diff --git a/.decent_ci-Linux.yaml b/.decent_ci-Linux.yaml index 28de42f0898..51ef3e60dec 100644 --- a/.decent_ci-Linux.yaml +++ b/.decent_ci-Linux.yaml @@ -1,13 +1,14 @@ compilers: - name: "gcc" - version: "11.4" + version: "13.3" cmake_extra_flags: -DLINK_WITH_PYTHON:BOOL=ON -DPYTHON_CLI:BOOL=OFF -DPython_REQUIRED_VERSION:STRING=3.12.2 -DPython_ROOT_DIR:PATH=~/.pyenv/versions/3.12.2/ -DBUILD_FORTRAN:BOOL=ON -DBUILD_TESTING:BOOL=ON -DENABLE_GTEST_DEBUG_MODE:BOOL=OFF -DBUILD_PERFORMANCE_TESTS:BOOL=ON -DVALGRIND_ANALYZE_PERFORMANCE_TESTS:BOOL=ON -DENABLE_PCH:BOOL=OFF collect_performance_results: true skip_regression: true s3_upload_bucket: energyplus + num_parallel_builds: 16 - name: "gcc" - version: "11.4" + version: "13.3" build_type: RelWithDebInfo cmake_extra_flags: -DLINK_WITH_PYTHON:BOOL=ON -DPYTHON_CLI:BOOL=OFF -DPython_REQUIRED_VERSION:STRING=3.12.2 -DPython_ROOT_DIR:PATH=~/.pyenv/versions/3.12.2/ -DBUILD_FORTRAN:BOOL=ON -DBUILD_TESTING:BOOL=ON -DENABLE_REGRESSION_TESTING:BOOL=OFF -DCOMMIT_SHA:STRING=$COMMIT_SHA -DENABLE_COVERAGE:BOOL=ON -DENABLE_GTEST_DEBUG_MODE:BOOL=OFF -DENABLE_PCH:BOOL=OFF coverage_enabled: true @@ -19,9 +20,10 @@ compilers: ctest_filter: -E "integration.*" skip_regression: true skip_packaging: true + num_parallel_builds: 16 - name: "gcc" - version: "11.4" + version: "13.3" build_type: RelWithDebInfo cmake_extra_flags: -DLINK_WITH_PYTHON:BOOL=ON -DPYTHON_CLI:BOOL=OFF -DPython_REQUIRED_VERSION:STRING=3.12.2 -DPython_ROOT_DIR:PATH=~/.pyenv/versions/3.12.2/ -DBUILD_FORTRAN:BOOL=ON -DBUILD_TESTING:BOOL=ON -DENABLE_REGRESSION_TESTING:BOOL=OFF -DCOMMIT_SHA:STRING=$COMMIT_SHA -DENABLE_COVERAGE:BOOL=ON -DENABLE_GTEST_DEBUG_MODE:BOOL=OFF -DENABLE_PCH:BOOL=OFF coverage_enabled: true @@ -33,3 +35,4 @@ compilers: ctest_filter: -R "integration.*" skip_regression: true skip_packaging: true + num_parallel_builds: 16 diff --git a/.decent_ci.yaml b/.decent_ci.yaml index 011ef0a2485..a80d9aee629 100644 --- a/.decent_ci.yaml +++ b/.decent_ci.yaml @@ -2,7 +2,7 @@ results_repository : Myoldmopar/EnergyPlusBuildResults results_path : _posts results_base_url : https://myoldmopar.github.io/EnergyPlusBuildResults regression_repository : NREL/EnergyPlusRegressionTool -regression_branch : BumpToBoto3 # this is the branch of NREL/EnergyPlusRegressionTool to use (usually main) +regression_branch : main # this is the branch of NREL/EnergyPlusRegressionTool to use (usually main) regression_baseline_default : develop # this is the NREL/EnergyPlus branch to use as the baseline for regressions regression_baseline_develop : "" regression_baseline_master : "" diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 22f26f5ac6d..b7621abf696 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -232,6 +232,10 @@ a9778bafea2ee3e92c6671144fa08d1394f11099 64b07699758bdf5f8bcd1211338e0428c80684c3 # 1005 files changed, 1006 insertions(+), 1006 deletions(-) +# Update the license scripts a bit [Jason W. DeGraw, 2023-01-04] +b2d55beb46c49fbb7bf84364d3a45f86e554a826 +# 2 files changed, 36 insertions(+), 17 deletions(-) + # Merge pull request #9781 from NREL/update-license-year [Michael J. Witte, 2023-01-04] 0ff3e33ff6d1d60abcaeb02f021f459840a2faa2 @@ -246,6 +250,13 @@ a9778bafea2ee3e92c6671144fa08d1394f11099 # Merge pull request #10352 from NREL/update-license-year-2024 [Edwin Lee, 2024-01-02] 6fafbb763fe676012f5db10da7b3e8449f578094 +# Update the license year to 2025 [Jason W. DeGraw, 2025-01-01] +5b2874d37a39aa528c7fba0d87b675d2d30cc146 +# 1053 files changed, 1059 insertions(+), 1056 deletions(-) + +# Merge pull request #10886 from NREL/update-license-year-2025 [Edwin Lee, 2025-01-08] +b46ced64a420a7df09af0f301499d0548ac89966 + ####################################################################### # S T Y L E B O T # ####################################################################### @@ -494,10 +505,6 @@ deb313430ea9b1cc2c0bb679c376689db32eeb17 c8f9fbba47a5425fbb4220285f70d0017f6f65b4 # 2 files changed, 2 insertions(+) -# Apply clang-format to src/EnergyPlus and tst/EnergyPlus/unit [Edwin Lee, 2021-03-30] -33b71ed598f37c10e9bfb6492e2a2103ba24e3dd -# 762 files changed, 397748 insertions(+), 351788 deletions(-) - # `python change_version.py ../../ 9.3 9.4` [chore] [Julien Marrec, 2020-04-10] 07ff20c0f9d89bde22c8f0b7a9dbbfe716339afd # 761 files changed, 795 insertions(+), 795 deletions(-) @@ -505,3 +512,19 @@ c8f9fbba47a5425fbb4220285f70d0017f6f65b4 # [chore] clang-format the FMI and FMUParser directories, hard to read. [Julien Marrec, 2020-11-24] 98dbfac765fbcf327681ecb13fb79a368363be9e # 26 files changed, 4230 insertions(+), 3938 deletions(-) + +# Apply clang-format to src/EnergyPlus and tst/EnergyPlus/unit [Edwin Lee, 2021-03-30] +33b71ed598f37c10e9bfb6492e2a2103ba24e3dd +# 762 files changed, 397748 insertions(+), 351788 deletions(-) + +# Add copyright header to EPVector.hh [Jason Turner, 2021-04-09] +fec99239575da7f77999cf82f4140f38a8026b80 +# 1 file changed, 51 insertions(+), 4 deletions(-) + +# clang-format [chore] [Julien Marrec, 2021-06-21] +7d40fa29de91752d5d449fe9be45a008c236fefb +# 2 files changed, 17 insertions(+), 17 deletions(-) + +# [chore] Typo cooing -> cooling [Julien Marrec, 2025-01-23] +ab5c96312d0cddec395e9616f23a8bd5f433ac6e +# 25 files changed, 132 insertions(+), 131 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/01-bug-report.yml b/.github/ISSUE_TEMPLATE/01-bug-report.yml new file mode 100644 index 00000000000..d718b3d5c38 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/01-bug-report.yml @@ -0,0 +1,74 @@ +name: Bug Report +description: Use this template for reporting an issue. +labels: Triage, UnconfirmedDefect +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to submit a report. + Include all applicable information to help us reproduce. + + - type: textarea + id: description + attributes: + label: Issue overview + description: | + Please change this line to a description of the defect, with useful supporting information including how the issue was found, + conditions that trigger this defect, workarounds for users of the current version, + and a clear description of how to validate that a fix is complete for this defect. + + You **can supply a link to your IDF if applicable**, or rename it to in.idf.txt and upload it directly here by drag and drop + placeholder: Include all applicable information with details to help us reproduce your problem. + validations: + required: true + + - type: dropdown + id: operating_system_multiple + attributes: + label: Operating System (Multiple choices) + multiple: true + description: What Operating System are you encountering issues on? + options: + - Windows + - Ubuntu + - MacOS + - Any + - Other + validations: + required: true + + - type: input + id: operating_system_version + attributes: + label: Operating System Version + placeholder: ex. 24.04 + validations: + required: true + + - type: input + id: eplus_version + attributes: + label: Version of EnergyPlus + description: if using an intermediate build, include SHA + placeholder: ex. 24.2.0 + validations: + required: true + + - type: input + id: uh_helpdesk_link + attributes: + label: Unmethours link or helpdesk ticket number + placeholder: ex. 24.2.0 + value: N/A + validations: + required: false + + - type: textarea + id: defect_file + attributes: + label: Defect file + description: | + You **can supply a link to your IDF if applicable**, or rename it to in.idf.txt and upload it directly here by drag and drop. + + Ideally, make it a _Minimum, Complete, Verifiable, Example (MCVE)_ by including the smallest possible number of input objects to reproduce the defect. + A good start might be to try to reproduce your issue with one of the EnergyPlus [ExampleFiles](https://github.com/NREL/EnergyPlus/tree/develop/testfiles). diff --git a/.github/ISSUE_TEMPLATE/02-enhancement-request.yml b/.github/ISSUE_TEMPLATE/02-enhancement-request.yml new file mode 100644 index 00000000000..a20aaa3c3a9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/02-enhancement-request.yml @@ -0,0 +1,38 @@ +name: Enhancement Request +description: Use this template for suggesting an enhancement. +labels: Triage, NewFeatureRequest +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to submit a report. + Include all applicable information to help us reproduce. + + - type: textarea + id: summary + attributes: + label: General Summary + description: | + Provide a general summary of the feature you would like to see implemented + validations: + required: true + + - type: textarea + id: details + attributes: + label: Detailed Description + description: | + Provide a detailed description of the change or addition you are proposing. + + Include screenshots, schemas, IDD/IDF snippets as appropriate. + validations: + required: true + + - type: textarea + id: implementation + attributes: + label: Possible Implementation + description: | + Not mandatory, but if you can, suggest an idea for implementing the feature + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000000..2029ba22a01 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: Unmet Hours + url: https://unmethours.com + about: "Ask modeling **questions** on unmethours.com" + - name: Helpdesk + url: https://energyplushelp.freshdesk.com/support/home + about: The EnergyPlus Helpdesk has a knowledge base and entry forms for submitting help requests and bug reports diff --git a/.github/issue_template.md b/.github/issue_template.md deleted file mode 100644 index 9f6d70d9310..00000000000 --- a/.github/issue_template.md +++ /dev/null @@ -1,16 +0,0 @@ -Issue overview --------------- -Please change this line to a description of the defect, with useful supporting information including how the issue was found, conditions that trigger this defect, workarounds for users of the current version, and a clear description of how to validate that a fix is complete for this defect. - -### Details -Some additional details for this issue (if relevant): - - Platform (Operating system, version) - - Version of EnergyPlus (if using an intermediate build, include SHA) - - Unmethours link or helpdesk ticket number - -### Checklist -Add to this list or remove from it as applicable. This is a simple templated set of guidelines. - - [ ] Defect file added (list location of defect file here) - - [ ] Ticket added to EnergyPlus Defect Complexity (Github Project) - - [ ] Pull request created (the pull request will have additional tasks related to reviewing changes that fix this defect) - diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 6384313abec..641ae551cdc 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,12 +1,18 @@ Pull request overview --------------------- - - Fixes #ISSUENUMBERHERE (IF THIS IS A DEFECT) - - DESCRIBE PURPOSE OF THIS PULL REQUEST -**NOTE: ENHANCEMENTS MUST FOLLOW A SUBMISSION PROCESS INCLUDING A FEATURE PROPOSAL AND DESIGN DOCUMENT PRIOR TO SUBMITTING CODE** +- Fixes #ISSUENUMBERHERE + + + +### Description of the purpose of this PR + + ### Pull Request Author -Add to this list or remove from it as applicable. This is a simple templated set of guidelines. + + + - [ ] Title of PR should be user-synopsis style (clearly understandable in a standalone changelog context) - [ ] Label the PR with at least one of: Defect, Refactoring, NewFeature, Performance, and/or DoNoPublish - [ ] Pull requests that impact EnergyPlus code must also include unit tests to cover enhancement or defect repair @@ -19,7 +25,9 @@ Add to this list or remove from it as applicable. This is a simple templated se - [ ] If adding/removing any LaTeX docs or figures, update that document's CMakeLists file dependencies ### Reviewer -This will not be exhaustively relevant to every PR. + + + - [ ] Perform a Code Review on GitHub - [ ] If branch is behind develop, merge develop and build locally to check for side effects of the merge - [ ] If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 405e19732d3..ea075493d95 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -47,7 +47,7 @@ jobs: path: ./dist - name: Deploy on Test PyPi - uses: pypa/gh-action-pypi-publish@v1.10.3 + uses: pypa/gh-action-pypi-publish@v1.12.4 with: repository-url: https://test.pypi.org/legacy/ user: __token__ diff --git a/.github/workflows/cpp-problem-matcher.json b/.github/workflows/cpp-problem-matcher.json new file mode 100644 index 00000000000..e7932b4950b --- /dev/null +++ b/.github/workflows/cpp-problem-matcher.json @@ -0,0 +1,17 @@ +{ + "problemMatcher": [ + { + "owner": "gcc-problem-matcher", + "pattern": [ + { + "regexp": "^(.*?):(\\d+):(\\d*):?\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$", + "file": 1, + "line": 2, + "column": 3, + "severity": 4, + "message": 5 + } + ] + } + ] +} diff --git a/.github/workflows/test_code_integrity.yml b/.github/workflows/test_code_integrity.yml index e3e228c5d62..9001751e46b 100644 --- a/.github/workflows/test_code_integrity.yml +++ b/.github/workflows/test_code_integrity.yml @@ -14,14 +14,14 @@ jobs: - uses: actions/checkout@v4 - name: Run clang-format style check for C/C++ source code. - uses: jidicula/clang-format-action@v4.13.0 + uses: jidicula/clang-format-action@v4.14.0 if: always() with: clang-format-version: '10' check-path: 'src/EnergyPlus' - name: Run clang-format style check for C/C++ unit test code. - uses: jidicula/clang-format-action@v4.13.0 + uses: jidicula/clang-format-action@v4.14.0 if: always() with: clang-format-version: '10' @@ -46,7 +46,8 @@ jobs: --force --std=c++17 --inline-suppr - --suppress=cppcheckError + --suppress=missingInclude + --suppress=missingIncludeSystem --suppress=unusedFunction:src/EnergyPlus/api/autosizing.cc --suppress=unusedFunction:src/EnergyPlus/api/datatransfer.cc --suppress=unusedFunction:src/EnergyPlus/api/func.cc diff --git a/.github/workflows/test_develop_commits.yml b/.github/workflows/test_develop_commits.yml index 0c1b2fbcb9a..111ca75c314 100644 --- a/.github/workflows/test_develop_commits.yml +++ b/.github/workflows/test_develop_commits.yml @@ -135,7 +135,10 @@ jobs: - name: Build id: build working-directory: ./build - run: cmake --build . -j ${{ matrix.nproc }} --config Release + run: | + echo "::add-matcher::./.github/workflows/cpp-problem-matcher.json" + cmake --build . -j ${{ matrix.nproc }} --config Release + echo "::remove-matcher owner=gcc-problem-matcher::" - name: Test # Not running test on alternate build yet, I need to test things diff --git a/.github/workflows/test_pull_requests.yml b/.github/workflows/test_pull_requests.yml index aafda588c84..7c49432587f 100644 --- a/.github/workflows/test_pull_requests.yml +++ b/.github/workflows/test_pull_requests.yml @@ -62,6 +62,7 @@ jobs: brew reinstall gcc@13 echo "FC=$(brew --prefix gcc@13)/bin/gfortran-13" >> $GITHUB_ENV echo MACOSX_DEPLOYMENT_TARGET=${{ matrix.macos_dev_target }} >> $GITHUB_ENV + pip install pytest lxml - name: Install Dependencies for Linux if: runner.os == 'Linux' @@ -72,6 +73,7 @@ jobs: # https://github.com/actions/runner-images/issues/10025 echo "FC=gfortran-13" >> $GITHUB_ENV fi + pip install pytest lxml # BUILD AND TEST INTEGRATION FILES ON THE BASELINE BRANCH @@ -155,7 +157,10 @@ jobs: - name: Branch Build id: branch_build working-directory: ./branch/build - run: cmake --build . -j ${{ matrix.nproc }} --config Release + run: | + echo "::add-matcher::./branch/.github/workflows/cpp-problem-matcher.json" + cmake --build . -j ${{ matrix.nproc }} --config Release + echo "::remove-matcher owner=gcc-problem-matcher::" - name: Branch Test working-directory: ./branch/build @@ -163,7 +168,7 @@ jobs: - name: Install Regression Tool if: always() && matrix.run_regressions && steps.branch_build.outcome != 'failure' # always run this step as long as we actually built - run: pip install energyplus-regressions + run: pip install energyplus-regressions>=2.1.1 # could rely on the requirements.txt file maybe - name: Run Regressions if: always() && matrix.run_regressions && steps.branch_build.outcome != 'failure' # always run this step as long as we actually built @@ -191,8 +196,16 @@ jobs: ${{ steps.upload_regressions.outputs.artifact-url }} - uses: actions/github-script@v7 - if: always() && matrix.run_regressions && steps.regressions.outcome == 'failure' + if: always() && matrix.run_regressions && steps.regressions.outcome == 'failure' && github.event.pull_request.head.repo.full_name == 'NREL/EnergyPlus' with: script: | const script = require('${{ github.workspace }}/regressions/summary.js') console.log(script({github, context})) + + # - uses: lhotari/action-upterm@v1 + + - name: Fail on Regressions from Forked Repository + if: always() && matrix.run_regressions && steps.regressions.outcome == 'failure' && github.event.pull_request.head.repo.full_name != 'NREL/EnergyPlus' + run: | + echo "::error::Regressions detected in pull request from forked repository, check job summary for details and to download regression results" + exit 1 diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d9416a4470..d5badfc00bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.17) +cmake_minimum_required(VERSION 3.19) # Use ccache if available, has to be before "project()" find_program(CCACHE_PROGRAM NAMES ccache sccache) @@ -35,6 +35,7 @@ cmake_policy(SET CMP0012 NEW) # if() recognizes boolean constants set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) set(CMAKE_POSITION_INDEPENDENT_CODE ON) +set(CMAKE_CXX_VISIBILITY_PRESET hidden) set_property(GLOBAL PROPERTY USE_FOLDERS ON) @@ -228,6 +229,21 @@ if(BUILD_TESTING) endif() set_property(GLOBAL PROPERTY CTEST_TARGETS_ADDED 1) # This avoids all the CTest Nightly, Continuous, etc. tests. enable_testing() + + execute_process(COMMAND ${Python_EXECUTABLE} -m pytest --version + RESULT_VARIABLE _Pytest_STATUS + OUTPUT_VARIABLE Pytest_Version + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(_Pytest_STATUS AND NOT _Pytest_STATUS EQUAL 0) + message(AUTHOR_WARNING "Pytest isn't installed on your system python, so some tests won't be run. Run `${Python_EXECUTABLE} -m pip install pytest`") + set(Pytest_AVAILABLE OFF) + else() + message(VERBOSE "Found Pytest: ${Pytest_Version}") + set(Pytest_AVAILABLE ON) + endif() + endif() if(ENABLE_REGRESSION_TESTING) diff --git a/LICENSE.txt b/LICENSE.txt index c9b07918624..ce4e412d864 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. +EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. NOTICE: This Software was developed under funding from the U.S. Department of Energy and the U.S. Government consequently retains certain rights. As such, the U.S. Government has been granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software to reproduce, distribute copies to the public, prepare derivative works, and perform publicly and display publicly, and to permit others to do so. diff --git a/cmake/PythonCopyStandardLib.py b/cmake/PythonCopyStandardLib.py index 7cc0f7a9723..1cb22ccd850 100644 --- a/cmake/PythonCopyStandardLib.py +++ b/cmake/PythonCopyStandardLib.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/cmake/PythonFixUpTclTk.py b/cmake/PythonFixUpTclTk.py index dac83009c72..3391be07f24 100644 --- a/cmake/PythonFixUpTclTk.py +++ b/cmake/PythonFixUpTclTk.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/cmake/PythonGetBitSize.py b/cmake/PythonGetBitSize.py index cc4d6e38562..9befc9d8bcc 100644 --- a/cmake/PythonGetBitSize.py +++ b/cmake/PythonGetBitSize.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/cmake/ReverseDDPostProcess.py b/cmake/ReverseDDPostProcess.py index 6777b567862..359912b2c05 100644 --- a/cmake/ReverseDDPostProcess.py +++ b/cmake/ReverseDDPostProcess.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/cmake/RunSimulation.cmake b/cmake/RunSimulation.cmake index acdc8ef61a2..62e5fce2c55 100644 --- a/cmake/RunSimulation.cmake +++ b/cmake/RunSimulation.cmake @@ -71,7 +71,7 @@ if(BUILD_FORTRAN) find_program(PARAMETRIC_EXE ParametricPreprocessor PATHS "${PRODUCT_PATH}" NO_DEFAULT_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH NO_CMAKE_FIND_ROOT_PATH) execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${IDF_PATH}" "${OUTPUT_DIR_PATH}") - execute_process(COMMAND "${PARAMETRIC_EXE}" "${IDF_FILE}" WORKING_DIRECTORY "${OUTPUT_DIR_PATH}") + execute_process(COMMAND "${PARAMETRIC_EXE}" "${IDF_FILE}" WORKING_DIRECTORY "${OUTPUT_DIR_PATH}" COMMAND_ERROR_IS_FATAL ANY) # this handles the LBuildingAppGRotPar parametric file if(EXISTS "${OUTPUT_DIR_PATH}/${IDF_NAME}-G000.idf") @@ -100,29 +100,48 @@ if(BUILD_FORTRAN) execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${IDF_PATH}" "${OUTPUT_DIR_PATH}/in.idf") execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${EPW_PATH}" "${OUTPUT_DIR_PATH}/in.epw") execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${PRODUCT_PATH}/Energy+.idd" "${OUTPUT_DIR_PATH}") - execute_process(COMMAND "${EXPANDOBJECTS_EXE}" WORKING_DIRECTORY "${OUTPUT_DIR_PATH}") + # This creates GHTIn.idf, and BasementGHTIn.idf IIF the GroundHeatTransfer:Control says to run it! + execute_process(COMMAND "${EXPANDOBJECTS_EXE}" WORKING_DIRECTORY "${OUTPUT_DIR_PATH}" COMMAND_ERROR_IS_FATAL ANY) if("${SLAB_RESULT}" GREATER -1) + if(NOT EXISTS "${OUTPUT_DIR_PATH}/GHTIn.idf") + string(REGEX MATCH "GroundHeatTransfer:Control.*Run Slab Preprocessor" GROUND_HT_CONTROL "${IDF_CONTENT}") + if (GROUND_HT_CONTROL) + message(FATAL_ERROR "Did not find ${OUTPUT_DIR_PATH}/GHTIn.idf, are you sure the GroundHeatTransfer:Control has Run Slab Preprocessor = Yes?\nGROUND_HT_CONTROL=${GROUND_HT_CONTROL}") + else() + message(FATAL_ERROR "Did not find ${OUTPUT_DIR_PATH}/GHTIn.idf, are you sure the GroundHeatTransfer:Control has Run Slab Preprocessor = Yes?") + endif() + endif() # Copy files needed for Slab file(COPY "${SOURCE_DIR}/idd/SlabGHT.idd" DESTINATION "${OUTPUT_DIR_PATH}") # Find and run slab find_program(SLAB_EXE Slab PATHS "${PRODUCT_PATH}" NO_DEFAULT_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH NO_CMAKE_FIND_ROOT_PATH) message("Executing Slab from ${SLAB_EXE}") - execute_process(COMMAND "${SLAB_EXE}" WORKING_DIRECTORY "${OUTPUT_DIR_PATH}") + # This creates SLABINP.TXT, SLABSplit Surface Temps.TXT, and SLABSurfaceTemps.TXT + execute_process(COMMAND "${SLAB_EXE}" WORKING_DIRECTORY "${OUTPUT_DIR_PATH}" COMMAND_ERROR_IS_FATAL ANY) # Then copy slab results into the expanded file file(READ "${OUTPUT_DIR_PATH}/SLABSurfaceTemps.TXT" SLAB_CONTENTS) file(APPEND "${OUTPUT_DIR_PATH}/expanded.idf" "${SLAB_CONTENTS}") endif() if("${BASEMENT_RESULT}" GREATER -1) + if(NOT EXISTS "${OUTPUT_DIR_PATH}/BasementGHTIn.idf") + string(REGEX MATCH "GroundHeatTransfer:Control.*Run Slab Preprocessor" GROUND_HT_CONTROL "${IDF_CONTENT}") + if (GROUND_HT_CONTROL) + message(FATAL_ERROR "Did not find ${OUTPUT_DIR_PATH}/BasementGHTIn.idf, are you sure the GroundHeatTransfer:Control has Run Basement Preprocessor = Yes?\nGROUND_HT_CONTROL=${GROUND_HT_CONTROL}") + else() + message(FATAL_ERROR "Did not find ${OUTPUT_DIR_PATH}/BasementGHTIn.idf, are you sure the GroundHeatTransfer:Control has Run Basement Preprocessor = Yes?") + endif() + endif() + # Copy files needed for Basement file(COPY "${SOURCE_DIR}/idd/BasementGHT.idd" DESTINATION "${OUTPUT_DIR_PATH}") # Find and run basement find_program(BASEMENT_EXE Basement PATHS "${PRODUCT_PATH}" NO_DEFAULT_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH NO_CMAKE_FIND_ROOT_PATH) message("Executing Basement from ${BASEMENT_EXE}") - execute_process(COMMAND "${BASEMENT_EXE}" WORKING_DIRECTORY "${OUTPUT_DIR_PATH}") + execute_process(COMMAND "${BASEMENT_EXE}" WORKING_DIRECTORY "${OUTPUT_DIR_PATH}" COMMAND_ERROR_IS_FATAL ANY) # Then copy basement results into the expanded file file(READ "${OUTPUT_DIR_PATH}/EPObjects.TXT" BASEMENT_CONTENTS) file(APPEND "${OUTPUT_DIR_PATH}/expanded.idf" "${BASEMENT_CONTENTS}") diff --git a/cmake/codesign_doc/conf.py b/cmake/codesign_doc/conf.py index 0c8c9e910d0..1dd25d61b96 100644 --- a/cmake/codesign_doc/conf.py +++ b/cmake/codesign_doc/conf.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/datasets/LCCusePriceEscalationDataSet2023.idf b/datasets/LCCusePriceEscalationDataSet2023.idf new file mode 100644 index 00000000000..3e84422e504 --- /dev/null +++ b/datasets/LCCusePriceEscalationDataSet2023.idf @@ -0,0 +1,2361 @@ +! The source of the values for the following objects is: +! +! NISTIR 85-3273-34 +! +! ENERGY PRICE INDICES AND DISCOUNT FACTORS +! FOR LIFE-CYCLE COST ANALYSIS - 2023 +! +! Annual Supplement to NIST Handbook 135 +! +! Priya D. Lavappa +! Joshua D. Kneifel +! +! These are factors for the United States and regions of the United States. +! +! The factors are from a file available upon request from NIST called ENCOSTxx.TXT and are +! converted into EnergyPlus objects using scripts/dev/update_nist_escalation.py +! https://www.energy.gov/eere/femp/building-life-cycle-cost-programs +! +! Joshua D. Kneifel (2023), Data tables for Energy Price Indices and Discount Factors for Life-Cycle Cost Analysis - 2023: +! Annual Supplement to NIST Handbook 135, National Institute of Standards and Technology, https://doi.org/10.18434/mds2-3069 + +LifeCycleCost:UsePriceEscalation, + NorthEast Residential-Electricity, !- Name + Electricity, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 1.0074, !- Year 1 Escalation [2024] + 1.0037, !- Year 2 Escalation [2025] + 0.9935, !- Year 3 Escalation [2026] + 0.9917, !- Year 4 Escalation [2027] + 0.9943, !- Year 5 Escalation [2028] + 0.9998, !- Year 6 Escalation [2029] + 1.0039, !- Year 7 Escalation [2030] + 1.0111, !- Year 8 Escalation [2031] + 1.0245, !- Year 9 Escalation [2032] + 1.0374, !- Year 10 Escalation [2033] + 1.0546, !- Year 11 Escalation [2034] + 1.0592, !- Year 12 Escalation [2035] + 1.0686, !- Year 13 Escalation [2036] + 1.0764, !- Year 14 Escalation [2037] + 1.0880, !- Year 15 Escalation [2038] + 1.1011, !- Year 16 Escalation [2039] + 1.1098, !- Year 17 Escalation [2040] + 1.1182, !- Year 18 Escalation [2041] + 1.1247, !- Year 19 Escalation [2042] + 1.1297, !- Year 20 Escalation [2043] + 1.1280, !- Year 21 Escalation [2044] + 1.1275, !- Year 22 Escalation [2045] + 1.1273, !- Year 23 Escalation [2046] + 1.1251, !- Year 24 Escalation [2047] + 1.1245, !- Year 25 Escalation [2048] + 1.1138, !- Year 26 Escalation [2049] + 1.1050, !- Year 27 Escalation [2050] + 1.0996, !- Year 28 Escalation [2051] + 1.0948, !- Year 29 Escalation [2052] + 1.0900; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + NorthEast Residential-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9563, !- Year 1 Escalation [2024] + 0.9114, !- Year 2 Escalation [2025] + 0.8899, !- Year 3 Escalation [2026] + 0.8772, !- Year 4 Escalation [2027] + 0.8683, !- Year 5 Escalation [2028] + 0.8686, !- Year 6 Escalation [2029] + 0.8698, !- Year 7 Escalation [2030] + 0.8739, !- Year 8 Escalation [2031] + 0.8775, !- Year 9 Escalation [2032] + 0.8810, !- Year 10 Escalation [2033] + 0.8828, !- Year 11 Escalation [2034] + 0.8875, !- Year 12 Escalation [2035] + 0.8893, !- Year 13 Escalation [2036] + 0.8922, !- Year 14 Escalation [2037] + 0.8955, !- Year 15 Escalation [2038] + 0.8973, !- Year 16 Escalation [2039] + 0.8987, !- Year 17 Escalation [2040] + 0.9029, !- Year 18 Escalation [2041] + 0.9037, !- Year 19 Escalation [2042] + 0.9064, !- Year 20 Escalation [2043] + 0.9055, !- Year 21 Escalation [2044] + 0.9058, !- Year 22 Escalation [2045] + 0.9105, !- Year 23 Escalation [2046] + 0.9129, !- Year 24 Escalation [2047] + 0.9141, !- Year 25 Escalation [2048] + 0.9161, !- Year 26 Escalation [2049] + 0.9167, !- Year 27 Escalation [2050] + 0.9185, !- Year 28 Escalation [2051] + 0.9206, !- Year 29 Escalation [2052] + 0.9229; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + NorthEast Residential-Natural Gas, !- Name + NaturalGas, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9136, !- Year 1 Escalation [2024] + 0.8567, !- Year 2 Escalation [2025] + 0.8217, !- Year 3 Escalation [2026] + 0.7956, !- Year 4 Escalation [2027] + 0.7771, !- Year 5 Escalation [2028] + 0.7764, !- Year 6 Escalation [2029] + 0.7723, !- Year 7 Escalation [2030] + 0.7709, !- Year 8 Escalation [2031] + 0.7716, !- Year 9 Escalation [2032] + 0.7757, !- Year 10 Escalation [2033] + 0.7778, !- Year 11 Escalation [2034] + 0.7785, !- Year 12 Escalation [2035] + 0.7798, !- Year 13 Escalation [2036] + 0.7833, !- Year 14 Escalation [2037] + 0.7915, !- Year 15 Escalation [2038] + 0.7949, !- Year 16 Escalation [2039] + 0.7977, !- Year 17 Escalation [2040] + 0.8032, !- Year 18 Escalation [2041] + 0.8052, !- Year 19 Escalation [2042] + 0.8038, !- Year 20 Escalation [2043] + 0.7990, !- Year 21 Escalation [2044] + 0.8032, !- Year 22 Escalation [2045] + 0.8032, !- Year 23 Escalation [2046] + 0.7977, !- Year 24 Escalation [2047] + 0.7915, !- Year 25 Escalation [2048] + 0.7901, !- Year 26 Escalation [2049] + 0.7949, !- Year 27 Escalation [2050] + 0.7956, !- Year 28 Escalation [2051] + 0.7936, !- Year 29 Escalation [2052] + 0.7922; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + NorthEast Residential-LPG, !- Name + Propane, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 1.0241, !- Year 1 Escalation [2024] + 1.0000, !- Year 2 Escalation [2025] + 0.9642, !- Year 3 Escalation [2026] + 0.9337, !- Year 4 Escalation [2027] + 0.9141, !- Year 5 Escalation [2028] + 0.9051, !- Year 6 Escalation [2029] + 0.9057, !- Year 7 Escalation [2030] + 0.9135, !- Year 8 Escalation [2031] + 0.9272, !- Year 9 Escalation [2032] + 0.9451, !- Year 10 Escalation [2033] + 0.9644, !- Year 11 Escalation [2034] + 0.9810, !- Year 12 Escalation [2035] + 0.9933, !- Year 13 Escalation [2036] + 1.0039, !- Year 14 Escalation [2037] + 1.0165, !- Year 15 Escalation [2038] + 1.0246, !- Year 16 Escalation [2039] + 1.0342, !- Year 17 Escalation [2040] + 1.0445, !- Year 18 Escalation [2041] + 1.0524, !- Year 19 Escalation [2042] + 1.0571, !- Year 20 Escalation [2043] + 1.0588, !- Year 21 Escalation [2044] + 1.0602, !- Year 22 Escalation [2045] + 1.0613, !- Year 23 Escalation [2046] + 1.0624, !- Year 24 Escalation [2047] + 1.0647, !- Year 25 Escalation [2048] + 1.0658, !- Year 26 Escalation [2049] + 1.0655, !- Year 27 Escalation [2050] + 1.0661, !- Year 28 Escalation [2051] + 1.0669, !- Year 29 Escalation [2052] + 1.0680; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + NorthEast Commercial-Electricity, !- Name + Electricity, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9947, !- Year 1 Escalation [2024] + 0.9779, !- Year 2 Escalation [2025] + 0.9565, !- Year 3 Escalation [2026] + 0.9491, !- Year 4 Escalation [2027] + 0.9458, !- Year 5 Escalation [2028] + 0.9420, !- Year 6 Escalation [2029] + 0.9393, !- Year 7 Escalation [2030] + 0.9395, !- Year 8 Escalation [2031] + 0.9462, !- Year 9 Escalation [2032] + 0.9552, !- Year 10 Escalation [2033] + 0.9687, !- Year 11 Escalation [2034] + 0.9729, !- Year 12 Escalation [2035] + 0.9777, !- Year 13 Escalation [2036] + 0.9805, !- Year 14 Escalation [2037] + 0.9916, !- Year 15 Escalation [2038] + 1.0061, !- Year 16 Escalation [2039] + 1.0126, !- Year 17 Escalation [2040] + 1.0193, !- Year 18 Escalation [2041] + 1.0231, !- Year 19 Escalation [2042] + 1.0269, !- Year 20 Escalation [2043] + 1.0229, !- Year 21 Escalation [2044] + 1.0174, !- Year 22 Escalation [2045] + 1.0141, !- Year 23 Escalation [2046] + 1.0071, !- Year 24 Escalation [2047] + 1.0040, !- Year 25 Escalation [2048] + 0.9889, !- Year 26 Escalation [2049] + 0.9763, !- Year 27 Escalation [2050] + 0.9676, !- Year 28 Escalation [2051] + 0.9594, !- Year 29 Escalation [2052] + 0.9512; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + NorthEast Commercial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9316, !- Year 1 Escalation [2024] + 0.8527, !- Year 2 Escalation [2025] + 0.7961, !- Year 3 Escalation [2026] + 0.7480, !- Year 4 Escalation [2027] + 0.7039, !- Year 5 Escalation [2028] + 0.6951, !- Year 6 Escalation [2029] + 0.6957, !- Year 7 Escalation [2030] + 0.6994, !- Year 8 Escalation [2031] + 0.7022, !- Year 9 Escalation [2032] + 0.7048, !- Year 10 Escalation [2033] + 0.7065, !- Year 11 Escalation [2034] + 0.7100, !- Year 12 Escalation [2035] + 0.7114, !- Year 13 Escalation [2036] + 0.7137, !- Year 14 Escalation [2037] + 0.7160, !- Year 15 Escalation [2038] + 0.7171, !- Year 16 Escalation [2039] + 0.7180, !- Year 17 Escalation [2040] + 0.7211, !- Year 18 Escalation [2041] + 0.7217, !- Year 19 Escalation [2042] + 0.7234, !- Year 20 Escalation [2043] + 0.7214, !- Year 21 Escalation [2044] + 0.7214, !- Year 22 Escalation [2045] + 0.7254, !- Year 23 Escalation [2046] + 0.7265, !- Year 24 Escalation [2047] + 0.7265, !- Year 25 Escalation [2048] + 0.7271, !- Year 26 Escalation [2049] + 0.7265, !- Year 27 Escalation [2050] + 0.7271, !- Year 28 Escalation [2051] + 0.7280, !- Year 29 Escalation [2052] + 0.7288; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + NorthEast Commercial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 1.0175, !- Year 1 Escalation [2024] + 1.0901, !- Year 2 Escalation [2025] + 1.2222, !- Year 3 Escalation [2026] + 1.3918, !- Year 4 Escalation [2027] + 1.5614, !- Year 5 Escalation [2028] + 1.6140, !- Year 6 Escalation [2029] + 1.6234, !- Year 7 Escalation [2030] + 1.6363, !- Year 8 Escalation [2031] + 1.6480, !- Year 9 Escalation [2032] + 1.6585, !- Year 10 Escalation [2033] + 1.6702, !- Year 11 Escalation [2034] + 1.6830, !- Year 12 Escalation [2035] + 1.6947, !- Year 13 Escalation [2036] + 1.7053, !- Year 14 Escalation [2037] + 1.7181, !- Year 15 Escalation [2038] + 1.7263, !- Year 16 Escalation [2039] + 1.7357, !- Year 17 Escalation [2040] + 1.7497, !- Year 18 Escalation [2041] + 1.7544, !- Year 19 Escalation [2042] + 1.7602, !- Year 20 Escalation [2043] + 1.7661, !- Year 21 Escalation [2044] + 1.7731, !- Year 22 Escalation [2045] + 1.7883, !- Year 23 Escalation [2046] + 1.7930, !- Year 24 Escalation [2047] + 1.8035, !- Year 25 Escalation [2048] + 1.8152, !- Year 26 Escalation [2049] + 1.8234, !- Year 27 Escalation [2050] + 1.8339, !- Year 28 Escalation [2051] + 1.8444, !- Year 29 Escalation [2052] + 1.8550; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + NorthEast Commercial-Natural Gas, !- Name + NaturalGas, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9134, !- Year 1 Escalation [2024] + 0.8516, !- Year 2 Escalation [2025] + 0.8083, !- Year 3 Escalation [2026] + 0.7760, !- Year 4 Escalation [2027] + 0.7521, !- Year 5 Escalation [2028] + 0.7484, !- Year 6 Escalation [2029] + 0.7419, !- Year 7 Escalation [2030] + 0.7382, !- Year 8 Escalation [2031] + 0.7373, !- Year 9 Escalation [2032] + 0.7410, !- Year 10 Escalation [2033] + 0.7429, !- Year 11 Escalation [2034] + 0.7429, !- Year 12 Escalation [2035] + 0.7438, !- Year 13 Escalation [2036] + 0.7484, !- Year 14 Escalation [2037] + 0.7594, !- Year 15 Escalation [2038] + 0.7641, !- Year 16 Escalation [2039] + 0.7677, !- Year 17 Escalation [2040] + 0.7751, !- Year 18 Escalation [2041] + 0.7779, !- Year 19 Escalation [2042] + 0.7770, !- Year 20 Escalation [2043] + 0.7705, !- Year 21 Escalation [2044] + 0.7760, !- Year 22 Escalation [2045] + 0.7760, !- Year 23 Escalation [2046] + 0.7696, !- Year 24 Escalation [2047] + 0.7622, !- Year 25 Escalation [2048] + 0.7604, !- Year 26 Escalation [2049] + 0.7668, !- Year 27 Escalation [2050] + 0.7677, !- Year 28 Escalation [2051] + 0.7659, !- Year 29 Escalation [2052] + 0.7641; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + NorthEast Industrial-Electricity, !- Name + Electricity, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9776, !- Year 1 Escalation [2024] + 0.9416, !- Year 2 Escalation [2025] + 0.9024, !- Year 3 Escalation [2026] + 0.8775, !- Year 4 Escalation [2027] + 0.8583, !- Year 5 Escalation [2028] + 0.8465, !- Year 6 Escalation [2029] + 0.8380, !- Year 7 Escalation [2030] + 0.8348, !- Year 8 Escalation [2031] + 0.8394, !- Year 9 Escalation [2032] + 0.8451, !- Year 10 Escalation [2033] + 0.8486, !- Year 11 Escalation [2034] + 0.8433, !- Year 12 Escalation [2035] + 0.8454, !- Year 13 Escalation [2036] + 0.8469, !- Year 14 Escalation [2037] + 0.8551, !- Year 15 Escalation [2038] + 0.8689, !- Year 16 Escalation [2039] + 0.8743, !- Year 17 Escalation [2040] + 0.8793, !- Year 18 Escalation [2041] + 0.8807, !- Year 19 Escalation [2042] + 0.8778, !- Year 20 Escalation [2043] + 0.8729, !- Year 21 Escalation [2044] + 0.8679, !- Year 22 Escalation [2045] + 0.8604, !- Year 23 Escalation [2046] + 0.8522, !- Year 24 Escalation [2047] + 0.8465, !- Year 25 Escalation [2048] + 0.8344, !- Year 26 Escalation [2049] + 0.8216, !- Year 27 Escalation [2050] + 0.8116, !- Year 28 Escalation [2051] + 0.8024, !- Year 29 Escalation [2052] + 0.7934; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + NorthEast Industrial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9315, !- Year 1 Escalation [2024] + 0.8525, !- Year 2 Escalation [2025] + 0.7963, !- Year 3 Escalation [2026] + 0.7488, !- Year 4 Escalation [2027] + 0.7045, !- Year 5 Escalation [2028] + 0.6960, !- Year 6 Escalation [2029] + 0.6972, !- Year 7 Escalation [2030] + 0.7013, !- Year 8 Escalation [2031] + 0.7045, !- Year 9 Escalation [2032] + 0.7077, !- Year 10 Escalation [2033] + 0.7100, !- Year 11 Escalation [2034] + 0.7141, !- Year 12 Escalation [2035] + 0.7158, !- Year 13 Escalation [2036] + 0.7187, !- Year 14 Escalation [2037] + 0.7219, !- Year 15 Escalation [2038] + 0.7237, !- Year 16 Escalation [2039] + 0.7252, !- Year 17 Escalation [2040] + 0.7292, !- Year 18 Escalation [2041] + 0.7304, !- Year 19 Escalation [2042] + 0.7330, !- Year 20 Escalation [2043] + 0.7321, !- Year 21 Escalation [2044] + 0.7327, !- Year 22 Escalation [2045] + 0.7377, !- Year 23 Escalation [2046] + 0.7400, !- Year 24 Escalation [2047] + 0.7412, !- Year 25 Escalation [2048] + 0.7429, !- Year 26 Escalation [2049] + 0.7438, !- Year 27 Escalation [2050] + 0.7456, !- Year 28 Escalation [2051] + 0.7476, !- Year 29 Escalation [2052] + 0.7499; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + NorthEast Industrial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 1.0211, !- Year 1 Escalation [2024] + 1.0971, !- Year 2 Escalation [2025] + 1.2327, !- Year 3 Escalation [2026] + 1.4070, !- Year 4 Escalation [2027] + 1.5778, !- Year 5 Escalation [2028] + 1.6304, !- Year 6 Escalation [2029] + 1.6409, !- Year 7 Escalation [2030] + 1.6538, !- Year 8 Escalation [2031] + 1.6667, !- Year 9 Escalation [2032] + 1.6784, !- Year 10 Escalation [2033] + 1.6901, !- Year 11 Escalation [2034] + 1.7029, !- Year 12 Escalation [2035] + 1.7146, !- Year 13 Escalation [2036] + 1.7251, !- Year 14 Escalation [2037] + 1.7380, !- Year 15 Escalation [2038] + 1.7462, !- Year 16 Escalation [2039] + 1.7556, !- Year 17 Escalation [2040] + 1.7696, !- Year 18 Escalation [2041] + 1.7743, !- Year 19 Escalation [2042] + 1.7813, !- Year 20 Escalation [2043] + 1.7871, !- Year 21 Escalation [2044] + 1.7942, !- Year 22 Escalation [2045] + 1.8094, !- Year 23 Escalation [2046] + 1.8140, !- Year 24 Escalation [2047] + 1.8246, !- Year 25 Escalation [2048] + 1.8363, !- Year 26 Escalation [2049] + 1.8456, !- Year 27 Escalation [2050] + 1.8550, !- Year 28 Escalation [2051] + 1.8655, !- Year 29 Escalation [2052] + 1.8760; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + NorthEast Industrial-Natural Gas, !- Name + NaturalGas, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.8881, !- Year 1 Escalation [2024] + 0.7928, !- Year 2 Escalation [2025] + 0.7238, !- Year 3 Escalation [2026] + 0.6782, !- Year 4 Escalation [2027] + 0.6506, !- Year 5 Escalation [2028] + 0.6423, !- Year 6 Escalation [2029] + 0.6367, !- Year 7 Escalation [2030] + 0.6367, !- Year 8 Escalation [2031] + 0.6409, !- Year 9 Escalation [2032] + 0.6506, !- Year 10 Escalation [2033] + 0.6588, !- Year 11 Escalation [2034] + 0.6657, !- Year 12 Escalation [2035] + 0.6713, !- Year 13 Escalation [2036] + 0.6796, !- Year 14 Escalation [2037] + 0.6934, !- Year 15 Escalation [2038] + 0.7003, !- Year 16 Escalation [2039] + 0.7058, !- Year 17 Escalation [2040] + 0.7127, !- Year 18 Escalation [2041] + 0.7113, !- Year 19 Escalation [2042] + 0.7058, !- Year 20 Escalation [2043] + 0.6989, !- Year 21 Escalation [2044] + 0.6989, !- Year 22 Escalation [2045] + 0.6961, !- Year 23 Escalation [2046] + 0.6878, !- Year 24 Escalation [2047] + 0.6782, !- Year 25 Escalation [2048] + 0.6727, !- Year 26 Escalation [2049] + 0.6754, !- Year 27 Escalation [2050] + 0.6727, !- Year 28 Escalation [2051] + 0.6685, !- Year 29 Escalation [2052] + 0.6630; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + NorthEast Industrial-Coal, !- Name + Coal, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 1.0156, !- Year 1 Escalation [2024] + 1.0402, !- Year 2 Escalation [2025] + 1.0335, !- Year 3 Escalation [2026] + 1.0469, !- Year 4 Escalation [2027] + 1.0491, !- Year 5 Escalation [2028] + 1.0491, !- Year 6 Escalation [2029] + 1.0513, !- Year 7 Escalation [2030] + 1.0536, !- Year 8 Escalation [2031] + 1.0580, !- Year 9 Escalation [2032] + 1.0625, !- Year 10 Escalation [2033] + 1.0692, !- Year 11 Escalation [2034] + 1.0759, !- Year 12 Escalation [2035] + 1.0826, !- Year 13 Escalation [2036] + 1.0915, !- Year 14 Escalation [2037] + 1.1004, !- Year 15 Escalation [2038] + 1.1071, !- Year 16 Escalation [2039] + 1.1116, !- Year 17 Escalation [2040] + 1.0357, !- Year 18 Escalation [2041] + 1.0089, !- Year 19 Escalation [2042] + 1.0089, !- Year 20 Escalation [2043] + 1.0089, !- Year 21 Escalation [2044] + 1.0089, !- Year 22 Escalation [2045] + 1.0089, !- Year 23 Escalation [2046] + 1.0089, !- Year 24 Escalation [2047] + 1.0089, !- Year 25 Escalation [2048] + 1.0089, !- Year 26 Escalation [2049] + 1.0089, !- Year 27 Escalation [2050] + 1.0089, !- Year 28 Escalation [2051] + 1.0089, !- Year 29 Escalation [2052] + 1.0089; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + MidWest Residential-Electricity, !- Name + Electricity, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9864, !- Year 1 Escalation [2024] + 0.9667, !- Year 2 Escalation [2025] + 0.9494, !- Year 3 Escalation [2026] + 0.9322, !- Year 4 Escalation [2027] + 0.9221, !- Year 5 Escalation [2028] + 0.9174, !- Year 6 Escalation [2029] + 0.9148, !- Year 7 Escalation [2030] + 0.9141, !- Year 8 Escalation [2031] + 0.9148, !- Year 9 Escalation [2032] + 0.9166, !- Year 10 Escalation [2033] + 0.9196, !- Year 11 Escalation [2034] + 0.9176, !- Year 12 Escalation [2035] + 0.9153, !- Year 13 Escalation [2036] + 0.9174, !- Year 14 Escalation [2037] + 0.9216, !- Year 15 Escalation [2038] + 0.9295, !- Year 16 Escalation [2039] + 0.9405, !- Year 17 Escalation [2040] + 0.9483, !- Year 18 Escalation [2041] + 0.9501, !- Year 19 Escalation [2042] + 0.9486, !- Year 20 Escalation [2043] + 0.9476, !- Year 21 Escalation [2044] + 0.9478, !- Year 22 Escalation [2045] + 0.9451, !- Year 23 Escalation [2046] + 0.9390, !- Year 24 Escalation [2047] + 0.9352, !- Year 25 Escalation [2048] + 0.9300, !- Year 26 Escalation [2049] + 0.9219, !- Year 27 Escalation [2050] + 0.9158, !- Year 28 Escalation [2051] + 0.9103, !- Year 29 Escalation [2052] + 0.9048; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + MidWest Residential-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9354, !- Year 1 Escalation [2024] + 0.8687, !- Year 2 Escalation [2025] + 0.8318, !- Year 3 Escalation [2026] + 0.8077, !- Year 4 Escalation [2027] + 0.7864, !- Year 5 Escalation [2028] + 0.7844, !- Year 6 Escalation [2029] + 0.7848, !- Year 7 Escalation [2030] + 0.7900, !- Year 8 Escalation [2031] + 0.7941, !- Year 9 Escalation [2032] + 0.7969, !- Year 10 Escalation [2033] + 0.8009, !- Year 11 Escalation [2034] + 0.8041, !- Year 12 Escalation [2035] + 0.8077, !- Year 13 Escalation [2036] + 0.8113, !- Year 14 Escalation [2037] + 0.8149, !- Year 15 Escalation [2038] + 0.8173, !- Year 16 Escalation [2039] + 0.8202, !- Year 17 Escalation [2040] + 0.8258, !- Year 18 Escalation [2041] + 0.8282, !- Year 19 Escalation [2042] + 0.8322, !- Year 20 Escalation [2043] + 0.8310, !- Year 21 Escalation [2044] + 0.8338, !- Year 22 Escalation [2045] + 0.8418, !- Year 23 Escalation [2046] + 0.8446, !- Year 24 Escalation [2047] + 0.8462, !- Year 25 Escalation [2048] + 0.8487, !- Year 26 Escalation [2049] + 0.8499, !- Year 27 Escalation [2050] + 0.8523, !- Year 28 Escalation [2051] + 0.8555, !- Year 29 Escalation [2052] + 0.8587; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + MidWest Residential-Natural Gas, !- Name + NaturalGas, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.8923, !- Year 1 Escalation [2024] + 0.8191, !- Year 2 Escalation [2025] + 0.7730, !- Year 3 Escalation [2026] + 0.7442, !- Year 4 Escalation [2027] + 0.7311, !- Year 5 Escalation [2028] + 0.7311, !- Year 6 Escalation [2029] + 0.7377, !- Year 7 Escalation [2030] + 0.7475, !- Year 8 Escalation [2031] + 0.7558, !- Year 9 Escalation [2032] + 0.7664, !- Year 10 Escalation [2033] + 0.7780, !- Year 11 Escalation [2034] + 0.7878, !- Year 12 Escalation [2035] + 0.7936, !- Year 13 Escalation [2036] + 0.8002, !- Year 14 Escalation [2037] + 0.8092, !- Year 15 Escalation [2038] + 0.8117, !- Year 16 Escalation [2039] + 0.8166, !- Year 17 Escalation [2040] + 0.8240, !- Year 18 Escalation [2041] + 0.8265, !- Year 19 Escalation [2042] + 0.8248, !- Year 20 Escalation [2043] + 0.8215, !- Year 21 Escalation [2044] + 0.8207, !- Year 22 Escalation [2045] + 0.8199, !- Year 23 Escalation [2046] + 0.8174, !- Year 24 Escalation [2047] + 0.8150, !- Year 25 Escalation [2048] + 0.8133, !- Year 26 Escalation [2049] + 0.8125, !- Year 27 Escalation [2050] + 0.8109, !- Year 28 Escalation [2051] + 0.8092, !- Year 29 Escalation [2052] + 0.8076; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + MidWest Residential-LPG, !- Name + Propane, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 1.0241, !- Year 1 Escalation [2024] + 1.0000, !- Year 2 Escalation [2025] + 0.9642, !- Year 3 Escalation [2026] + 0.9337, !- Year 4 Escalation [2027] + 0.9141, !- Year 5 Escalation [2028] + 0.9051, !- Year 6 Escalation [2029] + 0.9057, !- Year 7 Escalation [2030] + 0.9135, !- Year 8 Escalation [2031] + 0.9272, !- Year 9 Escalation [2032] + 0.9451, !- Year 10 Escalation [2033] + 0.9644, !- Year 11 Escalation [2034] + 0.9810, !- Year 12 Escalation [2035] + 0.9933, !- Year 13 Escalation [2036] + 1.0039, !- Year 14 Escalation [2037] + 1.0165, !- Year 15 Escalation [2038] + 1.0246, !- Year 16 Escalation [2039] + 1.0342, !- Year 17 Escalation [2040] + 1.0445, !- Year 18 Escalation [2041] + 1.0524, !- Year 19 Escalation [2042] + 1.0571, !- Year 20 Escalation [2043] + 1.0588, !- Year 21 Escalation [2044] + 1.0602, !- Year 22 Escalation [2045] + 1.0613, !- Year 23 Escalation [2046] + 1.0624, !- Year 24 Escalation [2047] + 1.0647, !- Year 25 Escalation [2048] + 1.0658, !- Year 26 Escalation [2049] + 1.0655, !- Year 27 Escalation [2050] + 1.0661, !- Year 28 Escalation [2051] + 1.0669, !- Year 29 Escalation [2052] + 1.0680; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + MidWest Commercial-Electricity, !- Name + Electricity, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9724, !- Year 1 Escalation [2024] + 0.9444, !- Year 2 Escalation [2025] + 0.9232, !- Year 3 Escalation [2026] + 0.9019, !- Year 4 Escalation [2027] + 0.8895, !- Year 5 Escalation [2028] + 0.8831, !- Year 6 Escalation [2029] + 0.8777, !- Year 7 Escalation [2030] + 0.8737, !- Year 8 Escalation [2031] + 0.8713, !- Year 9 Escalation [2032] + 0.8701, !- Year 10 Escalation [2033] + 0.8722, !- Year 11 Escalation [2034] + 0.8679, !- Year 12 Escalation [2035] + 0.8646, !- Year 13 Escalation [2036] + 0.8655, !- Year 14 Escalation [2037] + 0.8676, !- Year 15 Escalation [2038] + 0.8764, !- Year 16 Escalation [2039] + 0.8871, !- Year 17 Escalation [2040] + 0.8931, !- Year 18 Escalation [2041] + 0.8925, !- Year 19 Escalation [2042] + 0.8883, !- Year 20 Escalation [2043] + 0.8843, !- Year 21 Escalation [2044] + 0.8825, !- Year 22 Escalation [2045] + 0.8783, !- Year 23 Escalation [2046] + 0.8698, !- Year 24 Escalation [2047] + 0.8655, !- Year 25 Escalation [2048] + 0.8600, !- Year 26 Escalation [2049] + 0.8515, !- Year 27 Escalation [2050] + 0.8446, !- Year 28 Escalation [2051] + 0.8382, !- Year 29 Escalation [2052] + 0.8321; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + MidWest Commercial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9225, !- Year 1 Escalation [2024] + 0.8352, !- Year 2 Escalation [2025] + 0.7743, !- Year 3 Escalation [2026] + 0.7234, !- Year 4 Escalation [2027] + 0.6769, !- Year 5 Escalation [2028] + 0.6681, !- Year 6 Escalation [2029] + 0.6685, !- Year 7 Escalation [2030] + 0.6728, !- Year 8 Escalation [2031] + 0.6765, !- Year 9 Escalation [2032] + 0.6803, !- Year 10 Escalation [2033] + 0.6826, !- Year 11 Escalation [2034] + 0.6870, !- Year 12 Escalation [2035] + 0.6894, !- Year 13 Escalation [2036] + 0.6927, !- Year 14 Escalation [2037] + 0.6961, !- Year 15 Escalation [2038] + 0.6981, !- Year 16 Escalation [2039] + 0.6998, !- Year 17 Escalation [2040] + 0.7045, !- Year 18 Escalation [2041] + 0.7059, !- Year 19 Escalation [2042] + 0.7089, !- Year 20 Escalation [2043] + 0.7079, !- Year 21 Escalation [2044] + 0.7089, !- Year 22 Escalation [2045] + 0.7150, !- Year 23 Escalation [2046] + 0.7177, !- Year 24 Escalation [2047] + 0.7187, !- Year 25 Escalation [2048] + 0.7210, !- Year 26 Escalation [2049] + 0.7217, !- Year 27 Escalation [2050] + 0.7237, !- Year 28 Escalation [2051] + 0.7264, !- Year 29 Escalation [2052] + 0.7288; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + MidWest Commercial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 1.0371, !- Year 1 Escalation [2024] + 1.1205, !- Year 2 Escalation [2025] + 1.2260, !- Year 3 Escalation [2026] + 1.3835, !- Year 4 Escalation [2027] + 1.5481, !- Year 5 Escalation [2028] + 1.5933, !- Year 6 Escalation [2029] + 1.6014, !- Year 7 Escalation [2030] + 1.6141, !- Year 8 Escalation [2031] + 1.6269, !- Year 9 Escalation [2032] + 1.6385, !- Year 10 Escalation [2033] + 1.6501, !- Year 11 Escalation [2034] + 1.6628, !- Year 12 Escalation [2035] + 1.6744, !- Year 13 Escalation [2036] + 1.6848, !- Year 14 Escalation [2037] + 1.6964, !- Year 15 Escalation [2038] + 1.7057, !- Year 16 Escalation [2039] + 1.7149, !- Year 17 Escalation [2040] + 1.7289, !- Year 18 Escalation [2041] + 1.7335, !- Year 19 Escalation [2042] + 1.7404, !- Year 20 Escalation [2043] + 1.7393, !- Year 21 Escalation [2044] + 1.7428, !- Year 22 Escalation [2045] + 1.7578, !- Year 23 Escalation [2046] + 1.7625, !- Year 24 Escalation [2047] + 1.7740, !- Year 25 Escalation [2048] + 1.7845, !- Year 26 Escalation [2049] + 1.7937, !- Year 27 Escalation [2050] + 1.8030, !- Year 28 Escalation [2051] + 1.8134, !- Year 29 Escalation [2052] + 1.8250; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + MidWest Commercial-Natural Gas, !- Name + NaturalGas, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9060, !- Year 1 Escalation [2024] + 0.8349, !- Year 2 Escalation [2025] + 0.7858, !- Year 3 Escalation [2026] + 0.7555, !- Year 4 Escalation [2027] + 0.7419, !- Year 5 Escalation [2028] + 0.7429, !- Year 6 Escalation [2029] + 0.7492, !- Year 7 Escalation [2030] + 0.7597, !- Year 8 Escalation [2031] + 0.7680, !- Year 9 Escalation [2032] + 0.7816, !- Year 10 Escalation [2033] + 0.7941, !- Year 11 Escalation [2034] + 0.8056, !- Year 12 Escalation [2035] + 0.8119, !- Year 13 Escalation [2036] + 0.8182, !- Year 14 Escalation [2037] + 0.8286, !- Year 15 Escalation [2038] + 0.8318, !- Year 16 Escalation [2039] + 0.8380, !- Year 17 Escalation [2040] + 0.8464, !- Year 18 Escalation [2041] + 0.8495, !- Year 19 Escalation [2042] + 0.8474, !- Year 20 Escalation [2043] + 0.8443, !- Year 21 Escalation [2044] + 0.8433, !- Year 22 Escalation [2045] + 0.8422, !- Year 23 Escalation [2046] + 0.8412, !- Year 24 Escalation [2047] + 0.8380, !- Year 25 Escalation [2048] + 0.8359, !- Year 26 Escalation [2049] + 0.8359, !- Year 27 Escalation [2050] + 0.8349, !- Year 28 Escalation [2051] + 0.8339, !- Year 29 Escalation [2052] + 0.8328; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + MidWest Industrial-Electricity, !- Name + Electricity, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9561, !- Year 1 Escalation [2024] + 0.9161, !- Year 2 Escalation [2025] + 0.8815, !- Year 3 Escalation [2026] + 0.8549, !- Year 4 Escalation [2027] + 0.8397, !- Year 5 Escalation [2028] + 0.8313, !- Year 6 Escalation [2029] + 0.8245, !- Year 7 Escalation [2030] + 0.8208, !- Year 8 Escalation [2031] + 0.8178, !- Year 9 Escalation [2032] + 0.8199, !- Year 10 Escalation [2033] + 0.8186, !- Year 11 Escalation [2034] + 0.8144, !- Year 12 Escalation [2035] + 0.8106, !- Year 13 Escalation [2036] + 0.8140, !- Year 14 Escalation [2037] + 0.8186, !- Year 15 Escalation [2038] + 0.8330, !- Year 16 Escalation [2039] + 0.8473, !- Year 17 Escalation [2040] + 0.8553, !- Year 18 Escalation [2041] + 0.8553, !- Year 19 Escalation [2042] + 0.8515, !- Year 20 Escalation [2043] + 0.8490, !- Year 21 Escalation [2044] + 0.8469, !- Year 22 Escalation [2045] + 0.8410, !- Year 23 Escalation [2046] + 0.8330, !- Year 24 Escalation [2047] + 0.8283, !- Year 25 Escalation [2048] + 0.8220, !- Year 26 Escalation [2049] + 0.8144, !- Year 27 Escalation [2050] + 0.8077, !- Year 28 Escalation [2051] + 0.8013, !- Year 29 Escalation [2052] + 0.7946; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + MidWest Industrial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9198, !- Year 1 Escalation [2024] + 0.8307, !- Year 2 Escalation [2025] + 0.7677, !- Year 3 Escalation [2026] + 0.7145, !- Year 4 Escalation [2027] + 0.6657, !- Year 5 Escalation [2028] + 0.6564, !- Year 6 Escalation [2029] + 0.6568, !- Year 7 Escalation [2030] + 0.6607, !- Year 8 Escalation [2031] + 0.6647, !- Year 9 Escalation [2032] + 0.6683, !- Year 10 Escalation [2033] + 0.6706, !- Year 11 Escalation [2034] + 0.6752, !- Year 12 Escalation [2035] + 0.6772, !- Year 13 Escalation [2036] + 0.6809, !- Year 14 Escalation [2037] + 0.6842, !- Year 15 Escalation [2038] + 0.6858, !- Year 16 Escalation [2039] + 0.6878, !- Year 17 Escalation [2040] + 0.6921, !- Year 18 Escalation [2041] + 0.6937, !- Year 19 Escalation [2042] + 0.6967, !- Year 20 Escalation [2043] + 0.6954, !- Year 21 Escalation [2044] + 0.6960, !- Year 22 Escalation [2045] + 0.7023, !- Year 23 Escalation [2046] + 0.7046, !- Year 24 Escalation [2047] + 0.7059, !- Year 25 Escalation [2048] + 0.7079, !- Year 26 Escalation [2049] + 0.7086, !- Year 27 Escalation [2050] + 0.7106, !- Year 28 Escalation [2051] + 0.7132, !- Year 29 Escalation [2052] + 0.7155; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + MidWest Industrial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 1.0419, !- Year 1 Escalation [2024] + 1.1279, !- Year 2 Escalation [2025] + 1.2302, !- Year 3 Escalation [2026] + 1.3884, !- Year 4 Escalation [2027] + 1.5535, !- Year 5 Escalation [2028] + 1.5988, !- Year 6 Escalation [2029] + 1.6070, !- Year 7 Escalation [2030] + 1.6198, !- Year 8 Escalation [2031] + 1.6326, !- Year 9 Escalation [2032] + 1.6442, !- Year 10 Escalation [2033] + 1.6558, !- Year 11 Escalation [2034] + 1.6686, !- Year 12 Escalation [2035] + 1.6802, !- Year 13 Escalation [2036] + 1.6907, !- Year 14 Escalation [2037] + 1.7023, !- Year 15 Escalation [2038] + 1.7116, !- Year 16 Escalation [2039] + 1.7209, !- Year 17 Escalation [2040] + 1.7349, !- Year 18 Escalation [2041] + 1.7395, !- Year 19 Escalation [2042] + 1.7465, !- Year 20 Escalation [2043] + 1.7453, !- Year 21 Escalation [2044] + 1.7488, !- Year 22 Escalation [2045] + 1.7640, !- Year 23 Escalation [2046] + 1.7686, !- Year 24 Escalation [2047] + 1.7802, !- Year 25 Escalation [2048] + 1.7907, !- Year 26 Escalation [2049] + 1.8000, !- Year 27 Escalation [2050] + 1.8093, !- Year 28 Escalation [2051] + 1.8198, !- Year 29 Escalation [2052] + 1.8314; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + MidWest Industrial-Natural Gas, !- Name + NaturalGas, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.8457, !- Year 1 Escalation [2024] + 0.7443, !- Year 2 Escalation [2025] + 0.6732, !- Year 3 Escalation [2026] + 0.6309, !- Year 4 Escalation [2027] + 0.6127, !- Year 5 Escalation [2028] + 0.6097, !- Year 6 Escalation [2029] + 0.6157, !- Year 7 Escalation [2030] + 0.6263, !- Year 8 Escalation [2031] + 0.6369, !- Year 9 Escalation [2032] + 0.6536, !- Year 10 Escalation [2033] + 0.6687, !- Year 11 Escalation [2034] + 0.6823, !- Year 12 Escalation [2035] + 0.6868, !- Year 13 Escalation [2036] + 0.6929, !- Year 14 Escalation [2037] + 0.7065, !- Year 15 Escalation [2038] + 0.7065, !- Year 16 Escalation [2039] + 0.7156, !- Year 17 Escalation [2040] + 0.7277, !- Year 18 Escalation [2041] + 0.7277, !- Year 19 Escalation [2042] + 0.7216, !- Year 20 Escalation [2043] + 0.7126, !- Year 21 Escalation [2044] + 0.7080, !- Year 22 Escalation [2045] + 0.7050, !- Year 23 Escalation [2046] + 0.6989, !- Year 24 Escalation [2047] + 0.6929, !- Year 25 Escalation [2048] + 0.6853, !- Year 26 Escalation [2049] + 0.6823, !- Year 27 Escalation [2050] + 0.6778, !- Year 28 Escalation [2051] + 0.6732, !- Year 29 Escalation [2052] + 0.6672; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + MidWest Industrial-Coal, !- Name + Coal, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 1.0039, !- Year 1 Escalation [2024] + 1.0270, !- Year 2 Escalation [2025] + 1.0309, !- Year 3 Escalation [2026] + 1.0232, !- Year 4 Escalation [2027] + 1.0116, !- Year 5 Escalation [2028] + 1.0077, !- Year 6 Escalation [2029] + 1.0039, !- Year 7 Escalation [2030] + 1.0039, !- Year 8 Escalation [2031] + 1.0039, !- Year 9 Escalation [2032] + 1.0000, !- Year 10 Escalation [2033] + 1.0039, !- Year 11 Escalation [2034] + 1.0039, !- Year 12 Escalation [2035] + 1.0077, !- Year 13 Escalation [2036] + 1.0154, !- Year 14 Escalation [2037] + 1.0232, !- Year 15 Escalation [2038] + 1.0347, !- Year 16 Escalation [2039] + 1.0386, !- Year 17 Escalation [2040] + 1.0425, !- Year 18 Escalation [2041] + 1.0425, !- Year 19 Escalation [2042] + 1.0463, !- Year 20 Escalation [2043] + 1.0502, !- Year 21 Escalation [2044] + 1.0502, !- Year 22 Escalation [2045] + 1.0579, !- Year 23 Escalation [2046] + 1.0618, !- Year 24 Escalation [2047] + 1.0618, !- Year 25 Escalation [2048] + 1.0541, !- Year 26 Escalation [2049] + 1.0541, !- Year 27 Escalation [2050] + 1.0541, !- Year 28 Escalation [2051] + 1.0541, !- Year 29 Escalation [2052] + 1.0541; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + South Residential-Electricity, !- Name + Electricity, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9808, !- Year 1 Escalation [2024] + 0.9610, !- Year 2 Escalation [2025] + 0.9385, !- Year 3 Escalation [2026] + 0.9184, !- Year 4 Escalation [2027] + 0.9024, !- Year 5 Escalation [2028] + 0.8946, !- Year 6 Escalation [2029] + 0.8954, !- Year 7 Escalation [2030] + 0.8994, !- Year 8 Escalation [2031] + 0.9005, !- Year 9 Escalation [2032] + 0.9157, !- Year 10 Escalation [2033] + 0.9295, !- Year 11 Escalation [2034] + 0.9325, !- Year 12 Escalation [2035] + 0.9371, !- Year 13 Escalation [2036] + 0.9450, !- Year 14 Escalation [2037] + 0.9547, !- Year 15 Escalation [2038] + 0.9602, !- Year 16 Escalation [2039] + 0.9650, !- Year 17 Escalation [2040] + 0.9683, !- Year 18 Escalation [2041] + 0.9705, !- Year 19 Escalation [2042] + 0.9715, !- Year 20 Escalation [2043] + 0.9732, !- Year 21 Escalation [2044] + 0.9742, !- Year 22 Escalation [2045] + 0.9707, !- Year 23 Escalation [2046] + 0.9669, !- Year 24 Escalation [2047] + 0.9634, !- Year 25 Escalation [2048] + 0.9599, !- Year 26 Escalation [2049] + 0.9512, !- Year 27 Escalation [2050] + 0.9447, !- Year 28 Escalation [2051] + 0.9398, !- Year 29 Escalation [2052] + 0.9347; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + South Residential-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9583, !- Year 1 Escalation [2024] + 0.9142, !- Year 2 Escalation [2025] + 0.8918, !- Year 3 Escalation [2026] + 0.8784, !- Year 4 Escalation [2027] + 0.8674, !- Year 5 Escalation [2028] + 0.8668, !- Year 6 Escalation [2029] + 0.8674, !- Year 7 Escalation [2030] + 0.8715, !- Year 8 Escalation [2031] + 0.8745, !- Year 9 Escalation [2032] + 0.8769, !- Year 10 Escalation [2033] + 0.8796, !- Year 11 Escalation [2034] + 0.8823, !- Year 12 Escalation [2035] + 0.8846, !- Year 13 Escalation [2036] + 0.8876, !- Year 14 Escalation [2037] + 0.8903, !- Year 15 Escalation [2038] + 0.8921, !- Year 16 Escalation [2039] + 0.8942, !- Year 17 Escalation [2040] + 0.8984, !- Year 18 Escalation [2041] + 0.9001, !- Year 19 Escalation [2042] + 0.9028, !- Year 20 Escalation [2043] + 0.9022, !- Year 21 Escalation [2044] + 0.9040, !- Year 22 Escalation [2045] + 0.9100, !- Year 23 Escalation [2046] + 0.9121, !- Year 24 Escalation [2047] + 0.9130, !- Year 25 Escalation [2048] + 0.9151, !- Year 26 Escalation [2049] + 0.9159, !- Year 27 Escalation [2050] + 0.9177, !- Year 28 Escalation [2051] + 0.9198, !- Year 29 Escalation [2052] + 0.9222; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + South Residential-Natural Gas, !- Name + NaturalGas, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9544, !- Year 1 Escalation [2024] + 0.9239, !- Year 2 Escalation [2025] + 0.9008, !- Year 3 Escalation [2026] + 0.8896, !- Year 4 Escalation [2027] + 0.8882, !- Year 5 Escalation [2028] + 0.8935, !- Year 6 Escalation [2029] + 0.9015, !- Year 7 Escalation [2030] + 0.9120, !- Year 8 Escalation [2031] + 0.9233, !- Year 9 Escalation [2032] + 0.9365, !- Year 10 Escalation [2033] + 0.9484, !- Year 11 Escalation [2034] + 0.9590, !- Year 12 Escalation [2035] + 0.9656, !- Year 13 Escalation [2036] + 0.9729, !- Year 14 Escalation [2037] + 0.9821, !- Year 15 Escalation [2038] + 0.9861, !- Year 16 Escalation [2039] + 0.9940, !- Year 17 Escalation [2040] + 1.0026, !- Year 18 Escalation [2041] + 1.0073, !- Year 19 Escalation [2042] + 1.0093, !- Year 20 Escalation [2043] + 1.0106, !- Year 21 Escalation [2044] + 1.0132, !- Year 22 Escalation [2045] + 1.0165, !- Year 23 Escalation [2046] + 1.0179, !- Year 24 Escalation [2047] + 1.0198, !- Year 25 Escalation [2048] + 1.0212, !- Year 26 Escalation [2049] + 1.0238, !- Year 27 Escalation [2050] + 1.0265, !- Year 28 Escalation [2051] + 1.0284, !- Year 29 Escalation [2052] + 1.0304; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + South Residential-LPG, !- Name + Propane, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 1.0241, !- Year 1 Escalation [2024] + 0.9997, !- Year 2 Escalation [2025] + 0.9641, !- Year 3 Escalation [2026] + 0.9336, !- Year 4 Escalation [2027] + 0.9140, !- Year 5 Escalation [2028] + 0.9052, !- Year 6 Escalation [2029] + 0.9058, !- Year 7 Escalation [2030] + 0.9137, !- Year 8 Escalation [2031] + 0.9276, !- Year 9 Escalation [2032] + 0.9457, !- Year 10 Escalation [2033] + 0.9650, !- Year 11 Escalation [2034] + 0.9813, !- Year 12 Escalation [2035] + 0.9940, !- Year 13 Escalation [2036] + 1.0048, !- Year 14 Escalation [2037] + 1.0172, !- Year 15 Escalation [2038] + 1.0257, !- Year 16 Escalation [2039] + 1.0350, !- Year 17 Escalation [2040] + 1.0456, !- Year 18 Escalation [2041] + 1.0537, !- Year 19 Escalation [2042] + 1.0586, !- Year 20 Escalation [2043] + 1.0601, !- Year 21 Escalation [2044] + 1.0619, !- Year 22 Escalation [2045] + 1.0631, !- Year 23 Escalation [2046] + 1.0640, !- Year 24 Escalation [2047] + 1.0664, !- Year 25 Escalation [2048] + 1.0676, !- Year 26 Escalation [2049] + 1.0676, !- Year 27 Escalation [2050] + 1.0682, !- Year 28 Escalation [2051] + 1.0691, !- Year 29 Escalation [2052] + 1.0703; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + South Commercial-Electricity, !- Name + Electricity, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9645, !- Year 1 Escalation [2024] + 0.9352, !- Year 2 Escalation [2025] + 0.9082, !- Year 3 Escalation [2026] + 0.8845, !- Year 4 Escalation [2027] + 0.8633, !- Year 5 Escalation [2028] + 0.8523, !- Year 6 Escalation [2029] + 0.8516, !- Year 7 Escalation [2030] + 0.8529, !- Year 8 Escalation [2031] + 0.8493, !- Year 9 Escalation [2032] + 0.8620, !- Year 10 Escalation [2033] + 0.8734, !- Year 11 Escalation [2034] + 0.8734, !- Year 12 Escalation [2035] + 0.8767, !- Year 13 Escalation [2036] + 0.8815, !- Year 14 Escalation [2037] + 0.8884, !- Year 15 Escalation [2038] + 0.8907, !- Year 16 Escalation [2039] + 0.8936, !- Year 17 Escalation [2040] + 0.8955, !- Year 18 Escalation [2041] + 0.8965, !- Year 19 Escalation [2042] + 0.8968, !- Year 20 Escalation [2043] + 0.8968, !- Year 21 Escalation [2044] + 0.8955, !- Year 22 Escalation [2045] + 0.8884, !- Year 23 Escalation [2046] + 0.8799, !- Year 24 Escalation [2047] + 0.8744, !- Year 25 Escalation [2048] + 0.8698, !- Year 26 Escalation [2049] + 0.8597, !- Year 27 Escalation [2050] + 0.8513, !- Year 28 Escalation [2051] + 0.8438, !- Year 29 Escalation [2052] + 0.8366; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + South Commercial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9330, !- Year 1 Escalation [2024] + 0.8545, !- Year 2 Escalation [2025] + 0.7996, !- Year 3 Escalation [2026] + 0.7534, !- Year 4 Escalation [2027] + 0.7108, !- Year 5 Escalation [2028] + 0.7027, !- Year 6 Escalation [2029] + 0.7036, !- Year 7 Escalation [2030] + 0.7075, !- Year 8 Escalation [2031] + 0.7111, !- Year 9 Escalation [2032] + 0.7145, !- Year 10 Escalation [2033] + 0.7169, !- Year 11 Escalation [2034] + 0.7208, !- Year 12 Escalation [2035] + 0.7229, !- Year 13 Escalation [2036] + 0.7259, !- Year 14 Escalation [2037] + 0.7289, !- Year 15 Escalation [2038] + 0.7308, !- Year 16 Escalation [2039] + 0.7326, !- Year 17 Escalation [2040] + 0.7365, !- Year 18 Escalation [2041] + 0.7377, !- Year 19 Escalation [2042] + 0.7404, !- Year 20 Escalation [2043] + 0.7395, !- Year 21 Escalation [2044] + 0.7401, !- Year 22 Escalation [2045] + 0.7455, !- Year 23 Escalation [2046] + 0.7477, !- Year 24 Escalation [2047] + 0.7489, !- Year 25 Escalation [2048] + 0.7507, !- Year 26 Escalation [2049] + 0.7516, !- Year 27 Escalation [2050] + 0.7534, !- Year 28 Escalation [2051] + 0.7555, !- Year 29 Escalation [2052] + 0.7579; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + South Commercial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 1.0229, !- Year 1 Escalation [2024] + 1.1302, !- Year 2 Escalation [2025] + 1.2833, !- Year 3 Escalation [2026] + 1.4662, !- Year 4 Escalation [2027] + 1.6451, !- Year 5 Escalation [2028] + 1.6978, !- Year 6 Escalation [2029] + 1.7078, !- Year 7 Escalation [2030] + 1.7177, !- Year 8 Escalation [2031] + 1.7286, !- Year 9 Escalation [2032] + 1.7386, !- Year 10 Escalation [2033] + 1.7485, !- Year 11 Escalation [2034] + 1.7594, !- Year 12 Escalation [2035] + 1.7684, !- Year 13 Escalation [2036] + 1.7773, !- Year 14 Escalation [2037] + 1.7863, !- Year 15 Escalation [2038] + 1.7942, !- Year 16 Escalation [2039] + 1.8022, !- Year 17 Escalation [2040] + 1.8141, !- Year 18 Escalation [2041] + 1.8171, !- Year 19 Escalation [2042] + 1.8231, !- Year 20 Escalation [2043] + 1.8211, !- Year 21 Escalation [2044] + 1.8241, !- Year 22 Escalation [2045] + 1.8390, !- Year 23 Escalation [2046] + 1.8429, !- Year 24 Escalation [2047] + 1.8509, !- Year 25 Escalation [2048] + 1.8588, !- Year 26 Escalation [2049] + 1.8658, !- Year 27 Escalation [2050] + 1.8738, !- Year 28 Escalation [2051] + 1.8827, !- Year 29 Escalation [2052] + 1.8907; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + South Commercial-Natural Gas, !- Name + NaturalGas, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9199, !- Year 1 Escalation [2024] + 0.8779, !- Year 2 Escalation [2025] + 0.8490, !- Year 3 Escalation [2026] + 0.8360, !- Year 4 Escalation [2027] + 0.8360, !- Year 5 Escalation [2028] + 0.8397, !- Year 6 Escalation [2029] + 0.8453, !- Year 7 Escalation [2030] + 0.8546, !- Year 8 Escalation [2031] + 0.8658, !- Year 9 Escalation [2032] + 0.8798, !- Year 10 Escalation [2033] + 0.8928, !- Year 11 Escalation [2034] + 0.9031, !- Year 12 Escalation [2035] + 0.9087, !- Year 13 Escalation [2036] + 0.9133, !- Year 14 Escalation [2037] + 0.9226, !- Year 15 Escalation [2038] + 0.9245, !- Year 16 Escalation [2039] + 0.9310, !- Year 17 Escalation [2040] + 0.9385, !- Year 18 Escalation [2041] + 0.9404, !- Year 19 Escalation [2042] + 0.9394, !- Year 20 Escalation [2043] + 0.9366, !- Year 21 Escalation [2044] + 0.9366, !- Year 22 Escalation [2045] + 0.9366, !- Year 23 Escalation [2046] + 0.9357, !- Year 24 Escalation [2047] + 0.9338, !- Year 25 Escalation [2048] + 0.9329, !- Year 26 Escalation [2049] + 0.9329, !- Year 27 Escalation [2050] + 0.9320, !- Year 28 Escalation [2051] + 0.9310, !- Year 29 Escalation [2052] + 0.9301; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + South Industrial-Electricity, !- Name + Electricity, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9518, !- Year 1 Escalation [2024] + 0.9055, !- Year 2 Escalation [2025] + 0.8650, !- Year 3 Escalation [2026] + 0.8338, !- Year 4 Escalation [2027] + 0.8114, !- Year 5 Escalation [2028] + 0.7997, !- Year 6 Escalation [2029] + 0.7992, !- Year 7 Escalation [2030] + 0.8026, !- Year 8 Escalation [2031] + 0.8036, !- Year 9 Escalation [2032] + 0.8246, !- Year 10 Escalation [2033] + 0.8377, !- Year 11 Escalation [2034] + 0.8392, !- Year 12 Escalation [2035] + 0.8475, !- Year 13 Escalation [2036] + 0.8567, !- Year 14 Escalation [2037] + 0.8689, !- Year 15 Escalation [2038] + 0.8767, !- Year 16 Escalation [2039] + 0.8811, !- Year 17 Escalation [2040] + 0.8869, !- Year 18 Escalation [2041] + 0.8894, !- Year 19 Escalation [2042] + 0.8889, !- Year 20 Escalation [2043] + 0.8899, !- Year 21 Escalation [2044] + 0.8865, !- Year 22 Escalation [2045] + 0.8791, !- Year 23 Escalation [2046] + 0.8733, !- Year 24 Escalation [2047] + 0.8689, !- Year 25 Escalation [2048] + 0.8655, !- Year 26 Escalation [2049] + 0.8567, !- Year 27 Escalation [2050] + 0.8494, !- Year 28 Escalation [2051] + 0.8431, !- Year 29 Escalation [2052] + 0.8372; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + South Industrial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9338, !- Year 1 Escalation [2024] + 0.8563, !- Year 2 Escalation [2025] + 0.8014, !- Year 3 Escalation [2026] + 0.7551, !- Year 4 Escalation [2027] + 0.7121, !- Year 5 Escalation [2028] + 0.7040, !- Year 6 Escalation [2029] + 0.7051, !- Year 7 Escalation [2030] + 0.7089, !- Year 8 Escalation [2031] + 0.7126, !- Year 9 Escalation [2032] + 0.7158, !- Year 10 Escalation [2033] + 0.7181, !- Year 11 Escalation [2034] + 0.7222, !- Year 12 Escalation [2035] + 0.7242, !- Year 13 Escalation [2036] + 0.7271, !- Year 14 Escalation [2037] + 0.7300, !- Year 15 Escalation [2038] + 0.7317, !- Year 16 Escalation [2039] + 0.7332, !- Year 17 Escalation [2040] + 0.7372, !- Year 18 Escalation [2041] + 0.7384, !- Year 19 Escalation [2042] + 0.7410, !- Year 20 Escalation [2043] + 0.7398, !- Year 21 Escalation [2044] + 0.7404, !- Year 22 Escalation [2045] + 0.7453, !- Year 23 Escalation [2046] + 0.7476, !- Year 24 Escalation [2047] + 0.7485, !- Year 25 Escalation [2048] + 0.7505, !- Year 26 Escalation [2049] + 0.7514, !- Year 27 Escalation [2050] + 0.7531, !- Year 28 Escalation [2051] + 0.7551, !- Year 29 Escalation [2052] + 0.7572; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + South Industrial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 1.0192, !- Year 1 Escalation [2024] + 1.1190, !- Year 2 Escalation [2025] + 1.2671, !- Year 3 Escalation [2026] + 1.4446, !- Year 4 Escalation [2027] + 1.6200, !- Year 5 Escalation [2028] + 1.6724, !- Year 6 Escalation [2029] + 1.6825, !- Year 7 Escalation [2030] + 1.6925, !- Year 8 Escalation [2031] + 1.7036, !- Year 9 Escalation [2032] + 1.7137, !- Year 10 Escalation [2033] + 1.7238, !- Year 11 Escalation [2034] + 1.7349, !- Year 12 Escalation [2035] + 1.7450, !- Year 13 Escalation [2036] + 1.7540, !- Year 14 Escalation [2037] + 1.7641, !- Year 15 Escalation [2038] + 1.7722, !- Year 16 Escalation [2039] + 1.7813, !- Year 17 Escalation [2040] + 1.7923, !- Year 18 Escalation [2041] + 1.7974, !- Year 19 Escalation [2042] + 1.8024, !- Year 20 Escalation [2043] + 1.8034, !- Year 21 Escalation [2044] + 1.8075, !- Year 22 Escalation [2045] + 1.8226, !- Year 23 Escalation [2046] + 1.8266, !- Year 24 Escalation [2047] + 1.8347, !- Year 25 Escalation [2048] + 1.8438, !- Year 26 Escalation [2049] + 1.8508, !- Year 27 Escalation [2050] + 1.8599, !- Year 28 Escalation [2051] + 1.8690, !- Year 29 Escalation [2052] + 1.8780; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + South Industrial-Natural Gas, !- Name + NaturalGas, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.8091, !- Year 1 Escalation [2024] + 0.6933, !- Year 2 Escalation [2025] + 0.6183, !- Year 3 Escalation [2026] + 0.5742, !- Year 4 Escalation [2027] + 0.5579, !- Year 5 Escalation [2028] + 0.5579, !- Year 6 Escalation [2029] + 0.5693, !- Year 7 Escalation [2030] + 0.5889, !- Year 8 Escalation [2031] + 0.6101, !- Year 9 Escalation [2032] + 0.6378, !- Year 10 Escalation [2033] + 0.6623, !- Year 11 Escalation [2034] + 0.6819, !- Year 12 Escalation [2035] + 0.6884, !- Year 13 Escalation [2036] + 0.6949, !- Year 14 Escalation [2037] + 0.7113, !- Year 15 Escalation [2038] + 0.7080, !- Year 16 Escalation [2039] + 0.7210, !- Year 17 Escalation [2040] + 0.7357, !- Year 18 Escalation [2041] + 0.7374, !- Year 19 Escalation [2042] + 0.7308, !- Year 20 Escalation [2043] + 0.7227, !- Year 21 Escalation [2044] + 0.7210, !- Year 22 Escalation [2045] + 0.7194, !- Year 23 Escalation [2046] + 0.7145, !- Year 24 Escalation [2047] + 0.7096, !- Year 25 Escalation [2048] + 0.7015, !- Year 26 Escalation [2049] + 0.6966, !- Year 27 Escalation [2050] + 0.6933, !- Year 28 Escalation [2051] + 0.6884, !- Year 29 Escalation [2052] + 0.6835; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + South Industrial-Coal, !- Name + Coal, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 1.0456, !- Year 1 Escalation [2024] + 1.0782, !- Year 2 Escalation [2025] + 1.0782, !- Year 3 Escalation [2026] + 1.0782, !- Year 4 Escalation [2027] + 1.0782, !- Year 5 Escalation [2028] + 1.0814, !- Year 6 Escalation [2029] + 1.0847, !- Year 7 Escalation [2030] + 1.0879, !- Year 8 Escalation [2031] + 1.0912, !- Year 9 Escalation [2032] + 1.0977, !- Year 10 Escalation [2033] + 1.1042, !- Year 11 Escalation [2034] + 1.1107, !- Year 12 Escalation [2035] + 1.1140, !- Year 13 Escalation [2036] + 1.1173, !- Year 14 Escalation [2037] + 1.1238, !- Year 15 Escalation [2038] + 1.1270, !- Year 16 Escalation [2039] + 1.1303, !- Year 17 Escalation [2040] + 1.1336, !- Year 18 Escalation [2041] + 1.1368, !- Year 19 Escalation [2042] + 1.1401, !- Year 20 Escalation [2043] + 1.1401, !- Year 21 Escalation [2044] + 1.1433, !- Year 22 Escalation [2045] + 1.1466, !- Year 23 Escalation [2046] + 1.1498, !- Year 24 Escalation [2047] + 1.1466, !- Year 25 Escalation [2048] + 1.1466, !- Year 26 Escalation [2049] + 1.1498, !- Year 27 Escalation [2050] + 1.1531, !- Year 28 Escalation [2051] + 1.1531, !- Year 29 Escalation [2052] + 1.1564; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + West Residential-Electricity, !- Name + Electricity, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9348, !- Year 1 Escalation [2024] + 0.8673, !- Year 2 Escalation [2025] + 0.8448, !- Year 3 Escalation [2026] + 0.8399, !- Year 4 Escalation [2027] + 0.8379, !- Year 5 Escalation [2028] + 0.8383, !- Year 6 Escalation [2029] + 0.8436, !- Year 7 Escalation [2030] + 0.8523, !- Year 8 Escalation [2031] + 0.8630, !- Year 9 Escalation [2032] + 0.8744, !- Year 10 Escalation [2033] + 0.8847, !- Year 11 Escalation [2034] + 0.8938, !- Year 12 Escalation [2035] + 0.9015, !- Year 13 Escalation [2036] + 0.9108, !- Year 14 Escalation [2037] + 0.9220, !- Year 15 Escalation [2038] + 0.9317, !- Year 16 Escalation [2039] + 0.9398, !- Year 17 Escalation [2040] + 0.9491, !- Year 18 Escalation [2041] + 0.9570, !- Year 19 Escalation [2042] + 0.9645, !- Year 20 Escalation [2043] + 0.9735, !- Year 21 Escalation [2044] + 0.9826, !- Year 22 Escalation [2045] + 0.9909, !- Year 23 Escalation [2046] + 0.9955, !- Year 24 Escalation [2047] + 1.0000, !- Year 25 Escalation [2048] + 1.0030, !- Year 26 Escalation [2049] + 1.0051, !- Year 27 Escalation [2050] + 1.0087, !- Year 28 Escalation [2051] + 1.0130, !- Year 29 Escalation [2052] + 1.0172; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + West Residential-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9597, !- Year 1 Escalation [2024] + 0.9134, !- Year 2 Escalation [2025] + 0.8897, !- Year 3 Escalation [2026] + 0.8753, !- Year 4 Escalation [2027] + 0.8623, !- Year 5 Escalation [2028] + 0.8611, !- Year 6 Escalation [2029] + 0.8620, !- Year 7 Escalation [2030] + 0.8656, !- Year 8 Escalation [2031] + 0.8693, !- Year 9 Escalation [2032] + 0.8714, !- Year 10 Escalation [2033] + 0.8741, !- Year 11 Escalation [2034] + 0.8771, !- Year 12 Escalation [2035] + 0.8795, !- Year 13 Escalation [2036] + 0.8819, !- Year 14 Escalation [2037] + 0.8846, !- Year 15 Escalation [2038] + 0.8867, !- Year 16 Escalation [2039] + 0.8891, !- Year 17 Escalation [2040] + 0.8933, !- Year 18 Escalation [2041] + 0.8948, !- Year 19 Escalation [2042] + 0.8978, !- Year 20 Escalation [2043] + 0.8972, !- Year 21 Escalation [2044] + 0.8990, !- Year 22 Escalation [2045] + 0.9077, !- Year 23 Escalation [2046] + 0.9110, !- Year 24 Escalation [2047] + 0.9119, !- Year 25 Escalation [2048] + 0.9137, !- Year 26 Escalation [2049] + 0.9143, !- Year 27 Escalation [2050] + 0.9164, !- Year 28 Escalation [2051] + 0.9194, !- Year 29 Escalation [2052] + 0.9225; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + West Residential-Natural Gas, !- Name + NaturalGas, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9802, !- Year 1 Escalation [2024] + 0.9111, !- Year 2 Escalation [2025] + 0.8350, !- Year 3 Escalation [2026] + 0.7711, !- Year 4 Escalation [2027] + 0.7180, !- Year 5 Escalation [2028] + 0.7046, !- Year 6 Escalation [2029] + 0.7059, !- Year 7 Escalation [2030] + 0.7110, !- Year 8 Escalation [2031] + 0.7168, !- Year 9 Escalation [2032] + 0.7257, !- Year 10 Escalation [2033] + 0.7353, !- Year 11 Escalation [2034] + 0.7442, !- Year 12 Escalation [2035] + 0.7487, !- Year 13 Escalation [2036] + 0.7526, !- Year 14 Escalation [2037] + 0.7602, !- Year 15 Escalation [2038] + 0.7609, !- Year 16 Escalation [2039] + 0.7653, !- Year 17 Escalation [2040] + 0.7711, !- Year 18 Escalation [2041] + 0.7737, !- Year 19 Escalation [2042] + 0.7737, !- Year 20 Escalation [2043] + 0.7705, !- Year 21 Escalation [2044] + 0.7743, !- Year 22 Escalation [2045] + 0.8414, !- Year 23 Escalation [2046] + 0.8664, !- Year 24 Escalation [2047] + 0.8651, !- Year 25 Escalation [2048] + 0.8651, !- Year 26 Escalation [2049] + 0.8657, !- Year 27 Escalation [2050] + 0.8804, !- Year 28 Escalation [2051] + 0.9009, !- Year 29 Escalation [2052] + 0.9220; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + West Residential-LPG, !- Name + Propane, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 1.0231, !- Year 1 Escalation [2024] + 0.9984, !- Year 2 Escalation [2025] + 0.9632, !- Year 3 Escalation [2026] + 0.9327, !- Year 4 Escalation [2027] + 0.9131, !- Year 5 Escalation [2028] + 0.9044, !- Year 6 Escalation [2029] + 0.9047, !- Year 7 Escalation [2030] + 0.9125, !- Year 8 Escalation [2031] + 0.9255, !- Year 9 Escalation [2032] + 0.9436, !- Year 10 Escalation [2033] + 0.9623, !- Year 11 Escalation [2034] + 0.9782, !- Year 12 Escalation [2035] + 0.9907, !- Year 13 Escalation [2036] + 1.0009, !- Year 14 Escalation [2037] + 1.0131, !- Year 15 Escalation [2038] + 1.0212, !- Year 16 Escalation [2039] + 1.0305, !- Year 17 Escalation [2040] + 1.0405, !- Year 18 Escalation [2041] + 1.0483, !- Year 19 Escalation [2042] + 1.0530, !- Year 20 Escalation [2043] + 1.0545, !- Year 21 Escalation [2044] + 1.0573, !- Year 22 Escalation [2045] + 1.0850, !- Year 23 Escalation [2046] + 1.0947, !- Year 24 Escalation [2047] + 1.0966, !- Year 25 Escalation [2048] + 1.0978, !- Year 26 Escalation [2049] + 1.0975, !- Year 27 Escalation [2050] + 1.1034, !- Year 28 Escalation [2051] + 1.1115, !- Year 29 Escalation [2052] + 1.1199; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + West Commercial-Electricity, !- Name + Electricity, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9274, !- Year 1 Escalation [2024] + 0.8372, !- Year 2 Escalation [2025] + 0.8022, !- Year 3 Escalation [2026] + 0.7889, !- Year 4 Escalation [2027] + 0.7777, !- Year 5 Escalation [2028] + 0.7694, !- Year 6 Escalation [2029] + 0.7680, !- Year 7 Escalation [2030] + 0.7678, !- Year 8 Escalation [2031] + 0.7692, !- Year 9 Escalation [2032] + 0.7728, !- Year 10 Escalation [2033] + 0.7742, !- Year 11 Escalation [2034] + 0.7760, !- Year 12 Escalation [2035] + 0.7774, !- Year 13 Escalation [2036] + 0.7802, !- Year 14 Escalation [2037] + 0.7852, !- Year 15 Escalation [2038] + 0.7868, !- Year 16 Escalation [2039] + 0.7866, !- Year 17 Escalation [2040] + 0.7882, !- Year 18 Escalation [2041] + 0.7896, !- Year 19 Escalation [2042] + 0.7916, !- Year 20 Escalation [2043] + 0.7946, !- Year 21 Escalation [2044] + 0.7969, !- Year 22 Escalation [2045] + 0.7983, !- Year 23 Escalation [2046] + 0.7960, !- Year 24 Escalation [2047] + 0.7944, !- Year 25 Escalation [2048] + 0.7914, !- Year 26 Escalation [2049] + 0.7877, !- Year 27 Escalation [2050] + 0.7854, !- Year 28 Escalation [2051] + 0.7834, !- Year 29 Escalation [2052] + 0.7813; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + West Commercial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9373, !- Year 1 Escalation [2024] + 0.8600, !- Year 2 Escalation [2025] + 0.8029, !- Year 3 Escalation [2026] + 0.7551, !- Year 4 Escalation [2027] + 0.7103, !- Year 5 Escalation [2028] + 0.7013, !- Year 6 Escalation [2029] + 0.7028, !- Year 7 Escalation [2030] + 0.7061, !- Year 8 Escalation [2031] + 0.7098, !- Year 9 Escalation [2032] + 0.7129, !- Year 10 Escalation [2033] + 0.7151, !- Year 11 Escalation [2034] + 0.7191, !- Year 12 Escalation [2035] + 0.7210, !- Year 13 Escalation [2036] + 0.7238, !- Year 14 Escalation [2037] + 0.7267, !- Year 15 Escalation [2038] + 0.7286, !- Year 16 Escalation [2039] + 0.7303, !- Year 17 Escalation [2040] + 0.7343, !- Year 18 Escalation [2041] + 0.7354, !- Year 19 Escalation [2042] + 0.7382, !- Year 20 Escalation [2043] + 0.7382, !- Year 21 Escalation [2044] + 0.7407, !- Year 22 Escalation [2045] + 0.7739, !- Year 23 Escalation [2046] + 0.7854, !- Year 24 Escalation [2047] + 0.7866, !- Year 25 Escalation [2048] + 0.7885, !- Year 26 Escalation [2049] + 0.7894, !- Year 27 Escalation [2050] + 0.7970, !- Year 28 Escalation [2051] + 0.8071, !- Year 29 Escalation [2052] + 0.8175; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + West Commercial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9966, !- Year 1 Escalation [2024] + 1.0765, !- Year 2 Escalation [2025] + 1.2160, !- Year 3 Escalation [2026] + 1.3903, !- Year 4 Escalation [2027] + 1.5624, !- Year 5 Escalation [2028] + 1.6142, !- Year 6 Escalation [2029] + 1.6254, !- Year 7 Escalation [2030] + 1.6322, !- Year 8 Escalation [2031] + 1.6423, !- Year 9 Escalation [2032] + 1.6513, !- Year 10 Escalation [2033] + 1.6603, !- Year 11 Escalation [2034] + 1.6727, !- Year 12 Escalation [2035] + 1.6850, !- Year 13 Escalation [2036] + 1.6952, !- Year 14 Escalation [2037] + 1.7064, !- Year 15 Escalation [2038] + 1.7165, !- Year 16 Escalation [2039] + 1.7233, !- Year 17 Escalation [2040] + 1.7345, !- Year 18 Escalation [2041] + 1.7435, !- Year 19 Escalation [2042] + 1.7503, !- Year 20 Escalation [2043] + 1.7593, !- Year 21 Escalation [2044] + 1.7683, !- Year 22 Escalation [2045] + 1.7897, !- Year 23 Escalation [2046] + 1.7975, !- Year 24 Escalation [2047] + 1.8054, !- Year 25 Escalation [2048] + 1.8155, !- Year 26 Escalation [2049] + 1.8211, !- Year 27 Escalation [2050] + 1.8290, !- Year 28 Escalation [2051] + 1.8403, !- Year 29 Escalation [2052] + 1.8504; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + West Commercial-Natural Gas, !- Name + NaturalGas, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9068, !- Year 1 Escalation [2024] + 0.8571, !- Year 2 Escalation [2025] + 0.8243, !- Year 3 Escalation [2026] + 0.8048, !- Year 4 Escalation [2027] + 0.7968, !- Year 5 Escalation [2028] + 0.7986, !- Year 6 Escalation [2029] + 0.8030, !- Year 7 Escalation [2030] + 0.8110, !- Year 8 Escalation [2031] + 0.8199, !- Year 9 Escalation [2032] + 0.8332, !- Year 10 Escalation [2033] + 0.8474, !- Year 11 Escalation [2034] + 0.8598, !- Year 12 Escalation [2035] + 0.8660, !- Year 13 Escalation [2036] + 0.8722, !- Year 14 Escalation [2037] + 0.8838, !- Year 15 Escalation [2038] + 0.8846, !- Year 16 Escalation [2039] + 0.8909, !- Year 17 Escalation [2040] + 0.8988, !- Year 18 Escalation [2041] + 0.9033, !- Year 19 Escalation [2042] + 0.9033, !- Year 20 Escalation [2043] + 0.9006, !- Year 21 Escalation [2044] + 0.9059, !- Year 22 Escalation [2045] + 0.9849, !- Year 23 Escalation [2046] + 1.0089, !- Year 24 Escalation [2047] + 1.0044, !- Year 25 Escalation [2048] + 1.0053, !- Year 26 Escalation [2049] + 1.0080, !- Year 27 Escalation [2050] + 1.0257, !- Year 28 Escalation [2051] + 1.0479, !- Year 29 Escalation [2052] + 1.0710; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + West Industrial-Electricity, !- Name + Electricity, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.8804, !- Year 1 Escalation [2024] + 0.7829, !- Year 2 Escalation [2025] + 0.7486, !- Year 3 Escalation [2026] + 0.7324, !- Year 4 Escalation [2027] + 0.7213, !- Year 5 Escalation [2028] + 0.7152, !- Year 6 Escalation [2029] + 0.7135, !- Year 7 Escalation [2030] + 0.7118, !- Year 8 Escalation [2031] + 0.7139, !- Year 9 Escalation [2032] + 0.7179, !- Year 10 Escalation [2033] + 0.7223, !- Year 11 Escalation [2034] + 0.7263, !- Year 12 Escalation [2035] + 0.7290, !- Year 13 Escalation [2036] + 0.7364, !- Year 14 Escalation [2037] + 0.7489, !- Year 15 Escalation [2038] + 0.7570, !- Year 16 Escalation [2039] + 0.7637, !- Year 17 Escalation [2040] + 0.7685, !- Year 18 Escalation [2041] + 0.7711, !- Year 19 Escalation [2042] + 0.7732, !- Year 20 Escalation [2043] + 0.7752, !- Year 21 Escalation [2044] + 0.7786, !- Year 22 Escalation [2045] + 0.7802, !- Year 23 Escalation [2046] + 0.7789, !- Year 24 Escalation [2047] + 0.7782, !- Year 25 Escalation [2048] + 0.7769, !- Year 26 Escalation [2049] + 0.7745, !- Year 27 Escalation [2050] + 0.7732, !- Year 28 Escalation [2051] + 0.7722, !- Year 29 Escalation [2052] + 0.7708; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + West Industrial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9374, !- Year 1 Escalation [2024] + 0.8598, !- Year 2 Escalation [2025] + 0.8021, !- Year 3 Escalation [2026] + 0.7539, !- Year 4 Escalation [2027] + 0.7084, !- Year 5 Escalation [2028] + 0.6996, !- Year 6 Escalation [2029] + 0.7009, !- Year 7 Escalation [2030] + 0.7043, !- Year 8 Escalation [2031] + 0.7079, !- Year 9 Escalation [2032] + 0.7112, !- Year 10 Escalation [2033] + 0.7134, !- Year 11 Escalation [2034] + 0.7173, !- Year 12 Escalation [2035] + 0.7192, !- Year 13 Escalation [2036] + 0.7220, !- Year 14 Escalation [2037] + 0.7248, !- Year 15 Escalation [2038] + 0.7267, !- Year 16 Escalation [2039] + 0.7281, !- Year 17 Escalation [2040] + 0.7320, !- Year 18 Escalation [2041] + 0.7331, !- Year 19 Escalation [2042] + 0.7361, !- Year 20 Escalation [2043] + 0.7359, !- Year 21 Escalation [2044] + 0.7367, !- Year 22 Escalation [2045] + 0.7422, !- Year 23 Escalation [2046] + 0.7445, !- Year 24 Escalation [2047] + 0.7456, !- Year 25 Escalation [2048] + 0.7475, !- Year 26 Escalation [2049] + 0.7483, !- Year 27 Escalation [2050] + 0.7500, !- Year 28 Escalation [2051] + 0.7525, !- Year 29 Escalation [2052] + 0.7547; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + West Industrial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9846, !- Year 1 Escalation [2024] + 1.0636, !- Year 2 Escalation [2025] + 1.1963, !- Year 3 Escalation [2026] + 1.3640, !- Year 4 Escalation [2027] + 1.5274, !- Year 5 Escalation [2028] + 1.5757, !- Year 6 Escalation [2029] + 1.5866, !- Year 7 Escalation [2030] + 1.5921, !- Year 8 Escalation [2031] + 1.6009, !- Year 9 Escalation [2032] + 1.6107, !- Year 10 Escalation [2033] + 1.6206, !- Year 11 Escalation [2034] + 1.6338, !- Year 12 Escalation [2035] + 1.6404, !- Year 13 Escalation [2036] + 1.6502, !- Year 14 Escalation [2037] + 1.6612, !- Year 15 Escalation [2038] + 1.6721, !- Year 16 Escalation [2039] + 1.6787, !- Year 17 Escalation [2040] + 1.6886, !- Year 18 Escalation [2041] + 1.6963, !- Year 19 Escalation [2042] + 1.7072, !- Year 20 Escalation [2043] + 1.7138, !- Year 21 Escalation [2044] + 1.7193, !- Year 22 Escalation [2045] + 1.7379, !- Year 23 Escalation [2046] + 1.7434, !- Year 24 Escalation [2047] + 1.7533, !- Year 25 Escalation [2048] + 1.7664, !- Year 26 Escalation [2049] + 1.7796, !- Year 27 Escalation [2050] + 1.7939, !- Year 28 Escalation [2051] + 1.8059, !- Year 29 Escalation [2052] + 1.8191; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + West Industrial-Natural Gas, !- Name + NaturalGas, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.8492, !- Year 1 Escalation [2024] + 0.7622, !- Year 2 Escalation [2025] + 0.7052, !- Year 3 Escalation [2026] + 0.6658, !- Year 4 Escalation [2027] + 0.6467, !- Year 5 Escalation [2028] + 0.6413, !- Year 6 Escalation [2029] + 0.6427, !- Year 7 Escalation [2030] + 0.6522, !- Year 8 Escalation [2031] + 0.6644, !- Year 9 Escalation [2032] + 0.6848, !- Year 10 Escalation [2033] + 0.7065, !- Year 11 Escalation [2034] + 0.7269, !- Year 12 Escalation [2035] + 0.7351, !- Year 13 Escalation [2036] + 0.7418, !- Year 14 Escalation [2037] + 0.7582, !- Year 15 Escalation [2038] + 0.7568, !- Year 16 Escalation [2039] + 0.7677, !- Year 17 Escalation [2040] + 0.7799, !- Year 18 Escalation [2041] + 0.7853, !- Year 19 Escalation [2042] + 0.7826, !- Year 20 Escalation [2043] + 0.7745, !- Year 21 Escalation [2044] + 0.7731, !- Year 22 Escalation [2045] + 0.7636, !- Year 23 Escalation [2046] + 0.7609, !- Year 24 Escalation [2047] + 0.7554, !- Year 25 Escalation [2048] + 0.7541, !- Year 26 Escalation [2049] + 0.7554, !- Year 27 Escalation [2050] + 0.7541, !- Year 28 Escalation [2051] + 0.7514, !- Year 29 Escalation [2052] + 0.7473; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + West Industrial-Coal, !- Name + Coal, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 1.0000, !- Year 1 Escalation [2024] + 1.0177, !- Year 2 Escalation [2025] + 1.0247, !- Year 3 Escalation [2026] + 1.0212, !- Year 4 Escalation [2027] + 1.0141, !- Year 5 Escalation [2028] + 1.0071, !- Year 6 Escalation [2029] + 1.0035, !- Year 7 Escalation [2030] + 1.0000, !- Year 8 Escalation [2031] + 0.9965, !- Year 9 Escalation [2032] + 0.9929, !- Year 10 Escalation [2033] + 0.9894, !- Year 11 Escalation [2034] + 0.9859, !- Year 12 Escalation [2035] + 0.9859, !- Year 13 Escalation [2036] + 0.9859, !- Year 14 Escalation [2037] + 0.9859, !- Year 15 Escalation [2038] + 0.9823, !- Year 16 Escalation [2039] + 0.9823, !- Year 17 Escalation [2040] + 0.9788, !- Year 18 Escalation [2041] + 0.9788, !- Year 19 Escalation [2042] + 0.9788, !- Year 20 Escalation [2043] + 0.9788, !- Year 21 Escalation [2044] + 0.9823, !- Year 22 Escalation [2045] + 0.9823, !- Year 23 Escalation [2046] + 0.9823, !- Year 24 Escalation [2047] + 0.9823, !- Year 25 Escalation [2048] + 0.9823, !- Year 26 Escalation [2049] + 0.9823, !- Year 27 Escalation [2050] + 0.9823, !- Year 28 Escalation [2051] + 0.9823, !- Year 29 Escalation [2052] + 0.9823; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + U.S. Avg Residential-Electricity, !- Name + Electricity, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9768, !- Year 1 Escalation [2024] + 0.9497, !- Year 2 Escalation [2025] + 0.9298, !- Year 3 Escalation [2026] + 0.9159, !- Year 4 Escalation [2027] + 0.9063, !- Year 5 Escalation [2028] + 0.9023, !- Year 6 Escalation [2029] + 0.9034, !- Year 7 Escalation [2030] + 0.9075, !- Year 8 Escalation [2031] + 0.9121, !- Year 9 Escalation [2032] + 0.9233, !- Year 10 Escalation [2033] + 0.9346, !- Year 11 Escalation [2034] + 0.9382, !- Year 12 Escalation [2035] + 0.9427, !- Year 13 Escalation [2036] + 0.9494, !- Year 14 Escalation [2037] + 0.9588, !- Year 15 Escalation [2038] + 0.9667, !- Year 16 Escalation [2039] + 0.9736, !- Year 17 Escalation [2040] + 0.9796, !- Year 18 Escalation [2041] + 0.9835, !- Year 19 Escalation [2042] + 0.9859, !- Year 20 Escalation [2043] + 0.9878, !- Year 21 Escalation [2044] + 0.9899, !- Year 22 Escalation [2045] + 0.9892, !- Year 23 Escalation [2046] + 0.9866, !- Year 24 Escalation [2047] + 0.9849, !- Year 25 Escalation [2048] + 0.9811, !- Year 26 Escalation [2049] + 0.9746, !- Year 27 Escalation [2050] + 0.9701, !- Year 28 Escalation [2051] + 0.9665, !- Year 29 Escalation [2052] + 0.9631; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + U.S. Avg Residential-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9551, !- Year 1 Escalation [2024] + 0.9090, !- Year 2 Escalation [2025] + 0.8866, !- Year 3 Escalation [2026] + 0.8731, !- Year 4 Escalation [2027] + 0.8635, !- Year 5 Escalation [2028] + 0.8632, !- Year 6 Escalation [2029] + 0.8641, !- Year 7 Escalation [2030] + 0.8680, !- Year 8 Escalation [2031] + 0.8713, !- Year 9 Escalation [2032] + 0.8746, !- Year 10 Escalation [2033] + 0.8767, !- Year 11 Escalation [2034] + 0.8809, !- Year 12 Escalation [2035] + 0.8824, !- Year 13 Escalation [2036] + 0.8854, !- Year 14 Escalation [2037] + 0.8881, !- Year 15 Escalation [2038] + 0.8899, !- Year 16 Escalation [2039] + 0.8911, !- Year 17 Escalation [2040] + 0.8949, !- Year 18 Escalation [2041] + 0.8961, !- Year 19 Escalation [2042] + 0.8985, !- Year 20 Escalation [2043] + 0.8973, !- Year 21 Escalation [2044] + 0.8976, !- Year 22 Escalation [2045] + 0.9027, !- Year 23 Escalation [2046] + 0.9048, !- Year 24 Escalation [2047] + 0.9057, !- Year 25 Escalation [2048] + 0.9075, !- Year 26 Escalation [2049] + 0.9078, !- Year 27 Escalation [2050] + 0.9093, !- Year 28 Escalation [2051] + 0.9114, !- Year 29 Escalation [2052] + 0.9135; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + U.S. Avg Residential-Natural Gas, !- Name + NaturalGas, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9292, !- Year 1 Escalation [2024] + 0.8690, !- Year 2 Escalation [2025] + 0.8244, !- Year 3 Escalation [2026] + 0.7918, !- Year 4 Escalation [2027] + 0.7712, !- Year 5 Escalation [2028] + 0.7691, !- Year 6 Escalation [2029] + 0.7727, !- Year 7 Escalation [2030] + 0.7783, !- Year 8 Escalation [2031] + 0.7854, !- Year 9 Escalation [2032] + 0.7946, !- Year 10 Escalation [2033] + 0.8038, !- Year 11 Escalation [2034] + 0.8116, !- Year 12 Escalation [2035] + 0.8159, !- Year 13 Escalation [2036] + 0.8215, !- Year 14 Escalation [2037] + 0.8300, !- Year 15 Escalation [2038] + 0.8329, !- Year 16 Escalation [2039] + 0.8378, !- Year 17 Escalation [2040] + 0.8449, !- Year 18 Escalation [2041] + 0.8477, !- Year 19 Escalation [2042] + 0.8477, !- Year 20 Escalation [2043] + 0.8449, !- Year 21 Escalation [2044] + 0.8477, !- Year 22 Escalation [2045] + 0.8654, !- Year 23 Escalation [2046] + 0.8697, !- Year 24 Escalation [2047] + 0.8676, !- Year 25 Escalation [2048] + 0.8676, !- Year 26 Escalation [2049] + 0.8697, !- Year 27 Escalation [2050] + 0.8732, !- Year 28 Escalation [2051] + 0.8775, !- Year 29 Escalation [2052] + 0.8824; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + U.S. Avg Residential-LPG, !- Name + Propane, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 1.0224, !- Year 1 Escalation [2024] + 0.9977, !- Year 2 Escalation [2025] + 0.9623, !- Year 3 Escalation [2026] + 0.9317, !- Year 4 Escalation [2027] + 0.9122, !- Year 5 Escalation [2028] + 0.9034, !- Year 6 Escalation [2029] + 0.9041, !- Year 7 Escalation [2030] + 0.9119, !- Year 8 Escalation [2031] + 0.9255, !- Year 9 Escalation [2032] + 0.9437, !- Year 10 Escalation [2033] + 0.9629, !- Year 11 Escalation [2034] + 0.9792, !- Year 12 Escalation [2035] + 0.9915, !- Year 13 Escalation [2036] + 1.0023, !- Year 14 Escalation [2037] + 1.0146, !- Year 15 Escalation [2038] + 1.0231, !- Year 16 Escalation [2039] + 1.0325, !- Year 17 Escalation [2040] + 1.0429, !- Year 18 Escalation [2041] + 1.0511, !- Year 19 Escalation [2042] + 1.0559, !- Year 20 Escalation [2043] + 1.0576, !- Year 21 Escalation [2044] + 1.0595, !- Year 22 Escalation [2045] + 1.0654, !- Year 23 Escalation [2046] + 1.0683, !- Year 24 Escalation [2047] + 1.0706, !- Year 25 Escalation [2048] + 1.0722, !- Year 26 Escalation [2049] + 1.0722, !- Year 27 Escalation [2050] + 1.0738, !- Year 28 Escalation [2051] + 1.0761, !- Year 29 Escalation [2052] + 1.0784; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + U.S. Avg Commercial-Electricity, !- Name + Electricity, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9623, !- Year 1 Escalation [2024] + 0.9208, !- Year 2 Escalation [2025] + 0.8939, !- Year 3 Escalation [2026] + 0.8759, !- Year 4 Escalation [2027] + 0.8615, !- Year 5 Escalation [2028] + 0.8529, !- Year 6 Escalation [2029] + 0.8504, !- Year 7 Escalation [2030] + 0.8498, !- Year 8 Escalation [2031] + 0.8490, !- Year 9 Escalation [2032] + 0.8559, !- Year 10 Escalation [2033] + 0.8631, !- Year 11 Escalation [2034] + 0.8631, !- Year 12 Escalation [2035] + 0.8648, !- Year 13 Escalation [2036] + 0.8676, !- Year 14 Escalation [2037] + 0.8736, !- Year 15 Escalation [2038] + 0.8786, !- Year 16 Escalation [2039] + 0.8828, !- Year 17 Escalation [2040] + 0.8858, !- Year 18 Escalation [2041] + 0.8869, !- Year 19 Escalation [2042] + 0.8872, !- Year 20 Escalation [2043] + 0.8864, !- Year 21 Escalation [2044] + 0.8850, !- Year 22 Escalation [2045] + 0.8811, !- Year 23 Escalation [2046] + 0.8742, !- Year 24 Escalation [2047] + 0.8700, !- Year 25 Escalation [2048] + 0.8642, !- Year 26 Escalation [2049] + 0.8556, !- Year 27 Escalation [2050] + 0.8490, !- Year 28 Escalation [2051] + 0.8429, !- Year 29 Escalation [2052] + 0.8368; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + U.S. Avg Commercial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9299, !- Year 1 Escalation [2024] + 0.8494, !- Year 2 Escalation [2025] + 0.7922, !- Year 3 Escalation [2026] + 0.7442, !- Year 4 Escalation [2027] + 0.7001, !- Year 5 Escalation [2028] + 0.6914, !- Year 6 Escalation [2029] + 0.6920, !- Year 7 Escalation [2030] + 0.6956, !- Year 8 Escalation [2031] + 0.6992, !- Year 9 Escalation [2032] + 0.7021, !- Year 10 Escalation [2033] + 0.7042, !- Year 11 Escalation [2034] + 0.7078, !- Year 12 Escalation [2035] + 0.7096, !- Year 13 Escalation [2036] + 0.7123, !- Year 14 Escalation [2037] + 0.7150, !- Year 15 Escalation [2038] + 0.7165, !- Year 16 Escalation [2039] + 0.7179, !- Year 17 Escalation [2040] + 0.7218, !- Year 18 Escalation [2041] + 0.7227, !- Year 19 Escalation [2042] + 0.7254, !- Year 20 Escalation [2043] + 0.7242, !- Year 21 Escalation [2044] + 0.7251, !- Year 22 Escalation [2045] + 0.7370, !- Year 23 Escalation [2046] + 0.7415, !- Year 24 Escalation [2047] + 0.7421, !- Year 25 Escalation [2048] + 0.7439, !- Year 26 Escalation [2049] + 0.7445, !- Year 27 Escalation [2050] + 0.7475, !- Year 28 Escalation [2051] + 0.7513, !- Year 29 Escalation [2052] + 0.7555; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + U.S. Avg Commercial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 1.0181, !- Year 1 Escalation [2024] + 1.0915, !- Year 2 Escalation [2025] + 1.2169, !- Year 3 Escalation [2026] + 1.3751, !- Year 4 Escalation [2027] + 1.5412, !- Year 5 Escalation [2028] + 1.5910, !- Year 6 Escalation [2029] + 1.6011, !- Year 7 Escalation [2030] + 1.6124, !- Year 8 Escalation [2031] + 1.6237, !- Year 9 Escalation [2032] + 1.6339, !- Year 10 Escalation [2033] + 1.6452, !- Year 11 Escalation [2034] + 1.6576, !- Year 12 Escalation [2035] + 1.6678, !- Year 13 Escalation [2036] + 1.6791, !- Year 14 Escalation [2037] + 1.6904, !- Year 15 Escalation [2038] + 1.6994, !- Year 16 Escalation [2039] + 1.7085, !- Year 17 Escalation [2040] + 1.7209, !- Year 18 Escalation [2041] + 1.7254, !- Year 19 Escalation [2042] + 1.7322, !- Year 20 Escalation [2043] + 1.7367, !- Year 21 Escalation [2044] + 1.7424, !- Year 22 Escalation [2045] + 1.7571, !- Year 23 Escalation [2046] + 1.7616, !- Year 24 Escalation [2047] + 1.7718, !- Year 25 Escalation [2048] + 1.7831, !- Year 26 Escalation [2049] + 1.7921, !- Year 27 Escalation [2050] + 1.8011, !- Year 28 Escalation [2051] + 1.8113, !- Year 29 Escalation [2052] + 1.8215; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + U.S. Avg Commercial-Natural Gas, !- Name + NaturalGas, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9123, !- Year 1 Escalation [2024] + 0.8541, !- Year 2 Escalation [2025] + 0.8151, !- Year 3 Escalation [2026] + 0.7912, !- Year 4 Escalation [2027] + 0.7798, !- Year 5 Escalation [2028] + 0.7798, !- Year 6 Escalation [2029] + 0.7827, !- Year 7 Escalation [2030] + 0.7893, !- Year 8 Escalation [2031] + 0.7960, !- Year 9 Escalation [2032] + 0.8074, !- Year 10 Escalation [2033] + 0.8179, !- Year 11 Escalation [2034] + 0.8265, !- Year 12 Escalation [2035] + 0.8313, !- Year 13 Escalation [2036] + 0.8370, !- Year 14 Escalation [2037] + 0.8475, !- Year 15 Escalation [2038] + 0.8494, !- Year 16 Escalation [2039] + 0.8551, !- Year 17 Escalation [2040] + 0.8637, !- Year 18 Escalation [2041] + 0.8665, !- Year 19 Escalation [2042] + 0.8656, !- Year 20 Escalation [2043] + 0.8618, !- Year 21 Escalation [2044] + 0.8646, !- Year 22 Escalation [2045] + 0.8799, !- Year 23 Escalation [2046] + 0.8818, !- Year 24 Escalation [2047] + 0.8770, !- Year 25 Escalation [2048] + 0.8761, !- Year 26 Escalation [2049] + 0.8789, !- Year 27 Escalation [2050] + 0.8818, !- Year 28 Escalation [2051] + 0.8847, !- Year 29 Escalation [2052] + 0.8875; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + U.S. Avg Industrial-Electricity, !- Name + Electricity, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9385, !- Year 1 Escalation [2024] + 0.8825, !- Year 2 Escalation [2025] + 0.8451, !- Year 3 Escalation [2026] + 0.8194, !- Year 4 Escalation [2027] + 0.8023, !- Year 5 Escalation [2028] + 0.7924, !- Year 6 Escalation [2029] + 0.7890, !- Year 7 Escalation [2030] + 0.7882, !- Year 8 Escalation [2031] + 0.7886, !- Year 9 Escalation [2032] + 0.7986, !- Year 10 Escalation [2033] + 0.8048, !- Year 11 Escalation [2034] + 0.8044, !- Year 12 Escalation [2035] + 0.8077, !- Year 13 Escalation [2036] + 0.8140, !- Year 14 Escalation [2037] + 0.8239, !- Year 15 Escalation [2038] + 0.8339, !- Year 16 Escalation [2039] + 0.8414, !- Year 17 Escalation [2040] + 0.8472, !- Year 18 Escalation [2041] + 0.8493, !- Year 19 Escalation [2042] + 0.8480, !- Year 20 Escalation [2043] + 0.8472, !- Year 21 Escalation [2044] + 0.8459, !- Year 22 Escalation [2045] + 0.8414, !- Year 23 Escalation [2046] + 0.8360, !- Year 24 Escalation [2047] + 0.8322, !- Year 25 Escalation [2048] + 0.8277, !- Year 26 Escalation [2049] + 0.8202, !- Year 27 Escalation [2050] + 0.8144, !- Year 28 Escalation [2051] + 0.8094, !- Year 29 Escalation [2052] + 0.8040; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + U.S. Avg Industrial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.9299, !- Year 1 Escalation [2024] + 0.8484, !- Year 2 Escalation [2025] + 0.7900, !- Year 3 Escalation [2026] + 0.7406, !- Year 4 Escalation [2027] + 0.6950, !- Year 5 Escalation [2028] + 0.6863, !- Year 6 Escalation [2029] + 0.6872, !- Year 7 Escalation [2030] + 0.6911, !- Year 8 Escalation [2031] + 0.6947, !- Year 9 Escalation [2032] + 0.6980, !- Year 10 Escalation [2033] + 0.7004, !- Year 11 Escalation [2034] + 0.7046, !- Year 12 Escalation [2035] + 0.7064, !- Year 13 Escalation [2036] + 0.7094, !- Year 14 Escalation [2037] + 0.7124, !- Year 15 Escalation [2038] + 0.7142, !- Year 16 Escalation [2039] + 0.7157, !- Year 17 Escalation [2040] + 0.7199, !- Year 18 Escalation [2041] + 0.7211, !- Year 19 Escalation [2042] + 0.7241, !- Year 20 Escalation [2043] + 0.7232, !- Year 21 Escalation [2044] + 0.7238, !- Year 22 Escalation [2045] + 0.7292, !- Year 23 Escalation [2046] + 0.7316, !- Year 24 Escalation [2047] + 0.7328, !- Year 25 Escalation [2048] + 0.7346, !- Year 26 Escalation [2049] + 0.7355, !- Year 27 Escalation [2050] + 0.7373, !- Year 28 Escalation [2051] + 0.7394, !- Year 29 Escalation [2052] + 0.7418; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + U.S. Avg Industrial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 1.0221, !- Year 1 Escalation [2024] + 1.1136, !- Year 2 Escalation [2025] + 1.2482, !- Year 3 Escalation [2026] + 1.4185, !- Year 4 Escalation [2027] + 1.5899, !- Year 5 Escalation [2028] + 1.6404, !- Year 6 Escalation [2029] + 1.6509, !- Year 7 Escalation [2030] + 1.6635, !- Year 8 Escalation [2031] + 1.6761, !- Year 9 Escalation [2032] + 1.6887, !- Year 10 Escalation [2033] + 1.7014, !- Year 11 Escalation [2034] + 1.7140, !- Year 12 Escalation [2035] + 1.7256, !- Year 13 Escalation [2036] + 1.7361, !- Year 14 Escalation [2037] + 1.7487, !- Year 15 Escalation [2038] + 1.7581, !- Year 16 Escalation [2039] + 1.7676, !- Year 17 Escalation [2040] + 1.7813, !- Year 18 Escalation [2041] + 1.7865, !- Year 19 Escalation [2042] + 1.7928, !- Year 20 Escalation [2043] + 1.7939, !- Year 21 Escalation [2044] + 1.7981, !- Year 22 Escalation [2045] + 1.8139, !- Year 23 Escalation [2046] + 1.8191, !- Year 24 Escalation [2047] + 1.8275, !- Year 25 Escalation [2048] + 1.8381, !- Year 26 Escalation [2049] + 1.8454, !- Year 27 Escalation [2050] + 1.8549, !- Year 28 Escalation [2051] + 1.8644, !- Year 29 Escalation [2052] + 1.8749; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + U.S. Avg Industrial-Natural Gas, !- Name + NaturalGas, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 0.8313, !- Year 1 Escalation [2024] + 0.7255, !- Year 2 Escalation [2025] + 0.6534, !- Year 3 Escalation [2026] + 0.6104, !- Year 4 Escalation [2027] + 0.5920, !- Year 5 Escalation [2028] + 0.5905, !- Year 6 Escalation [2029] + 0.5982, !- Year 7 Escalation [2030] + 0.6120, !- Year 8 Escalation [2031] + 0.6288, !- Year 9 Escalation [2032] + 0.6503, !- Year 10 Escalation [2033] + 0.6718, !- Year 11 Escalation [2034] + 0.6887, !- Year 12 Escalation [2035] + 0.6963, !- Year 13 Escalation [2036] + 0.7009, !- Year 14 Escalation [2037] + 0.7178, !- Year 15 Escalation [2038] + 0.7163, !- Year 16 Escalation [2039] + 0.7270, !- Year 17 Escalation [2040] + 0.7408, !- Year 18 Escalation [2041] + 0.7439, !- Year 19 Escalation [2042] + 0.7377, !- Year 20 Escalation [2043] + 0.7301, !- Year 21 Escalation [2044] + 0.7270, !- Year 22 Escalation [2045] + 0.7239, !- Year 23 Escalation [2046] + 0.7178, !- Year 24 Escalation [2047] + 0.7132, !- Year 25 Escalation [2048] + 0.7071, !- Year 26 Escalation [2049] + 0.7040, !- Year 27 Escalation [2050] + 0.7009, !- Year 28 Escalation [2051] + 0.6963, !- Year 29 Escalation [2052] + 0.6917; !- Year 30 Escalation [2053] + +LifeCycleCost:UsePriceEscalation, + U.S. Avg Industrial-Coal, !- Name + Coal, !- Resource + 2024, !- Escalation Start Year + January, !- Escalation Start Month + 1.0182, !- Year 1 Escalation [2024] + 1.0400, !- Year 2 Escalation [2025] + 1.0436, !- Year 3 Escalation [2026] + 1.0400, !- Year 4 Escalation [2027] + 1.0327, !- Year 5 Escalation [2028] + 1.0291, !- Year 6 Escalation [2029] + 1.0255, !- Year 7 Escalation [2030] + 1.0255, !- Year 8 Escalation [2031] + 1.0218, !- Year 9 Escalation [2032] + 1.0218, !- Year 10 Escalation [2033] + 1.0218, !- Year 11 Escalation [2034] + 1.0218, !- Year 12 Escalation [2035] + 1.0218, !- Year 13 Escalation [2036] + 1.0255, !- Year 14 Escalation [2037] + 1.0327, !- Year 15 Escalation [2038] + 1.0364, !- Year 16 Escalation [2039] + 1.0364, !- Year 17 Escalation [2040] + 1.0364, !- Year 18 Escalation [2041] + 1.0364, !- Year 19 Escalation [2042] + 1.0364, !- Year 20 Escalation [2043] + 1.0364, !- Year 21 Escalation [2044] + 1.0400, !- Year 22 Escalation [2045] + 1.0400, !- Year 23 Escalation [2046] + 1.0400, !- Year 24 Escalation [2047] + 1.0436, !- Year 25 Escalation [2048] + 1.0436, !- Year 26 Escalation [2049] + 1.0436, !- Year 27 Escalation [2050] + 1.0436, !- Year 28 Escalation [2051] + 1.0436, !- Year 29 Escalation [2052] + 1.0436; !- Year 30 Escalation [2053] + diff --git a/datasets/LCCusePriceEscalationDataSet2024.idf b/datasets/LCCusePriceEscalationDataSet2024.idf new file mode 100644 index 00000000000..6e12aee7076 --- /dev/null +++ b/datasets/LCCusePriceEscalationDataSet2024.idf @@ -0,0 +1,6431 @@ +! The source of the values for the following objects is: +! +! NISTIR 85-3273-34 +! +! ENERGY PRICE INDICES AND DISCOUNT FACTORS +! FOR LIFE-CYCLE COST ANALYSIS - 2024 +! +! Annual Supplement to NIST Handbook 135 +! +! Priya D. Lavappa +! Joshua D. Kneifel +! +! These are factors for the United States and regions of the United States. +! +! The factors are from a file available upon request from NIST called ENCOSTxx.TXT and are +! converted into EnergyPlus objects using scripts/dev/update_nist_escalation.py +! https://www.energy.gov/eere/femp/building-life-cycle-cost-programs +! +! Kneifel, J. D. (2024). Energy Price Indices and Discount Factors for Life-Cycle Cost Analysis 2024: +! National Institute of Standards and Technology. https://doi.org/10.6028/nist.ir.85-3273-39 +! +! Includes normal ENCOST file as well as division level data in the same format. + +LifeCycleCost:UsePriceEscalation, + NorthEast Residential-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9898, !- Year 1 Escalation [2025] + 0.9798, !- Year 2 Escalation [2026] + 0.9808, !- Year 3 Escalation [2027] + 0.9838, !- Year 4 Escalation [2028] + 0.9902, !- Year 5 Escalation [2029] + 0.9934, !- Year 6 Escalation [2030] + 1.0016, !- Year 7 Escalation [2031] + 1.0168, !- Year 8 Escalation [2032] + 1.0286, !- Year 9 Escalation [2033] + 1.0474, !- Year 10 Escalation [2034] + 1.0471, !- Year 11 Escalation [2035] + 1.0596, !- Year 12 Escalation [2036] + 1.0657, !- Year 13 Escalation [2037] + 1.0792, !- Year 14 Escalation [2038] + 1.0919, !- Year 15 Escalation [2039] + 1.0990, !- Year 16 Escalation [2040] + 1.1080, !- Year 17 Escalation [2041] + 1.1134, !- Year 18 Escalation [2042] + 1.1182, !- Year 19 Escalation [2043] + 1.1144, !- Year 20 Escalation [2044] + 1.1149, !- Year 21 Escalation [2045] + 1.1144, !- Year 22 Escalation [2046] + 1.1116, !- Year 23 Escalation [2047] + 1.1118, !- Year 24 Escalation [2048] + 1.0979, !- Year 25 Escalation [2049] + 1.0906, !- Year 26 Escalation [2050] + 1.0848, !- Year 27 Escalation [2051] + 1.0790, !- Year 28 Escalation [2052] + 1.0733, !- Year 29 Escalation [2053] + 1.0675; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + NorthEast Residential-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9492, !- Year 1 Escalation [2025] + 0.9355, !- Year 2 Escalation [2026] + 0.9221, !- Year 3 Escalation [2027] + 0.9143, !- Year 4 Escalation [2028] + 0.9171, !- Year 5 Escalation [2029] + 0.9178, !- Year 6 Escalation [2030] + 0.9234, !- Year 7 Escalation [2031] + 0.9265, !- Year 8 Escalation [2032] + 0.9305, !- Year 9 Escalation [2033] + 0.9321, !- Year 10 Escalation [2034] + 0.9380, !- Year 11 Escalation [2035] + 0.9383, !- Year 12 Escalation [2036] + 0.9427, !- Year 13 Escalation [2037] + 0.9455, !- Year 14 Escalation [2038] + 0.9470, !- Year 15 Escalation [2039] + 0.9486, !- Year 16 Escalation [2040] + 0.9539, !- Year 17 Escalation [2041] + 0.9536, !- Year 18 Escalation [2042] + 0.9573, !- Year 19 Escalation [2043] + 0.9545, !- Year 20 Escalation [2044] + 0.9561, !- Year 21 Escalation [2045] + 0.9626, !- Year 22 Escalation [2046] + 0.9636, !- Year 23 Escalation [2047] + 0.9648, !- Year 24 Escalation [2048] + 0.9673, !- Year 25 Escalation [2049] + 0.9673, !- Year 26 Escalation [2050] + 0.9685, !- Year 27 Escalation [2051] + 0.9698, !- Year 28 Escalation [2052] + 0.9710, !- Year 29 Escalation [2053] + 0.9723; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + NorthEast Residential-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9522, !- Year 1 Escalation [2025] + 0.9151, !- Year 2 Escalation [2026] + 0.8881, !- Year 3 Escalation [2027] + 0.8704, !- Year 4 Escalation [2028] + 0.8750, !- Year 5 Escalation [2029] + 0.8673, !- Year 6 Escalation [2030] + 0.8673, !- Year 7 Escalation [2031] + 0.8681, !- Year 8 Escalation [2032] + 0.8735, !- Year 9 Escalation [2033] + 0.8750, !- Year 10 Escalation [2034] + 0.8758, !- Year 11 Escalation [2035] + 0.8773, !- Year 12 Escalation [2036] + 0.8827, !- Year 13 Escalation [2037] + 0.8935, !- Year 14 Escalation [2038] + 0.8951, !- Year 15 Escalation [2039] + 0.8989, !- Year 16 Escalation [2040] + 0.9051, !- Year 17 Escalation [2041] + 0.9059, !- Year 18 Escalation [2042] + 0.9043, !- Year 19 Escalation [2043] + 0.8974, !- Year 20 Escalation [2044] + 0.9059, !- Year 21 Escalation [2045] + 0.9028, !- Year 22 Escalation [2046] + 0.8958, !- Year 23 Escalation [2047] + 0.8889, !- Year 24 Escalation [2048] + 0.8889, !- Year 25 Escalation [2049] + 0.8966, !- Year 26 Escalation [2050] + 0.8951, !- Year 27 Escalation [2051] + 0.8935, !- Year 28 Escalation [2052] + 0.8920, !- Year 29 Escalation [2053] + 0.8904; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + NorthEast Residential-LPG, !- Name + Propane, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9659, !- Year 1 Escalation [2025] + 0.9310, !- Year 2 Escalation [2026] + 0.9026, !- Year 3 Escalation [2027] + 0.8865, !- Year 4 Escalation [2028] + 0.8803, !- Year 5 Escalation [2029] + 0.8833, !- Year 6 Escalation [2030] + 0.8923, !- Year 7 Escalation [2031] + 0.9070, !- Year 8 Escalation [2032] + 0.9258, !- Year 9 Escalation [2033] + 0.9444, !- Year 10 Escalation [2034] + 0.9594, !- Year 11 Escalation [2035] + 0.9708, !- Year 12 Escalation [2036] + 0.9806, !- Year 13 Escalation [2037] + 0.9937, !- Year 14 Escalation [2038] + 1.0000, !- Year 15 Escalation [2039] + 1.0101, !- Year 16 Escalation [2040] + 1.0202, !- Year 17 Escalation [2041] + 1.0273, !- Year 18 Escalation [2042] + 1.0308, !- Year 19 Escalation [2043] + 1.0316, !- Year 20 Escalation [2044] + 1.0336, !- Year 21 Escalation [2045] + 1.0344, !- Year 22 Escalation [2046] + 1.0355, !- Year 23 Escalation [2047] + 1.0379, !- Year 24 Escalation [2048] + 1.0387, !- Year 25 Escalation [2049] + 1.0382, !- Year 26 Escalation [2050] + 1.0390, !- Year 27 Escalation [2051] + 1.0401, !- Year 28 Escalation [2052] + 1.0409, !- Year 29 Escalation [2053] + 1.0420; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + NorthEast Commercial-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9814, !- Year 1 Escalation [2025] + 0.9589, !- Year 2 Escalation [2026] + 0.9566, !- Year 3 Escalation [2027] + 0.9525, !- Year 4 Escalation [2028] + 0.9489, !- Year 5 Escalation [2029] + 0.9464, !- Year 6 Escalation [2030] + 0.9474, !- Year 7 Escalation [2031] + 0.9563, !- Year 8 Escalation [2032] + 0.9655, !- Year 9 Escalation [2033] + 0.9805, !- Year 10 Escalation [2034] + 0.9809, !- Year 11 Escalation [2035] + 0.9875, !- Year 12 Escalation [2036] + 0.9888, !- Year 13 Escalation [2037] + 1.0036, !- Year 14 Escalation [2038] + 1.0180, !- Year 15 Escalation [2039] + 1.0220, !- Year 16 Escalation [2040] + 1.0297, !- Year 17 Escalation [2041] + 1.0322, !- Year 18 Escalation [2042] + 1.0364, !- Year 19 Escalation [2043] + 1.0297, !- Year 20 Escalation [2044] + 1.0246, !- Year 21 Escalation [2045] + 1.0218, !- Year 22 Escalation [2046] + 1.0136, !- Year 23 Escalation [2047] + 1.0119, !- Year 24 Escalation [2048] + 0.9922, !- Year 25 Escalation [2049] + 0.9818, !- Year 26 Escalation [2050] + 0.9720, !- Year 27 Escalation [2051] + 0.9625, !- Year 28 Escalation [2052] + 0.9527, !- Year 29 Escalation [2053] + 0.9434; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + NorthEast Commercial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9106, !- Year 1 Escalation [2025] + 0.8574, !- Year 2 Escalation [2026] + 0.8049, !- Year 3 Escalation [2027] + 0.7583, !- Year 4 Escalation [2028] + 0.7605, !- Year 5 Escalation [2029] + 0.7605, !- Year 6 Escalation [2030] + 0.7658, !- Year 7 Escalation [2031] + 0.7683, !- Year 8 Escalation [2032] + 0.7711, !- Year 9 Escalation [2033] + 0.7727, !- Year 10 Escalation [2034] + 0.7770, !- Year 11 Escalation [2035] + 0.7777, !- Year 12 Escalation [2036] + 0.7808, !- Year 13 Escalation [2037] + 0.7833, !- Year 14 Escalation [2038] + 0.7839, !- Year 15 Escalation [2039] + 0.7849, !- Year 16 Escalation [2040] + 0.7892, !- Year 17 Escalation [2041] + 0.7886, !- Year 18 Escalation [2042] + 0.7914, !- Year 19 Escalation [2043] + 0.7877, !- Year 20 Escalation [2044] + 0.7889, !- Year 21 Escalation [2045] + 0.7946, !- Year 22 Escalation [2046] + 0.7942, !- Year 23 Escalation [2047] + 0.7942, !- Year 24 Escalation [2048] + 0.7952, !- Year 25 Escalation [2049] + 0.7939, !- Year 26 Escalation [2050] + 0.7939, !- Year 27 Escalation [2051] + 0.7939, !- Year 28 Escalation [2052] + 0.7936, !- Year 29 Escalation [2053] + 0.7936; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + NorthEast Commercial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0285, !- Year 1 Escalation [2025] + 1.1875, !- Year 2 Escalation [2026] + 1.3476, !- Year 3 Escalation [2027] + 1.5055, !- Year 4 Escalation [2028] + 1.5154, !- Year 5 Escalation [2029] + 1.5252, !- Year 6 Escalation [2030] + 1.5373, !- Year 7 Escalation [2031] + 1.5482, !- Year 8 Escalation [2032] + 1.5581, !- Year 9 Escalation [2033] + 1.5691, !- Year 10 Escalation [2034] + 1.5811, !- Year 11 Escalation [2035] + 1.5910, !- Year 12 Escalation [2036] + 1.6020, !- Year 13 Escalation [2037] + 1.6129, !- Year 14 Escalation [2038] + 1.6206, !- Year 15 Escalation [2039] + 1.6294, !- Year 16 Escalation [2040] + 1.6436, !- Year 17 Escalation [2041] + 1.6447, !- Year 18 Escalation [2042] + 1.6524, !- Year 19 Escalation [2043] + 1.6579, !- Year 20 Escalation [2044] + 1.6634, !- Year 21 Escalation [2045] + 1.6809, !- Year 22 Escalation [2046] + 1.6809, !- Year 23 Escalation [2047] + 1.6941, !- Year 24 Escalation [2048] + 1.7039, !- Year 25 Escalation [2049] + 1.7116, !- Year 26 Escalation [2050] + 1.7193, !- Year 27 Escalation [2051] + 1.7270, !- Year 28 Escalation [2052] + 1.7346, !- Year 29 Escalation [2053] + 1.7423; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + NorthEast Commercial-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9430, !- Year 1 Escalation [2025] + 0.8974, !- Year 2 Escalation [2026] + 0.8653, !- Year 3 Escalation [2027] + 0.8394, !- Year 4 Escalation [2028] + 0.8425, !- Year 5 Escalation [2029] + 0.8311, !- Year 6 Escalation [2030] + 0.8290, !- Year 7 Escalation [2031] + 0.8290, !- Year 8 Escalation [2032] + 0.8342, !- Year 9 Escalation [2033] + 0.8352, !- Year 10 Escalation [2034] + 0.8352, !- Year 11 Escalation [2035] + 0.8363, !- Year 12 Escalation [2036] + 0.8425, !- Year 13 Escalation [2037] + 0.8570, !- Year 14 Escalation [2038] + 0.8591, !- Year 15 Escalation [2039] + 0.8653, !- Year 16 Escalation [2040] + 0.8736, !- Year 17 Escalation [2041] + 0.8746, !- Year 18 Escalation [2042] + 0.8736, !- Year 19 Escalation [2043] + 0.8642, !- Year 20 Escalation [2044] + 0.8756, !- Year 21 Escalation [2045] + 0.8715, !- Year 22 Escalation [2046] + 0.8632, !- Year 23 Escalation [2047] + 0.8549, !- Year 24 Escalation [2048] + 0.8549, !- Year 25 Escalation [2049] + 0.8653, !- Year 26 Escalation [2050] + 0.8632, !- Year 27 Escalation [2051] + 0.8611, !- Year 28 Escalation [2052] + 0.8601, !- Year 29 Escalation [2053] + 0.8580; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + NorthEast Industrial-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9579, !- Year 1 Escalation [2025] + 0.9180, !- Year 2 Escalation [2026] + 0.8971, !- Year 3 Escalation [2027] + 0.8781, !- Year 4 Escalation [2028] + 0.8678, !- Year 5 Escalation [2029] + 0.8594, !- Year 6 Escalation [2030] + 0.8579, !- Year 7 Escalation [2031] + 0.8649, !- Year 8 Escalation [2032] + 0.8700, !- Year 9 Escalation [2033] + 0.8733, !- Year 10 Escalation [2034] + 0.8649, !- Year 11 Escalation [2035] + 0.8707, !- Year 12 Escalation [2036] + 0.8707, !- Year 13 Escalation [2037] + 0.8821, !- Year 14 Escalation [2038] + 0.8971, !- Year 15 Escalation [2039] + 0.8993, !- Year 16 Escalation [2040] + 0.9059, !- Year 17 Escalation [2041] + 0.9052, !- Year 18 Escalation [2042] + 0.9019, !- Year 19 Escalation [2043] + 0.8960, !- Year 20 Escalation [2044] + 0.8912, !- Year 21 Escalation [2045] + 0.8825, !- Year 22 Escalation [2046] + 0.8740, !- Year 23 Escalation [2047] + 0.8693, !- Year 24 Escalation [2048] + 0.8539, !- Year 25 Escalation [2049] + 0.8418, !- Year 26 Escalation [2050] + 0.8319, !- Year 27 Escalation [2051] + 0.8220, !- Year 28 Escalation [2052] + 0.8122, !- Year 29 Escalation [2053] + 0.8026; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + NorthEast Industrial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9102, !- Year 1 Escalation [2025] + 0.8576, !- Year 2 Escalation [2026] + 0.8057, !- Year 3 Escalation [2027] + 0.7585, !- Year 4 Escalation [2028] + 0.7617, !- Year 5 Escalation [2029] + 0.7620, !- Year 6 Escalation [2030] + 0.7678, !- Year 7 Escalation [2031] + 0.7706, !- Year 8 Escalation [2032] + 0.7745, !- Year 9 Escalation [2033] + 0.7764, !- Year 10 Escalation [2034] + 0.7818, !- Year 11 Escalation [2035] + 0.7827, !- Year 12 Escalation [2036] + 0.7869, !- Year 13 Escalation [2037] + 0.7897, !- Year 14 Escalation [2038] + 0.7913, !- Year 15 Escalation [2039] + 0.7929, !- Year 16 Escalation [2040] + 0.7983, !- Year 17 Escalation [2041] + 0.7983, !- Year 18 Escalation [2042] + 0.8022, !- Year 19 Escalation [2043] + 0.7993, !- Year 20 Escalation [2044] + 0.8012, !- Year 21 Escalation [2045] + 0.8082, !- Year 22 Escalation [2046] + 0.8092, !- Year 23 Escalation [2047] + 0.8104, !- Year 24 Escalation [2048] + 0.8127, !- Year 25 Escalation [2049] + 0.8130, !- Year 26 Escalation [2050] + 0.8143, !- Year 27 Escalation [2051] + 0.8155, !- Year 28 Escalation [2052] + 0.8168, !- Year 29 Escalation [2053] + 0.8181; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + NorthEast Industrial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0339, !- Year 1 Escalation [2025] + 1.1945, !- Year 2 Escalation [2026] + 1.3574, !- Year 3 Escalation [2027] + 1.5158, !- Year 4 Escalation [2028] + 1.5268, !- Year 5 Escalation [2029] + 1.5366, !- Year 6 Escalation [2030] + 1.5486, !- Year 7 Escalation [2031] + 1.5607, !- Year 8 Escalation [2032] + 1.5705, !- Year 9 Escalation [2033] + 1.5814, !- Year 10 Escalation [2034] + 1.5945, !- Year 11 Escalation [2035] + 1.6044, !- Year 12 Escalation [2036] + 1.6153, !- Year 13 Escalation [2037] + 1.6262, !- Year 14 Escalation [2038] + 1.6339, !- Year 15 Escalation [2039] + 1.6426, !- Year 16 Escalation [2040] + 1.6568, !- Year 17 Escalation [2041] + 1.6590, !- Year 18 Escalation [2042] + 1.6667, !- Year 19 Escalation [2043] + 1.6710, !- Year 20 Escalation [2044] + 1.6776, !- Year 21 Escalation [2045] + 1.6951, !- Year 22 Escalation [2046] + 1.6951, !- Year 23 Escalation [2047] + 1.7082, !- Year 24 Escalation [2048] + 1.7191, !- Year 25 Escalation [2049] + 1.7268, !- Year 26 Escalation [2050] + 1.7344, !- Year 27 Escalation [2051] + 1.7421, !- Year 28 Escalation [2052] + 1.7497, !- Year 29 Escalation [2053] + 1.7574; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + NorthEast Industrial-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9016, !- Year 1 Escalation [2025] + 0.8274, !- Year 2 Escalation [2026] + 0.7790, !- Year 3 Escalation [2027] + 0.7532, !- Year 4 Escalation [2028] + 0.7500, !- Year 5 Escalation [2029] + 0.7403, !- Year 6 Escalation [2030] + 0.7435, !- Year 7 Escalation [2031] + 0.7500, !- Year 8 Escalation [2032] + 0.7629, !- Year 9 Escalation [2033] + 0.7710, !- Year 10 Escalation [2034] + 0.7790, !- Year 11 Escalation [2035] + 0.7855, !- Year 12 Escalation [2036] + 0.7968, !- Year 13 Escalation [2037] + 0.8145, !- Year 14 Escalation [2038] + 0.8177, !- Year 15 Escalation [2039] + 0.8258, !- Year 16 Escalation [2040] + 0.8339, !- Year 17 Escalation [2041] + 0.8306, !- Year 18 Escalation [2042] + 0.8226, !- Year 19 Escalation [2043] + 0.8129, !- Year 20 Escalation [2044] + 0.8177, !- Year 21 Escalation [2045] + 0.8113, !- Year 22 Escalation [2046] + 0.8000, !- Year 23 Escalation [2047] + 0.7887, !- Year 24 Escalation [2048] + 0.7855, !- Year 25 Escalation [2049] + 0.7903, !- Year 26 Escalation [2050] + 0.7839, !- Year 27 Escalation [2051] + 0.7790, !- Year 28 Escalation [2052] + 0.7742, !- Year 29 Escalation [2053] + 0.7694; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + NorthEast Industrial-Coal, !- Name + Coal, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0218, !- Year 1 Escalation [2025] + 1.0087, !- Year 2 Escalation [2026] + 1.0306, !- Year 3 Escalation [2027] + 1.0262, !- Year 4 Escalation [2028] + 1.0262, !- Year 5 Escalation [2029] + 1.0284, !- Year 6 Escalation [2030] + 1.0328, !- Year 7 Escalation [2031] + 1.0349, !- Year 8 Escalation [2032] + 1.0393, !- Year 9 Escalation [2033] + 1.0459, !- Year 10 Escalation [2034] + 1.0524, !- Year 11 Escalation [2035] + 1.0611, !- Year 12 Escalation [2036] + 1.0699, !- Year 13 Escalation [2037] + 1.0764, !- Year 14 Escalation [2038] + 1.0830, !- Year 15 Escalation [2039] + 1.0873, !- Year 16 Escalation [2040] + 0.9891, !- Year 17 Escalation [2041] + 0.9869, !- Year 18 Escalation [2042] + 0.9869, !- Year 19 Escalation [2043] + 0.9869, !- Year 20 Escalation [2044] + 0.9869, !- Year 21 Escalation [2045] + 0.9869, !- Year 22 Escalation [2046] + 0.9869, !- Year 23 Escalation [2047] + 0.9869, !- Year 24 Escalation [2048] + 0.9869, !- Year 25 Escalation [2049] + 0.9869, !- Year 26 Escalation [2050] + 0.9869, !- Year 27 Escalation [2051] + 0.9869, !- Year 28 Escalation [2052] + 0.9869, !- Year 29 Escalation [2053] + 0.9869; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + MidWest Residential-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9759, !- Year 1 Escalation [2025] + 0.9606, !- Year 2 Escalation [2026] + 0.9427, !- Year 3 Escalation [2027] + 0.9347, !- Year 4 Escalation [2028] + 0.9311, !- Year 5 Escalation [2029] + 0.9286, !- Year 6 Escalation [2030] + 0.9283, !- Year 7 Escalation [2031] + 0.9296, !- Year 8 Escalation [2032] + 0.9317, !- Year 9 Escalation [2033] + 0.9350, !- Year 10 Escalation [2034] + 0.9311, !- Year 11 Escalation [2035] + 0.9296, !- Year 12 Escalation [2036] + 0.9327, !- Year 13 Escalation [2037] + 0.9373, !- Year 14 Escalation [2038] + 0.9465, !- Year 15 Escalation [2039] + 0.9583, !- Year 16 Escalation [2040] + 0.9649, !- Year 17 Escalation [2041] + 0.9654, !- Year 18 Escalation [2042] + 0.9631, !- Year 19 Escalation [2043] + 0.9624, !- Year 20 Escalation [2044] + 0.9631, !- Year 21 Escalation [2045] + 0.9590, !- Year 22 Escalation [2046] + 0.9521, !- Year 23 Escalation [2047] + 0.9493, !- Year 24 Escalation [2048] + 0.9432, !- Year 25 Escalation [2049] + 0.9345, !- Year 26 Escalation [2050] + 0.9283, !- Year 27 Escalation [2051] + 0.9224, !- Year 28 Escalation [2052] + 0.9163, !- Year 29 Escalation [2053] + 0.9104; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + MidWest Residential-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9217, !- Year 1 Escalation [2025] + 0.8943, !- Year 2 Escalation [2026] + 0.8683, !- Year 3 Escalation [2027] + 0.8465, !- Year 4 Escalation [2028] + 0.8509, !- Year 5 Escalation [2029] + 0.8500, !- Year 6 Escalation [2030] + 0.8578, !- Year 7 Escalation [2031] + 0.8609, !- Year 8 Escalation [2032] + 0.8639, !- Year 9 Escalation [2033] + 0.8683, !- Year 10 Escalation [2034] + 0.8717, !- Year 11 Escalation [2035] + 0.8757, !- Year 12 Escalation [2036] + 0.8800, !- Year 13 Escalation [2037] + 0.8835, !- Year 14 Escalation [2038] + 0.8861, !- Year 15 Escalation [2039] + 0.8887, !- Year 16 Escalation [2040] + 0.8961, !- Year 17 Escalation [2041] + 0.8970, !- Year 18 Escalation [2042] + 0.9026, !- Year 19 Escalation [2043] + 0.8991, !- Year 20 Escalation [2044] + 0.9039, !- Year 21 Escalation [2045] + 0.9139, !- Year 22 Escalation [2046] + 0.9148, !- Year 23 Escalation [2047] + 0.9170, !- Year 24 Escalation [2048] + 0.9200, !- Year 25 Escalation [2049] + 0.9209, !- Year 26 Escalation [2050] + 0.9222, !- Year 27 Escalation [2051] + 0.9239, !- Year 28 Escalation [2052] + 0.9257, !- Year 29 Escalation [2053] + 0.9274; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + MidWest Residential-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9378, !- Year 1 Escalation [2025] + 0.8880, !- Year 2 Escalation [2026] + 0.8593, !- Year 3 Escalation [2027] + 0.8469, !- Year 4 Escalation [2028] + 0.8526, !- Year 5 Escalation [2029] + 0.8603, !- Year 6 Escalation [2030] + 0.8727, !- Year 7 Escalation [2031] + 0.8813, !- Year 8 Escalation [2032] + 0.8957, !- Year 9 Escalation [2033] + 0.9091, !- Year 10 Escalation [2034] + 0.9196, !- Year 11 Escalation [2035] + 0.9244, !- Year 12 Escalation [2036] + 0.9330, !- Year 13 Escalation [2037] + 0.9445, !- Year 14 Escalation [2038] + 0.9445, !- Year 15 Escalation [2039] + 0.9531, !- Year 16 Escalation [2040] + 0.9608, !- Year 17 Escalation [2041] + 0.9617, !- Year 18 Escalation [2042] + 0.9589, !- Year 19 Escalation [2043] + 0.9550, !- Year 20 Escalation [2044] + 0.9550, !- Year 21 Escalation [2045] + 0.9531, !- Year 22 Escalation [2046] + 0.9512, !- Year 23 Escalation [2047] + 0.9474, !- Year 24 Escalation [2048] + 0.9455, !- Year 25 Escalation [2049] + 0.9455, !- Year 26 Escalation [2050] + 0.9435, !- Year 27 Escalation [2051] + 0.9416, !- Year 28 Escalation [2052] + 0.9397, !- Year 29 Escalation [2053] + 0.9368; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + MidWest Residential-LPG, !- Name + Propane, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9659, !- Year 1 Escalation [2025] + 0.9310, !- Year 2 Escalation [2026] + 0.9026, !- Year 3 Escalation [2027] + 0.8865, !- Year 4 Escalation [2028] + 0.8803, !- Year 5 Escalation [2029] + 0.8833, !- Year 6 Escalation [2030] + 0.8923, !- Year 7 Escalation [2031] + 0.9070, !- Year 8 Escalation [2032] + 0.9258, !- Year 9 Escalation [2033] + 0.9444, !- Year 10 Escalation [2034] + 0.9594, !- Year 11 Escalation [2035] + 0.9708, !- Year 12 Escalation [2036] + 0.9806, !- Year 13 Escalation [2037] + 0.9937, !- Year 14 Escalation [2038] + 1.0000, !- Year 15 Escalation [2039] + 1.0101, !- Year 16 Escalation [2040] + 1.0202, !- Year 17 Escalation [2041] + 1.0273, !- Year 18 Escalation [2042] + 1.0308, !- Year 19 Escalation [2043] + 1.0316, !- Year 20 Escalation [2044] + 1.0336, !- Year 21 Escalation [2045] + 1.0344, !- Year 22 Escalation [2046] + 1.0355, !- Year 23 Escalation [2047] + 1.0379, !- Year 24 Escalation [2048] + 1.0387, !- Year 25 Escalation [2049] + 1.0382, !- Year 26 Escalation [2050] + 1.0390, !- Year 27 Escalation [2051] + 1.0401, !- Year 28 Escalation [2052] + 1.0409, !- Year 29 Escalation [2053] + 1.0420; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + MidWest Commercial-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9705, !- Year 1 Escalation [2025] + 0.9510, !- Year 2 Escalation [2026] + 0.9283, !- Year 3 Escalation [2027] + 0.9183, !- Year 4 Escalation [2028] + 0.9129, !- Year 5 Escalation [2029] + 0.9070, !- Year 6 Escalation [2030] + 0.9038, !- Year 7 Escalation [2031] + 0.9013, !- Year 8 Escalation [2032] + 0.9007, !- Year 9 Escalation [2033] + 0.9035, !- Year 10 Escalation [2034] + 0.8969, !- Year 11 Escalation [2035] + 0.8944, !- Year 12 Escalation [2036] + 0.8966, !- Year 13 Escalation [2037] + 0.8988, !- Year 14 Escalation [2038] + 0.9101, !- Year 15 Escalation [2039] + 0.9211, !- Year 16 Escalation [2040] + 0.9255, !- Year 17 Escalation [2041] + 0.9236, !- Year 18 Escalation [2042] + 0.9180, !- Year 19 Escalation [2043] + 0.9148, !- Year 20 Escalation [2044] + 0.9133, !- Year 21 Escalation [2045] + 0.9079, !- Year 22 Escalation [2046] + 0.8979, !- Year 23 Escalation [2047] + 0.8953, !- Year 24 Escalation [2048] + 0.8887, !- Year 25 Escalation [2049] + 0.8793, !- Year 26 Escalation [2050] + 0.8724, !- Year 27 Escalation [2051] + 0.8655, !- Year 28 Escalation [2052] + 0.8586, !- Year 29 Escalation [2053] + 0.8517; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + MidWest Commercial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.8994, !- Year 1 Escalation [2025] + 0.8420, !- Year 2 Escalation [2026] + 0.7865, !- Year 3 Escalation [2027] + 0.7362, !- Year 4 Escalation [2028] + 0.7399, !- Year 5 Escalation [2029] + 0.7388, !- Year 6 Escalation [2030] + 0.7455, !- Year 7 Escalation [2031] + 0.7489, !- Year 8 Escalation [2032] + 0.7534, !- Year 9 Escalation [2033] + 0.7556, !- Year 10 Escalation [2034] + 0.7612, !- Year 11 Escalation [2035] + 0.7627, !- Year 12 Escalation [2036] + 0.7671, !- Year 13 Escalation [2037] + 0.7705, !- Year 14 Escalation [2038] + 0.7724, !- Year 15 Escalation [2039] + 0.7746, !- Year 16 Escalation [2040] + 0.7806, !- Year 17 Escalation [2041] + 0.7806, !- Year 18 Escalation [2042] + 0.7850, !- Year 19 Escalation [2043] + 0.7820, !- Year 20 Escalation [2044] + 0.7843, !- Year 21 Escalation [2045] + 0.7928, !- Year 22 Escalation [2046] + 0.7936, !- Year 23 Escalation [2047] + 0.7955, !- Year 24 Escalation [2048] + 0.7981, !- Year 25 Escalation [2049] + 0.7981, !- Year 26 Escalation [2050] + 0.7996, !- Year 27 Escalation [2051] + 0.8010, !- Year 28 Escalation [2052] + 0.8022, !- Year 29 Escalation [2053] + 0.8037; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + MidWest Commercial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0405, !- Year 1 Escalation [2025] + 1.1565, !- Year 2 Escalation [2026] + 1.3131, !- Year 3 Escalation [2027] + 1.4622, !- Year 4 Escalation [2028] + 1.4654, !- Year 5 Escalation [2029] + 1.4750, !- Year 6 Escalation [2030] + 1.4867, !- Year 7 Escalation [2031] + 1.4973, !- Year 8 Escalation [2032] + 1.5080, !- Year 9 Escalation [2033] + 1.5186, !- Year 10 Escalation [2034] + 1.5314, !- Year 11 Escalation [2035] + 1.5410, !- Year 12 Escalation [2036] + 1.5506, !- Year 13 Escalation [2037] + 1.5612, !- Year 14 Escalation [2038] + 1.5698, !- Year 15 Escalation [2039] + 1.5793, !- Year 16 Escalation [2040] + 1.5921, !- Year 17 Escalation [2041] + 1.5942, !- Year 18 Escalation [2042] + 1.6006, !- Year 19 Escalation [2043] + 1.5974, !- Year 20 Escalation [2044] + 1.6038, !- Year 21 Escalation [2045] + 1.6198, !- Year 22 Escalation [2046] + 1.6198, !- Year 23 Escalation [2047] + 1.6337, !- Year 24 Escalation [2048] + 1.6432, !- Year 25 Escalation [2049] + 1.6507, !- Year 26 Escalation [2050] + 1.6581, !- Year 27 Escalation [2051] + 1.6656, !- Year 28 Escalation [2052] + 1.6731, !- Year 29 Escalation [2053] + 1.6816; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + MidWest Commercial-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9334, !- Year 1 Escalation [2025] + 0.8811, !- Year 2 Escalation [2026] + 0.8526, !- Year 3 Escalation [2027] + 0.8407, !- Year 4 Escalation [2028] + 0.8466, !- Year 5 Escalation [2029] + 0.8549, !- Year 6 Escalation [2030] + 0.8680, !- Year 7 Escalation [2031] + 0.8763, !- Year 8 Escalation [2032] + 0.8930, !- Year 9 Escalation [2033] + 0.9073, !- Year 10 Escalation [2034] + 0.9203, !- Year 11 Escalation [2035] + 0.9251, !- Year 12 Escalation [2036] + 0.9334, !- Year 13 Escalation [2037] + 0.9465, !- Year 14 Escalation [2038] + 0.9465, !- Year 15 Escalation [2039] + 0.9560, !- Year 16 Escalation [2040] + 0.9667, !- Year 17 Escalation [2041] + 0.9667, !- Year 18 Escalation [2042] + 0.9631, !- Year 19 Escalation [2043] + 0.9596, !- Year 20 Escalation [2044] + 0.9596, !- Year 21 Escalation [2045] + 0.9584, !- Year 22 Escalation [2046] + 0.9560, !- Year 23 Escalation [2047] + 0.9524, !- Year 24 Escalation [2048] + 0.9512, !- Year 25 Escalation [2049] + 0.9512, !- Year 26 Escalation [2050] + 0.9501, !- Year 27 Escalation [2051] + 0.9477, !- Year 28 Escalation [2052] + 0.9465, !- Year 29 Escalation [2053] + 0.9441; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + MidWest Industrial-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9594, !- Year 1 Escalation [2025] + 0.9246, !- Year 2 Escalation [2026] + 0.8982, !- Year 3 Escalation [2027] + 0.8862, !- Year 4 Escalation [2028] + 0.8781, !- Year 5 Escalation [2029] + 0.8710, !- Year 6 Escalation [2030] + 0.8679, !- Year 7 Escalation [2031] + 0.8647, !- Year 8 Escalation [2032] + 0.8688, !- Year 9 Escalation [2033] + 0.8661, !- Year 10 Escalation [2034] + 0.8607, !- Year 11 Escalation [2035] + 0.8576, !- Year 12 Escalation [2036] + 0.8629, !- Year 13 Escalation [2037] + 0.8679, !- Year 14 Escalation [2038] + 0.8862, !- Year 15 Escalation [2039] + 0.9004, !- Year 16 Escalation [2040] + 0.9067, !- Year 17 Escalation [2041] + 0.9045, !- Year 18 Escalation [2042] + 0.9004, !- Year 19 Escalation [2043] + 0.8982, !- Year 20 Escalation [2044] + 0.8955, !- Year 21 Escalation [2045] + 0.8879, !- Year 22 Escalation [2046] + 0.8799, !- Year 23 Escalation [2047] + 0.8754, !- Year 24 Escalation [2048] + 0.8683, !- Year 25 Escalation [2049] + 0.8603, !- Year 26 Escalation [2050] + 0.8531, !- Year 27 Escalation [2051] + 0.8464, !- Year 28 Escalation [2052] + 0.8397, !- Year 29 Escalation [2053] + 0.8330; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + MidWest Industrial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.8974, !- Year 1 Escalation [2025] + 0.8374, !- Year 2 Escalation [2026] + 0.7788, !- Year 3 Escalation [2027] + 0.7260, !- Year 4 Escalation [2028] + 0.7297, !- Year 5 Escalation [2029] + 0.7286, !- Year 6 Escalation [2030] + 0.7352, !- Year 7 Escalation [2031] + 0.7385, !- Year 8 Escalation [2032] + 0.7432, !- Year 9 Escalation [2033] + 0.7451, !- Year 10 Escalation [2034] + 0.7509, !- Year 11 Escalation [2035] + 0.7520, !- Year 12 Escalation [2036] + 0.7568, !- Year 13 Escalation [2037] + 0.7601, !- Year 14 Escalation [2038] + 0.7619, !- Year 15 Escalation [2039] + 0.7637, !- Year 16 Escalation [2040] + 0.7696, !- Year 17 Escalation [2041] + 0.7700, !- Year 18 Escalation [2042] + 0.7744, !- Year 19 Escalation [2043] + 0.7711, !- Year 20 Escalation [2044] + 0.7733, !- Year 21 Escalation [2045] + 0.7813, !- Year 22 Escalation [2046] + 0.7821, !- Year 23 Escalation [2047] + 0.7839, !- Year 24 Escalation [2048] + 0.7864, !- Year 25 Escalation [2049] + 0.7868, !- Year 26 Escalation [2050] + 0.7879, !- Year 27 Escalation [2051] + 0.7894, !- Year 28 Escalation [2052] + 0.7905, !- Year 29 Escalation [2053] + 0.7919; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + MidWest Industrial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0382, !- Year 1 Escalation [2025] + 1.1506, !- Year 2 Escalation [2026] + 1.3075, !- Year 3 Escalation [2027] + 1.4560, !- Year 4 Escalation [2028] + 1.4592, !- Year 5 Escalation [2029] + 1.4687, !- Year 6 Escalation [2030] + 1.4804, !- Year 7 Escalation [2031] + 1.4910, !- Year 8 Escalation [2032] + 1.5016, !- Year 9 Escalation [2033] + 1.5122, !- Year 10 Escalation [2034] + 1.5249, !- Year 11 Escalation [2035] + 1.5345, !- Year 12 Escalation [2036] + 1.5440, !- Year 13 Escalation [2037] + 1.5546, !- Year 14 Escalation [2038] + 1.5631, !- Year 15 Escalation [2039] + 1.5726, !- Year 16 Escalation [2040] + 1.5854, !- Year 17 Escalation [2041] + 1.5875, !- Year 18 Escalation [2042] + 1.5938, !- Year 19 Escalation [2043] + 1.5907, !- Year 20 Escalation [2044] + 1.5970, !- Year 21 Escalation [2045] + 1.6129, !- Year 22 Escalation [2046] + 1.6129, !- Year 23 Escalation [2047] + 1.6267, !- Year 24 Escalation [2048] + 1.6363, !- Year 25 Escalation [2049] + 1.6437, !- Year 26 Escalation [2050] + 1.6511, !- Year 27 Escalation [2051] + 1.6585, !- Year 28 Escalation [2052] + 1.6660, !- Year 29 Escalation [2053] + 1.6744; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + MidWest Industrial-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.8935, !- Year 1 Escalation [2025] + 0.8131, !- Year 2 Escalation [2026] + 0.7682, !- Year 3 Escalation [2027] + 0.7533, !- Year 4 Escalation [2028] + 0.7533, !- Year 5 Escalation [2029] + 0.7626, !- Year 6 Escalation [2030] + 0.7776, !- Year 7 Escalation [2031] + 0.7907, !- Year 8 Escalation [2032] + 0.8131, !- Year 9 Escalation [2033] + 0.8299, !- Year 10 Escalation [2034] + 0.8467, !- Year 11 Escalation [2035] + 0.8486, !- Year 12 Escalation [2036] + 0.8579, !- Year 13 Escalation [2037] + 0.8785, !- Year 14 Escalation [2038] + 0.8710, !- Year 15 Escalation [2039] + 0.8897, !- Year 16 Escalation [2040] + 0.9009, !- Year 17 Escalation [2041] + 0.8991, !- Year 18 Escalation [2042] + 0.8879, !- Year 19 Escalation [2043] + 0.8785, !- Year 20 Escalation [2044] + 0.8748, !- Year 21 Escalation [2045] + 0.8692, !- Year 22 Escalation [2046] + 0.8617, !- Year 23 Escalation [2047] + 0.8542, !- Year 24 Escalation [2048] + 0.8449, !- Year 25 Escalation [2049] + 0.8430, !- Year 26 Escalation [2050] + 0.8355, !- Year 27 Escalation [2051] + 0.8299, !- Year 28 Escalation [2052] + 0.8224, !- Year 29 Escalation [2053] + 0.8168; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + MidWest Industrial-Coal, !- Name + Coal, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0268, !- Year 1 Escalation [2025] + 1.0230, !- Year 2 Escalation [2026] + 1.0115, !- Year 3 Escalation [2027] + 1.0038, !- Year 4 Escalation [2028] + 1.0000, !- Year 5 Escalation [2029] + 0.9962, !- Year 6 Escalation [2030] + 0.9962, !- Year 7 Escalation [2031] + 0.9923, !- Year 8 Escalation [2032] + 0.9923, !- Year 9 Escalation [2033] + 0.9962, !- Year 10 Escalation [2034] + 0.9962, !- Year 11 Escalation [2035] + 1.0000, !- Year 12 Escalation [2036] + 1.0077, !- Year 13 Escalation [2037] + 1.0192, !- Year 14 Escalation [2038] + 1.0268, !- Year 15 Escalation [2039] + 1.0307, !- Year 16 Escalation [2040] + 1.0345, !- Year 17 Escalation [2041] + 1.0345, !- Year 18 Escalation [2042] + 1.0383, !- Year 19 Escalation [2043] + 1.0421, !- Year 20 Escalation [2044] + 1.0460, !- Year 21 Escalation [2045] + 1.0498, !- Year 22 Escalation [2046] + 1.0575, !- Year 23 Escalation [2047] + 1.0498, !- Year 24 Escalation [2048] + 1.0460, !- Year 25 Escalation [2049] + 1.0460, !- Year 26 Escalation [2050] + 1.0460, !- Year 27 Escalation [2051] + 1.0421, !- Year 28 Escalation [2052] + 1.0421, !- Year 29 Escalation [2053] + 1.0421; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + South Residential-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9773, !- Year 1 Escalation [2025] + 0.9540, !- Year 2 Escalation [2026] + 0.9346, !- Year 3 Escalation [2027] + 0.9190, !- Year 4 Escalation [2028] + 0.9135, !- Year 5 Escalation [2029] + 0.9166, !- Year 6 Escalation [2030] + 0.9210, !- Year 7 Escalation [2031] + 0.9210, !- Year 8 Escalation [2032] + 0.9421, !- Year 9 Escalation [2033] + 0.9534, !- Year 10 Escalation [2034] + 0.9537, !- Year 11 Escalation [2035] + 0.9601, !- Year 12 Escalation [2036] + 0.9684, !- Year 13 Escalation [2037] + 0.9792, !- Year 14 Escalation [2038] + 0.9828, !- Year 15 Escalation [2039] + 0.9881, !- Year 16 Escalation [2040] + 0.9909, !- Year 17 Escalation [2041] + 0.9931, !- Year 18 Escalation [2042] + 0.9939, !- Year 19 Escalation [2043] + 0.9958, !- Year 20 Escalation [2044] + 0.9964, !- Year 21 Escalation [2045] + 0.9917, !- Year 22 Escalation [2046] + 0.9881, !- Year 23 Escalation [2047] + 0.9842, !- Year 24 Escalation [2048] + 0.9809, !- Year 25 Escalation [2049] + 0.9701, !- Year 26 Escalation [2050] + 0.9648, !- Year 27 Escalation [2051] + 0.9595, !- Year 28 Escalation [2052] + 0.9543, !- Year 29 Escalation [2053] + 0.9490; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + South Residential-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9498, !- Year 1 Escalation [2025] + 0.9350, !- Year 2 Escalation [2026] + 0.9216, !- Year 3 Escalation [2027] + 0.9106, !- Year 4 Escalation [2028] + 0.9128, !- Year 5 Escalation [2029] + 0.9131, !- Year 6 Escalation [2030] + 0.9190, !- Year 7 Escalation [2031] + 0.9212, !- Year 8 Escalation [2032] + 0.9238, !- Year 9 Escalation [2033] + 0.9266, !- Year 10 Escalation [2034] + 0.9294, !- Year 11 Escalation [2035] + 0.9319, !- Year 12 Escalation [2036] + 0.9354, !- Year 13 Escalation [2037] + 0.9379, !- Year 14 Escalation [2038] + 0.9398, !- Year 15 Escalation [2039] + 0.9416, !- Year 16 Escalation [2040] + 0.9470, !- Year 17 Escalation [2041] + 0.9476, !- Year 18 Escalation [2042] + 0.9517, !- Year 19 Escalation [2043] + 0.9492, !- Year 20 Escalation [2044] + 0.9526, !- Year 21 Escalation [2045] + 0.9595, !- Year 22 Escalation [2046] + 0.9602, !- Year 23 Escalation [2047] + 0.9614, !- Year 24 Escalation [2048] + 0.9639, !- Year 25 Escalation [2049] + 0.9642, !- Year 26 Escalation [2050] + 0.9655, !- Year 27 Escalation [2051] + 0.9664, !- Year 28 Escalation [2052] + 0.9677, !- Year 29 Escalation [2053] + 0.9689; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + South Residential-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9727, !- Year 1 Escalation [2025] + 0.9495, !- Year 2 Escalation [2026] + 0.9411, !- Year 3 Escalation [2027] + 0.9425, !- Year 4 Escalation [2028] + 0.9488, !- Year 5 Escalation [2029] + 0.9579, !- Year 6 Escalation [2030] + 0.9698, !- Year 7 Escalation [2031] + 0.9818, !- Year 8 Escalation [2032] + 0.9965, !- Year 9 Escalation [2033] + 1.0084, !- Year 10 Escalation [2034] + 1.0189, !- Year 11 Escalation [2035] + 1.0259, !- Year 12 Escalation [2036] + 1.0330, !- Year 13 Escalation [2037] + 1.0442, !- Year 14 Escalation [2038] + 1.0463, !- Year 15 Escalation [2039] + 1.0561, !- Year 16 Escalation [2040] + 1.0652, !- Year 17 Escalation [2041] + 1.0687, !- Year 18 Escalation [2042] + 1.0701, !- Year 19 Escalation [2043] + 1.0715, !- Year 20 Escalation [2044] + 1.0750, !- Year 21 Escalation [2045] + 1.0785, !- Year 22 Escalation [2046] + 1.0799, !- Year 23 Escalation [2047] + 1.0820, !- Year 24 Escalation [2048] + 1.0835, !- Year 25 Escalation [2049] + 1.0863, !- Year 26 Escalation [2050] + 1.0884, !- Year 27 Escalation [2051] + 1.0905, !- Year 28 Escalation [2052] + 1.0926, !- Year 29 Escalation [2053] + 1.0947; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + South Residential-LPG, !- Name + Propane, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9659, !- Year 1 Escalation [2025] + 0.9309, !- Year 2 Escalation [2026] + 0.9026, !- Year 3 Escalation [2027] + 0.8865, !- Year 4 Escalation [2028] + 0.8806, !- Year 5 Escalation [2029] + 0.8835, !- Year 6 Escalation [2030] + 0.8926, !- Year 7 Escalation [2031] + 0.9074, !- Year 8 Escalation [2032] + 0.9262, !- Year 9 Escalation [2033] + 0.9450, !- Year 10 Escalation [2034] + 0.9600, !- Year 11 Escalation [2035] + 0.9715, !- Year 12 Escalation [2036] + 0.9815, !- Year 13 Escalation [2037] + 0.9944, !- Year 14 Escalation [2038] + 1.0009, !- Year 15 Escalation [2039] + 1.0112, !- Year 16 Escalation [2040] + 1.0215, !- Year 17 Escalation [2041] + 1.0285, !- Year 18 Escalation [2042] + 1.0324, !- Year 19 Escalation [2043] + 1.0332, !- Year 20 Escalation [2044] + 1.0353, !- Year 21 Escalation [2045] + 1.0359, !- Year 22 Escalation [2046] + 1.0371, !- Year 23 Escalation [2047] + 1.0397, !- Year 24 Escalation [2048] + 1.0406, !- Year 25 Escalation [2049] + 1.0400, !- Year 26 Escalation [2050] + 1.0412, !- Year 27 Escalation [2051] + 1.0424, !- Year 28 Escalation [2052] + 1.0432, !- Year 29 Escalation [2053] + 1.0444; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + South Commercial-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9717, !- Year 1 Escalation [2025] + 0.9431, !- Year 2 Escalation [2026] + 0.9196, !- Year 3 Escalation [2027] + 0.8979, !- Year 4 Escalation [2028] + 0.8897, !- Year 5 Escalation [2029] + 0.8917, !- Year 6 Escalation [2030] + 0.8927, !- Year 7 Escalation [2031] + 0.8873, !- Year 8 Escalation [2032] + 0.9070, !- Year 9 Escalation [2033] + 0.9159, !- Year 10 Escalation [2034] + 0.9132, !- Year 11 Escalation [2035] + 0.9186, !- Year 12 Escalation [2036] + 0.9237, !- Year 13 Escalation [2037] + 0.9312, !- Year 14 Escalation [2038] + 0.9322, !- Year 15 Escalation [2039] + 0.9360, !- Year 16 Escalation [2040] + 0.9374, !- Year 17 Escalation [2041] + 0.9384, !- Year 18 Escalation [2042] + 0.9384, !- Year 19 Escalation [2043] + 0.9384, !- Year 20 Escalation [2044] + 0.9367, !- Year 21 Escalation [2045] + 0.9271, !- Year 22 Escalation [2046] + 0.9186, !- Year 23 Escalation [2047] + 0.9135, !- Year 24 Escalation [2048] + 0.9091, !- Year 25 Escalation [2049] + 0.8965, !- Year 26 Escalation [2050] + 0.8890, !- Year 27 Escalation [2051] + 0.8815, !- Year 28 Escalation [2052] + 0.8744, !- Year 29 Escalation [2053] + 0.8669; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + South Commercial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9107, !- Year 1 Escalation [2025] + 0.8600, !- Year 2 Escalation [2026] + 0.8099, !- Year 3 Escalation [2027] + 0.7645, !- Year 4 Escalation [2028] + 0.7675, !- Year 5 Escalation [2029] + 0.7678, !- Year 6 Escalation [2030] + 0.7737, !- Year 7 Escalation [2031] + 0.7770, !- Year 8 Escalation [2032] + 0.7806, !- Year 9 Escalation [2033] + 0.7826, !- Year 10 Escalation [2034] + 0.7879, !- Year 11 Escalation [2035] + 0.7892, !- Year 12 Escalation [2036] + 0.7931, !- Year 13 Escalation [2037] + 0.7961, !- Year 14 Escalation [2038] + 0.7978, !- Year 15 Escalation [2039] + 0.7997, !- Year 16 Escalation [2040] + 0.8050, !- Year 17 Escalation [2041] + 0.8050, !- Year 18 Escalation [2042] + 0.8090, !- Year 19 Escalation [2043] + 0.8063, !- Year 20 Escalation [2044] + 0.8083, !- Year 21 Escalation [2045] + 0.8152, !- Year 22 Escalation [2046] + 0.8162, !- Year 23 Escalation [2047] + 0.8175, !- Year 24 Escalation [2048] + 0.8198, !- Year 25 Escalation [2049] + 0.8202, !- Year 26 Escalation [2050] + 0.8215, !- Year 27 Escalation [2051] + 0.8228, !- Year 28 Escalation [2052] + 0.8241, !- Year 29 Escalation [2053] + 0.8254; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + South Commercial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0743, !- Year 1 Escalation [2025] + 1.2433, !- Year 2 Escalation [2026] + 1.4141, !- Year 3 Escalation [2027] + 1.5794, !- Year 4 Escalation [2028] + 1.5887, !- Year 5 Escalation [2029] + 1.5970, !- Year 6 Escalation [2030] + 1.6072, !- Year 7 Escalation [2031] + 1.6165, !- Year 8 Escalation [2032] + 1.6258, !- Year 9 Escalation [2033] + 1.6351, !- Year 10 Escalation [2034] + 1.6453, !- Year 11 Escalation [2035] + 1.6537, !- Year 12 Escalation [2036] + 1.6620, !- Year 13 Escalation [2037] + 1.6713, !- Year 14 Escalation [2038] + 1.6778, !- Year 15 Escalation [2039] + 1.6852, !- Year 16 Escalation [2040] + 1.6973, !- Year 17 Escalation [2041] + 1.6973, !- Year 18 Escalation [2042] + 1.7047, !- Year 19 Escalation [2043] + 1.7001, !- Year 20 Escalation [2044] + 1.7047, !- Year 21 Escalation [2045] + 1.7224, !- Year 22 Escalation [2046] + 1.7214, !- Year 23 Escalation [2047] + 1.7307, !- Year 24 Escalation [2048] + 1.7382, !- Year 25 Escalation [2049] + 1.7447, !- Year 26 Escalation [2050] + 1.7502, !- Year 27 Escalation [2051] + 1.7558, !- Year 28 Escalation [2052] + 1.7614, !- Year 29 Escalation [2053] + 1.7669; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + South Commercial-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9659, !- Year 1 Escalation [2025] + 0.9349, !- Year 2 Escalation [2026] + 0.9255, !- Year 3 Escalation [2027] + 0.9286, !- Year 4 Escalation [2028] + 0.9317, !- Year 5 Escalation [2029] + 0.9400, !- Year 6 Escalation [2030] + 0.9514, !- Year 7 Escalation [2031] + 0.9638, !- Year 8 Escalation [2032] + 0.9804, !- Year 9 Escalation [2033] + 0.9938, !- Year 10 Escalation [2034] + 1.0052, !- Year 11 Escalation [2035] + 1.0093, !- Year 12 Escalation [2036] + 1.0155, !- Year 13 Escalation [2037] + 1.0269, !- Year 14 Escalation [2038] + 1.0248, !- Year 15 Escalation [2039] + 1.0352, !- Year 16 Escalation [2040] + 1.0434, !- Year 17 Escalation [2041] + 1.0445, !- Year 18 Escalation [2042] + 1.0414, !- Year 19 Escalation [2043] + 1.0383, !- Year 20 Escalation [2044] + 1.0393, !- Year 21 Escalation [2045] + 1.0393, !- Year 22 Escalation [2046] + 1.0372, !- Year 23 Escalation [2047] + 1.0362, !- Year 24 Escalation [2048] + 1.0341, !- Year 25 Escalation [2049] + 1.0352, !- Year 26 Escalation [2050] + 1.0331, !- Year 27 Escalation [2051] + 1.0321, !- Year 28 Escalation [2052] + 1.0310, !- Year 29 Escalation [2053] + 1.0300; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + South Industrial-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9538, !- Year 1 Escalation [2025] + 0.9117, !- Year 2 Escalation [2026] + 0.8810, !- Year 3 Escalation [2027] + 0.8597, !- Year 4 Escalation [2028] + 0.8499, !- Year 5 Escalation [2029] + 0.8530, !- Year 6 Escalation [2030] + 0.8561, !- Year 7 Escalation [2031] + 0.8566, !- Year 8 Escalation [2032] + 0.8868, !- Year 9 Escalation [2033] + 0.8951, !- Year 10 Escalation [2034] + 0.8940, !- Year 11 Escalation [2035] + 0.9065, !- Year 12 Escalation [2036] + 0.9153, !- Year 13 Escalation [2037] + 0.9299, !- Year 14 Escalation [2038] + 0.9361, !- Year 15 Escalation [2039] + 0.9403, !- Year 16 Escalation [2040] + 0.9470, !- Year 17 Escalation [2041] + 0.9486, !- Year 18 Escalation [2042] + 0.9470, !- Year 19 Escalation [2043] + 0.9486, !- Year 20 Escalation [2044] + 0.9439, !- Year 21 Escalation [2045] + 0.9345, !- Year 22 Escalation [2046] + 0.9294, !- Year 23 Escalation [2047] + 0.9252, !- Year 24 Escalation [2048] + 0.9216, !- Year 25 Escalation [2049] + 0.9101, !- Year 26 Escalation [2050] + 0.9044, !- Year 27 Escalation [2051] + 0.8982, !- Year 28 Escalation [2052] + 0.8925, !- Year 29 Escalation [2053] + 0.8868; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + South Industrial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9118, !- Year 1 Escalation [2025] + 0.8611, !- Year 2 Escalation [2026] + 0.8106, !- Year 3 Escalation [2027] + 0.7650, !- Year 4 Escalation [2028] + 0.7678, !- Year 5 Escalation [2029] + 0.7687, !- Year 6 Escalation [2030] + 0.7738, !- Year 7 Escalation [2031] + 0.7776, !- Year 8 Escalation [2032] + 0.7810, !- Year 9 Escalation [2033] + 0.7829, !- Year 10 Escalation [2034] + 0.7886, !- Year 11 Escalation [2035] + 0.7892, !- Year 12 Escalation [2036] + 0.7933, !- Year 13 Escalation [2037] + 0.7962, !- Year 14 Escalation [2038] + 0.7977, !- Year 15 Escalation [2039] + 0.7996, !- Year 16 Escalation [2040] + 0.8047, !- Year 17 Escalation [2041] + 0.8047, !- Year 18 Escalation [2042] + 0.8084, !- Year 19 Escalation [2043] + 0.8056, !- Year 20 Escalation [2044] + 0.8072, !- Year 21 Escalation [2045] + 0.8138, !- Year 22 Escalation [2046] + 0.8147, !- Year 23 Escalation [2047] + 0.8160, !- Year 24 Escalation [2048] + 0.8185, !- Year 25 Escalation [2049] + 0.8188, !- Year 26 Escalation [2050] + 0.8201, !- Year 27 Escalation [2051] + 0.8214, !- Year 28 Escalation [2052] + 0.8226, !- Year 29 Escalation [2053] + 0.8239; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + South Industrial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0662, !- Year 1 Escalation [2025] + 1.2325, !- Year 2 Escalation [2026] + 1.3979, !- Year 3 Escalation [2027] + 1.5614, !- Year 4 Escalation [2028] + 1.5709, !- Year 5 Escalation [2029] + 1.5794, !- Year 6 Escalation [2030] + 1.5898, !- Year 7 Escalation [2031] + 1.6002, !- Year 8 Escalation [2032] + 1.6087, !- Year 9 Escalation [2033] + 1.6181, !- Year 10 Escalation [2034] + 1.6295, !- Year 11 Escalation [2035] + 1.6380, !- Year 12 Escalation [2036] + 1.6465, !- Year 13 Escalation [2037] + 1.6569, !- Year 14 Escalation [2038] + 1.6635, !- Year 15 Escalation [2039] + 1.6720, !- Year 16 Escalation [2040] + 1.6834, !- Year 17 Escalation [2041] + 1.6853, !- Year 18 Escalation [2042] + 1.6919, !- Year 19 Escalation [2043] + 1.6909, !- Year 20 Escalation [2044] + 1.6957, !- Year 21 Escalation [2045] + 1.7127, !- Year 22 Escalation [2046] + 1.7127, !- Year 23 Escalation [2047] + 1.7231, !- Year 24 Escalation [2048] + 1.7306, !- Year 25 Escalation [2049] + 1.7372, !- Year 26 Escalation [2050] + 1.7439, !- Year 27 Escalation [2051] + 1.7495, !- Year 28 Escalation [2052] + 1.7561, !- Year 29 Escalation [2053] + 1.7628; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + South Industrial-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.8785, !- Year 1 Escalation [2025] + 0.7868, !- Year 2 Escalation [2026] + 0.7399, !- Year 3 Escalation [2027] + 0.7249, !- Year 4 Escalation [2028] + 0.7313, !- Year 5 Escalation [2029] + 0.7484, !- Year 6 Escalation [2030] + 0.7761, !- Year 7 Escalation [2031] + 0.8060, !- Year 8 Escalation [2032] + 0.8443, !- Year 9 Escalation [2033] + 0.8742, !- Year 10 Escalation [2034] + 0.8977, !- Year 11 Escalation [2035] + 0.9019, !- Year 12 Escalation [2036] + 0.9104, !- Year 13 Escalation [2037] + 0.9360, !- Year 14 Escalation [2038] + 0.9211, !- Year 15 Escalation [2039] + 0.9488, !- Year 16 Escalation [2040] + 0.9659, !- Year 17 Escalation [2041] + 0.9638, !- Year 18 Escalation [2042] + 0.9510, !- Year 19 Escalation [2043] + 0.9424, !- Year 20 Escalation [2044] + 0.9403, !- Year 21 Escalation [2045] + 0.9382, !- Year 22 Escalation [2046] + 0.9318, !- Year 23 Escalation [2047] + 0.9254, !- Year 24 Escalation [2048] + 0.9126, !- Year 25 Escalation [2049] + 0.9104, !- Year 26 Escalation [2050] + 0.9041, !- Year 27 Escalation [2051] + 0.8977, !- Year 28 Escalation [2052] + 0.8891, !- Year 29 Escalation [2053] + 0.8827; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + South Industrial-Coal, !- Name + Coal, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0153, !- Year 1 Escalation [2025] + 1.0122, !- Year 2 Escalation [2026] + 1.0122, !- Year 3 Escalation [2027] + 1.0122, !- Year 4 Escalation [2028] + 1.0153, !- Year 5 Escalation [2029] + 1.0183, !- Year 6 Escalation [2030] + 1.0245, !- Year 7 Escalation [2031] + 1.0275, !- Year 8 Escalation [2032] + 1.0336, !- Year 9 Escalation [2033] + 1.0367, !- Year 10 Escalation [2034] + 1.0428, !- Year 11 Escalation [2035] + 1.0459, !- Year 12 Escalation [2036] + 1.0520, !- Year 13 Escalation [2037] + 1.0550, !- Year 14 Escalation [2038] + 1.0581, !- Year 15 Escalation [2039] + 1.0612, !- Year 16 Escalation [2040] + 1.0642, !- Year 17 Escalation [2041] + 1.0673, !- Year 18 Escalation [2042] + 1.0703, !- Year 19 Escalation [2043] + 1.0703, !- Year 20 Escalation [2044] + 1.0734, !- Year 21 Escalation [2045] + 1.0765, !- Year 22 Escalation [2046] + 1.0795, !- Year 23 Escalation [2047] + 1.0765, !- Year 24 Escalation [2048] + 1.0795, !- Year 25 Escalation [2049] + 1.0826, !- Year 26 Escalation [2050] + 1.0826, !- Year 27 Escalation [2051] + 1.0826, !- Year 28 Escalation [2052] + 1.0826, !- Year 29 Escalation [2053] + 1.0856; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + West Residential-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9320, !- Year 1 Escalation [2025] + 0.9213, !- Year 2 Escalation [2026] + 0.9178, !- Year 3 Escalation [2027] + 0.9160, !- Year 4 Escalation [2028] + 0.9173, !- Year 5 Escalation [2029] + 0.9244, !- Year 6 Escalation [2030] + 0.9348, !- Year 7 Escalation [2031] + 0.9470, !- Year 8 Escalation [2032] + 0.9594, !- Year 9 Escalation [2033] + 0.9703, !- Year 10 Escalation [2034] + 0.9801, !- Year 11 Escalation [2035] + 0.9878, !- Year 12 Escalation [2036] + 0.9989, !- Year 13 Escalation [2037] + 1.0115, !- Year 14 Escalation [2038] + 1.0217, !- Year 15 Escalation [2039] + 1.0301, !- Year 16 Escalation [2040] + 1.0408, !- Year 17 Escalation [2041] + 1.0488, !- Year 18 Escalation [2042] + 1.0570, !- Year 19 Escalation [2043] + 1.0672, !- Year 20 Escalation [2044] + 1.0771, !- Year 21 Escalation [2045] + 1.0858, !- Year 22 Escalation [2046] + 1.0898, !- Year 23 Escalation [2047] + 1.0953, !- Year 24 Escalation [2048] + 1.0977, !- Year 25 Escalation [2049] + 1.1000, !- Year 26 Escalation [2050] + 1.1033, !- Year 27 Escalation [2051] + 1.1068, !- Year 28 Escalation [2052] + 1.1104, !- Year 29 Escalation [2053] + 1.1139; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + West Residential-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9463, !- Year 1 Escalation [2025] + 0.9308, !- Year 2 Escalation [2026] + 0.9157, !- Year 3 Escalation [2027] + 0.9027, !- Year 4 Escalation [2028] + 0.9053, !- Year 5 Escalation [2029] + 0.9059, !- Year 6 Escalation [2030] + 0.9103, !- Year 7 Escalation [2031] + 0.9141, !- Year 8 Escalation [2032] + 0.9157, !- Year 9 Escalation [2033] + 0.9189, !- Year 10 Escalation [2034] + 0.9220, !- Year 11 Escalation [2035] + 0.9245, !- Year 12 Escalation [2036] + 0.9271, !- Year 13 Escalation [2037] + 0.9302, !- Year 14 Escalation [2038] + 0.9321, !- Year 15 Escalation [2039] + 0.9346, !- Year 16 Escalation [2040] + 0.9397, !- Year 17 Escalation [2041] + 0.9403, !- Year 18 Escalation [2042] + 0.9441, !- Year 19 Escalation [2043] + 0.9419, !- Year 20 Escalation [2044] + 0.9451, !- Year 21 Escalation [2045] + 0.9564, !- Year 22 Escalation [2046] + 0.9571, !- Year 23 Escalation [2047] + 0.9583, !- Year 24 Escalation [2048] + 0.9605, !- Year 25 Escalation [2049] + 0.9605, !- Year 26 Escalation [2050] + 0.9615, !- Year 27 Escalation [2051] + 0.9627, !- Year 28 Escalation [2052] + 0.9637, !- Year 29 Escalation [2053] + 0.9646; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + West Residential-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9153, !- Year 1 Escalation [2025] + 0.8391, !- Year 2 Escalation [2026] + 0.7768, !- Year 3 Escalation [2027] + 0.7249, !- Year 4 Escalation [2028] + 0.7236, !- Year 5 Escalation [2029] + 0.7255, !- Year 6 Escalation [2030] + 0.7321, !- Year 7 Escalation [2031] + 0.7380, !- Year 8 Escalation [2032] + 0.7479, !- Year 9 Escalation [2033] + 0.7577, !- Year 10 Escalation [2034] + 0.7669, !- Year 11 Escalation [2035] + 0.7695, !- Year 12 Escalation [2036] + 0.7741, !- Year 13 Escalation [2037] + 0.7833, !- Year 14 Escalation [2038] + 0.7814, !- Year 15 Escalation [2039] + 0.7873, !- Year 16 Escalation [2040] + 0.7932, !- Year 17 Escalation [2041] + 0.7951, !- Year 18 Escalation [2042] + 0.7938, !- Year 19 Escalation [2043] + 0.7905, !- Year 20 Escalation [2044] + 0.7965, !- Year 21 Escalation [2045] + 0.8877, !- Year 22 Escalation [2046] + 0.8897, !- Year 23 Escalation [2047] + 0.8877, !- Year 24 Escalation [2048] + 0.8884, !- Year 25 Escalation [2049] + 0.8890, !- Year 26 Escalation [2050] + 0.8890, !- Year 27 Escalation [2051] + 0.8897, !- Year 28 Escalation [2052] + 0.8897, !- Year 29 Escalation [2053] + 0.8903; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + West Residential-LPG, !- Name + Propane, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9663, !- Year 1 Escalation [2025] + 0.9313, !- Year 2 Escalation [2026] + 0.9033, !- Year 3 Escalation [2027] + 0.8872, !- Year 4 Escalation [2028] + 0.8811, !- Year 5 Escalation [2029] + 0.8839, !- Year 6 Escalation [2030] + 0.8927, !- Year 7 Escalation [2031] + 0.9070, !- Year 8 Escalation [2032] + 0.9255, !- Year 9 Escalation [2033] + 0.9438, !- Year 10 Escalation [2034] + 0.9587, !- Year 11 Escalation [2035] + 0.9696, !- Year 12 Escalation [2036] + 0.9793, !- Year 13 Escalation [2037] + 0.9921, !- Year 14 Escalation [2038] + 0.9982, !- Year 15 Escalation [2039] + 1.0082, !- Year 16 Escalation [2040] + 1.0179, !- Year 17 Escalation [2041] + 1.0249, !- Year 18 Escalation [2042] + 1.0286, !- Year 19 Escalation [2043] + 1.0292, !- Year 20 Escalation [2044] + 1.0328, !- Year 21 Escalation [2045] + 1.0678, !- Year 22 Escalation [2046] + 1.0687, !- Year 23 Escalation [2047] + 1.0708, !- Year 24 Escalation [2048] + 1.0718, !- Year 25 Escalation [2049] + 1.0711, !- Year 26 Escalation [2050] + 1.0721, !- Year 27 Escalation [2051] + 1.0727, !- Year 28 Escalation [2052] + 1.0736, !- Year 29 Escalation [2053] + 1.0745; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + West Commercial-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9013, !- Year 1 Escalation [2025] + 0.8813, !- Year 2 Escalation [2026] + 0.8687, !- Year 3 Escalation [2027] + 0.8563, !- Year 4 Escalation [2028] + 0.8482, !- Year 5 Escalation [2029] + 0.8487, !- Year 6 Escalation [2030] + 0.8482, !- Year 7 Escalation [2031] + 0.8507, !- Year 8 Escalation [2032] + 0.8550, !- Year 9 Escalation [2033] + 0.8555, !- Year 10 Escalation [2034] + 0.8580, !- Year 11 Escalation [2035] + 0.8593, !- Year 12 Escalation [2036] + 0.8629, !- Year 13 Escalation [2037] + 0.8692, !- Year 14 Escalation [2038] + 0.8694, !- Year 15 Escalation [2039] + 0.8692, !- Year 16 Escalation [2040] + 0.8715, !- Year 17 Escalation [2041] + 0.8727, !- Year 18 Escalation [2042] + 0.8755, !- Year 19 Escalation [2043] + 0.8790, !- Year 20 Escalation [2044] + 0.8811, !- Year 21 Escalation [2045] + 0.8823, !- Year 22 Escalation [2046] + 0.8785, !- Year 23 Escalation [2047] + 0.8773, !- Year 24 Escalation [2048] + 0.8737, !- Year 25 Escalation [2049] + 0.8694, !- Year 26 Escalation [2050] + 0.8664, !- Year 27 Escalation [2051] + 0.8631, !- Year 28 Escalation [2052] + 0.8601, !- Year 29 Escalation [2053] + 0.8568; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + West Commercial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9115, !- Year 1 Escalation [2025] + 0.8578, !- Year 2 Escalation [2026] + 0.8066, !- Year 3 Escalation [2027] + 0.7587, !- Year 4 Escalation [2028] + 0.7614, !- Year 5 Escalation [2029] + 0.7624, !- Year 6 Escalation [2030] + 0.7669, !- Year 7 Escalation [2031] + 0.7712, !- Year 8 Escalation [2032] + 0.7743, !- Year 9 Escalation [2033] + 0.7764, !- Year 10 Escalation [2034] + 0.7816, !- Year 11 Escalation [2035] + 0.7825, !- Year 12 Escalation [2036] + 0.7862, !- Year 13 Escalation [2037] + 0.7892, !- Year 14 Escalation [2038] + 0.7907, !- Year 15 Escalation [2039] + 0.7926, !- Year 16 Escalation [2040] + 0.7977, !- Year 17 Escalation [2041] + 0.7977, !- Year 18 Escalation [2042] + 0.8020, !- Year 19 Escalation [2043] + 0.8002, !- Year 20 Escalation [2044] + 0.8045, !- Year 21 Escalation [2045] + 0.8517, !- Year 22 Escalation [2046] + 0.8523, !- Year 23 Escalation [2047] + 0.8536, !- Year 24 Escalation [2048] + 0.8560, !- Year 25 Escalation [2049] + 0.8563, !- Year 26 Escalation [2050] + 0.8575, !- Year 27 Escalation [2051] + 0.8588, !- Year 28 Escalation [2052] + 0.8600, !- Year 29 Escalation [2053] + 0.8609; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + West Commercial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0510, !- Year 1 Escalation [2025] + 1.2169, !- Year 2 Escalation [2026] + 1.3850, !- Year 3 Escalation [2027] + 1.5499, !- Year 4 Escalation [2028] + 1.5586, !- Year 5 Escalation [2029] + 1.5694, !- Year 6 Escalation [2030] + 1.5759, !- Year 7 Escalation [2031] + 1.5857, !- Year 8 Escalation [2032] + 1.5944, !- Year 9 Escalation [2033] + 1.6030, !- Year 10 Escalation [2034] + 1.6161, !- Year 11 Escalation [2035] + 1.6280, !- Year 12 Escalation [2036] + 1.6367, !- Year 13 Escalation [2037] + 1.6486, !- Year 14 Escalation [2038] + 1.6584, !- Year 15 Escalation [2039] + 1.6638, !- Year 16 Escalation [2040] + 1.6757, !- Year 17 Escalation [2041] + 1.6822, !- Year 18 Escalation [2042] + 1.6898, !- Year 19 Escalation [2043] + 1.6985, !- Year 20 Escalation [2044] + 1.7072, !- Year 21 Escalation [2045] + 1.7321, !- Year 22 Escalation [2046] + 1.7343, !- Year 23 Escalation [2047] + 1.7430, !- Year 24 Escalation [2048] + 1.7527, !- Year 25 Escalation [2049] + 1.7560, !- Year 26 Escalation [2050] + 1.7625, !- Year 27 Escalation [2051] + 1.7690, !- Year 28 Escalation [2052] + 1.7755, !- Year 29 Escalation [2053] + 1.7820; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + West Commercial-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9569, !- Year 1 Escalation [2025] + 0.9218, !- Year 2 Escalation [2026] + 0.9038, !- Year 3 Escalation [2027] + 0.8988, !- Year 4 Escalation [2028] + 0.9018, !- Year 5 Escalation [2029] + 0.9078, !- Year 6 Escalation [2030] + 0.9188, !- Year 7 Escalation [2031] + 0.9279, !- Year 8 Escalation [2032] + 0.9449, !- Year 9 Escalation [2033] + 0.9609, !- Year 10 Escalation [2034] + 0.9749, !- Year 11 Escalation [2035] + 0.9790, !- Year 12 Escalation [2036] + 0.9870, !- Year 13 Escalation [2037] + 1.0010, !- Year 14 Escalation [2038] + 0.9980, !- Year 15 Escalation [2039] + 1.0080, !- Year 16 Escalation [2040] + 1.0170, !- Year 17 Escalation [2041] + 1.0210, !- Year 18 Escalation [2042] + 1.0200, !- Year 19 Escalation [2043] + 1.0160, !- Year 20 Escalation [2044] + 1.0261, !- Year 21 Escalation [2045] + 1.1423, !- Year 22 Escalation [2046] + 1.1383, !- Year 23 Escalation [2047] + 1.1333, !- Year 24 Escalation [2048] + 1.1363, !- Year 25 Escalation [2049] + 1.1393, !- Year 26 Escalation [2050] + 1.1383, !- Year 27 Escalation [2051] + 1.1373, !- Year 28 Escalation [2052] + 1.1373, !- Year 29 Escalation [2053] + 1.1363; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + West Industrial-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9042, !- Year 1 Escalation [2025] + 0.8806, !- Year 2 Escalation [2026] + 0.8631, !- Year 3 Escalation [2027] + 0.8515, !- Year 4 Escalation [2028] + 0.8455, !- Year 5 Escalation [2029] + 0.8451, !- Year 6 Escalation [2030] + 0.8423, !- Year 7 Escalation [2031] + 0.8467, !- Year 8 Escalation [2032] + 0.8515, !- Year 9 Escalation [2033] + 0.8567, !- Year 10 Escalation [2034] + 0.8615, !- Year 11 Escalation [2035] + 0.8643, !- Year 12 Escalation [2036] + 0.8750, !- Year 13 Escalation [2037] + 0.8910, !- Year 14 Escalation [2038] + 0.8986, !- Year 15 Escalation [2039] + 0.9070, !- Year 16 Escalation [2040] + 0.9114, !- Year 17 Escalation [2041] + 0.9142, !- Year 18 Escalation [2042] + 0.9162, !- Year 19 Escalation [2043] + 0.9186, !- Year 20 Escalation [2044] + 0.9230, !- Year 21 Escalation [2045] + 0.9246, !- Year 22 Escalation [2046] + 0.9218, !- Year 23 Escalation [2047] + 0.9218, !- Year 24 Escalation [2048] + 0.9194, !- Year 25 Escalation [2049] + 0.9166, !- Year 26 Escalation [2050] + 0.9146, !- Year 27 Escalation [2051] + 0.9126, !- Year 28 Escalation [2052] + 0.9106, !- Year 29 Escalation [2053] + 0.9086; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + West Industrial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9119, !- Year 1 Escalation [2025] + 0.8568, !- Year 2 Escalation [2026] + 0.8054, !- Year 3 Escalation [2027] + 0.7570, !- Year 4 Escalation [2028] + 0.7597, !- Year 5 Escalation [2029] + 0.7606, !- Year 6 Escalation [2030] + 0.7654, !- Year 7 Escalation [2031] + 0.7693, !- Year 8 Escalation [2032] + 0.7726, !- Year 9 Escalation [2033] + 0.7744, !- Year 10 Escalation [2034] + 0.7798, !- Year 11 Escalation [2035] + 0.7808, !- Year 12 Escalation [2036] + 0.7844, !- Year 13 Escalation [2037] + 0.7874, !- Year 14 Escalation [2038] + 0.7889, !- Year 15 Escalation [2039] + 0.7907, !- Year 16 Escalation [2040] + 0.7955, !- Year 17 Escalation [2041] + 0.7955, !- Year 18 Escalation [2042] + 0.7997, !- Year 19 Escalation [2043] + 0.7982, !- Year 20 Escalation [2044] + 0.8000, !- Year 21 Escalation [2045] + 0.8075, !- Year 22 Escalation [2046] + 0.8081, !- Year 23 Escalation [2047] + 0.8093, !- Year 24 Escalation [2048] + 0.8117, !- Year 25 Escalation [2049] + 0.8120, !- Year 26 Escalation [2050] + 0.8132, !- Year 27 Escalation [2051] + 0.8144, !- Year 28 Escalation [2052] + 0.8156, !- Year 29 Escalation [2053] + 0.8168; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + West Industrial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0525, !- Year 1 Escalation [2025] + 1.2101, !- Year 2 Escalation [2026] + 1.3773, !- Year 3 Escalation [2027] + 1.5338, !- Year 4 Escalation [2028] + 1.5423, !- Year 5 Escalation [2029] + 1.5541, !- Year 6 Escalation [2030] + 1.5573, !- Year 7 Escalation [2031] + 1.5670, !- Year 8 Escalation [2032] + 1.5766, !- Year 9 Escalation [2033] + 1.5863, !- Year 10 Escalation [2034] + 1.6002, !- Year 11 Escalation [2035] + 1.6045, !- Year 12 Escalation [2036] + 1.6163, !- Year 13 Escalation [2037] + 1.6270, !- Year 14 Escalation [2038] + 1.6377, !- Year 15 Escalation [2039] + 1.6420, !- Year 16 Escalation [2040] + 1.6538, !- Year 17 Escalation [2041] + 1.6602, !- Year 18 Escalation [2042] + 1.6720, !- Year 19 Escalation [2043] + 1.6763, !- Year 20 Escalation [2044] + 1.6817, !- Year 21 Escalation [2045] + 1.7042, !- Year 22 Escalation [2046] + 1.7042, !- Year 23 Escalation [2047] + 1.7170, !- Year 24 Escalation [2048] + 1.7299, !- Year 25 Escalation [2049] + 1.7438, !- Year 26 Escalation [2050] + 1.7535, !- Year 27 Escalation [2051] + 1.7631, !- Year 28 Escalation [2052] + 1.7738, !- Year 29 Escalation [2053] + 1.7835; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + West Industrial-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9165, !- Year 1 Escalation [2025] + 0.8497, !- Year 2 Escalation [2026] + 0.8063, !- Year 3 Escalation [2027] + 0.7896, !- Year 4 Escalation [2028] + 0.7863, !- Year 5 Escalation [2029] + 0.7896, !- Year 6 Escalation [2030] + 0.8063, !- Year 7 Escalation [2031] + 0.8197, !- Year 8 Escalation [2032] + 0.8497, !- Year 9 Escalation [2033] + 0.8748, !- Year 10 Escalation [2034] + 0.8982, !- Year 11 Escalation [2035] + 0.9048, !- Year 12 Escalation [2036] + 0.9132, !- Year 13 Escalation [2037] + 0.9382, !- Year 14 Escalation [2038] + 0.9265, !- Year 15 Escalation [2039] + 0.9482, !- Year 16 Escalation [2040] + 0.9616, !- Year 17 Escalation [2041] + 0.9649, !- Year 18 Escalation [2042] + 0.9599, !- Year 19 Escalation [2043] + 0.9499, !- Year 20 Escalation [2044] + 0.9499, !- Year 21 Escalation [2045] + 0.9349, !- Year 22 Escalation [2046] + 0.9332, !- Year 23 Escalation [2047] + 0.9265, !- Year 24 Escalation [2048] + 0.9265, !- Year 25 Escalation [2049] + 0.9299, !- Year 26 Escalation [2050] + 0.9282, !- Year 27 Escalation [2051] + 0.9265, !- Year 28 Escalation [2052] + 0.9249, !- Year 29 Escalation [2053] + 0.9232; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + West Industrial-Coal, !- Name + Coal, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0176, !- Year 1 Escalation [2025] + 1.0211, !- Year 2 Escalation [2026] + 1.0176, !- Year 3 Escalation [2027] + 1.0070, !- Year 4 Escalation [2028] + 1.0035, !- Year 5 Escalation [2029] + 1.0000, !- Year 6 Escalation [2030] + 0.9965, !- Year 7 Escalation [2031] + 0.9894, !- Year 8 Escalation [2032] + 0.9859, !- Year 9 Escalation [2033] + 0.9859, !- Year 10 Escalation [2034] + 0.9824, !- Year 11 Escalation [2035] + 0.9824, !- Year 12 Escalation [2036] + 0.9824, !- Year 13 Escalation [2037] + 0.9824, !- Year 14 Escalation [2038] + 0.9789, !- Year 15 Escalation [2039] + 0.9789, !- Year 16 Escalation [2040] + 0.9754, !- Year 17 Escalation [2041] + 0.9754, !- Year 18 Escalation [2042] + 0.9754, !- Year 19 Escalation [2043] + 0.9754, !- Year 20 Escalation [2044] + 0.9789, !- Year 21 Escalation [2045] + 0.9789, !- Year 22 Escalation [2046] + 0.9789, !- Year 23 Escalation [2047] + 0.9789, !- Year 24 Escalation [2048] + 0.9789, !- Year 25 Escalation [2049] + 0.9789, !- Year 26 Escalation [2050] + 0.9789, !- Year 27 Escalation [2051] + 0.9789, !- Year 28 Escalation [2052] + 0.9789, !- Year 29 Escalation [2053] + 0.9789; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + U.S. Avg Residential-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9702, !- Year 1 Escalation [2025] + 0.9529, !- Year 2 Escalation [2026] + 0.9396, !- Year 3 Escalation [2027] + 0.9307, !- Year 4 Escalation [2028] + 0.9282, !- Year 5 Escalation [2029] + 0.9307, !- Year 6 Escalation [2030] + 0.9354, !- Year 7 Escalation [2031] + 0.9398, !- Year 8 Escalation [2032] + 0.9541, !- Year 9 Escalation [2033] + 0.9650, !- Year 10 Escalation [2034] + 0.9660, !- Year 11 Escalation [2035] + 0.9719, !- Year 12 Escalation [2036] + 0.9793, !- Year 13 Escalation [2037] + 0.9896, !- Year 14 Escalation [2038] + 0.9968, !- Year 15 Escalation [2039] + 1.0042, !- Year 16 Escalation [2040] + 1.0099, !- Year 17 Escalation [2041] + 1.0131, !- Year 18 Escalation [2042] + 1.0153, !- Year 19 Escalation [2043] + 1.0173, !- Year 20 Escalation [2044] + 1.0195, !- Year 21 Escalation [2045] + 1.0178, !- Year 22 Escalation [2046] + 1.0148, !- Year 23 Escalation [2047] + 1.0133, !- Year 24 Escalation [2048] + 1.0089, !- Year 25 Escalation [2049] + 1.0012, !- Year 26 Escalation [2050] + 0.9970, !- Year 27 Escalation [2051] + 0.9931, !- Year 28 Escalation [2052] + 0.9889, !- Year 29 Escalation [2053] + 0.9850; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + U.S. Avg Residential-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9481, !- Year 1 Escalation [2025] + 0.9336, !- Year 2 Escalation [2026] + 0.9193, !- Year 3 Escalation [2027] + 0.9105, !- Year 4 Escalation [2028] + 0.9130, !- Year 5 Escalation [2029] + 0.9133, !- Year 6 Escalation [2030] + 0.9190, !- Year 7 Escalation [2031] + 0.9215, !- Year 8 Escalation [2032] + 0.9253, !- Year 9 Escalation [2033] + 0.9269, !- Year 10 Escalation [2034] + 0.9323, !- Year 11 Escalation [2035] + 0.9329, !- Year 12 Escalation [2036] + 0.9367, !- Year 13 Escalation [2037] + 0.9396, !- Year 14 Escalation [2038] + 0.9408, !- Year 15 Escalation [2039] + 0.9424, !- Year 16 Escalation [2040] + 0.9472, !- Year 17 Escalation [2041] + 0.9472, !- Year 18 Escalation [2042] + 0.9506, !- Year 19 Escalation [2043] + 0.9475, !- Year 20 Escalation [2044] + 0.9491, !- Year 21 Escalation [2045] + 0.9557, !- Year 22 Escalation [2046] + 0.9567, !- Year 23 Escalation [2047] + 0.9576, !- Year 24 Escalation [2048] + 0.9595, !- Year 25 Escalation [2049] + 0.9595, !- Year 26 Escalation [2050] + 0.9605, !- Year 27 Escalation [2051] + 0.9617, !- Year 28 Escalation [2052] + 0.9627, !- Year 29 Escalation [2053] + 0.9636; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + U.S. Avg Residential-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9438, !- Year 1 Escalation [2025] + 0.8963, !- Year 2 Escalation [2026] + 0.8643, !- Year 3 Escalation [2027] + 0.8440, !- Year 4 Escalation [2028] + 0.8479, !- Year 5 Escalation [2029] + 0.8518, !- Year 6 Escalation [2030] + 0.8596, !- Year 7 Escalation [2031] + 0.8666, !- Year 8 Escalation [2032] + 0.8783, !- Year 9 Escalation [2033] + 0.8877, !- Year 10 Escalation [2034] + 0.8955, !- Year 11 Escalation [2035] + 0.9002, !- Year 12 Escalation [2036] + 0.9064, !- Year 13 Escalation [2037] + 0.9173, !- Year 14 Escalation [2038] + 0.9181, !- Year 15 Escalation [2039] + 0.9251, !- Year 16 Escalation [2040] + 0.9321, !- Year 17 Escalation [2041] + 0.9345, !- Year 18 Escalation [2042] + 0.9337, !- Year 19 Escalation [2043] + 0.9298, !- Year 20 Escalation [2044] + 0.9345, !- Year 21 Escalation [2045] + 0.9587, !- Year 22 Escalation [2046] + 0.9579, !- Year 23 Escalation [2047] + 0.9555, !- Year 24 Escalation [2048] + 0.9555, !- Year 25 Escalation [2049] + 0.9587, !- Year 26 Escalation [2050] + 0.9579, !- Year 27 Escalation [2051] + 0.9579, !- Year 28 Escalation [2052] + 0.9579, !- Year 29 Escalation [2053] + 0.9579; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + U.S. Avg Residential-LPG, !- Name + Propane, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9657, !- Year 1 Escalation [2025] + 0.9311, !- Year 2 Escalation [2026] + 0.9028, !- Year 3 Escalation [2027] + 0.8869, !- Year 4 Escalation [2028] + 0.8809, !- Year 5 Escalation [2029] + 0.8838, !- Year 6 Escalation [2030] + 0.8927, !- Year 7 Escalation [2031] + 0.9076, !- Year 8 Escalation [2032] + 0.9263, !- Year 9 Escalation [2033] + 0.9451, !- Year 10 Escalation [2034] + 0.9600, !- Year 11 Escalation [2035] + 0.9711, !- Year 12 Escalation [2036] + 0.9813, !- Year 13 Escalation [2037] + 0.9943, !- Year 14 Escalation [2038] + 1.0006, !- Year 15 Escalation [2039] + 1.0108, !- Year 16 Escalation [2040] + 1.0210, !- Year 17 Escalation [2041] + 1.0283, !- Year 18 Escalation [2042] + 1.0321, !- Year 19 Escalation [2043] + 1.0330, !- Year 20 Escalation [2044] + 1.0352, !- Year 21 Escalation [2045] + 1.0422, !- Year 22 Escalation [2046] + 1.0435, !- Year 23 Escalation [2047] + 1.0460, !- Year 24 Escalation [2048] + 1.0470, !- Year 25 Escalation [2049] + 1.0467, !- Year 26 Escalation [2050] + 1.0480, !- Year 27 Escalation [2051] + 1.0492, !- Year 28 Escalation [2052] + 1.0502, !- Year 29 Escalation [2053] + 1.0514; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + U.S. Avg Commercial-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9572, !- Year 1 Escalation [2025] + 0.9333, !- Year 2 Escalation [2026] + 0.9161, !- Year 3 Escalation [2027] + 0.9016, !- Year 4 Escalation [2028] + 0.8946, !- Year 5 Escalation [2029] + 0.8934, !- Year 6 Escalation [2030] + 0.8928, !- Year 7 Escalation [2031] + 0.8920, !- Year 8 Escalation [2032] + 0.9022, !- Year 9 Escalation [2033] + 0.9089, !- Year 10 Escalation [2034] + 0.9068, !- Year 11 Escalation [2035] + 0.9094, !- Year 12 Escalation [2036] + 0.9126, !- Year 13 Escalation [2037] + 0.9199, !- Year 14 Escalation [2038] + 0.9246, !- Year 15 Escalation [2039] + 0.9287, !- Year 16 Escalation [2040] + 0.9316, !- Year 17 Escalation [2041] + 0.9321, !- Year 18 Escalation [2042] + 0.9324, !- Year 19 Escalation [2043] + 0.9313, !- Year 20 Escalation [2044] + 0.9298, !- Year 21 Escalation [2045] + 0.9246, !- Year 22 Escalation [2046] + 0.9170, !- Year 23 Escalation [2047] + 0.9138, !- Year 24 Escalation [2048] + 0.9065, !- Year 25 Escalation [2049] + 0.8969, !- Year 26 Escalation [2050] + 0.8902, !- Year 27 Escalation [2051] + 0.8835, !- Year 28 Escalation [2052] + 0.8768, !- Year 29 Escalation [2053] + 0.8701; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + U.S. Avg Commercial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9085, !- Year 1 Escalation [2025] + 0.8549, !- Year 2 Escalation [2026] + 0.8027, !- Year 3 Escalation [2027] + 0.7553, !- Year 4 Escalation [2028] + 0.7582, !- Year 5 Escalation [2029] + 0.7582, !- Year 6 Escalation [2030] + 0.7638, !- Year 7 Escalation [2031] + 0.7667, !- Year 8 Escalation [2032] + 0.7700, !- Year 9 Escalation [2033] + 0.7720, !- Year 10 Escalation [2034] + 0.7769, !- Year 11 Escalation [2035] + 0.7779, !- Year 12 Escalation [2036] + 0.7814, !- Year 13 Escalation [2037] + 0.7841, !- Year 14 Escalation [2038] + 0.7857, !- Year 15 Escalation [2039] + 0.7870, !- Year 16 Escalation [2040] + 0.7922, !- Year 17 Escalation [2041] + 0.7919, !- Year 18 Escalation [2042] + 0.7955, !- Year 19 Escalation [2043] + 0.7926, !- Year 20 Escalation [2044] + 0.7948, !- Year 21 Escalation [2045] + 0.8122, !- Year 22 Escalation [2046] + 0.8125, !- Year 23 Escalation [2047] + 0.8135, !- Year 24 Escalation [2048] + 0.8157, !- Year 25 Escalation [2049] + 0.8157, !- Year 26 Escalation [2050] + 0.8167, !- Year 27 Escalation [2051] + 0.8177, !- Year 28 Escalation [2052] + 0.8187, !- Year 29 Escalation [2053] + 0.8197; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + U.S. Avg Commercial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0329, !- Year 1 Escalation [2025] + 1.1803, !- Year 2 Escalation [2026] + 1.3287, !- Year 3 Escalation [2027] + 1.4878, !- Year 4 Escalation [2028] + 1.4952, !- Year 5 Escalation [2029] + 1.5048, !- Year 6 Escalation [2030] + 1.5154, !- Year 7 Escalation [2031] + 1.5260, !- Year 8 Escalation [2032] + 1.5355, !- Year 9 Escalation [2033] + 1.5461, !- Year 10 Escalation [2034] + 1.5578, !- Year 11 Escalation [2035] + 1.5673, !- Year 12 Escalation [2036] + 1.5779, !- Year 13 Escalation [2037] + 1.5896, !- Year 14 Escalation [2038] + 1.5960, !- Year 15 Escalation [2039] + 1.6055, !- Year 16 Escalation [2040] + 1.6182, !- Year 17 Escalation [2041] + 1.6204, !- Year 18 Escalation [2042] + 1.6278, !- Year 19 Escalation [2043] + 1.6310, !- Year 20 Escalation [2044] + 1.6363, !- Year 21 Escalation [2045] + 1.6532, !- Year 22 Escalation [2046] + 1.6532, !- Year 23 Escalation [2047] + 1.6660, !- Year 24 Escalation [2048] + 1.6755, !- Year 25 Escalation [2049] + 1.6829, !- Year 26 Escalation [2050] + 1.6903, !- Year 27 Escalation [2051] + 1.6978, !- Year 28 Escalation [2052] + 1.7063, !- Year 29 Escalation [2053] + 1.7137; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + U.S. Avg Commercial-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9486, !- Year 1 Escalation [2025] + 0.9068, !- Year 2 Escalation [2026] + 0.8842, !- Year 3 Escalation [2027] + 0.8735, !- Year 4 Escalation [2028] + 0.8778, !- Year 5 Escalation [2029] + 0.8810, !- Year 6 Escalation [2030] + 0.8896, !- Year 7 Escalation [2031] + 0.8971, !- Year 8 Escalation [2032] + 0.9110, !- Year 9 Escalation [2033] + 0.9218, !- Year 10 Escalation [2034] + 0.9314, !- Year 11 Escalation [2035] + 0.9346, !- Year 12 Escalation [2036] + 0.9421, !- Year 13 Escalation [2037] + 0.9561, !- Year 14 Escalation [2038] + 0.9550, !- Year 15 Escalation [2039] + 0.9646, !- Year 16 Escalation [2040] + 0.9732, !- Year 17 Escalation [2041] + 0.9753, !- Year 18 Escalation [2042] + 0.9732, !- Year 19 Escalation [2043] + 0.9678, !- Year 20 Escalation [2044] + 0.9732, !- Year 21 Escalation [2045] + 0.9946, !- Year 22 Escalation [2046] + 0.9904, !- Year 23 Escalation [2047] + 0.9850, !- Year 24 Escalation [2048] + 0.9850, !- Year 25 Escalation [2049] + 0.9882, !- Year 26 Escalation [2050] + 0.9871, !- Year 27 Escalation [2051] + 0.9861, !- Year 28 Escalation [2052] + 0.9850, !- Year 29 Escalation [2053] + 0.9829; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + U.S. Avg Industrial-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9454, !- Year 1 Escalation [2025] + 0.9089, !- Year 2 Escalation [2026] + 0.8836, !- Year 3 Escalation [2027] + 0.8674, !- Year 4 Escalation [2028] + 0.8584, !- Year 5 Escalation [2029] + 0.8561, !- Year 6 Escalation [2030] + 0.8561, !- Year 7 Escalation [2031] + 0.8566, !- Year 8 Escalation [2032] + 0.8710, !- Year 9 Escalation [2033] + 0.8755, !- Year 10 Escalation [2034] + 0.8733, !- Year 11 Escalation [2035] + 0.8787, !- Year 12 Escalation [2036] + 0.8859, !- Year 13 Escalation [2037] + 0.8981, !- Year 14 Escalation [2038] + 0.9084, !- Year 15 Escalation [2039] + 0.9157, !- Year 16 Escalation [2040] + 0.9220, !- Year 17 Escalation [2041] + 0.9224, !- Year 18 Escalation [2042] + 0.9206, !- Year 19 Escalation [2043] + 0.9202, !- Year 20 Escalation [2044] + 0.9179, !- Year 21 Escalation [2045] + 0.9125, !- Year 22 Escalation [2046] + 0.9066, !- Year 23 Escalation [2047] + 0.9030, !- Year 24 Escalation [2048] + 0.8972, !- Year 25 Escalation [2049] + 0.8890, !- Year 26 Escalation [2050] + 0.8832, !- Year 27 Escalation [2051] + 0.8773, !- Year 28 Escalation [2052] + 0.8719, !- Year 29 Escalation [2053] + 0.8660; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + U.S. Avg Industrial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9068, !- Year 1 Escalation [2025] + 0.8517, !- Year 2 Escalation [2026] + 0.7979, !- Year 3 Escalation [2027] + 0.7493, !- Year 4 Escalation [2028] + 0.7523, !- Year 5 Escalation [2029] + 0.7526, !- Year 6 Escalation [2030] + 0.7582, !- Year 7 Escalation [2031] + 0.7615, !- Year 8 Escalation [2032] + 0.7654, !- Year 9 Escalation [2033] + 0.7674, !- Year 10 Escalation [2034] + 0.7730, !- Year 11 Escalation [2035] + 0.7740, !- Year 12 Escalation [2036] + 0.7779, !- Year 13 Escalation [2037] + 0.7808, !- Year 14 Escalation [2038] + 0.7825, !- Year 15 Escalation [2039] + 0.7844, !- Year 16 Escalation [2040] + 0.7897, !- Year 17 Escalation [2041] + 0.7897, !- Year 18 Escalation [2042] + 0.7940, !- Year 19 Escalation [2043] + 0.7913, !- Year 20 Escalation [2044] + 0.7930, !- Year 21 Escalation [2045] + 0.8005, !- Year 22 Escalation [2046] + 0.8015, !- Year 23 Escalation [2047] + 0.8028, !- Year 24 Escalation [2048] + 0.8051, !- Year 25 Escalation [2049] + 0.8054, !- Year 26 Escalation [2050] + 0.8068, !- Year 27 Escalation [2051] + 0.8081, !- Year 28 Escalation [2052] + 0.8091, !- Year 29 Escalation [2053] + 0.8104; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + U.S. Avg Industrial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0560, !- Year 1 Escalation [2025] + 1.2075, !- Year 2 Escalation [2026] + 1.3687, !- Year 3 Escalation [2027] + 1.5280, !- Year 4 Escalation [2028] + 1.5359, !- Year 5 Escalation [2029] + 1.5467, !- Year 6 Escalation [2030] + 1.5585, !- Year 7 Escalation [2031] + 1.5703, !- Year 8 Escalation [2032] + 1.5811, !- Year 9 Escalation [2033] + 1.5939, !- Year 10 Escalation [2034] + 1.6067, !- Year 11 Escalation [2035] + 1.6155, !- Year 12 Escalation [2036] + 1.6264, !- Year 13 Escalation [2037] + 1.6382, !- Year 14 Escalation [2038] + 1.6450, !- Year 15 Escalation [2039] + 1.6549, !- Year 16 Escalation [2040] + 1.6686, !- Year 17 Escalation [2041] + 1.6706, !- Year 18 Escalation [2042] + 1.6785, !- Year 19 Escalation [2043] + 1.6775, !- Year 20 Escalation [2044] + 1.6834, !- Year 21 Escalation [2045] + 1.7001, !- Year 22 Escalation [2046] + 1.7011, !- Year 23 Escalation [2047] + 1.7119, !- Year 24 Escalation [2048] + 1.7207, !- Year 25 Escalation [2049] + 1.7276, !- Year 26 Escalation [2050] + 1.7345, !- Year 27 Escalation [2051] + 1.7414, !- Year 28 Escalation [2052] + 1.7483, !- Year 29 Escalation [2053] + 1.7552; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + U.S. Avg Industrial-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.8895, !- Year 1 Escalation [2025] + 0.8062, !- Year 2 Escalation [2026] + 0.7597, !- Year 3 Escalation [2027] + 0.7442, !- Year 4 Escalation [2028] + 0.7461, !- Year 5 Escalation [2029] + 0.7578, !- Year 6 Escalation [2030] + 0.7791, !- Year 7 Escalation [2031] + 0.8004, !- Year 8 Escalation [2032] + 0.8295, !- Year 9 Escalation [2033] + 0.8547, !- Year 10 Escalation [2034] + 0.8760, !- Year 11 Escalation [2035] + 0.8798, !- Year 12 Escalation [2036] + 0.8895, !- Year 13 Escalation [2037] + 0.9128, !- Year 14 Escalation [2038] + 0.9012, !- Year 15 Escalation [2039] + 0.9244, !- Year 16 Escalation [2040] + 0.9399, !- Year 17 Escalation [2041] + 0.9399, !- Year 18 Escalation [2042] + 0.9283, !- Year 19 Escalation [2043] + 0.9186, !- Year 20 Escalation [2044] + 0.9186, !- Year 21 Escalation [2045] + 0.9128, !- Year 22 Escalation [2046] + 0.9050, !- Year 23 Escalation [2047] + 0.8992, !- Year 24 Escalation [2048] + 0.8915, !- Year 25 Escalation [2049] + 0.8895, !- Year 26 Escalation [2050] + 0.8837, !- Year 27 Escalation [2051] + 0.8798, !- Year 28 Escalation [2052] + 0.8740, !- Year 29 Escalation [2053] + 0.8682; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + U.S. Avg Industrial-Coal, !- Name + Coal, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0213, !- Year 1 Escalation [2025] + 1.0177, !- Year 2 Escalation [2026] + 1.0106, !- Year 3 Escalation [2027] + 1.0071, !- Year 4 Escalation [2028] + 1.0035, !- Year 5 Escalation [2029] + 1.0000, !- Year 6 Escalation [2030] + 1.0000, !- Year 7 Escalation [2031] + 0.9965, !- Year 8 Escalation [2032] + 0.9965, !- Year 9 Escalation [2033] + 0.9965, !- Year 10 Escalation [2034] + 0.9965, !- Year 11 Escalation [2035] + 1.0000, !- Year 12 Escalation [2036] + 1.0035, !- Year 13 Escalation [2037] + 1.0071, !- Year 14 Escalation [2038] + 1.0106, !- Year 15 Escalation [2039] + 1.0106, !- Year 16 Escalation [2040] + 1.0106, !- Year 17 Escalation [2041] + 1.0106, !- Year 18 Escalation [2042] + 1.0106, !- Year 19 Escalation [2043] + 1.0106, !- Year 20 Escalation [2044] + 1.0142, !- Year 21 Escalation [2045] + 1.0142, !- Year 22 Escalation [2046] + 1.0177, !- Year 23 Escalation [2047] + 1.0177, !- Year 24 Escalation [2048] + 1.0177, !- Year 25 Escalation [2049] + 1.0177, !- Year 26 Escalation [2050] + 1.0177, !- Year 27 Escalation [2051] + 1.0177, !- Year 28 Escalation [2052] + 1.0177, !- Year 29 Escalation [2053] + 1.0177; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + NewEngland Residential-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9866, !- Year 1 Escalation [2025] + 0.9785, !- Year 2 Escalation [2026] + 0.9771, !- Year 3 Escalation [2027] + 0.9812, !- Year 4 Escalation [2028] + 0.9869, !- Year 5 Escalation [2029] + 0.9831, !- Year 6 Escalation [2030] + 0.9907, !- Year 7 Escalation [2031] + 1.0017, !- Year 8 Escalation [2032] + 1.0103, !- Year 9 Escalation [2033] + 1.0452, !- Year 10 Escalation [2034] + 1.0289, !- Year 11 Escalation [2035] + 1.0572, !- Year 12 Escalation [2036] + 1.0638, !- Year 13 Escalation [2037] + 1.0786, !- Year 14 Escalation [2038] + 1.0819, !- Year 15 Escalation [2039] + 1.0876, !- Year 16 Escalation [2040] + 1.0935, !- Year 17 Escalation [2041] + 1.0927, !- Year 18 Escalation [2042] + 1.0948, !- Year 19 Escalation [2043] + 1.0826, !- Year 20 Escalation [2044] + 1.0804, !- Year 21 Escalation [2045] + 1.0823, !- Year 22 Escalation [2046] + 1.0774, !- Year 23 Escalation [2047] + 1.0804, !- Year 24 Escalation [2048] + 1.0613, !- Year 25 Escalation [2049] + 1.0591, !- Year 26 Escalation [2050] + 1.0534, !- Year 27 Escalation [2051] + 1.0478, !- Year 28 Escalation [2052] + 1.0422, !- Year 29 Escalation [2053] + 1.0366; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + NewEngland Residential-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9483, !- Year 1 Escalation [2025] + 0.9341, !- Year 2 Escalation [2026] + 0.9204, !- Year 3 Escalation [2027] + 0.9124, !- Year 4 Escalation [2028] + 0.9154, !- Year 5 Escalation [2029] + 0.9159, !- Year 6 Escalation [2030] + 0.9217, !- Year 7 Escalation [2031] + 0.9247, !- Year 8 Escalation [2032] + 0.9289, !- Year 9 Escalation [2033] + 0.9302, !- Year 10 Escalation [2034] + 0.9364, !- Year 11 Escalation [2035] + 0.9368, !- Year 12 Escalation [2036] + 0.9411, !- Year 13 Escalation [2037] + 0.9441, !- Year 14 Escalation [2038] + 0.9456, !- Year 15 Escalation [2039] + 0.9472, !- Year 16 Escalation [2040] + 0.9523, !- Year 17 Escalation [2041] + 0.9522, !- Year 18 Escalation [2042] + 0.9560, !- Year 19 Escalation [2043] + 0.9532, !- Year 20 Escalation [2044] + 0.9545, !- Year 21 Escalation [2045] + 0.9611, !- Year 22 Escalation [2046] + 0.9623, !- Year 23 Escalation [2047] + 0.9635, !- Year 24 Escalation [2048] + 0.9658, !- Year 25 Escalation [2049] + 0.9660, !- Year 26 Escalation [2050] + 0.9673, !- Year 27 Escalation [2051] + 0.9685, !- Year 28 Escalation [2052] + 0.9697, !- Year 29 Escalation [2053] + 0.9710; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + NewEngland Residential-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9646, !- Year 1 Escalation [2025] + 0.9453, !- Year 2 Escalation [2026] + 0.9299, !- Year 3 Escalation [2027] + 0.9180, !- Year 4 Escalation [2028] + 0.9173, !- Year 5 Escalation [2029] + 0.9146, !- Year 6 Escalation [2030] + 0.9133, !- Year 7 Escalation [2031] + 0.9142, !- Year 8 Escalation [2032] + 0.9158, !- Year 9 Escalation [2033] + 0.9176, !- Year 10 Escalation [2034] + 0.9195, !- Year 11 Escalation [2035] + 0.9214, !- Year 12 Escalation [2036] + 0.9235, !- Year 13 Escalation [2037] + 0.9266, !- Year 14 Escalation [2038] + 0.9282, !- Year 15 Escalation [2039] + 0.9306, !- Year 16 Escalation [2040] + 0.9330, !- Year 17 Escalation [2041] + 0.9343, !- Year 18 Escalation [2042] + 0.9345, !- Year 19 Escalation [2043] + 0.9335, !- Year 20 Escalation [2044] + 0.9355, !- Year 21 Escalation [2045] + 0.9354, !- Year 22 Escalation [2046] + 0.9352, !- Year 23 Escalation [2047] + 0.9349, !- Year 24 Escalation [2048] + 0.9355, !- Year 25 Escalation [2049] + 0.9370, !- Year 26 Escalation [2050] + 0.9374, !- Year 27 Escalation [2051] + 0.9378, !- Year 28 Escalation [2052] + 0.9382, !- Year 29 Escalation [2053] + 0.9386; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + NewEngland Residential-LPG, !- Name + Propane, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9659, !- Year 1 Escalation [2025] + 0.9309, !- Year 2 Escalation [2026] + 0.9026, !- Year 3 Escalation [2027] + 0.8865, !- Year 4 Escalation [2028] + 0.8803, !- Year 5 Escalation [2029] + 0.8831, !- Year 6 Escalation [2030] + 0.8923, !- Year 7 Escalation [2031] + 0.9070, !- Year 8 Escalation [2032] + 0.9257, !- Year 9 Escalation [2033] + 0.9444, !- Year 10 Escalation [2034] + 0.9594, !- Year 11 Escalation [2035] + 0.9707, !- Year 12 Escalation [2036] + 0.9807, !- Year 13 Escalation [2037] + 0.9936, !- Year 14 Escalation [2038] + 0.9999, !- Year 15 Escalation [2039] + 1.0101, !- Year 16 Escalation [2040] + 1.0201, !- Year 17 Escalation [2041] + 1.0272, !- Year 18 Escalation [2042] + 1.0309, !- Year 19 Escalation [2043] + 1.0317, !- Year 20 Escalation [2044] + 1.0336, !- Year 21 Escalation [2045] + 1.0343, !- Year 22 Escalation [2046] + 1.0354, !- Year 23 Escalation [2047] + 1.0379, !- Year 24 Escalation [2048] + 1.0387, !- Year 25 Escalation [2049] + 1.0381, !- Year 26 Escalation [2050] + 1.0390, !- Year 27 Escalation [2051] + 1.0400, !- Year 28 Escalation [2052] + 1.0410, !- Year 29 Escalation [2053] + 1.0419; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + NewEngland Commercial-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9814, !- Year 1 Escalation [2025] + 0.9648, !- Year 2 Escalation [2026] + 0.9567, !- Year 3 Escalation [2027] + 0.9546, !- Year 4 Escalation [2028] + 0.9484, !- Year 5 Escalation [2029] + 0.9388, !- Year 6 Escalation [2030] + 0.9399, !- Year 7 Escalation [2031] + 0.9405, !- Year 8 Escalation [2032] + 0.9452, !- Year 9 Escalation [2033] + 0.9848, !- Year 10 Escalation [2034] + 0.9546, !- Year 11 Escalation [2035] + 0.9887, !- Year 12 Escalation [2036] + 0.9920, !- Year 13 Escalation [2037] + 1.0082, !- Year 14 Escalation [2038] + 1.0099, !- Year 15 Escalation [2039] + 1.0098, !- Year 16 Escalation [2040] + 1.0141, !- Year 17 Escalation [2041] + 1.0090, !- Year 18 Escalation [2042] + 1.0081, !- Year 19 Escalation [2043] + 0.9899, !- Year 20 Escalation [2044] + 0.9836, !- Year 21 Escalation [2045] + 0.9846, !- Year 22 Escalation [2046] + 0.9760, !- Year 23 Escalation [2047] + 0.9779, !- Year 24 Escalation [2048] + 0.9493, !- Year 25 Escalation [2049] + 0.9442, !- Year 26 Escalation [2050] + 0.9344, !- Year 27 Escalation [2051] + 0.9247, !- Year 28 Escalation [2052] + 0.9151, !- Year 29 Escalation [2053] + 0.9056; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + NewEngland Commercial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9151, !- Year 1 Escalation [2025] + 0.8646, !- Year 2 Escalation [2026] + 0.8147, !- Year 3 Escalation [2027] + 0.7691, !- Year 4 Escalation [2028] + 0.7717, !- Year 5 Escalation [2029] + 0.7721, !- Year 6 Escalation [2030] + 0.7775, !- Year 7 Escalation [2031] + 0.7800, !- Year 8 Escalation [2032] + 0.7834, !- Year 9 Escalation [2033] + 0.7852, !- Year 10 Escalation [2034] + 0.7898, !- Year 11 Escalation [2035] + 0.7909, !- Year 12 Escalation [2036] + 0.7945, !- Year 13 Escalation [2037] + 0.7973, !- Year 14 Escalation [2038] + 0.7987, !- Year 15 Escalation [2039] + 0.8004, !- Year 16 Escalation [2040] + 0.8052, !- Year 17 Escalation [2041] + 0.8053, !- Year 18 Escalation [2042] + 0.8089, !- Year 19 Escalation [2043] + 0.8064, !- Year 20 Escalation [2044] + 0.8083, !- Year 21 Escalation [2045] + 0.8147, !- Year 22 Escalation [2046] + 0.8155, !- Year 23 Escalation [2047] + 0.8167, !- Year 24 Escalation [2048] + 0.8190, !- Year 25 Escalation [2049] + 0.8192, !- Year 26 Escalation [2050] + 0.8203, !- Year 27 Escalation [2051] + 0.8215, !- Year 28 Escalation [2052] + 0.8226, !- Year 29 Escalation [2053] + 0.8238; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + NewEngland Commercial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0323, !- Year 1 Escalation [2025] + 1.1903, !- Year 2 Escalation [2026] + 1.3499, !- Year 3 Escalation [2027] + 1.5061, !- Year 4 Escalation [2028] + 1.5162, !- Year 5 Escalation [2029] + 1.5259, !- Year 6 Escalation [2030] + 1.5382, !- Year 7 Escalation [2031] + 1.5495, !- Year 8 Escalation [2032] + 1.5597, !- Year 9 Escalation [2033] + 1.5710, !- Year 10 Escalation [2034] + 1.5834, !- Year 11 Escalation [2035] + 1.5932, !- Year 12 Escalation [2036] + 1.6040, !- Year 13 Escalation [2037] + 1.6155, !- Year 14 Escalation [2038] + 1.6226, !- Year 15 Escalation [2039] + 1.6318, !- Year 16 Escalation [2040] + 1.6455, !- Year 17 Escalation [2041] + 1.6473, !- Year 18 Escalation [2042] + 1.6548, !- Year 19 Escalation [2043] + 1.6600, !- Year 20 Escalation [2044] + 1.6663, !- Year 21 Escalation [2045] + 1.6834, !- Year 22 Escalation [2046] + 1.6835, !- Year 23 Escalation [2047] + 1.6967, !- Year 24 Escalation [2048] + 1.7066, !- Year 25 Escalation [2049] + 1.7141, !- Year 26 Escalation [2050] + 1.7218, !- Year 27 Escalation [2051] + 1.7296, !- Year 28 Escalation [2052] + 1.7374, !- Year 29 Escalation [2053] + 1.7453; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + NewEngland Commercial-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9800, !- Year 1 Escalation [2025] + 0.9809, !- Year 2 Escalation [2026] + 0.9869, !- Year 3 Escalation [2027] + 0.9972, !- Year 4 Escalation [2028] + 0.9997, !- Year 5 Escalation [2029] + 0.9993, !- Year 6 Escalation [2030] + 1.0010, !- Year 7 Escalation [2031] + 1.0058, !- Year 8 Escalation [2032] + 1.0088, !- Year 9 Escalation [2033] + 1.0118, !- Year 10 Escalation [2034] + 1.0147, !- Year 11 Escalation [2035] + 1.0172, !- Year 12 Escalation [2036] + 1.0198, !- Year 13 Escalation [2037] + 1.0236, !- Year 14 Escalation [2038] + 1.0252, !- Year 15 Escalation [2039] + 1.0278, !- Year 16 Escalation [2040] + 1.0302, !- Year 17 Escalation [2041] + 1.0308, !- Year 18 Escalation [2042] + 1.0301, !- Year 19 Escalation [2043] + 1.0275, !- Year 20 Escalation [2044] + 1.0292, !- Year 21 Escalation [2045] + 1.0281, !- Year 22 Escalation [2046] + 1.0269, !- Year 23 Escalation [2047] + 1.0254, !- Year 24 Escalation [2048] + 1.0256, !- Year 25 Escalation [2049] + 1.0271, !- Year 26 Escalation [2050] + 1.0268, !- Year 27 Escalation [2051] + 1.0266, !- Year 28 Escalation [2052] + 1.0263, !- Year 29 Escalation [2053] + 1.0260; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + NewEngland Industrial-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9512, !- Year 1 Escalation [2025] + 0.9134, !- Year 2 Escalation [2026] + 0.8951, !- Year 3 Escalation [2027] + 0.8843, !- Year 4 Escalation [2028] + 0.8738, !- Year 5 Escalation [2029] + 0.8532, !- Year 6 Escalation [2030] + 0.8496, !- Year 7 Escalation [2031] + 0.8495, !- Year 8 Escalation [2032] + 0.8517, !- Year 9 Escalation [2033] + 0.8726, !- Year 10 Escalation [2034] + 0.8467, !- Year 11 Escalation [2035] + 0.8639, !- Year 12 Escalation [2036] + 0.8641, !- Year 13 Escalation [2037] + 0.8772, !- Year 14 Escalation [2038] + 0.8744, !- Year 15 Escalation [2039] + 0.8723, !- Year 16 Escalation [2040] + 0.8737, !- Year 17 Escalation [2041] + 0.8666, !- Year 18 Escalation [2042] + 0.8628, !- Year 19 Escalation [2043] + 0.8459, !- Year 20 Escalation [2044] + 0.8393, !- Year 21 Escalation [2045] + 0.8364, !- Year 22 Escalation [2046] + 0.8270, !- Year 23 Escalation [2047] + 0.8251, !- Year 24 Escalation [2048] + 0.7964, !- Year 25 Escalation [2049] + 0.7898, !- Year 26 Escalation [2050] + 0.7786, !- Year 27 Escalation [2051] + 0.7676, !- Year 28 Escalation [2052] + 0.7568, !- Year 29 Escalation [2053] + 0.7460; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + NewEngland Industrial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9141, !- Year 1 Escalation [2025] + 0.8641, !- Year 2 Escalation [2026] + 0.8146, !- Year 3 Escalation [2027] + 0.7699, !- Year 4 Escalation [2028] + 0.7727, !- Year 5 Escalation [2029] + 0.7731, !- Year 6 Escalation [2030] + 0.7787, !- Year 7 Escalation [2031] + 0.7815, !- Year 8 Escalation [2032] + 0.7851, !- Year 9 Escalation [2033] + 0.7868, !- Year 10 Escalation [2034] + 0.7920, !- Year 11 Escalation [2035] + 0.7929, !- Year 12 Escalation [2036] + 0.7967, !- Year 13 Escalation [2037] + 0.7996, !- Year 14 Escalation [2038] + 0.8011, !- Year 15 Escalation [2039] + 0.8028, !- Year 16 Escalation [2040] + 0.8078, !- Year 17 Escalation [2041] + 0.8078, !- Year 18 Escalation [2042] + 0.8115, !- Year 19 Escalation [2043] + 0.8088, !- Year 20 Escalation [2044] + 0.8106, !- Year 21 Escalation [2045] + 0.8171, !- Year 22 Escalation [2046] + 0.8181, !- Year 23 Escalation [2047] + 0.8193, !- Year 24 Escalation [2048] + 0.8216, !- Year 25 Escalation [2049] + 0.8218, !- Year 26 Escalation [2050] + 0.8230, !- Year 27 Escalation [2051] + 0.8242, !- Year 28 Escalation [2052] + 0.8254, !- Year 29 Escalation [2053] + 0.8266; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + NewEngland Industrial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0339, !- Year 1 Escalation [2025] + 1.1944, !- Year 2 Escalation [2026] + 1.3562, !- Year 3 Escalation [2027] + 1.5149, !- Year 4 Escalation [2028] + 1.5250, !- Year 5 Escalation [2029] + 1.5348, !- Year 6 Escalation [2030] + 1.5472, !- Year 7 Escalation [2031] + 1.5585, !- Year 8 Escalation [2032] + 1.5688, !- Year 9 Escalation [2033] + 1.5801, !- Year 10 Escalation [2034] + 1.5926, !- Year 11 Escalation [2035] + 1.6024, !- Year 12 Escalation [2036] + 1.6133, !- Year 13 Escalation [2037] + 1.6249, !- Year 14 Escalation [2038] + 1.6321, !- Year 15 Escalation [2039] + 1.6413, !- Year 16 Escalation [2040] + 1.6551, !- Year 17 Escalation [2041] + 1.6568, !- Year 18 Escalation [2042] + 1.6644, !- Year 19 Escalation [2043] + 1.6696, !- Year 20 Escalation [2044] + 1.6759, !- Year 21 Escalation [2045] + 1.6932, !- Year 22 Escalation [2046] + 1.6933, !- Year 23 Escalation [2047] + 1.7065, !- Year 24 Escalation [2048] + 1.7165, !- Year 25 Escalation [2049] + 1.7240, !- Year 26 Escalation [2050] + 1.7318, !- Year 27 Escalation [2051] + 1.7397, !- Year 28 Escalation [2052] + 1.7475, !- Year 29 Escalation [2053] + 1.7554; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + NewEngland Industrial-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.8917, !- Year 1 Escalation [2025] + 0.8171, !- Year 2 Escalation [2026] + 0.7442, !- Year 3 Escalation [2027] + 0.6942, !- Year 4 Escalation [2028] + 0.7383, !- Year 5 Escalation [2029] + 0.7198, !- Year 6 Escalation [2030] + 0.7064, !- Year 7 Escalation [2031] + 0.7324, !- Year 8 Escalation [2032] + 0.7341, !- Year 9 Escalation [2033] + 0.7417, !- Year 10 Escalation [2034] + 0.7510, !- Year 11 Escalation [2035] + 0.7568, !- Year 12 Escalation [2036] + 0.7675, !- Year 13 Escalation [2037] + 0.7851, !- Year 14 Escalation [2038] + 0.7907, !- Year 15 Escalation [2039] + 0.7956, !- Year 16 Escalation [2040] + 0.8116, !- Year 17 Escalation [2041] + 0.8191, !- Year 18 Escalation [2042] + 0.8140, !- Year 19 Escalation [2043] + 0.7785, !- Year 20 Escalation [2044] + 0.8158, !- Year 21 Escalation [2045] + 0.8013, !- Year 22 Escalation [2046] + 0.7920, !- Year 23 Escalation [2047] + 0.7757, !- Year 24 Escalation [2048] + 0.7860, !- Year 25 Escalation [2049] + 0.7999, !- Year 26 Escalation [2050] + 0.7997, !- Year 27 Escalation [2051] + 0.7994, !- Year 28 Escalation [2052] + 0.7992, !- Year 29 Escalation [2053] + 0.7989; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + NewEngland Industrial-Coal, !- Name + Coal, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0221, !- Year 1 Escalation [2025] + 1.0042, !- Year 2 Escalation [2026] + 1.0287, !- Year 3 Escalation [2027] + 1.0258, !- Year 4 Escalation [2028] + 1.0264, !- Year 5 Escalation [2029] + 1.0287, !- Year 6 Escalation [2030] + 1.0324, !- Year 7 Escalation [2031] + 1.0361, !- Year 8 Escalation [2032] + 1.0413, !- Year 9 Escalation [2033] + 1.0483, !- Year 10 Escalation [2034] + 1.0552, !- Year 11 Escalation [2035] + 1.0626, !- Year 12 Escalation [2036] + 1.0722, !- Year 13 Escalation [2037] + 1.0800, !- Year 14 Escalation [2038] + 1.0864, !- Year 15 Escalation [2039] + 1.0904, !- Year 16 Escalation [2040] + 0.9849, !- Year 17 Escalation [2041] + 0.9823, !- Year 18 Escalation [2042] + 0.9824, !- Year 19 Escalation [2043] + 0.9824, !- Year 20 Escalation [2044] + 0.9826, !- Year 21 Escalation [2045] + 0.9826, !- Year 22 Escalation [2046] + 0.9824, !- Year 23 Escalation [2047] + 0.9822, !- Year 24 Escalation [2048] + 0.9822, !- Year 25 Escalation [2049] + 0.9820, !- Year 26 Escalation [2050] + 0.9818, !- Year 27 Escalation [2051] + 0.9817, !- Year 28 Escalation [2052] + 0.9816, !- Year 29 Escalation [2053] + 0.9814; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + MidAtlantic Residential-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9907, !- Year 1 Escalation [2025] + 0.9792, !- Year 2 Escalation [2026] + 0.9812, !- Year 3 Escalation [2027] + 0.9835, !- Year 4 Escalation [2028] + 0.9898, !- Year 5 Escalation [2029] + 0.9961, !- Year 6 Escalation [2030] + 1.0044, !- Year 7 Escalation [2031] + 1.0210, !- Year 8 Escalation [2032] + 1.0340, !- Year 9 Escalation [2033] + 1.0448, !- Year 10 Escalation [2034] + 1.0517, !- Year 11 Escalation [2035] + 1.0564, !- Year 12 Escalation [2036] + 1.0619, !- Year 13 Escalation [2037] + 1.0744, !- Year 14 Escalation [2038] + 1.0913, !- Year 15 Escalation [2039] + 1.0986, !- Year 16 Escalation [2040] + 1.1086, !- Year 17 Escalation [2041] + 1.1169, !- Year 18 Escalation [2042] + 1.1225, !- Year 19 Escalation [2043] + 1.1226, !- Year 20 Escalation [2044] + 1.1240, !- Year 21 Escalation [2045] + 1.1221, !- Year 22 Escalation [2046] + 1.1203, !- Year 23 Escalation [2047] + 1.1188, !- Year 24 Escalation [2048] + 1.1074, !- Year 25 Escalation [2049] + 1.0977, !- Year 26 Escalation [2050] + 1.0916, !- Year 27 Escalation [2051] + 1.0857, !- Year 28 Escalation [2052] + 1.0797, !- Year 29 Escalation [2053] + 1.0738; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + MidAtlantic Residential-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9502, !- Year 1 Escalation [2025] + 0.9366, !- Year 2 Escalation [2026] + 0.9234, !- Year 3 Escalation [2027] + 0.9157, !- Year 4 Escalation [2028] + 0.9187, !- Year 5 Escalation [2029] + 0.9191, !- Year 6 Escalation [2030] + 0.9247, !- Year 7 Escalation [2031] + 0.9276, !- Year 8 Escalation [2032] + 0.9316, !- Year 9 Escalation [2033] + 0.9330, !- Year 10 Escalation [2034] + 0.9389, !- Year 11 Escalation [2035] + 0.9393, !- Year 12 Escalation [2036] + 0.9434, !- Year 13 Escalation [2037] + 0.9463, !- Year 14 Escalation [2038] + 0.9478, !- Year 15 Escalation [2039] + 0.9493, !- Year 16 Escalation [2040] + 0.9543, !- Year 17 Escalation [2041] + 0.9542, !- Year 18 Escalation [2042] + 0.9578, !- Year 19 Escalation [2043] + 0.9551, !- Year 20 Escalation [2044] + 0.9563, !- Year 21 Escalation [2045] + 0.9628, !- Year 22 Escalation [2046] + 0.9639, !- Year 23 Escalation [2047] + 0.9651, !- Year 24 Escalation [2048] + 0.9673, !- Year 25 Escalation [2049] + 0.9675, !- Year 26 Escalation [2050] + 0.9687, !- Year 27 Escalation [2051] + 0.9699, !- Year 28 Escalation [2052] + 0.9711, !- Year 29 Escalation [2053] + 0.9723; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + MidAtlantic Residential-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9484, !- Year 1 Escalation [2025] + 0.9059, !- Year 2 Escalation [2026] + 0.8749, !- Year 3 Escalation [2027] + 0.8552, !- Year 4 Escalation [2028] + 0.8615, !- Year 5 Escalation [2029] + 0.8523, !- Year 6 Escalation [2030] + 0.8529, !- Year 7 Escalation [2031] + 0.8535, !- Year 8 Escalation [2032] + 0.8598, !- Year 9 Escalation [2033] + 0.8603, !- Year 10 Escalation [2034] + 0.8608, !- Year 11 Escalation [2035] + 0.8614, !- Year 12 Escalation [2036] + 0.8670, !- Year 13 Escalation [2037] + 0.8798, !- Year 14 Escalation [2038] + 0.8807, !- Year 15 Escalation [2039] + 0.8844, !- Year 16 Escalation [2040] + 0.8917, !- Year 17 Escalation [2041] + 0.8918, !- Year 18 Escalation [2042] + 0.8891, !- Year 19 Escalation [2043] + 0.8796, !- Year 20 Escalation [2044] + 0.8901, !- Year 21 Escalation [2045] + 0.8853, !- Year 22 Escalation [2046] + 0.8759, !- Year 23 Escalation [2047] + 0.8664, !- Year 24 Escalation [2048] + 0.8667, !- Year 25 Escalation [2049] + 0.8752, !- Year 26 Escalation [2050] + 0.8727, !- Year 27 Escalation [2051] + 0.8702, !- Year 28 Escalation [2052] + 0.8677, !- Year 29 Escalation [2053] + 0.8653; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + MidAtlantic Residential-LPG, !- Name + Propane, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9659, !- Year 1 Escalation [2025] + 0.9309, !- Year 2 Escalation [2026] + 0.9027, !- Year 3 Escalation [2027] + 0.8865, !- Year 4 Escalation [2028] + 0.8804, !- Year 5 Escalation [2029] + 0.8832, !- Year 6 Escalation [2030] + 0.8924, !- Year 7 Escalation [2031] + 0.9071, !- Year 8 Escalation [2032] + 0.9259, !- Year 9 Escalation [2033] + 0.9446, !- Year 10 Escalation [2034] + 0.9596, !- Year 11 Escalation [2035] + 0.9709, !- Year 12 Escalation [2036] + 0.9809, !- Year 13 Escalation [2037] + 0.9939, !- Year 14 Escalation [2038] + 1.0002, !- Year 15 Escalation [2039] + 1.0104, !- Year 16 Escalation [2040] + 1.0204, !- Year 17 Escalation [2041] + 1.0276, !- Year 18 Escalation [2042] + 1.0312, !- Year 19 Escalation [2043] + 1.0321, !- Year 20 Escalation [2044] + 1.0340, !- Year 21 Escalation [2045] + 1.0347, !- Year 22 Escalation [2046] + 1.0359, !- Year 23 Escalation [2047] + 1.0385, !- Year 24 Escalation [2048] + 1.0392, !- Year 25 Escalation [2049] + 1.0387, !- Year 26 Escalation [2050] + 1.0397, !- Year 27 Escalation [2051] + 1.0407, !- Year 28 Escalation [2052] + 1.0417, !- Year 29 Escalation [2053] + 1.0427; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + MidAtlantic Industrial-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9579, !- Year 1 Escalation [2025] + 0.9182, !- Year 2 Escalation [2026] + 0.8971, !- Year 3 Escalation [2027] + 0.8781, !- Year 4 Escalation [2028] + 0.8679, !- Year 5 Escalation [2029] + 0.8596, !- Year 6 Escalation [2030] + 0.8580, !- Year 7 Escalation [2031] + 0.8652, !- Year 8 Escalation [2032] + 0.8704, !- Year 9 Escalation [2033] + 0.8734, !- Year 10 Escalation [2034] + 0.8653, !- Year 11 Escalation [2035] + 0.8711, !- Year 12 Escalation [2036] + 0.8712, !- Year 13 Escalation [2037] + 0.8824, !- Year 14 Escalation [2038] + 0.8974, !- Year 15 Escalation [2039] + 0.8997, !- Year 16 Escalation [2040] + 0.9061, !- Year 17 Escalation [2041] + 0.9056, !- Year 18 Escalation [2042] + 0.9024, !- Year 19 Escalation [2043] + 0.8964, !- Year 20 Escalation [2044] + 0.8918, !- Year 21 Escalation [2045] + 0.8831, !- Year 22 Escalation [2046] + 0.8745, !- Year 23 Escalation [2047] + 0.8696, !- Year 24 Escalation [2048] + 0.8545, !- Year 25 Escalation [2049] + 0.8422, !- Year 26 Escalation [2050] + 0.8323, !- Year 27 Escalation [2051] + 0.8225, !- Year 28 Escalation [2052] + 0.8128, !- Year 29 Escalation [2053] + 0.8032; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + MidAtlantic Industrial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9099, !- Year 1 Escalation [2025] + 0.8572, !- Year 2 Escalation [2026] + 0.8052, !- Year 3 Escalation [2027] + 0.7581, !- Year 4 Escalation [2028] + 0.7609, !- Year 5 Escalation [2029] + 0.7614, !- Year 6 Escalation [2030] + 0.7672, !- Year 7 Escalation [2031] + 0.7701, !- Year 8 Escalation [2032] + 0.7739, !- Year 9 Escalation [2033] + 0.7757, !- Year 10 Escalation [2034] + 0.7811, !- Year 11 Escalation [2035] + 0.7820, !- Year 12 Escalation [2036] + 0.7860, !- Year 13 Escalation [2037] + 0.7890, !- Year 14 Escalation [2038] + 0.7906, !- Year 15 Escalation [2039] + 0.7923, !- Year 16 Escalation [2040] + 0.7975, !- Year 17 Escalation [2041] + 0.7976, !- Year 18 Escalation [2042] + 0.8014, !- Year 19 Escalation [2043] + 0.7986, !- Year 20 Escalation [2044] + 0.8005, !- Year 21 Escalation [2045] + 0.8073, !- Year 22 Escalation [2046] + 0.8083, !- Year 23 Escalation [2047] + 0.8095, !- Year 24 Escalation [2048] + 0.8119, !- Year 25 Escalation [2049] + 0.8122, !- Year 26 Escalation [2050] + 0.8134, !- Year 27 Escalation [2051] + 0.8147, !- Year 28 Escalation [2052] + 0.8159, !- Year 29 Escalation [2053] + 0.8171; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + MidAtlantic Industrial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0273, !- Year 1 Escalation [2025] + 1.1866, !- Year 2 Escalation [2026] + 1.3475, !- Year 3 Escalation [2027] + 1.5049, !- Year 4 Escalation [2028] + 1.5154, !- Year 5 Escalation [2029] + 1.5257, !- Year 6 Escalation [2030] + 1.5386, !- Year 7 Escalation [2031] + 1.5504, !- Year 8 Escalation [2032] + 1.5612, !- Year 9 Escalation [2033] + 1.5730, !- Year 10 Escalation [2034] + 1.5860, !- Year 11 Escalation [2035] + 1.5963, !- Year 12 Escalation [2036] + 1.6077, !- Year 13 Escalation [2037] + 1.6197, !- Year 14 Escalation [2038] + 1.6272, !- Year 15 Escalation [2039] + 1.6368, !- Year 16 Escalation [2040] + 1.6512, !- Year 17 Escalation [2041] + 1.6530, !- Year 18 Escalation [2042] + 1.6609, !- Year 19 Escalation [2043] + 1.6664, !- Year 20 Escalation [2044] + 1.6730, !- Year 21 Escalation [2045] + 1.6910, !- Year 22 Escalation [2046] + 1.6911, !- Year 23 Escalation [2047] + 1.7049, !- Year 24 Escalation [2048] + 1.7153, !- Year 25 Escalation [2049] + 1.7232, !- Year 26 Escalation [2050] + 1.7313, !- Year 27 Escalation [2051] + 1.7395, !- Year 28 Escalation [2052] + 1.7477, !- Year 29 Escalation [2053] + 1.7560; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + MidAtlantic Industrial-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9031, !- Year 1 Escalation [2025] + 0.8283, !- Year 2 Escalation [2026] + 0.7806, !- Year 3 Escalation [2027] + 0.7535, !- Year 4 Escalation [2028] + 0.7507, !- Year 5 Escalation [2029] + 0.7419, !- Year 6 Escalation [2030] + 0.7448, !- Year 7 Escalation [2031] + 0.7511, !- Year 8 Escalation [2032] + 0.7636, !- Year 9 Escalation [2033] + 0.7717, !- Year 10 Escalation [2034] + 0.7800, !- Year 11 Escalation [2035] + 0.7862, !- Year 12 Escalation [2036] + 0.7974, !- Year 13 Escalation [2037] + 0.8150, !- Year 14 Escalation [2038] + 0.8194, !- Year 15 Escalation [2039] + 0.8265, !- Year 16 Escalation [2040] + 0.8349, !- Year 17 Escalation [2041] + 0.8310, !- Year 18 Escalation [2042] + 0.8241, !- Year 19 Escalation [2043] + 0.8143, !- Year 20 Escalation [2044] + 0.8187, !- Year 21 Escalation [2045] + 0.8120, !- Year 22 Escalation [2046] + 0.8008, !- Year 23 Escalation [2047] + 0.7892, !- Year 24 Escalation [2048] + 0.7862, !- Year 25 Escalation [2049] + 0.7905, !- Year 26 Escalation [2050] + 0.7853, !- Year 27 Escalation [2051] + 0.7801, !- Year 28 Escalation [2052] + 0.7749, !- Year 29 Escalation [2053] + 0.7697; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + MidAtlantic Industrial-Coal, !- Name + Coal, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0324, !- Year 1 Escalation [2025] + 1.0438, !- Year 2 Escalation [2026] + 1.0391, !- Year 3 Escalation [2027] + 1.0324, !- Year 4 Escalation [2028] + 1.0284, !- Year 5 Escalation [2029] + 1.0248, !- Year 6 Escalation [2030] + 1.0212, !- Year 7 Escalation [2031] + 1.0179, !- Year 8 Escalation [2032] + 1.0169, !- Year 9 Escalation [2033] + 1.0184, !- Year 10 Escalation [2034] + 1.0197, !- Year 11 Escalation [2035] + 1.0217, !- Year 12 Escalation [2036] + 1.0243, !- Year 13 Escalation [2037] + 1.0275, !- Year 14 Escalation [2038] + 1.0297, !- Year 15 Escalation [2039] + 1.0293, !- Year 16 Escalation [2040] + 1.0294, !- Year 17 Escalation [2041] + 1.0291, !- Year 18 Escalation [2042] + 1.0305, !- Year 19 Escalation [2043] + 1.0318, !- Year 20 Escalation [2044] + 1.0332, !- Year 21 Escalation [2045] + 1.0334, !- Year 22 Escalation [2046] + 1.0335, !- Year 23 Escalation [2047] + 1.0337, !- Year 24 Escalation [2048] + 1.0345, !- Year 25 Escalation [2049] + 1.0347, !- Year 26 Escalation [2050] + 1.0350, !- Year 27 Escalation [2051] + 1.0353, !- Year 28 Escalation [2052] + 1.0356, !- Year 29 Escalation [2053] + 1.0359; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + EastNorthCentral Residential-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9672, !- Year 1 Escalation [2025] + 0.9510, !- Year 2 Escalation [2026] + 0.9295, !- Year 3 Escalation [2027] + 0.9180, !- Year 4 Escalation [2028] + 0.9128, !- Year 5 Escalation [2029] + 0.9103, !- Year 6 Escalation [2030] + 0.9098, !- Year 7 Escalation [2031] + 0.9118, !- Year 8 Escalation [2032] + 0.9142, !- Year 9 Escalation [2033] + 0.9199, !- Year 10 Escalation [2034] + 0.9173, !- Year 11 Escalation [2035] + 0.9174, !- Year 12 Escalation [2036] + 0.9205, !- Year 13 Escalation [2037] + 0.9254, !- Year 14 Escalation [2038] + 0.9315, !- Year 15 Escalation [2039] + 0.9401, !- Year 16 Escalation [2040] + 0.9470, !- Year 17 Escalation [2041] + 0.9493, !- Year 18 Escalation [2042] + 0.9492, !- Year 19 Escalation [2043] + 0.9498, !- Year 20 Escalation [2044] + 0.9516, !- Year 21 Escalation [2045] + 0.9480, !- Year 22 Escalation [2046] + 0.9405, !- Year 23 Escalation [2047] + 0.9400, !- Year 24 Escalation [2048] + 0.9352, !- Year 25 Escalation [2049] + 0.9267, !- Year 26 Escalation [2050] + 0.9214, !- Year 27 Escalation [2051] + 0.9162, !- Year 28 Escalation [2052] + 0.9110, !- Year 29 Escalation [2053] + 0.9059; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + EastNorthCentral Residential-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9218, !- Year 1 Escalation [2025] + 0.8944, !- Year 2 Escalation [2026] + 0.8687, !- Year 3 Escalation [2027] + 0.8467, !- Year 4 Escalation [2028] + 0.8510, !- Year 5 Escalation [2029] + 0.8502, !- Year 6 Escalation [2030] + 0.8580, !- Year 7 Escalation [2031] + 0.8612, !- Year 8 Escalation [2032] + 0.8644, !- Year 9 Escalation [2033] + 0.8687, !- Year 10 Escalation [2034] + 0.8722, !- Year 11 Escalation [2035] + 0.8759, !- Year 12 Escalation [2036] + 0.8802, !- Year 13 Escalation [2037] + 0.8840, !- Year 14 Escalation [2038] + 0.8864, !- Year 15 Escalation [2039] + 0.8893, !- Year 16 Escalation [2040] + 0.8967, !- Year 17 Escalation [2041] + 0.8975, !- Year 18 Escalation [2042] + 0.9029, !- Year 19 Escalation [2043] + 0.8994, !- Year 20 Escalation [2044] + 0.9045, !- Year 21 Escalation [2045] + 0.9145, !- Year 22 Escalation [2046] + 0.9152, !- Year 23 Escalation [2047] + 0.9172, !- Year 24 Escalation [2048] + 0.9206, !- Year 25 Escalation [2049] + 0.9211, !- Year 26 Escalation [2050] + 0.9228, !- Year 27 Escalation [2051] + 0.9244, !- Year 28 Escalation [2052] + 0.9261, !- Year 29 Escalation [2053] + 0.9277; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + EastNorthCentral Residential-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9333, !- Year 1 Escalation [2025] + 0.8804, !- Year 2 Escalation [2026] + 0.8500, !- Year 3 Escalation [2027] + 0.8357, !- Year 4 Escalation [2028] + 0.8410, !- Year 5 Escalation [2029] + 0.8491, !- Year 6 Escalation [2030] + 0.8609, !- Year 7 Escalation [2031] + 0.8695, !- Year 8 Escalation [2032] + 0.8828, !- Year 9 Escalation [2033] + 0.8954, !- Year 10 Escalation [2034] + 0.9066, !- Year 11 Escalation [2035] + 0.9119, !- Year 12 Escalation [2036] + 0.9202, !- Year 13 Escalation [2037] + 0.9321, !- Year 14 Escalation [2038] + 0.9333, !- Year 15 Escalation [2039] + 0.9418, !- Year 16 Escalation [2040] + 0.9504, !- Year 17 Escalation [2041] + 0.9513, !- Year 18 Escalation [2042] + 0.9489, !- Year 19 Escalation [2043] + 0.9454, !- Year 20 Escalation [2044] + 0.9456, !- Year 21 Escalation [2045] + 0.9446, !- Year 22 Escalation [2046] + 0.9425, !- Year 23 Escalation [2047] + 0.9394, !- Year 24 Escalation [2048] + 0.9380, !- Year 25 Escalation [2049] + 0.9380, !- Year 26 Escalation [2050] + 0.9364, !- Year 27 Escalation [2051] + 0.9347, !- Year 28 Escalation [2052] + 0.9331, !- Year 29 Escalation [2053] + 0.9315; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + EastNorthCentral Residential-LPG, !- Name + Propane, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9659, !- Year 1 Escalation [2025] + 0.9309, !- Year 2 Escalation [2026] + 0.9026, !- Year 3 Escalation [2027] + 0.8865, !- Year 4 Escalation [2028] + 0.8803, !- Year 5 Escalation [2029] + 0.8831, !- Year 6 Escalation [2030] + 0.8923, !- Year 7 Escalation [2031] + 0.9070, !- Year 8 Escalation [2032] + 0.9257, !- Year 9 Escalation [2033] + 0.9444, !- Year 10 Escalation [2034] + 0.9594, !- Year 11 Escalation [2035] + 0.9707, !- Year 12 Escalation [2036] + 0.9807, !- Year 13 Escalation [2037] + 0.9936, !- Year 14 Escalation [2038] + 0.9999, !- Year 15 Escalation [2039] + 1.0101, !- Year 16 Escalation [2040] + 1.0201, !- Year 17 Escalation [2041] + 1.0272, !- Year 18 Escalation [2042] + 1.0309, !- Year 19 Escalation [2043] + 1.0317, !- Year 20 Escalation [2044] + 1.0336, !- Year 21 Escalation [2045] + 1.0343, !- Year 22 Escalation [2046] + 1.0354, !- Year 23 Escalation [2047] + 1.0379, !- Year 24 Escalation [2048] + 1.0387, !- Year 25 Escalation [2049] + 1.0381, !- Year 26 Escalation [2050] + 1.0390, !- Year 27 Escalation [2051] + 1.0400, !- Year 28 Escalation [2052] + 1.0410, !- Year 29 Escalation [2053] + 1.0419; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + EastNorthCentral Commercial-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9590, !- Year 1 Escalation [2025] + 0.9385, !- Year 2 Escalation [2026] + 0.9110, !- Year 3 Escalation [2027] + 0.8963, !- Year 4 Escalation [2028] + 0.8890, !- Year 5 Escalation [2029] + 0.8832, !- Year 6 Escalation [2030] + 0.8792, !- Year 7 Escalation [2031] + 0.8778, !- Year 8 Escalation [2032] + 0.8777, !- Year 9 Escalation [2033] + 0.8847, !- Year 10 Escalation [2034] + 0.8795, !- Year 11 Escalation [2035] + 0.8794, !- Year 12 Escalation [2036] + 0.8812, !- Year 13 Escalation [2037] + 0.8840, !- Year 14 Escalation [2038] + 0.8915, !- Year 15 Escalation [2039] + 0.8974, !- Year 16 Escalation [2040] + 0.9023, !- Year 17 Escalation [2041] + 0.9029, !- Year 18 Escalation [2042] + 0.9003, !- Year 19 Escalation [2043] + 0.8989, !- Year 20 Escalation [2044] + 0.8990, !- Year 21 Escalation [2045] + 0.8942, !- Year 22 Escalation [2046] + 0.8833, !- Year 23 Escalation [2047] + 0.8840, !- Year 24 Escalation [2048] + 0.8788, !- Year 25 Escalation [2049] + 0.8694, !- Year 26 Escalation [2050] + 0.8633, !- Year 27 Escalation [2051] + 0.8573, !- Year 28 Escalation [2052] + 0.8513, !- Year 29 Escalation [2053] + 0.8454; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + EastNorthCentral Commercial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.8997, !- Year 1 Escalation [2025] + 0.8427, !- Year 2 Escalation [2026] + 0.7872, !- Year 3 Escalation [2027] + 0.7375, !- Year 4 Escalation [2028] + 0.7411, !- Year 5 Escalation [2029] + 0.7402, !- Year 6 Escalation [2030] + 0.7469, !- Year 7 Escalation [2031] + 0.7501, !- Year 8 Escalation [2032] + 0.7546, !- Year 9 Escalation [2033] + 0.7567, !- Year 10 Escalation [2034] + 0.7625, !- Year 11 Escalation [2035] + 0.7639, !- Year 12 Escalation [2036] + 0.7685, !- Year 13 Escalation [2037] + 0.7718, !- Year 14 Escalation [2038] + 0.7736, !- Year 15 Escalation [2039] + 0.7757, !- Year 16 Escalation [2040] + 0.7819, !- Year 17 Escalation [2041] + 0.7820, !- Year 18 Escalation [2042] + 0.7865, !- Year 19 Escalation [2043] + 0.7833, !- Year 20 Escalation [2044] + 0.7858, !- Year 21 Escalation [2045] + 0.7942, !- Year 22 Escalation [2046] + 0.7950, !- Year 23 Escalation [2047] + 0.7967, !- Year 24 Escalation [2048] + 0.7995, !- Year 25 Escalation [2049] + 0.7996, !- Year 26 Escalation [2050] + 0.8010, !- Year 27 Escalation [2051] + 0.8023, !- Year 28 Escalation [2052] + 0.8037, !- Year 29 Escalation [2053] + 0.8050; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + EastNorthCentral Commercial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0353, !- Year 1 Escalation [2025] + 1.1424, !- Year 2 Escalation [2026] + 1.2954, !- Year 3 Escalation [2027] + 1.4406, !- Year 4 Escalation [2028] + 1.4438, !- Year 5 Escalation [2029] + 1.4532, !- Year 6 Escalation [2030] + 1.4652, !- Year 7 Escalation [2031] + 1.4761, !- Year 8 Escalation [2032] + 1.4861, !- Year 9 Escalation [2033] + 1.4970, !- Year 10 Escalation [2034] + 1.5090, !- Year 11 Escalation [2035] + 1.5186, !- Year 12 Escalation [2036] + 1.5280, !- Year 13 Escalation [2037] + 1.5390, !- Year 14 Escalation [2038] + 1.5471, !- Year 15 Escalation [2039] + 1.5561, !- Year 16 Escalation [2040] + 1.5693, !- Year 17 Escalation [2041] + 1.5708, !- Year 18 Escalation [2042] + 1.5778, !- Year 19 Escalation [2043] + 1.5746, !- Year 20 Escalation [2044] + 1.5802, !- Year 21 Escalation [2045] + 1.5967, !- Year 22 Escalation [2046] + 1.5968, !- Year 23 Escalation [2047] + 1.6096, !- Year 24 Escalation [2048] + 1.6192, !- Year 25 Escalation [2049] + 1.6265, !- Year 26 Escalation [2050] + 1.6340, !- Year 27 Escalation [2051] + 1.6415, !- Year 28 Escalation [2052] + 1.6491, !- Year 29 Escalation [2053] + 1.6568; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + EastNorthCentral Commercial-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9261, !- Year 1 Escalation [2025] + 0.8679, !- Year 2 Escalation [2026] + 0.8341, !- Year 3 Escalation [2027] + 0.8182, !- Year 4 Escalation [2028] + 0.8228, !- Year 5 Escalation [2029] + 0.8302, !- Year 6 Escalation [2030] + 0.8413, !- Year 7 Escalation [2031] + 0.8486, !- Year 8 Escalation [2032] + 0.8633, !- Year 9 Escalation [2033] + 0.8765, !- Year 10 Escalation [2034] + 0.8879, !- Year 11 Escalation [2035] + 0.8924, !- Year 12 Escalation [2036] + 0.9008, !- Year 13 Escalation [2037] + 0.9134, !- Year 14 Escalation [2038] + 0.9133, !- Year 15 Escalation [2039] + 0.9225, !- Year 16 Escalation [2040] + 0.9318, !- Year 17 Escalation [2041] + 0.9318, !- Year 18 Escalation [2042] + 0.9281, !- Year 19 Escalation [2043] + 0.9236, !- Year 20 Escalation [2044] + 0.9236, !- Year 21 Escalation [2045] + 0.9220, !- Year 22 Escalation [2046] + 0.9192, !- Year 23 Escalation [2047] + 0.9153, !- Year 24 Escalation [2048] + 0.9134, !- Year 25 Escalation [2049] + 0.9131, !- Year 26 Escalation [2050] + 0.9109, !- Year 27 Escalation [2051] + 0.9087, !- Year 28 Escalation [2052] + 0.9065, !- Year 29 Escalation [2053] + 0.9043; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + EastNorthCentral Industrial-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9430, !- Year 1 Escalation [2025] + 0.9035, !- Year 2 Escalation [2026] + 0.8701, !- Year 3 Escalation [2027] + 0.8490, !- Year 4 Escalation [2028] + 0.8368, !- Year 5 Escalation [2029] + 0.8279, !- Year 6 Escalation [2030] + 0.8234, !- Year 7 Escalation [2031] + 0.8203, !- Year 8 Escalation [2032] + 0.8227, !- Year 9 Escalation [2033] + 0.8215, !- Year 10 Escalation [2034] + 0.8165, !- Year 11 Escalation [2035] + 0.8150, !- Year 12 Escalation [2036] + 0.8189, !- Year 13 Escalation [2037] + 0.8255, !- Year 14 Escalation [2038] + 0.8344, !- Year 15 Escalation [2039] + 0.8419, !- Year 16 Escalation [2040] + 0.8488, !- Year 17 Escalation [2041] + 0.8490, !- Year 18 Escalation [2042] + 0.8474, !- Year 19 Escalation [2043] + 0.8483, !- Year 20 Escalation [2044] + 0.8470, !- Year 21 Escalation [2045] + 0.8399, !- Year 22 Escalation [2046] + 0.8319, !- Year 23 Escalation [2047] + 0.8300, !- Year 24 Escalation [2048] + 0.8238, !- Year 25 Escalation [2049] + 0.8156, !- Year 26 Escalation [2050] + 0.8096, !- Year 27 Escalation [2051] + 0.8037, !- Year 28 Escalation [2052] + 0.7978, !- Year 29 Escalation [2053] + 0.7920; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + EastNorthCentral Industrial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.8978, !- Year 1 Escalation [2025] + 0.8383, !- Year 2 Escalation [2026] + 0.7802, !- Year 3 Escalation [2027] + 0.7281, !- Year 4 Escalation [2028] + 0.7317, !- Year 5 Escalation [2029] + 0.7308, !- Year 6 Escalation [2030] + 0.7374, !- Year 7 Escalation [2031] + 0.7406, !- Year 8 Escalation [2032] + 0.7453, !- Year 9 Escalation [2033] + 0.7472, !- Year 10 Escalation [2034] + 0.7533, !- Year 11 Escalation [2035] + 0.7544, !- Year 12 Escalation [2036] + 0.7591, !- Year 13 Escalation [2037] + 0.7623, !- Year 14 Escalation [2038] + 0.7641, !- Year 15 Escalation [2039] + 0.7661, !- Year 16 Escalation [2040] + 0.7721, !- Year 17 Escalation [2041] + 0.7722, !- Year 18 Escalation [2042] + 0.7766, !- Year 19 Escalation [2043] + 0.7734, !- Year 20 Escalation [2044] + 0.7755, !- Year 21 Escalation [2045] + 0.7839, !- Year 22 Escalation [2046] + 0.7846, !- Year 23 Escalation [2047] + 0.7862, !- Year 24 Escalation [2048] + 0.7890, !- Year 25 Escalation [2049] + 0.7891, !- Year 26 Escalation [2050] + 0.7904, !- Year 27 Escalation [2051] + 0.7917, !- Year 28 Escalation [2052] + 0.7930, !- Year 29 Escalation [2053] + 0.7944; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + EastNorthCentral Industrial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0375, !- Year 1 Escalation [2025] + 1.1473, !- Year 2 Escalation [2026] + 1.3033, !- Year 3 Escalation [2027] + 1.4515, !- Year 4 Escalation [2028] + 1.4547, !- Year 5 Escalation [2029] + 1.4642, !- Year 6 Escalation [2030] + 1.4762, !- Year 7 Escalation [2031] + 1.4872, !- Year 8 Escalation [2032] + 1.4972, !- Year 9 Escalation [2033] + 1.5083, !- Year 10 Escalation [2034] + 1.5204, !- Year 11 Escalation [2035] + 1.5300, !- Year 12 Escalation [2036] + 1.5395, !- Year 13 Escalation [2037] + 1.5506, !- Year 14 Escalation [2038] + 1.5588, !- Year 15 Escalation [2039] + 1.5678, !- Year 16 Escalation [2040] + 1.5811, !- Year 17 Escalation [2041] + 1.5826, !- Year 18 Escalation [2042] + 1.5897, !- Year 19 Escalation [2043] + 1.5865, !- Year 20 Escalation [2044] + 1.5921, !- Year 21 Escalation [2045] + 1.6087, !- Year 22 Escalation [2046] + 1.6088, !- Year 23 Escalation [2047] + 1.6217, !- Year 24 Escalation [2048] + 1.6314, !- Year 25 Escalation [2049] + 1.6387, !- Year 26 Escalation [2050] + 1.6463, !- Year 27 Escalation [2051] + 1.6539, !- Year 28 Escalation [2052] + 1.6616, !- Year 29 Escalation [2053] + 1.6693; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + EastNorthCentral Industrial-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.8971, !- Year 1 Escalation [2025] + 0.8189, !- Year 2 Escalation [2026] + 0.7759, !- Year 3 Escalation [2027] + 0.7598, !- Year 4 Escalation [2028] + 0.7602, !- Year 5 Escalation [2029] + 0.7676, !- Year 6 Escalation [2030] + 0.7793, !- Year 7 Escalation [2031] + 0.7882, !- Year 8 Escalation [2032] + 0.8061, !- Year 9 Escalation [2033] + 0.8214, !- Year 10 Escalation [2034] + 0.8356, !- Year 11 Escalation [2035] + 0.8386, !- Year 12 Escalation [2036] + 0.8469, !- Year 13 Escalation [2037] + 0.8650, !- Year 14 Escalation [2038] + 0.8602, !- Year 15 Escalation [2039] + 0.8763, !- Year 16 Escalation [2040] + 0.8872, !- Year 17 Escalation [2041] + 0.8837, !- Year 18 Escalation [2042] + 0.8743, !- Year 19 Escalation [2043] + 0.8655, !- Year 20 Escalation [2044] + 0.8612, !- Year 21 Escalation [2045] + 0.8557, !- Year 22 Escalation [2046] + 0.8485, !- Year 23 Escalation [2047] + 0.8402, !- Year 24 Escalation [2048] + 0.8321, !- Year 25 Escalation [2049] + 0.8285, !- Year 26 Escalation [2050] + 0.8218, !- Year 27 Escalation [2051] + 0.8152, !- Year 28 Escalation [2052] + 0.8086, !- Year 29 Escalation [2053] + 0.8021; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + EastNorthCentral Industrial-Coal, !- Name + Coal, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0330, !- Year 1 Escalation [2025] + 1.0292, !- Year 2 Escalation [2026] + 1.0191, !- Year 3 Escalation [2027] + 1.0124, !- Year 4 Escalation [2028] + 1.0101, !- Year 5 Escalation [2029] + 1.0094, !- Year 6 Escalation [2030] + 1.0087, !- Year 7 Escalation [2031] + 1.0075, !- Year 8 Escalation [2032] + 1.0069, !- Year 9 Escalation [2033] + 1.0078, !- Year 10 Escalation [2034] + 1.0084, !- Year 11 Escalation [2035] + 1.0116, !- Year 12 Escalation [2036] + 1.0192, !- Year 13 Escalation [2037] + 1.0310, !- Year 14 Escalation [2038] + 1.0398, !- Year 15 Escalation [2039] + 1.0448, !- Year 16 Escalation [2040] + 1.0490, !- Year 17 Escalation [2041] + 1.0520, !- Year 18 Escalation [2042] + 1.0555, !- Year 19 Escalation [2043] + 1.0584, !- Year 20 Escalation [2044] + 1.0609, !- Year 21 Escalation [2045] + 1.0622, !- Year 22 Escalation [2046] + 1.0631, !- Year 23 Escalation [2047] + 1.0640, !- Year 24 Escalation [2048] + 1.0570, !- Year 25 Escalation [2049] + 1.0565, !- Year 26 Escalation [2050] + 1.0551, !- Year 27 Escalation [2051] + 1.0536, !- Year 28 Escalation [2052] + 1.0522, !- Year 29 Escalation [2053] + 1.0508; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + WestNorthCentral Residential-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9936, !- Year 1 Escalation [2025] + 0.9801, !- Year 2 Escalation [2026] + 0.9690, !- Year 3 Escalation [2027] + 0.9685, !- Year 4 Escalation [2028] + 0.9679, !- Year 5 Escalation [2029] + 0.9658, !- Year 6 Escalation [2030] + 0.9660, !- Year 7 Escalation [2031] + 0.9658, !- Year 8 Escalation [2032] + 0.9675, !- Year 9 Escalation [2033] + 0.9659, !- Year 10 Escalation [2034] + 0.9602, !- Year 11 Escalation [2035] + 0.9552, !- Year 12 Escalation [2036] + 0.9581, !- Year 13 Escalation [2037] + 0.9629, !- Year 14 Escalation [2038] + 0.9781, !- Year 15 Escalation [2039] + 0.9962, !- Year 16 Escalation [2040] + 1.0025, !- Year 17 Escalation [2041] + 0.9993, !- Year 18 Escalation [2042] + 0.9931, !- Year 19 Escalation [2043] + 0.9898, !- Year 20 Escalation [2044] + 0.9884, !- Year 21 Escalation [2045] + 0.9838, !- Year 22 Escalation [2046] + 0.9776, !- Year 23 Escalation [2047] + 0.9704, !- Year 24 Escalation [2048] + 0.9618, !- Year 25 Escalation [2049] + 0.9527, !- Year 26 Escalation [2050] + 0.9451, !- Year 27 Escalation [2051] + 0.9376, !- Year 28 Escalation [2052] + 0.9301, !- Year 29 Escalation [2053] + 0.9226; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + WestNorthCentral Residential-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9217, !- Year 1 Escalation [2025] + 0.8940, !- Year 2 Escalation [2026] + 0.8679, !- Year 3 Escalation [2027] + 0.8456, !- Year 4 Escalation [2028] + 0.8499, !- Year 5 Escalation [2029] + 0.8491, !- Year 6 Escalation [2030] + 0.8569, !- Year 7 Escalation [2031] + 0.8601, !- Year 8 Escalation [2032] + 0.8632, !- Year 9 Escalation [2033] + 0.8675, !- Year 10 Escalation [2034] + 0.8710, !- Year 11 Escalation [2035] + 0.8747, !- Year 12 Escalation [2036] + 0.8790, !- Year 13 Escalation [2037] + 0.8828, !- Year 14 Escalation [2038] + 0.8851, !- Year 15 Escalation [2039] + 0.8880, !- Year 16 Escalation [2040] + 0.8954, !- Year 17 Escalation [2041] + 0.8962, !- Year 18 Escalation [2042] + 0.9016, !- Year 19 Escalation [2043] + 0.8981, !- Year 20 Escalation [2044] + 0.9032, !- Year 21 Escalation [2045] + 0.9132, !- Year 22 Escalation [2046] + 0.9139, !- Year 23 Escalation [2047] + 0.9159, !- Year 24 Escalation [2048] + 0.9192, !- Year 25 Escalation [2049] + 0.9197, !- Year 26 Escalation [2050] + 0.9214, !- Year 27 Escalation [2051] + 0.9230, !- Year 28 Escalation [2052] + 0.9246, !- Year 29 Escalation [2053] + 0.9263; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + WestNorthCentral Residential-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9475, !- Year 1 Escalation [2025] + 0.9058, !- Year 2 Escalation [2026] + 0.8838, !- Year 3 Escalation [2027] + 0.8770, !- Year 4 Escalation [2028] + 0.8817, !- Year 5 Escalation [2029] + 0.8896, !- Year 6 Escalation [2030] + 0.9017, !- Year 7 Escalation [2031] + 0.9119, !- Year 8 Escalation [2032] + 0.9280, !- Year 9 Escalation [2033] + 0.9415, !- Year 10 Escalation [2034] + 0.9525, !- Year 11 Escalation [2035] + 0.9559, !- Year 12 Escalation [2036] + 0.9624, !- Year 13 Escalation [2037] + 0.9726, !- Year 14 Escalation [2038] + 0.9701, !- Year 15 Escalation [2039] + 0.9777, !- Year 16 Escalation [2040] + 0.9856, !- Year 17 Escalation [2041] + 0.9857, !- Year 18 Escalation [2042] + 0.9817, !- Year 19 Escalation [2043] + 0.9760, !- Year 20 Escalation [2044] + 0.9743, !- Year 21 Escalation [2045] + 0.9714, !- Year 22 Escalation [2046] + 0.9676, !- Year 23 Escalation [2047] + 0.9631, !- Year 24 Escalation [2048] + 0.9602, !- Year 25 Escalation [2049] + 0.9586, !- Year 26 Escalation [2050] + 0.9554, !- Year 27 Escalation [2051] + 0.9522, !- Year 28 Escalation [2052] + 0.9491, !- Year 29 Escalation [2053] + 0.9459; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + WestNorthCentral Residential-LPG, !- Name + Propane, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9659, !- Year 1 Escalation [2025] + 0.9309, !- Year 2 Escalation [2026] + 0.9026, !- Year 3 Escalation [2027] + 0.8865, !- Year 4 Escalation [2028] + 0.8803, !- Year 5 Escalation [2029] + 0.8831, !- Year 6 Escalation [2030] + 0.8923, !- Year 7 Escalation [2031] + 0.9070, !- Year 8 Escalation [2032] + 0.9257, !- Year 9 Escalation [2033] + 0.9444, !- Year 10 Escalation [2034] + 0.9594, !- Year 11 Escalation [2035] + 0.9707, !- Year 12 Escalation [2036] + 0.9807, !- Year 13 Escalation [2037] + 0.9936, !- Year 14 Escalation [2038] + 0.9999, !- Year 15 Escalation [2039] + 1.0101, !- Year 16 Escalation [2040] + 1.0201, !- Year 17 Escalation [2041] + 1.0272, !- Year 18 Escalation [2042] + 1.0309, !- Year 19 Escalation [2043] + 1.0317, !- Year 20 Escalation [2044] + 1.0336, !- Year 21 Escalation [2045] + 1.0343, !- Year 22 Escalation [2046] + 1.0354, !- Year 23 Escalation [2047] + 1.0379, !- Year 24 Escalation [2048] + 1.0387, !- Year 25 Escalation [2049] + 1.0381, !- Year 26 Escalation [2050] + 1.0390, !- Year 27 Escalation [2051] + 1.0400, !- Year 28 Escalation [2052] + 1.0410, !- Year 29 Escalation [2053] + 1.0419; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + WestNorthCentral Commercial-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9590, !- Year 1 Escalation [2025] + 0.9385, !- Year 2 Escalation [2026] + 0.9110, !- Year 3 Escalation [2027] + 0.8963, !- Year 4 Escalation [2028] + 0.8890, !- Year 5 Escalation [2029] + 0.8832, !- Year 6 Escalation [2030] + 0.8792, !- Year 7 Escalation [2031] + 0.8778, !- Year 8 Escalation [2032] + 0.8777, !- Year 9 Escalation [2033] + 0.8847, !- Year 10 Escalation [2034] + 0.8795, !- Year 11 Escalation [2035] + 0.8794, !- Year 12 Escalation [2036] + 0.8812, !- Year 13 Escalation [2037] + 0.8840, !- Year 14 Escalation [2038] + 0.8915, !- Year 15 Escalation [2039] + 0.8974, !- Year 16 Escalation [2040] + 0.9023, !- Year 17 Escalation [2041] + 0.9029, !- Year 18 Escalation [2042] + 0.9003, !- Year 19 Escalation [2043] + 0.8989, !- Year 20 Escalation [2044] + 0.8990, !- Year 21 Escalation [2045] + 0.8942, !- Year 22 Escalation [2046] + 0.8833, !- Year 23 Escalation [2047] + 0.8840, !- Year 24 Escalation [2048] + 0.8788, !- Year 25 Escalation [2049] + 0.8694, !- Year 26 Escalation [2050] + 0.8633, !- Year 27 Escalation [2051] + 0.8573, !- Year 28 Escalation [2052] + 0.8513, !- Year 29 Escalation [2053] + 0.8454; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + WestNorthCentral Commercial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.8997, !- Year 1 Escalation [2025] + 0.8427, !- Year 2 Escalation [2026] + 0.7872, !- Year 3 Escalation [2027] + 0.7375, !- Year 4 Escalation [2028] + 0.7411, !- Year 5 Escalation [2029] + 0.7402, !- Year 6 Escalation [2030] + 0.7469, !- Year 7 Escalation [2031] + 0.7501, !- Year 8 Escalation [2032] + 0.7546, !- Year 9 Escalation [2033] + 0.7567, !- Year 10 Escalation [2034] + 0.7625, !- Year 11 Escalation [2035] + 0.7639, !- Year 12 Escalation [2036] + 0.7685, !- Year 13 Escalation [2037] + 0.7718, !- Year 14 Escalation [2038] + 0.7736, !- Year 15 Escalation [2039] + 0.7757, !- Year 16 Escalation [2040] + 0.7819, !- Year 17 Escalation [2041] + 0.7820, !- Year 18 Escalation [2042] + 0.7865, !- Year 19 Escalation [2043] + 0.7833, !- Year 20 Escalation [2044] + 0.7858, !- Year 21 Escalation [2045] + 0.7942, !- Year 22 Escalation [2046] + 0.7950, !- Year 23 Escalation [2047] + 0.7967, !- Year 24 Escalation [2048] + 0.7995, !- Year 25 Escalation [2049] + 0.7996, !- Year 26 Escalation [2050] + 0.8010, !- Year 27 Escalation [2051] + 0.8023, !- Year 28 Escalation [2052] + 0.8037, !- Year 29 Escalation [2053] + 0.8050; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + WestNorthCentral Commercial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0353, !- Year 1 Escalation [2025] + 1.1424, !- Year 2 Escalation [2026] + 1.2954, !- Year 3 Escalation [2027] + 1.4406, !- Year 4 Escalation [2028] + 1.4438, !- Year 5 Escalation [2029] + 1.4532, !- Year 6 Escalation [2030] + 1.4652, !- Year 7 Escalation [2031] + 1.4761, !- Year 8 Escalation [2032] + 1.4861, !- Year 9 Escalation [2033] + 1.4970, !- Year 10 Escalation [2034] + 1.5090, !- Year 11 Escalation [2035] + 1.5186, !- Year 12 Escalation [2036] + 1.5280, !- Year 13 Escalation [2037] + 1.5390, !- Year 14 Escalation [2038] + 1.5471, !- Year 15 Escalation [2039] + 1.5561, !- Year 16 Escalation [2040] + 1.5693, !- Year 17 Escalation [2041] + 1.5708, !- Year 18 Escalation [2042] + 1.5778, !- Year 19 Escalation [2043] + 1.5746, !- Year 20 Escalation [2044] + 1.5802, !- Year 21 Escalation [2045] + 1.5967, !- Year 22 Escalation [2046] + 1.5968, !- Year 23 Escalation [2047] + 1.6096, !- Year 24 Escalation [2048] + 1.6192, !- Year 25 Escalation [2049] + 1.6265, !- Year 26 Escalation [2050] + 1.6340, !- Year 27 Escalation [2051] + 1.6415, !- Year 28 Escalation [2052] + 1.6491, !- Year 29 Escalation [2053] + 1.6568; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + WestNorthCentral Commercial-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9261, !- Year 1 Escalation [2025] + 0.8679, !- Year 2 Escalation [2026] + 0.8341, !- Year 3 Escalation [2027] + 0.8182, !- Year 4 Escalation [2028] + 0.8228, !- Year 5 Escalation [2029] + 0.8302, !- Year 6 Escalation [2030] + 0.8413, !- Year 7 Escalation [2031] + 0.8486, !- Year 8 Escalation [2032] + 0.8633, !- Year 9 Escalation [2033] + 0.8765, !- Year 10 Escalation [2034] + 0.8879, !- Year 11 Escalation [2035] + 0.8924, !- Year 12 Escalation [2036] + 0.9008, !- Year 13 Escalation [2037] + 0.9134, !- Year 14 Escalation [2038] + 0.9133, !- Year 15 Escalation [2039] + 0.9225, !- Year 16 Escalation [2040] + 0.9318, !- Year 17 Escalation [2041] + 0.9318, !- Year 18 Escalation [2042] + 0.9281, !- Year 19 Escalation [2043] + 0.9236, !- Year 20 Escalation [2044] + 0.9236, !- Year 21 Escalation [2045] + 0.9220, !- Year 22 Escalation [2046] + 0.9192, !- Year 23 Escalation [2047] + 0.9153, !- Year 24 Escalation [2048] + 0.9134, !- Year 25 Escalation [2049] + 0.9131, !- Year 26 Escalation [2050] + 0.9109, !- Year 27 Escalation [2051] + 0.9087, !- Year 28 Escalation [2052] + 0.9065, !- Year 29 Escalation [2053] + 0.9043; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + WestNorthCentral Industrial-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9430, !- Year 1 Escalation [2025] + 0.9035, !- Year 2 Escalation [2026] + 0.8701, !- Year 3 Escalation [2027] + 0.8490, !- Year 4 Escalation [2028] + 0.8368, !- Year 5 Escalation [2029] + 0.8279, !- Year 6 Escalation [2030] + 0.8234, !- Year 7 Escalation [2031] + 0.8203, !- Year 8 Escalation [2032] + 0.8227, !- Year 9 Escalation [2033] + 0.8215, !- Year 10 Escalation [2034] + 0.8165, !- Year 11 Escalation [2035] + 0.8150, !- Year 12 Escalation [2036] + 0.8189, !- Year 13 Escalation [2037] + 0.8255, !- Year 14 Escalation [2038] + 0.8344, !- Year 15 Escalation [2039] + 0.8419, !- Year 16 Escalation [2040] + 0.8488, !- Year 17 Escalation [2041] + 0.8490, !- Year 18 Escalation [2042] + 0.8474, !- Year 19 Escalation [2043] + 0.8483, !- Year 20 Escalation [2044] + 0.8470, !- Year 21 Escalation [2045] + 0.8399, !- Year 22 Escalation [2046] + 0.8319, !- Year 23 Escalation [2047] + 0.8300, !- Year 24 Escalation [2048] + 0.8238, !- Year 25 Escalation [2049] + 0.8156, !- Year 26 Escalation [2050] + 0.8096, !- Year 27 Escalation [2051] + 0.8037, !- Year 28 Escalation [2052] + 0.7978, !- Year 29 Escalation [2053] + 0.7920; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + WestNorthCentral Industrial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.8978, !- Year 1 Escalation [2025] + 0.8383, !- Year 2 Escalation [2026] + 0.7802, !- Year 3 Escalation [2027] + 0.7281, !- Year 4 Escalation [2028] + 0.7317, !- Year 5 Escalation [2029] + 0.7308, !- Year 6 Escalation [2030] + 0.7374, !- Year 7 Escalation [2031] + 0.7406, !- Year 8 Escalation [2032] + 0.7453, !- Year 9 Escalation [2033] + 0.7472, !- Year 10 Escalation [2034] + 0.7533, !- Year 11 Escalation [2035] + 0.7544, !- Year 12 Escalation [2036] + 0.7591, !- Year 13 Escalation [2037] + 0.7623, !- Year 14 Escalation [2038] + 0.7641, !- Year 15 Escalation [2039] + 0.7661, !- Year 16 Escalation [2040] + 0.7721, !- Year 17 Escalation [2041] + 0.7722, !- Year 18 Escalation [2042] + 0.7766, !- Year 19 Escalation [2043] + 0.7734, !- Year 20 Escalation [2044] + 0.7755, !- Year 21 Escalation [2045] + 0.7839, !- Year 22 Escalation [2046] + 0.7846, !- Year 23 Escalation [2047] + 0.7862, !- Year 24 Escalation [2048] + 0.7890, !- Year 25 Escalation [2049] + 0.7891, !- Year 26 Escalation [2050] + 0.7904, !- Year 27 Escalation [2051] + 0.7917, !- Year 28 Escalation [2052] + 0.7930, !- Year 29 Escalation [2053] + 0.7944; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + WestNorthCentral Industrial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0375, !- Year 1 Escalation [2025] + 1.1473, !- Year 2 Escalation [2026] + 1.3033, !- Year 3 Escalation [2027] + 1.4515, !- Year 4 Escalation [2028] + 1.4547, !- Year 5 Escalation [2029] + 1.4642, !- Year 6 Escalation [2030] + 1.4762, !- Year 7 Escalation [2031] + 1.4872, !- Year 8 Escalation [2032] + 1.4972, !- Year 9 Escalation [2033] + 1.5083, !- Year 10 Escalation [2034] + 1.5204, !- Year 11 Escalation [2035] + 1.5300, !- Year 12 Escalation [2036] + 1.5395, !- Year 13 Escalation [2037] + 1.5506, !- Year 14 Escalation [2038] + 1.5588, !- Year 15 Escalation [2039] + 1.5678, !- Year 16 Escalation [2040] + 1.5811, !- Year 17 Escalation [2041] + 1.5826, !- Year 18 Escalation [2042] + 1.5897, !- Year 19 Escalation [2043] + 1.5865, !- Year 20 Escalation [2044] + 1.5921, !- Year 21 Escalation [2045] + 1.6087, !- Year 22 Escalation [2046] + 1.6088, !- Year 23 Escalation [2047] + 1.6217, !- Year 24 Escalation [2048] + 1.6314, !- Year 25 Escalation [2049] + 1.6387, !- Year 26 Escalation [2050] + 1.6463, !- Year 27 Escalation [2051] + 1.6539, !- Year 28 Escalation [2052] + 1.6616, !- Year 29 Escalation [2053] + 1.6693; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + WestNorthCentral Industrial-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.8971, !- Year 1 Escalation [2025] + 0.8189, !- Year 2 Escalation [2026] + 0.7759, !- Year 3 Escalation [2027] + 0.7598, !- Year 4 Escalation [2028] + 0.7602, !- Year 5 Escalation [2029] + 0.7676, !- Year 6 Escalation [2030] + 0.7793, !- Year 7 Escalation [2031] + 0.7882, !- Year 8 Escalation [2032] + 0.8061, !- Year 9 Escalation [2033] + 0.8214, !- Year 10 Escalation [2034] + 0.8356, !- Year 11 Escalation [2035] + 0.8386, !- Year 12 Escalation [2036] + 0.8469, !- Year 13 Escalation [2037] + 0.8650, !- Year 14 Escalation [2038] + 0.8602, !- Year 15 Escalation [2039] + 0.8763, !- Year 16 Escalation [2040] + 0.8872, !- Year 17 Escalation [2041] + 0.8837, !- Year 18 Escalation [2042] + 0.8743, !- Year 19 Escalation [2043] + 0.8655, !- Year 20 Escalation [2044] + 0.8612, !- Year 21 Escalation [2045] + 0.8557, !- Year 22 Escalation [2046] + 0.8485, !- Year 23 Escalation [2047] + 0.8402, !- Year 24 Escalation [2048] + 0.8321, !- Year 25 Escalation [2049] + 0.8285, !- Year 26 Escalation [2050] + 0.8218, !- Year 27 Escalation [2051] + 0.8152, !- Year 28 Escalation [2052] + 0.8086, !- Year 29 Escalation [2053] + 0.8021; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + WestNorthCentral Industrial-Coal, !- Name + Coal, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0330, !- Year 1 Escalation [2025] + 1.0292, !- Year 2 Escalation [2026] + 1.0191, !- Year 3 Escalation [2027] + 1.0124, !- Year 4 Escalation [2028] + 1.0101, !- Year 5 Escalation [2029] + 1.0094, !- Year 6 Escalation [2030] + 1.0087, !- Year 7 Escalation [2031] + 1.0075, !- Year 8 Escalation [2032] + 1.0069, !- Year 9 Escalation [2033] + 1.0078, !- Year 10 Escalation [2034] + 1.0084, !- Year 11 Escalation [2035] + 1.0116, !- Year 12 Escalation [2036] + 1.0192, !- Year 13 Escalation [2037] + 1.0310, !- Year 14 Escalation [2038] + 1.0398, !- Year 15 Escalation [2039] + 1.0448, !- Year 16 Escalation [2040] + 1.0490, !- Year 17 Escalation [2041] + 1.0520, !- Year 18 Escalation [2042] + 1.0555, !- Year 19 Escalation [2043] + 1.0584, !- Year 20 Escalation [2044] + 1.0609, !- Year 21 Escalation [2045] + 1.0622, !- Year 22 Escalation [2046] + 1.0631, !- Year 23 Escalation [2047] + 1.0640, !- Year 24 Escalation [2048] + 1.0570, !- Year 25 Escalation [2049] + 1.0565, !- Year 26 Escalation [2050] + 1.0551, !- Year 27 Escalation [2051] + 1.0536, !- Year 28 Escalation [2052] + 1.0522, !- Year 29 Escalation [2053] + 1.0508; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + SouthAtlantic Residential-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9803, !- Year 1 Escalation [2025] + 0.9603, !- Year 2 Escalation [2026] + 0.9398, !- Year 3 Escalation [2027] + 0.9237, !- Year 4 Escalation [2028] + 0.9161, !- Year 5 Escalation [2029] + 0.9124, !- Year 6 Escalation [2030] + 0.9159, !- Year 7 Escalation [2031] + 0.9179, !- Year 8 Escalation [2032] + 0.9377, !- Year 9 Escalation [2033] + 0.9505, !- Year 10 Escalation [2034] + 0.9493, !- Year 11 Escalation [2035] + 0.9538, !- Year 12 Escalation [2036] + 0.9665, !- Year 13 Escalation [2037] + 0.9825, !- Year 14 Escalation [2038] + 0.9884, !- Year 15 Escalation [2039] + 0.9937, !- Year 16 Escalation [2040] + 0.9915, !- Year 17 Escalation [2041] + 0.9891, !- Year 18 Escalation [2042] + 0.9862, !- Year 19 Escalation [2043] + 0.9873, !- Year 20 Escalation [2044] + 0.9923, !- Year 21 Escalation [2045] + 0.9932, !- Year 22 Escalation [2046] + 0.9928, !- Year 23 Escalation [2047] + 0.9881, !- Year 24 Escalation [2048] + 0.9832, !- Year 25 Escalation [2049] + 0.9743, !- Year 26 Escalation [2050] + 0.9696, !- Year 27 Escalation [2051] + 0.9649, !- Year 28 Escalation [2052] + 0.9603, !- Year 29 Escalation [2053] + 0.9557; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + SouthAtlantic Residential-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9501, !- Year 1 Escalation [2025] + 0.9353, !- Year 2 Escalation [2026] + 0.9216, !- Year 3 Escalation [2027] + 0.9107, !- Year 4 Escalation [2028] + 0.9131, !- Year 5 Escalation [2029] + 0.9134, !- Year 6 Escalation [2030] + 0.9191, !- Year 7 Escalation [2031] + 0.9214, !- Year 8 Escalation [2032] + 0.9239, !- Year 9 Escalation [2033] + 0.9268, !- Year 10 Escalation [2034] + 0.9297, !- Year 11 Escalation [2035] + 0.9321, !- Year 12 Escalation [2036] + 0.9353, !- Year 13 Escalation [2037] + 0.9381, !- Year 14 Escalation [2038] + 0.9398, !- Year 15 Escalation [2039] + 0.9418, !- Year 16 Escalation [2040] + 0.9471, !- Year 17 Escalation [2041] + 0.9477, !- Year 18 Escalation [2042] + 0.9515, !- Year 19 Escalation [2043] + 0.9490, !- Year 20 Escalation [2044] + 0.9525, !- Year 21 Escalation [2045] + 0.9596, !- Year 22 Escalation [2046] + 0.9601, !- Year 23 Escalation [2047] + 0.9614, !- Year 24 Escalation [2048] + 0.9640, !- Year 25 Escalation [2049] + 0.9644, !- Year 26 Escalation [2050] + 0.9655, !- Year 27 Escalation [2051] + 0.9667, !- Year 28 Escalation [2052] + 0.9679, !- Year 29 Escalation [2053] + 0.9691; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + SouthAtlantic Residential-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9825, !- Year 1 Escalation [2025] + 0.9652, !- Year 2 Escalation [2026] + 0.9621, !- Year 3 Escalation [2027] + 0.9669, !- Year 4 Escalation [2028] + 0.9720, !- Year 5 Escalation [2029] + 0.9793, !- Year 6 Escalation [2030] + 0.9885, !- Year 7 Escalation [2031] + 0.9987, !- Year 8 Escalation [2032] + 1.0107, !- Year 9 Escalation [2033] + 1.0203, !- Year 10 Escalation [2034] + 1.0298, !- Year 11 Escalation [2035] + 1.0370, !- Year 12 Escalation [2036] + 1.0447, !- Year 13 Escalation [2037] + 1.0547, !- Year 14 Escalation [2038] + 1.0591, !- Year 15 Escalation [2039] + 1.0678, !- Year 16 Escalation [2040] + 1.0751, !- Year 17 Escalation [2041] + 1.0791, !- Year 18 Escalation [2042] + 1.0813, !- Year 19 Escalation [2043] + 1.0833, !- Year 20 Escalation [2044] + 1.0870, !- Year 21 Escalation [2045] + 1.0902, !- Year 22 Escalation [2046] + 1.0923, !- Year 23 Escalation [2047] + 1.0946, !- Year 24 Escalation [2048] + 1.0970, !- Year 25 Escalation [2049] + 1.1006, !- Year 26 Escalation [2050] + 1.1033, !- Year 27 Escalation [2051] + 1.1059, !- Year 28 Escalation [2052] + 1.1085, !- Year 29 Escalation [2053] + 1.1111; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + SouthAtlantic Residential-LPG, !- Name + Propane, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9659, !- Year 1 Escalation [2025] + 0.9309, !- Year 2 Escalation [2026] + 0.9026, !- Year 3 Escalation [2027] + 0.8865, !- Year 4 Escalation [2028] + 0.8803, !- Year 5 Escalation [2029] + 0.8831, !- Year 6 Escalation [2030] + 0.8923, !- Year 7 Escalation [2031] + 0.9070, !- Year 8 Escalation [2032] + 0.9257, !- Year 9 Escalation [2033] + 0.9444, !- Year 10 Escalation [2034] + 0.9594, !- Year 11 Escalation [2035] + 0.9707, !- Year 12 Escalation [2036] + 0.9807, !- Year 13 Escalation [2037] + 0.9936, !- Year 14 Escalation [2038] + 0.9999, !- Year 15 Escalation [2039] + 1.0101, !- Year 16 Escalation [2040] + 1.0201, !- Year 17 Escalation [2041] + 1.0272, !- Year 18 Escalation [2042] + 1.0309, !- Year 19 Escalation [2043] + 1.0317, !- Year 20 Escalation [2044] + 1.0336, !- Year 21 Escalation [2045] + 1.0343, !- Year 22 Escalation [2046] + 1.0354, !- Year 23 Escalation [2047] + 1.0379, !- Year 24 Escalation [2048] + 1.0387, !- Year 25 Escalation [2049] + 1.0381, !- Year 26 Escalation [2050] + 1.0390, !- Year 27 Escalation [2051] + 1.0400, !- Year 28 Escalation [2052] + 1.0410, !- Year 29 Escalation [2053] + 1.0419; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + SouthAtlantic Commercial-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9762, !- Year 1 Escalation [2025] + 0.9511, !- Year 2 Escalation [2026] + 0.9265, !- Year 3 Escalation [2027] + 0.9056, !- Year 4 Escalation [2028] + 0.8944, !- Year 5 Escalation [2029] + 0.8871, !- Year 6 Escalation [2030] + 0.8871, !- Year 7 Escalation [2031] + 0.8853, !- Year 8 Escalation [2032] + 0.9032, !- Year 9 Escalation [2033] + 0.9136, !- Year 10 Escalation [2034] + 0.9085, !- Year 11 Escalation [2035] + 0.9119, !- Year 12 Escalation [2036] + 0.9221, !- Year 13 Escalation [2037] + 0.9367, !- Year 14 Escalation [2038] + 0.9414, !- Year 15 Escalation [2039] + 0.9440, !- Year 16 Escalation [2040] + 0.9395, !- Year 17 Escalation [2041] + 0.9345, !- Year 18 Escalation [2042] + 0.9289, !- Year 19 Escalation [2043] + 0.9277, !- Year 20 Escalation [2044] + 0.9307, !- Year 21 Escalation [2045] + 0.9291, !- Year 22 Escalation [2046] + 0.9260, !- Year 23 Escalation [2047] + 0.9200, !- Year 24 Escalation [2048] + 0.9142, !- Year 25 Escalation [2049] + 0.9038, !- Year 26 Escalation [2050] + 0.8976, !- Year 27 Escalation [2051] + 0.8914, !- Year 28 Escalation [2052] + 0.8853, !- Year 29 Escalation [2053] + 0.8792; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + SouthAtlantic Commercial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9120, !- Year 1 Escalation [2025] + 0.8619, !- Year 2 Escalation [2026] + 0.8125, !- Year 3 Escalation [2027] + 0.7679, !- Year 4 Escalation [2028] + 0.7708, !- Year 5 Escalation [2029] + 0.7712, !- Year 6 Escalation [2030] + 0.7772, !- Year 7 Escalation [2031] + 0.7800, !- Year 8 Escalation [2032] + 0.7837, !- Year 9 Escalation [2033] + 0.7857, !- Year 10 Escalation [2034] + 0.7908, !- Year 11 Escalation [2035] + 0.7920, !- Year 12 Escalation [2036] + 0.7960, !- Year 13 Escalation [2037] + 0.7990, !- Year 14 Escalation [2038] + 0.8007, !- Year 15 Escalation [2039] + 0.8025, !- Year 16 Escalation [2040] + 0.8078, !- Year 17 Escalation [2041] + 0.8080, !- Year 18 Escalation [2042] + 0.8119, !- Year 19 Escalation [2043] + 0.8091, !- Year 20 Escalation [2044] + 0.8113, !- Year 21 Escalation [2045] + 0.8183, !- Year 22 Escalation [2046] + 0.8193, !- Year 23 Escalation [2047] + 0.8206, !- Year 24 Escalation [2048] + 0.8230, !- Year 25 Escalation [2049] + 0.8233, !- Year 26 Escalation [2050] + 0.8246, !- Year 27 Escalation [2051] + 0.8258, !- Year 28 Escalation [2052] + 0.8271, !- Year 29 Escalation [2053] + 0.8284; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + SouthAtlantic Commercial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0470, !- Year 1 Escalation [2025] + 1.2088, !- Year 2 Escalation [2026] + 1.3718, !- Year 3 Escalation [2027] + 1.5319, !- Year 4 Escalation [2028] + 1.5411, !- Year 5 Escalation [2029] + 1.5500, !- Year 6 Escalation [2030] + 1.5612, !- Year 7 Escalation [2031] + 1.5715, !- Year 8 Escalation [2032] + 1.5808, !- Year 9 Escalation [2033] + 1.5911, !- Year 10 Escalation [2034] + 1.6024, !- Year 11 Escalation [2035] + 1.6113, !- Year 12 Escalation [2036] + 1.6212, !- Year 13 Escalation [2037] + 1.6317, !- Year 14 Escalation [2038] + 1.6382, !- Year 15 Escalation [2039] + 1.6466, !- Year 16 Escalation [2040] + 1.6591, !- Year 17 Escalation [2041] + 1.6607, !- Year 18 Escalation [2042] + 1.6675, !- Year 19 Escalation [2043] + 1.6723, !- Year 20 Escalation [2044] + 1.6780, !- Year 21 Escalation [2045] + 1.6937, !- Year 22 Escalation [2046] + 1.6938, !- Year 23 Escalation [2047] + 1.7058, !- Year 24 Escalation [2048] + 1.7148, !- Year 25 Escalation [2049] + 1.7216, !- Year 26 Escalation [2050] + 1.7287, !- Year 27 Escalation [2051] + 1.7358, !- Year 28 Escalation [2052] + 1.7429, !- Year 29 Escalation [2053] + 1.7501; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + SouthAtlantic Commercial-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9778, !- Year 1 Escalation [2025] + 0.9548, !- Year 2 Escalation [2026] + 0.9519, !- Year 3 Escalation [2027] + 0.9610, !- Year 4 Escalation [2028] + 0.9629, !- Year 5 Escalation [2029] + 0.9686, !- Year 6 Escalation [2030] + 0.9779, !- Year 7 Escalation [2031] + 0.9886, !- Year 8 Escalation [2032] + 1.0021, !- Year 9 Escalation [2033] + 1.0120, !- Year 10 Escalation [2034] + 1.0215, !- Year 11 Escalation [2035] + 1.0273, !- Year 12 Escalation [2036] + 1.0340, !- Year 13 Escalation [2037] + 1.0440, !- Year 14 Escalation [2038] + 1.0455, !- Year 15 Escalation [2039] + 1.0534, !- Year 16 Escalation [2040] + 1.0592, !- Year 17 Escalation [2041] + 1.0602, !- Year 18 Escalation [2042] + 1.0584, !- Year 19 Escalation [2043] + 1.0563, !- Year 20 Escalation [2044] + 1.0570, !- Year 21 Escalation [2045] + 1.0570, !- Year 22 Escalation [2046] + 1.0554, !- Year 23 Escalation [2047] + 1.0541, !- Year 24 Escalation [2048] + 1.0531, !- Year 25 Escalation [2049] + 1.0539, !- Year 26 Escalation [2050] + 1.0532, !- Year 27 Escalation [2051] + 1.0524, !- Year 28 Escalation [2052] + 1.0517, !- Year 29 Escalation [2053] + 1.0509; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + SouthAtlantic Industrial-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9360, !- Year 1 Escalation [2025] + 0.8981, !- Year 2 Escalation [2026] + 0.8646, !- Year 3 Escalation [2027] + 0.8292, !- Year 4 Escalation [2028] + 0.8043, !- Year 5 Escalation [2029] + 0.7859, !- Year 6 Escalation [2030] + 0.7774, !- Year 7 Escalation [2031] + 0.7780, !- Year 8 Escalation [2032] + 0.7746, !- Year 9 Escalation [2033] + 0.8047, !- Year 10 Escalation [2034] + 0.8095, !- Year 11 Escalation [2035] + 0.8051, !- Year 12 Escalation [2036] + 0.8138, !- Year 13 Escalation [2037] + 0.8266, !- Year 14 Escalation [2038] + 0.8422, !- Year 15 Escalation [2039] + 0.8515, !- Year 16 Escalation [2040] + 0.8508, !- Year 17 Escalation [2041] + 0.8469, !- Year 18 Escalation [2042] + 0.8472, !- Year 19 Escalation [2043] + 0.8409, !- Year 20 Escalation [2044] + 0.8448, !- Year 21 Escalation [2045] + 0.8463, !- Year 22 Escalation [2046] + 0.8438, !- Year 23 Escalation [2047] + 0.8442, !- Year 24 Escalation [2048] + 0.8387, !- Year 25 Escalation [2049] + 0.8353, !- Year 26 Escalation [2050] + 0.8258, !- Year 27 Escalation [2051] + 0.8214, !- Year 28 Escalation [2052] + 0.8170, !- Year 29 Escalation [2053] + 0.8126; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + SouthAtlantic Industrial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9139, !- Year 1 Escalation [2025] + 0.8636, !- Year 2 Escalation [2026] + 0.8140, !- Year 3 Escalation [2027] + 0.7692, !- Year 4 Escalation [2028] + 0.7720, !- Year 5 Escalation [2029] + 0.7724, !- Year 6 Escalation [2030] + 0.7780, !- Year 7 Escalation [2031] + 0.7808, !- Year 8 Escalation [2032] + 0.7844, !- Year 9 Escalation [2033] + 0.7861, !- Year 10 Escalation [2034] + 0.7914, !- Year 11 Escalation [2035] + 0.7922, !- Year 12 Escalation [2036] + 0.7961, !- Year 13 Escalation [2037] + 0.7990, !- Year 14 Escalation [2038] + 0.8005, !- Year 15 Escalation [2039] + 0.8021, !- Year 16 Escalation [2040] + 0.8072, !- Year 17 Escalation [2041] + 0.8072, !- Year 18 Escalation [2042] + 0.8109, !- Year 19 Escalation [2043] + 0.8082, !- Year 20 Escalation [2044] + 0.8100, !- Year 21 Escalation [2045] + 0.8165, !- Year 22 Escalation [2046] + 0.8175, !- Year 23 Escalation [2047] + 0.8187, !- Year 24 Escalation [2048] + 0.8210, !- Year 25 Escalation [2049] + 0.8213, !- Year 26 Escalation [2050] + 0.8225, !- Year 27 Escalation [2051] + 0.8236, !- Year 28 Escalation [2052] + 0.8248, !- Year 29 Escalation [2053] + 0.8260; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + SouthAtlantic Industrial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0475, !- Year 1 Escalation [2025] + 1.2100, !- Year 2 Escalation [2026] + 1.3738, !- Year 3 Escalation [2027] + 1.5346, !- Year 4 Escalation [2028] + 1.5438, !- Year 5 Escalation [2029] + 1.5527, !- Year 6 Escalation [2030] + 1.5640, !- Year 7 Escalation [2031] + 1.5742, !- Year 8 Escalation [2032] + 1.5836, !- Year 9 Escalation [2033] + 1.5939, !- Year 10 Escalation [2034] + 1.6052, !- Year 11 Escalation [2035] + 1.6142, !- Year 12 Escalation [2036] + 1.6241, !- Year 13 Escalation [2037] + 1.6346, !- Year 14 Escalation [2038] + 1.6411, !- Year 15 Escalation [2039] + 1.6495, !- Year 16 Escalation [2040] + 1.6620, !- Year 17 Escalation [2041] + 1.6636, !- Year 18 Escalation [2042] + 1.6705, !- Year 19 Escalation [2043] + 1.6752, !- Year 20 Escalation [2044] + 1.6810, !- Year 21 Escalation [2045] + 1.6967, !- Year 22 Escalation [2046] + 1.6967, !- Year 23 Escalation [2047] + 1.7088, !- Year 24 Escalation [2048] + 1.7178, !- Year 25 Escalation [2049] + 1.7247, !- Year 26 Escalation [2050] + 1.7317, !- Year 27 Escalation [2051] + 1.7388, !- Year 28 Escalation [2052] + 1.7460, !- Year 29 Escalation [2053] + 1.7531; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + SouthAtlantic Industrial-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.8948, !- Year 1 Escalation [2025] + 0.8032, !- Year 2 Escalation [2026] + 0.7551, !- Year 3 Escalation [2027] + 0.7346, !- Year 4 Escalation [2028] + 0.7339, !- Year 5 Escalation [2029] + 0.7410, !- Year 6 Escalation [2030] + 0.7549, !- Year 7 Escalation [2031] + 0.7717, !- Year 8 Escalation [2032] + 0.7971, !- Year 9 Escalation [2033] + 0.8146, !- Year 10 Escalation [2034] + 0.8315, !- Year 11 Escalation [2035] + 0.8370, !- Year 12 Escalation [2036] + 0.8470, !- Year 13 Escalation [2037] + 0.8673, !- Year 14 Escalation [2038] + 0.8630, !- Year 15 Escalation [2039] + 0.8803, !- Year 16 Escalation [2040] + 0.8916, !- Year 17 Escalation [2041] + 0.8896, !- Year 18 Escalation [2042] + 0.8811, !- Year 19 Escalation [2043] + 0.8703, !- Year 20 Escalation [2044] + 0.8688, !- Year 21 Escalation [2045] + 0.8646, !- Year 22 Escalation [2046] + 0.8564, !- Year 23 Escalation [2047] + 0.8505, !- Year 24 Escalation [2048] + 0.8427, !- Year 25 Escalation [2049] + 0.8414, !- Year 26 Escalation [2050] + 0.8357, !- Year 27 Escalation [2051] + 0.8301, !- Year 28 Escalation [2052] + 0.8245, !- Year 29 Escalation [2053] + 0.8189; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + SouthAtlantic Industrial-Coal, !- Name + Coal, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0229, !- Year 1 Escalation [2025] + 1.0070, !- Year 2 Escalation [2026] + 1.0077, !- Year 3 Escalation [2027] + 1.0085, !- Year 4 Escalation [2028] + 1.0113, !- Year 5 Escalation [2029] + 1.0147, !- Year 6 Escalation [2030] + 1.0193, !- Year 7 Escalation [2031] + 1.0227, !- Year 8 Escalation [2032] + 1.0270, !- Year 9 Escalation [2033] + 1.0322, !- Year 10 Escalation [2034] + 1.0370, !- Year 11 Escalation [2035] + 1.0415, !- Year 12 Escalation [2036] + 1.0463, !- Year 13 Escalation [2037] + 1.0516, !- Year 14 Escalation [2038] + 1.0561, !- Year 15 Escalation [2039] + 1.0591, !- Year 16 Escalation [2040] + 1.0624, !- Year 17 Escalation [2041] + 1.0649, !- Year 18 Escalation [2042] + 1.0689, !- Year 19 Escalation [2043] + 1.0727, !- Year 20 Escalation [2044] + 1.0767, !- Year 21 Escalation [2045] + 1.0803, !- Year 22 Escalation [2046] + 1.0840, !- Year 23 Escalation [2047] + 1.0880, !- Year 24 Escalation [2048] + 1.0923, !- Year 25 Escalation [2049] + 1.0963, !- Year 26 Escalation [2050] + 1.1004, !- Year 27 Escalation [2051] + 1.1044, !- Year 28 Escalation [2052] + 1.1085, !- Year 29 Escalation [2053] + 1.1126; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + EastSouthCentral Residential-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9672, !- Year 1 Escalation [2025] + 0.9510, !- Year 2 Escalation [2026] + 0.9295, !- Year 3 Escalation [2027] + 0.9180, !- Year 4 Escalation [2028] + 0.9128, !- Year 5 Escalation [2029] + 0.9103, !- Year 6 Escalation [2030] + 0.9098, !- Year 7 Escalation [2031] + 0.9118, !- Year 8 Escalation [2032] + 0.9142, !- Year 9 Escalation [2033] + 0.9199, !- Year 10 Escalation [2034] + 0.9173, !- Year 11 Escalation [2035] + 0.9174, !- Year 12 Escalation [2036] + 0.9205, !- Year 13 Escalation [2037] + 0.9254, !- Year 14 Escalation [2038] + 0.9315, !- Year 15 Escalation [2039] + 0.9401, !- Year 16 Escalation [2040] + 0.9470, !- Year 17 Escalation [2041] + 0.9493, !- Year 18 Escalation [2042] + 0.9492, !- Year 19 Escalation [2043] + 0.9498, !- Year 20 Escalation [2044] + 0.9516, !- Year 21 Escalation [2045] + 0.9480, !- Year 22 Escalation [2046] + 0.9405, !- Year 23 Escalation [2047] + 0.9400, !- Year 24 Escalation [2048] + 0.9352, !- Year 25 Escalation [2049] + 0.9267, !- Year 26 Escalation [2050] + 0.9214, !- Year 27 Escalation [2051] + 0.9162, !- Year 28 Escalation [2052] + 0.9110, !- Year 29 Escalation [2053] + 0.9059; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + EastSouthCentral Residential-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9218, !- Year 1 Escalation [2025] + 0.8944, !- Year 2 Escalation [2026] + 0.8687, !- Year 3 Escalation [2027] + 0.8467, !- Year 4 Escalation [2028] + 0.8510, !- Year 5 Escalation [2029] + 0.8502, !- Year 6 Escalation [2030] + 0.8580, !- Year 7 Escalation [2031] + 0.8612, !- Year 8 Escalation [2032] + 0.8644, !- Year 9 Escalation [2033] + 0.8687, !- Year 10 Escalation [2034] + 0.8722, !- Year 11 Escalation [2035] + 0.8759, !- Year 12 Escalation [2036] + 0.8802, !- Year 13 Escalation [2037] + 0.8840, !- Year 14 Escalation [2038] + 0.8864, !- Year 15 Escalation [2039] + 0.8893, !- Year 16 Escalation [2040] + 0.8967, !- Year 17 Escalation [2041] + 0.8975, !- Year 18 Escalation [2042] + 0.9029, !- Year 19 Escalation [2043] + 0.8994, !- Year 20 Escalation [2044] + 0.9045, !- Year 21 Escalation [2045] + 0.9145, !- Year 22 Escalation [2046] + 0.9152, !- Year 23 Escalation [2047] + 0.9172, !- Year 24 Escalation [2048] + 0.9206, !- Year 25 Escalation [2049] + 0.9211, !- Year 26 Escalation [2050] + 0.9228, !- Year 27 Escalation [2051] + 0.9244, !- Year 28 Escalation [2052] + 0.9261, !- Year 29 Escalation [2053] + 0.9277; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + EastSouthCentral Residential-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9333, !- Year 1 Escalation [2025] + 0.8804, !- Year 2 Escalation [2026] + 0.8500, !- Year 3 Escalation [2027] + 0.8357, !- Year 4 Escalation [2028] + 0.8410, !- Year 5 Escalation [2029] + 0.8491, !- Year 6 Escalation [2030] + 0.8609, !- Year 7 Escalation [2031] + 0.8695, !- Year 8 Escalation [2032] + 0.8828, !- Year 9 Escalation [2033] + 0.8954, !- Year 10 Escalation [2034] + 0.9066, !- Year 11 Escalation [2035] + 0.9119, !- Year 12 Escalation [2036] + 0.9202, !- Year 13 Escalation [2037] + 0.9321, !- Year 14 Escalation [2038] + 0.9333, !- Year 15 Escalation [2039] + 0.9418, !- Year 16 Escalation [2040] + 0.9504, !- Year 17 Escalation [2041] + 0.9513, !- Year 18 Escalation [2042] + 0.9489, !- Year 19 Escalation [2043] + 0.9454, !- Year 20 Escalation [2044] + 0.9456, !- Year 21 Escalation [2045] + 0.9446, !- Year 22 Escalation [2046] + 0.9425, !- Year 23 Escalation [2047] + 0.9394, !- Year 24 Escalation [2048] + 0.9380, !- Year 25 Escalation [2049] + 0.9380, !- Year 26 Escalation [2050] + 0.9364, !- Year 27 Escalation [2051] + 0.9347, !- Year 28 Escalation [2052] + 0.9331, !- Year 29 Escalation [2053] + 0.9315; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + EastSouthCentral Residential-LPG, !- Name + Propane, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9333, !- Year 1 Escalation [2025] + 0.8804, !- Year 2 Escalation [2026] + 0.8500, !- Year 3 Escalation [2027] + 0.8357, !- Year 4 Escalation [2028] + 0.8410, !- Year 5 Escalation [2029] + 0.8491, !- Year 6 Escalation [2030] + 0.8609, !- Year 7 Escalation [2031] + 0.8695, !- Year 8 Escalation [2032] + 0.8828, !- Year 9 Escalation [2033] + 0.8954, !- Year 10 Escalation [2034] + 0.9066, !- Year 11 Escalation [2035] + 0.9119, !- Year 12 Escalation [2036] + 0.9202, !- Year 13 Escalation [2037] + 0.9321, !- Year 14 Escalation [2038] + 0.9333, !- Year 15 Escalation [2039] + 0.9418, !- Year 16 Escalation [2040] + 0.9504, !- Year 17 Escalation [2041] + 0.9513, !- Year 18 Escalation [2042] + 0.9489, !- Year 19 Escalation [2043] + 0.9454, !- Year 20 Escalation [2044] + 0.9456, !- Year 21 Escalation [2045] + 0.9446, !- Year 22 Escalation [2046] + 0.9425, !- Year 23 Escalation [2047] + 0.9394, !- Year 24 Escalation [2048] + 0.9380, !- Year 25 Escalation [2049] + 0.9380, !- Year 26 Escalation [2050] + 0.9364, !- Year 27 Escalation [2051] + 0.9347, !- Year 28 Escalation [2052] + 0.9331, !- Year 29 Escalation [2053] + 0.9315; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + EastSouthCentral Commercial-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9626, !- Year 1 Escalation [2025] + 0.9292, !- Year 2 Escalation [2026] + 0.9081, !- Year 3 Escalation [2027] + 0.8942, !- Year 4 Escalation [2028] + 0.8890, !- Year 5 Escalation [2029] + 0.8800, !- Year 6 Escalation [2030] + 0.8776, !- Year 7 Escalation [2031] + 0.8825, !- Year 8 Escalation [2032] + 0.9072, !- Year 9 Escalation [2033] + 0.9067, !- Year 10 Escalation [2034] + 0.8997, !- Year 11 Escalation [2035] + 0.9161, !- Year 12 Escalation [2036] + 0.9244, !- Year 13 Escalation [2037] + 0.9327, !- Year 14 Escalation [2038] + 0.9395, !- Year 15 Escalation [2039] + 0.9410, !- Year 16 Escalation [2040] + 0.9446, !- Year 17 Escalation [2041] + 0.9422, !- Year 18 Escalation [2042] + 0.9421, !- Year 19 Escalation [2043] + 0.9420, !- Year 20 Escalation [2044] + 0.9372, !- Year 21 Escalation [2045] + 0.9308, !- Year 22 Escalation [2046] + 0.9243, !- Year 23 Escalation [2047] + 0.9263, !- Year 24 Escalation [2048] + 0.9204, !- Year 25 Escalation [2049] + 0.9234, !- Year 26 Escalation [2050] + 0.9215, !- Year 27 Escalation [2051] + 0.9197, !- Year 28 Escalation [2052] + 0.9179, !- Year 29 Escalation [2053] + 0.9161; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + EastSouthCentral Commercial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9098, !- Year 1 Escalation [2025] + 0.8579, !- Year 2 Escalation [2026] + 0.8074, !- Year 3 Escalation [2027] + 0.7620, !- Year 4 Escalation [2028] + 0.7650, !- Year 5 Escalation [2029] + 0.7644, !- Year 6 Escalation [2030] + 0.7703, !- Year 7 Escalation [2031] + 0.7731, !- Year 8 Escalation [2032] + 0.7771, !- Year 9 Escalation [2033] + 0.7790, !- Year 10 Escalation [2034] + 0.7843, !- Year 11 Escalation [2035] + 0.7854, !- Year 12 Escalation [2036] + 0.7895, !- Year 13 Escalation [2037] + 0.7924, !- Year 14 Escalation [2038] + 0.7942, !- Year 15 Escalation [2039] + 0.7960, !- Year 16 Escalation [2040] + 0.8015, !- Year 17 Escalation [2041] + 0.8014, !- Year 18 Escalation [2042] + 0.8054, !- Year 19 Escalation [2043] + 0.8025, !- Year 20 Escalation [2044] + 0.8041, !- Year 21 Escalation [2045] + 0.8114, !- Year 22 Escalation [2046] + 0.8121, !- Year 23 Escalation [2047] + 0.8135, !- Year 24 Escalation [2048] + 0.8160, !- Year 25 Escalation [2049] + 0.8164, !- Year 26 Escalation [2050] + 0.8176, !- Year 27 Escalation [2051] + 0.8188, !- Year 28 Escalation [2052] + 0.8201, !- Year 29 Escalation [2053] + 0.8213; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + EastSouthCentral Commercial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0708, !- Year 1 Escalation [2025] + 1.2414, !- Year 2 Escalation [2026] + 1.4118, !- Year 3 Escalation [2027] + 1.5811, !- Year 4 Escalation [2028] + 1.5901, !- Year 5 Escalation [2029] + 1.5996, !- Year 6 Escalation [2030] + 1.6099, !- Year 7 Escalation [2031] + 1.6200, !- Year 8 Escalation [2032] + 1.6292, !- Year 9 Escalation [2033] + 1.6394, !- Year 10 Escalation [2034] + 1.6505, !- Year 11 Escalation [2035] + 1.6593, !- Year 12 Escalation [2036] + 1.6681, !- Year 13 Escalation [2037] + 1.6783, !- Year 14 Escalation [2038] + 1.6858, !- Year 15 Escalation [2039] + 1.6941, !- Year 16 Escalation [2040] + 1.7063, !- Year 17 Escalation [2041] + 1.7077, !- Year 18 Escalation [2042] + 1.7149, !- Year 19 Escalation [2043] + 1.7112, !- Year 20 Escalation [2044] + 1.7166, !- Year 21 Escalation [2045] + 1.7346, !- Year 22 Escalation [2046] + 1.7347, !- Year 23 Escalation [2047] + 1.7448, !- Year 24 Escalation [2048] + 1.7525, !- Year 25 Escalation [2049] + 1.7592, !- Year 26 Escalation [2050] + 1.7654, !- Year 27 Escalation [2051] + 1.7717, !- Year 28 Escalation [2052] + 1.7779, !- Year 29 Escalation [2053] + 1.7842; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + EastSouthCentral Commercial-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9735, !- Year 1 Escalation [2025] + 0.9542, !- Year 2 Escalation [2026] + 0.9518, !- Year 3 Escalation [2027] + 0.9629, !- Year 4 Escalation [2028] + 0.9675, !- Year 5 Escalation [2029] + 0.9752, !- Year 6 Escalation [2030] + 0.9867, !- Year 7 Escalation [2031] + 0.9982, !- Year 8 Escalation [2032] + 1.0153, !- Year 9 Escalation [2033] + 1.0279, !- Year 10 Escalation [2034] + 1.0381, !- Year 11 Escalation [2035] + 1.0414, !- Year 12 Escalation [2036] + 1.0473, !- Year 13 Escalation [2037] + 1.0578, !- Year 14 Escalation [2038] + 1.0553, !- Year 15 Escalation [2039] + 1.0649, !- Year 16 Escalation [2040] + 1.0730, !- Year 17 Escalation [2041] + 1.0739, !- Year 18 Escalation [2042] + 1.0710, !- Year 19 Escalation [2043] + 1.0686, !- Year 20 Escalation [2044] + 1.0697, !- Year 21 Escalation [2045] + 1.0697, !- Year 22 Escalation [2046] + 1.0681, !- Year 23 Escalation [2047] + 1.0665, !- Year 24 Escalation [2048] + 1.0648, !- Year 25 Escalation [2049] + 1.0649, !- Year 26 Escalation [2050] + 1.0637, !- Year 27 Escalation [2051] + 1.0625, !- Year 28 Escalation [2052] + 1.0613, !- Year 29 Escalation [2053] + 1.0601; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + EastSouthCentral Industrial-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9522, !- Year 1 Escalation [2025] + 0.9039, !- Year 2 Escalation [2026] + 0.8729, !- Year 3 Escalation [2027] + 0.8539, !- Year 4 Escalation [2028] + 0.8419, !- Year 5 Escalation [2029] + 0.8347, !- Year 6 Escalation [2030] + 0.8350, !- Year 7 Escalation [2031] + 0.8408, !- Year 8 Escalation [2032] + 0.8715, !- Year 9 Escalation [2033] + 0.8721, !- Year 10 Escalation [2034] + 0.8639, !- Year 11 Escalation [2035] + 0.8859, !- Year 12 Escalation [2036] + 0.8944, !- Year 13 Escalation [2037] + 0.9069, !- Year 14 Escalation [2038] + 0.9200, !- Year 15 Escalation [2039] + 0.9200, !- Year 16 Escalation [2040] + 0.9258, !- Year 17 Escalation [2041] + 0.9286, !- Year 18 Escalation [2042] + 0.9289, !- Year 19 Escalation [2043] + 0.9311, !- Year 20 Escalation [2044] + 0.9261, !- Year 21 Escalation [2045] + 0.9126, !- Year 22 Escalation [2046] + 0.9050, !- Year 23 Escalation [2047] + 0.9057, !- Year 24 Escalation [2048] + 0.8975, !- Year 25 Escalation [2049] + 0.8991, !- Year 26 Escalation [2050] + 0.8958, !- Year 27 Escalation [2051] + 0.8925, !- Year 28 Escalation [2052] + 0.8892, !- Year 29 Escalation [2053] + 0.8860; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + EastSouthCentral Industrial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9110, !- Year 1 Escalation [2025] + 0.8587, !- Year 2 Escalation [2026] + 0.8077, !- Year 3 Escalation [2027] + 0.7620, !- Year 4 Escalation [2028] + 0.7649, !- Year 5 Escalation [2029] + 0.7642, !- Year 6 Escalation [2030] + 0.7699, !- Year 7 Escalation [2031] + 0.7727, !- Year 8 Escalation [2032] + 0.7767, !- Year 9 Escalation [2033] + 0.7783, !- Year 10 Escalation [2034] + 0.7837, !- Year 11 Escalation [2035] + 0.7846, !- Year 12 Escalation [2036] + 0.7886, !- Year 13 Escalation [2037] + 0.7914, !- Year 14 Escalation [2038] + 0.7930, !- Year 15 Escalation [2039] + 0.7947, !- Year 16 Escalation [2040] + 0.7999, !- Year 17 Escalation [2041] + 0.7999, !- Year 18 Escalation [2042] + 0.8036, !- Year 19 Escalation [2043] + 0.8008, !- Year 20 Escalation [2044] + 0.8023, !- Year 21 Escalation [2045] + 0.8094, !- Year 22 Escalation [2046] + 0.8100, !- Year 23 Escalation [2047] + 0.8114, !- Year 24 Escalation [2048] + 0.8138, !- Year 25 Escalation [2049] + 0.8140, !- Year 26 Escalation [2050] + 0.8152, !- Year 27 Escalation [2051] + 0.8163, !- Year 28 Escalation [2052] + 0.8175, !- Year 29 Escalation [2053] + 0.8186; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + EastSouthCentral Industrial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0686, !- Year 1 Escalation [2025] + 1.2363, !- Year 2 Escalation [2026] + 1.4038, !- Year 3 Escalation [2027] + 1.5702, !- Year 4 Escalation [2028] + 1.5792, !- Year 5 Escalation [2029] + 1.5887, !- Year 6 Escalation [2030] + 1.5989, !- Year 7 Escalation [2031] + 1.6089, !- Year 8 Escalation [2032] + 1.6180, !- Year 9 Escalation [2033] + 1.6281, !- Year 10 Escalation [2034] + 1.6392, !- Year 11 Escalation [2035] + 1.6479, !- Year 12 Escalation [2036] + 1.6566, !- Year 13 Escalation [2037] + 1.6667, !- Year 14 Escalation [2038] + 1.6742, !- Year 15 Escalation [2039] + 1.6824, !- Year 16 Escalation [2040] + 1.6946, !- Year 17 Escalation [2041] + 1.6960, !- Year 18 Escalation [2042] + 1.7032, !- Year 19 Escalation [2043] + 1.6995, !- Year 20 Escalation [2044] + 1.7048, !- Year 21 Escalation [2045] + 1.7227, !- Year 22 Escalation [2046] + 1.7228, !- Year 23 Escalation [2047] + 1.7328, !- Year 24 Escalation [2048] + 1.7404, !- Year 25 Escalation [2049] + 1.7471, !- Year 26 Escalation [2050] + 1.7533, !- Year 27 Escalation [2051] + 1.7595, !- Year 28 Escalation [2052] + 1.7657, !- Year 29 Escalation [2053] + 1.7720; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + EastSouthCentral Industrial-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.8835, !- Year 1 Escalation [2025] + 0.7972, !- Year 2 Escalation [2026] + 0.7524, !- Year 3 Escalation [2027] + 0.7388, !- Year 4 Escalation [2028] + 0.7422, !- Year 5 Escalation [2029] + 0.7567, !- Year 6 Escalation [2030] + 0.7786, !- Year 7 Escalation [2031] + 0.8039, !- Year 8 Escalation [2032] + 0.8391, !- Year 9 Escalation [2033] + 0.8642, !- Year 10 Escalation [2034] + 0.8849, !- Year 11 Escalation [2035] + 0.8874, !- Year 12 Escalation [2036] + 0.8964, !- Year 13 Escalation [2037] + 0.9202, !- Year 14 Escalation [2038] + 0.9077, !- Year 15 Escalation [2039] + 0.9334, !- Year 16 Escalation [2040] + 0.9491, !- Year 17 Escalation [2041] + 0.9470, !- Year 18 Escalation [2042] + 0.9348, !- Year 19 Escalation [2043] + 0.9262, !- Year 20 Escalation [2044] + 0.9244, !- Year 21 Escalation [2045] + 0.9222, !- Year 22 Escalation [2046] + 0.9147, !- Year 23 Escalation [2047] + 0.9091, !- Year 24 Escalation [2048] + 0.8978, !- Year 25 Escalation [2049] + 0.8951, !- Year 26 Escalation [2050] + 0.8884, !- Year 27 Escalation [2051] + 0.8818, !- Year 28 Escalation [2052] + 0.8753, !- Year 29 Escalation [2053] + 0.8688; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + EastSouthCentral Industrial-Coal, !- Name + Coal, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0171, !- Year 1 Escalation [2025] + 1.0223, !- Year 2 Escalation [2026] + 1.0237, !- Year 3 Escalation [2027] + 1.0259, !- Year 4 Escalation [2028] + 1.0299, !- Year 5 Escalation [2029] + 1.0345, !- Year 6 Escalation [2030] + 1.0407, !- Year 7 Escalation [2031] + 1.0453, !- Year 8 Escalation [2032] + 1.0506, !- Year 9 Escalation [2033] + 1.0557, !- Year 10 Escalation [2034] + 1.0605, !- Year 11 Escalation [2035] + 1.0657, !- Year 12 Escalation [2036] + 1.0715, !- Year 13 Escalation [2037] + 1.0729, !- Year 14 Escalation [2038] + 1.0783, !- Year 15 Escalation [2039] + 1.0825, !- Year 16 Escalation [2040] + 1.0865, !- Year 17 Escalation [2041] + 1.0894, !- Year 18 Escalation [2042] + 1.0936, !- Year 19 Escalation [2043] + 1.0975, !- Year 20 Escalation [2044] + 1.1016, !- Year 21 Escalation [2045] + 1.1053, !- Year 22 Escalation [2046] + 1.1090, !- Year 23 Escalation [2047] + 1.1128, !- Year 24 Escalation [2048] + 1.1169, !- Year 25 Escalation [2049] + 1.1207, !- Year 26 Escalation [2050] + 1.1246, !- Year 27 Escalation [2051] + 1.1285, !- Year 28 Escalation [2052] + 1.1325, !- Year 29 Escalation [2053] + 1.1364; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + WestSouthCentral Residential-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9765, !- Year 1 Escalation [2025] + 0.9504, !- Year 2 Escalation [2026] + 0.9318, !- Year 3 Escalation [2027] + 0.9145, !- Year 4 Escalation [2028] + 0.9119, !- Year 5 Escalation [2029] + 0.9301, !- Year 6 Escalation [2030] + 0.9365, !- Year 7 Escalation [2031] + 0.9292, !- Year 8 Escalation [2032] + 0.9511, !- Year 9 Escalation [2033] + 0.9641, !- Year 10 Escalation [2034] + 0.9679, !- Year 11 Escalation [2035] + 0.9731, !- Year 12 Escalation [2036] + 0.9737, !- Year 13 Escalation [2037] + 0.9763, !- Year 14 Escalation [2038] + 0.9742, !- Year 15 Escalation [2039] + 0.9802, !- Year 16 Escalation [2040] + 0.9900, !- Year 17 Escalation [2041] + 0.9997, !- Year 18 Escalation [2042] + 1.0069, !- Year 19 Escalation [2043] + 1.0098, !- Year 20 Escalation [2044] + 1.0042, !- Year 21 Escalation [2045] + 0.9901, !- Year 22 Escalation [2046] + 0.9821, !- Year 23 Escalation [2047] + 0.9770, !- Year 24 Escalation [2048] + 0.9767, !- Year 25 Escalation [2049] + 0.9576, !- Year 26 Escalation [2050] + 0.9496, !- Year 27 Escalation [2051] + 0.9417, !- Year 28 Escalation [2052] + 0.9339, !- Year 29 Escalation [2053] + 0.9262; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + WestSouthCentral Residential-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9468, !- Year 1 Escalation [2025] + 0.9328, !- Year 2 Escalation [2026] + 0.9171, !- Year 3 Escalation [2027] + 0.9057, !- Year 4 Escalation [2028] + 0.9084, !- Year 5 Escalation [2029] + 0.9106, !- Year 6 Escalation [2030] + 0.9157, !- Year 7 Escalation [2031] + 0.9199, !- Year 8 Escalation [2032] + 0.9218, !- Year 9 Escalation [2033] + 0.9255, !- Year 10 Escalation [2034] + 0.9291, !- Year 11 Escalation [2035] + 0.9314, !- Year 12 Escalation [2036] + 0.9345, !- Year 13 Escalation [2037] + 0.9379, !- Year 14 Escalation [2038] + 0.9404, !- Year 15 Escalation [2039] + 0.9428, !- Year 16 Escalation [2040] + 0.9485, !- Year 17 Escalation [2041] + 0.9485, !- Year 18 Escalation [2042] + 0.9526, !- Year 19 Escalation [2043] + 0.9497, !- Year 20 Escalation [2044] + 0.9522, !- Year 21 Escalation [2045] + 0.9588, !- Year 22 Escalation [2046] + 0.9597, !- Year 23 Escalation [2047] + 0.9610, !- Year 24 Escalation [2048] + 0.9637, !- Year 25 Escalation [2049] + 0.9649, !- Year 26 Escalation [2050] + 0.9664, !- Year 27 Escalation [2051] + 0.9679, !- Year 28 Escalation [2052] + 0.9695, !- Year 29 Escalation [2053] + 0.9710; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + WestSouthCentral Residential-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9535, !- Year 1 Escalation [2025] + 0.9143, !- Year 2 Escalation [2026] + 0.8906, !- Year 3 Escalation [2027] + 0.8774, !- Year 4 Escalation [2028] + 0.8853, !- Year 5 Escalation [2029] + 0.8963, !- Year 6 Escalation [2030] + 0.9108, !- Year 7 Escalation [2031] + 0.9241, !- Year 8 Escalation [2032] + 0.9413, !- Year 9 Escalation [2033] + 0.9557, !- Year 10 Escalation [2034] + 0.9678, !- Year 11 Escalation [2035] + 0.9731, !- Year 12 Escalation [2036] + 0.9803, !- Year 13 Escalation [2037] + 0.9921, !- Year 14 Escalation [2038] + 0.9919, !- Year 15 Escalation [2039] + 1.0034, !- Year 16 Escalation [2040] + 1.0132, !- Year 17 Escalation [2041] + 1.0171, !- Year 18 Escalation [2042] + 1.0176, !- Year 19 Escalation [2043] + 1.0189, !- Year 20 Escalation [2044] + 1.0229, !- Year 21 Escalation [2045] + 1.0261, !- Year 22 Escalation [2046] + 1.0277, !- Year 23 Escalation [2047] + 1.0295, !- Year 24 Escalation [2048] + 1.0307, !- Year 25 Escalation [2049] + 1.0336, !- Year 26 Escalation [2050] + 1.0355, !- Year 27 Escalation [2051] + 1.0374, !- Year 28 Escalation [2052] + 1.0393, !- Year 29 Escalation [2053] + 1.0412; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + WestSouthCentral Residential-LPG, !- Name + Propane, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9659, !- Year 1 Escalation [2025] + 0.9309, !- Year 2 Escalation [2026] + 0.9026, !- Year 3 Escalation [2027] + 0.8865, !- Year 4 Escalation [2028] + 0.8803, !- Year 5 Escalation [2029] + 0.8831, !- Year 6 Escalation [2030] + 0.8923, !- Year 7 Escalation [2031] + 0.9070, !- Year 8 Escalation [2032] + 0.9257, !- Year 9 Escalation [2033] + 0.9444, !- Year 10 Escalation [2034] + 0.9594, !- Year 11 Escalation [2035] + 0.9707, !- Year 12 Escalation [2036] + 0.9807, !- Year 13 Escalation [2037] + 0.9936, !- Year 14 Escalation [2038] + 0.9999, !- Year 15 Escalation [2039] + 1.0101, !- Year 16 Escalation [2040] + 1.0201, !- Year 17 Escalation [2041] + 1.0272, !- Year 18 Escalation [2042] + 1.0309, !- Year 19 Escalation [2043] + 1.0317, !- Year 20 Escalation [2044] + 1.0336, !- Year 21 Escalation [2045] + 1.0343, !- Year 22 Escalation [2046] + 1.0354, !- Year 23 Escalation [2047] + 1.0379, !- Year 24 Escalation [2048] + 1.0387, !- Year 25 Escalation [2049] + 1.0381, !- Year 26 Escalation [2050] + 1.0390, !- Year 27 Escalation [2051] + 1.0400, !- Year 28 Escalation [2052] + 1.0410, !- Year 29 Escalation [2053] + 1.0419; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + WestSouthCentral Commercial-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9679, !- Year 1 Escalation [2025] + 0.9368, !- Year 2 Escalation [2026] + 0.9134, !- Year 3 Escalation [2027] + 0.8867, !- Year 4 Escalation [2028] + 0.8823, !- Year 5 Escalation [2029] + 0.9041, !- Year 6 Escalation [2030] + 0.9082, !- Year 7 Escalation [2031] + 0.8920, !- Year 8 Escalation [2032] + 0.9124, !- Year 9 Escalation [2033] + 0.9236, !- Year 10 Escalation [2034] + 0.9264, !- Year 11 Escalation [2035] + 0.9302, !- Year 12 Escalation [2036] + 0.9252, !- Year 13 Escalation [2037] + 0.9215, !- Year 14 Escalation [2038] + 0.9138, !- Year 15 Escalation [2039] + 0.9201, !- Year 16 Escalation [2040] + 0.9300, !- Year 17 Escalation [2041] + 0.9419, !- Year 18 Escalation [2042] + 0.9514, !- Year 19 Escalation [2043] + 0.9536, !- Year 20 Escalation [2044] + 0.9453, !- Year 21 Escalation [2045] + 0.9220, !- Year 22 Escalation [2046] + 0.9037, !- Year 23 Escalation [2047] + 0.8965, !- Year 24 Escalation [2048] + 0.8947, !- Year 25 Escalation [2049] + 0.8724, !- Year 26 Escalation [2050] + 0.8605, !- Year 27 Escalation [2051] + 0.8487, !- Year 28 Escalation [2052] + 0.8371, !- Year 29 Escalation [2053] + 0.8257; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + WestSouthCentral Commercial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9086, !- Year 1 Escalation [2025] + 0.8572, !- Year 2 Escalation [2026] + 0.8056, !- Year 3 Escalation [2027] + 0.7588, !- Year 4 Escalation [2028] + 0.7618, !- Year 5 Escalation [2029] + 0.7635, !- Year 6 Escalation [2030] + 0.7685, !- Year 7 Escalation [2031] + 0.7731, !- Year 8 Escalation [2032] + 0.7766, !- Year 9 Escalation [2033] + 0.7790, !- Year 10 Escalation [2034] + 0.7846, !- Year 11 Escalation [2035] + 0.7856, !- Year 12 Escalation [2036] + 0.7896, !- Year 13 Escalation [2037] + 0.7929, !- Year 14 Escalation [2038] + 0.7948, !- Year 15 Escalation [2039] + 0.7967, !- Year 16 Escalation [2040] + 0.8022, !- Year 17 Escalation [2041] + 0.8021, !- Year 18 Escalation [2042] + 0.8062, !- Year 19 Escalation [2043] + 0.8032, !- Year 20 Escalation [2044] + 0.8049, !- Year 21 Escalation [2045] + 0.8118, !- Year 22 Escalation [2046] + 0.8129, !- Year 23 Escalation [2047] + 0.8142, !- Year 24 Escalation [2048] + 0.8167, !- Year 25 Escalation [2049] + 0.8173, !- Year 26 Escalation [2050] + 0.8186, !- Year 27 Escalation [2051] + 0.8200, !- Year 28 Escalation [2052] + 0.8214, !- Year 29 Escalation [2053] + 0.8228; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + WestSouthCentral Commercial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0737, !- Year 1 Escalation [2025] + 1.2393, !- Year 2 Escalation [2026] + 1.4047, !- Year 3 Escalation [2027] + 1.5690, !- Year 4 Escalation [2028] + 1.5776, !- Year 5 Escalation [2029] + 1.5866, !- Year 6 Escalation [2030] + 1.5964, !- Year 7 Escalation [2031] + 1.6060, !- Year 8 Escalation [2032] + 1.6147, !- Year 9 Escalation [2033] + 1.6243, !- Year 10 Escalation [2034] + 1.6349, !- Year 11 Escalation [2035] + 1.6433, !- Year 12 Escalation [2036] + 1.6516, !- Year 13 Escalation [2037] + 1.6613, !- Year 14 Escalation [2038] + 1.6684, !- Year 15 Escalation [2039] + 1.6762, !- Year 16 Escalation [2040] + 1.6879, !- Year 17 Escalation [2041] + 1.6892, !- Year 18 Escalation [2042] + 1.6961, !- Year 19 Escalation [2043] + 1.6926, !- Year 20 Escalation [2044] + 1.6976, !- Year 21 Escalation [2045] + 1.7147, !- Year 22 Escalation [2046] + 1.7148, !- Year 23 Escalation [2047] + 1.7244, !- Year 24 Escalation [2048] + 1.7317, !- Year 25 Escalation [2049] + 1.7381, !- Year 26 Escalation [2050] + 1.7440, !- Year 27 Escalation [2051] + 1.7499, !- Year 28 Escalation [2052] + 1.7559, !- Year 29 Escalation [2053] + 1.7618; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + WestSouthCentral Commercial-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9430, !- Year 1 Escalation [2025] + 0.8961, !- Year 2 Escalation [2026] + 0.8732, !- Year 3 Escalation [2027] + 0.8660, !- Year 4 Escalation [2028] + 0.8703, !- Year 5 Escalation [2029] + 0.8804, !- Year 6 Escalation [2030] + 0.8961, !- Year 7 Escalation [2031] + 0.9107, !- Year 8 Escalation [2032] + 0.9320, !- Year 9 Escalation [2033] + 0.9493, !- Year 10 Escalation [2034] + 0.9631, !- Year 11 Escalation [2035] + 0.9658, !- Year 12 Escalation [2036] + 0.9718, !- Year 13 Escalation [2037] + 0.9853, !- Year 14 Escalation [2038] + 0.9798, !- Year 15 Escalation [2039] + 0.9930, !- Year 16 Escalation [2040] + 1.0033, !- Year 17 Escalation [2041] + 1.0045, !- Year 18 Escalation [2042] + 1.0002, !- Year 19 Escalation [2043] + 0.9967, !- Year 20 Escalation [2044] + 0.9978, !- Year 21 Escalation [2045] + 0.9977, !- Year 22 Escalation [2046] + 0.9953, !- Year 23 Escalation [2047] + 0.9932, !- Year 24 Escalation [2048] + 0.9902, !- Year 25 Escalation [2049] + 0.9900, !- Year 26 Escalation [2050] + 0.9881, !- Year 27 Escalation [2051] + 0.9862, !- Year 28 Escalation [2052] + 0.9843, !- Year 29 Escalation [2053] + 0.9824; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + WestSouthCentral Industrial-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9511, !- Year 1 Escalation [2025] + 0.9069, !- Year 2 Escalation [2026] + 0.8814, !- Year 3 Escalation [2027] + 0.8622, !- Year 4 Escalation [2028] + 0.8585, !- Year 5 Escalation [2029] + 0.8725, !- Year 6 Escalation [2030] + 0.8790, !- Year 7 Escalation [2031] + 0.8794, !- Year 8 Escalation [2032] + 0.9081, !- Year 9 Escalation [2033] + 0.9210, !- Year 10 Escalation [2034] + 0.9255, !- Year 11 Escalation [2035] + 0.9358, !- Year 12 Escalation [2036] + 0.9421, !- Year 13 Escalation [2037] + 0.9565, !- Year 14 Escalation [2038] + 0.9574, !- Year 15 Escalation [2039] + 0.9663, !- Year 16 Escalation [2040] + 0.9801, !- Year 17 Escalation [2041] + 0.9820, !- Year 18 Escalation [2042] + 0.9832, !- Year 19 Escalation [2043] + 0.9828, !- Year 20 Escalation [2044] + 0.9741, !- Year 21 Escalation [2045] + 0.9627, !- Year 22 Escalation [2046] + 0.9552, !- Year 23 Escalation [2047] + 0.9497, !- Year 24 Escalation [2048] + 0.9476, !- Year 25 Escalation [2049] + 0.9313, !- Year 26 Escalation [2050] + 0.9236, !- Year 27 Escalation [2051] + 0.9160, !- Year 28 Escalation [2052] + 0.9084, !- Year 29 Escalation [2053] + 0.9009; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + WestSouthCentral Industrial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9110, !- Year 1 Escalation [2025] + 0.8601, !- Year 2 Escalation [2026] + 0.8094, !- Year 3 Escalation [2027] + 0.7633, !- Year 4 Escalation [2028] + 0.7663, !- Year 5 Escalation [2029] + 0.7678, !- Year 6 Escalation [2030] + 0.7726, !- Year 7 Escalation [2031] + 0.7770, !- Year 8 Escalation [2032] + 0.7806, !- Year 9 Escalation [2033] + 0.7827, !- Year 10 Escalation [2034] + 0.7883, !- Year 11 Escalation [2035] + 0.7891, !- Year 12 Escalation [2036] + 0.7931, !- Year 13 Escalation [2037] + 0.7962, !- Year 14 Escalation [2038] + 0.7979, !- Year 15 Escalation [2039] + 0.7997, !- Year 16 Escalation [2040] + 0.8049, !- Year 17 Escalation [2041] + 0.8048, !- Year 18 Escalation [2042] + 0.8087, !- Year 19 Escalation [2043] + 0.8058, !- Year 20 Escalation [2044] + 0.8073, !- Year 21 Escalation [2045] + 0.8139, !- Year 22 Escalation [2046] + 0.8150, !- Year 23 Escalation [2047] + 0.8163, !- Year 24 Escalation [2048] + 0.8187, !- Year 25 Escalation [2049] + 0.8191, !- Year 26 Escalation [2050] + 0.8204, !- Year 27 Escalation [2051] + 0.8217, !- Year 28 Escalation [2052] + 0.8229, !- Year 29 Escalation [2053] + 0.8242; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + WestSouthCentral Industrial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0742, !- Year 1 Escalation [2025] + 1.2405, !- Year 2 Escalation [2026] + 1.4066, !- Year 3 Escalation [2027] + 1.5716, !- Year 4 Escalation [2028] + 1.5802, !- Year 5 Escalation [2029] + 1.5893, !- Year 6 Escalation [2030] + 1.5990, !- Year 7 Escalation [2031] + 1.6086, !- Year 8 Escalation [2032] + 1.6174, !- Year 9 Escalation [2033] + 1.6270, !- Year 10 Escalation [2034] + 1.6376, !- Year 11 Escalation [2035] + 1.6460, !- Year 12 Escalation [2036] + 1.6543, !- Year 13 Escalation [2037] + 1.6640, !- Year 14 Escalation [2038] + 1.6711, !- Year 15 Escalation [2039] + 1.6790, !- Year 16 Escalation [2040] + 1.6907, !- Year 17 Escalation [2041] + 1.6920, !- Year 18 Escalation [2042] + 1.6989, !- Year 19 Escalation [2043] + 1.6953, !- Year 20 Escalation [2044] + 1.7004, !- Year 21 Escalation [2045] + 1.7175, !- Year 22 Escalation [2046] + 1.7176, !- Year 23 Escalation [2047] + 1.7273, !- Year 24 Escalation [2048] + 1.7345, !- Year 25 Escalation [2049] + 1.7410, !- Year 26 Escalation [2050] + 1.7469, !- Year 27 Escalation [2051] + 1.7528, !- Year 28 Escalation [2052] + 1.7588, !- Year 29 Escalation [2053] + 1.7647; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + WestSouthCentral Industrial-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.8734, !- Year 1 Escalation [2025] + 0.7802, !- Year 2 Escalation [2026] + 0.7334, !- Year 3 Escalation [2027] + 0.7218, !- Year 4 Escalation [2028] + 0.7278, !- Year 5 Escalation [2029] + 0.7492, !- Year 6 Escalation [2030] + 0.7810, !- Year 7 Escalation [2031] + 0.8147, !- Year 8 Escalation [2032] + 0.8564, !- Year 9 Escalation [2033] + 0.8893, !- Year 10 Escalation [2034] + 0.9171, !- Year 11 Escalation [2035] + 0.9195, !- Year 12 Escalation [2036] + 0.9269, !- Year 13 Escalation [2037] + 0.9553, !- Year 14 Escalation [2038] + 0.9372, !- Year 15 Escalation [2039] + 0.9690, !- Year 16 Escalation [2040] + 0.9868, !- Year 17 Escalation [2041] + 0.9849, !- Year 18 Escalation [2042] + 0.9710, !- Year 19 Escalation [2043] + 0.9624, !- Year 20 Escalation [2044] + 0.9613, !- Year 21 Escalation [2045] + 0.9597, !- Year 22 Escalation [2046] + 0.9515, !- Year 23 Escalation [2047] + 0.9463, !- Year 24 Escalation [2048] + 0.9327, !- Year 25 Escalation [2049] + 0.9299, !- Year 26 Escalation [2050] + 0.9226, !- Year 27 Escalation [2051] + 0.9154, !- Year 28 Escalation [2052] + 0.9082, !- Year 29 Escalation [2053] + 0.9011; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + WestSouthCentral Industrial-Coal, !- Name + Coal, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9961, !- Year 1 Escalation [2025] + 1.0043, !- Year 2 Escalation [2026] + 1.0004, !- Year 3 Escalation [2027] + 0.9935, !- Year 4 Escalation [2028] + 0.9900, !- Year 5 Escalation [2029] + 0.9865, !- Year 6 Escalation [2030] + 0.9833, !- Year 7 Escalation [2031] + 0.9794, !- Year 8 Escalation [2032] + 1.0066, !- Year 9 Escalation [2033] + 1.0063, !- Year 10 Escalation [2034] + 1.0061, !- Year 11 Escalation [2035] + 1.0065, !- Year 12 Escalation [2036] + 1.0077, !- Year 13 Escalation [2037] + 1.0094, !- Year 14 Escalation [2038] + 1.0103, !- Year 15 Escalation [2039] + 1.0086, !- Year 16 Escalation [2040] + 1.0078, !- Year 17 Escalation [2041] + 1.0067, !- Year 18 Escalation [2042] + 1.0060, !- Year 19 Escalation [2043] + 0.9802, !- Year 20 Escalation [2044] + 0.9810, !- Year 21 Escalation [2045] + 0.9804, !- Year 22 Escalation [2046] + 0.9800, !- Year 23 Escalation [2047] + 0.9834, !- Year 24 Escalation [2048] + 0.9833, !- Year 25 Escalation [2049] + 0.9829, !- Year 26 Escalation [2050] + 0.9836, !- Year 27 Escalation [2051] + 0.9842, !- Year 28 Escalation [2052] + 0.9848, !- Year 29 Escalation [2053] + 0.9855; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + Mountain Residential-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9800, !- Year 1 Escalation [2025] + 0.9675, !- Year 2 Escalation [2026] + 0.9593, !- Year 3 Escalation [2027] + 0.9490, !- Year 4 Escalation [2028] + 0.9501, !- Year 5 Escalation [2029] + 0.9570, !- Year 6 Escalation [2030] + 0.9606, !- Year 7 Escalation [2031] + 0.9676, !- Year 8 Escalation [2032] + 0.9790, !- Year 9 Escalation [2033] + 0.9870, !- Year 10 Escalation [2034] + 0.9915, !- Year 11 Escalation [2035] + 0.9973, !- Year 12 Escalation [2036] + 1.0128, !- Year 13 Escalation [2037] + 1.0343, !- Year 14 Escalation [2038] + 1.0523, !- Year 15 Escalation [2039] + 1.0671, !- Year 16 Escalation [2040] + 1.0814, !- Year 17 Escalation [2041] + 1.0897, !- Year 18 Escalation [2042] + 1.0879, !- Year 19 Escalation [2043] + 1.0905, !- Year 20 Escalation [2044] + 1.0951, !- Year 21 Escalation [2045] + 1.1002, !- Year 22 Escalation [2046] + 1.1024, !- Year 23 Escalation [2047] + 1.1042, !- Year 24 Escalation [2048] + 1.1076, !- Year 25 Escalation [2049] + 1.1096, !- Year 26 Escalation [2050] + 1.1120, !- Year 27 Escalation [2051] + 1.1143, !- Year 28 Escalation [2052] + 1.1167, !- Year 29 Escalation [2053] + 1.1191; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + Mountain Residential-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9429, !- Year 1 Escalation [2025] + 0.9277, !- Year 2 Escalation [2026] + 0.9132, !- Year 3 Escalation [2027] + 0.9006, !- Year 4 Escalation [2028] + 0.9035, !- Year 5 Escalation [2029] + 0.9044, !- Year 6 Escalation [2030] + 0.9096, !- Year 7 Escalation [2031] + 0.9140, !- Year 8 Escalation [2032] + 0.9159, !- Year 9 Escalation [2033] + 0.9195, !- Year 10 Escalation [2034] + 0.9231, !- Year 11 Escalation [2035] + 0.9260, !- Year 12 Escalation [2036] + 0.9290, !- Year 13 Escalation [2037] + 0.9325, !- Year 14 Escalation [2038] + 0.9348, !- Year 15 Escalation [2039] + 0.9377, !- Year 16 Escalation [2040] + 0.9437, !- Year 17 Escalation [2041] + 0.9444, !- Year 18 Escalation [2042] + 0.9489, !- Year 19 Escalation [2043] + 0.9466, !- Year 20 Escalation [2044] + 0.9501, !- Year 21 Escalation [2045] + 0.9574, !- Year 22 Escalation [2046] + 0.9585, !- Year 23 Escalation [2047] + 0.9600, !- Year 24 Escalation [2048] + 0.9626, !- Year 25 Escalation [2049] + 0.9629, !- Year 26 Escalation [2050] + 0.9643, !- Year 27 Escalation [2051] + 0.9657, !- Year 28 Escalation [2052] + 0.9671, !- Year 29 Escalation [2053] + 0.9685; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + Mountain Residential-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9719, !- Year 1 Escalation [2025] + 0.9525, !- Year 2 Escalation [2026] + 0.9501, !- Year 3 Escalation [2027] + 0.9614, !- Year 4 Escalation [2028] + 0.9675, !- Year 5 Escalation [2029] + 0.9771, !- Year 6 Escalation [2030] + 0.9915, !- Year 7 Escalation [2031] + 1.0045, !- Year 8 Escalation [2032] + 1.0218, !- Year 9 Escalation [2033] + 1.0372, !- Year 10 Escalation [2034] + 1.0504, !- Year 11 Escalation [2035] + 1.0549, !- Year 12 Escalation [2036] + 1.0613, !- Year 13 Escalation [2037] + 1.0732, !- Year 14 Escalation [2038] + 1.0704, !- Year 15 Escalation [2039] + 1.0790, !- Year 16 Escalation [2040] + 1.0873, !- Year 17 Escalation [2041] + 1.0894, !- Year 18 Escalation [2042] + 1.0869, !- Year 19 Escalation [2043] + 1.0820, !- Year 20 Escalation [2044] + 1.0820, !- Year 21 Escalation [2045] + 1.0785, !- Year 22 Escalation [2046] + 1.0759, !- Year 23 Escalation [2047] + 1.0723, !- Year 24 Escalation [2048] + 1.0707, !- Year 25 Escalation [2049] + 1.0704, !- Year 26 Escalation [2050] + 1.0683, !- Year 27 Escalation [2051] + 1.0663, !- Year 28 Escalation [2052] + 1.0643, !- Year 29 Escalation [2053] + 1.0623; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + Mountain Residential-LPG, !- Name + Propane, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9659, !- Year 1 Escalation [2025] + 0.9309, !- Year 2 Escalation [2026] + 0.9026, !- Year 3 Escalation [2027] + 0.8865, !- Year 4 Escalation [2028] + 0.8803, !- Year 5 Escalation [2029] + 0.8831, !- Year 6 Escalation [2030] + 0.8923, !- Year 7 Escalation [2031] + 0.9070, !- Year 8 Escalation [2032] + 0.9257, !- Year 9 Escalation [2033] + 0.9444, !- Year 10 Escalation [2034] + 0.9594, !- Year 11 Escalation [2035] + 0.9707, !- Year 12 Escalation [2036] + 0.9807, !- Year 13 Escalation [2037] + 0.9936, !- Year 14 Escalation [2038] + 0.9999, !- Year 15 Escalation [2039] + 1.0101, !- Year 16 Escalation [2040] + 1.0201, !- Year 17 Escalation [2041] + 1.0272, !- Year 18 Escalation [2042] + 1.0309, !- Year 19 Escalation [2043] + 1.0317, !- Year 20 Escalation [2044] + 1.0336, !- Year 21 Escalation [2045] + 1.0343, !- Year 22 Escalation [2046] + 1.0354, !- Year 23 Escalation [2047] + 1.0379, !- Year 24 Escalation [2048] + 1.0387, !- Year 25 Escalation [2049] + 1.0381, !- Year 26 Escalation [2050] + 1.0390, !- Year 27 Escalation [2051] + 1.0400, !- Year 28 Escalation [2052] + 1.0410, !- Year 29 Escalation [2053] + 1.0419; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + Mountain Commercial-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9645, !- Year 1 Escalation [2025] + 0.9397, !- Year 2 Escalation [2026] + 0.9210, !- Year 3 Escalation [2027] + 0.9001, !- Year 4 Escalation [2028] + 0.8950, !- Year 5 Escalation [2029] + 0.8919, !- Year 6 Escalation [2030] + 0.8862, !- Year 7 Escalation [2031] + 0.8841, !- Year 8 Escalation [2032] + 0.8890, !- Year 9 Escalation [2033] + 0.8882, !- Year 10 Escalation [2034] + 0.8861, !- Year 11 Escalation [2035] + 0.8871, !- Year 12 Escalation [2036] + 0.9025, !- Year 13 Escalation [2037] + 0.9249, !- Year 14 Escalation [2038] + 0.9390, !- Year 15 Escalation [2039] + 0.9517, !- Year 16 Escalation [2040] + 0.9606, !- Year 17 Escalation [2041] + 0.9619, !- Year 18 Escalation [2042] + 0.9530, !- Year 19 Escalation [2043] + 0.9499, !- Year 20 Escalation [2044] + 0.9468, !- Year 21 Escalation [2045] + 0.9474, !- Year 22 Escalation [2046] + 0.9425, !- Year 23 Escalation [2047] + 0.9391, !- Year 24 Escalation [2048] + 0.9382, !- Year 25 Escalation [2049] + 0.9350, !- Year 26 Escalation [2050] + 0.9320, !- Year 27 Escalation [2051] + 0.9289, !- Year 28 Escalation [2052] + 0.9259, !- Year 29 Escalation [2053] + 0.9228; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + Mountain Commercial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9123, !- Year 1 Escalation [2025] + 0.8595, !- Year 2 Escalation [2026] + 0.8097, !- Year 3 Escalation [2027] + 0.7629, !- Year 4 Escalation [2028] + 0.7657, !- Year 5 Escalation [2029] + 0.7667, !- Year 6 Escalation [2030] + 0.7714, !- Year 7 Escalation [2031] + 0.7754, !- Year 8 Escalation [2032] + 0.7786, !- Year 9 Escalation [2033] + 0.7808, !- Year 10 Escalation [2034] + 0.7859, !- Year 11 Escalation [2035] + 0.7870, !- Year 12 Escalation [2036] + 0.7907, !- Year 13 Escalation [2037] + 0.7937, !- Year 14 Escalation [2038] + 0.7954, !- Year 15 Escalation [2039] + 0.7973, !- Year 16 Escalation [2040] + 0.8024, !- Year 17 Escalation [2041] + 0.8026, !- Year 18 Escalation [2042] + 0.8068, !- Year 19 Escalation [2043] + 0.8050, !- Year 20 Escalation [2044] + 0.8072, !- Year 21 Escalation [2045] + 0.8146, !- Year 22 Escalation [2046] + 0.8153, !- Year 23 Escalation [2047] + 0.8165, !- Year 24 Escalation [2048] + 0.8191, !- Year 25 Escalation [2049] + 0.8195, !- Year 26 Escalation [2050] + 0.8207, !- Year 27 Escalation [2051] + 0.8219, !- Year 28 Escalation [2052] + 0.8231, !- Year 29 Escalation [2053] + 0.8244; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + Mountain Commercial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0487, !- Year 1 Escalation [2025] + 1.2233, !- Year 2 Escalation [2026] + 1.3920, !- Year 3 Escalation [2027] + 1.5656, !- Year 4 Escalation [2028] + 1.5765, !- Year 5 Escalation [2029] + 1.5857, !- Year 6 Escalation [2030] + 1.5942, !- Year 7 Escalation [2031] + 1.6058, !- Year 8 Escalation [2032] + 1.6138, !- Year 9 Escalation [2033] + 1.6204, !- Year 10 Escalation [2034] + 1.6334, !- Year 11 Escalation [2035] + 1.6533, !- Year 12 Escalation [2036] + 1.6592, !- Year 13 Escalation [2037] + 1.6707, !- Year 14 Escalation [2038] + 1.6796, !- Year 15 Escalation [2039] + 1.6853, !- Year 16 Escalation [2040] + 1.6997, !- Year 17 Escalation [2041] + 1.7053, !- Year 18 Escalation [2042] + 1.7089, !- Year 19 Escalation [2043] + 1.7218, !- Year 20 Escalation [2044] + 1.7336, !- Year 21 Escalation [2045] + 1.7606, !- Year 22 Escalation [2046] + 1.7642, !- Year 23 Escalation [2047] + 1.7709, !- Year 24 Escalation [2048] + 1.7766, !- Year 25 Escalation [2049] + 1.7702, !- Year 26 Escalation [2050] + 1.7727, !- Year 27 Escalation [2051] + 1.7751, !- Year 28 Escalation [2052] + 1.7775, !- Year 29 Escalation [2053] + 1.7799; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + Mountain Commercial-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9408, !- Year 1 Escalation [2025] + 0.8929, !- Year 2 Escalation [2026] + 0.8663, !- Year 3 Escalation [2027] + 0.8580, !- Year 4 Escalation [2028] + 0.8621, !- Year 5 Escalation [2029] + 0.8721, !- Year 6 Escalation [2030] + 0.8881, !- Year 7 Escalation [2031] + 0.9031, !- Year 8 Escalation [2032] + 0.9253, !- Year 9 Escalation [2033] + 0.9450, !- Year 10 Escalation [2034] + 0.9623, !- Year 11 Escalation [2035] + 0.9694, !- Year 12 Escalation [2036] + 0.9785, !- Year 13 Escalation [2037] + 0.9945, !- Year 14 Escalation [2038] + 0.9932, !- Year 15 Escalation [2039] + 1.0057, !- Year 16 Escalation [2040] + 1.0178, !- Year 17 Escalation [2041] + 1.0228, !- Year 18 Escalation [2042] + 1.0225, !- Year 19 Escalation [2043] + 1.0196, !- Year 20 Escalation [2044] + 1.0225, !- Year 21 Escalation [2045] + 1.0215, !- Year 22 Escalation [2046] + 1.0218, !- Year 23 Escalation [2047] + 1.0211, !- Year 24 Escalation [2048] + 1.0228, !- Year 25 Escalation [2049] + 1.0260, !- Year 26 Escalation [2050] + 1.0272, !- Year 27 Escalation [2051] + 1.0283, !- Year 28 Escalation [2052] + 1.0294, !- Year 29 Escalation [2053] + 1.0305; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + Mountain Industrial-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9578, !- Year 1 Escalation [2025] + 0.9279, !- Year 2 Escalation [2026] + 0.9040, !- Year 3 Escalation [2027] + 0.8856, !- Year 4 Escalation [2028] + 0.8908, !- Year 5 Escalation [2029] + 0.8836, !- Year 6 Escalation [2030] + 0.8788, !- Year 7 Escalation [2031] + 0.8785, !- Year 8 Escalation [2032] + 0.8863, !- Year 9 Escalation [2033] + 0.8878, !- Year 10 Escalation [2034] + 0.8901, !- Year 11 Escalation [2035] + 0.8951, !- Year 12 Escalation [2036] + 0.9175, !- Year 13 Escalation [2037] + 0.9529, !- Year 14 Escalation [2038] + 0.9704, !- Year 15 Escalation [2039] + 0.9921, !- Year 16 Escalation [2040] + 0.9982, !- Year 17 Escalation [2041] + 0.9965, !- Year 18 Escalation [2042] + 0.9874, !- Year 19 Escalation [2043] + 0.9821, !- Year 20 Escalation [2044] + 0.9763, !- Year 21 Escalation [2045] + 0.9773, !- Year 22 Escalation [2046] + 0.9729, !- Year 23 Escalation [2047] + 0.9715, !- Year 24 Escalation [2048] + 0.9723, !- Year 25 Escalation [2049] + 0.9693, !- Year 26 Escalation [2050] + 0.9673, !- Year 27 Escalation [2051] + 0.9653, !- Year 28 Escalation [2052] + 0.9634, !- Year 29 Escalation [2053] + 0.9614; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + Mountain Industrial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9128, !- Year 1 Escalation [2025] + 0.8593, !- Year 2 Escalation [2026] + 0.8088, !- Year 3 Escalation [2027] + 0.7617, !- Year 4 Escalation [2028] + 0.7645, !- Year 5 Escalation [2029] + 0.7654, !- Year 6 Escalation [2030] + 0.7699, !- Year 7 Escalation [2031] + 0.7739, !- Year 8 Escalation [2032] + 0.7773, !- Year 9 Escalation [2033] + 0.7792, !- Year 10 Escalation [2034] + 0.7845, !- Year 11 Escalation [2035] + 0.7853, !- Year 12 Escalation [2036] + 0.7890, !- Year 13 Escalation [2037] + 0.7920, !- Year 14 Escalation [2038] + 0.7935, !- Year 15 Escalation [2039] + 0.7953, !- Year 16 Escalation [2040] + 0.8002, !- Year 17 Escalation [2041] + 0.8003, !- Year 18 Escalation [2042] + 0.8044, !- Year 19 Escalation [2043] + 0.8028, !- Year 20 Escalation [2044] + 0.8047, !- Year 21 Escalation [2045] + 0.8120, !- Year 22 Escalation [2046] + 0.8127, !- Year 23 Escalation [2047] + 0.8138, !- Year 24 Escalation [2048] + 0.8164, !- Year 25 Escalation [2049] + 0.8168, !- Year 26 Escalation [2050] + 0.8179, !- Year 27 Escalation [2051] + 0.8191, !- Year 28 Escalation [2052] + 0.8203, !- Year 29 Escalation [2053] + 0.8215; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + Mountain Industrial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0475, !- Year 1 Escalation [2025] + 1.2204, !- Year 2 Escalation [2026] + 1.3875, !- Year 3 Escalation [2027] + 1.5595, !- Year 4 Escalation [2028] + 1.5704, !- Year 5 Escalation [2029] + 1.5795, !- Year 6 Escalation [2030] + 1.5880, !- Year 7 Escalation [2031] + 1.5995, !- Year 8 Escalation [2032] + 1.6075, !- Year 9 Escalation [2033] + 1.6141, !- Year 10 Escalation [2034] + 1.6270, !- Year 11 Escalation [2035] + 1.6468, !- Year 12 Escalation [2036] + 1.6528, !- Year 13 Escalation [2037] + 1.6642, !- Year 14 Escalation [2038] + 1.6731, !- Year 15 Escalation [2039] + 1.6787, !- Year 16 Escalation [2040] + 1.6930, !- Year 17 Escalation [2041] + 1.6987, !- Year 18 Escalation [2042] + 1.7022, !- Year 19 Escalation [2043] + 1.7151, !- Year 20 Escalation [2044] + 1.7268, !- Year 21 Escalation [2045] + 1.7538, !- Year 22 Escalation [2046] + 1.7573, !- Year 23 Escalation [2047] + 1.7640, !- Year 24 Escalation [2048] + 1.7697, !- Year 25 Escalation [2049] + 1.7633, !- Year 26 Escalation [2050] + 1.7658, !- Year 27 Escalation [2051] + 1.7682, !- Year 28 Escalation [2052] + 1.7706, !- Year 29 Escalation [2053] + 1.7730; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + Mountain Industrial-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.8977, !- Year 1 Escalation [2025] + 0.8183, !- Year 2 Escalation [2026] + 0.7726, !- Year 3 Escalation [2027] + 0.7559, !- Year 4 Escalation [2028] + 0.7573, !- Year 5 Escalation [2029] + 0.7688, !- Year 6 Escalation [2030] + 0.7905, !- Year 7 Escalation [2031] + 0.8102, !- Year 8 Escalation [2032] + 0.8410, !- Year 9 Escalation [2033] + 0.8684, !- Year 10 Escalation [2034] + 0.8927, !- Year 11 Escalation [2035] + 0.8976, !- Year 12 Escalation [2036] + 0.9061, !- Year 13 Escalation [2037] + 0.9308, !- Year 14 Escalation [2038] + 0.9188, !- Year 15 Escalation [2039] + 0.9397, !- Year 16 Escalation [2040] + 0.9558, !- Year 17 Escalation [2041] + 0.9567, !- Year 18 Escalation [2042] + 0.9489, !- Year 19 Escalation [2043] + 0.9378, !- Year 20 Escalation [2044] + 0.9367, !- Year 21 Escalation [2045] + 0.9289, !- Year 22 Escalation [2046] + 0.9242, !- Year 23 Escalation [2047] + 0.9178, !- Year 24 Escalation [2048] + 0.9142, !- Year 25 Escalation [2049] + 0.9148, !- Year 26 Escalation [2050] + 0.9113, !- Year 27 Escalation [2051] + 0.9078, !- Year 28 Escalation [2052] + 0.9043, !- Year 29 Escalation [2053] + 0.9009; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + Mountain Industrial-Coal, !- Name + Coal, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0179, !- Year 1 Escalation [2025] + 1.0217, !- Year 2 Escalation [2026] + 1.0161, !- Year 3 Escalation [2027] + 1.0076, !- Year 4 Escalation [2028] + 1.0032, !- Year 5 Escalation [2029] + 0.9989, !- Year 6 Escalation [2030] + 0.9940, !- Year 7 Escalation [2031] + 0.9885, !- Year 8 Escalation [2032] + 0.9847, !- Year 9 Escalation [2033] + 0.9820, !- Year 10 Escalation [2034] + 0.9796, !- Year 11 Escalation [2035] + 0.9776, !- Year 12 Escalation [2036] + 0.9765, !- Year 13 Escalation [2037] + 0.9763, !- Year 14 Escalation [2038] + 0.9756, !- Year 15 Escalation [2039] + 0.9732, !- Year 16 Escalation [2040] + 0.9715, !- Year 17 Escalation [2041] + 0.9697, !- Year 18 Escalation [2042] + 0.9699, !- Year 19 Escalation [2043] + 0.9704, !- Year 20 Escalation [2044] + 0.9713, !- Year 21 Escalation [2045] + 0.9716, !- Year 22 Escalation [2046] + 0.9720, !- Year 23 Escalation [2047] + 0.9727, !- Year 24 Escalation [2048] + 0.9730, !- Year 25 Escalation [2049] + 0.9723, !- Year 26 Escalation [2050] + 0.9725, !- Year 27 Escalation [2051] + 0.9727, !- Year 28 Escalation [2052] + 0.9729, !- Year 29 Escalation [2053] + 0.9731; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + Pacific Residential-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9054, !- Year 1 Escalation [2025] + 0.8956, !- Year 2 Escalation [2026] + 0.8947, !- Year 3 Escalation [2027] + 0.8984, !- Year 4 Escalation [2028] + 0.9009, !- Year 5 Escalation [2029] + 0.9093, !- Year 6 Escalation [2030] + 0.9244, !- Year 7 Escalation [2031] + 0.9406, !- Year 8 Escalation [2032] + 0.9547, !- Year 9 Escalation [2033] + 0.9685, !- Year 10 Escalation [2034] + 0.9826, !- Year 11 Escalation [2035] + 0.9926, !- Year 12 Escalation [2036] + 1.0020, !- Year 13 Escalation [2037] + 1.0103, !- Year 14 Escalation [2038] + 1.0163, !- Year 15 Escalation [2039] + 1.0215, !- Year 16 Escalation [2040] + 1.0308, !- Year 17 Escalation [2041] + 1.0395, !- Year 18 Escalation [2042] + 1.0552, !- Year 19 Escalation [2043] + 1.0714, !- Year 20 Escalation [2044] + 1.0863, !- Year 21 Escalation [2045] + 1.0987, !- Year 22 Escalation [2046] + 1.1048, !- Year 23 Escalation [2047] + 1.1139, !- Year 24 Escalation [2048] + 1.1168, !- Year 25 Escalation [2049] + 1.1198, !- Year 26 Escalation [2050] + 1.1251, !- Year 27 Escalation [2051] + 1.1305, !- Year 28 Escalation [2052] + 1.1359, !- Year 29 Escalation [2053] + 1.1413; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + Pacific Residential-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9467, !- Year 1 Escalation [2025] + 0.9312, !- Year 2 Escalation [2026] + 0.9164, !- Year 3 Escalation [2027] + 0.9033, !- Year 4 Escalation [2028] + 0.9059, !- Year 5 Escalation [2029] + 0.9067, !- Year 6 Escalation [2030] + 0.9114, !- Year 7 Escalation [2031] + 0.9154, !- Year 8 Escalation [2032] + 0.9171, !- Year 9 Escalation [2033] + 0.9204, !- Year 10 Escalation [2034] + 0.9236, !- Year 11 Escalation [2035] + 0.9263, !- Year 12 Escalation [2036] + 0.9289, !- Year 13 Escalation [2037] + 0.9321, !- Year 14 Escalation [2038] + 0.9342, !- Year 15 Escalation [2039] + 0.9369, !- Year 16 Escalation [2040] + 0.9423, !- Year 17 Escalation [2041] + 0.9429, !- Year 18 Escalation [2042] + 0.9469, !- Year 19 Escalation [2043] + 0.9449, !- Year 20 Escalation [2044] + 0.9484, !- Year 21 Escalation [2045] + 0.9605, !- Year 22 Escalation [2046] + 0.9614, !- Year 23 Escalation [2047] + 0.9628, !- Year 24 Escalation [2048] + 0.9652, !- Year 25 Escalation [2049] + 0.9655, !- Year 26 Escalation [2050] + 0.9667, !- Year 27 Escalation [2051] + 0.9680, !- Year 28 Escalation [2052] + 0.9692, !- Year 29 Escalation [2053] + 0.9705; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + Pacific Residential-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.8958, !- Year 1 Escalation [2025] + 0.7974, !- Year 2 Escalation [2026] + 0.7123, !- Year 3 Escalation [2027] + 0.6360, !- Year 4 Escalation [2028] + 0.6318, !- Year 5 Escalation [2029] + 0.6313, !- Year 6 Escalation [2030] + 0.6349, !- Year 7 Escalation [2031] + 0.6380, !- Year 8 Escalation [2032] + 0.6456, !- Year 9 Escalation [2033] + 0.6536, !- Year 10 Escalation [2034] + 0.6609, !- Year 11 Escalation [2035] + 0.6631, !- Year 12 Escalation [2036] + 0.6673, !- Year 13 Escalation [2037] + 0.6758, !- Year 14 Escalation [2038] + 0.6739, !- Year 15 Escalation [2039] + 0.6791, !- Year 16 Escalation [2040] + 0.6843, !- Year 17 Escalation [2041] + 0.6864, !- Year 18 Escalation [2042] + 0.6861, !- Year 19 Escalation [2043] + 0.6831, !- Year 20 Escalation [2044] + 0.6919, !- Year 21 Escalation [2045] + 0.8221, !- Year 22 Escalation [2046] + 0.8276, !- Year 23 Escalation [2047] + 0.8271, !- Year 24 Escalation [2048] + 0.8288, !- Year 25 Escalation [2049] + 0.8306, !- Year 26 Escalation [2050] + 0.8327, !- Year 27 Escalation [2051] + 0.8348, !- Year 28 Escalation [2052] + 0.8370, !- Year 29 Escalation [2053] + 0.8391; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + Pacific Residential-LPG, !- Name + Propane, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9666, !- Year 1 Escalation [2025] + 0.9323, !- Year 2 Escalation [2026] + 0.9046, !- Year 3 Escalation [2027] + 0.8887, !- Year 4 Escalation [2028] + 0.8827, !- Year 5 Escalation [2029] + 0.8855, !- Year 6 Escalation [2030] + 0.8944, !- Year 7 Escalation [2031] + 0.9089, !- Year 8 Escalation [2032] + 0.9272, !- Year 9 Escalation [2033] + 0.9456, !- Year 10 Escalation [2034] + 0.9603, !- Year 11 Escalation [2035] + 0.9713, !- Year 12 Escalation [2036] + 0.9811, !- Year 13 Escalation [2037] + 0.9937, !- Year 14 Escalation [2038] + 0.9999, !- Year 15 Escalation [2039] + 1.0099, !- Year 16 Escalation [2040] + 1.0197, !- Year 17 Escalation [2041] + 1.0267, !- Year 18 Escalation [2042] + 1.0302, !- Year 19 Escalation [2043] + 1.0311, !- Year 20 Escalation [2044] + 1.0364, !- Year 21 Escalation [2045] + 1.1052, !- Year 22 Escalation [2046] + 1.1063, !- Year 23 Escalation [2047] + 1.1088, !- Year 24 Escalation [2048] + 1.1095, !- Year 25 Escalation [2049] + 1.1089, !- Year 26 Escalation [2050] + 1.1099, !- Year 27 Escalation [2051] + 1.1108, !- Year 28 Escalation [2052] + 1.1117, !- Year 29 Escalation [2053] + 1.1127; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + Pacific Commercial-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.8786, !- Year 1 Escalation [2025] + 0.8607, !- Year 2 Escalation [2026] + 0.8512, !- Year 3 Escalation [2027] + 0.8428, !- Year 4 Escalation [2028] + 0.8339, !- Year 5 Escalation [2029] + 0.8370, !- Year 6 Escalation [2030] + 0.8396, !- Year 7 Escalation [2031] + 0.8449, !- Year 8 Escalation [2032] + 0.8500, !- Year 9 Escalation [2033] + 0.8520, !- Year 10 Escalation [2034] + 0.8572, !- Year 11 Escalation [2035] + 0.8593, !- Year 12 Escalation [2036] + 0.8582, !- Year 13 Escalation [2037] + 0.8576, !- Year 14 Escalation [2038] + 0.8519, !- Year 15 Escalation [2039] + 0.8463, !- Year 16 Escalation [2040] + 0.8462, !- Year 17 Escalation [2041] + 0.8477, !- Year 18 Escalation [2042] + 0.8561, !- Year 19 Escalation [2043] + 0.8633, !- Year 20 Escalation [2044] + 0.8682, !- Year 21 Escalation [2045] + 0.8704, !- Year 22 Escalation [2046] + 0.8675, !- Year 23 Escalation [2047] + 0.8676, !- Year 24 Escalation [2048] + 0.8629, !- Year 25 Escalation [2049] + 0.8586, !- Year 26 Escalation [2050] + 0.8557, !- Year 27 Escalation [2051] + 0.8527, !- Year 28 Escalation [2052] + 0.8498, !- Year 29 Escalation [2053] + 0.8469; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + Pacific Commercial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9113, !- Year 1 Escalation [2025] + 0.8568, !- Year 2 Escalation [2026] + 0.8052, !- Year 3 Escalation [2027] + 0.7565, !- Year 4 Escalation [2028] + 0.7593, !- Year 5 Escalation [2029] + 0.7602, !- Year 6 Escalation [2030] + 0.7648, !- Year 7 Escalation [2031] + 0.7688, !- Year 8 Escalation [2032] + 0.7719, !- Year 9 Escalation [2033] + 0.7740, !- Year 10 Escalation [2034] + 0.7790, !- Year 11 Escalation [2035] + 0.7801, !- Year 12 Escalation [2036] + 0.7837, !- Year 13 Escalation [2037] + 0.7866, !- Year 14 Escalation [2038] + 0.7883, !- Year 15 Escalation [2039] + 0.7901, !- Year 16 Escalation [2040] + 0.7951, !- Year 17 Escalation [2041] + 0.7953, !- Year 18 Escalation [2042] + 0.7994, !- Year 19 Escalation [2043] + 0.7977, !- Year 20 Escalation [2044] + 0.8030, !- Year 21 Escalation [2045] + 0.8714, !- Year 22 Escalation [2046] + 0.8721, !- Year 23 Escalation [2047] + 0.8733, !- Year 24 Escalation [2048] + 0.8759, !- Year 25 Escalation [2049] + 0.8762, !- Year 26 Escalation [2050] + 0.8774, !- Year 27 Escalation [2051] + 0.8786, !- Year 28 Escalation [2052] + 0.8798, !- Year 29 Escalation [2053] + 0.8810; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + Pacific Commercial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0533, !- Year 1 Escalation [2025] + 1.2106, !- Year 2 Escalation [2026] + 1.3781, !- Year 3 Escalation [2027] + 1.5347, !- Year 4 Escalation [2028] + 1.5428, !- Year 5 Escalation [2029] + 1.5545, !- Year 6 Escalation [2030] + 1.5582, !- Year 7 Escalation [2031] + 1.5677, !- Year 8 Escalation [2032] + 1.5774, !- Year 9 Escalation [2033] + 1.5867, !- Year 10 Escalation [2034] + 1.6005, !- Year 11 Escalation [2035] + 1.6046, !- Year 12 Escalation [2036] + 1.6164, !- Year 13 Escalation [2037] + 1.6274, !- Year 14 Escalation [2038] + 1.6380, !- Year 15 Escalation [2039] + 1.6430, !- Year 16 Escalation [2040] + 1.6543, !- Year 17 Escalation [2041] + 1.6606, !- Year 18 Escalation [2042] + 1.6729, !- Year 19 Escalation [2043] + 1.6766, !- Year 20 Escalation [2044] + 1.6824, !- Year 21 Escalation [2045] + 1.7047, !- Year 22 Escalation [2046] + 1.7052, !- Year 23 Escalation [2047] + 1.7179, !- Year 24 Escalation [2048] + 1.7300, !- Year 25 Escalation [2049] + 1.7442, !- Year 26 Escalation [2050] + 1.7542, !- Year 27 Escalation [2051] + 1.7642, !- Year 28 Escalation [2052] + 1.7743, !- Year 29 Escalation [2053] + 1.7845; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + Pacific Commercial-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9672, !- Year 1 Escalation [2025] + 0.9400, !- Year 2 Escalation [2026] + 0.9279, !- Year 3 Escalation [2027] + 0.9247, !- Year 4 Escalation [2028] + 0.9277, !- Year 5 Escalation [2029] + 0.9309, !- Year 6 Escalation [2030] + 0.9383, !- Year 7 Escalation [2031] + 0.9441, !- Year 8 Escalation [2032] + 0.9581, !- Year 9 Escalation [2033] + 0.9712, !- Year 10 Escalation [2034] + 0.9824, !- Year 11 Escalation [2035] + 0.9858, !- Year 12 Escalation [2036] + 0.9924, !- Year 13 Escalation [2037] + 1.0054, !- Year 14 Escalation [2038] + 1.0015, !- Year 15 Escalation [2039] + 1.0095, !- Year 16 Escalation [2040] + 1.0172, !- Year 17 Escalation [2041] + 1.0197, !- Year 18 Escalation [2042] + 1.0189, !- Year 19 Escalation [2043] + 1.0144, !- Year 20 Escalation [2044] + 1.0277, !- Year 21 Escalation [2045] + 1.2150, !- Year 22 Escalation [2046] + 1.2102, !- Year 23 Escalation [2047] + 1.2040, !- Year 24 Escalation [2048] + 1.2071, !- Year 25 Escalation [2049] + 1.2102, !- Year 26 Escalation [2050] + 1.2090, !- Year 27 Escalation [2051] + 1.2079, !- Year 28 Escalation [2052] + 1.2067, !- Year 29 Escalation [2053] + 1.2055; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + Pacific Industrial-Electricity, !- Name + Electricity, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.8710, !- Year 1 Escalation [2025] + 0.8510, !- Year 2 Escalation [2026] + 0.8374, !- Year 3 Escalation [2027] + 0.8300, !- Year 4 Escalation [2028] + 0.8166, !- Year 5 Escalation [2029] + 0.8209, !- Year 6 Escalation [2030] + 0.8199, !- Year 7 Escalation [2031] + 0.8271, !- Year 8 Escalation [2032] + 0.8301, !- Year 9 Escalation [2033] + 0.8377, !- Year 10 Escalation [2034] + 0.8442, !- Year 11 Escalation [2035] + 0.8458, !- Year 12 Escalation [2036] + 0.8492, !- Year 13 Escalation [2037] + 0.8531, !- Year 14 Escalation [2038] + 0.8541, !- Year 15 Escalation [2039] + 0.8538, !- Year 16 Escalation [2040] + 0.8575, !- Year 17 Escalation [2041] + 0.8630, !- Year 18 Escalation [2042] + 0.8721, !- Year 19 Escalation [2043] + 0.8798, !- Year 20 Escalation [2044] + 0.8908, !- Year 21 Escalation [2045] + 0.8927, !- Year 22 Escalation [2046] + 0.8903, !- Year 23 Escalation [2047] + 0.8913, !- Year 24 Escalation [2048] + 0.8874, !- Year 25 Escalation [2049] + 0.8844, !- Year 26 Escalation [2050] + 0.8824, !- Year 27 Escalation [2051] + 0.8803, !- Year 28 Escalation [2052] + 0.8782, !- Year 29 Escalation [2053] + 0.8762; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + Pacific Industrial-Distillate Oil, !- Name + FuelOilNo1, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9103, !- Year 1 Escalation [2025] + 0.8542, !- Year 2 Escalation [2026] + 0.8012, !- Year 3 Escalation [2027] + 0.7514, !- Year 4 Escalation [2028] + 0.7542, !- Year 5 Escalation [2029] + 0.7552, !- Year 6 Escalation [2030] + 0.7597, !- Year 7 Escalation [2031] + 0.7637, !- Year 8 Escalation [2032] + 0.7670, !- Year 9 Escalation [2033] + 0.7690, !- Year 10 Escalation [2034] + 0.7742, !- Year 11 Escalation [2035] + 0.7751, !- Year 12 Escalation [2036] + 0.7788, !- Year 13 Escalation [2037] + 0.7817, !- Year 14 Escalation [2038] + 0.7832, !- Year 15 Escalation [2039] + 0.7850, !- Year 16 Escalation [2040] + 0.7899, !- Year 17 Escalation [2041] + 0.7900, !- Year 18 Escalation [2042] + 0.7941, !- Year 19 Escalation [2043] + 0.7925, !- Year 20 Escalation [2044] + 0.7944, !- Year 21 Escalation [2045] + 0.8019, !- Year 22 Escalation [2046] + 0.8026, !- Year 23 Escalation [2047] + 0.8037, !- Year 24 Escalation [2048] + 0.8063, !- Year 25 Escalation [2049] + 0.8066, !- Year 26 Escalation [2050] + 0.8078, !- Year 27 Escalation [2051] + 0.8090, !- Year 28 Escalation [2052] + 0.8101, !- Year 29 Escalation [2053] + 0.8113; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + Pacific Industrial-Residual Oil, !- Name + FuelOilNo2, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0533, !- Year 1 Escalation [2025] + 1.2106, !- Year 2 Escalation [2026] + 1.3781, !- Year 3 Escalation [2027] + 1.5347, !- Year 4 Escalation [2028] + 1.5428, !- Year 5 Escalation [2029] + 1.5545, !- Year 6 Escalation [2030] + 1.5582, !- Year 7 Escalation [2031] + 1.5677, !- Year 8 Escalation [2032] + 1.5774, !- Year 9 Escalation [2033] + 1.5867, !- Year 10 Escalation [2034] + 1.6005, !- Year 11 Escalation [2035] + 1.6046, !- Year 12 Escalation [2036] + 1.6164, !- Year 13 Escalation [2037] + 1.6274, !- Year 14 Escalation [2038] + 1.6380, !- Year 15 Escalation [2039] + 1.6430, !- Year 16 Escalation [2040] + 1.6543, !- Year 17 Escalation [2041] + 1.6606, !- Year 18 Escalation [2042] + 1.6729, !- Year 19 Escalation [2043] + 1.6766, !- Year 20 Escalation [2044] + 1.6824, !- Year 21 Escalation [2045] + 1.7047, !- Year 22 Escalation [2046] + 1.7052, !- Year 23 Escalation [2047] + 1.7179, !- Year 24 Escalation [2048] + 1.7300, !- Year 25 Escalation [2049] + 1.7442, !- Year 26 Escalation [2050] + 1.7542, !- Year 27 Escalation [2051] + 1.7642, !- Year 28 Escalation [2052] + 1.7743, !- Year 29 Escalation [2053] + 1.7845; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + Pacific Industrial-Natural Gas, !- Name + NaturalGas, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 0.9194, !- Year 1 Escalation [2025] + 0.8563, !- Year 2 Escalation [2026] + 0.8144, !- Year 3 Escalation [2027] + 0.7965, !- Year 4 Escalation [2028] + 0.7933, !- Year 5 Escalation [2029] + 0.7941, !- Year 6 Escalation [2030] + 0.8095, !- Year 7 Escalation [2031] + 0.8224, !- Year 8 Escalation [2032] + 0.8521, !- Year 9 Escalation [2033] + 0.8771, !- Year 10 Escalation [2034] + 0.9009, !- Year 11 Escalation [2035] + 0.9067, !- Year 12 Escalation [2036] + 0.9158, !- Year 13 Escalation [2037] + 0.9418, !- Year 14 Escalation [2038] + 0.9310, !- Year 15 Escalation [2039] + 0.9517, !- Year 16 Escalation [2040] + 0.9657, !- Year 17 Escalation [2041] + 0.9687, !- Year 18 Escalation [2042] + 0.9646, !- Year 19 Escalation [2043] + 0.9547, !- Year 20 Escalation [2044] + 0.9551, !- Year 21 Escalation [2045] + 0.9413, !- Year 22 Escalation [2046] + 0.9405, !- Year 23 Escalation [2047] + 0.9325, !- Year 24 Escalation [2048] + 0.9330, !- Year 25 Escalation [2049] + 0.9374, !- Year 26 Escalation [2050] + 0.9365, !- Year 27 Escalation [2051] + 0.9355, !- Year 28 Escalation [2052] + 0.9346, !- Year 29 Escalation [2053] + 0.9337; !- Year 30 Escalation [2054] + +LifeCycleCost:UsePriceEscalation, + Pacific Industrial-Coal, !- Name + Coal, !- Resource + 2025, !- Escalation Start Year + January, !- Escalation Start Month + 1.0187, !- Year 1 Escalation [2025] + 1.0230, !- Year 2 Escalation [2026] + 1.0176, !- Year 3 Escalation [2027] + 1.0101, !- Year 4 Escalation [2028] + 1.0056, !- Year 5 Escalation [2029] + 1.0019, !- Year 6 Escalation [2030] + 0.9980, !- Year 7 Escalation [2031] + 0.9933, !- Year 8 Escalation [2032] + 0.9899, !- Year 9 Escalation [2033] + 0.9884, !- Year 10 Escalation [2034] + 0.9868, !- Year 11 Escalation [2035] + 0.9856, !- Year 12 Escalation [2036] + 0.9854, !- Year 13 Escalation [2037] + 0.9856, !- Year 14 Escalation [2038] + 0.9852, !- Year 15 Escalation [2039] + 0.9833, !- Year 16 Escalation [2040] + 0.9819, !- Year 17 Escalation [2041] + 0.9804, !- Year 18 Escalation [2042] + 0.9810, !- Year 19 Escalation [2043] + 0.9820, !- Year 20 Escalation [2044] + 0.9838, !- Year 21 Escalation [2045] + 0.9851, !- Year 22 Escalation [2046] + 0.9861, !- Year 23 Escalation [2047] + 0.9873, !- Year 24 Escalation [2048] + 0.9877, !- Year 25 Escalation [2049] + 0.9870, !- Year 26 Escalation [2050] + 0.9874, !- Year 27 Escalation [2051] + 0.9879, !- Year 28 Escalation [2052] + 0.9884, !- Year 29 Escalation [2053] + 0.9889; !- Year 30 Escalation [2054] + diff --git a/datasets/WaterToAirHeatPumps.idf b/datasets/WaterToAirHeatPumps.idf index acd014315b1..0668d14a70a 100644 --- a/datasets/WaterToAirHeatPumps.idf +++ b/datasets/WaterToAirHeatPumps.idf @@ -9,8 +9,8 @@ !- Rated characteristics: !- * Cooling capacity: 69 kBtu/h at 86F entering water temperature, and 80.6F/66.2F entering air dry-bulb and wet-bulb !- * Cooling efficiency: 13.3 EER at 86F entering water temperature, and 80.6F/66.2F entering air dry-bulb and wet-bulb -!- * Heating capacity: 92.5 kBtu/h at 68F entering water temperature, and 80.6F/66.2F entering air dry-bulb and wet-bulb -!- * Heating efficiency: 5.0 COP at 68F entering water temperature, and 80.6F/66.2F entering air dry-bulb and wet-bulb +!- * Heating capacity: 92.5 kBtu/h at 68F entering water temperature, and 68F/59F entering air dry-bulb and wet-bulb +!- * Heating efficiency: 5.0 COP at 68F entering water temperature, and 68F/59F entering air dry-bulb and wet-bulb Curve:QuadLinear, TCH072_WLHP_CLG_CAPFT, !- Name @@ -131,8 +131,8 @@ Curve:QuadLinear, !- Rated characteristics: !- * Cooling capacity: 77.72 kBtu/h at 59F entering water temperature, and 80.6F/66.2F entering air dry-bulb and wet-bulb !- * Cooling efficiency: 19.37 EER at 59F entering water temperature, and 80.6F/66.2F entering air dry-bulb and wet-bulb -!- * Heating capacity: 73.08 kBtu/h at 50F entering water temperature, and 80.6F/66.2F entering air dry-bulb and wet-bulb -!- * Heating efficiency: 4.3 COP at 50F entering water temperature, and 80.6F/66.2F entering air dry-bulb and wet-bulb +!- * Heating capacity: 73.08 kBtu/h at 50F entering water temperature, and 68F/59F entering air dry-bulb and wet-bulb +!- * Heating efficiency: 4.3 COP at 50F entering water temperature, and 68F/59F entering air dry-bulb and wet-bulb !- Performance curve based on 15% methanol antifreeze solution Curve:QuadLinear, @@ -258,8 +258,8 @@ Curve:QuadLinear, !- Rated characteristics: !- * Cooling capacity: 70.29 kBtu/h at 77F entering water temperature, and 80.6F/66.2F entering air dry-bulb and wet-bulb !- * Cooling efficiency: 14.35 EER at 77F entering water temperature, and 80.6F/66.2F entering air dry-bulb and wet-bulb -!- * Heating capacity: 56.14 kBtu/h at 32F entering water temperature, and 80.6F/66.2F entering air dry-bulb and wet-bulb -!- * Heating efficiency: 3.42 COP at 32F entering water temperature, and 80.6F/66.2F entering air dry-bulb and wet-bulb +!- * Heating capacity: 56.14 kBtu/h at 32F entering water temperature, and 68F/59F entering air dry-bulb and wet-bulb +!- * Heating efficiency: 3.42 COP at 32F entering water temperature, and 68F/59F entering air dry-bulb and wet-bulb !- Performance curve based on 15% methanol antifreeze solution Curve:QuadLinear, diff --git a/design/FY2025/NFP-epJSON-Editor-Enhancements.md b/design/FY2025/NFP-epJSON-Editor-Enhancements.md new file mode 100644 index 00000000000..cdd533f1b8a --- /dev/null +++ b/design/FY2025/NFP-epJSON-Editor-Enhancements.md @@ -0,0 +1,135 @@ +CROSS PLATFORM epJSON EDITOR ENHANCEMENTS +================ + +**Jason Glazer, GARD Analytics** + + - December 20, 2024 + + +## Justification for New Feature ## + +The cross-platform epJSON Editor developed in 2020-2021 used Python and the +wxPython library, and was intended to be the replacement for the Windows-only IDF +Editor that uses Visual Basic. Unfortunately, the wxPython library could not be +effectively integrated with the EnergyPlus installer. Also, the existence of the +epJSON Editor was not widely publicized, and currently most users still use the +IDF format. For these reasons, few users have used epJSON Editor. To solve +these problems, epJSON Editor will be refactored to use the Tkinter library +instead of wxPython, which is already part of the EnergyPlus installer. It will +also support opening and saving the IDF format using convertInputFormat. These +enhancements, along with some public notifications, should result in more users +using epJSON Editor and, ultimately, the epJSON format. + + +## E-mail and Conference Call Conclusions ## + +none + +## Overview ## + +A replacement for the popular Windows-only IDF Editor using a modern programming +language was previously developed called "epJSON Editor." The epJSON Editor +focused on use with the JSON-based epJSON format as an alternative to the IDF +format and used Python and a cross-platform GUI library so that it could be used +on Windows, MacOS, and Linux. It was developed but not widely tested or +publicized, and few users of EnergyPus have tried it even though it includes +useful additional functionality compared to IDF Editor. GARD in conjunction with +the NREL team, will update the epJSON Editor to use the EnergyPlus team's +preferred GUI library called Tkinter instead of the wxPython library. To ease +the transition to the new epJSON format, it is also expected that we will enable +opening IDF files by using the existing convertInputFormat utility. Two small +enhancements to convertInputFormat will be made to help facilitate user +migration to that format and preserve object order and comments provided by the +user, and to add field names. GARD will reach out to users for beta-testing, and +the code will be updated in response to problems and suggestions provided by the +testers, as well as known issues previously identified. A final version of the +release will be included in the EnergyPlus installation packages for each +platform. + +The current repository for the project is located here: + +https://github.com/ORNL-BTRIC/epJSON-Editor + +A list of feature suggestions is being maintained here: + +https://github.com/ORNL-BTRIC/epJSON-Editor/issues/15 + +The origin for editor came from this issue: + +https://github.com/NREL/EnergyPlus/issues/7418 + +That issue also includes a summary of a meeting with users of IDF Editor and what features they found most important. + +Two issues related to convertInputFormat are planned to be addressed as part of this work: + +Populate comments (!-) from IDD/schema when converting from epJSON to IDF + +https://github.com/NREL/EnergyPlus/issues/8987 + +Add ConvertInputFormat options to preserve object order and comments to facilitate round-tripping + +https://github.com/NREL/EnergyPlus/issues/8969 + +One widget that is not included in Tkinter that will be used is Tksheet + +https://pypi.org/project/tksheet/ + +https://github.com/ragardner/tksheet + + +## Approach ## + +The following steps are expected as part of this development effort: + +- Update the repository to Python 3.12 (or later) +- Create a mock-up of epJSON Editor using Tkinter widgets +- Refactor existing code to minimize non-GUI code in files using wxPython +- Remove wxPython and replace with Tkinter based on mock-up +- Allow multiple open files +- Possibly replace icons with better ones on hand +- Test to ensure features are consistent +- Fix known bugs +- Add additional unit test coverage +- Enable opening IDF file either by modifying convertInputFormat to save and use saved user comments and input + object order and include field names or else create a new Python library to perform these functions +- Create installers for all types of user groups including part of EnergyPlus installer, pip, and Windows installer +- Encourage beta testing on all platforms +- Test by opening a variety of files including large user files +- Maybe use automated testing for GUI +- Fix issues found during beta testing +- Possibly add new features +- Release testing and make final installers +- Publicize more widely +- Maybe add pop-up screen to IDF Editor to encourage the use of epJSON Editor + + +## Testing/Validation/Data Sources ## + +Will add additional unit tests. May add GUI unit tests. + +## Input Output Reference Documentation ## + +None expected. + +## Input Description ## + +N/A + +## Outputs Description ## + +N/A + +## Engineering Reference ## + +None + +## Example File and Transition Changes ## + +N/A + +## References ## + +None. + + + diff --git a/dictionary.dic b/dictionary.dic new file mode 100644 index 00000000000..81124bc4dda --- /dev/null +++ b/dictionary.dic @@ -0,0 +1,32 @@ +AirLoopHVAC +AirToAir +BalancedFlow +Celdek +CeldekPad +CoilSystem +ComponentModel +ConstantVolume +DetailedGeometry +Evaporative +EvaporativeCooler +FlatPlate +HeatExchanger +HeatExchangerAssisted +HVACDOAS +Liesen +NoFans +OutdoorAir +OutdoorAirSystem +PhotovoltaicThermal +ResearchSpecial +SensibleAndLatent +SolarCollector +SystemModel +TerminalUnit +UnglazedTranspired +UnitarySystem +UserDefined +VariableRefrigerantFlow +VariableVolume +WetCoil +ZoneHVAC diff --git a/doc/auxiliary-programs/src/hvac-performance-curve-fit-tool/introduction-004.tex b/doc/auxiliary-programs/src/hvac-performance-curve-fit-tool/introduction-004.tex index 1837dd4a4e0..0947e54a671 100644 --- a/doc/auxiliary-programs/src/hvac-performance-curve-fit-tool/introduction-004.tex +++ b/doc/auxiliary-programs/src/hvac-performance-curve-fit-tool/introduction-004.tex @@ -16,4 +16,4 @@ \section{Introduction}\label{introduction-002} \caption{Curve Fit Tool Input Interface \protect \label{fig:curve-fit-tool-input-interface}} \end{figure} -The tool can be used for Coil:Cooing:DX:SingleSpeed, Coil:Heating:DX:SingleSpeed, Coil:Cooing:DX:TwoSpeed (high and low speed) , CoilPerformance:DX:Cooling (each stage), and any HVAC equipment that use Biquadratic, Cubic or Quadratic curves. To add this flexibility generic input data labels can be populated by selecting ``Other'' for DX Coil Type input field, located in Cell B3 in Figure~\ref{fig:curve-fit-tool-input-interface}. +The tool can be used for Coil:Cooling:DX:SingleSpeed, Coil:Heating:DX:SingleSpeed, Coil:Cooling:DX:TwoSpeed (high and low speed) , CoilPerformance:DX:Cooling (each stage), and any HVAC equipment that use Biquadratic, Cubic or Quadratic curves. To add this flexibility generic input data labels can be populated by selecting ``Other'' for DX Coil Type input field, located in Cell B3 in Figure~\ref{fig:curve-fit-tool-input-interface}. diff --git a/doc/auxiliary-programs/src/weather-converter-program/epw-csv-format-in-out.tex b/doc/auxiliary-programs/src/weather-converter-program/epw-csv-format-in-out.tex index 8b5a4adcf0c..9763a66e699 100644 --- a/doc/auxiliary-programs/src/weather-converter-program/epw-csv-format-in-out.tex +++ b/doc/auxiliary-programs/src/weather-converter-program/epw-csv-format-in-out.tex @@ -98,7 +98,7 @@ \subsection{Data Records (CSV)}\label{data-records-csv} \caption{EnergyPlus EPW CSV file (spreadsheet view) \protect \label{fig:energyplus-epw-csv-file-spreadsheet-view}} \end{figure} -The figure above shows how the EnergyPlus EPW CSV file (initial header records) looks when opened in a spreadsheet. Each header record is shown in bold with data following the headers.. +Figure \ref{fig:energyplus-epw-csv-file-spreadsheet-view} shows how the EnergyPlus EPW CSV file (initial header records) looks when opened in a spreadsheet. Each header record is shown in bold with data following the headers.. \begin{figure}[hbtp] % fig 18 \centering @@ -106,4 +106,4 @@ \subsection{Data Records (CSV)}\label{data-records-csv} \caption{EnergyPlus EPW CSV Data Records (spreadsheet view) \protect \label{fig:energyplus-epw-csv-data-records-spreadsheet}} \end{figure} -The above figure shows how the data periods header record and the individual data records look when opened in a spread sheet. Again, the headers are shown in bold. Note that there are two header records for the data records - one with short names - one with longer more descriptive names. +Figure \ref{fig:energyplus-epw-csv-data-records-spreadsheet} shows how the data periods header record and the individual data records look when opened in a spread sheet. Again, the headers are shown in bold. Note that there are two header records for the data records - one with short names - one with longer more descriptive names. diff --git a/doc/ems-application-guide/src/ems-actuators/hvac-systems-001.tex b/doc/ems-application-guide/src/ems-actuators/hvac-systems-001.tex index 8aab11f4052..ed6c4b13925 100644 --- a/doc/ems-application-guide/src/ems-actuators/hvac-systems-001.tex +++ b/doc/ems-application-guide/src/ems-actuators/hvac-systems-001.tex @@ -180,7 +180,7 @@ \subsection{Pump}\label{pump} \end{equation} where $P$ is the pump power (\si{\watt}), $\dot{Q}$ is the volume flow rate (\si{\volumeFlowRate}), $\eta_{total}$ is the pump total efficiency (\%) -and $\Delta P_{override}$ is your EMS-overriden pressure rise (\si{\pascal}). +and $\Delta P_{override}$ is your EMS-overridden pressure rise (\si{\pascal}). The unique identifier in both these actuator is the name of Pump Input object. diff --git a/doc/engineering-reference/src/advanced-surface-concepts/exterior-naturally-vented-cavity.tex b/doc/engineering-reference/src/advanced-surface-concepts/exterior-naturally-vented-cavity.tex index 4fa169166ec..753ecf1ca9c 100644 --- a/doc/engineering-reference/src/advanced-surface-concepts/exterior-naturally-vented-cavity.tex +++ b/doc/engineering-reference/src/advanced-surface-concepts/exterior-naturally-vented-cavity.tex @@ -237,6 +237,6 @@ \subsection{Radiation Coefficients}\label{radiation-coefficients} \subsection{References}\label{references-023} -ASHRAE HOF 2001.~ 2001 ASHRAE Fundamentals Handbook.~ American Society of Heating Refrigeration and Air-Conditioning Engineers. Altanta GA. +ASHRAE HOF 2001.~ 2001 ASHRAE Fundamentals Handbook.~ American Society of Heating Refrigeration and Air-Conditioning Engineers. Atlanta GA. ISO. 2003. ISO 15099:2003. Thermal performance of windows, doors, and shading devices -- Detailed calculations. International Organization for Standardization. diff --git a/doc/engineering-reference/src/simulation-models-encyclopedic-reference-001/coils.tex b/doc/engineering-reference/src/simulation-models-encyclopedic-reference-001/coils.tex index 06433ea1982..bc07673af3b 100644 --- a/doc/engineering-reference/src/simulation-models-encyclopedic-reference-001/coils.tex +++ b/doc/engineering-reference/src/simulation-models-encyclopedic-reference-001/coils.tex @@ -392,7 +392,7 @@ \subsubsection{Coil Completely Wet Calculations (operating block)}\label{coil-co and \begin{equation} -OutletAirHumdityRatio = PsyWFnTdbH(OutletAirTemp,EnthAirOutlet) +OutletAirHumIdityRatio = PsyWFnTdbH(OutletAirTemp,EnthAirOutlet) \end{equation} \textbf{ELSE} @@ -1252,7 +1252,7 @@ \subsubsection{SHR Calculation Using User Specified SHR Modifier Curves}\label{s SHR = SH{R_{rated}} \cdot SHRFT\left( {{T_{wb,i}},{T_{db,i}}} \right) \cdot SHRFFF\left( {FF} \right) \end{equation} -The cooing coil outlet air enthalpy is given by: +The cooling coil outlet air enthalpy is given by: \begin{equation} {h_{out}} = {h_{in}} - \frac{{{{\dot Q}_{total}}}}{{\dot m}} @@ -1448,7 +1448,7 @@ \subsubsection{Latent Capacity Degradation}\label{latent-capacity-degradation} \(T_{db,rated}\) is the dry-bulb temperature of air entering the cooling coil at rated conditions (26.7\(^{\circ}\)C) -\(T_{wb,rated}\) is the wet-bulb temperature of air entering the cooing coil at rated conditions (19.4\(^{\circ}\)C). +\(T_{wb,rated}\) is the wet-bulb temperature of air entering the cooling coil at rated conditions (19.4\(^{\circ}\)C). The cooling coil on and off times are then calculated based on the maximum number of cycles per hour and the calculated run-time fraction for the coil. @@ -2294,7 +2294,7 @@ \subsubsection{Waste heat calculation}\label{waste-heat-calculation-000} {Q_{WasteHeat}} = (Fraction)(TempModifier)(CoolingPower) \end{equation} -where Fraction is the rated waste heat fraction of the energy input and TempModifer is the waste heat modifier as a function of indoor and outdoor air dry-bulb temperature. +where Fraction is the rated waste heat fraction of the energy input and TempModifier is the waste heat modifier as a function of indoor and outdoor air dry-bulb temperature. \subsubsection{Basin Heater For Multi-Speed DX Coil}\label{basin-heater-for-multi-speed-dx-coil} @@ -2306,10 +2306,10 @@ \subsubsection{Standard Rating of Multi-Speed DX Cooling Coils}\label{standard-r ANSI/AHRI Standard 210-240 (AHRI 2017 and 2023) [AHRI 2017] For multi-speed direct expansion cooling coils, the industry standard ratings are calculated according to ANSI/AHRI Standard 210-240 (AHRI 2017). These Standard Ratings are: Standard Rating Cooling Capacity and Seasonal Energy Efficiency Ratio (SEER). These standard ratings are calculated using the user-entered data in the Coil:Cooling:DX:MultiSpeed object. These AHRI Standard ratings apply only to air-to-air unitary heat pumps and air conditioners with rated cooling capacities less than 65,000 Btu/h (19,000 Watts). The equations required to calculate the net cooling capacity and SEER values according to the AHRI 2017 standard are outlined in the next two sections. Further detail can be found in the AHRI Standard 210-240 (2017) (section 11). -[AHRI 2023] Support for the 2023 version of this Standard was added in EnergyPlus version 22.2. The updated Standard Ratings are designated as: Standard Rating (Net) Cooling Capacity, Energy Efficiency Ratio (EER2), and Seasonal Energy Efficiency Ratio (SEER2). As with th 2017 version, this standard and ratings apply only to air-to-air unitary heat pumps and air conditioners with rated cooling capacities less than 65,000 Btu/h (19 kW). The equations used in this implementation are detailed in the AHRI standard (Section 11). The reader can download the standard document to view these details from AHRI(https://www.ahrinet.org/search-standards/ahri-210240-2023-2020-performance-rating-unitary-air-conditioning-air-source-heat). +[AHRI 2023] Support for the 2023 version of this Standard was added in EnergyPlus version 22.2. The updated Standard Ratings are designated as: Standard Rating (Net) Cooling Capacity, Energy Efficiency Ratio (EER2), and Seasonal Energy Efficiency Ratio (SEER2). As with the 2017 version, this standard and ratings apply only to air-to-air unitary heat pumps and air conditioners with rated cooling capacities less than 65,000 Btu/h (19 kW). The equations used in this implementation are detailed in the AHRI standard (Section 11). The reader can download the standard document to view these details from AHRI(https://www.ahrinet.org/search-standards/ahri-210240-2023-2020-performance-rating-unitary-air-conditioning-air-source-heat). ANSI/AHRI Standard 340-360 (AHRI 2022) -The Standard Rating calulations defined in this standard include: Standard Rating Cooling Capacity, Energy Efficiency Ratio (EER) and Integrated Energy Efficiency Ratio (IEER). These standard ratings are calculated using the user-entered data in the Coil:Cooling:DX:MultiSpeed object (see the EnergyPlus I/O Reference manual for details). According to AHRI Standard, these ratings apply to factory-made Commercial and Industrial Unitary Air-conditioning and Heat Pump Equipment with rated cooling/heating capcities greater than 65,000 Btu/h (19 kW) and less than 250,000 Btu/h (73.2 kW). The equations used in this implementation are detailed in this standard (Section 6). The reader can download the standard document to view these details from AHRI(https://www.ahrinet.org/search-standards/ahri-340360-i-p2022-performance-rating-commercial-and-industrial-unitary-air). +The Standard Rating calculations defined in this standard include: Standard Rating Cooling Capacity, Energy Efficiency Ratio (EER) and Integrated Energy Efficiency Ratio (IEER). These standard ratings are calculated using the user-entered data in the Coil:Cooling:DX:MultiSpeed object (see the EnergyPlus I/O Reference manual for details). According to AHRI Standard, these ratings apply to factory-made Commercial and Industrial Unitary Air-conditioning and Heat Pump Equipment with rated cooling/heating capacities greater than 65,000 Btu/h (19 kW) and less than 250,000 Btu/h (73.2 kW). The equations used in this implementation are detailed in this standard (Section 6). The reader can download the standard document to view these details from AHRI(https://www.ahrinet.org/search-standards/ahri-340360-i-p2022-performance-rating-commercial-and-industrial-unitary-air). Standard Ratings Reporting The values for these Standard Ratings are reported in the eplusout.eio output file and also in the predefined tabular output reports (Output:Table:SummaryReports object, '2017 Standard Ratings for DX Coils' and '2023 Standard Ratings for DX Coils'). @@ -2670,7 +2670,7 @@ \subsubsection{Standard Rating of Two-Speed DX Cooling Coils}\label{standard-rat For Two-Speed direct expansion cooling coils, the following industry standard ratings are calculated and reported according to the industry standards listed below: ANSI/AHRI Standard 340-360 (AHRI 2022) -The Standard Rating calulations defined in this standard include: Standard Rating Cooling Capacity, Energy Efficiency Ratio (EER) and Integrated Energy Efficiency Ratio (IEER). These standard ratings are calculated using the user-entered data in the Coil:Cooling:DX:TwoSpeed object (see the I/O Reference manual for details). According to Standard, these ratings apply to factory-made Commercial and Industrial Unitary Air-conditioning and Heat Pump Equipment with rated cooling/heating capcities greater than 65,000 Btu/h (19 kW) and less than 250,000 Btu/h (73.2 kW). The equations used in this implementation are outlined in the next section. For more detail is provided in this standard itself (Section 6). The reader can download the standard document to view these details from AHRI(https://www.ahrinet.org/search-standards/ahri-340360-i-p2022-performance-rating-commercial-and-industrial-unitary-air). +The Standard Rating calculations defined in this standard include: Standard Rating Cooling Capacity, Energy Efficiency Ratio (EER) and Integrated Energy Efficiency Ratio (IEER). These standard ratings are calculated using the user-entered data in the Coil:Cooling:DX:TwoSpeed object (see the I/O Reference manual for details). According to Standard, these ratings apply to factory-made Commercial and Industrial Unitary Air-conditioning and Heat Pump Equipment with rated cooling/heating capacities greater than 65,000 Btu/h (19 kW) and less than 250,000 Btu/h (73.2 kW). The equations used in this implementation are outlined in the next section. For more detail is provided in this standard itself (Section 6). The reader can download the standard document to view these details from AHRI(https://www.ahrinet.org/search-standards/ahri-340360-i-p2022-performance-rating-commercial-and-industrial-unitary-air). Standard Ratings Reporting The values for these Standard Ratings are reported in the eplusout.eio output file and also in the predefined tabular output reports (Output:Table:SummaryReports object, '2017 Standard Ratings for DX Coils' and '2023 Standard Ratings for DX Coils'). @@ -3134,11 +3134,11 @@ \subsubsection{Standard Rating of Variable Speed DX Cooling Coils}\label{standar For variable speed direct expansion cooling coils, the following industry standard ratings are calculated and reported according to the industry standards listed below: ANSI/AHRI Standard 210-240 (AHRI 2017 and 2023) -[AHRI 2017] The Standard Rating calulations defined in the 2017 version of this standard include: Standard Rating Cooling Capacity, Energy Efficiency Ratio (EER), Integrated Energy Efficiency Ratio (IEER), and Seasonal Energy Efficiency Ratio (SEER). These standard ratings are calculated using the user-entered data in the Coil:Cooling:DX:MultiSpeed object. These AHRI Standard ratings apply only to air-to-air unitary heat pumps and air conditioners with rated cooling capacities less than 65,000 Btu/h (19,000 Watts). The equations required to calculate the net cooling capacity and SEER values aaccording to the AHRI 2017 standard are outlined below (sections 15.2.5.9 and 15.2.5.10) further detail can be found in the AHRI Standard 210-240 (2017) (section 11). -[AHRI 2023] Support for the 2023 version of this Standard was added in EnergyPlus version 22.2. The updated Standard Ratings are designated as: Standard Rating Cooling Capacity, Energy Efficiency Ratio (EER2), and Seasonal Energy Efficiency Ratio (SEER2). As with th 2017 version, this standard and ratings apply only to air-to-air unitary heat pumps and air conditioners with rated cooling capacities less than 65,000 Btu/h (19 kW). The equations used in this implementation are detailed in the AHRI standard (Section 11). The reader can download the standard document to view these details from AHRI(https://www.ahrinet.org/search-standards/ahri-210240-2023-2020-performance-rating-unitary-air-conditioning-air-source-heat). +[AHRI 2017] The Standard Rating calculations defined in the 2017 version of this standard include: Standard Rating Cooling Capacity, Energy Efficiency Ratio (EER), Integrated Energy Efficiency Ratio (IEER), and Seasonal Energy Efficiency Ratio (SEER). These standard ratings are calculated using the user-entered data in the Coil:Cooling:DX:MultiSpeed object. These AHRI Standard ratings apply only to air-to-air unitary heat pumps and air conditioners with rated cooling capacities less than 65,000 Btu/h (19,000 Watts). The equations required to calculate the net cooling capacity and SEER values according to the AHRI 2017 standard are outlined below (sections 15.2.5.9 and 15.2.5.10) further detail can be found in the AHRI Standard 210-240 (2017) (section 11). +[AHRI 2023] Support for the 2023 version of this Standard was added in EnergyPlus version 22.2. The updated Standard Ratings are designated as: Standard Rating Cooling Capacity, Energy Efficiency Ratio (EER2), and Seasonal Energy Efficiency Ratio (SEER2). As with the 2017 version, this standard and ratings apply only to air-to-air unitary heat pumps and air conditioners with rated cooling capacities less than 65,000 Btu/h (19 kW). The equations used in this implementation are detailed in the AHRI standard (Section 11). The reader can download the standard document to view these details from AHRI(https://www.ahrinet.org/search-standards/ahri-210240-2023-2020-performance-rating-unitary-air-conditioning-air-source-heat). ANSI/AHRI Standard 340-360 (AHRI 2022) -The Standard Rating calulations defined in this standard include: Standard Rating Cooling Capacity, Energy Efficiency Ratio (EER) and Integrated Energy Efficiency Ratio (IEER). These standard ratings are calculated using the user-entered data in the Coil:Cooling:VariableSpeed object (see the EnergyPlus I/O Reference manual for details). According to AHRI Standard, these ratings apply to factory-made Commercial and Industrial Unitary Air-conditioning and Heat Pump Equipment with rated cooling/heating capcities greater than 65,000 Btu/h (19 kW) and less than 250,000 Btu/h (73.2 kW). The equations used in this implementation are detailed in this standard (Section 6). The reader can download the standard document to view these details from AHRI(https://www.ahrinet.org/search-standards/ahri-340360-i-p2022-performance-rating-commercial-and-industrial-unitary-air). +The Standard Rating calculations defined in this standard include: Standard Rating Cooling Capacity, Energy Efficiency Ratio (EER) and Integrated Energy Efficiency Ratio (IEER). These standard ratings are calculated using the user-entered data in the Coil:Cooling:VariableSpeed object (see the EnergyPlus I/O Reference manual for details). According to AHRI Standard, these ratings apply to factory-made Commercial and Industrial Unitary Air-conditioning and Heat Pump Equipment with rated cooling/heating capacities greater than 65,000 Btu/h (19 kW) and less than 250,000 Btu/h (73.2 kW). The equations used in this implementation are detailed in this standard (Section 6). The reader can download the standard document to view these details from AHRI(https://www.ahrinet.org/search-standards/ahri-340360-i-p2022-performance-rating-commercial-and-industrial-unitary-air). Standard Ratings Reporting The values for these Standard Ratings are reported in the eplusout.eio output file and also in the predefined tabular output reports (Output:Table:SummaryReports object, '2017 Standard Ratings for DX Coils' and '2023 Standard Ratings for DX Coils'). diff --git a/doc/engineering-reference/src/simulation-models-encyclopedic-reference-002/air-system-compound-component-groups.tex b/doc/engineering-reference/src/simulation-models-encyclopedic-reference-002/air-system-compound-component-groups.tex index 3d96644eeed..d331b6b5c4e 100644 --- a/doc/engineering-reference/src/simulation-models-encyclopedic-reference-002/air-system-compound-component-groups.tex +++ b/doc/engineering-reference/src/simulation-models-encyclopedic-reference-002/air-system-compound-component-groups.tex @@ -207,7 +207,7 @@ \subsubsection{Load based control:}\label{load-based-control} \emph{\({\dot m_{Speed1}}\)} is the air mass flow rate through unitary system at Speed 1 (kg/s) -\(\Delta_{sen,Speed1}\) is th sensible load difference between the system output node and the zone inlet node at full-load conditions at Speed 1. +\(\Delta_{sen,Speed1}\) is the sensible load difference between the system output node and the zone inlet node at full-load conditions at Speed 1. \begin{equation} \begin{split} @@ -1065,7 +1065,7 @@ \subsubsection{Model Description}\label{model-description-2} If Heating Priority is specified and the total heating requirement in all zones is not equal to zero, then heating is selected as the operating mode. If the total heating requirement is equal to zero and the total cooling requirement is not equal to zero, then cooling is selected as the operating mode. If the total cooling requirement and total heating requirement are equal to zero then the zones are allowed to float (no heating or cooling provided). -If Zone Priority is specified and the total number of zones requiring cooling is greater than the total number of zones requiring heating, then cooling is selected as the operating mode. If the total number of zones requiring heating is greater than the total number of zones requiring cooling, then heating is selected as the operating mode. If the total number of zones requiring cooling is equal to the total number of zones requiring heating, then the magnitude of the total cooling and heating requirements for all zones sets the operating mode. In this case, if the magnitudes of the cooling and heating requirements are zero, then the zones are allowed to float (no heating or cooing provided). If the magnitudes of the cooling and heating requirements are non-zero and identical, then cooling is selected as the operating mode. +If Zone Priority is specified and the total number of zones requiring cooling is greater than the total number of zones requiring heating, then cooling is selected as the operating mode. If the total number of zones requiring heating is greater than the total number of zones requiring cooling, then heating is selected as the operating mode. If the total number of zones requiring cooling is equal to the total number of zones requiring heating, then the magnitude of the total cooling and heating requirements for all zones sets the operating mode. In this case, if the magnitudes of the cooling and heating requirements are zero, then the zones are allowed to float (no heating or cooling provided). If the magnitudes of the cooling and heating requirements are non-zero and identical, then cooling is selected as the operating mode. \paragraph{Calculation of Bypass Duct Mixer Node Conditions}\label{calculation-of-bypass-duct-mixer-node-conditions} diff --git a/doc/engineering-reference/src/simulation-models-encyclopedic-reference-003/centralheatpumpsystem.tex b/doc/engineering-reference/src/simulation-models-encyclopedic-reference-003/centralheatpumpsystem.tex index e03854523b1..7d1142d21a0 100644 --- a/doc/engineering-reference/src/simulation-models-encyclopedic-reference-003/centralheatpumpsystem.tex +++ b/doc/engineering-reference/src/simulation-models-encyclopedic-reference-003/centralheatpumpsystem.tex @@ -6,7 +6,7 @@ \subsection{Overview}\label{overview-007} \subsection{Model Description}\label{model-description-004} -The model first determines operating modes based on the cooling and heating loads on the system, and then decides which calculation algorithm is called. It calls the cooling calculation subroutine when cooling load is demanded, the heating calculation subroutine when heating load is demanded, and both cooling and heating calculation subroutines when both cooling and heating loads are demanded, i.e., simultaneous cooing-heating mode. It then calculates mass-weighed temperatures and heat transfer energy. Six different operating modes (0 through 5) are possible: +The model first determines operating modes based on the cooling and heating loads on the system, and then decides which calculation algorithm is called. It calls the cooling calculation subroutine when cooling load is demanded, the heating calculation subroutine when heating load is demanded, and both cooling and heating calculation subroutines when both cooling and heating loads are demanded, i.e., simultaneous cooling-heating mode. It then calculates mass-weighed temperatures and heat transfer energy. Six different operating modes (0 through 5) are possible: 0: off diff --git a/doc/engineering-reference/src/surface-heat-balance-manager-processes/conduction-through-the-walls.tex b/doc/engineering-reference/src/surface-heat-balance-manager-processes/conduction-through-the-walls.tex index 3e7cc7acfc0..5b3e287fde2 100644 --- a/doc/engineering-reference/src/surface-heat-balance-manager-processes/conduction-through-the-walls.tex +++ b/doc/engineering-reference/src/surface-heat-balance-manager-processes/conduction-through-the-walls.tex @@ -143,7 +143,7 @@ \subsection{Calculation of Conduction Transfer Functions}\label{calculation-of-c The accuracy of the state space method of calculating CTFs has been addressed in the literature.~ Ceylan and Myers (1980) compared the response predicted by the state space method to various other solution techniques including an analytical solution.~ Their results showed that for an adequate number of nodes the state space method computed a heat flux at the surface of a simple one layer slab within 1\% of the analytical solution.~ Ouyang and Haghighat (1991) made a direct comparison between the Laplace and state space methods.~ For a wall composed of insulation between two layers of concrete, they found almost no difference in the response factors calculated by each method. -While more time consuming than calculating CTFs using the Laplace Transform method, the matrix algebra (including the calculation of an inverse and exponential matrix for A) is easier to follow than root find algorithms.~ Another difference between the Laplace and State Space methods is the number of coefficients required for a solution.~ In general, the State Space method requires more coefficients.~ In addition, the number of temperature and flux history terms is identical (nz = nq).~ Note that as with the Laplace method that the actual number of terms will vary from construction to construction. +While more time consuming than calculating CTFs using the Laplace Transform method, the matrix algebra (including the calculation of an inverse and exponential matrix for A) is easier to follow than root-finding algorithms.~ Another difference between the Laplace and State Space methods is the number of coefficients required for a solution.~ In general, the State Space method requires more coefficients.~ In addition, the number of temperature and flux history terms is identical (nz = nq).~ Note that as with the Laplace method that the actual number of terms will vary from construction to construction. Two distinct advantages of the State Space method over the Laplace method that are of interest when applying a CTF solution for conduction through a building element are the ability to obtain CTFs for much shorter time steps and the ability to obtain 2- and 3-D conduction transfer functions.~ While not implemented in the Toolkit, both Seem (1987) and Strand (1995) have demonstrated the effectiveness of the State Space method in handling these situations that can have important applications in buildings. diff --git a/doc/essentials/src/essentials.tex b/doc/essentials/src/essentials.tex index e7fddad3dc6..b81e087da89 100644 --- a/doc/essentials/src/essentials.tex +++ b/doc/essentials/src/essentials.tex @@ -42,7 +42,7 @@ \section{What is BEM?} \begin{itemize} \item \href{https://www.ashrae.org/technical-resources/ashrae-handbook/description-2017-ashrae-handbook-fundamentals}{2017 ASHRAE Handbook - Fundamentals }Chapter 19 Energy Estimating and Modeling Methods -\item \href{https://www.bemlibrary.com/}{BEM Libary} +\item \href{https://www.bemlibrary.com/}{BEM Library} \item \href{http://www.ibpsa.org/?page_id=695}{IBPSA}, \href{https://www.ibpsa.us/videos/all}{IBPSA-USA}, and \href{https://www.youtube.com/results?search_query=building+energy+modeling}{YouTube} videos @@ -89,7 +89,7 @@ \section{Questions that BEM can answer} The most common questions that BEM can answer are: \begin{itemize} \item If my building was made or operated differently, how would the required -equpment capacity and energy consumption change? +equipment capacity and energy consumption change? \item Does my building comply with a building energy code or standard? \item What kind of rating or how many points can I get in an environmental certification program? @@ -983,7 +983,7 @@ \section{What Are All These Output Files?} \item ERR -- list of errors and warnings \item TABLE.HTML, TABLE.TXT, TABLE.TAB, TABLE.CSV, TABLE.XML -- tabulated report of the bin and monthly data in HTML, space delimited, tab delimited, -comma delimited, or XML format. This is one of the primary otuput +comma delimited, or XML format. This is one of the primary output files. \item CSV, TAB, or TXT -- time series output from the Output:Variable input object in a comma, tab, or space delimited format (generated by the @@ -1101,7 +1101,7 @@ \section{Data Sets} DataSets -- which contains IDF snippets and MacroDataSets -- which also contain IDF snippets but are in a form such that they can be easily used with the EPMacro program. Another data set are DDY files -that acompany each EPW weather file. The DDY files include several +that accompany each EPW weather file. The DDY files include several varieties of the corresponding design day data for each weather file location. @@ -1168,7 +1168,7 @@ \section{Simulation Parameters} related to the simulation that, in general, should be allowed to default. \end{itemize} For a new modeler, the following input objects may be omitted. They -can be added later for special cases althought they and appear in +can be added later for special cases although they appear in almost all of the example files: \begin{itemize} \item Timestep - the number of timesteps each hour and usually set to 6. @@ -1204,7 +1204,7 @@ \section{Location and Climate} to the full year. When debugging a file, a shorter period of time can be used to speed up the simulation portion of the Run-Check-Edit cycle. -\item RunPeriodControl:SpecialDays - allows specfication of holidays and +\item RunPeriodControl:SpecialDays - allows specification of holidays and a good example can be seen in 5ZoneCostEst.idf. \item RunPeriodControl:DaylightSavingTime - allows the specification of the start and ending period for daylight savings time. This will impact diff --git a/doc/getting-started/src/energy-meters/standard-energy-meters.tex b/doc/getting-started/src/energy-meters/standard-energy-meters.tex index 24fd5d9fa3b..083b4327af6 100644 --- a/doc/getting-started/src/energy-meters/standard-energy-meters.tex +++ b/doc/getting-started/src/energy-meters/standard-energy-meters.tex @@ -61,7 +61,8 @@ \section{Standard Energy Meters}\label{standard-energy-meters} Water \tabularnewline Steam \tabularnewline DistrictCooling \tabularnewline -DistrictHeating \tabularnewline +DistrictHeatingWater \tabularnewline +DistrictHeatingSteam \tabularnewline \bottomrule \end{longtable} diff --git a/doc/getting-started/src/tutorial-example-for-running-energyplus/instructions.tex b/doc/getting-started/src/tutorial-example-for-running-energyplus/instructions.tex index fcc3923832c..17f3a502586 100644 --- a/doc/getting-started/src/tutorial-example-for-running-energyplus/instructions.tex +++ b/doc/getting-started/src/tutorial-example-for-running-energyplus/instructions.tex @@ -28,7 +28,7 @@ \subsection{Exercise 1A. Run Pre-Defined Building with no Windows}\label{exercis \item Outdoor Dry Bulb -- is being reported (so you can compare to outside temperature) \item - The meter for the heating in the facility - DistrictHeating:Facility -- is being reported. Facility is the entire building. + The meter for the heating in the facility - DistrictHeatingWater:Facility -- is being reported. Facility is the entire building. \item The meter for the cooling in the facility - DistrictCooling:Facility -- is being reported. \end{itemize} diff --git a/doc/input-output-reference/src/overview/group-airflow-network.tex b/doc/input-output-reference/src/overview/group-airflow-network.tex index 61599bfaeaa..d06129e9d67 100644 --- a/doc/input-output-reference/src/overview/group-airflow-network.tex +++ b/doc/input-output-reference/src/overview/group-airflow-network.tex @@ -2156,8 +2156,12 @@ \subsubsection{Inputs}\label{inputs-2016-06-16} \hyperref[coilcoolingdxtwostagewithhumiditycontrolmode]{Coil:Cooling:DX:TwoStageWithHumidityControlMode} \item \hyperref[coilcoolingdxmultispeed]{Coil:Cooling:DX:MultiSpeed} +\item + \hyperref[coilcoolingdxvariablespeed]{Coil:Cooling:DX:VariableSpeed} \item \hyperref[coilheatingdxmultispeed]{Coil:Heating:DX:MultiSpeed} +\item + \hyperref[coilheatingdxvariablespeed]{Coil:Heating:DX:VariableSpeed} \item \hyperref[coilheatingdesuperheater]{Coil:Heating:Desuperheater} \end{itemize} diff --git a/doc/input-output-reference/src/overview/group-airflow.tex b/doc/input-output-reference/src/overview/group-airflow.tex index f70b854e548..218ac1dab71 100644 --- a/doc/input-output-reference/src/overview/group-airflow.tex +++ b/doc/input-output-reference/src/overview/group-airflow.tex @@ -1927,7 +1927,7 @@ \subsubsection{Outputs}\label{zoneearthtube-outputs} This is the wet bulb temperature of the air entering the zone after passing through the earth tube {[}C{]}. -\paragraph{Earth Tube Zone Inlet Humidity Ratio {[}kgWater/krDryAir{]}}\label{earth-tube-zone-inlet-humidity-ratio-kgWater/kgDryAir} +\paragraph{Earth Tube Zone Inlet Humidity Ratio {[}kgWater/krDryAir{]}}\label{earth-tube-zone-inlet-humidity-ratio-kgWater-kgDryAir} This is the humidity ratio of the air entering the zone after passing through the earth tube {[}kgWater/kgDryAir{]}. diff --git a/doc/input-output-reference/src/overview/group-daylighting.tex b/doc/input-output-reference/src/overview/group-daylighting.tex index 769bf3ae999..cedc47a96e2 100644 --- a/doc/input-output-reference/src/overview/group-daylighting.tex +++ b/doc/input-output-reference/src/overview/group-daylighting.tex @@ -20,7 +20,7 @@ \subsubsection{Inputs}\label{inputs-009} The name of the \hyperref[zone]{Zone} or \hyperref[space]{Space} to which the following daylighting-related input applies. If a zone name is specified, the zone must lie completely within a single solar enclosure. -\paragraph{Field: Daylighting Method}\label{field-Daylighting Method} +\paragraph{Field: Daylighting Method}\label{field-daylighting-method} The Daylighting Method field can be set to either of the following: SplitFlux or DElight. Different Zones can have different settings in the same file but in a single zone only one method should be used at a time. Guidelines for using the SplitFlux method and additional details on the DElight method are shown in following sections. @@ -89,7 +89,7 @@ \subsubsection{Inputs}\label{inputs-009} May be specified if a stepped lighting control system (Lighting Control Type set to Stepped) is manually operated, such as in a simple, one-step (on-off) system. Gives the probability the occupants of a daylit zone will set the electric lights to the correct level to obtain the required illuminance. The rest of the time the lights are assumed to be set one step too high. For example, consider an on-off lighting system (Number of Steps = 1) with a set point of 600 lux and 0.7 reset probability. Then, when daylighting exceeds 600 lux, the electric lights will be off 70\% of the time and on 30\% of the time. -\paragraph{Field: Glare Calculation Daylighting Reference Point Name}\label{field-glare calculation-daylighting-reference-point-name} +\paragraph{Field: Glare Calculation Daylighting Reference Point Name}\label{field-glare-calculation-daylighting-reference-point-name} The \hyperref[daylightingreferencepoint-000]{Daylighting:ReferencePoint} name should be specified that is used for determining the glare. Only one reference point is used to calculate the glare. This input is only used in when the Daylighting Method is set to SplitFlux. This input is ignored when Daylighting Method is set to DElight. diff --git a/doc/input-output-reference/src/overview/group-electric-load-center-generator.tex b/doc/input-output-reference/src/overview/group-electric-load-center-generator.tex index c36ba22bab5..40192856bf8 100644 --- a/doc/input-output-reference/src/overview/group-electric-load-center-generator.tex +++ b/doc/input-output-reference/src/overview/group-electric-load-center-generator.tex @@ -40,7 +40,7 @@ \subsubsection{Inputs}\label{inputs-014} \paragraph{Field: Transformer Usage}\label{field-transformer-usage} -This field indicates one of the three supported transformer application types: PowerInFromGrid, PowerOutToGrid, and LoadCenterPowerConditioning. A PowerInFromGrid type of transformer is used to step down voltage from the electricity grid to the building. The transformer with this type of use is somewhat free standing and does not need to be referenced in any \hyperref[electricloadcenterdistribution]{ElectricLoadCenter:Distribution} object. There should be only one PowerInFromGrid transformer in the model. A PowerOutToGrid type of transformer is used to match voltage from the building to the electricity grid. This conditions power exported out of the facility and feed back into the grid. This type of transformer will only be needed if the building ever exports power and the building and grid connection have different voltages. There should be only one PowerOutToGrid transformer in the model and it will serve all the surplus electricity produced by electric load center(s). A LoadCenterPowerConditioning type of transformer is used to match voltage between an electic load center (subpanel) and the facility's main panel. Each electric load center can have its own transformer to condition power fed into the main panel. For electric load centers that also draw power from the main panel, to charge storage, the transformer is assumed to operate in both directions (at the same performance). This type of transformer should be named in an \hyperref[electricloadcenterdistribution]{ElectricLoadCenter:Distribution} object. +This field indicates one of the three supported transformer application types: PowerInFromGrid, PowerOutToGrid, and LoadCenterPowerConditioning. A PowerInFromGrid type of transformer is used to step down voltage from the electricity grid to the building. The transformer with this type of use is somewhat free standing and does not need to be referenced in any \hyperref[electricloadcenterdistribution]{ElectricLoadCenter:Distribution} object. There should be only one PowerInFromGrid transformer in the model. A PowerOutToGrid type of transformer is used to match voltage from the building to the electricity grid. This conditions power exported out of the facility and feed back into the grid. This type of transformer will only be needed if the building ever exports power and the building and grid connection have different voltages. There should be only one PowerOutToGrid transformer in the model and it will serve all the surplus electricity produced by electric load center(s). A LoadCenterPowerConditioning type of transformer is used to match voltage between an electric load center (subpanel) and the facility's main panel. Each electric load center can have its own transformer to condition power fed into the main panel. For electric load centers that also draw power from the main panel, to charge storage, the transformer is assumed to operate in both directions (at the same performance). This type of transformer should be named in an \hyperref[electricloadcenterdistribution]{ElectricLoadCenter:Distribution} object. \paragraph{Field: Zone Name}\label{field-zone-name-005} @@ -149,7 +149,7 @@ \subsubsection{Outputs}\label{outputs-010} \item HVAC,Average,Transformer Output Electricity Rate {[}W{]} \item - HVAC,Sum,Transformer Output Elecric Energy {[}J{]} + HVAC,Sum,Transformer Output Electric Energy {[}J{]} \item HVAC,Average,Transformer Input Electricity Rate {[}W{]} \item @@ -178,7 +178,7 @@ \subsubsection{Outputs}\label{outputs-010} \paragraph{Transformer Output Electricity Rate {[}W{]}}\label{transformer-output-electric-power-w} -\paragraph{Transformer Output Elecric Energy {[}J{]}}\label{transformer-output-elecric-energy-j} +\paragraph{Transformer Output Electric Energy {[}J{]}}\label{transformer-output-electric-energy-j} These outputs are the total electricity power or energy provided by the transformer. They are equal to the metered loads which are wired to the transformer. These values are calculated for each HVAC system timestep being simulated, and the results are averaged (for power) or summed (for energy) for the timestep being reported. diff --git a/doc/input-output-reference/src/overview/group-heating-and-cooling-coils.tex b/doc/input-output-reference/src/overview/group-heating-and-cooling-coils.tex index 9581e3197ee..a572b80ac56 100644 --- a/doc/input-output-reference/src/overview/group-heating-and-cooling-coils.tex +++ b/doc/input-output-reference/src/overview/group-heating-and-cooling-coils.tex @@ -4222,7 +4222,7 @@ \subsubsection{Inputs}\label{inputs-19-001} This numeric field defines the capacity of the resistive defrost heating element in Watts. This input field is used only when the selected defrost strategy is resistive (see input field Defrost Strategy above). The value for this input field must be greater than or equal to 0. If this input field is left blank, the default value is 0. -\paragraph{Field: Region Number for Calculating HSPF (2017) and HSPF2 (2023)}\label{field-region-number-for-calculating-HSPF-(2017)-and-hspf2-(2023)} +\paragraph{Field: Region Number for Calculating HSPF (2017) and HSPF2 (2023)}\label{field-region-number-for-calculating-HSPF-2017-and-hspf2-2023} This optional numeric field defines the region number which is used in calculating the Heating Seasonal Performance Factor (HSPF (2017 ANSI/AHRI standard) and HSPF2 (2023 ANSI/AHRI standard)) of heating coils. The value for this input field must be between 1 and 6. If this input field is left blank, the default value is 4. diff --git a/doc/input-output-reference/src/overview/group-operational-faults.tex b/doc/input-output-reference/src/overview/group-operational-faults.tex index abfdb1346f7..54e19388df9 100644 --- a/doc/input-output-reference/src/overview/group-operational-faults.tex +++ b/doc/input-output-reference/src/overview/group-operational-faults.tex @@ -857,11 +857,11 @@ \subsubsection{Inputs} This field provides the name of a schedule that represents severity of a fault. This schedule should be set to a non-zero value when a fault is applicable and 0.0 when it is not. If this field is blank, the schedule has values of 1 for all time periods. This is used to increase or decrease the fouling by a percentage. For example, if the schedule has a value of 1.2, it implies 20\% more fouling: if the Fouling Factor is 0.8, then resulting Fouling Factor would be $0.8 / 1.2 = 0.67$. -\paragraph{Field: Evaporative Cooler Object Type}\label{field-evaporative cooler-object-type} +\paragraph{Field: Evaporative Cooler Object Type}\label{field-evaporative-cooler-object-type} This field defines the evaporative cooler object type that this fault is associated with. Choices are the wetted coil evaporative coolers. -\paragraph{Field: Evaporative Cooler Object Name}\label{field-evaporative cooler-object-name} +\paragraph{Field: Evaporative Cooler Object Name}\label{field-evaporative-cooler-object-name} This field defines the name of the evaporative cooler object associated with the fault. It should be one of the objects with the defined types. diff --git a/doc/input-output-reference/src/overview/group-performance-curves.tex b/doc/input-output-reference/src/overview/group-performance-curves.tex index 37a96ce5ae7..6f8f877b647 100644 --- a/doc/input-output-reference/src/overview/group-performance-curves.tex +++ b/doc/input-output-reference/src/overview/group-performance-curves.tex @@ -1066,7 +1066,7 @@ \subsubsection{Inputs}\label{inputs-6-016} \subsection{Curve:Biquadratic}\label{curvebiquadratic} -This curve is a function of two independent variables. Input consists of the curve name, the six coefficients, and min and max values for each of the independent variables. Optional inputs for curve minimum and maximum may be used to limit the output of the performance curve (e.g., limit extrapolation). The equation represented by the bicubic curve is: +This curve is a function of two independent variables. Input consists of the curve name, the six coefficients, and min and max values for each of the independent variables. Optional inputs for curve minimum and maximum may be used to limit the output of the performance curve (e.g., limit extrapolation). The equation represented by the biquadratic curve is: \begin{equation} z = {C_1} + {C_2}*x + {C_3}*{x^2} + {C_4}*y + {C_5}*{y^2} + {C_6}*xy diff --git a/doc/input-output-reference/src/overview/group-plant-condenser-control.tex b/doc/input-output-reference/src/overview/group-plant-condenser-control.tex index bd931e9c419..ca6f9b310c3 100644 --- a/doc/input-output-reference/src/overview/group-plant-condenser-control.tex +++ b/doc/input-output-reference/src/overview/group-plant-condenser-control.tex @@ -461,9 +461,9 @@ \subsubsection{Inputs}\label{inputs-13-009} \subsection{PlantEquipmentOperation:ChillerHeaterChangeover}\label{plantequipmentoperationchillerheaterchangeover} -Plant operation can difficult to control when air-to-water or water-to-water heat pumps are used as plant equipment. Individual machines can be operated either as cooling or heat devices at any given time. This object will poll the building to determine what type of loads are dominant and determine how the plant equipment should operate. Once the mode of operation is set the apparant plant loads are dispatched to equipment listed to meet those loads. For example, a heat pump capable of providing heating or cooling will be dispatched in heating mode. It is also possible to create a heat recovery heat pump connected between the heating and cooling plant loops where this heat pump can serve low loads on one plant while supplementing the operation of the other plant. Traditional plant controls cannot meet this type of equipment configuration. This object provides a supervisory controller can be used to control one heating and one cooling hydronic plant. +Plant operation can difficult to control when air-to-water or water-to-water heat pumps are used as plant equipment. Individual machines can be operated either as cooling or heat devices at any given time. This object will poll the building to determine what type of loads are dominant and determine how the plant equipment should operate. Once the mode of operation is set the apparent plant loads are dispatched to equipment listed to meet those loads. For example, a heat pump capable of providing heating or cooling will be dispatched in heating mode. It is also possible to create a heat recovery heat pump connected between the heating and cooling plant loops where this heat pump can serve low loads on one plant while supplementing the operation of the other plant. Traditional plant controls cannot meet this type of equipment configuration. This object provides a supervisory controller can be used to control one heating and one cooling hydronic plant. -This object is used as a special plant operation scheme intended for a specific type of plant with both heating and cooling plant loops served by heat pumps which can switch between heating and cooling. EnergyPlus's usual plant operation schemes focus on one plant at a time, however the need to cleanly control heat pumps switching between heating and cooling modes requires an operation scheme that considers both the heating and cooling plant loops at the same time. This object is intended to allow controlling both heating and cooling heating plants served by heat pumps that can changeover between heating and cooling. The main focus is air source heat pumps serving seperate cooling and heating plant loops. The scheme is also able to control operation of secondary heating and cooling loops. The fullest application of this scheme include boiler backup and control of a special water to water heat pump situated to exchange heat between the return hot water and return chilled water on the secondary loops. The following diagram shows the plant configuration supported by this supervisory controller. +This object is used as a special plant operation scheme intended for a specific type of plant with both heating and cooling plant loops served by heat pumps which can switch between heating and cooling. EnergyPlus's usual plant operation schemes focus on one plant at a time, however the need to cleanly control heat pumps switching between heating and cooling modes requires an operation scheme that considers both the heating and cooling plant loops at the same time. This object is intended to allow controlling both heating and cooling heating plants served by heat pumps that can changeover between heating and cooling. The main focus is air source heat pumps serving separate cooling and heating plant loops. The scheme is also able to control operation of secondary heating and cooling loops. The fullest application of this scheme include boiler backup and control of a special water to water heat pump situated to exchange heat between the return hot water and return chilled water on the secondary loops. The following diagram shows the plant configuration supported by this supervisory controller. \begin{figure}[hbtp] \centering @@ -483,11 +483,11 @@ \subsection{PlantEquipmentOperation:ChillerHeaterChangeover}\label{plantequipmen This supervisory plant controller polls the building to see how the current loads favor operating the plants in either a cooling-only, heating-only, or simultaneous cooling and heating mode. The building loads include the predicted sensible loads to setpoint for the listed zones, the ventilation loads on any central air handlers connected to those zones, and the loads from any process loads on plant (from a LoadProfile:Plant object). The controller determines which of the three modes the plant should be in based on the polled building loads. -Once the mode of operaton is determined, the controller dispatches the equipment based on the inputs for the operation scheme and equipment lists input for that mode using the current load on the primary plant side. The heat pumps are modeled with companion objects, where a single machine has both cooling and heating input objects. The PlantEquipmentOperation:CoolingLoad operating schemes should specify equipment lists with the cooling companion models (HeatPump:PlantLoop:EIR:Cooling) and the PlantEquipmentOperation:HeatingLoad operating schemes should point to the heating companion models (HeatPump:PlantLoop:EIR:Heating). The heat pump model inputs need to set the Control Type to ``Setpoint'' control. +Once the mode of operation is determined, the controller dispatches the equipment based on the inputs for the operation scheme and equipment lists input for that mode using the current load on the primary plant side. The heat pumps are modeled with companion objects, where a single machine has both cooling and heating input objects. The PlantEquipmentOperation:CoolingLoad operating schemes should specify equipment lists with the cooling companion models (HeatPump:PlantLoop:EIR:Cooling) and the PlantEquipmentOperation:HeatingLoad operating schemes should point to the heating companion models (HeatPump:PlantLoop:EIR:Heating). The heat pump model inputs need to set the Control Type to ``Setpoint'' control. -This controller includes special handing of boiler backup. Because air-source heat pumps can be limited in their ability to operate and cold outdoor air temperatures, in is necessary to coordinate boiler operation to provide heating during cold weather. If a simple hot water boiler is present on the heating loops, it will be operated as a supplemental or auxilary heater to be used when the heat pumps cannot deliver. For example when the outdoor air is below the Low Outdoor Air Temperature limit the air source heat pumps cannot operate and a boiler is used to meeting the setpoint. Boilers found on a primary hot water loop are considered auxiliary boilers while boilers found on a secondary hot water loop are considered supplemental boilers. Auxiliary boilers, if present, are operated when the outdoor air temperature is below the Outdoor Low Temperature and use the setpoint temperature determined by outdoor air reset. The usual location of an auxiliary boiler is in the branch serving as the outlet branch on the supply side of the primary hot water loop. Supplemental boilers, if present, are operated when the inlet fluid temperature is below a setpoint. The setpoint is determined by the lower of the secondary hot water setpoint and the outdoor air reset. The usual location of a supplemental boiler is in the branch serving as the outlet branch on the supply side of the secondary hot water loop. +This controller includes special handing of boiler backup. Because air-source heat pumps can be limited in their ability to operate and cold outdoor air temperatures, in is necessary to coordinate boiler operation to provide heating during cold weather. If a simple hot water boiler is present on the heating loops, it will be operated as a supplemental or auxiliary heater to be used when the heat pumps cannot deliver. For example when the outdoor air is below the Low Outdoor Air Temperature limit the air source heat pumps cannot operate and a boiler is used to meeting the setpoint. Boilers found on a primary hot water loop are considered auxiliary boilers while boilers found on a secondary hot water loop are considered supplemental boilers. Auxiliary boilers, if present, are operated when the outdoor air temperature is below the Outdoor Low Temperature and use the setpoint temperature determined by outdoor air reset. The usual location of an auxiliary boiler is in the branch serving as the outlet branch on the supply side of the primary hot water loop. Supplemental boilers, if present, are operated when the inlet fluid temperature is below a setpoint. The setpoint is determined by the lower of the secondary hot water setpoint and the outdoor air reset. The usual location of a supplemental boiler is in the branch serving as the outlet branch on the supply side of the secondary hot water loop. -This controller includes a special handling of a dedicated water to water heat pump used to recover heat directly between the return hot water and return chlled water. The cooling and heating companions of this heat pump are named in the object. These are used to efficiently exchange heat between the return flows on the secondary hot and chilled water returns. This dedicated water to water heat pump will operate when there is sufficient flows in both returns and can be controlled to not operate when loads are high. +This controller includes a special handling of a dedicated water to water heat pump used to recover heat directly between the return hot water and return chilled water. The cooling and heating companions of this heat pump are named in the object. These are used to efficiently exchange heat between the return flows on the secondary hot and chilled water returns. This dedicated water to water heat pump will operate when there is sufficient flows in both returns and can be controlled to not operate when loads are high. \subsubsection{Inputs}\label{inputs-plantequipmentoperationchillerheaterchangeover} @@ -513,11 +513,11 @@ \subsubsection{Inputs}\label{inputs-plantequipmentoperationchillerheaterchangeov \paragraph{Field: Primary Heating Plant Setpoint at Outdoor Low Temperature}\label{field-hot-water-setpoint-reset-max-temp-diff-plantequipmentoperationchillerheaterchangeover} -This required numeric field specifies the heating plant operating set point temperature at the low outdoor air temperature. This value is generally set to the warmest temperature the heat pump can deliver at the Outdoor Low Temperature. Degress C. +This required numeric field specifies the heating plant operating set point temperature at the low outdoor air temperature. This value is generally set to the warmest temperature the heat pump can deliver at the Outdoor Low Temperature. Degrees C. \paragraph{Field: Outdoor Low Temperature}\label{field-hot-water-setpoint-reset-ratio-plantequipmentoperationchillerheaterchangeover} -This required numeric field specifies the low outdoor air temperature used for outdoor air reset and heat pump control. This serves as the lower limit for when air source heat pumps can operate in heaing mode. If the outdoor air is colder than this setting, the air source heat pumps cannot operate. Degrees C. +This required numeric field specifies the low outdoor air temperature used for outdoor air reset and heat pump control. This serves as the lower limit for when air source heat pumps can operate in heating mode. If the outdoor air is colder than this setting, the air source heat pumps cannot operate. Degrees C. \paragraph{Field: Secondary Distribution Heating Plant Setpoint Temperature}\label{secondary-distribution-heating-plant-setpoint-temperature} @@ -627,7 +627,7 @@ \subsubsection{Inputs}\label{inputs-plantequipmentoperationchillerheaterchangeov \paragraph{Supervisory Plant Auxiliary Boiler Mode}\label{operation-scheme-outputs-boiler-operation-mode} -This integer output represents the plant operating mode for the auxilary and/or supplemental boiler. Off = 0, Heating = 1. +This integer output represents the plant operating mode for the auxiliary and/or supplemental boiler. Off = 0, Heating = 1. \paragraph{Supervisory Plant Operation Polled Building Heating Load}\label{operation-scheme-outputs-supervisory-plant-operation-sensed-heating-load} diff --git a/doc/input-output-reference/src/overview/group-simulation-parameters.tex b/doc/input-output-reference/src/overview/group-simulation-parameters.tex index 133543c557a..a8483b4722b 100644 --- a/doc/input-output-reference/src/overview/group-simulation-parameters.tex +++ b/doc/input-output-reference/src/overview/group-simulation-parameters.tex @@ -618,10 +618,10 @@ \subsubsection{Inputs}\label{inputs-10-019} This field applies to the shading calculation update frequency method called ``Periodic.'' When the method called ``Timestep'' is used the diffuse sky modeling always uses DetailedSkyDiffuseModeling. -\paragraph{Field: Output External Shading Calculation Results}\label{field-output-external-shading-calculation results} +\paragraph{Field: Output External Shading Calculation Results}\label{field-output-external-shading-calculation-results} This fields indicates whether or not (\textbf{Yes} or \textbf{No})to save internal shading calculation results to an external file, which can be imported back as needed. This file saves external sunlit fractions for all surfaces. If \textbf{Yes} is chosen, hourly shading fraction of all surfaces will be exported as a CSV file, naming as "output file prefix + shading" (the default name is "eplusshading.csv" if no output file prefix is defined). Each column of the CSV file lists the annually calculated shading fraction of each surface with time-step interval. It only writes data for each simulation day that shadows are calculated, e.g. once every 20 days by default. If the results are intended to be reused to be imported back using \textbf{Imported} in \textbf{\hyperref[field-shading-calculation-method]{Field: Shading Calculation Method}}, the Calculation Frequency should be set as one to write year-round hourly results. Design days are not included. The default choice is \textbf{No}. -\paragraph{Field: Disable Self-Shading Within Shading Zone Groups}\label{fieldself--disable-shading-within-a-zone-group} +\paragraph{Field: Disable Self-Shading Within Shading Zone Groups}\label{field-self--disable-shading-within-a-zone-group} This fields specifies during shading calculation, for all surfaces in a targeted Zone Group, whether or not (\textbf{Yes} or \textbf{No} ) the self-shading effect by exterior surfaces of all zones within the target Zone Group is disabled. If Yes, self-shading will be disabled from all exterior surfaces in a given Shading Zone Group to surfaces within the same Shading Zone Group. If both Disable Self-Shading Within Shading Zone Groups and Disable Self-Shading From Shading Zone Groups to Other Zones = Yes, then all self-shading from exterior surfaces will be disabled.If only one of these fields = Yes, then at least one Shading Zone Group must be specified, or this field will be ignored. Shading from Shading:* surfaces, overhangs, fins, and reveals will not be disabled. \paragraph{Field: Disable Self-Shading From Shading Zone Groups to Other Zones}\label{field-self-disable-shading-between-zone-groups} diff --git a/doc/input-output-reference/src/overview/group-surface-construction-elements.tex b/doc/input-output-reference/src/overview/group-surface-construction-elements.tex index d5af6da4a1d..c107bfc842b 100644 --- a/doc/input-output-reference/src/overview/group-surface-construction-elements.tex +++ b/doc/input-output-reference/src/overview/group-surface-construction-elements.tex @@ -4118,7 +4118,7 @@ \subsubsection{Outputs}\label{outputs-36-1} This output is the temperature within the surface at the location of the source/sink. -\paragraph{Surface Internal User Specified Location Temperature {[}C{]}}\label{surface-internal-user—specified-location-temperature-c} +\paragraph{Surface Internal User Specified Location Temperature {[}C{]}}\label{surface-internal-user-specified-location-temperature-c} This output is the temperature within the surface at the location requested by the user. diff --git a/doc/input-output-reference/src/overview/group-unitary-equipment.tex b/doc/input-output-reference/src/overview/group-unitary-equipment.tex index 42ef71a45ff..5804bed40f7 100644 --- a/doc/input-output-reference/src/overview/group-unitary-equipment.tex +++ b/doc/input-output-reference/src/overview/group-unitary-equipment.tex @@ -2968,7 +2968,7 @@ \subsubsection{Inputs}\label{inputs-8-027} \paragraph{Field: Maximum Outlet Air Temperature During Heating Operation}\label{field-maximum-outlet-air-temperature-during-heating-operation} -This numeric field defines the maximum outlet air temperature leaving the system when the unit is operating to provide heating. Values are specified in degrees Celsius and must be greater than 0. The default value is 50°C. This value must be greater than or equal to the minimum outlet air temperature during cooing operation. +This numeric field defines the maximum outlet air temperature leaving the system when the unit is operating to provide heating. Values are specified in degrees Celsius and must be greater than 0. The default value is 50°C. This value must be greater than or equal to the minimum outlet air temperature during cooling operation. \paragraph{Field: Dehumidification Control Type}\label{field-dehumidification-control-type-5-000} diff --git a/doc/input-output-reference/src/overview/group-zone-forced-air-units.tex b/doc/input-output-reference/src/overview/group-zone-forced-air-units.tex index 43f2e9f2f5e..b10bf8baf47 100644 --- a/doc/input-output-reference/src/overview/group-zone-forced-air-units.tex +++ b/doc/input-output-reference/src/overview/group-zone-forced-air-units.tex @@ -1891,7 +1891,7 @@ \subsubsection{Inputs}\label{inputs-6-032} ZoneHVAC:OutdoorAirUnit:EquipmentList, Zone5OAUEquip1, !- Name Dehumidifier:Desiccant:NoFans, !- Component 1 Object Type - Z5Dessicant, !- Component 1 Name + Z5Desiccant, !- Component 1 Name HeatExchanger:AirToAir:FlatPlate, !- Component 2 Object Type Zone5A2AHeat Recovery, !- Component 2 Name CoilSystem:Cooling:DX, !- Component 3 Object Type diff --git a/doc/module-developer/src/energyplus-services/error-messages.tex b/doc/module-developer/src/energyplus-services/error-messages.tex index bf636074ac5..12d438b64d8 100644 --- a/doc/module-developer/src/energyplus-services/error-messages.tex +++ b/doc/module-developer/src/energyplus-services/error-messages.tex @@ -116,7 +116,7 @@ \subsection{ShowWarningError, ShowWarningMessage}\label{showwarningerror-showwar ~~ ** Warning ** Processing Monthly Tabular Reports: PEAK SPACE GAINS -The important difference between the two calls is that the ``Error'' call will incrase the ``number of warnings'' counter whereas the ``Message'' call does not incrase the counter.~ The ``Message'' call can, therefore, be used ro ``start'' off a recurring sequence without disturbing the total warning count.~ To do this, one would place the calls: +The important difference between the two calls is that the ``Error'' call will increase the ``number of warnings'' counter whereas the ``Message'' call does not increase the counter.~ The ``Message'' call can, therefore, be used to ``start'' off a recurring sequence without disturbing the total warning count.~ To do this, one would place the calls: CALL ShowWarningMessage(xxx) @@ -132,7 +132,7 @@ \subsection{ShowSevereError, ShowSevereMessage}\label{showsevereerror-showsevere ~~ ** Severe~ ** Node Connection Error, Node = ``SOFC AIR INLET NODE'', ZoneExhaust node did not find a matching inlet node. -The important difference between the two calls is that the ``Error'' call will incrase the ``number of severe errors'' counter whereas the ``Message'' call does not incrase the counter.~ The ``Message'' call can, therefore, be used ro ``start'' off a recurring sequence without disturbing the total warning count.~ To do this, one would place the calls: +The important difference between the two calls is that the ``Error'' call will increase the ``number of severe errors'' counter whereas the ``Message'' call does not increase the counter.~ The ``Message'' call can, therefore, be used to ``start'' off a recurring sequence without disturbing the total warning count.~ To do this, one would place the calls: CALL ShowSevereMessage(xxx) @@ -148,7 +148,7 @@ \subsection{ShowFatalError}\label{showfatalerror} ~~ **~ Fatal~ ** EMS user program halted simulation with error code = 9001.30 -For clarity, the sequence ending in the fatal error, should start with a Severe error and give the user a good indication of the problem.~ During execution, this Severe error may immediately preceed the Fata call. During get input, errors may be found previously in the input, interspersed with Warning errors.~ The last Severe error is stored and displayed as the program terminates. +For clarity, the sequence ending in the fatal error, should start with a Severe error and give the user a good indication of the problem.~ During execution, this Severe error may immediately precede the Fatal call. During get input, errors may be found previously in the input, interspersed with Warning errors.~ The last Severe error is stored and displayed as the program terminates. \subsection{ShowContinueError, ShowContinueErrorTimeStamp}\label{showcontinueerror-showcontinueerrortimestamp} @@ -196,7 +196,7 @@ \subsection{Recurring Error Handling}\label{recurring-error-handling} The first two parameters (Message, MsgIndex) are required.~ The remaining six arguments (ReportMaxOf, ReportMinOf, ReportSumOf, ReportMaxUnits, ReportMinUnits, ReportSumUnits) are optional. To illustrate, we re-write the above call using the recurring error routines.~ (Note that we still do the first few counted because we are using the TimeStamp routine -- however a message buffer is set up in this instance.). -!~~ Print warning messages only when valid and only for the first ocurrance. Let summary provide statistics. +!~~ Print warning messages only when valid and only for the first occurrence. Let summary provide statistics. !~~ Wait for next time step to print warnings. If simulation iterates, print out @@ -236,7 +236,7 @@ \subsection{Recurring Error Handling}\label{recurring-error-handling} Illustrations of use of these calls is seen in the Chiller modules, PurchasedAir modules, DXCoil modules and others. -Another example is seen in the Dessicant routines: +Another example is seen in the Desiccant routines: ~ IF (Node(DesicDehum(DesicDehumNum)\%RegenAirInNode)\%MassFlowRate .NE. \& diff --git a/doc/module-developer/src/energyplus-services/psychrometric-services.tex b/doc/module-developer/src/energyplus-services/psychrometric-services.tex index 983cf5e9ee8..32523d887ad 100644 --- a/doc/module-developer/src/energyplus-services/psychrometric-services.tex +++ b/doc/module-developer/src/energyplus-services/psychrometric-services.tex @@ -90,7 +90,7 @@ \subsection{PsyRhFnTdbRhov (Tdb,Rhov,calledfrom)}\label{psyrhfntdbrhov-tdbrhovca \subsection{PsyRhFnTdbWPb (Tdb,W,Pb,calledfrom)}\label{psyrhfntdbwpb-tdbwpbcalledfrom} -Returns the relative humifity (fraction) as a function of of dry bulb temperature {[}Tdb{]} (Celsius), humidity ratio {[}W{]} (kilograms of water per kilogram of dry air) and barometric pressure {[}Pb{]} (Pascals). +Returns the relative humidity (fraction) as a function of of dry bulb temperature {[}Tdb{]} (Celsius), humidity ratio {[}W{]} (kilograms of water per kilogram of dry air) and barometric pressure {[}Pb{]} (Pascals). \subsection{PsyTwbFnTdbWPb (Tdb,W,Pb,calledfrom)}\label{psytwbfntdbwpb-tdbwpbcalledfrom} diff --git a/doc/module-developer/src/hvac-network/interfacing-with-plant.tex b/doc/module-developer/src/hvac-network/interfacing-with-plant.tex index 1d6a8481c83..ad1594f25c0 100644 --- a/doc/module-developer/src/hvac-network/interfacing-with-plant.tex +++ b/doc/module-developer/src/hvac-network/interfacing-with-plant.tex @@ -1,6 +1,6 @@ \section{Interfacing with Plant}\label{interfacing-with-plant} -Beginning with Version 7.0, EnergyPlus's plant routines were reengineered and this section discusses protocols for how component models should interact with plant loop modeling.~ Component models that reject or obtain heat from a liquid fluid stream, such as hot or chilled water, condenser water, and steam (but not refrigeration), are ``plant components'' that will need to interface with the central plant solver routines.~ This section describes a number of utility routines and concepts for developers of plant component models. +Beginning with Version 7.0, EnergyPlus's plant routines were re-engineered and this section discusses protocols for how component models should interact with plant loop modeling.~ Component models that reject or obtain heat from a liquid fluid stream, such as hot or chilled water, condenser water, and steam (but not refrigeration), are ``plant components'' that will need to interface with the central plant solver routines.~ This section describes a number of utility routines and concepts for developers of plant component models. The node structure discussed above is reused for plant.~ Each component model related to plant has inlet and outlet nodes that describe how it is connected to the loop.~ Many of the routines pass in node indexes as arguments as well as other indexes into the main plant data structure. @@ -20,7 +20,7 @@ \subsection{Plant Loop Data Structure}\label{plant-loop-data-structure} Comp is the fourth level and will be sized to the total number of components on the branch. -There are four indices that indentify each component's location for each of the plant loops it is connected with: : loop number, loop side number, branch number, and component number.~ A water cooled chiller will be connected to two loops and so the component itself will appear twice in the data structure and one set of indices will identify its location on the chilled water loop while a second set of indices will locate it on the condenser loop.~~ +There are four indices that identify each component's location for each of the plant loops it is connected with: : loop number, loop side number, branch number, and component number.~ A water cooled chiller will be connected to two loops and so the component itself will appear twice in the data structure and one set of indices will identify its location on the chilled water loop while a second set of indices will locate it on the condenser loop.~~ \subsection{Initialization}\label{initialization} @@ -38,9 +38,9 @@ \subsection{Sizing}\label{sizing} \begin{itemize} \item - PlantFirstSizesOkayToFinalizePlantSizeNotComplete This public logical boolean flag is declared in DataPlant. It starts out FALSE TRUEfalse and is set to TRUE FALSEtrue only after all some intial plant sizing actions iterations have been completed and the first set of sizes can be finalized. Component models should delay first filling autosized values until this flag is true. The -9999 values that indicate an autosized variable are not filled until this is TRUE. + PlantFirstSizesOkayToFinalizePlantSizeNotComplete This public logical boolean flag is declared in DataPlant. It starts out FALSE TRUEfalse and is set to TRUE FALSEtrue only after all some initial plant sizing actions iterations have been completed and the first set of sizes can be finalized. Component models should delay first filling autosized values until this flag is true. The -9999 values that indicate an autosized variable are not filled until this is TRUE. \item - PlantFirstSizesOkayToReportPlantSizesOkayToFinalize This public logical boolean flag is declared in DataPlant. It starts out false FALSE and is set to TRUE true after the main iterative phase of sizing is completed but before the final finishing passes are made. This flag is only used for advanced sizing methods based on HVAC Sizing Simulations, where the program should report both the ``Initial'' sizes and the final sizes. Component models should delay final reporting first sizes and filling of autosized values until this is set to TRUEtrue. The -9999 values that indicate an autosized variable are not filled until this is TRUE. The first, or intial, cCalls to report the outcome of sizing are not made until this is TRUEtrue. + PlantFirstSizesOkayToReportPlantSizesOkayToFinalize This public logical boolean flag is declared in DataPlant. It starts out false FALSE and is set to TRUE true after the main iterative phase of sizing is completed but before the final finishing passes are made. This flag is only used for advanced sizing methods based on HVAC Sizing Simulations, where the program should report both the ``Initial'' sizes and the final sizes. Component models should delay final reporting first sizes and filling of autosized values until this is set to TRUEtrue. The -9999 values that indicate an autosized variable are not filled until this is TRUE. The first, or initial, cCalls to report the outcome of sizing are not made until this is TRUEtrue. \item PlantFinalSizesOkayToReport This public boolean flag is declared in DataPlant. It starts out false and is set to true when all the sizing is done and it is okay to report the final size values. Component models should delay reporting final sizes until this is set to true. \item @@ -67,7 +67,7 @@ \subsection{Sizing}\label{sizing} 6.~~~~Sizing finished and PlantSizeNotCompleteset FALSE -In earlier versions, component sizing routines were only called once and one had to take care not call them repeatedly (or else their flow request would get doubled each time). However, now plant component models should be designed for multiple executions of their component-level sizing routine. This allows for an iterative approach to plant sizing that is used to solve complex problems raised by inter-connected loops and the interdependence of sizing information. As of version 8.3, the addition of HVAC Sizing Simulation method makes it very explicit that not only do sizing routines need to be able to rerun, the autosized values need to be set to useable values and then changed. It is therefore now necessary to store whether or not the original input was set to autosize and so autosizable input now needs to add a boolean ``*WasAutoSized'' version of the variable to keep track of the user input. +In earlier versions, component sizing routines were only called once and one had to take care not call them repeatedly (or else their flow request would get doubled each time). However, now plant component models should be designed for multiple executions of their component-level sizing routine. This allows for an iterative approach to plant sizing that is used to solve complex problems raised by inter-connected loops and the interdependence of sizing information. As of version 8.3, the addition of HVAC Sizing Simulation method makes it very explicit that not only do sizing routines need to be able to rerun, the autosized values need to be set to usable values and then changed. It is therefore now necessary to store whether or not the original input was set to autosize and so autosizable input now needs to add a boolean ``*WasAutoSized'' version of the variable to keep track of the user input. After the component model has determined a design value for the flow rate, this flow rate needs to be registered with the larger plant routines by calling RegisterPlantCompDesignFlow.~This is a volume flow rate in m\(^{3}\)/s.~ The flow rate is associated with the inlet node.~ This call can be repeated and the design flow will be updated with the latest request. @@ -113,7 +113,7 @@ \subsection{Central Routine Modifications}\label{central-routine-modifications} d.~~~Array ValidLoopEquipTypes.~ Add array element with classification for what type of loop this component is intended for, primarily with respect to the type of loop it is intended to meet loads. -e.~~~~Parameter TypeOf\_xxxx .~ Add an integer parameter to identify ``TypeOf'' number for subsequent use to identify component type without having to do string comparisions. +e.~~~~Parameter TypeOf\_xxxx .~ Add an integer parameter to identify ``TypeOf'' number for subsequent use to identify component type without having to do string comparisons. 2.~~~~PlantManager.f90 diff --git a/doc/readthedocs/sphinx/tips_and_tricks/tips_and_tricks.rst b/doc/readthedocs/sphinx/tips_and_tricks/tips_and_tricks.rst index 76b1ceb5047..275132fb09d 100644 --- a/doc/readthedocs/sphinx/tips_and_tricks/tips_and_tricks.rst +++ b/doc/readthedocs/sphinx/tips_and_tricks/tips_and_tricks.rst @@ -43,7 +43,7 @@ https://energyplushelp.freshdesk.com/ The site is monitored by EnergyPlus developers and questions are attempted to be answered in a timely manner. Standard EnergyPlus support -is provided free of charge by the U.S. Deparment of Energy, as part of a +is provided free of charge by the U.S. Department of Energy, as part of a continuing effort to improve the EnergyPlus building simulation tool. Expedited, priority support may be available from other sources. The helpdesk has a files area where important (after release) files may be @@ -133,7 +133,7 @@ Datasets aka Libraries ---------------------- EnergyPlus uses the term DataSets for what many would call libraries. -These files are included, for the most part, in the instalation package +These files are included, for the most part, in the installation package but may be available from other sites (such as the helpdesk or Yahoo Groups). @@ -141,7 +141,7 @@ There are two flavors of DataSets: **simple** and **Macro**. Some sets have files in both camps (for example, Solar Collectors). Both flavors contain IDF objects ready to be put into EnergyPlus input files. With the simple datasets, you may need to use a text editor or the IDF Editor -to search the file for the one you want to use. With the macro datsets +to search the file for the one you want to use. With the macro datasets and a simply structured imf (input macro file), you can name the item you want to include. (The macro program is described in the `Auxiliary Programs document `__). @@ -291,7 +291,7 @@ You can’t measure extraterrestrial unless you’re in outer space, but then it’s assumed to be constant anyway. For the various radiation and illuminance values, they can measured by various instrumentation ranging from the very cheap to the very expensive. Properly, radiation needs to -be measured with a pyranometer (Eppley), which is pricy, but I’m also +be measured with a pyranometer (Eppley), which is pricey, but I’m also seen people use simpler apparatus (Lycors) that are really photometers. Direct beam is generally not measured, but derived by subtracting the diffuse from the global. Diffuse is measured by adding a shadow band @@ -1024,7 +1024,7 @@ each other: and diffuse solar (and daylighting) to pass between the adjacent zones. -* Radiant (long-wave thermal) transfer can be signifcant between exterior surfaces of a perimeter zone and +* Radiant (long-wave thermal) transfer can be significant between exterior surfaces of a perimeter zone and interior surfaces of a core zone with an open boundary between them. Normally, there is no direct radiant exchange between surfaces in different thermal zones. Construction:AirBoundary groups adjacent @@ -1133,7 +1133,7 @@ The Trombe wall convection algorithm is applicable to just about any vertical cavity with a high aspect ratio and relatively narrow width. I’m not sure if a double facade cavity would meet the aspect ratio requirement. But I do know the Trombe wall algorithm is not picky about -whether the inner wall is highly absorbant, or about any particular +whether the inner wall is highly absorbent, or about any particular properties of the walls. Actually the same basic algorithm is used by the window model to calculate the convection between the two panes of a window. The full reference is ISO 15099. @@ -1254,7 +1254,7 @@ that are used during EnergyPlus development testing (i.e.small differences are within .001 or .5%; big differences are greater than those limits). -For the purposes of dicussion, the buildings will be called: +For the purposes of discussion, the buildings will be called: * Multistory 1 – the original 9 zone building (with multipliers and groups) ref: Figure `fig:original-multistory-idf`_; * Multistory 2 – the building shown in Figure `fig:multistory-with-cloned-middle-zones`_. @@ -1317,7 +1317,7 @@ With these included, the files were rerun with the following results: .. table:: Multiplier Results with negated height variation. +---------------+---------------------+---------------------+---------------------+---------------------+ - | Location | Multi-story 2 Loahs | Multi-story 2 Meter | Multi-story 3 Loahs | Multi-story 3 Meter | + | Location | Multi-story 2 Loads | Multi-story 2 Meter | Multi-story 3 Loads | Multi-story 3 Meter | +===============+=====================+=====================+=====================+=====================+ | Chicago | Small diffs | Small diffs | Small diffs | Small diffs | +---------------+---------------------+---------------------+---------------------+---------------------+ @@ -1796,7 +1796,7 @@ A coil will check its inlet air temperature compared to the set point temperature. For cooling, if the inlet air temperature is above the set point temp, the coil turns on. It’s opposite that for heating. In the 5ZoneAutoDXVAV example file, a schedule temperature set point is placed -at the system outlet node. This is the temperture the designer wants at +at the system outlet node. This is the temperature the designer wants at the outlet. The mixed air SP manager is used to account for fan heat and places the required SP at the outlet of the cooling coil so the coil slightly overcools the air to overcome fan heat and meet the system @@ -1828,7 +1828,7 @@ SetpointManager objects place a setpoint on a node, for example, one might place a setpoint of 12C on the node named “Main Cooling Coil Air Outlet Node”. -In the case of Controler:WaterCoil which controls a hot water or chilled +In the case of Controller:WaterCoil which controls a hot water or chilled water coil, the controller reads the setpoint and tries to adjust the water flow so that the air temperature at the controlled node matches the current setpoint. Continuing the example above: @@ -2500,7 +2500,7 @@ Low Temperature Radiant Undersizing Issues ------------------------------------------ Some users have noted difficulties when trying to size certain aspects -of low temperature radiant systems, particulary in cooling mode for the +of low temperature radiant systems, particularly in cooling mode for the hydronic (variable flow) and constant flow low temperature radiant systems when using autosize. The problem appears to be that the system is not sizing properly or is undersizing, leaving zone conditions that @@ -3799,7 +3799,7 @@ buildings with large numbers of surfaces and shading surfaces): .. table:: Recommended Reduce Time Settings for Early Diagnostic runs ======================= ================================================================================ - Object Recommenheh Early Diagnostic Setting + Object Recommended Early Diagnostic Setting Building MinimalShadowing (Solar Distribution field) ShadowCalculation 200 (Maximum Figures in Shadow Overlap Calculations field) SizingPeriod:DesignDays Only perform design day or limited run period runs until you have the model set. diff --git a/doc/tools/create_changelog.py b/doc/tools/create_changelog.py index 088d1c15015..0363d9dd901 100755 --- a/doc/tools/create_changelog.py +++ b/doc/tools/create_changelog.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/doc/tools/example_file_objects.py b/doc/tools/example_file_objects.py index f4beefd13dc..c4d614717eb 100755 --- a/doc/tools/example_file_objects.py +++ b/doc/tools/example_file_objects.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/doc/tools/example_file_summary.py b/doc/tools/example_file_summary.py index b60f86dfc76..fe32cd9e12a 100755 --- a/doc/tools/example_file_summary.py +++ b/doc/tools/example_file_summary.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/doc/tools/idd_parser_library.py b/doc/tools/idd_parser_library.py index f9ee448355b..ba340021da2 100644 --- a/doc/tools/idd_parser_library.py +++ b/doc/tools/idd_parser_library.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/doc/tools/idf_parser_library.py b/doc/tools/idf_parser_library.py index c74d4131a00..b51d69a98a5 100644 --- a/doc/tools/idf_parser_library.py +++ b/doc/tools/idf_parser_library.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/doc/tools/idf_summary_class.py b/doc/tools/idf_summary_class.py index dc650003ce8..10481e15964 100644 --- a/doc/tools/idf_summary_class.py +++ b/doc/tools/idf_summary_class.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/doc/tools/parse_ems_actuators.py b/doc/tools/parse_ems_actuators.py index 1405874c093..ebcfd991f02 100644 --- a/doc/tools/parse_ems_actuators.py +++ b/doc/tools/parse_ems_actuators.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/doc/tools/parse_latex_log.py b/doc/tools/parse_latex_log.py index 4c41ecce83f..a9af8af08ea 100644 --- a/doc/tools/parse_latex_log.py +++ b/doc/tools/parse_latex_log.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/doc/tools/parse_output_variables.py b/doc/tools/parse_output_variables.py index ac6feabb6ba..29707788a35 100755 --- a/doc/tools/parse_output_variables.py +++ b/doc/tools/parse_output_variables.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/idd/CMakeLists.txt b/idd/CMakeLists.txt index aa17229ab9c..fd20f9133db 100644 --- a/idd/CMakeLists.txt +++ b/idd/CMakeLists.txt @@ -68,19 +68,6 @@ set(PREVIOUS_IDD ${PREVIOUS_IDD} PARENT_SCOPE) install(FILES "${PREVIOUS_IDD}" DESTINATION "PreProcess/IDFVersionUpdater") if (BUILD_TESTING) - execute_process(COMMAND ${Python_EXECUTABLE} -m pytest --version - RESULT_VARIABLE _Pytest_STATUS - OUTPUT_VARIABLE Pytest_Version - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - if(_Pytest_STATUS AND NOT _Pytest_STATUS EQUAL 0) - message(AUTHOR_WARNING "Pytest isn't installed on your system python, so some tests won't be run. Run `${Python_EXECUTABLE} -m pip install pytest`") - set(Pytest_AVAILABLE OFF) - else() - message(VERBOSE "Found Pytest: ${Pytest_Version}") - set(Pytest_AVAILABLE ON) - endif() if (Pytest_AVAILABLE) add_test(NAME idd_schema.test_idd_parser diff --git a/idd/Energy+.idd.in b/idd/Energy+.idd.in index fa0cf2f26d9..38ae62ec980 100644 --- a/idd/Energy+.idd.in +++ b/idd/Energy+.idd.in @@ -22827,7 +22827,7 @@ IndoorLivingWall, \object-list ScheduleNames \note units in Schedule should be fraction applied to design level of other equipment, generally (0.0 - 1.0) A4 , \field Evapotranspiration Calculation Method - \note Model selection for caclulating evapotranspiration of indoor greenery system. + \note Model selection for calculating evapotranspiration of indoor greenery system. \note This rate can also be actuated with user-defined calculations, see EMS application guide for actuator details. \type choice \key Penman-Monteith @@ -22844,8 +22844,8 @@ IndoorLivingWall, \object-list ScheduleNames A7 , \field Daylighting Control Name \note If daylighting is used in the selected lighting methods (Daylight or LED-Daylight), - \note users should define an object of Daylighting:Control to obtain the daylighting illumance level - \note and an object for Daylighing:ReferencePoint for the daylighting sensor location in the thermal zone. + \note users should define an object of Daylighting:Control to obtain the daylighting illuminance level + \note and an object for Daylighting:ReferencePoint for the daylighting sensor location in the thermal zone. \note The name of the object of Daylighting:Controls should be specified in this field. \type alpha A8 , \field LED-Daylight Targeted Lighting Intensity Schedule Name @@ -26706,6 +26706,8 @@ AirflowNetwork:Distribution:Component:Coil, \key Coil:Cooling:DX:TwoStageWithHumidityControlMode \key Coil:Cooling:DX:MultiSpeed \key Coil:Heating:DX:MultiSpeed + \key Coil:Cooling:DX:VariableSpeed + \key Coil:Heating:DX:VariableSpeed \key Coil:Heating:Desuperheater \key Coil:Heating:Electric:MultiStage \key Coil:Heating:Gas:MultiStage @@ -35693,7 +35695,7 @@ ZoneHVAC:IdealLoadsAirSystem, \memo the ideal loads system component. This component can be thought of as an ideal unit \memo that mixes zone air with the specified amount of outdoor air and then adds or removes \memo heat and moisture at 100% efficiency in order to meet the specified controls. Energy - \memo use is reported as DistrictHeating and DistrictCooling. + \memo use is reported as DistrictHeatingWater and DistrictCooling. \min-fields 27 A1 , \field Name \required-field @@ -63068,7 +63070,7 @@ HeatExchanger:AirToAir:SensibleAndLatent, \note when the economizer is operating or high humidity control is active A11,\field Sensible Effectiveness of Heating Air Flow Curve Name \note optional - \note if this field has value, then the sensivle effectiveness for heating + \note if this field has value, then the sensible effectiveness for heating \note will be the value in N2 multiplied by this curve value \type object-list \object-list UnivariateFunctions @@ -63080,7 +63082,7 @@ HeatExchanger:AirToAir:SensibleAndLatent, \object-list UnivariateFunctions A13,\field Sensible Effectiveness of Cooling Air Flow Curve Name \note optional - \note if this field has value, then the sensivle effectiveness for cooling + \note if this field has value, then the sensible effectiveness for cooling \note will be the value in N4 multiplied by this curve value \type object-list \object-list UnivariateFunctions @@ -73651,6 +73653,7 @@ Chiller:Electric:EIR, \note Name" input. \note Use "ConstantFlow" when modeling a constant flow condenser plant loop, choose one of the other inputs \note when modeling a variable flow condenser plant loop. + \type choice \key ConstantFlow \key ModulatedChillerPLR \key ModulatedLoopPLR @@ -73676,6 +73679,9 @@ Chiller:Electric:EIR, \note corresponds to this fraction multiplied by the maximum condenser flow rate. This input is only used \note when the "Condenser Flow Control" input is set to "ModulatedChillerPLR", "ModulatedLoopPLR" or \note "ModulatedDeltaTemperature". + \minimum 0.0 + \maximum 1 + \default 0.2 A20, \field Thermosiphon Capacity Fraction Curve Name \type object-list \object-list UniVariateFunctions @@ -73688,7 +73694,7 @@ Chiller:Electric:EIR, \minimum 0.0 \default 0.0 \note Thermosiphon model is disabled below this minimum limit and - \note when the load is greater than calculated using the prevoius field. + \note when the load is greater than calculated using the previous field. Chiller:Electric:ReformulatedEIR, \min-fields 22 @@ -73899,6 +73905,7 @@ Chiller:Electric:ReformulatedEIR, \note Name" input. \note Use "ConstantFlow" when modeling a constant flow condenser plant loop, choose one of the other inputs \note when modeling a variable flow condenser plant loop. + \type choice \key ConstantFlow \key ModulatedChillerPLR \key ModulatedLoopPLR @@ -73924,6 +73931,9 @@ Chiller:Electric:ReformulatedEIR, \note corresponds to this fraction multiplied by the maximum condenser flow rate. This input is only used \note when the "Condenser Flow Control" input is set to "ModulatedChillerPLR", "ModulatedLoopPLR" or \note "ModulatedDeltaTemperature". + \minimum 0.0 + \maximum 1 + \default 0.2 A19, \field Thermosiphon Capacity Fraction Curve Name \type object-list \object-list UniVariateFunctions @@ -73936,7 +73946,7 @@ Chiller:Electric:ReformulatedEIR, \minimum 0.0 \default 0.0 \note Thermosiphon model is disabled below this minimum limit and - \note when the load is greater than calculated using the prevoius field. + \note when the load is greater than calculated using the previous field. Chiller:Electric, \min-fields 27 @@ -74097,7 +74107,7 @@ Chiller:Electric, \minimum 0.0 \default 0.0 \note Thermosiphon model is disabled below this minimum limit and - \note when the load is greater than calculated using the prevoius field. + \note when the load is greater than calculated using the previous field. Chiller:Absorption:Indirect, \min-fields 17 @@ -74487,7 +74497,7 @@ Chiller:ConstantCOP, \minimum 0.0 \default 0.0 \note Thermosiphon model is disabled below this minimum limit and - \note when the load is greater than calculated using the prevoius field. + \note when the load is greater than calculated using the previous field. Chiller:EngineDriven, \min-fields 43 @@ -75454,7 +75464,7 @@ HeatPump:PlantLoop:EIR:Cooling, \minimum 0.0 \default 0.0 \note Thermosiphon model is disabled below this minimum limit and - \note when the load is greater than calculated using the prevoius field. + \note when the load is greater than calculated using the previous field. HeatPump:PlantLoop:EIR:Heating, diff --git a/idd/schema/generate_epJSON_schema.py b/idd/schema/generate_epJSON_schema.py index f522ebc8952..04a8b61caff 100644 --- a/idd/schema/generate_epJSON_schema.py +++ b/idd/schema/generate_epJSON_schema.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/idd/schema/idd_parser.py b/idd/schema/idd_parser.py index 893218e3a78..f1d22839d8f 100644 --- a/idd/schema/idd_parser.py +++ b/idd/schema/idd_parser.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/idd/schema/modify_schema.py b/idd/schema/modify_schema.py index 04b59c37f6e..d25c245df30 100644 --- a/idd/schema/modify_schema.py +++ b/idd/schema/modify_schema.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/idd/schema/test_idd_parser.py b/idd/schema/test_idd_parser.py index 5a330f35786..3dfb4abc43c 100644 --- a/idd/schema/test_idd_parser.py +++ b/idd/schema/test_idd_parser.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/requirements.txt b/requirements.txt index 3d8b2a018cb..41fdd2a5d08 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,4 @@ wheel # requirements for the CI regression testing scripts -energyplus-regressions +energyplus-regressions>=2.1.1 diff --git a/scripts/dev/analyze_state.py b/scripts/dev/analyze_state.py index f77390509be..24ce98953c1 100755 --- a/scripts/dev/analyze_state.py +++ b/scripts/dev/analyze_state.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/dev/api_debug_helper.py b/scripts/dev/api_debug_helper.py index 26380c5537d..786d13d36fe 100644 --- a/scripts/dev/api_debug_helper.py +++ b/scripts/dev/api_debug_helper.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/dev/build_regression_summary.py b/scripts/dev/build_regression_summary.py index 2228284517a..885d720e017 100644 --- a/scripts/dev/build_regression_summary.py +++ b/scripts/dev/build_regression_summary.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/dev/change_version.py b/scripts/dev/change_version.py index 2a15746993a..39b2f1865f5 100755 --- a/scripts/dev/change_version.py +++ b/scripts/dev/change_version.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/dev/check_constexpr.py b/scripts/dev/check_constexpr.py index 2557e6daca7..118ad332505 100644 --- a/scripts/dev/check_constexpr.py +++ b/scripts/dev/check_constexpr.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/dev/check_for_bom_in_idfs.py b/scripts/dev/check_for_bom_in_idfs.py index e29ec7311dd..a6a773613eb 100755 --- a/scripts/dev/check_for_bom_in_idfs.py +++ b/scripts/dev/check_for_bom_in_idfs.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/dev/check_for_c_style_comments.py b/scripts/dev/check_for_c_style_comments.py index 57c9a794ae2..b4ececb93b8 100644 --- a/scripts/dev/check_for_c_style_comments.py +++ b/scripts/dev/check_for_c_style_comments.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/dev/check_for_enum_scope_usage.py b/scripts/dev/check_for_enum_scope_usage.py index 73653bbc3e5..7e02eece983 100755 --- a/scripts/dev/check_for_enum_scope_usage.py +++ b/scripts/dev/check_for_enum_scope_usage.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/dev/check_for_malformed_enums.py b/scripts/dev/check_for_malformed_enums.py index f87f9e1ef9f..4bb9fbe6f44 100644 --- a/scripts/dev/check_for_malformed_enums.py +++ b/scripts/dev/check_for_malformed_enums.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/dev/check_for_switch_case_parentheses.py b/scripts/dev/check_for_switch_case_parentheses.py index 3b7b9b5338c..00b204c8610 100644 --- a/scripts/dev/check_for_switch_case_parentheses.py +++ b/scripts/dev/check_for_switch_case_parentheses.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/dev/check_for_tabs.py b/scripts/dev/check_for_tabs.py index d4df5a39475..d66ae92b39b 100755 --- a/scripts/dev/check_for_tabs.py +++ b/scripts/dev/check_for_tabs.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/dev/check_format_strings.py b/scripts/dev/check_format_strings.py index 03de2f98594..a0d01301e27 100644 --- a/scripts/dev/check_format_strings.py +++ b/scripts/dev/check_format_strings.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/dev/check_non_utf8.py b/scripts/dev/check_non_utf8.py index 55b3e6d646e..19896b30d74 100755 --- a/scripts/dev/check_non_utf8.py +++ b/scripts/dev/check_non_utf8.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/dev/check_stray_fields_in_idd.py b/scripts/dev/check_stray_fields_in_idd.py index fda6051d030..b066739dde3 100755 --- a/scripts/dev/check_stray_fields_in_idd.py +++ b/scripts/dev/check_stray_fields_in_idd.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/dev/clear_coverage_results.py b/scripts/dev/clear_coverage_results.py index 1a0e9354dbe..aeee16eeebe 100644 --- a/scripts/dev/clear_coverage_results.py +++ b/scripts/dev/clear_coverage_results.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/dev/compare_output_reports.py b/scripts/dev/compare_output_reports.py index da384d0cc43..dd6b8ec7284 100644 --- a/scripts/dev/compare_output_reports.py +++ b/scripts/dev/compare_output_reports.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/dev/find_byref_bool_override.py b/scripts/dev/find_byref_bool_override.py index e67bafbf497..6616af4fee6 100755 --- a/scripts/dev/find_byref_bool_override.py +++ b/scripts/dev/find_byref_bool_override.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- @@ -271,7 +271,7 @@ }, "HeatBalanceIntRadExchange.cc": { "UpdateMovableInsulationFlag": [ - "MovableInsulationChange" + "change" ] }, "HeatBalanceManager.cc": { diff --git a/scripts/dev/find_included_cc_files.py b/scripts/dev/find_included_cc_files.py index 4b832553121..c76b573de05 100755 --- a/scripts/dev/find_included_cc_files.py +++ b/scripts/dev/find_included_cc_files.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/dev/gha_coverage_summary.py b/scripts/dev/gha_coverage_summary.py index 34bb39dcc3c..6453d314dff 100644 --- a/scripts/dev/gha_coverage_summary.py +++ b/scripts/dev/gha_coverage_summary.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/dev/gha_regressions.py b/scripts/dev/gha_regressions.py index 46c8db4c34d..cf62bb9ec0c 100644 --- a/scripts/dev/gha_regressions.py +++ b/scripts/dev/gha_regressions.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- @@ -60,8 +60,10 @@ from pathlib import Path import sys from shutil import rmtree +from traceback import print_exc from zoneinfo import ZoneInfo +from energyplus_regressions.builds.base import BuildTree from energyplus_regressions.runtests import SuiteRunner from energyplus_regressions.structures import TextDifferences, TestEntry, EndErrSummary @@ -87,13 +89,12 @@ def single_file_regressions(self, baseline: Path, modified: Path) -> [TestEntry, this_file_diffs = [] entry = TestEntry(idf, "") + b1 = BuildTree() + b1.build_dir = baseline + b2 = BuildTree() + b2.build_dir = modified entry, message = SuiteRunner.process_diffs_for_one_case( - entry, - {'build_dir': str(baseline)}, - {'build_dir': str(modified)}, - "", - self.threshold_file, - ci_mode=True + entry, b1, b2,"", self.threshold_file, ci_mode=True ) # returns an updated entry self.summary_results[idf] = entry.summary_result @@ -462,6 +463,7 @@ def check_all_regressions(self, base_testfiles: Path, mod_testfiles: Path, bundl any_diffs = False bundle_root.mkdir(exist_ok=True) entries = sorted(base_testfiles.iterdir()) + backtrace_shown = False for entry_num, baseline in enumerate(entries): if not baseline.is_dir(): continue @@ -505,6 +507,10 @@ def check_all_regressions(self, base_testfiles: Path, mod_testfiles: Path, bundl except Exception as e: any_diffs = True print(f"Regression run *failed* trying to process file: {baseline.name}; reason: {e}") + if not backtrace_shown: + print("Traceback shown once:") + print_exc() + backtrace_shown = True self.root_index_files_failed.append(baseline.name) meta_data = [ f"Regression time stamp in UTC: {datetime.now(UTC)}", diff --git a/scripts/dev/license-check.py b/scripts/dev/license-check.py index a4d0357d439..aec4d6a41f3 100755 --- a/scripts/dev/license-check.py +++ b/scripts/dev/license-check.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/dev/license-update.py b/scripts/dev/license-update.py index 7128e183487..a056ab73ac9 100755 --- a/scripts/dev/license-update.py +++ b/scripts/dev/license-update.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- @@ -137,16 +137,19 @@ # Create LICENSE.txt licensetxt = licensetext.merge_paragraphs(current) +full_count = 0 + if not dryrun: print('Writing out LICENSE.txt') filename = "LICENSE.txt" fp = open(filename, 'w') fp.write(licensetxt) fp.close() + full_count += 1 else: print('Skipping writing out LICENSE.txt') -full_count = 1 + # Create C++ Replacer object replacer = licensetext.Replacer(previous, current, dryrun=dryrun) diff --git a/scripts/dev/licensetext.py b/scripts/dev/licensetext.py index e658a5010b2..6694854e2b3 100644 --- a/scripts/dev/licensetext.py +++ b/scripts/dev/licensetext.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- @@ -63,7 +63,7 @@ # # The previous year that is in the license. It should be a string # -_previous_year = '2023' +_previous_year = '2024' # # From file "EnergyPlus License DRAFT 112015 100 fixed.txt" # diff --git a/scripts/dev/update_gha_actions.py b/scripts/dev/update_gha_actions.py index 9f1162dc2a5..a4a464b2ba6 100644 --- a/scripts/dev/update_gha_actions.py +++ b/scripts/dev/update_gha_actions.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/dev/update_nist_escalation.py b/scripts/dev/update_nist_escalation.py index c5b51c54354..649389ecd74 100644 --- a/scripts/dev/update_nist_escalation.py +++ b/scripts/dev/update_nist_escalation.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- @@ -68,7 +68,7 @@ from pathlib import Path from typing import List, Optional, Tuple -ROOT_DIR = Path(__file__).resolve().parent.parent.parent +ROOT_DIR = Path(__file__).resolve().parent DATASETS_DIR = ROOT_DIR / "datasets" NUMBER_YEARS = 31 @@ -137,12 +137,12 @@ def parse_encost(fpath: Path) -> Tuple[List[dict], int]: continue if region is None: - region = line + region = line.expandtabs(1) # print(f"{region=}") continue if years is None: - years = [int(x) for x in line.split(" ")] + years = [int(x) for x in line.split()] if len(years) != NUMBER_YEARS: print( f"Warning: expected {NUMBER_YEARS} years, " @@ -166,7 +166,7 @@ def parse_encost(fpath: Path) -> Tuple[List[dict], int]: continue if prices is None: - prices = [float(x) for x in line.split(" ")] + prices = [float(x) for x in line.split()] if len(prices) != NUMBER_YEARS: print( f"Warning: expected {NUMBER_YEARS} years, " @@ -287,7 +287,7 @@ def produce_idf(results: List[dict], escalation_start_year: int): if __name__ == "__main__": - encosts = list(DATASETS_DIR.glob("encost*")) + encosts = list(DATASETS_DIR.glob("encost*.txt")) for fpath in encosts: results, escalation_start_year = parse_encost(fpath=fpath) # plot_escalations(results, diff --git a/scripts/dev/validate_idd_units.py b/scripts/dev/validate_idd_units.py index 8c54aa8e125..f0cf7e5a9ae 100755 --- a/scripts/dev/validate_idd_units.py +++ b/scripts/dev/validate_idd_units.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/dev/verify_cmake_dirs.py b/scripts/dev/verify_cmake_dirs.py index 953b43e6436..3991a835a53 100755 --- a/scripts/dev/verify_cmake_dirs.py +++ b/scripts/dev/verify_cmake_dirs.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/dev/verify_file_encodings.py b/scripts/dev/verify_file_encodings.py index 5d792353d3b..767059569b5 100755 --- a/scripts/dev/verify_file_encodings.py +++ b/scripts/dev/verify_file_encodings.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/dev/verify_idfs_in_cmake.py b/scripts/dev/verify_idfs_in_cmake.py index 2adaa1b45ce..c2c36ab5286 100755 --- a/scripts/dev/verify_idfs_in_cmake.py +++ b/scripts/dev/verify_idfs_in_cmake.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/dev/verify_signature.py b/scripts/dev/verify_signature.py index c264ba028ce..830d5677ef3 100644 --- a/scripts/dev/verify_signature.py +++ b/scripts/dev/verify_signature.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/diagnostics/afn_auditor.py b/scripts/diagnostics/afn_auditor.py index b81dd0b0b0e..7f53a999768 100644 --- a/scripts/diagnostics/afn_auditor.py +++ b/scripts/diagnostics/afn_auditor.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/diagnostics/auditor.py b/scripts/diagnostics/auditor.py index 6df7cee13cd..acc7be9e3f2 100644 --- a/scripts/diagnostics/auditor.py +++ b/scripts/diagnostics/auditor.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/package_tests/ep_testing/tests/api.py b/scripts/package_tests/ep_testing/tests/api.py index 1d20e0a93f3..11de95e8673 100644 --- a/scripts/package_tests/ep_testing/tests/api.py +++ b/scripts/package_tests/ep_testing/tests/api.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/package_tests/ep_testing/tests/api_templates/python_link.py b/scripts/package_tests/ep_testing/tests/api_templates/python_link.py index f1e72f57e2e..d58c46686c7 100644 --- a/scripts/package_tests/ep_testing/tests/api_templates/python_link.py +++ b/scripts/package_tests/ep_testing/tests/api_templates/python_link.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/package_tests/ep_testing/tests/base.py b/scripts/package_tests/ep_testing/tests/base.py index 849d72b0d98..6f6d676420e 100644 --- a/scripts/package_tests/ep_testing/tests/base.py +++ b/scripts/package_tests/ep_testing/tests/base.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/package_tests/ep_testing/tests/documentation.py b/scripts/package_tests/ep_testing/tests/documentation.py index ed66928400d..08209988560 100644 --- a/scripts/package_tests/ep_testing/tests/documentation.py +++ b/scripts/package_tests/ep_testing/tests/documentation.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/package_tests/ep_testing/tests/energyplus.py b/scripts/package_tests/ep_testing/tests/energyplus.py index e0e40a8fdf9..6c41865a855 100644 --- a/scripts/package_tests/ep_testing/tests/energyplus.py +++ b/scripts/package_tests/ep_testing/tests/energyplus.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/package_tests/ep_testing/tests/expand_objects.py b/scripts/package_tests/ep_testing/tests/expand_objects.py index 8266a183600..a8e757db4b5 100644 --- a/scripts/package_tests/ep_testing/tests/expand_objects.py +++ b/scripts/package_tests/ep_testing/tests/expand_objects.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/package_tests/ep_testing/tests/hvacdiagram.py b/scripts/package_tests/ep_testing/tests/hvacdiagram.py index b0fee9e6106..c6cd8959c7d 100644 --- a/scripts/package_tests/ep_testing/tests/hvacdiagram.py +++ b/scripts/package_tests/ep_testing/tests/hvacdiagram.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/package_tests/ep_testing/tests/transition.py b/scripts/package_tests/ep_testing/tests/transition.py index 8304e063133..4ea55376cda 100644 --- a/scripts/package_tests/ep_testing/tests/transition.py +++ b/scripts/package_tests/ep_testing/tests/transition.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/package_tests/runner.py b/scripts/package_tests/runner.py index fcbd5573599..b769513937b 100644 --- a/scripts/package_tests/runner.py +++ b/scripts/package_tests/runner.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/scripts/pytests/conftest.py b/scripts/pytests/conftest.py new file mode 100644 index 00000000000..08dd955a048 --- /dev/null +++ b/scripts/pytests/conftest.py @@ -0,0 +1,87 @@ +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University +# of Illinois, The Regents of the University of California, through Lawrence +# Berkeley National Laboratory (subject to receipt of any required approvals +# from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- +# Battelle, Alliance for Sustainable Energy, LLC, and other contributors. All +# rights reserved. +# +# NOTICE: This Software was developed under funding from the U.S. Department of +# Energy and the U.S. Government consequently retains certain rights. As such, +# the U.S. Government has been granted for itself and others acting on its +# behalf a paid-up, nonexclusive, irrevocable, worldwide license in the +# Software to reproduce, distribute copies to the public, prepare derivative +# works, and perform publicly and display publicly, and to permit others to do +# so. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# (1) Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# (2) Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# (3) Neither the name of the University of California, Lawrence Berkeley +# National Laboratory, the University of Illinois, U.S. Dept. of Energy nor +# the names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in +# stand-alone form without changes from the version obtained under this +# License, or (ii) Licensee makes a reference solely to the software +# portion of its product, Licensee must refer to the software as +# "EnergyPlus version X" software, where "X" is the version number Licensee +# obtained under this License and may not use a different name for the +# software. Except as specifically required in this Section (4), Licensee +# shall not use in a company name, a product name, in advertising, +# publicity, or other promotional activities any name, trade name, +# trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or +# confusingly similar designation, without the U.S. Department of Energy's +# prior written consent. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +from pathlib import Path + +import pytest + + +def validate_file(arg): + if (filepath := Path(arg).expanduser()).is_file(): + return filepath + else: + raise FileNotFoundError(arg) + + +def pytest_addoption(parser): + parser.addoption("--ep-cli-path", type=validate_file, help="Path to the E+ CLI") # , required=True + + +@pytest.fixture(scope="module") +def epclipath(request): + cli_path = request.config.getoption("--ep-cli-path") + if cli_path is None: + raise ValueError("You must supply --ep-cli-path [Path]") + return cli_path + + +@pytest.fixture(scope="module") +def testfiles_dir(): + return Path(__file__).parent / "../../testfiles" + + +@pytest.fixture(scope="module") +def chig_epw(): + return Path(__file__).parent / "../../weather/USA_IL_Chicago-OHare_TMY2.epw" diff --git a/scripts/pytests/requirements.txt b/scripts/pytests/requirements.txt new file mode 100644 index 00000000000..aec3ae2868c --- /dev/null +++ b/scripts/pytests/requirements.txt @@ -0,0 +1,2 @@ +pytest +lxml diff --git a/scripts/pytests/test_xml_output.py b/scripts/pytests/test_xml_output.py new file mode 100644 index 00000000000..207ed6873e9 --- /dev/null +++ b/scripts/pytests/test_xml_output.py @@ -0,0 +1,87 @@ +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University +# of Illinois, The Regents of the University of California, through Lawrence +# Berkeley National Laboratory (subject to receipt of any required approvals +# from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- +# Battelle, Alliance for Sustainable Energy, LLC, and other contributors. All +# rights reserved. +# +# NOTICE: This Software was developed under funding from the U.S. Department of +# Energy and the U.S. Government consequently retains certain rights. As such, +# the U.S. Government has been granted for itself and others acting on its +# behalf a paid-up, nonexclusive, irrevocable, worldwide license in the +# Software to reproduce, distribute copies to the public, prepare derivative +# works, and perform publicly and display publicly, and to permit others to do +# so. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# (1) Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# (2) Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# (3) Neither the name of the University of California, Lawrence Berkeley +# National Laboratory, the University of Illinois, U.S. Dept. of Energy nor +# the names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in +# stand-alone form without changes from the version obtained under this +# License, or (ii) Licensee makes a reference solely to the software +# portion of its product, Licensee must refer to the software as +# "EnergyPlus version X" software, where "X" is the version number Licensee +# obtained under this License and may not use a different name for the +# software. Except as specifically required in this Section (4), Licensee +# shall not use in a company name, a product name, in advertising, +# publicity, or other promotional activities any name, trade name, +# trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or +# confusingly similar designation, without the U.S. Department of Energy's +# prior written consent. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +import re +import subprocess +from pathlib import Path + +import pytest + + +@pytest.fixture +def prepare_idf_with_xml(tmp_path: Path, testfiles_dir: Path): # tmp_path is a built-in pytest fixture + RE_TABLE = re.compile(r"(?POutputControl:Table:Style.*)HTML;", re.DOTALL) + idf_file_path = testfiles_dir / "DXCoilSystemAuto.idf" + assert idf_file_path.is_file() + content = idf_file_path.read_text() + content = RE_TABLE.sub(r"\g<1>XMLandHTML;", content) + mod_idf_file_path = tmp_path / "in.idf" + mod_idf_file_path.write_text(content) + return mod_idf_file_path + + +def test_xml_with_standard_ratings_is_valid(epclipath, prepare_idf_with_xml, chig_epw): + lxml = pytest.importorskip("lxml", reason="lxml not found, please `pip install lxml`") + from lxml import etree + + subprocess.check_call( + [str(epclipath), "-w", str(chig_epw)], + stdout=subprocess.DEVNULL, + stderr=subprocess.STDOUT, + cwd=prepare_idf_with_xml.parent, + ) + xml_out_path = prepare_idf_with_xml.parent / "eplustbl.xml" + assert xml_out_path.is_file() + root = lxml.etree.fromstring(xml_out_path.read_text(encoding="latin-1")) diff --git a/setup.py b/setup.py index 095c5801bb8..54e40ab324d 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/src/.clang-format b/src/.clang-format index 69f11264af5..be0d523aa16 100644 --- a/src/.clang-format +++ b/src/.clang-format @@ -37,4 +37,4 @@ BraceWrapping: # SplitEmptyFunction: true # SplitEmptyRecord: true # SplitEmptyNamespace: true - +IndentPPDirectives: AfterHash diff --git a/src/ConvertInputFormat/main.cpp b/src/ConvertInputFormat/main.cpp index 51c911434aa..dfa6072b88b 100644 --- a/src/ConvertInputFormat/main.cpp +++ b/src/ConvertInputFormat/main.cpp @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -57,7 +57,7 @@ #include #ifdef _OPENMP -#include +# include #endif #include @@ -543,12 +543,13 @@ Select one (case insensitive): #ifdef _OPENMP omp_set_num_threads(number_of_threads); -#pragma omp parallel default(none) shared(files, number_files, fileCount, schema, outputType, outputTypeStr, outputDirectoryPath, convertHVACTemplate) +# pragma omp parallel default(none) \ + shared(files, number_files, fileCount, schema, outputType, outputTypeStr, outputDirectoryPath, convertHVACTemplate) { -#pragma omp for +# pragma omp for for (int i = 0; i < number_files; ++i) { const bool successful = processInput(files[i], schema, outputType, outputDirectoryPath, outputTypeStr, convertHVACTemplate); -#pragma omp atomic +# pragma omp atomic ++fileCount; if (successful) { displayMessage( diff --git a/src/ConvertInputFormat/test_convert_input_format.py b/src/ConvertInputFormat/test_convert_input_format.py index 92caef0cd48..114e04724e5 100644 --- a/src/ConvertInputFormat/test_convert_input_format.py +++ b/src/ConvertInputFormat/test_convert_input_format.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/src/EnergyPlus/AirLoopHVACDOAS.cc b/src/EnergyPlus/AirLoopHVACDOAS.cc index b382733e760..0d90a76534a 100644 --- a/src/EnergyPlus/AirLoopHVACDOAS.cc +++ b/src/EnergyPlus/AirLoopHVACDOAS.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -50,6 +50,7 @@ // EnergyPlus Headers #include +#include #include #include #include @@ -440,7 +441,7 @@ namespace AirLoopHVACDOAS { void AirLoopDOAS::getAirLoopDOASInput(EnergyPlusData &state) { - + constexpr std::string_view routineName = "AirLoopDOAS::getAirLoopDOASInput"; std::string const cCurrentModuleObject = "AirLoopHVAC:DedicatedOutdoorAirSystem"; auto const instances = state.dataInputProcessing->inputProcessor->epJSON.find(cCurrentModuleObject); @@ -457,6 +458,8 @@ namespace AirLoopHVACDOAS { ++AirLoopDOASNum; AirLoopDOAS thisDOAS; + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, thisObjectName}; + thisDOAS.Name = Util::makeUPPER(thisObjectName); // get OA and avail num thisDOAS.OASystemName = Util::makeUPPER(fields.at("airloophvac_outdoorairsystem_name").get()); @@ -758,12 +761,9 @@ namespace AirLoopHVACDOAS { } thisDOAS.AvailManagerSchedName = Util::makeUPPER(fields.at("availability_schedule_name").get()); - thisDOAS.m_AvailManagerSchedPtr = ScheduleManager::GetScheduleIndex(state, thisDOAS.AvailManagerSchedName); - if (thisDOAS.m_AvailManagerSchedPtr == 0) { - cFieldName = "Availability Schedule Name"; - ShowSevereError( - state, - format("{}, \"{}\" {} not found: {}", cCurrentModuleObject, thisDOAS.Name, cFieldName, thisDOAS.AvailManagerSchedName)); + + if ((thisDOAS.m_AvailManagerSched = Sched::GetSchedule(state, thisDOAS.AvailManagerSchedName)) == nullptr) { + ShowSevereItemNotFound(state, eoh, "Availability Schedule Name", thisDOAS.AvailManagerSchedName); errorsFound = true; } @@ -789,7 +789,7 @@ namespace AirLoopHVACDOAS { thisDOAS.m_CompPointerAirLoopSplitter = thisAirLoopSplitter.factory(state, thisDOAS.m_AirLoopSplitterIndex, thisDOAS.AirLoopSplitterName); - // get pretreated desing conditions + // get pretreated design conditions thisDOAS.PreheatTemp = fields.at("preheat_design_temperature").get(); thisDOAS.PreheatHumRat = fields.at("preheat_design_humidity_ratio").get(); thisDOAS.PrecoolTemp = fields.at("precool_design_temperature").get(); @@ -889,11 +889,7 @@ namespace AirLoopHVACDOAS { if (Util::SameString(CompType, "COIL:HEATING:WATER")) { WaterCoils::SimulateWaterCoilComponents(state, CompName, FirstHVACIteration, this->m_HeatCoilNum); Real64 CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", CompName, ErrorsFound); - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); PlantUtilities::InitComponentNodes(state, 0.0, CoilMaxVolFlowRate * rho, @@ -903,11 +899,7 @@ namespace AirLoopHVACDOAS { if (Util::SameString(CompType, "COIL:COOLING:WATER")) { WaterCoils::SimulateWaterCoilComponents(state, CompName, FirstHVACIteration, this->m_CoolCoilNum); Real64 CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Cooling:Water", CompName, ErrorsFound); - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); PlantUtilities::InitComponentNodes(state, 0.0, CoilMaxVolFlowRate * rho, @@ -918,11 +910,7 @@ namespace AirLoopHVACDOAS { WaterCoils::SimulateWaterCoilComponents(state, CompName, FirstHVACIteration, this->m_CoolCoilNum); Real64 CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Cooling:Water:DetailedGeometry", CompName, ErrorsFound); - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); PlantUtilities::InitComponentNodes(state, 0.0, CoilMaxVolFlowRate * rho, @@ -948,7 +936,7 @@ namespace AirLoopHVACDOAS { this->SumMassFlowRate += state.dataLoopNodes->Node(NodeNum).MassFlowRate; } - SchAvailValue = ScheduleManager::GetCurrentScheduleValue(state, this->m_AvailManagerSchedPtr); + SchAvailValue = this->m_AvailManagerSched->getCurrentVal(); if (SchAvailValue < 1.0) { this->SumMassFlowRate = 0.0; } @@ -980,32 +968,35 @@ namespace AirLoopHVACDOAS { void AirLoopDOAS::SizingAirLoopDOAS(EnergyPlusData &state) { - Real64 sizingMassFlow = 0; + Real64 sizingVolumeFlow = 0; for (int AirLoop = 1; AirLoop <= this->NumOfAirLoops; AirLoop++) { int AirLoopNum = this->m_AirLoopNum[AirLoop - 1]; this->m_OACtrlNum.push_back(state.dataAirLoop->AirLoopControlInfo(AirLoopNum).OACtrlNum); if (this->m_OACtrlNum[AirLoop - 1] > 0) { - sizingMassFlow += state.dataMixedAir->OAController(this->m_OACtrlNum[AirLoop - 1]).MaxOA; + sizingVolumeFlow += + state.dataMixedAir->OAController(this->m_OACtrlNum[AirLoop - 1]).MaxOA; // this is a volume flow rate not a mass flow rate } } - this->SizingMassFlow = sizingMassFlow; + this->SizingMassFlow = sizingVolumeFlow * state.dataEnvrn->StdRhoAir; + + BaseSizer::reportSizerOutput(state, "AirLoopHVAC:DedicatedOutdoorAirSystem", this->Name, "Design Volume Flow Rate [m3/s]", sizingVolumeFlow); this->GetDesignDayConditions(state); if (this->m_FanIndex > 0 && this->m_FanTypeNum == SimAirServingZones::CompType::Fan_System_Object) { - state.dataFans->fans(this->m_FanIndex)->maxAirFlowRate = sizingMassFlow / state.dataEnvrn->StdRhoAir; - state.dataLoopNodes->Node(this->m_FanInletNodeNum).MassFlowRateMaxAvail = sizingMassFlow; - state.dataLoopNodes->Node(this->m_FanOutletNodeNum).MassFlowRateMaxAvail = sizingMassFlow; - state.dataLoopNodes->Node(this->m_FanOutletNodeNum).MassFlowRateMax = sizingMassFlow; + state.dataFans->fans(this->m_FanIndex)->maxAirFlowRate = sizingVolumeFlow; + state.dataLoopNodes->Node(this->m_FanInletNodeNum).MassFlowRateMaxAvail = this->SizingMassFlow; + state.dataLoopNodes->Node(this->m_FanOutletNodeNum).MassFlowRateMaxAvail = this->SizingMassFlow; + state.dataLoopNodes->Node(this->m_FanOutletNodeNum).MassFlowRateMax = this->SizingMassFlow; } if (this->m_FanIndex > 0 && this->m_FanTypeNum == SimAirServingZones::CompType::Fan_ComponentModel) { - state.dataFans->fans(this->m_FanIndex)->maxAirFlowRate = sizingMassFlow / state.dataEnvrn->StdRhoAir; + state.dataFans->fans(this->m_FanIndex)->maxAirFlowRate = sizingVolumeFlow; state.dataFans->fans(this->m_FanIndex)->minAirFlowRate = 0.0; - state.dataFans->fans(this->m_FanIndex)->maxAirMassFlowRate = sizingMassFlow; - state.dataLoopNodes->Node(this->m_FanInletNodeNum).MassFlowRateMaxAvail = sizingMassFlow; - state.dataLoopNodes->Node(this->m_FanOutletNodeNum).MassFlowRateMaxAvail = sizingMassFlow; - state.dataLoopNodes->Node(this->m_FanOutletNodeNum).MassFlowRateMax = sizingMassFlow; + state.dataFans->fans(this->m_FanIndex)->maxAirMassFlowRate = this->SizingMassFlow; + state.dataLoopNodes->Node(this->m_FanInletNodeNum).MassFlowRateMaxAvail = this->SizingMassFlow; + state.dataLoopNodes->Node(this->m_FanOutletNodeNum).MassFlowRateMaxAvail = this->SizingMassFlow; + state.dataLoopNodes->Node(this->m_FanOutletNodeNum).MassFlowRateMax = this->SizingMassFlow; } state.dataSize->CurSysNum = state.dataHVACGlobal->NumPrimaryAirSys + this->m_AirLoopDOASNum + 1; @@ -1044,6 +1035,21 @@ namespace AirLoopHVACDOAS { } } } + + BaseSizer::reportSizerOutput( + state, "AirLoopHVAC:DedicatedOutdoorAirSystem", this->Name, "Design Cooling Outdoor Air Temperature [C]", this->SizingCoolOATemp); + BaseSizer::reportSizerOutput(state, + "AirLoopHVAC:DedicatedOutdoorAirSystem", + this->Name, + "Design Cooling Outdoor Air Humidity Ratio [kgWater/kgDryAir]", + this->SizingCoolOAHumRat); + BaseSizer::reportSizerOutput( + state, "AirLoopHVAC:DedicatedOutdoorAirSystem", this->Name, "Design Heating Outdoor Air Temperature [C]", this->HeatOutTemp); + BaseSizer::reportSizerOutput(state, + "AirLoopHVAC:DedicatedOutdoorAirSystem", + this->Name, + "Design Heating Outdoor Air Humidity Ratio [kgWater/kgDryAir]", + this->HeatOutHumRat); } void CheckConvergence(EnergyPlusData &state) diff --git a/src/EnergyPlus/AirLoopHVACDOAS.hh b/src/EnergyPlus/AirLoopHVACDOAS.hh index bc6130404de..640492f4338 100644 --- a/src/EnergyPlus/AirLoopHVACDOAS.hh +++ b/src/EnergyPlus/AirLoopHVACDOAS.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -117,7 +117,7 @@ namespace AirLoopHVACDOAS { int m_AirLoopDOASNum = 0; int m_OASystemNum = 0; - int m_AvailManagerSchedPtr = 0; + Sched::Schedule *m_AvailManagerSched = nullptr; int m_AirLoopMixerIndex = -1; int m_AirLoopSplitterIndex = -1; int NumOfAirLoops = 0; @@ -184,6 +184,10 @@ struct AirLoopHVACDOASData : BaseGlobalStruct std::vector airloopMixer; std::vector airloopSplitter; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/AirTerminalUnit.hh b/src/EnergyPlus/AirTerminalUnit.hh index 9574686c6fa..8b6f40b7810 100644 --- a/src/EnergyPlus/AirTerminalUnit.hh +++ b/src/EnergyPlus/AirTerminalUnit.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -54,6 +54,7 @@ // EnergyPlus Headers #include #include +#include namespace EnergyPlus { @@ -108,7 +109,7 @@ protected: // Data std::string name; // name of unit std::string unitType; // type of unit = e.g. AirTerminal:SingleDuct:ConstantVolume:FourPipeBeam int aDUNum = 0; // index of this unit in the corresponding air distribution unit structure - int airAvailSchedNum = 0; // index to schedule for pimary air availability + Sched::Schedule *airAvailSched = nullptr; // schedule for pimary air availability bool airAvailable = false; // true if primary air is available Real64 vDotDesignPrimAir = 0.0; // Design primary air volume flow rate m3/s (autosizable) bool vDotDesignPrimAirWasAutosized = false; // true if user input for design air flow was autsized on input diff --git a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Elements.hpp b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Elements.hpp index 42679bf6f5f..a3e9b8c3ad4 100644 --- a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Elements.hpp +++ b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Elements.hpp @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -51,6 +51,7 @@ #include "AirflowNetwork/Properties.hpp" #include #include +#include namespace EnergyPlus { @@ -245,11 +246,11 @@ namespace AirflowNetwork { struct MultizoneZoneProp // Zone information { // Members - std::string ZoneName; // Name of Associated EnergyPlus Thermal Zone - std::string VentControl; // Ventilation Control Mode: "TEMPERATURE", "ENTHALPIC", "CONSTANT", or "NOVENT" - std::string VentSchName; // Name of ventilation temperature control schedule - Real64 Height; // Nodal height - Real64 OpenFactor; // Limit Value on Multiplier for Modulating Venting Open Factor, + std::string ZoneName; // Name of Associated EnergyPlus Thermal Zone + std::string VentControl; // Ventilation Control Mode: "TEMPERATURE", "ENTHALPIC", "CONSTANT", or "NOVENT" + std::string VentAvailSchName; // Ventilation availability schedule + Real64 Height; // Nodal height + Real64 OpenFactor; // Limit Value on Multiplier for Modulating Venting Open Factor, // Not applicable if Vent Control Mode = CONSTANT or NOVENT Real64 LowValueTemp; // Lower Value on Inside/Outside Temperature Difference for // Modulating the Venting Open Factor with temp control @@ -259,24 +260,24 @@ namespace AirflowNetwork { // Modulating the Venting Open Factor with Enthalpic control Real64 UpValueEnth; // Upper Value on Inside/Outside Temperature Difference for // Modulating the Venting Open Factor with Enthalpic control - int ZoneNum; // Zone number associated with ZoneName - int VentSchNum; // Zone ventilation schedule number associated with ventilation schedule name - int VentCtrNum; // Ventilation control mode number: 1 "Temperature", 2 "ENTHALPIC", 3 "CONSTANT", 4 "NOVENT" - std::string VentingSchName; // Name of ventilation temperature control schedule - int VentingSchNum; // Ventilation schedule number - std::string SingleSidedCpType; // Type of calculation method for single sided wind pressure coefficients - Real64 BuildWidth; // The width of the building along the facade that contains this zone. - int ASH55PeopleInd; // Index of people object with ASH55 comfort calcs for ventilation control - int CEN15251PeopleInd; // Index of people object with CEN15251 comfort calcs for ventilation control - std::string OccupantVentilationControlName; // Occupant ventilation control name - int OccupantVentilationControlNum; // Occupant ventilation control number - int RAFNNodeNum; // Index of RAFN node number + int ZoneNum; // Zone number associated with ZoneName + Sched::Schedule *ventTempControlSched = nullptr; // Ventilation temperature control schedule + int VentCtrNum; // Ventilation control mode number: 1 "Temperature", 2 "ENTHALPIC", 3 "CONSTANT", 4 "NOVENT" + std::string VentTempControlSchName; // Name of ventilation temperature control schedule + Sched::Schedule *ventAvailSched = nullptr; // Ventilation availability schedule + std::string SingleSidedCpType; // Type of calculation method for single sided wind pressure coefficients + Real64 BuildWidth; // The width of the building along the facade that contains this zone. + int ASH55PeopleInd; // Index of people object with ASH55 comfort calcs for ventilation control + int CEN15251PeopleInd; // Index of people object with CEN15251 comfort calcs for ventilation control + std::string OccupantVentilationControlName; // Occupant ventilation control name + int OccupantVentilationControlNum; // Occupant ventilation control number + int RAFNNodeNum; // Index of RAFN node number // Default Constructor MultizoneZoneProp() : VentControl("NoVent"), Height(0.0), OpenFactor(1.0), LowValueTemp(0.0), UpValueTemp(100.0), LowValueEnth(0.0), UpValueEnth(300000.0), - ZoneNum(0), VentSchNum(0), VentCtrNum(VentControlType::None), VentingSchNum(0), SingleSidedCpType("STANDARD"), BuildWidth(10.0), - ASH55PeopleInd(0), CEN15251PeopleInd(0), OccupantVentilationControlNum(0), RAFNNodeNum(0) + ZoneNum(0), VentCtrNum(VentControlType::None), SingleSidedCpType("STANDARD"), BuildWidth(10.0), ASH55PeopleInd(0), CEN15251PeopleInd(0), + OccupantVentilationControlNum(0), RAFNNodeNum(0) { } }; @@ -298,7 +299,6 @@ namespace AirflowNetwork { Real64 Width; // Surface width Real64 CHeight; // Surface central height in z direction std::string VentControl; // Ventilation Control Mode: TEMPERATURE, ENTHALPIC, CONSTANT, ZONELEVEL or NOVENT - std::string VentSchName; // ! Name of ventilation temperature control schedule Real64 ModulateFactor; // Limit Value on Multiplier for Modulating Venting Open Factor Real64 LowValueTemp; // Lower Value on Inside/Outside Temperature Difference for // Modulating the Venting Open Factor with temp control @@ -308,31 +308,32 @@ namespace AirflowNetwork { // Modulating the Venting Open Factor with Enthalpic control Real64 UpValueEnth; // Upper Value on Inside/Outside Temperature Difference for // Modulating the Venting Open Factor with Enthalpic control - std::string VentingSchName; // Name of ventilation temperature control schedule - int VentSchNum; // Zone ventilation schedule number associated with ventilation schedule name - VentControlType VentSurfCtrNum; // Ventilation control mode number: 1 "Temperature", 2 "ENTHALPIC", 3 "CONSTANT", 4 "NOVENT" - int VentingSchNum; // Ventilation schedule number - int ZonePtr; // Pointer to inside face zone - bool IndVentControl; // Individual surface venting control - int ExtLargeOpeningErrCount; // Exterior large opening error count during HVAC system operation - int ExtLargeOpeningErrIndex; // Exterior large opening error index during HVAC system operation - int OpenFactorErrCount; // Large opening error count at Open factor > 1.0 - int OpenFactorErrIndex; // Large opening error error index at Open factor > 1.0 - Real64 Multiplier; // Window multiplier - bool HybridVentClose; // Hybrid ventilation window close control logical - bool HybridCtrlGlobal; // Hybrid ventilation global control logical - bool HybridCtrlMaster; // Hybrid ventilation global control master - Real64 WindModifier; // Wind modifier from hybrid ventilation control - std::string OccupantVentilationControlName; // Occupant ventilation control name - int OccupantVentilationControlNum; // Occupant ventilation control number - int OpeningStatus; // Open status at current time step - int PrevOpeningstatus; // Open status at previous time step - Real64 CloseElapsedTime; // Elapsed time during closing (min) - Real64 OpenElapsedTime; // Elapsed time during closing (min) - int ClosingProbStatus; // Closing probability status - int OpeningProbStatus; // Opening probability status - bool RAFNflag; // True if this surface is used in AirflowNetwork:IntraZone:Linkage - bool NonRectangular; // True if this surface is not rectangular + std::string VentTempControlSchName; // Name of ventilation temperature control schedule + Sched::Schedule *ventTempControlSched = nullptr; // Ventilation temperature control schedule + VentControlType VentSurfCtrNum; // Ventilation control mode number: 1 "Temperature", 2 "ENTHALPIC", 3 "CONSTANT", 4 "NOVENT" + std::string VentAvailSchName; // Ventilation availability schedule + Sched::Schedule *ventAvailSched = nullptr; // Ventilation availability schedule + int ZonePtr; // Pointer to inside face zone + bool IndVentControl; // Individual surface venting control + int ExtLargeOpeningErrCount; // Exterior large opening error count during HVAC system operation + int ExtLargeOpeningErrIndex; // Exterior large opening error index during HVAC system operation + int OpenFactorErrCount; // Large opening error count at Open factor > 1.0 + int OpenFactorErrIndex; // Large opening error error index at Open factor > 1.0 + Real64 Multiplier; // Window multiplier + bool HybridVentClose; // Hybrid ventilation window close control logical + bool HybridCtrlGlobal; // Hybrid ventilation global control logical + bool HybridCtrlMaster; // Hybrid ventilation global control master + Real64 WindModifier; // Wind modifier from hybrid ventilation control + std::string OccupantVentilationControlName; // Occupant ventilation control name + int OccupantVentilationControlNum; // Occupant ventilation control number + int OpeningStatus; // Open status at current time step + int PrevOpeningstatus; // Open status at previous time step + Real64 CloseElapsedTime; // Elapsed time during closing (min) + Real64 OpenElapsedTime; // Elapsed time during closing (min) + int ClosingProbStatus; // Closing probability status + int OpeningProbStatus; // Opening probability status + bool RAFNflag; // True if this surface is used in AirflowNetwork:IntraZone:Linkage + bool NonRectangular; // True if this surface is not rectangular EquivRec EquivRecMethod; // Equivalent Rectangle Method input: 1 Height; 2 Base surface aspect ratio; 3 User input aspect ratio Real64 EquivRecUserAspectRatio; // user input value when EquivRecMethod = 3 @@ -340,13 +341,12 @@ namespace AirflowNetwork { MultizoneSurfaceProp() : Factor(0.0), SurfNum(0), NodeNums{{0, 0}}, OpenFactor(0.0), OpenFactorLast(0.0), EMSOpenFactorActuated(false), EMSOpenFactor(0.0), Height(0.0), Width(0.0), CHeight(0.0), VentControl("ZONELEVEL"), ModulateFactor(0.0), LowValueTemp(0.0), UpValueTemp(100.0), - LowValueEnth(0.0), UpValueEnth(300000.0), VentSchNum(0), VentSurfCtrNum(VentControlType::None), VentingSchNum(0), ZonePtr(0), - IndVentControl(false), ExtLargeOpeningErrCount(0), ExtLargeOpeningErrIndex(0), OpenFactorErrCount(0), OpenFactorErrIndex(0), - Multiplier(1.0), HybridVentClose(false), HybridCtrlGlobal(false), HybridCtrlMaster(false), WindModifier(1.0), - OccupantVentilationControlNum(0), OpeningStatus(OpenStatus::FreeOperation), PrevOpeningstatus(OpenStatus::FreeOperation), - CloseElapsedTime(0.0), OpenElapsedTime(0.0), ClosingProbStatus(ProbabilityCheck::NoAction), - OpeningProbStatus(ProbabilityCheck::NoAction), RAFNflag(false), NonRectangular(false), EquivRecMethod(EquivRec::Height), - EquivRecUserAspectRatio(1.0) + LowValueEnth(0.0), UpValueEnth(300000.0), VentSurfCtrNum(VentControlType::None), ZonePtr(0), IndVentControl(false), + ExtLargeOpeningErrCount(0), ExtLargeOpeningErrIndex(0), OpenFactorErrCount(0), OpenFactorErrIndex(0), Multiplier(1.0), + HybridVentClose(false), HybridCtrlGlobal(false), HybridCtrlMaster(false), WindModifier(1.0), OccupantVentilationControlNum(0), + OpeningStatus(OpenStatus::FreeOperation), PrevOpeningstatus(OpenStatus::FreeOperation), CloseElapsedTime(0.0), OpenElapsedTime(0.0), + ClosingProbStatus(ProbabilityCheck::NoAction), OpeningProbStatus(ProbabilityCheck::NoAction), RAFNflag(false), NonRectangular(false), + EquivRecMethod(EquivRec::Height), EquivRecUserAspectRatio(1.0) { } }; @@ -752,21 +752,21 @@ namespace AirflowNetwork { struct ZoneExhaustFan : public AirflowElement // Zone exhaust fan component { // Members - Real64 FlowRate; // mass flow rate - int SchedPtr; // Schedule pointer - Real64 FlowCoef; // Air Mass Flow Coefficient [kg/s at 1Pa] - Real64 FlowExpo; // Air Mass Flow exponent [dimensionless] - Real64 StandardT; // Standard temperature for crack data - Real64 StandardP; // Standard barometric pressure for crack data - Real64 StandardW; // Standard humidity ratio for crack data - int InletNode; // Inlet node number - int OutletNode; // Outlet node number - int EPlusZoneNum; // Zone number - int PressCtrlNum; // pressure control number + Real64 FlowRate; // mass flow rate + Sched::Schedule *sched = nullptr; // Schedule pointer + Real64 FlowCoef; // Air Mass Flow Coefficient [kg/s at 1Pa] + Real64 FlowExpo; // Air Mass Flow exponent [dimensionless] + Real64 StandardT; // Standard temperature for crack data + Real64 StandardP; // Standard barometric pressure for crack data + Real64 StandardW; // Standard humidity ratio for crack data + int InletNode; // Inlet node number + int OutletNode; // Outlet node number + int EPlusZoneNum; // Zone number + int PressCtrlNum; // pressure control number // Default Constructor ZoneExhaustFan() - : FlowRate(0.0), SchedPtr(0), FlowCoef(0.0), FlowExpo(0.0), StandardT(0.0), StandardP(0.0), StandardW(0.0), InletNode(0), OutletNode(0), + : FlowRate(0.0), FlowCoef(0.0), FlowExpo(0.0), StandardT(0.0), StandardP(0.0), StandardW(0.0), InletNode(0), OutletNode(0), EPlusZoneNum(0), PressCtrlNum(0) { } @@ -1390,24 +1390,22 @@ namespace AirflowNetwork { struct PressureControllerProp { // Members - std::string Name; // Provide a unique object name - std::string ZoneName; // Name of the zone that is being controlled - int ZoneNum; // Zone number - int AFNNodeNum; // AFN node number - std::string ControlObjectType; // The control type to be used for pressure control - std::string ControlObjectName; // Corresponding control type name - int ControlTypeSet; // Control type set to be used for pressure control - int AvailSchedPtr; // Availability schedule pointer - int PresSetpointSchedPtr; // Pressure setpoint schedule pointer - int AirLoopNum; // Air loop number - int OANodeNum; // outdoor air node number - bool bypass; // Can not perform pressure control as true + std::string Name; // Provide a unique object name + std::string ZoneName; // Name of the zone that is being controlled + int ZoneNum; // Zone number + int AFNNodeNum; // AFN node number + std::string ControlObjectType; // The control type to be used for pressure control + std::string ControlObjectName; // Corresponding control type name + int ControlTypeSet; // Control type set to be used for pressure control + Sched::Schedule *availSched = nullptr; // Availability schedule pointer + Sched::Schedule *presSetpointSched = nullptr; // Pressure setpoint schedule pointer + int AirLoopNum; // Air loop number + int OANodeNum; // outdoor air node number + bool bypass; // Can not perform pressure control as true Real64 PresCtrlMassRate; // Default Constructor - PressureControllerProp() - : ZoneNum(0), AFNNodeNum(0), ControlTypeSet(0), AvailSchedPtr(0), PresSetpointSchedPtr(0), AirLoopNum(0), OANodeNum(0), bypass(false), - PresCtrlMassRate(0.0) + PressureControllerProp() : ZoneNum(0), AFNNodeNum(0), ControlTypeSet(0), AirLoopNum(0), OANodeNum(0), bypass(false), PresCtrlMassRate(0.0) { } }; @@ -1415,20 +1413,20 @@ namespace AirflowNetwork { struct OutdoorAirFan : public AirflowElement // OA fan component { // Members - int SchedPtr; // Schedule pointer - Real64 FlowCoef; // Air Mass Flow Coefficient [kg/s at 1Pa] - Real64 FlowExpo; // Air Mass Flow exponent [dimensionless] - Real64 StandardT; // Standard temperature for crack data [C] - Real64 StandardP; // Standard barometric pressure for crack data [Pa] - Real64 StandardW; // Standard humidity ratio for crack data [kg/kg] - int InletNode; // Inlet node number - int OutletNode; // Outlet node number - int OAMixerNum; // OA Mixer number - int PressCtrlNum; // Pressure control number + Sched::Schedule *sched = nullptr; // Schedule pointer + Real64 FlowCoef; // Air Mass Flow Coefficient [kg/s at 1Pa] + Real64 FlowExpo; // Air Mass Flow exponent [dimensionless] + Real64 StandardT; // Standard temperature for crack data [C] + Real64 StandardP; // Standard barometric pressure for crack data [Pa] + Real64 StandardW; // Standard humidity ratio for crack data [kg/kg] + int InletNode; // Inlet node number + int OutletNode; // Outlet node number + int OAMixerNum; // OA Mixer number + int PressCtrlNum; // Pressure control number // Default Constructor OutdoorAirFan() - : SchedPtr(0), FlowCoef(0.0), FlowExpo(0.0), StandardT(0.0), StandardP(0.0), StandardW(0.0), InletNode(0), OutletNode(0), OAMixerNum(0), + : FlowCoef(0.0), FlowExpo(0.0), StandardT(0.0), StandardP(0.0), StandardW(0.0), InletNode(0), OutletNode(0), OAMixerNum(0), PressCtrlNum(0) { } diff --git a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Properties.hpp b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Properties.hpp index 08dc94048ce..b96e9615d5b 100644 --- a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Properties.hpp +++ b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Properties.hpp @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -57,8 +57,8 @@ #define AIRCP(W) Psychrometrics::PsyCpAirFnW(W) #define AIRDYNAMICVISCOSITY_CONSTEXPR(T) air_dynamic_viscosity(T) #ifndef TOKELVIN -#include "../../../DataGlobals.hh" -#define TOKELVIN(T) (T + Constant::Kelvin) +# include "../../../DataGlobals.hh" +# define TOKELVIN(T) (T + Constant::Kelvin) #endif namespace EnergyPlus { diff --git a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Solver.hpp b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Solver.hpp index b3f013708e8..32d76121a26 100644 --- a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Solver.hpp +++ b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Solver.hpp @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -129,26 +129,26 @@ namespace AirflowNetwork { struct OccupantVentilationControlProp { - std::string Name; // Provide a unique object name - Real64 MinOpeningTime; // Minimum Opening Time - Real64 MinClosingTime; // Minimum Closing Time - std::string ComfortLowTempCurveName; // Thermal Comfort Low Temperature Curve Name - std::string ComfortHighTempCurveName; // Thermal Comfort High Temperature Curve Name - int ComfortLowTempCurveNum; // Thermal Comfort Low Temperature Curve number - int ComfortHighTempCurveNum; // Thermal Comfort high Temperature Curve number - int OpeningProbSchNum; // Opening probability schedule pointer - int ClosingProbSchNum; // Closing probability schedule pointer - Real64 ComfortBouPoint; // Thermal Comfort Temperature Boundary Point - bool OccupancyCheck; // Occupancy check - std::string OpeningProbSchName; // Opening probability schedule name - std::string ClosingProbSchName; // Closing probability schedule name - Real64 MaxPPD; // Maximum PPD used to calculate comfort band (%) - bool MinTimeControlOnly; // Chach minimum opening and closing time only + std::string Name; // Provide a unique object name + Real64 MinOpeningTime; // Minimum Opening Time + Real64 MinClosingTime; // Minimum Closing Time + std::string ComfortLowTempCurveName; // Thermal Comfort Low Temperature Curve Name + std::string ComfortHighTempCurveName; // Thermal Comfort High Temperature Curve Name + int ComfortLowTempCurveNum; // Thermal Comfort Low Temperature Curve number + int ComfortHighTempCurveNum; // Thermal Comfort high Temperature Curve number + Sched::Schedule *openingProbSched = nullptr; // Opening probability schedule pointer + Sched::Schedule *closingProbSched = nullptr; // Closing probability schedule pointer + Real64 ComfortBouPoint; // Thermal Comfort Temperature Boundary Point + bool OccupancyCheck; // Occupancy check + std::string OpeningProbSchName; // Opening probability schedule name + std::string ClosingProbSchName; // Closing probability schedule name + Real64 MaxPPD; // Maximum PPD used to calculate comfort band (%) + bool MinTimeControlOnly; // Chach minimum opening and closing time only // Default Constructor OccupantVentilationControlProp() - : MinOpeningTime(0.0), MinClosingTime(0.0), ComfortLowTempCurveNum(0), ComfortHighTempCurveNum(0), OpeningProbSchNum(0), - ClosingProbSchNum(0), ComfortBouPoint(10.0), OccupancyCheck(false), MaxPPD(10.0), MinTimeControlOnly(false) + : MinOpeningTime(0.0), MinClosingTime(0.0), ComfortLowTempCurveNum(0), ComfortHighTempCurveNum(0), ComfortBouPoint(10.0), + OccupancyCheck(false), MaxPPD(10.0), MinTimeControlOnly(false) { } @@ -539,6 +539,10 @@ namespace AirflowNetwork { Array1D DisSysCompReliefAirData; Array1D AirflowNetworkLinkageViewFactorData; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/AirflowNetwork/src/Elements.cpp b/src/EnergyPlus/AirflowNetwork/src/Elements.cpp index faa8a0a0340..c68f5e27b66 100644 --- a/src/EnergyPlus/AirflowNetwork/src/Elements.cpp +++ b/src/EnergyPlus/AirflowNetwork/src/Elements.cpp @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/AirflowNetwork/src/Properties.cpp b/src/EnergyPlus/AirflowNetwork/src/Properties.cpp index 6ed944c200a..44bbe8b8076 100644 --- a/src/EnergyPlus/AirflowNetwork/src/Properties.cpp +++ b/src/EnergyPlus/AirflowNetwork/src/Properties.cpp @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp index 47073976e3a..9630353fbdf 100644 --- a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp +++ b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -56,7 +56,7 @@ // ObjexxFCL Headers #include #include -#include +// #include // EnergyPlus Headers #include @@ -144,8 +144,6 @@ namespace AirflowNetwork { using Psychrometrics::PsyCpAirFnW; using Psychrometrics::PsyHFnTdbW; using Psychrometrics::PsyRhoAirFnPbTdbW; - using ScheduleManager::GetCurrentScheduleValue; - using ScheduleManager::GetScheduleIndex; Solver::Solver(EnergyPlusData &state) : m_state(state), properties(state) { @@ -1879,8 +1877,8 @@ namespace AirflowNetwork { } if (!lAlphaBlanks(5)) { OccupantVentilationControl(i).OpeningProbSchName = Alphas(5); // a schedule name for opening probability - OccupantVentilationControl(i).OpeningProbSchNum = GetScheduleIndex(m_state, OccupantVentilationControl(i).OpeningProbSchName); - if (OccupantVentilationControl(i).OpeningProbSchNum == 0) { + OccupantVentilationControl(i).openingProbSched = Sched::GetSchedule(m_state, OccupantVentilationControl(i).OpeningProbSchName); + if (OccupantVentilationControl(i).openingProbSched == nullptr) { ShowSevereError(m_state, format(RoutineName) + CurrentModuleObject + " object, " + cAlphaFields(5) + " not found = " + OccupantVentilationControl(i).OpeningProbSchName); @@ -1890,8 +1888,8 @@ namespace AirflowNetwork { } if (!lAlphaBlanks(6)) { OccupantVentilationControl(i).ClosingProbSchName = Alphas(6); // a schedule name for closing probability - OccupantVentilationControl(i).ClosingProbSchNum = GetScheduleIndex(m_state, OccupantVentilationControl(i).ClosingProbSchName); - if (OccupantVentilationControl(i).OpeningProbSchNum == 0) { + OccupantVentilationControl(i).closingProbSched = Sched::GetSchedule(m_state, OccupantVentilationControl(i).ClosingProbSchName); + if (OccupantVentilationControl(i).closingProbSched == nullptr) { ShowSevereError(m_state, format(RoutineName) + CurrentModuleObject + " object, " + cAlphaFields(6) + " not found = " + OccupantVentilationControl(i).ClosingProbSchName); @@ -2301,12 +2299,15 @@ namespace AirflowNetwork { lAlphaBlanks, cAlphaFields, cNumericFields); + + ErrorObjectHeader eoh{RoutineName, CurrentModuleObject, Alphas(1)}; + MultizoneZoneData(i).ZoneName = Alphas(1); // Name of Associated EnergyPlus Thermal Zone if (!lAlphaBlanks(2)) MultizoneZoneData(i).VentControl = Alphas(2); // Ventilation Control Mode: "Temperature", "Enthalpy", // "ASHRAE55ADAPTIVE", "CEN15251AdaptiveComfort, // "Constant", or "NoVent" - MultizoneZoneData(i).VentSchName = Alphas(3); // Name of ventilation temperature control schedule - MultizoneZoneData(i).OpenFactor = Numbers(1); // Limit Value on Multiplier for Modulating Venting Open Factor, + MultizoneZoneData(i).VentTempControlSchName = Alphas(3); // Name of ventilation temperature control schedule + MultizoneZoneData(i).OpenFactor = Numbers(1); // Limit Value on Multiplier for Modulating Venting Open Factor, // Not applicable if Vent Control Mode = CONSTANT or NOVENT MultizoneZoneData(i).LowValueTemp = Numbers(2); // Lower Value on Inside/Outside Temperature Difference // for Modulating the Venting Open Factor with temp control @@ -2342,19 +2343,15 @@ namespace AirflowNetwork { if (MultizoneZoneData(i).VentCtrNum < NumOfVentCtrTypes) { if (NumAlphas >= 4 && (!lAlphaBlanks(4))) { - MultizoneZoneData(i).VentingSchName = Alphas(4); - MultizoneZoneData(i).VentingSchNum = GetScheduleIndex(m_state, MultizoneZoneData(i).VentingSchName); - if (MultizoneZoneData(i).VentingSchNum == 0) { - ShowSevereError(m_state, - format(RoutineName) + CurrentModuleObject + " object, " + cAlphaFields(4) + - " not found = " + MultizoneZoneData(i).VentingSchName); - ShowContinueError(m_state, "..for specified " + cAlphaFields(1) + " = " + Alphas(1)); + MultizoneZoneData(i).VentAvailSchName = Alphas(4); + if ((MultizoneZoneData(i).ventAvailSched = Sched::GetSchedule(m_state, MultizoneZoneData(i).VentAvailSchName)) == nullptr) { + ShowSevereItemNotFound(m_state, eoh, cAlphaFields(4), Alphas(4)); ErrorsFound = true; } } } else { - MultizoneZoneData(i).VentingSchName = std::string(); - MultizoneZoneData(i).VentingSchNum = 0; + MultizoneZoneData(i).VentAvailSchName = std::string(); + MultizoneZoneData(i).ventAvailSched = Sched::GetScheduleAlwaysOn(m_state); } } } else { @@ -2368,10 +2365,11 @@ namespace AirflowNetwork { // ==> Zone data validation for (int i = 1; i <= AirflowNetworkNumOfZones; ++i) { // Zone name validation + ErrorObjectHeader eoh{RoutineName, CurrentModuleObject, MultizoneZoneData(i).ZoneName}; + MultizoneZoneData(i).ZoneNum = Util::FindItemInList(MultizoneZoneData(i).ZoneName, Zone); if (MultizoneZoneData(i).ZoneNum == 0) { - ShowSevereError(m_state, format(RoutineName) + CurrentModuleObject + " object, invalid " + cAlphaFields(1) + " given."); - ShowContinueError(m_state, "..invalid " + cAlphaFields(1) + " = \"" + MultizoneZoneData(i).ZoneName + "\""); + ShowSevereItemNotFound(m_state, eoh, "Zone Name", MultizoneZoneData(i).ZoneName); ErrorsFound = true; } else { AirflowNetworkZoneFlag(MultizoneZoneData(i).ZoneNum) = true; @@ -2385,41 +2383,25 @@ namespace AirflowNetwork { ShowContinueError(m_state, ".. in " + cAlphaFields(1) + " = \"" + MultizoneZoneData(i).ZoneName + "\""); ErrorsFound = true; } - if (Util::SameString(MultizoneZoneData(i).VentControl, "Temperature") || Util::SameString(MultizoneZoneData(i).VentControl, "Enthalpy")) { + + if (Util::SameString(MultizoneZoneData(i).VentControl, "Temperature") || + Util::SameString(MultizoneZoneData(i).VentControl, "Enthalpy")) { // Already converted this to an enum, why compare strings? // .or. & // Util::SameString(MultizoneZoneData(i)%VentControl,'ASHRAE55Adaptive') .or. & // Util::SameString(MultizoneZoneData(i)%VentControl,'CEN15251Adaptive')) then - MultizoneZoneData(i).VentSchNum = GetScheduleIndex(m_state, MultizoneZoneData(i).VentSchName); - if (MultizoneZoneData(i).VentSchName == std::string()) { - ShowSevereError(m_state, - format(RoutineName) + CurrentModuleObject + " object, No " + cAlphaFields(3) + - " was found, but is required when " + cAlphaFields(2) + " is Temperature or Enthalpy."); - ShowContinueError(m_state, - "..for " + cAlphaFields(1) + " = \"" + MultizoneZoneData(i).ZoneName + "\", with " + cAlphaFields(2) + " = \"" + - MultizoneZoneData(i).VentControl + "\""); + if (MultizoneZoneData(i).VentTempControlSchName.empty()) { + ShowSevereEmptyField(m_state, eoh, cAlphaFields(3), cAlphaFields(2), Alphas(2)); ErrorsFound = true; - } else if (MultizoneZoneData(i).VentSchNum == 0) { - ShowSevereError(m_state, - format(RoutineName) + CurrentModuleObject + " object, invalid " + cAlphaFields(3) + ", required when " + - cAlphaFields(2) + " is Temperature or Enthalpy."); - ShowContinueError(m_state, ".." + cAlphaFields(3) + " in error = " + MultizoneZoneData(i).VentSchName); - ShowContinueError(m_state, - "..for " + cAlphaFields(1) + " = \"" + MultizoneZoneData(i).ZoneName + "\", with " + cAlphaFields(2) + " = \"" + - MultizoneZoneData(i).VentControl + "\""); + } else if ((MultizoneZoneData(i).ventTempControlSched = Sched::GetSchedule(m_state, MultizoneZoneData(i).VentTempControlSchName)) == + nullptr) { + ShowSevereItemNotFound(m_state, eoh, cAlphaFields(3), Alphas(3)); ErrorsFound = true; } } else { - MultizoneZoneData(i).VentSchNum = GetScheduleIndex(m_state, MultizoneZoneData(i).VentSchName); - if (MultizoneZoneData(i).VentSchNum > 0) { - ShowWarningError(m_state, - format(RoutineName) + CurrentModuleObject + " object, " + cAlphaFields(3) + " not required, when " + - cAlphaFields(2) + " is neither Temperature nor Enthalpy."); - ShowContinueError(m_state, ".." + cAlphaFields(3) + " specified = " + MultizoneZoneData(i).VentSchName); - ShowContinueError(m_state, - "..for " + cAlphaFields(1) + " = \"" + MultizoneZoneData(i).ZoneName + "\", with " + cAlphaFields(2) + " = \"" + - MultizoneZoneData(i).VentControl + "\""); - MultizoneZoneData(i).VentSchNum = 0; - MultizoneZoneData(i).VentSchName = std::string(); + MultizoneZoneData(i).ventTempControlSched = nullptr; + if (!MultizoneZoneData(i).VentTempControlSchName.empty()) { + ShowWarningNonEmptyField(m_state, eoh, cAlphaFields(3), cAlphaFields(2), Alphas(2)); + MultizoneZoneData(i).VentTempControlSchName = std::string(); } } if (MultizoneZoneData(i).OpenFactor > 1.0 || MultizoneZoneData(i).OpenFactor < 0.0) { @@ -2696,7 +2678,7 @@ namespace AirflowNetwork { // or "ADJACENTENTHALPY" if (!lAlphaBlanks(4)) MultizoneSurfaceData(i).VentControl = Alphas(4); // Name of ventilation temperature control schedule - if (!lAlphaBlanks(5)) MultizoneSurfaceData(i).VentSchName = Alphas(5); + if (!lAlphaBlanks(5)) MultizoneSurfaceData(i).VentTempControlSchName = Alphas(5); { // This SELECT_CASE_var will go on input refactor, no need to fix auto const SELECT_CASE_var(Util::makeUPPER(MultizoneSurfaceData(i).VentControl)); @@ -2747,7 +2729,7 @@ namespace AirflowNetwork { if (MultizoneSurfaceData(i).VentSurfCtrNum < 4 || MultizoneSurfaceData(i).VentSurfCtrNum == VentControlType::AdjTemp || MultizoneSurfaceData(i).VentSurfCtrNum == VentControlType::AdjEnth) { if (!lAlphaBlanks(6)) { - MultizoneSurfaceData(i).VentingSchName = Alphas(6); // Name of ventilation availability schedule + MultizoneSurfaceData(i).VentAvailSchName = Alphas(6); // Name of ventilation availability schedule } } if (!lAlphaBlanks(7)) { @@ -3190,7 +3172,10 @@ namespace AirflowNetwork { CurrentModuleObject = "AirflowNetwork:MultiZone:Surface"; for (int i = 1; i <= AirflowNetworkNumOfSurfaces; ++i) { if (MultizoneSurfaceData(i).SurfNum == 0) continue; - bool has_Opening{false}; + bool has_Opening{false}; // Why use array constructor? + + ErrorObjectHeader eoh{RoutineName, CurrentModuleObject, MultizoneSurfaceData(i).SurfName}; + // This is terrible, should not do it this way auto afe = elements.find(MultizoneSurfaceData(i).OpeningName); if (afe != elements.end()) { @@ -3215,42 +3200,29 @@ namespace AirflowNetwork { MultizoneSurfaceData(i).VentSurfCtrNum = VentControlType::Const; MultizoneSurfaceData(i).IndVentControl = true; } - if (!MultizoneSurfaceData(i).VentingSchName.empty()) { - MultizoneSurfaceData(i).VentingSchNum = GetScheduleIndex(m_state, MultizoneSurfaceData(i).VentingSchName); - if (MultizoneSurfaceData(i).VentingSchNum == 0) { - ShowSevereError( - m_state, format(RoutineName) + CurrentModuleObject + "=\"" + MultizoneSurfaceData(i).SurfName + "\", invalid schedule."); - ShowContinueError(m_state, "Venting Schedule not found=\"" + MultizoneSurfaceData(i).VentingSchName + "\"."); - ErrorsFound = true; - } else if (m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).IsAirBoundarySurf) { - ShowWarningError(m_state, - format(RoutineName) + CurrentModuleObject + "=\"" + MultizoneSurfaceData(i).SurfName + - "\" is an air boundary surface."); - ShowContinueError(m_state, "Venting Availability Schedule will be ignored, venting is always available."); - MultizoneSurfaceData(i).VentingSchName = ""; - MultizoneSurfaceData(i).VentingSchNum = 0; - } - } else { - MultizoneSurfaceData(i).VentingSchName = ""; - MultizoneSurfaceData(i).VentingSchNum = 0; + + if (MultizoneSurfaceData(i).VentAvailSchName.empty()) { + MultizoneSurfaceData(i).ventAvailSched = Sched::GetScheduleAlwaysOn(m_state); + } else if ((MultizoneSurfaceData(i).ventAvailSched = Sched::GetSchedule(m_state, MultizoneSurfaceData(i).VentAvailSchName)) == + nullptr) { + ShowSevereItemNotFound(m_state, eoh, "Venting Schedule", MultizoneSurfaceData(i).VentAvailSchName); + ErrorsFound = true; + } else if (m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).IsAirBoundarySurf) { + ShowWarningNonEmptyField(m_state, eoh, "Venting Availbility Schedule"); + ShowContinueError(m_state, "Venting is always available for air-boundary surfaces."); + MultizoneSurfaceData(i).ventAvailSched = Sched::GetScheduleAlwaysOn(m_state); + MultizoneSurfaceData(i).VentAvailSchName = ""; } + switch (MultizoneSurfaceData(i).VentSurfCtrNum) { case VentControlType::Temp: case VentControlType::AdjTemp: { - MultizoneSurfaceData(i).VentSchNum = GetScheduleIndex(m_state, MultizoneSurfaceData(i).VentSchName); - if (MultizoneSurfaceData(i).VentSchName == std::string()) { - ShowSevereError(m_state, - format(RoutineName) + CurrentModuleObject + - " object, No Ventilation Schedule was found, but is required when ventilation control is " - "Temperature."); - ShowContinueError(m_state, "..for Surface = \"" + MultizoneSurfaceData(i).SurfName + "\""); + if (MultizoneSurfaceData(i).VentTempControlSchName.empty()) { + ShowSevereEmptyField(m_state, eoh, "Ventilation Schedule", "Ventinlation Control", "Temperature"); ErrorsFound = true; - } else if (MultizoneSurfaceData(i).VentSchNum == 0) { - ShowSevereError(m_state, - format(RoutineName) + CurrentModuleObject + - " object, Invalid Ventilation Schedule, required when ventilation control is Temperature."); - ShowContinueError(m_state, "..Schedule name in error = " + MultizoneSurfaceData(i).VentSchName); - ShowContinueError(m_state, "..for Surface = \"" + MultizoneSurfaceData(i).SurfName + "\""); + } else if ((MultizoneSurfaceData(i).ventTempControlSched = + Sched::GetSchedule(m_state, MultizoneSurfaceData(i).VentTempControlSchName)) == nullptr) { + ShowSevereItemNotFound(m_state, eoh, "Ventilation Schedule", MultizoneSurfaceData(i).VentTempControlSchName); ErrorsFound = true; } if (MultizoneSurfaceData(i).LowValueTemp < 0.0) { @@ -3276,21 +3248,15 @@ namespace AirflowNetwork { } } break; + case VentControlType::Enth: case VentControlType::AdjEnth: { - MultizoneSurfaceData(i).VentSchNum = GetScheduleIndex(m_state, MultizoneSurfaceData(i).VentSchName); - if (MultizoneSurfaceData(i).VentSchName == std::string()) { - ShowSevereError(m_state, - format(RoutineName) + CurrentModuleObject + - " object, No Ventilation Schedule was found, but is required when ventilation control is Enthalpy."); - ShowContinueError(m_state, "..for Surface = \"" + MultizoneSurfaceData(i).SurfName + "\""); + if (MultizoneSurfaceData(i).VentTempControlSchName.empty()) { + ShowSevereEmptyField(m_state, eoh, "Ventilation Schedule", "Ventilation Control", "Enthalpy"); ErrorsFound = true; - } else if (MultizoneSurfaceData(i).VentSchNum == 0) { - ShowSevereError(m_state, - format(RoutineName) + CurrentModuleObject + - " object, Invalid Ventilation Schedule, required when ventilation control is Enthalpy."); - ShowContinueError(m_state, "..Schedule name in error = " + MultizoneSurfaceData(i).VentSchName); - ShowContinueError(m_state, "..for Surface = \"" + MultizoneSurfaceData(i).SurfName + "\""); + } else if ((MultizoneSurfaceData(i).ventTempControlSched = + Sched::GetSchedule(m_state, MultizoneSurfaceData(i).VentTempControlSchName)) == nullptr) { + ShowSevereItemNotFound(m_state, eoh, "Ventilation Schedule", MultizoneSurfaceData(i).VentTempControlSchName); ErrorsFound = true; } if (MultizoneSurfaceData(i).LowValueEnth < 0.0) { @@ -3322,8 +3288,8 @@ namespace AirflowNetwork { case VentControlType::CEN15251: case VentControlType::NoVent: case VentControlType::ZoneLevel: { - MultizoneSurfaceData(i).VentSchNum = 0; - MultizoneSurfaceData(i).VentSchName = ""; + MultizoneSurfaceData(i).ventTempControlSched = nullptr; + MultizoneSurfaceData(i).VentTempControlSchName = ""; } break; default: break; @@ -4076,6 +4042,9 @@ namespace AirflowNetwork { lAlphaBlanks, cAlphaFields, cNumericFields); + + ErrorObjectHeader eoh{RoutineName, CurrentModuleObject, Alphas(1)}; + PressureControllerData(i).Name = Alphas(1); // Object Name PressureControllerData(i).ZoneName = Alphas(2); // Zone name PressureControllerData(i).ZoneNum = Util::FindItemInList(Alphas(2), Zone); @@ -4138,21 +4107,14 @@ namespace AirflowNetwork { } if (lAlphaBlanks(5)) { - PressureControllerData(i).AvailSchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - PressureControllerData(i).AvailSchedPtr = GetScheduleIndex(m_state, Alphas(5)); - if (PressureControllerData(i).AvailSchedPtr == 0) { - ShowSevereError(m_state, - CurrentModuleObject + ", \"" + PressureControllerData(i).Name + "\" " + cAlphaFields(5) + - " not found: " + Alphas(5)); - ErrorsFound = true; - } + PressureControllerData(i).availSched = Sched::GetScheduleAlwaysOn(m_state); + } else if ((PressureControllerData(i).availSched = Sched::GetSchedule(m_state, Alphas(5))) == nullptr) { + ShowSevereItemNotFound(m_state, eoh, cAlphaFields(5), Alphas(5)); + ErrorsFound = true; } - PressureControllerData(i).PresSetpointSchedPtr = GetScheduleIndex(m_state, Alphas(6)); - if (PressureControllerData(i).PresSetpointSchedPtr == 0) { - ShowSevereError(m_state, - CurrentModuleObject + ", \"" + PressureControllerData(i).Name + "\" " + cAlphaFields(6) + - " not found: " + Alphas(6)); + + if ((PressureControllerData(i).presSetpointSched = Sched::GetSchedule(m_state, Alphas(6))) == nullptr) { + ShowSevereItemNotFound(m_state, eoh, cAlphaFields(6), Alphas(6)); ErrorsFound = true; } } @@ -6501,15 +6463,13 @@ namespace AirflowNetwork { PressureSetFlag = 0; if (NumOfPressureControllers == 1) { - if (PressureControllerData(1).AvailSchedPtr == ScheduleManager::ScheduleAlwaysOn) { + if (PressureControllerData(1).availSched == nullptr) { + PressureSetFlag = PressureControllerData(1).ControlTypeSet; + } else if (PressureControllerData(1).availSched->getCurrentVal() > 0.0) { PressureSetFlag = PressureControllerData(1).ControlTypeSet; - } else { - if (GetCurrentScheduleValue(m_state, PressureControllerData(1).AvailSchedPtr) > 0.0) { - PressureSetFlag = PressureControllerData(1).ControlTypeSet; - } } if (PressureSetFlag > 0) { - PressureSet = GetCurrentScheduleValue(m_state, PressureControllerData(1).PresSetpointSchedPtr); + PressureSet = PressureControllerData(1).presSetpointSched->getCurrentVal(); } } @@ -6939,7 +6899,7 @@ namespace AirflowNetwork { // Wind-pressure coefficients for vertical facades, low-rise building if (Util::SameString(simulation_control.BldgType, "LowRise") && FacadeNum <= 4) { - IncRad = IncAng * Constant::DegToRadians; + IncRad = IncAng * Constant::DegToRad; Real64 const cos_IncRad_over_2(std::cos(IncRad / 2.0)); vals[windDirNum - 1] = 0.6 * std::log(1.248 - 0.703 * std::sin(IncRad / 2.0) - 1.175 * pow_2(std::sin(IncRad)) + 0.131 * pow_3(std::sin(2.0 * IncRad * SideRatioFac)) + 0.769 * cos_IncRad_over_2 + @@ -7015,7 +6975,7 @@ namespace AirflowNetwork { DelAng = mod(IncAng, 10.0); WtAng = 1.0 - DelAng / 10.0; // Wind-pressure coefficients for vertical facades, low-rise building - IncRad = IncAng * Constant::DegToRadians; + IncRad = IncAng * Constant::DegToRad; valsByFacade[FacadeNum - 1][windDirNum - 1] = 0.6 * std::log(1.248 - 0.703 * std::sin(IncRad / 2.0) - 1.175 * pow_2(std::sin(IncRad)) + 0.131 * pow_3(std::sin(2.0 * IncRad * SideRatioFac)) + 0.769 * std::cos(IncRad / 2.0) + @@ -7212,7 +7172,7 @@ namespace AirflowNetwork { Real64 Pr = properties.prandtl_number(Pamb, (Ts + Tamb) / 2, Wamb); Real64 KinVisc = properties.kinematic_viscosity(Pamb, (Ts + Tamb) / 2, Wamb); Real64 Beta = 2.0 / ((Tamb + Constant::Kelvin) + (Ts + Constant::Kelvin)); - Real64 Gr = Constant::GravityConstant * Beta * std::abs(Ts - Tamb) * pow_3(Dh) / pow_2(KinVisc); + Real64 Gr = Constant::Gravity * Beta * std::abs(Ts - Tamb) * pow_3(Dh) / pow_2(KinVisc); Real64 Ra = Gr * Pr; Real64 Nu_free(0); @@ -7505,7 +7465,7 @@ namespace AirflowNetwork { int SurfNum = VFObj.LinkageSurfaceData(j).SurfaceNum; Real64 ZoneSurfaceArea = m_state.dataSurface->Surface(SurfNum).Area; m_state.dataHeatBalFanSys->QRadSurfAFNDuct(SurfNum) += VFObj.LinkageSurfaceData(j).SurfaceRadLoad * TimeStepSys * - Constant::SecInHour / + Constant::rSecsInHour / ZoneSurfaceArea; // Energy to each surface per unit area [J/m2] VFObj.QRad += VFObj.LinkageSurfaceData(j).SurfaceRadLoad; // Total radiant load from all surfaces for this system timestep [W] } @@ -8574,7 +8534,7 @@ namespace AirflowNetwork { onceSurfFlag.dimension(AirflowNetworkNumOfLinks, false); onetime = true; } - ReportingConstant = TimeStepSys * Constant::SecInHour; + ReportingConstant = TimeStepSys * Constant::rSecsInHour; m_state.dataHeatBal->ZoneTotalExfiltrationHeatLoss = 0.0; @@ -9876,9 +9836,6 @@ namespace AirflowNetwork { // Determines the venting opening factor for an exterior or interior window or door // as determined by the venting control method. - // Using/Aliasing - using ScheduleManager::GetCurrentScheduleValue; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 VentTemp; // Venting temperature (C) Real64 ZoneAirEnthalpy; // Enthalpy of zone air (J/kg) @@ -9927,10 +9884,10 @@ namespace AirflowNetwork { // Note in the following that individual venting control for a window/door takes // precedence over zone-level control if (MultizoneSurfaceData(i).IndVentControl) { - VentTemp = GetCurrentScheduleValue(m_state, MultizoneSurfaceData(i).VentSchNum); + VentTemp = MultizoneSurfaceData(i).ventTempControlSched ? MultizoneSurfaceData(i).ventTempControlSched->getCurrentVal() : 0.0; VentCtrlNum = MultizoneSurfaceData(i).VentSurfCtrNum; - if (MultizoneSurfaceData(i).VentingSchNum > 0) { - VentingSchVal = GetCurrentScheduleValue(m_state, MultizoneSurfaceData(i).VentingSchNum); + if (MultizoneSurfaceData(i).ventAvailSched != nullptr) { + VentingSchVal = MultizoneSurfaceData(i).ventAvailSched->getCurrentVal(); if (VentingSchVal <= 0.0) { VentingAllowed = false; m_state.dataSurface->SurfWinVentingAvailabilityRep(SurfNum) = 0.0; @@ -9938,10 +9895,10 @@ namespace AirflowNetwork { } } else { // Zone level only by Gu on Nov. 8, 2005 - VentTemp = GetCurrentScheduleValue(m_state, MultizoneZoneData(IZ).VentSchNum); + VentTemp = MultizoneZoneData(IZ).ventTempControlSched ? MultizoneZoneData(IZ).ventTempControlSched->getCurrentVal() : 0.0; VentCtrlNum = MultizoneZoneData(IZ).VentCtrNum; - if (MultizoneZoneData(IZ).VentingSchNum > 0) { - VentingSchVal = GetCurrentScheduleValue(m_state, MultizoneZoneData(IZ).VentingSchNum); + if (MultizoneZoneData(IZ).ventAvailSched != nullptr) { + VentingSchVal = MultizoneZoneData(IZ).ventAvailSched->getCurrentVal(); if (VentingSchVal <= 0.0) { VentingAllowed = false; m_state.dataSurface->SurfWinVentingAvailabilityRep(SurfNum) = 0.0; @@ -10521,17 +10478,15 @@ namespace AirflowNetwork { } else { // Replace the convenience function with in-place code std::string mycoil = DisSysCompCoilData(i).name; - auto it = std::find_if(m_state.dataCoilCooingDX->coilCoolingDXs.begin(), - m_state.dataCoilCooingDX->coilCoolingDXs.end(), + auto it = std::find_if(m_state.dataCoilCoolingDX->coilCoolingDXs.begin(), + m_state.dataCoilCoolingDX->coilCoolingDXs.end(), [&mycoil](const CoilCoolingDX &coil) { return coil.name == mycoil; }); - if (it != m_state.dataCoilCooingDX->coilCoolingDXs.end()) { + if (it != m_state.dataCoilCoolingDX->coilCoolingDXs.end()) { // Set the airloop number on the CoilCoolingDX object, which is used to collect the runtime fraction it->airLoopNum = DisSysCompCoilData(i).AirLoopNum; } else { ShowSevereError(m_state, "SetDXCoilAirLoopNumber: Could not find Coil \"Name=\"" + DisSysCompCoilData(i).name + "\""); } - // SetDXCoilAirLoopNumber(DisSysCompCoilData(i).name, - // DisSysCompCoilData(i).AirLoopNum); } } else if (SELECT_CASE_var == "COIL:COOLING:DX:SINGLESPEED") { ValidateComponent( @@ -10622,6 +10577,26 @@ namespace AirflowNetwork { SetDXCoilAirLoopNumber(m_state, DisSysCompCoilData(i).name, DisSysCompCoilData(i).AirLoopNum); } + } else if (SELECT_CASE_var == "COIL:COOLING:DX:VARIABLESPEED") { + ValidateComponent( + m_state, "Coil:Cooling:DX:VariableSpeed", DisSysCompCoilData(i).name, IsNotOK, format(RoutineName) + CurrentModuleObject); + ++MultiSpeedHPIndicator; + if (IsNotOK) { + ErrorsFound = true; + } else { + SetDXCoilAirLoopNumber(m_state, DisSysCompCoilData(i).name, DisSysCompCoilData(i).AirLoopNum); + } + + } else if (SELECT_CASE_var == "COIL:HEATING:DX:VARIABLESPEED") { + ValidateComponent( + m_state, "Coil:Heating:DX:VariableSpeed", DisSysCompCoilData(i).name, IsNotOK, format(RoutineName) + CurrentModuleObject); + ++MultiSpeedHPIndicator; + if (IsNotOK) { + ErrorsFound = true; + } else { + SetDXCoilAirLoopNumber(m_state, DisSysCompCoilData(i).name, DisSysCompCoilData(i).AirLoopNum); + } + } else if (SELECT_CASE_var == "COIL:HEATING:DESUPERHEATER") { ValidateComponent( m_state, "Coil:Heating:Desuperheater", DisSysCompCoilData(i).name, IsNotOK, format(RoutineName) + CurrentModuleObject); @@ -11284,8 +11259,8 @@ namespace AirflowNetwork { auto &hybridVentMgr = m_state.dataAvail->HybridVentData(SysAvailNum); int AirLoopNum = hybridVentMgr.AirLoopNum; ventCtrlStatus = hybridVentMgr.ctrlStatus; - if (hybridVentMgr.ANCtrlStatus > 0) { - ControlType = static_cast(GetCurrentScheduleValue(m_state, hybridVentMgr.ANCtrlStatus)); + if (hybridVentMgr.afnControlTypeSched != nullptr) { + ControlType = static_cast(hybridVentMgr.afnControlTypeSched->getCurrentVal()); } bool Found = false; // Logical to indicate whether a master surface is found or not int ActualZoneNum = 0; @@ -11723,7 +11698,7 @@ namespace AirflowNetwork { Real64 CpAir = PsyCpAirFnW(thisZoneHB.airHumRat); Real64 RhoAir = PsyRhoAirFnPbTdbW(m_state, m_state.dataEnvrn->OutBaroPress, thisZoneHB.MAT, thisZoneHB.airHumRat); - Real64 InfilVolume = ((exchangeData(ZoneNum).SumMCp + exchangeData(ZoneNum).SumMVCp) / CpAir / RhoAir) * TimeStepSys * Constant::SecInHour; + Real64 InfilVolume = ((exchangeData(ZoneNum).SumMCp + exchangeData(ZoneNum).SumMVCp) / CpAir / RhoAir) * TimeStepSys * Constant::rSecsInHour; Real64 ACH = InfilVolume / (TimeStepSys * m_state.dataHeatBal->Zone(ZoneNum).Volume); return ACH; @@ -12851,6 +12826,7 @@ namespace AirflowNetwork { Real64 SchValue; Real64 RandomValue; auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); + auto &zoneTstatSetpt = state.dataHeatBalFanSys->zoneTstatSetpts(ZoneNum); if (TimeCloseDuration < MinClosingTime) { return false; @@ -12862,32 +12838,35 @@ namespace AirflowNetwork { } switch (state.dataHeatBalFanSys->TempControlType(ZoneNum)) { - case HVAC::ThermostatType::SingleHeating: - if (thisZoneHB.MAT <= state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ZoneNum)) { + case HVAC::SetptType::SingleHeat: { + if (thisZoneHB.MAT <= zoneTstatSetpt.setptLo) { return false; } - break; - case HVAC::ThermostatType::SingleCooling: - if (thisZoneHB.MAT >= state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ZoneNum)) { + } break; + + case HVAC::SetptType::SingleCool: { + if (thisZoneHB.MAT >= zoneTstatSetpt.setptHi) { return false; } - break; - case HVAC::ThermostatType::SingleHeatCool: + } break; + case HVAC::SetptType::SingleHeatCool: { return false; - case HVAC::ThermostatType::DualSetPointWithDeadBand: - if (thisZoneHB.MAT < state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ZoneNum) || - thisZoneHB.MAT > state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ZoneNum)) { + } break; + + case HVAC::SetptType::DualHeatCool: { + if (thisZoneHB.MAT < zoneTstatSetpt.setptLo || thisZoneHB.MAT > zoneTstatSetpt.setptHi) { return false; } - break; - default: - break; - } + } break; - if (OpeningProbSchNum == 0) { + default: { + } break; + } // switch + + if (openingProbSched == nullptr) { return true; } else { - SchValue = GetCurrentScheduleValue(state, OpeningProbSchNum); + SchValue = openingProbSched->getCurrentVal(); RandomValue = Real64(rand()) / RAND_MAX; if (SchValue > RandomValue) { return true; @@ -12906,10 +12885,10 @@ namespace AirflowNetwork { if (TimeOpenDuration < MinOpeningTime) { return false; } - if (ClosingProbSchNum == 0) { + if (closingProbSched == nullptr) { return true; } else { - SchValue = GetCurrentScheduleValue(state, ClosingProbSchNum); + SchValue = closingProbSched->getCurrentVal(); RandomValue = Real64(rand()) / RAND_MAX; if (SchValue > RandomValue) { return true; @@ -13401,7 +13380,7 @@ namespace AirflowNetwork { // na auto &NetworkNumOfNodes = ActualNumOfNodes; - auto &NetworkNumOfLinks = ActualNumOfLinks; + // auto &NetworkNumOfLinks = ActualNumOfLinks; // Argument array dimensioning (these used to be arguments, need to also test newAU and newIK) EP_SIZE_CHECK(IK, NetworkNumOfNodes + 1); diff --git a/src/EnergyPlus/Autosizing/All_Simple_Sizing.cc b/src/EnergyPlus/Autosizing/All_Simple_Sizing.cc index e27eec1fc9a..dc788ade567 100644 --- a/src/EnergyPlus/Autosizing/All_Simple_Sizing.cc +++ b/src/EnergyPlus/Autosizing/All_Simple_Sizing.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/All_Simple_Sizing.hh b/src/EnergyPlus/Autosizing/All_Simple_Sizing.hh index 8a692f422ba..7af234be572 100644 --- a/src/EnergyPlus/Autosizing/All_Simple_Sizing.hh +++ b/src/EnergyPlus/Autosizing/All_Simple_Sizing.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/Base.cc b/src/EnergyPlus/Autosizing/Base.cc index b7ff8a4ba59..6fa956ffe0c 100644 --- a/src/EnergyPlus/Autosizing/Base.cc +++ b/src/EnergyPlus/Autosizing/Base.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/Base.hh b/src/EnergyPlus/Autosizing/Base.hh index 3a34674d3e5..969d4945ee0 100644 --- a/src/EnergyPlus/Autosizing/Base.hh +++ b/src/EnergyPlus/Autosizing/Base.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/BaseSizerWithFanHeatInputs.cc b/src/EnergyPlus/Autosizing/BaseSizerWithFanHeatInputs.cc index 397f14b3d8a..f8a36a5ed1d 100644 --- a/src/EnergyPlus/Autosizing/BaseSizerWithFanHeatInputs.cc +++ b/src/EnergyPlus/Autosizing/BaseSizerWithFanHeatInputs.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/BaseSizerWithFanHeatInputs.hh b/src/EnergyPlus/Autosizing/BaseSizerWithFanHeatInputs.hh index 0d5ba3bebe7..46adbfc30ea 100644 --- a/src/EnergyPlus/Autosizing/BaseSizerWithFanHeatInputs.hh +++ b/src/EnergyPlus/Autosizing/BaseSizerWithFanHeatInputs.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -106,6 +106,10 @@ struct BaseSizerWithFanHeatInputs : BaseSizer struct BaseSizerWithFanHeatInputsData : BaseGlobalStruct { + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/Autosizing/BaseSizerWithScalableInputs.cc b/src/EnergyPlus/Autosizing/BaseSizerWithScalableInputs.cc index 219b1b6f6c0..aafda6804f5 100644 --- a/src/EnergyPlus/Autosizing/BaseSizerWithScalableInputs.cc +++ b/src/EnergyPlus/Autosizing/BaseSizerWithScalableInputs.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/BaseSizerWithScalableInputs.hh b/src/EnergyPlus/Autosizing/BaseSizerWithScalableInputs.hh index 60f04c8bb3a..4b9a4a4425e 100644 --- a/src/EnergyPlus/Autosizing/BaseSizerWithScalableInputs.hh +++ b/src/EnergyPlus/Autosizing/BaseSizerWithScalableInputs.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -136,6 +136,10 @@ struct BaseSizerWithScalableInputs : BaseSizerWithFanHeatInputs struct BaseSizerWithScalableInputsData : BaseGlobalStruct { + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/Autosizing/CoolingAirFlowSizing.cc b/src/EnergyPlus/Autosizing/CoolingAirFlowSizing.cc index 411a4cc5b87..fc9b825def6 100644 --- a/src/EnergyPlus/Autosizing/CoolingAirFlowSizing.cc +++ b/src/EnergyPlus/Autosizing/CoolingAirFlowSizing.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/CoolingAirFlowSizing.hh b/src/EnergyPlus/Autosizing/CoolingAirFlowSizing.hh index cc76cfd0ff0..f48d92f815a 100644 --- a/src/EnergyPlus/Autosizing/CoolingAirFlowSizing.hh +++ b/src/EnergyPlus/Autosizing/CoolingAirFlowSizing.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/CoolingCapacitySizing.cc b/src/EnergyPlus/Autosizing/CoolingCapacitySizing.cc index 3ecfd022a13..e1adfb828b5 100644 --- a/src/EnergyPlus/Autosizing/CoolingCapacitySizing.cc +++ b/src/EnergyPlus/Autosizing/CoolingCapacitySizing.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/CoolingCapacitySizing.hh b/src/EnergyPlus/Autosizing/CoolingCapacitySizing.hh index d079ec57f9f..88db8b05f4c 100644 --- a/src/EnergyPlus/Autosizing/CoolingCapacitySizing.hh +++ b/src/EnergyPlus/Autosizing/CoolingCapacitySizing.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/CoolingSHRSizing.cc b/src/EnergyPlus/Autosizing/CoolingSHRSizing.cc index 5a73c416625..393940ed423 100644 --- a/src/EnergyPlus/Autosizing/CoolingSHRSizing.cc +++ b/src/EnergyPlus/Autosizing/CoolingSHRSizing.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/CoolingSHRSizing.hh b/src/EnergyPlus/Autosizing/CoolingSHRSizing.hh index ffc392c8280..d40042e3d2d 100644 --- a/src/EnergyPlus/Autosizing/CoolingSHRSizing.hh +++ b/src/EnergyPlus/Autosizing/CoolingSHRSizing.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/CoolingWaterDesAirInletHumRatSizing.cc b/src/EnergyPlus/Autosizing/CoolingWaterDesAirInletHumRatSizing.cc index dc5c5f5768e..b91823fae1e 100644 --- a/src/EnergyPlus/Autosizing/CoolingWaterDesAirInletHumRatSizing.cc +++ b/src/EnergyPlus/Autosizing/CoolingWaterDesAirInletHumRatSizing.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/CoolingWaterDesAirInletHumRatSizing.hh b/src/EnergyPlus/Autosizing/CoolingWaterDesAirInletHumRatSizing.hh index 8cdf1516642..ad62b5b70af 100644 --- a/src/EnergyPlus/Autosizing/CoolingWaterDesAirInletHumRatSizing.hh +++ b/src/EnergyPlus/Autosizing/CoolingWaterDesAirInletHumRatSizing.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/CoolingWaterDesAirInletTempSizing.cc b/src/EnergyPlus/Autosizing/CoolingWaterDesAirInletTempSizing.cc index b8a4e4b0e75..88b324b5064 100644 --- a/src/EnergyPlus/Autosizing/CoolingWaterDesAirInletTempSizing.cc +++ b/src/EnergyPlus/Autosizing/CoolingWaterDesAirInletTempSizing.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/CoolingWaterDesAirInletTempSizing.hh b/src/EnergyPlus/Autosizing/CoolingWaterDesAirInletTempSizing.hh index eac0eec8b28..f9632e1bb08 100644 --- a/src/EnergyPlus/Autosizing/CoolingWaterDesAirInletTempSizing.hh +++ b/src/EnergyPlus/Autosizing/CoolingWaterDesAirInletTempSizing.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/CoolingWaterDesAirOutletHumRatSizing.cc b/src/EnergyPlus/Autosizing/CoolingWaterDesAirOutletHumRatSizing.cc index a095e23ad4e..9ec2877b7f9 100644 --- a/src/EnergyPlus/Autosizing/CoolingWaterDesAirOutletHumRatSizing.cc +++ b/src/EnergyPlus/Autosizing/CoolingWaterDesAirOutletHumRatSizing.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/CoolingWaterDesAirOutletHumRatSizing.hh b/src/EnergyPlus/Autosizing/CoolingWaterDesAirOutletHumRatSizing.hh index 5c62a5d1c41..1edba55bbe8 100644 --- a/src/EnergyPlus/Autosizing/CoolingWaterDesAirOutletHumRatSizing.hh +++ b/src/EnergyPlus/Autosizing/CoolingWaterDesAirOutletHumRatSizing.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/CoolingWaterDesAirOutletTempSizing.cc b/src/EnergyPlus/Autosizing/CoolingWaterDesAirOutletTempSizing.cc index 5afba936626..48a74104712 100644 --- a/src/EnergyPlus/Autosizing/CoolingWaterDesAirOutletTempSizing.cc +++ b/src/EnergyPlus/Autosizing/CoolingWaterDesAirOutletTempSizing.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -66,16 +66,10 @@ Real64 CoolingWaterDesAirOutletTempSizer::size(EnergyPlusData &state, Real64 _or this->autoSizedValue = _originalValue; } else { if (this->termUnitIU) { - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidIndex, - this->callingRoutine); - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidIndex, - this->callingRoutine); + Real64 Cp = + state.dataPlnt->PlantLoop(this->dataWaterLoopNum).glycol->getSpecificHeat(state, Constant::CWInitConvTemp, this->callingRoutine); + Real64 rho = + state.dataPlnt->PlantLoop(this->dataWaterLoopNum).glycol->getDensity(state, Constant::CWInitConvTemp, this->callingRoutine); Real64 DesCoilLoad = this->dataWaterFlowUsedForSizing * this->dataWaterCoilSizCoolDeltaT * Cp * rho; Real64 T1Out = this->dataDesInletAirTemp - DesCoilLoad / (state.dataEnvrn->StdRhoAir * Psychrometrics::PsyCpAirFnW(this->dataDesInletAirHumRat) * diff --git a/src/EnergyPlus/Autosizing/CoolingWaterDesAirOutletTempSizing.hh b/src/EnergyPlus/Autosizing/CoolingWaterDesAirOutletTempSizing.hh index 1d20b924ac1..288152bbbcf 100644 --- a/src/EnergyPlus/Autosizing/CoolingWaterDesAirOutletTempSizing.hh +++ b/src/EnergyPlus/Autosizing/CoolingWaterDesAirOutletTempSizing.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/CoolingWaterDesWaterInletTempSizing.cc b/src/EnergyPlus/Autosizing/CoolingWaterDesWaterInletTempSizing.cc index 0527073ca0b..4a975f5870c 100644 --- a/src/EnergyPlus/Autosizing/CoolingWaterDesWaterInletTempSizing.cc +++ b/src/EnergyPlus/Autosizing/CoolingWaterDesWaterInletTempSizing.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/CoolingWaterDesWaterInletTempSizing.hh b/src/EnergyPlus/Autosizing/CoolingWaterDesWaterInletTempSizing.hh index f63a1cfd42a..a912a5b78ba 100644 --- a/src/EnergyPlus/Autosizing/CoolingWaterDesWaterInletTempSizing.hh +++ b/src/EnergyPlus/Autosizing/CoolingWaterDesWaterInletTempSizing.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/CoolingWaterNumofTubesPerRowSizing.cc b/src/EnergyPlus/Autosizing/CoolingWaterNumofTubesPerRowSizing.cc index 668dc22fa32..d2eec69ab76 100644 --- a/src/EnergyPlus/Autosizing/CoolingWaterNumofTubesPerRowSizing.cc +++ b/src/EnergyPlus/Autosizing/CoolingWaterNumofTubesPerRowSizing.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/CoolingWaterNumofTubesPerRowSizing.hh b/src/EnergyPlus/Autosizing/CoolingWaterNumofTubesPerRowSizing.hh index faa83168c3d..643be111590 100644 --- a/src/EnergyPlus/Autosizing/CoolingWaterNumofTubesPerRowSizing.hh +++ b/src/EnergyPlus/Autosizing/CoolingWaterNumofTubesPerRowSizing.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/CoolingWaterflowSizing.cc b/src/EnergyPlus/Autosizing/CoolingWaterflowSizing.cc index 4725b24c5d1..5bb8f63bc8b 100644 --- a/src/EnergyPlus/Autosizing/CoolingWaterflowSizing.cc +++ b/src/EnergyPlus/Autosizing/CoolingWaterflowSizing.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -88,16 +88,10 @@ Real64 CoolingWaterflowSizer::size(EnergyPlusData &state, Real64 _originalValue, if (DesCoilLoad >= HVAC::SmallLoad) { if (this->dataWaterLoopNum > 0 && this->dataWaterLoopNum <= (int)state.dataPlnt->PlantLoop.size() && this->dataWaterCoilSizCoolDeltaT > 0.0) { - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidIndex, - this->callingRoutine); - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidIndex, - this->callingRoutine); + Real64 Cp = state.dataPlnt->PlantLoop(this->dataWaterLoopNum) + .glycol->getSpecificHeat(state, Constant::CWInitConvTemp, this->callingRoutine); + Real64 rho = state.dataPlnt->PlantLoop(this->dataWaterLoopNum) + .glycol->getDensity(state, Constant::CWInitConvTemp, this->callingRoutine); this->autoSizedValue = DesCoilLoad / (CoilDesWaterDeltaT * Cp * rho); } else { this->autoSizedValue = 0.0; @@ -120,16 +114,10 @@ Real64 CoolingWaterflowSizer::size(EnergyPlusData &state, Real64 _originalValue, if (this->curOASysNum > 0) CoilDesWaterDeltaT *= 0.5; if (this->dataCapacityUsedForSizing >= HVAC::SmallLoad) { if (this->dataWaterLoopNum > 0 && this->dataWaterLoopNum <= (int)state.dataPlnt->PlantLoop.size() && CoilDesWaterDeltaT > 0.0) { - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidIndex, - this->callingRoutine); - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidIndex, - this->callingRoutine); + Real64 Cp = state.dataPlnt->PlantLoop(this->dataWaterLoopNum) + .glycol->getSpecificHeat(state, Constant::CWInitConvTemp, this->callingRoutine); + Real64 rho = state.dataPlnt->PlantLoop(this->dataWaterLoopNum) + .glycol->getDensity(state, Constant::CWInitConvTemp, this->callingRoutine); this->autoSizedValue = this->dataCapacityUsedForSizing / (CoilDesWaterDeltaT * Cp * rho); } else { this->autoSizedValue = 0.0; diff --git a/src/EnergyPlus/Autosizing/CoolingWaterflowSizing.hh b/src/EnergyPlus/Autosizing/CoolingWaterflowSizing.hh index 2432d420ad1..6cf07c9e620 100644 --- a/src/EnergyPlus/Autosizing/CoolingWaterflowSizing.hh +++ b/src/EnergyPlus/Autosizing/CoolingWaterflowSizing.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/HeatingAirFlowSizing.cc b/src/EnergyPlus/Autosizing/HeatingAirFlowSizing.cc index 4b3f2ba41c1..582af45ff94 100644 --- a/src/EnergyPlus/Autosizing/HeatingAirFlowSizing.cc +++ b/src/EnergyPlus/Autosizing/HeatingAirFlowSizing.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/HeatingAirFlowSizing.hh b/src/EnergyPlus/Autosizing/HeatingAirFlowSizing.hh index 83f38b923a1..dc28867e945 100644 --- a/src/EnergyPlus/Autosizing/HeatingAirFlowSizing.hh +++ b/src/EnergyPlus/Autosizing/HeatingAirFlowSizing.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/HeatingAirflowUASizing.cc b/src/EnergyPlus/Autosizing/HeatingAirflowUASizing.cc index d7168f02dd9..ad8ec478213 100644 --- a/src/EnergyPlus/Autosizing/HeatingAirflowUASizing.cc +++ b/src/EnergyPlus/Autosizing/HeatingAirflowUASizing.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/HeatingAirflowUASizing.hh b/src/EnergyPlus/Autosizing/HeatingAirflowUASizing.hh index a4b8f254d48..18c3552215b 100644 --- a/src/EnergyPlus/Autosizing/HeatingAirflowUASizing.hh +++ b/src/EnergyPlus/Autosizing/HeatingAirflowUASizing.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/HeatingCapacitySizing.cc b/src/EnergyPlus/Autosizing/HeatingCapacitySizing.cc index 1cf816f2658..e9b09692fbb 100644 --- a/src/EnergyPlus/Autosizing/HeatingCapacitySizing.cc +++ b/src/EnergyPlus/Autosizing/HeatingCapacitySizing.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/HeatingCapacitySizing.hh b/src/EnergyPlus/Autosizing/HeatingCapacitySizing.hh index c759d785ec5..82953a9ac7b 100644 --- a/src/EnergyPlus/Autosizing/HeatingCapacitySizing.hh +++ b/src/EnergyPlus/Autosizing/HeatingCapacitySizing.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/HeatingWaterDesAirInletHumRatSizing.cc b/src/EnergyPlus/Autosizing/HeatingWaterDesAirInletHumRatSizing.cc index 191fceacd81..5da9ab78fc8 100644 --- a/src/EnergyPlus/Autosizing/HeatingWaterDesAirInletHumRatSizing.cc +++ b/src/EnergyPlus/Autosizing/HeatingWaterDesAirInletHumRatSizing.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/HeatingWaterDesAirInletHumRatSizing.hh b/src/EnergyPlus/Autosizing/HeatingWaterDesAirInletHumRatSizing.hh index a97a7ab6e89..7d786c80a83 100644 --- a/src/EnergyPlus/Autosizing/HeatingWaterDesAirInletHumRatSizing.hh +++ b/src/EnergyPlus/Autosizing/HeatingWaterDesAirInletHumRatSizing.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/HeatingWaterDesAirInletTempSizing.cc b/src/EnergyPlus/Autosizing/HeatingWaterDesAirInletTempSizing.cc index 0800571eca9..952c440acc4 100644 --- a/src/EnergyPlus/Autosizing/HeatingWaterDesAirInletTempSizing.cc +++ b/src/EnergyPlus/Autosizing/HeatingWaterDesAirInletTempSizing.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/HeatingWaterDesAirInletTempSizing.hh b/src/EnergyPlus/Autosizing/HeatingWaterDesAirInletTempSizing.hh index f5f2e0a67c3..d356ef10835 100644 --- a/src/EnergyPlus/Autosizing/HeatingWaterDesAirInletTempSizing.hh +++ b/src/EnergyPlus/Autosizing/HeatingWaterDesAirInletTempSizing.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/HeatingWaterDesCoilLoadUsedForUASizing.cc b/src/EnergyPlus/Autosizing/HeatingWaterDesCoilLoadUsedForUASizing.cc index 336dc37c5d3..d86dd0acade 100644 --- a/src/EnergyPlus/Autosizing/HeatingWaterDesCoilLoadUsedForUASizing.cc +++ b/src/EnergyPlus/Autosizing/HeatingWaterDesCoilLoadUsedForUASizing.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -69,42 +69,24 @@ Real64 HeatingWaterDesCoilLoadUsedForUASizer::size(EnergyPlusData &state, Real64 this->autoSizedValue = _originalValue; } else { if (this->termUnitSingDuct && (this->curTermUnitSizingNum > 0)) { - Real64 const Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidIndex, - this->callingRoutine); - Real64 const rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidIndex, - this->callingRoutine); + Real64 const Cp = + state.dataPlnt->PlantLoop(this->dataWaterLoopNum).glycol->getSpecificHeat(state, Constant::HWInitConvTemp, this->callingRoutine); + Real64 const rho = + state.dataPlnt->PlantLoop(this->dataWaterLoopNum).glycol->getDensity(state, Constant::HWInitConvTemp, this->callingRoutine); this->autoSizedValue = this->dataWaterFlowUsedForSizing * this->dataWaterCoilSizHeatDeltaT * Cp * rho; state.dataRptCoilSelection->coilSelectionReportObj->setCoilReheatMultiplier(state, this->compName, this->compType, 1.0); } else if ((this->termUnitPIU || this->termUnitIU) && (this->curTermUnitSizingNum > 0)) { - Real64 const Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidIndex, - this->callingRoutine); - Real64 const rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidIndex, - this->callingRoutine); + Real64 const Cp = + state.dataPlnt->PlantLoop(this->dataWaterLoopNum).glycol->getSpecificHeat(state, Constant::HWInitConvTemp, this->callingRoutine); + Real64 const rho = + state.dataPlnt->PlantLoop(this->dataWaterLoopNum).glycol->getDensity(state, Constant::HWInitConvTemp, this->callingRoutine); this->autoSizedValue = this->dataWaterFlowUsedForSizing * this->dataWaterCoilSizHeatDeltaT * Cp * rho * this->termUnitSizing(this->curTermUnitSizingNum).ReheatLoadMult; } else if (this->zoneEqFanCoil || this->zoneEqUnitHeater) { - Real64 const Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidIndex, - this->callingRoutine); - Real64 const rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidIndex, - this->callingRoutine); + Real64 const Cp = + state.dataPlnt->PlantLoop(this->dataWaterLoopNum).glycol->getSpecificHeat(state, Constant::HWInitConvTemp, this->callingRoutine); + Real64 const rho = + state.dataPlnt->PlantLoop(this->dataWaterLoopNum).glycol->getDensity(state, Constant::HWInitConvTemp, this->callingRoutine); this->autoSizedValue = this->dataWaterFlowUsedForSizing * this->dataWaterCoilSizHeatDeltaT * Cp * rho; state.dataRptCoilSelection->coilSelectionReportObj->setCoilReheatMultiplier(state, this->compName, this->compType, 1.0); } else { diff --git a/src/EnergyPlus/Autosizing/HeatingWaterDesCoilLoadUsedForUASizing.hh b/src/EnergyPlus/Autosizing/HeatingWaterDesCoilLoadUsedForUASizing.hh index 43b53437ddd..bc0cb94cee2 100644 --- a/src/EnergyPlus/Autosizing/HeatingWaterDesCoilLoadUsedForUASizing.hh +++ b/src/EnergyPlus/Autosizing/HeatingWaterDesCoilLoadUsedForUASizing.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/HeatingWaterDesCoilWaterVolFlowUsedForUASizing.cc b/src/EnergyPlus/Autosizing/HeatingWaterDesCoilWaterVolFlowUsedForUASizing.cc index d250f3396d4..857aef7f562 100644 --- a/src/EnergyPlus/Autosizing/HeatingWaterDesCoilWaterVolFlowUsedForUASizing.cc +++ b/src/EnergyPlus/Autosizing/HeatingWaterDesCoilWaterVolFlowUsedForUASizing.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/HeatingWaterDesCoilWaterVolFlowUsedForUASizing.hh b/src/EnergyPlus/Autosizing/HeatingWaterDesCoilWaterVolFlowUsedForUASizing.hh index e8ff1561d91..002837edced 100644 --- a/src/EnergyPlus/Autosizing/HeatingWaterDesCoilWaterVolFlowUsedForUASizing.hh +++ b/src/EnergyPlus/Autosizing/HeatingWaterDesCoilWaterVolFlowUsedForUASizing.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/HeatingWaterflowSizing.cc b/src/EnergyPlus/Autosizing/HeatingWaterflowSizing.cc index 823f2c00aa3..4603d47f1d3 100644 --- a/src/EnergyPlus/Autosizing/HeatingWaterflowSizing.cc +++ b/src/EnergyPlus/Autosizing/HeatingWaterflowSizing.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -93,16 +93,10 @@ Real64 HeatingWaterflowSizer::size(EnergyPlusData &state, Real64 _originalValue, if (DesCoilLoad >= HVAC::SmallLoad) { if (this->dataWaterLoopNum > 0 && this->dataWaterLoopNum <= (int)state.dataPlnt->PlantLoop.size() && this->dataWaterCoilSizHeatDeltaT > 0.0) { - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidIndex, - this->callingRoutine); - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidIndex, - this->callingRoutine); + Real64 Cp = state.dataPlnt->PlantLoop(this->dataWaterLoopNum) + .glycol->getSpecificHeat(state, Constant::HWInitConvTemp, this->callingRoutine); + Real64 rho = state.dataPlnt->PlantLoop(this->dataWaterLoopNum) + .glycol->getDensity(state, Constant::HWInitConvTemp, this->callingRoutine); this->autoSizedValue = DesCoilLoad / (this->dataWaterCoilSizHeatDeltaT * Cp * rho); } else { std::string msg = "Developer Error: For autosizing of " + this->compType + ' ' + this->compName + @@ -123,16 +117,10 @@ Real64 HeatingWaterflowSizer::size(EnergyPlusData &state, Real64 _originalValue, if (this->dataCapacityUsedForSizing >= HVAC::SmallLoad) { if (this->dataWaterLoopNum > 0 && this->dataWaterLoopNum <= (int)state.dataPlnt->PlantLoop.size() && this->dataWaterCoilSizHeatDeltaT > 0.0) { - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidIndex, - this->callingRoutine); - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidIndex, - this->callingRoutine); + Real64 Cp = state.dataPlnt->PlantLoop(this->dataWaterLoopNum) + .glycol->getSpecificHeat(state, Constant::HWInitConvTemp, this->callingRoutine); + Real64 rho = state.dataPlnt->PlantLoop(this->dataWaterLoopNum) + .glycol->getDensity(state, Constant::HWInitConvTemp, this->callingRoutine); this->autoSizedValue = this->dataCapacityUsedForSizing / (this->dataWaterCoilSizHeatDeltaT * Cp * rho); } else { this->autoSizedValue = 0.0; diff --git a/src/EnergyPlus/Autosizing/HeatingWaterflowSizing.hh b/src/EnergyPlus/Autosizing/HeatingWaterflowSizing.hh index aa2f6a4378b..953c97e138c 100644 --- a/src/EnergyPlus/Autosizing/HeatingWaterflowSizing.hh +++ b/src/EnergyPlus/Autosizing/HeatingWaterflowSizing.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/SystemAirFlowSizing.cc b/src/EnergyPlus/Autosizing/SystemAirFlowSizing.cc index 21208557a57..19ca673af03 100644 --- a/src/EnergyPlus/Autosizing/SystemAirFlowSizing.cc +++ b/src/EnergyPlus/Autosizing/SystemAirFlowSizing.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -777,13 +777,38 @@ Real64 SystemAirFlowSizer::size(EnergyPlusData &state, Real64 _originalValue, bo } } else { - auto &sysSizPeakDDNum = state.dataSize->SysSizPeakDDNum(this->curSysNum); - - if (this->airLoopSysFlag) { - auto const &unitarysysEqSizing = this->unitarySysEqSizing(this->curSysNum); - if (unitarysysEqSizing.CoolingAirFlow && unitarysysEqSizing.HeatingAirFlow) { - this->autoSizedValue = std::max(unitarysysEqSizing.CoolingAirVolFlow, unitarysysEqSizing.HeatingAirVolFlow); - if (this->autoSizedValue == unitarysysEqSizing.CoolingAirVolFlow) { + if (this->curOASysNum > 0) { + // should a parent object ever override DOAS or OASystem flow rate (e.g., using oaSysEqSizing().AirVolFlow)? + if (outsideAirSys(this->curOASysNum).AirLoopDOASNum > -1) { + this->autoSizedValue = + this->airloopDOAS[outsideAirSys(this->curOASysNum).AirLoopDOASNum].SizingMassFlow / state.dataEnvrn->StdRhoAir; + } else { + switch (this->curDuctType) { + case HVAC::AirDuctType::Cooling: { + this->autoSizedValue = this->finalSysSizing(this->curSysNum).DesCoolVolFlow; + } break; + case HVAC::AirDuctType::Heating: { + this->autoSizedValue = this->finalSysSizing(this->curSysNum).DesHeatVolFlow; + } break; + case HVAC::AirDuctType::Main: + case HVAC::AirDuctType::Other: + default: { + this->autoSizedValue = this->finalSysSizing(this->curSysNum).DesMainVolFlow; + } break; + } + if (this->autoSizedValue == this->finalSysSizing(this->curSysNum).DesHeatVolFlow) { + if (this->finalSysSizing(this->curSysNum).HeatDDNum > 0 && + this->finalSysSizing(this->curSysNum).HeatDDNum <= state.dataEnvrn->TotDesDays) { + auto &desDayInput = state.dataWeather->DesDayInput(this->finalSysSizing(this->curSysNum).HeatDDNum); + DDNameFanPeak = desDayInput.Title; + dateTimeFanPeak = format("{}/{} {}", + desDayInput.Month, + desDayInput.DayOfMonth, + state.dataRptCoilSelection->coilSelectionReportObj->getTimeText( + state, this->finalSysSizing(this->curSysNum).SysHeatAirTimeStepPk)); + } + } else if (this->autoSizedValue == this->finalSysSizing(this->curSysNum).DesCoolVolFlow) { + auto &sysSizPeakDDNum = state.dataSize->SysSizPeakDDNum(this->curSysNum); if (sysSizPeakDDNum.CoolFlowPeakDD > 0 && sysSizPeakDDNum.CoolFlowPeakDD <= state.dataEnvrn->TotDesDays) { auto &desDayInput = state.dataWeather->DesDayInput(sysSizPeakDDNum.CoolFlowPeakDD); DDNameFanPeak = desDayInput.Title; @@ -793,8 +818,51 @@ Real64 SystemAirFlowSizer::size(EnergyPlusData &state, Real64 _originalValue, bo state.dataRptCoilSelection->coilSelectionReportObj->getTimeText( state, sysSizPeakDDNum.TimeStepAtCoolFlowPk(sysSizPeakDDNum.CoolFlowPeakDD))); } + } + } + } else { + auto &sysSizPeakDDNum = state.dataSize->SysSizPeakDDNum(this->curSysNum); + + if (this->airLoopSysFlag) { + auto const &unitarysysEqSizing = this->unitarySysEqSizing(this->curSysNum); + if (unitarysysEqSizing.CoolingAirFlow && unitarysysEqSizing.HeatingAirFlow) { + this->autoSizedValue = std::max(unitarysysEqSizing.CoolingAirVolFlow, unitarysysEqSizing.HeatingAirVolFlow); + if (this->autoSizedValue == unitarysysEqSizing.CoolingAirVolFlow) { + if (sysSizPeakDDNum.CoolFlowPeakDD > 0 && sysSizPeakDDNum.CoolFlowPeakDD <= state.dataEnvrn->TotDesDays) { + auto &desDayInput = state.dataWeather->DesDayInput(sysSizPeakDDNum.CoolFlowPeakDD); + DDNameFanPeak = desDayInput.Title; + dateTimeFanPeak = format("{}/{} {}", + desDayInput.Month, + desDayInput.DayOfMonth, + state.dataRptCoilSelection->coilSelectionReportObj->getTimeText( + state, sysSizPeakDDNum.TimeStepAtCoolFlowPk(sysSizPeakDDNum.CoolFlowPeakDD))); + } - } else if (this->autoSizedValue == unitarysysEqSizing.HeatingAirVolFlow) { + } else if (this->autoSizedValue == unitarysysEqSizing.HeatingAirVolFlow) { + if (this->finalSysSizing(this->curSysNum).HeatDDNum > 0 && + this->finalSysSizing(this->curSysNum).HeatDDNum <= state.dataEnvrn->TotDesDays) { + auto &desDayInput = state.dataWeather->DesDayInput(this->finalSysSizing(this->curSysNum).HeatDDNum); + DDNameFanPeak = desDayInput.Title; + dateTimeFanPeak = format("{}/{} {}", + desDayInput.Month, + desDayInput.DayOfMonth, + state.dataRptCoilSelection->coilSelectionReportObj->getTimeText( + state, this->finalSysSizing(this->curSysNum).SysHeatAirTimeStepPk)); + } + } + } else if (unitarysysEqSizing.CoolingAirFlow) { + this->autoSizedValue = unitarysysEqSizing.CoolingAirVolFlow; + if (sysSizPeakDDNum.CoolFlowPeakDD > 0 && sysSizPeakDDNum.CoolFlowPeakDD <= state.dataEnvrn->TotDesDays) { + auto &desDayInput = state.dataWeather->DesDayInput(sysSizPeakDDNum.CoolFlowPeakDD); + DDNameFanPeak = state.dataWeather->DesDayInput(sysSizPeakDDNum.CoolFlowPeakDD).Title; + dateTimeFanPeak = format("{}/{} {}", + desDayInput.Month, + desDayInput.DayOfMonth, + state.dataRptCoilSelection->coilSelectionReportObj->getTimeText( + state, sysSizPeakDDNum.TimeStepAtCoolFlowPk(sysSizPeakDDNum.CoolFlowPeakDD))); + } + } else if (unitarysysEqSizing.HeatingAirFlow) { + this->autoSizedValue = unitarysysEqSizing.HeatingAirVolFlow; if (this->finalSysSizing(this->curSysNum).HeatDDNum > 0 && this->finalSysSizing(this->curSysNum).HeatDDNum <= state.dataEnvrn->TotDesDays) { auto &desDayInput = state.dataWeather->DesDayInput(this->finalSysSizing(this->curSysNum).HeatDDNum); @@ -805,31 +873,32 @@ Real64 SystemAirFlowSizer::size(EnergyPlusData &state, Real64 _originalValue, bo state.dataRptCoilSelection->coilSelectionReportObj->getTimeText( state, this->finalSysSizing(this->curSysNum).SysHeatAirTimeStepPk)); } - } - } else if (unitarysysEqSizing.CoolingAirFlow) { - this->autoSizedValue = unitarysysEqSizing.CoolingAirVolFlow; - if (sysSizPeakDDNum.CoolFlowPeakDD > 0 && sysSizPeakDDNum.CoolFlowPeakDD <= state.dataEnvrn->TotDesDays) { - auto &desDayInput = state.dataWeather->DesDayInput(sysSizPeakDDNum.CoolFlowPeakDD); - DDNameFanPeak = state.dataWeather->DesDayInput(sysSizPeakDDNum.CoolFlowPeakDD).Title; - dateTimeFanPeak = format("{}/{} {}", - desDayInput.Month, - desDayInput.DayOfMonth, - state.dataRptCoilSelection->coilSelectionReportObj->getTimeText( - state, sysSizPeakDDNum.TimeStepAtCoolFlowPk(sysSizPeakDDNum.CoolFlowPeakDD))); - } - } else if (unitarysysEqSizing.HeatingAirFlow) { - this->autoSizedValue = unitarysysEqSizing.HeatingAirVolFlow; - if (this->finalSysSizing(this->curSysNum).HeatDDNum > 0 && - this->finalSysSizing(this->curSysNum).HeatDDNum <= state.dataEnvrn->TotDesDays) { - auto &desDayInput = state.dataWeather->DesDayInput(this->finalSysSizing(this->curSysNum).HeatDDNum); - DDNameFanPeak = desDayInput.Title; - dateTimeFanPeak = format("{}/{} {}", - desDayInput.Month, - desDayInput.DayOfMonth, - state.dataRptCoilSelection->coilSelectionReportObj->getTimeText( - state, this->finalSysSizing(this->curSysNum).SysHeatAirTimeStepPk)); - } + } else { + this->autoSizedValue = this->finalSysSizing(this->curSysNum).DesMainVolFlow; + if (this->autoSizedValue == this->finalSysSizing(this->curSysNum).DesHeatVolFlow) { + if (this->finalSysSizing(this->curSysNum).HeatDDNum > 0 && + this->finalSysSizing(this->curSysNum).HeatDDNum <= state.dataEnvrn->TotDesDays) { + auto &desDayInput = state.dataWeather->DesDayInput(this->finalSysSizing(this->curSysNum).HeatDDNum); + DDNameFanPeak = desDayInput.Title; + dateTimeFanPeak = format("{}/{} {}", + desDayInput.Month, + desDayInput.DayOfMonth, + state.dataRptCoilSelection->coilSelectionReportObj->getTimeText( + state, this->finalSysSizing(this->curSysNum).SysHeatAirTimeStepPk)); + } + } else if (this->autoSizedValue == this->finalSysSizing(this->curSysNum).DesCoolVolFlow) { + if (sysSizPeakDDNum.CoolFlowPeakDD > 0 && sysSizPeakDDNum.CoolFlowPeakDD <= state.dataEnvrn->TotDesDays) { + auto &desDayInput = state.dataWeather->DesDayInput(sysSizPeakDDNum.CoolFlowPeakDD); + DDNameFanPeak = desDayInput.Title; + dateTimeFanPeak = format("{}/{} {}", + desDayInput.Month, + desDayInput.DayOfMonth, + state.dataRptCoilSelection->coilSelectionReportObj->getTimeText( + state, sysSizPeakDDNum.TimeStepAtCoolFlowPk(sysSizPeakDDNum.CoolFlowPeakDD))); + } + } + } } else { this->autoSizedValue = this->finalSysSizing(this->curSysNum).DesMainVolFlow; if (this->autoSizedValue == this->finalSysSizing(this->curSysNum).DesHeatVolFlow) { @@ -855,32 +924,8 @@ Real64 SystemAirFlowSizer::size(EnergyPlusData &state, Real64 _originalValue, bo } } } - } else { - this->autoSizedValue = this->finalSysSizing(this->curSysNum).DesMainVolFlow; - if (this->autoSizedValue == this->finalSysSizing(this->curSysNum).DesHeatVolFlow) { - if (this->finalSysSizing(this->curSysNum).HeatDDNum > 0 && - this->finalSysSizing(this->curSysNum).HeatDDNum <= state.dataEnvrn->TotDesDays) { - auto &desDayInput = state.dataWeather->DesDayInput(this->finalSysSizing(this->curSysNum).HeatDDNum); - DDNameFanPeak = desDayInput.Title; - dateTimeFanPeak = format("{}/{} {}", - desDayInput.Month, - desDayInput.DayOfMonth, - state.dataRptCoilSelection->coilSelectionReportObj->getTimeText( - state, this->finalSysSizing(this->curSysNum).SysHeatAirTimeStepPk)); - } - } else if (this->autoSizedValue == this->finalSysSizing(this->curSysNum).DesCoolVolFlow) { - if (sysSizPeakDDNum.CoolFlowPeakDD > 0 && sysSizPeakDDNum.CoolFlowPeakDD <= state.dataEnvrn->TotDesDays) { - auto &desDayInput = state.dataWeather->DesDayInput(sysSizPeakDDNum.CoolFlowPeakDD); - DDNameFanPeak = desDayInput.Title; - dateTimeFanPeak = format("{}/{} {}", - desDayInput.Month, - desDayInput.DayOfMonth, - state.dataRptCoilSelection->coilSelectionReportObj->getTimeText( - state, sysSizPeakDDNum.TimeStepAtCoolFlowPk(sysSizPeakDDNum.CoolFlowPeakDD))); - } - } + if (this->dataFractionUsedForSizing > 0.0) this->autoSizedValue = this->autoSizedValue * this->dataFractionUsedForSizing; } - if (this->dataFractionUsedForSizing > 0.0) this->autoSizedValue = this->autoSizedValue * this->dataFractionUsedForSizing; } } } else if (this->dataNonZoneNonAirloopValue > 0) { diff --git a/src/EnergyPlus/Autosizing/SystemAirFlowSizing.hh b/src/EnergyPlus/Autosizing/SystemAirFlowSizing.hh index b27c61667e2..5eb86ea010d 100644 --- a/src/EnergyPlus/Autosizing/SystemAirFlowSizing.hh +++ b/src/EnergyPlus/Autosizing/SystemAirFlowSizing.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -73,6 +73,10 @@ struct SystemAirFlowSizer : BaseSizerWithScalableInputs struct SystemAirFlowSizerData : BaseGlobalStruct { + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/Autosizing/WaterHeatingCapacitySizing.cc b/src/EnergyPlus/Autosizing/WaterHeatingCapacitySizing.cc index 342293b358a..7fcd86f0f59 100644 --- a/src/EnergyPlus/Autosizing/WaterHeatingCapacitySizing.cc +++ b/src/EnergyPlus/Autosizing/WaterHeatingCapacitySizing.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -72,29 +72,17 @@ Real64 WaterHeatingCapacitySizer::size(EnergyPlusData &state, Real64 _originalVa Real64 CoilOutHumRat = 0.0; if ((this->termUnitSingDuct || this->termUnitPIU || this->termUnitIU) && (this->curTermUnitSizingNum > 0)) { DesMassFlow = this->termUnitSizing(this->curTermUnitSizingNum).MaxHWVolFlow; - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidIndex, - this->callingRoutine); - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidIndex, - this->callingRoutine); + Real64 Cp = + state.dataPlnt->PlantLoop(this->dataWaterLoopNum).glycol->getSpecificHeat(state, Constant::HWInitConvTemp, this->callingRoutine); + Real64 rho = + state.dataPlnt->PlantLoop(this->dataWaterLoopNum).glycol->getDensity(state, Constant::HWInitConvTemp, this->callingRoutine); NominalCapacityDes = DesMassFlow * this->dataWaterCoilSizHeatDeltaT * Cp * rho; } else if (this->zoneEqFanCoil || this->zoneEqUnitHeater) { DesMassFlow = this->zoneEqSizing(this->curZoneEqNum).MaxHWVolFlow; - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidIndex, - this->callingRoutine); - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->dataWaterLoopNum).FluidIndex, - this->callingRoutine); + Real64 Cp = + state.dataPlnt->PlantLoop(this->dataWaterLoopNum).glycol->getSpecificHeat(state, Constant::HWInitConvTemp, this->callingRoutine); + Real64 rho = + state.dataPlnt->PlantLoop(this->dataWaterLoopNum).glycol->getDensity(state, Constant::HWInitConvTemp, this->callingRoutine); NominalCapacityDes = DesMassFlow * this->dataWaterCoilSizHeatDeltaT * Cp * rho; // if coil is part of a zonal unit, calc coil load to get hot water flow rate } else { diff --git a/src/EnergyPlus/Autosizing/WaterHeatingCapacitySizing.hh b/src/EnergyPlus/Autosizing/WaterHeatingCapacitySizing.hh index 3e24d939a41..c681552fce0 100644 --- a/src/EnergyPlus/Autosizing/WaterHeatingCapacitySizing.hh +++ b/src/EnergyPlus/Autosizing/WaterHeatingCapacitySizing.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/WaterHeatingCoilUASizing.cc b/src/EnergyPlus/Autosizing/WaterHeatingCoilUASizing.cc index 7580bd40f27..3a5a60cbaec 100644 --- a/src/EnergyPlus/Autosizing/WaterHeatingCoilUASizing.cc +++ b/src/EnergyPlus/Autosizing/WaterHeatingCoilUASizing.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Autosizing/WaterHeatingCoilUASizing.hh b/src/EnergyPlus/Autosizing/WaterHeatingCoilUASizing.hh index b38b2f9e3c2..708676a1520 100644 --- a/src/EnergyPlus/Autosizing/WaterHeatingCoilUASizing.hh +++ b/src/EnergyPlus/Autosizing/WaterHeatingCoilUASizing.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/BaseboardElectric.cc b/src/EnergyPlus/BaseboardElectric.cc index e6b1b408712..d37ece2fb94 100644 --- a/src/EnergyPlus/BaseboardElectric.cc +++ b/src/EnergyPlus/BaseboardElectric.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -76,11 +76,8 @@ namespace BaseboardElectric { // DATE WRITTEN Nov 2001 // RE-ENGINEERED na - // Use statements for access to subroutines in other modules - using namespace ScheduleManager; - // MODULE PARAMETER DEFINITIONS - const char *cCMO_BBRadiator_Electric = "ZoneHVAC:Baseboard:Convective:Electric"; + constexpr std::string_view cCMO_BBRadiator_Electric = "ZoneHVAC:Baseboard:Convective:Electric"; constexpr Real64 SimpConvAirFlowSpeed(0.5); // m/s void SimElectricBaseboard(EnergyPlusData &state, std::string const &EquipName, int const ControlledZoneNum, Real64 &PowerMet, int &CompIndex) @@ -171,12 +168,15 @@ namespace BaseboardElectric { // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetBaseboardInput: "); // include trailing blank space - int constexpr iHeatCAPMAlphaNum(3); // get input index to baseboard heating capacity sizing method - int constexpr iHeatDesignCapacityNumericNum(1); // get input index to baseboard heating capacity - int constexpr iHeatCapacityPerFloorAreaNumericNum(2); // get input index to baseboard heating capacity per floor area sizing + static constexpr std::string_view routineName = "GetBaseboardInput"; + int constexpr iHeatCAPMAlphaNum(3); // get input index to baseboard heating capacity sizing method + int constexpr iHeatDesignCapacityNumericNum(1); // get input index to baseboard heating capacity + int constexpr iHeatCapacityPerFloorAreaNumericNum(2); // get input index to baseboard heating capacity per floor area sizing int constexpr iHeatFracOfAutosizedCapacityNumericNum( 3); // get input index to baseboard heating capacity sizing as fraction of autosized heating capacity + auto &s_ipsc = state.dataIPShortCut; + auto &baseboard = state.dataBaseboardElectric; std::string_view cCurrentModuleObject = cCMO_BBRadiator_Electric; @@ -195,137 +195,114 @@ namespace BaseboardElectric { state.dataInputProcessing->inputProcessor->getObjectItem(state, cCurrentModuleObject, ConvElecBBNum, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNums, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); baseboard->baseboards(ConvElecBBNum).FieldNames.allocate(NumNums); baseboard->baseboards(ConvElecBBNum).FieldNames = ""; - baseboard->baseboards(ConvElecBBNum).FieldNames = state.dataIPShortCut->cNumericFieldNames; + baseboard->baseboards(ConvElecBBNum).FieldNames = s_ipsc->cNumericFieldNames; + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; // ErrorsFound will be set to True if problem was found, left untouched otherwise - VerifyUniqueBaseboardName( - state, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1), ErrorsFound, format("{} Name", cCurrentModuleObject)); + VerifyUniqueBaseboardName(state, cCurrentModuleObject, s_ipsc->cAlphaArgs(1), ErrorsFound, format("{} Name", cCurrentModuleObject)); ++BaseboardNum; auto &thisBaseboard = baseboard->baseboards(BaseboardNum); - thisBaseboard.EquipName = state.dataIPShortCut->cAlphaArgs(1); // name of this baseboard + thisBaseboard.EquipName = s_ipsc->cAlphaArgs(1); // name of this baseboard thisBaseboard.EquipType = Util::makeUPPER(cCurrentModuleObject); // the type of baseboard-rename change - thisBaseboard.Schedule = state.dataIPShortCut->cAlphaArgs(2); - if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { - thisBaseboard.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisBaseboard.SchedPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); - if (thisBaseboard.SchedPtr == 0) { - ShowSevereError(state, - format("{}{}: invalid {} entered ={} for {}= {}", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2), - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1))); - ErrorsFound = true; - } + thisBaseboard.Schedule = s_ipsc->cAlphaArgs(2); + if (s_ipsc->lAlphaFieldBlanks(2)) { + thisBaseboard.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisBaseboard.availSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); + ErrorsFound = true; } // get inlet node number - thisBaseboard.BaseboardEfficiency = state.dataIPShortCut->rNumericArgs(4); + thisBaseboard.BaseboardEfficiency = s_ipsc->rNumericArgs(4); // Determine baseboard electric heating design capacity sizing method - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum), "HeatingDesignCapacity")) { + if (Util::SameString(s_ipsc->cAlphaArgs(iHeatCAPMAlphaNum), "HeatingDesignCapacity")) { thisBaseboard.HeatingCapMethod = HeatingDesignCapacity; - if (!state.dataIPShortCut->lNumericFieldBlanks(iHeatDesignCapacityNumericNum)) { - thisBaseboard.ScaledHeatingCapacity = state.dataIPShortCut->rNumericArgs(iHeatDesignCapacityNumericNum); + if (!s_ipsc->lNumericFieldBlanks(iHeatDesignCapacityNumericNum)) { + thisBaseboard.ScaledHeatingCapacity = s_ipsc->rNumericArgs(iHeatDesignCapacityNumericNum); if (thisBaseboard.ScaledHeatingCapacity < 0.0 && thisBaseboard.ScaledHeatingCapacity != AutoSize) { ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisBaseboard.EquipName)); ShowContinueError(state, format("Illegal {} = {:.7T}", - state.dataIPShortCut->cNumericFieldNames(iHeatDesignCapacityNumericNum), - state.dataIPShortCut->rNumericArgs(iHeatDesignCapacityNumericNum))); + s_ipsc->cNumericFieldNames(iHeatDesignCapacityNumericNum), + s_ipsc->rNumericArgs(iHeatDesignCapacityNumericNum))); ErrorsFound = true; } } else { ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisBaseboard.EquipName)); - ShowContinueError(state, - format("Input for {} = {}", - state.dataIPShortCut->cAlphaFieldNames(iHeatCAPMAlphaNum), - state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum))); ShowContinueError( - state, format("Blank field not allowed for {}", state.dataIPShortCut->cNumericFieldNames(iHeatDesignCapacityNumericNum))); + state, format("Input for {} = {}", s_ipsc->cAlphaFieldNames(iHeatCAPMAlphaNum), s_ipsc->cAlphaArgs(iHeatCAPMAlphaNum))); + ShowContinueError(state, format("Blank field not allowed for {}", s_ipsc->cNumericFieldNames(iHeatDesignCapacityNumericNum))); ErrorsFound = true; } - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum), "CapacityPerFloorArea")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(iHeatCAPMAlphaNum), "CapacityPerFloorArea")) { thisBaseboard.HeatingCapMethod = CapacityPerFloorArea; - if (!state.dataIPShortCut->lNumericFieldBlanks(iHeatCapacityPerFloorAreaNumericNum)) { - thisBaseboard.ScaledHeatingCapacity = state.dataIPShortCut->rNumericArgs(iHeatCapacityPerFloorAreaNumericNum); + if (!s_ipsc->lNumericFieldBlanks(iHeatCapacityPerFloorAreaNumericNum)) { + thisBaseboard.ScaledHeatingCapacity = s_ipsc->rNumericArgs(iHeatCapacityPerFloorAreaNumericNum); if (thisBaseboard.ScaledHeatingCapacity <= 0.0) { ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisBaseboard.EquipName)); - ShowContinueError(state, - format("Input for {} = {}", - state.dataIPShortCut->cAlphaFieldNames(iHeatCAPMAlphaNum), - state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum))); + ShowContinueError( + state, + format("Input for {} = {}", s_ipsc->cAlphaFieldNames(iHeatCAPMAlphaNum), s_ipsc->cAlphaArgs(iHeatCAPMAlphaNum))); ShowContinueError(state, format("Illegal {} = {:.7T}", - state.dataIPShortCut->cNumericFieldNames(iHeatCapacityPerFloorAreaNumericNum), - state.dataIPShortCut->rNumericArgs(iHeatCapacityPerFloorAreaNumericNum))); + s_ipsc->cNumericFieldNames(iHeatCapacityPerFloorAreaNumericNum), + s_ipsc->rNumericArgs(iHeatCapacityPerFloorAreaNumericNum))); ErrorsFound = true; } else if (thisBaseboard.ScaledHeatingCapacity == AutoSize) { ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisBaseboard.EquipName)); - ShowContinueError(state, - format("Input for {} = {}", - state.dataIPShortCut->cAlphaFieldNames(iHeatCAPMAlphaNum), - state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum))); ShowContinueError( state, - format("Illegal {} = AutoSize", state.dataIPShortCut->cNumericFieldNames(iHeatCapacityPerFloorAreaNumericNum))); + format("Input for {} = {}", s_ipsc->cAlphaFieldNames(iHeatCAPMAlphaNum), s_ipsc->cAlphaArgs(iHeatCAPMAlphaNum))); + ShowContinueError(state, + format("Illegal {} = AutoSize", s_ipsc->cNumericFieldNames(iHeatCapacityPerFloorAreaNumericNum))); ErrorsFound = true; } } else { ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisBaseboard.EquipName)); - ShowContinueError(state, - format("Input for {} = {}", - state.dataIPShortCut->cAlphaFieldNames(iHeatCAPMAlphaNum), - state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum))); ShowContinueError( - state, - format("Blank field not allowed for {}", state.dataIPShortCut->cNumericFieldNames(iHeatCapacityPerFloorAreaNumericNum))); + state, format("Input for {} = {}", s_ipsc->cAlphaFieldNames(iHeatCAPMAlphaNum), s_ipsc->cAlphaArgs(iHeatCAPMAlphaNum))); + ShowContinueError(state, + format("Blank field not allowed for {}", s_ipsc->cNumericFieldNames(iHeatCapacityPerFloorAreaNumericNum))); ErrorsFound = true; } - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum), "FractionOfAutosizedHeatingCapacity")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(iHeatCAPMAlphaNum), "FractionOfAutosizedHeatingCapacity")) { thisBaseboard.HeatingCapMethod = FractionOfAutosizedHeatingCapacity; - if (!state.dataIPShortCut->lNumericFieldBlanks(iHeatFracOfAutosizedCapacityNumericNum)) { - thisBaseboard.ScaledHeatingCapacity = state.dataIPShortCut->rNumericArgs(iHeatFracOfAutosizedCapacityNumericNum); + if (!s_ipsc->lNumericFieldBlanks(iHeatFracOfAutosizedCapacityNumericNum)) { + thisBaseboard.ScaledHeatingCapacity = s_ipsc->rNumericArgs(iHeatFracOfAutosizedCapacityNumericNum); if (thisBaseboard.ScaledHeatingCapacity < 0.0) { ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisBaseboard.EquipName)); ShowContinueError(state, format("Illegal {} = {:.7T}", - state.dataIPShortCut->cNumericFieldNames(iHeatFracOfAutosizedCapacityNumericNum), - state.dataIPShortCut->rNumericArgs(iHeatFracOfAutosizedCapacityNumericNum))); + s_ipsc->cNumericFieldNames(iHeatFracOfAutosizedCapacityNumericNum), + s_ipsc->rNumericArgs(iHeatFracOfAutosizedCapacityNumericNum))); ErrorsFound = true; } } else { ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisBaseboard.EquipName)); - ShowContinueError(state, - format("Input for {} = {}", - state.dataIPShortCut->cAlphaFieldNames(iHeatCAPMAlphaNum), - state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum))); - ShowContinueError(state, - format("Blank field not allowed for {}", - state.dataIPShortCut->cNumericFieldNames(iHeatFracOfAutosizedCapacityNumericNum))); + ShowContinueError( + state, format("Input for {} = {}", s_ipsc->cAlphaFieldNames(iHeatCAPMAlphaNum), s_ipsc->cAlphaArgs(iHeatCAPMAlphaNum))); + ShowContinueError( + state, format("Blank field not allowed for {}", s_ipsc->cNumericFieldNames(iHeatFracOfAutosizedCapacityNumericNum))); ErrorsFound = true; } } else { ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisBaseboard.EquipName)); ShowContinueError(state, - format("Illegal {} = {}", - state.dataIPShortCut->cAlphaFieldNames(iHeatCAPMAlphaNum), - state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum))); + format("Illegal {} = {}", s_ipsc->cAlphaFieldNames(iHeatCAPMAlphaNum), s_ipsc->cAlphaArgs(iHeatCAPMAlphaNum))); ErrorsFound = true; } @@ -515,7 +492,7 @@ namespace BaseboardElectric { // thermal loss that could be accounted for with this efficiency input. Real64 Effic = baseboard.BaseboardEfficiency; - if (GetCurrentScheduleValue(state, baseboard.SchedPtr) > 0.0 && LoadMet >= HVAC::SmallLoad) { + if (baseboard.availSched->getCurrentVal() > 0.0 && LoadMet >= HVAC::SmallLoad) { // if the load exceeds the capacity than the capacity is set to the BB limit. if (LoadMet > baseboard.NominalCapacity) { diff --git a/src/EnergyPlus/BaseboardElectric.hh b/src/EnergyPlus/BaseboardElectric.hh index 0c1491f6def..ee2550e6cfe 100644 --- a/src/EnergyPlus/BaseboardElectric.hh +++ b/src/EnergyPlus/BaseboardElectric.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -56,6 +56,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -69,7 +70,7 @@ namespace BaseboardElectric { std::string EquipName; std::string EquipType; std::string Schedule; - int SchedPtr = 0; + Sched::Schedule *availSched = nullptr; Real64 NominalCapacity = 0.0; Real64 BaseboardEfficiency = 0.0; Real64 AirInletTemp = 0.0; @@ -105,6 +106,10 @@ struct BaseboardElectricData : BaseGlobalStruct bool getInputFlag = true; EPVector baseboards; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/BaseboardRadiator.cc b/src/EnergyPlus/BaseboardRadiator.cc index 95075a1901a..c9de7f9b594 100644 --- a/src/EnergyPlus/BaseboardRadiator.cc +++ b/src/EnergyPlus/BaseboardRadiator.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -50,7 +50,7 @@ // ObjexxFCL Headers #include -#include +// #include // EnergyPlus Headers #include @@ -94,9 +94,6 @@ namespace BaseboardRadiator { using HVAC::SmallLoad; // Use statements for access to subroutines in other modules - using namespace ScheduleManager; - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSpecificHeatGlycol; using Psychrometrics::PsyCpAirFnW; using Psychrometrics::PsyRhoAirFnPbTdbW; @@ -226,16 +223,17 @@ namespace BaseboardRadiator { // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName = "GetBaseboardInput: "; // include trailing blank space + static constexpr std::string_view routineName = "GetBaseboardInput"; int constexpr iHeatCAPMAlphaNum = 5; // get input index to water baseboard Radiator system heating capacity sizing method int constexpr iHeatDesignCapacityNumericNum = 1; // get input index to water baseboard Radiator system electric heating capacity int constexpr iHeatCapacityPerFloorAreaNumericNum = 2; // index to baseboard Radiator system electric heating capacity per floor area sizing int constexpr iHeatFracOfAutosizedCapacityNumericNum = 3; // index to baseboard heating capacity fraction of autosized heating capacity - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; + auto &s_ipsc = state.dataIPShortCut; - cCurrentModuleObject = cCMO_BBRadiator_Water; + s_ipsc->cCurrentModuleObject = cCMO_BBRadiator_Water; - int NumConvHWBaseboards = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + int NumConvHWBaseboards = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); // Calculate total number of baseboard units @@ -249,168 +247,141 @@ namespace BaseboardRadiator { int IOStat = 0; state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, ConvHWBaseboardNum, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNums, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; auto &thisBaseboard = state.dataBaseboardRadiator->baseboards(ConvHWBaseboardNum); thisBaseboard.FieldNames.allocate(NumNums); - thisBaseboard.FieldNames = state.dataIPShortCut->cNumericFieldNames; + thisBaseboard.FieldNames = s_ipsc->cNumericFieldNames; // ErrorsFound will be set to True if problem was found, left untouched otherwise VerifyUniqueBaseboardName( - state, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1), ErrorsFound, cCurrentModuleObject + " Name"); + state, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1), ErrorsFound, s_ipsc->cCurrentModuleObject + " Name"); - thisBaseboard.EquipID = state.dataIPShortCut->cAlphaArgs(1); // name of this baseboard + thisBaseboard.EquipID = s_ipsc->cAlphaArgs(1); // name of this baseboard thisBaseboard.EquipType = DataPlant::PlantEquipmentType::Baseboard_Conv_Water; - thisBaseboard.Schedule = state.dataIPShortCut->cAlphaArgs(2); - if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { - thisBaseboard.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisBaseboard.SchedPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); - if (thisBaseboard.SchedPtr == 0) { - ShowSevereError(state, - format("{}{}: invalid {} entered ={} for {}={}", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2), - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1))); - ErrorsFound = true; - } + thisBaseboard.Schedule = s_ipsc->cAlphaArgs(2); + if (s_ipsc->lAlphaFieldBlanks(2)) { + thisBaseboard.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisBaseboard.availSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); + ErrorsFound = true; } // get inlet node number thisBaseboard.WaterInletNode = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(3), + s_ipsc->cAlphaArgs(3), ErrorsFound, DataLoopNode::ConnectionObjectType::ZoneHVACBaseboardConvectiveWater, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, ObjectIsNotParent); // get outlet node number thisBaseboard.WaterOutletNode = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(4), + s_ipsc->cAlphaArgs(4), ErrorsFound, DataLoopNode::ConnectionObjectType::ZoneHVACBaseboardConvectiveWater, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Primary, ObjectIsNotParent); - TestCompSet(state, - cCMO_BBRadiator_Water, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaArgs(3), - state.dataIPShortCut->cAlphaArgs(4), - "Hot Water Nodes"); + TestCompSet(state, cCMO_BBRadiator_Water, s_ipsc->cAlphaArgs(1), s_ipsc->cAlphaArgs(3), s_ipsc->cAlphaArgs(4), "Hot Water Nodes"); // Determine steam baseboard radiator system heating design capacity sizing method - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum), "HeatingDesignCapacity")) { + if (Util::SameString(s_ipsc->cAlphaArgs(iHeatCAPMAlphaNum), "HeatingDesignCapacity")) { thisBaseboard.HeatingCapMethod = HeatingDesignCapacity; - if (!state.dataIPShortCut->lNumericFieldBlanks(iHeatDesignCapacityNumericNum)) { - thisBaseboard.ScaledHeatingCapacity = state.dataIPShortCut->rNumericArgs(iHeatDesignCapacityNumericNum); + if (!s_ipsc->lNumericFieldBlanks(iHeatDesignCapacityNumericNum)) { + thisBaseboard.ScaledHeatingCapacity = s_ipsc->rNumericArgs(iHeatDesignCapacityNumericNum); if (thisBaseboard.ScaledHeatingCapacity < 0.0 && thisBaseboard.ScaledHeatingCapacity != AutoSize) { ShowSevereError(state, format("{} = {}", cCMO_BBRadiator_Water, thisBaseboard.EquipID)); ShowContinueError(state, format("Illegal {} = {:.7T}", - state.dataIPShortCut->cNumericFieldNames(iHeatDesignCapacityNumericNum), - state.dataIPShortCut->rNumericArgs(iHeatDesignCapacityNumericNum))); + s_ipsc->cNumericFieldNames(iHeatDesignCapacityNumericNum), + s_ipsc->rNumericArgs(iHeatDesignCapacityNumericNum))); ErrorsFound = true; } } else { ShowSevereError(state, format("{} = {}", cCMO_BBRadiator_Water, thisBaseboard.EquipID)); - ShowContinueError(state, - format("Input for {} = {}", - state.dataIPShortCut->cAlphaFieldNames(iHeatCAPMAlphaNum), - state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum))); ShowContinueError( - state, format("Blank field not allowed for {}", state.dataIPShortCut->cNumericFieldNames(iHeatDesignCapacityNumericNum))); + state, format("Input for {} = {}", s_ipsc->cAlphaFieldNames(iHeatCAPMAlphaNum), s_ipsc->cAlphaArgs(iHeatCAPMAlphaNum))); + ShowContinueError(state, format("Blank field not allowed for {}", s_ipsc->cNumericFieldNames(iHeatDesignCapacityNumericNum))); ErrorsFound = true; } - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum), "CapacityPerFloorArea")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(iHeatCAPMAlphaNum), "CapacityPerFloorArea")) { thisBaseboard.HeatingCapMethod = CapacityPerFloorArea; - if (!state.dataIPShortCut->lNumericFieldBlanks(iHeatCapacityPerFloorAreaNumericNum)) { - thisBaseboard.ScaledHeatingCapacity = state.dataIPShortCut->rNumericArgs(iHeatCapacityPerFloorAreaNumericNum); + if (!s_ipsc->lNumericFieldBlanks(iHeatCapacityPerFloorAreaNumericNum)) { + thisBaseboard.ScaledHeatingCapacity = s_ipsc->rNumericArgs(iHeatCapacityPerFloorAreaNumericNum); if (thisBaseboard.ScaledHeatingCapacity <= 0.0) { ShowSevereError(state, format("{} = {}", cCMO_BBRadiator_Water, thisBaseboard.EquipID)); - ShowContinueError(state, - format("Input for {} = {}", - state.dataIPShortCut->cAlphaFieldNames(iHeatCAPMAlphaNum), - state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum))); + ShowContinueError( + state, + format("Input for {} = {}", s_ipsc->cAlphaFieldNames(iHeatCAPMAlphaNum), s_ipsc->cAlphaArgs(iHeatCAPMAlphaNum))); ShowContinueError(state, format("Illegal {} = {:.7T}", - state.dataIPShortCut->cNumericFieldNames(iHeatCapacityPerFloorAreaNumericNum), - state.dataIPShortCut->rNumericArgs(iHeatCapacityPerFloorAreaNumericNum))); + s_ipsc->cNumericFieldNames(iHeatCapacityPerFloorAreaNumericNum), + s_ipsc->rNumericArgs(iHeatCapacityPerFloorAreaNumericNum))); ErrorsFound = true; } else if (thisBaseboard.ScaledHeatingCapacity == AutoSize) { ShowSevereError(state, format("{} = {}", cCMO_BBRadiator_Water, thisBaseboard.EquipID)); - ShowContinueError(state, - format("Input for {} = {}", - state.dataIPShortCut->cAlphaFieldNames(iHeatCAPMAlphaNum), - state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum))); ShowContinueError( state, - format("Illegal {} = Autosize", state.dataIPShortCut->cNumericFieldNames(iHeatCapacityPerFloorAreaNumericNum))); + format("Input for {} = {}", s_ipsc->cAlphaFieldNames(iHeatCAPMAlphaNum), s_ipsc->cAlphaArgs(iHeatCAPMAlphaNum))); + ShowContinueError(state, + format("Illegal {} = Autosize", s_ipsc->cNumericFieldNames(iHeatCapacityPerFloorAreaNumericNum))); ErrorsFound = true; } } else { ShowSevereError(state, format("{} = {}", cCMO_BBRadiator_Water, thisBaseboard.EquipID)); - ShowContinueError(state, - format("Input for {} = {}", - state.dataIPShortCut->cAlphaFieldNames(iHeatCAPMAlphaNum), - state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum))); ShowContinueError( - state, - format("Blank field not allowed for {}", state.dataIPShortCut->cNumericFieldNames(iHeatCapacityPerFloorAreaNumericNum))); + state, format("Input for {} = {}", s_ipsc->cAlphaFieldNames(iHeatCAPMAlphaNum), s_ipsc->cAlphaArgs(iHeatCAPMAlphaNum))); + ShowContinueError(state, + format("Blank field not allowed for {}", s_ipsc->cNumericFieldNames(iHeatCapacityPerFloorAreaNumericNum))); ErrorsFound = true; } - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum), "FractionOfAutosizedHeatingCapacity")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(iHeatCAPMAlphaNum), "FractionOfAutosizedHeatingCapacity")) { thisBaseboard.HeatingCapMethod = FractionOfAutosizedHeatingCapacity; - if (!state.dataIPShortCut->lNumericFieldBlanks(iHeatFracOfAutosizedCapacityNumericNum)) { - thisBaseboard.ScaledHeatingCapacity = state.dataIPShortCut->rNumericArgs(iHeatFracOfAutosizedCapacityNumericNum); + if (!s_ipsc->lNumericFieldBlanks(iHeatFracOfAutosizedCapacityNumericNum)) { + thisBaseboard.ScaledHeatingCapacity = s_ipsc->rNumericArgs(iHeatFracOfAutosizedCapacityNumericNum); if (thisBaseboard.ScaledHeatingCapacity < 0.0) { ShowSevereError(state, format("{} = {}", cCMO_BBRadiator_Water, thisBaseboard.EquipID)); ShowContinueError(state, format("Illegal {} = {:.7T}", - state.dataIPShortCut->cNumericFieldNames(iHeatFracOfAutosizedCapacityNumericNum), - state.dataIPShortCut->rNumericArgs(iHeatFracOfAutosizedCapacityNumericNum))); + s_ipsc->cNumericFieldNames(iHeatFracOfAutosizedCapacityNumericNum), + s_ipsc->rNumericArgs(iHeatFracOfAutosizedCapacityNumericNum))); ErrorsFound = true; } } else { ShowSevereError(state, format("{} = {}", cCMO_BBRadiator_Water, thisBaseboard.EquipID)); - ShowContinueError(state, - format("Input for {} = {}", - state.dataIPShortCut->cAlphaFieldNames(iHeatCAPMAlphaNum), - state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum))); - ShowContinueError(state, - format("Blank field not allowed for {}", - state.dataIPShortCut->cNumericFieldNames(iHeatFracOfAutosizedCapacityNumericNum))); + ShowContinueError( + state, format("Input for {} = {}", s_ipsc->cAlphaFieldNames(iHeatCAPMAlphaNum), s_ipsc->cAlphaArgs(iHeatCAPMAlphaNum))); + ShowContinueError( + state, format("Blank field not allowed for {}", s_ipsc->cNumericFieldNames(iHeatFracOfAutosizedCapacityNumericNum))); ErrorsFound = true; } } else { ShowSevereError(state, format("{} = {}", cCMO_BBRadiator_Water, thisBaseboard.EquipID)); ShowContinueError(state, - format("Illegal {} = {}", - state.dataIPShortCut->cAlphaFieldNames(iHeatCAPMAlphaNum), - state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum))); + format("Illegal {} = {}", s_ipsc->cAlphaFieldNames(iHeatCAPMAlphaNum), s_ipsc->cAlphaArgs(iHeatCAPMAlphaNum))); ErrorsFound = true; } - thisBaseboard.UA = state.dataIPShortCut->rNumericArgs(4); - thisBaseboard.WaterVolFlowRateMax = state.dataIPShortCut->rNumericArgs(5); - thisBaseboard.Offset = state.dataIPShortCut->rNumericArgs(6); + thisBaseboard.UA = s_ipsc->rNumericArgs(4); + thisBaseboard.WaterVolFlowRateMax = s_ipsc->rNumericArgs(5); + thisBaseboard.Offset = s_ipsc->rNumericArgs(6); // Set default convergence tolerance if (thisBaseboard.Offset <= 0.0) { thisBaseboard.Offset = 0.001; @@ -543,19 +514,12 @@ namespace BaseboardRadiator { // Do the Begin Environment initializations if (state.dataGlobal->BeginEnvrnFlag && this->MyEnvrnFlag && !this->SetLoopIndexFlag) { int WaterInletNode = this->WaterInletNode; - Real64 rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); this->WaterMassFlowRateMax = rho * this->WaterVolFlowRateMax; PlantUtilities::InitComponentNodes(state, 0.0, this->WaterMassFlowRateMax, this->WaterInletNode, this->WaterOutletNode); state.dataLoopNodes->Node(WaterInletNode).Temp = Constant::HWInitConvTemp; - Real64 Cp = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(WaterInletNode).Temp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(WaterInletNode).Temp, RoutineName); state.dataLoopNodes->Node(WaterInletNode).Enthalpy = Cp * state.dataLoopNodes->Node(WaterInletNode).Temp; state.dataLoopNodes->Node(WaterInletNode).Quality = 0.0; state.dataLoopNodes->Node(WaterInletNode).Press = 0.0; @@ -611,9 +575,9 @@ namespace BaseboardRadiator { bool ErrorsFound(false); // If errors detected in input Real64 rho; // local fluid density Real64 Cp; // local fluid specific heat - Real64 WaterVolFlowRateMaxDes(0.0); // Design water volume flow for reproting + Real64 WaterVolFlowRateMaxDes(0.0); // Design water volume flow for reporting Real64 WaterVolFlowRateMaxUser(0.0); // User hard-sized volume flow for reporting - Real64 UADes(0.0); // Design UA value for reproting + Real64 UADes(0.0); // Design UA value for reporting Real64 UAUser(0.0); // User hard-sized value for reporting Real64 TempSize; // autosized value of coil input field @@ -685,16 +649,8 @@ namespace BaseboardRadiator { } if (DesCoilLoad >= SmallLoad) { - Cp = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); - rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, Constant::HWInitConvTemp, RoutineName); + rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); WaterVolFlowRateMaxDes = DesCoilLoad / (state.dataSize->PlantSizData(PltSizHeatNum).DeltaT * Cp * rho); } else { WaterVolFlowRateMaxDes = 0.0; @@ -736,7 +692,7 @@ namespace BaseboardRadiator { // UA sizing bool UAAutoSize = false; // Indicator to autosizing UA - // Set hard-sized values to the local variable to correct a false indication aftet SolFla function calculation + // Set hard-sized values to the local variable to correct a false indication after SolFla function calculation if (this->UA == DataSizing::AutoSize) { UAAutoSize = true; } else { @@ -753,11 +709,7 @@ namespace BaseboardRadiator { this->WaterInletTemp = state.dataSize->PlantSizData(PltSizHeatNum).ExitTemp; this->AirInletTemp = finalZoneSizing.ZoneTempAtHeatPeak; this->AirInletHumRat = finalZoneSizing.ZoneHumRatAtHeatPeak; - rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); state.dataLoopNodes->Node(this->WaterInletNode).MassFlowRate = rho * this->WaterVolFlowRateMax; std::string_view const CompType = cCMO_BBRadiator_Water; @@ -924,7 +876,7 @@ namespace BaseboardRadiator { } } } else { - // if there is no heating Sizing:Plant object and autosizng was requested, issue an error message + // if there is no heating Sizing:Plant object and autosizing was requested, issue an error message if (this->WaterVolFlowRateMax == DataSizing::AutoSize || this->UA == DataSizing::AutoSize) { ShowSevereError(state, format("SizeBaseboard: {}=\"{}\"", cCMO_BBRadiator_Water, this->EquipID)); ShowContinueError(state, "...Autosizing of hot water baseboard requires a heating loop Sizing:Plant object"); @@ -1003,42 +955,38 @@ namespace BaseboardRadiator { Real64 CC; Real64 QZnReq; - auto &baseboard = state.dataBaseboardRadiator; + auto &baseboard = state.dataBaseboardRadiator->baseboards(BaseboardNum); - ZoneNum = baseboard->baseboards(BaseboardNum).ZonePtr; + ZoneNum = baseboard.ZonePtr; QZnReq = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).RemainingOutputReqToHeatSP; - if (baseboard->baseboards(BaseboardNum).MySizeFlag) + if (baseboard.MySizeFlag) QZnReq = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).NonAirSysDesHeatLoad; // If in sizing, assign design condition - WaterInletTemp = baseboard->baseboards(BaseboardNum).WaterInletTemp; - AirInletTemp = baseboard->baseboards(BaseboardNum).AirInletTemp; + WaterInletTemp = baseboard.WaterInletTemp; + AirInletTemp = baseboard.AirInletTemp; - CpWater = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(baseboard->baseboards(BaseboardNum).plantLoc.loopNum).FluidName, - WaterInletTemp, - state.dataPlnt->PlantLoop(baseboard->baseboards(BaseboardNum).plantLoc.loopNum).FluidIndex, - RoutineName); - CpAir = PsyCpAirFnW(baseboard->baseboards(BaseboardNum).AirInletHumRat); + CpWater = state.dataPlnt->PlantLoop(baseboard.plantLoc.loopNum).glycol->getSpecificHeat(state, WaterInletTemp, RoutineName); + CpAir = PsyCpAirFnW(baseboard.AirInletHumRat); - if (baseboard->baseboards(BaseboardNum).DesAirMassFlowRate > 0.0) { // If UA is autosized, assign design condition - AirMassFlowRate = baseboard->baseboards(BaseboardNum).DesAirMassFlowRate; + if (baseboard.DesAirMassFlowRate > 0.0) { // If UA is autosized, assign design condition + AirMassFlowRate = baseboard.DesAirMassFlowRate; } else { - AirMassFlowRate = baseboard->baseboards(BaseboardNum).AirMassFlowRate; + AirMassFlowRate = baseboard.AirMassFlowRate; // pick a mass flow rate that depends on the max water mass flow rate. CR 8842 changed to factor of 2.0 - if (AirMassFlowRate <= 0.0) AirMassFlowRate = 2.0 * baseboard->baseboards(BaseboardNum).WaterMassFlowRateMax; + if (AirMassFlowRate <= 0.0) AirMassFlowRate = 2.0 * baseboard.WaterMassFlowRateMax; } - WaterMassFlowRate = state.dataLoopNodes->Node(baseboard->baseboards(BaseboardNum).WaterInletNode).MassFlowRate; + WaterMassFlowRate = state.dataLoopNodes->Node(baseboard.WaterInletNode).MassFlowRate; CapacitanceAir = CpAir * AirMassFlowRate; - if (QZnReq > SmallLoad && (!state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) || baseboard->baseboards(BaseboardNum).MySizeFlag) && - (GetCurrentScheduleValue(state, baseboard->baseboards(BaseboardNum).SchedPtr) > 0 || baseboard->baseboards(BaseboardNum).MySizeFlag) && - (WaterMassFlowRate > 0.0)) { + if (QZnReq > SmallLoad && (!state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) || baseboard.MySizeFlag) && + (baseboard.availSched->getCurrentVal() > 0 || baseboard.MySizeFlag) && (WaterMassFlowRate > 0.0)) { + CapacitanceWater = CpWater * WaterMassFlowRate; CapacitanceMax = max(CapacitanceAir, CapacitanceWater); CapacitanceMin = min(CapacitanceAir, CapacitanceWater); CapacityRatio = CapacitanceMin / CapacitanceMax; - NTU = baseboard->baseboards(BaseboardNum).UA / CapacitanceMin; + NTU = baseboard.UA / CapacitanceMin; // The effectiveness is given by the following formula: // Effectiveness = 1. - EXP((1./CapacityRatio)*(NTU)**0.22*(EXP(-CapacityRatio*(NTU)**0.78)-1.)) // To prevent possible underflows (numbers smaller than the computer can handle) we must break @@ -1058,25 +1006,23 @@ namespace BaseboardRadiator { AirOutletTemp = AirInletTemp + Effectiveness * CapacitanceMin * (WaterInletTemp - AirInletTemp) / CapacitanceAir; WaterOutletTemp = WaterInletTemp - CapacitanceAir * (AirOutletTemp - AirInletTemp) / CapacitanceWater; LoadMet = CapacitanceWater * (WaterInletTemp - WaterOutletTemp); - baseboard->baseboards(BaseboardNum).WaterOutletEnthalpy = - baseboard->baseboards(BaseboardNum).WaterInletEnthalpy - LoadMet / WaterMassFlowRate; + baseboard.WaterOutletEnthalpy = baseboard.WaterInletEnthalpy - LoadMet / WaterMassFlowRate; } else { AirOutletTemp = AirInletTemp; WaterOutletTemp = WaterInletTemp; LoadMet = 0.0; - baseboard->baseboards(BaseboardNum).WaterOutletEnthalpy = baseboard->baseboards(BaseboardNum).WaterInletEnthalpy; + baseboard.WaterOutletEnthalpy = baseboard.WaterInletEnthalpy; WaterMassFlowRate = 0.0; - SetActuatedBranchFlowRate( - state, WaterMassFlowRate, baseboard->baseboards(BaseboardNum).WaterInletNode, baseboard->baseboards(BaseboardNum).plantLoc, false); + SetActuatedBranchFlowRate(state, WaterMassFlowRate, baseboard.WaterInletNode, baseboard.plantLoc, false); AirMassFlowRate = 0.0; } - baseboard->baseboards(BaseboardNum).WaterOutletTemp = WaterOutletTemp; - baseboard->baseboards(BaseboardNum).AirOutletTemp = AirOutletTemp; - baseboard->baseboards(BaseboardNum).Power = LoadMet; - baseboard->baseboards(BaseboardNum).WaterMassFlowRate = WaterMassFlowRate; - baseboard->baseboards(BaseboardNum).AirMassFlowRate = AirMassFlowRate; + baseboard.WaterOutletTemp = WaterOutletTemp; + baseboard.AirOutletTemp = AirOutletTemp; + baseboard.Power = LoadMet; + baseboard.WaterMassFlowRate = WaterMassFlowRate; + baseboard.AirMassFlowRate = AirMassFlowRate; } void UpdateBaseboard(EnergyPlusData &state, int &BaseboardNum) diff --git a/src/EnergyPlus/BaseboardRadiator.hh b/src/EnergyPlus/BaseboardRadiator.hh index 7dc8a51adb3..e88deb72d2b 100644 --- a/src/EnergyPlus/BaseboardRadiator.hh +++ b/src/EnergyPlus/BaseboardRadiator.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -69,7 +69,7 @@ namespace BaseboardRadiator { // Members std::string EquipID; std::string Schedule; - int SchedPtr = 0; + Sched::Schedule *availSched = nullptr; DataPlant::PlantEquipmentType EquipType = DataPlant::PlantEquipmentType::Invalid; int ZonePtr = 0; int WaterInletNode = 0; @@ -128,6 +128,10 @@ struct BaseboardRadiatorData : BaseGlobalStruct bool getInputFlag = true; EPVector baseboards; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/BoilerSteam.cc b/src/EnergyPlus/BoilerSteam.cc index 8cb9a6534dd..25708ab0975 100644 --- a/src/EnergyPlus/BoilerSteam.cc +++ b/src/EnergyPlus/BoilerSteam.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -50,7 +50,7 @@ // ObjexxFCL Headers #include -#include +// #include // EnergyPlus Headers #include @@ -87,8 +87,6 @@ namespace BoilerSteam { // PURPOSE OF THIS MODULE: // Performs steam boiler simulation for plant simulation - const char *fluidNameSteam = "STEAM"; - BoilerSpecs *BoilerSpecs::factory(EnergyPlusData &state, std::string const &objectName) { // Process the input data for boilers if it hasn't been done already @@ -148,16 +146,15 @@ namespace BoilerSteam { // Locals static constexpr std::string_view RoutineName("GetBoilerInput: "); + static constexpr std::string_view routineName = "GetBoilerInput"; // LOCAL VARIABLES - int BoilerNum; // boiler identifier - int NumAlphas; // Number of elements in the alpha array - int NumNums; // Number of elements in the numeric array - int IOStat; // IO Status when calling get input subroutine - int SteamFluidIndex; // Fluid Index for Steam + int BoilerNum; // boiler identifier + int NumAlphas; // Number of elements in the alpha array + int NumNums; // Number of elements in the numeric array + int IOStat; // IO Status when calling get input subroutine bool ErrorsFound(false); - SteamFluidIndex = 0; state.dataIPShortCut->cCurrentModuleObject = "Boiler:Steam"; int numBoilers = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, state.dataIPShortCut->cCurrentModuleObject); @@ -186,6 +183,7 @@ namespace BoilerSteam { _, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + // ErrorsFound will be set to True if problem was found, left untouched otherwise GlobalNames::VerifyUniqueBoilerName(state, state.dataIPShortCut->cCurrentModuleObject, @@ -266,18 +264,12 @@ namespace BoilerSteam { state.dataIPShortCut->cAlphaArgs(4), "Hot Steam Nodes"); - if (SteamFluidIndex == 0 && BoilerNum == 1) { - SteamFluidIndex = FluidProperties::GetRefrigNum(state, fluidNameSteam); // Steam is a refrigerant? - if (SteamFluidIndex == 0) { - ShowSevereError( - state, format("{}{}=\"{}\",", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "Steam Properties not found; Steam Fluid Properties must be included in the input file."); - ErrorsFound = true; - } + thisBoiler.fluid = Fluid::GetSteam(state); + if (thisBoiler.fluid == nullptr && BoilerNum == 1) { + ShowSevereError(state, "Fluid Properties for STEAM not found."); + ErrorsFound = true; } - thisBoiler.FluidIndex = SteamFluidIndex; - if (NumAlphas > 4) { thisBoiler.EndUseSubcategory = state.dataIPShortCut->cAlphaArgs(5); } else { @@ -306,14 +298,11 @@ namespace BoilerSteam { int BoilerInletNode = this->BoilerInletNodeNum; - Real64 EnthSteamOutDry = - FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, this->TempUpLimitBoilerOut, 1.0, this->FluidIndex, RoutineName); - Real64 EnthSteamOutWet = - FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, this->TempUpLimitBoilerOut, 0.0, this->FluidIndex, RoutineName); + Real64 EnthSteamOutDry = this->fluid->getSatEnthalpy(state, this->TempUpLimitBoilerOut, 1.0, RoutineName); + Real64 EnthSteamOutWet = this->fluid->getSatEnthalpy(state, this->TempUpLimitBoilerOut, 0.0, RoutineName); Real64 LatentEnthSteam = EnthSteamOutDry - EnthSteamOutWet; - Real64 CpWater = - FluidProperties::GetSatSpecificHeatRefrig(state, fluidNameSteam, this->TempUpLimitBoilerOut, 0.0, this->FluidIndex, RoutineName); + Real64 CpWater = this->fluid->getSatSpecificHeat(state, this->TempUpLimitBoilerOut, 0.0, RoutineName); this->DesMassFlowRate = this->NomCap / (LatentEnthSteam + CpWater * (this->TempUpLimitBoilerOut - state.dataLoopNodes->Node(BoilerInletNode).Temp)); @@ -500,11 +489,11 @@ namespace BoilerSteam { if (PltSizNum > 0) { if (state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { Real64 SizingTemp = this->TempUpLimitBoilerOut; - Real64 SteamDensity = FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, SizingTemp, 1.0, this->FluidIndex, RoutineName); - Real64 EnthSteamOutDry = FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, SizingTemp, 1.0, this->FluidIndex, RoutineName); - Real64 EnthSteamOutWet = FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, SizingTemp, 0.0, this->FluidIndex, RoutineName); + Real64 SteamDensity = this->fluid->getSatDensity(state, SizingTemp, 1.0, RoutineName); + Real64 EnthSteamOutDry = this->fluid->getSatEnthalpy(state, SizingTemp, 1.0, RoutineName); + Real64 EnthSteamOutWet = this->fluid->getSatEnthalpy(state, SizingTemp, 0.0, RoutineName); Real64 LatentEnthSteam = EnthSteamOutDry - EnthSteamOutWet; - Real64 CpWater = FluidProperties::GetSatSpecificHeatRefrig(state, fluidNameSteam, SizingTemp, 0.0, this->FluidIndex, RoutineName); + Real64 CpWater = this->fluid->getSatSpecificHeat(state, SizingTemp, 0.0, RoutineName); tmpNomCap = (CpWater * SteamDensity * this->SizFac * state.dataSize->PlantSizData(PltSizNum).DeltaT * state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate + state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate * SteamDensity * LatentEnthSteam); @@ -677,7 +666,7 @@ namespace BoilerSteam { // Set the current load equal to the boiler load this->BoilerLoad = MyLoad; - this->BoilerPressCheck = FluidProperties::GetSatPressureRefrig(state, fluidNameSteam, this->BoilerOutletTemp, this->FluidIndex, RoutineName); + this->BoilerPressCheck = this->fluid->getSatPressure(state, this->BoilerOutletTemp, RoutineName); if ((this->BoilerPressCheck) > this->BoilerMaxOperPress) { if (this->PressErrIndex == 0) { @@ -697,8 +686,7 @@ namespace BoilerSteam { "[Pa]"); } - CpWater = FluidProperties::GetSatSpecificHeatRefrig( - state, fluidNameSteam, state.dataLoopNodes->Node(this->BoilerInletNodeNum).Temp, 0.0, this->FluidIndex, RoutineName); + CpWater = this->fluid->getSatSpecificHeat(state, state.dataLoopNodes->Node(this->BoilerInletNodeNum).Temp, 0.0, RoutineName); if (state.dataPlnt->PlantLoop(this->plantLoc.loopNum).LoopSide(this->plantLoc.loopSideNum).FlowLock == DataPlant::FlowLock::Unlocked) { // TODO: Components shouldn't check FlowLock @@ -716,10 +704,8 @@ namespace BoilerSteam { } this->BoilerOutletTemp = BoilerDeltaTemp + state.dataLoopNodes->Node(this->BoilerInletNodeNum).Temp; - Real64 const EnthSteamOutDry = - FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, this->BoilerOutletTemp, 1.0, this->FluidIndex, RoutineName); - Real64 const EnthSteamOutWet = - FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, this->BoilerOutletTemp, 0.0, this->FluidIndex, RoutineName); + Real64 const EnthSteamOutDry = this->fluid->getSatEnthalpy(state, this->BoilerOutletTemp, 1.0, RoutineName); + Real64 const EnthSteamOutWet = this->fluid->getSatEnthalpy(state, this->BoilerOutletTemp, 0.0, RoutineName); Real64 const LatentEnthSteam = EnthSteamOutDry - EnthSteamOutWet; this->BoilerMassFlowRate = this->BoilerLoad / (LatentEnthSteam + (CpWater * BoilerDeltaTemp)); @@ -754,10 +740,8 @@ namespace BoilerSteam { default: break; } - Real64 const EnthSteamOutDry = - FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, this->BoilerOutletTemp, 1.0, this->FluidIndex, RoutineName); - Real64 const EnthSteamOutWet = - FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, this->BoilerOutletTemp, 0.0, this->FluidIndex, RoutineName); + Real64 const EnthSteamOutDry = this->fluid->getSatEnthalpy(state, this->BoilerOutletTemp, 1.0, RoutineName); + Real64 const EnthSteamOutWet = this->fluid->getSatEnthalpy(state, this->BoilerOutletTemp, 0.0, RoutineName); Real64 const LatentEnthSteam = EnthSteamOutDry - EnthSteamOutWet; this->BoilerLoad = (this->BoilerMassFlowRate * LatentEnthSteam); @@ -773,10 +757,8 @@ namespace BoilerSteam { break; } - Real64 const EnthSteamOutDry = - FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, this->BoilerOutletTemp, 1.0, this->FluidIndex, RoutineName); - Real64 const EnthSteamOutWet = - FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, this->BoilerOutletTemp, 0.0, this->FluidIndex, RoutineName); + Real64 const EnthSteamOutDry = this->fluid->getSatEnthalpy(state, this->BoilerOutletTemp, 1.0, RoutineName); + Real64 const EnthSteamOutWet = this->fluid->getSatEnthalpy(state, this->BoilerOutletTemp, 0.0, RoutineName); Real64 const LatentEnthSteam = EnthSteamOutDry - EnthSteamOutWet; this->BoilerLoad = std::abs(this->BoilerMassFlowRate * LatentEnthSteam) + std::abs(this->BoilerMassFlowRate * CpWater * BoilerDeltaTemp); @@ -798,10 +780,8 @@ namespace BoilerSteam { break; } - Real64 const EnthSteamOutDry = - FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, this->BoilerOutletTemp, 1.0, this->FluidIndex, RoutineName); - Real64 const EnthSteamOutWet = - FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, this->BoilerOutletTemp, 0.0, this->FluidIndex, RoutineName); + Real64 const EnthSteamOutDry = this->fluid->getSatEnthalpy(state, this->BoilerOutletTemp, 1.0, RoutineName); + Real64 const EnthSteamOutWet = this->fluid->getSatEnthalpy(state, this->BoilerOutletTemp, 0.0, RoutineName); Real64 const LatentEnthSteam = EnthSteamOutDry - EnthSteamOutWet; BoilerDeltaTemp = this->BoilerOutletTemp - state.dataLoopNodes->Node(this->BoilerInletNodeNum).Temp; this->BoilerMassFlowRate = this->BoilerLoad / (LatentEnthSteam + CpWater * BoilerDeltaTemp); @@ -815,10 +795,8 @@ namespace BoilerSteam { if (this->BoilerMassFlowRate > DataBranchAirLoopPlant::MassFlowTolerance) { this->BoilerLoad = this->NomCap; - Real64 const EnthSteamOutDry = - FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, this->BoilerOutletTemp, 1.0, this->FluidIndex, RoutineName); - Real64 const EnthSteamOutWet = - FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, this->BoilerOutletTemp, 0.0, this->FluidIndex, RoutineName); + Real64 const EnthSteamOutDry = this->fluid->getSatEnthalpy(state, this->BoilerOutletTemp, 1.0, RoutineName); + Real64 const EnthSteamOutWet = this->fluid->getSatEnthalpy(state, this->BoilerOutletTemp, 0.0, RoutineName); Real64 const LatentEnthSteam = EnthSteamOutDry - EnthSteamOutWet; BoilerDeltaTemp = this->BoilerOutletTemp - state.dataLoopNodes->Node(this->BoilerInletNodeNum).Temp; this->BoilerMassFlowRate = this->BoilerLoad / (LatentEnthSteam + CpWater * BoilerDeltaTemp); diff --git a/src/EnergyPlus/BoilerSteam.hh b/src/EnergyPlus/BoilerSteam.hh index 406fb74a0ae..64c2785d4cd 100644 --- a/src/EnergyPlus/BoilerSteam.hh +++ b/src/EnergyPlus/BoilerSteam.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -96,9 +97,9 @@ namespace BoilerSteam { std::array FullLoadCoef = {0.0}; // Coefficients of the fuel consumption/part load ratio curve int TypeNum = 0; // Plant loop type identifier PlantLocation plantLoc; - int PressErrIndex = 0; // index pointer for recurring errors - int FluidIndex = 0; // Steam index - std::string EndUseSubcategory; // identifier use for the end use subcategory + int PressErrIndex = 0; // index pointer for recurring errors + Fluid::RefrigProps *fluid = nullptr; // Steam fluid properties + std::string EndUseSubcategory; // identifier use for the end use subcategory bool myFlag = true; bool myEnvrnFlag = true; @@ -162,6 +163,10 @@ struct BoilerSteamData : BaseGlobalStruct bool getSteamBoilerInput = true; Array1D Boiler; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/Boilers.cc b/src/EnergyPlus/Boilers.cc index dd0e9e9d5a0..b464882fac4 100644 --- a/src/EnergyPlus/Boilers.cc +++ b/src/EnergyPlus/Boilers.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -50,7 +50,6 @@ // ObjexxFCL Headers #include -#include // EnergyPlus Headers #include @@ -507,11 +506,7 @@ void BoilerSpecs::oneTimeInit(EnergyPlusData &state) void BoilerSpecs::initEachEnvironment(EnergyPlusData &state) { static constexpr std::string_view RoutineName("BoilerSpecs::initEachEnvironment"); - Real64 const rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 const rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); this->DesMassFlowRate = this->VolFlowRate * rho; PlantUtilities::InitComponentNodes(state, 0.0, this->DesMassFlowRate, this->BoilerInletNodeNum, this->BoilerOutletNodeNum); @@ -624,16 +619,8 @@ void BoilerSpecs::SizeBoiler(EnergyPlusData &state) if (PltSizNum > 0) { if (state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { - Real64 const rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); - Real64 const Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 const rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); + Real64 const Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, Constant::HWInitConvTemp, RoutineName); tmpNomCap = Cp * rho * this->SizFac * state.dataSize->PlantSizData(PltSizNum).DeltaT * state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate; } else { @@ -815,11 +802,8 @@ void BoilerSpecs::CalcBoilerModel(EnergyPlusData &state, Real64 const TempUpLimitBout = this->TempUpLimitBoilerOut; // C - boiler high temperature limit Real64 const BoilerMassFlowRateMax = this->DesMassFlowRate; // Max Design Boiler Mass Flow Rate converted from Volume Flow Rate - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(BoilerInletNode).Temp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(BoilerInletNode).Temp, RoutineName); // If the specified load is 0.0 or the boiler should not run then we leave this subroutine. Before leaving // if the component control is SERIESACTIVE we set the component flow to inlet flow so that flow resolver @@ -879,7 +863,7 @@ void BoilerSpecs::CalcBoilerModel(EnergyPlusData &state, if ((BoilerDeltaTemp > 0.0) && (this->BoilerLoad > 0.0)) { this->BoilerMassFlowRate = this->BoilerLoad / Cp / BoilerDeltaTemp; - this->BoilerMassFlowRate = min(BoilerMassFlowRateMax, this->BoilerMassFlowRate); + this->BoilerMassFlowRate = std::min(BoilerMassFlowRateMax, this->BoilerMassFlowRate); } else { this->BoilerMassFlowRate = 0.0; } @@ -908,8 +892,8 @@ void BoilerSpecs::CalcBoilerModel(EnergyPlusData &state, this->BoilerOutletTemp = state.dataLoopNodes->Node(BoilerInletNode).Temp; } this->BoilerPLR = this->BoilerLoad / BoilerNomCap; // operating part load ratio - this->BoilerPLR = min(this->BoilerPLR, BoilerMaxPLR); - this->BoilerPLR = max(this->BoilerPLR, BoilerMinPLR); + this->BoilerPLR = std::min(this->BoilerPLR, BoilerMaxPLR); + this->BoilerPLR = std::max(this->BoilerPLR, BoilerMinPLR); // calculate theoretical fuel use based on nominal thermal efficiency Real64 const TheorFuelUse = this->BoilerLoad / BoilerNomEff; // Theoretical (stoichiometric) fuel use diff --git a/src/EnergyPlus/Boilers.hh b/src/EnergyPlus/Boilers.hh index 873c67c634a..baf3cdbebfe 100644 --- a/src/EnergyPlus/Boilers.hh +++ b/src/EnergyPlus/Boilers.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -189,6 +189,10 @@ struct BoilersData : BaseGlobalStruct bool getBoilerInputFlag = true; Array1D Boiler; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/BranchInputManager.cc b/src/EnergyPlus/BranchInputManager.cc index 4e7c1508110..ee7b54d27c9 100644 --- a/src/EnergyPlus/BranchInputManager.cc +++ b/src/EnergyPlus/BranchInputManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -1322,7 +1322,7 @@ namespace BranchInputManager { } else { state.dataBranchInputManager->BranchList(BCount).BranchNames({1, NumAlphas - 1}) = Alphas({2, NumAlphas}); for (Loop = 1; Loop <= state.dataBranchInputManager->BranchList(BCount).NumOfBranchNames; ++Loop) { - // If NumOfBranches = 0 then Branches havent been read yet. + // If NumOfBranches = 0 then Branches haven't been read yet. if ((int)state.dataBranchInputManager->Branch.size() == 0) { GetBranchInput(state); } @@ -2251,7 +2251,7 @@ namespace BranchInputManager { // DATE WRITTEN February 2008 // PURPOSE OF THIS SUBROUTINE: - // An auxiliary routine locate a Airenser loop and type from a BranchListName + // An auxiliary routine to locate a Air condenser loop and type from a BranchListName // METHODOLOGY EMPLOYED: // calls GetObject for PRIMARY AIR LOOP diff --git a/src/EnergyPlus/BranchInputManager.hh b/src/EnergyPlus/BranchInputManager.hh index 5b7c5e7b33d..3a69f1dd406 100644 --- a/src/EnergyPlus/BranchInputManager.hh +++ b/src/EnergyPlus/BranchInputManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -317,6 +317,10 @@ struct BranchInputManagerData : BaseGlobalStruct Array1D Mixers; // Mixer Data for each Mixer Array1D BComponents; // Component data to be returned + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/BranchNodeConnections.cc b/src/EnergyPlus/BranchNodeConnections.cc index 4f5a6c3c547..ee374524c8d 100644 --- a/src/EnergyPlus/BranchNodeConnections.cc +++ b/src/EnergyPlus/BranchNodeConnections.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/BranchNodeConnections.hh b/src/EnergyPlus/BranchNodeConnections.hh index 44af9c25f18..fb0e407bf40 100644 --- a/src/EnergyPlus/BranchNodeConnections.hh +++ b/src/EnergyPlus/BranchNodeConnections.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/CMakeLists.txt b/src/EnergyPlus/CMakeLists.txt index 2570f70de51..bf94f5b216e 100644 --- a/src/EnergyPlus/CMakeLists.txt +++ b/src/EnergyPlus/CMakeLists.txt @@ -1147,7 +1147,25 @@ if(BUILD_TESTING) COMMAND energyplus -D -d "${CLI_TEST_DIR}/PythonPlugin.FromOutside/out-${NON_ASCII_DIRNAME}" ${NON_ASCII_DIRNAME}/${TEST_CASE}.idf WORKING_DIRECTORY "${CLI_TEST_DIR}" ) + + set(TEST_DIR "${PROJECT_BINARY_DIR}/tst/api/TestRuntimeReleasesTheGIL") + file(MAKE_DIRECTORY ${TEST_DIR}) + add_test(NAME "API.Runtime.PythonPlugin.TestRuntimeReleasesTheGIL" + COMMAND "${Python_EXECUTABLE}" "${PROJECT_SOURCE_DIR}/tst/EnergyPlus/api/TestRuntimeReleasesTheGIL.py" -d "${TEST_DIR}" -w "${EPW_FILE}" -D "${PROJECT_SOURCE_DIR}/tst/EnergyPlus/api/TestRuntimeReleasesTheGIL/mcve_gil.idf" + ) + set_tests_properties("API.Runtime.PythonPlugin.TestRuntimeReleasesTheGIL" + PROPERTIES + ENVIRONMENT PYTHONPATH=${DIR_WITH_PY_ENERGYPLUS} + TIMEOUT 10 # This used to timeout! and we expect it NOT to + ) endif() + + if(Pytest_AVAILABLE) + add_test(NAME energyplus.TabularXML_IsValid + COMMAND ${Python_EXECUTABLE} -m pytest --verbose --ep-cli-path $ "${PROJECT_SOURCE_DIR}/scripts/pytests/test_xml_output.py" + ) + endif() + endif() if(UNIX AND NOT APPLE) diff --git a/src/EnergyPlus/CTElectricGenerator.cc b/src/EnergyPlus/CTElectricGenerator.cc index db8b1b92d94..6a181e4e8af 100644 --- a/src/EnergyPlus/CTElectricGenerator.cc +++ b/src/EnergyPlus/CTElectricGenerator.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -555,11 +555,7 @@ namespace CTElectricGenerator { int heatRecInNode = this->HeatRecInletNodeNum; heatRecInTemp = state.dataLoopNodes->Node(heatRecInNode).Temp; - heatRecCp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidName, - heatRecInTemp, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidIndex, - RoutineName); + heatRecCp = state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).glycol->getSpecificHeat(state, heatRecInTemp, RoutineName); if (FirstHVACIteration && RunFlag) { heatRecMdot = this->DesignHeatRecMassFlowRate; } else { @@ -810,11 +806,7 @@ namespace CTElectricGenerator { int HeatRecOutletNode = this->HeatRecOutletNodeNum; // size mass flow rate - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); this->DesignHeatRecMassFlowRate = rho * this->DesignHeatRecVolFlowRate; diff --git a/src/EnergyPlus/CTElectricGenerator.hh b/src/EnergyPlus/CTElectricGenerator.hh index f6ab8913a29..30f05aca91a 100644 --- a/src/EnergyPlus/CTElectricGenerator.hh +++ b/src/EnergyPlus/CTElectricGenerator.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -155,6 +155,10 @@ struct CTElectricGeneratorData : BaseGlobalStruct bool getCTInputFlag = true; Array1D CTGenerator; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ChilledCeilingPanelSimple.cc b/src/EnergyPlus/ChilledCeilingPanelSimple.cc index 811b5aead15..9c310df141f 100644 --- a/src/EnergyPlus/ChilledCeilingPanelSimple.cc +++ b/src/EnergyPlus/ChilledCeilingPanelSimple.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -218,6 +218,7 @@ void GetCoolingPanelInput(EnergyPlusData &state) // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetCoolingPanelInput:"); + static constexpr std::string_view routineName = "GetCoolingPanelInput"; Real64 constexpr MaxFraction(1.0); Real64 constexpr MinFraction(0.0); Real64 constexpr MaxWaterTempAvg(30.0); // Maximum limit of average water temperature in degree C @@ -246,6 +247,7 @@ void GetCoolingPanelInput(EnergyPlusData &state) bool ErrorsFound(false); // If errors detected in input int NumCoolingPanels = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCMO_CoolingPanel_Simple); + auto &s_ipsc = state.dataIPShortCut; // Count total number of baseboard units state.dataChilledCeilingPanelSimple->CoolingPanel.allocate(NumCoolingPanels); @@ -256,59 +258,51 @@ void GetCoolingPanelInput(EnergyPlusData &state) state.dataInputProcessing->inputProcessor->getObjectItem(state, cCMO_CoolingPanel_Simple, CoolingPanelNum, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cCMO_CoolingPanel_Simple, s_ipsc->cAlphaArgs(1)}; state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).FieldNames.allocate(NumNumbers); state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).FieldNames = ""; - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).FieldNames = state.dataIPShortCut->cNumericFieldNames; + state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).FieldNames = s_ipsc->cNumericFieldNames; if (CoolingPanelNum > 1) { for (int CoolPanelNumI = 2; CoolPanelNumI <= NumCoolingPanels; ++CoolPanelNumI) { - if (state.dataIPShortCut->cAlphaArgs(1) == state.dataChilledCeilingPanelSimple->CoolingPanel(CoolPanelNumI).Name) { + if (s_ipsc->cAlphaArgs(1) == state.dataChilledCeilingPanelSimple->CoolingPanel(CoolPanelNumI).Name) { ErrorsFound = true; - ShowSevereError(state, - format("{} is used as a name for more than one simple COOLING PANEL.", state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("{} is used as a name for more than one simple COOLING PANEL.", s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "This is not allowed."); } } } auto &thisCP(state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum)); - thisCP.Name = state.dataIPShortCut->cAlphaArgs(1); // Name of this simple cooling panel + thisCP.Name = s_ipsc->cAlphaArgs(1); // Name of this simple cooling panel thisCP.EquipType = DataPlant::PlantEquipmentType::CoolingPanel_Simple; //'ZoneHVAC:CoolingPanel:RadiantConvective:Water' // Get schedule - thisCP.Schedule = state.dataIPShortCut->cAlphaArgs(2); - if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { - thisCP.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisCP.SchedPtr = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); - if (thisCP.SchedPtr == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}=\"{}\" not found.", - RoutineName, - cCMO_CoolingPanel_Simple, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); - ErrorsFound = true; - } + thisCP.Schedule = s_ipsc->cAlphaArgs(2); + if (s_ipsc->lAlphaFieldBlanks(2)) { + thisCP.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisCP.availSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); + ErrorsFound = true; } // Get inlet node number thisCP.WaterInletNode = NodeInputManager::GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(3), + s_ipsc->cAlphaArgs(3), ErrorsFound, DataLoopNode::ConnectionObjectType::ZoneHVACCoolingPanelRadiantConvectiveWater, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, @@ -316,29 +310,25 @@ void GetCoolingPanelInput(EnergyPlusData &state) // Get outlet node number thisCP.WaterOutletNode = NodeInputManager::GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(4), + s_ipsc->cAlphaArgs(4), ErrorsFound, DataLoopNode::ConnectionObjectType::ZoneHVACCoolingPanelRadiantConvectiveWater, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsNotParent); - BranchNodeConnections::TestCompSet(state, - cCMO_CoolingPanel_Simple, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaArgs(3), - state.dataIPShortCut->cAlphaArgs(4), - "Chilled Water Nodes"); - - thisCP.RatedWaterTemp = state.dataIPShortCut->rNumericArgs(1); + BranchNodeConnections::TestCompSet( + state, cCMO_CoolingPanel_Simple, s_ipsc->cAlphaArgs(1), s_ipsc->cAlphaArgs(3), s_ipsc->cAlphaArgs(4), "Chilled Water Nodes"); + + thisCP.RatedWaterTemp = s_ipsc->rNumericArgs(1); if (thisCP.RatedWaterTemp > MaxWaterTempAvg + 0.001) { ShowWarningError(state, format("{}{}=\"{}\", {} was higher than the allowable maximum.", RoutineName, cCMO_CoolingPanel_Simple, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(1))); + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(1))); ShowContinueError(state, format("...reset to maximum value=[{:.2R}].", MaxWaterTempAvg)); thisCP.RatedWaterTemp = MaxWaterTempAvg; } else if (thisCP.RatedWaterTemp < MinWaterTempAvg - 0.001) { @@ -346,20 +336,20 @@ void GetCoolingPanelInput(EnergyPlusData &state) format("{}{}=\"{}\", {} was lower than the allowable minimum.", RoutineName, cCMO_CoolingPanel_Simple, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(1))); + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(1))); ShowContinueError(state, format("...reset to minimum value=[{:.2R}].", MinWaterTempAvg)); thisCP.RatedWaterTemp = MinWaterTempAvg; } - thisCP.RatedZoneAirTemp = state.dataIPShortCut->rNumericArgs(2); + thisCP.RatedZoneAirTemp = s_ipsc->rNumericArgs(2); if (thisCP.RatedZoneAirTemp > MaxWaterTempAvg + 0.001) { ShowWarningError(state, format("{}{}=\"{}\", {} was higher than the allowable maximum.", RoutineName, cCMO_CoolingPanel_Simple, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(2))); + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(2))); ShowContinueError(state, format("...reset to maximum value=[{:.2R}].", MaxWaterTempAvg)); thisCP.RatedZoneAirTemp = MaxWaterTempAvg; } else if (thisCP.RatedZoneAirTemp < MinWaterTempAvg - 0.001) { @@ -367,97 +357,91 @@ void GetCoolingPanelInput(EnergyPlusData &state) format("{}{}=\"{}\", {} was lower than the allowable minimum.", RoutineName, cCMO_CoolingPanel_Simple, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(2))); + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(2))); ShowContinueError(state, format("...reset to minimum value=[{:.2R}].", MinWaterTempAvg)); thisCP.RatedZoneAirTemp = MinWaterTempAvg; } - thisCP.RatedWaterFlowRate = state.dataIPShortCut->rNumericArgs(3); + thisCP.RatedWaterFlowRate = s_ipsc->rNumericArgs(3); if (thisCP.RatedWaterFlowRate < 0.00001 || thisCP.RatedWaterFlowRate > 10.0) { ShowWarningError(state, format("{}{}=\"{}\", {} is an invalid Standard Water mass flow rate.", RoutineName, cCMO_CoolingPanel_Simple, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(2))); + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(2))); ShowContinueError(state, format("...reset to a default value=[{:.1R}].", WaterMassFlowDefault)); thisCP.RatedWaterFlowRate = WaterMassFlowDefault; } - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(5), "CoolingDesignCapacity")) { + if (Util::SameString(s_ipsc->cAlphaArgs(5), "CoolingDesignCapacity")) { thisCP.CoolingCapMethod = DataSizing::CoolingDesignCapacity; - if (!state.dataIPShortCut->lNumericFieldBlanks(4)) { - thisCP.ScaledCoolingCapacity = state.dataIPShortCut->rNumericArgs(4); + if (!s_ipsc->lNumericFieldBlanks(4)) { + thisCP.ScaledCoolingCapacity = s_ipsc->rNumericArgs(4); if (thisCP.ScaledCoolingCapacity < 0.0 && thisCP.ScaledCoolingCapacity != DataSizing::AutoSize) { ShowSevereError(state, format("{} = {}", cCMO_CoolingPanel_Simple, thisCP.Name)); - ShowContinueError( - state, format("Illegal {} = {:.7T}", state.dataIPShortCut->cNumericFieldNames(4), state.dataIPShortCut->rNumericArgs(4))); + ShowContinueError(state, format("Illegal {} = {:.7T}", s_ipsc->cNumericFieldNames(4), s_ipsc->rNumericArgs(4))); ErrorsFound = true; } } else { - if ((!state.dataIPShortCut->lAlphaFieldBlanks(6)) || (!state.dataIPShortCut->lAlphaFieldBlanks(7))) { + if ((!s_ipsc->lAlphaFieldBlanks(6)) || (!s_ipsc->lAlphaFieldBlanks(7))) { ShowSevereError(state, format("{} = {}", cCMO_CoolingPanel_Simple, thisCP.Name)); - ShowContinueError(state, - format("Input for {} = {}", state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5))); - ShowContinueError(state, format("Blank field not allowed for {}", state.dataIPShortCut->cNumericFieldNames(4))); + ShowContinueError(state, format("Input for {} = {}", s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaArgs(5))); + ShowContinueError(state, format("Blank field not allowed for {}", s_ipsc->cNumericFieldNames(4))); ErrorsFound = true; } } - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(5), "CapacityPerFloorArea")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(5), "CapacityPerFloorArea")) { thisCP.CoolingCapMethod = DataSizing::CapacityPerFloorArea; - if (!state.dataIPShortCut->lNumericFieldBlanks(5)) { - thisCP.ScaledCoolingCapacity = state.dataIPShortCut->rNumericArgs(5); + if (!s_ipsc->lNumericFieldBlanks(5)) { + thisCP.ScaledCoolingCapacity = s_ipsc->rNumericArgs(5); if (thisCP.ScaledCoolingCapacity < 0.0) { ShowSevereError(state, format("{} = {}", cCMO_CoolingPanel_Simple, thisCP.Name)); - ShowContinueError(state, - format("Input for {} = {}", state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5))); - ShowContinueError( - state, format("Illegal {} = {:.7T}", state.dataIPShortCut->cNumericFieldNames(5), state.dataIPShortCut->rNumericArgs(5))); + ShowContinueError(state, format("Input for {} = {}", s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaArgs(5))); + ShowContinueError(state, format("Illegal {} = {:.7T}", s_ipsc->cNumericFieldNames(5), s_ipsc->rNumericArgs(5))); ErrorsFound = true; } else if (thisCP.ScaledCoolingCapacity == DataSizing::AutoSize) { ShowSevereError(state, format("{} = {}", cCMO_CoolingPanel_Simple, thisCP.Name)); - ShowContinueError(state, - format("Input for {} = {}", state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5))); - ShowContinueError(state, format("Illegal {} = Autosize", state.dataIPShortCut->cNumericFieldNames(5))); + ShowContinueError(state, format("Input for {} = {}", s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaArgs(5))); + ShowContinueError(state, format("Illegal {} = Autosize", s_ipsc->cNumericFieldNames(5))); ErrorsFound = true; } } else { ShowSevereError(state, format("{} = {}", cCMO_CoolingPanel_Simple, thisCP.Name)); - ShowContinueError(state, format("Input for {} = {}", state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5))); - ShowContinueError(state, format("Blank field not allowed for {}", state.dataIPShortCut->cNumericFieldNames(5))); + ShowContinueError(state, format("Input for {} = {}", s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaArgs(5))); + ShowContinueError(state, format("Blank field not allowed for {}", s_ipsc->cNumericFieldNames(5))); ErrorsFound = true; } - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(5), "FractionOfAutosizedCoolingCapacity")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(5), "FractionOfAutosizedCoolingCapacity")) { thisCP.CoolingCapMethod = DataSizing::FractionOfAutosizedCoolingCapacity; - if (!state.dataIPShortCut->lNumericFieldBlanks(6)) { - thisCP.ScaledCoolingCapacity = state.dataIPShortCut->rNumericArgs(6); + if (!s_ipsc->lNumericFieldBlanks(6)) { + thisCP.ScaledCoolingCapacity = s_ipsc->rNumericArgs(6); if (thisCP.ScaledCoolingCapacity < 0.0) { ShowSevereError(state, format("{} = {}", cCMO_CoolingPanel_Simple, thisCP.Name)); - ShowContinueError( - state, format("Illegal {} = {:.7T}", state.dataIPShortCut->cNumericFieldNames(6), state.dataIPShortCut->rNumericArgs(6))); + ShowContinueError(state, format("Illegal {} = {:.7T}", s_ipsc->cNumericFieldNames(6), s_ipsc->rNumericArgs(6))); ErrorsFound = true; } } else { ShowSevereError(state, format("{} = {}", cCMO_CoolingPanel_Simple, thisCP.Name)); - ShowContinueError(state, format("Input for {} = {}", state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5))); - ShowContinueError(state, format("Blank field not allowed for {}", state.dataIPShortCut->cNumericFieldNames(6))); + ShowContinueError(state, format("Input for {} = {}", s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaArgs(5))); + ShowContinueError(state, format("Blank field not allowed for {}", s_ipsc->cNumericFieldNames(6))); ErrorsFound = true; } } else { ShowSevereError(state, format("{} = {}", cCMO_CoolingPanel_Simple, thisCP.Name)); - ShowContinueError(state, format("Illegal {} = {}", state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5))); + ShowContinueError(state, format("Illegal {} = {}", s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaArgs(5))); ErrorsFound = true; } - thisCP.WaterVolFlowRateMax = state.dataIPShortCut->rNumericArgs(7); + thisCP.WaterVolFlowRateMax = s_ipsc->rNumericArgs(7); if ((thisCP.WaterVolFlowRateMax <= MinWaterFlowRate) && thisCP.WaterVolFlowRateMax != DataSizing::AutoSize) { ShowWarningError(state, format("{}{}=\"{}\", {} was less than the allowable minimum.", RoutineName, cCMO_CoolingPanel_Simple, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(7))); + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(7))); ShowContinueError(state, format("...reset to minimum value=[{:.2R}].", MinWaterFlowRate)); thisCP.WaterVolFlowRateMax = MinWaterFlowRate; } else if (thisCP.WaterVolFlowRateMax > MaxWaterFlowRate) { @@ -465,69 +449,67 @@ void GetCoolingPanelInput(EnergyPlusData &state) format("{}{}=\"{}\", {} was higher than the allowable maximum.", RoutineName, cCMO_CoolingPanel_Simple, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(7))); + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(7))); ShowContinueError(state, format("...reset to maximum value=[{:.2R}].", MaxWaterFlowRate)); thisCP.WaterVolFlowRateMax = MaxWaterFlowRate; } // Process the temperature control type - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(6), MeanAirTemperature)) { + if (Util::SameString(s_ipsc->cAlphaArgs(6), MeanAirTemperature)) { thisCP.controlType = ClgPanelCtrlType::MAT; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(6), MeanRadiantTemperature)) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(6), MeanRadiantTemperature)) { thisCP.controlType = ClgPanelCtrlType::MRT; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(6), OperativeTemperature)) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(6), OperativeTemperature)) { thisCP.controlType = ClgPanelCtrlType::Operative; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(6), OutsideAirDryBulbTemperature)) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(6), OutsideAirDryBulbTemperature)) { thisCP.controlType = ClgPanelCtrlType::ODB; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(6), OutsideAirWetBulbTemperature)) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(6), OutsideAirWetBulbTemperature)) { thisCP.controlType = ClgPanelCtrlType::OWB; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(6), ZoneTotalLoad)) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(6), ZoneTotalLoad)) { thisCP.controlType = ClgPanelCtrlType::ZoneTotalLoad; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(6), ZoneConvectiveLoad)) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(6), ZoneConvectiveLoad)) { thisCP.controlType = ClgPanelCtrlType::ZoneConvectiveLoad; } else { - ShowWarningError(state, format("Invalid {} ={}", state.dataIPShortCut->cAlphaFieldNames(6), state.dataIPShortCut->cAlphaArgs(6))); - ShowContinueError(state, format("Occurs in {} = {}", RoutineName, state.dataIPShortCut->cAlphaArgs(1))); + ShowWarningError(state, format("Invalid {} ={}", s_ipsc->cAlphaFieldNames(6), s_ipsc->cAlphaArgs(6))); + ShowContinueError(state, format("Occurs in {} = {}", RoutineName, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "Control reset to MAT control for this Simple Cooling Panel."); thisCP.controlType = ClgPanelCtrlType::MAT; } - thisCP.ColdThrottlRange = state.dataIPShortCut->rNumericArgs(8); + thisCP.ColdThrottlRange = s_ipsc->rNumericArgs(8); if (thisCP.ColdThrottlRange < MinThrottlingRange) { ShowWarningError(state, format("{}Cooling throttling range too small, reset to 0.5", cCMO_CoolingPanel_Simple)); ShowContinueError(state, format("Occurs in Cooling Panel={}", thisCP.Name)); thisCP.ColdThrottlRange = MinThrottlingRange; } - thisCP.ColdSetptSched = state.dataIPShortCut->cAlphaArgs(7); - thisCP.ColdSetptSchedPtr = ScheduleManager::GetScheduleIndex(state, thisCP.ColdSetptSched); - if ((thisCP.ColdSetptSchedPtr == 0) && (!state.dataIPShortCut->lAlphaFieldBlanks(7))) { - ShowSevereError(state, format("{} not found: {}", state.dataIPShortCut->cAlphaFieldNames(7), thisCP.ColdSetptSched)); - ShowContinueError(state, format("Occurs in {} = {}", RoutineName, state.dataIPShortCut->cAlphaArgs(1))); + thisCP.ColdSetptSchedName = s_ipsc->cAlphaArgs(7); + if ((thisCP.coldSetptSched = Sched::GetSchedule(state, thisCP.ColdSetptSchedName)) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(7), s_ipsc->cAlphaArgs(7)); ErrorsFound = true; } - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(8), Off)) { + if (Util::SameString(s_ipsc->cAlphaArgs(8), Off)) { thisCP.CondCtrlType = CondCtrl::NONE; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(8), SimpleOff)) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(8), SimpleOff)) { thisCP.CondCtrlType = CondCtrl::SIMPLEOFF; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(8), VariableOff)) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(8), VariableOff)) { thisCP.CondCtrlType = CondCtrl::VARIEDOFF; } else { thisCP.CondCtrlType = CondCtrl::SIMPLEOFF; } - thisCP.CondDewPtDeltaT = state.dataIPShortCut->rNumericArgs(9); + thisCP.CondDewPtDeltaT = s_ipsc->rNumericArgs(9); - thisCP.FracRadiant = state.dataIPShortCut->rNumericArgs(10); + thisCP.FracRadiant = s_ipsc->rNumericArgs(10); if (thisCP.FracRadiant < MinFraction) { ShowWarningError(state, format("{}{}=\"{}\", {} was lower than the allowable minimum.", RoutineName, cCMO_CoolingPanel_Simple, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(10))); + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(10))); ShowContinueError(state, format("...reset to minimum value=[{:.2R}].", MinFraction)); thisCP.FracRadiant = MinFraction; } @@ -536,8 +518,8 @@ void GetCoolingPanelInput(EnergyPlusData &state) format("{}{}=\"{}\", {} was higher than the allowable maximum.", RoutineName, cCMO_CoolingPanel_Simple, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(10))); + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(10))); ShowContinueError(state, format("...reset to maximum value=[{:.2R}].", MaxFraction)); thisCP.FracRadiant = MaxFraction; } @@ -548,21 +530,21 @@ void GetCoolingPanelInput(EnergyPlusData &state) format("{}{}=\"{}\", Fraction Radiant was higher than the allowable maximum.", RoutineName, cCMO_CoolingPanel_Simple, - state.dataIPShortCut->cAlphaArgs(1))); + s_ipsc->cAlphaArgs(1))); thisCP.FracRadiant = MaxFraction; thisCP.FracConvect = 0.0; } else { thisCP.FracConvect = 1.0 - thisCP.FracRadiant; } - thisCP.FracDistribPerson = state.dataIPShortCut->rNumericArgs(11); + thisCP.FracDistribPerson = s_ipsc->rNumericArgs(11); if (thisCP.FracDistribPerson < MinFraction) { ShowWarningError(state, format("{}{}=\"{}\", {} was lower than the allowable minimum.", RoutineName, cCMO_CoolingPanel_Simple, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(11))); + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(11))); ShowContinueError(state, format("...reset to minimum value=[{:.3R}].", MinFraction)); thisCP.FracDistribPerson = MinFraction; } @@ -571,8 +553,8 @@ void GetCoolingPanelInput(EnergyPlusData &state) format("{}{}=\"{}\", {} was higher than the allowable maximum.", RoutineName, cCMO_CoolingPanel_Simple, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(11))); + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(11))); ShowContinueError(state, format("...reset to maximum value=[{:.3R}].", MaxFraction)); thisCP.FracDistribPerson = MaxFraction; } @@ -583,7 +565,7 @@ void GetCoolingPanelInput(EnergyPlusData &state) format("{}{}=\"{}\", the number of surface/radiant fraction groups entered was less than the allowable minimum.", RoutineName, cCMO_CoolingPanel_Simple, - state.dataIPShortCut->cAlphaArgs(1))); + s_ipsc->cAlphaArgs(1))); ShowContinueError(state, format("...the minimum that must be entered=[{}].", MinDistribSurfaces)); ErrorsFound = true; thisCP.TotSurfToDistrib = 0; // error @@ -613,17 +595,17 @@ void GetCoolingPanelInput(EnergyPlusData &state) Real64 AllFracsSummed = thisCP.FracDistribPerson; for (SurfNum = 1; SurfNum <= thisCP.TotSurfToDistrib; ++SurfNum) { - thisCP.SurfaceName(SurfNum) = state.dataIPShortCut->cAlphaArgs(SurfNum + 8); + thisCP.SurfaceName(SurfNum) = s_ipsc->cAlphaArgs(SurfNum + 8); thisCP.SurfacePtr(SurfNum) = HeatBalanceIntRadExchange::GetRadiantSystemSurface( state, cCMO_CoolingPanel_Simple, thisCP.Name, thisCP.ZonePtr, thisCP.SurfaceName(SurfNum), ErrorsFound); - thisCP.FracDistribToSurf(SurfNum) = state.dataIPShortCut->rNumericArgs(SurfNum + 11); + thisCP.FracDistribToSurf(SurfNum) = s_ipsc->rNumericArgs(SurfNum + 11); if (thisCP.FracDistribToSurf(SurfNum) > MaxFraction) { ShowWarningError(state, format("{}{}=\"{}\", {}was greater than the allowable maximum.", RoutineName, cCMO_CoolingPanel_Simple, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(SurfNum + 8))); + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(SurfNum + 8))); ShowContinueError(state, format("...reset to maximum value=[{:.2R}].", MaxFraction)); thisCP.TotSurfToDistrib = MaxFraction; } @@ -632,8 +614,8 @@ void GetCoolingPanelInput(EnergyPlusData &state) format("{}{}=\"{}\", {}was less than the allowable minimum.", RoutineName, cCMO_CoolingPanel_Simple, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(SurfNum + 8))); + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(SurfNum + 8))); ShowContinueError(state, format("...reset to maximum value=[{:.2R}].", MinFraction)); thisCP.TotSurfToDistrib = MinFraction; } @@ -650,7 +632,7 @@ void GetCoolingPanelInput(EnergyPlusData &state) format("{}{}=\"{}\", Summed radiant fractions for people + surface groups > 1.0", RoutineName, cCMO_CoolingPanel_Simple, - state.dataIPShortCut->cAlphaArgs(1))); + s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } if ((AllFracsSummed < (MaxFraction - 0.01)) && @@ -659,7 +641,7 @@ void GetCoolingPanelInput(EnergyPlusData &state) format("{}{}=\"{}\", Summed radiant fractions for people + surface groups < 1.0", RoutineName, cCMO_CoolingPanel_Simple, - state.dataIPShortCut->cAlphaArgs(1))); + s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "This would result in some of the radiant energy delivered by the high temp radiant heater being lost."); ShowContinueError(state, format("The sum of all radiation fractions to surfaces = {:.5T}", (AllFracsSummed - thisCP.FracDistribPerson))); ShowContinueError(state, format("The radiant fraction to people = {:.5T}", thisCP.FracDistribPerson)); @@ -671,7 +653,7 @@ void GetCoolingPanelInput(EnergyPlusData &state) ShowContinueError(state, format("Please check and correct this so that all radiant energy is accounted for in {} = {}", cCMO_CoolingPanel_Simple, - state.dataIPShortCut->cAlphaArgs(1))); + s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } } @@ -783,7 +765,7 @@ void InitCoolingPanel(EnergyPlusData &state, int const CoolingPanelNum, int cons // This subroutine initializes the cooling panel units, and determines the UA values during simulation. // METHODOLOGY EMPLOYED: - // The initialization subrotines borrowed from other sources and heat exchanger formulation for cooling panel. + // The initialization subroutines borrowed from other sources and heat exchanger formulation for cooling panel. // REFERENCES: // Incropera and DeWitt, Fundamentals of Heat and Mass Transfer @@ -830,11 +812,7 @@ void InitCoolingPanel(EnergyPlusData &state, int const CoolingPanelNum, int cons // set design mass flow rates if (thisCP.WaterInletNode > 0) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(thisCP.plantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(thisCP.plantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(thisCP.plantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); thisCP.WaterMassFlowRateMax = rho * thisCP.WaterVolFlowRateMax; PlantUtilities::InitComponentNodes(state, 0.0, thisCP.WaterMassFlowRateMax, thisCP.WaterInletNode, thisCP.WaterOutletNode); } @@ -845,11 +823,7 @@ void InitCoolingPanel(EnergyPlusData &state, int const CoolingPanelNum, int cons if (state.dataGlobal->BeginEnvrnFlag && thisCP.MyEnvrnFlag) { // Initialize - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(thisCP.plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(thisCP.plantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(thisCP.plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); thisCP.WaterMassFlowRateMax = rho * thisCP.WaterVolFlowRateMax; @@ -857,11 +831,7 @@ void InitCoolingPanel(EnergyPlusData &state, int const CoolingPanelNum, int cons ThisInNode.Temp = 7.0; - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(thisCP.plantLoc.loopNum).FluidName, - ThisInNode.Temp, - state.dataPlnt->PlantLoop(thisCP.plantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(thisCP.plantLoc.loopNum).glycol->getSpecificHeat(state, ThisInNode.Temp, RoutineName); ThisInNode.Enthalpy = Cp * ThisInNode.Temp; ThisInNode.Quality = 0.0; @@ -1032,16 +1002,8 @@ void SizeCoolingPanel(EnergyPlusData &state, int const CoolingPanelNum) PlantUtilities::MyPlantSizingIndex(state, CompType, thisCP.Name, thisCP.WaterInletNode, thisCP.WaterOutletNode, ErrorsFound); if (PltSizCoolNum > 0) { if (DesCoilLoad >= HVAC::SmallLoad) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(thisCP.plantLoc.loopNum).FluidName, - 5., - state.dataPlnt->PlantLoop(thisCP.plantLoc.loopNum).FluidIndex, - RoutineName); - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(thisCP.plantLoc.loopNum).FluidName, - 5.0, - state.dataPlnt->PlantLoop(thisCP.plantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(thisCP.plantLoc.loopNum).glycol->getDensity(state, 5., RoutineName); + Cp = state.dataPlnt->PlantLoop(thisCP.plantLoc.loopNum).glycol->getSpecificHeat(state, 5.0, RoutineName); WaterVolFlowMaxCoolDes = DesCoilLoad / (state.dataSize->PlantSizData(PltSizCoolNum).DeltaT * Cp * rho); } else { WaterVolFlowMaxCoolDes = 0.0; @@ -1214,11 +1176,8 @@ void CoolingPanelParams::CalcCoolingPanel(EnergyPlusData &state, int const Cooli Real64 waterMassFlowRateMax = this->WaterMassFlowRateMax; Real64 Xr = this->FracRadiant; - if (ScheduleManager::GetCurrentScheduleValue(state, this->SchedPtr) > 0) { - CoolingPanelOn = true; - } else { - CoolingPanelOn = false; - } + CoolingPanelOn = this->availSched->getCurrentVal() > 0; + // Calculate the "zone" temperature for determining the output of the cooling panel auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); Real64 Tzone = Xr * thisZoneHB.MRT + ((1.0 - Xr) * thisZoneHB.MAT); @@ -1290,11 +1249,7 @@ void CoolingPanelParams::CalcCoolingPanel(EnergyPlusData &state, int const Cooli if (QZnReq < -HVAC::SmallLoad && !state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) && (CoolingPanelOn)) { - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - waterInletTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, waterInletTemp, RoutineName); // Find the actual load: this parameter modifies what the response of the system should be. For total load control, the system tries // to meet the QZnReq. For convective load control, the convective output of the device equals QZnReq which means that the load on @@ -1350,7 +1305,7 @@ void CoolingPanelParams::CalcCoolingPanel(EnergyPlusData &state, int const Cooli ControlTemp = this->getCoolingPanelControlTemp(state, ZoneNum); - SetPointTemp = ScheduleManager::GetCurrentScheduleValue(state, this->ColdSetptSchedPtr); + SetPointTemp = this->coldSetptSched->getCurrentVal(); OffTempCool = SetPointTemp - 0.5 * this->ColdThrottlRange; FullOnTempCool = SetPointTemp + 0.5 * this->ColdThrottlRange; @@ -1375,11 +1330,7 @@ void CoolingPanelParams::CalcCoolingPanel(EnergyPlusData &state, int const Cooli if (CoolingPanelOn) { // Now simulate the system... - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - waterInletTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, waterInletTemp, RoutineName); Effectiveness = 1.0 - exp(-this->UA / (waterMassFlowRate * Cp)); if (Effectiveness <= 0.0) { Effectiveness = 0.0; @@ -1568,7 +1519,7 @@ void DistributeCoolingPanelRadGains(EnergyPlusData &state) // DATE WRITTEN Sept 2014 // PURPOSE OF THIS SUBROUTINE: - // To distribute the gains from the hot water basebaord heater + // To distribute the gains from the hot water baseboard heater // as specified in the user input file. This includes distribution // of long wavelength radiant gains to surfaces and "people." diff --git a/src/EnergyPlus/ChilledCeilingPanelSimple.hh b/src/EnergyPlus/ChilledCeilingPanelSimple.hh index 8da0fdf65be..118d525df00 100644 --- a/src/EnergyPlus/ChilledCeilingPanelSimple.hh +++ b/src/EnergyPlus/ChilledCeilingPanelSimple.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -57,6 +57,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -98,15 +99,15 @@ namespace CoolingPanelSimple { Array1D_string SurfaceName; Array1D_int SurfacePtr; int ZonePtr = 0; - int SchedPtr = 0; + Sched::Schedule *availSched = nullptr; int WaterInletNode = 0; int WaterOutletNode = 0; int TotSurfToDistrib = 0; int ControlCompTypeNum = 0; int CompErrIndex = 0; ClgPanelCtrlType controlType = ClgPanelCtrlType::Invalid; - std::string ColdSetptSched; - int ColdSetptSchedPtr = 0; + std::string ColdSetptSchedName; + Sched::Schedule *coldSetptSched = nullptr; CondCtrl CondCtrlType = CondCtrl::NONE; Real64 CondDewPtDeltaT = 0.0; int CondErrIndex = 0; @@ -188,6 +189,10 @@ struct ChilledCeilingPanelSimpleData : BaseGlobalStruct bool GetInputFlag = true; Array1D CoolingPanel; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ChillerAbsorption.cc b/src/EnergyPlus/ChillerAbsorption.cc index 879e1725eda..64cb01303ea 100644 --- a/src/EnergyPlus/ChillerAbsorption.cc +++ b/src/EnergyPlus/ChillerAbsorption.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -99,13 +99,9 @@ namespace EnergyPlus::ChillerAbsorption { // The Absorber program from the BLAST family of software can be used // to generate the coefficients for the model. -int constexpr waterIndex(1); const char *calcChillerAbsorption("CALC Chiller:Absorption "); const char *moduleObjectType("Chiller:Absorption"); -const char *fluidNameWater = "WATER"; -const char *fluidNameSteam = "STEAM"; - BLASTAbsorberSpecs *BLASTAbsorberSpecs::factory(EnergyPlusData &state, std::string const &objectName) { // Process the input data @@ -345,7 +341,7 @@ void GetBLASTAbsorberInput(EnergyPlusData &state) if (Util::SameString(state.dataIPShortCut->cAlphaArgs(9), "HotWater") || Util::SameString(state.dataIPShortCut->cAlphaArgs(9), "HotWater")) { thisChiller.GenHeatSourceType = DataLoopNode::NodeFluidType::Water; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(9), fluidNameSteam) || state.dataIPShortCut->cAlphaArgs(9).empty()) { + } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(9), "STEAM") || state.dataIPShortCut->cAlphaArgs(9).empty()) { thisChiller.GenHeatSourceType = DataLoopNode::NodeFluidType::Steam; } else { ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(9), state.dataIPShortCut->cAlphaArgs(9))); @@ -385,7 +381,7 @@ void GetBLASTAbsorberInput(EnergyPlusData &state) state.dataIPShortCut->cAlphaArgs(7), "Hot Water Nodes"); } else { - thisChiller.SteamFluidIndex = FluidProperties::GetRefrigNum(state, fluidNameSteam); + thisChiller.steam = Fluid::GetSteam(state); thisChiller.GeneratorInletNodeNum = NodeInputManager::GetOnlySingleNode(state, state.dataIPShortCut->cAlphaArgs(6), ErrorsFound, @@ -752,24 +748,15 @@ void BLASTAbsorberSpecs::oneTimeInit(EnergyPlusData &state) void BLASTAbsorberSpecs::initEachEnvironment(EnergyPlusData &state) { + constexpr std::string_view RoutineName("BLASTAbsorberSpecs::initEachEnvironment"); - constexpr const char *RoutineName("BLASTAbsorberSpecs::initEachEnvironment"); - - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); this->EvapMassFlowRateMax = this->EvapVolFlowRate * rho; PlantUtilities::InitComponentNodes(state, 0.0, this->EvapMassFlowRateMax, this->EvapInletNodeNum, this->EvapOutletNodeNum); - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); this->CondMassFlowRateMax = rho * this->CondVolFlowRate; @@ -779,11 +766,7 @@ void BLASTAbsorberSpecs::initEachEnvironment(EnergyPlusData &state) if (this->GeneratorInletNodeNum > 0) { if (this->GenHeatSourceType == DataLoopNode::NodeFluidType::Water) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); this->GenMassFlowRateMax = rho * this->GeneratorVolFlowRate; } else if (this->GenHeatSourceType == DataLoopNode::NodeFluidType::Steam) { @@ -791,26 +774,16 @@ void BLASTAbsorberSpecs::initEachEnvironment(EnergyPlusData &state) this->QGenerator = (this->SteamLoadCoef[0] + this->SteamLoadCoef[1] + this->SteamLoadCoef[2]) * this->NomCap; // dry enthalpy of steam (quality = 1) - Real64 EnthSteamOutDry = FluidProperties::GetSatEnthalpyRefrig(state, - fluidNameSteam, - state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, - 1.0, - this->SteamFluidIndex, - calcChillerAbsorption + this->Name); + Real64 EnthSteamOutDry = this->steam->getSatEnthalpy( + state, state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, 1.0, calcChillerAbsorption + this->Name); // wet enthalpy of steam (quality = 0) - Real64 EnthSteamOutWet = FluidProperties::GetSatEnthalpyRefrig(state, - fluidNameSteam, - state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, - 0.0, - this->SteamFluidIndex, - calcChillerAbsorption + this->Name); + Real64 EnthSteamOutWet = this->steam->getSatEnthalpy( + state, state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, 0.0, calcChillerAbsorption + this->Name); Real64 SteamDeltaT = this->GeneratorSubcool; Real64 SteamOutletTemp = state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp - SteamDeltaT; Real64 HfgSteam = EnthSteamOutDry - EnthSteamOutWet; - int curWaterIndex = waterIndex; - Real64 CpWater = - FluidProperties::GetDensityGlycol(state, fluidNameWater, SteamOutletTemp, curWaterIndex, calcChillerAbsorption + this->Name); + Real64 CpWater = this->water->getDensity(state, SteamOutletTemp, calcChillerAbsorption + this->Name); this->GenMassFlowRateMax = this->QGenerator / (HfgSteam + CpWater * SteamDeltaT); } @@ -952,17 +925,9 @@ void BLASTAbsorberSpecs::sizeChiller(EnergyPlusData &state) if (PltSizNum > 0) { if (state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); - - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getSpecificHeat(state, Constant::CWInitConvTemp, RoutineName); + + Real64 rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); tmpNomCap = Cp * rho * state.dataSize->PlantSizData(PltSizNum).DeltaT * state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate * this->SizFac; if (!this->NomCapWasAutoSized) tmpNomCap = this->NomCap; @@ -1120,17 +1085,9 @@ void BLASTAbsorberSpecs::sizeChiller(EnergyPlusData &state) if (this->EvapVolFlowRate >= HVAC::SmallWaterVolFlow && tmpNomCap > 0.0) { // QCondenser = QEvaporator + QGenerator + PumpingPower - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - this->TempDesCondIn, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); - - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getSpecificHeat(state, this->TempDesCondIn, RoutineName); + + Real64 rho = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); tmpCondVolFlowRate = tmpNomCap * (1.0 + SteamInputRatNom + tmpNomPumpPower / tmpNomCap) / (state.dataSize->PlantSizData(PltSizCondNum).DeltaT * Cp * rho); if (!this->CondVolFlowRateWasAutoSized) tmpCondVolFlowRate = this->CondVolFlowRate; @@ -1198,17 +1155,12 @@ void BLASTAbsorberSpecs::sizeChiller(EnergyPlusData &state) (PltSizHeatingNum > 0 && this->GenHeatSourceType == DataLoopNode::NodeFluidType::Water)) { if (this->EvapVolFlowRate >= HVAC::SmallWaterVolFlow && tmpNomCap > 0.0) { if (this->GenHeatSourceType == DataLoopNode::NodeFluidType::Water) { - Real64 CpWater = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).FluidName, - state.dataSize->PlantSizData(PltSizHeatingNum).ExitTemp, - state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpWater = state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataSize->PlantSizData(PltSizHeatingNum).ExitTemp, RoutineName); Real64 SteamDeltaT = max(0.5, state.dataSize->PlantSizData(PltSizHeatingNum).DeltaT); - Real64 RhoWater = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).FluidName, - (state.dataSize->PlantSizData(PltSizHeatingNum).ExitTemp - SteamDeltaT), - state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 RhoWater = + state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum) + .glycol->getDensity(state, (state.dataSize->PlantSizData(PltSizHeatingNum).ExitTemp - SteamDeltaT), RoutineName); tmpGeneratorVolFlowRate = (this->NomCap * SteamInputRatNom) / (CpWater * SteamDeltaT * RhoWater); if (!this->GeneratorVolFlowRateWasAutoSized) tmpGeneratorVolFlowRate = this->GeneratorVolFlowRate; if (state.dataPlnt->PlantFirstSizesOkayToFinalize) { @@ -1222,7 +1174,7 @@ void BLASTAbsorberSpecs::sizeChiller(EnergyPlusData &state) BaseSizer::reportSizerOutput(state, moduleObjectType, this->Name, - "Iniital Design Size Design Generator Fluid Flow Rate [m3/s]", + "Initial Design Size Design Generator Fluid Flow Rate [m3/s]", tmpGeneratorVolFlowRate); } } else { @@ -1258,26 +1210,16 @@ void BLASTAbsorberSpecs::sizeChiller(EnergyPlusData &state) } } } else { - constexpr const char *RoutineNameLong("SizeAbsorptionChiller"); - Real64 SteamDensity = FluidProperties::GetSatDensityRefrig( - state, fluidNameSteam, state.dataSize->PlantSizData(PltSizSteamNum).ExitTemp, 1.0, this->SteamFluidIndex, RoutineNameLong); + constexpr std::string_view RoutineNameLong("SizeAbsorptionChiller"); + Real64 SteamDensity = this->steam->getSatDensity(state, state.dataSize->PlantSizData(PltSizSteamNum).ExitTemp, 1.0, RoutineNameLong); Real64 SteamDeltaT = state.dataSize->PlantSizData(PltSizSteamNum).DeltaT; Real64 GeneratorOutletTemp = state.dataSize->PlantSizData(PltSizSteamNum).ExitTemp - SteamDeltaT; - Real64 EnthSteamOutDry = FluidProperties::GetSatEnthalpyRefrig(state, - fluidNameSteam, - state.dataSize->PlantSizData(PltSizSteamNum).ExitTemp, - 1.0, - this->SteamFluidIndex, - moduleObjectType + this->Name); - Real64 EnthSteamOutWet = FluidProperties::GetSatEnthalpyRefrig(state, - fluidNameSteam, - state.dataSize->PlantSizData(PltSizSteamNum).ExitTemp, - 0.0, - this->SteamFluidIndex, - moduleObjectType + this->Name); - int curWaterIndex = waterIndex; - Real64 CpWater = FluidProperties::GetSpecificHeatGlycol(state, fluidNameWater, GeneratorOutletTemp, curWaterIndex, RoutineName); + Real64 EnthSteamOutDry = + this->steam->getSatEnthalpy(state, state.dataSize->PlantSizData(PltSizSteamNum).ExitTemp, 1.0, moduleObjectType + this->Name); + Real64 EnthSteamOutWet = + this->steam->getSatEnthalpy(state, state.dataSize->PlantSizData(PltSizSteamNum).ExitTemp, 0.0, moduleObjectType + this->Name); + Real64 CpWater = this->water->getSpecificHeat(state, GeneratorOutletTemp, RoutineName); Real64 HfgSteam = EnthSteamOutDry - EnthSteamOutWet; this->SteamMassFlowRate = (this->NomCap * SteamInputRatNom) / ((HfgSteam) + (SteamDeltaT * CpWater)); tmpGeneratorVolFlowRate = this->SteamMassFlowRate / SteamDensity; @@ -1366,16 +1308,9 @@ void BLASTAbsorberSpecs::sizeChiller(EnergyPlusData &state) this->GeneratorDeltaTemp = max(0.5, state.dataSize->PlantSizData(PltSizHeatingNum).DeltaT); } else if (this->GenHeatSourceType == DataLoopNode::NodeFluidType::Water) { if (state.dataPlnt->PlantFirstSizesOkayToFinalize) { - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).FluidIndex, - RoutineName); - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = + state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).glycol->getSpecificHeat(state, Constant::HWInitConvTemp, RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); this->GeneratorDeltaTemp = (SteamInputRatNom * this->NomCap) / (Cp * rho * this->GeneratorVolFlowRate); } @@ -1485,11 +1420,8 @@ void BLASTAbsorberSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, bool R Real64 TempEvapOut = state.dataLoopNodes->Node(this->EvapOutletNodeNum).Temp; - Real64 CpFluid = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpFluid = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp, RoutineName); // If there is a fault of Chiller SWT Sensor if (this->FaultyChillerSWTFlag && (!state.dataGlobal->WarmupFlag) && (!state.dataGlobal->DoingSizing) && (!state.dataGlobal->KickOffSimulation)) { @@ -1512,7 +1444,7 @@ void BLASTAbsorberSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, bool R // limit by max capacity this->QEvaporator = min(this->QEvaporator, (this->MaxPartLoadRat * this->NomCap)); - // Either set the flow to the Constant value or caluclate the flow for the variable volume + // Either set the flow to the Constant value or calculate the flow for the variable volume if ((this->FlowMode == DataPlant::FlowMode::Constant) || (this->FlowMode == DataPlant::FlowMode::NotModulated)) { this->EvapMassFlowRate = state.dataLoopNodes->Node(this->EvapInletNodeNum).MassFlowRate; @@ -1715,11 +1647,8 @@ void BLASTAbsorberSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, bool R this->QCondenser = this->QEvaporator + this->QGenerator + this->PumpingPower; - CpFluid = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->CondInletNodeNum).Temp, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + CpFluid = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->CondInletNodeNum).Temp, RoutineName); if (this->CondMassFlowRate > DataBranchAirLoopPlant::MassFlowTolerance) { this->CondOutletTemp = this->QCondenser / this->CondMassFlowRate / CpFluid + state.dataLoopNodes->Node(this->CondInletNodeNum).Temp; @@ -1728,6 +1657,9 @@ void BLASTAbsorberSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, bool R this->CondOutletTemp = state.dataLoopNodes->Node(this->CondInletNodeNum).Temp; this->CondMassFlowRate = 0.0; this->QCondenser = 0.0; + MyLoad = 0.0; + this->EvapMassFlowRate = 0.0; + PlantUtilities::SetComponentFlowRate(state, this->EvapMassFlowRate, this->EvapInletNodeNum, this->EvapOutletNodeNum, this->CWPlantLoc); return; // V7 plant upgrade, no longer fatal here anymore, set some things and return } @@ -1736,17 +1668,14 @@ void BLASTAbsorberSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, bool R if (this->GenHeatSourceType == DataLoopNode::NodeFluidType::Water) { Real64 GenMassFlowRate = 0.0; // Hot water plant is used for the generator - CpFluid = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, - state.dataPlnt->PlantLoop(GenPlantLoc.loopNum).FluidIndex, - RoutineName); + CpFluid = state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, RoutineName); if (state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).LoopSide(this->GenPlantLoc.loopSideNum).FlowLock == DataPlant::FlowLock::Unlocked) { if ((this->FlowMode == DataPlant::FlowMode::Constant) || (this->FlowMode == DataPlant::FlowMode::NotModulated)) { GenMassFlowRate = this->GenMassFlowRateMax; } else { // LeavingSetpointModulated - // since the .FlowMode applies to the chiller evaporator, the generater mass flow rate will be proportional to the evaporator + // since the .FlowMode applies to the chiller evaporator, the generator mass flow rate will be proportional to the evaporator // mass flow rate Real64 GenFlowRatio = this->EvapMassFlowRate / this->EvapMassFlowRateMax; GenMassFlowRate = min(this->GenMassFlowRateMax, GenFlowRatio * this->GenMassFlowRateMax); @@ -1771,26 +1700,15 @@ void BLASTAbsorberSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, bool R } else { // using a steam plant for the generator // enthalpy of dry steam at generator inlet - Real64 EnthSteamOutDry = FluidProperties::GetSatEnthalpyRefrig(state, - fluidNameSteam, - state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, - 1.0, - this->SteamFluidIndex, - calcChillerAbsorption + this->Name); - + Real64 EnthSteamOutDry = this->steam->getSatEnthalpy( + state, state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, 1.0, calcChillerAbsorption + this->Name); // enthalpy of wet steam at generator inlet - Real64 EnthSteamOutWet = FluidProperties::GetSatEnthalpyRefrig(state, - fluidNameSteam, - state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, - 0.0, - this->SteamFluidIndex, - calcChillerAbsorption + this->Name); + Real64 EnthSteamOutWet = this->steam->getSatEnthalpy( + state, state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, 0.0, calcChillerAbsorption + this->Name); Real64 SteamDeltaT = this->GeneratorSubcool; Real64 SteamOutletTemp = state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp - SteamDeltaT; Real64 HfgSteam = EnthSteamOutDry - EnthSteamOutWet; - int curWaterIndex = waterIndex; - CpFluid = - FluidProperties::GetSpecificHeatGlycol(state, fluidNameWater, SteamOutletTemp, curWaterIndex, calcChillerAbsorption + this->Name); + CpFluid = this->water->getSpecificHeat(state, SteamOutletTemp, calcChillerAbsorption + this->Name); this->SteamMassFlowRate = this->QGenerator / (HfgSteam + CpFluid * SteamDeltaT); PlantUtilities::SetComponentFlowRate( state, this->SteamMassFlowRate, this->GeneratorInletNodeNum, this->GeneratorOutletNodeNum, this->GenPlantLoc); @@ -1800,8 +1718,7 @@ void BLASTAbsorberSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, bool R this->SteamOutletEnthalpy = state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Enthalpy; } else { this->GenOutletTemp = state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp - SteamDeltaT; - this->SteamOutletEnthalpy = FluidProperties::GetSatEnthalpyRefrig( - state, fluidNameSteam, this->GenOutletTemp, 0.0, this->SteamFluidIndex, moduleObjectType + this->Name); + this->SteamOutletEnthalpy = this->steam->getSatEnthalpy(state, this->GenOutletTemp, 0.0, moduleObjectType + this->Name); this->SteamOutletEnthalpy -= CpFluid * SteamDeltaT; } } diff --git a/src/EnergyPlus/ChillerAbsorption.hh b/src/EnergyPlus/ChillerAbsorption.hh index f0d6982fa2d..2348a4cd2c0 100644 --- a/src/EnergyPlus/ChillerAbsorption.hh +++ b/src/EnergyPlus/ChillerAbsorption.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -56,6 +56,7 @@ #include #include #include +#include #include #include @@ -128,7 +129,7 @@ namespace ChillerAbsorption { Real64 GeneratorVolFlowRate = 0.0; // m3/s - hot water volumetric flow rate through generator bool GeneratorVolFlowRateWasAutoSized = false; // true if hot water flow was autosize on input Real64 GeneratorSubcool = 0.0; // amount of subcooling in steam generator - int SteamFluidIndex = 0; // index to generator fluid type + Fluid::RefrigProps *steam = nullptr; // STEAM fluid properties Real64 GeneratorDeltaTemp = -99999.0; // C - generator fluid temperature difference (water only) bool GeneratorDeltaTempWasAutoSized = true; // true if generator delta T was autosize on input PlantLocation CWPlantLoc; // chilled water plant loop index number @@ -159,6 +160,8 @@ namespace ChillerAbsorption { ReportVars Report; DataBranchAirLoopPlant::ControlType EquipFlowCtrl = DataBranchAirLoopPlant::ControlType::Invalid; + Fluid::GlycolProps *water = nullptr; + static BLASTAbsorberSpecs *factory(EnergyPlusData &state, std::string const &objectName); void simulate([[maybe_unused]] EnergyPlusData &state, @@ -200,6 +203,10 @@ struct ChillerAbsorberData : BaseGlobalStruct bool getInput = true; Array1D absorptionChillers; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ChillerElectricASHRAE205.cc b/src/EnergyPlus/ChillerElectricASHRAE205.cc index 77786d58266..0a0cf95b3e1 100644 --- a/src/EnergyPlus/ChillerElectricASHRAE205.cc +++ b/src/EnergyPlus/ChillerElectricASHRAE205.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -103,15 +103,18 @@ std::map InterpMethods = // NOLINT(cert void getChillerASHRAE205Input(EnergyPlusData &state) { static constexpr std::string_view RoutineName("getChillerASHRAE205Input: "); // include trailing blank space + static constexpr std::string_view routineName = "getChillerASHRAE205Input"; using namespace tk205; RSInstanceFactory::register_factory("RS0001", std::make_shared()); bool ErrorsFound{false}; + auto &s_ip = state.dataInputProcessing->inputProcessor; + auto &s_ipsc = state.dataIPShortCut; + state.dataIPShortCut->cCurrentModuleObject = ChillerElectricASHRAE205::ASHRAE205ChillerSpecs::ObjectType; - auto &ip = state.dataInputProcessing->inputProcessor; - int numElectric205Chillers = ip->getNumObjectsFound(state, state.dataIPShortCut->cCurrentModuleObject); + int numElectric205Chillers = s_ip->getNumObjectsFound(state, state.dataIPShortCut->cCurrentModuleObject); if (numElectric205Chillers <= 0) { ShowSevereError(state, format("No {} equipment specified in input file", state.dataIPShortCut->cCurrentModuleObject)); @@ -120,12 +123,16 @@ void getChillerASHRAE205Input(EnergyPlusData &state) state.dataChillerElectricASHRAE205->Electric205Chiller.allocate(numElectric205Chillers); - auto const &ChillerInstances = ip->epJSON.find(state.dataIPShortCut->cCurrentModuleObject).value(); + auto const &ChillerInstances = s_ip->epJSON.find(state.dataIPShortCut->cCurrentModuleObject).value(); int ChillerNum{0}; - auto const &objectSchemaProps = ip->getObjectSchemaProps(state, state.dataIPShortCut->cCurrentModuleObject); + auto const &objectSchemaProps = s_ip->getObjectSchemaProps(state, state.dataIPShortCut->cCurrentModuleObject); + for (auto &instance : ChillerInstances.items()) { auto const &fields = instance.value(); std::string const &thisObjectName = instance.key(); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, thisObjectName}; + GlobalNames::VerifyUniqueChillerName( state, state.dataIPShortCut->cCurrentModuleObject, thisObjectName, ErrorsFound, state.dataIPShortCut->cCurrentModuleObject + " Name"); @@ -133,9 +140,9 @@ void getChillerASHRAE205Input(EnergyPlusData &state) auto &thisChiller = state.dataChillerElectricASHRAE205->Electric205Chiller(ChillerNum); thisChiller.Name = Util::makeUPPER(thisObjectName); - ip->markObjectAsUsed(state.dataIPShortCut->cCurrentModuleObject, thisObjectName); + s_ip->markObjectAsUsed(state.dataIPShortCut->cCurrentModuleObject, thisObjectName); - std::string const rep_file_name = ip->getAlphaFieldValue(fields, objectSchemaProps, "representation_file_name"); + std::string const rep_file_name = s_ip->getAlphaFieldValue(fields, objectSchemaProps, "representation_file_name"); fs::path rep_file_path = DataSystemVariables::CheckForActualFilePath(state, fs::path(rep_file_name), std::string(RoutineName)); if (rep_file_path.empty()) { ErrorsFound = true; @@ -155,7 +162,7 @@ void getChillerASHRAE205Input(EnergyPlusData &state) thisChiller.Representation->performance.performance_map_cooling.get_logger()->set_message_context(&thisChiller.LoggerContext); thisChiller.Representation->performance.performance_map_standby.get_logger()->set_message_context(&thisChiller.LoggerContext); thisChiller.InterpolationType = - InterpMethods[Util::makeUPPER(ip->getAlphaFieldValue(fields, objectSchemaProps, "performance_interpolation_method"))]; + InterpMethods[Util::makeUPPER(s_ip->getAlphaFieldValue(fields, objectSchemaProps, "performance_interpolation_method"))]; const auto &compressorSequence = thisChiller.Representation->performance.performance_map_cooling.grid_variables.compressor_sequence_number; // minmax_element is sound but perhaps overkill; as sequence numbers are required by A205 to be in ascending order @@ -181,8 +188,8 @@ void getChillerASHRAE205Input(EnergyPlusData &state) // ErrorsFound = true; // } - std::string const evap_inlet_node_name = ip->getAlphaFieldValue(fields, objectSchemaProps, "chilled_water_inlet_node_name"); - std::string const evap_outlet_node_name = ip->getAlphaFieldValue(fields, objectSchemaProps, "chilled_water_outlet_node_name"); + std::string const evap_inlet_node_name = s_ip->getAlphaFieldValue(fields, objectSchemaProps, "chilled_water_inlet_node_name"); + std::string const evap_outlet_node_name = s_ip->getAlphaFieldValue(fields, objectSchemaProps, "chilled_water_outlet_node_name"); if (evap_inlet_node_name.empty() || evap_outlet_node_name.empty()) { ShowSevereError(state, format("{}{}=\"{}\"", std::string{RoutineName}, state.dataIPShortCut->cCurrentModuleObject, thisChiller.Name)); ShowContinueError(state, "Evaporator Inlet or Outlet Node Name is blank."); @@ -211,8 +218,8 @@ void getChillerASHRAE205Input(EnergyPlusData &state) thisChiller.CondenserType = DataPlant::CondenserType::WaterCooled; - std::string const cond_inlet_node_name = ip->getAlphaFieldValue(fields, objectSchemaProps, "condenser_inlet_node_name"); - std::string const cond_outlet_node_name = ip->getAlphaFieldValue(fields, objectSchemaProps, "condenser_outlet_node_name"); + std::string const cond_inlet_node_name = s_ip->getAlphaFieldValue(fields, objectSchemaProps, "condenser_inlet_node_name"); + std::string const cond_outlet_node_name = s_ip->getAlphaFieldValue(fields, objectSchemaProps, "condenser_outlet_node_name"); if (cond_inlet_node_name.empty() || cond_outlet_node_name.empty()) { ShowSevereError(state, format("{}{}=\"{}\"", std::string{RoutineName}, state.dataIPShortCut->cCurrentModuleObject, thisChiller.Name)); ShowContinueError(state, "Condenser Inlet or Outlet Node Name is blank."); @@ -246,7 +253,7 @@ void getChillerASHRAE205Input(EnergyPlusData &state) "Condenser Water Nodes"); thisChiller.FlowMode = static_cast( - getEnumValue(DataPlant::FlowModeNamesUC, ip->getAlphaFieldValue(fields, objectSchemaProps, "chiller_flow_mode"))); + getEnumValue(DataPlant::FlowModeNamesUC, s_ip->getAlphaFieldValue(fields, objectSchemaProps, "chiller_flow_mode"))); if (thisChiller.FlowMode == DataPlant::FlowMode::Invalid) { ShowSevereError(state, format("{}{}=\"{}\"", std::string{RoutineName}, state.dataIPShortCut->cCurrentModuleObject, thisObjectName)); @@ -281,24 +288,19 @@ void getChillerASHRAE205Input(EnergyPlusData &state) } thisChiller.AmbientTempType = static_cast( - getEnumValue(AmbientTempNamesUC, Util::makeUPPER(ip->getAlphaFieldValue(fields, objectSchemaProps, "ambient_temperature_indicator")))); + getEnumValue(AmbientTempNamesUC, Util::makeUPPER(s_ip->getAlphaFieldValue(fields, objectSchemaProps, "ambient_temperature_indicator")))); switch (thisChiller.AmbientTempType) { case AmbientTempIndicator::Schedule: { - std::string const ambient_temp_schedule = ip->getAlphaFieldValue(fields, objectSchemaProps, "ambient_temperature_schedule"); - thisChiller.AmbientTempSchedule = ScheduleManager::GetScheduleIndex(state, ambient_temp_schedule); - if (thisChiller.AmbientTempSchedule == 0) { - ShowSevereError(state, - format("{} = {}: Ambient Temperature Schedule not found = {}", - state.dataIPShortCut->cCurrentModuleObject, - thisObjectName, - ambient_temp_schedule)); + std::string const ambient_temp_schedule = s_ip->getAlphaFieldValue(fields, objectSchemaProps, "ambient_temperature_schedule"); + if ((thisChiller.ambientTempSched = Sched::GetSchedule(state, ambient_temp_schedule)) == nullptr) { + ShowSevereItemNotFound(state, eoh, "Ambient Temperature Schedule", ambient_temp_schedule); ErrorsFound = true; } break; } case AmbientTempIndicator::TempZone: { - std::string const ambient_temp_zone_name = ip->getAlphaFieldValue(fields, objectSchemaProps, "ambient_temperature_zone_name"); + std::string const ambient_temp_zone_name = s_ip->getAlphaFieldValue(fields, objectSchemaProps, "ambient_temperature_zone_name"); thisChiller.AmbientTempZone = Util::FindItemInList(ambient_temp_zone_name, state.dataHeatBal->Zone); if (thisChiller.AmbientTempZone == 0) { ShowSevereError(state, @@ -318,7 +320,7 @@ void getChillerASHRAE205Input(EnergyPlusData &state) } case AmbientTempIndicator::OutsideAir: { std::string const ambient_temp_outdoor_node = - ip->getAlphaFieldValue(fields, objectSchemaProps, "ambient_temperature_outdoor_air_node_name"); + s_ip->getAlphaFieldValue(fields, objectSchemaProps, "ambient_temperature_outdoor_air_node_name"); thisChiller.AmbientTempOutsideAirNode = NodeInputManager::GetOnlySingleNode(state, ambient_temp_outdoor_node, ErrorsFound, @@ -350,15 +352,15 @@ void getChillerASHRAE205Input(EnergyPlusData &state) format("{} = {}: Invalid Ambient Temperature Indicator entered={}", state.dataIPShortCut->cCurrentModuleObject, thisObjectName, - ip->getAlphaFieldValue(fields, objectSchemaProps, "ambient_temperature_indicator"))); + s_ip->getAlphaFieldValue(fields, objectSchemaProps, "ambient_temperature_indicator"))); ShowContinueError(state, " Valid entries are SCHEDULE, ZONE, and OUTDOORS."); ErrorsFound = true; break; } } // end Ambient temperature - std::string const oil_cooler_inlet_node = ip->getAlphaFieldValue(fields, objectSchemaProps, "oil_cooler_inlet_node_name"); - std::string const oil_cooler_outlet_node = ip->getAlphaFieldValue(fields, objectSchemaProps, "oil_cooler_outlet_node_name"); + std::string const oil_cooler_inlet_node = s_ip->getAlphaFieldValue(fields, objectSchemaProps, "oil_cooler_inlet_node_name"); + std::string const oil_cooler_outlet_node = s_ip->getAlphaFieldValue(fields, objectSchemaProps, "oil_cooler_outlet_node_name"); if (!oil_cooler_inlet_node.empty() && !oil_cooler_outlet_node.empty()) { thisChiller.OilCoolerInletNode = NodeInputManager::GetOnlySingleNode(state, oil_cooler_inlet_node, @@ -385,8 +387,8 @@ void getChillerASHRAE205Input(EnergyPlusData &state) oil_cooler_outlet_node, "Oil Cooler Water Nodes"); } - std::string const aux_heat_inlet_node = ip->getAlphaFieldValue(fields, objectSchemaProps, "auxiliary_inlet_node_name"); - std::string const aux_heat_outlet_node = ip->getAlphaFieldValue(fields, objectSchemaProps, "auxiliary_outlet_node_name"); + std::string const aux_heat_inlet_node = s_ip->getAlphaFieldValue(fields, objectSchemaProps, "auxiliary_inlet_node_name"); + std::string const aux_heat_outlet_node = s_ip->getAlphaFieldValue(fields, objectSchemaProps, "auxiliary_outlet_node_name"); if (!aux_heat_inlet_node.empty() && !aux_heat_outlet_node.empty()) { thisChiller.AuxiliaryHeatInletNode = NodeInputManager::GetOnlySingleNode(state, @@ -424,7 +426,7 @@ void getChillerASHRAE205Input(EnergyPlusData &state) } if (fields.count("end_use_subcategory")) { - thisChiller.EndUseSubcategory = ip->getAlphaFieldValue(fields, objectSchemaProps, "end_use_subcategory"); + thisChiller.EndUseSubcategory = s_ip->getAlphaFieldValue(fields, objectSchemaProps, "end_use_subcategory"); } else { thisChiller.EndUseSubcategory = "General"; } @@ -579,7 +581,7 @@ void ASHRAE205ChillerSpecs::initialize(EnergyPlusData &state, bool const RunFlag switch (this->AmbientTempType) { case AmbientTempIndicator::Schedule: { - this->AmbientTemp = ScheduleManager::GetCurrentScheduleValue(state, this->AmbientTempSchedule); + this->AmbientTemp = this->ambientTempSched->getCurrentVal(); break; } case AmbientTempIndicator::TempZone: { @@ -597,41 +599,26 @@ void ASHRAE205ChillerSpecs::initialize(EnergyPlusData &state, bool const RunFlag this->EquipFlowCtrl = DataPlant::CompData::getPlantComponent(state, this->CWPlantLoc).FlowCtrl; if (this->MyEnvrnFlag && state.dataGlobal->BeginEnvrnFlag && (state.dataPlnt->PlantFirstSizesOkayToFinalize)) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); this->EvapMassFlowRateMax = rho * this->EvapVolFlowRate; PlantUtilities::InitComponentNodes(state, 0.0, this->EvapMassFlowRateMax, this->EvapInletNodeNum, this->EvapOutletNodeNum); if (this->CondenserType == DataPlant::CondenserType::WaterCooled) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - this->TempRefCondIn, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getDensity(state, this->TempRefCondIn, RoutineName); this->CondMassFlowRateMax = rho * this->CondVolFlowRate; PlantUtilities::InitComponentNodes(state, 0.0, this->CondMassFlowRateMax, this->CondInletNodeNum, this->CondOutletNodeNum); state.dataLoopNodes->Node(this->CondInletNodeNum).Temp = this->TempRefCondIn; } // Set mass flow rates at Oil Cooler and Aux Equipment nodes if (this->OilCoolerInletNode) { - Real64 rho_oil_cooler = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->OCPlantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->OCPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho_oil_cooler = + state.dataPlnt->PlantLoop(this->OCPlantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); this->OilCoolerMassFlowRate = rho_oil_cooler * this->OilCoolerVolFlowRate; PlantUtilities::InitComponentNodes(state, 0.0, this->OilCoolerMassFlowRate, this->OilCoolerInletNode, this->OilCoolerOutletNode); } if (this->AuxiliaryHeatInletNode) { - Real64 rho_aux = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->AHPlantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->AHPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho_aux = state.dataPlnt->PlantLoop(this->AHPlantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); this->AuxiliaryMassFlowRate = rho_aux * this->AuxiliaryVolFlowRate; PlantUtilities::InitComponentNodes(state, 0.0, this->AuxiliaryMassFlowRate, this->AuxiliaryHeatInletNode, this->AuxiliaryHeatOutletNode); } @@ -675,8 +662,8 @@ void ASHRAE205ChillerSpecs::initialize(EnergyPlusData &state, bool const RunFlag // check if inlet limit active and if exceeded. bool HeatRecRunFlag = RunFlag; - if (this->HeatRecInletLimitSchedNum > 0) { - Real64 HeatRecHighInletLimit = ScheduleManager::GetCurrentScheduleValue(state, this->HeatRecInletLimitSchedNum); + if (this->heatRecInletLimitSched != nullptr) { + Real64 HeatRecHighInletLimit = this->heatRecInletLimitSched->getCurrentVal(); if (state.dataLoopNodes->Node(this->HeatRecInletNodeNum).Temp > HeatRecHighInletLimit) { // shut down heat recovery HeatRecRunFlag = false; } else { @@ -772,16 +759,8 @@ void ASHRAE205ChillerSpecs::size([[maybe_unused]] EnergyPlusData &state) if (PltSizCondNum > 0 && PltSizNum > 0) { if (state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow && tmpNomCap > 0.0) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - this->TempRefCondIn, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getSpecificHeat(state, this->TempRefCondIn, RoutineName); tmpCondVolFlowRate = tmpNomCap * (1.0 + (1.0 / this->RefCOP) * this->CompPowerToCondenserFrac) / (state.dataSize->PlantSizData(PltSizCondNum).DeltaT * Cp * rho); @@ -879,17 +858,9 @@ void ASHRAE205ChillerSpecs::size([[maybe_unused]] EnergyPlusData &state) if (PltSizNum > 0) { if (state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); - - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getSpecificHeat(state, Constant::CWInitConvTemp, RoutineName); + + Real64 rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); tmpNomCap = Cp * rho * state.dataSize->PlantSizData(PltSizNum).DeltaT * tmpEvapVolFlowRate; } else { tmpNomCap = 0.0; @@ -1257,11 +1228,7 @@ void ASHRAE205ChillerSpecs::findEvaporatorMassFlowRate(EnergyPlusData &state, Re } } // This is the end of the FlowLock Block - const Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + const Real64 rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); this->EvapVolFlowRate = this->EvapMassFlowRate / rho; } @@ -1337,7 +1304,14 @@ void ASHRAE205ChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, boo PlantUtilities::PullCompInterconnectTrigger( state, this->CWPlantLoc, this->CondMassFlowIndex, this->CDPlantLoc, DataPlant::CriteriaType::MassFlowRate, this->CondMassFlowRate); - if (this->CondMassFlowRate < DataBranchAirLoopPlant::MassFlowTolerance) return; + if (this->CondMassFlowRate < DataBranchAirLoopPlant::MassFlowTolerance) { + MyLoad = 0.0; + this->Power = standbyPower; + this->AmbientZoneGain = standbyPower; + this->EvapMassFlowRate = 0.0; + PlantUtilities::SetComponentFlowRate(state, this->EvapMassFlowRate, this->EvapInletNodeNum, this->EvapOutletNodeNum, this->CWPlantLoc); + return; + } } Real64 EvapOutletTempSetPoint(0.0); // Evaporator outlet temperature setpoint [C] switch (state.dataPlnt->PlantLoop(PlantLoopNum).LoopDemandCalcScheme) { @@ -1392,11 +1366,8 @@ void ASHRAE205ChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, boo return; } - Real64 CpEvap = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpEvap = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp, RoutineName); // Calculate mass flow rate based on MyLoad (TODO: then adjust it after determining if chiller can meet the load) this->findEvaporatorMassFlowRate(state, MyLoad, CpEvap); @@ -1509,11 +1480,7 @@ void ASHRAE205ChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, boo // Energy balance on the chiller system gives the amount of heat lost to the ambient zone this->AmbientZoneGain = this->QEvaporator + this->Power - (this->QCondenser + QExternallyCooled); - Real64 CpCond = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - condInletTemp, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpCond = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getSpecificHeat(state, condInletTemp, RoutineName); this->CondOutletTemp = this->QCondenser / this->CondMassFlowRate / CpCond + condInletTemp; // Oil cooler and Auxiliary Heat delta-T calculations @@ -1522,11 +1489,8 @@ void ASHRAE205ChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, boo PlantUtilities::SetComponentFlowRate( state, this->OilCoolerMassFlowRate, this->OilCoolerInletNode, this->OilCoolerOutletNode, this->OCPlantLoc); - Real64 CpOilCooler = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->OCPlantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->OilCoolerInletNode).Temp, - state.dataPlnt->PlantLoop(this->OCPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpOilCooler = state.dataPlnt->PlantLoop(this->OCPlantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->OilCoolerInletNode).Temp, RoutineName); if (this->OilCoolerMassFlowRate != 0.0) { oilCoolerDeltaTemp = this->QOilCooler / (this->OilCoolerMassFlowRate * CpOilCooler); @@ -1540,11 +1504,8 @@ void ASHRAE205ChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, boo PlantUtilities::SetComponentFlowRate( state, this->AuxiliaryMassFlowRate, this->AuxiliaryHeatInletNode, this->AuxiliaryHeatOutletNode, this->AHPlantLoc); - Real64 CpAux = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->AHPlantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->AuxiliaryHeatInletNode).Temp, - state.dataPlnt->PlantLoop(this->AHPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpAux = state.dataPlnt->PlantLoop(this->AHPlantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->AuxiliaryHeatInletNode).Temp, RoutineName); if (this->AuxiliaryMassFlowRate != 0.0) { auxiliaryDeltaTemp = this->QAuxiliary / (this->AuxiliaryMassFlowRate * CpAux); diff --git a/src/EnergyPlus/ChillerElectricASHRAE205.hh b/src/EnergyPlus/ChillerElectricASHRAE205.hh index d9672a179f0..51b9d697ed1 100644 --- a/src/EnergyPlus/ChillerElectricASHRAE205.hh +++ b/src/EnergyPlus/ChillerElectricASHRAE205.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -100,7 +100,7 @@ namespace ChillerElectricASHRAE205 { Real64 AuxiliaryEnergy{0}; AmbientTempIndicator AmbientTempType{AmbientTempIndicator::Invalid}; - int AmbientTempSchedule{0}; // Schedule index pointer + Sched::Schedule *ambientTempSched = nullptr; int AmbientTempZone{0}; // Number of ambient zone around tank int AmbientTempOutsideAirNode{0}; // Number of outside air node Real64 AmbientTemp{0}; @@ -150,6 +150,10 @@ struct ChillerElectricASHRAE205Data : BaseGlobalStruct bool getInputFlag = true; Array1D Electric205Chiller; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ChillerElectricEIR.cc b/src/EnergyPlus/ChillerElectricEIR.cc index 4ffc4585300..5b64e7e2065 100644 --- a/src/EnergyPlus/ChillerElectricEIR.cc +++ b/src/EnergyPlus/ChillerElectricEIR.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -221,14 +221,17 @@ void GetElectricEIRChillerInput(EnergyPlusData &state) // This routine will get the input required by the Electric EIR Chiller model. static constexpr std::string_view RoutineName("GetElectricEIRChillerInput: "); // include trailing blank space + static constexpr std::string_view routineName = "GetElectricEIRChillerInput"; // include trailing blank space bool ErrorsFound(false); // True when input errors are found - state.dataIPShortCut->cCurrentModuleObject = "Chiller:Electric:EIR"; - int NumElectricEIRChillers = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, state.dataIPShortCut->cCurrentModuleObject); + auto &s_ipsc = state.dataIPShortCut; + + s_ipsc->cCurrentModuleObject = "Chiller:Electric:EIR"; + int NumElectricEIRChillers = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); if (NumElectricEIRChillers <= 0) { - ShowSevereError(state, format("No {} equipment specified in input file", state.dataIPShortCut->cCurrentModuleObject)); + ShowSevereError(state, format("No {} equipment specified in input file", s_ipsc->cCurrentModuleObject)); ErrorsFound = true; } @@ -241,87 +244,79 @@ void GetElectricEIRChillerInput(EnergyPlusData &state) int NumNums = 0; // Number of elements in the numeric array int IOStat = 0; // IO Status when calling get input subroutine state.dataInputProcessing->inputProcessor->getObjectItem(state, - state.dataIPShortCut->cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, EIRChillerNum, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNums, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; // ErrorsFound will be set to True if problem was found, left untouched otherwise - GlobalNames::VerifyUniqueChillerName(state, - state.dataIPShortCut->cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - ErrorsFound, - state.dataIPShortCut->cCurrentModuleObject + " Name"); + GlobalNames::VerifyUniqueChillerName( + state, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1), ErrorsFound, s_ipsc->cCurrentModuleObject + " Name"); auto &thisChiller = state.dataChillerElectricEIR->ElectricEIRChiller(EIRChillerNum); - thisChiller.Name = state.dataIPShortCut->cAlphaArgs(1); + thisChiller.Name = s_ipsc->cAlphaArgs(1); // Performance curves - thisChiller.ChillerCapFTIndex = Curve::GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(2)); + thisChiller.ChillerCapFTIndex = Curve::GetCurveIndex(state, s_ipsc->cAlphaArgs(2)); if (thisChiller.ChillerCapFTIndex == 0) { - ShowSevereError(state, - format("{}{} \"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); + ShowSevereError(state, format("{}{} \"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } - thisChiller.ChillerEIRFTIndex = Curve::GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(3)); + thisChiller.ChillerEIRFTIndex = Curve::GetCurveIndex(state, s_ipsc->cAlphaArgs(3)); if (thisChiller.ChillerEIRFTIndex == 0) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3))); + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3))); ErrorsFound = true; } - thisChiller.ChillerEIRFPLRIndex = Curve::GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(4)); + thisChiller.ChillerEIRFPLRIndex = Curve::GetCurveIndex(state, s_ipsc->cAlphaArgs(4)); if (thisChiller.ChillerEIRFPLRIndex == 0) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4))); + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4))); ErrorsFound = true; } thisChiller.EvapInletNodeNum = NodeInputManager::GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(5), + s_ipsc->cAlphaArgs(5), ErrorsFound, DataLoopNode::ConnectionObjectType::ChillerElectricEIR, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsNotParent); thisChiller.EvapOutletNodeNum = NodeInputManager::GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(6), + s_ipsc->cAlphaArgs(6), ErrorsFound, DataLoopNode::ConnectionObjectType::ChillerElectricEIR, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsNotParent); - BranchNodeConnections::TestCompSet(state, - state.dataIPShortCut->cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaArgs(5), - state.dataIPShortCut->cAlphaArgs(6), - "Chilled Water Nodes"); - - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(9), "WaterCooled")) { + BranchNodeConnections::TestCompSet( + state, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1), s_ipsc->cAlphaArgs(5), s_ipsc->cAlphaArgs(6), "Chilled Water Nodes"); + + if (Util::SameString(s_ipsc->cAlphaArgs(9), "WaterCooled")) { thisChiller.CondenserType = DataPlant::CondenserType::WaterCooled; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(9), "AirCooled")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(9), "AirCooled")) { thisChiller.CondenserType = DataPlant::CondenserType::AirCooled; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(9), "EvaporativelyCooled")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(9), "EvaporativelyCooled")) { thisChiller.CondenserType = DataPlant::CondenserType::EvapCooled; } else { - ShowSevereError(state, format("{}{}: {}", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(9), state.dataIPShortCut->cAlphaArgs(9))); + ShowSevereError(state, format("{}{}: {}", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(9), s_ipsc->cAlphaArgs(9))); ShowContinueError(state, "Valid entries are AirCooled, WaterCooled, or EvaporativelyCooled"); ErrorsFound = true; } @@ -330,26 +325,26 @@ void GetElectricEIRChillerInput(EnergyPlusData &state) // Connection not required for air or evap cooled condenser // If the condenser inlet is blank for air cooled and evap cooled condensers then supply a generic name // since it is not used elsewhere for connection - if (state.dataIPShortCut->lAlphaFieldBlanks(7)) { - if (len(state.dataIPShortCut->cAlphaArgs(1)) < Constant::MaxNameLength - 25) { // protect against long name leading to > 100 chars - state.dataIPShortCut->cAlphaArgs(7) = state.dataIPShortCut->cAlphaArgs(1) + " INLET NODE FOR CONDENSER"; + if (s_ipsc->lAlphaFieldBlanks(7)) { + if (len(s_ipsc->cAlphaArgs(1)) < Constant::MaxNameLength - 25) { // protect against long name leading to > 100 chars + s_ipsc->cAlphaArgs(7) = s_ipsc->cAlphaArgs(1) + " INLET NODE FOR CONDENSER"; } else { - state.dataIPShortCut->cAlphaArgs(7) = state.dataIPShortCut->cAlphaArgs(1).substr(0, 75) + " INLET NODE FOR CONDENSER"; + s_ipsc->cAlphaArgs(7) = s_ipsc->cAlphaArgs(1).substr(0, 75) + " INLET NODE FOR CONDENSER"; } } - if (state.dataIPShortCut->lAlphaFieldBlanks(8)) { - if (len(state.dataIPShortCut->cAlphaArgs(1)) < Constant::MaxNameLength - 26) { // protect against long name leading to > 100 chars - state.dataIPShortCut->cAlphaArgs(8) = state.dataIPShortCut->cAlphaArgs(1) + " OUTLET NODE FOR CONDENSER"; + if (s_ipsc->lAlphaFieldBlanks(8)) { + if (len(s_ipsc->cAlphaArgs(1)) < Constant::MaxNameLength - 26) { // protect against long name leading to > 100 chars + s_ipsc->cAlphaArgs(8) = s_ipsc->cAlphaArgs(1) + " OUTLET NODE FOR CONDENSER"; } else { - state.dataIPShortCut->cAlphaArgs(8) = state.dataIPShortCut->cAlphaArgs(1).substr(0, 74) + " OUTLET NODE FOR CONDENSER"; + s_ipsc->cAlphaArgs(8) = s_ipsc->cAlphaArgs(1).substr(0, 74) + " OUTLET NODE FOR CONDENSER"; } } thisChiller.CondInletNodeNum = NodeInputManager::GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(7), + s_ipsc->cAlphaArgs(7), ErrorsFound, DataLoopNode::ConnectionObjectType::ChillerElectricEIR, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::OutsideAirReference, NodeInputManager::CompFluidStream::Secondary, @@ -357,16 +352,15 @@ void GetElectricEIRChillerInput(EnergyPlusData &state) bool Okay = true; OutAirNodeManager::CheckAndAddAirNodeNumber(state, thisChiller.CondInletNodeNum, Okay); if (!Okay) { - ShowWarningError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Adding OutdoorAir:Node={}", state.dataIPShortCut->cAlphaArgs(7))); + ShowWarningError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Adding OutdoorAir:Node={}", s_ipsc->cAlphaArgs(7))); } thisChiller.CondOutletNodeNum = NodeInputManager::GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(8), + s_ipsc->cAlphaArgs(8), ErrorsFound, DataLoopNode::ConnectionObjectType::ChillerElectricEIR, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Secondary, @@ -374,231 +368,203 @@ void GetElectricEIRChillerInput(EnergyPlusData &state) } else if (thisChiller.CondenserType == DataPlant::CondenserType::WaterCooled) { // Condenser inlet node name is necessary for water-cooled condenser - if (state.dataIPShortCut->lAlphaFieldBlanks(7) || state.dataIPShortCut->lAlphaFieldBlanks(8)) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + if (s_ipsc->lAlphaFieldBlanks(7) || s_ipsc->lAlphaFieldBlanks(8)) { + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "Condenser Inlet or Outlet Node Name is blank."); ErrorsFound = true; } thisChiller.CondInletNodeNum = NodeInputManager::GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(7), + s_ipsc->cAlphaArgs(7), ErrorsFound, DataLoopNode::ConnectionObjectType::ChillerElectricEIR, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Secondary, DataLoopNode::ObjectIsNotParent); thisChiller.CondOutletNodeNum = NodeInputManager::GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(8), + s_ipsc->cAlphaArgs(8), ErrorsFound, DataLoopNode::ConnectionObjectType::ChillerElectricEIR, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Secondary, DataLoopNode::ObjectIsNotParent); - BranchNodeConnections::TestCompSet(state, - state.dataIPShortCut->cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaArgs(7), - state.dataIPShortCut->cAlphaArgs(8), - "Condenser Water Nodes"); + BranchNodeConnections::TestCompSet( + state, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1), s_ipsc->cAlphaArgs(7), s_ipsc->cAlphaArgs(8), "Condenser Water Nodes"); } else { // Condenser inlet node name is necessary (never should reach this part of code) - if (state.dataIPShortCut->lAlphaFieldBlanks(7) || state.dataIPShortCut->lAlphaFieldBlanks(8)) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + if (s_ipsc->lAlphaFieldBlanks(7) || s_ipsc->lAlphaFieldBlanks(8)) { + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "Condenser Inlet or Outlet Node Name is blank."); ErrorsFound = true; } thisChiller.CondInletNodeNum = NodeInputManager::GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(7), + s_ipsc->cAlphaArgs(7), ErrorsFound, DataLoopNode::ConnectionObjectType::ChillerElectricEIR, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Blank, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Secondary, DataLoopNode::ObjectIsNotParent); thisChiller.CondOutletNodeNum = NodeInputManager::GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(8), + s_ipsc->cAlphaArgs(8), ErrorsFound, DataLoopNode::ConnectionObjectType::ChillerElectricEIR, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Blank, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Secondary, DataLoopNode::ObjectIsNotParent); BranchNodeConnections::TestCompSet(state, - state.dataIPShortCut->cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaArgs(7), - state.dataIPShortCut->cAlphaArgs(8), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaArgs(7), + s_ipsc->cAlphaArgs(8), "Condenser (unknown?) Nodes"); } - thisChiller.FlowMode = static_cast(getEnumValue(DataPlant::FlowModeNamesUC, state.dataIPShortCut->cAlphaArgs(10))); + thisChiller.FlowMode = static_cast(getEnumValue(DataPlant::FlowModeNamesUC, s_ipsc->cAlphaArgs(10))); if (thisChiller.FlowMode == DataPlant::FlowMode::Invalid) { - ShowSevereError(state, - format("{}{}=\"{}\",", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(10), state.dataIPShortCut->cAlphaArgs(10))); + ShowSevereError(state, format("{}{}=\"{}\",", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(10), s_ipsc->cAlphaArgs(10))); ShowContinueError(state, "Available choices are ConstantFlow, NotModulated, or LeavingSetpointModulated"); ShowContinueError(state, "Flow mode NotModulated is assumed and the simulation continues."); thisChiller.FlowMode = DataPlant::FlowMode::NotModulated; }; // Chiller rated performance data - thisChiller.RefCap = state.dataIPShortCut->rNumericArgs(1); + thisChiller.RefCap = s_ipsc->rNumericArgs(1); if (thisChiller.RefCap == DataSizing::AutoSize) { thisChiller.RefCapWasAutoSized = true; } - if (state.dataIPShortCut->rNumericArgs(1) == 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {}={:.2R}", state.dataIPShortCut->cNumericFieldNames(1), state.dataIPShortCut->rNumericArgs(1))); + if (s_ipsc->rNumericArgs(1) == 0.0) { + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {}={:.2R}", s_ipsc->cNumericFieldNames(1), s_ipsc->rNumericArgs(1))); ErrorsFound = true; } - thisChiller.RefCOP = state.dataIPShortCut->rNumericArgs(2); - if (state.dataIPShortCut->rNumericArgs(2) == 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {}={:.2R}", state.dataIPShortCut->cNumericFieldNames(2), state.dataIPShortCut->rNumericArgs(2))); + thisChiller.RefCOP = s_ipsc->rNumericArgs(2); + if (s_ipsc->rNumericArgs(2) == 0.0) { + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {}={:.2R}", s_ipsc->cNumericFieldNames(2), s_ipsc->rNumericArgs(2))); ErrorsFound = true; } - thisChiller.TempRefEvapOut = state.dataIPShortCut->rNumericArgs(3); - thisChiller.TempRefCondIn = state.dataIPShortCut->rNumericArgs(4); - thisChiller.EvapVolFlowRate = state.dataIPShortCut->rNumericArgs(5); + thisChiller.TempRefEvapOut = s_ipsc->rNumericArgs(3); + thisChiller.TempRefCondIn = s_ipsc->rNumericArgs(4); + thisChiller.EvapVolFlowRate = s_ipsc->rNumericArgs(5); if (thisChiller.EvapVolFlowRate == DataSizing::AutoSize) { thisChiller.EvapVolFlowRateWasAutoSized = true; } - thisChiller.CondVolFlowRate = state.dataIPShortCut->rNumericArgs(6); + thisChiller.CondVolFlowRate = s_ipsc->rNumericArgs(6); if (thisChiller.CondVolFlowRate == DataSizing::AutoSize) { thisChiller.CondVolFlowRateWasAutoSized = true; } - thisChiller.MinPartLoadRat = state.dataIPShortCut->rNumericArgs(7); - thisChiller.MaxPartLoadRat = state.dataIPShortCut->rNumericArgs(8); - thisChiller.OptPartLoadRat = state.dataIPShortCut->rNumericArgs(9); - thisChiller.MinUnloadRat = state.dataIPShortCut->rNumericArgs(10); - thisChiller.SizFac = state.dataIPShortCut->rNumericArgs(15); + thisChiller.MinPartLoadRat = s_ipsc->rNumericArgs(7); + thisChiller.MaxPartLoadRat = s_ipsc->rNumericArgs(8); + thisChiller.OptPartLoadRat = s_ipsc->rNumericArgs(9); + thisChiller.MinUnloadRat = s_ipsc->rNumericArgs(10); + thisChiller.SizFac = s_ipsc->rNumericArgs(15); if (thisChiller.SizFac <= 0.0) thisChiller.SizFac = 1.0; if (thisChiller.MinPartLoadRat > thisChiller.MaxPartLoadRat) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, format("{} [{:.3R}] > {} [{:.3R}]", - state.dataIPShortCut->cNumericFieldNames(7), - state.dataIPShortCut->rNumericArgs(7), - state.dataIPShortCut->cNumericFieldNames(8), - state.dataIPShortCut->rNumericArgs(8))); + s_ipsc->cNumericFieldNames(7), + s_ipsc->rNumericArgs(7), + s_ipsc->cNumericFieldNames(8), + s_ipsc->rNumericArgs(8))); ShowContinueError(state, "Minimum part load ratio must be less than or equal to the maximum part load ratio "); ErrorsFound = true; } if (thisChiller.MinUnloadRat < thisChiller.MinPartLoadRat || thisChiller.MinUnloadRat > thisChiller.MaxPartLoadRat) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("{} = {:.3R}", state.dataIPShortCut->cNumericFieldNames(10), state.dataIPShortCut->rNumericArgs(10))); + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{} = {:.3R}", s_ipsc->cNumericFieldNames(10), s_ipsc->rNumericArgs(10))); ShowContinueError(state, - format("{} must be greater than or equal to the {}", - state.dataIPShortCut->cNumericFieldNames(10), - state.dataIPShortCut->cNumericFieldNames(7))); + format("{} must be greater than or equal to the {}", s_ipsc->cNumericFieldNames(10), s_ipsc->cNumericFieldNames(7))); ShowContinueError(state, - format("{} must be less than or equal to the {}", - state.dataIPShortCut->cNumericFieldNames(10), - state.dataIPShortCut->cNumericFieldNames(8))); + format("{} must be less than or equal to the {}", s_ipsc->cNumericFieldNames(10), s_ipsc->cNumericFieldNames(8))); ErrorsFound = true; } if (thisChiller.OptPartLoadRat < thisChiller.MinPartLoadRat || thisChiller.OptPartLoadRat > thisChiller.MaxPartLoadRat) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("{} = {:.3R}", state.dataIPShortCut->cNumericFieldNames(9), state.dataIPShortCut->rNumericArgs(9))); - ShowContinueError(state, - format("{} must be greater than or equal to the {}", - state.dataIPShortCut->cNumericFieldNames(9), - state.dataIPShortCut->cNumericFieldNames(7))); + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{} = {:.3R}", s_ipsc->cNumericFieldNames(9), s_ipsc->rNumericArgs(9))); ShowContinueError(state, - format("{} must be less than or equal to the {}", - state.dataIPShortCut->cNumericFieldNames(9), - state.dataIPShortCut->cNumericFieldNames(8))); + format("{} must be greater than or equal to the {}", s_ipsc->cNumericFieldNames(9), s_ipsc->cNumericFieldNames(7))); + ShowContinueError(state, format("{} must be less than or equal to the {}", s_ipsc->cNumericFieldNames(9), s_ipsc->cNumericFieldNames(8))); ErrorsFound = true; } - thisChiller.CondenserFanPowerRatio = state.dataIPShortCut->rNumericArgs(11); - thisChiller.CompPowerToCondenserFrac = state.dataIPShortCut->rNumericArgs(12); + thisChiller.CondenserFanPowerRatio = s_ipsc->rNumericArgs(11); + thisChiller.CompPowerToCondenserFrac = s_ipsc->rNumericArgs(12); if (thisChiller.CompPowerToCondenserFrac < 0.0 || thisChiller.CompPowerToCondenserFrac > 1.0) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("{} = {:.3R}", state.dataIPShortCut->cNumericFieldNames(12), state.dataIPShortCut->rNumericArgs(12))); - ShowContinueError(state, format("{} must be greater than or equal to zero", state.dataIPShortCut->cNumericFieldNames(12))); - ShowContinueError(state, format("{} must be less than or equal to one", state.dataIPShortCut->cNumericFieldNames(12))); + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{} = {:.3R}", s_ipsc->cNumericFieldNames(12), s_ipsc->rNumericArgs(12))); + ShowContinueError(state, format("{} must be greater than or equal to zero", s_ipsc->cNumericFieldNames(12))); + ShowContinueError(state, format("{} must be less than or equal to one", s_ipsc->cNumericFieldNames(12))); ErrorsFound = true; } - thisChiller.TempLowLimitEvapOut = state.dataIPShortCut->rNumericArgs(13); + thisChiller.TempLowLimitEvapOut = s_ipsc->rNumericArgs(13); // These are the heat recovery inputs - thisChiller.DesignHeatRecVolFlowRate = state.dataIPShortCut->rNumericArgs(14); + thisChiller.DesignHeatRecVolFlowRate = s_ipsc->rNumericArgs(14); if (thisChiller.DesignHeatRecVolFlowRate == DataSizing::AutoSize) { thisChiller.DesignHeatRecVolFlowRateWasAutoSized = true; } if ((thisChiller.DesignHeatRecVolFlowRate > 0.0) || (thisChiller.DesignHeatRecVolFlowRate == DataSizing::AutoSize)) { thisChiller.HeatRecActive = true; thisChiller.HeatRecInletNodeNum = NodeInputManager::GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(11), + s_ipsc->cAlphaArgs(11), ErrorsFound, DataLoopNode::ConnectionObjectType::ChillerElectricEIR, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Tertiary, DataLoopNode::ObjectIsNotParent); if (thisChiller.HeatRecInletNodeNum == 0) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(11), state.dataIPShortCut->cAlphaArgs(11))); + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(11), s_ipsc->cAlphaArgs(11))); ErrorsFound = true; } thisChiller.HeatRecOutletNodeNum = NodeInputManager::GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(12), + s_ipsc->cAlphaArgs(12), ErrorsFound, DataLoopNode::ConnectionObjectType::ChillerElectricEIR, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Tertiary, DataLoopNode::ObjectIsNotParent); if (thisChiller.HeatRecOutletNodeNum == 0) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(12), state.dataIPShortCut->cAlphaArgs(12))); + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(12), s_ipsc->cAlphaArgs(12))); ErrorsFound = true; } - BranchNodeConnections::TestCompSet(state, - state.dataIPShortCut->cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaArgs(11), - state.dataIPShortCut->cAlphaArgs(12), - "Heat Recovery Nodes"); + BranchNodeConnections::TestCompSet( + state, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1), s_ipsc->cAlphaArgs(11), s_ipsc->cAlphaArgs(12), "Heat Recovery Nodes"); // store heat recovery volume flow for plant sizing if (thisChiller.DesignHeatRecVolFlowRate > 0.0) { PlantUtilities::RegisterPlantCompDesignFlow(state, thisChiller.HeatRecInletNodeNum, thisChiller.DesignHeatRecVolFlowRate); // CR 6953 } if (NumNums > 17) { - if (!state.dataIPShortCut->lNumericFieldBlanks(18)) { - thisChiller.HeatRecCapacityFraction = state.dataIPShortCut->rNumericArgs(18); + if (!s_ipsc->lNumericFieldBlanks(18)) { + thisChiller.HeatRecCapacityFraction = s_ipsc->rNumericArgs(18); } else { thisChiller.HeatRecCapacityFraction = 1.0; } @@ -606,31 +572,20 @@ void GetElectricEIRChillerInput(EnergyPlusData &state) thisChiller.HeatRecCapacityFraction = 1.0; } - if (NumAlphas > 13) { - if (!state.dataIPShortCut->lAlphaFieldBlanks(14)) { - thisChiller.HeatRecInletLimitSchedNum = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(14)); - if (thisChiller.HeatRecInletLimitSchedNum == 0) { - ShowSevereError( - state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, - format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(14), state.dataIPShortCut->cAlphaArgs(14))); - ErrorsFound = true; - } - } else { - thisChiller.HeatRecInletLimitSchedNum = 0; - } - } else { - thisChiller.HeatRecInletLimitSchedNum = 0; + if (NumAlphas <= 13 || s_ipsc->lAlphaFieldBlanks(14)) { + thisChiller.heatRecInletLimitSched = nullptr; // Ok for this schedule to remain null if field is empty + } else if ((thisChiller.heatRecInletLimitSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(14))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(14), s_ipsc->cAlphaArgs(14)); + ErrorsFound = true; } if (NumAlphas > 14) { - if (!state.dataIPShortCut->lAlphaFieldBlanks(15)) { + if (!s_ipsc->lAlphaFieldBlanks(15)) { thisChiller.HeatRecSetPointNodeNum = NodeInputManager::GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(15), + s_ipsc->cAlphaArgs(15), ErrorsFound, DataLoopNode::ConnectionObjectType::ChillerElectricEIR, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Sensor, NodeInputManager::CompFluidStream::Primary, @@ -647,63 +602,55 @@ void GetElectricEIRChillerInput(EnergyPlusData &state) thisChiller.DesignHeatRecMassFlowRate = 0.0; thisChiller.HeatRecInletNodeNum = 0; thisChiller.HeatRecOutletNodeNum = 0; - if (!state.dataIPShortCut->lAlphaFieldBlanks(11) || !state.dataIPShortCut->lAlphaFieldBlanks(12)) { - ShowWarningError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + if (!s_ipsc->lAlphaFieldBlanks(11) || !s_ipsc->lAlphaFieldBlanks(12)) { + ShowWarningError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "Since Reference Heat Reclaim Volume Flow Rate = 0.0, heat recovery is inactive."); ShowContinueError(state, "However, node names were specified for heat recovery inlet or outlet nodes."); } } if (NumAlphas > 16) { - thisChiller.CondenserFlowControl = static_cast( - getEnumValue(DataPlant::CondenserFlowControlNamesUC, state.dataIPShortCut->cAlphaArgs(17))); + thisChiller.CondenserFlowControl = + static_cast(getEnumValue(DataPlant::CondenserFlowControlNamesUC, s_ipsc->cAlphaArgs(17))); } else { thisChiller.CondenserFlowControl = DataPlant::CondenserFlowControl::ConstantFlow; } if (thisChiller.CondenserFlowControl == DataPlant::CondenserFlowControl::Invalid) { - ShowSevereError(state, - format("{}{}=\"{}\",", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(17), state.dataIPShortCut->cAlphaArgs(17))); + ShowSevereError(state, format("{}{}=\"{}\",", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(17), s_ipsc->cAlphaArgs(17))); ShowContinueError(state, "Available choices are ConstantFlow, ModulatedChillerPLR, ModulatedLoopPLR, or ModulatedDeltaTemperature"); ShowContinueError(state, "Flow mode ConstantFlow is assumed and the simulation continues."); thisChiller.CondenserFlowControl = DataPlant::CondenserFlowControl::ConstantFlow; }; if (NumAlphas > 17) { - thisChiller.ChillerCondLoopFlowFLoopPLRIndex = Curve::GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(18)); + thisChiller.ChillerCondLoopFlowFLoopPLRIndex = Curve::GetCurveIndex(state, s_ipsc->cAlphaArgs(18)); } if ((thisChiller.ChillerCondLoopFlowFLoopPLRIndex == 0) && (thisChiller.CondenserFlowControl == DataPlant::CondenserFlowControl::ModulatedLoopPLR)) { - ShowSevereError(state, - format("{}{} \"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(18), state.dataIPShortCut->cAlphaArgs(18))); + ShowSevereError(state, format("{}{} \"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(18), s_ipsc->cAlphaArgs(18))); ErrorsFound = true; } - if (NumAlphas > 18) { - if (!state.dataIPShortCut->lAlphaFieldBlanks(19)) { - thisChiller.CondDTScheduleNum = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(19)); - } - } - if (thisChiller.CondDTScheduleNum == 0 && thisChiller.CondenserFlowControl == DataPlant::CondenserFlowControl::ModulatedDeltaTemperature) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(19), state.dataIPShortCut->cAlphaArgs(19))); + if (NumAlphas <= 18 || s_ipsc->lAlphaFieldBlanks(19)) { + thisChiller.condDTSched = nullptr; // Okay for this schedule to remain nullptr if field is empty + } else if (((thisChiller.condDTSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(19))) == nullptr) && + thisChiller.CondenserFlowControl == DataPlant::CondenserFlowControl::ModulatedDeltaTemperature) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(19), s_ipsc->cAlphaArgs(19)); ErrorsFound = true; } if (NumNums > 18) { - thisChiller.MinCondFlowRatio = state.dataIPShortCut->rNumericArgs(19); + thisChiller.MinCondFlowRatio = s_ipsc->rNumericArgs(19); } // Check the CAP-FT, EIR-FT, and PLR curves and warn user if different from 1.0 by more than +-10% if (thisChiller.ChillerCapFTIndex > 0) { Real64 CurveVal = Curve::CurveValue(state, thisChiller.ChillerCapFTIndex, thisChiller.TempRefEvapOut, thisChiller.TempRefCondIn); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowWarningError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError( state, "Capacity ratio as a function of temperature curve output is not equal to 1.0 (+ or - 10%) at reference conditions."); ShowContinueError(state, format("Curve output at reference conditions = {:.3T}", CurveVal)); @@ -713,8 +660,7 @@ void GetElectricEIRChillerInput(EnergyPlusData &state) if (thisChiller.ChillerEIRFTIndex > 0) { Real64 CurveVal = Curve::CurveValue(state, thisChiller.ChillerEIRFTIndex, thisChiller.TempRefEvapOut, thisChiller.TempRefCondIn); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowWarningError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError( state, "Energy input ratio as a function of temperature curve output is not equal to 1.0 (+ or - 10%) at reference conditions."); ShowContinueError(state, format("Curve output at reference conditions = {:.3T}", CurveVal)); @@ -725,8 +671,7 @@ void GetElectricEIRChillerInput(EnergyPlusData &state) Real64 CurveVal = Curve::CurveValue(state, thisChiller.ChillerEIRFPLRIndex, 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowWarningError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError( state, "Energy input ratio as a function of part-load ratio curve output is not equal to 1.0 (+ or - 10%) at reference conditions."); @@ -743,8 +688,7 @@ void GetElectricEIRChillerInput(EnergyPlusData &state) CurveValArray(CurveCheck + 1) = int(CurveValTmp * 100.0) / 100.0; } if (FoundNegValue) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "Energy input ratio as a function of part-load ratio curve shows negative values."); ShowContinueError(state, "EIR as a function of PLR curve output at various part-load ratios shown below:"); ShowContinueError(state, "PLR = 0.00 0.10 0.20 0.30 0.40 0.50 0.60 0.70 0.80 0.90 1.00"); @@ -753,57 +697,53 @@ void GetElectricEIRChillerInput(EnergyPlusData &state) } } // Basin heater power as a function of temperature must be greater than or equal to 0 - thisChiller.BasinHeaterPowerFTempDiff = state.dataIPShortCut->rNumericArgs(16); - if (state.dataIPShortCut->rNumericArgs(16) < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("{} must be >= 0", state.dataIPShortCut->cNumericFieldNames(16))); + thisChiller.BasinHeaterPowerFTempDiff = s_ipsc->rNumericArgs(16); + if (s_ipsc->rNumericArgs(16) < 0.0) { + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{} must be >= 0", s_ipsc->cNumericFieldNames(16))); ErrorsFound = true; } - thisChiller.BasinHeaterSetPointTemp = state.dataIPShortCut->rNumericArgs(17); + thisChiller.BasinHeaterSetPointTemp = s_ipsc->rNumericArgs(17); if (thisChiller.BasinHeaterPowerFTempDiff > 0.0) { if (NumNums < 17) { thisChiller.BasinHeaterSetPointTemp = 2.0; } if (thisChiller.BasinHeaterSetPointTemp < 2.0) { - ShowWarningError(state, - format("{}{} \"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("{} is less than 2 deg C. Freezing could occur.", state.dataIPShortCut->cNumericFieldNames(17))); + ShowWarningError(state, format("{}{} \"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{} is less than 2 deg C. Freezing could occur.", s_ipsc->cNumericFieldNames(17))); } } - if (!state.dataIPShortCut->lAlphaFieldBlanks(13)) { - thisChiller.BasinHeaterSchedulePtr = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(13)); - if (thisChiller.BasinHeaterSchedulePtr == 0) { - ShowWarningError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowWarningError(state, - format("{} \"{}\" was not found. Basin heater operation will not be modeled and the simulation continues", - state.dataIPShortCut->cAlphaFieldNames(13), - state.dataIPShortCut->cAlphaArgs(13))); + if (!s_ipsc->lAlphaFieldBlanks(13)) { + if ((thisChiller.basinHeaterSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(13))) == nullptr) { + ShowWarningItemNotFound(state, + eoh, + s_ipsc->cAlphaFieldNames(13), + s_ipsc->cAlphaArgs(13), + "Basin heater operation will not be modeled and the simulation continues"); } } if (NumAlphas > 15) { - thisChiller.EndUseSubcategory = state.dataIPShortCut->cAlphaArgs(16); + thisChiller.EndUseSubcategory = s_ipsc->cAlphaArgs(16); } else { thisChiller.EndUseSubcategory = "General"; } - if (!state.dataIPShortCut->lAlphaFieldBlanks(20)) { - thisChiller.thermosiphonTempCurveIndex = Curve::GetCurveIndex(state, Util::makeUPPER(state.dataIPShortCut->cAlphaArgs(20))); + if (!s_ipsc->lAlphaFieldBlanks(20)) { + thisChiller.thermosiphonTempCurveIndex = Curve::GetCurveIndex(state, Util::makeUPPER(s_ipsc->cAlphaArgs(20))); if (thisChiller.thermosiphonTempCurveIndex == 0) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, thisChiller.Name)); - ShowContinueError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(20), state.dataIPShortCut->cAlphaArgs(20))); + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, thisChiller.Name)); + ShowContinueError(state, format("Invalid {} = {}", s_ipsc->cAlphaFieldNames(20), s_ipsc->cAlphaArgs(20))); ErrorsFound = true; } } - thisChiller.thermosiphonMinTempDiff = state.dataIPShortCut->rNumericArgs(20); + thisChiller.thermosiphonMinTempDiff = s_ipsc->rNumericArgs(20); } if (ErrorsFound) { - ShowFatalError(state, format("Errors found in processing input for {}", state.dataIPShortCut->cCurrentModuleObject)); + ShowFatalError(state, format("Errors found in processing input for {}", s_ipsc->cCurrentModuleObject)); } } @@ -1212,11 +1152,7 @@ void ElectricEIRChillerSpecs::initEachEnvironment(EnergyPlusData &state) static constexpr std::string_view RoutineName("ElectricEIRChillerSpecs::initEachEnvironment"); - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); this->EvapMassFlowRateMax = this->EvapVolFlowRate * rho; @@ -1224,11 +1160,7 @@ void ElectricEIRChillerSpecs::initEachEnvironment(EnergyPlusData &state) if (this->CondenserType == DataPlant::CondenserType::WaterCooled) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - this->TempRefCondIn, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getDensity(state, this->TempRefCondIn, RoutineName); this->CondMassFlowRateMax = rho * this->CondVolFlowRate; PlantUtilities::InitComponentNodes(state, 0.0, this->CondMassFlowRateMax, this->CondInletNodeNum, this->CondOutletNodeNum); state.dataLoopNodes->Node(this->CondInletNodeNum).Temp = this->TempRefCondIn; @@ -1250,11 +1182,7 @@ void ElectricEIRChillerSpecs::initEachEnvironment(EnergyPlusData &state) } if (this->HeatRecActive) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); this->DesignHeatRecMassFlowRate = rho * this->DesignHeatRecVolFlowRate; PlantUtilities::InitComponentNodes(state, 0.0, this->DesignHeatRecMassFlowRate, this->HeatRecInletNodeNum, this->HeatRecOutletNodeNum); @@ -1468,17 +1396,9 @@ void ElectricEIRChillerSpecs::size(EnergyPlusData &state) if (PltSizNum > 0) { if (state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); - - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getSpecificHeat(state, Constant::CWInitConvTemp, RoutineName); + + Real64 rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); tmpNomCap = Cp * rho * state.dataSize->PlantSizData(PltSizNum).DeltaT * tmpEvapVolFlowRate; } else { tmpNomCap = 0.0; @@ -1531,16 +1451,8 @@ void ElectricEIRChillerSpecs::size(EnergyPlusData &state) if (PltSizCondNum > 0 && PltSizNum > 0) { if (state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow && tmpNomCap > 0.0) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - this->TempRefCondIn, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - this->TempRefCondIn, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getDensity(state, this->TempRefCondIn, RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getSpecificHeat(state, this->TempRefCondIn, RoutineName); tmpCondVolFlowRate = tmpNomCap * (1.0 + (1.0 / this->RefCOP) * this->CompPowerToCondenserFrac) / (state.dataSize->PlantSizData(PltSizCondNum).DeltaT * Cp * rho); @@ -1877,7 +1789,7 @@ void ElectricEIRChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, b } if (this->CondenserType == DataPlant::CondenserType::EvapCooled) { CalcBasinHeaterPower( - state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); + state, this->BasinHeaterPowerFTempDiff, this->basinHeaterSched, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); } this->PrintMessage = false; return; @@ -1962,11 +1874,11 @@ void ElectricEIRChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, b state, this->CWPlantLoc, this->CondMassFlowIndex, this->CDPlantLoc, DataPlant::CriteriaType::MassFlowRate, this->CondMassFlowRate); if (this->CondMassFlowRate < DataBranchAirLoopPlant::MassFlowTolerance) { - if (this->EvapMassFlowRate < DataBranchAirLoopPlant::MassFlowTolerance) { - // Use PlantUtilities::SetComponentFlowRate to decide actual flow - PlantUtilities::SetComponentFlowRate( - state, this->EvapMassFlowRate, this->EvapInletNodeNum, this->EvapOutletNodeNum, this->CWPlantLoc); - } + // Shut chiller off if there is no condenser water flow + MyLoad = 0.0; + this->EvapMassFlowRate = 0.0; + // Use PlantUtilities::SetComponentFlowRate to decide actual flow + PlantUtilities::SetComponentFlowRate(state, this->EvapMassFlowRate, this->EvapInletNodeNum, this->EvapOutletNodeNum, this->CWPlantLoc); return; } } @@ -2060,11 +1972,8 @@ void ElectricEIRChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, b if (DataPlant::CompData::getPlantComponent(state, this->CWPlantLoc).CurOpSchemeType == DataPlant::OpScheme::CompSetPtBased) { // Calculate water side load - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp, RoutineName); this->EvapMassFlowRate = state.dataLoopNodes->Node(this->EvapInletNodeNum).MassFlowRate; switch (state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).LoopDemandCalcScheme) { case DataPlant::LoopDemandCalcScheme::SingleSetPoint: { @@ -2093,11 +2002,8 @@ void ElectricEIRChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, b PartLoadRat = max(0.0, min(std::abs(MyLoad) / AvailChillerCap, this->MaxPartLoadRat)); } - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp, RoutineName); if (DataPlant::CompData::getPlantComponent(state, this->CWPlantLoc).CurOpSchemeType == DataPlant::OpScheme::CompSetPtBased) { this->PossibleSubcooling = false; @@ -2190,7 +2096,7 @@ void ElectricEIRChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, b MyLoad = 0.0; if (this->CondenserType == DataPlant::CondenserType::EvapCooled) { CalcBasinHeaterPower( - state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); + state, this->BasinHeaterPowerFTempDiff, this->basinHeaterSched, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); } this->PrintMessage = false; return; @@ -2302,8 +2208,7 @@ void ElectricEIRChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, b this->ChillerFalseLoadRate = 0.0; } if (this->QEvaporator == 0.0 && this->CondenserType == DataPlant::CondenserType::EvapCooled) { - CalcBasinHeaterPower( - state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); + CalcBasinHeaterPower(state, this->BasinHeaterPowerFTempDiff, this->basinHeaterSched, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); } this->ChillerEIRFT = Curve::CurveValue(state, this->ChillerEIRFTIndex, this->EvapOutletTemp, AvgCondSinkTemp); @@ -2385,11 +2290,7 @@ void ElectricEIRChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, b Real64 condWaterFlowFrac = Curve::CurveValue(state, this->ChillerCondLoopFlowFLoopPLRIndex, cwhLoopPLR); Real64 cwLoopDesVolFlowRate = state.dataSize->PlantSizData(CondPltSizNum).DesVolFlowRate; Real64 cwLoopVolFlowRate = condWaterFlowFrac * cwLoopDesVolFlowRate; - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - this->TempRefCondIn, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getDensity(state, this->TempRefCondIn, RoutineName); if (chwLoopDemand > 0) { this->CondMassFlowRate = cwLoopVolFlowRate * rho * this->QEvaporator / chwLoopDemand; } else { @@ -2403,14 +2304,10 @@ void ElectricEIRChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, b } } break; case DataPlant::CondenserFlowControl::ModulatedDeltaTemperature: { - Real64 CpCond = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - this->CondInletTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpCond = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getSpecificHeat(state, this->CondInletTemp, RoutineName); Real64 condDT = 0.0; - if (this->CondDTScheduleNum > 0) { - condDT = ScheduleManager::GetCurrentScheduleValue(state, this->CondDTScheduleNum); + if (this->condDTSched != nullptr) { + condDT = this->condDTSched->getCurrentVal(); } this->CondMassFlowRate = this->QCondenser / (CpCond * condDT); } break; @@ -2431,11 +2328,7 @@ void ElectricEIRChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, b if (this->CondMassFlowRate > DataBranchAirLoopPlant::MassFlowTolerance) { // If Heat Recovery specified for this vapor compression chiller, then Qcondenser will be adjusted by this subroutine if (this->HeatRecActive) this->calcHeatRecovery(state, this->QCondenser, this->CondMassFlowRate, condInletTemp, this->QHeatRecovered); - Real64 CpCond = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - condInletTemp, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpCond = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getSpecificHeat(state, condInletTemp, RoutineName); this->CondOutletTemp = this->QCondenser / this->CondMassFlowRate / CpCond + condInletTemp; } else { @@ -2500,18 +2393,10 @@ void ElectricEIRChillerSpecs::calcHeatRecovery(EnergyPlusData &state, Real64 heatRecInletTemp = state.dataLoopNodes->Node(this->HeatRecInletNodeNum).Temp; Real64 HeatRecMassFlowRate = state.dataLoopNodes->Node(this->HeatRecInletNodeNum).MassFlowRate; - Real64 CpHeatRec = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidName, - heatRecInletTemp, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpHeatRec = state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).glycol->getSpecificHeat(state, heatRecInletTemp, RoutineName); Real64 CpCond; if (this->CondenserType == DataPlant::CondenserType::WaterCooled) { - CpCond = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - condInletTemp, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + CpCond = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getSpecificHeat(state, condInletTemp, RoutineName); } else { CpCond = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(this->HeatRecInletNodeNum).HumRat); } @@ -2552,8 +2437,8 @@ void ElectricEIRChillerSpecs::calcHeatRecovery(EnergyPlusData &state, } // check if limit on inlet is present and exceeded. - if (this->HeatRecInletLimitSchedNum > 0) { - Real64 HeatRecHighInletLimit = ScheduleManager::GetCurrentScheduleValue(state, this->HeatRecInletLimitSchedNum); + if (this->heatRecInletLimitSched != nullptr) { + Real64 HeatRecHighInletLimit = this->heatRecInletLimitSched->getCurrentVal(); if (heatRecInletTemp > HeatRecHighInletLimit) { // shut down heat recovery QHeatRec = 0.0; } diff --git a/src/EnergyPlus/ChillerElectricEIR.hh b/src/EnergyPlus/ChillerElectricEIR.hh index 83df4f2cef8..b7161997651 100644 --- a/src/EnergyPlus/ChillerElectricEIR.hh +++ b/src/EnergyPlus/ChillerElectricEIR.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -117,28 +117,28 @@ namespace ChillerElectricEIR { Real64 HeatRecCapacityFraction = 0.0; // user input for heat recovery capacity fraction [] Real64 HeatRecMaxCapacityLimit = 0.0; // Capacity limit for Heat recovery, one time calc [W] int HeatRecSetPointNodeNum = 0; // index for system node with the heat recover leaving setpoint - int HeatRecInletLimitSchedNum = 0; // index for schedule for the inlet high limit for heat recovery operation + Sched::Schedule *heatRecInletLimitSched = nullptr; // schedule for the inlet high limit for heat recovery operation int ChillerCapFTIndex = 0; // Index for the total cooling capacity modifier curve // (function of leaving chilled water temperature and // entering condenser fluid temperature) int ChillerEIRFTIndex = 0; // Index for the energy input ratio modifier curve // (function of leaving chilled water temperature and // entering condenser fluid temperature) - int ChillerEIRFPLRIndex = 0; // Index for the EIR vs part-load ratio curve - int ChillerCapFTError = 0; // Used for negative capacity as a function of temp warnings - int ChillerCapFTErrorIndex = 0; // Used for negative capacity as a function of temp warnings - int ChillerEIRFTError = 0; // Used for negative EIR as a function of temp warnings - int ChillerEIRFTErrorIndex = 0; // Used for negative EIR as a function of temp warnings - int ChillerEIRFPLRError = 0; // Used for negative EIR as a function of PLR warnings - int ChillerEIRFPLRErrorIndex = 0; // Used for negative EIR as a function of PLR warnings - Real64 ChillerEIRFPLRMin = 0.0; // Minimum value of PLR from EIRFPLR curve - Real64 ChillerEIRFPLRMax = 0.0; // Maximum value of PLR from EIRFPLR curve - int DeltaTErrCount = 0; // Evaporator delta T equals 0 for variable flow chiller warning messages - int DeltaTErrCountIndex = 0; // Index to evaporator delta T = 0 for variable flow chiller warning messages - PlantLocation CWPlantLoc; // chilled water plant loop component index - PlantLocation CDPlantLoc; // condenser water plant loop component index - PlantLocation HRPlantLoc; // heat recovery water plant loop component index - int BasinHeaterSchedulePtr = 0; // Pointer to basin heater schedule + int ChillerEIRFPLRIndex = 0; // Index for the EIR vs part-load ratio curve + int ChillerCapFTError = 0; // Used for negative capacity as a function of temp warnings + int ChillerCapFTErrorIndex = 0; // Used for negative capacity as a function of temp warnings + int ChillerEIRFTError = 0; // Used for negative EIR as a function of temp warnings + int ChillerEIRFTErrorIndex = 0; // Used for negative EIR as a function of temp warnings + int ChillerEIRFPLRError = 0; // Used for negative EIR as a function of PLR warnings + int ChillerEIRFPLRErrorIndex = 0; // Used for negative EIR as a function of PLR warnings + Real64 ChillerEIRFPLRMin = 0.0; // Minimum value of PLR from EIRFPLR curve + Real64 ChillerEIRFPLRMax = 0.0; // Maximum value of PLR from EIRFPLR curve + int DeltaTErrCount = 0; // Evaporator delta T equals 0 for variable flow chiller warning messages + int DeltaTErrCountIndex = 0; // Index to evaporator delta T = 0 for variable flow chiller warning messages + PlantLocation CWPlantLoc; // chilled water plant loop component index + PlantLocation CDPlantLoc; // condenser water plant loop component index + PlantLocation HRPlantLoc; // heat recovery water plant loop component index + Sched::Schedule *basinHeaterSched = nullptr; // basin heater schedule int CondMassFlowIndex = 0; std::string MsgBuffer1; // - buffer to print warning messages on following time step std::string MsgBuffer2; // - buffer to print warning messages on following time step @@ -190,7 +190,7 @@ namespace ChillerElectricEIR { bool IPLVFlag = true; int ChillerCondLoopFlowFLoopPLRIndex = 0; // Condenser loop flow rate fraction function of loop PLR int CondDT = 0; // Temperature difference across condenser - int CondDTScheduleNum = 0; // Temperature difference across condenser schedule index + Sched::Schedule *condDTSched = nullptr; // Temperature difference across condenser schedule Real64 MinCondFlowRatio = 0.2; // Minimum condenser flow fraction DataBranchAirLoopPlant::ControlType EquipFlowCtrl = DataBranchAirLoopPlant::ControlType::Invalid; Real64 VSBranchPumpMinLimitMassFlowCond = 0.0; @@ -252,6 +252,10 @@ struct ChillerElectricEIRData : BaseGlobalStruct bool getInputFlag = true; Array1D ElectricEIRChiller; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ChillerExhaustAbsorption.cc b/src/EnergyPlus/ChillerExhaustAbsorption.cc index bdf19121c02..3182b67751f 100644 --- a/src/EnergyPlus/ChillerExhaustAbsorption.cc +++ b/src/EnergyPlus/ChillerExhaustAbsorption.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -86,7 +86,7 @@ namespace EnergyPlus::ChillerExhaustAbsorption { // for Gas Research Institute (Original module GasAbsoptionChiller) // DATE WRITTEN March 2001 // MODIFIED Brent Griffith, Nov 2010 plant upgrades, generalize fluid properties -// Mahabir Bhandari, ORNL, Aug 2011, modified to accomodate Exhaust Fired Absorption Chiller +// Mahabir Bhandari, ORNL, Aug 2011, modified to accommodate Exhaust Fired Absorption Chiller // PURPOSE OF THIS MODULE: // This module simulates the performance of the Exhaust fired double effect @@ -238,7 +238,7 @@ void ExhaustAbsorberSpecs::getDesignCapacities( if (!matchfound) { // Error, nodes do not match - ShowSevereError(state, format("SimExhaustAbsorber: Invalid call to Exhaust Absorbtion Chiller-Heater {}", this->Name)); + ShowSevereError(state, format("SimExhaustAbsorber: Invalid call to Exhaust Absorption Chiller-Heater {}", this->Name)); ShowContinueError(state, "Node connections in branch are not consistent with object nodes."); ShowFatalError(state, "Preceding conditions cause termination."); } // Operate as Chiller or Heater @@ -442,7 +442,7 @@ void GetExhaustAbsorberInput(EnergyPlusData &state) ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); ShowContinueError(state, "resetting to ENTERING-CONDENSER, simulation continues"); } - // Assign Other Paramters + // Assign Other Parameters if (Util::SameString(state.dataIPShortCut->cAlphaArgs(16), "AirCooled")) { thisChiller.isWaterCooled = false; } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(16), "WaterCooled")) { @@ -937,7 +937,7 @@ void ExhaustAbsorberSpecs::initialize(EnergyPlusData &state) // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 rho; // local fluid density - Real64 mdot; // lcoal fluid mass flow rate + Real64 mdot; // local fluid mass flow rate int CondInletNode = this->CondReturnNodeNum; int CondOutletNode = this->CondSupplyNodeNum; @@ -949,11 +949,7 @@ void ExhaustAbsorberSpecs::initialize(EnergyPlusData &state) if (this->isWaterCooled) { // init max available condenser water flow rate if (this->CDPlantLoc.loopNum > 0) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); } else { rho = Psychrometrics::RhoH2O(Constant::InitConvTemp); } @@ -963,11 +959,7 @@ void ExhaustAbsorberSpecs::initialize(EnergyPlusData &state) } if (this->HWPlantLoc.loopNum > 0) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); } else { rho = Psychrometrics::RhoH2O(Constant::InitConvTemp); } @@ -976,11 +968,7 @@ void ExhaustAbsorberSpecs::initialize(EnergyPlusData &state) PlantUtilities::InitComponentNodes(state, 0.0, this->DesHeatMassFlowRate, HeatInletNode, HeatOutletNode); if (this->CWPlantLoc.loopNum > 0) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); } else { rho = Psychrometrics::RhoH2O(Constant::InitConvTemp); } @@ -1066,16 +1054,8 @@ void ExhaustAbsorberSpecs::size(EnergyPlusData &state) if (PltSizCoolNum > 0) { if (state.dataSize->PlantSizData(PltSizCoolNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getSpecificHeat(state, Constant::CWInitConvTemp, RoutineName); + rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); tmpNomCap = Cp * rho * state.dataSize->PlantSizData(PltSizCoolNum).DeltaT * state.dataSize->PlantSizData(PltSizCoolNum).DesVolFlowRate * this->SizFac; if (!this->NomCoolingCapWasAutoSized) tmpNomCap = this->NomCoolingCap; @@ -1296,16 +1276,8 @@ void ExhaustAbsorberSpecs::size(EnergyPlusData &state) if (PltSizCondNum > 0 && PltSizCoolNum > 0) { if (state.dataSize->PlantSizData(PltSizCoolNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow && tmpNomCap > 0.0) { - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - this->TempDesCondReturn, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - this->TempDesCondReturn, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getSpecificHeat(state, this->TempDesCondReturn, RoutineName); + rho = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getDensity(state, this->TempDesCondReturn, RoutineName); tmpCondVolFlowRate = tmpNomCap * (1.0 + this->ThermalEnergyCoolRatio) / (state.dataSize->PlantSizData(PltSizCondNum).DeltaT * Cp * rho); if (!this->CondVolFlowRateWasAutoSized) tmpCondVolFlowRate = this->CondVolFlowRate; @@ -1448,7 +1420,7 @@ void ExhaustAbsorberSpecs::calcChiller(EnergyPlusData &state, Real64 &MyLoad) // SUBROUTINE INFORMATION: // AUTHOR Jason Glazer // DATE WRITTEN March 2001 - // MODIFIED Mahabir Bhandari, ORNL, Aug 2011, modified to accomodate exhaust fired chiller + // MODIFIED Mahabir Bhandari, ORNL, Aug 2011, modified to accommodate exhaust fired chiller // PURPOSE OF THIS SUBROUTINE: // Simulate a Exhaust fired (Exhaust consuming) absorption chiller using @@ -1515,7 +1487,7 @@ void ExhaustAbsorberSpecs::calcChiller(EnergyPlusData &state, Real64 &MyLoad) int lThermalEnergyCoolFPLRCurve = this->ThermalEnergyCoolFPLRCurve; int lElecCoolFTCurve = this->ElecCoolFTCurve; int lElecCoolFPLRCurve = this->ElecCoolFPLRCurve; - bool lIsEnterCondensTemp = this->isEnterCondensTemp; // if using entering conderser water temperature is TRUE, exiting is FALSE + bool lIsEnterCondensTemp = this->isEnterCondensTemp; // if using entering condenser water temperature is TRUE, exiting is FALSE bool lIsWaterCooled = this->isWaterCooled; // if water cooled it is TRUE Real64 lCHWLowLimitTemp = this->CHWLowLimitTemp; Real64 lHeatElectricPower = this->HeatElectricPower; // parasitic electric power used for heating @@ -1542,17 +1514,9 @@ void ExhaustAbsorberSpecs::calcChiller(EnergyPlusData &state, Real64 &MyLoad) Real64 lExhaustInFlow = state.dataLoopNodes->Node(lExhaustAirInletNodeNum).MassFlowRate; Real64 lExhaustAirHumRat = state.dataLoopNodes->Node(lExhaustAirInletNodeNum).HumRat; - Real64 Cp_CW = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - lChillReturnTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp_CW = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getSpecificHeat(state, lChillReturnTemp, RoutineName); if (this->CDPlantLoc.loopNum > 0) { - Cp_CD = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - lChillReturnTemp, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + Cp_CD = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getSpecificHeat(state, lChillReturnTemp, RoutineName); } // If no loop demand or Absorber OFF, return @@ -1722,7 +1686,7 @@ void ExhaustAbsorberSpecs::calcChiller(EnergyPlusData &state, Real64 &MyLoad) Curve::CurveValue(state, lElecCoolFTCurve, lChillSupplyTemp, calcCondTemp) * Curve::CurveValue(state, lElecCoolFPLRCurve, lCoolPartLoadRatio); - // determine conderser load which is cooling load plus the + // determine condenser load which is cooling load plus the // ThermalEnergy used for cooling plus // the electricity used lTowerLoad = lCoolingLoad + lCoolThermalEnergyUseRate / lThermalEnergyHeatRatio + lCoolElectricPower; @@ -1754,7 +1718,7 @@ void ExhaustAbsorberSpecs::calcChiller(EnergyPlusData &state, Real64 &MyLoad) this->ExhTempLTAbsLeavingTempIndex, lExhaustInTemp, AbsLeavingTemp); - // If exhaust is not available, it means the avilable thermal energy is 0.0 and Chiller is not available + // If exhaust is not available, it means the available thermal energy is 0.0 and Chiller is not available lCoolThermalEnergyUseRate = 0.0; lTowerLoad = 0.0; lCoolElectricPower = 0.0; @@ -1835,7 +1799,7 @@ void ExhaustAbsorberSpecs::calcHeater(EnergyPlusData &state, Real64 &MyLoad, boo // SUBROUTINE INFORMATION: // AUTHOR Jason Glazer and Michael J. Witte // DATE WRITTEN March 2001 - // MODIFIED Mahabir Bhandari, ORNL, Aug 2011, modified to accomodate exhaust fired double effect absorption chiller + // MODIFIED Mahabir Bhandari, ORNL, Aug 2011, modified to accommodate exhaust fired double effect absorption chiller // PURPOSE OF THIS SUBROUTINE: // Simulate a Exhaust fired (Exhaust consuming) absorption chiller using @@ -1905,8 +1869,7 @@ void ExhaustAbsorberSpecs::calcHeater(EnergyPlusData &state, Real64 &MyLoad, boo lFractionOfPeriodRunning = min(1.0, max(lHeatPartLoadRatio, this->CoolPartLoadRatio) / this->MinPartLoadRat); } else { - Real64 const Cp_HW = - FluidProperties::GetSpecificHeatGlycol(state, hwPlantLoop.FluidName, heatReturnNode.Temp, hwPlantLoop.FluidIndex, RoutineName); + Real64 const Cp_HW = hwPlantLoop.glycol->getSpecificHeat(state, heatReturnNode.Temp, RoutineName); // Determine available heating capacity using the current cooling load lAvailableHeatingCapacity = this->NomHeatCoolRatio * this->NomCoolingCap * @@ -1967,7 +1930,7 @@ void ExhaustAbsorberSpecs::calcHeater(EnergyPlusData &state, Real64 &MyLoad, boo // Calculate electric parasitics used // for heating based on nominal capacity not available capacity lHeatElectricPower = this->NomCoolingCap * this->NomHeatCoolRatio * this->ElecHeatRatio * lFractionOfPeriodRunning; - // Coodinate electric parasitics for heating and cooling to avoid double counting + // Coordinate electric parasitics for heating and cooling to avoid double counting // Total electric is the max of heating electric or cooling electric // If heating electric is greater, leave cooling electric and subtract if off of heating elec // If cooling electric is greater, set heating electric to zero @@ -1997,7 +1960,7 @@ void ExhaustAbsorberSpecs::calcHeater(EnergyPlusData &state, Real64 &MyLoad, boo this->ExhTempLTAbsLeavingHeatingTempIndex, lExhaustInTemp, AbsLeavingTemp); - // If exhaust is not available, it means the avilable thermal energy is 0.0 and Chiller is not available + // If exhaust is not available, it means the available thermal energy is 0.0 and Chiller is not available lHeatThermalEnergyUseRate = 0.0; lHeatElectricPower = 0.0; lHotWaterSupplyTemp = heatReturnNode.Temp; diff --git a/src/EnergyPlus/ChillerExhaustAbsorption.hh b/src/EnergyPlus/ChillerExhaustAbsorption.hh index 2fd35a83631..6fda2bed411 100644 --- a/src/EnergyPlus/ChillerExhaustAbsorption.hh +++ b/src/EnergyPlus/ChillerExhaustAbsorption.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -222,6 +222,10 @@ struct ChillerExhaustAbsorptionData : BaseGlobalStruct bool Sim_GetInput = true; Array1D ExhaustAbsorber; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ChillerGasAbsorption.cc b/src/EnergyPlus/ChillerGasAbsorption.cc index 6cb26c946db..72f5f6bf93d 100644 --- a/src/EnergyPlus/ChillerGasAbsorption.cc +++ b/src/EnergyPlus/ChillerGasAbsorption.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -948,11 +948,7 @@ void GasAbsorberSpecs::initialize(EnergyPlusData &state) if (this->isWaterCooled) { // init max available condenser water flow rate if (this->CDplantLoc.loopNum > 0) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CDplantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CDplantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->CDplantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); } else { rho = Psychrometrics::RhoH2O(Constant::InitConvTemp); } @@ -962,11 +958,7 @@ void GasAbsorberSpecs::initialize(EnergyPlusData &state) } if (this->HWplantLoc.loopNum > 0) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->HWplantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->HWplantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->HWplantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); } else { rho = Psychrometrics::RhoH2O(Constant::InitConvTemp); } @@ -975,11 +967,7 @@ void GasAbsorberSpecs::initialize(EnergyPlusData &state) PlantUtilities::InitComponentNodes(state, 0.0, this->DesHeatMassFlowRate, HeatInletNode, HeatOutletNode); if (this->CWplantLoc.loopNum > 0) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWplantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWplantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->CWplantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); } else { rho = Psychrometrics::RhoH2O(Constant::InitConvTemp); } @@ -1059,16 +1047,8 @@ void GasAbsorberSpecs::size(EnergyPlusData &state) if (PltSizCoolNum > 0) { if (state.dataSize->PlantSizData(PltSizCoolNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWplantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWplantLoc.loopNum).FluidIndex, - RoutineName); - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWplantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWplantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(this->CWplantLoc.loopNum).glycol->getSpecificHeat(state, Constant::CWInitConvTemp, RoutineName); + rho = state.dataPlnt->PlantLoop(this->CWplantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); tmpNomCap = Cp * rho * state.dataSize->PlantSizData(PltSizCoolNum).DeltaT * state.dataSize->PlantSizData(PltSizCoolNum).DesVolFlowRate * this->SizFac; if (!this->NomCoolingCapWasAutoSized) tmpNomCap = this->NomCoolingCap; @@ -1288,16 +1268,8 @@ void GasAbsorberSpecs::size(EnergyPlusData &state) if (PltSizCondNum > 0 && PltSizCoolNum > 0) { if (state.dataSize->PlantSizData(PltSizCoolNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow && tmpNomCap > 0.0) { - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDplantLoc.loopNum).FluidName, - this->TempDesCondReturn, - state.dataPlnt->PlantLoop(this->CDplantLoc.loopNum).FluidIndex, - RoutineName); - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CDplantLoc.loopNum).FluidName, - this->TempDesCondReturn, - state.dataPlnt->PlantLoop(this->CDplantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(this->CDplantLoc.loopNum).glycol->getSpecificHeat(state, this->TempDesCondReturn, RoutineName); + rho = state.dataPlnt->PlantLoop(this->CDplantLoc.loopNum).glycol->getDensity(state, this->TempDesCondReturn, RoutineName); tmpCondVolFlowRate = tmpNomCap * (1.0 + this->FuelCoolRatio) / (state.dataSize->PlantSizData(PltSizCondNum).DeltaT * Cp * rho); if (!this->CondVolFlowRateWasAutoSized) tmpCondVolFlowRate = this->CondVolFlowRate; // IF (PlantFirstSizesOkayToFinalize) GasAbsorber(ChillNum)%CondVolFlowRate = tmpCondVolFlowRate @@ -1532,19 +1504,11 @@ void GasAbsorberSpecs::calculateChiller(EnergyPlusData &state, Real64 &MyLoad) Real64 ChillDeltaTemp = std::abs(lChillReturnTemp - ChillSupplySetPointTemp); // local fluid specific heat for chilled water - Real64 Cp_CW = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWplantLoc.loopNum).FluidName, - lChillReturnTemp, - state.dataPlnt->PlantLoop(this->CWplantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp_CW = state.dataPlnt->PlantLoop(this->CWplantLoc.loopNum).glycol->getSpecificHeat(state, lChillReturnTemp, RoutineName); // local fluid specific heat for condenser water Real64 Cp_CD = 0; // putting this here as a dummy initialization to hush the compiler warning, in real runs this value should never be used if (this->CDplantLoc.loopNum > 0) { - Cp_CD = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDplantLoc.loopNum).FluidName, - lChillReturnTemp, - state.dataPlnt->PlantLoop(this->CDplantLoc.loopNum).FluidIndex, - RoutineName); + Cp_CD = state.dataPlnt->PlantLoop(this->CDplantLoc.loopNum).glycol->getSpecificHeat(state, lChillReturnTemp, RoutineName); } // If no loop demand or Absorber OFF, return @@ -1854,8 +1818,7 @@ void GasAbsorberSpecs::calculateHeater(EnergyPlusData &state, Real64 &MyLoad, bo LoopNum = this->HWplantLoc.loopNum; LoopSideNum = this->HWplantLoc.loopSideNum; - Cp_HW = FluidProperties::GetSpecificHeatGlycol( - state, state.dataPlnt->PlantLoop(LoopNum).FluidName, lHotWaterReturnTemp, state.dataPlnt->PlantLoop(LoopNum).FluidIndex, RoutineName); + Cp_HW = state.dataPlnt->PlantLoop(LoopNum).glycol->getSpecificHeat(state, lHotWaterReturnTemp, RoutineName); lCoolElectricPower = this->CoolElectricPower; lCoolFuelUseRate = this->CoolFuelUseRate; diff --git a/src/EnergyPlus/ChillerGasAbsorption.hh b/src/EnergyPlus/ChillerGasAbsorption.hh index 82b23f2cfa4..74c870f008c 100644 --- a/src/EnergyPlus/ChillerGasAbsorption.hh +++ b/src/EnergyPlus/ChillerGasAbsorption.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -222,6 +222,10 @@ struct ChillerGasAbsorptionData : BaseGlobalStruct bool getGasAbsorberInputs = true; Array1D GasAbsorber; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ChillerIndirectAbsorption.cc b/src/EnergyPlus/ChillerIndirectAbsorption.cc index 9a60e43c688..d8cd8ed1b09 100644 --- a/src/EnergyPlus/ChillerIndirectAbsorption.cc +++ b/src/EnergyPlus/ChillerIndirectAbsorption.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -102,9 +102,6 @@ namespace EnergyPlus::ChillerIndirectAbsorption { // Manufacturers performance data can be used to generate the coefficients for the model. static constexpr std::string_view calcChillerAbsorptionIndirect("CALC Chiller:Absorption:Indirect "); -int constexpr waterIndex = 1; -static constexpr std::string_view fluidNameSteam = "STEAM"; -static constexpr std::string_view fluidNameWater = "WATER"; IndirectAbsorberSpecs *IndirectAbsorberSpecs::factory(EnergyPlusData &state, std::string const &objectName) { @@ -354,8 +351,9 @@ void GetIndirectAbsorberInput(EnergyPlusData &state) Util::SameString(state.dataIPShortCut->cAlphaArgs(16), "HotWater")) { thisChiller.GenHeatSourceType = DataLoopNode::NodeFluidType::Water; // Default to Steam if left blank - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(16), fluidNameSteam) || state.dataIPShortCut->cAlphaArgs(16).empty()) { + } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(16), "STEAM") || state.dataIPShortCut->cAlphaArgs(16).empty()) { thisChiller.GenHeatSourceType = DataLoopNode::NodeFluidType::Steam; + thisChiller.steam = Fluid::GetSteam(state); } else { ShowWarningError(state, format("{}, Name={}", state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); ShowContinueError(state, "...Generator heat source type must be Steam or Hot Water."); @@ -365,6 +363,7 @@ void GetIndirectAbsorberInput(EnergyPlusData &state) } else { // Default to Steam if not entered as input thisChiller.GenHeatSourceType = DataLoopNode::NodeFluidType::Steam; + thisChiller.steam = Fluid::GetSteam(state); } if ((!state.dataIPShortCut->cAlphaArgs(9).empty()) && (!state.dataIPShortCut->cAlphaArgs(10).empty())) { @@ -396,7 +395,11 @@ void GetIndirectAbsorberInput(EnergyPlusData &state) state.dataIPShortCut->cAlphaArgs(10), "Hot Water Nodes"); } else { - thisChiller.SteamFluidIndex = FluidProperties::GetRefrigNum(state, fluidNameSteam); + if ((thisChiller.steam = Fluid::GetSteam(state)) == nullptr) { + ShowSevereError(state, "Fluid Properties for STEAM not found."); + ErrorsFound = true; + } + thisChiller.GeneratorInletNodeNum = NodeInputManager::GetOnlySingleNode(state, state.dataIPShortCut->cAlphaArgs(9), ErrorsFound, @@ -891,21 +894,13 @@ void IndirectAbsorberSpecs::initialize(EnergyPlusData &state, bool RunFlag, Real // Initialize Supply Side Variables if (this->MyEnvrnFlag && state.dataGlobal->BeginEnvrnFlag && (state.dataPlnt->PlantFirstSizesOkayToFinalize)) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); this->EvapMassFlowRateMax = this->EvapVolFlowRate * rho; PlantUtilities::InitComponentNodes(state, 0.0, this->EvapMassFlowRateMax, this->EvapInletNodeNum, this->EvapOutletNodeNum); - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); this->CondMassFlowRateMax = rho * this->CondVolFlowRate; @@ -917,20 +912,12 @@ void IndirectAbsorberSpecs::initialize(EnergyPlusData &state, bool RunFlag, Real if (this->GenHeatSourceType == DataLoopNode::NodeFluidType::Water) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); this->GenMassFlowRateMax = rho * this->GeneratorVolFlowRate; } else { - Real64 SteamDensity = FluidProperties::GetSatDensityRefrig(state, - fluidNameSteam, - state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, - 1.0, - this->SteamFluidIndex, - std::string{calcChillerAbsorptionIndirect} + this->Name); + Real64 SteamDensity = this->steam->getSatDensity( + state, state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, 1.0, std::string{calcChillerAbsorptionIndirect} + this->Name); this->GenMassFlowRateMax = SteamDensity * this->GeneratorVolFlowRate; } @@ -1052,17 +1039,9 @@ void IndirectAbsorberSpecs::sizeChiller(EnergyPlusData &state) if (PltSizNum > 0) { if (state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); - - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getSpecificHeat(state, Constant::CWInitConvTemp, RoutineName); + + Real64 rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); tmpNomCap = Cp * rho * state.dataSize->PlantSizData(PltSizNum).DeltaT * state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate * this->SizFac; if (!this->NomCapWasAutoSized) tmpNomCap = this->NomCap; @@ -1240,17 +1219,9 @@ void IndirectAbsorberSpecs::sizeChiller(EnergyPlusData &state) if (this->EvapVolFlowRate >= HVAC::SmallWaterVolFlow && tmpNomCap > 0.0) { // QCondenser = QEvaporator + QGenerator + PumpingPower - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); - - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getSpecificHeat(state, Constant::CWInitConvTemp, RoutineName); + + Real64 rho = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); tmpCondVolFlowRate = tmpNomCap * (1.0 + SteamInputRatNom + tmpNomPumpPower / tmpNomCap) / (state.dataSize->PlantSizData(PltSizCondNum).DeltaT * Cp * rho); if (!this->CondVolFlowRateWasAutoSized) tmpCondVolFlowRate = this->CondVolFlowRate; @@ -1331,18 +1302,13 @@ void IndirectAbsorberSpecs::sizeChiller(EnergyPlusData &state) (PltSizHeatingNum > 0 && this->GenHeatSourceType == DataLoopNode::NodeFluidType::Water)) { if (this->EvapVolFlowRate >= HVAC::SmallWaterVolFlow && tmpNomCap > 0.0) { if (this->GenHeatSourceType == DataLoopNode::NodeFluidType::Water) { - Real64 CpWater = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).FluidName, - state.dataSize->PlantSizData(PltSizHeatingNum).ExitTemp, - state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpWater = state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataSize->PlantSizData(PltSizHeatingNum).ExitTemp, RoutineName); Real64 SteamDeltaT = max(0.5, state.dataSize->PlantSizData(PltSizHeatingNum).DeltaT); - Real64 RhoWater = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).FluidName, - (state.dataSize->PlantSizData(PltSizHeatingNum).ExitTemp - SteamDeltaT), - state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 RhoWater = + state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum) + .glycol->getDensity(state, (state.dataSize->PlantSizData(PltSizHeatingNum).ExitTemp - SteamDeltaT), RoutineName); tmpGeneratorVolFlowRate = (tmpNomCap * SteamInputRatNom) / (CpWater * SteamDeltaT * RhoWater); if (!this->GeneratorVolFlowRateWasAutoSized) tmpGeneratorVolFlowRate = this->GeneratorVolFlowRate; if (state.dataPlnt->PlantFirstSizesOkayToFinalize) { @@ -1395,32 +1361,21 @@ void IndirectAbsorberSpecs::sizeChiller(EnergyPlusData &state) } } } else { - Real64 SteamDensity = FluidProperties::GetSatDensityRefrig(state, - fluidNameSteam, - state.dataSize->PlantSizData(PltSizSteamNum).ExitTemp, - 1.0, - this->SteamFluidIndex, - std::string{SizeChillerAbsorptionIndirect} + this->Name); + Real64 SteamDensity = this->steam->getSatDensity( + state, state.dataSize->PlantSizData(PltSizSteamNum).ExitTemp, 1.0, std::string{SizeChillerAbsorptionIndirect} + this->Name); Real64 SteamDeltaT = state.dataSize->PlantSizData(PltSizSteamNum).DeltaT; Real64 GeneratorOutletTemp = state.dataSize->PlantSizData(PltSizSteamNum).ExitTemp - SteamDeltaT; // dry enthalpy of steam (quality = 1) - Real64 EnthSteamOutDry = FluidProperties::GetSatEnthalpyRefrig(state, - fluidNameSteam, - state.dataSize->PlantSizData(PltSizSteamNum).ExitTemp, - 1.0, - this->SteamFluidIndex, - std::string{SizeChillerAbsorptionIndirect} + this->Name); + Real64 EnthSteamOutDry = this->steam->getSatEnthalpy( + state, state.dataSize->PlantSizData(PltSizSteamNum).ExitTemp, 1.0, std::string{SizeChillerAbsorptionIndirect} + this->Name); // wet enthalpy of steam (quality = 0) - Real64 EnthSteamOutWet = FluidProperties::GetSatEnthalpyRefrig(state, - fluidNameSteam, - state.dataSize->PlantSizData(PltSizSteamNum).ExitTemp, - 0.0, - this->SteamFluidIndex, - std::string{SizeChillerAbsorptionIndirect} + this->Name); - Real64 CpWater = - FluidProperties::GetSpecificHeatGlycol(state, fluidNameWater, GeneratorOutletTemp, const_cast(waterIndex), RoutineName); + Real64 EnthSteamOutWet = this->steam->getSatEnthalpy( + state, state.dataSize->PlantSizData(PltSizSteamNum).ExitTemp, 0.0, std::string{SizeChillerAbsorptionIndirect} + this->Name); + + auto *water = Fluid::GetWater(state); + Real64 CpWater = water->getSpecificHeat(state, GeneratorOutletTemp, RoutineName); Real64 HfgSteam = EnthSteamOutDry - EnthSteamOutWet; // calculate the mass flow rate through the generator Real64 SteamMassFlowRate = (tmpNomCap * SteamInputRatNom) / ((HfgSteam) + (SteamDeltaT * CpWater)); @@ -1519,16 +1474,9 @@ void IndirectAbsorberSpecs::sizeChiller(EnergyPlusData &state) if (PltSizHeatingNum > 0 && this->GenHeatSourceType == DataLoopNode::NodeFluidType::Water) { this->GeneratorDeltaTemp = max(0.5, state.dataSize->PlantSizData(PltSizHeatingNum).DeltaT); } else if (this->GenHeatSourceType == DataLoopNode::NodeFluidType::Water) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).FluidIndex, - RoutineName); - Real64 CpWater = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).FluidName, - state.dataSize->PlantSizData(PltSizHeatingNum).ExitTemp, - state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); + Real64 CpWater = state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataSize->PlantSizData(PltSizHeatingNum).ExitTemp, RoutineName); if (state.dataPlnt->PlantFirstSizesOkayToFinalize) { this->GeneratorDeltaTemp = (SteamInputRatNom * this->NomCap) / (CpWater * rho * this->GeneratorVolFlowRate); } @@ -1604,7 +1552,7 @@ void IndirectAbsorberSpecs::sizeChiller(EnergyPlusData &state) } } -void IndirectAbsorberSpecs::calculate(EnergyPlusData &state, Real64 const MyLoad, bool const RunFlag) +void IndirectAbsorberSpecs::calculate(EnergyPlusData &state, Real64 MyLoad, bool const RunFlag) { // SUBROUTINE INFORMATION: // AUTHOR R. Raustad (FSEC) @@ -1717,11 +1665,7 @@ void IndirectAbsorberSpecs::calculate(EnergyPlusData &state, Real64 const MyLoad // C - Evaporator low temp. limit cut off Real64 TempLowLimitEout = this->TempLowLimitEvapOut; - Real64 CpFluid = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - EvapInletTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpFluid = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getSpecificHeat(state, EvapInletTemp, RoutineName); // If there is a fault of Chiller SWT Sensor if (this->FaultyChillerSWTFlag && (!state.dataGlobal->WarmupFlag) && (!state.dataGlobal->DoingSizing) && (!state.dataGlobal->KickOffSimulation)) { @@ -1768,7 +1712,7 @@ void IndirectAbsorberSpecs::calculate(EnergyPlusData &state, Real64 const MyLoad this->PossibleSubcooling = false; this->QEvaporator = std::abs(MyLoad); - // Either set the flow to the Constant value or caluclate the flow for the variable volume + // Either set the flow to the Constant value or calculate the flow for the variable volume if ((this->FlowMode == DataPlant::FlowMode::Constant) || (this->FlowMode == DataPlant::FlowMode::NotModulated)) { this->EvapMassFlowRate = state.dataLoopNodes->Node(this->EvapInletNodeNum).MassFlowRate; @@ -1987,11 +1931,7 @@ void IndirectAbsorberSpecs::calculate(EnergyPlusData &state, Real64 const MyLoad this->QCondenser = this->QEvaporator + this->QGenerator + this->PumpingPower; - CpFluid = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - CondInletTemp, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + CpFluid = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getSpecificHeat(state, CondInletTemp, RoutineName); if (this->CondMassFlowRate > DataBranchAirLoopPlant::MassFlowTolerance) { this->CondOutletTemp = this->QCondenser / this->CondMassFlowRate / CpFluid + CondInletTemp; @@ -1999,6 +1939,9 @@ void IndirectAbsorberSpecs::calculate(EnergyPlusData &state, Real64 const MyLoad this->CondOutletTemp = CondInletTemp; this->CondMassFlowRate = 0.0; this->QCondenser = 0.0; + MyLoad = 0.0; + this->EvapMassFlowRate = 0.0; + PlantUtilities::SetComponentFlowRate(state, this->EvapMassFlowRate, this->EvapInletNodeNum, this->EvapOutletNodeNum, this->CWPlantLoc); return; // V7 plant upgrade, no longer fatal here anymore... set some things and return } @@ -2007,11 +1950,8 @@ void IndirectAbsorberSpecs::calculate(EnergyPlusData &state, Real64 const MyLoad // Hot water plant is used for the generator if (this->GenHeatSourceType == DataLoopNode::NodeFluidType::Water) { - CpFluid = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, - state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).FluidIndex, - RoutineName); + CpFluid = state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, RoutineName); if ((this->FlowMode == DataPlant::FlowMode::Constant) || (this->FlowMode == DataPlant::FlowMode::NotModulated)) { this->GenMassFlowRate = this->GenMassFlowRateMax; } else { @@ -2034,20 +1974,12 @@ void IndirectAbsorberSpecs::calculate(EnergyPlusData &state, Real64 const MyLoad } else { // using a steam plant for the generator // enthalpy of dry steam at generator inlet - Real64 EnthSteamOutDry = FluidProperties::GetSatEnthalpyRefrig(state, - fluidNameSteam, - state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, - 1.0, - this->SteamFluidIndex, - std::string{calcChillerAbsorptionIndirect} + this->Name); + Real64 EnthSteamOutDry = this->steam->getSatEnthalpy( + state, state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, 1.0, std::string{calcChillerAbsorptionIndirect} + this->Name); // enthalpy of wet steam at generator inlet - Real64 EnthSteamOutWet = FluidProperties::GetSatEnthalpyRefrig(state, - fluidNameSteam, - state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, - 0.0, - this->SteamFluidIndex, - std::string{calcChillerAbsorptionIndirect} + this->Name); + Real64 EnthSteamOutWet = this->steam->getSatEnthalpy( + state, state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, 0.0, std::string{calcChillerAbsorptionIndirect} + this->Name); // temperature difference of fluid through generator Real64 SteamDeltaT = this->GeneratorSubcool; @@ -2057,8 +1989,7 @@ void IndirectAbsorberSpecs::calculate(EnergyPlusData &state, Real64 const MyLoad // heat of vaporization of steam Real64 HfgSteam = EnthSteamOutDry - EnthSteamOutWet; - CpFluid = FluidProperties::GetSpecificHeatGlycol( - state, fluidNameWater, SteamOutletTemp, const_cast(waterIndex), std::string{calcChillerAbsorptionIndirect} + this->Name); + CpFluid = Fluid::GetWater(state)->getSpecificHeat(state, SteamOutletTemp, std::string{calcChillerAbsorptionIndirect} + this->Name); this->GenMassFlowRate = this->QGenerator / (HfgSteam + CpFluid * SteamDeltaT); PlantUtilities::SetComponentFlowRate( state, this->GenMassFlowRate, this->GeneratorInletNodeNum, this->GeneratorOutletNodeNum, this->GenPlantLoc); @@ -2068,36 +1999,24 @@ void IndirectAbsorberSpecs::calculate(EnergyPlusData &state, Real64 const MyLoad this->SteamOutletEnthalpy = state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Enthalpy; } else { this->GenOutletTemp = state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp - SteamDeltaT; - this->SteamOutletEnthalpy = FluidProperties::GetSatEnthalpyRefrig(state, - fluidNameSteam, - state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, - 0.0, - this->SteamFluidIndex, - std::string{LoopLossesChillerAbsorptionIndirect} + this->Name); - CpFluid = FluidProperties::GetSpecificHeatGlycol(state, - fluidNameWater, - state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, - const_cast(waterIndex), - std::string{calcChillerAbsorptionIndirect} + this->Name); + this->SteamOutletEnthalpy = this->steam->getSatEnthalpy(state, + state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, + 0.0, + std::string{LoopLossesChillerAbsorptionIndirect} + this->Name); + CpFluid = Fluid::GetWater(state)->getSpecificHeat( + state, state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, std::string{calcChillerAbsorptionIndirect} + this->Name); this->SteamOutletEnthalpy -= CpFluid * SteamDeltaT; //************************* Loop Losses ***************************** // temperature of condensed steam leaving generator (after condensate trap) - Real64 TempWaterAtmPress = FluidProperties::GetSatTemperatureRefrig(state, - fluidNameSteam, - state.dataEnvrn->OutBaroPress, - this->SteamFluidIndex, - std::string{LoopLossesChillerAbsorptionIndirect} + this->Name); + Real64 TempWaterAtmPress = this->steam->getSatTemperature( + state, state.dataEnvrn->OutBaroPress, std::string{LoopLossesChillerAbsorptionIndirect} + this->Name); // enthalpy of condensed steam leaving generator (after condensate trap) - Real64 EnthAtAtmPress = FluidProperties::GetSatEnthalpyRefrig(state, - fluidNameSteam, - TempWaterAtmPress, - 0.0, - this->SteamFluidIndex, - std::string{LoopLossesChillerAbsorptionIndirectSpace} + this->Name); + Real64 EnthAtAtmPress = + this->steam->getSatEnthalpy(state, TempWaterAtmPress, 0.0, std::string{LoopLossesChillerAbsorptionIndirectSpace} + this->Name); // Point 4 at atm - loop delta subcool during return journey back to pump diff --git a/src/EnergyPlus/ChillerIndirectAbsorption.hh b/src/EnergyPlus/ChillerIndirectAbsorption.hh index b3136eab293..0b930bb1141 100644 --- a/src/EnergyPlus/ChillerIndirectAbsorption.hh +++ b/src/EnergyPlus/ChillerIndirectAbsorption.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -55,6 +55,7 @@ #include #include #include +#include #include #include @@ -137,7 +138,7 @@ namespace ChillerIndirectAbsorption { DataLoopNode::NodeFluidType GenHeatSourceType = DataLoopNode::NodeFluidType::Blank; // Generator heat source type, DataLoopNode::NodeFluidType::Steam=3 or // DataLoopNode::NodeFluidType::Water=2 - int SteamFluidIndex = 0; // index to generator fluid type + Fluid::RefrigProps *steam = nullptr; // STEAM Fluid Properties bool Available = false; // need an array of logicals--load identifiers of available equipment bool ON = false; // simulate the machine at it's operating part load ratio DataPlant::FlowMode FlowMode = DataPlant::FlowMode::Invalid; // one of 3 modes for component flow during operation @@ -177,6 +178,8 @@ namespace ChillerIndirectAbsorption { ReportVars Report; DataBranchAirLoopPlant::ControlType EquipFlowCtrl = DataBranchAirLoopPlant::ControlType::Invalid; + Fluid::GlycolProps *water = nullptr; + static IndirectAbsorberSpecs *factory(EnergyPlusData &state, std::string const &objectName); void simulate([[maybe_unused]] EnergyPlusData &state, @@ -214,6 +217,10 @@ struct ChillerIndirectAbsoprtionData : BaseGlobalStruct bool GetInput = true; Array1D IndirectAbsorber; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ChillerReformulatedEIR.cc b/src/EnergyPlus/ChillerReformulatedEIR.cc index d1922a404c9..0ce3ec86e06 100644 --- a/src/EnergyPlus/ChillerReformulatedEIR.cc +++ b/src/EnergyPlus/ChillerReformulatedEIR.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -221,14 +221,17 @@ void GetElecReformEIRChillerInput(EnergyPlusData &state) // This routine will get the input required by the Reformulated Electric EIR Chiller model static constexpr std::string_view RoutineName("GetElecReformEIRChillerInput: "); // include trailing blank space + static constexpr std::string_view routineName = "GetElecReformEIRChillerInput"; bool ErrorsFound(false); // True when input errors found - state.dataIPShortCut->cCurrentModuleObject = "Chiller:Electric:ReformulatedEIR"; - int NumElecReformEIRChillers = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, state.dataIPShortCut->cCurrentModuleObject); + auto &s_ipsc = state.dataIPShortCut; + + s_ipsc->cCurrentModuleObject = "Chiller:Electric:ReformulatedEIR"; + int NumElecReformEIRChillers = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); if (NumElecReformEIRChillers <= 0) { - ShowSevereError(state, format("No {} equipment specified in input file", state.dataIPShortCut->cCurrentModuleObject)); + ShowSevereError(state, format("No {} equipment specified in input file", s_ipsc->cCurrentModuleObject)); ErrorsFound = true; } @@ -241,60 +244,56 @@ void GetElecReformEIRChillerInput(EnergyPlusData &state) int NumNums = 0; // Number of elements in the numeric array int IOStat = 0; // IO Status when calling get input subroutine state.dataInputProcessing->inputProcessor->getObjectItem(state, - state.dataIPShortCut->cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, EIRChillerNum, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNums, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; // ErrorsFound will be set to True if problem was found, left untouched otherwise - GlobalNames::VerifyUniqueChillerName(state, - state.dataIPShortCut->cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - ErrorsFound, - state.dataIPShortCut->cCurrentModuleObject + " Name"); + GlobalNames::VerifyUniqueChillerName( + state, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1), ErrorsFound, s_ipsc->cCurrentModuleObject + " Name"); auto &thisChiller = state.dataChillerReformulatedEIR->ElecReformEIRChiller(EIRChillerNum); - thisChiller.Name = state.dataIPShortCut->cAlphaArgs(1); + thisChiller.Name = s_ipsc->cAlphaArgs(1); // Performance curves - thisChiller.ChillerCapFTIndex = Curve::GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(2)); - thisChiller.CAPFTName = state.dataIPShortCut->cAlphaArgs(2); + thisChiller.ChillerCapFTIndex = Curve::GetCurveIndex(state, s_ipsc->cAlphaArgs(2)); + thisChiller.CAPFTName = s_ipsc->cAlphaArgs(2); if (thisChiller.ChillerCapFTIndex == 0) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } - thisChiller.ChillerEIRFTIndex = Curve::GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(3)); - thisChiller.EIRFTName = state.dataIPShortCut->cAlphaArgs(3); + thisChiller.ChillerEIRFTIndex = Curve::GetCurveIndex(state, s_ipsc->cAlphaArgs(3)); + thisChiller.EIRFTName = s_ipsc->cAlphaArgs(3); if (thisChiller.ChillerEIRFTIndex == 0) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3))); + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3))); ErrorsFound = true; } // The default type of part-load curve is: LeavingCondenserWaterTemperature std::string PartLoadCurveType; // Part load curve type - if (state.dataIPShortCut->lAlphaFieldBlanks(4)) { + if (s_ipsc->lAlphaFieldBlanks(4)) { PartLoadCurveType = "LeavingCondenserWaterTemperature"; } else { - PartLoadCurveType = state.dataIPShortCut->cAlphaArgs(4); + PartLoadCurveType = s_ipsc->cAlphaArgs(4); } - thisChiller.EIRFPLRName = state.dataIPShortCut->cAlphaArgs(5); - thisChiller.ChillerEIRFPLRIndex = Curve::GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(5)); + thisChiller.EIRFPLRName = s_ipsc->cAlphaArgs(5); + thisChiller.ChillerEIRFPLRIndex = Curve::GetCurveIndex(state, s_ipsc->cAlphaArgs(5)); if (thisChiller.ChillerEIRFPLRIndex == 0) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5))); + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaArgs(5))); ErrorsFound = true; } @@ -305,104 +304,90 @@ void GetElecReformEIRChillerInput(EnergyPlusData &state) } else if (Util::SameString(PartLoadCurveType, "Lift") && state.dataCurveManager->PerfCurve(thisChiller.ChillerEIRFPLRIndex)->numDims == 3) { thisChiller.PartLoadCurveType = PLR::Lift; } else { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, format("Invalid {}={} for {}={}", - state.dataIPShortCut->cAlphaFieldNames(5), - state.dataIPShortCut->cAlphaArgs(5), - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4))); + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5), + s_ipsc->cAlphaFieldNames(4), + s_ipsc->cAlphaArgs(4))); ErrorsFound = true; } // Chilled water inlet/outlet node names are necessary - if (state.dataIPShortCut->lAlphaFieldBlanks(6)) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("{} is blank.", state.dataIPShortCut->cAlphaFieldNames(6))); + if (s_ipsc->lAlphaFieldBlanks(6)) { + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{} is blank.", s_ipsc->cAlphaFieldNames(6))); ErrorsFound = true; } - if (state.dataIPShortCut->lAlphaFieldBlanks(7)) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("{} is blank.", state.dataIPShortCut->cAlphaFieldNames(7))); + if (s_ipsc->lAlphaFieldBlanks(7)) { + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{} is blank.", s_ipsc->cAlphaFieldNames(7))); ErrorsFound = true; } thisChiller.EvapInletNodeNum = NodeInputManager::GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(6), + s_ipsc->cAlphaArgs(6), ErrorsFound, DataLoopNode::ConnectionObjectType::ChillerElectricReformulatedEIR, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsNotParent); thisChiller.EvapOutletNodeNum = NodeInputManager::GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(7), + s_ipsc->cAlphaArgs(7), ErrorsFound, DataLoopNode::ConnectionObjectType::ChillerElectricReformulatedEIR, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsNotParent); - BranchNodeConnections::TestCompSet(state, - state.dataIPShortCut->cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaArgs(6), - state.dataIPShortCut->cAlphaArgs(7), - "Chilled Water Nodes"); + BranchNodeConnections::TestCompSet( + state, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1), s_ipsc->cAlphaArgs(6), s_ipsc->cAlphaArgs(7), "Chilled Water Nodes"); thisChiller.CondenserType = DataPlant::CondenserType::WaterCooled; // Condenser inlet/outlet node names are necessary - if (state.dataIPShortCut->lAlphaFieldBlanks(8)) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("{} is blank.", state.dataIPShortCut->cAlphaFieldNames(8))); + if (s_ipsc->lAlphaFieldBlanks(8)) { + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{} is blank.", s_ipsc->cAlphaFieldNames(8))); ErrorsFound = true; } - if (state.dataIPShortCut->lAlphaFieldBlanks(9)) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("{} is blank.", state.dataIPShortCut->cAlphaFieldNames(9))); + if (s_ipsc->lAlphaFieldBlanks(9)) { + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{} is blank.", s_ipsc->cAlphaFieldNames(9))); ErrorsFound = true; } thisChiller.CondInletNodeNum = NodeInputManager::GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(8), + s_ipsc->cAlphaArgs(8), ErrorsFound, DataLoopNode::ConnectionObjectType::ChillerElectricReformulatedEIR, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Secondary, DataLoopNode::ObjectIsNotParent); thisChiller.CondOutletNodeNum = NodeInputManager::GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(9), + s_ipsc->cAlphaArgs(9), ErrorsFound, DataLoopNode::ConnectionObjectType::ChillerElectricReformulatedEIR, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Secondary, DataLoopNode::ObjectIsNotParent); - BranchNodeConnections::TestCompSet(state, - state.dataIPShortCut->cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaArgs(8), - state.dataIPShortCut->cAlphaArgs(9), - "Condenser Water Nodes"); + BranchNodeConnections::TestCompSet( + state, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1), s_ipsc->cAlphaArgs(8), s_ipsc->cAlphaArgs(9), "Condenser Water Nodes"); { - thisChiller.FlowMode = static_cast(getEnumValue(DataPlant::FlowModeNamesUC, state.dataIPShortCut->cAlphaArgs(10))); + thisChiller.FlowMode = static_cast(getEnumValue(DataPlant::FlowModeNamesUC, s_ipsc->cAlphaArgs(10))); if (thisChiller.FlowMode == DataPlant::FlowMode::Invalid) { - ShowSevereError(state, - format("{}{}=\"{}\",", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(10), state.dataIPShortCut->cAlphaArgs(10))); + ShowSevereError(state, format("{}{}=\"{}\",", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(10), s_ipsc->cAlphaArgs(10))); ShowContinueError(state, "Available choices are ConstantFlow, NotModulated, or LeavingSetpointModulated"); ShowContinueError(state, "Flow mode NotModulated is assumed and the simulation continues."); thisChiller.FlowMode = DataPlant::FlowMode::NotModulated; @@ -410,162 +395,140 @@ void GetElecReformEIRChillerInput(EnergyPlusData &state) } // Chiller rated performance data - thisChiller.RefCap = state.dataIPShortCut->rNumericArgs(1); + thisChiller.RefCap = s_ipsc->rNumericArgs(1); if (thisChiller.RefCap == DataSizing::AutoSize) { thisChiller.RefCapWasAutoSized = true; } - if (state.dataIPShortCut->rNumericArgs(1) == 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {}={:.2R}", state.dataIPShortCut->cNumericFieldNames(1), state.dataIPShortCut->rNumericArgs(1))); + if (s_ipsc->rNumericArgs(1) == 0.0) { + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {}={:.2R}", s_ipsc->cNumericFieldNames(1), s_ipsc->rNumericArgs(1))); ErrorsFound = true; } - thisChiller.RefCOP = state.dataIPShortCut->rNumericArgs(2); - if (state.dataIPShortCut->rNumericArgs(2) == 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {}={:.2R}", state.dataIPShortCut->cNumericFieldNames(2), state.dataIPShortCut->rNumericArgs(2))); + thisChiller.RefCOP = s_ipsc->rNumericArgs(2); + if (s_ipsc->rNumericArgs(2) == 0.0) { + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {}={:.2R}", s_ipsc->cNumericFieldNames(2), s_ipsc->rNumericArgs(2))); ErrorsFound = true; } - thisChiller.TempRefEvapOut = state.dataIPShortCut->rNumericArgs(3); - thisChiller.TempRefCondOut = state.dataIPShortCut->rNumericArgs(4); + thisChiller.TempRefEvapOut = s_ipsc->rNumericArgs(3); + thisChiller.TempRefCondOut = s_ipsc->rNumericArgs(4); if (thisChiller.TempRefEvapOut >= thisChiller.TempRefCondOut) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, format("{} [{:.2R}] >= {} [{:.2R}]", - state.dataIPShortCut->cNumericFieldNames(3), - state.dataIPShortCut->rNumericArgs(3), - state.dataIPShortCut->cNumericFieldNames(4), - state.dataIPShortCut->rNumericArgs(4))); + s_ipsc->cNumericFieldNames(3), + s_ipsc->rNumericArgs(3), + s_ipsc->cNumericFieldNames(4), + s_ipsc->rNumericArgs(4))); ShowContinueError(state, "Reference Leaving Chilled Water Temperature must be less than Reference Leaving Condenser Water Temperature "); ErrorsFound = true; } - thisChiller.EvapVolFlowRate = state.dataIPShortCut->rNumericArgs(5); + thisChiller.EvapVolFlowRate = s_ipsc->rNumericArgs(5); if (thisChiller.EvapVolFlowRate == DataSizing::AutoSize) { thisChiller.EvapVolFlowRateWasAutoSized = true; } - thisChiller.CondVolFlowRate = state.dataIPShortCut->rNumericArgs(6); + thisChiller.CondVolFlowRate = s_ipsc->rNumericArgs(6); if (thisChiller.CondVolFlowRate == DataSizing::AutoSize) { thisChiller.CondVolFlowRateWasAutoSized = true; } - thisChiller.MinPartLoadRat = state.dataIPShortCut->rNumericArgs(7); - thisChiller.MaxPartLoadRat = state.dataIPShortCut->rNumericArgs(8); - thisChiller.OptPartLoadRat = state.dataIPShortCut->rNumericArgs(9); - thisChiller.MinUnloadRat = state.dataIPShortCut->rNumericArgs(10); - thisChiller.SizFac = state.dataIPShortCut->rNumericArgs(14); + thisChiller.MinPartLoadRat = s_ipsc->rNumericArgs(7); + thisChiller.MaxPartLoadRat = s_ipsc->rNumericArgs(8); + thisChiller.OptPartLoadRat = s_ipsc->rNumericArgs(9); + thisChiller.MinUnloadRat = s_ipsc->rNumericArgs(10); + thisChiller.SizFac = s_ipsc->rNumericArgs(14); if (thisChiller.SizFac <= 0.0) thisChiller.SizFac = 1.0; if (thisChiller.MinPartLoadRat > thisChiller.MaxPartLoadRat) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, format("{} [{:.3R}] > {} [{:.3R}]", - state.dataIPShortCut->cNumericFieldNames(7), - state.dataIPShortCut->rNumericArgs(7), - state.dataIPShortCut->cNumericFieldNames(8), - state.dataIPShortCut->rNumericArgs(8))); + s_ipsc->cNumericFieldNames(7), + s_ipsc->rNumericArgs(7), + s_ipsc->cNumericFieldNames(8), + s_ipsc->rNumericArgs(8))); ShowContinueError(state, "Minimum part load ratio must be less than or equal to the maximum part load ratio "); ErrorsFound = true; } if (thisChiller.MinUnloadRat < thisChiller.MinPartLoadRat || thisChiller.MinUnloadRat > thisChiller.MaxPartLoadRat) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("{} = {:.3R}", state.dataIPShortCut->cNumericFieldNames(10), state.dataIPShortCut->rNumericArgs(10))); + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{} = {:.3R}", s_ipsc->cNumericFieldNames(10), s_ipsc->rNumericArgs(10))); ShowContinueError(state, - format("{} must be greater than or equal to the {}", - state.dataIPShortCut->cNumericFieldNames(10), - state.dataIPShortCut->cNumericFieldNames(7))); + format("{} must be greater than or equal to the {}", s_ipsc->cNumericFieldNames(10), s_ipsc->cNumericFieldNames(7))); ShowContinueError(state, - format("{} must be less than or equal to the {}", - state.dataIPShortCut->cNumericFieldNames(10), - state.dataIPShortCut->cNumericFieldNames(8))); + format("{} must be less than or equal to the {}", s_ipsc->cNumericFieldNames(10), s_ipsc->cNumericFieldNames(8))); ErrorsFound = true; } if (thisChiller.OptPartLoadRat < thisChiller.MinPartLoadRat || thisChiller.OptPartLoadRat > thisChiller.MaxPartLoadRat) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("{} = {:.3R}", state.dataIPShortCut->cNumericFieldNames(9), state.dataIPShortCut->rNumericArgs(9))); + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{} = {:.3R}", s_ipsc->cNumericFieldNames(9), s_ipsc->rNumericArgs(9))); ShowContinueError(state, - format("{} must be greater than or equal to the {}", - state.dataIPShortCut->cNumericFieldNames(9), - state.dataIPShortCut->cNumericFieldNames(7))); - ShowContinueError(state, - format("{} must be less than or equal to the {}", - state.dataIPShortCut->cNumericFieldNames(9), - state.dataIPShortCut->cNumericFieldNames(8))); + format("{} must be greater than or equal to the {}", s_ipsc->cNumericFieldNames(9), s_ipsc->cNumericFieldNames(7))); + ShowContinueError(state, format("{} must be less than or equal to the {}", s_ipsc->cNumericFieldNames(9), s_ipsc->cNumericFieldNames(8))); ErrorsFound = true; } - thisChiller.CompPowerToCondenserFrac = state.dataIPShortCut->rNumericArgs(11); + thisChiller.CompPowerToCondenserFrac = s_ipsc->rNumericArgs(11); if (thisChiller.CompPowerToCondenserFrac < 0.0 || thisChiller.CompPowerToCondenserFrac > 1.0) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("{} = {:.3R}", state.dataIPShortCut->cNumericFieldNames(11), state.dataIPShortCut->rNumericArgs(11))); - ShowContinueError(state, format("{} must be greater than or equal to zero", state.dataIPShortCut->cNumericFieldNames(11))); - ShowContinueError(state, format("{} must be less than or equal to one", state.dataIPShortCut->cNumericFieldNames(11))); + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{} = {:.3R}", s_ipsc->cNumericFieldNames(11), s_ipsc->rNumericArgs(11))); + ShowContinueError(state, format("{} must be greater than or equal to zero", s_ipsc->cNumericFieldNames(11))); + ShowContinueError(state, format("{} must be less than or equal to one", s_ipsc->cNumericFieldNames(11))); ErrorsFound = true; } - thisChiller.TempLowLimitEvapOut = state.dataIPShortCut->rNumericArgs(12); + thisChiller.TempLowLimitEvapOut = s_ipsc->rNumericArgs(12); // These are the optional heat recovery inputs - thisChiller.DesignHeatRecVolFlowRate = state.dataIPShortCut->rNumericArgs(13); + thisChiller.DesignHeatRecVolFlowRate = s_ipsc->rNumericArgs(13); if (thisChiller.DesignHeatRecVolFlowRate == DataSizing::AutoSize) { thisChiller.DesignHeatRecVolFlowRateWasAutoSized = true; } if ((thisChiller.DesignHeatRecVolFlowRate > 0.0) || (thisChiller.DesignHeatRecVolFlowRate == DataSizing::AutoSize)) { thisChiller.HeatRecActive = true; thisChiller.HeatRecInletNodeNum = NodeInputManager::GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(11), + s_ipsc->cAlphaArgs(11), ErrorsFound, DataLoopNode::ConnectionObjectType::ChillerElectricReformulatedEIR, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Tertiary, DataLoopNode::ObjectIsNotParent); if (thisChiller.HeatRecInletNodeNum == 0) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(11), state.dataIPShortCut->cAlphaArgs(11))); + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(11), s_ipsc->cAlphaArgs(11))); ErrorsFound = true; } thisChiller.HeatRecOutletNodeNum = NodeInputManager::GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(12), + s_ipsc->cAlphaArgs(12), ErrorsFound, DataLoopNode::ConnectionObjectType::ChillerElectricReformulatedEIR, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Tertiary, DataLoopNode::ObjectIsNotParent); if (thisChiller.HeatRecOutletNodeNum == 0) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(12), state.dataIPShortCut->cAlphaArgs(12))); + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(12), s_ipsc->cAlphaArgs(12))); ErrorsFound = true; } - BranchNodeConnections::TestCompSet(state, - state.dataIPShortCut->cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaArgs(11), - state.dataIPShortCut->cAlphaArgs(12), - "Heat Recovery Nodes"); + BranchNodeConnections::TestCompSet( + state, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1), s_ipsc->cAlphaArgs(11), s_ipsc->cAlphaArgs(12), "Heat Recovery Nodes"); if (thisChiller.DesignHeatRecVolFlowRate > 0.0) { PlantUtilities::RegisterPlantCompDesignFlow(state, thisChiller.HeatRecInletNodeNum, thisChiller.DesignHeatRecVolFlowRate); } if (NumNums > 14) { - if (!state.dataIPShortCut->lNumericFieldBlanks(15)) { - thisChiller.HeatRecCapacityFraction = state.dataIPShortCut->rNumericArgs(15); + if (!s_ipsc->lNumericFieldBlanks(15)) { + thisChiller.HeatRecCapacityFraction = s_ipsc->rNumericArgs(15); } else { thisChiller.HeatRecCapacityFraction = 1.0; } @@ -573,32 +536,21 @@ void GetElecReformEIRChillerInput(EnergyPlusData &state) thisChiller.HeatRecCapacityFraction = 1.0; } - if (NumAlphas > 12) { - if (!state.dataIPShortCut->lAlphaFieldBlanks(13)) { - thisChiller.HeatRecInletLimitSchedNum = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(13)); - if (thisChiller.HeatRecInletLimitSchedNum == 0) { - ShowSevereError( - state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, - format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(13), state.dataIPShortCut->cAlphaArgs(13))); - ErrorsFound = true; - } - } else { - thisChiller.HeatRecInletLimitSchedNum = 0; - } - } else { - thisChiller.HeatRecInletLimitSchedNum = 0; + if (NumAlphas <= 12 || s_ipsc->lAlphaFieldBlanks(13)) { + thisChiller.heatRecInletLimitSched = nullptr; // Ok for this to be nullptr + } else if ((thisChiller.heatRecInletLimitSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(13))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(13), s_ipsc->cAlphaArgs(13)); + ErrorsFound = true; } if (NumAlphas > 13) { - if (!state.dataIPShortCut->lAlphaFieldBlanks(14)) { + if (!s_ipsc->lAlphaFieldBlanks(14)) { thisChiller.HeatRecSetPointNodeNum = NodeInputManager::GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(14), + s_ipsc->cAlphaArgs(14), ErrorsFound, DataLoopNode::ConnectionObjectType::ChillerElectricReformulatedEIR, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Sensor, NodeInputManager::CompFluidStream::Primary, @@ -615,75 +567,68 @@ void GetElecReformEIRChillerInput(EnergyPlusData &state) thisChiller.DesignHeatRecMassFlowRate = 0.0; thisChiller.HeatRecInletNodeNum = 0; thisChiller.HeatRecOutletNodeNum = 0; - if ((!state.dataIPShortCut->lAlphaFieldBlanks(11)) || (!state.dataIPShortCut->lAlphaFieldBlanks(12))) { - ShowWarningError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + if ((!s_ipsc->lAlphaFieldBlanks(11)) || (!s_ipsc->lAlphaFieldBlanks(12))) { + ShowWarningError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowWarningError(state, "Since Reference Heat Reclaim Volume Flow Rate = 0.0, heat recovery is inactive."); ShowContinueError(state, "However, node names were specified for heat recovery inlet or outlet nodes."); } } if (NumAlphas > 14) { - thisChiller.EndUseSubcategory = state.dataIPShortCut->cAlphaArgs(15); + thisChiller.EndUseSubcategory = s_ipsc->cAlphaArgs(15); } else { thisChiller.EndUseSubcategory = "General"; } if (NumAlphas > 15) { - thisChiller.CondenserFlowControl = static_cast( - getEnumValue(DataPlant::CondenserFlowControlNamesUC, state.dataIPShortCut->cAlphaArgs(16))); + thisChiller.CondenserFlowControl = + static_cast(getEnumValue(DataPlant::CondenserFlowControlNamesUC, s_ipsc->cAlphaArgs(16))); } else { thisChiller.CondenserFlowControl = DataPlant::CondenserFlowControl::ConstantFlow; } if (thisChiller.CondenserFlowControl == DataPlant::CondenserFlowControl::Invalid) { - ShowSevereError(state, - format("{}{}=\"{}\",", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(16), state.dataIPShortCut->cAlphaArgs(16))); + ShowSevereError(state, format("{}{}=\"{}\",", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(16), s_ipsc->cAlphaArgs(16))); ShowContinueError(state, "Available choices are ConstantFlow, ModulatedChillerPLR, ModulatedLoopPLR, or ModulatedDeltaTemperature"); thisChiller.CondenserFlowControl = DataPlant::CondenserFlowControl::ConstantFlow; ErrorsFound = true; }; if (NumAlphas > 16) { - thisChiller.ChillerCondLoopFlowFLoopPLRIndex = Curve::GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(17)); + thisChiller.ChillerCondLoopFlowFLoopPLRIndex = Curve::GetCurveIndex(state, s_ipsc->cAlphaArgs(17)); } if ((thisChiller.ChillerCondLoopFlowFLoopPLRIndex == 0) && (thisChiller.CondenserFlowControl == DataPlant::CondenserFlowControl::ModulatedLoopPLR)) { - ShowSevereError(state, - format("{}{} \"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(17), state.dataIPShortCut->cAlphaArgs(17))); + ShowSevereError(state, format("{}{} \"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(17), s_ipsc->cAlphaArgs(17))); ErrorsFound = true; } - if (NumAlphas > 17) { - if (!state.dataIPShortCut->lAlphaFieldBlanks(18)) { - thisChiller.CondDTScheduleNum = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(18)); - } - } - if (thisChiller.CondDTScheduleNum == 0 && thisChiller.CondenserFlowControl == DataPlant::CondenserFlowControl::ModulatedDeltaTemperature) { - ShowSevereError(state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(18), state.dataIPShortCut->cAlphaArgs(18))); + if (NumAlphas < 17 || s_ipsc->lAlphaFieldBlanks(18)) { + thisChiller.condDTSched = nullptr; // ok for this to be nullptr + } else if (((thisChiller.condDTSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(18))) == nullptr) && + thisChiller.CondenserFlowControl == DataPlant::CondenserFlowControl::ModulatedDeltaTemperature) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(18), s_ipsc->cAlphaArgs(18)); ErrorsFound = true; } if (NumNums > 15) { - thisChiller.MinCondFlowRatio = state.dataIPShortCut->rNumericArgs(16); + thisChiller.MinCondFlowRatio = s_ipsc->rNumericArgs(16); } - if (!state.dataIPShortCut->lAlphaFieldBlanks(19)) { - thisChiller.thermosiphonTempCurveIndex = Curve::GetCurveIndex(state, Util::makeUPPER(state.dataIPShortCut->cAlphaArgs(19))); + if (!s_ipsc->lAlphaFieldBlanks(19)) { + thisChiller.thermosiphonTempCurveIndex = Curve::GetCurveIndex(state, Util::makeUPPER(s_ipsc->cAlphaArgs(19))); if (thisChiller.thermosiphonTempCurveIndex == 0) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, thisChiller.Name)); - ShowContinueError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(19), state.dataIPShortCut->cAlphaArgs(19))); + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, s_ipsc->cCurrentModuleObject, thisChiller.Name)); + ShowContinueError(state, format("Invalid {} = {}", s_ipsc->cAlphaFieldNames(19), s_ipsc->cAlphaArgs(19))); ErrorsFound = true; } } - thisChiller.thermosiphonMinTempDiff = state.dataIPShortCut->rNumericArgs(17); + thisChiller.thermosiphonMinTempDiff = s_ipsc->rNumericArgs(17); } if (ErrorsFound) { - ShowFatalError(state, format("Errors found in processing input for {}", state.dataIPShortCut->cCurrentModuleObject)); + ShowFatalError(state, format("Errors found in processing input for {}", s_ipsc->cCurrentModuleObject)); } } @@ -1050,11 +995,7 @@ void ReformulatedEIRChillerSpecs::initialize(EnergyPlusData &state, bool const R if (this->MyEnvrnFlag && state.dataGlobal->BeginEnvrnFlag && (state.dataPlnt->PlantFirstSizesOkayToFinalize)) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); this->EvapMassFlowRateMax = this->EvapVolFlowRate * rho; @@ -1062,11 +1003,7 @@ void ReformulatedEIRChillerSpecs::initialize(EnergyPlusData &state, bool const R if (this->CondenserType == DataPlant::CondenserType::WaterCooled) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - this->TempRefCondIn, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getDensity(state, this->TempRefCondIn, RoutineName); this->CondMassFlowRateMax = rho * this->CondVolFlowRate; PlantUtilities::InitComponentNodes(state, 0.0, this->CondMassFlowRateMax, this->CondInletNodeNum, this->CondOutletNodeNum); state.dataLoopNodes->Node(this->CondInletNodeNum).Temp = this->TempRefCondIn; @@ -1090,11 +1027,7 @@ void ReformulatedEIRChillerSpecs::initialize(EnergyPlusData &state, bool const R } if (this->HeatRecActive) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); this->DesignHeatRecMassFlowRate = rho * this->DesignHeatRecVolFlowRate; PlantUtilities::InitComponentNodes(state, 0.0, this->DesignHeatRecMassFlowRate, this->HeatRecInletNodeNum, this->HeatRecOutletNodeNum); // overall capacity limit @@ -1133,8 +1066,8 @@ void ReformulatedEIRChillerSpecs::initialize(EnergyPlusData &state, bool const R // check if inlet limit active and if exceeded. bool HeatRecRunFlag = RunFlag; - if (this->HeatRecInletLimitSchedNum > 0) { - Real64 HeatRecHighInletLimit = ScheduleManager::GetCurrentScheduleValue(state, this->HeatRecInletLimitSchedNum); + if (this->heatRecInletLimitSched != nullptr) { + Real64 HeatRecHighInletLimit = this->heatRecInletLimitSched->getCurrentVal(); if (state.dataLoopNodes->Node(this->HeatRecInletNodeNum).Temp > HeatRecHighInletLimit) { // shut down heat recovery HeatRecRunFlag = false; } else { @@ -1260,16 +1193,8 @@ void ReformulatedEIRChillerSpecs::size(EnergyPlusData &state) SizingEvapOutletTemp = state.dataSize->PlantSizData(PltSizNum).ExitTemp; SizingCondOutletTemp = state.dataSize->PlantSizData(PltSizCondNum).ExitTemp + state.dataSize->PlantSizData(PltSizCondNum).DeltaT; } - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getSpecificHeat(state, Constant::CWInitConvTemp, RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); Real64 RefCapFT = Curve::CurveValue(state, this->ChillerCapFTIndex, SizingEvapOutletTemp, SizingCondOutletTemp); tmpNomCap = (Cp * rho * state.dataSize->PlantSizData(PltSizNum).DeltaT * tmpEvapVolFlowRate) / RefCapFT; } else { @@ -1326,16 +1251,8 @@ void ReformulatedEIRChillerSpecs::size(EnergyPlusData &state) if (PltSizCondNum > 0 && PltSizNum > 0 && this->CondenserType == DataPlant::CondenserType::WaterCooled) { if (state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow && tmpNomCap > 0.0) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - this->TempRefCondIn, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - this->TempRefCondIn, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getDensity(state, this->TempRefCondIn, RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getSpecificHeat(state, this->TempRefCondIn, RoutineName); tmpCondVolFlowRate = tmpNomCap * (1.0 + (1.0 / this->RefCOP) * this->CompPowerToCondenserFrac) / (state.dataSize->PlantSizData(PltSizCondNum).DeltaT * Cp * rho); // IF (DataPlant::PlantFirstSizesOkayToFinalize) ElecReformEIRChiller(EIRChillNum)%CondVolFlowRate = tmpCondVolFlowRate @@ -1670,17 +1587,9 @@ void ReformulatedEIRChillerSpecs::size(EnergyPlusData &state) } // Initialize condenser reference inlet temperature (not a user input) - Real64 Density = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - this->TempRefCondOut, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); - - Real64 SpecificHeat = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - this->TempRefCondOut, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Density = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getDensity(state, this->TempRefCondOut, RoutineName); + + Real64 SpecificHeat = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getSpecificHeat(state, this->TempRefCondOut, RoutineName); Real64 CondenserCapacity = this->RefCap * (1.0 + (1.0 / this->RefCOP) * this->CompPowerToCondenserFrac); Real64 DeltaTCond = (CondenserCapacity) / (this->CondVolFlowRate * Density * SpecificHeat); this->TempRefCondIn = this->TempRefCondOut - DeltaTCond; @@ -1714,7 +1623,7 @@ void ReformulatedEIRChillerSpecs::size(EnergyPlusData &state) // Output warning message if negative values are found in the EIRFPLR curve output. Results in Fatal error. if (FoundNegValue) { - ShowWarningError(state, "Energy input to cooing output ratio function of part-load ratio curve shows negative values "); + ShowWarningError(state, "Energy input to cooling output ratio function of part-load ratio curve shows negative values "); ShowContinueError(state, format("for Chiller:Electric:ReformulatedEIR = {}.", equipName)); ShowContinueError(state, "EIR as a function of PLR curve output at various part-load ratios and condenser water temperatures shown below:"); @@ -1909,18 +1818,10 @@ void ReformulatedEIRChillerSpecs::calcHeatRecovery(EnergyPlusData &state, Real64 heatRecInletTemp = state.dataLoopNodes->Node(this->HeatRecInletNodeNum).Temp; Real64 HeatRecMassFlowRate = state.dataLoopNodes->Node(this->HeatRecInletNodeNum).MassFlowRate; - Real64 CpHeatRec = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidName, - heatRecInletTemp, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpHeatRec = state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).glycol->getSpecificHeat(state, heatRecInletTemp, RoutineName); Real64 CpCond; if (this->CondenserType == DataPlant::CondenserType::WaterCooled) { - CpCond = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - condInletTemp, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + CpCond = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getSpecificHeat(state, condInletTemp, RoutineName); } else { CpCond = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(this->HeatRecInletNodeNum).HumRat); } @@ -1961,8 +1862,8 @@ void ReformulatedEIRChillerSpecs::calcHeatRecovery(EnergyPlusData &state, } // check if limit on inlet is present and exceeded. - if (this->HeatRecInletLimitSchedNum > 0) { - Real64 HeatRecHighInletLimit = ScheduleManager::GetCurrentScheduleValue(state, this->HeatRecInletLimitSchedNum); + if (this->heatRecInletLimitSched != nullptr) { + Real64 HeatRecHighInletLimit = this->heatRecInletLimitSched->getCurrentVal(); if (heatRecInletTemp > HeatRecHighInletLimit) { // shut down heat recovery QHeatRec = 0.0; } @@ -2147,7 +2048,12 @@ void ReformulatedEIRChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoa PlantUtilities::PullCompInterconnectTrigger( state, this->CWPlantLoc, this->CondMassFlowIndex, this->CDPlantLoc, DataPlant::CriteriaType::MassFlowRate, this->CondMassFlowRate); - if (this->CondMassFlowRate < DataBranchAirLoopPlant::MassFlowTolerance) return; + if (this->CondMassFlowRate < DataBranchAirLoopPlant::MassFlowTolerance) { + MyLoad = 0.0; + this->EvapMassFlowRate = 0.0; + PlantUtilities::SetComponentFlowRate(state, this->EvapMassFlowRate, this->EvapInletNodeNum, this->EvapOutletNodeNum, this->CWPlantLoc); + return; + } } Real64 FRAC = 1.0; Real64 EvapOutletTempSetPoint(0.0); // Evaporator outlet temperature setpoint [C] @@ -2222,11 +2128,8 @@ void ReformulatedEIRChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoa // This chiller is currently has only a water-cooled condenser // Calculate water side load - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp, RoutineName); // actual load to be met by chiller. This value is compared to MyLoad // and reset when necessary since this chiller can cycle, the load passed @@ -2527,11 +2430,7 @@ void ReformulatedEIRChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoa Real64 condWaterFlowFrac = Curve::CurveValue(state, this->ChillerCondLoopFlowFLoopPLRIndex, cwhLoopPLR); Real64 cwLoopDesVolFlowRate = state.dataSize->PlantSizData(CondPltSizNum).DesVolFlowRate; Real64 cwLoopVolFlowRate = condWaterFlowFrac * cwLoopDesVolFlowRate; - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - this->TempRefCondIn, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getDensity(state, this->TempRefCondIn, RoutineName); if (chwLoopDemand > 0) { this->CondMassFlowRate = cwLoopVolFlowRate * rho * this->QEvaporator / chwLoopDemand; } else { @@ -2545,17 +2444,11 @@ void ReformulatedEIRChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoa } } break; case DataPlant::CondenserFlowControl::ModulatedDeltaTemperature: { - Real64 CpCond = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - this->CondInletTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); - Real64 condDT = 0.0; - if (this->CondDTScheduleNum > 0) { - condDT = ScheduleManager::GetCurrentScheduleValue(state, this->CondDTScheduleNum); - } + Real64 CpCond = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getSpecificHeat(state, this->CondInletTemp, RoutineName); + Real64 condDT = (this->condDTSched != nullptr) ? this->condDTSched->getCurrentVal() : 0.0; this->CondMassFlowRate = this->QCondenser / (CpCond * condDT); } break; + default: { this->CondMassFlowRate = this->CondMassFlowRateMax; } break; @@ -2573,11 +2466,7 @@ void ReformulatedEIRChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoa if (this->CondMassFlowRate > DataBranchAirLoopPlant::MassFlowTolerance) { // If Heat Recovery specified for this vapor compression chiller, then Qcondenser will be adjusted by this subroutine if (this->HeatRecActive) this->calcHeatRecovery(state, this->QCondenser, this->CondMassFlowRate, condInletTemp, this->QHeatRecovery); - Real64 CpCond = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - condInletTemp, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpCond = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getSpecificHeat(state, condInletTemp, RoutineName); this->CondOutletTemp = this->QCondenser / this->CondMassFlowRate / CpCond + condInletTemp; } else { ShowSevereError(state, format("ControlReformEIRChillerModel: Condenser flow = 0, for ElecReformEIRChiller={}", this->Name)); diff --git a/src/EnergyPlus/ChillerReformulatedEIR.hh b/src/EnergyPlus/ChillerReformulatedEIR.hh index 58077b2c478..ce441d2c518 100644 --- a/src/EnergyPlus/ChillerReformulatedEIR.hh +++ b/src/EnergyPlus/ChillerReformulatedEIR.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -123,7 +123,7 @@ namespace ChillerReformulatedEIR { Real64 HeatRecCapacityFraction = 0.0; // user input for heat recovery capacity fraction [] Real64 HeatRecMaxCapacityLimit = 0.0; // Capacity limit for Heat recovery, one time calc [W] int HeatRecSetPointNodeNum = 0; // index for system node with the heat recover leaving setpoint - int HeatRecInletLimitSchedNum = 0; // index for schedule for the inlet high limit for heat recovery operation + Sched::Schedule *heatRecInletLimitSched = nullptr; // index for schedule for the inlet high limit for heat recovery operation int ChillerCapFTIndex = 0; // Index for the total cooling capacity modifier curve // (function of leaving evaporator and condenser water temperatures) int ChillerEIRFTIndex = 0; // Index for the energy input ratio modifier curve @@ -214,7 +214,7 @@ namespace ChillerReformulatedEIR { Real64 HeatRecMassFlow = 0.0; // Heat reclaim mass flow rate [kg/s] int ChillerCondLoopFlowFLoopPLRIndex = 0; // Condenser loop flow rate fraction function of loop PLR int CondDT = 0; // Temperature difference across condenser - int CondDTScheduleNum = 0; // Temperature difference across condenser schedule index + Sched::Schedule *condDTSched = nullptr; // Temperature difference across condenser schedule Real64 MinCondFlowRatio = 0.2; // Minimum condenser flow fraction DataBranchAirLoopPlant::ControlType EquipFlowCtrl = DataBranchAirLoopPlant::ControlType::Invalid; Real64 VSBranchPumpMinLimitMassFlowCond = 0.0; @@ -273,6 +273,10 @@ struct ChillerReformulatedEIRData : BaseGlobalStruct bool GetInputREIR = true; Array1D ElecReformEIRChiller; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/Coils/CoilCoolingDX.cc b/src/EnergyPlus/Coils/CoilCoolingDX.cc index 6ce7bef2a44..db7e1b36331 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDX.cc +++ b/src/EnergyPlus/Coils/CoilCoolingDX.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -70,19 +70,20 @@ #include #include #include +#include #include using namespace EnergyPlus; int CoilCoolingDX::factory(EnergyPlus::EnergyPlusData &state, std::string const &coilName) { - if (state.dataCoilCooingDX->coilCoolingDXGetInputFlag) { + if (state.dataCoilCoolingDX->coilCoolingDXGetInputFlag) { CoilCoolingDX::getInput(state); - state.dataCoilCooingDX->coilCoolingDXGetInputFlag = false; + state.dataCoilCoolingDX->coilCoolingDXGetInputFlag = false; } int handle = -1; std::string coilNameUpper = Util::makeUPPER(coilName); - for (auto const &thisCoil : state.dataCoilCooingDX->coilCoolingDXs) { + for (auto const &thisCoil : state.dataCoilCoolingDX->coilCoolingDXs) { handle++; if (coilNameUpper == Util::makeUPPER(thisCoil.name)) { return handle; @@ -94,7 +95,7 @@ int CoilCoolingDX::factory(EnergyPlus::EnergyPlusData &state, std::string const void CoilCoolingDX::getInput(EnergyPlusData &state) { - int numCoolingCoilDXs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, state.dataCoilCooingDX->coilCoolingDXObjectName); + int numCoolingCoilDXs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, state.dataCoilCoolingDX->coilCoolingDXObjectName); if (numCoolingCoilDXs <= 0) { ShowFatalError(state, R"(No "Coil:Cooling:DX" objects in input file)"); } @@ -103,7 +104,7 @@ void CoilCoolingDX::getInput(EnergyPlusData &state) int NumNumbers; // Number of Numbers for each GetObjectItem call int IOStatus; state.dataInputProcessing->inputProcessor->getObjectItem(state, - state.dataCoilCooingDX->coilCoolingDXObjectName, + state.dataCoilCoolingDX->coilCoolingDXObjectName, coilNum, state.dataIPShortCut->cAlphaArgs, NumAlphas, @@ -123,20 +124,23 @@ void CoilCoolingDX::getInput(EnergyPlusData &state) input_specs.evaporative_condenser_supply_water_storage_tank_name = state.dataIPShortCut->cAlphaArgs(10); CoilCoolingDX thisCoil; thisCoil.instantiateFromInputSpec(state, input_specs); - state.dataCoilCooingDX->coilCoolingDXs.push_back(thisCoil); + state.dataCoilCoolingDX->coilCoolingDXs.push_back(thisCoil); } } void CoilCoolingDX::instantiateFromInputSpec(EnergyPlusData &state, const CoilCoolingDXInputSpecification &input_data) { - static constexpr std::string_view routineName("CoilCoolingDX::instantiateFromInputSpec: "); + static constexpr std::string_view routineName = "CoilCoolingDX::instantiateFromInputSpec"; + + ErrorObjectHeader eoh{routineName, "CoilCoolingDX", input_data.name}; + this->original_input_specs = input_data; bool errorsFound = false; this->name = input_data.name; // initialize reclaim heat parameters this->reclaimHeat.Name = this->name; - this->reclaimHeat.SourceType = state.dataCoilCooingDX->coilCoolingDXObjectName; + this->reclaimHeat.SourceType = state.dataCoilCoolingDX->coilCoolingDXObjectName; this->performance = CoilCoolingDXCurveFitPerformance(state, input_data.performance_object_name); @@ -189,7 +193,7 @@ void CoilCoolingDX::instantiateFromInputSpec(EnergyPlusData &state, const CoilCo if (!input_data.condensate_collection_water_storage_tank_name.empty()) { WaterManager::SetupTankSupplyComponent(state, this->name, - state.dataCoilCooingDX->coilCoolingDXObjectName, + state.dataCoilCoolingDX->coilCoolingDXObjectName, input_data.condensate_collection_water_storage_tank_name, errorsFound, this->condensateTankIndex, @@ -199,7 +203,7 @@ void CoilCoolingDX::instantiateFromInputSpec(EnergyPlusData &state, const CoilCo if (!input_data.evaporative_condenser_supply_water_storage_tank_name.empty()) { WaterManager::SetupTankDemandComponent(state, this->name, - state.dataCoilCooingDX->coilCoolingDXObjectName, + state.dataCoilCoolingDX->coilCoolingDXObjectName, input_data.evaporative_condenser_supply_water_storage_tank_name, errorsFound, this->evaporativeCondSupplyTankIndex, @@ -207,14 +211,9 @@ void CoilCoolingDX::instantiateFromInputSpec(EnergyPlusData &state, const CoilCo } if (input_data.availability_schedule_name.empty()) { - this->availScheduleIndex = ScheduleManager::ScheduleAlwaysOn; - } else { - this->availScheduleIndex = ScheduleManager::GetScheduleIndex(state, input_data.availability_schedule_name); - } - - if (this->availScheduleIndex == 0) { - ShowSevereError(state, std::string{routineName} + state.dataCoilCooingDX->coilCoolingDXObjectName + "=\"" + this->name + "\", invalid"); - ShowContinueError(state, "...Availability Schedule Name=\"" + input_data.availability_schedule_name + "\"."); + this->availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((this->availSched = Sched::GetSchedule(state, input_data.availability_schedule_name)) == nullptr) { + ShowSevereItemNotFound(state, eoh, "Availability Schedule Name", input_data.availability_schedule_name); errorsFound = true; } @@ -224,7 +223,7 @@ void CoilCoolingDX::instantiateFromInputSpec(EnergyPlusData &state, const CoilCo } BranchNodeConnections::TestCompSet(state, - state.dataCoilCooingDX->coilCoolingDXObjectName, + state.dataCoilCoolingDX->coilCoolingDXObjectName, this->name, input_data.evaporator_inlet_node_name, input_data.evaporator_outlet_node_name, @@ -232,7 +231,7 @@ void CoilCoolingDX::instantiateFromInputSpec(EnergyPlusData &state, const CoilCo if (errorsFound) { ShowFatalError(state, - std::string{routineName} + "Errors found in getting " + state.dataCoilCooingDX->coilCoolingDXObjectName + + std::string{routineName} + "Errors found in getting " + state.dataCoilCoolingDX->coilCoolingDXObjectName + " input. Preceding condition(s) causes termination."); } } @@ -697,7 +696,7 @@ void CoilCoolingDX::simulate(EnergyPlusData &state, CoilCoolingDX::passThroughNodeData(evapInletNode, evapOutletNode); // calculate energy conversion factor - Real64 reportingConstant = state.dataHVACGlobal->TimeStepSys * Constant::SecInHour; + Real64 reportingConstant = state.dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; // update condensate collection tank if (this->condensateTankIndex > 0) { @@ -805,7 +804,7 @@ void CoilCoolingDX::simulate(EnergyPlusData &state, ratedSensCap = this->performance.normalMode.ratedGrossTotalCap * this->normModeNomSpeed().grossRatedSHR; state.dataRptCoilSelection->coilSelectionReportObj->setCoilFinalSizes(state, this->name, - state.dataCoilCooingDX->coilCoolingDXObjectName, + state.dataCoilCoolingDX->coilCoolingDXObjectName, this->performance.normalMode.ratedGrossTotalCap, ratedSensCap, this->performance.normalMode.ratedEvapAirFlowRate, @@ -816,7 +815,7 @@ void CoilCoolingDX::simulate(EnergyPlusData &state, if (this->supplyFanIndex > 0) { state.dataRptCoilSelection->coilSelectionReportObj->setCoilSupplyFanInfo(state, this->name, - state.dataCoilCooingDX->coilCoolingDXObjectName, + state.dataCoilCoolingDX->coilCoolingDXObjectName, state.dataFans->fans(this->supplyFanIndex)->Name, state.dataFans->fans(this->supplyFanIndex)->type, this->supplyFanIndex); @@ -903,7 +902,7 @@ void CoilCoolingDX::simulate(EnergyPlusData &state, state, dummyEvapOutlet.Temp, dummyEvapOutlet.HumRat, DataEnvironment::StdPressureSeaLevel, "Coil:Cooling:DX::simulate"); state.dataRptCoilSelection->coilSelectionReportObj->setRatedCoilConditions(state, this->name, - state.dataCoilCooingDX->coilCoolingDXObjectName, + state.dataCoilCoolingDX->coilCoolingDXObjectName, coolingRate, sensCoolingRate, ratedInletEvapMassFlowRate, @@ -987,7 +986,7 @@ void PopulateCoolingCoilStandardRatingInformation(InputOutputFile &eio, void CoilCoolingDX::reportAllStandardRatings(EnergyPlusData &state) { - if (!state.dataCoilCooingDX->coilCoolingDXs.empty()) { + if (!state.dataCoilCoolingDX->coilCoolingDXs.empty()) { Real64 constexpr ConvFromSIToIP(3.412141633); // Conversion from SI to IP [3.412 Btu/hr-W] if (state.dataHVACGlobal->StandardRatingsMyCoolOneTimeFlag) { static constexpr std::string_view Format_994( @@ -998,7 +997,7 @@ void CoilCoolingDX::reportAllStandardRatings(EnergyPlusData &state) print(state.files.eio, "{}\n", Format_994); state.dataHVACGlobal->StandardRatingsMyCoolOneTimeFlag = false; } - for (auto &coil : state.dataCoilCooingDX->coilCoolingDXs) { + for (auto &coil : state.dataCoilCoolingDX->coilCoolingDXs) { coil.performance.calcStandardRatings210240(state); PopulateCoolingCoilStandardRatingInformation(state.files.eio, coil.name, @@ -1047,19 +1046,7 @@ void CoilCoolingDX::reportAllStandardRatings(EnergyPlusData &state) } else { OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilIEERIP, coil.name, "N/A"); } - OutputReportPredefined::addFootNoteSubTable( - state, - state.dataOutRptPredefined->pdstDXCoolCoil, - "ANSI/AHRI ratings account for supply air fan heat and electric power.
" - "1 - EnergyPlus object type.
" - "2 - Capacity less than 65K Btu/h (19050 W) - calculated as per AHRI Standard 210/240-2017.
" - "  Capacity of 65K Btu/h (19050 W) to less than 135K Btu/h (39565 W) - calculated as per AHRI Standard 340/360-2007. " - "
" - "  Capacity from 135K (39565 W) to 250K Btu/hr (73268 W) - calculated as per AHRI Standard 365-2009 - Ratings not yet " - "supported in EnergyPlus.
" - "3 - SEER (User) is calculated using user-input PLF curve and cooling coefficient of degradation.
" - "  SEER (Standard) is calculated using the default PLF curve and cooling coefficient of degradation" - "from the appropriate AHRI standard."); + OutputReportPredefined::addFootNoteSubTable(state, state.dataOutRptPredefined->pdstDXCoolCoil, StandardRatings::AHRI2017FOOTNOTE); // AHRI 2023 Standard SEER2 Calculations if (state.dataHVACGlobal->StandardRatingsMyCoolOneTimeFlag2) { @@ -1125,21 +1112,8 @@ void CoilCoolingDX::reportAllStandardRatings(EnergyPlusData &state) } else { OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilIEERIP_2023, coil.name, "N/A"); } - OutputReportPredefined::addFootNoteSubTable( - state, - state.dataOutRptPredefined->pdstDXCoolCoil_2023, - "ANSI/AHRI ratings account for supply air fan heat and electric power.
" - "1 - EnergyPlus object type.
" - "2 - Capacity less than 65K Btu/h (19050 W) - calculated as per AHRI Standard 210/240-2023.
" - "  Capacity of 65K Btu/h (19050 W) to less than 135K Btu/h (39565 W) - calculated as per AHRI Standard 340/360-2022. " - "
" - "  Capacity from 135K (39565 W) to 250K Btu/hr (73268 W) - calculated as per AHRI Standard 365-2009 - Ratings not yet " - "supported in EnergyPlus.
" - "3 - SEER2 (User) is calculated using user-input PLF curve and cooling coefficient of degradation.
" - "  SEER2 (Standard) is calculated using the default PLF curve and cooling coefficient of degradation" - "from the appropriate AHRI standard.
" - "4 - Value for the Full Speed of the coil."); + OutputReportPredefined::addFootNoteSubTable(state, state.dataOutRptPredefined->pdstDXCoolCoil_2023, StandardRatings::AHRI2023FOOTNOTE); } } - state.dataCoilCooingDX->stillNeedToReportStandardRatings = false; + state.dataCoilCoolingDX->stillNeedToReportStandardRatings = false; } diff --git a/src/EnergyPlus/Coils/CoilCoolingDX.hh b/src/EnergyPlus/Coils/CoilCoolingDX.hh index fd680a177ae..22bd5d2130f 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDX.hh +++ b/src/EnergyPlus/Coils/CoilCoolingDX.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -55,6 +55,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -115,7 +116,7 @@ struct CoilCoolingDX bool myOneTimeInitFlag = true; int evapInletNodeIndex = 0; int evapOutletNodeIndex = 0; - int availScheduleIndex = 0; + Sched::Schedule *availSched = nullptr; int condInletNodeIndex = 0; int condOutletNodeIndex = 0; CoilCoolingDXCurveFitPerformance performance; @@ -181,6 +182,11 @@ struct CoilCoolingDXData : BaseGlobalStruct bool coilCoolingDXGetInputFlag = true; std::string const coilCoolingDXObjectName = "Coil:Cooling:DX"; bool stillNeedToReportStandardRatings = true; // standard ratings flag for all coils to report at the same time + + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.cc b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.cc index 0067efabb32..9f4e8871b23 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.cc +++ b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.hh b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.hh index 026c1107d98..ae70be1f82b 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.hh +++ b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.cc b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.cc index 67ab205d590..aeba9103887 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.cc +++ b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -66,7 +66,10 @@ using namespace EnergyPlus; void CoilCoolingDXCurveFitPerformance::instantiateFromInputSpec(EnergyPlus::EnergyPlusData &state, const CoilCoolingDXCurveFitPerformanceInputSpecification &input_data) { - static constexpr std::string_view routineName("CoilCoolingDXCurveFitOperatingMode::instantiateFromInputSpec: "); + static constexpr std::string_view routineName = "CoilCoolingDXCurveFitOperatingMode::instantiateFromInputSpec"; + + ErrorObjectHeader eoh{routineName, this->object_name, input_data.name}; + bool errorsFound(false); this->original_input_specs = input_data; this->name = input_data.name; @@ -75,6 +78,7 @@ void CoilCoolingDXCurveFitPerformance::instantiateFromInputSpec(EnergyPlus::Ener this->crankcaseHeaterCap = input_data.crankcase_heater_capacity; this->normalMode = CoilCoolingDXCurveFitOperatingMode(state, input_data.base_operating_mode_name); this->normalMode.oneTimeInit(state); // oneTimeInit does not need to be delayed in this use case + if (Util::SameString(input_data.capacity_control, "CONTINUOUS")) { this->capControlMethod = CapControlMethod::CONTINUOUS; } else if (Util::SameString(input_data.capacity_control, "DISCRETE")) { @@ -88,14 +92,10 @@ void CoilCoolingDXCurveFitPerformance::instantiateFromInputSpec(EnergyPlus::Ener this->evapCondBasinHeatCap = input_data.basin_heater_capacity; this->evapCondBasinHeatSetpoint = input_data.basin_heater_setpoint_temperature; if (input_data.basin_heater_operating_schedule_name.empty()) { - this->evapCondBasinHeatSchedulIndex = ScheduleManager::ScheduleAlwaysOn; - } else { - this->evapCondBasinHeatSchedulIndex = ScheduleManager::GetScheduleIndex(state, input_data.basin_heater_operating_schedule_name); - } - if (this->evapCondBasinHeatSchedulIndex == 0) { - ShowSevereError(state, std::string{routineName} + this->object_name + "=\"" + this->name + "\", invalid"); - ShowContinueError( - state, "...Evaporative Condenser Basin Heater Operating Schedule Name=\"" + input_data.basin_heater_operating_schedule_name + "\"."); + this->evapCondBasinHeatSched = Sched::GetScheduleAlwaysOn(state); + } else if ((this->evapCondBasinHeatSched = Sched::GetSchedule(state, input_data.basin_heater_operating_schedule_name)) == nullptr) { + ShowSevereItemNotFound( + state, eoh, "Evaporative Condenser Basin Heater Operating Schedule Name", input_data.basin_heater_operating_schedule_name); errorsFound = true; } @@ -215,7 +215,7 @@ void CoilCoolingDXCurveFitPerformance::simulate(EnergyPlus::EnergyPlusData &stat Real64 LoadSHR) { static constexpr std::string_view RoutineName = "CoilCoolingDXCurveFitPerformance::simulate"; - Real64 reportingConstant = state.dataHVACGlobal->TimeStepSys * Constant::SecInHour; + Real64 reportingConstant = state.dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; this->recoveredEnergyRate = 0.0; this->NormalSHR = 0.0; @@ -363,8 +363,8 @@ void CoilCoolingDXCurveFitPerformance::simulate(EnergyPlus::EnergyPlusData &stat this->crankcaseHeaterElectricityConsumption = this->crankcaseHeaterPower * reportingConstant; // basin heater - if (this->evapCondBasinHeatSchedulIndex > 0) { - Real64 currentBasinHeaterAvail = ScheduleManager::GetCurrentScheduleValue(state, this->evapCondBasinHeatSchedulIndex); + if (this->evapCondBasinHeatSched != nullptr) { + Real64 currentBasinHeaterAvail = this->evapCondBasinHeatSched->getCurrentVal(); if (this->evapCondBasinHeatCap > 0.0 && currentBasinHeaterAvail > 0.0) { this->basinHeaterPower = max(0.0, this->evapCondBasinHeatCap * (this->evapCondBasinHeatSetpoint - state.dataEnvrn->OutDryBulbTemp)); } @@ -447,7 +447,7 @@ void CoilCoolingDXCurveFitPerformance::calcStandardRatings210240(EnergyPlus::Ene Real64 ElecPowerReducedCap(0.0); // Net power consumption (Cond Fan+Compressor) at reduced test condition [W] Real64 NetCoolingCapReduced(0.0); // Net Cooling Coil capacity at reduced conditions, accounting for supply fan heat [W] Real64 LoadFactor(0.0); // Fractional "on" time for last stage at the desired reduced capacity, (dimensionless) - Real64 DegradationCoeff(0.0); // Degradation coeficient, (dimenssionless) + Real64 DegradationCoeff(0.0); // Degradation coefficient, (dimensionless) Real64 OutdoorUnitInletAirDryBulbTempReduced; // Outdoor unit entering air dry-bulb temperature at reduced capacity [C] // *** SOME CONSTANTS FROM THE STANDARD diff --git a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.hh b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.hh index 2f1b5a4ce27..c7f77790405 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.hh +++ b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -55,6 +55,7 @@ #include #include #include +#include #include namespace EnergyPlus { @@ -138,7 +139,7 @@ struct CoilCoolingDXCurveFitPerformance Real64 evapCondBasinHeatCap = 0.0; Real64 evapCondBasinHeatSetpoint = 0.0; - int evapCondBasinHeatSchedulIndex = 0; + Sched::Schedule *evapCondBasinHeatSched = nullptr; Real64 basinHeaterElectricityConsumption = 0.0; Real64 basinHeaterPower = 0.0; Real64 powerUse = 0.0; diff --git a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.cc b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.cc index 7e2af833675..ef84534d2e9 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.cc +++ b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.hh b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.hh index 971c3891f90..e0e6ebf4bf5 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.hh +++ b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/CommandLineInterface.cc b/src/EnergyPlus/CommandLineInterface.cc index c25c82f4819..f7deb99e86a 100644 --- a/src/EnergyPlus/CommandLineInterface.cc +++ b/src/EnergyPlus/CommandLineInterface.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -62,7 +62,7 @@ #include #if LINK_WITH_PYTHON -#include +# include #endif namespace EnergyPlus { @@ -235,7 +235,7 @@ Built on Platform: {} app.add_flag("--debug-cli", debugCLI, "Print the result of the CLI assignments to the console and exit")->group(""); // Empty group to hide it #if LINK_WITH_PYTHON -#ifdef PYTHON_CLI +# ifdef PYTHON_CLI auto *auxiliaryToolsSubcommand = app.add_subcommand("auxiliary", "Run Auxiliary Python Tools"); auxiliaryToolsSubcommand->require_subcommand(); // should default to requiring 1 or more additional args? @@ -283,7 +283,7 @@ main_gui() engine.exec(cmd); exit(0); }); -#endif +# endif #endif app.footer("Example: energyplus -w weather.epw -r input.idf"); diff --git a/src/EnergyPlus/CommandLineInterface.hh b/src/EnergyPlus/CommandLineInterface.hh index d0d17907653..461badbd437 100644 --- a/src/EnergyPlus/CommandLineInterface.hh +++ b/src/EnergyPlus/CommandLineInterface.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/CondenserLoopTowers.cc b/src/EnergyPlus/CondenserLoopTowers.cc index a99dee14c4c..6eb94bfbbc2 100644 --- a/src/EnergyPlus/CondenserLoopTowers.cc +++ b/src/EnergyPlus/CondenserLoopTowers.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -52,7 +52,7 @@ // ObjexxFCL Headers #include #include -#include +// #include // EnergyPlus Headers #include @@ -200,8 +200,7 @@ namespace CondenserLoopTowers { // METHODOLOGY EMPLOYED: // Uses "Get" routines to read in the data. - // SUBROUTINE PARAMETER DEFINITIONS: - static constexpr std::string_view OutputFormat("{:5.2F}"); + static constexpr std::string_view routineName = "GetTowerInput"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int TowerNum; // Tower number, reference counter for towers data array @@ -227,11 +226,14 @@ namespace CondenserLoopTowers { constexpr std::array(Blowdown::Num)> BlowDownNamesUC = {"CONCENTRATIONRATIO", "SCHEDULEDRATE"}; constexpr std::array(CellCtrl::Num)> CellCtrlNamesUC = {"MINIMALCELL", "MAXIMALCELL"}; + auto const &s_ip = state.dataInputProcessing->inputProcessor; + auto &s_ipsc = state.dataIPShortCut; + // Get number of all cooling towers specified in the input data file (idf) - int NumSingleSpeedTowers = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCoolingTower_SingleSpeed); - int NumTwoSpeedTowers = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCoolingTower_TwoSpeed); - int NumVariableSpeedTowers = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCoolingTower_VariableSpeed); - int NumVSMerkelTowers = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCoolingTower_VariableSpeedMerkel); + int NumSingleSpeedTowers = s_ip->getNumObjectsFound(state, cCoolingTower_SingleSpeed); + int NumTwoSpeedTowers = s_ip->getNumObjectsFound(state, cCoolingTower_TwoSpeed); + int NumVariableSpeedTowers = s_ip->getNumObjectsFound(state, cCoolingTower_VariableSpeed); + int NumVSMerkelTowers = s_ip->getNumObjectsFound(state, cCoolingTower_VariableSpeedMerkel); int NumSimpleTowers = NumSingleSpeedTowers + NumTwoSpeedTowers + NumVariableSpeedTowers + NumVSMerkelTowers; if (NumSimpleTowers <= 0) @@ -249,30 +251,31 @@ namespace CondenserLoopTowers { // Allocate variable-speed tower structure with data specific to this type if (NumVariableSpeedTowers > 0) { // Allow users to input model coefficients other than default - NumVSCoolToolsModelCoeffs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "CoolingTowerPerformance:CoolTools"); - NumVSYorkCalcModelCoeffs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "CoolingTowerPerformance:YorkCalc"); + NumVSCoolToolsModelCoeffs = s_ip->getNumObjectsFound(state, "CoolingTowerPerformance:CoolTools"); + NumVSYorkCalcModelCoeffs = s_ip->getNumObjectsFound(state, "CoolingTowerPerformance:YorkCalc"); } - std::string &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; - // Load data structures with cooling tower input data - cCurrentModuleObject = cCoolingTower_SingleSpeed; + s_ipsc->cCurrentModuleObject = cCoolingTower_SingleSpeed; for (int SingleSpeedTowerNumber = 1; SingleSpeedTowerNumber <= NumSingleSpeedTowers; ++SingleSpeedTowerNumber) { TowerNum = SingleSpeedTowerNumber; - state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, - SingleSpeedTowerNumber, - AlphArray, - NumAlphas, - NumArray, - NumNums, - IOStat, - _, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + SingleSpeedTowerNumber, + AlphArray, + NumAlphas, + NumArray, + NumNums, + IOStat, + _, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, AlphArray(1)}; + GlobalNames::VerifyUniqueInterObjectName( - state, UniqueSimpleTowerNames, AlphArray(1), cCurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), ErrorsFound); + state, UniqueSimpleTowerNames, AlphArray(1), s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaFieldNames(1), ErrorsFound); auto &tower = state.dataCondenserLoopTowers->towers(TowerNum); tower.Name = AlphArray(1); tower.TowerType = DataPlant::PlantEquipmentType::CoolingTower_SingleSpd; @@ -295,7 +298,7 @@ namespace CondenserLoopTowers { DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsNotParent); - BranchNodeConnections::TestCompSet(state, cCurrentModuleObject, tower.Name, AlphArray(2), AlphArray(3), "Chilled Water Nodes"); + BranchNodeConnections::TestCompSet(state, s_ipsc->cCurrentModuleObject, tower.Name, AlphArray(2), AlphArray(3), "Chilled Water Nodes"); tower.DesignWaterFlowRate = NumArray(1); if (tower.DesignWaterFlowRate == DataSizing::AutoSize) { tower.DesignWaterFlowRateWasAutoSized = true; @@ -335,8 +338,7 @@ namespace CondenserLoopTowers { if (NumAlphas >= 4) { tower.PerformanceInputMethod_Num = static_cast(getEnumValue(PIMNamesUC, Util::makeUPPER(AlphArray(4)))); if (tower.PerformanceInputMethod_Num == PIM::Invalid) { - ShowSevereError(state, format("{}={}", cCurrentModuleObject, AlphArray(1))); - ShowContinueError(state, format("Invalid, {} = {}", state.dataIPShortCut->cAlphaFieldNames(4), AlphArray(4))); + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(4), AlphArray(4)); ErrorsFound = true; } } else { @@ -370,9 +372,7 @@ namespace CondenserLoopTowers { // Basin heater power as a function of temperature must be greater than or equal to 0 tower.BasinHeaterPowerFTempDiff = NumArray(17); if (NumArray(17) < 0.0) { - ShowSevereError( - state, - format("{}, \"{}\" basin heater power as a function of temperature difference must be >= 0", cCurrentModuleObject, tower.Name)); + ShowSevereCustom(state, eoh, "Basin heater power as a function of temperature difference must be >= 0"); ErrorsFound = true; } @@ -383,23 +383,17 @@ namespace CondenserLoopTowers { tower.BasinHeaterSetPointTemp = 2.0; } if (tower.BasinHeaterSetPointTemp < 2.0) { - ShowWarningError(state, - format("{}:\"{}\", {} is less than 2 deg C. Freezing could occur.", - cCurrentModuleObject, - tower.Name, - state.dataIPShortCut->cNumericFieldNames(18))); + ShowWarningCustom(state, eoh, format("{} is less than 2 deg C. Freezing could occur.", s_ipsc->cNumericFieldNames(18))); } } if (!AlphArray(5).empty()) { - tower.BasinHeaterSchedulePtr = ScheduleManager::GetScheduleIndex(state, AlphArray(5)); - if (tower.BasinHeaterSchedulePtr == 0) { - ShowWarningError(state, - format("{}, \"{}\" basin heater schedule name \"{}\" was not found. Basin heater operation will not be modeled " - "and the simulation continues", - cCurrentModuleObject, - tower.Name, - AlphArray(5))); + if ((tower.basinHeaterSched = Sched::GetSchedule(state, AlphArray(5))) == nullptr) { + ShowWarningItemNotFound(state, + eoh, + s_ipsc->cAlphaFieldNames(5), + AlphArray(5), + "Basin heater operation will not be modeled and the simulation continues"); } } @@ -413,24 +407,24 @@ namespace CondenserLoopTowers { if (tower.SizFac <= 0.0) tower.SizFac = 1.0; tower.BlowdownMode = static_cast(getEnumValue(BlowDownNamesUC, Util::makeUPPER(AlphArray(7)))); - tower.SchedIDBlowdown = ScheduleManager::GetScheduleIndex(state, AlphArray(8)); - if ((tower.SchedIDBlowdown == 0) && (tower.BlowdownMode == Blowdown::Schedule)) { - ShowSevereError(state, format("Invalid, {} = \"{}\"", state.dataIPShortCut->cAlphaFieldNames(8), AlphArray(8))); - ShowContinueError(state, format("Entered in {} = \"{}\"", cCoolingTower_SingleSpeed, tower.Name)); - ErrorsFound = true; + if (tower.BlowdownMode == Blowdown::Schedule) { + if ((tower.blowdownSched = Sched::GetSchedule(state, AlphArray(8))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(8), AlphArray(8)); + ErrorsFound = true; + } } if (AlphArray(9).empty()) { tower.SuppliedByWaterSystem = false; } else { // water from storage tank WaterManager::SetupTankDemandComponent( - state, AlphArray(1), cCurrentModuleObject, AlphArray(9), ErrorsFound, tower.WaterTankID, tower.WaterTankDemandARRID); + state, AlphArray(1), s_ipsc->cCurrentModuleObject, AlphArray(9), ErrorsFound, tower.WaterTankID, tower.WaterTankDemandARRID); tower.SuppliedByWaterSystem = true; } // outdoor air inlet node - if (state.dataIPShortCut->lAlphaFieldBlanks(10)) { + if (s_ipsc->lAlphaFieldBlanks(10)) { tower.OutdoorAirInletNodeNum = 0; } else { tower.OutdoorAirInletNodeNum = NodeInputManager::GetOnlySingleNode(state, @@ -443,28 +437,22 @@ namespace CondenserLoopTowers { NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsNotParent); if (!OutAirNodeManager::CheckOutAirNodeNumber(state, tower.OutdoorAirInletNodeNum)) { - ShowSevereError(state, - format("{}, \"{}\" Outdoor Air Inlet Node Name not valid Outdoor Air Node= {}", - cCurrentModuleObject, - tower.Name, - AlphArray(10))); - ShowContinueError(state, "...does not appear in an OutdoorAir:NodeList or as an OutdoorAir:Node."); + ShowSevereCustom(state, + eoh, + format("Outdoor Air Inlet Node Name not valid Outdoor Air Node= {}" + "does not appear in an OutdoorAir:NodeList or as an OutdoorAir:Node.", + AlphArray(10))); ErrorsFound = true; } } // fluid bypass for single speed tower - if (state.dataIPShortCut->lAlphaFieldBlanks(11) || AlphArray(11).empty()) { + if (s_ipsc->lAlphaFieldBlanks(11) || AlphArray(11).empty()) { tower.CapacityControl = CapacityCtrl::FanCycling; // FanCycling - } else { - tower.CapacityControl = static_cast(getEnumValue(CapacityCtrlNamesUC, Util::makeUPPER(AlphArray(11)))); - if (tower.CapacityControl == CapacityCtrl::Invalid) { - tower.CapacityControl = CapacityCtrl::FanCycling; - ShowWarningError(state, - format("{}, \"{}\" The Capacity Control is not specified correctly. The default Fan Cycling is used.", - cCurrentModuleObject, - tower.Name)); - } + } else if ((tower.CapacityControl = static_cast(getEnumValue(CapacityCtrlNamesUC, AlphArray(11)))) == + CapacityCtrl::Invalid) { + tower.CapacityControl = CapacityCtrl::FanCycling; + ShowWarningInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(11), AlphArray(11), "The default Fan Cycling is used."); } // added for multi-cell @@ -485,115 +473,76 @@ namespace CondenserLoopTowers { } // cell control for single speed tower - if (!state.dataIPShortCut->lAlphaFieldBlanks(12)) { + if (!s_ipsc->lAlphaFieldBlanks(12)) { tower.cellCtrl = static_cast(getEnumValue(CellCtrlNamesUC, Util::makeUPPER(AlphArray(12)))); } // High speed air flow rate must be greater than free convection air flow rate. // Can't tell yet if autosized, check later in initialize. if (tower.HighSpeedAirFlowRate <= tower.FreeConvAirFlowRate && tower.HighSpeedAirFlowRate != DataSizing::AutoSize) { - ShowSevereError( - state, - format("{} \"{}\". Free convection air flow rate must be less than the design air flow rate.", cCurrentModuleObject, tower.Name)); + ShowSevereCustom(state, eoh, "Free convection air flow rate must be less than the design air flow rate."); ErrorsFound = true; } // Check various inputs if Performance Input Method = "UA and Design Water Flow Rate" if (tower.PerformanceInputMethod_Num == PIM::UFactor) { if (tower.DesignWaterFlowRate == 0.0) { - ShowSevereError(state, - format("{} \"{}\". Tower performance input method requires a design water flow rate greater than zero.", - cCurrentModuleObject, - tower.Name)); + ShowSevereCustom(state, eoh, "Tower performance input method requires a design water flow rate greater than zero."); ErrorsFound = true; } if (tower.HighSpeedTowerUA <= tower.FreeConvTowerUA && tower.HighSpeedTowerUA != DataSizing::AutoSize) { - ShowSevereError(state, - format("{} \"{}\". Free convection UA must be less than the design tower UA.", cCurrentModuleObject, tower.Name)); + ShowSevereCustom(state, eoh, "Free convection UA must be less than the design tower UA."); ErrorsFound = true; } if (tower.FreeConvTowerUA > 0.0 && tower.FreeConvAirFlowRate == 0.0) { - ShowSevereError( - state, - format("{} \"{}\". Free convection air flow rate must be greater than zero when free convection UA is greater than zero.", - cCurrentModuleObject, - tower.Name)); + ShowSevereCustom( + state, eoh, "Free convection air flow rate must be greater than zero when free convection UA is greater than zero."); ErrorsFound = true; } } else if (tower.PerformanceInputMethod_Num == PIM::NominalCapacity) { if (tower.TowerNominalCapacity == 0.0) { - ShowSevereError( - state, - format("{} \"{}\". Tower performance input method requires valid nominal capacity.", cCurrentModuleObject, tower.Name)); + ShowSevereCustom(state, eoh, "Tower performance input method requires valid nominal capacity."); ErrorsFound = true; } if (tower.DesignWaterFlowRate != 0.0) { if (tower.DesignWaterFlowRate > 0.0) { - ShowWarningError(state, - format("{} \"{}\". Nominal capacity input method and design water flow rate have been specified.", - cCurrentModuleObject, - tower.Name)); + ShowWarningCustom(state, eoh, "Nominal capacity input method and design water flow rate have been specified."); } else { - ShowSevereError( - state, - format("{} \"{}\". Nominal capacity input method has been specified and design water flow rate is being autosized.", - cCurrentModuleObject, - tower.Name)); + ShowSevereCustom( + state, eoh, "Nominal capacity input method has been specified and design water flow rate is being autosized."); } ShowContinueError(state, "Design water flow rate will be set according to nominal tower capacity."); } if (tower.HighSpeedTowerUA != 0.0) { if (tower.HighSpeedTowerUA > 0.0) { - ShowWarningError( - state, - format("{} \"{}\". Nominal tower capacity and design tower UA have been specified.", cCurrentModuleObject, tower.Name)); + ShowWarningCustom(state, eoh, "Nominal tower capacity and design tower UA have been specified."); } else { - ShowSevereError(state, - format("{} \"{}\". Nominal tower capacity has been specified and design tower UA is being autosized.", - cCurrentModuleObject, - tower.Name)); + ShowSevereCustom(state, eoh, "Nominal tower capacity has been specified and design tower UA is being autosized."); } ShowContinueError(state, "Design tower UA will be set according to nominal tower capacity."); } if (tower.FreeConvTowerUA != 0.0) { if (tower.FreeConvTowerUA > 0.0) { - ShowWarningError(state, - format("{} \"{}\". Nominal capacity input method and free convection UA have been specified.", - cCurrentModuleObject, - tower.Name)); + ShowWarningCustom(state, eoh, "Nominal capacity input method and free convection UA have been specified."); } else { - ShowSevereError( - state, - format("{} \"{}\". Nominal capacity input method has been specified and free convection UA is being autosized.", - cCurrentModuleObject, - tower.Name)); + ShowSevereCustom(state, eoh, "Nominal capacity input method has been specified and free convection UA is being autosized."); } ShowContinueError(state, "Free convection UA will be set according to nominal tower capacity."); } if (tower.TowerFreeConvNomCap >= tower.TowerNominalCapacity) { - ShowSevereError(state, - format("{} \"{}\". Free convection nominal capacity must be less than the nominal (design) tower capacity.", - cCurrentModuleObject, - tower.Name)); + ShowSevereCustom(state, eoh, "Free convection nominal capacity must be less than the nominal (design) tower capacity."); ErrorsFound = true; } if (tower.TowerFreeConvNomCap > 0.0 && tower.FreeConvAirFlowRate == 0.0) { - ShowSevereError( - state, - format("{} \"{}\". Free convection air flow must be greater than zero when tower free convection capacity is specified.", - cCurrentModuleObject, - tower.Name)); + ShowSevereCustom( + state, eoh, "Free convection air flow must be greater than zero when tower free convection capacity is specified."); ErrorsFound = true; } } else { // Tower performance input method is not specified as a valid "choice" - ShowSevereError(state, - format("{} \"{}{}", - cCurrentModuleObject, - tower.Name, - ". Tower Performance Input Method must be \"UFactorTimesAreaAndDesignWaterFlowRate\" or \"NominalCapacity\"")); - ShowContinueError(state, format("Tower Performanace Input Method currently specified as: {}", AlphArray(4))); + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(4), AlphArray(4)); ErrorsFound = true; } + if (NumAlphas > 12) { tower.EndUseSubcategory = AlphArray(13); } else { @@ -601,23 +550,26 @@ namespace CondenserLoopTowers { } } // End Single-Speed Tower Loop - cCurrentModuleObject = cCoolingTower_TwoSpeed; + s_ipsc->cCurrentModuleObject = cCoolingTower_TwoSpeed; for (int TwoSpeedTowerNumber = 1; TwoSpeedTowerNumber <= NumTwoSpeedTowers; ++TwoSpeedTowerNumber) { TowerNum = NumSingleSpeedTowers + TwoSpeedTowerNumber; - state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, - TwoSpeedTowerNumber, - AlphArray, - NumAlphas, - NumArray, - NumNums, - IOStat, - _, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + TwoSpeedTowerNumber, + AlphArray, + NumAlphas, + NumArray, + NumNums, + IOStat, + _, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, AlphArray(1)}; + GlobalNames::VerifyUniqueInterObjectName( - state, UniqueSimpleTowerNames, AlphArray(1), cCurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), ErrorsFound); + state, UniqueSimpleTowerNames, AlphArray(1), s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaFieldNames(1), ErrorsFound); auto &tower = state.dataCondenserLoopTowers->towers(TowerNum); tower.Name = AlphArray(1); @@ -641,7 +593,7 @@ namespace CondenserLoopTowers { DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsNotParent); - BranchNodeConnections::TestCompSet(state, cCurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Chilled Water Nodes"); + BranchNodeConnections::TestCompSet(state, s_ipsc->cCurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Chilled Water Nodes"); if (NumAlphas >= 4) { tower.PerformanceInputMethod_Num = static_cast(getEnumValue(PIMNamesUC, Util::makeUPPER(AlphArray(4)))); @@ -731,9 +683,7 @@ namespace CondenserLoopTowers { // Basin heater power as a function of temperature must be greater than or equal to 0 tower.BasinHeaterPowerFTempDiff = NumArray(25); if (NumArray(25) < 0.0) { - ShowSevereError( - state, - format("{}, \"{}\" basin heater power as a function of temperature difference must be >= 0", cCurrentModuleObject, tower.Name)); + ShowSevereCustom(state, eoh, "Basin heater power as a function of temperature difference must be >= 0"); ErrorsFound = true; } @@ -743,23 +693,17 @@ namespace CondenserLoopTowers { tower.BasinHeaterSetPointTemp = 2.0; } if (tower.BasinHeaterSetPointTemp < 2.0) { - ShowWarningError(state, - format("{}:\"{}\", {} is less than 2 deg C. Freezing could occur.", - cCurrentModuleObject, - tower.Name, - state.dataIPShortCut->cNumericFieldNames(26))); + ShowWarningCustom(state, eoh, format("{} is less than 2 deg C. Freezing could occur.", s_ipsc->cNumericFieldNames(26))); } } if (!AlphArray(5).empty()) { - tower.BasinHeaterSchedulePtr = ScheduleManager::GetScheduleIndex(state, AlphArray(5)); - if (tower.BasinHeaterSchedulePtr == 0) { - ShowWarningError(state, - format("{}, \"{}\" basin heater schedule name \"{}\" was not found. Basin heater operation will not be modeled " - "and the simulation continues", - cCurrentModuleObject, - tower.Name, - AlphArray(5))); + if ((tower.basinHeaterSched = Sched::GetSchedule(state, AlphArray(5))) == nullptr) { + ShowWarningItemNotFound(state, + eoh, + s_ipsc->cAlphaFieldNames(5), + AlphArray(5), + "Basin heater operation will not be modeled and the simulation continues"); } } @@ -772,11 +716,11 @@ namespace CondenserLoopTowers { if (tower.SizFac <= 0.0) tower.SizFac = 1.0; tower.BlowdownMode = static_cast(getEnumValue(BlowDownNamesUC, Util::makeUPPER(AlphArray(7)))); - tower.SchedIDBlowdown = ScheduleManager::GetScheduleIndex(state, AlphArray(8)); - if ((tower.SchedIDBlowdown == 0) && (tower.BlowdownMode == Blowdown::Schedule)) { - ShowSevereError(state, format("Invalid, {} = \"{}\"", state.dataIPShortCut->cAlphaFieldNames(8), AlphArray(8))); - ShowContinueError(state, format("Entered in {} = \"{}\"", cCoolingTower_TwoSpeed, tower.Name)); - ErrorsFound = true; + if (tower.BlowdownMode == Blowdown::Schedule) { + if ((tower.blowdownSched = Sched::GetSchedule(state, AlphArray(8))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(8), AlphArray(8)); + ErrorsFound = true; + } } // added for multi-cell @@ -797,20 +741,20 @@ namespace CondenserLoopTowers { } // cell control for two speed tower - if (!state.dataIPShortCut->lAlphaFieldBlanks(11)) { + if (!s_ipsc->lAlphaFieldBlanks(11)) { tower.cellCtrl = static_cast(getEnumValue(CellCtrlNamesUC, Util::makeUPPER(AlphArray(11)))); } - if (state.dataIPShortCut->lAlphaFieldBlanks(9)) { + if (s_ipsc->lAlphaFieldBlanks(9)) { tower.SuppliedByWaterSystem = false; } else { // water from storage tank WaterManager::SetupTankDemandComponent( - state, AlphArray(1), cCurrentModuleObject, AlphArray(9), ErrorsFound, tower.WaterTankID, tower.WaterTankDemandARRID); + state, AlphArray(1), s_ipsc->cCurrentModuleObject, AlphArray(9), ErrorsFound, tower.WaterTankID, tower.WaterTankDemandARRID); tower.SuppliedByWaterSystem = true; } // outdoor air inlet node - if (state.dataIPShortCut->lAlphaFieldBlanks(10)) { + if (s_ipsc->lAlphaFieldBlanks(10)) { tower.OutdoorAirInletNodeNum = 0; } else { tower.OutdoorAirInletNodeNum = NodeInputManager::GetOnlySingleNode(state, @@ -823,12 +767,7 @@ namespace CondenserLoopTowers { NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsNotParent); if (!OutAirNodeManager::CheckOutAirNodeNumber(state, tower.OutdoorAirInletNodeNum)) { - ShowSevereError(state, - format("{}, \"{}\" Outdoor Air Inlet Node Name not valid Outdoor Air Node= {}", - cCurrentModuleObject, - tower.Name, - AlphArray(10))); - ShowContinueError(state, "...does not appear in an OutdoorAir:NodeList or as an OutdoorAir:Node."); + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(10), AlphArray(10)); ErrorsFound = true; } } @@ -836,9 +775,10 @@ namespace CondenserLoopTowers { // High speed air flow rate must be greater than low speed air flow rate. // Can't tell yet if autosized, check later in initialize. if (tower.HighSpeedAirFlowRate <= tower.LowSpeedAirFlowRate && tower.HighSpeedAirFlowRate != DataSizing::AutoSize) { - ShowSevereError( - state, - format("{} \"{}\". Low speed air flow rate must be less than the high speed air flow rate.", cCurrentModuleObject, tower.Name)); + ShowSevereError(state, + format("{} \"{}\". Low speed air flow rate must be less than the high speed air flow rate.", + s_ipsc->cCurrentModuleObject, + tower.Name)); ErrorsFound = true; } // Low speed air flow rate must be greater than free convection air flow rate. @@ -846,7 +786,7 @@ namespace CondenserLoopTowers { if (tower.LowSpeedAirFlowRate <= tower.FreeConvAirFlowRate && tower.LowSpeedAirFlowRate != DataSizing::AutoSize) { ShowSevereError(state, format("{} \"{}\". Free convection air flow rate must be less than the low speed air flow rate.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, tower.Name)); ErrorsFound = true; } @@ -856,21 +796,21 @@ namespace CondenserLoopTowers { if (tower.DesignWaterFlowRate == 0.0) { ShowSevereError(state, format("{} \"{}\". Tower performance input method requires a design water flow rate greater than zero.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, tower.Name)); ErrorsFound = true; } if (tower.HighSpeedTowerUA <= tower.LowSpeedTowerUA && tower.HighSpeedTowerUA != DataSizing::AutoSize) { ShowSevereError(state, format("{} \"{}\". Tower UA at low fan speed must be less than the tower UA at high fan speed.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, tower.Name)); ErrorsFound = true; } if (tower.LowSpeedTowerUA <= tower.FreeConvTowerUA && tower.LowSpeedTowerUA != DataSizing::AutoSize) { ShowSevereError(state, format("{} \"{}\". Tower UA at free convection air flow rate must be less than the tower UA at low fan speed.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, tower.Name)); ErrorsFound = true; } @@ -878,7 +818,7 @@ namespace CondenserLoopTowers { ShowSevereError( state, format("{} \"{}\". Free convection air flow rate must be greater than zero when free convection UA is greater than zero.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, tower.Name)); ErrorsFound = true; } @@ -886,14 +826,14 @@ namespace CondenserLoopTowers { if (tower.TowerNominalCapacity == 0.0) { ShowSevereError(state, format("{} \"{}\". Tower performance input method requires valid high-speed nominal capacity.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, tower.Name)); ErrorsFound = true; } if (tower.TowerLowSpeedNomCap == 0.0) { ShowSevereError(state, format("{} \"{}\". Tower performance input method requires valid low-speed nominal capacity.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, tower.Name)); ErrorsFound = true; } @@ -901,13 +841,13 @@ namespace CondenserLoopTowers { if (tower.DesignWaterFlowRate > 0.0) { ShowWarningError(state, format("{} \"{}\". Nominal capacity input method and design water flow rate have been specified.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, tower.Name)); } else { ShowSevereError( state, format("{} \"{}\". Nominal capacity input method has been specified and design water flow rate is being autosized.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, tower.Name)); } ShowContinueError(state, "Design water flow rate will be set according to nominal tower capacity."); @@ -916,13 +856,13 @@ namespace CondenserLoopTowers { if (tower.HighSpeedTowerUA > 0.0) { ShowWarningError(state, format("{} \"{}\". Nominal capacity input method and tower UA at high fan speed have been specified.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, tower.Name)); } else { ShowSevereError( state, format("{} \"{}\". Nominal capacity input method has been specified and tower UA at high fan speed is being autosized.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, tower.Name)); } ShowContinueError(state, "Tower UA at high fan speed will be set according to nominal tower capacity."); @@ -931,13 +871,13 @@ namespace CondenserLoopTowers { if (tower.LowSpeedTowerUA > 0.0) { ShowWarningError(state, format("{} \"{}\". Nominal capacity input method and tower UA at low fan speed have been specified.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, tower.Name)); } else { ShowSevereError( state, format("{} \"{}\". Nominal capacity input method has been specified and tower UA at low fan speed is being autosized.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, tower.Name)); } ShowContinueError(state, "Tower UA at low fan speed will be set according to nominal tower capacity."); @@ -946,13 +886,13 @@ namespace CondenserLoopTowers { if (tower.FreeConvTowerUA > 0.0) { ShowWarningError(state, format("{} \"{}\". Nominal capacity input method and free convection UA have been specified.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, tower.Name)); } else { ShowSevereError( state, format("{} \"{}\". Nominal capacity input method has been specified and free convection UA is being autosized.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, tower.Name)); } ShowContinueError(state, "Free convection UA will be set according to nominal tower capacity."); @@ -960,7 +900,7 @@ namespace CondenserLoopTowers { if (tower.TowerLowSpeedNomCap >= tower.TowerNominalCapacity) { ShowSevereError(state, format("{} \"{}\". Low-speed nominal capacity must be less than the high-speed nominal capacity.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, tower.Name)); ErrorsFound = true; } @@ -968,29 +908,21 @@ namespace CondenserLoopTowers { if (tower.TowerFreeConvNomCap >= tower.TowerLowSpeedNomCap) { ShowSevereError(state, format("{} \"{}\". Free convection nominal capacity must be less than the low-speed nominal capacity.", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, tower.Name)); ErrorsFound = true; } } if (tower.TowerFreeConvNomCap > 0.0 && tower.FreeConvAirFlowRate == 0.0) { - ShowSevereError( - state, - format("{} \"{}\". Free convection air flow must be greater than zero when tower free convection capacity is specified.", - cCurrentModuleObject, - tower.Name)); + ShowSevereCustom( + state, eoh, "Free convection air flow must be greater than zero when tower free convection capacity is specified."); ErrorsFound = true; } } else { // Tower performance input method is not specified as a valid "choice" - ShowSevereError( - state, - format("{} \"{}{}", - cCurrentModuleObject, - tower.Name, - R"(". Tower Performance Input Method must be "UFactorTimesAreaAndDesignWaterFlowRate" or "NominalCapacity".)")); - ShowContinueError(state, format("Tower Performanace Input Method currently specified as: {}", AlphArray(4))); + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(4), AlphArray(4)); ErrorsFound = true; } + if (NumAlphas > 11) { tower.EndUseSubcategory = AlphArray(12); } else { @@ -998,26 +930,26 @@ namespace CondenserLoopTowers { } } // End Two-Speed Tower Loop - cCurrentModuleObject = cCoolingTower_VariableSpeed; + s_ipsc->cCurrentModuleObject = cCoolingTower_VariableSpeed; for (int VariableSpeedTowerNumber = 1; VariableSpeedTowerNumber <= NumVariableSpeedTowers; ++VariableSpeedTowerNumber) { TowerNum = NumSingleSpeedTowers + NumTwoSpeedTowers + VariableSpeedTowerNumber; - state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, - VariableSpeedTowerNumber, - AlphArray, - NumAlphas, - NumArray, - NumNums, - IOStat, - _, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + VariableSpeedTowerNumber, + AlphArray, + NumAlphas, + NumArray, + NumNums, + IOStat, + _, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, AlphArray(1)}; GlobalNames::VerifyUniqueInterObjectName( - state, UniqueSimpleTowerNames, AlphArray(1), cCurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), ErrorsFound); + state, UniqueSimpleTowerNames, AlphArray(1), s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaFieldNames(1), ErrorsFound); auto &tower = state.dataCondenserLoopTowers->towers(TowerNum); - tower.VSTower = VariableSpeedTowerNumber; tower.Name = AlphArray(1); tower.TowerType = DataPlant::PlantEquipmentType::CoolingTower_VarSpd; tower.WaterInletNodeNum = NodeInputManager::GetOnlySingleNode(state, @@ -1038,44 +970,40 @@ namespace CondenserLoopTowers { DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsNotParent); - BranchNodeConnections::TestCompSet(state, cCurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Chilled Water Nodes"); + BranchNodeConnections::TestCompSet(state, s_ipsc->cCurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Chilled Water Nodes"); if ((Util::SameString(AlphArray(4), "CoolToolsUserDefined") || Util::SameString(AlphArray(4), "YorkCalcUserDefined")) && - state.dataIPShortCut->lAlphaFieldBlanks(5)) { - ShowSevereError(state, - format("{}, \"{}\" a {} must be specified when {} is specified as CoolToolsUserDefined or YorkCalcUserDefined", - cCurrentModuleObject, - tower.Name, - state.dataIPShortCut->cAlphaFieldNames(5), - state.dataIPShortCut->cAlphaFieldNames(4))); + s_ipsc->lAlphaFieldBlanks(5)) { + ShowSevereCustom(state, + eoh, + format("A {} must be specified when {} is specified as CoolToolsUserDefined or YorkCalcUserDefined", + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaFieldNames(4))); ErrorsFound = true; } else if ((Util::SameString(AlphArray(4), "CoolToolsCrossFlow") || Util::SameString(AlphArray(4), "YorkCalc")) && - !state.dataIPShortCut->lAlphaFieldBlanks(5)) { - ShowWarningError(state, - format("{}, \"{}\" a Tower Model Coefficient Name is specified and the Tower Model Type is not specified as " - "CoolToolsUserDefined or YorkCalcUserDefined. The CoolingTowerPerformance:CoolTools " - "(orCoolingTowerPerformance:YorkCalc) data object will not be used.", - cCurrentModuleObject, - tower.Name)); + !s_ipsc->lAlphaFieldBlanks(5)) { + ShowWarningCustom(state, + eoh, + "A Tower Model Coefficient Name is specified and the Tower Model Type is not specified as " + "CoolToolsUserDefined or YorkCalcUserDefined. The CoolingTowerPerformance:CoolTools " + "(orCoolingTowerPerformance:YorkCalc) data object will not be used."); } else { tower.ModelCoeffObjectName = AlphArray(5); } - if (!state.dataIPShortCut->lAlphaFieldBlanks(6)) { + if (!s_ipsc->lAlphaFieldBlanks(6)) { tower.FanPowerfAirFlowCurve = Curve::GetCurveIndex(state, AlphArray(6)); if (tower.FanPowerfAirFlowCurve == 0) { - ShowWarningError( - state, - format( - "{}, \"{}\" the Fan Power Ratio as a function of Air Flow Rate Ratio Curve Name specified as {} was not found. Fan Power " - "as a function of Air Flow Rate Ratio will default to Fan Power = (Air Flow Rate Ratio)^3 and the simulation continues.", - cCurrentModuleObject, - tower.Name, - AlphArray(6))); + ShowWarningCustom(state, + eoh, + format("The Fan Power Ratio as a function of Air Flow Rate Ratio Curve Name specified as {} was not found." + "Fan Power as a function of Air Flow Rate Ratio will default to Fan Power = (Air Flow Rate Ratio)^3." + "The simulation continues.", + AlphArray(6))); } } - auto &vstower = state.dataCondenserLoopTowers->towers(tower.VSTower); + auto &vstower = state.dataCondenserLoopTowers->towers(TowerNum); if (Util::SameString(AlphArray(4), "CoolToolsCrossFlow")) { tower.TowerModelType = ModelType::CoolToolsXFModel; @@ -1174,8 +1102,9 @@ namespace CondenserLoopTowers { tower.TowerModelType = ModelType::CoolToolsUserDefined; // Nested Get-input routines below. Should pull out of here and read in beforehand. for (VSModelCoeffNum = 1; VSModelCoeffNum <= NumVSCoolToolsModelCoeffs; ++VSModelCoeffNum) { - state.dataInputProcessing->inputProcessor->getObjectItem( + s_ip->getObjectItem( state, "CoolingTowerPerformance:CoolTools", VSModelCoeffNum, AlphArray2, NumAlphas2, NumArray2, NumNums2, IOStat); + if (!Util::SameString(AlphArray2(1), tower.ModelCoeffObjectName)) continue; vstower.FoundModelCoeff = true; // verify the correct number of coefficients for the CoolTools model @@ -1215,7 +1144,7 @@ namespace CondenserLoopTowers { tower.TowerModelType = ModelType::YorkCalcUserDefined; // Nested Get-input routines below. Should pull out of here and read in beforehand. for (VSModelCoeffNum = 1; VSModelCoeffNum <= NumVSYorkCalcModelCoeffs; ++VSModelCoeffNum) { - state.dataInputProcessing->inputProcessor->getObjectItem( + s_ip->getObjectItem( state, "CoolingTowerPerformance:YorkCalc", VSModelCoeffNum, AlphArray2, NumAlphas2, NumArray2, NumNums2, IOStat); if (!Util::SameString(AlphArray2(1), tower.ModelCoeffObjectName)) continue; vstower.FoundModelCoeff = true; @@ -1249,15 +1178,13 @@ namespace CondenserLoopTowers { if (!vstower.FoundModelCoeff) { ShowSevereError(state, format("{} \"{}\". User defined name for variable speed cooling tower model coefficients object not found = {}", - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, tower.Name, tower.ModelCoeffObjectName)); ErrorsFound = true; } } else { - ShowSevereError(state, format("{} \"{}\". Illegal Tower Model Type = {}", cCurrentModuleObject, tower.Name, AlphArray(5))); - ShowContinueError(state, - R"( Tower Model Type must be "CoolToolsCrossFlow", "YorkCalc", "CoolToolsUserDefined", or "YorkCalcUserDefined.)"); + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(5), AlphArray(5)); ErrorsFound = true; } @@ -1265,83 +1192,65 @@ namespace CondenserLoopTowers { // check user defined minimums to be greater than 0 if (vstower.MinApproachTemp < 0.0) { - ShowSevereError(state, format("{} \"{}\". User defined minimum approach temperature must be > 0", cCurrentModuleObject, tower.Name)); + ShowSevereCustom(state, eoh, "User defined minimum approach temperature must be > 0"); ErrorsFound = true; } if (vstower.MinRangeTemp < 0.0) { - ShowSevereError(state, format("{} \"{}\". User defined minimum range temperature must be > 0", cCurrentModuleObject, tower.Name)); + ShowSevereCustom(state, eoh, "User defined minimum range temperature must be > 0"); ErrorsFound = true; } if (vstower.MinWaterFlowRatio < 0.0) { - ShowSevereError(state, format("{} \"{}\". User defined minimum water flow rate ratio must be > 0", cCurrentModuleObject, tower.Name)); + ShowSevereCustom(state, eoh, "User defined minimum water flow rate ratio must be > 0"); ErrorsFound = true; } // check that the user defined maximums are greater than the minimums if (vstower.MaxApproachTemp < vstower.MinApproachTemp) { - ShowSevereError(state, - format("{} \"{}\". User defined maximum approach temperature must be > the minimum approach temperature", - cCurrentModuleObject, - tower.Name)); + ShowSevereCustom(state, eoh, "User defined maximum approach temperature must be > the minimum approach temperature"); ErrorsFound = true; } if (vstower.MaxRangeTemp < vstower.MinRangeTemp) { - ShowSevereError(state, - format("{} \"{}\". User defined maximum range temperature must be > the minimum range temperature", - cCurrentModuleObject, - tower.Name)); + ShowSevereCustom(state, eoh, "User defined maximum range temperature must be > the minimum range temperature"); ErrorsFound = true; } if (vstower.MaxWaterFlowRatio < vstower.MinWaterFlowRatio) { - ShowSevereError(state, - format("{} \"{}\". User defined maximum water flow rate ratio must be > the minimum water flow rate ratio", - cCurrentModuleObject, - tower.Name)); + ShowSevereCustom(state, eoh, "User defined maximum water flow rate ratio must be > the minimum water flow rate ratio"); ErrorsFound = true; } tower.DesignInletWB = NumArray(1); if (NumArray(1) < vstower.MinInletAirWBTemp || NumArray(1) > vstower.MaxInletAirWBTemp) { - ShowSevereError(state, - cCurrentModuleObject.append(", \"") - .append(tower.Name) - .append("\" the design inlet air wet-bulb temperature of ") - .append(format(OutputFormat, tower.DesignInletWB)) - .append(" must be within the model limits of ") - .append(format(OutputFormat, vstower.MinInletAirWBTemp)) - .append(" and ") - .append(format(OutputFormat, vstower.MaxInletAirWBTemp)) - .append(" degrees C")); + ShowSevereCustom(state, + eoh, + format("The design inlet air wet-bulb temperature of {:5.2F}" + "must be within the model limits of {:5.2F} and {:5.2F} degrees C", + tower.DesignInletWB, + vstower.MinInletAirWBTemp, + vstower.MaxInletAirWBTemp)); ErrorsFound = true; } tower.DesignApproach = NumArray(2); if (NumArray(2) < vstower.MinApproachTemp || NumArray(2) > vstower.MaxApproachTemp) { - ShowSevereError(state, - cCurrentModuleObject.append(", \"") - .append(tower.Name) - .append("\" the design approach temperature of ") - .append(format(OutputFormat, tower.DesignApproach)) - .append(" must be within the model limits of ") - .append(format(OutputFormat, vstower.MinApproachTemp)) - .append(" and ") - .append(format(OutputFormat, vstower.MaxApproachTemp)) - .append(" degrees C")); + ShowSevereCustom(state, + eoh, + format("The design approach temperature of {:5.2F}" + "must be within the model limits of {:5.2F} and {:5.2F} degrees C", + tower.DesignApproach, + vstower.MinApproachTemp, + vstower.MaxApproachTemp)); ErrorsFound = true; } tower.DesignRange = NumArray(3); if (NumArray(3) < vstower.MinRangeTemp || NumArray(3) > vstower.MaxRangeTemp) { - ShowSevereError(state, - cCurrentModuleObject.append(", \"") - .append(tower.Name) - .append("\" the design range temperature of ") - .append(format(OutputFormat, tower.DesignRange)) - .append(" must be within the model limits of ") - .append(format(OutputFormat, vstower.MinRangeTemp)) - .append(" and ") - .append(format(OutputFormat, vstower.MaxRangeTemp)) - .append(" degrees C")); + ShowSevereCustom(state, + eoh, + format("The design range temperature of {:5.2F}" + "must be within the model limits of {:5.2F} and {:5.2F} degrees C", + tower.DesignRange, + vstower.MinRangeTemp, + vstower.MaxRangeTemp)); ErrorsFound = true; } @@ -1350,7 +1259,7 @@ namespace CondenserLoopTowers { tower.DesignWaterFlowRateWasAutoSized = true; } if (NumArray(4) <= 0.0 && NumArray(4) != DataSizing::AutoSize) { - ShowSevereError(state, format("{}, \"{}\" design water flow rate must be > 0", cCurrentModuleObject, tower.Name)); + ShowSevereCustom(state, eoh, "Design water flow rate must be > 0"); ErrorsFound = true; } @@ -1359,7 +1268,7 @@ namespace CondenserLoopTowers { tower.HighSpeedAirFlowRateWasAutoSized = true; } if (NumArray(5) <= 0.0 && NumArray(5) != DataSizing::AutoSize) { - ShowSevereError(state, format("{}, \"{}\" design air flow rate must be > 0", cCurrentModuleObject, tower.Name)); + ShowSevereCustom(state, eoh, "Design air flow rate must be > 0"); ErrorsFound = true; } @@ -1368,7 +1277,7 @@ namespace CondenserLoopTowers { tower.HighSpeedFanPowerWasAutoSized = true; } if (NumArray(6) <= 0.0 && NumArray(6) != DataSizing::AutoSize) { - ShowSevereError(state, format("{}, \"{}\" design fan power must be > 0", cCurrentModuleObject, tower.Name)); + ShowSevereCustom(state, eoh, "Design fan power must be > 0"); ErrorsFound = true; } @@ -1376,27 +1285,21 @@ namespace CondenserLoopTowers { tower.MinimumVSAirFlowFrac = NumArray(7); tower.MinimumVSAirFlowFrac = NumArray(7); if (NumArray(7) < 0.2 || NumArray(7) > 0.5) { - ShowSevereError(state, - format("{}, \"{}\" minimum VS air flow rate ratio must be >= 0.2 and <= 0.5", cCurrentModuleObject, tower.Name)); + ShowSevereCustom(state, eoh, "Minimum VS air flow rate ratio must be >= 0.2 and <= 0.5"); ErrorsFound = true; } // fraction of tower capacity in free convection regime must be >= to 0 and <= 0.2 tower.FreeConvectionCapacityFraction = NumArray(8); if (NumArray(8) < 0.0 || NumArray(8) > 0.2) { - ShowSevereError(state, - format("{}, \"{}\" fraction of tower capacity in free convection regime must be >= 0 and <= 0.2", - cCurrentModuleObject, - tower.Name)); + ShowSevereCustom(state, eoh, "Fraction of tower capacity in free convection regime must be >= 0 and <= 0.2"); ErrorsFound = true; } // Basin heater power as a function of temperature must be greater than or equal to 0 tower.BasinHeaterPowerFTempDiff = NumArray(9); if (NumArray(9) < 0.0) { - ShowSevereError( - state, - format("{}, \"{}\" basin heater power as a function of temperature difference must be >= 0", cCurrentModuleObject, tower.Name)); + ShowSevereCustom(state, eoh, "Basin heater power as a function of temperature difference must be >= 0"); ErrorsFound = true; } @@ -1406,11 +1309,7 @@ namespace CondenserLoopTowers { tower.BasinHeaterSetPointTemp = 2.0; } if (tower.BasinHeaterSetPointTemp < 2.0) { - ShowWarningError(state, - format("{}:\"{}\", {} is less than 2 deg C. Freezing could occur.", - cCurrentModuleObject, - tower.Name, - state.dataIPShortCut->cNumericFieldNames(10))); + ShowWarningCustom(state, eoh, format("{} is less than 2 deg C. Freezing could occur.", s_ipsc->cNumericFieldNames(10))); } } @@ -1419,14 +1318,12 @@ namespace CondenserLoopTowers { tower.PerformanceInputMethod_Num = PIM::UFactor; if (!AlphArray(7).empty()) { - tower.BasinHeaterSchedulePtr = ScheduleManager::GetScheduleIndex(state, AlphArray(7)); - if (tower.BasinHeaterSchedulePtr == 0) { - ShowWarningError(state, - format("{}, \"{}\" basin heater schedule name \"{}\" was not found. Basin heater operation will not be modeled " - "and the simulation continues", - cCurrentModuleObject, - tower.Name, - AlphArray(7))); + if ((tower.basinHeaterSched = Sched::GetSchedule(state, AlphArray(7))) == nullptr) { + ShowWarningItemNotFound(state, + eoh, + s_ipsc->cAlphaFieldNames(7), + AlphArray(7), + "Basin heater operation will not be modeled and the simulation continues."); } } @@ -1439,11 +1336,11 @@ namespace CondenserLoopTowers { if (tower.SizFac <= 0.0) tower.SizFac = 1.0; tower.BlowdownMode = static_cast(getEnumValue(BlowDownNamesUC, Util::makeUPPER(AlphArray(9)))); - tower.SchedIDBlowdown = ScheduleManager::GetScheduleIndex(state, AlphArray(10)); - if ((tower.SchedIDBlowdown == 0) && (tower.BlowdownMode == Blowdown::Schedule)) { - ShowSevereError(state, format("Invalid, {} = \"{}\"", state.dataIPShortCut->cAlphaFieldNames(10), AlphArray(10))); - ShowContinueError(state, format("Entered in {} = \"{}\"", cCoolingTower_VariableSpeed, tower.Name)); - ErrorsFound = true; + if (tower.BlowdownMode == Blowdown::Schedule) { + if ((tower.blowdownSched = Sched::GetSchedule(state, AlphArray(10))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(10), AlphArray(10)); + ErrorsFound = true; + } } // added for multi-cell @@ -1464,20 +1361,20 @@ namespace CondenserLoopTowers { } // cell control for variable speed tower - if (!state.dataIPShortCut->lAlphaFieldBlanks(13)) { + if (!s_ipsc->lAlphaFieldBlanks(13)) { tower.cellCtrl = static_cast(getEnumValue(CellCtrlNamesUC, Util::makeUPPER(AlphArray(13)))); } - if (state.dataIPShortCut->lAlphaFieldBlanks(11)) { + if (s_ipsc->lAlphaFieldBlanks(11)) { tower.SuppliedByWaterSystem = false; } else { // water from storage tank WaterManager::SetupTankDemandComponent( - state, AlphArray(1), cCurrentModuleObject, AlphArray(11), ErrorsFound, tower.WaterTankID, tower.WaterTankDemandARRID); + state, AlphArray(1), s_ipsc->cCurrentModuleObject, AlphArray(11), ErrorsFound, tower.WaterTankID, tower.WaterTankDemandARRID); tower.SuppliedByWaterSystem = true; } // outdoor air inlet node - if (state.dataIPShortCut->lAlphaFieldBlanks(12)) { + if (s_ipsc->lAlphaFieldBlanks(12)) { tower.OutdoorAirInletNodeNum = 0; } else { tower.OutdoorAirInletNodeNum = NodeInputManager::GetOnlySingleNode(state, @@ -1490,12 +1387,7 @@ namespace CondenserLoopTowers { NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsNotParent); if (!OutAirNodeManager::CheckOutAirNodeNumber(state, tower.OutdoorAirInletNodeNum)) { - ShowSevereError(state, - format("{}, \"{}\" Outdoor Air Inlet Node Name not valid Outdoor Air Node= {}", - cCurrentModuleObject, - tower.Name, - AlphArray(12))); - ShowContinueError(state, "...does not appear in an OutdoorAir:NodeList or as an OutdoorAir:Node."); + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(12), AlphArray(12)); ErrorsFound = true; } } @@ -1507,23 +1399,25 @@ namespace CondenserLoopTowers { } // End Variable-Speed Tower Loop - cCurrentModuleObject = cCoolingTower_VariableSpeedMerkel; + s_ipsc->cCurrentModuleObject = cCoolingTower_VariableSpeedMerkel; for (int MerkelVSTowerNum = 1; MerkelVSTowerNum <= NumVSMerkelTowers; ++MerkelVSTowerNum) { TowerNum = NumSingleSpeedTowers + NumTwoSpeedTowers + NumVariableSpeedTowers + MerkelVSTowerNum; - state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, - MerkelVSTowerNum, - AlphArray, - NumAlphas, - NumArray, - NumNums, - IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + MerkelVSTowerNum, + AlphArray, + NumAlphas, + NumArray, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, AlphArray(1)}; GlobalNames::VerifyUniqueInterObjectName( - state, UniqueSimpleTowerNames, AlphArray(1), cCurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), ErrorsFound); + state, UniqueSimpleTowerNames, AlphArray(1), s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaFieldNames(1), ErrorsFound); auto &tower = state.dataCondenserLoopTowers->towers(TowerNum); tower.Name = AlphArray(1); tower.TowerType = DataPlant::PlantEquipmentType::CoolingTower_VarSpdMerkel; @@ -1545,23 +1439,20 @@ namespace CondenserLoopTowers { DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsNotParent); - BranchNodeConnections::TestCompSet(state, cCurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Chilled Water Nodes"); + BranchNodeConnections::TestCompSet(state, s_ipsc->cCurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Chilled Water Nodes"); if (Util::SameString(AlphArray(4), "UFactorTimesAreaAndDesignWaterFlowRate")) { tower.PerformanceInputMethod_Num = PIM::UFactor; } else if (Util::SameString(AlphArray(4), "NominalCapacity")) { tower.PerformanceInputMethod_Num = PIM::NominalCapacity; } else { - ShowSevereError(state, format("{}={}", cCurrentModuleObject, AlphArray(1))); - ShowContinueError(state, format("Invalid, {} = {}", state.dataIPShortCut->cAlphaFieldNames(4), AlphArray(4))); + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(4), AlphArray(4)); ErrorsFound = true; } tower.FanPowerfAirFlowCurve = Curve::GetCurveIndex(state, AlphArray(5)); if (tower.FanPowerfAirFlowCurve == 0) { - ShowSevereError(state, format("{}={}", cCurrentModuleObject, AlphArray(1))); - ShowContinueError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(5), AlphArray(5))); - ShowContinueError(state, "Curve name not found."); + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(5), AlphArray(5)); ErrorsFound = true; } @@ -1584,7 +1475,7 @@ namespace CondenserLoopTowers { if (tower.HighSpeedAirFlowRate == DataSizing::AutoSize) { tower.HighSpeedAirFlowRateWasAutoSized = true; } - tower.DefaultedDesignAirFlowScalingFactor = state.dataIPShortCut->lNumericFieldBlanks(8); + tower.DefaultedDesignAirFlowScalingFactor = s_ipsc->lNumericFieldBlanks(8); tower.DesignAirFlowPerUnitNomCap = NumArray(8); tower.MinimumVSAirFlowFrac = NumArray(9); tower.HighSpeedFanPower = NumArray(10); @@ -1609,25 +1500,19 @@ namespace CondenserLoopTowers { tower.UAModFuncAirFlowRatioCurvePtr = Curve::GetCurveIndex(state, AlphArray(6)); if (tower.UAModFuncAirFlowRatioCurvePtr == 0) { - ShowSevereError(state, format("{}={}", cCurrentModuleObject, AlphArray(1))); - ShowContinueError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(6), AlphArray(6))); - ShowContinueError(state, "Curve name not found."); + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(6), AlphArray(6)); ErrorsFound = true; } tower.UAModFuncWetBulbDiffCurvePtr = Curve::GetCurveIndex(state, AlphArray(7)); if (tower.UAModFuncWetBulbDiffCurvePtr == 0) { - ShowSevereError(state, format("{}={}", cCurrentModuleObject, AlphArray(1))); - ShowContinueError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(7), AlphArray(7))); - ShowContinueError(state, "Curve name not found."); + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(7), AlphArray(7)); ErrorsFound = true; } tower.UAModFuncWaterFlowRatioCurvePtr = Curve::GetCurveIndex(state, AlphArray(8)); if (tower.UAModFuncWaterFlowRatioCurvePtr == 0) { - ShowSevereError(state, format("{}={}", cCurrentModuleObject, AlphArray(1))); - ShowContinueError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(8), AlphArray(8))); - ShowContinueError(state, "Curve name not found."); + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(8), AlphArray(8)); ErrorsFound = true; } // cooling tower design inlet conditions @@ -1657,9 +1542,7 @@ namespace CondenserLoopTowers { // Basin heater power as a function of temperature must be greater than or equal to 0 tower.BasinHeaterPowerFTempDiff = NumArray(21); if (NumArray(21) < 0.0) { - ShowSevereError( - state, - format("{}, \"{}\" basin heater power as a function of temperature difference must be >= 0", cCurrentModuleObject, tower.Name)); + ShowSevereCustom(state, eoh, "Basin heater power as a function of temperature difference must be >= 0"); ErrorsFound = true; } @@ -1669,23 +1552,17 @@ namespace CondenserLoopTowers { tower.BasinHeaterSetPointTemp = 2.0; } if (tower.BasinHeaterSetPointTemp < 2.0) { - ShowWarningError(state, - format("{}:\"{}\", {} is less than 2 deg C. Freezing could occur.", - cCurrentModuleObject, - tower.Name, - state.dataIPShortCut->cNumericFieldNames(22))); + ShowWarningCustom(state, eoh, format("{} is less than 2 deg C. Freezing could occur.", s_ipsc->cNumericFieldNames(22))); } } if (!AlphArray(9).empty()) { - tower.BasinHeaterSchedulePtr = ScheduleManager::GetScheduleIndex(state, AlphArray(9)); - if (tower.BasinHeaterSchedulePtr == 0) { - ShowWarningError(state, - format("{}, \"{}\" basin heater schedule name \"{}\" was not found. Basin heater operation will not be modeled " - "and the simulation continues", - cCurrentModuleObject, - tower.Name, - AlphArray(9))); + if ((tower.basinHeaterSched = Sched::GetSchedule(state, AlphArray(9))) == nullptr) { + ShowWarningItemNotFound(state, + eoh, + s_ipsc->cAlphaFieldNames(9), + AlphArray(9), + "Basin heater operation will not be modeled and the simulation continues"); } } @@ -1698,11 +1575,11 @@ namespace CondenserLoopTowers { if (tower.SizFac <= 0.0) tower.SizFac = 1.0; tower.BlowdownMode = static_cast(getEnumValue(BlowDownNamesUC, Util::makeUPPER(AlphArray(11)))); - tower.SchedIDBlowdown = ScheduleManager::GetScheduleIndex(state, AlphArray(12)); - if ((tower.SchedIDBlowdown == 0) && (tower.BlowdownMode == Blowdown::Schedule)) { - ShowSevereError(state, format("Invalid, {} = \"{}\"", state.dataIPShortCut->cAlphaFieldNames(12), AlphArray(12))); - ShowContinueError(state, format("Entered in {} = \"{}\"", cCoolingTower_VariableSpeedMerkel, tower.Name)); - ErrorsFound = true; + if (tower.BlowdownMode == Blowdown::Schedule) { + if ((tower.blowdownSched = Sched::GetSchedule(state, AlphArray(12))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(12), AlphArray(12)); + ErrorsFound = true; + } } // added for multi-cell @@ -1723,20 +1600,20 @@ namespace CondenserLoopTowers { } tower.TowerMassFlowRateMultiplier = tower.MaxFracFlowRate; // cell control for variable speed Merkel tower - if (!state.dataIPShortCut->lAlphaFieldBlanks(15)) { + if (!s_ipsc->lAlphaFieldBlanks(15)) { tower.cellCtrl = static_cast(getEnumValue(CellCtrlNamesUC, Util::makeUPPER(AlphArray(15)))); } - if (state.dataIPShortCut->lAlphaFieldBlanks(13)) { + if (s_ipsc->lAlphaFieldBlanks(13)) { tower.SuppliedByWaterSystem = false; } else { // water from storage tank WaterManager::SetupTankDemandComponent( - state, AlphArray(1), cCurrentModuleObject, AlphArray(13), ErrorsFound, tower.WaterTankID, tower.WaterTankDemandARRID); + state, AlphArray(1), s_ipsc->cCurrentModuleObject, AlphArray(13), ErrorsFound, tower.WaterTankID, tower.WaterTankDemandARRID); tower.SuppliedByWaterSystem = true; } // outdoor air inlet node - if (state.dataIPShortCut->lAlphaFieldBlanks(14)) { + if (s_ipsc->lAlphaFieldBlanks(14)) { tower.OutdoorAirInletNodeNum = 0; } else { tower.OutdoorAirInletNodeNum = @@ -1750,12 +1627,7 @@ namespace CondenserLoopTowers { NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsNotParent); if (!OutAirNodeManager::CheckOutAirNodeNumber(state, tower.OutdoorAirInletNodeNum)) { - ShowSevereError(state, - format("{}, \"{}\" Outdoor Air Inlet Node Name not valid Outdoor Air Node= {}", - cCurrentModuleObject, - tower.Name, - AlphArray(14))); - ShowContinueError(state, "...does not appear in an OutdoorAir:NodeList or as an OutdoorAir:Node."); + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(14), AlphArray(14)); ErrorsFound = true; } } @@ -1789,11 +1661,7 @@ namespace CondenserLoopTowers { void CoolingTower::initEachEnvironment(EnergyPlusData &state) { static constexpr std::string_view RoutineName("CoolingTower::initEachEnvironment"); - Real64 const rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 const rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); this->DesWaterMassFlowRate = this->DesignWaterFlowRate * rho; this->DesWaterMassFlowRatePerCell = this->DesWaterMassFlowRate / this->NumCell; PlantUtilities::InitComponentNodes(state, 0.0, this->DesWaterMassFlowRate, this->WaterInletNodeNum, this->WaterOutletNodeNum); @@ -2398,7 +2266,7 @@ namespace CondenserLoopTowers { Real64 DesTowerExitWaterTemp; // design tower exit water temperature Real64 DesTowerWaterDeltaT; // design tower temperature range Real64 DesTowerApproachFromPlant; // design tower approach temperature from plant sizing object - Real64 TolTemp(0.04); // DeltaT and DesApproach diffs tollerance between plant sizing data and user input in cooling tower + Real64 TolTemp(0.04); // DeltaT and DesApproach diffs tolerance between plant sizing data and user input in cooling tower // for warning message reporting purpose only Real64 tmpDesignWaterFlowRate = this->DesignWaterFlowRate; @@ -2481,16 +2349,9 @@ namespace CondenserLoopTowers { if (this->PerformanceInputMethod_Num == PIM::UFactor && (!this->HighSpeedTowerUAWasAutoSized)) { if (PltSizCondNum > 0) { - Real64 const rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - DesTowerExitWaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); - Real64 const Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - DesTowerExitWaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 const rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, DesTowerExitWaterTemp, RoutineName); + Real64 const Cp = + state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, DesTowerExitWaterTemp, RoutineName); DesTowerLoad = rho * Cp * this->DesignWaterFlowRate * DesTowerWaterDeltaT; this->TowerNominalCapacity = DesTowerLoad / this->HeatRejectCapNomCapSizingRatio; @@ -2498,16 +2359,8 @@ namespace CondenserLoopTowers { Real64 AssumedDeltaT = DesTowerWaterDeltaT; Real64 AssumedExitTemp = DesTowerExitWaterTemp; - Real64 const rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - AssumedExitTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); - Real64 const Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - AssumedExitTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 const rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, AssumedExitTemp, RoutineName); + Real64 const Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, AssumedExitTemp, RoutineName); DesTowerLoad = rho * Cp * this->DesignWaterFlowRate * AssumedDeltaT; this->TowerNominalCapacity = DesTowerLoad / this->HeatRejectCapNomCapSizingRatio; @@ -2592,16 +2445,10 @@ namespace CondenserLoopTowers { } else { if (PltSizCondNum > 0) { if (PlantSizData(PltSizCondNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { - Real64 const rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); - Real64 const Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - DesTowerExitWaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 const rho = + state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); + Real64 const Cp = + state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, DesTowerExitWaterTemp, RoutineName); DesTowerLoad = rho * Cp * tmpDesignWaterFlowRate * DesTowerWaterDeltaT; tmpHighSpeedFanPower = 0.0105 * DesTowerLoad; if (state.dataPlnt->PlantFirstSizesOkayToFinalize) this->HighSpeedFanPower = tmpHighSpeedFanPower; @@ -2692,16 +2539,10 @@ namespace CondenserLoopTowers { if (this->HighSpeedTowerUAWasAutoSized) { if (PltSizCondNum > 0) { if (PlantSizData(PltSizCondNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { - Real64 const rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); - Real64 const Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - DesTowerExitWaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 const rho = + state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); + Real64 const Cp = + state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, DesTowerExitWaterTemp, RoutineName); DesTowerLoad = rho * Cp * tmpDesignWaterFlowRate * DesTowerWaterDeltaT; // This conditional statement is to trap when the user specified condenser/tower water design setpoint // temperature is less than design inlet air wet bulb temperature @@ -2791,16 +2632,10 @@ namespace CondenserLoopTowers { } else { if (this->DesignWaterFlowRate >= HVAC::SmallWaterVolFlow) { - Real64 const rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); - Real64 const Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - DesTowerExitWaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 const rho = + state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); + Real64 const Cp = + state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, DesTowerExitWaterTemp, RoutineName); DesTowerLoad = rho * Cp * tmpDesignWaterFlowRate * DesTowerWaterDeltaT; // This conditional statement is to trap when the user specified condenser/tower water design setpoint // temperature is less than design inlet air wet bulb temperature @@ -2911,16 +2746,14 @@ namespace CondenserLoopTowers { if (this->DesignWaterFlowRate >= HVAC::SmallWaterVolFlow) { // nominal capacity doesn't include compressor heat; predefined factor was 1.25 W heat rejection per W of delivered cooling but now is // a user input - Real64 const rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - 29.44, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); // 85F design exiting water temp - Real64 const Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - 29.44, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); // 85F design exiting water temp + Real64 const rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getDensity(state, + 29.44, + RoutineName); // 85F design exiting water temp + Real64 const Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getSpecificHeat(state, + 29.44, + RoutineName); // 85F design exiting water temp DesTowerLoad = this->TowerNominalCapacity * this->HeatRejectCapNomCapSizingRatio; Real64 const solveWaterFlowRate = rho * tmpDesignWaterFlowRate; // design water mass flow rate @@ -3094,16 +2927,14 @@ namespace CondenserLoopTowers { // nominal capacity doesn't include compressor heat; predefined factor was 1.25 W heat rejection per W of evap cooling but now is a // user input - Real64 const rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - 29.44, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); // 85F design exiting water temp - Real64 const Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - 29.44, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); // 85F design exiting water temp + Real64 const rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getDensity(state, + 29.44, + RoutineName); // 85F design exiting water temp + Real64 const Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getSpecificHeat(state, + 29.44, + RoutineName); // 85F design exiting water temp DesTowerLoad = this->TowerLowSpeedNomCap * this->HeatRejectCapNomCapSizingRatio; Real64 const solveWaterFlow = rho * tmpDesignWaterFlowRate; // design water mass flow rate UA0 = 0.0001 * DesTowerLoad; // Assume deltaT = 10000K (limit) @@ -3193,16 +3024,14 @@ namespace CondenserLoopTowers { if (this->DesignWaterFlowRate >= HVAC::SmallWaterVolFlow && this->TowerFreeConvNomCap > 0.0) { // nominal capacity doesn't include compressor heat; predefined factor was 1.25 W heat rejection per W of evap cooling but now user // input - Real64 const rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - 29.44, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); // 85F design exiting water temp - Real64 const Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - 29.44, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); // 85F design exiting water temp + Real64 const rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getDensity(state, + 29.44, + RoutineName); // 85F design exiting water temp + Real64 const Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getSpecificHeat(state, + 29.44, + RoutineName); // 85F design exiting water temp DesTowerLoad = this->TowerFreeConvNomCap * this->HeatRejectCapNomCapSizingRatio; Real64 const solveWaterFlow = rho * this->DesignWaterFlowRate; // design water mass flow rate UA0 = 0.0001 * DesTowerLoad; // Assume deltaT = 10000K (limit) @@ -3275,12 +3104,9 @@ namespace CondenserLoopTowers { // check range for water flow rate ratio (make sure RegulaFalsi converges) Real64 MaxWaterFlowRateRatio = 0.5; // maximum water flow rate ratio which yields desired approach temp Real64 Tapproach = 0.0; // temporary tower approach temp variable [C] - Real64 const FlowRateRatioStep = (state.dataCondenserLoopTowers->towers(this->VSTower).MaxWaterFlowRatio - - state.dataCondenserLoopTowers->towers(this->VSTower).MinWaterFlowRatio) / - 10.0; + Real64 const FlowRateRatioStep = (this->MaxWaterFlowRatio - this->MinWaterFlowRatio) / 10.0; bool ModelCalibrated = true; - Real64 ModelWaterFlowRatioMax = state.dataCondenserLoopTowers->towers(this->VSTower).MaxWaterFlowRatio * - 4.0; // maximum water flow rate ratio used for model calibration + Real64 ModelWaterFlowRatioMax = this->MaxWaterFlowRatio * 4.0; // maximum water flow rate ratio used for model calibration // find a flow rate large enough to provide an approach temperature > than the user defined approach Real64 WaterFlowRateRatio(0.0); // tower water flow rate ratio while (Tapproach < this->DesignApproach && MaxWaterFlowRateRatio <= ModelWaterFlowRatioMax) { @@ -3331,27 +3157,20 @@ namespace CondenserLoopTowers { this->CalibratedWaterFlowRate = this->DesignWaterFlowRate / WaterFlowRatio; - if (WaterFlowRatio < state.dataCondenserLoopTowers->towers(this->VSTower).MinWaterFlowRatio || - WaterFlowRatio > state.dataCondenserLoopTowers->towers(this->VSTower).MaxWaterFlowRatio) { + if (WaterFlowRatio < this->MinWaterFlowRatio || WaterFlowRatio > this->MaxWaterFlowRatio) { ShowWarningError(state, format("CoolingTower:VariableSpeed, \"{}\" the calibrated water flow rate ratio is determined to be {:9.6F}. This " "is outside the valid range of {:.2F} to {:.2F}.", this->Name, WaterFlowRatio, - state.dataCondenserLoopTowers->towers(this->VSTower).MinWaterFlowRatio, - state.dataCondenserLoopTowers->towers(this->VSTower).MaxWaterFlowRatio)); + this->MinWaterFlowRatio, + this->MaxWaterFlowRatio)); } - Real64 const rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - (this->DesignInletWB + this->DesignApproach + this->DesignRange), - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); - Real64 const Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - (this->DesignInletWB + this->DesignApproach + this->DesignRange), - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 const rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getDensity(state, (this->DesignInletWB + this->DesignApproach + this->DesignRange), RoutineName); + Real64 const Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getSpecificHeat(state, (this->DesignInletWB + this->DesignApproach + this->DesignRange), RoutineName); this->TowerNominalCapacity = ((rho * tmpDesignWaterFlowRate) * Cp * this->DesignRange); if (state.dataPlnt->PlantFinalSizesOkayToReport) { @@ -3425,11 +3244,11 @@ namespace CondenserLoopTowers { state, state.dataOutRptPredefined->pdchCTFCFluidType, this->Name, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName); // Fluid Name more reasonable than FluidType + state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->Name); // Fluid Name more reasonable than FluidType OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCTFCRange, this->Name, this->DesignRange); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCTFCApproach, this->Name, this->DesignApproach); OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchCTFCDesFanPwr, this->Name, this->HighSpeedFanPower); // eqival to Design Fan Power? + state, state.dataOutRptPredefined->pdchCTFCDesFanPwr, this->Name, this->HighSpeedFanPower); // equivalent to Design Fan Power? OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCTFCDesInletAirWBT, this->Name, this->DesInletAirWBTemp); OutputReportPredefined::PreDefTableEntry( state, state.dataOutRptPredefined->pdchCTFCDesWaterFlowRate, this->Name, this->DesignWaterFlowRate); @@ -3518,7 +3337,7 @@ namespace CondenserLoopTowers { Real64 DesTowerExitWaterTemp; // design tower exit water temperature Real64 DesTowerWaterDeltaT; // design tower temperature range Real64 DesTowerApproachFromPlant; // design tower approach temperature from plant sizing object - Real64 TolTemp(0.04); // DeltaT and DesApproach diffs tollerance between plant sizing data and user input in cooling tower + Real64 TolTemp(0.04); // DeltaT and DesApproach diffs tolerance between plant sizing data and user input in cooling tower // for warning message reporting purpose only // Find the appropriate Plant Sizing object @@ -3563,9 +3382,9 @@ namespace CondenserLoopTowers { format("is inconsistent with Design Loop Delta Temperature specified in Sizing:Plant object = {}.", PlantSizData(PltSizCondNum).PlantLoopName)); ShowContinueError(state, format("..The Design Range Temperature specified in tower is = {:.2T}", this->DesRange)); - ShowContinueError(state, - format("..The Design Loop Delta Temperature specified iin plant sizing data is = {:.2T}", - PlantSizData(PltSizCondNum).DeltaT)); + ShowContinueError( + state, + format("..The Design Loop Delta Temperature specified in plant sizing data is = {:.2T}", PlantSizData(PltSizCondNum).DeltaT)); } // check if the tower approach is different from plant sizing data DesTowerApproachFromPlant = PlantSizData(PltSizCondNum).ExitTemp - this->DesInletAirWBTemp; @@ -3589,16 +3408,8 @@ namespace CondenserLoopTowers { if (PltSizCondNum > 0) { // get nominal capacity from PlantSizData(PltSizCondNum)%DeltaT and PlantSizData(PltSizCondNum)%DesVolFlowRate if (PlantSizData(PltSizCondNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - DesTowerExitWaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - DesTowerExitWaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, DesTowerExitWaterTemp, RoutineName); + Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, DesTowerExitWaterTemp, RoutineName); DesTowerLoad = rho * Cp * PlantSizData(PltSizCondNum).DesVolFlowRate * DesTowerWaterDeltaT * this->SizFac; tmpNomTowerCap = DesTowerLoad / this->HeatRejectCapNomCapSizingRatio; } else { @@ -3607,16 +3418,8 @@ namespace CondenserLoopTowers { } else { // PltSizCondNum = 0 if (!this->TowerInletCondsAutoSize) { // can use design data entered into tower object if (this->DesignWaterFlowRate >= HVAC::SmallWaterVolFlow) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - DesTowerExitWaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - DesTowerExitWaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, DesTowerExitWaterTemp, RoutineName); + Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, DesTowerExitWaterTemp, RoutineName); DesTowerLoad = rho * Cp * this->DesignWaterFlowRate * DesTowerWaterDeltaT * this->SizFac; tmpNomTowerCap = DesTowerLoad / this->HeatRejectCapNomCapSizingRatio; } else { @@ -3867,28 +3670,16 @@ namespace CondenserLoopTowers { } } - // now calcuate UA values from nominal capacities and flow rates + // now calculate UA values from nominal capacities and flow rates if (state.dataPlnt->PlantFirstSizesOkayToFinalize) { if (PltSizCondNum > 0) { // user has a plant sizing object - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - DesTowerExitWaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, DesTowerExitWaterTemp, RoutineName); this->WaterTemp = DesTowerInletWaterTemp; } else { // probably no plant sizing object - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, Constant::InitConvTemp, RoutineName); this->WaterTemp = DesTowerInletWaterTemp; // 35.0; // design condition } - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); // full speed fan tower UA Real64 const solveLoad = tmpNomTowerCap * this->HeatRejectCapNomCapSizingRatio; @@ -4033,16 +3824,8 @@ namespace CondenserLoopTowers { // get nominal capacity from PlantSizData(PltSizCondNum)%DeltaT and PlantSizData(PltSizCondNum)%DesVolFlowRate if (PltSizCondNum > 0) { if (PlantSizData(PltSizCondNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - DesTowerExitWaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - DesTowerExitWaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, DesTowerExitWaterTemp, RoutineName); + Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, DesTowerExitWaterTemp, RoutineName); DesTowerLoad = rho * Cp * PlantSizData(PltSizCondNum).DesVolFlowRate * DesTowerWaterDeltaT * this->SizFac; tmpNomTowerCap = DesTowerLoad / this->HeatRejectCapNomCapSizingRatio; if (state.dataPlnt->PlantFirstSizesOkayToFinalize) { @@ -4085,16 +3868,8 @@ namespace CondenserLoopTowers { } else { if (!this->TowerInletCondsAutoSize) { if (this->DesignWaterFlowRate >= HVAC::SmallWaterVolFlow) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - DesTowerExitWaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - DesTowerExitWaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, DesTowerExitWaterTemp, RoutineName); + Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, DesTowerExitWaterTemp, RoutineName); DesTowerLoad = rho * Cp * this->DesignWaterFlowRate * DesTowerWaterDeltaT * this->SizFac; tmpNomTowerCap = DesTowerLoad / this->HeatRejectCapNomCapSizingRatio; if (state.dataPlnt->PlantFirstSizesOkayToFinalize) { @@ -4205,18 +3980,10 @@ namespace CondenserLoopTowers { } } } - // now calcuate UA values from nominal capacities and flow rates + // now calculate UA values from nominal capacities and flow rates if (state.dataPlnt->PlantFirstSizesOkayToFinalize) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - DesTowerExitWaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); + Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, DesTowerExitWaterTemp, RoutineName); // full speed fan tower UA Real64 const solveLoad = tmpNomTowerCap * this->HeatRejectCapNomCapSizingRatio; Real64 const solveWaterFlow = rho * tmpDesignWaterFlowRate; // design water mass flow rate @@ -4322,16 +4089,8 @@ namespace CondenserLoopTowers { // get nominal capacity from PlantSizData(PltSizCondNum)%DeltaT and PlantSizData(PltSizCondNum)%DesVolFlowRate if (PltSizCondNum > 0) { if (PlantSizData(PltSizCondNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - DesTowerExitWaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - DesTowerExitWaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, DesTowerExitWaterTemp, RoutineName); + Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, DesTowerExitWaterTemp, RoutineName); DesTowerLoad = rho * Cp * PlantSizData(PltSizCondNum).DesVolFlowRate * DesTowerWaterDeltaT; tmpNomTowerCap = DesTowerLoad / this->HeatRejectCapNomCapSizingRatio; if (state.dataPlnt->PlantFirstSizesOkayToFinalize) { @@ -4405,16 +4164,8 @@ namespace CondenserLoopTowers { } else { // UA and Air flow rate given, so find Nominal Cap from running model - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - DesTowerExitWaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - DesTowerExitWaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, DesTowerExitWaterTemp, RoutineName); + Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, DesTowerExitWaterTemp, RoutineName); this->WaterTemp = DesTowerInletWaterTemp; this->AirTemp = DesTowerInletAirDBTemp; // 35.0; @@ -4765,7 +4516,7 @@ namespace CondenserLoopTowers { } // Calculate bypass fraction since OWTLowerLimit < OutletWaterTemp < TempSetPoint. - // The iteraction ends when the numer of iteraction exceeds the limit or the difference + // The iteration ends when the number of iterations exceeds the limit or the difference // between the new and old bypass fractions is less than the threshold. if (BypassFlag == 1) { // Inlet water temperature lower than setpoint, assume 100% bypass, tower fan off @@ -4803,7 +4554,7 @@ namespace CondenserLoopTowers { this->OutletWaterTemp = this->calculateSimpleTowerOutletTemp( state, WaterMassFlowRatePerCell * (1.0 - BypassFraction2), AirFlowRate, UAdesign); if (this->OutletWaterTemp < OWTLowerLimit) { - // Use previous iteraction values + // Use previous iteration values BypassFraction2 = BypassFractionPrev; this->OutletWaterTemp = OutletWaterTempPrev; } @@ -4833,11 +4584,8 @@ namespace CondenserLoopTowers { // output the fraction of the time step the fan is ON this->FanCyclingRatio = FanModeFrac; // Should this be water inlet node num????? - Real64 const CpWater = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 const CpWater = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp, RoutineName); this->Qactual = this->WaterMassFlowRate * CpWater * (state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp - this->OutletWaterTemp); this->airFlowRateRatio = (AirFlowRate * this->NumCell) / this->HighSpeedAirFlowRate; @@ -4867,7 +4615,7 @@ namespace CondenserLoopTowers { // Cyclic losses are neglected. The period of time required to meet the // leaving water temperature setpoint is used to determine the required // fan power and energy. Free convection regime is also modeled. This - // occures when the pump is operating and the fan is off. If free convection + // occurs when the pump is operating and the fan is off. If free convection // regime cooling is all that is required for a given time step, the leaving // water temperature is allowed to fall below the leaving water temperature // setpoint (free cooling). At times when the cooling tower fan is required, @@ -5073,11 +4821,8 @@ namespace CondenserLoopTowers { this->FanCyclingRatio = FanModeFrac; this->SpeedSelected = SpeedSel; - Real64 const CpWater = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 const CpWater = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp, RoutineName); this->Qactual = this->WaterMassFlowRate * CpWater * (state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp - this->OutletWaterTemp); this->airFlowRateRatio = (AirFlowRate * this->NumCell) / this->HighSpeedAirFlowRate; } @@ -5218,11 +4963,8 @@ namespace CondenserLoopTowers { while (IncrNumCellFlag) { IncrNumCellFlag = false; // Initialize inlet node water properties - Real64 const WaterDensity = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 const WaterDensity = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getDensity(state, state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp, RoutineName); Real64 const WaterFlowRateRatio = WaterMassFlowRatePerCell / (WaterDensity * this->CalibratedWaterFlowRate / this->NumCell); // check independent inputs with respect to model boundaries @@ -5351,11 +5093,8 @@ namespace CondenserLoopTowers { } } - Real64 const CpWater = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 const CpWater = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp, RoutineName); this->Qactual = this->WaterMassFlowRate * CpWater * (state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp - this->OutletWaterTemp); // calculate end time of current time step @@ -5366,20 +5105,20 @@ namespace CondenserLoopTowers { // the warning for the last iteration only. Must wait for next time step to accomplish this. // If a warning occurs and the simulation down shifts, the warning is not valid. if (CurrentEndTime > this->CurrentEndTimeLast && state.dataHVACGlobal->TimeStepSys >= this->TimeStepSysLast) { - if (state.dataCondenserLoopTowers->towers(this->VSTower).PrintLGMessage) { - ++state.dataCondenserLoopTowers->towers(this->VSTower).VSErrorCountFlowFrac; + if (this->PrintLGMessage) { + ++this->VSErrorCountFlowFrac; // Show single warning and pass additional info to ShowRecurringWarningErrorAtEnd - if (state.dataCondenserLoopTowers->towers(this->VSTower).VSErrorCountFlowFrac < 2) { - ShowWarningError(state, state.dataCondenserLoopTowers->towers(this->VSTower).LGBuffer1); - ShowContinueError(state, state.dataCondenserLoopTowers->towers(this->VSTower).LGBuffer2); + if (this->VSErrorCountFlowFrac < 2) { + ShowWarningError(state, this->LGBuffer1); + ShowContinueError(state, this->LGBuffer2); } else { ShowRecurringWarningErrorAtEnd(state, format("{} \"{}\" - Liquid to gas ratio is out of range error continues...", DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], this->Name), - state.dataCondenserLoopTowers->towers(this->VSTower).ErrIndexLG, - state.dataCondenserLoopTowers->towers(this->VSTower).LGLast, - state.dataCondenserLoopTowers->towers(this->VSTower).LGLast); + this->ErrIndexLG, + this->LGLast, + this->LGLast); } } } @@ -5390,28 +5129,26 @@ namespace CondenserLoopTowers { // warn user on first occurrence if flow fraction is greater than maximum for the YorkCalc model, use recurring warning stats if (this->TowerModelType == ModelType::YorkCalcModel || this->TowerModelType == ModelType::YorkCalcUserDefined) { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintLGMessage = false; + this->PrintLGMessage = false; // Do not report error message in free convection regime if (this->airFlowRateRatio > this->MinimumVSAirFlowFrac) { Real64 const FlowFraction = WaterFlowRateRatioCapped / this->airFlowRateRatio; // Flow fractions greater than a MaxLiquidToGasRatio of 8 are not reliable using the YorkCalc model - if (FlowFraction > state.dataCondenserLoopTowers->towers(this->VSTower).MaxLiquidToGasRatio) { + if (FlowFraction > this->MaxLiquidToGasRatio) { // Report warnings only during actual simulation if (!state.dataGlobal->WarmupFlag) { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintLGMessage = true; - state.dataCondenserLoopTowers->towers(this->VSTower).LGBuffer1 = - format("{} \"{}\" - Liquid to gas ratio (L/G) is out of range at {:5.2F}.", - DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], - this->Name, - FlowFraction); - state.dataCondenserLoopTowers->towers(this->VSTower).LGBuffer2 = - format(" ...Valid maximum ratio = {:5.2F}. Occurrence info = {}, {} {}", - state.dataCondenserLoopTowers->towers(this->VSTower).MaxLiquidToGasRatio, - state.dataEnvrn->EnvironmentName, - state.dataEnvrn->CurMnDy, - General::CreateSysTimeIntervalString(state)); - - state.dataCondenserLoopTowers->towers(this->VSTower).LGLast = FlowFraction; + this->PrintLGMessage = true; + this->LGBuffer1 = format("{} \"{}\" - Liquid to gas ratio (L/G) is out of range at {:5.2F}.", + DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], + this->Name, + FlowFraction); + this->LGBuffer2 = format(" ...Valid maximum ratio = {:5.2F}. Occurrence info = {}, {} {}", + this->MaxLiquidToGasRatio, + state.dataEnvrn->EnvironmentName, + state.dataEnvrn->CurMnDy, + General::CreateSysTimeIntervalString(state)); + + this->LGLast = FlowFraction; } } } @@ -5439,11 +5176,8 @@ namespace CondenserLoopTowers { Real64 constexpr Acc(1.e-3); // Accuracy of solver result static constexpr std::string_view RoutineName("calculateMerkelVariableSpeedTower"); - Real64 const CpWater = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 const CpWater = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp, RoutineName); this->Qactual = 0.0; this->FanPower = 0.0; this->OutletWaterTemp = state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp; @@ -5511,12 +5245,12 @@ namespace CondenserLoopTowers { this->airFlowRateRatio = 0.0; this->Qactual = 0.0; CalcBasinHeaterPower( - state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); + state, this->BasinHeaterPowerFTempDiff, this->basinHeaterSched, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); return; } else if (this->WaterMassFlowRate <= DataBranchAirLoopPlant::MassFlowTolerance || (MyLoad > HVAC::SmallLoad)) { // for multiple cells, we assume that it's a common basin CalcBasinHeaterPower( - state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); + state, this->BasinHeaterPowerFTempDiff, this->basinHeaterSched, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); return; } @@ -5535,7 +5269,7 @@ namespace CondenserLoopTowers { this->airFlowRateRatio = 0.0; this->Qactual = FreeConvQdot; CalcBasinHeaterPower( - state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); + state, this->BasinHeaterPowerFTempDiff, this->basinHeaterSched, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); return; } @@ -5575,7 +5309,7 @@ namespace CondenserLoopTowers { } this->Qactual = FullSpeedFanQdot; CalcBasinHeaterPower( - state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); + state, this->BasinHeaterPowerFTempDiff, this->basinHeaterSched, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); // now calculate fan power FanPowerAdjustFac = Curve::CurveValue(state, this->FanPowerfAirFlowCurve, this->airFlowRateRatio); this->FanPower = this->HighSpeedFanPower * FanPowerAdjustFac * this->NumCellOn / this->NumCell; @@ -5595,7 +5329,7 @@ namespace CondenserLoopTowers { if (std::abs(MyLoad) <= MinSpeedFanQdot) { // min fan speed already exceeds load) this->Qactual = MinSpeedFanQdot; CalcBasinHeaterPower( - state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); + state, this->BasinHeaterPowerFTempDiff, this->basinHeaterSched, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); // now calculate fan power FanPowerAdjustFac = Curve::CurveValue(state, this->FanPowerfAirFlowCurve, this->airFlowRateRatio); this->FanPower = this->HighSpeedFanPower * FanPowerAdjustFac * this->NumCellOn / this->NumCell; @@ -5663,7 +5397,7 @@ namespace CondenserLoopTowers { } } - // now rerun to get peformance with AirFlowRateRatio + // now rerun to get performance with AirFlowRateRatio AirFlowRatePerCell = this->airFlowRateRatio * this->HighSpeedAirFlowRate / this->NumCell; UAairflowAdjFac = Curve::CurveValue(state, this->UAModFuncAirFlowRatioCurvePtr, this->airFlowRateRatio); @@ -5672,7 +5406,7 @@ namespace CondenserLoopTowers { this->OutletWaterTemp = this->calculateSimpleTowerOutletTemp(state, WaterMassFlowRatePerCell, AirFlowRatePerCell, UAadjustedPerCell); this->Qactual = this->WaterMassFlowRate * CpWater * (state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp - this->OutletWaterTemp); CalcBasinHeaterPower( - state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); + state, this->BasinHeaterPowerFTempDiff, this->basinHeaterSched, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); // now calculate fan power FanPowerAdjustFac = Curve::CurveValue(state, this->FanPowerfAirFlowCurve, this->airFlowRateRatio); @@ -5719,11 +5453,10 @@ namespace CondenserLoopTowers { Real64 AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, this->AirPress, InletAirTemp, this->AirHumRat); // Density of air [kg/m3] Real64 AirMassFlowRate = AirFlowRate * AirDensity; // Mass flow rate of air [kg/s] Real64 CpAir = Psychrometrics::PsyCpAirFnW(this->AirHumRat); // Heat capacity of air [J/kg/K] - Real64 CpWater = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->WaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); // Heat capacity of water [J/kg/K] + Real64 CpWater = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getSpecificHeat(state, + this->WaterTemp, + RoutineName); // Heat capacity of water [J/kg/K] Real64 InletAirEnthalpy = Psychrometrics::PsyHFnTdbRhPb(state, this->AirWetBulb, 1.0, this->AirPress); // Enthalpy of entering moist air [J/kg] @@ -5902,39 +5635,38 @@ namespace CondenserLoopTowers { // York International Corporation, "YORKcalcTM Software, Chiller-Plant Energy-Estimating Program", // Form 160.00-SG2 (0502). 2002. - auto &tower = state.dataCondenserLoopTowers->towers(this->VSTower); if (this->TowerModelType == ModelType::YorkCalcModel || this->TowerModelType == ModelType::YorkCalcUserDefined) { Real64 PctAirFlow = airFlowRatioLocal; Real64 FlowFactor = PctWaterFlow / PctAirFlow; - return tower.Coeff[0] + tower.Coeff[1] * Twb + tower.Coeff[2] * Twb * Twb + tower.Coeff[3] * Tr + tower.Coeff[4] * Twb * Tr + - tower.Coeff[5] * Twb * Twb * Tr + tower.Coeff[6] * Tr * Tr + tower.Coeff[7] * Twb * Tr * Tr + - tower.Coeff[8] * Twb * Twb * Tr * Tr + tower.Coeff[9] * FlowFactor + tower.Coeff[10] * Twb * FlowFactor + - tower.Coeff[11] * Twb * Twb * FlowFactor + tower.Coeff[12] * Tr * FlowFactor + tower.Coeff[13] * Twb * Tr * FlowFactor + - tower.Coeff[14] * Twb * Twb * Tr * FlowFactor + tower.Coeff[15] * Tr * Tr * FlowFactor + - tower.Coeff[16] * Twb * Tr * Tr * FlowFactor + tower.Coeff[17] * Twb * Twb * Tr * Tr * FlowFactor + - tower.Coeff[18] * FlowFactor * FlowFactor + tower.Coeff[19] * Twb * FlowFactor * FlowFactor + - tower.Coeff[20] * Twb * Twb * FlowFactor * FlowFactor + tower.Coeff[21] * Tr * FlowFactor * FlowFactor + - tower.Coeff[22] * Twb * Tr * FlowFactor * FlowFactor + tower.Coeff[23] * Twb * Twb * Tr * FlowFactor * FlowFactor + - tower.Coeff[24] * Tr * Tr * FlowFactor * FlowFactor + tower.Coeff[25] * Twb * Tr * Tr * FlowFactor * FlowFactor + - tower.Coeff[26] * Twb * Twb * Tr * Tr * FlowFactor * FlowFactor; + return this->Coeff[0] + this->Coeff[1] * Twb + this->Coeff[2] * Twb * Twb + this->Coeff[3] * Tr + this->Coeff[4] * Twb * Tr + + this->Coeff[5] * Twb * Twb * Tr + this->Coeff[6] * Tr * Tr + this->Coeff[7] * Twb * Tr * Tr + + this->Coeff[8] * Twb * Twb * Tr * Tr + this->Coeff[9] * FlowFactor + this->Coeff[10] * Twb * FlowFactor + + this->Coeff[11] * Twb * Twb * FlowFactor + this->Coeff[12] * Tr * FlowFactor + this->Coeff[13] * Twb * Tr * FlowFactor + + this->Coeff[14] * Twb * Twb * Tr * FlowFactor + this->Coeff[15] * Tr * Tr * FlowFactor + + this->Coeff[16] * Twb * Tr * Tr * FlowFactor + this->Coeff[17] * Twb * Twb * Tr * Tr * FlowFactor + + this->Coeff[18] * FlowFactor * FlowFactor + this->Coeff[19] * Twb * FlowFactor * FlowFactor + + this->Coeff[20] * Twb * Twb * FlowFactor * FlowFactor + this->Coeff[21] * Tr * FlowFactor * FlowFactor + + this->Coeff[22] * Twb * Tr * FlowFactor * FlowFactor + this->Coeff[23] * Twb * Twb * Tr * FlowFactor * FlowFactor + + this->Coeff[24] * Tr * Tr * FlowFactor * FlowFactor + this->Coeff[25] * Twb * Tr * Tr * FlowFactor * FlowFactor + + this->Coeff[26] * Twb * Twb * Tr * Tr * FlowFactor * FlowFactor; } else { // empirical model is CoolTools format // the CoolTools model actually uses PctFanPower = AirFlowRatio^3 as an input to the model Real64 PctAirFlow = pow_3(airFlowRatioLocal); - return tower.Coeff[0] + tower.Coeff[1] * PctAirFlow + tower.Coeff[2] * PctAirFlow * PctAirFlow + - tower.Coeff[3] * PctAirFlow * PctAirFlow * PctAirFlow + tower.Coeff[4] * PctWaterFlow + - tower.Coeff[5] * PctAirFlow * PctWaterFlow + tower.Coeff[6] * PctAirFlow * PctAirFlow * PctWaterFlow + - tower.Coeff[7] * PctWaterFlow * PctWaterFlow + tower.Coeff[8] * PctAirFlow * PctWaterFlow * PctWaterFlow + - tower.Coeff[9] * PctWaterFlow * PctWaterFlow * PctWaterFlow + tower.Coeff[10] * Twb + tower.Coeff[11] * PctAirFlow * Twb + - tower.Coeff[12] * PctAirFlow * PctAirFlow * Twb + tower.Coeff[13] * PctWaterFlow * Twb + - tower.Coeff[14] * PctAirFlow * PctWaterFlow * Twb + tower.Coeff[15] * PctWaterFlow * PctWaterFlow * Twb + - tower.Coeff[16] * Twb * Twb + tower.Coeff[17] * PctAirFlow * Twb * Twb + tower.Coeff[18] * PctWaterFlow * Twb * Twb + - tower.Coeff[19] * Twb * Twb * Twb + tower.Coeff[20] * Tr + tower.Coeff[21] * PctAirFlow * Tr + - tower.Coeff[22] * PctAirFlow * PctAirFlow * Tr + tower.Coeff[23] * PctWaterFlow * Tr + - tower.Coeff[24] * PctAirFlow * PctWaterFlow * Tr + tower.Coeff[25] * PctWaterFlow * PctWaterFlow * Tr + - tower.Coeff[26] * Twb * Tr + tower.Coeff[27] * PctAirFlow * Twb * Tr + tower.Coeff[28] * PctWaterFlow * Twb * Tr + - tower.Coeff[29] * Twb * Twb * Tr + tower.Coeff[30] * Tr * Tr + tower.Coeff[31] * PctAirFlow * Tr * Tr + - tower.Coeff[32] * PctWaterFlow * Tr * Tr + tower.Coeff[33] * Twb * Tr * Tr + tower.Coeff[34] * Tr * Tr * Tr; + return this->Coeff[0] + this->Coeff[1] * PctAirFlow + this->Coeff[2] * PctAirFlow * PctAirFlow + + this->Coeff[3] * PctAirFlow * PctAirFlow * PctAirFlow + this->Coeff[4] * PctWaterFlow + + this->Coeff[5] * PctAirFlow * PctWaterFlow + this->Coeff[6] * PctAirFlow * PctAirFlow * PctWaterFlow + + this->Coeff[7] * PctWaterFlow * PctWaterFlow + this->Coeff[8] * PctAirFlow * PctWaterFlow * PctWaterFlow + + this->Coeff[9] * PctWaterFlow * PctWaterFlow * PctWaterFlow + this->Coeff[10] * Twb + this->Coeff[11] * PctAirFlow * Twb + + this->Coeff[12] * PctAirFlow * PctAirFlow * Twb + this->Coeff[13] * PctWaterFlow * Twb + + this->Coeff[14] * PctAirFlow * PctWaterFlow * Twb + this->Coeff[15] * PctWaterFlow * PctWaterFlow * Twb + + this->Coeff[16] * Twb * Twb + this->Coeff[17] * PctAirFlow * Twb * Twb + this->Coeff[18] * PctWaterFlow * Twb * Twb + + this->Coeff[19] * Twb * Twb * Twb + this->Coeff[20] * Tr + this->Coeff[21] * PctAirFlow * Tr + + this->Coeff[22] * PctAirFlow * PctAirFlow * Tr + this->Coeff[23] * PctWaterFlow * Tr + + this->Coeff[24] * PctAirFlow * PctWaterFlow * Tr + this->Coeff[25] * PctWaterFlow * PctWaterFlow * Tr + + this->Coeff[26] * Twb * Tr + this->Coeff[27] * PctAirFlow * Twb * Tr + this->Coeff[28] * PctWaterFlow * Twb * Tr + + this->Coeff[29] * Twb * Twb * Tr + this->Coeff[30] * Tr * Tr + this->Coeff[31] * PctAirFlow * Tr * Tr + + this->Coeff[32] * PctWaterFlow * Tr * Tr + this->Coeff[33] * Twb * Tr * Tr + this->Coeff[34] * Tr * Tr * Tr; } } @@ -5983,17 +5715,17 @@ namespace CondenserLoopTowers { // calculate end time of current time step Real64 CurrentEndTime = state.dataGlobal->CurrentTime + state.dataHVACGlobal->SysTimeElapsed; - // Print warning messages only when valid and only for the first ocurrance. Let summary provide statistics. + // Print warning messages only when valid and only for the first occurrence. Let summary provide statistics. // Wait for next time step to print warnings. If simulation iterates, print out // the warning for the last iteration only. Must wait for next time step to accomplish this. // If a warning occurs and the simulation down shifts, the warning is not valid. if (CurrentEndTime > this->CurrentEndTimeLast && state.dataHVACGlobal->TimeStepSys >= this->TimeStepSysLast) { - if (state.dataCondenserLoopTowers->towers(this->VSTower).PrintTrMessage) { - ++state.dataCondenserLoopTowers->towers(this->VSTower).VSErrorCountTR; - if (state.dataCondenserLoopTowers->towers(this->VSTower).VSErrorCountTR < 2) { - ShowWarningError(state, state.dataCondenserLoopTowers->towers(this->VSTower).TrBuffer1); - ShowContinueError(state, state.dataCondenserLoopTowers->towers(this->VSTower).TrBuffer2); - ShowContinueError(state, state.dataCondenserLoopTowers->towers(this->VSTower).TrBuffer3); + if (this->PrintTrMessage) { + ++this->VSErrorCountTR; + if (this->VSErrorCountTR < 2) { + ShowWarningError(state, this->TrBuffer1); + ShowContinueError(state, this->TrBuffer2); + ShowContinueError(state, this->TrBuffer3); ShowContinueError(state, " ...Range temperatures outside model boundaries may not adversely affect tower performance."); ShowContinueError(state, " ...This is not an unexpected occurrence when simulating actual conditions."); } else { @@ -6001,34 +5733,34 @@ namespace CondenserLoopTowers { format("{} \"{}\" - Tower range temperature is out of range error continues...", DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], this->Name), - state.dataCondenserLoopTowers->towers(this->VSTower).ErrIndexTR, - state.dataCondenserLoopTowers->towers(this->VSTower).TrLast, - state.dataCondenserLoopTowers->towers(this->VSTower).TrLast); + this->ErrIndexTR, + this->TrLast, + this->TrLast); } } - if (state.dataCondenserLoopTowers->towers(this->VSTower).PrintTwbMessage) { - ++state.dataCondenserLoopTowers->towers(this->VSTower).VSErrorCountIAWB; - if (state.dataCondenserLoopTowers->towers(this->VSTower).VSErrorCountIAWB < 6) { - ShowWarningError(state, state.dataCondenserLoopTowers->towers(this->VSTower).TwbBuffer1); - ShowContinueError(state, state.dataCondenserLoopTowers->towers(this->VSTower).TwbBuffer2); - ShowContinueError(state, state.dataCondenserLoopTowers->towers(this->VSTower).TwbBuffer3); + if (this->PrintTwbMessage) { + ++this->VSErrorCountIAWB; + if (this->VSErrorCountIAWB < 6) { + ShowWarningError(state, this->TwbBuffer1); + ShowContinueError(state, this->TwbBuffer2); + ShowContinueError(state, this->TwbBuffer3); ShowContinueError(state, " ...Wet-bulb temperatures outside model boundaries may not adversely affect tower performance."); } else { ShowRecurringWarningErrorAtEnd(state, format("{} \"{}\" - Inlet air wet-bulb temperature is out of range error continues...", DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], this->Name), - state.dataCondenserLoopTowers->towers(this->VSTower).ErrIndexIAWB, - state.dataCondenserLoopTowers->towers(this->VSTower).TwbLast, - state.dataCondenserLoopTowers->towers(this->VSTower).TwbLast); + this->ErrIndexIAWB, + this->TwbLast, + this->TwbLast); } } - if (state.dataCondenserLoopTowers->towers(this->VSTower).PrintTaMessage) { - ++state.dataCondenserLoopTowers->towers(this->VSTower).VSErrorCountTA; - if (state.dataCondenserLoopTowers->towers(this->VSTower).VSErrorCountTA < 2) { - ShowWarningError(state, state.dataCondenserLoopTowers->towers(this->VSTower).TaBuffer1); - ShowContinueError(state, state.dataCondenserLoopTowers->towers(this->VSTower).TaBuffer2); - ShowContinueError(state, state.dataCondenserLoopTowers->towers(this->VSTower).TaBuffer3); + if (this->PrintTaMessage) { + ++this->VSErrorCountTA; + if (this->VSErrorCountTA < 2) { + ShowWarningError(state, this->TaBuffer1); + ShowContinueError(state, this->TaBuffer2); + ShowContinueError(state, this->TaBuffer3); ShowContinueError(state, " ...Approach temperatures outside model boundaries may not adversely affect tower performance."); ShowContinueError(state, " ...This is not an unexpected occurrence when simulating actual conditions."); } else { @@ -6036,26 +5768,26 @@ namespace CondenserLoopTowers { format("{} \"{}\" - Tower approach temperature is out of range error continues...", DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], this->Name), - state.dataCondenserLoopTowers->towers(this->VSTower).ErrIndexTA, - state.dataCondenserLoopTowers->towers(this->VSTower).TaLast, - state.dataCondenserLoopTowers->towers(this->VSTower).TaLast); + this->ErrIndexTA, + this->TaLast, + this->TaLast); } } - if (state.dataCondenserLoopTowers->towers(this->VSTower).PrintWFRRMessage) { - ++state.dataCondenserLoopTowers->towers(this->VSTower).VSErrorCountWFRR; - if (state.dataCondenserLoopTowers->towers(this->VSTower).VSErrorCountWFRR < 6) { - ShowWarningError(state, state.dataCondenserLoopTowers->towers(this->VSTower).WFRRBuffer1); - ShowContinueError(state, state.dataCondenserLoopTowers->towers(this->VSTower).WFRRBuffer2); - ShowContinueError(state, state.dataCondenserLoopTowers->towers(this->VSTower).WFRRBuffer3); + if (this->PrintWFRRMessage) { + ++this->VSErrorCountWFRR; + if (this->VSErrorCountWFRR < 6) { + ShowWarningError(state, this->WFRRBuffer1); + ShowContinueError(state, this->WFRRBuffer2); + ShowContinueError(state, this->WFRRBuffer3); ShowContinueError(state, " ...Water flow rate ratios outside model boundaries may not adversely affect tower performance."); } else { ShowRecurringWarningErrorAtEnd(state, format("{} \"{}\" - Water flow rate ratio is out of range error continues...", DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], this->Name), - state.dataCondenserLoopTowers->towers(this->VSTower).ErrIndexWFRR, - state.dataCondenserLoopTowers->towers(this->VSTower).WaterFlowRateRatioLast, - state.dataCondenserLoopTowers->towers(this->VSTower).WaterFlowRateRatioLast); + this->ErrIndexWFRR, + this->WaterFlowRateRatioLast, + this->WaterFlowRateRatioLast); } } } @@ -6065,134 +5797,125 @@ namespace CondenserLoopTowers { this->CurrentEndTimeLast = CurrentEndTime; // check boundaries of independent variables and post warnings to individual buffers to print at end of time step - if (Twb < state.dataCondenserLoopTowers->towers(this->VSTower).MinInletAirWBTemp || - Twb > state.dataCondenserLoopTowers->towers(this->VSTower).MaxInletAirWBTemp) { + if (Twb < this->MinInletAirWBTemp || Twb > this->MaxInletAirWBTemp) { OutputChar = format("{:.2R}", Twb); - OutputCharLo = format("{:.2R}", state.dataCondenserLoopTowers->towers(this->VSTower).MinInletAirWBTemp); - OutputCharHi = format("{:.2R}", state.dataCondenserLoopTowers->towers(this->VSTower).MaxInletAirWBTemp); - if (Twb < state.dataCondenserLoopTowers->towers(this->VSTower).MinInletAirWBTemp) { - TwbCapped = state.dataCondenserLoopTowers->towers(this->VSTower).MinInletAirWBTemp; + OutputCharLo = format("{:.2R}", this->MinInletAirWBTemp); + OutputCharHi = format("{:.2R}", this->MaxInletAirWBTemp); + if (Twb < this->MinInletAirWBTemp) { + TwbCapped = this->MinInletAirWBTemp; } - if (Twb > state.dataCondenserLoopTowers->towers(this->VSTower).MaxInletAirWBTemp) { - TwbCapped = state.dataCondenserLoopTowers->towers(this->VSTower).MaxInletAirWBTemp; + if (Twb > this->MaxInletAirWBTemp) { + TwbCapped = this->MaxInletAirWBTemp; } if (!state.dataGlobal->WarmupFlag) { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintTwbMessage = true; - state.dataCondenserLoopTowers->towers(this->VSTower).TwbBuffer1 = - format("{} \"{}\" - Inlet air wet-bulb temperature is outside model boundaries at {}.", - DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], - this->Name, - OutputChar); - state.dataCondenserLoopTowers->towers(this->VSTower).TwbBuffer2 = - " ...Valid range = " + OutputCharLo + " to " + OutputCharHi + ". Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + - state.dataEnvrn->CurMnDy + ' ' + General::CreateSysTimeIntervalString(state); + this->PrintTwbMessage = true; + this->TwbBuffer1 = format("{} \"{}\" - Inlet air wet-bulb temperature is outside model boundaries at {}.", + DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], + this->Name, + OutputChar); + this->TwbBuffer2 = " ...Valid range = " + OutputCharLo + " to " + OutputCharHi + + ". Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + state.dataEnvrn->CurMnDy + ' ' + + General::CreateSysTimeIntervalString(state); TrimValue = format("{:.6R}", TwbCapped); - state.dataCondenserLoopTowers->towers(this->VSTower).TwbBuffer3 = - " ...Inlet air wet-bulb temperature passed to the model = " + TrimValue; - state.dataCondenserLoopTowers->towers(this->VSTower).TwbLast = Twb; + this->TwbBuffer3 = " ...Inlet air wet-bulb temperature passed to the model = " + TrimValue; + this->TwbLast = Twb; } else { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintTwbMessage = false; + this->PrintTwbMessage = false; } } else { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintTwbMessage = false; + this->PrintTwbMessage = false; } - if (Tr < state.dataCondenserLoopTowers->towers(this->VSTower).MinRangeTemp || - Tr > state.dataCondenserLoopTowers->towers(this->VSTower).MaxRangeTemp) { + if (Tr < this->MinRangeTemp || Tr > this->MaxRangeTemp) { OutputChar = format("{:.2R}", Tr); - OutputCharLo = format("{:.2R}", state.dataCondenserLoopTowers->towers(this->VSTower).MinRangeTemp); - OutputCharHi = format("{:.2R}", state.dataCondenserLoopTowers->towers(this->VSTower).MaxRangeTemp); - if (Tr < state.dataCondenserLoopTowers->towers(this->VSTower).MinRangeTemp) { - TrCapped = state.dataCondenserLoopTowers->towers(this->VSTower).MinRangeTemp; + OutputCharLo = format("{:.2R}", this->MinRangeTemp); + OutputCharHi = format("{:.2R}", this->MaxRangeTemp); + if (Tr < this->MinRangeTemp) { + TrCapped = this->MinRangeTemp; } - if (Tr > state.dataCondenserLoopTowers->towers(this->VSTower).MaxRangeTemp) { - TrCapped = state.dataCondenserLoopTowers->towers(this->VSTower).MaxRangeTemp; + if (Tr > this->MaxRangeTemp) { + TrCapped = this->MaxRangeTemp; } if (!state.dataGlobal->WarmupFlag) { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintTrMessage = true; - state.dataCondenserLoopTowers->towers(this->VSTower).TrBuffer1 = - format("{} \"{}\" - Tower range temperature is outside model boundaries at {}.", - DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], - this->Name, - OutputChar); - state.dataCondenserLoopTowers->towers(this->VSTower).TrBuffer2 = - " ...Valid range = " + OutputCharLo + " to " + OutputCharHi + ". Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + - state.dataEnvrn->CurMnDy + ' ' + General::CreateSysTimeIntervalString(state); + this->PrintTrMessage = true; + this->TrBuffer1 = format("{} \"{}\" - Tower range temperature is outside model boundaries at {}.", + DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], + this->Name, + OutputChar); + this->TrBuffer2 = " ...Valid range = " + OutputCharLo + " to " + OutputCharHi + + ". Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + state.dataEnvrn->CurMnDy + ' ' + + General::CreateSysTimeIntervalString(state); TrimValue = format("{:.5R}", Tr); - state.dataCondenserLoopTowers->towers(this->VSTower).TrBuffer3 = " ...Tower range temperature passed to the model = " + TrimValue; - state.dataCondenserLoopTowers->towers(this->VSTower).TrLast = Tr; + this->TrBuffer3 = " ...Tower range temperature passed to the model = " + TrimValue; + this->TrLast = Tr; } else { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintTrMessage = false; + this->PrintTrMessage = false; } } else { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintTrMessage = false; + this->PrintTrMessage = false; } - if (Ta < state.dataCondenserLoopTowers->towers(this->VSTower).MinApproachTemp || - Ta > state.dataCondenserLoopTowers->towers(this->VSTower).MaxApproachTemp) { + if (Ta < this->MinApproachTemp || Ta > this->MaxApproachTemp) { OutputChar = format("{:.2R}", Ta); - OutputCharLo = format("{:.2R}", state.dataCondenserLoopTowers->towers(this->VSTower).MinApproachTemp); - OutputCharHi = format("{:.2R}", state.dataCondenserLoopTowers->towers(this->VSTower).MaxApproachTemp); - if (Ta < state.dataCondenserLoopTowers->towers(this->VSTower).MinApproachTemp) { - TaCapped = state.dataCondenserLoopTowers->towers(this->VSTower).MinApproachTemp; + OutputCharLo = format("{:.2R}", this->MinApproachTemp); + OutputCharHi = format("{:.2R}", this->MaxApproachTemp); + if (Ta < this->MinApproachTemp) { + TaCapped = this->MinApproachTemp; } - if (Ta > state.dataCondenserLoopTowers->towers(this->VSTower).MaxApproachTemp) { - TaCapped = state.dataCondenserLoopTowers->towers(this->VSTower).MaxApproachTemp; + if (Ta > this->MaxApproachTemp) { + TaCapped = this->MaxApproachTemp; } if (!state.dataGlobal->WarmupFlag) { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintTaMessage = true; - state.dataCondenserLoopTowers->towers(this->VSTower).TaBuffer1 = - format("{} \"{}\" - Tower approach temperature is outside model boundaries at {}.", - DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], - this->Name, - OutputChar); - state.dataCondenserLoopTowers->towers(this->VSTower).TaBuffer2 = - " ...Valid range = " + OutputCharLo + " to " + OutputCharHi + ". Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + - state.dataEnvrn->CurMnDy + ' ' + General::CreateSysTimeIntervalString(state); + this->PrintTaMessage = true; + this->TaBuffer1 = format("{} \"{}\" - Tower approach temperature is outside model boundaries at {}.", + DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], + this->Name, + OutputChar); + this->TaBuffer2 = " ...Valid range = " + OutputCharLo + " to " + OutputCharHi + + ". Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + state.dataEnvrn->CurMnDy + ' ' + + General::CreateSysTimeIntervalString(state); TrimValue = format("{:.5R}", Ta); - state.dataCondenserLoopTowers->towers(this->VSTower).TaBuffer3 = " ...Tower approach temperature passed to the model = " + TrimValue; - state.dataCondenserLoopTowers->towers(this->VSTower).TaLast = Ta; + this->TaBuffer3 = " ...Tower approach temperature passed to the model = " + TrimValue; + this->TaLast = Ta; } else { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintTaMessage = false; + this->PrintTaMessage = false; } } else { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintTaMessage = false; + this->PrintTaMessage = false; } if (this->TowerModelType == ModelType::YorkCalcModel || this->TowerModelType == ModelType::YorkCalcUserDefined) { // Water flow rate ratio warning not valid for YorkCalc model, print liquid to gas ratio // warning instead (bottom of Subroutine VariableSpeedTower) - state.dataCondenserLoopTowers->towers(this->VSTower).PrintWFRRMessage = false; + this->PrintWFRRMessage = false; } else { - if (WaterFlowRateRatio < state.dataCondenserLoopTowers->towers(this->VSTower).MinWaterFlowRatio || - WaterFlowRateRatio > state.dataCondenserLoopTowers->towers(this->VSTower).MaxWaterFlowRatio) { + if (WaterFlowRateRatio < this->MinWaterFlowRatio || WaterFlowRateRatio > this->MaxWaterFlowRatio) { OutputChar = format("{:.2R}", WaterFlowRateRatio); - OutputCharLo = format("{:.2R}", state.dataCondenserLoopTowers->towers(this->VSTower).MinWaterFlowRatio); - OutputCharHi = format("{:.2R}", state.dataCondenserLoopTowers->towers(this->VSTower).MaxWaterFlowRatio); - if (WaterFlowRateRatio < state.dataCondenserLoopTowers->towers(this->VSTower).MinWaterFlowRatio) { - WaterFlowRateRatioCapped = state.dataCondenserLoopTowers->towers(this->VSTower).MinWaterFlowRatio; + OutputCharLo = format("{:.2R}", this->MinWaterFlowRatio); + OutputCharHi = format("{:.2R}", this->MaxWaterFlowRatio); + if (WaterFlowRateRatio < this->MinWaterFlowRatio) { + WaterFlowRateRatioCapped = this->MinWaterFlowRatio; } - if (WaterFlowRateRatio > state.dataCondenserLoopTowers->towers(this->VSTower).MaxWaterFlowRatio) { - WaterFlowRateRatioCapped = state.dataCondenserLoopTowers->towers(this->VSTower).MaxWaterFlowRatio; + if (WaterFlowRateRatio > this->MaxWaterFlowRatio) { + WaterFlowRateRatioCapped = this->MaxWaterFlowRatio; } if (!state.dataGlobal->WarmupFlag) { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintWFRRMessage = true; - state.dataCondenserLoopTowers->towers(this->VSTower).WFRRBuffer1 = - format("{} \"{}\" - Water flow rate ratio is outside model boundaries at {}.", - DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], - this->Name, - OutputChar); - state.dataCondenserLoopTowers->towers(this->VSTower).WFRRBuffer2 = - " ...Valid range = " + OutputCharLo + " to " + OutputCharHi + ". Occurrence info = " + state.dataEnvrn->EnvironmentName + - ", " + state.dataEnvrn->CurMnDy + ' ' + General::CreateSysTimeIntervalString(state); + this->PrintWFRRMessage = true; + this->WFRRBuffer1 = format("{} \"{}\" - Water flow rate ratio is outside model boundaries at {}.", + DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], + this->Name, + OutputChar); + this->WFRRBuffer2 = " ...Valid range = " + OutputCharLo + " to " + OutputCharHi + + ". Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + state.dataEnvrn->CurMnDy + ' ' + + General::CreateSysTimeIntervalString(state); TrimValue = format("{:.5R}", WaterFlowRateRatioCapped); - state.dataCondenserLoopTowers->towers(this->VSTower).WFRRBuffer3 = " ...Water flow rate ratio passed to the model = " + TrimValue; - state.dataCondenserLoopTowers->towers(this->VSTower).WaterFlowRateRatioLast = WaterFlowRateRatio; + this->WFRRBuffer3 = " ...Water flow rate ratio passed to the model = " + TrimValue; + this->WaterFlowRateRatioLast = WaterFlowRateRatio; } else { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintWFRRMessage = false; + this->PrintWFRRMessage = false; } } else { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintWFRRMessage = false; + this->PrintWFRRMessage = false; } } } @@ -6207,7 +5930,7 @@ namespace CondenserLoopTowers { // A Flament, July 2010. Added multi-cell capability // PURPOSE OF THIS SUBROUTINE: - // Collect tower water useage calculations for reuse by all the tower models. + // Collect tower water usage calculations for reuse by all the tower models. // REFERENCES: // Code for this routine started from VariableSpeedTower @@ -6240,11 +5963,7 @@ namespace CondenserLoopTowers { Real64 const TairAvg = (this->AirTemp + OutletAirTSat) / 2.0; // Amount of water evaporated, get density water at air temp or 4 C if too cold - Real64 const rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - max(TairAvg, 4.0), - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 const rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, max(TairAvg, 4.0), RoutineName); EvapVdot = (AirMassFlowRate * (OutSpecificHumRat - InSpecificHumRat)) / rho; // [m3/s] if (EvapVdot < 0.0) EvapVdot = 0.0; @@ -6253,11 +5972,7 @@ namespace CondenserLoopTowers { } } else if (this->EvapLossMode == EvapLoss::UserFactor) { - Real64 const rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - AverageWaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 const rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, AverageWaterTemp, RoutineName); EvapVdot = this->UserEvapLossFactor * (this->InletWaterTemp - this->OutletWaterTemp) * (this->WaterMassFlowRate / rho); if (EvapVdot < 0.0) EvapVdot = 0.0; @@ -6271,11 +5986,7 @@ namespace CondenserLoopTowers { Real64 BlowDownVdot(0.0); if (this->BlowdownMode == Blowdown::Schedule) { // Amount of water lost due to blow down (purging contaminants from tower basin) - if (this->SchedIDBlowdown > 0) { - BlowDownVdot = ScheduleManager::GetCurrentScheduleValue(state, this->SchedIDBlowdown); - } else { - BlowDownVdot = 0.0; - } + BlowDownVdot = (this->blowdownSched != nullptr) ? this->blowdownSched->getCurrentVal() : 0.0; } else if (this->BlowdownMode == Blowdown::Concentration) { if (this->ConcentrationRatio > 2.0) { // protect divide by zero BlowDownVdot = EvapVdot / (this->ConcentrationRatio - 1) - driftVdot; @@ -6351,7 +6062,7 @@ namespace CondenserLoopTowers { state.dataGlobal->WarmupFlag) return; - // Check flow rate through tower and compare to design flow rate, show warning if greater than Design * Mulitplier + // Check flow rate through tower and compare to design flow rate, show warning if greater than Design * Multiplier if (state.dataLoopNodes->Node(this->WaterOutletNodeNum).MassFlowRate > this->DesWaterMassFlowRate * this->TowerMassFlowRateMultiplier) { ++this->HighMassFlowErrorCount; if (this->HighMassFlowErrorCount < 2) { @@ -6464,16 +6175,88 @@ namespace CondenserLoopTowers { this->WaterMassFlowRate = 0.0; PlantUtilities::SetComponentFlowRate(state, this->WaterMassFlowRate, this->WaterInletNodeNum, this->WaterOutletNodeNum, this->plantLoc); CalcBasinHeaterPower( - state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); + state, this->BasinHeaterPowerFTempDiff, this->basinHeaterSched, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); returnFlagSet = true; } else if (this->WaterMassFlowRate <= DataBranchAirLoopPlant::MassFlowTolerance) { // for multiple cells, we assume that it's a common basin CalcBasinHeaterPower( - state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); + state, this->BasinHeaterPowerFTempDiff, this->basinHeaterSched, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); returnFlagSet = true; } } + Real64 CoolingTower::getDynamicMaxCapacity(EnergyPlusData &state) + { + // TODO: does not include faults object impact + static constexpr std::string_view routineName("getDynamicMaxCapacity"); + Real64 outletWaterTemp = 0.0; + Real64 constexpr designWetBulb = 25.56; + Real64 constexpr airFlowRateRatio = 1.0; + Real64 constexpr waterFlowRateRatio = 1.0; + Real64 const CpWater = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp, routineName); + // use operating max (i.e., at current plant flow rates, could be 0 if plant is off) or max available capacity? + // Real64 waterMassFlowRate = state.dataLoopNodes->Node(this->WaterInletNodeNum).MassFlowRateMaxAvail; + Real64 waterMassFlowRate = this->DesWaterMassFlowRate; + this->AirWetBulb = (this->OutdoorAirInletNodeNum > 0) ? state.dataLoopNodes->Node(this->OutdoorAirInletNodeNum).OutAirWetBulb + : state.dataEnvrn->OutWetBulbTemp; + + switch (this->TowerType) { + case DataPlant::PlantEquipmentType::CoolingTower_SingleSpd: + case DataPlant::PlantEquipmentType::CoolingTower_TwoSpd: { + // only needed for calculateSimpleTowerOutletTemp + this->AirTemp = + (this->OutdoorAirInletNodeNum > 0) ? state.dataLoopNodes->Node(this->OutdoorAirInletNodeNum).Temp : state.dataEnvrn->OutDryBulbTemp; + Real64 WaterMassFlowRatePerCell = waterMassFlowRate / this->NumCell; + Real64 UAdesign = this->HighSpeedTowerUA / this->NumCell; // could save these calculations in e.g., this->DesUAPerCell + Real64 AirFlowRate = this->HighSpeedAirFlowRate / this->NumCell; + outletWaterTemp = this->calculateSimpleTowerOutletTemp(state, WaterMassFlowRatePerCell, AirFlowRate, UAdesign); + } break; + case DataPlant::PlantEquipmentType::CoolingTower_VarSpd: { + Real64 TrCapped; // range temp passed to VS tower model + Real64 TaCapped; // approach temp passed to VS tower model + Real64 Twb = this->AirWetBulb; + Real64 TwbCapped = this->AirWetBulb; + // water temperature setpoint + Real64 TempSetPoint(0.0); // Outlet water temperature setpoint (C) + switch (state.dataPlnt->PlantLoop(this->plantLoc.loopNum).LoopDemandCalcScheme) { + case DataPlant::LoopDemandCalcScheme::SingleSetPoint: { + TempSetPoint = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).LoopSide(this->plantLoc.loopSideNum).TempSetPoint; + } break; + case DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand: { + TempSetPoint = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).LoopSide(this->plantLoc.loopSideNum).TempSetPointHi; + } break; + default: { + assert(false); + } break; + } + Real64 Tr = state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp - TempSetPoint; + Real64 Ta = TempSetPoint - this->AirWetBulb; + Real64 waterFlowRateRatioCapped = 0.0; // Water flow rate ratio passed to VS tower model + // check independent inputs with respect to model boundaries + this->checkModelBounds(state, Twb, Tr, Ta, waterFlowRateRatio, TwbCapped, TrCapped, TaCapped, waterFlowRateRatioCapped); + outletWaterTemp = this->calculateVariableTowerOutletTemp(state, waterFlowRateRatioCapped, airFlowRateRatio, TwbCapped); + } break; + case DataPlant::PlantEquipmentType::CoolingTower_VarSpdMerkel: { + // only needed for calculateSimpleTowerOutletTemp + this->AirTemp = + (this->OutdoorAirInletNodeNum > 0) ? state.dataLoopNodes->Node(this->OutdoorAirInletNodeNum).Temp : state.dataEnvrn->OutDryBulbTemp; + Real64 const UAdesignPerCell = this->HighSpeedTowerUA / this->NumCell; + Real64 const airFlowRatePerCell = this->HighSpeedAirFlowRate / this->NumCell; + Real64 const waterMassFlowRatePerCell = waterMassFlowRate / this->NumCell; + Real64 const WaterFlowRateRatio = waterMassFlowRatePerCell / this->DesWaterMassFlowRatePerCell; // this should always be 1 ? + Real64 const UAwetbulbAdjFac = Curve::CurveValue(state, this->UAModFuncWetBulbDiffCurvePtr, (designWetBulb - this->AirWetBulb)); + Real64 const UAairflowAdjFac = Curve::CurveValue(state, this->UAModFuncAirFlowRatioCurvePtr, airFlowRateRatio); + Real64 const UAwaterflowAdjFac = Curve::CurveValue(state, this->UAModFuncWaterFlowRatioCurvePtr, WaterFlowRateRatio); + Real64 const UAadjustedPerCell = UAdesignPerCell * UAwetbulbAdjFac * UAairflowAdjFac * UAwaterflowAdjFac; + outletWaterTemp = this->calculateSimpleTowerOutletTemp(state, waterMassFlowRatePerCell, airFlowRatePerCell, UAadjustedPerCell); + } break; + default: + assert(false); + } + return waterMassFlowRate * CpWater * (state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp - outletWaterTemp); + } + } // namespace CondenserLoopTowers } // namespace EnergyPlus diff --git a/src/EnergyPlus/CondenserLoopTowers.hh b/src/EnergyPlus/CondenserLoopTowers.hh index 16170e121cf..3cceb996815 100644 --- a/src/EnergyPlus/CondenserLoopTowers.hh +++ b/src/EnergyPlus/CondenserLoopTowers.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -195,10 +195,9 @@ namespace CondenserLoopTowers { int WaterOutletNodeNum = 0; // Node number on the water outlet side of the tower int OutdoorAirInletNodeNum = 0; // Node number of outdoor air inlet for the tower ModelType TowerModelType = ModelType::Invalid; // Type of empirical model (1=CoolTools) - int VSTower = 0; // Index to a variable speed tower (otherwise = 0) int FanPowerfAirFlowCurve = 0; // Index to fan power correlation curve for VS Towers - int BlowDownSchedulePtr = 0; // Pointer to blow down schedule - int BasinHeaterSchedulePtr = 0; // Pointer to basin heater schedule + Sched::Schedule *blowDownSched = nullptr; // Pointer to blow down schedule + Sched::Schedule *basinHeaterSched = nullptr; // Pointer to basin heater schedule int HighMassFlowErrorCount = 0; // Counter when mass flow rate is > Design*TowerMassFlowRateMultiplier int HighMassFlowErrorIndex = 0; // Index for high mass flow recurring error message int OutletWaterTempErrorCount = 0; // Counter when outlet water temperature is < minimum allowed temperature @@ -229,7 +228,7 @@ namespace CondenserLoopTowers { Real64 DriftLossFraction = 0.008; // default value is 0.008% Blowdown BlowdownMode = Blowdown::Concentration; // sets how tower water blowdown is modeled Real64 ConcentrationRatio = 3.0; // ratio of solids in blowdown vs make up water - int SchedIDBlowdown = 0; // index "pointer" to schedule of blowdown in [m3/s] + Sched::Schedule *blowdownSched = nullptr; // index "pointer" to schedule of blowdown in [m3/s] bool SuppliedByWaterSystem = false; int WaterTankID = 0; // index "pointer" to WaterStorage structure int WaterTankDemandARRID = 0; // index "pointer" to demand array inside WaterStorage structure @@ -430,6 +429,8 @@ namespace CondenserLoopTowers { void checkMassFlowAndLoad(EnergyPlusData &state, Real64 MyLoad, bool RunFlag, bool &returnFlagSet); static CoolingTower *factory(EnergyPlusData &state, std::string_view objectName); + + Real64 getDynamicMaxCapacity(EnergyPlusData &state) override; }; void GetTowerInput(EnergyPlusData &state); @@ -441,6 +442,10 @@ struct CondenserLoopTowersData : BaseGlobalStruct bool GetInput = true; Array1D towers; // dimension to number of machines + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ConfiguredFunctions.hh b/src/EnergyPlus/ConfiguredFunctions.hh index c3397e05375..039b0e2cf05 100644 --- a/src/EnergyPlus/ConfiguredFunctions.hh +++ b/src/EnergyPlus/ConfiguredFunctions.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/ConfiguredFunctions.in.cc b/src/EnergyPlus/ConfiguredFunctions.in.cc index bbab1ab7122..3e1e63d4ea2 100644 --- a/src/EnergyPlus/ConfiguredFunctions.in.cc +++ b/src/EnergyPlus/ConfiguredFunctions.in.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Construction.cc b/src/EnergyPlus/Construction.cc index 267e9f56ed5..cb1225a78ad 100644 --- a/src/EnergyPlus/Construction.cc +++ b/src/EnergyPlus/Construction.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -2025,18 +2025,6 @@ void ConstructionProps::setArraysBasedOnMaxSolidWinLayers(EnergyPlusData &state) this->rbBareVisCoef.allocate(state.dataHeatBal->MaxSolidWinLayers); this->afBareSolCoef.allocate(state.dataHeatBal->MaxSolidWinLayers); this->abBareSolCoef.allocate(state.dataHeatBal->MaxSolidWinLayers); - for (int Layer = 1; Layer <= state.dataHeatBal->MaxSolidWinLayers; ++Layer) { - this->AbsBeamCoef(Layer).allocate(DataSurfaces::MaxPolyCoeff); - this->AbsBeamBackCoef(Layer).allocate(DataSurfaces::MaxPolyCoeff); - this->tBareSolCoef(Layer).allocate(DataSurfaces::MaxPolyCoeff); - this->tBareVisCoef(Layer).allocate(DataSurfaces::MaxPolyCoeff); - this->rfBareSolCoef(Layer).allocate(DataSurfaces::MaxPolyCoeff); - this->rfBareVisCoef(Layer).allocate(DataSurfaces::MaxPolyCoeff); - this->rbBareSolCoef(Layer).allocate(DataSurfaces::MaxPolyCoeff); - this->rbBareVisCoef(Layer).allocate(DataSurfaces::MaxPolyCoeff); - this->afBareSolCoef(Layer).allocate(DataSurfaces::MaxPolyCoeff); - this->abBareSolCoef(Layer).allocate(DataSurfaces::MaxPolyCoeff); - } for (int Layer = 1; Layer <= state.dataHeatBal->MaxSolidWinLayers; ++Layer) { this->AbsDiff(Layer) = 0.0; @@ -2053,18 +2041,16 @@ void ConstructionProps::setArraysBasedOnMaxSolidWinLayers(EnergyPlusData &state) } } for (int Layer = 1; Layer <= state.dataHeatBal->MaxSolidWinLayers; ++Layer) { - for (int Index = 1; Index <= DataSurfaces::MaxPolyCoeff; ++Index) { - this->AbsBeamCoef(Layer)(Index) = 0.0; - this->AbsBeamBackCoef(Layer)(Index) = 0.0; - this->tBareSolCoef(Layer)(Index) = 0.0; - this->tBareVisCoef(Layer)(Index) = 0.0; - this->rfBareSolCoef(Layer)(Index) = 0.0; - this->rfBareVisCoef(Layer)(Index) = 0.0; - this->rbBareSolCoef(Layer)(Index) = 0.0; - this->rbBareVisCoef(Layer)(Index) = 0.0; - this->afBareSolCoef(Layer)(Index) = 0.0; - this->abBareSolCoef(Layer)(Index) = 0.0; - } + std::fill(this->AbsBeamCoef(Layer).begin(), this->AbsBeamCoef(Layer).end(), 0.0); + std::fill(this->AbsBeamBackCoef(Layer).begin(), this->AbsBeamBackCoef(Layer).end(), 0.0); + std::fill(this->tBareSolCoef(Layer).begin(), this->tBareSolCoef(Layer).end(), 0.0); + std::fill(this->tBareVisCoef(Layer).begin(), this->tBareVisCoef(Layer).end(), 0.0); + std::fill(this->rfBareSolCoef(Layer).begin(), this->rfBareSolCoef(Layer).end(), 0.0); + std::fill(this->rfBareVisCoef(Layer).begin(), this->rfBareVisCoef(Layer).end(), 0.0); + std::fill(this->rbBareSolCoef(Layer).begin(), this->rbBareSolCoef(Layer).end(), 0.0); + std::fill(this->rbBareVisCoef(Layer).begin(), this->rbBareVisCoef(Layer).end(), 0.0); + std::fill(this->afBareSolCoef(Layer).begin(), this->afBareSolCoef(Layer).end(), 0.0); + std::fill(this->abBareSolCoef(Layer).begin(), this->abBareSolCoef(Layer).end(), 0.0); } } diff --git a/src/EnergyPlus/Construction.hh b/src/EnergyPlus/Construction.hh index 1c95c7b513a..8f6936d8cfc 100644 --- a/src/EnergyPlus/Construction.hh +++ b/src/EnergyPlus/Construction.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -55,6 +55,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -212,46 +213,42 @@ namespace Construction { // Sol diffuse absorptance per glass layer with blind on Array1D> layerSlatBlindDfAbs; - Array1D AbsDiffBack; // Diffuse back solar absorptance for each glass layer - Real64 AbsDiffShade = 0.0; // Diffuse solar absorptance for shade - Real64 AbsDiffBackShade = 0.0; // Diffuse back solar absorptance for shade - Real64 ShadeAbsorpThermal = 0.0; // Diffuse back thermal absorptance of shade - Array1D> AbsBeamCoef; // Coefficients of incidence-angle polynomial for solar + Array1D AbsDiffBack; // Diffuse back solar absorptance for each glass layer + Real64 AbsDiffShade = 0.0; // Diffuse solar absorptance for shade + Real64 AbsDiffBackShade = 0.0; // Diffuse back solar absorptance for shade + Real64 ShadeAbsorpThermal = 0.0; // Diffuse back thermal absorptance of shade + Array1D> AbsBeamCoef; // Coefficients of incidence-angle polynomial for solar // absorptance for each solid glazing layer - Array1D> AbsBeamBackCoef; // As for AbsBeamCoef but for back-incident solar - Array1D AbsBeamShadeCoef; // Coefficients of incidence-angle polynomial for solar - // absorptance of shade + Array1D> AbsBeamBackCoef; // As for AbsBeamCoef but for back-incident solar + std::array AbsBeamShadeCoef = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Shade abs inc-angle coefs Real64 TransDiff = 0.0; // Diffuse solar transmittance, bare glass or shade on Real64 TransDiffVis; // Diffuse visible transmittance, bare glass or shade on Real64 ReflectSolDiffBack = 0.0; // Diffuse back solar reflectance, bare glass or shade on Real64 ReflectSolDiffFront = 0.0; // Diffuse front solar reflectance, bare glass or shade on Real64 ReflectVisDiffBack = 0.0; // Diffuse back visible reflectance, bare glass or shade on Real64 ReflectVisDiffFront = 0.0; // Diffuse front visible reflectance, bare glass or shade on - Array1D TransSolBeamCoef; // Coeffs of incidence-angle polynomial for beam sol trans, - // bare glass or shade on - Array1D TransVisBeamCoef; // Coeffs of incidence-angle polynomial for beam vis trans, - // bare glass or shade on - Array1D ReflSolBeamFrontCoef; // Coeffs of incidence-angle polynomial for beam sol front refl, - // bare glass or shade on - Array1D ReflSolBeamBackCoef; // Like ReflSolBeamFrontCoef, but for back-incident beam solar - Array1D> tBareSolCoef; // Isolated glass solar transmittance coeffs of inc. angle polynomial - Array1D> tBareVisCoef; // Isolated glass visible transmittance coeffs of inc. angle polynomial - Array1D> rfBareSolCoef; // Isolated glass front solar reflectance coeffs of inc. angle polynomial - Array1D> rfBareVisCoef; // Isolated glass front visible reflectance coeffs of inc. angle polynomial - Array1D> rbBareSolCoef; // Isolated glass back solar reflectance coeffs of inc. angle polynomial - Array1D> rbBareVisCoef; // Isolated glass back visible reflectance coeffs of inc. angle polynomial - Array1D> afBareSolCoef; // Isolated glass front solar absorptance coeffs of inc. angle polynomial - Array1D> abBareSolCoef; // Isolated glass back solar absorptance coeffs of inc. angle polynomial - Array1D tBareSolDiff; // Isolated glass diffuse solar transmittance - Array1D tBareVisDiff; // Isolated glass diffuse visible transmittance - Array1D rfBareSolDiff; // Isolated glass diffuse solar front reflectance - Array1D rfBareVisDiff; // Isolated glass diffuse visible front reflectance - Array1D rbBareSolDiff; // Isolated glass diffuse solar back reflectance - Array1D rbBareVisDiff; // Isolated glass diffuse visible back reflectance - Array1D afBareSolDiff; // Isolated glass diffuse solar front absorptance - Array1D abBareSolDiff; // Isolated glass diffuse solar back absorptance - bool FromWindow5DataFile = false; // True if this is a window construction extracted from the Window5 data file - Real64 W5FileMullionWidth = 0.0; // Width of mullion for construction from Window5 data file (m) + std::array TransSolBeamCoef = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // beam sol trans inc-angle coefs + std::array TransVisBeamCoef = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // beam vis trans inc-angle coefs + std::array ReflSolBeamFrontCoef = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // beam sol ref front inc-angle coefs + std::array ReflSolBeamBackCoef = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // beam sol ref back inc-angle coefs + Array1D> tBareSolCoef; // Isolated glass solar transmittance coeffs of inc. angle polynomial + Array1D> tBareVisCoef; // Isolated glass visible transmittance coeffs of inc. angle polynomial + Array1D> rfBareSolCoef; // Isolated glass front solar reflectance coeffs of inc. angle polynomial + Array1D> rfBareVisCoef; // Isolated glass front visible reflectance coeffs of inc. angle polynomial + Array1D> rbBareSolCoef; // Isolated glass back solar reflectance coeffs of inc. angle polynomial + Array1D> rbBareVisCoef; // Isolated glass back visible reflectance coeffs of inc. angle polynomial + Array1D> afBareSolCoef; // Isolated glass front solar absorptance coeffs of inc. angle polynomial + Array1D> abBareSolCoef; // Isolated glass back solar absorptance coeffs of inc. angle polynomial + Array1D tBareSolDiff; // Isolated glass diffuse solar transmittance + Array1D tBareVisDiff; // Isolated glass diffuse visible transmittance + Array1D rfBareSolDiff; // Isolated glass diffuse solar front reflectance + Array1D rfBareVisDiff; // Isolated glass diffuse visible front reflectance + Array1D rbBareSolDiff; // Isolated glass diffuse solar back reflectance + Array1D rbBareVisDiff; // Isolated glass diffuse visible back reflectance + Array1D afBareSolDiff; // Isolated glass diffuse solar front absorptance + Array1D abBareSolDiff; // Isolated glass diffuse solar back absorptance + bool FromWindow5DataFile = false; // True if this is a window construction extracted from the Window5 data file + Real64 W5FileMullionWidth = 0.0; // Width of mullion for construction from Window5 data file (m) DataWindowEquivalentLayer::Orientation W5FileMullionOrientation = DataWindowEquivalentLayer::Orientation::Invalid; // Orientation of mullion, if present, for Window5 data file construction, Real64 W5FileGlazingSysWidth = 0.0; // Glass width for construction from Window5 data file (m) @@ -298,10 +295,10 @@ namespace Construction { Real64 TransDiffFrontEQL = 0.0; // Diffuse system front transmittance for EQL window Real64 TransDiffBackEQL = 0.0; // Diffuse system back transmittance for EQL window // Air boundary - bool TypeIsAirBoundary = false; // true for Construction:AirBoundary - bool TypeIsAirBoundaryMixing = false; // true for Construction:AirBoundary with SimpleMixing for air exchange - Real64 AirBoundaryACH = 0.0; // Air boundary simple mixing air changes per hour [1/hr] - int AirBoundaryMixingSched = 0; // Air boundary simple mixing schedule index + bool TypeIsAirBoundary = false; // true for Construction:AirBoundary + bool TypeIsAirBoundaryMixing = false; // true for Construction:AirBoundary with SimpleMixing for air exchange + Real64 AirBoundaryACH = 0.0; // Air boundary simple mixing air changes per hour [1/hr] + Sched::Schedule *airBoundaryMixingSched = nullptr; // Air boundary simple mixing schedule index int rcmax = 0; // Total number of nodes in the construct (<= MaxTotNodes) Array2D AExp; // Exponential of AMat @@ -325,8 +322,7 @@ namespace Construction { // Default Constructor ConstructionProps() - : LayerPoint(MaxLayersInConstruct, 0), AbsBeamShadeCoef(6, 0.0), TransDiffVis(0.0), TransSolBeamCoef(6, 0.0), TransVisBeamCoef(6, 0.0), - ReflSolBeamFrontCoef(6, 0.0), ReflSolBeamBackCoef(6, 0.0), tBareSolDiff(5, 0.0), tBareVisDiff(5, 0.0), rfBareSolDiff(5, 0.0), + : LayerPoint(MaxLayersInConstruct, 0), TransDiffVis(0.0), tBareSolDiff(5, 0.0), tBareVisDiff(5, 0.0), rfBareSolDiff(5, 0.0), rfBareVisDiff(5, 0.0), rbBareSolDiff(5, 0.0), rbBareVisDiff(5, 0.0), afBareSolDiff(5, 0.0), abBareSolDiff(5, 0.0), AbsDiffFrontEQL(DataWindowEquivalentLayer::CFSMAXNL, 0.0), AbsDiffBackEQL(DataWindowEquivalentLayer::CFSMAXNL, 0.0) { @@ -367,6 +363,10 @@ struct ConstructionData : BaseGlobalStruct Array1D Construct; Array1D_int LayerPoint = Array1D(Construction::MaxLayersInConstruct, 0); + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ConvectionCoefficients.cc b/src/EnergyPlus/ConvectionCoefficients.cc index 8524c1b5800..3c91903ba2f 100644 --- a/src/EnergyPlus/ConvectionCoefficients.cc +++ b/src/EnergyPlus/ConvectionCoefficients.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -434,9 +434,8 @@ void InitExtConvCoeff(EnergyPlusData &state, if (surface.SurfHasSurroundingSurfProperty) { int SrdSurfsNum = surface.SurfSurroundingSurfacesNum; - if (state.dataSurface->SurroundingSurfsProperty(SrdSurfsNum).SkyTempSchNum != 0) { - TSky = ScheduleManager::GetCurrentScheduleValue(state, state.dataSurface->SurroundingSurfsProperty(SrdSurfsNum).SkyTempSchNum) + - Constant::Kelvin; + if (state.dataSurface->SurroundingSurfsProperty(SrdSurfsNum).skyTempSched != nullptr) { + TSky = state.dataSurface->SurroundingSurfsProperty(SrdSurfsNum).skyTempSched->getCurrentVal() + Constant::Kelvin; } HSrdSurf = SurroundingSurfacesRadCoeffAverage(state, SurfNum, TSurf, AbsExt); } @@ -1090,26 +1089,21 @@ void GetUserConvCoeffs(EnergyPlusData &state) userExtConvModel.SurfaceName = Alphas(1); userExtConvModel.WhichSurface = surfNum; userExtConvModel.overrideType = OverrideType::Schedule; - userExtConvModel.ScheduleIndex = ScheduleManager::GetScheduleIndex(state, Alphas(Ptr + 2)); - if (userExtConvModel.ScheduleIndex == 0) { + if ((userExtConvModel.sched = Sched::GetSchedule(state, Alphas(Ptr + 2))) == nullptr) { ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(Ptr + 2), Alphas(Ptr + 2)); ErrorsFound = true; - } else if (!ScheduleManager::CheckScheduleValueMinMax(state, - userExtConvModel.ScheduleIndex, - ScheduleManager::Clusivity::Inclusive, - state.dataHeatBal->LowHConvLimit, // >= - ScheduleManager::Clusivity::Inclusive, - state.dataHeatBal->HighHConvLimit)) { // <= - ShowSevereScheduleOutOfRange(state, - eoh, - ipsc->cAlphaFieldNames(Ptr + 2), - Alphas(Ptr + 2), - state.dataHeatBal->LowHConvLimit, - state.dataHeatBal->HighHConvLimit, - "Limits are set (or default) in HeatBalanceAlgorithm object."); + } else if (!userExtConvModel.sched->checkMinMaxVals( + state, Clusive::In, state.dataHeatBal->LowHConvLimit, Clusive::In, state.dataHeatBal->HighHConvLimit)) { + Sched::ShowSevereBadMinMax(state, + eoh, + ipsc->cAlphaFieldNames(Ptr + 2), + Alphas(Ptr + 2), + Clusive::In, + state.dataHeatBal->LowHConvLimit, + Clusive::In, + state.dataHeatBal->HighHConvLimit, + "Limits are set (or default) in HeatBalanceAlgorithm object."); ErrorsFound = true; - } else { - userExtConvModel.ScheduleName = Alphas(Ptr + 2); } ApplyExtConvValue(state, surfNum, hcExt, state.dataSurface->TotUserExtConvModels); } break; @@ -1197,13 +1191,15 @@ void GetUserConvCoeffs(EnergyPlusData &state) userIntConvModel.SurfaceName = Alphas(1); userIntConvModel.WhichSurface = surfNum; if (Numbers(NumField) < state.dataHeatBal->LowHConvLimit || Numbers(NumField) > state.dataHeatBal->HighHConvLimit) { - ShowSevereValueOutOfRange(state, - eoh, - ipsc->cNumericFieldNames(NumField), - Numbers(NumField), - state.dataHeatBal->LowHConvLimit, - state.dataHeatBal->HighHConvLimit, - "Limits are set (or default) in HeatBalanceAlgorithm object."); + ShowSevereBadMinMax(state, + eoh, + ipsc->cNumericFieldNames(NumField), + Numbers(NumField), + Clusive::In, + state.dataHeatBal->LowHConvLimit, + Clusive::In, + state.dataHeatBal->HighHConvLimit, + "Limits are set (or default) in HeatBalanceAlgorithm object."); ErrorsFound = true; } userIntConvModel.overrideType = OverrideType::Value; @@ -1225,26 +1221,21 @@ void GetUserConvCoeffs(EnergyPlusData &state) userIntConvModel.SurfaceName = Alphas(1); userIntConvModel.WhichSurface = surfNum; userIntConvModel.overrideType = OverrideType::Schedule; - userIntConvModel.ScheduleIndex = ScheduleManager::GetScheduleIndex(state, Alphas(Ptr + 2)); - if (userIntConvModel.ScheduleIndex == 0) { + if ((userIntConvModel.sched = Sched::GetSchedule(state, Alphas(Ptr + 2))) == nullptr) { ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(Ptr + 2), Alphas(Ptr + 2)); ErrorsFound = true; - } else if (!ScheduleManager::CheckScheduleValueMinMax(state, - userIntConvModel.ScheduleIndex, - ScheduleManager::Clusivity::Inclusive, - state.dataHeatBal->LowHConvLimit, - ScheduleManager::Clusivity::Inclusive, - state.dataHeatBal->HighHConvLimit)) { - ShowSevereScheduleOutOfRange(state, - eoh, - ipsc->cAlphaFieldNames(Ptr + 2), - Alphas(Ptr + 2), - state.dataHeatBal->LowHConvLimit, - state.dataHeatBal->HighHConvLimit, - "Limits are set (or default) in HeatBalanceAlgorithm object."); + } else if (!userIntConvModel.sched->checkMinMaxVals( + state, Clusive::In, state.dataHeatBal->LowHConvLimit, Clusive::In, state.dataHeatBal->HighHConvLimit)) { + Sched::ShowSevereBadMinMax(state, + eoh, + ipsc->cAlphaFieldNames(Ptr + 2), + Alphas(Ptr + 2), + Clusive::In, + state.dataHeatBal->LowHConvLimit, + Clusive::In, + state.dataHeatBal->HighHConvLimit, + "Limits are set (or default) in HeatBalanceAlgorithm object."); ErrorsFound = true; - } else { - userIntConvModel.ScheduleName = Alphas(Ptr + 2); } ApplyIntConvValue(state, surfNum, hcInt, state.dataSurface->TotUserIntConvModels); } break; @@ -1332,13 +1323,15 @@ void GetUserConvCoeffs(EnergyPlusData &state) userExtConvModel.SurfaceName = Alphas(Ptr); userExtConvModel.WhichSurface = -999; if (Numbers(NumField) < state.dataHeatBal->LowHConvLimit || Numbers(NumField) > state.dataHeatBal->HighHConvLimit) { - ShowSevereValueOutOfRange(state, - eoh, - ipsc->cNumericFieldNames(NumField), - Numbers(NumField), - state.dataHeatBal->LowHConvLimit, - state.dataHeatBal->HighHConvLimit, - "Limits are set (or default) in HeatBalanceAlgorithm object."); + ShowSevereBadMinMax(state, + eoh, + ipsc->cNumericFieldNames(NumField), + Numbers(NumField), + Clusive::In, + state.dataHeatBal->LowHConvLimit, + Clusive::In, + state.dataHeatBal->HighHConvLimit, + "Limits are set (or default) in HeatBalanceAlgorithm object."); ErrorsFound = true; } userExtConvModel.overrideType = OverrideType::Value; @@ -1360,26 +1353,21 @@ void GetUserConvCoeffs(EnergyPlusData &state) userExtConvModel.SurfaceName = Alphas(Ptr); userExtConvModel.WhichSurface = -999; userExtConvModel.overrideType = OverrideType::Schedule; - userExtConvModel.ScheduleIndex = ScheduleManager::GetScheduleIndex(state, Alphas(Ptr + 2)); - if (userExtConvModel.ScheduleIndex == 0) { + if ((userExtConvModel.sched = Sched::GetSchedule(state, Alphas(Ptr + 2))) == nullptr) { ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(Ptr + 2), Alphas(Ptr + 2)); ErrorsFound = true; - } else if (!ScheduleManager::CheckScheduleValueMinMax(state, - userExtConvModel.ScheduleIndex, - ScheduleManager::Clusivity::Inclusive, - state.dataHeatBal->LowHConvLimit, // >= - ScheduleManager::Clusivity::Inclusive, - state.dataHeatBal->HighHConvLimit)) { // <= - ShowSevereScheduleOutOfRange(state, - eoh, - ipsc->cAlphaFieldNames(Ptr + 2), - Alphas(Ptr + 2), - state.dataHeatBal->LowHConvLimit, - state.dataHeatBal->HighHConvLimit, - "Limits are set (or default) in HeatBalanceAlgorithm object."); + } else if (!userExtConvModel.sched->checkMinMaxVals( + state, Clusive::In, state.dataHeatBal->LowHConvLimit, Clusive::In, state.dataHeatBal->HighHConvLimit)) { + Sched::ShowSevereBadMinMax(state, + eoh, + ipsc->cAlphaFieldNames(Ptr + 2), + Alphas(Ptr + 2), + Clusive::In, + state.dataHeatBal->LowHConvLimit, + Clusive::In, + state.dataHeatBal->HighHConvLimit, + "Limits are set (or default) in HeatBalanceAlgorithm object."); ErrorsFound = true; - } else { - userExtConvModel.ScheduleName = Alphas(Ptr + 2); } ApplyExtConvValueMulti(state, surfaceFilter, hcExt, state.dataSurface->TotUserExtConvModels); } break; @@ -1449,13 +1437,15 @@ void GetUserConvCoeffs(EnergyPlusData &state) userIntConvModel.SurfaceName = Alphas(Ptr); userIntConvModel.WhichSurface = -999; if (Numbers(NumField) < state.dataHeatBal->LowHConvLimit || Numbers(NumField) > state.dataHeatBal->HighHConvLimit) { - ShowSevereValueOutOfRange(state, - eoh, - ipsc->cNumericFieldNames(NumField), - Numbers(NumField), - state.dataHeatBal->LowHConvLimit, - state.dataHeatBal->HighHConvLimit, - "Limits are set (or default) in HeatBalanceAlgorithm object."); + ShowSevereBadMinMax(state, + eoh, + ipsc->cNumericFieldNames(NumField), + Numbers(NumField), + Clusive::In, + state.dataHeatBal->LowHConvLimit, + Clusive::In, + state.dataHeatBal->HighHConvLimit, + "Limits are set (or default) in HeatBalanceAlgorithm object."); ErrorsFound = true; } userIntConvModel.overrideType = OverrideType::Value; @@ -1477,26 +1467,24 @@ void GetUserConvCoeffs(EnergyPlusData &state) userIntConvModel.SurfaceName = Alphas(Ptr); userIntConvModel.WhichSurface = -999; userIntConvModel.overrideType = OverrideType::Schedule; - userIntConvModel.ScheduleIndex = ScheduleManager::GetScheduleIndex(state, Alphas(Ptr + 2)); - if (userIntConvModel.ScheduleIndex == 0) { + if ((userIntConvModel.sched = Sched::GetSchedule(state, Alphas(Ptr + 2))) == nullptr) { ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(Ptr + 2), Alphas(Ptr + 2)); ErrorsFound = true; - } else if (!ScheduleManager::CheckScheduleValueMinMax(state, - userIntConvModel.ScheduleIndex, - ScheduleManager::Clusivity::Inclusive, - state.dataHeatBal->LowHConvLimit, // >= - ScheduleManager::Clusivity::Inclusive, - state.dataHeatBal->HighHConvLimit)) { // <= - ShowSevereScheduleOutOfRange(state, - eoh, - ipsc->cAlphaFieldNames(Ptr + 2), - Alphas(Ptr + 2), - state.dataHeatBal->LowHConvLimit, - state.dataHeatBal->HighHConvLimit, - "Limits are set (or default) in HeatBalanceAlgorithm object."); + } else if (!userIntConvModel.sched->checkMinMaxVals(state, + Clusive::In, + state.dataHeatBal->LowHConvLimit, // >= + Clusive::In, + state.dataHeatBal->HighHConvLimit)) { // <= + Sched::ShowSevereBadMinMax(state, + eoh, + ipsc->cAlphaFieldNames(Ptr + 2), + Alphas(Ptr + 2), + Clusive::In, + state.dataHeatBal->LowHConvLimit, + Clusive::In, + state.dataHeatBal->HighHConvLimit, + "Limits are set (or default) in HeatBalanceAlgorithm object."); ErrorsFound = true; - } else { - userIntConvModel.ScheduleName = Alphas(Ptr + 2); } ApplyIntConvValueMulti(state, surfaceFilter, hcInt, state.dataSurface->TotUserIntConvModels); } break; @@ -2027,7 +2015,7 @@ Real64 CalcZoneSystemACH(EnergyPlusData &state, int const ZoneNum) Real64 ZoneVolFlowRate = CalcZoneSystemVolFlowRate(state, ZoneNum); // Calculate ACH - return ZoneVolFlowRate / ZoneVolume * Constant::SecInHour; + return ZoneVolFlowRate / ZoneVolume * Constant::rSecsInHour; } } @@ -2239,7 +2227,7 @@ void CalcCeilingDiffuserInletCorr(EnergyPlusData &state, ACH = 0.0; } else { // Calculate ACH (AR: can we please stop with these unparenthesized multiple divides? / / ) - ACH = ZoneMassFlowRate / AirDensity / ZoneVolume * Constant::SecInHour; + ACH = ZoneMassFlowRate / AirDensity / ZoneVolume * Constant::rSecsInHour; // Limit ACH to range of correlation ACH = min(ACH, MaxACH); ACH = max(ACH, 0.0); @@ -2433,7 +2421,7 @@ Real64 CalcNusselt(EnergyPlusData &state, auto const &surface = state.dataSurface->Surface(SurfNum); Real64 tilt = surface.Tilt; - Real64 tiltr = tilt * Constant::DegToRadians; + Real64 tiltr = tilt * Constant::DegToRad; Real64 costilt = surface.CosTilt; Real64 sintilt = surface.SinTilt; Real64 ra = gr * pr; // Rayleigh number @@ -2509,7 +2497,7 @@ Real64 SetExtConvCoeff(EnergyPlusData &state, int const SurfNum) // Surface Numb } break; case OverrideType::Schedule: { - HExt = ScheduleManager::GetCurrentScheduleValue(state, userExtConvModel.ScheduleIndex); + HExt = userExtConvModel.sched->getCurrentVal(); // Need to check for validity if (surface.ExtBoundCond == DataSurfaces::KivaFoundation) { state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].f = KIVA_HF_ZERO; @@ -2573,7 +2561,7 @@ Real64 SetIntConvCoeff(EnergyPlusData &state, int const SurfNum) // Surface Numb } break; case OverrideType::Schedule: { - HInt = ScheduleManager::GetCurrentScheduleValue(state, userIntConvModel.ScheduleIndex); + HInt = userIntConvModel.sched->getCurrentVal(); // Need to check for validity if (surface.ExtBoundCond == DataSurfaces::KivaFoundation) { state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].in = KIVA_CONST_CONV(HInt); @@ -4668,7 +4656,7 @@ Real64 CalcUserDefinedIntHcModel(EnergyPlusData &state, int const SurfNum, int c auto const &zoneNode = state.dataLoopNodes->Node(zone.SystemZoneNodeNumber); Real64 AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW( state, state.dataEnvrn->OutBaroPress, zoneNode.Temp, Psychrometrics::PsyWFnTdpPb(state, zoneNode.Temp, state.dataEnvrn->OutBaroPress)); - AirChangeRate = (zoneNode.MassFlowRate * Constant::SecInHour) / (AirDensity * zone.Volume); + AirChangeRate = (zoneNode.MassFlowRate * Constant::rSecsInHour) / (AirDensity * zone.Volume); auto const &zoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(surface.Zone); if (zoneEquipConfig.EquipListIndex > 0) { @@ -4779,12 +4767,12 @@ Real64 CalcUserDefinedExtHcModel(EnergyPlusData &state, int const SurfNum, int c case RefWind::ParallelComp: // WindSpeed , WindDir, surface Azimuth Theta = CalcWindSurfaceTheta(state.dataEnvrn->WindDir, surface.Azimuth); - ThetaRad = Theta * Constant::DegToRadians; + ThetaRad = Theta * Constant::DegToRad; break; case RefWind::ParallelCompAtZ: // Surface WindSpeed , Surface WindDir, surface Azimuth Theta = CalcWindSurfaceTheta(state.dataSurface->SurfOutWindDir(SurfNum), surface.Azimuth); - ThetaRad = Theta * Constant::DegToRadians; + ThetaRad = Theta * Constant::DegToRad; windVel = std::cos(ThetaRad) * state.dataSurface->SurfOutWindSpeed(SurfNum); break; default: @@ -6383,7 +6371,7 @@ Real64 CalcASTMC1340ConvCoeff(EnergyPlusData &state, int const SurfNum, Real64 c Real64 Nuf; // Nusselt number for forced convection Real64 Grc; // Critical Grashof number - constexpr Real64 g = Constant::GravityConstant; // Acceleration of gravity, m/s2 + constexpr Real64 g = Constant::Gravity; // Acceleration of gravity, m/s2 auto const &surface = state.dataSurface->Surface(SurfNum); @@ -6433,7 +6421,7 @@ Real64 CalcASTMC1340ConvCoeff(EnergyPlusData &state, int const SurfNum, Real64 c if (Tilt < 2) { Nun = 0.58 * std::pow(Ra, 0.2); } else { - Nun = 0.56 * std::pow(Ra * (std::sin(Tilt * Constant::DegToRadians)), 0.25); + Nun = 0.56 * std::pow(Ra * (std::sin(Tilt * Constant::DegToRad)), 0.25); } } else { // heat flow up if (Tilt < 15) { @@ -6447,7 +6435,7 @@ Real64 CalcASTMC1340ConvCoeff(EnergyPlusData &state, int const SurfNum, Real64 c Nun = 0.56 * std::pow(Ra * (std::sin(Tilt * 3.14159 / 180)), 0.25); } else { Nun = 0.14 * (std::pow(Ra, Constant::OneThird) - std::pow(Grc * Pr, Constant::OneThird)) + - 0.56 * std::pow(Grc * Pr * (std::sin(Tilt * Constant::DegToRadians)), 0.25); + 0.56 * std::pow(Grc * Pr * (std::sin(Tilt * Constant::DegToRad)), 0.25); } } } else if (Tilt == 180) { // Horizontal surface: Floor @@ -6463,7 +6451,7 @@ Real64 CalcASTMC1340ConvCoeff(EnergyPlusData &state, int const SurfNum, Real64 c if (Tilt > 178) { Nun = 0.58 * std::pow(Ra, 0.2); } else { - Nun = 0.56 * std::pow(Ra * (std::sin(Tilt * Constant::DegToRadians)), 0.25); + Nun = 0.56 * std::pow(Ra * (std::sin(Tilt * Constant::DegToRad)), 0.25); } } else { // heat flow up if (Tilt > 165) { @@ -6474,10 +6462,10 @@ Real64 CalcASTMC1340ConvCoeff(EnergyPlusData &state, int const SurfNum, Real64 c Grc = 5000000000; } if ((Ra / Pr) <= Grc) { - Nun = 0.56 * std::pow(Ra * (std::sin(Tilt * Constant::DegToRadians)), 0.25); + Nun = 0.56 * std::pow(Ra * (std::sin(Tilt * Constant::DegToRad)), 0.25); } else { Nun = 0.14 * (std::pow(Ra, Constant::OneThird) - std::pow(Grc * Pr, Constant::OneThird)) + - 0.56 * std::pow(Grc * Pr * (std::sin(Tilt * Constant::DegToRadians)), 0.25); + 0.56 * std::pow(Grc * Pr * (std::sin(Tilt * Constant::DegToRad)), 0.25); } } } else { // Vertical wall (Tilt = 90) @@ -6518,29 +6506,6 @@ SurfOrientation GetSurfConvOrientation(Real64 const Tilt) } } -void ShowSevereValueOutOfRange( - EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view fieldName, Real64 fieldVal, Real64 lo, Real64 hi, std::string const &msg) -{ - ShowSevereError(state, format("{}: {} = {} out of range value", eoh.routineName, eoh.objectType, eoh.objectName)); - ShowContinueError(state, format("{} = [{:.5R}] is out-of-range", fieldName, fieldVal)); - ShowContinueError(state, format("Low/high limits = [>={:.9R}, <={:.1R}].", lo, hi)); - if (!msg.empty()) ShowContinueError(state, msg); -} - -void ShowSevereScheduleOutOfRange(EnergyPlusData &state, - ErrorObjectHeader const &eoh, - std::string_view fieldName, - std::string_view fieldVal, - Real64 lo, - Real64 hi, - std::string const &msg) -{ - ShowSevereError(state, format("{}: {} = {} out of range value", eoh.routineName, eoh.objectType, eoh.objectName)); - ShowContinueError(state, format("{} = {} contains an out-of-range value", fieldName, fieldVal)); - ShowContinueError(state, format("Low/high limits = [>={:.9R}, <={:.1R}].", lo, hi)); - if (!msg.empty()) ShowContinueError(state, msg); -} - Real64 SurroundingSurfacesRadCoeffAverage(EnergyPlusData &state, int const SurfNum, Real64 const TSurfK, Real64 const AbsExt) { // compute exterior surfaces LW radiation transfer coefficient to surrounding surfaces diff --git a/src/EnergyPlus/ConvectionCoefficients.hh b/src/EnergyPlus/ConvectionCoefficients.hh index db063217f72..f59de4e36e0 100644 --- a/src/EnergyPlus/ConvectionCoefficients.hh +++ b/src/EnergyPlus/ConvectionCoefficients.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -743,23 +743,6 @@ namespace Convect { CalcASTMC1340ConvCoeff(EnergyPlusData &state, int const SurfNum, Real64 const Tsurf, Real64 const Tair, Real64 const Vair, Real64 const Tilt); SurfOrientation GetSurfConvOrientation(Real64 const Tilt); - - void ShowSevereValueOutOfRange(EnergyPlusData &state, - ErrorObjectHeader const &eoh, - std::string_view fieldName, - Real64 fieldVal, - Real64 lo, - Real64 hi, - std::string const &msg); - - void ShowSevereScheduleOutOfRange(EnergyPlusData &state, - ErrorObjectHeader const &eoh, - std::string_view fieldName, - std::string_view fieldVal, - Real64 lo, - Real64 hi, - std::string const &msg); - } // namespace Convect struct ConvectionCoefficientsData : BaseGlobalStruct @@ -808,6 +791,10 @@ struct ConvectionCoefficientsData : BaseGlobalStruct Array1D hcIntUserCurve; Array1D hcExtUserCurve; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ConvectionConstants.hh b/src/EnergyPlus/ConvectionConstants.hh index 2509cfac75f..0dd7d791fc3 100644 --- a/src/EnergyPlus/ConvectionConstants.hh +++ b/src/EnergyPlus/ConvectionConstants.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/CoolTower.cc b/src/EnergyPlus/CoolTower.cc index b0d46af320f..622abaccaf2 100644 --- a/src/EnergyPlus/CoolTower.cc +++ b/src/EnergyPlus/CoolTower.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -131,6 +131,8 @@ namespace CoolTower { // and stores it in the Cooltower data structure. // SUBROUTINE PARAMETER DEFINITIONS: + static constexpr std::string_view routineName = "GetCoolTower"; + static std::string const CurrentModuleObject("ZoneCoolTower:Shower"); Real64 constexpr MaximumWaterFlowRate(0.016667); // Maximum limit of water flow rate in m3/s (1000 l/min) Real64 constexpr MinimumWaterFlowRate(0.0); // Minimum limit of water flow rate @@ -165,6 +167,8 @@ namespace CoolTower { auto &Zone(state.dataHeatBal->Zone); + auto &s_ipsc = state.dataIPShortCut; + int NumCoolTowers = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); state.dataCoolTower->CoolTowerSys.allocate(NumCoolTowers); @@ -175,46 +179,40 @@ namespace CoolTower { state.dataInputProcessing->inputProcessor->getObjectItem(state, CurrentModuleObject, CoolTowerNum, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStat, lNumericBlanks, lAlphaBlanks, cAlphaFields, cNumericFields); - state.dataCoolTower->CoolTowerSys(CoolTowerNum).Name = state.dataIPShortCut->cAlphaArgs(1); // Name of cooltower - state.dataCoolTower->CoolTowerSys(CoolTowerNum).Schedule = state.dataIPShortCut->cAlphaArgs(2); // Get schedule + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + state.dataCoolTower->CoolTowerSys(CoolTowerNum).Name = s_ipsc->cAlphaArgs(1); // Name of cooltower if (lAlphaBlanks(2)) { - state.dataCoolTower->CoolTowerSys(CoolTowerNum).SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - state.dataCoolTower->CoolTowerSys(CoolTowerNum).SchedPtr = - ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); - if (state.dataCoolTower->CoolTowerSys(CoolTowerNum).SchedPtr == 0) { - ShowSevereError(state, format("{}=\"{}\" invalid data", CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid-Schedule not found {}=\"{}\".", cAlphaFields(2), state.dataIPShortCut->cAlphaArgs(2))); - ErrorsFound = true; - } + state.dataCoolTower->CoolTowerSys(CoolTowerNum).availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((state.dataCoolTower->CoolTowerSys(CoolTowerNum).availSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), s_ipsc->cAlphaArgs(2)); + ErrorsFound = true; } - state.dataCoolTower->CoolTowerSys(CoolTowerNum).ZonePtr = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(3), Zone); - state.dataCoolTower->CoolTowerSys(CoolTowerNum).spacePtr = - Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(3), state.dataHeatBal->space); + state.dataCoolTower->CoolTowerSys(CoolTowerNum).ZonePtr = Util::FindItemInList(s_ipsc->cAlphaArgs(3), Zone); + state.dataCoolTower->CoolTowerSys(CoolTowerNum).spacePtr = Util::FindItemInList(s_ipsc->cAlphaArgs(3), state.dataHeatBal->space); if ((state.dataCoolTower->CoolTowerSys(CoolTowerNum).ZonePtr == 0) && (state.dataCoolTower->CoolTowerSys(CoolTowerNum).spacePtr == 0)) { if (lAlphaBlanks(3)) { - ShowSevereError(state, - format("{}=\"{}\" invalid {} is required but input is blank.", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - cAlphaFields(3))); + ShowSevereError( + state, + format("{}=\"{}\" invalid {} is required but input is blank.", CurrentModuleObject, s_ipsc->cAlphaArgs(1), cAlphaFields(3))); } else { ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\" not found.", CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), cAlphaFields(3), - state.dataIPShortCut->cAlphaArgs(3))); + s_ipsc->cAlphaArgs(3))); } ErrorsFound = true; } else if (state.dataCoolTower->CoolTowerSys(CoolTowerNum).ZonePtr == 0) { @@ -222,7 +220,7 @@ namespace CoolTower { state.dataHeatBal->space(state.dataCoolTower->CoolTowerSys(CoolTowerNum).spacePtr).zoneNum; } - state.dataCoolTower->CoolTowerSys(CoolTowerNum).CoolTWaterSupplyName = state.dataIPShortCut->cAlphaArgs(4); // Name of water storage tank + state.dataCoolTower->CoolTowerSys(CoolTowerNum).CoolTWaterSupplyName = s_ipsc->cAlphaArgs(4); // Name of water storage tank if (lAlphaBlanks(4)) { state.dataCoolTower->CoolTowerSys(CoolTowerNum).CoolTWaterSupplyMode = WaterSupplyMode::FromMains; } else if (state.dataCoolTower->CoolTowerSys(CoolTowerNum).CoolTWaterSupplyMode == WaterSupplyMode::FromTank) { @@ -237,195 +235,134 @@ namespace CoolTower { { state.dataCoolTower->CoolTowerSys(CoolTowerNum).FlowCtrlType = - static_cast(getEnumValue(FlowCtrlNamesUC, state.dataIPShortCut->cAlphaArgs(5))); // Type of flow control + static_cast(getEnumValue(FlowCtrlNamesUC, s_ipsc->cAlphaArgs(5))); // Type of flow control if (state.dataCoolTower->CoolTowerSys(CoolTowerNum).FlowCtrlType == FlowCtrl::Invalid) { - ShowSevereError(state, - format("{}=\"{}\" invalid {}=\"{}\".", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - cAlphaFields(5), - state.dataIPShortCut->cAlphaArgs(5))); + ShowSevereError( + state, + format("{}=\"{}\" invalid {}=\"{}\".", CurrentModuleObject, s_ipsc->cAlphaArgs(1), cAlphaFields(5), s_ipsc->cAlphaArgs(5))); ErrorsFound = true; } } - state.dataCoolTower->CoolTowerSys(CoolTowerNum).PumpSchedPtr = - ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(6)); - if (state.dataCoolTower->CoolTowerSys(CoolTowerNum).PumpSchedPtr == 0) { - if (lAlphaBlanks(6)) { - ShowSevereError(state, - format("{}=\"{}\" invalid {} is required but input is blank.", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - cAlphaFields(6))); - } else { - ShowSevereError(state, - format("{}=\"{}\" invalid {}=\"{}\" not found.", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - cAlphaFields(6), - state.dataIPShortCut->cAlphaArgs(6))); - } + if ((state.dataCoolTower->CoolTowerSys(CoolTowerNum).pumpSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(6))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(6), s_ipsc->cAlphaArgs(6)); ErrorsFound = true; } - state.dataCoolTower->CoolTowerSys(CoolTowerNum).MaxWaterFlowRate = state.dataIPShortCut->rNumericArgs(1); // Maximum limit of water supply + state.dataCoolTower->CoolTowerSys(CoolTowerNum).MaxWaterFlowRate = s_ipsc->rNumericArgs(1); // Maximum limit of water supply if (state.dataCoolTower->CoolTowerSys(CoolTowerNum).MaxWaterFlowRate > MaximumWaterFlowRate) { state.dataCoolTower->CoolTowerSys(CoolTowerNum).MaxWaterFlowRate = MaximumWaterFlowRate; - ShowWarningError(state, - format("{}=\"{}\" invalid {}=[{:.2R}].", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - cNumericFields(1), - state.dataIPShortCut->rNumericArgs(1))); + ShowWarningError( + state, + format("{}=\"{}\" invalid {}=[{:.2R}].", CurrentModuleObject, s_ipsc->cAlphaArgs(1), cNumericFields(1), s_ipsc->rNumericArgs(1))); ShowContinueError(state, format("...Maximum Allowable=[{:.2R}].", MaximumWaterFlowRate)); } if (state.dataCoolTower->CoolTowerSys(CoolTowerNum).MaxWaterFlowRate < MinimumWaterFlowRate) { state.dataCoolTower->CoolTowerSys(CoolTowerNum).MaxWaterFlowRate = MinimumWaterFlowRate; - ShowWarningError(state, - format("{}=\"{}\" invalid {}=[{:.2R}].", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - cNumericFields(1), - state.dataIPShortCut->rNumericArgs(1))); + ShowWarningError( + state, + format("{}=\"{}\" invalid {}=[{:.2R}].", CurrentModuleObject, s_ipsc->cAlphaArgs(1), cNumericFields(1), s_ipsc->rNumericArgs(1))); ShowContinueError(state, format("...Minimum Allowable=[{:.2R}].", MinimumWaterFlowRate)); } - state.dataCoolTower->CoolTowerSys(CoolTowerNum).TowerHeight = state.dataIPShortCut->rNumericArgs(2); // Get effctive tower height + state.dataCoolTower->CoolTowerSys(CoolTowerNum).TowerHeight = s_ipsc->rNumericArgs(2); // Get effctive tower height if (state.dataCoolTower->CoolTowerSys(CoolTowerNum).TowerHeight > MaxHeight) { state.dataCoolTower->CoolTowerSys(CoolTowerNum).TowerHeight = MaxHeight; - ShowWarningError(state, - format("{}=\"{}\" invalid {}=[{:.2R}].", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - cNumericFields(2), - state.dataIPShortCut->rNumericArgs(2))); + ShowWarningError( + state, + format("{}=\"{}\" invalid {}=[{:.2R}].", CurrentModuleObject, s_ipsc->cAlphaArgs(1), cNumericFields(2), s_ipsc->rNumericArgs(2))); ShowContinueError(state, format("...Maximum Allowable=[{:.2R}].", MaxHeight)); } if (state.dataCoolTower->CoolTowerSys(CoolTowerNum).TowerHeight < MinHeight) { state.dataCoolTower->CoolTowerSys(CoolTowerNum).TowerHeight = MinHeight; - ShowWarningError(state, - format("{}=\"{}\" invalid {}=[{:.2R}].", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - cNumericFields(2), - state.dataIPShortCut->rNumericArgs(2))); + ShowWarningError( + state, + format("{}=\"{}\" invalid {}=[{:.2R}].", CurrentModuleObject, s_ipsc->cAlphaArgs(1), cNumericFields(2), s_ipsc->rNumericArgs(2))); ShowContinueError(state, format("...Minimum Allowable=[{:.2R}].", MinHeight)); } - state.dataCoolTower->CoolTowerSys(CoolTowerNum).OutletArea = state.dataIPShortCut->rNumericArgs(3); // Get outlet area + state.dataCoolTower->CoolTowerSys(CoolTowerNum).OutletArea = s_ipsc->rNumericArgs(3); // Get outlet area if (state.dataCoolTower->CoolTowerSys(CoolTowerNum).OutletArea > MaxValue) { state.dataCoolTower->CoolTowerSys(CoolTowerNum).OutletArea = MaxValue; - ShowWarningError(state, - format("{}=\"{}\" invalid {}=[{:.2R}].", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - cNumericFields(3), - state.dataIPShortCut->rNumericArgs(3))); + ShowWarningError( + state, + format("{}=\"{}\" invalid {}=[{:.2R}].", CurrentModuleObject, s_ipsc->cAlphaArgs(1), cNumericFields(3), s_ipsc->rNumericArgs(3))); ShowContinueError(state, format("...Maximum Allowable=[{:.2R}].", MaxValue)); } if (state.dataCoolTower->CoolTowerSys(CoolTowerNum).OutletArea < MinValue) { state.dataCoolTower->CoolTowerSys(CoolTowerNum).OutletArea = MinValue; - ShowWarningError(state, - format("{}=\"{}\" invalid {}=[{:.2R}].", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - cNumericFields(3), - state.dataIPShortCut->rNumericArgs(3))); + ShowWarningError( + state, + format("{}=\"{}\" invalid {}=[{:.2R}].", CurrentModuleObject, s_ipsc->cAlphaArgs(1), cNumericFields(3), s_ipsc->rNumericArgs(3))); ShowContinueError(state, format("...Minimum Allowable=[{:.2R}].", MinValue)); } - state.dataCoolTower->CoolTowerSys(CoolTowerNum).MaxAirVolFlowRate = - state.dataIPShortCut->rNumericArgs(4); // Maximum limit of air flow to the space + state.dataCoolTower->CoolTowerSys(CoolTowerNum).MaxAirVolFlowRate = s_ipsc->rNumericArgs(4); // Maximum limit of air flow to the space if (state.dataCoolTower->CoolTowerSys(CoolTowerNum).MaxAirVolFlowRate > MaxValue) { state.dataCoolTower->CoolTowerSys(CoolTowerNum).MaxAirVolFlowRate = MaxValue; - ShowWarningError(state, - format("{}=\"{}\" invalid {}=[{:.2R}].", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - cNumericFields(4), - state.dataIPShortCut->rNumericArgs(4))); + ShowWarningError( + state, + format("{}=\"{}\" invalid {}=[{:.2R}].", CurrentModuleObject, s_ipsc->cAlphaArgs(1), cNumericFields(4), s_ipsc->rNumericArgs(4))); ShowContinueError(state, format("...Maximum Allowable=[{:.2R}].", MaxValue)); } if (state.dataCoolTower->CoolTowerSys(CoolTowerNum).MaxAirVolFlowRate < MinValue) { state.dataCoolTower->CoolTowerSys(CoolTowerNum).MaxAirVolFlowRate = MinValue; - ShowWarningError(state, - format("{}=\"{}\" invalid {}=[{:.2R}].", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - cNumericFields(4), - state.dataIPShortCut->rNumericArgs(4))); + ShowWarningError( + state, + format("{}=\"{}\" invalid {}=[{:.2R}].", CurrentModuleObject, s_ipsc->cAlphaArgs(1), cNumericFields(4), s_ipsc->rNumericArgs(4))); ShowContinueError(state, format("...Minimum Allowable=[{:.2R}].", MinValue)); } state.dataCoolTower->CoolTowerSys(CoolTowerNum).MinZoneTemp = - state.dataIPShortCut->rNumericArgs(5); // Get minimum temp limit which gets this cooltower off + s_ipsc->rNumericArgs(5); // Get minimum temp limit which gets this cooltower off if (state.dataCoolTower->CoolTowerSys(CoolTowerNum).MinZoneTemp > MaxValue) { state.dataCoolTower->CoolTowerSys(CoolTowerNum).MinZoneTemp = MaxValue; - ShowWarningError(state, - format("{}=\"{}\" invalid {}=[{:.2R}].", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - cNumericFields(5), - state.dataIPShortCut->rNumericArgs(5))); + ShowWarningError( + state, + format("{}=\"{}\" invalid {}=[{:.2R}].", CurrentModuleObject, s_ipsc->cAlphaArgs(1), cNumericFields(5), s_ipsc->rNumericArgs(5))); ShowContinueError(state, format("...Maximum Allowable=[{:.2R}].", MaxValue)); } if (state.dataCoolTower->CoolTowerSys(CoolTowerNum).MinZoneTemp < MinValue) { state.dataCoolTower->CoolTowerSys(CoolTowerNum).MinZoneTemp = MinValue; - ShowWarningError(state, - format("{}=\"{}\" invalid {}=[{:.2R}].", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - cNumericFields(5), - state.dataIPShortCut->rNumericArgs(5))); + ShowWarningError( + state, + format("{}=\"{}\" invalid {}=[{:.2R}].", CurrentModuleObject, s_ipsc->cAlphaArgs(1), cNumericFields(5), s_ipsc->rNumericArgs(5))); ShowContinueError(state, format("...Minimum Allowable=[{:.2R}].", MinValue)); } - state.dataCoolTower->CoolTowerSys(CoolTowerNum).FracWaterLoss = state.dataIPShortCut->rNumericArgs(6); // Fraction of water loss + state.dataCoolTower->CoolTowerSys(CoolTowerNum).FracWaterLoss = s_ipsc->rNumericArgs(6); // Fraction of water loss if (state.dataCoolTower->CoolTowerSys(CoolTowerNum).FracWaterLoss > MaxFrac) { state.dataCoolTower->CoolTowerSys(CoolTowerNum).FracWaterLoss = MaxFrac; - ShowWarningError(state, - format("{}=\"{}\" invalid {}=[{:.2R}].", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - cNumericFields(6), - state.dataIPShortCut->rNumericArgs(6))); + ShowWarningError( + state, + format("{}=\"{}\" invalid {}=[{:.2R}].", CurrentModuleObject, s_ipsc->cAlphaArgs(1), cNumericFields(6), s_ipsc->rNumericArgs(6))); ShowContinueError(state, format("...Maximum Allowable=[{:.2R}].", MaxFrac)); } if (state.dataCoolTower->CoolTowerSys(CoolTowerNum).FracWaterLoss < MinFrac) { state.dataCoolTower->CoolTowerSys(CoolTowerNum).FracWaterLoss = MinFrac; - ShowWarningError(state, - format("{}=\"{}\" invalid {}=[{:.2R}].", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - cNumericFields(6), - state.dataIPShortCut->rNumericArgs(6))); + ShowWarningError( + state, + format("{}=\"{}\" invalid {}=[{:.2R}].", CurrentModuleObject, s_ipsc->cAlphaArgs(1), cNumericFields(6), s_ipsc->rNumericArgs(6))); ShowContinueError(state, format("...Minimum Allowable=[{:.2R}].", MinFrac)); } - state.dataCoolTower->CoolTowerSys(CoolTowerNum).FracFlowSched = state.dataIPShortCut->rNumericArgs(7); // Fraction of loss of air flow + state.dataCoolTower->CoolTowerSys(CoolTowerNum).FracFlowSched = s_ipsc->rNumericArgs(7); // Fraction of loss of air flow if (state.dataCoolTower->CoolTowerSys(CoolTowerNum).FracFlowSched > MaxFrac) { state.dataCoolTower->CoolTowerSys(CoolTowerNum).FracFlowSched = MaxFrac; - ShowWarningError(state, - format("{}=\"{}\" invalid {}=[{:.2R}].", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - cNumericFields(7), - state.dataIPShortCut->rNumericArgs(7))); + ShowWarningError( + state, + format("{}=\"{}\" invalid {}=[{:.2R}].", CurrentModuleObject, s_ipsc->cAlphaArgs(1), cNumericFields(7), s_ipsc->rNumericArgs(7))); ShowContinueError(state, format("...Maximum Allowable=[{:.2R}].", MaxFrac)); } if (state.dataCoolTower->CoolTowerSys(CoolTowerNum).FracFlowSched < MinFrac) { state.dataCoolTower->CoolTowerSys(CoolTowerNum).FracFlowSched = MinFrac; - ShowWarningError(state, - format("{}=\"{}\" invalid {}=[{:.5R}].", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - cNumericFields(7), - state.dataIPShortCut->rNumericArgs(7))); + ShowWarningError( + state, + format("{}=\"{}\" invalid {}=[{:.5R}].", CurrentModuleObject, s_ipsc->cAlphaArgs(1), cNumericFields(7), s_ipsc->rNumericArgs(7))); ShowContinueError(state, format("...Minimum Allowable=[{:.2R}].", MinFrac)); } - state.dataCoolTower->CoolTowerSys(CoolTowerNum).RatedPumpPower = state.dataIPShortCut->rNumericArgs(8); // Get rated pump power + state.dataCoolTower->CoolTowerSys(CoolTowerNum).RatedPumpPower = s_ipsc->rNumericArgs(8); // Get rated pump power } cAlphaArgs.deallocate(); @@ -637,7 +574,8 @@ namespace CoolTower { thisSpaceHB.MCPC = 0.0; thisSpaceHB.CTMFL = 0.0; } - if (ScheduleManager::GetCurrentScheduleValue(state, state.dataCoolTower->CoolTowerSys(CoolTowerNum).SchedPtr) > 0.0) { + + if (state.dataCoolTower->CoolTowerSys(CoolTowerNum).availSched->getCurrentVal() > 0.0) { // check component operation if (state.dataEnvrn->WindSpeed < MinWindSpeed || state.dataEnvrn->WindSpeed > MaxWindSpeed) continue; if (state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT < state.dataCoolTower->CoolTowerSys(CoolTowerNum).MinZoneTemp) @@ -695,8 +633,8 @@ namespace CoolTower { } // Determine pump power - if (ScheduleManager::GetCurrentScheduleValue(state, state.dataCoolTower->CoolTowerSys(CoolTowerNum).PumpSchedPtr) > 0) { - PumpPartLoadRat = ScheduleManager::GetCurrentScheduleValue(state, state.dataCoolTower->CoolTowerSys(CoolTowerNum).PumpSchedPtr); + if (state.dataCoolTower->CoolTowerSys(CoolTowerNum).pumpSched->getCurrentVal() > 0) { + PumpPartLoadRat = state.dataCoolTower->CoolTowerSys(CoolTowerNum).pumpSched->getCurrentVal(); } else { PumpPartLoadRat = 1.0; } @@ -715,7 +653,7 @@ namespace CoolTower { AirSpecHeat = Psychrometrics::PsyCpAirFnW(OutletHumRat); AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, OutletTemp, OutletHumRat); // Outlet air density CVF_ZoneNum = state.dataCoolTower->CoolTowerSys(CoolTowerNum).ActualAirVolFlowRate * - ScheduleManager::GetCurrentScheduleValue(state, state.dataCoolTower->CoolTowerSys(CoolTowerNum).SchedPtr); + state.dataCoolTower->CoolTowerSys(CoolTowerNum).availSched->getCurrentVal(); Real64 thisMCPC = CVF_ZoneNum * AirDensity * AirSpecHeat; Real64 thisMCPTC = thisMCPC * OutletTemp; Real64 thisCTMFL = thisMCPC / AirSpecHeat; diff --git a/src/EnergyPlus/CoolTower.hh b/src/EnergyPlus/CoolTower.hh index 4da1b7a67f8..4247c020354 100644 --- a/src/EnergyPlus/CoolTower.hh +++ b/src/EnergyPlus/CoolTower.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -55,6 +55,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -84,11 +85,10 @@ namespace CoolTower { // Members std::string Name; // The component name std::string CompType; // Type of component - std::string Schedule; // Available schedule - int SchedPtr = 0; // Index to schedule + Sched::Schedule *availSched = nullptr; // schedule int ZonePtr = 0; // Index to zone int spacePtr = 0; // Index to space (if applicable) - int PumpSchedPtr = 0; // Index to schedule for water pump + Sched::Schedule *pumpSched = nullptr; // Index to schedule for water pump FlowCtrl FlowCtrlType = FlowCtrl::Invalid; // Type of cooltower operation WaterSupplyMode CoolTWaterSupplyMode = WaterSupplyMode::FromMains; // Type of water source std::string CoolTWaterSupplyName; // Name of water source @@ -145,6 +145,10 @@ struct CoolTowerData : BaseGlobalStruct bool GetInputFlag = true; Array1D CoolTowerSys; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/CostEstimateManager.cc b/src/EnergyPlus/CostEstimateManager.cc index 6a132a16014..fea2c41eee9 100644 --- a/src/EnergyPlus/CostEstimateManager.cc +++ b/src/EnergyPlus/CostEstimateManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -718,7 +718,7 @@ namespace CostEstimateManager { // Input validation happens before we get to this point // The factory throws a severe error when the coil is not found // Finding the coil like this here to protects against another SevereError being thrown out of context - auto &v = state.dataCoilCooingDX->coilCoolingDXs; + auto &v = state.dataCoilCoolingDX->coilCoolingDXs; auto isInCoils = [&parentObjName](const CoilCoolingDX &coil) { return coil.name == parentObjName; }; auto it = std::find_if(v.begin(), v.end(), isInCoils); if (it != v.end()) { @@ -730,7 +730,7 @@ namespace CostEstimateManager { if (state.dataCostEstimateManager->CostLineItem(Item).PerKiloWattCap > 0.0) { if (WildcardObjNames) { Real64 Qty(0.0); - for (auto const &e : state.dataCoilCooingDX->coilCoolingDXs) + for (auto const &e : state.dataCoilCoolingDX->coilCoolingDXs) Qty += e.performance.normalMode.ratedGrossTotalCap; state.dataCostEstimateManager->CostLineItem(Item).Qty = Qty / 1000.0; state.dataCostEstimateManager->CostLineItem(Item).Units = "kW (tot cool cap.)"; @@ -740,7 +740,7 @@ namespace CostEstimateManager { } if (coilFound) { state.dataCostEstimateManager->CostLineItem(Item).Qty = - state.dataCoilCooingDX->coilCoolingDXs[thisCoil].performance.normalMode.ratedGrossTotalCap / 1000.0; + state.dataCoilCoolingDX->coilCoolingDXs[thisCoil].performance.normalMode.ratedGrossTotalCap / 1000.0; state.dataCostEstimateManager->CostLineItem(Item).Units = "kW (tot cool cap.)"; state.dataCostEstimateManager->CostLineItem(Item).ValuePer = state.dataCostEstimateManager->CostLineItem(Item).PerKiloWattCap; state.dataCostEstimateManager->CostLineItem(Item).LineSubTotal = @@ -750,7 +750,7 @@ namespace CostEstimateManager { if (state.dataCostEstimateManager->CostLineItem(Item).PerEach > 0.0) { if (WildcardObjNames) - state.dataCostEstimateManager->CostLineItem(Item).Qty = double(state.dataCoilCooingDX->coilCoolingDXs.size()); + state.dataCostEstimateManager->CostLineItem(Item).Qty = double(state.dataCoilCoolingDX->coilCoolingDXs.size()); if (coilFound) state.dataCostEstimateManager->CostLineItem(Item).Qty = 1.0; state.dataCostEstimateManager->CostLineItem(Item).ValuePer = state.dataCostEstimateManager->CostLineItem(Item).PerEach; state.dataCostEstimateManager->CostLineItem(Item).LineSubTotal = @@ -761,7 +761,7 @@ namespace CostEstimateManager { if (state.dataCostEstimateManager->CostLineItem(Item).PerKWCapPerCOP > 0.0) { if (WildcardObjNames) { Real64 Qty(0.0); - for (auto const &e : state.dataCoilCooingDX->coilCoolingDXs) { + for (auto const &e : state.dataCoilCoolingDX->coilCoolingDXs) { auto const &maxSpeed = e.performance.normalMode.speeds.back(); Real64 COP = maxSpeed.original_input_specs.gross_rated_cooling_COP; Qty += COP * e.performance.normalMode.ratedGrossTotalCap; @@ -773,10 +773,10 @@ namespace CostEstimateManager { state.dataCostEstimateManager->CostLineItem(Item).Qty * state.dataCostEstimateManager->CostLineItem(Item).ValuePer; } if (coilFound) { - auto const &maxSpeed = state.dataCoilCooingDX->coilCoolingDXs[thisCoil].performance.normalMode.speeds.back(); + auto const &maxSpeed = state.dataCoilCoolingDX->coilCoolingDXs[thisCoil].performance.normalMode.speeds.back(); Real64 COP = maxSpeed.original_input_specs.gross_rated_cooling_COP; state.dataCostEstimateManager->CostLineItem(Item).Qty = - COP * state.dataCoilCooingDX->coilCoolingDXs[thisCoil].performance.normalMode.ratedGrossTotalCap / 1000.0; + COP * state.dataCoilCoolingDX->coilCoolingDXs[thisCoil].performance.normalMode.ratedGrossTotalCap / 1000.0; state.dataCostEstimateManager->CostLineItem(Item).Units = "kW*COP (total, rated) "; state.dataCostEstimateManager->CostLineItem(Item).ValuePer = state.dataCostEstimateManager->CostLineItem(Item).PerKWCapPerCOP; state.dataCostEstimateManager->CostLineItem(Item).LineSubTotal = diff --git a/src/EnergyPlus/CostEstimateManager.hh b/src/EnergyPlus/CostEstimateManager.hh index 4d82595fd08..4a2188c1b92 100644 --- a/src/EnergyPlus/CostEstimateManager.hh +++ b/src/EnergyPlus/CostEstimateManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -189,6 +189,10 @@ struct CostEstimateManagerData : BaseGlobalStruct Array1D monetaryUnit; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/CrossVentMgr.cc b/src/EnergyPlus/CrossVentMgr.cc index 55762137b66..c870ca9c77c 100644 --- a/src/EnergyPlus/CrossVentMgr.cc +++ b/src/EnergyPlus/CrossVentMgr.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -387,7 +387,7 @@ namespace RoomAir { // Check if wind direction is within +/- 90 degrees of the outward normal of the dominant surface SurfNorm = thisSurface.Azimuth; - CosPhi = std::cos((state.dataEnvrn->WindDir - SurfNorm) * Constant::DegToRadians); + CosPhi = std::cos((state.dataEnvrn->WindDir - SurfNorm) * Constant::DegToRad); if (CosPhi <= 0) { state.dataRoomAir->AirModel(ZoneNum).SimAirModel = false; auto flows(state.dataRoomAir->CrossVentJetRecFlows(_, ZoneNum)); // This is an array slice, need to get rid of this (THIS_AUTO_OK) @@ -736,7 +736,7 @@ namespace RoomAir { for (int Ctd = 1; Ctd <= state.dataRoomAir->TotCrossVent; ++Ctd) { if (ZoneNum == state.dataRoomAir->ZoneCrossVent(Ctd).ZonePtr) { - GainsFrac = ScheduleManager::GetCurrentScheduleValue(state, state.dataRoomAir->ZoneCrossVent(Ctd).SchedGainsPtr); + GainsFrac = state.dataRoomAir->ZoneCrossVent(Ctd).gainsSched->getCurrentVal(); } } diff --git a/src/EnergyPlus/CrossVentMgr.hh b/src/EnergyPlus/CrossVentMgr.hh index d05afc87e2d..67b0d71374b 100644 --- a/src/EnergyPlus/CrossVentMgr.hh +++ b/src/EnergyPlus/CrossVentMgr.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -81,6 +81,10 @@ struct CrossVentMgrData : BaseGlobalStruct bool InitUCSDCV_MyOneTimeFlag = true; Array1D_bool InitUCSDCV_MyEnvrnFlag; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/CurveManager.cc b/src/EnergyPlus/CurveManager.cc index 77a0e811884..844bc982746 100644 --- a/src/EnergyPlus/CurveManager.cc +++ b/src/EnergyPlus/CurveManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -47,13 +47,14 @@ // C++ Headers #include +#include #include #include #include +#include // ObjexxFCL Headers #include -#include #include // Third-party Headers @@ -703,7 +704,7 @@ namespace Curve { if (Numbers(7) > Numbers(8)) { // error ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); ShowContinueError(state, - format("{} [{:.R2}] > {} [{.R2}]", + format("{} [{:.2R}] > {} [{:.2R}]", state.dataIPShortCut->cNumericFieldNames(7), Numbers(7), state.dataIPShortCut->cNumericFieldNames(8), @@ -713,7 +714,7 @@ namespace Curve { if (Numbers(9) > Numbers(10)) { // error ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); ShowContinueError(state, - format("{} [{:.R2}] > {} [{.R2}]", + format("{} [{:.2R}] > {} [{:.2R}]", state.dataIPShortCut->cNumericFieldNames(9), Numbers(9), state.dataIPShortCut->cNumericFieldNames(10), @@ -773,10 +774,42 @@ namespace Curve { thisCurve->inputLimits[0].min = Numbers(13); thisCurve->inputLimits[0].max = Numbers(14); + if (Numbers(13) > Numbers(14)) { // error + ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); + ShowContinueError(state, + format("{} [{:.2R}] > {} [{:.2R}]", + state.dataIPShortCut->cNumericFieldNames(13), + Numbers(13), + state.dataIPShortCut->cNumericFieldNames(14), + Numbers(14))); + ErrorsFound = true; + } + thisCurve->inputLimits[1].min = Numbers(15); thisCurve->inputLimits[1].max = Numbers(16); + if (Numbers(15) > Numbers(16)) { // error + ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); + ShowContinueError(state, + format("{} [{:.2R}] > {} [{:.2R}]", + state.dataIPShortCut->cNumericFieldNames(15), + Numbers(15), + state.dataIPShortCut->cNumericFieldNames(16), + Numbers(16))); + ErrorsFound = true; + } + thisCurve->inputLimits[2].min = Numbers(17); thisCurve->inputLimits[2].max = Numbers(18); + if (Numbers(17) > Numbers(18)) { // error + ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); + ShowContinueError(state, + format("{} [{:.2R}] > {} [{:.2R}]", + state.dataIPShortCut->cNumericFieldNames(17), + Numbers(17), + state.dataIPShortCut->cNumericFieldNames(18), + Numbers(18))); + ErrorsFound = true; + } if (NumNumbers > 18 && !state.dataIPShortCut->lNumericFieldBlanks(19)) { thisCurve->outputLimits.min = Numbers(19); @@ -798,8 +831,8 @@ namespace Curve { } } if (NumAlphas >= 4) { - if (!IsCurveOutputTypeValid(Alphas(4))) { - ShowWarningError(state, format("In {} named {} the OInput Unit Type for Z is invalid.", CurrentModuleObject, Alphas(1))); + if (!IsCurveInputTypeValid(Alphas(4))) { + ShowWarningError(state, format("In {} named {} the Input Unit Type for Z is invalid.", CurrentModuleObject, Alphas(1))); } } if (NumAlphas >= 5) { @@ -854,7 +887,7 @@ namespace Curve { if (Numbers(5) > Numbers(6)) { // error ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); ShowContinueError(state, - format("{}[{:.R2}] > {} [{.R2}]", + format("{} [{:.2R}] > {} [{:.2R}]", state.dataIPShortCut->cNumericFieldNames(5), Numbers(5), state.dataIPShortCut->cNumericFieldNames(6), @@ -918,7 +951,7 @@ namespace Curve { if (Numbers(6) > Numbers(7)) { // error ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); ShowContinueError(state, - format("{}[{:.R2}] > {} [{.R2}]", + format("{} [{:.2R}] > {} [{:.2R}]", state.dataIPShortCut->cNumericFieldNames(6), Numbers(6), state.dataIPShortCut->cNumericFieldNames(7), @@ -982,7 +1015,7 @@ namespace Curve { if (Numbers(4) > Numbers(5)) { // error ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); ShowContinueError(state, - format("{} [{:.R2}] > {} [{.R2}]", + format("{} [{:.2R}] > {} [{:.2R}]", state.dataIPShortCut->cNumericFieldNames(4), Numbers(4), state.dataIPShortCut->cNumericFieldNames(5), @@ -1048,7 +1081,7 @@ namespace Curve { if (Numbers(7) > Numbers(8)) { // error ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); ShowContinueError(state, - format("{} [{:.R2}] > {} [{.R2}]", + format("{} [{:.2R}] > {} [{:.2R}]", state.dataIPShortCut->cNumericFieldNames(7), Numbers(7), state.dataIPShortCut->cNumericFieldNames(8), @@ -1058,7 +1091,7 @@ namespace Curve { if (Numbers(9) > Numbers(10)) { // error ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); ShowContinueError(state, - format("{} [{:.R2}] > {} [{.R2}]", + format("{} [{:.2R}] > {} [{:.2R}]", state.dataIPShortCut->cNumericFieldNames(9), Numbers(9), state.dataIPShortCut->cNumericFieldNames(10), @@ -1129,7 +1162,7 @@ namespace Curve { if (Numbers(7) > Numbers(8)) { // error ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); ShowContinueError(state, - format("{} [{:.R2}] > {} [{.R2}]", + format("{} [{:.2R}] > {} [{:.2R}]", state.dataIPShortCut->cNumericFieldNames(7), Numbers(7), state.dataIPShortCut->cNumericFieldNames(8), @@ -1139,7 +1172,7 @@ namespace Curve { if (Numbers(9) > Numbers(10)) { // error ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); ShowContinueError(state, - format("{} [{:.R2}] > {} [{.R2}]", + format("{} [{:.2R}] > {} [{:.2R}]", state.dataIPShortCut->cNumericFieldNames(9), Numbers(9), state.dataIPShortCut->cNumericFieldNames(10), @@ -1208,7 +1241,7 @@ namespace Curve { if (Numbers(3) > Numbers(4)) { // error ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); ShowContinueError(state, - format("{} [{:.R2}] > {} [{.R2}]", + format("{} [{:.2R}] > {} [{:.2R}]", state.dataIPShortCut->cNumericFieldNames(3), Numbers(3), state.dataIPShortCut->cNumericFieldNames(4), @@ -1274,7 +1307,7 @@ namespace Curve { if (Numbers(11) > Numbers(12)) { // error ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); ShowContinueError(state, - format("{} [{:.R2}] > {} [{.R2}]", + format("{} [{:.2R}] > {} [{:.2R}]", state.dataIPShortCut->cNumericFieldNames(11), Numbers(11), state.dataIPShortCut->cNumericFieldNames(12), @@ -1284,7 +1317,7 @@ namespace Curve { if (Numbers(13) > Numbers(14)) { // error ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); ShowContinueError(state, - format("{} [{:.R2}] > {} [{.R2}]", + format("{} [{:.2R}] > {} [{:.2R}]", state.dataIPShortCut->cNumericFieldNames(13), Numbers(13), state.dataIPShortCut->cNumericFieldNames(14), @@ -1381,7 +1414,7 @@ namespace Curve { if (Numbers(28) > Numbers(29)) { // error ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); ShowContinueError(state, - format("{} [{:.R2}] > {} [{.R2}]", + format("{} [{:.2R}] > {} [{:.2R}]", state.dataIPShortCut->cNumericFieldNames(28), Numbers(28), state.dataIPShortCut->cNumericFieldNames(29), @@ -1391,7 +1424,7 @@ namespace Curve { if (Numbers(30) > Numbers(31)) { // error ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); ShowContinueError(state, - format("{} [{:.R2}] > {} [{.R2}]", + format("{} [{:.2R}] > {} [{:.2R}]", state.dataIPShortCut->cNumericFieldNames(30), Numbers(30), state.dataIPShortCut->cNumericFieldNames(31), @@ -1401,7 +1434,7 @@ namespace Curve { if (Numbers(32) > Numbers(33)) { // error ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); ShowContinueError(state, - format("{} [{:.R2}] > {} [{.R2}]", + format("{} [{:.2R}] > {} [{:.2R}]", state.dataIPShortCut->cNumericFieldNames(32), Numbers(32), state.dataIPShortCut->cNumericFieldNames(33), @@ -1480,14 +1513,14 @@ namespace Curve { } constexpr int NumVar = 4; - std::string VarNames[NumVar] = {"w", "x", "y", "z"}; + constexpr std::array VarNames{"w", "x", "y", "z"}; for (int i = 1; i <= NumVar; ++i) { int MinIndex = 2 * i + 4; int MaxIndex = MinIndex + 1; if (Numbers(MinIndex) > Numbers(MaxIndex)) { // error ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); ShowContinueError(state, - format("{} [{:.R2}] > {} [{.R2}]", + format("{} [{:.2R}] > {} [{:.2R}]", state.dataIPShortCut->cNumericFieldNames(MinIndex), Numbers(MinIndex), state.dataIPShortCut->cNumericFieldNames(MaxIndex), @@ -1560,14 +1593,14 @@ namespace Curve { } constexpr int NumVar = 5; - std::string VarNames[NumVar] = {"v", "w", "x", "y", "z"}; + constexpr std::array VarNames{"v", "w", "x", "y", "z"}; for (int i = 1; i <= NumVar; ++i) { int MinIndex = 2 * i + 5; int MaxIndex = MinIndex + 1; if (Numbers(MinIndex) > Numbers(MaxIndex)) { // error ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); ShowContinueError(state, - format("{} [{:.R2}] > {} [{.R2}]", + format("{} [{:.2R}] > {} [{:.2R}]", state.dataIPShortCut->cNumericFieldNames(MinIndex), Numbers(MinIndex), state.dataIPShortCut->cNumericFieldNames(MaxIndex), @@ -1622,6 +1655,18 @@ namespace Curve { } thisCurve->inputLimits[0].min = Numbers(4); thisCurve->inputLimits[0].max = Numbers(5); + + if (Numbers(4) > Numbers(5)) { // error + ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); + ShowContinueError(state, + format("{} [{:.2R}] > {} [{:.2R}]", + state.dataIPShortCut->cNumericFieldNames(4), + Numbers(4), + state.dataIPShortCut->cNumericFieldNames(5), + Numbers(5))); + ErrorsFound = true; + } + if (NumNumbers > 5 && !state.dataIPShortCut->lNumericFieldBlanks(6)) { thisCurve->outputLimits.min = Numbers(6); thisCurve->outputLimits.minPresent = true; @@ -1690,7 +1735,7 @@ namespace Curve { if (Numbers(5) > Numbers(6)) { // error ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); ShowContinueError(state, - format("{}[{:.R2}] > {} [{.R2}]", + format("{} [{:.2R}] > {} [{:.2R}]", state.dataIPShortCut->cNumericFieldNames(5), Numbers(5), state.dataIPShortCut->cNumericFieldNames(6), @@ -1700,7 +1745,7 @@ namespace Curve { if (Numbers(7) > Numbers(8)) { // error ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); ShowContinueError(state, - format("{}[{:.R2}] > {} [{.R2}]", + format("{} [{:.2R}] > {} [{:.2R}]", state.dataIPShortCut->cNumericFieldNames(7), Numbers(7), state.dataIPShortCut->cNumericFieldNames(8), @@ -1756,7 +1801,7 @@ namespace Curve { if (Numbers(5) > Numbers(6)) { // error ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); ShowContinueError(state, - format("{}[{:.R2}] > {} [{.R2}]", + format("{} [{:.2R}] > {} [{:.2R}]", state.dataIPShortCut->cNumericFieldNames(5), Numbers(5), state.dataIPShortCut->cNumericFieldNames(6), @@ -1822,7 +1867,7 @@ namespace Curve { if (Numbers(6) > Numbers(7)) { // error ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); ShowContinueError(state, - format("{}[{:.R2}] > {} [{.R2}]", + format("{} [{:.2R}] > {} [{:.2R}]", state.dataIPShortCut->cNumericFieldNames(6), Numbers(6), state.dataIPShortCut->cNumericFieldNames(7), @@ -1888,7 +1933,7 @@ namespace Curve { if (Numbers(4) > Numbers(5)) { // error ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); ShowContinueError(state, - format("{}[{:.R2}] > {} [{.R2}]", + format("{} [{:.2R}] > {} [{:.2R}]", state.dataIPShortCut->cNumericFieldNames(4), Numbers(4), state.dataIPShortCut->cNumericFieldNames(5), @@ -1954,7 +1999,7 @@ namespace Curve { if (Numbers(4) > Numbers(5)) { // error ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); ShowContinueError(state, - format("{}[{:.R2}] > {} [{.R2}]", + format("{} [{:.2R}] > {} [{:.2R}]", state.dataIPShortCut->cNumericFieldNames(4), Numbers(4), state.dataIPShortCut->cNumericFieldNames(5), @@ -2020,7 +2065,7 @@ namespace Curve { if (Numbers(4) > Numbers(5)) { // error ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); ShowContinueError(state, - format("{}[{:.R2}] > {} [{.R2}]", + format("{} [{:.2R}] > {} [{:.2R}]", state.dataIPShortCut->cNumericFieldNames(4), Numbers(4), state.dataIPShortCut->cNumericFieldNames(5), @@ -2074,6 +2119,17 @@ namespace Curve { thisCurve->inputLimits[0].min = Numbers(6); thisCurve->inputLimits[0].max = Numbers(7); + if (Numbers(6) > Numbers(7)) { // error + ShowSevereError(state, format("GetCurveInput: For {}: ", CurrentModuleObject)); + ShowContinueError(state, + format("{} [{:.2R}] > {} [{:.2R}]", + state.dataIPShortCut->cNumericFieldNames(6), + Numbers(6), + state.dataIPShortCut->cNumericFieldNames(7), + Numbers(7))); + ErrorsFound = true; + } + if (NumNumbers > 7 && !state.dataIPShortCut->lNumericFieldBlanks(8)) { thisCurve->outputLimits.min = Numbers(8); thisCurve->outputLimits.minPresent = true; @@ -2297,7 +2353,7 @@ namespace Curve { // TODO: Actually use this to define output variable units if (indVarInstance.count("unit_type")) { std::string unitType = indVarInstance.at("unit_type").get(); - if (!IsCurveOutputTypeValid(unitType)) { + if (!IsCurveInputTypeValid(unitType)) { ShowSevereError(state, format("{}: Unit Type [{}] is invalid", contextString, unitType)); } } @@ -2953,10 +3009,21 @@ namespace Curve { Distance, Wavelength, Angle, + VolumetricFlowPerPower, Num }; constexpr std::array(CurveInputType::Num)> inputTypes = { - "DIMENSIONLESS", "TEMPERATURE", "PRESSURE", "VOLUMETRICFLOW", "MASSFLOW", "POWER", "DISTANCE", "WAVELENGTH", "ANGLE"}; + "DIMENSIONLESS", + "TEMPERATURE", + "PRESSURE", + "VOLUMETRICFLOW", + "MASSFLOW", + "POWER", + "DISTANCE", + "WAVELENGTH", + "ANGLE", + "VOLUMETRICFLOWPERPOWER", + }; if (InInputType.empty()) { return true; // if not used it is valid @@ -3002,7 +3069,7 @@ namespace Curve { std::string_view curveFieldText) { // Returns true if errors found - Curve *thisCurve = state.dataCurveManager->PerfCurve(CurveIndex); + Curve const *thisCurve = state.dataCurveManager->PerfCurve(CurveIndex); int curveDim = thisCurve->numDims; if (std::find(validDims.begin(), validDims.end(), curveDim) != validDims.end()) return false; diff --git a/src/EnergyPlus/CurveManager.hh b/src/EnergyPlus/CurveManager.hh index 79e20bdbfde..aee0eff1826 100644 --- a/src/EnergyPlus/CurveManager.hh +++ b/src/EnergyPlus/CurveManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -469,6 +469,10 @@ struct CurveManagerData : BaseGlobalStruct this->PerfCurve.push_back(new EnergyPlus::Curve::Curve); } + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DElightManagerF.cc b/src/EnergyPlus/DElightManagerF.cc index 1be42160c7e..0ca3ff2037c 100644 --- a/src/EnergyPlus/DElightManagerF.cc +++ b/src/EnergyPlus/DElightManagerF.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -233,8 +233,8 @@ namespace DElightManagerF { state.dataEnvrn->TimeZoneNumber); // Calc cos and sin of Building Relative North values for later use in transforming Reference Point coordinates - CosBldgRelNorth = std::cos(-state.dataHeatBal->BuildingAzimuth * Constant::DegToRadians); - SinBldgRelNorth = std::sin(-state.dataHeatBal->BuildingAzimuth * Constant::DegToRadians); + CosBldgRelNorth = std::cos(-state.dataHeatBal->BuildingAzimuth * Constant::DegToRad); + SinBldgRelNorth = std::sin(-state.dataHeatBal->BuildingAzimuth * Constant::DegToRad); // Loop through the Daylighting:Controls objects that use DElight checking for a host Zone for (auto &znDayl : state.dataDayltg->daylightControl) { @@ -309,8 +309,8 @@ namespace DElightManagerF { znDayl.DElightGriddingResolution * M22FT2); // Calc cos and sin of Zone Relative North values for later use in transforming Reference Point coordinates - CosZoneRelNorth = std::cos(-zn.RelNorth * Constant::DegToRadians); - SinZoneRelNorth = std::sin(-zn.RelNorth * Constant::DegToRadians); + CosZoneRelNorth = std::cos(-zn.RelNorth * Constant::DegToRad); + SinZoneRelNorth = std::sin(-zn.RelNorth * Constant::DegToRad); // Zone Lighting Schedule Data Section // NOTE: Schedules are not required since hourly values are retrieved from EnergyPlus as needed @@ -687,12 +687,12 @@ namespace DElightManagerF { iWndoConstIndexes(iconst) + 10000, state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransDiffVis, state.dataConstruction->Construct(iWndoConstIndexes(iconst)).ReflectVisDiffBack, - state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(1), - state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(2), - state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(3), - state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(4), - state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(5), - state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(6)); + state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef[0], + state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef[1], + state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef[2], + state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef[3], + state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef[4], + state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef[5]); } // Glass Type loop diff --git a/src/EnergyPlus/DElightManagerF.hh b/src/EnergyPlus/DElightManagerF.hh index 7925e7c56d4..304561cc7be 100644 --- a/src/EnergyPlus/DElightManagerF.hh +++ b/src/EnergyPlus/DElightManagerF.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/DXCoils.cc b/src/EnergyPlus/DXCoils.cc index dc78db35aa7..9de06284896 100644 --- a/src/EnergyPlus/DXCoils.cc +++ b/src/EnergyPlus/DXCoils.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -123,9 +123,6 @@ namespace EnergyPlus::DXCoils { using namespace DataLoopNode; using namespace Psychrometrics; -// Use statements for access to subroutines in other modules -using namespace ScheduleManager; - // Functions void SimDXCoil(EnergyPlusData &state, @@ -255,7 +252,7 @@ void SimDXCoilMultiSpeed(EnergyPlusData &state, Real64 const SpeedRatio, // = (CompressorSpeed - CompressorSpeedMin) / Real64 const CycRatio, // cycling part load ratio for variable speed int &CompIndex, - ObjexxFCL::Optional_int_const SpeedNum, // Speed number for multispeed cooling coil onlyn + ObjexxFCL::Optional_int_const SpeedNum, // Speed number for multispeed cooling coil only ObjexxFCL::Optional fanOp, // Fan operation mode HVAC::CompressorOp compressorOp, // Compressor on/off; 1=on, 0=off ObjexxFCL::Optional_int_const SingleMode // Single mode operation Yes/No; 1=Yes, 0=No @@ -721,13 +718,14 @@ void GetDXCoils(EnergyPlusData &state) using GlobalNames::VerifyUniqueCoilName; using NodeInputManager::GetOnlySingleNode; using OutAirNodeManager::CheckOutAirNodeNumber; - using ScheduleManager::GetScheduleIndex; using WaterManager::SetupTankDemandComponent; using WaterManager::SetupTankSupplyComponent; // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetDXCoils: "); // include trailing blank space - constexpr Real64 minOATCompDXCooling = -25.0; // min OAT for compressor operation for DX cooling coils + static constexpr std::string_view routineName = "GetDXCoils"; // include trailing blank space + + constexpr Real64 minOATCompDXCooling = -25.0; // min OAT for compressor operation for DX cooling coils // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int DXCoilIndex; // loop index @@ -912,6 +910,8 @@ void GetDXCoils(EnergyPlusData &state) cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + ++DXCoilNum; // allocate single performance mode for numeric field strings used for sizing routine state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); @@ -927,16 +927,11 @@ void GetDXCoils(EnergyPlusData &state) state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).SourceType = CurrentModuleObject; thisDXCoil.DXCoilType = CurrentModuleObject; thisDXCoil.DXCoilType_Num = HVAC::CoilDX_CoolingSingleSpeed; - thisDXCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { - thisDXCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisDXCoil.SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (thisDXCoil.SchedPtr == 0) { - ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, thisDXCoil.Name)); - ShowContinueError(state, format("...{}=\"{}\".", cAlphaFields(2), Alphas(2))); - ErrorsFound = true; - } + thisDXCoil.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisDXCoil.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } thisDXCoil.RatedTotCap(1) = Numbers(1); thisDXCoil.RatedSHR(1) = Numbers(2); @@ -1305,11 +1300,9 @@ void GetDXCoils(EnergyPlusData &state) } if (!lAlphaBlanks(15)) { - thisDXCoil.BasinHeaterSchedulePtr = GetScheduleIndex(state, Alphas(15)); - if (thisDXCoil.BasinHeaterSchedulePtr == 0) { - ShowWarningError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, thisDXCoil.Name)); - ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(15), Alphas(15))); - ShowContinueError(state, "Basin heater will be available to operate throughout the simulation."); + if ((thisDXCoil.basinHeaterSched = Sched::GetSchedule(state, Alphas(15))) == nullptr) { + ShowWarningItemNotFound( + state, eoh, cAlphaFields(15), Alphas(15), "Basin heater will be available to operate throughout the simulation."); } } @@ -1401,6 +1394,7 @@ void GetDXCoils(EnergyPlusData &state) cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; ++DXCoilNum; // ErrorsFound will be set to True if problem was found, left untouched otherwise VerifyUniqueCoilName(state, CurrentModuleObject, Alphas(1), ErrorsFound, CurrentModuleObject + " Name"); @@ -1412,16 +1406,11 @@ void GetDXCoils(EnergyPlusData &state) state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).SourceType = CurrentModuleObject; thisDXCoil.DXCoilType = CurrentModuleObject; thisDXCoil.DXCoilType_Num = HVAC::CoilDX_CoolingTwoStageWHumControl; - thisDXCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { - thisDXCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisDXCoil.SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (thisDXCoil.SchedPtr == 0) { - ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, thisDXCoil.Name)); - ShowContinueError(state, format("...{}=\"{}\".", cAlphaFields(2), Alphas(2))); - ErrorsFound = true; - } + thisDXCoil.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisDXCoil.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } thisDXCoil.AirInNode = GetOnlySingleNode(state, @@ -1811,7 +1800,7 @@ void GetDXCoils(EnergyPlusData &state) thisDXCoil.RatedEIR(PerfModeNum) = 1.0 / thisDXCoil.RatedCOP(PerfModeNum); - // read in user specified SHR modifer curves + // read in user specified SHR modifier curves if (!lAlphaBlanks2(9) && NumAlphas2 > 8) { thisDXCoil.SHRFTemp(PerfModeNum) = GetCurveIndex(state, Alphas2(9)); // convert curve name to number if (thisDXCoil.SHRFTemp(PerfModeNum) == 0) { @@ -1928,11 +1917,9 @@ void GetDXCoils(EnergyPlusData &state) } if (!lAlphaBlanks(16)) { - thisDXCoil.BasinHeaterSchedulePtr = GetScheduleIndex(state, Alphas(16)); - if (thisDXCoil.BasinHeaterSchedulePtr == 0) { - ShowWarningError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, thisDXCoil.Name)); - ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(16), Alphas(16))); - ShowContinueError(state, "Basin heater will be available to operate throughout the simulation."); + if ((thisDXCoil.basinHeaterSched = Sched::GetSchedule(state, Alphas(16))) == nullptr) { + ShowWarningItemNotFound( + state, eoh, cAlphaFields(16), Alphas(16), "Basin heater will be available to operate throughout the simulation."); } } @@ -1962,6 +1949,7 @@ void GetDXCoils(EnergyPlusData &state) cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; // allocate single performance mode for numeric field strings used for sizing routine state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames.allocate(MaxNumbers); @@ -1973,16 +1961,11 @@ void GetDXCoils(EnergyPlusData &state) thisDXCoil.Name = Alphas(1); thisDXCoil.DXCoilType = CurrentModuleObject; thisDXCoil.DXCoilType_Num = HVAC::CoilDX_HeatingEmpirical; - thisDXCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { - thisDXCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisDXCoil.SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (thisDXCoil.SchedPtr == 0) { - ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, thisDXCoil.Name)); - ShowContinueError(state, format("...{}=\"{}\".", cAlphaFields(2), Alphas(2))); - ErrorsFound = true; - } + thisDXCoil.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisDXCoil.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } thisDXCoil.AirInNode = GetOnlySingleNode(state, @@ -2426,6 +2409,8 @@ void GetDXCoils(EnergyPlusData &state) cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + // allocate single performance mode for numeric field strings used for sizing routine state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames.allocate(MaxNumbers); @@ -2440,16 +2425,11 @@ void GetDXCoils(EnergyPlusData &state) state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).SourceType = CurrentModuleObject; thisDXCoil.DXCoilType = CurrentModuleObject; thisDXCoil.DXCoilType_Num = HVAC::CoilDX_CoolingTwoSpeed; - thisDXCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { - thisDXCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisDXCoil.SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (thisDXCoil.SchedPtr == 0) { - ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, thisDXCoil.Name)); - ShowContinueError(state, format("...{}=\"{}\".", cAlphaFields(2), Alphas(2))); - ErrorsFound = true; - } + thisDXCoil.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisDXCoil.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } thisDXCoil.RatedTotCap(1) = Numbers(1); thisDXCoil.RatedSHR(1) = Numbers(2); @@ -2880,11 +2860,9 @@ void GetDXCoils(EnergyPlusData &state) } if (!lAlphaBlanks(16)) { - thisDXCoil.BasinHeaterSchedulePtr = GetScheduleIndex(state, Alphas(16)); - if (thisDXCoil.BasinHeaterSchedulePtr == 0) { - ShowWarningError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, thisDXCoil.Name)); - ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(16), Alphas(16))); - ShowContinueError(state, "Basin heater will be available to operate throughout the simulation."); + if ((thisDXCoil.basinHeaterSched = Sched::GetSchedule(state, Alphas(16))) == nullptr) { + ShowWarningItemNotFound( + state, eoh, cAlphaFields(16), Alphas(16), "Basin heater will be available to operate throughout the simulation."); } } @@ -3014,7 +2992,7 @@ void GetDXCoils(EnergyPlusData &state) thisDXCoil.Name = Alphas(1); thisDXCoil.DXCoilType = CurrentModuleObject; thisDXCoil.DXCoilType_Num = HVAC::CoilDX_HeatPumpWaterHeaterPumped; - thisDXCoil.SchedPtr = 0; // heat pump water heater DX coil has no schedule + thisDXCoil.availSched = Sched::GetScheduleAlwaysOff(state); // heat pump water heater DX coil has no schedule // Store the HPWH DX coil heating capacity in RatedTotCap2. After backing off pump and fan heat, // move to RatedTotCap() for use by DX coil @@ -3507,7 +3485,7 @@ void GetDXCoils(EnergyPlusData &state) thisDXCoil.Name = Alphas(1); thisDXCoil.DXCoilType = CurrentModuleObject; thisDXCoil.DXCoilType_Num = HVAC::CoilDX_HeatPumpWaterHeaterWrapped; - thisDXCoil.SchedPtr = 0; // heat pump water heater DX coil has no schedule + thisDXCoil.availSched = Sched::GetScheduleAlwaysOff(state); // heat pump water heater DX coil has no schedule // Store the HPWH DX coil heating capacity in RatedTotCap2. After backing off pump and fan heat, // move to RatedTotCap() for use by DX coil @@ -3890,6 +3868,7 @@ void GetDXCoils(EnergyPlusData &state) cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; // allocate single performance mode for numeric field strings used for sizing routine (all fields are in this object) state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode(1).FieldNames.allocate(MaxNumbers); @@ -3904,16 +3883,11 @@ void GetDXCoils(EnergyPlusData &state) state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).SourceType = CurrentModuleObject; thisDXCoil.DXCoilType = CurrentModuleObject; thisDXCoil.DXCoilType_Num = HVAC::CoilDX_MultiSpeedCooling; - thisDXCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { - thisDXCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisDXCoil.SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (thisDXCoil.SchedPtr == 0) { - ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, thisDXCoil.Name)); - ShowContinueError(state, format("...{}=\"{}\".", cAlphaFields(2), Alphas(2))); - ErrorsFound = true; - } + thisDXCoil.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisDXCoil.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } thisDXCoil.AirInNode = GetOnlySingleNode(state, @@ -4072,11 +4046,9 @@ void GetDXCoils(EnergyPlusData &state) } if (!lAlphaBlanks(12)) { - thisDXCoil.BasinHeaterSchedulePtr = GetScheduleIndex(state, Alphas(12)); - if (thisDXCoil.BasinHeaterSchedulePtr == 0) { - ShowWarningError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, thisDXCoil.Name)); - ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(12), Alphas(12))); - ShowContinueError(state, "Basin heater will be available to operate throughout the simulation."); + if ((thisDXCoil.basinHeaterSched = Sched::GetSchedule(state, Alphas(12))) == nullptr) { + ShowWarningItemNotFound( + state, eoh, cAlphaFields(12), Alphas(12), "Basin heater will be available to operate throughout the simulation."); } } @@ -4439,6 +4411,8 @@ void GetDXCoils(EnergyPlusData &state) cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + // *** will have to circle back to this one to fix since the multispeed coil has all fields in this coil object *** // allocate single performance mode for numeric field strings used for sizing routine state.dataDXCoils->DXCoilNumericFields(DXCoilNum).PerfMode.allocate(1); @@ -4454,16 +4428,11 @@ void GetDXCoils(EnergyPlusData &state) state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).SourceType = CurrentModuleObject; thisDXCoil.DXCoilType = CurrentModuleObject; thisDXCoil.DXCoilType_Num = HVAC::CoilDX_MultiSpeedHeating; - thisDXCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { - thisDXCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisDXCoil.SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (thisDXCoil.SchedPtr == 0) { - ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, thisDXCoil.Name)); - ShowContinueError(state, format("...{}=\"{}\".", cAlphaFields(2), Alphas(2))); - ErrorsFound = true; - } + thisDXCoil.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisDXCoil.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } thisDXCoil.AirInNode = GetOnlySingleNode(state, @@ -4931,6 +4900,8 @@ void GetDXCoils(EnergyPlusData &state) cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + ++DXCoilNum; // allocate single performance mode for numeric field strings used for sizing routine @@ -4944,16 +4915,12 @@ void GetDXCoils(EnergyPlusData &state) thisDXCoil.Name = Alphas(1); thisDXCoil.DXCoilType = CurrentModuleObject; thisDXCoil.DXCoilType_Num = HVAC::CoilVRF_Cooling; - thisDXCoil.Schedule = Alphas(2); + if (lAlphaBlanks(2)) { - thisDXCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisDXCoil.SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (thisDXCoil.SchedPtr == 0) { - ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, thisDXCoil.Name)); - ShowContinueError(state, format("...{}=\"{}\".", cAlphaFields(2), Alphas(2))); - ErrorsFound = true; - } + thisDXCoil.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisDXCoil.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } thisDXCoil.RatedTotCap(1) = Numbers(1); thisDXCoil.RatedSHR(1) = Numbers(2); @@ -5075,6 +5042,7 @@ void GetDXCoils(EnergyPlusData &state) cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; ++DXCoilNum; // allocate single performance mode for numeric field strings used for sizing routine @@ -5088,16 +5056,11 @@ void GetDXCoils(EnergyPlusData &state) thisDXCoil.Name = Alphas(1); thisDXCoil.DXCoilType = CurrentModuleObject; thisDXCoil.DXCoilType_Num = HVAC::CoilVRF_Heating; - thisDXCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { - thisDXCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisDXCoil.SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (thisDXCoil.SchedPtr == 0) { - ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, thisDXCoil.Name)); - ShowContinueError(state, format("...{}=\"{}\".", cAlphaFields(2), Alphas(2))); - ErrorsFound = true; - } + thisDXCoil.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisDXCoil.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } thisDXCoil.RatedTotCap(1) = Numbers(1); thisDXCoil.RatedAirVolFlowRate(1) = Numbers(2); @@ -5208,6 +5171,7 @@ void GetDXCoils(EnergyPlusData &state) cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; ++DXCoilNum; // allocate single performance mode for numeric field strings used for sizing routine @@ -5221,16 +5185,11 @@ void GetDXCoils(EnergyPlusData &state) thisDXCoil.Name = Alphas(1); thisDXCoil.DXCoilType = CurrentModuleObject; thisDXCoil.DXCoilType_Num = HVAC::CoilVRF_FluidTCtrl_Cooling; - thisDXCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { - thisDXCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisDXCoil.SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (thisDXCoil.SchedPtr == 0) { - ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, thisDXCoil.Name)); - ShowContinueError(state, format("...{}=\"{}\".", cAlphaFields(2), Alphas(2))); - ErrorsFound = true; - } + thisDXCoil.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisDXCoil.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } thisDXCoil.AirInNode = GetOnlySingleNode(state, @@ -5257,7 +5216,7 @@ void GetDXCoils(EnergyPlusData &state) thisDXCoil.RatedSHR(1) = Numbers(2); thisDXCoil.SH = Numbers(3); // @@ DXCoil( DXCoilNum ).RateBFVRFIUEvap = 0.0592; there will be a new field for this, which will be handled in a separate issue to - // update VRF-HP idd. It is not hanlded here to avoide tranistion issues for VRF-HP. + // update VRF-HP idd. It is not handled here to avoid transition issues for VRF-HP. int indexSHCurve = GetCurveIndex(state, Alphas(5)); // convert curve name to index number // Verify curve name and type @@ -5326,6 +5285,7 @@ void GetDXCoils(EnergyPlusData &state) cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; ++DXCoilNum; // allocate single performance mode for numeric field strings used for sizing routine @@ -5339,16 +5299,11 @@ void GetDXCoils(EnergyPlusData &state) thisDXCoil.Name = Alphas(1); thisDXCoil.DXCoilType = CurrentModuleObject; thisDXCoil.DXCoilType_Num = HVAC::CoilVRF_FluidTCtrl_Heating; - thisDXCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { - thisDXCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisDXCoil.SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (thisDXCoil.SchedPtr == 0) { - ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, thisDXCoil.Name)); - ShowContinueError(state, format("...{}=\"{}\".", cAlphaFields(2), Alphas(2))); - ErrorsFound = true; - } + thisDXCoil.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisDXCoil.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } thisDXCoil.AirInNode = GetOnlySingleNode(state, @@ -6836,7 +6791,7 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur thisDXCoil.RatedAirVolFlowRate(Mode), thisDXCoil.RatedSHR(Mode)); - // call coil model with everthing set at rating point + // call coil model with everything set at rating point thisDXCoil.InletAirMassFlowRate = thisDXCoil.RatedAirMassFlowRate(Mode); thisDXCoil.InletAirMassFlowRateMax = thisDXCoil.RatedAirMassFlowRate(Mode); thisDXCoil.InletAirTemp = RatedInletAirTemp; @@ -6998,7 +6953,7 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur } } - // call coil model with everthing set at rating point + // call coil model with everything set at rating point thisDXCoil.InletAirMassFlowRate = thisDXCoil.RatedAirMassFlowRate(Mode); thisDXCoil.InletAirMassFlowRateMax = thisDXCoil.RatedAirMassFlowRate(Mode); @@ -7096,7 +7051,7 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur thisDXCoil.RatedAirVolFlowRate2, thisDXCoil.RatedSHR2); - // call for standard ratings for two-speeed DX coil + // call for standard ratings for two-speed DX coil if (thisDXCoil.CondenserType(1) == DataHeatBalance::RefrigCondenserType::Air) { CalcTwoSpeedDXCoilStandardRating(state, DXCoilNum); } @@ -7241,7 +7196,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) // Feb 2005, M. J. Witte, GARD Analytics, Inc. Add new coil type COIL:DX:MultiMode:CoolingEmpirical. // Jul 2005, R. Raustad, FSEC. Add new coil type COIL:DX:HEATPUMPWATERHEATER // Jun 2007, L. Gu, FSEC. Add new coil type COIL:DX:MULTISPEED:COOLING and HEATING - // Jan 2011, B. Griffithn, NREL. add EMS overrides for autosized fields + // Jan 2011, B. Griffith, NREL. add EMS overrides for autosized fields // Aug 2013, D. Kang. add component sizing table entries // May 2014, R. Raustad, FSEC. moved sizing calculations to common routine // Aug 2015, R. Zhang, LBNL. Add new coil types for VRF_FluidTCtrl @@ -7391,7 +7346,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) state.dataSize->DXCoolCap; // pass global variable used only for heat pumps (i.e., DX cooling and heating coils) if ((thisDXCoil.IsSecondaryDXCoilInZone) && (thisDXCoil.CondenserType(1) == - DataHeatBalance::RefrigCondenserType::Air)) { // seconday DX coil in secondary zone is specified + DataHeatBalance::RefrigCondenserType::Air)) { // secondary DX coil in secondary zone is specified SizeSecDXCoil = true; } } else if (thisDXCoil.DXCoilType_Num == HVAC::CoilVRF_Heating) { @@ -7925,7 +7880,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) state.dataSize->DataFractionUsedForSizing = 0.0; } - // Ensure flow rate at lower speed must be lower or equal to the flow rate at higher speed. Otherwise, a severe error is isssued. + // Ensure flow rate at lower speed must be lower or equal to the flow rate at higher speed. Otherwise, a severe error is issued. for (Mode = 1; Mode <= thisDXCoil.NumOfSpeeds - 1; ++Mode) { if (thisDXCoil.MSRatedAirVolFlowRate(Mode) > thisDXCoil.MSRatedAirVolFlowRate(Mode + 1)) { ShowWarningError(state, @@ -8049,7 +8004,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) thisDXCoil.MSRatedSHR(Mode) = sizerCoolingSHR.size(state, TempSize, ErrorsFound); // added for rated sensible cooling capacity estimate for html reporting, issue #7381 thisDXCoil.RatedSHR(1) = thisDXCoil.MSRatedSHR(Mode); - // design SHR value at the maxiumum speed calculated above was supposed to be used for all speeds + // design SHR value at the maximum speed calculated above was supposed to be used for all speeds // Now user specified SHR value is used when the SHR field is not autosized and design day run is // set to yes unless the code below is commented out MSRatedSHRDes = thisDXCoil.MSRatedSHR(Mode); @@ -8071,7 +8026,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) state.dataSize->DataFractionUsedForSizing = 0.0; state.dataSize->DataConstantUsedForSizing = 0.0; - // Rated Evapovative condenser airflow rates + // Rated Evaporative condenser airflow rates for (Mode = 1; Mode <= thisDXCoil.NumOfSpeeds; ++Mode) { IsAutoSize = false; if (thisDXCoil.MSEvapCondAirFlow(Mode) == AutoSize) { @@ -8134,7 +8089,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) } } - // Sizing multispeed rated evapovative condenser pump power + // Sizing multispeed rated evaporative condenser pump power for (Mode = 1; Mode <= thisDXCoil.NumOfSpeeds; ++Mode) { IsAutoSize = false; if (thisDXCoil.MSEvapCondPumpElecNomPower(Mode) == AutoSize) { @@ -8185,7 +8140,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) } } - // Ensure evaporative condesner pump power at lower speed must be lower or equal to one at higher speed. + // Ensure evaporative condenser pump power at lower speed must be lower or equal to one at higher speed. for (Mode = 1; Mode <= thisDXCoil.NumOfSpeeds - 1; ++Mode) { if (thisDXCoil.MSEvapCondPumpElecNomPower(Mode) > thisDXCoil.MSEvapCondPumpElecNomPower(Mode + 1)) { ShowWarningError(state, @@ -8263,7 +8218,7 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum) state.dataSize->DataFractionUsedForSizing = 0.0; } - // Ensure flow rate at lower speed must be lower or equal to the flow rate at higher speed. Otherwise, a severe error is isssued. + // Ensure flow rate at lower speed must be lower or equal to the flow rate at higher speed. Otherwise, a severe error is issued. for (Mode = 1; Mode <= thisDXCoil.NumOfSpeeds - 1; ++Mode) { if (thisDXCoil.MSRatedAirVolFlowRate(Mode) > thisDXCoil.MSRatedAirVolFlowRate(Mode + 1)) { ShowWarningError(state, @@ -9234,7 +9189,7 @@ void CalcDoe2DXCoil(EnergyPlusData &state, // calculate end time of current time step to determine if error messages should be printed state.dataDXCoils->CurrentEndTime = state.dataGlobal->CurrentTime + SysTimeElapsed; - // Print warning messages only when valid and only for the first ocurrance. Let summary provide statistics. + // Print warning messages only when valid and only for the first occurrence. Let summary provide statistics. // Wait for next time step to print warnings. If simulation iterates, print out // the warning for the last iteration only. Must wait for next time step to accomplish this. // If a warning occurs and the simulation down shifts, the warning is not valid. @@ -9300,7 +9255,7 @@ void CalcDoe2DXCoil(EnergyPlusData &state, thisDXCoil.PrintLowOutTempMessage = false; if ((AirMassFlow > 0.0) && - (GetCurrentScheduleValue(state, thisDXCoil.SchedPtr) > 0.0 || thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterPumped || + (thisDXCoil.availSched->getCurrentVal() > 0.0 || thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterPumped || thisDXCoil.DXCoilType_Num == HVAC::CoilDX_HeatPumpWaterHeaterWrapped) && (PartLoadRatio > 0.0) && (compressorOp == HVAC::CompressorOp::On) && CompAmbTemp > thisDXCoil.MinOATCompressor) { // criteria for coil operation @@ -9437,7 +9392,7 @@ void CalcDoe2DXCoil(EnergyPlusData &state, } // Get total capacity modifying factor (function of temperature) for off-rated conditions - // InletAirHumRat may be modified in this ADP/BF loop, use temporary varible for calculations + // InletAirHumRat may be modified in this ADP/BF loop, use temporary variable for calculations InletAirHumRatTemp = InletAirHumRat; AirMassFlowRatio = AirMassFlow / thisDXCoil.RatedAirMassFlowRate(Mode); while (true) { @@ -9785,7 +9740,7 @@ void CalcDoe2DXCoil(EnergyPlusData &state, // Default to cycling fan, cycling compressor // Also return this result for stage 2 operation of multimode coil // Cycling fan typically provides full outlet conditions. When RH control is used, account for additional - // heating run time by using cooing/heating ratio the same as constant fan (otherwise PLRRatio = 1). + // heating run time by using cooling/heating ratio the same as constant fan (otherwise PLRRatio = 1). OutletAirEnthalpy = FullLoadOutAirEnth * DXcoolToHeatPLRRatio + InletAirEnthalpy * (1.0 - DXcoolToHeatPLRRatio); OutletAirHumRat = FullLoadOutAirHumRat * DXcoolToHeatPLRRatio + InletAirHumRat * (1.0 - DXcoolToHeatPLRRatio); OutletAirTemp = FullLoadOutAirTemp * DXcoolToHeatPLRRatio + InletAirDryBulbTemp * (1.0 - DXcoolToHeatPLRRatio); @@ -9928,7 +9883,7 @@ void CalcDoe2DXCoil(EnergyPlusData &state, // Calculate basin heater power CalcBasinHeaterPower(state, thisDXCoil.BasinHeaterPowerFTempDiff, - thisDXCoil.BasinHeaterSchedulePtr, + thisDXCoil.basinHeaterSched, thisDXCoil.BasinHeaterSetPointTemp, thisDXCoil.BasinHeaterPower); if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed) { @@ -9972,7 +9927,7 @@ void CalcDoe2DXCoil(EnergyPlusData &state, if (any_eq(thisDXCoil.CondenserType, DataHeatBalance::RefrigCondenserType::Evap)) { CalcBasinHeaterPower(state, thisDXCoil.BasinHeaterPowerFTempDiff, - thisDXCoil.BasinHeaterSchedulePtr, + thisDXCoil.basinHeaterSched, thisDXCoil.BasinHeaterSetPointTemp, thisDXCoil.BasinHeaterPower); } @@ -9980,7 +9935,7 @@ void CalcDoe2DXCoil(EnergyPlusData &state, if (thisDXCoil.CondenserType(Mode) == DataHeatBalance::RefrigCondenserType::Evap) { CalcBasinHeaterPower(state, thisDXCoil.BasinHeaterPowerFTempDiff, - thisDXCoil.BasinHeaterSchedulePtr, + thisDXCoil.basinHeaterSched, thisDXCoil.BasinHeaterSetPointTemp, thisDXCoil.BasinHeaterPower); } @@ -10049,7 +10004,7 @@ void CalcVRFCoolingCoil(EnergyPlusData &state, // of entering air temperatures and supply air flow rate (actual vs rated flow). The model // does NOT employ the exact same methodology to calculate performance as DOE-2. // This VRF cooling coil model adjusts the rated total cooling capacity by the CAPFT - // and CAP funciton of flow curve/model currently used by the existing DX coil model. + // and CAP function of flow curve/model currently used by the existing DX coil model. // The part-load ratio is then applied to the total operating capacity to find the capacity // required to meet the load. This VRF model then uses the ADP/bypass method to find the // SHR and resulting outlet conditions given that total capacity (or delta H). @@ -10221,7 +10176,7 @@ void CalcVRFCoolingCoil(EnergyPlusData &state, // calculate end time of current time step to determine if error messages should be printed state.dataDXCoils->CalcVRFCoolingCoilCurrentEndTime = state.dataGlobal->CurrentTime + SysTimeElapsed; - // Print warning messages only when valid and only for the first ocurrance. Let summary provide statistics. + // Print warning messages only when valid and only for the first occurrence. Let summary provide statistics. // Wait for next time step to print warnings. If simulation iterates, print out // the warning for the last iteration only. Must wait for next time step to accomplish this. // If a warning occurs and the simulation down shifts, the warning is not valid. @@ -10292,7 +10247,7 @@ void CalcVRFCoolingCoil(EnergyPlusData &state, thisDXCoil.PrintLowAmbMessage = false; thisDXCoil.PrintLowOutTempMessage = false; - if ((AirMassFlow > 0.0) && (GetCurrentScheduleValue(state, thisDXCoil.SchedPtr) > 0.0) && (PartLoadRatio > 0.0) && + if ((AirMassFlow > 0.0) && (thisDXCoil.availSched->getCurrentVal() > 0.0) && (PartLoadRatio > 0.0) && (compressorOp == HVAC::CompressorOp::On)) { // for cycling fan, reset mass flow to full on rate if (fanOp == HVAC::FanOp::Cycling) { AirMassFlow /= PartLoadRatio; @@ -10402,7 +10357,7 @@ void CalcVRFCoolingCoil(EnergyPlusData &state, } // Get total capacity modifying factor (function of temperature) for off-rated conditions - // InletAirHumRat may be modified in this ADP/BF loop, use temporary varible for calculations + // InletAirHumRat may be modified in this ADP/BF loop, use temporary variable for calculations InletAirHumRatTemp = InletAirHumRat; Label50:; @@ -10742,7 +10697,7 @@ void CalcDXHeatingCoil(EnergyPlusData &state, // REFERENCES: // Winkelmann, F.C., Birdsall, B.E., Buhl W.F., Ellington, K.L., Erdem, A.E. 1993. - // DOE-2 Supplement Version 2.1E. Energy and Environment Division, Larwence Berkely + // DOE-2 Supplement Version 2.1E. Energy and Environment Division, Lawrence Berkeley // Laboratory. // Henderson, H.I. Jr., Y.J. Huang and Danny Parker. 1999. Residential Equipment Part // Load Curves for Use in DOE-2. Environmental Energy Technologies Division, Ernest @@ -10872,7 +10827,7 @@ void CalcDXHeatingCoil(EnergyPlusData &state, CrankcaseHeatingPower = 0.0; } - if ((AirMassFlow > 0.0) && (GetCurrentScheduleValue(state, thisDXCoil.SchedPtr) > 0.0) && (PartLoadRatio > 0.0) && + if ((AirMassFlow > 0.0) && (thisDXCoil.availSched->getCurrentVal() > 0.0) && (PartLoadRatio > 0.0) && OutdoorDryBulb > thisDXCoil.MinOATCompressor) { // for cycling fan, reset mass flow to full on rate if (fanOp == HVAC::FanOp::Cycling) AirMassFlow /= PartLoadRatio; @@ -10912,7 +10867,7 @@ void CalcDXHeatingCoil(EnergyPlusData &state, // Get total capacity modifying factor (function of temperature) for off-rated conditions // Model was extended to accept bi-quadratic curves. This allows sensitivity of the heating capacity // to the entering dry-bulb temperature as well as the outside dry-bulb temperature. User is - // advised to use the bi-quaratic curve if sufficient manufacturer data is available. + // advised to use the bi-quadratic curve if sufficient manufacturer data is available. if (state.dataCurveManager->PerfCurve(thisDXCoil.CCapFTemp(Mode))->numDims == 2) { switch (thisDXCoil.HeatingPerformanceOATType) { case HVAC::OATType::DryBulb: { @@ -11051,7 +11006,7 @@ void CalcDXHeatingCoil(EnergyPlusData &state, // Calculate electricity consumed. First, get EIR modifying factors for off-rated conditions // Model was extended to accept bi-quadratic curves. This allows sensitivity of the EIR // to the entering dry-bulb temperature as well as the outside dry-bulb temperature. User is - // advised to use the bi-quaratic curve if sufficient manufacturer data is available. + // advised to use the bi-quadratic curve if sufficient manufacturer data is available. if (thisDXCoil.DXCoilType_Num != HVAC::CoilVRF_Heating && thisDXCoil.DXCoilType_Num != HVAC::CoilVRF_FluidTCtrl_Heating) { if (state.dataCurveManager->PerfCurve(thisDXCoil.EIRFTemp(Mode))->numDims == 1) { EIRTempModFac = CurveValue(state, thisDXCoil.EIRFTemp(Mode), OutdoorDryBulb); @@ -11352,8 +11307,8 @@ void CalcMultiSpeedDXCoil(EnergyPlusData &state, CondInletHumRat = PsyWFnTdbTwbPb(state, CondInletTemp, OutdoorWetBulb, OutdoorPressure); } - if ((AirMassFlow > 0.0 && CompAmbTemp >= thisDXCoil.MinOATCompressor) && - ((GetCurrentScheduleValue(state, thisDXCoil.SchedPtr) > 0.0) || (LocalForceOn)) && (SpeedRatio > 0.0 || CycRatio > 0.0)) { + if ((AirMassFlow > 0.0 && CompAmbTemp >= thisDXCoil.MinOATCompressor) && ((thisDXCoil.availSched->getCurrentVal() > 0.0) || (LocalForceOn)) && + (SpeedRatio > 0.0 || CycRatio > 0.0)) { RhoAir = PsyRhoAirFnPbTdbW(state, OutdoorPressure, OutdoorDryBulb, OutdoorHumRat); if (SpeedRatio > 0.0) { @@ -11623,7 +11578,7 @@ void CalcMultiSpeedDXCoil(EnergyPlusData &state, if (thisDXCoil.CoolingCoilRuntimeFraction > 1.0) { thisDXCoil.CoolingCoilRuntimeFraction = 1.0; // Reset coil runtime fraction to 1.0 } - // get the eletrical power consumption + // get the electrical power consumption thisDXCoil.ElecCoolingPower = TotCapLS * EIRLS * thisDXCoil.CoolingCoilRuntimeFraction; // Coil total/sensible/latent cooling rates and electrical power @@ -11662,7 +11617,7 @@ void CalcMultiSpeedDXCoil(EnergyPlusData &state, // Calculate basin heater power CalcBasinHeaterPower(state, thisDXCoil.BasinHeaterPowerFTempDiff, - thisDXCoil.BasinHeaterSchedulePtr, + thisDXCoil.basinHeaterSched, thisDXCoil.BasinHeaterSetPointTemp, thisDXCoil.BasinHeaterPower); thisDXCoil.BasinHeaterPower *= (1.0 - thisDXCoil.CoolingCoilRuntimeFraction); @@ -11686,7 +11641,7 @@ void CalcMultiSpeedDXCoil(EnergyPlusData &state, if (thisDXCoil.CondenserType(Mode) == DataHeatBalance::RefrigCondenserType::Evap) { CalcBasinHeaterPower(state, thisDXCoil.BasinHeaterPowerFTempDiff, - thisDXCoil.BasinHeaterSchedulePtr, + thisDXCoil.basinHeaterSched, thisDXCoil.BasinHeaterSetPointTemp, thisDXCoil.BasinHeaterPower); } @@ -11746,7 +11701,7 @@ void CalcBasinHeaterPowerForMultiModeDXCoil(EnergyPlusData &state, } else if (thisDXCoil.CondenserType(PerfMode + 1) == DataHeatBalance::RefrigCondenserType::Evap) { CalcBasinHeaterPower(state, thisDXCoil.BasinHeaterPowerFTempDiff, - thisDXCoil.BasinHeaterSchedulePtr, + thisDXCoil.basinHeaterSched, thisDXCoil.BasinHeaterSetPointTemp, thisDXCoil.BasinHeaterPower); thisDXCoil.BasinHeaterPower *= (1.0 - thisDXCoil.CoolingCoilStg2RuntimeFrac); @@ -12052,7 +12007,7 @@ Real64 ValidateADP(EnergyPlusData &state, // DATE WRITTEN December 2015 // PURPOSE OF THIS FUNCTION: - // Validates that the calcualted bypass factor represents valid SHR based on total capacity and air mass flow rate. + // Validates that the calculated bypass factor represents valid SHR based on total capacity and air mass flow rate. // METHODOLOGY EMPLOYED: // With model parameters autosized by the user, the SHR is selected based on an empirical model. @@ -12223,7 +12178,7 @@ Real64 CalcEffectiveSHR(EnergyPlusData &state, Twet = min(Twet_Rated * QLatRated / (QLatActual + 1.e-10), Twet_max); Gamma = Gamma_Rated * QLatRated * (EnteringDB - EnteringWB) / ((26.7 - 19.4) * QLatActual + 1.e-10); - // Calculate the compressor on and off times using a converntional thermostat curve + // Calculate the compressor on and off times using a conventional thermostat curve Ton = 3600.0 / (4.0 * Nmax * (1.0 - RTF)); // duration of cooling coil on-cycle (sec) Toff = 3600.0 / (4.0 * Nmax * RTF); // duration of cooling coil off-cycle (sec) @@ -12239,7 +12194,7 @@ Real64 CalcEffectiveSHR(EnergyPlusData &state, // and real world applications would use a single heating coil for both purposes, the actual // fan operation is based on HeatingPLR + ReheatPLR. For cycling fan RH control, latent // degradation only occurs when a heating load exists, in this case the reheat load is - // equal to and oposite in magnitude to the cooling coil sensible output but the reheat + // equal to and opposite in magnitude to the cooling coil sensible output but the reheat // coil is not always active. This additional fan run time has not been accounted for at this time. // Recalculate Toff for cycling fan systems when heating is active if (present(HeatingRTF)) { @@ -12252,7 +12207,7 @@ Real64 CalcEffectiveSHR(EnergyPlusData &state, } } - // Use sucessive substitution to solve for To + // Use successive substitution to solve for To aa = (Gamma * Toffa) - (0.25 / Twet) * pow_2(Gamma) * pow_2(Toffa); To1 = aa + Tcl; Error = 1.0; @@ -12471,7 +12426,7 @@ void CalcMultiSpeedDXCoilCooling(EnergyPlusData &state, Real64 LSOutletAirDryBulbTemp; // low speed outlet air dry bulb temperature [C] Real64 LSOutletAirEnthalpy; // low speed outlet air enthalpy [J/kg] Real64 LSOutletAirHumRat; // low speed outlet air humidity ratio [kg/kg] - Real64 HSOutletAirDryBulbTemp; // hihg speed outlet air dry bulb temperature [C] + Real64 HSOutletAirDryBulbTemp; // high speed outlet air dry bulb temperature [C] Real64 HSOutletAirEnthalpy; // high speed outlet air enthalpy [J/kg] Real64 HSOutletAirHumRat; // high speed outlet air humidity ratio [kg/kg] Real64 hDelta; // Change in air enthalpy across the cooling coil [J/kg] @@ -12638,7 +12593,7 @@ void CalcMultiSpeedDXCoilCooling(EnergyPlusData &state, CrankcaseHeatingPower = 0.0; } - if ((AirMassFlow > 0.0 && CondInletTemp >= thisDXCoil.MinOATCompressor) && (GetCurrentScheduleValue(state, thisDXCoil.SchedPtr) > 0.0) && + if ((AirMassFlow > 0.0 && CondInletTemp >= thisDXCoil.MinOATCompressor) && (thisDXCoil.availSched->getCurrentVal() > 0.0) && ((SpeedRatio > 0.0 && SingleMode == 0) || CycRatio > 0.0) && (compressorOp == HVAC::CompressorOp::On)) { RhoAir = PsyRhoAirFnPbTdbW(state, OutdoorPressure, OutdoorDryBulb, OutdoorHumRat, RoutineName); @@ -13147,7 +13102,7 @@ void CalcMultiSpeedDXCoilCooling(EnergyPlusData &state, EIRFlowModFacLS = CurveValue(state, thisDXCoil.MSEIRFFlow(SpeedNum), AirMassFlowRatioLS); EIRLS = 1.0 / thisDXCoil.MSRatedCOP(SpeedNum) * EIRTempModFacLS * EIRFlowModFacLS; - // get the eletrical power consumption + // get the electrical power consumption thisDXCoil.ElecCoolingPower = TotCapLS * EIRLS * thisDXCoil.CoolingCoilRuntimeFraction; // calculate cooling output power // AirMassFlow = DXCoil(DXCoilNum)%InletAirMassFlowRate @@ -13216,7 +13171,7 @@ void CalcMultiSpeedDXCoilCooling(EnergyPlusData &state, // Calculate basin heater power CalcBasinHeaterPower(state, thisDXCoil.BasinHeaterPowerFTempDiff, - thisDXCoil.BasinHeaterSchedulePtr, + thisDXCoil.basinHeaterSched, thisDXCoil.BasinHeaterSetPointTemp, thisDXCoil.BasinHeaterPower); thisDXCoil.BasinHeaterPower *= (1.0 - thisDXCoil.CoolingCoilRuntimeFraction); @@ -13248,7 +13203,7 @@ void CalcMultiSpeedDXCoilCooling(EnergyPlusData &state, if (thisDXCoil.CondenserType(DXMode) == DataHeatBalance::RefrigCondenserType::Evap) { CalcBasinHeaterPower(state, thisDXCoil.BasinHeaterPowerFTempDiff, - thisDXCoil.BasinHeaterSchedulePtr, + thisDXCoil.basinHeaterSched, thisDXCoil.BasinHeaterSetPointTemp, thisDXCoil.BasinHeaterPower); } @@ -13341,22 +13296,22 @@ void CalcMultiSpeedDXCoilHeating(EnergyPlusData &state, Real64 CrankcaseHeatingPower; // Power due to crank case heater Real64 AirVolumeFlowRate; // Air volume flow rate across the heating coil Real64 VolFlowperRatedTotCap; // Air volume flow rate divided by rated total heating capacity - Real64 TotCapTempModFac(0.0); // Total capacity modifier as a function ot temperature + Real64 TotCapTempModFac(0.0); // Total capacity modifier as a function of temperature Real64 TotCapFlowModFac; // Total capacity modifier as a function of flow ratio Real64 OutdoorCoilT; // Outdoor coil temperature Real64 OutdoorCoildw; // Outdoor coil delta w assuming coil temperature of OutdoorCoilT - Real64 LoadDueToDefrost; // Additonal load due to defrost - Real64 LoadDueToDefrostLS; // Additonal load due to defrost at low speed - Real64 LoadDueToDefrostHS; // Additonal load due to defrost at high speed + Real64 LoadDueToDefrost; // Additional load due to defrost + Real64 LoadDueToDefrostLS; // Additional load due to defrost at low speed + Real64 LoadDueToDefrostHS; // Additional load due to defrost at high speed Real64 HeatingCapacityMultiplier; // Multiplier for heating capacity when system is in defrost Real64 FractionalDefrostTime; // Fraction of time step when system is in defrost - Real64 InputPowerMultiplier; // Multiplier for poer when system is in defrost + Real64 InputPowerMultiplier; // Multiplier for power when system is in defrost Real64 DefrostEIRTempModFac; // EIR modifier for defrost Real64 FullLoadOutAirEnth; // Outlet full load enthalpy Real64 FullLoadOutAirHumRat; // Outlet humidity ratio at full load Real64 FullLoadOutAirTemp; // Outlet temperature at full load - Real64 FullLoadOutAirRH; // Outler relative humidity at full load - Real64 OutletAirTemp; // Supply ari temperature + Real64 FullLoadOutAirRH; // Outlet relative humidity at full load + Real64 OutletAirTemp; // Supply air temperature Real64 EIRTempModFac(0.0); // EIR modifier as a function of temperature Real64 EIRFlowModFac; // EIR modifier as a function of airflow ratio Real64 WasteHeatLS; // Waste heat at low speed @@ -13477,8 +13432,8 @@ void CalcMultiSpeedDXCoilHeating(EnergyPlusData &state, thisDXCoil.PartLoadRatio = 0.0; state.dataHeatBal->HeatReclaimDXCoil(DXCoilNum).AvailCapacity = 0.0; - if ((AirMassFlow > 0.0) && (GetCurrentScheduleValue(state, thisDXCoil.SchedPtr) > 0.0) && - ((CycRatio > 0.0) || (SpeedRatio > 0.0 && SingleMode == 0)) && OutdoorDryBulb > thisDXCoil.MinOATCompressor) { + if ((AirMassFlow > 0.0) && (thisDXCoil.availSched->getCurrentVal() > 0.0) && ((CycRatio > 0.0) || (SpeedRatio > 0.0 && SingleMode == 0)) && + OutdoorDryBulb > thisDXCoil.MinOATCompressor) { if (SpeedNum > 1 && SingleMode == 0) { @@ -13553,7 +13508,7 @@ void CalcMultiSpeedDXCoilHeating(EnergyPlusData &state, // Get total capacity modifying factor (function of temperature) for off-rated conditions // Model was extended to accept bi-quadratic curves. This allows sensitivity of the heating capacity // to the entering dry-bulb temperature as well as the outside dry-bulb temperature. User is - // advised to use the bi-quaratic curve if sufficient manufacturer data is available. + // advised to use the bi-quadratic curve if sufficient manufacturer data is available. // Low speed if (state.dataCurveManager->PerfCurve(thisDXCoil.MSCCapFTemp(SpeedNumLS))->numDims == 1) { TotCapTempModFac = CurveValue(state, thisDXCoil.MSCCapFTemp(SpeedNumLS), OutdoorDryBulb); @@ -13577,7 +13532,7 @@ void CalcMultiSpeedDXCoilHeating(EnergyPlusData &state, // Calculate electricity consumed. First, get EIR modifying factors for off-rated conditions // Model was extended to accept bi-quadratic curves. This allows sensitivity of the EIR // to the entering dry-bulb temperature as well as the outside dry-bulb temperature. User is - // advised to use the bi-quaratic curve if sufficient manufacturer data is available. + // advised to use the bi-quadratic curve if sufficient manufacturer data is available. // Low Speed if (state.dataCurveManager->PerfCurve(thisDXCoil.MSEIRFTemp(SpeedNumLS))->numDims == 1) { EIRTempModFac = CurveValue(state, thisDXCoil.MSEIRFTemp(SpeedNumLS), OutdoorDryBulb); @@ -13798,7 +13753,7 @@ void CalcMultiSpeedDXCoilHeating(EnergyPlusData &state, // Get total capacity modifying factor (function of temperature) for off-rated conditions // Model was extended to accept bi-quadratic curves. This allows sensitivity of the heating capacity // to the entering dry-bulb temperature as well as the outside dry-bulb temperature. User is - // advised to use the bi-quaratic curve if sufficient manufacturer data is available. + // advised to use the bi-quadratic curve if sufficient manufacturer data is available. if (state.dataCurveManager->PerfCurve(thisDXCoil.MSCCapFTemp(SpeedNum))->numDims == 1) { TotCapTempModFac = CurveValue(state, thisDXCoil.MSCCapFTemp(SpeedNum), OutdoorDryBulb); } else { @@ -14702,7 +14657,7 @@ void CalcTwoSpeedDXCoilStandardRating(EnergyPlusData &state, int const DXCoilNum newPreDefSubTable(state, state.dataOutRptPredefined->pdrEquip, "VAV DX Cooling Standard Rating Details"); state.dataOutRptPredefined->pdchVAVDXCoolCoilType = newPreDefColumn(state, state.dataOutRptPredefined->pdstVAVDXCoolCoil, "DX Cooling Coil Type"); - state.dataOutRptPredefined->pdchVAVDXFanName = newPreDefColumn(state, state.dataOutRptPredefined->pdstVAVDXCoolCoil, "Assocated Fan"); + state.dataOutRptPredefined->pdchVAVDXFanName = newPreDefColumn(state, state.dataOutRptPredefined->pdstVAVDXCoolCoil, "Associated Fan"); state.dataOutRptPredefined->pdchVAVDXCoolCoilNetCapSI = newPreDefColumn(state, state.dataOutRptPredefined->pdstVAVDXCoolCoil, "Net Cooling Capacity [W]"); state.dataOutRptPredefined->pdchVAVDXCoolCoilCOP = newPreDefColumn(state, state.dataOutRptPredefined->pdstVAVDXCoolCoil, "COP [W/W]"); @@ -14824,18 +14779,7 @@ void CalcTwoSpeedDXCoilStandardRating(EnergyPlusData &state, int const DXCoilNum PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilSEERUserIP, thisDXCoil.Name, "N/A"); PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilSEERStandardIP, thisDXCoil.Name, "N/A"); - addFootNoteSubTable( - state, - state.dataOutRptPredefined->pdstDXCoolCoil, - "ANSI/AHRI ratings account for supply air fan heat and electric power.
" - "1 - EnergyPlus object type.
" - "2 - Capacity less than 65K Btu/h (19050 W) - calculated as per AHRI Standard 210/240-2017.
" - "  Capacity of 65K Btu/h (19050 W) to less than 135K Btu/h (39565 W) - calculated as per AHRI Standard 340/360-2007.
" - "  Capacity from 135K (39565 W) to 250K Btu/hr (73268 W) - calculated as per AHRI Standard 365-2009 - Ratings not yet supported in " - "EnergyPlus.
" - "3 - SEER (User) is calculated using user-input PLF curve and cooling coefficient of degradation.
" - "  SEER (Standard) is calculated using the default PLF curve and cooling coefficient of degradation" - "from the appropriate AHRI standard."); + addFootNoteSubTable(state, state.dataOutRptPredefined->pdstDXCoolCoil, StandardRatings::AHRI2017FOOTNOTE); PreDefTableEntry(state, state.dataOutRptPredefined->pdchVAVDXCoolCoilType, thisDXCoil.Name, "Coil:Cooling:DX:TwoSpeed"); if (thisDXCoil.RateWithInternalStaticAndFanObject) { @@ -15564,11 +15508,11 @@ int GetDXCoilNumberOfSpeeds(EnergyPlusData &state, return NumberOfSpeeds; } -int GetDXCoilAvailSchPtr(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound, // set to true if problem - ObjexxFCL::Optional_int_const CoilIndex // Coil index number +Sched::Schedule *GetDXCoilAvailSched(EnergyPlusData &state, + std::string const &CoilType, // must match coil types in this module + std::string const &CoilName, // must match coil names for the coil type + bool &ErrorsFound, // set to true if problem + ObjexxFCL::Optional_int_const CoilIndex // Coil index number ) { @@ -15581,9 +15525,6 @@ int GetDXCoilAvailSchPtr(EnergyPlusData &state, // incorrect coil type or name is given, ErrorsFound is returned as true and schedule index is returned // as -1. - // Return value - int SchPtr; // returned availabiltiy schedule of matched coil - // FUNCTION LOCAL VARIABLE DECLARATIONS: int WhichCoil; @@ -15598,8 +15539,7 @@ int GetDXCoilAvailSchPtr(EnergyPlusData &state, ShowSevereError(state, "GetDXCoilAvailSchPtr: Invalid index passed = 0"); ShowContinueError(state, "... returning DXCoilAvailSchPtr as -1."); ErrorsFound = true; - SchPtr = -1; - return SchPtr; + return nullptr; } else { WhichCoil = CoilIndex; } @@ -15607,7 +15547,7 @@ int GetDXCoilAvailSchPtr(EnergyPlusData &state, WhichCoil = Util::FindItemInList(CoilName, state.dataDXCoils->DXCoil); } if (WhichCoil != 0) { - SchPtr = state.dataDXCoils->DXCoil(WhichCoil).SchedPtr; + return state.dataDXCoils->DXCoil(WhichCoil).availSched; } else { if (!present(CoilIndex)) { ShowSevereError(state, @@ -15616,10 +15556,8 @@ int GetDXCoilAvailSchPtr(EnergyPlusData &state, CoilName)); } ErrorsFound = true; - SchPtr = -1; + return nullptr; } - - return SchPtr; } Real64 GetDXCoilAirFlow(EnergyPlusData &state, @@ -15723,7 +15661,7 @@ int GetDXCoilCapFTCurveIndex(EnergyPlusData &state, default: { // CALL ShowSevereError(state, 'GetDXCoilCapFTCurveIndex: Could not find Coil, Type="'// & // TRIM(cAllCoilTypes(DXCoil(CoilIndex)%DXCoilType_Num))//'" Name="'//TRIM(DXCoil(CoilIndex)%Name)// & - // '" when accessing coil capacity as a function of temperture curve.') + // '" when accessing coil capacity as a function of temperature curve.') ErrorsFound = true; CapFTCurveIndex = 0; } break; @@ -15967,14 +15905,14 @@ Real64 CalcSHRUserDefinedCurves(EnergyPlusData &state, // DATE WRITTEN December 2012 // PURPOSE OF THIS FUNCTION: - // Returns the oprating sensible heat ratio for a given Rated SHR abd coil entering + // Returns the operating sensible heat ratio for a given Rated SHR and coil entering // air DBT and WBT, and supply air mass flow fraction. // METHODOLOGY EMPLOYED: // Model uses user specified rated SHR, and SHR modifying curves for temperature and flow // fraction. The curves adjust the rated SHR based on biquadratic curve for temperatures // and quadratic function for supply air mass flow ratio (actual vs rated). - // The biquadratic and quadratic curves are normalized caurves generated from manufacturer's + // The biquadratic and quadratic curves are normalized curves generated from manufacturer's // performance data // Using/Aliasing @@ -16087,10 +16025,10 @@ void CalcSecondaryDXCoils(EnergyPlusData &state, int const DXCoilNum) Real64 TotalHeatRejectionRate; // secondary coil total heat rejection rate int SecCoilSHRFT; // index of the SHR modifier curve for temperature of a secondary DX coil int SecCoilSHRFF; // index of the sHR modifier curve for flow fraction of a secondary DX coil - int MSSpeedNumLS; // current low speed number of multspeed HP - int MSSpeedNumHS; // current high speed number of multspeed HP - Real64 MSSpeedRatio; // current speed ratio of multspeed HP - Real64 MSCycRatio; // current cycling ratio of multspeed HP + int MSSpeedNumLS; // current low speed number of multispeed HP + int MSSpeedNumHS; // current high speed number of multispeed HP + Real64 MSSpeedRatio; // current speed ratio of multispeed HP + Real64 MSCycRatio; // current cycling ratio of multispeed HP Real64 SHRHighSpeed; // sensible heat ratio at high speed Real64 SHRLowSpeed; // sensible heat ratio at low speed @@ -16335,9 +16273,9 @@ Real64 CalcSecondaryDXCoilsSHR(EnergyPlusData &state, // METHODOLOGY EMPLOYED: // Energy balance: - // (1) checks if the seconday coil operation is dry and calculates appliavle SHR. + // (1) checks if the secondary coil operation is dry and calculates applicable SHR. // (2) determines SHR from user specified rated SHR values and SHR modifier curves for - // temperature and flor fraction. + // temperature and flow fraction. // (3) if secondary coil operates dry then the larger of the user SHR value and dry // coil operation SHR is selected. @@ -16356,13 +16294,13 @@ Real64 CalcSecondaryDXCoilsSHR(EnergyPlusData &state, Real64 DryCoilTestEvapInletWetBulb; // evaporator coil inlet dry bulb temperature test for dry coil Real64 FullLoadOutAirEnth; // evaporator outlet full load enthalpy [J/kg] Real64 FullLoadOutAirTemp; // evaporator outlet air temperature at full load [C] - Real64 hTinwADP; // enthaly of air at secondary coil entering temperature and Humidity ratio at ADP + Real64 hTinwADP; // enthalpy of air at secondary coil entering temperature and Humidity ratio at ADP Real64 SHRadp; // Sensible heat ratio - Real64 hADP; // enthaly of air at secondary coil at ADP + Real64 hADP; // enthalpy of air at secondary coil at ADP Real64 tADP; // dry bulb temperature of air at secondary coil at ADP Real64 wADP; // humidity ratio of air at secondary coil at ADP Real64 HumRatError; // humidity ratio error - bool CoilMightBeDry; // TRUE means the secondary DX coi runs dry + bool CoilMightBeDry; // TRUE means the secondary DX coil runs dry int Counter; // iteration counter bool Converged; // convergence flag Real64 SHR; // current time step sensible heat ratio of secondary coil @@ -16644,7 +16582,7 @@ void CalcVRFCoolingCoil_FluidTCtrl(EnergyPlusData &state, thisDXCoil.PrintLowAmbMessage = false; thisDXCoil.PrintLowOutTempMessage = false; - if ((AirMassFlow > 0.0) && (GetCurrentScheduleValue(state, thisDXCoil.SchedPtr) > 0.0) && (PartLoadRatio > 0.0) && + if ((AirMassFlow > 0.0) && (thisDXCoil.availSched->getCurrentVal() > 0.0) && (PartLoadRatio > 0.0) && (compressorOp == HVAC::CompressorOp::On)) { // for cycling fan, reset mass flow to full on rate if (thisDXCoil.RatedTotCap(Mode) <= 0.0) { @@ -16988,8 +16926,8 @@ void CalcVRFHeatingCoil_FluidTCtrl(EnergyPlusData &state, CrankcaseHeatingPower = 0.0; } - if ((AirMassFlow > 0.0) && (compressorOp == HVAC::CompressorOp::On) && (GetCurrentScheduleValue(state, thisDXCoil.SchedPtr) > 0.0) && - (PartLoadRatio > 0.0) && (OutdoorDryBulb > thisDXCoil.MinOATCompressor)) { + if ((AirMassFlow > 0.0) && (compressorOp == HVAC::CompressorOp::On) && (thisDXCoil.availSched->getCurrentVal() > 0.0) && (PartLoadRatio > 0.0) && + (OutdoorDryBulb > thisDXCoil.MinOATCompressor)) { TotCap = thisDXCoil.RatedTotCap(Mode); HeatingCapacityMultiplier = 1.0; diff --git a/src/EnergyPlus/DXCoils.hh b/src/EnergyPlus/DXCoils.hh index e79a70ca309..ea35193b925 100644 --- a/src/EnergyPlus/DXCoils.hh +++ b/src/EnergyPlus/DXCoils.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -110,11 +110,10 @@ namespace DXCoils { // Members // Some variables in this type are arrays (dimension=MaxModes) to support coil type // COIL:DX:MultiMode:CoolingEmpirical. Other coil types only use the first element. - std::string Name; // Name of the DX Coil - std::string DXCoilType; // type of coil - int DXCoilType_Num; // Integer equivalent to DXCoilType - std::string Schedule; // WaterCoil Operation Schedule - int SchedPtr; // Pointer to the correct schedule + std::string Name; // Name of the DX Coil + std::string DXCoilType; // type of coil + int DXCoilType_Num; // Integer equivalent to DXCoilType + Sched::Schedule *availSched = nullptr; // availability schedule // RatedCoolCap, RatedSHR and RatedCOP do not include the thermal or electrical // effects due to the supply air fan Array1D RatedTotCap; // Gross total cooling capacity at rated conditions [watts] @@ -162,16 +161,16 @@ namespace DXCoils { int CompanionUpstreamDXCoil; // index number of the DX coil that is "upstream" of this DX coil. Currently used for // UnitarySystem:HeatPump:AirToAir for proper calculation of crankcase heater energy // consumption - bool FindCompanionUpStreamCoil; // Flag to get the companion coil in Init. - Array1D_int CondenserInletNodeNum; // Node number of outdoor condenser(s) (actually an evaporator for heating coils) - int LowOutletTempIndex; // used for low outlet temperature warnings - Real64 FullLoadOutAirTempLast; // used for low outlet temperature warnings - Real64 FullLoadInletAirTempLast; // used for low outlet temperature warnings - bool PrintLowOutTempMessage; // used to print warning message for low outlet air dry-bulb conditions - std::string LowOutTempBuffer1; // holds warning message until next iteration (only prints 1 message/iteration) - std::string LowOutTempBuffer2; // holds warning message until next iteration (only prints 1 message/iteration) - int HeatingCoilPLFCurvePTR; // PLF curve index to gas or electric heating coil (used in latent degradation model) - int BasinHeaterSchedulePtr; // Pointer to basin heater schedule + bool FindCompanionUpStreamCoil; // Flag to get the companion coil in Init. + Array1D_int CondenserInletNodeNum; // Node number of outdoor condenser(s) (actually an evaporator for heating coils) + int LowOutletTempIndex; // used for low outlet temperature warnings + Real64 FullLoadOutAirTempLast; // used for low outlet temperature warnings + Real64 FullLoadInletAirTempLast; // used for low outlet temperature warnings + bool PrintLowOutTempMessage; // used to print warning message for low outlet air dry-bulb conditions + std::string LowOutTempBuffer1; // holds warning message until next iteration (only prints 1 message/iteration) + std::string LowOutTempBuffer2; // holds warning message until next iteration (only prints 1 message/iteration) + int HeatingCoilPLFCurvePTR; // PLF curve index to gas or electric heating coil (used in latent degradation model) + Sched::Schedule *basinHeaterSched = nullptr; // Pointer to basin heater schedule // start of multi-speed compressor variables Real64 RatedTotCap2; // Gross total cooling capacity at rated conditions, low speed [watts] // Note: For HPWHs, RatedTotCap2 = Water Heating Capacity for Coil:DX:HPWH and @@ -455,7 +454,7 @@ namespace DXCoils { // Default Constructor DXCoilData() - : DXCoilType_Num(0), SchedPtr(0), RatedTotCap(MaxModes, 0.0), HeatSizeRatio(1.0), RatedTotCapEMSOverrideOn(MaxModes, false), + : DXCoilType_Num(0), RatedTotCap(MaxModes, 0.0), HeatSizeRatio(1.0), RatedTotCapEMSOverrideOn(MaxModes, false), RatedTotCapEMSOverrideValue(MaxModes, 0.0), RatedSHR(MaxModes, 0.0), RatedSHREMSOverrideOn(MaxModes, false), RatedSHREMSOverrideValue(MaxModes, 0.0), RatedCOP(MaxModes, 0.0), RatedAirVolFlowRate(MaxModes, 0.0), RatedAirVolFlowRateEMSOverrideON(MaxModes, false), RatedAirVolFlowRateEMSOverrideValue(MaxModes, 0.0), @@ -466,44 +465,44 @@ namespace DXCoils { CrankcaseHeaterPower(0.0), MaxOATCrankcaseHeater(0.0), CrankcaseHeaterCapacityCurveIndex(0), CrankcaseHeaterConsumption(0.0), BasinHeaterPowerFTempDiff(0.0), BasinHeaterSetPointTemp(0.0), CompanionUpstreamDXCoil(0), FindCompanionUpStreamCoil(true), CondenserInletNodeNum(MaxModes, 0), LowOutletTempIndex(0), FullLoadOutAirTempLast(0.0), FullLoadInletAirTempLast(0.0), - PrintLowOutTempMessage(false), HeatingCoilPLFCurvePTR(0), BasinHeaterSchedulePtr(0), RatedTotCap2(0.0), RatedSHR2(0.0), RatedCOP2(0.0), - RatedAirVolFlowRate2(0.0), FanPowerPerEvapAirFlowRate_LowSpeed(MaxModes, 0.0), FanPowerPerEvapAirFlowRate_2023_LowSpeed(MaxModes, 0.0), - RatedAirMassFlowRate2(0.0), RatedCBF2(0.0), CCapFTemp2(0), EIRFTemp2(0), RatedEIR2(0.0), InternalStaticPressureDrop(0.0), - RateWithInternalStaticAndFanObject(false), SupplyFanIndex(0), supplyFanType(HVAC::FanType::Invalid), RatedEIR(MaxModes, 0.0), - InletAirMassFlowRate(0.0), InletAirMassFlowRateMax(0.0), InletAirTemp(0.0), InletAirHumRat(0.0), InletAirEnthalpy(0.0), - OutletAirTemp(0.0), OutletAirHumRat(0.0), OutletAirEnthalpy(0.0), PartLoadRatio(0.0), TotalCoolingEnergy(0.0), SensCoolingEnergy(0.0), - LatCoolingEnergy(0.0), TotalCoolingEnergyRate(0.0), SensCoolingEnergyRate(0.0), LatCoolingEnergyRate(0.0), ElecCoolingConsumption(0.0), - ElecCoolingPower(0.0), CoolingCoilRuntimeFraction(0.0), TotalHeatingEnergy(0.0), TotalHeatingEnergyRate(0.0), - ElecHeatingConsumption(0.0), ElecHeatingPower(0.0), HeatingCoilRuntimeFraction(0.0), - DefrostStrategy(StandardRatings::DefrostStrat::Invalid), DefrostControl(StandardRatings::HPdefrostControl::Invalid), EIRFPLR(0), - DefrostEIRFT(0), RegionNum(0), MinOATCompressor(0.0), OATempCompressorOn(0.0), MaxOATCompressor(0.0), MaxOATDefrost(0.0), - DefrostTime(0.0), DefrostCapacity(0.0), HPCompressorRuntime(0.0), HPCompressorRuntimeLast(0.0), TimeLeftToDefrost(0.0), - DefrostPower(0.0), DefrostConsumption(0.0), HeatingPerformanceOATType(HVAC::OATType::DryBulb), HPCoilIsInCoilSystemHeatingDX(false), - OATempCompressorOnOffBlank(false), Twet_Rated(MaxModes, 0.0), Gamma_Rated(MaxModes, 0.0), MaxONOFFCyclesperHour(MaxModes, 0.0), - LatentCapacityTimeConstant(MaxModes, 0.0), CondenserType(MaxModes, DataHeatBalance::RefrigCondenserType::Air), - ReportEvapCondVars(false), EvapCondEffect(MaxModes, 0.0), CondInletTemp(0.0), EvapCondAirFlow(MaxModes, 0.0), - EvapCondPumpElecNomPower(MaxModes, 0.0), EvapCondPumpElecPower(0.0), EvapCondPumpElecConsumption(0.0), EvapWaterConsumpRate(0.0), - EvapWaterConsump(0.0), EvapCondAirFlow2(0.0), EvapCondEffect2(0.0), EvapCondPumpElecNomPower2(0.0), BasinHeaterPower(0.0), - BasinHeaterConsumption(0.0), NumCapacityStages(1), NumDehumidModes(0), CoilPerformanceType(MaxModes), - CoilPerformanceType_Num(MaxModes, 0), CoilPerformanceName(MaxModes), CoolingCoilStg2RuntimeFrac(0.0), WaterInNode(0), WaterOutNode(0), - HCOPFTemp(0), HCOPFTempErrorIndex(0), HCOPFAirFlow(0), HCOPFAirFlowErrorIndex(0), HCOPFWaterFlow(0), HCOPFWaterFlowErrorIndex(0), - HCapFTemp(0), HCapFTempErrorIndex(0), HCapFAirFlow(0), HCapFAirFlowErrorIndex(0), HCapFWaterFlow(0), HCapFWaterFlowErrorIndex(0), - RatedInletDBTemp(0.0), RatedInletWBTemp(0.0), RatedInletWaterTemp(0.0), HPWHCondPumpElecNomPower(0.0), HPWHCondPumpFracToWater(0.0), - RatedHPWHCondWaterFlow(0.0), ElecWaterHeatingPower(0.0), ElecWaterHeatingConsumption(0.0), FanPowerIncludedInCOP(true), - CondPumpHeatInCapacity(false), CondPumpPowerInCOP(false), LowTempLast(0.0), HighTempLast(0.0), ErrIndex1(0), ErrIndex2(0), ErrIndex3(0), - ErrIndex4(0), LowAmbErrIndex(0), HighAmbErrIndex(0), PLFErrIndex(0), PLRErrIndex(0), PrintLowAmbMessage(false), - PrintHighAmbMessage(false), EvapWaterSupplyMode(EvapWaterSupply::FromMains), EvapWaterSupTankID(0), EvapWaterTankDemandARRID(0), - CondensateCollectMode(CondensateCollectAction::Discard), CondensateTankID(0), CondensateTankSupplyARRID(0), CondensateVdot(0.0), - CondensateVol(0.0), CurrentEndTimeLast(0.0), TimeStepSysLast(0.0), FuelType(Constant::eFuel::Invalid), NumOfSpeeds(0), PLRImpact(false), - LatentImpact(false), MSFuelWasteHeat(0.0), MSHPHeatRecActive(false), MSHPDesignSpecIndex(0), CoolingCoilPresent(true), - HeatingCoilPresent(true), ISHundredPercentDOASDXCoil(false), SHRFTemp(MaxModes, 0), SHRFTempErrorIndex(0), SHRFFlow(MaxModes, 0), - SHRFFlowErrorIndex(0), SHRFTemp2(0), SHRFFlow2(0), UserSHRCurveExists(false), ASHRAE127StdRprt(false), SecZonePtr(0), SecCoilSHRFT(0), - SecCoilSHRFF(0), SecCoilAirFlow(0.0), SecCoilAirFlowScalingFactor(1.0), SecCoilRatedSHR(1.0), SecCoilSHR(1.0), EvapInletWetBulb(0.0), - SecCoilSensibleHeatGainRate(0.0), SecCoilTotalHeatRemovalRate(0.0), SecCoilSensibleHeatRemovalRate(0.0), - SecCoilLatentHeatRemovalRate(0.0), IsSecondaryDXCoilInZone(false), IsDXCoilInZone(false), CompressorPartLoadRatio(0.0), MSSpeedNumLS(1), - MSSpeedNumHS(2), MSSpeedRatio(0.0), MSCycRatio(0.0), VRFIUPtr(0), VRFOUPtr(0), EvaporatingTemp(4.0), CondensingTemp(40.0), C1Te(0.0), - C2Te(0.0), C3Te(0.0), C1Tc(0.0), C2Tc(0.0), C3Tc(0.0), SH(0.0), SC(0.0), ActualSH(0.0), ActualSC(0.0), RateBFVRFIUEvap(0.0592), - RateBFVRFIUCond(0.1360), CAPFTErrIndex(0), EIRFTErrIndex(0), reportCoilFinalSizes(true), capModFacTotal(0.0), AirLoopNum(0) + PrintLowOutTempMessage(false), HeatingCoilPLFCurvePTR(0), RatedTotCap2(0.0), RatedSHR2(0.0), RatedCOP2(0.0), RatedAirVolFlowRate2(0.0), + FanPowerPerEvapAirFlowRate_LowSpeed(MaxModes, 0.0), FanPowerPerEvapAirFlowRate_2023_LowSpeed(MaxModes, 0.0), RatedAirMassFlowRate2(0.0), + RatedCBF2(0.0), CCapFTemp2(0), EIRFTemp2(0), RatedEIR2(0.0), InternalStaticPressureDrop(0.0), RateWithInternalStaticAndFanObject(false), + SupplyFanIndex(0), supplyFanType(HVAC::FanType::Invalid), RatedEIR(MaxModes, 0.0), InletAirMassFlowRate(0.0), + InletAirMassFlowRateMax(0.0), InletAirTemp(0.0), InletAirHumRat(0.0), InletAirEnthalpy(0.0), OutletAirTemp(0.0), OutletAirHumRat(0.0), + OutletAirEnthalpy(0.0), PartLoadRatio(0.0), TotalCoolingEnergy(0.0), SensCoolingEnergy(0.0), LatCoolingEnergy(0.0), + TotalCoolingEnergyRate(0.0), SensCoolingEnergyRate(0.0), LatCoolingEnergyRate(0.0), ElecCoolingConsumption(0.0), ElecCoolingPower(0.0), + CoolingCoilRuntimeFraction(0.0), TotalHeatingEnergy(0.0), TotalHeatingEnergyRate(0.0), ElecHeatingConsumption(0.0), + ElecHeatingPower(0.0), HeatingCoilRuntimeFraction(0.0), DefrostStrategy(StandardRatings::DefrostStrat::Invalid), + DefrostControl(StandardRatings::HPdefrostControl::Invalid), EIRFPLR(0), DefrostEIRFT(0), RegionNum(0), MinOATCompressor(0.0), + OATempCompressorOn(0.0), MaxOATCompressor(0.0), MaxOATDefrost(0.0), DefrostTime(0.0), DefrostCapacity(0.0), HPCompressorRuntime(0.0), + HPCompressorRuntimeLast(0.0), TimeLeftToDefrost(0.0), DefrostPower(0.0), DefrostConsumption(0.0), + HeatingPerformanceOATType(HVAC::OATType::DryBulb), HPCoilIsInCoilSystemHeatingDX(false), OATempCompressorOnOffBlank(false), + Twet_Rated(MaxModes, 0.0), Gamma_Rated(MaxModes, 0.0), MaxONOFFCyclesperHour(MaxModes, 0.0), LatentCapacityTimeConstant(MaxModes, 0.0), + CondenserType(MaxModes, DataHeatBalance::RefrigCondenserType::Air), ReportEvapCondVars(false), EvapCondEffect(MaxModes, 0.0), + CondInletTemp(0.0), EvapCondAirFlow(MaxModes, 0.0), EvapCondPumpElecNomPower(MaxModes, 0.0), EvapCondPumpElecPower(0.0), + EvapCondPumpElecConsumption(0.0), EvapWaterConsumpRate(0.0), EvapWaterConsump(0.0), EvapCondAirFlow2(0.0), EvapCondEffect2(0.0), + EvapCondPumpElecNomPower2(0.0), BasinHeaterPower(0.0), BasinHeaterConsumption(0.0), NumCapacityStages(1), NumDehumidModes(0), + CoilPerformanceType(MaxModes), CoilPerformanceType_Num(MaxModes, 0), CoilPerformanceName(MaxModes), CoolingCoilStg2RuntimeFrac(0.0), + WaterInNode(0), WaterOutNode(0), HCOPFTemp(0), HCOPFTempErrorIndex(0), HCOPFAirFlow(0), HCOPFAirFlowErrorIndex(0), HCOPFWaterFlow(0), + HCOPFWaterFlowErrorIndex(0), HCapFTemp(0), HCapFTempErrorIndex(0), HCapFAirFlow(0), HCapFAirFlowErrorIndex(0), HCapFWaterFlow(0), + HCapFWaterFlowErrorIndex(0), RatedInletDBTemp(0.0), RatedInletWBTemp(0.0), RatedInletWaterTemp(0.0), HPWHCondPumpElecNomPower(0.0), + HPWHCondPumpFracToWater(0.0), RatedHPWHCondWaterFlow(0.0), ElecWaterHeatingPower(0.0), ElecWaterHeatingConsumption(0.0), + FanPowerIncludedInCOP(true), CondPumpHeatInCapacity(false), CondPumpPowerInCOP(false), LowTempLast(0.0), HighTempLast(0.0), + ErrIndex1(0), ErrIndex2(0), ErrIndex3(0), ErrIndex4(0), LowAmbErrIndex(0), HighAmbErrIndex(0), PLFErrIndex(0), PLRErrIndex(0), + PrintLowAmbMessage(false), PrintHighAmbMessage(false), EvapWaterSupplyMode(EvapWaterSupply::FromMains), EvapWaterSupTankID(0), + EvapWaterTankDemandARRID(0), CondensateCollectMode(CondensateCollectAction::Discard), CondensateTankID(0), CondensateTankSupplyARRID(0), + CondensateVdot(0.0), CondensateVol(0.0), CurrentEndTimeLast(0.0), TimeStepSysLast(0.0), FuelType(Constant::eFuel::Invalid), + NumOfSpeeds(0), PLRImpact(false), LatentImpact(false), MSFuelWasteHeat(0.0), MSHPHeatRecActive(false), MSHPDesignSpecIndex(0), + CoolingCoilPresent(true), HeatingCoilPresent(true), ISHundredPercentDOASDXCoil(false), SHRFTemp(MaxModes, 0), SHRFTempErrorIndex(0), + SHRFFlow(MaxModes, 0), SHRFFlowErrorIndex(0), SHRFTemp2(0), SHRFFlow2(0), UserSHRCurveExists(false), ASHRAE127StdRprt(false), + SecZonePtr(0), SecCoilSHRFT(0), SecCoilSHRFF(0), SecCoilAirFlow(0.0), SecCoilAirFlowScalingFactor(1.0), SecCoilRatedSHR(1.0), + SecCoilSHR(1.0), EvapInletWetBulb(0.0), SecCoilSensibleHeatGainRate(0.0), SecCoilTotalHeatRemovalRate(0.0), + SecCoilSensibleHeatRemovalRate(0.0), SecCoilLatentHeatRemovalRate(0.0), IsSecondaryDXCoilInZone(false), IsDXCoilInZone(false), + CompressorPartLoadRatio(0.0), MSSpeedNumLS(1), MSSpeedNumHS(2), MSSpeedRatio(0.0), MSCycRatio(0.0), VRFIUPtr(0), VRFOUPtr(0), + EvaporatingTemp(4.0), CondensingTemp(40.0), C1Te(0.0), C2Te(0.0), C3Te(0.0), C1Tc(0.0), C2Tc(0.0), C3Tc(0.0), SH(0.0), SC(0.0), + ActualSH(0.0), ActualSC(0.0), RateBFVRFIUEvap(0.0592), RateBFVRFIUCond(0.1360), CAPFTErrIndex(0), EIRFTErrIndex(0), + reportCoilFinalSizes(true), capModFacTotal(0.0), AirLoopNum(0) { } }; @@ -785,11 +784,11 @@ namespace DXCoils { bool &ErrorsFound // set to true if problem ); - int GetDXCoilAvailSchPtr(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound, // set to true if problem - ObjexxFCL::Optional_int_const CoilIndex = _ // Coil index number + Sched::Schedule *GetDXCoilAvailSched(EnergyPlusData &state, + std::string const &CoilType, // must match coil types in this module + std::string const &CoilName, // must match coil names for the coil type + bool &ErrorsFound, // set to true if problem + ObjexxFCL::Optional_int_const CoilIndex = _ // Coil index number ); Real64 GetDXCoilAirFlow(EnergyPlusData &state, @@ -992,6 +991,10 @@ struct DXCoilsData : BaseGlobalStruct Real64 EIRFlowModFac = 0.0; // EIR modifier (function of actual supply air flow vs rated flow) [-] Real64 TempDryBulb_Leaving_Apoint = 0.0; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DXFEarClipping.cc b/src/EnergyPlus/DXFEarClipping.cc index 29722ed3e75..c7bad862910 100644 --- a/src/EnergyPlus/DXFEarClipping.cc +++ b/src/EnergyPlus/DXFEarClipping.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/DXFEarClipping.hh b/src/EnergyPlus/DXFEarClipping.hh index 5597301b792..202a526ef64 100644 --- a/src/EnergyPlus/DXFEarClipping.hh +++ b/src/EnergyPlus/DXFEarClipping.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -143,6 +143,10 @@ struct DXFEarClippingData : BaseGlobalStruct bool trackit = false; int errcount = 0; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/Data/BaseData.hh b/src/EnergyPlus/Data/BaseData.hh index 17d248e66d0..b03d56d9212 100644 --- a/src/EnergyPlus/Data/BaseData.hh +++ b/src/EnergyPlus/Data/BaseData.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -54,6 +54,9 @@ struct EnergyPlusData; // Forward declaration struct BaseGlobalStruct { + + virtual ~BaseGlobalStruct() = default; + virtual void init_constant_state([[maybe_unused]] EnergyPlusData &state) = 0; virtual void init_state([[maybe_unused]] EnergyPlusData &state) = 0; virtual void clear_state() = 0; }; diff --git a/src/EnergyPlus/Data/CommonIncludes.hh b/src/EnergyPlus/Data/CommonIncludes.hh index a7ba5bc5042..e2872a018d7 100644 --- a/src/EnergyPlus/Data/CommonIncludes.hh +++ b/src/EnergyPlus/Data/CommonIncludes.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -159,7 +159,6 @@ #include #include #include -#include #include #include #include diff --git a/src/EnergyPlus/Data/EnergyPlusData.cc b/src/EnergyPlus/Data/EnergyPlusData.cc index b09d3575914..fd59c7fe39e 100644 --- a/src/EnergyPlus/Data/EnergyPlusData.cc +++ b/src/EnergyPlus/Data/EnergyPlusData.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -78,7 +78,7 @@ EnergyPlusData::EnergyPlusData() this->dataChillerIndirectAbsorption = std::make_unique(); this->dataChillerReformulatedEIR = std::make_unique(); this->dataChillerElectricASHRAE205 = std::make_unique(); - this->dataCoilCooingDX = std::make_unique(); + this->dataCoilCoolingDX = std::make_unique(); this->dataCondenserLoopTowers = std::make_unique(); this->dataConstruction = std::make_unique(); this->dataContaminantBalance = std::make_unique(); @@ -117,7 +117,7 @@ EnergyPlusData::EnergyPlusData() this->dataFans = std::make_unique(); this->dataFaultsMgr = std::make_unique(); this->dataFluidCoolers = std::make_unique(); - this->dataFluidProps = std::make_unique(); + this->dataFluid = std::make_unique(); this->dataFourPipeBeam = std::make_unique(); this->dataFuelCellElectGen = std::make_unique(); this->dataFurnaces = std::make_unique(); @@ -233,7 +233,7 @@ EnergyPlusData::EnergyPlusData() this->dataRuntimeLang = std::make_unique(); this->dataRuntimeLangProcessor = std::make_unique(); this->dataSQLiteProcedures = std::make_unique(); - this->dataScheduleMgr = std::make_unique(); + this->dataSched = std::make_unique(); this->dataSetPointManager = std::make_unique(); this->dataShadowComb = std::make_unique(); this->dataSimAirServingZones = std::make_unique(); @@ -334,7 +334,7 @@ void EnergyPlusData::clear_state() this->dataChillerIndirectAbsorption->clear_state(); this->dataChillerReformulatedEIR->clear_state(); this->dataChillerElectricASHRAE205->clear_state(); - this->dataCoilCooingDX->clear_state(); + this->dataCoilCoolingDX->clear_state(); this->dataCondenserLoopTowers->clear_state(); this->dataConstruction->clear_state(); this->dataContaminantBalance->clear_state(); @@ -373,7 +373,7 @@ void EnergyPlusData::clear_state() this->dataFans->clear_state(); this->dataFaultsMgr->clear_state(); this->dataFluidCoolers->clear_state(); - this->dataFluidProps->clear_state(); + this->dataFluid->clear_state(); this->dataFourPipeBeam->clear_state(); this->dataFuelCellElectGen->clear_state(); this->dataFurnaces->clear_state(); @@ -489,7 +489,7 @@ void EnergyPlusData::clear_state() this->dataRuntimeLang->clear_state(); this->dataRuntimeLangProcessor->clear_state(); this->dataSQLiteProcedures->clear_state(); - this->dataScheduleMgr->clear_state(); + this->dataSched->clear_state(); this->dataSetPointManager->clear_state(); this->dataShadowComb->clear_state(); this->dataSimAirServingZones->clear_state(); @@ -570,17 +570,283 @@ void EnergyPlusData::clear_state() this->files.spsz.close(); } +void EnergyPlusData::init_constant_state(EnergyPlusData &state) +{ + if (this->init_constant_state_called) { + return; + } + + this->init_constant_state_called = true; + + // The order of these should not matter, but we are mirroring init_state() order which does matter. + this->dataSimulationManager->init_constant_state(state); + this->dataEMSMgr->init_constant_state(state); + this->dataPsychrometrics->init_constant_state(state); + this->dataFluid->init_constant_state(state); + this->dataSched->init_constant_state(state); + + this->dataAirLoop->init_constant_state(state); + this->dataAirLoopHVACDOAS->init_constant_state(state); + this->dataAirSystemsData->init_constant_state(state); + this->afn->init_constant_state(state); + this->dataBSDFWindow->init_constant_state(state); + this->dataBaseSizerFanHeatInputs->init_constant_state(state); + this->dataBaseSizerScalableInputs->init_constant_state(state); + this->dataBaseboardElectric->init_constant_state(state); + this->dataBaseboardRadiator->init_constant_state(state); + this->dataBoilerSteam->init_constant_state(state); + this->dataBoilers->init_constant_state(state); + this->dataBranchAirLoopPlant->init_constant_state(state); + this->dataBranchInputManager->init_constant_state(state); + this->dataBranchNodeConnections->init_constant_state(state); + this->dataCHPElectGen->init_constant_state(state); + this->dataCTElectricGenerator->init_constant_state(state); + this->dataChilledCeilingPanelSimple->init_constant_state(state); + this->dataChillerAbsorber->init_constant_state(state); + this->dataChillerElectricEIR->init_constant_state(state); + this->dataChillerExhaustAbsorption->init_constant_state(state); + this->dataChillerGasAbsorption->init_constant_state(state); + this->dataChillerIndirectAbsorption->init_constant_state(state); + this->dataChillerReformulatedEIR->init_constant_state(state); + this->dataChillerElectricASHRAE205->init_constant_state(state); + this->dataCoilCoolingDX->init_constant_state(state); + this->dataCondenserLoopTowers->init_constant_state(state); + this->dataConstruction->init_constant_state(state); + this->dataContaminantBalance->init_constant_state(state); + this->dataConvect->init_constant_state(state); + this->dataConvergeParams->init_constant_state(state); + this->dataCoolTower->init_constant_state(state); + this->dataCostEstimateManager->init_constant_state(state); + this->dataCrossVentMgr->init_constant_state(state); + this->dataCurveManager->init_constant_state(state); + this->dataDXCoils->init_constant_state(state); + this->dataDXFEarClipping->init_constant_state(state); + this->dataDaylightingDevices->init_constant_state(state); + this->dataDaylightingDevicesData->init_constant_state(state); + this->dataDayltg->init_constant_state(state); + this->dataDefineEquipment->init_constant_state(state); + this->dataDemandManager->init_constant_state(state); + this->dataDesiccantDehumidifiers->init_constant_state(state); + this->dataDispVentMgr->init_constant_state(state); + this->dataDualDuct->init_constant_state(state); + this->dataEIRFuelFiredHeatPump->init_constant_state(state); + this->dataEIRPlantLoopHeatPump->init_constant_state(state); + this->dataEarthTube->init_constant_state(state); + this->dataEcoRoofMgr->init_constant_state(state); + this->dataEconLifeCycleCost->init_constant_state(state); + this->dataEconTariff->init_constant_state(state); + this->dataElectBaseboardRad->init_constant_state(state); + this->dataElectPwrSvcMgr->init_constant_state(state); + this->dataEnvrn->init_constant_state(state); + this->dataErrTracking->init_constant_state(state); + this->dataEvapCoolers->init_constant_state(state); + this->dataEvapFluidCoolers->init_constant_state(state); + this->dataExteriorEnergyUse->init_constant_state(state); + this->dataExternalInterface->init_constant_state(state); + this->dataFanCoilUnits->init_constant_state(state); + this->dataFans->init_constant_state(state); + this->dataFaultsMgr->init_constant_state(state); + this->dataFluidCoolers->init_constant_state(state); + this->dataFourPipeBeam->init_constant_state(state); + this->dataFuelCellElectGen->init_constant_state(state); + this->dataFurnaces->init_constant_state(state); + this->dataGeneral->init_constant_state(state); + this->dataGeneralRoutines->init_constant_state(state); + this->dataGenerator->init_constant_state(state); + this->dataGeneratorFuelSupply->init_constant_state(state); + this->dataGlobal->init_constant_state(state); + this->dataGlobalNames->init_constant_state(state); + this->dataGrndTempModelMgr->init_constant_state(state); + this->dataGroundHeatExchanger->init_constant_state(state); + this->dataHPWaterToWaterClg->init_constant_state(state); + this->dataHPWaterToWaterHtg->init_constant_state(state); + this->dataHPWaterToWaterSimple->init_constant_state(state); + this->dataHVACAssistedCC->init_constant_state(state); + this->dataHVACControllers->init_constant_state(state); + this->dataHVACCooledBeam->init_constant_state(state); + this->dataHVACCtrl->init_constant_state(state); + this->dataHVACDXHeatPumpSys->init_constant_state(state); + this->dataHVACDuct->init_constant_state(state); + this->dataHVACGlobal->init_constant_state(state); + this->dataHVACInterfaceMgr->init_constant_state(state); + this->dataHVACMgr->init_constant_state(state); + this->dataHVACMultiSpdHP->init_constant_state(state); + this->dataHVACSingleDuctInduc->init_constant_state(state); + this->dataHVACSizingSimMgr->init_constant_state(state); + this->dataHVACStandAloneERV->init_constant_state(state); + this->dataHVACUnitaryBypassVAV->init_constant_state(state); + this->dataHVACVarRefFlow->init_constant_state(state); + this->dataHWBaseboardRad->init_constant_state(state); + this->dataHeatBal->init_constant_state(state); + this->dataHeatBalAirMgr->init_constant_state(state); + this->dataHeatBalFanSys->init_constant_state(state); + this->dataHeatBalFiniteDiffMgr->init_constant_state(state); + this->dataHeatBalHAMTMgr->init_constant_state(state); + this->dataHeatBalIntHeatGains->init_constant_state(state); + this->dataHeatBalIntRadExchg->init_constant_state(state); + this->dataHeatBalMgr->init_constant_state(state); + this->dataHeatBalSurf->init_constant_state(state); + this->dataHeatBalSurfMgr->init_constant_state(state); + this->dataHeatRecovery->init_constant_state(state); + this->dataHeatingCoils->init_constant_state(state); + this->dataHighTempRadSys->init_constant_state(state); + this->dataHumidifiers->init_constant_state(state); + this->dataHybridModel->init_constant_state(state); + this->dataHybridUnitaryAC->init_constant_state(state); + this->dataHysteresisPhaseChange->init_constant_state(state); + this->dataICEngElectGen->init_constant_state(state); + this->dataIPShortCut->init_constant_state(state); + this->dataIceThermalStorage->init_constant_state(state); + this->dataIndoorGreen->init_constant_state(state); + this->dataInputProcessing->init_constant_state(state); + this->dataIntegratedHP->init_constant_state(state); + this->dataInternalHeatGains->init_constant_state(state); + this->dataLoopNodes->init_constant_state(state); + this->dataLowTempRadSys->init_constant_state(state); + this->dataMaterial->init_constant_state(state); + this->dataMatrixDataManager->init_constant_state(state); + this->dataMircoturbElectGen->init_constant_state(state); + this->dataMixedAir->init_constant_state(state); + this->dataMixerComponent->init_constant_state(state); + this->dataMoistureBalEMPD->init_constant_state(state); + this->dataMstBal->init_constant_state(state); + this->dataMstBalEMPD->init_constant_state(state); + this->dataMundtSimMgr->init_constant_state(state); + this->dataNodeInputMgr->init_constant_state(state); + this->dataOutAirNodeMgr->init_constant_state(state); + this->dataOutRptPredefined->init_constant_state(state); + this->dataOutRptTab->init_constant_state(state); + this->dataOutdoorAirUnit->init_constant_state(state); + this->dataOutput->init_constant_state(state); + this->dataOutputProcessor->init_constant_state(state); + this->dataOutputReportTabularAnnual->init_constant_state(state); + this->dataOutputReports->init_constant_state(state); + this->dataOutsideEnergySrcs->init_constant_state(state); + this->dataPackagedThermalStorageCoil->init_constant_state(state); + this->dataPhotovoltaic->init_constant_state(state); + this->dataPhotovoltaicState->init_constant_state(state); + this->dataPhotovoltaicThermalCollector->init_constant_state(state); + this->dataPipeHT->init_constant_state(state); + this->dataPipes->init_constant_state(state); + this->dataPlantCentralGSHP->init_constant_state(state); + this->dataPlantChillers->init_constant_state(state); + this->dataPlantCompTempSrc->init_constant_state(state); + this->dataPlantCondLoopOp->init_constant_state(state); + this->dataPlantHXFluidToFluid->init_constant_state(state); + this->dataPlantLoadProfile->init_constant_state(state); + this->dataPlantMgr->init_constant_state(state); + this->dataPlantPipingSysMgr->init_constant_state(state); + this->dataPlantPressureSys->init_constant_state(state); + this->dataPlantUtilities->init_constant_state(state); + this->dataPlantValves->init_constant_state(state); + this->dataPlnt->init_constant_state(state); + this->dataPluginManager->init_constant_state(state); + this->dataPollution->init_constant_state(state); + this->dataPondGHE->init_constant_state(state); + this->dataPowerInductionUnits->init_constant_state(state); + this->dataPsychCache->init_constant_state(state); + this->dataPumps->init_constant_state(state); + this->dataPurchasedAirMgr->init_constant_state(state); + this->dataRefrigCase->init_constant_state(state); + this->dataReportFlag->init_constant_state(state); + this->dataResultsFramework->init_constant_state(state); + this->dataRetAirPathMrg->init_constant_state(state); + this->dataExhAirSystemMrg->init_constant_state(state); + this->dataExhCtrlSystemMrg->init_constant_state(state); + this->dataRoomAir->init_constant_state(state); + this->dataRoomAirModelTempPattern->init_constant_state(state); + this->dataRoomAirflowNetModel->init_constant_state(state); + this->dataRootFinder->init_constant_state(state); + this->dataRptCoilSelection->init_constant_state(state); + this->dataRuntimeLang->init_constant_state(state); + this->dataRuntimeLangProcessor->init_constant_state(state); + this->dataSQLiteProcedures->init_constant_state(state); + this->dataSetPointManager->init_constant_state(state); + this->dataShadowComb->init_constant_state(state); + this->dataSimAirServingZones->init_constant_state(state); + this->dataSingleDuct->init_constant_state(state); + this->dataSize->init_constant_state(state); + this->dataSizingManager->init_constant_state(state); + this->dataSolarCollectors->init_constant_state(state); + this->dataSolarReflectionManager->init_constant_state(state); + this->dataSolarShading->init_constant_state(state); + this->dataSplitterComponent->init_constant_state(state); + this->dataSteamBaseboardRadiator->init_constant_state(state); + this->dataSteamCoils->init_constant_state(state); + this->dataStrGlobals->init_constant_state(state); + this->dataSurfColor->init_constant_state(state); + this->dataSurfLists->init_constant_state(state); + this->dataSurface->init_constant_state(state); + this->dataSurfaceGeometry->init_constant_state(state); + this->dataSurfaceGroundHeatExchangers->init_constant_state(state); + this->dataSwimmingPools->init_constant_state(state); + this->dataSysAirFlowSizer->init_constant_state(state); + this->dataSysRpts->init_constant_state(state); + this->dataSysVars->init_constant_state(state); + this->dataAvail->init_constant_state(state); + this->dataTARCOGCommon->init_constant_state(state); + this->dataTARCOGOutputs->init_constant_state(state); + this->dataThermalChimneys->init_constant_state(state); + this->dataThermalComforts->init_constant_state(state); + this->dataThermalISO15099Calc->init_constant_state(state); + this->dataTARCOGGasses90->init_constant_state(state); + this->dataTARCOGMain->init_constant_state(state); + this->dataTarcogShading->init_constant_state(state); + this->dataTimingsData->init_constant_state(state); + this->dataTranspiredCollector->init_constant_state(state); + this->dataUFADManager->init_constant_state(state); + this->dataUnitHeaters->init_constant_state(state); + this->dataUnitVentilators->init_constant_state(state); + this->dataUnitarySystems->init_constant_state(state); + this->dataUserDefinedComponents->init_constant_state(state); + this->dataUtilityRoutines->init_constant_state(state); + this->dataVariableSpeedCoils->init_constant_state(state); + this->dataVectors->init_constant_state(state); + this->dataVentilatedSlab->init_constant_state(state); + this->dataViewFactor->init_constant_state(state); + this->dataWaterCoils->init_constant_state(state); + this->dataWaterData->init_constant_state(state); + this->dataWaterManager->init_constant_state(state); + this->dataWaterThermalTanks->init_constant_state(state); + this->dataWaterToAirHeatPump->init_constant_state(state); + this->dataWaterToAirHeatPumpSimple->init_constant_state(state); + this->dataWaterUse->init_constant_state(state); + this->dataWeather->init_constant_state(state); + this->dataWindTurbine->init_constant_state(state); + this->dataWindowAC->init_constant_state(state); + this->dataWindowComplexManager->init_constant_state(state); + this->dataWindowEquivLayer->init_constant_state(state); + this->dataWindowEquivalentLayer->init_constant_state(state); + this->dataWindowManager->init_constant_state(state); + this->dataWindowManagerExterior->init_constant_state(state); + this->dataZoneAirLoopEquipmentManager->init_constant_state(state); + this->dataZoneContaminantPredictorCorrector->init_constant_state(state); + this->dataZoneCtrls->init_constant_state(state); + this->dataZoneDehumidifier->init_constant_state(state); + this->dataZoneEnergyDemand->init_constant_state(state); + this->dataZoneEquip->init_constant_state(state); + this->dataZoneEquipmentManager->init_constant_state(state); + this->dataZonePlenum->init_constant_state(state); + this->dataZoneTempPredictorCorrector->init_constant_state(state); +} + void EnergyPlusData::init_state(EnergyPlusData &state) { - if (this->init_state_called) return; + if (this->init_state_called) { + return; + } + this->init_state_called = true; + // The order in which we do this matters. We're going to try to // do this in "topological" order meaning the first to go are the // objects that do not reference any other objects, like fluids, // schedules, curves, etc. this->dataSimulationManager->init_state(state); // GetProjectData - this->dataFluidProps->init_state(state); // GetFluidPropertiesData + this->dataEMSMgr->init_state(state); // CheckIfAnyEMS this->dataPsychrometrics->init_state(state); // InitializePsychRoutines + this->dataFluid->init_state(state); // GetFluidPropertiesData + this->dataSched->init_state(state); // GetScheduleData this->dataAirLoop->init_state(state); this->dataAirLoopHVACDOAS->init_state(state); @@ -606,7 +872,7 @@ void EnergyPlusData::init_state(EnergyPlusData &state) this->dataChillerIndirectAbsorption->init_state(state); this->dataChillerReformulatedEIR->init_state(state); this->dataChillerElectricASHRAE205->init_state(state); - this->dataCoilCooingDX->init_state(state); + this->dataCoilCoolingDX->init_state(state); this->dataCondenserLoopTowers->init_state(state); this->dataConstruction->init_state(state); this->dataContaminantBalance->init_state(state); @@ -628,7 +894,6 @@ void EnergyPlusData::init_state(EnergyPlusData &state) this->dataDualDuct->init_state(state); this->dataEIRFuelFiredHeatPump->init_state(state); this->dataEIRPlantLoopHeatPump->init_state(state); - this->dataEMSMgr->init_state(state); this->dataEarthTube->init_state(state); this->dataEcoRoofMgr->init_state(state); this->dataEconLifeCycleCost->init_state(state); @@ -759,7 +1024,6 @@ void EnergyPlusData::init_state(EnergyPlusData &state) this->dataRuntimeLang->init_state(state); this->dataRuntimeLangProcessor->init_state(state); this->dataSQLiteProcedures->init_state(state); - this->dataScheduleMgr->init_state(state); this->dataSetPointManager->init_state(state); this->dataShadowComb->init_state(state); this->dataSimAirServingZones->init_state(state); diff --git a/src/EnergyPlus/Data/EnergyPlusData.hh b/src/EnergyPlus/Data/EnergyPlusData.hh index bfe3499577e..0233da7c845 100644 --- a/src/EnergyPlus/Data/EnergyPlusData.hh +++ b/src/EnergyPlus/Data/EnergyPlusData.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -50,8 +50,6 @@ // C++ Headers #include -#include -#include // EnergyPlus Headers #include @@ -340,7 +338,7 @@ struct EnergyPlusData : BaseGlobalStruct std::unique_ptr dataChillerIndirectAbsorption; std::unique_ptr dataChillerReformulatedEIR; std::unique_ptr dataChillerElectricASHRAE205; - std::unique_ptr dataCoilCooingDX; + std::unique_ptr dataCoilCoolingDX; std::unique_ptr dataCondenserLoopTowers; std::unique_ptr dataConstruction; std::unique_ptr dataContaminantBalance; @@ -390,7 +388,7 @@ struct EnergyPlusData : BaseGlobalStruct std::unique_ptr dataFans; std::unique_ptr dataFaultsMgr; std::unique_ptr dataFluidCoolers; - std::unique_ptr dataFluidProps; + std::unique_ptr dataFluid; std::unique_ptr dataFourPipeBeam; std::unique_ptr dataFuelCellElectGen; std::unique_ptr dataFurnaces; @@ -504,7 +502,7 @@ struct EnergyPlusData : BaseGlobalStruct std::unique_ptr dataRuntimeLang; std::unique_ptr dataRuntimeLangProcessor; std::unique_ptr dataSQLiteProcedures; - std::unique_ptr dataScheduleMgr; + std::unique_ptr dataSched; std::unique_ptr dataSetPointManager; std::unique_ptr dataShadowComb; std::unique_ptr dataSimAirServingZones; @@ -576,8 +574,10 @@ struct EnergyPlusData : BaseGlobalStruct EnergyPlusData(const EnergyPlusData &) = delete; EnergyPlusData(EnergyPlusData &&) = delete; - void init_state([[maybe_unused]] EnergyPlusData &state) override; + void init_constant_state(EnergyPlusData &state) override; + void init_state(EnergyPlusData &state) override; bool init_state_called = false; + bool init_constant_state_called = false; void clear_state() override; }; diff --git a/src/EnergyPlus/DataAirLoop.hh b/src/EnergyPlus/DataAirLoop.hh index 03eea3ca392..67589467ce0 100644 --- a/src/EnergyPlus/DataAirLoop.hh +++ b/src/EnergyPlus/DataAirLoop.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -125,7 +125,7 @@ namespace DataAirLoop { int OASysNum = 0; // index of OA System bool CyclingFan = false; // TRUE if currently the air loop supply fan is cycling bool AnyContFan = false; // TRUE if at any time supply fan is continuous - int CycFanSchedPtr = 0; // index of schedule indicating whether fan is cycling or continuous in a unitary system + Sched::Schedule *cycFanSched = nullptr; // schedule indicating whether fan is cycling or continuous in a unitary system HVAC::FanOp fanOp = HVAC::FanOp::Invalid; // 1=cycling fan cycling compressor; 2=constant fan cycling comptressor bool UnitarySys = false; // TRUE if a unitary system bool UnitarySysSimulating = true; // set FALSE for AirloopUnitarySystem after simulating to downstream coils can size independently @@ -250,6 +250,10 @@ struct DataAirLoopData : BaseGlobalStruct EPVector OutsideAirSys; EPVector AirLoopAFNInfo; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataAirSystems.cc b/src/EnergyPlus/DataAirSystems.cc index fc3bddce511..1036be55ce2 100644 --- a/src/EnergyPlus/DataAirSystems.cc +++ b/src/EnergyPlus/DataAirSystems.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/DataAirSystems.hh b/src/EnergyPlus/DataAirSystems.hh index 984e35c3da2..53d6f9ee7b8 100644 --- a/src/EnergyPlus/DataAirSystems.hh +++ b/src/EnergyPlus/DataAirSystems.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -332,6 +332,10 @@ struct AirSystemsData : BaseGlobalStruct Array1D AirSysSubCompToPlant; // Connections between loops Array1D AirSysSubSubCompToPlant; // Connections between loops + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataBSDFWindow.hh b/src/EnergyPlus/DataBSDFWindow.hh index 044fdea031d..8aef1d8ada1 100644 --- a/src/EnergyPlus/DataBSDFWindow.hh +++ b/src/EnergyPlus/DataBSDFWindow.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -52,6 +52,9 @@ #include #include #include +#include + +using ObjexxFCL::Vector3; // EnergyPlus Headers #include @@ -393,6 +396,10 @@ struct BSDFWindowData : BaseGlobalStruct Array2D BSDFTempMtrx; // Temporary matrix for holding axisymmetric input EPVector ComplexWind; // Window geometry structure: set in CalcPerSolarBeam/SolarShading + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataBranchAirLoopPlant.hh b/src/EnergyPlus/DataBranchAirLoopPlant.hh index f4a533b0497..6b814f52459 100644 --- a/src/EnergyPlus/DataBranchAirLoopPlant.hh +++ b/src/EnergyPlus/DataBranchAirLoopPlant.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -111,6 +111,10 @@ struct DataBranchAirLoopPlantData : BaseGlobalStruct { Array1D PressureCurve; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataBranchNodeConnections.hh b/src/EnergyPlus/DataBranchNodeConnections.hh index eb724939835..df2f2a009a7 100644 --- a/src/EnergyPlus/DataBranchNodeConnections.hh +++ b/src/EnergyPlus/DataBranchNodeConnections.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -130,6 +130,10 @@ struct BranchNodeConnectionsData : BaseGlobalStruct EPVector AirTerminalNodeConnections; Array1D_bool NonConnectedNodes; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataComplexFenestration.hh b/src/EnergyPlus/DataComplexFenestration.hh index 44daa8e5c2e..e613fbdfa0d 100644 --- a/src/EnergyPlus/DataComplexFenestration.hh +++ b/src/EnergyPlus/DataComplexFenestration.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/DataContaminantBalance.hh b/src/EnergyPlus/DataContaminantBalance.hh index 177d4eed26e..10796a364c8 100644 --- a/src/EnergyPlus/DataContaminantBalance.hh +++ b/src/EnergyPlus/DataContaminantBalance.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -55,6 +55,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -66,11 +67,11 @@ namespace DataContaminantBalance { struct ContaminantData { // Members - bool SimulateContaminants = false; // A logical flag to determine whether any contaminants are simulated or not - bool CO2Simulation = false; // CO2 simulation flag - int CO2OutdoorSchedPtr = 0; // CO2 outdoor level schedule pointer - bool GenericContamSimulation = false; // Generic contaminant simulation flag - int GenericContamOutdoorSchedPtr = 0; // Generic contaminant outdoor level schedule pointer + bool SimulateContaminants = false; // A logical flag to determine whether any contaminants are simulated or not + bool CO2Simulation = false; // CO2 simulation flag + Sched::Schedule *CO2OutdoorSched = nullptr; // CO2 outdoor level schedule + bool GenericContamSimulation = false; // Generic contaminant simulation flag + Sched::Schedule *genericOutdoorSched = nullptr; // Generic contaminant outdoor level schedule }; struct ZoneContControls @@ -79,25 +80,20 @@ namespace DataContaminantBalance { std::string Name; // Name of the contaminant controller std::string ZoneName; // Name of the zone int ActualZoneNum = 0; - std::string AvaiSchedule; // Availability Schedule name - int AvaiSchedPtr = 0; // Pointer to the correct schedule - std::string SetPointSchedName; // Name of the schedule which determines the CO2 setpoint - int SPSchedIndex = 0; // Index for this schedule - bool EMSOverrideCO2SetPointOn = false; // EMS is calling to override CO2 setpoint - Real64 EMSOverrideCO2SetPointValue = 0.0; // value EMS is directing to use for CO2 setpoint - int NumOfZones = 0; // Number of controlled zones in the same airloop - Array1D_int ControlZoneNum; // Controlled zone number - std::string ZoneMinCO2SchedName; // Name of the schedule which determines minimum CO2 concentration - int ZoneMinCO2SchedIndex = 0; // Index for this schedule - std::string ZoneMaxCO2SchedName; // Name of the schedule which determines maximum CO2 concentration - int ZoneMaxCO2SchedIndex = 0; // Index for this schedule - int ZoneContamControllerSchedIndex = 0; // Index for this schedule - std::string GCAvaiSchedule; // Availability Schedule name for generic contamiant - int GCAvaiSchedPtr = 0; // Pointer to the correct generic contaminant availability schedule - std::string GCSetPointSchedName; // Name of the schedule which determines the generic contaminant setpoint - int GCSPSchedIndex = 0; // Index for this schedule - bool EMSOverrideGCSetPointOn = false; // EMS is calling to override generic contaminant setpoint - Real64 EMSOverrideGCSetPointValue = 0.0; // value EMS is directing to use for generic contaminant setpoint + Sched::Schedule *availSched = nullptr; // Availability schedule + Sched::Schedule *setptSched = nullptr; // Setpoint schedule + bool EMSOverrideCO2SetPointOn = false; // EMS is calling to override CO2 setpoint + Real64 EMSOverrideCO2SetPointValue = 0.0; // value EMS is directing to use for CO2 setpoint + int NumOfZones = 0; // Number of controlled zones in the same airloop + Array1D_int ControlZoneNum; // Controlled zone number + Sched::Schedule *zoneMinCO2Sched = nullptr; // Minimum CO2 concentration schedule + Sched::Schedule *zoneMaxCO2Sched = nullptr; // Maximum CO2 concentration schedule + + Sched::Schedule *zoneContamControllerSched = nullptr; // Index for this schedule + Sched::Schedule *genericContamAvailSched = nullptr; // Availability Schedule name for generic contamiant + Sched::Schedule *genericContamSetptSched = nullptr; // Schedule which determines the generic contaminant setpoint + bool EMSOverrideGCSetPointOn = false; // EMS is calling to override generic contaminant setpoint + Real64 EMSOverrideGCSetPointValue = 0.0; // value EMS is directing to use for generic contaminant setpoint }; struct ZoneSystemContaminantDemandData // Contaminent loads to be met (kg air per second) @@ -112,51 +108,51 @@ namespace DataContaminantBalance { struct ZoneContamGenericDataConstant { // Members - std::string Name; // Name of the constant generic contaminant source and sink - std::string ZoneName; // Name of the zone - int ActualZoneNum = 0; // Zone number - Real64 GCGenerateRate = 0.0; // Generic contaminant design generation rate [m3/s] - int GCGenerateRateSchedPtr = 0; // Generic contaminant design generation rate schedule pointer - Real64 GCRemovalCoef = 0.0; // Generic contaminant design removal coefficient [m3/s] - int GCRemovalCoefSchedPtr = 0; // Generic contaminant design removal coefficient schedule pointer - Real64 GCGenRate = 0.0; // Generic contaminant design generation rate [m3/s] for reporting + std::string Name; // Name of the constant generic contaminant source and sink + std::string ZoneName; // Name of the zone + int ActualZoneNum = 0; // Zone number + Real64 GenerateRate = 0.0; // Generic contaminant design generation rate [m3/s] + Sched::Schedule *generateRateSched = nullptr; // Generic contaminant design generation rate schedule pointer + Real64 RemovalCoef = 0.0; // Generic contaminant design removal coefficient [m3/s] + Sched::Schedule *removalCoefSched = nullptr; // Generic contaminant design removal coefficient schedule pointer + Real64 GenRate = 0.0; // Generic contaminant design generation rate [m3/s] for reporting }; struct ZoneContamGenericDataPDriven { // Members - std::string Name; // Name of the pressure driven generic contaminant source and sink - std::string SurfName; // Name of the surface - int SurfNum = 0; // Surface number - Real64 GCGenRateCoef = 0.0; // Generic contaminant design generation rate coefficeint [m3/s] - int GCGenRateCoefSchedPtr = 0; // Generic contaminant design generation rate schedule pointer - Real64 GCExpo = 0.0; // Generic contaminant exponent [] - Real64 GCGenRate = 0.0; // Generic contaminant design generation rate [m3/s] for reporting + std::string Name; // Name of the pressure driven generic contaminant source and sink + std::string SurfName; // Name of the surface + int SurfNum = 0; // Surface number + Real64 GenRateCoef = 0.0; // Generic contaminant design generation rate coefficeint [m3/s] + Sched::Schedule *generateRateCoefSched = nullptr; // Generic contaminant design generation rate schedule + Real64 Expo = 0.0; // Generic contaminant exponent [] + Real64 GenRate = 0.0; // Generic contaminant design generation rate [m3/s] for reporting }; struct ZoneContamGenericDataCutoff { // Members - std::string Name; // Name of the cutoff generic contaminant source and sink - std::string ZoneName; // Name of the zone - int ActualZoneNum = 0; // Zone number - Real64 GCGenerateRate = 0.0; // Generic contaminant design generation rate [m3/s] - int GCGenerateRateSchedPtr = 0; // Generic contaminant design generation rate schedule pointer - Real64 GCCutoffValue = 0.0; // Cutoff value [ppm] - Real64 GCGenRate = 0.0; // Generic contaminant design generation rate [m3/s] for reporting + std::string Name; // Name of the cutoff generic contaminant source and sink + std::string ZoneName; // Name of the zone + int ActualZoneNum = 0; // Zone number + Real64 GenerateRate = 0.0; // Generic contaminant design generation rate [m3/s] + Sched::Schedule *generateRateSched = nullptr; // Generic contaminant design generation rate schedule pointer + Real64 CutoffValue = 0.0; // Cutoff value [ppm] + Real64 GenRate = 0.0; // Generic contaminant design generation rate [m3/s] for reporting }; struct ZoneContamGenericDataDecay { // Members - std::string Name; // Name of the decay generic contaminant source and sink - std::string ZoneName; // Name of the zone - int ActualZoneNum = 0; // Zone number - Real64 GCInitEmiRate = 0.0; // Generic contaminant design generation rate [m3/s] - int GCEmiRateSchedPtr = 0; // Generic contaminant emission rate schedule pointer - Real64 GCTime = 0.0; // Time since the styart of emission [s] - Real64 GCDelayTime = 0.0; // Delay time constant [s] - Real64 GCGenRate = 0.0; // Generic contaminant design generation rate [m3/s] for reporting + std::string Name; // Name of the decay generic contaminant source and sink + std::string ZoneName; // Name of the zone + int ActualZoneNum = 0; // Zone number + Real64 InitEmitRate = 0.0; // Generic contaminant design generation rate [m3/s] + Sched::Schedule *emitRateSched = nullptr; // Generic contaminant emission rate schedule pointer + Real64 Time = 0.0; // Time since the styart of emission [s] + Real64 DelayTime = 0.0; // Delay time constant [s] + Real64 GenRate = 0.0; // Generic contaminant design generation rate [m3/s] for reporting }; struct ZoneContamGenericDataBLDiff @@ -164,42 +160,41 @@ namespace DataContaminantBalance { // Members std::string Name; // Name of the boundary layer diffusion generic contaminant source // and sink - std::string SurfName; // Name of the surface - int SurfNum = 0; // Surface number - Real64 GCTranCoef = 0.0; // Generic contaminant mass transfer coefficeint [m/s] - int GCTranCoefSchedPtr = 0; // Generic contaminant mass transfer coefficeint schedule pointer - Real64 GCHenryCoef = 0.0; // Generic contaminant Henry adsorption constant or + std::string SurfName; // Name of the surface + int SurfNum = 0; // Surface number + Real64 TransCoef = 0.0; // Generic contaminant mass transfer coefficeint [m/s] + Sched::Schedule *transCoefSched = nullptr; // Generic contaminant mass transfer coefficeint schedule pointer + Real64 HenryCoef = 0.0; // Generic contaminant Henry adsorption constant or // partition coefficient [] - Real64 GCGenRate = 0.0; // Generic contaminant design generation rate [m3/s] for reporting + Real64 GenRate = 0.0; // Generic contaminant design generation rate [m3/s] for reporting }; struct ZoneContamGenericDataDVS { // Members - std::string Name; // Name of the deposition velocity generic contaminant sink - std::string SurfName; // Name of the surface - int SurfNum = 0; // Surface number - Real64 GCDepoVelo = 0.0; // Generic contaminant deposition velocity [m/s] - int GCDepoVeloPtr = 0; // Generic contaminant deposition velocity sink schedule pointer - Real64 GCGenRate = 0.0; // Generic contaminant design generation rate [m3/s] for reporting + std::string Name; // Name of the deposition velocity generic contaminant sink + std::string SurfName; // Name of the surface + int SurfNum = 0; // Surface number + Real64 DepoVelo = 0.0; // Generic contaminant deposition velocity [m/s] + Sched::Schedule *depoVeloSched = nullptr; // Generic contaminant deposition velocity sink schedule pointer + Real64 GenRate = 0.0; // Generic contaminant design generation rate [m3/s] for reporting }; struct ZoneContamGenericDataDRS { // Members - std::string Name; // Name of the deposition rate generic contaminant sink - std::string ZoneName; // Name of the zone - int ActualZoneNum = 0; // Zone number - Real64 GCDepoRate = 0.0; // Generic contaminant deposition rate [m/s] - int GCDepoRatePtr = 0; // Generic contaminant deposition rate sink schedule pointer - Real64 GCGenRate = 0.0; // Generic contaminant design generation rate [m3/s] for reporting + std::string Name; // Name of the deposition rate generic contaminant sink + std::string ZoneName; // Name of the zone + int ActualZoneNum = 0; // Zone number + Real64 DepoRate = 0.0; // Generic contaminant deposition rate [m/s] + Sched::Schedule *depoRateSched = nullptr; // Generic contaminant deposition rate sink schedule + Real64 GenRate = 0.0; // Generic contaminant design generation rate [m3/s] for reporting }; } // namespace DataContaminantBalance struct ContaminantBalanceData : BaseGlobalStruct { - Array1D ZoneCO2SetPoint; Array1D CO2PredictedRate; @@ -291,6 +286,10 @@ struct ContaminantBalanceData : BaseGlobalStruct Array1D ZoneContamGenericDVS; Array1D ZoneContamGenericDRS; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataConvergParams.hh b/src/EnergyPlus/DataConvergParams.hh index ccb329ae122..521fa2d01af 100644 --- a/src/EnergyPlus/DataConvergParams.hh +++ b/src/EnergyPlus/DataConvergParams.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -183,6 +183,10 @@ struct ConvergParamsData : BaseGlobalStruct Array1D AirLoopConvergence; Array1D PlantConvergence; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataConversions.hh b/src/EnergyPlus/DataConversions.hh index 6724482d3a6..0b62e9e8c6b 100644 --- a/src/EnergyPlus/DataConversions.hh +++ b/src/EnergyPlus/DataConversions.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/DataDElight.hh b/src/EnergyPlus/DataDElight.hh index 3b6aea53f35..250f4a886d3 100644 --- a/src/EnergyPlus/DataDElight.hh +++ b/src/EnergyPlus/DataDElight.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/DataDaylighting.hh b/src/EnergyPlus/DataDaylighting.hh index 36b8c0a78c4..1040a2b7797 100644 --- a/src/EnergyPlus/DataDaylighting.hh +++ b/src/EnergyPlus/DataDaylighting.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -51,7 +51,6 @@ // ObjexxFCL Headers #include #include -#include // EnergyPlus Headers #include @@ -189,7 +188,7 @@ namespace Dayltg { int spaceIndex = 0; // Index to space where the daylighting:controls object is located (0 if specified for a zone) int enclIndex = 0; // Index to enclosure where the daylighting:controls object is located Dayltg::DaylightingMethod DaylightMethod = DaylightingMethod::None; // Type of Daylighting (1=SplitFlux, 2=DElight) - int AvailSchedNum = 0; // pointer to availability schedule if present + Sched::Schedule *availSched = nullptr; // availability schedule if present int TotalExtWindows = 0; int TotalDaylRefPoints = 0; // Number of daylighting reference points for this control @@ -214,7 +213,7 @@ namespace Dayltg { // 3: Reference point number (1 to Total Daylighting Reference Points) // 4: Sky type (1 to 4; 1 = clear, 2 = clear turbid, 3 = intermediate, 4 = overcast // 5: Daylit window number (1 to NumOfDayltgExtWins) - std::array, (int)DataSurfaces::WinCover::Num>>, (int)Constant::HoursInDay + 1> + std::array, (int)DataSurfaces::WinCover::Num>>, (int)Constant::iHoursInDay + 1> daylFac; // Time exceeding daylight illuminance setpoint at reference points (hours) @@ -271,7 +270,7 @@ namespace Dayltg { // 3: Reference point number (1 to Total Map Reference Points) // 4: Shading index (1 to MaxSlatAngs+1; 1 = bare window; 2 = with shade, or, if blinds // 2 = first slat position, 3 = second position, ..., MaxSlatAngs+1 = last position) - std::array>, (int)Constant::HoursInDay + 1> daylFac; + std::array>, (int)Constant::iHoursInDay + 1> daylFac; }; struct RefPointData diff --git a/src/EnergyPlus/DataDaylightingDevices.hh b/src/EnergyPlus/DataDaylightingDevices.hh index 7b2a98d0d05..703c0de1fee 100644 --- a/src/EnergyPlus/DataDaylightingDevices.hh +++ b/src/EnergyPlus/DataDaylightingDevices.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -136,6 +136,10 @@ struct DataDaylightingDevicesData : BaseGlobalStruct Array1D TDDPipe; Array1D Shelf; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataDefineEquip.hh b/src/EnergyPlus/DataDefineEquip.hh index 98d7bcaf6e6..57bd26d5fa0 100644 --- a/src/EnergyPlus/DataDefineEquip.hh +++ b/src/EnergyPlus/DataDefineEquip.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -145,6 +145,10 @@ struct DefineEquipData : BaseGlobalStruct { Array1D AirDistUnit; // Used to specify zone related + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataEnvironment.cc b/src/EnergyPlus/DataEnvironment.cc index 64efcd6e26d..15b7f36ecdc 100644 --- a/src/EnergyPlus/DataEnvironment.cc +++ b/src/EnergyPlus/DataEnvironment.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/DataEnvironment.hh b/src/EnergyPlus/DataEnvironment.hh index f1ff959a438..09a48fd2cb3 100644 --- a/src/EnergyPlus/DataEnvironment.hh +++ b/src/EnergyPlus/DataEnvironment.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -50,10 +50,14 @@ // ObjexxFCL Headers #include +#include + +using ObjexxFCL::Vector3; // EnergyPlus Headers #include #include +#include namespace EnergyPlus { @@ -205,12 +209,16 @@ struct EnvironmentData : BaseGlobalStruct std::string EnvironmentStartEnd; // Start/End dates for Environment bool CurrentYearIsLeapYear = false; // true when current year is leap year (convoluted logic dealing with whether weather file allows leap years, runperiod inputs. - int varyingLocationSchedIndexLat = 0; - int varyingLocationSchedIndexLong = 0; - int varyingOrientationSchedIndex = 0; + Sched::Schedule *varyingLocationLatSched = nullptr; + Sched::Schedule *varyingLocationLongSched = nullptr; + Sched::Schedule *varyingOrientationSched = nullptr; bool forceBeginEnvResetSuppress = false; // for PerformancePrecisionTradeoffs bool oneTimeCompRptHeaderFlag = true; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataErrorTracking.hh b/src/EnergyPlus/DataErrorTracking.hh index d88f17840da..54b8bda246d 100644 --- a/src/EnergyPlus/DataErrorTracking.hh +++ b/src/EnergyPlus/DataErrorTracking.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -232,6 +232,10 @@ struct ErrorTrackingData : BaseGlobalStruct MatchCounts = Array1D_int(DataErrorTracking::SearchCounts, 0); } + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataGenerators.hh b/src/EnergyPlus/DataGenerators.hh index 88246121787..3266c130c1f 100644 --- a/src/EnergyPlus/DataGenerators.hh +++ b/src/EnergyPlus/DataGenerators.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -55,6 +55,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -203,7 +204,7 @@ namespace DataGenerators { DataGenerators::FuelMode FuelTypeMode = DataGenerators::FuelMode::Invalid; // type of fuel, gasous or liquid std::string NodeName; // node name for temperature at input int NodeNum = 0; // node number for temperature at input - int SchedNum = 0; // fuel temperature at input + Sched::Schedule *sched = nullptr; // fuel temperature at input int CompPowerCurveID = 0; // "pointer" to compressor power cubic curve Real64 CompPowerLossFactor = 0.0; int NumConstituents = 0; // number of constituents in fue supply @@ -292,7 +293,7 @@ namespace DataGenerators { Real64 kp = 0.0; // coefficient k_p for warmup power bool MandatoryFullCoolDown = false; bool WarmRestartOkay = true; - int AvailabilitySchedID = 0; + Sched::Schedule *availSched = nullptr; // Calculated values and input from elsewhere DataGenerators::OperatingMode CurrentOpMode = DataGenerators::OperatingMode::Off; // current operating mode, uses params like OpModeNormal DataGenerators::OperatingMode LastOpMode = DataGenerators::OperatingMode::Off; @@ -327,6 +328,10 @@ struct GeneratorsData : BaseGlobalStruct Real64 TrialMdotcw = 0.0; // test or estimate of what the plant flows are going to be (kg/s) Real64 LimitMinMdotcw = 0.0; // lower limit for cooling water flow for generatior operation (kg/s) + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataGlobalConstants.hh b/src/EnergyPlus/DataGlobalConstants.hh index 3c7ff92e8fb..74868891359 100644 --- a/src/EnergyPlus/DataGlobalConstants.hh +++ b/src/EnergyPlus/DataGlobalConstants.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -49,8 +49,6 @@ #define DataGlobalConstants_hh_INCLUDED // EnergyPlus Headers -#include -// #include #include namespace EnergyPlus { @@ -477,21 +475,6 @@ namespace Constant { "customEMS" // customEMS }; - inline std::string unitToString(Units unit) - { - switch (unit) { - case Units::Invalid: - return "invalid"; - default: - const int iUnit = static_cast(unit); - constexpr int numUnitNames = unitNames.size(); - if (0 <= iUnit && iUnit < numUnitNames) { - return fmt::format("[{}]", unitNames[iUnit]); - } - return "invalid-out-of-range"; - } - } - constexpr std::array unitNamesUC = { "KG/S", // kg_s "C", // C @@ -597,13 +580,24 @@ namespace Constant { Real64 constexpr Pi = 3.14159265358979324; // Pi 3.1415926535897932384626435 Real64 constexpr PiOvr2 = Pi / 2.0; // Pi/2 Real64 constexpr TwoPi = 2.0 * Pi; // 2*Pi 6.2831853071795864769252868 - Real64 constexpr GravityConstant = 9.807; - Real64 constexpr DegToRadians = Pi / 180.0; // Conversion for Degrees to Radians - Real64 constexpr DegToRad = Pi / 180.0; // Why is it DegToRadians and RadToDeg? Why? WHY? - Real64 constexpr RadToDeg = 180.0 / Pi; // Conversion for Radians to Degrees - Real64 constexpr SecInHour = 3600.0; // Conversion for hours to seconds - Real64 constexpr HoursInDay = 24.0; // Number of Hours in Day - Real64 constexpr SecsInDay = SecInHour * HoursInDay; // Number of seconds in Day + Real64 constexpr Gravity = 9.807; + Real64 constexpr DegToRad = Pi / 180.0; // Why is it DegToRadians and RadToDeg? Why? WHY? + Real64 constexpr RadToDeg = 180.0 / Pi; // Conversion for Radians to Degrees + + int constexpr iSecsInMinute = 60; // Conversion for hours to seconds + int constexpr iMinutesInHour = 60; // Conversion for hours to minutes + int constexpr iSecsInHour = iSecsInMinute * iMinutesInHour; // Conversion for hours to seconds + int constexpr iHoursInDay = 24; // Number of Hours in Day + int constexpr iMinutesInDay = iMinutesInHour * iHoursInDay; // Number of seconds in Day + int constexpr iSecsInDay = iSecsInHour * iHoursInDay; // Number of seconds in Day + + Real64 constexpr rSecsInMinute = 60.0; // Conversion for hours to seconds + Real64 constexpr rMinutesInHour = 60.0; // Conversion for hours to minutes + Real64 constexpr rSecsInHour = rSecsInMinute * rMinutesInHour; // Conversion for hours to seconds + Real64 constexpr rHoursInDay = 24.0; // Number of Hours in Day + Real64 constexpr rMinutesInDay = rMinutesInHour * rHoursInDay; // Number of seconds in Day + Real64 constexpr rSecsInDay = rSecsInHour * rHoursInDay; // Number of seconds in Day + Real64 constexpr BigNumber = std::numeric_limits::max(); // Max Number real used for initializations Real64 constexpr rTinyValue = std::numeric_limits::epsilon(); // Tiny value to replace use of TINY(x) std::string::size_type constexpr MaxNameLength = diff --git a/src/EnergyPlus/DataGlobals.hh b/src/EnergyPlus/DataGlobals.hh index fb4d70283fd..b7a0dba5411 100644 --- a/src/EnergyPlus/DataGlobals.hh +++ b/src/EnergyPlus/DataGlobals.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -105,7 +105,7 @@ struct DataGlobal : BaseGlobalStruct Real64 WeightNow = 0.0; // Weighting of value for current hour int NumOfDayInEnvrn = 0; // Number of days in the simulation for a particular environment bool OverrideTimestep = false; // True if PerformancePrecision object overrides the number of time steps in each hour - int NumOfTimeStepInHour = 0; // Number of time steps in each hour of the simulation + int TimeStepsInHour = 0; // Number of time steps in each hour of the simulation int NumOfZones = 0; // Total number of Zones for simulation int numSpaces = 0; // Total number of Spaces for simulation int numSpaceTypes = 0; // Number of unique space types @@ -139,7 +139,7 @@ struct DataGlobal : BaseGlobalStruct bool CreateMinimalSurfaceVariables = false; // True when selection for "CreateMinimalSurfaceVariables" is entered Real64 CurrentTime = 0.0; // CurrentTime, in fractional hours, from start of day. Uses Loads time step. int SimTimeSteps = 0; // Number of (Loads) timesteps since beginning of run period (environment). - int MinutesPerTimeStep = 0; // Minutes per time step calculated from NumTimeStepInHour (number of minutes per load time step) + int MinutesInTimeStep = 0; // Minutes per time step calculated from NumTimeStepInHour (number of minutes per load time step) Real64 TimeStepZoneSec = 0.0; // Seconds per time step bool MetersHaveBeenInitialized = false; bool KickOffSimulation = false; // Kick off simulation -- meaning run each environment for 1 or 2 time steps. @@ -177,6 +177,10 @@ struct DataGlobal : BaseGlobalStruct int numThread = 1; bool AirLoopHVACDOASUsedInSim = false; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataHVACControllers.hh b/src/EnergyPlus/DataHVACControllers.hh index 0c6be17f416..c5b6b232c34 100644 --- a/src/EnergyPlus/DataHVACControllers.hh +++ b/src/EnergyPlus/DataHVACControllers.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -120,6 +120,10 @@ struct HVACCtrlData : BaseGlobalStruct "Active min-constrained controller mode", "Active max-constrained controller mode"}); + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataHVACGlobals.cc b/src/EnergyPlus/DataHVACGlobals.cc index 6816cac9dfc..b488976c4ba 100644 --- a/src/EnergyPlus/DataHVACGlobals.cc +++ b/src/EnergyPlus/DataHVACGlobals.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/DataHVACGlobals.hh b/src/EnergyPlus/DataHVACGlobals.hh index 5565538e8bc..48f96bcefa2 100644 --- a/src/EnergyPlus/DataHVACGlobals.hh +++ b/src/EnergyPlus/DataHVACGlobals.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -109,18 +109,21 @@ namespace HVAC { int constexpr AutoCalculateSizing(25); // identifies an autocalulate input // The following parameters describe the setpoint types in TempControlType(ActualZoneNum) - enum class ThermostatType + enum class SetptType { Invalid = -1, Uncontrolled, - SingleHeating, - SingleCooling, + SingleHeat, + SingleCool, SingleHeatCool, - DualSetPointWithDeadBand, + DualHeatCool, Num }; - static constexpr std::array(ThermostatType::Num)> thermostatTypeNames = { + static constexpr std::array setptTypes = { + SetptType::SingleHeat, SetptType::SingleCool, SetptType::SingleHeatCool, SetptType::DualHeatCool}; + + static constexpr std::array setptTypeNames = { "Uncontrolled", "SingleHeating", "SingleCooling", "SingleHeatCool", "DualSetPointWithDeadBand"}; enum class AirDuctType @@ -534,6 +537,10 @@ struct HVACGlobalsData : BaseGlobalStruct bool StandardRatingsMyHeatOneTimeFlag = true; bool StandardRatingsMyHeatOneTimeFlag2 = true; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataHVACSystems.hh b/src/EnergyPlus/DataHVACSystems.hh index c06a2c42bd3..47ceca83b91 100644 --- a/src/EnergyPlus/DataHVACSystems.hh +++ b/src/EnergyPlus/DataHVACSystems.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/DataHeatBalFanSys.hh b/src/EnergyPlus/DataHeatBalFanSys.hh index aab092488ea..c4f5e6719e8 100644 --- a/src/EnergyPlus/DataHeatBalFanSys.hh +++ b/src/EnergyPlus/DataHeatBalFanSys.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -98,6 +98,16 @@ namespace DataHeatBalFanSys { Real64 CoolingPanel; // Current radiant heat flux to surface from simple cooling panels }; + struct ZoneTstatSetpt + { + Real64 setpt = 0.0; + Real64 setptAdapComfortCool = 0.0; + Real64 setptHi = 0.0; + Real64 setptLo = 0.0; + Real64 setptHiAver = 0.0; + Real64 setptLoAver = 0.0; + }; + } // namespace DataHeatBalFanSys struct HeatBalFanSysData : BaseGlobalStruct @@ -141,12 +151,7 @@ struct HeatBalFanSysData : BaseGlobalStruct Array1D RadSysToHBTinCoef; // Outside heat balance coefficient that modifies Toutside Array1D RadSysToHBQsrcCoef; // Outside heat balance coefficient that modifies source/sink - Array1D TempZoneThermostatSetPoint; - Array1D AdapComfortCoolingSetPoint; - Array1D ZoneThermostatSetPointHi; - Array1D ZoneThermostatSetPointLo; - Array1D ZoneThermostatSetPointHiAver; - Array1D ZoneThermostatSetPointLoAver; + Array1D zoneTstatSetpts; EPVector LoadCorrectionFactor; // PH 3/3/04 @@ -157,9 +162,9 @@ struct HeatBalFanSysData : BaseGlobalStruct Array1D PreviousMeasuredHumRat1; // Hybrid model zone humidity ratio at previous timestep Array1D PreviousMeasuredHumRat2; // Hybrid model zone humidity ratio at previous timestep Array1D PreviousMeasuredHumRat3; // Hybrid model zone humidity ratio at previous timestep - EPVector TempControlType; + EPVector TempControlType; EPVector TempControlTypeRpt; - EPVector ComfortControlType; + EPVector ComfortControlType; EPVector ComfortControlTypeRpt; Array2D CrossedColdThreshRepPeriod; @@ -195,6 +200,10 @@ struct HeatBalFanSysData : BaseGlobalStruct EPVector ZoneComfortControlsFanger; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataHeatBalSurface.hh b/src/EnergyPlus/DataHeatBalSurface.hh index 0a70f0a729f..5ecf73ddb20 100644 --- a/src/EnergyPlus/DataHeatBalSurface.hh +++ b/src/EnergyPlus/DataHeatBalSurface.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -51,7 +51,6 @@ // ObjexxFCL Headers #include #include -#include // EnergyPlus Headers #include @@ -231,20 +230,18 @@ struct HeatBalSurfData : BaseGlobalStruct Array1D_bool EnclSolRecDifShortFromZ; // True if Zone gets short radiation from another // Surface Heat Balance - Array1D SurfMovInsulExtPresent; // True when interior movable insulation is present - Array1D SurfMovInsulIntPresent; // True when interior movable insulation is present - Array1D SurfMovInsulIntPresentPrevTS; // True when interior movable insulation was present during the previous time step - - Array1D SurfMovInsulHExt; // Resistance or "h" value of exterior movable insulation - Array1D SurfMovInsulHInt; // Resistance or "h" value of interior movable insulation Array1D SurfAbsSolarExt; // Solar Absorptivity of surface outside face or interior movable insulation if present Array1D SurfAbsThermalExt; // Thermal Absorptivity of surface outside face or interior movable insulation if present Array1D SurfAbsSolarInt; // Solar absorptivity of surface inside face or exterior movable insulation if present Array1D SurfRoughnessExt; // Roughness of surface inside face or exterior movable insulation if present Array1D SurfAbsThermalInt; // Thermal absorptivity of surface inside face or exterior movable insulation if present - std::vector SurfMovInsulIndexList; + std::vector SurfMovSlatsIndexList; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataHeatBalance.cc b/src/EnergyPlus/DataHeatBalance.cc index 0561b8aa23e..cd743f82e18 100644 --- a/src/EnergyPlus/DataHeatBalance.cc +++ b/src/EnergyPlus/DataHeatBalance.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/DataHeatBalance.hh b/src/EnergyPlus/DataHeatBalance.hh index d0c04f26035..0bc1f3c4683 100644 --- a/src/EnergyPlus/DataHeatBalance.hh +++ b/src/EnergyPlus/DataHeatBalance.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -633,16 +633,16 @@ namespace DataHeatBalance { bool HasLtsRetAirGain = false; // TRUE means that zone lights return air heat > 0.0 calculated from plenum temperature bool HasAirFlowWindowReturn = false; // TRUE means that zone has return air flow from windows // from refrigeration cases for this zone - Real64 InternalHeatGains = 0.0; // internal loads (W) - Real64 NominalInfilVent = 0.0; // internal infiltration/ventilation - Real64 NominalMixing = 0.0; // internal mixing/cross mixing - bool TempOutOfBoundsReported = false; // if any temp out of bounds errors, first will show zone details. - bool EnforcedReciprocity = false; // if zone/space required forced reciprocity -- less out of bounds temp errors allowed - int ZoneMinCO2SchedIndex = 0; // Index for the schedule the schedule which determines minimum CO2 concentration - int ZoneMaxCO2SchedIndex = 0; // Index for the schedule the schedule which determines maximum CO2 concentration - int ZoneContamControllerSchedIndex = 0; // Index for this schedule - bool FlagCustomizedZoneCap = false; // True if customized Zone Capacitance Multiplier is used - std::vector otherEquipFuelTypeNums; // List of fuel types used by other equipment in this zone + Real64 InternalHeatGains = 0.0; // internal loads (W) + Real64 NominalInfilVent = 0.0; // internal infiltration/ventilation + Real64 NominalMixing = 0.0; // internal mixing/cross mixing + bool TempOutOfBoundsReported = false; // if any temp out of bounds errors, first will show zone details. + bool EnforcedReciprocity = false; // if zone/space required forced reciprocity -- less out of bounds temp errors allowed + Sched::Schedule *zoneMinCO2Sched = nullptr; // Index for the schedule the schedule which determines minimum CO2 concentration + Sched::Schedule *zoneMaxCO2Sched = nullptr; // Index for the schedule the schedule which determines maximum CO2 concentration + Sched::Schedule *zoneContamControllerSched = nullptr; // Index for this schedule + bool FlagCustomizedZoneCap = false; // True if customized Zone Capacitance Multiplier is used + std::vector otherEquipFuelTypeNums; // List of fuel types used by other equipment in this zone // Hybrid Modeling Real64 ZoneMeasuredTemperature = 0.0; // Measured zone air temperature input by user @@ -728,28 +728,28 @@ namespace DataHeatBalance { struct PeopleData { // Members - std::string Name; // PEOPLE object name - int ZonePtr = 0; // Zone index for this people statement - int spaceIndex = 0; // Space index for this people statement - Real64 NumberOfPeople = 0.0; // Maximum number of people for this statement - int NumberOfPeoplePtr = -1; // Pointer to schedule for number of people - bool EMSPeopleOn = false; // EMS actuating number of people if .TRUE. - Real64 EMSNumberOfPeople = 0.0; // Value EMS is directing to use for override + std::string Name; // PEOPLE object name + int ZonePtr = 0; // Zone index for this people statement + int spaceIndex = 0; // Space index for this people statement + Real64 NumberOfPeople = 0.0; // Maximum number of people for this statement + Sched::Schedule *sched = nullptr; // schedule for number of people + bool EMSPeopleOn = false; // EMS actuating number of people if .TRUE. + Real64 EMSNumberOfPeople = 0.0; // Value EMS is directing to use for override // Note that the schedule and maximum number was kept for people since it seemed likely that // users would want to assign the same schedule to multiple people statements. - int ActivityLevelPtr = -1; // Pointer to schedule for activity level - Real64 FractionRadiant = 0.0; // Percentage (fraction 0.0-1.0) of sensible heat gain from people + Sched::Schedule *activityLevelSched = nullptr; // schedule for activity level + Real64 FractionRadiant = 0.0; // Percentage (fraction 0.0-1.0) of sensible heat gain from people // that is radiant Real64 FractionConvected = 0.0; // Percentage (fraction 0.0-1.0) of sensible heat gain from people // that is convective - Real64 NomMinNumberPeople = 0.0; // Nominal Minimum Number of People (min sch X number of people) - Real64 NomMaxNumberPeople = 0.0; // Nominal Maximum Number of People (min sch X number of people) - int WorkEffPtr = -1; // Pointer to schedule for work efficiency - int ClothingPtr = -1; // Pointer to schedule for clothing insulation - int ClothingMethodPtr = -1; + Real64 NomMinNumberPeople = 0.0; // Nominal Minimum Number of People (min sch X number of people) + Real64 NomMaxNumberPeople = 0.0; // Nominal Maximum Number of People (min sch X number of people) + Sched::Schedule *workEffSched = nullptr; // schedule for work efficiency + Sched::Schedule *clothingSched = nullptr; // schedule for clothing insulation + Sched::Schedule *clothingMethodSched = nullptr; ClothingType clothingType = ClothingType::Invalid; // Clothing type - int AirVelocityPtr = -1; // Pointer to schedule for air velocity in zone - int AnkleAirVelocityPtr = -1; // Pointer to schedule for air velocity in zone + Sched::Schedule *airVelocitySched = nullptr; // schedule for air velocity in zone + Sched::Schedule *ankleAirVelocitySched = nullptr; // schedule for ankle air velocity in zone bool Fanger = false; // True when Fanger calculation to be performed bool Pierce = false; // True when Pierce 2-node calculation to be performed bool KSU = false; // True when KSU 2-node calculation to be performed @@ -799,7 +799,7 @@ namespace DataHeatBalance { std::string Name; // LIGHTS object name int ZonePtr = 0; // Which zone lights are in int spaceIndex = 0; // Space index for this lights instance - int SchedPtr = -1; // Schedule for lights + Sched::Schedule *sched = nullptr; // Schedule for lights Real64 DesignLevel = 0.0; // design level for lights [W] bool EMSLightsOn = false; // EMS actuating Lighting power if .TRUE. Real64 EMSLightingPower = 0.0; // Value EMS is directing to use for override @@ -842,7 +842,7 @@ namespace DataHeatBalance { std::string Name; // EQUIPMENT object name int ZonePtr = 0; // Which zone internal gain is in int spaceIndex = 0; // Space index for this equipment instance - int SchedPtr = 0; // Schedule for internal gain + Sched::Schedule *sched = nullptr; // Schedule for internal gain Real64 DesignLevel = 0.0; // design level for internal gain [W] bool EMSZoneEquipOverrideOn = false; // EMS actuating equipment power if .TRUE. Real64 EMSEquipPower = 0.0; // Value EMS is directing to use for override @@ -976,8 +976,8 @@ namespace DataHeatBalance { Real64 NomMinDesignLevel = 0.0; // Nominal Minimum Design Level (min sch X design level) Real64 NomMaxDesignLevel = 0.0; // Nominal Maximum Design Level (max sch X design level) Real64 DesignFanPowerFrac = 0.0; // Fraction (0.0-1.0) of design power level that is fans - int OperSchedPtr = 0; // Schedule pointer for design power input or operating schedule - int CPULoadSchedPtr = 0; // Schedule pointer for CPU loading schedule + Sched::Schedule *operSched = nullptr; // Schedule for design power input or operating schedule + Sched::Schedule *cpuLoadSched = nullptr; // Schedule for CPU loading schedule Real64 SizingTAirIn = 0.0; // Entering air dry-bulb temperature at maximum value during sizing[C] Real64 DesignTAirIn = 0.0; // Design entering air dry-bulb temperature [C] Real64 DesignFanPower = 0.0; // Design fan power input [W] @@ -992,24 +992,25 @@ namespace DataHeatBalance { int OutletRoomAirNodeNum = 0; // Room air model node number for air outlet int SupplyAirNodeNum = 0; // Node number for supply air inlet Real64 DesignRecircFrac = 0.0; // Design recirculation fraction (0.0-0.5) - int RecircFLTCurve = 0; // Index for recirculation function of CPULoadFrac (x) and TSupply (y) curve - Real64 DesignUPSEfficiency = 0.0; // Design power supply efficiency (>0.0 - 1.0) - int UPSEfficFPLRCurve = 0; // Index for recirculation function of part load ratio - Real64 UPSLossToZoneFrac = 0.0; // Fraction of UPS power loss to zone (0.0 - 1.0); remainder is lost - std::string EndUseSubcategoryCPU; // User defined name for the end use category for the CPU - std::string EndUseSubcategoryFan; // User defined name for the end use category for the Fans - std::string EndUseSubcategoryUPS; // User defined name for the end use category for the power supply - bool EMSCPUPowerOverrideOn = false; // EMS actuating CPU power if .TRUE. - Real64 EMSCPUPower = 0.0; // Value EMS is directing to use for override of CPU power [W] - bool EMSFanPowerOverrideOn = false; // EMS actuating Fan power if .TRUE. - Real64 EMSFanPower = 0.0; // Value EMS is directing to use for override of Fan power [W] - bool EMSUPSPowerOverrideOn = false; // EMS actuating UPS power if .TRUE. - Real64 EMSUPSPower = 0.0; // Value EMS is directing to use for override of UPS power [W] - Real64 SupplyApproachTemp = 0.0; // The difference of the IT inlet temperature from the AHU supply air temperature - int SupplyApproachTempSch = 0; // The difference schedule of the IT inlet temperature from the AHU supply air temperature - Real64 ReturnApproachTemp = 0.0; // The difference of the unit outlet temperature from the well mixed zone temperature - int ReturnApproachTempSch = 0; // The difference schedule of the unit outlet temperature from the well mixed zone temperature - bool inControlledZone = false; // True if in a controlled zone + int RecircFLTCurve = 0; // Index for recirculation function of CPULoadFrac (x) and TSupply (y) curve + Real64 DesignUPSEfficiency = 0.0; // Design power supply efficiency (>0.0 - 1.0) + int UPSEfficFPLRCurve = 0; // Index for recirculation function of part load ratio + Real64 UPSLossToZoneFrac = 0.0; // Fraction of UPS power loss to zone (0.0 - 1.0); remainder is lost + std::string EndUseSubcategoryCPU; // User defined name for the end use category for the CPU + std::string EndUseSubcategoryFan; // User defined name for the end use category for the Fans + std::string EndUseSubcategoryUPS; // User defined name for the end use category for the power supply + bool EMSCPUPowerOverrideOn = false; // EMS actuating CPU power if .TRUE. + Real64 EMSCPUPower = 0.0; // Value EMS is directing to use for override of CPU power [W] + bool EMSFanPowerOverrideOn = false; // EMS actuating Fan power if .TRUE. + Real64 EMSFanPower = 0.0; // Value EMS is directing to use for override of Fan power [W] + bool EMSUPSPowerOverrideOn = false; // EMS actuating UPS power if .TRUE. + Real64 EMSUPSPower = 0.0; // Value EMS is directing to use for override of UPS power [W] + Real64 SupplyApproachTemp = 0.0; // The difference of the IT inlet temperature from the AHU supply air temperature + Sched::Schedule *supplyApproachTempSched = nullptr; // The difference schedule of the IT inlet temperature from the AHU supply air temperature + Real64 ReturnApproachTemp = 0.0; // The difference of the unit outlet temperature from the well mixed zone temperature + Sched::Schedule *returnApproachTempSched = + nullptr; // The difference schedule of the unit outlet temperature from the well mixed zone temperature + bool inControlledZone = false; // True if in a controlled zone // Report variables std::array PowerRpt; @@ -1044,7 +1045,7 @@ namespace DataHeatBalance { std::string Name; // BASEBOARD HEAT object name int ZonePtr = 0; int spaceIndex = 0; // Space index for this equipment instance - int SchedPtr = 0; + Sched::Schedule *sched = nullptr; Real64 CapatLowTemperature = 0.0; Real64 LowTemperature = 0.0; Real64 CapatHighTemperature = 0.0; @@ -1073,7 +1074,7 @@ namespace DataHeatBalance { std::string Name; int ZonePtr = 0; // Which zone infiltration is in int spaceIndex = 0; // Space index for this infiltration instance - int SchedPtr = 0; // Schedule for infiltration + Sched::Schedule *sched = nullptr; // Schedule for infiltration InfiltrationModelType ModelType = InfiltrationModelType::Invalid; // which model is used for infiltration // Design Flow Rate model terms Real64 DesignLevel = 0.0; @@ -1117,9 +1118,8 @@ namespace DataHeatBalance { std::string Name; int ZonePtr = 0; int spaceIndex = 0; // Space index for this ventilation instance - int SchedPtr = 0; - VentilationModelType ModelType = - VentilationModelType::Invalid; // which model is used for ventilation: DesignFlowRate and WindandStackOpenArea + Sched::Schedule *availSched = nullptr; + VentilationModelType ModelType = VentilationModelType::Invalid; // DesignFlowRate or WindandStackOpenArea Real64 DesignLevel = 0.0; bool EMSSimpleVentOn = false; // EMS actuating ventilation flow rate if .TRUE. Real64 EMSimpleVentFlowRate = 0.0; // Value EMS is directing to use for override @@ -1138,11 +1138,11 @@ namespace DataHeatBalance { Real64 MinOutdoorTemperature = -100.0; Real64 MaxOutdoorTemperature = 100.0; Real64 MaxWindSpeed = 40.0; - int MinIndoorTempSchedPtr = 0; // Minimum indoor temperature schedule index - int MaxIndoorTempSchedPtr = 0; // Maximum indoor temperature schedule index - int DeltaTempSchedPtr = 0; // Delta temperature schedule index - int MinOutdoorTempSchedPtr = 0; // Minimum outdoor temperature schedule index - int MaxOutdoorTempSchedPtr = 0; // Maximum outdoor temperature schedule index + Sched::Schedule *minIndoorTempSched = nullptr; // Minimum indoor temperature schedule + Sched::Schedule *maxIndoorTempSched = nullptr; // Maximum indoor temperature schedule + Sched::Schedule *deltaTempSched = nullptr; // Delta temperature schedule + Sched::Schedule *minOutdoorTempSched = nullptr; // Minimum outdoor temperature schedule + Sched::Schedule *maxOutdoorTempSched = nullptr; // Maximum outdoor temperature schedule int IndoorTempErrCount = 0; // Indoor temperature error count int OutdoorTempErrCount = 0; // Outdoor temperature error count int IndoorTempErrIndex = 0; // Indoor temperature error Index @@ -1151,13 +1151,13 @@ namespace DataHeatBalance { int HybridControlMasterNum = 0; // Hybrid ventilation control master object number bool HybridControlMasterStatus = false; // Hybrid ventilation control master object opening status // WindandStackOpenArea - Real64 OpenArea = 0.0; // Opening area [m2] - int OpenAreaSchedPtr = 0; // Opening area fraction schedule pointer - Real64 OpenEff = 0.0; // Opening effectiveness [dimensionless] - Real64 EffAngle = 0.0; // Effective angle [degree] - Real64 DH = 0.0; // Height difference [m] - Real64 DiscCoef = 0.0; // Discharge coefficient - Real64 MCP = 0.0; // Product of mass flow rate and Cp + Real64 OpenArea = 0.0; // Opening area [m2] + Sched::Schedule *openAreaFracSched = nullptr; // Opening area fraction schedule + Real64 OpenEff = 0.0; // Opening effectiveness [dimensionless] + Real64 EffAngle = 0.0; // Effective angle [degree] + Real64 DH = 0.0; // Height difference [m] + Real64 DiscCoef = 0.0; // Discharge coefficient + Real64 MCP = 0.0; // Product of mass flow rate and Cp }; struct ZoneAirBalanceData @@ -1168,7 +1168,7 @@ namespace DataHeatBalance { int ZonePtr = 0; // Zone number AirBalance BalanceMethod = AirBalance::None; // Air Balance Method Real64 InducedAirRate = 0.0; // Induced Outdoor Air Due to Duct Leakage Unbalance [m3/s] - int InducedAirSchedPtr = 0; // Induced Outdoor Air Fraction Schedule + Sched::Schedule *inducedAirSched = nullptr; // Induced Outdoor Air Fraction Schedule Real64 BalMassFlowRate = 0.0; // balanced mass flow rate Real64 InfMassFlowRate = 0.0; // unbalanced mass flow rate from infiltration Real64 NatMassFlowRate = 0.0; // unbalanced mass flow rate from natural ventilation @@ -1187,7 +1187,7 @@ namespace DataHeatBalance { std::string Name; int ZonePtr = 0; int spaceIndex = 0; // Space index for this mixing instance - int SchedPtr = 0; + Sched::Schedule *sched = nullptr; Real64 DesignLevel = 0.0; int FromZone = 0; int fromSpaceIndex = 0; // Source space index for this mixing instance @@ -1195,13 +1195,13 @@ namespace DataHeatBalance { Real64 DesiredAirFlowRate = 0.0; Real64 DesiredAirFlowRateSaved = 0.0; Real64 MixingMassFlowRate = 0.0; - int DeltaTempSchedPtr = 0; // Delta temperature schedule index - int MinIndoorTempSchedPtr = 0; // Minimum indoor temperature schedule index - int MaxIndoorTempSchedPtr = 0; // Maximum indoor temperature schedule index - int MinSourceTempSchedPtr = 0; // Minimum source zone temperature schedule index - int MaxSourceTempSchedPtr = 0; // Maximum source zone temperature schedule index - int MinOutdoorTempSchedPtr = 0; // Minimum outdoor temperature schedule index - int MaxOutdoorTempSchedPtr = 0; // Maximum outdoor temperature schedule index + Sched::Schedule *deltaTempSched = nullptr; // Delta temperature schedule index + Sched::Schedule *minIndoorTempSched = nullptr; // Minimum indoor temperature schedule index + Sched::Schedule *maxIndoorTempSched = nullptr; // Maximum indoor temperature schedule index + Sched::Schedule *minSourceTempSched = nullptr; // Minimum source zone temperature schedule index + Sched::Schedule *maxSourceTempSched = nullptr; // Maximum source zone temperature schedule index + Sched::Schedule *minOutdoorTempSched = nullptr; // Minimum outdoor temperature schedule index + Sched::Schedule *maxOutdoorTempSched = nullptr; // Maximum outdoor temperature schedule index int IndoorTempErrCount = 0; // Indoor temperature error count int SourceTempErrCount = 0; // Source zone temperature error count int OutdoorTempErrCount = 0; // Outdoor temperature error count @@ -1218,23 +1218,23 @@ namespace DataHeatBalance { Array1D_bool EMSRefDoorMixingOn; Array1D EMSRefDoorFlowRate; Array1D VolRefDoorFlowRate; - Array1D_int OpenSchedPtr; // Schedule for Refrigeration door open fraction - Array1D DoorHeight; // Door height for refrigeration door, m - Array1D DoorArea; // Door area for refrigeration door, m2 - Array1D Protection; // Refrigeration door protection factor, dimensionless - Array1D_int MateZonePtr; // Zone connected by refrigeration door (MateZone > ZonePtr) - Array1D_string DoorMixingObjectName; // Used in one error statement and eio - Array1D_string DoorProtTypeName; // Used in eio - // Note, for mixing and crossmixing, this type dimensioned by number of mixing objects. + Array1D openScheds; // Schedule for Refrigeration door open fraction + Array1D DoorHeight; // Door height for refrigeration door, m + Array1D DoorArea; // Door area for refrigeration door, m2 + Array1D Protection; // Refrigeration door protection factor, dimensionless + Array1D_int MateZonePtr; // Zone connected by refrigeration door (MateZone > ZonePtr) + Array1D_string DoorMixingObjectName; // Used in one error statement and eio + Array1D_string DoorProtTypeName; // Used in eio + // Note, for mixing and crossmixing, this type dimensioned by number of mixing objects. // For ref door mixing, dimensioned by number of zones. }; struct AirBoundaryMixingSpecs { - int space1; // Air boundary simple mixing space 1 - int space2; // Air boundary simple mixing space 2 - int scheduleIndex; // Air boundary simple mixing schedule index - Real64 mixingVolumeFlowRate; // Air boundary simple mixing volume flow rate [m3/s] + int space1; // Air boundary simple mixing space 1 + int space2; // Air boundary simple mixing space 2 + Sched::Schedule *sched = nullptr; // Air boundary simple mixing schedule index + Real64 mixingVolumeFlowRate; // Air boundary simple mixing volume flow rate [m3/s] }; struct ZoneAirMassFlowConservation @@ -1405,6 +1405,8 @@ namespace DataHeatBalance { Real64 MixVdotStdDensity = 0.0; // Mixing volume flow rate of Air {m3/s} at standard density (adjusted for elevation) Real64 MixMass = 0.0; // Mixing mass of air {kg} Real64 MixMdot = 0.0; // Mixing mass flow rate of air {kg/s} + Real64 MixSenLoad = 0.0; // Heat Gain(+)/Loss(-) {J} due to mixing and cross mixing and refrigeration door mixing + Real64 MixLatLoad = 0.0; // Latent Gain(+)/Loss(-) {J} due to mixing and cross mixing and refrigeration door mixing Real64 MixHeatLoss = 0.0; // Heat Gain {J} due to mixing and cross mixing and refrigeration door mixing Real64 MixHeatGain = 0.0; // Heat Loss {J} due to mixing and cross mixing and refrigeration door mixing Real64 MixLatentLoss = 0.0; // Latent Gain {J} due to mixing and cross mixing and refrigeration door mixing @@ -2004,6 +2006,10 @@ struct HeatBalanceData : BaseGlobalStruct EPVector spaceTypes; EPVector ExtVentedCavity; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataIPShortCuts.hh b/src/EnergyPlus/DataIPShortCuts.hh index 9ed7b0dcfd5..723c496b1c1 100644 --- a/src/EnergyPlus/DataIPShortCuts.hh +++ b/src/EnergyPlus/DataIPShortCuts.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -67,6 +67,10 @@ struct IPShortCutsData : BaseGlobalStruct Array1D rNumericArgs; std::string cCurrentModuleObject; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataLoopNode.hh b/src/EnergyPlus/DataLoopNode.hh index 6d409b27070..3cdac78d6a7 100644 --- a/src/EnergyPlus/DataLoopNode.hh +++ b/src/EnergyPlus/DataLoopNode.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -57,6 +57,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -463,10 +464,10 @@ namespace DataLoopNode { // Following are for Outdoor Air Nodes Scheduled Properties bool IsLocalNode = false; - int OutAirDryBulbSchedNum = 0; - int OutAirWetBulbSchedNum = 0; - int OutAirWindSpeedSchedNum = 0; - int OutAirWindDirSchedNum = 0; + Sched::Schedule *outAirDryBulbSched = nullptr; + Sched::Schedule *outAirWetBulbSched = nullptr; + Sched::Schedule *outAirWindSpeedSched = nullptr; + Sched::Schedule *outAirWindDirSched = nullptr; // Following are for Outdoor Air Nodes "read only" Real64 OutAirDryBulb = 0.0; // {C} @@ -538,6 +539,10 @@ struct LoopNodeData : BaseGlobalStruct Array1D MarkedNode; Array1D NodeSetpointCheck; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataMoistureBalance.hh b/src/EnergyPlus/DataMoistureBalance.hh index da72293b4fd..a5673c9e754 100644 --- a/src/EnergyPlus/DataMoistureBalance.hh +++ b/src/EnergyPlus/DataMoistureBalance.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -92,6 +92,10 @@ struct MoistureBalanceData : BaseGlobalStruct Array1D HGrndFD; // Ground Convection Coefficient Array1D HAirFD; // Air Convection Coefficient + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataMoistureBalanceEMPD.hh b/src/EnergyPlus/DataMoistureBalanceEMPD.hh index 66411f76f34..6fb4cfdfcc0 100644 --- a/src/EnergyPlus/DataMoistureBalanceEMPD.hh +++ b/src/EnergyPlus/DataMoistureBalanceEMPD.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -76,6 +76,10 @@ struct MoistureBalanceEMPDData : BaseGlobalStruct Array1D RVDeepLayer; Array1D RVwall; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataOutputs.cc b/src/EnergyPlus/DataOutputs.cc index e39e78ac61e..888a69b71d9 100644 --- a/src/EnergyPlus/DataOutputs.cc +++ b/src/EnergyPlus/DataOutputs.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/DataOutputs.hh b/src/EnergyPlus/DataOutputs.hh index 73e9e96f9f4..8fff5ee9dcf 100644 --- a/src/EnergyPlus/DataOutputs.hh +++ b/src/EnergyPlus/DataOutputs.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -112,6 +112,10 @@ struct OutputsData : BaseGlobalStruct Util::case_insensitive_comparator> OutputVariablesForSimulation; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataPhotovoltaics.hh b/src/EnergyPlus/DataPhotovoltaics.hh index df0f72c0488..c49228d9c2d 100644 --- a/src/EnergyPlus/DataPhotovoltaics.hh +++ b/src/EnergyPlus/DataPhotovoltaics.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -102,15 +102,15 @@ namespace DataPhotovoltaics { struct SimplePVParamsStruct { // Members - std::string Name; // name as identified in Sandia database - Real64 AreaCol; // effective area of solar collection - Real64 ActiveFraction; // fraction of parent surface that has active solar cells - Efficiency EfficencyInputMode; // to schedule or not - int EffSchedPtr; // index pointer for efficiency schedule - Real64 PVEfficiency; // fixed or current PV efficiency + std::string Name; // name as identified in Sandia database + Real64 AreaCol; // effective area of solar collection + Real64 ActiveFraction; // fraction of parent surface that has active solar cells + Efficiency EfficencyInputMode; // to schedule or not + Sched::Schedule *effSched = nullptr; // index pointer for efficiency schedule + Real64 PVEfficiency; // fixed or current PV efficiency // Default Constructor - SimplePVParamsStruct() : AreaCol(0.0), ActiveFraction(0.0), EfficencyInputMode(Efficiency::Invalid), EffSchedPtr(0), PVEfficiency(0.0) + SimplePVParamsStruct() : AreaCol(0.0), ActiveFraction(0.0), EfficencyInputMode(Efficiency::Invalid), PVEfficiency(0.0) { } }; @@ -350,6 +350,10 @@ struct PhotovoltaicsData : BaseGlobalStruct Real64 ShuntResistance = 0.0; // old "RSH" in common block of trnsys code Array1D PVarray; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataPrecisionGlobals.hh b/src/EnergyPlus/DataPrecisionGlobals.hh index db28bd6bbdd..0aee1189abe 100644 --- a/src/EnergyPlus/DataPrecisionGlobals.hh +++ b/src/EnergyPlus/DataPrecisionGlobals.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/DataReportingFlags.hh b/src/EnergyPlus/DataReportingFlags.hh index 2b6b0342ab5..f917fea5384 100644 --- a/src/EnergyPlus/DataReportingFlags.hh +++ b/src/EnergyPlus/DataReportingFlags.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -70,6 +70,10 @@ struct ReportFlagData : BaseGlobalStruct bool DebugOutput = false; bool EvenDuringWarmup = false; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataRoomAirModel.hh b/src/EnergyPlus/DataRoomAirModel.hh index 65d9819f34a..3c827427e6b 100644 --- a/src/EnergyPlus/DataRoomAirModel.hh +++ b/src/EnergyPlus/DataRoomAirModel.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -193,14 +193,13 @@ namespace RoomAir { struct DispVentData { // Members - std::string ZoneName = ""; // Name of zone - int ZonePtr = 0; // Pointer to the zone number for this statement - int SchedGainsPtr = -1; // Schedule for internal gain fraction to occupied zone - std::string SchedGainsName = ""; // Gains Schedule name - Real64 NumPlumesPerOcc = 0.0; // Effective number of plumes per occupant - Real64 ThermostatHeight = 0.0; // Height of thermostat/ temperature control sensor - Real64 ComfortHeight = 0.0; // Height at which air temperature is measured for comfort purposes - Real64 TempTrigger = 0.0; // Minimum temperature difference between TOC TMX for stratification + std::string ZoneName = ""; // Name of zone + int ZonePtr = 0; // Pointer to the zone number for this statement + Sched::Schedule *gainsSched = nullptr; // Schedule for internal gain fraction to occupied zone + Real64 NumPlumesPerOcc = 0.0; // Effective number of plumes per occupant + Real64 ThermostatHeight = 0.0; // Height of thermostat/ temperature control sensor + Real64 ComfortHeight = 0.0; // Height at which air temperature is measured for comfort purposes + Real64 TempTrigger = 0.0; // Minimum temperature difference between TOC TMX for stratification }; struct CrossVentData @@ -208,8 +207,7 @@ namespace RoomAir { // Members std::string ZoneName = ""; // Name of zone int ZonePtr = 0; // Pointer to the zone number for this statement - int SchedGainsPtr = 0; // Schedule for internal gain fraction to occupied zone - std::string SchedGainsName = ""; // Gains Schedule name + Sched::Schedule *gainsSched = nullptr; // Schedule for internal gain fraction to occupied zone Comfort VforComfort = Comfort::Invalid; // Use Recirculation or Jet velocity and temperatures // for comfort models }; @@ -341,14 +339,12 @@ namespace RoomAir { { // Members // user variables - bool IsUsed = false; // .TRUE. if user-defined patterns used in zone - std::string Name = ""; // Name - std::string ZoneName = ""; // Zone name in building - int ZoneID = 0; // Index of Zone in Heat Balance - std::string AvailSched = ""; // Name of availability schedule - int AvailSchedID = 0; // index of availability schedule - std::string PatternCntrlSched = ""; // name of schedule that selects pattern - int PatternSchedID = 0; // index of pattern selecting schedule + bool IsUsed = false; // .TRUE. if user-defined patterns used in zone + std::string Name = ""; // Name + std::string ZoneName = ""; // Zone name in building + int ZoneID = 0; // Index of Zone in Heat Balance + Sched::Schedule *availSched = nullptr; // availability schedule + Sched::Schedule *patternSched = nullptr; // pattern selecting schedule // calculated and from elsewhere Real64 ZoneHeight = 0.0; // in meters, from Zone%CeilingHeight int ZoneNodeID = 0; // index in Node array for this zone @@ -477,23 +473,22 @@ namespace RoomAir { { // Members // user variables - bool IsUsed = false; // true. if RoomAirflowNetwork model used in zone - std::string Name = ""; // Name - std::string ZoneName = ""; // Zone name in building - int ZoneID = 0; // Index of Zone in Heat Balance - int ActualZoneID = 0; // Index of controlled zones in ZoneCOnfigure - std::string AvailSched = ""; // Name of availability schedule - int AvailSchedID = 0; // index of availability schedule - int ControlAirNodeID = 0; // index of roomair node that is HVAC control sensor location - int NumOfAirNodes = 0; // Number of air nodes - Array1D Node; // Node struct - int ZoneNodeID = 0; // index in system Node array for this zone - Real64 TairMean = 0.0; // comes from MAT - Real64 Tstat = 0.0; // temperature for thermostat - Real64 Tleaving = 0.0; // temperature for return air node - Real64 Texhaust = 0.0; // temperature for exhaust air node - int totNumSurfs = 0; // total surfs for this zone - int firstSurfID = 0; // Index of first surface + bool IsUsed = false; // true. if RoomAirflowNetwork model used in zone + std::string Name = ""; // Name + std::string ZoneName = ""; // Zone name in building + int ZoneID = 0; // Index of Zone in Heat Balance + int ActualZoneID = 0; // Index of controlled zones in ZoneCOnfigure + Sched::Schedule *availSched = nullptr; // index of availability schedule + int ControlAirNodeID = 0; // index of roomair node that is HVAC control sensor location + int NumOfAirNodes = 0; // Number of air nodes + Array1D Node; // Node struct + int ZoneNodeID = 0; // index in system Node array for this zone + Real64 TairMean = 0.0; // comes from MAT + Real64 Tstat = 0.0; // temperature for thermostat + Real64 Tleaving = 0.0; // temperature for return air node + Real64 Texhaust = 0.0; // temperature for exhaust air node + int totNumSurfs = 0; // total surfs for this zone + int firstSurfID = 0; // Index of first surface }; struct BegEnd @@ -650,6 +645,10 @@ struct RoomAirModelData : BaseGlobalStruct EPVector AirPatternZoneInfo; // added zone information for user defined patterns EPVector AFNZoneInfo; // added zone info + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataRootFinder.hh b/src/EnergyPlus/DataRootFinder.hh index f7561089ef3..ca890c597cf 100644 --- a/src/EnergyPlus/DataRootFinder.hh +++ b/src/EnergyPlus/DataRootFinder.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/DataRuntimeLanguage.cc b/src/EnergyPlus/DataRuntimeLanguage.cc index ed1c56e3da1..5007bb667d9 100644 --- a/src/EnergyPlus/DataRuntimeLanguage.cc +++ b/src/EnergyPlus/DataRuntimeLanguage.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/DataRuntimeLanguage.hh b/src/EnergyPlus/DataRuntimeLanguage.hh index 85a0424dad6..b3173563252 100644 --- a/src/EnergyPlus/DataRuntimeLanguage.hh +++ b/src/EnergyPlus/DataRuntimeLanguage.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -62,6 +62,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -247,13 +248,13 @@ namespace DataRuntimeLanguage { std::string OutputVarName; // name of output variable bool CheckedOkay; // set to true once checked out okay OutputProcessor::VariableType VariableType; - int Index; // ref index in output processor, points to variable - int VariableNum; // ref to global variable in runtime language - int SchedNum; // ref index ptr to schedule service (filled if Schedule Value) + int Index; // ref index in output processor, points to variable + int VariableNum; // ref to global variable in runtime language + Sched::Schedule *sched = nullptr; // ref index ptr to schedule service (filled if Schedule Value) // INTEGER :: VarType = 0 // Default Constructor - OutputVarSensorType() : CheckedOkay(false), VariableType(OutputProcessor::VariableType::Invalid), Index(0), VariableNum(0), SchedNum(0) + OutputVarSensorType() : CheckedOkay(false), VariableType(OutputProcessor::VariableType::Invalid), Index(0), VariableNum(0) { } }; @@ -805,9 +806,11 @@ struct RuntimeLanguageData : BaseGlobalStruct DataRuntimeLanguage::ErlValueType True = DataRuntimeLanguage::ErlValueType( DataRuntimeLanguage::Value::Null, 0.0, "", 0, 0, false, 0, "", true); // special "True" Erl variable value instance, gets reset - // EMS Actuator fast duplicate check lookup support - std::unordered_set, DataRuntimeLanguage::EMSActuatorKey_hash> - EMSActuator_lookup; // Fast duplicate lookup structure + std::map, int> EMSActuatorAvailableMap; + + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } void init_state([[maybe_unused]] EnergyPlusData &state) override { @@ -860,10 +863,11 @@ struct RuntimeLanguageData : BaseGlobalStruct this->EMSInternalVarsAvailable.deallocate(); this->EMSInternalVarsUsed.deallocate(); this->EMSProgramCallManager.deallocate(); - this->EMSActuator_lookup.clear(); this->Null = DataRuntimeLanguage::ErlValueType(DataRuntimeLanguage::Value::Null, 0.0, "", 0, 0, false, 0, "", true); this->False = DataRuntimeLanguage::ErlValueType(DataRuntimeLanguage::Value::Null, 0.0, "", 0, 0, false, 0, "", true); this->True = DataRuntimeLanguage::ErlValueType(DataRuntimeLanguage::Value::Null, 0.0, "", 0, 0, false, 0, "", true); + + this->EMSActuatorAvailableMap.clear(); } }; diff --git a/src/EnergyPlus/DataShadowingCombinations.hh b/src/EnergyPlus/DataShadowingCombinations.hh index 561db8470d5..2d8e07655ed 100644 --- a/src/EnergyPlus/DataShadowingCombinations.hh +++ b/src/EnergyPlus/DataShadowingCombinations.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -83,6 +83,10 @@ struct ShadowCombData : BaseGlobalStruct Array1D ShadowComb; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataSizing.cc b/src/EnergyPlus/DataSizing.cc index a2c5ad1718d..54ca2c21553 100644 --- a/src/EnergyPlus/DataSizing.cc +++ b/src/EnergyPlus/DataSizing.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -602,9 +602,9 @@ Real64 ZoneAirDistributionData::calculateEz(EnergyPlusData &state, int const Zon // Calc the zone supplied OA flow rate counting the zone air distribution effectiveness // First check whether the zone air distribution effectiveness schedule exists, if yes uses it; // otherwise uses the inputs of zone distribution effectiveness in cooling mode or heating mode - if (this->ZoneADEffSchPtr > 0) { + if (this->zoneADEffSched != nullptr) { // Get schedule value for the zone air distribution effectiveness - zoneEz = ScheduleManager::GetCurrentScheduleValue(state, this->ZoneADEffSchPtr); + zoneEz = this->zoneADEffSched->getCurrentVal(); } else { Real64 zoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).TotalOutputRequired; @@ -774,7 +774,7 @@ Real64 OARequirementsData::calcOAFlowRate(EnergyPlusData &state, Real64 curNumOccupants = 0.0; Real64 maxOccupants = 0.0; if (spaceNum > 0) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); + auto const &thisSpace = state.dataHeatBal->space(spaceNum); floorArea = thisSpace.FloorArea; volume = thisSpace.Volume; nomTotOccupants = thisSpace.TotOccupants; @@ -909,23 +909,23 @@ Real64 OARequirementsData::calcOAFlowRate(EnergyPlusData &state, if (state.dataHeatBal->People(PeopleNum).ZonePtr != ActualZoneNum) continue; } CO2PeopleGeneration += state.dataHeatBal->People(PeopleNum).NumberOfPeople * state.dataHeatBal->People(PeopleNum).CO2RateFactor * - ScheduleManager::GetCurrentScheduleValue(state, state.dataHeatBal->People(PeopleNum).ActivityLevelPtr); + state.dataHeatBal->People(PeopleNum).activityLevelSched->getCurrentVal(); } } } ZoneOAArea = floorArea * thisZone.Multiplier * thisZone.ListMultiplier * this->OAFlowPerArea; ZoneOAMin = ZoneOAArea; ZoneOAMax = (ZoneOAArea + ZoneOAPeople); - if (thisZone.ZoneContamControllerSchedIndex > 0.0) { + if (thisZone.zoneContamControllerSched != nullptr) { // Check the availability schedule value for ZoneControl:ContaminantController - ZoneContamControllerSched = ScheduleManager::GetCurrentScheduleValue(state, thisZone.ZoneContamControllerSchedIndex); + ZoneContamControllerSched = thisZone.zoneContamControllerSched->getCurrentVal(); if (ZoneContamControllerSched > 0.0) { if (ZoneOAPeople > 0.0) { if (state.dataContaminantBalance->ZoneCO2GainFromPeople(ActualZoneNum) > 0.0) { - if (thisZone.ZoneMinCO2SchedIndex > 0.0) { + if (thisZone.zoneMinCO2Sched != nullptr) { // Take the schedule value of "Minimum Carbon Dioxide Concentration Schedule Name" // in the ZoneControl:ContaminantController - ZoneMinCO2 = ScheduleManager::GetCurrentScheduleValue(state, thisZone.ZoneMinCO2SchedIndex); + ZoneMinCO2 = thisZone.zoneMinCO2Sched->getCurrentVal(); } else { ZoneMinCO2 = state.dataContaminantBalance->OutdoorCO2; } @@ -1083,11 +1083,11 @@ Real64 OARequirementsData::calcOAFlowRate(EnergyPlusData &state, OAVolumeFlowRate *= thisZone.Multiplier * thisZone.ListMultiplier; // Apply schedule as needed. Sizing does not use schedule. - if (this->OAFlowFracSchPtr > 0 && UseMinOASchFlag) { + if (this->oaFlowFracSched != nullptr && UseMinOASchFlag) { if (MaxOAVolFlowFlag) { - OAVolumeFlowRate *= ScheduleManager::GetScheduleMaxValue(state, this->OAFlowFracSchPtr); + OAVolumeFlowRate *= this->oaFlowFracSched->getMaxVal(state); } else { - OAVolumeFlowRate *= ScheduleManager::GetCurrentScheduleValue(state, this->OAFlowFracSchPtr); + OAVolumeFlowRate *= this->oaFlowFracSched->getCurrentVal(); } } diff --git a/src/EnergyPlus/DataSizing.hh b/src/EnergyPlus/DataSizing.hh index 901ce5156f4..e790320ffac 100644 --- a/src/EnergyPlus/DataSizing.hh +++ b/src/EnergyPlus/DataSizing.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -363,8 +363,8 @@ namespace DataSizing { Real64 HeatDesHumRatDiff = 0.005; // zone design heating supply air humidity ratio temperature difference [deltakgw/kga] int ZnLatCoolDgnSAMethod = 0; // choice of how to get zone latent cooling design air humidity ratio; int ZnLatHeatDgnSAMethod = 0; // choice of how to get zone latent heating design air humidity ratio; - int zoneRHDehumidifySchIndex = 0; // index to zone RH dehumidifying schedule used for zone sizing - int zoneRHHumidifySchIndex = 0; // index to zone RH humidifying schedule used for zone sizing + Sched::Schedule *zoneRHDehumidifySched = nullptr; // zone RH dehumidifying schedule used for zone sizing + Sched::Schedule *zoneRHHumidifySched = nullptr; // zone RH humidifying schedule used for zone sizing ZoneSizing zoneSizingMethod = ZoneSizing::Invalid; // load to sizing on: sensible, latent, sensibleandlatent, sensibleonlynolatent }; @@ -609,9 +609,9 @@ namespace DataSizing { Array1D LatentHeatFlowSeq; // daily sequence of zone latent heating supply mass flow rate (zone time step) [Kg/s] bool zoneLatentSizing = false; // trigger to do RH control during zone sizing Real64 zoneRHDehumidifySetPoint = 50.0; // RH dehumidifying set point used during sizing, default to 50% - int zoneRHDehumidifySchIndex = 0; // index to zone RH dehumidifying schedule used for zone sizing + Sched::Schedule *zoneRHDehumidifySched = nullptr; // zone RH dehumidifying schedule used for zone sizing Real64 zoneRHHumidifySetPoint = 50.0; // RH humidifying set point used during sizing, default to 50% - int zoneRHHumidifySchIndex = 0; // index to zone RH humidifying schedule used for zone sizing + Sched::Schedule *zoneRHHumidifySched = nullptr; // zone RH humidifying schedule used for zone sizing Real64 LatentCoolDesHumRat = 0.0; // zone design dehumidification supply air humidity ratio [kgw/kga] Real64 CoolDesHumRatDiff = 0.005; // zone design cooling supply air humidity ratio difference [deltakgw/kga] Real64 LatentHeatDesHumRat = 0.0; // zone design humidification supply air humidity ratio [kgw/kga] @@ -1115,18 +1115,17 @@ namespace DataSizing { EPVector dsoaSpaceNames; // Names of spaces if this is a (if this is a DSOA:SpaceList object) EPVector dsoaSpaceIndexes; // Indexes to Spaces (if this is a DSOA:SpaceList object) OAFlowCalcMethod OAFlowMethod = - OAFlowCalcMethod::PerPerson; // - Method for OA flow calculation (Flow/Person, Flow/Zone, Flow/Area, FlowACH, Sum, Maximum) - Real64 OAFlowPerPerson = 0.0; // - OA requirement per person - Real64 OAFlowPerArea = 0.0; // - OA requirement per zone area - Real64 OAFlowPerZone = 0.0; // - OA requirement per zone - Real64 OAFlowACH = 0.0; // - OA requirement per zone per hour - int OAFlowFracSchPtr = ScheduleManager::ScheduleAlwaysOn; // - Fraction schedule applied to total OA requirement - int OAPropCtlMinRateSchPtr = - ScheduleManager::ScheduleAlwaysOn; // - Fraction schedule applied to Proportional Control Minimum Outdoor Air Flow Rate - int CO2MaxMinLimitErrorCount = 0; // Counter when max CO2 concentration < min CO2 concentration for SOAM_ProportionalControlSchOcc - int CO2MaxMinLimitErrorIndex = 0; // Index for max CO2 concentration < min CO2 concentration recurring error message for - // SOAM_ProportionalControlSchOcc - int CO2GainErrorCount = 0; // Counter when CO2 generation from people is zero for SOAM_ProportionalControlSchOcc + OAFlowCalcMethod::PerPerson; // - Method for OA flow calculation (Flow/Person, Flow/Zone, Flow/Area, FlowACH, Sum, Maximum) + Real64 OAFlowPerPerson = 0.0; // - OA requirement per person + Real64 OAFlowPerArea = 0.0; // - OA requirement per zone area + Real64 OAFlowPerZone = 0.0; // - OA requirement per zone + Real64 OAFlowACH = 0.0; // - OA requirement per zone per hour + Sched::Schedule *oaFlowFracSched = nullptr; // - Fraction schedule applied to total OA requirement + Sched::Schedule *oaPropCtlMinRateSched = nullptr; // - Fraction schedule applied to Proportional Control Minimum Outdoor Air Flow Rate + int CO2MaxMinLimitErrorCount = 0; // Counter when max CO2 concentration < min CO2 concentration for SOAM_ProportionalControlSchOcc + int CO2MaxMinLimitErrorIndex = 0; // Index for max CO2 concentration < min CO2 concentration recurring error message for + // SOAM_ProportionalControlSchOcc + int CO2GainErrorCount = 0; // Counter when CO2 generation from people is zero for SOAM_ProportionalControlSchOcc int CO2GainErrorIndex = 0; // Index for recurring error message when CO2 generation from people is zero for SOAM_ProportionalControlSchOcc bool myEnvrnFlag = true; @@ -1148,16 +1147,15 @@ namespace DataSizing { { // Members std::string Name; - std::string ZoneADEffSchName; // - Zone air distribution effectiveness schedule name - Real64 ZoneADEffCooling; // - Zone air distribution effectiveness in cooling mode - Real64 ZoneADEffHeating; // - Zone air distribution effectiveness in heating mode - Real64 ZoneSecondaryRecirculation; // - Zone air secondary recirculation ratio - int ZoneADEffSchPtr; // - Zone air distribution effectiveness schedule index - Real64 ZoneVentilationEff; // Zone ventilation effectiveness + std::string ZoneADEffSchName; // - Zone air distribution effectiveness schedule name + Real64 ZoneADEffCooling; // - Zone air distribution effectiveness in cooling mode + Real64 ZoneADEffHeating; // - Zone air distribution effectiveness in heating mode + Real64 ZoneSecondaryRecirculation; // - Zone air secondary recirculation ratio + Sched::Schedule *zoneADEffSched = nullptr; // - Zone air distribution effectiveness schedule index + Real64 ZoneVentilationEff; // Zone ventilation effectiveness // Default Constructor - ZoneAirDistributionData() - : ZoneADEffCooling(1.0), ZoneADEffHeating(1.0), ZoneSecondaryRecirculation(0.0), ZoneADEffSchPtr(0), ZoneVentilationEff(0.0) + ZoneAirDistributionData() : ZoneADEffCooling(1.0), ZoneADEffHeating(1.0), ZoneSecondaryRecirculation(0.0), ZoneVentilationEff(0.0) { } @@ -1371,6 +1369,10 @@ struct SizingData : BaseGlobalStruct Array1D FaByZoneCool; // triggers allocation in UpdateSysSizing Array1D SensCoolCapTemp; // triggers allocation in UpdateSysSizing + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataStringGlobals.hh b/src/EnergyPlus/DataStringGlobals.hh index a68e147b905..7f2b87404fe 100644 --- a/src/EnergyPlus/DataStringGlobals.hh +++ b/src/EnergyPlus/DataStringGlobals.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -76,7 +76,7 @@ namespace DataStringGlobals { char constexpr pathChar('/'); char constexpr altpathChar('\\'); #else -#error "Invalid platform detection in DataStringGlobals." +# error "Invalid platform detection in DataStringGlobals." #endif char constexpr CharComma(','); // comma char constexpr CharSemicolon(';'); // semicolon @@ -129,6 +129,10 @@ struct DataStringGlobalsData : BaseGlobalStruct std::string CurrentDateTime; // For printing current date and time at start of run std::string VerStringVar; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataStringGlobals.in.cc b/src/EnergyPlus/DataStringGlobals.in.cc index 9a0fba0684e..581482399ad 100644 --- a/src/EnergyPlus/DataStringGlobals.in.cc +++ b/src/EnergyPlus/DataStringGlobals.in.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/DataSurfaceColors.cc b/src/EnergyPlus/DataSurfaceColors.cc index 922911dc967..508c177d893 100644 --- a/src/EnergyPlus/DataSurfaceColors.cc +++ b/src/EnergyPlus/DataSurfaceColors.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/DataSurfaceColors.hh b/src/EnergyPlus/DataSurfaceColors.hh index 51a631c0bf5..41fb37c4764 100644 --- a/src/EnergyPlus/DataSurfaceColors.hh +++ b/src/EnergyPlus/DataSurfaceColors.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -99,6 +99,10 @@ struct SurfaceColorData : BaseGlobalStruct { std::array DXFcolorno = DataSurfaceColors::defaultcolorno; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataSurfaceLists.cc b/src/EnergyPlus/DataSurfaceLists.cc index 142d1ac06d4..717975d37bc 100644 --- a/src/EnergyPlus/DataSurfaceLists.cc +++ b/src/EnergyPlus/DataSurfaceLists.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/DataSurfaceLists.hh b/src/EnergyPlus/DataSurfaceLists.hh index dcbfc916878..c6af94e6150 100644 --- a/src/EnergyPlus/DataSurfaceLists.hh +++ b/src/EnergyPlus/DataSurfaceLists.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -117,6 +117,10 @@ struct SurfaceListsData : BaseGlobalStruct Array1D SurfList; Array1D SlabList; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataSurfaces.cc b/src/EnergyPlus/DataSurfaces.cc index 77d09bf2bd7..eb6371a8493 100644 --- a/src/EnergyPlus/DataSurfaces.cc +++ b/src/EnergyPlus/DataSurfaces.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -514,6 +514,8 @@ Real64 SurfaceData::get_average_height(EnergyPlusData &state) const void SurfaceData::make_hash_key(EnergyPlusData &state, const int SurfNum) { + auto &s_surf = state.dataSurface; + calcHashKey = SurfaceCalcHashKey(); calcHashKey.Construction = Construction; calcHashKey.Azimuth = round(Azimuth * 10.0) / 10.0; @@ -521,12 +523,12 @@ void SurfaceData::make_hash_key(EnergyPlusData &state, const int SurfNum) calcHashKey.Height = round(Height * 10.0) / 10.0; calcHashKey.Zone = Zone; calcHashKey.EnclIndex = SolarEnclIndex; - calcHashKey.TAirRef = state.dataSurface->SurfTAirRef(SurfNum); + calcHashKey.TAirRef = s_surf->SurfTAirRef(SurfNum); - int extBoundCond = state.dataSurface->Surface(SurfNum).ExtBoundCond; + int extBoundCond = s_surf->Surface(SurfNum).ExtBoundCond; if (extBoundCond > 0) { - calcHashKey.ExtZone = state.dataSurface->Surface(extBoundCond).Zone; - calcHashKey.ExtEnclIndex = state.dataSurface->Surface(extBoundCond).SolarEnclIndex; + calcHashKey.ExtZone = s_surf->Surface(extBoundCond).Zone; + calcHashKey.ExtEnclIndex = s_surf->Surface(extBoundCond).SolarEnclIndex; calcHashKey.ExtCond = 1; } else { calcHashKey.ExtZone = 0; @@ -540,26 +542,28 @@ void SurfaceData::make_hash_key(EnergyPlusData &state, const int SurfNum) calcHashKey.ViewFactorSky = round(ViewFactorSky * 10.0) / 10.0; calcHashKey.HeatTransferAlgorithm = HeatTransferAlgorithm; - calcHashKey.intConvModel = state.dataSurface->surfIntConv(SurfNum).model; - calcHashKey.extConvModel = state.dataSurface->surfExtConv(SurfNum).model; - calcHashKey.intConvUserModelNum = state.dataSurface->surfIntConv(SurfNum).userModelNum; - calcHashKey.extConvUserModelNum = state.dataSurface->surfExtConv(SurfNum).userModelNum; + calcHashKey.intConvModel = s_surf->surfIntConv(SurfNum).model; + calcHashKey.extConvModel = s_surf->surfExtConv(SurfNum).model; + calcHashKey.intConvUserModelNum = s_surf->surfIntConv(SurfNum).userModelNum; + calcHashKey.extConvUserModelNum = s_surf->surfExtConv(SurfNum).userModelNum; calcHashKey.OSCPtr = OSCPtr; calcHashKey.OSCMPtr = OSCMPtr; calcHashKey.FrameDivider = FrameDivider; - calcHashKey.SurfWinStormWinConstr = state.dataSurface->SurfWinStormWinConstr(SurfNum); - - calcHashKey.MaterialMovInsulExt = state.dataSurface->SurfMaterialMovInsulExt(SurfNum); - calcHashKey.MaterialMovInsulInt = state.dataSurface->SurfMaterialMovInsulInt(SurfNum); - calcHashKey.SchedMovInsulExt = state.dataSurface->SurfSchedMovInsulExt(SurfNum); - calcHashKey.SchedMovInsulInt = state.dataSurface->SurfSchedMovInsulInt(SurfNum); - calcHashKey.ExternalShadingSchInd = state.dataSurface->Surface(SurfNum).SurfExternalShadingSchInd; - calcHashKey.SurroundingSurfacesNum = state.dataSurface->Surface(SurfNum).SurfSurroundingSurfacesNum; - calcHashKey.LinkedOutAirNode = state.dataSurface->Surface(SurfNum).SurfLinkedOutAirNode; - calcHashKey.OutsideHeatSourceTermSchedule = OutsideHeatSourceTermSchedule; - calcHashKey.InsideHeatSourceTermSchedule = InsideHeatSourceTermSchedule; - calcHashKey.ViewFactorSrdSurfs = state.dataSurface->Surface(SurfNum).ViewFactorSrdSurfs; + calcHashKey.SurfWinStormWinConstr = s_surf->SurfWinStormWinConstr(SurfNum); + + calcHashKey.MaterialMovInsulExt = s_surf->extMovInsuls(SurfNum).matNum; + calcHashKey.MaterialMovInsulInt = s_surf->intMovInsuls(SurfNum).matNum; + calcHashKey.movInsulExtSchedNum = (s_surf->extMovInsuls(SurfNum).sched == nullptr) ? -1 : s_surf->extMovInsuls(SurfNum).sched->Num; + calcHashKey.movInsulIntSchedNum = (s_surf->intMovInsuls(SurfNum).sched == nullptr) ? -1 : s_surf->intMovInsuls(SurfNum).sched->Num; + + calcHashKey.externalShadingSchedNum = + (s_surf->Surface(SurfNum).surfExternalShadingSched != nullptr) ? s_surf->Surface(SurfNum).surfExternalShadingSched->Num : -1; + calcHashKey.SurroundingSurfacesNum = s_surf->Surface(SurfNum).SurfSurroundingSurfacesNum; + calcHashKey.LinkedOutAirNode = s_surf->Surface(SurfNum).SurfLinkedOutAirNode; + calcHashKey.outsideHeatSourceTermSchedNum = (outsideHeatSourceTermSched != nullptr) ? outsideHeatSourceTermSched->Num : -1; + calcHashKey.insideHeatSourceTermSchedNum = (insideHeatSourceTermSched != nullptr) ? insideHeatSourceTermSched->Num : -1; + calcHashKey.ViewFactorSrdSurfs = s_surf->Surface(SurfNum).ViewFactorSrdSurfs; } void SurfaceData::set_representative_surface(EnergyPlusData &state, const int SurfNum) diff --git a/src/EnergyPlus/DataSurfaces.hh b/src/EnergyPlus/DataSurfaces.hh index c1c96b5beb2..ee59d5261ce 100644 --- a/src/EnergyPlus/DataSurfaces.hh +++ b/src/EnergyPlus/DataSurfaces.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -56,7 +56,9 @@ // ObjexxFCL Headers #include #include -#include +#include + +using ObjexxFCL::Vector4; // EnergyPlus Headers #include @@ -67,6 +69,7 @@ #include #include #include +#include #include namespace EnergyPlus { @@ -80,9 +83,6 @@ namespace DataSurfaces { using DataBSDFWindow::BSDFWindowDescript; using DataVectorTypes::Vector; - // MODULE PARAMETER DEFINITIONS: - constexpr int MaxPolyCoeff(6); - // Not sure this is the right module for this stuff, may move it later enum class Compass4 { @@ -587,15 +587,15 @@ namespace DataSurfaces { // Other special boundary conditions // SolarIncidentInside // Not supported - int MaterialMovInsulExt = 0; // Pointer to the material used for exterior movable insulation - int MaterialMovInsulInt = 0; // Pointer to the material used for interior movable insulation - int SchedMovInsulExt = 0; // Schedule for exterior movable insulation - int SchedMovInsulInt = 0; // Schedule for interior movable insulation - int ExternalShadingSchInd = 0; // Schedule for a the external shading - int SurroundingSurfacesNum = 0; // Index of a surrounding surfaces list (defined in SurfaceProperties::SurroundingSurfaces) - int LinkedOutAirNode = 0; // Index of the an OutdoorAir:Node - int OutsideHeatSourceTermSchedule = 0; // Pointer to the schedule of additional source of heat flux rate applied to the outside surface - int InsideHeatSourceTermSchedule = 0; // Pointer to the schedule of additional source of heat flux rate applied to the inside surface + int MaterialMovInsulExt = 0; // Pointer to the material used for exterior movable insulation + int MaterialMovInsulInt = 0; // Pointer to the material used for interior movable insulation + int movInsulExtSchedNum = Sched::SchedNum_Invalid; // Schedule for exterior movable insulation + int movInsulIntSchedNum = Sched::SchedNum_Invalid; // Schedule for interior movable insulation + int externalShadingSchedNum = Sched::SchedNum_Invalid; // Schedule for a the external shading + int SurroundingSurfacesNum = 0; // Index of a surrounding surfaces list (defined in SurfaceProperties::SurroundingSurfaces) + int LinkedOutAirNode = 0; // Index of the an OutdoorAir:Node + int outsideHeatSourceTermSchedNum = Sched::SchedNum_Invalid; // schedule of additional source of heat flux rate applied to the outside surface + int insideHeatSourceTermSchedNum = Sched::SchedNum_Invalid; // schedule of additional source of heat flux rate applied to the inside surface // based on boost::hash_combine std::size_t hash_combine(std::size_t current_hash, std::size_t new_hash) const @@ -636,13 +636,13 @@ namespace DataSurfaces { hash()(MaterialMovInsulExt), hash()(MaterialMovInsulInt), - hash()(SchedMovInsulExt), - hash()(SchedMovInsulInt), - hash()(ExternalShadingSchInd), + hash()(movInsulExtSchedNum), + hash()(movInsulIntSchedNum), + hash()(externalShadingSchedNum), hash()(SurroundingSurfacesNum), hash()(LinkedOutAirNode), - hash()(OutsideHeatSourceTermSchedule), - hash()(InsideHeatSourceTermSchedule)}; + hash()(outsideHeatSourceTermSchedNum), + hash()(insideHeatSourceTermSchedNum)}; } std::size_t get_hash() const @@ -669,10 +669,10 @@ namespace DataSurfaces { FrameDivider == other.FrameDivider && SurfWinStormWinConstr == other.SurfWinStormWinConstr && MaterialMovInsulExt == other.MaterialMovInsulExt && MaterialMovInsulInt == other.MaterialMovInsulInt && - SchedMovInsulExt == other.SchedMovInsulExt && SchedMovInsulInt == other.SchedMovInsulInt && - ExternalShadingSchInd == other.ExternalShadingSchInd && SurroundingSurfacesNum == other.SurroundingSurfacesNum && - LinkedOutAirNode == other.LinkedOutAirNode && OutsideHeatSourceTermSchedule == other.OutsideHeatSourceTermSchedule && - InsideHeatSourceTermSchedule == other.InsideHeatSourceTermSchedule); + movInsulExtSchedNum == other.movInsulExtSchedNum && movInsulIntSchedNum == other.movInsulIntSchedNum && + externalShadingSchedNum == other.externalShadingSchedNum && SurroundingSurfacesNum == other.SurroundingSurfacesNum && + LinkedOutAirNode == other.LinkedOutAirNode && outsideHeatSourceTermSchedNum == other.outsideHeatSourceTermSchedNum && + insideHeatSourceTermSchedNum == other.insideHeatSourceTermSchedNum); } }; @@ -748,12 +748,12 @@ namespace DataSurfaces { Real64 YShift; // relative coordinate shift data - used by child subsurfaces // Boundary conditions and interconnections - bool HeatTransSurf; // True if surface is a heat transfer surface (light shelf can also be IsShadowing) - int OutsideHeatSourceTermSchedule; // Pointer to the schedule of additional source of heat flux rate applied to the outside surface - int InsideHeatSourceTermSchedule; // Pointer to the schedule of additional source of heat flux rate applied to the inside surface - // False if a (detached) shadowing (sub)surface - HeatTransferModel HeatTransferAlgorithm; // used for surface-specific heat transfer algorithm. - std::string BaseSurfName; // Name of BaseSurf + bool HeatTransSurf; // True if surface is a heat transfer surface (light shelf can also be IsShadowing) + Sched::Schedule *outsideHeatSourceTermSched = nullptr; // Schedule of additional source of heat flux rate applied to the outside surface + Sched::Schedule *insideHeatSourceTermSched = nullptr; // Schedule of additional source of heat flux rate applied to the inside surface + // False if a (detached) shadowing (sub)surface + HeatTransferModel HeatTransferAlgorithm; // used for surface-specific heat transfer algorithm. + std::string BaseSurfName; // Name of BaseSurf int BaseSurf; // "Base surface" for this surface. Applies mainly to subsurfaces in which case it points back to the base surface number. // Equals 0 for detached shading. BaseSurf equals surface number for all other surfaces. int NumSubSurfaces; // Number of subsurfaces this surface has (doors/windows) @@ -786,9 +786,9 @@ namespace DataSurfaces { bool IsShadowPossibleObstruction; // True if a surface can be an exterior obstruction // Optional parameters specific to shadowing surfaces and subsurfaces (detached shading, overhangs, wings, etc.) - int SchedShadowSurfIndex; // Schedule for a shadowing (sub)surface - bool IsTransparent; // True if the schedule values are always 1.0 (or the minimum is 1.0) - Real64 SchedMinValue; // Schedule minimum value. + Sched::Schedule *shadowSurfSched = nullptr; // Schedule for a shadowing (sub)surface + bool IsTransparent; // True if the schedule values are always 1.0 (or the minimum is 1.0) + Real64 SchedMinValue; // Schedule minimum value. // Window Parameters (when surface is Window) int activeWindowShadingControl; // Active window shading control (windows only) @@ -820,12 +820,12 @@ namespace DataSurfaces { bool SurfHasSurroundingSurfProperty; // true if surrounding surfaces properties are listed for an external surface bool SurfSchedExternalShadingFrac; // true if the external shading is scheduled or calculated externally to be imported int SurfSurroundingSurfacesNum; // Index of a surrounding surfaces list (defined in SurfaceProperties::SurroundingSurfaces) - int SurfExternalShadingSchInd; // Schedule for a the external shading - int SurfLinkedOutAirNode; // Index of the an OutdoorAir:Node, zero if none - Real64 AE = 0.0; // Product of area and emissivity for each surface - Real64 enclAESum = 0.0; // Sum of area times emissivity for all other surfaces in enclosure - Real64 SrdSurfTemp; // surrounding surfaces average temperature seen by an exterior surface (C) - Real64 ViewFactorSrdSurfs; // surrounding surfaces view factor sum seen by an exterior surface(-) + Sched::Schedule *surfExternalShadingSched = nullptr; // Schedule for a the external shading + int SurfLinkedOutAirNode; // Index of the an OutdoorAir:Node, zero if none + Real64 AE = 0.0; // Product of area and emissivity for each surface + Real64 enclAESum = 0.0; // Sum of area times emissivity for all other surfaces in enclosure + Real64 SrdSurfTemp; // surrounding surfaces average temperature seen by an exterior surface (C) + Real64 ViewFactorSrdSurfs; // surrounding surfaces view factor sum seen by an exterior surface(-) // Default Constructor SurfaceData() @@ -834,16 +834,14 @@ namespace DataSurfaces { Width(0.0), shapeCat(ShapeCat::Invalid), plane(0.0, 0.0, 0.0, 0.0), Centroid(0.0, 0.0, 0.0), lcsx(0.0, 0.0, 0.0), lcsy(0.0, 0.0, 0.0), lcsz(0.0, 0.0, 0.0), NewellAreaVector(0.0, 0.0, 0.0), NewellSurfaceNormalVector(0.0, 0.0, 0.0), OutNormVec(0.0, 0.0, 0.0), SinAzim(0.0), CosAzim(0.0), SinTilt(0.0), CosTilt(0.0), IsConvex(true), IsDegenerate(false), VerticesProcessed(false), XShift(0.0), YShift(0.0), - HeatTransSurf(false), OutsideHeatSourceTermSchedule(0), InsideHeatSourceTermSchedule(0), - HeatTransferAlgorithm(HeatTransferModel::Invalid), BaseSurf(0), NumSubSurfaces(0), Zone(0), spaceNum(0), ExtBoundCond(0), - ExtSolar(false), ExtWind(false), hasIncSolMultiplier(false), IncSolMultiplier(1.0), ViewFactorGround(0.0), ViewFactorSky(0.0), - ViewFactorGroundIR(0.0), ViewFactorSkyIR(0.0), OSCPtr(0), OSCMPtr(0), MirroredSurf(false), IsShadowing(false), - IsShadowPossibleObstruction(false), SchedShadowSurfIndex(0), IsTransparent(false), SchedMinValue(0.0), activeWindowShadingControl(0), - HasShadeControl(false), activeShadedConstruction(0), activeShadedConstructionPrev(0), FrameDivider(0), Multiplier(1.0), - SolarEnclIndex(0), SolarEnclSurfIndex(0), IsAirBoundarySurf(false), IsSurfPropertyGndSurfacesDefined(false), - SurfPropertyGndSurfIndex(0), UseSurfPropertyGndSurfTemp(false), UseSurfPropertyGndSurfRefl(false), GndReflSolarRad(0.0), - SurfHasSurroundingSurfProperty(false), SurfSchedExternalShadingFrac(false), SurfSurroundingSurfacesNum(0), SurfExternalShadingSchInd(0), - SurfLinkedOutAirNode(0), SrdSurfTemp(0.0), ViewFactorSrdSurfs(0.0) + HeatTransSurf(false), HeatTransferAlgorithm(HeatTransferModel::Invalid), BaseSurf(0), NumSubSurfaces(0), Zone(0), spaceNum(0), + ExtBoundCond(0), ExtSolar(false), ExtWind(false), hasIncSolMultiplier(false), IncSolMultiplier(1.0), ViewFactorGround(0.0), + ViewFactorSky(0.0), ViewFactorGroundIR(0.0), ViewFactorSkyIR(0.0), OSCPtr(0), OSCMPtr(0), MirroredSurf(false), IsShadowing(false), + IsShadowPossibleObstruction(false), IsTransparent(false), SchedMinValue(0.0), activeWindowShadingControl(0), HasShadeControl(false), + activeShadedConstruction(0), activeShadedConstructionPrev(0), FrameDivider(0), Multiplier(1.0), SolarEnclIndex(0), + SolarEnclSurfIndex(0), IsAirBoundarySurf(false), IsSurfPropertyGndSurfacesDefined(false), SurfPropertyGndSurfIndex(0), + UseSurfPropertyGndSurfTemp(false), UseSurfPropertyGndSurfRefl(false), GndReflSolarRad(0.0), SurfHasSurroundingSurfProperty(false), + SurfSchedExternalShadingFrac(false), SurfSurroundingSurfacesNum(0), SurfLinkedOutAirNode(0), SrdSurfTemp(0.0), ViewFactorSrdSurfs(0.0) { } @@ -913,10 +911,10 @@ namespace DataSurfaces { // Multiplier on sunlit fraction due to shadowing of glass by // frame and divider outside projections - std::array OutProjSLFracMult = {1.0}; + std::array OutProjSLFracMult = {1.0}; // Multiplier on sunlit fraction due to shadowing of glass by // frame and divider inside and outside projections - std::array InOutProjSLFracMult = {1.0}; + std::array InOutProjSLFracMult = {1.0}; // for shadowing of ground by building and obstructions [W/m2] // Enclosure inside surface area minus this surface and its @@ -1159,7 +1157,7 @@ namespace DataSurfaces { // OnNight/OnDayIfCoolingAndHighSolarOnWindow: shading on at night; shading on daytime if // solar on window > setpoint (W/m2 of window) and // prev. time step cooling rate > 0 - int Schedule{0}; // Pointer to schedule of 0 and 1 values: 0 => window is not shaded; + Sched::Schedule *sched = nullptr; // schedule of 0 and 1 values: 0 => window is not shaded; // 1 => window is shaded if Type=Schedule or Type = ScheduleAnd... // and setpoint is exceeded. Real64 SetPoint{0.0}; // Control setpoint (dimension depends on Trigger: @@ -1170,9 +1168,9 @@ namespace DataSurfaces { // MeetDaylightIlluminanceSetpoint or OnIfHighGlare. Real64 SetPoint2{0.0}; // Second control setpoint for control types that take two setpoints. // Dimension is deg C or W/m2. - bool ShadingControlIsScheduled{false}; // True if shading control has a schedule - bool GlareControlIsActive{false}; // True if shading control to reduce daylight glare is active - int SlatAngleSchedule{0}; // Pointer to schedule of slat angle values between 0.0 and 180.0 degrees + bool ShadingControlIsScheduled{false}; // True if shading control has a schedule + bool GlareControlIsActive{false}; // True if shading control to reduce daylight glare is active + Sched::Schedule *slatAngleSched = nullptr; // schedule of slat angle values between 0.0 and 180.0 degrees SlatAngleControl slatAngleControl{ SlatAngleControl::Invalid}; // Takes one of the following values that specifies // CHARACTER(len=32) :: slatAngleControlForBlinds = ' ' ! Takes one of the following values that specifies @@ -1197,31 +1195,31 @@ namespace DataSurfaces { struct OSCData { // Members - std::string Name; // Name of OSC - Real64 ConstTemp; // User selected constant temperature (degrees C) - Real64 ConstTempCoef; // Coefficient modifying the user selected constant temperature - Real64 ExtDryBulbCoef; // Coefficient modifying the external dry bulb temperature - Real64 GroundTempCoef; // Coefficient modifying the ground temperature - Real64 SurfFilmCoef; // Combined convective/radiative film coefficient if >0, else use other coefficients - Real64 WindSpeedCoef; // Coefficient modifying the wind speed term (s/m) - Real64 ZoneAirTempCoef; // Coefficient modifying the zone air temperature part of the equation - std::string ConstTempScheduleName; // Schedule name for scheduled outside temp - int ConstTempScheduleIndex; // Index for scheduled outside temp. - bool SinusoidalConstTempCoef; // If true then ConstTempCoef varies by sine wave - Real64 SinusoidPeriod; // period of sine wave variation (hr) - Real64 TPreviousCoef; // Coefficient modifying the OSC temp from the previous timestep (dimensionless) - Real64 TOutsideSurfPast; // Ouside surface temperature from previous timestep {C} - Real64 MinTempLimit; // Minimum limit on OSC temp {deg C} - Real64 MaxTempLimit; // Maximum limit on OSC temp {deg C} - bool MinLimitPresent; // If TRUE then apply minimum limit on calculated OSC temp - bool MaxLimitPresent; // If TRUE then apply maximum limit on calculated OSC temp - Real64 OSCTempCalc; // Result of calculated temperature using OSC (degrees C) + std::string Name; // Name of OSC + Real64 ConstTemp; // User selected constant temperature (degrees C) + Real64 ConstTempCoef; // Coefficient modifying the user selected constant temperature + Real64 ExtDryBulbCoef; // Coefficient modifying the external dry bulb temperature + Real64 GroundTempCoef; // Coefficient modifying the ground temperature + Real64 SurfFilmCoef; // Combined convective/radiative film coefficient if >0, else use other coefficients + Real64 WindSpeedCoef; // Coefficient modifying the wind speed term (s/m) + Real64 ZoneAirTempCoef; // Coefficient modifying the zone air temperature part of the equation + std::string ConstTempScheduleName; // Schedule name for scheduled outside temp + Sched::Schedule *constTempSched = nullptr; // Index for scheduled outside temp. + bool SinusoidalConstTempCoef; // If true then ConstTempCoef varies by sine wave + Real64 SinusoidPeriod; // period of sine wave variation (hr) + Real64 TPreviousCoef; // Coefficient modifying the OSC temp from the previous timestep (dimensionless) + Real64 TOutsideSurfPast; // Ouside surface temperature from previous timestep {C} + Real64 MinTempLimit; // Minimum limit on OSC temp {deg C} + Real64 MaxTempLimit; // Maximum limit on OSC temp {deg C} + bool MinLimitPresent; // If TRUE then apply minimum limit on calculated OSC temp + bool MaxLimitPresent; // If TRUE then apply maximum limit on calculated OSC temp + Real64 OSCTempCalc; // Result of calculated temperature using OSC (degrees C) // Default Constructor OSCData() : ConstTemp(0.0), ConstTempCoef(0.0), ExtDryBulbCoef(0.0), GroundTempCoef(0.0), SurfFilmCoef(0.0), WindSpeedCoef(0.0), - ZoneAirTempCoef(0.0), ConstTempScheduleIndex(0), SinusoidalConstTempCoef(false), SinusoidPeriod(0.0), TPreviousCoef(0.0), - TOutsideSurfPast(0.0), MinTempLimit(0.0), MaxTempLimit(0.0), MinLimitPresent(false), MaxLimitPresent(false), OSCTempCalc(0.0) + ZoneAirTempCoef(0.0), SinusoidalConstTempCoef(false), SinusoidPeriod(0.0), TPreviousCoef(0.0), TOutsideSurfPast(0.0), MinTempLimit(0.0), + MaxTempLimit(0.0), MinLimitPresent(false), MaxLimitPresent(false), OSCTempCalc(0.0) { } }; @@ -1260,8 +1258,7 @@ namespace DataSurfaces { Convect::OverrideType overrideType = // Override type, 1=value, 2=schedule, 3=model, 4=user curve Convect::OverrideType::Invalid; Real64 OverrideValue = 0.0; // User specified value - std::string ScheduleName = ""; // Which surface (name) - int ScheduleIndex = 0; // if type="schedule" is used + Sched::Schedule *sched = nullptr; // if type="schedule" is used int UserCurveIndex = 0; // if type=UserCurve is used Convect::HcInt HcIntModelEq = Convect::HcInt::Invalid; // if type is one of specific model equations Convect::HcExt HcExtModelEq = Convect::HcExt::Invalid; @@ -1285,33 +1282,28 @@ namespace DataSurfaces { { // Members std::string Name; - int SurfPtr; // surface pointer - int ConstrPtr; // construction pointer - int SchedPtr; // schedule pointer - - // Default Constructor - SurfaceSolarIncident() : SurfPtr(0), ConstrPtr(0), SchedPtr(0) - { - } + int SurfPtr = 0; // surface pointer + int ConstrPtr = 0; // construction pointer + Sched::Schedule *sched = nullptr; // schedule }; struct SurfaceIncidentSolarMultiplier { // Members std::string Name; - int SurfaceIdx = 0; // surface index - Real64 Scaler = 1.0; // the constant multiplier constant from user input - int SchedPtr = 0; // the index of the multiplier schedule + int SurfaceIdx = 0; // surface index + Real64 Scaler = 1.0; // the constant multiplier constant from user input + Sched::Schedule *sched = nullptr; // multiplier schedule }; struct FenestrationSolarAbsorbed { // Members std::string Name; - int SurfPtr; // surface pointer - int ConstrPtr; // construction pointer - int NumOfSched; // number of scheduled layers - Array1D_int SchedPtrs; // pointer to schedules for each layer in construction + int SurfPtr; // surface pointer + int ConstrPtr; // construction pointer + int NumOfSched; // number of scheduled layers + Array1D scheds; // pointer to schedules for each layer in construction // Default Constructor FenestrationSolarAbsorbed() : SurfPtr(0), ConstrPtr(0), NumOfSched(0) @@ -1322,10 +1314,10 @@ namespace DataSurfaces { struct GroundSurfacesData { // Members - std::string Name; // name of a ground surface - Real64 ViewFactor = 0.0; // view factor to a ground surface - int TempSchPtr = 0; // pointer to a ground surface temperature schedule object - int ReflSchPtr = 0; // pointer to a ground Surface reflectance schedule object + std::string Name; // name of a ground surface + Real64 ViewFactor = 0.0; // view factor to a ground surface + Sched::Schedule *tempSched = nullptr; // pointer to a ground surface temperature schedule object + Sched::Schedule *reflSched = nullptr; // pointer to a ground Surface reflectance schedule object }; struct GroundSurfacesProperty @@ -1344,33 +1336,33 @@ namespace DataSurfaces { { // Members std::string Name; - int SurfPtr = 0; // surface pointer - int SunlitFracSchedPtr = 0; // schedule pointer - int SurroundingSurfsPtr = 0; // schedule pointer - int OutdoorAirNodePtr = 0; // outdoor air node pointer - int GroundSurfsPtr = 0; // pointer to multiple ground surfaces object + int SurfPtr = 0; // surface pointer + Sched::Schedule *sunlitFracSched = nullptr; // schedule + int SurroundingSurfsPtr = 0; // schedule pointer + int OutdoorAirNodePtr = 0; // outdoor air node pointer + int GroundSurfsPtr = 0; // pointer to multiple ground surfaces object }; struct SurroundingSurfProperty { // Members std::string Name; - Real64 ViewFactor = 0.0; // view factor to surrounding surface - int TempSchNum = 0; // schedule pointer + Real64 ViewFactor = 0.0; // view factor to surrounding surface + Sched::Schedule *tempSched = nullptr; // temperature schedule }; struct SurroundingSurfacesProperty { // Members std::string Name; - Real64 SkyViewFactor = 0.0; // sky view factor - Real64 GroundViewFactor = 0.0; // ground view factor - Real64 SurfsViewFactorSum = 0.0; // surrounding surfaces view factor sum - int SkyTempSchNum = 0; // schedule pointer - int GroundTempSchNum = 0; // schedule pointer - int TotSurroundingSurface = 0; // Total number of surrounding surfaces defined for an exterior surface - bool IsSkyViewFactorSet = false; // false if the sky view factor field is blank - bool IsGroundViewFactorSet = false; // false if the ground view factor field is blank + Real64 SkyViewFactor = 0.0; // sky view factor + Real64 GroundViewFactor = 0.0; // ground view factor + Real64 SurfsViewFactorSum = 0.0; // surrounding surfaces view factor sum + Sched::Schedule *skyTempSched = nullptr; // schedule + Sched::Schedule *groundTempSched = nullptr; // schedule + int TotSurroundingSurface = 0; // Total number of surrounding surfaces defined for an exterior surface + bool IsSkyViewFactorSet = false; // false if the sky view factor field is blank + bool IsGroundViewFactorSet = false; // false if the ground view factor field is blank Array1D SurroundingSurfs; }; @@ -1466,6 +1458,15 @@ namespace DataSurfaces { std::string cSurfaceClass(SurfaceClass ClassNo); + struct MovInsul + { + bool present = false; + bool presentPrevTS = false; + Real64 H = 0.0; + int matNum = 0; // Material number + Sched::Schedule *sched = nullptr; + }; + } // namespace DataSurfaces struct SurfacesData : BaseGlobalStruct @@ -1529,6 +1530,8 @@ struct SurfacesData : BaseGlobalStruct std::vector allInsideSourceSurfaceList; // List of all surfaces with SurfaceProperty:HeatBalanceSourceTerm for inside face std::vector allOutsideSourceSurfaceList; // List of all surfaces with SurfaceProperty:HeatBalanceSourceTerm for outside face std::vector allGetsRadiantHeatSurfaceList; // List of all surfaces that receive radiant HVAC output + std::vector intMovInsulSurfNums; + std::vector extMovInsulSurfNums; std::array, static_cast(DataSurfaces::SurfaceFilter::Num)> SurfaceFilterLists; @@ -1577,12 +1580,6 @@ struct SurfacesData : BaseGlobalStruct Array1D> SurfShadowDisabledZoneList; // Array of all disabled shadowing zone number to the current surface the surface diffusion model - // Surface movable insulation properties - Array1D SurfMaterialMovInsulExt; // Pointer to the material used for exterior movable insulation - Array1D SurfMaterialMovInsulInt; // Pointer to the material used for interior movable insulation - Array1D SurfSchedMovInsulExt; // Schedule for exterior movable insulation - Array1D SurfSchedMovInsulInt; // Schedule for interior movable insulation - // Surface EMS Array1D SurfEMSConstructionOverrideON; // if true, EMS is calling to override the construction value Array1D SurfEMSConstructionOverrideValue; // pointer value to use for Construction when overridden @@ -1788,7 +1785,7 @@ struct SurfacesData : BaseGlobalStruct Array1D SurfWinMaxAirflow; // Maximum gap airflow (m3/s per m of glazing width) Array1D SurfWinAirflowControlType; // Gap airflow control type (ALWAYSONATMAXFLOW, etc.) Array1D SurfWinAirflowHasSchedule; // True if gap airflow is scheduled - Array1D SurfWinAirflowSchedulePtr; // Gap airflow schedule pointer + Array1D SurfWinAirflowScheds; // Gap airflow schedule Array1D SurfWinAirflowThisTS; // Gap airflow this timestep (m3/s per m of glazing width) Array1D SurfWinTAirflowGapOutlet; // Temperature of air leaving airflow gap between glass panes (C) Array1D SurfWinWindowCalcIterationsRep; // Number of iterations in window heat balance calculation @@ -1811,6 +1808,9 @@ struct SurfacesData : BaseGlobalStruct Array1D SurfActiveConstruction; // The currently active construction with or without storm window Array1D SurfWinActiveShadedConstruction; // The currently active shaded construction with or without storm window (windows only) + Array1D intMovInsuls; + Array1D extMovInsuls; + EPVector Surface; EPVector SurfaceWindow; EPVector surfShades; @@ -1830,6 +1830,10 @@ struct SurfacesData : BaseGlobalStruct EPVector IntMassObjects; EPVector GroundSurfsProperty; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataSystemVariables.cc b/src/EnergyPlus/DataSystemVariables.cc index dd2100e87d6..793a24009ff 100644 --- a/src/EnergyPlus/DataSystemVariables.cc +++ b/src/EnergyPlus/DataSystemVariables.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/DataSystemVariables.hh b/src/EnergyPlus/DataSystemVariables.hh index f1d57148038..a39a1b6b618 100644 --- a/src/EnergyPlus/DataSystemVariables.hh +++ b/src/EnergyPlus/DataSystemVariables.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -152,6 +152,10 @@ struct SystemVarsData : BaseGlobalStruct bool Threading = false; bool ciForceTimeStep = false; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataTimings.hh b/src/EnergyPlus/DataTimings.hh index 19adecf5799..8f66640c283 100644 --- a/src/EnergyPlus/DataTimings.hh +++ b/src/EnergyPlus/DataTimings.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -76,6 +76,10 @@ struct DataTimingsData : BaseGlobalStruct int NumCalcScriptF_Calls = 0; #endif + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataVectorTypes.hh b/src/EnergyPlus/DataVectorTypes.hh index 4af56321ac6..6c80d3c0cf6 100644 --- a/src/EnergyPlus/DataVectorTypes.hh +++ b/src/EnergyPlus/DataVectorTypes.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/DataViewFactorInformation.hh b/src/EnergyPlus/DataViewFactorInformation.hh index 1882c62ee24..5c49cc6b55e 100644 --- a/src/EnergyPlus/DataViewFactorInformation.hh +++ b/src/EnergyPlus/DataViewFactorInformation.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -106,6 +106,10 @@ struct ViewFactorInfoData : BaseGlobalStruct EPVector EnclRadInfo; EPVector EnclSolInfo; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataWater.hh b/src/EnergyPlus/DataWater.hh index 2699f3ca3e7..326ec13ea95 100644 --- a/src/EnergyPlus/DataWater.hh +++ b/src/EnergyPlus/DataWater.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -155,15 +155,15 @@ namespace DataWater { Real64 MaxInFlowRate; // limit on rate of inlet [m3/s] Real64 MaxOutFlowRate; // limit on rate of outlet [m3/s] TankThermalMode ThermalMode; - Real64 InitialTankTemp; // initial tank temperature [C] - int TempSchedID; // index "pointer" to schedule - AmbientTempType AmbientTempIndicator; // Indicator for ambient tank losses (SCHEDULE, ZONE, EXTERIOR) - int AmbientTempSchedule; // Schedule index pointer - int ZoneID; // index "pointer" to zone where tank is - Real64 UValue; // U-value for tank [W/m2-k] - Real64 SurfArea; // surface are of tank on Zone side... [m2] - int InternalMassID; // index "pointer" to internal mass object for thermal coupling - std::string SurfMaterialName; // surface properties + Real64 InitialTankTemp; // initial tank temperature [C] + Sched::Schedule *tempSched = nullptr; // temp schedule + AmbientTempType AmbientTempIndicator; // Indicator for ambient tank losses (SCHEDULE, ZONE, EXTERIOR) + Sched::Schedule *ambientTempSched = nullptr; // Ambient temp schedule + int ZoneID; // index "pointer" to zone where tank is + Real64 UValue; // U-value for tank [W/m2-k] + Real64 SurfArea; // surface are of tank on Zone side... [m2] + int InternalMassID; // index "pointer" to internal mass object for thermal coupling + std::string SurfMaterialName; // surface properties // calculated data and from elsewhere Real64 ThisTimeStepVolume; Real64 LastTimeStepVolume; @@ -199,11 +199,11 @@ namespace DataWater { : MaxCapacity(0.0), OverflowMode(Overflow::Invalid), OverflowTankID(0), OverflowTankSupplyARRID(0), ValveOnCapacity(0.0), ValveOffCapacity(0.0), LastTimeStepFilling(false), ControlSupply(ControlSupplyType::Invalid), GroundWellID(0), SupplyTankID(0), SupplyTankDemandARRID(0), BackupMainsCapacity(0.0), InitialVolume(0.0), MaxInFlowRate(0.0), MaxOutFlowRate(0.0), - ThermalMode(TankThermalMode::Invalid), InitialTankTemp(20.0), TempSchedID(0), AmbientTempIndicator(AmbientTempType::Invalid), - AmbientTempSchedule(0), ZoneID(0), UValue(0.0), SurfArea(0.0), InternalMassID(0), ThisTimeStepVolume(0.0), LastTimeStepVolume(0.0), - LastTimeStepTemp(0.0), NumWaterSupplies(0), NumWaterDemands(0), VdotFromTank(0.0), VdotToTank(0.0), VdotOverflow(0.0), VolOverflow(0.0), - NetVdot(0.0), Twater(0.0), TouterSkin(0.0), TwaterOverflow(0.0), MainsDrawVdot(0.0), MainsDrawVol(0.0), SkinLossPower(0.0), - SkinLossEnergy(0.0), SkinLossConvect(0.0), SkinLossRadiat(0.0) + ThermalMode(TankThermalMode::Invalid), InitialTankTemp(20.0), AmbientTempIndicator(AmbientTempType::Invalid), ZoneID(0), UValue(0.0), + SurfArea(0.0), InternalMassID(0), ThisTimeStepVolume(0.0), LastTimeStepVolume(0.0), LastTimeStepTemp(0.0), NumWaterSupplies(0), + NumWaterDemands(0), VdotFromTank(0.0), VdotToTank(0.0), VdotOverflow(0.0), VolOverflow(0.0), NetVdot(0.0), Twater(0.0), TouterSkin(0.0), + TwaterOverflow(0.0), MainsDrawVdot(0.0), MainsDrawVol(0.0), SkinLossPower(0.0), SkinLossEnergy(0.0), SkinLossConvect(0.0), + SkinLossRadiat(0.0) { } }; @@ -216,9 +216,9 @@ namespace DataWater { std::string StorageTankName; int StorageTankID; // index "pointer" to storage tank array int StorageTankSupplyARRID; - RainLossFactor LossFactorMode; // control how loss factor(s) are entered - Real64 LossFactor; // loss factor when constant - int LossFactorSchedID; // index "pointer" to schedule + RainLossFactor LossFactorMode; // control how loss factor(s) are entered + Real64 LossFactor; // loss factor when constant + Sched::Schedule *lossFactorSched = nullptr; // schedule Real64 MaxCollectRate; int NumCollectSurfs; // number of surfaces used in the collector Array1D_string SurfName; @@ -232,8 +232,8 @@ namespace DataWater { // Default Constructor RainfallCollectorDataStruct() - : StorageTankID(0), StorageTankSupplyARRID(0), LossFactorMode(RainLossFactor::Invalid), LossFactor(0.0), LossFactorSchedID(0), - MaxCollectRate(0.0), NumCollectSurfs(0), HorizArea(0.0), VdotAvail(0.0), VolCollected(0.0), MeanHeight(0.0) + : StorageTankID(0), StorageTankSupplyARRID(0), LossFactorMode(RainLossFactor::Invalid), LossFactor(0.0), MaxCollectRate(0.0), + NumCollectSurfs(0), HorizArea(0.0), VdotAvail(0.0), VolCollected(0.0), MeanHeight(0.0) { } }; @@ -255,7 +255,7 @@ namespace DataWater { Real64 NomWellStorageVol; // water storage in well at average water table depth [m3] GroundWaterTable GroundwaterTableMode; // method of determining water table depth Real64 WaterTableDepth; - int WaterTableDepthSchedID; + Sched::Schedule *waterTableDepthSched = nullptr; // calculated and from elsewhere Real64 VdotRequest; // rate of flow over timestep requested by tank Real64 VdotDelivered; // rate of flow provided [m3/s] @@ -267,8 +267,7 @@ namespace DataWater { GroundwaterWellDataStruct() : StorageTankID(0), StorageTankSupplyARRID(0), PumpDepth(0.0), PumpNomVolFlowRate(0.0), PumpNomHead(0.0), PumpNomPowerUse(0.0), PumpEfficiency(0.0), WellRecoveryRate(0.0), NomWellStorageVol(0.0), GroundwaterTableMode(GroundWaterTable::Invalid), - WaterTableDepth(0.0), WaterTableDepthSchedID(0), VdotRequest(0.0), VdotDelivered(0.0), VolDelivered(0.0), PumpPower(0.0), - PumpEnergy(0.0) + WaterTableDepth(0.0), VdotRequest(0.0), VdotDelivered(0.0), VolDelivered(0.0), PumpPower(0.0), PumpEnergy(0.0) { } }; @@ -278,7 +277,7 @@ namespace DataWater { // Members RainfallMode ModeID; // type of rainfall modeling Real64 DesignAnnualRain; - int RainSchedID; + Sched::Schedule *rainSched = nullptr; Real64 NomAnnualRain; // calculated and from elsewhere. Real64 CurrentRate; @@ -288,8 +287,7 @@ namespace DataWater { std::array numRainyHoursInWeather = {0}; // Monthly number of rainy hours // Default Constructor - SiteRainFallDataStruct() - : ModeID(RainfallMode::None), DesignAnnualRain(0.0), RainSchedID(0), NomAnnualRain(0.0), CurrentRate(0.0), CurrentAmount(0.0) + SiteRainFallDataStruct() : ModeID(RainfallMode::None), DesignAnnualRain(0.0), NomAnnualRain(0.0), CurrentRate(0.0), CurrentAmount(0.0) { } }; @@ -298,13 +296,13 @@ namespace DataWater { { // Members IrrigationMode ModeID; // type of irrigation modeling - int IrrSchedID; + Sched::Schedule *irrSched = nullptr; Real64 ScheduledAmount; Real64 ActualAmount; Real64 IrrigationThreshold; // percent at which no irrigation happens (smart schedule) // Default Constructor - IrrigationDataStruct() : ModeID(IrrigationMode::Invalid), IrrSchedID(0), ScheduledAmount(0.0), ActualAmount(0.0), IrrigationThreshold(0.4) + IrrigationDataStruct() : ModeID(IrrigationMode::Invalid), ScheduledAmount(0.0), ActualAmount(0.0), IrrigationThreshold(0.4) { } }; @@ -331,6 +329,10 @@ struct DataWaterData : BaseGlobalStruct bool AnyIrrigationInModel = false; // control flag set true if irrigation input for ecoroof DJS PSU Dec 2006 int PrecipOverwrittenByRainFlag = 0; // recurring warning index when the rain flag is on but the liquidprecipitation = 0 + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataWindowEquivalentLayer.hh b/src/EnergyPlus/DataWindowEquivalentLayer.hh index 3a245c1691b..6520d80c866 100644 --- a/src/EnergyPlus/DataWindowEquivalentLayer.hh +++ b/src/EnergyPlus/DataWindowEquivalentLayer.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -292,6 +292,10 @@ struct WindowEquivLayerData : BaseGlobalStruct Array1D CFS; Array1D CFSGaps; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataZoneControls.hh b/src/EnergyPlus/DataZoneControls.hh index c0d79f4f2ce..cc41a484729 100644 --- a/src/EnergyPlus/DataZoneControls.hh +++ b/src/EnergyPlus/DataZoneControls.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -71,30 +71,24 @@ namespace DataZoneControls { Num }; + struct TempSetptType + { + std::string Name; + bool isUsed = false; + Sched::Schedule *heatSetptSched = nullptr; + Sched::Schedule *coolSetptSched = nullptr; + }; + struct ZoneTempControls { // Members std::string Name; // Name of the thermostat std::string ZoneName; // Name of the zone int ActualZoneNum; - std::string ControlTypeSchedName; // Name of the schedule which determines the zone temp setpoint - int CTSchedIndex; // Index for this schedule - - // this is the number of control types defined on this zone control object - int NumControlTypes; - // these are all allocated to NumControlTypes, should be a struct allocated once - Array1D_string ControlType; // from IDF, the "types" (string-should be an enum) of control modes for this particular thermostat - delete this - Array1D_string ControlTypeName; // from IDF, the names of the control modes for this particular thermostat - Array1D ControlTypeEnum; // from IDF, the enum types of each control mode for this particular thermostat + Sched::Schedule *setptTypeSched = nullptr; // Index for this schedule - // these now reflect that actual underlying setpoint temperature schedule indexes for each possible control type, - // so they can be used to call directly to ScheduleValue(...) - int SchIndx_SingleHeatSetPoint; - int SchIndx_SingleCoolSetPoint; - int SchIndx_SingleHeatCoolSetPoint; - int SchIndx_DualSetPointWDeadBandHeat; - int SchIndx_DualSetPointWDeadBandCool; + std::array setpts; bool ManageDemand; // Flag to indicate whether to use demand limiting Real64 HeatingResetLimit; // Lowest heating setpoint that can be set by demand manager [C] @@ -106,8 +100,8 @@ namespace DataZoneControls { bool OperativeTempControl; // flag to indicate whether control based on Operative Temp bool OpTempCntrlModeScheduled; // flag to indicate if radiative fraction is scheduled, // else constant - Real64 FixedRadiativeFraction; // weighting factor for mean radiant temp for Operative temperature - int OpTempRadiativeFractionSched; // index of schedule for when fraction is scheduled + Real64 FixedRadiativeFraction; // weighting factor for mean radiant temp for Operative temperature + Sched::Schedule *opTempRadiativeFractionSched = nullptr; // schedule for when fraction is scheduled bool AdaptiveComfortTempControl; // flag to indicate whether control based on Operative Temp int AdaptiveComfortModelTypeIndex; // index to adaptive comfort model type @@ -116,15 +110,14 @@ namespace DataZoneControls { bool ZoneOvercoolControl; // Flag to indicate whether control is based on overcool bool OvercoolCntrlModeScheduled; // Flag to indicate if zone overcool range is scheduled // or constant - Real64 ZoneOvercoolConstRange; // Overcool Range for Zone Air Setpoint Temperature [deltaC] - int ZoneOvercoolRangeSchedIndex; // Index for Overcool Range Schedule - Real64 ZoneOvercoolControlRatio; // Zone relative humidity shift per dry-bulb temperature overcooling + Real64 ZoneOvercoolConstRange; // Overcool Range for Zone Air Setpoint Temperature [deltaC] + Sched::Schedule *zoneOvercoolRangeSched = nullptr; // Overcool Range Schedule + Real64 ZoneOvercoolControlRatio; // Zone relative humidity shift per dry-bulb temperature overcooling // below the original cooling setpoint, %RH/deltaC - std::string DehumidifyingSched; // Name of the schedule to determine the zone dehumidifying setpoint - int DehumidifyingSchedIndex; // Index for dehumidifying schedule - Real64 DeltaTCutSet; // Temperature difference between cutout and setpoint - Real64 ZoneThermostatSetPointHi; // Cooling setpoint - Real64 ZoneThermostatSetPointLo; // Heating setpoint + Sched::Schedule *dehumidifyingSched = nullptr; // dehumidifying schedule + Real64 DeltaTCutSet; // Temperature difference between cutout and setpoint + Real64 ZoneThermostatSetPointHi; // Cooling setpoint + Real64 ZoneThermostatSetPointLo; // Heating setpoint bool CoolModeLast; bool HeatModeLast; bool CoolModeLastSave; @@ -134,15 +127,13 @@ namespace DataZoneControls { // Default Constructor ZoneTempControls() - : ActualZoneNum(0), CTSchedIndex(0), NumControlTypes(0), SchIndx_SingleHeatSetPoint(0), SchIndx_SingleCoolSetPoint(0), - SchIndx_SingleHeatCoolSetPoint(0), SchIndx_DualSetPointWDeadBandHeat(0), SchIndx_DualSetPointWDeadBandCool(0), ManageDemand(false), - HeatingResetLimit(0.0), CoolingResetLimit(0.0), EMSOverrideHeatingSetPointOn(false), EMSOverrideHeatingSetPointValue(0.0), - EMSOverrideCoolingSetPointOn(false), EMSOverrideCoolingSetPointValue(0.0), OperativeTempControl(false), OpTempCntrlModeScheduled(false), - FixedRadiativeFraction(0.0), OpTempRadiativeFractionSched(0), AdaptiveComfortTempControl(false), AdaptiveComfortModelTypeIndex(0), - ZoneOvercoolRange(0.0), ZoneOvercoolControl(false), OvercoolCntrlModeScheduled(false), ZoneOvercoolConstRange(0.0), - ZoneOvercoolRangeSchedIndex(0), ZoneOvercoolControlRatio(0.0), DehumidifyingSchedIndex(0), DeltaTCutSet(0), - ZoneThermostatSetPointHi(0.0), ZoneThermostatSetPointLo(0.0), CoolModeLast(false), HeatModeLast(false), CoolModeLastSave(false), - HeatModeLastSave(false), CoolOffFlag(false), HeatOffFlag(false) + : ActualZoneNum(0), ManageDemand(false), HeatingResetLimit(0.0), CoolingResetLimit(0.0), EMSOverrideHeatingSetPointOn(false), + EMSOverrideHeatingSetPointValue(0.0), EMSOverrideCoolingSetPointOn(false), EMSOverrideCoolingSetPointValue(0.0), + OperativeTempControl(false), OpTempCntrlModeScheduled(false), FixedRadiativeFraction(0.0), AdaptiveComfortTempControl(false), + AdaptiveComfortModelTypeIndex(0), ZoneOvercoolRange(0.0), ZoneOvercoolControl(false), OvercoolCntrlModeScheduled(false), + ZoneOvercoolConstRange(0.0), ZoneOvercoolControlRatio(0.0), DeltaTCutSet(0), ZoneThermostatSetPointHi(0.0), + ZoneThermostatSetPointLo(0.0), CoolModeLast(false), HeatModeLast(false), CoolModeLastSave(false), HeatModeLastSave(false), + CoolOffFlag(false), HeatOffFlag(false) { } @@ -151,43 +142,43 @@ namespace DataZoneControls { struct ZoneHumidityControls { // Members - std::string ControlName; // Name of this humidity controller - std::string ZoneName; // Name of the zone - std::string HumidifyingSched; // Name of the schedule to determine the zone humidifying setpoint - std::string DehumidifyingSched; // Name of the schedule to determine the zone dehumidifying setpoint + std::string ControlName; // Name of this humidity controller + std::string ZoneName; // Name of the zone int ActualZoneNum; - int HumidifyingSchedIndex; // Index for humidifying schedule - int DehumidifyingSchedIndex; // Index for dehumidifying schedule - int ErrorIndex; // Error index when LowRH setpoint > HighRH setpoint - bool EMSOverrideHumidifySetPointOn; // EMS is calling to override humidifying setpoint - Real64 EMSOverrideHumidifySetPointValue; // value EMS is directing to use for humidifying setpoint - bool EMSOverrideDehumidifySetPointOn; // EMS is calling to override dehumidifying setpoint - Real64 EMSOverrideDehumidifySetPointValue; // value EMS is directing to use for dehumidifying setpoint + Sched::Schedule *humidifyingSched = nullptr; // humidifying schedule + Sched::Schedule *dehumidifyingSched = nullptr; // dehumidifying schedule + int ErrorIndex; // Error index when LowRH setpoint > HighRH setpoint + bool EMSOverrideHumidifySetPointOn; // EMS is calling to override humidifying setpoint + Real64 EMSOverrideHumidifySetPointValue; // value EMS is directing to use for humidifying setpoint + bool EMSOverrideDehumidifySetPointOn; // EMS is calling to override dehumidifying setpoint + Real64 EMSOverrideDehumidifySetPointValue; // value EMS is directing to use for dehumidifying setpoint // Default Constructor ZoneHumidityControls() - : ActualZoneNum(0), HumidifyingSchedIndex(0), DehumidifyingSchedIndex(0), ErrorIndex(0), EMSOverrideHumidifySetPointOn(false), - EMSOverrideHumidifySetPointValue(0.0), EMSOverrideDehumidifySetPointOn(false), EMSOverrideDehumidifySetPointValue(0.0) + : ActualZoneNum(0), ErrorIndex(0), EMSOverrideHumidifySetPointOn(false), EMSOverrideHumidifySetPointValue(0.0), + EMSOverrideDehumidifySetPointOn(false), EMSOverrideDehumidifySetPointValue(0.0) { } }; + struct ComfortSetptType + { + std::string Name; + bool isUsed = false; + Sched::Schedule *heatSetptSched = nullptr; + Sched::Schedule *coolSetptSched = nullptr; + }; + struct ZoneComfortControls { // Members - std::string Name; // Name of the thermostat - std::string ZoneName; // Name of the zone - int ActualZoneNum; // Index number of zone - std::string ControlTypeSchedName; // Name of the schedule which determines the zone temp setpoint - int ComfortSchedIndex; // Index for this schedule - int NumControlTypes; // Number of control types in ZoneControl:ThermalComfort object - Array1D_string ControlType; // Type of control - Array1D_string ControlTypeName; // Name of control type - Array1D_int ControlTypeSchIndx; // Index to control type schedule - int SchIndx_SingleHeating; // Index to fanger single heating setpoint schedule - int SchIndx_SingleCooling; // Index to fanger single cooling setpoint schedule - int SchIndx_SingleHeatCool; // Index to fanger single heating/cooling setpoint schedule - int SchIndx_DualSetPointWithDeadBand; // Index to fanger dual setpoint schedule + std::string Name; // Name of the thermostat + std::string ZoneName; // Name of the zone + int ActualZoneNum; // Index number of zone + Sched::Schedule *setptTypeSched = nullptr; // Schedule determines which thermostat type is active + + std::array setpts; // Type of control + bool ManageDemand; // Flag to indicate whether to use demand limiting Real64 HeatingResetLimit; // Lowest heating setpoint that can be set by demand manager [C] Real64 CoolingResetLimit; // Highest cooling setpoint that can be set by demand manager [C] @@ -197,7 +188,7 @@ namespace DataZoneControls { Real64 EMSOverrideCoolingSetPointValue; // value EMS is directing to use for cooling setpoint Real64 TdbMaxSetPoint; // Maximum dry-bulb temperature setpoint [C] Real64 TdbMinSetPoint; // Minimum dry-bulb temperature setpoint [C] - std::string AverageMethodName; // Averaging Method for Zones with Multiple People Objects + std::string AverageMethodName; // Name for Averaging Method std::string AverageObjectName; // Object Name for Specific Object Average DataZoneControls::AverageMethod AverageMethod; // Averaging method int SpecificObjectNum; // People Object number used for Specific people object choice @@ -210,12 +201,10 @@ namespace DataZoneControls { // Default Constructor ZoneComfortControls() - : ActualZoneNum(0), ComfortSchedIndex(0), NumControlTypes(0), SchIndx_SingleHeating(0), SchIndx_SingleCooling(0), - SchIndx_SingleHeatCool(0), SchIndx_DualSetPointWithDeadBand(0), ManageDemand(false), HeatingResetLimit(0.0), CoolingResetLimit(0.0), - EMSOverrideHeatingSetPointOn(false), EMSOverrideHeatingSetPointValue(0.0), EMSOverrideCoolingSetPointOn(false), - EMSOverrideCoolingSetPointValue(0.0), TdbMaxSetPoint(50.0), TdbMinSetPoint(0.0), AverageMethodName("PEOPLE AVERGAE"), - AverageMethod(DataZoneControls::AverageMethod::NO), SpecificObjectNum(0), PeopleAverageErrIndex(0), TdbMaxErrIndex(0), - TdbMinErrIndex(0), TdbHCErrIndex(0), TdbDualMaxErrIndex(0), TdbDualMinErrIndex(0) + : ActualZoneNum(0), ManageDemand(false), HeatingResetLimit(0.0), CoolingResetLimit(0.0), EMSOverrideHeatingSetPointOn(false), + EMSOverrideHeatingSetPointValue(0.0), EMSOverrideCoolingSetPointOn(false), EMSOverrideCoolingSetPointValue(0.0), TdbMaxSetPoint(50.0), + TdbMinSetPoint(0.0), AverageMethodName("PEOPLE AVERGAE"), AverageMethod(DataZoneControls::AverageMethod::NO), SpecificObjectNum(0), + PeopleAverageErrIndex(0), TdbMaxErrIndex(0), TdbMinErrIndex(0), TdbHCErrIndex(0), TdbDualMaxErrIndex(0), TdbDualMinErrIndex(0) { } }; @@ -223,28 +212,26 @@ namespace DataZoneControls { struct ZoneStagedControls { // Members - std::string Name; // Name of the thermostat - std::string ZoneName; // Name of the zone - int ActualZoneNum; // Index number of zone - std::string HeatSetBaseSchedName; // Name of the schedule which provides zone heating setpoint base - int HSBchedIndex; // Index for this schedule - std::string CoolSetBaseSchedName; // Name of the schedule which provides zone cooling setpoint base - int CSBchedIndex; // Index for this schedule - int NumOfHeatStages; // Number of heating stages - int NumOfCoolStages; // Number of cooling stages - Real64 HeatThroRange; // Heating throttling tempeature range - Real64 CoolThroRange; // Cooling throttling tempeature range - Array1D HeatTOffset; // Heating temperature offset - Array1D CoolTOffset; // Cooling temperature offset - Real64 HeatSetPoint; // Heating throttling tempeature range - Real64 CoolSetPoint; // Cooling throttling tempeature range - int StageErrCount; // Staged setpoint erro count - int StageErrIndex; // Staged setpoint erro index + std::string Name; // Name of the thermostat + std::string ZoneName; // Name of the zone + int ActualZoneNum; // Index number of zone + Sched::Schedule *heatSetptBaseSched = nullptr; // schedule which provides zone heating setpoint base + Sched::Schedule *coolSetptBaseSched = nullptr; // schedule which provides zone cooling setpoint base + int NumOfHeatStages; // Number of heating stages + int NumOfCoolStages; // Number of cooling stages + Real64 HeatThroRange; // Heating throttling tempeature range + Real64 CoolThroRange; // Cooling throttling tempeature range + Array1D HeatTOffset; // Heating temperature offset + Array1D CoolTOffset; // Cooling temperature offset + Real64 HeatSetPoint; // Heating throttling tempeature range + Real64 CoolSetPoint; // Cooling throttling tempeature range + int StageErrCount; // Staged setpoint erro count + int StageErrIndex; // Staged setpoint erro index // Default Constructor ZoneStagedControls() - : ActualZoneNum(0), HSBchedIndex(0), CSBchedIndex(0), NumOfHeatStages(0), NumOfCoolStages(0), HeatThroRange(0.0), CoolThroRange(0.0), - HeatSetPoint(0.0), CoolSetPoint(0.0), StageErrCount(0), StageErrIndex(0) + : ActualZoneNum(0), NumOfHeatStages(0), NumOfCoolStages(0), HeatThroRange(0.0), CoolThroRange(0.0), HeatSetPoint(0.0), CoolSetPoint(0.0), + StageErrCount(0), StageErrIndex(0) { } }; @@ -293,6 +280,10 @@ struct DataZoneControlsData : BaseGlobalStruct Array1D StagedTStatObjects; Array1D StageControlledZone; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataZoneEnergyDemands.cc b/src/EnergyPlus/DataZoneEnergyDemands.cc index 9f7a1da3eb2..53e32945bbc 100644 --- a/src/EnergyPlus/DataZoneEnergyDemands.cc +++ b/src/EnergyPlus/DataZoneEnergyDemands.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/DataZoneEnergyDemands.hh b/src/EnergyPlus/DataZoneEnergyDemands.hh index 13e84b63452..8544c0e2db5 100644 --- a/src/EnergyPlus/DataZoneEnergyDemands.hh +++ b/src/EnergyPlus/DataZoneEnergyDemands.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -172,6 +172,10 @@ struct DataZoneEnergyDemandsData : BaseGlobalStruct EPVector spaceSysEnergyDemand; EPVector spaceSysMoistureDemand; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DataZoneEquipment.cc b/src/EnergyPlus/DataZoneEquipment.cc index 12745c33139..c316d5f89f4 100644 --- a/src/EnergyPlus/DataZoneEquipment.cc +++ b/src/EnergyPlus/DataZoneEquipment.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -184,7 +184,6 @@ void GetZoneEquipmentData(EnergyPlusData &state) using NodeInputManager::GetOnlySingleNode; using NodeInputManager::InitUniqueNodeCheck; using namespace DataLoopNode; - using namespace ScheduleManager; // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetZoneEquipmentData: "); // include trailing blank space @@ -754,11 +753,15 @@ void processZoneEquipmentInput(EnergyPlusData &state, Array1D_int &NodeNums) { static constexpr std::string_view RoutineName("processZoneEquipmentInput: "); // include trailing blank space + static constexpr std::string_view routineName = "processZoneEquipmentInput"; + int spaceFieldShift = 0; if (isSpace) { spaceFieldShift = -1; } + ErrorObjectHeader eoh{routineName, zoneEqModuleObject, AlphArray(1)}; + thisEquipConfig.IsControlled = true; thisEquipConfig.ZoneName = AlphArray(1); // for x-referencing with the geometry data @@ -797,20 +800,10 @@ void processZoneEquipmentInput(EnergyPlusData &state, std::string ReturnNodeListName = AlphArray(6 + spaceFieldShift); if (lAlphaBlanks(7)) { - thisEquipConfig.ReturnFlowSchedPtrNum = ScheduleManager::ScheduleAlwaysOn; - } else { - thisEquipConfig.ReturnFlowSchedPtrNum = ScheduleManager::GetScheduleIndex(state, AlphArray(7 + spaceFieldShift)); - if (thisEquipConfig.ReturnFlowSchedPtrNum == 0) { - ShowSevereError(state, - format("{}{}: invalid {} entered ={} for {}={}", - RoutineName, - zoneEqModuleObject, - cAlphaFields(7), - AlphArray(7), - cAlphaFields(1), - AlphArray(1))); - state.dataZoneEquip->GetZoneEquipmentDataErrorsFound = true; - } + thisEquipConfig.returnFlowFracSched = Sched::GetScheduleAlwaysOn(state); // Not an availability sched, but defaults to constant-1.0 + } else if ((thisEquipConfig.returnFlowFracSched = Sched::GetSchedule(state, AlphArray(7 + spaceFieldShift))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(7), AlphArray(7)); + state.dataZoneEquip->GetZoneEquipmentDataErrorsFound = true; } std::string ReturnFlowBasisNodeListName = AlphArray(8 + spaceFieldShift); @@ -864,8 +857,8 @@ void processZoneEquipmentInput(EnergyPlusData &state, thisZoneEquipList.HeatingPriority.allocate(thisZoneEquipList.NumOfEquipTypes); thisZoneEquipList.CoolingCapacity.allocate(thisZoneEquipList.NumOfEquipTypes); thisZoneEquipList.HeatingCapacity.allocate(thisZoneEquipList.NumOfEquipTypes); - thisZoneEquipList.SequentialCoolingFractionSchedPtr.allocate(thisZoneEquipList.NumOfEquipTypes); - thisZoneEquipList.SequentialHeatingFractionSchedPtr.allocate(thisZoneEquipList.NumOfEquipTypes); + thisZoneEquipList.sequentialCoolingFractionScheds.allocate(thisZoneEquipList.NumOfEquipTypes); + thisZoneEquipList.sequentialHeatingFractionScheds.allocate(thisZoneEquipList.NumOfEquipTypes); for (int eqNum = 1; eqNum <= thisZoneEquipList.NumOfEquipTypes; ++eqNum) { thisZoneEquipList.EquipTypeName(eqNum) = ""; thisZoneEquipList.EquipType(eqNum) = DataZoneEquipment::ZoneEquipType::Invalid; @@ -877,8 +870,8 @@ void processZoneEquipmentInput(EnergyPlusData &state, thisZoneEquipList.HeatingPriority(eqNum) = 0; thisZoneEquipList.CoolingCapacity(eqNum) = 0; thisZoneEquipList.HeatingCapacity(eqNum) = 0; - thisZoneEquipList.SequentialCoolingFractionSchedPtr(eqNum) = 0; - thisZoneEquipList.SequentialHeatingFractionSchedPtr(eqNum) = 0; + thisZoneEquipList.sequentialCoolingFractionScheds(eqNum) = nullptr; + thisZoneEquipList.sequentialHeatingFractionScheds(eqNum) = nullptr; } auto const &extensionSchemaProps = objectSchemaProps["equipment"]["items"]["properties"]; @@ -935,15 +928,12 @@ void processZoneEquipmentInput(EnergyPlusData &state, std::string coolingSchName = ip->getAlphaFieldValue(extensibleInstance, extensionSchemaProps, "zone_equipment_sequential_cooling_fraction_schedule_name"); if (coolingSchName.empty()) { - thisZoneEquipList.SequentialCoolingFractionSchedPtr(ZoneEquipTypeNum) = ScheduleManager::ScheduleAlwaysOn; + thisZoneEquipList.sequentialCoolingFractionScheds(ZoneEquipTypeNum) = + Sched::GetScheduleAlwaysOn(state); // Not an availability schedule, but defaults to constant-1.0 } else { - thisZoneEquipList.SequentialCoolingFractionSchedPtr(ZoneEquipTypeNum) = - ScheduleManager::GetScheduleIndex(state, coolingSchName); - if (thisZoneEquipList.SequentialCoolingFractionSchedPtr(ZoneEquipTypeNum) == 0) { - ShowSevereError(state, format("{}{} = \"{}\".", RoutineName, CurrentModuleObject, thisZoneEquipList.Name)); - ShowContinueError(state, - format("invalid zone_equipment_sequential_cooling_fraction_schedule_name=[{}].", coolingSchName)); - ShowContinueError(state, "Schedule does not exist."); + thisZoneEquipList.sequentialCoolingFractionScheds(ZoneEquipTypeNum) = Sched::GetSchedule(state, coolingSchName); + if (thisZoneEquipList.sequentialCoolingFractionScheds(ZoneEquipTypeNum) == nullptr) { + ShowSevereItemNotFound(state, eoh, "zone_equipment_sequential_cooling_fraction_schedule_name", coolingSchName); state.dataZoneEquip->GetZoneEquipmentDataErrorsFound = true; } } @@ -951,15 +941,12 @@ void processZoneEquipmentInput(EnergyPlusData &state, std::string heatingSchName = ip->getAlphaFieldValue(extensibleInstance, extensionSchemaProps, "zone_equipment_sequential_heating_fraction_schedule_name"); if (heatingSchName.empty()) { - thisZoneEquipList.SequentialHeatingFractionSchedPtr(ZoneEquipTypeNum) = ScheduleManager::ScheduleAlwaysOn; + thisZoneEquipList.sequentialHeatingFractionScheds(ZoneEquipTypeNum) = + Sched::GetScheduleAlwaysOn(state); // Not an availability schedule, but defaults to constant-1.0 } else { - thisZoneEquipList.SequentialHeatingFractionSchedPtr(ZoneEquipTypeNum) = - ScheduleManager::GetScheduleIndex(state, heatingSchName); - if (thisZoneEquipList.SequentialHeatingFractionSchedPtr(ZoneEquipTypeNum) == 0) { - ShowSevereError(state, format("{}{} = \"{}\".", RoutineName, CurrentModuleObject, thisZoneEquipList.Name)); - ShowContinueError(state, - format("invalid zone_equipment_sequential_heating_fraction_schedule_name=[{}].", coolingSchName)); - ShowContinueError(state, "Schedule does not exist."); + thisZoneEquipList.sequentialHeatingFractionScheds(ZoneEquipTypeNum) = Sched::GetSchedule(state, heatingSchName); + if (thisZoneEquipList.sequentialHeatingFractionScheds(ZoneEquipTypeNum) == nullptr) { + ShowSevereItemNotFound(state, eoh, "zone_equipment_sequential_heating_fraction_schedule_name", coolingSchName); state.dataZoneEquip->GetZoneEquipmentDataErrorsFound = true; } } @@ -1735,14 +1722,14 @@ void EquipList::getPrioritiesForInletNode(EnergyPlusData &state, state.dataHVACGlobal->MinAirLoopIterationsAfterFirst = minIterations; } -Real64 EquipList::SequentialHeatingFraction(EnergyPlusData &state, const int equipNum) +Real64 EquipList::SequentialHeatingFraction([[maybe_unused]] EnergyPlusData &state, const int equipNum) { - return ScheduleManager::GetCurrentScheduleValue(state, SequentialHeatingFractionSchedPtr(equipNum)); + return sequentialHeatingFractionScheds(equipNum)->getCurrentVal(); } -Real64 EquipList::SequentialCoolingFraction(EnergyPlusData &state, const int equipNum) +Real64 EquipList::SequentialCoolingFraction([[maybe_unused]] EnergyPlusData &state, const int equipNum) { - return ScheduleManager::GetCurrentScheduleValue(state, SequentialCoolingFractionSchedPtr(equipNum)); + return sequentialCoolingFractionScheds(equipNum)->getCurrentVal(); } int GetZoneEquipControlledZoneNum(EnergyPlusData &state, DataZoneEquipment::ZoneEquipType const zoneEquipType, std::string const &EquipmentName) @@ -2022,12 +2009,16 @@ void ZoneEquipmentSplitter::adjustLoads(EnergyPlusData &state, int zoneNum, int { auto &thisZoneEnergyDemand = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(zoneNum); auto &thisZoneMoistureDemand = state.dataZoneEnergyDemand->ZoneSysMoistureDemand(zoneNum); + + auto &zoneTstatSetpt = state.dataHeatBalFanSys->zoneTstatSetpts(zoneNum); + Real64 sensibleRatio = 1.0; Real64 latentRatio = 1.0; switch (this->tstatControl) { - case DataZoneEquipment::ZoneEquipTstatControl::Ideal: + case DataZoneEquipment::ZoneEquipTstatControl::Ideal: { return; - break; // Do nothing + } break; // Do nothing + case DataZoneEquipment::ZoneEquipTstatControl::SingleSpace: { Real64 controlSpaceFrac = this->spaces[this->controlSpaceNumber].fraction; if (controlSpaceFrac > 0.0) { @@ -2043,6 +2034,7 @@ void ZoneEquipmentSplitter::adjustLoads(EnergyPlusData &state, int zoneNum, int } } } break; + case DataZoneEquipment::ZoneEquipTstatControl::Maximum: { int maxSpaceIndex = 0; Real64 maxDeltaTemp = 0.0; // Only positive deltaTemps are relevant @@ -2050,8 +2042,7 @@ void ZoneEquipmentSplitter::adjustLoads(EnergyPlusData &state, int zoneNum, int for (auto &splitterSpace : this->spaces) { Real64 spaceTemp = state.dataZoneTempPredictorCorrector->spaceHeatBalance(splitterSpace.spaceIndex).T1; // Based on calcPredictedSystemLoad usage - Real64 spaceDeltaTemp = max((state.dataHeatBalFanSys->ZoneThermostatSetPointLo(zoneNum) - spaceTemp), - (spaceTemp - state.dataHeatBalFanSys->ZoneThermostatSetPointHi(zoneNum))); + Real64 spaceDeltaTemp = max((zoneTstatSetpt.setptLo - spaceTemp), (spaceTemp - zoneTstatSetpt.setptHi)); if (spaceDeltaTemp > maxDeltaTemp) { maxSpaceIndex = splitterSpace.spaceIndex; maxSpaceFrac = splitterSpace.fraction; @@ -2236,7 +2227,7 @@ void EquipConfiguration::calcReturnFlows(EnergyPlusData &state, Real64 totReturnFlow = 0.0; // Total flow to all return nodes in the zone (kg/s) Real64 totVarReturnFlow = 0.0; // Total variable return flow, for return nodes connected to an airloop with an OA system or not with specified flow (kg/s) - Real64 returnSchedFrac = ScheduleManager::GetCurrentScheduleValue(state, this->ReturnFlowSchedPtrNum); + Real64 returnSchedFrac = this->returnFlowFracSched->getCurrentVal(); this->FixedReturnFlow = false; FinalTotalReturnMassFlow = 0.0; this->TotAvailAirLoopOA = 0.0; diff --git a/src/EnergyPlus/DataZoneEquipment.hh b/src/EnergyPlus/DataZoneEquipment.hh index 282de4e6652..226e7d5bca3 100644 --- a/src/EnergyPlus/DataZoneEquipment.hh +++ b/src/EnergyPlus/DataZoneEquipment.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -310,14 +310,14 @@ namespace DataZoneEquipment { int EquipListIndex; std::string ControlListName; int ZoneNode; - int NumInletNodes; // number of inlet nodes - int NumExhaustNodes; // number of exhaust nodes - int NumReturnNodes; // number of return air nodes - int NumReturnFlowBasisNodes; // number of return air flow basis nodes - int ReturnFlowSchedPtrNum; // return air flow fraction schedule pointer - bool FlowError; // flow error flag - Array1D_int InletNode; // zone supply air inlet nodes - Array1D_int InletNodeAirLoopNum; // air loop number connected to this inlet node (0 if not an airloop node) + int NumInletNodes; // number of inlet nodes + int NumExhaustNodes; // number of exhaust nodes + int NumReturnNodes; // number of return air nodes + int NumReturnFlowBasisNodes; // number of return air flow basis nodes + Sched::Schedule *returnFlowFracSched = nullptr; // return air flow fraction schedule pointer + bool FlowError; // flow error flag + Array1D_int InletNode; // zone supply air inlet nodes + Array1D_int InletNodeAirLoopNum; // air loop number connected to this inlet node (0 if not an airloop node) Array1D_int InletNodeADUNum; // AirDistUnit connected to this inlet node (0 if not an ADU node, could be zone equip or direct air) Array1D_int ExhaustNode; // zone air exhaust nodes Array1D_int ReturnNode; // zone return air nodes (node numbers) @@ -363,10 +363,10 @@ namespace DataZoneEquipment { // Default Constructor EquipConfiguration() : ZoneName("Uncontrolled Zone"), EquipListIndex(0), ZoneNode(0), NumInletNodes(0), NumExhaustNodes(0), NumReturnNodes(0), - NumReturnFlowBasisNodes(0), ReturnFlowSchedPtrNum(0), FlowError(false), ZonalSystemOnly(false), IsControlled(false), ZoneExh(0.0), - ZoneExhBalanced(0.0), PlenumMassFlow(0.0), ExcessZoneExh(0.0), TotAvailAirLoopOA(0.0), TotInletAirMassFlowRate(0.0), - TotExhaustAirMassFlowRate(0.0), InFloorActiveElement(false), InWallActiveElement(false), InCeilingActiveElement(false), - ZoneHasAirLoopWithOASys(false), ZoneAirDistributionIndex(0), ZoneDesignSpecOAIndex(0), AirLoopDesSupply(0.0) + NumReturnFlowBasisNodes(0), FlowError(false), ZonalSystemOnly(false), IsControlled(false), ZoneExh(0.0), ZoneExhBalanced(0.0), + PlenumMassFlow(0.0), ExcessZoneExh(0.0), TotAvailAirLoopOA(0.0), TotInletAirMassFlowRate(0.0), TotExhaustAirMassFlowRate(0.0), + InFloorActiveElement(false), InWallActiveElement(false), InCeilingActiveElement(false), ZoneHasAirLoopWithOASys(false), + ZoneAirDistributionIndex(0), ZoneDesignSpecOAIndex(0), AirLoopDesSupply(0.0) { } @@ -430,8 +430,8 @@ namespace DataZoneEquipment { std::vector compPointer; Array1D_int CoolingPriority; Array1D_int HeatingPriority; - Array1D_int SequentialCoolingFractionSchedPtr; - Array1D_int SequentialHeatingFractionSchedPtr; + Array1D sequentialCoolingFractionScheds; + Array1D sequentialHeatingFractionScheds; Array1D_int CoolingCapacity; // Current cooling capacity (negative) [W] Array1D_int HeatingCapacity; // Current heating capacity (positive) [W] Array1D EquipData; // Index of energy output report data @@ -649,6 +649,10 @@ struct DataZoneEquipmentData : BaseGlobalStruct std::vector zoneEquipMixer; std::vector zoneReturnMixer; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DaylightingDevices.cc b/src/EnergyPlus/DaylightingDevices.cc index 37a8942ad32..3ef01c6439e 100644 --- a/src/EnergyPlus/DaylightingDevices.cc +++ b/src/EnergyPlus/DaylightingDevices.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -159,7 +159,7 @@ namespace Dayltg { // sky is conveniently given by SurfAnisoSkyMult. NOTE: The solar shading code was modified to allow sunlit // fraction, sunlit area, SurfAnisoSkyMult, etc. to be calculated for attached shading surfaces. // Future shelf model improvements: - // 1. Allow beam and downgoing flux to pass the end of the inside shelf depending on actual shelf goemetry. + // 1. Allow beam and downgoing flux to pass the end of the inside shelf depending on actual shelf geometry. // 2. Reduce outside shelf view factor to sky (for daylighting) by taking into account anisotropic sky // distribution and shading, i.e. the daylighting equivalent of SurfAnisoSkyMult. // 3. Expand view factor to shelf calculation to handle more complicated geometry. @@ -210,8 +210,8 @@ namespace Dayltg { state.dataDaylightingDevices->COSAngle(1) = 0.0; state.dataDaylightingDevices->COSAngle(NumOfAngles) = 1.0; - Real64 dTheta = 90.0 * Constant::DegToRadians / (NumOfAngles - 1.0); - Real64 Theta = 90.0 * Constant::DegToRadians; + Real64 dTheta = 90.0 * Constant::DegToRad / (NumOfAngles - 1.0); + Real64 Theta = 90.0 * Constant::DegToRad; for (int AngleNum = 2; AngleNum <= NumOfAngles - 1; ++AngleNum) { Theta -= dTheta; state.dataDaylightingDevices->COSAngle(AngleNum) = std::cos(Theta); @@ -256,7 +256,7 @@ namespace Dayltg { TDDPipeStored(NumStored).TransBeam(NumOfAngles) = 1.0; // Calculate intermediate beam transmittances between 0 and 90 degrees - Theta = 90.0 * Constant::DegToRadians; + Theta = 90.0 * Constant::DegToRad; for (int AngleNum = 2; AngleNum <= NumOfAngles - 1; ++AngleNum) { Theta -= dTheta; TDDPipeStored(NumStored).TransBeam(AngleNum) = @@ -752,10 +752,10 @@ namespace Dayltg { } // PipeNum if (state.dataDaylightingDevices->GetTDDInputErrorsFound) ShowFatalError(state, "Errors in DaylightingDevice:Tubular input."); - state.dataDayltg->TDDTransVisBeam.allocate(Constant::HoursInDay, NumOfTDDPipes); - state.dataDayltg->TDDFluxInc.allocate(Constant::HoursInDay, NumOfTDDPipes); - state.dataDayltg->TDDFluxTrans.allocate(Constant::HoursInDay, NumOfTDDPipes); - for (int hr = 1; hr <= Constant::HoursInDay; ++hr) { + state.dataDayltg->TDDTransVisBeam.allocate(Constant::iHoursInDay, NumOfTDDPipes); + state.dataDayltg->TDDFluxInc.allocate(Constant::iHoursInDay, NumOfTDDPipes); + state.dataDayltg->TDDFluxTrans.allocate(Constant::iHoursInDay, NumOfTDDPipes); + for (int hr = 1; hr <= Constant::iHoursInDay; ++hr) { for (int tddNum = 1; tddNum <= NumOfTDDPipes; ++tddNum) { state.dataDayltg->TDDTransVisBeam(hr, tddNum) = 0.0; state.dataDayltg->TDDFluxInc(hr, tddNum) = Illums(); @@ -919,7 +919,7 @@ namespace Dayltg { state.dataDaylightingDevices->GetShelfInputErrorsFound = true; } - if (state.dataSurface->Surface(SurfNum).SchedShadowSurfIndex > 0) { + if (state.dataSurface->Surface(SurfNum).shadowSurfSched != nullptr) { ShowSevereError(state, format("{} = {}: Outside shelf {} must not have a transmittance schedule.", cCurrentModuleObject, @@ -1129,8 +1129,8 @@ namespace Dayltg { Real64 COSI; // Cosine of incident angle Real64 SINI; // Sine of incident angle - Real64 const dPH = 90.0 * Constant::DegToRadians / NPH; // Altitude angle of sky element - Real64 PH = 0.5 * dPH; // Altitude angle increment + Real64 const dPH = 90.0 * Constant::DegToRad / NPH; // Altitude angle of sky element + Real64 PH = 0.5 * dPH; // Altitude angle increment // Integrate from 0 to Pi/2 altitude for (int N = 1; N <= NPH; ++N) { @@ -1194,15 +1194,15 @@ namespace Dayltg { Real64 Theta; // TDD:DOME azimuth angle CosPhi = std::cos(Constant::PiOvr2 - - state.dataSurface->Surface(state.dataDaylightingDevicesData->TDDPipe(PipeNum).Dome).Tilt * Constant::DegToRadians); - Theta = state.dataSurface->Surface(state.dataDaylightingDevicesData->TDDPipe(PipeNum).Dome).Azimuth * Constant::DegToRadians; + state.dataSurface->Surface(state.dataDaylightingDevicesData->TDDPipe(PipeNum).Dome).Tilt * Constant::DegToRad); + Theta = state.dataSurface->Surface(state.dataDaylightingDevicesData->TDDPipe(PipeNum).Dome).Azimuth * Constant::DegToRad; if (CosPhi > 0.01) { // Dome has a view of the horizon // Integrate over the semicircle Real64 const THMIN = Theta - Constant::PiOvr2; // Minimum azimuth integration limit // Real64 const THMAX = Theta + PiOvr2; // Maximum azimuth integration limit - Real64 const dTH = 180.0 * Constant::DegToRadians / NTH; // Azimuth angle increment - Real64 TH = THMIN + 0.5 * dTH; // Azimuth angle of sky horizon element + Real64 const dTH = 180.0 * Constant::DegToRad / NTH; // Azimuth angle increment + Real64 TH = THMIN + 0.5 * dTH; // Azimuth angle of sky horizon element for (int N = 1; N <= NTH; ++N) { // Calculate incident angle between dome outward normal and horizon element @@ -1328,9 +1328,6 @@ namespace Dayltg { // Swift, P. D., and Smith, G. B. "Cylindrical Mirror Light Pipes", // Solar Energy Materials and Solar Cells 36 (1995), pp. 159-168. - // Using/Aliasing - using General::POLYF; - // Return value Real64 TransTDD; @@ -1353,7 +1350,7 @@ namespace Dayltg { // Get the transmittance of each component and of total TDD switch (RadiationType) { case RadType::VisibleBeam: { - transDome = POLYF(COSI, state.dataConstruction->Construct(constDome).TransVisBeamCoef); + transDome = Window::POLYF(COSI, state.dataConstruction->Construct(constDome).TransVisBeamCoef); transPipe = InterpolatePipeTransBeam(state, COSI, state.dataDaylightingDevicesData->TDDPipe(PipeNum).PipeTransVisBeam); transDiff = state.dataConstruction->Construct(constDiff).TransDiffVis; // May want to change to POLYF also! @@ -1361,7 +1358,7 @@ namespace Dayltg { } break; case RadType::SolarBeam: { - transDome = POLYF(COSI, state.dataConstruction->Construct(constDome).TransSolBeamCoef); + transDome = Window::POLYF(COSI, state.dataConstruction->Construct(constDome).TransSolBeamCoef); transPipe = InterpolatePipeTransBeam(state, COSI, state.dataDaylightingDevicesData->TDDPipe(PipeNum).PipeTransSolBeam); transDiff = state.dataConstruction->Construct(constDiff).TransDiff; // May want to change to POLYF also! @@ -1400,7 +1397,7 @@ namespace Dayltg { // REFERENCES: na // Using/Aliasing - using FluidProperties::FindArrayIndex; // USEd code could be copied here to eliminate dependence on FluidProperties + using Fluid::FindArrayIndex; // USEd code could be copied here to eliminate dependence on FluidProperties // Return value Real64 InterpolatePipeTransBeam; @@ -1789,7 +1786,7 @@ namespace Dayltg { // DATE WRITTEN Dec 2011 // PURPOSE OF THIS SUBROUTINE: - // intialize zone gains at begin new environment + // initialize zone gains at begin new environment // SUBROUTINE LOCAL VARIABLE DECLARATIONS: diff --git a/src/EnergyPlus/DaylightingDevices.hh b/src/EnergyPlus/DaylightingDevices.hh index 949ad96e7f1..da09a5d0ea5 100644 --- a/src/EnergyPlus/DaylightingDevices.hh +++ b/src/EnergyPlus/DaylightingDevices.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -112,6 +112,10 @@ struct DaylightingDevicesData : BaseGlobalStruct bool GetShelfInputErrorsFound = false; // Set to true if errors in input, fatal at end of routine bool MyEnvrnFlag = true; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DaylightingManager.cc b/src/EnergyPlus/DaylightingManager.cc index 8718da982b4..260c2d4dacb 100644 --- a/src/EnergyPlus/DaylightingManager.cc +++ b/src/EnergyPlus/DaylightingManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -449,7 +449,7 @@ void CalcDayltgCoefficients(EnergyPlusData &state) // Zero daylighting factor arrays if (numTDD > 0) { int iHrBeg = state.dataSysVars->DetailedSolarTimestepIntegration ? state.dataGlobal->HourOfDay : 1; - int iHrEnd = state.dataSysVars->DetailedSolarTimestepIntegration ? state.dataGlobal->HourOfDay : Constant::HoursInDay; + int iHrEnd = state.dataSysVars->DetailedSolarTimestepIntegration ? state.dataGlobal->HourOfDay : Constant::iHoursInDay; for (int iHr = iHrBeg; iHr <= iHrEnd; ++iHr) { for (int iTDD = 1; iTDD <= numTDD; ++iTDD) { dl->TDDTransVisBeam(iHr, iTDD) = 0.0; @@ -465,7 +465,7 @@ void CalcDayltgCoefficients(EnergyPlusData &state) dl->sunAngles = SunAngles(); dl->sunAnglesHr = {SunAngles()}; dl->horIllum = {Illums()}; - for (int IHR = 1; IHR <= Constant::HoursInDay; ++IHR) { + for (int IHR = 1; IHR <= Constant::iHoursInDay; ++IHR) { auto const &surfSunCosHr = s_surf->SurfSunCosHourly(IHR); if (surfSunCosHr.z < DataEnvironment::SunIsUpValue) continue; // Skip if sun is below horizon //Autodesk SurfSunCosHourly was uninitialized here @@ -604,7 +604,7 @@ void CalcDayltgCoefficients(EnergyPlusData &state) s_surf->Surface(windowSurfNum).Name); } - for (int IHR = 1; IHR <= Constant::HoursInDay; ++IHR) { + for (int IHR = 1; IHR <= Constant::iHoursInDay; ++IHR) { // For each Daylight Reference Point auto &daylFacHr = thisDayltgCtrl.daylFac[IHR]; for (int refPtNum = 1; refPtNum <= thisDayltgCtrl.TotalDaylRefPoints; ++refPtNum) { @@ -776,7 +776,7 @@ void CalcDayltgCoeffsRefPoints(EnergyPlusData &state, int const daylightCtrlNum) // Azimuth of view vector in absolute coord sys Real64 AZVIEW = (thisDayltgCtrl.ViewAzimuthForGlare + state.dataHeatBal->Zone(zoneNum).RelNorth + state.dataHeatBal->BuildingAzimuth + state.dataHeatBal->BuildingRotationAppendixG) * - Constant::DegToRadians; + Constant::DegToRad; // View vector components in absolute coord sys VIEWVC = {std::sin(AZVIEW), std::cos(AZVIEW), 0.0}; @@ -790,7 +790,7 @@ void CalcDayltgCoeffsRefPoints(EnergyPlusData &state, int const daylightCtrlNum) } int iHrBeg = state.dataSysVars->DetailedSolarTimestepIntegration ? state.dataGlobal->HourOfDay : 1; - int iHrEnd = state.dataSysVars->DetailedSolarTimestepIntegration ? state.dataGlobal->HourOfDay : Constant::HoursInDay; + int iHrEnd = state.dataSysVars->DetailedSolarTimestepIntegration ? state.dataGlobal->HourOfDay : Constant::iHoursInDay; int numExtWins = thisEnclDaylight.NumOfDayltgExtWins; int numRefPts = thisDayltgCtrl.TotalDaylRefPoints; @@ -922,7 +922,7 @@ void CalcDayltgCoeffsRefPoints(EnergyPlusData &state, int const daylightCtrlNum) if (!state.dataSysVars->DetailedSolarTimestepIntegration) { ISunPos = 0; - for (int IHR = 1; IHR <= Constant::HoursInDay; ++IHR) { + for (int IHR = 1; IHR <= Constant::iHoursInDay; ++IHR) { FigureDayltgCoeffsAtPointsForSunPosition(state, daylightCtrlNum, @@ -1024,7 +1024,7 @@ void CalcDayltgCoeffsRefPoints(EnergyPlusData &state, int const daylightCtrlNum) if (!state.dataSysVars->DetailedSolarTimestepIntegration) { ISunPos = 0; - for (int IHR = 1; IHR <= Constant::HoursInDay; ++IHR) { + for (int IHR = 1; IHR <= Constant::iHoursInDay; ++IHR) { FigureRefPointDayltgFactorsToAddIllums(state, daylightCtrlNum, ILB, IHR, ISunPos, IWin, loopwin, NWX, NWY, ICtrl); } // End of sun position loop, IHR @@ -1150,7 +1150,7 @@ void CalcDayltgCoeffsMapPoints(EnergyPlusData &state, int const mapNum) } int iHrBeg = state.dataSysVars->DetailedSolarTimestepIntegration ? state.dataGlobal->HourOfDay : 1; - int iHrEnd = state.dataSysVars->DetailedSolarTimestepIntegration ? state.dataGlobal->HourOfDay : Constant::HoursInDay; + int iHrEnd = state.dataSysVars->DetailedSolarTimestepIntegration ? state.dataGlobal->HourOfDay : Constant::iHoursInDay; for (int iHr = iHrBeg; iHr <= iHrEnd; ++iHr) { auto &daylFacHr = illumMap.daylFac[iHr]; @@ -1276,7 +1276,7 @@ void CalcDayltgCoeffsMapPoints(EnergyPlusData &state, int const mapNum) // that do not depend on sun position. if (!state.dataSysVars->DetailedSolarTimestepIntegration) { ISunPos = 0; - for (int IHR = 1; IHR <= Constant::HoursInDay; ++IHR) { + for (int IHR = 1; IHR <= Constant::iHoursInDay; ++IHR) { // daylightingCtrlNum parameter is unused for map points FigureDayltgCoeffsAtPointsForSunPosition(state, 0, @@ -1375,7 +1375,7 @@ void CalcDayltgCoeffsMapPoints(EnergyPlusData &state, int const mapNum) // direct and inter-reflected illum components, then dividing by exterior horiz illum. // Also calculate corresponding glare factors. ILB = IL; - for (int IHR = 1; IHR <= Constant::HoursInDay; ++IHR) { + for (int IHR = 1; IHR <= Constant::iHoursInDay; ++IHR) { FigureMapPointDayltgFactorsToAddIllums(state, mapNum, ILB, IHR, IWin, loopwin, ICtrl); } // End of sun position loop, IHR } else { @@ -1526,7 +1526,7 @@ void FigureDayltgCoeffsAtPointsSetupForWindow(EnergyPlusData &state, LSHCAL = 0; // Visible transmittance at normal incidence - s_surf->SurfWinVisTransSelected(IWin) = General::POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac; + s_surf->SurfWinVisTransSelected(IWin) = Window::POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac; // For windows with switchable glazing, ratio of visible transmittance at normal // incidence for fully switched (dark) state to that of unswitched state s_surf->SurfWinVisTransRatio(IWin) = 1.0; @@ -1534,8 +1534,8 @@ void FigureDayltgCoeffsAtPointsSetupForWindow(EnergyPlusData &state, if (ShType == WinShadingType::SwitchableGlazing) { int IConstShaded = surf.activeShadedConstruction; // Shaded construction counter s_surf->SurfWinVisTransRatio(IWin) = - General::SafeDivide(General::POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef), - General::POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef)); + General::SafeDivide(Window::POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef), + Window::POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef)); } } @@ -1759,7 +1759,7 @@ void FigureDayltgCoeffsAtPointsSetupForWindow(EnergyPlusData &state, } int iHrBeg = state.dataSysVars->DetailedSolarTimestepIntegration ? state.dataGlobal->HourOfDay : 1; - int iHrEnd = state.dataSysVars->DetailedSolarTimestepIntegration ? state.dataGlobal->HourOfDay : Constant::HoursInDay; + int iHrEnd = state.dataSysVars->DetailedSolarTimestepIntegration ? state.dataGlobal->HourOfDay : Constant::iHoursInDay; for (int iHr = iHrBeg; iHr <= iHrEnd; ++iHr) { // Initialize sky and sun components of direct illuminance (arrays EDIRSK, EDIRSU, EDIRSUdisk) @@ -1929,7 +1929,7 @@ void FigureDayltgCoeffsAtPointsForWindowElements( } else { // Regular window if (s_surf->SurfWinWindowModelType(IWin) != WindowModel::BSDF) { // Vis trans of glass for COSB incidence angle - TVISB = General::POLYF(COSB, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac * surfWin.lightWellEff; + TVISB = Window::POLYF(COSB, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac * surfWin.lightWellEff; } else { // Complex fenestration needs to use different equation for visible transmittance. That will be calculated later // in the code since it depends on different incoming directions. For now, just put zero to differentiate from @@ -1963,7 +1963,7 @@ void FigureDayltgCoeffsAtPointsForWindowElements( IntWinHitNum = 0; continue; } - TVISIntWin = General::POLYF(COSBIntWin, state.dataConstruction->Construct(surfIntWin.Construction).TransVisBeamCoef); + TVISIntWin = Window::POLYF(COSBIntWin, state.dataConstruction->Construct(surfIntWin.Construction).TransVisBeamCoef); TVISB *= TVISIntWin; break; // Ray passes thru interior window; exit from DO loop } @@ -2107,7 +2107,7 @@ void InitializeCFSDaylighting(EnergyPlusData &state, int zoneNum = dl->daylightControl(daylightCtrlNum).zoneIndex; Real64 AZVIEW = (dl->daylightControl(daylightCtrlNum).ViewAzimuthForGlare + state.dataHeatBal->Zone(zoneNum).RelNorth + state.dataHeatBal->BuildingAzimuth + state.dataHeatBal->BuildingRotationAppendixG) * - Constant::DegToRadians; + Constant::DegToRad; // Perform necessary calculations for window coordinates and vectors. This will be used to calculate centroids for // each window element @@ -2341,7 +2341,7 @@ void InitializeCFSStateData(EnergyPlusData &state, V = HitPt - Centroid; // vector array from window ctr to hit pt LeastHitDsq = V.magnitude_squared(); // dist^2 window ctr to hit pt TmpHSurfDSq(1, NReflSurf) = LeastHitDsq; - if (!surf2.HeatTransSurf && surf2.SchedShadowSurfIndex != 0) { + if (!surf2.HeatTransSurf && surf2.shadowSurfSched != nullptr) { TransRSurf = 1.0; // If a shadowing surface may have a scheduled transmittance, treat it here as completely transparent } else { TransRSurf = 0.0; @@ -2359,7 +2359,7 @@ void InitializeCFSStateData(EnergyPlusData &state, break; } } - if (!surf2.HeatTransSurf && surf2.SchedShadowSurfIndex == 0) { + if (!surf2.HeatTransSurf && surf2.shadowSurfSched == nullptr) { // The new hit is opaque, so we can drop all the hits further away TmpHSurfNo(J, NReflSurf) = JSurf; TmpHitPt(J, NReflSurf) = HitPt; @@ -2387,7 +2387,7 @@ void InitializeCFSStateData(EnergyPlusData &state, // A new closest hit. If it is opaque, drop the current hit list, // otherwise add it at the front LeastHitDsq = HitDsq; - if (!surf2.HeatTransSurf && surf2.SchedShadowSurfIndex != 0) { + if (!surf2.HeatTransSurf && surf2.shadowSurfSched != nullptr) { TransRSurf = 1.0; // New closest hit is transparent, keep the existing hit list for (int I = TotHits; I >= 1; --I) { TmpHSurfNo(I + 1, NReflSurf) = TmpHSurfNo(I, NReflSurf); @@ -3114,7 +3114,7 @@ void FigureDayltgCoeffsAtPointsForSunPosition( continue; } TVISIntWinDisk = - General::POLYF(COSBIntWin, state.dataConstruction->Construct(surfIntWinDisk.Construction).TransVisBeamCoef); + Window::POLYF(COSBIntWin, state.dataConstruction->Construct(surfIntWinDisk.Construction).TransVisBeamCoef); break; } // for (IntWinDisk) } // for (spaceNum) @@ -3170,7 +3170,7 @@ void FigureDayltgCoeffsAtPointsForSunPosition( TVISS = 0.0; } else { // Beam transmittance for bare window and all types of blinds - TVISS = General::POLYF(COSI, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac * + TVISS = Window::POLYF(COSI, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac * surfWin.lightWellEff; if (extWinType == ExtWinType::AdjZone && hitIntWinDisk) TVISS *= TVISIntWinDisk; } @@ -3343,15 +3343,15 @@ void FigureDayltgCoeffsAtPointsForSunPosition( if (s_surf->Surface(ReflSurfNum).Class == SurfaceClass::Window) { int const ConstrNumRefl = s_surf->SurfActiveConstruction(ReflSurfNum); SpecReflectance = - General::POLYF(std::abs(CosIncAngRefl), state.dataConstruction->Construct(ConstrNumRefl).ReflSolBeamFrontCoef); + Window::POLYF(std::abs(CosIncAngRefl), state.dataConstruction->Construct(ConstrNumRefl).ReflSolBeamFrontCoef); } if (s_surf->Surface(ReflSurfNum).IsShadowing && s_surf->SurfShadowGlazingConstruct(ReflSurfNum) > 0) SpecReflectance = s_surf->SurfShadowGlazingFrac(ReflSurfNum) * - General::POLYF( + Window::POLYF( std::abs(CosIncAngRefl), state.dataConstruction->Construct(s_surf->SurfShadowGlazingConstruct(ReflSurfNum)).ReflSolBeamFrontCoef); - TVisRefl = General::POLYF(CosIncAngRec, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac * + TVisRefl = Window::POLYF(CosIncAngRec, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac * surfWin.lightWellEff; dl->dirIllum(iHour)[iWinCover_Bare].sunDisk += SunVecMir.z * SpecReflectance * TVisRefl; // Bare window @@ -3659,10 +3659,10 @@ void GetDaylightingParametersInput(EnergyPlusData &state) if (!dl->getDaylightingParametersInputFlag) return; dl->getDaylightingParametersInputFlag = false; - auto const &ipsc = state.dataIPShortCut; - ipsc->cCurrentModuleObject = "Daylighting:Controls"; + auto const &s_ipsc = state.dataIPShortCut; + s_ipsc->cCurrentModuleObject = "Daylighting:Controls"; bool ErrorsFound = false; - int TotDaylightingControls = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, ipsc->cCurrentModuleObject); + int TotDaylightingControls = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); if (TotDaylightingControls > 0) { dl->enclDaylight.allocate(state.dataViewFactor->NumOfSolarEnclosures); GetInputDayliteRefPt(state, ErrorsFound); @@ -3911,27 +3911,27 @@ void GetDaylightingParametersInput(EnergyPlusData &state) // RJH DElight Modification End - Calls to DElight preprocessing subroutines // TH 6/3/2010, added to report daylight factors - ipsc->cCurrentModuleObject = "Output:DaylightFactors"; - int NumReports = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, ipsc->cCurrentModuleObject); + s_ipsc->cCurrentModuleObject = "Output:DaylightFactors"; + int NumReports = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); if (NumReports > 0) { int NumNames; int NumNumbers; int IOStat; state.dataInputProcessing->inputProcessor->getObjectItem(state, - ipsc->cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, 1, - ipsc->cAlphaArgs, + s_ipsc->cAlphaArgs, NumNames, - ipsc->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStat, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); - if (has_prefix(ipsc->cAlphaArgs(1), "SIZINGDAYS")) { + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + if (has_prefix(s_ipsc->cAlphaArgs(1), "SIZINGDAYS")) { dl->DFSReportSizingDays = true; - } else if (has_prefix(ipsc->cAlphaArgs(1), "ALLSHADOWCALCULATIONDAYS")) { + } else if (has_prefix(s_ipsc->cAlphaArgs(1), "ALLSHADOWCALCULATIONDAYS")) { dl->DFSReportAllShadowCalculationDays = true; } } @@ -3948,11 +3948,11 @@ void GetInputIlluminanceMap(EnergyPlusData &state, bool &ErrorsFound) Array1D_bool ZoneMsgDone; - Real64 CosBldgRelNorth = std::cos(-(state.dataHeatBal->BuildingAzimuth + state.dataHeatBal->BuildingRotationAppendixG) * Constant::DegToRadians); - Real64 SinBldgRelNorth = std::sin(-(state.dataHeatBal->BuildingAzimuth + state.dataHeatBal->BuildingRotationAppendixG) * Constant::DegToRadians); + Real64 CosBldgRelNorth = std::cos(-(state.dataHeatBal->BuildingAzimuth + state.dataHeatBal->BuildingRotationAppendixG) * Constant::DegToRad); + Real64 SinBldgRelNorth = std::sin(-(state.dataHeatBal->BuildingAzimuth + state.dataHeatBal->BuildingRotationAppendixG) * Constant::DegToRad); // these are only for Building Rotation for Appendix G when using world coordinate system - Real64 CosBldgRotAppGonly = std::cos(-state.dataHeatBal->BuildingRotationAppendixG * Constant::DegToRadians); - Real64 SinBldgRotAppGonly = std::sin(-state.dataHeatBal->BuildingRotationAppendixG * Constant::DegToRadians); + Real64 CosBldgRotAppGonly = std::cos(-state.dataHeatBal->BuildingRotationAppendixG * Constant::DegToRad); + Real64 SinBldgRotAppGonly = std::sin(-state.dataHeatBal->BuildingRotationAppendixG * Constant::DegToRad); bool doTransform = false; Real64 OldAspectRatio = 1.0; @@ -3960,9 +3960,10 @@ void GetInputIlluminanceMap(EnergyPlusData &state, bool &ErrorsFound) CheckForGeometricTransform(state, doTransform, OldAspectRatio, NewAspectRatio); - auto const &ipsc = state.dataIPShortCut; - ipsc->cCurrentModuleObject = "Output:IlluminanceMap"; - int TotIllumMaps = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, ipsc->cCurrentModuleObject); + auto &ip = state.dataInputProcessing->inputProcessor; + auto const &s_ipsc = state.dataIPShortCut; + s_ipsc->cCurrentModuleObject = "Output:IlluminanceMap"; + int TotIllumMaps = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); dl->illumMaps.allocate(TotIllumMaps); @@ -3973,21 +3974,21 @@ void GetInputIlluminanceMap(EnergyPlusData &state, bool &ErrorsFound) auto &ip = state.dataInputProcessing->inputProcessor; for (int MapNum = 1; MapNum <= TotIllumMaps; ++MapNum) { ip->getObjectItem(state, - ipsc->cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, MapNum, - ipsc->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlpha, - ipsc->rNumericArgs, + s_ipsc->rNumericArgs, NumNumber, IOStat, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); auto &illumMap = dl->illumMaps(MapNum); - illumMap.Name = ipsc->cAlphaArgs(1); - int const zoneNum = Util::FindItemInList(ipsc->cAlphaArgs(2), state.dataHeatBal->Zone); + illumMap.Name = s_ipsc->cAlphaArgs(1); + int const zoneNum = Util::FindItemInList(s_ipsc->cAlphaArgs(2), state.dataHeatBal->Zone); if (zoneNum > 0) { illumMap.zoneIndex = zoneNum; // set enclosure index for first space in zone @@ -3999,8 +4000,8 @@ void GetInputIlluminanceMap(EnergyPlusData &state, bool &ErrorsFound) if (enclNum != state.dataHeatBal->space(spaceNum).solarEnclosureNum) { ShowSevereError(state, format("{}=\"{}\" All spaces in the zone must be in the same enclosure for daylighting illuminance maps.", - ipsc->cCurrentModuleObject, - ipsc->cAlphaArgs(1))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1))); ShowContinueError( state, format("Zone=\"{}\" spans multiple enclosures. Use a Space Name instead.", state.dataHeatBal->Zone(zoneNum).Name)); ErrorsFound = true; @@ -4012,10 +4013,10 @@ void GetInputIlluminanceMap(EnergyPlusData &state, bool &ErrorsFound) if (spaceNum == 0) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", - ipsc->cCurrentModuleObject, - ipsc->cAlphaArgs(1), - ipsc->cAlphaFieldNames(2), - ipsc->cAlphaArgs(2))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } else { illumMap.spaceIndex = spaceNum; @@ -4025,90 +4026,90 @@ void GetInputIlluminanceMap(EnergyPlusData &state, bool &ErrorsFound) } } - illumMap.Z = ipsc->rNumericArgs(1); - illumMap.Xmin = ipsc->rNumericArgs(2); - illumMap.Xmax = ipsc->rNumericArgs(3); - if (ipsc->rNumericArgs(2) > ipsc->rNumericArgs(3)) { - ShowSevereError(state, format("{}=\"{}\", invalid entry.", ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1))); + illumMap.Z = s_ipsc->rNumericArgs(1); + illumMap.Xmin = s_ipsc->rNumericArgs(2); + illumMap.Xmax = s_ipsc->rNumericArgs(3); + if (s_ipsc->rNumericArgs(2) > s_ipsc->rNumericArgs(3)) { + ShowSevereError(state, format("{}=\"{}\", invalid entry.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, format("...{} {:.2R} must be <= {} {:.2R}.", - ipsc->cNumericFieldNames(2), - ipsc->rNumericArgs(2), - ipsc->cNumericFieldNames(3), - ipsc->rNumericArgs(3))); + s_ipsc->cNumericFieldNames(2), + s_ipsc->rNumericArgs(2), + s_ipsc->cNumericFieldNames(3), + s_ipsc->rNumericArgs(3))); ErrorsFound = true; } - illumMap.Xnum = ipsc->rNumericArgs(4); + illumMap.Xnum = s_ipsc->rNumericArgs(4); illumMap.Xinc = (illumMap.Xnum != 1) ? ((illumMap.Xmax - illumMap.Xmin) / (illumMap.Xnum - 1)) : 0.0; - illumMap.Ymin = ipsc->rNumericArgs(5); - illumMap.Ymax = ipsc->rNumericArgs(6); - if (ipsc->rNumericArgs(5) > ipsc->rNumericArgs(6)) { - ShowSevereError(state, format("{}=\"{}\", invalid entry.", ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1))); + illumMap.Ymin = s_ipsc->rNumericArgs(5); + illumMap.Ymax = s_ipsc->rNumericArgs(6); + if (s_ipsc->rNumericArgs(5) > s_ipsc->rNumericArgs(6)) { + ShowSevereError(state, format("{}=\"{}\", invalid entry.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, format("...{} {:.2R} must be <= {} {:.2R}.", - ipsc->cNumericFieldNames(5), - ipsc->rNumericArgs(5), - ipsc->cNumericFieldNames(6), - ipsc->rNumericArgs(6))); + s_ipsc->cNumericFieldNames(5), + s_ipsc->rNumericArgs(5), + s_ipsc->cNumericFieldNames(6), + s_ipsc->rNumericArgs(6))); ErrorsFound = true; } - illumMap.Ynum = ipsc->rNumericArgs(7); + illumMap.Ynum = s_ipsc->rNumericArgs(7); illumMap.Yinc = (illumMap.Ynum != 1) ? ((illumMap.Ymax - illumMap.Ymin) / (illumMap.Ynum - 1)) : 0.0; if (illumMap.Xnum * illumMap.Ynum > MaxMapRefPoints) { - ShowSevereError(state, format("{}=\"{}\", too many map points specified.", ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1))); + ShowSevereError(state, format("{}=\"{}\", too many map points specified.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, format("...{}[{}] * {}[{}].= [{}] must be <= [{}].", - ipsc->cNumericFieldNames(4), + s_ipsc->cNumericFieldNames(4), illumMap.Xnum, - ipsc->cNumericFieldNames(7), + s_ipsc->cNumericFieldNames(7), illumMap.Ynum, illumMap.Xnum * illumMap.Ynum, MaxMapRefPoints)); ErrorsFound = true; } } // MapNum - ipsc->cCurrentModuleObject = "OutputControl:IlluminanceMap:Style"; - int MapStyleIn = ip->getNumObjectsFound(state, ipsc->cCurrentModuleObject); + s_ipsc->cCurrentModuleObject = "OutputControl:IlluminanceMap:Style"; + int MapStyleIn = ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); if (MapStyleIn == 0) { - ipsc->cAlphaArgs(1) = "COMMA"; + s_ipsc->cAlphaArgs(1) = "COMMA"; dl->MapColSep = DataStringGlobals::CharComma; // comma } else if (MapStyleIn == 1) { ip->getObjectItem(state, - ipsc->cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, 1, - ipsc->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlpha, - ipsc->rNumericArgs, + s_ipsc->rNumericArgs, NumNumber, IOStat, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); - if (ipsc->cAlphaArgs(1) == "COMMA") { + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + if (s_ipsc->cAlphaArgs(1) == "COMMA") { dl->MapColSep = DataStringGlobals::CharComma; // comma - } else if (ipsc->cAlphaArgs(1) == "TAB") { + } else if (s_ipsc->cAlphaArgs(1) == "TAB") { dl->MapColSep = DataStringGlobals::CharTab; // tab - } else if (ipsc->cAlphaArgs(1) == "FIXED" || ipsc->cAlphaArgs(1) == "SPACE") { + } else if (s_ipsc->cAlphaArgs(1) == "FIXED" || s_ipsc->cAlphaArgs(1) == "SPACE") { dl->MapColSep = DataStringGlobals::CharSpace; // space } else { dl->MapColSep = DataStringGlobals::CharComma; // comma ShowWarningError(state, format("{}: invalid {}=\"{}\", Commas will be used to separate fields.", - ipsc->cCurrentModuleObject, - ipsc->cAlphaFieldNames(1), - ipsc->cAlphaArgs(1))); - ipsc->cAlphaArgs(1) = "COMMA"; + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(1), + s_ipsc->cAlphaArgs(1))); + s_ipsc->cAlphaArgs(1) = "COMMA"; } } print(state.files.eio, "! ,#Maps,Style\n"); - ConvertCaseToLower(ipsc->cAlphaArgs(1), ipsc->cAlphaArgs(2)); - ipsc->cAlphaArgs(1).erase(1); - ipsc->cAlphaArgs(1) += ipsc->cAlphaArgs(2).substr(1); - print(state.files.eio, "Daylighting:Illuminance Maps,{},{}\n", TotIllumMaps, ipsc->cAlphaArgs(1)); + ConvertCaseToLower(s_ipsc->cAlphaArgs(1), s_ipsc->cAlphaArgs(2)); + s_ipsc->cAlphaArgs(1).erase(1); + s_ipsc->cAlphaArgs(1) += s_ipsc->cAlphaArgs(2).substr(1); + print(state.files.eio, "Daylighting:Illuminance Maps,{},{}\n", TotIllumMaps, s_ipsc->cAlphaArgs(1)); } // Check for illuminance maps associated with this zone @@ -4118,8 +4119,8 @@ void GetInputIlluminanceMap(EnergyPlusData &state, bool &ErrorsFound) auto &zone = state.dataHeatBal->Zone(illumMap.zoneIndex); // Calc cos and sin of Zone Relative North values for later use in transforming Reference Point coordinates - Real64 CosZoneRelNorth = std::cos(-zone.RelNorth * Constant::DegToRadians); - Real64 SinZoneRelNorth = std::sin(-zone.RelNorth * Constant::DegToRadians); + Real64 CosZoneRelNorth = std::cos(-zone.RelNorth * Constant::DegToRad); + Real64 SinZoneRelNorth = std::sin(-zone.RelNorth * Constant::DegToRad); if (illumMap.Xnum * illumMap.Ynum == 0) continue; @@ -4302,6 +4303,8 @@ void GetDaylightingControls(EnergyPlusData &state, bool &ErrorsFound) // MODIFIED Glazer - July 2016 - Move geometry transformation portion, rearrange input, allow more than three reference points // Obtain the user input data for Daylighting:Controls object in the input file. + static constexpr std::string_view routineName = "GetDaylightingControls"; + auto &dl = state.dataDayltg; int IOStat; @@ -4315,9 +4318,9 @@ void GetDaylightingControls(EnergyPlusData &state, bool &ErrorsFound) constexpr Real64 FractionTolerance(0.001); auto &ip = state.dataInputProcessing->inputProcessor; - auto const &ipsc = state.dataIPShortCut; - ipsc->cCurrentModuleObject = "Daylighting:Controls"; - int totDaylightingControls = ip->getNumObjectsFound(state, ipsc->cCurrentModuleObject); + auto const &s_ipsc = state.dataIPShortCut; + s_ipsc->cCurrentModuleObject = "Daylighting:Controls"; + int totDaylightingControls = ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); dl->daylightControl.allocate(totDaylightingControls); Array1D spaceHasDaylightingControl; spaceHasDaylightingControl.dimension(state.dataGlobal->numSpaces, false); @@ -4326,22 +4329,25 @@ void GetDaylightingControls(EnergyPlusData &state, bool &ErrorsFound) state.dataViewFactor->EnclSolInfo(enclNum).TotalEnclosureDaylRefPoints = 0; } for (int controlNum = 1; controlNum <= totDaylightingControls; ++controlNum) { - ipsc->cAlphaArgs = ""; - ipsc->rNumericArgs = 0.0; + s_ipsc->cAlphaArgs = ""; + s_ipsc->rNumericArgs = 0.0; ip->getObjectItem(state, - ipsc->cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, controlNum, - ipsc->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlpha, - ipsc->rNumericArgs, + s_ipsc->rNumericArgs, NumNumber, IOStat, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + auto &daylightControl = dl->daylightControl(controlNum); - daylightControl.Name = ipsc->cAlphaArgs(1); + daylightControl.Name = s_ipsc->cAlphaArgs(1); // Is it a zone or space name? int const zoneNum = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(2), state.dataHeatBal->Zone); @@ -4356,9 +4362,9 @@ void GetDaylightingControls(EnergyPlusData &state, bool &ErrorsFound) if (daylightControl.enclIndex != state.dataHeatBal->space(zoneSpaceNum).solarEnclosureNum) { ShowSevereError(state, format("{}: invalid {}=\"{}\" All spaces in the zone must be in the same enclosure for daylighting.", - ipsc->cCurrentModuleObject, - ipsc->cAlphaFieldNames(2), - ipsc->cAlphaArgs(2))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ErrorsFound = true; break; } @@ -4368,10 +4374,10 @@ void GetDaylightingControls(EnergyPlusData &state, bool &ErrorsFound) if (spaceHasDaylightingControl(zoneSpaceNum)) { ShowWarningError(state, format("{}=\"{}\" Space=\"{}\" already has a {} object assigned to it.", - ipsc->cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, daylightControl.Name, state.dataHeatBal->space(zoneSpaceNum).Name, - ipsc->cCurrentModuleObject)); + s_ipsc->cCurrentModuleObject)); ShowContinueError(state, "This control will override the lighting power factor for this space."); } spaceHasDaylightingControl(zoneSpaceNum) = true; @@ -4379,7 +4385,8 @@ void GetDaylightingControls(EnergyPlusData &state, bool &ErrorsFound) } else { int const spaceNum = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(2), state.dataHeatBal->space); if (spaceNum == 0) { - ShowSevereError(state, format("{}: invalid {}=\"{}\".", ipsc->cCurrentModuleObject, ipsc->cAlphaFieldNames(2), ipsc->cAlphaArgs(2))); + ShowSevereError(state, + format("{}: invalid {}=\"{}\".", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); ErrorsFound = true; continue; } else { @@ -4390,10 +4397,10 @@ void GetDaylightingControls(EnergyPlusData &state, bool &ErrorsFound) if (spaceHasDaylightingControl(spaceNum)) { ShowWarningError(state, format("{}=\"{}\" Space=\"{}\" already has a {} object assigned to it.", - ipsc->cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, daylightControl.Name, state.dataHeatBal->space(spaceNum).Name, - ipsc->cCurrentModuleObject)); + s_ipsc->cCurrentModuleObject)); ShowContinueError(state, "This control will override the lighting power factor for this space."); } spaceHasDaylightingControl(spaceNum) = true; @@ -4403,85 +4410,73 @@ void GetDaylightingControls(EnergyPlusData &state, bool &ErrorsFound) dl->enclDaylight(daylightControl.enclIndex).daylightControlIndexes.emplace_back(controlNum); daylightControl.ZoneName = state.dataHeatBal->Zone(daylightControl.zoneIndex).Name; - if (ipsc->lAlphaFieldBlanks(3)) { + if (s_ipsc->lAlphaFieldBlanks(3)) { daylightControl.DaylightMethod = DaylightingMethod::SplitFlux; } else { daylightControl.DaylightMethod = - static_cast(getEnumValue(DaylightingMethodNamesUC, Util::makeUPPER(ipsc->cAlphaArgs(3)))); + static_cast(getEnumValue(DaylightingMethodNamesUC, Util::makeUPPER(s_ipsc->cAlphaArgs(3)))); if (daylightControl.DaylightMethod == DaylightingMethod::Invalid) { daylightControl.DaylightMethod = DaylightingMethod::SplitFlux; ShowWarningError(state, format("Invalid {} = {}, occurs in {}object for {}=\"{}", - ipsc->cAlphaFieldNames(3), - ipsc->cAlphaArgs(3), - ipsc->cCurrentModuleObject, - ipsc->cCurrentModuleObject, - ipsc->cAlphaArgs(1))); + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3), + s_ipsc->cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "SplitFlux assumed, and the simulation continues."); } } dl->enclDaylight(daylightControl.enclIndex).hasSplitFluxDaylighting |= (daylightControl.DaylightMethod == DaylightingMethod::SplitFlux); - if (!ipsc->lAlphaFieldBlanks(4)) { // Field: Availability Schedule Name - daylightControl.AvailSchedNum = ScheduleManager::GetScheduleIndex(state, ipsc->cAlphaArgs(4)); - if (daylightControl.AvailSchedNum == 0) { - ShowWarningError(state, - format("Invalid {} = {}, occurs in {}object for {}=\"{}", - ipsc->cAlphaFieldNames(4), - ipsc->cAlphaArgs(4), - ipsc->cCurrentModuleObject, - ipsc->cCurrentModuleObject, - ipsc->cAlphaArgs(1))); - ShowContinueError(state, "Schedule was not found so controls will always be available, and the simulation continues."); - daylightControl.AvailSchedNum = ScheduleManager::ScheduleAlwaysOn; - } - } else { - daylightControl.AvailSchedNum = ScheduleManager::ScheduleAlwaysOn; + if (s_ipsc->lAlphaFieldBlanks(4)) { // Field: Availability Schedule Name + daylightControl.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((daylightControl.availSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(4))) == nullptr) { + ShowWarningItemNotFound(state, + eoh, + s_ipsc->cAlphaFieldNames(4), + s_ipsc->cAlphaArgs(4), + "Schedule was not found so controls will always be available, and the simulation continues."); + daylightControl.availSched = Sched::GetScheduleAlwaysOn(state); } - daylightControl.LightControlType = static_cast(getEnumValue(LtgCtrlTypeNamesUC, Util::makeUPPER(ipsc->cAlphaArgs(5)))); + daylightControl.LightControlType = static_cast(getEnumValue(LtgCtrlTypeNamesUC, s_ipsc->cAlphaArgs(5))); if (daylightControl.LightControlType == LtgCtrlType::Invalid) { - ShowWarningError(state, - format("Invalid {} = {}, occurs in {}object for {}=\"{}", - ipsc->cAlphaFieldNames(5), - ipsc->cAlphaArgs(5), - ipsc->cCurrentModuleObject, - ipsc->cCurrentModuleObject, - ipsc->cAlphaArgs(1))); - ShowContinueError(state, "Continuous assumed, and the simulation continues."); - } - - daylightControl.MinPowerFraction = ipsc->rNumericArgs(1); // Field: Minimum Input Power Fraction for Continuous Dimming Control - daylightControl.MinLightFraction = ipsc->rNumericArgs(2); // Field: Minimum Light Output Fraction for Continuous Dimming Control - daylightControl.LightControlSteps = ipsc->rNumericArgs(3); // Field: Number of Stepped Control Steps + ShowWarningInvalidKey( + state, eoh, s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaArgs(5), "Continuous assumed, and the simulation continues."); + } + + daylightControl.MinPowerFraction = s_ipsc->rNumericArgs(1); // Field: Minimum Input Power Fraction for Continuous Dimming Control + daylightControl.MinLightFraction = s_ipsc->rNumericArgs(2); // Field: Minimum Light Output Fraction for Continuous Dimming Control + daylightControl.LightControlSteps = s_ipsc->rNumericArgs(3); // Field: Number of Stepped Control Steps daylightControl.LightControlProbability = - ipsc->rNumericArgs(4); // Field: Probability Lighting will be Reset When Needed in Manual Stepped Control + s_ipsc->rNumericArgs(4); // Field: Probability Lighting will be Reset When Needed in Manual Stepped Control - if (!ipsc->lAlphaFieldBlanks(6)) { // Field: Glare Calculation Daylighting Reference Point Name - daylightControl.glareRefPtNumber = Util::FindItemInList(ipsc->cAlphaArgs(6), + if (!s_ipsc->lAlphaFieldBlanks(6)) { // Field: Glare Calculation Daylighting Reference Point Name + daylightControl.glareRefPtNumber = Util::FindItemInList(s_ipsc->cAlphaArgs(6), dl->DaylRefPt, &RefPointData::Name); // Field: Glare Calculation Daylighting Reference Point Name if (daylightControl.glareRefPtNumber == 0) { ShowSevereError(state, format("{}: invalid {}=\"{}\" for object named: {}", - ipsc->cCurrentModuleObject, - ipsc->cAlphaFieldNames(6), - ipsc->cAlphaArgs(6), - ipsc->cAlphaArgs(1))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(6), + s_ipsc->cAlphaArgs(6), + s_ipsc->cAlphaArgs(1))); ErrorsFound = true; continue; } } else if (daylightControl.DaylightMethod == DaylightingMethod::SplitFlux) { - ShowWarningError(state, format("No {} provided for object named: {}", ipsc->cAlphaFieldNames(6), ipsc->cAlphaArgs(1))); + ShowWarningError(state, format("No {} provided for object named: {}", s_ipsc->cAlphaFieldNames(6), s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "No glare calculation performed, and the simulation continues."); } // Field: Glare Calculation Azimuth Angle of View Direction Clockwise from Zone y-Axis - daylightControl.ViewAzimuthForGlare = !ipsc->lNumericFieldBlanks(5) ? ipsc->rNumericArgs(5) : 0.0; + daylightControl.ViewAzimuthForGlare = !s_ipsc->lNumericFieldBlanks(5) ? s_ipsc->rNumericArgs(5) : 0.0; - daylightControl.MaxGlareallowed = ipsc->rNumericArgs(6); // Field: Maximum Allowable Discomfort Glare Index - daylightControl.DElightGriddingResolution = ipsc->rNumericArgs(7); // Field: DElight Gridding Resolution + daylightControl.MaxGlareallowed = s_ipsc->rNumericArgs(6); // Field: Maximum Allowable Discomfort Glare Index + daylightControl.DElightGriddingResolution = s_ipsc->rNumericArgs(7); // Field: DElight Gridding Resolution int curTotalDaylRefPts = NumAlpha - 6; // first six alpha fields are not part of extensible group daylightControl.TotalDaylRefPoints = curTotalDaylRefPts; @@ -4491,12 +4486,12 @@ void GetDaylightingControls(EnergyPlusData &state, bool &ErrorsFound) if ((NumNumber - 7) / 2 != daylightControl.TotalDaylRefPoints) { ShowSevereError(state, format("{}The number of extensible numeric fields and alpha fields is inconsistent for: {}", - ipsc->cCurrentModuleObject, - ipsc->cAlphaArgs(1))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1))); ShowContinueError(state, format("For each field: {} there needs to be the following fields: Fraction Controlled by Reference Point and " "Illuminance Setpoint at Reference Point", - ipsc->cAlphaFieldNames(NumAlpha))); + s_ipsc->cAlphaFieldNames(NumAlpha))); ErrorsFound = true; } @@ -4510,21 +4505,21 @@ void GetDaylightingControls(EnergyPlusData &state, bool &ErrorsFound) for (int refPtNum = 1; refPtNum <= curTotalDaylRefPts; ++refPtNum) { auto &refPt = daylightControl.refPts(refPtNum); refPt.num = - Util::FindItemInList(ipsc->cAlphaArgs(6 + refPtNum), dl->DaylRefPt, &RefPointData::Name); // Field: Daylighting Reference Point Name + Util::FindItemInList(s_ipsc->cAlphaArgs(6 + refPtNum), dl->DaylRefPt, &RefPointData::Name); // Field: Daylighting Reference Point Name if (refPt.num == 0) { ShowSevereError(state, format("{}: invalid {}=\"{}\" for object named: {}", - ipsc->cCurrentModuleObject, - ipsc->cAlphaFieldNames(6 + refPtNum), - ipsc->cAlphaArgs(6 + refPtNum), - ipsc->cAlphaArgs(1))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(6 + refPtNum), + s_ipsc->cAlphaArgs(6 + refPtNum), + s_ipsc->cAlphaArgs(1))); ErrorsFound = true; continue; } else { ++countRefPts; } - refPt.fracZoneDaylit = ipsc->rNumericArgs(6 + refPtNum * 2); // Field: Fraction Controlled by Reference Point - refPt.illumSetPoint = ipsc->rNumericArgs(7 + refPtNum * 2); // Field: Illuminance Setpoint at Reference Point + refPt.fracZoneDaylit = s_ipsc->rNumericArgs(6 + refPtNum * 2); // Field: Fraction Controlled by Reference Point + refPt.illumSetPoint = s_ipsc->rNumericArgs(7 + refPtNum * 2); // Field: Illuminance Setpoint at Reference Point if (daylightControl.DaylightMethod == DaylightingMethod::SplitFlux) { SetupOutputVariable(state, @@ -4560,7 +4555,7 @@ void GetDaylightingControls(EnergyPlusData &state, bool &ErrorsFound) // Register Error if 0 DElight RefPts have been input for valid DElight object if (countRefPts < 1) { - ShowSevereError(state, format("No Reference Points input for {} zone ={}", ipsc->cCurrentModuleObject, daylightControl.ZoneName)); + ShowSevereError(state, format("No Reference Points input for {} zone ={}", s_ipsc->cCurrentModuleObject, daylightControl.ZoneName)); ErrorsFound = true; } @@ -4573,14 +4568,14 @@ void GetDaylightingControls(EnergyPlusData &state, bool &ErrorsFound) ShowWarningError(state, "GetDaylightingControls: Fraction of zone or space controlled by the Daylighting reference points is < 1.0."); ShowContinueError(state, format("..discovered in {}=\"{}\", only {:.3R} of the zone or space is controlled.", - ipsc->cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, daylightControl.Name, sumFracs)); } else if ((sumFracs - 1.0) > FractionTolerance) { ShowSevereError(state, "GetDaylightingControls: Fraction of zone or space controlled by the Daylighting reference points is > 1.0."); ShowContinueError(state, format("..discovered in {}=\"{}\", trying to control {:.3R} of the zone or space.", - ipsc->cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, daylightControl.Name, sumFracs)); ErrorsFound = true; @@ -4588,7 +4583,8 @@ void GetDaylightingControls(EnergyPlusData &state, bool &ErrorsFound) if (daylightControl.LightControlType == LtgCtrlType::Stepped && daylightControl.LightControlSteps <= 0) { ShowWarningError(state, "GetDaylightingControls: For Stepped Control, the number of steps must be > 0"); - ShowContinueError(state, format("..discovered in \"{}\" for Zone=\"{}\", will use 1", ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(2))); + ShowContinueError(state, + format("..discovered in \"{}\" for Zone=\"{}\", will use 1", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(2))); daylightControl.LightControlSteps = 1; } SetupOutputVariable(state, @@ -4611,11 +4607,11 @@ void GeometryTransformForDaylighting(EnergyPlusData &state) auto const &s_surf = state.dataSurface; // Calc cos and sin of Building Relative North values for later use in transforming Reference Point coordinates - Real64 CosBldgRelNorth = std::cos(-(state.dataHeatBal->BuildingAzimuth + state.dataHeatBal->BuildingRotationAppendixG) * Constant::DegToRadians); - Real64 SinBldgRelNorth = std::sin(-(state.dataHeatBal->BuildingAzimuth + state.dataHeatBal->BuildingRotationAppendixG) * Constant::DegToRadians); + Real64 CosBldgRelNorth = std::cos(-(state.dataHeatBal->BuildingAzimuth + state.dataHeatBal->BuildingRotationAppendixG) * Constant::DegToRad); + Real64 SinBldgRelNorth = std::sin(-(state.dataHeatBal->BuildingAzimuth + state.dataHeatBal->BuildingRotationAppendixG) * Constant::DegToRad); // these are only for Building Rotation for Appendix G when using world coordinate system - Real64 CosBldgRotAppGonly = std::cos(-state.dataHeatBal->BuildingRotationAppendixG * Constant::DegToRadians); - Real64 SinBldgRotAppGonly = std::sin(-state.dataHeatBal->BuildingRotationAppendixG * Constant::DegToRadians); + Real64 CosBldgRotAppGonly = std::cos(-state.dataHeatBal->BuildingRotationAppendixG * Constant::DegToRad); + Real64 SinBldgRotAppGonly = std::sin(-state.dataHeatBal->BuildingRotationAppendixG * Constant::DegToRad); bool doTransform = false; Real64 OldAspectRatio = 1.0; @@ -4626,8 +4622,8 @@ void GeometryTransformForDaylighting(EnergyPlusData &state) auto &zone = state.dataHeatBal->Zone(daylCntrl.zoneIndex); // Calc cos and sin of Zone Relative North values for later use in transforming Reference Point coordinates - Real64 CosZoneRelNorth = std::cos(-zone.RelNorth * Constant::DegToRadians); - Real64 SinZoneRelNorth = std::sin(-zone.RelNorth * Constant::DegToRadians); + Real64 CosZoneRelNorth = std::cos(-zone.RelNorth * Constant::DegToRad); + Real64 SinZoneRelNorth = std::sin(-zone.RelNorth * Constant::DegToRad); Real64 rLightLevel = InternalHeatGains::GetDesignLightingLevelForZone(state, daylCntrl.zoneIndex); InternalHeatGains::CheckLightsReplaceableMinMaxForZone(state, daylCntrl.zoneIndex); @@ -4736,47 +4732,47 @@ void GetInputDayliteRefPt(EnergyPlusData &state, bool &ErrorsFound) // Glazer - July 2016 auto const &dl = state.dataDayltg; auto &ip = state.dataInputProcessing->inputProcessor; - auto const &ipsc = state.dataIPShortCut; - ipsc->cCurrentModuleObject = "Daylighting:ReferencePoint"; + auto const &s_ipsc = state.dataIPShortCut; + s_ipsc->cCurrentModuleObject = "Daylighting:ReferencePoint"; int RefPtNum = 0; int IOStat; int NumAlpha; int NumNumber; - int TotRefPoints = ip->getNumObjectsFound(state, ipsc->cCurrentModuleObject); + int TotRefPoints = ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); dl->DaylRefPt.allocate(TotRefPoints); for (auto &pt : dl->DaylRefPt) { ip->getObjectItem(state, - ipsc->cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, ++RefPtNum, - ipsc->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlpha, - ipsc->rNumericArgs, + s_ipsc->rNumericArgs, NumNumber, IOStat, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); - pt.Name = ipsc->cAlphaArgs(1); - pt.ZoneNum = Util::FindItemInList(ipsc->cAlphaArgs(2), state.dataHeatBal->Zone); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + pt.Name = s_ipsc->cAlphaArgs(1); + pt.ZoneNum = Util::FindItemInList(s_ipsc->cAlphaArgs(2), state.dataHeatBal->Zone); if (pt.ZoneNum == 0) { - int spaceNum = Util::FindItemInList(ipsc->cAlphaArgs(2), state.dataHeatBal->space); + int spaceNum = Util::FindItemInList(s_ipsc->cAlphaArgs(2), state.dataHeatBal->space); if (spaceNum == 0) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", - ipsc->cCurrentModuleObject, - ipsc->cAlphaArgs(1), - ipsc->cAlphaFieldNames(2), - ipsc->cAlphaArgs(2))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } else { pt.ZoneNum = state.dataHeatBal->space(spaceNum).zoneNum; } } - pt.coords = {ipsc->rNumericArgs(1), ipsc->rNumericArgs(2), ipsc->rNumericArgs(3)}; + pt.coords = {s_ipsc->rNumericArgs(1), s_ipsc->rNumericArgs(2), s_ipsc->rNumericArgs(3)}; } } @@ -4892,32 +4888,32 @@ void GetLightWellData(EnergyPlusData &state, bool &ErrorsFound) // If errors fou auto &ip = state.dataInputProcessing->inputProcessor; auto &s_surf = state.dataSurface; - auto const &ipsc = state.dataIPShortCut; + auto const &s_ipsc = state.dataIPShortCut; // Get the total number of Light Well objects - ipsc->cCurrentModuleObject = "DaylightingDevice:LightWell"; - TotLightWells = ip->getNumObjectsFound(state, ipsc->cCurrentModuleObject); + s_ipsc->cCurrentModuleObject = "DaylightingDevice:LightWell"; + TotLightWells = ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); if (TotLightWells == 0) return; for (int loop = 1; loop <= TotLightWells; ++loop) { ip->getObjectItem(state, - ipsc->cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, loop, - ipsc->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlpha, - ipsc->rNumericArgs, + s_ipsc->rNumericArgs, NumProp, IOStat, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); - int SurfNum = Util::FindItemInList(ipsc->cAlphaArgs(1), s_surf->Surface); + int SurfNum = Util::FindItemInList(s_ipsc->cAlphaArgs(1), s_surf->Surface); if (SurfNum == 0) { - ShowSevereError(state, - format("{}: invalid {}=\"{}\" not found.", ipsc->cCurrentModuleObject, ipsc->cAlphaFieldNames(1), ipsc->cAlphaArgs(1))); + ShowSevereError( + state, format("{}: invalid {}=\"{}\" not found.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaFieldNames(1), s_ipsc->cAlphaArgs(1))); ErrorsFound = true; continue; } @@ -4927,25 +4923,26 @@ void GetLightWellData(EnergyPlusData &state, bool &ErrorsFound) // If errors fou // Check that associated surface is an exterior window // True if associated surface is not an exterior window if (surf.Class != SurfaceClass::Window && surf.ExtBoundCond != ExternalEnvironment) { - ShowSevereError( - state, - format( - "{}: invalid {}=\"{}\" - not an exterior window.", ipsc->cCurrentModuleObject, ipsc->cAlphaFieldNames(1), ipsc->cAlphaArgs(1))); + ShowSevereError(state, + format("{}: invalid {}=\"{}\" - not an exterior window.", + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(1), + s_ipsc->cAlphaArgs(1))); ErrorsFound = true; continue; } // Associated surface is an exterior window; calculate light well efficiency. surfWin.lightWellEff = 1.0; - Real64 HeightWell = ipsc->rNumericArgs(1); // Well height (from window to bottom of well) (m) - Real64 PerimWell = ipsc->rNumericArgs(2); // Well perimeter (at bottom of well) (m) - Real64 AreaWell = ipsc->rNumericArgs(3); // Well area (at bottom of well) (m2) - Real64 VisReflWell = ipsc->rNumericArgs(4); // Area-weighted visible reflectance of well walls + Real64 HeightWell = s_ipsc->rNumericArgs(1); // Well height (from window to bottom of well) (m) + Real64 PerimWell = s_ipsc->rNumericArgs(2); // Well perimeter (at bottom of well) (m) + Real64 AreaWell = s_ipsc->rNumericArgs(3); // Well area (at bottom of well) (m2) + Real64 VisReflWell = s_ipsc->rNumericArgs(4); // Area-weighted visible reflectance of well walls // Warning if light well area is less than window area if (AreaWell < (surf.Area + s_surf->SurfWinDividerArea(SurfNum) - 0.1)) { - ShowSevereError(state, - format("{}: invalid {}=\"{}\" - Areas.", ipsc->cCurrentModuleObject, ipsc->cAlphaFieldNames(1), ipsc->cAlphaArgs(1))); + ShowSevereError( + state, format("{}: invalid {}=\"{}\" - Areas.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaFieldNames(1), s_ipsc->cAlphaArgs(1))); ShowContinueError(state, format("has Area of Bottom of Well={:.1R} that is less than window area={:.1R}", surf.Area, AreaWell)); } @@ -5191,8 +5188,7 @@ Real64 DayltgHitObstruction(EnergyPlusData &state, hit = PierceSurface(state, ISurf, R1, RN, DayltgHitObstructionHP); if (hit) { // Shading surface is hit // Get solar transmittance of the shading surface - Real64 const Trans( - surface.SchedShadowSurfIndex > 0 ? ScheduleManager::LookUpScheduleValue(state, surface.SchedShadowSurfIndex, IHOUR, 1) : 0.0); + Real64 const Trans = (surface.shadowSurfSched != nullptr) ? surface.shadowSurfSched->getHrTsVal(state, IHOUR, 1) : 0.0; if (Trans < 1.e-6) { ObTrans = 0.0; break; @@ -5223,8 +5219,7 @@ Real64 DayltgHitObstruction(EnergyPlusData &state, hit = PierceSurface(surface, R1, RN, HP); if (hit) { // Shading surface is hit // Get solar transmittance of the shading surface - Real64 const Trans( - surface.SchedShadowSurfIndex > 0 ? ScheduleManager::LookUpScheduleValue(state, surface.SchedShadowSurfIndex, IHOUR, 1) : 0.0); + Real64 const Trans = (surface.shadowSurfSched != nullptr) ? surface.shadowSurfSched->getHrTsVal(state, IHOUR, 1) : 0.0; if (Trans < 1.e-6) { ObTrans = 0.0; return true; @@ -5637,7 +5632,7 @@ void manageDaylighting(EnergyPlusData &state) } } DayltgElecLightingControl(state); - } else if (dl->mapResultsToReport && state.dataGlobal->TimeStep == state.dataGlobal->NumOfTimeStepInHour) { + } else if (dl->mapResultsToReport && state.dataGlobal->TimeStep == state.dataGlobal->TimeStepsInHour) { for (int MapNum = 1; MapNum <= (int)dl->illumMaps.size(); ++MapNum) { ReportIllumMap(state, MapNum); } @@ -5809,8 +5804,8 @@ void DayltgInteriorIllum(EnergyPlusData &state, // based on the master construction. They need to be adjusted by the VTRatio, including: // ZoneDaylight()%DaylIllFacSky, DaylIllFacSun, DaylIllFacSunDisk; DaylBackFacSky, // DaylBackFacSun, DaylBackFacSunDisk, DaylSourceFacSky, DaylSourceFacSun, DaylSourceFacSunDisk - VTNow = General::POLYF(1.0, construction.TransVisBeamCoef); - VTMaster = General::POLYF(1.0, state.dataConstruction->Construct(construction.TCMasterConstrNum).TransVisBeamCoef); + VTNow = Window::POLYF(1.0, construction.TransVisBeamCoef); + VTMaster = Window::POLYF(1.0, state.dataConstruction->Construct(construction.TCMasterConstrNum).TransVisBeamCoef); VTRatio = VTNow / VTMaster; } } @@ -6084,12 +6079,12 @@ void DayltgInteriorIllum(EnergyPlusData &state, int const IConst = s_surf->SurfActiveConstruction(IWin); // Vis trans at normal incidence of unswitched glass shadeGroupLums.unswitchedTvis = - General::POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac; + Window::POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac; // Vis trans at normal incidence of fully switched glass int const IConstShaded = s_surf->Surface(IWin).activeShadedConstruction; shadeGroupLums.switchedTvis = - General::POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac; + Window::POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac; // Reset shading flag to indicate that window is shaded by being partially or fully switched s_surf->SurfWinShadingFlag(IWin) = WinShadingType::SwitchableGlazing; @@ -6304,12 +6299,12 @@ void DayltgInteriorIllum(EnergyPlusData &state, int const IConst = s_surf->SurfActiveConstruction(IWin); // Vis trans at normal incidence of unswitched glass shadeGroupLums.unswitchedTvis = - General::POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac; + Window::POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac; // Vis trans at normal incidence of fully switched glass int const IConstShaded = s_surf->Surface(IWin).activeShadedConstruction; shadeGroupLums.switchedTvis = - General::POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac; + Window::POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac; } // if (switchableGlazing) } // if (GlareControlIsActive) } // for (IWin) @@ -6710,7 +6705,7 @@ void DayltgElecLightingControl(EnergyPlusData &state) Real64 ZFTOT = 0.0; // check if scheduled to be available - if (ScheduleManager::GetCurrentScheduleValue(state, thisDayltgCtrl.AvailSchedNum) > 0.0) { + if (thisDayltgCtrl.availSched->getCurrentVal() > 0.0) { // Loop over reference points for (int IL = 1; IL <= thisDayltgCtrl.TotalDaylRefPoints; ++IL) { @@ -6803,14 +6798,14 @@ void DayltgElecLightingControl(EnergyPlusData &state) auto &illumMap = dl->illumMaps(mapNum); if (state.dataGlobal->TimeStep == 1) dl->mapResultsToReport = false; for (auto &refPt : illumMap.refPts) { - refPt.lumsHr[iLum_Illum] += refPt.lums[iLum_Illum] / double(state.dataGlobal->NumOfTimeStepInHour); + refPt.lumsHr[iLum_Illum] += refPt.lums[iLum_Illum] / double(state.dataGlobal->TimeStepsInHour); if (refPt.lumsHr[iLum_Illum] > 0.0) { dl->mapResultsToReport = true; dl->mapResultsReported = true; } } ReportIllumMap(state, mapNum); - if (state.dataGlobal->TimeStep == state.dataGlobal->NumOfTimeStepInHour) { + if (state.dataGlobal->TimeStep == state.dataGlobal->TimeStepsInHour) { for (auto &refPt : illumMap.refPts) { refPt.lumsHr[iLum_Illum] = refPt.lums[iLum_Illum] = 0.0; } @@ -7287,7 +7282,7 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, } else { // Bare window // Transmittance of bare window for this sky/ground element - TVISBR = General::POLYF(COSB, construct.TransVisBeamCoef) * surfWin.glazedFrac * surfWin.lightWellEff; + TVISBR = Window::POLYF(COSB, construct.TransVisBeamCoef) * surfWin.glazedFrac * surfWin.lightWellEff; if (InShelfSurf > 0) { // Inside daylighting shelf // Daylighting shelf simplification: All light is diffuse @@ -7313,8 +7308,8 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, if (hitObs) { // disk passes thru // cosine of incidence angle of light from sky or ground element for COSBintWin = SPH * std::sin(surfIntWin.phi) + CPH * std::cos(surfIntWin.phi) * std::cos(TH - surfIntWin.theta); - TVISBR *= General::POLYF(COSBintWin, - state.dataConstruction->Construct(s_surf->Surface(IntWinNum).Construction).TransVisBeamCoef); + TVISBR *= Window::POLYF(COSBintWin, + state.dataConstruction->Construct(s_surf->Surface(IntWinNum).Construction).TransVisBeamCoef); break; } } @@ -7387,7 +7382,7 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, transMult = TransTDD(state, PipeNum, COSB, RadType::VisibleBeam) * surfWin.glazedFrac; } else { // Shade only, no TDD // Calculate transmittance of the combined window and shading device for this sky/ground element - transMult = General::POLYF(COSB, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac * + transMult = Window::POLYF(COSB, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac * surfWin.lightWellEff; } @@ -7448,7 +7443,7 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, (1.0 - ReflGlDiffDiffFront * ReflBlDiffDiffBack) * surfWin.lightWellEff; } else { // Between-glass blind - Real64 t1 = General::POLYF(COSB, construct.tBareVisCoef(1)); + Real64 t1 = Window::POLYF(COSB, construct.tBareVisCoef(1)); td2 = construct.tBareVisDiff(2); rbd1 = construct.rbBareVisDiff(1); rfd2 = construct.rfBareVisDiff(2); @@ -7459,7 +7454,7 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, if (construct.TotGlassLayers == 2) { // 2 glass layers transMult = t1 * (tfshBd * (1.0 + rfd2 * rbshd) + rfshB * rbd1 * tfshd) * td2 * surfWin.lightWellEff; } else { // 3 glass layers; blind between layers 2 and 3 - Real64 t2 = General::POLYF(COSB, construct.tBareVisCoef(2)); + Real64 t2 = Window::POLYF(COSB, construct.tBareVisCoef(2)); td3 = construct.tBareVisDiff(3); rfd3 = construct.rfBareVisDiff(3); rbd2 = construct.rbBareVisDiff(2); @@ -7470,7 +7465,7 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, transBmBmMult = TVISBR * matBlind->BeamBeamTrans(ProfAng, surfShade.blind.slatAng); } else { // Diffusing glass - transMult = General::POLYF(COSB, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac * + transMult = Window::POLYF(COSB, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac * surfWin.lightWellEff; } // End of check if shade, blind or diffusing glass @@ -7594,7 +7589,7 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, FLCW[iWinCover_Bare].sun += ZSU1 * TVISBSun * surfWin.fractionUpgoing; } else { // Bare window - TVISBSun = General::POLYF(COSBSun, construct.TransVisBeamCoef) * surfWin.glazedFrac * surfWin.lightWellEff; + TVISBSun = Window::POLYF(COSBSun, construct.TransVisBeamCoef) * surfWin.glazedFrac * surfWin.lightWellEff; // Daylighting shelf simplification: No beam makes it past end of shelf, all light is diffuse if (InShelfSurf > 0) { // Inside daylighting shelf @@ -7640,7 +7635,7 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, } else { int IConstShaded = s_surf->SurfWinActiveShadedConstruction(IWin); if (s_surf->SurfWinSolarDiffusing(IWin)) IConstShaded = surf.Construction; - transMult = General::POLYF(COSBSun, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac * + transMult = Window::POLYF(COSBSun, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac * surfWin.lightWellEff; } @@ -7675,13 +7670,13 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, surfWin.glazedFrac * surfWin.lightWellEff; } else { // Between-glass blind - Real64 t1 = General::POLYF(COSBSun, construct.tBareVisCoef(1)); + Real64 t1 = Window::POLYF(COSBSun, construct.tBareVisCoef(1)); Real64 tfshBd = Interp(btar.Vis.Ft.Bm[idxLo].DfTra, btar.Vis.Ft.Bm[idxHi].DfTra, interpFac); Real64 rfshB = Interp(btar.Vis.Ft.Bm[idxLo].DfRef, btar.Vis.Ft.Bm[idxHi].DfRef, interpFac); if (construct.TotGlassLayers == 2) { // 2 glass layers transMult = t1 * (tfshBd * (1.0 + rfd2 * rbshd) + rfshB * rbd1 * tfshd) * td2 * surfWin.lightWellEff; } else { // 3 glass layers; blind between layers 2 and 3 - Real64 t2 = General::POLYF(COSBSun, construct.tBareVisCoef(2)); + Real64 t2 = Window::POLYF(COSBSun, construct.tBareVisCoef(2)); transMult = t1 * t2 * (tfshBd * (1.0 + rfd3 * rbshd) + rfshB * (rbd2 * tfshd + td2 * rbd1 * td2 * tfshd)) * td3 * surfWin.lightWellEff; } @@ -8398,9 +8393,9 @@ Real64 ProfileAngle(EnergyPlusData &state, Real64 AzimSun = std::atan2(CosDirSun.y, CosDirSun.x); // Sun azimuth (radians) return std::atan(std::sin(ElevSun) / std::abs(std::cos(ElevSun) * std::cos(AzimWin - AzimSun))) - ElevWin; } else { // Profile angle for vertical structures - Real64 ElevWin = Constant::PiOvr2 - surf.Tilt * Constant::DegToRadians; - Real64 AzimWin = surf.Azimuth * Constant::DegToRadians; // 7952 - Real64 AzimSun = std::atan2(CosDirSun.x, CosDirSun.y); // 7952 + Real64 ElevWin = Constant::PiOvr2 - surf.Tilt * Constant::DegToRad; + Real64 AzimWin = surf.Azimuth * Constant::DegToRad; // 7952 + Real64 AzimSun = std::atan2(CosDirSun.x, CosDirSun.y); // 7952 Real64 ProfileAng; if (std::abs(ElevWin) < 0.1) { // Near-vertical window @@ -8684,8 +8679,8 @@ void DayltgInteriorMapIllum(EnergyPlusData &state) // based on the master construction. They need to be adjusted by the VTRatio, including: // ZoneDaylight()%DaylIllFacSky, DaylIllFacSun, DaylIllFacSunDisk; DaylBackFacSky, // DaylBackFacSun, DaylBackFacSunDisk, DaylSourceFacSky, DaylSourceFacSun, DaylSourceFacSunDisk - Real64 VTNow = General::POLYF(1.0, construction.TransVisBeamCoef); - Real64 VTMaster = General::POLYF(1.0, state.dataConstruction->Construct(construction.TCMasterConstrNum).TransVisBeamCoef); + Real64 VTNow = Window::POLYF(1.0, construction.TransVisBeamCoef); + Real64 VTMaster = Window::POLYF(1.0, state.dataConstruction->Construct(construction.TCMasterConstrNum).TransVisBeamCoef); VTRatio = VTNow / VTMaster; } } @@ -8793,7 +8788,7 @@ void DayltgInteriorMapIllum(EnergyPlusData &state) int IConstShaded = s_surf->Surface(IWin).activeShadedConstruction; if (IConstShaded > 0) { // Visible transmittance (VT) of electrochromic (EC) windows in fully dark state - Real64 VTDark = General::POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac; + Real64 VTDark = Window::POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac; if (VTDark > 0) VTMULT = s_surf->SurfWinVisTransSelected(IWin) / VTDark; } } @@ -8891,7 +8886,7 @@ void ReportIllumMap(EnergyPlusData &state, int const MapNum) } if (!state.dataGlobal->WarmupFlag) { - if (state.dataGlobal->TimeStep == state.dataGlobal->NumOfTimeStepInHour) { // Report only hourly + if (state.dataGlobal->TimeStep == state.dataGlobal->TimeStepsInHour) { // Report only hourly int linelen = 0; // Write X scale column header @@ -9317,7 +9312,7 @@ void DayltgSetupAdjZoneListsAndPointers(EnergyPlusData &state) for (int controlNum : thisEnclDaylight.daylightControlIndexes) { auto &thisDayltgCtrl = dl->daylightControl(controlNum); int refSize = thisDayltgCtrl.TotalDaylRefPoints; - for (int iHr = 1; iHr <= (int)Constant::HoursInDay; ++iHr) { + for (int iHr = 1; iHr <= Constant::iHoursInDay; ++iHr) { thisDayltgCtrl.daylFac[iHr].allocate(winSize, refSize); } } @@ -9353,16 +9348,16 @@ void DayltgSetupAdjZoneListsAndPointers(EnergyPlusData &state) } } - for (int iHr = 1; iHr <= (int)Constant::HoursInDay; ++iHr) { + for (int iHr = 1; iHr <= Constant::iHoursInDay; ++iHr) { illumMap.daylFac[iHr].allocate(numExtWin, illumMap.TotalMapRefPoints); } } // End of map loop - dl->dirIllum.allocate(Constant::HoursInDay); - dl->reflIllum.allocate(Constant::HoursInDay); - dl->winLum.allocate(Constant::HoursInDay); - dl->avgWinLum.allocate(Constant::HoursInDay); + dl->dirIllum.allocate(Constant::iHoursInDay); + dl->reflIllum.allocate(Constant::iHoursInDay); + dl->winLum.allocate(Constant::iHoursInDay); + dl->avgWinLum.allocate(Constant::iHoursInDay); static constexpr std::string_view Format_700("! , Enclosure Name, Number of Exterior Windows, " "Number of Exterior Windows in Adjacent Enclosures\n"); @@ -9666,8 +9661,8 @@ void CheckForGeometricTransform(EnergyPlusData &state, bool &doTransform, Real64 NewAspectRatio = 1.0; auto &ip = state.dataInputProcessing->inputProcessor; - auto const &ipsc = state.dataIPShortCut; - auto const &s_surf = state.dataSurface; + auto const &s_ipsc = state.dataIPShortCut; + auto &s_surf = state.dataSurface; if (ip->getNumObjectsFound(state, CurrentModuleObject) == 1) { int NAlphas; @@ -9681,15 +9676,15 @@ void CheckForGeometricTransform(EnergyPlusData &state, bool &doTransform, Real64 rNumerics, NNum, IOStat, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); OldAspectRatio = rNumerics(1); NewAspectRatio = rNumerics(2); std::string transformPlane = cAlphas(1); if (transformPlane != "XY") { - ShowWarningError(state, format("{}: invalid {}=\"{}...ignored.", CurrentModuleObject, ipsc->cAlphaFieldNames(1), cAlphas(1))); + ShowWarningError(state, format("{}: invalid {}=\"{}...ignored.", CurrentModuleObject, s_ipsc->cAlphaFieldNames(1), cAlphas(1))); } doTransform = true; s_surf->AspectTransform = true; diff --git a/src/EnergyPlus/DaylightingManager.hh b/src/EnergyPlus/DaylightingManager.hh index cc7e70c55cf..5220c8f5e8e 100644 --- a/src/EnergyPlus/DaylightingManager.hh +++ b/src/EnergyPlus/DaylightingManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -52,7 +52,6 @@ #include #include #include -#include #include // EnergyPlus Headers @@ -518,13 +517,13 @@ struct DaylightingData : BaseGlobalStruct int maxNumRefPtInAnyEncl = 0; // The most number of reference points that any single enclosure has Dayltg::SunAngles sunAngles = Dayltg::SunAngles(); - std::array sunAnglesHr = {Dayltg::SunAngles()}; + std::array sunAnglesHr = {Dayltg::SunAngles()}; // In the following I,J,K arrays: // I = 1 for clear sky, 2 for clear turbid, 3 for intermediate, 4 for overcast; // J = 1 for bare window, 2 - 12 for shaded; // K = sun position index. - std::array horIllum = { + std::array horIllum = { Dayltg::Illums()}; // Horizontal illuminance from sky, by sky type, for each hour of the day Array1D> dirIllum; // Sky-related component of direct illuminance Array1D> reflIllum; // Sky-related portion of internally reflected illuminance @@ -568,6 +567,10 @@ struct DaylightingData : BaseGlobalStruct Array1D YValue; Array2D IllumValue; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DemandManager.cc b/src/EnergyPlus/DemandManager.cc index 34d0da88b48..b7cf8d00311 100644 --- a/src/EnergyPlus/DemandManager.cc +++ b/src/EnergyPlus/DemandManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -210,7 +210,7 @@ void SimulateDemandManagerList(EnergyPlusData &state, auto &demandManagerList = state.dataDemandManager->DemandManagerList(ListNum); - demandManagerList.ScheduledLimit = ScheduleManager::GetCurrentScheduleValue(state, demandManagerList.LimitSchedule); + demandManagerList.ScheduledLimit = demandManagerList.limitSched->getCurrentVal(); demandManagerList.DemandLimit = demandManagerList.ScheduledLimit * demandManagerList.SafetyFraction; demandManagerList.MeterDemand = @@ -221,15 +221,7 @@ void SimulateDemandManagerList(EnergyPlusData &state, Real64 AverageDemand = demandManagerList.AverageDemand + (demandManagerList.MeterDemand - demandManagerList.History(1)) / demandManagerList.AveragingWindow; - if (demandManagerList.PeakSchedule == 0) { - OnPeak = true; - } else { - if (ScheduleManager::GetCurrentScheduleValue(state, demandManagerList.PeakSchedule) == 1) { - OnPeak = true; - } else { - OnPeak = false; - } - } + OnPeak = (demandManagerList.peakSched == nullptr) || (demandManagerList.peakSched->getCurrentVal() == 1); if (OnPeak) { Real64 OverLimit = AverageDemand - demandManagerList.DemandLimit; @@ -321,8 +313,13 @@ void GetDemandManagerListInput(EnergyPlusData &state) // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + static constexpr std::string_view routineName = "GetDemandManagerListInput"; constexpr std::string_view cCurrentModuleObject = "DemandManagerAssignmentList"; - state.dataDemandManager->NumDemandManagerList = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + + auto &s_ipsc = state.dataIPShortCut; + auto const &s_ip = state.dataInputProcessing->inputProcessor; + + state.dataDemandManager->NumDemandManagerList = s_ip->getNumObjectsFound(state, cCurrentModuleObject); if (state.dataDemandManager->NumDemandManagerList > 0) { int NumAlphas; // Number of elements in the alpha array @@ -336,90 +333,68 @@ void GetDemandManagerListInput(EnergyPlusData &state) auto &thisDemandMgrList = state.dataDemandManager->DemandManagerList(ListNum); - state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, - ListNum, - state.dataIPShortCut->cAlphaArgs, - NumAlphas, - state.dataIPShortCut->rNumericArgs, - NumNums, - IOStat, - _, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ip->getObjectItem(state, + cCurrentModuleObject, + ListNum, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + _, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); - thisDemandMgrList.Name = state.dataIPShortCut->cAlphaArgs(1); + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; - thisDemandMgrList.Meter = GetMeterIndex(state, state.dataIPShortCut->cAlphaArgs(2)); + thisDemandMgrList.Name = s_ipsc->cAlphaArgs(1); + + thisDemandMgrList.Meter = GetMeterIndex(state, s_ipsc->cAlphaArgs(2)); if (thisDemandMgrList.Meter == -1) { - ShowSevereError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); + ShowSevereError(state, format("Invalid {} = {}", s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, thisDemandMgrList.Name)); ErrorsFound = true; + } else if ((state.dataOutputProcessor->meters[thisDemandMgrList.Meter]->resource == Constant::eResource::Electricity) || + (state.dataOutputProcessor->meters[thisDemandMgrList.Meter]->resource == Constant::eResource::ElectricityNet)) { } else { - if ((state.dataOutputProcessor->meters[thisDemandMgrList.Meter]->resource == Constant::eResource::Electricity) || - (state.dataOutputProcessor->meters[thisDemandMgrList.Meter]->resource == Constant::eResource::ElectricityNet)) { - } else { - ShowSevereError(state, - format("{} = \"{}\" invalid value {} = \"{}\".", - cCurrentModuleObject, - thisDemandMgrList.Name, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError(state, "Only Electricity and ElectricityNet meters are currently allowed."); - ErrorsFound = true; - } + ShowSevereError(state, + format("{} = \"{}\" invalid value {} = \"{}\".", + cCurrentModuleObject, + thisDemandMgrList.Name, + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); + ShowContinueError(state, "Only Electricity and ElectricityNet meters are currently allowed."); + ErrorsFound = true; } // Further checking for conflicting DEMAND MANAGER LISTs - if (!state.dataIPShortCut->lAlphaFieldBlanks(3)) { - thisDemandMgrList.LimitSchedule = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(3)); - - if (thisDemandMgrList.LimitSchedule == 0) { - ShowSevereError(state, - format("{} = \"{}\" invalid {} = \"{}\" not found.", - cCurrentModuleObject, - thisDemandMgrList.Name, - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); - ErrorsFound = true; - } + if (s_ipsc->lAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(3)); + ErrorsFound = true; + } else if ((thisDemandMgrList.limitSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3)); + ErrorsFound = true; } - thisDemandMgrList.SafetyFraction = state.dataIPShortCut->rNumericArgs(1); - - if (!state.dataIPShortCut->lAlphaFieldBlanks(4)) { - thisDemandMgrList.BillingSchedule = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(4)); + thisDemandMgrList.SafetyFraction = s_ipsc->rNumericArgs(1); - if (thisDemandMgrList.BillingSchedule == 0) { - ShowSevereError(state, - format("{} = \"{}\" invalid {} = \"{}\" not found.", - cCurrentModuleObject, - thisDemandMgrList.Name, - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4))); - ErrorsFound = true; - } + if (s_ipsc->lAlphaFieldBlanks(4)) { + } else if ((thisDemandMgrList.billingSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(4))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4)); + ErrorsFound = true; } - if (!state.dataIPShortCut->lAlphaFieldBlanks(5)) { - thisDemandMgrList.PeakSchedule = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(5)); - - if (thisDemandMgrList.PeakSchedule == 0) { - ShowSevereError(state, - format("{} = \"{}\" invalid {} = \"{}\" not found.", - cCurrentModuleObject, - thisDemandMgrList.Name, - state.dataIPShortCut->cAlphaFieldNames(5), - state.dataIPShortCut->cAlphaArgs(5))); - ErrorsFound = true; - } + if (s_ipsc->lAlphaFieldBlanks(5)) { + } else if ((thisDemandMgrList.peakSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(5))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaArgs(5)); + ErrorsFound = true; } - thisDemandMgrList.AveragingWindow = max(int(state.dataIPShortCut->rNumericArgs(2) / state.dataGlobal->MinutesPerTimeStep), 1); + thisDemandMgrList.AveragingWindow = max(int(s_ipsc->rNumericArgs(2) / state.dataGlobal->MinutesInTimeStep), 1); // Round to nearest timestep // Can make this fancier to include windows that do not fit the timesteps thisDemandMgrList.History.allocate(thisDemandMgrList.AveragingWindow); @@ -427,7 +402,7 @@ void GetDemandManagerListInput(EnergyPlusData &state) // Validate Demand Manager Priority thisDemandMgrList.ManagerPriority = - static_cast(getEnumValue(ManagePriorityNamesUC, Util::makeUPPER(state.dataIPShortCut->cAlphaArgs(6)))); + static_cast(getEnumValue(ManagePriorityNamesUC, Util::makeUPPER(s_ipsc->cAlphaArgs(6)))); ErrorsFound = ErrorsFound || (thisDemandMgrList.ManagerPriority == ManagePriorityType::Invalid); // Get DEMAND MANAGER Type and Name pairs @@ -439,17 +414,16 @@ void GetDemandManagerListInput(EnergyPlusData &state) auto &thisManager = thisDemandMgrList.Manager(MgrNum); // Validate DEMAND MANAGER Type - ManagerType MgrType = - static_cast(getEnumValue(ManagerNamesUC, Util::makeUPPER(state.dataIPShortCut->cAlphaArgs(MgrNum * 2 + 5)))); + ManagerType MgrType = static_cast(getEnumValue(ManagerNamesUC, Util::makeUPPER(s_ipsc->cAlphaArgs(MgrNum * 2 + 5)))); if (MgrType != ManagerType::Invalid) { - thisManager = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(MgrNum * 2 + 6), state.dataDemandManager->DemandMgr); + thisManager = Util::FindItemInList(s_ipsc->cAlphaArgs(MgrNum * 2 + 6), state.dataDemandManager->DemandMgr); if (thisManager == 0) { ShowSevereError(state, format("{} = \"{}\" invalid {} = \"{}\" not found.", cCurrentModuleObject, thisDemandMgrList.Name, - state.dataIPShortCut->cAlphaFieldNames(MgrNum * 2 + 6), - state.dataIPShortCut->cAlphaArgs(MgrNum * 2 + 6))); + s_ipsc->cAlphaFieldNames(MgrNum * 2 + 6), + s_ipsc->cAlphaArgs(MgrNum * 2 + 6))); ErrorsFound = true; } } else { @@ -457,8 +431,8 @@ void GetDemandManagerListInput(EnergyPlusData &state) format("{} = \"{}\" invalid value {} = \"{}\".", cCurrentModuleObject, thisDemandMgrList.Name, - state.dataIPShortCut->cAlphaFieldNames(MgrNum * 2 + 5), - state.dataIPShortCut->cAlphaArgs(MgrNum * 2 + 5))); + s_ipsc->cAlphaFieldNames(MgrNum * 2 + 5), + s_ipsc->cAlphaArgs(MgrNum * 2 + 5))); ErrorsFound = true; } @@ -568,6 +542,11 @@ void GetDemandManagerInput(EnergyPlusData &state) // PURPOSE OF THIS SUBROUTINE: // Gets the DEMAND MANAGER input from the input file. + static constexpr std::string_view routineName = "GetDemandManagerInput"; + + auto &s_ipsc = state.dataIPShortCut; + auto const &s_ip = state.dataInputProcessing->inputProcessor; + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumAlphas; // Number of elements in the alpha array int NumNums; // Number of elements in the numeric array @@ -579,37 +558,37 @@ void GetDemandManagerInput(EnergyPlusData &state) int MaxAlphas = 0; int MaxNums = 0; std::string CurrentModuleObject = "DemandManager:ExteriorLights"; - int NumDemandMgrExtLights = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int NumDemandMgrExtLights = s_ip->getNumObjectsFound(state, CurrentModuleObject); if (NumDemandMgrExtLights > 0) { - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, NumParams, NumAlphas, NumNums); + s_ip->getObjectDefMaxArgs(state, CurrentModuleObject, NumParams, NumAlphas, NumNums); MaxAlphas = max(MaxAlphas, NumAlphas); MaxNums = max(MaxNums, NumNums); } CurrentModuleObject = "DemandManager:Lights"; - int NumDemandMgrLights = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int NumDemandMgrLights = s_ip->getNumObjectsFound(state, CurrentModuleObject); if (NumDemandMgrLights > 0) { - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, NumParams, NumAlphas, NumNums); + s_ip->getObjectDefMaxArgs(state, CurrentModuleObject, NumParams, NumAlphas, NumNums); MaxAlphas = max(MaxAlphas, NumAlphas); MaxNums = max(MaxNums, NumNums); } CurrentModuleObject = "DemandManager:ElectricEquipment"; - int NumDemandMgrElecEquip = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int NumDemandMgrElecEquip = s_ip->getNumObjectsFound(state, CurrentModuleObject); if (NumDemandMgrElecEquip > 0) { - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, NumParams, NumAlphas, NumNums); + s_ip->getObjectDefMaxArgs(state, CurrentModuleObject, NumParams, NumAlphas, NumNums); MaxAlphas = max(MaxAlphas, NumAlphas); MaxNums = max(MaxNums, NumNums); } CurrentModuleObject = "DemandManager:Thermostats"; - int NumDemandMgrThermostats = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int NumDemandMgrThermostats = s_ip->getNumObjectsFound(state, CurrentModuleObject); if (NumDemandMgrThermostats > 0) { - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, NumParams, NumAlphas, NumNums); + s_ip->getObjectDefMaxArgs(state, CurrentModuleObject, NumParams, NumAlphas, NumNums); MaxAlphas = max(MaxAlphas, NumAlphas); MaxNums = max(MaxNums, NumNums); } CurrentModuleObject = "DemandManager:Ventilation"; - int NumDemandMgrVentilation = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int NumDemandMgrVentilation = s_ip->getNumObjectsFound(state, CurrentModuleObject); if (NumDemandMgrVentilation > 0) { - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, NumParams, NumAlphas, NumNums); + s_ip->getObjectDefMaxArgs(state, CurrentModuleObject, NumParams, NumAlphas, NumNums); MaxAlphas = max(MaxAlphas, NumAlphas); MaxNums = max(MaxNums, NumNums); } @@ -636,42 +615,32 @@ void GetDemandManagerInput(EnergyPlusData &state) for (int MgrNum = StartIndex; MgrNum <= EndIndex; ++MgrNum) { auto &demandMgr = DemandMgr(MgrNum); - state.dataInputProcessing->inputProcessor->getObjectItem(state, - CurrentModuleObject, - MgrNum - StartIndex + 1, - AlphArray, - NumAlphas, - NumArray, - NumNums, - IOStat, - _, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - GlobalNames::VerifyUniqueInterObjectName(state, - state.dataDemandManager->UniqueDemandMgrNames, - AlphArray(1), - CurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), - ErrorsFound); + s_ip->getObjectItem(state, + CurrentModuleObject, + MgrNum - StartIndex + 1, + AlphArray, + NumAlphas, + NumArray, + NumNums, + IOStat, + _, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, AlphArray(1)}; + + GlobalNames::VerifyUniqueInterObjectName( + state, state.dataDemandManager->UniqueDemandMgrNames, AlphArray(1), CurrentModuleObject, s_ipsc->cAlphaFieldNames(1), ErrorsFound); demandMgr.Name = AlphArray(1); demandMgr.Type = ManagerType::ExtLights; - if (!state.dataIPShortCut->lAlphaFieldBlanks(2)) { - demandMgr.AvailSchedule = ScheduleManager::GetScheduleIndex(state, AlphArray(2)); - - if (demandMgr.AvailSchedule == 0) { - ShowSevereError(state, - format("{}=\"{}\" invalid {}=\"{}\" not found.", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(2), - AlphArray(2))); - ErrorsFound = true; - } - } else { - demandMgr.AvailSchedule = ScheduleManager::ScheduleAlwaysOn; + if (s_ipsc->lAlphaFieldBlanks(2)) { + demandMgr.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((demandMgr.availSched = Sched::GetSchedule(state, AlphArray(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), AlphArray(2)); + ErrorsFound = true; } // Validate Limiting Control @@ -679,7 +648,7 @@ void GetDemandManagerInput(EnergyPlusData &state) ErrorsFound = ErrorsFound || (demandMgr.LimitControl == ManagerLimit::Invalid); if (NumArray(1) == 0.0) - demandMgr.LimitDuration = state.dataGlobal->MinutesPerTimeStep; + demandMgr.LimitDuration = state.dataGlobal->MinutesInTimeStep; else demandMgr.LimitDuration = NumArray(1); @@ -690,7 +659,7 @@ void GetDemandManagerInput(EnergyPlusData &state) ErrorsFound = ErrorsFound || (demandMgr.SelectionControl == ManagerSelection::Invalid); if (NumArray(4) == 0.0) - demandMgr.RotationDuration = state.dataGlobal->MinutesPerTimeStep; + demandMgr.RotationDuration = state.dataGlobal->MinutesInTimeStep; else demandMgr.RotationDuration = NumArray(4); @@ -709,15 +678,14 @@ void GetDemandManagerInput(EnergyPlusData &state) ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\" not found.", CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(LoadNum + 4), + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(LoadNum + 4), AlphArray(LoadNum + 4))); ErrorsFound = true; } } // LoadNum } else { - ShowSevereError(state, - format("{}=\"{}\" invalid value for number of loads.", CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("{}=\"{}\" invalid value for number of loads.", CurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "Number of loads is calculated to be less than one. Demand manager must have at least one load assigned."); ErrorsFound = true; } @@ -733,42 +701,31 @@ void GetDemandManagerInput(EnergyPlusData &state) for (int MgrNum = StartIndex; MgrNum <= EndIndex; ++MgrNum) { auto &demandMgr = DemandMgr(MgrNum); - state.dataInputProcessing->inputProcessor->getObjectItem(state, - CurrentModuleObject, - MgrNum - StartIndex + 1, - AlphArray, - NumAlphas, - NumArray, - NumNums, - IOStat, - _, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - GlobalNames::VerifyUniqueInterObjectName(state, - state.dataDemandManager->UniqueDemandMgrNames, - AlphArray(1), - CurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), - ErrorsFound); + s_ip->getObjectItem(state, + CurrentModuleObject, + MgrNum - StartIndex + 1, + AlphArray, + NumAlphas, + NumArray, + NumNums, + IOStat, + _, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, AlphArray(1)}; + GlobalNames::VerifyUniqueInterObjectName( + state, state.dataDemandManager->UniqueDemandMgrNames, AlphArray(1), CurrentModuleObject, s_ipsc->cAlphaFieldNames(1), ErrorsFound); demandMgr.Name = AlphArray(1); demandMgr.Type = ManagerType::Lights; - if (!state.dataIPShortCut->lAlphaFieldBlanks(2)) { - demandMgr.AvailSchedule = ScheduleManager::GetScheduleIndex(state, AlphArray(2)); - - if (demandMgr.AvailSchedule == 0) { - ShowSevereError(state, - format("{}=\"{}\" invalid {}=\"{}\" not found.", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(2), - AlphArray(2))); - ErrorsFound = true; - } - } else { - demandMgr.AvailSchedule = ScheduleManager::ScheduleAlwaysOn; + if (s_ipsc->lAlphaFieldBlanks(2)) { + demandMgr.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((demandMgr.availSched = Sched::GetSchedule(state, AlphArray(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), AlphArray(2)); + ErrorsFound = true; } // Validate Limiting Control @@ -776,7 +733,7 @@ void GetDemandManagerInput(EnergyPlusData &state) ErrorsFound = ErrorsFound || (demandMgr.LimitControl == ManagerLimit::Invalid); if (NumArray(1) == 0.0) - demandMgr.LimitDuration = state.dataGlobal->MinutesPerTimeStep; + demandMgr.LimitDuration = state.dataGlobal->MinutesInTimeStep; else demandMgr.LimitDuration = NumArray(1); @@ -787,7 +744,7 @@ void GetDemandManagerInput(EnergyPlusData &state) ErrorsFound = ErrorsFound || (demandMgr.SelectionControl == ManagerSelection::Invalid); if (NumArray(4) == 0.0) - demandMgr.RotationDuration = state.dataGlobal->MinutesPerTimeStep; + demandMgr.RotationDuration = state.dataGlobal->MinutesInTimeStep; else demandMgr.RotationDuration = NumArray(4); @@ -805,8 +762,8 @@ void GetDemandManagerInput(EnergyPlusData &state) ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\" not found.", CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(LoadNum + 4), + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(LoadNum + 4), AlphArray(LoadNum + 4))); ErrorsFound = true; } @@ -834,8 +791,7 @@ void GetDemandManagerInput(EnergyPlusData &state) } } // LoadNum } else { - ShowSevereError(state, - format("{}=\"{}\" invalid value for number of loads.", CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("{}=\"{}\" invalid value for number of loads.", CurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "Number of loads is calculated to be less than one. Demand manager must have at least one load assigned."); ErrorsFound = true; } @@ -851,42 +807,32 @@ void GetDemandManagerInput(EnergyPlusData &state) for (int MgrNum = StartIndex; MgrNum <= EndIndex; ++MgrNum) { auto &demandMgr = DemandMgr(MgrNum); - state.dataInputProcessing->inputProcessor->getObjectItem(state, - CurrentModuleObject, - MgrNum - StartIndex + 1, - AlphArray, - NumAlphas, - NumArray, - NumNums, - IOStat, - _, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - GlobalNames::VerifyUniqueInterObjectName(state, - state.dataDemandManager->UniqueDemandMgrNames, - AlphArray(1), - CurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), - ErrorsFound); + s_ip->getObjectItem(state, + CurrentModuleObject, + MgrNum - StartIndex + 1, + AlphArray, + NumAlphas, + NumArray, + NumNums, + IOStat, + _, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, AlphArray(1)}; + GlobalNames::VerifyUniqueInterObjectName( + state, state.dataDemandManager->UniqueDemandMgrNames, AlphArray(1), CurrentModuleObject, s_ipsc->cAlphaFieldNames(1), ErrorsFound); + demandMgr.Name = AlphArray(1); demandMgr.Type = ManagerType::ElecEquip; - if (!state.dataIPShortCut->lAlphaFieldBlanks(2)) { - demandMgr.AvailSchedule = ScheduleManager::GetScheduleIndex(state, AlphArray(2)); - - if (demandMgr.AvailSchedule == 0) { - ShowSevereError(state, - format("{}=\"{}\" invalid {}=\"{}\" not found.", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(2), - AlphArray(2))); - ErrorsFound = true; - } - } else { - demandMgr.AvailSchedule = ScheduleManager::ScheduleAlwaysOn; + if (s_ipsc->lAlphaFieldBlanks(2)) { + demandMgr.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((demandMgr.availSched = Sched::GetSchedule(state, AlphArray(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), AlphArray(2)); + ErrorsFound = true; } // Validate Limiting Control @@ -894,7 +840,7 @@ void GetDemandManagerInput(EnergyPlusData &state) ErrorsFound = ErrorsFound || (demandMgr.LimitControl == ManagerLimit::Invalid); if (NumArray(1) == 0.0) - demandMgr.LimitDuration = state.dataGlobal->MinutesPerTimeStep; + demandMgr.LimitDuration = state.dataGlobal->MinutesInTimeStep; else demandMgr.LimitDuration = NumArray(1); @@ -905,7 +851,7 @@ void GetDemandManagerInput(EnergyPlusData &state) ErrorsFound = ErrorsFound || (demandMgr.SelectionControl == ManagerSelection::Invalid); if (NumArray(4) == 0.0) - demandMgr.RotationDuration = state.dataGlobal->MinutesPerTimeStep; + demandMgr.RotationDuration = state.dataGlobal->MinutesInTimeStep; else demandMgr.RotationDuration = NumArray(4); @@ -923,8 +869,8 @@ void GetDemandManagerInput(EnergyPlusData &state) ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\" not found.", CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(LoadNum + 4), + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(LoadNum + 4), AlphArray(LoadNum + 4))); ErrorsFound = true; } @@ -952,8 +898,7 @@ void GetDemandManagerInput(EnergyPlusData &state) } } // LoadNum } else { - ShowSevereError(state, - format("{}=\"{}\" invalid value for number of loads.", CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("{}=\"{}\" invalid value for number of loads.", CurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "Number of loads is calculated to be less than one. Demand manager must have at least one load assigned."); ErrorsFound = true; } @@ -969,43 +914,32 @@ void GetDemandManagerInput(EnergyPlusData &state) for (int MgrNum = StartIndex; MgrNum <= EndIndex; ++MgrNum) { auto &demandMgr = DemandMgr(MgrNum); - state.dataInputProcessing->inputProcessor->getObjectItem(state, - CurrentModuleObject, - MgrNum - StartIndex + 1, - AlphArray, - NumAlphas, - NumArray, - NumNums, - IOStat, - _, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - - GlobalNames::VerifyUniqueInterObjectName(state, - state.dataDemandManager->UniqueDemandMgrNames, - AlphArray(1), - CurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), - ErrorsFound); + s_ip->getObjectItem(state, + CurrentModuleObject, + MgrNum - StartIndex + 1, + AlphArray, + NumAlphas, + NumArray, + NumNums, + IOStat, + _, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, AlphArray(1)}; + + GlobalNames::VerifyUniqueInterObjectName( + state, state.dataDemandManager->UniqueDemandMgrNames, AlphArray(1), CurrentModuleObject, s_ipsc->cAlphaFieldNames(1), ErrorsFound); demandMgr.Name = AlphArray(1); demandMgr.Type = ManagerType::Thermostats; - if (!state.dataIPShortCut->lAlphaFieldBlanks(2)) { - demandMgr.AvailSchedule = ScheduleManager::GetScheduleIndex(state, AlphArray(2)); - - if (demandMgr.AvailSchedule == 0) { - ShowSevereError(state, - format("{}=\"{}\" invalid {}=\"{}\" not found.", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(2), - AlphArray(2))); - ErrorsFound = true; - } - } else { - demandMgr.AvailSchedule = ScheduleManager::ScheduleAlwaysOn; + if (s_ipsc->lAlphaFieldBlanks(2)) { + demandMgr.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((demandMgr.availSched = Sched::GetSchedule(state, AlphArray(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), AlphArray(2)); + ErrorsFound = true; } // Validate Limiting Control @@ -1013,7 +947,7 @@ void GetDemandManagerInput(EnergyPlusData &state) ErrorsFound = ErrorsFound || (demandMgr.LimitControl == ManagerLimit::Invalid); if (NumArray(1) == 0.0) - demandMgr.LimitDuration = state.dataGlobal->MinutesPerTimeStep; + demandMgr.LimitDuration = state.dataGlobal->MinutesInTimeStep; else demandMgr.LimitDuration = NumArray(1); @@ -1022,15 +956,10 @@ void GetDemandManagerInput(EnergyPlusData &state) if (demandMgr.LowerLimit > demandMgr.UpperLimit) { ShowSevereError(state, format("Invalid input for {} = {}", CurrentModuleObject, AlphArray(1))); - ShowContinueError(state, - format("{} [{:.R2}] > {} [{.R2}]", - state.dataIPShortCut->cNumericFieldNames(2), - NumArray(2), - state.dataIPShortCut->cNumericFieldNames(3), - NumArray(3))); ShowContinueError( state, - format("{} cannot be greater than {}", state.dataIPShortCut->cNumericFieldNames(2), state.dataIPShortCut->cNumericFieldNames(3))); + format("{} [{:.2R}] > {} [{:.2R}]", s_ipsc->cNumericFieldNames(2), NumArray(2), s_ipsc->cNumericFieldNames(3), NumArray(3))); + ShowContinueError(state, format("{} cannot be greater than {}", s_ipsc->cNumericFieldNames(2), s_ipsc->cNumericFieldNames(3))); ErrorsFound = true; } @@ -1039,7 +968,7 @@ void GetDemandManagerInput(EnergyPlusData &state) ErrorsFound = ErrorsFound || (demandMgr.SelectionControl == ManagerSelection::Invalid); if (NumArray(5) == 0.0) - demandMgr.RotationDuration = state.dataGlobal->MinutesPerTimeStep; + demandMgr.RotationDuration = state.dataGlobal->MinutesInTimeStep; else demandMgr.RotationDuration = NumArray(5); @@ -1057,8 +986,8 @@ void GetDemandManagerInput(EnergyPlusData &state) ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\" not found.", CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(LoadNum + 4), + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(LoadNum + 4), AlphArray(LoadNum + 4))); ErrorsFound = true; } @@ -1084,8 +1013,7 @@ void GetDemandManagerInput(EnergyPlusData &state) } } // LoadNum } else { - ShowSevereError(state, - format("{}=\"{}\" invalid value for number of loads.", CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("{}=\"{}\" invalid value for number of loads.", CurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "Number of loads is calculated to be less than one. Demand manager must have at least one load assigned."); ErrorsFound = true; } @@ -1100,53 +1028,38 @@ void GetDemandManagerInput(EnergyPlusData &state) for (int MgrNum = StartIndex; MgrNum <= EndIndex; ++MgrNum) { auto &demandMgr = DemandMgr(MgrNum); - state.dataInputProcessing->inputProcessor->getObjectItem(state, - CurrentModuleObject, - MgrNum - StartIndex + 1, - AlphArray, - NumAlphas, - NumArray, - NumNums, - IOStat, - _, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - - GlobalNames::VerifyUniqueInterObjectName(state, - state.dataDemandManager->UniqueDemandMgrNames, - AlphArray(1), - CurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), - ErrorsFound); + s_ip->getObjectItem(state, + CurrentModuleObject, + MgrNum - StartIndex + 1, + AlphArray, + NumAlphas, + NumArray, + NumNums, + IOStat, + _, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, AlphArray(1)}; + GlobalNames::VerifyUniqueInterObjectName( + state, state.dataDemandManager->UniqueDemandMgrNames, AlphArray(1), CurrentModuleObject, s_ipsc->cAlphaFieldNames(1), ErrorsFound); demandMgr.Name = AlphArray(1); demandMgr.Type = ManagerType::Ventilation; - if (!state.dataIPShortCut->lAlphaFieldBlanks(2)) { - demandMgr.AvailSchedule = ScheduleManager::GetScheduleIndex(state, AlphArray(2)); - - if (demandMgr.AvailSchedule == 0) { - ShowSevereError(state, - format("{}=\"{}\" invalid {}=\"{}\" not found.", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(2), - AlphArray(2))); - ErrorsFound = true; - } - } else { - demandMgr.AvailSchedule = ScheduleManager::ScheduleAlwaysOn; + if (s_ipsc->lAlphaFieldBlanks(2)) { + demandMgr.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((demandMgr.availSched = Sched::GetSchedule(state, AlphArray(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), AlphArray(2)); + ErrorsFound = true; } // Validate Limiting Control demandMgr.LimitControl = static_cast(getEnumValue(ManagerLimitVentNamesUC, Util::makeUPPER(AlphArray(3)))); ErrorsFound = ErrorsFound || (demandMgr.LimitControl == ManagerLimit::Invalid); - if (NumArray(1) == 0.0) - demandMgr.LimitDuration = state.dataGlobal->MinutesPerTimeStep; - else - demandMgr.LimitDuration = NumArray(1); + demandMgr.LimitDuration = (NumArray(1) == 0.0) ? state.dataGlobal->MinutesInTimeStep : NumArray(1); if (demandMgr.LimitControl == ManagerLimit::Fixed) demandMgr.FixedRate = NumArray(2); if (demandMgr.LimitControl == ManagerLimit::ReductionRatio) demandMgr.ReductionRatio = NumArray(3); @@ -1157,10 +1070,7 @@ void GetDemandManagerInput(EnergyPlusData &state) demandMgr.SelectionControl = static_cast(getEnumValue(ManagerSelectionNamesUC, Util::makeUPPER(AlphArray(4)))); ErrorsFound = ErrorsFound || (demandMgr.SelectionControl == ManagerSelection::Invalid); - if (NumArray(5) == 0.0) - demandMgr.RotationDuration = state.dataGlobal->MinutesPerTimeStep; - else - demandMgr.RotationDuration = NumArray(5); + demandMgr.RotationDuration = (NumArray(5) == 0.0) ? state.dataGlobal->MinutesInTimeStep : NumArray(5); // Count number of string fields for loading Controller:OutdoorAir names. This number must be increased in case if // new string field is added or decreased if string fields are removed. @@ -1176,8 +1086,8 @@ void GetDemandManagerInput(EnergyPlusData &state) ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\" not found.", CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(LoadNum + AlphaShift), + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(LoadNum + AlphaShift), AlphArray(LoadNum + AlphaShift))); ErrorsFound = true; } @@ -1192,8 +1102,7 @@ void GetDemandManagerInput(EnergyPlusData &state) } } } else { - ShowSevereError(state, - format("{}=\"{}\" invalid value for number of loads.", CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("{}=\"{}\" invalid value for number of loads.", CurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "Number of loads is calculated to be less than one. Demand manager must have at least one load assigned."); ErrorsFound = true; } @@ -1346,7 +1255,6 @@ void UpdateDemandManagers(EnergyPlusData &state) // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int LoadPtr; - bool Available; bool CanReduceDemand; int RotatedLoadNum; @@ -1355,12 +1263,7 @@ void UpdateDemandManagers(EnergyPlusData &state) auto &demandMgr = state.dataDemandManager->DemandMgr(MgrNum); // Check availability - if (ScheduleManager::GetCurrentScheduleValue(state, demandMgr.AvailSchedule) > 0.0) { - Available = true; - } else { - Available = false; - } - // END IF + bool Available = demandMgr.availSched->getCurrentVal() > 0.0; demandMgr.Available = Available; @@ -1369,7 +1272,7 @@ void UpdateDemandManagers(EnergyPlusData &state) if (demandMgr.Active) { - demandMgr.ElapsedTime += state.dataGlobal->MinutesPerTimeStep; + demandMgr.ElapsedTime += state.dataGlobal->MinutesInTimeStep; // Check for expiring limit duration if (demandMgr.ElapsedTime >= demandMgr.LimitDuration) { @@ -1391,7 +1294,7 @@ void UpdateDemandManagers(EnergyPlusData &state) } break; case ManagerSelection::Many: { // All loads are limited except for one - demandMgr.ElapsedRotationTime += state.dataGlobal->MinutesPerTimeStep; + demandMgr.ElapsedRotationTime += state.dataGlobal->MinutesInTimeStep; if (demandMgr.ElapsedRotationTime >= demandMgr.RotationDuration) { demandMgr.ElapsedRotationTime = 0; @@ -1415,7 +1318,7 @@ void UpdateDemandManagers(EnergyPlusData &state) } break; case ManagerSelection::One: { // Only one load is limited - demandMgr.ElapsedRotationTime += state.dataGlobal->MinutesPerTimeStep; + demandMgr.ElapsedRotationTime += state.dataGlobal->MinutesInTimeStep; if (demandMgr.ElapsedRotationTime >= demandMgr.RotationDuration) { demandMgr.ElapsedRotationTime = 0; @@ -1470,18 +1373,13 @@ void ReportDemandManagerList(EnergyPlusData &state, int const ListNum) // Standard EnergyPlus methodology. // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 BillingPeriod; int AveragingWindow; bool OnPeak; Real64 OverLimit; auto &demandManagerList = state.dataDemandManager->DemandManagerList(ListNum); - if (demandManagerList.BillingSchedule == 0) { - BillingPeriod = state.dataEnvrn->Month; - } else { - BillingPeriod = ScheduleManager::GetCurrentScheduleValue(state, demandManagerList.BillingSchedule); - } + Real64 BillingPeriod = (demandManagerList.billingSched == nullptr) ? state.dataEnvrn->Month : demandManagerList.billingSched->getCurrentVal(); if (demandManagerList.BillingPeriod != BillingPeriod) { // Reset variables for new billing period @@ -1503,15 +1401,7 @@ void ReportDemandManagerList(EnergyPlusData &state, int const ListNum) } demandManagerList.History(AveragingWindow) = demandManagerList.MeterDemand; - if (demandManagerList.PeakSchedule == 0) { - OnPeak = true; - } else { - if (ScheduleManager::GetCurrentScheduleValue(state, demandManagerList.PeakSchedule) == 1) { - OnPeak = true; - } else { - OnPeak = false; - } - } + OnPeak = (demandManagerList.peakSched == nullptr) || (demandManagerList.peakSched->getCurrentVal() == 1); if (OnPeak) { demandManagerList.PeakDemand = max(demandManagerList.AverageDemand, demandManagerList.PeakDemand); @@ -1519,7 +1409,7 @@ void ReportDemandManagerList(EnergyPlusData &state, int const ListNum) OverLimit = demandManagerList.AverageDemand - demandManagerList.ScheduledLimit; if (OverLimit > 0.0) { demandManagerList.OverLimit = OverLimit; - demandManagerList.OverLimitDuration += (state.dataGlobal->MinutesPerTimeStep / 60.0); + demandManagerList.OverLimitDuration += (state.dataGlobal->MinutesInTimeStep / 60.0); } else { demandManagerList.OverLimit = 0.0; } @@ -1541,6 +1431,7 @@ void LoadInterface(EnergyPlusData &state, DemandAction const Action, int const M // Demand managers for new types of loads can be easily added with a new CASE statement in this subroutine // and new GetInput code. + auto const &s_dhbf = state.dataHeatBalFanSys; auto const &demandMgr = state.dataDemandManager->DemandMgr(MgrNum); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: @@ -1560,6 +1451,7 @@ void LoadInterface(EnergyPlusData &state, DemandAction const Action, int const M state.dataExteriorEnergyUse->ExteriorLights(LoadPtr).ManageDemand = false; } } break; + case ManagerType::Lights: { LowestPower = state.dataHeatBal->Lights(LoadPtr).DesignLevel * demandMgr.LowerLimit; if (Action == DemandAction::CheckCanReduce) { @@ -1570,8 +1462,8 @@ void LoadInterface(EnergyPlusData &state, DemandAction const Action, int const M } else if (Action == DemandAction::ClearLimit) { state.dataHeatBal->Lights(LoadPtr).ManageDemand = false; } - } break; + case ManagerType::ElecEquip: { LowestPower = state.dataHeatBal->ZoneElectric(LoadPtr).DesignLevel * demandMgr.LowerLimit; if (Action == DemandAction::CheckCanReduce) { @@ -1583,39 +1475,38 @@ void LoadInterface(EnergyPlusData &state, DemandAction const Action, int const M state.dataHeatBal->ZoneElectric(LoadPtr).ManageDemand = false; } } break; + case ManagerType::Thermostats: { + auto &tempZone = state.dataZoneCtrls->TempControlledZone(LoadPtr); + auto &zoneTstatSetpt = s_dhbf->zoneTstatSetpts(tempZone.ActualZoneNum); if (Action == DemandAction::CheckCanReduce) { - if (state.dataHeatBalFanSys->ZoneThermostatSetPointLo(state.dataZoneCtrls->TempControlledZone(LoadPtr).ActualZoneNum) > - demandMgr.LowerLimit || - state.dataHeatBalFanSys->ZoneThermostatSetPointHi(state.dataZoneCtrls->TempControlledZone(LoadPtr).ActualZoneNum) < - demandMgr.UpperLimit) + if (zoneTstatSetpt.setptLo > demandMgr.LowerLimit || zoneTstatSetpt.setptHi < demandMgr.UpperLimit) CanReduceDemand = true; // Heating | Cooling } else if (Action == DemandAction::SetLimit) { - state.dataZoneCtrls->TempControlledZone(LoadPtr).ManageDemand = true; - state.dataZoneCtrls->TempControlledZone(LoadPtr).HeatingResetLimit = demandMgr.LowerLimit; - state.dataZoneCtrls->TempControlledZone(LoadPtr).CoolingResetLimit = demandMgr.UpperLimit; + tempZone.ManageDemand = true; + tempZone.HeatingResetLimit = demandMgr.LowerLimit; + tempZone.CoolingResetLimit = demandMgr.UpperLimit; } else if (Action == DemandAction::ClearLimit) { - state.dataZoneCtrls->TempControlledZone(LoadPtr).ManageDemand = false; + tempZone.ManageDemand = false; } if (state.dataZoneCtrls->NumComfortControlledZones > 0) { - if (state.dataHeatBalFanSys->ComfortControlType(state.dataZoneCtrls->TempControlledZone(LoadPtr).ActualZoneNum) != - HVAC::ThermostatType::Uncontrolled) { + auto &comfortZone = state.dataZoneCtrls->ComfortControlledZone(LoadPtr); + if (state.dataHeatBalFanSys->ComfortControlType(comfortZone.ActualZoneNum) != HVAC::SetptType::Uncontrolled) { + auto &zoneTstatSetpt = s_dhbf->zoneTstatSetpts(comfortZone.ActualZoneNum); if (Action == DemandAction::CheckCanReduce) { - if (state.dataHeatBalFanSys->ZoneThermostatSetPointLo(state.dataZoneCtrls->ComfortControlledZone(LoadPtr).ActualZoneNum) > - demandMgr.LowerLimit || - state.dataHeatBalFanSys->ZoneThermostatSetPointHi(state.dataZoneCtrls->ComfortControlledZone(LoadPtr).ActualZoneNum) < - demandMgr.UpperLimit) + if (zoneTstatSetpt.setptLo > demandMgr.LowerLimit || zoneTstatSetpt.setptHi < demandMgr.UpperLimit) CanReduceDemand = true; // Heating } else if (Action == DemandAction::SetLimit) { - state.dataZoneCtrls->ComfortControlledZone(LoadPtr).ManageDemand = true; - state.dataZoneCtrls->ComfortControlledZone(LoadPtr).HeatingResetLimit = demandMgr.LowerLimit; - state.dataZoneCtrls->ComfortControlledZone(LoadPtr).CoolingResetLimit = demandMgr.UpperLimit; + comfortZone.ManageDemand = true; + comfortZone.HeatingResetLimit = demandMgr.LowerLimit; + comfortZone.CoolingResetLimit = demandMgr.UpperLimit; } else if (Action == DemandAction::ClearLimit) { - state.dataZoneCtrls->ComfortControlledZone(LoadPtr).ManageDemand = false; + comfortZone.ManageDemand = false; } } } } break; + case ManagerType::Ventilation: { Real64 FlowRate(0); FlowRate = MixedAir::OAGetFlowRate(state, LoadPtr); diff --git a/src/EnergyPlus/DemandManager.hh b/src/EnergyPlus/DemandManager.hh index 485cb8fd0c5..2ceca028f88 100644 --- a/src/EnergyPlus/DemandManager.hh +++ b/src/EnergyPlus/DemandManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -58,6 +58,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -119,32 +120,31 @@ namespace DemandManager { struct DemandManagerListData { // Members - std::string Name; // Name of DEMAND MANAGER LIST - int Meter; // Index to meter to demand limit - int LimitSchedule; // Schedule index for demand limit - Real64 SafetyFraction; // Multiplier applied to demand limit schedule - int BillingSchedule; // Schedule index for billing month periods - Real64 BillingPeriod; // Current billing period value - int PeakSchedule; // Schedule index for billing month periods - int AveragingWindow; // Number of timesteps for averaging demand window - Array1D History; // Demand window history - ManagePriorityType ManagerPriority; // Indicator for priority (SEQUENTIAL, OPTIMAL, ALL) - int NumOfManager = 0; // Number of DEMAND MANAGERs - Array1D_int Manager; // Indexes for DEMAND MANAGERs - Real64 MeterDemand; // Meter demand at this timestep - Real64 AverageDemand; // Current demand over the demand window - Real64 PeakDemand; // Peak demand in the billing month so far - Real64 ScheduledLimit; // Scheduled demand limit - Real64 DemandLimit; // Scheduled demand limit * Safety Fraction - Real64 AvoidedDemand; // Demand avoided by active DEMAND MANAGERs - Real64 OverLimit; // Amount that demand limit is exceeded - Real64 OverLimitDuration; // Number of hours that demand limit is exceeded + std::string Name; // Name of DEMAND MANAGER LIST + int Meter; // Index to meter to demand limit + Sched::Schedule *limitSched = nullptr; // Schedule for demand limit + Real64 SafetyFraction; // Multiplier applied to demand limit schedule + Sched::Schedule *billingSched = nullptr; // Schedule for billing month periods + Real64 BillingPeriod; // Current billing period value + Sched::Schedule *peakSched = nullptr; // Schedule index for billing month periods + int AveragingWindow; // Number of timesteps for averaging demand window + Array1D History; // Demand window history + ManagePriorityType ManagerPriority; // Indicator for priority (SEQUENTIAL, OPTIMAL, ALL) + int NumOfManager = 0; // Number of DEMAND MANAGERs + Array1D_int Manager; // Indexes for DEMAND MANAGERs + Real64 MeterDemand; // Meter demand at this timestep + Real64 AverageDemand; // Current demand over the demand window + Real64 PeakDemand; // Peak demand in the billing month so far + Real64 ScheduledLimit; // Scheduled demand limit + Real64 DemandLimit; // Scheduled demand limit * Safety Fraction + Real64 AvoidedDemand; // Demand avoided by active DEMAND MANAGERs + Real64 OverLimit; // Amount that demand limit is exceeded + Real64 OverLimitDuration; // Number of hours that demand limit is exceeded // Default Constructor DemandManagerListData() - : Meter(0), LimitSchedule(0), SafetyFraction(1.0), BillingSchedule(0), BillingPeriod(0.0), PeakSchedule(0), AveragingWindow(1), - ManagerPriority(ManagePriorityType::Invalid), MeterDemand(0.0), AverageDemand(0.0), PeakDemand(0.0), ScheduledLimit(0.0), - DemandLimit(0.0), AvoidedDemand(0.0), OverLimit(0.0), OverLimitDuration(0.0) + : Meter(0), SafetyFraction(1.0), BillingPeriod(0.0), AveragingWindow(1), ManagerPriority(ManagePriorityType::Invalid), MeterDemand(0.0), + AverageDemand(0.0), PeakDemand(0.0), ScheduledLimit(0.0), DemandLimit(0.0), AvoidedDemand(0.0), OverLimit(0.0), OverLimitDuration(0.0) { } }; @@ -152,14 +152,14 @@ namespace DemandManager { struct DemandManagerData { // Members - std::string Name; // Name of DEMAND MANAGER - ManagerType Type; // Type of DEMAND MANAGER (:LIGHTS, :ELECTRICEQUIPMENT, etc.) - int DemandManagerList; // Reference to parent DEMAND MANAGER LIST for error checking - bool CanReduceDemand; // Flag to indicate whether manager can reduce demand - int AvailSchedule; // Schedule index pointer for Availability Schedule - bool Available; // Availability flag - bool Activate; // Flag to activate the manager - bool Active; // Flag to indicate that the manager is active + std::string Name; // Name of DEMAND MANAGER + ManagerType Type; // Type of DEMAND MANAGER (:LIGHTS, :ELECTRICEQUIPMENT, etc.) + int DemandManagerList; // Reference to parent DEMAND MANAGER LIST for error checking + bool CanReduceDemand; // Flag to indicate whether manager can reduce demand + Sched::Schedule *availSched = nullptr; // Availability Schedule + bool Available; // Availability flag + bool Activate; // Flag to activate the manager + bool Active; // Flag to indicate that the manager is active ManagerLimit LimitControl; ManagerSelection SelectionControl; int LimitDuration; // Minimum duration of demand manager activity (min) @@ -180,10 +180,9 @@ namespace DemandManager { // Default Constructor DemandManagerData() - : Type(ManagerType::Invalid), DemandManagerList(0), CanReduceDemand(false), AvailSchedule(0), Available(false), Activate(false), - Active(false), LimitControl(ManagerLimit::Invalid), SelectionControl(ManagerSelection::Invalid), LimitDuration(0), ElapsedTime(0), - RotationDuration(0), ElapsedRotationTime(0), RotatedLoadNum(0), LowerLimit(0.0), UpperLimit(0.0), NumOfLoads(0), FixedRate(0.0), - ReductionRatio(0.0) + : Type(ManagerType::Invalid), DemandManagerList(0), CanReduceDemand(false), Available(false), Activate(false), Active(false), + LimitControl(ManagerLimit::Invalid), SelectionControl(ManagerSelection::Invalid), LimitDuration(0), ElapsedTime(0), RotationDuration(0), + ElapsedRotationTime(0), RotatedLoadNum(0), LowerLimit(0.0), UpperLimit(0.0), NumOfLoads(0), FixedRate(0.0), ReductionRatio(0.0) { } }; @@ -233,6 +232,10 @@ struct DemandManagerData : BaseGlobalStruct bool ResimExt = true; bool firstTime = true; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DesiccantDehumidifiers.cc b/src/EnergyPlus/DesiccantDehumidifiers.cc index 5b26d322892..3f8367ab799 100644 --- a/src/EnergyPlus/DesiccantDehumidifiers.cc +++ b/src/EnergyPlus/DesiccantDehumidifiers.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -121,7 +121,6 @@ namespace DesiccantDehumidifiers { // Development of portions of this module was funded by the Gas Research Institute. // (Please see copyright and disclaimer information at end of module) - static std::string const fluidNameSteam("STEAM"); Real64 constexpr TempSteamIn = 100.0; void SimDesiccantDehumidifier(EnergyPlusData &state, @@ -246,7 +245,6 @@ namespace DesiccantDehumidifiers { bool errFlag; // local error flag std::string RegenCoilType; // Regen heating coil type std::string RegenCoilName; // Regen heating coil name - int SteamIndex; // steam coil Index bool RegairHeatingCoilFlag; // local error flag int TotalArgs = 0; @@ -302,21 +300,12 @@ namespace DesiccantDehumidifiers { desicDehum.DehumType = CurrentModuleObject; desicDehum.DehumTypeCode = DesicDehumType::Solid; desicDehum.Sched = Alphas(2); + if (lAlphaBlanks(2)) { - desicDehum.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - desicDehum.SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (desicDehum.SchedPtr == 0) { - ShowSevereError(state, - format("{}{}: invalid {} entered ={} for {}={}", - RoutineName, - CurrentModuleObject, - cAlphaFields(2), - Alphas(2), - cAlphaFields(1), - Alphas(1))); - ErrorsFound = true; - } + desicDehum.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((desicDehum.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } // For node connections, this object is both a parent and a non-parent, because the // Desiccant wheel is not called out as a separate component, its nodes must be connected @@ -473,9 +462,7 @@ namespace DesiccantDehumidifiers { // Get the regeneration heating Coil steam max volume flow rate desicDehum.MaxCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, desicDehum.RegenCoilIndex, errFlag); if (desicDehum.MaxCoilFluidFlow > 0.0) { - SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed - Real64 SteamDensity = - FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, dehumidifierDesiccantNoFans); + Real64 SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, dehumidifierDesiccantNoFans); desicDehum.MaxCoilFluidFlow *= SteamDensity; } @@ -678,20 +665,10 @@ namespace DesiccantDehumidifiers { desicDehum.Sched = Alphas(2); if (lAlphaBlanks(2)) { - desicDehum.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - desicDehum.SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (desicDehum.SchedPtr == 0) { - ShowSevereError(state, - format("{}{}: invalid {} entered ={} for {}={}", - RoutineName, - CurrentModuleObject, - cAlphaFields(2), - Alphas(2), - cAlphaFields(1), - Alphas(1))); - ErrorsFound = true; - } + desicDehum.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((desicDehum.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } desicDehum.HXType = Alphas(3); @@ -982,9 +959,7 @@ namespace DesiccantDehumidifiers { // Get the regeneration heating Coil steam max volume flow rate desicDehum.MaxCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, desicDehum.RegenCoilIndex, errFlag); if (desicDehum.MaxCoilFluidFlow > 0.0) { - SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed - Real64 SteamDensity = FluidProperties::GetSatDensityRefrig( - state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, dehumidifierDesiccantNoFans); + Real64 SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, dehumidifierDesiccantNoFans); desicDehum.MaxCoilFluidFlow *= SteamDensity; } @@ -1653,11 +1628,8 @@ namespace DesiccantDehumidifiers { desicDehum.MaxCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", desicDehum.RegenCoilName, ErrorFlag); if (desicDehum.MaxCoilFluidFlow > 0.0) { - Real64 FluidDensity = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(desicDehum.plantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(desicDehum.plantLoc.loopNum).FluidIndex, - initCBVAV); + Real64 FluidDensity = + state.dataPlnt->PlantLoop(desicDehum.plantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, initCBVAV); desicDehum.MaxCoilFluidFlow *= FluidDensity; } @@ -1682,8 +1654,7 @@ namespace DesiccantDehumidifiers { desicDehum.MaxCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, desicDehum.RegenCoilIndex, ErrorFlag); if (desicDehum.MaxCoilFluidFlow > 0.0) { - int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed - Real64 FluidDensity = FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, RoutineName); + Real64 FluidDensity = Fluid::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, RoutineName); desicDehum.MaxCoilFluidFlow *= FluidDensity; } } @@ -1768,12 +1739,8 @@ namespace DesiccantDehumidifiers { // ErrorsFound = true; //} if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - Real64 FluidDensity = - FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(desicDehum.plantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(desicDehum.plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 FluidDensity = state.dataPlnt->PlantLoop(desicDehum.plantLoc.loopNum) + .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); desicDehum.MaxCoilFluidFlow = CoilMaxVolFlowRate * FluidDensity; } } @@ -1790,9 +1757,7 @@ namespace DesiccantDehumidifiers { // ErrorsFound = true; //} if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed - Real64 FluidDensity = - FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, RoutineName); + Real64 FluidDensity = Fluid::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, RoutineName); desicDehum.MaxCoilFluidFlow = CoilMaxVolFlowRate * FluidDensity; } } @@ -1885,7 +1850,7 @@ namespace DesiccantDehumidifiers { ProcAirMassFlowRate = desicDehum.ProcAirInMassFlowRate; if (ProcAirMassFlowRate <= HVAC::SmallMassFlow) UnitOn = false; - if (ScheduleManager::GetCurrentScheduleValue(state, desicDehum.SchedPtr) <= 0.0) UnitOn = false; + if (desicDehum.availSched->getCurrentVal() <= 0.0) UnitOn = false; // If incoming conditions are outside valid range for curve fits, then shut unit off, do not issue warnings @@ -1931,7 +1896,7 @@ namespace DesiccantDehumidifiers { ProcAirMassFlowRate = state.dataLoopNodes->Node(desicDehum.ProcAirInNode).MassFlowRate; if (ProcAirMassFlowRate <= HVAC::SmallMassFlow) UnitOn = false; - if (ScheduleManager::GetCurrentScheduleValue(state, desicDehum.SchedPtr) <= 0.0) UnitOn = false; + if (desicDehum.availSched->getCurrentVal() <= 0.0) UnitOn = false; if (UnitOn) { if (desicDehum.ControlNodeNum == desicDehum.ProcAirOutNode) { diff --git a/src/EnergyPlus/DesiccantDehumidifiers.hh b/src/EnergyPlus/DesiccantDehumidifiers.hh index a72db21bde4..dde2884968f 100644 --- a/src/EnergyPlus/DesiccantDehumidifiers.hh +++ b/src/EnergyPlus/DesiccantDehumidifiers.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -140,40 +140,40 @@ namespace DesiccantDehumidifiers { Real64 MinProcAirInHumRat; // min allowable process inlet air humidity ratio [kg water / kg air] Real64 MaxProcAirInHumRat; // max allowable process inlet air humidity ratio [kg water / kg air] // Internal Data - int SchedPtr; // index of availability schedule - Real64 NomProcAirMassFlow; // nominal process air mass flow rate [kg/s] - Real64 NomRegenAirMassFlow; // nominal regeneration air mass flow rate [kg/s] - Real64 ProcAirInTemp; // process inlet air temperature [C] - Real64 ProcAirInHumRat; // process inlet air humidity ratio [kg water / kg air] - Real64 ProcAirInEnthalpy; // process inlet air specific enthalpy [J/kg] - Real64 ProcAirInMassFlowRate; // process inlet air mass flow rate [kg/s] - Real64 ProcAirOutTemp; // process outlet air temperature [C] - Real64 ProcAirOutHumRat; // process outlet air humidity ratio [kg water / kg air] - Real64 ProcAirOutEnthalpy; // process outlet air specific enthalpy [J/kg] - Real64 ProcAirOutMassFlowRate; // process outlet air mass flow rate [kg/s] - Real64 RegenAirInTemp; // regen inlet air temperature [C] - Real64 RegenAirInHumRat; // regen inlet air humidity ratio [kg water / kg air] - Real64 RegenAirInEnthalpy; // regen inlet air specific enthalpy [J/kg] - Real64 RegenAirInMassFlowRate; // regen inlet air mass flow rate [kg/s] - Real64 RegenAirVel; // regen air velocity [m/s] - std::string DehumType; // Type of desiccant dehumidifier - DesicDehumType DehumTypeCode; // Type of desiccant dehumidifier, integer code - Real64 WaterRemove; // water removed [kg] - Real64 WaterRemoveRate; // water removal rate [kg/s] - Real64 SpecRegenEnergy; // specific regen energy [J/kg of water removed] - Real64 QRegen; // regen energy rate requested from regen coil [W] - Real64 RegenEnergy; // regen energy requested from regen coil [J] - Real64 ElecUseEnergy; // electricity consumption [J] - Real64 ElecUseRate; // electricity consumption rate [W] - Real64 PartLoad; // fraction of dehumidification capacity required to meet setpoint - int RegenCapErrorIndex1; // recurring error message index for insufficient regen coil capacity - int RegenCapErrorIndex2; // recurring error message index for insufficient regen coil capacity - int RegenCapErrorIndex3; // recurring error message index for insufficient regen coil capacity - int RegenCapErrorIndex4; // recurring error message index for insufficient regen coil capacity - int RegenFanErrorIndex1; // recurring error message index for incorrect regen fan flow - int RegenFanErrorIndex2; // recurring error message index for incorrect regen fan flow - int RegenFanErrorIndex3; // recurring error message index for incorrect regen fan flow - int RegenFanErrorIndex4; // recurring error message index for incorrect regen fan flow + Sched::Schedule *availSched = nullptr; // availability schedule + Real64 NomProcAirMassFlow; // nominal process air mass flow rate [kg/s] + Real64 NomRegenAirMassFlow; // nominal regeneration air mass flow rate [kg/s] + Real64 ProcAirInTemp; // process inlet air temperature [C] + Real64 ProcAirInHumRat; // process inlet air humidity ratio [kg water / kg air] + Real64 ProcAirInEnthalpy; // process inlet air specific enthalpy [J/kg] + Real64 ProcAirInMassFlowRate; // process inlet air mass flow rate [kg/s] + Real64 ProcAirOutTemp; // process outlet air temperature [C] + Real64 ProcAirOutHumRat; // process outlet air humidity ratio [kg water / kg air] + Real64 ProcAirOutEnthalpy; // process outlet air specific enthalpy [J/kg] + Real64 ProcAirOutMassFlowRate; // process outlet air mass flow rate [kg/s] + Real64 RegenAirInTemp; // regen inlet air temperature [C] + Real64 RegenAirInHumRat; // regen inlet air humidity ratio [kg water / kg air] + Real64 RegenAirInEnthalpy; // regen inlet air specific enthalpy [J/kg] + Real64 RegenAirInMassFlowRate; // regen inlet air mass flow rate [kg/s] + Real64 RegenAirVel; // regen air velocity [m/s] + std::string DehumType; // Type of desiccant dehumidifier + DesicDehumType DehumTypeCode; // Type of desiccant dehumidifier, integer code + Real64 WaterRemove; // water removed [kg] + Real64 WaterRemoveRate; // water removal rate [kg/s] + Real64 SpecRegenEnergy; // specific regen energy [J/kg of water removed] + Real64 QRegen; // regen energy rate requested from regen coil [W] + Real64 RegenEnergy; // regen energy requested from regen coil [J] + Real64 ElecUseEnergy; // electricity consumption [J] + Real64 ElecUseRate; // electricity consumption rate [W] + Real64 PartLoad; // fraction of dehumidification capacity required to meet setpoint + int RegenCapErrorIndex1; // recurring error message index for insufficient regen coil capacity + int RegenCapErrorIndex2; // recurring error message index for insufficient regen coil capacity + int RegenCapErrorIndex3; // recurring error message index for insufficient regen coil capacity + int RegenCapErrorIndex4; // recurring error message index for insufficient regen coil capacity + int RegenFanErrorIndex1; // recurring error message index for incorrect regen fan flow + int RegenFanErrorIndex2; // recurring error message index for incorrect regen fan flow + int RegenFanErrorIndex3; // recurring error message index for incorrect regen fan flow + int RegenFanErrorIndex4; // recurring error message index for incorrect regen fan flow // structure elements unique to generic desiccant dehumidifier std::string HXType; // type of desiccant heat exchanger std::string HXName; // name of desiccant heat exchanger @@ -224,7 +224,7 @@ namespace DesiccantDehumidifiers { NomRotorPower(0.0), RegenCoilIndex(0), RegenFanIndex(0), regenFanType(HVAC::FanType::Invalid), ProcDryBulbCurvefTW(0), ProcDryBulbCurvefV(0), ProcHumRatCurvefTW(0), ProcHumRatCurvefV(0), RegenEnergyCurvefTW(0), RegenEnergyCurvefV(0), RegenVelCurvefTW(0), RegenVelCurvefV(0), NomRegenTemp(121.0), MinProcAirInTemp(-73.3), MaxProcAirInTemp(65.6), MinProcAirInHumRat(0.0), - MaxProcAirInHumRat(0.21273), SchedPtr(0), NomProcAirMassFlow(0.0), NomRegenAirMassFlow(0.0), ProcAirInTemp(0.0), ProcAirInHumRat(0.0), + MaxProcAirInHumRat(0.21273), NomProcAirMassFlow(0.0), NomRegenAirMassFlow(0.0), ProcAirInTemp(0.0), ProcAirInHumRat(0.0), ProcAirInEnthalpy(0.0), ProcAirInMassFlowRate(0.0), ProcAirOutTemp(0.0), ProcAirOutHumRat(0.0), ProcAirOutEnthalpy(0.0), ProcAirOutMassFlowRate(0.0), RegenAirInTemp(0.0), RegenAirInHumRat(0.0), RegenAirInEnthalpy(0.0), RegenAirInMassFlowRate(0.0), RegenAirVel(0.0), DehumTypeCode(DesicDehumType::Invalid), WaterRemove(0.0), WaterRemoveRate(0.0), SpecRegenEnergy(0.0), QRegen(0.0), @@ -307,6 +307,10 @@ struct DesiccantDehumidifiersData : BaseGlobalStruct Array1D_bool MyPlantScanFlag; // Used for init plant component for heating coils Real64 QRegen = 0.0; // required coil load passed to sim heating coil routine (W) + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DisplacementVentMgr.cc b/src/EnergyPlus/DisplacementVentMgr.cc index 3c687532b1d..a400199b944 100644 --- a/src/EnergyPlus/DisplacementVentMgr.cc +++ b/src/EnergyPlus/DisplacementVentMgr.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -176,7 +176,6 @@ namespace RoomAir { // Using/Aliasing using namespace DataEnvironment; using namespace DataHeatBalance; - using ScheduleManager::GetScheduleIndex; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 HLD; // Convection coefficient for the lower area of surface @@ -513,8 +512,6 @@ namespace RoomAir { using Psychrometrics::PsyCpAirFnW; using Psychrometrics::PsyRhoAirFnPbTdbW; - using ScheduleManager::GetCurrentScheduleValue; - using ScheduleManager::GetScheduleIndex; // SUBROUTINE PARAMETER DEFINITIONS: Real64 const OneThird(1.0 / 3.0); @@ -592,7 +589,7 @@ namespace RoomAir { for (int Ctd = 1; Ctd <= state.dataRoomAir->TotDispVent3Node; ++Ctd) { auto &zoneDV3N = state.dataRoomAir->ZoneDispVent3Node(Ctd); if (ZoneNum == zoneDV3N.ZonePtr) { - GainsFrac = GetCurrentScheduleValue(state, zoneDV3N.SchedGainsPtr); + GainsFrac = zoneDV3N.gainsSched->getCurrentVal(); NumPLPP = zoneDV3N.NumPlumesPerOcc; HeightThermostat = zoneDV3N.ThermostatHeight; HeightComfort = zoneDV3N.ComfortHeight; diff --git a/src/EnergyPlus/DisplacementVentMgr.hh b/src/EnergyPlus/DisplacementVentMgr.hh index 9afcfe76436..1f46b8df6c2 100644 --- a/src/EnergyPlus/DisplacementVentMgr.hh +++ b/src/EnergyPlus/DisplacementVentMgr.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -158,6 +158,10 @@ struct DisplacementVentMgrData : BaseGlobalStruct Real64 TempDepCoef = 0.0; // Formerly CoefSumha, coef in zone temp equation with dimensions of h*A Real64 TempIndCoef = 0.0; // Formerly CoefSumhat, coef in zone temp equation with dimensions of h*A(T1 + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/DisplayRoutines.cc b/src/EnergyPlus/DisplayRoutines.cc index 101da2a44ad..18b23b2b6ec 100644 --- a/src/EnergyPlus/DisplayRoutines.cc +++ b/src/EnergyPlus/DisplayRoutines.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/DisplayRoutines.hh b/src/EnergyPlus/DisplayRoutines.hh index 0ca8c99a33a..506cb22b637 100644 --- a/src/EnergyPlus/DisplayRoutines.hh +++ b/src/EnergyPlus/DisplayRoutines.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/DualDuct.cc b/src/EnergyPlus/DualDuct.cc index ae896577a69..9cfd245cbd3 100644 --- a/src/EnergyPlus/DualDuct.cc +++ b/src/EnergyPlus/DualDuct.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -201,6 +201,7 @@ namespace DualDuct { // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetDualDuctInput: "); // include trailing bla + static constexpr std::string_view routineName = "GetDualDuctInput"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumAlphas; @@ -244,6 +245,8 @@ namespace DualDuct { cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, AlphArray(1)}; + // Anything below this line in this control block should use DDNum int DDNum = DamperIndex; auto &thisDD = state.dataDualDuct->dd_airterminal(DDNum); @@ -252,14 +255,10 @@ namespace DualDuct { thisDD.Name = AlphArray(1); thisDD.DamperType = DualDuctDamper::ConstantVolume; if (lAlphaBlanks(2)) { - thisDD.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisDD.SchedPtr = ScheduleManager::GetScheduleIndex(state, AlphArray(2)); - if (thisDD.SchedPtr == 0) { - ShowSevereError(state, - format("{}, \"{}\" {} = {} not found.", CurrentModuleObject, thisDD.Name, cAlphaFields(2), AlphArray(2))); - ErrorsFound = true; - } + thisDD.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisDD.availSched = Sched::GetSchedule(state, AlphArray(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), AlphArray(2)); + ErrorsFound = true; } thisDD.OutletNodeNum = GetOnlySingleNode(state, AlphArray(3), @@ -383,6 +382,8 @@ namespace DualDuct { cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, AlphArray(1)}; + // Anything below this line in this control block should use DDNum int DDNum = DamperIndex + NumDualDuctConstVolDampers; auto &thisDD = state.dataDualDuct->dd_airterminal(DDNum); @@ -391,14 +392,10 @@ namespace DualDuct { thisDD.Name = AlphArray(1); thisDD.DamperType = DualDuctDamper::VariableVolume; if (lAlphaBlanks(2)) { - thisDD.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisDD.SchedPtr = ScheduleManager::GetScheduleIndex(state, AlphArray(2)); - if (thisDD.SchedPtr == 0) { - ShowSevereError(state, - format("{}, \"{}\" {} = {} not found.", CurrentModuleObject, thisDD.Name, cAlphaFields(2), AlphArray(2))); - ErrorsFound = true; - } + thisDD.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisDD.availSched = Sched::GetSchedule(state, AlphArray(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), AlphArray(2)); + ErrorsFound = true; } thisDD.OutletNodeNum = GetOnlySingleNode(state, AlphArray(3), @@ -488,15 +485,9 @@ namespace DualDuct { if (lAlphaBlanks(7)) { thisDD.ZoneTurndownMinAirFrac = 1.0; - thisDD.ZoneTurndownMinAirFracSchExist = false; - } else { - thisDD.ZoneTurndownMinAirFracSchPtr = ScheduleManager::GetScheduleIndex(state, AlphArray(7)); - if (thisDD.ZoneTurndownMinAirFracSchPtr == 0) { - ShowSevereError(state, format("{} = {} not found.", cAlphaFields(7), AlphArray(7))); - ShowContinueError(state, format("Occurs in {} = {}", cCMO_DDVariableVolume, thisDD.Name)); - ErrorsFound = true; - } - thisDD.ZoneTurndownMinAirFracSchExist = true; + } else if ((thisDD.zoneTurndownMinAirFracSched = Sched::GetSchedule(state, AlphArray(7))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(7), AlphArray(7)); + ErrorsFound = true; } // Setup the Average damper Position output variable @@ -543,6 +534,8 @@ namespace DualDuct { cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, AlphArray(1)}; + // Anything below this line in this control block should use DDNum int DDNum = DamperIndex + NumDualDuctConstVolDampers + NumDualDuctVarVolDampers; auto &thisDD = state.dataDualDuct->dd_airterminal(DDNum); @@ -551,14 +544,10 @@ namespace DualDuct { thisDD.Name = AlphArray(1); thisDD.DamperType = DualDuctDamper::OutdoorAir; if (lAlphaBlanks(2)) { - thisDD.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisDD.SchedPtr = ScheduleManager::GetScheduleIndex(state, AlphArray(2)); - if (thisDD.SchedPtr == 0) { - ShowSevereError(state, - format("{}, \"{}\" {} = {} not found.", CurrentModuleObject, thisDD.Name, cAlphaFields(2), AlphArray(2))); - ErrorsFound = true; - } + thisDD.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisDD.availSched = Sched::GetSchedule(state, AlphArray(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), AlphArray(2)); + ErrorsFound = true; } thisDD.OutletNodeNum = GetOnlySingleNode(state, AlphArray(3), @@ -800,8 +789,8 @@ namespace DualDuct { state.dataLoopNodes->Node(OutNode).MassFlowRateMin = 0.0; } else if (this->DamperType == DualDuctDamper::VariableVolume) { // get dual duct air terminal box minimum flow fraction value - if (this->ZoneTurndownMinAirFracSchExist) { - this->ZoneTurndownMinAirFrac = ScheduleManager::GetScheduleMinValue(state, this->ZoneTurndownMinAirFracSchPtr); + if (this->zoneTurndownMinAirFracSched != nullptr) { + this->ZoneTurndownMinAirFrac = this->zoneTurndownMinAirFracSched->getMinVal(state); } else { this->ZoneTurndownMinAirFrac = 1.0; } @@ -884,7 +873,7 @@ namespace DualDuct { if (this->DamperType == DualDuctDamper::ConstantVolume || this->DamperType == DualDuctDamper::VariableVolume) { auto &thisHotInNode = state.dataLoopNodes->Node(HotInNode); auto &thisColdInNode = state.dataLoopNodes->Node(ColdInNode); - Real64 schedValue = ScheduleManager::GetCurrentScheduleValue(state, this->SchedPtr); + Real64 schedValue = this->availSched->getCurrentVal(); if ((thisHotInNode.MassFlowRate > 0.0) && (schedValue > 0.0)) { thisHotInNode.MassFlowRate = this->dd_airterminalHotAirInlet.AirMassFlowRateMax; } else { @@ -907,8 +896,8 @@ namespace DualDuct { thisColdInNode.MassFlowRateMaxAvail = 0.0; } // get current time step air terminal box turndown minimum flow fraction - if (this->ZoneTurndownMinAirFracSchExist) { - this->ZoneTurndownMinAirFrac = ScheduleManager::GetCurrentScheduleValue(state, this->ZoneTurndownMinAirFracSchPtr); + if (this->zoneTurndownMinAirFracSched != nullptr) { + this->ZoneTurndownMinAirFrac = this->zoneTurndownMinAirFracSched->getCurrentVal(); } else { this->ZoneTurndownMinAirFrac = 1.0; } @@ -928,7 +917,7 @@ namespace DualDuct { } else if (this->DamperType == DualDuctDamper::OutdoorAir) { auto &thisOAInNode = state.dataLoopNodes->Node(OAInNode); - Real64 schedValue = ScheduleManager::GetCurrentScheduleValue(state, this->SchedPtr); + Real64 schedValue = this->availSched->getCurrentVal(); // The first time through set the mass flow rate to the Max for VAV:OutdoorAir if ((thisOAInNode.MassFlowRate > 0.0) && (schedValue > 0.0)) { thisOAInNode.MassFlowRate = this->dd_airterminalOAInlet.AirMassFlowRateMax; @@ -1115,7 +1104,7 @@ namespace DualDuct { // Get the calculated load from the Heat Balance from ZoneSysEnergyDemand QTotLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).RemainingOutputRequired; // Need the design MassFlowRate for calculations - if (ScheduleManager::GetCurrentScheduleValue(state, this->SchedPtr) > 0.0) { + if (this->availSched->getCurrentVal() > 0.0) { MassFlow = this->dd_airterminalHotAirInlet.AirMassFlowRateMaxAvail / 2.0 + this->dd_airterminalColdAirInlet.AirMassFlowRateMaxAvail / 2.0; } else { MassFlow = 0.0; @@ -1243,7 +1232,7 @@ namespace DualDuct { // the massflow rate of either heating or cooling is determined to meet the entire load. Then // if the massflow is below the minimum or greater than the Max it is set to either the Min // or the Max as specified for the VAV model. - if (ScheduleManager::GetCurrentScheduleValue(state, this->SchedPtr) == 0.0) { + if (this->availSched->getCurrentVal() == 0.0) { // System is Off set massflow to 0.0 MassFlow = 0.0; @@ -1476,10 +1465,11 @@ namespace DualDuct { QOALoad = this->dd_airterminalOAInlet.AirMassFlowRate * (CpAirSysOA * this->dd_airterminalOAInlet.AirTemp - CpAirZn * state.dataLoopNodes->Node(ZoneNodeNum).Temp); - QOALoadToHeatSP = this->dd_airterminalOAInlet.AirMassFlowRate * (CpAirSysOA * this->dd_airterminalOAInlet.AirTemp - - CpAirZn * state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ZoneNum)); - QOALoadToCoolSP = this->dd_airterminalOAInlet.AirMassFlowRate * (CpAirSysOA * this->dd_airterminalOAInlet.AirTemp - - CpAirZn * state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ZoneNum)); + auto const &zoneTstatSetpt = state.dataHeatBalFanSys->zoneTstatSetpts(ZoneNum); + QOALoadToHeatSP = + this->dd_airterminalOAInlet.AirMassFlowRate * (CpAirSysOA * this->dd_airterminalOAInlet.AirTemp - CpAirZn * zoneTstatSetpt.setptLo); + QOALoadToCoolSP = + this->dd_airterminalOAInlet.AirMassFlowRate * (CpAirSysOA * this->dd_airterminalOAInlet.AirTemp - CpAirZn * zoneTstatSetpt.setptHi); } else { QOALoad = 0.0; @@ -1548,7 +1538,7 @@ namespace DualDuct { // Find the Max Box Flow Rate. MassFlowMax = this->dd_airterminalOAInlet.AirMassFlowRateMaxAvail + this->dd_airterminalRecircAirInlet.AirMassFlowRateMaxAvail; - if (ScheduleManager::GetCurrentScheduleValue(state, this->SchedPtr) > 0.0) { + if (this->availSched->getCurrentVal() > 0.0) { TotMassFlow = this->dd_airterminalOAInlet.AirMassFlowRate + this->dd_airterminalRecircAirInlet.AirMassFlowRate; } else { TotMassFlow = 0.0; @@ -2053,17 +2043,15 @@ namespace DualDuct { OutputReportPredefined::PreDefTableEntry(state, orp->pdchAirTermTypeInp, adu.Name, dualDuctDamperNames[(int)this->DamperType]); OutputReportPredefined::PreDefTableEntry(state, orp->pdchAirTermPrimFlow, adu.Name, this->MaxAirVolFlowRate); OutputReportPredefined::PreDefTableEntry(state, orp->pdchAirTermSecdFlow, adu.Name, "n/a"); - if (this->ZoneTurndownMinAirFracSchPtr > 0) { - OutputReportPredefined::PreDefTableEntry( - state, orp->pdchAirTermMinFlowSch, adu.Name, ScheduleManager::GetScheduleName(state, this->ZoneTurndownMinAirFracSchPtr)); + if (this->zoneTurndownMinAirFracSched != nullptr) { + OutputReportPredefined::PreDefTableEntry(state, orp->pdchAirTermMinFlowSch, adu.Name, this->zoneTurndownMinAirFracSched->Name); } else { OutputReportPredefined::PreDefTableEntry(state, orp->pdchAirTermMinFlowSch, adu.Name, "n/a"); } OutputReportPredefined::PreDefTableEntry(state, orp->pdchAirTermMaxFlowReh, adu.Name, "n/a"); std::string schName = "n/a"; if (this->OARequirementsPtr > 0) { - int minOAsch = state.dataSize->OARequirements(this->OARequirementsPtr).OAFlowFracSchPtr; - if (minOAsch > 0) schName = ScheduleManager::GetScheduleName(state, minOAsch); + schName = state.dataSize->OARequirements(this->OARequirementsPtr).oaFlowFracSched->Name; } OutputReportPredefined::PreDefTableEntry(state, orp->pdchAirTermMinOAflowSch, adu.Name, schName); OutputReportPredefined::PreDefTableEntry(state, orp->pdchAirTermHeatCoilType, adu.Name, "n/a"); diff --git a/src/EnergyPlus/DualDuct.hh b/src/EnergyPlus/DualDuct.hh index f99c2cb262d..08183956eaa 100644 --- a/src/EnergyPlus/DualDuct.hh +++ b/src/EnergyPlus/DualDuct.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -104,9 +104,9 @@ namespace DualDuct { { std::string Name; // Name of the Damper DualDuctDamper DamperType = DualDuctDamper::Invalid; // Type of Damper ie. VAV, Mixing, Inducing, etc. - int SchedPtr = 0; // Pointer to the correct schedule - Real64 MaxAirVolFlowRate = 0.0; // Max Specified Volume Flow Rate of Damper [m3/sec] - Real64 MaxAirMassFlowRate = 0.0; // Max Specified MAss Flow Rate of Damper [kg/s] + Sched::Schedule *availSched = nullptr; // Pointer to the correct schedule // brazenly assume that this is an availability schedule + Real64 MaxAirVolFlowRate = 0.0; // Max Specified Volume Flow Rate of Damper [m3/sec] + Real64 MaxAirMassFlowRate = 0.0; // Max Specified MAss Flow Rate of Damper [kg/s] int HotAirInletNodeNum = 0; int ColdAirInletNodeNum = 0; int OutletNodeNum = 0; @@ -130,12 +130,11 @@ namespace DualDuct { int OARequirementsPtr = 0; // - Index to DesignSpecification:OutdoorAir object PerPersonMode OAPerPersonMode = PerPersonMode::ModeNotSet; // mode for how per person rates are determined, DCV or design. int AirLoopNum = 0; // index to airloop that this terminal unit is connected to - int ZoneTurndownMinAirFracSchPtr = 0; // pointer to the schedule for turndown minimum airflow fraction - Real64 ZoneTurndownMinAirFrac = 1.0; // turndown minimum airflow fraction value, multiplier of zone design minimum air flow - bool ZoneTurndownMinAirFracSchExist = false; // if true, if zone turndown min air frac schedule exist - bool MyEnvrnFlag = true; // environment flag - bool MySizeFlag = true; // sizing flag - bool MyAirLoopFlag = true; // airloop flag + Sched::Schedule *zoneTurndownMinAirFracSched = nullptr; // pointer to the schedule for turndown minimum airflow fraction + Real64 ZoneTurndownMinAirFrac = 1.0; // turndown minimum airflow fraction value, multiplier of zone design minimum air flow + bool MyEnvrnFlag = true; // environment flag + bool MySizeFlag = true; // sizing flag + bool MyAirLoopFlag = true; // airloop flag bool CheckEquipName = true; DualDuctAirTerminalFlowConditions dd_airterminalHotAirInlet; DualDuctAirTerminalFlowConditions dd_airterminalColdAirInlet; @@ -192,6 +191,10 @@ struct DualDuctData : BaseGlobalStruct Array1D_bool RecircIsUsedARR; Array1D_string DamperNamesARR; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/EMSManager.cc b/src/EnergyPlus/EMSManager.cc index bb2105de660..f27749bdecd 100644 --- a/src/EnergyPlus/EMSManager.cc +++ b/src/EnergyPlus/EMSManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -336,7 +336,7 @@ namespace EMSManager { } auto const &thisErlVar = state.dataRuntimeLang->ErlVariable(ErlVariableNum); - auto &thisActuatorAvail = state.dataRuntimeLang->EMSActuatorAvailable(EMSActuatorVariableNum); + auto const &thisActuatorAvail = state.dataRuntimeLang->EMSActuatorAvailable(EMSActuatorVariableNum); if (thisErlVar.Value.Type == DataRuntimeLanguage::Value::Null) { *thisActuatorAvail.Actuated = false; @@ -443,7 +443,7 @@ namespace EMSManager { for (int SensorNum = 1; SensorNum <= state.dataRuntimeLang->NumSensors; ++SensorNum) { int ErlVariableNum = state.dataRuntimeLang->Sensor(SensorNum).VariableNum; if ((ErlVariableNum > 0) && (state.dataRuntimeLang->Sensor(SensorNum).Index > -1)) { - if (state.dataRuntimeLang->Sensor(SensorNum).SchedNum == 0) { // not a schedule so get from output processor + if (state.dataRuntimeLang->Sensor(SensorNum).sched == nullptr) { // not a schedule so get from output processor state.dataRuntimeLang->ErlVariable(ErlVariableNum).Value = RuntimeLanguageProcessor::SetErlValueNumber( GetInternalVariableValue( @@ -452,8 +452,7 @@ namespace EMSManager { } else { // schedule so use schedule service state.dataRuntimeLang->ErlVariable(ErlVariableNum).Value = RuntimeLanguageProcessor::SetErlValueNumber( - ScheduleManager::GetCurrentScheduleValue(state, state.dataRuntimeLang->Sensor(SensorNum).SchedNum), - state.dataRuntimeLang->ErlVariable(ErlVariableNum).Value); + state.dataRuntimeLang->Sensor(SensorNum).sched->getCurrentVal(), state.dataRuntimeLang->ErlVariable(ErlVariableNum).Value); } } } @@ -747,25 +746,15 @@ namespace EMSManager { thisEMSactuator.UniqueIDName = cAlphaArgs(2); thisEMSactuator.ControlTypeName = cAlphaArgs(4); - int ActuatorVariableNum; - bool FoundActuatorName = false; - for (ActuatorVariableNum = 1; ActuatorVariableNum <= state.dataRuntimeLang->numEMSActuatorsAvailable; ++ActuatorVariableNum) { - if (Util::SameString(state.dataRuntimeLang->EMSActuatorAvailable(ActuatorVariableNum).ComponentTypeName, cAlphaArgs(3))) { - if (Util::SameString(state.dataRuntimeLang->EMSActuatorAvailable(ActuatorVariableNum).UniqueIDName, cAlphaArgs(2))) { - if (Util::SameString(state.dataRuntimeLang->EMSActuatorAvailable(ActuatorVariableNum).ControlTypeName, cAlphaArgs(4))) { - FoundActuatorName = true; - break; - } - } - } - } + auto found = state.dataRuntimeLang->EMSActuatorAvailableMap.find( + std::make_tuple(thisEMSactuator.ComponentTypeName, thisEMSactuator.UniqueIDName, thisEMSactuator.ControlTypeName)); + if (found != state.dataRuntimeLang->EMSActuatorAvailableMap.end()) { - if (FoundActuatorName) { // SetupNodeSetPointAsActuators has NOT been called yet at this point - thisEMSactuator.ActuatorVariableNum = ActuatorVariableNum; + thisEMSactuator.ActuatorVariableNum = found->second; thisEMSactuator.CheckedOkay = true; - int nHandle = state.dataRuntimeLang->EMSActuatorAvailable(ActuatorVariableNum).handleCount; + int nHandle = state.dataRuntimeLang->EMSActuatorAvailable(found->second).handleCount; if (nHandle > 0) { EnergyPlus::ShowWarningError(state, format("Seems like you already tried to get a Handle on this Actuator {}times.", nHandle)); @@ -776,7 +765,7 @@ namespace EMSManager { thisEMSactuator.UniqueIDName)); EnergyPlus::ShowContinueError(state, "You should take note that there is a risk of overwritting."); } - ++state.dataRuntimeLang->EMSActuatorAvailable(ActuatorVariableNum).handleCount; + ++state.dataRuntimeLang->EMSActuatorAvailable(found->second).handleCount; } } // ActuatorNum } @@ -995,9 +984,9 @@ namespace EMSManager { state.dataRuntimeLang->Sensor(SensorNum).CheckedOkay = true; // If variable is Schedule Value, then get the schedule id to register it as being used if (Util::SameString(state.dataRuntimeLang->Sensor(SensorNum).OutputVarName, "Schedule Value")) { - state.dataRuntimeLang->Sensor(SensorNum).SchedNum = - ScheduleManager::GetScheduleIndex(state, state.dataRuntimeLang->Sensor(SensorNum).UniqueKeyName); - if (state.dataRuntimeLang->Sensor(SensorNum).SchedNum == 0) { + state.dataRuntimeLang->Sensor(SensorNum).sched = + Sched::GetSchedule(state, state.dataRuntimeLang->Sensor(SensorNum).UniqueKeyName); + if (state.dataRuntimeLang->Sensor(SensorNum).sched == nullptr) { state.dataRuntimeLang->Sensor(SensorNum).CheckedOkay = false; if (reportErrors) { ShowSevereError(state, @@ -1018,6 +1007,8 @@ namespace EMSManager { } // SensorNum + auto &s_lang = state.dataRuntimeLang; + // added for FMU for (int ActuatorNum = 1; ActuatorNum <= state.dataRuntimeLang->numActuatorsUsed + state.dataRuntimeLang->NumExternalInterfaceActuatorsUsed + state.dataRuntimeLang->NumExternalInterfaceFunctionalMockupUnitImportActuatorsUsed + @@ -1038,33 +1029,19 @@ namespace EMSManager { cCurrentModuleObject = "ExternalInterface:FunctionalMockupUnitExport:To:Actuator"; } - if (state.dataRuntimeLang->EMSActuatorUsed(ActuatorNum).CheckedOkay) continue; - FoundObjectType = false; - FoundObjectName = false; - FoundActuatorName = false; - for (ActuatorVariableNum = 1; ActuatorVariableNum <= state.dataRuntimeLang->numEMSActuatorsAvailable; ++ActuatorVariableNum) { - if (Util::SameString(state.dataRuntimeLang->EMSActuatorAvailable(ActuatorVariableNum).ComponentTypeName, - state.dataRuntimeLang->EMSActuatorUsed(ActuatorNum).ComponentTypeName)) { - FoundObjectType = true; - if (Util::SameString(state.dataRuntimeLang->EMSActuatorAvailable(ActuatorVariableNum).UniqueIDName, - state.dataRuntimeLang->EMSActuatorUsed(ActuatorNum).UniqueIDName)) { - FoundObjectName = true; - if (Util::SameString(state.dataRuntimeLang->EMSActuatorAvailable(ActuatorVariableNum).ControlTypeName, - state.dataRuntimeLang->EMSActuatorUsed(ActuatorNum).ControlTypeName)) { - FoundActuatorName = true; - break; - } - } - } - } + auto &actuatorUsed = state.dataRuntimeLang->EMSActuatorUsed(ActuatorNum); + if (actuatorUsed.CheckedOkay) continue; - if (!FoundObjectType) { + auto found = s_lang->EMSActuatorAvailableMap.find( + std::make_tuple(actuatorUsed.ComponentTypeName, actuatorUsed.UniqueIDName, actuatorUsed.ControlTypeName)); + if (found == s_lang->EMSActuatorAvailableMap.end()) { if (reportErrors) { - ShowSevereError( - state, format("Invalid Actuated Component Type ={}", state.dataRuntimeLang->EMSActuatorUsed(ActuatorNum).ComponentTypeName)); + ShowSevereError(state, format("Actuator {} = {} not found.", cCurrentModuleObject, actuatorUsed.Name)); ShowContinueError(state, - format("Entered in {}={}", cCurrentModuleObject, state.dataRuntimeLang->EMSActuatorUsed(ActuatorNum).Name)); - ShowContinueError(state, "Component Type not found"); + format("Combination of ObjectType = {}, ObjectName = {}, and ControlType = {} not available.", + actuatorUsed.ComponentTypeName, + actuatorUsed.UniqueIDName, + actuatorUsed.ControlTypeName)); if (state.dataRuntimeLang->OutputEDDFile) { ShowContinueError(state, "Review .edd file for valid component types."); } else { @@ -1072,65 +1049,31 @@ namespace EMSManager { } ErrorsFound = true; } - } - if (!FoundObjectName) { - if (reportErrors) { - ShowSevereError( - state, - format("Invalid Actuated Component Unique Name ={}", state.dataRuntimeLang->EMSActuatorUsed(ActuatorNum).UniqueIDName)); - ShowContinueError(state, - format("Entered in {}={}", cCurrentModuleObject, state.dataRuntimeLang->EMSActuatorUsed(ActuatorNum).Name)); - ShowContinueError(state, "Component Unique key name not found "); - if (state.dataRuntimeLang->OutputEDDFile) { - ShowContinueError(state, "Review edd file for valid component names."); - } else { - ShowContinueError(state, "Use Output:EnergyManagementSystem object to create .edd file for valid component names."); - } - ErrorsFound = true; - } - } - - if (!FoundActuatorName) { - if (reportErrors) { - ShowSevereError( - state, - format("Invalid Actuated Component Control Type ={}", state.dataRuntimeLang->EMSActuatorUsed(ActuatorNum).ControlTypeName)); - ShowContinueError(state, - format("Entered in {}={}", cCurrentModuleObject, state.dataRuntimeLang->EMSActuatorUsed(ActuatorNum).Name)); - ShowContinueError(state, "Control Type not found"); - if (state.dataRuntimeLang->OutputEDDFile) { - ShowContinueError(state, "Review edd file for valid component control types."); - } else { - ShowContinueError(state, "Use Output:EnergyManagementSystem object to create .edd file for valid component control types."); - } - ErrorsFound = true; - } } else { - state.dataRuntimeLang->EMSActuatorUsed(ActuatorNum).ActuatorVariableNum = ActuatorVariableNum; - state.dataRuntimeLang->EMSActuatorUsed(ActuatorNum).CheckedOkay = true; - int nHandle = state.dataRuntimeLang->EMSActuatorAvailable(ActuatorVariableNum).handleCount; + actuatorUsed.ActuatorVariableNum = found->second; + actuatorUsed.CheckedOkay = true; + int nHandle = s_lang->EMSActuatorAvailable(found->second).handleCount; if (nHandle > 0) { EnergyPlus::ShowWarningError(state, format("Seems like you already tried to get a Handle on this Actuator {}times.", nHandle)); EnergyPlus::ShowContinueError(state, format("Occurred for componentType='{}', controlType='{}', uniqueKey='{}'.", - state.dataRuntimeLang->EMSActuatorUsed(ActuatorNum).ComponentTypeName, - state.dataRuntimeLang->EMSActuatorUsed(ActuatorNum).ControlTypeName, - state.dataRuntimeLang->EMSActuatorUsed(ActuatorNum).UniqueIDName)); + actuatorUsed.ComponentTypeName, + actuatorUsed.ControlTypeName, + actuatorUsed.UniqueIDName)); EnergyPlus::ShowContinueError(state, "You should take note that there is a risk of overwritting."); } - ++state.dataRuntimeLang->EMSActuatorAvailable(ActuatorVariableNum).handleCount; + ++s_lang->EMSActuatorAvailable(found->second).handleCount; // Warn if actuator applied to an air boundary surface - if (Util::SameString(state.dataRuntimeLang->EMSActuatorUsed(ActuatorNum).ComponentTypeName, "AIRFLOW NETWORK WINDOW/DOOR OPENING")) { - int actuatedSurfNum = - Util::FindItemInList(state.dataRuntimeLang->EMSActuatorUsed(ActuatorNum).UniqueIDName, state.dataSurface->Surface); + if (Util::SameString(actuatorUsed.ComponentTypeName, "AIRFLOW NETWORK WINDOW/DOOR OPENING")) { + int actuatedSurfNum = Util::FindItemInList(actuatorUsed.UniqueIDName, state.dataSurface->Surface); if (actuatedSurfNum > 0) { if (state.dataSurface->Surface(actuatedSurfNum).IsAirBoundarySurf) { ShowWarningError( state, format("GetEMSInput: EnergyManagementSystem:Actuator={} actuates an opening attached to an air boundary surface.", - state.dataRuntimeLang->EMSActuatorUsed(ActuatorNum).Name)); + actuatorUsed.Name)); } } } @@ -1589,14 +1532,12 @@ namespace EMSManager { return FoundControl; } - bool isScheduleManaged(EnergyPlusData &state, int const scheduleNum) + bool isScheduleManaged(EnergyPlusData &state, Sched::Schedule *sched) { // Check if a specific schedule has an EMS or External Interface actuator assigned to it static constexpr std::string_view cControlTypeName = "SCHEDULE VALUE"; - std::string_view cSchedName = state.dataScheduleMgr->Schedule(scheduleNum).Name; - for (int Loop = 1; Loop <= state.dataRuntimeLang->numActuatorsUsed + state.dataRuntimeLang->NumExternalInterfaceActuatorsUsed; ++Loop) { - if ((Util::SameString(state.dataRuntimeLang->EMSActuatorUsed(Loop).UniqueIDName, cSchedName)) && + if ((Util::SameString(state.dataRuntimeLang->EMSActuatorUsed(Loop).UniqueIDName, sched->Name)) && (Util::SameString(state.dataRuntimeLang->EMSActuatorUsed(Loop).ControlTypeName, cControlTypeName))) { return true; } @@ -2023,9 +1964,9 @@ namespace EMSManager { // ScheduleManager and OutputProcessor. Followed pattern used for SetupOutputVariable void SetupEMSActuator(EnergyPlusData &state, - std::string_view cComponentTypeName, - std::string_view cUniqueIDName, - std::string_view cControlTypeName, + std::string_view objType, + std::string_view objName, + std::string_view controlTypeName, std::string_view cUnits, bool &lEMSActuated, Real64 &rValue) @@ -2044,34 +1985,33 @@ void SetupEMSActuator(EnergyPlusData &state, // push size of ActuatorVariable and add a new one. // check for duplicates. - std::string const UpperCaseObjectType(Util::makeUPPER(cComponentTypeName)); - std::string const UpperCaseObjectName(Util::makeUPPER(cUniqueIDName)); - std::string const UpperCaseActuatorName(Util::makeUPPER(cControlTypeName)); + auto &s_lang = state.dataRuntimeLang; - DataRuntimeLanguage::EMSActuatorKey const key(UpperCaseObjectType, UpperCaseObjectName, UpperCaseActuatorName); + auto tup = std::make_tuple(std::move(Util::makeUPPER(objType)), std::move(Util::makeUPPER(objName)), std::move(Util::makeUPPER(controlTypeName))); - if (state.dataRuntimeLang->EMSActuator_lookup.find(key) == state.dataRuntimeLang->EMSActuator_lookup.end()) { - if (state.dataRuntimeLang->numEMSActuatorsAvailable == 0) { - state.dataRuntimeLang->EMSActuatorAvailable.allocate(state.dataRuntimeLang->varsAvailableAllocInc); - state.dataRuntimeLang->numEMSActuatorsAvailable = 1; - state.dataRuntimeLang->maxEMSActuatorsAvailable = state.dataRuntimeLang->varsAvailableAllocInc; - } else { - if (state.dataRuntimeLang->numEMSActuatorsAvailable + 1 > state.dataRuntimeLang->maxEMSActuatorsAvailable) { - state.dataRuntimeLang->EMSActuatorAvailable.redimension(state.dataRuntimeLang->maxEMSActuatorsAvailable *= 2); - } - ++state.dataRuntimeLang->numEMSActuatorsAvailable; - } + // DataRuntimeLanguage::EMSActuatorKey const key(UpperCaseObjectType, UpperCaseObjectName, UpperCaseActuatorName); + if (s_lang->EMSActuatorAvailableMap.find(tup) != s_lang->EMSActuatorAvailableMap.end()) return; - auto &actuator(state.dataRuntimeLang->EMSActuatorAvailable(state.dataRuntimeLang->numEMSActuatorsAvailable)); - actuator.ComponentTypeName = cComponentTypeName; - actuator.UniqueIDName = cUniqueIDName; - actuator.ControlTypeName = cControlTypeName; - actuator.Units = cUnits; - actuator.Actuated = &lEMSActuated; // Pointer assigment - actuator.RealValue = &rValue; // Pointer assigment - actuator.PntrVarTypeUsed = DataRuntimeLanguage::PtrDataType::Real; - state.dataRuntimeLang->EMSActuator_lookup.insert(key); + if (s_lang->numEMSActuatorsAvailable == 0) { + s_lang->EMSActuatorAvailable.allocate(s_lang->varsAvailableAllocInc); + s_lang->numEMSActuatorsAvailable = 1; + s_lang->maxEMSActuatorsAvailable = s_lang->varsAvailableAllocInc; + } else { + if (s_lang->numEMSActuatorsAvailable + 1 > s_lang->maxEMSActuatorsAvailable) { + s_lang->EMSActuatorAvailable.redimension(s_lang->maxEMSActuatorsAvailable *= 2); + } + ++s_lang->numEMSActuatorsAvailable; } + + auto &actuator = s_lang->EMSActuatorAvailable(s_lang->numEMSActuatorsAvailable); + actuator.ComponentTypeName = objType; + actuator.UniqueIDName = objName; + actuator.ControlTypeName = controlTypeName; + actuator.Units = cUnits; + actuator.Actuated = &lEMSActuated; // Pointer assigment + actuator.RealValue = &rValue; // Pointer assigment + actuator.PntrVarTypeUsed = DataRuntimeLanguage::PtrDataType::Real; + s_lang->EMSActuatorAvailableMap.insert_or_assign(std::move(tup), s_lang->numEMSActuatorsAvailable); } void SetupEMSActuator(EnergyPlusData &state, @@ -2095,25 +2035,27 @@ void SetupEMSActuator(EnergyPlusData &state, // push size of ActuatorVariable and add a new one. // check for duplicates. - std::string const UpperCaseObjectType(Util::makeUPPER(cComponentTypeName)); - std::string const UpperCaseObjectName(Util::makeUPPER(cUniqueIDName)); - std::string const UpperCaseActuatorName(Util::makeUPPER(cControlTypeName)); + auto &s_lang = state.dataRuntimeLang; + + std::string const objType = Util::makeUPPER(cComponentTypeName); + std::string const objName = Util::makeUPPER(cUniqueIDName); + std::string const actuatorName = Util::makeUPPER(cControlTypeName); - DataRuntimeLanguage::EMSActuatorKey const key(UpperCaseObjectType, UpperCaseObjectName, UpperCaseActuatorName); + // DataRuntimeLanguage::EMSActuatorKey const key(UpperCaseObjectType, UpperCaseObjectName, UpperCaseActuatorName); - if (state.dataRuntimeLang->EMSActuator_lookup.find(key) == state.dataRuntimeLang->EMSActuator_lookup.end()) { - if (state.dataRuntimeLang->numEMSActuatorsAvailable == 0) { - state.dataRuntimeLang->EMSActuatorAvailable.allocate(state.dataRuntimeLang->varsAvailableAllocInc); - state.dataRuntimeLang->numEMSActuatorsAvailable = 1; - state.dataRuntimeLang->maxEMSActuatorsAvailable = state.dataRuntimeLang->varsAvailableAllocInc; + if (s_lang->EMSActuatorAvailableMap.find(std::make_tuple(objType, objName, actuatorName)) == s_lang->EMSActuatorAvailableMap.end()) { + if (s_lang->numEMSActuatorsAvailable == 0) { + s_lang->EMSActuatorAvailable.allocate(s_lang->varsAvailableAllocInc); + s_lang->numEMSActuatorsAvailable = 1; + s_lang->maxEMSActuatorsAvailable = s_lang->varsAvailableAllocInc; } else { - if (state.dataRuntimeLang->numEMSActuatorsAvailable + 1 > state.dataRuntimeLang->maxEMSActuatorsAvailable) { - state.dataRuntimeLang->EMSActuatorAvailable.redimension(state.dataRuntimeLang->maxEMSActuatorsAvailable *= 2); + if (s_lang->numEMSActuatorsAvailable + 1 > s_lang->maxEMSActuatorsAvailable) { + s_lang->EMSActuatorAvailable.redimension(s_lang->maxEMSActuatorsAvailable *= 2); } - ++state.dataRuntimeLang->numEMSActuatorsAvailable; + ++s_lang->numEMSActuatorsAvailable; } - auto &actuator(state.dataRuntimeLang->EMSActuatorAvailable(state.dataRuntimeLang->numEMSActuatorsAvailable)); + auto &actuator(s_lang->EMSActuatorAvailable(s_lang->numEMSActuatorsAvailable)); actuator.ComponentTypeName = cComponentTypeName; actuator.UniqueIDName = cUniqueIDName; actuator.ControlTypeName = cControlTypeName; @@ -2121,7 +2063,7 @@ void SetupEMSActuator(EnergyPlusData &state, actuator.Actuated = &lEMSActuated; // Pointer assigment actuator.IntValue = &iValue; // Pointer assigment actuator.PntrVarTypeUsed = DataRuntimeLanguage::PtrDataType::Integer; - state.dataRuntimeLang->EMSActuator_lookup.insert(key); + s_lang->EMSActuatorAvailableMap.insert_or_assign(std::make_tuple(objType, objName, actuatorName), s_lang->numEMSActuatorsAvailable); } } @@ -2146,25 +2088,27 @@ void SetupEMSActuator(EnergyPlusData &state, // push size of ActuatorVariable and add a new one. // check for duplicates. - std::string const UpperCaseObjectType(Util::makeUPPER(cComponentTypeName)); - std::string const UpperCaseObjectName(Util::makeUPPER(cUniqueIDName)); - std::string const UpperCaseActuatorName(Util::makeUPPER(cControlTypeName)); + auto &s_lang = state.dataRuntimeLang; + + std::string const objType = Util::makeUPPER(cComponentTypeName); + std::string const objName = Util::makeUPPER(cUniqueIDName); + std::string const actuatorName = Util::makeUPPER(cControlTypeName); - DataRuntimeLanguage::EMSActuatorKey const key(UpperCaseObjectType, UpperCaseObjectName, UpperCaseActuatorName); + // DataRuntimeLanguage::EMSActuatorKey const key(UpperCaseObjectType, UpperCaseObjectName, UpperCaseActuatorName); - if (state.dataRuntimeLang->EMSActuator_lookup.find(key) == state.dataRuntimeLang->EMSActuator_lookup.end()) { - if (state.dataRuntimeLang->numEMSActuatorsAvailable == 0) { - state.dataRuntimeLang->EMSActuatorAvailable.allocate(state.dataRuntimeLang->varsAvailableAllocInc); - state.dataRuntimeLang->numEMSActuatorsAvailable = 1; - state.dataRuntimeLang->maxEMSActuatorsAvailable = state.dataRuntimeLang->varsAvailableAllocInc; + if (s_lang->EMSActuatorAvailableMap.find(std::make_tuple(objType, objName, actuatorName)) == s_lang->EMSActuatorAvailableMap.end()) { + if (s_lang->numEMSActuatorsAvailable == 0) { + s_lang->EMSActuatorAvailable.allocate(s_lang->varsAvailableAllocInc); + s_lang->numEMSActuatorsAvailable = 1; + s_lang->maxEMSActuatorsAvailable = s_lang->varsAvailableAllocInc; } else { - if (state.dataRuntimeLang->numEMSActuatorsAvailable + 1 > state.dataRuntimeLang->maxEMSActuatorsAvailable) { - state.dataRuntimeLang->EMSActuatorAvailable.redimension(state.dataRuntimeLang->maxEMSActuatorsAvailable *= 2); + if (s_lang->numEMSActuatorsAvailable + 1 > s_lang->maxEMSActuatorsAvailable) { + s_lang->EMSActuatorAvailable.redimension(s_lang->maxEMSActuatorsAvailable *= 2); } - ++state.dataRuntimeLang->numEMSActuatorsAvailable; + ++s_lang->numEMSActuatorsAvailable; } - auto &actuator(state.dataRuntimeLang->EMSActuatorAvailable(state.dataRuntimeLang->numEMSActuatorsAvailable)); + auto &actuator(s_lang->EMSActuatorAvailable(s_lang->numEMSActuatorsAvailable)); actuator.ComponentTypeName = cComponentTypeName; actuator.UniqueIDName = cUniqueIDName; actuator.ControlTypeName = cControlTypeName; @@ -2172,7 +2116,7 @@ void SetupEMSActuator(EnergyPlusData &state, actuator.Actuated = &lEMSActuated; // Pointer assigment actuator.LogValue = &lValue; // Pointer assigment actuator.PntrVarTypeUsed = DataRuntimeLanguage::PtrDataType::Logical; - state.dataRuntimeLang->EMSActuator_lookup.insert(key); + s_lang->EMSActuatorAvailableMap.insert_or_assign(std::make_tuple(objType, objName, actuatorName), s_lang->numEMSActuatorsAvailable); } } diff --git a/src/EnergyPlus/EMSManager.hh b/src/EnergyPlus/EMSManager.hh index 929d7265823..7722a53affa 100644 --- a/src/EnergyPlus/EMSManager.hh +++ b/src/EnergyPlus/EMSManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -135,7 +135,7 @@ namespace EMSManager { int nodeNum, // index of node being checked. std::string const &varName); - bool isScheduleManaged(EnergyPlusData &state, int const scheduleNum); + bool isScheduleManaged(EnergyPlusData &state, Sched::Schedule *const sched); void SetupPrimaryAirSystemAvailMgrAsActuators(EnergyPlusData &state); @@ -201,8 +201,13 @@ struct EMSManagerData : BaseGlobalStruct bool lDummy = false; // dummy pointer location bool lDummy2 = false; // dummy pointer location + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { + EMSManager::CheckIfAnyEMS(state); } void clear_state() override diff --git a/src/EnergyPlus/EPVector.hh b/src/EnergyPlus/EPVector.hh index 9d556b4e9f2..e886dc54957 100644 --- a/src/EnergyPlus/EPVector.hh +++ b/src/EnergyPlus/EPVector.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/EarthTube.cc b/src/EnergyPlus/EarthTube.cc index 3a8bb30db2a..e3b83e67d9b 100644 --- a/src/EnergyPlus/EarthTube.cc +++ b/src/EnergyPlus/EarthTube.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -142,6 +142,8 @@ void GetEarthTube(EnergyPlusData &state, bool &ErrorsFound) // If errors found i // This subroutine obtains input data for EarthTube units and // stores it in the EarthTube data structure. + static constexpr std::string_view routineName = "GetEarthTube"; + // SUBROUTINE PARAMETER DEFINITIONS: Real64 constexpr EarthTubeTempLimit(100.0); // degrees Celsius @@ -157,228 +159,210 @@ void GetEarthTube(EnergyPlusData &state, bool &ErrorsFound) // If errors found i // Following used for reporting state.dataEarthTube->ZnRptET.allocate(state.dataGlobal->NumOfZones); - std::string_view cCurrentModuleObject = "ZoneEarthtube:Parameters"; - int totEarthTubePars = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + auto &s_ipsc = state.dataIPShortCut; + + s_ipsc->cCurrentModuleObject = "ZoneEarthtube:Parameters"; + + int totEarthTubePars = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); state.dataEarthTube->EarthTubePars.allocate(totEarthTubePars); for (Loop = 1; Loop <= totEarthTubePars; ++Loop) { auto &thisEarthTubePars = state.dataEarthTube->EarthTubePars(Loop); state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, Loop, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlpha, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumber, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); - thisEarthTubePars.nameParameters = state.dataIPShortCut->cAlphaArgs(1); + thisEarthTubePars.nameParameters = s_ipsc->cAlphaArgs(1); // Check to make sure name is unique for (int otherParams = 1; otherParams < Loop; ++otherParams) { if (Util::SameString(thisEarthTubePars.nameParameters, state.dataEarthTube->EarthTubePars(otherParams).nameParameters)) { - ShowSevereError(state, - format("{}: {} = {} is not a unique name.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Check the other {} names for a duplicate.", cCurrentModuleObject)); + ShowSevereError( + state, + format("{}: {} = {} is not a unique name.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaFieldNames(1), s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Check the other {} names for a duplicate.", s_ipsc->cCurrentModuleObject)); ErrorsFound = true; } } - thisEarthTubePars.numNodesAbove = state.dataIPShortCut->rNumericArgs(1); - thisEarthTubePars.numNodesBelow = state.dataIPShortCut->rNumericArgs(2); - thisEarthTubePars.dimBoundAbove = state.dataIPShortCut->rNumericArgs(3); - thisEarthTubePars.dimBoundBelow = state.dataIPShortCut->rNumericArgs(4); - thisEarthTubePars.width = state.dataIPShortCut->rNumericArgs(5); + thisEarthTubePars.numNodesAbove = s_ipsc->rNumericArgs(1); + thisEarthTubePars.numNodesBelow = s_ipsc->rNumericArgs(2); + thisEarthTubePars.dimBoundAbove = s_ipsc->rNumericArgs(3); + thisEarthTubePars.dimBoundBelow = s_ipsc->rNumericArgs(4); + thisEarthTubePars.width = s_ipsc->rNumericArgs(5); } - cCurrentModuleObject = "ZoneEarthtube"; - totEarthTube = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + s_ipsc->cCurrentModuleObject = "ZoneEarthtube"; + totEarthTube = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); state.dataEarthTube->EarthTubeSys.allocate(totEarthTube); for (Loop = 1; Loop <= totEarthTube; ++Loop) { auto &thisEarthTube = state.dataEarthTube->EarthTubeSys(Loop); state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, Loop, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlpha, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumber, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; // First Alpha is Zone Name - thisEarthTube.ZonePtr = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(1), state.dataHeatBal->Zone); + thisEarthTube.ZonePtr = Util::FindItemInList(s_ipsc->cAlphaArgs(1), state.dataHeatBal->Zone); if (thisEarthTube.ZonePtr == 0) { - ShowSevereError( - state, - format("{}: {} not found={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("{}: {} not found={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaFieldNames(1), s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } // Second Alpha is Schedule Name - thisEarthTube.SchedPtr = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); - if (thisEarthTube.SchedPtr == 0) { - if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { - ShowSevereError(state, - format("{}: {} is required, missing for {}={}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1))); - } else { - ShowSevereError(state, - format("{}: invalid {} entered={} for {}={}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2), - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1))); - } + if (s_ipsc->lAlphaFieldBlanks(2)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(2)); + ErrorsFound = true; + } else if ((thisEarthTube.availSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); ErrorsFound = true; } // Overall parameters and their limits - thisEarthTube.DesignLevel = state.dataIPShortCut->rNumericArgs(1); + thisEarthTube.DesignLevel = s_ipsc->rNumericArgs(1); - thisEarthTube.MinTemperature = state.dataIPShortCut->rNumericArgs(2); + thisEarthTube.MinTemperature = s_ipsc->rNumericArgs(2); if ((thisEarthTube.MinTemperature < -EarthTubeTempLimit) || (thisEarthTube.MinTemperature > EarthTubeTempLimit)) { ShowSevereError(state, format("{}: {}={} must have a minimum temperature between -{:.0R}C and {:.0R}C", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(1), + s_ipsc->cAlphaArgs(1), EarthTubeTempLimit, EarthTubeTempLimit)); ShowContinueError(state, format("Entered value={:.0R}", thisEarthTube.MinTemperature)); ErrorsFound = true; } - thisEarthTube.MaxTemperature = state.dataIPShortCut->rNumericArgs(3); + thisEarthTube.MaxTemperature = s_ipsc->rNumericArgs(3); if ((thisEarthTube.MaxTemperature < -EarthTubeTempLimit) || (thisEarthTube.MaxTemperature > EarthTubeTempLimit)) { ShowSevereError(state, format("{}: {}={} must have a maximum temperature between -{:.0R}C and {:.0R}C", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(1), + s_ipsc->cAlphaArgs(1), EarthTubeTempLimit, EarthTubeTempLimit)); ShowContinueError(state, format("Entered value={:.0R}", thisEarthTube.MaxTemperature)); ErrorsFound = true; } - thisEarthTube.DelTemperature = state.dataIPShortCut->rNumericArgs(4); // 3/12/03 Negative del temp now allowed COP + thisEarthTube.DelTemperature = s_ipsc->rNumericArgs(4); // 3/12/03 Negative del temp now allowed COP // if we have a blank, then just set it to the Natural type, otherwise, search on it - if (state.dataIPShortCut->cAlphaArgs(3).empty()) { + if (s_ipsc->cAlphaArgs(3).empty()) { thisEarthTube.FanType = Ventilation::Natural; } else { - thisEarthTube.FanType = static_cast(getEnumValue(ventilationNamesUC, state.dataIPShortCut->cAlphaArgs(3))); + thisEarthTube.FanType = static_cast(getEnumValue(ventilationNamesUC, s_ipsc->cAlphaArgs(3))); if (thisEarthTube.FanType == Ventilation::Invalid) { - ShowSevereError(state, - format("{}: {}={}, {} invalid={}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3)); ErrorsFound = true; } } - thisEarthTube.FanPressure = state.dataIPShortCut->rNumericArgs(5); + thisEarthTube.FanPressure = s_ipsc->rNumericArgs(5); if (thisEarthTube.FanPressure < 0.0) { ShowSevereError(state, format("{}: {}={}, {} must be positive, entered value={:.2R}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(5), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(1), + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(5), thisEarthTube.FanPressure)); ErrorsFound = true; } - thisEarthTube.FanEfficiency = state.dataIPShortCut->rNumericArgs(6); + thisEarthTube.FanEfficiency = s_ipsc->rNumericArgs(6); if ((thisEarthTube.FanEfficiency <= 0.0) || (thisEarthTube.FanEfficiency > 1.0)) { ShowSevereError(state, format("{}: {}={}, {} must be greater than zero and less than or equal to one, entered value={:.2R}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(6), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(1), + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(6), thisEarthTube.FanEfficiency)); ErrorsFound = true; } - thisEarthTube.r1 = state.dataIPShortCut->rNumericArgs(7); + thisEarthTube.r1 = s_ipsc->rNumericArgs(7); if (thisEarthTube.r1 <= 0.0) { ShowSevereError(state, format("{}: {}={}, {} must be positive, entered value={:.2R}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(7), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(1), + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(7), thisEarthTube.r1)); ErrorsFound = true; } - thisEarthTube.r2 = state.dataIPShortCut->rNumericArgs(8); + thisEarthTube.r2 = s_ipsc->rNumericArgs(8); if (thisEarthTube.r2 <= 0.0) { ShowSevereError(state, format("{}: {}={}, {} must be positive, entered value={:.2R}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(8), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(1), + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(8), thisEarthTube.r2)); ErrorsFound = true; } thisEarthTube.r3 = 2.0 * thisEarthTube.r1; - thisEarthTube.PipeLength = state.dataIPShortCut->rNumericArgs(9); + thisEarthTube.PipeLength = s_ipsc->rNumericArgs(9); if (thisEarthTube.PipeLength <= 0.0) { ShowSevereError(state, format("{}: {}={}, {} must be positive, entered value={:.2R}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(9), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(1), + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(9), thisEarthTube.PipeLength)); ErrorsFound = true; } - thisEarthTube.PipeThermCond = state.dataIPShortCut->rNumericArgs(10); + thisEarthTube.PipeThermCond = s_ipsc->rNumericArgs(10); if (thisEarthTube.PipeThermCond <= 0.0) { ShowSevereError(state, format("{}: {}={}, {} must be positive, entered value={:.2R}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(10), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(1), + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(10), thisEarthTube.PipeThermCond)); ErrorsFound = true; } - thisEarthTube.z = state.dataIPShortCut->rNumericArgs(11); + thisEarthTube.z = s_ipsc->rNumericArgs(11); if (thisEarthTube.z <= 0.0) { ShowSevereError(state, format("{}: {}={}, {} must be positive, entered value={:.2R}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(11), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(1), + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(11), thisEarthTube.z)); ErrorsFound = true; } @@ -387,37 +371,31 @@ void GetEarthTube(EnergyPlusData &state, bool &ErrorsFound) // If errors found i // code in initEarthTubeVertical must be modified ShowSevereError(state, format("{}: {}={}, {} must be greater than 3*{} + {} entered value={:.2R} ref sum={:.2R}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(11), - state.dataIPShortCut->cNumericFieldNames(7), - state.dataIPShortCut->cNumericFieldNames(8), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(1), + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(11), + s_ipsc->cNumericFieldNames(7), + s_ipsc->cNumericFieldNames(8), thisEarthTube.z, thisEarthTube.r1 + thisEarthTube.r2 + thisEarthTube.r3)); ErrorsFound = true; } - SoilType soilType = static_cast(getEnumValue(soilTypeNamesUC, state.dataIPShortCut->cAlphaArgs(4))); + SoilType soilType = static_cast(getEnumValue(soilTypeNamesUC, s_ipsc->cAlphaArgs(4))); constexpr std::array(SoilType::Num)> thermalDiffusivity = {0.0781056, 0.055728, 0.0445824, 0.024192}; constexpr std::array(SoilType::Num)> thermalConductivity = {2.42, 1.3, 0.865, 0.346}; if (soilType == SoilType::Invalid) { - ShowSevereError(state, - format("{}: {}={}, {} invalid={}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4))); + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4)); ErrorsFound = true; } else { thisEarthTube.SoilThermDiff = thermalDiffusivity[static_cast(soilType)]; thisEarthTube.SoilThermCond = thermalConductivity[static_cast(soilType)]; } - thisEarthTube.AverSoilSurTemp = state.dataIPShortCut->rNumericArgs(12); - thisEarthTube.ApmlSoilSurTemp = state.dataIPShortCut->rNumericArgs(13); - thisEarthTube.SoilSurPhaseConst = int(state.dataIPShortCut->rNumericArgs(14)); + thisEarthTube.AverSoilSurTemp = s_ipsc->rNumericArgs(12); + thisEarthTube.ApmlSoilSurTemp = s_ipsc->rNumericArgs(13); + thisEarthTube.SoilSurPhaseConst = int(s_ipsc->rNumericArgs(14)); // Override any user input for cases where natural ventilation is being used if (thisEarthTube.FanType == Ventilation::Natural) { @@ -425,25 +403,19 @@ void GetEarthTube(EnergyPlusData &state, bool &ErrorsFound) // If errors found i thisEarthTube.FanEfficiency = 1.0; } - thisEarthTube.ConstantTermCoef = state.dataIPShortCut->rNumericArgs(15); - thisEarthTube.TemperatureTermCoef = state.dataIPShortCut->rNumericArgs(16); - thisEarthTube.VelocityTermCoef = state.dataIPShortCut->rNumericArgs(17); - thisEarthTube.VelocitySQTermCoef = state.dataIPShortCut->rNumericArgs(18); + thisEarthTube.ConstantTermCoef = s_ipsc->rNumericArgs(15); + thisEarthTube.TemperatureTermCoef = s_ipsc->rNumericArgs(16); + thisEarthTube.VelocityTermCoef = s_ipsc->rNumericArgs(17); + thisEarthTube.VelocitySQTermCoef = s_ipsc->rNumericArgs(18); // cAlphaArgs(5)--Model type: basic or vertical // only process cAlphaArgs(6) if cAlphaArgs(5) is "Vertical" - if (state.dataIPShortCut->cAlphaArgs(5).empty()) { + if (s_ipsc->cAlphaArgs(5).empty()) { thisEarthTube.ModelType = EarthTubeModelType::Basic; } else { - thisEarthTube.ModelType = static_cast(getEnumValue(solutionTypeNamesUC, state.dataIPShortCut->cAlphaArgs(5))); + thisEarthTube.ModelType = static_cast(getEnumValue(solutionTypeNamesUC, s_ipsc->cAlphaArgs(5))); if (thisEarthTube.ModelType == EarthTubeModelType::Invalid) { - ShowSevereError(state, - format("{}: {}={}, {} invalid={}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(5), - state.dataIPShortCut->cAlphaArgs(5))); + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaArgs(5)); ErrorsFound = true; } } @@ -453,19 +425,13 @@ void GetEarthTube(EnergyPlusData &state, bool &ErrorsFound) // If errors found i // Process the parameters based on the name (link via index) thisEarthTube.vertParametersPtr = 0; for (int parIndex = 1; parIndex <= totEarthTubePars; ++parIndex) { - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(6), state.dataEarthTube->EarthTubePars(parIndex).nameParameters)) { + if (Util::SameString(s_ipsc->cAlphaArgs(6), state.dataEarthTube->EarthTubePars(parIndex).nameParameters)) { thisEarthTube.vertParametersPtr = parIndex; break; } } if (thisEarthTube.vertParametersPtr == 0) { // didn't find a match - ShowSevereError(state, - format("{}: {}={}, Parameter Object {} was not found in the input file.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaArgs(6))); - ShowContinueError(state, "Check this name and make sure one of the earth tube parameters objects matches it."); + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(6), s_ipsc->cAlphaArgs(6)); ErrorsFound = true; } } @@ -601,10 +567,10 @@ void GetEarthTube(EnergyPlusData &state, bool &ErrorsFound) // If errors found i } } - CheckEarthTubesInZones(state, state.dataIPShortCut->cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); + CheckEarthTubesInZones(state, s_ipsc->cAlphaArgs(1), s_ipsc->cCurrentModuleObject, ErrorsFound); if (ErrorsFound) { - ShowFatalError(state, format("{}: Errors getting input. Program terminates.", cCurrentModuleObject)); + ShowFatalError(state, format("{}: Errors getting input. Program terminates.", s_ipsc->cCurrentModuleObject)); } } @@ -654,7 +620,7 @@ void initEarthTubeVertical(EnergyPlusData &state) Real64 thickBottom = thickBase * thisEarthTubeParams.dimBoundBelow / float(thisEarthTubeParams.numNodesBelow); Real64 thickEarthTube = 4.0 * thisEarthTube.r1; Real64 deltat = state.dataGlobal->TimeStepZone; - Real64 thermDiff = thisEarthTube.SoilThermDiff / Constant::HoursInDay; // convert to "per hour" from "per day" + Real64 thermDiff = thisEarthTube.SoilThermDiff / Constant::rHoursInDay; // convert to "per hour" from "per day" // Node equations determine the _Coeff terms--see Engineering Referenve for details on these equation types // Note that node numbers are shifted for c++ arrays that go from 0 to numNodes-1. @@ -874,7 +840,7 @@ void CalcEarthTube(EnergyPlusData &state) if (tempShutDown) { EVF = 0.0; } else { - EVF = thisEarthTube.DesignLevel * ScheduleManager::GetCurrentScheduleValue(state, thisEarthTube.SchedPtr); + EVF = thisEarthTube.DesignLevel * thisEarthTube.availSched->getCurrentVal(); } thisZoneHB.MCPE = EVF * AirDensity * AirSpecHeat * diff --git a/src/EnergyPlus/EarthTube.hh b/src/EnergyPlus/EarthTube.hh index 8f6ebeee8cd..a66a64d5210 100644 --- a/src/EnergyPlus/EarthTube.hh +++ b/src/EnergyPlus/EarthTube.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -55,6 +55,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -84,7 +85,7 @@ namespace EarthTube { struct EarthTubeData { int ZonePtr = 0; - int SchedPtr = 0; + Sched::Schedule *availSched = nullptr; // Assuming this is an availability schedule Real64 DesignLevel = 0.0; Real64 MinTemperature = 0.0; Real64 MaxTemperature = 0.0; @@ -206,6 +207,10 @@ struct EarthTubeData : BaseGlobalStruct EPVector ZnRptET; EPVector EarthTubePars; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/EcoRoofManager.cc b/src/EnergyPlus/EcoRoofManager.cc index 978713dff92..68d097e335c 100644 --- a/src/EnergyPlus/EcoRoofManager.cc +++ b/src/EnergyPlus/EcoRoofManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -194,7 +194,7 @@ namespace EcoRoofManager { auto const &thisConstruct = state.dataConstruction->Construct(ConstrNum); auto const *thisMaterial = state.dataMaterial->materials(thisConstruct.LayerPoint(1)); RoughSurf = thisMaterial->Roughness; - Real64 AbsThermSurf = thisMaterial->AbsorpThermal; // Thermal absoptance of the exterior surface + Real64 AbsThermSurf = thisMaterial->AbsorpThermal; // Thermal absorptance of the exterior surface Real64 HMovInsul = 0.0; // "Convection" coefficient of movable insulation if (state.dataSurface->Surface(SurfNum).ExtWind) { @@ -284,7 +284,7 @@ namespace EcoRoofManager { // (Deardorff (1987)). Kelvin. based of the previous temperatures Tafk = (1.0 - sigmaf) * Tak + sigmaf * (0.3 * Tak + 0.6 * (Tif + Constant::Kelvin) + 0.1 * Tgk); - Taf = Tafk - Constant::Kelvin; // Air Temperature within canopy in Celcius (C). + Taf = Tafk - Constant::Kelvin; // Air Temperature within canopy in Celsius (C). Rhof = state.dataEcoRoofMgr->Pa / (Rair * Tafk); // Density of air at the leaf temperature Rhoaf = (Rhoa + Rhof) / 2.0; // Average of air density Zd = 0.701 * std::pow(state.dataEcoRoofMgr->Zf, 0.979); // Zero displacement height @@ -316,7 +316,7 @@ namespace EcoRoofManager { ra = 1.0 / (Cf * Waf); // Aerodynamic Resistance. Resistance that is caused // by the boundary layer on a leaf surface to transfer water vapor. It is measured in // s/m and depends on wind speed, leaf's surface roughness, - // and stability of atsmophere. + // and stability of atmosphere. CalculateEcoRoofSolar(state, RS, f1, SurfNum); if (state.dataEcoRoofMgr->MoistureMax == state.dataEcoRoofMgr->MoistureResidual) { @@ -525,9 +525,9 @@ namespace EcoRoofManager { thisEcoRoof->LAI = matER->LAI; // Leaf Area Index thisEcoRoof->Alphag = 1.0 - matER->AbsorpSolar; // albedo rather than absorptivity thisEcoRoof->Alphaf = matER->Lreflectivity; // Leaf Reflectivity - thisEcoRoof->epsilonf = matER->LEmissitivity; // Leaf Emisivity + thisEcoRoof->epsilonf = matER->LEmissitivity; // Leaf Emissivity thisEcoRoof->StomatalResistanceMin = matER->RStomata; // Leaf min stomatal resistance - thisEcoRoof->epsilong = matER->AbsorpThermal; // Soil Emisivity + thisEcoRoof->epsilong = matER->AbsorpThermal; // Soil Emissivity thisEcoRoof->MoistureMax = matER->Porosity; // Max moisture content in soil thisEcoRoof->MoistureResidual = matER->MinMoisture; // Min moisture content in soil thisEcoRoof->Moisture = matER->InitMoisture; // Initial moisture content in soil @@ -774,8 +774,8 @@ namespace EcoRoofManager { // DJS 2011 FEB - Since we no longer use CTF with soil-dependent properties (Do not RECALL INITCONDUCTION... // DJS 2011 FEB - we may be able to get away with NO limits on rates of change when using CFD routine. // DJS 2011 FEB - for now we stick with 20% per quarter hour. - RatioMax = 1.0 + 0.20 * state.dataGlobal->MinutesPerTimeStep / 15.0; - RatioMin = 1.0 - 0.20 * state.dataGlobal->MinutesPerTimeStep / 15.0; + RatioMax = 1.0 + 0.20 * state.dataGlobal->MinutesInTimeStep / 15.0; + RatioMin = 1.0 - 0.20 * state.dataGlobal->MinutesInTimeStep / 15.0; auto *mat = state.dataMaterial->materials(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)); assert(mat->group == Material::Group::EcoRoof); @@ -800,16 +800,16 @@ namespace EcoRoofManager { int index1; Real64 const depth_limit(depth_fac * std::pow(state.dataEcoRoofMgr->TopDepth + state.dataEcoRoofMgr->RootDepth, 2.07)); for (index1 = 1; index1 <= 20; ++index1) { - if (double(state.dataGlobal->MinutesPerTimeStep / index1) <= depth_limit) break; + if (double(state.dataGlobal->MinutesInTimeStep / index1) <= depth_limit) break; } if (index1 > 1) { ShowWarningError(state, "CalcEcoRoof: Too few time steps per hour for stability."); - if (ceil(60 * index1 / state.dataGlobal->MinutesPerTimeStep) <= 60) { + if (ceil(60 * index1 / state.dataGlobal->MinutesInTimeStep) <= 60) { ShowContinueError( state, format("...Entered Timesteps per hour=[{}], Change to some value greater than or equal to [{}] for assured stability.", - state.dataGlobal->NumOfTimeStepInHour, - 60 * index1 / state.dataGlobal->MinutesPerTimeStep)); + state.dataGlobal->TimeStepsInHour, + 60 * index1 / state.dataGlobal->MinutesInTimeStep)); ShowContinueError(state, "...Note that EnergyPlus has a maximum of 60 timesteps per hour"); ShowContinueError(state, "...The program will continue, but if the simulation fails due to too low/high temperatures, instability " @@ -818,8 +818,8 @@ namespace EcoRoofManager { ShowContinueError(state, format("...Entered Timesteps per hour=[{}], however the required frequency for stability [{}] is over the " "EnergyPlus maximum of 60.", - state.dataGlobal->NumOfTimeStepInHour, - 60 * index1 / state.dataGlobal->MinutesPerTimeStep)); + state.dataGlobal->TimeStepsInHour, + 60 * index1 / state.dataGlobal->MinutesInTimeStep)); ShowContinueError(state, "...Consider using the simple moisture diffusion calculation method for this application"); ShowContinueError(state, "...The program will continue, but if the simulation fails due to too low/high temperatures, instability " @@ -830,7 +830,7 @@ namespace EcoRoofManager { state.dataEcoRoofMgr->RootDepth = SoilThickness - state.dataEcoRoofMgr->TopDepth; // Next create a timestep in seconds - state.dataEcoRoofMgr->TimeStepZoneSec = state.dataGlobal->MinutesPerTimeStep * 60.0; + state.dataEcoRoofMgr->TimeStepZoneSec = state.dataGlobal->MinutesInTimeStep * 60.0; state.dataEcoRoofMgr->UpdatebeginFlag = false; } @@ -838,11 +838,11 @@ namespace EcoRoofManager { state.dataEcoRoofMgr->CurrentRunoff = 0.0; // Initialize current time step runoff as it is used in several spots below... // FIRST Subtract water evaporated by plants and at soil surface - Moisture -= (Vfluxg)*state.dataGlobal->MinutesPerTimeStep * 60.0 / state.dataEcoRoofMgr->TopDepth; // soil surface evaporation - MeanRootMoisture -= (Vfluxf)*state.dataGlobal->MinutesPerTimeStep * 60.0 / state.dataEcoRoofMgr->RootDepth; // plant extraction from root zone + Moisture -= (Vfluxg)*state.dataGlobal->MinutesInTimeStep * 60.0 / state.dataEcoRoofMgr->TopDepth; // soil surface evaporation + MeanRootMoisture -= (Vfluxf)*state.dataGlobal->MinutesInTimeStep * 60.0 / state.dataEcoRoofMgr->RootDepth; // plant extraction from root zone // NEXT Update evapotranspiration summary variable for print out - state.dataEcoRoofMgr->CurrentET = (Vfluxg + Vfluxf) * state.dataGlobal->MinutesPerTimeStep * 60.0; // units are meters + state.dataEcoRoofMgr->CurrentET = (Vfluxg + Vfluxf) * state.dataGlobal->MinutesInTimeStep * 60.0; // units are meters if (!state.dataGlobal->WarmupFlag) { state.dataEcoRoofMgr->CumET += state.dataEcoRoofMgr->CurrentET; } @@ -886,7 +886,7 @@ namespace EcoRoofManager { // the water will simply run right off the top and not penetrate at all! // At the present time this limit is fairly small due to some minor stability issues // in EnergyPlus. If the moisture changes too rapidly the code cannot handle the rapid changes in - // surface characteristics and heat fluxes. The result that I've noticed is a non-physical fluctation + // surface characteristics and heat fluxes. The result that I've noticed is a non-physical fluctuation // in ground surface temperature that oscillates up to 10 deg C from one hour to the next until the // code catches up. The temporary solution is to simply limit how much moisture can enter the soil // in any time step to 0.5"/hour. In the future this might be fixed by running with finer time steps @@ -895,9 +895,9 @@ namespace EcoRoofManager { // overflow bin that will hold extra moisture and then distribute it in subsequent hours. This way the // soil still gets the same total moisture... it is just distributed over a longer period. if (state.dataEcoRoofMgr->CurrentIrrigation + state.dataEcoRoofMgr->CurrentPrecipitation > - 0.5 * 0.0254 * state.dataGlobal->MinutesPerTimeStep / 60.0) { + 0.5 * 0.0254 * state.dataGlobal->MinutesInTimeStep / 60.0) { state.dataEcoRoofMgr->CurrentRunoff = state.dataEcoRoofMgr->CurrentIrrigation + state.dataEcoRoofMgr->CurrentPrecipitation - - (0.5 * 0.0254 * state.dataGlobal->MinutesPerTimeStep / 60.0); + (0.5 * 0.0254 * state.dataGlobal->MinutesInTimeStep / 60.0); // If we get here then TOO much moisture has already been added to soil (must now subtract excess) Moisture -= state.dataEcoRoofMgr->CurrentRunoff / state.dataEcoRoofMgr->TopDepth; // currently any incident moisture in excess of 1/4 " // per hour @@ -913,12 +913,12 @@ namespace EcoRoofManager { if (matER->calcMethod == Material::EcoRoofCalcMethod::Simple) { // THE SECTION BELOW WAS THE INITIAL MOISTURE DISTRIBUTION MODEL. - // Any line with "!-" was code. A line with "!" was just a comment. This is done in case this code needs to be resurected in the future. - // See below this commented out code for the new moisture distribution model. + // Any line with "!-" was code. A line with "!" was just a comment. This is done in case this code needs to be resurrected in the + // future. See below this commented out code for the new moisture distribution model. //********************************************************************************************************* //********************************************************************************************************* // NEXT Redistribute moisture based on moisture diffusion. - // The effective diffusivities should be revisted when better moisture transport data in ecoroof soils are + // The effective diffusivities should be revisited when better moisture transport data in ecoroof soils are // available. // Here the diffusion rate is in units of [1/s] // A value of 0.0001 would be ~ 36% / hour @@ -933,7 +933,7 @@ namespace EcoRoofManager { (Moisture - MeanRootMoisture) * state.dataEcoRoofMgr->TopDepth); MoistureDiffusion = max(0.0, MoistureDiffusion); // Safety net to keep positive (not needed?) // at this point moistureDiffusion is in units of (m)/timestep - MoistureDiffusion *= 0.00005 * state.dataGlobal->MinutesPerTimeStep * 60.0; + MoistureDiffusion *= 0.00005 * state.dataGlobal->MinutesInTimeStep * 60.0; Moisture -= MoistureDiffusion / state.dataEcoRoofMgr->TopDepth; MeanRootMoisture += MoistureDiffusion / state.dataEcoRoofMgr->RootDepth; } else if (MeanRootMoisture > Moisture) { @@ -942,7 +942,7 @@ namespace EcoRoofManager { min((MoistureMax - Moisture) * state.dataEcoRoofMgr->TopDepth, (MeanRootMoisture - Moisture) * state.dataEcoRoofMgr->RootDepth); MoistureDiffusion = max(0.0, MoistureDiffusion); // Safety net (not needed?) // at this point moistureDiffusion is in units of (m)/timestep - MoistureDiffusion *= 0.00001 * state.dataGlobal->MinutesPerTimeStep * 60.0; + MoistureDiffusion *= 0.00001 * state.dataGlobal->MinutesInTimeStep * 60.0; Moisture += MoistureDiffusion / state.dataEcoRoofMgr->TopDepth; MeanRootMoisture -= MoistureDiffusion / state.dataEcoRoofMgr->RootDepth; } @@ -1072,7 +1072,7 @@ namespace EcoRoofManager { // Note wet soil absorptance is generally 25-50% higher than dry soil absorptance (assume linear) SoilAbsorpSolar = state.dataEcoRoofMgr->DryAbsorp + (0.92 - state.dataEcoRoofMgr->DryAbsorp) * (Moisture - MoistureResidual) / (MoistureMax - MoistureResidual); - // Limit solar absorptivity to 95% so soil abledo is always above 5% + // Limit solar absorptivity to 95% so soil albedo is always above 5% if (SoilAbsorpSolar > 0.95) SoilAbsorpSolar = 0.95; // Limit solar absorptivity to greater than 20% so that albedo is always less than 80% if (SoilAbsorpSolar < 0.20) SoilAbsorpSolar = 0.20; diff --git a/src/EnergyPlus/EcoRoofManager.hh b/src/EnergyPlus/EcoRoofManager.hh index e7ddb18d47d..6fae684dfc4 100644 --- a/src/EnergyPlus/EcoRoofManager.hh +++ b/src/EnergyPlus/EcoRoofManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -169,6 +169,10 @@ struct EcoRoofManagerData : BaseGlobalStruct Real64 TestMoisture = 0.15; // This makes sure that the moisture cannot change by too much in each step int ErrIndex = 0; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/EconomicLifeCycleCost.cc b/src/EnergyPlus/EconomicLifeCycleCost.cc index 1895608fe0b..864647d63de 100644 --- a/src/EnergyPlus/EconomicLifeCycleCost.cc +++ b/src/EnergyPlus/EconomicLifeCycleCost.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -172,7 +172,7 @@ void GetInputLifeCycleCostParameters(EnergyPlusData &state) AlphaArray.allocate(NumAlphas); NumObj = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); - auto &elcc(state.dataEconLifeCycleCost); + auto const &elcc = state.dataEconLifeCycleCost; if (NumObj == 0) { elcc->LCCparamPresent = false; diff --git a/src/EnergyPlus/EconomicLifeCycleCost.hh b/src/EnergyPlus/EconomicLifeCycleCost.hh index ac10e829859..39e9ca8fb7f 100644 --- a/src/EnergyPlus/EconomicLifeCycleCost.hh +++ b/src/EnergyPlus/EconomicLifeCycleCost.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -512,6 +512,10 @@ struct EconomicLifeCycleCostData : BaseGlobalStruct EPVector UseAdjustment; std::vector CashFlow; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/EconomicTariff.cc b/src/EnergyPlus/EconomicTariff.cc index cb2ec0a5f6a..6b53f604ae7 100644 --- a/src/EnergyPlus/EconomicTariff.cc +++ b/src/EnergyPlus/EconomicTariff.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -136,6 +136,8 @@ void GetInputEconomicsTariff(EnergyPlusData &state, bool &ErrorsFound) // true i // meaning if "CCF" is picked, the conversion factor isn't the same whether it's a water meter or a fuel meter. static constexpr std::string_view RoutineName("GetInputEconomicsTariff: "); + static constexpr std::string_view routineName = "GetInputEconomicsTariff"; + int NumAlphas; // Number of elements in the alpha array int NumNums; // Number of elements in the numeric array int IOStat; // IO Status when calling get input subroutine @@ -149,6 +151,8 @@ void GetInputEconomicsTariff(EnergyPlusData &state, bool &ErrorsFound) // true i Array1D_string NamesOfKeys; // Specific key name Array1D_int IndexesForKeyVar; // Array index + auto &s_ipsc = state.dataIPShortCut; + auto &tariff(state.dataEconTariff->tariff); std::string_view CurrentModuleObject = "UtilityCost:Tariff"; @@ -158,25 +162,27 @@ void GetInputEconomicsTariff(EnergyPlusData &state, bool &ErrorsFound) // true i state.dataInputProcessing->inputProcessor->getObjectItem(state, CurrentModuleObject, iInObj, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNums, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; // check to make sure none of the values are another economic object for (int jFld = 1; jFld <= NumAlphas; ++jFld) { // args are always turned to upper case but this is okay... - if (hasi(state.dataIPShortCut->cAlphaArgs(jFld), "UtilityCost:")) { - ShowWarningError(state, format("{}{}=\"{}\".", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + if (hasi(s_ipsc->cAlphaArgs(jFld), "UtilityCost:")) { + ShowWarningError(state, format("{}{}=\"{}\".", RoutineName, CurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "... a field was found containing UtilityCost: which may indicate a missing comma."); } } // name of the tariff - tariff(iInObj).tariffName = state.dataIPShortCut->cAlphaArgs(1); + tariff(iInObj).tariffName = s_ipsc->cAlphaArgs(1); // check if tariff name is unique int found = 0; for (int jObj = 1; jObj <= iInObj - 1; ++jObj) { @@ -186,17 +192,17 @@ void GetInputEconomicsTariff(EnergyPlusData &state, bool &ErrorsFound) // true i } } if (found > 0) { - ShowSevereError(state, format("{}{}=\"{}\" invalid data", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("{}{}=\"{}\" invalid data", RoutineName, CurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "...Duplicate name. Name has already been used."); ErrorsFound = true; } // name of the report meter - tariff(iInObj).reportMeter = state.dataIPShortCut->cAlphaArgs(2); + tariff(iInObj).reportMeter = s_ipsc->cAlphaArgs(2); // call the key count function but only need count during this pass GetVariableKeyCountandType(state, tariff(iInObj).reportMeter, KeyCount, TypeVar, AvgSumVar, StepTypeVar, UnitsVar); // if no meters found for that name if (KeyCount == 0) { - ShowWarningError(state, format("{}{}=\"{}\" missing meter", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowWarningError(state, format("{}{}=\"{}\" missing meter", RoutineName, CurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, format("Meter referenced is not present due to a lack of equipment that uses that energy source/meter:\"{}\".", tariff(iInObj).reportMeter)); @@ -207,7 +213,7 @@ void GetInputEconomicsTariff(EnergyPlusData &state, bool &ErrorsFound) // true i GetVariableKeys(state, tariff(iInObj).reportMeter, TypeVar, NamesOfKeys, IndexesForKeyVar); // although this retrieves all keys for a variable, we only need one so the first one is chosen if (KeyCount > 1) { - ShowWarningError(state, format("{}{}=\"{}\" multiple keys", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowWarningError(state, format("{}{}=\"{}\" multiple keys", RoutineName, CurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "... Multiple keys for variable select. First key will be used."); } // assign the index @@ -267,23 +273,23 @@ void GetInputEconomicsTariff(EnergyPlusData &state, bool &ErrorsFound) // true i // We set demandConv to something analogous to m3/h if (tariff(iInObj).kindWaterMtr == kindMeterWater) { // conversion factor - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "USERDEFINED")) { + if (Util::SameString(s_ipsc->cAlphaArgs(3), "USERDEFINED")) { tariff(iInObj).convChoice = EconConv::USERDEF; - tariff(iInObj).energyConv = state.dataIPShortCut->rNumericArgs(1); // energy conversion factor - tariff(iInObj).demandConv = state.dataIPShortCut->rNumericArgs(2); // demand conversion factor - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "M3")) { + tariff(iInObj).energyConv = s_ipsc->rNumericArgs(1); // energy conversion factor + tariff(iInObj).demandConv = s_ipsc->rNumericArgs(2); // demand conversion factor + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "M3")) { tariff(iInObj).convChoice = EconConv::M3; tariff(iInObj).energyConv = 1.0; tariff(iInObj).demandConv = 3600.0; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "CCF")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "CCF")) { tariff(iInObj).convChoice = EconConv::CCF; tariff(iInObj).energyConv = 0.35314666721488586; tariff(iInObj).demandConv = 0.35314666721488586 * 3600; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "GAL")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "GAL")) { tariff(iInObj).convChoice = EconConv::GAL; tariff(iInObj).energyConv = 264.1720523602524; tariff(iInObj).demandConv = 264.1720523602524 * 3600; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "KGAL")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "KGAL")) { tariff(iInObj).convChoice = EconConv::KGAL; tariff(iInObj).energyConv = 0.2641720523602524; tariff(iInObj).demandConv = 0.2641720523602524 * 3600; @@ -292,100 +298,94 @@ void GetInputEconomicsTariff(EnergyPlusData &state, bool &ErrorsFound) // true i tariff(iInObj).convChoice = EconConv::M3; tariff(iInObj).energyConv = 1.0; tariff(iInObj).demandConv = 3600.0; - ShowWarningError(state, format("{}{}=\"{}\" invalid data", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, - format("{}=\"{}\", Defaulting to m^3 (Water resource detected).", - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + ShowWarningError(state, format("{}{}=\"{}\" invalid data", RoutineName, CurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError( + state, format("{}=\"{}\", Defaulting to m^3 (Water resource detected).", s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3))); } // If it's an electric meter // Volumetric units such as MCF or CCF doesn't make sense IMHO (JM) // THERM is strange for an electric meter but currently I accept but issue a warning } else if (tariff(iInObj).kindElectricMtr != kindMeterNotElectric) { - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "USERDEFINED")) { + if (Util::SameString(s_ipsc->cAlphaArgs(3), "USERDEFINED")) { tariff(iInObj).convChoice = EconConv::USERDEF; - tariff(iInObj).energyConv = state.dataIPShortCut->rNumericArgs(1); // energy conversion factor - tariff(iInObj).demandConv = state.dataIPShortCut->rNumericArgs(2); // demand conversion factor - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "KWH")) { + tariff(iInObj).energyConv = s_ipsc->rNumericArgs(1); // energy conversion factor + tariff(iInObj).demandConv = s_ipsc->rNumericArgs(2); // demand conversion factor + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "KWH")) { tariff(iInObj).convChoice = EconConv::KWH; tariff(iInObj).energyConv = 0.0000002778; tariff(iInObj).demandConv = 0.001; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "MJ")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "MJ")) { tariff(iInObj).convChoice = EconConv::MJ; tariff(iInObj).energyConv = 0.000001; tariff(iInObj).demandConv = 0.0036; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "MMBTU")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "MMBTU")) { tariff(iInObj).convChoice = EconConv::MMBTU; tariff(iInObj).energyConv = 9.4781712e-10; tariff(iInObj).demandConv = 0.000003412; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "KBTU")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "KBTU")) { tariff(iInObj).convChoice = EconConv::KBTU; tariff(iInObj).energyConv = 9.4781712e-7; tariff(iInObj).demandConv = 0.003412; // We accept the following choices, but issue a warning - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "THERM")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "THERM")) { tariff(iInObj).convChoice = EconConv::THERM; tariff(iInObj).energyConv = 9.4781712e-9; tariff(iInObj).demandConv = 0.00003412; - ShowWarningError( - state, format("{}{}=\"{}\" potentially invalid data", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, - format("{}=\"{}\", Therm is an unusual choice for an electric resource.", - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + ShowWarningError(state, format("{}{}=\"{}\" potentially invalid data", RoutineName, CurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError( + state, + format("{}=\"{}\", Therm is an unusual choice for an electric resource.", s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3))); // Otherwise, default to kWh } else { tariff(iInObj).convChoice = EconConv::KWH; tariff(iInObj).energyConv = 0.0000002778; tariff(iInObj).demandConv = 0.001; - ShowWarningError(state, format("{}{}=\"{}\" invalid data", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, - format("{}=\"{}\", Defaulting to kWh (Electric resource detected)", - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + ShowWarningError(state, format("{}{}=\"{}\" invalid data", RoutineName, CurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError( + state, format("{}=\"{}\", Defaulting to kWh (Electric resource detected)", s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3))); } // If it's a gas meter } else if (tariff(iInObj).kindGasMtr == kindMeterGas) { - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "USERDEFINED")) { + if (Util::SameString(s_ipsc->cAlphaArgs(3), "USERDEFINED")) { tariff(iInObj).convChoice = EconConv::USERDEF; - tariff(iInObj).energyConv = state.dataIPShortCut->rNumericArgs(1); // energy conversion factor - tariff(iInObj).demandConv = state.dataIPShortCut->rNumericArgs(2); // demand conversion factor - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "KWH")) { + tariff(iInObj).energyConv = s_ipsc->rNumericArgs(1); // energy conversion factor + tariff(iInObj).demandConv = s_ipsc->rNumericArgs(2); // demand conversion factor + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "KWH")) { tariff(iInObj).convChoice = EconConv::KWH; tariff(iInObj).energyConv = 0.0000002778; tariff(iInObj).demandConv = 0.001; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "THERM")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "THERM")) { tariff(iInObj).convChoice = EconConv::THERM; tariff(iInObj).energyConv = 9.4781712e-9; tariff(iInObj).demandConv = 0.00003412; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "MMBTU")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "MMBTU")) { tariff(iInObj).convChoice = EconConv::MMBTU; tariff(iInObj).energyConv = 9.4781712e-10; tariff(iInObj).demandConv = 0.000003412; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "MJ")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "MJ")) { tariff(iInObj).convChoice = EconConv::MJ; tariff(iInObj).energyConv = 0.000001; tariff(iInObj).demandConv = 0.0036; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "KBTU")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "KBTU")) { tariff(iInObj).convChoice = EconConv::KBTU; tariff(iInObj).energyConv = 9.4781712e-7; tariff(iInObj).demandConv = 0.003412; // Volumetric units for natural gas // Actually assuming 1 therm = 1 CCF (= 100 ft^3) - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "MCF")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "MCF")) { tariff(iInObj).convChoice = EconConv::MCF; tariff(iInObj).energyConv = 9.4781712e-10; tariff(iInObj).demandConv = 0.000003412; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "CCF")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "CCF")) { tariff(iInObj).convChoice = EconConv::CCF; tariff(iInObj).energyConv = 9.4781712e-9; tariff(iInObj).demandConv = 0.00003412; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "M3")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "M3")) { // Obtained from converting CCF above to m^3 so the same heat content of natural gas is used (1 therm = 1 CCF) tariff(iInObj).convChoice = EconConv::M3; tariff(iInObj).energyConv = 2.6839192e-10; @@ -396,35 +396,34 @@ void GetInputEconomicsTariff(EnergyPlusData &state, bool &ErrorsFound) // true i tariff(iInObj).convChoice = EconConv::KWH; tariff(iInObj).energyConv = 0.0000002778; tariff(iInObj).demandConv = 0.001; - ShowWarningError(state, format("{}{}=\"{}\" invalid data", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError( - state, format("{}=\"{}\", Defaulting to kWh.", state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3))); + ShowWarningError(state, format("{}{}=\"{}\" invalid data", RoutineName, CurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{}=\"{}\", Defaulting to kWh.", s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3))); } // It it's neither an electric, water or gas meter, we cannot accept volumetric units // because we cannot infer the heat content } else { - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "USERDEFINED")) { + if (Util::SameString(s_ipsc->cAlphaArgs(3), "USERDEFINED")) { tariff(iInObj).convChoice = EconConv::USERDEF; - tariff(iInObj).energyConv = state.dataIPShortCut->rNumericArgs(1); // energy conversion factor - tariff(iInObj).demandConv = state.dataIPShortCut->rNumericArgs(2); // demand conversion factor - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "KWH")) { + tariff(iInObj).energyConv = s_ipsc->rNumericArgs(1); // energy conversion factor + tariff(iInObj).demandConv = s_ipsc->rNumericArgs(2); // demand conversion factor + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "KWH")) { tariff(iInObj).convChoice = EconConv::KWH; tariff(iInObj).energyConv = 0.0000002778; tariff(iInObj).demandConv = 0.001; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "THERM")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "THERM")) { tariff(iInObj).convChoice = EconConv::THERM; tariff(iInObj).energyConv = 9.4781712e-9; tariff(iInObj).demandConv = 0.00003412; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "MMBTU")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "MMBTU")) { tariff(iInObj).convChoice = EconConv::MMBTU; tariff(iInObj).energyConv = 9.4781712e-10; tariff(iInObj).demandConv = 0.000003412; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "MJ")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "MJ")) { tariff(iInObj).convChoice = EconConv::MJ; tariff(iInObj).energyConv = 0.000001; tariff(iInObj).demandConv = 0.0036; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "KBTU")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "KBTU")) { tariff(iInObj).convChoice = EconConv::KBTU; tariff(iInObj).energyConv = 9.4781712e-7; tariff(iInObj).demandConv = 0.003412; @@ -434,71 +433,50 @@ void GetInputEconomicsTariff(EnergyPlusData &state, bool &ErrorsFound) // true i tariff(iInObj).convChoice = EconConv::KWH; tariff(iInObj).energyConv = 0.0000002778; tariff(iInObj).demandConv = 0.001; - ShowWarningError(state, format("{}{}=\"{}\" invalid data", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError( - state, format("{}=\"{}\", Defaulting to kWh.", state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3))); + ShowWarningError(state, format("{}{}=\"{}\" invalid data", RoutineName, CurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{}=\"{}\", Defaulting to kWh.", s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3))); } } // Default conversion factors have been applied from here on // schedules // period schedule - if (len(state.dataIPShortCut->cAlphaArgs(4)) > 0) { - tariff(iInObj).periodSchedule = state.dataIPShortCut->cAlphaArgs(4); // name of the period schedule (time of day) - tariff(iInObj).periodSchIndex = - ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(4)); // index to the period schedule - if (tariff(iInObj).periodSchIndex == 0) { - ShowSevereError(state, format("{}{}=\"{}\" invalid data", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, - format(" not found {}=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4))); + if (len(s_ipsc->cAlphaArgs(4)) > 0) { + if ((tariff(iInObj).periodSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(4))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4)); ErrorsFound = true; } - } else { - tariff(iInObj).periodSchIndex = 0; // flag value for no schedule used } + // season schedule - if (len(state.dataIPShortCut->cAlphaArgs(5)) > 0) { - tariff(iInObj).seasonSchedule = state.dataIPShortCut->cAlphaArgs(5); // name of the season schedule (winter/summer) - tariff(iInObj).seasonSchIndex = - ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(5)); // index to the season schedule - if (tariff(iInObj).seasonSchIndex == 0) { - ShowSevereError(state, format("{}{}=\"{}\" invalid data", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, - format(" not found {}=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5))); + if (len(s_ipsc->cAlphaArgs(5)) > 0) { + if ((tariff(iInObj).seasonSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(5))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaArgs(5)); ErrorsFound = true; } - } else { - tariff(iInObj).seasonSchIndex = 0; // flag value for no schedule used } + // month schedule - if (len(state.dataIPShortCut->cAlphaArgs(6)) > 0) { - tariff(iInObj).monthSchedule = state.dataIPShortCut->cAlphaArgs(6); // name of month schedule (when months end) - tariff(iInObj).monthSchIndex = - ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(6)); // index to the month schedule - if (tariff(iInObj).monthSchIndex == 0) { - ShowSevereError(state, format("{}{}=\"{}\" invalid data", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, - format(" not found {}=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(6), state.dataIPShortCut->cAlphaArgs(6))); + if (len(s_ipsc->cAlphaArgs(6)) > 0) { + if ((tariff(iInObj).monthSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(6))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(6), s_ipsc->cAlphaArgs(6)); ErrorsFound = true; } - } else { - tariff(iInObj).monthSchIndex = 0; // flag value for no schedule used } // type of demand window - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(7), "QuarterHour")) { - // check to make sure that the demand window and the TIMESTEP IN HOUR are consistant. - { - switch (state.dataGlobal->NumOfTimeStepInHour) { + if (Util::SameString(s_ipsc->cAlphaArgs(7), "QuarterHour")) { + // check to make sure that the demand window and the TIMESTEP IN HOUR are consistent. + { // Why is this a nested scope? + switch (state.dataGlobal->TimeStepsInHour) { case 1: case 3: case 5: case 15: { tariff(iInObj).demandWindow = DemandWindow::Hour; tariff(iInObj).demWinTime = 1.00; - ShowWarningError(state, - format("{}{}=\"{}\" invalid data", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowWarningError(state, format("{}{}=\"{}\" invalid data", RoutineName, CurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, format("Demand window of QuarterHour is not consistent with number of timesteps per hour [{}].", - state.dataGlobal->NumOfTimeStepInHour)); + state.dataGlobal->TimeStepsInHour)); ShowContinueError(state, "Demand window will be set to FullHour, and the simulation continues."); } break; case 2: @@ -507,11 +485,10 @@ void GetInputEconomicsTariff(EnergyPlusData &state, bool &ErrorsFound) // true i case 30: { tariff(iInObj).demandWindow = DemandWindow::Half; tariff(iInObj).demWinTime = 0.50; - ShowWarningError(state, - format("{}{}=\"{}\" invalid data", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowWarningError(state, format("{}{}=\"{}\" invalid data", RoutineName, CurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, format("Demand window of QuarterHour is not consistent with number of timesteps per hour [{}].", - state.dataGlobal->NumOfTimeStepInHour)); + state.dataGlobal->TimeStepsInHour)); ShowContinueError(state, "Demand window will be set to HalfHour, and the simulation continues."); } break; case 4: @@ -526,20 +503,19 @@ void GetInputEconomicsTariff(EnergyPlusData &state, bool &ErrorsFound) // true i } break; } } - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(7), "HalfHour")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(7), "HalfHour")) { { - switch (state.dataGlobal->NumOfTimeStepInHour) { + switch (state.dataGlobal->TimeStepsInHour) { case 1: case 3: case 5: case 15: { tariff(iInObj).demandWindow = DemandWindow::Hour; tariff(iInObj).demWinTime = 1.00; - ShowWarningError(state, - format("{}{}=\"{}\" invalid data", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowWarningError(state, format("{}{}=\"{}\" invalid data", RoutineName, CurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, format("Demand window of HalfHour is not consistent with number of timesteps per hour [{}].", - state.dataGlobal->NumOfTimeStepInHour)); + state.dataGlobal->TimeStepsInHour)); ShowContinueError(state, "Demand window will be set to FullHour, and the simulation continues."); } break; case 2: @@ -558,19 +534,19 @@ void GetInputEconomicsTariff(EnergyPlusData &state, bool &ErrorsFound) // true i } break; } } - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(7), "FullHour")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(7), "FullHour")) { tariff(iInObj).demandWindow = DemandWindow::Hour; tariff(iInObj).demWinTime = 1.00; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(7), "Day")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(7), "Day")) { tariff(iInObj).demandWindow = DemandWindow::Day; tariff(iInObj).demWinTime = 24.00; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(7), "Week")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(7), "Week")) { tariff(iInObj).demandWindow = DemandWindow::Week; tariff(iInObj).demWinTime = 24.0 * 7.0; } else { // if not entered default to the same logic as quarter of an hour { - switch (state.dataGlobal->NumOfTimeStepInHour) { + switch (state.dataGlobal->TimeStepsInHour) { case 1: case 3: case 5: @@ -599,43 +575,41 @@ void GetInputEconomicsTariff(EnergyPlusData &state, bool &ErrorsFound) // true i } } // monthly charge - tariff(iInObj).monthChgVal = Util::ProcessNumber(state.dataIPShortCut->cAlphaArgs(8), isNotNumeric); + tariff(iInObj).monthChgVal = Util::ProcessNumber(s_ipsc->cAlphaArgs(8), isNotNumeric); tariff(iInObj).monthChgPt = - AssignVariablePt(state, state.dataIPShortCut->cAlphaArgs(8), isNotNumeric, varIsArgument, varNotYetDefined, ObjType::Invalid, 0, iInObj); + AssignVariablePt(state, s_ipsc->cAlphaArgs(8), isNotNumeric, varIsArgument, varNotYetDefined, ObjType::Invalid, 0, iInObj); // minimum monthly charge - if (len(state.dataIPShortCut->cAlphaArgs(9)) > 0) { - tariff(iInObj).minMonthChgVal = Util::ProcessNumber(state.dataIPShortCut->cAlphaArgs(9), isNotNumeric); + if (len(s_ipsc->cAlphaArgs(9)) > 0) { + tariff(iInObj).minMonthChgVal = Util::ProcessNumber(s_ipsc->cAlphaArgs(9), isNotNumeric); } else { tariff(iInObj).minMonthChgVal = -HUGE_(-1.0); // set to a very negative value } tariff(iInObj).minMonthChgPt = - AssignVariablePt(state, state.dataIPShortCut->cAlphaArgs(9), isNotNumeric, varIsArgument, varNotYetDefined, ObjType::Invalid, 0, iInObj); + AssignVariablePt(state, s_ipsc->cAlphaArgs(9), isNotNumeric, varIsArgument, varNotYetDefined, ObjType::Invalid, 0, iInObj); // real time pricing - tariff(iInObj).chargeSchedule = state.dataIPShortCut->cAlphaArgs(10); - tariff(iInObj).chargeSchIndex = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(10)); - tariff(iInObj).baseUseSchedule = state.dataIPShortCut->cAlphaArgs(11); - tariff(iInObj).baseUseSchIndex = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(11)); + tariff(iInObj).chargeSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(10)); + tariff(iInObj).baseUseSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(11)); // group name for separate distribution and transmission rates - tariff(iInObj).groupName = state.dataIPShortCut->cAlphaArgs(12); + tariff(iInObj).groupName = s_ipsc->cAlphaArgs(12); // buy or sell option - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(13), "BuyFromUtility")) { + if (Util::SameString(s_ipsc->cAlphaArgs(13), "BuyFromUtility")) { tariff(iInObj).buyOrSell = buyFromUtility; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(13), "SellToUtility")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(13), "SellToUtility")) { tariff(iInObj).buyOrSell = sellToUtility; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(13), "NetMetering")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(13), "NetMetering")) { tariff(iInObj).buyOrSell = netMetering; } else { tariff(iInObj).buyOrSell = buyFromUtility; } // check if meter is consistent with buy or sell option if ((tariff(iInObj).buyOrSell == sellToUtility) && (!Util::SameString(tariff(iInObj).reportMeter, "ELECTRICITYSURPLUSSOLD:FACILITY"))) { - ShowWarningError(state, format("{}{}=\"{}\" atypical meter", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowWarningError(state, format("{}{}=\"{}\" atypical meter", RoutineName, CurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, format("The meter chosen \"{}\" is not typically used with the sellToUtility option.", tariff(iInObj).reportMeter)); ShowContinueError(state, "Usually the ElectricitySurplusSold:Facility meter is selected when the sellToUtility option is used."); } if ((tariff(iInObj).buyOrSell == netMetering) && (!Util::SameString(tariff(iInObj).reportMeter, "ELECTRICITYNET:FACILITY"))) { - ShowWarningError(state, format("{}{}=\"{}\" atypical meter", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowWarningError(state, format("{}{}=\"{}\" atypical meter", RoutineName, CurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, format("The meter chosen \"{}\" is not typically used with the netMetering option.", tariff(iInObj).reportMeter)); ShowContinueError(state, "Usually the ElectricityNet:Facility meter is selected when the netMetering option is used."); @@ -645,8 +619,7 @@ void GetInputEconomicsTariff(EnergyPlusData &state, bool &ErrorsFound) // true i if (hasi(tariff(iInObj).reportMeter, "Elec")) { // test if electric meter if (!(Util::SameString(tariff(iInObj).reportMeter, "Electricity:Facility") || Util::SameString(tariff(iInObj).reportMeter, "ElectricityPurchased:Facility"))) { - ShowWarningError(state, - format("{}{}=\"{}\" atypical meter", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowWarningError(state, format("{}{}=\"{}\" atypical meter", RoutineName, CurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError( state, format("The meter chosen \"{}\" is not typically used with the buyFromUtility option.", tariff(iInObj).reportMeter)); ShowContinueError(state, @@ -684,84 +657,80 @@ void GetInputEconomicsQualify(EnergyPlusData &state, bool &ErrorsFound) // true // Read the input file for "Economics:Qualify" objects. static constexpr std::string_view RoutineName("GetInputEconomicsQualify: "); + int iInObj; // loop index variable for reading in objects int NumAlphas; // Number of elements in the alpha array int NumNums; // Number of elements in the numeric array int IOStat; // IO Status when calling get input subroutine bool isNotNumeric; int jFld; - std::string CurrentModuleObject; // for ease in renaming. auto &qualify(state.dataEconTariff->qualify); - CurrentModuleObject = "UtilityCost:Qualify"; - state.dataEconTariff->numQualify = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + auto &s_ipsc = state.dataIPShortCut; + + s_ipsc->cCurrentModuleObject = "UtilityCost:Qualify"; + state.dataEconTariff->numQualify = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); qualify.allocate(state.dataEconTariff->numQualify); for (iInObj = 1; iInObj <= state.dataEconTariff->numQualify; ++iInObj) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - CurrentModuleObject, + s_ipsc->cCurrentModuleObject, iInObj, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNums, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + // check to make sure none of the values are another economic object for (jFld = 1; jFld <= NumAlphas; ++jFld) { - if (hasi(state.dataIPShortCut->cAlphaArgs(jFld), "UtilityCost:")) { - ShowWarningError(state, format("{}{}=\"{}\".", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + if (hasi(s_ipsc->cAlphaArgs(jFld), "UtilityCost:")) { + ShowWarningError(state, format("{}{}=\"{}\".", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "... a field was found containing UtilityCost: which may indicate a missing comma."); } } // index of the tariff name in the tariff array - qualify(iInObj).tariffIndx = - FindTariffIndex(state, state.dataIPShortCut->cAlphaArgs(2), state.dataIPShortCut->cAlphaArgs(1), ErrorsFound, CurrentModuleObject); - warnIfNativeVarname(state, state.dataIPShortCut->cAlphaArgs(1), qualify(iInObj).tariffIndx, ErrorsFound, CurrentModuleObject); + qualify(iInObj).tariffIndx = FindTariffIndex(state, s_ipsc->cAlphaArgs(2), s_ipsc->cAlphaArgs(1), ErrorsFound, s_ipsc->cCurrentModuleObject); + warnIfNativeVarname(state, s_ipsc->cAlphaArgs(1), qualify(iInObj).tariffIndx, ErrorsFound, s_ipsc->cCurrentModuleObject); qualify(iInObj).namePt = AssignVariablePt( - state, state.dataIPShortCut->cAlphaArgs(1), true, varIsAssigned, varNotYetDefined, ObjType::Qualify, iInObj, qualify(iInObj).tariffIndx); + state, s_ipsc->cAlphaArgs(1), true, varIsAssigned, varNotYetDefined, ObjType::Qualify, iInObj, qualify(iInObj).tariffIndx); // index of the variable in the variable array - qualify(iInObj).sourcePt = AssignVariablePt( - state, state.dataIPShortCut->cAlphaArgs(3), true, varIsArgument, varNotYetDefined, ObjType::Invalid, 0, qualify(iInObj).tariffIndx); + qualify(iInObj).sourcePt = + AssignVariablePt(state, s_ipsc->cAlphaArgs(3), true, varIsArgument, varNotYetDefined, ObjType::Invalid, 0, qualify(iInObj).tariffIndx); // indicator if maximum test otherwise minimum - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(4), "Minimum")) { + if (Util::SameString(s_ipsc->cAlphaArgs(4), "Minimum")) { qualify(iInObj).isMaximum = false; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(4), "Maximum")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(4), "Maximum")) { qualify(iInObj).isMaximum = true; } else { - ShowSevereError(state, format("{}{}=\"{}\" invalid data", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("{}=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4))); + ShowSevereError(state, format("{}{}=\"{}\" invalid data", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{}=\"{}\".", s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4))); ErrorsFound = true; qualify(iInObj).isMaximum = true; } // value of the threshold - qualify(iInObj).thresholdVal = Util::ProcessNumber(state.dataIPShortCut->cAlphaArgs(5), isNotNumeric); - qualify(iInObj).thresholdPt = AssignVariablePt(state, - state.dataIPShortCut->cAlphaArgs(5), - isNotNumeric, - varIsArgument, - varNotYetDefined, - ObjType::Invalid, - 0, - qualify(iInObj).tariffIndx); + qualify(iInObj).thresholdVal = Util::ProcessNumber(s_ipsc->cAlphaArgs(5), isNotNumeric); + qualify(iInObj).thresholdPt = AssignVariablePt( + state, s_ipsc->cAlphaArgs(5), isNotNumeric, varIsArgument, varNotYetDefined, ObjType::Invalid, 0, qualify(iInObj).tariffIndx); // enumerated list of the kind of season - qualify(iInObj).season = LookUpSeason(state, state.dataIPShortCut->cAlphaArgs(6), state.dataIPShortCut->cAlphaArgs(1)); + qualify(iInObj).season = LookUpSeason(state, s_ipsc->cAlphaArgs(6), s_ipsc->cAlphaArgs(1)); // indicator if consecutive months otherwise count - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(7), "Count")) { + if (Util::SameString(s_ipsc->cAlphaArgs(7), "Count")) { qualify(iInObj).isConsecutive = false; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(7), "Consecutive")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(7), "Consecutive")) { qualify(iInObj).isConsecutive = true; } else { - ShowWarningError(state, format("{}{}=\"{}\" invalid data", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("{}=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5))); + ShowWarningError(state, format("{}{}=\"{}\" invalid data", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{}=\"{}\".", s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaArgs(5))); ErrorsFound = true; qualify(iInObj).isConsecutive = true; } // number of months the test must be good for - qualify(iInObj).numberOfMonths = state.dataIPShortCut->rNumericArgs(1); + qualify(iInObj).numberOfMonths = s_ipsc->rNumericArgs(1); } } @@ -778,66 +747,60 @@ void GetInputEconomicsChargeSimple(EnergyPlusData &state, bool &ErrorsFound) // int IOStat; // IO Status when calling get input subroutine bool isNotNumeric; - std::string CurrentModuleObject = "UtilityCost:Charge:Simple"; - state.dataEconTariff->numChargeSimple = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + auto &s_ipsc = state.dataIPShortCut; + s_ipsc->cCurrentModuleObject = "UtilityCost:Charge:Simple"; + + state.dataEconTariff->numChargeSimple = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); state.dataEconTariff->chargeSimple.allocate(state.dataEconTariff->numChargeSimple); for (int iInObj = 1; iInObj <= state.dataEconTariff->numChargeSimple; ++iInObj) { auto &chargeSimple = state.dataEconTariff->chargeSimple(iInObj); state.dataInputProcessing->inputProcessor->getObjectItem(state, - CurrentModuleObject, + s_ipsc->cCurrentModuleObject, iInObj, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNums, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); // check to make sure none of the values are another economic object for (int jFld = 1; jFld <= NumAlphas; ++jFld) { - if (hasi(state.dataIPShortCut->cAlphaArgs(jFld), "UtilityCost:")) { - ShowWarningError(state, format("{}{}=\"{}\".", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + if (hasi(s_ipsc->cAlphaArgs(jFld), "UtilityCost:")) { + ShowWarningError(state, format("{}{}=\"{}\".", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "... a field was found containing UtilityCost: which may indicate a missing comma."); } } // index of the tariff name in the tariff array - chargeSimple.tariffIndx = - FindTariffIndex(state, state.dataIPShortCut->cAlphaArgs(2), state.dataIPShortCut->cAlphaArgs(1), ErrorsFound, CurrentModuleObject); - warnIfNativeVarname(state, state.dataIPShortCut->cAlphaArgs(1), chargeSimple.tariffIndx, ErrorsFound, CurrentModuleObject); - chargeSimple.namePt = AssignVariablePt(state, - state.dataIPShortCut->cAlphaArgs(1), - true, - varIsAssigned, - varNotYetDefined, - ObjType::ChargeSimple, - iInObj, - chargeSimple.tariffIndx); + chargeSimple.tariffIndx = FindTariffIndex(state, s_ipsc->cAlphaArgs(2), s_ipsc->cAlphaArgs(1), ErrorsFound, s_ipsc->cCurrentModuleObject); + warnIfNativeVarname(state, s_ipsc->cAlphaArgs(1), chargeSimple.tariffIndx, ErrorsFound, s_ipsc->cCurrentModuleObject); + chargeSimple.namePt = AssignVariablePt( + state, s_ipsc->cAlphaArgs(1), true, varIsAssigned, varNotYetDefined, ObjType::ChargeSimple, iInObj, chargeSimple.tariffIndx); // index of the variable in the variable array - chargeSimple.sourcePt = AssignVariablePt( - state, state.dataIPShortCut->cAlphaArgs(3), true, varIsArgument, varNotYetDefined, ObjType::Invalid, 0, chargeSimple.tariffIndx); + chargeSimple.sourcePt = + AssignVariablePt(state, s_ipsc->cAlphaArgs(3), true, varIsArgument, varNotYetDefined, ObjType::Invalid, 0, chargeSimple.tariffIndx); // enumerated list of the kind of season - chargeSimple.season = LookUpSeason(state, state.dataIPShortCut->cAlphaArgs(4), state.dataIPShortCut->cAlphaArgs(1)); + chargeSimple.season = LookUpSeason(state, s_ipsc->cAlphaArgs(4), s_ipsc->cAlphaArgs(1)); // check to make sure a seasonal schedule is specified if the season is not annual if (chargeSimple.season != seasonAnnual) { if (chargeSimple.tariffIndx != 0) { - if (state.dataEconTariff->tariff(chargeSimple.tariffIndx).seasonSchIndex == 0) { - ShowWarningError(state, - format("{}{}=\"{}\" invalid data", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("{}=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4))); + if (state.dataEconTariff->tariff(chargeSimple.tariffIndx).seasonSched == nullptr) { + ShowWarningError(state, format("{}{}=\"{}\" invalid data", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{}=\"{}\".", s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4))); ShowContinueError(state, " a Season other than Annual is used but no Season Schedule Name is specified in the UtilityCost:Tariff."); } } } // index of the category in the variable array - chargeSimple.categoryPt = AssignVariablePt( - state, state.dataIPShortCut->cAlphaArgs(5), true, varIsAssigned, varNotYetDefined, ObjType::Category, iInObj, chargeSimple.tariffIndx); + chargeSimple.categoryPt = + AssignVariablePt(state, s_ipsc->cAlphaArgs(5), true, varIsAssigned, varNotYetDefined, ObjType::Category, iInObj, chargeSimple.tariffIndx); // cost per unit value or variable - chargeSimple.costPerVal = Util::ProcessNumber(state.dataIPShortCut->cAlphaArgs(6), isNotNumeric); + chargeSimple.costPerVal = Util::ProcessNumber(s_ipsc->cAlphaArgs(6), isNotNumeric); chargeSimple.costPerPt = AssignVariablePt( - state, state.dataIPShortCut->cAlphaArgs(6), isNotNumeric, varIsArgument, varNotYetDefined, ObjType::Invalid, 0, chargeSimple.tariffIndx); + state, s_ipsc->cAlphaArgs(6), isNotNumeric, varIsArgument, varNotYetDefined, ObjType::Invalid, 0, chargeSimple.tariffIndx); } } @@ -853,93 +816,86 @@ void GetInputEconomicsChargeBlock(EnergyPlusData &state, bool &ErrorsFound) // t int NumNums; // Number of elements in the numeric array int IOStat; // IO Status when calling get input subroutine bool isNotNumeric; - int alphaOffset; // offset used in blocks for alpha array - Real64 hugeNumber(0.0); // Autodesk Value not used but suppresses warning about HUGE_() call - std::string CurrentModuleObject; // for ease in renaming. + int alphaOffset; // offset used in blocks for alpha array + Real64 hugeNumber(0.0); // Autodesk Value not used but suppresses warning about HUGE_() call + + auto &s_ipsc = state.dataIPShortCut; + s_ipsc->cCurrentModuleObject = "UtilityCost:Charge:Block"; - CurrentModuleObject = "UtilityCost:Charge:Block"; hugeNumber = HUGE_(hugeNumber); - state.dataEconTariff->numChargeBlock = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + state.dataEconTariff->numChargeBlock = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); state.dataEconTariff->chargeBlock.allocate(state.dataEconTariff->numChargeBlock); for (int iInObj = 1; iInObj <= state.dataEconTariff->numChargeBlock; ++iInObj) { auto &chargeBlock = state.dataEconTariff->chargeBlock(iInObj); state.dataInputProcessing->inputProcessor->getObjectItem(state, - CurrentModuleObject, + s_ipsc->cCurrentModuleObject, iInObj, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNums, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); // check to make sure none of the values are another economic object for (int jFld = 1; jFld <= NumAlphas; ++jFld) { - if (hasi(state.dataIPShortCut->cAlphaArgs(jFld), "UtilityCost:")) { - ShowWarningError(state, format("{}{}=\"{}\".", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + if (hasi(s_ipsc->cAlphaArgs(jFld), "UtilityCost:")) { + ShowWarningError(state, format("{}{}=\"{}\".", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "... a field was found containing UtilityCost: which may indicate a missing comma."); } } // index of the tariff name in the tariff array - chargeBlock.tariffIndx = - FindTariffIndex(state, state.dataIPShortCut->cAlphaArgs(2), state.dataIPShortCut->cAlphaArgs(1), ErrorsFound, CurrentModuleObject); - warnIfNativeVarname(state, state.dataIPShortCut->cAlphaArgs(1), chargeBlock.tariffIndx, ErrorsFound, CurrentModuleObject); + chargeBlock.tariffIndx = FindTariffIndex(state, s_ipsc->cAlphaArgs(2), s_ipsc->cAlphaArgs(1), ErrorsFound, s_ipsc->cCurrentModuleObject); + warnIfNativeVarname(state, s_ipsc->cAlphaArgs(1), chargeBlock.tariffIndx, ErrorsFound, s_ipsc->cCurrentModuleObject); chargeBlock.namePt = AssignVariablePt( - state, state.dataIPShortCut->cAlphaArgs(1), true, varIsAssigned, varNotYetDefined, ObjType::ChargeBlock, iInObj, chargeBlock.tariffIndx); + state, s_ipsc->cAlphaArgs(1), true, varIsAssigned, varNotYetDefined, ObjType::ChargeBlock, iInObj, chargeBlock.tariffIndx); // index of the variable in the variable array - chargeBlock.sourcePt = AssignVariablePt( - state, state.dataIPShortCut->cAlphaArgs(3), true, varIsArgument, varNotYetDefined, ObjType::Invalid, 0, chargeBlock.tariffIndx); + chargeBlock.sourcePt = + AssignVariablePt(state, s_ipsc->cAlphaArgs(3), true, varIsArgument, varNotYetDefined, ObjType::Invalid, 0, chargeBlock.tariffIndx); // enumerated list of the kind of season - chargeBlock.season = LookUpSeason(state, state.dataIPShortCut->cAlphaArgs(4), state.dataIPShortCut->cAlphaArgs(1)); + chargeBlock.season = LookUpSeason(state, s_ipsc->cAlphaArgs(4), s_ipsc->cAlphaArgs(1)); // check to make sure a seasonal schedule is specified if the season is not annual if (chargeBlock.season != seasonAnnual) { if (chargeBlock.tariffIndx != 0) { - if (state.dataEconTariff->tariff(chargeBlock.tariffIndx).seasonSchIndex == 0) { - ShowWarningError(state, - format("{}{}=\"{}\" invalid data", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("{}=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4))); + if (state.dataEconTariff->tariff(chargeBlock.tariffIndx).seasonSched == nullptr) { + ShowWarningError(state, format("{}{}=\"{}\" invalid data", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{}=\"{}\".", s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4))); ShowContinueError(state, " a Season other than Annual is used but no Season Schedule Name is specified in the UtilityCost:Tariff."); } } } // index of the category in the variable array - chargeBlock.categoryPt = AssignVariablePt( - state, state.dataIPShortCut->cAlphaArgs(5), true, varIsAssigned, varNotYetDefined, ObjType::Category, iInObj, chargeBlock.tariffIndx); + chargeBlock.categoryPt = + AssignVariablePt(state, s_ipsc->cAlphaArgs(5), true, varIsAssigned, varNotYetDefined, ObjType::Category, iInObj, chargeBlock.tariffIndx); // index of the remaining into variable in the variable array - chargeBlock.remainingPt = AssignVariablePt( - state, state.dataIPShortCut->cAlphaArgs(6), true, varIsAssigned, varNotYetDefined, ObjType::Category, iInObj, chargeBlock.tariffIndx); + chargeBlock.remainingPt = + AssignVariablePt(state, s_ipsc->cAlphaArgs(6), true, varIsAssigned, varNotYetDefined, ObjType::Category, iInObj, chargeBlock.tariffIndx); // block size multiplier - if (len(state.dataIPShortCut->cAlphaArgs(7)) == 0) { // if blank - chargeBlock.blkSzMultVal = 1.0; // default is 1 if left blank + if (len(s_ipsc->cAlphaArgs(7)) == 0) { // if blank + chargeBlock.blkSzMultVal = 1.0; // default is 1 if left blank chargeBlock.blkSzMultPt = 0; } else { - chargeBlock.blkSzMultVal = Util::ProcessNumber(state.dataIPShortCut->cAlphaArgs(7), isNotNumeric); - chargeBlock.blkSzMultPt = AssignVariablePt(state, - state.dataIPShortCut->cAlphaArgs(7), - isNotNumeric, - varIsArgument, - varNotYetDefined, - ObjType::Invalid, - 0, - chargeBlock.tariffIndx); + chargeBlock.blkSzMultVal = Util::ProcessNumber(s_ipsc->cAlphaArgs(7), isNotNumeric); + chargeBlock.blkSzMultPt = AssignVariablePt( + state, s_ipsc->cAlphaArgs(7), isNotNumeric, varIsArgument, varNotYetDefined, ObjType::Invalid, 0, chargeBlock.tariffIndx); } // number of blocks used chargeBlock.numBlk = (NumAlphas - 7) / 2; for (int jBlk = 1; jBlk <= chargeBlock.numBlk; ++jBlk) { alphaOffset = 7 + (jBlk - 1) * 2; // catch the "remaining" code word for the block size - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(alphaOffset + 1), "REMAINING")) { + if (Util::SameString(s_ipsc->cAlphaArgs(alphaOffset + 1), "REMAINING")) { chargeBlock.blkSzVal(jBlk) = hugeNumber / 1000000; // using small portion of largest possible value to prevent overflow chargeBlock.blkSzPt(jBlk) = 0; } else { // array of block size - chargeBlock.blkSzVal(jBlk) = Util::ProcessNumber(state.dataIPShortCut->cAlphaArgs(alphaOffset + 1), isNotNumeric); + chargeBlock.blkSzVal(jBlk) = Util::ProcessNumber(s_ipsc->cAlphaArgs(alphaOffset + 1), isNotNumeric); chargeBlock.blkSzPt(jBlk) = AssignVariablePt(state, - state.dataIPShortCut->cAlphaArgs(alphaOffset + 1), + s_ipsc->cAlphaArgs(alphaOffset + 1), isNotNumeric, varIsArgument, varNotYetDefined, @@ -948,9 +904,9 @@ void GetInputEconomicsChargeBlock(EnergyPlusData &state, bool &ErrorsFound) // t chargeBlock.tariffIndx); } // array of block cost - chargeBlock.blkCostVal(jBlk) = Util::ProcessNumber(state.dataIPShortCut->cAlphaArgs(alphaOffset + 2), isNotNumeric); + chargeBlock.blkCostVal(jBlk) = Util::ProcessNumber(s_ipsc->cAlphaArgs(alphaOffset + 2), isNotNumeric); chargeBlock.blkCostPt(jBlk) = AssignVariablePt(state, - state.dataIPShortCut->cAlphaArgs(alphaOffset + 2), + s_ipsc->cAlphaArgs(alphaOffset + 2), isNotNumeric, varIsArgument, varNotYetDefined, @@ -969,59 +925,61 @@ void GetInputEconomicsRatchet(EnergyPlusData &state, bool &ErrorsFound) // true // Read the input file for "Economics:Ratchet" objects. static constexpr std::string_view RoutineName("GetInputEconomicsRatchet: "); + int NumAlphas; // Number of elements in the alpha array int NumNums; // Number of elements in the numeric array int IOStat; // IO Status when calling get input subroutine bool isNotNumeric; - std::string CurrentModuleObject = "UtilityCost:Ratchet"; - state.dataEconTariff->numRatchet = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + auto &s_ipsc = state.dataIPShortCut; + s_ipsc->cCurrentModuleObject = "UtilityCost:Ratchet"; + + state.dataEconTariff->numRatchet = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); state.dataEconTariff->ratchet.allocate(state.dataEconTariff->numRatchet); for (int iInObj = 1; iInObj <= state.dataEconTariff->numRatchet; ++iInObj) { auto &ratchet = state.dataEconTariff->ratchet(iInObj); state.dataInputProcessing->inputProcessor->getObjectItem(state, - CurrentModuleObject, + s_ipsc->cCurrentModuleObject, iInObj, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNums, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); // check to make sure none of the values are another economic object for (int jFld = 1; jFld <= NumAlphas; ++jFld) { - if (hasi(state.dataIPShortCut->cAlphaArgs(jFld), "UtilityCost:")) { - ShowWarningError(state, format("{}{}=\"{}\".", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + if (hasi(s_ipsc->cAlphaArgs(jFld), "UtilityCost:")) { + ShowWarningError(state, format("{}{}=\"{}\".", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "... a field was found containing UtilityCost: which may indicate a missing comma."); } } // index of the tariff name in the tariff array - ratchet.tariffIndx = - FindTariffIndex(state, state.dataIPShortCut->cAlphaArgs(2), state.dataIPShortCut->cAlphaArgs(1), ErrorsFound, CurrentModuleObject); - warnIfNativeVarname(state, state.dataIPShortCut->cAlphaArgs(1), ratchet.tariffIndx, ErrorsFound, CurrentModuleObject); - ratchet.namePt = AssignVariablePt( - state, state.dataIPShortCut->cAlphaArgs(1), true, varIsAssigned, varNotYetDefined, ObjType::Ratchet, iInObj, ratchet.tariffIndx); + ratchet.tariffIndx = FindTariffIndex(state, s_ipsc->cAlphaArgs(2), s_ipsc->cAlphaArgs(1), ErrorsFound, s_ipsc->cCurrentModuleObject); + warnIfNativeVarname(state, s_ipsc->cAlphaArgs(1), ratchet.tariffIndx, ErrorsFound, s_ipsc->cCurrentModuleObject); + ratchet.namePt = + AssignVariablePt(state, s_ipsc->cAlphaArgs(1), true, varIsAssigned, varNotYetDefined, ObjType::Ratchet, iInObj, ratchet.tariffIndx); // index of the variable in the variable array - ratchet.baselinePt = AssignVariablePt( - state, state.dataIPShortCut->cAlphaArgs(3), true, varIsArgument, varNotYetDefined, ObjType::Ratchet, iInObj, ratchet.tariffIndx); + ratchet.baselinePt = + AssignVariablePt(state, s_ipsc->cAlphaArgs(3), true, varIsArgument, varNotYetDefined, ObjType::Ratchet, iInObj, ratchet.tariffIndx); // index of the variable in the variable array - ratchet.adjustmentPt = AssignVariablePt( - state, state.dataIPShortCut->cAlphaArgs(4), true, varIsArgument, varNotYetDefined, ObjType::Ratchet, iInObj, ratchet.tariffIndx); + ratchet.adjustmentPt = + AssignVariablePt(state, s_ipsc->cAlphaArgs(4), true, varIsArgument, varNotYetDefined, ObjType::Ratchet, iInObj, ratchet.tariffIndx); // seasons to and from - ratchet.seasonFrom = LookUpSeason(state, state.dataIPShortCut->cAlphaArgs(5), state.dataIPShortCut->cAlphaArgs(1)); - ratchet.seasonTo = LookUpSeason(state, state.dataIPShortCut->cAlphaArgs(6), state.dataIPShortCut->cAlphaArgs(1)); + ratchet.seasonFrom = LookUpSeason(state, s_ipsc->cAlphaArgs(5), s_ipsc->cAlphaArgs(1)); + ratchet.seasonTo = LookUpSeason(state, s_ipsc->cAlphaArgs(6), s_ipsc->cAlphaArgs(1)); // ratchet multiplier - ratchet.multiplierVal = Util::ProcessNumber(state.dataIPShortCut->cAlphaArgs(7), isNotNumeric); - ratchet.multiplierPt = AssignVariablePt( - state, state.dataIPShortCut->cAlphaArgs(7), isNotNumeric, varIsArgument, varNotYetDefined, ObjType::Invalid, 0, ratchet.tariffIndx); + ratchet.multiplierVal = Util::ProcessNumber(s_ipsc->cAlphaArgs(7), isNotNumeric); + ratchet.multiplierPt = + AssignVariablePt(state, s_ipsc->cAlphaArgs(7), isNotNumeric, varIsArgument, varNotYetDefined, ObjType::Invalid, 0, ratchet.tariffIndx); // ratchet offset - ratchet.offsetVal = Util::ProcessNumber(state.dataIPShortCut->cAlphaArgs(8), isNotNumeric); - ratchet.offsetPt = AssignVariablePt( - state, state.dataIPShortCut->cAlphaArgs(8), isNotNumeric, varIsArgument, varNotYetDefined, ObjType::Invalid, 0, ratchet.tariffIndx); + ratchet.offsetVal = Util::ProcessNumber(s_ipsc->cAlphaArgs(8), isNotNumeric); + ratchet.offsetPt = + AssignVariablePt(state, s_ipsc->cAlphaArgs(8), isNotNumeric, varIsArgument, varNotYetDefined, ObjType::Invalid, 0, ratchet.tariffIndx); } } @@ -1038,58 +996,58 @@ void GetInputEconomicsVariable(EnergyPlusData &state, bool &ErrorsFound) // true int NumNums; // Number of elements in the numeric array int IOStat; // IO Status when calling get input subroutine - std::string CurrentModuleObject = "UtilityCost:Variable"; - int numEconVarObj = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + auto &s_ipsc = state.dataIPShortCut; + + s_ipsc->cCurrentModuleObject = "UtilityCost:Variable"; + int numEconVarObj = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); for (int iInObj = 1; iInObj <= numEconVarObj; ++iInObj) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - CurrentModuleObject, + s_ipsc->cCurrentModuleObject, iInObj, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNums, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); // check to make sure none of the values are another economic object for (int jFld = 1; jFld <= NumAlphas; ++jFld) { - if (hasi(state.dataIPShortCut->cAlphaArgs(jFld), "UtilityCost:")) { - ShowWarningError(state, format("{}{}=\"{}\".", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + if (hasi(s_ipsc->cAlphaArgs(jFld), "UtilityCost:")) { + ShowWarningError(state, format("{}{}=\"{}\".", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "... a field was found containing UtilityCost: which may indicate a missing comma."); } } - int tariffPt = - FindTariffIndex(state, state.dataIPShortCut->cAlphaArgs(2), state.dataIPShortCut->cAlphaArgs(1), ErrorsFound, CurrentModuleObject); - int variablePt = - AssignVariablePt(state, state.dataIPShortCut->cAlphaArgs(1), true, varIsArgument, varUserDefined, ObjType::Variable, iInObj, tariffPt); - warnIfNativeVarname(state, state.dataIPShortCut->cAlphaArgs(1), tariffPt, ErrorsFound, CurrentModuleObject); + int tariffPt = FindTariffIndex(state, s_ipsc->cAlphaArgs(2), s_ipsc->cAlphaArgs(1), ErrorsFound, s_ipsc->cCurrentModuleObject); + int variablePt = AssignVariablePt(state, s_ipsc->cAlphaArgs(1), true, varIsArgument, varUserDefined, ObjType::Variable, iInObj, tariffPt); + warnIfNativeVarname(state, s_ipsc->cAlphaArgs(1), tariffPt, ErrorsFound, s_ipsc->cCurrentModuleObject); auto &econVar = state.dataEconTariff->econVar(variablePt); // validate the kind of variable - not used internally except for validation - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "ENERGY")) { + if (Util::SameString(s_ipsc->cAlphaArgs(3), "ENERGY")) { econVar.varUnitType = varUnitTypeEnergy; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "DEMAND")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "DEMAND")) { econVar.varUnitType = varUnitTypeDemand; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "DIMENSIONLESS")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "DIMENSIONLESS")) { econVar.varUnitType = varUnitTypeDimensionless; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "CURRENCY")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "CURRENCY")) { econVar.varUnitType = varUnitTypeCurrency; } else { econVar.varUnitType = varUnitTypeDimensionless; - ShowSevereError(state, format("{}{}=\"{}\" invalid data", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("invalid {}=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3))); + ShowSevereError(state, format("{}{}=\"{}\" invalid data", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("invalid {}=\"{}\".", s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3))); ErrorsFound = true; } // move number inputs into econVar for (int jVal = 1; jVal <= NumNums; ++jVal) { - econVar.values(jVal) = state.dataIPShortCut->rNumericArgs(jVal); + econVar.values(jVal) = s_ipsc->rNumericArgs(jVal); } // fill the rest of the array with the last value entered if (NumNums < MaxNumMonths) { for (int jVal = NumNums + 1; jVal <= MaxNumMonths; ++jVal) { - econVar.values(jVal) = state.dataIPShortCut->rNumericArgs(NumNums); + econVar.values(jVal) = s_ipsc->rNumericArgs(NumNums); } } } @@ -1109,8 +1067,10 @@ void GetInputEconomicsComputation(EnergyPlusData &state, bool &ErrorsFound) // t int NumNums; // Number of elements in the numeric array int IOStat; // IO Status when calling get input subroutine - std::string CurrentModuleObject = "UtilityCost:Computation"; - state.dataEconTariff->numComputation = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + auto &s_ipsc = state.dataIPShortCut; + + s_ipsc->cCurrentModuleObject = "UtilityCost:Computation"; + state.dataEconTariff->numComputation = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); state.dataEconTariff->computation.allocate(state.dataEconTariff->numTariff); // not the number of Computations but the number of tariffs // set default values for computation for (auto &e : state.dataEconTariff->computation) { @@ -1121,36 +1081,35 @@ void GetInputEconomicsComputation(EnergyPlusData &state, bool &ErrorsFound) // t } for (int iInObj = 1; iInObj <= state.dataEconTariff->numComputation; ++iInObj) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - CurrentModuleObject, + s_ipsc->cCurrentModuleObject, iInObj, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNums, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); // check to make sure none of the values are another economic object for (int jFld = 1; jFld <= NumAlphas; ++jFld) { - if (hasi(state.dataIPShortCut->cAlphaArgs(jFld), "UtilityCost:")) { - ShowWarningError(state, format("{}{}=\"{}\".", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + if (hasi(s_ipsc->cAlphaArgs(jFld), "UtilityCost:")) { + ShowWarningError(state, format("{}{}=\"{}\".", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "... a field was found containing UtilityCost: which may indicate a missing comma."); } } - int tariffPt = - FindTariffIndex(state, state.dataIPShortCut->cAlphaArgs(2), state.dataIPShortCut->cAlphaArgs(1), ErrorsFound, CurrentModuleObject); - warnIfNativeVarname(state, state.dataIPShortCut->cAlphaArgs(1), tariffPt, ErrorsFound, CurrentModuleObject); + int tariffPt = FindTariffIndex(state, s_ipsc->cAlphaArgs(2), s_ipsc->cAlphaArgs(1), ErrorsFound, s_ipsc->cCurrentModuleObject); + warnIfNativeVarname(state, s_ipsc->cAlphaArgs(1), tariffPt, ErrorsFound, s_ipsc->cCurrentModuleObject); // tariff and computation share the same index, the tariff index // so all references are to the tariffPt auto &computation = state.dataEconTariff->computation(tariffPt); if (isWithinRange(state, tariffPt, 1, state.dataEconTariff->numTariff)) { - computation.computeName = state.dataIPShortCut->cAlphaArgs(1); + computation.computeName = s_ipsc->cAlphaArgs(1); computation.firstStep = state.dataEconTariff->numSteps + 1; for (int jLine = 3; jLine <= NumAlphas; ++jLine) { - parseComputeLine(state, state.dataIPShortCut->cAlphaArgs(jLine), tariffPt); + parseComputeLine(state, s_ipsc->cAlphaArgs(jLine), tariffPt); } computation.lastStep = state.dataEconTariff->numSteps; // check to make sure that some steps were defined @@ -1158,16 +1117,15 @@ void GetInputEconomicsComputation(EnergyPlusData &state, bool &ErrorsFound) // t computation.firstStep = 0; computation.lastStep = -1; computation.isUserDef = false; - ShowSevereError(state, format("{}{}=\"{}\" invalid data.", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereError(state, format("{}{}=\"{}\" invalid data.", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ShowContinueError(state, "... No lines in the computation can be interpreted "); ErrorsFound = true; } else { computation.isUserDef = true; } } else { - ShowSevereError(state, format("{}{}=\"{}\" invalid data.", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, - format("... not found {}=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); + ShowSevereError(state, format("{}{}=\"{}\" invalid data.", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("... not found {}=\"{}\".", s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } } @@ -1181,7 +1139,6 @@ void GetInputEconomicsCurrencyType(EnergyPlusData &state, bool &ErrorsFound) // // Sets the type of currency (U.S. Dollar, Euro, Yen, etc.. ) // This is a "unique" object. - std::string const CurrentModuleObject("CurrencyType"); static constexpr std::string_view RoutineName("GetInputEconomicsCurrencyType: "); int NumCurrencyType; @@ -1190,38 +1147,42 @@ void GetInputEconomicsCurrencyType(EnergyPlusData &state, bool &ErrorsFound) // int IOStat; // IO Status when calling get input subroutine int i; + auto &s_ipsc = state.dataIPShortCut; + s_ipsc->cCurrentModuleObject = "CurrencyType"; + initializeMonetaryUnit(state); - NumCurrencyType = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + NumCurrencyType = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); state.dataCostEstimateManager->selectedMonetaryUnit = 0; // invalid if (NumCurrencyType == 0) { state.dataCostEstimateManager->selectedMonetaryUnit = 1; // USD - U.S. Dollar } else if (NumCurrencyType == 1) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - CurrentModuleObject, + s_ipsc->cCurrentModuleObject, 1, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNums, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); // Monetary Unit for (i = 1; i <= (int)state.dataCostEstimateManager->monetaryUnit.size(); ++i) { - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(1), state.dataCostEstimateManager->monetaryUnit(i).code)) { + if (Util::SameString(s_ipsc->cAlphaArgs(1), state.dataCostEstimateManager->monetaryUnit(i).code)) { state.dataCostEstimateManager->selectedMonetaryUnit = i; break; } } if (state.dataCostEstimateManager->selectedMonetaryUnit == 0) { - ShowSevereError(state, format("{}{}=\"{}\" invalid data.", RoutineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("... invalid {}.", state.dataIPShortCut->cAlphaFieldNames(1))); + ShowSevereError(state, format("{}{}=\"{}\" invalid data.", RoutineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("... invalid {}.", s_ipsc->cAlphaFieldNames(1))); ErrorsFound = true; } } else if (NumCurrencyType > 1) { - ShowWarningError(state, format("{}{} Only one instance of this object is allowed. USD will be used.", RoutineName, CurrentModuleObject)); + ShowWarningError(state, + format("{}{} Only one instance of this object is allowed. USD will be used.", RoutineName, s_ipsc->cCurrentModuleObject)); state.dataCostEstimateManager->selectedMonetaryUnit = 1; // USD - U.S. Dollar } } @@ -1275,7 +1236,7 @@ void GetLastWord(std::string const &lineOfText, std::string::size_type &endOfSca // Returns the last substring of the line of text to the // left of the endOfSubStrg pointer. A substring is - // delimitted by spaces. Quotes are not significant + // delimited by spaces. Quotes are not significant // (they are treated just like any other non-space character) // Scan the string from the end. @@ -2210,7 +2171,7 @@ void CreateDefaultComputation(EnergyPlusData &state) // into categories. // category SUM chg1Name chg2Name chg3Name // Since the dependency array has one target and multiple - // parameters, remainingPt is shown as a seperate equation that + // parameters, remainingPt is shown as a separate equation that // depends on namePt for Charge:Block. The equation will not be // displayed or processed except in the sort. // remainingPt NOOP namePt @@ -2219,21 +2180,21 @@ void CreateDefaultComputation(EnergyPlusData &state) // charge, ratchet or qualify. // chg1Name // It is also possible that two variables referenced within one - // object could include a dependancy relationship also. For + // object could include a dependency relationship also. For // example, the blkSzPt could be calculated using the same sourePt // in Charge:Block. // METHODOLOGY EMPLOYED: // Since some ECONOMCIS:* objects depend on other variables // first must create the order of when to perform the - // computations. First a dependancy table is created that - // indicates what variables are dependant on other variables. + // computations. First a dependency table is created that + // indicates what variables are dependent on other variables. // A directed acyclic graph (DAG) describes the general // problem which is usually solved using a topological // sorting algorithm. // Each line/step is generated and put into the depend // array. Also in the array are counts of how many items it - // depends on and a list of entries that are dependant on that + // depends on and a list of entries that are dependent on that // line. // for each tariff that does not have a UtilityCost:Computation object go through the variables @@ -2251,7 +2212,7 @@ void CreateDefaultComputation(EnergyPlusData &state) } //"clear" the dependOn array state.dataEconTariff->numOperand = 0; - // Define the preset equations (category sumation) + // Define the preset equations (category summation) int curTotal = tariff.ptTotal; int curSubtotal = tariff.ptSubtotal; int curBasis = tariff.ptBasis; @@ -2280,11 +2241,11 @@ void CreateDefaultComputation(EnergyPlusData &state) addChargesToOperand(state, iTariff, tariff.ptSurcharge); addChargesToOperand(state, iTariff, tariff.ptTaxes); // add the real time pricing to the energy charges - if (tariff.chargeSchIndex != 0) { + if (tariff.chargeSched != nullptr) { addOperand(state, tariff.ptEnergyCharges, tariff.nativeRealTimePriceCosts); } // now add equations with NOOP to represent each object with its - // dependancies + // dependencies // Qualify for (int kObj = 1; kObj <= state.dataEconTariff->numQualify; ++kObj) { auto const &qualify = state.dataEconTariff->qualify(kObj); @@ -2351,7 +2312,7 @@ void CreateDefaultComputation(EnergyPlusData &state) } } } - // make sure no compuation is already user defined + // make sure no computation is already user defined if (computation.firstStep != 0) { ShowWarningError(state, format("In UtilityCost:Tariff: Overwriting user defined tariff {}", tariff.tariffName)); } @@ -2361,13 +2322,13 @@ void CreateDefaultComputation(EnergyPlusData &state) computation.lastStep = -1; // this will be incremented by addStep computation.isUserDef = false; // now all "equations" are defined, treat the variables with the list - // of dependancies as a directed acyclic graph and use "count down" algorithm + // of dependencies as a directed acyclic graph and use "count down" algorithm // to do a topological sort of the variables into the order for computation // First, clear the counters for (int jVar = 1; jVar <= state.dataEconTariff->numEconVar; ++jVar) { state.dataEconTariff->econVar(jVar).cntMeDependOn = 0; } - // Second, add up the number of dependancies on each variable + // Second, add up the number of dependencies on each variable for (int iVar = 1; iVar <= state.dataEconTariff->numEconVar; ++iVar) { if (state.dataEconTariff->econVar(iVar).activeNow) { if (state.dataEconTariff->econVar(iVar).lastOperand >= state.dataEconTariff->econVar(iVar).firstOperand) { @@ -2384,7 +2345,7 @@ void CreateDefaultComputation(EnergyPlusData &state) numNoDepend = 0; for (int iVar = 1; iVar <= state.dataEconTariff->numEconVar; ++iVar) { if (state.dataEconTariff->econVar(iVar).activeNow) { - // find a variable that has no more dangling dependancies + // find a variable that has no more dangling dependencies if (state.dataEconTariff->econVar(iVar).cntMeDependOn == 0) { // If the variable is a native variable then // IF (econVar(iVar)%kindOfObj .NE. iEconVarObjType::Native) THEN @@ -2437,7 +2398,7 @@ void CreateDefaultComputation(EnergyPlusData &state) } if (loopCount > 100000) { ShowWarningError(state, - format("UtilityCost:Tariff: Loop count exceeded when counting dependancies in tariff: {}", tariff.tariffName)); + format("UtilityCost:Tariff: Loop count exceeded when counting dependencies in tariff: {}", tariff.tariffName)); } // make sure that all variables associated with the tariff are included bool remainingVarFlag = false; @@ -2450,7 +2411,7 @@ void CreateDefaultComputation(EnergyPlusData &state) ShowWarningError(state, format("CreateDefaultComputation: In UtilityCost:Computation: Circular or invalid dependencies found in tariff: {}", tariff.tariffName)); - ShowContinueError(state, " UtilityCost variables that may have invalid dependencies and the variables they are dependant on."); + ShowContinueError(state, " UtilityCost variables that may have invalid dependencies and the variables they are dependent on."); for (int iVar = 1; iVar <= state.dataEconTariff->numEconVar; ++iVar) { if (state.dataEconTariff->econVar(iVar).tariffIndx == iTariff) { if (state.dataEconTariff->econVar(iVar).activeNow) { @@ -2484,7 +2445,7 @@ void addOperand(EnergyPlusData &state, int const varMe, int const varOperand) // AUTHOR Jason Glazer of GARD Analytics, Inc. // DATE WRITTEN July 2004 - // Used by CreateDefaultComputation to create the dependancy + // Used by CreateDefaultComputation to create the dependency // relationship in the EconVar array int constexpr sizeIncrement(100); @@ -2586,36 +2547,22 @@ void GatherForEconomics(EnergyPlusData &state) tariff.collectEnergy += curInstantValue; tariff.collectTime += state.dataGlobal->TimeStepZoneSec; // added *SecInHour when adding RTP support August 2008 - if (tariff.collectTime >= tariff.demWinTime * Constant::SecInHour) { - int curSeason; - int curMonth; - int curPeriod; + if (tariff.collectTime >= tariff.demWinTime * Constant::rSecsInHour) { // get current value that has been converted into desired units curDemand = tariff.demandConv * tariff.collectEnergy / tariff.collectTime; curEnergy = tariff.energyConv * tariff.collectEnergy; // get the schedule values // remember no confirmation of schedule values occurs prior to now - if (tariff.seasonSchIndex != 0) { - curSeason = ScheduleManager::GetCurrentScheduleValue(state, tariff.seasonSchIndex); - } else { - curSeason = 1; - } - if (tariff.periodSchIndex != 0) { - curPeriod = ScheduleManager::GetCurrentScheduleValue(state, tariff.periodSchIndex); - } else { - curPeriod = 1; - } - if (tariff.monthSchIndex != 0) { - curMonth = ScheduleManager::GetCurrentScheduleValue(state, tariff.monthSchIndex); - } else { - // #7814 - Have to be careful with DST. tariff::seasonForMonth is overwritten at each timestep, and only the last value is - // retained, so make sure to capture the right one - if ((state.dataGlobal->HourOfDay + state.dataEnvrn->DSTIndicator) <= 24) { - curMonth = state.dataEnvrn->Month; - } else { - curMonth = state.dataEnvrn->MonthTomorrow; - } - } + int curSeason = (tariff.seasonSched != nullptr) ? tariff.seasonSched->getCurrentVal() : 1; + int curPeriod = (tariff.periodSched != nullptr) ? tariff.periodSched->getCurrentVal() : 1; + + int curMonth = + (tariff.monthSched != nullptr) ? tariff.monthSched->getCurrentVal() : + // #7814 - Have to be careful with DST. tariff::seasonForMonth is overwritten at each timestep, and + // only the last value is retained, so make sure to capture the right one + (((state.dataGlobal->HourOfDay + state.dataEnvrn->DSTIndicator) <= Constant::iHoursInDay) ? state.dataEnvrn->Month + : state.dataEnvrn->MonthTomorrow); + bool isGood = false; if (isWithinRange(state, curSeason, 1, 5)) { if (isWithinRange(state, curPeriod, 1, 4)) { @@ -2635,12 +2582,12 @@ void GatherForEconomics(EnergyPlusData &state) ShowContinueError(state, "Invalid schedule values - outside of range"); } // Real Time Pricing - if (tariff.chargeSchIndex != 0) { - curRTPprice = ScheduleManager::GetCurrentScheduleValue(state, tariff.chargeSchIndex); + if (tariff.chargeSched != nullptr) { + curRTPprice = tariff.chargeSched->getCurrentVal(); // if customer baseline load schedule is used, subtract that off of the // current energy - if (tariff.baseUseSchIndex != 0) { - curRTPbaseline = ScheduleManager::GetCurrentScheduleValue(state, tariff.baseUseSchIndex); + if (tariff.baseUseSched != nullptr) { + curRTPbaseline = tariff.baseUseSched->getCurrentVal(); curRTPenergy = curEnergy - curRTPbaseline; } else { curRTPenergy = curEnergy; @@ -3148,7 +3095,7 @@ void pushStack(EnergyPlusData &state, Array1A const monthlyArray, int co } // if the serviceCharges are being evaluated add in the monthly charges if (econVar(variablePointer).specific == catServiceCharges) addMonthlyCharge(state, variablePointer); - // get the results of performing the evaulation - should have been + // get the results of performing the evaluation - should have been // put into the econVar values curMonthlyArray = econVar(variablePointer).values; } @@ -3298,7 +3245,7 @@ void evaluateChargeBlock(EnergyPlusData &state, int const usingVariable) } else { blkSzMult = chargeBlock.blkSzMultVal; } - // initially set the remaing energy or demand to the source + // initially set the remaining energy or demand to the source remainVals = sourceVals; // initially set the result (cost) to zero resultChg = 0.0; @@ -3607,7 +3554,7 @@ void evaluateQualify(EnergyPlusData &state, int const usingVariable) } } // now update the tariff level qualifier - only update if the tariff is still qualified - // and the current qualifer fails. + // and the current qualifier fails. if (tariff.isQualified) { if (!isQualified) { tariff.isQualified = false; @@ -4743,7 +4690,7 @@ void selectTariff(EnergyPlusData &state) // DATE WRITTEN July 2004 // To select tariffs for each combination of meter and - // group. If multipler tariffs have the same meter and + // group. If multiple tariffs have the same meter and // group, then select the one with the lowest cost. // For electric tariffs, since they may have buy, sell, or // netmetering, they need to be combined more carefully. diff --git a/src/EnergyPlus/EconomicTariff.hh b/src/EnergyPlus/EconomicTariff.hh index e7f98d9ffcb..ab66e785cfe 100644 --- a/src/EnergyPlus/EconomicTariff.hh +++ b/src/EnergyPlus/EconomicTariff.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -57,6 +57,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -372,12 +373,9 @@ namespace EconomicTariff { EconConv convChoice; // enumerated choice index of the conversion factor Real64 energyConv; // energy conversion factor Real64 demandConv; // demand conversion factor - std::string periodSchedule; // name of the period schedule (time of day) - int periodSchIndex; // index to the period schedule - std::string seasonSchedule; // name of the season schedule (winter/summer) - int seasonSchIndex; // index to the season schedule - std::string monthSchedule; // name of month schedule (when months end) - int monthSchIndex; // index to the month schedule + Sched::Schedule *periodSched = nullptr; // period schedule + Sched::Schedule *seasonSched = nullptr; // season schedule + Sched::Schedule *monthSched = nullptr; // month schedule DemandWindow demandWindow; // enumerated list of the kind of demand window Real64 demWinTime; // length of time for the demand window Real64 monthChgVal; // monthly charge value @@ -386,13 +384,11 @@ namespace EconomicTariff { Real64 minMonthChgVal; // minimum monthly charge value int minMonthChgPt; // pointer to a variable that contains the minimum monthly charge // if 0 then use minMonthChgVal - std::string chargeSchedule; // name of the charge schedule (for real time pricing) - int chargeSchIndex; // index to the charge schedule - std::string baseUseSchedule; // name of the baseline use schedule (for real time pricing) - int baseUseSchIndex; // index to the baseline use schedule - std::string groupName; // name of the group - std::string monetaryUnit; // text string representing monetary unit, usually $ - int buyOrSell; // enumerated choice index of the buy or sell options + Sched::Schedule *chargeSched = nullptr; // index to the charge schedule + Sched::Schedule *baseUseSched = nullptr; // index to the baseline use schedule + std::string groupName; // name of the group + std::string monetaryUnit; // text string representing monetary unit, usually $ + int buyOrSell; // enumerated choice index of the buy or sell options // index to the first and last category variables int firstCategory; // first category referenced int lastCategory; // last category referenced @@ -472,22 +468,21 @@ namespace EconomicTariff { // Default Constructor TariffType() : reportMeterIndx(0), kindElectricMtr(0), kindWaterMtr(0), kindGasMtr(0), convChoice(EconConv::USERDEF), energyConv(0.0), demandConv(0.0), - periodSchIndex(0), seasonSchIndex(0), monthSchIndex(0), demandWindow(DemandWindow::Invalid), demWinTime(0.0), monthChgVal(0.0), - monthChgPt(0), minMonthChgVal(0.0), minMonthChgPt(0), chargeSchIndex(0), baseUseSchIndex(0), buyOrSell(0), firstCategory(0), - lastCategory(0), ptEnergyCharges(0), ptDemandCharges(0), ptServiceCharges(0), ptBasis(0), ptAdjustment(0), ptSurcharge(0), - ptSubtotal(0), ptTaxes(0), ptTotal(0), ptNotIncluded(0), firstNative(0), lastNative(0), nativeTotalEnergy(0), nativeTotalDemand(0), - nativePeakEnergy(0), nativePeakDemand(0), nativeShoulderEnergy(0), nativeShoulderDemand(0), nativeOffPeakEnergy(0), - nativeOffPeakDemand(0), nativeMidPeakEnergy(0), nativeMidPeakDemand(0), nativePeakExceedsOffPeak(0), nativeOffPeakExceedsPeak(0), - nativePeakExceedsMidPeak(0), nativeMidPeakExceedsPeak(0), nativePeakExceedsShoulder(0), nativeShoulderExceedsPeak(0), nativeIsWinter(0), - nativeIsNotWinter(0), nativeIsSpring(0), nativeIsNotSpring(0), nativeIsSummer(0), nativeIsNotSummer(0), nativeIsAutumn(0), - nativeIsNotAutumn(0), nativePeakAndShoulderEnergy(0), nativePeakAndShoulderDemand(0), nativePeakAndMidPeakEnergy(0), - nativePeakAndMidPeakDemand(0), nativeShoulderAndOffPeakEnergy(0), nativeShoulderAndOffPeakDemand(0), nativePeakAndOffPeakEnergy(0), - nativePeakAndOffPeakDemand(0), nativeRealTimePriceCosts(0), nativeAboveCustomerBaseCosts(0), nativeBelowCustomerBaseCosts(0), - nativeAboveCustomerBaseEnergy(0), nativeBelowCustomerBaseEnergy(0), gatherEnergy(MaxNumMonths, countPeriod, 0.0), - gatherDemand(MaxNumMonths, countPeriod, 0.0), collectTime(0.0), collectEnergy(0.0), RTPcost(MaxNumMonths, 0.0), - RTPaboveBaseCost(MaxNumMonths, 0.0), RTPbelowBaseCost(MaxNumMonths, 0.0), RTPaboveBaseEnergy(MaxNumMonths, 0.0), - RTPbelowBaseEnergy(MaxNumMonths, 0.0), seasonForMonth(MaxNumMonths, 0), isQualified(false), ptDisqualifier(0), isSelected(false), - totalAnnualCost(0.0), totalAnnualEnergy(0.0) + demandWindow(DemandWindow::Invalid), demWinTime(0.0), monthChgVal(0.0), monthChgPt(0), minMonthChgVal(0.0), minMonthChgPt(0), + buyOrSell(0), firstCategory(0), lastCategory(0), ptEnergyCharges(0), ptDemandCharges(0), ptServiceCharges(0), ptBasis(0), + ptAdjustment(0), ptSurcharge(0), ptSubtotal(0), ptTaxes(0), ptTotal(0), ptNotIncluded(0), firstNative(0), lastNative(0), + nativeTotalEnergy(0), nativeTotalDemand(0), nativePeakEnergy(0), nativePeakDemand(0), nativeShoulderEnergy(0), nativeShoulderDemand(0), + nativeOffPeakEnergy(0), nativeOffPeakDemand(0), nativeMidPeakEnergy(0), nativeMidPeakDemand(0), nativePeakExceedsOffPeak(0), + nativeOffPeakExceedsPeak(0), nativePeakExceedsMidPeak(0), nativeMidPeakExceedsPeak(0), nativePeakExceedsShoulder(0), + nativeShoulderExceedsPeak(0), nativeIsWinter(0), nativeIsNotWinter(0), nativeIsSpring(0), nativeIsNotSpring(0), nativeIsSummer(0), + nativeIsNotSummer(0), nativeIsAutumn(0), nativeIsNotAutumn(0), nativePeakAndShoulderEnergy(0), nativePeakAndShoulderDemand(0), + nativePeakAndMidPeakEnergy(0), nativePeakAndMidPeakDemand(0), nativeShoulderAndOffPeakEnergy(0), nativeShoulderAndOffPeakDemand(0), + nativePeakAndOffPeakEnergy(0), nativePeakAndOffPeakDemand(0), nativeRealTimePriceCosts(0), nativeAboveCustomerBaseCosts(0), + nativeBelowCustomerBaseCosts(0), nativeAboveCustomerBaseEnergy(0), nativeBelowCustomerBaseEnergy(0), + gatherEnergy(MaxNumMonths, countPeriod, 0.0), gatherDemand(MaxNumMonths, countPeriod, 0.0), collectTime(0.0), collectEnergy(0.0), + RTPcost(MaxNumMonths, 0.0), RTPaboveBaseCost(MaxNumMonths, 0.0), RTPbelowBaseCost(MaxNumMonths, 0.0), + RTPaboveBaseEnergy(MaxNumMonths, 0.0), RTPbelowBaseEnergy(MaxNumMonths, 0.0), seasonForMonth(MaxNumMonths, 0), isQualified(false), + ptDisqualifier(0), isSelected(false), totalAnnualCost(0.0), totalAnnualEnergy(0.0) { } }; @@ -778,6 +773,10 @@ struct EconomicTariffData : BaseGlobalStruct EPVector computation; Array1D stack; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ElectricBaseboardRadiator.cc b/src/EnergyPlus/ElectricBaseboardRadiator.cc index 7970a0034b9..2b4eea41196 100644 --- a/src/EnergyPlus/ElectricBaseboardRadiator.cc +++ b/src/EnergyPlus/ElectricBaseboardRadiator.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -84,7 +84,7 @@ namespace ElectricBaseboardRadiator { // PURPOSE OF THIS MODULE: // This module is to calculate the actual convective heat addition that an electrical baseboard heater - // deliveres to a space. + // delivers to a space. // METHODOLOGY EMPLOYED: // Based on the convective-only electric baseboard module (Object: ZoneHVAC:Baseboard:Convective:Electric) @@ -170,8 +170,10 @@ namespace ElectricBaseboardRadiator { // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetElectricBaseboardInput: "); // include trailing blank space - Real64 constexpr MaxFraction(1.0); // Maximum limit of fractional values - Real64 constexpr MinFraction(0.0); // Minimum limit of fractional values + static constexpr std::string_view routineName = "GetElectricBaseboardInput"; // include trailing blank space + + Real64 constexpr MaxFraction(1.0); // Maximum limit of fractional values + Real64 constexpr MinFraction(0.0); // Minimum limit of fractional values // INTEGER,PARAMETER :: MaxDistribSurfaces = 20 ! Maximum number of surfaces that a baseboard heater can radiate to int constexpr MinDistribSurfaces(1); // Minimum number of surfaces that a baseboard heater can radiate to int constexpr iHeatCAPMAlphaNum(3); // get input index to HW baseboard heating capacity sizing method @@ -185,13 +187,14 @@ namespace ElectricBaseboardRadiator { int NumNumbers; int IOStat; bool ErrorsFound(false); // If errors detected in input - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; - cCurrentModuleObject = state.dataElectBaseboardRad->cCMO_BBRadiator_Electric; + auto &s_ipsc = state.dataIPShortCut; + + s_ipsc->cCurrentModuleObject = state.dataElectBaseboardRad->cCMO_BBRadiator_Electric; // Update Num in state and make local convenience copy int NumElecBaseboards = state.dataElectBaseboardRad->NumElecBaseboards = - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); // object is extensible, no max args needed as IPShortCuts being used auto &ElecBaseboardNumericFields = state.dataElectBaseboardRad->ElecBaseboardNumericFields; @@ -203,138 +206,123 @@ namespace ElectricBaseboardRadiator { auto &elecBaseboard = state.dataElectBaseboardRad->ElecBaseboard(BaseboardNum); state.dataInputProcessing->inputProcessor->getObjectItem(state, - cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, BaseboardNum, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; ElecBaseboardNumericFields(BaseboardNum).FieldNames.allocate(NumNumbers); ElecBaseboardNumericFields(BaseboardNum).FieldNames = ""; - ElecBaseboardNumericFields(BaseboardNum).FieldNames = state.dataIPShortCut->cNumericFieldNames; + ElecBaseboardNumericFields(BaseboardNum).FieldNames = s_ipsc->cNumericFieldNames; // ErrorsFound will be set to True if problem was found, left untouched otherwise GlobalNames::VerifyUniqueBaseboardName( - state, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1), ErrorsFound, cCurrentModuleObject + " Name"); - - elecBaseboard.EquipName = state.dataIPShortCut->cAlphaArgs(1); // name of this baseboard - elecBaseboard.Schedule = state.dataIPShortCut->cAlphaArgs(2); - if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { - elecBaseboard.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - elecBaseboard.SchedPtr = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); - if (elecBaseboard.SchedPtr == 0) { - ShowSevereError(state, - std::string{RoutineName} + cCurrentModuleObject + ": invalid " + state.dataIPShortCut->cAlphaFieldNames(2) + - " entered =" + state.dataIPShortCut->cAlphaArgs(2) + " for " + state.dataIPShortCut->cAlphaFieldNames(1) + - '=' + state.dataIPShortCut->cAlphaArgs(1)); - ErrorsFound = true; - } + state, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1), ErrorsFound, s_ipsc->cCurrentModuleObject + " Name"); + + elecBaseboard.EquipName = s_ipsc->cAlphaArgs(1); // name of this baseboard + elecBaseboard.Schedule = s_ipsc->cAlphaArgs(2); + if (s_ipsc->lAlphaFieldBlanks(2)) { + elecBaseboard.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((elecBaseboard.availSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); + ErrorsFound = true; } // Determine HW radiant baseboard heating design capacity sizing method - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum), "HeatingDesignCapacity")) { + if (Util::SameString(s_ipsc->cAlphaArgs(iHeatCAPMAlphaNum), "HeatingDesignCapacity")) { elecBaseboard.HeatingCapMethod = DataSizing::HeatingDesignCapacity; - if (!state.dataIPShortCut->lNumericFieldBlanks(iHeatDesignCapacityNumericNum)) { - elecBaseboard.ScaledHeatingCapacity = state.dataIPShortCut->rNumericArgs(iHeatDesignCapacityNumericNum); + if (!s_ipsc->lNumericFieldBlanks(iHeatDesignCapacityNumericNum)) { + elecBaseboard.ScaledHeatingCapacity = s_ipsc->rNumericArgs(iHeatDesignCapacityNumericNum); if (elecBaseboard.ScaledHeatingCapacity < 0.0 && elecBaseboard.ScaledHeatingCapacity != DataSizing::AutoSize) { - ShowSevereError(state, cCurrentModuleObject + " = " + elecBaseboard.EquipName); + ShowSevereError(state, format("{} = {}", s_ipsc->cCurrentModuleObject, elecBaseboard.EquipName)); ShowContinueError(state, format("Illegal {} = {:.7T}", - state.dataIPShortCut->cNumericFieldNames(iHeatDesignCapacityNumericNum), - state.dataIPShortCut->rNumericArgs(iHeatDesignCapacityNumericNum))); + s_ipsc->cNumericFieldNames(iHeatDesignCapacityNumericNum), + s_ipsc->rNumericArgs(iHeatDesignCapacityNumericNum))); ErrorsFound = true; } } else { - ShowSevereError(state, cCurrentModuleObject + " = " + elecBaseboard.EquipName); - ShowContinueError(state, - "Input for " + state.dataIPShortCut->cAlphaFieldNames(iHeatCAPMAlphaNum) + " = " + - state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum)); + ShowSevereError(state, format("{} = {}", s_ipsc->cCurrentModuleObject, elecBaseboard.EquipName)); ShowContinueError(state, - "Blank field not allowed for " + state.dataIPShortCut->cNumericFieldNames(iHeatDesignCapacityNumericNum)); + "Input for " + s_ipsc->cAlphaFieldNames(iHeatCAPMAlphaNum) + " = " + s_ipsc->cAlphaArgs(iHeatCAPMAlphaNum)); + ShowContinueError(state, "Blank field not allowed for " + s_ipsc->cNumericFieldNames(iHeatDesignCapacityNumericNum)); ErrorsFound = true; } - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum), "CapacityPerFloorArea")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(iHeatCAPMAlphaNum), "CapacityPerFloorArea")) { elecBaseboard.HeatingCapMethod = DataSizing::CapacityPerFloorArea; - if (!state.dataIPShortCut->lNumericFieldBlanks(iHeatCapacityPerFloorAreaNumericNum)) { - elecBaseboard.ScaledHeatingCapacity = state.dataIPShortCut->rNumericArgs(iHeatCapacityPerFloorAreaNumericNum); + if (!s_ipsc->lNumericFieldBlanks(iHeatCapacityPerFloorAreaNumericNum)) { + elecBaseboard.ScaledHeatingCapacity = s_ipsc->rNumericArgs(iHeatCapacityPerFloorAreaNumericNum); if (elecBaseboard.ScaledHeatingCapacity <= 0.0) { - ShowSevereError(state, cCurrentModuleObject + " = " + elecBaseboard.EquipName); + ShowSevereError(state, format("{} = {}", s_ipsc->cCurrentModuleObject, elecBaseboard.EquipName)); ShowContinueError(state, - "Input for " + state.dataIPShortCut->cAlphaFieldNames(iHeatCAPMAlphaNum) + " = " + - state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum)); + "Input for " + s_ipsc->cAlphaFieldNames(iHeatCAPMAlphaNum) + " = " + s_ipsc->cAlphaArgs(iHeatCAPMAlphaNum)); ShowContinueError(state, format("Illegal {} = {:.7T}", - state.dataIPShortCut->cNumericFieldNames(iHeatCapacityPerFloorAreaNumericNum), - state.dataIPShortCut->rNumericArgs(iHeatCapacityPerFloorAreaNumericNum))); + s_ipsc->cNumericFieldNames(iHeatCapacityPerFloorAreaNumericNum), + s_ipsc->rNumericArgs(iHeatCapacityPerFloorAreaNumericNum))); ErrorsFound = true; } else if (elecBaseboard.ScaledHeatingCapacity == DataSizing::AutoSize) { - ShowSevereError(state, cCurrentModuleObject + " = " + elecBaseboard.EquipName); + ShowSevereError(state, format("{} = {}", s_ipsc->cCurrentModuleObject, elecBaseboard.EquipName)); ShowContinueError(state, - "Input for " + state.dataIPShortCut->cAlphaFieldNames(iHeatCAPMAlphaNum) + " = " + - state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum)); - ShowContinueError(state, - "Illegal " + state.dataIPShortCut->cNumericFieldNames(iHeatCapacityPerFloorAreaNumericNum) + " = Autosize"); + "Input for " + s_ipsc->cAlphaFieldNames(iHeatCAPMAlphaNum) + " = " + s_ipsc->cAlphaArgs(iHeatCAPMAlphaNum)); + ShowContinueError(state, "Illegal " + s_ipsc->cNumericFieldNames(iHeatCapacityPerFloorAreaNumericNum) + " = Autosize"); ErrorsFound = true; } } else { - ShowSevereError(state, cCurrentModuleObject + " = " + elecBaseboard.EquipName); - ShowContinueError(state, - "Input for " + state.dataIPShortCut->cAlphaFieldNames(iHeatCAPMAlphaNum) + " = " + - state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum)); + ShowSevereError(state, format(s_ipsc->cCurrentModuleObject, elecBaseboard.EquipName)); ShowContinueError(state, - "Blank field not allowed for " + state.dataIPShortCut->cNumericFieldNames(iHeatCapacityPerFloorAreaNumericNum)); + "Input for " + s_ipsc->cAlphaFieldNames(iHeatCAPMAlphaNum) + " = " + s_ipsc->cAlphaArgs(iHeatCAPMAlphaNum)); + ShowContinueError(state, "Blank field not allowed for " + s_ipsc->cNumericFieldNames(iHeatCapacityPerFloorAreaNumericNum)); ErrorsFound = true; } - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum), "FractionOfAutosizedHeatingCapacity")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(iHeatCAPMAlphaNum), "FractionOfAutosizedHeatingCapacity")) { elecBaseboard.HeatingCapMethod = DataSizing::FractionOfAutosizedHeatingCapacity; - if (!state.dataIPShortCut->lNumericFieldBlanks(iHeatFracOfAutosizedCapacityNumericNum)) { - elecBaseboard.ScaledHeatingCapacity = state.dataIPShortCut->rNumericArgs(iHeatFracOfAutosizedCapacityNumericNum); + if (!s_ipsc->lNumericFieldBlanks(iHeatFracOfAutosizedCapacityNumericNum)) { + elecBaseboard.ScaledHeatingCapacity = s_ipsc->rNumericArgs(iHeatFracOfAutosizedCapacityNumericNum); if (elecBaseboard.ScaledHeatingCapacity < 0.0) { - ShowSevereError(state, cCurrentModuleObject + " = " + elecBaseboard.EquipName); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + " = " + elecBaseboard.EquipName); ShowContinueError(state, format("Illegal {} = {:.7T}", - state.dataIPShortCut->cNumericFieldNames(iHeatFracOfAutosizedCapacityNumericNum), - state.dataIPShortCut->rNumericArgs(iHeatFracOfAutosizedCapacityNumericNum))); + s_ipsc->cNumericFieldNames(iHeatFracOfAutosizedCapacityNumericNum), + s_ipsc->rNumericArgs(iHeatFracOfAutosizedCapacityNumericNum))); ErrorsFound = true; } } else { - ShowSevereError(state, cCurrentModuleObject + " = " + elecBaseboard.EquipName); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + " = " + elecBaseboard.EquipName); ShowContinueError(state, - "Input for " + state.dataIPShortCut->cAlphaFieldNames(iHeatCAPMAlphaNum) + " = " + - state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum)); - ShowContinueError( - state, "Blank field not allowed for " + state.dataIPShortCut->cNumericFieldNames(iHeatFracOfAutosizedCapacityNumericNum)); + "Input for " + s_ipsc->cAlphaFieldNames(iHeatCAPMAlphaNum) + " = " + s_ipsc->cAlphaArgs(iHeatCAPMAlphaNum)); + ShowContinueError(state, "Blank field not allowed for " + s_ipsc->cNumericFieldNames(iHeatFracOfAutosizedCapacityNumericNum)); ErrorsFound = true; } } else { - ShowSevereError(state, cCurrentModuleObject + " = " + elecBaseboard.EquipName); - ShowContinueError(state, - "Illegal " + state.dataIPShortCut->cAlphaFieldNames(iHeatCAPMAlphaNum) + " = " + - state.dataIPShortCut->cAlphaArgs(iHeatCAPMAlphaNum)); + ShowSevereError(state, s_ipsc->cCurrentModuleObject + " = " + elecBaseboard.EquipName); + ShowContinueError(state, "Illegal " + s_ipsc->cAlphaFieldNames(iHeatCAPMAlphaNum) + " = " + s_ipsc->cAlphaArgs(iHeatCAPMAlphaNum)); ErrorsFound = true; } - elecBaseboard.BaseboardEfficiency = state.dataIPShortCut->rNumericArgs(4); - elecBaseboard.FracRadiant = state.dataIPShortCut->rNumericArgs(5); + elecBaseboard.BaseboardEfficiency = s_ipsc->rNumericArgs(4); + elecBaseboard.FracRadiant = s_ipsc->rNumericArgs(5); if (elecBaseboard.FracRadiant < MinFraction) { ShowWarningError(state, - std::string{RoutineName} + cCurrentModuleObject + "=\"" + state.dataIPShortCut->cAlphaArgs(1) + "\", " + - state.dataIPShortCut->cNumericFieldNames(5) + " was lower than the allowable minimum."); + std::string{RoutineName} + s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", " + + s_ipsc->cNumericFieldNames(5) + " was lower than the allowable minimum."); ShowContinueError(state, format("...reset to minimum value=[{:.2R}].", MinFraction)); elecBaseboard.FracRadiant = MinFraction; } if (elecBaseboard.FracRadiant > MaxFraction) { ShowWarningError(state, - std::string{RoutineName} + cCurrentModuleObject + "=\"" + state.dataIPShortCut->cAlphaArgs(1) + "\", " + - state.dataIPShortCut->cNumericFieldNames(5) + " was higher than the allowable maximum."); + std::string{RoutineName} + s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", " + + s_ipsc->cNumericFieldNames(5) + " was higher than the allowable maximum."); ShowContinueError(state, format("...reset to maximum value=[{:.2R}].", MaxFraction)); elecBaseboard.FracRadiant = MaxFraction; } @@ -342,7 +330,7 @@ namespace ElectricBaseboardRadiator { // Remaining fraction is added to the zone as convective heat transfer if (elecBaseboard.FracRadiant > MaxFraction) { ShowWarningError(state, - std::string{RoutineName} + cCurrentModuleObject + "=\"" + state.dataIPShortCut->cAlphaArgs(1) + + std::string{RoutineName} + s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Fraction Radiant was higher than the allowable maximum."); elecBaseboard.FracRadiant = MaxFraction; elecBaseboard.FracConvect = 0.0; @@ -350,18 +338,18 @@ namespace ElectricBaseboardRadiator { elecBaseboard.FracConvect = 1.0 - elecBaseboard.FracRadiant; } - elecBaseboard.FracDistribPerson = state.dataIPShortCut->rNumericArgs(6); + elecBaseboard.FracDistribPerson = s_ipsc->rNumericArgs(6); if (elecBaseboard.FracDistribPerson < MinFraction) { ShowWarningError(state, - std::string{RoutineName} + cCurrentModuleObject + "=\"" + state.dataIPShortCut->cAlphaArgs(1) + "\", " + - state.dataIPShortCut->cNumericFieldNames(6) + " was lower than the allowable minimum."); + std::string{RoutineName} + s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", " + + s_ipsc->cNumericFieldNames(6) + " was lower than the allowable minimum."); ShowContinueError(state, format("...reset to minimum value=[{:.2R}].", MinFraction)); elecBaseboard.FracDistribPerson = MinFraction; } if (elecBaseboard.FracDistribPerson > MaxFraction) { ShowWarningError(state, - std::string{RoutineName} + cCurrentModuleObject + "=\"" + state.dataIPShortCut->cAlphaArgs(1) + "\", " + - state.dataIPShortCut->cNumericFieldNames(6) + " was higher than the allowable maximum."); + std::string{RoutineName} + s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", " + + s_ipsc->cNumericFieldNames(6) + " was higher than the allowable maximum."); ShowContinueError(state, format("...reset to maximum value=[{:.2R}].", MaxFraction)); elecBaseboard.FracDistribPerson = MaxFraction; } @@ -370,7 +358,7 @@ namespace ElectricBaseboardRadiator { if ((elecBaseboard.TotSurfToDistrib < MinDistribSurfaces) && (elecBaseboard.FracRadiant > MinFraction)) { ShowSevereError(state, - std::string{RoutineName} + cCurrentModuleObject + "=\"" + state.dataIPShortCut->cAlphaArgs(1) + + std::string{RoutineName} + s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", the number of surface/radiant fraction groups entered was less than the allowable minimum."); ShowContinueError(state, format("...the minimum that must be entered=[{}].", MinDistribSurfaces)); ErrorsFound = true; @@ -389,21 +377,25 @@ namespace ElectricBaseboardRadiator { Real64 AllFracsSummed = elecBaseboard.FracDistribPerson; for (int SurfNum = 1; SurfNum <= elecBaseboard.TotSurfToDistrib; ++SurfNum) { - elecBaseboard.SurfaceName(SurfNum) = state.dataIPShortCut->cAlphaArgs(SurfNum + 3); - elecBaseboard.SurfacePtr(SurfNum) = HeatBalanceIntRadExchange::GetRadiantSystemSurface( - state, cCurrentModuleObject, elecBaseboard.EquipName, elecBaseboard.ZonePtr, elecBaseboard.SurfaceName(SurfNum), ErrorsFound); - elecBaseboard.FracDistribToSurf(SurfNum) = state.dataIPShortCut->rNumericArgs(SurfNum + 6); + elecBaseboard.SurfaceName(SurfNum) = s_ipsc->cAlphaArgs(SurfNum + 3); + elecBaseboard.SurfacePtr(SurfNum) = HeatBalanceIntRadExchange::GetRadiantSystemSurface(state, + s_ipsc->cCurrentModuleObject, + elecBaseboard.EquipName, + elecBaseboard.ZonePtr, + elecBaseboard.SurfaceName(SurfNum), + ErrorsFound); + elecBaseboard.FracDistribToSurf(SurfNum) = s_ipsc->rNumericArgs(SurfNum + 6); if (elecBaseboard.FracDistribToSurf(SurfNum) > MaxFraction) { ShowWarningError(state, - std::string{RoutineName} + cCurrentModuleObject + "=\"" + state.dataIPShortCut->cAlphaArgs(1) + "\", " + - state.dataIPShortCut->cNumericFieldNames(SurfNum + 6) + "was greater than the allowable maximum."); + std::string{RoutineName} + s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", " + + s_ipsc->cNumericFieldNames(SurfNum + 6) + "was greater than the allowable maximum."); ShowContinueError(state, format("...reset to maximum value=[{:.2R}].", MaxFraction)); elecBaseboard.TotSurfToDistrib = MaxFraction; } if (elecBaseboard.FracDistribToSurf(SurfNum) < MinFraction) { ShowWarningError(state, - std::string{RoutineName} + cCurrentModuleObject + "=\"" + state.dataIPShortCut->cAlphaArgs(1) + "\", " + - state.dataIPShortCut->cNumericFieldNames(SurfNum + 6) + "was less than the allowable minimum."); + std::string{RoutineName} + s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", " + + s_ipsc->cNumericFieldNames(SurfNum + 6) + "was less than the allowable minimum."); ShowContinueError(state, format("...reset to maximum value=[{:.2R}].", MinFraction)); elecBaseboard.TotSurfToDistrib = MinFraction; } @@ -417,21 +409,21 @@ namespace ElectricBaseboardRadiator { if (AllFracsSummed > (MaxFraction + 0.01)) { ShowSevereError(state, - std::string{RoutineName} + cCurrentModuleObject + "=\"" + state.dataIPShortCut->cAlphaArgs(1) + + std::string{RoutineName} + s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Summed radiant fractions for people + surface groups > 1.0"); ErrorsFound = true; } if ((AllFracsSummed < (MaxFraction - 0.01)) && (elecBaseboard.FracRadiant > MinFraction)) { // User didn't distribute all of the | radiation warn that some will be lost ShowWarningError(state, - std::string{RoutineName} + cCurrentModuleObject + "=\"" + state.dataIPShortCut->cAlphaArgs(1) + + std::string{RoutineName} + s_ipsc->cCurrentModuleObject + "=\"" + s_ipsc->cAlphaArgs(1) + "\", Summed radiant fractions for people + surface groups < 1.0"); ShowContinueError(state, "The rest of the radiant energy delivered by the baseboard heater will be lost"); } } if (ErrorsFound) { - ShowFatalError(state, std::string{RoutineName} + cCurrentModuleObject + "Errors found getting input. Program terminates."); + ShowFatalError(state, std::string{RoutineName} + s_ipsc->cCurrentModuleObject + "Errors found getting input. Program terminates."); } for (auto &elecBaseboard : state.dataElectBaseboardRad->ElecBaseboard) { @@ -691,7 +683,7 @@ namespace ElectricBaseboardRadiator { Real64 Effic = elecBaseboard.BaseboardEfficiency; if (QZnReq > HVAC::SmallLoad && !state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) && - ScheduleManager::GetCurrentScheduleValue(state, elecBaseboard.SchedPtr) > 0.0) { + elecBaseboard.availSched->getCurrentVal() > 0.0) { // If the load exceeds the capacity than the capacity is set to the BB limit. if (QZnReq > elecBaseboard.NominalCapacity) { @@ -888,7 +880,7 @@ namespace ElectricBaseboardRadiator { // April 2010 Brent Griffith, max limit to protect surface temperature calcs // PURPOSE OF THIS SUBROUTINE: - // To distribute the gains from the electric basebaord heater + // To distribute the gains from the electric baseboard heater // as specified in the user input file. This includes distribution // of long wavelength radiant gains to surfaces and "people." diff --git a/src/EnergyPlus/ElectricBaseboardRadiator.hh b/src/EnergyPlus/ElectricBaseboardRadiator.hh index b4a8d2df86f..22e46e99957 100644 --- a/src/EnergyPlus/ElectricBaseboardRadiator.hh +++ b/src/EnergyPlus/ElectricBaseboardRadiator.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -72,7 +72,7 @@ namespace ElectricBaseboardRadiator { Array1D_string SurfaceName; Array1D_int SurfacePtr; int ZonePtr = 0; - int SchedPtr = 0; + Sched::Schedule *availSched = nullptr; // Assuming availability schedule int TotSurfToDistrib = 0; Real64 NominalCapacity = 0.0; Real64 BaseboardEfficiency = 0.0; @@ -160,6 +160,10 @@ struct ElectricBaseboardRadiatorData : BaseGlobalStruct Array1D ElecBaseboardNumericFields; bool GetInputFlag = true; // One time get input flag + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ElectricPowerServiceManager.cc b/src/EnergyPlus/ElectricPowerServiceManager.cc index 76069c342d1..73f4d358ac0 100644 --- a/src/EnergyPlus/ElectricPowerServiceManager.cc +++ b/src/EnergyPlus/ElectricPowerServiceManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -197,7 +197,9 @@ void ElectricPowerServiceManager::reinitZoneGainsAtBeginEnvironment() void ElectricPowerServiceManager::getPowerManagerInput(EnergyPlusData &state) { - static constexpr std::string_view routineName = "ElectricPowerServiceManager getPowerManagerInput "; + static constexpr std::string_view routineName = "ElectricPowerServiceManager::getPowerManagerInput "; + + auto &s_ipsc = state.dataIPShortCut; numLoadCenters_ = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "ElectricLoadCenter:Distribution"); @@ -261,43 +263,38 @@ void ElectricPowerServiceManager::getPowerManagerInput(EnergyPlusData &state) int iOStat; // IO Status when calling get input subroutine bool foundInFromGridTransformer = false; - state.dataIPShortCut->cCurrentModuleObject = "ElectricLoadCenter:Transformer"; + s_ipsc->cCurrentModuleObject = "ElectricLoadCenter:Transformer"; for (int loopTransformer = 1; loopTransformer <= numTransformers_; ++loopTransformer) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - state.dataIPShortCut->cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, loopTransformer, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, numAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, numNums, iOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "PowerInFromGrid")) { + if (Util::SameString(s_ipsc->cAlphaArgs(3), "PowerInFromGrid")) { if (!foundInFromGridTransformer) { foundInFromGridTransformer = true; - facilityPowerInTransformerName_ = state.dataIPShortCut->cAlphaArgs(1); + facilityPowerInTransformerName_ = s_ipsc->cAlphaArgs(1); facilityPowerInTransformerPresent_ = true; } else { // should only have one transformer in input that is PowerInFromGrid - ShowWarningError(state, - format("{}{}=\"{}\", invalid entry.", - routineName, - state.dataIPShortCut->cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, - format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3))); + ShowWarningError(state, format("{}{}=\"{}\", invalid entry.", routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {} = {}", s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3))); ShowContinueError(state, "Only one transformer with Usage PowerInFromGrid can be used, first one in input file will be used and the " "simulation continues..."); } - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "PowerOutToGrid")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "PowerOutToGrid")) { if (powerOutTransformerObj_ == nullptr) { ++numPowerOutTransformers_; - powerOutTransformerName_ = state.dataIPShortCut->cAlphaArgs(1); + powerOutTransformerName_ = s_ipsc->cAlphaArgs(1); powerOutTransformerObj_ = std::make_unique(state, powerOutTransformerName_); } else { @@ -673,19 +670,21 @@ void ElectricPowerServiceManager::checkLoadCenters(EnergyPlusData &state) } } +// TODO: Absolutely not. Constructors should not do this much work, +// because if this fails, then the constructor fails and who knows who +// will be referencing this object. ElectPowerLoadCenter::ElectPowerLoadCenter(EnergyPlusData &state, int const objectNum) : numGenerators(0), bussType(ElectricBussType::Invalid), thermalProd(0.0), thermalProdRate(0.0), inverterPresent(false), subpanelFeedInRequest(0.0), subpanelFeedInRate(0.0), subpanelDrawRate(0.0), genElectricProd(0.0), genElectProdRate(0.0), storOpCVDrawRate(0.0), storOpCVFeedInRate(0.0), storOpCVChargeRate(0.0), storOpCVDischargeRate(0.0), storOpIsCharging(false), storOpIsDischarging(false), genOperationScheme_(GeneratorOpScheme::Invalid), demandMeterPtr_(0), generatorsPresent_(false), myCoGenSetupFlag_(true), demandLimit_(0.0), - trackSchedPtr_(0), storagePresent_(false), transformerPresent_(false), totalPowerRequest_(0.0), totalThermalPowerRequest_(0.0), + storagePresent_(false), transformerPresent_(false), totalPowerRequest_(0.0), totalThermalPowerRequest_(0.0), storageScheme_(StorageOpScheme::Invalid), trackStorageOpMeterIndex_(0), converterPresent_(false), maxStorageSOCFraction_(1.0), minStorageSOCFraction_(0.0), designStorageChargePower_(0.0), designStorageChargePowerWasSet_(false), designStorageDischargePower_(0.0), - designStorageDischargePowerWasSet_(false), storageChargeModSchedIndex_(0), storageDischargeModSchedIndex_(0), facilityDemandTarget_(0.0), - facilityDemandTargetModSchedIndex_(0), eMSOverridePelFromStorage_(false), // if true, EMS calling for override - eMSValuePelFromStorage_(0.0), // value EMS is directing to use, power from storage [W] - eMSOverridePelIntoStorage_(false), // if true, EMS calling for override - eMSValuePelIntoStorage_(0.0) // value EMS is directing to use, power into storage [W] + designStorageDischargePowerWasSet_(false), facilityDemandTarget_(0.0), eMSOverridePelFromStorage_(false), // if true, EMS calling for override + eMSValuePelFromStorage_(0.0), // value EMS is directing to use, power from storage [W] + eMSOverridePelIntoStorage_(false), // if true, EMS calling for override + eMSValuePelIntoStorage_(0.0) // value EMS is directing to use, power into storage [W] { static constexpr std::string_view routineName = "ElectPowerLoadCenter constructor "; @@ -693,151 +692,130 @@ ElectPowerLoadCenter::ElectPowerLoadCenter(EnergyPlusData &state, int const obje int numNums; // Number of elements in the numeric array int IOStat; // IO Status when calling get input subroutine - state.dataIPShortCut->cCurrentModuleObject = "ElectricLoadCenter:Distribution"; + auto &s_ipsc = state.dataIPShortCut; + + s_ipsc->cCurrentModuleObject = "ElectricLoadCenter:Distribution"; bool errorsFound = false; if (objectNum > 0) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - state.dataIPShortCut->cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, objectNum, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, numAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, numNums, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); - name_ = state.dataIPShortCut->cAlphaArgs(1); + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + name_ = s_ipsc->cAlphaArgs(1); // how to verify names are unique across objects? add to GlobalNames? - if (!state.dataIPShortCut->lAlphaFieldBlanks(2)) { - generatorListName_ = state.dataIPShortCut->cAlphaArgs(2); + if (!s_ipsc->lAlphaFieldBlanks(2)) { + generatorListName_ = s_ipsc->cAlphaArgs(2); // check that int testIndex = state.dataInputProcessing->inputProcessor->getObjectItemNum(state, "ElectricLoadCenter:Generators", generatorListName_); if (testIndex == 0) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); errorsFound = true; } } - if (!state.dataIPShortCut->lAlphaFieldBlanks(3)) { + if (!s_ipsc->lAlphaFieldBlanks(3)) { // Load the Generator Control Operation Scheme - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "Baseload")) { + if (Util::SameString(s_ipsc->cAlphaArgs(3), "Baseload")) { genOperationScheme_ = GeneratorOpScheme::BaseLoad; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "DemandLimit")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "DemandLimit")) { genOperationScheme_ = GeneratorOpScheme::DemandLimit; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "TrackElectrical")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "TrackElectrical")) { genOperationScheme_ = GeneratorOpScheme::TrackElectrical; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "TrackSchedule")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "TrackSchedule")) { genOperationScheme_ = GeneratorOpScheme::TrackSchedule; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "TrackMeter")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "TrackMeter")) { genOperationScheme_ = GeneratorOpScheme::TrackMeter; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "FollowThermal")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "FollowThermal")) { genOperationScheme_ = GeneratorOpScheme::ThermalFollow; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "FollowThermalLimitElectrical")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "FollowThermalLimitElectrical")) { genOperationScheme_ = GeneratorOpScheme::ThermalFollowLimitElectrical; } else { - ShowSevereError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3))); + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3)); errorsFound = true; } } - demandLimit_ = state.dataIPShortCut->rNumericArgs(1); + demandLimit_ = s_ipsc->rNumericArgs(1); - trackSchedPtr_ = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(4)); - if ((trackSchedPtr_ == 0) && (genOperationScheme_ == GeneratorOpScheme::TrackSchedule)) { - if (!state.dataIPShortCut->lAlphaFieldBlanks(4)) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4))); - } else { - ShowSevereError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = blank field.", state.dataIPShortCut->cAlphaFieldNames(4))); + if (genOperationScheme_ == GeneratorOpScheme::TrackSchedule) { + if (s_ipsc->lAlphaFieldBlanks(4)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(4)); + errorsFound = true; + } else if ((trackSched_ = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(4))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4)); + errorsFound = true; } - ShowContinueError(state, "Schedule not found; Must be entered and valid when Generator Operation Scheme=TrackSchedule"); - errorsFound = true; } - demandMeterName_ = Util::makeUPPER(state.dataIPShortCut->cAlphaArgs(5)); + demandMeterName_ = Util::makeUPPER(s_ipsc->cAlphaArgs(5)); // meters may not be "loaded" yet, defered check to later subroutine - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(6), "AlternatingCurrent")) { + if (Util::SameString(s_ipsc->cAlphaArgs(6), "AlternatingCurrent")) { bussType = ElectricBussType::ACBuss; - state.dataIPShortCut->cAlphaArgs(6) = "AlternatingCurrent"; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(6), "DirectCurrentWithInverter")) { + s_ipsc->cAlphaArgs(6) = "AlternatingCurrent"; + } else if (Util::SameString(s_ipsc->cAlphaArgs(6), "DirectCurrentWithInverter")) { bussType = ElectricBussType::DCBussInverter; inverterPresent = true; - state.dataIPShortCut->cAlphaArgs(6) = "DirectCurrentWithInverter"; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(6), "AlternatingCurrentWithStorage")) { + s_ipsc->cAlphaArgs(6) = "DirectCurrentWithInverter"; + } else if (Util::SameString(s_ipsc->cAlphaArgs(6), "AlternatingCurrentWithStorage")) { bussType = ElectricBussType::ACBussStorage; storagePresent_ = true; - state.dataIPShortCut->cAlphaArgs(6) = "AlternatingCurrentWithStorage"; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(6), "DirectCurrentWithInverterDCStorage")) { + s_ipsc->cAlphaArgs(6) = "AlternatingCurrentWithStorage"; + } else if (Util::SameString(s_ipsc->cAlphaArgs(6), "DirectCurrentWithInverterDCStorage")) { bussType = ElectricBussType::DCBussInverterDCStorage; inverterPresent = true; storagePresent_ = true; - state.dataIPShortCut->cAlphaArgs(6) = "DirectCurrentWithInverterDCStorage"; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(6), "DirectCurrentWithInverterACStorage")) { + s_ipsc->cAlphaArgs(6) = "DirectCurrentWithInverterDCStorage"; + } else if (Util::SameString(s_ipsc->cAlphaArgs(6), "DirectCurrentWithInverterACStorage")) { bussType = ElectricBussType::DCBussInverterACStorage; inverterPresent = true; storagePresent_ = true; - state.dataIPShortCut->cAlphaArgs(6) = "DirectCurrentWithInverterACStorage"; - } else if (state.dataIPShortCut->cAlphaArgs(6).empty()) { + s_ipsc->cAlphaArgs(6) = "DirectCurrentWithInverterACStorage"; + } else if (s_ipsc->cAlphaArgs(6).empty()) { bussType = ElectricBussType::ACBuss; - state.dataIPShortCut->cAlphaArgs(6) = "AlternatingCurrent (field was blank)"; + s_ipsc->cAlphaArgs(6) = "AlternatingCurrent (field was blank)"; } else { - ShowSevereError( - state, - format("{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(6), state.dataIPShortCut->cAlphaArgs(6))); + ShowSevereError(state, format("{}{}=\"{}\", invalid entry.", routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {} = {}", s_ipsc->cAlphaFieldNames(6), s_ipsc->cAlphaArgs(6))); errorsFound = true; } if (inverterPresent) { - if (!state.dataIPShortCut->lAlphaFieldBlanks(7)) { - inverterName = state.dataIPShortCut->cAlphaArgs(7); + if (!s_ipsc->lAlphaFieldBlanks(7)) { + inverterName = s_ipsc->cAlphaArgs(7); } else { - ShowSevereError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("{} is blank, but buss type requires inverter.", state.dataIPShortCut->cAlphaFieldNames(7))); + ShowSevereError(state, format("{}{}=\"{}\", invalid entry.", routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{} is blank, but buss type requires inverter.", s_ipsc->cAlphaFieldNames(7))); errorsFound = true; } } if (storagePresent_) { - if (!state.dataIPShortCut->lAlphaFieldBlanks(8)) { - storageName_ = state.dataIPShortCut->cAlphaArgs(8); + if (!s_ipsc->lAlphaFieldBlanks(8)) { + storageName_ = s_ipsc->cAlphaArgs(8); } else { - ShowSevereError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("{} is blank, but buss type requires storage.", state.dataIPShortCut->cAlphaFieldNames(8))); + ShowSevereError(state, format("{}{}=\"{}\", invalid entry.", routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("{} is blank, but buss type requires storage.", s_ipsc->cAlphaFieldNames(8))); errorsFound = true; } } - if (!state.dataIPShortCut->lAlphaFieldBlanks(9)) { + if (!s_ipsc->lAlphaFieldBlanks(9)) { // process transformer - transformerName_ = state.dataIPShortCut->cAlphaArgs(9); + transformerName_ = s_ipsc->cAlphaArgs(9); // only transformers of use type powerFromLoadCenterToBldg are really held in a load center, The legacy applications for transformers are // held at the higher Electric service level transformerPresent_ = true; @@ -845,173 +823,117 @@ ElectPowerLoadCenter::ElectPowerLoadCenter(EnergyPlusData &state, int const obje // Begin new content for grid supply and more control over storage // user selected storage operation scheme - if (!state.dataIPShortCut->lAlphaFieldBlanks(10)) { - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(10), "TrackFacilityElectricDemandStoreExcessOnSite")) { + if (!s_ipsc->lAlphaFieldBlanks(10)) { + if (Util::SameString(s_ipsc->cAlphaArgs(10), "TrackFacilityElectricDemandStoreExcessOnSite")) { storageScheme_ = StorageOpScheme::FacilityDemandStoreExcessOnSite; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(10), "TrackMeterDemandStoreExcessOnSite")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(10), "TrackMeterDemandStoreExcessOnSite")) { storageScheme_ = StorageOpScheme::MeterDemandStoreExcessOnSite; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(10), "TrackChargeDischargeSchedules")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(10), "TrackChargeDischargeSchedules")) { storageScheme_ = StorageOpScheme::ChargeDischargeSchedules; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(10), "FacilityDemandLeveling")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(10), "FacilityDemandLeveling")) { storageScheme_ = StorageOpScheme::FacilityDemandLeveling; } else { - ShowSevereError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(10), state.dataIPShortCut->cAlphaArgs(10))); + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(10), s_ipsc->cAlphaArgs(10)); errorsFound = true; } } else { // blank (preserve legacy behavior for short files) storageScheme_ = StorageOpScheme::FacilityDemandStoreExcessOnSite; } - if (!state.dataIPShortCut->lAlphaFieldBlanks(11)) { - trackSorageOpMeterName_ = state.dataIPShortCut->cAlphaArgs(11); - - } else { - if (storageScheme_ == StorageOpScheme::MeterDemandStoreExcessOnSite) { // throw error - ShowSevereError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, - format("Invalid {}, cannot be blank when storage operation scheme is TrackMeterDemandStoreExcessOnSite", - state.dataIPShortCut->cAlphaFieldNames(11))); - errorsFound = true; - } + if (!s_ipsc->lAlphaFieldBlanks(11)) { + trackSorageOpMeterName_ = s_ipsc->cAlphaArgs(11); + } else if (storageScheme_ == StorageOpScheme::MeterDemandStoreExcessOnSite) { // throw error + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(11), s_ipsc->cAlphaFieldNames(10), s_ipsc->cAlphaArgs(10)); + errorsFound = true; } - if (!state.dataIPShortCut->lAlphaFieldBlanks(12)) { - converterName_ = state.dataIPShortCut->cAlphaArgs(12); + if (!s_ipsc->lAlphaFieldBlanks(12)) { + converterName_ = s_ipsc->cAlphaArgs(12); converterPresent_ = true; - } else { - if (storageScheme_ == StorageOpScheme::ChargeDischargeSchedules || storageScheme_ == StorageOpScheme::FacilityDemandLeveling) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, - format("Invalid {}, cannot be blank when storage scheme is {}", - state.dataIPShortCut->cAlphaFieldNames(12), - state.dataIPShortCut->cAlphaArgs(10))); - errorsFound = true; - } + } else if (storageScheme_ == StorageOpScheme::ChargeDischargeSchedules || storageScheme_ == StorageOpScheme::FacilityDemandLeveling) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(12), s_ipsc->cAlphaFieldNames(10), s_ipsc->cAlphaArgs(10)); + errorsFound = true; } - if (state.dataIPShortCut->lNumericFieldBlanks(2)) { + if (s_ipsc->lNumericFieldBlanks(2)) { maxStorageSOCFraction_ = 1.0; } else { - maxStorageSOCFraction_ = state.dataIPShortCut->rNumericArgs(2); + maxStorageSOCFraction_ = s_ipsc->rNumericArgs(2); } - if (state.dataIPShortCut->lNumericFieldBlanks(3)) { + if (s_ipsc->lNumericFieldBlanks(3)) { minStorageSOCFraction_ = 0.0; } else { - minStorageSOCFraction_ = state.dataIPShortCut->rNumericArgs(3); + minStorageSOCFraction_ = s_ipsc->rNumericArgs(3); } - if (state.dataIPShortCut->lNumericFieldBlanks(4)) { + if (s_ipsc->lNumericFieldBlanks(4)) { designStorageChargePowerWasSet_ = false; } else { designStorageChargePowerWasSet_ = true; - designStorageChargePower_ = state.dataIPShortCut->rNumericArgs(4); + designStorageChargePower_ = s_ipsc->rNumericArgs(4); } - if (state.dataIPShortCut->lNumericFieldBlanks(5)) { + if (s_ipsc->lNumericFieldBlanks(5)) { designStorageDischargePowerWasSet_ = false; } else { designStorageDischargePowerWasSet_ = true; - designStorageDischargePower_ = state.dataIPShortCut->rNumericArgs(5); + designStorageDischargePower_ = s_ipsc->rNumericArgs(5); } - if (state.dataIPShortCut->lNumericFieldBlanks(6)) { - if (storageScheme_ == StorageOpScheme::FacilityDemandLeveling) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = blank field.", state.dataIPShortCut->cNumericFieldNames(6))); - errorsFound = true; - } - } else { - facilityDemandTarget_ = state.dataIPShortCut->rNumericArgs(6); - } - storageChargeModSchedIndex_ = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(13)); - if (storageChargeModSchedIndex_ == 0 && storageScheme_ == StorageOpScheme::ChargeDischargeSchedules) { - if (!state.dataIPShortCut->lAlphaFieldBlanks(13)) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(13), state.dataIPShortCut->cAlphaArgs(13))); - } else { - ShowSevereError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = blank field.", state.dataIPShortCut->cAlphaFieldNames(13))); - } - ShowContinueError(state, "Schedule not found; Must be entered and valid when Storage Operation Scheme = TrackChargeDischargeSchedules"); + if (!s_ipsc->lNumericFieldBlanks(6)) { + facilityDemandTarget_ = s_ipsc->rNumericArgs(6); + } else if (storageScheme_ == StorageOpScheme::FacilityDemandLeveling) { + ShowSevereEmptyField(state, eoh, s_ipsc->cNumericFieldNames(6), s_ipsc->cAlphaFieldNames(10), s_ipsc->cAlphaArgs(10)); errorsFound = true; } - storageDischargeModSchedIndex_ = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(14)); - if (storageDischargeModSchedIndex_ == 0 && storageScheme_ == StorageOpScheme::ChargeDischargeSchedules) { - if (!state.dataIPShortCut->lAlphaFieldBlanks(14)) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(14), state.dataIPShortCut->cAlphaArgs(14))); - } else { - ShowSevereError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = blank field.", state.dataIPShortCut->cAlphaFieldNames(14))); + if (storageScheme_ == StorageOpScheme::ChargeDischargeSchedules) { + if (s_ipsc->lAlphaFieldBlanks(13)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(13), s_ipsc->cAlphaFieldNames(10), s_ipsc->cAlphaArgs(10)); + errorsFound = true; + } else if ((storageChargeModSched_ = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(13))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(13), s_ipsc->cAlphaArgs(13)); + errorsFound = true; + } + + if (s_ipsc->lAlphaFieldBlanks(14)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(14), s_ipsc->cAlphaFieldNames(10), s_ipsc->cAlphaArgs(10)); + errorsFound = true; + } else if ((storageDischargeModSched_ = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(14))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(14), s_ipsc->cAlphaArgs(14)); + errorsFound = true; } - ShowContinueError(state, "Schedule not found; Must be entered and valid when Storage Operation Scheme = TrackChargeDischargeSchedules"); - errorsFound = true; } - facilityDemandTargetModSchedIndex_ = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(15)); - if (facilityDemandTargetModSchedIndex_ == 0 && storageScheme_ == StorageOpScheme::FacilityDemandLeveling) { - if (!state.dataIPShortCut->lAlphaFieldBlanks(15)) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(15), state.dataIPShortCut->cAlphaArgs(15))); - } else { - ShowSevereError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = blank field.", state.dataIPShortCut->cAlphaFieldNames(15))); + if (storageScheme_ == StorageOpScheme::FacilityDemandLeveling) { + if (s_ipsc->lAlphaFieldBlanks(15)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(15), s_ipsc->cAlphaFieldNames(10), s_ipsc->cAlphaArgs(10)); + errorsFound = true; + } else if ((facilityDemandTargetModSched_ = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(15))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(15), s_ipsc->cAlphaArgs(15)); + errorsFound = true; } - ShowContinueError(state, "Schedule not found; Must be entered and valid when Storage Operation Scheme = FacilityDemandLeveling"); - errorsFound = true; } + } else { // object num == 0 // just construct an empty object and return return; } // now that we are done with processing get input for ElectricLoadCenter:Distribution we can call child input objects without IP shortcut problems - state.dataIPShortCut->cCurrentModuleObject = "ElectricLoadCenter:Generators"; - int genListObjectNum = - state.dataInputProcessing->inputProcessor->getObjectItemNum(state, state.dataIPShortCut->cCurrentModuleObject, generatorListName_); + s_ipsc->cCurrentModuleObject = "ElectricLoadCenter:Generators"; + int genListObjectNum = state.dataInputProcessing->inputProcessor->getObjectItemNum(state, s_ipsc->cCurrentModuleObject, generatorListName_); if (genListObjectNum > 0) { state.dataInputProcessing->inputProcessor->getObjectItem(state, - state.dataIPShortCut->cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, genListObjectNum, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, numAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, numNums, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); // Calculate the number of generators in list numGenerators = numNums / 2; // note IDD needs Min Fields = 6 @@ -1021,11 +943,11 @@ ElectPowerLoadCenter::ElectPowerLoadCenter(EnergyPlusData &state, int const obje // call constructor in place generatorsPresent_ = true; elecGenCntrlObj.emplace_back(new GeneratorController(state, - state.dataIPShortCut->cAlphaArgs(alphaCount), - state.dataIPShortCut->cAlphaArgs(alphaCount + 1), - state.dataIPShortCut->rNumericArgs(2 * genCount - 1), - state.dataIPShortCut->cAlphaArgs(alphaCount + 2), - state.dataIPShortCut->rNumericArgs(2 * genCount))); + s_ipsc->cAlphaArgs(alphaCount), + s_ipsc->cAlphaArgs(alphaCount + 1), + s_ipsc->rNumericArgs(2 * genCount - 1), + s_ipsc->cAlphaArgs(alphaCount + 2), + s_ipsc->rNumericArgs(2 * genCount))); ++alphaCount; ++alphaCount; ++alphaCount; @@ -1039,8 +961,8 @@ ElectPowerLoadCenter::ElectPowerLoadCenter(EnergyPlusData &state, int const obje ShowWarningError(state, format("Generator operation needs to be based on following thermal loads and needs values for Rated Thermal to " "Electrical Power Ratio in {} named {}", - state.dataIPShortCut->cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1))); } } } @@ -1084,24 +1006,23 @@ ElectPowerLoadCenter::ElectPowerLoadCenter(EnergyPlusData &state, int const obje if (!errorsFound && transformerPresent_) { - state.dataIPShortCut->cCurrentModuleObject = "ElectricLoadCenter:Transformer"; - int transformerItemNum = - state.dataInputProcessing->inputProcessor->getObjectItemNum(state, state.dataIPShortCut->cCurrentModuleObject, transformerName_); + s_ipsc->cCurrentModuleObject = "ElectricLoadCenter:Transformer"; + int transformerItemNum = state.dataInputProcessing->inputProcessor->getObjectItemNum(state, s_ipsc->cCurrentModuleObject, transformerName_); if (transformerItemNum > 0) { int iOStat; state.dataInputProcessing->inputProcessor->getObjectItem(state, - state.dataIPShortCut->cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, transformerItemNum, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, numAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, numNums, iOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + if (Util::SameString(s_ipsc->cAlphaArgs(3), "LoadCenterPowerConditioning")) { // this is the right kind of transformer transformerObj = std::make_unique(state, transformerName_); } else { @@ -1110,7 +1031,7 @@ ElectPowerLoadCenter::ElectPowerLoadCenter(EnergyPlusData &state, int const obje format("Transformer named {} associated with the load center named {} should have {} set to LoadCenterPowerConditioning.", transformerName_, name_, - state.dataIPShortCut->cAlphaFieldNames(3))); + s_ipsc->cAlphaFieldNames(3))); } } else { ShowSevereError(state, format("Transformer named {}, was not found for the load center named {}", transformerName_, name_)); @@ -1250,7 +1171,7 @@ void ElectPowerLoadCenter::dispatchGenerators(EnergyPlusData &state, for (auto &g : elecGenCntrlObj) { - if (ScheduleManager::GetCurrentScheduleValue(state, g->availSchedPtr) > 0.0) { + if (g->availSched->getCurrentVal() > 0.0) { // Set the Operation Flag g->onThisTimestep = true; // Set the electric generator load request @@ -1287,7 +1208,7 @@ void ElectPowerLoadCenter::dispatchGenerators(EnergyPlusData &state, for (auto &g : elecGenCntrlObj) { - if (ScheduleManager::GetCurrentScheduleValue(state, g->availSchedPtr) > 0.0 && remainingLoad > 0.0) { + if (g->availSched->getCurrentVal() > 0.0 && remainingLoad > 0.0) { // Set the Operation Flag g->onThisTimestep = true; @@ -1342,7 +1263,7 @@ void ElectPowerLoadCenter::dispatchGenerators(EnergyPlusData &state, for (auto &g : elecGenCntrlObj) { - if (ScheduleManager::GetCurrentScheduleValue(state, g->availSchedPtr) > 0.0 && remainingLoad > 0.0) { + if (g->availSched->getCurrentVal() > 0.0 && remainingLoad > 0.0) { // Set the Operation Flag g->onThisTimestep = true; @@ -1393,12 +1314,12 @@ void ElectPowerLoadCenter::dispatchGenerators(EnergyPlusData &state, // The Track Schedule scheme tries to have the generators meet the electrical demand determined from a schedule. // Code is very similar to 'Track Electrical' except for initial RemainingLoad is replaced by SchedElecDemand // and PV production is ignored. - remainingLoad = ScheduleManager::GetCurrentScheduleValue(state, trackSchedPtr_); + remainingLoad = trackSched_->getCurrentVal(); loadCenterElectricLoad = remainingLoad; for (auto &g : elecGenCntrlObj) { - if (ScheduleManager::GetCurrentScheduleValue(state, g->availSchedPtr) > 0.0 && remainingLoad > 0.0) { + if (g->availSched->getCurrentVal() > 0.0 && remainingLoad > 0.0) { // Set the Operation Flag g->onThisTimestep = true; @@ -1458,7 +1379,7 @@ void ElectPowerLoadCenter::dispatchGenerators(EnergyPlusData &state, loadCenterElectricLoad = remainingLoad; for (auto &g : elecGenCntrlObj) { - if (ScheduleManager::GetCurrentScheduleValue(state, g->availSchedPtr) > 0.0 && remainingLoad > 0.0) { + if (g->availSched->getCurrentVal() > 0.0 && remainingLoad > 0.0) { // Set the Operation Flag g->onThisTimestep = true; // Set the electric generator load @@ -1511,7 +1432,7 @@ void ElectPowerLoadCenter::dispatchGenerators(EnergyPlusData &state, Real64 loadCenterThermalLoad = remainingThermalLoad; for (auto &g : elecGenCntrlObj) { - if (ScheduleManager::GetCurrentScheduleValue(state, g->availSchedPtr) > 0.0 && remainingThermalLoad > 0.0) { + if (g->availSched->getCurrentVal() > 0.0 && remainingThermalLoad > 0.0) { if (g->nominalThermElectRatio > 0.0) { remainingLoad = remainingThermalLoad / g->nominalThermElectRatio; @@ -1577,7 +1498,7 @@ void ElectPowerLoadCenter::dispatchGenerators(EnergyPlusData &state, loadCenterElectricLoad = remainingWholePowerDemand; Real64 loadCenterThermalLoad = remainingThermalLoad; for (auto &g : elecGenCntrlObj) { - if ((ScheduleManager::GetCurrentScheduleValue(state, g->availSchedPtr) > 0.0) && (remainingThermalLoad > 0.0) && (remainingLoad > 0.0)) { + if ((g->availSched->getCurrentVal() > 0.0) && (remainingThermalLoad > 0.0) && (remainingLoad > 0.0)) { if (g->nominalThermElectRatio > 0.0) { remainingLoad = min(remainingWholePowerDemand, remainingThermalLoad / g->nominalThermElectRatio); g->powerRequestThisTimestep = min(g->maxPowerOut, remainingLoad); @@ -1708,7 +1629,7 @@ void ElectPowerLoadCenter::dispatchStorage(EnergyPlusData &state, break; } case StorageOpScheme::FacilityDemandLeveling: { - Real64 demandTarget = facilityDemandTarget_ * ScheduleManager::GetCurrentScheduleValue(state, facilityDemandTargetModSchedIndex_); + Real64 demandTarget = facilityDemandTarget_ * facilityDemandTargetModSched_->getCurrentVal(); // compare target to Real64 deltaLoad = originalFeedInRequest - demandTarget; if (deltaLoad >= 0.0) { @@ -1811,8 +1732,8 @@ void ElectPowerLoadCenter::dispatchStorage(EnergyPlusData &state, } case StorageOpScheme::ChargeDischargeSchedules: { - storOpCVChargeRate = designStorageChargePower_ * ScheduleManager::GetCurrentScheduleValue(state, storageChargeModSchedIndex_); - storOpCVDischargeRate = designStorageDischargePower_ * ScheduleManager::GetCurrentScheduleValue(state, storageDischargeModSchedIndex_); + storOpCVChargeRate = designStorageChargePower_ * storageChargeModSched_->getCurrentVal(); + storOpCVDischargeRate = designStorageDischargePower_ * storageDischargeModSched_->getCurrentVal(); Real64 genAndStorSum = storOpCVGenRate + storOpCVDischargeRate - storOpCVChargeRate; if (genAndStorSum >= 0.0) { // power to feed toward main panel storOpCVDrawRate = 0.0; @@ -2152,6 +2073,7 @@ Real64 ElectPowerLoadCenter::calcLoadCenterThermalLoad(EnergyPlusData &state) return thermalLoad; } +// TODO: Constructors should not do this much work GeneratorController::GeneratorController(EnergyPlusData &state, std::string const &objectName, std::string const &objectType, @@ -2159,7 +2081,7 @@ GeneratorController::GeneratorController(EnergyPlusData &state, std::string const &availSchedName, Real64 thermalToElectRatio) : generatorType(GeneratorType::Invalid), compPlantType(DataPlant::PlantEquipmentType::Invalid), generatorIndex(0), maxPowerOut(0.0), - availSchedPtr(0), powerRequestThisTimestep(0.0), onThisTimestep(false), eMSPowerRequest(0.0), eMSRequestOn(false), plantInfoFound(false), + powerRequestThisTimestep(0.0), onThisTimestep(false), eMSPowerRequest(0.0), eMSRequestOn(false), plantInfoFound(false), cogenLocation(PlantLocation(0, DataPlant::LoopSideLocation::Invalid, 0, 0)), nominalThermElectRatio(0.0), dCElectricityProd(0.0), dCElectProdRate(0.0), electricityProd(0.0), electProdRate(0.0), thermalProd(0.0), thermProdRate(0.0), pvwattsGenerator(nullptr), errCountNegElectProd_(0) @@ -2167,6 +2089,10 @@ GeneratorController::GeneratorController(EnergyPlusData &state, static constexpr std::string_view routineName = "GeneratorController constructor "; + auto &s_ipsc = state.dataIPShortCut; + + ErrorObjectHeader eoh{routineName, objectType, objectName}; + name = objectName; generatorType = static_cast(getEnumValue(GeneratorTypeNamesUC, Util::makeUPPER(objectType))); @@ -2222,51 +2148,33 @@ GeneratorController::GeneratorController(EnergyPlusData &state, break; } default: { - ShowSevereError(state, format("{}{} invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject)); + ShowSevereError(state, format("{}{} invalid entry.", routineName, s_ipsc->cCurrentModuleObject)); ShowContinueError(state, format("Invalid {} associated with generator = {}", objectType, objectName)); break; } } - availSched = availSchedName; - if (availSched.empty()) { - availSchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - availSchedPtr = ScheduleManager::GetScheduleIndex(state, availSchedName); - if (availSchedPtr <= 0) { - ShowSevereError(state, format("{}{}, invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject)); - ShowContinueError(state, format("Invalid availability schedule = {}", availSchedName)); - ShowContinueError(state, "Schedule was not found "); - } else { - if (generatorType == GeneratorType::PVWatts) { - ShowWarningError(state, - format("{}{}, Availability Schedule for Generator:PVWatts '{}' will be be ignored (runs all the time).", - routineName, - state.dataIPShortCut->cCurrentModuleObject, - objectName)); - } else if (generatorType == GeneratorType::PV) { - // It should only warn if Performance type is SimplePV (DataPhotovoltaics::iSimplePVModel). - // Except you need GetPVInput to have run already etc - // Note: you can't use state.dataIPShortCut->cAlphaArgs etc or it'll override what will still need to be processed in - // ElectPowerLoadCenter::ElectPowerLoadCenter after this function is called - int PVNum = state.dataInputProcessing->inputProcessor->getObjectItemNum(state, objectType, Util::makeUPPER(objectName)); - int NumAlphas; // Number of PV Array parameter alpha names being passed - int NumNums; // Number of PV Array numeric parameters are being passed - int IOStat; - Array1D_string Alphas(5); // Alpha items for object - Array1D Numbers(2); // Numeric items for object - state.dataInputProcessing->inputProcessor->getObjectItem(state, objectType, PVNum, Alphas, NumAlphas, Numbers, NumNums, IOStat); - if (Util::SameString(Alphas(3), "PhotovoltaicPerformance:Simple")) { - ShowWarningError(state, - format("{}{}, Availability Schedule for Generator:Photovoltaics '{}' of Type PhotovoltaicPerformance:Simple " - "will be be ignored (runs all the time).", - routineName, - state.dataIPShortCut->cCurrentModuleObject, - objectName)); - ShowContinueError(state, - "To limit this Generator:Photovoltaic's output, please use the Inverter's availability schedule instead."); - } - } + if (availSchedName.empty()) { + availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((availSched = Sched::GetSchedule(state, availSchedName)) == nullptr) { + ShowSevereItemNotFound(state, eoh, "Availability Schedule Name", availSchedName); + } else if (generatorType == GeneratorType::PVWatts) { + ShowWarningCustom(state, eoh, "Availability Schedule will be ignored (runs all the time)."); + } else if (generatorType == GeneratorType::PV) { + // It should only warn if Performance type is SimplePV (DataPhotovoltaics::iSimplePVModel). + // Except you need GetPVInput to have run already etc + // Note: you can't use s_ipsc->cAlphaArgs etc or it'll override what will still need to be processed in + // ElectPowerLoadCenter::ElectPowerLoadCenter after this function is called + int PVNum = state.dataInputProcessing->inputProcessor->getObjectItemNum(state, objectType, Util::makeUPPER(objectName)); + int NumAlphas; // Number of PV Array parameter alpha names being passed + int NumNums; // Number of PV Array numeric parameters are being passed + int IOStat; + Array1D_string Alphas(5); // Alpha items for object + Array1D Numbers(2); // Numeric items for object + state.dataInputProcessing->inputProcessor->getObjectItem(state, objectType, PVNum, Alphas, NumAlphas, Numbers, NumNums, IOStat); + if (Util::SameString(Alphas(3), "PhotovoltaicPerformance:Simple")) { + ShowWarningCustom(state, eoh, "Availability Schedule will be ignored (runs all the time)."); + ShowContinueError(state, "To limit this Generator:Photovoltaic's output, please use the Inverter's availability schedule instead."); } } @@ -2450,14 +2358,17 @@ void GeneratorController::simGeneratorGetPowerOutput(EnergyPlusData &state, DCtoACInverter::DCtoACInverter(EnergyPlusData &state, std::string const &objectName) : aCPowerOut_(0.0), aCEnergyOut_(0.0), efficiency_(0.0), dCPowerIn_(0.0), dCEnergyIn_(0.0), conversionLossPower_(0.0), conversionLossEnergy_(0.0), conversionLossEnergyDecrement_(0.0), thermLossRate_(0.0), thermLossEnergy_(0.0), qdotConvZone_(0.0), qdotRadZone_(0.0), ancillACuseRate_(0.0), - ancillACuseEnergy_(0.0), modelType_(InverterModelType::Invalid), availSchedPtr_(0), heatLossesDestination_(ThermalLossDestination::Invalid), - zoneNum_(0), zoneRadFract_(0.0), nominalVoltage_(0.0), nomVoltEfficiencyARR_(6, 0.0), curveNum_(0), ratedPower_(0.0), minPower_(0.0), - maxPower_(0.0), minEfficiency_(0.0), maxEfficiency_(0.0), standbyPower_(0.0) + ancillACuseEnergy_(0.0), modelType_(InverterModelType::Invalid), heatLossesDestination_(ThermalLossDestination::Invalid), zoneNum_(0), + zoneRadFract_(0.0), nominalVoltage_(0.0), nomVoltEfficiencyARR_(6, 0.0), curveNum_(0), ratedPower_(0.0), minPower_(0.0), maxPower_(0.0), + minEfficiency_(0.0), maxEfficiency_(0.0), standbyPower_(0.0) { // initialize nomVoltEfficiencyARR_.resize(6, 0.0); static constexpr std::string_view routineName = "DCtoACInverter constructor "; + + auto &s_ipsc = state.dataIPShortCut; + bool errorsFound = false; // if/when add object class name to input object this can be simplified. for now search all possible types bool foundInverter = false; @@ -2468,28 +2379,28 @@ DCtoACInverter::DCtoACInverter(EnergyPlusData &state, std::string const &objectN if (testInvertIndex > 0) { foundInverter = true; invertIDFObjectNum = testInvertIndex; - state.dataIPShortCut->cCurrentModuleObject = "ElectricLoadCenter:Inverter:LookUpTable"; + s_ipsc->cCurrentModuleObject = "ElectricLoadCenter:Inverter:LookUpTable"; modelType_ = InverterModelType::CECLookUpTableModel; } testInvertIndex = state.dataInputProcessing->inputProcessor->getObjectItemNum(state, "ElectricLoadCenter:Inverter:FunctionOfPower", objectName); if (testInvertIndex > 0) { foundInverter = true; invertIDFObjectNum = testInvertIndex; - state.dataIPShortCut->cCurrentModuleObject = "ElectricLoadCenter:Inverter:FunctionOfPower"; + s_ipsc->cCurrentModuleObject = "ElectricLoadCenter:Inverter:FunctionOfPower"; modelType_ = InverterModelType::CurveFuncOfPower; } testInvertIndex = state.dataInputProcessing->inputProcessor->getObjectItemNum(state, "ElectricLoadCenter:Inverter:Simple", objectName); if (testInvertIndex > 0) { foundInverter = true; invertIDFObjectNum = testInvertIndex; - state.dataIPShortCut->cCurrentModuleObject = "ElectricLoadCenter:Inverter:Simple"; + s_ipsc->cCurrentModuleObject = "ElectricLoadCenter:Inverter:Simple"; modelType_ = InverterModelType::SimpleConstantEff; } testInvertIndex = state.dataInputProcessing->inputProcessor->getObjectItemNum(state, "ElectricLoadCenter:Inverter:PVWatts", objectName); if (testInvertIndex > 0) { foundInverter = true; invertIDFObjectNum = testInvertIndex; - state.dataIPShortCut->cCurrentModuleObject = "ElectricLoadCenter:Inverter:PVWatts"; + s_ipsc->cCurrentModuleObject = "ElectricLoadCenter:Inverter:PVWatts"; modelType_ = InverterModelType::PVWatts; } @@ -2499,101 +2410,80 @@ DCtoACInverter::DCtoACInverter(EnergyPlusData &state, std::string const &objectN int IOStat; // IO Status when calling get input subroutine state.dataInputProcessing->inputProcessor->getObjectItem(state, - state.dataIPShortCut->cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, invertIDFObjectNum, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNums, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); - name_ = state.dataIPShortCut->cAlphaArgs(1); + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + name_ = s_ipsc->cAlphaArgs(1); // how to verify names are unique across objects? add to GlobalNames? if (modelType_ == InverterModelType::PVWatts) { - availSchedPtr_ = ScheduleManager::ScheduleAlwaysOn; + availSched_ = Sched::GetScheduleAlwaysOn(state); zoneNum_ = 0; heatLossesDestination_ = ThermalLossDestination::LostToOutside; zoneRadFract_ = 0; + } else if (s_ipsc->lAlphaFieldBlanks(2)) { + availSched_ = Sched::GetScheduleAlwaysOn(state); } else { - if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { - availSchedPtr_ = ScheduleManager::ScheduleAlwaysOn; - } else { - availSchedPtr_ = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); - if (availSchedPtr_ == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid entry.", - routineName, - state.dataIPShortCut->cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, - format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); - errorsFound = true; - } + if ((availSched_ = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); + errorsFound = true; } - zoneNum_ = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(3), state.dataHeatBal->Zone); - if (zoneNum_ > 0) heatLossesDestination_ = ThermalLossDestination::ZoneGains; - if (zoneNum_ == 0) { - if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { - heatLossesDestination_ = ThermalLossDestination::LostToOutside; - } else { - heatLossesDestination_ = ThermalLossDestination::LostToOutside; - ShowWarningError(state, - format("{}{}=\"{}\", invalid entry.", - routineName, - state.dataIPShortCut->cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, - format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3))); - ShowContinueError(state, "Zone name not found. Inverter heat losses will not be added to a zone"); - // continue with simulation but inverter losses not sent to a zone. - } + if (s_ipsc->lAlphaFieldBlanks(3)) { + heatLossesDestination_ = ThermalLossDestination::LostToOutside; + } else if ((zoneNum_ = Util::FindItemInList(s_ipsc->cAlphaArgs(3), state.dataHeatBal->Zone)) == 0) { + heatLossesDestination_ = ThermalLossDestination::LostToOutside; + ShowWarningItemNotFound( + state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3), "Inverter heat losses will not be added to a zone"); + // continue with simulation but inverter losses not sent to a zone. + } else { + heatLossesDestination_ = ThermalLossDestination::ZoneGains; } - zoneRadFract_ = state.dataIPShortCut->rNumericArgs(1); + zoneRadFract_ = s_ipsc->rNumericArgs(1); } // now the input objects differ depending on class type switch (modelType_) { case InverterModelType::CECLookUpTableModel: { - ratedPower_ = state.dataIPShortCut->rNumericArgs(2); - standbyPower_ = state.dataIPShortCut->rNumericArgs(3); - - nominalVoltage_ = state.dataIPShortCut->rNumericArgs(4); - nomVoltEfficiencyARR_[0] = state.dataIPShortCut->rNumericArgs(5); - nomVoltEfficiencyARR_[1] = state.dataIPShortCut->rNumericArgs(6); - nomVoltEfficiencyARR_[2] = state.dataIPShortCut->rNumericArgs(7); - nomVoltEfficiencyARR_[3] = state.dataIPShortCut->rNumericArgs(8); - nomVoltEfficiencyARR_[4] = state.dataIPShortCut->rNumericArgs(9); - nomVoltEfficiencyARR_[5] = state.dataIPShortCut->rNumericArgs(10); + ratedPower_ = s_ipsc->rNumericArgs(2); + standbyPower_ = s_ipsc->rNumericArgs(3); + + nominalVoltage_ = s_ipsc->rNumericArgs(4); + nomVoltEfficiencyARR_[0] = s_ipsc->rNumericArgs(5); + nomVoltEfficiencyARR_[1] = s_ipsc->rNumericArgs(6); + nomVoltEfficiencyARR_[2] = s_ipsc->rNumericArgs(7); + nomVoltEfficiencyARR_[3] = s_ipsc->rNumericArgs(8); + nomVoltEfficiencyARR_[4] = s_ipsc->rNumericArgs(9); + nomVoltEfficiencyARR_[5] = s_ipsc->rNumericArgs(10); break; } case InverterModelType::CurveFuncOfPower: { - curveNum_ = Curve::GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(4)); + curveNum_ = Curve::GetCurveIndex(state, s_ipsc->cAlphaArgs(4)); if (curveNum_ == 0) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4))); - ShowContinueError(state, "Curve was not found"); + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4)); errorsFound = true; } - ratedPower_ = state.dataIPShortCut->rNumericArgs(2); - minEfficiency_ = state.dataIPShortCut->rNumericArgs(3); - maxEfficiency_ = state.dataIPShortCut->rNumericArgs(4); - minPower_ = state.dataIPShortCut->rNumericArgs(5); - maxPower_ = state.dataIPShortCut->rNumericArgs(6); - standbyPower_ = state.dataIPShortCut->rNumericArgs(7); + ratedPower_ = s_ipsc->rNumericArgs(2); + minEfficiency_ = s_ipsc->rNumericArgs(3); + maxEfficiency_ = s_ipsc->rNumericArgs(4); + minPower_ = s_ipsc->rNumericArgs(5); + maxPower_ = s_ipsc->rNumericArgs(6); + standbyPower_ = s_ipsc->rNumericArgs(7); break; } case InverterModelType::SimpleConstantEff: { - efficiency_ = state.dataIPShortCut->rNumericArgs(2); + efficiency_ = s_ipsc->rNumericArgs(2); break; } case InverterModelType::Invalid: { @@ -2601,8 +2491,8 @@ DCtoACInverter::DCtoACInverter(EnergyPlusData &state, std::string const &objectN break; } case InverterModelType::PVWatts: { - pvWattsDCtoACSizeRatio_ = state.dataIPShortCut->rNumericArgs(1); - pvWattsInverterEfficiency_ = state.dataIPShortCut->rNumericArgs(2); + pvWattsDCtoACSizeRatio_ = s_ipsc->rNumericArgs(1); + pvWattsInverterEfficiency_ = s_ipsc->rNumericArgs(2); break; } default: @@ -2915,7 +2805,7 @@ void DCtoACInverter::simulate(EnergyPlusData &state, Real64 const powerIntoInver dCPowerIn_ = powerIntoInverter; dCEnergyIn_ = dCPowerIn_ * (state.dataHVACGlobal->TimeStepSysSec); // check availability schedule - if (ScheduleManager::GetCurrentScheduleValue(state, availSchedPtr_) > 0.0) { + if (availSched_->getCurrentVal() > 0.0) { // now calculate Inverter based on model type calcEfficiency(state); @@ -2949,12 +2839,15 @@ void DCtoACInverter::simulate(EnergyPlusData &state, Real64 const powerIntoInver ACtoDCConverter::ACtoDCConverter(EnergyPlusData &state, std::string const &objectName) : efficiency_(0.0), aCPowerIn_(0.0), aCEnergyIn_(0.0), dCPowerOut_(0.0), dCEnergyOut_(0.0), conversionLossPower_(0.0), conversionLossEnergy_(0.0), conversionLossEnergyDecrement_(0.0), thermLossRate_(0.0), thermLossEnergy_(0.0), qdotConvZone_(0.0), qdotRadZone_(0.0), ancillACuseRate_(0.0), - ancillACuseEnergy_(0.0), availSchedPtr_(0), modelType_(ConverterModelType::Invalid), heatLossesDestination_(ThermalLossDestination::Invalid), - zoneNum_(0), zoneRadFract_(0.0), // radiative fraction for thermal losses to zone + ancillACuseEnergy_(0.0), modelType_(ConverterModelType::Invalid), heatLossesDestination_(ThermalLossDestination::Invalid), zoneNum_(0), + zoneRadFract_(0.0), // radiative fraction for thermal losses to zone standbyPower_(0.0), maxPower_(0.0) { static constexpr std::string_view routineName = "ACtoDCConverter constructor "; + + auto &s_ipsc = state.dataIPShortCut; + bool errorsFound = false; // if/when add object class name to input object this can be simplified. for now search all possible types @@ -2964,66 +2857,53 @@ ACtoDCConverter::ACtoDCConverter(EnergyPlusData &state, std::string const &objec int NumAlphas; // Number of elements in the alpha array int NumNums; // Number of elements in the numeric array int IOStat; // IO Status when calling get input subroutine - state.dataIPShortCut->cCurrentModuleObject = "ElectricLoadCenter:Storage:Converter"; + s_ipsc->cCurrentModuleObject = "ElectricLoadCenter:Storage:Converter"; state.dataInputProcessing->inputProcessor->getObjectItem(state, - state.dataIPShortCut->cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, testConvertIndex, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, NumNums, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; - name_ = state.dataIPShortCut->cAlphaArgs(1); + name_ = s_ipsc->cAlphaArgs(1); // need a new general approach for verify names are unique across objects, next gen GlobalNames - if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { - availSchedPtr_ = ScheduleManager::ScheduleAlwaysOn; - } else { - availSchedPtr_ = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); - if (availSchedPtr_ == 0) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); - errorsFound = true; - } + if (s_ipsc->lAlphaFieldBlanks(2)) { + availSched_ = Sched::GetScheduleAlwaysOn(state); + } else if ((availSched_ = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); + errorsFound = true; } - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "SimpleFixed")) { + if (Util::SameString(s_ipsc->cAlphaArgs(3), "SimpleFixed")) { modelType_ = ConverterModelType::SimpleConstantEff; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "FunctionOfPower")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "FunctionOfPower")) { modelType_ = ConverterModelType::CurveFuncOfPower; } else { - ShowSevereError( - state, - format("{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3))); + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3)); errorsFound = true; } switch (modelType_) { case ConverterModelType::SimpleConstantEff: { - efficiency_ = state.dataIPShortCut->rNumericArgs(1); + efficiency_ = s_ipsc->rNumericArgs(1); break; } case ConverterModelType::CurveFuncOfPower: { - maxPower_ = state.dataIPShortCut->rNumericArgs(2); - curveNum_ = Curve::GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(4)); + maxPower_ = s_ipsc->rNumericArgs(2); + curveNum_ = Curve::GetCurveIndex(state, s_ipsc->cAlphaArgs(4)); if (curveNum_ == 0) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4))); - ShowContinueError(state, "Curve was not found"); + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4)); errorsFound = true; } break; @@ -3036,25 +2916,20 @@ ACtoDCConverter::ACtoDCConverter(EnergyPlusData &state, std::string const &objec assert(false); } // end switch - standbyPower_ = state.dataIPShortCut->rNumericArgs(3); + standbyPower_ = s_ipsc->rNumericArgs(3); - zoneNum_ = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(5), state.dataHeatBal->Zone); - if (zoneNum_ > 0) heatLossesDestination_ = ThermalLossDestination::ZoneGains; - if (zoneNum_ == 0) { - if (state.dataIPShortCut->lAlphaFieldBlanks(5)) { - heatLossesDestination_ = ThermalLossDestination::LostToOutside; - } else { - heatLossesDestination_ = ThermalLossDestination::LostToOutside; - ShowWarningError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5))); - ShowContinueError(state, "Zone name not found. Inverter heat losses will not be added to a zone"); - // continue with simulation but inverter losses not sent to a zone. - } + if (s_ipsc->lAlphaFieldBlanks(5)) { + heatLossesDestination_ = ThermalLossDestination::LostToOutside; + } else if ((zoneNum_ = Util::FindItemInList(s_ipsc->cAlphaArgs(5), state.dataHeatBal->Zone)) == 0) { + heatLossesDestination_ = ThermalLossDestination::LostToOutside; + ShowWarningItemNotFound( + state, eoh, s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaArgs(5), "Inverter heat losses will not be added to a zone"); + // continue with simulation but inverter losses not sent to a zone. + } else { + heatLossesDestination_ = ThermalLossDestination::ZoneGains; } - zoneRadFract_ = state.dataIPShortCut->rNumericArgs(4); + + zoneRadFract_ = s_ipsc->rNumericArgs(4); SetupOutputVariable(state, "Converter AC to DC Efficiency", @@ -3214,7 +3089,7 @@ void ACtoDCConverter::simulate(EnergyPlusData &state, Real64 const powerOutFromC // need to invert, find an aCPowerIn that produces the desired DC power out // use last efficiency for initial guess - if (ScheduleManager::GetCurrentScheduleValue(state, availSchedPtr_) > 0.0) { + if (availSched_->getCurrentVal() > 0.0) { aCPowerIn_ = powerOutFromConverter / efficiency_; calcEfficiency(state), aCPowerIn_ = powerOutFromConverter / efficiency_; @@ -3253,8 +3128,8 @@ ElectricStorage::ElectricStorage( // main constructor EnergyPlusData &state, std::string const &objectName) : storedPower_(0.0), storedEnergy_(0.0), drawnPower_(0.0), drawnEnergy_(0.0), decrementedEnergyStored_(0.0), maxRainflowArrayBounds_(100), - myWarmUpFlag_(false), storageModelMode_(StorageModelType::Invalid), availSchedPtr_(0), heatLossesDestination_(ThermalLossDestination::Invalid), - zoneNum_(0), zoneRadFract_(0.0), startingEnergyStored_(0.0), energeticEfficCharge_(0.0), energeticEfficDischarge_(0.0), maxPowerDraw_(0.0), + myWarmUpFlag_(false), storageModelMode_(StorageModelType::Invalid), heatLossesDestination_(ThermalLossDestination::Invalid), zoneNum_(0), + zoneRadFract_(0.0), startingEnergyStored_(0.0), energeticEfficCharge_(0.0), energeticEfficDischarge_(0.0), maxPowerDraw_(0.0), maxPowerStore_(0.0), maxEnergyCapacity_(0.0), parallelNum_(0), seriesNum_(0), numBattery_(0), chargeCurveNum_(0), dischargeCurveNum_(0), cycleBinNum_(0), startingSOC_(0.0), maxAhCapacity_(0.0), availableFrac_(0.0), chargeConversionRate_(0.0), chargedOCV_(0.0), dischargedOCV_(0.0), internalR_(0.0), maxDischargeI_(0.0), cutoffV_(0.0), maxChargeRate_(0.0), lifeCalculation_(BatteryDegradationModelType::Invalid), @@ -3268,6 +3143,9 @@ ElectricStorage::ElectricStorage( // main constructor { static constexpr std::string_view routineName = "ElectricStorage constructor "; + + auto &s_ipsc = state.dataIPShortCut; + bool errorsFound = false; // if/when add object class name to input object this can be simplified. for now search all possible types bool foundStorage = false; @@ -3283,7 +3161,7 @@ ElectricStorage::ElectricStorage( // main constructor if (testStorageIndex > 0) { foundStorage = true; storageIDFObjectNum = testStorageIndex; - state.dataIPShortCut->cCurrentModuleObject = item.first; + s_ipsc->cCurrentModuleObject = item.first; storageModelMode_ = item.second; break; } @@ -3294,62 +3172,52 @@ ElectricStorage::ElectricStorage( // main constructor int numNums; // Number of elements in the numeric array int iOStat; // IO Status when calling get input subroutine state.dataInputProcessing->inputProcessor->getObjectItem(state, - state.dataIPShortCut->cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, storageIDFObjectNum, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, numAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, numNums, iOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); - name_ = state.dataIPShortCut->cAlphaArgs(1); + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + name_ = s_ipsc->cAlphaArgs(1); // how to verify names are unique across objects? add to GlobalNames? - if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { - availSchedPtr_ = ScheduleManager::ScheduleAlwaysOn; - } else { - availSchedPtr_ = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); - if (availSchedPtr_ == 0) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); - errorsFound = true; - } + if (s_ipsc->lAlphaFieldBlanks(2)) { + availSched_ = Sched::GetScheduleAlwaysOn(state); + } else if ((availSched_ = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); + errorsFound = true; } - zoneNum_ = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(3), state.dataHeatBal->Zone); - if (zoneNum_ > 0) heatLossesDestination_ = ThermalLossDestination::ZoneGains; - if (zoneNum_ == 0) { - if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { - heatLossesDestination_ = ThermalLossDestination::LostToOutside; - } else { - heatLossesDestination_ = ThermalLossDestination::LostToOutside; - ShowWarningError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3))); - ShowContinueError(state, "Zone name not found. Storage heat losses will not be added to a zone"); - // continue with simulation but storage losses not sent to a zone. - } + if (s_ipsc->lAlphaFieldBlanks(3)) { + heatLossesDestination_ = ThermalLossDestination::LostToOutside; + } else if ((zoneNum_ = Util::FindItemInList(s_ipsc->cAlphaArgs(3), state.dataHeatBal->Zone)) == 0) { + heatLossesDestination_ = ThermalLossDestination::LostToOutside; + ShowWarningItemNotFound( + state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3), "Storage heat losses will not be added to a zone"); + // continue with simulation but storage losses not sent to a zone. + } else { + heatLossesDestination_ = ThermalLossDestination::ZoneGains; } - zoneRadFract_ = state.dataIPShortCut->rNumericArgs(1); + + zoneRadFract_ = s_ipsc->rNumericArgs(1); switch (storageModelMode_) { case StorageModelType::SimpleBucketStorage: { - energeticEfficCharge_ = checkUserEfficiencyInput(state, state.dataIPShortCut->rNumericArgs(2), "CHARGING", name_, errorsFound); - energeticEfficDischarge_ = checkUserEfficiencyInput(state, state.dataIPShortCut->rNumericArgs(3), "DISCHARGING", name_, errorsFound); - maxEnergyCapacity_ = state.dataIPShortCut->rNumericArgs(4); - maxPowerDraw_ = state.dataIPShortCut->rNumericArgs(5); - maxPowerStore_ = state.dataIPShortCut->rNumericArgs(6); - startingEnergyStored_ = state.dataIPShortCut->rNumericArgs(7); + energeticEfficCharge_ = checkUserEfficiencyInput(state, s_ipsc->rNumericArgs(2), "CHARGING", name_, errorsFound); + energeticEfficDischarge_ = checkUserEfficiencyInput(state, s_ipsc->rNumericArgs(3), "DISCHARGING", name_, errorsFound); + maxEnergyCapacity_ = s_ipsc->rNumericArgs(4); + maxPowerDraw_ = s_ipsc->rNumericArgs(5); + maxPowerStore_ = s_ipsc->rNumericArgs(6); + startingEnergyStored_ = s_ipsc->rNumericArgs(7); SetupOutputVariable(state, "Electric Storage Simple Charge State", Constant::Units::J, @@ -3361,101 +3229,77 @@ ElectricStorage::ElectricStorage( // main constructor } case StorageModelType::KIBaMBattery: { - chargeCurveNum_ = Curve::GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(4)); // voltage calculation for charging - if (chargeCurveNum_ == 0 && !state.dataIPShortCut->lAlphaFieldBlanks(4)) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4))); + chargeCurveNum_ = Curve::GetCurveIndex(state, s_ipsc->cAlphaArgs(4)); // voltage calculation for charging + if (chargeCurveNum_ == 0 && !s_ipsc->lAlphaFieldBlanks(4)) { + ShowSevereError(state, format("{}{}=\"{}\", invalid entry.", routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4))); errorsFound = true; - } else if (state.dataIPShortCut->lAlphaFieldBlanks(4)) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} cannot be blank. But no entry found.", state.dataIPShortCut->cAlphaFieldNames(4))); + } else if (s_ipsc->lAlphaFieldBlanks(4)) { + ShowSevereError(state, format("{}{}=\"{}\", invalid entry.", routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {} cannot be blank. But no entry found.", s_ipsc->cAlphaFieldNames(4))); errorsFound = true; } else { errorsFound |= Curve::CheckCurveDims(state, - chargeCurveNum_, // Curve index - {1}, // Valid dimensions - routineName, // Routine name - state.dataIPShortCut->cCurrentModuleObject, // Object Type - name_, // Object Name - state.dataIPShortCut->cAlphaFieldNames(4)); // Field Name + chargeCurveNum_, // Curve index + {1}, // Valid dimensions + routineName, // Routine name + s_ipsc->cCurrentModuleObject, // Object Type + name_, // Object Name + s_ipsc->cAlphaFieldNames(4)); // Field Name } - dischargeCurveNum_ = Curve::GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(5)); // voltage calculation for discharging - if (dischargeCurveNum_ == 0 && !state.dataIPShortCut->lAlphaFieldBlanks(5)) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5))); + dischargeCurveNum_ = Curve::GetCurveIndex(state, s_ipsc->cAlphaArgs(5)); // voltage calculation for discharging + if (dischargeCurveNum_ == 0 && !s_ipsc->lAlphaFieldBlanks(5)) { + ShowSevereError(state, format("{}{}=\"{}\", invalid entry.", routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaArgs(5))); errorsFound = true; - } else if (state.dataIPShortCut->lAlphaFieldBlanks(5)) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} cannot be blank. But no entry found.", state.dataIPShortCut->cAlphaFieldNames(5))); + } else if (s_ipsc->lAlphaFieldBlanks(5)) { + ShowSevereError(state, format("{}{}=\"{}\", invalid entry.", routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {} cannot be blank. But no entry found.", s_ipsc->cAlphaFieldNames(5))); errorsFound = true; } else { errorsFound |= Curve::CheckCurveDims(state, - dischargeCurveNum_, // Curve index - {1}, // Valid dimensions - routineName, // Routine name - state.dataIPShortCut->cCurrentModuleObject, // Object Type - name_, // Object Name - state.dataIPShortCut->cAlphaFieldNames(5)); // Field Name + dischargeCurveNum_, // Curve index + {1}, // Valid dimensions + routineName, // Routine name + s_ipsc->cCurrentModuleObject, // Object Type + name_, // Object Name + s_ipsc->cAlphaFieldNames(5)); // Field Name } - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(6), "Yes")) { + if (Util::SameString(s_ipsc->cAlphaArgs(6), "Yes")) { lifeCalculation_ = BatteryDegradationModelType::LifeCalculationYes; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(6), "No")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(6), "No")) { lifeCalculation_ = BatteryDegradationModelType::LifeCalculationNo; } else { - ShowWarningError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(6), state.dataIPShortCut->cAlphaArgs(6))); + ShowWarningError(state, format("{}{}=\"{}\", invalid entry.", routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {} = {}", s_ipsc->cAlphaFieldNames(6), s_ipsc->cAlphaArgs(6))); ShowContinueError(state, "Yes or No should be selected. Default value No is used to continue simulation"); lifeCalculation_ = BatteryDegradationModelType::LifeCalculationNo; } if (lifeCalculation_ == BatteryDegradationModelType::LifeCalculationYes) { - lifeCurveNum_ = Curve::GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(7)); // Battery life calculation - if (lifeCurveNum_ == 0 && !state.dataIPShortCut->lAlphaFieldBlanks(7)) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid entry.", - routineName, - state.dataIPShortCut->cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(7), state.dataIPShortCut->cAlphaArgs(7))); + lifeCurveNum_ = Curve::GetCurveIndex(state, s_ipsc->cAlphaArgs(7)); // Battery life calculation + if (lifeCurveNum_ == 0 && !s_ipsc->lAlphaFieldBlanks(7)) { + ShowSevereError(state, format("{}{}=\"{}\", invalid entry.", routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(7), s_ipsc->cAlphaArgs(7))); errorsFound = true; - } else if (state.dataIPShortCut->lAlphaFieldBlanks(7)) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid entry.", - routineName, - state.dataIPShortCut->cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, - format("Invalid {} cannot be blank when {} = Yes. But no entry found.", - state.dataIPShortCut->cAlphaFieldNames(7), - state.dataIPShortCut->cAlphaArgs(6))); + } else if (s_ipsc->lAlphaFieldBlanks(7)) { + ShowSevereError(state, format("{}{}=\"{}\", invalid entry.", routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError( + state, + format("Invalid {} cannot be blank when {} = Yes. But no entry found.", s_ipsc->cAlphaFieldNames(7), s_ipsc->cAlphaArgs(6))); errorsFound = true; } else { errorsFound |= Curve::CheckCurveDims(state, - lifeCurveNum_, // Curve index - {1}, // Valid dimensions - routineName, // Routine name - state.dataIPShortCut->cCurrentModuleObject, // Object Type - name_, // Object Name - state.dataIPShortCut->cAlphaFieldNames(7)); // Field Name + lifeCurveNum_, // Curve index + {1}, // Valid dimensions + routineName, // Routine name + s_ipsc->cCurrentModuleObject, // Object Type + name_, // Object Name + s_ipsc->cAlphaFieldNames(7)); // Field Name } - cycleBinNum_ = state.dataIPShortCut->rNumericArgs(14); + cycleBinNum_ = s_ipsc->rNumericArgs(14); if (!errorsFound) { // life cycle calculation for this battery, allocate arrays for degradation calculation // std::vector is zero base instead of 1, so first index is now 0. @@ -3466,7 +3310,7 @@ ElectricStorage::ElectricStorage( // main constructor } } - parallelNum_ = state.dataIPShortCut->rNumericArgs(2); + parallelNum_ = s_ipsc->rNumericArgs(2); seriesNum_ = state.dataIPShortCut->rNumericArgs(3); numBattery_ = parallelNum_ * seriesNum_; maxAhCapacity_ = state.dataIPShortCut->rNumericArgs(4); @@ -4004,7 +3848,7 @@ void ElectricStorage::simulate(EnergyPlusData &state, Real64 const controlSOCMinFracLimit) { // pass thru to constrain function depending on storage model type - if (ScheduleManager::GetCurrentScheduleValue(state, availSchedPtr_) == 0.0) { // storage not available + if (availSched_->getCurrentVal() == 0.0) { // storage not available discharging = false; powerDischarge = 0.0; charging = false; @@ -4641,17 +4485,19 @@ void ElectricStorage::shift(std::vector &A, int const m, int const n, st // constructor ElectricTransformer::ElectricTransformer(EnergyPlusData &state, std::string const &objectName) - : myOneTimeFlag_(true), availSchedPtr_(0), usageMode_(TransformerUse::Invalid), heatLossesDestination_(ThermalLossDestination::Invalid), - zoneNum_(0), zoneRadFrac_(0.0), ratedCapacity_(0.0), factorTempCoeff_(0.0), tempRise_(0.0), eddyFrac_(0.0), + : myOneTimeFlag_(true), usageMode_(TransformerUse::Invalid), heatLossesDestination_(ThermalLossDestination::Invalid), zoneNum_(0), + zoneRadFrac_(0.0), ratedCapacity_(0.0), factorTempCoeff_(0.0), tempRise_(0.0), eddyFrac_(0.0), performanceInputMode_(TransformerPerformanceInput::Invalid), ratedEfficiency_(0.0), ratedPUL_(0.0), ratedTemp_(0.0), maxPUL_(0.0), considerLosses_(true), ratedNL_(0.0), ratedLL_(0.0), overloadErrorIndex_(0), efficiency_(0.0), powerIn_(0.0), energyIn_(0.0), powerOut_(0.0), energyOut_(0.0), noLoadLossRate_(0.0), noLoadLossEnergy_(0.0), loadLossRate_(0.0), loadLossEnergy_(0.0), thermalLossRate_(0.0), thermalLossEnergy_(0.0), elecUseMeteredUtilityLosses_(0.0), powerConversionMeteredLosses_(0.0), qdotConvZone_(0.0), qdotRadZone_(0.0) { static constexpr std::string_view routineName = "ElectricTransformer constructor "; + auto &s_ipsc = state.dataIPShortCut; + bool errorsFound = false; int transformerIDFObjectNum = 0; - state.dataIPShortCut->cCurrentModuleObject = "ElectricLoadCenter:Transformer"; + s_ipsc->cCurrentModuleObject = "ElectricLoadCenter:Transformer"; transformerIDFObjectNum = state.dataInputProcessing->inputProcessor->getObjectItemNum(state, "ElectricLoadCenter:Transformer", objectName); if (transformerIDFObjectNum > 0) { @@ -4659,137 +4505,110 @@ ElectricTransformer::ElectricTransformer(EnergyPlusData &state, std::string cons int numNums; // Number of elements in the numeric array int IOStat; // IO Status when calling get input subroutine state.dataInputProcessing->inputProcessor->getObjectItem(state, - state.dataIPShortCut->cCurrentModuleObject, + s_ipsc->cCurrentModuleObject, transformerIDFObjectNum, - state.dataIPShortCut->cAlphaArgs, + s_ipsc->cAlphaArgs, numAlphas, - state.dataIPShortCut->rNumericArgs, + s_ipsc->rNumericArgs, numNums, IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - name_ = state.dataIPShortCut->cAlphaArgs(1); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + name_ = s_ipsc->cAlphaArgs(1); // how to verify names are unique across objects? add to GlobalNames? - if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { - availSchedPtr_ = ScheduleManager::ScheduleAlwaysOn; - } else { - availSchedPtr_ = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); - if (availSchedPtr_ == 0) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); - errorsFound = true; - } + if (s_ipsc->lAlphaFieldBlanks(2)) { + availSched_ = Sched::GetScheduleAlwaysOn(state); + } else if ((availSched_ = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); + errorsFound = true; } - if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { + if (s_ipsc->lAlphaFieldBlanks(3)) { usageMode_ = TransformerUse::PowerInFromGrid; // default - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "PowerInFromGrid")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "PowerInFromGrid")) { usageMode_ = TransformerUse::PowerInFromGrid; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "PowerOutToGrid")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "PowerOutToGrid")) { usageMode_ = TransformerUse::PowerOutFromBldgToGrid; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "LoadCenterPowerConditioning")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "LoadCenterPowerConditioning")) { usageMode_ = TransformerUse::PowerBetweenLoadCenterAndBldg; - } else { - ShowWarningError( - state, - format("{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3))); + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3)); errorsFound = true; } - zoneNum_ = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(4), state.dataHeatBal->Zone); - if (zoneNum_ > 0) heatLossesDestination_ = ThermalLossDestination::ZoneGains; - if (zoneNum_ == 0) { - if (state.dataIPShortCut->lAlphaFieldBlanks(4)) { - heatLossesDestination_ = ThermalLossDestination::LostToOutside; - } else { - heatLossesDestination_ = ThermalLossDestination::LostToOutside; - ShowWarningError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4))); - ShowContinueError(state, "Zone name not found. Transformer heat losses will not be added to a zone"); - // continue with simulation but storage losses not sent to a zone. - } + if (s_ipsc->lAlphaFieldBlanks(4)) { + heatLossesDestination_ = ThermalLossDestination::LostToOutside; + } else if ((zoneNum_ = Util::FindItemInList(s_ipsc->cAlphaArgs(4), state.dataHeatBal->Zone)) == 0) { + heatLossesDestination_ = ThermalLossDestination::LostToOutside; + ShowWarningItemNotFound( + state, eoh, s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4), "Transformer heat losses will not be added to a zone"); + // continue with simulation but storage losses not sent to a zone. + } else { + heatLossesDestination_ = ThermalLossDestination::ZoneGains; } - zoneRadFrac_ = state.dataIPShortCut->rNumericArgs(1); - ratedCapacity_ = state.dataIPShortCut->rNumericArgs(2); - // unused phase_ = state.dataIPShortCut->rNumericArgs(3); - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(5), "Copper")) { + zoneRadFrac_ = s_ipsc->rNumericArgs(1); + ratedCapacity_ = s_ipsc->rNumericArgs(2); + // unused phase_ = s_ipsc->rNumericArgs(3); + + if (Util::SameString(s_ipsc->cAlphaArgs(5), "Copper")) { factorTempCoeff_ = 234.5; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(5), "Aluminum")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(5), "Aluminum")) { factorTempCoeff_ = 225.0; } else { - ShowSevereError( - state, - format("{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5))); + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaArgs(5)); errorsFound = true; } - tempRise_ = state.dataIPShortCut->rNumericArgs(4); - eddyFrac_ = state.dataIPShortCut->rNumericArgs(5); + tempRise_ = s_ipsc->rNumericArgs(4); + eddyFrac_ = s_ipsc->rNumericArgs(5); - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(6), "RatedLosses")) { + if (Util::SameString(s_ipsc->cAlphaArgs(6), "RatedLosses")) { performanceInputMode_ = TransformerPerformanceInput::LossesMethod; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(6), "NominalEfficiency")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(6), "NominalEfficiency")) { performanceInputMode_ = TransformerPerformanceInput::EfficiencyMethod; } else { - ShowSevereError( - state, - format("{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(6), state.dataIPShortCut->cAlphaArgs(6))); + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(6), s_ipsc->cAlphaArgs(6)); errorsFound = true; } + if (ratedCapacity_ == 0) { if (performanceInputMode_ == TransformerPerformanceInput::LossesMethod) { - ShowWarningError( - state, format("{}{}=\"{}\".", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Specified {} = {}", state.dataIPShortCut->cAlphaFieldNames(6), state.dataIPShortCut->cAlphaArgs(6))); - ShowContinueError(state, format("Specified {} = {:.1R}", state.dataIPShortCut->cNumericFieldNames(2), ratedCapacity_)); + ShowWarningError(state, format("{}{}=\"{}\".", routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Specified {} = {}", s_ipsc->cAlphaFieldNames(6), s_ipsc->cAlphaArgs(6))); + ShowContinueError(state, format("Specified {} = {:.1R}", s_ipsc->cNumericFieldNames(2), ratedCapacity_)); ShowContinueError(state, "Transformer load and no load losses cannot be calculated with 0.0 rated capacity."); ShowContinueError(state, "Simulation continues but transformer losses will be set to zero."); } } - ratedNL_ = state.dataIPShortCut->rNumericArgs(6); - ratedLL_ = state.dataIPShortCut->rNumericArgs(7); - ratedEfficiency_ = state.dataIPShortCut->rNumericArgs(8); - ratedPUL_ = state.dataIPShortCut->rNumericArgs(9); - ratedTemp_ = state.dataIPShortCut->rNumericArgs(10); - maxPUL_ = state.dataIPShortCut->rNumericArgs(11); + ratedNL_ = s_ipsc->rNumericArgs(6); + ratedLL_ = s_ipsc->rNumericArgs(7); + ratedEfficiency_ = s_ipsc->rNumericArgs(8); + ratedPUL_ = s_ipsc->rNumericArgs(9); + ratedTemp_ = s_ipsc->rNumericArgs(10); + maxPUL_ = s_ipsc->rNumericArgs(11); // Check the input for MaxPUL if the performance input method is EfficiencyMethod if (performanceInputMode_ == TransformerPerformanceInput::EfficiencyMethod) { - if (state.dataIPShortCut->lNumericFieldBlanks(11)) { + if (s_ipsc->lNumericFieldBlanks(11)) { maxPUL_ = ratedPUL_; } else if (maxPUL_ <= 0 || maxPUL_ > 1) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError( - state, format("Invalid {}=[{:.3R}].", state.dataIPShortCut->cNumericFieldNames(11), state.dataIPShortCut->rNumericArgs(11))); + ShowSevereError(state, format("{}{}=\"{}\", invalid entry.", routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {}=[{:.3R}].", s_ipsc->cNumericFieldNames(11), s_ipsc->rNumericArgs(11))); ShowContinueError(state, "Entered value must be > 0 and <= 1."); errorsFound = true; } } - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(7), "Yes")) { + if (Util::SameString(s_ipsc->cAlphaArgs(7), "Yes")) { considerLosses_ = true; - } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(7), "No")) { + } else if (Util::SameString(s_ipsc->cAlphaArgs(7), "No")) { considerLosses_ = false; } else { if (usageMode_ == TransformerUse::PowerInFromGrid) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", invalid entry.", routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(7), state.dataIPShortCut->cAlphaArgs(7))); + ShowSevereError(state, format("{}{}=\"{}\", invalid entry.", routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("Invalid {} = {}", s_ipsc->cAlphaFieldNames(7), s_ipsc->cAlphaArgs(7))); errorsFound = true; } } @@ -4811,7 +4630,7 @@ ElectricTransformer::ElectricTransformer(EnergyPlusData &state, std::string cons // Meter check deferred because they may have not been "loaded" yet, for (int loopCount = 0; loopCount < numWiredMeters; ++loopCount) { - wiredMeterNames_[loopCount] = Util::makeUPPER(state.dataIPShortCut->cAlphaArgs(loopCount + numAlphaBeforeMeter + 1)); + wiredMeterNames_[loopCount] = Util::makeUPPER(s_ipsc->cAlphaArgs(loopCount + numAlphaBeforeMeter + 1)); // Assign SpecialMeter as TRUE if the meter name is Electricity:Facility or Electricity:HVAC if (Util::SameString(wiredMeterNames_[loopCount], "Electricity:Facility") || Util::SameString(wiredMeterNames_[loopCount], "Electricity:HVAC")) { @@ -5037,7 +4856,7 @@ void ElectricTransformer::manageTransformers(EnergyPlusData &state, Real64 const } // switch usage mode // check availability schedule - if (ratedCapacity_ > 0.0 && ScheduleManager::GetCurrentScheduleValue(state, availSchedPtr_) > 0.0) { + if (ratedCapacity_ > 0.0 && availSched_->getCurrentVal() > 0.0) { Real64 pUL = elecLoad / ratedCapacity_; diff --git a/src/EnergyPlus/ElectricPowerServiceManager.hh b/src/EnergyPlus/ElectricPowerServiceManager.hh index 518c5b33aa3..b449661cfa9 100644 --- a/src/EnergyPlus/ElectricPowerServiceManager.hh +++ b/src/EnergyPlus/ElectricPowerServiceManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -171,8 +171,8 @@ private: // data Real64 qdotRadZone_; Real64 ancillACuseRate_; Real64 ancillACuseEnergy_; - InverterModelType modelType_; // type of inverter model used - int availSchedPtr_; // number for availability schedule. + InverterModelType modelType_; // type of inverter model used + Sched::Schedule *availSched_ = nullptr; // number for availability schedule. ThermalLossDestination heatLossesDestination_; int zoneNum_; // destination zone for heat losses from inverter. Real64 zoneRadFract_; // radiative fraction for thermal losses to zone @@ -238,9 +238,9 @@ private: // data Real64 qdotRadZone_; Real64 ancillACuseRate_; Real64 ancillACuseEnergy_; - int availSchedPtr_; // number for availability schedule. - ConverterModelType modelType_; // type of inverter model used - int curveNum_; // performance curve or table index + Sched::Schedule *availSched_ = nullptr; // number for availability schedule. + ConverterModelType modelType_; // type of inverter model used + int curveNum_; // performance curve or table index ThermalLossDestination heatLossesDestination_; int zoneNum_; // destination zone for heat losses from inverter. Real64 zoneRadFract_; // radiative fraction for thermal losses to zone @@ -371,7 +371,7 @@ private: // data int maxRainflowArrayBounds_; bool myWarmUpFlag_; StorageModelType storageModelMode_; // type of model parameter, SimpleBucketStorage - int availSchedPtr_; // availability schedule index. + Sched::Schedule *availSched_ = nullptr; // availability schedule index. ThermalLossDestination heatLossesDestination_; // mode for where thermal losses go int zoneNum_; // destination zone for heat losses from inverter. Real64 zoneRadFract_; // radiative fraction for thermal losses to zone @@ -495,7 +495,7 @@ private: // data std::string name_; // user identifier bool myOneTimeFlag_; - int availSchedPtr_; // availability schedule index. + Sched::Schedule *availSched_ = nullptr; // availability schedule TransformerUse usageMode_; // mode for transformer usage ThermalLossDestination heatLossesDestination_; // mode for where thermal losses go int zoneNum_; // destination zone for heat losses from inverter. @@ -572,8 +572,7 @@ public: // data // might make this class a friend of El std::string compPlantName; // name of plant component if heat recovery int generatorIndex; // index in generator model data struct Real64 maxPowerOut; // Maximum Power Output (W) - std::string availSched; // Operation Schedule. - int availSchedPtr; // pointer to operation schedule + Sched::Schedule *availSched = nullptr; // pointer to operation schedule Real64 powerRequestThisTimestep; // Current Demand on Equipment (W) bool onThisTimestep; // Indicator whether Generator on Real64 eMSPowerRequest; // EMS actuator for current demand on equipment (W) @@ -695,8 +694,8 @@ private: // data std::string generationMeterName_; // Name of Generated Energy Meter for "on demand" operation bool generatorsPresent_; // true if any generators bool myCoGenSetupFlag_; - Real64 demandLimit_; // Demand Limit in Watts(W) which the generator will operate above - int trackSchedPtr_; // "pointer" to schedule for electrical demand to meet. + Real64 demandLimit_; // Demand Limit in Watts(W) which the generator will operate above + Sched::Schedule *trackSched_ = nullptr; // schedule for electrical demand to meet. bool storagePresent_; std::string storageName_; // hold name for verificaton and error messages bool transformerPresent_; // should only be transformers for on-site load center, not facility service @@ -710,18 +709,18 @@ private: // data std::string converterName_; Real64 maxStorageSOCFraction_; // Fraction of storage capacity used as upper limit for controlling charging (don't overcharge the batteries) Real64 minStorageSOCFraction_; // Fraction of storage capacity used as lower limit for controlling discharging (dont drain the batteries too far) - Real64 designStorageChargePower_; // rate of electric power drawn from grid to go into storage - bool designStorageChargePowerWasSet_; // true if a value was input - Real64 designStorageDischargePower_; // rate of electric power exported to grid by being drawn from storage - bool designStorageDischargePowerWasSet_; // true if value was input - int storageChargeModSchedIndex_; // index of fraction schedule for controlling charge rate over time - int storageDischargeModSchedIndex_; // index of fraction schedule for controlling discharge rate over time. - Real64 facilityDemandTarget_; // target utility demand level in Watts - int facilityDemandTargetModSchedIndex_; // index of fracton schedule for controlling target demand over time. - bool eMSOverridePelFromStorage_; // if true, EMS calling for override - Real64 eMSValuePelFromStorage_; // value EMS is directing to use, power from storage [W] - bool eMSOverridePelIntoStorage_; // if true, EMS calling for override - Real64 eMSValuePelIntoStorage_; // value EMS is directing to use, power into storage [W] + Real64 designStorageChargePower_; // rate of electric power drawn from grid to go into storage + bool designStorageChargePowerWasSet_; // true if a value was input + Real64 designStorageDischargePower_; // rate of electric power exported to grid by being drawn from storage + bool designStorageDischargePowerWasSet_; // true if value was input + Sched::Schedule *storageChargeModSched_ = nullptr; // index of fraction schedule for controlling charge rate over time + Sched::Schedule *storageDischargeModSched_ = nullptr; // index of fraction schedule for controlling discharge rate over time. + Real64 facilityDemandTarget_; // target utility demand level in Watts + Sched::Schedule *facilityDemandTargetModSched_ = nullptr; // index of fracton schedule for controlling target demand over time. + bool eMSOverridePelFromStorage_; // if true, EMS calling for override + Real64 eMSValuePelFromStorage_; // value EMS is directing to use, power from storage [W] + bool eMSOverridePelIntoStorage_; // if true, EMS calling for override + Real64 eMSValuePelIntoStorage_; // value EMS is directing to use, power into storage [W] }; // class ElectPowerLoadCenter @@ -828,6 +827,10 @@ struct ElectPwrSvcMgrData : BaseGlobalStruct std::unique_ptr facilityElectricServiceObj; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/EnergyPlus.hh b/src/EnergyPlus/EnergyPlus.hh index 9d1f11abe98..70129d3c13c 100644 --- a/src/EnergyPlus/EnergyPlus.hh +++ b/src/EnergyPlus/EnergyPlus.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -137,7 +137,7 @@ using ObjexxFCL::Vector4; // ObjexxFCL Functions #include -#include +// #include #include #include #include diff --git a/src/EnergyPlus/EnergyPlusLogger.cc b/src/EnergyPlus/EnergyPlusLogger.cc index e0f6e396d00..eb2961e022e 100644 --- a/src/EnergyPlus/EnergyPlusLogger.cc +++ b/src/EnergyPlus/EnergyPlusLogger.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/EnergyPlusLogger.hh b/src/EnergyPlus/EnergyPlusLogger.hh index d553e621c4b..47d686123c0 100644 --- a/src/EnergyPlus/EnergyPlusLogger.hh +++ b/src/EnergyPlus/EnergyPlusLogger.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/EvaporativeCoolers.cc b/src/EnergyPlus/EvaporativeCoolers.cc index ae2801a861e..f69b28bc03a 100644 --- a/src/EnergyPlus/EvaporativeCoolers.cc +++ b/src/EnergyPlus/EvaporativeCoolers.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -93,7 +93,7 @@ namespace EnergyPlus::EvaporativeCoolers { // AUTHOR Richard J. Liesen // DATE WRITTEN Oct 2000 // MODIFIED BG July 2003 ResearchSpecial Indirect -// BG Febraury 2007 outside air nodes +// BG February 2007 outside air nodes // BG March 2009 ResearchSpecial Direct // RE-ENGINEERED na @@ -214,6 +214,8 @@ void GetEvapInput(EnergyPlusData &state) // METHODOLOGY EMPLOYED: // Uses the status flags to trigger events. + static constexpr std::string_view routineName = "GetEvapInput"; + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumDirectEvapCool; // The number of Direct CelDek EvapCooler in this simulation int NumDryInDirectEvapCool; // The number of dry indirect evap coolers @@ -264,25 +266,25 @@ void GetEvapInput(EnergyPlusData &state) state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + GlobalNames::VerifyUniqueInterObjectName(state, UniqueEvapCondNames, state.dataIPShortCut->cAlphaArgs(1), cCurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), ErrorsFound); + thisEvapCooler.Name = state.dataIPShortCut->cAlphaArgs(1); thisEvapCooler.evapCoolerType = EvapCoolerType::DirectCELDEKPAD; thisEvapCooler.Schedule = state.dataIPShortCut->cAlphaArgs(2); if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { - thisEvapCooler.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisEvapCooler.SchedPtr = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); - if (thisEvapCooler.SchedPtr == 0) { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ErrorsFound = true; - } + thisEvapCooler.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisEvapCooler.availSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2)); + ErrorsFound = true; } thisEvapCooler.InletNode = GetOnlySingleNode(state, @@ -363,6 +365,9 @@ void GetEvapInput(EnergyPlusData &state) state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + GlobalNames::VerifyUniqueInterObjectName(state, UniqueEvapCondNames, state.dataIPShortCut->cAlphaArgs(1), @@ -374,14 +379,10 @@ void GetEvapInput(EnergyPlusData &state) thisEvapCooler.Schedule = state.dataIPShortCut->cAlphaArgs(2); if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { - thisEvapCooler.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisEvapCooler.SchedPtr = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); - if (thisEvapCooler.SchedPtr == 0) { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ErrorsFound = true; - } + thisEvapCooler.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisEvapCooler.availSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2)); + ErrorsFound = true; } thisEvapCooler.InletNode = GetOnlySingleNode(state, @@ -494,6 +495,9 @@ void GetEvapInput(EnergyPlusData &state) state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + GlobalNames::VerifyUniqueInterObjectName(state, UniqueEvapCondNames, state.dataIPShortCut->cAlphaArgs(1), @@ -505,14 +509,10 @@ void GetEvapInput(EnergyPlusData &state) thisEvapCooler.Schedule = state.dataIPShortCut->cAlphaArgs(2); if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { - thisEvapCooler.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisEvapCooler.SchedPtr = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); - if (thisEvapCooler.SchedPtr == 0) { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ErrorsFound = true; - } + thisEvapCooler.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisEvapCooler.availSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2)); + ErrorsFound = true; } thisEvapCooler.InletNode = GetOnlySingleNode(state, @@ -616,6 +616,8 @@ void GetEvapInput(EnergyPlusData &state) state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; GlobalNames::VerifyUniqueInterObjectName(state, UniqueEvapCondNames, state.dataIPShortCut->cAlphaArgs(1), @@ -627,14 +629,10 @@ void GetEvapInput(EnergyPlusData &state) thisEvapCooler.Schedule = state.dataIPShortCut->cAlphaArgs(2); if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { - thisEvapCooler.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisEvapCooler.SchedPtr = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); - if (thisEvapCooler.SchedPtr == 0) { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ErrorsFound = true; - } + thisEvapCooler.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisEvapCooler.availSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2)); + ErrorsFound = true; } thisEvapCooler.InletNode = GetOnlySingleNode(state, @@ -818,6 +816,8 @@ void GetEvapInput(EnergyPlusData &state) state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; GlobalNames::VerifyUniqueInterObjectName(state, UniqueEvapCondNames, state.dataIPShortCut->cAlphaArgs(1), @@ -829,14 +829,10 @@ void GetEvapInput(EnergyPlusData &state) thisEvapCooler.Schedule = state.dataIPShortCut->cAlphaArgs(2); if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { - thisEvapCooler.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisEvapCooler.SchedPtr = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); - if (thisEvapCooler.SchedPtr == 0) { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ErrorsFound = true; - } + thisEvapCooler.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisEvapCooler.availSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2)); + ErrorsFound = true; } thisEvapCooler.InletNode = GetOnlySingleNode(state, @@ -1189,7 +1185,7 @@ void SizeEvapCooler(EnergyPlusData &state, int const EvapCoolNum) if (CurSysNum > 0) { CheckThisAirSystemForSizing(state, CurSysNum, SizingDesRunThisAirSys); if (SizingDesRunThisAirSys) { - HardSizeNoDesRun = false; // Check if design infomation is available + HardSizeNoDesRun = false; // Check if design information is available } } if (CurZoneEqNum > 0) { @@ -1199,7 +1195,7 @@ void SizeEvapCooler(EnergyPlusData &state, int const EvapCoolNum) // This check was commented to get back to original code and an issue is needed to correct. // Why no check for zone equipment? // if (SizingDesRunThisZone) { - // HardSizeNoDesRun = false; // Check if design infomation is available + // HardSizeNoDesRun = false; // Check if design information is available //} } // I don't think the sizing logic is correct when it comes to autosized vs hard-sized inputs @@ -1400,7 +1396,7 @@ void SizeEvapCooler(EnergyPlusData &state, int const EvapCoolNum) if (CurSysNum > 0 && !IsAutoSize && !SizingDesRunThisAirSys) { HardSizeNoDesRun = true; } - if (SizingDesRunThisAirSys) HardSizeNoDesRun = false; // Check if design infomation is available + if (SizingDesRunThisAirSys) HardSizeNoDesRun = false; // Check if design information is available // Design air flow rate if (CurSysNum > 0) { // central system if (!IsAutoSize && !SizingDesRunThisAirSys) { @@ -1516,7 +1512,7 @@ void SizeEvapCooler(EnergyPlusData &state, int const EvapCoolNum) IsAutoSize = true; } if (SizingDesRunThisAirSys) { - HardSizeNoDesRun = false; // Check if design infomation is available + HardSizeNoDesRun = false; // Check if design information is available } // Design air flow rate if (CurSysNum > 0) { // central system @@ -1691,7 +1687,7 @@ void CalcDirectEvapCooler(EnergyPlusData &state, int EvapCoolNum, Real64 const P // If the Evaporative Cooler is operating there should be some mass flow rate // Also the evap cooler has to be scheduled to be available - if ((thisEvapCond.InletMassFlowRate > 0.0) && (ScheduleManager::GetCurrentScheduleValue(state, thisEvapCond.SchedPtr) > 0.0)) { + if ((thisEvapCond.InletMassFlowRate > 0.0) && (thisEvapCond.availSched->getCurrentVal() > 0.0)) { PadDepth = thisEvapCond.PadDepth; //****************************************************************************** @@ -1735,7 +1731,7 @@ void CalcDirectEvapCooler(EnergyPlusData &state, int EvapCoolNum, Real64 const P //*************************************************************************** // ENERGY CONSUMED BY THE RECIRCULATING PUMP - // Add the pump energy to the total Evap Cooler energy comsumption + // Add the pump energy to the total Evap Cooler energy consumption thisEvapCond.EvapCoolerPower += PartLoadRatio * thisEvapCond.RecircPumpPower; //****************** // WATER CONSUMPTION IN m3 OF WATER FOR DIRECT @@ -1797,7 +1793,7 @@ void CalcDryIndirectEvapCooler(EnergyPlusData &state, int EvapCoolNum, Real64 co // If the Evaporative Cooler is operating there should be some mass flow rate // Also the evap cooler has to be scheduled to be available - if ((thisEvapCond.InletMassFlowRate > 0.0) && (ScheduleManager::GetCurrentScheduleValue(state, thisEvapCond.SchedPtr) > 0.0)) { + if ((thisEvapCond.InletMassFlowRate > 0.0) && (thisEvapCond.availSched->getCurrentVal() > 0.0)) { PadDepth = thisEvapCond.IndirectPadDepth; //****************************************************************************** @@ -1839,12 +1835,12 @@ void CalcDryIndirectEvapCooler(EnergyPlusData &state, int EvapCoolNum, Real64 co CpAir = Psychrometrics::PsyCpAirFnW(thisEvapCond.InletHumRat); RhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, thisEvapCond.InletTemp, thisEvapCond.InletHumRat); CFMAir = thisEvapCond.VolFlowRate; // Volume Flow Rate Primary Side - CFMSec = thisEvapCond.IndirectVolFlowRate; // Volume Flolw Rate Secondary Side + CFMSec = thisEvapCond.IndirectVolFlowRate; // Volume Flow Rate Secondary Side QHX = EffHX * min(CFMSec, CFMAir) * RhoAir * CpAir * (thisEvapCond.InletTemp - TDBSec); thisEvapCond.OutletTemp = thisEvapCond.InletTemp - QHX / (RhoAir * CFMAir * CpAir); // This is a rough approximation of the Total Indirect Stage Efficiency for the Dry stage which - // is a 2 step process the first being teh pad efficiency and then the HX Effectiveness. I think that + // is a 2 step process the first being the pad efficiency and then the HX Effectiveness. I think that // this would mainly be used for evap sizing purposes. thisEvapCond.StageEff = SatEff * EffHX; //*************************************************************************** @@ -1870,7 +1866,7 @@ void CalcDryIndirectEvapCooler(EnergyPlusData &state, int EvapCoolNum, Real64 co // ENERGY CONSUMED BY THE RECIRCULATING PUMP // ENERGY CONSUMED BY THE RECIRCULATING PUMP - // Add the pump energy to the total Evap Cooler energy comsumption + // Add the pump energy to the total Evap Cooler energy consumption thisEvapCond.EvapCoolerPower += PartLoadRatio * thisEvapCond.IndirectRecircPumpPower; //****************** @@ -1933,7 +1929,7 @@ void CalcWetIndirectEvapCooler(EnergyPlusData &state, int EvapCoolNum, Real64 co // If the Evaporative Cooler is operating there should be some mass flow rate // Also the evap cooler has to be scheduled to be available - if ((thisEvapCond.InletMassFlowRate > 0.0) && (ScheduleManager::GetCurrentScheduleValue(state, thisEvapCond.SchedPtr) > 0.0)) { + if ((thisEvapCond.InletMassFlowRate > 0.0) && (thisEvapCond.availSched->getCurrentVal() > 0.0)) { //****************************************************************************** // THIS SUBROUTINE WILL CACULATE THE TEMPERATURE OF THE LEAVING AIR DRY BULB @@ -1941,7 +1937,7 @@ void CalcWetIndirectEvapCooler(EnergyPlusData &state, int EvapCoolNum, Real64 co //****************************************************************************** // INDIRECT STAGE EFFICIENCY FOR WET COIL INDIRECT EVAP COOLERS CFMAir = thisEvapCond.VolFlowRate; // Volume Flow Rate Primary Side - CFMSec = thisEvapCond.IndirectVolFlowRate; // Volume Flolw Rate Secondary Side + CFMSec = thisEvapCond.IndirectVolFlowRate; // Volume Flow Rate Secondary Side StageEff = thisEvapCond.WetCoilMaxEfficiency - min(thisEvapCond.WetCoilFlowRatio * CFMAir / CFMSec, thisEvapCond.WetCoilMaxEfficiency); @@ -1999,7 +1995,7 @@ void CalcWetIndirectEvapCooler(EnergyPlusData &state, int EvapCoolNum, Real64 co // ENERGY CONSUMED BY THE RECIRCULATING PUMP // ENERGY CONSUMED BY THE RECIRCULATING PUMP - // Add the pump energy to the total Evap Cooler energy comsumption + // Add the pump energy to the total Evap Cooler energy consumption thisEvapCond.EvapCoolerPower += PartLoadRatio * thisEvapCond.IndirectRecircPumpPower; //****************** @@ -2064,8 +2060,7 @@ void CalcResearchSpecialPartLoad(EnergyPlusData &state, int EvapCoolNum) Real64 PartLoadFrac = 0.0; // If Evap Cooler runs with a cooling load then set PartLoadFrac on Cooling System and the Mass Flow - if ((ScheduleManager::GetCurrentScheduleValue(state, thisEvapCond.SchedPtr) > 0.0) && - (state.dataLoopNodes->Node(InletNode).MassFlowRate > MinAirMassFlow) && + if ((thisEvapCond.availSched->getCurrentVal() > 0.0) && (state.dataLoopNodes->Node(InletNode).MassFlowRate > MinAirMassFlow) && (state.dataLoopNodes->Node(InletNode).Temp > state.dataLoopNodes->Node(ControlNode).TempSetPoint) && (std::abs(state.dataLoopNodes->Node(InletNode).Temp - DesOutTemp) > HVAC::TempControlTol)) { @@ -2173,7 +2168,7 @@ void CalcIndirectResearchSpecialEvapCooler(EnergyPlusData &state, int const Evap // If the Evaporative Cooler is operating there should be some mass flow rate // Also the evap cooler has to be scheduled to be available - if ((thisEvapCond.InletMassFlowRate > 0.0) && (ScheduleManager::GetCurrentScheduleValue(state, thisEvapCond.SchedPtr) > 0.0)) { + if ((thisEvapCond.InletMassFlowRate > 0.0) && (thisEvapCond.availSched->getCurrentVal() > 0.0)) { //****************************************************************************** // THIS SUBROUTINE WILL CACULATE THE TEMPERATURE OF THE LEAVING AIR DRY BULB @@ -2215,7 +2210,7 @@ void CalcIndirectResearchSpecialEvapCooler(EnergyPlusData &state, int const Evap SecVdot = TotalVolFlow - TertVdot; - if (SecVdot < 0.0) { // all tertiary/releif air e.g. econonizer wide open + if (SecVdot < 0.0) { // all tertiary/relief air e.g. economizer wide open SecVdot = 0.0; SecondaryInletDryBulbTemp = TertTemp; SecondaryInletWetBulbTemp = Psychrometrics::PsyTwbFnTdbWPb(state, TertTemp, TertHumRate, state.dataEnvrn->OutBaroPress); @@ -2250,7 +2245,7 @@ void CalcIndirectResearchSpecialEvapCooler(EnergyPlusData &state, int const Evap } } if (thisEvapCond.EvapCoolerOperationControlFlag) { - // addvanced mode: runs either in dry or wet depending on the entering conditions + // advanced mode: runs either in dry or wet depending on the entering conditions CalcIndirectResearchSpecialEvapCoolerAdvanced( state, EvapCoolNum, SecondaryInletDryBulbTemp, SecondaryInletWetBulbTemp, SecondaryInletDewPointTemp, SecondaryInletHumRatio); @@ -2292,7 +2287,7 @@ void CalcIndirectResearchSpecialEvapCooler(EnergyPlusData &state, int const Evap // ENERGY CONSUMED BY THE RECIRCULATING PUMP // ENERGY CONSUMED BY THE RECIRCULATING PUMP - // Add the pump energy to the total Evap Cooler energy comsumption + // Add the pump energy to the total Evap Cooler energy consumption thisEvapCond.EvapCoolerPower += thisEvapCond.IndirectRecircPumpPower * PartLoad * FanPLR; //*************************************************************************** @@ -2301,7 +2296,7 @@ void CalcIndirectResearchSpecialEvapCooler(EnergyPlusData &state, int const Evap thisEvapCond.OuletWetBulbTemp = Psychrometrics::PsyTwbFnTdbWPb(state, thisEvapCond.OutletTemp, thisEvapCond.InletHumRat, state.dataEnvrn->OutBaroPress); //*************************************************************************** - // CALCULATE other outlet propertiesusing PSYCH ROUTINES + // CALCULATE other outlet properties using PSYCH ROUTINES thisEvapCond.OutletHumRat = thisEvapCond.InletHumRat; thisEvapCond.OutletEnthalpy = Psychrometrics::PsyHFnTdbW(thisEvapCond.OutletTemp, thisEvapCond.OutletHumRat); @@ -2360,7 +2355,7 @@ void CalcIndirectResearchSpecialEvapCoolerAdvanced(EnergyPlusData &state, { // SUBROUTINE INFORMATION: - // AUTHOR B. Bigusse + // AUTHOR B. Nigusse // DATE WRITTEN October 2014 // PURPOSE OF THIS SUBROUTINE: @@ -2369,7 +2364,7 @@ void CalcIndirectResearchSpecialEvapCoolerAdvanced(EnergyPlusData &state, // SUBROUTINE PARAMETER DEFINITIONS: int constexpr MaxIte(500); // Maximum number of iterations for solver - Real64 constexpr TempTol(0.01); // convergence tollerance + Real64 constexpr TempTol(0.01); // convergence tolerance // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 BoundTemp; // temperature limit for outlet @@ -2423,7 +2418,7 @@ void CalcIndirectResearchSpecialEvapCoolerAdvanced(EnergyPlusData &state, EvapCond.SecInletMassFlowRate = AirMassFlowSec; CalcIndirectRDDEvapCoolerOutletTemp( state, EvapCoolNum, OperatingMode::DryModulated, AirMassFlowSec, InletDryBulbTempSec, InletWetBulbTempSec, InletHumRatioSec); - Real64 const OutletAirTemp = EvapCond.OutletTemp; // evap Coler outlet air temperature + Real64 const OutletAirTemp = EvapCond.OutletTemp; // evap Cooler outlet air temperature return SysTempSetPoint - OutletAirTemp; }; int SolFla = 0; // Flag of solver @@ -2489,7 +2484,7 @@ void CalcIndirectResearchSpecialEvapCoolerAdvanced(EnergyPlusData &state, EvapCond.SecInletMassFlowRate = AirMassFlowSec; CalcIndirectRDDEvapCoolerOutletTemp( state, EvapCoolNum, OperatingMode::DryModulated, AirMassFlowSec, InletDryBulbTempSec, InletWetBulbTempSec, InletHumRatioSec); - Real64 const OutletAirTemp = EvapCond.OutletTemp; // evap Coler outlet air temperature + Real64 const OutletAirTemp = EvapCond.OutletTemp; // evap Cooler outlet air temperature return SysTempSetPoint - OutletAirTemp; }; int SolFla = 0; // Flag of solver @@ -2548,7 +2543,7 @@ void CalcIndirectResearchSpecialEvapCoolerAdvanced(EnergyPlusData &state, EvapCond.SecInletMassFlowRate = AirMassFlowSec; CalcIndirectRDDEvapCoolerOutletTemp( state, EvapCoolNum, OperatingMode::WetModulated, AirMassFlowSec, InletDryBulbTempSec, InletWetBulbTempSec, InletHumRatioSec); - Real64 const OutletAirTemp = EvapCond.OutletTemp; // evap Coler outlet air temperature + Real64 const OutletAirTemp = EvapCond.OutletTemp; // evap Cooler outlet air temperature return SysTempSetPoint - OutletAirTemp; }; General::SolveRoot(state, TempTol, MaxIte, SolFla, AirMassFlowSec, f2, MassFlowRateSecMin, MassFlowRateSecMax); @@ -2624,7 +2619,7 @@ void CalcIndirectResearchSpecialEvapCoolerAdvanced(EnergyPlusData &state, EvapCond.SecInletMassFlowRate = AirMassFlowSec; CalcIndirectRDDEvapCoolerOutletTemp( state, EvapCoolNum, OperatingMode::WetModulated, AirMassFlowSec, InletDryBulbTempSec, InletWetBulbTempSec, InletHumRatioSec); - Real64 const OutletAirTemp = EvapCond.OutletTemp; // evap Coler outlet air temperature + Real64 const OutletAirTemp = EvapCond.OutletTemp; // evap Cooler outlet air temperature return SysTempSetPoint - OutletAirTemp; }; int SolFla = 0; // Flag of solver @@ -2795,7 +2790,7 @@ OperatingMode IndirectResearchSpecialEvapCoolerOperatingMode(EnergyPlusData &sta // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 InletDryBulbTempPri; // entering air dry bulb temperature of primary air Real64 SysTempSetPoint; // evaporative cooler outlet setpoint temperature, drybulb - OperatingMode OperatingMode; // current operating mode of indrect evaporative cooler + OperatingMode OperatingMode; // current operating mode of indirect evaporative cooler auto const &thisEvapCond = state.dataEvapCoolers->EvapCond(EvapCoolNum); @@ -2839,7 +2834,7 @@ void CalcIndirectRDDEvapCoolerOutletTemp(EnergyPlusData &state, // DATE WRITTEN Sep 2014 // PURPOSE OF THIS SUBROUTINE: - // Indirect research special evaporative cooler perfomance: + // Indirect research special evaporative cooler performance: // determines the IEC primary air outlet temperature // METHODOLOGY EMPLOYED: @@ -2954,7 +2949,7 @@ void CalcSecondaryAirOutletCondition(EnergyPlusData &state, // METHODOLOGY EMPLOYED: // applies energy balance equations to determine the secondary air outlet condition // For wt operations assumes the secondary air leaves at at inlet temperature, i.e., - // latent heat transfer only. For dry operation the humdity ratio remains constant. + // latent heat transfer only. For dry operation the humidity ratio remains constant. // REFERENCES: // CalculateWaterUsage routine of cooling towers for wet operation mode @@ -2963,7 +2958,7 @@ void CalcSecondaryAirOutletCondition(EnergyPlusData &state, Real64 SecOutletAirHumRat; // secondary air humidity ratio at the outlet node Real64 SecOutletEnthalpy; // secondary air outlet enthalpy Real64 CpAirSec; // specific heat of secondary air at inlet condition - Real64 hfg; // secondary air side enthaly of evaporation + Real64 hfg; // secondary air side enthalpy of evaporation auto &thisEvapCond(state.dataEvapCoolers->EvapCond(EvapCoolNum)); @@ -3092,8 +3087,7 @@ void CalcDirectResearchSpecialEvapCooler(EnergyPlusData &state, int const EvapCo // If the Evaporative Cooler is operating there should be some mass flow rate // Also the evap cooler has to be scheduled to be available - if ((thisEvapCond.InletMassFlowRate > 0.0) && (ScheduleManager::GetCurrentScheduleValue(state, thisEvapCond.SchedPtr) > 0.0) && - EvapCoolerOperatingLimitFlag) { + if ((thisEvapCond.InletMassFlowRate > 0.0) && (thisEvapCond.availSched->getCurrentVal() > 0.0) && EvapCoolerOperatingLimitFlag) { //*************************************************************************** // TEMP LEAVING DRY BULB IS CALCULATED FROM SATURATION EFFICIENCY AS THE @@ -3419,15 +3413,10 @@ void GetInputZoneEvaporativeCoolerUnit(EnergyPlusData &state) auto &thisZoneEvapUnit = ZoneEvapUnit(UnitLoop); thisZoneEvapUnit.Name = Alphas(1); if (lAlphaBlanks(2)) { - thisZoneEvapUnit.AvailSchedIndex = ScheduleManager::ScheduleAlwaysOn; - } else { - thisZoneEvapUnit.AvailSchedIndex = ScheduleManager::GetScheduleIndex(state, - Alphas(2)); // convert schedule name to pointer (index number) - if (thisZoneEvapUnit.AvailSchedIndex == 0) { - ShowSevereError(state, format("{}=\"{}\" invalid data.", CurrentModuleObject, thisZoneEvapUnit.Name)); - ShowContinueError(state, format("invalid-not found {}=\"{}\".", cAlphaFields(2), Alphas(2))); - ErrorsFound = true; - } + thisZoneEvapUnit.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisZoneEvapUnit.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } if (!lAlphaBlanks(3)) { @@ -3481,7 +3470,7 @@ void GetInputZoneEvaporativeCoolerUnit(EnergyPlusData &state) thisZoneEvapUnit.FanInletNodeNum = fan->inletNodeNum; thisZoneEvapUnit.FanOutletNodeNum = fan->outletNodeNum; thisZoneEvapUnit.ActualFanVolFlowRate = fan->maxAirFlowRate; - thisZoneEvapUnit.FanAvailSchedPtr = fan->availSchedNum; + thisZoneEvapUnit.fanAvailSched = fan->availSched; } // set evap unit to cycling mode for all fan types. Note OpMode var is not used @@ -3788,20 +3777,17 @@ void InitZoneEvaporativeCoolerUnit(EnergyPlusData &state, } } - if (zoneEvapUnit.FanAvailSchedPtr > 0) { + if (zoneEvapUnit.fanAvailSched != nullptr) { // include fan is not available, then unit is not available - zoneEvapUnit.UnitIsAvailable = ((ScheduleManager::GetCurrentScheduleValue(state, zoneEvapUnit.FanAvailSchedPtr) > 0.0) && - (ScheduleManager::GetCurrentScheduleValue(state, zoneEvapUnit.AvailSchedIndex) > 0.0)); + zoneEvapUnit.UnitIsAvailable = ((zoneEvapUnit.fanAvailSched->getCurrentVal() > 0.0) && (zoneEvapUnit.availSched->getCurrentVal() > 0.0)); } else { - zoneEvapUnit.UnitIsAvailable = (ScheduleManager::GetCurrentScheduleValue(state, zoneEvapUnit.AvailSchedIndex) > 0.0); + zoneEvapUnit.UnitIsAvailable = (zoneEvapUnit.availSched->getCurrentVal() > 0.0); } - zoneEvapUnit.EvapCooler_1_AvailStatus = - (ScheduleManager::GetCurrentScheduleValue(state, state.dataEvapCoolers->EvapCond(zoneEvapUnit.EvapCooler_1_Index).SchedPtr) > 0.0); + zoneEvapUnit.EvapCooler_1_AvailStatus = (state.dataEvapCoolers->EvapCond(zoneEvapUnit.EvapCooler_1_Index).availSched->getCurrentVal() > 0.0); if (zoneEvapUnit.EvapCooler_2_Index > 0) { - zoneEvapUnit.EvapCooler_2_AvailStatus = - (ScheduleManager::GetCurrentScheduleValue(state, state.dataEvapCoolers->EvapCond(zoneEvapUnit.EvapCooler_2_Index).SchedPtr) > 0.0); + zoneEvapUnit.EvapCooler_2_AvailStatus = (state.dataEvapCoolers->EvapCond(zoneEvapUnit.EvapCooler_2_Index).availSched->getCurrentVal() > 0.0); } // Do the Begin Environment initializations if (state.dataGlobal->BeginEnvrnFlag && zoneEvapUnit.MyEnvrn) { @@ -4022,8 +4008,10 @@ void CalcZoneEvaporativeCoolerUnit(EnergyPlusData &state, if (zoneEvapUnit.ControlSchemeType == ControlType::ZoneTemperatureDeadBandOnOffCycling) { ZoneTemp = state.dataLoopNodes->Node(zoneEvapUnit.ZoneNodeNum).Temp; - CoolSetLowThrottle = state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ZoneNum) - (0.5 * zoneEvapUnit.ThrottlingRange); - CoolSetHiThrottle = state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ZoneNum) + (0.5 * zoneEvapUnit.ThrottlingRange); + + auto const &zoneTstatSetpt = state.dataHeatBalFanSys->zoneTstatSetpts(ZoneNum); + CoolSetLowThrottle = zoneTstatSetpt.setptHi - (0.5 * zoneEvapUnit.ThrottlingRange); + CoolSetHiThrottle = zoneTstatSetpt.setptHi + (0.5 * zoneEvapUnit.ThrottlingRange); if ((ZoneTemp < CoolSetLowThrottle) || !zoneEvapUnit.UnitIsAvailable) { zoneEvapUnit.IsOnThisTimestep = false; diff --git a/src/EnergyPlus/EvaporativeCoolers.hh b/src/EnergyPlus/EvaporativeCoolers.hh index 9b72aa49005..0f3bacdb1b2 100644 --- a/src/EnergyPlus/EvaporativeCoolers.hh +++ b/src/EnergyPlus/EvaporativeCoolers.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -110,12 +110,12 @@ namespace EvaporativeCoolers { { std::string Name; // Name of the EvapCooler int EquipIndex; - EvapCoolerType evapCoolerType; // Type of the EvapCooler - std::string EvapControlType; // Type of Control for the EvapCooler - std::string Schedule; // HeatingCoil Operation Schedule - int SchedPtr; // Pointer to the correct schedule - Real64 VolFlowRate; // Volume Flow Rate in Evap Cooler needed for calculating SatEff - Real64 DesVolFlowRate; // Design volume flow rate (autosize or user input) - this is only used to compute design pump power + EvapCoolerType evapCoolerType; // Type of the EvapCooler + std::string EvapControlType; // Type of Control for the EvapCooler + std::string Schedule; // HeatingCoil Operation Schedule + Sched::Schedule *availSched = nullptr; // Pointer to the correct schedule + Real64 VolFlowRate; // Volume Flow Rate in Evap Cooler needed for calculating SatEff + Real64 DesVolFlowRate; // Design volume flow rate (autosize or user input) - this is only used to compute design pump power Real64 OutletTemp; Real64 OuletWetBulbTemp; Real64 OutletHumRat; @@ -209,11 +209,11 @@ namespace EvaporativeCoolers { // Default Constructor EvapConditions() - : EquipIndex(0), evapCoolerType(EvapCoolerType::Invalid), SchedPtr(0), VolFlowRate(0.0), DesVolFlowRate(0.0), OutletTemp(0.0), - OuletWetBulbTemp(0.0), OutletHumRat(0.0), OutletEnthalpy(0.0), OutletPressure(0.0), OutletMassFlowRate(0.0), - OutletMassFlowRateMaxAvail(0.0), OutletMassFlowRateMinAvail(0.0), InitFlag(false), InletNode(0), OutletNode(0), SecondaryInletNode(0), - SecondaryOutletNode(0), TertiaryInletNode(0), InletMassFlowRate(0.0), InletMassFlowRateMaxAvail(0.0), InletMassFlowRateMinAvail(0.0), - InletTemp(0.0), InletWetBulbTemp(0.0), InletHumRat(0.0), InletEnthalpy(0.0), InletPressure(0.0), SecInletMassFlowRate(0.0), + : EquipIndex(0), evapCoolerType(EvapCoolerType::Invalid), VolFlowRate(0.0), DesVolFlowRate(0.0), OutletTemp(0.0), OuletWetBulbTemp(0.0), + OutletHumRat(0.0), OutletEnthalpy(0.0), OutletPressure(0.0), OutletMassFlowRate(0.0), OutletMassFlowRateMaxAvail(0.0), + OutletMassFlowRateMinAvail(0.0), InitFlag(false), InletNode(0), OutletNode(0), SecondaryInletNode(0), SecondaryOutletNode(0), + TertiaryInletNode(0), InletMassFlowRate(0.0), InletMassFlowRateMaxAvail(0.0), InletMassFlowRateMinAvail(0.0), InletTemp(0.0), + InletWetBulbTemp(0.0), InletHumRat(0.0), InletEnthalpy(0.0), InletPressure(0.0), SecInletMassFlowRate(0.0), SecInletMassFlowRateMaxAvail(0.0), SecInletMassFlowRateMinAvail(0.0), SecInletTemp(0.0), SecInletWetBulbTemp(0.0), SecInletHumRat(0.0), SecInletEnthalpy(0.0), SecInletPressure(0.0), SecOutletTemp(0.0), SecOuletWetBulbTemp(0.0), SecOutletHumRat(0.0), SecOutletEnthalpy(0.0), SecOutletMassFlowRate(0.0), PadDepth(0.0), PadArea(0.0), RecircPumpPower(0.0), IndirectRecircPumpPower(0.0), @@ -236,8 +236,8 @@ namespace EvaporativeCoolers { { std::string Name; // user identifier int ZoneNodeNum; - int AvailSchedIndex; // pointer to local availability schedule - std::string AvailManagerListName; // Name of an availability manager list object + Sched::Schedule *availSched = nullptr; // local availability schedule + std::string AvailManagerListName; // Name of an availability manager list object bool UnitIsAvailable; Avail::Status FanAvailStatus = Avail::Status::NoAction; int OAInletNodeNum; // outdoor air inlet node index @@ -247,7 +247,7 @@ namespace EvaporativeCoolers { std::string FanName; int FanIndex; Real64 ActualFanVolFlowRate; - int FanAvailSchedPtr; + Sched::Schedule *fanAvailSched = nullptr; int FanInletNodeNum; int FanOutletNodeNum; HVAC::FanOp fanOp = HVAC::FanOp::Invalid; @@ -307,19 +307,19 @@ namespace EvaporativeCoolers { // Default Constructor ZoneEvapCoolerUnitStruct() - : ZoneNodeNum(0), AvailSchedIndex(0), UnitIsAvailable(false), OAInletNodeNum(0), UnitOutletNodeNum(0), UnitReliefNodeNum(0), - fanType(HVAC::FanType::Invalid), FanIndex(0), ActualFanVolFlowRate(0.0), FanAvailSchedPtr(0), FanInletNodeNum(0), FanOutletNodeNum(0), - DesignAirVolumeFlowRate(0.0), DesignAirMassFlowRate(0.0), DesignFanSpeedRatio(0.0), FanSpeedRatio(0.0), - fanPlace(HVAC::FanPlace::Invalid), ControlSchemeType(ControlType::Invalid), TimeElapsed(0.0), ThrottlingRange(0.0), - IsOnThisTimestep(false), WasOnLastTimestep(false), ThresholdCoolingLoad(0.0), EvapCooler_1_Type_Num(EvapCoolerType::Invalid), - EvapCooler_1_Index(0), EvapCooler_1_AvailStatus(false), EvapCooler_2_Type_Num(EvapCoolerType::Invalid), EvapCooler_2_Index(0), - EvapCooler_2_AvailStatus(false), OAInletRho(0.0), OAInletCp(0.0), OAInletTemp(0.0), OAInletHumRat(0.0), OAInletMassFlowRate(0.0), - UnitOutletTemp(0.0), UnitOutletHumRat(0.0), UnitOutletMassFlowRate(0.0), UnitReliefTemp(0.0), UnitReliefHumRat(0.0), - UnitReliefMassFlowRate(0.0), UnitTotalCoolingRate(0.0), UnitTotalCoolingEnergy(0.0), UnitSensibleCoolingRate(0.0), - UnitSensibleCoolingEnergy(0.0), UnitLatentHeatingRate(0.0), UnitLatentHeatingEnergy(0.0), UnitLatentCoolingRate(0.0), - UnitLatentCoolingEnergy(0.0), UnitFanSpeedRatio(0.0), UnitPartLoadRatio(0.0), UnitVSControlMaxIterErrorIndex(0), - UnitVSControlLimitsErrorIndex(0), UnitLoadControlMaxIterErrorIndex(0), UnitLoadControlLimitsErrorIndex(0), ZonePtr(0), - HVACSizingIndex(0), ShutOffRelativeHumidity(100.0), MySize(true), MyEnvrn(true), MyFan(true), MyZoneEq(true) + : ZoneNodeNum(0), UnitIsAvailable(false), OAInletNodeNum(0), UnitOutletNodeNum(0), UnitReliefNodeNum(0), fanType(HVAC::FanType::Invalid), + FanIndex(0), ActualFanVolFlowRate(0.0), FanInletNodeNum(0), FanOutletNodeNum(0), DesignAirVolumeFlowRate(0.0), + DesignAirMassFlowRate(0.0), DesignFanSpeedRatio(0.0), FanSpeedRatio(0.0), fanPlace(HVAC::FanPlace::Invalid), + ControlSchemeType(ControlType::Invalid), TimeElapsed(0.0), ThrottlingRange(0.0), IsOnThisTimestep(false), WasOnLastTimestep(false), + ThresholdCoolingLoad(0.0), EvapCooler_1_Type_Num(EvapCoolerType::Invalid), EvapCooler_1_Index(0), EvapCooler_1_AvailStatus(false), + EvapCooler_2_Type_Num(EvapCoolerType::Invalid), EvapCooler_2_Index(0), EvapCooler_2_AvailStatus(false), OAInletRho(0.0), OAInletCp(0.0), + OAInletTemp(0.0), OAInletHumRat(0.0), OAInletMassFlowRate(0.0), UnitOutletTemp(0.0), UnitOutletHumRat(0.0), UnitOutletMassFlowRate(0.0), + UnitReliefTemp(0.0), UnitReliefHumRat(0.0), UnitReliefMassFlowRate(0.0), UnitTotalCoolingRate(0.0), UnitTotalCoolingEnergy(0.0), + UnitSensibleCoolingRate(0.0), UnitSensibleCoolingEnergy(0.0), UnitLatentHeatingRate(0.0), UnitLatentHeatingEnergy(0.0), + UnitLatentCoolingRate(0.0), UnitLatentCoolingEnergy(0.0), UnitFanSpeedRatio(0.0), UnitPartLoadRatio(0.0), + UnitVSControlMaxIterErrorIndex(0), UnitVSControlLimitsErrorIndex(0), UnitLoadControlMaxIterErrorIndex(0), + UnitLoadControlLimitsErrorIndex(0), ZonePtr(0), HVACSizingIndex(0), ShutOffRelativeHumidity(100.0), MySize(true), MyEnvrn(true), + MyFan(true), MyZoneEq(true) { } }; @@ -450,6 +450,10 @@ struct EvaporativeCoolersData : BaseGlobalStruct bool MySetPointCheckFlag = true; bool ZoneEquipmentListChecked = false; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/EvaporativeFluidCoolers.cc b/src/EnergyPlus/EvaporativeFluidCoolers.cc index 3e170a3c51e..1149a2ce2ea 100644 --- a/src/EnergyPlus/EvaporativeFluidCoolers.cc +++ b/src/EnergyPlus/EvaporativeFluidCoolers.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -142,6 +142,8 @@ namespace EvaporativeFluidCoolers { // B.A. Qureshi and S.M. Zubair , Prediction of evaporation losses in evaporative fluid coolers // Applied thermal engineering 27 (2007) 520-527 + static constexpr std::string_view routineName = "GetEvapFluidCoolerInput"; + int NumAlphas; // Number of elements in the alpha array int NumNums; // Number of elements in the numeric array int IOStat; // IO Status when calling get input subroutine @@ -181,6 +183,9 @@ namespace EvaporativeFluidCoolers { state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, state.dataIPShortCut->cCurrentModuleObject, AlphArray(1)}; + GlobalNames::VerifyUniqueInterObjectName(state, state.dataEvapFluidCoolers->UniqueSimpleEvapFluidCoolerNames, AlphArray(1), @@ -335,11 +340,11 @@ namespace EvaporativeFluidCoolers { } } - thisEFC.SchedIDBlowdown = ScheduleManager::GetScheduleIndex(state, AlphArray(9)); - if ((thisEFC.SchedIDBlowdown == 0) && (thisEFC.BlowdownMode == Blowdown::BySchedule)) { - ShowSevereError(state, format("Invalid, {} = {}", state.dataIPShortCut->cAlphaFieldNames(9), AlphArray(9))); - ShowContinueError(state, format("Entered in {} ={}", state.dataIPShortCut->cCurrentModuleObject, AlphArray(1))); - ErrorsFound = true; + if (thisEFC.BlowdownMode == Blowdown::BySchedule) { + if ((thisEFC.blowdownSched = Sched::GetSchedule(state, AlphArray(9))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(9), AlphArray(9)); + ErrorsFound = true; + } } if (AlphArray(10).empty()) { @@ -518,6 +523,8 @@ namespace EvaporativeFluidCoolers { state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + ErrorObjectHeader eoh{routineName, state.dataIPShortCut->cCurrentModuleObject, AlphArray(1)}; + GlobalNames::VerifyUniqueInterObjectName(state, state.dataEvapFluidCoolers->UniqueSimpleEvapFluidCoolerNames, AlphArray(1), @@ -675,11 +682,11 @@ namespace EvaporativeFluidCoolers { } } - thisEFC.SchedIDBlowdown = ScheduleManager::GetScheduleIndex(state, AlphArray(8)); - if ((thisEFC.SchedIDBlowdown == 0) && (thisEFC.BlowdownMode == Blowdown::BySchedule)) { - ShowSevereError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(8), AlphArray(8))); - ShowContinueError(state, format("Entered in {} = {}", state.dataIPShortCut->cCurrentModuleObject, AlphArray(1))); - ErrorsFound = true; + if (thisEFC.BlowdownMode == Blowdown::BySchedule) { + if ((thisEFC.blowdownSched = Sched::GetSchedule(state, AlphArray(8))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(8), AlphArray(8)); + ErrorsFound = true; + } } if (state.dataIPShortCut->lAlphaFieldBlanks(9)) { @@ -905,7 +912,7 @@ namespace EvaporativeFluidCoolers { ShowSevereError( state, format( - "{} = \"{}\". Low-Speed User Specified Design Capacity must be less than the High-Speed User Specified Design Dapacity.", + "{} = \"{}\". Low-Speed User Specified Design Capacity must be less than the High-Speed User Specified Design Capacity.", state.dataIPShortCut->cCurrentModuleObject, thisEFC.Name)); ErrorsFound = true; @@ -964,7 +971,7 @@ namespace EvaporativeFluidCoolers { "\"UFactorTimesAreaAndDesignWaterFlowRate\" or \"StandardDesignCapacity\" or \"UserSpecifiedDesignCapacity\".", state.dataIPShortCut->cCurrentModuleObject, thisEFC.Name)); - ShowContinueError(state, format("Evaporative fluid cooler Performanace Input Method currently specified as: {}", AlphArray(4))); + ShowContinueError(state, format("Evaporative fluid cooler Performance Input Method currently specified as: {}", AlphArray(4))); ErrorsFound = true; } @@ -1277,11 +1284,7 @@ namespace EvaporativeFluidCoolers { // Begin environment initializations if (this->MyEnvrnFlag && state.dataGlobal->BeginEnvrnFlag && (state.dataPlnt->PlantFirstSizesOkayToFinalize)) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); this->DesWaterMassFlowRate = this->DesignWaterFlowRate * rho; PlantUtilities::InitComponentNodes(state, 0.0, this->DesWaterMassFlowRate, this->WaterInletNodeNum, this->WaterOutletNodeNum); this->MyEnvrnFlag = false; @@ -1406,16 +1409,9 @@ namespace EvaporativeFluidCoolers { if (this->PerformanceInputMethod_Num == PIM::UFactor && !this->HighSpeedEvapFluidCoolerUAWasAutoSized) { if (PltSizCondNum > 0) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); + Real64 rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, CalledFrom); + Real64 Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, CalledFrom); DesEvapFluidCoolerLoad = rho * Cp * tmpDesignWaterFlowRate * state.dataSize->PlantSizData(PltSizCondNum).DeltaT; this->HighSpeedStandardDesignCapacity = DesEvapFluidCoolerLoad / this->HeatRejectCapNomCapSizingRatio; } else { @@ -1481,16 +1477,9 @@ namespace EvaporativeFluidCoolers { if (state.dataPlnt->PlantFirstSizesOkayToFinalize) this->HighSpeedFanPower = tmpHighSpeedFanPower; } else if (PltSizCondNum > 0) { if (state.dataSize->PlantSizData(PltSizCondNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); + Real64 rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, CalledFrom); + Real64 Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, CalledFrom); DesEvapFluidCoolerLoad = rho * Cp * tmpDesignWaterFlowRate * state.dataSize->PlantSizData(PltSizCondNum).DeltaT; tmpHighSpeedFanPower = 0.0105 * DesEvapFluidCoolerLoad; if (state.dataPlnt->PlantFirstSizesOkayToFinalize) this->HighSpeedFanPower = tmpHighSpeedFanPower; @@ -1586,16 +1575,9 @@ namespace EvaporativeFluidCoolers { "must be > 25.6 C if autosizing the Evaporative Fluid Cooler."); ShowFatalError(state, "Review and revise design input values as appropriate."); } - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); + Real64 rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, CalledFrom); + Real64 Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, CalledFrom); DesEvapFluidCoolerLoad = rho * Cp * tmpDesignWaterFlowRate * state.dataSize->PlantSizData(PltSizCondNum).DeltaT; Real64 const par1 = rho * tmpDesignWaterFlowRate; // Design water mass flow rate Real64 const par2 = tmpHighSpeedAirFlowRate; // Design air volume flow rate @@ -1714,16 +1696,8 @@ namespace EvaporativeFluidCoolers { if (this->DesignWaterFlowRate >= HVAC::SmallWaterVolFlow) { // Standard Design Capacity doesn't include compressor heat; // predefined factor was 1.25 W heat rejection per W of delivered cooling, now a user input with 1.25 default - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - 35.0, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); + Real64 rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, CalledFrom); + Real64 Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, 35.0, CalledFrom); DesEvapFluidCoolerLoad = this->HighSpeedStandardDesignCapacity * this->HeatRejectCapNomCapSizingRatio; Real64 const par1 = rho * this->DesignWaterFlowRate; // Design water mass flow rate Real64 const par2 = this->HighSpeedAirFlowRate; // Design air volume flow rate @@ -1792,16 +1766,9 @@ namespace EvaporativeFluidCoolers { if (this->PerformanceInputMethod_Num == PIM::UserSpecifiedDesignCapacity) { if (this->DesignWaterFlowRate >= HVAC::SmallWaterVolFlow) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->DesignEnteringWaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); + Real64 rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, CalledFrom); + Real64 Cp = + state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, this->DesignEnteringWaterTemp, CalledFrom); DesEvapFluidCoolerLoad = this->HighSpeedUserSpecifiedDesignCapacity; Real64 const par1 = rho * tmpDesignWaterFlowRate; // Design water mass flow rate Real64 const par2 = tmpHighSpeedAirFlowRate; // Design air volume flow rate @@ -1952,16 +1919,9 @@ namespace EvaporativeFluidCoolers { if (this->DesignWaterFlowRate >= HVAC::SmallWaterVolFlow && this->LowSpeedStandardDesignCapacity > 0.0) { // Standard design capacity doesn't include compressor heat; // predefined factor was 1.25 W heat rejection per W of delivered cooling, now user input with default 1.25 - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->DesignEnteringWaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); + Real64 rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, CalledFrom); + Real64 Cp = + state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, this->DesignEnteringWaterTemp, CalledFrom); DesEvapFluidCoolerLoad = this->LowSpeedStandardDesignCapacity * this->HeatRejectCapNomCapSizingRatio; Real64 const par1 = rho * tmpDesignWaterFlowRate; // Design water mass flow rate Real64 const par2 = this->LowSpeedAirFlowRate; // Air volume flow rate at low fan speed @@ -2014,16 +1974,9 @@ namespace EvaporativeFluidCoolers { if (this->PerformanceInputMethod_Num == PIM::UserSpecifiedDesignCapacity && this->Type == DataPlant::PlantEquipmentType::EvapFluidCooler_TwoSpd) { if (this->DesignWaterFlowRate >= HVAC::SmallWaterVolFlow && this->LowSpeedUserSpecifiedDesignCapacity > 0.0) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->DesignEnteringWaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); + Real64 rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, CalledFrom); + Real64 Cp = + state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, this->DesignEnteringWaterTemp, CalledFrom); DesEvapFluidCoolerLoad = this->LowSpeedUserSpecifiedDesignCapacity; Real64 const par1 = rho * tmpDesignWaterFlowRate; // Design water mass flow rate Real64 const par2 = this->LowSpeedAirFlowRate; // Air volume flow rate at low fan speed @@ -2225,7 +2178,7 @@ namespace EvaporativeFluidCoolers { } // Calculate bypass fraction since OWTLowerLimit < OutletWaterTemp < TempSetPoint. - // The iteration ends when the numer of iteration exceeds the limit or the difference + // The iteration ends when the number of iteration exceeds the limit or the difference // between the new and old bypass fractions is less than the threshold. if (BypassFlag == 1) { Real64 bypassFraction = (TempSetPoint - this->OutletWaterTemp) / (inletWaterTemp - this->OutletWaterTemp); @@ -2254,7 +2207,7 @@ namespace EvaporativeFluidCoolers { this->SimSimpleEvapFluidCooler( state, this->WaterMassFlowRate * (1.0 - BypassFraction2), AirFlowRate, UAdesign, this->OutletWaterTemp); if (this->OutletWaterTemp < OWTLowerLimit) { - // Use previous iteraction values + // Use previous iteration values BypassFraction2 = BypassFractionPrev; this->OutletWaterTemp = OutletWaterTempPrev; } @@ -2279,11 +2232,8 @@ namespace EvaporativeFluidCoolers { } // Should this be water inlet node num????? - CpWater = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->WaterInletNode).Temp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + CpWater = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->WaterInletNode).Temp, RoutineName); this->Qactual = this->WaterMassFlowRate * CpWater * (state.dataLoopNodes->Node(this->WaterInletNode).Temp - this->OutletWaterTemp); this->AirFlowRateRatio = AirFlowRate / this->HighSpeedAirFlowRate; } @@ -2404,11 +2354,8 @@ namespace EvaporativeFluidCoolers { } // Should this be water inlet node num?? - Real64 CpWater = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->WaterInletNode).Temp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpWater = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->WaterInletNode).Temp, RoutineName); this->Qactual = this->WaterMassFlowRate * CpWater * (state.dataLoopNodes->Node(this->WaterInletNode).Temp - this->OutletWaterTemp); this->AirFlowRateRatio = AirFlowRate / this->HighSpeedAirFlowRate; } @@ -2457,11 +2404,7 @@ namespace EvaporativeFluidCoolers { Real64 AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, this->inletConds.AirPress, InletAirTemp, this->inletConds.AirHumRat); Real64 AirMassFlowRate = AirFlowRate * AirDensity; Real64 CpAir = Psychrometrics::PsyCpAirFnW(this->inletConds.AirHumRat); - Real64 CpWater = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->InletWaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpWater = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, this->InletWaterTemp, RoutineName); Real64 InletAirEnthalpy = Psychrometrics::PsyHFnTdbRhPb(state, InletAirWetBulb, 1.0, this->inletConds.AirPress); // initialize exiting wet bulb temperature before iterating on final solution @@ -2520,7 +2463,7 @@ namespace EvaporativeFluidCoolers { // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // Collect evaporative fluid cooler water useage calculations for + // Collect evaporative fluid cooler water usage calculations for // reuse by all the evaporative fluid cooler models. // REFERENCES: @@ -2556,11 +2499,7 @@ namespace EvaporativeFluidCoolers { Real64 TairAvg = (this->inletConds.AirTemp + OutletAirTSat) / 2.0; // Amount of water evaporated - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - TairAvg, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, TairAvg, RoutineName); this->EvaporationVdot = (AirMassFlowRate * (OutSpecificHumRat - InSpecificHumRat)) / rho; // [m3/s] if (this->EvaporationVdot < 0.0) this->EvaporationVdot = 0.0; } else { @@ -2568,11 +2507,7 @@ namespace EvaporativeFluidCoolers { } } else if (this->EvapLossMode == EvapLoss::ByUserFactor) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - AverageWaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, AverageWaterTemp, RoutineName); this->EvaporationVdot = this->UserEvapLossFactor * (this->InletWaterTemp - this->OutletWaterTemp) * (this->WaterMassFlowRate / rho); if (this->EvaporationVdot < 0.0) this->EvaporationVdot = 0.0; } else { @@ -2584,11 +2519,7 @@ namespace EvaporativeFluidCoolers { if (this->BlowdownMode == Blowdown::BySchedule) { // Amount of water lost due to blow down (purging contaminants from evaporative fluid cooler basin) - if (this->SchedIDBlowdown > 0) { - this->BlowdownVdot = ScheduleManager::GetCurrentScheduleValue(state, this->SchedIDBlowdown); - } else { - this->BlowdownVdot = 0.0; - } + this->BlowdownVdot = (this->blowdownSched != nullptr) ? this->blowdownSched->getCurrentVal() : 0.0; } else if (this->BlowdownMode == Blowdown::ByConcentration) { if (this->ConcentrationRatio > 2.0) { // protect divide by zero this->BlowdownVdot = this->EvaporationVdot / (this->ConcentrationRatio - 1) - this->DriftVdot; @@ -2657,7 +2588,7 @@ namespace EvaporativeFluidCoolers { return; // Check flow rate through evaporative fluid cooler and compare to design flow rate, - // show warning if greater than Design * Mulitplier + // show warning if greater than Design * Multiplier if (state.dataLoopNodes->Node(this->WaterOutletNode).MassFlowRate > this->DesWaterMassFlowRate * this->EvapFluidCoolerMassFlowRateMultiplier) { ++this->HighMassFlowErrorCount; @@ -2761,8 +2692,8 @@ namespace EvaporativeFluidCoolers { this->setupOutputVars(state); - this->FluidIndex = state.dataPlnt->PlantLoop(state.dataSize->CurLoopNum).FluidIndex; - std::string FluidName = FluidProperties::GetGlycolNameByIndex(state, this->FluidIndex); + this->glycol = state.dataPlnt->PlantLoop(state.dataSize->CurLoopNum).glycol; + std::string const &FluidName = this->glycol->Name; if (Util::SameString(this->PerformanceInputMethod, "STANDARDDESIGNCAPACITY")) { this->PerformanceInputMethod_Num = PIM::StandardDesignCapacity; diff --git a/src/EnergyPlus/EvaporativeFluidCoolers.hh b/src/EnergyPlus/EvaporativeFluidCoolers.hh index 56e262a19d8..177da1f3dcc 100644 --- a/src/EnergyPlus/EvaporativeFluidCoolers.hh +++ b/src/EnergyPlus/EvaporativeFluidCoolers.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -153,7 +153,7 @@ namespace EvaporativeFluidCoolers { Real64 LowSpeedUserSpecifiedDesignCapacity = 0.0; // User specified design capacity for at low speed for // two speed fluid cooler[W] Real64 Concentration = 0.0; // fluid/glycol concentration - percent - int FluidIndex = 0; // Index to Property arrays + Fluid::GlycolProps *glycol = nullptr; // Index to Property arrays Real64 SizFac = 0.0; // sizing factor int WaterInletNodeNum = 0; // Node number on the water inlet side of the evaporative fluid cooler int WaterOutletNodeNum = 0; // Node number on the water outlet side of the evaporative fluid cooler @@ -171,7 +171,7 @@ namespace EvaporativeFluidCoolers { // begin water system interactions EvapLoss EvapLossMode = EvapLoss::ByMoistTheory; // sets how evaporative fluid cooler water evaporation is modeled Blowdown BlowdownMode = Blowdown::ByConcentration; // sets how evaporative fluid cooler water blowdown is modeled - int SchedIDBlowdown = 0; // index "pointer" to schedule of blowdown in [m3/s] + Sched::Schedule *blowdownSched = nullptr; // schedule of blowdown in [m3/s] int WaterTankID = 0; // index "pointer" to WaterStorage structure int WaterTankDemandARRID = 0; // index "pointer" to demand array inside WaterStorage structure Real64 UserEvapLossFactor = 0.0; // simple model [%/Delt C] @@ -258,6 +258,10 @@ struct EvaporativeFluidCoolersData : BaseGlobalStruct Array1D SimpleEvapFluidCooler; // dimension to number of machines std::unordered_map UniqueSimpleEvapFluidCoolerNames; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ExhaustAirSystemManager.cc b/src/EnergyPlus/ExhaustAirSystemManager.cc index 0e90d5918b4..5a9677df2c2 100644 --- a/src/EnergyPlus/ExhaustAirSystemManager.cc +++ b/src/EnergyPlus/ExhaustAirSystemManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -174,7 +174,7 @@ namespace ExhaustAirSystemManager { } else { auto *fan = state.dataFans->fans(centralFanIndex); - thisExhSys.AvailScheduleNum = fan->availSchedNum; + thisExhSys.availSched = fan->availSched; BranchNodeConnections::SetUpCompSets(state, cCurrentModuleObject, @@ -362,6 +362,8 @@ namespace ExhaustAirSystemManager { // Use the json helper to process input constexpr std::string_view RoutineName("GetZoneExhaustControlInput: "); + constexpr std::string_view routineName = "GetZoneExhaustControlInput"; + std::string const cCurrentModuleObject = "ZoneHVAC:ExhaustControl"; auto &ip = state.dataInputProcessing->inputProcessor; auto const instances = ip->epJSON.find(cCurrentModuleObject); @@ -381,22 +383,20 @@ namespace ExhaustAirSystemManager { ++exhCtrlNum; auto const &objectFields = instance.value(); auto &thisExhCtrl = state.dataZoneEquip->ZoneExhaustControlSystem(exhCtrlNum); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, instance.key()}; + thisExhCtrl.Name = Util::makeUPPER(instance.key()); ip->markObjectAsUsed(cCurrentModuleObject, instance.key()); std::string availSchName = ip->getAlphaFieldValue(objectFields, objectSchemaProps, "availability_schedule_name"); - if (availSchName == "") { + if (availSchName.empty()) { // blank - thisExhCtrl.AvailScheduleNum = ScheduleManager::ScheduleAlwaysOn; - } else { - thisExhCtrl.AvailScheduleNum = ScheduleManager::GetScheduleIndex(state, availSchName); - if (thisExhCtrl.AvailScheduleNum == 0) { - // mismatch, reset to always on - thisExhCtrl.AvailScheduleNum = ScheduleManager::ScheduleAlwaysOn; - ShowWarningError(state, format("{}{}={}", RoutineName, cCurrentModuleObject, thisExhCtrl.Name)); - ShowContinueError(state, format("Avaiability Schedule Name = {} not found.", availSchName)); - ShowContinueError(state, "Availability Schedule is reset to Always ON."); - } + thisExhCtrl.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisExhCtrl.availSched = Sched::GetSchedule(state, availSchName)) == nullptr) { + // mismatch, reset to always on + thisExhCtrl.availSched = Sched::GetScheduleAlwaysOn(state); + ShowWarningItemNotFound(state, eoh, "Avaiability Schedule Name", availSchName, "Availability Schedule is reset to Always ON."); } std::string zoneName = ip->getAlphaFieldValue(objectFields, objectSchemaProps, "zone_name"); @@ -444,23 +444,15 @@ namespace ExhaustAirSystemManager { thisExhCtrl.FlowControlOption = static_cast(getEnumValue(flowControlTypeNamesUC, flowControlTypeName)); - std::string exhaustFlowFractionScheduleName = + std::string exhaustFlowFractionSchedName = ip->getAlphaFieldValue(objectFields, objectSchemaProps, "exhaust_flow_fraction_schedule_name"); - // Schedule matching - int exhaustFlowFractionScheduleNum = 0; - exhaustFlowFractionScheduleNum = ScheduleManager::GetScheduleIndex(state, exhaustFlowFractionScheduleName); - - if (exhaustFlowFractionScheduleNum > 0) { - // normal conditions - } else if (exhaustFlowFractionScheduleNum == 0) { - // blank, treat as always available - } else { - exhaustFlowFractionScheduleNum = 0; - // a regular warning - ShowWarningError(state, format("{}{}={}", RoutineName, cCurrentModuleObject, thisExhCtrl.Name)); - ShowContinueError(state, format("Schedule Name = {} not found.", exhaustFlowFractionScheduleName)); + + if (exhaustFlowFractionSchedName.empty()) { + thisExhCtrl.exhaustFlowFractionSched = + Sched::GetScheduleAlwaysOn(state); // Not an availability schedule, but defaults to constant-1.0 + } else if ((thisExhCtrl.exhaustFlowFractionSched = Sched::GetSchedule(state, exhaustFlowFractionSchedName)) == nullptr) { + ShowSevereItemNotFound(state, eoh, "Exhaust Flow Fraction Schedule Name", exhaustFlowFractionSchedName); } - thisExhCtrl.ExhaustFlowFractionScheduleNum = exhaustFlowFractionScheduleNum; thisExhCtrl.SupplyNodeOrNodelistName = ip->getAlphaFieldValue(objectFields, objectSchemaProps, "supply_node_or_nodelist_name"); @@ -501,71 +493,38 @@ namespace ExhaustAirSystemManager { SizeExhaustControlFlow(state, exhCtrlNum, thisExhCtrl.SuppNodeNums); } - std::string minZoneTempLimitScheduleName = + std::string minZoneTempLimitSchedName = ip->getAlphaFieldValue(objectFields, objectSchemaProps, "minimum_zone_temperature_limit_schedule_name"); - int minZoneTempLimitScheduleNum = 0; - minZoneTempLimitScheduleNum = ScheduleManager::GetScheduleIndex(state, minZoneTempLimitScheduleName); - - if (minZoneTempLimitScheduleNum > 0) { - // normal conditions - } else if (minZoneTempLimitScheduleNum == 0) { - // blank or anything like that, treat as no comparision - } else { - minZoneTempLimitScheduleNum = 0; - // a regular warning - ShowWarningError(state, format("{}{}={}", RoutineName, cCurrentModuleObject, thisExhCtrl.Name)); - ShowContinueError(state, format("Schedule Name ={} not found.", minZoneTempLimitScheduleName)); + if (minZoneTempLimitSchedName.empty()) { + } else if ((thisExhCtrl.minZoneTempLimitSched = Sched::GetSchedule(state, minZoneTempLimitSchedName)) == nullptr) { + ShowSevereItemNotFound(state, eoh, "Minimum Zone Temperature Limit Schedule Name", minZoneTempLimitSchedName); } - thisExhCtrl.MinZoneTempLimitScheduleNum = minZoneTempLimitScheduleNum; - std::string minExhFlowFracScheduleName = + std::string minExhFlowFracSchedName = ip->getAlphaFieldValue(objectFields, objectSchemaProps, "minimum_exhaust_flow_fraction_schedule_name"); // to do so schedule matching - int minExhFlowFracScheduleNum = 0; - minExhFlowFracScheduleNum = ScheduleManager::GetScheduleIndex(state, minExhFlowFracScheduleName); - - if (minExhFlowFracScheduleNum > 0) { - // normal conditions - } else if (minExhFlowFracScheduleNum == 0) { - // blank, meaning minimum is zero - } else { - minExhFlowFracScheduleNum = 0; - // a regular warning - ShowWarningError(state, format("{}{}={}", RoutineName, cCurrentModuleObject, thisExhCtrl.Name)); - ShowContinueError(state, format("Schedule Name ={} not found.", minExhFlowFracScheduleName)); + if (minExhFlowFracSchedName.empty()) { + } else if ((thisExhCtrl.minExhFlowFracSched = Sched::GetSchedule(state, minExhFlowFracSchedName)) == nullptr) { + ShowSevereItemNotFound(state, eoh, "Minimum Exhaust Flow Fraction Schedule Name", minExhFlowFracSchedName); } - thisExhCtrl.MinExhFlowFracScheduleNum = minExhFlowFracScheduleNum; - std::string balancedExhFracScheduleName = + std::string balancedExhFracSchedName = ip->getAlphaFieldValue(objectFields, objectSchemaProps, "balanced_exhaust_fraction_schedule_name"); // to do so schedule matching - int balancedExhFracScheduleNum = 0; - balancedExhFracScheduleNum = ScheduleManager::GetScheduleIndex(state, balancedExhFracScheduleName); - - if (balancedExhFracScheduleNum > 0) { - // normal conditions - } else if (balancedExhFracScheduleNum == 0) { - // blank, treated as not activated - } else { - balancedExhFracScheduleNum = 0; - // a regular warning - ShowWarningError(state, format("{}{}={}", RoutineName, cCurrentModuleObject, thisExhCtrl.Name)); - ShowContinueError(state, format("Schedule Name ={} not found.", balancedExhFracScheduleName)); + if (balancedExhFracSchedName.empty()) { + } else if ((thisExhCtrl.balancedExhFracSched = Sched::GetSchedule(state, balancedExhFracSchedName)) == nullptr) { + ShowSevereItemNotFound(state, eoh, "Balanced Exhaust Fraction Schedule Name", balancedExhFracSchedName); } // Maybe an additional check per IORef: // This input field must be blank when the zone air flow balance is enforced. If user specifies a schedule and zone air flow balance // is enforced, then EnergyPlus throws a warning error message, ignores the schedule and simulation continues. - - thisExhCtrl.BalancedExhFracScheduleNum = balancedExhFracScheduleNum; } state.dataZoneEquip->NumZoneExhaustControls = numZoneExhaustControls; // or exhCtrlNum // Done with creating a map that contains a table of for each zone to exhasut controls state.dataExhAirSystemMrg->mappingDone = true; - } else { - // If no exhaust systems are defined, then do something : } if (ErrorsFound) { @@ -599,7 +558,7 @@ namespace ExhaustAirSystemManager { auto &thisExhOutlet = state.dataLoopNodes->Node(OutletNode); Real64 MassFlow; Real64 Tin = state.dataZoneTempPredictorCorrector->zoneHeatBalance(thisExhCtrl.ZoneNum).ZT; - Real64 thisExhCtrlAvailScheVal = ScheduleManager::GetCurrentScheduleValue(state, thisExhCtrl.AvailScheduleNum); + Real64 thisExhCtrlAvailScheVal = thisExhCtrl.availSched->getCurrentVal(); if (FlowRatio >= 0.0) { thisExhCtrl.BalancedFlow *= FlowRatio; @@ -617,8 +576,8 @@ namespace ExhaustAirSystemManager { Real64 DesignFlowRate = thisExhCtrl.DesignExhaustFlowRate; Real64 FlowFrac = 0.0; - if (thisExhCtrl.MinExhFlowFracScheduleNum > 0) { - FlowFrac = ScheduleManager::GetCurrentScheduleValue(state, thisExhCtrl.ExhaustFlowFractionScheduleNum); + if (thisExhCtrl.minExhFlowFracSched != nullptr) { + FlowFrac = thisExhCtrl.exhaustFlowFractionSched->getCurrentVal(); if (FlowFrac < 0.0) { ShowWarningError( state, format("Exhaust Flow Fraction Schedule value is negative for Zone Exhaust Control Named: {};", thisExhCtrl.Name)); @@ -628,8 +587,8 @@ namespace ExhaustAirSystemManager { } Real64 MinFlowFrac = 0.0; - if (thisExhCtrl.MinExhFlowFracScheduleNum > 0) { - MinFlowFrac = ScheduleManager::GetCurrentScheduleValue(state, thisExhCtrl.MinExhFlowFracScheduleNum); + if (thisExhCtrl.minExhFlowFracSched != nullptr) { + MinFlowFrac = thisExhCtrl.minExhFlowFracSched->getCurrentVal(); if (MinFlowFrac < 0.0) { ShowWarningError( state, @@ -644,8 +603,8 @@ namespace ExhaustAirSystemManager { } if (thisExhCtrlAvailScheVal > 0.0) { // available - if (thisExhCtrl.MinZoneTempLimitScheduleNum > 0) { - if (Tin >= ScheduleManager::GetCurrentScheduleValue(state, thisExhCtrl.MinZoneTempLimitScheduleNum)) { + if (thisExhCtrl.minZoneTempLimitSched != nullptr) { + if (Tin >= thisExhCtrl.minZoneTempLimitSched->getCurrentVal()) { } else { FlowFrac = MinFlowFrac; } @@ -667,10 +626,10 @@ namespace ExhaustAirSystemManager { MassFlow = DesignFlowRate * FlowFrac; } - if (thisExhCtrl.BalancedExhFracScheduleNum > 0) { + if (thisExhCtrl.balancedExhFracSched != nullptr) { thisExhCtrl.BalancedFlow = // state.dataHVACGlobal->BalancedExhMassFlow = MassFlow * // state.dataHVACGlobal->UnbalExhMassFlow * - ScheduleManager::GetCurrentScheduleValue(state, thisExhCtrl.BalancedExhFracScheduleNum); + thisExhCtrl.balancedExhFracSched->getCurrentVal(); thisExhCtrl.UnbalancedFlow = // state.dataHVACGlobal->UnbalExhMassFlow = MassFlow - // = state.dataHVACGlobal->UnbalExhMassFlow - thisExhCtrl.BalancedFlow; // state.dataHVACGlobal->BalancedExhMassFlow; diff --git a/src/EnergyPlus/ExhaustAirSystemManager.hh b/src/EnergyPlus/ExhaustAirSystemManager.hh index 4c61d5d8958..7f56270c7a5 100644 --- a/src/EnergyPlus/ExhaustAirSystemManager.hh +++ b/src/EnergyPlus/ExhaustAirSystemManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -66,7 +66,7 @@ namespace ExhaustAirSystemManager { // Members std::string Name = ""; - int AvailScheduleNum = ScheduleManager::ScheduleAlwaysOn; + Sched::Schedule *availSched = nullptr; std::string ZoneMixerName = ""; int ZoneMixerIndex = 0; HVAC::FanType centralFanType = HVAC::FanType::Invalid; @@ -98,7 +98,7 @@ namespace ExhaustAirSystemManager { std::string Name = ""; - int AvailScheduleNum = ScheduleManager::ScheduleAlwaysOn; + Sched::Schedule *availSched = nullptr; std::string ZoneName = ""; int ZoneNum = 0; @@ -109,12 +109,12 @@ namespace ExhaustAirSystemManager { Real64 DesignExhaustFlowRate = 0.0; FlowControlType FlowControlOption = FlowControlType::Scheduled; - int ExhaustFlowFractionScheduleNum = 0; + Sched::Schedule *exhaustFlowFractionSched = nullptr; std::string SupplyNodeOrNodelistName = ""; int SupplyNodeOrNodelistNum = 0; // may not need this one - int MinZoneTempLimitScheduleNum = 0; - int MinExhFlowFracScheduleNum = 0; - int BalancedExhFracScheduleNum = 0; + Sched::Schedule *minZoneTempLimitSched = nullptr; + Sched::Schedule *minExhFlowFracSched = nullptr; + Sched::Schedule *balancedExhFracSched = nullptr; Real64 BalancedFlow = 0.0; Real64 UnbalancedFlow = 0.0; @@ -150,6 +150,10 @@ struct ExhaustAirSystemMgr : BaseGlobalStruct std::map mixerIndexMap; bool mappingDone = false; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } @@ -165,6 +169,10 @@ struct ExhaustControlSystemMgr : BaseGlobalStruct bool GetInputFlag = true; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ExteriorEnergyUse.cc b/src/EnergyPlus/ExteriorEnergyUse.cc index 64eede6d095..08550631a35 100644 --- a/src/EnergyPlus/ExteriorEnergyUse.cc +++ b/src/EnergyPlus/ExteriorEnergyUse.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -107,11 +107,6 @@ namespace ExteriorEnergyUse { // This subroutine gets the input for the Exterior Lights and Equipment. // Using/Aliasing - - using ScheduleManager::GetScheduleIndex; - using ScheduleManager::GetScheduleMaxValue; - using ScheduleManager::GetScheduleMinValue; - using ScheduleManager::GetScheduleName; using namespace OutputReportPredefined; // SUBROUTINE PARAMETER DEFINITIONS: std::string_view constexpr routineName = "GetExteriorEnergyUseInput"; @@ -122,10 +117,8 @@ namespace ExteriorEnergyUse { int IOStatus; // Used in GetObjectItem bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine std::string EndUseSubcategoryName; - Real64 SchMax; // Max value of schedule for item - Real64 SchMin; // Min value of schedule for item - auto &ipsc = state.dataIPShortCut; + auto &s_ipsc = state.dataIPShortCut; state.dataExteriorEnergyUse->NumExteriorLights = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Exterior:Lights"); state.dataExteriorEnergyUse->ExteriorLights.allocate(state.dataExteriorEnergyUse->NumExteriorLights); @@ -144,81 +137,42 @@ namespace ExteriorEnergyUse { state.dataInputProcessing->inputProcessor->getObjectItem(state, cCurrentModuleObject, Item, - ipsc->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - ipsc->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStatus, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); - - state.dataExteriorEnergyUse->ExteriorLights(Item).Name = ipsc->cAlphaArgs(1); - state.dataExteriorEnergyUse->ExteriorLights(Item).SchedPtr = GetScheduleIndex(state, ipsc->cAlphaArgs(2)); - if (state.dataExteriorEnergyUse->ExteriorLights(Item).SchedPtr == 0) { - if (ipsc->lAlphaFieldBlanks(2)) { - ShowSevereError(state, - format("{}: {}: {} is required, missing for {}={}", - routineName, - cCurrentModuleObject, - ipsc->cAlphaFieldNames(2), - ipsc->cAlphaFieldNames(1), - ipsc->cAlphaArgs(1))); - } else { - ShowSevereError(state, - format("{}: {}: invalid {} entered={} for {}={}", - routineName, - cCurrentModuleObject, - ipsc->cAlphaFieldNames(2), - ipsc->cAlphaArgs(2), - ipsc->cAlphaFieldNames(1), - ipsc->cAlphaArgs(1))); - } + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + state.dataExteriorEnergyUse->ExteriorLights(Item).Name = s_ipsc->cAlphaArgs(1); + + if (s_ipsc->lAlphaFieldBlanks(2)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(2)); + ErrorsFound = true; + } else if ((state.dataExteriorEnergyUse->ExteriorLights(Item).sched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); + ErrorsFound = true; + } else if (int SchMin = state.dataExteriorEnergyUse->ExteriorLights(Item).sched->getMinVal(state); SchMin < 0.0) { + ShowSevereCustom( + state, + eoh, + format("{} = {} minimum is [{:.1R}]. Values must be >= 0.0.", s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3), SchMin)); ErrorsFound = true; - } else { // check min/max on schedule - SchMin = GetScheduleMinValue(state, state.dataExteriorEnergyUse->ExteriorLights(Item).SchedPtr); - SchMax = GetScheduleMaxValue(state, state.dataExteriorEnergyUse->ExteriorLights(Item).SchedPtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (SchMin < 0.0) { - ShowSevereError(state, - format("{}: {}: invalid {} minimum, is < 0.0 for {}={}", - routineName, - cCurrentModuleObject, - ipsc->cAlphaFieldNames(2), - ipsc->cAlphaFieldNames(1), - ipsc->cAlphaArgs(1))); - ShowContinueError(state, format("{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", ipsc->cAlphaArgs(2), SchMin)); - ErrorsFound = true; - } - if (SchMax < 0.0) { - ShowSevereError(state, - format("{}: {}: invalid {} maximum, is < 0.0 for {}={}", - routineName, - cCurrentModuleObject, - ipsc->cAlphaFieldNames(2), - ipsc->cAlphaFieldNames(1), - ipsc->cAlphaArgs(1))); - ShowContinueError(state, format("{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", ipsc->cAlphaArgs(2), SchMax)); - ErrorsFound = true; - } - } } - if (ipsc->lAlphaFieldBlanks(3)) { + + if (s_ipsc->lAlphaFieldBlanks(3)) { state.dataExteriorEnergyUse->ExteriorLights(Item).ControlMode = ExteriorEnergyUse::LightControlType::ScheduleOnly; } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "ScheduleNameOnly")) { state.dataExteriorEnergyUse->ExteriorLights(Item).ControlMode = ExteriorEnergyUse::LightControlType::ScheduleOnly; } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), "AstronomicalClock")) { state.dataExteriorEnergyUse->ExteriorLights(Item).ControlMode = ExteriorEnergyUse::LightControlType::AstroClockOverride; } else { - ShowSevereError(state, - format("{}: {}: invalid {} entered={} for {}={}", - routineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3), - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1))); + ShowSevereInvalidKey(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3)); } if (NumAlphas > 3) { @@ -275,7 +229,7 @@ namespace ExteriorEnergyUse { PreDefTableEntry(state, state.dataOutRptPredefined->pdchExLtSchd, state.dataExteriorEnergyUse->ExteriorLights(Item).Name, - GetScheduleName(state, state.dataExteriorEnergyUse->ExteriorLights(Item).SchedPtr)); + state.dataExteriorEnergyUse->ExteriorLights(Item).sched->Name); } } PreDefTableEntry(state, state.dataOutRptPredefined->pdchExLtPower, "Exterior Lighting Total", state.dataExteriorEnergyUse->sumDesignLevel); @@ -303,7 +257,7 @@ namespace ExteriorEnergyUse { state.dataIPShortCut->cAlphaFieldNames(1), ErrorsFound); - ErrorObjectHeader eoh{routineName, ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1)}; + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; ++state.dataExteriorEnergyUse->NumExteriorEqs; @@ -317,12 +271,12 @@ namespace ExteriorEnergyUse { } if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { - ShowSevereEmptyField(state, eoh, ipsc->cAlphaFieldNames(2)); + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(2)); ErrorsFound = true; - } else if ((exteriorEquip.FuelType = static_cast( - getEnumValue(Constant::eFuelNamesUC, Util::makeUPPER(ipsc->cAlphaArgs(2))))) == Constant::eFuel::Invalid) { - ShowSevereInvalidKey(state, eoh, ipsc->cAlphaFieldNames(2), ipsc->cAlphaArgs(2)); + } else if ((exteriorEquip.FuelType = static_cast(getEnumValue(Constant::eFuelNamesUC, s_ipsc->cAlphaArgs(2)))) == + Constant::eFuel::Invalid) { + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); ErrorsFound = true; } else if (exteriorEquip.FuelType != Constant::eFuel::Water) { @@ -365,56 +319,20 @@ namespace ExteriorEnergyUse { EndUseSubcategoryName); } - exteriorEquip.SchedPtr = GetScheduleIndex(state, ipsc->cAlphaArgs(3)); - if (exteriorEquip.SchedPtr == 0) { - if (ipsc->lAlphaFieldBlanks(3)) { - ShowSevereError(state, - format("{}: {}: {} is required, missing for {}={}", - routineName, - cCurrentModuleObject, - ipsc->cAlphaFieldNames(3), - ipsc->cAlphaFieldNames(1), - ipsc->cAlphaArgs(1))); - } else { - ShowSevereError(state, - format("{}: {}: invalid {} entered={} for {}={}", - routineName, - cCurrentModuleObject, - ipsc->cAlphaFieldNames(3), - ipsc->cAlphaArgs(3), - ipsc->cAlphaFieldNames(1), - ipsc->cAlphaArgs(1))); - } + if (s_ipsc->lAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(3)); + ErrorsFound = true; + } else if ((exteriorEquip.sched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3)); + ErrorsFound = true; + } else if (int SchMin = exteriorEquip.sched->getMinVal(state); SchMin < 0.0) { + ShowSevereCustom( + state, + eoh, + format("{} = {} minimum is [{:.1R}]. Values must be >= 0.0.", s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3), SchMin)); ErrorsFound = true; - } else { // check min/max on schedule - SchMin = GetScheduleMinValue(state, exteriorEquip.SchedPtr); - SchMax = GetScheduleMaxValue(state, exteriorEquip.SchedPtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (SchMin < 0.0) { - ShowSevereError(state, - format("{}: {}: invalid {} minimum, is < 0.0 for {}={}", - routineName, - cCurrentModuleObject, - ipsc->cAlphaFieldNames(3), - ipsc->cAlphaFieldNames(1), - ipsc->cAlphaArgs(1))); - ShowContinueError(state, format("{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", ipsc->cAlphaArgs(3), SchMin)); - ErrorsFound = true; - } - if (SchMax < 0.0) { - ShowSevereError(state, - format("{}: {}: invalid {} maximum, is < 0.0 for {}={}", - routineName, - cCurrentModuleObject, - ipsc->cAlphaFieldNames(3), - ipsc->cAlphaFieldNames(1), - ipsc->cAlphaArgs(1))); - ShowContinueError(state, format("{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", ipsc->cAlphaArgs(3), SchMax)); - ErrorsFound = true; - } - } } - exteriorEquip.DesignLevel = ipsc->rNumericArgs(1); + exteriorEquip.DesignLevel = s_ipsc->rNumericArgs(1); } // ================================= Get Exterior Water Equipment @@ -424,84 +342,52 @@ namespace ExteriorEnergyUse { state.dataInputProcessing->inputProcessor->getObjectItem(state, cCurrentModuleObject, Item, - ipsc->cAlphaArgs, + s_ipsc->cAlphaArgs, NumAlphas, - ipsc->rNumericArgs, + s_ipsc->rNumericArgs, NumNumbers, IOStatus, - ipsc->lNumericFieldBlanks, - ipsc->lAlphaFieldBlanks, - ipsc->cAlphaFieldNames, - ipsc->cNumericFieldNames); + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + GlobalNames::VerifyUniqueInterObjectName(state, state.dataExteriorEnergyUse->UniqueExteriorEquipNames, - ipsc->cAlphaArgs(1), + s_ipsc->cAlphaArgs(1), cCurrentModuleObject, - ipsc->cAlphaFieldNames(1), + s_ipsc->cAlphaFieldNames(1), ErrorsFound); ++state.dataExteriorEnergyUse->NumExteriorEqs; auto &exteriorEquip = state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs); - exteriorEquip.Name = ipsc->cAlphaArgs(1); + exteriorEquip.Name = s_ipsc->cAlphaArgs(1); exteriorEquip.FuelType = Constant::eFuel::Water; - exteriorEquip.SchedPtr = GetScheduleIndex(state, ipsc->cAlphaArgs(3)); - if (exteriorEquip.SchedPtr == 0) { - if (ipsc->lAlphaFieldBlanks(3)) { - ShowSevereError(state, - format("{}: {}: {} is required, missing for {}={}", - routineName, - cCurrentModuleObject, - ipsc->cAlphaFieldNames(3), - ipsc->cAlphaFieldNames(1), - ipsc->cAlphaArgs(1))); - } else { - ShowSevereError(state, - format("{}: {}: invalid {} entered={} for {}={}", - routineName, - cCurrentModuleObject, - ipsc->cAlphaFieldNames(3), - ipsc->cAlphaArgs(3), - ipsc->cAlphaFieldNames(1), - ipsc->cAlphaArgs(1))); - } + + if (s_ipsc->lAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(3)); + ErrorsFound = true; + } else if ((exteriorEquip.sched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3)); + ErrorsFound = true; + } else if (int SchMin = exteriorEquip.sched->getMinVal(state); SchMin < 0.0) { + ShowSevereCustom( + state, + eoh, + format("{} = {} minimum is [{:.1R}]. Values must be >= 0.0.", s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3), SchMin)); ErrorsFound = true; - } else { // check min/max on schedule - SchMin = GetScheduleMinValue(state, exteriorEquip.SchedPtr); - SchMax = GetScheduleMaxValue(state, exteriorEquip.SchedPtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (SchMin < 0.0) { - ShowSevereError(state, - format("{}: {}: invalid {} minimum, is < 0.0 for {}={}", - routineName, - cCurrentModuleObject, - ipsc->cAlphaFieldNames(3), - ipsc->cAlphaFieldNames(1), - ipsc->cAlphaArgs(1))); - ShowContinueError(state, format("{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", ipsc->cAlphaArgs(3), SchMin)); - ErrorsFound = true; - } - if (SchMax < 0.0) { - ShowSevereError(state, - format("{}: {}: invalid {} maximum, is < 0.0 for {}={}", - routineName, - cCurrentModuleObject, - ipsc->cAlphaFieldNames(3), - ipsc->cAlphaFieldNames(1), - ipsc->cAlphaArgs(1))); - ShowContinueError(state, format("{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", ipsc->cAlphaArgs(3), SchMax)); - ErrorsFound = true; - } - } } if (NumAlphas > 3) { - EndUseSubcategoryName = ipsc->cAlphaArgs(4); + EndUseSubcategoryName = s_ipsc->cAlphaArgs(4); } else { EndUseSubcategoryName = "General"; } - exteriorEquip.DesignLevel = ipsc->rNumericArgs(1); + exteriorEquip.DesignLevel = s_ipsc->rNumericArgs(1); SetupOutputVariable(state, "Exterior Equipment Water Volume Flow Rate", @@ -538,7 +424,7 @@ namespace ExteriorEnergyUse { if (ErrorsFound) { ShowFatalError(state, format("{}Errors found in input. Program terminates.", routineName)); } - } + } // GetExteriorEnergyUseInput() void ReportExteriorEnergyUse(EnergyPlusData &state) { @@ -546,44 +432,16 @@ namespace ExteriorEnergyUse { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN January 2001 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine performs the calculations necessary to report // the exterior energy use types. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // Using/Aliasing - using ScheduleManager::GetCurrentScheduleValue; - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int Item; // Loop Control - - for (Item = 1; Item <= state.dataExteriorEnergyUse->NumExteriorLights; ++Item) { + for (int Item = 1; Item <= state.dataExteriorEnergyUse->NumExteriorLights; ++Item) { switch (state.dataExteriorEnergyUse->ExteriorLights(Item).ControlMode) { case ExteriorEnergyUse::LightControlType::ScheduleOnly: - state.dataExteriorEnergyUse->ExteriorLights(Item).Power = - state.dataExteriorEnergyUse->ExteriorLights(Item).DesignLevel * - GetCurrentScheduleValue(state, state.dataExteriorEnergyUse->ExteriorLights(Item).SchedPtr); + state.dataExteriorEnergyUse->ExteriorLights(Item).Power = state.dataExteriorEnergyUse->ExteriorLights(Item).DesignLevel * + state.dataExteriorEnergyUse->ExteriorLights(Item).sched->getCurrentVal(); state.dataExteriorEnergyUse->ExteriorLights(Item).CurrentUse = state.dataExteriorEnergyUse->ExteriorLights(Item).Power * state.dataGlobal->TimeStepZoneSec; break; @@ -594,7 +452,7 @@ namespace ExteriorEnergyUse { } else { state.dataExteriorEnergyUse->ExteriorLights(Item).Power = state.dataExteriorEnergyUse->ExteriorLights(Item).DesignLevel * - GetCurrentScheduleValue(state, state.dataExteriorEnergyUse->ExteriorLights(Item).SchedPtr); + state.dataExteriorEnergyUse->ExteriorLights(Item).sched->getCurrentVal(); state.dataExteriorEnergyUse->ExteriorLights(Item).CurrentUse = state.dataExteriorEnergyUse->ExteriorLights(Item).Power * state.dataGlobal->TimeStepZoneSec; } @@ -634,10 +492,9 @@ namespace ExteriorEnergyUse { } } - for (Item = 1; Item <= state.dataExteriorEnergyUse->NumExteriorEqs; ++Item) { - state.dataExteriorEnergyUse->ExteriorEquipment(Item).Power = - state.dataExteriorEnergyUse->ExteriorEquipment(Item).DesignLevel * - GetCurrentScheduleValue(state, state.dataExteriorEnergyUse->ExteriorEquipment(Item).SchedPtr); + for (int Item = 1; Item <= state.dataExteriorEnergyUse->NumExteriorEqs; ++Item) { + state.dataExteriorEnergyUse->ExteriorEquipment(Item).Power = state.dataExteriorEnergyUse->ExteriorEquipment(Item).DesignLevel * + state.dataExteriorEnergyUse->ExteriorEquipment(Item).sched->getCurrentVal(); state.dataExteriorEnergyUse->ExteriorEquipment(Item).CurrentUse = state.dataExteriorEnergyUse->ExteriorEquipment(Item).Power * state.dataGlobal->TimeStepZoneSec; } diff --git a/src/EnergyPlus/ExteriorEnergyUse.hh b/src/EnergyPlus/ExteriorEnergyUse.hh index 6c10765e96e..5755c0ef3e5 100644 --- a/src/EnergyPlus/ExteriorEnergyUse.hh +++ b/src/EnergyPlus/ExteriorEnergyUse.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -58,6 +58,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -77,23 +78,23 @@ namespace ExteriorEnergyUse { struct ExteriorLightUsage { // Members - std::string Name; // Descriptive name -- will show on reporting - int SchedPtr; // Can be scheduled - Real64 DesignLevel; // Consumption in Watts - Real64 Power; // Power = DesignLevel * ScheduleValue - Real64 CurrentUse; // Use for this time step - LightControlType ControlMode; // Control mode Schedule Only or Astronomical Clock plus schedule - bool ManageDemand; // Flag to indicate whether to use demand limiting - Real64 DemandLimit; // Demand limit set by demand manager [W] - bool PowerActuatorOn; // EMS flag - Real64 PowerActuatorValue; // EMS value - Real64 SumConsumption; // sum of electric consumption [J] for reporting - Real64 SumTimeNotZeroCons; // sum of time of positive electric consumption [hr] + std::string Name; // Descriptive name -- will show on reporting + Sched::Schedule *sched = nullptr; // Can be scheduled + Real64 DesignLevel; // Consumption in Watts + Real64 Power; // Power = DesignLevel * ScheduleValue + Real64 CurrentUse; // Use for this time step + LightControlType ControlMode; // Control mode Schedule Only or Astronomical Clock plus schedule + bool ManageDemand; // Flag to indicate whether to use demand limiting + Real64 DemandLimit; // Demand limit set by demand manager [W] + bool PowerActuatorOn; // EMS flag + Real64 PowerActuatorValue; // EMS value + Real64 SumConsumption; // sum of electric consumption [J] for reporting + Real64 SumTimeNotZeroCons; // sum of time of positive electric consumption [hr] // Default Constructor ExteriorLightUsage() - : SchedPtr(0), DesignLevel(0.0), Power(0.0), CurrentUse(0.0), ControlMode(LightControlType::ScheduleOnly), ManageDemand(false), - DemandLimit(0.0), PowerActuatorOn(false), PowerActuatorValue(0.0), SumConsumption(0.0), SumTimeNotZeroCons(0.0) + : DesignLevel(0.0), Power(0.0), CurrentUse(0.0), ControlMode(LightControlType::ScheduleOnly), ManageDemand(false), DemandLimit(0.0), + PowerActuatorOn(false), PowerActuatorValue(0.0), SumConsumption(0.0), SumTimeNotZeroCons(0.0) { } }; @@ -103,16 +104,16 @@ namespace ExteriorEnergyUse { // Members std::string Name; // Descriptive name -- will show on reporting Constant::eFuel FuelType; - int SchedPtr; // Can be scheduled - Real64 DesignLevel; // Design Consumption (Watts, except for Water Equipment) - Real64 Power; // Power = DesignLevel * ScheduleValue - Real64 CurrentUse; // Use for this time step - bool ManageDemand; // Flag to indicate whether to use demand limiting - Real64 DemandLimit; // Demand limit set by demand manager [W] + Sched::Schedule *sched = nullptr; // Can be scheduled + Real64 DesignLevel; // Design Consumption (Watts, except for Water Equipment) + Real64 Power; // Power = DesignLevel * ScheduleValue + Real64 CurrentUse; // Use for this time step + bool ManageDemand; // Flag to indicate whether to use demand limiting + Real64 DemandLimit; // Demand limit set by demand manager [W] // Default Constructor ExteriorEquipmentUsage() - : FuelType(Constant::eFuel::Invalid), SchedPtr(0), DesignLevel(0.0), Power(0.0), CurrentUse(0.0), ManageDemand(false), DemandLimit(0.0) + : FuelType(Constant::eFuel::Invalid), DesignLevel(0.0), Power(0.0), CurrentUse(0.0), ManageDemand(false), DemandLimit(0.0) { } }; @@ -136,6 +137,10 @@ struct ExteriorEnergyUseData : BaseGlobalStruct bool GetExteriorEnergyInputFlag = true; // First time, input is "gotten" Real64 sumDesignLevel = 0.0; // for predefined report of design level total + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ExternalInterface.cc b/src/EnergyPlus/ExternalInterface.cc index 30e6ff105df..1f96e67f9da 100644 --- a/src/EnergyPlus/ExternalInterface.cc +++ b/src/EnergyPlus/ExternalInterface.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -532,7 +532,7 @@ void InitExternalInterface(EnergyPlusData &state) state.dataExternalInterface->varInd.allocate(state.dataExternalInterface->nInpVar); for (int i = 1; i <= state.dataExternalInterface->nInpVar; ++i) { if (state.dataExternalInterface->inpVarTypes(i) == indexSchedule) { - state.dataExternalInterface->varInd(i) = ScheduleManager::GetDayScheduleIndex(state, state.dataExternalInterface->inpVarNames(i)); + state.dataExternalInterface->varInd(i) = Sched::GetDayScheduleNum(state, state.dataExternalInterface->inpVarNames(i)); } else if (state.dataExternalInterface->inpVarTypes(i) == indexVariable) { state.dataExternalInterface->varInd(i) = RuntimeLanguageProcessor::FindEMSVariable(state, state.dataExternalInterface->inpVarNames(i), 0); @@ -591,128 +591,110 @@ void GetSetVariablesAndDoStepFMUImport(EnergyPlusData &state) // This routine gets, sets and does the time integration in FMUs. for (int i = 1; i <= state.dataExternalInterface->NumFMUObjects; ++i) { - for (int j = 1; j <= state.dataExternalInterface->FMU(i).NumInstances; ++j) { + auto &fmu = state.dataExternalInterface->FMU(i); + auto &fmuTemp = state.dataExternalInterface->FMUTemp(i); + + for (int j = 1; j <= fmu.NumInstances; ++j) { + auto &fmuInst = fmu.Instance(j); + auto &fmuTempInst = fmuTemp.Instance(j); + if (state.dataExternalInterface->FlagReIni) { // Get from FMUs, values that will be set in EnergyPlus (Schedule) - for (int k = 1; k <= state.dataExternalInterface->FMUTemp(i).Instance(j).NumOutputVariablesSchedule; ++k) { - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableSchedule(k).RealVarValue = - state.dataExternalInterface->FMUTemp(i).Instance(j).fmuOutputVariableSchedule(k).RealVarValue; + for (int k = 1; k <= fmuTempInst.NumOutputVariablesSchedule; ++k) { + fmuInst.fmuOutputVariableSchedule(k).RealVarValue = fmuTempInst.fmuOutputVariableSchedule(k).RealVarValue; } // Get from FMUs, values that will be set in EnergyPlus (Variable) - for (int k = 1; k <= state.dataExternalInterface->FMUTemp(i).Instance(j).NumOutputVariablesVariable; ++k) { - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableVariable(k).RealVarValue = - state.dataExternalInterface->FMUTemp(i).Instance(j).fmuOutputVariableVariable(k).RealVarValue; + for (int k = 1; k <= fmuTempInst.NumOutputVariablesVariable; ++k) { + fmuInst.fmuOutputVariableVariable(k).RealVarValue = fmuTempInst.fmuOutputVariableVariable(k).RealVarValue; } // Get from FMUs, values that will be set in EnergyPlus (Actuator) - for (int k = 1; k <= state.dataExternalInterface->FMUTemp(i).Instance(j).NumOutputVariablesActuator; ++k) { - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableActuator(k).RealVarValue = - state.dataExternalInterface->FMUTemp(i).Instance(j).fmuOutputVariableActuator(k).RealVarValue; + for (int k = 1; k <= fmuTempInst.NumOutputVariablesActuator; ++k) { + fmuInst.fmuOutputVariableActuator(k).RealVarValue = fmuTempInst.fmuOutputVariableActuator(k).RealVarValue; } } else { // Get from FMUs, values that will be set in EnergyPlus (Schedule) - if (size(state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableSchedule) > 0) { + if (size(fmuInst.fmuOutputVariableSchedule) > 0) { // generate vectors here first std::vector valueReferenceVec; std::vector realVarValueVec; - for (unsigned long x = 1; x <= size(state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableSchedule); ++x) { - valueReferenceVec.push_back(state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableSchedule(x).ValueReference); - realVarValueVec.push_back(state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableSchedule(x).RealVarValue); + for (unsigned long x = 1; x <= size(fmuInst.fmuOutputVariableSchedule); ++x) { + valueReferenceVec.push_back(fmuInst.fmuOutputVariableSchedule(x).ValueReference); + realVarValueVec.push_back(fmuInst.fmuOutputVariableSchedule(x).RealVarValue); } // pass in the vectors as pointers to the first member of the vector - state.dataExternalInterface->FMU(i).Instance(j).fmistatus = - fmiEPlusGetReal(&state.dataExternalInterface->FMU(i).Instance(j).fmicomponent, - &valueReferenceVec[0], - &realVarValueVec[0], - &state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesSchedule, - &state.dataExternalInterface->FMU(i).Instance(j).Index); - - for (unsigned long x = 1; x <= size(state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableSchedule); ++x) { - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableSchedule(x).ValueReference = valueReferenceVec[x - 1]; - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableSchedule(x).RealVarValue = realVarValueVec[x - 1]; + fmuInst.fmistatus = fmiEPlusGetReal( + &fmuInst.fmicomponent, &valueReferenceVec[0], &realVarValueVec[0], &fmuInst.NumOutputVariablesSchedule, &fmuInst.Index); + + for (unsigned long x = 1; x <= size(fmuInst.fmuOutputVariableSchedule); ++x) { + fmuInst.fmuOutputVariableSchedule(x).ValueReference = valueReferenceVec[x - 1]; + fmuInst.fmuOutputVariableSchedule(x).RealVarValue = realVarValueVec[x - 1]; } - if (state.dataExternalInterface->FMU(i).Instance(j).fmistatus != fmiOK) { + if (fmuInst.fmistatus != fmiOK) { ShowSevereError(state, "ExternalInterface/GetSetVariablesAndDoStepFMUImport: Error when trying to get outputs"); - ShowContinueError(state, - format("in instance \"{}\" of FMU \"{}\"", - state.dataExternalInterface->FMU(i).Instance(j).Name, - state.dataExternalInterface->FMU(i).Name)); - ShowContinueError(state, format("Error Code = \"{}\"", state.dataExternalInterface->FMU(i).Instance(j).fmistatus)); + ShowContinueError(state, format("in instance \"{}\" of FMU \"{}\"", fmuInst.Name, fmu.Name)); + ShowContinueError(state, format("Error Code = \"{}\"", fmuInst.fmistatus)); state.dataExternalInterface->ErrorsFound = true; StopExternalInterfaceIfError(state); } } // generate vectors here first - if (size(state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableVariable) > 0) { + if (size(fmuInst.fmuOutputVariableVariable) > 0) { std::vector valueReferenceVec2; std::vector realVarValueVec2; - for (unsigned long x = 1; x <= size(state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableVariable); ++x) { - valueReferenceVec2.push_back(state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableVariable(x).ValueReference); - realVarValueVec2.push_back(state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableVariable(x).RealVarValue); + for (unsigned long x = 1; x <= size(fmuInst.fmuOutputVariableVariable); ++x) { + valueReferenceVec2.push_back(fmuInst.fmuOutputVariableVariable(x).ValueReference); + realVarValueVec2.push_back(fmuInst.fmuOutputVariableVariable(x).RealVarValue); } // pass in the vectors as pointers to the first member of the vector - state.dataExternalInterface->FMU(i).Instance(j).fmistatus = - fmiEPlusGetReal(&state.dataExternalInterface->FMU(i).Instance(j).fmicomponent, - &valueReferenceVec2[0], - &realVarValueVec2[0], - &state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesVariable, - &state.dataExternalInterface->FMU(i).Instance(j).Index); - - for (unsigned long x = 1; x <= size(state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableVariable); ++x) { - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableVariable(x).ValueReference = valueReferenceVec2[x - 1]; - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableVariable(x).RealVarValue = realVarValueVec2[x - 1]; + fmuInst.fmistatus = fmiEPlusGetReal( + &fmuInst.fmicomponent, &valueReferenceVec2[0], &realVarValueVec2[0], &fmuInst.NumOutputVariablesVariable, &fmuInst.Index); + + for (unsigned long x = 1; x <= size(fmuInst.fmuOutputVariableVariable); ++x) { + fmuInst.fmuOutputVariableVariable(x).ValueReference = valueReferenceVec2[x - 1]; + fmuInst.fmuOutputVariableVariable(x).RealVarValue = realVarValueVec2[x - 1]; } - if (state.dataExternalInterface->FMU(i).Instance(j).fmistatus != fmiOK) { + if (fmuInst.fmistatus != fmiOK) { ShowSevereError(state, "ExternalInterface/GetSetVariablesAndDoStepFMUImport: Error when trying to get outputs"); - ShowContinueError(state, - format("in instance \"{}\" of FMU \"{}\"", - state.dataExternalInterface->FMU(i).Instance(j).Name, - state.dataExternalInterface->FMU(i).Name)); - ShowContinueError(state, format("Error Code = \"{}\"", state.dataExternalInterface->FMU(i).Instance(j).fmistatus)); + ShowContinueError(state, format("in instance \"{}\" of FMU \"{}\"", fmuInst.Name, fmu.Name)); + ShowContinueError(state, format("Error Code = \"{}\"", fmuInst.fmistatus)); state.dataExternalInterface->ErrorsFound = true; StopExternalInterfaceIfError(state); } } - if (size(state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableActuator) > 0) { + if (size(fmuInst.fmuOutputVariableActuator) > 0) { // generate vectors here first std::vector valueReferenceVec3; std::vector realVarValueVec3; - for (unsigned long x = 1; x <= size(state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableActuator); ++x) { - valueReferenceVec3.push_back(state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableActuator(x).ValueReference); - realVarValueVec3.push_back(state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableActuator(x).RealVarValue); + for (unsigned long x = 1; x <= size(fmuInst.fmuOutputVariableActuator); ++x) { + valueReferenceVec3.push_back(fmuInst.fmuOutputVariableActuator(x).ValueReference); + realVarValueVec3.push_back(fmuInst.fmuOutputVariableActuator(x).RealVarValue); } // pass in the vectors as pointers to the first member of the vector - state.dataExternalInterface->FMU(i).Instance(j).fmistatus = - fmiEPlusGetReal(&state.dataExternalInterface->FMU(i).Instance(j).fmicomponent, - &valueReferenceVec3[0], - &realVarValueVec3[0], - &state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesActuator, - &state.dataExternalInterface->FMU(i).Instance(j).Index); - - for (unsigned long x = 1; x <= size(state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableActuator); ++x) { - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableActuator(x).ValueReference = valueReferenceVec3[x - 1]; - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableActuator(x).RealVarValue = realVarValueVec3[x - 1]; + fmuInst.fmistatus = fmiEPlusGetReal( + &fmuInst.fmicomponent, &valueReferenceVec3[0], &realVarValueVec3[0], &fmuInst.NumOutputVariablesActuator, &fmuInst.Index); + + for (unsigned long x = 1; x <= size(fmuInst.fmuOutputVariableActuator); ++x) { + fmuInst.fmuOutputVariableActuator(x).ValueReference = valueReferenceVec3[x - 1]; + fmuInst.fmuOutputVariableActuator(x).RealVarValue = realVarValueVec3[x - 1]; } - if (state.dataExternalInterface->FMU(i).Instance(j).fmistatus != fmiOK) { + if (fmuInst.fmistatus != fmiOK) { ShowSevereError(state, "ExternalInterface/GetSetVariablesAndDoStepFMUImport: Error when trying to get outputs"); - ShowContinueError(state, - format("in instance \"{}\" of FMU \"{}\"", - state.dataExternalInterface->FMU(i).Instance(j).Name, - state.dataExternalInterface->FMU(i).Name)); - ShowContinueError(state, format("Error Code = \"{}\"", state.dataExternalInterface->FMU(i).Instance(j).fmistatus)); + ShowContinueError(state, format("in instance \"{}\" of FMU \"{}\"", fmuInst.Name, fmu.Name)); + ShowContinueError(state, format("Error Code = \"{}\"", fmuInst.fmistatus)); state.dataExternalInterface->ErrorsFound = true; StopExternalInterfaceIfError(state); } @@ -720,46 +702,36 @@ void GetSetVariablesAndDoStepFMUImport(EnergyPlusData &state) } // Set in EnergyPlus the values of the schedules - for (int k = 1; k <= state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesSchedule; ++k) { - ScheduleManager::ExternalInterfaceSetSchedule( - state, - state.dataExternalInterface->FMU(i).Instance(j).eplusInputVariableSchedule(k).VarIndex, - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableSchedule(k).RealVarValue); + for (int k = 1; k <= fmuInst.NumOutputVariablesSchedule; ++k) { + Sched::ExternalInterfaceSetSchedule( + state, fmuInst.eplusInputVariableSchedule(k).VarIndex, fmuInst.fmuOutputVariableSchedule(k).RealVarValue); } // Set in EnergyPlus the values of the variables - for (int k = 1; k <= state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesVariable; ++k) { + for (int k = 1; k <= fmuInst.NumOutputVariablesVariable; ++k) { RuntimeLanguageProcessor::ExternalInterfaceSetErlVariable( - state, - state.dataExternalInterface->FMU(i).Instance(j).eplusInputVariableVariable(k).VarIndex, - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableVariable(k).RealVarValue); + state, fmuInst.eplusInputVariableVariable(k).VarIndex, fmuInst.fmuOutputVariableVariable(k).RealVarValue); } // Set in EnergyPlus the values of the actuators - for (int k = 1; k <= state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesActuator; ++k) { + for (int k = 1; k <= fmuInst.NumOutputVariablesActuator; ++k) { RuntimeLanguageProcessor::ExternalInterfaceSetErlVariable( - state, - state.dataExternalInterface->FMU(i).Instance(j).eplusInputVariableActuator(k).VarIndex, - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableActuator(k).RealVarValue); + state, fmuInst.eplusInputVariableActuator(k).VarIndex, fmuInst.fmuOutputVariableActuator(k).RealVarValue); } if (state.dataExternalInterface->FirstCallGetSetDoStep) { // Get from EnergyPlus, values that will be set in fmus - for (int k = 1; k <= state.dataExternalInterface->FMU(i).Instance(j).NumInputVariablesInIDF; ++k) { + for (int k = 1; k <= fmuInst.NumInputVariablesInIDF; ++k) { // This make sure that the variables are updated at the Zone Time Step - state.dataExternalInterface->FMU(i).Instance(j).eplusOutputVariable(k).RTSValue = - GetInternalVariableValue(state, - state.dataExternalInterface->FMU(i).Instance(j).eplusOutputVariable(k).VarType, - state.dataExternalInterface->FMU(i).Instance(j).eplusOutputVariable(k).VarIndex); + fmuInst.eplusOutputVariable(k).RTSValue = + GetInternalVariableValue(state, fmuInst.eplusOutputVariable(k).VarType, fmuInst.eplusOutputVariable(k).VarIndex); } } else { // Get from EnergyPlus, values that will be set in fmus - for (int k = 1; k <= state.dataExternalInterface->FMU(i).Instance(j).NumInputVariablesInIDF; ++k) { + for (int k = 1; k <= fmuInst.NumInputVariablesInIDF; ++k) { // This make sure that the variables are updated at the Zone Time Step - state.dataExternalInterface->FMU(i).Instance(j).eplusOutputVariable(k).RTSValue = - GetInternalVariableValueExternalInterface(state, - state.dataExternalInterface->FMU(i).Instance(j).eplusOutputVariable(k).VarType, - state.dataExternalInterface->FMU(i).Instance(j).eplusOutputVariable(k).VarIndex); + fmuInst.eplusOutputVariable(k).RTSValue = GetInternalVariableValueExternalInterface( + state, fmuInst.eplusOutputVariable(k).VarType, fmuInst.eplusOutputVariable(k).VarIndex); } } @@ -767,45 +739,35 @@ void GetSetVariablesAndDoStepFMUImport(EnergyPlusData &state) // generate vectors here first std::vector valueReferenceVec4; - for (unsigned long x = 1; x <= size(state.dataExternalInterface->FMU(i).Instance(j).fmuInputVariable); ++x) { - valueReferenceVec4.push_back(state.dataExternalInterface->FMU(i).Instance(j).fmuInputVariable(x).ValueReference); + for (unsigned long x = 1; x <= size(fmuInst.fmuInputVariable); ++x) { + valueReferenceVec4.push_back(fmuInst.fmuInputVariable(x).ValueReference); } std::vector rtsValueVec4; - for (unsigned long x = 1; x <= size(state.dataExternalInterface->FMU(i).Instance(j).eplusOutputVariable); ++x) { - rtsValueVec4.push_back(state.dataExternalInterface->FMU(i).Instance(j).eplusOutputVariable(x).RTSValue); + for (unsigned long x = 1; x <= size(fmuInst.eplusOutputVariable); ++x) { + rtsValueVec4.push_back(fmuInst.eplusOutputVariable(x).RTSValue); } - state.dataExternalInterface->FMU(i).Instance(j).fmistatus = - fmiEPlusSetReal(&state.dataExternalInterface->FMU(i).Instance(j).fmicomponent, - &valueReferenceVec4[0], - &rtsValueVec4[0], - &state.dataExternalInterface->FMU(i).Instance(j).NumInputVariablesInIDF, - &state.dataExternalInterface->FMU(i).Instance(j).Index); + fmuInst.fmistatus = + fmiEPlusSetReal(&fmuInst.fmicomponent, &valueReferenceVec4[0], &rtsValueVec4[0], &fmuInst.NumInputVariablesInIDF, &fmuInst.Index); - if (state.dataExternalInterface->FMU(i).Instance(j).fmistatus != fmiOK) { + if (fmuInst.fmistatus != fmiOK) { ShowSevereError(state, "ExternalInterface/GetSetVariablesAndDoStepFMUImport: Error when trying to set inputs"); - ShowContinueError(state, - format("in instance \"{}\" of FMU \"{}\"", - state.dataExternalInterface->FMU(i).Instance(j).Name, - state.dataExternalInterface->FMU(i).Name)); - ShowContinueError(state, format("Error Code = \"{}\"", state.dataExternalInterface->FMU(i).Instance(j).fmistatus)); + ShowContinueError(state, format("in instance \"{}\" of FMU \"{}\"", fmuInst.Name, fmu.Name)); + ShowContinueError(state, format("Error Code = \"{}\"", fmuInst.fmistatus)); state.dataExternalInterface->ErrorsFound = true; StopExternalInterfaceIfError(state); } } int localfmitrue(fmiTrue); // Call and simulate the FMUs to get values at the corresponding timestep. - state.dataExternalInterface->FMU(i).Instance(j).fmistatus = fmiEPlusDoStep(&state.dataExternalInterface->FMU(i).Instance(j).fmicomponent, - &state.dataExternalInterface->tComm, - &state.dataExternalInterface->hStep, - &localfmitrue, - &state.dataExternalInterface->FMU(i).Instance(j).Index); - if (state.dataExternalInterface->FMU(i).Instance(j).fmistatus != fmiOK) { + fmuInst.fmistatus = fmiEPlusDoStep( + &fmuInst.fmicomponent, &state.dataExternalInterface->tComm, &state.dataExternalInterface->hStep, &localfmitrue, &fmuInst.Index); + if (fmuInst.fmistatus != fmiOK) { ShowSevereError(state, "ExternalInterface/GetSetVariablesAndDoStepFMUImport: Error when trying to"); - ShowContinueError(state, format("do the coSimulation with instance \"{}\"", state.dataExternalInterface->FMU(i).Instance(j).Name)); - ShowContinueError(state, format("of FMU \"{}\"", state.dataExternalInterface->FMU(i).Name)); - ShowContinueError(state, format("Error Code = \"{}\"", state.dataExternalInterface->FMU(i).Instance(j).fmistatus)); + ShowContinueError(state, format("do the coSimulation with instance \"{}\"", fmuInst.Name)); + ShowContinueError(state, format("of FMU \"{}\"", fmu.Name)); + ShowContinueError(state, format("Error Code = \"{}\"", fmuInst.fmistatus)); state.dataExternalInterface->ErrorsFound = true; StopExternalInterfaceIfError(state); } @@ -832,23 +794,16 @@ void InstantiateInitializeFMUImport(EnergyPlusData &state) // Instantiate FMUs for (int i = 1; i <= state.dataExternalInterface->NumFMUObjects; ++i) { - for (int j = 1; j <= state.dataExternalInterface->FMU(i).NumInstances; ++j) { - std::string const folderStr = FileSystem::toString(state.dataExternalInterface->FMU(i).Instance(j).WorkingFolder); - state.dataExternalInterface->FMU(i).Instance(j).fmicomponent = - fmiEPlusInstantiateSlave((char *)folderStr.c_str(), - &state.dataExternalInterface->FMU(i).Instance(j).LenWorkingFolder, - &state.dataExternalInterface->FMU(i).TimeOut, - &state.dataExternalInterface->FMU(i).Visible, - &state.dataExternalInterface->FMU(i).Interactive, - &state.dataExternalInterface->FMU(i).LoggingOn, - &state.dataExternalInterface->FMU(i).Instance(j).Index); + auto &fmu = state.dataExternalInterface->FMU(i); + for (int j = 1; j <= fmu.NumInstances; ++j) { + auto &fmuInst = fmu.Instance(j); + std::string const folderStr = FileSystem::toString(fmuInst.WorkingFolder); + fmuInst.fmicomponent = fmiEPlusInstantiateSlave( + (char *)folderStr.c_str(), &fmuInst.LenWorkingFolder, &fmu.TimeOut, &fmu.Visible, &fmu.Interactive, &fmu.LoggingOn, &fmuInst.Index); // TODO: This is doing a null pointer check; OK? - if (!state.dataExternalInterface->FMU(i).Instance(j).fmicomponent) { + if (!fmuInst.fmicomponent) { ShowSevereError(state, "ExternalInterface/CalcExternalInterfaceFMUImport: Error when trying to instantiate"); - ShowContinueError(state, - format("instance \"{}\" of FMU \"{}\"", - state.dataExternalInterface->FMU(i).Instance(j).Name, - state.dataExternalInterface->FMU(i).Name)); + ShowContinueError(state, format("instance \"{}\" of FMU \"{}\"", fmuInst.Name, fmu.Name)); state.dataExternalInterface->ErrorsFound = true; StopExternalInterfaceIfError(state); } @@ -858,20 +813,15 @@ void InstantiateInitializeFMUImport(EnergyPlusData &state) // Initialize FMUs int localfmiTrue(fmiTrue); for (int i = 1; i <= state.dataExternalInterface->NumFMUObjects; ++i) { - for (int j = 1; j <= state.dataExternalInterface->FMU(i).NumInstances; ++j) { - state.dataExternalInterface->FMU(i).Instance(j).fmistatus = - fmiEPlusInitializeSlave(&state.dataExternalInterface->FMU(i).Instance(j).fmicomponent, - &state.dataExternalInterface->tStart, - &localfmiTrue, - &state.dataExternalInterface->tStop, - &state.dataExternalInterface->FMU(i).Instance(j).Index); - if (state.dataExternalInterface->FMU(i).Instance(j).fmistatus != fmiOK) { + auto &fmu = state.dataExternalInterface->FMU(i); + for (int j = 1; j <= fmu.NumInstances; ++j) { + auto &fmuInst = fmu.Instance(j); + fmuInst.fmistatus = fmiEPlusInitializeSlave( + &fmuInst.fmicomponent, &state.dataExternalInterface->tStart, &localfmiTrue, &state.dataExternalInterface->tStop, &fmuInst.Index); + if (fmuInst.fmistatus != fmiOK) { ShowSevereError(state, "ExternalInterface/CalcExternalInterfaceFMUImport: Error when trying to initialize"); - ShowContinueError(state, - format("instance \"{}\" of FMU \"{}\"", - state.dataExternalInterface->FMU(i).Instance(j).Name, - state.dataExternalInterface->FMU(i).Name)); - ShowContinueError(state, format("Error Code = \"{}\"", state.dataExternalInterface->FMU(i).Instance(j).fmistatus)); + ShowContinueError(state, format("instance \"{}\" of FMU \"{}\"", fmuInst.Name, fmu.Name)); + ShowContinueError(state, format("Error Code = \"{}\"", fmuInst.fmistatus)); state.dataExternalInterface->ErrorsFound = true; StopExternalInterfaceIfError(state); } @@ -893,20 +843,15 @@ void InitializeFMU(EnergyPlusData &state) // Initialize FMUs for (int i = 1; i <= state.dataExternalInterface->NumFMUObjects; ++i) { - for (int j = 1; j <= state.dataExternalInterface->FMU(i).NumInstances; ++j) { - state.dataExternalInterface->FMU(i).Instance(j).fmistatus = - fmiEPlusInitializeSlave(&state.dataExternalInterface->FMU(i).Instance(j).fmicomponent, - &state.dataExternalInterface->tStart, - &localfmiTrue, - &state.dataExternalInterface->tStop, - &state.dataExternalInterface->FMU(i).Instance(j).Index); - if (state.dataExternalInterface->FMU(i).Instance(j).fmistatus != fmiOK) { + auto &fmu = state.dataExternalInterface->FMU(i); + for (int j = 1; j <= fmu.NumInstances; ++j) { + auto &fmuInst = fmu.Instance(j); + fmuInst.fmistatus = fmiEPlusInitializeSlave( + &fmuInst.fmicomponent, &state.dataExternalInterface->tStart, &localfmiTrue, &state.dataExternalInterface->tStop, &fmuInst.Index); + if (fmuInst.fmistatus != fmiOK) { ShowSevereError(state, "ExternalInterface/CalcExternalInterfaceFMUImport: Error when trying to initialize"); - ShowContinueError(state, - format("instance \"{}\" of FMU \"{}\"", - state.dataExternalInterface->FMU(i).Instance(j).Name, - state.dataExternalInterface->FMU(i).Name)); - ShowContinueError(state, format("Error Code = \"{}\"", state.dataExternalInterface->FMU(i).Instance(j).fmistatus)); + ShowContinueError(state, format("instance \"{}\" of FMU \"{}\"", fmuInst.Name, fmu.Name)); + ShowContinueError(state, format("Error Code = \"{}\"", fmuInst.fmistatus)); state.dataExternalInterface->ErrorsFound = true; StopExternalInterfaceIfError(state); } @@ -925,21 +870,17 @@ void TerminateResetFreeFMUImport(EnergyPlusData &state, int fmiEndSimulation) //----Needs to have function that allows to terminates FMU. Was not defined in version 1.0 -- fixme for (int i = 1; i <= state.dataExternalInterface->NumFMUObjects; ++i) { - for (int j = 1; j <= state.dataExternalInterface->FMU(i).NumInstances; ++j) { - if (state.dataExternalInterface->FMU(i).Instance(j).fmistatus != fmiFatal) { + auto &fmu = state.dataExternalInterface->FMU(i); + for (int j = 1; j <= fmu.NumInstances; ++j) { + auto &fmuInst = fmu.Instance(j); + if (fmuInst.fmistatus != fmiFatal) { // Cleanup slaves - state.dataExternalInterface->FMU(i).Instance(j).fmistatus = - fmiEPlusFreeSlave(&state.dataExternalInterface->FMU(i).Instance(j).fmicomponent, - &state.dataExternalInterface->FMU(i).Instance(j).Index, - &fmiEndSimulation); + fmuInst.fmistatus = fmiEPlusFreeSlave(&fmuInst.fmicomponent, &fmuInst.Index, &fmiEndSimulation); } // check if fmiComponent has been freed - if (!state.dataExternalInterface->FMU(i).Instance(j).fmicomponent) { + if (!fmuInst.fmicomponent) { ShowSevereError(state, "ExternalInterface/TerminateResetFreeFMUImport: Error when trying to terminate"); - ShowContinueError(state, - format("instance \"{}\" of FMU \"{}\"", - state.dataExternalInterface->FMU(i).Instance(j).Name, - state.dataExternalInterface->FMU(i).Name)); + ShowContinueError(state, format("instance \"{}\" of FMU \"{}\"", fmuInst.Name, fmu.Name)); state.dataExternalInterface->ErrorsFound = true; StopExternalInterfaceIfError(state); } @@ -1065,10 +1006,12 @@ void InitExternalInterfaceFMUImport(EnergyPlusData &state) int NumFMUInputVariables = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); // Determine the number of instances for each FMUs for (int i = 1; i <= state.dataExternalInterface->NumFMUObjects; ++i) { + auto &fmu = state.dataExternalInterface->FMU(i); + std::string Name_OLD = ""; int j = 1; int k = 1; - state.dataExternalInterface->FMU(i).Instance.allocate(NumFMUInputVariables); + fmu.Instance.allocate(NumFMUInputVariables); state.dataExternalInterface->checkInstanceName.allocate(NumFMUInputVariables); for (int l = 1; l <= NumFMUInputVariables; ++l) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -1083,19 +1026,19 @@ void InitExternalInterfaceFMUImport(EnergyPlusData &state) _, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), state.dataExternalInterface->FMU(i).Name)) { + if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), fmu.Name)) { std::string Name_NEW = state.dataIPShortCut->cAlphaArgs(4); if (!Util::SameString(Name_OLD, Name_NEW)) { int FOUND = Util::FindItem(Name_NEW, state.dataExternalInterface->checkInstanceName); if (FOUND == 0) { state.dataExternalInterface->checkInstanceName(l).Name = Name_NEW; - state.dataExternalInterface->FMU(i).NumInstances = j; - state.dataExternalInterface->FMU(i).Instance(j).Name = Name_NEW; + fmu.NumInstances = j; + fmu.Instance(j).Name = Name_NEW; ++j; Name_OLD = Name_NEW; } } - state.dataExternalInterface->FMU(i).TotNumInputVariablesInIDF = k; + fmu.TotNumInputVariablesInIDF = k; ++k; } } @@ -1103,16 +1046,16 @@ void InitExternalInterfaceFMUImport(EnergyPlusData &state) } for (int i = 1; i <= state.dataExternalInterface->NumFMUObjects; ++i) { - if (state.dataExternalInterface->FMU(i).NumInstances == 0) { - ShowSevereError( - state, format("ExternalInterface/InitExternalInterfaceFMUImport: The FMU \"{}\" does", state.dataExternalInterface->FMU(i).Name)); + auto &fmu = state.dataExternalInterface->FMU(i); + if (fmu.NumInstances == 0) { + ShowSevereError(state, format("ExternalInterface/InitExternalInterfaceFMUImport: The FMU \"{}\" does", fmu.Name)); ShowContinueError(state, "not have any instances or any input variable. An FMU should have at least one instance"); ShowContinueError(state, "or one input variable defined in input file. Check FMU object in the input file."); state.dataExternalInterface->ErrorsFound = true; StopExternalInterfaceIfError(state); } - if (NumFMUInputVariables > 0 && state.dataExternalInterface->FMU(i).TotNumInputVariablesInIDF == 0) { - ShowWarningError(state, format("InitExternalInterfaceFMUImport: The FMU \"{}\"", state.dataExternalInterface->FMU(i).Name)); + if (NumFMUInputVariables > 0 && fmu.TotNumInputVariablesInIDF == 0) { + ShowWarningError(state, format("InitExternalInterfaceFMUImport: The FMU \"{}\"", fmu.Name)); ShowContinueError(state, "is defined but has no input variables."); ShowContinueError(state, "Check the input field of the corresponding object"); ShowContinueError(state, "ExternalInterface:FunctionalMockupUnitImport:From:Variable."); @@ -1121,19 +1064,21 @@ void InitExternalInterfaceFMUImport(EnergyPlusData &state) // write output folder where FMUs will be unpacked later on. for (int i = 1; i <= state.dataExternalInterface->NumFMUObjects; ++i) { - for (int j = 1; j <= state.dataExternalInterface->FMU(i).NumInstances; ++j) { - state.dataExternalInterface->FMU(i).Instance(j).WorkingFolder = - state.dataExternalInterface->FMURootWorkingFolder / - fs::path(strippedFileName(i) + '_' + state.dataExternalInterface->FMU(i).Instance(j).Name); + auto &fmu = state.dataExternalInterface->FMU(i); + for (int j = 1; j <= fmu.NumInstances; ++j) { + auto &fmuInst = fmu.Instance(j); + fmuInst.WorkingFolder = state.dataExternalInterface->FMURootWorkingFolder / fs::path(strippedFileName(i) + '_' + fmuInst.Name); } } // parse the fmu defined in the idf using the fmuUnpack. for (int i = 1; i <= state.dataExternalInterface->NumFMUObjects; ++i) { - for (int j = 1; j <= state.dataExternalInterface->FMU(i).NumInstances; ++j) { + auto &fmu = state.dataExternalInterface->FMU(i); + for (int j = 1; j <= fmu.NumInstances; ++j) { + auto &fmuInst = fmu.Instance(j); // get the length of working folder trimmed - std::string const workingFolderStr = FileSystem::toString(state.dataExternalInterface->FMU(i).Instance(j).WorkingFolder); - state.dataExternalInterface->FMU(i).Instance(j).LenWorkingFolder = workingFolderStr.length(); + std::string const workingFolderStr = FileSystem::toString(fmuInst.WorkingFolder); + fmuInst.LenWorkingFolder = workingFolderStr.length(); // unpack fmus // preprocess arguments for library call { @@ -1142,12 +1087,11 @@ void InitExternalInterfaceFMUImport(EnergyPlusData &state) int lenFileName(len(fullFileName(i))); // make the library call - int retVal = fmiEPlusUnpack( - &fullFileNameArr[0], &workingFolderArr[0], &lenFileName, &state.dataExternalInterface->FMU(i).Instance(j).LenWorkingFolder); + int retVal = fmiEPlusUnpack(&fullFileNameArr[0], &workingFolderArr[0], &lenFileName, &fmuInst.LenWorkingFolder); if (retVal != 0) { ShowSevereError(state, "ExternalInterface/InitExternalInterfaceFMUImport: Error when trying to"); - ShowContinueError(state, format("unpack the FMU \"{}\".", state.dataExternalInterface->FMU(i).Name)); + ShowContinueError(state, format("unpack the FMU \"{}\".", fmu.Name)); ShowContinueError(state, "Check if the FMU exists. Also check if the FMU folder is not write protected."); state.dataExternalInterface->ErrorsFound = true; StopExternalInterfaceIfError(state); @@ -1160,20 +1104,16 @@ void InitExternalInterfaceFMUImport(EnergyPlusData &state) std::vector workingFolderArr(getCharArrayFromString(workingFolderStr)); // make the library call - state.dataExternalInterface->FMU(i).Instance(j).Index = - model_ID_GUID((char *)state.dataExternalInterface->FMU(i).Instance(j).Name.c_str(), - &workingFolderArr[0], - &state.dataExternalInterface->FMU(i).Instance(j).LenWorkingFolder, - &state.dataExternalInterface->FMU(i).Instance(j).NumInputVariablesInFMU, - &state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesInFMU); - - if (state.dataExternalInterface->FMU(i).Instance(j).Index < 0) { + fmuInst.Index = model_ID_GUID((char *)fmuInst.Name.c_str(), + &workingFolderArr[0], + &fmuInst.LenWorkingFolder, + &fmuInst.NumInputVariablesInFMU, + &fmuInst.NumOutputVariablesInFMU); + + if (fmuInst.Index < 0) { ShowSevereError(state, "ExternalInterface/InitExternalInterfaceFMUImport: Error when trying to"); ShowContinueError(state, "get the model ID and model GUID"); - ShowContinueError(state, - format("of instance \"{}\" of FMU \"{}\".", - state.dataExternalInterface->FMU(i).Instance(j).Name, - state.dataExternalInterface->FMU(i).Name)); + ShowContinueError(state, format("of instance \"{}\" of FMU \"{}\".", fmuInst.Name, fmu.Name)); ShowContinueError(state, "Check if modelDescription.xml exists in the folder where the FMU has been unpacked."); state.dataExternalInterface->ErrorsFound = true; StopExternalInterfaceIfError(state); @@ -1192,68 +1132,53 @@ void InitExternalInterfaceFMUImport(EnergyPlusData &state) std::vector workingFolderWithLibArr(getCharArrayFromString(reservedString)); // make the library call - int retValfmiPathLib = addLibPathCurrentWorkingFolder(&workingFolderWithLibArr[0], - &workingFolderArr[0], - &state.dataExternalInterface->FMU(i).Instance(j).LenWorkingFolder, - &state.dataExternalInterface->FMU(i).Instance(j).Index); + int retValfmiPathLib = + addLibPathCurrentWorkingFolder(&workingFolderWithLibArr[0], &workingFolderArr[0], &fmuInst.LenWorkingFolder, &fmuInst.Index); // post process args in case they are used later - state.dataExternalInterface->FMU(i).Instance(j).WorkingFolder_wLib = - fs::path(trim(getStringFromCharArray(workingFolderWithLibArr))); + fmuInst.WorkingFolder_wLib = fs::path(trim(getStringFromCharArray(workingFolderWithLibArr))); if (retValfmiPathLib != 0) { ShowSevereError(state, "ExternalInterface/InitExternalInterfaceFMUImport: Error when trying to"); ShowContinueError(state, "get the path to the binaries of instance"); - ShowContinueError(state, - format("\"{}\" of FMU \"{}\".", - state.dataExternalInterface->FMU(i).Instance(j).Name, - state.dataExternalInterface->FMU(i).Name)); + ShowContinueError(state, format("\"{}\" of FMU \"{}\".", fmuInst.Name, fmu.Name)); ShowContinueError(state, "Check if binaries folder exists where the FMU has been unpacked."); state.dataExternalInterface->ErrorsFound = true; StopExternalInterfaceIfError(state); } // get the length of the working folder with libraries - state.dataExternalInterface->FMU(i).Instance(j).LenWorkingFolder_wLib = - FileSystem::toString(state.dataExternalInterface->FMU(i).Instance(j).WorkingFolder_wLib).length(); + fmuInst.LenWorkingFolder_wLib = FileSystem::toString(fmuInst.WorkingFolder_wLib).length(); } { // determine the FMI version // preprocess args for library call - std::vector workingFolderWithLibArr( - getCharArrayFromString(FileSystem::toString(state.dataExternalInterface->FMU(i).Instance(j).WorkingFolder_wLib))); + std::vector workingFolderWithLibArr(getCharArrayFromString(FileSystem::toString(fmuInst.WorkingFolder_wLib))); std::vector VersionNumArr( getCharArrayFromString(" ")); // the version should only be 3 characters long, since for now we only handle "1.0" // make the library call - int retValfmiVersion = getfmiEPlusVersion(&workingFolderWithLibArr[0], - &state.dataExternalInterface->FMU(i).Instance(j).LenWorkingFolder_wLib, - &VersionNumArr[0], - &state.dataExternalInterface->FMU(i).Instance(j).Index); + int retValfmiVersion = + getfmiEPlusVersion(&workingFolderWithLibArr[0], &fmuInst.LenWorkingFolder_wLib, &VersionNumArr[0], &fmuInst.Index); // post process in case args are used later - state.dataExternalInterface->FMU(i).Instance(j).fmiVersionNumber = getStringFromCharArray(VersionNumArr); + fmuInst.fmiVersionNumber = getStringFromCharArray(VersionNumArr); if (retValfmiVersion != 0) { ShowSevereError(state, "ExternalInterface/InitExternalInterfaceFMUImport: Error when trying to"); ShowContinueError(state, "load FMI functions library of instance"); - ShowContinueError(state, - format("\"{}\" of FMU \"{}\".", - state.dataExternalInterface->FMU(i).Instance(j).Name, - state.dataExternalInterface->FMU(i).Name)); - ShowContinueError(state, format("\"{}\".", state.dataExternalInterface->FMU(i).Instance(j).fmiVersionNumber)); + ShowContinueError(state, format("\"{}\" of FMU \"{}\".", fmuInst.Name, fmu.Name)); + ShowContinueError(state, format("\"{}\".", fmuInst.fmiVersionNumber)); state.dataExternalInterface->ErrorsFound = true; StopExternalInterfaceIfError(state); } - if (state.dataExternalInterface->FMU(i).Instance(j).fmiVersionNumber.substr(0, 3) != "1.0") { + if (fmuInst.fmiVersionNumber.substr(0, 3) != "1.0") { ShowSevereError(state, "ExternalInterface/InitExternalInterfaceFMUImport: Error when getting version"); - ShowContinueError(state, format("number of instance \"{}\"", state.dataExternalInterface->FMU(i).Instance(j).Name)); - ShowContinueError(state, format("of FMU \"{}\".", state.dataExternalInterface->FMU(i).Name)); - ShowContinueError(state, - format("The version number found (\"{}\")", - state.dataExternalInterface->FMU(i).Instance(j).fmiVersionNumber.substr(0, 3))); + ShowContinueError(state, format("number of instance \"{}\"", fmuInst.Name)); + ShowContinueError(state, format("of FMU \"{}\".", fmu.Name)); + ShowContinueError(state, format("The version number found (\"{}\")", fmuInst.fmiVersionNumber.substr(0, 3))); ShowContinueError(state, "differs from version 1.0 which is currently supported."); state.dataExternalInterface->ErrorsFound = true; StopExternalInterfaceIfError(state); @@ -1267,11 +1192,13 @@ void InitExternalInterfaceFMUImport(EnergyPlusData &state) state.dataExternalInterface->UniqueFMUInputVarNames.reserve(static_cast(NumFMUInputVariables)); for (int i = 1; i <= state.dataExternalInterface->NumFMUObjects; ++i) { - for (int j = 1; j <= state.dataExternalInterface->FMU(i).NumInstances; ++j) { - state.dataExternalInterface->FMU(i).Instance(j).fmuInputVariable.allocate(NumFMUInputVariables); - state.dataExternalInterface->FMU(i).Instance(j).checkfmuInputVariable.allocate(NumFMUInputVariables); + auto &fmu = state.dataExternalInterface->FMU(i); + for (int j = 1; j <= fmu.NumInstances; ++j) { + auto &fmuInst = fmu.Instance(j); + fmuInst.fmuInputVariable.allocate(NumFMUInputVariables); + fmuInst.checkfmuInputVariable.allocate(NumFMUInputVariables); state.dataExternalInterface->UniqueFMUInputVarNames.clear(); - state.dataExternalInterface->FMU(i).Instance(j).eplusOutputVariable.allocate(NumFMUInputVariables); + fmuInst.eplusOutputVariable.allocate(NumFMUInputVariables); int k = 1; for (int l = 1; l <= NumFMUInputVariables; ++l) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -1286,17 +1213,17 @@ void InitExternalInterfaceFMUImport(EnergyPlusData &state) _, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), state.dataExternalInterface->FMU(i).Name) && - Util::SameString(state.dataIPShortCut->cAlphaArgs(4), state.dataExternalInterface->FMU(i).Instance(j).Name)) { - state.dataExternalInterface->FMU(i).Instance(j).fmuInputVariable(k).Name = state.dataIPShortCut->cAlphaArgs(5); - state.dataExternalInterface->FMU(i).Instance(j).eplusOutputVariable(k).VarKey = state.dataIPShortCut->cAlphaArgs(1); - state.dataExternalInterface->FMU(i).Instance(j).eplusOutputVariable(k).Name = state.dataIPShortCut->cAlphaArgs(2); + if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), fmu.Name) && + Util::SameString(state.dataIPShortCut->cAlphaArgs(4), fmuInst.Name)) { + fmuInst.fmuInputVariable(k).Name = state.dataIPShortCut->cAlphaArgs(5); + fmuInst.eplusOutputVariable(k).VarKey = state.dataIPShortCut->cAlphaArgs(1); + fmuInst.eplusOutputVariable(k).Name = state.dataIPShortCut->cAlphaArgs(2); // verify whether we have duplicate FMU input variables in the idf GlobalNames::VerifyUniqueInterObjectName(state, state.dataExternalInterface->UniqueFMUInputVarNames, - state.dataExternalInterface->FMU(i).Instance(j).fmuInputVariable(k).Name, + fmuInst.fmuInputVariable(k).Name, cCurrentModuleObject, - state.dataExternalInterface->FMU(i).Instance(j).Name, + fmuInst.Name, state.dataExternalInterface->ErrorsFound); // Util::VerifyName( state.dataExternalInterface->FMU( i ).Instance( j // ).fmuInputVariable( @@ -1313,45 +1240,35 @@ void InitExternalInterfaceFMUImport(EnergyPlusData &state) if (state.dataExternalInterface->ErrorsFound) { StopExternalInterfaceIfError(state); } else { - state.dataExternalInterface->FMU(i).Instance(j).checkfmuInputVariable(k).Name = - state.dataExternalInterface->FMU(i).Instance(j).fmuInputVariable(k).Name; + fmuInst.checkfmuInputVariable(k).Name = fmuInst.fmuInputVariable(k).Name; } // preprocess args for library call - std::vector inputVarNameArr( - getCharArrayFromString(state.dataExternalInterface->FMU(i).Instance(j).fmuInputVariable(k).Name)); - int inputVarNameLen(len(state.dataExternalInterface->FMU(i).Instance(j).fmuInputVariable(k).Name)); + std::vector inputVarNameArr(getCharArrayFromString(fmuInst.fmuInputVariable(k).Name)); + int inputVarNameLen(len(fmuInst.fmuInputVariable(k).Name)); // make the library call - state.dataExternalInterface->FMU(i).Instance(j).fmuInputVariable(k).ValueReference = getValueReferenceByNameFMUInputVariables( - &inputVarNameArr[0], &inputVarNameLen, &state.dataExternalInterface->FMU(i).Instance(j).Index); + fmuInst.fmuInputVariable(k).ValueReference = + getValueReferenceByNameFMUInputVariables(&inputVarNameArr[0], &inputVarNameLen, &fmuInst.Index); // postprocess args in case they are used later - state.dataExternalInterface->FMU(i).Instance(j).fmuInputVariable(k).Name = getStringFromCharArray(inputVarNameArr); + fmuInst.fmuInputVariable(k).Name = getStringFromCharArray(inputVarNameArr); - if (state.dataExternalInterface->FMU(i).Instance(j).fmuInputVariable(k).ValueReference == -999) { + if (fmuInst.fmuInputVariable(k).ValueReference == -999) { ShowSevereError(state, "ExternalInterface/InitExternalInterfaceFMUImport: Error when trying to"); ShowContinueError(state, "get the value reference of FMU input variable"); - ShowContinueError(state, - format("\"{}\" of instance \"{}\" of FMU", - state.dataExternalInterface->FMU(i).Instance(j).fmuInputVariable(k).Name, - state.dataExternalInterface->FMU(i).Instance(j).Name)); - ShowContinueError( - state, format("of FMU \"{}\". Please check the name of input variable", state.dataExternalInterface->FMU(i).Name)); + ShowContinueError(state, format("\"{}\" of instance \"{}\" of FMU", fmuInst.fmuInputVariable(k).Name, fmuInst.Name)); + ShowContinueError(state, format("of FMU \"{}\". Please check the name of input variable", fmu.Name)); ShowContinueError(state, "in the input file and in the modelDescription file."); state.dataExternalInterface->ErrorsFound = true; StopExternalInterfaceIfError(state); } - if (state.dataExternalInterface->FMU(i).Instance(j).fmuInputVariable(k).ValueReference == -1) { + if (fmuInst.fmuInputVariable(k).ValueReference == -1) { ShowSevereError(state, "ExternalInterface/InitExternalInterfaceFMUImport: Error when trying to"); ShowContinueError(state, "get the value reference of FMU input variable"); - ShowContinueError(state, - format("\"{}\" of instance \"{}\" of FMU", - state.dataExternalInterface->FMU(i).Instance(j).fmuInputVariable(k).Name, - state.dataExternalInterface->FMU(i).Instance(j).Name)); - ShowContinueError( - state, format("\"{}\". This variable is not an FMU input variable.", state.dataExternalInterface->FMU(i).Name)); + ShowContinueError(state, format("\"{}\" of instance \"{}\" of FMU", fmuInst.fmuInputVariable(k).Name, fmuInst.Name)); + ShowContinueError(state, format("\"{}\". This variable is not an FMU input variable.", fmu.Name)); ShowContinueError(state, "Please check the causality of the variable in the modelDescription file."); state.dataExternalInterface->ErrorsFound = true; StopExternalInterfaceIfError(state); @@ -1359,28 +1276,25 @@ void InitExternalInterfaceFMUImport(EnergyPlusData &state) // The next call expects an array, but a single item is passed // Therefore create a single item array here first - Array1D_string tempSingleStringA(1, state.dataExternalInterface->FMU(i).Instance(j).eplusOutputVariable(k).VarKey); - Array1D_string tempSingleStringB(1, state.dataExternalInterface->FMU(i).Instance(j).eplusOutputVariable(k).Name); + Array1D_string tempSingleStringA(1, fmuInst.eplusOutputVariable(k).VarKey); + Array1D_string tempSingleStringB(1, fmuInst.eplusOutputVariable(k).Name); // Make the call with arrays GetReportVariableKey(state, tempSingleStringA, 1, tempSingleStringB, keyIndexes, varTypes); // Then postprocess the array items back in case they changed - state.dataExternalInterface->FMU(i).Instance(j).eplusOutputVariable(k).VarKey = tempSingleStringA(1); - state.dataExternalInterface->FMU(i).Instance(j).eplusOutputVariable(k).Name = tempSingleStringB(1); + fmuInst.eplusOutputVariable(k).VarKey = tempSingleStringA(1); + fmuInst.eplusOutputVariable(k).Name = tempSingleStringB(1); - state.dataExternalInterface->FMU(i).Instance(j).eplusOutputVariable(k).VarIndex = keyIndexes(1); - state.dataExternalInterface->FMU(i).Instance(j).eplusOutputVariable(k).VarType = varTypes(1); - state.dataExternalInterface->FMU(i).Instance(j).NumInputVariablesInIDF = k; + fmuInst.eplusOutputVariable(k).VarIndex = keyIndexes(1); + fmuInst.eplusOutputVariable(k).VarType = varTypes(1); + fmuInst.NumInputVariablesInIDF = k; ++k; } } - if (NumFMUInputVariables > 0 && state.dataExternalInterface->FMU(i).Instance(j).NumInputVariablesInIDF == 0) { - ShowWarningError(state, - format("InitExternalInterfaceFMUImport: The instance \"{}\" of FMU \"{}\"", - state.dataExternalInterface->FMU(i).Instance(j).Name, - state.dataExternalInterface->FMU(i).Name)); + if (NumFMUInputVariables > 0 && fmuInst.NumInputVariablesInIDF == 0) { + ShowWarningError(state, format("InitExternalInterfaceFMUImport: The instance \"{}\" of FMU \"{}\"", fmuInst.Name, fmu.Name)); ShowContinueError(state, "is defined but has no input variables. Check the input field of the"); ShowContinueError(state, "corresponding object: ExternalInterface:FunctionalMockupUnitImport:From:Variable."); } @@ -1388,33 +1302,27 @@ void InitExternalInterfaceFMUImport(EnergyPlusData &state) } for (int i = 1; i <= state.dataExternalInterface->NumFMUObjects; ++i) { - for (int j = 1; j <= state.dataExternalInterface->FMU(i).NumInstances; ++j) { + auto &fmu = state.dataExternalInterface->FMU(i); + for (int j = 1; j <= fmu.NumInstances; ++j) { + auto &fmuInst = fmu.Instance(j); // check whether the number of input variables in fmu is bigger than in the idf - if (state.dataExternalInterface->FMU(i).Instance(j).NumInputVariablesInFMU > - state.dataExternalInterface->FMU(i).Instance(j).NumInputVariablesInIDF) { + if (fmuInst.NumInputVariablesInFMU > fmuInst.NumInputVariablesInIDF) { ShowWarningError(state, format("InitExternalInterfaceFMUImport: The number of input variables defined in input file ({})", - state.dataExternalInterface->FMU(i).Instance(j).NumInputVariablesInIDF)); + fmuInst.NumInputVariablesInIDF)); ShowContinueError(state, - format("of instance \"{}\" of FMU \"{}\" is less than the number of input variables", - state.dataExternalInterface->FMU(i).Instance(j).Name, - state.dataExternalInterface->FMU(i).Name)); - ShowContinueError( - state, format("in the modelDescription file ({}).", state.dataExternalInterface->FMU(i).Instance(j).NumInputVariablesInFMU)); + format("of instance \"{}\" of FMU \"{}\" is less than the number of input variables", fmuInst.Name, fmu.Name)); + ShowContinueError(state, format("in the modelDescription file ({}).", fmuInst.NumInputVariablesInFMU)); ShowContinueError(state, "Check the input file and the modelDescription file again."); } // check whether the number of input variables in fmu is less than in the idf - if (state.dataExternalInterface->FMU(i).Instance(j).NumInputVariablesInFMU < - state.dataExternalInterface->FMU(i).Instance(j).NumInputVariablesInIDF) { + if (fmuInst.NumInputVariablesInFMU < fmuInst.NumInputVariablesInIDF) { ShowWarningError(state, format("InitExternalInterfaceFMUImport: The number of input variables defined in input file ({})", - state.dataExternalInterface->FMU(i).Instance(j).NumInputVariablesInIDF)); - ShowContinueError(state, - format("of instance \"{}\" of FMU \"{}\" is bigger than the number of input variables", - state.dataExternalInterface->FMU(i).Instance(j).Name, - state.dataExternalInterface->FMU(i).Name)); + fmuInst.NumInputVariablesInIDF)); ShowContinueError( - state, format("in the modelDescription file ({}).", state.dataExternalInterface->FMU(i).Instance(j).NumInputVariablesInFMU)); + state, format("of instance \"{}\" of FMU \"{}\" is bigger than the number of input variables", fmuInst.Name, fmu.Name)); + ShowContinueError(state, format("in the modelDescription file ({}).", fmuInst.NumInputVariablesInFMU)); ShowContinueError(state, "Check the input file and the modelDescription file again."); } } @@ -1426,6 +1334,7 @@ void InitExternalInterfaceFMUImport(EnergyPlusData &state) NumFMUInputVariables = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); for (int i = 1; i <= state.dataExternalInterface->NumFMUObjects; ++i) { + auto &fmu = state.dataExternalInterface->FMU(i); int j = 1; for (int k = 1; k <= NumFMUInputVariables; ++k) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -1440,17 +1349,19 @@ void InitExternalInterfaceFMUImport(EnergyPlusData &state) _, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), state.dataExternalInterface->FMU(i).Name)) { - state.dataExternalInterface->FMU(i).TotNumOutputVariablesSchedule = j; + if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), fmu.Name)) { + fmu.TotNumOutputVariablesSchedule = j; ++j; } } } for (int i = 1; i <= state.dataExternalInterface->NumFMUObjects; ++i) { - for (int j = 1; j <= state.dataExternalInterface->FMU(i).NumInstances; ++j) { - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableSchedule.allocate(NumFMUInputVariables); - state.dataExternalInterface->FMU(i).Instance(j).eplusInputVariableSchedule.allocate(NumFMUInputVariables); + auto &fmu = state.dataExternalInterface->FMU(i); + for (int j = 1; j <= fmu.NumInstances; ++j) { + auto &fmuInst = fmu.Instance(j); + fmuInst.fmuOutputVariableSchedule.allocate(NumFMUInputVariables); + fmuInst.eplusInputVariableSchedule.allocate(NumFMUInputVariables); int k = 1; for (int l = 1; l <= NumFMUInputVariables; ++l) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -1465,67 +1376,55 @@ void InitExternalInterfaceFMUImport(EnergyPlusData &state) _, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), state.dataExternalInterface->FMU(i).Name) && - Util::SameString(state.dataIPShortCut->cAlphaArgs(4), state.dataExternalInterface->FMU(i).Instance(j).Name)) { - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableSchedule(k).Name = state.dataIPShortCut->cAlphaArgs(5); - state.dataExternalInterface->FMU(i).Instance(j).eplusInputVariableSchedule(k).Name = state.dataIPShortCut->cAlphaArgs(1); - state.dataExternalInterface->FMU(i).Instance(j).eplusInputVariableSchedule(k).InitialValue = - state.dataIPShortCut->rNumericArgs(1); + if (Util::SameString(state.dataIPShortCut->cAlphaArgs(3), fmu.Name) && + Util::SameString(state.dataIPShortCut->cAlphaArgs(4), fmuInst.Name)) { + fmuInst.fmuOutputVariableSchedule(k).Name = state.dataIPShortCut->cAlphaArgs(5); + fmuInst.eplusInputVariableSchedule(k).Name = state.dataIPShortCut->cAlphaArgs(1); + fmuInst.eplusInputVariableSchedule(k).InitialValue = state.dataIPShortCut->rNumericArgs(1); // get the value reference by using the FMU name and the variable name. // preprocess the arguments before the following library call - std::vector NameCharArr( - getCharArrayFromString(state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableSchedule(k).Name)); - int lengthVar(len(state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableSchedule(k).Name)); + std::vector NameCharArr(getCharArrayFromString(fmuInst.fmuOutputVariableSchedule(k).Name)); + int lengthVar(len(fmuInst.fmuOutputVariableSchedule(k).Name)); // make the library call - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableSchedule(k).ValueReference = - getValueReferenceByNameFMUOutputVariables( - &NameCharArr[0], &lengthVar, &state.dataExternalInterface->FMU(i).Instance(j).Index); + fmuInst.fmuOutputVariableSchedule(k).ValueReference = + getValueReferenceByNameFMUOutputVariables(&NameCharArr[0], &lengthVar, &fmuInst.Index); // postprocess the arguments after the library call in case they are changed and used later - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableSchedule(k).Name = getStringFromCharArray(NameCharArr); + fmuInst.fmuOutputVariableSchedule(k).Name = getStringFromCharArray(NameCharArr); - if (state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableSchedule(k).ValueReference == -999) { + if (fmuInst.fmuOutputVariableSchedule(k).ValueReference == -999) { ShowSevereError(state, "ExternalInterface/InitExternalInterfaceFMUImport: Error when trying to get the value reference of " "the FMU output variable"); - ShowContinueError(state, - format("\"{}\" of instance \"{}\"", - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableSchedule(k).Name, - state.dataExternalInterface->FMU(i).Instance(j).Name)); - ShowContinueError(state, - format("of FMU \"{}\" that will be mapped to a schedule.", state.dataExternalInterface->FMU(i).Name)); + ShowContinueError(state, format("\"{}\" of instance \"{}\"", fmuInst.fmuOutputVariableSchedule(k).Name, fmuInst.Name)); + ShowContinueError(state, format("of FMU \"{}\" that will be mapped to a schedule.", fmu.Name)); ShowContinueError(state, "Please check the name of output variables in the input file and"); ShowContinueError(state, "in the modelDescription file."); state.dataExternalInterface->ErrorsFound = true; StopExternalInterfaceIfError(state); } - if (state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableSchedule(k).ValueReference == -1) { + if (fmuInst.fmuOutputVariableSchedule(k).ValueReference == -1) { ShowSevereError(state, "ExternalInterface/InitExternalInterfaceFMUImport: Error when trying to get the value reference of " "the FMU output variable"); - ShowContinueError(state, - format("\"{}\" of instance \"{}\"", - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableSchedule(k).Name, - state.dataExternalInterface->FMU(i).Instance(j).Name)); - ShowContinueError(state, - format("of FMU \"{}\" that will be mapped to a schedule.", state.dataExternalInterface->FMU(i).Name)); + ShowContinueError(state, format("\"{}\" of instance \"{}\"", fmuInst.fmuOutputVariableSchedule(k).Name, fmuInst.Name)); + ShowContinueError(state, format("of FMU \"{}\" that will be mapped to a schedule.", fmu.Name)); ShowContinueError(state, "This variable is not an FMU output variable."); ShowContinueError(state, "Please check the causality of the variable in the modelDescription file."); state.dataExternalInterface->ErrorsFound = true; StopExternalInterfaceIfError(state); } - state.dataExternalInterface->FMU(i).Instance(j).eplusInputVariableSchedule(k).VarIndex = ScheduleManager::GetDayScheduleIndex( - state, state.dataExternalInterface->FMU(i).Instance(j).eplusInputVariableSchedule(k).Name); - state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesSchedule = k; - if (state.dataExternalInterface->FMU(i).Instance(j).eplusInputVariableSchedule(k).VarIndex <= 0) { + fmuInst.eplusInputVariableSchedule(k).VarIndex = Sched::GetScheduleNum(state, fmuInst.eplusInputVariableSchedule(k).Name); + fmuInst.NumOutputVariablesSchedule = k; + if (fmuInst.eplusInputVariableSchedule(k).VarIndex <= 0) { ShowSevereError(state, format("ExternalInterface/InitExternalInterfaceFMUImport:declares variable \"{}\",", - state.dataExternalInterface->FMU(i).Instance(j).eplusInputVariableSchedule(k).Name)); + fmuInst.eplusInputVariableSchedule(k).Name)); ShowContinueError(state, "but variable is not a schedule variable."); state.dataExternalInterface->ErrorsFound = true; StopExternalInterfaceIfError(state); @@ -1542,6 +1441,7 @@ void InitExternalInterfaceFMUImport(EnergyPlusData &state) NumFMUInputVariables = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); for (int i = 1; i <= state.dataExternalInterface->NumFMUObjects; ++i) { + auto &fmu = state.dataExternalInterface->FMU(i); int j = 1; for (int k = 1; k <= NumFMUInputVariables; ++k) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -1556,17 +1456,19 @@ void InitExternalInterfaceFMUImport(EnergyPlusData &state) _, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(2), state.dataExternalInterface->FMU(i).Name)) { - state.dataExternalInterface->FMU(i).TotNumOutputVariablesVariable = j; + if (Util::SameString(state.dataIPShortCut->cAlphaArgs(2), fmu.Name)) { + fmu.TotNumOutputVariablesVariable = j; ++j; } } } for (int i = 1; i <= state.dataExternalInterface->NumFMUObjects; ++i) { - for (int j = 1; j <= state.dataExternalInterface->FMU(i).NumInstances; ++j) { - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableVariable.allocate(NumFMUInputVariables); - state.dataExternalInterface->FMU(i).Instance(j).eplusInputVariableVariable.allocate(NumFMUInputVariables); + auto &fmu = state.dataExternalInterface->FMU(i); + for (int j = 1; j <= fmu.NumInstances; ++j) { + auto &fmuInst = fmu.Instance(j); + fmuInst.fmuOutputVariableVariable.allocate(NumFMUInputVariables); + fmuInst.eplusInputVariableVariable.allocate(NumFMUInputVariables); int k = 1; for (int l = 1; l <= NumFMUInputVariables; ++l) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -1581,46 +1483,36 @@ void InitExternalInterfaceFMUImport(EnergyPlusData &state) _, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(2), state.dataExternalInterface->FMU(i).Name) && - Util::SameString(state.dataIPShortCut->cAlphaArgs(3), state.dataExternalInterface->FMU(i).Instance(j).Name)) { - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableVariable(k).Name = state.dataIPShortCut->cAlphaArgs(4); - state.dataExternalInterface->FMU(i).Instance(j).eplusInputVariableVariable(k).Name = state.dataIPShortCut->cAlphaArgs(1); + if (Util::SameString(state.dataIPShortCut->cAlphaArgs(2), fmu.Name) && + Util::SameString(state.dataIPShortCut->cAlphaArgs(3), fmuInst.Name)) { + fmuInst.fmuOutputVariableVariable(k).Name = state.dataIPShortCut->cAlphaArgs(4); + fmuInst.eplusInputVariableVariable(k).Name = state.dataIPShortCut->cAlphaArgs(1); // get the value reference by using the FMU name and the variable name. - std::vector NameCharArr( - getCharArrayFromString(state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableVariable(k).Name)); - int tempLength(len(state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableVariable(k).Name)); - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableVariable(k).ValueReference = - getValueReferenceByNameFMUOutputVariables( - &NameCharArr[0], &tempLength, &state.dataExternalInterface->FMU(i).Instance(j).Index); + std::vector NameCharArr(getCharArrayFromString(fmuInst.fmuOutputVariableVariable(k).Name)); + int tempLength(len(fmuInst.fmuOutputVariableVariable(k).Name)); + fmuInst.fmuOutputVariableVariable(k).ValueReference = + getValueReferenceByNameFMUOutputVariables(&NameCharArr[0], &tempLength, &fmuInst.Index); // state.dataExternalInterface->FMU( i ).Instance( j ).fmuOutputVariableVariable( k ).Name = getStringFromCharArray( // NameCharArr ); - if (state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableVariable(k).ValueReference == -999) { + if (fmuInst.fmuOutputVariableVariable(k).ValueReference == -999) { ShowSevereError(state, "ExternalInterface/InitExternalInterfaceFMUImport: Error when trying to get the value reference of " "the FMU output variable"); - ShowContinueError(state, - format("\"{}\" of instance \"{}\"", - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableVariable(k).Name, - state.dataExternalInterface->FMU(i).Instance(j).Name)); - ShowContinueError(state, - format("of FMU \"{}\" that will be mapped to a variable.", state.dataExternalInterface->FMU(i).Name)); + ShowContinueError(state, format("\"{}\" of instance \"{}\"", fmuInst.fmuOutputVariableVariable(k).Name, fmuInst.Name)); + ShowContinueError(state, format("of FMU \"{}\" that will be mapped to a variable.", fmu.Name)); ShowContinueError(state, "Please check the name of output variables in the input file and in the modelDescription file."); state.dataExternalInterface->ErrorsFound = true; StopExternalInterfaceIfError(state); } - if (state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableVariable(k).ValueReference == -1) { + if (fmuInst.fmuOutputVariableVariable(k).ValueReference == -1) { ShowSevereError(state, "ExternalInterface/InitExternalInterfaceFMUImport: Error when trying to get the value reference of " "the FMU output variable"); - ShowContinueError(state, - format("\"{}\" of instance \"{}\"", - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableVariable(k).Name, - state.dataExternalInterface->FMU(i).Instance(j).Name)); - ShowContinueError(state, - format("of FMU \"{}\" that will be mapped to a variable.", state.dataExternalInterface->FMU(i).Name)); + ShowContinueError(state, format("\"{}\" of instance \"{}\"", fmuInst.fmuOutputVariableVariable(k).Name, fmuInst.Name)); + ShowContinueError(state, format("of FMU \"{}\" that will be mapped to a variable.", fmu.Name)); ShowContinueError(state, "This variable is not an FMU output variable. Please check the causality of the variable in the " "modelDescription file."); @@ -1628,14 +1520,13 @@ void InitExternalInterfaceFMUImport(EnergyPlusData &state) StopExternalInterfaceIfError(state); } - state.dataExternalInterface->FMU(i).Instance(j).eplusInputVariableVariable(k).VarIndex = - RuntimeLanguageProcessor::FindEMSVariable( - state, state.dataExternalInterface->FMU(i).Instance(j).eplusInputVariableVariable(k).Name, 0); - state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesVariable = k; - if (state.dataExternalInterface->FMU(i).Instance(j).eplusInputVariableVariable(k).VarIndex <= 0) { + fmuInst.eplusInputVariableVariable(k).VarIndex = + RuntimeLanguageProcessor::FindEMSVariable(state, fmuInst.eplusInputVariableVariable(k).Name, 0); + fmuInst.NumOutputVariablesVariable = k; + if (fmuInst.eplusInputVariableVariable(k).VarIndex <= 0) { ShowSevereError(state, format("ExternalInterface/InitExternalInterfaceFMUImport:declares variable \"{}\",", - state.dataExternalInterface->FMU(i).Instance(j).eplusInputVariableVariable(k).Name)); + fmuInst.eplusInputVariableVariable(k).Name)); ShowContinueError(state, "but variable is not an EMS variable."); state.dataExternalInterface->ErrorsFound = true; StopExternalInterfaceIfError(state); @@ -1643,7 +1534,7 @@ void InitExternalInterfaceFMUImport(EnergyPlusData &state) ++k; } } - if (state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesVariable >= 1) { + if (fmuInst.NumOutputVariablesVariable >= 1) { state.dataExternalInterface->useEMS = true; } } @@ -1655,6 +1546,7 @@ void InitExternalInterfaceFMUImport(EnergyPlusData &state) NumFMUInputVariables = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); for (int i = 1; i <= state.dataExternalInterface->NumFMUObjects; ++i) { + auto &fmu = state.dataExternalInterface->FMU(i); int j = 1; for (int k = 1; k <= NumFMUInputVariables; ++k) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -1669,17 +1561,19 @@ void InitExternalInterfaceFMUImport(EnergyPlusData &state) _, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(5), state.dataExternalInterface->FMU(i).Name)) { - state.dataExternalInterface->FMU(i).TotNumOutputVariablesActuator = j; + if (Util::SameString(state.dataIPShortCut->cAlphaArgs(5), fmu.Name)) { + fmu.TotNumOutputVariablesActuator = j; ++j; } } } for (int i = 1; i <= state.dataExternalInterface->NumFMUObjects; ++i) { - for (int j = 1; j <= state.dataExternalInterface->FMU(i).NumInstances; ++j) { - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableActuator.allocate(NumFMUInputVariables); - state.dataExternalInterface->FMU(i).Instance(j).eplusInputVariableActuator.allocate(NumFMUInputVariables); + auto &fmu = state.dataExternalInterface->FMU(i); + for (int j = 1; j <= fmu.NumInstances; ++j) { + auto &fmuInst = fmu.Instance(j); + fmuInst.fmuOutputVariableActuator.allocate(NumFMUInputVariables); + fmuInst.eplusInputVariableActuator.allocate(NumFMUInputVariables); int k = 1; for (int l = 1; l <= NumFMUInputVariables; ++l) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -1694,46 +1588,36 @@ void InitExternalInterfaceFMUImport(EnergyPlusData &state) _, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); - if (Util::SameString(state.dataIPShortCut->cAlphaArgs(5), state.dataExternalInterface->FMU(i).Name) && - Util::SameString(state.dataIPShortCut->cAlphaArgs(6), state.dataExternalInterface->FMU(i).Instance(j).Name)) { - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableActuator(k).Name = state.dataIPShortCut->cAlphaArgs(7); - state.dataExternalInterface->FMU(i).Instance(j).eplusInputVariableActuator(k).Name = state.dataIPShortCut->cAlphaArgs(1); + if (Util::SameString(state.dataIPShortCut->cAlphaArgs(5), fmu.Name) && + Util::SameString(state.dataIPShortCut->cAlphaArgs(6), fmuInst.Name)) { + fmuInst.fmuOutputVariableActuator(k).Name = state.dataIPShortCut->cAlphaArgs(7); + fmuInst.eplusInputVariableActuator(k).Name = state.dataIPShortCut->cAlphaArgs(1); // get the value reference by using the FMU name and the variable name. - std::vector tempNameArr( - getCharArrayFromString(state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableActuator(k).Name)); - int tempLength(len(state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableActuator(k).Name)); - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableActuator(k).ValueReference = - getValueReferenceByNameFMUOutputVariables( - &tempNameArr[0], &tempLength, &state.dataExternalInterface->FMU(i).Instance(j).Index); + std::vector tempNameArr(getCharArrayFromString(fmuInst.fmuOutputVariableActuator(k).Name)); + int tempLength(len(fmuInst.fmuOutputVariableActuator(k).Name)); + fmuInst.fmuOutputVariableActuator(k).ValueReference = + getValueReferenceByNameFMUOutputVariables(&tempNameArr[0], &tempLength, &fmuInst.Index); // state.dataExternalInterface->FMU( i ).Instance( j ).fmuOutputVariableActuator( k ).Name = getStringFromCharArray( // tempNameArr ); - if (state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableActuator(k).ValueReference == -999) { + if (fmuInst.fmuOutputVariableActuator(k).ValueReference == -999) { ShowSevereError(state, "ExternalInterface/InitExternalInterfaceFMUImport: Error when trying to get the value reference of " "the FMU output variable"); - ShowContinueError(state, - format("\"{}\" of instance \"{}\"", - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableActuator(k).Name, - state.dataExternalInterface->FMU(i).Instance(j).Name)); - ShowContinueError(state, - format("of FMU \"{}\" that will be mapped to an actuator.", state.dataExternalInterface->FMU(i).Name)); + ShowContinueError(state, format("\"{}\" of instance \"{}\"", fmuInst.fmuOutputVariableActuator(k).Name, fmuInst.Name)); + ShowContinueError(state, format("of FMU \"{}\" that will be mapped to an actuator.", fmu.Name)); ShowContinueError(state, "Please check the name of output variables in the input file and in the modelDescription file."); state.dataExternalInterface->ErrorsFound = true; StopExternalInterfaceIfError(state); } - if (state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableActuator(k).ValueReference == -1) { + if (fmuInst.fmuOutputVariableActuator(k).ValueReference == -1) { ShowSevereError(state, "ExternalInterface/InitExternalInterfaceFMUImport: Error when trying to get the value reference of " "the FMU output variable"); - ShowContinueError(state, - format("\"{}\" of instance \"{}\"", - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableActuator(k).Name, - state.dataExternalInterface->FMU(i).Instance(j).Name)); - ShowContinueError(state, - format("of FMU \"{}\" that will be mapped to an actuator.", state.dataExternalInterface->FMU(i).Name)); + ShowContinueError(state, format("\"{}\" of instance \"{}\"", fmuInst.fmuOutputVariableActuator(k).Name, fmuInst.Name)); + ShowContinueError(state, format("of FMU \"{}\" that will be mapped to an actuator.", fmu.Name)); ShowContinueError(state, "This variable is not an FMU output variable. Please check the causality of the variable in the " "modelDescription file."); @@ -1741,14 +1625,13 @@ void InitExternalInterfaceFMUImport(EnergyPlusData &state) StopExternalInterfaceIfError(state); } - state.dataExternalInterface->FMU(i).Instance(j).eplusInputVariableActuator(k).VarIndex = - RuntimeLanguageProcessor::FindEMSVariable( - state, state.dataExternalInterface->FMU(i).Instance(j).eplusInputVariableActuator(k).Name, 0); - state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesActuator = k; - if (state.dataExternalInterface->FMU(i).Instance(j).eplusInputVariableActuator(k).VarIndex <= 0) { + fmuInst.eplusInputVariableActuator(k).VarIndex = + RuntimeLanguageProcessor::FindEMSVariable(state, fmuInst.eplusInputVariableActuator(k).Name, 0); + fmuInst.NumOutputVariablesActuator = k; + if (fmuInst.eplusInputVariableActuator(k).VarIndex <= 0) { ShowSevereError(state, format("ExternalInterface/InitExternalInterfaceFMUImport:declares variable \"{}\",", - state.dataExternalInterface->FMU(i).Instance(j).eplusInputVariableActuator(k).Name)); + fmuInst.eplusInputVariableActuator(k).Name)); ShowContinueError(state, "but variable is not an EMS variable."); state.dataExternalInterface->ErrorsFound = true; StopExternalInterfaceIfError(state); @@ -1757,7 +1640,7 @@ void InitExternalInterfaceFMUImport(EnergyPlusData &state) } } // set the flag state.dataExternalInterface->useEMS to true. This will be used then to update the erl variables in erl data structure - if (state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesActuator >= 1) { + if (fmuInst.NumOutputVariablesActuator >= 1) { state.dataExternalInterface->useEMS = true; } } @@ -1765,50 +1648,38 @@ void InitExternalInterfaceFMUImport(EnergyPlusData &state) // parse the fmu defined in the idf using the fmuUnpack with the flag --unpack. for (int i = 1; i <= state.dataExternalInterface->NumFMUObjects; ++i) { - for (int j = 1; j <= state.dataExternalInterface->FMU(i).NumInstances; ++j) { - state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesInIDF = - state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesSchedule + - state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesVariable + - state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesActuator; + auto &fmu = state.dataExternalInterface->FMU(i); + for (int j = 1; j <= fmu.NumInstances; ++j) { + auto &fmuInst = fmu.Instance(j); + fmuInst.NumOutputVariablesInIDF = + fmuInst.NumOutputVariablesSchedule + fmuInst.NumOutputVariablesVariable + fmuInst.NumOutputVariablesActuator; // check whether the number of output variables in fmu is bigger than in the idf - if (state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesInFMU > - state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesInIDF) { + if (fmuInst.NumOutputVariablesInFMU > fmuInst.NumOutputVariablesInIDF) { ShowWarningError(state, format("InitExternalInterfaceFMUImport: The number of output variables defined in input file ({})", - state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesInIDF)); + fmuInst.NumOutputVariablesInIDF)); ShowContinueError(state, - format("of instance \"{}\" of FMU \"{}\" is less than the number of output variables", - state.dataExternalInterface->FMU(i).Instance(j).Name, - state.dataExternalInterface->FMU(i).Name)); - ShowContinueError( - state, format("in the modelDescription file ({}).", state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesInFMU)); + format("of instance \"{}\" of FMU \"{}\" is less than the number of output variables", fmuInst.Name, fmu.Name)); + ShowContinueError(state, format("in the modelDescription file ({}).", fmuInst.NumOutputVariablesInFMU)); ShowContinueError(state, "Check the input file and the modelDescription file again."); } // check whether the number of output variables in fmu is less than in the idf - if (state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesInFMU < - state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesInIDF) { + if (fmuInst.NumOutputVariablesInFMU < fmuInst.NumOutputVariablesInIDF) { ShowWarningError(state, format("InitExternalInterfaceFMUImport: The number of output variables defined in input file ({})", - state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesInIDF)); - ShowContinueError(state, - format("of instance \"{}\" of FMU \"{}\" is bigger than the number of output variables", - state.dataExternalInterface->FMU(i).Instance(j).Name, - state.dataExternalInterface->FMU(i).Name)); + fmuInst.NumOutputVariablesInIDF)); ShowContinueError( - state, format("in the modelDescription file ({}).", state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesInFMU)); + state, format("of instance \"{}\" of FMU \"{}\" is bigger than the number of output variables", fmuInst.Name, fmu.Name)); + ShowContinueError(state, format("in the modelDescription file ({}).", fmuInst.NumOutputVariablesInFMU)); ShowContinueError(state, "Check the input file and the modelDescription file again."); } - DisplayString(state, - format("Number of inputs in instance \"{}\" of FMU \"{}\" = \"{}\".", - state.dataExternalInterface->FMU(i).Instance(j).Name, - state.dataExternalInterface->FMU(i).Name, - state.dataExternalInterface->FMU(i).Instance(j).NumInputVariablesInIDF)); - DisplayString(state, - format("Number of outputs in instance \"{}\" of FMU \"{}\" = \"{}\".", - state.dataExternalInterface->FMU(i).Instance(j).Name, - state.dataExternalInterface->FMU(i).Name, - state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesInIDF)); + DisplayString( + state, + format("Number of inputs in instance \"{}\" of FMU \"{}\" = \"{}\".", fmuInst.Name, fmu.Name, fmuInst.NumInputVariablesInIDF)); + DisplayString( + state, + format("Number of outputs in instance \"{}\" of FMU \"{}\" = \"{}\".", fmuInst.Name, fmu.Name, fmuInst.NumOutputVariablesInIDF)); } } StopExternalInterfaceIfError(state); @@ -1964,20 +1835,22 @@ void CalcExternalInterfaceFMUImport(EnergyPlusData &state) // allocate memory for a temporary FMU that will be used at the end of the warmup state.dataExternalInterface->FMUTemp.allocate(state.dataExternalInterface->NumFMUObjects); for (int i = 1; i <= state.dataExternalInterface->NumFMUObjects; ++i) { - state.dataExternalInterface->FMUTemp(i).Instance.allocate(state.dataExternalInterface->FMU(i).NumInstances); + auto const &fmu = state.dataExternalInterface->FMU(i); + auto &fmuTemp = state.dataExternalInterface->FMUTemp(i); + fmuTemp.Instance.allocate(fmu.NumInstances); } for (int i = 1; i <= state.dataExternalInterface->NumFMUObjects; ++i) { - for (int j = 1; j <= state.dataExternalInterface->FMU(i).NumInstances; ++j) { - state.dataExternalInterface->FMUTemp(i).Instance(j).fmuInputVariable.allocate( - state.dataExternalInterface->FMU(i).Instance(j).NumInputVariablesInIDF); - state.dataExternalInterface->FMUTemp(i).Instance(j).eplusOutputVariable.allocate( - state.dataExternalInterface->FMU(i).Instance(j).NumInputVariablesInIDF); - state.dataExternalInterface->FMUTemp(i).Instance(j).fmuOutputVariableSchedule.allocate( - state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesSchedule); - state.dataExternalInterface->FMUTemp(i).Instance(j).fmuOutputVariableVariable.allocate( - state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesVariable); - state.dataExternalInterface->FMUTemp(i).Instance(j).fmuOutputVariableActuator.allocate( - state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesActuator); + auto const &fmu = state.dataExternalInterface->FMU(i); + auto &fmuTemp = state.dataExternalInterface->FMUTemp(i); + for (int j = 1; j <= fmu.NumInstances; ++j) { + auto const &fmuInst = fmu.Instance(j); + auto &fmuTempInst = fmuTemp.Instance(j); + + fmuTempInst.fmuInputVariable.allocate(fmuInst.NumInputVariablesInIDF); + fmuTempInst.eplusOutputVariable.allocate(fmuInst.NumInputVariablesInIDF); + fmuTempInst.fmuOutputVariableSchedule.allocate(fmuInst.NumOutputVariablesSchedule); + fmuTempInst.fmuOutputVariableVariable.allocate(fmuInst.NumOutputVariablesVariable); + fmuTempInst.fmuOutputVariableActuator.allocate(fmuInst.NumOutputVariablesActuator); } } @@ -1992,43 +1865,36 @@ void CalcExternalInterfaceFMUImport(EnergyPlusData &state) state.dataExternalInterface->tComm += state.dataExternalInterface->hStep; } else { for (int i = 1; i <= state.dataExternalInterface->NumFMUObjects; ++i) { - for (int j = 1; j <= state.dataExternalInterface->FMU(i).NumInstances; ++j) { - - state.dataExternalInterface->FMUTemp(i).Instance(j).NumInputVariablesInIDF = - state.dataExternalInterface->FMU(i).Instance(j).NumInputVariablesInIDF; - for (int k = 1; k <= state.dataExternalInterface->FMU(i).Instance(j).NumInputVariablesInIDF; ++k) { - state.dataExternalInterface->FMUTemp(i).Instance(j).fmuInputVariable(k).ValueReference = - state.dataExternalInterface->FMU(i).Instance(j).fmuInputVariable(k).ValueReference; - state.dataExternalInterface->FMUTemp(i).Instance(j).eplusOutputVariable(k).RTSValue = - state.dataExternalInterface->FMU(i).Instance(j).eplusOutputVariable(k).RTSValue; - state.dataExternalInterface->FMUTemp(i).Instance(j).eplusOutputVariable(k).ITSValue = - state.dataExternalInterface->FMU(i).Instance(j).eplusOutputVariable(k).ITSValue; - state.dataExternalInterface->FMUTemp(i).Instance(j).eplusOutputVariable(k).VarType = - state.dataExternalInterface->FMU(i).Instance(j).eplusOutputVariable(k).VarType; + auto const &fmu = state.dataExternalInterface->FMU(i); + auto &fmuTemp = state.dataExternalInterface->FMUTemp(i); + for (int j = 1; j <= fmu.NumInstances; ++j) { + auto const &fmuInst = fmu.Instance(j); + auto &fmuTempInst = fmuTemp.Instance(j); + + fmuTempInst.NumInputVariablesInIDF = fmuInst.NumInputVariablesInIDF; + for (int k = 1; k <= fmuInst.NumInputVariablesInIDF; ++k) { + fmuTempInst.fmuInputVariable(k).ValueReference = fmuInst.fmuInputVariable(k).ValueReference; + fmuTempInst.eplusOutputVariable(k).RTSValue = fmuInst.eplusOutputVariable(k).RTSValue; + fmuTempInst.eplusOutputVariable(k).ITSValue = fmuInst.eplusOutputVariable(k).ITSValue; + fmuTempInst.eplusOutputVariable(k).VarType = fmuInst.eplusOutputVariable(k).VarType; } // save values that will be set in EnergyPlus (Schedule) - state.dataExternalInterface->FMUTemp(i).Instance(j).NumOutputVariablesSchedule = - state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesSchedule; - for (int k = 1; k <= state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesSchedule; ++k) { - state.dataExternalInterface->FMUTemp(i).Instance(j).fmuOutputVariableSchedule(k).RealVarValue = - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableSchedule(k).RealVarValue; + fmuTempInst.NumOutputVariablesSchedule = fmuInst.NumOutputVariablesSchedule; + for (int k = 1; k <= fmuInst.NumOutputVariablesSchedule; ++k) { + fmuTempInst.fmuOutputVariableSchedule(k).RealVarValue = fmuInst.fmuOutputVariableSchedule(k).RealVarValue; } // save values that will be set in EnergyPlus (Variable) - state.dataExternalInterface->FMUTemp(i).Instance(j).NumOutputVariablesVariable = - state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesVariable; - for (int k = 1; k <= state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesVariable; ++k) { - state.dataExternalInterface->FMUTemp(i).Instance(j).fmuOutputVariableVariable(k).RealVarValue = - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableVariable(k).RealVarValue; + fmuTempInst.NumOutputVariablesVariable = fmuInst.NumOutputVariablesVariable; + for (int k = 1; k <= fmuInst.NumOutputVariablesVariable; ++k) { + fmuTempInst.fmuOutputVariableVariable(k).RealVarValue = fmuInst.fmuOutputVariableVariable(k).RealVarValue; } // save values that will be set in EnergyPlus (Actuator) - state.dataExternalInterface->FMUTemp(i).Instance(j).NumOutputVariablesActuator = - state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesActuator; - for (int k = 1; k <= state.dataExternalInterface->FMU(i).Instance(j).NumOutputVariablesActuator; ++k) { - state.dataExternalInterface->FMUTemp(i).Instance(j).fmuOutputVariableActuator(k).RealVarValue = - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableActuator(k).RealVarValue; + fmuTempInst.NumOutputVariablesActuator = fmuInst.NumOutputVariablesActuator; + for (int k = 1; k <= fmuInst.NumOutputVariablesActuator; ++k) { + fmuTempInst.fmuOutputVariableActuator(k).RealVarValue = fmuInst.fmuOutputVariableActuator(k).RealVarValue; } } } @@ -2046,35 +1912,32 @@ void CalcExternalInterfaceFMUImport(EnergyPlusData &state) // Set the values that have been saved in the FMUs-- saveFMUStateVariables () for (int i = 1; i <= state.dataExternalInterface->NumFMUObjects; ++i) { - for (int j = 1; j <= state.dataExternalInterface->FMU(i).NumInstances; ++j) { + auto &fmu = state.dataExternalInterface->FMU(i); + auto &fmuTemp = state.dataExternalInterface->FMUTemp(i); + for (int j = 1; j <= fmu.NumInstances; ++j) { + auto &fmuInst = fmu.Instance(j); + auto &fmuTempInst = fmuTemp.Instance(j); std::vector valRefVec; - for (unsigned long x = 1; x <= size(state.dataExternalInterface->FMU(i).Instance(j).fmuInputVariable); ++x) { - valRefVec.push_back(state.dataExternalInterface->FMU(i).Instance(j).fmuInputVariable(x).ValueReference); + for (unsigned long x = 1; x <= size(fmuInst.fmuInputVariable); ++x) { + valRefVec.push_back(fmuInst.fmuInputVariable(x).ValueReference); } std::vector rtsValVec; - for (unsigned long x = 1; x <= size(state.dataExternalInterface->FMU(i).Instance(j).eplusOutputVariable); ++x) { - rtsValVec.push_back(state.dataExternalInterface->FMU(i).Instance(j).eplusOutputVariable(x).RTSValue); + for (unsigned long x = 1; x <= size(fmuInst.eplusOutputVariable); ++x) { + rtsValVec.push_back(fmuInst.eplusOutputVariable(x).RTSValue); } // make the library call - state.dataExternalInterface->FMU(i).Instance(j).fmistatus = - fmiEPlusSetReal(&state.dataExternalInterface->FMU(i).Instance(j).fmicomponent, - &valRefVec[0], - &rtsValVec[0], - &state.dataExternalInterface->FMUTemp(i).Instance(j).NumInputVariablesInIDF, - &state.dataExternalInterface->FMU(i).Instance(j).Index); - - if (state.dataExternalInterface->FMU(i).Instance(j).fmistatus != fmiOK) { + fmuInst.fmistatus = + fmiEPlusSetReal(&fmuInst.fmicomponent, &valRefVec[0], &rtsValVec[0], &fmuTempInst.NumInputVariablesInIDF, &fmuInst.Index); + + if (fmuInst.fmistatus != fmiOK) { ShowSevereError( state, format("ExternalInterface/CalcExternalInterfaceFMUImport: Error when trying to set an input value in instance \"{}\"", - state.dataExternalInterface->FMU(i).Instance(j).Name)); - ShowContinueError(state, - format("of FMU \"{}\"; Error Code = \"{}\"", - state.dataExternalInterface->FMU(i).Name, - state.dataExternalInterface->FMU(i).Instance(j).fmistatus)); + fmuInst.Name)); + ShowContinueError(state, format("of FMU \"{}\"; Error Code = \"{}\"", fmu.Name, fmuInst.fmistatus)); state.dataExternalInterface->ErrorsFound = true; StopExternalInterfaceIfError(state); } @@ -2109,34 +1972,31 @@ void CalcExternalInterfaceFMUImport(EnergyPlusData &state) // Set the values that have been saved in the FMUs-- saveFMUStateVariables () for (int i = 1; i <= state.dataExternalInterface->NumFMUObjects; ++i) { - for (int j = 1; j <= state.dataExternalInterface->FMU(i).NumInstances; ++j) { + auto &fmu = state.dataExternalInterface->FMU(i); + auto &fmuTemp = state.dataExternalInterface->FMUTemp(i); + for (int j = 1; j <= fmu.NumInstances; ++j) { + auto &fmuInst = fmu.Instance(j); + auto &fmuTempInst = fmuTemp.Instance(j); // make vectors first std::vector valRefVec; - for (unsigned long x = 1; x <= size(state.dataExternalInterface->FMUTemp(i).Instance(j).fmuInputVariable); ++x) { - valRefVec.push_back(state.dataExternalInterface->FMUTemp(i).Instance(j).fmuInputVariable(x).ValueReference); + for (unsigned long x = 1; x <= size(fmuTempInst.fmuInputVariable); ++x) { + valRefVec.push_back(fmuTempInst.fmuInputVariable(x).ValueReference); } std::vector rtsValVec; - for (unsigned long x = 1; x <= size(state.dataExternalInterface->FMUTemp(i).Instance(j).eplusOutputVariable); ++x) { - rtsValVec.push_back(state.dataExternalInterface->FMUTemp(i).Instance(j).eplusOutputVariable(x).RTSValue); + for (unsigned long x = 1; x <= size(fmuTempInst.eplusOutputVariable); ++x) { + rtsValVec.push_back(fmuTempInst.eplusOutputVariable(x).RTSValue); } // make the library call - state.dataExternalInterface->FMU(i).Instance(j).fmistatus = - fmiEPlusSetReal(&state.dataExternalInterface->FMU(i).Instance(j).fmicomponent, - &valRefVec[0], - &rtsValVec[0], - &state.dataExternalInterface->FMUTemp(i).Instance(j).NumInputVariablesInIDF, - &state.dataExternalInterface->FMU(i).Instance(j).Index); - - if (state.dataExternalInterface->FMU(i).Instance(j).fmistatus != fmiOK) { + fmuInst.fmistatus = + fmiEPlusSetReal(&fmuInst.fmicomponent, &valRefVec[0], &rtsValVec[0], &fmuTempInst.NumInputVariablesInIDF, &fmuInst.Index); + + if (fmuInst.fmistatus != fmiOK) { ShowSevereError(state, "ExternalInterface/CalcExternalInterfaceFMUImport: "); ShowContinueError(state, "Error when trying to set inputs in instance"); - ShowContinueError(state, - format("\"{}\" of FMU \"{}\"", - state.dataExternalInterface->FMU(i).Instance(j).Name, - state.dataExternalInterface->FMU(i).Name)); - ShowContinueError(state, format("Error Code = \"{}\"", state.dataExternalInterface->FMU(i).Instance(j).fmistatus)); + ShowContinueError(state, format("\"{}\" of FMU \"{}\"", fmuInst.Name, fmu.Name)); + ShowContinueError(state, format("Error Code = \"{}\"", fmuInst.fmistatus)); state.dataExternalInterface->ErrorsFound = true; StopExternalInterfaceIfError(state); } @@ -2158,37 +2018,44 @@ void CalcExternalInterfaceFMUImport(EnergyPlusData &state) state.dataExternalInterface->fmiEndSimulation = 1; TerminateResetFreeFMUImport(state, state.dataExternalInterface->fmiEndSimulation); for (int i = 1; i <= state.dataExternalInterface->NumFMUObjects; ++i) { - for (int j = 1; j <= state.dataExternalInterface->FMU(i).NumInstances; ++j) { + auto &fmu = state.dataExternalInterface->FMU(i); + auto &fmuTemp = state.dataExternalInterface->FMUTemp(i); + for (int j = 1; j <= fmu.NumInstances; ++j) { + auto &fmuTempInst = fmuTemp.Instance(j); // Deallocate used objects - state.dataExternalInterface->FMUTemp(i).Instance(j).fmuInputVariable.deallocate(); - state.dataExternalInterface->FMUTemp(i).Instance(j).eplusOutputVariable.deallocate(); - state.dataExternalInterface->FMUTemp(i).Instance(j).fmuOutputVariableSchedule.deallocate(); - state.dataExternalInterface->FMUTemp(i).Instance(j).fmuOutputVariableVariable.deallocate(); - state.dataExternalInterface->FMUTemp(i).Instance(j).fmuOutputVariableActuator.deallocate(); + fmuTempInst.fmuInputVariable.deallocate(); + fmuTempInst.eplusOutputVariable.deallocate(); + fmuTempInst.fmuOutputVariableSchedule.deallocate(); + fmuTempInst.fmuOutputVariableVariable.deallocate(); + fmuTempInst.fmuOutputVariableActuator.deallocate(); } } for (int i = 1; i <= state.dataExternalInterface->NumFMUObjects; ++i) { - state.dataExternalInterface->FMUTemp(i).Instance.deallocate(); + auto &fmuTemp = state.dataExternalInterface->FMUTemp(i); + fmuTemp.Instance.deallocate(); } state.dataExternalInterface->FMUTemp.deallocate(); for (int i = 1; i <= state.dataExternalInterface->NumFMUObjects; ++i) { - for (int j = 1; j <= state.dataExternalInterface->FMU(i).NumInstances; ++j) { - state.dataExternalInterface->FMU(i).Instance(j).eplusInputVariableSchedule.deallocate(); - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableSchedule.deallocate(); - state.dataExternalInterface->FMU(i).Instance(j).eplusInputVariableVariable.deallocate(); - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableVariable.deallocate(); - state.dataExternalInterface->FMU(i).Instance(j).eplusInputVariableActuator.deallocate(); - state.dataExternalInterface->FMU(i).Instance(j).fmuOutputVariableActuator.deallocate(); - state.dataExternalInterface->FMU(i).Instance(j).fmuInputVariable.deallocate(); - state.dataExternalInterface->FMU(i).Instance(j).checkfmuInputVariable.deallocate(); + auto &fmu = state.dataExternalInterface->FMU(i); + for (int j = 1; j <= fmu.NumInstances; ++j) { + auto &fmuInst = fmu.Instance(j); + fmuInst.eplusInputVariableSchedule.deallocate(); + fmuInst.fmuOutputVariableSchedule.deallocate(); + fmuInst.eplusInputVariableVariable.deallocate(); + fmuInst.fmuOutputVariableVariable.deallocate(); + fmuInst.eplusInputVariableActuator.deallocate(); + fmuInst.fmuOutputVariableActuator.deallocate(); + fmuInst.fmuInputVariable.deallocate(); + fmuInst.checkfmuInputVariable.deallocate(); } } for (int i = 1; i <= state.dataExternalInterface->NumFMUObjects; ++i) { - state.dataExternalInterface->FMU(i).Instance.deallocate(); + auto &fmu = state.dataExternalInterface->FMU(i); + fmu.Instance.deallocate(); } state.dataExternalInterface->FMU.deallocate(); } @@ -2260,7 +2127,7 @@ void CalcExternalInterface(EnergyPlusData &state) state.dataExternalInterface->simulationStatus = 2; preSimTim = 0; // In the first call, E+ did not reset SimTimeSteps to zero } else { - preSimTim = state.dataGlobal->SimTimeSteps * state.dataGlobal->MinutesPerTimeStep * 60.0; + preSimTim = state.dataGlobal->SimTimeSteps * state.dataGlobal->MinutesInTimeStep * 60.0; } // Socket asked to terminate simulation, but simulation continues @@ -2360,7 +2227,7 @@ void CalcExternalInterface(EnergyPlusData &state) if ((flaRea == 0) && continueSimulation) { for (int i = 1; i <= isize(state.dataExternalInterface->varInd); ++i) { if (state.dataExternalInterface->inpVarTypes(i) == indexSchedule) { - ScheduleManager::ExternalInterfaceSetSchedule(state, state.dataExternalInterface->varInd(i), dblValRea(i)); + Sched::ExternalInterfaceSetSchedule(state, state.dataExternalInterface->varInd(i), dblValRea(i)); } else if ((state.dataExternalInterface->inpVarTypes(i) == indexVariable) || (state.dataExternalInterface->inpVarTypes(i) == indexActuator)) { RuntimeLanguageProcessor::ExternalInterfaceSetErlVariable(state, state.dataExternalInterface->varInd(i), dblValRea(i)); diff --git a/src/EnergyPlus/ExternalInterface.hh b/src/EnergyPlus/ExternalInterface.hh index ac0fec96911..1f82d222fe9 100644 --- a/src/EnergyPlus/ExternalInterface.hh +++ b/src/EnergyPlus/ExternalInterface.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -392,6 +392,10 @@ struct ExternalInterfaceData : BaseGlobalStruct int nOutVal; // Number of output values (E+ -> ExternalInterface) int nInpVar; // Number of input values (ExternalInterface -> E+) + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/FanCoilUnits.cc b/src/EnergyPlus/FanCoilUnits.cc index 7c27178d74f..51780208eb2 100644 --- a/src/EnergyPlus/FanCoilUnits.cc +++ b/src/EnergyPlus/FanCoilUnits.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -272,16 +272,12 @@ namespace FanCoilUnits { fanCoil.Name = Alphas(1); fanCoil.UnitType = CurrentModuleObject; fanCoil.UnitType_Num = FanCoilUnit_4Pipe; - fanCoil.Sched = Alphas(2); + if (lAlphaBlanks(2)) { - fanCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - fanCoil.SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (fanCoil.SchedPtr == 0) { - ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("invalid-not found: {}=\"{}\".", cAlphaFields(2), Alphas(2))); - ErrorsFound = true; - } + fanCoil.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((fanCoil.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } constexpr std::array(CCM::Num)> CapCtrlMethUC{"CONSTANTFANVARIABLEFLOW", "CYCLINGFAN", @@ -297,11 +293,8 @@ namespace FanCoilUnits { fanCoil.fanOp = HVAC::FanOp::Continuous; } - fanCoil.SchedOutAir = Alphas(4); - fanCoil.SchedOutAirPtr = ScheduleManager::GetScheduleIndex(state, Alphas(4)); // convert schedule name to pointer - if (fanCoil.SchedOutAirPtr == 0 && (!lAlphaBlanks(4))) { - ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, fanCoil.Name)); - ShowContinueError(state, format("illegal value: {}=\"{}\".", cAlphaFields(4), Alphas(4))); + if (!lAlphaBlanks(4) && ((fanCoil.oaSched = Sched::GetSchedule(state, Alphas(4))) == nullptr)) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(4), Alphas(4)); ErrorsFound = true; } fanCoil.MaxAirVolFlow = Numbers(1); @@ -520,16 +513,16 @@ namespace FanCoilUnits { auto *fan = state.dataFans->fans(fanCoil.FanIndex); if (fanCoil.fanType != fan->type) { - ShowSevereCustomMessage(state, - eoh, - format("{} was specified as having type {}, but has type {}", - fanCoil.FanName, - HVAC::fanTypeNamesUC[(int)fanCoil.fanType], - HVAC::fanTypeNamesUC[(int)fan->type])); + ShowSevereCustom(state, + eoh, + format("{} was specified as having type {}, but has type {}", + fanCoil.FanName, + HVAC::fanTypeNamesUC[(int)fanCoil.fanType], + HVAC::fanTypeNamesUC[(int)fan->type])); ErrorsFound = true; } - fanCoil.fanAvailSchIndex = fan->availSchedNum; + fanCoil.fanAvailSched = fan->availSched; fanCoil.FanAirVolFlow = fan->maxAirFlowRate; if (fanCoil.MaxAirVolFlow > fanCoil.FanAirVolFlow && fanCoil.FanAirVolFlow != DataSizing::AutoSize) { @@ -749,24 +742,19 @@ namespace FanCoilUnits { } if (fanCoil.CapCtrlMeth_Num == CCM::MultiSpeedFan) { if (!lAlphaBlanks(17)) { - fanCoil.FanOpModeSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(17)); + fanCoil.fanOpModeSched = Sched::GetSchedule(state, Alphas(17)); if (fanCoil.fanType != HVAC::FanType::OnOff && fanCoil.fanType != HVAC::FanType::SystemModel) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, fanCoil.Name)); ShowContinueError(state, format("For {} = {}", cAlphaFields(17), Alphas(17))); ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(9), Alphas(9))); ShowContinueError(state, "...fan operating schedule is allowed for on off or system model fan type only )"); ErrorsFound = true; - } else { - if (fanCoil.FanOpModeSchedPtr == 0) { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, fanCoil.Name)); - ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(17), Alphas(17))); - ErrorsFound = true; - } - } - } else { - if (fanCoil.fanType == HVAC::FanType::OnOff || fanCoil.fanType == HVAC::FanType::SystemModel) { - fanCoil.fanOp = HVAC::FanOp::Cycling; + } else if (fanCoil.fanOpModeSched == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(17), Alphas(17)); + ErrorsFound = true; } + } else if (fanCoil.fanType == HVAC::FanType::OnOff || fanCoil.fanType == HVAC::FanType::SystemModel) { + fanCoil.fanOp = HVAC::FanOp::Cycling; } } @@ -1083,20 +1071,13 @@ namespace FanCoilUnits { fanCoil.OutAirMassFlow = RhoAir * fanCoil.OutAirVolFlow; if (fanCoil.HCoilType_Num == HCoil::Water) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(fanCoil.HeatCoilPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(fanCoil.HeatCoilPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = + state.dataPlnt->PlantLoop(fanCoil.HeatCoilPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); fanCoil.MaxHeatCoilFluidFlow = rho * fanCoil.MaxHotWaterVolFlow; fanCoil.MinHotWaterFlow = rho * fanCoil.MinHotWaterVolFlow; } - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(fanCoil.CoolCoilPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(fanCoil.CoolCoilPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(fanCoil.CoolCoilPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); fanCoil.MaxCoolCoilFluidFlow = rho * fanCoil.MaxColdWaterVolFlow; fanCoil.MinColdWaterFlow = rho * fanCoil.MinColdWaterVolFlow; @@ -1126,17 +1107,11 @@ namespace FanCoilUnits { // These initializations are done every iteration fanCoil.SpeedRatio = 0.0; - if (fanCoil.FanOpModeSchedPtr > 0) { - if (ScheduleManager::GetCurrentScheduleValue(state, fanCoil.FanOpModeSchedPtr) == 0.0) { - fanCoil.fanOp = HVAC::FanOp::Cycling; - } else { - fanCoil.fanOp = HVAC::FanOp::Continuous; - } + if (fanCoil.fanOpModeSched != nullptr) { + fanCoil.fanOp = (fanCoil.fanOpModeSched->getCurrentVal() == 0.0) ? HVAC::FanOp::Cycling : HVAC::FanOp::Continuous; } // Set the inlet node mass flow rate - if (((ScheduleManager::GetCurrentScheduleValue(state, fanCoil.SchedPtr) > 0.0 && - ScheduleManager::GetCurrentScheduleValue(state, fanCoil.fanAvailSchIndex) > 0.0) || - state.dataHVACGlobal->TurnFansOn) && + if (((fanCoil.availSched->getCurrentVal() > 0.0 && fanCoil.fanAvailSched->getCurrentVal() > 0.0) || state.dataHVACGlobal->TurnFansOn) && !state.dataHVACGlobal->TurnFansOff) { state.dataLoopNodes->Node(fanCoil.AirInNode).MassFlowRate = fanCoil.MaxAirMassFlow; state.dataLoopNodes->Node(fanCoil.AirInNode).MassFlowRateMaxAvail = state.dataLoopNodes->Node(fanCoil.AirInNode).MassFlowRate; @@ -1630,16 +1605,10 @@ namespace FanCoilUnits { } fanCoil.DesHeatingLoad = DesCoilLoad; if (DesCoilLoad >= HVAC::SmallLoad) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(fanCoil.HeatCoilPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(fanCoil.HeatCoilPlantLoc.loopNum).FluidIndex, - RoutineNameNoSpace); - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(fanCoil.HeatCoilPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(fanCoil.HeatCoilPlantLoc.loopNum).FluidIndex, - RoutineNameNoSpace); + rho = state.dataPlnt->PlantLoop(fanCoil.HeatCoilPlantLoc.loopNum) + .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineNameNoSpace); + Cp = state.dataPlnt->PlantLoop(fanCoil.HeatCoilPlantLoc.loopNum) + .glycol->getSpecificHeat(state, Constant::HWInitConvTemp, RoutineNameNoSpace); MaxHotWaterVolFlowDes = DesCoilLoad / (WaterCoilSizDeltaT * Cp * rho); } else { @@ -1815,16 +1784,8 @@ namespace FanCoilUnits { } fanCoil.DesCoolingLoad = DesCoilLoad; if (DesCoilLoad >= HVAC::SmallLoad) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(fanCoil.CoolCoilPlantLoc.loopNum).FluidName, - 5., - state.dataPlnt->PlantLoop(fanCoil.CoolCoilPlantLoc.loopNum).FluidIndex, - RoutineNameNoSpace); - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(fanCoil.CoolCoilPlantLoc.loopNum).FluidName, - 5., - state.dataPlnt->PlantLoop(fanCoil.CoolCoilPlantLoc.loopNum).FluidIndex, - RoutineNameNoSpace); + rho = state.dataPlnt->PlantLoop(fanCoil.CoolCoilPlantLoc.loopNum).glycol->getDensity(state, 5., RoutineNameNoSpace); + Cp = state.dataPlnt->PlantLoop(fanCoil.CoolCoilPlantLoc.loopNum).glycol->getSpecificHeat(state, 5., RoutineNameNoSpace); MaxColdWaterVolFlowDes = DesCoilLoad / (WaterCoilSizDeltaT * Cp * rho); } else { MaxColdWaterVolFlowDes = 0.0; @@ -2085,7 +2046,7 @@ namespace FanCoilUnits { // if cooling if (UnitOn && QCoilCoolSP < -HVAC::SmallLoad && - state.dataHeatBalFanSys->TempControlType(ControlledZoneNum) != HVAC::ThermostatType::SingleHeating) { + state.dataHeatBalFanSys->TempControlType(ControlledZoneNum) != HVAC::SetptType::SingleHeat) { int ControlNode = fanCoil.CoolCoilFluidInletNode; ControlOffset = fanCoil.ColdControlOffset; MaxWaterFlow = fanCoil.MaxCoolCoilFluidFlow; @@ -2217,7 +2178,7 @@ namespace FanCoilUnits { // if heating } else if (UnitOn && QCoilHeatSP > HVAC::SmallLoad && - state.dataHeatBalFanSys->TempControlType(ControlledZoneNum) != HVAC::ThermostatType::SingleCooling) { + state.dataHeatBalFanSys->TempControlType(ControlledZoneNum) != HVAC::SetptType::SingleCool) { // get full load result if (fanCoil.HCoilType_Num == HCoil::Water) { // if HW Coil int ControlNode = fanCoil.HeatCoilFluidInletNode; @@ -2456,7 +2417,7 @@ namespace FanCoilUnits { // meet the coil load adjusted for fan operation if (UnitOn && QCoilCoolSP < (-1.0 * HVAC::SmallLoad) && - state.dataHeatBalFanSys->TempControlType(ControlledZoneNum) != HVAC::ThermostatType::SingleHeating) { + state.dataHeatBalFanSys->TempControlType(ControlledZoneNum) != HVAC::SetptType::SingleHeat) { // cooling coil action, maximum cold water flow mdot = fanCoil.MaxCoolCoilFluidFlow; PlantUtilities::SetComponentFlowRate( @@ -2550,7 +2511,7 @@ namespace FanCoilUnits { Calc4PipeFanCoil(state, FanCoilNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, PLR); } else if (UnitOn && QCoilHeatSP > HVAC::SmallLoad && - state.dataHeatBalFanSys->TempControlType(ControlledZoneNum) != HVAC::ThermostatType::SingleCooling) { + state.dataHeatBalFanSys->TempControlType(ControlledZoneNum) != HVAC::SetptType::SingleCool) { // heating coil action, maximun hot water flow if (fanCoil.HCoilType_Num == HCoil::Water) { @@ -2736,18 +2697,18 @@ namespace FanCoilUnits { QCoilHeatSP = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlledZoneNum).RemainingOutputReqToHeatSP; if (QCoilHeatSP > 0.0 && QCoilCoolSP > 0.0 && - state.dataHeatBalFanSys->TempControlType(ControlledZoneNum) != HVAC::ThermostatType::SingleCooling) { + state.dataHeatBalFanSys->TempControlType(ControlledZoneNum) != HVAC::SetptType::SingleCool) { QZnReq = QCoilHeatSP; state.dataFanCoilUnits->HeatingLoad = true; } else if (QCoilHeatSP > 0.0 && QCoilCoolSP > 0.0 && - state.dataHeatBalFanSys->TempControlType(ControlledZoneNum) == HVAC::ThermostatType::SingleCooling) { + state.dataHeatBalFanSys->TempControlType(ControlledZoneNum) == HVAC::SetptType::SingleCool) { QZnReq = 0.0; } else if (QCoilHeatSP < 0.0 && QCoilCoolSP < 0.0 && - state.dataHeatBalFanSys->TempControlType(ControlledZoneNum) != HVAC::ThermostatType::SingleHeating) { + state.dataHeatBalFanSys->TempControlType(ControlledZoneNum) != HVAC::SetptType::SingleHeat) { QZnReq = QCoilCoolSP; state.dataFanCoilUnits->CoolingLoad = true; } else if (QCoilHeatSP < 0.0 && QCoilCoolSP < 0.0 && - state.dataHeatBalFanSys->TempControlType(ControlledZoneNum) == HVAC::ThermostatType::SingleHeating) { + state.dataHeatBalFanSys->TempControlType(ControlledZoneNum) == HVAC::SetptType::SingleHeat) { QZnReq = 0.0; } else if (QCoilHeatSP <= 0.0 && QCoilCoolSP >= 0.0) { QZnReq = 0.0; @@ -2854,7 +2815,7 @@ namespace FanCoilUnits { int Iter = 0; if (UnitOn && state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlledZoneNum).RemainingOutputReqToCoolSP < (-1.0 * HVAC::SmallLoad) && - state.dataHeatBalFanSys->TempControlType(ControlledZoneNum) != HVAC::ThermostatType::SingleHeating) { + state.dataHeatBalFanSys->TempControlType(ControlledZoneNum) != HVAC::SetptType::SingleHeat) { // cooling coil action, maximum cold water flow mdot = fanCoil.MaxCoolCoilFluidFlow; PlantUtilities::SetComponentFlowRate( @@ -2900,7 +2861,7 @@ namespace FanCoilUnits { Calc4PipeFanCoil(state, FanCoilNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, PLR); } else if (UnitOn && state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlledZoneNum).RemainingOutputReqToHeatSP > HVAC::SmallLoad && - state.dataHeatBalFanSys->TempControlType(ControlledZoneNum) != HVAC::ThermostatType::SingleCooling) { + state.dataHeatBalFanSys->TempControlType(ControlledZoneNum) != HVAC::SetptType::SingleCool) { // heating coil action, maximun hot water flow if (fanCoil.HCoilType_Num == HCoil::Water) { mdot = fanCoil.MaxHeatCoilFluidFlow; @@ -3221,9 +3182,7 @@ namespace FanCoilUnits { // Assume the unit is able to vary the flow. A cycling unit is treated as // if it were variable flow, with the flow being the averaqe flow over the time step - if (((ScheduleManager::GetCurrentScheduleValue(state, fanCoil.SchedPtr) > 0.0 && - ScheduleManager::GetCurrentScheduleValue(state, fanCoil.fanAvailSchIndex) > 0.0) || - state.dataHVACGlobal->TurnFansOn) && + if (((fanCoil.availSched->getCurrentVal() > 0.0 && fanCoil.fanAvailSched->getCurrentVal() > 0.0) || state.dataHVACGlobal->TurnFansOn) && !state.dataHVACGlobal->TurnFansOff) { if (fanCoil.CapCtrlMeth_Num != CCM::ConsFanVarFlow) { if (fanCoil.CapCtrlMeth_Num != CCM::ASHRAE) @@ -3234,11 +3193,7 @@ namespace FanCoilUnits { } // use the value of the outside air schedule if present - if (fanCoil.SchedOutAirPtr > 0) { - OASchedValue = ScheduleManager::GetCurrentScheduleValue(state, fanCoil.SchedOutAirPtr); - } else { - OASchedValue = 1.0; - } + OASchedValue = (fanCoil.oaSched != nullptr) ? fanCoil.oaSched->getCurrentVal() : 1.0; if (fanCoil.ATMixerExists) { state.dataFanCoilUnits->ATMixOutNode = fanCoil.ATMixerOutNode; @@ -3471,18 +3426,15 @@ namespace FanCoilUnits { state.dataFanCoilUnits->HeatingLoad = false; state.dataFanCoilUnits->CoolingLoad = false; - if (QCoilHeatSP > 0.0 && QCoilCoolSP > 0.0 && state.dataHeatBalFanSys->TempControlType(ZoneNum) != HVAC::ThermostatType::SingleCooling) { + if (QCoilHeatSP > 0.0 && QCoilCoolSP > 0.0 && state.dataHeatBalFanSys->TempControlType(ZoneNum) != HVAC::SetptType::SingleCool) { QZnReq = QCoilHeatSP; HeatingLoad = true; - } else if (QCoilHeatSP > 0.0 && QCoilCoolSP > 0.0 && - state.dataHeatBalFanSys->TempControlType(ZoneNum) == HVAC::ThermostatType::SingleCooling) { + } else if (QCoilHeatSP > 0.0 && QCoilCoolSP > 0.0 && state.dataHeatBalFanSys->TempControlType(ZoneNum) == HVAC::SetptType::SingleCool) { QZnReq = 0.0; - } else if (QCoilHeatSP < 0.0 && QCoilCoolSP < 0.0 && - state.dataHeatBalFanSys->TempControlType(ZoneNum) != HVAC::ThermostatType::SingleHeating) { + } else if (QCoilHeatSP < 0.0 && QCoilCoolSP < 0.0 && state.dataHeatBalFanSys->TempControlType(ZoneNum) != HVAC::SetptType::SingleHeat) { QZnReq = QCoilCoolSP; CoolingLoad = true; - } else if (QCoilHeatSP < 0.0 && QCoilCoolSP < 0.0 && - state.dataHeatBalFanSys->TempControlType(ZoneNum) == HVAC::ThermostatType::SingleHeating) { + } else if (QCoilHeatSP < 0.0 && QCoilCoolSP < 0.0 && state.dataHeatBalFanSys->TempControlType(ZoneNum) == HVAC::SetptType::SingleHeat) { QZnReq = 0.0; } else if (QCoilHeatSP <= 0.0 && QCoilCoolSP >= 0.0) { QZnReq = 0.0; @@ -3491,7 +3443,7 @@ namespace FanCoilUnits { // Zone load calculation for constant fan systems, adopted from unitary system if (fanCoil.fanOp == HVAC::FanOp::Continuous) { switch (state.dataHeatBalFanSys->TempControlType(ZoneNum)) { - case HVAC::ThermostatType::SingleHeating: { + case HVAC::SetptType::SingleHeat: { CoolingLoad = false; // No heating load and constant fan pushes zone below heating set point if (QUnitOutNoHC < 0.0 && QCoilHeatSP < 0.0 && QUnitOutNoHC - QCoilHeatSP < -HVAC::SmallLoad) { @@ -3500,7 +3452,7 @@ namespace FanCoilUnits { QZnReq = QCoilHeatSP; } } break; - case HVAC::ThermostatType::SingleCooling: { + case HVAC::SetptType::SingleCool: { HeatingLoad = false; // No heating load and constant fan pushes zone above cooling set point if (QUnitOutNoHC > 0.0 && QCoilCoolSP > 0.0 && QUnitOutNoHC - QCoilCoolSP > HVAC::SmallLoad) { @@ -3509,7 +3461,7 @@ namespace FanCoilUnits { QZnReq = QCoilCoolSP; } } break; - case HVAC::ThermostatType::SingleHeatCool: { + case HVAC::SetptType::SingleHeatCool: { // zone temp above cooling and heating set point temps if (QCoilHeatSP < 0.0 && QCoilCoolSP < 0.0) { // zone pushed below heating set point @@ -3528,7 +3480,7 @@ namespace FanCoilUnits { } } } break; - case HVAC::ThermostatType::DualSetPointWithDeadBand: { + case HVAC::SetptType::DualHeatCool: { // zone temp above cooling and heating set point temps if (QCoilHeatSP < 0.0 && QCoilCoolSP < 0.0) { // zone pushed into deadband diff --git a/src/EnergyPlus/FanCoilUnits.hh b/src/EnergyPlus/FanCoilUnits.hh index 68983667875..ae0cde9e776 100644 --- a/src/EnergyPlus/FanCoilUnits.hh +++ b/src/EnergyPlus/FanCoilUnits.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -110,11 +110,11 @@ namespace FanCoilUnits { // Members // Input data int UnitType_Num = 0; - std::string Sched; // availability schedule - int SchedPtr = 0; // index to schedule + std::string availSchedName; // availability schedule + Sched::Schedule *availSched = nullptr; // availability schedule std::string SchedOutAir; // outside air schedule, multipliy maximum outdoor air flow rate - int SchedOutAirPtr = 0; // index to outside air schedule - HVAC::FanType fanType = HVAC::FanType::Invalid; // index to fan type + Sched::Schedule *oaSched = nullptr; // outside air schedule + HVAC::FanType fanType = HVAC::FanType::Invalid; // fan type int SpeedFanSel = 0; // Speed fan selected CCM CapCtrlMeth_Num = CCM::Invalid; Real64 PLR = 0.0; // Part Load Ratio, fraction of time step fancoil is on @@ -176,7 +176,7 @@ namespace FanCoilUnits { int ATMixerSecNode = 0; // secondary air inlet node number for the air terminal mixer int HVACSizingIndex = 0; // index of a HVACSizing object for a fancoil unit Real64 SpeedRatio = 0.0; // speed ratio when the fan is cycling between stages - int FanOpModeSchedPtr = 0; // pointer to supply air fan operating mode schedule + Sched::Schedule *fanOpModeSched = nullptr; // supply air fan operating mode schedule HVAC::FanOp fanOp = HVAC::FanOp::Cycling; // 1=cycling fan cycling coil; 2=constant fan cycling coil bool ASHRAETempControl = false; // ASHRAE90.1 control to temperature set point when true Real64 QUnitOutNoHC = 0.0; // unit output with coils off [W] @@ -187,21 +187,21 @@ namespace FanCoilUnits { int ConvgErrCountH = 0; // count of SolveRoot iteration limit errors int ConvgErrCountC = 0; // count of SolveRoot iteration limit errors // Report data - Real64 HeatPower = 0.0; // unit heating output in watts - Real64 HeatEnergy = 0.0; // unit heating output in J - Real64 TotCoolPower = 0.0; // unit total cooling power output in watts - Real64 TotCoolEnergy = 0.0; // unit total cooling energy output in joules - Real64 SensCoolPower = 0.0; // unit sensible cooling power output in watts - Real64 SensCoolEnergy = 0.0; // unit sensible cooling energy output in joules - Real64 ElecPower = 0.0; // unit electric power consumption in watts - Real64 ElecEnergy = 0.0; // unit electiric energy consumption in joules - Real64 DesCoolingLoad = 0.0; // used for reporting in watts - Real64 DesHeatingLoad = 0.0; // used for reporting in watts - Real64 DesZoneCoolingLoad = 0.0; // used for reporting in watts - Real64 DesZoneHeatingLoad = 0.0; // used for reporting in watts - int DSOAPtr = 0; // design specification outdoor air object index - bool FirstPass = true; // detects first time through for resetting sizing data - int fanAvailSchIndex = 0; // fan availability schedule index + Real64 HeatPower = 0.0; // unit heating output in watts + Real64 HeatEnergy = 0.0; // unit heating output in J + Real64 TotCoolPower = 0.0; // unit total cooling power output in watts + Real64 TotCoolEnergy = 0.0; // unit total cooling energy output in joules + Real64 SensCoolPower = 0.0; // unit sensible cooling power output in watts + Real64 SensCoolEnergy = 0.0; // unit sensible cooling energy output in joules + Real64 ElecPower = 0.0; // unit electric power consumption in watts + Real64 ElecEnergy = 0.0; // unit electiric energy consumption in joules + Real64 DesCoolingLoad = 0.0; // used for reporting in watts + Real64 DesHeatingLoad = 0.0; // used for reporting in watts + Real64 DesZoneCoolingLoad = 0.0; // used for reporting in watts + Real64 DesZoneHeatingLoad = 0.0; // used for reporting in watts + int DSOAPtr = 0; // design specification outdoor air object index + bool FirstPass = true; // detects first time through for resetting sizing data + Sched::Schedule *fanAvailSched = nullptr; // fan availability schedule index // SZVAV Model inputs std::string Name; // name of unit @@ -419,6 +419,10 @@ struct FanCoilUnitsData : BaseGlobalStruct int ATMixOutNode = 0; // outlet node of ATM Mixer int ZoneNode = 0; // zone node + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/Fans.cc b/src/EnergyPlus/Fans.cc index 6c0c23e29da..5f904c1104a 100644 --- a/src/EnergyPlus/Fans.cc +++ b/src/EnergyPlus/Fans.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -304,8 +304,8 @@ void GetFanInput(EnergyPlusData &state) fan->sizingPrefix = cNumericFieldNames(3); if (lAlphaFieldBlanks(2)) { - fan->availSchedNum = ScheduleManager::ScheduleAlwaysOn; - } else if ((fan->availSchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(2))) == 0) { + fan->availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((fan->availSched = Sched::GetSchedule(state, cAlphaArgs(2))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2)); ErrorsFound = true; } @@ -383,8 +383,8 @@ void GetFanInput(EnergyPlusData &state) fan->sizingPrefix = cNumericFieldNames(3); if (lAlphaFieldBlanks(2)) { - fan->availSchedNum = ScheduleManager::ScheduleAlwaysOn; - } else if ((fan->availSchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(2))) == 0) { + fan->availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((fan->availSched = Sched::GetSchedule(state, cAlphaArgs(2))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2)); ErrorsFound = true; } @@ -473,16 +473,15 @@ void GetFanInput(EnergyPlusData &state) fan->sizingPrefix = cNumericFieldNames(3); if (lAlphaFieldBlanks(2)) { - fan->availSchedNum = ScheduleManager::ScheduleAlwaysOn; - } else if ((fan->availSchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(2))) == 0) { + fan->availSched = Sched::GetScheduleAlwaysOn(state); // Not an availability schedule, but defaults to constant-1.0 + } else if ((fan->availSched = Sched::GetSchedule(state, cAlphaArgs(2))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2)); ErrorsFound = true; - } else if (ScheduleManager::HasFractionalScheduleValue(state, fan->availSchedNum)) { - ShowWarningError(state, - format("{}=\"{}\" has fractional values in Schedule={}. Only 0.0 in the schedule value turns the fan off.", - cCurrentModuleObject, - fan->Name, - cAlphaArgs(2))); + } else if (fan->availSched->hasFractionalVal(state)) { + ShowWarningCustom( + state, + eoh, + format("{}={} has fracdtional values. Only 0.0 in the schedule value turns the fan off.", cAlphaFieldNames(2), cAlphaArgs(2))); } fan->totalEff = rNumericArgs(1); @@ -523,17 +522,12 @@ void GetFanInput(EnergyPlusData &state) fan->endUseSubcategoryName = (NumAlphas > 4 && !lAlphaFieldBlanks(5)) ? cAlphaArgs(5) : "General"; if (NumAlphas <= 5 || lAlphaFieldBlanks(6)) { - fan->flowFracSchedNum = ScheduleManager::ScheduleAlwaysOn; - } else if ((fan->flowFracSchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(6))) == 0) { + fan->flowFracSched = Sched::GetScheduleAlwaysOn(state); // Not an availability schedule, but defaults to constant-1.0 + } else if ((fan->flowFracSched = Sched::GetSchedule(state, cAlphaArgs(6))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(6), cAlphaArgs(6)); ErrorsFound = true; - } else if (!ScheduleManager::CheckScheduleValueMinMax( - state, fan->flowFracSchedNum, ScheduleManager::Clusivity::Inclusive, 0.0, ScheduleManager::Clusivity::Inclusive, 1.0)) { - ShowSevereError( - state, - format("{}: {}: invalid {} for {}={}", routineName, cCurrentModuleObject, cAlphaFieldNames(6), cAlphaFieldNames(1), cAlphaArgs(1))); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFieldNames(6), cAlphaArgs(6))); - ShowContinueError(state, "Schedule values must be (>=0., <=1.)"); + } else if (!fan->flowFracSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFieldNames(6), cAlphaArgs(6), Clusive::In, 0.0, Clusive::In, 1.0); ErrorsFound = true; } @@ -546,14 +540,14 @@ void GetFanInput(EnergyPlusData &state) } if (NumAlphas <= 7 || lAlphaFieldBlanks(8)) { - fan->minTempLimitSchedNum = 0; - } else if ((fan->minTempLimitSchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(8))) == 0) { + fan->minTempLimitSched = nullptr; + } else if ((fan->minTempLimitSched = Sched::GetSchedule(state, cAlphaArgs(8))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(8), cAlphaArgs(8)); ErrorsFound = true; } if (NumAlphas <= 8 || lAlphaFieldBlanks(9)) { - fan->balancedFractSchedNum = 0; + fan->balancedFractSched = nullptr; } else if (state.dataHeatBal->ZoneAirMassFlow.ZoneFlowAdjustment != DataHeatBalance::AdjustmentType::NoAdjustReturnAndMixing) { // do not include adjusted for "balanced" exhaust flow in the zone total return calculation ShowWarningError(state, @@ -566,17 +560,12 @@ void GetFanInput(EnergyPlusData &state) cAlphaArgs(1))); ShowContinueError(state, "When zone air mass flow balance is enforced, this input field should be left blank."); ShowContinueError(state, "This schedule will be ignored in the simulation."); - fan->balancedFractSchedNum = 0; - } else if ((fan->balancedFractSchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(9))) == 0) { + fan->balancedFractSched = nullptr; + } else if ((fan->balancedFractSched = Sched::GetSchedule(state, cAlphaArgs(9))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(9), cAlphaArgs(9)); ErrorsFound = true; - } else if (!ScheduleManager::CheckScheduleValueMinMax( - state, fan->balancedFractSchedNum, ScheduleManager::Clusivity::Inclusive, 0.0, ScheduleManager::Clusivity::Inclusive, 1.0)) { - ShowSevereError( - state, - format("{}: {}: invalid {} for {}={}", routineName, cCurrentModuleObject, cAlphaFieldNames(9), cAlphaFieldNames(1), cAlphaArgs(1))); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFieldNames(9), cAlphaArgs(9))); - ShowContinueError(state, "Schedule values must be (>=0., <=1.)"); + } else if (!fan->balancedFractSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFieldNames(9), cAlphaArgs(9), Clusive::In, 0.0, Clusive::In, 1.0); ErrorsFound = true; } if (ErrorsFound) { @@ -616,8 +605,8 @@ void GetFanInput(EnergyPlusData &state) fan->sizingPrefix = cNumericFieldNames(3); if (lAlphaFieldBlanks(2)) { - fan->availSchedNum = ScheduleManager::ScheduleAlwaysOn; - } else if ((fan->availSchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(2))) == 0) { + fan->availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((fan->availSched = Sched::GetSchedule(state, cAlphaArgs(2))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2)); ErrorsFound = true; } @@ -780,8 +769,8 @@ void GetFanInput(EnergyPlusData &state) BranchNodeConnections::TestCompSet(state, cCurrentModuleObject, cAlphaArgs(1), cAlphaArgs(2), cAlphaArgs(3), "Air Nodes"); if (lAlphaFieldBlanks(4)) { - fan->availSchedNum = 0; - } else if ((fan->availSchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(4))) == 0) { + fan->availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((fan->availSched = Sched::GetSchedule(state, cAlphaArgs(4))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(4), cAlphaArgs(4)); ErrorsFound = true; } @@ -875,8 +864,8 @@ void GetFanInput(EnergyPlusData &state) fan->type = HVAC::FanType::SystemModel; if (lAlphaFieldBlanks(2)) { - fan->availSchedNum = ScheduleManager::ScheduleAlwaysOn; - } else if ((fan->availSchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(2))) == 0) { + fan->availSched = Sched::GetScheduleAlwaysOn(state); // nullptr + } else if ((fan->availSched = Sched::GetSchedule(state, cAlphaArgs(2))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2)); ErrorsFound = true; } @@ -1124,7 +1113,7 @@ void GetFanInput(EnergyPlusData &state) if (fan->type == HVAC::FanType::Exhaust) { auto *fanExhaust = dynamic_cast(fan); assert(fanExhaust != nullptr); - if (fanExhaust->balancedFractSchedNum > 0) { + if (fanExhaust->balancedFractSched != nullptr) { SetupOutputVariable(state, "Fan Unbalanced Air Mass Flow Rate", Constant::Units::kg_s, @@ -1306,8 +1295,8 @@ void FanComponent::init(EnergyPlusData &state) } else { // zone exhaust fans massFlowRateMaxAvail = maxAirMassFlowRate; massFlowRateMinAvail = 0.0; - if (flowFracSchedNum > 0) { // modulate flow - inletAirMassFlowRate = massFlowRateMaxAvail * ScheduleManager::GetCurrentScheduleValue(state, flowFracSchedNum); + if (flowFracSched != nullptr) { // modulate flow + inletAirMassFlowRate = massFlowRateMaxAvail * flowFracSched->getCurrentVal(); inletAirMassFlowRate = max(0.0, inletAirMassFlowRate); } else { // always run at max inletAirMassFlowRate = massFlowRateMaxAvail; @@ -1658,19 +1647,14 @@ void FanComponent::simulateConstant(EnergyPlusData &state) if (faultyFilterFlag && (!state.dataGlobal->WarmupFlag) && (!state.dataGlobal->DoingSizing) && (!state.dataGlobal->KickOffSimulation)) { auto &fault = state.dataFaultsMgr->FaultsFouledAirFilters(faultyFilterIndex); // Check fault availability schedules - if (ScheduleManager::GetCurrentScheduleValue(state, fault.availSchedNum) > 0.0) { + if (fault.availSched->getCurrentVal() > 0.0) { // Decrease of the Fan Design Volume Flow Rate [m3/sec] - Real64 _fanDesignFlowRateDec = - CalFaultyFanAirFlowReduction(state, - Name, - maxAirFlowRate, - deltaPress, - (ScheduleManager::GetCurrentScheduleValue(state, fault.pressFracSchedNum) - 1) * deltaPress, - fault.fanCurveNum); + Real64 _fanDesignFlowRateDec = CalFaultyFanAirFlowReduction( + state, Name, maxAirFlowRate, deltaPress, (fault.pressFracSched->getCurrentVal() - 1) * deltaPress, fault.fanCurveNum); // Update MassFlow & DeltaPress of the fan _massFlow = min(_massFlow, maxAirMassFlowRate - _fanDesignFlowRateDec * _rhoAir); - _deltaPress = ScheduleManager::GetCurrentScheduleValue(state, fault.pressFracSchedNum) * deltaPress; + _deltaPress = fault.pressFracSched->getCurrentVal() * deltaPress; } } @@ -1683,8 +1667,7 @@ void FanComponent::simulateConstant(EnergyPlusData &state) _massFlow = max(_massFlow, minAirMassFlowRate); // Determine the Fan Schedule for the Time step - if ((ScheduleManager::GetCurrentScheduleValue(state, availSchedNum) > 0.0 || state.dataHVACGlobal->TurnFansOn) && - !state.dataHVACGlobal->TurnFansOff && _massFlow > 0.0) { + if ((availSched->getCurrentVal() > 0.0 || state.dataHVACGlobal->TurnFansOn) && !state.dataHVACGlobal->TurnFansOff && _massFlow > 0.0) { // Fan is operating totalPower = max(0.0, _massFlow * _deltaPress / (_totalEff * _rhoAir)); // total fan power _shaftPower = _motorEff * totalPower; // power delivered to shaft @@ -1775,19 +1758,15 @@ void FanComponent::simulateVAV(EnergyPlusData &state, ObjexxFCL::OptionalFaultsFouledAirFilters(faultyFilterIndex); // Check fault availability schedules - if (ScheduleManager::GetCurrentScheduleValue(state, fault.availSchedNum) > 0.0) { + if (fault.availSched->getCurrentVal() > 0.0) { Real64 _fanDesignFlowRateDec = // Decrease of the Fan Design Volume Flow Rate [m3/sec] - CalFaultyFanAirFlowReduction(state, - Name, - maxAirFlowRate, - deltaPress, - (ScheduleManager::GetCurrentScheduleValue(state, fault.pressFracSchedNum) - 1) * deltaPress, - fault.fanCurveNum); + CalFaultyFanAirFlowReduction( + state, Name, maxAirFlowRate, deltaPress, (fault.pressFracSched->getCurrentVal() - 1) * deltaPress, fault.fanCurveNum); // Update MassFlow & DeltaPress of the fan _maxAirFlowRate = maxAirFlowRate - _fanDesignFlowRateDec; _maxAirMassFlowRate = maxAirMassFlowRate - _fanDesignFlowRateDec * _rhoAir; - _deltaPress = ScheduleManager::GetCurrentScheduleValue(state, fault.pressFracSchedNum) * deltaPress; + _deltaPress = fault.pressFracSched->getCurrentVal() * deltaPress; } } @@ -1799,8 +1778,7 @@ void FanComponent::simulateVAV(EnergyPlusData &state, ObjexxFCL::Optional 0.0 || state.dataHVACGlobal->TurnFansOn) && - !state.dataHVACGlobal->TurnFansOff && _massFlow > 0.0) { + if ((availSched->getCurrentVal() > 0.0 || state.dataHVACGlobal->TurnFansOn) && !state.dataHVACGlobal->TurnFansOff && _massFlow > 0.0) { // Fan is operating - calculate power loss and enthalpy rise // fan%FanPower = PartLoadFrac*FullMassFlow*DeltaPress/(FanEff*RhoAir) ! total fan power // Calculate and check limits on fraction of system flow @@ -1918,18 +1896,14 @@ void FanComponent::simulateOnOff(EnergyPlusData &state, ObjexxFCL::OptionalFaultsFouledAirFilters(faultyFilterIndex); // Check fault availability schedules - if (ScheduleManager::GetCurrentScheduleValue(state, fault.availSchedNum) > 0.0) { + if (fault.availSched->getCurrentVal() > 0.0) { Real64 _fanDesignFlowRateDec = // Decrease of the Fan Design Volume Flow Rate [m3/sec] - CalFaultyFanAirFlowReduction(state, - Name, - maxAirFlowRate, - deltaPress, - (ScheduleManager::GetCurrentScheduleValue(state, fault.pressFracSchedNum) - 1) * deltaPress, - fault.fanCurveNum); + CalFaultyFanAirFlowReduction( + state, Name, maxAirFlowRate, deltaPress, (fault.pressFracSched->getCurrentVal() - 1) * deltaPress, fault.fanCurveNum); // Update MassFlow & DeltaPress of the fan _maxAirMassFlowRate = maxAirMassFlowRate - _fanDesignFlowRateDec * _rhoAir; - _deltaPress = ScheduleManager::GetCurrentScheduleValue(state, fault.pressFracSchedNum) * deltaPress; + _deltaPress = fault.pressFracSched->getCurrentVal() * deltaPress; } } @@ -1943,8 +1917,8 @@ void FanComponent::simulateOnOff(EnergyPlusData &state, ObjexxFCL::Optional 0.0 || state.dataHVACGlobal->TurnFansOn) && - !state.dataHVACGlobal->TurnFansOff && _massFlow > 0.0 && maxAirMassFlowRate > 0.0) { + if ((availSched->getCurrentVal() > 0.0 || state.dataHVACGlobal->TurnFansOn) && !state.dataHVACGlobal->TurnFansOff && _massFlow > 0.0 && + maxAirMassFlowRate > 0.0) { // The actual flow fraction is calculated from MassFlow and the MaxVolumeFlow * AirDensity Real64 _flowFrac = _massFlow / _maxAirMassFlowRate; @@ -2079,24 +2053,16 @@ void FanComponent::simulateZoneExhaust(EnergyPlusData &state) // apply controls to determine if operating if (availManagerMode == AvailManagerMode::Coupled) { - if (((ScheduleManager::GetCurrentScheduleValue(state, availSchedNum) > 0.0) || state.dataHVACGlobal->TurnFansOn) && - !state.dataHVACGlobal->TurnFansOff && _massFlow > 0.0) { // available - if (minTempLimitSchedNum > 0) { - _fanIsRunning = (_Tin >= ScheduleManager::GetCurrentScheduleValue(state, minTempLimitSchedNum)); - } else { - _fanIsRunning = true; - } + if (((availSched->getCurrentVal() > 0.0) || state.dataHVACGlobal->TurnFansOn) && !state.dataHVACGlobal->TurnFansOff && + _massFlow > 0.0) { // available + _fanIsRunning = (minTempLimitSched != nullptr) ? (_Tin >= minTempLimitSched->getCurrentVal()) : true; } else { _fanIsRunning = false; } } else if (availManagerMode == AvailManagerMode::Decoupled) { - if (ScheduleManager::GetCurrentScheduleValue(state, availSchedNum) > 0.0 && _massFlow > 0.0) { - if (minTempLimitSchedNum > 0) { - _fanIsRunning = (_Tin >= ScheduleManager::GetCurrentScheduleValue(state, minTempLimitSchedNum)); - } else { - _fanIsRunning = true; - } + if (availSched->getCurrentVal() > 0.0 && _massFlow > 0.0) { + _fanIsRunning = (minTempLimitSched != nullptr) ? (_Tin >= minTempLimitSched->getCurrentVal()) : true; } else { _fanIsRunning = false; } @@ -2187,8 +2153,7 @@ void FanComponent::simulateComponentModel(EnergyPlusData &state) // IF (fan%EMSMaxMassFlowOverrideOn) MassFlow = fan%EMSAirMassFlowValue // Determine the Fan Schedule for the Time step - if ((ScheduleManager::GetCurrentScheduleValue(state, availSchedNum) > 0.0 || state.dataHVACGlobal->TurnFansOn) && - !state.dataHVACGlobal->TurnFansOff && _massFlow > 0.0) { + if ((availSched->getCurrentVal() > 0.0 || state.dataHVACGlobal->TurnFansOn) && !state.dataHVACGlobal->TurnFansOff && _massFlow > 0.0) { // Fan is operating - calculate fan pressure rise, component efficiencies and power, and also air enthalpy rise // Calculate fan static pressure rise using fan volumetric flow, std air density, air-handling system characteristics, @@ -2358,9 +2323,8 @@ void FanComponent::update(EnergyPlusData &state) inletNode.MassFlowRate = inletAirMassFlowRate; if (state.afn->AirflowNetworkNumOfExhFan == 0) { state.dataHVACGlobal->UnbalExhMassFlow = inletAirMassFlowRate; - if (balancedFractSchedNum > 0) { - state.dataHVACGlobal->BalancedExhMassFlow = - state.dataHVACGlobal->UnbalExhMassFlow * ScheduleManager::GetCurrentScheduleValue(state, balancedFractSchedNum); + if (balancedFractSched != nullptr) { + state.dataHVACGlobal->BalancedExhMassFlow = state.dataHVACGlobal->UnbalExhMassFlow * balancedFractSched->getCurrentVal(); state.dataHVACGlobal->UnbalExhMassFlow = state.dataHVACGlobal->UnbalExhMassFlow - state.dataHVACGlobal->BalancedExhMassFlow; } else { state.dataHVACGlobal->BalancedExhMassFlow = 0.0; @@ -2803,9 +2767,9 @@ void FanSystem::calcSimpleSystemFan( if (faultyFilterFlag && (state.dataFaultsMgr->NumFaultyAirFilter > 0) && (!state.dataGlobal->WarmupFlag) && (!state.dataGlobal->DoingSizing) && state.dataGlobal->DoWeathSim && (!EMSMaxMassFlowOverrideOn) && (!EMSPressureOverrideOn)) { auto &fault = state.dataFaultsMgr->FaultsFouledAirFilters(faultyFilterIndex); - if (ScheduleManager::GetCurrentScheduleValue(state, fault.availSchedNum) > 0) { + if (fault.availSched->getCurrentVal() > 0) { _faultActive = true; - Real64 _pressFrac = ScheduleManager::GetCurrentScheduleValue(state, fault.pressFracSchedNum); + Real64 _pressFrac = fault.pressFracSched->getCurrentVal(); Real64 _designFlowRateDec = // Decrease of the Fan Design Volume Flow Rate [m3/sec] Fans::CalFaultyFanAirFlowReduction(state, Name, maxAirFlowRate, deltaPress, (_pressFrac - 1) * deltaPress, fault.fanCurveNum); @@ -2844,8 +2808,8 @@ void FanSystem::calcSimpleSystemFan( } } - if ((ScheduleManager::GetCurrentScheduleValue(state, availSchedNum) > 0.0 || state.dataHVACGlobal->TurnFansOn) && - !state.dataHVACGlobal->TurnFansOff && ((_localAirMassFlow[0] + _localAirMassFlow[1]) > 0.0)) { + if ((availSched->getCurrentVal() > 0.0 || state.dataHVACGlobal->TurnFansOn) && !state.dataHVACGlobal->TurnFansOff && + ((_localAirMassFlow[0] + _localAirMassFlow[1]) > 0.0)) { // fan is running for (int mode = 0; mode < _numModes; ++mode) { diff --git a/src/EnergyPlus/Fans.hh b/src/EnergyPlus/Fans.hh index e78811ef0b3..9373eed1d30 100644 --- a/src/EnergyPlus/Fans.hh +++ b/src/EnergyPlus/Fans.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -130,7 +130,7 @@ namespace Fans { std::string endUseSubcategoryName; - int availSchedNum = 0; // Pointer to the availability schedule + Sched::Schedule *availSched = nullptr; // Pointer to the availability schedule int inletNodeNum = 0; int outletNodeNum = 0; int airLoopNum = 0; @@ -293,10 +293,10 @@ namespace Fans { Real64 vfdEff = 0.0; // VFD efficiency (electrical) Real64 vfdInputPower = 0.0; // VFD input power for fan being Simulated [W] // zone exhaust fan - int flowFracSchedNum = 0; // schedule index flow rate modifier schedule + Sched::Schedule *flowFracSched = nullptr; // schedule index flow rate modifier schedule AvailManagerMode availManagerMode = AvailManagerMode::Invalid; // mode for how exhaust fan should react to availability managers - int minTempLimitSchedNum = 0; // schedule index minimum temperature limit - int balancedFractSchedNum = 0; // schedule index portion recirculated + Sched::Schedule *minTempLimitSched = nullptr; // schedule index minimum temperature limit + Sched::Schedule *balancedFractSched = nullptr; // schedule index portion recirculated Real64 unbalancedOutletMassFlowRate = 0.0; Real64 balancedOutletMassFlowRate = 0.0; Real64 designPointFEI = 0.0; // Fan Energy Index for the fan at the design operating point @@ -455,6 +455,10 @@ struct FansData : BaseGlobalStruct Array1D fans; std::map fanMap; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/FaultsManager.cc b/src/EnergyPlus/FaultsManager.cc index 01f96db6798..5bc5184862e 100644 --- a/src/EnergyPlus/FaultsManager.cc +++ b/src/EnergyPlus/FaultsManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -344,16 +344,16 @@ namespace FaultsManager { // Fault availability schedule if (lAlphaFieldBlanks(2)) { - faultsECFouling.availSchedNum = -1; // returns schedule value of 1 - } else if ((faultsECFouling.availSchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(2))) == 0) { + faultsECFouling.availSched = Sched::GetScheduleAlwaysOn(state); // returns schedule value of 1 + } else if ((faultsECFouling.availSched = Sched::GetSchedule(state, cAlphaArgs(2))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2)); state.dataFaultsMgr->ErrorsFound = true; } // Fault severity schedule if (lAlphaFieldBlanks(3)) { - faultsECFouling.severitySchedNum = -1; // returns schedule value of 1 - } else if ((faultsECFouling.severitySchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(3))) == 0) { + faultsECFouling.severitySched = Sched::GetScheduleAlwaysOn(state); // not an availability schedule, but defaults to constant-1.0 + } else if ((faultsECFouling.severitySched = Sched::GetSchedule(state, cAlphaArgs(3))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(3), cAlphaArgs(3)); state.dataFaultsMgr->ErrorsFound = true; } @@ -425,16 +425,16 @@ namespace FaultsManager { // Fault availability schedule if (lAlphaFieldBlanks(2)) { - faultsChillerFouling.availSchedNum = -1; // returns schedule value of 1 - } else if ((faultsChillerFouling.availSchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(2))) == 0) { + faultsChillerFouling.availSched = Sched::GetScheduleAlwaysOn(state); // returns schedule value of 1 + } else if ((faultsChillerFouling.availSched = Sched::GetSchedule(state, cAlphaArgs(2))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2)); state.dataFaultsMgr->ErrorsFound = true; } // Fault severity schedule if (lAlphaFieldBlanks(3)) { - faultsChillerFouling.severitySchedNum = -1; // returns schedule value of 1 - } else if ((faultsChillerFouling.severitySchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(3))) == 0) { + faultsChillerFouling.severitySched = Sched::GetScheduleAlwaysOn(state); // not an availability schedule, but defaults to constant-1.0 + } else if ((faultsChillerFouling.severitySched = Sched::GetSchedule(state, cAlphaArgs(3))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(3), cAlphaArgs(3)); state.dataFaultsMgr->ErrorsFound = true; } @@ -693,16 +693,16 @@ namespace FaultsManager { // Fault availability schedule if (lAlphaFieldBlanks(2)) { - faultsBoilerFouling.availSchedNum = -1; // returns schedule value of 1 - } else if ((faultsBoilerFouling.availSchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(2))) == 0) { + faultsBoilerFouling.availSched = Sched::GetScheduleAlwaysOn(state); // returns schedule value of 1 + } else if ((faultsBoilerFouling.availSched = Sched::GetSchedule(state, cAlphaArgs(2))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2)); state.dataFaultsMgr->ErrorsFound = true; } // Fault severity schedule if (lAlphaFieldBlanks(3)) { - faultsBoilerFouling.severitySchedNum = -1; // returns schedule value of 1 - } else if ((faultsBoilerFouling.severitySchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(3))) == 0) { + faultsBoilerFouling.severitySched = Sched::GetScheduleAlwaysOn(state); // not an availability schedule, but defaults to constant-1.0 + } else if ((faultsBoilerFouling.severitySched = Sched::GetSchedule(state, cAlphaArgs(3))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(3), cAlphaArgs(3)); state.dataFaultsMgr->ErrorsFound = true; } @@ -771,16 +771,16 @@ namespace FaultsManager { // Fault availability schedule if (lAlphaFieldBlanks(2)) { - faultsCoilSATFouling.availSchedNum = -1; // returns schedule value of 1 - } else if ((faultsCoilSATFouling.availSchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(2))) == 0) { + faultsCoilSATFouling.availSched = Sched::GetScheduleAlwaysOn(state); // returns schedule value of 1 + } else if ((faultsCoilSATFouling.availSched = Sched::GetSchedule(state, cAlphaArgs(2))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2)); state.dataFaultsMgr->ErrorsFound = true; } // Fault severity schedule if (lAlphaFieldBlanks(3)) { - faultsCoilSATFouling.severitySchedNum = -1; // returns schedule value of 1 - } else if ((faultsCoilSATFouling.severitySchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(3))) == 0) { + faultsCoilSATFouling.severitySched = Sched::GetScheduleAlwaysOn(state); // not an availability schedule, but defaults to constant-1.0 + } else if ((faultsCoilSATFouling.severitySched = Sched::GetSchedule(state, cAlphaArgs(3))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(3), cAlphaArgs(3)); state.dataFaultsMgr->ErrorsFound = true; } @@ -991,16 +991,16 @@ namespace FaultsManager { // Fault availability schedule if (lAlphaFieldBlanks(2)) { - faultsTowerFouling.availSchedNum = -1; // returns schedule value of 1 - } else if ((faultsTowerFouling.availSchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(2))) == 0) { + faultsTowerFouling.availSched = Sched::GetScheduleAlwaysOn(state); // returns schedule value of 1 + } else if ((faultsTowerFouling.availSched = Sched::GetSchedule(state, cAlphaArgs(2))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2)); state.dataFaultsMgr->ErrorsFound = true; } // Fault severity schedule if (lAlphaFieldBlanks(3)) { - faultsTowerFouling.severitySchedNum = -1; // returns schedule value of 1 - } else if ((faultsTowerFouling.severitySchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(3))) == 0) { + faultsTowerFouling.severitySched = Sched::GetScheduleAlwaysOn(state); // not an availability schedule, but defaults to constant-1.0 + } else if ((faultsTowerFouling.severitySched = Sched::GetSchedule(state, cAlphaArgs(3))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(3), cAlphaArgs(3)); state.dataFaultsMgr->ErrorsFound = true; } @@ -1099,16 +1099,16 @@ namespace FaultsManager { // Fault availability schedule if (lAlphaFieldBlanks(2)) { - faultsCondSWTFouling.availSchedNum = -1; // returns schedule value of 1 - } else if ((faultsCondSWTFouling.availSchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(2))) == 0) { + faultsCondSWTFouling.availSched = Sched::GetScheduleAlwaysOn(state); // returns schedule value of 1 + } else if ((faultsCondSWTFouling.availSched = Sched::GetSchedule(state, cAlphaArgs(2))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2)); state.dataFaultsMgr->ErrorsFound = true; } // Fault severity schedule if (lAlphaFieldBlanks(3)) { - faultsCondSWTFouling.severitySchedNum = -1; // returns schedule value of 1 - } else if ((faultsCondSWTFouling.severitySchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(3))) == 0) { + faultsCondSWTFouling.severitySched = Sched::GetScheduleAlwaysOn(state); // not an availability schedule, but defaults to constant-1.0 + } else if ((faultsCondSWTFouling.severitySched = Sched::GetSchedule(state, cAlphaArgs(3))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(3), cAlphaArgs(3)); state.dataFaultsMgr->ErrorsFound = true; } @@ -1192,16 +1192,16 @@ namespace FaultsManager { // Fault availability schedule if (lAlphaFieldBlanks(2)) { - faultsChillerSWT.availSchedNum = -1; // returns schedule value of 1 - } else if ((faultsChillerSWT.availSchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(2))) == 0) { + faultsChillerSWT.availSched = Sched::GetScheduleAlwaysOn(state); // returns schedule value of 1 + } else if ((faultsChillerSWT.availSched = Sched::GetSchedule(state, cAlphaArgs(2))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2)); state.dataFaultsMgr->ErrorsFound = true; } // Fault severity schedule if (lAlphaFieldBlanks(3)) { - faultsChillerSWT.severitySchedNum = -1; // returns schedule value of 1 - } else if ((faultsChillerSWT.severitySchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(3))) == 0) { + faultsChillerSWT.severitySched = Sched::GetScheduleAlwaysOn(state); // not an availability schedule, but defaults to constant-1.0 + } else if ((faultsChillerSWT.severitySched = Sched::GetSchedule(state, cAlphaArgs(3))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(3), cAlphaArgs(3)); state.dataFaultsMgr->ErrorsFound = true; } @@ -1441,16 +1441,16 @@ namespace FaultsManager { // Fault availability schedule if (lAlphaFieldBlanks(4)) { - faultsAirFilter.availSchedNum = -1; // returns schedule value of 1 - } else if ((faultsAirFilter.availSchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(4))) == 0) { + faultsAirFilter.availSched = Sched::GetScheduleAlwaysOn(state); // returns schedule value of 1 + } else if ((faultsAirFilter.availSched = Sched::GetSchedule(state, cAlphaArgs(4))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(4), cAlphaArgs(4)); state.dataFaultsMgr->ErrorsFound = true; } // Fan pressure increase fraction schedule if (lAlphaFieldBlanks(5)) { - faultsAirFilter.pressFracSchedNum = -1; // returns schedule value of 1 - } else if ((faultsAirFilter.pressFracSchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(5))) == 0) { + faultsAirFilter.pressFracSched = Sched::GetScheduleAlwaysOn(state); // not an availability schedule, but defaults to constant-1.0 + } else if ((faultsAirFilter.pressFracSched = Sched::GetSchedule(state, cAlphaArgs(5))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(5), cAlphaArgs(5)); state.dataFaultsMgr->ErrorsFound = true; } @@ -1512,16 +1512,16 @@ namespace FaultsManager { // Availability schedule if (lAlphaFieldBlanks(4)) { - faultsHStat.availSchedNum = -1; // returns schedule value of 1 - } else if ((faultsHStat.availSchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(4))) == 0) { + faultsHStat.availSched = Sched::GetScheduleAlwaysOn(state); // returns schedule value of 1 + } else if ((faultsHStat.availSched = Sched::GetSchedule(state, cAlphaArgs(4))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(4), cAlphaArgs(4)); state.dataFaultsMgr->ErrorsFound = true; } // Severity schedule if (lAlphaFieldBlanks(5)) { - faultsHStat.severitySchedNum = -1; // returns schedule value of 1 - } else if ((faultsHStat.severitySchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(5))) == 0) { + faultsHStat.severitySched = Sched::GetScheduleAlwaysOn(state); // not an availability schedule, but defaults to constant-1.0 + } else if ((faultsHStat.severitySched = Sched::GetSchedule(state, cAlphaArgs(5))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(5), cAlphaArgs(5)); state.dataFaultsMgr->ErrorsFound = true; } @@ -1565,16 +1565,16 @@ namespace FaultsManager { // Availability schedule if (lAlphaFieldBlanks(3)) { - faultsTStat.availSchedNum = -1; // returns schedule value of 1 - } else if ((faultsTStat.availSchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(3))) == 0) { + faultsTStat.availSched = Sched::GetScheduleAlwaysOn(state); // returns schedule value of 1 + } else if ((faultsTStat.availSched = Sched::GetSchedule(state, cAlphaArgs(3))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(3), cAlphaArgs(3)); state.dataFaultsMgr->ErrorsFound = true; } // Severity schedule if (lAlphaFieldBlanks(4)) { - faultsTStat.severitySchedNum = -1; // returns schedule value of 1 - } else if ((faultsTStat.severitySchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(4))) == 0) { + faultsTStat.severitySched = Sched::GetScheduleAlwaysOn(state); // not an availability schedule, but defaults to constant-1.0 + } else if ((faultsTStat.severitySched = Sched::GetSchedule(state, cAlphaArgs(4))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(4), cAlphaArgs(4)); state.dataFaultsMgr->ErrorsFound = true; } @@ -1613,16 +1613,16 @@ namespace FaultsManager { // Availability schedule if (lAlphaFieldBlanks(3)) { - faultsFoulCoil.availSchedNum = -1; // returns schedule value of 1 - } else if ((faultsFoulCoil.availSchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(3))) == 0) { + faultsFoulCoil.availSched = Sched::GetScheduleAlwaysOn(state); // returns schedule value of 1 + } else if ((faultsFoulCoil.availSched = Sched::GetSchedule(state, cAlphaArgs(3))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(3), cAlphaArgs(3)); state.dataFaultsMgr->ErrorsFound = true; } // Severity schedule if (lAlphaFieldBlanks(4)) { - faultsFoulCoil.severitySchedNum = -1; // returns schedule value of 1 - } else if ((faultsFoulCoil.severitySchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(4))) == 0) { + faultsFoulCoil.severitySched = Sched::GetScheduleAlwaysOn(state); // not an availability schedule, but defaults to constant-1.0 + } else if ((faultsFoulCoil.severitySched = Sched::GetSchedule(state, cAlphaArgs(4))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(4), cAlphaArgs(4)); state.dataFaultsMgr->ErrorsFound = true; } @@ -1775,16 +1775,16 @@ namespace FaultsManager { // check availability schedule if (lAlphaFieldBlanks(2)) { - fault.availSchedNum = -1; // returns schedule value of 1 - } else if ((fault.availSchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(2))) == 0) { + fault.availSched = Sched::GetScheduleAlwaysOn(state); // returns schedule value of 1 + } else if ((fault.availSched = Sched::GetSchedule(state, cAlphaArgs(2))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2)); state.dataFaultsMgr->ErrorsFound = true; } // check severity schedule if (lAlphaFieldBlanks(3)) { - fault.severitySchedNum = -1; // returns schedule value of 1 - } else if ((fault.severitySchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(3))) == 0) { + fault.severitySched = Sched::GetScheduleAlwaysOn(state); // not an availability schedule, but defaults to constant-1.0 + } else if ((fault.severitySched = Sched::GetSchedule(state, cAlphaArgs(3))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(3), cAlphaArgs(3)); state.dataFaultsMgr->ErrorsFound = true; } @@ -1827,7 +1827,7 @@ namespace FaultsManager { } } - Real64 FaultProperties::CalFaultOffsetAct(EnergyPlusData &state) + Real64 FaultProperties::CalFaultOffsetAct([[maybe_unused]] EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -1839,25 +1839,18 @@ namespace FaultsManager { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 FaultFac(0.0); // fault modification factor - Real64 OffsetAct; // actual offset after applying the modification factor // Check fault availability schedules - if (ScheduleManager::GetCurrentScheduleValue(state, this->availSchedNum) > 0.0) { + if (this->availSched->getCurrentVal() > 0.0) { // Check fault severity schedules - if (this->severitySchedNum >= 0) { - FaultFac = ScheduleManager::GetCurrentScheduleValue(state, this->severitySchedNum); - } else { - FaultFac = 1.0; - } + FaultFac = (this->severitySched != nullptr) ? this->severitySched->getCurrentVal() : 1.0; } - OffsetAct = FaultFac * this->Offset; - - return OffsetAct; + return FaultFac * this->Offset; } - Real64 FaultPropertiesFouling::CalFoulingFactor(EnergyPlusData &state) + Real64 FaultPropertiesFouling::CalFoulingFactor([[maybe_unused]] EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -1874,14 +1867,10 @@ namespace FaultsManager { 1.0); // Actual Nominal Fouling Factor, ratio between the nominal capacity or efficiency at fouling case and that at fault free case // Check fault availability schedules - if (ScheduleManager::GetCurrentScheduleValue(state, this->availSchedNum) > 0.0) { + if (this->availSched->getCurrentVal() > 0.0) { // Check fault severity schedules - if (this->severitySchedNum >= 0) { - FaultFac = ScheduleManager::GetCurrentScheduleValue(state, this->severitySchedNum); - } else { - FaultFac = 1.0; - } + FaultFac = (this->severitySched != nullptr) ? this->severitySched->getCurrentVal() : 1.0; } // The more severe the fouling fault is (i.e., larger FaultFac), the less the FoulingFactor is @@ -1890,7 +1879,7 @@ namespace FaultsManager { return FoulingFactor; } - Real64 FaultPropertiesTowerFouling::CalFaultyTowerFoulingFactor(EnergyPlusData &state) + Real64 FaultPropertiesTowerFouling::CalFaultyTowerFoulingFactor([[maybe_unused]] EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -1906,14 +1895,10 @@ namespace FaultsManager { Real64 UAReductionFactorAct(1.0); // actual UA Reduction Factor, ratio between the UA value at fouling case and that at fault free case // Check fault availability schedules - if (ScheduleManager::GetCurrentScheduleValue(state, this->availSchedNum) > 0.0) { + if (this->availSched->getCurrentVal() > 0.0) { // Check fault severity schedules - if (this->severitySchedNum >= 0) { - FaultFac = ScheduleManager::GetCurrentScheduleValue(state, this->severitySchedNum); - } else { - FaultFac = 1.0; - } + FaultFac = (this->severitySched != nullptr) ? this->severitySched->getCurrentVal() : 1.0; } // The more severe the fouling fault is (i.e., larger FaultFac), the less the UAReductionFactor is @@ -1922,7 +1907,7 @@ namespace FaultsManager { return UAReductionFactorAct; } - Real64 FaultPropertiesFoulingCoil::FaultFraction(EnergyPlusData &state) + Real64 FaultPropertiesFoulingCoil::FaultFraction([[maybe_unused]] EnergyPlusData &state) { // SUBROUTINE INFORMATION: // AUTHOR Julien Marrec, EffiBEM @@ -1932,10 +1917,10 @@ namespace FaultsManager { // Calculate the Fault Fraction based on Availability and Severity Schedules // Check fault availability schedules - if (ScheduleManager::GetCurrentScheduleValue(state, this->availSchedNum) > 0.0) { + if (this->availSched->getCurrentVal() > 0.0) { // Check fault severity schedules (Ptr initialized to -1, so would return a FaultFrac of 1 if not set) - return ScheduleManager::GetCurrentScheduleValue(state, this->severitySchedNum); + return this->severitySched->getCurrentVal(); } return 0.0; diff --git a/src/EnergyPlus/FaultsManager.hh b/src/EnergyPlus/FaultsManager.hh index 706830572bd..f57fde3e5cf 100644 --- a/src/EnergyPlus/FaultsManager.hh +++ b/src/EnergyPlus/FaultsManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -149,8 +149,8 @@ namespace FaultsManager { // Members std::string Name; FaultType type = FaultType::Invalid; - int availSchedNum = 0; - int severitySchedNum = 0; + Sched::Schedule *availSched = nullptr; + Sched::Schedule *severitySched = nullptr; Real64 Offset = 0.0; // offset, + means sensor reading is higher than actual value bool Status = false; // for future use @@ -246,7 +246,7 @@ namespace FaultsManager { int fanNum = 0; HVAC::FanType fanType = HVAC::FanType::Invalid; // The type of the fan corresponding to the fouled air filter int fanCurveNum = 0; // The index to the curve - int pressFracSchedNum = 0; // The pointer to the schedule + Sched::Schedule *pressFracSched = nullptr; // The pointer to the schedule Real64 fanPressInc = 0.0; // The increase of the fan pressure due to fouled air filter Real64 fanFlowDec = 0.0; // The decrease of the fan airflow rate due to fouled air filter @@ -417,6 +417,10 @@ struct FaultsManagerData : BaseGlobalStruct Array1D FaultsChillerFouling; Array1D FaultsEvapCoolerFouling; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/FileSystem.cc b/src/EnergyPlus/FileSystem.cc index ff8484e9556..bf9defb18e7 100644 --- a/src/EnergyPlus/FileSystem.cc +++ b/src/EnergyPlus/FileSystem.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -56,14 +56,14 @@ #include #ifdef _WIN32 -#include -#include +# include +# include #else -#include +# include #endif #ifdef __APPLE__ -#include +# include #endif // EnergyPlus Headers diff --git a/src/EnergyPlus/FileSystem.hh b/src/EnergyPlus/FileSystem.hh index 64a274359e4..c6461853ac7 100644 --- a/src/EnergyPlus/FileSystem.hh +++ b/src/EnergyPlus/FileSystem.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -56,16 +56,16 @@ #include #include #ifndef __cppcheck__ -#if __has_include() -#include +# if __has_include() +# include namespace fs = std::filesystem; -#elif __has_include() -#include +# elif __has_include() +# include namespace fs = std::experimental::filesystem; -#else +# else // cppcheck-suppress preprocessorErrorDirective -#error "no filesystem support" -#endif +# error "no filesystem support" +# endif #endif #include diff --git a/src/EnergyPlus/FluidCoolers.cc b/src/EnergyPlus/FluidCoolers.cc index 1f4601b9296..5b601dfcf77 100644 --- a/src/EnergyPlus/FluidCoolers.cc +++ b/src/EnergyPlus/FluidCoolers.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -851,11 +851,7 @@ void FluidCoolerspecs::oneTimeInit_new(EnergyPlusData &state) void FluidCoolerspecs::initEachEnvironment(EnergyPlusData &state) { static constexpr std::string_view RoutineName("FluidCoolerspecs::initEachEnvironment"); - Real64 const rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 const rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); this->DesWaterMassFlowRate = this->DesignWaterFlowRate * rho; PlantUtilities::InitComponentNodes(state, 0.0, this->DesWaterMassFlowRate, this->WaterInletNodeNum, this->WaterOutletNodeNum); } @@ -1009,16 +1005,9 @@ void FluidCoolerspecs::size(EnergyPlusData &state) if (this->PerformanceInputMethod_Num == PerfInputMethod::U_FACTOR && this->HighSpeedFluidCoolerUAWasAutoSized) { if (PltSizCondNum > 0) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); + rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, CalledFrom); + Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, CalledFrom); DesFluidCoolerLoad = rho * Cp * tmpDesignWaterFlowRate * state.dataSize->PlantSizData(PltSizCondNum).DeltaT; if (state.dataPlnt->PlantFirstSizesOkayToFinalize) this->FluidCoolerNominalCapacity = DesFluidCoolerLoad; } else { @@ -1055,16 +1044,9 @@ void FluidCoolerspecs::size(EnergyPlusData &state) "Setpoint must be > design inlet air dry-bulb temp if autosizing the Fluid Cooler."); ShowFatalError(state, "Review and revise design input values as appropriate."); } - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); + rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, CalledFrom); + Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, CalledFrom); DesFluidCoolerLoad = rho * Cp * tmpDesignWaterFlowRate * state.dataSize->PlantSizData(PltSizCondNum).DeltaT; tmpHighSpeedFanPower = 0.0105 * DesFluidCoolerLoad; if (state.dataPlnt->PlantFirstSizesOkayToFinalize) this->HighSpeedFanPower = tmpHighSpeedFanPower; @@ -1144,16 +1126,9 @@ void FluidCoolerspecs::size(EnergyPlusData &state) "Setpoint must be > design inlet air dry-bulb temp if autosizing the Fluid Cooler."); ShowFatalError(state, "Review and revise design input values as appropriate."); } - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); + rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, CalledFrom); + Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, CalledFrom); DesFluidCoolerLoad = rho * Cp * tmpDesignWaterFlowRate * state.dataSize->PlantSizData(PltSizCondNum).DeltaT; tmpHighSpeedAirFlowRate = DesFluidCoolerLoad / (this->DesignEnteringWaterTemp - this->DesignEnteringAirTemp) * 4.0; if (state.dataPlnt->PlantFirstSizesOkayToFinalize) this->HighSpeedAirFlowRate = tmpHighSpeedAirFlowRate; @@ -1226,16 +1201,9 @@ void FluidCoolerspecs::size(EnergyPlusData &state) "must be > design inlet air dry-bulb temp if autosizing the Fluid Cooler."); ShowFatalError(state, "Review and revise design input values as appropriate."); } - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); + rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, CalledFrom); + Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, CalledFrom); DesFluidCoolerLoad = rho * Cp * tmpDesignWaterFlowRate * state.dataSize->PlantSizData(PltSizCondNum).DeltaT; UA0 = 0.0001 * DesFluidCoolerLoad; // Assume deltaT = 10000K (limit) UA1 = DesFluidCoolerLoad; // Assume deltaT = 1K @@ -1340,16 +1308,8 @@ void FluidCoolerspecs::size(EnergyPlusData &state) if (this->PerformanceInputMethod_Num == PerfInputMethod::NOMINAL_CAPACITY) { if (this->DesignWaterFlowRate >= HVAC::SmallWaterVolFlow) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->DesignEnteringWaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); + rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, CalledFrom); + Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, this->DesignEnteringWaterTemp, CalledFrom); DesFluidCoolerLoad = this->FluidCoolerNominalCapacity; Real64 par2_WaterFlow = rho * tmpDesignWaterFlowRate; UA0 = 0.0001 * DesFluidCoolerLoad; // Assume deltaT = 10000K (limit) @@ -1524,16 +1484,8 @@ void FluidCoolerspecs::size(EnergyPlusData &state) } if (this->DesignWaterFlowRate >= HVAC::SmallWaterVolFlow && this->FluidCoolerLowSpeedNomCap > 0.0) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->DesignEnteringWaterTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); + rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, CalledFrom); + Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, this->DesignEnteringWaterTemp, CalledFrom); DesFluidCoolerLoad = this->FluidCoolerLowSpeedNomCap; UA0 = 0.0001 * DesFluidCoolerLoad; // Assume deltaT = 10000K (limit) UA1 = DesFluidCoolerLoad; // Assume deltaT = 1K @@ -1639,7 +1591,7 @@ void FluidCoolerspecs::size(EnergyPlusData &state) OutputReportPredefined::PreDefTableEntry( state, state.dataOutRptPredefined->pdchCTFCApproach, this->Name, this->DesignLeavingWaterTemp - this->DesignEnteringAirWetBulbTemp); OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchCTFCDesFanPwr, this->Name, this->HighSpeedFanPower); // eqival to Design Fan Power? + state, state.dataOutRptPredefined->pdchCTFCDesFanPwr, this->Name, this->HighSpeedFanPower); // equivalent to Design Fan Power? OutputReportPredefined::PreDefTableEntry( state, state.dataOutRptPredefined->pdchCTFCDesInletAirWBT, this->Name, this->DesignEnteringAirWetBulbTemp); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCTFCDesWaterFlowRate, this->Name, this->DesignWaterFlowRate); @@ -1760,11 +1712,8 @@ void FluidCoolerspecs::calcSingleSpeed(EnergyPlusData &state) // Setpoint was not met, fluid cooler ran at full capacity this->FanPower = FanPowerOn; } - Real64 CpWater = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpWater = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp, RoutineName); this->Qactual = this->WaterMassFlowRate * CpWater * (state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp - this->OutletWaterTemp); } @@ -1886,11 +1835,8 @@ void FluidCoolerspecs::calcTwoSpeed(EnergyPlusData &state) this->FanPower = FanPowerHigh; } } - Real64 CpWater = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpWater = state.dataPlnt->PlantLoop(this->plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp, RoutineName); this->Qactual = this->WaterMassFlowRate * CpWater * (state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp - this->OutletWaterTemp); } @@ -1917,24 +1863,17 @@ void CalcFluidCoolerOutlet( if (UAdesign == 0.0) return; + auto &fluidCooler = state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum); // set local fluid cooler inlet and outlet temperature variables - Real64 _InletWaterTemp = state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).WaterTemp; + Real64 _InletWaterTemp = fluidCooler.WaterTemp; _OutletWaterTemp = _InletWaterTemp; - Real64 InletAirTemp = state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).AirTemp; + Real64 InletAirTemp = fluidCooler.AirTemp; // set water and air properties - Real64 AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, - state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).AirPress, - InletAirTemp, - state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).AirHumRat); + Real64 AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, fluidCooler.AirPress, InletAirTemp, fluidCooler.AirHumRat); Real64 AirMassFlowRate = AirFlowRate * AirDensity; - Real64 CpAir = Psychrometrics::PsyCpAirFnW(state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).AirHumRat); - Real64 CpWater = FluidProperties::GetSpecificHeatGlycol( - state, - state.dataPlnt->PlantLoop(state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).plantLoc.loopNum).FluidName, - _InletWaterTemp, - state.dataPlnt->PlantLoop(state.dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpAir = Psychrometrics::PsyCpAirFnW(fluidCooler.AirHumRat); + Real64 CpWater = state.dataPlnt->PlantLoop(fluidCooler.plantLoc.loopNum).glycol->getSpecificHeat(state, _InletWaterTemp, RoutineName); // Calculate mass flow rates Real64 MdotCpWater = _WaterMassFlowRate * CpWater; @@ -1949,7 +1888,7 @@ void CalcFluidCoolerOutlet( Real64 NumTransferUnits = UAdesign / CapacityRatioMin; Real64 ETA = std::pow(NumTransferUnits, 0.22); Real64 A = CapacityRatio * NumTransferUnits / ETA; - Real64 effectiveness = 1.0 - std::exp((std::exp(-A) - 1.0) / (CapacityRatio / ETA)); + Real64 effectiveness = 1.0 - std::exp(std::expm1(-A) / (CapacityRatio / ETA)); // calculate water to air heat transfer _Qactual = effectiveness * CapacityRatioMin * (_InletWaterTemp - InletAirTemp); @@ -1978,7 +1917,7 @@ void FluidCoolerspecs::update(EnergyPlusData &state) state.dataGlobal->WarmupFlag) return; - // Check flow rate through fluid cooler and compare to design flow rate, show warning if greater than Design * Mulitplier + // Check flow rate through fluid cooler and compare to design flow rate, show warning if greater than Design * Multiplier if (state.dataLoopNodes->Node(waterOutletNode).MassFlowRate > this->DesWaterMassFlowRate * this->FluidCoolerMassFlowRateMultiplier) { ++this->HighMassFlowErrorCount; if (this->HighMassFlowErrorCount < 2) { @@ -2006,10 +1945,11 @@ void FluidCoolerspecs::update(EnergyPlusData &state) if (this->OutletWaterTempErrorCount < 2) { ShowWarningError(state, format("{} \"{}\"", DataPlant::PlantEquipTypeNames[static_cast(this->FluidCoolerType)], this->Name)); - ShowContinueError(state, - format(" Fluid cooler water outlet temperature ({.2F} C) is below the specified minimum condenser loop temp of {.2F} C", - this->OutletWaterTemp, - LoopMinTemp)); + ShowContinueError( + state, + format(" Fluid cooler water outlet temperature ({:.2F} C) is below the specified minimum condenser loop temp of {:.2F} C", + this->OutletWaterTemp, + LoopMinTemp)); ShowContinueErrorTimeStamp(state, ""); } else { ShowRecurringWarningErrorAtEnd( diff --git a/src/EnergyPlus/FluidCoolers.hh b/src/EnergyPlus/FluidCoolers.hh index 894e5d7a171..ea1f003991c 100644 --- a/src/EnergyPlus/FluidCoolers.hh +++ b/src/EnergyPlus/FluidCoolers.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -224,6 +224,10 @@ struct FluidCoolersData : BaseGlobalStruct Array1D SimpleFluidCooler; std::unordered_map UniqueSimpleFluidCoolerNames; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/FluidProperties.cc b/src/EnergyPlus/FluidProperties.cc index f42be6b6a47..39f7afcc282 100644 --- a/src/EnergyPlus/FluidProperties.cc +++ b/src/EnergyPlus/FluidProperties.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -64,7 +64,7 @@ namespace EnergyPlus { -namespace FluidProperties { +namespace Fluid { // MODULE INFORMATION: // AUTHOR Mike Turner @@ -506,6 +506,172 @@ namespace FluidProperties { 2797000.0, 3347000.0, 3976000.0, 4692000.0, 5503000.0, 6417000.0, 7442000.0, 8588000.0, 9865000.0, 11280000.0, 12860000.0, 14600000.0, 16530000.0, 18670000.0, 21040000.0, 30000000.0, 35000000.0, 40000000.0}; + void InitConstantFluidPropertiesData(EnergyPlusData &state) + { + constexpr std::string_view routineName = "InitConstantFluidPropertiesData"; + + auto &df = state.dataFluid; + bool ErrorsFound = false; + + // Where are these things initialized? + Array2D DefaultSteamSuperheatedEnthalpyData(DefaultNumSteamSuperheatedPressure, DefaultNumSteamSuperheatedTemps); + Array2D DefaultSteamSuperheatedDensityData(DefaultNumSteamSuperheatedPressure, DefaultNumSteamSuperheatedTemps); + + // Add refrigerant object for Steam. + auto *steam = new RefrigProps; + steam->Name = "STEAM"; + df->refrigs.push_back(steam); + steam->Num = df->refrigs.isize(); + + // Initialize Steam + steam->NumPsPoints = DefaultNumSteamTemps; + steam->PsTemps.allocate(DefaultNumSteamTemps); + steam->PsValues.allocate(DefaultNumSteamTemps); + steam->NumHPoints = DefaultNumSteamTemps; + steam->HTemps.allocate(DefaultNumSteamTemps); + steam->HfValues.allocate(DefaultNumSteamTemps); + steam->HfgValues.allocate(DefaultNumSteamTemps); + steam->NumCpPoints = DefaultNumSteamTemps; + steam->CpTemps.allocate(DefaultNumSteamTemps); + steam->CpfValues.allocate(DefaultNumSteamTemps); + steam->CpfgValues.allocate(DefaultNumSteamTemps); + steam->NumRhoPoints = DefaultNumSteamTemps; + steam->RhoTemps.allocate(DefaultNumSteamTemps); + steam->RhofValues.allocate(DefaultNumSteamTemps); + steam->RhofgValues.allocate(DefaultNumSteamTemps); + + steam->PsTemps = DefaultSteamTemps; + steam->PsValues = DefaultSteamPressData; + steam->HTemps = DefaultSteamTemps; + steam->HfValues = DefaultSteamEnthalpyFluidData; + steam->HfgValues = DefaultSteamEnthalpyGasFluidData; + steam->CpTemps = DefaultSteamTemps; + steam->CpfValues = DefaultSteamCpFluidData; + steam->CpfgValues = DefaultSteamCpGasFluidData; + steam->RhoTemps = DefaultSteamTemps; + steam->RhofValues = DefaultSteamDensityFluidData; + steam->RhofgValues = DefaultSteamDensityGasFluidData; + + steam->NumSupTempPoints = DefaultNumSteamSuperheatedTemps; + steam->NumSupPressPoints = DefaultNumSteamSuperheatedPressure; + steam->SupTemps.allocate(steam->NumSupTempPoints); + steam->SupPress.allocate(steam->NumSupPressPoints); + steam->HshValues.allocate(steam->NumSupPressPoints, steam->NumSupTempPoints); + steam->RhoshValues.allocate(steam->NumSupPressPoints, steam->NumSupTempPoints); + steam->SupTemps = DefaultSteamSuperheatedTemps; + steam->SupPress = DefaultSteamSuperheatedPressData; + steam->HshValues = DefaultSteamSuperheatedEnthalpyData; + steam->RhoshValues = DefaultSteamSuperheatedDensityData; + + steam->setTempLimits(state, ErrorsFound); + + // Water is always available + auto *waterRaw = GetGlycolRaw(state, "WATER"); + if (waterRaw == nullptr) { + waterRaw = new GlycolRawProps; + waterRaw->Name = "WATER"; + + df->glycolsRaw.push_back(waterRaw); + waterRaw->Num = df->glycolsRaw.isize(); + } + + waterRaw->CpDataPresent = true; + waterRaw->NumCpConcPoints = 1; + waterRaw->NumCpTempPoints = DefaultNumGlyTemps; + waterRaw->CpTemps.allocate(waterRaw->NumCpTempPoints); + waterRaw->CpTemps = DefaultGlycolTemps; + waterRaw->CpConcs.allocate(waterRaw->NumCpConcPoints); + waterRaw->CpConcs = 0.0; + waterRaw->CpValues.allocate(waterRaw->NumCpConcPoints, waterRaw->NumCpTempPoints); + waterRaw->CpValues(1, {1, waterRaw->NumCpTempPoints}) = DefaultWaterCpData; + + waterRaw->RhoDataPresent = true; + waterRaw->NumRhoConcPoints = 1; + waterRaw->NumRhoTempPoints = DefaultNumGlyTemps; + waterRaw->RhoTemps.allocate(waterRaw->NumRhoTempPoints); + waterRaw->RhoTemps = DefaultGlycolTemps; + waterRaw->RhoConcs.allocate(waterRaw->NumRhoConcPoints); + waterRaw->RhoConcs = 0.0; + waterRaw->RhoValues.allocate(waterRaw->NumRhoConcPoints, waterRaw->NumRhoTempPoints); + waterRaw->RhoValues(1, {1, waterRaw->NumRhoTempPoints}) = DefaultWaterRhoData; + + waterRaw->CondDataPresent = true; + waterRaw->NumCondConcPoints = 1; + waterRaw->NumCondTempPoints = DefaultNumGlyTemps; + waterRaw->CondTemps.allocate(waterRaw->NumCondTempPoints); + waterRaw->CondTemps = DefaultGlycolTemps; + waterRaw->CondConcs.allocate(waterRaw->NumCondConcPoints); + waterRaw->CondConcs = 0.0; + waterRaw->CondValues.allocate(waterRaw->NumCondConcPoints, waterRaw->NumCondTempPoints); + waterRaw->CondValues(1, {1, waterRaw->NumCondTempPoints}) = DefaultWaterCondData; + + waterRaw->ViscDataPresent = true; + waterRaw->NumViscConcPoints = 1; + waterRaw->NumViscTempPoints = DefaultNumGlyTemps; + waterRaw->ViscTemps.allocate(waterRaw->NumViscTempPoints); + waterRaw->ViscTemps = DefaultGlycolTemps; + waterRaw->ViscConcs.allocate(waterRaw->NumViscConcPoints); + waterRaw->ViscConcs = 0.0; + waterRaw->ViscValues.allocate(waterRaw->NumViscConcPoints, waterRaw->NumViscTempPoints); + waterRaw->ViscValues(1, {1, waterRaw->NumViscTempPoints}) = DefaultWaterViscData; + + // Water is always available + auto *water = GetGlycol(state, "WATER"); + if (water == nullptr) { + water = new GlycolProps; + water->Name = "WATER"; + water->GlycolName = "WATER"; + water->used = true; // mark Water as always used + + df->glycols.push_back(water); + water->Num = df->glycols.isize(); + } + water->Concentration = 1.0; + water->CpDataPresent = true; + water->NumCpTempPoints = DefaultNumGlyTemps; + water->RhoDataPresent = true; + water->NumRhoTempPoints = DefaultNumGlyTemps; + water->CondDataPresent = true; + water->NumCondTempPoints = DefaultNumGlyTemps; + water->ViscDataPresent = true; + water->NumViscTempPoints = DefaultNumGlyTemps; + water->CpTemps.allocate(water->NumCpTempPoints); + water->CpValues.allocate(water->NumCpTempPoints); + water->RhoTemps.allocate(water->NumRhoTempPoints); + water->RhoValues.allocate(water->NumRhoTempPoints); + water->CondTemps.allocate(water->NumCondTempPoints); + water->CondValues.allocate(water->NumCondTempPoints); + water->ViscTemps.allocate(water->NumViscTempPoints); + water->ViscValues.allocate(water->NumViscTempPoints); + water->CpTemps = DefaultGlycolTemps; + water->CpValues = DefaultWaterCpData; + water->RhoTemps = DefaultGlycolTemps; + water->RhoValues = DefaultWaterRhoData; + water->CondTemps = DefaultGlycolTemps; + water->CondValues = DefaultWaterCondData; + water->ViscTemps = DefaultGlycolTemps; + water->ViscValues = DefaultWaterViscData; + + water->setTempLimits(state, ErrorsFound); + +#ifdef PERFORMANCE_OPT + // This is a speed optimization. Maybe. + water->CpTempRatios.allocate(water->NumCpTempPoints); + for (int i = 1; i < water->NumCpTempPoints; ++i) + water->CpTempRatios(i) = (water->CpValues(i + 1) - water->CpValues(i)) / (water->CpTemps(i + 1) - water->CpTemps(i)); + water->RhoTempRatios.allocate(water->NumRhoTempPoints); + for (int i = 1; i < water->NumRhoTempPoints; ++i) + water->RhoTempRatios(i) = (water->RhoValues(i + 1) - water->RhoValues(i)) / (water->RhoTemps(i + 1) - water->RhoTemps(i)); + water->CondTempRatios.allocate(water->NumCondTempPoints); + for (int i = 1; i < water->NumCondTempPoints; ++i) + water->CondTempRatios(i) = (water->CondValues(i + 1) - water->CondValues(i)) / (water->CondTemps(i + 1) - water->CondTemps(i)); + water->ViscTempRatios.allocate(water->NumViscTempPoints); + for (int i = 1; i < water->NumCondTempPoints; ++i) + water->ViscTempRatios(i) = (water->ViscValues(i + 1) - water->ViscValues(i)) / (water->ViscTemps(i + 1) - water->ViscTemps(i)); +#endif // PERFORMANCE_OPT + + } // InitConstantFluidPropertiesData() + void GetFluidPropertiesData(EnergyPlusData &state) { @@ -526,7 +692,7 @@ namespace FluidProperties { // allocated as necessary as the data is read into the program. // SUBROUTINE PARAMETER DEFINITIONS: - Real64 constexpr PressToler(1.0); // Some reasonable value for comparisons + // Real64 constexpr PressToler(1.0); // Some reasonable value for comparisons static constexpr std::string_view routineName = "GetFluidPropertiesData"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: @@ -553,25 +719,10 @@ namespace FluidProperties { // Array initializer only takes one argument. std::bind is used to convert the // actual initializer into a function of one argument. - auto &df = state.dataFluidProps; - - // This is here because of a unit test in HVACVRF:2358 - for (int i = 1; i <= df->refrigs.isize(); ++i) - delete df->refrigs(i); - df->refrigs.clear(); - for (int i = 1; i <= df->glycolsRaw.isize(); ++i) - delete df->glycolsRaw(i); - df->glycolsRaw.clear(); - for (int i = 1; i <= df->glycols.isize(); ++i) - delete df->glycols(i); - df->glycols.clear(); + auto &df = state.dataFluid; // For default "glycol" fluids of Water, Ethylene Glycol, and Propylene Glycol - // Where are these things initialized? - Array2D DefaultSteamSuperheatedEnthalpyData(DefaultNumSteamSuperheatedPressure, DefaultNumSteamSuperheatedTemps); - Array2D DefaultSteamSuperheatedDensityData(DefaultNumSteamSuperheatedPressure, DefaultNumSteamSuperheatedTemps); - struct FluidTempData { // Members @@ -637,12 +788,6 @@ namespace FluidProperties { cNumericFields = ""; lNumericFieldBlanks = false; - // First things first, add refrigerant placeholder for Steam. - auto *steam = new RefrigProps; - steam->Name = "STEAM"; - df->refrigs.push_back(steam); - steam->Num = df->refrigs.isize(); - // Check to see if there is any FluidName input. If not, this is okay as // long as the user only desires to simulate loops with water. More than // one FluidName input is not allowed. @@ -688,46 +833,6 @@ namespace FluidProperties { ShowFatalError(state, format("{}: Previous errors in input cause program termination.", routineName)); } - // Initialize Steam - steam->NumPsPoints = DefaultNumSteamTemps; - steam->PsTemps.allocate(DefaultNumSteamTemps); - steam->PsValues.allocate(DefaultNumSteamTemps); - steam->NumHPoints = DefaultNumSteamTemps; - steam->HTemps.allocate(DefaultNumSteamTemps); - steam->HfValues.allocate(DefaultNumSteamTemps); - steam->HfgValues.allocate(DefaultNumSteamTemps); - steam->NumCpPoints = DefaultNumSteamTemps; - steam->CpTemps.allocate(DefaultNumSteamTemps); - steam->CpfValues.allocate(DefaultNumSteamTemps); - steam->CpfgValues.allocate(DefaultNumSteamTemps); - steam->NumRhoPoints = DefaultNumSteamTemps; - steam->RhoTemps.allocate(DefaultNumSteamTemps); - steam->RhofValues.allocate(DefaultNumSteamTemps); - steam->RhofgValues.allocate(DefaultNumSteamTemps); - - steam->PsTemps = DefaultSteamTemps; - steam->PsValues = DefaultSteamPressData; - steam->HTemps = DefaultSteamTemps; - steam->HfValues = DefaultSteamEnthalpyFluidData; - steam->HfgValues = DefaultSteamEnthalpyGasFluidData; - steam->CpTemps = DefaultSteamTemps; - steam->CpfValues = DefaultSteamCpFluidData; - steam->CpfgValues = DefaultSteamCpGasFluidData; - steam->RhoTemps = DefaultSteamTemps; - steam->RhofValues = DefaultSteamDensityFluidData; - steam->RhofgValues = DefaultSteamDensityGasFluidData; - - steam->NumSupTempPoints = DefaultNumSteamSuperheatedTemps; - steam->NumSupPressPoints = DefaultNumSteamSuperheatedPressure; - steam->SupTemps.allocate(steam->NumSupTempPoints); - steam->SupPress.allocate(steam->NumSupPressPoints); - steam->HshValues.allocate(steam->NumSupPressPoints, steam->NumSupTempPoints); - steam->RhoshValues.allocate(steam->NumSupPressPoints, steam->NumSupTempPoints); - steam->SupTemps = DefaultSteamSuperheatedTemps; - steam->SupPress = DefaultSteamSuperheatedPressData; - steam->HshValues = DefaultSteamSuperheatedEnthalpyData; - steam->RhoshValues = DefaultSteamSuperheatedDensityData; - // Read in all of the temperature arrays in the input file FluidTemps.allocate(NumOfFluidTempArrays); @@ -760,7 +865,7 @@ namespace FluidProperties { ShowSevereError( state, format("{}: {} name={}, lists must have data in ascending order", routineName, CurrentModuleObject, tempArray.Name)); ShowContinueError(state, - format("First out of order occurrence at Temperature #({}) {{{:.R3}}} >= Temp({}) {{{:.R3}}}", + format("First out of order occurrence at Temperature #({}) {{{:.3R}}} >= Temp({}) {{{:.3R}}}", TempLoop - 1, tempArray.Temps(TempLoop - 1), TempLoop, @@ -803,7 +908,7 @@ namespace FluidProperties { } if (refrig->satTempArrayName != "" && refrig->satTempArrayName != Alphas(4)) { - ShowSevereCustomMessage(state, eoh, "Saturated temperature arrays are not the same for different properties"); + ShowSevereCustom(state, eoh, "Saturated temperature arrays are not the same for different properties"); ErrorsFound = true; continue; } @@ -901,66 +1006,65 @@ namespace FluidProperties { ErrorObjectHeader eoh{routineName, CurrentModuleObject, refrig->Name}; if (refrig->PsValues.size() == 0) { - ShowSevereCustomMessage(state, - eoh, - format(R"(No Gas/Fluid Saturation Pressure found. Need properties with {}="Pressure" and {}="FluidGas".)", - cAlphaFields(2), - cAlphaFields(3))); + ShowSevereCustom(state, + eoh, + format(R"(No Gas/Fluid Saturation Pressure found. Need properties with {}="Pressure" and {}="FluidGas".)", + cAlphaFields(2), + cAlphaFields(3))); ErrorsFound = true; } if (refrig->HfValues.size() == 0) { - ShowSevereCustomMessage(state, - eoh, - format(R"(No Saturated Fluid Enthalpy found. Need properties with {}="Enthalpy" and {}="Fluid".)", - cAlphaFields(2), - cAlphaFields(3))); + ShowSevereCustom(state, + eoh, + format(R"(No Saturated Fluid Enthalpy found. Need properties with {}="Enthalpy" and {}="Fluid".)", + cAlphaFields(2), + cAlphaFields(3))); ErrorsFound = true; } if (refrig->HfgValues.size() == 0) { - ShowSevereCustomMessage(state, - eoh, - format(R"(No Saturated Gas/Fluid Enthalpy found. Need properties with {}="Enthalpy" and {}="FluidGas".)", - cAlphaFields(2), - cAlphaFields(3))); + ShowSevereCustom(state, + eoh, + format(R"(No Saturated Gas/Fluid Enthalpy found. Need properties with {}="Enthalpy" and {}="FluidGas".)", + cAlphaFields(2), + cAlphaFields(3))); ErrorsFound = true; } if (refrig->CpfValues.size() == 0) { - ShowSevereCustomMessage(state, - eoh, - format(R"(No Saturated Fluid Specific Heat found. Need properties with {}="SpecificHeat" and {}="Fluid".)", - cAlphaFields(2), - cAlphaFields(3))); + ShowSevereCustom(state, + eoh, + format(R"(No Saturated Fluid Specific Heat found. Need properties with {}="SpecificHeat" and {}="Fluid".)", + cAlphaFields(2), + cAlphaFields(3))); ErrorsFound = true; } if (refrig->CpfgValues.size() == 0) { - ShowSevereCustomMessage( - state, - eoh, - format(R"(No Saturated Gas/Fluid Specific Heat found. Need properties with {}="SpecificHeat" and {}="FluidGas".)", - cAlphaFields(2), - cAlphaFields(3))); + ShowSevereCustom(state, + eoh, + format(R"(No Saturated Gas/Fluid Specific Heat found. Need properties with {}="SpecificHeat" and {}="FluidGas".)", + cAlphaFields(2), + cAlphaFields(3))); ErrorsFound = true; } if (refrig->RhofValues.size() == 0) { - ShowSevereCustomMessage(state, - eoh, - format(R"(No Saturated Fluid Density found. Need properties with {}="Density" and {}="Fluid".)", - cAlphaFields(2), - cAlphaFields(3))); + ShowSevereCustom(state, + eoh, + format(R"(No Saturated Fluid Density found. Need properties with {}="Density" and {}="Fluid".)", + cAlphaFields(2), + cAlphaFields(3))); ErrorsFound = true; } if (refrig->RhofgValues.size() == 0) { - ShowSevereCustomMessage(state, - eoh, - format(R"(No Saturated Gas/Fluid Density found. Need properties with {}="Density" and {}="FluidGas".)", - cAlphaFields(2), - cAlphaFields(3))); + ShowSevereCustom(state, + eoh, + format(R"(No Saturated Gas/Fluid Density found. Need properties with {}="Density" and {}="FluidGas".)", + cAlphaFields(2), + cAlphaFields(3))); ErrorsFound = true; } } // for (refrigNum) @@ -1019,7 +1123,7 @@ namespace FluidProperties { } if (refrig->supTempArrayName != "" && refrig->supTempArrayName != Alphas(3)) { - ShowSevereCustomMessage(state, eoh, "Saturated temperature arrays are not the same for different properties"); + ShowSevereCustom(state, eoh, "Saturated temperature arrays are not the same for different properties"); ErrorsFound = true; continue; } @@ -1089,12 +1193,12 @@ namespace FluidProperties { } if ((NumNumbers - 1) != refrig->NumSupTempPoints) { - ShowSevereCustomMessage(state, - eoh, - format("Number of superheated {} points ({}) not equal to number of temperature points ({})", - Alphas(2), - NumNumbers - 1, - refrig->NumSupTempPoints)); + ShowSevereCustom(state, + eoh, + format("Number of superheated {} points ({}) not equal to number of temperature points ({})", + Alphas(2), + NumNumbers - 1, + refrig->NumSupTempPoints)); ErrorsFound = true; continue; } @@ -1120,62 +1224,12 @@ namespace FluidProperties { } } // for (InData) - // *************** RAW GLYCOLS *************** - // Go through each glycol found in the fluid names statement and read in the data - // Note that every valid fluid must have ALL of the necessary data or a fatal error will - // be produced. - - // Propylene and ethylene are available by default - - auto *waterRaw = GetGlycolRaw(state, "WATER"); - if (waterRaw == nullptr) { - waterRaw = new GlycolRawProps; - waterRaw->Name = "WATER"; - - df->glycolsRaw.push_back(waterRaw); - waterRaw->Num = df->glycolsRaw.isize(); + if (!ErrorsFound) { + for (auto *refrig : df->refrigs) + refrig->setTempLimits(state, ErrorsFound); } - waterRaw->CpDataPresent = true; - waterRaw->NumCpConcPoints = 1; - waterRaw->NumCpTempPoints = DefaultNumGlyTemps; - waterRaw->CpTemps.allocate(waterRaw->NumCpTempPoints); - waterRaw->CpTemps = DefaultGlycolTemps; - waterRaw->CpConcs.allocate(waterRaw->NumCpConcPoints); - waterRaw->CpConcs = 0.0; - waterRaw->CpValues.allocate(waterRaw->NumCpConcPoints, waterRaw->NumCpTempPoints); - waterRaw->CpValues(1, {1, waterRaw->NumCpTempPoints}) = DefaultWaterCpData; - - waterRaw->RhoDataPresent = true; - waterRaw->NumRhoConcPoints = 1; - waterRaw->NumRhoTempPoints = DefaultNumGlyTemps; - waterRaw->RhoTemps.allocate(waterRaw->NumRhoTempPoints); - waterRaw->RhoTemps = DefaultGlycolTemps; - waterRaw->RhoConcs.allocate(waterRaw->NumRhoConcPoints); - waterRaw->RhoConcs = 0.0; - waterRaw->RhoValues.allocate(waterRaw->NumRhoConcPoints, waterRaw->NumRhoTempPoints); - waterRaw->RhoValues(1, {1, waterRaw->NumRhoTempPoints}) = DefaultWaterRhoData; - - waterRaw->CondDataPresent = true; - waterRaw->NumCondConcPoints = 1; - waterRaw->NumCondTempPoints = DefaultNumGlyTemps; - waterRaw->CondTemps.allocate(waterRaw->NumCondTempPoints); - waterRaw->CondTemps = DefaultGlycolTemps; - waterRaw->CondConcs.allocate(waterRaw->NumCondConcPoints); - waterRaw->CondConcs = 0.0; - waterRaw->CondValues.allocate(waterRaw->NumCondConcPoints, waterRaw->NumCondTempPoints); - waterRaw->CondValues(1, {1, waterRaw->NumCondTempPoints}) = DefaultWaterCondData; - - waterRaw->ViscDataPresent = true; - waterRaw->NumViscConcPoints = 1; - waterRaw->NumViscTempPoints = DefaultNumGlyTemps; - waterRaw->ViscTemps.allocate(waterRaw->NumViscTempPoints); - waterRaw->ViscTemps = DefaultGlycolTemps; - waterRaw->ViscConcs.allocate(waterRaw->NumViscConcPoints); - waterRaw->ViscConcs = 0.0; - waterRaw->ViscValues.allocate(waterRaw->NumViscConcPoints, waterRaw->NumViscTempPoints); - waterRaw->ViscValues(1, {1, waterRaw->NumViscTempPoints}) = DefaultWaterViscData; - + // Ethylene and Propylene are available auto *ethylene = GetGlycolRaw(state, "ETHYLENEGLYCOL"); if (ethylene == nullptr) { ethylene = new GlycolRawProps; @@ -1314,6 +1368,11 @@ namespace FluidProperties { for (int i = 1; i <= propylene->NumViscConcPoints; ++i) propylene->ViscValues(i, {1, propylene->NumViscTempPoints}) = DefaultPropGlyViscData[i - 1]; + // *************** RAW GLYCOLS *************** + // Go through each glycol found in the fluid names statement and read in the data + // Note that every valid fluid must have ALL of the necessary data or a fatal error will + // be produced. + CurrentModuleObject = "FluidProperties:Concentration"; for (int InData = 1; InData <= NumOfGlyFluidPropArrays; ++InData) { // check temperatures given for specific heat are consistant state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -1347,7 +1406,7 @@ namespace FluidProperties { } if (Numbers(1) < 0.0) { - ShowSevereCustomMessage(state, eoh, "Negative concentrations not allowed in fluid property input data"); + ShowSevereCustom(state, eoh, "Negative concentrations not allowed in fluid property input data"); ErrorsFound = true; continue; } @@ -1355,12 +1414,12 @@ namespace FluidProperties { // Can temperatue and pressure points be different for different properties? Why is this allowed? if (Alphas(2) == "SPECIFICHEAT") { if (glycolRaw->CpTempArrayName != "" && glycolRaw->CpTempArrayName != Alphas(3)) { - ShowSevereCustomMessage(state, - eoh, - format("All specific heat data for the same glycol must use the same temperature list" - "Expected name={}, Entered name={}", - glycolRaw->CpTempArrayName, - Alphas(3))); + ShowSevereCustom(state, + eoh, + format("All specific heat data for the same glycol must use the same temperature list" + "Expected name={}, Entered name={}", + glycolRaw->CpTempArrayName, + Alphas(3))); ErrorsFound = true; continue; } @@ -1374,12 +1433,12 @@ namespace FluidProperties { } else if (Alphas(2) == "DENSITY") { if (glycolRaw->RhoTempArrayName != "" && glycolRaw->RhoTempArrayName != Alphas(3)) { - ShowSevereCustomMessage(state, - eoh, - format("All density data for the same glycol must use the same temperature list" - "Expected name={}, Entered name={}", - glycolRaw->RhoTempArrayName, - Alphas(3))); + ShowSevereCustom(state, + eoh, + format("All density data for the same glycol must use the same temperature list" + "Expected name={}, Entered name={}", + glycolRaw->RhoTempArrayName, + Alphas(3))); ErrorsFound = true; continue; } @@ -1393,12 +1452,12 @@ namespace FluidProperties { } else if (Alphas(2) == "CONDUCTIVITY") { if (glycolRaw->CondTempArrayName != "" && glycolRaw->CondTempArrayName != Alphas(3)) { - ShowSevereCustomMessage(state, - eoh, - format("All conductivity data for the same glycol must use the same temperature list" - "Expected name={}, Entered name={}", - glycolRaw->CondTempArrayName, - Alphas(3))); + ShowSevereCustom(state, + eoh, + format("All conductivity data for the same glycol must use the same temperature list" + "Expected name={}, Entered name={}", + glycolRaw->CondTempArrayName, + Alphas(3))); ErrorsFound = true; continue; } @@ -1412,12 +1471,12 @@ namespace FluidProperties { } else if (Alphas(2) == "VISCOSITY") { if (glycolRaw->ViscTempArrayName != "" && glycolRaw->ViscTempArrayName != Alphas(3)) { - ShowSevereCustomMessage(state, - eoh, - format("All conductivity data for the same glycol must use the same temperature list" - "Expected name={}, Entered name={}", - glycolRaw->ViscTempArrayName, - Alphas(3))); + ShowSevereCustom(state, + eoh, + format("All conductivity data for the same glycol must use the same temperature list" + "Expected name={}, Entered name={}", + glycolRaw->ViscTempArrayName, + Alphas(3))); ErrorsFound = true; continue; } @@ -1508,11 +1567,11 @@ namespace FluidProperties { if (Alphas(2) == "SPECIFICHEAT") { if ((NumNumbers - 1) != glycolRaw->NumCpTempPoints) { - ShowSevereCustomMessage(state, - eoh, - format("Number of specific heat points ({}) not equal to number of temperature points ({})", - NumNumbers - 1, - glycolRaw->NumCpTempPoints)); + ShowSevereCustom(state, + eoh, + format("Number of specific heat points ({}) not equal to number of temperature points ({})", + NumNumbers - 1, + glycolRaw->NumCpTempPoints)); ErrorsFound = true; continue; } @@ -1523,11 +1582,11 @@ namespace FluidProperties { } else if (Alphas(2) == "DENSITY") { if ((NumNumbers - 1) != glycolRaw->NumRhoTempPoints) { - ShowSevereCustomMessage(state, - eoh, - format("Number of density points ({}) not equal to number of temperature points ({})", - NumNumbers - 1, - glycolRaw->NumRhoTempPoints)); + ShowSevereCustom(state, + eoh, + format("Number of density points ({}) not equal to number of temperature points ({})", + NumNumbers - 1, + glycolRaw->NumRhoTempPoints)); ErrorsFound = true; continue; } @@ -1538,11 +1597,11 @@ namespace FluidProperties { } else if (Alphas(2) == "CONDUCTIVITY") { if ((NumNumbers - 1) != glycolRaw->NumCondTempPoints) { - ShowSevereCustomMessage(state, - eoh, - format("Number of conductivity points ({}) not equal to number of temperature points ({})", - NumNumbers - 1, - glycolRaw->NumCondTempPoints)); + ShowSevereCustom(state, + eoh, + format("Number of conductivity points ({}) not equal to number of temperature points ({})", + NumNumbers - 1, + glycolRaw->NumCondTempPoints)); ErrorsFound = true; continue; } @@ -1553,11 +1612,11 @@ namespace FluidProperties { } else if (Alphas(2) == "VISCOSITY") { if ((NumNumbers - 1) != glycolRaw->NumViscTempPoints) { - ShowSevereCustomMessage(state, - eoh, - format("Number of viscosity points ({}) not equal to number of temperature points ({})", - NumNumbers - 1, - glycolRaw->NumViscTempPoints)); + ShowSevereCustom(state, + eoh, + format("Number of viscosity points ({}) not equal to number of temperature points ({})", + NumNumbers - 1, + glycolRaw->NumViscTempPoints)); ErrorsFound = true; continue; } @@ -1599,58 +1658,6 @@ namespace FluidProperties { CurrentModuleObject = "FluidProperties:GlycolConcentration"; NumOfOptionalInput = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); - auto *water = GetGlycol(state, "WATER"); - if (water == nullptr) { - water = new GlycolProps; - water->Name = "WATER"; - water->GlycolName = "WATER"; - water->used = true; // mark Water as always used - - df->glycols.push_back(water); - water->Num = df->glycols.isize(); - } - water->Concentration = 1.0; - water->CpDataPresent = true; - water->NumCpTempPoints = DefaultNumGlyTemps; - water->RhoDataPresent = true; - water->NumRhoTempPoints = DefaultNumGlyTemps; - water->CondDataPresent = true; - water->NumCondTempPoints = DefaultNumGlyTemps; - water->ViscDataPresent = true; - water->NumViscTempPoints = DefaultNumGlyTemps; - water->CpTemps.allocate(water->NumCpTempPoints); - water->CpValues.allocate(water->NumCpTempPoints); - water->RhoTemps.allocate(water->NumRhoTempPoints); - water->RhoValues.allocate(water->NumRhoTempPoints); - water->CondTemps.allocate(water->NumCondTempPoints); - water->CondValues.allocate(water->NumCondTempPoints); - water->ViscTemps.allocate(water->NumViscTempPoints); - water->ViscValues.allocate(water->NumViscTempPoints); - water->CpTemps = DefaultGlycolTemps; - water->CpValues = DefaultWaterCpData; - water->RhoTemps = DefaultGlycolTemps; - water->RhoValues = DefaultWaterRhoData; - water->CondTemps = DefaultGlycolTemps; - water->CondValues = DefaultWaterCondData; - water->ViscTemps = DefaultGlycolTemps; - water->ViscValues = DefaultWaterViscData; - -#ifdef PERFORMANCE_OPT - // This is a speed optimization. Maybe. - water->CpTempRatios.allocate(water->NumCpTempPoints); - for (int i = 1; i < water->NumCpTempPoints; ++i) - water->CpTempRatios(i) = (water->CpValues(i + 1) - water->CpValues(i)) / (water->CpTemps(i + 1) - water->CpTemps(i)); - water->RhoTempRatios.allocate(water->NumRhoTempPoints); - for (int i = 1; i < water->NumRhoTempPoints; ++i) - water->RhoTempRatios(i) = (water->RhoValues(i + 1) - water->RhoValues(i)) / (water->RhoTemps(i + 1) - water->RhoTemps(i)); - water->CondTempRatios.allocate(water->NumCondTempPoints); - for (int i = 1; i < water->NumCondTempPoints; ++i) - water->CondTempRatios(i) = (water->CondValues(i + 1) - water->CondValues(i)) / (water->CondTemps(i + 1) - water->CondTemps(i)); - water->ViscTempRatios.allocate(water->NumViscTempPoints); - for (int i = 1; i < water->NumCondTempPoints; ++i) - water->ViscTempRatios(i) = (water->ViscValues(i + 1) - water->ViscValues(i)) / (water->ViscTemps(i + 1) - water->ViscTemps(i)); -#endif // PERFORMANCE_OPT - for (int Loop = 1; Loop <= NumOfOptionalInput; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, CurrentModuleObject, @@ -1786,6 +1793,7 @@ namespace FluidProperties { glycol->Concentration, glycol->ViscValues); + glycol->setTempLimits(state, ErrorsFound); #ifdef PERFORMANCE_OPT // This is a speed optimization. Maybe. glycol->CpTempRatios.allocate(glycol->NumCpTempPoints); @@ -1803,10 +1811,6 @@ namespace FluidProperties { #endif // PERFORMANCE_OPT } // for (Loop) - if (!ErrorsFound) InitializeGlycolTempLimits(state, ErrorsFound); // Initialize the Temp limits for the glycols - - if (!ErrorsFound) InitializeRefrigerantLimits(state, ErrorsFound); // Initialize the limits for the refrigerants - FluidTemps.deallocate(); Alphas.deallocate(); @@ -1924,7 +1928,7 @@ namespace FluidProperties { //***************************************************************************** - void InitializeGlycolTempLimits(EnergyPlusData &state, bool &ErrorsFound) // set to true if errors found here + void GlycolProps::setTempLimits(EnergyPlusData &state, bool &ErrorsFound) // set to true if errors found here { // SUBROUTINE INFORMATION: @@ -1936,98 +1940,96 @@ namespace FluidProperties { // Most properties requested (e.g., Specific Heat) must be > 0 but the tables may // be set up for symmetry and not be limited to just valid values. - auto const &df = state.dataFluidProps; - - for (auto *glycol : df->glycols) { - if (glycol->CpDataPresent) { - // check for lowest non-zero value by referencing temp data - for (int IndexNum = 1; IndexNum <= glycol->NumCpTempPoints; ++IndexNum) { - if (glycol->CpValues(IndexNum) <= 0.0) continue; - glycol->CpLowTempIndex = IndexNum; - glycol->CpLowTempValue = glycol->CpTemps(IndexNum); - break; - } - // check for highest non-zero value by referencing temp data - for (int IndexNum = glycol->NumCpTempPoints; IndexNum >= 1; --IndexNum) { - if (glycol->CpValues(IndexNum) <= 0.0) continue; - glycol->CpHighTempIndex = IndexNum; - glycol->CpHighTempValue = glycol->CpTemps(IndexNum); - break; - } - } - if (glycol->RhoDataPresent) { - // check for lowest non-zero value by referencing temp data - for (int IndexNum = 1; IndexNum <= glycol->NumRhoTempPoints; ++IndexNum) { - if (glycol->RhoValues(IndexNum) <= 0.0) continue; - glycol->RhoLowTempIndex = IndexNum; - glycol->RhoLowTempValue = glycol->RhoTemps(IndexNum); - break; - } - // check for highest non-zero value by referencing temp data - for (int IndexNum = glycol->NumRhoTempPoints; IndexNum >= 1; --IndexNum) { - if (glycol->RhoValues(IndexNum) <= 0.0) continue; - glycol->RhoHighTempIndex = IndexNum; - glycol->RhoHighTempValue = glycol->RhoTemps(IndexNum); - break; - } + if (this->CpDataPresent) { + // check for lowest non-zero value by referencing temp data + for (int IndexNum = 1; IndexNum <= this->NumCpTempPoints; ++IndexNum) { + if (this->CpValues(IndexNum) <= 0.0) continue; + this->CpLowTempIndex = IndexNum; + this->CpLowTempValue = this->CpTemps(IndexNum); + break; } - if (glycol->CondDataPresent) { - // check for lowest non-zero value by referencing temp data - for (int IndexNum = 1; IndexNum <= glycol->NumCondTempPoints; ++IndexNum) { - if (glycol->CondValues(IndexNum) <= 0.0) continue; - glycol->CondLowTempIndex = IndexNum; - glycol->CondLowTempValue = glycol->CondTemps(IndexNum); - break; - } - // check for highest non-zero value by referencing temp data - for (int IndexNum = glycol->NumCondTempPoints; IndexNum >= 1; --IndexNum) { - if (glycol->CondValues(IndexNum) <= 0.0) continue; - glycol->CondHighTempIndex = IndexNum; - glycol->CondHighTempValue = glycol->CondTemps(IndexNum); - break; - } + // check for highest non-zero value by referencing temp data + for (int IndexNum = this->NumCpTempPoints; IndexNum >= 1; --IndexNum) { + if (this->CpValues(IndexNum) <= 0.0) continue; + this->CpHighTempIndex = IndexNum; + this->CpHighTempValue = this->CpTemps(IndexNum); + break; } - if (glycol->ViscDataPresent) { - // check for lowest non-zero value by referencing temp data - for (int IndexNum = 1; IndexNum <= glycol->NumViscTempPoints; ++IndexNum) { - if (glycol->ViscValues(IndexNum) <= 0.0) continue; - glycol->ViscLowTempIndex = IndexNum; - glycol->ViscLowTempValue = glycol->ViscTemps(IndexNum); - break; - } - // check for highest non-zero value by referencing temp data - for (int IndexNum = glycol->NumViscTempPoints; IndexNum >= 1; --IndexNum) { - if (glycol->ViscValues(IndexNum) <= 0.0) continue; - glycol->ViscHighTempIndex = IndexNum; - glycol->ViscHighTempValue = glycol->ViscTemps(IndexNum); - break; - } + } + + if (this->RhoDataPresent) { + // check for lowest non-zero value by referencing temp data + for (int IndexNum = 1; IndexNum <= this->NumRhoTempPoints; ++IndexNum) { + if (this->RhoValues(IndexNum) <= 0.0) continue; + this->RhoLowTempIndex = IndexNum; + this->RhoLowTempValue = this->RhoTemps(IndexNum); + break; } - bool Failure = false; - // Check to see that all are set to non-zero - if (glycol->CpDataPresent) { - Failure = glycol->CpLowTempIndex == 0 || glycol->CpHighTempIndex == 0; + // check for highest non-zero value by referencing temp data + for (int IndexNum = this->NumRhoTempPoints; IndexNum >= 1; --IndexNum) { + if (this->RhoValues(IndexNum) <= 0.0) continue; + this->RhoHighTempIndex = IndexNum; + this->RhoHighTempValue = this->RhoTemps(IndexNum); + break; } - if (glycol->RhoDataPresent) { - Failure = glycol->RhoLowTempIndex == 0 || glycol->RhoHighTempIndex == 0; + } + + if (this->CondDataPresent) { + // check for lowest non-zero value by referencing temp data + for (int IndexNum = 1; IndexNum <= this->NumCondTempPoints; ++IndexNum) { + if (this->CondValues(IndexNum) <= 0.0) continue; + this->CondLowTempIndex = IndexNum; + this->CondLowTempValue = this->CondTemps(IndexNum); + break; } - if (glycol->CondDataPresent) { - Failure = glycol->CondLowTempIndex == 0 || glycol->CondHighTempIndex == 0; + // check for highest non-zero value by referencing temp data + for (int IndexNum = this->NumCondTempPoints; IndexNum >= 1; --IndexNum) { + if (this->CondValues(IndexNum) <= 0.0) continue; + this->CondHighTempIndex = IndexNum; + this->CondHighTempValue = this->CondTemps(IndexNum); + break; } - if (glycol->ViscDataPresent) { - Failure = glycol->ViscLowTempIndex == 0 || glycol->ViscHighTempIndex == 0; + } + if (this->ViscDataPresent) { + // check for lowest non-zero value by referencing temp data + for (int IndexNum = 1; IndexNum <= this->NumViscTempPoints; ++IndexNum) { + if (this->ViscValues(IndexNum) <= 0.0) continue; + this->ViscLowTempIndex = IndexNum; + this->ViscLowTempValue = this->ViscTemps(IndexNum); + break; } - if (Failure) { - ShowSevereError( - state, format("InitializeGlycolTempLimits: Required values for Glycol={} are all zeroes for some data types.", glycol->Name)); - ErrorsFound = true; + // check for highest non-zero value by referencing temp data + for (int IndexNum = this->NumViscTempPoints; IndexNum >= 1; --IndexNum) { + if (this->ViscValues(IndexNum) <= 0.0) continue; + this->ViscHighTempIndex = IndexNum; + this->ViscHighTempValue = this->ViscTemps(IndexNum); + break; } } + + bool Failure = false; + // Check to see that all are set to non-zero + if (this->CpDataPresent) { + Failure = this->CpLowTempIndex == 0 || this->CpHighTempIndex == 0; + } + if (this->RhoDataPresent) { + Failure = this->RhoLowTempIndex == 0 || this->RhoHighTempIndex == 0; + } + if (this->CondDataPresent) { + Failure = this->CondLowTempIndex == 0 || this->CondHighTempIndex == 0; + } + if (this->ViscDataPresent) { + Failure = this->ViscLowTempIndex == 0 || this->ViscHighTempIndex == 0; + } + if (Failure) { + ShowSevereError(state, format("setTempLimits: Required values for Glycol={} are all zeroes for some data types.", this->Name)); + ErrorsFound = true; + } } //***************************************************************************** - void InitializeRefrigerantLimits(EnergyPlusData &state, bool &ErrorsFound) // set to true if errors found here + void RefrigProps::setTempLimits(EnergyPlusData &state, bool &ErrorsFound) // set to true if errors found here { // SUBROUTINE INFORMATION: @@ -2039,120 +2041,113 @@ namespace FluidProperties { // for the refrigerant properties. // Most properties requested (e.g., Specific Heat) must be > 0 but the tables may // be set up for symmetry and not be limited to just valid values. - auto const &df = state.dataFluidProps; + for (int IndexNum = 1; IndexNum <= this->NumPsPoints; ++IndexNum) { + if (this->PsValues(IndexNum) <= 0.0) continue; + this->PsLowPresIndex = IndexNum; + this->PsLowPresValue = this->PsValues(IndexNum); + this->PsLowTempValue = this->PsTemps(IndexNum); + this->PsLowTempIndex = IndexNum; + break; + } + for (int IndexNum = this->NumPsPoints; IndexNum >= 1; --IndexNum) { + if (this->PsValues(IndexNum) <= 0.0) continue; + this->PsHighPresIndex = IndexNum; + this->PsHighPresValue = this->PsValues(IndexNum); + this->PsHighTempValue = this->PsTemps(IndexNum); + this->PsHighTempIndex = IndexNum; + break; + } + for (int IndexNum = 1; IndexNum <= this->NumHPoints; ++IndexNum) { + if (this->HfValues(IndexNum) <= 0.0) continue; + this->HfLowTempValue = this->HfValues(IndexNum); + this->HfLowTempIndex = IndexNum; + break; + } + for (int IndexNum = this->NumHPoints; IndexNum >= 1; --IndexNum) { + if (this->HfValues(IndexNum) <= 0.0) continue; + this->HfHighTempValue = this->HfValues(IndexNum); + this->HfHighTempIndex = IndexNum; + break; + } + for (int IndexNum = 1; IndexNum <= this->NumHPoints; ++IndexNum) { + if (this->HfgValues(IndexNum) <= 0.0) continue; + this->HfgLowTempValue = this->HfgValues(IndexNum); + this->HfgLowTempIndex = IndexNum; + break; + } + for (int IndexNum = this->NumHPoints; IndexNum >= 1; --IndexNum) { + if (this->HfgValues(IndexNum) <= 0.0) continue; + this->HfgHighTempValue = this->HfgValues(IndexNum); + this->HfgHighTempIndex = IndexNum; + break; + } + for (int IndexNum = 1; IndexNum <= this->NumCpPoints; ++IndexNum) { + if (this->CpfValues(IndexNum) <= 0.0) continue; + this->CpfLowTempValue = this->CpfValues(IndexNum); + this->CpfLowTempIndex = IndexNum; + break; + } + for (int IndexNum = this->NumCpPoints; IndexNum >= 1; --IndexNum) { + if (this->CpfValues(IndexNum) <= 0.0) continue; + this->CpfHighTempValue = this->CpfValues(IndexNum); + this->CpfHighTempIndex = IndexNum; + break; + } + for (int IndexNum = 1; IndexNum <= this->NumCpPoints; ++IndexNum) { + if (this->CpfgValues(IndexNum) <= 0.0) continue; + this->CpfgLowTempValue = this->CpfgValues(IndexNum); + this->CpfgLowTempIndex = IndexNum; + break; + } + for (int IndexNum = this->NumCpPoints; IndexNum >= 1; --IndexNum) { + if (this->CpfgValues(IndexNum) <= 0.0) continue; + this->CpfgHighTempValue = this->CpfgValues(IndexNum); + this->CpfgHighTempIndex = IndexNum; + break; + } + for (int IndexNum = 1; IndexNum <= this->NumRhoPoints; ++IndexNum) { + if (this->RhofValues(IndexNum) <= 0.0) continue; + this->RhofLowTempValue = this->RhofValues(IndexNum); + this->RhofLowTempIndex = IndexNum; + break; + } + for (int IndexNum = this->NumRhoPoints; IndexNum >= 1; --IndexNum) { + if (this->RhofValues(IndexNum) <= 0.0) continue; + this->RhofHighTempValue = this->RhofValues(IndexNum); + this->RhofHighTempIndex = IndexNum; + break; + } + for (int IndexNum = 1; IndexNum <= this->NumRhoPoints; ++IndexNum) { + if (this->RhofgValues(IndexNum) <= 0.0) continue; + this->RhofgLowTempValue = this->RhofgValues(IndexNum); + this->RhofgLowTempIndex = IndexNum; + break; + } + for (int IndexNum = this->NumRhoPoints; IndexNum >= 1; --IndexNum) { + if (this->RhofgValues(IndexNum) <= 0.0) continue; + this->RhofgHighTempValue = this->RhofgValues(IndexNum); + this->RhofgHighTempIndex = IndexNum; + break; + } - for (auto *refrig : df->refrigs) { - for (int IndexNum = 1; IndexNum <= refrig->NumPsPoints; ++IndexNum) { - if (refrig->PsValues(IndexNum) <= 0.0) continue; - refrig->PsLowPresIndex = IndexNum; - refrig->PsLowPresValue = refrig->PsValues(IndexNum); - refrig->PsLowTempValue = refrig->PsTemps(IndexNum); - refrig->PsLowTempIndex = IndexNum; - break; - } - for (int IndexNum = refrig->NumPsPoints; IndexNum >= 1; --IndexNum) { - if (refrig->PsValues(IndexNum) <= 0.0) continue; - refrig->PsHighPresIndex = IndexNum; - refrig->PsHighPresValue = refrig->PsValues(IndexNum); - refrig->PsHighTempValue = refrig->PsTemps(IndexNum); - refrig->PsHighTempIndex = IndexNum; - break; - } - for (int IndexNum = 1; IndexNum <= refrig->NumHPoints; ++IndexNum) { - if (refrig->HfValues(IndexNum) <= 0.0) continue; - refrig->HfLowTempValue = refrig->HfValues(IndexNum); - refrig->HfLowTempIndex = IndexNum; - break; - } - for (int IndexNum = refrig->NumHPoints; IndexNum >= 1; --IndexNum) { - if (refrig->HfValues(IndexNum) <= 0.0) continue; - refrig->HfHighTempValue = refrig->HfValues(IndexNum); - refrig->HfHighTempIndex = IndexNum; - break; - } - for (int IndexNum = 1; IndexNum <= refrig->NumHPoints; ++IndexNum) { - if (refrig->HfgValues(IndexNum) <= 0.0) continue; - refrig->HfgLowTempValue = refrig->HfgValues(IndexNum); - refrig->HfgLowTempIndex = IndexNum; - break; - } - for (int IndexNum = refrig->NumHPoints; IndexNum >= 1; --IndexNum) { - if (refrig->HfgValues(IndexNum) <= 0.0) continue; - refrig->HfgHighTempValue = refrig->HfgValues(IndexNum); - refrig->HfgHighTempIndex = IndexNum; - break; - } - for (int IndexNum = 1; IndexNum <= refrig->NumCpPoints; ++IndexNum) { - if (refrig->CpfValues(IndexNum) <= 0.0) continue; - refrig->CpfLowTempValue = refrig->CpfValues(IndexNum); - refrig->CpfLowTempIndex = IndexNum; - break; - } - for (int IndexNum = refrig->NumCpPoints; IndexNum >= 1; --IndexNum) { - if (refrig->CpfValues(IndexNum) <= 0.0) continue; - refrig->CpfHighTempValue = refrig->CpfValues(IndexNum); - refrig->CpfHighTempIndex = IndexNum; - break; - } - for (int IndexNum = 1; IndexNum <= refrig->NumCpPoints; ++IndexNum) { - if (refrig->CpfgValues(IndexNum) <= 0.0) continue; - refrig->CpfgLowTempValue = refrig->CpfgValues(IndexNum); - refrig->CpfgLowTempIndex = IndexNum; - break; - } - for (int IndexNum = refrig->NumCpPoints; IndexNum >= 1; --IndexNum) { - if (refrig->CpfgValues(IndexNum) <= 0.0) continue; - refrig->CpfgHighTempValue = refrig->CpfgValues(IndexNum); - refrig->CpfgHighTempIndex = IndexNum; - break; - } - for (int IndexNum = 1; IndexNum <= refrig->NumRhoPoints; ++IndexNum) { - if (refrig->RhofValues(IndexNum) <= 0.0) continue; - refrig->RhofLowTempValue = refrig->RhofValues(IndexNum); - refrig->RhofLowTempIndex = IndexNum; - break; - } - for (int IndexNum = refrig->NumRhoPoints; IndexNum >= 1; --IndexNum) { - if (refrig->RhofValues(IndexNum) <= 0.0) continue; - refrig->RhofHighTempValue = refrig->RhofValues(IndexNum); - refrig->RhofHighTempIndex = IndexNum; - break; - } - for (int IndexNum = 1; IndexNum <= refrig->NumRhoPoints; ++IndexNum) { - if (refrig->RhofgValues(IndexNum) <= 0.0) continue; - refrig->RhofgLowTempValue = refrig->RhofgValues(IndexNum); - refrig->RhofgLowTempIndex = IndexNum; - break; - } - for (int IndexNum = refrig->NumRhoPoints; IndexNum >= 1; --IndexNum) { - if (refrig->RhofgValues(IndexNum) <= 0.0) continue; - refrig->RhofgHighTempValue = refrig->RhofgValues(IndexNum); - refrig->RhofgHighTempIndex = IndexNum; - break; - } - bool Failure = false; - // Check to see that all are set to non-zero - if (refrig->NumPsPoints > 0) { - Failure = refrig->PsLowPresIndex == 0 || refrig->PsLowTempIndex == 0 || refrig->PsHighPresIndex == 0 || refrig->PsHighTempIndex == 0; - } - if (refrig->NumHPoints > 0) { - Failure = - refrig->HfLowTempIndex == 0 || refrig->HfgLowTempIndex == 0 || refrig->HfHighTempIndex == 0 || refrig->HfgHighTempIndex == 0; - } - if (refrig->NumCpPoints > 0) { - Failure = - refrig->CpfLowTempIndex == 0 || refrig->CpfgLowTempIndex == 0 || refrig->CpfHighTempIndex == 0 || refrig->CpfgHighTempIndex == 0; - } - if (refrig->NumRhoPoints > 0) { - Failure = refrig->RhofLowTempIndex == 0 || refrig->RhofgLowTempIndex == 0 || refrig->RhofHighTempIndex == 0 || - refrig->RhofgHighTempIndex == 0; - } - if (Failure) { - ShowSevereError( - state, - format("InitializeRefrigerantLimits: Required values for Refrigerant={} are all zeroes for some data types.", refrig->Name)); - ErrorsFound = true; - } + bool Failure = false; + // Check to see that all are set to non-zero + if (this->NumPsPoints > 0) { + Failure = this->PsLowPresIndex == 0 || this->PsLowTempIndex == 0 || this->PsHighPresIndex == 0 || this->PsHighTempIndex == 0; + } + if (this->NumHPoints > 0) { + Failure = this->HfLowTempIndex == 0 || this->HfgLowTempIndex == 0 || this->HfHighTempIndex == 0 || this->HfgHighTempIndex == 0; + } + if (this->NumCpPoints > 0) { + Failure = this->CpfLowTempIndex == 0 || this->CpfgLowTempIndex == 0 || this->CpfHighTempIndex == 0 || this->CpfgHighTempIndex == 0; + } + if (this->NumRhoPoints > 0) { + Failure = this->RhofLowTempIndex == 0 || this->RhofgLowTempIndex == 0 || this->RhofHighTempIndex == 0 || this->RhofgHighTempIndex == 0; + } + if (Failure) { + ShowSevereError(state, + format("RefrigProps::setTempimits: Required values for Refrigerant={} are all zeroes for some data types.", this->Name)); + ErrorsFound = true; } } @@ -2181,7 +2176,7 @@ namespace FluidProperties { Real64 Temperature; // Temperature to drive values Real64 ReturnValue; // Values returned from glycol functions - auto const &df = state.dataFluidProps; + auto const &df = state.dataFluid; for (auto *glycol : df->glycols) { @@ -2284,7 +2279,7 @@ namespace FluidProperties { print(state.files.debug, ",{:.2R}\n", glycol->CpTemps(glycol->NumCpTempPoints) + incr); print(state.files.debug, "Specific Heat:"); Temperature = glycol->CpTemps(1) - incr; - ReturnValue = GetSpecificHeatGlycol(state, glycol->Name, Temperature, GlycolIndex, routineName); + ReturnValue = glycol->getSpecificHeat(state, Temperature, routineName); print(state.files.debug, ",{:.2R}", ReturnValue); for (int Loop = 1; Loop <= glycol->NumCpTempPoints - 1; ++Loop) { Temperature = glycol->CpTemps(Loop); @@ -2315,7 +2310,7 @@ namespace FluidProperties { print(state.files.debug, ",{:.2R}\n", glycol->RhoTemps(glycol->NumRhoTempPoints) + incr); print(state.files.debug, "Density:"); Temperature = glycol->RhoTemps(1) - incr; - ReturnValue = GetDensityGlycol(state, glycol->Name, Temperature, GlycolIndex, routineName); + ReturnValue = glycol->getDensity(state, Temperature, routineName); print(state.files.debug, ",{:.3R}", ReturnValue); for (int Loop = 1; Loop <= glycol->NumRhoTempPoints - 1; ++Loop) { Temperature = glycol->RhoTemps(Loop); @@ -2423,7 +2418,7 @@ namespace FluidProperties { Real64 Temperature; // Temperature to drive values Real64 ReturnValue; // Values returned from refrigerant functions - auto const &df = state.dataFluidProps; + auto const &df = state.dataFluid; for (auto *refrig : df->refrigs) { // Lay out the basic values: @@ -2776,7 +2771,7 @@ namespace FluidProperties { if (!state.dataGlobal->WarmupFlag && ErrorFlag) { ++this->errors[(int)RefrigError::SatTemp].count; - auto &df = state.dataFluidProps; + auto const &df = state.dataFluid; // send warning if (this->errors[(int)RefrigError::SatTemp].count <= df->RefrigErrorLimitTest) { @@ -2801,7 +2796,7 @@ namespace FluidProperties { return ReturnValue; } - +#ifdef GET_OUT Real64 GetSatPressureRefrig(EnergyPlusData &state, std::string_view const refrigName, // carries in substance name Real64 const Temperature, // actual temperature given as input @@ -2810,7 +2805,7 @@ namespace FluidProperties { ) { // Wrapper for RefrigProps::getSatPressure() - auto &df = state.dataFluidProps; + auto &df = state.dataFluid; if (RefrigIndex == 0) { if ((RefrigIndex = GetRefrigNum(state, refrigName)) == 0) { @@ -2822,6 +2817,7 @@ namespace FluidProperties { return df->refrigs(RefrigIndex)->getSatPressure(state, Temperature, CalledFrom); } +#endif // GET_OUT //***************************************************************************** @@ -2871,7 +2867,7 @@ namespace FluidProperties { if (!state.dataGlobal->WarmupFlag && ErrorFlag) { ++this->errors[(int)RefrigError::SatPress].count; - auto &df = state.dataFluidProps; + auto const &df = state.dataFluid; // send warning if (this->errors[(int)RefrigError::SatPress].count <= df->RefrigErrorLimitTest) { @@ -2895,7 +2891,7 @@ namespace FluidProperties { } return ReturnValue; } - +#ifdef GET_OUT Real64 GetSatTemperatureRefrig(EnergyPlusData &state, std::string_view const refrigName, // carries in substance name Real64 const Pressure, // actual temperature given as input @@ -2904,7 +2900,7 @@ namespace FluidProperties { ) { // Wrapper for RefrigProps::getSatTemperature() - auto &df = state.dataFluidProps; + auto &df = state.dataFluid; if (RefrigIndex == 0) { if ((RefrigIndex = GetRefrigNum(state, refrigName)) == 0) { @@ -2916,6 +2912,7 @@ namespace FluidProperties { return df->refrigs(RefrigIndex)->getSatTemperature(state, Pressure, CalledFrom); } +#endif // GET_OUT //***************************************************************************** @@ -2945,6 +2942,7 @@ namespace FluidProperties { state, Temperature, this->HTemps, this->HfValues, this->HfgValues, Quality, CalledFrom, this->HfLowTempIndex, this->HfHighTempIndex); } +#ifdef GET_OUT Real64 GetSatEnthalpyRefrig(EnergyPlusData &state, std::string_view const refrigName, // carries in substance name Real64 const Temperature, // actual temperature given as input @@ -2954,7 +2952,7 @@ namespace FluidProperties { ) { // Wrapper for RefrigProps::getSatEnthalpy() - auto &df = state.dataFluidProps; + auto &df = state.dataFluid; if (RefrigIndex == 0) { if ((RefrigIndex = GetRefrigNum(state, refrigName)) == 0) { @@ -2965,6 +2963,7 @@ namespace FluidProperties { } return df->refrigs(RefrigIndex)->getSatEnthalpy(state, Temperature, Quality, CalledFrom); } +#endif // GET_OUT //***************************************************************************** @@ -3043,7 +3042,7 @@ namespace FluidProperties { if (!state.dataGlobal->WarmupFlag && ErrorFlag) { ++this->errors[(int)RefrigError::SatTempDensity].count; - auto &df = state.dataFluidProps; + auto const &df = state.dataFluid; // send warning if (this->errors[(int)RefrigError::SatTempDensity].count <= df->RefrigErrorLimitTest) { @@ -3067,7 +3066,7 @@ namespace FluidProperties { } return ReturnValue; } - +#ifdef GET_OUT Real64 GetSatDensityRefrig(EnergyPlusData &state, std::string_view const refrigName, // carries in substance name Real64 const Temperature, // actual temperature given as input @@ -3077,7 +3076,7 @@ namespace FluidProperties { ) { // Wrapper for RefrigProps::getSatDensity() - auto &df = state.dataFluidProps; + auto &df = state.dataFluid; if (RefrigIndex == 0) { if ((RefrigIndex = GetRefrigNum(state, refrigName)) == 0) { @@ -3089,7 +3088,7 @@ namespace FluidProperties { return df->refrigs(RefrigIndex)->getSatDensity(state, Temperature, Quality, CalledFrom); } - +#endif // GET_OUT //***************************************************************************** Real64 RefrigProps::getSatSpecificHeat(EnergyPlusData &state, @@ -3126,7 +3125,7 @@ namespace FluidProperties { return GetInterpolatedSatProp( state, Temperature, this->CpTemps, this->CpfValues, this->CpfgValues, Quality, CalledFrom, this->CpfLowTempIndex, this->CpfHighTempIndex); } - +#ifdef GET_OUT Real64 GetSatSpecificHeatRefrig(EnergyPlusData &state, std::string_view const refrigName, // carries in substance name Real64 const Temperature, // actual temperature given as input @@ -3137,7 +3136,7 @@ namespace FluidProperties { { // Wrapper for RefrigProps::getSpecificHeat() - auto &df = state.dataFluidProps; + auto &df = state.dataFluid; if (RefrigIndex == 0) { if ((RefrigIndex = GetRefrigNum(state, refrigName)) == 0) { @@ -3149,7 +3148,7 @@ namespace FluidProperties { return df->refrigs(RefrigIndex)->getSatSpecificHeat(state, Temperature, Quality, CalledFrom); } - +#endif // GET_OUT //***************************************************************************** Real64 RefrigProps::getSupHeatEnthalpy(EnergyPlusData &state, @@ -3187,7 +3186,7 @@ namespace FluidProperties { // FUNCTION PARAMETER DEFINITIONS: static constexpr std::string_view routineName = "RefrigProps::getSupHeatEnthalpy"; - auto &df = state.dataFluidProps; + auto &df = state.dataFluid; Real64 TempInterpRatio; Real64 PressInterpRatio; @@ -3343,7 +3342,7 @@ namespace FluidProperties { return ReturnValue; } - +#ifdef GET_OUT Real64 GetSupHeatEnthalpyRefrig(EnergyPlusData &state, std::string_view const refrigName, // carries in substance name Real64 const Temperature, // actual temperature given as input @@ -3353,7 +3352,7 @@ namespace FluidProperties { ) { // Wrapper for RefrigProps::getSupHeatEnthalpy() - auto &df = state.dataFluidProps; + auto &df = state.dataFluid; if (RefrigIndex == 0) { if ((RefrigIndex = GetRefrigNum(state, refrigName)) == 0) { @@ -3365,7 +3364,7 @@ namespace FluidProperties { return df->refrigs(RefrigIndex)->getSupHeatEnthalpy(state, Temperature, Pressure, CalledFrom); } - +#endif // GET_OUT //***************************************************************************** Real64 RefrigProps::getSupHeatPressure(EnergyPlusData &state, @@ -3540,7 +3539,7 @@ namespace FluidProperties { } if (ErrCount > 0 && !state.dataGlobal->WarmupFlag) { - auto &df = state.dataFluidProps; + auto const &df = state.dataFluid; // send near saturation warning if flagged this->errors[(int)RefrigError::SatSupPress].count += CurSatErrCount; @@ -3606,7 +3605,7 @@ namespace FluidProperties { return ReturnValue; } - +#ifdef GET_OUT Real64 GetSupHeatPressureRefrig(EnergyPlusData &state, std::string const &refrigName, // carries in substance name Real64 const Temperature, // actual temperature given as input @@ -3616,7 +3615,7 @@ namespace FluidProperties { ) { // Wrapper for RefrigProps::getSupHeatPressure() - auto &df = state.dataFluidProps; + auto &df = state.dataFluid; if (RefrigIndex == 0) { if ((RefrigIndex = GetRefrigNum(state, refrigName)) == 0) { @@ -3628,7 +3627,7 @@ namespace FluidProperties { return df->refrigs(RefrigIndex)->getSupHeatPressure(state, Temperature, Enthalpy, CalledFrom); } - +#endif // GET_OUT //***************************************************************************** Real64 RefrigProps::getSupHeatTemp(EnergyPlusData &state, @@ -3729,7 +3728,7 @@ namespace FluidProperties { return ReturnValue; } - +#ifdef GET_OUT Real64 GetSupHeatTempRefrig(EnergyPlusData &state, std::string_view const refrigName, // carries in substance name Real64 const Pressure, // actual pressure given as input @@ -3741,7 +3740,7 @@ namespace FluidProperties { ) { // Wrapper for RefrigProps::getSupHeatTemp() - auto &df = state.dataFluidProps; + auto &df = state.dataFluid; if (RefrigIndex == 0) { if ((RefrigIndex = GetRefrigNum(state, refrigName)) == 0) { @@ -3753,7 +3752,7 @@ namespace FluidProperties { return df->refrigs(RefrigIndex)->getSupHeatTemp(state, Pressure, Enthalpy, TempLow, TempUp, CalledFrom); } - +#endif // GET_OUT //***************************************************************************** Real64 RefrigProps::getSupHeatDensity(EnergyPlusData &state, @@ -3788,7 +3787,7 @@ namespace FluidProperties { // Return value Real64 ReturnValue; - auto &df = state.dataFluidProps; + auto &df = state.dataFluid; // FUNCTION PARAMETERS: static constexpr std::string_view routineName = "RefrigProps::getSupHeatDensity"; @@ -3951,7 +3950,7 @@ namespace FluidProperties { return ReturnValue; } - +#ifdef GET_OUT Real64 GetSupHeatDensityRefrig(EnergyPlusData &state, std::string_view const refrigName, // carries in substance name Real64 const Temperature, // actual temperature given as input @@ -3961,7 +3960,7 @@ namespace FluidProperties { ) { // Wrapper for RefrigProps::getSupHeatDensity() - auto &df = state.dataFluidProps; + auto &df = state.dataFluid; if (RefrigIndex == 0) { if ((RefrigIndex = GetRefrigNum(state, refrigName)) == 0) { ShowSevereError(state, format("Refrigerant \"{}\" not found, called from: {}", refrigName, CalledFrom)); @@ -3973,6 +3972,7 @@ namespace FluidProperties { return df->refrigs(RefrigIndex)->getSupHeatDensity(state, Temperature, Pressure, CalledFrom); } +#endif // GET_OUT //***************************************************************************** #ifdef EP_cache_GlycolSpecificHeat Real64 GlycolProps::getSpecificHeat(EnergyPlusData &state, @@ -3980,7 +3980,7 @@ namespace FluidProperties { std::string_view const CalledFrom // routine this function was called from (error messages) ) { - auto &df = state.dataFluidProps; + auto &df = state.dataFluid; std::uint64_t constexpr Grid_Shift = 64 - 12 - t_sh_precision_bits; double const t(Temperature + 1000 * this->Num); @@ -4000,6 +4000,7 @@ namespace FluidProperties { cTsh.sh = this->getSpecificHeat_raw(state, Temperature, CalledFrom); } + // print(state.files.eio, "SH,{},{},{}\n", this->Num, CalledFrom, cTsh.sh); return cTsh.sh; // saturation pressure {Pascals} } @@ -4036,7 +4037,7 @@ namespace FluidProperties { // FUNCTION PARAMETERS: static constexpr std::string_view routineName = "GlycolProps::getSpecificHeat"; - auto &df = state.dataFluidProps; + auto &df = state.dataFluid; // If user didn't input data (shouldn't get this far, but just in case...), we can't find a value assert(this->CpDataPresent); @@ -4108,7 +4109,7 @@ namespace FluidProperties { #endif // PERFORMANCE_OPT } } - +#ifdef GET_OUT Real64 GetSpecificHeatGlycol(EnergyPlusData &state, std::string_view const glycolName, // carries in substance name Real64 const Temperature, // actual temperature given as input @@ -4117,7 +4118,7 @@ namespace FluidProperties { ) { // Wrapper for GlycolProps::getSpecificHeat() - auto &df = state.dataFluidProps; + auto &df = state.dataFluid; if (GlycolIndex == 0) { if ((GlycolIndex = GetGlycolNum(state, glycolName)) == 0) { @@ -4129,6 +4130,7 @@ namespace FluidProperties { return df->glycols(GlycolIndex)->getSpecificHeat(state, Temperature, CalledFrom); } +#endif // GET_OUT //***************************************************************************** @@ -4162,7 +4164,7 @@ namespace FluidProperties { // FUNCTION PARAMETERS: static constexpr std::string_view routineName = "GlycolProps::getDensity"; - auto &df = state.dataFluidProps; + auto &df = state.dataFluid; // FUNCTION LOCAL VARIABLE DECLARATIONS: GlycolError error = GlycolError::Invalid; @@ -4233,9 +4235,10 @@ namespace FluidProperties { } } + // print(state.files.eio, "D,{},{},{}\n", this->Num, CalledFrom, Rho); return Rho; } - +#ifdef GET_OUT Real64 GetDensityGlycol(EnergyPlusData &state, std::string_view const glycolName, // carries in substance name Real64 const Temperature, // actual temperature given as input @@ -4244,7 +4247,7 @@ namespace FluidProperties { ) { // Wrapper for GlycolProps::getDensity() - auto &df = state.dataFluidProps; + auto &df = state.dataFluid; if (GlycolIndex == 0) { if ((GlycolIndex = GetGlycolNum(state, glycolName)) == 0) { @@ -4256,7 +4259,7 @@ namespace FluidProperties { return df->glycols(GlycolIndex)->getDensity(state, Temperature, CalledFrom); } - +#endif // GET_OUT //***************************************************************************** Real64 GlycolProps::getConductivity(EnergyPlusData &state, @@ -4292,7 +4295,7 @@ namespace FluidProperties { // FUNCTION LOCAL VARIABLE DECLARATIONS: GlycolError error = GlycolError::Invalid; - auto &df = state.dataFluidProps; + auto &df = state.dataFluid; // If user didn't input data (shouldn't get this far, but just in case...), we can't find a value if (!this->CondDataPresent) { @@ -4371,7 +4374,7 @@ namespace FluidProperties { return Cond; } // GlycolProps::getConductivity() - +#ifdef GET_OUT Real64 GetConductivityGlycol(EnergyPlusData &state, std::string_view const glycolName, // carries in substance name Real64 const Temperature, // actual temperature given as input @@ -4380,7 +4383,7 @@ namespace FluidProperties { ) { // Wrapper for GlycolProps::getConductivity() - auto &df = state.dataFluidProps; + auto &df = state.dataFluid; if (GlycolIndex == 0) { if ((GlycolIndex = GetGlycolNum(state, glycolName)) == 0) { @@ -4393,7 +4396,7 @@ namespace FluidProperties { // If user didn't input data (shouldn't get this far, but just in case...), we can't find a value return df->glycols(GlycolIndex)->getConductivity(state, Temperature, CalledFrom); } - +#endif // GET_OUT //***************************************************************************** Real64 GlycolProps::getViscosity(EnergyPlusData &state, @@ -4429,7 +4432,7 @@ namespace FluidProperties { // FUNCTION LOCAL VARIABLE DECLARATIONS: GlycolError error = GlycolError::Invalid; - auto &df = state.dataFluidProps; + auto &df = state.dataFluid; // If user didn't input data (shouldn't get this far, but just in case...), we can't find a value if (!this->ViscDataPresent) { @@ -4506,7 +4509,7 @@ namespace FluidProperties { return Visc; } // GlycolProps::getViscosity() - +#ifdef GET_OUT Real64 GetViscosityGlycol(EnergyPlusData &state, std::string_view const glycolName, // carries in substance name Real64 const Temperature, // actual temperature given as input @@ -4515,7 +4518,7 @@ namespace FluidProperties { ) { // Wrapper for GlycolProps::getViscosity() - auto &df = state.dataFluidProps; + auto &df = state.dataFluid; if (GlycolIndex == 0) { if ((GlycolIndex = GetGlycolNum(state, glycolName)) == 0) { @@ -4528,7 +4531,7 @@ namespace FluidProperties { // Now determine the value of specific heat using interpolation return df->glycols(GlycolIndex)->getViscosity(state, Temperature, CalledFrom); } - +#endif // GET_OUT //***************************************************************************** int GetRefrigNum(EnergyPlusData &state, std::string_view const refrigName) // carries in substance name @@ -4541,7 +4544,7 @@ namespace FluidProperties { // PURPOSE OF THIS FUNCTION: // This function simply determines the index of the refrigerant named // in the input variable to this routine within the derived type. - auto &df = state.dataFluidProps; + auto &df = state.dataFluid; auto found = std::find_if(df->refrigs.begin(), df->refrigs.end(), [refrigName](RefrigProps const *refrig) { return refrig->Name == refrigName; }); @@ -4555,11 +4558,17 @@ namespace FluidProperties { RefrigProps *GetRefrig(EnergyPlusData &state, std::string_view const refrigName) { - auto &df = state.dataFluidProps; + auto &df = state.dataFluid; int refrigNum = GetRefrigNum(state, refrigName); return (refrigNum > 0) ? df->refrigs(refrigNum) : nullptr; } + RefrigProps *GetSteam(EnergyPlusData &state) + { + assert(state.dataFluid->refrigs.isize() >= RefrigNum_Steam); + return state.dataFluid->refrigs(RefrigNum_Steam); + } + //***************************************************************************** int GetGlycolNum(EnergyPlusData &state, std::string_view const glycolName) // carries in substance name @@ -4572,7 +4581,7 @@ namespace FluidProperties { // PURPOSE OF THIS FUNCTION: // This function simply determines the index of the glycol named // in the input variable to this routine within the derived type. - auto &df = state.dataFluidProps; + auto &df = state.dataFluid; auto found = std::find_if(df->glycols.begin(), df->glycols.end(), [glycolName](GlycolProps const *glycol) { return glycol->Name == glycolName; }); @@ -4586,14 +4595,20 @@ namespace FluidProperties { GlycolProps *GetGlycol(EnergyPlusData &state, std::string_view const glycolName) { - auto &df = state.dataFluidProps; + auto &df = state.dataFluid; int glycolNum = GetGlycolNum(state, glycolName); return (glycolNum > 0) ? df->glycols(glycolNum) : nullptr; } + GlycolProps *GetWater(EnergyPlusData &state) + { + assert(state.dataFluid->glycols.isize() >= GlycolNum_Water); + return state.dataFluid->glycols(GlycolNum_Water); + } + int GetGlycolRawNum(EnergyPlusData &state, std::string_view const glycolRawName) // carries in substance name { - auto const &df = state.dataFluidProps; + auto const &df = state.dataFluid; auto found = std::find_if(df->glycolsRaw.begin(), df->glycolsRaw.end(), [glycolRawName](GlycolRawProps const *glycolRaw) { return glycolRaw->Name == glycolRawName; @@ -4607,7 +4622,7 @@ namespace FluidProperties { GlycolRawProps *GetGlycolRaw(EnergyPlusData &state, std::string_view const glycolRawName) { - auto &df = state.dataFluidProps; + auto &df = state.dataFluid; int glycolRawNum = GetGlycolRawNum(state, glycolRawName); return (glycolRawNum > 0) ? df->glycolsRaw(glycolRawNum) : nullptr; } @@ -4635,7 +4650,7 @@ namespace FluidProperties { // Check to see if this glycol shows up in the glycol data // ArrayLength = SIZE(GlycolData) - auto &df = state.dataFluidProps; + auto &df = state.dataFluid; if (Idx > 0 && Idx <= df->glycols.isize()) { return df->glycols(Idx)->Name; } else { // return blank - error checking in calling proceedure @@ -4809,7 +4824,7 @@ namespace FluidProperties { } if (ErrorFlag && (CalledFrom != "ReportAndTestRefrigerants")) { - auto &df = state.dataFluidProps; + auto &df = state.dataFluid; ++df->TempRangeErrCountGetInterpolatedSatProp; // send warning @@ -4832,27 +4847,6 @@ namespace FluidProperties { //***************************************************************************** - bool CheckFluidPropertyName(EnergyPlusData const &state, - std::string const &name) // Name from input(?) to be checked against valid FluidPropertyNames - { - - // FUNCTION INFORMATION: - // AUTHOR Linda K. Lawrie - // DATE WRITTEN October 2002 - - // PURPOSE OF THIS FUNCTION: - // This function checks on an input fluid property to make sure it is valid. - auto const &df = state.dataFluidProps; - - auto foundRefrig = std::find_if(df->refrigs.begin(), df->refrigs.end(), [name](RefrigProps const *refrig) { return refrig->Name == name; }); - if (foundRefrig != df->refrigs.end()) return true; - - auto foundGlycol = std::find_if(df->glycols.begin(), df->glycols.end(), [name](GlycolProps const *glycol) { return glycol->Name == name; }); - if (foundGlycol != df->glycols.end()) return true; - - return false; - } - void ReportOrphanFluids(EnergyPlusData &state) { @@ -4867,7 +4861,7 @@ namespace FluidProperties { bool NeedOrphanMessage = true; int NumUnusedRefrig = 0; - auto const &df = state.dataFluidProps; + auto const &df = state.dataFluid; for (auto const *refrig : df->refrigs) { if (refrig->used) continue; @@ -4910,90 +4904,16 @@ namespace FluidProperties { } } - void GetFluidDensityTemperatureLimits(EnergyPlusData &state, int const FluidIndex, Real64 &MinTempLimit, Real64 &MaxTempLimit) - { - if (FluidIndex > 0) { - auto const &df = state.dataFluidProps->glycols(FluidIndex); - MinTempLimit = df->RhoLowTempValue; - MaxTempLimit = df->RhoHighTempValue; - } - } - - void GetFluidSpecificHeatTemperatureLimits(EnergyPlusData &state, int const FluidIndex, Real64 &MinTempLimit, Real64 &MaxTempLimit) - { - if (FluidIndex > 0) { - auto const &df = state.dataFluidProps->glycols(FluidIndex); - MinTempLimit = df->CpLowTempValue; - MaxTempLimit = df->CpHighTempValue; - } - } - - GlycolAPI::GlycolAPI(EnergyPlusData &state, std::string const &glycolName) - { - this->glycolName = EnergyPlus::Util::makeUPPER(glycolName); - this->glycolIndex = 0; - this->cf = "GlycolAPI:Instance"; - if (this->glycolName != "WATER") { - EnergyPlus::ShowFatalError(state, "Can only do water right now"); - } - } - Real64 GlycolAPI::specificHeat(EnergyPlusData &state, Real64 temperature) + void GlycolProps::getDensityTemperatureLimits(EnergyPlusData &state, Real64 &MinTempLimit, Real64 &MaxTempLimit) { - return FluidProperties::GetSpecificHeatGlycol(state, this->glycolName, temperature, this->glycolIndex, this->cf); - } - Real64 GlycolAPI::density(EnergyPlusData &state, Real64 temperature) - { - return FluidProperties::GetDensityGlycol(state, this->glycolName, temperature, this->glycolIndex, this->cf); - } - Real64 GlycolAPI::conductivity(EnergyPlusData &state, Real64 temperature) - { - return FluidProperties::GetConductivityGlycol(state, this->glycolName, temperature, this->glycolIndex, this->cf); - } - Real64 GlycolAPI::viscosity(EnergyPlusData &state, Real64 temperature) - { - return FluidProperties::GetViscosityGlycol(state, this->glycolName, temperature, this->glycolIndex, this->cf); + MinTempLimit = this->RhoLowTempValue; + MaxTempLimit = this->RhoHighTempValue; } - RefrigerantAPI::RefrigerantAPI(EnergyPlusData &state, std::string const &refrigName) - { - this->rName = EnergyPlus::Util::makeUPPER(refrigName); - this->rIndex = 0; - this->cf = "RefrigerantAPI:Instance"; - if (this->rName != "STEAM") { - EnergyPlus::ShowFatalError(state, "Can only do steam right now"); - } - } - Real64 RefrigerantAPI::saturationPressure(EnergyPlusData &state, Real64 temperature) - { - return FluidProperties::GetSatPressureRefrig(state, this->rName, temperature, this->rIndex, this->cf); - } - Real64 RefrigerantAPI::saturationTemperature(EnergyPlusData &state, Real64 pressure) - { - return FluidProperties::GetSatTemperatureRefrig(state, this->rName, pressure, this->rIndex, this->cf); - } - Real64 RefrigerantAPI::saturatedEnthalpy(EnergyPlusData &state, Real64 temperature, Real64 quality) - { - return FluidProperties::GetSatEnthalpyRefrig(state, this->rName, temperature, quality, this->rIndex, this->cf); - } - Real64 RefrigerantAPI::saturatedDensity(EnergyPlusData &state, Real64 temperature, Real64 quality) - { - return FluidProperties::GetSatDensityRefrig(state, this->rName, temperature, quality, this->rIndex, this->cf); - } - Real64 RefrigerantAPI::saturatedSpecificHeat(EnergyPlusData &state, Real64 temperature, Real64 quality) - { - return FluidProperties::GetSatSpecificHeatRefrig(state, this->rName, temperature, quality, this->rIndex, this->cf); - } - Real64 RefrigerantAPI::superHeatedEnthalpy(EnergyPlusData &state, Real64 temperature, Real64 pressure) - { - return FluidProperties::GetSupHeatEnthalpyRefrig(state, this->rName, temperature, pressure, this->rIndex, this->cf); - } - Real64 RefrigerantAPI::superHeatedPressure(EnergyPlusData &state, Real64 temperature, Real64 enthalpy) - { - return FluidProperties::GetSupHeatPressureRefrig(state, this->rName, temperature, enthalpy, this->rIndex, this->cf); - } - Real64 RefrigerantAPI::superHeatedDensity(EnergyPlusData &state, Real64 temperature, Real64 pressure) + void GlycolProps::getSpecificHeatTemperatureLimits(EnergyPlusData &state, Real64 &MinTempLimit, Real64 &MaxTempLimit) { - return FluidProperties::GetSupHeatDensityRefrig(state, this->rName, temperature, pressure, this->rIndex, this->cf); + MinTempLimit = this->CpLowTempValue; + MaxTempLimit = this->CpHighTempValue; } #ifdef UNUSED_FLUID_PROPS @@ -6953,6 +6873,6 @@ namespace FluidProperties { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.542e-05, 270.9, 177.8}}}; #endif // UNUSED_FLUID_PROPS -} // namespace FluidProperties +} // namespace Fluid } // namespace EnergyPlus diff --git a/src/EnergyPlus/FluidProperties.hh b/src/EnergyPlus/FluidProperties.hh index 2fd4cf1aeb8..7f05d150a84 100644 --- a/src/EnergyPlus/FluidProperties.hh +++ b/src/EnergyPlus/FluidProperties.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -67,7 +67,10 @@ namespace EnergyPlus { // Forward declarations struct EnergyPlusData; -namespace FluidProperties { +namespace Fluid { + + constexpr int GlycolNum_Water = 1; + constexpr int RefrigNum_Steam = 1; #undef PERFORMANCE_OPT @@ -229,6 +232,8 @@ namespace FluidProperties { Real64 Temperature, // actual temperature given as input Real64 Pressure, // actual pressure given as input std::string_view CalledFrom); // routine this function was called from (error messages) + + void setTempLimits(EnergyPlusData &state, bool &ErrorsFound); }; enum class GlycolError @@ -372,22 +377,25 @@ namespace FluidProperties { Real64 getViscosity(EnergyPlusData &state, Real64 Temperature, // actual temperature given as input std::string_view CalledFrom); // routine this function was called from (error messages) + + void setTempLimits(EnergyPlusData &state, bool &ErrorsFound); + + void getDensityTemperatureLimits(EnergyPlusData &state, Real64 &MinTempLimit, Real64 &MaxTempLimit); + + void getSpecificHeatTemperatureLimits(EnergyPlusData &state, Real64 &MinTempLimit, Real64 &MaxTempLimit); }; struct cached_tsh { // Members - std::uint64_t iT; - Real64 sh; - - // Default Constructor - cached_tsh() : iT(1000), sh(0.0) - { - } + std::uint64_t iT = 1000; + Real64 sh = 0.0; }; void GetFluidPropertiesData(EnergyPlusData &state); + void InitConstantFluidPropertiesData(EnergyPlusData &state); + template void InterpDefValuesForGlycolConc( EnergyPlusData &state, @@ -406,14 +414,10 @@ namespace FluidProperties { Array1D &InterpData // interpolated output data at proper concentration ); - void InitializeGlycolTempLimits(EnergyPlusData &state, bool &ErrorsFound); // set to true if errors found here - - void InitializeRefrigerantLimits(EnergyPlusData &state, bool &ErrorsFound); // set to true if errors found here - void ReportAndTestGlycols(EnergyPlusData &state); void ReportAndTestRefrigerants(EnergyPlusData &state); - +#ifdef GET_OUT Real64 GetQualityRefrig(EnergyPlusData &state, std::string const &Refrigerant, // carries in substance name Real64 Temperature, // actual temperature given as input @@ -521,6 +525,7 @@ namespace FluidProperties { int &GlycolIndex, // Index to Glycol Properties std::string_view CalledFrom // routine this function was called from (error messages) ); +#endif // GET_OUT inline Real64 GetInterpValue(Real64 const Tact, // actual temperature at which we want the property of interest Real64 const Tlo, // temperature below Tact for which we have property data @@ -534,12 +539,14 @@ namespace FluidProperties { int GetRefrigNum(EnergyPlusData &state, std::string_view name); RefrigProps *GetRefrig(EnergyPlusData &state, std::string_view name); + RefrigProps *GetSteam(EnergyPlusData &state); int GetGlycolRawNum(EnergyPlusData &state, std::string_view name); GlycolRawProps *GetGlycolRaw(EnergyPlusData &state, std::string_view name); int GetGlycolNum(EnergyPlusData &state, std::string_view name); GlycolProps *GetGlycol(EnergyPlusData &state, std::string_view name); + GlycolProps *GetWater(EnergyPlusData &state); std::string GetGlycolNameByIndex(EnergyPlusData &state, int Idx); // carries in substance index @@ -564,46 +571,8 @@ namespace FluidProperties { int UpperBound // Valid values upper bound (set by calling program) ); - bool CheckFluidPropertyName(EnergyPlusData const &state, - std::string const &NameToCheck); // Name from input(?) to be checked against valid FluidPropertyNames - void ReportOrphanFluids(EnergyPlusData &state); - - void GetFluidDensityTemperatureLimits(EnergyPlusData &state, int FluidIndex, Real64 &MinTempLimit, Real64 &MaxTempLimit); - - void GetFluidSpecificHeatTemperatureLimits(EnergyPlusData &state, int FluidIndex, Real64 &MinTempLimit, Real64 &MaxTempLimit); - - struct GlycolAPI - { - std::string glycolName; - int glycolIndex; - std::string cf; - explicit GlycolAPI(EnergyPlusData &state, std::string const &glycolName); - ~GlycolAPI() = default; - Real64 specificHeat(EnergyPlusData &state, Real64 temperature); - Real64 density(EnergyPlusData &state, Real64 temperature); - Real64 conductivity(EnergyPlusData &state, Real64 temperature); - Real64 viscosity(EnergyPlusData &state, Real64 temperature); - }; - - struct RefrigerantAPI - { - std::string rName; - int rIndex; - std::string cf; - explicit RefrigerantAPI(EnergyPlusData &state, std::string const &refrigName); - ~RefrigerantAPI() = default; - Real64 saturationPressure(EnergyPlusData &state, Real64 temperature); - Real64 saturationTemperature(EnergyPlusData &state, Real64 pressure); - Real64 saturatedEnthalpy(EnergyPlusData &state, Real64 temperature, Real64 quality); - Real64 saturatedDensity(EnergyPlusData &state, Real64 temperature, Real64 quality); - Real64 saturatedSpecificHeat(EnergyPlusData &state, Real64 temperature, Real64 quality); - Real64 superHeatedEnthalpy(EnergyPlusData &state, Real64 temperature, Real64 pressure); - Real64 superHeatedPressure(EnergyPlusData &state, Real64 temperature, Real64 enthalpy); - Real64 superHeatedDensity(EnergyPlusData &state, Real64 temperature, Real64 pressure); - }; - -} // namespace FluidProperties +} // namespace Fluid struct FluidData : BaseGlobalStruct { @@ -612,11 +581,11 @@ struct FluidData : BaseGlobalStruct int GlycolErrorLimitTest = 1; // how many times error is printed with details before recurring called int RefrigErrorLimitTest = 1; // how many times error is printed with details before recurring called - Array1D refrigs; - Array1D glycolsRaw; - Array1D glycols; + Array1D refrigs; + Array1D glycolsRaw; + Array1D glycols; - std::array glycolErrorLimits = {0, 0, 0, 0, 0, 0, 0, 0}; + std::array glycolErrorLimits = {0, 0, 0, 0, 0, 0, 0, 0}; int SatErrCountGetSupHeatEnthalpyRefrig = 0; int SatErrCountGetSupHeatDensityRefrig = 0; @@ -626,19 +595,27 @@ struct FluidData : BaseGlobalStruct int TempRangeErrIndexGetInterpolatedSatProp = 0; #ifdef EP_cache_GlycolSpecificHeat - std::array cached_t_sh; + std::array cached_t_sh; #endif + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + Fluid::InitConstantFluidPropertiesData(state); + } + void init_state(EnergyPlusData &state) override { - FluidProperties::GetFluidPropertiesData(state); + Fluid::GetFluidPropertiesData(state); } void clear_state() override { - for (int i = 1; i <= refrigs.isize(); ++i) + for (int i = 1; i <= refrigs.isize(); ++i) { + refrigs(i)->HshValues.deallocate(); + refrigs(i)->RhoshValues.deallocate(); delete refrigs(i); + } for (int i = 1; i <= glycolsRaw.isize(); ++i) delete glycolsRaw(i); for (int i = 1; i <= glycols.isize(); ++i) diff --git a/src/EnergyPlus/FromChars.hh b/src/EnergyPlus/FromChars.hh index 67946dde35f..1235d8dd788 100644 --- a/src/EnergyPlus/FromChars.hh +++ b/src/EnergyPlus/FromChars.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -49,7 +49,7 @@ #define FromChars_hh_INCLUDED #if __has_include() -#include +# include #endif #include #include diff --git a/src/EnergyPlus/FuelCellElectricGenerator.cc b/src/EnergyPlus/FuelCellElectricGenerator.cc index c2a50442c7f..1939aa095a5 100644 --- a/src/EnergyPlus/FuelCellElectricGenerator.cc +++ b/src/EnergyPlus/FuelCellElectricGenerator.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -168,6 +168,7 @@ namespace FuelCellElectricGenerator { // METHODOLOGY EMPLOYED: // EnergyPlus input processor + static constexpr std::string_view routineName = "getFuelCellInput"; int NumAlphas; // Number of elements in the alpha array int NumNums; // Number of elements in the numeric array @@ -272,12 +273,12 @@ namespace FuelCellElectricGenerator { state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.UpTranLimit = NumArray(8); state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.DownTranLimit = NumArray(9); state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.StartUpTime = - NumArray(10) / Constant::SecInHour; // convert to hours from seconds + NumArray(10) / Constant::rSecsInHour; // convert to hours from seconds state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.StartUpFuel = NumArray(11); state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.StartUpElectConsum = NumArray(12); state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.StartUpElectProd = NumArray(13); state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.ShutDownTime = - NumArray(14) / Constant::SecInHour; // convert to hours from seconds + NumArray(14) / Constant::rSecsInHour; // convert to hours from seconds state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.ShutDownFuel = NumArray(15); state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.ShutDownElectConsum = NumArray(16); state.dataFuelCellElectGen->FuelCell(thisFuelCell).FCPM.ANC0 = NumArray(17); @@ -608,6 +609,7 @@ namespace FuelCellElectricGenerator { state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + ErrorObjectHeader eoh{routineName, state.dataIPShortCut->cCurrentModuleObject, AlphArray(1)}; int thisFuelCell = Util::FindItemInList(AlphArray(1), state.dataFuelCellElectGen->FuelCell, &FCDataStruct::NameFCWaterSup); if (thisFuelCell > 0) { @@ -674,13 +676,11 @@ namespace FuelCellElectricGenerator { ErrorsFound = true; } - state.dataFuelCellElectGen->FuelCell(thisFuelCell).WaterSup.SchedNum = ScheduleManager::GetScheduleIndex(state, AlphArray(6)); - if ((state.dataFuelCellElectGen->FuelCell(thisFuelCell).WaterSup.SchedNum == 0) && + state.dataFuelCellElectGen->FuelCell(thisFuelCell).WaterSup.sched = Sched::GetSchedule(state, AlphArray(6)); + if ((state.dataFuelCellElectGen->FuelCell(thisFuelCell).WaterSup.sched == nullptr) && (state.dataFuelCellElectGen->FuelCell(thisFuelCell).WaterSup.WaterTempMode == DataGenerators::WaterTemperatureMode::WaterInReformSchedule)) { - ShowSevereError(state, format("Invalid, {} = {}", state.dataIPShortCut->cAlphaFieldNames(6), AlphArray(6))); - ShowContinueError(state, format("Entered in {}={}", state.dataIPShortCut->cCurrentModuleObject, AlphArray(1))); - ShowContinueError(state, "Schedule was not found"); + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(6), AlphArray(6)); ErrorsFound = true; } @@ -1223,7 +1223,7 @@ namespace FuelCellElectricGenerator { SetupOutputVariable(state, "Generator Power Module Entering Air Enthalpy", Constant::Units::W, - this->Report.TotAirInEnthalphy, + this->Report.TotAirInEnthalpy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, this->Name); @@ -1606,7 +1606,7 @@ namespace FuelCellElectricGenerator { double(state.dataGlobal->DayOfSim) + (int(state.dataGlobal->CurrentTime) + (state.dataHVACGlobal->SysTimeElapsed + (state.dataGlobal->CurrentTime - int(state.dataGlobal->CurrentTime)))) / - Constant::HoursInDay; + Constant::rHoursInDay; this->FCPM.HasBeenOn = false; if (this->FCPM.ShutDownTime > 0.0) this->FCPM.DuringShutDown = true; @@ -1627,7 +1627,7 @@ namespace FuelCellElectricGenerator { double(state.dataGlobal->DayOfSim) + (int(state.dataGlobal->CurrentTime) + (state.dataHVACGlobal->SysTimeElapsed + (state.dataGlobal->CurrentTime - int(state.dataGlobal->CurrentTime)))) / - Constant::HoursInDay; + Constant::rHoursInDay; this->FCPM.HasBeenOn = true; ++this->FCPM.NumCycles; // increment cycling counter @@ -1761,7 +1761,7 @@ namespace FuelCellElectricGenerator { } else if (state.dataGenerator->FuelSupply(this->FuelSupNum).FuelTempMode == DataGenerators::FuelTemperatureMode::FuelInTempSchedule) { state.dataGenerator->FuelSupply(this->FuelSupNum).TfuelIntoCompress = - ScheduleManager::GetCurrentScheduleValue(state, state.dataGenerator->FuelSupply(this->FuelSupNum).SchedNum); + state.dataGenerator->FuelSupply(this->FuelSupNum).sched->getCurrentVal(); } // evaluate heat capacity at average temperature using shomate @@ -1804,7 +1804,7 @@ namespace FuelCellElectricGenerator { // units, NdotFuel in kmol/sec. Hmolfule in KJ/mol , // factor of 1000's to get to J/s or watts - this->FCPM.TotFuelInEnthalphy = Hmolfuel * 1000.0 * this->FCPM.NdotFuel * 1000.0; + this->FCPM.TotFuelInEnthalpy = Hmolfuel * 1000.0 * this->FCPM.NdotFuel * 1000.0; // Calculation Step 6, water compressor calculations @@ -1823,7 +1823,7 @@ namespace FuelCellElectricGenerator { this->WaterSup.TwaterIntoCompress = state.dataLoopNodes->Node(this->WaterSup.NodeNum).Temp; } break; case DataGenerators::WaterTemperatureMode::WaterInReformSchedule: { - this->WaterSup.TwaterIntoCompress = ScheduleManager::GetCurrentScheduleValue(state, this->WaterSup.SchedNum); + this->WaterSup.TwaterIntoCompress = this->WaterSup.sched->getCurrentVal(); } break; default: break; @@ -1921,7 +1921,7 @@ namespace FuelCellElectricGenerator { // units, NdotAir in kmol/sec.; Hmolfuel in KJ/mol , // factor of 1000's to get to J/s or watts - this->FCPM.TotAirInEnthalphy = Hmolair * 1000.0 * this->FCPM.NdotAir * 1000.0; + this->FCPM.TotAirInEnthalpy = Hmolair * 1000.0 * this->FCPM.NdotAir * 1000.0; // calculation Step 8, Figure Product Gases @@ -2001,7 +2001,7 @@ namespace FuelCellElectricGenerator { // all the oxygen in the excess air stream this->FCPM.ConstitMolalFract(3) = Ndot02 / this->FCPM.NdotProdGas; - // all the H2O comming in plus the new H2O from reactions and the H2O from water used in reforming + // all the H2O coming in plus the new H2O from reactions and the H2O from water used in reforming this->FCPM.ConstitMolalFract(4) = NdotH2O / this->FCPM.NdotProdGas; // all the argon coming in. @@ -2013,9 +2013,9 @@ namespace FuelCellElectricGenerator { // units, NdotProdGas in kmol/sec.; HmolProdGases in KJ/mol , // factor of 1000's to get to J/s or watts - this->FCPM.TotProdGasEnthalphy = HmolProdGases * 1000.0 * this->FCPM.NdotProdGas * 1000.0; + this->FCPM.TotProdGasEnthalpy = HmolProdGases * 1000.0 * this->FCPM.NdotProdGas * 1000.0; - // calculation Step 9, Figure Skin lossess + // calculation Step 9, Figure Skin losses if (this->FCPM.SkinLossMode == DataGenerators::SkinLoss::ConstantRate) { // do nothing just use QdotSkin @@ -2054,15 +2054,15 @@ namespace FuelCellElectricGenerator { // calculation Step 13, Calculate Heat balance // move all terms in Equation 7 to RHS and calculate imbalance - Real64 MagofImbalance = -this->FCPM.TotFuelInEnthalphy - this->FCPM.TotAirInEnthalphy - this->FCPM.WaterInEnthalpy - + Real64 MagofImbalance = -this->FCPM.TotFuelInEnthalpy - this->FCPM.TotAirInEnthalpy - this->FCPM.WaterInEnthalpy - this->FCPM.DilutionAirInEnthalpy - this->FCPM.NdotFuel * state.dataGenerator->FuelSupply(this->FuelSupNum).LHV * 1000000.0 - - this->FCPM.PelancillariesAC + this->FCPM.Pel + this->FCPM.TotProdGasEnthalphy + this->FCPM.WaterOutEnthalpy + + this->FCPM.PelancillariesAC + this->FCPM.Pel + this->FCPM.TotProdGasEnthalpy + this->FCPM.WaterOutEnthalpy + this->FCPM.QdotStackCool + this->FCPM.QdotSkin + this->FCPM.DilutionAirOutEnthalpy; - // Now find a new total prod Gas Enthalphy that would result in an energy balance + // Now find a new total prod Gas Enthalpy that would result in an energy balance // TODO check signs... - Real64 tmpTotProdGasEnthalpy = this->FCPM.TotProdGasEnthalphy - MagofImbalance; + Real64 tmpTotProdGasEnthalpy = this->FCPM.TotProdGasEnthalpy - MagofImbalance; // solve for a new TprodGasLeavingFCPM using regula falsi method @@ -2339,7 +2339,7 @@ namespace FuelCellElectricGenerator { // loop through fuel constituents and sum up Cp - // two different themodynamic curve fits might be used + // two different thermodynamic curve fits might be used Real64 tempCp = 0.0; @@ -2905,18 +2905,18 @@ namespace FuelCellElectricGenerator { // AUTHOR Brent Griffith // DATE WRITTEN Aug 2005 - Real64 PelInput = Pel; // hold initial value of inout var + Real64 PelInput = Pel; // hold initial value of input var Real64 CurrentFractionalDay = double(state.dataGlobal->DayOfSim) + (int(state.dataGlobal->CurrentTime) + (state.dataHVACGlobal->SysTimeElapsed + (state.dataGlobal->CurrentTime - int(state.dataGlobal->CurrentTime)))) / - Constant::HoursInDay; + Constant::rHoursInDay; // Check if in start up and if it still should be if (this->FCPM.DuringStartUp) { // calculate time for end of start up period - Real64 EndingFractionalDay = this->FCPM.FractionalDayofLastStartUp + this->FCPM.StartUpTime / Constant::HoursInDay; + Real64 EndingFractionalDay = this->FCPM.FractionalDayofLastStartUp + this->FCPM.StartUpTime / Constant::rHoursInDay; if (CurrentFractionalDay > EndingFractionalDay) { // start up period is now over @@ -2928,7 +2928,7 @@ namespace FuelCellElectricGenerator { if (this->FCPM.DuringShutDown) { // calculate time for end of shut down period - Real64 EndingFractionalDay = this->FCPM.FractionalDayofLastShutDown + this->FCPM.ShutDownTime / Constant::HoursInDay; + Real64 EndingFractionalDay = this->FCPM.FractionalDayofLastShutDown + this->FCPM.ShutDownTime / Constant::rHoursInDay; if (CurrentFractionalDay > EndingFractionalDay) { // start up period is now over @@ -3032,11 +3032,7 @@ namespace FuelCellElectricGenerator { this->ExhaustHX.THXexh = TprodGasIn - this->ExhaustHX.qHX / (NdotGas * CpProdGasMol * 1000.0); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - TwaterIn, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getSpecificHeat(state, TwaterIn, RoutineName); if (this->ExhaustHX.WaterMassFlowRate * Cp <= 0.0) { this->ExhaustHX.WaterOutletTemp = TwaterIn; @@ -3068,7 +3064,7 @@ namespace FuelCellElectricGenerator { this->ExhaustHX.THXexh = ((1.0 - NdotCpAuxMix / NdotCpWater) / (std::exp(UAeff * (1.0 / NdotCpAuxMix - 1.0 / NdotCpWater)) - NdotCpAuxMix / NdotCpWater)) * TauxMix + - ((std::exp(UAeff * (1.0 / NdotCpAuxMix - 1.0 / NdotCpWater)) - 1.0) / + (std::expm1(UAeff * (1.0 / NdotCpAuxMix - 1.0 / NdotCpWater)) / (std::exp(UAeff * (1.0 / NdotCpAuxMix - 1.0 / NdotCpWater)) - NdotCpAuxMix / NdotCpWater)) * TwaterIn; @@ -3113,7 +3109,7 @@ namespace FuelCellElectricGenerator { this->ExhaustHX.THXexh = ((1.0 - NdotCpAuxMix / NdotCpWater) / (std::exp(UAeff * (1.0 / NdotCpAuxMix - 1.0 / NdotCpWater)) - NdotCpAuxMix / NdotCpWater)) * TauxMix + - ((std::exp(UAeff * (1.0 / NdotCpAuxMix - 1.0 / NdotCpWater)) - 1.0) / + (std::expm1(UAeff * (1.0 / NdotCpAuxMix - 1.0 / NdotCpWater)) / (std::exp(UAeff * (1.0 / NdotCpAuxMix - 1.0 / NdotCpWater)) - NdotCpAuxMix / NdotCpWater)) * TwaterIn; @@ -3174,7 +3170,7 @@ namespace FuelCellElectricGenerator { this->ExhaustHX.THXexh = ((1.0 - NdotCpAuxMix / NdotCpWater) / (std::exp(UAeff * (1.0 / NdotCpAuxMix - 1.0 / NdotCpWater)) - NdotCpAuxMix / NdotCpWater)) * TauxMix + - ((std::exp(UAeff * (1.0 / NdotCpAuxMix - 1.0 / NdotCpWater)) - 1.0) / + (std::expm1(UAeff * (1.0 / NdotCpAuxMix - 1.0 / NdotCpWater)) / (std::exp(UAeff * (1.0 / NdotCpAuxMix - 1.0 / NdotCpWater)) - NdotCpAuxMix / NdotCpWater)) * TwaterIn; @@ -3330,12 +3326,12 @@ namespace FuelCellElectricGenerator { this->FCPM.Eel = 0.0; this->FCPM.PelancillariesAC = 0.0; this->FCPM.NdotFuel = 0.0; - this->FCPM.TotFuelInEnthalphy = 0.0; + this->FCPM.TotFuelInEnthalpy = 0.0; this->FCPM.NdotProdGas = 0.0; this->FCPM.TprodGasLeavingFCPM = 0.0; - this->FCPM.TotProdGasEnthalphy = 0.0; + this->FCPM.TotProdGasEnthalpy = 0.0; this->FCPM.NdotAir = 0.0; - this->FCPM.TotAirInEnthalphy = 0.0; + this->FCPM.TotAirInEnthalpy = 0.0; this->FCPM.NdotLiqwater = 0.0; this->FCPM.TwaterInlet = 0.0; this->FCPM.WaterInEnthalpy = 0.0; @@ -3368,11 +3364,7 @@ namespace FuelCellElectricGenerator { this->Inverter.PCUlosses = 0.0; this->Inverter.QairIntake = 0.0; - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - DataGenerators::InitHRTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, DataGenerators::InitHRTemp, RoutineName); this->ExhaustHX.WaterMassFlowRateDesign = this->ExhaustHX.WaterVolumeFlowMax * rho; this->ExhaustHX.WaterMassFlowRate = this->ExhaustHX.WaterMassFlowRateDesign; @@ -3405,7 +3397,7 @@ namespace FuelCellElectricGenerator { this->ElecStorage.LastTimeStepStateOfCharge = this->ElecStorage.ThisTimeStepStateOfCharge; this->FCPM.PelLastTimeStep = this->FCPM.Pel; - // intialize flow rate in water loop, this is "requesting" flow + // initialize flow rate in water loop, this is "requesting" flow Real64 mdot = this->ExhaustHX.WaterMassFlowRateDesign; PlantUtilities::SetComponentFlowRate(state, mdot, this->ExhaustHX.WaterInNode, this->ExhaustHX.WaterOutNode, this->CWPlantLoc); @@ -3548,7 +3540,7 @@ namespace FuelCellElectricGenerator { this->Report.TairInlet = this->AirSup.TairIntoBlower; // State point 1 this->Report.TairIntoFCPM = this->AirSup.TairIntoFCPM; // State point 4 this->Report.NdotAir = this->FCPM.NdotAir; // air flow in kmol/sec - this->Report.TotAirInEnthalphy = this->FCPM.TotAirInEnthalphy; // State point 4 + this->Report.TotAirInEnthalpy = this->FCPM.TotAirInEnthalpy; // State point 4 this->Report.BlowerPower = this->AirSup.PairCompEl; // electrical power used by air supply blower this->Report.BlowerEnergy = this->AirSup.PairCompEl * state.dataHVACGlobal->TimeStepSysSec; // electrical energy this->Report.BlowerSkinLoss = this->AirSup.QskinLoss; // heat rate of losses by blower @@ -3556,11 +3548,11 @@ namespace FuelCellElectricGenerator { this->Report.TfuelInlet = state.dataGenerator->FuelSupply(this->FuelSupNum).TfuelIntoCompress; // State point 2 this->Report.TfuelIntoFCPM = state.dataGenerator->FuelSupply(this->FuelSupNum).TfuelIntoFCPM; // TEmperature state point 5 [C] this->Report.NdotFuel = this->FCPM.NdotFuel; // fuel flow in kmol/sec - this->Report.TotFuelInEnthalpy = this->FCPM.TotFuelInEnthalphy; // enthalpy at state point 5 [W] + this->Report.TotFuelInEnthalpy = this->FCPM.TotFuelInEnthalpy; // enthalpy at state point 5 [W] this->Report.FuelCompressPower = state.dataGenerator->FuelSupply(this->FuelSupNum).PfuelCompEl; // electrical power used by fuel supply compressor [W] this->Report.FuelCompressEnergy = - state.dataGenerator->FuelSupply(this->FuelSupNum).PfuelCompEl * state.dataHVACGlobal->TimeStepSys * Constant::SecInHour; // elect energy + state.dataGenerator->FuelSupply(this->FuelSupNum).PfuelCompEl * state.dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; // elect energy this->Report.FuelCompressSkinLoss = state.dataGenerator->FuelSupply(this->FuelSupNum).QskinLoss; // heat rate of losses.by fuel supply compressor [W] this->Report.FuelEnergyLHV = this->FCPM.NdotFuel * state.dataGenerator->FuelSupply(this->FuelSupNum).LHV * 1000000.0 * @@ -3569,7 +3561,7 @@ namespace FuelCellElectricGenerator { this->FCPM.NdotFuel * state.dataGenerator->FuelSupply(this->FuelSupNum).LHV * 1000000.0; // reporting: Fuel Energy used (W) this->Report.FuelEnergyHHV = this->FCPM.NdotFuel * state.dataGenerator->FuelSupply(this->FuelSupNum).HHV * state.dataGenerator->FuelSupply(this->FuelSupNum).KmolPerSecToKgPerSec * state.dataHVACGlobal->TimeStepSys * - Constant::SecInHour; + Constant::rSecsInHour; this->Report.FuelEnergyUseRateHHV = this->FCPM.NdotFuel * state.dataGenerator->FuelSupply(this->FuelSupNum).HHV * state.dataGenerator->FuelSupply(this->FuelSupNum).KmolPerSecToKgPerSec; @@ -3583,9 +3575,9 @@ namespace FuelCellElectricGenerator { this->Report.WaterPumpEnergy = this->WaterSup.PwaterCompEl * state.dataHVACGlobal->TimeStepSysSec; // electrical energy this->Report.WaterIntoFCPMEnthalpy = this->FCPM.WaterInEnthalpy; - this->Report.TprodGas = this->FCPM.TprodGasLeavingFCPM; // temperature at State point 7 - this->Report.EnthalProdGas = this->FCPM.TotProdGasEnthalphy; // enthalpy at State point 7 - this->Report.NdotProdGas = this->FCPM.NdotProdGas; // flow rate at point 7 [kmol/sec] + this->Report.TprodGas = this->FCPM.TprodGasLeavingFCPM; // temperature at State point 7 + this->Report.EnthalProdGas = this->FCPM.TotProdGasEnthalpy; // enthalpy at State point 7 + this->Report.NdotProdGas = this->FCPM.NdotProdGas; // flow rate at point 7 [kmol/sec] this->Report.NdotProdAr = this->FCPM.ConstitMolalFract(5) * this->FCPM.NdotProdGas; this->Report.NdotProdCO2 = this->FCPM.ConstitMolalFract(1) * this->FCPM.NdotProdGas; this->Report.NdotProdH2O = this->FCPM.ConstitMolalFract(4) * this->FCPM.NdotProdGas; diff --git a/src/EnergyPlus/FuelCellElectricGenerator.hh b/src/EnergyPlus/FuelCellElectricGenerator.hh index 6a3e148b9a9..478922c9f8e 100644 --- a/src/EnergyPlus/FuelCellElectricGenerator.hh +++ b/src/EnergyPlus/FuelCellElectricGenerator.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -124,22 +124,22 @@ namespace FuelCellElectricGenerator { bool HasBeenOn; bool DuringShutDown; bool DuringStartUp; - Real64 NdotFuel; // molar fuel use rate. (kmol/sec) - Real64 TotFuelInEnthalphy; // Enthalpy of fuel coming into FCPM (watts) - Real64 NdotProdGas; // (kmol/sec) + Real64 NdotFuel; // molar fuel use rate. (kmol/sec) + Real64 TotFuelInEnthalpy; // Enthalpy of fuel coming into FCPM (watts) + Real64 NdotProdGas; // (kmol/sec) Array1D ConstitMolalFract; Array1D GasLibID; // lookup ID in Gas Phase ThermoChemistry Structure Array Real64 TprodGasLeavingFCPM; - Real64 NdotAir; // molar air use rate (kmol/sec) - Real64 TotAirInEnthalphy; // Enthalpy of air coming nto FCPM energy balance (watts) - Real64 NdotLiqwater; // molar water use rate (kmol/sec) + Real64 NdotAir; // molar air use rate (kmol/sec) + Real64 TotAirInEnthalpy; // Enthalpy of air coming nto FCPM energy balance (watts) + Real64 NdotLiqwater; // molar water use rate (kmol/sec) Real64 TwaterInlet; Real64 WaterInEnthalpy; // Enthalpy of liquid water used for reforming (watts) Real64 DilutionAirInEnthalpy; // Enthalpy of Dilution air coming into FCPM (watts) Real64 DilutionAirOutEnthalpy; - Real64 PelancillariesAC; // ancillary power (watts) - Real64 TotProdGasEnthalphy; // Enthalphy of product gases leaving FCPM (watts) - Real64 WaterOutEnthalpy; // enthalpy of vapor from water used for reforming + Real64 PelancillariesAC; // ancillary power (watts) + Real64 TotProdGasEnthalpy; // Enthalpy of product gases leaving FCPM (watts) + Real64 WaterOutEnthalpy; // enthalpy of vapor from water used for reforming int SeqSubstitIter; int RegulaFalsiIter; @@ -151,10 +151,10 @@ namespace FuelCellElectricGenerator { SkinLossMode(DataGenerators::SkinLoss::Invalid), ZoneID(0), RadiativeFract(0.0), QdotSkin(0.0), UAskin(0.0), SkinLossCurveID(0), WaterSupplyCurveID(0), NdotDilutionAir(0.0), StackHeatLossToDilution(0.0), DilutionInletNode(0), DilutionExhaustNode(0), PelMin(0.0), PelMax(0.0), Pel(0.0), PelLastTimeStep(0.0), Eel(0.0), QdotStackCool(0.0), FractionalDayofLastStartUp(0.0), - FractionalDayofLastShutDown(0.0), HasBeenOn(true), DuringShutDown(false), DuringStartUp(false), NdotFuel(0.0), TotFuelInEnthalphy(0.0), + FractionalDayofLastShutDown(0.0), HasBeenOn(true), DuringShutDown(false), DuringStartUp(false), NdotFuel(0.0), TotFuelInEnthalpy(0.0), NdotProdGas(0.0), ConstitMolalFract(14, 0.0), GasLibID(14, GasID::Invalid), TprodGasLeavingFCPM(0.0), NdotAir(0.0), - TotAirInEnthalphy(0.0), NdotLiqwater(0.0), TwaterInlet(0.0), WaterInEnthalpy(0.0), DilutionAirInEnthalpy(0.0), - DilutionAirOutEnthalpy(0.0), PelancillariesAC(0.0), TotProdGasEnthalphy(0.0), WaterOutEnthalpy(0.0), SeqSubstitIter(0), + TotAirInEnthalpy(0.0), NdotLiqwater(0.0), TwaterInlet(0.0), WaterInEnthalpy(0.0), DilutionAirInEnthalpy(0.0), + DilutionAirOutEnthalpy(0.0), PelancillariesAC(0.0), TotProdGasEnthalpy(0.0), WaterOutEnthalpy(0.0), SeqSubstitIter(0), RegulaFalsiIter(0) { } @@ -203,7 +203,7 @@ namespace FuelCellElectricGenerator { DataGenerators::WaterTemperatureMode WaterTempMode; // temperature of water inlet determination std::string NodeName; // node name for temperature at input int NodeNum; // node number for temperature at input - int SchedNum; // water temperature at input + Sched::Schedule *sched = nullptr; // water temperature at input int WaterSupRateCurveID; // "pointer" to water flow rate curve as a function of fuel rate int PmpPowerCurveID; // "pointer to Pump power curve as a function of water flow Rate Real64 PmpPowerLossFactor; // Pump heat loss factor @@ -216,7 +216,7 @@ namespace FuelCellElectricGenerator { // Default Constructor FCWaterSupplyDataStruct() - : WaterTempMode(DataGenerators::WaterTemperatureMode::Invalid), NodeNum(0), SchedNum(0), WaterSupRateCurveID(0), PmpPowerCurveID(0), + : WaterTempMode(DataGenerators::WaterTemperatureMode::Invalid), NodeNum(0), WaterSupRateCurveID(0), PmpPowerCurveID(0), PmpPowerLossFactor(0.0), IsModeled(true), TwaterIntoCompress(0.0), TwaterIntoFCPM(0.0), PwaterCompEl(0.0), QskinLoss(0.0) { } @@ -398,13 +398,13 @@ namespace FuelCellElectricGenerator { Real64 HeatRecOutletTemp; // reporting: Heat Recovery Loop Outlet Temperature (C) Real64 HeatRecMdot; // reporting: Heat Recovery Loop Mass flow rate (kg/s) // air supply and blower - Real64 TairInlet; // State point 1 - Real64 TairIntoFCPM; // Temperature at State point 4 - Real64 NdotAir; // air flow in kmol/sec - Real64 TotAirInEnthalphy; // Enthalpy at State point 4 - Real64 BlowerPower; // electrical power used by air supply blower - Real64 BlowerEnergy; // electrical energy used by air supply blower - Real64 BlowerSkinLoss; // heat rate of losses by blower + Real64 TairInlet; // State point 1 + Real64 TairIntoFCPM; // Temperature at State point 4 + Real64 NdotAir; // air flow in kmol/sec + Real64 TotAirInEnthalpy; // Enthalpy at State point 4 + Real64 BlowerPower; // electrical power used by air supply blower + Real64 BlowerEnergy; // electrical energy used by air supply blower + Real64 BlowerSkinLoss; // heat rate of losses by blower // fuel supply and compressor Real64 TfuelInlet; // State point 2 [C] Real64 TfuelIntoFCPM; // state point 5 [C] @@ -463,7 +463,7 @@ namespace FuelCellElectricGenerator { FCReportDataStruct() : ACPowerGen(0.0), ACEnergyGen(0.0), QdotExhaust(0.0), TotalHeatEnergyRec(0.0), ExhaustEnergyRec(0.0), FuelEnergyLHV(0.0), FuelEnergyUseRateLHV(0.0), FuelEnergyHHV(0.0), FuelEnergyUseRateHHV(0.0), FuelRateMdot(0.0), HeatRecInletTemp(0.0), - HeatRecOutletTemp(0.0), HeatRecMdot(0.0), TairInlet(0.0), TairIntoFCPM(0.0), NdotAir(0.0), TotAirInEnthalphy(0.0), BlowerPower(0.0), + HeatRecOutletTemp(0.0), HeatRecMdot(0.0), TairInlet(0.0), TairIntoFCPM(0.0), NdotAir(0.0), TotAirInEnthalpy(0.0), BlowerPower(0.0), BlowerEnergy(0.0), BlowerSkinLoss(0.0), TfuelInlet(0.0), TfuelIntoFCPM(0.0), NdotFuel(0.0), TotFuelInEnthalpy(0.0), FuelCompressPower(0.0), FuelCompressEnergy(0.0), FuelCompressSkinLoss(0.0), TwaterInlet(0.0), TwaterIntoFCPM(0.0), NdotWater(0.0), WaterPumpPower(0.0), WaterPumpEnergy(0.0), WaterIntoFCPMEnthalpy(0.0), TprodGas(0.0), EnthalProdGas(0.0), NdotProdGas(0.0), @@ -652,6 +652,10 @@ struct FuelCellElectricGeneratorData : BaseGlobalStruct bool MyEnvrnFlag = true; Array1D FuelCell; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/Furnaces.cc b/src/EnergyPlus/Furnaces.cc index 1d590e325e1..0827aaf30d8 100644 --- a/src/EnergyPlus/Furnaces.cc +++ b/src/EnergyPlus/Furnaces.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -118,7 +118,7 @@ namespace Furnaces { // METHODOLOGY EMPLOYED: // Calculates the part-load ratio of the HVAC system to meet the zone sensible load. For non-heat pump HVAC systems, // if humidity control is specified and the latent capacity at the sensible PLR is insufficient to meet the latent load, - // calculate a latent part-load ratio to meet the zone sensible load (MultiMode dehumidificaiton control) or the zone + // calculate a latent part-load ratio to meet the zone sensible load (MultiMode dehumidification control) or the zone // latent load (CoolReheat dehumidification control). Use the greater of the sensible PLR and latent PLR to control // the HVAC system. // Subroutines: @@ -134,10 +134,10 @@ namespace Furnaces { // CalcNewZoneHeatCoolFlowRates - HeatCool furnace/unitarysystem and air-to-air HeatPump routine. // Calculates a part-load ratio for the system (sensible and/or latent). // For dehumidification control type COOLREHEAT, both a sensible and latent PLR - // may exist for a single time step (heating and dehumidificaiton can occur). For all + // may exist for a single time step (heating and dehumidification can occur). For all // other system types, only a single PLR is allowed for any given time step. // Order of simulation depends on dehumidification control option as described below. - // Dehumidificaiton control options (non-heat pump versions): + // Dehumidification control options (non-heat pump versions): // Dehumidification Control NONE: Cooling performance is simulated first and then heating performance. If a HX // assisted cooling coil is selected, the HX is always active (cooling). // Dehumidification Control COOLREHEAT: For cooling operation, the sensible capacity is calculated to @@ -165,8 +165,6 @@ namespace Furnaces { // MODULE PARAMETER DEFINITIONS static constexpr std::string_view BlankString; - constexpr std::string_view fluidNameSteam("STEAM"); - // Functions void SimFurnace(EnergyPlusData &state, @@ -251,13 +249,13 @@ namespace Furnaces { Real64 ZoneLoadToCoolSPSequenced = zoneSysEnergyDemand.SequencedOutputRequiredToCoolingSP(thisFurnace.ZoneSequenceCoolingNum); Real64 ZoneLoadToHeatSPSequenced = zoneSysEnergyDemand.SequencedOutputRequiredToHeatingSP(thisFurnace.ZoneSequenceHeatingNum); auto const &tempControlType = state.dataHeatBalFanSys->TempControlType(thisFurnace.ControlZoneNum); - if (ZoneLoadToHeatSPSequenced > 0.0 && ZoneLoadToCoolSPSequenced > 0.0 && tempControlType != HVAC::ThermostatType::SingleCooling) { + if (ZoneLoadToHeatSPSequenced > 0.0 && ZoneLoadToCoolSPSequenced > 0.0 && tempControlType != HVAC::SetptType::SingleCool) { ZoneLoad = ZoneLoadToHeatSPSequenced; - } else if (ZoneLoadToHeatSPSequenced > 0.0 && ZoneLoadToCoolSPSequenced > 0.0 && tempControlType == HVAC::ThermostatType::SingleCooling) { + } else if (ZoneLoadToHeatSPSequenced > 0.0 && ZoneLoadToCoolSPSequenced > 0.0 && tempControlType == HVAC::SetptType::SingleCool) { ZoneLoad = 0.0; - } else if (ZoneLoadToHeatSPSequenced < 0.0 && ZoneLoadToCoolSPSequenced < 0.0 && tempControlType != HVAC::ThermostatType::SingleHeating) { + } else if (ZoneLoadToHeatSPSequenced < 0.0 && ZoneLoadToCoolSPSequenced < 0.0 && tempControlType != HVAC::SetptType::SingleHeat) { ZoneLoad = ZoneLoadToCoolSPSequenced; - } else if (ZoneLoadToHeatSPSequenced < 0.0 && ZoneLoadToCoolSPSequenced < 0.0 && tempControlType == HVAC::ThermostatType::SingleHeating) { + } else if (ZoneLoadToHeatSPSequenced < 0.0 && ZoneLoadToCoolSPSequenced < 0.0 && tempControlType == HVAC::SetptType::SingleHeat) { ZoneLoad = 0.0; } else if (ZoneLoadToHeatSPSequenced <= 0.0 && ZoneLoadToCoolSPSequenced >= 0.0) { ZoneLoad = 0.0; @@ -309,7 +307,7 @@ namespace Furnaces { state.dataFans->fans(thisFurnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); } } break; - // Simulate HeatCool sytems: + // Simulate HeatCool systems: case HVAC::UnitarySysType::Furnace_HeatCool: case HVAC::UnitarySysType::Unitary_HeatCool: { if (thisFurnace.CoolingCoilType_Num == HVAC::Coil_CoolingAirToAirVariableSpeed) { @@ -413,7 +411,7 @@ namespace Furnaces { // Simulate furnace reheat coil if a humidistat is used or if the reheat coil is present if (thisFurnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat || thisFurnace.SuppHeatCoilIndex > 0) { - SuppHeatingCoilFlag = true; // if truee simulates supplemental heating coil + SuppHeatingCoilFlag = true; // if true simulates supplemental heating coil CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, ReheatCoilLoad, fanOp, QActual); } } @@ -518,7 +516,7 @@ namespace Furnaces { // Simulate furnace reheat coil if a humidistat is present, the dehumidification type of coolreheat and // reheat coil load exists if (thisFurnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat && ReheatCoilLoad > 0.0) { - SuppHeatingCoilFlag = true; // if truee simulates supplemental heating coil + SuppHeatingCoilFlag = true; // if true simulates supplemental heating coil CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, ReheatCoilLoad, fanOp, QActual); } else { SuppHeatingCoilFlag = true; // if true simulates supplemental heating coil @@ -733,7 +731,6 @@ namespace Furnaces { std::string FanName; // Used in mining function CALLS bool PrintMessage; // Used in mining function CALLS int HeatingCoilPLFCurveIndex; // index of heating coil PLF curve - int SteamIndex; // steam coil index Real64 SteamDensity; // density of steam at 100C int DXCoilIndex; // Index to DX coil in HXAssited object std::string IHPCoilName; // IHP cooling coil name @@ -848,14 +845,10 @@ namespace Furnaces { ErrorObjectHeader eoh{routineName, cAlphaFields(1), thisFurnace.Name}; if (lAlphaBlanks(2)) { - thisFurnace.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisFurnace.SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); - if (thisFurnace.SchedPtr == 0) { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(2), Alphas(2))); - ErrorsFound = true; - } + thisFurnace.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisFurnace.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } thisFurnace.FurnaceInletNodeNum = NodeInputManager::GetOnlySingleNode(state, @@ -879,13 +872,11 @@ namespace Furnaces { BranchNodeConnections::TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(3), Alphas(4), "Air Nodes"); - thisFurnace.FanSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(5)); - if (!lAlphaBlanks(5) && thisFurnace.FanSchedPtr == 0) { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(5), Alphas(5))); - ErrorsFound = true; - } else if (lAlphaBlanks(5)) { + if (lAlphaBlanks(5)) { thisFurnace.fanOp = HVAC::FanOp::Cycling; + } else if ((thisFurnace.fanOpModeSched = Sched::GetSchedule(state, Alphas(5))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(5), Alphas(5)); + ErrorsFound = true; } // Get the Controlling Zone or Location of the Furnace Thermostat @@ -970,17 +961,21 @@ namespace Furnaces { thisFurnace.ActualFanVolFlowRate = fan->maxAirFlowRate; FanInletNode = fan->inletNodeNum; FanOutletNode = fan->outletNodeNum; - thisFurnace.FanAvailSchedPtr = fan->availSchedNum; + thisFurnace.fanAvailSched = fan->availSched; // Check fan's schedule for cycling fan operation if constant volume fan is used - if (thisFurnace.FanSchedPtr > 0 && thisFurnace.fanType == HVAC::FanType::Constant) { - if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisFurnace.FanSchedPtr, ScheduleManager::Clusivity::Exclusive, 0.0, ScheduleManager::Clusivity::Inclusive, 1.0)) { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("For {} = {}", cAlphaFields(7), Alphas(7))); - ShowContinueError(state, "Fan operating mode must be continuous (fan operating mode schedule values > 0)."); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFields(5), Alphas(5))); - ShowContinueError(state, "...schedule values must be (>0., <=1.)"); + if (thisFurnace.fanOpModeSched != nullptr && thisFurnace.fanType == HVAC::FanType::Constant) { + if (!thisFurnace.fanOpModeSched->checkMinMaxVals(state, Clusive::Ex, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax( + state, + eoh, + cAlphaFields(5), + Alphas(5), + Clusive::Ex, + 0.0, + Clusive::In, + 1.0, + format("For {} = {}, Fan operating mode must be continuous (schedule values > 0)", cAlphaFields(7), Alphas(7))); ErrorsFound = true; } } else if (lAlphaBlanks(5) && thisFurnace.fanType != HVAC::FanType::OnOff) { @@ -1130,9 +1125,7 @@ namespace Furnaces { // Get the Heating Coil steam max volume flow rate thisFurnace.MaxHeatCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, thisFurnace.HeatingCoilIndex, errFlag); if (thisFurnace.MaxHeatCoilFluidFlow > 0.0) { - SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed - SteamDensity = FluidProperties::GetSatDensityRefrig( - state, fluidNameSteam, state.dataFurnaces->TempSteamIn, 1.0, SteamIndex, getUnitaryHeatOnly); + SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, state.dataFurnaces->TempSteamIn, 1.0, getUnitaryHeatOnly); thisFurnace.MaxHeatCoilFluidFlow *= SteamDensity; } @@ -1382,14 +1375,10 @@ namespace Furnaces { ErrorObjectHeader eoh{routineName, CurrentModuleObject, thisFurnace.Name}; if (lAlphaBlanks(2)) { - thisFurnace.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisFurnace.SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); - if (thisFurnace.SchedPtr == 0) { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(2), Alphas(2))); - ErrorsFound = true; - } + thisFurnace.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisFurnace.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } thisFurnace.FurnaceInletNodeNum = NodeInputManager::GetOnlySingleNode(state, @@ -1413,13 +1402,11 @@ namespace Furnaces { BranchNodeConnections::TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(3), Alphas(4), "Air Nodes"); - thisFurnace.FanSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(5)); - if (!lAlphaBlanks(5) && thisFurnace.FanSchedPtr == 0) { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(5), Alphas(5))); - ErrorsFound = true; - } else if (lAlphaBlanks(5)) { + if (lAlphaBlanks(5)) { thisFurnace.fanOp = HVAC::FanOp::Cycling; + } else if ((thisFurnace.fanOpModeSched = Sched::GetSchedule(state, Alphas(5))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(5), Alphas(5)); + ErrorsFound = true; } // Get the Controlling Zone or Location of the Furnace Thermostat @@ -1503,17 +1490,21 @@ namespace Furnaces { thisFurnace.ActualFanVolFlowRate = fan->maxAirFlowRate; FanInletNode = fan->inletNodeNum; FanOutletNode = fan->outletNodeNum; - thisFurnace.FanAvailSchedPtr = fan->availSchedNum; + thisFurnace.fanAvailSched = fan->availSched; // Check fan's schedule for cycling fan operation if constant volume fan is used - if (thisFurnace.FanSchedPtr > 0 && thisFurnace.fanType == HVAC::FanType::Constant) { - if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisFurnace.FanSchedPtr, ScheduleManager::Clusivity::Exclusive, 0.0, ScheduleManager::Clusivity::Inclusive, 1.0)) { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("For {} = {}", cAlphaFields(7), Alphas(7))); - ShowContinueError(state, "Fan operating mode must be continuous (fan operating mode schedule values > 0)."); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFields(5), Alphas(5))); - ShowContinueError(state, "...schedule values must be (>0., <=1.)"); + if (thisFurnace.fanOpModeSched != nullptr && thisFurnace.fanType == HVAC::FanType::Constant) { + if (!thisFurnace.fanOpModeSched->checkMinMaxVals(state, Clusive::Ex, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax( + state, + eoh, + cAlphaFields(5), + Alphas(5), + Clusive::In, + 0.0, + Clusive::In, + 1.0, + format("For {} = {}, fan operating mode must be continuous (schedule values > 0)", cAlphaFields(7), Alphas(7))); ErrorsFound = true; } } else if (lAlphaBlanks(5) && thisFurnace.fanType != HVAC::FanType::OnOff) { @@ -1672,9 +1663,8 @@ namespace Furnaces { // Get the Heating Coil steam max volume flow rate thisFurnace.MaxHeatCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, thisFurnace.HeatingCoilIndex, errFlag); if (thisFurnace.MaxHeatCoilFluidFlow > 0.0) { - SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed - SteamDensity = FluidProperties::GetSatDensityRefrig( - state, fluidNameSteam, state.dataFurnaces->TempSteamIn, 1.0, SteamIndex, getAirLoopHVACHeatCoolInput); + SteamDensity = + Fluid::GetSteam(state)->getSatDensity(state, state.dataFurnaces->TempSteamIn, 1.0, getAirLoopHVACHeatCoolInput); thisFurnace.MaxHeatCoilFluidFlow *= SteamDensity; } @@ -1832,7 +1822,7 @@ namespace Furnaces { errFlag = true; ErrorsFound = true; } - auto const &newCoil = state.dataCoilCooingDX->coilCoolingDXs[childCCIndex]; + auto const &newCoil = state.dataCoilCoolingDX->coilCoolingDXs[childCCIndex]; thisFurnace.CondenserNodeNum = newCoil.condInletNodeIndex; @@ -2129,9 +2119,8 @@ namespace Furnaces { // Get the Heating Coil steam max volume flow rate thisFurnace.MaxSuppCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, thisFurnace.SuppHeatCoilIndex, errFlag); if (thisFurnace.MaxSuppCoilFluidFlow > 0.0) { - SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed - SteamDensity = FluidProperties::GetSatDensityRefrig( - state, fluidNameSteam, state.dataFurnaces->TempSteamIn, 1.0, SteamIndex, getAirLoopHVACHeatCoolInput); + SteamDensity = + Fluid::GetSteam(state)->getSatDensity(state, state.dataFurnaces->TempSteamIn, 1.0, getAirLoopHVACHeatCoolInput); thisFurnace.MaxSuppCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, thisFurnace.SuppHeatCoilIndex, errFlag) * SteamDensity; } @@ -2155,7 +2144,7 @@ namespace Furnaces { } } - } else { // Illeagal heating coil + } else { // Illegal heating coil ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(15), Alphas(15))); ErrorsFound = true; @@ -2583,8 +2572,9 @@ namespace Furnaces { } } - if (thisFurnace.FanSchedPtr > 0) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, thisFurnace.FanSchedPtr, ">=", 0.0, "<=", 0.0)) { + if (thisFurnace.fanOpModeSched != nullptr) { + // Is this correct? 0.0 for max also? + if (!thisFurnace.fanOpModeSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 0.0)) { // set air flow control mode: // UseCompressorOnFlow = operate at last cooling or heating air flow requested when compressor is off // UseCompressorOffFlow = operate at value specified by user @@ -2669,14 +2659,10 @@ namespace Furnaces { ErrorObjectHeader eoh{routineName, CurrentModuleObject, thisFurnace.Name}; if (lAlphaBlanks(2)) { - thisFurnace.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisFurnace.SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); - if (thisFurnace.SchedPtr == 0) { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(2), Alphas(2))); - ErrorsFound = true; - } + thisFurnace.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisFurnace.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } thisFurnace.FurnaceInletNodeNum = @@ -2779,7 +2765,7 @@ namespace Furnaces { auto *fan = state.dataFans->fans(thisFurnace.FanIndex); FanInletNode = fan->inletNodeNum; FanOutletNode = fan->outletNodeNum; - thisFurnace.FanAvailSchedPtr = fan->availSchedNum; + thisFurnace.fanAvailSched = fan->availSched; thisFurnace.ActualFanVolFlowRate = fan->maxAirFlowRate; } } @@ -3136,9 +3122,8 @@ namespace Furnaces { // Get the Heating Coil steam max volume flow rate thisFurnace.MaxSuppCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, thisFurnace.SuppHeatCoilIndex, errFlag); if (thisFurnace.MaxSuppCoilFluidFlow > 0.0) { - SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed - SteamDensity = FluidProperties::GetSatDensityRefrig( - state, fluidNameSteam, state.dataFurnaces->TempSteamIn, 1.0, SteamIndex, getAirLoopHVACHeatCoolInput); + SteamDensity = + Fluid::GetSteam(state)->getSatDensity(state, state.dataFurnaces->TempSteamIn, 1.0, getAirLoopHVACHeatCoolInput); thisFurnace.MaxSuppCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, thisFurnace.SuppHeatCoilIndex, errFlag) * SteamDensity; } @@ -3171,12 +3156,7 @@ namespace Furnaces { thisFurnace.fanPlace = static_cast(getEnumValue(HVAC::fanPlaceNamesUC, Alphas(14))); assert(thisFurnace.fanPlace != HVAC::FanPlace::Invalid); - thisFurnace.FanSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(15)); - if (!lAlphaBlanks(15) && thisFurnace.FanSchedPtr == 0) { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(15), Alphas(15))); - ErrorsFound = true; - } else if (lAlphaBlanks(15)) { + if (lAlphaBlanks(15)) { thisFurnace.fanOp = HVAC::FanOp::Cycling; if (thisFurnace.fanType != HVAC::FanType::OnOff) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, thisFurnace.Name)); @@ -3184,19 +3164,24 @@ namespace Furnaces { ShowContinueError(state, format("Fan type must be Fan:OnOff when {} = Blank.", cAlphaFields(15))); ErrorsFound = true; } + } else if ((thisFurnace.fanOpModeSched = Sched::GetSchedule(state, Alphas(15))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(15), Alphas(15)); + ErrorsFound = true; } - if (thisFurnace.fanType == HVAC::FanType::Constant) { - if (thisFurnace.FanSchedPtr > 0) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, thisFurnace.FanSchedPtr, ">", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("For {} = {}", cAlphaFields(7), Alphas(7))); - ShowContinueError(state, "Fan operating mode must be continuous (fan operating mode schedule values > 0)."); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFields(15), Alphas(15))); - ShowContinueError(state, "...schedule values must be (>0., <=1.)"); - ErrorsFound = true; - } - } + if (thisFurnace.fanType == HVAC::FanType::Constant && thisFurnace.fanOpModeSched != nullptr && + !thisFurnace.fanOpModeSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax( + state, + eoh, + cAlphaFields(15), + Alphas(15), + Clusive::In, + 0.0, + Clusive::In, + 1.0, + format("For {} = {}, fan operating mode must be continuous (schedule values > 0)", cAlphaFields(7), Alphas(7))); + ErrorsFound = true; } // Dehumidification Control Type @@ -3393,9 +3378,8 @@ namespace Furnaces { ErrorsFound = true; } - if (thisFurnace.FanSchedPtr > 0) { - if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisFurnace.FanSchedPtr, ">=", 0.0, "<=", 0.0)) { // Autodesk:Note Range is 0 to 0? + if (thisFurnace.fanOpModeSched != nullptr) { + if (!thisFurnace.fanOpModeSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 0.0)) { // Autodesk:Note Range is 0 to 0? // set air flow control mode: // UseCompressorOnFlow = operate at last cooling or heating air flow requested when compressor is off // UseCompressorOffFlow = operate at value specified by user @@ -3588,14 +3572,10 @@ namespace Furnaces { ErrorObjectHeader eoh{routineName, CurrentModuleObject, thisFurnace.Name}; if (lAlphaBlanks(2)) { - thisFurnace.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisFurnace.SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); - if (thisFurnace.SchedPtr == 0) { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(2), Alphas(2))); - ErrorsFound = true; - } + thisFurnace.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisFurnace.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } thisFurnace.FurnaceInletNodeNum = @@ -3702,7 +3682,7 @@ namespace Furnaces { auto *fan = state.dataFans->fans(thisFurnace.FanIndex); FanInletNode = fan->inletNodeNum; FanOutletNode = fan->outletNodeNum; - thisFurnace.FanAvailSchedPtr = fan->availSchedNum; + thisFurnace.fanAvailSched = fan->availSched; } // Get heating coil type and name data @@ -3953,9 +3933,8 @@ namespace Furnaces { // Get the Heating Coil steam max volume flow rate thisFurnace.MaxSuppCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, thisFurnace.SuppHeatCoilIndex, errFlag); if (thisFurnace.MaxSuppCoilFluidFlow > 0.0) { - SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed - SteamDensity = FluidProperties::GetSatDensityRefrig( - state, fluidNameSteam, state.dataFurnaces->TempSteamIn, 1.0, SteamIndex, getAirLoopHVACHeatCoolInput); + SteamDensity = + Fluid::GetSteam(state)->getSatDensity(state, state.dataFurnaces->TempSteamIn, 1.0, getAirLoopHVACHeatCoolInput); thisFurnace.MaxSuppCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, thisFurnace.SuppHeatCoilIndex, errFlag) * SteamDensity; } @@ -4010,12 +3989,7 @@ namespace Furnaces { thisFurnace.fanPlace = static_cast(getEnumValue(HVAC::fanPlaceNamesUC, Alphas(15))); assert(thisFurnace.fanPlace != HVAC::FanPlace::Invalid); - thisFurnace.FanSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(16)); - if (!lAlphaBlanks(16) && thisFurnace.FanSchedPtr == 0) { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(16), Alphas(16))); - ErrorsFound = true; - } else if (lAlphaBlanks(16)) { + if (lAlphaBlanks(16)) { thisFurnace.fanOp = HVAC::FanOp::Cycling; if (thisFurnace.fanType != HVAC::FanType::OnOff) { ShowSevereError(state, format("{} = {}", CurrentModuleObject, thisFurnace.Name)); @@ -4023,6 +3997,9 @@ namespace Furnaces { ShowContinueError(state, format("Fan type must be Fan:OnOff when {} = Blank.", cAlphaFields(16))); ErrorsFound = true; } + } else if ((thisFurnace.fanOpModeSched = Sched::GetSchedule(state, Alphas(16))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(16), Alphas(16)); + ErrorsFound = true; } // add the Dehumidification Type @@ -4719,7 +4696,7 @@ namespace Furnaces { state.dataFurnaces->MySizeFlag(FurnaceNum) = false; // Pass the fan cycling schedule index up to the air loop. Set the air loop unitary system flag. - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).CycFanSchedPtr = thisFurnace.FanSchedPtr; + state.dataAirLoop->AirLoopControlInfo(AirLoopNum).cycFanSched = thisFurnace.fanOpModeSched; state.dataAirLoop->AirLoopControlInfo(AirLoopNum).UnitarySys = true; // RR this is wrong, Op mode needs to be updated each time atep state.dataAirLoop->AirLoopControlInfo(AirLoopNum).fanOp = thisFurnace.fanOp; @@ -4785,11 +4762,8 @@ namespace Furnaces { thisFurnace.MaxHeatCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", thisFurnace.HeatingCoilName, ErrorsFound); if (thisFurnace.MaxHeatCoilFluidFlow > 0.0) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(thisFurnace.plantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(thisFurnace.plantLoc.loopNum).FluidIndex, - RoutineName); + rho = + state.dataPlnt->PlantLoop(thisFurnace.plantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); thisFurnace.MaxHeatCoilFluidFlow *= rho; } } else if (thisFurnace.HeatingCoilType_Num == HVAC::Coil_HeatingSteam) { @@ -4810,9 +4784,7 @@ namespace Furnaces { } thisFurnace.MaxHeatCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, thisFurnace.HeatingCoilIndex, ErrorsFound); if (thisFurnace.MaxHeatCoilFluidFlow > 0.0) { - int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed - SteamDensity = FluidProperties::GetSatDensityRefrig( - state, fluidNameSteam, state.dataFurnaces->TempSteamIn, 1.0, SteamIndex, RoutineName); + SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, state.dataFurnaces->TempSteamIn, 1.0, RoutineName); thisFurnace.MaxHeatCoilFluidFlow *= SteamDensity; } } @@ -4848,11 +4820,8 @@ namespace Furnaces { thisFurnace.MaxSuppCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", thisFurnace.SuppHeatCoilName, ErrorsFound); if (thisFurnace.MaxSuppCoilFluidFlow > 0.0) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(thisFurnace.SuppPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(thisFurnace.SuppPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(thisFurnace.SuppPlantLoc.loopNum) + .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); thisFurnace.MaxSuppCoilFluidFlow *= rho; } } else if (thisFurnace.SuppHeatCoilType_Num == HVAC::Coil_HeatingSteam) { @@ -4872,9 +4841,7 @@ namespace Furnaces { } thisFurnace.MaxSuppCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, thisFurnace.SuppHeatCoilIndex, ErrorsFound); if (thisFurnace.MaxSuppCoilFluidFlow > 0.0) { - int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed - SteamDensity = FluidProperties::GetSatDensityRefrig( - state, fluidNameSteam, state.dataFurnaces->TempSteamIn, 1.0, SteamIndex, RoutineName); + SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, state.dataFurnaces->TempSteamIn, 1.0, RoutineName); thisFurnace.MaxSuppCoilFluidFlow *= SteamDensity; } } @@ -4916,11 +4883,8 @@ namespace Furnaces { CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", thisFurnace.HeatingCoilName, ErrorsFound); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(thisFurnace.plantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(thisFurnace.plantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(thisFurnace.plantLoc.loopNum) + .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); thisFurnace.MaxHeatCoilFluidFlow = CoilMaxVolFlowRate * rho; } } @@ -4934,9 +4898,7 @@ namespace Furnaces { QActual); // QCoilReq, simulate any load > 0 to get max capacity CoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate(state, thisFurnace.HeatingCoilIndex, ErrorsFound); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed - SteamDensity = FluidProperties::GetSatDensityRefrig( - state, fluidNameSteam, state.dataFurnaces->TempSteamIn, 1.0, SteamIndex, RoutineName); + SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, state.dataFurnaces->TempSteamIn, 1.0, RoutineName); thisFurnace.MaxHeatCoilFluidFlow = CoilMaxVolFlowRate * SteamDensity; } } @@ -4954,11 +4916,8 @@ namespace Furnaces { CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", thisFurnace.SuppHeatCoilName, ErrorsFound); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(thisFurnace.SuppPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(thisFurnace.SuppPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(thisFurnace.SuppPlantLoc.loopNum) + .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); thisFurnace.MaxSuppCoilFluidFlow = CoilMaxVolFlowRate * rho; } } @@ -4971,9 +4930,7 @@ namespace Furnaces { QActual); // QCoilReq, simulate any load > 0 to get max capacity CoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate(state, thisFurnace.SuppHeatCoilIndex, ErrorsFound); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed - SteamDensity = FluidProperties::GetSatDensityRefrig( - state, fluidNameSteam, state.dataFurnaces->TempSteamIn, 1.0, SteamIndex, RoutineName); + SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, state.dataFurnaces->TempSteamIn, 1.0, RoutineName); thisFurnace.MaxSuppCoilFluidFlow = CoilMaxVolFlowRate * SteamDensity; } } @@ -5136,12 +5093,8 @@ namespace Furnaces { } } - if (thisFurnace.FanSchedPtr > 0) { - if (ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.FanSchedPtr) == 0.0) { - thisFurnace.fanOp = HVAC::FanOp::Cycling; - } else { - thisFurnace.fanOp = HVAC::FanOp::Continuous; - } + if (thisFurnace.fanOpModeSched != nullptr) { + thisFurnace.fanOp = (thisFurnace.fanOpModeSched->getCurrentVal() == 0.0) ? HVAC::FanOp::Cycling : HVAC::FanOp::Continuous; if (AirLoopNum > 0) { state.dataAirLoop->AirLoopControlInfo(AirLoopNum).fanOp = thisFurnace.fanOp; } @@ -5187,7 +5140,7 @@ namespace Furnaces { // Check for heat only furnace if (thisFurnace.type != HVAC::UnitarySysType::Furnace_HeatOnly && thisFurnace.type != HVAC::UnitarySysType::Unitary_HeatOnly) { - if (ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.SchedPtr) > 0.0) { + if (thisFurnace.availSched->getCurrentVal() > 0.0) { if ((state.dataFurnaces->HeatingLoad || state.dataFurnaces->CoolingLoad) || (thisFurnace.Humidistat && MoistureLoad < 0.0)) { PartLoadRatio = 1.0; } else { @@ -5406,9 +5359,8 @@ namespace Furnaces { QToCoolSetPt = 0.0; QToHeatSetPt = 0.0; - if (fanOp == HVAC::FanOp::Continuous && ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.SchedPtr) > 0.0 && - ((ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.FanAvailSchedPtr) > 0.0 || state.dataHVACGlobal->TurnFansOn) && - !state.dataHVACGlobal->TurnFansOff)) { + if (fanOp == HVAC::FanOp::Continuous && thisFurnace.availSched->getCurrentVal() > 0.0 && + ((thisFurnace.fanAvailSched->getCurrentVal() > 0.0 || state.dataHVACGlobal->TurnFansOn) && !state.dataHVACGlobal->TurnFansOff)) { if (thisFurnace.NumOfSpeedCooling > 0) { CalcVarSpeedHeatPump(state, @@ -5468,8 +5420,8 @@ namespace Furnaces { QZnReq = QToHeatSetPt; state.dataFurnaces->CoolingLoad = false; // Don't set mode TRUE unless mode is allowed. Also check for floating zone. - if (state.dataHeatBalFanSys->TempControlType(thisFurnace.ControlZoneNum) == HVAC::ThermostatType::SingleCooling || - state.dataHeatBalFanSys->TempControlType(thisFurnace.ControlZoneNum) == HVAC::ThermostatType::Uncontrolled) { + if (state.dataHeatBalFanSys->TempControlType(thisFurnace.ControlZoneNum) == HVAC::SetptType::SingleCool || + state.dataHeatBalFanSys->TempControlType(thisFurnace.ControlZoneNum) == HVAC::SetptType::Uncontrolled) { state.dataFurnaces->HeatingLoad = false; } else { state.dataFurnaces->HeatingLoad = true; @@ -5539,8 +5491,8 @@ namespace Furnaces { if (SensibleOutput > QToCoolSetPt) { QZnReq = QToCoolSetPt; // Don't set mode TRUE unless mode is allowed. Also check for floating zone. - if (state.dataHeatBalFanSys->TempControlType(thisFurnace.ControlZoneNum) == HVAC::ThermostatType::SingleHeating || - state.dataHeatBalFanSys->TempControlType(thisFurnace.ControlZoneNum) == HVAC::ThermostatType::Uncontrolled) { + if (state.dataHeatBalFanSys->TempControlType(thisFurnace.ControlZoneNum) == HVAC::SetptType::SingleHeat || + state.dataHeatBalFanSys->TempControlType(thisFurnace.ControlZoneNum) == HVAC::SetptType::Uncontrolled) { state.dataFurnaces->CoolingLoad = false; } else { state.dataFurnaces->CoolingLoad = true; @@ -5823,7 +5775,7 @@ namespace Furnaces { // Bo Shen, ORNL, July 2012 - added variable-speed air source heat pump cooling and heating coils, using curve-fits // PURPOSE OF THIS SUBROUTINE: - // This subroutine is for sizing Furnace Components for which nominal cpacities + // This subroutine is for sizing Furnace Components for which nominal capacities // and flow rates have not been specified in the input // METHODOLOGY EMPLOYED: @@ -5863,7 +5815,7 @@ namespace Furnaces { if (childCCIndex < 0) { ShowContinueError(state, "Occurs in sizing HeatExchangerAssistedCoolingCoil."); } - auto &newCoil = state.dataCoilCooingDX->coilCoolingDXs[childCCIndex]; + auto &newCoil = state.dataCoilCoolingDX->coilCoolingDXs[childCCIndex]; newCoil.size(state); } HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil( @@ -6246,8 +6198,7 @@ namespace Furnaces { state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; } else { // If Furnace runs then set HeatCoilLoad on Heating Coil and the Mass Flow - if ((ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.SchedPtr) > 0.0) && (furnaceInNode.MassFlowRate > 0.0) && - (state.dataFurnaces->HeatingLoad)) { + if ((thisFurnace.availSched->getCurrentVal() > 0.0) && (furnaceInNode.MassFlowRate > 0.0) && (state.dataFurnaces->HeatingLoad)) { furnaceInNode.MassFlowRate = thisFurnace.MdotFurnace; HeatCoilLoad = thisFurnace.DesignHeatingCapacity; @@ -6410,8 +6361,7 @@ namespace Furnaces { // END IF thisFurnace.MdotFurnace = furnaceInNode.MassFlowRate; - } else if ((ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.SchedPtr) > 0.0) && (furnaceInNode.MassFlowRate > 0.0) && - (fanOp == HVAC::FanOp::Continuous)) { + } else if ((thisFurnace.availSched->getCurrentVal() > 0.0) && (furnaceInNode.MassFlowRate > 0.0) && (fanOp == HVAC::FanOp::Continuous)) { HeatCoilLoad = 0.0; } else { // no heating and no flow thisFurnace.MdotFurnace = 0.0; @@ -6451,10 +6401,10 @@ namespace Furnaces { // the operating PLR (greater of the sensible and latent PLR) to meet the zone SENSIBLE load // (Multimode dehumidification control) or zone LATENT load (CoolReheat dehumidification control). // For dehumidification control type COOLREHEAT, both a sensible and latent PLR may exist for a - // single time step (heating and dehumidificaiton can occur). For all other sytem types, + // single time step (heating and dehumidification can occur). For all other system types, // only a single PLR is allowed for any given time step. // Order of simulation depends on dehumidification control option as described below. - // Dehumidificaiton control options: + // Dehumidification control options: // Dehumidification Control NONE: Cooling performance is simulated first and then heating performance. If a HX // assisted cooling coil is selected, the HX is always active. // Dehumidification Control COOLREHEAT: Continuous Fan Operation: @@ -6598,7 +6548,7 @@ namespace Furnaces { } SetAverageAirFlow(state, FurnaceNum, max(thisFurnace.HeatPartLoadRatio, thisFurnace.CoolPartLoadRatio), OnOffAirFlowRatio); - // if dehumidification load exists (for heat pumps) turn on the supplmental heater + // if dehumidification load exists (for heat pumps) turn on the supplemental heater if (state.dataFurnaces->HPDehumidificationLoadFlag) HumControl = true; } else { // not FirstHVACIteration // Init for heating @@ -6650,7 +6600,7 @@ namespace Furnaces { //*********** Heating Section ************ // If Furnace runs with a heating load then set HeatCoilLoad on Heating Coil and the Mass Flow // (Node(FurnaceInletNode)%MassFlowRate .gt. 0.0d0) .and. & - if ((ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.SchedPtr) > 0.0) && (state.dataFurnaces->HeatingLoad)) { + if ((thisFurnace.availSched->getCurrentVal() > 0.0) && (state.dataFurnaces->HeatingLoad)) { // Heat pumps only calculate a single PLR each time step (i.e. only cooling or heating allowed in a single time step) if (thisFurnace.type == HVAC::UnitarySysType::Unitary_HeatPump_AirToAir || @@ -7128,7 +7078,7 @@ namespace Furnaces { // Simulate if scheduled ON and cooling load or if a moisture load exists when using a humidistat // Check of HeatingLatentOutput is used to reduce overshoot during simultaneous heating and cooling // Setback flag is used to avoid continued RH control when Tstat is setback (RH should float down) - if ((ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.SchedPtr) > 0.0 && state.dataFurnaces->CoolingLoad) || + if ((thisFurnace.availSched->getCurrentVal() > 0.0 && state.dataFurnaces->CoolingLoad) || (thisFurnace.Humidistat && thisFurnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat && (SystemMoistureLoad < 0.0 || (SystemMoistureLoad >= 0.0 && HeatingLatentOutput > SystemMoistureLoad && !state.dataZoneEnergyDemand->Setback(thisFurnace.ControlZoneNum))))) { @@ -7324,7 +7274,7 @@ namespace Furnaces { PartLoadRatio = 0.0; } // EndIf for IF(CoolCoilLoad.NE.0.0) - // Calculate the delivered capacity from the PLR caculated above + // Calculate the delivered capacity from the PLR calculated above CalcFurnaceOutput(state, FurnaceNum, FirstHVACIteration, @@ -7748,7 +7698,7 @@ namespace Furnaces { } // Calculate the reheat coil output - if (HumControl) { // HumControl = .TRUE. if a Humidistat is installed and dehumdification control type is CoolReheat + if (HumControl) { // HumControl = .TRUE. if a Humidistat is installed and dehumidification control type is CoolReheat if (thisFurnace.ZoneSequenceHeatingNum > 0) { QToHeatSetPt = (state.dataZoneEnergyDemand->ZoneSysEnergyDemand(thisFurnace.ControlZoneNum) .SequencedOutputRequiredToHeatingSP(thisFurnace.ZoneSequenceHeatingNum) / @@ -7815,8 +7765,7 @@ namespace Furnaces { //*********HVAC Scheduled OFF************* // No heating or cooling or dehumidification //!!LKL discrepancy with < 0? - if (ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.SchedPtr) == 0.0 || - state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate == 0.0) { + if (thisFurnace.availSched->getCurrentVal() == 0.0 || state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate == 0.0) { thisFurnace.MdotFurnace = 0.0; CoolCoilLoad = 0.0; HeatCoilLoad = 0.0; @@ -7866,7 +7815,7 @@ namespace Furnaces { Real64 ZoneSensLoadMet; // Actual zone sensible load met by heat pump (W) Real64 ZoneLatLoadMet; // Actual zone latent load met by heat pump (W) Real64 ZoneSensLoadMetFanONCompON; // Max Zone sensible load heat pump can meet (W) - Real64 ZoneLatLoadMetFanONCompON; // Max Zone latentload heat pump can meet (W) + Real64 ZoneLatLoadMetFanONCompON; // Max Zone latent load heat pump can meet (W) Real64 ZoneSensLoadMetFanONCompOFF; // control zone sensible load met using only outside air // and fan heat (no coil output) (W) Real64 ZoneLatLoadMetFanONCompOFF; // control zone Latent load met using only outside air @@ -7889,7 +7838,7 @@ namespace Furnaces { Real64 Dummy2 = 0.0; // used as dummy heat and reheat coil load Real64 OnOffAirFlowRatio = 1.0; // Ratio of compressor ON air mass flow to AVERAGE air mass flow over time step int FurnaceInletNode = thisFurnace.FurnaceInletNodeNum; - HVAC::FanOp fanOp = thisFurnace.fanOp; // fan operting mode + HVAC::FanOp fanOp = thisFurnace.fanOp; // fan operating mode thisFurnace.MdotFurnace = thisFurnace.DesignMassFlowRate; //*********INITIAL CALCULATIONS**************** @@ -7918,8 +7867,7 @@ namespace Furnaces { // AND air flow rate is greater than zero... // AND the air system has a cooling load and is not set back or in the deadband... // OR the system is controlled by a humidistat and there is a latent load - if ((ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.SchedPtr) > 0.0 && - state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate > 0.0) && + if ((thisFurnace.availSched->getCurrentVal() > 0.0 && state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate > 0.0) && ((state.dataFurnaces->CoolingLoad) || (thisFurnace.Humidistat && thisFurnace.CoolingCoilLatentDemand < 0.0))) { // Set the air flow rate to the design flow rate and set the fan operation fraction to 1 (continuous operation) @@ -8120,8 +8068,8 @@ namespace Furnaces { //*********HEATING CALCULATIONS**************** // If Furnace runs with a heating load then set HeatCoilLoad on Heating Coil and the Mass Flow - } else if ((ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.SchedPtr) > 0.0) && - (state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate > 0.0) && state.dataFurnaces->HeatingLoad) { + } else if ((thisFurnace.availSched->getCurrentVal() > 0.0) && (state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate > 0.0) && + state.dataFurnaces->HeatingLoad) { // Set the air flow rate to the design flow rate and set the fan operation fraction to 1 (continuous operation) state.dataLoopNodes->Node(FurnaceInletNode).MassFlowRate = thisFurnace.DesignMassFlowRate; @@ -8337,7 +8285,7 @@ namespace Furnaces { } //**********HVAC Scheduled ON, but no cooling, dehumidification or heating load********* - } else if (ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.SchedPtr) > 0.0) { + } else if (thisFurnace.availSched->getCurrentVal() > 0.0) { thisFurnace.InitHeatPump = true; // initialization call to Calc Furnace HeatPartLoadRatio = 0.0; CoolPartLoadRatio = 0.0; @@ -8452,7 +8400,7 @@ namespace Furnaces { // Cooling to Heating PLR Ratio (CoolHeatPLRRat) is used to track the air mass flow rate of both the heating // and cooling coils when RH control is used and the heating coil operates longer than the cooling coil. - // When CoolPartLoadRatio/CoolHeatPLRRat is used, the PLR calculated is acutally the PLR for the heating + // When CoolPartLoadRatio/CoolHeatPLRRat is used, the PLR calculated is actually the PLR for the heating // coil (heating PLR is greater than cooling PLR), it is this PLR that determines the air mass flow rate. // When MAX(HeatPartLoadRatio,CoolPartLoadRatio) is used, only one of these values is non-zero. if (fanOp == HVAC::FanOp::Cycling) { @@ -8733,7 +8681,7 @@ namespace Furnaces { state.dataFans->fans(thisFurnace.FanIndex)->simulate(state, FirstHVACIteration, state.dataFurnaces->FanSpeedRatio); } if (thisFurnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat || thisFurnace.SuppHeatCoilIndex > 0) { - bool SuppHeatingCoilFlag = true; // if truee simulates supplemental heating coil + bool SuppHeatingCoilFlag = true; // if true simulates supplemental heating coil CalcNonDXHeatingCoils(state, FurnaceNum, SuppHeatingCoilFlag, FirstHVACIteration, ReheatCoilLoad, fanOp, QActual); } } // IF(Furnace(FurnaceNum)%type == UnitarySys_HeatPump_AirToAir)THEN @@ -9048,10 +8996,10 @@ namespace Furnaces { } else { state.dataFurnaces->FanSpeedRatio = state.dataFurnaces->CompOnFlowRatio; } + // IF the furnace is scheduled on or nightime cycle overrides fan schedule. Uses same logic as fan. - if (ScheduleManager::GetCurrentScheduleValue(state, state.dataFurnaces->Furnace(FurnaceNum).SchedPtr) > 0.0 && - ((ScheduleManager::GetCurrentScheduleValue(state, state.dataFurnaces->Furnace(FurnaceNum).FanAvailSchedPtr) > 0.0 || - state.dataHVACGlobal->TurnFansOn) && + if (state.dataFurnaces->Furnace(FurnaceNum).availSched->getCurrentVal() > 0.0 && + ((state.dataFurnaces->Furnace(FurnaceNum).fanAvailSched->getCurrentVal() > 0.0 || state.dataHVACGlobal->TurnFansOn) && !state.dataHVACGlobal->TurnFansOff)) { state.dataLoopNodes->Node(InletNode).MassFlowRate = AverageUnitMassFlow; state.dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail = AverageUnitMassFlow; @@ -9100,7 +9048,7 @@ namespace Furnaces { } } - // Set mass flow rates during on and off cylce using an OnOff fan + // Set mass flow rates during on and off cycle using an OnOff fan if (state.afn->distribution_simulated) { state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).LoopSystemOnMassFlowrate = state.dataFurnaces->CompOnMassFlow; state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).LoopSystemOffMassFlowrate = state.dataFurnaces->CompOffMassFlow; @@ -9165,7 +9113,7 @@ namespace Furnaces { int CoilTypeNum(0); // heating coil type number int HeatingCoilIndex(0); // heating coil index int CoilControlNode(0); // control node for hot water and steam heating coils - int CoilOutletNode(0); // air outlet node of the heatiing coils + int CoilOutletNode(0); // air outlet node of the heating coils PlantLocation plantLoc{}; // plant loop location Real64 QActual = 0.0; // actual heating load @@ -9469,9 +9417,9 @@ namespace Furnaces { TotalZoneSensibleLoad = QZnReq; TotalZoneLatentLoad = QLatReq; // Calculate the reheat coil output - if ((ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.SchedPtr) > 0.0) && + if ((thisFurnace.availSched->getCurrentVal() > 0.0) && (thisFurnace.Humidistat && thisFurnace.DehumidControlType_Num == DehumidificationControlMode::CoolReheat && - (QLatReq < 0.0))) { // if a Humidistat is installed and dehumdification control type is CoolReheat + (QLatReq < 0.0))) { // if a Humidistat is installed and dehumidification control type is CoolReheat CalcVarSpeedHeatPump(state, FurnaceNum, FirstHVACIteration, @@ -9579,9 +9527,9 @@ namespace Furnaces { if (TotBranchNum == 1) { int ZoneSideNodeNum = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).ZoneEquipSupplyNodeNum(1); // THE MASS FLOW PRECISION of the system solver is not enough for some small air flow rate iterations , BY DEBUGGING - // it may cause mass flow rate occilations between airloop and zoneequip + // it may cause mass flow rate oscillations between airloop and zoneequip // specify the air flow rate directly for one-to-one system, when the iteration deviation is closing the solver precision level - // 0.02 is 2 * HVACFlowRateToler, in order to accomodate the system solver precision level + // 0.02 is 2 * HVACFlowRateToler, in order to accommodate the system solver precision level if (std::abs(AirMassFlow - state.dataLoopNodes->Node(ZoneSideNodeNum).MassFlowRate) < 0.02) state.dataLoopNodes->Node(ZoneSideNodeNum).MassFlowRateMaxAvail = AirMassFlow; state.dataLoopNodes->Node(ZoneSideNodeNum).MassFlowRate = AirMassFlow; @@ -9675,7 +9623,7 @@ namespace Furnaces { Real64 ErrorToler = 0.001; // Error tolerance for convergence from input deck auto &thisFurnace = state.dataFurnaces->Furnace(FurnaceNum); - if (ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.SchedPtr) == 0.0) return; + if (thisFurnace.availSched->getCurrentVal() == 0.0) return; // Get result when DX coil is off SupHeaterLoad = 0.0; @@ -10052,7 +10000,7 @@ namespace Furnaces { // DATE WRITTEN: March 2012 // PURPOSE OF THIS SUBROUTINE: - // This routine will calcultes MSHP performance based on given system load + // This routine will calculates MSHP performance based on given system load Real64 SavePartloadRatio = 0.0; // part-load ratio Real64 SaveSpeedRatio = 0.0; // speed ratio @@ -10853,8 +10801,8 @@ namespace Furnaces { } } - if ((ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.SchedPtr) == 0.0) || state.dataHVACGlobal->TurnFansOff || - (ScheduleManager::GetCurrentScheduleValue(state, thisFurnace.FanAvailSchedPtr) == 0.0 && !state.dataHVACGlobal->TurnFansOn)) { + if ((thisFurnace.availSched->getCurrentVal() == 0.0) || state.dataHVACGlobal->TurnFansOff || + (thisFurnace.fanAvailSched->getCurrentVal() == 0.0 && !state.dataHVACGlobal->TurnFansOn)) { state.dataLoopNodes->Node(thisFurnace.FurnaceInletNodeNum).MassFlowRate = 0.0; OnOffAirFlowRatio = 0.0; } else { @@ -10894,7 +10842,7 @@ namespace Furnaces { errFlag = true; ErrorsFound = true; } - auto const &newCoil = state.dataCoilCooingDX->coilCoolingDXs[childCCIndex_DX]; + auto const &newCoil = state.dataCoilCoolingDX->coilCoolingDXs[childCCIndex_DX]; thisFurnace.MinOATCompressorCooling = newCoil.performance.minOutdoorDrybulb; } else if (Util::SameString(ChildCoolingCoilType, "Coil:Cooling:DX:VariableSpeed")) { int childCCIndex_VS = state.dataHVACAssistedCC->HXAssistedCoil(thisFurnace.CoolingCoilIndex).CoolingCoilIndex; diff --git a/src/EnergyPlus/Furnaces.hh b/src/EnergyPlus/Furnaces.hh index 0c42383cead..1596214e3e0 100644 --- a/src/EnergyPlus/Furnaces.hh +++ b/src/EnergyPlus/Furnaces.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -111,9 +111,9 @@ namespace Furnaces { std::string Name; // Name of the Furnace HVAC::UnitarySysType type = HVAC::UnitarySysType::Invalid; // Numeric Equivalent for Furnace Type int FurnaceIndex; // Index to furnace - int SchedPtr; // Index to furnace operating schedule - int FanSchedPtr; // Index to fan operating mode schedule - int FanAvailSchedPtr; // Index to fan availability schedule + Sched::Schedule *availSched = nullptr; // furnace operating schedule + Sched::Schedule *fanOpModeSched = nullptr; // fan operating mode schedule + Sched::Schedule *fanAvailSched = nullptr; // fan availability schedule int ControlZoneNum; // Index to controlled zone int ZoneSequenceCoolingNum; // Index to cooling sequence/priority for this zone int ZoneSequenceHeatingNum; // Index to heating sequence/priority for this zone @@ -255,32 +255,32 @@ namespace Furnaces { int ErrCountVar2 = 0; // Counter used to minimize the occurrence of output warnings FurnaceEquipConditions() - : FurnaceIndex(0), SchedPtr(0), FanSchedPtr(0), FanAvailSchedPtr(0), ControlZoneNum(0), ZoneSequenceCoolingNum(0), - ZoneSequenceHeatingNum(0), CoolingCoilType_Num(0), CoolingCoilIndex(0), ActualDXCoilIndexForHXAssisted(0), CoolingCoilUpstream(true), - HeatingCoilType_Num(0), HeatingCoilIndex(0), ReheatingCoilType_Num(0), ReheatingCoilIndex(0), CoilControlNode(0), HWCoilAirInletNode(0), - HWCoilAirOutletNode(0), SuppCoilAirInletNode(0), SuppCoilAirOutletNode(0), SuppHeatCoilType_Num(0), SuppHeatCoilIndex(0), - SuppCoilControlNode(0), fanType(HVAC::FanType::Invalid), FanIndex(0), FurnaceInletNodeNum(0), FurnaceOutletNodeNum(0), - LastMode(Furnaces::ModeOfOperation::Invalid), AirFlowControl(AirFlowControlConstFan::Invalid), fanPlace(HVAC::FanPlace::Invalid), - NodeNumOfControlledZone(0), CoolingConvergenceTolerance(0.0), HeatingConvergenceTolerance(0.0), DesignHeatingCapacity(0.0), - DesignCoolingCapacity(0.0), CoolingCoilSensDemand(0.0), HeatingCoilSensDemand(0.0), CoolingCoilLatentDemand(0.0), - DesignSuppHeatingCapacity(0.0), DesignFanVolFlowRate(0.0), DesignFanVolFlowRateEMSOverrideOn(false), - DesignFanVolFlowRateEMSOverrideValue(0.0), DesignMassFlowRate(0.0), MaxCoolAirVolFlow(0.0), MaxCoolAirVolFlowEMSOverrideOn(false), - MaxCoolAirVolFlowEMSOverrideValue(0.0), MaxHeatAirVolFlow(0.0), MaxHeatAirVolFlowEMSOverrideOn(false), - MaxHeatAirVolFlowEMSOverrideValue(0.0), MaxNoCoolHeatAirVolFlow(0.0), MaxNoCoolHeatAirVolFlowEMSOverrideOn(false), - MaxNoCoolHeatAirVolFlowEMSOverrideValue(0.0), MaxCoolAirMassFlow(0.0), MaxHeatAirMassFlow(0.0), MaxNoCoolHeatAirMassFlow(0.0), - MaxHeatCoilFluidFlow(0.0), MaxSuppCoilFluidFlow(0.0), ControlZoneMassFlowFrac(0.0), DesignMaxOutletTemp(9999.0), MdotFurnace(0.0), - FanPartLoadRatio(0.0), CompPartLoadRatio(0.0), CoolPartLoadRatio(0.0), HeatPartLoadRatio(0.0), MinOATCompressorCooling(0.0), - MinOATCompressorHeating(0.0), MaxOATSuppHeat(0.0), CondenserNodeNum(0), Humidistat(false), InitHeatPump(false), - DehumidControlType_Num(DehumidificationControlMode::None), LatentMaxIterIndex(0), LatentRegulaFalsiFailedIndex(0), - LatentRegulaFalsiFailedIndex2(0), SensibleMaxIterIndex(0), SensibleRegulaFalsiFailedIndex(0), WSHPHeatMaxIterIndex(0), - WSHPHeatRegulaFalsiFailedIndex(0), DXHeatingMaxIterIndex(0), DXHeatingRegulaFalsiFailedIndex(0), HeatingMaxIterIndex(0), - HeatingMaxIterIndex2(0), HeatingRegulaFalsiFailedIndex(0), ActualFanVolFlowRate(0.0), HeatingSpeedRatio(1.0), CoolingSpeedRatio(1.0), - NoHeatCoolSpeedRatio(1.0), ZoneInletNode(0), SenLoadLoss(0.0), LatLoadLoss(0.0), SensibleLoadMet(0.0), LatentLoadMet(0.0), - DehumidInducedHeatingDemandRate(0.0), CoilOutletNode(0), plantLoc{}, SuppPlantLoc{}, HotWaterCoilMaxIterIndex(0), - HotWaterCoilMaxIterIndex2(0), EMSOverrideSensZoneLoadRequest(false), EMSSensibleZoneLoadValue(0.0), - EMSOverrideMoistZoneLoadRequest(false), EMSMoistureZoneLoadValue(0.0), HeatCoolMode(Furnaces::ModeOfOperation::Invalid), - NumOfSpeedCooling(0), NumOfSpeedHeating(0), IdleSpeedRatio(0.0), IdleVolumeAirRate(0.0), IdleMassFlowRate(0.0), FanVolFlow(0.0), - CheckFanFlow(true), HeatVolumeFlowRate(HVAC::MaxSpeedLevels, 0.0), HeatMassFlowRate(HVAC::MaxSpeedLevels, 0.0), + : FurnaceIndex(0), ControlZoneNum(0), ZoneSequenceCoolingNum(0), ZoneSequenceHeatingNum(0), CoolingCoilType_Num(0), CoolingCoilIndex(0), + ActualDXCoilIndexForHXAssisted(0), CoolingCoilUpstream(true), HeatingCoilType_Num(0), HeatingCoilIndex(0), ReheatingCoilType_Num(0), + ReheatingCoilIndex(0), CoilControlNode(0), HWCoilAirInletNode(0), HWCoilAirOutletNode(0), SuppCoilAirInletNode(0), + SuppCoilAirOutletNode(0), SuppHeatCoilType_Num(0), SuppHeatCoilIndex(0), SuppCoilControlNode(0), fanType(HVAC::FanType::Invalid), + FanIndex(0), FurnaceInletNodeNum(0), FurnaceOutletNodeNum(0), LastMode(Furnaces::ModeOfOperation::Invalid), + AirFlowControl(AirFlowControlConstFan::Invalid), fanPlace(HVAC::FanPlace::Invalid), NodeNumOfControlledZone(0), + CoolingConvergenceTolerance(0.0), HeatingConvergenceTolerance(0.0), DesignHeatingCapacity(0.0), DesignCoolingCapacity(0.0), + CoolingCoilSensDemand(0.0), HeatingCoilSensDemand(0.0), CoolingCoilLatentDemand(0.0), DesignSuppHeatingCapacity(0.0), + DesignFanVolFlowRate(0.0), DesignFanVolFlowRateEMSOverrideOn(false), DesignFanVolFlowRateEMSOverrideValue(0.0), DesignMassFlowRate(0.0), + MaxCoolAirVolFlow(0.0), MaxCoolAirVolFlowEMSOverrideOn(false), MaxCoolAirVolFlowEMSOverrideValue(0.0), MaxHeatAirVolFlow(0.0), + MaxHeatAirVolFlowEMSOverrideOn(false), MaxHeatAirVolFlowEMSOverrideValue(0.0), MaxNoCoolHeatAirVolFlow(0.0), + MaxNoCoolHeatAirVolFlowEMSOverrideOn(false), MaxNoCoolHeatAirVolFlowEMSOverrideValue(0.0), MaxCoolAirMassFlow(0.0), + MaxHeatAirMassFlow(0.0), MaxNoCoolHeatAirMassFlow(0.0), MaxHeatCoilFluidFlow(0.0), MaxSuppCoilFluidFlow(0.0), + ControlZoneMassFlowFrac(0.0), DesignMaxOutletTemp(9999.0), MdotFurnace(0.0), FanPartLoadRatio(0.0), CompPartLoadRatio(0.0), + CoolPartLoadRatio(0.0), HeatPartLoadRatio(0.0), MinOATCompressorCooling(0.0), MinOATCompressorHeating(0.0), MaxOATSuppHeat(0.0), + CondenserNodeNum(0), Humidistat(false), InitHeatPump(false), DehumidControlType_Num(DehumidificationControlMode::None), + LatentMaxIterIndex(0), LatentRegulaFalsiFailedIndex(0), LatentRegulaFalsiFailedIndex2(0), SensibleMaxIterIndex(0), + SensibleRegulaFalsiFailedIndex(0), WSHPHeatMaxIterIndex(0), WSHPHeatRegulaFalsiFailedIndex(0), DXHeatingMaxIterIndex(0), + DXHeatingRegulaFalsiFailedIndex(0), HeatingMaxIterIndex(0), HeatingMaxIterIndex2(0), HeatingRegulaFalsiFailedIndex(0), + ActualFanVolFlowRate(0.0), HeatingSpeedRatio(1.0), CoolingSpeedRatio(1.0), NoHeatCoolSpeedRatio(1.0), ZoneInletNode(0), + SenLoadLoss(0.0), LatLoadLoss(0.0), SensibleLoadMet(0.0), LatentLoadMet(0.0), DehumidInducedHeatingDemandRate(0.0), + CoilOutletNode(0), plantLoc{}, SuppPlantLoc{}, HotWaterCoilMaxIterIndex(0), HotWaterCoilMaxIterIndex2(0), + EMSOverrideSensZoneLoadRequest(false), EMSSensibleZoneLoadValue(0.0), EMSOverrideMoistZoneLoadRequest(false), + EMSMoistureZoneLoadValue(0.0), HeatCoolMode(Furnaces::ModeOfOperation::Invalid), NumOfSpeedCooling(0), NumOfSpeedHeating(0), + IdleSpeedRatio(0.0), IdleVolumeAirRate(0.0), IdleMassFlowRate(0.0), FanVolFlow(0.0), CheckFanFlow(true), + HeatVolumeFlowRate(HVAC::MaxSpeedLevels, 0.0), HeatMassFlowRate(HVAC::MaxSpeedLevels, 0.0), CoolVolumeFlowRate(HVAC::MaxSpeedLevels, 0.0), CoolMassFlowRate(HVAC::MaxSpeedLevels, 0.0), MSHeatingSpeedRatio(HVAC::MaxSpeedLevels, 0.0), MSCoolingSpeedRatio(HVAC::MaxSpeedLevels, 0.0), bIsIHP(false), CompSpeedNum(0), CompSpeedRatio(0.0), ErrIndexCyc(0), ErrIndexVar(0), iterationCounter(0), iterationMode(0), FirstPass(true) @@ -577,6 +577,10 @@ struct FurnacesData : BaseGlobalStruct int SpeedNum = 1; // Speed number Real64 SupHeaterLoad = 0.0; // supplement heater load + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/General.cc b/src/EnergyPlus/General.cc index 65a1dd95fed..04757c20e94 100644 --- a/src/EnergyPlus/General.cc +++ b/src/EnergyPlus/General.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -68,7 +68,7 @@ #include #if defined(_WIN32) && _MSC_VER < 1900 -#define snprintf _snprintf +# define snprintf _snprintf #endif namespace EnergyPlus::General { @@ -186,7 +186,7 @@ void SolveRoot(const EnergyPlusData &state, Real64 X0 = X_0; // present 1st bound Real64 X1 = X_1; // present 2nd bound Real64 XTemp = X0; // new estimate - int NIte = 0; // number of interations + int NIte = 0; // number of iterations int AltIte = 0; // an accounter used for Alternation choice Real64 Y0 = f(X0); // f at X0 @@ -396,7 +396,7 @@ void DetermineDateTokens(EnergyPlusData &state, static constexpr std::array SingleChars{"/", ":", "-"}; static constexpr int NumDoubleChars(6); static constexpr std::array DoubleChars{ - "ST ", "ND ", "RD ", "TH ", "OF ", "IN "}; // Need trailing spaces: Want thse only at end of words + "ST ", "ND ", "RD ", "TH ", "OF ", "IN "}; // Need trailing spaces: Want these only at end of words static constexpr std::array Months{"JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"}; static constexpr std::array Weekdays{"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"}; @@ -701,7 +701,7 @@ bool BetweenDates(int const TestDate, // Date to test // METHODOLOGY EMPLOYED: // The input dates are Julian Day format, year is irrelevant. // Thus, if StartDate > EndDate (i.e. StartDate = 1Dec and EndDate = 31Jan), - // this routine accomodates. + // this routine accommodates. // REFERENCES: // Adapted from BLAST BTWEEN function. @@ -805,7 +805,7 @@ void Iterate(Real64 &ResultX, // ResultX is the final Iteration result passed b // DATE WRITTEN March 2004 // PURPOSE OF THIS SUBROUTINE: - // Iterately solves for the value of X which satisfies Y(X)=0. + // Iteratively solves for the value of X which satisfies Y(X)=0. // The subroutine tests for convergence and provides a new guess for the value of the // independent variable X. @@ -1087,7 +1087,7 @@ void ScanForReports(EnergyPlusData &state, state.dataGeneral->SurfDetWVert = true; break; case COSTINFO: - // Custom case for reporting surface info for cost estimates (for first costs in opitimzing) + // Custom case for reporting surface info for cost estimates (for first costs in optimizing) state.dataGeneral->CostInfo = true; break; case VIEWFACTORINFO: // actual reporting is in HeatBalanceIntRadExchange diff --git a/src/EnergyPlus/General.hh b/src/EnergyPlus/General.hh index 31f26cdf9f4..53e73f3c27e 100644 --- a/src/EnergyPlus/General.hh +++ b/src/EnergyPlus/General.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -82,17 +82,6 @@ namespace General { Real64 X_0, // 1st bound of interval that contains the solution Real64 X_1); // 2nd bound of interval that contains the solution - constexpr Real64 POLYF(Real64 const X, // Cosine of angle of incidence - Array1D const &A // Polynomial coefficients - ) - { - if (X < 0.0 || X > 1.0) { - return 0.0; - } else { - return X * (A(1) + X * (A(2) + X * (A(3) + X * (A(4) + X * (A(5) + X * A(6)))))); - } - } - void MovingAvg(Array1D &DataIn, int NumItemsInAvg); void ProcessDateString(EnergyPlusData &state, @@ -346,6 +335,10 @@ struct GeneralData : BaseGlobalStruct std::string VarDictOption1; std::string VarDictOption2; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/GeneralRoutines.cc b/src/EnergyPlus/GeneralRoutines.cc index 4784ac71328..0bafaf45f1b 100644 --- a/src/EnergyPlus/GeneralRoutines.cc +++ b/src/EnergyPlus/GeneralRoutines.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -798,7 +798,7 @@ void ValidateComponent(EnergyPlusData &state, void CalcBasinHeaterPower(EnergyPlusData &state, Real64 const Capacity, // Basin heater capacity per degree C below setpoint (W/C) - int const SchedulePtr, // Pointer to basin heater schedule + Sched::Schedule *sched, // basin heater schedule Real64 const SetPointTemp, // setpoint temperature for basin heater operation (C) Real64 &Power // Basin heater power (W) ) @@ -821,8 +821,8 @@ void CalcBasinHeaterPower(EnergyPlusData &state, Power = 0.0; // Operate basin heater anytime outdoor temperature is below setpoint and water is not flowing through the equipment // IF schedule exists, basin heater performance can be scheduled OFF - if (SchedulePtr > 0) { - Real64 BasinHeaterSch = ScheduleManager::GetCurrentScheduleValue(state, SchedulePtr); + if (sched != nullptr) { + Real64 BasinHeaterSch = sched->getCurrentVal(); if (Capacity > 0.0 && BasinHeaterSch > 0.0) { Power = max(0.0, Capacity * (SetPointTemp - state.dataEnvrn->OutDryBulbTemp)); } diff --git a/src/EnergyPlus/GeneralRoutines.hh b/src/EnergyPlus/GeneralRoutines.hh index 2b13e24cccb..5866d84e676 100644 --- a/src/EnergyPlus/GeneralRoutines.hh +++ b/src/EnergyPlus/GeneralRoutines.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -57,6 +57,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -175,9 +176,10 @@ void ValidateComponent(EnergyPlusData &state, std::string_view CallString // Context of this pair -- for error message ); +// Why is this in GeneralRoutines? Asking for a friend void CalcBasinHeaterPower(EnergyPlusData &state, Real64 const Capacity, // Basin heater capacity per degree C below setpoint (W/C) - int const SchedulePtr, // Pointer to basin heater schedule + Sched::Schedule *sched, // Pointer to basin heater schedule Real64 const SetPointTemp, // setpoint temperature for basin heater operation (C) Real64 &Power // Basin heater power (W) ); @@ -220,6 +222,10 @@ struct GeneralRoutinesData : BaseGlobalStruct IntervalHalf ZoneInterHalf = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, false, false, false, false}; ZoneEquipControllerProps ZoneController = {0.0, 0.0, 0.0, 0.0, 0.0}; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/GeneratorDynamicsManager.cc b/src/EnergyPlus/GeneratorDynamicsManager.cc index f20c5159d5b..9859904c8a9 100644 --- a/src/EnergyPlus/GeneratorDynamicsManager.cc +++ b/src/EnergyPlus/GeneratorDynamicsManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -122,7 +122,7 @@ namespace GeneratorDynamicsManager { thisGen.MandatoryFullCoolDown = thisMicroCHP.A42Model.MandatoryFullCoolDown; thisGen.WarmRestartOkay = thisMicroCHP.A42Model.WarmRestartOkay; thisGen.WarmUpDelay = thisMicroCHP.A42Model.WarmUpDelay; - thisGen.CoolDownDelay = thisMicroCHP.A42Model.CoolDownDelay / Constant::SecInHour; // seconds to hours + thisGen.CoolDownDelay = thisMicroCHP.A42Model.CoolDownDelay / Constant::rSecsInHour; // seconds to hours thisGen.PcoolDown = thisMicroCHP.A42Model.PcoolDown; thisGen.Pstandby = thisMicroCHP.A42Model.Pstandby; thisGen.MCeng = thisMicroCHP.A42Model.MCeng; @@ -130,8 +130,8 @@ namespace GeneratorDynamicsManager { thisGen.kf = thisMicroCHP.A42Model.kf; thisGen.TnomEngOp = thisMicroCHP.A42Model.TnomEngOp; thisGen.kp = thisMicroCHP.A42Model.kp; - thisGen.AvailabilitySchedID = thisMicroCHP.AvailabilitySchedID; - thisGen.StartUpTimeDelay = thisMicroCHP.A42Model.WarmUpDelay / Constant::SecInHour; // seconds to hours + thisGen.availSched = thisMicroCHP.availSched; + thisGen.StartUpTimeDelay = thisMicroCHP.A42Model.WarmUpDelay / Constant::rSecsInHour; // seconds to hours thisGen.ElectEffNom = thisMicroCHP.A42Model.ElecEff; thisGen.ThermEffNom = thisMicroCHP.A42Model.ThermEff; @@ -170,7 +170,7 @@ namespace GeneratorDynamicsManager { // Control decision results include: // -- electrical load allowed/resulting/provided // -- new operating mode - // -- part load this timestep for shift to normal mode occuring midway in timestep + // -- part load this timestep for shift to normal mode occurring midway in timestep // -- part load this timestep for shift out of cool down mode // Input data used to make control decisions include: @@ -245,7 +245,7 @@ namespace GeneratorDynamicsManager { } // check availability schedule - Real64 SchedVal = ScheduleManager::GetCurrentScheduleValue(state, thisGen.AvailabilitySchedID); + Real64 SchedVal = thisGen.availSched->getCurrentVal(); Real64 Pel = PelInput; // get data to check if sufficient flow available from Plant @@ -280,7 +280,7 @@ namespace GeneratorDynamicsManager { double(state.dataGlobal->DayOfSim) + (int(state.dataGlobal->CurrentTime) + (SysTimeElapsed + (state.dataGlobal->CurrentTime - int(state.dataGlobal->CurrentTime) - TimeStepSys))) / - Constant::HoursInDay; + Constant::rHoursInDay; } else { // warm up period is less than a single system time step newOpMode = DataGenerators::OperatingMode::Normal; @@ -323,7 +323,7 @@ namespace GeneratorDynamicsManager { double(state.dataGlobal->DayOfSim) + (int(state.dataGlobal->CurrentTime) + (SysTimeElapsed + (state.dataGlobal->CurrentTime - int(state.dataGlobal->CurrentTime)))) / - Constant::HoursInDay; + Constant::rHoursInDay; } else { newOpMode = DataGenerators::OperatingMode::Off; } @@ -340,7 +340,7 @@ namespace GeneratorDynamicsManager { double(state.dataGlobal->DayOfSim) + (int(state.dataGlobal->CurrentTime) + (SysTimeElapsed + (state.dataGlobal->CurrentTime - int(state.dataGlobal->CurrentTime)))) / - Constant::HoursInDay; + Constant::rHoursInDay; } else { newOpMode = DataGenerators::OperatingMode::Standby; @@ -356,12 +356,12 @@ namespace GeneratorDynamicsManager { Real64 CurrentFractionalDay = double(state.dataGlobal->DayOfSim) + (int(state.dataGlobal->CurrentTime) + (SysTimeElapsed + (state.dataGlobal->CurrentTime - int(state.dataGlobal->CurrentTime)))) / - Constant::HoursInDay; - Real64 EndingFractionalDay = thisGen.FractionalDayofLastStartUp + thisGen.StartUpTimeDelay / Constant::HoursInDay; + Constant::rHoursInDay; + Real64 EndingFractionalDay = thisGen.FractionalDayofLastStartUp + thisGen.StartUpTimeDelay / Constant::rHoursInDay; if ((std::abs(CurrentFractionalDay - EndingFractionalDay) < 0.000001) || (CurrentFractionalDay > EndingFractionalDay)) { newOpMode = DataGenerators::OperatingMode::Normal; PLRStartUp = true; - Real64 LastSystemTimeStepFractionalDay = CurrentFractionalDay - (TimeStepSys / Constant::HoursInDay); + Real64 LastSystemTimeStepFractionalDay = CurrentFractionalDay - (TimeStepSys / Constant::rHoursInDay); PLRforSubtimestepStartUp = ((CurrentFractionalDay - EndingFractionalDay) / (CurrentFractionalDay - LastSystemTimeStepFractionalDay)); } else { @@ -407,7 +407,7 @@ namespace GeneratorDynamicsManager { thisGen.FractionalDayofLastShutDown = double(state.dataGlobal->DayOfSim) + (int(state.dataGlobal->CurrentTime) + (SysTimeElapsed + (state.dataGlobal->CurrentTime - int(state.dataGlobal->CurrentTime)))) / - Constant::HoursInDay; + Constant::rHoursInDay; } else { // cool down period is less than a single system time step if (SchedVal != 0.0) { newOpMode = DataGenerators::OperatingMode::Standby; @@ -421,7 +421,7 @@ namespace GeneratorDynamicsManager { thisGen.FractionalDayofLastShutDown = double(state.dataGlobal->DayOfSim) + (int(state.dataGlobal->CurrentTime) + (SysTimeElapsed + (state.dataGlobal->CurrentTime - int(state.dataGlobal->CurrentTime)))) / - Constant::HoursInDay; + Constant::rHoursInDay; } } else { @@ -438,15 +438,15 @@ namespace GeneratorDynamicsManager { Real64 CurrentFractionalDay = double(state.dataGlobal->DayOfSim) + (int(state.dataGlobal->CurrentTime) + (SysTimeElapsed + (state.dataGlobal->CurrentTime - int(state.dataGlobal->CurrentTime)))) / - Constant::HoursInDay; + Constant::rHoursInDay; Real64 EndingFractionalDay = - thisGen.FractionalDayofLastShutDown + thisGen.CoolDownDelay / Constant::HoursInDay - (TimeStepSys / Constant::HoursInDay); + thisGen.FractionalDayofLastShutDown + thisGen.CoolDownDelay / Constant::rHoursInDay - (TimeStepSys / Constant::rHoursInDay); if ((std::abs(CurrentFractionalDay - EndingFractionalDay) < 0.000001) || (CurrentFractionalDay > EndingFractionalDay)) { // CurrentFractionalDay == EndingFractionalDay newOpMode = DataGenerators::OperatingMode::Off; PLRShutDown = true; - Real64 LastSystemTimeStepFractionalDay = CurrentFractionalDay - (TimeStepSys / Constant::HoursInDay); - PLRforSubtimestepShutDown = (EndingFractionalDay - LastSystemTimeStepFractionalDay) * Constant::HoursInDay / TimeStepSys; + Real64 LastSystemTimeStepFractionalDay = CurrentFractionalDay - (TimeStepSys / Constant::rHoursInDay); + PLRforSubtimestepShutDown = (EndingFractionalDay - LastSystemTimeStepFractionalDay) * Constant::rHoursInDay / TimeStepSys; } else { // CurrentFractionalDay > EndingFractionalDay newOpMode = DataGenerators::OperatingMode::CoolDown; } @@ -460,15 +460,15 @@ namespace GeneratorDynamicsManager { Real64 CurrentFractionalDay = double(state.dataGlobal->DayOfSim) + (int(state.dataGlobal->CurrentTime) + (SysTimeElapsed + (state.dataGlobal->CurrentTime - int(state.dataGlobal->CurrentTime)))) / - Constant::HoursInDay; + Constant::rHoursInDay; Real64 EndingFractionalDay = - thisGen.FractionalDayofLastShutDown + thisGen.CoolDownDelay / Constant::HoursInDay - (TimeStepSys / Constant::HoursInDay); + thisGen.FractionalDayofLastShutDown + thisGen.CoolDownDelay / Constant::rHoursInDay - (TimeStepSys / Constant::rHoursInDay); if ((std::abs(CurrentFractionalDay - EndingFractionalDay) < 0.000001) || (CurrentFractionalDay > EndingFractionalDay)) { // CurrentFractionalDay == EndingFractionalDay newOpMode = DataGenerators::OperatingMode::Standby; PLRShutDown = true; - Real64 LastSystemTimeStepFractionalDay = CurrentFractionalDay - (TimeStepSys / Constant::HoursInDay); - PLRforSubtimestepShutDown = (EndingFractionalDay - LastSystemTimeStepFractionalDay) * Constant::HoursInDay / TimeStepSys; + Real64 LastSystemTimeStepFractionalDay = CurrentFractionalDay - (TimeStepSys / Constant::rHoursInDay); + PLRforSubtimestepShutDown = (EndingFractionalDay - LastSystemTimeStepFractionalDay) * Constant::rHoursInDay / TimeStepSys; } else { // CurrentFractionalDay < EndingFractionalDay newOpMode = DataGenerators::OperatingMode::CoolDown; } @@ -485,9 +485,9 @@ namespace GeneratorDynamicsManager { Real64 CurrentFractionalDay = double(state.dataGlobal->DayOfSim) + (int(state.dataGlobal->CurrentTime) + (SysTimeElapsed + (state.dataGlobal->CurrentTime - int(state.dataGlobal->CurrentTime)))) / - Constant::HoursInDay; - Real64 EndingFractionalDay = - thisGen.FractionalDayofLastShutDown + thisGen.CoolDownDelay / Constant::HoursInDay - (TimeStepSys / Constant::HoursInDay); + Constant::rHoursInDay; + Real64 EndingFractionalDay = thisGen.FractionalDayofLastShutDown + thisGen.CoolDownDelay / Constant::rHoursInDay - + (TimeStepSys / Constant::rHoursInDay); if ((std::abs(CurrentFractionalDay - EndingFractionalDay) < 0.000001) || (CurrentFractionalDay < EndingFractionalDay)) { // CurrentFractionalDay == EndingFractionalDay @@ -495,8 +495,8 @@ namespace GeneratorDynamicsManager { } else { // CurrentFractionalDay > EndingFractionalDay // could go to warm up or normal now PLRShutDown = true; - Real64 LastSystemTimeStepFractionalDay = CurrentFractionalDay - (TimeStepSys / Constant::HoursInDay); - PLRforSubtimestepShutDown = (EndingFractionalDay - LastSystemTimeStepFractionalDay) * Constant::HoursInDay / TimeStepSys; + Real64 LastSystemTimeStepFractionalDay = CurrentFractionalDay - (TimeStepSys / Constant::rHoursInDay); + PLRforSubtimestepShutDown = (EndingFractionalDay - LastSystemTimeStepFractionalDay) * Constant::rHoursInDay / TimeStepSys; if (thisGen.StartUpTimeDelay == 0.0) { newOpMode = DataGenerators::OperatingMode::Normal; // possible PLR on start up. @@ -519,7 +519,7 @@ namespace GeneratorDynamicsManager { double(state.dataGlobal->DayOfSim) + (int(state.dataGlobal->CurrentTime) + (SysTimeElapsed + (state.dataGlobal->CurrentTime - int(state.dataGlobal->CurrentTime) - TimeStepSys))) / - Constant::HoursInDay; + Constant::rHoursInDay; } } } @@ -527,7 +527,7 @@ namespace GeneratorDynamicsManager { newOpMode = DataGenerators::OperatingMode::Standby; } - } else { // not mandetory cool donw + } else { // not mandatory cool down // likely to go into warm up but if no warm up then back to normal if (thisGen.WarmUpByTimeDelay) { if (thisGen.StartUpTimeDelay == 0.0) { @@ -537,14 +537,14 @@ namespace GeneratorDynamicsManager { Real64 CurrentFractionalDay = double(state.dataGlobal->DayOfSim) + (int(state.dataGlobal->CurrentTime) + (SysTimeElapsed + (state.dataGlobal->CurrentTime - int(state.dataGlobal->CurrentTime)))) / - Constant::HoursInDay; - Real64 EndingFractionalDay = thisGen.FractionalDayofLastShutDown + thisGen.CoolDownDelay / Constant::HoursInDay; + Constant::rHoursInDay; + Real64 EndingFractionalDay = thisGen.FractionalDayofLastShutDown + thisGen.CoolDownDelay / Constant::rHoursInDay; if ((std::abs(CurrentFractionalDay - EndingFractionalDay) < 0.000001) || (CurrentFractionalDay > EndingFractionalDay)) { // CurrentFractionalDay == EndingFractionalDay newOpMode = DataGenerators::OperatingMode::Normal; // possible PLR on start up. PLRStartUp = true; - Real64 LastSystemTimeStepFractionalDay = CurrentFractionalDay - (TimeStepSys / Constant::HoursInDay); + Real64 LastSystemTimeStepFractionalDay = CurrentFractionalDay - (TimeStepSys / Constant::rHoursInDay); PLRforSubtimestepStartUp = ((CurrentFractionalDay - EndingFractionalDay) / (CurrentFractionalDay - LastSystemTimeStepFractionalDay)); } else { @@ -555,7 +555,7 @@ namespace GeneratorDynamicsManager { double(state.dataGlobal->DayOfSim) + (int(state.dataGlobal->CurrentTime) + (SysTimeElapsed + (state.dataGlobal->CurrentTime - int(state.dataGlobal->CurrentTime) - TimeStepSys))) / - Constant::HoursInDay; + Constant::rHoursInDay; } } } @@ -747,7 +747,7 @@ namespace GeneratorDynamicsManager { // common place to figure flow rates with internal flow control // METHODOLOGY EMPLOYED: - // apply contraints imposed by plant according to flow lock, first HVAC iteration etc. + // apply constraints imposed by plant according to flow lock, first HVAC iteration etc. // Return value Real64 FuncDetermineCWMdotForInternalFlowControl; diff --git a/src/EnergyPlus/GeneratorDynamicsManager.hh b/src/EnergyPlus/GeneratorDynamicsManager.hh index de10999e7e4..03d24cc3169 100644 --- a/src/EnergyPlus/GeneratorDynamicsManager.hh +++ b/src/EnergyPlus/GeneratorDynamicsManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/GeneratorFuelSupply.cc b/src/EnergyPlus/GeneratorFuelSupply.cc index ebbe59af1ac..c8d8e339fec 100644 --- a/src/EnergyPlus/GeneratorFuelSupply.cc +++ b/src/EnergyPlus/GeneratorFuelSupply.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -77,7 +77,7 @@ namespace GeneratorFuelSupply { // reused among some generators to define gaseous fuel chemistry, optional compressor) // Module containing the routines dealing with the fuel supply for some generators - // different generator modules can reuse the same fuel supply code, hence a seperate module + // different generator modules can reuse the same fuel supply code, hence a separate module // MODULE INFORMATION: // AUTHOR B Griffith @@ -100,6 +100,7 @@ namespace GeneratorFuelSupply { // RE-ENGINEERED this module extracted from older SOFC module for // reuse with both Annex 42 models, + static constexpr std::string_view routineName = "GetGeneratorFuelSupplyInput"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: // INTEGER :: GeneratorNum !Generator counter Array1D_string AlphArray(25); // character string data @@ -134,6 +135,7 @@ namespace GeneratorFuelSupply { state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, AlphArray(1)}; state.dataGenerator->FuelSupply(FuelSupNum).Name = AlphArray(1); if (Util::SameString("TemperatureFromAirNode", AlphArray(2))) { state.dataGenerator->FuelSupply(FuelSupNum).FuelTempMode = DataGenerators::FuelTemperatureMode::FuelInTempFromNode; @@ -157,13 +159,11 @@ namespace GeneratorFuelSupply { NodeInputManager::CompFluidStream::Primary, DataLoopNode::ObjectIsNotParent); - state.dataGenerator->FuelSupply(FuelSupNum).SchedNum = ScheduleManager::GetScheduleIndex(state, AlphArray(4)); - if ((state.dataGenerator->FuelSupply(FuelSupNum).SchedNum == 0) && - (state.dataGenerator->FuelSupply(FuelSupNum).FuelTempMode == DataGenerators::FuelTemperatureMode::FuelInTempSchedule)) { - ShowSevereError(state, format("Invalid, {} = {}", state.dataIPShortCut->cAlphaFieldNames(4), AlphArray(4))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, AlphArray(1))); - ShowContinueError(state, "Schedule named was not found"); - ErrorsFound = true; + if (state.dataGenerator->FuelSupply(FuelSupNum).FuelTempMode == DataGenerators::FuelTemperatureMode::FuelInTempSchedule) { + if ((state.dataGenerator->FuelSupply(FuelSupNum).sched = Sched::GetSchedule(state, AlphArray(4))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(4), AlphArray(4)); + ErrorsFound = true; + } } state.dataGenerator->FuelSupply(FuelSupNum).CompPowerCurveID = Curve::GetCurveIndex(state, AlphArray(5)); diff --git a/src/EnergyPlus/GeneratorFuelSupply.hh b/src/EnergyPlus/GeneratorFuelSupply.hh index a612372720b..ae1bbf29031 100644 --- a/src/EnergyPlus/GeneratorFuelSupply.hh +++ b/src/EnergyPlus/GeneratorFuelSupply.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -70,6 +70,10 @@ struct GeneratorFuelSupplyData : BaseGlobalStruct bool MyOneTimeFlag = true; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/GlobalNames.cc b/src/EnergyPlus/GlobalNames.cc index 85029613843..eff1126395c 100644 --- a/src/EnergyPlus/GlobalNames.cc +++ b/src/EnergyPlus/GlobalNames.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/GlobalNames.hh b/src/EnergyPlus/GlobalNames.hh index e5ca827a7a2..0e73ad13e78 100644 --- a/src/EnergyPlus/GlobalNames.hh +++ b/src/EnergyPlus/GlobalNames.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -145,6 +145,10 @@ struct GlobalNamesData : BaseGlobalStruct std::unordered_map CoilNames; std::unordered_map aDUNames; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/GroundHeatExchangers.cc b/src/EnergyPlus/GroundHeatExchangers.cc index 7c86b973419..d7b496bacee 100644 --- a/src/EnergyPlus/GroundHeatExchangers.cc +++ b/src/EnergyPlus/GroundHeatExchangers.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -47,6 +47,7 @@ // C++ Headers #include +#include #include // ObjexxFCL Headers @@ -246,9 +247,12 @@ GLHESlinky::GLHESlinky(EnergyPlusData &state, std::string const &objName, nlohma } // Initialize ground temperature model and get pointer reference - std::string const gtmType = Util::makeUPPER(j["undisturbed_ground_temperature_model_type"].get()); + GroundTemp::ModelType gtmType = static_cast( + getEnumValue(GroundTemp::modelTypeNamesUC, Util::makeUPPER(j["undisturbed_ground_temperature_model_type"].get()))); + assert(gtmType != GroundTemp::ModelType::Invalid); + std::string const gtmName = Util::makeUPPER(j["undisturbed_ground_temperature_model_name"].get()); - this->groundTempModel = GetGroundTempModelAndInit(state, gtmType, gtmName); + this->groundTempModel = GroundTemp::GetGroundTempModelAndInit(state, gtmType, gtmName); // Check for Errors if (errorsFound) { @@ -411,10 +415,13 @@ GLHEVert::GLHEVert(EnergyPlusData &state, std::string const &objName, nlohmann:: state.dataGroundHeatExchanger->prevTimeSteps.allocate(static_cast((this->SubAGG + 1) * maxTSinHr + 1)); state.dataGroundHeatExchanger->prevTimeSteps = 0.0; + GroundTemp::ModelType modelType = static_cast( + getEnumValue(GroundTemp::modelTypeNamesUC, Util::makeUPPER(j["undisturbed_ground_temperature_model_type"].get()))); + assert(modelType != GroundTemp::ModelType::Invalid); + // Initialize ground temperature model and get pointer reference - this->groundTempModel = GetGroundTempModelAndInit(state, - Util::makeUPPER(j["undisturbed_ground_temperature_model_type"].get()), - Util::makeUPPER(j["undisturbed_ground_temperature_model_name"].get())); + this->groundTempModel = + GroundTemp::GetGroundTempModelAndInit(state, modelType, Util::makeUPPER(j["undisturbed_ground_temperature_model_name"].get())); // Check for Errors if (errorsFound) { @@ -487,12 +494,10 @@ GLHEResponseFactors::GLHEResponseFactors(EnergyPlusData &state, std::string cons } this->numGFuncPairs = static_cast(tmpLntts.size()); - this->LNTTS.dimension(this->numGFuncPairs, 0.0); - this->GFNC.dimension(this->numGFuncPairs, 0.0); for (int i = 1; i <= (int)tmpLntts.size(); ++i) { - this->LNTTS(i) = tmpLntts[i - 1]; - this->GFNC(i) = tmpGvals[i - 1]; + this->LNTTS.push_back(tmpLntts[i - 1]); + this->GFNC.push_back(tmpGvals[i - 1]); } } @@ -649,7 +654,7 @@ BuildAndGetResponseFactorsObjectFromSingleBHs(EnergyPlusData &state, std::vector // Make new props object which has the mean values of the other props objects referenced by the individual BH objects std::shared_ptr thisProps(new GLHEVertProps); thisProps->name = format("Response Factor Auto Generated Mean Props No: {}", state.dataGroundHeatExchanger->numAutoGeneratedResponseFactors + 1); - for (auto &thisBH : state.dataGroundHeatExchanger->singleBoreholesVector) { + for (auto &thisBH : singleBHsForRFVect) { thisProps->bhDiameter += thisBH->props->bhDiameter; thisProps->bhLength += thisBH->props->bhLength; thisProps->bhTopDepth += thisBH->props->bhTopDepth; @@ -962,18 +967,12 @@ void GLHEVert::calcUniformBHWallTempGFunctions(EnergyPlusData &state) boreholes.emplace_back(bh->props->bhLength, bh->props->bhTopDepth, bh->props->bhDiameter / 2.0, bh->xLoc, bh->yLoc); } - // convert time to a std::vector from an Array1D - std::vector time; - for (auto &v : this->myRespFactors->time) { - time.push_back(v); - } - // Obtain number of segments by adaptive discretization gt::segments::adaptive adptDisc; int nSegments = adptDisc.discretize(this->bhLength, this->totalTubeLength); - this->myRespFactors->GFNC = - gt::gfunction::uniform_borehole_wall_temperature(boreholes, time, this->soil.diffusivity, nSegments, true, state.dataGlobal->numThread); + this->myRespFactors->GFNC = gt::gfunction::uniform_borehole_wall_temperature( + boreholes, this->myRespFactors->time, this->soil.diffusivity, nSegments, true, state.dataGlobal->numThread); } //****************************************************************************** @@ -989,8 +988,8 @@ void GLHEVert::calcGFunctions(EnergyPlusData &state) // save data for later if (state.files.outputControl.glhe && !state.dataSysVars->DisableGLHECaching) { - myCacheData["Response Factors"]["time"] = std::vector(this->myRespFactors->time.begin(), this->myRespFactors->time.end()); - myCacheData["Response Factors"]["LNTTS"] = std::vector(this->myRespFactors->LNTTS.begin(), this->myRespFactors->LNTTS.end()); + myCacheData["Response Factors"]["time"] = std::vector(this->myRespFactors->time); + myCacheData["Response Factors"]["LNTTS"] = std::vector(this->myRespFactors->LNTTS); myCacheData["Response Factors"]["GFNC"] = std::vector(this->myRespFactors->GFNC.begin(), this->myRespFactors->GFNC.end()); writeGLHECacheToFile(state); } @@ -1018,24 +1017,19 @@ void GLHEVert::setupTimeVectors() // Determine how many g-function pairs to generate based on user defined maximum simulation time while (true) { Real64 maxPossibleSimTime = exp(tempLNTTS.back()) * t_s; - if (maxPossibleSimTime < this->myRespFactors->maxSimYears * numDaysInYear * Constant::HoursInDay * Constant::SecInHour) { + if (maxPossibleSimTime < this->myRespFactors->maxSimYears * numDaysInYear * Constant::rHoursInDay * Constant::rSecsInHour) { tempLNTTS.push_back(tempLNTTS.back() + lnttsStepSize); } else { break; } } - // Setup the arrays - this->myRespFactors->time.dimension(tempLNTTS.size(), 0.0); - this->myRespFactors->LNTTS.dimension(tempLNTTS.size(), 0.0); - this->myRespFactors->GFNC.dimension(tempLNTTS.size(), 0.0); - - int index = 1; - for (auto const &thisLNTTS : tempLNTTS) { - this->myRespFactors->time(index) = exp(thisLNTTS) * t_s; - this->myRespFactors->LNTTS(index) = thisLNTTS; - ++index; - } + this->myRespFactors->LNTTS = tempLNTTS; + this->myRespFactors->time = tempLNTTS; + std::transform(this->myRespFactors->time.begin(), this->myRespFactors->time.end(), this->myRespFactors->time.begin(), [&t_s](auto const &c) { + return exp(c) * t_s; + }); + this->myRespFactors->GFNC = std::vector(tempLNTTS.size(), 0.0); } //****************************************************************************** @@ -1045,15 +1039,15 @@ void GLHEVert::calcUniformHeatFluxGFunctions(EnergyPlusData &state) DisplayString(state, "Initializing GroundHeatExchanger:System: " + this->name); // Calculate the g-functions - for (size_t lntts_index = 1; lntts_index <= this->myRespFactors->LNTTS.size(); ++lntts_index) { + for (size_t lntts_index = 0; lntts_index < this->myRespFactors->LNTTS.size(); ++lntts_index) { for (auto const &bh_i : this->myRespFactors->myBorholes) { Real64 sum_T_ji = 0; for (auto const &bh_j : this->myRespFactors->myBorholes) { - sum_T_ji += doubleIntegral(bh_i, bh_j, this->myRespFactors->time(lntts_index)); + sum_T_ji += doubleIntegral(bh_i, bh_j, this->myRespFactors->time[lntts_index]); } - this->myRespFactors->GFNC(lntts_index) += sum_T_ji; + this->myRespFactors->GFNC[lntts_index] += sum_T_ji; } - this->myRespFactors->GFNC(lntts_index) /= (2 * this->totalTubeLength); + this->myRespFactors->GFNC[lntts_index] /= (2 * this->totalTubeLength); std::stringstream ss; ss << std::fixed << std::setprecision(1) << float(lntts_index) / this->myRespFactors->LNTTS.size() * 100; @@ -1137,16 +1131,8 @@ void GLHEVert::calcShortTimestepGFunctions(EnergyPlusData &state) Real64 bh_equivalent_resistance_convection = bhResistance - bh_equivalent_resistance_tube_grout; Real64 initial_temperature = this->inletTemp; - Real64 cpFluid_init = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - initial_temperature, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); - Real64 fluidDensity_init = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - initial_temperature, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 cpFluid_init = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, initial_temperature, RoutineName); + Real64 fluidDensity_init = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, initial_temperature, RoutineName); // initialize the fluid cells for (int i = 0; i < num_fluid_cells; ++i) { @@ -1335,7 +1321,7 @@ void GLHEVert::calcShortTimestepGFunctions(EnergyPlusData &state) //****************************************************************************** -std::vector TDMA(std::vector a, std::vector b, std::vector c, std::vector d) +std::vector TDMA(std::vector const &a, std::vector const &b, std::vector &c, std::vector &d) { // from: https://en.wikibooks.org/wiki/Algorithm_Implementation/Linear_Algebra/Tridiagonal_matrix_algorithm#C.2B.2B @@ -1375,25 +1361,18 @@ void GLHEVert::combineShortAndLongTimestepGFunctions() } // Add the rest of the long time-step g-functions to the combined curve - for (int index_longTS = this->myRespFactors->GFNC.l(); index_longTS <= this->myRespFactors->GFNC.u(); ++index_longTS) { - GFNC_combined.push_back(this->myRespFactors->GFNC(index_longTS)); - LNTTS_combined.push_back(this->myRespFactors->LNTTS(index_longTS)); + for (int index_longTS = 0; index_longTS < this->myRespFactors->GFNC.size(); ++index_longTS) { + GFNC_combined.push_back(this->myRespFactors->GFNC[index_longTS]); + LNTTS_combined.push_back(this->myRespFactors->LNTTS[index_longTS]); } - // Move combined values into right data struct - this->myRespFactors->time.deallocate(); - this->myRespFactors->LNTTS.deallocate(); - this->myRespFactors->GFNC.deallocate(); - - this->myRespFactors->time.dimension(GFNC_combined.size(), 0.0); - this->myRespFactors->LNTTS.dimension(GFNC_combined.size(), 0.0); - this->myRespFactors->GFNC.dimension(GFNC_combined.size(), 0.0); + this->myRespFactors->time = LNTTS_combined; + std::transform(this->myRespFactors->time.begin(), this->myRespFactors->time.end(), this->myRespFactors->time.begin(), [&t_s](auto const &c) { + return exp(c) * t_s; + }); - for (unsigned int index = 0; index < GFNC_combined.size(); ++index) { - this->myRespFactors->time[index] = exp(LNTTS_combined[index]) * t_s; - this->myRespFactors->LNTTS[index] = LNTTS_combined[index]; - this->myRespFactors->GFNC[index] = GFNC_combined[index]; - } + this->myRespFactors->LNTTS = LNTTS_combined; + this->myRespFactors->GFNC = GFNC_combined; } void GLHEBase::makeThisGLHECacheAndCompareWithFileCache(EnergyPlusData &state) @@ -1460,13 +1439,13 @@ void GLHEVert::readCacheFileAndCompareWithThisGLHECache(EnergyPlusData &state) if (gFunctionsExist) { // Populate the time array - this->myRespFactors->time = Array1D(myCacheData["Response Factors"]["time"].get>()); + this->myRespFactors->time = std::vector(myCacheData["Response Factors"]["time"].get>()); // Populate the lntts array - this->myRespFactors->LNTTS = Array1D(myCacheData["Response Factors"]["LNTTS"].get>()); + this->myRespFactors->LNTTS = std::vector(myCacheData["Response Factors"]["LNTTS"].get>()); // Populate the g-function array - this->myRespFactors->GFNC = Array1D(myCacheData["Response Factors"]["GFNC"].get>()); + this->myRespFactors->GFNC = std::vector(myCacheData["Response Factors"]["GFNC"].get>()); } } @@ -1522,18 +1501,13 @@ void GLHESlinky::calcGFunctions(EnergyPlusData &state) int NPairs = static_cast((tLg_max - tLg_min) / (tLg_grid) + 1); // Allocate and setup g-function arrays - this->myRespFactors->GFNC.allocate(NPairs); - this->myRespFactors->LNTTS.allocate(NPairs); + this->myRespFactors->GFNC = std::vector(NPairs, 0.0); + this->myRespFactors->LNTTS = std::vector(NPairs, 0.0); this->QnMonthlyAgg.allocate(static_cast(this->maxSimYears * 12)); this->QnHr.allocate(730 + this->AGG + this->SubAGG); this->QnSubHr.allocate(static_cast((this->SubAGG + 1) * maxTSinHr + 1)); this->LastHourN.allocate(this->SubAGG + 1); - for (int i = 1; i <= NPairs; ++i) { - this->myRespFactors->GFNC(i) = 0.0; - this->myRespFactors->LNTTS(i) = 0.0; - } - // Calculate the number of loops (per trench) and number of trenches to be involved // Due to the symmetry of a slinky GHX field, we need only calculate about // on quarter of the rings' tube wall temperature perturbation to get the @@ -1652,8 +1626,8 @@ void GLHESlinky::calcGFunctions(EnergyPlusData &state) } // n1 } // m1 - this->myRespFactors->GFNC(NT) = (gFunc * (this->coilDiameter / 2.0)) / (4 * Constant::Pi * fraction * this->numTrenches * this->numCoils); - this->myRespFactors->LNTTS(NT) = tLg; + this->myRespFactors->GFNC[NT - 1] = (gFunc * (this->coilDiameter / 2.0)) / (4 * Constant::Pi * fraction * this->numTrenches * this->numCoils); + this->myRespFactors->LNTTS[NT - 1] = tLg; } // NT time } @@ -1834,7 +1808,7 @@ inline bool GLHEBase::isEven(int const val) //****************************************************************************** -Real64 GLHESlinky::integral(int const m, int const n, int const m1, int const n1, Real64 const t, Real64 const eta, Real64 const J0) +Real64 GLHESlinky::integral(int const m, int const n, int const m1, int const n1, Real64 const t, Real64 const eta, int const J0) { // SUBROUTINE INFORMATION: // AUTHOR: Matt Mitchell @@ -1848,33 +1822,28 @@ Real64 GLHESlinky::integral(int const m, int const n, int const m1, int const n1 // Simpson's 1/3 rule of integration // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 sumIntF = 0.0; Real64 theta = 0.0; constexpr Real64 theta1 = 0.0; constexpr Real64 theta2 = 2 * Constant::Pi; - Array1D f(J0, 0.0); + std::vector f; Real64 h = (theta2 - theta1) / (J0 - 1); // Calculate the function at various equally spaced x values - for (int j = 1; j <= J0; ++j) { - - theta = theta1 + (j - 1) * h; - - f(j) = nearFieldResponseFunction(m, n, m1, n1, eta, theta, t); + for (int j = 0; j < J0; ++j) { + theta = theta1 + j * h; + f.push_back(nearFieldResponseFunction(m, n, m1, n1, eta, theta, t)); + } - if (j == 1 || j == J0) { - f(j) = f(j); - } else if (isEven(j)) { - f(j) = 4 * f(j); + for (int j = 1; j < J0 - 1; ++j) { + if (!isEven(j)) { + f[j] = 4 * f[j]; } else { - f(j) = 2 * f(j); + f[j] = 2 * f[j]; } - - sumIntF += f(j); } - return (h / 3) * sumIntF; + return (h / 3) * std::reduce(f.begin(), f.end()); } //****************************************************************************** @@ -1896,29 +1865,25 @@ Real64 GLHESlinky::doubleIntegral(int const m, int const n, int const m1, int co constexpr Real64 eta1 = 0.0; constexpr Real64 eta2 = 2 * Constant::Pi; - Real64 sumIntF = 0.0; - Array1D g(I0, 0.0); + std::vector g; Real64 h = (eta2 - eta1) / (I0 - 1); // Calculates the value of the function at various equally spaced values - for (int i = 1; i <= I0; ++i) { - - Real64 eta = eta1 + (i - 1) * h; - g(i) = integral(m, n, m1, n1, t, eta, J0); + for (int i = 0; i < I0; ++i) { + Real64 eta = eta1 + i * h; + g.push_back(integral(m, n, m1, n1, t, eta, J0)); + } - if (i == 1 || i == I0) { - g(i) = g(i); - } else if (isEven(i)) { - g(i) = 4 * g(i); + for (int i = 1; i < g.size() - 1; ++i) { + if (!isEven(i)) { + g[i] = 4 * g[i]; } else { - g(i) = 2 * g(i); + g[i] = 2 * g[i]; } - - sumIntF += g(i); } - return (h / 3) * sumIntF; + return (h / 3) * std::reduce(g.begin(), g.end()); } //****************************************************************************** @@ -1934,7 +1899,7 @@ void GLHEVert::getAnnualTimeConstant() constexpr Real64 hrInYear = 8760; - this->timeSS = (pow_2(this->bhLength) / (9.0 * this->soil.diffusivity)) / Constant::SecInHour / hrInYear; + this->timeSS = (pow_2(this->bhLength) / (9.0 * this->soil.diffusivity)) / Constant::rSecsInHour / hrInYear; // Excuse me? this->timeSSFactor = this->timeSS * 8760.0; } @@ -2004,11 +1969,7 @@ void GLHEBase::calcGroundHeatExchanger(EnergyPlusData &state) this->inletTemp = state.dataLoopNodes->Node(this->inletNodeNum).Temp; - Real64 cpFluid = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->inletTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 cpFluid = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, this->inletTemp, RoutineName); Real64 kGroundFactor = 2.0 * Constant::Pi * this->soil.k; @@ -2031,7 +1992,7 @@ void GLHEBase::calcGroundHeatExchanger(EnergyPlusData &state) state.dataGroundHeatExchanger->currentSimTime = (state.dataGlobal->DayOfSim - 1) * 24 + state.dataGlobal->HourOfDay - 1 + (state.dataGlobal->TimeStep - 1) * state.dataGlobal->TimeStepZone + state.dataHVACGlobal->SysTimeElapsed; //+ TimeStepsys - state.dataGroundHeatExchanger->locHourOfDay = static_cast(mod(state.dataGroundHeatExchanger->currentSimTime, Constant::HoursInDay) + 1); + state.dataGroundHeatExchanger->locHourOfDay = static_cast(mod(state.dataGroundHeatExchanger->currentSimTime, Constant::iHoursInDay) + 1); state.dataGroundHeatExchanger->locDayOfSim = static_cast(state.dataGroundHeatExchanger->currentSimTime / 24 + 1); if (state.dataGlobal->DayOfSim > 1) { @@ -2275,20 +2236,12 @@ void GLHEBase::updateGHX(EnergyPlusData &state) state.dataLoopNodes->Node(this->outletNodeNum).Temp = this->outletTemp; state.dataLoopNodes->Node(this->outletNodeNum).Enthalpy = - this->outletTemp * FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->outletTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + this->outletTemp * state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, this->outletTemp, RoutineName); Real64 GLHEdeltaTemp = std::abs(this->outletTemp - this->inletTemp); if (GLHEdeltaTemp > deltaTempLimit && this->numErrorCalls < state.dataGroundHeatExchanger->numVerticalGLHEs && !state.dataGlobal->WarmupFlag) { - Real64 fluidDensity = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->inletTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 fluidDensity = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, this->inletTemp, RoutineName); this->designMassFlow = this->designFlow * fluidDensity; ShowWarningError(state, "Check GLHE design inputs & g-functions for consistency"); ShowContinueError(state, format("For GroundHeatExchanger: {}GLHE delta Temp > 100C.", this->name)); @@ -2347,11 +2300,11 @@ void GLHEBase::calcAggregateLoad(EnergyPlusData &state) } // CHECK IF A MONTH PASSES... - if (mod(((state.dataGroundHeatExchanger->locDayOfSim - 1) * Constant::HoursInDay + (state.dataGroundHeatExchanger->locHourOfDay)), hrsPerMonth) == - 0 && + if (mod(((state.dataGroundHeatExchanger->locDayOfSim - 1) * Constant::iHoursInDay + (state.dataGroundHeatExchanger->locHourOfDay)), + hrsPerMonth) == 0 && this->prevHour != state.dataGroundHeatExchanger->locHourOfDay) { Real64 MonthNum = static_cast( - (state.dataGroundHeatExchanger->locDayOfSim * Constant::HoursInDay + state.dataGroundHeatExchanger->locHourOfDay) / hrsPerMonth); + (state.dataGroundHeatExchanger->locDayOfSim * Constant::iHoursInDay + state.dataGroundHeatExchanger->locHourOfDay) / hrsPerMonth); Real64 SumQnMonth = 0.0; for (int J = 1; J <= int(hrsPerMonth); ++J) { SumQnMonth += this->QnHr(J); @@ -2636,11 +2589,7 @@ Real64 GLHEVert::calcHXResistance(EnergyPlusData &state) } else { std::string_view const RoutineName = "calcBHResistance"; - Real64 const cpFluid = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->inletTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 const cpFluid = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, this->inletTemp, RoutineName); return calcBHAverageResistance(state) + 1 / (3 * calcBHTotalInternalResistance(state)) * pow_2(this->bhLength / (this->massFlowRate * cpFluid)); } @@ -2671,21 +2620,9 @@ Real64 GLHEVert::calcPipeConvectionResistance(EnergyPlusData &state) // Get fluid props this->inletTemp = state.dataLoopNodes->Node(this->inletNodeNum).Temp; - Real64 const cpFluid = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->inletTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); - Real64 const kFluid = FluidProperties::GetConductivityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->inletTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); - Real64 const fluidViscosity = FluidProperties::GetViscosityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->inletTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 const cpFluid = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, this->inletTemp, RoutineName); + Real64 const kFluid = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getConductivity(state, this->inletTemp, RoutineName); + Real64 const fluidViscosity = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getViscosity(state, this->inletTemp, RoutineName); // Smoothing fit limits constexpr Real64 lower_limit = 2000; @@ -2775,26 +2712,10 @@ Real64 GLHESlinky::calcHXResistance(EnergyPlusData &state) constexpr Real64 B = 350; constexpr Real64 laminarNusseltNo = 4.364; - Real64 cpFluid = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->inletTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); - Real64 kFluid = FluidProperties::GetConductivityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->inletTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); - Real64 fluidDensity = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->inletTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); - Real64 fluidViscosity = FluidProperties::GetViscosityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->inletTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 cpFluid = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, this->inletTemp, RoutineName); + Real64 kFluid = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getConductivity(state, this->inletTemp, RoutineName); + Real64 fluidDensity = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, this->inletTemp, RoutineName); + Real64 fluidViscosity = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getViscosity(state, this->inletTemp, RoutineName); // calculate mass flow rate Real64 singleSlinkyMassFlowRate = this->massFlowRate / this->numTrenches; @@ -2913,7 +2834,7 @@ void GLHEVert::initGLHESimVars(EnergyPlusData &state) // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 currTime = ((state.dataGlobal->DayOfSim - 1) * 24 + (state.dataGlobal->HourOfDay - 1) + (state.dataGlobal->TimeStep - 1) * state.dataGlobal->TimeStepZone + state.dataHVACGlobal->SysTimeElapsed) * - Constant::SecInHour; + Constant::rSecsInHour; if (this->myEnvrnFlag && state.dataGlobal->BeginEnvrnFlag) { this->initEnvironment(state, currTime); @@ -2951,11 +2872,7 @@ void GLHEVert::initEnvironment(EnergyPlusData &state, [[maybe_unused]] Real64 co std::string_view const RoutineName = "initEnvironment"; this->myEnvrnFlag = false; - Real64 fluidDensity = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - 20.0, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 fluidDensity = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, 20.0, RoutineName); this->designMassFlow = this->designFlow * fluidDensity; PlantUtilities::InitComponentNodes(state, 0.0, this->designMassFlow, this->inletNodeNum, this->outletNodeNum); @@ -2999,9 +2916,9 @@ void GLHESlinky::initGLHESimVars(EnergyPlusData &state) // DATE WRITTEN: August, 2000 // MODIFIED Arun Murugappan - Real64 CurTime = ((state.dataGlobal->DayOfSim - 1) * 24 + (state.dataGlobal->HourOfDay - 1) + + Real64 CurTime = ((state.dataGlobal->DayOfSim - 1) * Constant::rHoursInDay + (state.dataGlobal->HourOfDay - 1) + (state.dataGlobal->TimeStep - 1) * state.dataGlobal->TimeStepZone + state.dataHVACGlobal->SysTimeElapsed) * - Constant::SecInHour; + Constant::rSecsInHour; // Init more variables if (this->myEnvrnFlag && state.dataGlobal->BeginEnvrnFlag) { @@ -3026,11 +2943,7 @@ void GLHESlinky::initEnvironment(EnergyPlusData &state, Real64 const CurTime) std::string_view const RoutineName = "initEnvironment"; this->myEnvrnFlag = false; - Real64 fluidDensity = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - 20.0, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 fluidDensity = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, 20.0, RoutineName); this->designMassFlow = this->designFlow * fluidDensity; PlantUtilities::InitComponentNodes(state, 0.0, this->designMassFlow, this->inletNodeNum, this->outletNodeNum); diff --git a/src/EnergyPlus/GroundHeatExchangers.hh b/src/EnergyPlus/GroundHeatExchangers.hh index a8b5ff2db37..3e257484cab 100644 --- a/src/EnergyPlus/GroundHeatExchangers.hh +++ b/src/EnergyPlus/GroundHeatExchangers.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -58,7 +58,7 @@ #include #include #include -#include +#include #include #include #include @@ -70,9 +70,6 @@ struct EnergyPlusData; namespace GroundHeatExchangers { - // Using/Aliasing - using namespace GroundTemperatureManager; - struct ThermophysicalProps // LCOV_EXCL_LINE { // Destructor @@ -201,9 +198,9 @@ namespace GroundHeatExchangers { int numGFuncPairs; // Number of g-function pairs Real64 gRefRatio; // Reference ratio of g-function set Real64 maxSimYears; // Maximum length of simulation in years - Array1D time; // response time in seconds - Array1D LNTTS; // natural log of Non Dimensional Time Ln(t/ts) - Array1D GFNC; // G-function ( Non Dimensional temperature response factors) + std::vector time; // response time in seconds + std::vector LNTTS; // natural log of non-dimensional time Ln(t/ts) + std::vector GFNC; // g-function (non-dimensional temperature response factors) std::shared_ptr props; // Properties std::vector> myBorholes; // Boreholes used by this response factors object @@ -249,11 +246,11 @@ namespace GroundHeatExchangers { bool myEnvrnFlag; bool gFunctionsExist; Real64 lastQnSubHr; - Real64 HXResistance; // The thermal resistance of the GHX, (K per W/m) - Real64 totalTubeLength; // The total length of pipe. NumBoreholes * BoreholeDepth OR Pi * Dcoil * NumCoils - Real64 timeSS; // Steady state time - Real64 timeSSFactor; // Steady state time factor for calculation - std::shared_ptr groundTempModel; + Real64 HXResistance; // The thermal resistance of the GHX, (K per W/m) + Real64 totalTubeLength; // The total length of pipe. NumBoreholes * BoreholeDepth OR Pi * Dcoil * NumCoils + Real64 timeSS; // Steady state time + Real64 timeSSFactor; // Steady state time factor for calculation + GroundTemp::BaseGroundTempsModel *groundTempModel; // non-owning pointer // some statics pulled out into member variables bool firstTime; @@ -454,7 +451,7 @@ namespace GroundHeatExchangers { Real64 doubleIntegral(int m, int n, int m1, int n1, Real64 t, int I0, int J0); - Real64 integral(int m, int n, int m1, int n1, Real64 t, Real64 eta, Real64 J0); + Real64 integral(int m, int n, int m1, int n1, Real64 t, Real64 eta, int J0); Real64 distance(int m, int n, int m1, int n1, Real64 eta, Real64 theta); @@ -497,7 +494,7 @@ namespace GroundHeatExchangers { std::shared_ptr GetVertArray(EnergyPlusData &state, std::string const &objectName); - std::vector TDMA(std::vector a, std::vector b, std::vector c, std::vector d); + std::vector TDMA(std::vector const &a, std::vector const &b, std::vector &c, std::vector &d); } // namespace GroundHeatExchangers @@ -530,6 +527,10 @@ struct GroundHeatExchangerData : BaseGlobalStruct std::vector> responseFactorsVector; std::vector> singleBoreholesVector; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/GroundTemperatureModeling/BaseGroundTemperatureModel.hh b/src/EnergyPlus/GroundTemperatureModeling/BaseGroundTemperatureModel.hh index bb06d658b56..4afc797c31a 100644 --- a/src/EnergyPlus/GroundTemperatureModeling/BaseGroundTemperatureModel.hh +++ b/src/EnergyPlus/GroundTemperatureModeling/BaseGroundTemperatureModel.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -57,55 +57,99 @@ namespace EnergyPlus { // Forward declarations struct EnergyPlusData; -enum class GroundTempObjType -{ - Invalid = -1, - KusudaGroundTemp, - FiniteDiffGroundTemp, - SiteBuildingSurfaceGroundTemp, - SiteShallowGroundTemp, - SiteDeepGroundTemp, - SiteFCFactorMethodGroundTemp, - XingGroundTemp, - Num -}; +namespace GroundTemp { -// Base class -class BaseGroundTempsModel -{ -public: - // Public Members - GroundTempObjType objectType; - std::string objectName; - - virtual ~BaseGroundTempsModel() = default; - BaseGroundTempsModel(const BaseGroundTempsModel &) = delete; - BaseGroundTempsModel(BaseGroundTempsModel &&) = delete; - BaseGroundTempsModel &operator=(const BaseGroundTempsModel &) = delete; - BaseGroundTempsModel &operator=(BaseGroundTempsModel &&) = delete; - - // Default Constructor - BaseGroundTempsModel() : objectType(GroundTempObjType::Invalid) + enum class ModelType { - } + Invalid = -1, + Kusuda, + FiniteDiff, + SiteBuildingSurface, + SiteShallow, + SiteDeep, + SiteFCFactorMethod, + Xing, + Num + }; + + constexpr std::array modelTypeNamesUC = {"SITE:GROUNDTEMPERATURE:UNDISTURBED:KUSUDAACHENBACH", + "SITE:GROUNDTEMPERATURE:UNDISTURBED:FINITEDIFFERENCE", + "SITE:GROUNDTEMPERATURE:BUILDINGSURFACE", + "SITE:GROUNDTEMPERATURE:SHALLOW", + "SITE:GROUNDTEMPERATURE:DEEP", + "SITE:GROUNDTEMPERATURE:FCFACTORMETHOD", + "SITE:GROUNDTEMPERATURE:UNDISTURBED:XING"}; + + constexpr std::array modelTypeNames = {"Site:GroundTemperature:Undisturbed:KusudaAchenbach", + "Site:GroundTemperature:Undisturbed:FiniteDifference", + "Site:GroundTemperature:BuildingSurface", + "Site:GroundTemperature:Shallow", + "Site:GroundTemperature:Deep", + "Site:GroundTemperature:FCfactorMethod", + "Site:GroundTemperature:Undisturbed:Xing"}; + + // Base class + class BaseGroundTempsModel + { + public: + // Public Members + std::string Name; + ModelType modelType = ModelType::Invalid; + + BaseGroundTempsModel() = default; + virtual ~BaseGroundTempsModel() = default; + BaseGroundTempsModel(const BaseGroundTempsModel &) = delete; + BaseGroundTempsModel(BaseGroundTempsModel &&) = delete; + BaseGroundTempsModel &operator=(const BaseGroundTempsModel &) = delete; + BaseGroundTempsModel &operator=(BaseGroundTempsModel &&) = delete; + + // Virtual method for retrieving the ground temp + virtual Real64 getGroundTemp(EnergyPlusData &state) = 0; + + virtual Real64 getGroundTempAtTimeInSeconds(EnergyPlusData &state, Real64, Real64) = 0; // parameter names, this isn't K&R C - // Virtual method for retrieving the ground temp - virtual Real64 getGroundTemp(EnergyPlusData &state) = 0; + virtual Real64 getGroundTempAtTimeInMonths(EnergyPlusData &state, Real64, int) = 0; // parameter names, this isn't K&R C - virtual Real64 getGroundTempAtTimeInSeconds(EnergyPlusData &state, Real64 const, Real64 const) = 0; + protected: + static void write_ground_temps(InputOutputFile &os, const std::string &name, const Array1D &data) + { + print( + os, + "! " + ",Jan{{C}},Feb{{C}},Mar{{C}},Apr{{C}},May{{C}},Jun{{C}},Jul{{C}},Aug{{C}},Sep{{C}},Oct{{" + "C}},Nov{{C}},Dec{{C}}\n", + name); + print(os, " Site:GroundTemperature:{}, {}\n", name, fmt::format("{:6.2F}", fmt::join(data, ", "))); + } + }; - virtual Real64 getGroundTempAtTimeInMonths(EnergyPlusData &state, Real64 const, int const) = 0; + BaseGroundTempsModel *GetGroundTempModelAndInit(EnergyPlusData &state, ModelType modelType, std::string const &name); -protected: - static void write_ground_temps(InputOutputFile &os, const std::string &name, const Array1D &data) +} // namespace GroundTemp + +struct GroundTemperatureManagerData final : BaseGlobalStruct +{ + // all ground temperature model instances are owned here + // client component models can get pointers to the instances inside this vector, but they don't own them + std::vector groundTempModels; + + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + + void init_state([[maybe_unused]] EnergyPlusData &state) override { - print(os, - "! " - ",Jan{{C}},Feb{{C}},Mar{{C}},Apr{{C}},May{{C}},Jun{{C}},Jul{{C}},Aug{{C}},Sep{{C}},Oct{{" - "C}},Nov{{C}},Dec{{C}}\n", - name); - print(os, " Site:GroundTemperature:{}, {}\n", name, fmt::format("{:6.2F}", fmt::join(data, ", "))); } + + void clear_state() override + { + for (const auto &groundTempModel : groundTempModels) { + delete groundTempModel; + } + new (this) GroundTemperatureManagerData(); + } + + virtual ~GroundTemperatureManagerData() = default; }; } // namespace EnergyPlus diff --git a/src/EnergyPlus/GroundTemperatureModeling/FiniteDifferenceGroundTemperatureModel.cc b/src/EnergyPlus/GroundTemperatureModeling/FiniteDifferenceGroundTemperatureModel.cc index 7cb4a0bb2b1..8b293f0053b 100644 --- a/src/EnergyPlus/GroundTemperatureModeling/FiniteDifferenceGroundTemperatureModel.cc +++ b/src/EnergyPlus/GroundTemperatureModeling/FiniteDifferenceGroundTemperatureModel.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -47,11 +47,9 @@ // C++ Headers #include -#include // ObjexxFCL Headers #include -#include // EnergyPlus Headers #include @@ -61,7 +59,6 @@ #include #include #include -#include #include #include #include @@ -69,913 +66,890 @@ namespace EnergyPlus { -//****************************************************************************** +namespace GroundTemp { + //****************************************************************************** + + // Finite difference model factory + FiniteDiffGroundTempsModel *FiniteDiffGroundTempsModel::FiniteDiffGTMFactory(EnergyPlusData &state, const std::string &objectName) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 + + // PURPOSE OF THIS SUBROUTINE: + // Read input and creates instance of finite difference ground temp model + + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + bool found = false; + int NumNums; + int NumAlphas; + int IOStat; + + // New shared pointer for this model object + auto *thisModel = new FiniteDiffGroundTempsModel(); + + GroundTemp::ModelType modelType = GroundTemp::ModelType::FiniteDiff; + + // Search through finite diff models here + std::string_view const cCurrentModuleObject = GroundTemp::modelTypeNamesUC[(int)modelType]; + const int numCurrModels = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + + for (int modelNum = 1; modelNum <= numCurrModels; ++modelNum) { + + state.dataInputProcessing->inputProcessor->getObjectItem(state, + cCurrentModuleObject, + modelNum, + state.dataIPShortCut->cAlphaArgs, + NumAlphas, + state.dataIPShortCut->rNumericArgs, + NumNums, + IOStat); + + if (objectName == state.dataIPShortCut->cAlphaArgs(1)) { + // Read input into object here + + thisModel->modelType = modelType; + thisModel->Name = state.dataIPShortCut->cAlphaArgs(1); + thisModel->baseConductivity = state.dataIPShortCut->rNumericArgs(1); + thisModel->baseDensity = state.dataIPShortCut->rNumericArgs(2); + thisModel->baseSpecificHeat = state.dataIPShortCut->rNumericArgs(3); + thisModel->waterContent = state.dataIPShortCut->rNumericArgs(4) / 100.0; + thisModel->saturatedWaterContent = state.dataIPShortCut->rNumericArgs(5) / 100.0; + thisModel->evapotransCoeff = state.dataIPShortCut->rNumericArgs(6); + + found = true; + break; + } + } -// Finite difference model factory -std::shared_ptr FiniteDiffGroundTempsModel::FiniteDiffGTMFactory(EnergyPlusData &state, std::string objectName) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + if (found) { + state.dataGrndTempModelMgr->groundTempModels.push_back(thisModel); - // PURPOSE OF THIS SUBROUTINE: - // Read input and creates instance of finite difference ground temp model + // Simulate + thisModel->initAndSim(state); - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - bool found = false; - int NumNums; - int NumAlphas; - int IOStat; + // Return the pointer + return thisModel; + } - // New shared pointer for this model object - std::shared_ptr thisModel(new FiniteDiffGroundTempsModel()); + ShowFatalError(state, fmt::format("{}--Errors getting input for ground temperature model", GroundTemp::modelTypeNames[(int)modelType])); + return nullptr; + } - GroundTempObjType objType = GroundTempObjType::FiniteDiffGroundTemp; + //****************************************************************************** - // Search through finite diff models here - std::string_view const cCurrentModuleObject = GroundTemperatureManager::groundTempModelNamesUC[static_cast(objType)]; - int numCurrModels = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + void FiniteDiffGroundTempsModel::initAndSim(EnergyPlusData &state) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 - for (int modelNum = 1; modelNum <= numCurrModels; ++modelNum) { + // PURPOSE OF THIS SUBROUTINE: + // Initializes and simulates finite difference ground temps model - state.dataInputProcessing->inputProcessor->getObjectItem( - state, cCurrentModuleObject, modelNum, state.dataIPShortCut->cAlphaArgs, NumAlphas, state.dataIPShortCut->rNumericArgs, NumNums, IOStat); + getWeatherData(state); - if (objectName == state.dataIPShortCut->cAlphaArgs(1)) { - // Read input into object here + developMesh(); - thisModel->objectType = objType; - thisModel->objectName = state.dataIPShortCut->cAlphaArgs(1); - thisModel->baseConductivity = state.dataIPShortCut->rNumericArgs(1); - thisModel->baseDensity = state.dataIPShortCut->rNumericArgs(2); - thisModel->baseSpecificHeat = state.dataIPShortCut->rNumericArgs(3); - thisModel->waterContent = state.dataIPShortCut->rNumericArgs(4) / 100.0; - thisModel->saturatedWaterContent = state.dataIPShortCut->rNumericArgs(5) / 100.0; - thisModel->evapotransCoeff = state.dataIPShortCut->rNumericArgs(6); + performSimulation(state); + } - found = true; - break; + //****************************************************************************** + + void FiniteDiffGroundTempsModel::getWeatherData(EnergyPlusData &state) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 + + // PURPOSE OF THIS SUBROUTINE: + // Finds correct environment for reading all weather data. Loops over all weather data in weather file + // and data structure containing daily average of required weather data. + + // SUBROUTINE ARGUMENT DEFINITIONS: + // an environment is available to process + + // Save current environment so we can revert back when done + const int Envrn_reset = state.dataWeather->Envrn; + const Constant::KindOfSim KindOfSim_reset = state.dataGlobal->KindOfSim; + const int TimeStep_reset = state.dataGlobal->TimeStep; + const int HourOfDay_reset = state.dataGlobal->HourOfDay; + const bool BeginEnvrnFlag_reset = state.dataGlobal->BeginEnvrnFlag; + const bool EndEnvrnFlag_reset = state.dataGlobal->EndEnvrnFlag; + const bool EndMonthFlag_reset = state.dataEnvrn->EndMonthFlag; + const bool WarmupFlag_reset = state.dataGlobal->WarmupFlag; + const int DayOfSim_reset = state.dataGlobal->DayOfSim; + const std::string DayOfSimChr_reset = state.dataGlobal->DayOfSimChr; + const int NumOfWarmupDays_reset = state.dataReportFlag->NumOfWarmupDays; + const bool BeginDayFlag_reset = state.dataGlobal->BeginDayFlag; + const bool EndDayFlag_reset = state.dataGlobal->EndDayFlag; + const bool BeginHourFlag_reset = state.dataGlobal->BeginHourFlag; + const bool EndHourFlag_reset = state.dataGlobal->EndHourFlag; + + if (!state.dataWeather->WeatherFileExists) { + ShowSevereError(state, + "Site:GroundTemperature:Undisturbed:FiniteDifference -- using this model requires specification of a weather file."); + ShowContinueError( + state, "Either place in.epw in the working directory or specify a weather file on the command line using -w /path/to/weather.epw"); + ShowFatalError(state, "Simulation halted due to input error in ground temperature model."); } - } - if (found) { - state.dataGrndTempModelMgr->groundTempModels.push_back(thisModel); + // We add a new period to force running all weather data + int originalNumOfEnvrn = state.dataWeather->NumOfEnvrn; + ++state.dataWeather->NumOfEnvrn; + ++state.dataWeather->TotRunPers; + state.dataWeather->Environment.redimension(state.dataWeather->NumOfEnvrn); + state.dataWeather->RunPeriodInput.redimension(state.dataWeather->TotRunPers); + state.dataWeather->Environment(state.dataWeather->NumOfEnvrn).KindOfEnvrn = Constant::KindOfSim::ReadAllWeatherData; + state.dataWeather->RPReadAllWeatherData = true; + state.dataGlobal->WeathSimReq = true; + // RunPeriod is initialized to be one year of simulation + // RunPeriodInput(TotRunPers).monWeekDay = 0; // Why do this? + + Weather::SetupEnvironmentTypes(state); + + // We reset the counter to the original number of run periods, so that GetNextEnvironment will fetch the one we added + state.dataWeather->Envrn = originalNumOfEnvrn; + bool Available = true; + bool ErrorsFound = false; + Weather::GetNextEnvironment(state, Available, ErrorsFound); + if (ErrorsFound) { + ShowFatalError(state, "Site:GroundTemperature:Undisturbed:FiniteDifference: error in reading weather file data"); + } - // Simulate - thisModel->initAndSim(state); + if (state.dataGlobal->KindOfSim != Constant::KindOfSim::ReadAllWeatherData) { + // This shouldn't happen + ShowFatalError(state, "Site:GroundTemperature:Undisturbed:FiniteDifference: error in reading weather file data, bad KindOfSim."); + } - // Return the pointer - return thisModel; - } else { - ShowFatalError(state, - fmt::format("{}--Errors getting input for ground temperature model", - GroundTemperatureManager::groundTempModelNames[static_cast(objType)])); - return nullptr; - } -} - -//****************************************************************************** - -void FiniteDiffGroundTempsModel::initAndSim(EnergyPlusData &state) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 - - // PURPOSE OF THIS SUBROUTINE: - // Initalizes and simulated finite difference ground temps model - - FiniteDiffGroundTempsModel::getWeatherData(state); - - FiniteDiffGroundTempsModel::developMesh(); - - FiniteDiffGroundTempsModel::performSimulation(state); -} - -//****************************************************************************** - -void FiniteDiffGroundTempsModel::getWeatherData(EnergyPlusData &state) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 - - // PURPOSE OF THIS SUBROUTINE: - // Finds correct environment for reading all weather data. Loops over all weather data in weather file - // and data structure containing daily average of required weather data. - - // SUBROUTINE ARGUMENT DEFINITIONS: - bool Available; // an environment is available to process - bool ErrorsFound; - Real64 outDryBulbTemp_num; - Real64 relHum_num; - Real64 windSpeed_num; - Real64 horizSolarRad_num; - Real64 airDensity_num; - Real64 annualAveAirTemp_num; - - // Save current environment so we can revert back when done - int Envrn_reset = state.dataWeather->Envrn; - Constant::KindOfSim KindOfSim_reset = state.dataGlobal->KindOfSim; - int TimeStep_reset = state.dataGlobal->TimeStep; - int HourOfDay_reset = state.dataGlobal->HourOfDay; - bool BeginEnvrnFlag_reset = state.dataGlobal->BeginEnvrnFlag; - bool EndEnvrnFlag_reset = state.dataGlobal->EndEnvrnFlag; - bool EndMonthFlag_reset = state.dataEnvrn->EndMonthFlag; - bool WarmupFlag_reset = state.dataGlobal->WarmupFlag; - int DayOfSim_reset = state.dataGlobal->DayOfSim; - std::string DayOfSimChr_reset = state.dataGlobal->DayOfSimChr; - int NumOfWarmupDays_reset = state.dataReportFlag->NumOfWarmupDays; - bool BeginDayFlag_reset = state.dataGlobal->BeginDayFlag; - bool EndDayFlag_reset = state.dataGlobal->EndDayFlag; - bool BeginHourFlag_reset = state.dataGlobal->BeginHourFlag; - bool EndHourFlag_reset = state.dataGlobal->EndHourFlag; - - if (!state.dataWeather->WeatherFileExists) { - ShowSevereError(state, "Site:GroundTemperature:Undisturbed:FiniteDifference -- using this model requires specification of a weather file."); - ShowContinueError(state, - "Either place in.epw in the working directory or specify a weather file on the command line using -w /path/to/weather.epw"); - ShowFatalError(state, "Simulation halted due to input error in ground temperature model."); - } + weatherDataArray.dimension(state.dataWeather->NumDaysInYear); - // We add a new period to force running all weather data - int originalNumOfEnvn = state.dataWeather->NumOfEnvrn; - ++state.dataWeather->NumOfEnvrn; - ++state.dataWeather->TotRunPers; - state.dataWeather->Environment.redimension(state.dataWeather->NumOfEnvrn); - state.dataWeather->RunPeriodInput.redimension(state.dataWeather->TotRunPers); - state.dataWeather->Environment(state.dataWeather->NumOfEnvrn).KindOfEnvrn = Constant::KindOfSim::ReadAllWeatherData; - state.dataWeather->RPReadAllWeatherData = true; - state.dataGlobal->WeathSimReq = true; - // RunPeriod is initialized to be one year of simulation - // RunPeriodInput(TotRunPers).monWeekDay = 0; // Why do this? - - Weather::SetupEnvironmentTypes(state); - - // We reset the counter to the original number of run periods, so that GetNextEnvironment will fetch the one we added - state.dataWeather->Envrn = originalNumOfEnvn; - Available = true; - ErrorsFound = false; - Weather::GetNextEnvironment(state, Available, ErrorsFound); - if (ErrorsFound) { - ShowFatalError(state, "Site:GroundTemperature:Undisturbed:FiniteDifference: error in reading weather file data"); - } + state.dataGlobal->BeginEnvrnFlag = true; + state.dataGlobal->EndEnvrnFlag = false; + state.dataEnvrn->EndMonthFlag = false; + state.dataGlobal->WarmupFlag = false; + state.dataGlobal->DayOfSim = 0; + state.dataGlobal->DayOfSimChr = "0"; + state.dataReportFlag->NumOfWarmupDays = 0; - if (state.dataGlobal->KindOfSim != Constant::KindOfSim::ReadAllWeatherData) { - // This shouldn't happen - ShowFatalError(state, "Site:GroundTemperature:Undisturbed:FiniteDifference: error in reading weather file data, bad KindOfSim."); - } + Real64 annualAveAirTemp_num = 0.0; - weatherDataArray.dimension(state.dataWeather->NumDaysInYear); + while ((state.dataGlobal->DayOfSim < state.dataWeather->NumDaysInYear) || (state.dataGlobal->WarmupFlag)) { // Begin day loop ... - state.dataGlobal->BeginEnvrnFlag = true; - state.dataGlobal->EndEnvrnFlag = false; - state.dataEnvrn->EndMonthFlag = false; - state.dataGlobal->WarmupFlag = false; - state.dataGlobal->DayOfSim = 0; - state.dataGlobal->DayOfSimChr = "0"; - state.dataReportFlag->NumOfWarmupDays = 0; + ++state.dataGlobal->DayOfSim; - annualAveAirTemp_num = 0.0; + // Reset daily values + Real64 outDryBulbTemp_num = 0.0; + Real64 relHum_num = 0.0; + Real64 windSpeed_num = 0.0; + Real64 horizSolarRad_num = 0.0; + Real64 airDensity_num = 0.0; + int denominator = 0; - while ((state.dataGlobal->DayOfSim < state.dataWeather->NumDaysInYear) || (state.dataGlobal->WarmupFlag)) { // Begin day loop ... + auto &tdwd = weatherDataArray(state.dataGlobal->DayOfSim); // "This day weather data" - ++state.dataGlobal->DayOfSim; + state.dataGlobal->BeginDayFlag = true; + state.dataGlobal->EndDayFlag = false; - // Reset daily values - outDryBulbTemp_num = 0.0; - relHum_num = 0.0; - windSpeed_num = 0.0; - horizSolarRad_num = 0.0; - airDensity_num = 0.0; - int denominator = 0; + for (state.dataGlobal->HourOfDay = 1; state.dataGlobal->HourOfDay <= 24; ++state.dataGlobal->HourOfDay) { // Begin hour loop ... - auto &tdwd = weatherDataArray(state.dataGlobal->DayOfSim); // "This day weather data" + state.dataGlobal->BeginHourFlag = true; + state.dataGlobal->EndHourFlag = false; - state.dataGlobal->BeginDayFlag = true; - state.dataGlobal->EndDayFlag = false; + for (state.dataGlobal->TimeStep = 1; state.dataGlobal->TimeStep <= state.dataGlobal->TimeStepsInHour; ++state.dataGlobal->TimeStep) { - for (state.dataGlobal->HourOfDay = 1; state.dataGlobal->HourOfDay <= 24; ++state.dataGlobal->HourOfDay) { // Begin hour loop ... + state.dataGlobal->BeginTimeStepFlag = true; - state.dataGlobal->BeginHourFlag = true; - state.dataGlobal->EndHourFlag = false; + // Set the End__Flag variables to true if necessary. Note that + // each flag builds on the previous level. EndDayFlag cannot be + // .TRUE. unless EndHourFlag is also .TRUE., etc. Note that the + // EndEnvrnFlag and the EndSimFlag cannot be set during warmup. + // Note also that BeginTimeStepFlag, EndTimeStepFlag, and the + // SubTimeStepFlags can/will be set/reset in the HVAC Manager. - for (state.dataGlobal->TimeStep = 1; state.dataGlobal->TimeStep <= state.dataGlobal->NumOfTimeStepInHour; ++state.dataGlobal->TimeStep) { + if (state.dataGlobal->TimeStep == state.dataGlobal->TimeStepsInHour) { + state.dataGlobal->EndHourFlag = true; + if (state.dataGlobal->HourOfDay == 24) { + state.dataGlobal->EndDayFlag = true; + if (!state.dataGlobal->WarmupFlag && (state.dataGlobal->DayOfSim == state.dataGlobal->NumOfDayInEnvrn)) { + state.dataGlobal->EndEnvrnFlag = true; + } + } + } - state.dataGlobal->BeginTimeStepFlag = true; + Weather::ManageWeather(state); - // Set the End__Flag variables to true if necessary. Note that - // each flag builds on the previous level. EndDayFlag cannot be - // .TRUE. unless EndHourFlag is also .TRUE., etc. Note that the - // EndEnvrnFlag and the EndSimFlag cannot be set during warmup. - // Note also that BeginTimeStepFlag, EndTimeStepFlag, and the - // SubTimeStepFlags can/will be set/reset in the HVAC Manager. + outDryBulbTemp_num += state.dataEnvrn->OutDryBulbTemp; + airDensity_num += state.dataEnvrn->OutAirDensity; + relHum_num += state.dataEnvrn->OutRelHumValue; + windSpeed_num += state.dataEnvrn->WindSpeed; + horizSolarRad_num += max(state.dataEnvrn->SOLCOS(3), 0.0) * state.dataEnvrn->BeamSolarRad + state.dataEnvrn->DifSolarRad; - if (state.dataGlobal->TimeStep == state.dataGlobal->NumOfTimeStepInHour) { - state.dataGlobal->EndHourFlag = true; - if (state.dataGlobal->HourOfDay == 24) { - state.dataGlobal->EndDayFlag = true; - if (!state.dataGlobal->WarmupFlag && (state.dataGlobal->DayOfSim == state.dataGlobal->NumOfDayInEnvrn)) { - state.dataGlobal->EndEnvrnFlag = true; - } - } - } + state.dataGlobal->BeginHourFlag = false; + state.dataGlobal->BeginDayFlag = false; + state.dataGlobal->BeginEnvrnFlag = false; + state.dataGlobal->BeginSimFlag = false; - Weather::ManageWeather(state); + ++denominator; - outDryBulbTemp_num += state.dataEnvrn->OutDryBulbTemp; - airDensity_num += state.dataEnvrn->OutAirDensity; - relHum_num += state.dataEnvrn->OutRelHumValue; - windSpeed_num += state.dataEnvrn->WindSpeed; - horizSolarRad_num += max(state.dataEnvrn->SOLCOS(3), 0.0) * state.dataEnvrn->BeamSolarRad + state.dataEnvrn->DifSolarRad; + } // TimeStep loop - state.dataGlobal->BeginHourFlag = false; - state.dataGlobal->BeginDayFlag = false; - state.dataGlobal->BeginEnvrnFlag = false; - state.dataGlobal->BeginSimFlag = false; + state.dataGlobal->PreviousHour = state.dataGlobal->HourOfDay; - ++denominator; + } // ... End hour loop. - } // TimeStep loop + tdwd.dryBulbTemp = outDryBulbTemp_num / denominator; + tdwd.relativeHumidity = relHum_num / denominator; + tdwd.windSpeed = windSpeed_num / denominator; + tdwd.horizontalRadiation = horizSolarRad_num / denominator; + tdwd.airDensity = airDensity_num / denominator; - state.dataGlobal->PreviousHour = state.dataGlobal->HourOfDay; + // Log data for domain initialization using KA model + annualAveAirTemp_num += tdwd.dryBulbTemp; - } // ... End hour loop. + if (tdwd.dryBulbTemp < minDailyAirTemp) { + minDailyAirTemp = tdwd.dryBulbTemp; + dayOfMinDailyAirTemp = state.dataGlobal->DayOfSim; + } - tdwd.dryBulbTemp = outDryBulbTemp_num / denominator; - tdwd.relativeHumidity = relHum_num / denominator; - tdwd.windSpeed = windSpeed_num / denominator; - tdwd.horizontalRadiation = horizSolarRad_num / denominator; - tdwd.airDensity = airDensity_num / denominator; + if (tdwd.dryBulbTemp > maxDailyAirTemp) { + maxDailyAirTemp = tdwd.dryBulbTemp; + } - // Log data for domain initialization using KA model - annualAveAirTemp_num += tdwd.dryBulbTemp; + } // ... End day loop. + + annualAveAirTemp = annualAveAirTemp_num / state.dataWeather->NumDaysInYear; // Used for initializing domain + + // Reset Environment when done reading data + --state.dataWeather->NumOfEnvrn; // May need better way of eliminating the extra environment that was added to read the data + --state.dataWeather->TotRunPers; + state.dataGlobal->KindOfSim = KindOfSim_reset; + state.dataWeather->RPReadAllWeatherData = false; + state.dataWeather->Environment.redimension(state.dataWeather->NumOfEnvrn); + state.dataWeather->RunPeriodInput.redimension(state.dataWeather->TotRunPers); + state.dataWeather->Envrn = Envrn_reset; + state.dataGlobal->TimeStep = TimeStep_reset; + state.dataGlobal->HourOfDay = HourOfDay_reset; + state.dataGlobal->BeginEnvrnFlag = BeginEnvrnFlag_reset; + state.dataGlobal->EndEnvrnFlag = EndEnvrnFlag_reset; + state.dataEnvrn->EndMonthFlag = EndMonthFlag_reset; + state.dataGlobal->WarmupFlag = WarmupFlag_reset; + state.dataGlobal->DayOfSim = DayOfSim_reset; + state.dataGlobal->DayOfSimChr = DayOfSimChr_reset; + state.dataReportFlag->NumOfWarmupDays = NumOfWarmupDays_reset; + state.dataGlobal->BeginDayFlag = BeginDayFlag_reset; + state.dataGlobal->EndDayFlag = EndDayFlag_reset; + state.dataGlobal->BeginHourFlag = BeginHourFlag_reset; + state.dataGlobal->EndHourFlag = EndHourFlag_reset; + } - if (tdwd.dryBulbTemp < minDailyAirTemp) { - minDailyAirTemp = tdwd.dryBulbTemp; - dayOfMinDailyAirTemp = state.dataGlobal->DayOfSim; - } + //****************************************************************************** - if (tdwd.dryBulbTemp > maxDailyAirTemp) { - maxDailyAirTemp = tdwd.dryBulbTemp; - } + void FiniteDiffGroundTempsModel::developMesh() + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 + + // PURPOSE OF THIS SUBROUTINE: + // Creates static mesh used for model + + // Surface layer parameters + constexpr Real64 surfaceLayerThickness = 2.0; + constexpr Real64 surfaceLayerCellThickness = 0.015; + constexpr int surfaceLayerNumCells = static_cast(surfaceLayerThickness / surfaceLayerCellThickness); + + // Center layer parameters + constexpr int centerLayerNumCells = 80; - } // ... End day loop. - - annualAveAirTemp = annualAveAirTemp_num / state.dataWeather->NumDaysInYear; // Used for initalizing domain - - // Reset Envrionment when done reading data - --state.dataWeather->NumOfEnvrn; // May need better way of eliminating the extra envrionment that was added to read the data - --state.dataWeather->TotRunPers; - state.dataGlobal->KindOfSim = KindOfSim_reset; - state.dataWeather->RPReadAllWeatherData = false; - state.dataWeather->Environment.redimension(state.dataWeather->NumOfEnvrn); - state.dataWeather->RunPeriodInput.redimension(state.dataWeather->TotRunPers); - state.dataWeather->Envrn = Envrn_reset; - state.dataGlobal->TimeStep = TimeStep_reset; - state.dataGlobal->HourOfDay = HourOfDay_reset; - state.dataGlobal->BeginEnvrnFlag = BeginEnvrnFlag_reset; - state.dataGlobal->EndEnvrnFlag = EndEnvrnFlag_reset; - state.dataEnvrn->EndMonthFlag = EndMonthFlag_reset; - state.dataGlobal->WarmupFlag = WarmupFlag_reset; - state.dataGlobal->DayOfSim = DayOfSim_reset; - state.dataGlobal->DayOfSimChr = DayOfSimChr_reset; - state.dataReportFlag->NumOfWarmupDays = NumOfWarmupDays_reset; - state.dataGlobal->BeginDayFlag = BeginDayFlag_reset; - state.dataGlobal->EndDayFlag = EndDayFlag_reset; - state.dataGlobal->BeginHourFlag = BeginHourFlag_reset; - state.dataGlobal->EndHourFlag = EndHourFlag_reset; -} - -//****************************************************************************** - -void FiniteDiffGroundTempsModel::developMesh() -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 - - // PURPOSE OF THIS SUBROUTINE: - // Creates static mesh used for model - - // Surface layer parameters - Real64 surfaceLayerThickness = 2.0; - Real64 surfaceLayerCellThickness = 0.015; - int surfaceLayerNumCells = surfaceLayerThickness / surfaceLayerCellThickness; - - // Center layer parameters - Real64 centerLayerExpansionCoeff = 1.10879; - int centerLayerNumCells = 80; - - // Deep layer parameters - Real64 deepLayerThickness = 0.2; - Real64 deepLayerCellThickness = surfaceLayerCellThickness; - int deepLayerNumCells = deepLayerThickness / deepLayerCellThickness; - - // Other - Real64 currentCellDepth = 0.0; - - totalNumCells = surfaceLayerNumCells + centerLayerNumCells + deepLayerNumCells; - - // Allocate arrays - cellArray.allocate(totalNumCells); - cellDepths.allocate(totalNumCells); - - for (int i = 1; i <= totalNumCells; ++i) { - - // Reference to thisCell - auto &thisCell = cellArray(i); - - // Set the index - thisCell.index = i; - - // Give thickness to the cells - if (i <= surfaceLayerNumCells) { - // Constant thickness mesh here - thisCell.thickness = surfaceLayerCellThickness; - - } else if (i <= (centerLayerNumCells + surfaceLayerNumCells)) { - // Geometric expansion/contraction here - int numCenterCell = i - surfaceLayerNumCells; - - if (numCenterCell <= (centerLayerNumCells / 2)) { - thisCell.thickness = surfaceLayerCellThickness * std::pow(centerLayerExpansionCoeff, numCenterCell); + // Deep layer parameters + constexpr Real64 deepLayerThickness = 0.2; + constexpr Real64 deepLayerCellThickness = surfaceLayerCellThickness; + constexpr int deepLayerNumCells = static_cast(deepLayerThickness / deepLayerCellThickness); + + // Other + Real64 currentCellDepth = 0.0; + + totalNumCells = surfaceLayerNumCells + centerLayerNumCells + deepLayerNumCells; + + // Allocate arrays + cellArray.allocate(totalNumCells); + cellDepths.allocate(totalNumCells); + + for (int i = 1; i <= totalNumCells; ++i) { + + // Reference to thisCell + auto &thisCell = cellArray(i); + + // Set the index + thisCell.index = i; + + // Give thickness to the cells + if (i <= surfaceLayerNumCells) { + // Constant thickness mesh here + thisCell.thickness = surfaceLayerCellThickness; + + } else if (i <= (centerLayerNumCells + surfaceLayerNumCells)) { + // Geometric expansion/contraction here + int numCenterCell = i - surfaceLayerNumCells; + + if (numCenterCell <= (centerLayerNumCells / 2)) { + Real64 centerLayerExpansionCoeff = 1.10879; + thisCell.thickness = surfaceLayerCellThickness * std::pow(centerLayerExpansionCoeff, numCenterCell); + } else { + thisCell.thickness = + cellArray((surfaceLayerNumCells + (centerLayerNumCells / 2)) - (numCenterCell - (centerLayerNumCells / 2))).thickness; + } } else { - thisCell.thickness = - cellArray((surfaceLayerNumCells + (centerLayerNumCells / 2)) - (numCenterCell - (centerLayerNumCells / 2))).thickness; + // Constant thickness mesh here + thisCell.thickness = deepLayerCellThickness; } - } else { - // Constant thickness mesh here - thisCell.thickness = deepLayerCellThickness; - } - // Set minimum z value - thisCell.minZValue = currentCellDepth; + // Set minimum z value + thisCell.minZValue = currentCellDepth; - // Populate depth array for use later when looking up temperatures - cellDepths(i) = currentCellDepth + thisCell.thickness / 2.0; + // Populate depth array for use later when looking up temperatures + cellDepths(i) = currentCellDepth + thisCell.thickness / 2.0; - // Update local counter - currentCellDepth += thisCell.thickness; + // Update local counter + currentCellDepth += thisCell.thickness; - // Set maximum z value - thisCell.maxZValue = currentCellDepth; + // Set maximum z value + thisCell.maxZValue = currentCellDepth; - // Set base properties - thisCell.props.conductivity = baseConductivity; - thisCell.props.density = baseDensity; - thisCell.props.specificHeat = baseSpecificHeat; - thisCell.props.diffusivity = baseConductivity / (baseDensity * baseSpecificHeat); + // Set base properties + thisCell.props.conductivity = baseConductivity; + thisCell.props.density = baseDensity; + thisCell.props.specificHeat = baseSpecificHeat; + thisCell.props.diffusivity = baseConductivity / (baseDensity * baseSpecificHeat); + } } -} -//****************************************************************************** + //****************************************************************************** -void FiniteDiffGroundTempsModel::performSimulation(EnergyPlusData &state) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + void FiniteDiffGroundTempsModel::performSimulation(EnergyPlusData &state) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 - // PURPOSE OF THIS SUBROUTINE: - // Simulates model, repeating years, until steady-periodic temperatures are determined. + // PURPOSE OF THIS SUBROUTINE: + // Simulates model, repeating years, until steady-periodic temperatures are determined. - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - timeStepInSeconds = Constant::SecsInDay; - bool convergedFinal = false; + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + timeStepInSeconds = Constant::rSecsInDay; + bool convergedFinal = false; - initDomain(state); + initDomain(state); - // Loop until converged - do { + // Loop until converged + do { - // loop over all days - for (state.dataGlobal->FDsimDay = 1; state.dataGlobal->FDsimDay <= state.dataWeather->NumDaysInYear; ++state.dataGlobal->FDsimDay) { + // loop over all days + for (state.dataGlobal->FDsimDay = 1; state.dataGlobal->FDsimDay <= state.dataWeather->NumDaysInYear; ++state.dataGlobal->FDsimDay) { - bool iterationConverged = false; + bool iterationConverged = false; - doStartOfTimeStepInits(); + doStartOfTimeStepInits(); - // Loop until iteration temperature converges - do { + // Loop until iteration temperature converges + do { - // For all cells - for (int cell = 1; cell <= totalNumCells; ++cell) { + // For all cells + for (int cell = 1; cell <= totalNumCells; ++cell) { - if (cell == 1) { - updateSurfaceCellTemperature(state); - } else if (cell > 1 && cell < totalNumCells) { - updateGeneralDomainCellTemperature(cell); - } else if (cell == totalNumCells) { - updateBottomCellTemperature(); + if (cell == 1) { + updateSurfaceCellTemperature(state); + } else if (cell > 1 && cell < totalNumCells) { + updateGeneralDomainCellTemperature(cell); + } else if (cell == totalNumCells) { + updateBottomCellTemperature(); + } } - } - // Check iteration temperature convergence - iterationConverged = checkIterationTemperatureConvergence(); + // Check iteration temperature convergence + iterationConverged = checkIterationTemperatureConvergence(); - if (!iterationConverged) { - // Shift temperatures for next iteration - updateIterationTemperatures(); - } + if (!iterationConverged) { + // Shift temperatures for next iteration + updateIterationTemperatures(); + } - } while (!iterationConverged); + } while (!iterationConverged); - // Shift temperatures for next timestep - updateTimeStepTemperatures(state); - } + // Shift temperatures for next timestep + updateTimeStepTemperatures(state); + } + + // Check final temperature convergence + convergedFinal = checkFinalTemperatureConvergence(state); - // Check final temperature convergence - convergedFinal = checkFinalTemperatureConvergence(state); - - } while (!convergedFinal); -} - -//****************************************************************************** - -void FiniteDiffGroundTempsModel::updateSurfaceCellTemperature(EnergyPlusData &state) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 - - // PURPOSE OF THIS SUBROUTINE: - // Determines heat transfer to surface. Updates surface cell temperature. - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - Real64 numerator = 0.0; - Real64 denominator = 0.0; - Real64 resistance = 0.0; - Real64 incidentHeatGain; - Real64 incidentSolar_MJhrmin; - Real64 evapotransHeatLoss_Wm2; - Real64 absorbedIncidentSolar_MJhrmin; - Real64 vaporPressureSaturated_kPa; - Real64 vaporPressureActual_kPa; - Real64 currAirTempK; - Real64 QRAD_NL; - Real64 netIncidentRadiation_MJhr; - Real64 netIncidentRadiation_Wm2; - Real64 slope_S; - Real64 CN; - Real64 G_hr; - Real64 Cd; - Real64 pressure; - Real64 psychrometricConstant; - Real64 evapotransFluidLoss_mmhr; - Real64 evapotransFluidLoss_mhr; - Real64 latentHeatVaporization; - Real64 evapotransHeatLoss_MJhrmin; - - Real64 constexpr rho_water = 998.0; // [kg/m3] - Real64 constexpr airSpecificHeat = 1003; // '[J/kg-K] - // evapotranspiration parameters - Real64 constexpr absor_Corrected = 0.77; - Real64 const convert_Wm2_To_MJhrmin = 3600.0 / 1000000.0; - Real64 const convert_MJhrmin_To_Wm2 = 1.0 / convert_Wm2_To_MJhrmin; - - auto &thisCell = cellArray(1); - auto &cellBelow_thisCell = cellArray(2); - auto &cwd = weatherDataArray(state.dataGlobal->FDsimDay); // "Current Weather Day" - - // Add effect from previous time step - numerator += thisCell.temperature_prevTimeStep; - ++denominator; - - // Conduction to lower cell - resistance = (thisCell.thickness / 2.0) / (thisCell.props.conductivity * thisCell.conductionArea) + - (cellBelow_thisCell.thickness / 2.0) / (cellBelow_thisCell.props.conductivity * cellBelow_thisCell.conductionArea); - numerator += (thisCell.beta / resistance) * cellBelow_thisCell.temperature; - denominator += (thisCell.beta / resistance); - - // Convection to atmosphere - if (cwd.windSpeed > 0.1) { - resistance = 208.0 / (cwd.airDensity * airSpecificHeat * cwd.windSpeed * thisCell.conductionArea); - } else { - // Future development should include additional natural convection effects here + } while (!convergedFinal); } - numerator += (thisCell.beta / resistance) * cwd.dryBulbTemp; - denominator += (thisCell.beta / resistance); - // Initialize, this variable is used for both evapotranspiration and non-ET cases, [W] - incidentHeatGain = 0.0; + //****************************************************************************** + + void FiniteDiffGroundTempsModel::updateSurfaceCellTemperature(const EnergyPlusData &state) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 + + // PURPOSE OF THIS SUBROUTINE: + // Determines heat transfer to surface. Updates surface cell temperature. + + // FUNCTION LOCAL VARIABLE DECLARATIONS: + Real64 numerator = 0.0; + Real64 denominator = 0.0; + Real64 resistance = 0.0; + Real64 G_hr; + Real64 Cd; + + Real64 constexpr rho_water = 998.0; // [kg/m3] + // evapotranspiration parameters + Real64 constexpr absor_Corrected = 0.77; + constexpr Real64 convert_Wm2_To_MJhrmin = 3600.0 / 1000000.0; + constexpr Real64 convert_MJhrmin_To_Wm2 = 1.0 / convert_Wm2_To_MJhrmin; + + const auto &thisCell = cellArray(1); + const auto &cellBelow_thisCell = cellArray(2); + const auto &cwd = weatherDataArray(state.dataGlobal->FDsimDay); // "Current Weather Day" + + // Add effect from previous time step + numerator += thisCell.temperature_prevTimeStep; + ++denominator; + + // Conduction to lower cell + resistance = thisCell.thickness / 2.0 / (thisCell.props.conductivity * thisCell.conductionArea) + + cellBelow_thisCell.thickness / 2.0 / (cellBelow_thisCell.props.conductivity * cellBelow_thisCell.conductionArea); + numerator += thisCell.beta / resistance * cellBelow_thisCell.temperature; + denominator += thisCell.beta / resistance; + + // Convection to atmosphere + if (cwd.windSpeed > 0.1) { + Real64 constexpr airSpecificHeat = 1003; // '[J/kg-K] + resistance = 208.0 / (cwd.airDensity * airSpecificHeat * cwd.windSpeed * thisCell.conductionArea); + } else { + // Future development should include additional natural convection effects here + } + numerator += thisCell.beta / resistance * cwd.dryBulbTemp; + denominator += thisCell.beta / resistance; - // For convenience convert to Kelvin once - currAirTempK = cwd.dryBulbTemp + 273.15; + // For convenience convert to Kelvin once + const Real64 currAirTempK = cwd.dryBulbTemp + 273.15; - // Convert input solar radiation [w/m2] into units for ET model, [MJ/hr-min] - // Diffuse + Direct Beam Radation - incidentSolar_MJhrmin = cwd.horizontalRadiation * convert_Wm2_To_MJhrmin; + // Convert input solar radiation [w/m2] into units for ET model, [MJ/hr-min] + // Diffuse + Direct Beam Radiation + const Real64 incidentSolar_MJhrmin = cwd.horizontalRadiation * convert_Wm2_To_MJhrmin; - // Absorbed solar radiation, [MJ/hr-min] - absorbedIncidentSolar_MJhrmin = absor_Corrected * incidentSolar_MJhrmin; + // Absorbed solar radiation, [MJ/hr-min] + const Real64 absorbedIncidentSolar_MJhrmin = absor_Corrected * incidentSolar_MJhrmin; - // Calculate saturated vapor pressure, [kPa] - vaporPressureSaturated_kPa = 0.6108 * std::exp(17.27 * cwd.dryBulbTemp / (cwd.dryBulbTemp + 237.3)); + // Calculate saturated vapor pressure, [kPa] + const Real64 vaporPressureSaturated_kPa = 0.6108 * std::exp(17.27 * cwd.dryBulbTemp / (cwd.dryBulbTemp + 237.3)); - // Calculate actual vapor pressure, [kPa] - vaporPressureActual_kPa = vaporPressureSaturated_kPa * cwd.relativeHumidity; + // Calculate actual vapor pressure, [kPa] + const Real64 vaporPressureActual_kPa = vaporPressureSaturated_kPa * cwd.relativeHumidity; - // Calculate another Q term, [MJ/m2-hr] - QRAD_NL = 2.042E-10 * pow_4(currAirTempK) * (0.34 - 0.14 * std::sqrt(vaporPressureActual_kPa)); + // Calculate another Q term, [MJ/m2-hr] + const Real64 QRAD_NL = 2.042E-10 * pow_4(currAirTempK) * (0.34 - 0.14 * std::sqrt(vaporPressureActual_kPa)); - // Calculate another Q term, [MJ/hr] - netIncidentRadiation_MJhr = absorbedIncidentSolar_MJhrmin - QRAD_NL; + // Calculate another Q term, [MJ/hr] + const Real64 netIncidentRadiation_MJhr = absorbedIncidentSolar_MJhrmin - QRAD_NL; - // constant - CN = 37.0; + // constant + constexpr Real64 CN = 37.0; - // Check whether there was sun - if (netIncidentRadiation_MJhr < 0.0) { - G_hr = 0.5 * netIncidentRadiation_MJhr; - Cd = 0.96; - } else { - G_hr = 0.1 * netIncidentRadiation_MJhr; - Cd = 0.24; - } + // Check whether there was sun + if (netIncidentRadiation_MJhr < 0.0) { + G_hr = 0.5 * netIncidentRadiation_MJhr; + Cd = 0.96; + } else { + G_hr = 0.1 * netIncidentRadiation_MJhr; + Cd = 0.24; + } - slope_S = 2503.0 * std::exp(17.27 * cwd.dryBulbTemp / (cwd.dryBulbTemp + 237.3)) / pow_2(cwd.dryBulbTemp + 237.3); - pressure = 98.0; - psychrometricConstant = 0.665e-3 * pressure; + const Real64 slope_S = 2503.0 * std::exp(17.27 * cwd.dryBulbTemp / (cwd.dryBulbTemp + 237.3)) / pow_2(cwd.dryBulbTemp + 237.3); + constexpr Real64 pressure = 98.0; + constexpr Real64 psychrometricConstant = 0.665e-3 * pressure; - // Evapotranspiration constant, [mm/hr] - evapotransFluidLoss_mmhr = - (evapotransCoeff * slope_S * (netIncidentRadiation_MJhr - G_hr) + - psychrometricConstant * (CN / currAirTempK) * cwd.windSpeed * (vaporPressureSaturated_kPa - vaporPressureActual_kPa)) / - (slope_S + psychrometricConstant * (1 + Cd * cwd.windSpeed)); + // Evapotranspiration constant, [mm/hr] + const Real64 evapotransFluidLoss_mmhr = + (evapotransCoeff * slope_S * (netIncidentRadiation_MJhr - G_hr) + + psychrometricConstant * (CN / currAirTempK) * cwd.windSpeed * (vaporPressureSaturated_kPa - vaporPressureActual_kPa)) / + (slope_S + psychrometricConstant * (1 + Cd * cwd.windSpeed)); - // Convert units, [m/hr] - evapotransFluidLoss_mhr = evapotransFluidLoss_mmhr / 1000.0; + // Convert units, [m/hr] + const Real64 evapotransFluidLoss_mhr = evapotransFluidLoss_mmhr / 1000.0; - // Calculate latent heat, [MJ/kg] - // Full formulation is cubic: L(T) = -0.0000614342 * T**3 + 0.00158927 * T**2 - 2.36418 * T + 2500.79[5] - // In: Cubic fit to Table 2.1,p.16, Textbook: R.R.Rogers & M.K. Yau, A Short Course in Cloud Physics, 3e,(1989), Pergamon press - // But a linear relation should suffice; - // note-for now using the previous time step temperature as an approximation to help ensure stability - latentHeatVaporization = 2.501 - 2.361e-3 * thisCell.temperature_prevTimeStep; + // Calculate latent heat, [MJ/kg] + // Full formulation is cubic: L(T) = -0.0000614342 * T**3 + 0.00158927 * T**2 - 2.36418 * T + 2500.79[5] + // In: Cubic fit to Table 2.1,p.16, Textbook: R.R.Rogers & M.K. Yau, A Short Course in Cloud Physics, 3e,(1989), Pergamon press + // But a linear relation should suffice; + // note-for now using the previous time step temperature as an approximation to help ensure stability + const Real64 latentHeatVaporization = 2.501 - 2.361e-3 * thisCell.temperature_prevTimeStep; - // Calculate evapotranspiration heat loss, [MJ/m2-hr] - evapotransHeatLoss_MJhrmin = rho_water * evapotransFluidLoss_mhr * latentHeatVaporization; + // Calculate evapotranspiration heat loss, [MJ/m2-hr] + const Real64 evapotransHeatLoss_MJhrmin = rho_water * evapotransFluidLoss_mhr * latentHeatVaporization; - // Convert net incident solar units, [W/m2] - netIncidentRadiation_Wm2 = netIncidentRadiation_MJhr * convert_MJhrmin_To_Wm2; + // Convert net incident solar units, [W/m2] + const Real64 netIncidentRadiation_Wm2 = netIncidentRadiation_MJhr * convert_MJhrmin_To_Wm2; - // Convert evapotranspiration units, [W/m2] - evapotransHeatLoss_Wm2 = evapotransHeatLoss_MJhrmin * convert_MJhrmin_To_Wm2; + // Convert evapotranspiration units, [W/m2] + const Real64 evapotransHeatLoss_Wm2 = evapotransHeatLoss_MJhrmin * convert_MJhrmin_To_Wm2; - // Calculate overall net heat ?gain? into the cell, [W] - incidentHeatGain = (netIncidentRadiation_Wm2 - evapotransHeatLoss_Wm2) * thisCell.conductionArea; + // Calculate overall net heat ?gain? into the cell, [W] + const Real64 incidentHeatGain = (netIncidentRadiation_Wm2 - evapotransHeatLoss_Wm2) * thisCell.conductionArea; - // Add any solar/evapotranspiration heat gain here - numerator += thisCell.beta * incidentHeatGain; + // Add any solar/evapotranspiration heat gain here + numerator += thisCell.beta * incidentHeatGain; - // Calculate the return temperature and leave - cellArray(1).temperature = numerator / denominator; -} + // Calculate the return temperature and leave + cellArray(1).temperature = numerator / denominator; + } -//****************************************************************************** + //****************************************************************************** -void FiniteDiffGroundTempsModel::updateGeneralDomainCellTemperature(int const cell) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + void FiniteDiffGroundTempsModel::updateGeneralDomainCellTemperature(int const cell) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 - // PURPOSE OF THIS SUBROUTINE: - // Update cell temperature based on HT from cells above and below + // PURPOSE OF THIS SUBROUTINE: + // Update cell temperature based on HT from cells above and below - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 numerator = 0.0; - Real64 denominator = 0.0; - Real64 resistance = 0.0; + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + Real64 numerator = 0.0; + Real64 denominator = 0.0; + Real64 resistance = 0.0; - auto &thisCell = cellArray(cell); - auto &cellAbove_thisCell = cellArray(cell - 1); - auto &cellBelow_thisCell = cellArray(cell + 1); + auto &thisCell = cellArray(cell); + const auto &cellAbove_thisCell = cellArray(cell - 1); + const auto &cellBelow_thisCell = cellArray(cell + 1); - // add effect from cell history - numerator += thisCell.temperature_prevTimeStep; - ++denominator; + // add effect from cell history + numerator += thisCell.temperature_prevTimeStep; + ++denominator; - // Conduction resistance between this cell and above cell - resistance = ((thisCell.thickness / 2.0) / (thisCell.conductionArea * thisCell.props.conductivity)) + - ((cellAbove_thisCell.thickness / 2.0) / (cellAbove_thisCell.conductionArea * cellAbove_thisCell.props.conductivity)); + // Conduction resistance between this cell and above cell + resistance = thisCell.thickness / 2.0 / (thisCell.conductionArea * thisCell.props.conductivity) + + cellAbove_thisCell.thickness / 2.0 / (cellAbove_thisCell.conductionArea * cellAbove_thisCell.props.conductivity); - numerator += (thisCell.beta / resistance) * cellAbove_thisCell.temperature; - denominator += thisCell.beta / resistance; + numerator += thisCell.beta / resistance * cellAbove_thisCell.temperature; + denominator += thisCell.beta / resistance; - // Conduction resitance between this cell and below cell - resistance = ((thisCell.thickness / 2.0) / (thisCell.conductionArea * thisCell.props.conductivity)) + - ((cellBelow_thisCell.thickness / 2.0) / (cellBelow_thisCell.conductionArea * cellBelow_thisCell.props.conductivity)); + // Conduction resistance between this cell and below cell + resistance = thisCell.thickness / 2.0 / (thisCell.conductionArea * thisCell.props.conductivity) + + cellBelow_thisCell.thickness / 2.0 / (cellBelow_thisCell.conductionArea * cellBelow_thisCell.props.conductivity); - numerator += (thisCell.beta / resistance) * cellBelow_thisCell.temperature; - denominator += thisCell.beta / resistance; + numerator += thisCell.beta / resistance * cellBelow_thisCell.temperature; + denominator += thisCell.beta / resistance; - //'now that we have passed all directions, update the temperature - thisCell.temperature = numerator / denominator; -} + // now that we have passed all directions, update the temperature + thisCell.temperature = numerator / denominator; + } -//****************************************************************************** + //****************************************************************************** -void FiniteDiffGroundTempsModel::updateBottomCellTemperature() -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + void FiniteDiffGroundTempsModel::updateBottomCellTemperature() + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 - // PURPOSE OF THIS SUBROUTINE: - // Updates bottom cell temperature based on earth heat flux HT from cell above + // PURPOSE OF THIS SUBROUTINE: + // Updates bottom cell temperature based on earth heat flux HT from cell above - // REFERENCES: - // Fridleifsson, I.B., R. Bertani, E.Huenges, J.W. Lund, A. Ragnarsson, L. Rybach. 2008 - // 'The possible role and contribution of geothermal energy to the mitigation of climate change.' - // IPCC scoping meeting on renewable energy sources: 59-80. + // REFERENCES: + // Fridleifsson, I.B., R. Bertani, E.Huenges, J.W. Lund, A. Ragnarsson, L. Rybach. 2008 + // 'The possible role and contribution of geothermal energy to the mitigation of climate change.' + // IPCC scoping meeting on renewable energy sources: 59-80. - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 numerator = 0.0; - Real64 denominator = 0.0; - Real64 resistance = 0.0; - Real64 constexpr geothermalGradient = 0.025; // C/m + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + Real64 numerator = 0.0; + Real64 denominator = 0.0; + Real64 resistance = 0.0; + Real64 constexpr geothermalGradient = 0.025; // C/m - auto &thisCell = cellArray(totalNumCells); - auto &cellAbove_thisCell = cellArray(totalNumCells - 1); + auto &thisCell = cellArray(totalNumCells); + auto &cellAbove_thisCell = cellArray(totalNumCells - 1); - // Initialize - numerator += thisCell.temperature_prevTimeStep; - ++denominator; + // Initialize + numerator += thisCell.temperature_prevTimeStep; + ++denominator; - // Conduction resistance between this cell and above cell - resistance = ((thisCell.thickness / 2.0) / (thisCell.conductionArea * thisCell.props.conductivity)) + - ((cellAbove_thisCell.thickness / 2.0) / (cellAbove_thisCell.conductionArea * cellAbove_thisCell.props.conductivity)); + // Conduction resistance between this cell and above cell + resistance = ((thisCell.thickness / 2.0) / (thisCell.conductionArea * thisCell.props.conductivity)) + + ((cellAbove_thisCell.thickness / 2.0) / (cellAbove_thisCell.conductionArea * cellAbove_thisCell.props.conductivity)); - numerator += (thisCell.beta / resistance) * cellAbove_thisCell.temperature; - denominator += thisCell.beta / resistance; + numerator += (thisCell.beta / resistance) * cellAbove_thisCell.temperature; + denominator += thisCell.beta / resistance; - // Geothermal gradient heat transfer - Real64 HTBottom = geothermalGradient * thisCell.props.conductivity * thisCell.conductionArea; + // Geothermal gradient heat transfer + Real64 HTBottom = geothermalGradient * thisCell.props.conductivity * thisCell.conductionArea; - numerator += thisCell.beta * HTBottom; + numerator += thisCell.beta * HTBottom; - cellArray(totalNumCells).temperature = numerator / denominator; -} + cellArray(totalNumCells).temperature = numerator / denominator; + } -//****************************************************************************** + //****************************************************************************** -bool FiniteDiffGroundTempsModel::checkFinalTemperatureConvergence(EnergyPlusData &state) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + bool FiniteDiffGroundTempsModel::checkFinalTemperatureConvergence(const EnergyPlusData &state) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 - // PURPOSE OF THIS SUBROUTINE: - // Checks final temperature convergence + // PURPOSE OF THIS SUBROUTINE: + // Checks final temperature convergence - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - bool converged = true; - Real64 constexpr finalTempConvergenceCriteria = 0.05; + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + bool converged = true; + Real64 constexpr finalTempConvergenceCriteria = 0.05; - if (state.dataGlobal->FDnumIterYears == maxYearsToIterate) return converged; + if (state.dataGlobal->FDnumIterYears == maxYearsToIterate) return converged; - for (int cell = 1; cell <= totalNumCells; ++cell) { + for (int cell = 1; cell <= totalNumCells; ++cell) { - auto &thisCell = cellArray(cell); + auto &thisCell = cellArray(cell); - if (std::abs(thisCell.temperature - thisCell.temperature_finalConvergence) >= finalTempConvergenceCriteria) { - converged = false; - } + if (std::abs(thisCell.temperature - thisCell.temperature_finalConvergence) >= finalTempConvergenceCriteria) { + converged = false; + } - thisCell.temperature_finalConvergence = thisCell.temperature; - } + thisCell.temperature_finalConvergence = thisCell.temperature; + } - ++state.dataGlobal->FDnumIterYears; + ++state.dataGlobal->FDnumIterYears; - return converged; -} + return converged; + } -//****************************************************************************** + //****************************************************************************** -bool FiniteDiffGroundTempsModel::checkIterationTemperatureConvergence() -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + bool FiniteDiffGroundTempsModel::checkIterationTemperatureConvergence() + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 - // PURPOSE OF THIS SUBROUTINE: - // Checks iteration temperature convergence + // PURPOSE OF THIS SUBROUTINE: + // Checks iteration temperature convergence - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - bool converged = true; - Real64 constexpr iterationTempConvergenceCriteria = 0.00001; + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + bool converged = true; + Real64 constexpr iterationTempConvergenceCriteria = 0.00001; - for (int cell = 1; cell <= totalNumCells; ++cell) { + for (int cell = 1; cell <= totalNumCells; ++cell) { - if (std::abs(cellArray(cell).temperature - cellArray(cell).temperature_prevIteration) >= iterationTempConvergenceCriteria) { - converged = false; - break; + if (std::abs(cellArray(cell).temperature - cellArray(cell).temperature_prevIteration) >= iterationTempConvergenceCriteria) { + converged = false; + break; + } } + + return converged; } - return converged; -} + //****************************************************************************** -//****************************************************************************** + void FiniteDiffGroundTempsModel::initDomain(EnergyPlusData &state) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 -void FiniteDiffGroundTempsModel::initDomain(EnergyPlusData &state) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + // PURPOSE OF THIS SUBROUTINE: + // Initializes model using Kusuda-Achenbach model. + // Average ground temp initialized to average annual air temperature - // PURPOSE OF THIS SUBROUTINE: - // Initalizes model using Kusuda-Achenbach model. - // Average ground temp initialized to average annual air temperature + // Temporary KA model for initialization + auto tempModel = std::make_unique(); // (AUTO_OK) Why does this have to be a unique_ptr? - // Temporary KA model for initialization - auto tempModel = std::make_unique(); // (AUTO_OK) Why does this have to be a unique_ptr? + tempModel->Name = "KAModelForFDModel"; + tempModel->modelType = GroundTemp::ModelType::Kusuda; + tempModel->aveGroundTemp = annualAveAirTemp; + tempModel->aveGroundTempAmplitude = + (maxDailyAirTemp - minDailyAirTemp) / 4.0; // Rough estimate here. Ground temps will not swing as far as the air temp. + tempModel->phaseShiftInSecs = dayOfMinDailyAirTemp * Constant::rSecsInDay; + tempModel->groundThermalDiffusivity = baseConductivity / (baseDensity * baseSpecificHeat); - tempModel->objectName = "KAModelForFDModel"; - tempModel->objectType = GroundTempObjType::KusudaGroundTemp; - tempModel->aveGroundTemp = annualAveAirTemp; - tempModel->aveGroundTempAmplitude = - (maxDailyAirTemp - minDailyAirTemp) / 4.0; // Rough estimate here. Ground temps will not swing as far as the air temp. - tempModel->phaseShiftInSecs = dayOfMinDailyAirTemp * Constant::SecsInDay; - tempModel->groundThermalDiffisivity = baseConductivity / (baseDensity * baseSpecificHeat); + // Initialize temperatures and volume + for (int cell = 1; cell <= totalNumCells; ++cell) { + auto &thisCell = cellArray(cell); - // Initialize temperatures and volume - for (int cell = 1; cell <= totalNumCells; ++cell) { - auto &thisCell = cellArray(cell); + Real64 depth = (thisCell.maxZValue + thisCell.minZValue) / 2.0; - Real64 depth = (thisCell.maxZValue + thisCell.minZValue) / 2.0; + // Initialize temperatures + if (tempModel) { + thisCell.temperature = tempModel->getGroundTempAtTimeInSeconds(state, depth, 0.0); // Initialized at first day of year + } + thisCell.temperature_finalConvergence = thisCell.temperature; + thisCell.temperature_prevIteration = thisCell.temperature; + thisCell.temperature_prevTimeStep = thisCell.temperature; - // Initialize temperatures - if (tempModel) { - thisCell.temperature = tempModel->getGroundTempAtTimeInSeconds(state, depth, 0.0); // Initialized at first day of year + // Set cell volume + thisCell.volume = thisCell.thickness * thisCell.conductionArea; } - thisCell.temperature_finalConvergence = thisCell.temperature; - thisCell.temperature_prevIteration = thisCell.temperature; - thisCell.temperature_prevTimeStep = thisCell.temperature; - - // Set cell volume - thisCell.volume = thisCell.thickness * thisCell.conductionArea; - } - // Initialize freezing calculation variables - evaluateSoilRhoCp(_, true); + // Initialize freezing calculation variables + evaluateSoilRhoCpInit(); - // Initialize the groundTemps array - groundTemps.dimension({1, state.dataWeather->NumDaysInYear}, {1, totalNumCells}, 0.0); + // Initialize the groundTemps array + groundTemps.dimension({1, state.dataWeather->NumDaysInYear}, {1, totalNumCells}, 0.0); - tempModel.reset(); -} + tempModel.reset(); + } -//****************************************************************************** + //****************************************************************************** -void FiniteDiffGroundTempsModel::updateIterationTemperatures() -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + void FiniteDiffGroundTempsModel::updateIterationTemperatures() + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 - // PURPOSE OF THIS SUBROUTINE: - // Updates iteration temperatures for convergence checks + // PURPOSE OF THIS SUBROUTINE: + // Updates iteration temperatures for convergence checks - for (int cell = 1; cell <= totalNumCells; ++cell) { - cellArray(cell).temperature_prevIteration = cellArray(cell).temperature; + for (int cell = 1; cell <= totalNumCells; ++cell) { + cellArray(cell).temperature_prevIteration = cellArray(cell).temperature; + } } -} -//****************************************************************************** + //****************************************************************************** -void FiniteDiffGroundTempsModel::updateTimeStepTemperatures(EnergyPlusData &state) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + void FiniteDiffGroundTempsModel::updateTimeStepTemperatures(const EnergyPlusData &state) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 - // PURPOSE OF THIS SUBROUTINE: - // Updates timestep temperatures for convergence checks. + // PURPOSE OF THIS SUBROUTINE: + // Updates timestep temperatures for convergence checks. - for (int cell = 1; cell <= totalNumCells; ++cell) { + for (int cell = 1; cell <= totalNumCells; ++cell) { - auto &thisCell = cellArray(cell); + auto &thisCell = cellArray(cell); - thisCell.temperature_prevTimeStep = thisCell.temperature; + thisCell.temperature_prevTimeStep = thisCell.temperature; - // Log temps for later use - groundTemps(state.dataGlobal->FDsimDay, cell) = thisCell.temperature; + // Log temps for later use + groundTemps(state.dataGlobal->FDsimDay, cell) = thisCell.temperature; + } } -} -//****************************************************************************** + //****************************************************************************** -void FiniteDiffGroundTempsModel::doStartOfTimeStepInits() -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + void FiniteDiffGroundTempsModel::doStartOfTimeStepInits() + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 - // PURPOSE OF THIS SUBROUTINE: - // Updates cell properties for each timestep + // PURPOSE OF THIS SUBROUTINE: + // Updates cell properties for each timestep - for (int cell = 1; cell <= totalNumCells; ++cell) { + for (int cell = 1; cell <= totalNumCells; ++cell) { - auto &thisCell = cellArray(cell); + auto &thisCell = cellArray(cell); - evaluateSoilRhoCp(cell); + evaluateSoilRhoCpCell(cell); - thisCell.beta = (timeStepInSeconds / (thisCell.props.rhoCp * thisCell.volume)); + thisCell.beta = (timeStepInSeconds / (thisCell.props.rhoCp * thisCell.volume)); + } } -} - -//****************************************************************************** - -Real64 FiniteDiffGroundTempsModel::interpolate(Real64 const x, Real64 const x_hi, Real64 const x_low, Real64 const y_hi, Real64 const y_low) -{ - return (x - x_low) / (x_hi - x_low) * (y_hi - y_low) + y_low; -} - -//****************************************************************************** - -Real64 FiniteDiffGroundTempsModel::getGroundTemp(EnergyPlusData &state) -{ - - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 - - // PURPOSE OF THIS SUBROUTINE: - // Interpolates between days and depths to find correct ground temperature - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // Interpolation variables - int i0; // First day - int i1; // Next day - int j1; // Next cell index (with depth greater than y-depth - Real64 T_i0_j0; // Temp at int( x-day ); cell lower_bound( y-depth ) - Real64 T_i1_j0; // Temp at int( x-day ) + 1; cell lower_bound( y-depth ) - Real64 T_i0_j1; // Temp at int( x-day ); cell lower_bound( y-depth ) + 1 - Real64 T_i1_j1; // Temp at int( x-day ) + 1; cell lower_bound( y-depth ) + 1 - Real64 T_ix_j0; // Temp at x-day; cell lower_bound( y-depth ) - Real64 T_ix_j1; // Temp at x-day; cell lower_bound( y-depth ) + 1 - Real64 T_ix_jy; // Final Temperature--Temp at x-day; y-depth - - if (depth < 0.0) { - depth = 0.0; + + //****************************************************************************** + + Real64 FiniteDiffGroundTempsModel::interpolate(Real64 const x, Real64 const x_hi, Real64 const x_low, Real64 const y_hi, Real64 const y_low) + { + return (x - x_low) / (x_hi - x_low) * (y_hi - y_low) + y_low; } - // Get index of nearest cell with depth less than depth - auto it = std::lower_bound(cellDepths.begin(), cellDepths.end(), depth); - int j0 = std::distance(cellDepths.begin(), it); // Cell index with depth less than y-depth + //****************************************************************************** + + Real64 FiniteDiffGroundTempsModel::getGroundTemp(EnergyPlusData &state) + { + + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 + + // PURPOSE OF THIS SUBROUTINE: + // Interpolates between days and depths to find correct ground temperature + + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + // Interpolation variables + int i0; // First day + int i1; // Next day + int j1; // Next cell index (with depth greater than y-depth + // Real64 T_i0_j0; // Temp at int( x-day ); cell lower_bound( y-depth ) + // Real64 T_i1_j0; // Temp at int( x-day ) + 1; cell lower_bound( y-depth ) + // Real64 T_i0_j1; // Temp at int( x-day ); cell lower_bound( y-depth ) + 1 + // Real64 T_i1_j1; // Temp at int( x-day ) + 1; cell lower_bound( y-depth ) + 1 + // Real64 T_ix_j0; // Temp at x-day; cell lower_bound( y-depth ) + // Real64 T_ix_j1; // Temp at x-day; cell lower_bound( y-depth ) + 1 + // RETURNS: Final Temperature--Temp at x-day; y-depth + + if (depth < 0.0) { + depth = 0.0; + } - // Compensate for 1-based array - ++j0; + // Get index of nearest cell with depth less than depth + auto it = std::lower_bound(cellDepths.begin(), cellDepths.end(), depth); + int j0 = static_cast(std::distance(cellDepths.begin(), it)); // Cell index with depth less than y-depth - // Fraction of day - Real64 dayFrac = simTimeInDays - int(simTimeInDays); // Fraction of day + // Compensate for 1-based array + ++j0; - if (j0 < totalNumCells - 1) { - // All depths within domain - j1 = j0 + 1; + // Fraction of day + const Real64 dayFrac = simTimeInDays - static_cast(simTimeInDays); // Fraction of day - if (simTimeInDays <= 1 || simTimeInDays >= state.dataWeather->NumDaysInYear) { - // First day of year, last day of year, and leap day - // Interpolate between first and last day - i0 = state.dataWeather->NumDaysInYear; - i1 = 1; + if (j0 < totalNumCells - 1) { + // All depths within domain + j1 = j0 + 1; - // Lookup ground temps - T_i0_j0 = groundTemps(i0, j0); - T_i0_j1 = groundTemps(i0, j1); - T_i1_j0 = groundTemps(i1, j0); - T_i1_j1 = groundTemps(i1, j1); + if (simTimeInDays <= 1 || simTimeInDays >= state.dataWeather->NumDaysInYear) { + // First day of year, last day of year, and leap day + // Interpolate between first and last day + i0 = state.dataWeather->NumDaysInYear; + i1 = 1; - // Interpolate between days holding depth constant - T_ix_j0 = interpolate(dayFrac, 1, 0, T_i1_j0, T_i0_j0); - T_ix_j1 = interpolate(dayFrac, 1, 0, T_i1_j1, T_i0_j1); + // Lookup ground temps + const Real64 T_i0_j0 = groundTemps(i0, j0); + const Real64 T_i0_j1 = groundTemps(i0, j1); + const Real64 T_i1_j0 = groundTemps(i1, j0); + const Real64 T_i1_j1 = groundTemps(i1, j1); - // Interpolate to correct depth now that we're at the right time - T_ix_jy = interpolate(depth, cellDepths(j1), cellDepths(j0), T_ix_j1, T_ix_j0); + // Interpolate between days holding depth constant + const Real64 T_ix_j0 = interpolate(dayFrac, 1, 0, T_i1_j0, T_i0_j0); + const Real64 T_ix_j1 = interpolate(dayFrac, 1, 0, T_i1_j1, T_i0_j1); + + // Interpolate to correct depth now that we're at the right time + return interpolate(depth, cellDepths(j1), cellDepths(j0), T_ix_j1, T_ix_j0); + } - } else { // All other days - i0 = int(simTimeInDays); + i0 = static_cast(simTimeInDays); i1 = i0 + 1; // Lookup ground temps - T_i0_j0 = groundTemps(i0, j0); - T_i0_j1 = groundTemps(i0, j1); - T_i1_j0 = groundTemps(i1, j0); - T_i1_j1 = groundTemps(i1, j1); + const Real64 T_i0_j0 = groundTemps(i0, j0); + const Real64 T_i0_j1 = groundTemps(i0, j1); + const Real64 T_i1_j0 = groundTemps(i1, j0); + const Real64 T_i1_j1 = groundTemps(i1, j1); // Interpolate between days holding depth constant - T_ix_j0 = interpolate(dayFrac, 1, 0, T_i1_j0, T_i0_j0); - T_ix_j1 = interpolate(dayFrac, 1, 0, T_i1_j1, T_i0_j1); + const Real64 T_ix_j0 = interpolate(dayFrac, 1, 0, T_i1_j0, T_i0_j0); + const Real64 T_ix_j1 = interpolate(dayFrac, 1, 0, T_i1_j1, T_i0_j1); // Interpolate to correct depth now that we're at the right time - T_ix_jy = interpolate(depth, cellDepths(j1), cellDepths(j0), T_ix_j1, T_ix_j0); + return interpolate(depth, cellDepths(j1), cellDepths(j0), T_ix_j1, T_ix_j0); } - } else { // Requesting a temperature deeper than domain. Pass deepest point in domain. j0 = totalNumCells; j1 = j0; @@ -987,149 +961,150 @@ Real64 FiniteDiffGroundTempsModel::getGroundTemp(EnergyPlusData &state) i1 = 1; // Lookup ground temps - T_i0_j1 = groundTemps(i0, j1); - T_i1_j1 = groundTemps(i1, j1); + const Real64 T_i0_j1 = groundTemps(i0, j1); + const Real64 T_i1_j1 = groundTemps(i1, j1); // Interpolate between days holding depth constant - T_ix_jy = interpolate(dayFrac, 1, 0, T_i1_j1, T_i0_j1); + return interpolate(dayFrac, 1, 0, T_i1_j1, T_i0_j1); + } - } else { - // All other days - i0 = int(simTimeInDays); - i1 = i0 + 1; + // All other days + i0 = static_cast(simTimeInDays); + i1 = i0 + 1; - // Lookup ground temps - T_i0_j1 = groundTemps(i0, j1); - T_i1_j1 = groundTemps(i1, j1); + // Lookup ground temps + const Real64 T_i0_j1 = groundTemps(i0, j1); + const Real64 T_i1_j1 = groundTemps(i1, j1); - // Interpolate between days holding depth constant - T_ix_jy = interpolate(dayFrac, 1, 0, T_i1_j1, T_i0_j1); - } + // Interpolate between days holding depth constant + return interpolate(dayFrac, 1, 0, T_i1_j1, T_i0_j1); } - return T_ix_jy; -} + //****************************************************************************** -//****************************************************************************** + Real64 FiniteDiffGroundTempsModel::getGroundTempAtTimeInSeconds(EnergyPlusData &state, Real64 const _depth, Real64 const seconds) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 -Real64 FiniteDiffGroundTempsModel::getGroundTempAtTimeInSeconds(EnergyPlusData &state, Real64 const _depth, Real64 const seconds) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + // PURPOSE OF THIS SUBROUTINE: + // Retrieves ground temperature when input time is in seconds - // PURPOSE OF THIS SUBROUTINE: - // Retrieves ground tempeature when input time is in seconds + depth = _depth; - depth = _depth; + simTimeInDays = seconds / Constant::rSecsInDay; - simTimeInDays = seconds / Constant::SecsInDay; + if (simTimeInDays > state.dataWeather->NumDaysInYear) { + simTimeInDays = remainder(simTimeInDays, state.dataWeather->NumDaysInYear); + } - if (simTimeInDays > state.dataWeather->NumDaysInYear) { - simTimeInDays = remainder(simTimeInDays, state.dataWeather->NumDaysInYear); + return getGroundTemp(state); } - return getGroundTemp(state); -} + //****************************************************************************** -//****************************************************************************** + Real64 FiniteDiffGroundTempsModel::getGroundTempAtTimeInMonths(EnergyPlusData &state, Real64 const _depth, int const month) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 -Real64 FiniteDiffGroundTempsModel::getGroundTempAtTimeInMonths(EnergyPlusData &state, Real64 const _depth, int const month) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + // PURPOSE OF THIS SUBROUTINE: + // Returns ground temperature when input time is in months - // PURPOSE OF THIS SUBROUTINE: - // Returns ground temperature when input time is in months + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + // TODO: Fixing this to be floating point 12.0 causes diffs and failed tests + Real64 const aveDaysInMonth = state.dataWeather->NumDaysInYear / 12; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 const aveDaysInMonth = state.dataWeather->NumDaysInYear / 12; + depth = _depth; - depth = _depth; + // Convert months to days. Puts time in middle of specified month + simTimeInDays = aveDaysInMonth * ((month - 1) + 0.5); - // Convert months to days. Puts time in middle of specified month - simTimeInDays = aveDaysInMonth * ((month - 1) + 0.5); + if (simTimeInDays > state.dataWeather->NumDaysInYear) { + simTimeInDays = remainder(simTimeInDays, state.dataWeather->NumDaysInYear); + } - if (simTimeInDays > state.dataWeather->NumDaysInYear) { - simTimeInDays = remainder(simTimeInDays, state.dataWeather->NumDaysInYear); + // Get and return ground temperature + return getGroundTemp(state); } - // Get and return ground temperature - return getGroundTemp(state); -} + //****************************************************************************** + + void FiniteDiffGroundTempsModel::evaluateSoilRhoCpCell(int const cell) + { + // SUBROUTINE INFORMATION: + // AUTHOR Edwin Lee + // DATE WRITTEN Summer 2011 -//****************************************************************************** + // PURPOSE OF THIS SUBROUTINE: + // Evaluates the soil properties on a single cell -void FiniteDiffGroundTempsModel::evaluateSoilRhoCp(ObjexxFCL::Optional cell, ObjexxFCL::Optional_bool_const InitOnly) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Edwin Lee - // DATE WRITTEN Summer 2011 + // Real64 rhoCP_soil; - // PURPOSE OF THIS SUBROUTINE: - // Evaluates the soil properties + // These vary by domain now, so we must be careful to retrieve them every time - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 rho_ice; - Real64 rho_liq; - Real64 CP_liq; - Real64 CP_ice; - Real64 Lat_fus; - Real64 Cp_transient; - // other variables - Real64 rhoCP_soil; + auto &thisCell = cellArray(cell); + + // set some temperatures here for generalization -- these could be set in the input file + // constexpr Real64 frzAllIce = -0.5; + // constexpr Real64 frzIceTrans = -0.4; + // constexpr Real64 frzLiqTrans = -0.1; + // constexpr Real64 frzAllLiq = 0.0; + + // calculate this cell's new Cp value based on the cell temperature + // if (thisCell.temperature >= frzAllLiq) { + // rhoCP_soil = rhoCp_soil_liq_1; + // } else if (thisCell.temperature <= frzAllIce) { + // rhoCP_soil = rhoCP_soil_ice; + // } else if (thisCell.temperature > frzLiqTrans) { + // rhoCP_soil = rhoCp_soil_liq_1 + (rhoCP_soil_transient - rhoCP_soil_liq) / (frzAllLiq - frzLiqTrans) * (frzAllLiq - + // thisCell.temperature); + // } else if (thisCell.temperature >= frzIceTrans) { + // rhoCP_soil = rhoCP_soil_transient; + // } else { + // rhoCP_soil = rhoCP_soil_ice + (rhoCP_soil_transient - rhoCP_soil_ice) / (frzIceTrans - frzAllIce) * (thisCell.temperature - frzAllIce); + // } + + // TODO: The calculated rhoCP_soil is commented on this line and never used. Curious. + thisCell.props.rhoCp = baseDensity * baseSpecificHeat; // rhoCP_soil; + + thisCell.props.specificHeat = thisCell.props.rhoCp / thisCell.props.density; + } - // These vary by domain now, so we must be careful to retrieve them every time - Real64 Theta_liq = waterContent; - Real64 Theta_sat = saturatedWaterContent; + void FiniteDiffGroundTempsModel::evaluateSoilRhoCpInit() + { + // SUBROUTINE INFORMATION: + // AUTHOR Edwin Lee + // DATE WRITTEN Summer 2011 - // Assumption - Real64 Theta_ice = Theta_liq; + // PURPOSE OF THIS SUBROUTINE: + // Evaluates the soil properties + + // These vary by domain now, so we must be careful to retrieve them every time + const Real64 Theta_liq = waterContent; + const Real64 Theta_sat = saturatedWaterContent; + + // Assumption + const Real64 Theta_ice = Theta_liq; - if (present(InitOnly)) { //'Cp (freezing) calculations - rho_ice = 917.0; //'Kg / m3 - rho_liq = 1000.0; //'kg / m3 - rhoCp_soil_liq_1 = 1225000.0 / (1.0 - Theta_sat); //'J/m3K - //'from( " An improved model for predicting soil thermal conductivity from water content at room temperature, Fig 4" ) - CP_liq = 4180.0; //'J / KgK - CP_ice = 2066.0; //'J / KgK - Lat_fus = 334000.0; //'J / Kg - Cp_transient = Lat_fus / 0.4 + (0.5 * CP_ice - (CP_liq + CP_ice) / 2.0 * 0.1) / 0.4; - //'from( " Numerical and experimental investigation of melting and freezing processes in phase change material storage" ) + constexpr Real64 rho_ice = 917.0; //'Kg / m3 + constexpr Real64 rho_liq = 1000.0; //'kg / m3 + rhoCp_soil_liq_1 = 1225000.0 / (1.0 - Theta_sat); // J/m3K + // from( " An improved model for predicting soil thermal conductivity from water content at room temperature, Fig 4" ) + constexpr Real64 CP_liq = 4180.0; //'J / KgK + constexpr Real64 CP_ice = 2066.0; //'J / KgK + constexpr Real64 Lat_fus = 334000.0; //'J / Kg + constexpr Real64 Cp_transient = Lat_fus / 0.4 + (0.5 * CP_ice - (CP_liq + CP_ice) / 2.0 * 0.1) / 0.4; + // from( " Numerical and experimental investigation of melting and freezing processes in phase change material storage" ) rhoCP_soil_liq = rhoCp_soil_liq_1 * (1.0 - Theta_sat) + rho_liq * CP_liq * Theta_liq; rhoCP_soil_transient = rhoCp_soil_liq_1 * (1.0 - Theta_sat) + ((rho_liq + rho_ice) / 2.0) * Cp_transient * Theta_ice; rhoCP_soil_ice = rhoCp_soil_liq_1 * (1.0 - Theta_sat) + rho_ice * CP_ice * Theta_ice; //'!J / m3K - return; - } - - auto &thisCell = cellArray(cell); - - //'set some temperatures here for generalization -- these could be set in the input file - Real64 frzAllIce = -0.5; - Real64 frzIceTrans = -0.4; - Real64 frzLiqTrans = -0.1; - Real64 frzAllLiq = 0.0; - - //'calculate this cell's new Cp value based on the cell temperature - if (thisCell.temperature >= frzAllLiq) { - rhoCP_soil = rhoCp_soil_liq_1; - } else if (thisCell.temperature <= frzAllIce) { - rhoCP_soil = rhoCP_soil_ice; - } else if (thisCell.temperature > frzLiqTrans) { - rhoCP_soil = rhoCp_soil_liq_1 + (rhoCP_soil_transient - rhoCP_soil_liq) / (frzAllLiq - frzLiqTrans) * (frzAllLiq - thisCell.temperature); - } else if (thisCell.temperature >= frzIceTrans) { - rhoCP_soil = rhoCP_soil_transient; - } else { - rhoCP_soil = rhoCP_soil_ice + (rhoCP_soil_transient - rhoCP_soil_ice) / (frzIceTrans - frzAllIce) * (thisCell.temperature - frzAllIce); } - thisCell.props.rhoCp = baseDensity * baseSpecificHeat; // rhoCP_soil; - - thisCell.props.specificHeat = thisCell.props.rhoCp / thisCell.props.density; -} - -//****************************************************************************** + //****************************************************************************** +} // namespace GroundTemp } // namespace EnergyPlus diff --git a/src/EnergyPlus/GroundTemperatureModeling/FiniteDifferenceGroundTemperatureModel.hh b/src/EnergyPlus/GroundTemperatureModeling/FiniteDifferenceGroundTemperatureModel.hh index 83422a21780..791c26c20fd 100644 --- a/src/EnergyPlus/GroundTemperatureModeling/FiniteDifferenceGroundTemperatureModel.hh +++ b/src/EnergyPlus/GroundTemperatureModeling/FiniteDifferenceGroundTemperatureModel.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -48,13 +48,9 @@ #ifndef FiniteDifferenceGroundTemperatureModel_hh_INCLUDED #define FiniteDifferenceGroundTemperatureModel_hh_INCLUDED -// C++ Headers -#include - // ObjexxFCL Headers #include #include -#include // EnergyPlus Headers #include @@ -65,128 +61,128 @@ namespace EnergyPlus { // Forward declarations struct EnergyPlusData; -// Derived class for Finite-Difference Model -class FiniteDiffGroundTempsModel : public BaseGroundTempsModel -{ - - static int constexpr maxYearsToIterate = 10; - - Real64 rhoCp_soil_liq_1; - Real64 rhoCP_soil_liq; - Real64 rhoCP_soil_transient; - Real64 rhoCP_soil_ice; - -public: - Real64 baseConductivity; - Real64 baseDensity; - Real64 baseSpecificHeat; - int totalNumCells; - Real64 timeStepInSeconds; - Real64 evapotransCoeff; - Real64 saturatedWaterContent; - Real64 waterContent; - Real64 annualAveAirTemp; - Real64 minDailyAirTemp; // Set hi. Will be reset later - Real64 maxDailyAirTemp; // Set low. Will be reset later - Real64 dayOfMinDailyAirTemp; - Real64 depth; - Real64 simTimeInDays; - - // Default constructor - FiniteDiffGroundTempsModel() : minDailyAirTemp(100.0), maxDailyAirTemp(-100.0), dayOfMinDailyAirTemp(1) - { - } +namespace GroundTemp { - struct instanceOfCellData + // Derived class for Finite-Difference Model + class FiniteDiffGroundTempsModel : public BaseGroundTempsModel { - struct properties + static int constexpr maxYearsToIterate = 10; + + Real64 rhoCp_soil_liq_1 = 0.0; + Real64 rhoCP_soil_liq = 0.0; + Real64 rhoCP_soil_transient = 0.0; + Real64 rhoCP_soil_ice = 0.0; + + public: + Real64 baseConductivity = 0.0; + Real64 baseDensity = 0.0; + Real64 baseSpecificHeat = 0.0; + int totalNumCells = 0; + Real64 timeStepInSeconds = 0.0; + Real64 evapotransCoeff = 0.0; + Real64 saturatedWaterContent = 0.0; + Real64 waterContent = 0.0; + Real64 annualAveAirTemp = 0.0; + Real64 minDailyAirTemp = 100.0; // Set hi. Will be reset later + Real64 maxDailyAirTemp = -100.0; // Set low. Will be reset later + Real64 dayOfMinDailyAirTemp = 1; + Real64 depth = 0.0; + Real64 simTimeInDays = 0.0; + + struct instanceOfCellData { - Real64 conductivity; - Real64 density; - Real64 specificHeat; - Real64 diffusivity; - Real64 rhoCp; + + struct properties + { + Real64 conductivity = 0.0; + Real64 density = 0.0; + Real64 specificHeat = 0.0; + Real64 diffusivity = 0.0; + Real64 rhoCp = 0.0; + }; + + properties props; + + int index = 0; + Real64 thickness = 0.0; + Real64 minZValue = 0.0; + Real64 maxZValue = 0.0; + Real64 temperature = 0.0; + Real64 temperature_prevIteration = 0.0; + Real64 temperature_prevTimeStep = 0.0; + Real64 temperature_finalConvergence = 0.0; + Real64 beta = 0.0; + Real64 volume = 0.0; + Real64 conductionArea = 1.0; // Assumes 1 m2 }; - properties props; - - int index; - Real64 thickness; - Real64 minZValue; - Real64 maxZValue; - Real64 temperature; - Real64 temperature_prevIteration; - Real64 temperature_prevTimeStep; - Real64 temperature_finalConvergence; - Real64 beta; - Real64 volume; - Real64 conductionArea = 1.0; // Assumes 1 m2 - }; + Array1D cellArray; - Array1D cellArray; + struct instanceOfWeatherData + { + Real64 dryBulbTemp = 0.0; + Real64 relativeHumidity = 0.0; + Real64 windSpeed = 0.0; + Real64 horizontalRadiation = 0.0; + Real64 airDensity = 0.0; + }; - struct instanceOfWeatherData - { - Real64 dryBulbTemp; - Real64 relativeHumidity; - Real64 windSpeed; - Real64 horizontalRadiation; - Real64 airDensity; - }; + Array1D weatherDataArray; - Array1D weatherDataArray; + static FiniteDiffGroundTempsModel *FiniteDiffGTMFactory(EnergyPlusData &state, const std::string &objectName); - static std::shared_ptr FiniteDiffGTMFactory(EnergyPlusData &state, std::string objectName); + void getWeatherData(EnergyPlusData &state); - void getWeatherData(EnergyPlusData &state); + void initAndSim(EnergyPlusData &state); - void initAndSim(EnergyPlusData &state); + void developMesh(); - void developMesh(); + void performSimulation(EnergyPlusData &state); - void performSimulation(EnergyPlusData &state); + void updateSurfaceCellTemperature(const EnergyPlusData &state); - void updateSurfaceCellTemperature(EnergyPlusData &state); + void updateGeneralDomainCellTemperature(int cell); - void updateGeneralDomainCellTemperature(int const cell); + void updateBottomCellTemperature(); - void updateBottomCellTemperature(); + void initDomain(EnergyPlusData &state); - void initDomain(EnergyPlusData &state); + bool checkFinalTemperatureConvergence(const EnergyPlusData &state); - bool checkFinalTemperatureConvergence(EnergyPlusData &state); + bool checkIterationTemperatureConvergence(); - bool checkIterationTemperatureConvergence(); + void updateIterationTemperatures(); - void updateIterationTemperatures(); + void updateTimeStepTemperatures(const EnergyPlusData &state); - void updateTimeStepTemperatures(EnergyPlusData &state); + void doStartOfTimeStepInits(); - void doStartOfTimeStepInits(); + Real64 getGroundTemp(EnergyPlusData &state) override; - Real64 getGroundTemp(EnergyPlusData &state) override; + Real64 getGroundTempAtTimeInSeconds(EnergyPlusData &state, Real64 depth, Real64 timeInSecondsOfSim) override; - Real64 getGroundTempAtTimeInSeconds(EnergyPlusData &state, Real64 const depth, Real64 const timeInSecondsOfSim) override; + Real64 getGroundTempAtTimeInMonths(EnergyPlusData &state, Real64 depth, int monthOfSim) override; - Real64 getGroundTempAtTimeInMonths(EnergyPlusData &state, Real64 const depth, int const monthOfSim) override; + void evaluateSoilRhoCpInit(); - void evaluateSoilRhoCp(ObjexxFCL::Optional cell = _, ObjexxFCL::Optional_bool_const InitOnly = _); + void evaluateSoilRhoCpCell(int cell); - Real64 interpolate(Real64 const x, Real64 const x_hi, Real64 const x_low, Real64 const y_hi, Real64 const y_low); + static Real64 interpolate(Real64 x, Real64 x_hi, Real64 x_low, Real64 y_hi, Real64 y_low); - Array2D groundTemps; + Array2D groundTemps; - Array1D cellDepths; + Array1D cellDepths; - enum surfaceTypes - { - surfaceCoverType_bareSoil = 1, - surfaceCoverType_shortGrass = 2, - surfaceCoverType_longGrass = 3 + enum surfaceTypes + { + surfaceCoverType_bareSoil = 1, + surfaceCoverType_shortGrass = 2, + surfaceCoverType_longGrass = 3 + }; }; -}; +} // namespace GroundTemp } // namespace EnergyPlus #endif diff --git a/src/EnergyPlus/GroundTemperatureModeling/GroundTemperatureModelManager.cc b/src/EnergyPlus/GroundTemperatureModeling/GroundTemperatureModelManager.cc index 913d2c0403e..9702fe149af 100644 --- a/src/EnergyPlus/GroundTemperatureModeling/GroundTemperatureModelManager.cc +++ b/src/EnergyPlus/GroundTemperatureModeling/GroundTemperatureModelManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -46,7 +46,6 @@ // POSSIBILITY OF SUCH DAMAGE. // C++ Headers -#include #include // EnergyPlus Headers @@ -63,75 +62,45 @@ #include #include -namespace EnergyPlus { +namespace EnergyPlus::GroundTemp { -namespace GroundTemperatureManager { +BaseGroundTempsModel *GetGroundTempModelAndInit(EnergyPlusData &state, ModelType modelType, std::string const &name) +{ + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 - constexpr std::array(GroundTempObjType::Num)> groundTempModelNamesUC = { - "SITE:GROUNDTEMPERATURE:UNDISTURBED:KUSUDAACHENBACH", - "SITE:GROUNDTEMPERATURE:UNDISTURBED:FINITEDIFFERENCE", - "SITE:GROUNDTEMPERATURE:BUILDINGSURFACE", - "SITE:GROUNDTEMPERATURE:SHALLOW", - "SITE:GROUNDTEMPERATURE:DEEP", - "SITE:GROUNDTEMPERATURE:FCFACTORMETHOD", - "SITE:GROUNDTEMPERATURE:UNDISTURBED:XING"}; + // PURPOSE OF THIS SUBROUTINE: + // Called by objects requiring ground temperature models. Determines type and calls appropriate factory method. - constexpr std::array(GroundTempObjType::Num)> groundTempModelNames = { - "Site:GroundTemperature:Undisturbed:KusudaAchenbach", - "Site:GroundTemperature:Undisturbed:FiniteDifference", - "Site:GroundTemperature:BuildingSurface", - "Site:GroundTemperature:Shallow", - "Site:GroundTemperature:Deep", - "Site:GroundTemperature:FCfactorMethod", - "Site:GroundTemperature:Undisturbed:Xing"}; - - std::shared_ptr - GetGroundTempModelAndInit(EnergyPlusData &state, std::string_view const objectType_str, std::string const &objectName) - { - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 - - // PURPOSE OF THIS SUBROUTINE: - // Called by objects requiring ground temperature models. Determines type and calls appropriate factory method. - - // Set object type - GroundTempObjType objectType = static_cast(getEnumValue(groundTempModelNamesUC, Util::makeUPPER(objectType_str))); - - assert(objectType != GroundTempObjType::Invalid); - - int numGTMs = state.dataGrndTempModelMgr->groundTempModels.size(); - - // Check if this instance of this model has already been retrieved - for (int i = 0; i < numGTMs; ++i) { - auto currentModel = state.dataGrndTempModelMgr->groundTempModels[i]; // (AUTO_OK_UNIQUE_PTR) - // Check if the type and name match - if (objectType == currentModel->objectType && objectName == currentModel->objectName) { - return state.dataGrndTempModelMgr->groundTempModels[i]; - } - } - - // If not found, create new instance of the model - if (objectType == GroundTempObjType::KusudaGroundTemp) { - return KusudaGroundTempsModel::KusudaGTMFactory(state, objectName); - } else if (objectType == GroundTempObjType::FiniteDiffGroundTemp) { - return FiniteDiffGroundTempsModel::FiniteDiffGTMFactory(state, objectName); - } else if (objectType == GroundTempObjType::SiteBuildingSurfaceGroundTemp) { - return SiteBuildingSurfaceGroundTemps::BuildingSurfaceGTMFactory(state, objectName); - } else if (objectType == GroundTempObjType::SiteShallowGroundTemp) { - return SiteShallowGroundTemps::ShallowGTMFactory(state, objectName); - } else if (objectType == GroundTempObjType::SiteDeepGroundTemp) { - return SiteDeepGroundTemps::DeepGTMFactory(state, objectName); - } else if (objectType == GroundTempObjType::SiteFCFactorMethodGroundTemp) { - return SiteFCFactorMethodGroundTemps::FCFactorGTMFactory(state, objectName); - } else if (objectType == GroundTempObjType::XingGroundTemp) { - return XingGroundTempsModel::XingGTMFactory(state, objectName); - } else { - assert(false); - return nullptr; + // Check if this instance of this model has already been retrieved + for (auto *gtm : state.dataGrndTempModelMgr->groundTempModels) { + // Check if the type and name match + if (modelType == gtm->modelType && name == gtm->Name) { + return gtm; } } -} // namespace GroundTemperatureManager + // If not found, create new instance of the model + switch (modelType) { + case ModelType::Kusuda: + return KusudaGroundTempsModel::KusudaGTMFactory(state, name); + case ModelType::FiniteDiff: + return FiniteDiffGroundTempsModel::FiniteDiffGTMFactory(state, name); + case ModelType::SiteBuildingSurface: + return SiteBuildingSurfaceGroundTemps::BuildingSurfaceGTMFactory(state, name); + case ModelType::SiteShallow: + return SiteShallowGroundTemps::ShallowGTMFactory(state, name); + case ModelType::SiteDeep: + return SiteDeepGroundTemps::DeepGTMFactory(state, name); + case ModelType::SiteFCFactorMethod: + return SiteFCFactorMethodGroundTemps::FCFactorGTMFactory(state, name); + case ModelType::Xing: + return XingGroundTempsModel::XingGTMFactory(state, name); + default: + assert(false); + return nullptr; + } +} -} // namespace EnergyPlus +} // namespace EnergyPlus::GroundTemp diff --git a/src/EnergyPlus/GroundTemperatureModeling/GroundTemperatureModelManager.hh b/src/EnergyPlus/GroundTemperatureModeling/GroundTemperatureModelManager.hh index a905559976b..89f8e639cf5 100644 --- a/src/EnergyPlus/GroundTemperatureModeling/GroundTemperatureModelManager.hh +++ b/src/EnergyPlus/GroundTemperatureModeling/GroundTemperatureModelManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -47,49 +47,4 @@ #ifndef GroundTemperatureModelManager_hh_INCLUDED #define GroundTemperatureModelManager_hh_INCLUDED - -// C++ Headers -#include - -// ObjexxFCL Headers -#include - -// EnergyPlus Headers -#include -#include -#include -#include - -namespace EnergyPlus { - -// Forward declarations -struct EnergyPlusData; -class BaseGroundTempsModel; - -namespace GroundTemperatureManager { - - extern const std::array(GroundTempObjType::Num)> groundTempModelNamesUC; - - extern const std::array(GroundTempObjType::Num)> groundTempModelNames; - - std::shared_ptr GetGroundTempModelAndInit(EnergyPlusData &state, std::string_view const type, std::string const &name); - -} // namespace GroundTemperatureManager - -struct GroundTemperatureManagerData : BaseGlobalStruct -{ - std::vector> groundTempModels; - - void init_state([[maybe_unused]] EnergyPlusData &state) override - { - } - - void clear_state() override - { - new (this) GroundTemperatureManagerData(); - } -}; - -} // namespace EnergyPlus - #endif diff --git a/src/EnergyPlus/GroundTemperatureModeling/KusudaAchenbachGroundTemperatureModel.cc b/src/EnergyPlus/GroundTemperatureModeling/KusudaAchenbachGroundTemperatureModel.cc index 950331d122b..59c7fc7d0c7 100644 --- a/src/EnergyPlus/GroundTemperatureModeling/KusudaAchenbachGroundTemperatureModel.cc +++ b/src/EnergyPlus/GroundTemperatureModeling/KusudaAchenbachGroundTemperatureModel.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -45,16 +45,11 @@ // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. -// C++ Headers -#include - -// ObjexxFCL Headers - // EnergyPlus Headers #include #include -#include #include +#include #include #include #include @@ -62,191 +57,202 @@ namespace EnergyPlus { //****************************************************************************** - -// Kusuda model factory -std::shared_ptr KusudaGroundTempsModel::KusudaGTMFactory(EnergyPlusData &state, std::string objectName) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 - - // PURPOSE OF THIS SUBROUTINE: - // Reads input and creates instance of Kusuda ground temps model - - // Locals - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - bool found = false; - int NumNums; - int NumAlphas; - int IOStat; - - // New shared pointer for this model object - std::shared_ptr thisModel(new KusudaGroundTempsModel()); - - GroundTempObjType objType = GroundTempObjType::KusudaGroundTemp; - - std::string_view const cCurrentModuleObject = GroundTemperatureManager::groundTempModelNamesUC[static_cast(objType)]; - int numCurrModels = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - - for (int modelNum = 1; modelNum <= numCurrModels; ++modelNum) { - - state.dataInputProcessing->inputProcessor->getObjectItem( - state, cCurrentModuleObject, modelNum, state.dataIPShortCut->cAlphaArgs, NumAlphas, state.dataIPShortCut->rNumericArgs, NumNums, IOStat); - - if (objectName == state.dataIPShortCut->cAlphaArgs(1)) { - - // Read input into object here - thisModel->objectName = state.dataIPShortCut->cAlphaArgs(1); - thisModel->objectType = objType; - thisModel->groundThermalDiffisivity = - state.dataIPShortCut->rNumericArgs(1) / (state.dataIPShortCut->rNumericArgs(2) * state.dataIPShortCut->rNumericArgs(3)); - - bool useGroundTempDataForKusuda = - state.dataIPShortCut->rNumericArgs(4) || state.dataIPShortCut->rNumericArgs(5) || state.dataIPShortCut->rNumericArgs(6); - - if (useGroundTempDataForKusuda) { - // Use Kusuda Parameters - thisModel->aveGroundTemp = state.dataIPShortCut->rNumericArgs(4); - thisModel->aveGroundTempAmplitude = state.dataIPShortCut->rNumericArgs(5); - thisModel->phaseShiftInSecs = state.dataIPShortCut->rNumericArgs(6) * Constant::SecsInDay; - } else { - // Use data from Site:GroundTemperature:Shallow to generate parameters - - int monthsInYear(12); - int avgDaysInMonth(30); - int monthOfMinSurfTemp(0); - Real64 averageGroundTemp(0); - Real64 amplitudeOfGroundTemp(0); - Real64 phaseShiftOfMinGroundTempDays(0); - Real64 minSurfTemp(100); // Set high month 1 temp will be lower and actually get updated - Real64 maxSurfTemp(-100); // Set low initially but will get updated - - std::shared_ptr shallowObj = GroundTemperatureManager::GetGroundTempModelAndInit( - state, - static_cast( - GroundTemperatureManager::groundTempModelNamesUC[static_cast(GroundTempObjType::SiteShallowGroundTemp)]), - ""); - - for (int monthIndex = 1; monthIndex <= 12; ++monthIndex) { - Real64 currMonthTemp = shallowObj->getGroundTempAtTimeInMonths(state, 0.0, monthIndex); - - // Calculate Average Ground Temperature for all 12 months of the year: - averageGroundTemp += currMonthTemp; - - // Need max temp, min temp, and month of min surf temp to set amplitude and month of min surf temp - if (currMonthTemp <= minSurfTemp) { - monthOfMinSurfTemp = monthIndex; - minSurfTemp = currMonthTemp; +namespace GroundTemp { + + // Kusuda model factory + KusudaGroundTempsModel *KusudaGroundTempsModel::KusudaGTMFactory(EnergyPlusData &state, const std::string &objectName) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 + + // PURPOSE OF THIS SUBROUTINE: + // Reads input and creates instance of Kusuda ground temps model + + // Locals + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + bool found = false; + int NumNums; + int NumAlphas; + int IOStat; + + // New shared pointer for this model object + auto *thisModel = new KusudaGroundTempsModel(); + + // There was some **spooky** behavior here. One of the calling sites for this factory was passing in a reference + // to a dataIPShortCuts item as the objectName argument. Inside here, we make a second call to getObjectItem + // which then overwrites the value. So objectName gets overwritten. I made a copy of the string here to ensure + // it persists. + const std::string lookingForName = objectName; // NOLINT(*-unnecessary-copy-initialization) + + ModelType modelType = ModelType::Kusuda; + + std::string_view const cCurrentModuleObject = GroundTemp::modelTypeNamesUC[(int)modelType]; + const int numCurrModels = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + + for (int modelNum = 1; modelNum <= numCurrModels; ++modelNum) { + + state.dataInputProcessing->inputProcessor->getObjectItem(state, + cCurrentModuleObject, + modelNum, + state.dataIPShortCut->cAlphaArgs, + NumAlphas, + state.dataIPShortCut->rNumericArgs, + NumNums, + IOStat); + + if (lookingForName == state.dataIPShortCut->cAlphaArgs(1)) { + + // Read input into object here + thisModel->Name = state.dataIPShortCut->cAlphaArgs(1); + thisModel->modelType = modelType; + thisModel->groundThermalDiffusivity = + state.dataIPShortCut->rNumericArgs(1) / (state.dataIPShortCut->rNumericArgs(2) * state.dataIPShortCut->rNumericArgs(3)); + + std::array flags = { + state.dataIPShortCut->rNumericArgs(4), state.dataIPShortCut->rNumericArgs(5), state.dataIPShortCut->rNumericArgs(6)}; + const bool useGroundTempDataForKusuda = + std::any_of(flags.begin(), flags.end(), [](Real64 const flag) { return static_cast(flag); }); + + if (useGroundTempDataForKusuda) { + // Use Kusuda Parameters + thisModel->aveGroundTemp = state.dataIPShortCut->rNumericArgs(4); + thisModel->aveGroundTempAmplitude = state.dataIPShortCut->rNumericArgs(5); + thisModel->phaseShiftInSecs = state.dataIPShortCut->rNumericArgs(6) * Constant::rSecsInDay; + } else { + // Use data from Site:GroundTemperature:Shallow to generate parameters + + constexpr int monthsInYear(12); + constexpr int avgDaysInMonth(30); + int monthOfMinSurfTemp(0); + Real64 averageGroundTemp(0); + Real64 amplitudeOfGroundTemp(0); + Real64 phaseShiftOfMinGroundTempDays(0); + Real64 minSurfTemp(100); // Set high; month 1 temp will be lower than that and actually get updated + Real64 maxSurfTemp(-100); // Set low initially but will get updated + + // get a non-owning pointer to the shallow ground temperature object, whether user-input or defaults + BaseGroundTempsModel *shallowObj = SiteShallowGroundTemps::ShallowGTMFactory(state, ""); + + for (int monthIndex = 1; monthIndex <= 12; ++monthIndex) { + const Real64 currMonthTemp = shallowObj->getGroundTempAtTimeInMonths(state, 0.0, monthIndex); + + // Calculate Average Ground Temperature for all 12 months of the year: + averageGroundTemp += currMonthTemp; + + // Need max temp, min temp, and month of min surf temp to set amplitude and month of min surf temp + if (currMonthTemp <= minSurfTemp) { + monthOfMinSurfTemp = monthIndex; + minSurfTemp = currMonthTemp; + } + + if (currMonthTemp >= maxSurfTemp) { + maxSurfTemp = currMonthTemp; + } } - if (currMonthTemp >= maxSurfTemp) { - maxSurfTemp = currMonthTemp; - } - } + averageGroundTemp /= monthsInYear; - averageGroundTemp /= monthsInYear; + amplitudeOfGroundTemp = (maxSurfTemp - minSurfTemp) / 2.0; - amplitudeOfGroundTemp = (maxSurfTemp - minSurfTemp) / 2.0; + phaseShiftOfMinGroundTempDays = monthOfMinSurfTemp * avgDaysInMonth; - phaseShiftOfMinGroundTempDays = monthOfMinSurfTemp * avgDaysInMonth; + // Assign to KA Model + thisModel->aveGroundTemp = averageGroundTemp; + thisModel->aveGroundTempAmplitude = amplitudeOfGroundTemp; + thisModel->phaseShiftInSecs = phaseShiftOfMinGroundTempDays * Constant::rSecsInDay; + } - // Assign to KA Model - thisModel->aveGroundTemp = averageGroundTemp; - thisModel->aveGroundTempAmplitude = amplitudeOfGroundTemp; - thisModel->phaseShiftInSecs = phaseShiftOfMinGroundTempDays * Constant::SecsInDay; + found = true; + break; } + } - found = true; - break; + if (found) { + state.dataGrndTempModelMgr->groundTempModels.push_back(thisModel); + return thisModel; } - } - if (found) { - state.dataGrndTempModelMgr->groundTempModels.push_back(thisModel); - return thisModel; - } else { - ShowFatalError(state, - fmt::format("{}--Errors getting input for ground temperature model", - GroundTemperatureManager::groundTempModelNames[static_cast(objType)])); + ShowFatalError(state, fmt::format("{}--Errors getting input for ground temperature model", GroundTemp::modelTypeNames[(int)modelType])); return nullptr; } -} -//****************************************************************************** + //****************************************************************************** -Real64 KusudaGroundTempsModel::getGroundTemp(EnergyPlusData &state) -{ - // AUTHOR Matt Mitchell - // DATE WRITTEN June 2015 + Real64 KusudaGroundTempsModel::getGroundTemp(EnergyPlusData &state) + { + // AUTHOR Matt Mitchell + // DATE WRITTEN June 2015 - // PURPOSE OF THIS FUNCTION: - // Returns a ground temperature + // PURPOSE OF THIS FUNCTION: + // Returns a ground temperature - // METHODOLOGY EMPLOYED: - // Kusuda and Achenbach correlation is used + // METHODOLOGY EMPLOYED: + // Kusuda and Achenbach correlation is used - Real64 const secsInYear = Constant::SecsInDay * state.dataWeather->NumDaysInYear; + Real64 const secsInYear = Constant::rSecsInDay * state.dataWeather->NumDaysInYear; - Real64 term1 = -depth * std::sqrt(Constant::Pi / (secsInYear * groundThermalDiffisivity)); - Real64 term2 = (2 * Constant::Pi / secsInYear) * - (simTimeInSeconds - phaseShiftInSecs - (depth / 2) * std::sqrt(secsInYear / (Constant::Pi * groundThermalDiffisivity))); + const Real64 term1 = -depth * std::sqrt(Constant::Pi / (secsInYear * groundThermalDiffusivity)); + const Real64 term2 = (2 * Constant::Pi / secsInYear) * + (simTimeInSeconds - phaseShiftInSecs - (depth / 2) * std::sqrt(secsInYear / (Constant::Pi * groundThermalDiffusivity))); - return aveGroundTemp - aveGroundTempAmplitude * std::exp(term1) * std::cos(term2); -} + return aveGroundTemp - aveGroundTempAmplitude * std::exp(term1) * std::cos(term2); + } -//****************************************************************************** + //****************************************************************************** -Real64 KusudaGroundTempsModel::getGroundTempAtTimeInSeconds(EnergyPlusData &state, Real64 const _depth, Real64 const _seconds) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + Real64 KusudaGroundTempsModel::getGroundTempAtTimeInSeconds(EnergyPlusData &state, Real64 const _depth, Real64 const _seconds) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 - // PURPOSE OF THIS SUBROUTINE: - // Returns the ground temperature when input time is in seconds + // PURPOSE OF THIS SUBROUTINE: + // Returns the ground temperature when input time is in seconds - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 const secondsInYear = state.dataWeather->NumDaysInYear * Constant::SecsInDay; + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + Real64 const secondsInYear = state.dataWeather->NumDaysInYear * Constant::rSecsInDay; - depth = _depth; + depth = _depth; - simTimeInSeconds = _seconds; + simTimeInSeconds = _seconds; + + if (simTimeInSeconds > secondsInYear) { + simTimeInSeconds = remainder(simTimeInSeconds, secondsInYear); + } - if (simTimeInSeconds > secondsInYear) { - simTimeInSeconds = remainder(simTimeInSeconds, secondsInYear); + // Get and return ground temperature + return getGroundTemp(state); } - // Get and return ground temperature - return getGroundTemp(state); -} + //****************************************************************************** -//****************************************************************************** + Real64 KusudaGroundTempsModel::getGroundTempAtTimeInMonths(EnergyPlusData &state, Real64 const _depth, int const _month) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 -Real64 KusudaGroundTempsModel::getGroundTempAtTimeInMonths(EnergyPlusData &state, Real64 const _depth, int const _month) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + // PURPOSE OF THIS SUBROUTINE: + // Returns the ground temperature when input time is in months - // PURPOSE OF THIS SUBROUTINE: - // Returns the ground temperature when input time is in months + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + Real64 const aveSecondsInMonth = (state.dataWeather->NumDaysInYear / 12) * Constant::rSecsInDay; + Real64 const secondsPerYear = state.dataWeather->NumDaysInYear * Constant::rSecsInDay; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 const aveSecondsInMonth = (state.dataWeather->NumDaysInYear / 12) * Constant::SecsInDay; - Real64 const secondsPerYear = state.dataWeather->NumDaysInYear * Constant::SecsInDay; + depth = _depth; - depth = _depth; + simTimeInSeconds = aveSecondsInMonth * (_month - 1 + 0.5); - simTimeInSeconds = aveSecondsInMonth * ((_month - 1) + 0.5); + if (simTimeInSeconds > secondsPerYear) { + simTimeInSeconds = remainder(simTimeInSeconds, secondsPerYear); + } - if (simTimeInSeconds > secondsPerYear) { - simTimeInSeconds = remainder(simTimeInSeconds, secondsPerYear); + // Get and return ground temperature + return getGroundTemp(state); } - // Get and return ground temperature - return getGroundTemp(state); -} - -//****************************************************************************** + //****************************************************************************** +} // namespace GroundTemp } // namespace EnergyPlus diff --git a/src/EnergyPlus/GroundTemperatureModeling/KusudaAchenbachGroundTemperatureModel.hh b/src/EnergyPlus/GroundTemperatureModeling/KusudaAchenbachGroundTemperatureModel.hh index 0a7156bfc72..da144f3c677 100644 --- a/src/EnergyPlus/GroundTemperatureModeling/KusudaAchenbachGroundTemperatureModel.hh +++ b/src/EnergyPlus/GroundTemperatureModeling/KusudaAchenbachGroundTemperatureModel.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -48,12 +48,8 @@ #ifndef KusudaAchenbachGroundTemperatureModel_hh_INCLUDED #define KusudaAchenbachGroundTemperatureModel_hh_INCLUDED -// C++ Headers -#include - // EnergyPlus Headers #include -#include #include #include @@ -62,27 +58,28 @@ namespace EnergyPlus { // Forward declarations struct EnergyPlusData; -// Derived class for Kusuda-Achenbach model -class KusudaGroundTempsModel : public BaseGroundTempsModel -{ -public: - // Public Members - Real64 depth; - Real64 groundThermalDiffisivity; - Real64 simTimeInSeconds; - Real64 aveGroundTemp; - Real64 aveGroundTempAmplitude; - Real64 phaseShiftInSecs; +namespace GroundTemp { + + // Derived class for Kusuda-Achenbach model + struct KusudaGroundTempsModel final : BaseGroundTempsModel + { + Real64 depth = 0.0; + Real64 groundThermalDiffusivity = 0.0; + Real64 simTimeInSeconds = 0.0; + Real64 aveGroundTemp = 0.0; + Real64 aveGroundTempAmplitude = 0.0; + Real64 phaseShiftInSecs = 0.0; - static std::shared_ptr KusudaGTMFactory(EnergyPlusData &state, std::string objectName); + static KusudaGroundTempsModel *KusudaGTMFactory(EnergyPlusData &state, const std::string &objectName); - Real64 getGroundTemp(EnergyPlusData &state) override; + Real64 getGroundTemp(EnergyPlusData &state) override; - Real64 getGroundTempAtTimeInSeconds(EnergyPlusData &state, Real64 const depth, Real64 const timeInSecondsOfSim) override; + Real64 getGroundTempAtTimeInSeconds(EnergyPlusData &state, Real64 depth, Real64 timeInSecondsOfSim) override; - Real64 getGroundTempAtTimeInMonths(EnergyPlusData &state, Real64 const depth, int const monthOfSim) override; -}; + Real64 getGroundTempAtTimeInMonths(EnergyPlusData &state, Real64 depth, int monthOfSim) override; + }; +} // namespace GroundTemp } // namespace EnergyPlus #endif diff --git a/src/EnergyPlus/GroundTemperatureModeling/SiteBuildingSurfaceGroundTemperatures.cc b/src/EnergyPlus/GroundTemperatureModeling/SiteBuildingSurfaceGroundTemperatures.cc index 90d687cd7b2..b804faaec47 100644 --- a/src/EnergyPlus/GroundTemperatureModeling/SiteBuildingSurfaceGroundTemperatures.cc +++ b/src/EnergyPlus/GroundTemperatureModeling/SiteBuildingSurfaceGroundTemperatures.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -45,15 +45,11 @@ // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. -// C++ Headers -#include - // EnergyPlus Headers #include #include #include #include -#include #include #include #include @@ -61,153 +57,145 @@ namespace EnergyPlus { -//****************************************************************************** +namespace GroundTemp { + // Site:GroundTemperature:BuildingSurface factory + SiteBuildingSurfaceGroundTemps *SiteBuildingSurfaceGroundTemps::BuildingSurfaceGTMFactory(EnergyPlusData &state, const std::string &objectName) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 -// Site:GroundTemperature:BuildingSurface factory -std::shared_ptr SiteBuildingSurfaceGroundTemps::BuildingSurfaceGTMFactory(EnergyPlusData &state, - std::string objectName) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + // PURPOSE OF THIS SUBROUTINE: + // Reads input and creates instance of Site:GroundTemperature:BuildingSurface object - // PURPOSE OF THIS SUBROUTINE: - // Reads input and creates instance of Site:GroundTemperature:BuildingSurface object + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + bool errorsFound = false; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - bool errorsFound = false; + // New shared pointer for this model object + auto *thisModel = new SiteBuildingSurfaceGroundTemps(); - // New shared pointer for this model object - std::shared_ptr thisModel(new SiteBuildingSurfaceGroundTemps()); + ModelType modelType = GroundTemp::ModelType::SiteBuildingSurface; - GroundTempObjType objType = GroundTempObjType::SiteBuildingSurfaceGroundTemp; + std::string_view const cCurrentModuleObject = GroundTemp::modelTypeNamesUC[(int)modelType]; + const int numCurrObjects = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - std::string_view const cCurrentModuleObject = GroundTemperatureManager::groundTempModelNamesUC[static_cast(objType)]; - int numCurrObjects = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + thisModel->modelType = modelType; + thisModel->Name = objectName; - thisModel->objectType = objType; - thisModel->objectName = objectName; + if (numCurrObjects == 1) { - if (numCurrObjects == 1) { + int NumNums; + int NumAlphas; + int IOStat; + bool genErrorMessage = false; - int NumNums; - int NumAlphas; - int IOStat; - bool genErrorMessage = false; + // Get the object names for each construction from the input processor + state.dataInputProcessing->inputProcessor->getObjectItem( + state, cCurrentModuleObject, 1, state.dataIPShortCut->cAlphaArgs, NumAlphas, state.dataIPShortCut->rNumericArgs, NumNums, IOStat); - // Get the object names for each construction from the input processor - state.dataInputProcessing->inputProcessor->getObjectItem( - state, cCurrentModuleObject, 1, state.dataIPShortCut->cAlphaArgs, NumAlphas, state.dataIPShortCut->rNumericArgs, NumNums, IOStat); + if (NumNums < 12) { + ShowSevereError(state, fmt::format("{}: Less than 12 values entered.", GroundTemp::modelTypeNames[(int)modelType])); + errorsFound = true; + } - if (NumNums < 12) { - ShowSevereError( - state, fmt::format("{}: Less than 12 values entered.", GroundTemperatureManager::groundTempModelNames[static_cast(objType)])); - errorsFound = true; - } + // Assign the ground temps to the variable + for (int i = 1; i <= 12; ++i) { + thisModel->buildingSurfaceGroundTemps[i - 1] = state.dataIPShortCut->rNumericArgs(i); + if (thisModel->buildingSurfaceGroundTemps[i - 1] < 15.0 || thisModel->buildingSurfaceGroundTemps[i - 1] > 25.0) + genErrorMessage = true; + } - // Assign the ground temps to the variable - for (int i = 1; i <= 12; ++i) { - thisModel->buildingSurfaceGroundTemps(i) = state.dataIPShortCut->rNumericArgs(i); - if (thisModel->buildingSurfaceGroundTemps(i) < 15.0 || thisModel->buildingSurfaceGroundTemps(i) > 25.0) genErrorMessage = true; - } + state.dataEnvrn->GroundTempInputs[static_cast(DataEnvironment::GroundTempType::BuildingSurface)] = true; - state.dataEnvrn->GroundTempInputs[(int)DataEnvironment::GroundTempType::BuildingSurface] = true; + if (genErrorMessage) { + ShowWarningError(state, fmt::format("{}: Some values fall outside the range of 15-25C.", GroundTemp::modelTypeNames[(int)modelType])); + ShowContinueError(state, "These values may be inappropriate. Please consult the Input Output Reference for more details."); + } - if (genErrorMessage) { - ShowWarningError(state, - fmt::format("{}: Some values fall outside the range of 15-25C.", - GroundTemperatureManager::groundTempModelNames[static_cast(objType)])); - ShowContinueError(state, "These values may be inappropriate. Please consult the Input Output Reference for more details."); + } else if (numCurrObjects > 1) { + ShowSevereError(state, fmt::format("{}: Too many objects entered. Only one allowed.", GroundTemp::modelTypeNames[(int)modelType])); + errorsFound = true; + } else { + std::fill(thisModel->buildingSurfaceGroundTemps.begin(), thisModel->buildingSurfaceGroundTemps.end(), 18.0); } - } else if (numCurrObjects > 1) { - ShowSevereError(state, - fmt::format("{}: Too many objects entered. Only one allowed.", - GroundTemperatureManager::groundTempModelNames[static_cast(objType)])); - errorsFound = true; - } else { - thisModel->buildingSurfaceGroundTemps = 18.0; - } + // Write Final Ground Temp Information to the initialization output file + write_ground_temps(state.files.eio, "BuildingSurface", thisModel->buildingSurfaceGroundTemps); - // Write Final Ground Temp Information to the initialization output file - write_ground_temps(state.files.eio, "BuildingSurface", thisModel->buildingSurfaceGroundTemps); + if (!errorsFound) { + state.dataGrndTempModelMgr->groundTempModels.push_back(thisModel); + return thisModel; + } - if (!errorsFound) { - state.dataGrndTempModelMgr->groundTempModels.push_back(thisModel); - return thisModel; - } else { - ShowFatalError(state, - fmt::format("{}--Errors getting input for ground temperature model", - GroundTemperatureManager::groundTempModelNames[static_cast(objType)])); + ShowFatalError(state, fmt::format("{}--Errors getting input for ground temperature model", GroundTemp::modelTypeNames[(int)modelType])); return nullptr; } -} -//****************************************************************************** + //****************************************************************************** -Real64 SiteBuildingSurfaceGroundTemps::getGroundTemp([[maybe_unused]] EnergyPlusData &state) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + Real64 SiteBuildingSurfaceGroundTemps::getGroundTemp([[maybe_unused]] EnergyPlusData &state) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 - // PURPOSE OF THIS SUBROUTINE: - // Returns the ground temperature for Site:GroundTemperature:BuildingSurface + // PURPOSE OF THIS SUBROUTINE: + // Returns the ground temperature for Site:GroundTemperature:BuildingSurface - return buildingSurfaceGroundTemps(timeOfSimInMonths); -} + return buildingSurfaceGroundTemps[timeOfSimInMonths - 1]; + } + + //****************************************************************************** -//****************************************************************************** + Real64 + SiteBuildingSurfaceGroundTemps::getGroundTempAtTimeInSeconds(EnergyPlusData &state, [[maybe_unused]] Real64 const _depth, Real64 const _seconds) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 -Real64 -SiteBuildingSurfaceGroundTemps::getGroundTempAtTimeInSeconds(EnergyPlusData &state, [[maybe_unused]] Real64 const _depth, Real64 const _seconds) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + // PURPOSE OF THIS SUBROUTINE: + // Returns the ground temperature when input time is in seconds - // PURPOSE OF THIS SUBROUTINE: - // Returns the ground temperature when input time is in seconds + // USE STATEMENTS: + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + Real64 secPerMonth = state.dataWeather->NumDaysInYear * Constant::rSecsInDay / 12; - // USE STATEMENTS: - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 secPerMonth = state.dataWeather->NumDaysInYear * Constant::SecsInDay / 12; + // Convert secs to months + const int month = ceil(_seconds / secPerMonth); - // Convert secs to months - int month = ceil(_seconds / secPerMonth); + if (month >= 1 && month <= 12) { + timeOfSimInMonths = month; + } else { + timeOfSimInMonths = month % 12; + } - if (month >= 1 && month <= 12) { - timeOfSimInMonths = month; - } else { - timeOfSimInMonths = remainder(month, 12); + // Get and return ground temp + return getGroundTemp(state); } - // Get and return ground temp - return getGroundTemp(state); -} + //****************************************************************************** -//****************************************************************************** + Real64 SiteBuildingSurfaceGroundTemps::getGroundTempAtTimeInMonths(EnergyPlusData &state, [[maybe_unused]] Real64 const _depth, int const _month) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 -Real64 SiteBuildingSurfaceGroundTemps::getGroundTempAtTimeInMonths(EnergyPlusData &state, [[maybe_unused]] Real64 const _depth, int const _month) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + // PURPOSE OF THIS SUBROUTINE: + // Returns the ground temperature when input time is in months - // PURPOSE OF THIS SUBROUTINE: - // Returns the ground temperature when input time is in months + // Set month + if (_month >= 1 && _month <= 12) { + timeOfSimInMonths = _month; + } else { + timeOfSimInMonths = _month % 12; + } - // Set month - if (_month >= 1 && _month <= 12) { - timeOfSimInMonths = _month; - } else { - timeOfSimInMonths = remainder(_month, 12); + // Get and return ground temp + return getGroundTemp(state); } - // Get and return ground temp - return getGroundTemp(state); -} - -//****************************************************************************** - + //****************************************************************************** +} // namespace GroundTemp } // namespace EnergyPlus diff --git a/src/EnergyPlus/GroundTemperatureModeling/SiteBuildingSurfaceGroundTemperatures.hh b/src/EnergyPlus/GroundTemperatureModeling/SiteBuildingSurfaceGroundTemperatures.hh index 6fedf548608..a3f16fe034b 100644 --- a/src/EnergyPlus/GroundTemperatureModeling/SiteBuildingSurfaceGroundTemperatures.hh +++ b/src/EnergyPlus/GroundTemperatureModeling/SiteBuildingSurfaceGroundTemperatures.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -48,14 +48,9 @@ #ifndef SiteBuildingSurfaceGroundTemperatures_hh_INCLUDED #define SiteBuildingSurfaceGroundTemperatures_hh_INCLUDED -// C++ Headers -#include - -// ObjexxFCL Headers -#include +#include // EnergyPlus Headers -#include #include #include @@ -64,27 +59,24 @@ namespace EnergyPlus { // Forward declarations struct EnergyPlusData; -// Derived class for Site:GroundTemperature:BuildingSurface -class SiteBuildingSurfaceGroundTemps : public BaseGroundTempsModel -{ -public: - int timeOfSimInMonths; - Array1D buildingSurfaceGroundTemps; +namespace GroundTemp { - // Default Constructor - SiteBuildingSurfaceGroundTemps() : timeOfSimInMonths(0), buildingSurfaceGroundTemps(12, 13.0) + // Derived class for Site:GroundTemperature:BuildingSurface + struct SiteBuildingSurfaceGroundTemps final : BaseGroundTempsModel { - } + int timeOfSimInMonths = 0; + std::array buildingSurfaceGroundTemps = {13}; - static std::shared_ptr BuildingSurfaceGTMFactory(EnergyPlusData &state, std::string objectName); + static SiteBuildingSurfaceGroundTemps *BuildingSurfaceGTMFactory(EnergyPlusData &state, const std::string &objectName); - Real64 getGroundTemp(EnergyPlusData &state) override; + Real64 getGroundTemp(EnergyPlusData &state) override; - Real64 getGroundTempAtTimeInSeconds(EnergyPlusData &state, Real64 const depth, Real64 const timeInSecondsOfSim) override; + Real64 getGroundTempAtTimeInSeconds(EnergyPlusData &state, Real64 depth, Real64 timeInSecondsOfSim) override; - Real64 getGroundTempAtTimeInMonths(EnergyPlusData &state, Real64 const depth, int const monthOfSim) override; -}; + Real64 getGroundTempAtTimeInMonths(EnergyPlusData &state, Real64 depth, int monthOfSim) override; + }; +} // namespace GroundTemp } // namespace EnergyPlus #endif diff --git a/src/EnergyPlus/GroundTemperatureModeling/SiteDeepGroundTemperatures.cc b/src/EnergyPlus/GroundTemperatureModeling/SiteDeepGroundTemperatures.cc index 236eb1f79d3..dad4b5c9a93 100644 --- a/src/EnergyPlus/GroundTemperatureModeling/SiteDeepGroundTemperatures.cc +++ b/src/EnergyPlus/GroundTemperatureModeling/SiteDeepGroundTemperatures.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -53,7 +53,6 @@ #include #include #include -#include #include #include #include @@ -62,141 +61,137 @@ namespace EnergyPlus { //****************************************************************************** +namespace GroundTemp { + // Site:GroundTemperature:Deep factory + SiteDeepGroundTemps *SiteDeepGroundTemps::DeepGTMFactory(EnergyPlusData &state, const std::string &objectName) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 -// Site:GroundTemperature:Deep factory -std::shared_ptr SiteDeepGroundTemps::DeepGTMFactory(EnergyPlusData &state, std::string objectName) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + // PURPOSE OF THIS SUBROUTINE: + // Reads input and creates instance of Site:GroundTemperature:Deep object - // PURPOSE OF THIS SUBROUTINE: - // Reads input and creates instance of Site:GroundTemperature:Deep object + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + bool errorsFound = false; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - bool errorsFound = false; + // New shared pointer for this model object + auto *thisModel = new SiteDeepGroundTemps(); - // New shared pointer for this model object - std::shared_ptr thisModel(new SiteDeepGroundTemps()); + ModelType modelType = ModelType::SiteDeep; - GroundTempObjType objType = GroundTempObjType::SiteDeepGroundTemp; + std::string_view const cCurrentModuleObject = GroundTemp::modelTypeNamesUC[(int)modelType]; + const int numCurrObjects = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - std::string_view const cCurrentModuleObject = GroundTemperatureManager::groundTempModelNamesUC[static_cast(objType)]; - int numCurrObjects = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + thisModel->modelType = modelType; + thisModel->Name = objectName; - thisModel->objectType = objType; - thisModel->objectName = objectName; + if (numCurrObjects == 1) { - if (numCurrObjects == 1) { + int NumNums; + int NumAlphas; + int IOStat; - int NumNums; - int NumAlphas; - int IOStat; + // Get the object names for each construction from the input processor + state.dataInputProcessing->inputProcessor->getObjectItem( + state, cCurrentModuleObject, 1, state.dataIPShortCut->cAlphaArgs, NumAlphas, state.dataIPShortCut->rNumericArgs, NumNums, IOStat); - // Get the object names for each construction from the input processor - state.dataInputProcessing->inputProcessor->getObjectItem( - state, cCurrentModuleObject, 1, state.dataIPShortCut->cAlphaArgs, NumAlphas, state.dataIPShortCut->rNumericArgs, NumNums, IOStat); + if (NumNums < 12) { + ShowSevereError(state, fmt::format("{}: Less than 12 values entered.", GroundTemp::modelTypeNames[(int)modelType])); + errorsFound = true; + } - if (NumNums < 12) { - ShowSevereError( - state, fmt::format("{}: Less than 12 values entered.", GroundTemperatureManager::groundTempModelNames[static_cast(objType)])); + // overwrite values read from weather file for the 0.5m set ground temperatures + for (int i = 1; i <= 12; ++i) { + thisModel->deepGroundTemps[i - 1] = state.dataIPShortCut->rNumericArgs(i); + } + + state.dataEnvrn->GroundTempInputs[static_cast(DataEnvironment::GroundTempType::Deep)] = true; + + } else if (numCurrObjects > 1) { + ShowSevereError(state, fmt::format("{}: Too many objects entered. Only one allowed.", GroundTemp::modelTypeNames[(int)modelType])); errorsFound = true; - } - // overwrite values read from weather file for the 0.5m set ground temperatures - for (int i = 1; i <= 12; ++i) { - thisModel->deepGroundTemps(i) = state.dataIPShortCut->rNumericArgs(i); + } else { + std::fill(thisModel->deepGroundTemps.begin(), thisModel->deepGroundTemps.end(), 16.0); } - state.dataEnvrn->GroundTempInputs[(int)DataEnvironment::GroundTempType::Deep] = true; + // Write Final Ground Temp Information to the initialization output file + write_ground_temps(state.files.eio, "Deep", thisModel->deepGroundTemps); - } else if (numCurrObjects > 1) { - ShowSevereError(state, - fmt::format("{}: Too many objects entered. Only one allowed.", - GroundTemperatureManager::groundTempModelNames[static_cast(objType)])); - errorsFound = true; + if (!errorsFound) { + state.dataGrndTempModelMgr->groundTempModels.push_back(thisModel); + return thisModel; + } - } else { - thisModel->deepGroundTemps = 16.0; + ShowFatalError(state, fmt::format("{}--Errors getting input for ground temperature model", GroundTemp::modelTypeNames[(int)modelType])); + return nullptr; } - // Write Final Ground Temp Information to the initialization output file - write_ground_temps(state.files.eio, "Deep", thisModel->deepGroundTemps); + //****************************************************************************** - if (!errorsFound) { - state.dataGrndTempModelMgr->groundTempModels.push_back(thisModel); - return thisModel; - } else { - ShowFatalError(state, - fmt::format("{}--Errors getting input for ground temperature model", - GroundTemperatureManager::groundTempModelNames[static_cast(objType)])); - return nullptr; - } -} + Real64 SiteDeepGroundTemps::getGroundTemp([[maybe_unused]] EnergyPlusData &state) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 -//****************************************************************************** + // PURPOSE OF THIS SUBROUTINE: + // Returns the ground temperature for Site:GroundTemperature:Deep -Real64 SiteDeepGroundTemps::getGroundTemp([[maybe_unused]] EnergyPlusData &state) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + return deepGroundTemps[timeOfSimInMonths - 1]; + } - // PURPOSE OF THIS SUBROUTINE: - // Returns the ground temperature for Site:GroundTemperature:Deep + //****************************************************************************** - return deepGroundTemps(timeOfSimInMonths); -} + Real64 SiteDeepGroundTemps::getGroundTempAtTimeInSeconds(EnergyPlusData &state, [[maybe_unused]] Real64 const _depth, Real64 const _seconds) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 -//****************************************************************************** + // PURPOSE OF THIS SUBROUTINE: + // Returns the ground temperature when input time is in seconds -Real64 SiteDeepGroundTemps::getGroundTempAtTimeInSeconds(EnergyPlusData &state, [[maybe_unused]] Real64 const _depth, Real64 const _seconds) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // PURPOSE OF THIS SUBROUTINE: - // Returns the ground temperature when input time is in seconds + const Real64 secPerMonth = state.dataWeather->NumDaysInYear * Constant::rSecsInDay / 12; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 secPerMonth = state.dataWeather->NumDaysInYear * Constant::SecsInDay / 12; + // Convert secs to months + const int month = ceil(_seconds / secPerMonth); - // Convert secs to months - int month = ceil(_seconds / secPerMonth); + if (month >= 1 && month <= 12) { + timeOfSimInMonths = month; + } else { + timeOfSimInMonths = month % 12; + } - if (month >= 1 && month <= 12) { - timeOfSimInMonths = month; - } else { - timeOfSimInMonths = remainder(month, 12); + // Get and return ground temp + return getGroundTemp(state); } - // Get and return ground temp - return getGroundTemp(state); -} + //****************************************************************************** -//****************************************************************************** + Real64 SiteDeepGroundTemps::getGroundTempAtTimeInMonths(EnergyPlusData &state, [[maybe_unused]] Real64 const _depth, int const _month) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 -Real64 SiteDeepGroundTemps::getGroundTempAtTimeInMonths(EnergyPlusData &state, [[maybe_unused]] Real64 const _depth, int const _month) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + // PURPOSE OF THIS SUBROUTINE: + // Returns the ground temperature when input time is in months - // PURPOSE OF THIS SUBROUTINE: - // Returns the ground temperature when input time is in months + // Set month + if (_month >= 1 && _month <= 12) { + timeOfSimInMonths = _month; + } else { + timeOfSimInMonths = _month % 12; + } - // Set month - if (_month >= 1 && _month <= 12) { - timeOfSimInMonths = _month; - } else { - timeOfSimInMonths = remainder(_month, 12); + // Get and return ground temp + return getGroundTemp(state); } - // Get and return ground temp - return getGroundTemp(state); -} - -//****************************************************************************** - + //****************************************************************************** +} // namespace GroundTemp } // namespace EnergyPlus diff --git a/src/EnergyPlus/GroundTemperatureModeling/SiteDeepGroundTemperatures.hh b/src/EnergyPlus/GroundTemperatureModeling/SiteDeepGroundTemperatures.hh index 1c899f46518..8470b2704e3 100644 --- a/src/EnergyPlus/GroundTemperatureModeling/SiteDeepGroundTemperatures.hh +++ b/src/EnergyPlus/GroundTemperatureModeling/SiteDeepGroundTemperatures.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -49,13 +49,9 @@ #define SiteDeepGroundTemperatures_hh_INCLUDED // C++ Headers -#include - -// ObjexxFCL Headers -#include +#include // EnergyPlus Headers -#include #include #include @@ -64,27 +60,24 @@ namespace EnergyPlus { // Forward declarations struct EnergyPlusData; -// Derived class for Site:GroundTemperature:Deep -class SiteDeepGroundTemps : public BaseGroundTempsModel -{ -public: - int timeOfSimInMonths; - Array1D deepGroundTemps; +namespace GroundTemp { - // Default Constructor - SiteDeepGroundTemps() : timeOfSimInMonths(0), deepGroundTemps(12, 13.0) + // Derived class for Site:GroundTemperature:Deep + struct SiteDeepGroundTemps final : BaseGroundTempsModel { - } + int timeOfSimInMonths = 12; + std::array deepGroundTemps = {13.0}; - static std::shared_ptr DeepGTMFactory(EnergyPlusData &state, std::string objectName); + static SiteDeepGroundTemps *DeepGTMFactory(EnergyPlusData &state, const std::string &objectName); - Real64 getGroundTemp([[maybe_unused]] EnergyPlusData &state) override; + Real64 getGroundTemp([[maybe_unused]] EnergyPlusData &state) override; - Real64 getGroundTempAtTimeInSeconds(EnergyPlusData &state, Real64 const depth, Real64 const timeInSecondsOfSim) override; + Real64 getGroundTempAtTimeInSeconds(EnergyPlusData &state, Real64 depth, Real64 timeInSecondsOfSim) override; - Real64 getGroundTempAtTimeInMonths(EnergyPlusData &state, Real64 const depth, int const monthOfSim) override; -}; + Real64 getGroundTempAtTimeInMonths(EnergyPlusData &state, Real64 depth, int monthOfSim) override; + }; +} // namespace GroundTemp } // namespace EnergyPlus #endif diff --git a/src/EnergyPlus/GroundTemperatureModeling/SiteFCFactorMethodGroundTemperatures.cc b/src/EnergyPlus/GroundTemperatureModeling/SiteFCFactorMethodGroundTemperatures.cc index 55e08254873..197c851fc13 100644 --- a/src/EnergyPlus/GroundTemperatureModeling/SiteFCFactorMethodGroundTemperatures.cc +++ b/src/EnergyPlus/GroundTemperatureModeling/SiteFCFactorMethodGroundTemperatures.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -46,14 +46,12 @@ // POSSIBILITY OF SUCH DAMAGE. // C++ Headers -#include // EnergyPlus Headers #include #include #include #include -#include #include #include #include @@ -62,155 +60,149 @@ namespace EnergyPlus { //****************************************************************************** +namespace GroundTemp { + // Site:GroundTemperature:FCFactorMethod factory + SiteFCFactorMethodGroundTemps *SiteFCFactorMethodGroundTemps::FCFactorGTMFactory(EnergyPlusData &state, const std::string &objectName) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 -// Site:GroundTemperature:FCFactorMethod factory -std::shared_ptr SiteFCFactorMethodGroundTemps::FCFactorGTMFactory(EnergyPlusData &state, std::string objectName) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + // PURPOSE OF THIS SUBROUTINE: + // Reads input and creates instance of Site:GroundTemperature:FCfactorMethod object - // PURPOSE OF THIS SUBROUTINE: - // Reads input and creates instance of Site:GroundTemperature:FCfactorMethod object + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + bool found = false; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - bool found = false; - bool errorsFound = false; + // New shared pointer for this model object + auto *thisModel = new SiteFCFactorMethodGroundTemps(); - // New shared pointer for this model object - std::shared_ptr thisModel(new SiteFCFactorMethodGroundTemps()); + ModelType modelType = ModelType::SiteFCFactorMethod; - GroundTempObjType objType = GroundTempObjType::SiteFCFactorMethodGroundTemp; + std::string_view const cCurrentModuleObject = GroundTemp::modelTypeNamesUC[(int)modelType]; + const int numCurrObjects = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - std::string_view const cCurrentModuleObject = GroundTemperatureManager::groundTempModelNamesUC[static_cast(objType)]; - int numCurrObjects = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + thisModel->modelType = modelType; + thisModel->Name = objectName; - thisModel->objectType = objType; - thisModel->objectName = objectName; + if (numCurrObjects == 1) { - if (numCurrObjects == 1) { + int NumNums; + int NumAlphas; + int IOStat; - int NumNums; - int NumAlphas; - int IOStat; + // Get the object names for each construction from the input processor + state.dataInputProcessing->inputProcessor->getObjectItem( + state, cCurrentModuleObject, 1, state.dataIPShortCut->cAlphaArgs, NumAlphas, state.dataIPShortCut->rNumericArgs, NumNums, IOStat); - // Get the object names for each construction from the input processor - state.dataInputProcessing->inputProcessor->getObjectItem( - state, cCurrentModuleObject, 1, state.dataIPShortCut->cAlphaArgs, NumAlphas, state.dataIPShortCut->rNumericArgs, NumNums, IOStat); + if (NumNums < 12) { + ShowSevereError(state, fmt::format("{}: Less than 12 values entered.", GroundTemp::modelTypeNames[(int)modelType])); + // found stays false + } else { + // overwrite values read from weather file for the 0.5m set ground temperatures + for (int i = 1; i <= 12; ++i) { + thisModel->fcFactorGroundTemps[i - 1] = state.dataIPShortCut->rNumericArgs(i); + } - if (NumNums < 12) { - ShowSevereError( - state, fmt::format("{}: Less than 12 values entered.", GroundTemperatureManager::groundTempModelNames[static_cast(objType)])); - errorsFound = true; - } + state.dataEnvrn->GroundTempInputs[static_cast(DataEnvironment::GroundTempType::FCFactorMethod)] = true; + found = true; + } - // overwrite values read from weather file for the 0.5m set ground temperatures - for (int i = 1; i <= 12; ++i) { - thisModel->fcFactorGroundTemps(i) = state.dataIPShortCut->rNumericArgs(i); - } + } else if (numCurrObjects > 1) { + ShowSevereError(state, fmt::format("{}: Too many objects entered. Only one allowed.", GroundTemp::modelTypeNames[(int)modelType])); + // found stays false - state.dataEnvrn->GroundTempInputs[(int)DataEnvironment::GroundTempType::FCFactorMethod] = true; - found = true; + } else if (state.dataWeather->wthFCGroundTemps) { - } else if (numCurrObjects > 1) { - ShowSevereError(state, - fmt::format("{}: Too many objects entered. Only one allowed.", - GroundTemperatureManager::groundTempModelNames[static_cast(objType)])); - errorsFound = true; + for (int i = 1; i <= 12; ++i) { + thisModel->fcFactorGroundTemps[i - 1] = state.dataWeather->GroundTempsFCFromEPWHeader(i); + } - } else if (state.dataWeather->wthFCGroundTemps) { + state.dataEnvrn->GroundTempInputs[static_cast(DataEnvironment::GroundTempType::FCFactorMethod)] = true; + found = true; - for (int i = 1; i <= 12; ++i) { - thisModel->fcFactorGroundTemps(i) = state.dataWeather->GroundTempsFCFromEPWHeader(i); + } else { + std::fill(thisModel->fcFactorGroundTemps.begin(), thisModel->fcFactorGroundTemps.end(), 0.0); + found = true; } - state.dataEnvrn->GroundTempInputs[(int)DataEnvironment::GroundTempType::FCFactorMethod] = true; - found = true; - - } else { - thisModel->fcFactorGroundTemps = 0.0; - found = true; - } - - // Write Final Ground Temp Information to the initialization output file - if (state.dataEnvrn->GroundTempInputs[(int)DataEnvironment::GroundTempType::FCFactorMethod]) { - write_ground_temps(state.files.eio, "FCfactorMethod", thisModel->fcFactorGroundTemps); - } + // Write Final Ground Temp Information to the initialization output file + if (state.dataEnvrn->GroundTempInputs[static_cast(DataEnvironment::GroundTempType::FCFactorMethod)]) { + write_ground_temps(state.files.eio, "FCfactorMethod", thisModel->fcFactorGroundTemps); + } - if (found && !errorsFound) { - state.dataGrndTempModelMgr->groundTempModels.push_back(thisModel); - return thisModel; - } else { - ShowFatalError(state, - fmt::format("{}--Errors getting input for ground temperature model", - GroundTemperatureManager::groundTempModelNames[static_cast(objType)])); + if (found) { + state.dataGrndTempModelMgr->groundTempModels.push_back(thisModel); + return thisModel; + } + ShowFatalError(state, fmt::format("{}--Errors getting input for ground temperature model", GroundTemp::modelTypeNames[(int)modelType])); return nullptr; } -} -//****************************************************************************** + //****************************************************************************** -Real64 SiteFCFactorMethodGroundTemps::getGroundTemp([[maybe_unused]] EnergyPlusData &state) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + Real64 SiteFCFactorMethodGroundTemps::getGroundTemp([[maybe_unused]] EnergyPlusData &state) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 - // PURPOSE OF THIS SUBROUTINE: - // Returns the ground temperature for Site:GroundTemperature:FCFactorMethod + // PURPOSE OF THIS SUBROUTINE: + // Returns the ground temperature for Site:GroundTemperature:FCFactorMethod - return fcFactorGroundTemps(timeOfSimInMonths); -} + return fcFactorGroundTemps[timeOfSimInMonths - 1]; + } -//****************************************************************************** + //****************************************************************************** -Real64 SiteFCFactorMethodGroundTemps::getGroundTempAtTimeInSeconds(EnergyPlusData &state, [[maybe_unused]] Real64 const _depth, Real64 const _seconds) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + Real64 + SiteFCFactorMethodGroundTemps::getGroundTempAtTimeInSeconds(EnergyPlusData &state, [[maybe_unused]] Real64 const _depth, Real64 const _seconds) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 - // PURPOSE OF THIS SUBROUTINE: - // Returns the ground temperature when input time is in seconds + // PURPOSE OF THIS SUBROUTINE: + // Returns the ground temperature when input time is in seconds - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 secPerMonth = state.dataWeather->NumDaysInYear * Constant::SecsInDay / 12; + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + const Real64 secPerMonth = state.dataWeather->NumDaysInYear * Constant::rSecsInDay / 12; - // Convert secs to months - int month = ceil(_seconds / secPerMonth); + // Convert secs to months + const int month = ceil(_seconds / secPerMonth); - if (month >= 1 && month <= 12) { - timeOfSimInMonths = month; - } else { - timeOfSimInMonths = remainder(month, 12); + if (month >= 1 && month <= 12) { + timeOfSimInMonths = month; + } else { + timeOfSimInMonths = month % 12; + } + + // Get and return ground temp + return getGroundTemp(state); } - // Get and return ground temp - return getGroundTemp(state); -} + //****************************************************************************** -//****************************************************************************** + Real64 SiteFCFactorMethodGroundTemps::getGroundTempAtTimeInMonths(EnergyPlusData &state, [[maybe_unused]] Real64 const _depth, int const _month) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 -Real64 SiteFCFactorMethodGroundTemps::getGroundTempAtTimeInMonths(EnergyPlusData &state, [[maybe_unused]] Real64 const _depth, int const _month) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + // PURPOSE OF THIS SUBROUTINE: + // Returns the ground temperature when input time is in months - // PURPOSE OF THIS SUBROUTINE: - // Returns the ground temperature when input time is in months + // Set month + if (_month >= 1 && _month <= 12) { + timeOfSimInMonths = _month; + } else { + timeOfSimInMonths = _month % 12; + } - // Set month - if (_month >= 1 && _month <= 12) { - timeOfSimInMonths = _month; - } else { - timeOfSimInMonths = remainder(_month, 12); + // Get and return ground temp + return getGroundTemp(state); } - // Get and return ground temp - return getGroundTemp(state); -} - -//****************************************************************************** - + //****************************************************************************** +} // namespace GroundTemp } // namespace EnergyPlus diff --git a/src/EnergyPlus/GroundTemperatureModeling/SiteFCFactorMethodGroundTemperatures.hh b/src/EnergyPlus/GroundTemperatureModeling/SiteFCFactorMethodGroundTemperatures.hh index 6e59240ff8c..b116c0dda10 100644 --- a/src/EnergyPlus/GroundTemperatureModeling/SiteFCFactorMethodGroundTemperatures.hh +++ b/src/EnergyPlus/GroundTemperatureModeling/SiteFCFactorMethodGroundTemperatures.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -49,13 +49,9 @@ #define SiteFCFactorMethodTemperatures_hh_INCLUDED // C++ Headers -#include - -// ObjexxFCL Headers -#include +#include // EnergyPlus Headers -#include #include #include @@ -64,27 +60,24 @@ namespace EnergyPlus { // Forward declarations struct EnergyPlusData; -// Derived class for Site:GroundTemperature:FCFactorMethod -class SiteFCFactorMethodGroundTemps : public BaseGroundTempsModel -{ -public: - int timeOfSimInMonths; - Array1D fcFactorGroundTemps; +namespace GroundTemp { - // Default Constructor - SiteFCFactorMethodGroundTemps() : timeOfSimInMonths(0), fcFactorGroundTemps(12, 13.0) + // Derived class for Site:GroundTemperature:FCFactorMethod + struct SiteFCFactorMethodGroundTemps final : BaseGroundTempsModel { - } + int timeOfSimInMonths = 0; + std::array fcFactorGroundTemps = {13.0}; - static std::shared_ptr FCFactorGTMFactory(EnergyPlusData &state, std::string objectName); + static SiteFCFactorMethodGroundTemps *FCFactorGTMFactory(EnergyPlusData &state, const std::string &objectName); - Real64 getGroundTemp([[maybe_unused]] EnergyPlusData &state) override; + Real64 getGroundTemp([[maybe_unused]] EnergyPlusData &state) override; - Real64 getGroundTempAtTimeInSeconds(EnergyPlusData &state, Real64 const depth, Real64 const timeInSecondsOfSim) override; + Real64 getGroundTempAtTimeInSeconds(EnergyPlusData &state, Real64 depth, Real64 timeInSecondsOfSim) override; - Real64 getGroundTempAtTimeInMonths(EnergyPlusData &state, Real64 const depth, int const monthOfSim) override; -}; + Real64 getGroundTempAtTimeInMonths(EnergyPlusData &state, Real64 depth, int monthOfSim) override; + }; +} // namespace GroundTemp } // namespace EnergyPlus #endif diff --git a/src/EnergyPlus/GroundTemperatureModeling/SiteShallowGroundTemperatures.cc b/src/EnergyPlus/GroundTemperatureModeling/SiteShallowGroundTemperatures.cc index a430cc98fce..ff96f303266 100644 --- a/src/EnergyPlus/GroundTemperatureModeling/SiteShallowGroundTemperatures.cc +++ b/src/EnergyPlus/GroundTemperatureModeling/SiteShallowGroundTemperatures.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -46,14 +46,12 @@ // POSSIBILITY OF SUCH DAMAGE. // C++ Headers -#include // EnergyPlus Headers #include #include #include #include -#include #include #include #include @@ -62,141 +60,136 @@ namespace EnergyPlus { //****************************************************************************** +namespace GroundTemp { + // Site:GroundTemperature:Shallow factory + SiteShallowGroundTemps *SiteShallowGroundTemps::ShallowGTMFactory(EnergyPlusData &state, const std::string &objectName) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 -// Site:GroundTemperature:Shallow factory -std::shared_ptr SiteShallowGroundTemps::ShallowGTMFactory(EnergyPlusData &state, std::string objectName) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + // PURPOSE OF THIS SUBROUTINE: + // Reads input and creates instance of Site:GroundDomain:Shallow object - // PURPOSE OF THIS SUBROUTINE: - // Reads input and creates instance of Site:GroundDomain:Shallow object + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + bool errorsFound = false; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - bool errorsFound = false; + // New shared pointer for this model object + auto *thisModel = new SiteShallowGroundTemps(); - // New shared pointer for this model object - std::shared_ptr thisModel(new SiteShallowGroundTemps()); + ModelType modelType = ModelType::SiteShallow; - GroundTempObjType objType = GroundTempObjType::SiteShallowGroundTemp; + std::string_view const cCurrentModuleObject = GroundTemp::modelTypeNamesUC[(int)modelType]; + const int numCurrObjects = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - std::string_view const cCurrentModuleObject = GroundTemperatureManager::groundTempModelNamesUC[static_cast(objType)]; - int numCurrObjects = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + thisModel->modelType = modelType; + thisModel->Name = objectName; - thisModel->objectType = objType; - thisModel->objectName = objectName; + if (numCurrObjects == 1) { - if (numCurrObjects == 1) { + int NumNums; + int NumAlphas; + int IOStat; - int NumNums; - int NumAlphas; - int IOStat; + // Get the object names for each construction from the input processor + state.dataInputProcessing->inputProcessor->getObjectItem( + state, cCurrentModuleObject, 1, state.dataIPShortCut->cAlphaArgs, NumAlphas, state.dataIPShortCut->rNumericArgs, NumNums, IOStat); - // Get the object names for each construction from the input processor - state.dataInputProcessing->inputProcessor->getObjectItem( - state, cCurrentModuleObject, 1, state.dataIPShortCut->cAlphaArgs, NumAlphas, state.dataIPShortCut->rNumericArgs, NumNums, IOStat); + if (NumNums < 12) { + ShowSevereError(state, fmt::format("{}: Less than 12 values entered.", GroundTemp::modelTypeNames[(int)modelType])); + errorsFound = true; + } - if (NumNums < 12) { - ShowSevereError( - state, fmt::format("{}: Less than 12 values entered.", GroundTemperatureManager::groundTempModelNames[static_cast(objType)])); - errorsFound = true; - } + // Assign the ground temps to the variable + for (int i = 1; i <= 12; ++i) { + thisModel->surfaceGroundTemps[i - 1] = state.dataIPShortCut->rNumericArgs(i); + } + + state.dataEnvrn->GroundTempInputs[static_cast(DataEnvironment::GroundTempType::Shallow)] = true; - // Assign the ground temps to the variable - for (int i = 1; i <= 12; ++i) { - thisModel->surfaceGroundTemps(i) = state.dataIPShortCut->rNumericArgs(i); + } else if (numCurrObjects > 1) { + ShowSevereError(state, fmt::format("{}: Too many objects entered. Only one allowed.", GroundTemp::modelTypeNames[(int)modelType])); + errorsFound = true; + } else { + std::fill(thisModel->surfaceGroundTemps.begin(), thisModel->surfaceGroundTemps.end(), 13.0); } - state.dataEnvrn->GroundTempInputs[(int)DataEnvironment::GroundTempType::Shallow] = true; + // Write Final Ground Temp Information to the initialization output file + write_ground_temps(state.files.eio, "Shallow", thisModel->surfaceGroundTemps); - } else if (numCurrObjects > 1) { - ShowSevereError(state, - fmt::format("{}: Too many objects entered. Only one allowed.", - GroundTemperatureManager::groundTempModelNames[static_cast(objType)])); - errorsFound = true; - } else { - thisModel->surfaceGroundTemps = 13.0; - } - - // Write Final Ground Temp Information to the initialization output file - write_ground_temps(state.files.eio, "Shallow", thisModel->surfaceGroundTemps); + if (!errorsFound) { + state.dataGrndTempModelMgr->groundTempModels.push_back(thisModel); + return thisModel; + } - if (!errorsFound) { - state.dataGrndTempModelMgr->groundTempModels.push_back(thisModel); - return thisModel; - } else { - ShowFatalError(state, - fmt::format("{}--Errors getting input for ground temperature model", - GroundTemperatureManager::groundTempModelNames[static_cast(objType)])); + ShowFatalError(state, fmt::format("{}--Errors getting input for ground temperature model", GroundTemp::modelTypeNames[(int)modelType])); return nullptr; } -} -//****************************************************************************** + //****************************************************************************** -Real64 SiteShallowGroundTemps::getGroundTemp([[maybe_unused]] EnergyPlusData &state) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + Real64 SiteShallowGroundTemps::getGroundTemp([[maybe_unused]] EnergyPlusData &state) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 - // PURPOSE OF THIS SUBROUTINE: - // Return the ground temperature from Site:GroundTemperature:Shallow + // PURPOSE OF THIS SUBROUTINE: + // Return the ground temperature from Site:GroundTemperature:Shallow - return surfaceGroundTemps(timeOfSimInMonths); -} + return surfaceGroundTemps[timeOfSimInMonths - 1]; + } -//****************************************************************************** + //****************************************************************************** + + Real64 SiteShallowGroundTemps::getGroundTempAtTimeInSeconds(EnergyPlusData &state, [[maybe_unused]] Real64 const _depth, Real64 const _seconds) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 -Real64 SiteShallowGroundTemps::getGroundTempAtTimeInSeconds(EnergyPlusData &state, [[maybe_unused]] Real64 const _depth, Real64 const _seconds) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + // PURPOSE OF THIS SUBROUTINE: + // Returns the ground temperature when input time is in seconds - // PURPOSE OF THIS SUBROUTINE: - // Returns the ground temperature when input time is in seconds + // USE STATEMENTS: + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + Real64 secPerMonth = state.dataWeather->NumDaysInYear * Constant::rSecsInDay / 12; - // USE STATEMENTS: - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 secPerMonth = state.dataWeather->NumDaysInYear * Constant::SecsInDay / 12; + // Convert secs to months + int month = ceil(_seconds / secPerMonth); - // Convert secs to months - int month = ceil(_seconds / secPerMonth); + if (month >= 1 && month <= 12) { + timeOfSimInMonths = month; + } else { + timeOfSimInMonths = month % 12; + } - if (month >= 1 && month <= 12) { - timeOfSimInMonths = month; - } else { - timeOfSimInMonths = remainder(month, 12); + // Get and return ground temp + return getGroundTemp(state); } - // Get and return ground temp - return getGroundTemp(state); -} + //****************************************************************************** -//****************************************************************************** + Real64 SiteShallowGroundTemps::getGroundTempAtTimeInMonths(EnergyPlusData &state, [[maybe_unused]] Real64 const _depth, int const _month) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 -Real64 SiteShallowGroundTemps::getGroundTempAtTimeInMonths(EnergyPlusData &state, [[maybe_unused]] Real64 const _depth, int const _month) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + // PURPOSE OF THIS SUBROUTINE: + // Returns the ground temperature when input time is in months - // PURPOSE OF THIS SUBROUTINE: - // Returns the ground temperature when input time is in months + // Set month + if (_month >= 1 && _month <= 12) { + timeOfSimInMonths = _month; + } else { + timeOfSimInMonths = _month % 12; + } - // Set month - if (_month >= 1 && _month <= 12) { - timeOfSimInMonths = _month; - } else { - timeOfSimInMonths = remainder(_month, 12); + // Get and return ground temp + return getGroundTemp(state); } - // Get and return ground temp - return getGroundTemp(state); -} - -//****************************************************************************** - + //****************************************************************************** +} // namespace GroundTemp } // namespace EnergyPlus diff --git a/src/EnergyPlus/GroundTemperatureModeling/SiteShallowGroundTemperatures.hh b/src/EnergyPlus/GroundTemperatureModeling/SiteShallowGroundTemperatures.hh index 9334d00489b..dbd8497a590 100644 --- a/src/EnergyPlus/GroundTemperatureModeling/SiteShallowGroundTemperatures.hh +++ b/src/EnergyPlus/GroundTemperatureModeling/SiteShallowGroundTemperatures.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -49,14 +49,9 @@ #define SiteShallowGroundTemperatures_hh_INCLUDED // C++ Headers -#include - -// ObjexxFCL Headers -#include -#include +#include // EnergyPlus Headers -#include #include #include @@ -65,27 +60,24 @@ namespace EnergyPlus { // Forward declarations struct EnergyPlusData; -// Derived class for Site:GroundTemperature:Shallow -class SiteShallowGroundTemps : public BaseGroundTempsModel -{ -public: - int timeOfSimInMonths; - Array1D surfaceGroundTemps; +namespace GroundTemp { - // Default Constructor - SiteShallowGroundTemps() : timeOfSimInMonths(0), surfaceGroundTemps(12, 13.0) + // Derived class for Site:GroundTemperature:Shallow + struct SiteShallowGroundTemps final : BaseGroundTempsModel { - } + int timeOfSimInMonths = 0; + std::array surfaceGroundTemps = {13.0}; - static std::shared_ptr ShallowGTMFactory(EnergyPlusData &state, std::string objectName); + static SiteShallowGroundTemps *ShallowGTMFactory(EnergyPlusData &state, const std::string &objectName); - Real64 getGroundTemp([[maybe_unused]] EnergyPlusData &state) override; + Real64 getGroundTemp([[maybe_unused]] EnergyPlusData &state) override; - Real64 getGroundTempAtTimeInSeconds(EnergyPlusData &state, Real64 const depth, Real64 const timeInSecondsOfSim) override; + Real64 getGroundTempAtTimeInSeconds(EnergyPlusData &state, Real64 depth, Real64 timeInSecondsOfSim) override; - Real64 getGroundTempAtTimeInMonths(EnergyPlusData &state, Real64 const depth, int const monthOfSim) override; -}; + Real64 getGroundTempAtTimeInMonths(EnergyPlusData &state, Real64 depth, int monthOfSim) override; + }; +} // namespace GroundTemp } // namespace EnergyPlus #endif diff --git a/src/EnergyPlus/GroundTemperatureModeling/XingGroundTemperatureModel.cc b/src/EnergyPlus/GroundTemperatureModeling/XingGroundTemperatureModel.cc index 3f9701fb3c2..566347a13ab 100644 --- a/src/EnergyPlus/GroundTemperatureModeling/XingGroundTemperatureModel.cc +++ b/src/EnergyPlus/GroundTemperatureModeling/XingGroundTemperatureModel.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -51,9 +51,7 @@ // EnergyPlus headers #include #include -#include #include -#include #include #include #include @@ -62,151 +60,156 @@ namespace EnergyPlus { //****************************************************************************** +namespace GroundTemp { + // Xing model factory + XingGroundTempsModel *XingGroundTempsModel::XingGTMFactory(EnergyPlusData &state, const std::string &objectName) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 + + // PURPOSE OF THIS SUBROUTINE: + // Reads input and creates instance of Xing ground temps model + + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + bool found = false; + int NumNums; + int NumAlphas; + int IOStat; + + // New shared pointer for this model object + auto *thisModel = new XingGroundTempsModel(); + + ModelType modelType = ModelType::Xing; + + std::string_view const cCurrentModuleObject = GroundTemp::modelTypeNamesUC[(int)modelType]; + const int numCurrModels = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + + for (int modelNum = 1; modelNum <= numCurrModels; ++modelNum) { + + state.dataInputProcessing->inputProcessor->getObjectItem(state, + cCurrentModuleObject, + modelNum, + state.dataIPShortCut->cAlphaArgs, + NumAlphas, + state.dataIPShortCut->rNumericArgs, + NumNums, + IOStat); + + if (objectName == state.dataIPShortCut->cAlphaArgs(1)) { + // Read input into object here + + thisModel->Name = state.dataIPShortCut->cAlphaArgs(1); + thisModel->modelType = modelType; + thisModel->groundThermalDiffusivity = state.dataIPShortCut->rNumericArgs(1) / + (state.dataIPShortCut->rNumericArgs(2) * state.dataIPShortCut->rNumericArgs(3)) * + Constant::rSecsInDay; + thisModel->aveGroundTemp = state.dataIPShortCut->rNumericArgs(4); + thisModel->surfTempAmplitude_1 = state.dataIPShortCut->rNumericArgs(5); + thisModel->surfTempAmplitude_2 = state.dataIPShortCut->rNumericArgs(6); + thisModel->phaseShift_1 = state.dataIPShortCut->rNumericArgs(7); + thisModel->phaseShift_2 = state.dataIPShortCut->rNumericArgs(8); + + found = true; + break; + } + } -// Xing model factory -std::shared_ptr XingGroundTempsModel::XingGTMFactory(EnergyPlusData &state, std::string objectName) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 - - // PURPOSE OF THIS SUBROUTINE: - // Reads input and creates instance of Xing ground temps model - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - bool found = false; - int NumNums; - int NumAlphas; - int IOStat; - - // New shared pointer for this model object - std::shared_ptr thisModel(new XingGroundTempsModel()); - - GroundTempObjType objType = GroundTempObjType::XingGroundTemp; - - std::string_view const cCurrentModuleObject = GroundTemperatureManager::groundTempModelNamesUC[static_cast(objType)]; - int numCurrModels = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - - for (int modelNum = 1; modelNum <= numCurrModels; ++modelNum) { - - state.dataInputProcessing->inputProcessor->getObjectItem( - state, cCurrentModuleObject, modelNum, state.dataIPShortCut->cAlphaArgs, NumAlphas, state.dataIPShortCut->rNumericArgs, NumNums, IOStat); - - if (objectName == state.dataIPShortCut->cAlphaArgs(1)) { - // Read input into object here - - thisModel->objectName = state.dataIPShortCut->cAlphaArgs(1); - thisModel->objectType = objType; - thisModel->groundThermalDiffisivity = state.dataIPShortCut->rNumericArgs(1) / - (state.dataIPShortCut->rNumericArgs(2) * state.dataIPShortCut->rNumericArgs(3)) * - Constant::SecsInDay; - thisModel->aveGroundTemp = state.dataIPShortCut->rNumericArgs(4); - thisModel->surfTempAmplitude_1 = state.dataIPShortCut->rNumericArgs(5); - thisModel->surfTempAmplitude_2 = state.dataIPShortCut->rNumericArgs(6); - thisModel->phaseShift_1 = state.dataIPShortCut->rNumericArgs(7); - thisModel->phaseShift_2 = state.dataIPShortCut->rNumericArgs(8); - - found = true; - break; + if (found) { + state.dataGrndTempModelMgr->groundTempModels.push_back(thisModel); + return thisModel; } - } - if (found) { - state.dataGrndTempModelMgr->groundTempModels.push_back(thisModel); - return thisModel; - } else { - ShowFatalError(state, - fmt::format("{}--Errors getting input for ground temperature model", - GroundTemperatureManager::groundTempModelNames[static_cast(objType)])); + ShowFatalError(state, fmt::format("{}--Errors getting input for ground temperature model", GroundTemp::modelTypeNames[(int)modelType])); return nullptr; } -} -//****************************************************************************** + //****************************************************************************** + + Real64 XingGroundTempsModel::getGroundTemp(EnergyPlusData &state) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 -Real64 XingGroundTempsModel::getGroundTemp(EnergyPlusData &state) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + // PURPOSE OF THIS SUBROUTINE: + // Returns the ground temperature for the Site:GroundTemperature:Undisturbed:Xing - // PURPOSE OF THIS SUBROUTINE: - // Returns the ground temperature for the Site:GroundTemperature:Undisturbed:Xing + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + const Real64 tp = state.dataWeather->NumDaysInYear; // Period of soil temperature cycle - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 tp = state.dataWeather->NumDaysInYear; // Period of soil temperature cycle + // Inits + const Real64 Ts_1 = surfTempAmplitude_1; // Amplitude of surface temperature + const Real64 PL_1 = phaseShift_1; // Phase shift of surface temperature + const Real64 Ts_2 = surfTempAmplitude_2; // Amplitude of surface temperature + const Real64 PL_2 = phaseShift_2; // Phase shift of surface temperature - // Inits - Real64 Ts_1 = surfTempAmplitude_1; // Amplitude of surface temperature - Real64 PL_1 = phaseShift_1; // Phase shift of surface temperature - Real64 Ts_2 = surfTempAmplitude_2; // Amplitude of surface temperature - Real64 PL_2 = phaseShift_2; // Phase shift of surface temperature + constexpr int n1 = 1; + const Real64 gamma1 = std::sqrt((n1 * Constant::Pi) / (groundThermalDiffusivity * tp)); + const Real64 exp1 = -depth * gamma1; + const Real64 cos1 = 2 * Constant::Pi * n1 / tp * (simTimeInDays - PL_1) - depth * gamma1; - int n = 1; - Real64 gamma1 = std::sqrt((n * Constant::Pi) / (groundThermalDiffisivity * tp)); - Real64 exp1 = -depth * gamma1; - Real64 cos1 = (2 * Constant::Pi * n) / tp * (simTimeInDays - PL_1) - depth * gamma1; + constexpr int n2 = 2; + const Real64 gamma2 = std::sqrt((n2 * Constant::Pi) / (groundThermalDiffusivity * tp)); + const Real64 exp2 = -depth * gamma2; + const Real64 cos2 = 2 * Constant::Pi * n2 / tp * (simTimeInDays - PL_2) - depth * gamma2; - n = 2; - Real64 gamma2 = std::sqrt((n * Constant::Pi) / (groundThermalDiffisivity * tp)); - Real64 exp2 = -depth * gamma2; - Real64 cos2 = (2 * Constant::Pi * n) / tp * (simTimeInDays - PL_2) - depth * gamma2; + const Real64 summation = std::exp(exp1) * Ts_1 * std::cos(cos1) + std::exp(exp2) * Ts_2 * std::cos(cos2); - Real64 summation = std::exp(exp1) * Ts_1 * std::cos(cos1) + std::exp(exp2) * Ts_2 * std::cos(cos2); + return aveGroundTemp - summation; + } - return aveGroundTemp - summation; -} + //****************************************************************************** -//****************************************************************************** + Real64 XingGroundTempsModel::getGroundTempAtTimeInMonths(EnergyPlusData &state, const Real64 _depth, const int _month) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 -Real64 XingGroundTempsModel::getGroundTempAtTimeInMonths(EnergyPlusData &state, Real64 _depth, int _month) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + // PURPOSE OF THIS SUBROUTINE: + // Returns ground temperature when input time is in months - // PURPOSE OF THIS SUBROUTINE: - // Returns ground temperature when input time is in months + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + // TODO: Fixing this to be floating point 12.0 causes diffs and failed tests + Real64 const aveDaysInMonth = state.dataWeather->NumDaysInYear / 12; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 const aveDaysInMonth = state.dataWeather->NumDaysInYear / 12; + depth = _depth; - depth = _depth; + // Set month + if (_month >= 1 && _month <= 12) { + simTimeInDays = aveDaysInMonth * (_month - 1 + 0.5); + } else { + const int monthIndex = _month % 12; + simTimeInDays = aveDaysInMonth * (monthIndex - 1 + 0.5); + } - // Set month - if (_month >= 1 && _month <= 12) { - simTimeInDays = aveDaysInMonth * ((_month - 1) + 0.5); - } else { - int monthIndex = remainder(_month, 12); - simTimeInDays = aveDaysInMonth * ((monthIndex - 1) + 0.5); + // Get and return ground temp + return getGroundTemp(state); } - // Get and return ground temp - return getGroundTemp(state); -} + //****************************************************************************** -//****************************************************************************** + Real64 XingGroundTempsModel::getGroundTempAtTimeInSeconds(EnergyPlusData &state, const Real64 _depth, const Real64 seconds) + { + // SUBROUTINE INFORMATION: + // AUTHOR Matt Mitchell + // DATE WRITTEN Summer 2015 -Real64 XingGroundTempsModel::getGroundTempAtTimeInSeconds(EnergyPlusData &state, Real64 _depth, Real64 seconds) -{ - // SUBROUTINE INFORMATION: - // AUTHOR Matt Mitchell - // DATE WRITTEN Summer 2015 + // PURPOSE OF THIS SUBROUTINE: + // Returns ground temperature when time is in seconds - // PURPOSE OF THIS SUBROUTINE: - // Returns ground temperature when time is in seconds + depth = _depth; - depth = _depth; + simTimeInDays = seconds / Constant::rSecsInDay; - simTimeInDays = seconds / Constant::SecsInDay; + if (simTimeInDays > state.dataWeather->NumDaysInYear) { + simTimeInDays = remainder(simTimeInDays, state.dataWeather->NumDaysInYear); + } - if (simTimeInDays > state.dataWeather->NumDaysInYear) { - simTimeInDays = remainder(simTimeInDays, state.dataWeather->NumDaysInYear); + return getGroundTemp(state); } - return getGroundTemp(state); -} - -//****************************************************************************** - + //****************************************************************************** +} // namespace GroundTemp } // namespace EnergyPlus diff --git a/src/EnergyPlus/GroundTemperatureModeling/XingGroundTemperatureModel.hh b/src/EnergyPlus/GroundTemperatureModeling/XingGroundTemperatureModel.hh index 924f6566a0c..35e135b0d50 100644 --- a/src/EnergyPlus/GroundTemperatureModeling/XingGroundTemperatureModel.hh +++ b/src/EnergyPlus/GroundTemperatureModeling/XingGroundTemperatureModel.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -48,11 +48,7 @@ #ifndef XingGroundTemperatureManager_hh_INCLUDED #define XingGroundTemperatureManager_hh_INCLUDED -// C++ Headers -#include - // EnergyPlus Headers -#include #include #include @@ -61,27 +57,28 @@ namespace EnergyPlus { // Forward declarations struct EnergyPlusData; -class XingGroundTempsModel : public BaseGroundTempsModel -{ -public: - Real64 depth = 0.0; - Real64 groundThermalDiffisivity = 0.0; - Real64 simTimeInDays = 0.0; - Real64 aveGroundTemp = 0.0; - Real64 surfTempAmplitude_1 = 0.0; - Real64 phaseShift_1 = 0.0; - Real64 surfTempAmplitude_2 = 0.0; - Real64 phaseShift_2 = 0.0; +namespace GroundTemp { + struct XingGroundTempsModel final : BaseGroundTempsModel + { + Real64 depth = 0.0; + Real64 groundThermalDiffusivity = 0.0; + Real64 simTimeInDays = 0.0; + Real64 aveGroundTemp = 0.0; + Real64 surfTempAmplitude_1 = 0.0; + Real64 phaseShift_1 = 0.0; + Real64 surfTempAmplitude_2 = 0.0; + Real64 phaseShift_2 = 0.0; - static std::shared_ptr XingGTMFactory(EnergyPlusData &state, std::string objectName); + static XingGroundTempsModel *XingGTMFactory(EnergyPlusData &state, const std::string &objectName); - Real64 getGroundTemp(EnergyPlusData &state) override; + Real64 getGroundTemp(EnergyPlusData &state) override; - Real64 getGroundTempAtTimeInSeconds(EnergyPlusData &state, Real64 const depth, Real64 const timeInSecondsOfSim) override; + Real64 getGroundTempAtTimeInSeconds(EnergyPlusData &state, Real64 depth, Real64 timeInSecondsOfSim) override; - Real64 getGroundTempAtTimeInMonths(EnergyPlusData &state, Real64 const depth, int const monthOfSim) override; -}; + Real64 getGroundTempAtTimeInMonths(EnergyPlusData &state, Real64 depth, int monthOfSim) override; + }; +} // namespace GroundTemp } // namespace EnergyPlus #endif diff --git a/src/EnergyPlus/HVACControllers.cc b/src/EnergyPlus/HVACControllers.cc index 18614ac6d3a..45de694d730 100644 --- a/src/EnergyPlus/HVACControllers.cc +++ b/src/EnergyPlus/HVACControllers.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -1022,11 +1022,8 @@ void InitController(EnergyPlusData &state, int const ControlNum, bool &IsConverg // Do the Begin Environment initializations if (state.dataGlobal->BeginEnvrnFlag && MyEnvrnFlag(ControlNum)) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(thisController.ActuatedNodePlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(thisController.ActuatedNodePlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = + state.dataPlnt->PlantLoop(thisController.ActuatedNodePlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); thisController.MinActuated = rho * thisController.MinVolFlowActuated; thisController.MaxActuated = rho * thisController.MaxVolFlowActuated; @@ -2473,7 +2470,7 @@ Real64 GetCurrentHVACTime(const EnergyPlusData &state) // as real. Real64 const CurrentHVACTime = (state.dataGlobal->CurrentTime - state.dataGlobal->TimeStepZone) + state.dataHVACGlobal->SysTimeElapsed + state.dataHVACGlobal->TimeStepSys; - return CurrentHVACTime * Constant::SecInHour; + return CurrentHVACTime * Constant::rSecsInHour; } Real64 GetPreviousHVACTime(const EnergyPlusData &state) @@ -2488,7 +2485,7 @@ Real64 GetPreviousHVACTime(const EnergyPlusData &state) // This is the correct formula that does not use MinutesPerSystemTimeStep, which would // erronously truncate all sub-minute system time steps down to the closest full minute. Real64 const PreviousHVACTime = (state.dataGlobal->CurrentTime - state.dataGlobal->TimeStepZone) + state.dataHVACGlobal->SysTimeElapsed; - return PreviousHVACTime * Constant::SecInHour; + return PreviousHVACTime * Constant::rSecsInHour; } std::string CreateHVACTimeString(const EnergyPlusData &state) diff --git a/src/EnergyPlus/HVACControllers.hh b/src/EnergyPlus/HVACControllers.hh index 4798aeee770..7eb2d16e7e5 100644 --- a/src/EnergyPlus/HVACControllers.hh +++ b/src/EnergyPlus/HVACControllers.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -367,6 +367,10 @@ struct HVACControllersData : BaseGlobalStruct Array1D_bool MySizeFlag; Array1D_bool MyPlantIndexsFlag; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/HVACCooledBeam.cc b/src/EnergyPlus/HVACCooledBeam.cc index 91bc20a0de9..721e2fcbe74 100644 --- a/src/EnergyPlus/HVACCooledBeam.cc +++ b/src/EnergyPlus/HVACCooledBeam.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -102,7 +102,6 @@ namespace HVACCooledBeam { // Using/Aliasing using namespace DataLoopNode; - using namespace ScheduleManager; using HVAC::SmallAirVolFlow; using HVAC::SmallLoad; using HVAC::SmallMassFlow; @@ -209,6 +208,7 @@ namespace HVACCooledBeam { // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetCoolBeams "); // include trailing blank space + static constexpr std::string_view routineName = "GetCoolBeams"; int CBIndex; // loop index std::string CurrentModuleObject; // for ease in getting objects @@ -267,6 +267,8 @@ namespace HVACCooledBeam { lAlphaBlanks, cAlphaFields, cNumericFields); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; int CBNum = CBIndex; CoolBeam(CBNum).Name = Alphas(1); @@ -282,22 +284,12 @@ namespace HVACCooledBeam { ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, CoolBeam(CBNum).Name)); ErrorsFound = true; } - CoolBeam(CBNum).Sched = Alphas(2); + if (lAlphaBlanks(2)) { - CoolBeam(CBNum).SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - CoolBeam(CBNum).SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (CoolBeam(CBNum).SchedPtr == 0) { - ShowSevereError(state, - format("{}{}: invalid {} entered ={} for {}={}", - RoutineName, - CurrentModuleObject, - cAlphaFields(2), - Alphas(2), - cAlphaFields(1), - Alphas(1))); - ErrorsFound = true; - } + CoolBeam(CBNum).availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((CoolBeam(CBNum).availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { // convert schedule name to pointer + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } CoolBeam(CBNum).AirInNode = GetOnlySingleNode(state, Alphas(4), @@ -509,7 +501,6 @@ namespace HVACCooledBeam { // Using/Aliasing using DataZoneEquipment::CheckZoneEquipmentList; - using FluidProperties::GetDensityGlycol; using PlantUtilities::InitComponentNodes; using PlantUtilities::ScanPlantLoopsForObject; using PlantUtilities::SetComponentFlowRate; @@ -560,11 +551,7 @@ namespace HVACCooledBeam { InWaterNode = coolBeam.CWInNode; OutWaterNode = coolBeam.CWOutNode; - rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(coolBeam.CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(coolBeam.CWPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(coolBeam.CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); coolBeam.MaxCoolWaterMassFlow = rho * coolBeam.MaxCoolWaterVolFlow; InitComponentNodes(state, 0.0, coolBeam.MaxCoolWaterMassFlow, InWaterNode, OutWaterNode); coolBeam.MySizeFlag = false; @@ -607,13 +594,13 @@ namespace HVACCooledBeam { // Do the start of HVAC time step initializations if (FirstHVACIteration) { // check for upstream zero flow. If nonzero and schedule ON, set primary flow to max - if (GetCurrentScheduleValue(state, coolBeam.SchedPtr) > 0.0 && state.dataLoopNodes->Node(InAirNode).MassFlowRate > 0.0) { + if (coolBeam.availSched->getCurrentVal() > 0.0 && state.dataLoopNodes->Node(InAirNode).MassFlowRate > 0.0) { state.dataLoopNodes->Node(InAirNode).MassFlowRate = coolBeam.MaxAirMassFlow; } else { state.dataLoopNodes->Node(InAirNode).MassFlowRate = 0.0; } // reset the max and min avail flows - if (GetCurrentScheduleValue(state, coolBeam.SchedPtr) > 0.0 && state.dataLoopNodes->Node(InAirNode).MassFlowRateMaxAvail > 0.0) { + if (coolBeam.availSched->getCurrentVal() > 0.0 && state.dataLoopNodes->Node(InAirNode).MassFlowRateMaxAvail > 0.0) { state.dataLoopNodes->Node(InAirNode).MassFlowRateMaxAvail = coolBeam.MaxAirMassFlow; state.dataLoopNodes->Node(InAirNode).MassFlowRateMinAvail = coolBeam.MaxAirMassFlow; } else { @@ -648,8 +635,6 @@ namespace HVACCooledBeam { // Using/Aliasing using namespace DataSizing; - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSpecificHeatGlycol; using PlantUtilities::MyPlantSizingIndex; using PlantUtilities::RegisterPlantCompDesignFlow; @@ -735,17 +720,10 @@ namespace HVACCooledBeam { state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum).ZoneSizThermSetPtHi); } - rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(coolBeam.CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(coolBeam.CWPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(coolBeam.CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); - Cp = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(coolBeam.CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(coolBeam.CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(coolBeam.CWPlantLoc.loopNum) + .glycol->getSpecificHeat(state, Constant::CWInitConvTemp, RoutineName); coolBeam.MaxCoolWaterVolFlow = DesCoilLoad / ((coolBeam.DesOutletWaterTemp - coolBeam.DesInletWaterTemp) * Cp * rho); coolBeam.MaxCoolWaterVolFlow = max(coolBeam.MaxCoolWaterVolFlow, 0.0); @@ -767,11 +745,7 @@ namespace HVACCooledBeam { } if (coolBeam.NumBeams == AutoSize) { - rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(coolBeam.CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(coolBeam.CWPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(coolBeam.CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); NumBeams = int(coolBeam.MaxCoolWaterVolFlow * rho / NomMassFlowPerBeam) + 1; coolBeam.NumBeams = double(NumBeams); @@ -785,17 +759,9 @@ namespace HVACCooledBeam { CheckZoneSizing(state, coolBeam.UnitType, coolBeam.Name); if (PltSizCoolNum > 0) { - rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(coolBeam.CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(coolBeam.CWPlantLoc.loopNum).FluidIndex, - RoutineName); - - Cp = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(coolBeam.CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(coolBeam.CWPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(coolBeam.CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); + + Cp = state.dataPlnt->PlantLoop(coolBeam.CWPlantLoc.loopNum).glycol->getSpecificHeat(state, Constant::CWInitConvTemp, RoutineName); DesCoilLoad = coolBeam.MaxCoolWaterVolFlow * (coolBeam.DesOutletWaterTemp - coolBeam.DesInletWaterTemp) * Cp * rho; if (DesCoilLoad > 0.0) { DesLoadPerBeam = DesCoilLoad / NumBeams; @@ -932,7 +898,7 @@ namespace HVACCooledBeam { MinColdWaterFlow = 0.0; SetComponentFlowRate(state, MinColdWaterFlow, coolBeam.CWInNode, coolBeam.CWOutNode, coolBeam.CWPlantLoc); - if (GetCurrentScheduleValue(state, coolBeam.SchedPtr) <= 0.0) UnitOn = false; + if (coolBeam.availSched->getCurrentVal() <= 0.0) UnitOn = false; if (MaxColdWaterFlow <= SmallMassFlow) UnitOn = false; // Set the unit's air inlet nodes mass flow rates @@ -1022,8 +988,6 @@ namespace HVACCooledBeam { // na // Using/Aliasing - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSpecificHeatGlycol; using PlantUtilities::SetComponentFlowRate; // Locals @@ -1066,17 +1030,9 @@ namespace HVACCooledBeam { CWFlowPerBeam = mdot / coolBeam.NumBeams; TWIn = coolBeam.TWIn; - Cp = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(coolBeam.CWPlantLoc.loopNum).FluidName, - TWIn, - state.dataPlnt->PlantLoop(coolBeam.CWPlantLoc.loopNum).FluidIndex, - RoutineName); - - rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(coolBeam.CWPlantLoc.loopNum).FluidName, - TWIn, - state.dataPlnt->PlantLoop(coolBeam.CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(coolBeam.CWPlantLoc.loopNum).glycol->getSpecificHeat(state, TWIn, RoutineName); + + rho = state.dataPlnt->PlantLoop(coolBeam.CWPlantLoc.loopNum).glycol->getDensity(state, TWIn, RoutineName); TWOut = TWIn + 2.0; ZTemp = state.dataLoopNodes->Node(ZoneNode).Temp; diff --git a/src/EnergyPlus/HVACCooledBeam.hh b/src/EnergyPlus/HVACCooledBeam.hh index 08835018e67..ece261fdbf0 100644 --- a/src/EnergyPlus/HVACCooledBeam.hh +++ b/src/EnergyPlus/HVACCooledBeam.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -56,6 +56,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -77,36 +78,35 @@ namespace HVACCooledBeam { { // Members // input data - std::string Name; // name of unit - std::string UnitType; // type of unit = AirTerminal:SingleDuct:ConstantVolume:CooledBeam - int UnitType_Num; // index to type of unit = 1 (there's only 1 type so far) - std::string CBTypeString; // type of cooled beam: active | passive - CooledBeamType CBType; // index to type of cooled beam - std::string Sched; // availability schedule - int SchedPtr; // index to schedule - Real64 MaxAirVolFlow; // m3/s (autosizable) - Real64 MaxAirMassFlow; // kg/s - Real64 MaxCoolWaterVolFlow; // m3/s - Real64 MaxCoolWaterMassFlow; // kg/s - int AirInNode; // unit air inlet node number - int AirOutNode; // unit air outlet node number - int CWInNode; // chilled water inlet node - int CWOutNode; // chilled water outlet node - int ADUNum; // index of corresponding air distribution unit - Real64 NumBeams; // number of beams in the zone - Real64 BeamLength; // length of individual beam [m] - Real64 DesInletWaterTemp; // design inlet water temperature [C] - Real64 DesOutletWaterTemp; // design outlet water Temperature [c] - Real64 CoilArea; // coil surface area per coil length [m2/m] - Real64 a; // model parameter a - Real64 n1; // model parameter n0 - Real64 n2; // model parameter n1 - Real64 n3; // model parameter n2 - Real64 a0; // model parameter a0 - Real64 K1; // model parameter K1 - Real64 n; // model parameter n - Real64 Kin; // Coefficient of Induction Kin - Real64 InDiam; // Leaving Pipe Inside Diameter + std::string Name; // name of unit + std::string UnitType; // type of unit = AirTerminal:SingleDuct:ConstantVolume:CooledBeam + int UnitType_Num; // index to type of unit = 1 (there's only 1 type so far) + std::string CBTypeString; // type of cooled beam: active | passive + CooledBeamType CBType; // index to type of cooled beam + Sched::Schedule *availSched = nullptr; // availability schedule + Real64 MaxAirVolFlow; // m3/s (autosizable) + Real64 MaxAirMassFlow; // kg/s + Real64 MaxCoolWaterVolFlow; // m3/s + Real64 MaxCoolWaterMassFlow; // kg/s + int AirInNode; // unit air inlet node number + int AirOutNode; // unit air outlet node number + int CWInNode; // chilled water inlet node + int CWOutNode; // chilled water outlet node + int ADUNum; // index of corresponding air distribution unit + Real64 NumBeams; // number of beams in the zone + Real64 BeamLength; // length of individual beam [m] + Real64 DesInletWaterTemp; // design inlet water temperature [C] + Real64 DesOutletWaterTemp; // design outlet water Temperature [c] + Real64 CoilArea; // coil surface area per coil length [m2/m] + Real64 a; // model parameter a + Real64 n1; // model parameter n0 + Real64 n2; // model parameter n1 + Real64 n3; // model parameter n2 + Real64 a0; // model parameter a0 + Real64 K1; // model parameter K1 + Real64 n; // model parameter n + Real64 Kin; // Coefficient of Induction Kin + Real64 InDiam; // Leaving Pipe Inside Diameter // time step variables Real64 TWIn; // current inlet water temperature [C] Real64 TWOut; // current outlet water temperature [C] @@ -133,7 +133,7 @@ namespace HVACCooledBeam { // Default Constructor CoolBeamData() - : UnitType_Num(0), CBType(CooledBeamType::Invalid), SchedPtr(0), MaxAirVolFlow(0.0), MaxAirMassFlow(0.0), MaxCoolWaterVolFlow(0.0), + : UnitType_Num(0), CBType(CooledBeamType::Invalid), MaxAirVolFlow(0.0), MaxAirMassFlow(0.0), MaxCoolWaterVolFlow(0.0), MaxCoolWaterMassFlow(0.0), AirInNode(0), AirOutNode(0), CWInNode(0), CWOutNode(0), ADUNum(0), NumBeams(0.0), BeamLength(0.0), DesInletWaterTemp(0.0), DesOutletWaterTemp(0.0), CoilArea(0.0), a(0.0), n1(0.0), n2(0.0), n3(0.0), a0(0.0), K1(0.0), n(0.0), Kin(0.0), InDiam(0.0), TWIn(0.0), TWOut(0.0), EnthWaterOut(0.0), BeamFlow(0.0), CoolWaterMassFlow(0.0), BeamCoolingEnergy(0.0), @@ -195,6 +195,10 @@ struct HVACCooledBeamData : BaseGlobalStruct bool GetInputFlag = true; // First time, input is "gotten" bool ZoneEquipmentListChecked = false; // True after the Zone Equipment List has been checked for items + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/HVACDXHeatPumpSystem.cc b/src/EnergyPlus/HVACDXHeatPumpSystem.cc index a5a2a332cdc..ce71e6ec18b 100644 --- a/src/EnergyPlus/HVACDXHeatPumpSystem.cc +++ b/src/EnergyPlus/HVACDXHeatPumpSystem.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -94,7 +94,6 @@ namespace HVACDXHeatPumpSystem { // Use statements for data only modules // Using/Aliasing using namespace DataLoopNode; - using namespace ScheduleManager; void SimDXHeatPumpSystem(EnergyPlusData &state, std::string_view DXHeatPumpSystemName, // Name of DXSystem:Airloop object @@ -246,8 +245,6 @@ namespace HVACDXHeatPumpSystem { // METHODOLOGY EMPLOYED: // Uses "Get" routines to read in data. - // REFERENCES: - // Using/Aliasing using BranchNodeConnections::SetUpCompSets; using BranchNodeConnections::TestCompSet; @@ -262,7 +259,8 @@ namespace HVACDXHeatPumpSystem { int NumNums; int IOStat; static constexpr std::string_view RoutineName("GetDXHeatPumpSystemInput: "); // include trailing blank space - bool IsNotOK; // Flag to verify name + static constexpr std::string_view routineName = "GetDXHeatPumpSystemInput"; + bool IsNotOK; // Flag to verify name int DXHeatSysNum; std::string CurrentModuleObject; // for ease in getting objects Array1D_string Alphas; // Alpha input items for object @@ -307,23 +305,16 @@ namespace HVACDXHeatPumpSystem { lAlphaBlanks, cAlphaFields, cNumericFields); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; DXHeatPumpSystem(DXHeatSysNum).DXHeatPumpSystemType = CurrentModuleObject; // push Object Name into data array DXHeatPumpSystem(DXHeatSysNum).Name = Alphas(1); + if (lAlphaBlanks(2)) { - DXHeatPumpSystem(DXHeatSysNum).SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - DXHeatPumpSystem(DXHeatSysNum).SchedPtr = GetScheduleIndex(state, Alphas(2)); - if (DXHeatPumpSystem(DXHeatSysNum).SchedPtr == 0) { - ShowSevereError(state, - format("{}{}: invalid {} entered ={} for {}={}", - RoutineName, - CurrentModuleObject, - cAlphaFields(2), - Alphas(2), - cAlphaFields(1), - Alphas(1))); - state.dataHVACDXHeatPumpSys->ErrorsFound = true; - } + DXHeatPumpSystem(DXHeatSysNum).availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((DXHeatPumpSystem(DXHeatSysNum).availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + state.dataHVACDXHeatPumpSys->ErrorsFound = true; } if (Util::SameString(Alphas(3), "Coil:Heating:DX:SingleSpeed")) { @@ -549,7 +540,6 @@ namespace HVACDXHeatPumpSystem { // Data is moved from the System data structure to the System outlet nodes. // Using/Aliasing - using namespace ScheduleManager; using DXCoils::SimDXCoil; using HVAC::TempControlTol; @@ -626,8 +616,7 @@ namespace HVACDXHeatPumpSystem { } // If DXHeatingSystem is scheduled on and there is flow - if ((GetCurrentScheduleValue(state, DXHeatPumpSystem.SchedPtr) > 0.0) && - (state.dataLoopNodes->Node(InletNode).MassFlowRate > MinAirMassFlow)) { + if ((DXHeatPumpSystem.availSched->getCurrentVal() > 0.0) && (state.dataLoopNodes->Node(InletNode).MassFlowRate > MinAirMassFlow)) { // Determine if there is a sensible load on this system if ((state.dataLoopNodes->Node(InletNode).Temp < state.dataLoopNodes->Node(ControlNode).TempSetPoint) && diff --git a/src/EnergyPlus/HVACDXHeatPumpSystem.hh b/src/EnergyPlus/HVACDXHeatPumpSystem.hh index d2ef78c3304..c8c128dadc6 100644 --- a/src/EnergyPlus/HVACDXHeatPumpSystem.hh +++ b/src/EnergyPlus/HVACDXHeatPumpSystem.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -73,7 +73,7 @@ namespace HVACDXHeatPumpSystem { // Members std::string DXHeatPumpSystemType; // Type of DXHeatingSystem std::string Name; // Name of the DXHeatingSystem - int SchedPtr; + Sched::Schedule *availSched = nullptr; std::string HeatPumpCoilType; int HeatPumpCoilType_Num; std::string HeatPumpCoilName; @@ -103,10 +103,10 @@ namespace HVACDXHeatPumpSystem { // Default Constructor DXHeatPumpSystemStruct() - : SchedPtr(0), HeatPumpCoilType_Num(0), HeatPumpCoilIndex(0), DXHeatPumpCoilInletNodeNum(0), DXHeatPumpCoilOutletNodeNum(0), - DXSystemControlNodeNum(0), DesiredOutletTemp(0.0), PartLoadFrac(0.0), SpeedRatio(0.0), CycRatio(0.0), DXCoilSensPLRIter(0), - DXCoilSensPLRIterIndex(0), DXCoilSensPLRFail(0), DXCoilSensPLRFailIndex(0), OAUnitSetTemp(0.0), SpeedNum(0), FaultyCoilSATFlag(false), - FaultyCoilSATIndex(0), FaultyCoilSATOffset(0.0) + : HeatPumpCoilType_Num(0), HeatPumpCoilIndex(0), DXHeatPumpCoilInletNodeNum(0), DXHeatPumpCoilOutletNodeNum(0), DXSystemControlNodeNum(0), + DesiredOutletTemp(0.0), PartLoadFrac(0.0), SpeedRatio(0.0), CycRatio(0.0), DXCoilSensPLRIter(0), DXCoilSensPLRIterIndex(0), + DXCoilSensPLRFail(0), DXCoilSensPLRFailIndex(0), OAUnitSetTemp(0.0), SpeedNum(0), FaultyCoilSATFlag(false), FaultyCoilSATIndex(0), + FaultyCoilSATOffset(0.0) { } }; @@ -197,6 +197,10 @@ struct HVACDXHeatPumpSystemData : BaseGlobalStruct Real64 AirFlowOnOffRatio = 1.0; // ratio of compressor on flow to average flow over time step Real64 SpeedPartLoadRatio = 1.0; // SpeedRatio varies between 1.0 (higher speed) and 0.0 (lower speed) + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/HVACDuct.cc b/src/EnergyPlus/HVACDuct.cc index f470ec36024..92b39618bbd 100644 --- a/src/EnergyPlus/HVACDuct.cc +++ b/src/EnergyPlus/HVACDuct.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/HVACDuct.hh b/src/EnergyPlus/HVACDuct.hh index 4e0aa3ae80b..fa07bef3b05 100644 --- a/src/EnergyPlus/HVACDuct.hh +++ b/src/EnergyPlus/HVACDuct.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -118,6 +118,10 @@ struct HVACDuctData : BaseGlobalStruct Array1D Duct; bool GetInputFlag = true; // First time, input is "gotten" + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/HVACFourPipeBeam.cc b/src/EnergyPlus/HVACFourPipeBeam.cc index d2359453977..a3d1db38985 100644 --- a/src/EnergyPlus/HVACFourPipeBeam.cc +++ b/src/EnergyPlus/HVACFourPipeBeam.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -96,7 +96,6 @@ namespace FourPipeBeam { using NodeInputManager::GetOnlySingleNode; using namespace DataSizing; using Curve::GetCurveIndex; - using ScheduleManager::GetScheduleIndex; static constexpr std::string_view routineName("FourPipeBeamFactory "); // include trailing blank space int beamIndex; // loop index @@ -137,6 +136,8 @@ namespace FourPipeBeam { ErrorsFound = true; } + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + errFlag = false; GlobalNames::VerifyUniqueADUName(state, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1), errFlag, cCurrentModuleObject + " Name"); if (errFlag) { @@ -146,52 +147,23 @@ namespace FourPipeBeam { thisBeam->unitType = cCurrentModuleObject; if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { - thisBeam->airAvailSchedNum = ScheduleManager::ScheduleAlwaysOn; - } else { - thisBeam->airAvailSchedNum = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); // convert schedule name to pointer - if (thisBeam->airAvailSchedNum == 0) { - ShowSevereError(state, - format("{}{}: invalid {} entered ={} for {}={}", - routineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2), - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1))); - ErrorsFound = true; - } + thisBeam->airAvailSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisBeam->airAvailSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2)); + ErrorsFound = true; } + if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { - thisBeam->coolingAvailSchedNum = ScheduleManager::ScheduleAlwaysOn; - } else { - thisBeam->coolingAvailSchedNum = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(3)); // convert schedule name to index - if (thisBeam->coolingAvailSchedNum == 0) { - ShowSevereError(state, - format("{}{}: invalid {} entered ={} for {}={}", - routineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3), - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1))); - ErrorsFound = true; - } + thisBeam->coolingAvailSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisBeam->coolingAvailSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3)); + ErrorsFound = true; } if (state.dataIPShortCut->lAlphaFieldBlanks(4)) { - thisBeam->heatingAvailSchedNum = ScheduleManager::ScheduleAlwaysOn; - } else { - thisBeam->heatingAvailSchedNum = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(4)); // convert schedule name to index - if (thisBeam->heatingAvailSchedNum == 0) { - ShowSevereError(state, - format("{}{}: invalid {} entered ={} for {}={}", - routineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4), - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1))); - ErrorsFound = true; - } + thisBeam->heatingAvailSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisBeam->heatingAvailSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(4))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4)); + ErrorsFound = true; } thisBeam->airInNodeNum = GetOnlySingleNode(state, @@ -576,7 +548,6 @@ namespace FourPipeBeam { using PlantUtilities::InitComponentNodes; using PlantUtilities::ScanPlantLoopsForObject; using PlantUtilities::SetComponentFlowRate; - using ScheduleManager::GetCurrentScheduleValue; static constexpr std::string_view routineName("HVACFourPipeBeam::init"); @@ -674,21 +645,10 @@ namespace FourPipeBeam { // Do the start of HVAC time step initializations if (FirstHVACIteration) { // check availability schedules and set flags - if (GetCurrentScheduleValue(state, this->airAvailSchedNum) > 0.0) { - this->airAvailable = true; - } else { - this->airAvailable = false; - } - if (this->airAvailable && beamCoolingPresent && (GetCurrentScheduleValue(state, this->coolingAvailSchedNum) > 0.0)) { - this->coolingAvailable = true; - } else { - this->coolingAvailable = false; - } - if (this->airAvailable && beamHeatingPresent && (GetCurrentScheduleValue(state, this->heatingAvailSchedNum) > 0.0)) { - this->heatingAvailable = true; - } else { - this->heatingAvailable = false; - } + this->airAvailable = (this->airAvailSched->getCurrentVal() > 0.0); + this->coolingAvailable = (this->airAvailable && beamCoolingPresent && (this->coolingAvailSched->getCurrentVal() > 0.0)); + this->heatingAvailable = (this->airAvailable && beamHeatingPresent && (this->heatingAvailSched->getCurrentVal() > 0.0)); + // check for upstream zero flow. If nonzero and air available, set primary flow to max if (this->airAvailable && state.dataLoopNodes->Node(this->airInNodeNum).MassFlowRate > 0.0) { state.dataLoopNodes->Node(this->airInNodeNum).MassFlowRate = this->mDotDesignPrimAir; @@ -735,8 +695,6 @@ namespace FourPipeBeam { // Using using namespace DataSizing; - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSpecificHeatGlycol; using PlantUtilities::MyPlantSizingIndex; using PlantUtilities::RegisterPlantCompDesignFlow; using Psychrometrics::PsyCpAirFnW; @@ -872,11 +830,8 @@ namespace FourPipeBeam { this->totBeamLength = this->vDotDesignPrimAir / this->vDotNormRatedPrimAir; if (this->vDotDesignCWWasAutosized) { this->vDotDesignCW = this->vDotNormRatedCW * this->totBeamLength; - Real64 const rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->cWplantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->cWplantLoc.loopNum).FluidIndex, - routineName); + Real64 const rho = + state.dataPlnt->PlantLoop(this->cWplantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, routineName); this->mDotNormRatedCW = this->vDotNormRatedCW * rho; this->mDotCW = this->vDotDesignCW * rho; if (this->beamCoolingPresent) { @@ -885,11 +840,8 @@ namespace FourPipeBeam { } if (vDotDesignHWWasAutosized) { this->vDotDesignHW = this->vDotNormRatedHW * this->totBeamLength; - Real64 const rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->hWplantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->hWplantLoc.loopNum).FluidIndex, - routineName); + Real64 const rho = + state.dataPlnt->PlantLoop(this->hWplantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, routineName); this->mDotNormRatedHW = this->vDotNormRatedHW * rho; this->mDotHW = this->vDotDesignHW * rho; if (this->beamHeatingPresent) { @@ -952,11 +904,8 @@ namespace FourPipeBeam { this->totBeamLength = this->vDotDesignPrimAir / this->vDotNormRatedPrimAir; if (this->vDotDesignCWWasAutosized) { this->vDotDesignCW = this->vDotNormRatedCW * this->totBeamLength; - Real64 const rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->cWplantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->cWplantLoc.loopNum).FluidIndex, - routineName); + Real64 const rho = + state.dataPlnt->PlantLoop(this->cWplantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, routineName); this->mDotNormRatedCW = this->vDotNormRatedCW * rho; this->mDotCW = this->vDotDesignCW * rho; if (this->beamCoolingPresent) { @@ -965,11 +914,8 @@ namespace FourPipeBeam { } if (vDotDesignHWWasAutosized) { this->vDotDesignHW = this->vDotNormRatedHW * this->totBeamLength; - Real64 const rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->hWplantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->hWplantLoc.loopNum).FluidIndex, - routineName); + Real64 const rho = + state.dataPlnt->PlantLoop(this->hWplantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, routineName); this->mDotNormRatedHW = this->vDotNormRatedHW * rho; this->mDotHW = this->vDotDesignHW * rho; if (this->beamHeatingPresent) { @@ -1035,21 +981,13 @@ namespace FourPipeBeam { } if (this->beamCoolingPresent) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->cWplantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->cWplantLoc.loopNum).FluidIndex, - routineName); + rho = state.dataPlnt->PlantLoop(this->cWplantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, routineName); this->mDotNormRatedCW = this->vDotNormRatedCW * rho; this->mDotDesignCW = this->vDotDesignCW * rho; PlantUtilities::InitComponentNodes(state, 0.0, this->mDotDesignCW, this->cWInNodeNum, this->cWOutNodeNum); } if (this->beamHeatingPresent) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->hWplantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->hWplantLoc.loopNum).FluidIndex, - routineName); + rho = state.dataPlnt->PlantLoop(this->hWplantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, routineName); this->mDotNormRatedHW = this->vDotNormRatedHW * rho; this->mDotDesignHW = this->vDotDesignHW * rho; PlantUtilities::InitComponentNodes(state, 0.0, this->mDotDesignHW, this->hWInNodeNum, this->hWOutNodeNum); @@ -1245,8 +1183,6 @@ namespace FourPipeBeam { { // Using/Aliasing - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSpecificHeatGlycol; using PlantUtilities::SetComponentFlowRate; // Locals @@ -1284,11 +1220,7 @@ namespace FourPipeBeam { fModCoolAirMdot = Curve::CurveValue( state, this->modCoolingQdotAirFlowFuncNum, ((this->mDotSystemAir / this->totBeamLength) / this->mDotNormRatedPrimAir)); this->qDotBeamCooling = -1.0 * this->qDotNormRatedCooling * fModCoolDeltaT * fModCoolAirMdot * fModCoolCWMdot * this->totBeamLength; - cp = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->cWplantLoc.loopNum).FluidName, - this->cWTempIn, - state.dataPlnt->PlantLoop(this->cWplantLoc.loopNum).FluidIndex, - routineName); + cp = state.dataPlnt->PlantLoop(this->cWplantLoc.loopNum).glycol->getSpecificHeat(state, this->cWTempIn, routineName); if (this->mDotCW > 0.0) { this->cWTempOut = this->cWTempIn - (this->qDotBeamCooling / (this->mDotCW * cp)); } else { @@ -1325,11 +1257,7 @@ namespace FourPipeBeam { fModHeatAirMdot = Curve::CurveValue( state, this->modHeatingQdotAirFlowFuncNum, ((this->mDotSystemAir / this->totBeamLength) / this->mDotNormRatedPrimAir)); this->qDotBeamHeating = this->qDotNormRatedHeating * fModHeatDeltaT * fModHeatAirMdot * fModHeatHWMdot * this->totBeamLength; - cp = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->hWplantLoc.loopNum).FluidName, - this->hWTempIn, - state.dataPlnt->PlantLoop(this->hWplantLoc.loopNum).FluidIndex, - routineName); + cp = state.dataPlnt->PlantLoop(this->hWplantLoc.loopNum).glycol->getSpecificHeat(state, this->hWTempIn, routineName); if (this->mDotHW > 0.0) { this->hWTempOut = this->hWTempIn - (this->qDotBeamHeating / (this->mDotHW * cp)); } else { diff --git a/src/EnergyPlus/HVACFourPipeBeam.hh b/src/EnergyPlus/HVACFourPipeBeam.hh index f6d4d4e5732..90bae748b2b 100644 --- a/src/EnergyPlus/HVACFourPipeBeam.hh +++ b/src/EnergyPlus/HVACFourPipeBeam.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -73,15 +73,14 @@ namespace FourPipeBeam { private: // Creation // Default Constructor HVACFourPipeBeam() - : coolingAvailSchedNum(0), coolingAvailable(false), heatingAvailSchedNum(0), heatingAvailable(false), totBeamLength(0.0), - totBeamLengthWasAutosized(false), vDotNormRatedPrimAir(0.0), mDotNormRatedPrimAir(0.0), beamCoolingPresent(false), vDotDesignCW(0.0), - vDotDesignCWWasAutosized(false), mDotDesignCW(0.0), qDotNormRatedCooling(0.0), deltaTempRatedCooling(0.0), vDotNormRatedCW(0.0), - mDotNormRatedCW(0.0), modCoolingQdotDeltaTFuncNum(0), modCoolingQdotAirFlowFuncNum(0), modCoolingQdotCWFlowFuncNum(0), mDotCW(0.0), - cWTempIn(0.0), cWTempOut(0.0), cWTempOutErrorCount(0), cWInNodeNum(0), cWOutNodeNum(0), - cWplantLoc(PlantLocation(0, DataPlant::LoopSideLocation::Invalid, 0, 0)), beamHeatingPresent(false), vDotDesignHW(0.0), - vDotDesignHWWasAutosized(false), mDotDesignHW(0.0), qDotNormRatedHeating(0.0), deltaTempRatedHeating(0.0), vDotNormRatedHW(0.0), - mDotNormRatedHW(0.0), modHeatingQdotDeltaTFuncNum(0), modHeatingQdotAirFlowFuncNum(0), modHeatingQdotHWFlowFuncNum(0), mDotHW(0.0), - hWTempIn(0.0), hWTempOut(0.0), hWTempOutErrorCount(0), hWInNodeNum(0), hWOutNodeNum(0), + : coolingAvailable(false), heatingAvailable(false), totBeamLength(0.0), totBeamLengthWasAutosized(false), vDotNormRatedPrimAir(0.0), + mDotNormRatedPrimAir(0.0), beamCoolingPresent(false), vDotDesignCW(0.0), vDotDesignCWWasAutosized(false), mDotDesignCW(0.0), + qDotNormRatedCooling(0.0), deltaTempRatedCooling(0.0), vDotNormRatedCW(0.0), mDotNormRatedCW(0.0), modCoolingQdotDeltaTFuncNum(0), + modCoolingQdotAirFlowFuncNum(0), modCoolingQdotCWFlowFuncNum(0), mDotCW(0.0), cWTempIn(0.0), cWTempOut(0.0), cWTempOutErrorCount(0), + cWInNodeNum(0), cWOutNodeNum(0), cWplantLoc(PlantLocation(0, DataPlant::LoopSideLocation::Invalid, 0, 0)), beamHeatingPresent(false), + vDotDesignHW(0.0), vDotDesignHWWasAutosized(false), mDotDesignHW(0.0), qDotNormRatedHeating(0.0), deltaTempRatedHeating(0.0), + vDotNormRatedHW(0.0), mDotNormRatedHW(0.0), modHeatingQdotDeltaTFuncNum(0), modHeatingQdotAirFlowFuncNum(0), + modHeatingQdotHWFlowFuncNum(0), mDotHW(0.0), hWTempIn(0.0), hWTempOut(0.0), hWTempOutErrorCount(0), hWInNodeNum(0), hWOutNodeNum(0), hWplantLoc(PlantLocation(0, DataPlant::LoopSideLocation::Invalid, 0, 0)), beamCoolingEnergy(0.0), beamCoolingRate(0.0), beamHeatingEnergy(0.0), beamHeatingRate(0.0), supAirCoolingEnergy(0.0), supAirCoolingRate(0.0), supAirHeatingEnergy(0.0), supAirHeatingRate(0.0), primAirFlow(0.0), OutdoorAirFlowRate(0.0), myEnvrnFlag(true), mySizeFlag(true), plantLoopScanFlag(true), @@ -136,11 +135,11 @@ namespace FourPipeBeam { void CalcOutdoorAirVolumeFlowRate(EnergyPlusData &state); - private: // data - int coolingAvailSchedNum; // index to schedule for cooling availability - bool coolingAvailable; // true if beam cooling is available - int heatingAvailSchedNum; // index to schedule for heating availability - bool heatingAvailable; // true if beam heating is available + private: // data + Sched::Schedule *coolingAvailSched = nullptr; // schedule for cooling availability + bool coolingAvailable; // true if beam cooling is available + Sched::Schedule *heatingAvailSched = nullptr; // schedule for heating availability + bool heatingAvailable; // true if beam heating is available Real64 totBeamLength; // length of all the beams in the zone (autosizable) (m) bool totBeamLengthWasAutosized; // true if beam length was autosized on input @@ -228,6 +227,10 @@ struct FourPipeBeamData : BaseGlobalStruct ///// Note use of shared_ptr here is not a good pattern, not to be replicated without further discussion. Array1D> FourPipeBeams; // dimension to number of machines + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc b/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc index 31efd545087..fe61af6a082 100644 --- a/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc +++ b/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -323,7 +323,7 @@ namespace HVACHXAssistedCoolingCoil { ErrorsFound = true; } - thisHXCoil.DXCoilNumOfSpeeds = state.dataCoilCooingDX->coilCoolingDXs[coolingCoilIndex_temp].performance.normalMode.speeds.size(); + thisHXCoil.DXCoilNumOfSpeeds = state.dataCoilCoolingDX->coilCoolingDXs[coolingCoilIndex_temp].performance.normalMode.speeds.size(); if (thisHXCoil.DXCoilNumOfSpeeds < 1) { CoolingCoilErrFlag = true; } @@ -389,7 +389,7 @@ namespace HVACHXAssistedCoolingCoil { } if (Util::SameString(thisHXCoil.CoolingCoilType, "Coil:Cooling:DX")) { - CoolingCoilInletNodeNum = state.dataCoilCooingDX->coilCoolingDXs[thisHXCoil.CoolingCoilIndex].evapInletNodeIndex; + CoolingCoilInletNodeNum = state.dataCoilCoolingDX->coilCoolingDXs[thisHXCoil.CoolingCoilIndex].evapInletNodeIndex; if (SupplyAirOutletNode != CoolingCoilInletNodeNum) { ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisHXCoil.Name)); ShowContinueError(state, "Node names are inconsistent in heat exchanger and cooling coil object."); @@ -406,7 +406,7 @@ namespace HVACHXAssistedCoolingCoil { ErrorsFound = true; } - CoolingCoilOutletNodeNum = state.dataCoilCooingDX->coilCoolingDXs[thisHXCoil.CoolingCoilIndex].evapOutletNodeIndex; + CoolingCoilOutletNodeNum = state.dataCoilCoolingDX->coilCoolingDXs[thisHXCoil.CoolingCoilIndex].evapOutletNodeIndex; if (SecondaryAirInletNode != CoolingCoilOutletNodeNum) { ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisHXCoil.Name)); ShowContinueError(state, "Node names are inconsistent in heat exchanger and cooling coil object."); @@ -836,9 +836,9 @@ namespace HVACHXAssistedCoolingCoil { if (thisHXCoil.CoolingCoilType_Num == HVAC::CoilDX_Cooling) { // - // state.dataCoilCooingDX->coilCoolingDXs[thisHXCoil.CoolingCoilIndex] + // state.dataCoilCoolingDX->coilCoolingDXs[thisHXCoil.CoolingCoilIndex] // .outletAirDryBulbTemp = 0.0; - // state.dataCoilCooingDX->coilCoolingDXs[thisHXCoil.CoolingCoilIndex].outletAirHumRat = + // state.dataCoilCoolingDX->coilCoolingDXs[thisHXCoil.CoolingCoilIndex].outletAirHumRat = // 0.0; } else if (thisHXCoil.CoolingCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed) { state.dataDXCoils->DXCoilFullLoadOutAirTemp(thisHXCoil.CoolingCoilIndex) = 0.0; @@ -930,14 +930,14 @@ namespace HVACHXAssistedCoolingCoil { int coolingCoilIndex = thisHXCoil.CoolingCoilIndex; - int mSingleMode = state.dataCoilCooingDX->coilCoolingDXs[coolingCoilIndex].getNumModes(); + int mSingleMode = state.dataCoilCoolingDX->coilCoolingDXs[coolingCoilIndex].getNumModes(); bool singleMode = (mSingleMode == 1); - Real64 mCoolingSpeedNum = state.dataCoilCooingDX->coilCoolingDXs[coolingCoilIndex] + Real64 mCoolingSpeedNum = state.dataCoilCoolingDX->coilCoolingDXs[coolingCoilIndex] .performance.normalMode.speeds.size(); // used the same for the original variable speed coil HVAC::CoilMode coilMode = HVAC::CoilMode::Normal; - if (state.dataCoilCooingDX->coilCoolingDXs[coolingCoilIndex].SubcoolReheatFlag) { + if (state.dataCoilCoolingDX->coilCoolingDXs[coolingCoilIndex].SubcoolReheatFlag) { coilMode = HVAC::CoilMode::SubcoolReheat; } else if (DehumidificationMode == HVAC::CoilMode::Enhanced) { coilMode = HVAC::CoilMode::Enhanced; @@ -960,13 +960,13 @@ namespace HVACHXAssistedCoolingCoil { CoilPLR = PartLoadRatio * ((compressorOp == HVAC::CompressorOp::On) ? 1.0 : 0.0); } - state.dataCoilCooingDX->coilCoolingDXs[thisHXCoil.CoolingCoilIndex].simulate(state, - coilMode, // partially implemented for HXAssistedCoil - CoilPLR, // PartLoadRatio, - mCoolingSpeedNum, - mCoolingSpeedRatio, - fanOp, - singleMode); // + state.dataCoilCoolingDX->coilCoolingDXs[thisHXCoil.CoolingCoilIndex].simulate(state, + coilMode, // partially implemented for HXAssistedCoil + CoilPLR, // PartLoadRatio, + mCoolingSpeedNum, + mCoolingSpeedRatio, + fanOp, + singleMode); // } else if (thisHXCoil.CoolingCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed) { DXCoils::SimDXCoil(state, @@ -1171,7 +1171,7 @@ namespace HVACHXAssistedCoolingCoil { if (state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType_Num == HVAC::CoilDX_Cooling) { int coolingCoilDXIndex = state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilIndex; - CoilCapacity = state.dataCoilCooingDX->coilCoolingDXs[coolingCoilDXIndex].performance.normalMode.ratedGrossTotalCap; + CoilCapacity = state.dataCoilCoolingDX->coilCoolingDXs[coolingCoilDXIndex].performance.normalMode.ratedGrossTotalCap; } else if (state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed) { CoilCapacity = DXCoils::GetCoilCapacity(state, state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType, diff --git a/src/EnergyPlus/HVACHXAssistedCoolingCoil.hh b/src/EnergyPlus/HVACHXAssistedCoolingCoil.hh index a24688310fe..a427fbfaf94 100644 --- a/src/EnergyPlus/HVACHXAssistedCoolingCoil.hh +++ b/src/EnergyPlus/HVACHXAssistedCoolingCoil.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -248,6 +248,10 @@ struct HVACHXAssistedCoolingCoilData : BaseGlobalStruct int ErrCount = 0; int ErrCount2 = 0; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/HVACInterfaceManager.cc b/src/EnergyPlus/HVACInterfaceManager.cc index bc69d709fb9..9772e392b12 100644 --- a/src/EnergyPlus/HVACInterfaceManager.cc +++ b/src/EnergyPlus/HVACInterfaceManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -506,8 +506,7 @@ void UpdatePlantLoopInterface(EnergyPlusData &state, Real64 OldTankOutletTemp = state.dataLoopNodes->Node(OtherLoopSideInletNode).Temp; // calculate the specific heat - Real64 Cp = FluidProperties::GetSpecificHeatGlycol( - state, state.dataPlnt->PlantLoop(LoopNum).FluidName, OldTankOutletTemp, state.dataPlnt->PlantLoop(LoopNum).FluidIndex, RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(LoopNum).glycol->getSpecificHeat(state, OldTankOutletTemp, RoutineName); // update the enthalpy state.dataLoopNodes->Node(OtherLoopSideInletNode).Enthalpy = Cp * state.dataLoopNodes->Node(OtherLoopSideInletNode).Temp; @@ -660,8 +659,7 @@ void UpdateHalfLoopInletTemp(EnergyPlusData &state, int const LoopNum, const Dat Real64 LastTankOutletTemp = state.dataPlnt->PlantLoop(LoopNum).LoopSide(TankOutletLoopSide).LastTempInterfaceTankOutlet; // calculate the specific heat for the capacitance calculation - Real64 Cp = FluidProperties::GetSpecificHeatGlycol( - state, state.dataPlnt->PlantLoop(LoopNum).FluidName, LastTankOutletTemp, state.dataPlnt->PlantLoop(LoopNum).FluidIndex, RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(LoopNum).glycol->getSpecificHeat(state, LastTankOutletTemp, RoutineName); // set the fraction of loop mass assigned to each half loop outlet capacitance ('tank') calculation // calculate new loop inlet temperature. The calculation is a simple 'tank' (thermal capacitance) calculation that includes: @@ -791,8 +789,7 @@ void UpdateCommonPipe(EnergyPlusData &state, Real64 LastTankOutletTemp = state.dataPlnt->PlantLoop(LoopNum).LoopSide(TankOutletLoopSide).LastTempInterfaceTankOutlet; // calculate the specific heat for the capacitance calculation - Real64 Cp = FluidProperties::GetSpecificHeatGlycol( - state, state.dataPlnt->PlantLoop(LoopNum).FluidName, LastTankOutletTemp, state.dataPlnt->PlantLoop(LoopNum).FluidIndex, RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(LoopNum).glycol->getSpecificHeat(state, LastTankOutletTemp, RoutineName); // set the fraction of loop mass assigned to each half loop outlet capacitance ('tank') calculation diff --git a/src/EnergyPlus/HVACInterfaceManager.hh b/src/EnergyPlus/HVACInterfaceManager.hh index aa0a15cbe38..9063e546a5c 100644 --- a/src/EnergyPlus/HVACInterfaceManager.hh +++ b/src/EnergyPlus/HVACInterfaceManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -158,6 +158,10 @@ struct HVACInterfaceManagerData : BaseGlobalStruct Array1D PlantCommonPipe; Array1D TmpRealARR = Array1D(DataConvergParams::ConvergLogStackDepth); // Tuned Made static + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/HVACManager.cc b/src/EnergyPlus/HVACManager.cc index 8bc8708c0ed..7fdf5f7ad62 100644 --- a/src/EnergyPlus/HVACManager.cc +++ b/src/EnergyPlus/HVACManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -152,6 +152,8 @@ void ManageHVAC(EnergyPlusData &state) Real64 PriorTimeStep; // magnitude of time step for previous history terms Real64 ZoneTempChange(0.0); // change in zone air temperature from timestep t-1 to t + auto &s_hbfs = state.dataHeatBalFanSys; + // SYSTEM INITIALIZATION if (state.dataHVACMgr->TriggerGetAFN) { state.dataHVACMgr->TriggerGetAFN = false; @@ -171,17 +173,18 @@ void ManageHVAC(EnergyPlusData &state) thisSpaceHB.ZTAV = 0.0; thisSpaceHB.airHumRatAvg = 0.0; } - state.dataHeatBalFanSys->ZoneThermostatSetPointHiAver = 0.0; - state.dataHeatBalFanSys->ZoneThermostatSetPointLoAver = 0.0; + + for (auto &zoneTstatSetpt : s_hbfs->zoneTstatSetpts) { + zoneTstatSetpt.setptHiAver = zoneTstatSetpt.setptLoAver = 0.0; + } + state.dataHVACMgr->PrintedWarmup = false; if (state.dataContaminantBalance->Contaminant.CO2Simulation) { - state.dataContaminantBalance->OutdoorCO2 = - ScheduleManager::GetCurrentScheduleValue(state, state.dataContaminantBalance->Contaminant.CO2OutdoorSchedPtr); + state.dataContaminantBalance->OutdoorCO2 = state.dataContaminantBalance->Contaminant.CO2OutdoorSched->getCurrentVal(); state.dataContaminantBalance->ZoneAirCO2Avg = 0.0; } if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) { - state.dataContaminantBalance->OutdoorGC = - ScheduleManager::GetCurrentScheduleValue(state, state.dataContaminantBalance->Contaminant.GenericContamOutdoorSchedPtr); + state.dataContaminantBalance->OutdoorGC = state.dataContaminantBalance->Contaminant.genericOutdoorSched->getCurrentVal(); if (allocated(state.dataContaminantBalance->ZoneAirGCAvg)) state.dataContaminantBalance->ZoneAirGCAvg = 0.0; } @@ -199,7 +202,7 @@ void ManageHVAC(EnergyPlusData &state) state.dataHVACGlobal->SysTimeElapsed = 0.0; state.dataHVACGlobal->TimeStepSys = state.dataGlobal->TimeStepZone; - state.dataHVACGlobal->TimeStepSysSec = state.dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state.dataHVACGlobal->TimeStepSysSec = state.dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state.dataHVACGlobal->FirstTimeStepSysFlag = true; state.dataHVACGlobal->ShortenTimeStepSys = false; state.dataHVACGlobal->UseZoneTimeStepHistory = true; @@ -306,7 +309,7 @@ void ManageHVAC(EnergyPlusData &state) state.dataHVACGlobal->TimeStepSys = state.dataGlobal->TimeStepZone / state.dataHVACGlobal->NumOfSysTimeSteps; } state.dataHVACGlobal->TimeStepSys = max(state.dataHVACGlobal->TimeStepSys, state.dataConvergeParams->MinTimeStepSys); - state.dataHVACGlobal->TimeStepSysSec = state.dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state.dataHVACGlobal->TimeStepSysSec = state.dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state.dataHVACGlobal->UseZoneTimeStepHistory = false; state.dataHVACGlobal->ShortenTimeStepSys = true; @@ -404,10 +407,9 @@ void ManageHVAC(EnergyPlusData &state) state.dataContaminantBalance->ZoneAirGCAvg(ZoneNum) += state.dataContaminantBalance->ZoneAirGC(ZoneNum) * state.dataHVACGlobal->FracTimeStepZone; if (state.dataZoneTempPredictorCorrector->NumOnOffCtrZone > 0) { - state.dataHeatBalFanSys->ZoneThermostatSetPointHiAver(ZoneNum) += - state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ZoneNum) * state.dataHVACGlobal->FracTimeStepZone; - state.dataHeatBalFanSys->ZoneThermostatSetPointLoAver(ZoneNum) += - state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ZoneNum) * state.dataHVACGlobal->FracTimeStepZone; + auto &zoneTstatSetpt = s_hbfs->zoneTstatSetpts(ZoneNum); + zoneTstatSetpt.setptHiAver += zoneTstatSetpt.setptHi * state.dataHVACGlobal->FracTimeStepZone; + zoneTstatSetpt.setptLoAver += zoneTstatSetpt.setptLo * state.dataHVACGlobal->FracTimeStepZone; } } @@ -1717,7 +1719,7 @@ void SimHVAC(EnergyPlusData &state) state.dataHVACGlobal->DoSetPointTest = false; } - if (state.dataCoilCooingDX->stillNeedToReportStandardRatings) { + if (state.dataCoilCoolingDX->stillNeedToReportStandardRatings) { if (!state.dataGlobal->WarmupFlag) { CoilCoolingDX::reportAllStandardRatings(state); } @@ -2238,7 +2240,12 @@ void ReportInfiltrations(EnergyPlusData &state) AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, thisSpaceHB.MAT, thisSpaceHB.airHumRatAvg, RoutineName); thisInfiltration.InfilVdotCurDensity = thisInfiltration.InfilMdot / AirDensity; thisInfiltration.InfilVolumeCurDensity = thisInfiltration.InfilVdotCurDensity * TimeStepSysSec; - thisInfiltration.InfilAirChangeRate = thisInfiltration.InfilVolumeCurDensity / (TimeStepSys * thisZone.Volume); + Real64 vol = state.dataHeatBal->space(spaceNum).Volume; + if (vol > 0.0) { + thisInfiltration.InfilAirChangeRate = thisInfiltration.InfilVolumeCurDensity / (TimeStepSys * vol); + } else { + thisInfiltration.InfilAirChangeRate = 0.0; + } // CR7751 third, calculate using standard dry air at nominal elevation AirDensity = state.dataEnvrn->StdRhoAir; @@ -2261,58 +2268,28 @@ void ReportAirHeatBalance(EnergyPlusData &state) static constexpr std::string_view RoutineName3("ReportAirHeatBalance:3"); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 AirDensity; // Density of air (kg/m^3) - Real64 CpAir; // Heat capacity of air (J/kg-C) - Real64 ADSCorrectionFactor; // Correction factor of air flow model values when ADS is simulated - Real64 H2OHtOfVap; // Heat of vaporization of air - Real64 TotalLoad; // Total loss or gain state.dataHeatBal->ZoneTotalExfiltrationHeatLoss = 0.0; state.dataHeatBal->ZoneTotalExhaustHeatLoss = 0.0; - Real64 TimeStepSys = state.dataHVACGlobal->TimeStepSys; - Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { state.afn->report(); } // Reports zone exhaust loss by exhaust fans - for (int ZoneLoop = 1; ZoneLoop <= state.dataGlobal->NumOfZones; ++ZoneLoop) { // Start of zone loads report variable update loop ... - auto &zone = state.dataHeatBal->Zone(ZoneLoop); - auto &znAirRpt = state.dataHeatBal->ZnAirRpt(ZoneLoop); - auto &zoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(ZoneLoop); - CpAir = Psychrometrics::PsyCpAirFnW(state.dataEnvrn->OutHumRat); - H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(state.dataEnvrn->OutHumRat, zone.OutDryBulbTemp); - ADSCorrectionFactor = 1.0; - if (state.afn->simulation_control.type == AirflowNetwork::ControlType::MultizoneWithDistributionOnlyDuringFanOperation) { - if ((state.dataZoneEquip->ZoneEquipAvail(ZoneLoop) == Avail::Status::CycleOn || - state.dataZoneEquip->ZoneEquipAvail(ZoneLoop) == Avail::Status::CycleOnZoneFansOnly) && - state.afn->AirflowNetworkZoneFlag(ZoneLoop)) { - ADSCorrectionFactor = 0.0; - } - } - - znAirRpt.ExhTotalLoss = 0; - znAirRpt.ExhSensiLoss = 0; - - for (int FanNum = 1; FanNum <= (int)state.dataFans->fans.size(); ++FanNum) { - auto const *thisFan = state.dataFans->fans(FanNum); - // Add reportable vars - if (thisFan->type == HVAC::FanType::Exhaust) { - for (int ExhNum = 1; ExhNum <= zoneEquipConfig.NumExhaustNodes; ExhNum++) { - if (thisFan->inletNodeNum == zoneEquipConfig.ExhaustNode(ExhNum)) { - znAirRpt.ExhTotalLoss += - thisFan->outletAirMassFlowRate * (thisFan->outletAirEnthalpy - state.dataEnvrn->OutEnthalpy) * ADSCorrectionFactor; - znAirRpt.ExhSensiLoss += - thisFan->outletAirMassFlowRate * CpAir * (thisFan->outletAirTemp - zone.OutDryBulbTemp) * ADSCorrectionFactor; - break; - } - } - } + for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { // Start of zone loads report variable update loop ... + auto &zone = state.dataHeatBal->Zone(zoneNum); + auto &znAirRpt = state.dataHeatBal->ZnAirRpt(zoneNum); + auto &znEquipConfig = state.dataZoneEquip->ZoneEquipConfig(zoneNum); + reportAirHeatBal1(state, znAirRpt, znEquipConfig, zoneNum); + } + if (state.dataHeatBal->doSpaceHeatBalance) { + for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) { + auto &spAirRpt = state.dataHeatBal->spaceAirRpt(spaceNum); + auto &spEquipConfig = state.dataZoneEquip->spaceEquipConfig(spaceNum); + int zoneNum = state.dataHeatBal->space(spaceNum).zoneNum; + reportAirHeatBal1(state, spAirRpt, spEquipConfig, zoneNum, spaceNum); } - - znAirRpt.ExhLatentLoss = znAirRpt.ExhTotalLoss - znAirRpt.ExhSensiLoss; } // Report results for SIMPLE option only @@ -2321,397 +2298,484 @@ void ReportAirHeatBalance(EnergyPlusData &state) return; } - if (state.dataHVACMgr->ReportAirHeatBalanceFirstTimeFlag) { - state.dataHVACMgr->MixSenLoad.allocate(state.dataGlobal->NumOfZones); - state.dataHVACMgr->MixLatLoad.allocate(state.dataGlobal->NumOfZones); - state.dataHVACMgr->ReportAirHeatBalanceFirstTimeFlag = false; - } - ReportInfiltrations(state); - for (int ZoneLoop = 1; ZoneLoop <= state.dataGlobal->NumOfZones; ++ZoneLoop) { // Start of zone loads report variable update loop ... - auto &zone = state.dataHeatBal->Zone(ZoneLoop); - auto &znAirRpt = state.dataHeatBal->ZnAirRpt(ZoneLoop); - auto &zoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(ZoneLoop); - auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneLoop); - auto &mixSenLoad = state.dataHVACMgr->MixSenLoad(ZoneLoop); // Mixing sensible loss or gain - auto &mixLatLoad = state.dataHVACMgr->MixLatLoad(ZoneLoop); // Mixing latent loss or gain + for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { + auto &znAirRpt = state.dataHeatBal->ZnAirRpt(zoneNum); + auto &znEquipConfig = state.dataZoneEquip->ZoneEquipConfig(zoneNum); + auto &znHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum); + reportAirHeatBal2(state, znAirRpt, znEquipConfig, znHB, zoneNum); + } + if (state.dataHeatBal->doSpaceHeatBalance) { + for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) { + auto &spAirRpt = state.dataHeatBal->spaceAirRpt(spaceNum); + auto &spEquipConfig = state.dataZoneEquip->spaceEquipConfig(spaceNum); + auto &spHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum); + int zoneNum = state.dataHeatBal->space(spaceNum).zoneNum; + reportAirHeatBal2(state, spAirRpt, spEquipConfig, spHB, zoneNum, spaceNum); + } + } +} - // Break the infiltration load into heat gain and loss components - ADSCorrectionFactor = 1.0; +void reportAirHeatBal1(EnergyPlusData &state, + DataHeatBalance::AirReportVars &szAirRpt, + DataZoneEquipment::EquipConfiguration const &szEquipConfig, + int const zoneNum, + int const spaceNum) +{ + Real64 CpAir = Psychrometrics::PsyCpAirFnW(state.dataEnvrn->OutHumRat); // Heat capacity of air (J/kg-C) + Real64 outDB = state.dataHeatBal->Zone(zoneNum).OutDryBulbTemp; + Real64 H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(state.dataEnvrn->OutHumRat, outDB); // Heat of vaporization of air + Real64 ADSCorrectionFactor = 1.0; + if (state.afn->simulation_control.type == AirflowNetwork::ControlType::MultizoneWithDistributionOnlyDuringFanOperation) { + if ((state.dataZoneEquip->ZoneEquipAvail(zoneNum) == Avail::Status::CycleOn || + state.dataZoneEquip->ZoneEquipAvail(zoneNum) == Avail::Status::CycleOnZoneFansOnly) && + state.afn->AirflowNetworkZoneFlag(zoneNum)) { + ADSCorrectionFactor = 0.0; + } + } - if (state.afn->simulation_control.type == AirflowNetwork::ControlType::MultizoneWithDistributionOnlyDuringFanOperation) { - // CR7608 IF (TurnFansOn .AND. AirflowNetworkZoneFlag(ZoneLoop)) ADSCorrectionFactor=0 - if ((state.dataZoneEquip->ZoneEquipAvail(ZoneLoop) == Avail::Status::CycleOn || - state.dataZoneEquip->ZoneEquipAvail(ZoneLoop) == Avail::Status::CycleOnZoneFansOnly) && - state.afn->AirflowNetworkZoneFlag(ZoneLoop)) - ADSCorrectionFactor = 0.0; + szAirRpt.ExhTotalLoss = 0; + szAirRpt.ExhSensiLoss = 0; + + for (int FanNum = 1; FanNum <= (int)state.dataFans->fans.size(); ++FanNum) { + auto const *thisFan = state.dataFans->fans(FanNum); + // Add reportable vars + if (thisFan->type == HVAC::FanType::Exhaust) { + for (int ExhNum = 1; ExhNum <= szEquipConfig.NumExhaustNodes; ExhNum++) { + if (thisFan->inletNodeNum == szEquipConfig.ExhaustNode(ExhNum)) { + szAirRpt.ExhTotalLoss += + thisFan->outletAirMassFlowRate * (thisFan->outletAirEnthalpy - state.dataEnvrn->OutEnthalpy) * ADSCorrectionFactor; + szAirRpt.ExhSensiLoss += thisFan->outletAirMassFlowRate * CpAir * (thisFan->outletAirTemp - outDB) * ADSCorrectionFactor; + break; + } + } } + } - if (thisZoneHB.MAT > zone.OutDryBulbTemp) { + szAirRpt.ExhLatentLoss = szAirRpt.ExhTotalLoss - szAirRpt.ExhSensiLoss; +} +void reportAirHeatBal2(EnergyPlusData &state, + DataHeatBalance::AirReportVars &szAirRpt, + DataZoneEquipment::EquipConfiguration const &szEquipConfig, + ZoneTempPredictorCorrector::ZoneSpaceHeatBalanceData const &szHeatBal, + int const zoneNum, + int const spaceNum) +{ + static constexpr std::string_view RoutineName = "reportAirHeatBal2"; - znAirRpt.InfilHeatLoss = thisZoneHB.MCPI * (thisZoneHB.MAT - zone.OutDryBulbTemp) * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.InfilHeatGain = 0.0; + // Break the infiltration load into heat gain and loss components + Real64 ADSCorrectionFactor = 1.0; - } else { + if (state.afn->simulation_control.type == AirflowNetwork::ControlType::MultizoneWithDistributionOnlyDuringFanOperation) { + // CR7608 IF (TurnFansOn .AND. AirflowNetworkZoneFlag(zoneNum)) ADSCorrectionFactor=0 + if ((state.dataZoneEquip->ZoneEquipAvail(zoneNum) == Avail::Status::CycleOn || + state.dataZoneEquip->ZoneEquipAvail(zoneNum) == Avail::Status::CycleOnZoneFansOnly) && + state.afn->AirflowNetworkZoneFlag(zoneNum)) + ADSCorrectionFactor = 0.0; + } - znAirRpt.InfilHeatGain = thisZoneHB.MCPI * (zone.OutDryBulbTemp - thisZoneHB.MAT) * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.InfilHeatLoss = 0.0; - } - // Report infiltration latent gains and losses - CpAir = Psychrometrics::PsyCpAirFnW(state.dataEnvrn->OutHumRat); - H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(thisZoneHB.airHumRat, thisZoneHB.MAT); - if (thisZoneHB.airHumRat > state.dataEnvrn->OutHumRat) { + Real64 const outDryBulb = state.dataHeatBal->Zone(zoneNum).OutDryBulbTemp; + if (szHeatBal.MAT > outDryBulb) { - znAirRpt.InfilLatentLoss = - thisZoneHB.MCPI / CpAir * (thisZoneHB.airHumRat - state.dataEnvrn->OutHumRat) * H2OHtOfVap * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.InfilLatentGain = 0.0; + szAirRpt.InfilHeatLoss = szHeatBal.MCPI * (szHeatBal.MAT - outDryBulb) * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.InfilHeatGain = 0.0; - } else { + } else { - znAirRpt.InfilLatentGain = - thisZoneHB.MCPI / CpAir * (state.dataEnvrn->OutHumRat - thisZoneHB.airHumRat) * H2OHtOfVap * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.InfilLatentLoss = 0.0; - } - // Total infiltration losses and gains - TotalLoad = znAirRpt.InfilHeatGain + znAirRpt.InfilLatentGain - znAirRpt.InfilHeatLoss - znAirRpt.InfilLatentLoss; - if (TotalLoad > 0) { - znAirRpt.InfilTotalGain = TotalLoad * ADSCorrectionFactor; - znAirRpt.InfilTotalLoss = 0.0; - } else { - znAirRpt.InfilTotalGain = 0.0; - znAirRpt.InfilTotalLoss = -TotalLoad * ADSCorrectionFactor; - } + szAirRpt.InfilHeatGain = szHeatBal.MCPI * (outDryBulb - szHeatBal.MAT) * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.InfilHeatLoss = 0.0; + } + // Report infiltration latent gains and losses + Real64 CpAir = Psychrometrics::PsyCpAirFnW(state.dataEnvrn->OutHumRat); // Heat capacity of air (J/kg-C) + Real64 H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(szHeatBal.airHumRat, szHeatBal.MAT); // Heat of vaporization of air + if (szHeatBal.airHumRat > state.dataEnvrn->OutHumRat) { - // first calculate mass flows using outside air heat capacity for consistency with input to heat balance - znAirRpt.InfilMdot = (thisZoneHB.MCPI / CpAir) * ADSCorrectionFactor; - znAirRpt.InfilMass = znAirRpt.InfilMdot * TimeStepSysSec; - znAirRpt.VentilMdot = (thisZoneHB.MCPV / CpAir) * ADSCorrectionFactor; - znAirRpt.VentilMass = znAirRpt.VentilMdot * TimeStepSysSec; + szAirRpt.InfilLatentLoss = szHeatBal.MCPI / CpAir * (szHeatBal.airHumRat - state.dataEnvrn->OutHumRat) * H2OHtOfVap * + state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.InfilLatentGain = 0.0; - // CR7751 second, calculate using indoor conditions for density property - AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, thisZoneHB.MAT, thisZoneHB.airHumRatAvg, RoutineName3); - znAirRpt.InfilVdotCurDensity = znAirRpt.InfilMdot / AirDensity; - znAirRpt.InfilVolumeCurDensity = znAirRpt.InfilVdotCurDensity * TimeStepSysSec; - znAirRpt.InfilAirChangeRate = znAirRpt.InfilVolumeCurDensity / (TimeStepSys * zone.Volume); - znAirRpt.VentilVdotCurDensity = znAirRpt.VentilMdot / AirDensity; - znAirRpt.VentilVolumeCurDensity = znAirRpt.VentilVdotCurDensity * TimeStepSysSec; - znAirRpt.VentilAirChangeRate = znAirRpt.VentilVolumeCurDensity / (TimeStepSys * zone.Volume); + } else { - // CR7751 third, calculate using standard dry air at nominal elevation - AirDensity = state.dataEnvrn->StdRhoAir; - znAirRpt.InfilVdotStdDensity = znAirRpt.InfilMdot / AirDensity; - znAirRpt.InfilVolumeStdDensity = znAirRpt.InfilVdotStdDensity * TimeStepSysSec; - znAirRpt.VentilVdotStdDensity = znAirRpt.VentilMdot / AirDensity; - znAirRpt.VentilVolumeStdDensity = znAirRpt.VentilVdotStdDensity * TimeStepSysSec; - - // znAirRpt%VentilFanElec = 0.0 - znAirRpt.VentilAirTemp = 0.0; - znAirRpt.VentilHeatLoss = 0.0; - znAirRpt.VentilHeatGain = 0.0; - int VentZoneNum = 0; // Number of ventilation object per zone - Real64 VentZoneMassflow = 0.0; // Total mass flow rate per zone - Real64 VentZoneAirTemp = 0.0; // Average Zone inlet temperature - - for (int VentNum = 1; VentNum <= state.dataHeatBal->TotVentilation; ++VentNum) { - auto const &ventilation = state.dataHeatBal->Ventilation(VentNum); - if (ventilation.ZonePtr == ZoneLoop) { - if (ADSCorrectionFactor > 0) { - znAirRpt.VentilAirTemp += ventilation.AirTemp * ventilation.MCP; - VentZoneMassflow += ventilation.MCP; - VentZoneAirTemp += ventilation.AirTemp; - } else { - znAirRpt.VentilAirTemp = zone.OutDryBulbTemp; - } - // Break the ventilation load into heat gain and loss components - if (thisZoneHB.MAT > ventilation.AirTemp) { - znAirRpt.VentilHeatLoss += ventilation.MCP * (thisZoneHB.MAT - ventilation.AirTemp) * TimeStepSysSec * ADSCorrectionFactor; - } else { - znAirRpt.VentilHeatGain += ventilation.MCP * (ventilation.AirTemp - thisZoneHB.MAT) * TimeStepSysSec * ADSCorrectionFactor; - } + szAirRpt.InfilLatentGain = szHeatBal.MCPI / CpAir * (state.dataEnvrn->OutHumRat - szHeatBal.airHumRat) * H2OHtOfVap * + state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.InfilLatentLoss = 0.0; + } + // Total infiltration losses and gains + Real64 TotalLoad = szAirRpt.InfilHeatGain + szAirRpt.InfilLatentGain - szAirRpt.InfilHeatLoss - szAirRpt.InfilLatentLoss; + if (TotalLoad > 0) { + szAirRpt.InfilTotalGain = TotalLoad * ADSCorrectionFactor; + szAirRpt.InfilTotalLoss = 0.0; + } else { + szAirRpt.InfilTotalGain = 0.0; + szAirRpt.InfilTotalLoss = -TotalLoad * ADSCorrectionFactor; + } - ++VentZoneNum; - if (VentZoneNum > 1) continue; + // first calculate mass flows using outside air heat capacity for consistency with input to heat balance + szAirRpt.InfilMdot = (szHeatBal.MCPI / CpAir) * ADSCorrectionFactor; + szAirRpt.InfilMass = szAirRpt.InfilMdot * state.dataHVACGlobal->TimeStepSysSec; + szAirRpt.VentilMdot = (szHeatBal.MCPV / CpAir) * ADSCorrectionFactor; + szAirRpt.VentilMass = szAirRpt.VentilMdot * state.dataHVACGlobal->TimeStepSysSec; + + // CR7751 second, calculate using indoor conditions for density property + Real64 szVolume = (spaceNum == 0) ? state.dataHeatBal->Zone(zoneNum).Volume : state.dataHeatBal->space(spaceNum).Volume; + Real64 AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, szHeatBal.MAT, szHeatBal.airHumRatAvg, RoutineName); + szAirRpt.InfilVdotCurDensity = szAirRpt.InfilMdot / AirDensity; + szAirRpt.InfilVolumeCurDensity = szAirRpt.InfilVdotCurDensity * state.dataHVACGlobal->TimeStepSysSec; + if (szVolume > 0.0) { + szAirRpt.InfilAirChangeRate = szAirRpt.InfilVolumeCurDensity / (state.dataHVACGlobal->TimeStepSys * szVolume); + } else { + szAirRpt.InfilAirChangeRate = 0.0; + } + szAirRpt.VentilVdotCurDensity = szAirRpt.VentilMdot / AirDensity; + szAirRpt.VentilVolumeCurDensity = szAirRpt.VentilVdotCurDensity * state.dataHVACGlobal->TimeStepSysSec; + if (szVolume > 0.0) { + szAirRpt.VentilAirChangeRate = szAirRpt.VentilVolumeCurDensity / (state.dataHVACGlobal->TimeStepSys * szVolume); + } else { + szAirRpt.VentilAirChangeRate = 0.0; + } - // Report ventilation latent gains and losses - H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(thisZoneHB.airHumRat, thisZoneHB.MAT); - if (thisZoneHB.airHumRat > state.dataEnvrn->OutHumRat) { - znAirRpt.VentilLatentLoss = - znAirRpt.VentilMdot * (thisZoneHB.airHumRat - state.dataEnvrn->OutHumRat) * H2OHtOfVap * TimeStepSysSec; - znAirRpt.VentilLatentGain = 0.0; - } else { - znAirRpt.VentilLatentGain = - znAirRpt.VentilMdot * (state.dataEnvrn->OutHumRat - thisZoneHB.airHumRat) * H2OHtOfVap * TimeStepSysSec; - znAirRpt.VentilLatentLoss = 0.0; - } - // Total ventilation losses and gains - TotalLoad = znAirRpt.VentilHeatGain + znAirRpt.VentilLatentGain - znAirRpt.VentilHeatLoss - znAirRpt.VentilLatentLoss; - if (TotalLoad > 0) { - znAirRpt.VentilTotalGain = TotalLoad * ADSCorrectionFactor; - znAirRpt.VentilTotalLoss = 0.0; - } else { - znAirRpt.VentilTotalGain = 0.0; - znAirRpt.VentilTotalLoss = -TotalLoad * ADSCorrectionFactor; - } + // CR7751 third, calculate using standard dry air at nominal elevation + AirDensity = state.dataEnvrn->StdRhoAir; + szAirRpt.InfilVdotStdDensity = szAirRpt.InfilMdot / AirDensity; + szAirRpt.InfilVolumeStdDensity = szAirRpt.InfilVdotStdDensity * state.dataHVACGlobal->TimeStepSysSec; + szAirRpt.VentilVdotStdDensity = szAirRpt.VentilMdot / AirDensity; + szAirRpt.VentilVolumeStdDensity = szAirRpt.VentilVdotStdDensity * state.dataHVACGlobal->TimeStepSysSec; + + // szAirRpt%VentilFanElec = 0.0 + szAirRpt.VentilAirTemp = 0.0; + szAirRpt.VentilHeatLoss = 0.0; + szAirRpt.VentilHeatGain = 0.0; + int ventCount = 0; // Number of ventilation object per zone or space + Real64 VentZoneMassflow = 0.0; // Total mass flow rate per zone + Real64 VentZoneAirTemp = 0.0; // Average Zone inlet temperature + + for (int VentNum = 1; VentNum <= state.dataHeatBal->TotVentilation; ++VentNum) { + auto const &ventilation = state.dataHeatBal->Ventilation(VentNum); + if (((spaceNum == 0) && (ventilation.ZonePtr == zoneNum)) || ((spaceNum > 0) && (spaceNum == ventilation.spaceIndex))) { + if (ADSCorrectionFactor > 0) { + szAirRpt.VentilAirTemp += ventilation.AirTemp * ventilation.MCP; + VentZoneMassflow += ventilation.MCP; + VentZoneAirTemp += ventilation.AirTemp; + } else { + szAirRpt.VentilAirTemp = outDryBulb; } - } - - if (ADSCorrectionFactor > 0 && VentZoneNum > 1 && VentZoneMassflow > 0.0) { - znAirRpt.VentilAirTemp /= VentZoneMassflow; - } else if (ADSCorrectionFactor > 0 && VentZoneNum == 1) { - znAirRpt.VentilAirTemp = VentZoneAirTemp; - } else { // Just in case - znAirRpt.VentilAirTemp = zone.OutDryBulbTemp; - } - - // Report mixing sensible and latent loads - mixSenLoad = 0.0; // Initialize arrays to zero before starting to sum - mixLatLoad = 0.0; - znAirRpt.MixVolume = 0.0; // zero reported volume prior to summations below - znAirRpt.MixVdotCurDensity = 0.0; // zero reported volume flow rate prior to summations below - znAirRpt.MixVdotStdDensity = 0.0; // zero reported volume flow rate prior to summations below - znAirRpt.MixMass = 0.0; // ! zero reported mass prior to summations below - znAirRpt.MixMdot = 0.0; // ! zero reported mass flow rate prior to summations below - // MixingLoad = 0.0d0 - - for (int MixNum = 1; MixNum <= state.dataHeatBal->TotMixing; ++MixNum) { - auto &mixing = state.dataHeatBal->Mixing(MixNum); - if ((mixing.ZonePtr == ZoneLoop) && mixing.ReportFlag) { - auto const &fromZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(mixing.FromZone); - // MixSenLoad(ZoneLoop) = MixSenLoad(ZoneLoop)+MCPM(ZoneLoop)*MAT(mixing%FromZone) - // H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(ZoneAirHumRat(ZoneLoop), MAT(ZoneLoop)) - // Per Jan 17, 2008 conference call, agreed to use average conditions for Rho, Cp and Hfg - // and to recalculate the report variable using end of time step temps and humrats - AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, - state.dataEnvrn->OutBaroPress, - (thisZoneHB.MAT + fromZoneHB.MAT) / 2.0, - (thisZoneHB.airHumRat + fromZoneHB.airHumRat) / 2.0, - std::string()); - CpAir = Psychrometrics::PsyCpAirFnW((thisZoneHB.airHumRat + fromZoneHB.airHumRat) / 2.0); - znAirRpt.MixVolume += mixing.DesiredAirFlowRate * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.MixVdotCurDensity += mixing.DesiredAirFlowRate * ADSCorrectionFactor; - znAirRpt.MixMass += mixing.DesiredAirFlowRate * AirDensity * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.MixMdot += mixing.DesiredAirFlowRate * AirDensity * ADSCorrectionFactor; - znAirRpt.MixVdotStdDensity += mixing.DesiredAirFlowRate * (AirDensity / state.dataEnvrn->StdRhoAir) * ADSCorrectionFactor; - mixSenLoad += mixing.DesiredAirFlowRate * AirDensity * CpAir * (thisZoneHB.MAT - fromZoneHB.MAT); - H2OHtOfVap = - Psychrometrics::PsyHgAirFnWTdb((thisZoneHB.airHumRat + fromZoneHB.airHumRat) / 2.0, (thisZoneHB.MAT + fromZoneHB.MAT) / 2.0); - // MixLatLoad(ZoneLoop) = MixLatLoad(ZoneLoop)+MixingMassFlowzone*(ZoneAirHumRat(ZoneLoop)- & - // ZoneAirHumRat(mixing%FromZone))*H2OHtOfVap - mixLatLoad += mixing.DesiredAirFlowRate * AirDensity * (thisZoneHB.airHumRat - fromZoneHB.airHumRat) * H2OHtOfVap; + // Break the ventilation load into heat gain and loss components + if (szHeatBal.MAT > ventilation.AirTemp) { + szAirRpt.VentilHeatLoss += + ventilation.MCP * (szHeatBal.MAT - ventilation.AirTemp) * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + } else { + szAirRpt.VentilHeatGain += + ventilation.MCP * (ventilation.AirTemp - szHeatBal.MAT) * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; } - } - for (int MixNum = 1; MixNum <= state.dataHeatBal->TotCrossMixing; ++MixNum) { - auto &crossMixing = state.dataHeatBal->CrossMixing(MixNum); - if ((crossMixing.ZonePtr == ZoneLoop) && crossMixing.ReportFlag) { - auto const &fromZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(crossMixing.FromZone); - // MixSenLoad(ZoneLoop) = MixSenLoad(ZoneLoop)+MCPM(ZoneLoop)*MAT(crossMixing%FromZone) - // Per Jan 17, 2008 conference call, agreed to use average conditions for Rho, Cp and Hfg - // and to recalculate the report variable using end of time step temps and humrats - AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, - state.dataEnvrn->OutBaroPress, - (thisZoneHB.MAT + fromZoneHB.MAT) / 2.0, - (thisZoneHB.airHumRat + fromZoneHB.airHumRat) / 2.0, - std::string()); - CpAir = Psychrometrics::PsyCpAirFnW((thisZoneHB.airHumRat + fromZoneHB.airHumRat) / 2.0); - znAirRpt.MixVolume += crossMixing.DesiredAirFlowRate * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.MixVdotCurDensity += crossMixing.DesiredAirFlowRate * ADSCorrectionFactor; - znAirRpt.MixMass += crossMixing.DesiredAirFlowRate * AirDensity * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.MixMdot += crossMixing.DesiredAirFlowRate * AirDensity * ADSCorrectionFactor; - znAirRpt.MixVdotStdDensity += crossMixing.DesiredAirFlowRate * (AirDensity / state.dataEnvrn->StdRhoAir) * ADSCorrectionFactor; - mixSenLoad += crossMixing.DesiredAirFlowRate * AirDensity * CpAir * (thisZoneHB.MAT - fromZoneHB.MAT); - H2OHtOfVap = - Psychrometrics::PsyHgAirFnWTdb((thisZoneHB.airHumRat + fromZoneHB.airHumRat) / 2.0, (thisZoneHB.MAT + fromZoneHB.MAT) / 2.0); - // MixLatLoad(ZoneLoop) = MixLatLoad(ZoneLoop)+MixingMassFlowzone*(ZoneAirHumRat(ZoneLoop)- & - // ZoneAirHumRat(crossMixing%FromZone))*H2OHtOfVap - mixLatLoad += crossMixing.DesiredAirFlowRate * AirDensity * (thisZoneHB.airHumRat - fromZoneHB.airHumRat) * H2OHtOfVap; + ++ventCount; + if (ventCount > 1) continue; + + // Report ventilation latent gains and losses + H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(szHeatBal.airHumRat, szHeatBal.MAT); + if (szHeatBal.airHumRat > state.dataEnvrn->OutHumRat) { + szAirRpt.VentilLatentLoss = + szAirRpt.VentilMdot * (szHeatBal.airHumRat - state.dataEnvrn->OutHumRat) * H2OHtOfVap * state.dataHVACGlobal->TimeStepSysSec; + szAirRpt.VentilLatentGain = 0.0; + } else { + szAirRpt.VentilLatentGain = + szAirRpt.VentilMdot * (state.dataEnvrn->OutHumRat - szHeatBal.airHumRat) * H2OHtOfVap * state.dataHVACGlobal->TimeStepSysSec; + szAirRpt.VentilLatentLoss = 0.0; } - if ((crossMixing.FromZone == ZoneLoop) && crossMixing.ReportFlag) { - auto const &mixingZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(crossMixing.ZonePtr); - AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, - state.dataEnvrn->OutBaroPress, - (thisZoneHB.MAT + mixingZoneHB.MAT) / 2.0, - (thisZoneHB.airHumRat + mixingZoneHB.airHumRat) / 2.0, - std::string()); - CpAir = Psychrometrics::PsyCpAirFnW((thisZoneHB.airHumRat + mixingZoneHB.airHumRat) / 2.0); - znAirRpt.MixVolume += crossMixing.DesiredAirFlowRate * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.MixVdotCurDensity += crossMixing.DesiredAirFlowRate * ADSCorrectionFactor; - znAirRpt.MixMass += crossMixing.DesiredAirFlowRate * AirDensity * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.MixMdot += crossMixing.DesiredAirFlowRate * AirDensity * ADSCorrectionFactor; - znAirRpt.MixVdotStdDensity += crossMixing.DesiredAirFlowRate * (AirDensity / state.dataEnvrn->StdRhoAir) * ADSCorrectionFactor; - mixSenLoad += crossMixing.DesiredAirFlowRate * AirDensity * CpAir * (thisZoneHB.MAT - mixingZoneHB.MAT); - H2OHtOfVap = - Psychrometrics::PsyHgAirFnWTdb((thisZoneHB.airHumRat + mixingZoneHB.airHumRat) / 2.0, (thisZoneHB.MAT + mixingZoneHB.MAT) / 2.0); - mixLatLoad += crossMixing.DesiredAirFlowRate * AirDensity * (thisZoneHB.airHumRat - mixingZoneHB.airHumRat) * H2OHtOfVap; + // Total ventilation losses and gains + TotalLoad = szAirRpt.VentilHeatGain + szAirRpt.VentilLatentGain - szAirRpt.VentilHeatLoss - szAirRpt.VentilLatentLoss; + if (TotalLoad > 0) { + szAirRpt.VentilTotalGain = TotalLoad * ADSCorrectionFactor; + szAirRpt.VentilTotalLoss = 0.0; + } else { + szAirRpt.VentilTotalGain = 0.0; + szAirRpt.VentilTotalLoss = -TotalLoad * ADSCorrectionFactor; } } + } - if (state.dataHeatBal->TotRefDoorMixing > 0) { - // IF(ZoneLoop .NE. NumOfZones)THEN !Refrigeration Door Mixing - // Note - do each Pair a Single time, so must do increment reports for both zones - // Can't have a pair that has ZoneA zone number = NumOfZones because organized - // in input with lowest zone # first no matter how input in idf - auto &refDoorMixing = state.dataHeatBal->RefDoorMixing(ZoneLoop); - if (refDoorMixing.RefDoorMixFlag) { // .TRUE. for both zoneA and zoneB - if (refDoorMixing.ZonePtr == ZoneLoop) { - for (int j = 1; j <= refDoorMixing.NumRefDoorConnections; ++j) { - // Capture impact when zoneloop is the 'primary zone' - // that is, the zone of a pair with the lower zone number - if (refDoorMixing.VolRefDoorFlowRate(j) > 0.0) { - int ZoneB = refDoorMixing.MateZonePtr(j); - auto const &zoneBHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneB); - AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, - state.dataEnvrn->OutBaroPress, - (thisZoneHB.MAT + zoneBHB.MAT) / 2.0, - (thisZoneHB.airHumRat + zoneBHB.airHumRat) / 2.0, - std::string()); - CpAir = Psychrometrics::PsyCpAirFnW((thisZoneHB.airHumRat + zoneBHB.airHumRat) / 2.0); - H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb((thisZoneHB.airHumRat + zoneBHB.airHumRat) / 2.0, - (thisZoneHB.MAT + zoneBHB.MAT) / 2.0); - znAirRpt.MixVolume += refDoorMixing.VolRefDoorFlowRate(j) * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.MixVdotCurDensity += refDoorMixing.VolRefDoorFlowRate(j) * ADSCorrectionFactor; - znAirRpt.MixMass += refDoorMixing.VolRefDoorFlowRate(j) * AirDensity * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.MixMdot += refDoorMixing.VolRefDoorFlowRate(j) * AirDensity * ADSCorrectionFactor; - znAirRpt.MixVdotStdDensity += - refDoorMixing.VolRefDoorFlowRate(j) * (AirDensity / state.dataEnvrn->StdRhoAir) * ADSCorrectionFactor; - mixSenLoad += refDoorMixing.VolRefDoorFlowRate(j) * AirDensity * CpAir * (thisZoneHB.MAT - zoneBHB.MAT); - mixLatLoad += refDoorMixing.VolRefDoorFlowRate(j) * AirDensity * (thisZoneHB.airHumRat - zoneBHB.airHumRat) * H2OHtOfVap; - } // flow > 0 - } // J-1, numref connections - } // zone A (zoneptr = zoneloop) - for (int ZoneA = 1; ZoneA <= (ZoneLoop - 1); ++ZoneA) { - auto &refDoorMixingA = state.dataHeatBal->RefDoorMixing(ZoneA); - auto const &zoneAHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneA); - // Capture impact when zoneloop is the 'mating zone' - // that is, the zone of a pair with the higher zone number(matezoneptr = zoneloop) - if (refDoorMixingA.RefDoorMixFlag) { - for (int j = 1; j <= refDoorMixingA.NumRefDoorConnections; ++j) { - if (refDoorMixingA.MateZonePtr(j) == ZoneLoop) { - if (refDoorMixingA.VolRefDoorFlowRate(j) > 0.0) { - AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, - state.dataEnvrn->OutBaroPress, - (thisZoneHB.MAT + zoneAHB.MAT) / 2.0, - (thisZoneHB.airHumRat + zoneAHB.airHumRat) / 2.0, - std::string()); - CpAir = Psychrometrics::PsyCpAirFnW((thisZoneHB.airHumRat + zoneAHB.airHumRat) / 2.0); - H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb((thisZoneHB.airHumRat + zoneAHB.airHumRat) / 2.0, - (thisZoneHB.MAT + zoneAHB.MAT) / 2.0); - znAirRpt.MixVolume += refDoorMixingA.VolRefDoorFlowRate(j) * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.MixVdotCurDensity += refDoorMixingA.VolRefDoorFlowRate(j) * ADSCorrectionFactor; - znAirRpt.MixMass += refDoorMixingA.VolRefDoorFlowRate(j) * AirDensity * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.MixMdot += refDoorMixingA.VolRefDoorFlowRate(j) * AirDensity * ADSCorrectionFactor; - znAirRpt.MixVdotStdDensity += - refDoorMixingA.VolRefDoorFlowRate(j) * (AirDensity / state.dataEnvrn->StdRhoAir) * ADSCorrectionFactor; - mixSenLoad += refDoorMixingA.VolRefDoorFlowRate(j) * AirDensity * CpAir * (thisZoneHB.MAT - zoneAHB.MAT); - mixLatLoad += - refDoorMixingA.VolRefDoorFlowRate(j) * AirDensity * (thisZoneHB.airHumRat - zoneAHB.airHumRat) * H2OHtOfVap; - } // volflowrate > 0 - } // matezoneptr (zoneB) = Zonelooop - } // NumRefDoorConnections - } // Refdoormix flag on ZoneA - } // zone A from 1 to (zoneloop - 1) - } // Refdoormix flag on zoneloop - } //(TotRefDoorMixing .GT. 0) - // end refrigeration door mixing reports - - // MixingLoad(ZoneLoop) = MCPM(ZoneLoop)*MAT(ZoneLoop) - MixSenLoad(ZoneLoop) - if (mixSenLoad > 0.0) { - znAirRpt.MixHeatLoss = mixSenLoad * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.MixHeatGain = 0.0; - } else { - znAirRpt.MixHeatLoss = 0.0; - znAirRpt.MixHeatGain = -mixSenLoad * TimeStepSysSec * ADSCorrectionFactor; + if (ADSCorrectionFactor > 0 && ventCount > 1 && VentZoneMassflow > 0.0) { + szAirRpt.VentilAirTemp /= VentZoneMassflow; + } else if (ADSCorrectionFactor > 0 && ventCount == 1) { + szAirRpt.VentilAirTemp = VentZoneAirTemp; + } else { // Just in case + szAirRpt.VentilAirTemp = outDryBulb; + } + + // Report mixing sensible and latent loads + szAirRpt.MixSenLoad = 0.0; // Initialize arrays to zero before starting to sum + szAirRpt.MixLatLoad = 0.0; + szAirRpt.MixVolume = 0.0; // zero reported volume prior to summations below + szAirRpt.MixVdotCurDensity = 0.0; // zero reported volume flow rate prior to summations below + szAirRpt.MixVdotStdDensity = 0.0; // zero reported volume flow rate prior to summations below + szAirRpt.MixMass = 0.0; // ! zero reported mass prior to summations below + szAirRpt.MixMdot = 0.0; // ! zero reported mass flow rate prior to summations below + // MixingLoad = 0.0d0 + + for (int MixNum = 1; MixNum <= state.dataHeatBal->TotMixing; ++MixNum) { + auto &mixing = state.dataHeatBal->Mixing(MixNum); + if (mixing.ReportFlag && (((spaceNum == 0) && (mixing.ZonePtr == zoneNum)) || ((spaceNum > 0) && (spaceNum == mixing.spaceIndex)))) { + Real64 const fromMAT = (mixing.fromSpaceIndex == 0) ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(mixing.FromZone).MAT + : state.dataZoneTempPredictorCorrector->spaceHeatBalance(mixing.fromSpaceIndex).MAT; + Real64 const fromHumRat = (mixing.fromSpaceIndex == 0) + ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(mixing.FromZone).airHumRat + : state.dataZoneTempPredictorCorrector->spaceHeatBalance(mixing.fromSpaceIndex).airHumRat; + // szAirRpt.MixSenLoad(zoneNum) = szAirRpt.MixSenLoad(zoneNum)+MCPM(zoneNum)*MAT(mixing%FromZone) + // H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(ZoneAirHumRat(zoneNum), MAT(zoneNum)) + // Per Jan 17, 2008 conference call, agreed to use average conditions for Rho, Cp and Hfg + // and to recalculate the report variable using end of time step temps and humrats + AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW( + state, state.dataEnvrn->OutBaroPress, (szHeatBal.MAT + fromMAT) / 2.0, (szHeatBal.airHumRat + fromHumRat) / 2.0, std::string()); + CpAir = Psychrometrics::PsyCpAirFnW((szHeatBal.airHumRat + fromHumRat) / 2.0); + szAirRpt.MixVolume += mixing.DesiredAirFlowRate * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.MixVdotCurDensity += mixing.DesiredAirFlowRate * ADSCorrectionFactor; + szAirRpt.MixMass += mixing.DesiredAirFlowRate * AirDensity * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.MixMdot += mixing.DesiredAirFlowRate * AirDensity * ADSCorrectionFactor; + szAirRpt.MixVdotStdDensity += mixing.DesiredAirFlowRate * (AirDensity / state.dataEnvrn->StdRhoAir) * ADSCorrectionFactor; + szAirRpt.MixSenLoad += mixing.DesiredAirFlowRate * AirDensity * CpAir * (szHeatBal.MAT - fromMAT); + H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb((szHeatBal.airHumRat + fromHumRat) / 2.0, (szHeatBal.MAT + fromMAT) / 2.0); + // szAirRpt.MixLatLoad(zoneNum) = szAirRpt.MixLatLoad(zoneNum)+MixingMassFlowzone*(ZoneAirHumRat(zoneNum)- & + // ZoneAirHumRat(mixing%FromZone))*H2OHtOfVap + szAirRpt.MixLatLoad += mixing.DesiredAirFlowRate * AirDensity * (szHeatBal.airHumRat - fromHumRat) * H2OHtOfVap; } - // Report mixing latent loads - // MixingLoad(ZoneLoop) = MixLatLoad(ZoneLoop) - if (mixLatLoad > 0.0) { - znAirRpt.MixLatentLoss = mixLatLoad * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.MixLatentGain = 0.0; - } else { - znAirRpt.MixLatentLoss = 0.0; - znAirRpt.MixLatentGain = -mixLatLoad * TimeStepSysSec * ADSCorrectionFactor; + } + + for (int MixNum = 1; MixNum <= state.dataHeatBal->TotCrossMixing; ++MixNum) { + auto &crossMixing = state.dataHeatBal->CrossMixing(MixNum); + if (crossMixing.ReportFlag && + ((((spaceNum == 0) && (crossMixing.ZonePtr == zoneNum)) || (spaceNum > 0) && (spaceNum == crossMixing.spaceIndex)))) { + Real64 const fromMAT = (crossMixing.fromSpaceIndex == 0) + ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(crossMixing.FromZone).MAT + : state.dataZoneTempPredictorCorrector->spaceHeatBalance(crossMixing.fromSpaceIndex).MAT; + Real64 const fromHumRat = (crossMixing.fromSpaceIndex == 0) + ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(crossMixing.FromZone).airHumRat + : state.dataZoneTempPredictorCorrector->spaceHeatBalance(crossMixing.fromSpaceIndex).airHumRat; + // szAirRpt.MixSenLoad(zoneNum) = szAirRpt.MixSenLoad(zoneNum)+MCPM(zoneNum)*MAT(crossMixing%FromZone) + // Per Jan 17, 2008 conference call, agreed to use average conditions for Rho, Cp and Hfg + // and to recalculate the report variable using end of time step temps and humrats + AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW( + state, state.dataEnvrn->OutBaroPress, (szHeatBal.MAT + fromMAT) / 2.0, (szHeatBal.airHumRat + fromHumRat) / 2.0, std::string()); + CpAir = Psychrometrics::PsyCpAirFnW((szHeatBal.airHumRat + fromHumRat) / 2.0); + szAirRpt.MixVolume += crossMixing.DesiredAirFlowRate * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.MixVdotCurDensity += crossMixing.DesiredAirFlowRate * ADSCorrectionFactor; + szAirRpt.MixMass += crossMixing.DesiredAirFlowRate * AirDensity * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.MixMdot += crossMixing.DesiredAirFlowRate * AirDensity * ADSCorrectionFactor; + szAirRpt.MixVdotStdDensity += crossMixing.DesiredAirFlowRate * (AirDensity / state.dataEnvrn->StdRhoAir) * ADSCorrectionFactor; + szAirRpt.MixSenLoad += crossMixing.DesiredAirFlowRate * AirDensity * CpAir * (szHeatBal.MAT - fromMAT); + H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb((szHeatBal.airHumRat + fromHumRat) / 2.0, (szHeatBal.MAT + fromMAT) / 2.0); + // szAirRpt.MixLatLoad(zoneNum) = szAirRpt.MixLatLoad(zoneNum)+MixingMassFlowzone*(ZoneAirHumRat(zoneNum)- & + // ZoneAirHumRat(crossMixing%FromZone))*H2OHtOfVap + szAirRpt.MixLatLoad += crossMixing.DesiredAirFlowRate * AirDensity * (szHeatBal.airHumRat - fromHumRat) * H2OHtOfVap; } - // Total Mixing losses and gains - TotalLoad = znAirRpt.MixHeatGain + znAirRpt.MixLatentGain - znAirRpt.MixHeatLoss - znAirRpt.MixLatentLoss; - if (TotalLoad > 0) { - znAirRpt.MixTotalGain = TotalLoad * ADSCorrectionFactor; - znAirRpt.MixTotalLoss = 0.0; - } else { - znAirRpt.MixTotalGain = 0.0; - znAirRpt.MixTotalLoss = -TotalLoad * ADSCorrectionFactor; + if (crossMixing.ReportFlag && + (((spaceNum == 0) && (crossMixing.FromZone == zoneNum)) || ((spaceNum > 0) && (spaceNum == crossMixing.fromSpaceIndex)))) { + Real64 const mixingMAT = (crossMixing.spaceIndex == 0) + ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(crossMixing.ZonePtr).MAT + : state.dataZoneTempPredictorCorrector->spaceHeatBalance(crossMixing.spaceIndex).MAT; + Real64 const mixingHumRat = (crossMixing.fromSpaceIndex == 0) + ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(crossMixing.ZonePtr).airHumRat + : state.dataZoneTempPredictorCorrector->spaceHeatBalance(crossMixing.spaceIndex).airHumRat; + AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW( + state, state.dataEnvrn->OutBaroPress, (szHeatBal.MAT + mixingMAT) / 2.0, (szHeatBal.airHumRat + mixingHumRat) / 2.0, std::string()); + CpAir = Psychrometrics::PsyCpAirFnW((szHeatBal.airHumRat + mixingHumRat) / 2.0); + szAirRpt.MixVolume += crossMixing.DesiredAirFlowRate * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.MixVdotCurDensity += crossMixing.DesiredAirFlowRate * ADSCorrectionFactor; + szAirRpt.MixMass += crossMixing.DesiredAirFlowRate * AirDensity * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.MixMdot += crossMixing.DesiredAirFlowRate * AirDensity * ADSCorrectionFactor; + szAirRpt.MixVdotStdDensity += crossMixing.DesiredAirFlowRate * (AirDensity / state.dataEnvrn->StdRhoAir) * ADSCorrectionFactor; + szAirRpt.MixSenLoad += crossMixing.DesiredAirFlowRate * AirDensity * CpAir * (szHeatBal.MAT - mixingMAT); + H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb((szHeatBal.airHumRat + mixingHumRat) / 2.0, (szHeatBal.MAT + mixingMAT) / 2.0); + szAirRpt.MixLatLoad += crossMixing.DesiredAirFlowRate * AirDensity * (szHeatBal.airHumRat - mixingHumRat) * H2OHtOfVap; } + } - // Reporting combined outdoor air flows - for (int j = 1; j <= state.dataHeatBal->TotZoneAirBalance; ++j) { - if (state.dataHeatBal->ZoneAirBalance(j).BalanceMethod == DataHeatBalance::AirBalance::Quadrature && - ZoneLoop == state.dataHeatBal->ZoneAirBalance(j).ZonePtr) { - if (thisZoneHB.MAT > zone.OutDryBulbTemp) { - znAirRpt.OABalanceHeatLoss = thisZoneHB.MDotCPOA * (thisZoneHB.MAT - zone.OutDryBulbTemp) * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.OABalanceHeatGain = 0.0; - } else { - znAirRpt.OABalanceHeatLoss = 0.0; - znAirRpt.OABalanceHeatGain = -thisZoneHB.MDotCPOA * (thisZoneHB.MAT - zone.OutDryBulbTemp) * TimeStepSysSec * ADSCorrectionFactor; - } - H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(state.dataEnvrn->OutHumRat, zone.OutDryBulbTemp); - if (thisZoneHB.airHumRat > state.dataEnvrn->OutHumRat) { - znAirRpt.OABalanceLatentLoss = - thisZoneHB.MDotOA * (thisZoneHB.airHumRat - state.dataEnvrn->OutHumRat) * H2OHtOfVap * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.OABalanceLatentGain = 0.0; - } else { - znAirRpt.OABalanceLatentGain = - thisZoneHB.MDotOA * (state.dataEnvrn->OutHumRat - thisZoneHB.airHumRat) * H2OHtOfVap * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.OABalanceLatentLoss = 0.0; - } - // Total ventilation losses and gains - TotalLoad = znAirRpt.OABalanceHeatGain + znAirRpt.OABalanceLatentGain - znAirRpt.OABalanceHeatLoss - znAirRpt.OABalanceLatentLoss; - if (TotalLoad > 0) { - znAirRpt.OABalanceTotalGain = TotalLoad * ADSCorrectionFactor; - znAirRpt.OABalanceTotalLoss = 0.0; - } else { - znAirRpt.OABalanceTotalGain = 0.0; - znAirRpt.OABalanceTotalLoss = -TotalLoad * ADSCorrectionFactor; - } - znAirRpt.OABalanceMass = (thisZoneHB.MDotOA) * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.OABalanceMdot = (thisZoneHB.MDotOA) * ADSCorrectionFactor; - AirDensity = - Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, thisZoneHB.MAT, thisZoneHB.airHumRatAvg, std::string()); - znAirRpt.OABalanceVolumeCurDensity = (thisZoneHB.MDotOA / AirDensity) * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.OABalanceAirChangeRate = znAirRpt.OABalanceVolumeCurDensity / (TimeStepSys * zone.Volume); - znAirRpt.OABalanceVdotCurDensity = (thisZoneHB.MDotOA / AirDensity) * ADSCorrectionFactor; - AirDensity = state.dataEnvrn->StdRhoAir; - znAirRpt.OABalanceVolumeStdDensity = (thisZoneHB.MDotOA / AirDensity) * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.OABalanceVdotStdDensity = (thisZoneHB.MDotOA / AirDensity) * ADSCorrectionFactor; - znAirRpt.OABalanceFanElec = znAirRpt.VentilFanElec; - } - } - // Reports exfiltration loss - H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(state.dataEnvrn->OutHumRat, zone.OutDryBulbTemp); - znAirRpt.SysInletMass = 0; - znAirRpt.SysOutletMass = 0; - if (!zoneEquipConfig.IsControlled) { - for (int k = 1; k <= zoneEquipConfig.NumInletNodes; ++k) { - znAirRpt.SysInletMass += state.dataLoopNodes->Node(zoneEquipConfig.InletNode(k)).MassFlowRate * TimeStepSysSec * ADSCorrectionFactor; + if (state.dataHeatBal->TotRefDoorMixing > 0) { + // IF(zoneNum .NE. NumOfZones)THEN !Refrigeration Door Mixing + // Note - do each Pair a Single time, so must do increment reports for both zones + // Can't have a pair that has ZoneA zone number = NumOfZones because organized + // in input with lowest zone # first no matter how input in idf + auto &refDoorMixing = state.dataHeatBal->RefDoorMixing(zoneNum); + if (refDoorMixing.RefDoorMixFlag) { // .TRUE. for both zoneA and zoneB + if (((spaceNum == 0) && (refDoorMixing.ZonePtr == zoneNum)) || ((spaceNum > 0) && (spaceNum == refDoorMixing.spaceIndex))) { + for (int j = 1; j <= refDoorMixing.NumRefDoorConnections; ++j) { + // Capture impact when zoneNum is the 'primary zone' + // that is, the zone of a pair with the lower zone number + if (refDoorMixing.VolRefDoorFlowRate(j) > 0.0) { + // int ZoneB = refDoorMixing.MateZonePtr(j); + // auto const &zoneBHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneB); + Real64 const szBMAT = (refDoorMixing.fromSpaceIndex == 0) + ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(refDoorMixing.MateZonePtr(j)).MAT + : state.dataZoneTempPredictorCorrector->spaceHeatBalance(refDoorMixing.fromSpaceIndex).MAT; + Real64 const szBHumRat = (refDoorMixing.fromSpaceIndex == 0) + ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(refDoorMixing.MateZonePtr(j)).airHumRat + : state.dataZoneTempPredictorCorrector->spaceHeatBalance(refDoorMixing.fromSpaceIndex).airHumRat; + AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, + state.dataEnvrn->OutBaroPress, + (szHeatBal.MAT + szBMAT) / 2.0, + (szHeatBal.airHumRat + szBHumRat) / 2.0, + std::string()); + CpAir = Psychrometrics::PsyCpAirFnW((szHeatBal.airHumRat + szBHumRat) / 2.0); + H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb((szHeatBal.airHumRat + szBHumRat) / 2.0, (szHeatBal.MAT + szBMAT) / 2.0); + szAirRpt.MixVolume += refDoorMixing.VolRefDoorFlowRate(j) * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.MixVdotCurDensity += refDoorMixing.VolRefDoorFlowRate(j) * ADSCorrectionFactor; + szAirRpt.MixMass += + refDoorMixing.VolRefDoorFlowRate(j) * AirDensity * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.MixMdot += refDoorMixing.VolRefDoorFlowRate(j) * AirDensity * ADSCorrectionFactor; + szAirRpt.MixVdotStdDensity += + refDoorMixing.VolRefDoorFlowRate(j) * (AirDensity / state.dataEnvrn->StdRhoAir) * ADSCorrectionFactor; + szAirRpt.MixSenLoad += refDoorMixing.VolRefDoorFlowRate(j) * AirDensity * CpAir * (szHeatBal.MAT - szBMAT); + szAirRpt.MixLatLoad += refDoorMixing.VolRefDoorFlowRate(j) * AirDensity * (szHeatBal.airHumRat - szBHumRat) * H2OHtOfVap; + } // flow > 0 + } // J-1, numref connections + } // zone A (zoneptr = zoneNum) + for (int ZoneA = 1; ZoneA <= (zoneNum - 1); ++ZoneA) { + auto &refDoorMixingA = state.dataHeatBal->RefDoorMixing(ZoneA); + // Capture impact when zoneNum is the 'mating zone' + // that is, the zone of a pair with the higher zone number(matezoneptr = zoneNum) + if (refDoorMixingA.RefDoorMixFlag) { + for (int j = 1; j <= refDoorMixingA.NumRefDoorConnections; ++j) { + if (((spaceNum == 0) && (refDoorMixingA.MateZonePtr(j) == zoneNum)) || + ((spaceNum == 0) && (refDoorMixingA.fromSpaceIndex == spaceNum))) { + if (refDoorMixingA.VolRefDoorFlowRate(j) > 0.0) { + // auto const &zoneAHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneA); + Real64 const szAMAT = (refDoorMixingA.spaceIndex == 0) + ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(refDoorMixingA.ZonePtr).MAT + : state.dataZoneTempPredictorCorrector->spaceHeatBalance(refDoorMixingA.spaceIndex).MAT; + Real64 const szAHumRat = + (refDoorMixingA.spaceIndex == 0) + ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(refDoorMixingA.ZonePtr).airHumRat + : state.dataZoneTempPredictorCorrector->spaceHeatBalance(refDoorMixingA.spaceIndex).airHumRat; + AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, + state.dataEnvrn->OutBaroPress, + (szHeatBal.MAT + szAMAT) / 2.0, + (szHeatBal.airHumRat + szAHumRat) / 2.0, + std::string()); + CpAir = Psychrometrics::PsyCpAirFnW((szHeatBal.airHumRat + szAHumRat) / 2.0); + H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb((szHeatBal.airHumRat + szAHumRat) / 2.0, (szHeatBal.MAT + szAMAT) / 2.0); + szAirRpt.MixVolume += + refDoorMixingA.VolRefDoorFlowRate(j) * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.MixVdotCurDensity += refDoorMixingA.VolRefDoorFlowRate(j) * ADSCorrectionFactor; + szAirRpt.MixMass += + refDoorMixingA.VolRefDoorFlowRate(j) * AirDensity * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.MixMdot += refDoorMixingA.VolRefDoorFlowRate(j) * AirDensity * ADSCorrectionFactor; + szAirRpt.MixVdotStdDensity += + refDoorMixingA.VolRefDoorFlowRate(j) * (AirDensity / state.dataEnvrn->StdRhoAir) * ADSCorrectionFactor; + szAirRpt.MixSenLoad += refDoorMixingA.VolRefDoorFlowRate(j) * AirDensity * CpAir * (szHeatBal.MAT - szAMAT); + szAirRpt.MixLatLoad += + refDoorMixingA.VolRefDoorFlowRate(j) * AirDensity * (szHeatBal.airHumRat - szAHumRat) * H2OHtOfVap; + } // volflowrate > 0 + } // matezoneptr (zoneB) = Zonelooop + } // NumRefDoorConnections + } // Refdoormix flag on ZoneA + } // zone A from 1 to (zoneNum - 1) + } // Refdoormix flag on zoneNum + } //(TotRefDoorMixing .GT. 0) + // end refrigeration door mixing reports + + // MixingLoad(zoneNum) = MCPM(zoneNum)*MAT(zoneNum) - szAirRpt.MixSenLoad(zoneNum) + if (szAirRpt.MixSenLoad > 0.0) { + szAirRpt.MixHeatLoss = szAirRpt.MixSenLoad * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.MixHeatGain = 0.0; + } else { + szAirRpt.MixHeatLoss = 0.0; + szAirRpt.MixHeatGain = -szAirRpt.MixSenLoad * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + } + // Report mixing latent loads + // MixingLoad(zoneNum) = szAirRpt.MixLatLoad(zoneNum) + if (szAirRpt.MixLatLoad > 0.0) { + szAirRpt.MixLatentLoss = szAirRpt.MixLatLoad * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.MixLatentGain = 0.0; + } else { + szAirRpt.MixLatentLoss = 0.0; + szAirRpt.MixLatentGain = -szAirRpt.MixLatLoad * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + } + // Total Mixing losses and gains + TotalLoad = szAirRpt.MixHeatGain + szAirRpt.MixLatentGain - szAirRpt.MixHeatLoss - szAirRpt.MixLatentLoss; + if (TotalLoad > 0) { + szAirRpt.MixTotalGain = TotalLoad * ADSCorrectionFactor; + szAirRpt.MixTotalLoss = 0.0; + } else { + szAirRpt.MixTotalGain = 0.0; + szAirRpt.MixTotalLoss = -TotalLoad * ADSCorrectionFactor; + } + + // Reporting combined outdoor air flows + for (int j = 1; j <= state.dataHeatBal->TotZoneAirBalance; ++j) { + if (state.dataHeatBal->ZoneAirBalance(j).BalanceMethod == DataHeatBalance::AirBalance::Quadrature && + zoneNum == state.dataHeatBal->ZoneAirBalance(j).ZonePtr) { + if (szHeatBal.MAT > outDryBulb) { + szAirRpt.OABalanceHeatLoss = + szHeatBal.MDotCPOA * (szHeatBal.MAT - outDryBulb) * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.OABalanceHeatGain = 0.0; + } else { + szAirRpt.OABalanceHeatLoss = 0.0; + szAirRpt.OABalanceHeatGain = + -szHeatBal.MDotCPOA * (szHeatBal.MAT - outDryBulb) * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; } - for (int k = 1; k <= zoneEquipConfig.NumExhaustNodes; ++k) { - znAirRpt.SysOutletMass += - state.dataLoopNodes->Node(zoneEquipConfig.ExhaustNode(k)).MassFlowRate * TimeStepSysSec * ADSCorrectionFactor; + H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(state.dataEnvrn->OutHumRat, outDryBulb); + if (szHeatBal.airHumRat > state.dataEnvrn->OutHumRat) { + szAirRpt.OABalanceLatentLoss = szHeatBal.MDotOA * (szHeatBal.airHumRat - state.dataEnvrn->OutHumRat) * H2OHtOfVap * + state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.OABalanceLatentGain = 0.0; + } else { + szAirRpt.OABalanceLatentGain = szHeatBal.MDotOA * (state.dataEnvrn->OutHumRat - szHeatBal.airHumRat) * H2OHtOfVap * + state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.OABalanceLatentLoss = 0.0; } - for (int k = 1; k <= zoneEquipConfig.NumReturnNodes; ++k) { - znAirRpt.SysOutletMass += - state.dataLoopNodes->Node(zoneEquipConfig.ReturnNode(k)).MassFlowRate * TimeStepSysSec * ADSCorrectionFactor; + // Total ventilation losses and gains + TotalLoad = szAirRpt.OABalanceHeatGain + szAirRpt.OABalanceLatentGain - szAirRpt.OABalanceHeatLoss - szAirRpt.OABalanceLatentLoss; + if (TotalLoad > 0) { + szAirRpt.OABalanceTotalGain = TotalLoad * ADSCorrectionFactor; + szAirRpt.OABalanceTotalLoss = 0.0; + } else { + szAirRpt.OABalanceTotalGain = 0.0; + szAirRpt.OABalanceTotalLoss = -TotalLoad * ADSCorrectionFactor; } + szAirRpt.OABalanceMass = (szHeatBal.MDotOA) * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.OABalanceMdot = (szHeatBal.MDotOA) * ADSCorrectionFactor; + AirDensity = + Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, szHeatBal.MAT, szHeatBal.airHumRatAvg, std::string()); + szAirRpt.OABalanceVolumeCurDensity = (szHeatBal.MDotOA / AirDensity) * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.OABalanceAirChangeRate = szAirRpt.OABalanceVolumeCurDensity / (state.dataHVACGlobal->TimeStepSys * szVolume); + szAirRpt.OABalanceVdotCurDensity = (szHeatBal.MDotOA / AirDensity) * ADSCorrectionFactor; + AirDensity = state.dataEnvrn->StdRhoAir; + szAirRpt.OABalanceVolumeStdDensity = (szHeatBal.MDotOA / AirDensity) * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.OABalanceVdotStdDensity = (szHeatBal.MDotOA / AirDensity) * ADSCorrectionFactor; + szAirRpt.OABalanceFanElec = szAirRpt.VentilFanElec; } + } + // Reports exfiltration loss + H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(state.dataEnvrn->OutHumRat, outDryBulb); + szAirRpt.SysInletMass = 0; + szAirRpt.SysOutletMass = 0; + if (!szEquipConfig.IsControlled) { + for (int k = 1; k <= szEquipConfig.NumInletNodes; ++k) { + szAirRpt.SysInletMass += + state.dataLoopNodes->Node(szEquipConfig.InletNode(k)).MassFlowRate * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + } + for (int k = 1; k <= szEquipConfig.NumExhaustNodes; ++k) { + szAirRpt.SysOutletMass += + state.dataLoopNodes->Node(szEquipConfig.ExhaustNode(k)).MassFlowRate * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + } + for (int k = 1; k <= szEquipConfig.NumReturnNodes; ++k) { + szAirRpt.SysOutletMass += + state.dataLoopNodes->Node(szEquipConfig.ReturnNode(k)).MassFlowRate * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + } + } - znAirRpt.ExfilMass = znAirRpt.InfilMass + znAirRpt.VentilMass + znAirRpt.MixMass + znAirRpt.OABalanceMass + znAirRpt.SysInletMass - - znAirRpt.SysOutletMass; // kg - // I am not happy with these un-parenthesized divisions and multiplications. Someone clean this up. - znAirRpt.ExfilSensiLoss = znAirRpt.ExfilMass / TimeStepSysSec * (thisZoneHB.MAT - zone.OutDryBulbTemp) * CpAir; // W - znAirRpt.ExfilLatentLoss = znAirRpt.ExfilMass / TimeStepSysSec * (thisZoneHB.airHumRat - state.dataEnvrn->OutHumRat) * H2OHtOfVap; - znAirRpt.ExfilTotalLoss = znAirRpt.ExfilLatentLoss + znAirRpt.ExfilSensiLoss; - - state.dataHeatBal->ZoneTotalExfiltrationHeatLoss += znAirRpt.ExfilTotalLoss * TimeStepSysSec; - state.dataHeatBal->ZoneTotalExhaustHeatLoss += znAirRpt.ExhTotalLoss * TimeStepSysSec; + szAirRpt.ExfilMass = + szAirRpt.InfilMass + szAirRpt.VentilMass + szAirRpt.MixMass + szAirRpt.OABalanceMass + szAirRpt.SysInletMass - szAirRpt.SysOutletMass; // kg + // I am not happy with these un-parenthesized divisions and multiplications. Someone clean this up. + szAirRpt.ExfilSensiLoss = szAirRpt.ExfilMass / state.dataHVACGlobal->TimeStepSysSec * (szHeatBal.MAT - outDryBulb) * CpAir; // W + szAirRpt.ExfilLatentLoss = + szAirRpt.ExfilMass / state.dataHVACGlobal->TimeStepSysSec * (szHeatBal.airHumRat - state.dataEnvrn->OutHumRat) * H2OHtOfVap; + szAirRpt.ExfilTotalLoss = szAirRpt.ExfilLatentLoss + szAirRpt.ExfilSensiLoss; + + // Accumulate only for zones + if (spaceNum == 0) { + state.dataHeatBal->ZoneTotalExfiltrationHeatLoss += szAirRpt.ExfilTotalLoss * state.dataHVACGlobal->TimeStepSysSec; + state.dataHeatBal->ZoneTotalExhaustHeatLoss += szAirRpt.ExhTotalLoss * state.dataHVACGlobal->TimeStepSysSec; } } @@ -2742,19 +2806,12 @@ void SetHeatToReturnAirFlag(EnergyPlusData &state) for (int AirLoopNum = 1; AirLoopNum <= NumPrimaryAirSys; ++AirLoopNum) { auto &airLoopControlInfo = state.dataAirLoop->AirLoopControlInfo(AirLoopNum); - if (airLoopControlInfo.UnitarySys) { // for unitary systems check the cycling fan schedule - if (airLoopControlInfo.CycFanSchedPtr > 0) { - Real64 CycFanMaxVal = ScheduleManager::GetScheduleMaxValue(state, airLoopControlInfo.CycFanSchedPtr); - if (CycFanMaxVal > 0.0) { - airLoopControlInfo.AnyContFan = true; - } else { - airLoopControlInfo.AnyContFan = false; - } - } else { // no schedule means always cycling fan - airLoopControlInfo.AnyContFan = false; - } - } else { // for nonunitary (central) all systems are continuous fan + if (!airLoopControlInfo.UnitarySys) { // for nonunitary (central) all systems are continuous fan airLoopControlInfo.AnyContFan = true; + } else if (airLoopControlInfo.cycFanSched != nullptr) { // for unitary systems check the cycling fan schedule + airLoopControlInfo.AnyContFan = (airLoopControlInfo.cycFanSched->getMaxVal(state) > 0.0); + } else { // no schedule means always cycling fan + airLoopControlInfo.AnyContFan = false; } } // check to see if a controlled zone is served exclusively by a zonal system @@ -2779,9 +2836,8 @@ void SetHeatToReturnAirFlag(EnergyPlusData &state) for (int zoneInNode = 1; zoneInNode <= zoneEquipConfig.NumInletNodes; ++zoneInNode) { int AirLoopNum = zoneEquipConfig.InletNodeAirLoopNum(zoneInNode); if (AirLoopNum > 0) { - if (state.dataAirLoop->AirLoopControlInfo(AirLoopNum).CycFanSchedPtr > 0) { - CyclingFan = - ScheduleManager::CheckScheduleValue(state, state.dataAirLoop->AirLoopControlInfo(AirLoopNum).CycFanSchedPtr, 0.0); + if (state.dataAirLoop->AirLoopControlInfo(AirLoopNum).cycFanSched != nullptr) { + CyclingFan = state.dataAirLoop->AirLoopControlInfo(AirLoopNum).cycFanSched->hasVal(state, 0.0); } } } @@ -2820,12 +2876,8 @@ void SetHeatToReturnAirFlag(EnergyPlusData &state) // set the air loop fan operation mode for (int AirLoopNum = 1; AirLoopNum <= NumPrimaryAirSys; ++AirLoopNum) { auto &airLoopControlInfo = state.dataAirLoop->AirLoopControlInfo(AirLoopNum); - if (airLoopControlInfo.CycFanSchedPtr > 0) { - if (ScheduleManager::GetCurrentScheduleValue(state, airLoopControlInfo.CycFanSchedPtr) == 0.0) { - airLoopControlInfo.fanOp = HVAC::FanOp::Cycling; - } else { - airLoopControlInfo.fanOp = HVAC::FanOp::Continuous; - } + if (airLoopControlInfo.cycFanSched != nullptr) { + airLoopControlInfo.fanOp = (airLoopControlInfo.cycFanSched->getCurrentVal() == 0.0) ? HVAC::FanOp::Cycling : HVAC::FanOp::Continuous; } } // set the zone level NoHeatToReturnAir flag diff --git a/src/EnergyPlus/HVACManager.hh b/src/EnergyPlus/HVACManager.hh index 89d35831ceb..38db7ed9f32 100644 --- a/src/EnergyPlus/HVACManager.hh +++ b/src/EnergyPlus/HVACManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -54,6 +54,7 @@ // EnergyPlus Headers #include #include +#include namespace EnergyPlus { @@ -105,6 +106,19 @@ namespace HVACManager { void ReportAirHeatBalance(EnergyPlusData &state); + void reportAirHeatBal1(EnergyPlusData &state, + DataHeatBalance::AirReportVars &szAirRpt, + DataZoneEquipment::EquipConfiguration const &szEquipConfig, + int const zoneNum, + int const spaceNum = 0); + + void reportAirHeatBal2(EnergyPlusData &state, + DataHeatBalance::AirReportVars &szAirRpt, + DataZoneEquipment::EquipConfiguration const &szEquipConfig, + ZoneTempPredictorCorrector::ZoneSpaceHeatBalanceData const &szHeatBal, + int const zoneNum, + int const spaceNum = 0); + void SetHeatToReturnAirFlag(EnergyPlusData &state); void UpdateZoneInletConvergenceLog(EnergyPlusData &state); @@ -128,7 +142,6 @@ struct HVACManagerData : BaseGlobalStruct int RepIterAir = 0; bool SimHVACIterSetup = false; bool TriggerGetAFN = true; - bool ReportAirHeatBalanceFirstTimeFlag = true; bool MyOneTimeFlag = true; bool PrintedWarmup = false; bool MyEnvrnFlag = true; @@ -140,8 +153,10 @@ struct HVACManagerData : BaseGlobalStruct int ErrCount = 0; // Number of times that the maximum iterations was exceeded int MaxErrCount = 0; std::string ErrEnvironmentName; - Array1D MixSenLoad; // Mixing sensible loss or gain - Array1D MixLatLoad; // Mixing latent loss or gain + + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } void init_state([[maybe_unused]] EnergyPlusData &state) override { diff --git a/src/EnergyPlus/HVACMultiSpeedHeatPump.cc b/src/EnergyPlus/HVACMultiSpeedHeatPump.cc index ea4fc8c7ee4..319e0740bff 100644 --- a/src/EnergyPlus/HVACMultiSpeedHeatPump.cc +++ b/src/EnergyPlus/HVACMultiSpeedHeatPump.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -104,7 +104,7 @@ namespace HVACMultiSpeedHeatPump { // EnergyPlus. // Module currently models air-cooled or evap-cooled direct expansion systems - // (split or packaged) with mulptiple speeds. Air-side performance is modeled to determine + // (split or packaged) with multiple speeds. Air-side performance is modeled to determine // coil discharge air conditions. The module also determines the DX unit's energy // usage. Neither the air-side performance nor the energy usage includes the effect // of supply air fan heat/energy usage. The supply air fan is modeled by other modules. @@ -121,8 +121,6 @@ namespace HVACMultiSpeedHeatPump { Num }; - static constexpr std::string_view fluidNameSteam("STEAM"); - void SimMSHeatPump(EnergyPlusData &state, std::string_view CompName, // Name of the unitary engine driven heat pump system bool const FirstHVACIteration, // TRUE if 1st HVAC simulation of system time step @@ -194,7 +192,7 @@ namespace HVACMultiSpeedHeatPump { int const MSHeatPumpNum, // number of the current engine driven Heat Pump being simulated bool const FirstHVACIteration, // TRUE if 1st HVAC simulation of system timestep int const AirLoopNum, // air loop index - Real64 &QSensUnitOut, // cooling/heating deliveded to zones [W] + Real64 &QSensUnitOut, // cooling/heating delivered to zones [W] Real64 const QZnReq, // required zone load Real64 &OnOffAirFlowRatio // ratio of compressor ON airflow to AVERAGE airflow over timestep ) @@ -222,7 +220,7 @@ namespace HVACMultiSpeedHeatPump { int OutletNode; // MSHP air outlet node int InletNode; // MSHP air inlet node Real64 AirMassFlow; // air mass flow rate [kg/s] - HVAC::FanOp fanOp; // operating mode (fan cycling or continious; DX coil always cycles) + HVAC::FanOp fanOp; // operating mode (fan cycling or continuous; DX coil always cycles) int ZoneNum; // Controlled zone number Real64 QTotUnitOut; int SpeedNum; // Speed number @@ -484,7 +482,6 @@ namespace HVACMultiSpeedHeatPump { int TotalArgs(0); // Total number of alpha and numeric arguments (max) for a // certain object in the input file bool errFlag; - int SteamIndex; // steam coil steam inlet density Real64 SteamDensity; // density of steam at 100C auto &MSHeatPump(state.dataHVACMultiSpdHP->MSHeatPump); @@ -547,16 +544,10 @@ namespace HVACMultiSpeedHeatPump { ErrorObjectHeader eoh{routineName, state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name}; if (lAlphaBlanks(2)) { - thisMSHP.AvaiSchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisMSHP.AvaiSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); - if (thisMSHP.AvaiSchedPtr == 0) { - ShowSevereError( - state, - format( - "{}, \"{}\" {} not found: {}", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name, cAlphaFields(2), Alphas(2))); - ErrorsFound = true; - } + thisMSHP.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisMSHP.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } thisMSHP.AirInletNodeName = Alphas(3); @@ -680,24 +671,22 @@ namespace HVACMultiSpeedHeatPump { thisMSHP.fanPlace = static_cast(getEnumValue(HVAC::fanPlaceNamesUC, Alphas(8))); assert(thisMSHP.fanPlace != HVAC::FanPlace::Invalid); - thisMSHP.FanSchedule = Alphas(9); - thisMSHP.FanSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(9)); - if (thisMSHP.FanSchedPtr == 0) { - ShowSevereError( - state, - format("{}, \"{}\" {} not found: {}", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name, cAlphaFields(9), Alphas(9))); + if ((thisMSHP.fanOpModeSched = Sched::GetSchedule(state, Alphas(9))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(9), Alphas(9)); ErrorsFound = true; } - if (thisMSHP.FanSchedPtr > 0 && thisMSHP.fanType == HVAC::FanType::Constant) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, thisMSHP.FanSchedPtr, ">", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{} \"{}\"", state.dataHVACMultiSpdHP->CurrentModuleObject, thisMSHP.Name)); - ShowContinueError(state, - format("{} must be continuous (fan operating mode schedule values > 0) for {} = Fan:ConstantVolume.", - cAlphaFields(9), - cAlphaFields(6))); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFields(9), Alphas(9))); - ShowContinueError(state, "schedule values must be (>0., <=1.)"); + if (thisMSHP.fanOpModeSched != nullptr && thisMSHP.fanType == HVAC::FanType::Constant) { + if (!thisMSHP.fanOpModeSched->checkMinMaxVals(state, Clusive::Ex, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, + eoh, + cAlphaFields(9), + Alphas(9), + Clusive::Ex, + 0.0, + Clusive::In, + 1.0, + "Fan mode must be continuous (schedule values > 0) for Fan:ConstantVolume."); ErrorsFound = true; } } @@ -852,7 +841,7 @@ namespace HVACMultiSpeedHeatPump { ErrorsFound = true; } - // Get the lemental Heating Coil Inlet Node + // Get the supplemental Heating Coil Inlet Node errFlag = false; HeatingCoilInletNode = WaterCoils::GetCoilInletNode(state, "Coil:Heating:Water", thisMSHP.HeatCoilName, errFlag); thisMSHP.CoilAirInletNode = HeatingCoilInletNode; @@ -861,7 +850,7 @@ namespace HVACMultiSpeedHeatPump { ErrorsFound = true; } - // Get the lemental Heating Coil Outlet Node + // Get the supplemental Heating Coil Outlet Node errFlag = false; HeatingCoilOutletNode = WaterCoils::GetCoilOutletNode(state, "Coil:Heating:Water", thisMSHP.HeatCoilName, errFlag); if (errFlag) { @@ -895,7 +884,7 @@ namespace HVACMultiSpeedHeatPump { ErrorsFound = true; } - // Get the lemental Heating Coil steam inlet node number + // Get the supplemental Heating Coil steam inlet node number errFlag = false; thisMSHP.CoilControlNode = SteamCoils::GetCoilAirOutletNode(state, "Coil:Heating:Steam", thisMSHP.HeatCoilName, errFlag); if (errFlag) { @@ -903,16 +892,14 @@ namespace HVACMultiSpeedHeatPump { ErrorsFound = true; } - // Get the lemental Heating Coil steam max volume flow rate + // Get the supplemental Heating Coil steam max volume flow rate thisMSHP.MaxCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, thisMSHP.HeatCoilNum, errFlag); if (thisMSHP.MaxCoilFluidFlow > 0.0) { - SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed - SteamDensity = FluidProperties::GetSatDensityRefrig( - state, fluidNameSteam, state.dataHVACMultiSpdHP->TempSteamIn, 1.0, SteamIndex, routineName); + SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, state.dataHVACMultiSpdHP->TempSteamIn, 1.0, routineName); thisMSHP.MaxCoilFluidFlow *= SteamDensity; } - // Get the lemental Heating Coil Inlet Node + // Get the supplemental Heating Coil Inlet Node errFlag = false; HeatingCoilInletNode = SteamCoils::GetCoilAirInletNode(state, thisMSHP.HeatCoilNum, thisMSHP.HeatCoilName, errFlag); thisMSHP.CoilAirInletNode = HeatingCoilInletNode; @@ -921,7 +908,7 @@ namespace HVACMultiSpeedHeatPump { ErrorsFound = true; } - // Get the lemental Heating Coil Outlet Node + // Get the supplemental Heating Coil Outlet Node errFlag = false; HeatingCoilOutletNode = SteamCoils::GetCoilAirOutletNode(state, thisMSHP.HeatCoilNum, thisMSHP.HeatCoilName, errFlag); if (errFlag) { @@ -1178,9 +1165,7 @@ namespace HVACMultiSpeedHeatPump { // Get the Supplemental Heating Coil steam max volume flow rate thisMSHP.MaxSuppCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, thisMSHP.SuppHeatCoilNum, errFlag); if (thisMSHP.MaxSuppCoilFluidFlow > 0.0) { - SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed - SteamDensity = FluidProperties::GetSatDensityRefrig( - state, fluidNameSteam, state.dataHVACMultiSpdHP->TempSteamIn, 1.0, SteamIndex, routineName); + SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, state.dataHVACMultiSpdHP->TempSteamIn, 1.0, routineName); thisMSHP.MaxSuppCoilFluidFlow *= SteamDensity; } @@ -1288,7 +1273,7 @@ namespace HVACMultiSpeedHeatPump { ErrorsFound = true; } BranchNodeConnections::TestCompSet( - state, state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1), Alphas(16), Alphas(17), "MSHP Heat receovery Nodes"); + state, state.dataHVACMultiSpdHP->CurrentModuleObject, Alphas(1), Alphas(16), Alphas(17), "MSHP Heat Recovery Nodes"); DXCoils::SetMSHPDXCoilHeatRecoveryFlag(state, thisMSHP.DXCoolCoilIndex); if (thisMSHP.DXHeatCoilIndex > 0) { DXCoils::SetMSHPDXCoilHeatRecoveryFlag(state, thisMSHP.DXHeatCoilIndex); @@ -1846,11 +1831,8 @@ namespace HVACMultiSpeedHeatPump { WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", MSHeatPump(MSHeatPumpNum).HeatCoilName, ErrorsFound); if (MSHeatPump(MSHeatPumpNum).MaxCoilFluidFlow > 0.0) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(MSHeatPump(MSHeatPumpNum).plantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(MSHeatPump(MSHeatPumpNum).plantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(MSHeatPump(MSHeatPumpNum).plantLoc.loopNum) + .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); MSHeatPump(MSHeatPumpNum).MaxCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", MSHeatPump(MSHeatPumpNum).HeatCoilName, ErrorsFound) * rho; } @@ -1877,10 +1859,7 @@ namespace HVACMultiSpeedHeatPump { MSHeatPump(MSHeatPumpNum).MaxCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, MSHeatPump(MSHeatPumpNum).HeatCoilNum, ErrorsFound); if (MSHeatPump(MSHeatPumpNum).MaxCoilFluidFlow > 0.0) { - int SteamIndex = - 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed // TODO: Why do you want to re-look this up? - SteamDensity = FluidProperties::GetSatDensityRefrig( - state, fluidNameSteam, state.dataHVACMultiSpdHP->TempSteamIn, 1.0, SteamIndex, RoutineName); + SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, state.dataHVACMultiSpdHP->TempSteamIn, 1.0, RoutineName); MSHeatPump(MSHeatPumpNum).MaxCoilFluidFlow *= SteamDensity; } @@ -1908,11 +1887,8 @@ namespace HVACMultiSpeedHeatPump { WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", MSHeatPump(MSHeatPumpNum).SuppHeatCoilName, ErrorsFound); if (MSHeatPump(MSHeatPumpNum).MaxSuppCoilFluidFlow > 0.0) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(MSHeatPump(MSHeatPumpNum).SuppPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(MSHeatPump(MSHeatPumpNum).SuppPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(MSHeatPump(MSHeatPumpNum).SuppPlantLoc.loopNum) + .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); MSHeatPump(MSHeatPumpNum).MaxSuppCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", MSHeatPump(MSHeatPumpNum).SuppHeatCoilName, ErrorsFound) * rho; @@ -1940,9 +1916,7 @@ namespace HVACMultiSpeedHeatPump { MSHeatPump(MSHeatPumpNum).MaxSuppCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, MSHeatPump(MSHeatPumpNum).SuppHeatCoilNum, ErrorsFound); if (MSHeatPump(MSHeatPumpNum).MaxSuppCoilFluidFlow > 0.0) { - int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed - SteamDensity = FluidProperties::GetSatDensityRefrig( - state, fluidNameSteam, state.dataHVACMultiSpdHP->TempSteamIn, 1.0, SteamIndex, RoutineName); + SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, state.dataHVACMultiSpdHP->TempSteamIn, 1.0, RoutineName); MSHeatPump(MSHeatPumpNum).MaxSuppCoilFluidFlow *= SteamDensity; } @@ -1961,7 +1935,7 @@ namespace HVACMultiSpeedHeatPump { MSHeatPump(MSHeatPumpNum).FlowFraction = 1.0; MSHeatPump(MSHeatPumpNum).MySizeFlag = false; // Pass the fan cycling schedule index up to the air loop. Set the air loop unitary system flag. - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).CycFanSchedPtr = MSHeatPump(MSHeatPumpNum).FanSchedPtr; + state.dataAirLoop->AirLoopControlInfo(AirLoopNum).cycFanSched = MSHeatPump(MSHeatPumpNum).fanOpModeSched; state.dataAirLoop->AirLoopControlInfo(AirLoopNum).UnitarySys = true; state.dataAirLoop->AirLoopControlInfo(AirLoopNum).UnitarySysSimulating = false; // affects child coil sizing by allowing coil to size itself instead of parent telling coil what size to use @@ -2063,11 +2037,8 @@ namespace HVACMultiSpeedHeatPump { if ((MSHeatPump(MSHeatPumpNum).HeatRecActive) && (!MSHeatPump(MSHeatPumpNum).MyPlantScantFlag)) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(MSHeatPump(MSHeatPumpNum).HRPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(MSHeatPump(MSHeatPumpNum).HRPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(MSHeatPump(MSHeatPumpNum).HRPlantLoc.loopNum) + .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); MSHeatPump(MSHeatPumpNum).DesignHeatRecMassFlowRate = MSHeatPump(MSHeatPumpNum).DesignHeatRecFlowRate * rho; @@ -2086,11 +2057,8 @@ namespace HVACMultiSpeedHeatPump { CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", MSHeatPump(MSHeatPumpNum).HeatCoilName, ErrorsFound); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(MSHeatPump(MSHeatPumpNum).plantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(MSHeatPump(MSHeatPumpNum).plantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(MSHeatPump(MSHeatPumpNum).plantLoc.loopNum) + .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); MSHeatPump(MSHeatPumpNum).MaxCoilFluidFlow = CoilMaxVolFlowRate * rho; } PlantUtilities::InitComponentNodes(state, @@ -2110,9 +2078,7 @@ namespace HVACMultiSpeedHeatPump { CoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate(state, MSHeatPump(MSHeatPumpNum).HeatCoilNum, ErrorsFound); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed - SteamDensity = FluidProperties::GetSatDensityRefrig( - state, fluidNameSteam, state.dataHVACMultiSpdHP->TempSteamIn, 1.0, SteamIndex, RoutineName); + SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, state.dataHVACMultiSpdHP->TempSteamIn, 1.0, RoutineName); MSHeatPump(MSHeatPumpNum).MaxCoilFluidFlow = CoilMaxVolFlowRate * SteamDensity; } PlantUtilities::InitComponentNodes(state, @@ -2132,12 +2098,8 @@ namespace HVACMultiSpeedHeatPump { CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", MSHeatPump(MSHeatPumpNum).SuppHeatCoilName, ErrorsFound); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - rho = FluidProperties::GetDensityGlycol( - state, - state.dataPlnt->PlantLoop(MSHeatPump(MSHeatPumpNum).SuppPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(MSHeatPump(MSHeatPumpNum).SuppPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(MSHeatPump(MSHeatPumpNum).SuppPlantLoc.loopNum) + .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); MSHeatPump(MSHeatPumpNum).MaxSuppCoilFluidFlow = CoilMaxVolFlowRate * rho; } PlantUtilities::InitComponentNodes(state, @@ -2157,9 +2119,7 @@ namespace HVACMultiSpeedHeatPump { CoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate(state, MSHeatPump(MSHeatPumpNum).SuppHeatCoilNum, ErrorsFound); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed - SteamDensity = FluidProperties::GetSatDensityRefrig( - state, fluidNameSteam, state.dataHVACMultiSpdHP->TempSteamIn, 1.0, SteamIndex, RoutineName); + SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, state.dataHVACMultiSpdHP->TempSteamIn, 1.0, RoutineName); MSHeatPump(MSHeatPumpNum).MaxSuppCoilFluidFlow = CoilMaxVolFlowRate * SteamDensity; } PlantUtilities::InitComponentNodes(state, @@ -2283,15 +2243,12 @@ namespace HVACMultiSpeedHeatPump { } } - if (MSHeatPump(MSHeatPumpNum).FanSchedPtr > 0) { - if (ScheduleManager::GetCurrentScheduleValue(state, MSHeatPump(MSHeatPumpNum).FanSchedPtr) == 0.0) { - MSHeatPump(MSHeatPumpNum).fanOp = HVAC::FanOp::Cycling; - } else { - MSHeatPump(MSHeatPumpNum).fanOp = HVAC::FanOp::Continuous; - } + if (MSHeatPump(MSHeatPumpNum).fanOpModeSched != nullptr) { + MSHeatPump(MSHeatPumpNum).fanOp = + (MSHeatPump(MSHeatPumpNum).fanOpModeSched->getCurrentVal() == 0.0) ? HVAC::FanOp::Cycling : HVAC::FanOp::Continuous; } - // Calcuate air distribution losses + // Calculate air distribution losses if (!FirstHVACIteration && state.dataHVACMultiSpdHP->AirLoopPass == 1) { int ZoneInNode = MSHeatPump(MSHeatPumpNum).ZoneInletNode; DeltaMassRate = state.dataLoopNodes->Node(OutNode).MassFlowRate - @@ -2406,8 +2363,7 @@ namespace HVACMultiSpeedHeatPump { } // Set the inlet node mass flow rate - if (ScheduleManager::GetCurrentScheduleValue(state, MSHeatPump(MSHeatPumpNum).AvaiSchedPtr) > 0.0 && - state.dataHVACMultiSpdHP->CompOnMassFlow != 0.0) { + if (MSHeatPump(MSHeatPumpNum).availSched->getCurrentVal() > 0.0 && state.dataHVACMultiSpdHP->CompOnMassFlow != 0.0) { OnOffAirFlowRatio = 1.0; if (FirstHVACIteration) { state.dataLoopNodes->Node(MSHeatPump(MSHeatPumpNum).AirInletNodeNum).MassFlowRate = state.dataHVACMultiSpdHP->CompOnMassFlow; @@ -2428,10 +2384,9 @@ namespace HVACMultiSpeedHeatPump { } // Check availability of DX coils - if (ScheduleManager::GetCurrentScheduleValue(state, MSHeatPump(MSHeatPumpNum).AvaiSchedPtr) > 0.0) { - int CoilAvailSchPtr; // DX coil availability schedule pointer + if (MSHeatPump(MSHeatPumpNum).availSched->getCurrentVal() > 0.0) { if (MSHeatPump(MSHeatPumpNum).HeatCoolMode == ModeOfOperation::CoolingMode) { - CoilAvailSchPtr = DXCoils::GetDXCoilAvailSchPtr( // TODO: Why isn't this stored on the struct? + auto *coilAvailSched = DXCoils::GetDXCoilAvailSched( // TODO: Why isn't this stored on the struct? state, "Coil:Cooling:DX:MultiSpeed", MSHeatPump(MSHeatPumpNum).DXCoolCoilName, @@ -2440,7 +2395,7 @@ namespace HVACMultiSpeedHeatPump { if (ErrorsFound) { ShowFatalError(state, "InitMSHeatPump, The previous error causes termination."); } - if (ScheduleManager::GetCurrentScheduleValue(state, CoilAvailSchPtr) == 0.0) { + if (coilAvailSched->getCurrentVal() == 0.0) { if (MSHeatPump(MSHeatPumpNum).CoolCountAvail == 0) { ++MSHeatPump(MSHeatPumpNum).CoolCountAvail; ShowWarningError( @@ -2448,30 +2403,29 @@ namespace HVACMultiSpeedHeatPump { format("{} is ready to perform cooling, but its DX cooling coil = {} is not available at Available Schedule = {}.", MSHeatPump(MSHeatPumpNum).Name, MSHeatPump(MSHeatPumpNum).DXCoolCoilName, - ScheduleManager::GetScheduleName(state, CoilAvailSchPtr))); - ShowContinueErrorTimeStamp( - state, format("Availability schedule returned={:.1R}", ScheduleManager::GetCurrentScheduleValue(state, CoilAvailSchPtr))); + coilAvailSched->Name)); + ShowContinueErrorTimeStamp(state, format("Availability schedule returned={:.1R}", coilAvailSched->getCurrentVal())); } else { ++MSHeatPump(MSHeatPumpNum).CoolCountAvail; ShowRecurringWarningErrorAtEnd(state, MSHeatPump(MSHeatPumpNum).Name + ": Cooling coil is still not available ...", MSHeatPump(MSHeatPumpNum).CoolIndexAvail, - ScheduleManager::GetCurrentScheduleValue(state, CoilAvailSchPtr), - ScheduleManager::GetCurrentScheduleValue(state, CoilAvailSchPtr)); + coilAvailSched->getCurrentVal(), + coilAvailSched->getCurrentVal()); } } } if (MSHeatPump(MSHeatPumpNum).HeatCoolMode == ModeOfOperation::HeatingMode && MSHeatPump(MSHeatPumpNum).HeatCoilType == MultiSpeedHeatingCoil) { - CoilAvailSchPtr = DXCoils::GetDXCoilAvailSchPtr(state, - "Coil:Heating:DX:MultiSpeed", - MSHeatPump(MSHeatPumpNum).DXHeatCoilName, - ErrorsFound, - MSHeatPump(MSHeatPumpNum).DXHeatCoilIndex); + auto *coilAvailSched = DXCoils::GetDXCoilAvailSched(state, + "Coil:Heating:DX:MultiSpeed", + MSHeatPump(MSHeatPumpNum).DXHeatCoilName, + ErrorsFound, + MSHeatPump(MSHeatPumpNum).DXHeatCoilIndex); if (ErrorsFound) { ShowFatalError(state, "InitMSHeatPump, The previous error causes termination."); } - if (ScheduleManager::GetCurrentScheduleValue(state, CoilAvailSchPtr) == 0.0) { + if (coilAvailSched->getCurrentVal() == 0.0) { if (MSHeatPump(MSHeatPumpNum).HeatCountAvail == 0) { ++MSHeatPump(MSHeatPumpNum).HeatCountAvail; ShowWarningError( @@ -2479,16 +2433,15 @@ namespace HVACMultiSpeedHeatPump { format("{} is ready to perform heating, but its DX heating coil = {} is not available at Available Schedule = {}.", MSHeatPump(MSHeatPumpNum).Name, MSHeatPump(MSHeatPumpNum).DXCoolCoilName, - ScheduleManager::GetScheduleName(state, CoilAvailSchPtr))); - ShowContinueErrorTimeStamp( - state, format("Availability schedule returned={:.1R}", ScheduleManager::GetCurrentScheduleValue(state, CoilAvailSchPtr))); + coilAvailSched->Name)); + ShowContinueErrorTimeStamp(state, format("Availability schedule returned={:.1R}", coilAvailSched->getCurrentVal())); } else { ++MSHeatPump(MSHeatPumpNum).HeatCountAvail; ShowRecurringWarningErrorAtEnd(state, MSHeatPump(MSHeatPumpNum).Name + ": Heating coil is still not available ...", MSHeatPump(MSHeatPumpNum).HeatIndexAvail, - ScheduleManager::GetCurrentScheduleValue(state, CoilAvailSchPtr), - ScheduleManager::GetCurrentScheduleValue(state, CoilAvailSchPtr)); + coilAvailSched->getCurrentVal(), + coilAvailSched->getCurrentVal()); } } } @@ -2521,7 +2474,7 @@ namespace HVACMultiSpeedHeatPump { } // If unit is scheduled OFF, setpoint is equal to inlet node temperature. //!!LKL Discrepancy with < 0 - if (ScheduleManager::GetCurrentScheduleValue(state, MSHeatPump(MSHeatPumpNum).AvaiSchedPtr) == 0.0) { + if (MSHeatPump(MSHeatPumpNum).availSched->getCurrentVal() == 0.0) { state.dataLoopNodes->Node(OutNode).Temp = state.dataLoopNodes->Node(InNode).Temp; return; } @@ -2918,7 +2871,7 @@ namespace HVACMultiSpeedHeatPump { HVAC::CompressorOp const compressorOp, // compressor operation; 1=on, 0=off HVAC::FanOp const fanOp, // operating mode: FanOp::Cycling | FanOp::Continuous Real64 const QZnReq, // cooling or heating output needed by zone [W] - int const EMSOutput, // unit full output when compressor is operating [W]vvvv + int const EMSOutput, // unit full output when compressor is operating [W] int const SpeedNum, // Speed number Real64 SpeedRatio, // unit speed ratio for DX coils Real64 PartLoadFrac, // unit part load fraction @@ -3026,7 +2979,7 @@ namespace HVACMultiSpeedHeatPump { auto &MSHeatPump = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum); //!!LKL Discrepancy with < 0 - if (ScheduleManager::GetCurrentScheduleValue(state, MSHeatPump.AvaiSchedPtr) == 0.0) return; + if (MSHeatPump.availSched->getCurrentVal() == 0.0) return; // Get result when DX coil is off CalcMSHeatPump(state, @@ -3186,7 +3139,7 @@ namespace HVACMultiSpeedHeatPump { } } - // Coolling + // Cooling if (QZnReq < (-1.0 * HVAC::SmallLoad) && QZnReq > FullOutput) { CalcMSHeatPump( state, MSHeatPumpNum, FirstHVACIteration, compressorOp, 1, 0.0, 0.0, TempOutput0, QZnReq, OnOffAirFlowRatio, SupHeaterLoad); @@ -3605,7 +3558,7 @@ namespace HVACMultiSpeedHeatPump { // DATE WRITTEN: June 2007 // PURPOSE OF THIS SUBROUTINE: - // This routine will calcultes MSHP performance based on given system load + // This routine will calculates MSHP performance based on given system load // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int OutletNode; // MSHP air outlet node @@ -3616,7 +3569,7 @@ namespace HVACMultiSpeedHeatPump { Real64 SaveSpeedRatio; Real64 QCoilActual; // coil load actually delivered returned to calling component Real64 MinWaterFlow; // minimum water flow rate - Real64 ErrorToler; // supplemental heating coil convergence tollerance + Real64 ErrorToler; // supplemental heating coil convergence tolerance auto &MSHeatPump = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum); @@ -3936,9 +3889,10 @@ namespace HVACMultiSpeedHeatPump { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 HeatRecOutletTemp; // Heat reclaim outlet temp [C] + auto &mshp = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum); // Begin routine - int HeatRecInNode = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).HeatRecInletNodeNum; - int HeatRecOutNode = state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).HeatRecOutletNodeNum; + int HeatRecInNode = mshp.HeatRecInletNodeNum; + int HeatRecOutNode = mshp.HeatRecOutletNodeNum; // Inlet node to the heat recovery heat exchanger Real64 HeatRecInletTemp = state.dataLoopNodes->Node(HeatRecInNode).Temp; @@ -3950,16 +3904,11 @@ namespace HVACMultiSpeedHeatPump { if (HeatRecMassFlowRate > 0.0) { // Heat reclaim water inlet specific heat [J/kg-K] - Real64 CpHeatRec = FluidProperties::GetSpecificHeatGlycol( - state, - state.dataPlnt->PlantLoop(state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).HRPlantLoc.loopNum).FluidName, - HeatRecInletTemp, - state.dataPlnt->PlantLoop(state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).HRPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpHeatRec = state.dataPlnt->PlantLoop(mshp.HRPlantLoc.loopNum).glycol->getSpecificHeat(state, HeatRecInletTemp, RoutineName); HeatRecOutletTemp = QHeatRec / (HeatRecMassFlowRate * CpHeatRec) + HeatRecInletTemp; - if (HeatRecOutletTemp > state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).MaxHeatRecOutletTemp) { - HeatRecOutletTemp = max(HeatRecInletTemp, state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).MaxHeatRecOutletTemp); + if (HeatRecOutletTemp > mshp.MaxHeatRecOutletTemp) { + HeatRecOutletTemp = max(HeatRecInletTemp, mshp.MaxHeatRecOutletTemp); QHeatRec = HeatRecMassFlowRate * CpHeatRec * (HeatRecOutletTemp - HeatRecInletTemp); } } else { @@ -3971,10 +3920,10 @@ namespace HVACMultiSpeedHeatPump { // changed outputs state.dataLoopNodes->Node(HeatRecOutNode).Temp = HeatRecOutletTemp; - state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).HeatRecoveryRate = QHeatRec; - state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).HeatRecoveryInletTemp = HeatRecInletTemp; - state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).HeatRecoveryOutletTemp = HeatRecOutletTemp; - state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).HeatRecoveryMassFlowRate = HeatRecMassFlowRate; + mshp.HeatRecoveryRate = QHeatRec; + mshp.HeatRecoveryInletTemp = HeatRecInletTemp; + mshp.HeatRecoveryOutletTemp = HeatRecOutletTemp; + mshp.HeatRecoveryMassFlowRate = HeatRecMassFlowRate; } void SetAverageAirFlow(EnergyPlusData &state, @@ -4085,7 +4034,7 @@ namespace HVACMultiSpeedHeatPump { } //!!LKL Discrepancy with > 0 - if (ScheduleManager::GetCurrentScheduleValue(state, state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).AvaiSchedPtr) == 0.0) { + if (state.dataHVACMultiSpdHP->MSHeatPump(MSHeatPumpNum).availSched->getCurrentVal() == 0.0) { state.dataLoopNodes->Node(InletNode).MassFlowRate = 0.0; OnOffAirFlowRatio = 0.0; } else { diff --git a/src/EnergyPlus/HVACMultiSpeedHeatPump.hh b/src/EnergyPlus/HVACMultiSpeedHeatPump.hh index 975d4e91fb6..fc524dba094 100644 --- a/src/EnergyPlus/HVACMultiSpeedHeatPump.hh +++ b/src/EnergyPlus/HVACMultiSpeedHeatPump.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -97,101 +97,99 @@ namespace HVACMultiSpeedHeatPump { { // Members // Some variables in this type are arrays (dimension=MaxSpeed) to support the number of speeds - std::string Name; // Name of the engine driven heat pump - std::string AvaiSchedule; // Availability Schedule name - int AvaiSchedPtr; // Pointer to the correct schedule - int AirInletNodeNum; // Node number of the heat pump air inlet - int AirOutletNodeNum; // Node number of the heat pump air inlet - std::string AirInletNodeName; // Node name of the heat pump air inlet - std::string AirOutletNodeName; // Node name of the heat pump air outlet - int ControlZoneNum; // Controlling zone or thermostat location - int ZoneSequenceCoolingNum; // Index to cooling sequence/priority for this zone - int ZoneSequenceHeatingNum; // Index to heating sequence/priority for this zone - std::string ControlZoneName; // Controlled zone name - int NodeNumOfControlledZone; // Controlled zone node number - Real64 FlowFraction; // Fraction of the total volume flow that goes through the controlling zone - std::string FanName; // Name of supply air fan - HVAC::FanType fanType; // Supply fan type - int FanNum; // Supply fan number - HVAC::FanPlace fanPlace; // Supply air fan placement: 1 Blow through; 2 Draw through - int FanInletNode; // Fan Inlet node - int FanOutletNode; // Fan Outlet node - Real64 FanVolFlow; // Supply fan volumetric flow rate - std::string FanSchedule; // Supply air fan operating mode schedule name - int FanSchedPtr; // Pointer to the Supply air fan operating mode schedule - HVAC::FanOp fanOp = HVAC::FanOp::Invalid; // mode of operation; 1=cycling fan, cycling compressor; 2=continuous fan, cycling compresor - std::string DXHeatCoilName; // COIL:DX:MultiSpeed:Heating name - int HeatCoilType; // Heating coil type: 1 COIL:DX:MultiSpeed:Heating only - int HeatCoilNum; // Heating coil number - int DXHeatCoilIndex; // DX heating coil index number - std::string HeatCoilName; // Coil:Electric:MultiSpeed:Heating OR Coil:Gas:MultiSpeed:Heating name - int HeatCoilIndex; // heating coil index number (Coil:Electric:MultiSpeed:Heating OR Coil:Gas:MultiSpeed:Heating) - std::string DXCoolCoilName; // COIL:DX:MultiSpeed:Cooling name - int CoolCoilType; // Cooling coil type: 1 COIL:DX:MultiSpeed:Cooling only - int DXCoolCoilIndex; // DX cooling coil index number - std::string SuppHeatCoilName; // Supplymental heating coil name - int SuppHeatCoilType; // Supplymental heating coil type: 1 Gas; 2 Electric; 3 Recovery - int SuppHeatCoilNum; // Supplymental heating coil number - Real64 DesignSuppHeatingCapacity; // Supplemental heating coil design capacity - Real64 SuppMaxAirTemp; // Maximum supply air temperature from supplemental heater - Real64 SuppMaxOATemp; // Maximum outdoor dry-bulb temperature for supplemental heater operation - Real64 AuxOnCyclePower; // Auxiliary On-Cycle Electric Power - Real64 AuxOffCyclePower; // Auxiliary Off-Cycle Electric Power - Real64 DesignHeatRecFlowRate; // Design water volume flow rate through heat recovery loop [m3/s] - bool HeatRecActive; // True when entered Heat Rec Vol Flow Rate > 0 - std::string HeatRecName; // heat recovery water inlet name - int HeatRecInletNodeNum; // Node number on heat recovery water inlet - int HeatRecOutletNodeNum; // Node number on heat recovery water outlet - Real64 MaxHeatRecOutletTemp; // Maximum outlet water temperature for heat recovery - Real64 DesignHeatRecMassFlowRate; // Design water mass flow rate through heat recovery loop [kg/s] - PlantLocation HRPlantLoc; // plant loop component for heat recovery - Real64 AuxElecPower; // Auxiliary Electric Power - Real64 IdleVolumeAirRate; // Supply air volumetric flow rate when no cooling or heating is needed - Real64 IdleMassFlowRate; // Supply air mass flow rate when no cooling or heating is needed - Real64 IdleSpeedRatio; // Fan speed ratio in idle mode - int NumOfSpeedCooling; // The number of speeds for cooling - int NumOfSpeedHeating; // The number of speeds for heating - Array1D HeatVolumeFlowRate; // Supply air volume flow rate during heating operation - Array1D HeatMassFlowRate; // Supply air mass flow rate during heating operation - Array1D CoolVolumeFlowRate; // Supply air volume flow rate during cooling operation - Array1D CoolMassFlowRate; // Supply air mass flow rate during cooling operation - Array1D HeatingSpeedRatio; // Fan speed ratio in heating mode - Array1D CoolingSpeedRatio; // Fan speed ratio in cooling mode - bool CheckFanFlow; // Supply airflow check - ModeOfOperation LastMode; // MSHP operation mode - ModeOfOperation HeatCoolMode; // System operating mode (0 = floating, 1 = cooling, 2 = heating) - int AirLoopNumber; // Air loop served by the engine driven heat pump system - int NumControlledZones; // Number of controlled zones for this system - int ZoneInletNode; // Zone inlet node number in the controlled zone - Real64 CompPartLoadRatio; // Compressor part load ratio - Real64 FanPartLoadRatio; // Fan part load ratio - Real64 TotCoolEnergyRate; // Total cooling enertgy rate - Real64 TotHeatEnergyRate; // Total heating enertgy rate - Real64 SensCoolEnergyRate; // Sensible cooling enertgy rate - Real64 SensHeatEnergyRate; // Sensible heating enertgy rate - Real64 LatCoolEnergyRate; // Latent cooling enertgy rate - Real64 LatHeatEnergyRate; // Latent heating enertgy rate - Real64 ElecPower; // Electric power (fan + supplemental electric coil) - Real64 LoadMet; // met system load - Real64 HeatRecoveryRate; // Heat recovery rate [W] - Real64 HeatRecoveryInletTemp; // Inlet temperature for heat recovery rate [C] - Real64 HeatRecoveryOutletTemp; // Outlet temperature for heat recovery rate [C] - Real64 HeatRecoveryMassFlowRate; // Mass flow rate for heat recovery rate [kg/s] - AirflowControl AirFlowControl; // fan control mode, UseCompressorOnFlow or UseCompressorOffFlow - int ErrIndexCyc; // Error index at low speed - int ErrIndexVar; // Error index at high speed - Real64 LoadLoss; // Air distribution system loss - int SuppCoilAirInletNode; // air inlet node number of supplemental heating coil - int SuppCoilAirOutletNode; // air outlet node number of supplemental heating coil - int SuppHeatCoilType_Num; // Numeric Equivalent for Supplemental Heat Coil Type - int SuppHeatCoilIndex; // Index to supplemental heater - int SuppCoilControlNode; // control node for simple water and steam heating coil - Real64 MaxSuppCoilFluidFlow; // water or steam mass flow rate for supplemental heating coil [kg/s] - int SuppCoilOutletNode; // outlet node for hot water and steam supplemental heating coil - int CoilAirInletNode; // air inlet node number of supplemental heating coil - int CoilControlNode; // control node for simple water and steam heating coil - Real64 MaxCoilFluidFlow; // water or steam mass flow rate for supplemental heating coil [kg/s] - int CoilOutletNode; // outlet node for hot water and steam supplemental heating coil + std::string Name; // Name of the engine driven heat pump + Sched::Schedule *availSched = nullptr; // availability schedule + int AirInletNodeNum; // Node number of the heat pump air inlet + int AirOutletNodeNum; // Node number of the heat pump air inlet + std::string AirInletNodeName; // Node name of the heat pump air inlet + std::string AirOutletNodeName; // Node name of the heat pump air outlet + int ControlZoneNum; // Controlling zone or thermostat location + int ZoneSequenceCoolingNum; // Index to cooling sequence/priority for this zone + int ZoneSequenceHeatingNum; // Index to heating sequence/priority for this zone + std::string ControlZoneName; // Controlled zone name + int NodeNumOfControlledZone; // Controlled zone node number + Real64 FlowFraction; // Fraction of the total volume flow that goes through the controlling zone + std::string FanName; // Name of supply air fan + HVAC::FanType fanType; // Supply fan type + int FanNum; // Supply fan number + HVAC::FanPlace fanPlace; // Supply air fan placement: 1 Blow through; 2 Draw through + int FanInletNode; // Fan Inlet node + int FanOutletNode; // Fan Outlet node + Real64 FanVolFlow; // Supply fan volumetric flow rate + Sched::Schedule *fanOpModeSched = nullptr; // Supply air fan operating mode schedule + HVAC::FanOp fanOp = HVAC::FanOp::Invalid; // mode of operation; 1=cycling fan, cycling compressor; 2=continuous fan, cycling compresor + std::string DXHeatCoilName; // COIL:DX:MultiSpeed:Heating name + int HeatCoilType; // Heating coil type: 1 COIL:DX:MultiSpeed:Heating only + int HeatCoilNum; // Heating coil number + int DXHeatCoilIndex; // DX heating coil index number + std::string HeatCoilName; // Coil:Electric:MultiSpeed:Heating OR Coil:Gas:MultiSpeed:Heating name + int HeatCoilIndex; // heating coil index number (Coil:Electric:MultiSpeed:Heating OR Coil:Gas:MultiSpeed:Heating) + std::string DXCoolCoilName; // COIL:DX:MultiSpeed:Cooling name + int CoolCoilType; // Cooling coil type: 1 COIL:DX:MultiSpeed:Cooling only + int DXCoolCoilIndex; // DX cooling coil index number + std::string SuppHeatCoilName; // Supplymental heating coil name + int SuppHeatCoilType; // Supplymental heating coil type: 1 Gas; 2 Electric; 3 Recovery + int SuppHeatCoilNum; // Supplymental heating coil number + Real64 DesignSuppHeatingCapacity; // Supplemental heating coil design capacity + Real64 SuppMaxAirTemp; // Maximum supply air temperature from supplemental heater + Real64 SuppMaxOATemp; // Maximum outdoor dry-bulb temperature for supplemental heater operation + Real64 AuxOnCyclePower; // Auxiliary On-Cycle Electric Power + Real64 AuxOffCyclePower; // Auxiliary Off-Cycle Electric Power + Real64 DesignHeatRecFlowRate; // Design water volume flow rate through heat recovery loop [m3/s] + bool HeatRecActive; // True when entered Heat Rec Vol Flow Rate > 0 + std::string HeatRecName; // heat recovery water inlet name + int HeatRecInletNodeNum; // Node number on heat recovery water inlet + int HeatRecOutletNodeNum; // Node number on heat recovery water outlet + Real64 MaxHeatRecOutletTemp; // Maximum outlet water temperature for heat recovery + Real64 DesignHeatRecMassFlowRate; // Design water mass flow rate through heat recovery loop [kg/s] + PlantLocation HRPlantLoc; // plant loop component for heat recovery + Real64 AuxElecPower; // Auxiliary Electric Power + Real64 IdleVolumeAirRate; // Supply air volumetric flow rate when no cooling or heating is needed + Real64 IdleMassFlowRate; // Supply air mass flow rate when no cooling or heating is needed + Real64 IdleSpeedRatio; // Fan speed ratio in idle mode + int NumOfSpeedCooling; // The number of speeds for cooling + int NumOfSpeedHeating; // The number of speeds for heating + Array1D HeatVolumeFlowRate; // Supply air volume flow rate during heating operation + Array1D HeatMassFlowRate; // Supply air mass flow rate during heating operation + Array1D CoolVolumeFlowRate; // Supply air volume flow rate during cooling operation + Array1D CoolMassFlowRate; // Supply air mass flow rate during cooling operation + Array1D HeatingSpeedRatio; // Fan speed ratio in heating mode + Array1D CoolingSpeedRatio; // Fan speed ratio in cooling mode + bool CheckFanFlow; // Supply airflow check + ModeOfOperation LastMode; // MSHP operation mode + ModeOfOperation HeatCoolMode; // System operating mode (0 = floating, 1 = cooling, 2 = heating) + int AirLoopNumber; // Air loop served by the engine driven heat pump system + int NumControlledZones; // Number of controlled zones for this system + int ZoneInletNode; // Zone inlet node number in the controlled zone + Real64 CompPartLoadRatio; // Compressor part load ratio + Real64 FanPartLoadRatio; // Fan part load ratio + Real64 TotCoolEnergyRate; // Total cooling enertgy rate + Real64 TotHeatEnergyRate; // Total heating enertgy rate + Real64 SensCoolEnergyRate; // Sensible cooling enertgy rate + Real64 SensHeatEnergyRate; // Sensible heating enertgy rate + Real64 LatCoolEnergyRate; // Latent cooling enertgy rate + Real64 LatHeatEnergyRate; // Latent heating enertgy rate + Real64 ElecPower; // Electric power (fan + supplemental electric coil) + Real64 LoadMet; // met system load + Real64 HeatRecoveryRate; // Heat recovery rate [W] + Real64 HeatRecoveryInletTemp; // Inlet temperature for heat recovery rate [C] + Real64 HeatRecoveryOutletTemp; // Outlet temperature for heat recovery rate [C] + Real64 HeatRecoveryMassFlowRate; // Mass flow rate for heat recovery rate [kg/s] + AirflowControl AirFlowControl; // fan control mode, UseCompressorOnFlow or UseCompressorOffFlow + int ErrIndexCyc; // Error index at low speed + int ErrIndexVar; // Error index at high speed + Real64 LoadLoss; // Air distribution system loss + int SuppCoilAirInletNode; // air inlet node number of supplemental heating coil + int SuppCoilAirOutletNode; // air outlet node number of supplemental heating coil + int SuppHeatCoilType_Num; // Numeric Equivalent for Supplemental Heat Coil Type + int SuppHeatCoilIndex; // Index to supplemental heater + int SuppCoilControlNode; // control node for simple water and steam heating coil + Real64 MaxSuppCoilFluidFlow; // water or steam mass flow rate for supplemental heating coil [kg/s] + int SuppCoilOutletNode; // outlet node for hot water and steam supplemental heating coil + int CoilAirInletNode; // air inlet node number of supplemental heating coil + int CoilControlNode; // control node for simple water and steam heating coil + Real64 MaxCoilFluidFlow; // water or steam mass flow rate for supplemental heating coil [kg/s] + int CoilOutletNode; // outlet node for hot water and steam supplemental heating coil int HotWaterCoilControlNode; int HotWaterCoilOutletNode; std::string HotWaterCoilName; @@ -223,11 +221,11 @@ namespace HVACMultiSpeedHeatPump { // Default Constructor MSHeatPumpData() - : AvaiSchedPtr(0), AirInletNodeNum(0), AirOutletNodeNum(0), ControlZoneNum(0), ZoneSequenceCoolingNum(0), ZoneSequenceHeatingNum(0), + : AirInletNodeNum(0), AirOutletNodeNum(0), ControlZoneNum(0), ZoneSequenceCoolingNum(0), ZoneSequenceHeatingNum(0), NodeNumOfControlledZone(0), FlowFraction(0.0), fanType(HVAC::FanType::Invalid), FanNum(0), fanPlace(HVAC::FanPlace::Invalid), - FanInletNode(0), FanOutletNode(0), FanVolFlow(0.0), FanSchedPtr(0), HeatCoilType(0), HeatCoilNum(0), DXHeatCoilIndex(0), - HeatCoilIndex(0), CoolCoilType(0), DXCoolCoilIndex(0), SuppHeatCoilType(0), SuppHeatCoilNum(0), DesignSuppHeatingCapacity(0.0), - SuppMaxAirTemp(0.0), SuppMaxOATemp(0.0), AuxOnCyclePower(0.0), AuxOffCyclePower(0.0), DesignHeatRecFlowRate(0.0), HeatRecActive(false), + FanInletNode(0), FanOutletNode(0), FanVolFlow(0.0), HeatCoilType(0), HeatCoilNum(0), DXHeatCoilIndex(0), HeatCoilIndex(0), + CoolCoilType(0), DXCoolCoilIndex(0), SuppHeatCoilType(0), SuppHeatCoilNum(0), DesignSuppHeatingCapacity(0.0), SuppMaxAirTemp(0.0), + SuppMaxOATemp(0.0), AuxOnCyclePower(0.0), AuxOffCyclePower(0.0), DesignHeatRecFlowRate(0.0), HeatRecActive(false), HeatRecInletNodeNum(0), HeatRecOutletNodeNum(0), MaxHeatRecOutletTemp(0.0), DesignHeatRecMassFlowRate(0.0), HRPlantLoc{}, AuxElecPower(0.0), IdleVolumeAirRate(0.0), IdleMassFlowRate(0.0), IdleSpeedRatio(0.0), NumOfSpeedCooling(0), NumOfSpeedHeating(0), CheckFanFlow(true), LastMode(ModeOfOperation::Invalid), HeatCoolMode(ModeOfOperation::Invalid), AirLoopNumber(0), NumControlledZones(0), @@ -418,6 +416,10 @@ struct HVACMultiSpeedHeatPumpData : BaseGlobalStruct std::string HeatCoilName; // TODO: What's the best plan here? + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/HVACSingleDuctInduc.cc b/src/EnergyPlus/HVACSingleDuctInduc.cc index 5d1ece65db0..bae7dd26852 100644 --- a/src/EnergyPlus/HVACSingleDuctInduc.cc +++ b/src/EnergyPlus/HVACSingleDuctInduc.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -197,6 +197,7 @@ namespace HVACSingleDuctInduc { // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetIndUnits "); // include trailing blank space + static constexpr std::string_view routineName = "GetIndUnits"; Array1D_string Alphas; // Alpha input items for object Array1D_string cAlphaFields; // Alpha field names @@ -244,29 +245,20 @@ namespace HVACSingleDuctInduc { cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + int IUNum = IUIndex; Util::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound); state.dataHVACSingleDuctInduc->IndUnit(IUNum).Name = Alphas(1); state.dataHVACSingleDuctInduc->IndUnit(IUNum).UnitType = CurrentModuleObject; state.dataHVACSingleDuctInduc->IndUnit(IUNum).UnitType_Num = SingleDuct_CV::FourPipeInduc; - state.dataHVACSingleDuctInduc->IndUnit(IUNum).Sched = Alphas(2); + if (lAlphaBlanks(2)) { - state.dataHVACSingleDuctInduc->IndUnit(IUNum).SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - state.dataHVACSingleDuctInduc->IndUnit(IUNum).SchedPtr = - ScheduleManager::GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (state.dataHVACSingleDuctInduc->IndUnit(IUNum).SchedPtr == 0) { - ShowSevereError(state, - format("{}{}: invalid {} entered ={} for {}={}", - RoutineName, - CurrentModuleObject, - cAlphaFields(2), - Alphas(2), - cAlphaFields(1), - Alphas(1))); - ErrorsFound = true; - } + state.dataHVACSingleDuctInduc->IndUnit(IUNum).availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((state.dataHVACSingleDuctInduc->IndUnit(IUNum).availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } state.dataHVACSingleDuctInduc->IndUnit(IUNum).MaxTotAirVolFlow = Numbers(1); state.dataHVACSingleDuctInduc->IndUnit(IUNum).InducRatio = Numbers(2); @@ -621,12 +613,8 @@ namespace HVACSingleDuctInduc { int HotConNode = state.dataHVACSingleDuctInduc->IndUnit(IUNum).HWControlNode; if (HotConNode > 0 && !state.dataHVACSingleDuctInduc->MyPlantScanFlag(IUNum)) { - rho = FluidProperties::GetDensityGlycol( - state, - state.dataPlnt->PlantLoop(state.dataHVACSingleDuctInduc->IndUnit(IUNum).HWPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(state.dataHVACSingleDuctInduc->IndUnit(IUNum).HWPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(state.dataHVACSingleDuctInduc->IndUnit(IUNum).HWPlantLoc.loopNum) + .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); state.dataHVACSingleDuctInduc->IndUnit(IUNum).MaxHotWaterFlow = rho * state.dataHVACSingleDuctInduc->IndUnit(IUNum).MaxVolHotWaterFlow; state.dataHVACSingleDuctInduc->IndUnit(IUNum).MinHotWaterFlow = @@ -642,12 +630,8 @@ namespace HVACSingleDuctInduc { int ColdConNode = state.dataHVACSingleDuctInduc->IndUnit(IUNum).CWControlNode; if (ColdConNode > 0) { - rho = FluidProperties::GetDensityGlycol( - state, - state.dataPlnt->PlantLoop(state.dataHVACSingleDuctInduc->IndUnit(IUNum).CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(state.dataHVACSingleDuctInduc->IndUnit(IUNum).CWPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(state.dataHVACSingleDuctInduc->IndUnit(IUNum).CWPlantLoc.loopNum) + .glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); state.dataHVACSingleDuctInduc->IndUnit(IUNum).MaxColdWaterFlow = rho * state.dataHVACSingleDuctInduc->IndUnit(IUNum).MaxVolColdWaterFlow; state.dataHVACSingleDuctInduc->IndUnit(IUNum).MinColdWaterFlow = @@ -674,7 +658,7 @@ namespace HVACSingleDuctInduc { // Do the start of HVAC time step initializations if (FirstHVACIteration) { // check for upstream zero flow. If nonzero and schedule ON, set primary flow to max - if (ScheduleManager::GetCurrentScheduleValue(state, state.dataHVACSingleDuctInduc->IndUnit(IUNum).SchedPtr) > 0.0 && + if (state.dataHVACSingleDuctInduc->IndUnit(IUNum).availSched->getCurrentVal() > 0.0 && state.dataLoopNodes->Node(PriNode).MassFlowRate > 0.0) { if (Util::SameString(state.dataHVACSingleDuctInduc->IndUnit(IUNum).UnitType, "AirTerminal:SingleDuct:ConstantVolume:FourPipeInduction")) { @@ -686,7 +670,7 @@ namespace HVACSingleDuctInduc { state.dataLoopNodes->Node(SecNode).MassFlowRate = 0.0; } // reset the max and min avail flows - if (ScheduleManager::GetCurrentScheduleValue(state, state.dataHVACSingleDuctInduc->IndUnit(IUNum).SchedPtr) > 0.0 && + if (state.dataHVACSingleDuctInduc->IndUnit(IUNum).availSched->getCurrentVal() > 0.0 && state.dataLoopNodes->Node(PriNode).MassFlowRateMaxAvail > 0.0) { if (Util::SameString(state.dataHVACSingleDuctInduc->IndUnit(IUNum).UnitType, "AirTerminal:SingleDuct:ConstantVolume:FourPipeInduction")) { @@ -733,11 +717,11 @@ namespace HVACSingleDuctInduc { Real64 RhoAir = state.dataEnvrn->StdRhoAir; bool ErrorsFound = false; bool IsAutoSize = false; - Real64 MaxTotAirVolFlowDes = 0.0; // Desing size maximum air volume flow for reproting + Real64 MaxTotAirVolFlowDes = 0.0; // Design size maximum air volume flow for reporting Real64 MaxTotAirVolFlowUser = 0.0; // User hard-sized maximum air volume flow for reporting - Real64 MaxVolHotWaterFlowDes = 0.0; // Desing size maximum hot water flow for reproting + Real64 MaxVolHotWaterFlowDes = 0.0; // Design size maximum hot water flow for reporting Real64 MaxVolHotWaterFlowUser = 0.0; // User hard-sized maximum hot water flow for reporting - Real64 MaxVolColdWaterFlowDes = 0.0; // Desing size maximum cold water flow for reproting + Real64 MaxVolColdWaterFlowDes = 0.0; // Design size maximum cold water flow for reporting Real64 MaxVolColdWaterFlowUser = 0.0; // User hard-sized maximum cold water flow for reporting if (state.dataHVACSingleDuctInduc->IndUnit(IUNum).MaxTotAirVolFlow == DataSizing::AutoSize) { @@ -851,19 +835,11 @@ namespace HVACSingleDuctInduc { state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum).DesHeatCoilInTempTU); } state.dataHVACSingleDuctInduc->IndUnit(IUNum).DesHeatingLoad = DesCoilLoad; - Cp = FluidProperties::GetSpecificHeatGlycol( - state, - state.dataPlnt->PlantLoop(state.dataHVACSingleDuctInduc->IndUnit(IUNum).HWPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(state.dataHVACSingleDuctInduc->IndUnit(IUNum).HWPlantLoc.loopNum).FluidIndex, - RoutineName); - - rho = FluidProperties::GetDensityGlycol( - state, - state.dataPlnt->PlantLoop(state.dataHVACSingleDuctInduc->IndUnit(IUNum).HWPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(state.dataHVACSingleDuctInduc->IndUnit(IUNum).HWPlantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(state.dataHVACSingleDuctInduc->IndUnit(IUNum).HWPlantLoc.loopNum) + .glycol->getSpecificHeat(state, Constant::HWInitConvTemp, RoutineName); + + rho = state.dataPlnt->PlantLoop(state.dataHVACSingleDuctInduc->IndUnit(IUNum).HWPlantLoc.loopNum) + .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); MaxVolHotWaterFlowDes = DesCoilLoad / (state.dataSize->PlantSizData(PltSizHeatNum).DeltaT * Cp * rho); MaxVolHotWaterFlowDes = max(MaxVolHotWaterFlowDes, 0.0); @@ -986,19 +962,11 @@ namespace HVACSingleDuctInduc { state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum).ZoneSizThermSetPtHi); } state.dataHVACSingleDuctInduc->IndUnit(IUNum).DesCoolingLoad = DesCoilLoad; - Cp = FluidProperties::GetSpecificHeatGlycol( - state, - state.dataPlnt->PlantLoop(state.dataHVACSingleDuctInduc->IndUnit(IUNum).CWPlantLoc.loopNum).FluidName, - 5.0, - state.dataPlnt->PlantLoop(state.dataHVACSingleDuctInduc->IndUnit(IUNum).CWPlantLoc.loopNum).FluidIndex, - RoutineName); - - rho = FluidProperties::GetDensityGlycol( - state, - state.dataPlnt->PlantLoop(state.dataHVACSingleDuctInduc->IndUnit(IUNum).CWPlantLoc.loopNum).FluidName, - 5.0, - state.dataPlnt->PlantLoop(state.dataHVACSingleDuctInduc->IndUnit(IUNum).CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(state.dataHVACSingleDuctInduc->IndUnit(IUNum).CWPlantLoc.loopNum) + .glycol->getSpecificHeat(state, 5.0, RoutineName); + + rho = state.dataPlnt->PlantLoop(state.dataHVACSingleDuctInduc->IndUnit(IUNum).CWPlantLoc.loopNum) + .glycol->getDensity(state, 5.0, RoutineName); MaxVolColdWaterFlowDes = DesCoilLoad / (state.dataSize->PlantSizData(PltSizCoolNum).DeltaT * Cp * rho); MaxVolColdWaterFlowDes = max(MaxVolColdWaterFlowDes, 0.0); @@ -1151,7 +1119,7 @@ namespace HVACSingleDuctInduc { PlantUtilities::SetComponentFlowRate( state, MinColdWaterFlow, ColdControlNode, CWOutletNode, state.dataHVACSingleDuctInduc->IndUnit(IUNum).CWPlantLoc); - if (ScheduleManager::GetCurrentScheduleValue(state, state.dataHVACSingleDuctInduc->IndUnit(IUNum).SchedPtr) <= 0.0) UnitOn = false; + if (state.dataHVACSingleDuctInduc->IndUnit(IUNum).availSched->getCurrentVal() <= 0.0) UnitOn = false; if (PriAirMassFlow <= HVAC::SmallMassFlow) UnitOn = false; // Set the unit's air inlet nodes mass flow rates diff --git a/src/EnergyPlus/HVACSingleDuctInduc.hh b/src/EnergyPlus/HVACSingleDuctInduc.hh index a57ed44349d..544922d5f2e 100644 --- a/src/EnergyPlus/HVACSingleDuctInduc.hh +++ b/src/EnergyPlus/HVACSingleDuctInduc.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -76,22 +76,21 @@ namespace HVACSingleDuctInduc { { // Members // input data - std::string Name; // name of unit - std::string UnitType; // type of unit - SingleDuct_CV UnitType_Num; // index to type of unit - std::string Sched; // availability schedule - int SchedPtr; // index to schedule - Real64 MaxTotAirVolFlow; // m3/s (autosizable) - Real64 MaxTotAirMassFlow; // kg/s - Real64 InducRatio; // ratio of induced air flow to primary air flow - int PriAirInNode; // unit primary air inlet node number - int SecAirInNode; // unit induced air inlet node number - int OutAirNode; // unit air outlet node number - int HWControlNode; // hot water control node - int CWControlNode; // cold water control node - std::string HCoilType; // type of heating coil component - std::string HCoil; // name of heating coil component - int HCoil_Num; // index to this coil + std::string Name; // name of unit + std::string UnitType; // type of unit + SingleDuct_CV UnitType_Num; // index to type of unit + Sched::Schedule *availSched = nullptr; // index to schedule + Real64 MaxTotAirVolFlow; // m3/s (autosizable) + Real64 MaxTotAirMassFlow; // kg/s + Real64 InducRatio; // ratio of induced air flow to primary air flow + int PriAirInNode; // unit primary air inlet node number + int SecAirInNode; // unit induced air inlet node number + int OutAirNode; // unit air outlet node number + int HWControlNode; // hot water control node + int CWControlNode; // cold water control node + std::string HCoilType; // type of heating coil component + std::string HCoil; // name of heating coil component + int HCoil_Num; // index to this coil DataPlant::PlantEquipmentType HeatingCoilType; Real64 MaxVolHotWaterFlow; // m3/s (autosizable) Real64 MaxHotWaterFlow; // kg/s @@ -127,14 +126,13 @@ namespace HVACSingleDuctInduc { // Default Constructor IndUnitData() - : UnitType_Num(SingleDuct_CV::Invalid), SchedPtr(0), MaxTotAirVolFlow(0.0), MaxTotAirMassFlow(0.0), InducRatio(2.5), PriAirInNode(0), - SecAirInNode(0), OutAirNode(0), HWControlNode(0), CWControlNode(0), HCoil_Num(0), - HeatingCoilType(DataPlant::PlantEquipmentType::Invalid), MaxVolHotWaterFlow(0.0), MaxHotWaterFlow(0.0), MinVolHotWaterFlow(0.0), - MinHotWaterFlow(0.0), HotControlOffset(0.0), HWPlantLoc{}, HWCoilFailNum1(0), HWCoilFailNum2(0), CCoil_Num(0), - CoolingCoilType(DataPlant::PlantEquipmentType::Invalid), MaxVolColdWaterFlow(0.0), MaxColdWaterFlow(0.0), MinVolColdWaterFlow(0.0), - MinColdWaterFlow(0.0), ColdControlOffset(0.0), CWPlantLoc{}, CWCoilFailNum1(0), CWCoilFailNum2(0), Mixer_Num(0), MaxPriAirMassFlow(0.0), - MaxSecAirMassFlow(0.0), ADUNum(0), DesCoolingLoad(0.0), DesHeatingLoad(0.0), CtrlZoneNum(0), CtrlZoneInNodeIndex(0), AirLoopNum(0), - OutdoorAirFlowRate(0.0) + : UnitType_Num(SingleDuct_CV::Invalid), MaxTotAirVolFlow(0.0), MaxTotAirMassFlow(0.0), InducRatio(2.5), PriAirInNode(0), SecAirInNode(0), + OutAirNode(0), HWControlNode(0), CWControlNode(0), HCoil_Num(0), HeatingCoilType(DataPlant::PlantEquipmentType::Invalid), + MaxVolHotWaterFlow(0.0), MaxHotWaterFlow(0.0), MinVolHotWaterFlow(0.0), MinHotWaterFlow(0.0), HotControlOffset(0.0), HWPlantLoc{}, + HWCoilFailNum1(0), HWCoilFailNum2(0), CCoil_Num(0), CoolingCoilType(DataPlant::PlantEquipmentType::Invalid), MaxVolColdWaterFlow(0.0), + MaxColdWaterFlow(0.0), MinVolColdWaterFlow(0.0), MinColdWaterFlow(0.0), ColdControlOffset(0.0), CWPlantLoc{}, CWCoilFailNum1(0), + CWCoilFailNum2(0), Mixer_Num(0), MaxPriAirMassFlow(0.0), MaxSecAirMassFlow(0.0), ADUNum(0), DesCoolingLoad(0.0), DesHeatingLoad(0.0), + CtrlZoneNum(0), CtrlZoneInNodeIndex(0), AirLoopNum(0), OutdoorAirFlowRate(0.0) { } void ReportIndUnit(EnergyPlusData &state); @@ -193,6 +191,10 @@ struct HVACSingleDuctInducData : BaseGlobalStruct Array1D IndUnit; bool ZoneEquipmentListChecked = false; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/HVACSizingSimulationManager.cc b/src/EnergyPlus/HVACSizingSimulationManager.cc index 9dd268ccea2..a4de7c5832b 100644 --- a/src/EnergyPlus/HVACSizingSimulationManager.cc +++ b/src/EnergyPlus/HVACSizingSimulationManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -97,16 +97,8 @@ void HVACSizingSimulationManager::CreateNewCoincidentPlantAnalysisObject(EnergyP for (int i = 1; i <= state.dataPlnt->TotNumLoops; ++i) { if (PlantLoopName == state.dataPlnt->PlantLoop(i).Name) { // found it - density = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(i).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(i).FluidIndex, - "createNewCoincidentPlantAnalysisObject"); - cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(i).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(i).FluidIndex, - "createNewCoincidentPlantAnalysisObject"); + density = state.dataPlnt->PlantLoop(i).glycol->getDensity(state, Constant::CWInitConvTemp, "createNewCoincidentPlantAnalysisObject"); + cp = state.dataPlnt->PlantLoop(i).glycol->getSpecificHeat(state, Constant::CWInitConvTemp, "createNewCoincidentPlantAnalysisObject"); plantCoincAnalyObjs.emplace_back(PlantLoopName, i, @@ -299,7 +291,7 @@ void ManageHVACSizingSimulation(EnergyPlusData &state, bool &ErrorsFound) state.dataGlobal->BeginHourFlag = true; state.dataGlobal->EndHourFlag = false; - for (state.dataGlobal->TimeStep = 1; state.dataGlobal->TimeStep <= state.dataGlobal->NumOfTimeStepInHour; + for (state.dataGlobal->TimeStep = 1; state.dataGlobal->TimeStep <= state.dataGlobal->TimeStepsInHour; ++state.dataGlobal->TimeStep) { if (state.dataGlobal->AnySlabsInModel || state.dataGlobal->AnyBasementsInModel) { PlantPipingSystemsManager::SimulateGroundDomains(state, false); @@ -314,7 +306,7 @@ void ManageHVACSizingSimulation(EnergyPlusData &state, bool &ErrorsFound) // Note also that BeginTimeStepFlag, EndTimeStepFlag, and the // SubTimeStepFlags can/will be set/reset in the HVAC Manager. - if (state.dataGlobal->TimeStep == state.dataGlobal->NumOfTimeStepInHour) { + if (state.dataGlobal->TimeStep == state.dataGlobal->TimeStepsInHour) { state.dataGlobal->EndHourFlag = true; if (state.dataGlobal->HourOfDay == 24) { state.dataGlobal->EndDayFlag = true; diff --git a/src/EnergyPlus/HVACSizingSimulationManager.hh b/src/EnergyPlus/HVACSizingSimulationManager.hh index 7498901cde4..96fb2149cae 100644 --- a/src/EnergyPlus/HVACSizingSimulationManager.hh +++ b/src/EnergyPlus/HVACSizingSimulationManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -106,6 +106,10 @@ void ManageHVACSizingSimulation(EnergyPlusData &state, bool &ErrorsFound); struct HVACSizingSimMgrData : BaseGlobalStruct { std::unique_ptr hvacSizingSimulationManager; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/HVACStandAloneERV.cc b/src/EnergyPlus/HVACStandAloneERV.cc index a606bccb8c8..5ebd3dbf39a 100644 --- a/src/EnergyPlus/HVACStandAloneERV.cc +++ b/src/EnergyPlus/HVACStandAloneERV.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -250,13 +250,10 @@ void GetStandAloneERV(EnergyPlusData &state) ErrorObjectHeader eoh{routineName, CurrentModuleObject, standAloneERV.Name}; if (lAlphaBlanks(2)) { - standAloneERV.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - standAloneERV.SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (standAloneERV.SchedPtr == 0) { - ShowSevereError(state, format("{}, \"{}\" {} not found = {}", CurrentModuleObject, standAloneERV.Name, cAlphaFields(2), Alphas(2))); - ErrorsFound = true; - } + standAloneERV.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((standAloneERV.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } GlobalNames::IntraObjUniquenessCheck( @@ -287,7 +284,7 @@ void GetStandAloneERV(EnergyPlusData &state) } else { auto *fan = state.dataFans->fans(standAloneERV.SupplyAirFanIndex); standAloneERV.supplyAirFanType = fan->type; - standAloneERV.SupplyAirFanSchPtr = fan->availSchedNum; + standAloneERV.supplyAirFanSched = fan->availSched; standAloneERV.DesignSAFanVolFlowRate = fan->maxAirFlowRate; standAloneERV.SupplyAirOutletNode = fan->outletNodeNum; } @@ -304,7 +301,7 @@ void GetStandAloneERV(EnergyPlusData &state) auto *fan = state.dataFans->fans(standAloneERV.ExhaustAirFanIndex); standAloneERV.exhaustAirFanType = fan->type; - standAloneERV.ExhaustAirFanSchPtr = fan->availSchedNum; + standAloneERV.exhaustAirFanSched = fan->availSched; standAloneERV.DesignEAFanVolFlowRate = fan->maxAirFlowRate; standAloneERV.ExhaustAirOutletNode = fan->outletNodeNum; } @@ -862,10 +859,10 @@ void GetStandAloneERV(EnergyPlusData &state) } // Check for a time of day outside air schedule - thisOAController.EconomizerOASchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(5)); + thisOAController.economizerOASched = Sched::GetSchedule(state, Alphas(5)); if (WhichERV != 0) { - state.dataHVACStandAloneERV->StandAloneERV(WhichERV).EconomizerOASchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(5)); + state.dataHVACStandAloneERV->StandAloneERV(WhichERV).economizerOASched = Sched::GetSchedule(state, Alphas(5)); // Compare the ERV SA fan flow rates to modified air flow rate. if (HighRHOARatio > 1.0 && state.dataHVACStandAloneERV->StandAloneERV(WhichERV).SupplyAirVolFlow != DataSizing::AutoSize && @@ -1150,7 +1147,7 @@ void InitStandAloneERV(EnergyPlusData &state, auto &exhInNode = state.dataLoopNodes->Node(ExhInNode); // Set the inlet node mass flow rate - if (ScheduleManager::GetCurrentScheduleValue(state, state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).SchedPtr) > 0.0) { + if (state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).availSched->getCurrentVal() > 0.0) { // IF optional ControllerName is defined SimOAController ONLY to set economizer and Modifyairflow flags if (state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).ControllerNameDefined) { @@ -1163,7 +1160,7 @@ void InitStandAloneERV(EnergyPlusData &state, 0); } - if (ScheduleManager::GetCurrentScheduleValue(state, state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).SupplyAirFanSchPtr) > 0 || + if (state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).supplyAirFanSched->getCurrentVal() > 0 || (state.dataHVACGlobal->TurnFansOn && !state.dataHVACGlobal->TurnFansOff)) { if (state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).ControllerNameDefined) { if (state.dataMixedAir->OAController(state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).ControllerIndex) @@ -1185,7 +1182,7 @@ void InitStandAloneERV(EnergyPlusData &state, supInNode.MassFlowRateMaxAvail = supInNode.MassFlowRate; supInNode.MassFlowRateMinAvail = supInNode.MassFlowRate; - if (ScheduleManager::GetCurrentScheduleValue(state, state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).ExhaustAirFanSchPtr) > 0) { + if (state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).exhaustAirFanSched->getCurrentVal() > 0) { if (state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).ControllerNameDefined) { if (state.dataMixedAir->OAController(state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).ControllerIndex) .HighHumCtrlActive) { @@ -1259,8 +1256,7 @@ void SizeStandAloneERV(EnergyPlusData &state, int const StandAloneERVNum) Real64 MaxPeopleSch = 0.0; for (int PeopleNum = 1; PeopleNum <= state.dataHeatBal->TotPeople; ++PeopleNum) { if (ZoneNum != state.dataHeatBal->People(PeopleNum).ZonePtr) continue; - int PeopleSchPtr = state.dataHeatBal->People(PeopleNum).NumberOfPeoplePtr; - MaxPeopleSch = ScheduleManager::GetScheduleMaxValue(state, PeopleSchPtr); + MaxPeopleSch = state.dataHeatBal->People(PeopleNum).sched->getMaxVal(state); NumberOfPeople = NumberOfPeople + (state.dataHeatBal->People(PeopleNum).NumberOfPeople * MaxPeopleSch); } SupplyAirVolFlowDes = FloorArea * state.dataHVACStandAloneERV->StandAloneERV(StandAloneERVNum).AirVolFlowPerFloorArea + diff --git a/src/EnergyPlus/HVACStandAloneERV.hh b/src/EnergyPlus/HVACStandAloneERV.hh index 382cbea51bb..7516a2b9a42 100644 --- a/src/EnergyPlus/HVACStandAloneERV.hh +++ b/src/EnergyPlus/HVACStandAloneERV.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -70,42 +70,42 @@ namespace HVACStandAloneERV { { // Members // input data - std::string Name; // name of the stand alone ERV unit - std::string UnitType; // ZoneHVAC:EnergyRecoveryVentilator - int SchedPtr; // pointer to availability schedule - std::string HeatExchangerName; // name of the heat exchanger within the ERV unit - int HeatExchangerIndex; // Pointer to heat exchanger - HVAC::HXType hxType = HVAC::HXType::Invalid; // Parameter equivalent of HX object type - int SupplyAirInletNode; // supply air inlet node for the stand alone ERV - int SupplyAirOutletNode; // supply air outlet node for the stand alone ERV - std::string SupplyAirFanName; // fan name in the supply air stream of the ERV - int SupplyAirFanIndex; // index to supply air fan - int SupplyAirFanSchPtr; // index to supply air fan schedule - HVAC::FanType supplyAirFanType; // parameter equivalent of fan type - int ExhaustAirInletNode; // exhaust air inlet node for the stand alone ERV - int ExhaustAirOutletNode; // exhaust air outlet node for the stand alone ERV - std::string ExhaustAirFanName; // fan name in exhaust air stream of the ERV - int ExhaustAirFanIndex; // index to exhaust air fan - int ExhaustAirFanSchPtr; // index to exhaust air fan schedule - HVAC::FanType exhaustAirFanType; // paramter equivalent of fan type - Real64 SupplyAirVolFlow; // volumetric flow rate through the supply side of the ERV - Real64 ExhaustAirVolFlow; // volumetric flow rate through the exhaust side of the ERV - std::string ControllerName; // name of the controller for the stand alone ERV - bool ControllerNameDefined; // controller for the stand alone ERV is defined - int ControlledZoneNum; // index to controlled zone for stand alone ERV - int ControllerIndex; // Pointer for updates by routines this module calls. - Real64 MaxSupAirMassFlow; // air mass flow rate through the supply side of the ERV - Real64 MaxExhAirMassFlow; // air mass flow rate through the exhaust side of the ERV - Real64 HighRHOAFlowRatio; // ratio of outside air flow to max outside air flow - Real64 DesignSAFanVolFlowRate; // SA fan volumetric flow rate - Real64 DesignEAFanVolFlowRate; // EA fan volumetric flow rate - Real64 DesignHXVolFlowRate; // HX (heat exchanger) volumetric flow rate - Real64 DesignSAFanMassFlowRate; // SA fan mass flow rate - Real64 DesignEAFanMassFlowRate; // EA fan mass flow rate - Real64 AirVolFlowPerFloorArea; // Air flow rate per unit floor area, used for autosizing - Real64 AirVolFlowPerOccupant; // Air flow rate per occupant, used for autosizing - int EconomizerOASchedPtr; // schedule to modify outdoor air - bool FlowError; // used for one-time warning message for flow imbalance (Init) + std::string Name; // name of the stand alone ERV unit + std::string UnitType; // ZoneHVAC:EnergyRecoveryVentilator + Sched::Schedule *availSched = nullptr; // availability schedule + std::string HeatExchangerName; // name of the heat exchanger within the ERV unit + int HeatExchangerIndex; // Pointer to heat exchanger + HVAC::HXType hxType = HVAC::HXType::Invalid; // Parameter equivalent of HX object type + int SupplyAirInletNode; // supply air inlet node for the stand alone ERV + int SupplyAirOutletNode; // supply air outlet node for the stand alone ERV + std::string SupplyAirFanName; // fan name in the supply air stream of the ERV + int SupplyAirFanIndex; // index to supply air fan + Sched::Schedule *supplyAirFanSched = nullptr; // supply air fan schedule + HVAC::FanType supplyAirFanType; // parameter equivalent of fan type + int ExhaustAirInletNode; // exhaust air inlet node for the stand alone ERV + int ExhaustAirOutletNode; // exhaust air outlet node for the stand alone ERV + std::string ExhaustAirFanName; // fan name in exhaust air stream of the ERV + int ExhaustAirFanIndex; // index to exhaust air fan + Sched::Schedule *exhaustAirFanSched = nullptr; // exhaust air fan schedule + HVAC::FanType exhaustAirFanType; // paramter equivalent of fan type + Real64 SupplyAirVolFlow; // volumetric flow rate through the supply side of the ERV + Real64 ExhaustAirVolFlow; // volumetric flow rate through the exhaust side of the ERV + std::string ControllerName; // name of the controller for the stand alone ERV + bool ControllerNameDefined; // controller for the stand alone ERV is defined + int ControlledZoneNum; // index to controlled zone for stand alone ERV + int ControllerIndex; // Pointer for updates by routines this module calls. + Real64 MaxSupAirMassFlow; // air mass flow rate through the supply side of the ERV + Real64 MaxExhAirMassFlow; // air mass flow rate through the exhaust side of the ERV + Real64 HighRHOAFlowRatio; // ratio of outside air flow to max outside air flow + Real64 DesignSAFanVolFlowRate; // SA fan volumetric flow rate + Real64 DesignEAFanVolFlowRate; // EA fan volumetric flow rate + Real64 DesignHXVolFlowRate; // HX (heat exchanger) volumetric flow rate + Real64 DesignSAFanMassFlowRate; // SA fan mass flow rate + Real64 DesignEAFanMassFlowRate; // EA fan mass flow rate + Real64 AirVolFlowPerFloorArea; // Air flow rate per unit floor area, used for autosizing + Real64 AirVolFlowPerOccupant; // Air flow rate per occupant, used for autosizing + Sched::Schedule *economizerOASched = nullptr; // schedule to modify outdoor air + bool FlowError; // used for one-time warning message for flow imbalance (Init) Avail::Status availStatus = Avail::Status::NoAction; std::string AvailManagerListName; // Name of an availability manager list object // report variables @@ -127,13 +127,12 @@ namespace HVACStandAloneERV { // Default Constructor StandAloneERVData() - : SchedPtr(0), HeatExchangerIndex(0), SupplyAirInletNode(0), SupplyAirOutletNode(0), SupplyAirFanIndex(0), SupplyAirFanSchPtr(0), - supplyAirFanType(HVAC::FanType::Invalid), ExhaustAirInletNode(0), ExhaustAirOutletNode(0), ExhaustAirFanIndex(0), - ExhaustAirFanSchPtr(0), exhaustAirFanType(HVAC::FanType::Invalid), SupplyAirVolFlow(0.0), ExhaustAirVolFlow(0.0), - ControllerNameDefined(false), ControlledZoneNum(0), ControllerIndex(0), MaxSupAirMassFlow(0.0), MaxExhAirMassFlow(0.0), - HighRHOAFlowRatio(1.0), DesignSAFanVolFlowRate(0.0), DesignEAFanVolFlowRate(0.0), DesignHXVolFlowRate(0.0), - DesignSAFanMassFlowRate(0.0), DesignEAFanMassFlowRate(0.0), AirVolFlowPerFloorArea(0.0), AirVolFlowPerOccupant(0.0), - EconomizerOASchedPtr(0), FlowError(true), ElecUseRate(0.0), ElecUseEnergy(0.0), SensCoolingEnergy(0.0), SensCoolingRate(0.0), + : HeatExchangerIndex(0), SupplyAirInletNode(0), SupplyAirOutletNode(0), SupplyAirFanIndex(0), supplyAirFanType(HVAC::FanType::Invalid), + ExhaustAirInletNode(0), ExhaustAirOutletNode(0), ExhaustAirFanIndex(0), exhaustAirFanType(HVAC::FanType::Invalid), + SupplyAirVolFlow(0.0), ExhaustAirVolFlow(0.0), ControllerNameDefined(false), ControlledZoneNum(0), ControllerIndex(0), + MaxSupAirMassFlow(0.0), MaxExhAirMassFlow(0.0), HighRHOAFlowRatio(1.0), DesignSAFanVolFlowRate(0.0), DesignEAFanVolFlowRate(0.0), + DesignHXVolFlowRate(0.0), DesignSAFanMassFlowRate(0.0), DesignEAFanMassFlowRate(0.0), AirVolFlowPerFloorArea(0.0), + AirVolFlowPerOccupant(0.0), FlowError(true), ElecUseRate(0.0), ElecUseEnergy(0.0), SensCoolingEnergy(0.0), SensCoolingRate(0.0), LatCoolingEnergy(0.0), LatCoolingRate(0.0), TotCoolingEnergy(0.0), TotCoolingRate(0.0), SensHeatingEnergy(0.0), SensHeatingRate(0.0), LatHeatingEnergy(0.0), LatHeatingRate(0.0), TotHeatingEnergy(0.0), TotHeatingRate(0.0), FirstPass(true) { @@ -208,6 +207,10 @@ struct HVACStandAloneERVData : BaseGlobalStruct Array1D_bool MyZoneEqFlag; // used to set up zone equipment availability managers bool ZoneEquipmentListChecked = false; // True after the Zone Equipment List has been checked for items + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/HVACSystemRootFindingAlgorithm.hh b/src/EnergyPlus/HVACSystemRootFindingAlgorithm.hh index 6138bacc004..96ce493a5a2 100644 --- a/src/EnergyPlus/HVACSystemRootFindingAlgorithm.hh +++ b/src/EnergyPlus/HVACSystemRootFindingAlgorithm.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -70,6 +70,10 @@ struct HVACSystemRootFindingAlgorithm struct RootFindingData : BaseGlobalStruct { HVACSystemRootFindingAlgorithm HVACSystemRootFinding; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/HVACUnitaryBypassVAV.cc b/src/EnergyPlus/HVACUnitaryBypassVAV.cc index 29014cd42a6..c3bea79397d 100644 --- a/src/EnergyPlus/HVACUnitaryBypassVAV.cc +++ b/src/EnergyPlus/HVACUnitaryBypassVAV.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -109,7 +109,7 @@ namespace HVACUnitaryBypassVAV { // METHODOLOGY EMPLOYED: // Units are modeled as a collection of components: outside air mixer, - // supply air fan, DX cooing coil, DX/gas/elec heating coil, and variable volume boxes. + // supply air fan, DX cooling coil, DX/gas/elec heating coil, and variable volume boxes. // Control is accomplished by calculating the load in all zones to determine a mode of operation. // The system will either cool, heat, or operate based on fan mode selection. @@ -125,8 +125,6 @@ namespace HVACUnitaryBypassVAV { // "Ventilation for Changeover-Bypass VAV Systems," D. Stanke, ASHRAE Journal Vol. 46, No. 11, November 2004. // Lawrence Berkeley Laboratory. Nov. 1993. DOE-2 Supplement Version 2.1E, Winklemann et.al. - static constexpr std::string_view fluidNameSteam("STEAM"); - void SimUnitaryBypassVAV(EnergyPlusData &state, std::string_view CompName, // Name of the CBVAV system bool const FirstHVACIteration, // TRUE if 1st HVAC simulation of system time step @@ -372,16 +370,11 @@ namespace HVACUnitaryBypassVAV { ErrorObjectHeader eoh{routineName, CurrentModuleObject, thisCBVAV.Name}; thisCBVAV.UnitType = CurrentModuleObject; - thisCBVAV.Sched = Alphas(2); if (lAlphaBlanks(2)) { - thisCBVAV.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisCBVAV.SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer (index number) - if (thisCBVAV.SchedPtr == 0) { - ShowSevereError(state, format("{} {} not found = {}", CurrentModuleObject, cAlphaFields(2), Alphas(2))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, thisCBVAV.Name)); - ErrorsFound = true; - } + thisCBVAV.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisCBVAV.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } thisCBVAV.MaxCoolAirVolFlow = Numbers(1); @@ -432,11 +425,10 @@ namespace HVACUnitaryBypassVAV { ErrorsFound = true; } - thisCBVAV.OutAirSchPtr = ScheduleManager::GetScheduleIndex(state, Alphas(3)); // convert schedule name to pointer (index number) - if (thisCBVAV.OutAirSchPtr != 0) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, thisCBVAV.OutAirSchPtr, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{}: {}", CurrentModuleObject, thisCBVAV.Name)); - ShowContinueError(state, format("The schedule values in {} must be 0 to 1.", cAlphaFields(3))); + thisCBVAV.outAirSched = Sched::GetSchedule(state, Alphas(3)); + if (thisCBVAV.outAirSched != nullptr) { + if (!thisCBVAV.outAirSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFields(3), Alphas(3), Clusive::In, 0.0, Clusive::In, 1.0); ErrorsFound = true; } } @@ -753,7 +745,7 @@ namespace HVACUnitaryBypassVAV { ShowContinueError(state, format("...occurs in {} \"{}\"", thisCBVAV.UnitType, thisCBVAV.Name)); ErrorsFound = true; } else { - auto const &newCoil = state.dataCoilCooingDX->coilCoolingDXs[thisCBVAV.DXCoolCoilIndexNum]; + auto const &newCoil = state.dataCoilCoolingDX->coilCoolingDXs[thisCBVAV.DXCoolCoilIndexNum]; thisCBVAV.DXCoilInletNode = newCoil.evapInletNodeIndex; thisCBVAV.DXCoilOutletNode = newCoil.evapOutletNodeIndex; thisCBVAV.CondenserNodeNum = newCoil.condInletNodeIndex; @@ -773,27 +765,22 @@ namespace HVACUnitaryBypassVAV { } } - thisCBVAV.FanOpModeSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(13)); // convert schedule name to pointer (index number) - if (thisCBVAV.FanOpModeSchedPtr != 0) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, thisCBVAV.FanOpModeSchedPtr, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{}: {}", CurrentModuleObject, thisCBVAV.Name)); - ShowContinueError(state, format("The schedule values in {} must be 0 to 1.", cAlphaFields(13))); + thisCBVAV.fanOpModeSched = Sched::GetSchedule(state, Alphas(13)); + if (thisCBVAV.fanOpModeSched != nullptr) { + if (!thisCBVAV.fanOpModeSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFields(13), Alphas(13), Clusive::In, 0.0, Clusive::In, 1.0); ShowContinueError(state, "A value of 0 represents cycling fan mode, any other value up to 1 represents constant fan mode."); ErrorsFound = true; } // Check supply air fan operating mode for cycling fan, if NOT cycling fan set AirFlowControl - if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisCBVAV.FanOpModeSchedPtr, ">=", 0.0, "<=", 0.0)) { // Autodesk:Note Range is 0 to 0? + if (!thisCBVAV.fanOpModeSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 0.0)) { // Autodesk:Note Range is 0 to 0? // set air flow control mode, // UseCompressorOnFlow = operate at last cooling or heating air flow requested when compressor is off // UseCompressorOffFlow = operate at value specified by user (no input for this object type, UseCompONFlow) // AirFlowControl only valid if fan opmode = HVAC::FanOp::Continuous - if (thisCBVAV.MaxNoCoolHeatAirVolFlow == 0.0) { - thisCBVAV.AirFlowControl = AirFlowCtrlMode::UseCompressorOnFlow; - } else { - thisCBVAV.AirFlowControl = AirFlowCtrlMode::UseCompressorOffFlow; - } + thisCBVAV.AirFlowControl = + (thisCBVAV.MaxNoCoolHeatAirVolFlow == 0.0) ? AirFlowCtrlMode::UseCompressorOnFlow : AirFlowCtrlMode::UseCompressorOffFlow; } } else { @@ -899,9 +886,8 @@ namespace HVACUnitaryBypassVAV { thisCBVAV.HeatingCoilOutletNode = state.dataSteamCoils->SteamCoil(thisCBVAV.HeatCoilIndex).AirOutletNodeNum; thisCBVAV.CoilControlNode = state.dataSteamCoils->SteamCoil(thisCBVAV.HeatCoilIndex).SteamInletNodeNum; thisCBVAV.MaxHeatCoilFluidFlow = state.dataSteamCoils->SteamCoil(thisCBVAV.HeatCoilIndex).MaxSteamVolFlowRate; - int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed - Real64 SteamDensity = FluidProperties::GetSatDensityRefrig( - state, fluidNameSteam, state.dataHVACUnitaryBypassVAV->TempSteamIn, 1.0, SteamIndex, getUnitaryHeatCoolVAVChangeoverBypass); + Real64 SteamDensity = Fluid::GetSteam(state)->getSatDensity( + state, state.dataHVACUnitaryBypassVAV->TempSteamIn, 1.0, getUnitaryHeatCoolVAVChangeoverBypass); if (thisCBVAV.MaxHeatCoilFluidFlow > 0.0) { thisCBVAV.MaxHeatCoilFluidFlow = thisCBVAV.MaxHeatCoilFluidFlow * SteamDensity; } @@ -1381,11 +1367,8 @@ namespace HVACUnitaryBypassVAV { cBVAV.MaxHeatCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", cBVAV.HeatCoilName, ErrorsFound); if (cBVAV.MaxHeatCoilFluidFlow > 0.0) { - Real64 FluidDensity = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(cBVAV.plantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(cBVAV.plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 FluidDensity = + state.dataPlnt->PlantLoop(cBVAV.plantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); cBVAV.MaxHeatCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", cBVAV.HeatCoilName, ErrorsFound) * FluidDensity; } @@ -1403,9 +1386,10 @@ namespace HVACUnitaryBypassVAV { cBVAV.MaxHeatCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, cBVAV.HeatCoilIndex, ErrorsFound); if (cBVAV.MaxHeatCoilFluidFlow > 0.0) { - int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed - Real64 FluidDensity = FluidProperties::GetSatDensityRefrig( - state, fluidNameSteam, state.dataHVACUnitaryBypassVAV->TempSteamIn, 1.0, SteamIndex, RoutineName); + // Why is TempSteamIn a state variable of the entire module? + Real64 FluidDensity = + Fluid::GetSteam(state)->getSatDensity(state, state.dataHVACUnitaryBypassVAV->TempSteamIn, 1.0, RoutineName); + cBVAV.MaxHeatCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, cBVAV.HeatCoilIndex, ErrorsFound) * FluidDensity; } } @@ -1427,7 +1411,7 @@ namespace HVACUnitaryBypassVAV { if (!state.dataGlobal->SysSizingCalc && state.dataHVACUnitaryBypassVAV->MySizeFlag(CBVAVNum)) { SizeCBVAV(state, CBVAVNum); // Pass the fan cycling schedule index up to the air loop. Set the air loop unitary system flag. - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).CycFanSchedPtr = cBVAV.FanOpModeSchedPtr; + state.dataAirLoop->AirLoopControlInfo(AirLoopNum).cycFanSched = cBVAV.fanOpModeSched; // Set UnitarySys flag to FALSE and let the heating coil autosize independently of the cooling coil state.dataAirLoop->AirLoopControlInfo(AirLoopNum).UnitarySys = false; state.dataAirLoop->AirLoopControlInfo(AirLoopNum).fanOp = cBVAV.fanOp; @@ -1479,11 +1463,8 @@ namespace HVACUnitaryBypassVAV { ShowContinueError(state, format("Occurs in {} = {}", "AirLoopHVAC:UnitaryHeatCool:VAVChangeoverBypass", cBVAV.Name)); } if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - Real64 FluidDensity = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(cBVAV.plantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(cBVAV.plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 FluidDensity = + state.dataPlnt->PlantLoop(cBVAV.plantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); cBVAV.MaxHeatCoilFluidFlow = CoilMaxVolFlowRate * FluidDensity; } } @@ -1500,9 +1481,8 @@ namespace HVACUnitaryBypassVAV { ShowContinueError(state, format("Occurs in {} = {}", "AirLoopHVAC:UnitaryHeatCool:VAVChangeoverBypass", cBVAV.Name)); } if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed - Real64 FluidDensity = FluidProperties::GetSatDensityRefrig( - state, fluidNameSteam, state.dataHVACUnitaryBypassVAV->TempSteamIn, 1.0, SteamIndex, RoutineName); + Real64 FluidDensity = + Fluid::GetSteam(state)->getSatDensity(state, state.dataHVACUnitaryBypassVAV->TempSteamIn, 1.0, RoutineName); cBVAV.MaxHeatCoilFluidFlow = CoilMaxVolFlowRate * FluidDensity; } } @@ -1635,23 +1615,15 @@ namespace HVACUnitaryBypassVAV { } } - if (cBVAV.FanOpModeSchedPtr > 0) { - if (ScheduleManager::GetCurrentScheduleValue(state, cBVAV.FanOpModeSchedPtr) == 0.0) { - cBVAV.fanOp = HVAC::FanOp::Cycling; - } else { - cBVAV.fanOp = HVAC::FanOp::Continuous; - } + if (cBVAV.fanOpModeSched != nullptr) { + cBVAV.fanOp = (cBVAV.fanOpModeSched->getCurrentVal() == 0.0) ? HVAC::FanOp::Cycling : HVAC::FanOp::Continuous; } // Returns load only for zones requesting cooling (heating). If in deadband, Qzoneload = 0. if (FirstHVACIteration) cBVAV.modeChanged = false; GetZoneLoads(state, CBVAVNum); - if (cBVAV.OutAirSchPtr > 0) { - OutsideAirMultiplier = ScheduleManager::GetCurrentScheduleValue(state, cBVAV.OutAirSchPtr); - } else { - OutsideAirMultiplier = 1.0; - } + OutsideAirMultiplier = (cBVAV.outAirSched != nullptr) ? cBVAV.outAirSched->getCurrentVal() : 1.0; // Set the inlet node mass flow rate if (cBVAV.fanOp == HVAC::FanOp::Continuous) { @@ -1741,7 +1713,7 @@ namespace HVACUnitaryBypassVAV { } // Set the inlet node mass flow rate - if (ScheduleManager::GetCurrentScheduleValue(state, cBVAV.SchedPtr) > 0.0 && state.dataHVACUnitaryBypassVAV->CompOnMassFlow != 0.0) { + if (cBVAV.availSched->getCurrentVal() > 0.0 && state.dataHVACUnitaryBypassVAV->CompOnMassFlow != 0.0) { OnOffAirFlowRatio = 1.0; if (FirstHVACIteration) { state.dataLoopNodes->Node(cBVAV.AirInNode).MassFlowRate = state.dataHVACUnitaryBypassVAV->CompOnMassFlow; @@ -1782,7 +1754,7 @@ namespace HVACUnitaryBypassVAV { CalcCBVAV(state, CBVAVNum, FirstHVACIteration, state.dataHVACUnitaryBypassVAV->PartLoadFrac, QSensUnitOut, OnOffAirFlowRatio, HXUnitOn); // If unit is scheduled OFF, setpoint is equal to inlet node temperature. - if (ScheduleManager::GetCurrentScheduleValue(state, cBVAV.SchedPtr) == 0.0) { + if (cBVAV.availSched->getCurrentVal() == 0.0) { cBVAV.OutletTempSetPoint = state.dataLoopNodes->Node(InNode).Temp; return; } @@ -2029,7 +2001,7 @@ namespace HVACUnitaryBypassVAV { auto &cBVAV = state.dataHVACUnitaryBypassVAV->CBVAV(CBVAVNum); - if (ScheduleManager::GetCurrentScheduleValue(state, cBVAV.SchedPtr) == 0.0) return; + if (cBVAV.availSched->getCurrentVal() == 0.0) return; // Get operating result PartLoadFrac = 1.0; @@ -3756,7 +3728,7 @@ namespace HVACUnitaryBypassVAV { state.dataLoopNodes->Node(MixerMixedAirNode).MassFlowRateMin = 0.0; - if (ScheduleManager::GetCurrentScheduleValue(state, cBVAV.SchedPtr) == 0.0 || AverageUnitMassFlow == 0.0) { + if (cBVAV.availSched->getCurrentVal() == 0.0 || AverageUnitMassFlow == 0.0) { state.dataLoopNodes->Node(InletNode).MassFlowRate = 0.0; state.dataLoopNodes->Node(MixerOutsideAirNode).MassFlowRate = 0.0; state.dataLoopNodes->Node(MixerReliefAirNode).MassFlowRate = 0.0; diff --git a/src/EnergyPlus/HVACUnitaryBypassVAV.hh b/src/EnergyPlus/HVACUnitaryBypassVAV.hh index fb359ee33b7..2ff2d4e0ef4 100644 --- a/src/EnergyPlus/HVACUnitaryBypassVAV.hh +++ b/src/EnergyPlus/HVACUnitaryBypassVAV.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -106,40 +106,40 @@ namespace HVACUnitaryBypassVAV { struct CBVAVData { - std::string Name; // Name of unit - std::string UnitType; // Type of unit - std::string Sched; // Availability schedule name - int SchedPtr = 0; // Index number to availability schedule - Real64 MaxCoolAirVolFlow = 0.0; // System air volumetric flow rate during cooling operation [m3/s] - Real64 MaxHeatAirVolFlow = 0.0; // System air volumetric flow rate during heating operation [m3/s] - Real64 MaxNoCoolHeatAirVolFlow = 0.0; // System air volumetric flow rate when no cooling or heating [m3/s] - Real64 MaxCoolAirMassFlow = 0.0; // System air mass flow rate during cooling operation [kg/s] - Real64 MaxHeatAirMassFlow = 0.0; // System air mass flow rate during heating operation [kg/s] - Real64 MaxNoCoolHeatAirMassFlow = 0.0; // System air mass flow rate when no cooling or heating [kg/s] - Real64 CoolOutAirVolFlow = 0.0; // OA volumetric flow rate during cooling operation [m3/s] - Real64 HeatOutAirVolFlow = 0.0; // OA volumetric flow rate during heating operation [m3/s] - Real64 NoCoolHeatOutAirVolFlow = 0.0; // OA volumetric flow rate when no cooling or heating [m3/s] - Real64 CoolOutAirMassFlow = 0.0; // OA mass flow rate during cooling operation [kg/s] - Real64 HeatOutAirMassFlow = 0.0; // OA mass flow rate during heating operation [kg/s] - Real64 NoCoolHeatOutAirMassFlow = 0.0; // OA mass flow rate when no cooling or heating [kg/s] - int OutAirSchPtr = 0; // Index number to outside air multiplier schedule - int AirInNode = 0; // Inlet air node number for CBVAV unit - int AirOutNode = 0; // Outlet air node number for CBVAV unit - int CondenserNodeNum = 0; // DX Coil condenser air inlet node number - int MixerOutsideAirNode = 0; // Outside air node number for OA mixer - int MixerMixedAirNode = 0; // Mixed air node number for OA mixer - int MixerReliefAirNode = 0; // Relief air node number for OA mixer - int MixerInletAirNode = 0; // Return air node number for OA mixer - int SplitterOutletAirNode = 0; // Air node number for splitter (last component outlet node) - int PlenumMixerInletAirNode = 0; // only used when bypass is connected to plenum or mixer - std::string OAMixType; // type of outside air mixer - std::string OAMixName; // Name of OA mixer - int OAMixIndex = 0; // Index to OA mixer - std::string FanName; // Name of fan + std::string Name; // Name of unit + std::string UnitType; // Type of unit + std::string availSchedName; // Availability schedule name + Sched::Schedule *availSched = nullptr; // availability schedule + Real64 MaxCoolAirVolFlow = 0.0; // System air volumetric flow rate during cooling operation [m3/s] + Real64 MaxHeatAirVolFlow = 0.0; // System air volumetric flow rate during heating operation [m3/s] + Real64 MaxNoCoolHeatAirVolFlow = 0.0; // System air volumetric flow rate when no cooling or heating [m3/s] + Real64 MaxCoolAirMassFlow = 0.0; // System air mass flow rate during cooling operation [kg/s] + Real64 MaxHeatAirMassFlow = 0.0; // System air mass flow rate during heating operation [kg/s] + Real64 MaxNoCoolHeatAirMassFlow = 0.0; // System air mass flow rate when no cooling or heating [kg/s] + Real64 CoolOutAirVolFlow = 0.0; // OA volumetric flow rate during cooling operation [m3/s] + Real64 HeatOutAirVolFlow = 0.0; // OA volumetric flow rate during heating operation [m3/s] + Real64 NoCoolHeatOutAirVolFlow = 0.0; // OA volumetric flow rate when no cooling or heating [m3/s] + Real64 CoolOutAirMassFlow = 0.0; // OA mass flow rate during cooling operation [kg/s] + Real64 HeatOutAirMassFlow = 0.0; // OA mass flow rate during heating operation [kg/s] + Real64 NoCoolHeatOutAirMassFlow = 0.0; // OA mass flow rate when no cooling or heating [kg/s] + Sched::Schedule *outAirSched = nullptr; // outside air multiplier schedule + int AirInNode = 0; // Inlet air node number for CBVAV unit + int AirOutNode = 0; // Outlet air node number for CBVAV unit + int CondenserNodeNum = 0; // DX Coil condenser air inlet node number + int MixerOutsideAirNode = 0; // Outside air node number for OA mixer + int MixerMixedAirNode = 0; // Mixed air node number for OA mixer + int MixerReliefAirNode = 0; // Relief air node number for OA mixer + int MixerInletAirNode = 0; // Return air node number for OA mixer + int SplitterOutletAirNode = 0; // Air node number for splitter (last component outlet node) + int PlenumMixerInletAirNode = 0; // only used when bypass is connected to plenum or mixer + std::string OAMixType; // type of outside air mixer + std::string OAMixName; // Name of OA mixer + int OAMixIndex = 0; // Index to OA mixer + std::string FanName; // Name of fan HVAC::FanType fanType = HVAC::FanType::Invalid; HVAC::FanPlace fanPlace = HVAC::FanPlace::Invalid; // Fan placement is either blowthru (1) or drawthru (2) int FanIndex = 0; // Index number to fan - int FanOpModeSchedPtr = 0; // Fan operating mode schedule pointer + Sched::Schedule *fanOpModeSched = nullptr; // Fan operating mode schedule Real64 FanVolFlow = 0.0; // Volumetric flow rate of system supply air fan [m3/s] Real64 HeatingSpeedRatio = 1.0; // Fan speed ratio in heating mode Real64 CoolingSpeedRatio = 1.0; // Fan speed ratio in cooling mode @@ -343,6 +343,10 @@ struct HVACUnitaryBypassVAVData : BaseGlobalStruct Array1D_bool MySizeFlag; // Used for sizing CBVAV inputs one time Array1D_bool MyPlantScanFlag; // Used for initializations plant component for heating coils + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index 80b40eaaddd..3e53c6fcf67 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -131,9 +131,9 @@ void SimulateVRF(EnergyPlusData &state, int &CompIndex, bool &HeatingActive, bool &CoolingActive, - int const OAUnitNum, // If the system is an equipment of OutdoorAirUnit - Real64 const OAUCoilOutTemp, // the coil inlet temperature of OutdoorAirUnit - bool const ZoneEquipment, // TRUE if called as zone equipment + [[maybe_unused]] int const OAUnitNum, // If the system is an equipment of OutdoorAirUnit + [[maybe_unused]] Real64 const OAUCoilOutTemp, // the coil inlet temperature of OutdoorAirUnit + [[maybe_unused]] bool const ZoneEquipment, // TRUE if called as zone equipment Real64 &SysOutputProvided, Real64 &LatOutputProvided) { @@ -1226,7 +1226,7 @@ void CalcVRFCondenser(EnergyPlusData &state, int const VRFCond) if (vrf.CondenserType == DataHeatBalance::RefrigCondenserType::Evap) { // Calculate basin heater power - CalcBasinHeaterPower(state, vrf.BasinHeaterPowerFTempDiff, vrf.BasinHeaterSchedulePtr, vrf.BasinHeaterSetPointTemp, vrf.BasinHeaterPower); + CalcBasinHeaterPower(state, vrf.BasinHeaterPowerFTempDiff, vrf.basinHeaterSched, vrf.BasinHeaterSetPointTemp, vrf.BasinHeaterPower); vrf.BasinHeaterPower *= (1.0 - VRFRTF); // calculate evaporative condenser pump power and water consumption @@ -1254,11 +1254,7 @@ void CalcVRFCondenser(EnergyPlusData &state, int const VRFCond) // VRF( VRFCond ).CondenserInletTemp = state.dataLoopNodes->Node(VRF(VRFCond).CondenserNodeNum).Temp; vrf.WaterCondenserMassFlow = state.dataLoopNodes->Node(vrf.CondenserNodeNum).MassFlowRate; - CpCond = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(vrf.SourcePlantLoc.loopNum).FluidName, - vrf.CondenserInletTemp, - state.dataPlnt->PlantLoop(vrf.SourcePlantLoc.loopNum).FluidIndex, - RoutineName); + CpCond = state.dataPlnt->PlantLoop(vrf.SourcePlantLoc.loopNum).glycol->getSpecificHeat(state, vrf.CondenserInletTemp, RoutineName); if (CondWaterMassFlow > 0.0) { CondOutletTemp = vrf.QCondenser / (CondWaterMassFlow * CpCond) + CondInletTemp; } else { @@ -1382,7 +1378,6 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) using DataSizing::AutoSize; using DXCoils::GetCoilCondenserInletNode; using DXCoils::GetCoilTypeNum; - using DXCoils::GetDXCoilAvailSchPtr; using DXCoils::GetDXCoilCapFTCurveIndex; using DXCoils::GetDXCoilName; using DXCoils::RatedInletAirTempHeat; @@ -1394,8 +1389,6 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) using MixedAir::GetOAMixerNodeNumbers; using NodeInputManager::GetOnlySingleNode; using OutAirNodeManager::CheckOutAirNodeNumber; - using ScheduleManager::CheckScheduleValueMinMax; - using ScheduleManager::GetScheduleIndex; using SingleDuct::GetATMixer; using WaterManager::SetupTankDemandComponent; using WaterManager::SetupTankSupplyComponent; @@ -1545,8 +1538,8 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) thisTUList.HRCoolRequest.allocate(thisTUList.NumTUInList); thisTUList.CoolingCoilAvailable.allocate(thisTUList.NumTUInList); thisTUList.HeatingCoilAvailable.allocate(thisTUList.NumTUInList); - thisTUList.CoolingCoilAvailSchPtr.allocate(thisTUList.NumTUInList); - thisTUList.HeatingCoilAvailSchPtr.allocate(thisTUList.NumTUInList); + thisTUList.coolingCoilAvailScheds.allocate(thisTUList.NumTUInList); + thisTUList.heatingCoilAvailScheds.allocate(thisTUList.NumTUInList); thisTUList.ZoneTUPtr = 0; thisTUList.IsSimulated = false; thisTUList.TotalCoolLoad = 0.0; @@ -1558,8 +1551,8 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) thisTUList.HRCoolRequest = false; thisTUList.CoolingCoilAvailable = false; thisTUList.HeatingCoilAvailable = false; - thisTUList.CoolingCoilAvailSchPtr = -1; - thisTUList.HeatingCoilAvailSchPtr = -1; + thisTUList.coolingCoilAvailScheds = nullptr; + thisTUList.heatingCoilAvailScheds = nullptr; for (int TUNum = 1; TUNum <= thisTUList.NumTUInList; ++TUNum) { thisTUList.ZoneTUName(TUNum) = cAlphaArgs(TUNum + 1); @@ -1602,6 +1595,8 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, cAlphaArgs(1)}; GlobalNames::VerifyUniqueInterObjectName( state, state.dataHVACVarRefFlow->VrfUniqueNames, cAlphaArgs(1), cCurrentModuleObject, cAlphaFieldNames(1), ErrorsFound); @@ -1609,15 +1604,12 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) thisVrfSys.Name = cAlphaArgs(1); thisVrfSys.VRFSystemTypeNum = VRF_HeatPump; thisVrfSys.VRFAlgorithmType = AlgorithmType::SysCurve; + if (lAlphaFieldBlanks(2)) { - thisVrfSys.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisVrfSys.SchedPtr = GetScheduleIndex(state, cAlphaArgs(2)); - if (thisVrfSys.SchedPtr == 0) { - ShowSevereError(state, format("{}=\"{}\" invalid data", cCurrentModuleObject, thisVrfSys.Name)); - ShowContinueError(state, format("Invalid-not found {}=\"{}\".", cAlphaFieldNames(2), cAlphaArgs(2))); - ErrorsFound = true; - } + thisVrfSys.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisVrfSys.availSched = Sched::GetSchedule(state, cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2)); + ErrorsFound = true; } thisVrfSys.CoolingCapacity = rNumericArgs(1); @@ -2034,11 +2026,10 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) } if (thisVrfSys.ThermostatPriority == ThermostatCtrlType::ScheduledPriority) { - thisVrfSys.SchedPriorityPtr = GetScheduleIndex(state, cAlphaArgs(26)); - if (thisVrfSys.SchedPriorityPtr == 0) { - ShowSevereError(state, format("{} = \"{}\"", cCurrentModuleObject, thisVrfSys.Name)); - ShowContinueError(state, format("...{} = {} not found.", cAlphaFieldNames(26), cAlphaArgs(26))); - ShowContinueError(state, format("A schedule name is required when {}={}", cAlphaFieldNames(25), cAlphaArgs(25))); + if (lAlphaFieldBlanks(26)) { + ShowSevereEmptyField(state, eoh, cAlphaFieldNames(26), cAlphaFieldNames(25), cAlphaArgs(25)); + } else if ((thisVrfSys.prioritySched = Sched::GetSchedule(state, cAlphaArgs(26))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(26), cAlphaArgs(26)); ErrorsFound = true; } } @@ -2292,24 +2283,16 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) } if (!lAlphaFieldBlanks(38)) { - thisVrfSys.BasinHeaterSchedulePtr = GetScheduleIndex(state, cAlphaArgs(38)); - if (thisVrfSys.BasinHeaterSchedulePtr == 0) { - ShowSevereError( - state, - format("{} = \"{}\", {} = \"{}\" was not found.", cCurrentModuleObject, thisVrfSys.Name, cAlphaFieldNames(38), cAlphaArgs(38))); - ShowContinueError(state, "Basin heater will be available to operate throughout the simulation."); + if ((thisVrfSys.basinHeaterSched = Sched::GetSchedule(state, cAlphaArgs(38))) == nullptr) { + ShowWarningItemNotFound( + state, eoh, cAlphaFieldNames(38), cAlphaArgs(38), "Basin heater will be available to operate throughout the simulation."); } } if (!lAlphaFieldBlanks(39)) { // A39; \field Fuel type, Validate fuel type input - thisVrfSys.fuel = static_cast(getEnumValue(Constant::eFuelNamesUC, cAlphaArgs(39))); - if (thisVrfSys.fuel == Constant::eFuel::Invalid) { - ShowSevereError( - state, - format("{} = \"{}\", {} = \"{}\" was not found.", cCurrentModuleObject, thisVrfSys.Name, cAlphaFieldNames(39), cAlphaArgs(39))); - ShowContinueError( - state, "Valid choices are Electricity, NaturalGas, Propane, Diesel, Gasoline, FuelOilNo1, FuelOilNo2, OtherFuel1 or OtherFuel2"); + if ((thisVrfSys.fuel = static_cast(getEnumValue(Constant::eFuelNamesUC, cAlphaArgs(39)))) == Constant::eFuel::Invalid) { + ShowSevereInvalidKey(state, eoh, cAlphaFieldNames(39), cAlphaArgs(39)); ErrorsFound = true; } } @@ -2453,14 +2436,10 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) thisVrfFluidCtrl.fuel = Constant::eFuel::Electricity; if (lAlphaFieldBlanks(2)) { - thisVrfFluidCtrl.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisVrfFluidCtrl.SchedPtr = GetScheduleIndex(state, cAlphaArgs(2)); - if (thisVrfFluidCtrl.SchedPtr == 0) { - ShowSevereError(state, cCurrentModuleObject + "=\"" + thisVrfFluidCtrl.Name + "\" invalid data"); - ShowContinueError(state, "Invalid-not found " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); - ErrorsFound = true; - } + thisVrfFluidCtrl.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisVrfFluidCtrl.availSched = Sched::GetSchedule(state, cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2)); + ErrorsFound = true; } thisVrfFluidCtrl.ZoneTUListPtr = @@ -2473,7 +2452,7 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) // Refrigerant type thisVrfFluidCtrl.refrigName = cAlphaArgs(4); - thisVrfFluidCtrl.refrig = FluidProperties::GetRefrig(state, thisVrfFluidCtrl.refrigName); + thisVrfFluidCtrl.refrig = Fluid::GetRefrig(state, thisVrfFluidCtrl.refrigName); if (thisVrfFluidCtrl.refrig == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(4), cAlphaArgs(4)); ErrorsFound = true; @@ -2851,14 +2830,10 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) thisVrfFluidCtrlHR.fuel = Constant::eFuel::Electricity; if (lAlphaFieldBlanks(2)) { - thisVrfFluidCtrlHR.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisVrfFluidCtrlHR.SchedPtr = GetScheduleIndex(state, cAlphaArgs(2)); - if (thisVrfFluidCtrlHR.SchedPtr == 0) { - ShowSevereError(state, cCurrentModuleObject + "=\"" + thisVrfFluidCtrlHR.Name + "\" invalid data"); - ShowContinueError(state, "Invalid-not found " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); - ErrorsFound = true; - } + thisVrfFluidCtrlHR.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisVrfFluidCtrlHR.availSched = Sched::GetSchedule(state, cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2)); + ErrorsFound = true; } thisVrfFluidCtrlHR.ZoneTUListPtr = @@ -2871,7 +2846,7 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) // Refrigerant type thisVrfFluidCtrlHR.refrigName = cAlphaArgs(4); - if ((thisVrfFluidCtrlHR.refrig = FluidProperties::GetRefrig(state, thisVrfFluidCtrlHR.refrigName)) == nullptr) { + if ((thisVrfFluidCtrlHR.refrig = Fluid::GetRefrig(state, thisVrfFluidCtrlHR.refrigName)) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(4), cAlphaArgs(4)); ErrorsFound = true; } @@ -2881,6 +2856,7 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) thisVrfFluidCtrlHR.RatedCompPower = thisVrfFluidCtrlHR.RatedCompPowerPerCapcity * thisVrfFluidCtrlHR.RatedEvapCapacity; thisVrfFluidCtrlHR.CoolingCapacity = thisVrfFluidCtrlHR.RatedEvapCapacity; thisVrfFluidCtrlHR.HeatingCapacity = thisVrfFluidCtrlHR.RatedEvapCapacity * (1 + thisVrfFluidCtrlHR.RatedCompPowerPerCapcity); + thisVrfFluidCtrlHR.RatedHeatCapacity = thisVrfFluidCtrlHR.HeatingCapacity; // Reference system COP thisVrfFluidCtrlHR.CoolingCOP = 1 / thisVrfFluidCtrlHR.RatedCompPowerPerCapcity; @@ -3309,14 +3285,10 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) } thisVrfTU.type = TUType::ConstantVolume; if (lAlphaFieldBlanks(2)) { - thisVrfTU.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisVrfTU.SchedPtr = GetScheduleIndex(state, cAlphaArgs(2)); - if (thisVrfTU.SchedPtr == 0) { - ShowSevereError(state, cCurrentModuleObject + "=\"" + thisVrfTU.Name + "\" invalid data"); - ShowContinueError(state, "Invalid-not found " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\"."); - ErrorsFound = true; - } + thisVrfTU.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisVrfTU.availSched = Sched::GetSchedule(state, cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2)); + ErrorsFound = true; } thisVrfTU.VRFTUInletNodeNum = GetOnlySingleNode(state, @@ -3347,14 +3319,11 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) thisVrfTU.HeatOutAirVolFlow = rNumericArgs(6); thisVrfTU.NoCoolHeatOutAirVolFlow = rNumericArgs(7); - thisVrfTU.FanOpModeSchedPtr = GetScheduleIndex(state, cAlphaArgs(5)); - // default to constant fan operating mode - if (thisVrfTU.FanOpModeSchedPtr == 0) { - if (!lAlphaFieldBlanks(5)) { - ShowSevereError(state, cCurrentModuleObject + " = " + thisVrfTU.Name); - ShowContinueError(state, "..." + cAlphaFieldNames(5) + " = " + cAlphaArgs(5) + " not found."); - ShowContinueError(state, "...Defaulting to constant fan operating mode and simulation continues."); - } + if (lAlphaFieldBlanks(5)) { + thisVrfTU.fanOp = HVAC::FanOp::Continuous; + } else if ((thisVrfTU.fanOpModeSched = Sched::GetSchedule(state, cAlphaArgs(5))) == nullptr) { + ShowWarningItemNotFound( + state, eoh, cAlphaFieldNames(5), cAlphaArgs(5), "Defaulting to constant fan operating mode and simulation continues."); thisVrfTU.fanOp = HVAC::FanOp::Continuous; } @@ -3422,16 +3391,21 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) thisVrfTU.ActualFanVolFlowRate = FanVolFlowRate; int FanInletNodeNum = fan->inletNodeNum; int FanOutletNodeNum = fan->outletNodeNum; - thisVrfTU.FanAvailSchedPtr = fan->availSchedNum; + thisVrfTU.fanAvailSched = fan->availSched; // Check fan's schedule for cycling fan operation if constant volume fan is used - if (thisVrfTU.FanOpModeSchedPtr > 0 && thisVrfTU.fanType == HVAC::FanType::Constant) { - if (!CheckScheduleValueMinMax(state, thisVrfTU.FanOpModeSchedPtr, ">", 0.0, "<=", 1.0)) { - ShowSevereError(state, cCurrentModuleObject + " = " + thisVrfTU.Name); - ShowContinueError(state, format("For fan type = {}", HVAC::fanTypeNames[(int)HVAC::FanType::Constant])); - ShowContinueError(state, "Fan operating mode must be continuous (fan operating mode schedule values > 0)."); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFieldNames(5), cAlphaArgs(5))); - ShowContinueError(state, "...schedule values must be (>0., <=1.)"); + if (thisVrfTU.fanOpModeSched != nullptr && thisVrfTU.fanType == HVAC::FanType::Constant) { + if (!thisVrfTU.fanOpModeSched->checkMinMaxVals(state, Clusive::Ex, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, + eoh, + cAlphaFieldNames(5), + cAlphaArgs(5), + Clusive::Ex, + 0.0, + Clusive::In, + 1.0, + format("For fan type = {}, operating mode must be continuous (schedule values > 0).", + HVAC::fanTypeNames[(int)HVAC::FanType::Constant])); ErrorsFound = true; } } // IF (FanType_Num == HVAC::FanType_SimpleOnOff .OR. FanType_Num == HVAC::FanType_SimpleConstVolume)THEN @@ -3447,6 +3421,8 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) } else { thisVrfTU.fanPlace = HVAC::FanPlace::Invalid; // reset fan placement when fan is not used so as not to call the fan + thisVrfTU.fanAvailSched = + Sched::GetScheduleAlwaysOn(state); // A missing fan is the same as a fan that is always on for availability purposes } // Get OA mixer data @@ -3492,8 +3468,8 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) if (Util::SameString(HVAC::cAllCoilTypes(thisVrfTU.DXCoolCoilType_Num), HVAC::cAllCoilTypes(HVAC::CoilVRF_FluidTCtrl_Cooling))) { errFlag = false; if (thisVrfTU.TUListIndex > 0 && thisVrfTU.IndexToTUInTUList > 0) { - state.dataHVACVarRefFlow->TerminalUnitList(thisVrfTU.TUListIndex).CoolingCoilAvailSchPtr(thisVrfTU.IndexToTUInTUList) = - GetDXCoilAvailSchPtr(state, DXCoolingCoilType, cAlphaArgs(12), errFlag); + state.dataHVACVarRefFlow->TerminalUnitList(thisVrfTU.TUListIndex).coolingCoilAvailScheds(thisVrfTU.IndexToTUInTUList) = + DXCoils::GetDXCoilAvailSched(state, DXCoolingCoilType, cAlphaArgs(12), errFlag); } GetDXCoilIndex( state, cAlphaArgs(12), thisVrfTU.CoolCoilIndex, errFlag, HVAC::cAllCoilTypes(HVAC::CoilVRF_FluidTCtrl_Cooling)); @@ -3573,8 +3549,8 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) if (Util::SameString(HVAC::cAllCoilTypes(thisVrfTU.DXCoolCoilType_Num), HVAC::cAllCoilTypes(HVAC::CoilVRF_Cooling))) { if (thisVrfTU.TUListIndex > 0 && thisVrfTU.IndexToTUInTUList > 0) { - state.dataHVACVarRefFlow->TerminalUnitList(thisVrfTU.TUListIndex).CoolingCoilAvailSchPtr(thisVrfTU.IndexToTUInTUList) = - GetDXCoilAvailSchPtr(state, DXCoolingCoilType, cAlphaArgs(12), errFlag); + state.dataHVACVarRefFlow->TerminalUnitList(thisVrfTU.TUListIndex).coolingCoilAvailScheds(thisVrfTU.IndexToTUInTUList) = + DXCoils::GetDXCoilAvailSched(state, DXCoolingCoilType, cAlphaArgs(12), errFlag); } else { thisVrfTU.CoolingCoilPresent = false; } @@ -3651,8 +3627,8 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) if (Util::SameString(HVAC::cAllCoilTypes(thisVrfTU.DXHeatCoilType_Num), HVAC::cAllCoilTypes(HVAC::CoilVRF_FluidTCtrl_Heating))) { errFlag = false; if (thisVrfTU.TUListIndex > 0 && thisVrfTU.IndexToTUInTUList > 0) { - state.dataHVACVarRefFlow->TerminalUnitList(thisVrfTU.TUListIndex).HeatingCoilAvailSchPtr(thisVrfTU.IndexToTUInTUList) = - GetDXCoilAvailSchPtr(state, DXHeatingCoilType, cAlphaArgs(14), errFlag); + state.dataHVACVarRefFlow->TerminalUnitList(thisVrfTU.TUListIndex).heatingCoilAvailScheds(thisVrfTU.IndexToTUInTUList) = + DXCoils::GetDXCoilAvailSched(state, DXHeatingCoilType, cAlphaArgs(14), errFlag); } GetDXCoilIndex( state, cAlphaArgs(14), thisVrfTU.HeatCoilIndex, errFlag, HVAC::cAllCoilTypes(HVAC::CoilVRF_FluidTCtrl_Heating)); @@ -3891,8 +3867,8 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) // Algorithm Type: VRF model based on system curve if (Util::SameString(HVAC::cAllCoilTypes(thisVrfTU.DXHeatCoilType_Num), HVAC::cAllCoilTypes(HVAC::CoilVRF_Heating))) { if (thisVrfTU.TUListIndex > 0 && thisVrfTU.IndexToTUInTUList > 0) { - state.dataHVACVarRefFlow->TerminalUnitList(thisVrfTU.TUListIndex).HeatingCoilAvailSchPtr(thisVrfTU.IndexToTUInTUList) = - GetDXCoilAvailSchPtr(state, DXHeatingCoilType, cAlphaArgs(14), errFlag); + state.dataHVACVarRefFlow->TerminalUnitList(thisVrfTU.TUListIndex).heatingCoilAvailScheds(thisVrfTU.IndexToTUInTUList) = + DXCoils::GetDXCoilAvailSched(state, DXHeatingCoilType, cAlphaArgs(14), errFlag); } else { thisVrfTU.HeatingCoilPresent = false; } @@ -4278,9 +4254,8 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) // Get the supplemental heating coil steam max volume flow rate thisVrfTU.SuppHeatCoilFluidMaxFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, thisVrfTU.SuppHeatCoilIndex, errFlag); if (thisVrfTU.SuppHeatCoilFluidMaxFlow > 0.0) { - int SteamIndex = 0; // fluid type index of 0 is passed if steam Real64 TempSteamIn = 100.0; - Real64 SteamDensity = FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, RoutineName); + Real64 SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, RoutineName); thisVrfTU.SuppHeatCoilFluidMaxFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, thisVrfTU.SuppHeatCoilIndex, errFlag) * SteamDensity; } @@ -5509,7 +5484,6 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool using DataZoneEquipment::CheckZoneEquipmentList; using PlantUtilities::InitComponentNodes; - using ScheduleManager::GetCurrentScheduleValue; using SingleDuct::SimATMixer; static constexpr std::string_view RoutineName("InitVRF"); @@ -5641,12 +5615,8 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool state, "Coil:Heating:Water", state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, ErrorsFound); if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow > 0.0) { - rho = FluidProperties::GetDensityGlycol( - state, - state.dataPlnt->PlantLoop(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilPlantLoc.loopNum) + .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow * rho; } @@ -5675,9 +5645,8 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex, ErrorsFound); if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow > 0.0) { - int SteamIndex = 0; // fluid type index of 0 is passed if steam Real64 TempSteamIn = 100.0; - Real64 SteamDensity = FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, RoutineName); + Real64 SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, RoutineName); state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow * SteamDensity; } @@ -5968,9 +5937,8 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool state.dataHVACVarRefFlow->VRFTU(TUIndex).ZoneAirNode == 0) { // TU must be set point controlled and use constant fan mode (or coil out T won't change with PLR/air flow) state.dataHVACVarRefFlow->VRFTU(TUIndex).isSetPointControlled = true; - if (state.dataHVACVarRefFlow->VRFTU(TUIndex).FanOpModeSchedPtr > 0) { - if (ScheduleManager::GetScheduleMinValue(state, state.dataHVACVarRefFlow->VRFTU(TUIndex).FanOpModeSchedPtr) == - 0.0) { + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).fanOpModeSched != nullptr) { + if (state.dataHVACVarRefFlow->VRFTU(TUIndex).fanOpModeSched->getCurrentVal() == 0.0) { ShowSevereError(state, format("{} = {}", tuTypeNames[(int)state.dataHVACVarRefFlow->VRFTU(TUIndex).type], @@ -5978,11 +5946,9 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool ShowContinueError(state, "When using set point control, fan operating mode must be continuous (fan " "operating mode schedule values > 0)."); - ShowContinueError( - state, - format("Error found in Supply Air Fan Operating Mode Schedule Name = {}", - state.dataScheduleMgr->Schedule(state.dataHVACVarRefFlow->VRFTU(TUIndex).FanOpModeSchedPtr) - .Name)); + ShowContinueError(state, + format("Error found in Supply Air Fan Operating Mode Schedule Name = {}", + state.dataHVACVarRefFlow->VRFTU(TUIndex).fanOpModeSched->Name)); ShowContinueError(state, "...schedule values must be (>0., <=1.)"); ErrorsFound = true; } @@ -6254,12 +6220,8 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool state.dataHVACVarRefFlow->MyEnvrnFlag(VRFTUNum) = false; if (state.dataHVACVarRefFlow->VRF(VRFCond).CondenserType == DataHeatBalance::RefrigCondenserType::Water) { - rho = - FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(state.dataHVACVarRefFlow->VRF(VRFCond).SourcePlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(state.dataHVACVarRefFlow->VRF(VRFCond).SourcePlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(state.dataHVACVarRefFlow->VRF(VRFCond).SourcePlantLoc.loopNum) + .glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); state.dataHVACVarRefFlow->VRF(VRFCond).WaterCondenserDesignMassFlow = state.dataHVACVarRefFlow->VRF(VRFCond).WaterCondVolFlowRate * rho; InitComponentNodes(state, @@ -6286,12 +6248,8 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool Real64 CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate( state, "Coil:Heating:Water", state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilName, ErrorsFound); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - rho = FluidProperties::GetDensityGlycol( - state, - state.dataPlnt->PlantLoop(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilPlantLoc.loopNum) + .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = CoilMaxVolFlowRate * rho; } } @@ -6308,9 +6266,8 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool Real64 CoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilIndex, ErrorsFound); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - int SteamIndex = 0; // fluid type index of 0 is passed if steam Real64 TempSteamIn = 100.0; - Real64 SteamDensity = FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, RoutineName); + Real64 SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, RoutineName); state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow = CoilMaxVolFlowRate * SteamDensity; } } @@ -6601,8 +6558,8 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool TimeStepSysLast = state.dataHVACGlobal->TimeStepSys; state.dataHVACVarRefFlow->CurrentEndTimeLast = CurrentEndTime; - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr > 0) { - if (GetCurrentScheduleValue(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr) == 0.0) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOpModeSched != nullptr) { + if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOpModeSched->getCurrentVal() == 0.0) { state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOp = HVAC::FanOp::Cycling; } else { state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOp = HVAC::FanOp::Continuous; @@ -6610,7 +6567,7 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool } // if condenser is off, all terminal unit coils are off - if (GetCurrentScheduleValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).SchedPtr) == 0.0) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).availSched->getCurrentVal() == 0.0) { state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false; state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false; } else { @@ -6947,10 +6904,8 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool // If the net cooling capacity overshoots the heating setpoint count as heating load if (TempOutput < LoadToHeatingSP) { // Don't count as heating load unless mode is allowed. Also check for floating zone. - if (state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != - HVAC::ThermostatType::SingleCooling && - state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != - HVAC::ThermostatType::Uncontrolled) { + if (state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != HVAC::SetptType::SingleCool && + state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != HVAC::SetptType::Uncontrolled) { if (!state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) { // system last operated in cooling mode, change air flows and repeat coil off capacity test if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { @@ -7004,10 +6959,8 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool // If the net heating capacity overshoots the cooling setpoint count as cooling load if (TempOutput > LoadToCoolingSP) { // Don't count as cooling load unless mode is allowed. Also check for floating zone. - if (state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != - HVAC::ThermostatType::SingleHeating && - state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != - HVAC::ThermostatType::Uncontrolled) { + if (state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != HVAC::SetptType::SingleHeat && + state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != HVAC::SetptType::Uncontrolled) { if (!state.dataHVACVarRefFlow->LastModeCooling(VRFCond)) { if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = @@ -7045,10 +6998,8 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool } } else if (TempOutput < LoadToHeatingSP) { // Don't count as heating load unless mode is allowed. Also check for floating zone. - if (state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != - HVAC::ThermostatType::SingleCooling && - state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != - HVAC::ThermostatType::Uncontrolled) { + if (state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != HVAC::SetptType::SingleCool && + state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != HVAC::SetptType::Uncontrolled) { if (!state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) { if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = @@ -7100,8 +7051,8 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool } else if (TempOutput > 0.0 && LoadToCoolingSP < 0.0) { // If the net heating capacity overshoots the cooling setpoint count as cooling load // Don't count as cooling load unless mode is allowed. Also check for floating zone. - if (state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != HVAC::ThermostatType::SingleHeating && - state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != HVAC::ThermostatType::Uncontrolled) { + if (state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != HVAC::SetptType::SingleHeat && + state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != HVAC::SetptType::Uncontrolled) { if (!state.dataHVACVarRefFlow->LastModeCooling(VRFCond)) { if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRetNodeNum).MassFlowRate = @@ -7143,8 +7094,8 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool // see if the terminal unit operation will exceed the setpoint } else if (TempOutput < 0.0 && LoadToHeatingSP > 0.0) { // Don't count as heating load unless mode is allowed. Also check for floating zone. - if (state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != HVAC::ThermostatType::SingleCooling && - state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != HVAC::ThermostatType::Uncontrolled) { + if (state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != HVAC::SetptType::SingleCool && + state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != HVAC::SetptType::Uncontrolled) { if (!state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) { // system last operated in cooling mode, change air flows and repeat coil off capacity test if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).OAMixerUsed) { @@ -7988,7 +7939,6 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum) FieldNum = 3; // N3, \field Supply Air Flow Rate During Heating Operation SizingString = state.dataHVACVarRefFlow->VRFTUNumericFields(VRFTUNum).FieldNames(FieldNum) + " [m3/s]"; - int SizingMethod = HeatingAirflowSizing; // either this isn't needed or needs to be assigned to EqSizing TempSize = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).MaxHeatAirVolFlow; errorsFound = false; HeatingAirFlowSizer sizingHeatingAirFlow; @@ -8897,17 +8847,11 @@ void VRFCondenserEquipment::SizeVRFCondenser(EnergyPlusData &state) int PltSizCondNum = 0; if (this->SourcePlantLoc.loopNum > 0) PltSizCondNum = state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).PlantSizNum; if (PltSizCondNum > 0) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName, - state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex, - RoutineName); - - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName, - state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum) + .glycol->getDensity(state, state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, RoutineName); + + Cp = state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, RoutineName); tmpCondVolFlowRate = max(this->CoolingCapacity, this->HeatingCapacity) / (state.dataSize->PlantSizData(PltSizCondNum).DeltaT * Cp * rho); if (this->HeatingCapacity != DataSizing::AutoSize && this->CoolingCapacity != DataSizing::AutoSize) { @@ -8919,11 +8863,7 @@ void VRFCondenserEquipment::SizeVRFCondenser(EnergyPlusData &state) this->WaterCondVolFlowRate); } - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); this->WaterCondenserDesignMassFlow = this->WaterCondVolFlowRate * rho; PlantUtilities::InitComponentNodes( state, 0.0, this->WaterCondenserDesignMassFlow, this->CondenserNodeNum, this->CondenserOutletNodeNum); @@ -9029,7 +8969,7 @@ void VRFTerminalUnitEquipment::ControlVRF(EnergyPlusData &state, // The RETURNS here will jump back to SimVRF where the CalcVRF routine will simulate with latest PLR // do nothing else if TU is scheduled off - if (ScheduleManager::GetCurrentScheduleValue(state, this->SchedPtr) == 0.0) return; + if (this->availSched->getCurrentVal() == 0.0) return; // do nothing if TU has no load (TU will be modeled using PLR=0) if (QZnReq == 0.0) return; @@ -9886,8 +9826,8 @@ void SetAverageAirFlow(EnergyPlusData &state, // PURPOSE OF THIS SUBROUTINE: // Set the average air mass flow rates using the part load fraction of the heat pump for this time step // Set OnOffAirFlowRatio to be used by DX coils - - using ScheduleManager::GetCurrentScheduleValue; + auto &s_vrf = state.dataHVACVarRefFlow; + auto &vrfTu = s_vrf->VRFTU(VRFTUNum); int InletNode; // inlet node number int OutsideAirNode; // outside air node number @@ -9895,77 +9835,56 @@ void SetAverageAirFlow(EnergyPlusData &state, Real64 AverageUnitMassFlow(0.0); // average supply air mass flow rate over time step Real64 AverageOAMassFlow(0.0); // average outdoor air mass flow rate over time step - InletNode = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum; - OutsideAirNode = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum; - AirRelNode = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOAMixerRelNodeNum; + InletNode = vrfTu.VRFTUInletNodeNum; + OutsideAirNode = vrfTu.VRFTUOAMixerOANodeNum; + AirRelNode = vrfTu.VRFTUOAMixerRelNodeNum; - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOp == HVAC::FanOp::Cycling && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum == 0) { + if (vrfTu.fanOp == HVAC::FanOp::Cycling && vrfTu.SpeedNum == 0) { Real64 partLoadRat = PartLoadRatio; - if (partLoadRat == 0.0 && state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatPartLoadRatio > 0.0) { - partLoadRat = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatPartLoadRatio; + if (partLoadRat == 0.0 && vrfTu.SuppHeatPartLoadRatio > 0.0) { + partLoadRat = vrfTu.SuppHeatPartLoadRatio; + } + AverageUnitMassFlow = (partLoadRat * s_vrf->CompOnMassFlow) + ((1 - partLoadRat) * s_vrf->CompOffMassFlow); + AverageOAMassFlow = (partLoadRat * s_vrf->OACompOnMassFlow) + ((1 - partLoadRat) * s_vrf->OACompOffMassFlow); + } else if (vrfTu.SpeedNum == 0) { + if (PartLoadRatio == 0.0) { + // set the average OA air flow to off compressor values if the compressor PartLoadRatio is zero + AverageUnitMassFlow = s_vrf->CompOffMassFlow; + AverageOAMassFlow = s_vrf->OACompOffMassFlow; + } else { + AverageUnitMassFlow = s_vrf->CompOnMassFlow; + AverageOAMassFlow = s_vrf->OACompOnMassFlow; + } + } else if (vrfTu.SpeedNum == 1) { + if (s_vrf->CoolingLoad(vrfTu.VRFSysNum)) { + AverageUnitMassFlow = vrfTu.CoolMassFlowRate[vrfTu.SpeedNum] * PartLoadRatio + (1.0 - PartLoadRatio) * s_vrf->CompOffMassFlow; + } else if (s_vrf->HeatingLoad(vrfTu.VRFSysNum)) { + AverageUnitMassFlow = vrfTu.HeatMassFlowRate[vrfTu.SpeedNum] * PartLoadRatio + (1.0 - PartLoadRatio) * s_vrf->CompOffMassFlow; } + } else if (s_vrf->CoolingLoad(vrfTu.VRFSysNum)) { AverageUnitMassFlow = - (partLoadRat * state.dataHVACVarRefFlow->CompOnMassFlow) + ((1 - partLoadRat) * state.dataHVACVarRefFlow->CompOffMassFlow); - AverageOAMassFlow = - (partLoadRat * state.dataHVACVarRefFlow->OACompOnMassFlow) + ((1 - partLoadRat) * state.dataHVACVarRefFlow->OACompOffMassFlow); - } else { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum == 0) { - if (PartLoadRatio == 0.0) { - // set the average OA air flow to off compressor values if the compressor PartLoadRatio is zero - AverageUnitMassFlow = state.dataHVACVarRefFlow->CompOffMassFlow; - AverageOAMassFlow = state.dataHVACVarRefFlow->OACompOffMassFlow; - } else { - AverageUnitMassFlow = state.dataHVACVarRefFlow->CompOnMassFlow; - AverageOAMassFlow = state.dataHVACVarRefFlow->OACompOnMassFlow; - } - } else { - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum == 1) { - if (state.dataHVACVarRefFlow->CoolingLoad(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum)) { - AverageUnitMassFlow = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum] * - PartLoadRatio + - (1.0 - PartLoadRatio) * state.dataHVACVarRefFlow->CompOffMassFlow; - } else if (state.dataHVACVarRefFlow->HeatingLoad(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum)) { - AverageUnitMassFlow = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum] * - PartLoadRatio + - (1.0 - PartLoadRatio) * state.dataHVACVarRefFlow->CompOffMassFlow; - } - } else { - if (state.dataHVACVarRefFlow->CoolingLoad(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum)) { - AverageUnitMassFlow = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum] * - PartLoadRatio + - (1.0 - PartLoadRatio) * - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum - 1]; - } else if (state.dataHVACVarRefFlow->HeatingLoad(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFSysNum)) { - AverageUnitMassFlow = - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum] * - PartLoadRatio + - (1.0 - PartLoadRatio) * - state.dataHVACVarRefFlow->VRFTU(VRFTUNum).HeatMassFlowRate[state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum - 1]; - } - } - } - } - if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SpeedNum == 0) { - if (state.dataHVACVarRefFlow->CompOffFlowRatio > 0.0) { - state.dataHVACVarRefFlow->FanSpeedRatio = - (PartLoadRatio * state.dataHVACVarRefFlow->CompOnFlowRatio) + ((1 - PartLoadRatio) * state.dataHVACVarRefFlow->CompOffFlowRatio); + vrfTu.CoolMassFlowRate[vrfTu.SpeedNum] * PartLoadRatio + (1.0 - PartLoadRatio) * vrfTu.CoolMassFlowRate[vrfTu.SpeedNum - 1]; + } else if (s_vrf->HeatingLoad(vrfTu.VRFSysNum)) { + AverageUnitMassFlow = + vrfTu.HeatMassFlowRate[vrfTu.SpeedNum] * PartLoadRatio + (1.0 - PartLoadRatio) * vrfTu.HeatMassFlowRate[vrfTu.SpeedNum - 1]; + } + + if (vrfTu.SpeedNum == 0) { + if (s_vrf->CompOffFlowRatio > 0.0) { + s_vrf->FanSpeedRatio = (PartLoadRatio * s_vrf->CompOnFlowRatio) + ((1 - PartLoadRatio) * s_vrf->CompOffFlowRatio); } else { - state.dataHVACVarRefFlow->FanSpeedRatio = state.dataHVACVarRefFlow->CompOnFlowRatio; + s_vrf->FanSpeedRatio = s_vrf->CompOnFlowRatio; } } // if the terminal unit and fan are scheduled on then set flow rate - if (GetCurrentScheduleValue(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr) > 0.0 && - (GetCurrentScheduleValue(state, state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr) > 0.0 || state.dataHVACGlobal->TurnFansOn) && + if (vrfTu.availSched->getCurrentVal() > 0.0 && (vrfTu.fanAvailSched->getCurrentVal() > 0.0 || state.dataHVACGlobal->TurnFansOn) && !state.dataHVACGlobal->TurnFansOff) { // so for sure OA system TUs should use inlet node flow rate, don't overwrite inlet node flow rate // could there be a reason for air loops to use inlet node flow? Possibly when VAV TUs used? - if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInOASys) state.dataLoopNodes->Node(InletNode).MassFlowRate = AverageUnitMassFlow; - if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInOASys) state.dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail = AverageUnitMassFlow; + if (!vrfTu.isInOASys) state.dataLoopNodes->Node(InletNode).MassFlowRate = AverageUnitMassFlow; + if (!vrfTu.isInOASys) state.dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail = AverageUnitMassFlow; if (OutsideAirNode > 0) { state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate = AverageOAMassFlow; state.dataLoopNodes->Node(OutsideAirNode).MassFlowRateMaxAvail = AverageOAMassFlow; @@ -9973,14 +9892,13 @@ void SetAverageAirFlow(EnergyPlusData &state, state.dataLoopNodes->Node(AirRelNode).MassFlowRateMaxAvail = AverageOAMassFlow; } if (AverageUnitMassFlow > 0.0) { - OnOffAirFlowRatio = state.dataHVACVarRefFlow->CompOnMassFlow / AverageUnitMassFlow; + OnOffAirFlowRatio = s_vrf->CompOnMassFlow / AverageUnitMassFlow; } else { OnOffAirFlowRatio = 0.0; } } else { // terminal unit and/or fan is off - - if (!state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isInOASys) { + if (!vrfTu.isInOASys) { state.dataLoopNodes->Node(InletNode).MassFlowRate = 0.0; OnOffAirFlowRatio = 0.0; } @@ -10009,8 +9927,6 @@ void InitializeOperatingMode(EnergyPlusData &state, // Scans each zone coil and determines the load based on control // Moved from Init to clean up and localize code segments - using ScheduleManager::GetCurrentScheduleValue; - Real64 ZoneDeltaT; // zone temperature difference from setpoint Real64 SPTempHi; // thermostat setpoint high Real64 SPTempLo; // thermostat setpoint low @@ -10049,7 +9965,7 @@ void InitializeOperatingMode(EnergyPlusData &state, // check to see if coil is present if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).CoolingCoilPresent(NumTU)) { // now check to see if coil is scheduled off - if (GetCurrentScheduleValue(state, state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).CoolingCoilAvailSchPtr(NumTU)) > 0.0) { + if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).coolingCoilAvailScheds(NumTU)->getCurrentVal() > 0.0) { state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).CoolingCoilAvailable(NumTU) = true; } } @@ -10057,7 +9973,7 @@ void InitializeOperatingMode(EnergyPlusData &state, // check to see if coil is present if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).HeatingCoilPresent(NumTU)) { // now check to see if coil is scheduled off - if (GetCurrentScheduleValue(state, state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).HeatingCoilAvailSchPtr(NumTU)) > 0.0) { + if (state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).heatingCoilAvailScheds(NumTU)->getCurrentVal() > 0.0) { state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).HeatingCoilAvailable(NumTU) = true; } } @@ -10166,24 +10082,25 @@ void InitializeOperatingMode(EnergyPlusData &state, // for TSTATPriority, just check difference between zone temp and thermostat setpoint if (ThisZoneNum > 0) { auto const &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ThisZoneNum); - SPTempHi = state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ThisZoneNum); - SPTempLo = state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ThisZoneNum); + auto const &zoneTstatSetpt = state.dataHeatBalFanSys->zoneTstatSetpts(ThisZoneNum); + SPTempHi = zoneTstatSetpt.setptHi; + SPTempLo = zoneTstatSetpt.setptLo; switch (state.dataHeatBalFanSys->TempControlType(ThisZoneNum)) { - case HVAC::ThermostatType::Uncontrolled: + case HVAC::SetptType::Uncontrolled: // MaxDeltaT denotes cooling, MinDeltaT denotes heating break; - case HVAC::ThermostatType::SingleHeating: + case HVAC::SetptType::SingleHeat: // if heating load, ZoneDeltaT will be negative ZoneDeltaT = min(0.0, thisZoneHB.ZT - SPTempLo); state.dataHVACVarRefFlow->MinDeltaT(VRFCond) = min(state.dataHVACVarRefFlow->MinDeltaT(VRFCond), ZoneDeltaT); break; - case HVAC::ThermostatType::SingleCooling: + case HVAC::SetptType::SingleCool: // if cooling load, ZoneDeltaT will be positive ZoneDeltaT = max(0.0, thisZoneHB.ZT - SPTempHi); state.dataHVACVarRefFlow->MaxDeltaT(VRFCond) = max(state.dataHVACVarRefFlow->MaxDeltaT(VRFCond), ZoneDeltaT); break; - case HVAC::ThermostatType::SingleHeatCool: + case HVAC::SetptType::SingleHeatCool: ZoneDeltaT = thisZoneHB.ZT - SPTempHi; //- SPTempHi and SPTempLo are same value if (ZoneDeltaT > 0.0) { state.dataHVACVarRefFlow->MaxDeltaT(VRFCond) = max(state.dataHVACVarRefFlow->MaxDeltaT(VRFCond), ZoneDeltaT); @@ -10191,7 +10108,7 @@ void InitializeOperatingMode(EnergyPlusData &state, state.dataHVACVarRefFlow->MinDeltaT(VRFCond) = min(state.dataHVACVarRefFlow->MinDeltaT(VRFCond), ZoneDeltaT); } break; - case HVAC::ThermostatType::DualSetPointWithDeadBand: + case HVAC::SetptType::DualHeatCool: if (thisZoneHB.ZT - SPTempHi > 0.0) { ZoneDeltaT = max(0.0, thisZoneHB.ZT - SPTempHi); state.dataHVACVarRefFlow->MaxDeltaT(VRFCond) = max(state.dataHVACVarRefFlow->MaxDeltaT(VRFCond), ZoneDeltaT); @@ -10225,8 +10142,8 @@ void InitializeOperatingMode(EnergyPlusData &state, // If the net cooling capacity overshoots the heating setpoint count as heating load if (TempOutput < LoadToHeatingSP) { // Don't count as heating load unless mode is allowed. Also check for floating zone. - if (state.dataHeatBalFanSys->TempControlType(ThisZoneNum) != HVAC::ThermostatType::SingleCooling && - state.dataHeatBalFanSys->TempControlType(ThisZoneNum) != HVAC::ThermostatType::Uncontrolled) { + if (state.dataHeatBalFanSys->TempControlType(ThisZoneNum) != HVAC::SetptType::SingleCool && + state.dataHeatBalFanSys->TempControlType(ThisZoneNum) != HVAC::SetptType::Uncontrolled) { if (!state.dataHVACVarRefFlow->LastModeHeating(VRFCond)) { // if last mode was cooling, make sure heating flow rate is used if (state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerUsed) { @@ -10279,8 +10196,8 @@ void InitializeOperatingMode(EnergyPlusData &state, // If the net heating capacity overshoots the cooling setpoint count as cooling load if (TempOutput > LoadToCoolingSP) { // Don't count as cooling load unless mode is allowed. Also check for floating zone. - if (state.dataHeatBalFanSys->TempControlType(ThisZoneNum) != HVAC::ThermostatType::SingleHeating && - state.dataHeatBalFanSys->TempControlType(ThisZoneNum) != HVAC::ThermostatType::Uncontrolled) { + if (state.dataHeatBalFanSys->TempControlType(ThisZoneNum) != HVAC::SetptType::SingleHeat && + state.dataHeatBalFanSys->TempControlType(ThisZoneNum) != HVAC::SetptType::Uncontrolled) { if (!state.dataHVACVarRefFlow->LastModeCooling(VRFCond)) { if (state.dataHVACVarRefFlow->VRFTU(TUIndex).OAMixerUsed) { state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(TUIndex).VRFTUOAMixerRetNodeNum).MassFlowRate = @@ -10387,10 +10304,10 @@ void InitializeOperatingMode(EnergyPlusData &state, } } break; case ThermostatCtrlType::ScheduledPriority: { - if (GetCurrentScheduleValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).SchedPriorityPtr) == 0) { + if (state.dataHVACVarRefFlow->VRF(VRFCond).prioritySched->getCurrentVal() == 0) { state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = true; state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = false; - } else if (GetCurrentScheduleValue(state, state.dataHVACVarRefFlow->VRF(VRFCond).SchedPriorityPtr) == 1) { + } else if (state.dataHVACVarRefFlow->VRF(VRFCond).prioritySched->getCurrentVal() == 1) { state.dataHVACVarRefFlow->HeatingLoad(VRFCond) = false; state.dataHVACVarRefFlow->CoolingLoad(VRFCond) = true; } else { @@ -10764,19 +10681,16 @@ void getVRFTUZoneLoad( .SequencedOutputRequiredToHeatingSP(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).zoneSequenceHeatingNum) / state.dataHVACVarRefFlow->VRFTU(VRFTUNum).controlZoneMassFlowFrac; if (LoadToHeatingSP > 0.0 && LoadToCoolingSP > 0.0 && - state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != HVAC::ThermostatType::SingleCooling) { + state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != HVAC::SetptType::SingleCool) { zoneLoad = LoadToHeatingSP; } else if (LoadToHeatingSP > 0.0 && LoadToCoolingSP > 0.0 && - state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) == - HVAC::ThermostatType::SingleCooling) { + state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) == HVAC::SetptType::SingleCool) { zoneLoad = 0.0; } else if (LoadToHeatingSP < 0.0 && LoadToCoolingSP < 0.0 && - state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != - HVAC::ThermostatType::SingleHeating) { + state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) != HVAC::SetptType::SingleHeat) { zoneLoad = LoadToCoolingSP; } else if (LoadToHeatingSP < 0.0 && LoadToCoolingSP < 0.0 && - state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) == - HVAC::ThermostatType::SingleHeating) { + state.dataHeatBalFanSys->TempControlType(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum) == HVAC::SetptType::SingleHeat) { zoneLoad = 0.0; } else if (LoadToHeatingSP <= 0.0 && LoadToCoolingSP >= 0.0) { zoneLoad = 0.0; @@ -12373,7 +12287,6 @@ void VRFTerminalUnitEquipment::ControlVRF_FluidTCtrl(EnergyPlusData &state, // Use RegulaFalsi technique to iterate on part-load ratio until convergence is achieved. using General::SolveRoot; - using ScheduleManager::GetCurrentScheduleValue; int constexpr MaxIte(500); // maximum number of iterations Real64 constexpr MinPLF(0.0); // minimum part load factor allowed @@ -12409,7 +12322,7 @@ void VRFTerminalUnitEquipment::ControlVRF_FluidTCtrl(EnergyPlusData &state, // The RETURNS here will jump back to SimVRF where the CalcVRF routine will simulate with latest PLR // do nothing else if TU is scheduled off - if (GetCurrentScheduleValue(state, this->SchedPtr) == 0.0) return; + if (this->availSched->getCurrentVal() == 0.0) return; // Block the following statement: QZnReq==0 doesn't mean QCoilReq==0 due to possible OA mixer operation. zrp_201511 // do nothing if TU has no load (TU will be modeled using PLR=0) @@ -13700,35 +13613,68 @@ void VRFCondenserEquipment::VRFOU_CompSpd( } else { // Capacity to meet is for condenser - Q_cond_req = Q_req; - - for (CounterCompSpdTemp = 1; CounterCompSpdTemp <= NumOfCompSpdInput; CounterCompSpdTemp++) { - // Iteration to find the VRF speed that can meet the required load, Iteration DoName1 - - CompEvaporatingPWRSpd(CounterCompSpdTemp) = - this->RatedCompPower * CurveValue(state, this->OUCoolingPWRFT(CounterCompSpdTemp), T_discharge, T_suction); - CompEvaporatingCAPSpd(CounterCompSpdTemp) = - this->CoffEvapCap * this->RatedEvapCapacity * CurveValue(state, this->OUCoolingCAPFT(CounterCompSpdTemp), T_discharge, T_suction); - - Q_evap_req = Q_cond_req - CompEvaporatingPWRSpd(CounterCompSpdTemp); - - if (Q_evap_req * C_cap_operation <= CompEvaporatingCAPSpd(CounterCompSpdTemp)) { - // Compressor speed stage CounterCompSpdTemp need not to be increased, finish Iteration DoName1 - - if (CounterCompSpdTemp > 1) { + // derivation process + // let + // k be the speed level + // C be the short form for C_cap_operation + // PWR(.) be the short form of CompEvaporatingPWRSpd(.) + // CAP(.) be the short form of CompEvaporatingCAPSpd(.) + // spd(.) be the short form of this->CompressorSpeed(.) + // deltaPWR be PWR(k) - PWR(k - 1) + // deltaCAP be CAP(k) - CAP(k - 1) + // + // compressor heat = deltaPWR * r + PWR(k - 1) + // so + // Q_cond_req = Q_req = Q_evap_req + deltaPWR * r + PWR(k - 1) <---- eq 1 + // + // we also know this from the CompSpdActual calculation equation that + // CompSpdActual = Spd(k - 1) + deltaSpd / deltaCAP * (Q_evap_req * C - CAP(k - 1)) + // so we call the following r + // r = (Q_evap_req * C - CAP(k - 1)) / deltaCAP + // so + // CompSpdActual = Spd(k - 1) + deltaSpd * r + // + // arranging terms in eq 1 + // Q_cond_req - deltaPWR * r - PWR(k - 1) = Q_evap_req + // (Q_cond_req - deltaPWR * r - PWR(k - 1)) * C - CAP(k - 1) = Q_evap_req * C - CAP(k - 1) + // ((Q_cond_req - deltaPWR * r - PWR(k - 1)) * C - CAP(k - 1)) / deltaCAP = (Q_evap_req * C - CAP(k - 1)) / deltaCAP + // ((Q_cond_req - deltaPWR * r - PWR(k - 1)) * C - CAP(k - 1)) / deltaCAP = r + // (Q_cond_req - deltaPWR * r - PWR(k - 1)) * C - CAP(k - 1) = deltaCAP * r + // (Q_cond_req - PWR(k - 1)) * C - CAP(k - 1) = deltaCAP * r + deltaPWR * r * C + // so + // r = ((Q_cond_req - PWR(k - 1)) * C - CAP(k - 1)) / (deltaCAP + deltaPWR * C) + // = ((Q_cond_req - PWR(k - 1)) - CAP(k - 1)/C) / (deltaCAP/C + deltaPWR) + // + // in the special case where k = 1, then k - 1, PWR(k - 1) and CAP(k - 1) will all be 0 + // r = ((Q_cond_req) * C) / (CAP(1) - PWR(1) * C) + // = (Q_cond_req) / (CAP(1)/C - PWR(1)) - CompSpdLB = CounterCompSpdTemp - 1; - CompSpdUB = CounterCompSpdTemp; - - CompSpdActual = this->CompressorSpeed(CompSpdLB) + (this->CompressorSpeed(CompSpdUB) - this->CompressorSpeed(CompSpdLB)) / - (CompEvaporatingCAPSpd(CompSpdUB) - CompEvaporatingCAPSpd(CompSpdLB)) * - (Q_evap_req * C_cap_operation - CompEvaporatingCAPSpd(CompSpdLB)); + Q_cond_req = Q_req; - } else { - CompSpdActual = this->CompressorSpeed(1) * (Q_evap_req * C_cap_operation) / CompEvaporatingCAPSpd(1); + CounterCompSpdTemp = 1; + CompEvaporatingPWRSpd(1) = this->RatedCompPower * CurveValue(state, this->OUCoolingPWRFT(1), T_discharge, T_suction); + CompEvaporatingCAPSpd(1) = this->CoffEvapCap * this->RatedEvapCapacity * CurveValue(state, this->OUCoolingCAPFT(1), T_discharge, T_suction); + Real64 r = (Q_cond_req * C_cap_operation) / (CompEvaporatingCAPSpd(1) + CompEvaporatingPWRSpd(1) * C_cap_operation); + if (r < 1.0) { + CompSpdActual = this->CompressorSpeed(1) * r; + Q_evap_req = Q_cond_req - CompEvaporatingPWRSpd(1) * r; + } else { + for (CounterCompSpdTemp = 2; CounterCompSpdTemp <= NumOfCompSpdInput; CounterCompSpdTemp++) { + CompEvaporatingPWRSpd(CounterCompSpdTemp) = + this->RatedCompPower * CurveValue(state, this->OUCoolingPWRFT(CounterCompSpdTemp), T_discharge, T_suction); + CompEvaporatingCAPSpd(CounterCompSpdTemp) = + this->CoffEvapCap * this->RatedEvapCapacity * CurveValue(state, this->OUCoolingCAPFT(CounterCompSpdTemp), T_discharge, T_suction); + CompSpdLB = CounterCompSpdTemp - 1; + CompSpdUB = CounterCompSpdTemp; + Real64 deltaCAP = CompEvaporatingCAPSpd(CompSpdUB) - CompEvaporatingCAPSpd(CompSpdLB); + Real64 deltaPWR = CompEvaporatingPWRSpd(CompSpdUB) - CompEvaporatingPWRSpd(CompSpdLB); + Real64 r = ((Q_cond_req - CompEvaporatingPWRSpd(CompSpdLB)) * C_cap_operation - CompEvaporatingCAPSpd(CompSpdLB)) / + (deltaCAP + deltaPWR * C_cap_operation); + if (r < 1.0) { + CompSpdActual = this->CompressorSpeed(CompSpdLB) + (this->CompressorSpeed(CompSpdUB) - this->CompressorSpeed(CompSpdLB)) * r; + Q_evap_req = Q_cond_req - deltaPWR * r - CompEvaporatingPWRSpd(CompSpdLB); + break; } - - break; // EXIT DoName1 } } // End: Iteration DoName1 @@ -13740,13 +13686,13 @@ void VRFCondenserEquipment::VRFOU_CompSpd( void VRFCondenserEquipment::VRFOU_CompCap( EnergyPlusData &state, - int const CompSpdActual, // Given compressor speed - Real64 const T_suction, // Compressor suction temperature Te' [C] - Real64 const T_discharge, // Compressor discharge temperature Tc' [C] - Real64 const h_IU_evap_in, // Enthalpy of IU at inlet, for C_cap_operation calculation [kJ/kg] - Real64 const h_comp_in, // Enthalpy after piping loss (compressor inlet), for C_cap_operation calculation [kJ/kg] - Real64 &Q_c_tot, // Compressor evaporative capacity [W] - Real64 &Ncomp // Compressor power [W] + Real64 const CompSpdActual, // Given compressor speed + Real64 const T_suction, // Compressor suction temperature Te' [C] + Real64 const T_discharge, // Compressor discharge temperature Tc' [C] + Real64 const h_IU_evap_in, // Enthalpy of IU at inlet, for C_cap_operation calculation [kJ/kg] + Real64 const h_comp_in, // Enthalpy after piping loss (compressor inlet), for C_cap_operation calculation [kJ/kg] + Real64 &Q_c_tot, // Compressor evaporative capacity [W] + Real64 &Ncomp // Compressor power [W] ) { @@ -14934,7 +14880,7 @@ void VRFCondenserEquipment::VRFOU_PipeLossC( Pipe_Coe_k1 = Pipe_Num_Nu * Pipe_viscosity_ref; Pipe_Coe_k3 = RefPipInsH * (this->RefPipDiaSuc + 2 * this->RefPipInsThi); if (this->RefPipInsThi >= 0.0) { - Pipe_Coe_k2 = 2 * this->RefPipInsCon / std::log(1.0 + 2 * this->RefPipInsThi / this->RefPipDiaSuc); + Pipe_Coe_k2 = 2 * this->RefPipInsCon / std::log1p(2 * this->RefPipInsThi / this->RefPipDiaSuc); } else { Pipe_Coe_k2 = 9999.9; } diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.hh b/src/EnergyPlus/HVACVariableRefrigerantFlow.hh index 18069ff01e3..cb8cff12ab0 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.hh +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -129,8 +129,6 @@ namespace HVACVariableRefrigerantFlow { } } - constexpr const char *fluidNameSteam("STEAM"); - // Flag for hex operation enum class HXOpMode { @@ -159,7 +157,7 @@ namespace HVACVariableRefrigerantFlow { Real64 QCondenser; // Water condenser heat rejection/absorption (W) Real64 QCondEnergy; // Water condenser heat rejection/aborption energy (J) Real64 CondenserSideOutletTemp; // Water condenser outlet temp (C) - int SchedPtr; // Pointer to the correct schedule + Sched::Schedule *availSched = nullptr; // Pointer to the correct schedule // LOL Real64 CoolingCapacity; // Nominal VRF heat pump cooling capacity (W) Real64 TotalCoolingCapacity; // Nominal VRF heat pump cooling capacity (W) Real64 CoolingCombinationRatio; // Ratio or terminal unit cooling capacity to VRF condenser capacity @@ -205,7 +203,7 @@ namespace HVACVariableRefrigerantFlow { int MasterZonePtr; // index to master thermostat zone int MasterZoneTUIndex; // index to TU in master thermostat zone ThermostatCtrlType ThermostatPriority; // VRF priority control (1=LoadPriority, 2=ZonePriority, etc) - int SchedPriorityPtr; // VRF priority control schedule pointer + Sched::Schedule *prioritySched = nullptr; // VRF priority control schedule int ZoneTUListPtr; // index to zone terminal unit list bool HeatRecoveryUsed; // .TRUE. = heat recovery used Real64 VertPipeLngth; // vertical piping length (m) @@ -302,11 +300,11 @@ namespace HVACVariableRefrigerantFlow { Real64 CondensateVol; // amount of water condensed from air stream [m3] // end variables for water system interactions // begin variables for Basin Heater interactions - Real64 BasinHeaterPowerFTempDiff; // Basin heater capacity per degree C below setpoint (W/C) - Real64 BasinHeaterSetPointTemp; // setpoint temperature for basin heater operation (C) - Real64 BasinHeaterPower; // Basin heater power (W) - Real64 BasinHeaterConsumption; // Basin heater energy consumption (J) - int BasinHeaterSchedulePtr; // Pointer to basin heater schedule + Real64 BasinHeaterPowerFTempDiff; // Basin heater capacity per degree C below setpoint (W/C) + Real64 BasinHeaterSetPointTemp; // setpoint temperature for basin heater operation (C) + Real64 BasinHeaterPower; // Basin heater power (W) + Real64 BasinHeaterConsumption; // Basin heater energy consumption (J) + Sched::Schedule *basinHeaterSched = nullptr; // Pointer to basin heater schedule // end variables for Basin Heater interactions bool EMSOverrideHPOperatingMode; Real64 EMSValueForHPOperatingMode; @@ -359,7 +357,7 @@ namespace HVACVariableRefrigerantFlow { Real64 OUEvapHeatRate; // Outdoor Unit Evaporator Heat Extract Rate, excluding piping loss [W] Real64 OUFanPower; // Outdoor unit fan power at real conditions[W] std::string refrigName; // Name of refrigerant, must match name in FluidName (see fluidpropertiesrefdata.idf) - FluidProperties::RefrigProps *refrig; + Fluid::RefrigProps *refrig; Real64 RatedEvapCapacity; // Rated Evaporative Capacity [W] Real64 RatedHeatCapacity; // Rated Heating Capacity [W] Real64 RatedCompPower; // Rated Compressor Power [W] @@ -391,20 +389,19 @@ namespace HVACVariableRefrigerantFlow { VRFCondenserEquipment() : VRFSystemTypeNum(0), VRFAlgorithmType(AlgorithmType::Invalid), VRFType(DataPlant::PlantEquipmentType::Invalid), SourcePlantLoc{}, WaterCondenserDesignMassFlow(0.0), WaterCondenserMassFlow(0.0), QCondenser(0.0), QCondEnergy(0.0), CondenserSideOutletTemp(0.0), - SchedPtr(-1), CoolingCapacity(0.0), TotalCoolingCapacity(0.0), CoolingCombinationRatio(1.0), VRFCondPLR(0.0), VRFCondRTF(0.0), + CoolingCapacity(0.0), TotalCoolingCapacity(0.0), CoolingCombinationRatio(1.0), VRFCondPLR(0.0), VRFCondRTF(0.0), VRFCondCyclingRatio(0.0), CondenserInletTemp(0.0), CoolingCOP(0.0), OperatingCoolingCOP(0.0), RatedCoolingPower(0.0), HeatingCapacity(0.0), HeatingCapacitySizeRatio(1.0), LockHeatingCapacity(false), TotalHeatingCapacity(0.0), HeatingCombinationRatio(1.0), HeatingCOP(0.0), OperatingHeatingCOP(0.0), RatedHeatingPower(0.0), MinOATCooling(0.0), MaxOATCooling(0.0), MinOATHeating(0.0), MaxOATHeating(0.0), CoolCapFT(0), CoolEIRFT(0), HeatCapFT(0), HeatEIRFT(0), CoolBoundaryCurvePtr(0), HeatBoundaryCurvePtr(0), EIRCoolBoundaryCurvePtr(0), CoolEIRFPLR1(0), CoolEIRFPLR2(0), CoolCapFTHi(0), CoolEIRFTHi(0), HeatCapFTHi(0), HeatEIRFTHi(0), EIRHeatBoundaryCurvePtr(0), HeatEIRFPLR1(0), HeatEIRFPLR2(0), CoolPLFFPLR(0), HeatPLFFPLR(0), MinPLR(0.0), - MasterZonePtr(0), MasterZoneTUIndex(0), ThermostatPriority(ThermostatCtrlType::Invalid), SchedPriorityPtr(0), ZoneTUListPtr(0), - HeatRecoveryUsed(false), VertPipeLngth(0.0), PCFLengthCoolPtr(0), PCFHeightCool(0.0), EquivPipeLngthCool(0.0), - PipingCorrectionCooling(1.0), PCFLengthHeatPtr(0), PCFHeightHeat(0.0), EquivPipeLngthHeat(0.0), PipingCorrectionHeating(1.0), - CCHeaterPower(0.0), CompressorSizeRatio(0.0), NumCompressors(0), MaxOATCCHeater(0.0), DefrostEIRPtr(0), DefrostFraction(0.0), - DefrostStrategy(StandardRatings::DefrostStrat::Invalid), DefrostControl(StandardRatings::HPdefrostControl::Invalid), - DefrostCapacity(0.0), DefrostPower(0.0), DefrostConsumption(0.0), MaxOATDefrost(0.0), - CondenserType(DataHeatBalance::RefrigCondenserType::Invalid), CondenserNodeNum(0), SkipCondenserNodeNumCheck(false), + MasterZonePtr(0), MasterZoneTUIndex(0), ThermostatPriority(ThermostatCtrlType::Invalid), ZoneTUListPtr(0), HeatRecoveryUsed(false), + VertPipeLngth(0.0), PCFLengthCoolPtr(0), PCFHeightCool(0.0), EquivPipeLngthCool(0.0), PipingCorrectionCooling(1.0), PCFLengthHeatPtr(0), + PCFHeightHeat(0.0), EquivPipeLngthHeat(0.0), PipingCorrectionHeating(1.0), CCHeaterPower(0.0), CompressorSizeRatio(0.0), + NumCompressors(0), MaxOATCCHeater(0.0), DefrostEIRPtr(0), DefrostFraction(0.0), DefrostStrategy(StandardRatings::DefrostStrat::Invalid), + DefrostControl(StandardRatings::HPdefrostControl::Invalid), DefrostCapacity(0.0), DefrostPower(0.0), DefrostConsumption(0.0), + MaxOATDefrost(0.0), CondenserType(DataHeatBalance::RefrigCondenserType::Invalid), CondenserNodeNum(0), SkipCondenserNodeNumCheck(false), CondenserOutletNodeNum(0), WaterCondVolFlowRate(0.0), EvapCondEffectiveness(0.0), EvapCondAirVolFlowRate(0.0), EvapCondPumpPower(0.0), CoolCombRatioPTR(0), HeatCombRatioPTR(0), OperatingMode(0), ElecPower(0.0), ElecCoolingPower(0.0), ElecHeatingPower(0.0), CoolElecConsumption(0.0), HeatElecConsumption(0.0), CrankCaseHeaterPower(0.0), CrankCaseHeaterElecConsumption(0.0), @@ -416,12 +413,12 @@ namespace HVACVariableRefrigerantFlow { HRModeChange(false), HRTimer(0.0), HRTime(0.0), EvapWaterSupplyMode(EvapWaterSupply::FromMains), EvapWaterSupTankID(0), EvapWaterTankDemandARRID(0), CondensateTankID(0), CondensateTankSupplyARRID(0), CondensateVdot(0.0), CondensateVol(0.0), BasinHeaterPowerFTempDiff(0.0), BasinHeaterSetPointTemp(0.0), BasinHeaterPower(0.0), BasinHeaterConsumption(0.0), - BasinHeaterSchedulePtr(0), EMSOverrideHPOperatingMode(false), EMSValueForHPOperatingMode(0.0), HPOperatingModeErrorIndex(0), - VRFHeatRec(0.0), VRFHeatEnergyRec(0.0), AlgorithmIUCtrl(1), CondensingTemp(44.0), CondTempFixed(0.0), CoffEvapCap(1.0), - CompActSpeed(0.0), CompMaxDeltaP(0.0), C1Te(0.0), C2Te(0.0), C3Te(0.0), C1Tc(0.0), C2Tc(0.0), C3Tc(0.0), DiffOUTeTo(5), - EffCompInverter(0.95), EvaporatingTemp(6.0), EvapTempFixed(0.0), HROUHexRatio(0.0), IUEvaporatingTemp(6.0), IUCondensingTemp(44.0), - IUEvapTempLow(4.0), IUEvapTempHigh(15.0), IUCondTempLow(42.0), IUCondTempHigh(46.0), IUCondHeatRate(0.0), IUEvapHeatRate(0.0), - Ncomp(0.0), NcompCooling(0.0), NcompHeating(0.0), OUEvapTempLow(-30.0), OUEvapTempHigh(20.0), OUCondTempLow(30.0), OUCondTempHigh(96.0), + EMSOverrideHPOperatingMode(false), EMSValueForHPOperatingMode(0.0), HPOperatingModeErrorIndex(0), VRFHeatRec(0.0), + VRFHeatEnergyRec(0.0), AlgorithmIUCtrl(1), CondensingTemp(44.0), CondTempFixed(0.0), CoffEvapCap(1.0), CompActSpeed(0.0), + CompMaxDeltaP(0.0), C1Te(0.0), C2Te(0.0), C3Te(0.0), C1Tc(0.0), C2Tc(0.0), C3Tc(0.0), DiffOUTeTo(5), EffCompInverter(0.95), + EvaporatingTemp(6.0), EvapTempFixed(0.0), HROUHexRatio(0.0), IUEvaporatingTemp(6.0), IUCondensingTemp(44.0), IUEvapTempLow(4.0), + IUEvapTempHigh(15.0), IUCondTempLow(42.0), IUCondTempHigh(46.0), IUCondHeatRate(0.0), IUEvapHeatRate(0.0), Ncomp(0.0), + NcompCooling(0.0), NcompHeating(0.0), OUEvapTempLow(-30.0), OUEvapTempHigh(20.0), OUCondTempLow(30.0), OUCondTempHigh(96.0), OUAirFlowRate(0.0), OUAirFlowRatePerCapcity(0.0), OUCondHeatRate(0.0), OUEvapHeatRate(0.0), OUFanPower(0.0), RatedEvapCapacity(40000.0), RatedHeatCapacity(0.0), RatedCompPower(14000.0), RatedCompPowerPerCapcity(0.35), RatedOUFanPower(0.0), RatedOUFanPowerPerCapcity(0.0), RateBFOUEvap(0.45581), RateBFOUCond(0.21900), RefPipDiaSuc(0.0), RefPipDiaDis(0.0), RefPipLen(0.0), RefPipEquLen(0.0), RefPipHei(0.0), @@ -577,13 +574,13 @@ namespace HVACVariableRefrigerantFlow { ); void VRFOU_CompCap(EnergyPlusData &state, - int CompSpdActual, // Given compressor speed - Real64 T_suction, // Compressor suction temperature Te' [C] - Real64 T_discharge, // Compressor discharge temperature Tc' [C] - Real64 h_IU_evap_in, // Enthalpy of IU at inlet, for C_cap_operation calculation [kJ/kg] - Real64 h_comp_in, // Enthalpy after piping loss (compressor inlet), for C_cap_operation calculation [kJ/kg] - Real64 &Q_c_tot, // Compressor evaporative capacity [W] - Real64 &Ncomp // Compressor power [W] + Real64 CompSpdActual, // Given compressor speed + Real64 T_suction, // Compressor suction temperature Te' [C] + Real64 T_discharge, // Compressor discharge temperature Tc' [C] + Real64 h_IU_evap_in, // Enthalpy of IU at inlet, for C_cap_operation calculation [kJ/kg] + Real64 h_comp_in, // Enthalpy after piping loss (compressor inlet), for C_cap_operation calculation [kJ/kg] + Real64 &Q_c_tot, // Compressor evaporative capacity [W] + Real64 &Ncomp // Compressor power [W] ); void VRFOU_PipeLossC(EnergyPlusData &state, @@ -615,24 +612,24 @@ namespace HVACVariableRefrigerantFlow { struct TerminalUnitListData { // Members - std::string Name; // Name of the VRF Terminal Unit List - int NumTUInList; // Number of VRF Terminal Units in List - bool reset_isSimulatedFlags; // used to align simulate flags with order of each TU in simulation - Array1D_int ZoneTUPtr; // index to VRF Terminal Unit - Array1D_string ZoneTUName; // Name of the VRF Terminal Unit - Array1D_bool IsSimulated; // TRUE if TU has been simulated - Array1D TotalCoolLoad; // Total zone cooling coil load met by TU - Array1D TotalHeatLoad; // Total zone heating coil load met by TU - Array1D_bool CoolingCoilPresent; // FALSE if coil not present - Array1D_bool HeatingCoilPresent; // FALSE if coil not present - Array1D_bool SuppHeatingCoilPresent; // FALSE if supplemental heating coil not present - Array1D_bool TerminalUnitNotSizedYet; // TRUE if terminal unit not sized - Array1D_bool HRHeatRequest; // defines a heating load on VRFTerminalUnits when QZnReq < 0 - Array1D_bool HRCoolRequest; // defines a cooling load on VRFTerminalUnits when QZnReq > 0 - Array1D_bool CoolingCoilAvailable; // cooling coil availability scheduled on - Array1D_bool HeatingCoilAvailable; // cooling coil availability scheduled on - Array1D_int CoolingCoilAvailSchPtr; // cooling coil availability schedule index - Array1D_int HeatingCoilAvailSchPtr; // heating coil availability schedule index + std::string Name; // Name of the VRF Terminal Unit List + int NumTUInList; // Number of VRF Terminal Units in List + bool reset_isSimulatedFlags; // used to align simulate flags with order of each TU in simulation + Array1D_int ZoneTUPtr; // index to VRF Terminal Unit + Array1D_string ZoneTUName; // Name of the VRF Terminal Unit + Array1D_bool IsSimulated; // TRUE if TU has been simulated + Array1D TotalCoolLoad; // Total zone cooling coil load met by TU + Array1D TotalHeatLoad; // Total zone heating coil load met by TU + Array1D_bool CoolingCoilPresent; // FALSE if coil not present + Array1D_bool HeatingCoilPresent; // FALSE if coil not present + Array1D_bool SuppHeatingCoilPresent; // FALSE if supplemental heating coil not present + Array1D_bool TerminalUnitNotSizedYet; // TRUE if terminal unit not sized + Array1D_bool HRHeatRequest; // defines a heating load on VRFTerminalUnits when QZnReq < 0 + Array1D_bool HRCoolRequest; // defines a cooling load on VRFTerminalUnits when QZnReq > 0 + Array1D_bool CoolingCoilAvailable; // cooling coil availability scheduled on + Array1D_bool HeatingCoilAvailable; // cooling coil availability scheduled on + Array1D coolingCoilAvailScheds; // cooling coil availability schedule index + Array1D heatingCoilAvailScheds; // heating coil availability schedule index // Default Constructor TerminalUnitListData() : NumTUInList(0), reset_isSimulatedFlags(true) @@ -645,7 +642,7 @@ namespace HVACVariableRefrigerantFlow { // Members std::string Name; // Name of the VRF Terminal Unit TUType type = TUType::Invalid; // DataHVACGlobals VRF Terminal Unit type - int SchedPtr = -1; // Pointer to the correct schedule + Sched::Schedule *availSched = nullptr; // Pointer to the correct schedule // LOL // avail? int VRFSysNum = 0; // index to VRF Condenser int TUListIndex = 0; // index to VRF Terminal Unit List int IndexToTUInTUList = 0; // index to TU in VRF Terminal Unit List @@ -679,8 +676,8 @@ namespace HVACVariableRefrigerantFlow { Real64 SuppHeatPartLoadRatio = 0.0; // supplemental heating coil part load ratio Real64 SuppHeatingCoilLoad = 0.0; // supplemental heating coil heating load HVAC::FanType fanType = HVAC::FanType::Invalid; // index to fan type - int FanOpModeSchedPtr = 0; // Pointer to the correct fan operating mode schedule - int FanAvailSchedPtr = -1; // Pointer to the correct fan availability schedule + Sched::Schedule *fanOpModeSched = nullptr; // Pointer to the correct fan operating mode schedule + Sched::Schedule *fanAvailSched = nullptr; // Pointer to the correct fan availability schedule int FanIndex = 0; // Index to fan object Real64 FanPower = 0.0; // power reported by fan component HVAC::FanOp fanOp = HVAC::FanOp::Invalid; // operation mode: 1 = cycling fan, cycling coil 2 = constant fan, cycling coil @@ -1050,6 +1047,10 @@ struct HVACVarRefFlowData : BaseGlobalStruct EPVector TerminalUnitList; // zoneTerminalUnitList object EPVector VRFTUNumericFields; // holds VRF TU numeric input fields character field name + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/HWBaseboardRadiator.cc b/src/EnergyPlus/HWBaseboardRadiator.cc index c6ff41bfedc..148e3e91565 100644 --- a/src/EnergyPlus/HWBaseboardRadiator.cc +++ b/src/EnergyPlus/HWBaseboardRadiator.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -236,6 +236,8 @@ namespace HWBaseboardRadiator { // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetHWBaseboardInput:"); + static constexpr std::string_view routineName = "GetHWBaseboardInput"; + Real64 constexpr MaxFraction(1.0); Real64 constexpr MinFraction(0.0); Real64 constexpr MaxWaterTempAvg(150.0); // Maximum limit of average water temperature in degree C @@ -250,7 +252,7 @@ namespace HWBaseboardRadiator { int constexpr iHeatDesignCapacityNumericNum(3); // get input index to HW baseboard heating capacity int constexpr iHeatCapacityPerFloorAreaNumericNum(1); // get input index to HW baseboard heating capacity per floor area sizing int constexpr iHeatFracOfAutosizedCapacityNumericNum( - 2); // get input index to HW baseboard heating capacity sizing as fraction of autozized heating capacity + 2); // get input index to HW baseboard heating capacity sizing as fraction of autosized heating capacity // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int BaseboardNum; // Baseboard number @@ -439,6 +441,8 @@ namespace HWBaseboardRadiator { state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + ErrorObjectHeader eoh{routineName, cCMO_BBRadiator_Water, state.dataIPShortCut->cAlphaArgs(1)}; + HWBaseboardNumericFields.FieldNames.allocate(NumNumbers); HWBaseboardNumericFields.FieldNames = state.dataIPShortCut->cNumericFieldNames; @@ -456,19 +460,10 @@ namespace HWBaseboardRadiator { // Get schedule if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { - thisHWBaseboard.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisHWBaseboard.SchedPtr = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(3)); - if (thisHWBaseboard.SchedPtr == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}=\"{}\" not found.", - RoutineName, - cCMO_BBRadiator_Water, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); - ErrorsFound = true; - } + thisHWBaseboard.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisHWBaseboard.availSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3)); + ErrorsFound = true; } // Get inlet node number @@ -813,7 +808,7 @@ namespace HWBaseboardRadiator { // This subroutine initializes the baseboard units, and determines the UA values during simulation. // METHODOLOGY EMPLOYED: - // The initialization subrotines both in high temperature radiant radiator + // The initialization subroutines both in high temperature radiant radiator // and convective only baseboard radiator are combined and modified. In addition, // an UA value calculation by LMTD method is added. // The heater is assumed to be crossflow with both fluids unmixed. @@ -880,11 +875,7 @@ namespace HWBaseboardRadiator { // Initialize WaterInletNode = HWBaseboard.WaterInletNode; - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(HWBaseboard.plantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(HWBaseboard.plantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(HWBaseboard.plantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); HWBaseboard.WaterMassFlowRateMax = rho * HWBaseboard.WaterVolFlowRateMax; @@ -892,11 +883,8 @@ namespace HWBaseboardRadiator { state.dataLoopNodes->Node(WaterInletNode).Temp = 60.0; - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(HWBaseboard.plantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(WaterInletNode).Temp, - state.dataPlnt->PlantLoop(HWBaseboard.plantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(HWBaseboard.plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(WaterInletNode).Temp, RoutineName); state.dataLoopNodes->Node(WaterInletNode).Enthalpy = Cp * state.dataLoopNodes->Node(WaterInletNode).Temp; state.dataLoopNodes->Node(WaterInletNode).Quality = 0.0; @@ -1068,16 +1056,10 @@ namespace HWBaseboardRadiator { CheckZoneSizing(state, cCMO_BBRadiator_Water, hWBaseboard.Name); DesCoilLoad = RatedCapacityDes; if (DesCoilLoad >= HVAC::SmallLoad) { - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(hWBaseboard.plantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(hWBaseboard.plantLoc.loopNum).FluidIndex, - RoutineName); - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(hWBaseboard.plantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(hWBaseboard.plantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(hWBaseboard.plantLoc.loopNum) + .glycol->getSpecificHeat(state, Constant::HWInitConvTemp, RoutineName); + rho = + state.dataPlnt->PlantLoop(hWBaseboard.plantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); WaterVolFlowRateMaxDes = DesCoilLoad / (state.dataSize->PlantSizData(PltSizHeatNum).DeltaT * Cp * rho); } else { WaterVolFlowRateMaxDes = 0.0; @@ -1120,11 +1102,8 @@ namespace HWBaseboardRadiator { WaterMassFlowRateStd = hWBaseboard.WaterMassFlowRateStd; } else if (hWBaseboard.RatedCapacity == DataSizing::AutoSize || hWBaseboard.RatedCapacity == 0.0) { DesCoilLoad = RatedCapacityDes; - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(hWBaseboard.plantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(hWBaseboard.plantLoc.loopNum).FluidIndex, - RoutineNameFull); + rho = + state.dataPlnt->PlantLoop(hWBaseboard.plantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineNameFull); WaterMassFlowRateStd = hWBaseboard.WaterVolFlowRateMax * rho; } if (DesCoilLoad >= HVAC::SmallLoad) { @@ -1132,11 +1111,8 @@ namespace HWBaseboardRadiator { // Air mass flow rate is obtained from the following linear equation // m_dot = 0.0062 + 2.75e-05*q AirMassFlowRate = Constant + Coeff * DesCoilLoad; - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(hWBaseboard.plantLoc.loopNum).FluidName, - hWBaseboard.WaterTempAvg, - state.dataPlnt->PlantLoop(hWBaseboard.plantLoc.loopNum).FluidIndex, - RoutineName); + Cp = + state.dataPlnt->PlantLoop(hWBaseboard.plantLoc.loopNum).glycol->getSpecificHeat(state, hWBaseboard.WaterTempAvg, RoutineName); WaterInletTempStd = (DesCoilLoad / (2.0 * WaterMassFlowRateStd * Cp)) + hWBaseboard.WaterTempAvg; WaterOutletTempStd = std::abs((2.0 * hWBaseboard.WaterTempAvg) - WaterInletTempStd); AirOutletTempStd = (DesCoilLoad / (AirMassFlowRate * CPAirStd)) + AirInletTempStd; @@ -1173,7 +1149,7 @@ namespace HWBaseboardRadiator { BaseSizer::reportSizerOutput(state, cCMO_BBRadiator_Water, hWBaseboard.Name, "U-Factor times Area [W/C]", hWBaseboard.UA); } } else { - // if there is no heating Sizing:Plant object and autosizng was requested, issue an error message + // if there is no heating Sizing:Plant object and autosizing was requested, issue an error message if (hWBaseboard.WaterVolFlowRateMax == DataSizing::AutoSize || hWBaseboard.RatedCapacity == DataSizing::AutoSize || hWBaseboard.RatedCapacity == 0.0) { ShowSevereError(state, "Autosizing of hot water baseboard requires a heating loop Sizing:Plant object"); @@ -1188,11 +1164,7 @@ namespace HWBaseboardRadiator { WaterMassFlowRateStd = hWBaseboard.WaterMassFlowRateStd; // m_dot = 0.0062 + 2.75e-05*q AirMassFlowRate = Constant + Coeff * DesCoilLoad; - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(hWBaseboard.plantLoc.loopNum).FluidName, - hWBaseboard.WaterTempAvg, - state.dataPlnt->PlantLoop(hWBaseboard.plantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(hWBaseboard.plantLoc.loopNum).glycol->getSpecificHeat(state, hWBaseboard.WaterTempAvg, RoutineName); WaterInletTempStd = (DesCoilLoad / (2.0 * WaterMassFlowRateStd * Cp)) + hWBaseboard.WaterTempAvg; WaterOutletTempStd = std::abs((2.0 * hWBaseboard.WaterTempAvg) - WaterInletTempStd); AirOutletTempStd = (DesCoilLoad / (AirMassFlowRate * CPAirStd)) + AirInletTempStd; @@ -1246,7 +1218,7 @@ namespace HWBaseboardRadiator { // PURPOSE OF THIS SUBROUTINE: // This subroutine calculates both the convective and radiant heat transfer rate - // in a hot water baseboard heater. The heater is assumed to be crossflowwith + // in a hot water baseboard heater. The heater is assumed to be crossflow with // both fluids unmixed. The air flow is buoyancy driven and a constant airflow // and a constant airflow velocity of 0.5m/s is assumed. @@ -1284,8 +1256,8 @@ namespace HWBaseboardRadiator { Real64 WaterInletTemp = hWBaseboard.WaterInletTemp; Real64 WaterMassFlowRate = state.dataLoopNodes->Node(hWBaseboard.WaterInletNode).MassFlowRate; - if (QZnReq > HVAC::SmallLoad && !state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) && - (ScheduleManager::GetCurrentScheduleValue(state, hWBaseboard.SchedPtr) > 0) && (WaterMassFlowRate > 0.0)) { + if (QZnReq > HVAC::SmallLoad && !state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) && (hWBaseboard.availSched->getCurrentVal() > 0) && + (WaterMassFlowRate > 0.0)) { HWBaseboardDesignData const &HWBaseboardDesignDataObject{ state.dataHWBaseboardRad->HWBaseboardDesignObject(hWBaseboard.DesignObjectPtr)}; // Contains the data for the design object @@ -1293,11 +1265,7 @@ namespace HWBaseboardRadiator { // Calculate air mass flow rate AirMassFlowRate = hWBaseboard.AirMassFlowRateStd * (WaterMassFlowRate / hWBaseboard.WaterMassFlowRateMax); CapacitanceAir = Psychrometrics::PsyCpAirFnW(hWBaseboard.AirInletHumRat) * AirMassFlowRate; - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(hWBaseboard.plantLoc.loopNum).FluidName, - WaterInletTemp, - state.dataPlnt->PlantLoop(hWBaseboard.plantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(hWBaseboard.plantLoc.loopNum).glycol->getSpecificHeat(state, WaterInletTemp, RoutineName); CapacitanceWater = Cp * WaterMassFlowRate; CapacitanceMax = max(CapacitanceAir, CapacitanceWater); @@ -1391,7 +1359,7 @@ namespace HWBaseboardRadiator { // MODIFIED Aug 2007 Daeho Kang (Add the update of radiant source) // METHODOLOGY EMPLOYED: - // The update subrotines both in high temperature radiant radiator + // The update subroutines both in high temperature radiant radiator // and convective only baseboard radiator are combined and modified. // SUBROUTINE LOCAL VARIABLE DECLARATIONS: @@ -1473,7 +1441,7 @@ namespace HWBaseboardRadiator { // April 2010 Brent Griffith, max limit to protect surface temperature calcs // PURPOSE OF THIS SUBROUTINE: - // To distribute the gains from the hot water basebaord heater + // To distribute the gains from the hot water baseboard heater // as specified in the user input file. This includes distribution // of long wavelength radiant gains to surfaces and "people." diff --git a/src/EnergyPlus/HWBaseboardRadiator.hh b/src/EnergyPlus/HWBaseboardRadiator.hh index ac714b4cf27..f5bdd03ec1f 100644 --- a/src/EnergyPlus/HWBaseboardRadiator.hh +++ b/src/EnergyPlus/HWBaseboardRadiator.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -77,7 +77,7 @@ namespace HWBaseboardRadiator { int DesignObjectPtr = 0; Array1D_int SurfacePtr; int ZonePtr = 0; - int SchedPtr = 0; + Sched::Schedule *availSched = nullptr; int WaterInletNode = 0; int WaterOutletNode = 0; int TotSurfToDistrib = 0; @@ -219,6 +219,10 @@ struct HWBaseboardRadiatorData : BaseGlobalStruct bool MyEnvrnFlag2 = true; Array1D_bool MyEnvrnFlag; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/HeatBalFiniteDiffManager.cc b/src/EnergyPlus/HeatBalFiniteDiffManager.cc index 94d4b94b7c8..6b8266c3b2d 100644 --- a/src/EnergyPlus/HeatBalFiniteDiffManager.cc +++ b/src/EnergyPlus/HeatBalFiniteDiffManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -586,10 +586,10 @@ namespace HeatBalFiniteDiffManager { // set a Delt that fits the zone time step and keeps it below 200s. - s_hbfd->fracTimeStepZone_Hour = 1.0 / double(state.dataGlobal->NumOfTimeStepInHour); + s_hbfd->fracTimeStepZone_Hour = 1.0 / double(state.dataGlobal->TimeStepsInHour); for (int index = 1; index <= 20; ++index) { - Delt = (s_hbfd->fracTimeStepZone_Hour * Constant::SecInHour) / index; // TimeStepZone = Zone time step in fractional hours + Delt = (s_hbfd->fracTimeStepZone_Hour * Constant::rSecsInHour) / index; // TimeStepZone = Zone time step in fractional hours if (Delt <= 200) break; } @@ -1135,7 +1135,8 @@ namespace HeatBalFiniteDiffManager { auto &surfaceFD = s_hbfd->SurfaceFD(Surf); Real64 HMovInsul = 0; - if (state.dataSurface->AnyMovableInsulation) HMovInsul = state.dataHeatBalSurf->SurfMovInsulHExt(Surf); + if (state.dataSurface->AnyMovableInsulation) + HMovInsul = state.dataSurface->extMovInsuls(Surf).H; // Even if this is not a movable insulation surface? // Start stepping through the slab with time. for (int J = 1, J_end = nint(state.dataGlobal->TimeStepZoneSec / Delt); J <= J_end; ++J) { // PT testing higher time steps @@ -1364,7 +1365,7 @@ namespace HeatBalFiniteDiffManager { ThisNum, construct.TotLayers, int(constructFD.TotNodes + 1), - constructFD.DeltaTime / Constant::SecInHour); + constructFD.DeltaTime / Constant::rSecsInHour); for (int Layer = 1; Layer <= construct.TotLayers; ++Layer) { static constexpr std::string_view Format_701(" Material CondFD Summary,{},{:.4R},{},{:.8R},{:.8R},{:.8R}\n"); diff --git a/src/EnergyPlus/HeatBalFiniteDiffManager.hh b/src/EnergyPlus/HeatBalFiniteDiffManager.hh index 39d2a3eab68..e5cb39b066e 100644 --- a/src/EnergyPlus/HeatBalFiniteDiffManager.hh +++ b/src/EnergyPlus/HeatBalFiniteDiffManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -347,6 +347,10 @@ struct HeatBalFiniteDiffMgr : BaseGlobalStruct Array1D MaterialFD; bool MyEnvrnFlag = true; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/HeatBalanceAirManager.cc b/src/EnergyPlus/HeatBalanceAirManager.cc index 6daa9ff9e43..78a88d4c132 100644 --- a/src/EnergyPlus/HeatBalanceAirManager.cc +++ b/src/EnergyPlus/HeatBalanceAirManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -248,6 +248,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err Real64 constexpr MixingTempLimit = 100.0; // degrees Celsius Real64 constexpr VentilWSLimit = 40.0; // m/s static constexpr std::string_view RoutineName("GetSimpleAirModelInputs: "); // include trailing blank space + static constexpr std::string_view routineName = "GetSimpleAirModelInputs"; // Refrigeration Door Mixing Protection types, factors used to moderate mixing flow. Real64 constexpr RefDoorNone = 0.0; Real64 constexpr RefDoorAirCurtain = 0.5; @@ -286,7 +287,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err // Following used for reporting state.dataHeatBal->ZnAirRpt.allocate(state.dataGlobal->NumOfZones); - if (state.dataHeatBal->doSpaceHeatBalanceSimulation) { + if (state.dataHeatBal->doSpaceHeatBalanceSizing || state.dataHeatBal->doSpaceHeatBalanceSimulation) { state.dataHeatBal->spaceAirRpt.allocate(state.dataGlobal->numSpaces); } @@ -440,6 +441,8 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, cAlphaArgs(1)}; bool IsNotOK = false; auto &thisZoneAirBalance = state.dataHeatBal->ZoneAirBalance(Loop); thisZoneAirBalance.Name = cAlphaArgs(1); @@ -499,27 +502,13 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err ErrorsFound = true; } - thisZoneAirBalance.InducedAirSchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(4)); - if (thisZoneAirBalance.InducedAirSchedPtr == 0) { - if (lAlphaFieldBlanks(4)) { - ShowSevereError( - state, - format("{}{}=\"{}\",{} is required but field is blank.", RoutineName, cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(4))); - } else { - ShowSevereError(state, - format(R"({}{}="{}", invalid (not found) {}="{}".)", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(4), - cAlphaArgs(4))); - } + if (lAlphaFieldBlanks(4)) { + ShowSevereEmptyField(state, eoh, cAlphaFieldNames(4)); + } else if ((thisZoneAirBalance.inducedAirSched = Sched::GetSchedule(state, cAlphaArgs(4))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(4), cAlphaArgs(4)); ErrorsFound = true; - } - if (!ScheduleManager::CheckScheduleValueMinMax(state, thisZoneAirBalance.InducedAirSchedPtr, ">=", 0.0, "<=", 1.0)) { - ShowSevereError( - state, format("{} = {}: Error found in {} = {}", cCurrentModuleObject, thisZoneAirBalance.Name, cAlphaFieldNames(4), cAlphaArgs(4))); - ShowContinueError(state, "Schedule values must be (>=0., <=1.)"); + } else if (!thisZoneAirBalance.inducedAirSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFieldNames(4), cAlphaArgs(4), Clusive::In, 0.0, Clusive::In, 1.0); ErrorsFound = true; } @@ -701,6 +690,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err cAlphaFieldNames, cNumericFieldNames); + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, cAlphaArgs(1)}; // Create one Infiltration instance for every space associated with this input object auto &thisInfiltrationInput = infiltrationDesignFlowRateObjects(infilInputNum); for (int Item1 = 1; Item1 <= thisInfiltrationInput.numOfSpaces; ++Item1) { @@ -713,21 +703,14 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err auto &thisZone = state.dataHeatBal->Zone(thisSpace.zoneNum); thisInfiltration.ModelType = DataHeatBalance::InfiltrationModelType::DesignFlowRate; + if (lAlphaFieldBlanks(3)) { - thisInfiltration.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisInfiltration.SchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(3)); - if (thisInfiltration.SchedPtr == 0) { - if (Item1 == 1) { // avoid repeated error messages from the same input object - ShowSevereError(state, - format("{}{}=\"{}\", invalid (not found) {}=\"{}\".", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(3), - cAlphaArgs(3))); - ErrorsFound = true; - } + thisInfiltration.sched = + Sched::GetScheduleAlwaysOn(state); // This is not an availability schedule per se, but does default to Constant-1.0 + } else if ((thisInfiltration.sched = Sched::GetSchedule(state, cAlphaArgs(3))) == nullptr) { + if (Item1 == 1) { // avoid repeated error messages from the same input object + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(3), cAlphaArgs(3)); + ErrorsFound = true; } } @@ -870,7 +853,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err case AirflowSpec::AirChanges: if (thisInfiltration.spaceIndex != 0) { if (rNumericArgs(4) >= 0.0) { - thisInfiltration.DesignLevel = rNumericArgs(4) * thisSpace.Volume / Constant::SecInHour; + thisInfiltration.DesignLevel = rNumericArgs(4) * thisSpace.Volume / Constant::rSecsInHour; if (thisSpace.Volume <= 0.0) { ShowWarningError(state, format("{}{}=\"{}\", {} specifies {}, but Space Volume = 0. 0 Infiltration will result.", @@ -944,6 +927,9 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, cAlphaArgs(1)}; + // Create one Infiltration instance for every space associated with this input object auto &thisInfiltrationInput = infiltrationLeakageAreaObjects(infilInputNum); for (int Item1 = 1; Item1 <= thisInfiltrationInput.numOfSpaces; ++Item1) { @@ -958,19 +944,10 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err thisInfiltration.ModelType = DataHeatBalance::InfiltrationModelType::ShermanGrimsrud; if (lAlphaFieldBlanks(3)) { - thisInfiltration.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisInfiltration.SchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(3)); - if (thisInfiltration.SchedPtr == 0) { - ShowSevereError(state, - format(R"({}{}="{}", invalid (not found) {}="{}".)", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(3), - cAlphaArgs(3))); - ErrorsFound = true; - } + thisInfiltration.sched = Sched::GetScheduleAlwaysOn(state); // Not an availability schedule but defaults to constant 1.0 + } else if ((thisInfiltration.sched = Sched::GetSchedule(state, cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(3), cAlphaArgs(3)); + ErrorsFound = true; } thisInfiltration.BasicStackCoefficient = rNumericArgs(2); thisInfiltration.BasicWindCoefficient = rNumericArgs(3); @@ -1031,6 +1008,9 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, cAlphaArgs(1)}; + // Create one Infiltration instance for every space associated with this input object auto &thisInfiltrationInput = infiltrationFlowCoefficientObjects(infilInputNum); for (int Item1 = 1; Item1 <= thisInfiltrationInput.numOfSpaces; ++Item1) { @@ -1045,19 +1025,10 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err thisInfiltration.ModelType = DataHeatBalance::InfiltrationModelType::AIM2; if (lAlphaFieldBlanks(3)) { - thisInfiltration.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisInfiltration.SchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(3)); - if (thisInfiltration.SchedPtr == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid (not found) {}=\"{}\".", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(3), - cAlphaArgs(3))); - ErrorsFound = true; - } + thisInfiltration.sched = Sched::GetScheduleAlwaysOn(state); // Not an availability schedule, but defaults to constant-1.0 + } else if ((thisInfiltration.sched = Sched::GetSchedule(state, cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(3), cAlphaArgs(3)); + ErrorsFound = true; } thisInfiltration.AIM2StackCoefficient = rNumericArgs(2); thisInfiltration.PressureExponent = rNumericArgs(3); @@ -1354,6 +1325,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err cAlphaFieldNames, cNumericFieldNames); + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, cAlphaArgs(1)}; auto &thisVentilationInput = ventilationDesignFlowRateObjects(ventInputNum); for (int Item1 = 1; Item1 <= thisVentilationInput.numOfSpaces; ++Item1) { ++ventilationNum; @@ -1366,19 +1338,10 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err thisVentilation.ModelType = DataHeatBalance::VentilationModelType::DesignFlowRate; if (lAlphaFieldBlanks(3)) { - thisVentilation.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisVentilation.SchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(3)); - if (thisVentilation.SchedPtr == 0) { - if (Item1 == 1) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid (not found) {}=\"{}\".", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(3), - cAlphaArgs(3))); - } + thisVentilation.availSched = Sched::GetScheduleAlwaysOn(state); // Defaults to constant-1.0 + } else if ((thisVentilation.availSched = Sched::GetSchedule(state, cAlphaArgs(3))) == nullptr) { + if (Item1 == 1) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(3), cAlphaArgs(3)); ErrorsFound = true; } } @@ -1470,7 +1433,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err case AirflowSpec::AirChanges: if (thisVentilation.spaceIndex != 0) { if (rNumericArgs(4) >= 0.0) { - thisVentilation.DesignLevel = rNumericArgs(4) * thisSpace.Volume / Constant::SecInHour; + thisVentilation.DesignLevel = rNumericArgs(4) * thisSpace.Volume / Constant::rSecsInHour; if (thisSpace.Volume <= 0.0) { ShowWarningError(state, format("{}{}=\"{}\", {} specifies {}, but Space Volume = 0. 0 Ventilation will result.", @@ -1576,6 +1539,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err } else { thisVentilation.MinIndoorTemperature = -VentilTempLimit; } + // Ventilation(Loop)%MinIndoorTemperature = rNumericArgs(11) if ((thisVentilation.MinIndoorTemperature < -VentilTempLimit) || (thisVentilation.MinIndoorTemperature > VentilTempLimit)) { if (Item1 == 1) { @@ -1590,54 +1554,32 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err } } - thisVentilation.MinIndoorTempSchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(6)); - if (thisVentilation.MinIndoorTempSchedPtr > 0) { - if (Item1 == 1) { - if (!lNumericFieldBlanks(11)) - ShowWarningError(state, - format("{}The Minimum Indoor Temperature value and schedule are provided. The scheduled temperature " - "will be used in the {} object = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1))); - // Check min and max values in the schedule to ensure both values are within the range - if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisVentilation.MinIndoorTempSchedPtr, ">=", -VentilTempLimit, "<=", VentilTempLimit)) { - ShowSevereError( - state, - format( - "{}{} statement = {} must have a minimum indoor temperature between -100C and 100C defined in the schedule = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaArgs(6))); - ErrorsFound = true; - } - } - } - if (thisVentilation.MinIndoorTempSchedPtr == 0 && lNumericFieldBlanks(11) && (!lAlphaFieldBlanks(6))) { - if (Item1 == 1) { - ShowWarningError( - state, - format("{}{}: the value field is blank and schedule field is invalid. The default value will be used ({:.1R}) ", - RoutineName, - cNumericFieldNames(11), - -VentilTempLimit)); - ShowContinueError(state, - format("in the {} object = {} and the simulation continues...", cCurrentModuleObject, cAlphaArgs(1))); - } + if (!lAlphaFieldBlanks(6)) { + thisVentilation.minIndoorTempSched = Sched::GetSchedule(state, cAlphaArgs(6)); } - // Check Minimum indoor temperature value and schedule fields - if (!lNumericFieldBlanks(11) && (!cAlphaArgs(6).empty() && thisVentilation.MinIndoorTempSchedPtr == 0)) { - if (Item1 == 1) { - ShowWarningError(state, - format("{}{} = {} is invalid. The constant value will be used at {:.1R} degrees C ", - RoutineName, + + if (Item1 == 1) { // Item check prevents this error from printing multiple times + if (lAlphaFieldBlanks(6)) { + if (lNumericFieldBlanks(11)) { + // ShowWarningEmptyField(state, eoh, cNumericFieldNames(11), format("The default value will be used ({:.1R})", + // -VentilTempLimit)); + } + } else if (thisVentilation.minIndoorTempSched == nullptr) { + ShowWarningItemNotFound(state, + eoh, cAlphaFieldNames(6), cAlphaArgs(6), - rNumericArgs(11))); - ShowContinueError(state, - format("in the {} object = {} and the simulation continues...", cCurrentModuleObject, cAlphaArgs(1))); + format("The default value will be used ({:.1R})", thisVentilation.MinIndoorTemperature)); + } else if (!thisVentilation.minIndoorTempSched->checkMinMaxVals( + state, Clusive::In, -VentilTempLimit, Clusive::In, VentilTempLimit)) { + Sched::ShowSevereBadMinMax( + state, eoh, cAlphaFieldNames(6), cAlphaArgs(6), Clusive::In, -VentilTempLimit, Clusive::In, VentilTempLimit); + ErrorsFound = true; + } else if (!lNumericFieldBlanks(11)) { + ShowWarningCustom( + state, + eoh, + format("Both {} and {} provided, {} will be used.", cAlphaFieldNames(6), cAlphaFieldNames(11), cAlphaFieldNames(6))); } } @@ -1653,104 +1595,62 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err } } - thisVentilation.MaxIndoorTempSchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(7)); - if (thisVentilation.MaxIndoorTempSchedPtr > 0) { - if (Item1 == 1) { - if (!lNumericFieldBlanks(12)) - ShowWarningError(state, - format("{}The Maximum Indoor Temperature value and schedule are provided. The scheduled temperature " - "will be used in the {} object = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1))); - // Check min and max values in the schedule to ensure both values are within the range - if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisVentilation.MaxIndoorTempSchedPtr, ">=", -VentilTempLimit, "<=", VentilTempLimit)) { - ShowSevereError( - state, - format("{} = {} must have a maximum indoor temperature between -100C and 100C defined in the schedule = {}", - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaArgs(7))); - ErrorsFound = true; - } - } - } - if (thisVentilation.MaxIndoorTempSchedPtr == 0 && lNumericFieldBlanks(12) && (!lAlphaFieldBlanks(7))) { - if (Item1 == 1) { - ShowWarningError( - state, - format("{}{}: the value field is blank and schedule field is invalid. The default value will be used ({:.1R}) ", - RoutineName, - cNumericFieldNames(12), - VentilTempLimit)); - ShowContinueError(state, - format("in the {} object = {} and the simulation continues...", cCurrentModuleObject, cAlphaArgs(1))); - } + if (!lAlphaFieldBlanks(7)) { + thisVentilation.maxIndoorTempSched = Sched::GetSchedule(state, cAlphaArgs(7)); } - // Check Maximum indoor temperature value and schedule fields - if (!lNumericFieldBlanks(12) && ((!lAlphaFieldBlanks(7)) && thisVentilation.MaxIndoorTempSchedPtr == 0)) { - if (Item1 == 1) { - ShowWarningError(state, - format("{}{} = {} is invalid. The constant value will be used at {:.1R} degrees C ", - RoutineName, + + if (Item1 == 1) { // Item check prevents this error from printing multiple times + if (lAlphaFieldBlanks(7)) { + if (lNumericFieldBlanks(12)) { + // ShowWarningEmptyField(state, eoh, cNumericFieldNames(12), format("The default value will be used ({:.1R})", + // VentilTempLimit)); + } + } else if (thisVentilation.maxIndoorTempSched == nullptr) { + ShowWarningItemNotFound(state, + eoh, cAlphaFieldNames(7), cAlphaArgs(7), - rNumericArgs(12))); - ShowContinueError(state, - format("in the {} object = {} and the simulation continues...", cCurrentModuleObject, cAlphaArgs(1))); + format("The default value will be used ({:.1R})", thisVentilation.MaxIndoorTemperature)); + } else if (!thisVentilation.maxIndoorTempSched->checkMinMaxVals( + state, Clusive::In, -VentilTempLimit, Clusive::In, VentilTempLimit)) { + Sched::ShowSevereBadMinMax( + state, eoh, cAlphaFieldNames(7), cAlphaArgs(7), Clusive::In, -VentilTempLimit, Clusive::In, VentilTempLimit); + ErrorsFound = true; + } else if (!lNumericFieldBlanks(12)) { + ShowWarningCustom( + state, + eoh, + format("Both {} and {} provided, {} will be used.", cAlphaFieldNames(7), cAlphaFieldNames(12), cAlphaFieldNames(7))); } } thisVentilation.DelTemperature = !lNumericFieldBlanks(13) ? rNumericArgs(13) : -VentilTempLimit; // Ventilation(Loop)%DelTemperature = rNumericArgs(13) ! 3/12/03 Negative del temp now allowed COP - thisVentilation.DeltaTempSchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(8)); - if (thisVentilation.DeltaTempSchedPtr > 0) { - if (Item1 == 1) { - if (!lNumericFieldBlanks(13)) - ShowWarningError(state, - format("{}The Delta Temperature value and schedule are provided. The scheduled temperature will be used " - "in the {} object = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1))); - // Check min value in the schedule to ensure both values are within the range - if (ScheduleManager::GetScheduleMinValue(state, thisVentilation.DeltaTempSchedPtr) < -VentilTempLimit) { - ShowSevereError( - state, - format("{}{} statement = {} must have a delta temperature equal to or above -100C defined in the schedule = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaArgs(8))); - ErrorsFound = true; - } - } - } - if (thisVentilation.DeltaTempSchedPtr == 0 && lNumericFieldBlanks(13) && (!lAlphaFieldBlanks(8))) { - if (Item1 == 1) { - ShowWarningError( - state, - format("{}{}: the value field is blank and schedule field is invalid. The default value will be used ({:.1R}) ", - RoutineName, - cNumericFieldNames(13), - VentilTempLimit)); - ShowContinueError(state, - format("in the {} object = {} and the simulation continues...", cCurrentModuleObject, cAlphaArgs(1))); - } + if (!lAlphaFieldBlanks(8)) { + thisVentilation.deltaTempSched = Sched::GetSchedule(state, cAlphaArgs(8)); } - if (!lNumericFieldBlanks(13) && ((!lAlphaFieldBlanks(8)) && thisVentilation.DeltaTempSchedPtr == 0)) { - if (Item1 == 1) { - ShowWarningError(state, - format("{}{} = {} is invalid. The constant value will be used at {:.1R} degrees C ", - RoutineName, + if (Item1 == 1) { // Item check prevents this error from printing multiple times + if (lAlphaFieldBlanks(8)) { + if (lNumericFieldBlanks(13)) { + // ShowWarningEmptyField(state, eoh, cNumericFieldNames(13), format("The default value will be used ({:.1R})", + // VentilTempLimit)); + } + } else if (thisVentilation.deltaTempSched == nullptr) { + ShowWarningItemNotFound(state, + eoh, cAlphaFieldNames(8), cAlphaArgs(8), - rNumericArgs(13))); - ShowContinueError(state, - format("in the {} object = {} and the simulation continues...", cCurrentModuleObject, cAlphaArgs(1))); + format("The default value will be used ({:.1R})", thisVentilation.DelTemperature)); + } else if (!thisVentilation.deltaTempSched->checkMinVal(state, Clusive::In, -VentilTempLimit)) { + Sched::ShowSevereBadMin(state, eoh, cAlphaFieldNames(8), cAlphaArgs(8), Clusive::In, -100); + ErrorsFound = true; + } else if (!lNumericFieldBlanks(13)) { + ShowWarningCustom( + state, + eoh, + format("Both {} and {} provided, {} will be used.", cAlphaFieldNames(8), cAlphaFieldNames(13), cAlphaFieldNames(8))); } } @@ -1767,49 +1667,32 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err } } - thisVentilation.MinOutdoorTempSchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(9)); - if (Item1 == 1) { - if (thisVentilation.MinOutdoorTempSchedPtr > 0) { - if (!lNumericFieldBlanks(14)) - ShowWarningError(state, - format("{}The Minimum Outdoor Temperature value and schedule are provided. The scheduled temperature " - "will be used in the {} object = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1))); - // Check min and max values in the schedule to ensure both values are within the range - if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisVentilation.MinOutdoorTempSchedPtr, ">=", -VentilTempLimit, "<=", VentilTempLimit)) { - ShowSevereError( - state, - format( - "{}{} statement = {} must have a minimum outdoor temperature between -100C and 100C defined in the schedule = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaArgs(9))); - ErrorsFound = true; + if (!lAlphaFieldBlanks(9)) { + thisVentilation.minOutdoorTempSched = Sched::GetSchedule(state, cAlphaArgs(9)); + } + + if (Item1 == 1) { // Item check prevents this error from printing multiple times + if (lAlphaFieldBlanks(9)) { + if (lNumericFieldBlanks(14)) { + // ShowWarningEmptyField(state, eoh, cNumericFieldNames(14), format("The default value will be used ({:.1R})", + // VentilTempLimit)); } - } - if (thisVentilation.MinOutdoorTempSchedPtr == 0 && lNumericFieldBlanks(14) && (!lAlphaFieldBlanks(9))) { - ShowWarningError(state, - format("{}Minimum Outdoor Temperature: the value field is blank and schedule field is invalid. The " - "default value will be used ({:.1R}) ", - RoutineName, - -VentilTempLimit)); - ShowContinueError(state, - format("in the {} object = {} and the simulation continues...", cCurrentModuleObject, cAlphaArgs(1))); - } - // Check Minimum outdoor temperature value and schedule fields - if (!lNumericFieldBlanks(14) && ((!lAlphaFieldBlanks(9)) && thisVentilation.MinOutdoorTempSchedPtr == 0)) { - ShowWarningError(state, - format("{}{} = {} is invalid. The constant value will be used at {:.1R} degrees C ", - RoutineName, + } else if (thisVentilation.minOutdoorTempSched == nullptr) { + ShowWarningItemNotFound(state, + eoh, cAlphaFieldNames(9), cAlphaArgs(9), - rNumericArgs(14))); - ShowContinueError(state, - format("in the {} object = {} and the simulation continues...", cCurrentModuleObject, cAlphaArgs(1))); + format("The default value will be used ({:.1R})", thisVentilation.MinOutdoorTemperature)); + } else if (!thisVentilation.minOutdoorTempSched->checkMinMaxVals( + state, Clusive::In, -VentilTempLimit, Clusive::In, VentilTempLimit)) { + Sched::ShowSevereBadMinMax( + state, eoh, cAlphaFieldNames(9), cAlphaArgs(9), Clusive::In, -VentilTempLimit, Clusive::In, VentilTempLimit); + ErrorsFound = true; + } else if (!lNumericFieldBlanks(14)) { + ShowWarningCustom( + state, + eoh, + format("Both {} and {} provided, {} will be used.", cAlphaFieldNames(9), cNumericFieldNames(14), cAlphaFieldNames(9))); } } @@ -1826,49 +1709,32 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err } } - thisVentilation.MaxOutdoorTempSchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(10)); - if (Item1 == 1) { - if (thisVentilation.MaxOutdoorTempSchedPtr > 0) { - if (!lNumericFieldBlanks(15)) - ShowWarningError(state, - format("{}The Maximum Outdoor Temperature value and schedule are provided. The scheduled temperature " - "will be used in the {} object = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1))); - if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisVentilation.MaxOutdoorTempSchedPtr, ">=", -VentilTempLimit, "<=", VentilTempLimit)) { - ShowSevereError( - state, - format( - "{}{} statement = {} must have a maximum outdoor temperature between -100C and 100C defined in the schedule = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaArgs(10))); - ErrorsFound = true; + if (!lAlphaFieldBlanks(10)) { + thisVentilation.maxOutdoorTempSched = Sched::GetSchedule(state, cAlphaArgs(10)); + } + + if (Item1 == 1) { // Item check prevents this error from printing multiple times + if (lAlphaFieldBlanks(10)) { + if (lNumericFieldBlanks(15)) { + // ShowWarningEmptyField(state, eoh, cNumericFieldNames(15), format("The default value will be used ({:.1R})", + // VentilTempLimit)); } - } - if (thisVentilation.MaxOutdoorTempSchedPtr == 0 && lNumericFieldBlanks(15) && (!lAlphaFieldBlanks(10))) { - ShowWarningError( - state, - format("{}{}: the value field is blank and schedule field is invalid. The default value will be used ({:.1R}) ", - RoutineName, - cNumericFieldNames(15), - VentilTempLimit)); - ShowContinueError(state, - format("in the {} object = {} and the simulation continues...", cCurrentModuleObject, cAlphaArgs(1))); - } - // Check Maximum outdoor temperature value and schedule fields - if (!lNumericFieldBlanks(15) && ((!lAlphaFieldBlanks(10)) && thisVentilation.MaxOutdoorTempSchedPtr == 0)) { - ShowWarningError(state, - format("{}{} = {}is invalid. The constant value will be used at {:.1R} degrees C ", - RoutineName, + } else if (thisVentilation.maxOutdoorTempSched == nullptr) { + ShowWarningItemNotFound(state, + eoh, cAlphaFieldNames(10), cAlphaArgs(10), - rNumericArgs(15))); - ShowContinueError(state, - format("in the {} object = {} and the simulation continues...", cCurrentModuleObject, cAlphaArgs(1))); + format("The default value will be used ({:.1R})", thisVentilation.MaxOutdoorTemperature)); + } else if (!thisVentilation.maxOutdoorTempSched->checkMinMaxVals( + state, Clusive::In, -VentilTempLimit, Clusive::In, VentilTempLimit)) { + Sched::ShowSevereBadMinMax( + state, eoh, cAlphaFieldNames(10), cAlphaArgs(10), Clusive::In, -VentilTempLimit, Clusive::In, VentilTempLimit); + ErrorsFound = true; + } else if (!lNumericFieldBlanks(15)) { + ShowWarningCustom( + state, + eoh, + format("Both {} and {} provided, {} will be used.", cAlphaFieldNames(10), cNumericFieldNames(15), cAlphaFieldNames(15))); } } @@ -2032,6 +1898,8 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err cAlphaFieldNames, cNumericFieldNames); + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, cAlphaArgs(1)}; + auto &thisVentilationInput = ventilationWindStackObjects(ventInputNum); for (int Item1 = 1; Item1 <= thisVentilationInput.numOfSpaces; ++Item1) { ++ventilationNum; @@ -2044,6 +1912,8 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err thisVentilation.ModelType = DataHeatBalance::VentilationModelType::WindAndStack; + thisVentilation.availSched = Sched::GetScheduleAlwaysOn(state); // not an availability schedule, but defaults to constant-1.0 + thisVentilation.OpenArea = rNumericArgs(1); if (thisVentilation.OpenArea < 0.0) { ShowSevereError( @@ -2052,19 +1922,11 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err } if (lAlphaFieldBlanks(3)) { - thisVentilation.OpenAreaSchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisVentilation.OpenAreaSchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(3)); - if (thisVentilation.OpenAreaSchedPtr == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid (not found) {}=\"{}\".", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(3), - cAlphaArgs(3))); - ErrorsFound = true; - } + thisVentilation.openAreaFracSched = + Sched::GetScheduleAlwaysOn(state); // not an availability schedule, but defaults to constant-1.0 + } else if ((thisVentilation.openAreaFracSched = Sched::GetSchedule(state, cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(3), cAlphaArgs(3)); + ErrorsFound = true; } thisVentilation.OpenEff = rNumericArgs(2); @@ -2114,98 +1976,67 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err ErrorsFound = true; } - thisVentilation.MinIndoorTempSchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(4)); - if (thisVentilation.MinIndoorTempSchedPtr > 0) { - if (!lNumericFieldBlanks(6)) - ShowWarningError(state, - format("{}The Minimum Indoor Temperature value and schedule are provided. The scheduled temperature will be " - "used in the {} object = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1))); - // Check min and max values in the schedule to ensure both values are within the range - if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisVentilation.MinIndoorTempSchedPtr, ">=", -VentilTempLimit, "<=", VentilTempLimit)) { - ShowSevereError( - state, - format("{}{} statement = {} must have a minimum indoor temperature between -100C and 100C defined in the schedule = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaArgs(4))); - ErrorsFound = true; - } - } - if (thisVentilation.MinIndoorTempSchedPtr == 0 && lNumericFieldBlanks(6) && (!lAlphaFieldBlanks(4))) { - ShowWarningError(state, - format("{}{}: the value field is blank and schedule field is invalid. The default value will be used ({:.1R}) ", - RoutineName, - cNumericFieldNames(6), - -VentilTempLimit)); - ShowContinueError(state, format("in the {} object = {} and the simulation continues...", cCurrentModuleObject, cAlphaArgs(1))); + if (!lAlphaFieldBlanks(4)) { + thisVentilation.minIndoorTempSched = Sched::GetSchedule(state, cAlphaArgs(4)); } - // Check Minimum indoor temperature value and schedule fields - if (!lNumericFieldBlanks(6) && (!cAlphaArgs(4).empty() && thisVentilation.MinIndoorTempSchedPtr == 0)) { - ShowWarningError(state, - format("{}{} = {} is invalid. The constant value will be used at {:.1R} degrees C ", - RoutineName, + + if (lAlphaFieldBlanks(4)) { + if (lNumericFieldBlanks(6)) { + // ShowWarningEmptyField(state, eoh, cAlphaFieldNames(12), format("The default value will be used ({:.1R})", + // VentilTempLimit)); + } + } else if (thisVentilation.minIndoorTempSched == nullptr) { + ShowWarningItemNotFound(state, + eoh, cAlphaFieldNames(4), cAlphaArgs(4), - rNumericArgs(11))); - ShowContinueError(state, format("in the {} object = {} and the simulation continues...", cCurrentModuleObject, cAlphaArgs(1))); + format("The default value will be used ({:.1R})", thisVentilation.MinIndoorTemperature)); + } else if (!thisVentilation.minIndoorTempSched->checkMinMaxVals(state, Clusive::In, -VentilTempLimit, Clusive::In, VentilTempLimit)) { + Sched::ShowSevereBadMinMax( + state, eoh, cAlphaFieldNames(4), cAlphaArgs(4), Clusive::In, -VentilTempLimit, Clusive::In, VentilTempLimit); + ErrorsFound = true; + } else if (!lNumericFieldBlanks(6)) { + ShowWarningCustom( + state, + eoh, + format("Both {} and {} provided, {} will be used.", cAlphaFieldNames(4), cNumericFieldNames(6), cAlphaFieldNames(4))); } + // Max indoor temperature if (!lNumericFieldBlanks(7)) { thisVentilation.MaxIndoorTemperature = rNumericArgs(7); } else { thisVentilation.MaxIndoorTemperature = VentilTempLimit; } if ((thisVentilation.MaxIndoorTemperature < -VentilTempLimit) || (thisVentilation.MaxIndoorTemperature > VentilTempLimit)) { - ShowSevereError(state, - format("{}{}=\"{}\" must have a maximum indoor temperature between -100C and 100C", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1))); + ShowSevereCustom(state, eoh, format("{} must be between {}C and {}C", cNumericFieldNames(7), -VentilTempLimit, VentilTempLimit)); ErrorsFound = true; } - thisVentilation.MaxIndoorTempSchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(5)); - if (thisVentilation.MaxIndoorTempSchedPtr > 0) { - if (!lNumericFieldBlanks(7)) - ShowWarningError(state, - format("{}The Maximum Indoor Temperature value and schedule are provided. The scheduled temperature will be " - "used in the {} object = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1))); - // Check min and max values in the schedule to ensure both values are within the range - if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisVentilation.MaxIndoorTempSchedPtr, ">=", -VentilTempLimit, "<=", VentilTempLimit)) { - ShowSevereError(state, - format("{} = {} must have a maximum indoor temperature between -100C and 100C defined in the schedule = {}", - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaArgs(5))); - ErrorsFound = true; - } + if (!lAlphaFieldBlanks(5)) { + thisVentilation.maxIndoorTempSched = Sched::GetSchedule(state, cAlphaArgs(5)); } - if (thisVentilation.MaxIndoorTempSchedPtr == 0 && lNumericFieldBlanks(7) && (!lAlphaFieldBlanks(5))) { - ShowWarningError(state, - format("{}{}: the value field is blank and schedule field is invalid. The default value will be used ({:.1R}) ", - RoutineName, - cNumericFieldNames(7), - VentilTempLimit)); - ShowContinueError(state, format("in the {} object = {} and the simulation continues...", cCurrentModuleObject, cAlphaArgs(1))); - } - // Check Maximum indoor temperature value and schedule fields - if (!lNumericFieldBlanks(7) && ((!lAlphaFieldBlanks(5)) && thisVentilation.MaxIndoorTempSchedPtr == 0)) { - ShowWarningError(state, - format("{}{} = {} is invalid. The constant value will be used at {:.1R} degrees C ", - RoutineName, - cAlphaFieldNames(7), + + if (lAlphaFieldBlanks(5)) { + if (lNumericFieldBlanks(7)) { + // ShowWarningEmptyField(state, eoh, cNumericFieldNames(7), format("The default value will be used ({:.1R})", + // VentilTempLimit)); + } + } else if (thisVentilation.maxIndoorTempSched == nullptr) { + ShowWarningItemNotFound(state, + eoh, + cAlphaFieldNames(5), cAlphaArgs(5), - rNumericArgs(7))); - ShowContinueError(state, format("in the {} object = {} and the simulation continues...", cCurrentModuleObject, cAlphaArgs(1))); + format("The default value will be used ({:.1R})", thisVentilation.MaxIndoorTemperature)); + } else if (!thisVentilation.maxIndoorTempSched->checkMinMaxVals(state, Clusive::In, -VentilTempLimit, Clusive::In, VentilTempLimit)) { + Sched::ShowSevereBadMinMax( + state, eoh, cAlphaFieldNames(5), cAlphaArgs(5), Clusive::In, -VentilTempLimit, Clusive::In, VentilTempLimit); + ErrorsFound = true; + } else if (!lNumericFieldBlanks(7)) { + ShowWarningCustom( + state, + eoh, + format("Both {} and {} provided, {} will be used.", cAlphaFieldNames(5), cNumericFieldNames(7), cAlphaFieldNames(5))); } if (!lNumericFieldBlanks(8)) { @@ -2214,45 +2045,32 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err thisVentilation.DelTemperature = -VentilTempLimit; } - thisVentilation.DeltaTempSchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(6)); - if (thisVentilation.DeltaTempSchedPtr > 0) { - if (!lNumericFieldBlanks(8)) - ShowWarningError(state, - format("{}The Delta Temperature value and schedule are provided. The scheduled temperature will be used in " - "the {} object = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1))); - // Check min value in the schedule to ensure both values are within the range - if (ScheduleManager::GetScheduleMinValue(state, thisVentilation.DeltaTempSchedPtr) < -VentilTempLimit) { - ShowSevereError( - state, - format("{}{} statement = {} must have a delta temperature equal to or above -100C defined in the schedule = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaArgs(8))); - ErrorsFound = true; - } + if (!lAlphaFieldBlanks(6)) { + thisVentilation.deltaTempSched = Sched::GetSchedule(state, cAlphaArgs(6)); } - if (thisVentilation.DeltaTempSchedPtr == 0 && lNumericFieldBlanks(8) && (!lAlphaFieldBlanks(6))) { - ShowWarningError(state, - format("{}{}: the value field is blank and schedule field is invalid. The default value will be used ({:.1R}) ", - RoutineName, - cNumericFieldNames(8), - VentilTempLimit)); - ShowContinueError(state, format("in the {} object = {} and the simulation continues...", cCurrentModuleObject, cAlphaArgs(1))); - } - if (!lNumericFieldBlanks(8) && ((!lAlphaFieldBlanks(6)) && thisVentilation.DeltaTempSchedPtr == 0)) { - ShowWarningError(state, - format("{}{} = {} is invalid. The constant value will be used at {:.1R} degrees C ", - RoutineName, + + if (lAlphaFieldBlanks(6)) { + if (lNumericFieldBlanks(8)) { + // ShowWarningEmptyField(state, eoh, cNumericFieldNames(8), format("The default value will be used ({:.1R})", + // VentilTempLimit)); + } + } else if (thisVentilation.deltaTempSched == nullptr) { + ShowWarningItemNotFound(state, + eoh, cAlphaFieldNames(6), cAlphaArgs(6), - rNumericArgs(8))); - ShowContinueError(state, format("in the {} object = {} and the simulation continues...", cCurrentModuleObject, cAlphaArgs(1))); + format("The default value will be used ({:.1R})", thisVentilation.DelTemperature)); + } else if (!thisVentilation.deltaTempSched->checkMinVal(state, Clusive::In, -VentilTempLimit)) { + Sched::ShowSevereBadMin(state, eoh, cAlphaFieldNames(6), cAlphaArgs(6), Clusive::In, -VentilTempLimit); + ErrorsFound = true; + } else if (!lNumericFieldBlanks(8)) { + ShowWarningCustom( + state, + eoh, + format("Both {} and {} provided, {} will be used.", cAlphaFieldNames(6), cNumericFieldNames(8), cAlphaFieldNames(6))); } + // Min outdoor temp thisVentilation.MinOutdoorTemperature = !lNumericFieldBlanks(9) ? rNumericArgs(9) : -VentilTempLimit; if ((thisVentilation.MinOutdoorTemperature < -VentilTempLimit) || (thisVentilation.MinOutdoorTemperature > VentilTempLimit)) { ShowSevereError(state, @@ -2264,48 +2082,34 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err ErrorsFound = true; } - thisVentilation.MinOutdoorTempSchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(7)); - if (thisVentilation.MinOutdoorTempSchedPtr > 0) { - if (!lNumericFieldBlanks(9)) - ShowWarningError(state, - format("{}The Minimum Outdoor Temperature value and schedule are provided. The scheduled temperature will " - "be used in the {} object = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1))); - // Check min and max values in the schedule to ensure both values are within the range - if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisVentilation.MinOutdoorTempSchedPtr, ">=", -VentilTempLimit, "<=", VentilTempLimit)) { - ShowSevereError( - state, - format("{}{} statement = {} must have a minimum outdoor temperature between -100C and 100C defined in the schedule = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaArgs(7))); - ErrorsFound = true; - } - } - if (thisVentilation.MinOutdoorTempSchedPtr == 0 && lNumericFieldBlanks(9) && (!lAlphaFieldBlanks(7))) { - ShowWarningError( - state, - format("{}Minimum Outdoor Temperature: the value field is blank and schedule field is invalid. The default value " - "will be used ({:.1R}) ", - RoutineName, - -VentilTempLimit)); - ShowContinueError(state, format("in the {} object = {} and the simulation continues...", cCurrentModuleObject, cAlphaArgs(1))); + if (!lAlphaFieldBlanks(7)) { + thisVentilation.minOutdoorTempSched = Sched::GetSchedule(state, cAlphaArgs(7)); } - // Check Minimum outdoor temperature value and schedule fields - if (!lNumericFieldBlanks(9) && ((!lAlphaFieldBlanks(7)) && thisVentilation.MinOutdoorTempSchedPtr == 0)) { - ShowWarningError(state, - format("{}{} = {} is invalid. The constant value will be used at {:.1R} degrees C ", - RoutineName, + + if (lAlphaFieldBlanks(7)) { + if (lNumericFieldBlanks(9)) { + // ShowWarningEmptyField(state, eoh, cNumericFieldNames(9), format("The default value will be used ({:.1R})", + // VentilTempLimit)); + } + } else if (thisVentilation.minOutdoorTempSched == nullptr) { + ShowWarningItemNotFound(state, + eoh, cAlphaFieldNames(7), cAlphaArgs(7), - rNumericArgs(14))); - ShowContinueError(state, format("in the {} object = {} and the simulation continues...", cCurrentModuleObject, cAlphaArgs(1))); + format("The default value will be used ({:.1R})", thisVentilation.MinOutdoorTemperature)); + } else if (!thisVentilation.minOutdoorTempSched->checkMinMaxVals( + state, Clusive::In, -VentilTempLimit, Clusive::In, VentilTempLimit)) { + Sched::ShowSevereBadMinMax( + state, eoh, cAlphaFieldNames(7), cAlphaArgs(7), Clusive::In, -VentilTempLimit, Clusive::In, VentilTempLimit); + ErrorsFound = true; + } else if (!lNumericFieldBlanks(9)) { + ShowWarningCustom( + state, + eoh, + format("Both {} and {} provided, {} will be used.", cAlphaFieldNames(7), cNumericFieldNames(9), cAlphaFieldNames(7))); } + // Max outdoor temp thisVentilation.MaxOutdoorTemperature = !lNumericFieldBlanks(10) ? rNumericArgs(10) : VentilTempLimit; if ((thisVentilation.MaxOutdoorTemperature < -VentilTempLimit) || (thisVentilation.MaxOutdoorTemperature > VentilTempLimit)) { ShowSevereError(state, @@ -2317,46 +2121,34 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err ErrorsFound = true; } - thisVentilation.MaxOutdoorTempSchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(8)); - if (thisVentilation.MaxOutdoorTempSchedPtr > 0) { - if (!lNumericFieldBlanks(10)) - ShowWarningError(state, - format("{}The Maximum Outdoor Temperature value and schedule are provided. The scheduled temperature will " - "be used in the {} object = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1))); - if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisVentilation.MaxOutdoorTempSchedPtr, ">=", -VentilTempLimit, "<=", VentilTempLimit)) { - ShowSevereError( - state, - format("{}{} statement = {} must have a maximum outdoor temperature between -100C and 100C defined in the schedule = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaArgs(8))); - ErrorsFound = true; - } - } - if (thisVentilation.MaxOutdoorTempSchedPtr == 0 && lNumericFieldBlanks(10) && (!lAlphaFieldBlanks(8))) { - ShowWarningError(state, - format("{}{}: the value field is blank and schedule field is invalid. The default value will be used ({:.1R}) ", - RoutineName, - cNumericFieldNames(10), - VentilTempLimit)); - ShowContinueError(state, format("in the {} object = {} and the simulation continues...", cCurrentModuleObject, cAlphaArgs(1))); + if (!lAlphaFieldBlanks(8)) { + thisVentilation.maxOutdoorTempSched = Sched::GetSchedule(state, cAlphaArgs(8)); } - // Check Maximum outdoor temperature value and schedule fields - if (!lNumericFieldBlanks(10) && ((!lAlphaFieldBlanks(8)) && thisVentilation.MaxOutdoorTempSchedPtr == 0)) { - ShowWarningError(state, - format("{}{} = {}is invalid. The constant value will be used at {:.1R} degrees C ", - RoutineName, + + if (lAlphaFieldBlanks(8)) { + if (lNumericFieldBlanks(10)) { + // ShowWarningEmptyField(state, eoh, cNumericFieldNames(10), format("The default value will be used ({:.1R})", + // VentilTempLimit)); + } + } else if (thisVentilation.maxOutdoorTempSched == nullptr) { + ShowWarningItemNotFound(state, + eoh, cAlphaFieldNames(8), cAlphaArgs(8), - rNumericArgs(10))); - ShowContinueError(state, format("in the {} object = {} and the simulation continues...", cCurrentModuleObject, cAlphaArgs(1))); + format("The default value will be used ({:.1R})", thisVentilation.MaxOutdoorTemperature)); + } else if (!thisVentilation.maxOutdoorTempSched->checkMinMaxVals( + state, Clusive::In, -VentilTempLimit, Clusive::In, VentilTempLimit)) { + Sched::ShowSevereBadMinMax( + state, eoh, cAlphaFieldNames(8), cAlphaArgs(8), Clusive::In, -VentilTempLimit, Clusive::In, VentilTempLimit); + ErrorsFound = true; + } else if (!lNumericFieldBlanks(10)) { + ShowWarningCustom( + state, + eoh, + format("Both {} and {} provided, {} will be used.", cAlphaFieldNames(8), cNumericFieldNames(10), cAlphaFieldNames(8))); } + // Max wind speed thisVentilation.MaxWindSpeed = !lNumericFieldBlanks(11) ? rNumericArgs(11) : VentilWSLimit; if ((thisVentilation.MaxWindSpeed < -VentilWSLimit) || (thisVentilation.MaxWindSpeed > VentilWSLimit)) { ShowSevereError(state, @@ -2532,6 +2324,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err cAlphaFieldNames, cNumericFieldNames); + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, cAlphaArgs(1)}; // Create one Mixing instance for every space associated with this input object auto const &thisMixingInput = zoneMixingInputObjects(mixingInputNum); for (int Item1 = 1; Item1 <= thisMixingInput.numOfSpaces; ++Item1) { @@ -2544,23 +2337,14 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err auto &thisZone = state.dataHeatBal->Zone(thisSpace.zoneNum); if (lAlphaFieldBlanks(3)) { - thisMixing.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisMixing.SchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(3)); - if (thisMixing.SchedPtr == 0) { - ShowWarningError(state, - format("{}{}=\"{}\", invalid (not found) {}=\"{}\"", - RoutineName, - cCurrentModuleObject, - thisMixingInput.Name, - cAlphaFieldNames(3), - cAlphaArgs(3))); - ErrorsFound = true; - } + thisMixing.sched = Sched::GetScheduleAlwaysOn(state); // Not an availability schedule, but defaults to constant-1.0 + } else if ((thisMixing.sched = Sched::GetSchedule(state, cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(3), cAlphaArgs(3)); + ErrorsFound = true; } // Mixing equipment design level calculation method - AirflowSpec flow = static_cast(getEnumValue(airflowSpecNamesUC, cAlphaArgs(4))); // NOLINT(modernize-use-auto) + AirflowSpec flow = static_cast(getEnumValue(airflowSpecNamesUC, cAlphaArgs(4))); switch (flow) { case AirflowSpec::FlowPerZone: thisMixing.DesignLevel = rNumericArgs(1); @@ -2663,7 +2447,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err case AirflowSpec::AirChanges: if (thisMixing.spaceIndex != 0) { if (rNumericArgs(4) >= 0.0) { - thisMixing.DesignLevel = rNumericArgs(4) * thisSpace.Volume / Constant::SecInHour; + thisMixing.DesignLevel = rNumericArgs(4) * thisSpace.Volume / Constant::rSecsInHour; if (thisSpace.Volume <= 0.0) { ShowWarningError(state, format("{}{}=\"{}\", {} specifies {}, but Space Volume = 0. 0 Mixing will result.", @@ -2707,230 +2491,111 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err thisMixing.FromZone = state.dataHeatBal->space(thisMixing.fromSpaceIndex).zoneNum; } if ((thisMixing.FromZone == 0) && (thisMixing.fromSpaceIndex == 0)) { - ShowSevereError( - state, - format("{}{} not found={} for {}={}", RoutineName, cAlphaFieldNames(5), cAlphaArgs(5), cCurrentModuleObject, cAlphaArgs(1))); + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(5), cAlphaArgs(5)); ErrorsFound = true; } thisMixing.DeltaTemperature = rNumericArgs(5); if (NumAlpha > 5) { - thisMixing.DeltaTempSchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(6)); - if (thisMixing.DeltaTempSchedPtr > 0) { - if (!lNumericFieldBlanks(5)) - ShowWarningError(state, - format("{}The Delta Temperature value and schedule are provided. The scheduled temperature will be used " - "in the {} object = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1))); - if (ScheduleManager::GetScheduleMinValue(state, thisMixing.DeltaTempSchedPtr) < -MixingTempLimit) { - ShowSevereError( - state, - format("{}{} statement = {} must have a delta temperature equal to or above -100C defined in the schedule = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaArgs(6))); - ErrorsFound = true; + if (lAlphaFieldBlanks(6)) { + if (lNumericFieldBlanks(5)) { + ShowWarningCustom(state, + eoh, + format("{} and {} are empty, a default temperature of {:.1R}C will be used.", + cAlphaFieldNames(6), + cNumericFieldNames(5), + -MixingTempLimit)); } - } - } - if (thisMixing.DeltaTempSchedPtr == 0 && lNumericFieldBlanks(5) && (!lAlphaFieldBlanks(6))) { - ShowWarningError(state, - format("{}{}: the value field is blank and schedule field is invalid. The default value will be used ({:.1R}) ", - RoutineName, - cNumericFieldNames(5), - rNumericArgs(5))); - ShowContinueError(state, format("in the {} object = {} and the simulation continues...", cCurrentModuleObject, cAlphaArgs(1))); - } - if (!lNumericFieldBlanks(5) && ((!lAlphaFieldBlanks(6)) && thisMixing.DeltaTempSchedPtr == 0)) { - ShowWarningError(state, - format("{}{} = {} is invalid. The constant value will be used at {:.1R} degrees C ", - RoutineName, - cAlphaFieldNames(6), - cAlphaArgs(6), - rNumericArgs(5))); - ShowContinueError(state, format("in the {} object = {} and the simulation continues...", cCurrentModuleObject, cAlphaArgs(1))); + } else if ((thisMixing.deltaTempSched = Sched::GetSchedule(state, cAlphaArgs(6))) == nullptr) { + ShowWarningItemNotFound(state, eoh, cAlphaFieldNames(6), cAlphaArgs(6), ""); + if (lNumericFieldBlanks(5)) { + ShowContinueError(state, format("a default temperature of {:.1R}C will be used.", -MixingTempLimit)); + } + } else if (!thisMixing.deltaTempSched->checkMinVal(state, Clusive::In, -MixingTempLimit)) { + Sched::ShowSevereBadMin(state, eoh, cAlphaFieldNames(6), cAlphaArgs(6), Clusive::In, -MixingTempLimit); + ErrorsFound = true; + } else if (!lNumericFieldBlanks(5)) + ShowWarningCustom( + state, + eoh, + format("{} and {} are provided, {} will be used.", cAlphaFieldNames(6), cNumericFieldNames(5), cAlphaFieldNames(6))); } + // Min indoor temp if (NumAlpha > 6) { - thisMixing.MinIndoorTempSchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(7)); - if (thisMixing.MinIndoorTempSchedPtr == 0) { - if ((!lAlphaFieldBlanks(7))) { - ShowSevereError(state, - format("{}{} not found={} for {}={}", - RoutineName, - cAlphaFieldNames(7), - cAlphaArgs(7), - cCurrentModuleObject, - cAlphaArgs(1))); - ErrorsFound = true; - } - } - if (thisMixing.MinIndoorTempSchedPtr > 0) { - // Check min and max values in the schedule to ensure both values are within the range - if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisMixing.MinIndoorTempSchedPtr, ">=", -MixingTempLimit, "<=", MixingTempLimit)) { - ShowSevereError( - state, - format("{}{} statement = {} must have a minimum zone temperature between -100C and 100C defined in the schedule = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaArgs(7))); - ErrorsFound = true; - } + if (lAlphaFieldBlanks(7)) { + // Is this an error or is there a default? + } else if ((thisMixing.minIndoorTempSched = Sched::GetSchedule(state, cAlphaArgs(7))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(7), cAlphaArgs(7)); + ErrorsFound = true; + } else if (!thisMixing.minIndoorTempSched->checkMinMaxVals(state, Clusive::In, -MixingTempLimit, Clusive::In, MixingTempLimit)) { + Sched::ShowSevereBadMinMax( + state, eoh, cAlphaFieldNames(7), cAlphaArgs(7), Clusive::In, -MixingTempLimit, Clusive::In, MixingTempLimit); + ErrorsFound = true; } } + // Max indoor temp if (NumAlpha > 7) { - thisMixing.MaxIndoorTempSchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(8)); - if (thisMixing.MaxIndoorTempSchedPtr == 0) { - if ((!lAlphaFieldBlanks(8))) { - ShowSevereError(state, - format("{}{}=\"{}\", {} not found=\"{}\".", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(8), - cAlphaArgs(8))); - ErrorsFound = true; - } - } - if (thisMixing.MaxIndoorTempSchedPtr > 0) { - // Check min and max values in the schedule to ensure both values are within the range - if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisMixing.MaxIndoorTempSchedPtr, ">=", -MixingTempLimit, "<=", MixingTempLimit)) { - ShowSevereError( - state, - format("{}{}=\"{}\" must have a maximum zone temperature between -100C and 100C defined in the schedule = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaArgs(8))); - ErrorsFound = true; - } + if (lAlphaFieldBlanks(8)) { + } else if ((thisMixing.maxIndoorTempSched = Sched::GetSchedule(state, cAlphaArgs(8))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(8), cAlphaArgs(8)); + ErrorsFound = true; + } else if (!thisMixing.maxIndoorTempSched->checkMinMaxVals(state, Clusive::In, -MixingTempLimit, Clusive::In, MixingTempLimit)) { + Sched::ShowSevereBadMinMax( + state, eoh, cAlphaFieldNames(8), cAlphaArgs(8), Clusive::In, -MixingTempLimit, Clusive::In, MixingTempLimit); + ErrorsFound = true; } } + // Min source temp if (NumAlpha > 8) { - thisMixing.MinSourceTempSchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(9)); - if (thisMixing.MinSourceTempSchedPtr == 0) { - if ((!lAlphaFieldBlanks(9))) { - ShowSevereError(state, - format("{}{}=\"{}\", {} not found=\"{}\".", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(9), - cAlphaArgs(9))); - ErrorsFound = true; - } - } - if (thisMixing.MinSourceTempSchedPtr > 0) { - // Check min and max values in the schedule to ensure both values are within the range - if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisMixing.MinSourceTempSchedPtr, ">=", -MixingTempLimit, "<=", MixingTempLimit)) { - ShowSevereError( - state, - format("{}{}=\"{}\" must have a minimum source temperature between -100C and 100C defined in the schedule = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaArgs(9))); - ErrorsFound = true; - } + if (lAlphaFieldBlanks(9)) { + } else if ((thisMixing.minSourceTempSched = Sched::GetSchedule(state, cAlphaArgs(9))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(9), cAlphaArgs(9)); + ErrorsFound = true; + } else if (!thisMixing.minSourceTempSched->checkMinMaxVals(state, Clusive::In, -MixingTempLimit, Clusive::In, MixingTempLimit)) { + Sched::ShowSevereBadMinMax( + state, eoh, cAlphaFieldNames(9), cAlphaArgs(9), Clusive::In, -MixingTempLimit, Clusive::In, MixingTempLimit); + ErrorsFound = true; } } + // Max source temp if (NumAlpha > 9) { - thisMixing.MaxSourceTempSchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(10)); - if (thisMixing.MaxSourceTempSchedPtr == 0) { - if ((!lAlphaFieldBlanks(10))) { - ShowSevereError(state, - format("{}{}=\"{}\", {} not found=\"{}\".", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(10), - cAlphaArgs(10))); - ErrorsFound = true; - } - } - if (thisMixing.MaxSourceTempSchedPtr > 0) { - // Check min and max values in the schedule to ensure both values are within the range - if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisMixing.MaxSourceTempSchedPtr, ">=", -MixingTempLimit, "<=", MixingTempLimit)) { - ShowSevereError(state, - format("{}{} statement =\"{}\" must have a maximum source temperature between -100C and 100C defined in " - "the schedule = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaArgs(10))); - ErrorsFound = true; - } + if (lAlphaFieldBlanks(10)) { + } else if ((thisMixing.maxSourceTempSched = Sched::GetSchedule(state, cAlphaArgs(10))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(10), cAlphaArgs(10)); + ErrorsFound = true; + } else if (!thisMixing.maxSourceTempSched->checkMinMaxVals(state, Clusive::In, -MixingTempLimit, Clusive::In, MixingTempLimit)) { + Sched::ShowSevereBadMinMax( + state, eoh, cAlphaFieldNames(10), cAlphaArgs(10), Clusive::In, -MixingTempLimit, Clusive::In, MixingTempLimit); + ErrorsFound = true; } } if (NumAlpha > 10) { - thisMixing.MinOutdoorTempSchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(11)); - if (thisMixing.MinOutdoorTempSchedPtr == 0) { - if ((!lAlphaFieldBlanks(11))) { - ShowSevereError(state, - format("{}{}=\"{}\", {} not found=\"{}\".", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(11), - cAlphaArgs(11))); - ErrorsFound = true; - } - } - if (thisMixing.MinOutdoorTempSchedPtr > 0) { - // Check min and max values in the schedule to ensure both values are within the range - if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisMixing.MinOutdoorTempSchedPtr, ">=", -MixingTempLimit, "<=", MixingTempLimit)) { - ShowSevereError( - state, - format("{}{} =\"{}\" must have a minimum outdoor temperature between -100C and 100C defined in the schedule = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaArgs(11))); - ErrorsFound = true; - } + if (lAlphaFieldBlanks(11)) { + } else if ((thisMixing.minOutdoorTempSched = Sched::GetSchedule(state, cAlphaArgs(11))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(11), cAlphaArgs(11)); + ErrorsFound = true; + } else if (!thisMixing.minOutdoorTempSched->checkMinMaxVals(state, Clusive::In, -MixingTempLimit, Clusive::In, MixingTempLimit)) { + Sched::ShowSevereBadMinMax( + state, eoh, cAlphaFieldNames(11), cAlphaArgs(11), Clusive::In, -MixingTempLimit, Clusive::In, MixingTempLimit); + ErrorsFound = true; } } + // if (NumAlpha > 11) { - thisMixing.MaxOutdoorTempSchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(12)); - if (thisMixing.MaxOutdoorTempSchedPtr == 0) { - if ((!lAlphaFieldBlanks(12))) { - ShowSevereError(state, - format("{}{}=\"{}\", {} not found=\"{}\".", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(12), - cAlphaArgs(12))); - ErrorsFound = true; - } - } - if (thisMixing.MaxOutdoorTempSchedPtr > 0) { - // Check min and max values in the schedule to ensure both values are within the range - if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisMixing.MaxOutdoorTempSchedPtr, ">=", -MixingTempLimit, "<=", MixingTempLimit)) { - ShowSevereError( - state, - format("{}{} =\"{}\" must have a maximum outdoor temperature between -100C and 100C defined in the schedule = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaArgs(12))); - ErrorsFound = true; - } + if (lAlphaFieldBlanks(12)) { + } else if ((thisMixing.maxOutdoorTempSched = Sched::GetSchedule(state, cAlphaArgs(12))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(12), cAlphaArgs(12)); + ErrorsFound = true; + } else if (!thisMixing.maxOutdoorTempSched->checkMinMaxVals(state, Clusive::In, -MixingTempLimit, Clusive::In, MixingTempLimit)) { + Sched::ShowSevereBadMinMax( + state, eoh, cAlphaFieldNames(12), cAlphaArgs(12), Clusive::In, -MixingTempLimit, Clusive::In, MixingTempLimit); + ErrorsFound = true; } } @@ -3151,6 +2816,9 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, cAlphaArgs(1)}; + // Create one Mixing instance for every space associated with this input object auto const &thisMixingInput = zoneCrossMixingInputObjects(mixingInputNum); for (int Item1 = 1; Item1 <= thisMixingInput.numOfSpaces; ++Item1) { @@ -3163,19 +2831,10 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err auto &thisZone = state.dataHeatBal->Zone(thisSpace.zoneNum); if (lAlphaFieldBlanks(3)) { - thisMixing.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisMixing.SchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(3)); - if (thisMixing.SchedPtr == 0) { - ShowWarningError(state, - format("{}{}=\"{}\", invalid (not found) {}=\"{}\"", - RoutineName, - cCurrentModuleObject, - thisMixingInput.Name, - cAlphaFieldNames(3), - cAlphaArgs(3))); - ErrorsFound = true; - } + thisMixing.sched = Sched::GetScheduleAlwaysOn(state); // not an availability schedule, but defaults to constant-1.0 + } else if ((thisMixing.sched = Sched::GetSchedule(state, cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(3), cAlphaArgs(3)); + ErrorsFound = true; } // Mixing equipment design level calculation method. @@ -3282,7 +2941,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err case AirflowSpec::AirChanges: if (thisMixing.spaceIndex != 0) { if (rNumericArgs(4) >= 0.0) { - thisMixing.DesignLevel = rNumericArgs(4) * thisSpace.Volume / Constant::SecInHour; + thisMixing.DesignLevel = rNumericArgs(4) * thisSpace.Volume / Constant::rSecsInHour; if (thisSpace.Volume <= 0.0) { ShowWarningError(state, format("{}{}=\"{}\", {} specifies {}, but Space Volume = 0. 0 Cross Mixing will result.", @@ -3338,225 +2997,111 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err thisMixing.DeltaTemperature = rNumericArgs(5); if (NumAlpha > 5) { - thisMixing.DeltaTempSchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(6)); - if (thisMixing.DeltaTempSchedPtr > 0) { - if (!lNumericFieldBlanks(5)) - ShowWarningError(state, - format("{}The Delta Temperature value and schedule are provided. The scheduled temperature will be used " - "in the {} object = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1))); - if (ScheduleManager::GetScheduleMinValue(state, thisMixing.DeltaTempSchedPtr) < 0.0) { - ShowSevereError(state, - format("{}{} = {} must have a delta temperature equal to or above 0 C defined in the schedule = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaArgs(6))); - ErrorsFound = true; + if (lAlphaFieldBlanks(6)) { + if (lNumericFieldBlanks(5)) { + ShowWarningCustom(state, + eoh, + format("{} and {} are empty, a default temperature of {:.1R}C will be used.", + cAlphaFieldNames(6), + cNumericFieldNames(5), + thisMixing.DeltaTemperature)); } + } else if ((thisMixing.deltaTempSched = Sched::GetSchedule(state, cAlphaArgs(6))) == nullptr) { + ShowWarningItemNotFound(state, + eoh, + cAlphaFieldNames(6), + cAlphaArgs(6), + format("Fixed delta temperature {:.1R}C will be used", thisMixing.DeltaTemperature)); + } else if (!thisMixing.deltaTempSched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, cAlphaFieldNames(6), cAlphaArgs(6), Clusive::In, 0.0); + ErrorsFound = true; + } else if (!lNumericFieldBlanks(5)) { + ShowWarningCustom( + state, + eoh, + format("{} and {} provided. {} will be used.", cAlphaFieldNames(6), cNumericFieldNames(5), cAlphaFieldNames(6))); } } - if (thisMixing.DeltaTempSchedPtr == 0 && lNumericFieldBlanks(5) && (!lAlphaFieldBlanks(6))) { - ShowWarningError(state, - format("{}{}: the value field is blank and schedule field is invalid. The default value will be used ({:.1R}) ", - RoutineName, - cNumericFieldNames(5), - rNumericArgs(5))); - ShowContinueError(state, format("in {} = {} and the simulation continues...", cCurrentModuleObject, cAlphaArgs(1))); - } - if (!lNumericFieldBlanks(5) && ((!lAlphaFieldBlanks(6)) && thisMixing.DeltaTempSchedPtr == 0)) { - ShowWarningError(state, - format("{}{} = {} is invalid. The constant value will be used at {:.1R} degrees C ", - RoutineName, - cAlphaFieldNames(6), - cAlphaArgs(6), - rNumericArgs(5))); - ShowContinueError(state, format("in the {} object = {} and the simulation continues...", cCurrentModuleObject, cAlphaArgs(1))); - } + // Min indoor temp if (NumAlpha > 6) { - thisMixing.MinIndoorTempSchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(7)); - if (thisMixing.MinIndoorTempSchedPtr == 0) { - if ((!lAlphaFieldBlanks(7))) { - ShowSevereError(state, - format("{}{}=\"{}\",{} not found={}\".", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(7), - cAlphaArgs(7))); - ErrorsFound = true; - } - } - if (thisMixing.MinIndoorTempSchedPtr > 0) { - // Check min and max values in the schedule to ensure both values are within the range - if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisMixing.MinIndoorTempSchedPtr, ">=", -MixingTempLimit, "<=", MixingTempLimit)) { - ShowSevereError( - state, - format("{}{} = {} must have a minimum zone temperature between -100C and 100C defined in the schedule = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaArgs(7))); - ErrorsFound = true; - } + if (lAlphaFieldBlanks(7)) { + } else if ((thisMixing.minIndoorTempSched = Sched::GetSchedule(state, cAlphaArgs(7))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(7), cAlphaArgs(7)); + ErrorsFound = true; + } else if (!thisMixing.minIndoorTempSched->checkMinMaxVals(state, Clusive::In, -MixingTempLimit, Clusive::In, MixingTempLimit)) { + Sched::ShowSevereBadMinMax( + state, eoh, cAlphaFieldNames(7), cAlphaArgs(7), Clusive::In, -MixingTempLimit, Clusive::In, MixingTempLimit); + ErrorsFound = true; } } + // Max indoor temp if (NumAlpha > 7) { - thisMixing.MaxIndoorTempSchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(8)); - if (thisMixing.MaxIndoorTempSchedPtr == 0) { - if ((!lAlphaFieldBlanks(8))) { - ShowSevereError(state, - format("{}{}=\"{}\",{} not found=\"{}\".", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(8), - cAlphaArgs(8))); - ErrorsFound = true; - } - } - if (thisMixing.MaxIndoorTempSchedPtr > 0) { - // Check min and max values in the schedule to ensure both values are within the range - if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisMixing.MaxIndoorTempSchedPtr, ">=", -MixingTempLimit, "<=", MixingTempLimit)) { - ShowSevereError( - state, - format("{}{} = {} must have a maximum zone temperature between -100C and 100C defined in the schedule = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaArgs(8))); - ErrorsFound = true; - } + if (lAlphaFieldBlanks(8)) { + } else if ((thisMixing.maxIndoorTempSched = Sched::GetSchedule(state, cAlphaArgs(8))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(8), cAlphaArgs(8)); + ErrorsFound = true; + } else if (!thisMixing.maxIndoorTempSched->checkMinMaxVals(state, Clusive::In, -MixingTempLimit, Clusive::In, MixingTempLimit)) { + Sched::ShowSevereBadMinMax( + state, eoh, cAlphaFieldNames(8), cAlphaArgs(8), Clusive::In, -MixingTempLimit, Clusive::In, MixingTempLimit); + ErrorsFound = true; } } + // Min source temp if (NumAlpha > 8) { - thisMixing.MinSourceTempSchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(9)); - if (thisMixing.MinSourceTempSchedPtr == 0) { - if ((!lAlphaFieldBlanks(9))) { - ShowSevereError(state, - format("{}{}=\"{}\",{} not found=\"{}\".", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(9), - cAlphaArgs(9))); - ErrorsFound = true; - } - } - if (thisMixing.MinSourceTempSchedPtr > 0) { - // Check min and max values in the schedule to ensure both values are within the range - if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisMixing.MinSourceTempSchedPtr, ">=", -MixingTempLimit, "<=", MixingTempLimit)) { - ShowSevereError( - state, - format("{}{} = {} must have a minimum source temperature between -100C and 100C defined in the schedule = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaArgs(9))); - ErrorsFound = true; - } + if (lAlphaFieldBlanks(9)) { + } else if ((thisMixing.minSourceTempSched = Sched::GetSchedule(state, cAlphaArgs(9))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(9), cAlphaArgs(9)); + ErrorsFound = true; + } else if (!thisMixing.minSourceTempSched->checkMinMaxVals(state, Clusive::In, -MixingTempLimit, Clusive::In, MixingTempLimit)) { + Sched::ShowSevereBadMinMax( + state, eoh, cAlphaFieldNames(9), cAlphaArgs(9), Clusive::In, -MixingTempLimit, Clusive::In, MixingTempLimit); + ErrorsFound = true; } } + // Max source temp if (NumAlpha > 9) { - thisMixing.MaxSourceTempSchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(10)); - if (thisMixing.MaxSourceTempSchedPtr == 0) { - if ((!lAlphaFieldBlanks(10))) { - ShowSevereError(state, - format("{}{}=\"{}\",{} not found=\"{}\".", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(10), - cAlphaArgs(9))); - ErrorsFound = true; - } - } - if (thisMixing.MaxSourceTempSchedPtr > 0) { - // Check min and max values in the schedule to ensure both values are within the range - if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisMixing.MaxSourceTempSchedPtr, ">=", -MixingTempLimit, "<=", MixingTempLimit)) { - ShowSevereError( - state, - format("{}{} = {} must have a maximum source temperature between -100C and 100C defined in the schedule = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaArgs(10))); - ErrorsFound = true; - } + if (lAlphaFieldBlanks(10)) { + } else if ((thisMixing.maxSourceTempSched = Sched::GetSchedule(state, cAlphaArgs(10))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(10), cAlphaArgs(10)); + ErrorsFound = true; + } else if (!thisMixing.maxSourceTempSched->checkMinMaxVals(state, Clusive::In, -MixingTempLimit, Clusive::In, MixingTempLimit)) { + Sched::ShowSevereBadMinMax( + state, eoh, cAlphaFieldNames(10), cAlphaArgs(10), Clusive::In, -MixingTempLimit, Clusive::In, MixingTempLimit); + ErrorsFound = true; } } + // Min outdoor temp if (NumAlpha > 10) { - thisMixing.MinOutdoorTempSchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(11)); - if (thisMixing.MinOutdoorTempSchedPtr == 0) { - if ((!lAlphaFieldBlanks(11))) { - ShowSevereError(state, - format("{}{}=\"{}\",{} not found=\"{}\".", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(11), - cAlphaArgs(9))); - ErrorsFound = true; - } - } - if (thisMixing.MinOutdoorTempSchedPtr > 0) { - // Check min and max values in the schedule to ensure both values are within the range - if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisMixing.MinOutdoorTempSchedPtr, ">=", -MixingTempLimit, "<=", MixingTempLimit)) { - ShowSevereError( - state, - format("{}{} = {} must have a minimum outdoor temperature between -100C and 100C defined in the schedule = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaArgs(11))); - ErrorsFound = true; - } + if (lAlphaFieldBlanks(11)) { + } else if ((thisMixing.minOutdoorTempSched = Sched::GetSchedule(state, cAlphaArgs(11))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(11), cAlphaArgs(11)); + ErrorsFound = true; + } else if (!thisMixing.minOutdoorTempSched->checkMinMaxVals(state, Clusive::In, -MixingTempLimit, Clusive::In, MixingTempLimit)) { + Sched::ShowSevereBadMinMax( + state, eoh, cAlphaFieldNames(11), cAlphaArgs(11), Clusive::In, -MixingTempLimit, Clusive::In, MixingTempLimit); + ErrorsFound = true; } } if (NumAlpha > 11) { - thisMixing.MaxOutdoorTempSchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(12)); - if (thisMixing.MaxOutdoorTempSchedPtr == 0) { - if ((!lAlphaFieldBlanks(12))) { - ShowSevereError(state, - format("{}{}=\"{}\",{} not found=\"{}\".", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(12), - cAlphaArgs(9))); - ErrorsFound = true; - } - } - if (thisMixing.MaxOutdoorTempSchedPtr > 0) { - // Check min and max values in the schedule to ensure both values are within the range - if (!ScheduleManager::CheckScheduleValueMinMax( - state, thisMixing.MaxOutdoorTempSchedPtr, ">=", -MixingTempLimit, "<=", MixingTempLimit)) { - ShowSevereError( - state, - format("{}{} = {} must have a maximum outdoor temperature between -100C and 100C defined in the schedule = {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaArgs(12))); - ErrorsFound = true; - } + if (lAlphaFieldBlanks(12)) { + } else if ((thisMixing.maxOutdoorTempSched = Sched::GetSchedule(state, cAlphaArgs(12))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(12), cAlphaArgs(12)); + ErrorsFound = true; + } else if (!thisMixing.maxOutdoorTempSched->checkMinMaxVals(state, Clusive::In, -MixingTempLimit, Clusive::In, MixingTempLimit)) { + Sched::ShowSevereBadMinMax( + state, eoh, cAlphaFieldNames(12), cAlphaArgs(12), Clusive::In, -MixingTempLimit, Clusive::In, MixingTempLimit); + ErrorsFound = true; } } } - } + } // for (mixingInputNum) + // Create CrossMixing objects from air boundary info for (auto const &thisAirBoundaryMixing : state.dataHeatBal->airBoundaryMixing) { ++mixingNum; @@ -3569,7 +3114,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err thisCrossMizing.Name = fmt::format("Air Boundary Mixing Zones {} and {}", zone1, zone2); thisCrossMizing.spaceIndex = space1; thisCrossMizing.ZonePtr = zone1; - thisCrossMizing.SchedPtr = thisAirBoundaryMixing.scheduleIndex; + thisCrossMizing.sched = thisAirBoundaryMixing.sched; thisCrossMizing.DesignLevel = thisAirBoundaryMixing.mixingVolumeFlowRate; thisCrossMizing.FromZone = zone2; thisCrossMizing.fromSpaceIndex = space2; @@ -3781,6 +3326,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err cAlphaFieldNames, cNumericFieldNames); + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, cAlphaArgs(1)}; NameThisObject = cAlphaArgs(1); int AlphaNum = 2; @@ -3838,72 +3384,70 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err spaceNumB = space1Num; } - if (!allocated(state.dataHeatBal->RefDoorMixing(ZoneNumA).OpenSchedPtr)) { - state.dataHeatBal->RefDoorMixing(ZoneNumA).DoorMixingObjectName.allocate(state.dataGlobal->NumOfZones); - state.dataHeatBal->RefDoorMixing(ZoneNumA).OpenSchedPtr.allocate(state.dataGlobal->NumOfZones); - state.dataHeatBal->RefDoorMixing(ZoneNumA).DoorHeight.allocate(state.dataGlobal->NumOfZones); - state.dataHeatBal->RefDoorMixing(ZoneNumA).DoorArea.allocate(state.dataGlobal->NumOfZones); - state.dataHeatBal->RefDoorMixing(ZoneNumA).Protection.allocate(state.dataGlobal->NumOfZones); - state.dataHeatBal->RefDoorMixing(ZoneNumA).MateZonePtr.allocate(state.dataGlobal->NumOfZones); - state.dataHeatBal->RefDoorMixing(ZoneNumA).EMSRefDoorMixingOn.allocate(state.dataGlobal->NumOfZones); - state.dataHeatBal->RefDoorMixing(ZoneNumA).EMSRefDoorFlowRate.allocate(state.dataGlobal->NumOfZones); - state.dataHeatBal->RefDoorMixing(ZoneNumA).VolRefDoorFlowRate.allocate(state.dataGlobal->NumOfZones); - state.dataHeatBal->RefDoorMixing(ZoneNumA).DoorProtTypeName.allocate(state.dataGlobal->NumOfZones); - state.dataHeatBal->RefDoorMixing(ZoneNumA).DoorMixingObjectName = ""; - state.dataHeatBal->RefDoorMixing(ZoneNumA).OpenSchedPtr = 0; - state.dataHeatBal->RefDoorMixing(ZoneNumA).DoorHeight = 0.0; - state.dataHeatBal->RefDoorMixing(ZoneNumA).DoorArea = 0.0; - state.dataHeatBal->RefDoorMixing(ZoneNumA).Protection = RefDoorNone; - state.dataHeatBal->RefDoorMixing(ZoneNumA).MateZonePtr = 0; - state.dataHeatBal->RefDoorMixing(ZoneNumA).EMSRefDoorMixingOn = false; - state.dataHeatBal->RefDoorMixing(ZoneNumA).EMSRefDoorFlowRate = 0.0; - state.dataHeatBal->RefDoorMixing(ZoneNumA).VolRefDoorFlowRate = 0.0; - state.dataHeatBal->RefDoorMixing(ZoneNumA).DoorProtTypeName = ""; + auto &zoneA = state.dataHeatBal->RefDoorMixing(ZoneNumA); + auto &zoneB = state.dataHeatBal->RefDoorMixing(ZoneNumB); + + if (!allocated(zoneA.openScheds)) { + zoneA.DoorMixingObjectName.allocate(state.dataGlobal->NumOfZones); + zoneA.openScheds.allocate(state.dataGlobal->NumOfZones); + zoneA.DoorHeight.allocate(state.dataGlobal->NumOfZones); + zoneA.DoorArea.allocate(state.dataGlobal->NumOfZones); + zoneA.Protection.allocate(state.dataGlobal->NumOfZones); + zoneA.MateZonePtr.allocate(state.dataGlobal->NumOfZones); + zoneA.EMSRefDoorMixingOn.allocate(state.dataGlobal->NumOfZones); + zoneA.EMSRefDoorFlowRate.allocate(state.dataGlobal->NumOfZones); + zoneA.VolRefDoorFlowRate.allocate(state.dataGlobal->NumOfZones); + zoneA.DoorProtTypeName.allocate(state.dataGlobal->NumOfZones); + zoneA.DoorMixingObjectName = ""; + zoneA.openScheds = nullptr; + zoneA.DoorHeight = 0.0; + zoneA.DoorArea = 0.0; + zoneA.Protection = RefDoorNone; + zoneA.MateZonePtr = 0; + zoneA.EMSRefDoorMixingOn = false; + zoneA.EMSRefDoorFlowRate = 0.0; + zoneA.VolRefDoorFlowRate = 0.0; + zoneA.DoorProtTypeName = ""; } // First refrigeration mixing in this zone - if (!allocated(state.dataHeatBal->RefDoorMixing(ZoneNumB).OpenSchedPtr)) { - state.dataHeatBal->RefDoorMixing(ZoneNumB).DoorMixingObjectName.allocate(state.dataGlobal->NumOfZones); - state.dataHeatBal->RefDoorMixing(ZoneNumB).OpenSchedPtr.allocate(state.dataGlobal->NumOfZones); - state.dataHeatBal->RefDoorMixing(ZoneNumB).DoorHeight.allocate(state.dataGlobal->NumOfZones); - state.dataHeatBal->RefDoorMixing(ZoneNumB).DoorArea.allocate(state.dataGlobal->NumOfZones); - state.dataHeatBal->RefDoorMixing(ZoneNumB).Protection.allocate(state.dataGlobal->NumOfZones); - state.dataHeatBal->RefDoorMixing(ZoneNumB).MateZonePtr.allocate(state.dataGlobal->NumOfZones); - state.dataHeatBal->RefDoorMixing(ZoneNumB).EMSRefDoorMixingOn.allocate(state.dataGlobal->NumOfZones); - state.dataHeatBal->RefDoorMixing(ZoneNumB).EMSRefDoorFlowRate.allocate(state.dataGlobal->NumOfZones); - state.dataHeatBal->RefDoorMixing(ZoneNumB).VolRefDoorFlowRate.allocate(state.dataGlobal->NumOfZones); - state.dataHeatBal->RefDoorMixing(ZoneNumB).DoorProtTypeName.allocate(state.dataGlobal->NumOfZones); - state.dataHeatBal->RefDoorMixing(ZoneNumB).DoorMixingObjectName = ""; - state.dataHeatBal->RefDoorMixing(ZoneNumB).OpenSchedPtr = 0; - state.dataHeatBal->RefDoorMixing(ZoneNumB).DoorHeight = 0.0; - state.dataHeatBal->RefDoorMixing(ZoneNumB).DoorArea = 0.0; - state.dataHeatBal->RefDoorMixing(ZoneNumB).Protection = RefDoorNone; - state.dataHeatBal->RefDoorMixing(ZoneNumB).MateZonePtr = 0; - state.dataHeatBal->RefDoorMixing(ZoneNumB).EMSRefDoorMixingOn = false; - state.dataHeatBal->RefDoorMixing(ZoneNumB).EMSRefDoorFlowRate = 0.0; - state.dataHeatBal->RefDoorMixing(ZoneNumB).VolRefDoorFlowRate = 0.0; - state.dataHeatBal->RefDoorMixing(ZoneNumB).DoorProtTypeName = ""; + if (!allocated(zoneB.openScheds)) { + zoneB.DoorMixingObjectName.allocate(state.dataGlobal->NumOfZones); + zoneB.openScheds.allocate(state.dataGlobal->NumOfZones); + zoneB.DoorHeight.allocate(state.dataGlobal->NumOfZones); + zoneB.DoorArea.allocate(state.dataGlobal->NumOfZones); + zoneB.Protection.allocate(state.dataGlobal->NumOfZones); + zoneB.MateZonePtr.allocate(state.dataGlobal->NumOfZones); + zoneB.EMSRefDoorMixingOn.allocate(state.dataGlobal->NumOfZones); + zoneB.EMSRefDoorFlowRate.allocate(state.dataGlobal->NumOfZones); + zoneB.VolRefDoorFlowRate.allocate(state.dataGlobal->NumOfZones); + zoneB.DoorProtTypeName.allocate(state.dataGlobal->NumOfZones); + zoneB.DoorMixingObjectName = ""; + zoneB.openScheds = nullptr; + zoneB.DoorHeight = 0.0; + zoneB.DoorArea = 0.0; + zoneB.Protection = RefDoorNone; + zoneB.MateZonePtr = 0; + zoneB.EMSRefDoorMixingOn = false; + zoneB.EMSRefDoorFlowRate = 0.0; + zoneB.VolRefDoorFlowRate = 0.0; + zoneB.DoorProtTypeName = ""; } // First refrigeration mixing in this zone - ConnectionNumber = state.dataHeatBal->RefDoorMixing(ZoneNumA).NumRefDoorConnections + 1; - state.dataHeatBal->RefDoorMixing(ZoneNumA).NumRefDoorConnections = ConnectionNumber; - state.dataHeatBal->RefDoorMixing(ZoneNumA).ZonePtr = ZoneNumA; - state.dataHeatBal->RefDoorMixing(ZoneNumA).spaceIndex = spaceNumA; - state.dataHeatBal->RefDoorMixing(ZoneNumA).fromSpaceIndex = spaceNumB; - state.dataHeatBal->RefDoorMixing(ZoneNumA).MateZonePtr(ConnectionNumber) = ZoneNumB; - state.dataHeatBal->RefDoorMixing(ZoneNumA).DoorMixingObjectName(ConnectionNumber) = NameThisObject; + ConnectionNumber = zoneA.NumRefDoorConnections + 1; + zoneA.NumRefDoorConnections = ConnectionNumber; + zoneA.ZonePtr = ZoneNumA; + zoneA.spaceIndex = spaceNumA; + zoneA.fromSpaceIndex = spaceNumB; + zoneA.MateZonePtr(ConnectionNumber) = ZoneNumB; + zoneA.DoorMixingObjectName(ConnectionNumber) = NameThisObject; // need to make sure same pair of zones is only entered once. - if (state.dataHeatBal->RefDoorMixing(ZoneNumA).RefDoorMixFlag && state.dataHeatBal->RefDoorMixing(ZoneNumB).RefDoorMixFlag) { - if (state.dataHeatBal->RefDoorMixing(ZoneNumA).NumRefDoorConnections > 1) { + if (zoneA.RefDoorMixFlag && zoneB.RefDoorMixFlag) { + if (zoneA.NumRefDoorConnections > 1) { for (int ConnectTest = 1; ConnectTest <= (ConnectionNumber - 1); ++ConnectTest) { - if (state.dataHeatBal->RefDoorMixing(ZoneNumA).MateZonePtr(ConnectTest) != - state.dataHeatBal->RefDoorMixing(ZoneNumA).MateZonePtr(ConnectionNumber)) - continue; - ShowSevereError(state, - format("{}{}=\"{}\", and {}", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - state.dataHeatBal->RefDoorMixing(ZoneNumA).DoorMixingObjectName(ConnectTest))); + if (zoneA.MateZonePtr(ConnectTest) != zoneA.MateZonePtr(ConnectionNumber)) continue; + ShowSevereError( + state, + format("{}{}=\"{}\", and {}", RoutineName, cCurrentModuleObject, cAlphaArgs(1), zoneA.DoorMixingObjectName(ConnectTest))); ShowContinueError(state, format(" Share same pair of zones: \"{}\" and \"{}\". Only one RefrigerationDoorMixing object is allowed " "for any unique pair of zones.", @@ -3913,49 +3457,25 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err } // ConnectTest } // NumRefDoorconnections > 1 } else { // Both zones need to be flagged with ref doors - state.dataHeatBal->RefDoorMixing(ZoneNumA).RefDoorMixFlag = true; - state.dataHeatBal->RefDoorMixing(ZoneNumB).RefDoorMixFlag = true; + zoneA.RefDoorMixFlag = true; + zoneB.RefDoorMixFlag = true; } // Both zones already flagged with ref doors ++AlphaNum; // 4 if (lAlphaFieldBlanks(AlphaNum)) { - ShowSevereError(state, - format("{}{}=\"{}\",{} is required but field is blank.", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(AlphaNum))); + ShowSevereEmptyField(state, eoh, cAlphaFieldNames(AlphaNum)); ErrorsFound = true; - } else { //(lAlphaFieldBlanks(AlphaNum)) THEN - state.dataHeatBal->RefDoorMixing(ZoneNumA).OpenSchedPtr(ConnectionNumber) = - ScheduleManager::GetScheduleIndex(state, cAlphaArgs(AlphaNum)); - if (state.dataHeatBal->RefDoorMixing(ZoneNumA).OpenSchedPtr(ConnectionNumber) == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid (not found) {}=\"{}\".", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(AlphaNum), - cAlphaArgs(AlphaNum))); - ErrorsFound = true; - } else { // OpenSchedPtr(ConnectionNumber) ne 0) - if (!ScheduleManager::CheckScheduleValueMinMax( - state, state.dataHeatBal->RefDoorMixing(ZoneNumA).OpenSchedPtr(ConnectionNumber), ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, - format("{}{}=\"{}\",{}=\"{}\" has schedule values < 0 or > 1.", - RoutineName, - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(AlphaNum), - cAlphaArgs(AlphaNum))); - ErrorsFound = true; - } // check door opening schedule values between 0 and 1 - } // OpenSchedPtr(ConnectionNumber) == 0) - } //(lAlphaFieldBlanks(AlphaNum)) THEN + } else if ((zoneA.openScheds(ConnectionNumber) = Sched::GetSchedule(state, cAlphaArgs(AlphaNum))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(AlphaNum), cAlphaArgs(AlphaNum)); + ErrorsFound = true; + } else if (!zoneA.openScheds(ConnectionNumber)->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFieldNames(AlphaNum), cAlphaArgs(AlphaNum), Clusive::In, 0.0, Clusive::In, 1.0); + ErrorsFound = true; + } //(lAlphaFieldBlanks(AlphaNum)) THEN int NumbNum = 1; if (lAlphaFieldBlanks(NumbNum)) { - state.dataHeatBal->RefDoorMixing(ZoneNumA).DoorHeight(ConnectionNumber) = 3.0; // default height of 3 meters + zoneA.DoorHeight(ConnectionNumber) = 3.0; // default height of 3 meters ShowWarningError(state, format("{}{}=\"{}{} is blank and the default value of 3.0 will be used.", RoutineName, @@ -3963,9 +3483,8 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err cAlphaArgs(1), cNumericFieldNames(NumbNum))); } else { - state.dataHeatBal->RefDoorMixing(ZoneNumA).DoorHeight(ConnectionNumber) = rNumericArgs(NumbNum); - if ((state.dataHeatBal->RefDoorMixing(ZoneNumA).DoorHeight(ConnectionNumber) < 0) || - (state.dataHeatBal->RefDoorMixing(ZoneNumA).DoorHeight(ConnectionNumber) > 50.0)) { + zoneA.DoorHeight(ConnectionNumber) = rNumericArgs(NumbNum); + if ((zoneA.DoorHeight(ConnectionNumber) < 0) || (zoneA.DoorHeight(ConnectionNumber) > 50.0)) { ShowSevereError( state, format("{}{} = {} must have a door height between 0 and 50 meters. ", RoutineName, cCurrentModuleObject, cAlphaArgs(1))); @@ -3975,7 +3494,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err ++NumbNum; // 2 if (lAlphaFieldBlanks(NumbNum)) { - state.dataHeatBal->RefDoorMixing(ZoneNumA).DoorArea(ConnectionNumber) = 9.0; // default area of 9 m2 + zoneA.DoorArea(ConnectionNumber) = 9.0; // default area of 9 m2 ShowWarningError(state, format("{}{}=\"{}{} is blank and the default value of 9 m2 will be used.", RoutineName, @@ -3983,9 +3502,8 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err cAlphaArgs(1), cNumericFieldNames(NumbNum))); } else { - state.dataHeatBal->RefDoorMixing(ZoneNumA).DoorArea(ConnectionNumber) = rNumericArgs(NumbNum); - if ((state.dataHeatBal->RefDoorMixing(ZoneNumA).DoorArea(ConnectionNumber) < 0) || - (state.dataHeatBal->RefDoorMixing(ZoneNumA).DoorArea(ConnectionNumber) > 400.0)) { + zoneA.DoorArea(ConnectionNumber) = rNumericArgs(NumbNum); + if ((zoneA.DoorArea(ConnectionNumber) < 0) || (zoneA.DoorArea(ConnectionNumber) > 400.0)) { ShowSevereError( state, format( @@ -3997,8 +3515,8 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err ++AlphaNum; // 5 // Door protection type. if (lAlphaFieldBlanks(AlphaNum)) { - state.dataHeatBal->RefDoorMixing(ZoneNumA).Protection(ConnectionNumber) = RefDoorNone; // Default - state.dataHeatBal->RefDoorMixing(ZoneNumA).DoorProtTypeName(ConnectionNumber) = "None"; // Default + zoneA.Protection(ConnectionNumber) = RefDoorNone; // Default + zoneA.DoorProtTypeName(ConnectionNumber) = "None"; // Default ShowWarningError(state, format("{}{}=\"{}\" {} is blank. Default of no door protection will be used", RoutineName, @@ -4007,14 +3525,14 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err cAlphaFieldNames(AlphaNum))); } else { if (cAlphaArgs(AlphaNum) == "NONE") { - state.dataHeatBal->RefDoorMixing(ZoneNumA).Protection(ConnectionNumber) = RefDoorNone; - state.dataHeatBal->RefDoorMixing(ZoneNumA).DoorProtTypeName(ConnectionNumber) = "None"; + zoneA.Protection(ConnectionNumber) = RefDoorNone; + zoneA.DoorProtTypeName(ConnectionNumber) = "None"; } else if (cAlphaArgs(AlphaNum) == "AIRCURTAIN") { - state.dataHeatBal->RefDoorMixing(ZoneNumA).Protection(ConnectionNumber) = RefDoorAirCurtain; - state.dataHeatBal->RefDoorMixing(ZoneNumA).DoorProtTypeName(ConnectionNumber) = "AirCurtain"; + zoneA.Protection(ConnectionNumber) = RefDoorAirCurtain; + zoneA.DoorProtTypeName(ConnectionNumber) = "AirCurtain"; } else if (cAlphaArgs(AlphaNum) == "STRIPCURTAIN") { - state.dataHeatBal->RefDoorMixing(ZoneNumA).Protection(ConnectionNumber) = RefDoorStripCurtain; - state.dataHeatBal->RefDoorMixing(ZoneNumA).DoorProtTypeName(ConnectionNumber) = "StripCurtain"; + zoneA.Protection(ConnectionNumber) = RefDoorStripCurtain; + zoneA.DoorProtTypeName(ConnectionNumber) = "StripCurtain"; } else { ShowSevereError(state, format("{}{}=\"{}\", invalid calculation method={} with alphanum of 5: {}", @@ -4112,11 +3630,11 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err if (state.dataGlobal->AnyEnergyManagementSystemInModel) { SetupEMSActuator(state, "ZoneRefDoorMixing", - state.dataHeatBal->RefDoorMixing(ZoneNumA).Name, + zoneA.Name, "Air Exchange Flow Rate", "[m3/s]", - state.dataHeatBal->RefDoorMixing(ZoneNumA).EMSRefDoorMixingOn(ConnectionNumber), - state.dataHeatBal->RefDoorMixing(ZoneNumA).EMSRefDoorFlowRate(ConnectionNumber)); + zoneA.EMSRefDoorMixingOn(ConnectionNumber), + zoneA.EMSRefDoorFlowRate(ConnectionNumber)); } if (ZoneNumB > 0) { @@ -4204,13 +3722,12 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err if (state.dataGlobal->AnyEnergyManagementSystemInModel) { SetupEMSActuator(state, "ZoneRefDoorMixing", - state.dataHeatBal->RefDoorMixing(ZoneNumB).Name, + zoneB.Name, "Air Exchange Flow Rate", "[m3/s]", - state.dataHeatBal->RefDoorMixing(ZoneNumA).EMSRefDoorMixingOn(ConnectionNumber), + zoneA.EMSRefDoorMixingOn(ConnectionNumber), state.dataHeatBal->RefDoorMixing(ZoneNumA).EMSRefDoorFlowRate(ConnectionNumber)); } - } // DO Loop=1,TotRefDoorMixing } // TotRefDoorMixing > 0) @@ -4251,7 +3768,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err Format_720, "ZoneInfiltration", state.dataHeatBal->Infiltration(Loop).Name, - ScheduleManager::GetScheduleName(state, state.dataHeatBal->Infiltration(Loop).SchedPtr), + state.dataHeatBal->Infiltration(Loop).sched->Name, state.dataHeatBal->Zone(ZoneNum).Name, state.dataHeatBal->Zone(ZoneNum).FloorArea, state.dataHeatBal->Zone(ZoneNum).TotOccupants); @@ -4261,7 +3778,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err divide_and_print_if_greater_than_zero(state.dataHeatBal->Zone(ZoneNum).ExteriorTotalSurfArea, state.dataHeatBal->Infiltration(Loop).DesignLevel); divide_and_print_if_greater_than_zero(state.dataHeatBal->Zone(ZoneNum).Volume, - state.dataHeatBal->Infiltration(Loop).DesignLevel * Constant::SecInHour); + state.dataHeatBal->Infiltration(Loop).DesignLevel * Constant::rSecsInHour); print(state.files.eio, "{:.3R},", state.dataHeatBal->Infiltration(Loop).ConstantTermCoef); print(state.files.eio, "{:.3R},", state.dataHeatBal->Infiltration(Loop).TemperatureTermCoef); @@ -4299,7 +3816,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err Format_720, "ZoneVentilation", state.dataHeatBal->Ventilation(Loop).Name, - ScheduleManager::GetScheduleName(state, state.dataHeatBal->Ventilation(Loop).SchedPtr), + state.dataHeatBal->Ventilation(Loop).availSched->Name, state.dataHeatBal->Zone(ZoneNum).Name, state.dataHeatBal->Zone(ZoneNum).FloorArea, state.dataHeatBal->Zone(ZoneNum).TotOccupants); @@ -4309,7 +3826,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err divide_and_print_if_greater_than_zero(state.dataHeatBal->Zone(ZoneNum).FloorArea, state.dataHeatBal->Ventilation(Loop).DesignLevel); divide_and_print_if_greater_than_zero(state.dataHeatBal->Zone(ZoneNum).TotOccupants, state.dataHeatBal->Ventilation(Loop).DesignLevel); divide_and_print_if_greater_than_zero(state.dataHeatBal->Zone(ZoneNum).Volume, - state.dataHeatBal->Ventilation(Loop).DesignLevel * Constant::SecInHour); + state.dataHeatBal->Ventilation(Loop).DesignLevel * Constant::rSecsInHour); if (state.dataHeatBal->Ventilation(Loop).FanType == DataHeatBalance::VentilationType::Exhaust) { print(state.files.eio, "Exhaust,"); @@ -4330,24 +3847,24 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err print(state.files.eio, "{:.3R},", state.dataHeatBal->Ventilation(Loop).VelocitySQTermCoef); // TODO Should this also be prefixed with "Schedule: " like the following ones are? - if (state.dataHeatBal->Ventilation(Loop).MinIndoorTempSchedPtr > 0) { - print(state.files.eio, "{},", ScheduleManager::GetScheduleName(state, state.dataHeatBal->Ventilation(Loop).MinIndoorTempSchedPtr)); + if (state.dataHeatBal->Ventilation(Loop).minIndoorTempSched != nullptr) { + print(state.files.eio, "{},", state.dataHeatBal->Ventilation(Loop).minIndoorTempSched->Name); } else { print(state.files.eio, "{:.2R},", state.dataHeatBal->Ventilation(Loop).MinIndoorTemperature); } - const auto print_temperature = [&](const int ptr, const Real64 value) { - if (ptr > 0) { - print(state.files.eio, "Schedule: {},", ScheduleManager::GetScheduleName(state, ptr)); + const auto print_temperature = [&](Sched::Schedule const *ptr, const Real64 value) { + if (ptr != nullptr) { + print(state.files.eio, "Schedule: {},", ptr->Name); } else { print(state.files.eio, "{:.2R},", value); } }; - print_temperature(state.dataHeatBal->Ventilation(Loop).MaxIndoorTempSchedPtr, state.dataHeatBal->Ventilation(Loop).MaxIndoorTemperature); - print_temperature(state.dataHeatBal->Ventilation(Loop).DeltaTempSchedPtr, state.dataHeatBal->Ventilation(Loop).DelTemperature); - print_temperature(state.dataHeatBal->Ventilation(Loop).MinOutdoorTempSchedPtr, state.dataHeatBal->Ventilation(Loop).MinOutdoorTemperature); - print_temperature(state.dataHeatBal->Ventilation(Loop).MaxOutdoorTempSchedPtr, state.dataHeatBal->Ventilation(Loop).MaxOutdoorTemperature); + print_temperature(state.dataHeatBal->Ventilation(Loop).maxIndoorTempSched, state.dataHeatBal->Ventilation(Loop).MaxIndoorTemperature); + print_temperature(state.dataHeatBal->Ventilation(Loop).deltaTempSched, state.dataHeatBal->Ventilation(Loop).DelTemperature); + print_temperature(state.dataHeatBal->Ventilation(Loop).minOutdoorTempSched, state.dataHeatBal->Ventilation(Loop).MinOutdoorTemperature); + print_temperature(state.dataHeatBal->Ventilation(Loop).maxOutdoorTempSched, state.dataHeatBal->Ventilation(Loop).MaxOutdoorTemperature); print(state.files.eio, "{:.2R}\n", state.dataHeatBal->Ventilation(Loop).MaxWindSpeed); } @@ -4371,7 +3888,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err Format_720, "Mixing", state.dataHeatBal->Mixing(Loop).Name, - ScheduleManager::GetScheduleName(state, state.dataHeatBal->Mixing(Loop).SchedPtr), + state.dataHeatBal->Mixing(Loop).sched->Name, state.dataHeatBal->Zone(ZoneNum).Name, state.dataHeatBal->Zone(ZoneNum).FloorArea, state.dataHeatBal->Zone(ZoneNum).TotOccupants); @@ -4379,7 +3896,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err divide_and_print_if_greater_than_zero(state.dataHeatBal->Zone(ZoneNum).FloorArea, state.dataHeatBal->Mixing(Loop).DesignLevel); divide_and_print_if_greater_than_zero(state.dataHeatBal->Zone(ZoneNum).TotOccupants, state.dataHeatBal->Mixing(Loop).DesignLevel); divide_and_print_if_greater_than_zero(state.dataHeatBal->Zone(ZoneNum).Volume, - state.dataHeatBal->Mixing(Loop).DesignLevel * Constant::SecInHour); + state.dataHeatBal->Mixing(Loop).DesignLevel * Constant::rSecsInHour); print(state.files.eio, "{},", state.dataHeatBal->Zone(state.dataHeatBal->Mixing(Loop).FromZone).Name); print(state.files.eio, "{:.2R}\n", state.dataHeatBal->Mixing(Loop).DeltaTemperature); @@ -4404,7 +3921,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err Format_720, "CrossMixing", state.dataHeatBal->CrossMixing(Loop).Name, - ScheduleManager::GetScheduleName(state, state.dataHeatBal->CrossMixing(Loop).SchedPtr), + state.dataHeatBal->CrossMixing(Loop).sched->Name, state.dataHeatBal->Zone(ZoneNum).Name, state.dataHeatBal->Zone(ZoneNum).FloorArea, state.dataHeatBal->Zone(ZoneNum).TotOccupants); @@ -4414,7 +3931,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err divide_and_print_if_greater_than_zero(state.dataHeatBal->Zone(ZoneNum).FloorArea, state.dataHeatBal->CrossMixing(Loop).DesignLevel); divide_and_print_if_greater_than_zero(state.dataHeatBal->Zone(ZoneNum).TotOccupants, state.dataHeatBal->CrossMixing(Loop).DesignLevel); divide_and_print_if_greater_than_zero(state.dataHeatBal->Zone(ZoneNum).Volume, - state.dataHeatBal->CrossMixing(Loop).DesignLevel * Constant::SecInHour); + state.dataHeatBal->CrossMixing(Loop).DesignLevel * Constant::rSecsInHour); print(state.files.eio, "{},", state.dataHeatBal->Zone(state.dataHeatBal->CrossMixing(Loop).FromZone).Name); print(state.files.eio, "{:.2R}\n", state.dataHeatBal->CrossMixing(Loop).DeltaTemperature); @@ -4438,7 +3955,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err state.dataHeatBal->RefDoorMixing(ZoneNumA).DoorMixingObjectName(ConnectionNumber), state.dataHeatBal->Zone(ZoneNumA).Name, state.dataHeatBal->Zone(ZoneNumB).Name, - ScheduleManager::GetScheduleName(state, state.dataHeatBal->RefDoorMixing(ZoneNumA).OpenSchedPtr(ConnectionNumber)), + state.dataHeatBal->RefDoorMixing(ZoneNumA).openScheds(ConnectionNumber)->Name, state.dataHeatBal->RefDoorMixing(ZoneNumA).DoorHeight(ConnectionNumber), state.dataHeatBal->RefDoorMixing(ZoneNumA).DoorArea(ConnectionNumber), state.dataHeatBal->RefDoorMixing(ZoneNumA).DoorProtTypeName(ConnectionNumber)); @@ -4815,7 +4332,7 @@ void InitSimpleMixingConvectiveHeatGains(EnergyPlusData &state) if (state.dataHeatBal->AirFlowFlag) { // Simplified airflow calculation // Process the scheduled Mixing for air heat balance for (auto &thisMixing : state.dataHeatBal->Mixing) { - thisMixing.DesiredAirFlowRate = thisMixing.DesignLevel * ScheduleManager::GetCurrentScheduleValue(state, thisMixing.SchedPtr); + thisMixing.DesiredAirFlowRate = thisMixing.DesignLevel * thisMixing.sched->getCurrentVal(); if (thisMixing.EMSSimpleMixingOn) thisMixing.DesiredAirFlowRate = thisMixing.EMSimpleMixingFlowRate; thisMixing.DesiredAirFlowRateSaved = thisMixing.DesiredAirFlowRate; } @@ -4840,7 +4357,7 @@ void InitSimpleMixingConvectiveHeatGains(EnergyPlusData &state) // Process the scheduled CrossMixing for air heat balance for (auto &thisCrossMix : state.dataHeatBal->CrossMixing) { - thisCrossMix.DesiredAirFlowRate = thisCrossMix.DesignLevel * ScheduleManager::GetCurrentScheduleValue(state, thisCrossMix.SchedPtr); + thisCrossMix.DesiredAirFlowRate = thisCrossMix.DesignLevel * thisCrossMix.sched->getCurrentVal(); if (thisCrossMix.EMSSimpleMixingOn) thisCrossMix.DesiredAirFlowRate = thisCrossMix.EMSimpleMixingFlowRate; } @@ -4954,11 +4471,11 @@ void ReportZoneMeanAirTemp(EnergyPlusData &state) state.dataHeatBalAirMgr->CalcExtraReportVarMyOneTimeFlag = false; } for (int ZoneLoop = 1; ZoneLoop <= state.dataGlobal->NumOfZones; ++ZoneLoop) { - auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneLoop); + auto const &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneLoop); calcMeanAirTemps(state, thisZoneHB.ZTAV, thisZoneHB.airHumRatAvg, thisZoneHB.MRT, state.dataHeatBal->ZnAirRpt(ZoneLoop), ZoneLoop); if (state.dataHeatBal->doSpaceHeatBalanceSimulation) { for (int spaceNum : state.dataHeatBal->Zone(ZoneLoop).spaceIndexes) { - auto &thisSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum); + auto const &thisSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum); calcMeanAirTemps( state, thisSpaceHB.ZTAV, thisSpaceHB.airHumRatAvg, thisSpaceHB.MRT, state.dataHeatBal->spaceAirRpt(spaceNum), ZoneLoop); } @@ -4991,8 +4508,7 @@ void calcMeanAirTemps(EnergyPlusData &state, Real64 thisMRTFraction; // temp working value for radiative fraction/weight // is operative temp radiative fraction scheduled or fixed? if (state.dataZoneCtrls->TempControlledZone(TempControlledZoneID).OpTempCntrlModeScheduled) { - thisMRTFraction = ScheduleManager::GetCurrentScheduleValue( - state, state.dataZoneCtrls->TempControlledZone(TempControlledZoneID).OpTempRadiativeFractionSched); + thisMRTFraction = state.dataZoneCtrls->TempControlledZone(TempControlledZoneID).opTempRadiativeFractionSched->getCurrentVal(); } else { thisMRTFraction = state.dataZoneCtrls->TempControlledZone(TempControlledZoneID).FixedRadiativeFraction; } diff --git a/src/EnergyPlus/HeatBalanceAirManager.hh b/src/EnergyPlus/HeatBalanceAirManager.hh index 4339ab1a68c..cf193bd44e7 100644 --- a/src/EnergyPlus/HeatBalanceAirManager.hh +++ b/src/EnergyPlus/HeatBalanceAirManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -101,6 +101,10 @@ struct HeatBalanceAirMgrData : BaseGlobalStruct bool ManageAirHeatBalanceGetInputFlag = true; bool CalcExtraReportVarMyOneTimeFlag = true; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/HeatBalanceHAMTManager.cc b/src/EnergyPlus/HeatBalanceHAMTManager.cc index ebdb33c004b..0875bfd378e 100644 --- a/src/EnergyPlus/HeatBalanceHAMTManager.cc +++ b/src/EnergyPlus/HeatBalanceHAMTManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -285,7 +285,7 @@ namespace HeatBalanceHAMTManager { auto *mat = s_mat->materials(matNum); if (mat->group != Material::Group::Regular) { - ShowSevereCustomMessage(state, eoh, format("{} = \"{}\" is not a regular material.", cAlphaFieldNames(1), AlphaArray(1))); + ShowSevereCustom(state, eoh, format("{} = \"{}\" is not a regular material.", cAlphaFieldNames(1), AlphaArray(1))); ErrorsFound = true; continue; } @@ -334,7 +334,7 @@ namespace HeatBalanceHAMTManager { auto *mat = s_mat->materials(matNum); if (!mat->hasHAMT) { - ShowSevereCustomMessage(state, eoh, format("{} is not defined for {} = \"{}\"", cHAMTObject1, cAlphaFieldNames(1), AlphaArray(1))); + ShowSevereCustom(state, eoh, format("{} is not defined for {} = \"{}\"", cHAMTObject1, cAlphaFieldNames(1), AlphaArray(1))); ErrorsFound = true; continue; } @@ -426,7 +426,7 @@ namespace HeatBalanceHAMTManager { auto *mat = s_mat->materials(matNum); if (!mat->hasHAMT) { - ShowSevereCustomMessage(state, eoh, format("{} is not defined for {} = \"{}\"", cHAMTObject1, cAlphaFieldNames(1), AlphaArray(1))); + ShowSevereCustom(state, eoh, format("{} is not defined for {} = \"{}\"", cHAMTObject1, cAlphaFieldNames(1), AlphaArray(1))); ErrorsFound = true; continue; } @@ -473,7 +473,7 @@ namespace HeatBalanceHAMTManager { auto *mat = s_mat->materials(matNum); if (!mat->hasHAMT) { - ShowSevereCustomMessage(state, eoh, format("{} is not defined for {} = \"{}\"", cHAMTObject1, cAlphaFieldNames(1), AlphaArray(1))); + ShowSevereCustom(state, eoh, format("{} is not defined for {} = \"{}\"", cHAMTObject1, cAlphaFieldNames(1), AlphaArray(1))); ErrorsFound = true; continue; } @@ -520,7 +520,7 @@ namespace HeatBalanceHAMTManager { auto *mat = s_mat->materials(matNum); if (!mat->hasHAMT) { - ShowSevereCustomMessage(state, eoh, format("{} is not defined for {} = \"{}\"", cHAMTObject1, cAlphaFieldNames(1), AlphaArray(1))); + ShowSevereCustom(state, eoh, format("{} is not defined for {} = \"{}\"", cHAMTObject1, cAlphaFieldNames(1), AlphaArray(1))); ErrorsFound = true; continue; } @@ -569,7 +569,7 @@ namespace HeatBalanceHAMTManager { auto *mat = s_mat->materials(matNum); if (!mat->hasHAMT) { - ShowSevereCustomMessage(state, eoh, format("{} is not defined for {} = \"{}\"", cHAMTObject1, cAlphaFieldNames(1), AlphaArray(1))); + ShowSevereCustom(state, eoh, format("{} is not defined for {} = \"{}\"", cHAMTObject1, cAlphaFieldNames(1), AlphaArray(1))); ErrorsFound = true; continue; } diff --git a/src/EnergyPlus/HeatBalanceHAMTManager.hh b/src/EnergyPlus/HeatBalanceHAMTManager.hh index 5fc7516378b..18cab702575 100644 --- a/src/EnergyPlus/HeatBalanceHAMTManager.hh +++ b/src/EnergyPlus/HeatBalanceHAMTManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -227,6 +227,10 @@ struct HeatBalHAMTMgrData : BaseGlobalStruct int qvpErrCount = 0; int qvpErrReport = 0; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/HeatBalanceIntRadExchange.cc b/src/EnergyPlus/HeatBalanceIntRadExchange.cc index a62ea45dfc0..33c65b3c18c 100644 --- a/src/EnergyPlus/HeatBalanceIntRadExchange.cc +++ b/src/EnergyPlus/HeatBalanceIntRadExchange.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -412,7 +412,7 @@ namespace HeatBalanceIntRadExchange { } } - void UpdateMovableInsulationFlag(EnergyPlusData &state, bool &MovableInsulationChange, int const SurfNum) + void UpdateMovableInsulationFlag(EnergyPlusData &state, bool &change, int const SurfNum) { // SUBROUTINE INFORMATION: @@ -424,16 +424,14 @@ namespace HeatBalanceIntRadExchange { // If there have been changes due to a schedule change AND a change in properties, // then the matrices which are used to calculate interior radiation must be recalculated. - MovableInsulationChange = false; + auto &s_surf = state.dataSurface; - if (state.dataHeatBalSurf->SurfMovInsulIntPresent(SurfNum) != state.dataHeatBalSurf->SurfMovInsulIntPresentPrevTS(SurfNum)) { - auto const &thissurf = state.dataSurface->Surface(SurfNum); - Real64 AbsorpDiff = std::abs(state.dataConstruction->Construct(thissurf.Construction).InsideAbsorpThermal - - state.dataMaterial->materials(state.dataSurface->SurfMaterialMovInsulInt(SurfNum))->AbsorpThermal); - if (AbsorpDiff > 0.01) { - MovableInsulationChange = true; - } - } + change = false; + + auto &movInsul = s_surf->intMovInsuls(SurfNum); + if (movInsul.present != movInsul.presentPrevTS) + change = (std::abs(state.dataConstruction->Construct(s_surf->Surface(SurfNum).Construction).InsideAbsorpThermal - + state.dataMaterial->materials(movInsul.matNum)->AbsorpThermal) > 0.01); } void InitInteriorRadExchange(EnergyPlusData &state) diff --git a/src/EnergyPlus/HeatBalanceIntRadExchange.hh b/src/EnergyPlus/HeatBalanceIntRadExchange.hh index 1b8415522a5..672303ca2ab 100644 --- a/src/EnergyPlus/HeatBalanceIntRadExchange.hh +++ b/src/EnergyPlus/HeatBalanceIntRadExchange.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -182,6 +182,10 @@ struct HeatBalanceIntRadExchgData : BaseGlobalStruct bool ViewFactorReport = false; // Flag to output view factor report in eio file int LargestSurf = 0; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/HeatBalanceInternalHeatGains.cc b/src/EnergyPlus/HeatBalanceInternalHeatGains.cc index 3daab1fdef6..08b161f2ac8 100644 --- a/src/EnergyPlus/HeatBalanceInternalHeatGains.cc +++ b/src/EnergyPlus/HeatBalanceInternalHeatGains.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/HeatBalanceInternalHeatGains.hh b/src/EnergyPlus/HeatBalanceInternalHeatGains.hh index 2af13a0c90d..b4e628b75e8 100644 --- a/src/EnergyPlus/HeatBalanceInternalHeatGains.hh +++ b/src/EnergyPlus/HeatBalanceInternalHeatGains.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -86,6 +86,10 @@ void SetupSpaceInternalGain(EnergyPlusData &state, struct HeatBalInternalHeatGainsData : BaseGlobalStruct { + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/HeatBalanceKivaManager.cc b/src/EnergyPlus/HeatBalanceKivaManager.cc index a3c6b3425bd..c58fef8d095 100644 --- a/src/EnergyPlus/HeatBalanceKivaManager.cc +++ b/src/EnergyPlus/HeatBalanceKivaManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -50,8 +50,8 @@ // Kiva Headers #include #ifdef GROUND_PLOT -#include -#include +# include +# include #endif // EnergyPlus Headers @@ -179,7 +179,7 @@ void KivaInstanceMap::initGround(EnergyPlusData &state, const KivaWeatherData &k int accDate = getAccDate(state, numAccelaratedTimesteps, acceleratedTimestep); // Initialize with steady state before accelerated timestepping instance.ground->foundation.numericalScheme = Kiva::Foundation::NS_STEADY_STATE; - setInitialBoundaryConditions(state, kivaWeather, accDate, 24, state.dataGlobal->NumOfTimeStepInHour); + setInitialBoundaryConditions(state, kivaWeather, accDate, 24, state.dataGlobal->TimeStepsInHour); instance.calculate(); accDate += acceleratedTimestep; while (accDate > 365 + state.dataWeather->LeapYearAdd) { @@ -189,7 +189,7 @@ void KivaInstanceMap::initGround(EnergyPlusData &state, const KivaWeatherData &k // Accelerated timestepping instance.ground->foundation.numericalScheme = Kiva::Foundation::NS_IMPLICIT; for (int i = 0; i < numAccelaratedTimesteps; ++i) { - setInitialBoundaryConditions(state, kivaWeather, accDate, 24, state.dataGlobal->NumOfTimeStepInHour); + setInitialBoundaryConditions(state, kivaWeather, accDate, 24, state.dataGlobal->TimeStepsInHour); instance.calculate(acceleratedTimestep * 24 * 60 * 60); accDate += acceleratedTimestep; while (accDate > 365 + state.dataWeather->LeapYearAdd) { @@ -222,9 +222,9 @@ void KivaInstanceMap::setInitialBoundaryConditions( if (kivaWeather.intervalsPerHour == 1) { index = (date - 1) * 24 + (hour - 1); - weightNow = min(1.0, (double(timestep) / double(state.dataGlobal->NumOfTimeStepInHour))); + weightNow = min(1.0, (double(timestep) / double(state.dataGlobal->TimeStepsInHour))); } else { - index = (date - 1) * 24 * state.dataGlobal->NumOfTimeStepInHour + (hour - 1) * state.dataGlobal->NumOfTimeStepInHour + (timestep - 1); + index = (date - 1) * 24 * state.dataGlobal->TimeStepsInHour + (hour - 1) * state.dataGlobal->TimeStepsInHour + (timestep - 1); weightNow = 1.0; // weather data interval must be the same as the timestep interval (i.e., no interpolation) } if (index == 0) { @@ -268,37 +268,37 @@ void KivaInstanceMap::setInitialBoundaryConditions( } case KIVAZONE_TEMPCONTROL: { - int controlTypeSchId = state.dataZoneCtrls->TempControlledZone(zoneControlNum).CTSchedIndex; - HVAC::ThermostatType controlType = - static_cast(ScheduleManager::LookUpScheduleValue(state, controlTypeSchId, hour, timestep)); + auto const *ctrlTypeSched = state.dataZoneCtrls->TempControlledZone(zoneControlNum).setptTypeSched; + HVAC::SetptType controlType = static_cast(ctrlTypeSched->getHrTsVal(state, hour, timestep)); switch (controlType) { - case HVAC::ThermostatType::Uncontrolled: + case HVAC::SetptType::Uncontrolled: Tin = assumedFloatingTemp + Constant::Kelvin; break; - case HVAC::ThermostatType::SingleHeating: { - int schNameId = state.dataZoneCtrls->TempControlledZone(zoneControlNum).SchIndx_SingleHeatSetPoint; - Real64 setpoint = ScheduleManager::LookUpScheduleValue(state, schNameId, hour, timestep); + case HVAC::SetptType::SingleHeat: { + auto const *sched = state.dataZoneCtrls->TempControlledZone(zoneControlNum).setpts[(int)controlType].heatSetptSched; + Real64 setpoint = sched->getHrTsVal(state, hour, timestep); Tin = setpoint + Constant::Kelvin; - break; - } - case HVAC::ThermostatType::SingleCooling: { - int schNameId = state.dataZoneCtrls->TempControlledZone(zoneControlNum).SchIndx_SingleCoolSetPoint; - Real64 setpoint = ScheduleManager::LookUpScheduleValue(state, schNameId, hour, timestep); + } break; + + case HVAC::SetptType::SingleCool: { + auto const *sched = state.dataZoneCtrls->TempControlledZone(zoneControlNum).setpts[(int)controlType].coolSetptSched; + Real64 setpoint = sched->getHrTsVal(state, hour, timestep); Tin = setpoint + Constant::Kelvin; - break; - } - case HVAC::ThermostatType::SingleHeatCool: { - int schNameId = state.dataZoneCtrls->TempControlledZone(zoneControlNum).SchIndx_SingleHeatCoolSetPoint; - Real64 setpoint = ScheduleManager::LookUpScheduleValue(state, schNameId, hour, timestep); + } break; + + case HVAC::SetptType::SingleHeatCool: { + // Heat and cool setpt scheds will be the same for this option + auto const *sched = state.dataZoneCtrls->TempControlledZone(zoneControlNum).setpts[(int)controlType].heatSetptSched; + Real64 setpoint = sched->getHrTsVal(state, hour, timestep); Tin = setpoint + Constant::Kelvin; - break; - } - case HVAC::ThermostatType::DualSetPointWithDeadBand: { - int schNameIdHeat = state.dataZoneCtrls->TempControlledZone(zoneControlNum).SchIndx_DualSetPointWDeadBandHeat; - int schNameIdCool = state.dataZoneCtrls->TempControlledZone(zoneControlNum).SchIndx_DualSetPointWDeadBandCool; - Real64 heatSetpoint = ScheduleManager::LookUpScheduleValue(state, schNameIdHeat, hour, timestep); - Real64 coolSetpoint = ScheduleManager::LookUpScheduleValue(state, schNameIdCool, hour, timestep); + } break; + + case HVAC::SetptType::DualHeatCool: { + auto const *heatSched = state.dataZoneCtrls->TempControlledZone(zoneControlNum).setpts[(int)controlType].heatSetptSched; + auto const *coolSched = state.dataZoneCtrls->TempControlledZone(zoneControlNum).setpts[(int)controlType].coolSetptSched; + Real64 heatSetpoint = heatSched->getHrTsVal(state, hour, timestep); + Real64 coolSetpoint = coolSched->getHrTsVal(state, hour, timestep); constexpr Real64 heatBalanceTemp = 10.0 + Constant::Kelvin; // (assumed) constexpr Real64 coolBalanceTemp = 15.0 + Constant::Kelvin; // (assumed) @@ -310,16 +310,18 @@ void KivaInstanceMap::setInitialBoundaryConditions( Real64 weight = (coolBalanceTemp - bcs->outdoorTemp) / (coolBalanceTemp - heatBalanceTemp); Tin = heatSetpoint * weight + coolSetpoint * (1.0 - weight) + Constant::Kelvin; } - break; - } - default: + } break; + + default: { Tin = 0.0; ShowSevereError(state, format("Illegal control type for Zone={}, Found value={}, in Schedule={}", state.dataHeatBal->Zone(zoneNum).Name, controlType, - state.dataZoneCtrls->TempControlledZone(zoneControlNum).ControlTypeSchedName)); - } + state.dataZoneCtrls->TempControlledZone(zoneControlNum).setptTypeSched->Name)); + } break; + + } // switch (tstatType) break; } case KIVAZONE_COMFORTCONTROL: { @@ -329,10 +331,10 @@ void KivaInstanceMap::setInitialBoundaryConditions( } case KIVAZONE_STAGEDCONTROL: { - int heatSpSchId = state.dataZoneCtrls->StageControlledZone(zoneControlNum).HSBchedIndex; - int coolSpSchId = state.dataZoneCtrls->StageControlledZone(zoneControlNum).CSBchedIndex; - Real64 heatSetpoint = ScheduleManager::LookUpScheduleValue(state, heatSpSchId, hour, timestep); - Real64 coolSetpoint = ScheduleManager::LookUpScheduleValue(state, coolSpSchId, hour, timestep); + auto const *heatSched = state.dataZoneCtrls->StageControlledZone(zoneControlNum).heatSetptBaseSched; + auto const *coolSched = state.dataZoneCtrls->StageControlledZone(zoneControlNum).coolSetptBaseSched; + Real64 heatSetpoint = heatSched->getHrTsVal(state, hour, timestep); + Real64 coolSetpoint = coolSched->getHrTsVal(state, hour, timestep); constexpr Real64 heatBalanceTemp = 10.0 + Constant::Kelvin; // (assumed) constexpr Real64 coolBalanceTemp = 15.0 + Constant::Kelvin; // (assumed) if (bcs->outdoorTemp < heatBalanceTemp) { @@ -377,7 +379,7 @@ void KivaInstanceMap::setBoundaryConditions(EnergyPlusData &state) bcs->outdoorTemp = state.dataEnvrn->OutDryBulbTemp + Constant::Kelvin; bcs->localWindSpeed = DataEnvironment::WindSpeedAt(state, instance.ground->foundation.grade.roughness); - bcs->windDirection = state.dataEnvrn->WindDir * Constant::DegToRadians; + bcs->windDirection = state.dataEnvrn->WindDir * Constant::DegToRad; bcs->solarAzimuth = std::atan2(state.dataEnvrn->SOLCOS(1), state.dataEnvrn->SOLCOS(2)); bcs->solarAltitude = Constant::PiOvr2 - std::acos(state.dataEnvrn->SOLCOS(3)); bcs->directNormalFlux = state.dataEnvrn->BeamSolarRad; diff --git a/src/EnergyPlus/HeatBalanceKivaManager.hh b/src/EnergyPlus/HeatBalanceKivaManager.hh index 5cc8015ba17..7ad5028494d 100644 --- a/src/EnergyPlus/HeatBalanceKivaManager.hh +++ b/src/EnergyPlus/HeatBalanceKivaManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/HeatBalanceManager.cc b/src/EnergyPlus/HeatBalanceManager.cc index a4c2d6ceed3..11c2edcd2d9 100644 --- a/src/EnergyPlus/HeatBalanceManager.cc +++ b/src/EnergyPlus/HeatBalanceManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -79,7 +79,6 @@ #include #include #include -#include #include #include #include @@ -512,6 +511,7 @@ namespace HeatBalanceManager { // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetProjectControlData: "); + static constexpr std::string_view routineName = "GetProjectControlData"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Array1D_string AlphaName(4); @@ -824,13 +824,13 @@ namespace HeatBalanceManager { state.dataHeatBal->OverallHeatTransferSolutionAlgo = DataSurfaces::HeatTransferModel::CondFD; state.dataHeatBal->AnyCondFD = true; state.dataHeatBal->AllCTF = false; - if (state.dataGlobal->NumOfTimeStepInHour < 20) { + if (state.dataGlobal->TimeStepsInHour < 20) { ShowSevereError( state, format("GetSolutionAlgorithm: {} {} is Conduction Finite Difference but Number of TimeSteps in Hour < 20, Value is {}.", state.dataHeatBalMgr->CurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), - state.dataGlobal->NumOfTimeStepInHour)); + state.dataGlobal->TimeStepsInHour)); ShowContinueError(state, "...Suggested minimum number of time steps in hour for Conduction Finite Difference solutions is 20. " "Errors or inaccurate calculations may occur."); @@ -840,13 +840,13 @@ namespace HeatBalanceManager { state.dataHeatBal->OverallHeatTransferSolutionAlgo = DataSurfaces::HeatTransferModel::HAMT; state.dataHeatBal->AnyHAMT = true; state.dataHeatBal->AllCTF = false; - if (state.dataGlobal->NumOfTimeStepInHour < 20) { + if (state.dataGlobal->TimeStepsInHour < 20) { ShowSevereError(state, format("GetSolutionAlgorithm: {} {} is Combined Heat and Moisture Finite Element but Number of TimeSteps in " "Hour < 20, Value is {}.", state.dataHeatBalMgr->CurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), - state.dataGlobal->NumOfTimeStepInHour)); + state.dataGlobal->TimeStepsInHour)); ShowContinueError(state, "...Suggested minimum number of time steps in hour for Combined Heat and Moisture Finite Element solutions " "is 20. Errors or inaccurate calculations may occur."); @@ -993,8 +993,11 @@ namespace HeatBalanceManager { state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, state.dataHeatBalMgr->CurrentModuleObject, state.dataHeatBalMgr->CurrentModuleObject}; + if (NumAlpha > 0) { - { + { // Why an extra nested scope here? std::string const &SELECT_CASE_var = AlphaName(1); if (SELECT_CASE_var == "YES") { state.dataContaminantBalance->Contaminant.CO2Simulation = true; @@ -1011,23 +1014,17 @@ namespace HeatBalanceManager { } } } - if (NumAlpha == 1 && state.dataContaminantBalance->Contaminant.CO2Simulation) { - ShowSevereError(state, - format("{}, {} is required and not given.", - state.dataHeatBalMgr->CurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(2))); - ErrorsFound = true; - } else if (NumAlpha > 1 && state.dataContaminantBalance->Contaminant.CO2Simulation) { - state.dataContaminantBalance->Contaminant.CO2OutdoorSchedPtr = ScheduleManager::GetScheduleIndex(state, AlphaName(2)); - if (state.dataContaminantBalance->Contaminant.CO2OutdoorSchedPtr == 0) { - ShowSevereError(state, - format("{}, {} not found: {}", - state.dataHeatBalMgr->CurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(2), - AlphaName(2))); + + if (state.dataContaminantBalance->Contaminant.CO2Simulation) { + if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { + ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(2)); + ErrorsFound = true; + } else if ((state.dataContaminantBalance->Contaminant.CO2OutdoorSched = Sched::GetSchedule(state, AlphaName(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(2), AlphaName(2)); ErrorsFound = true; } } + if (NumAlpha > 2) { { std::string const &SELECT_CASE_var = AlphaName(3); @@ -1046,6 +1043,7 @@ namespace HeatBalanceManager { state.dataIPShortCut->cAlphaFieldNames(3))); } } + if (NumAlpha == 3 && state.dataContaminantBalance->Contaminant.GenericContamSimulation) { ShowSevereError(state, format("{}, {} is required and not given.", @@ -1053,8 +1051,7 @@ namespace HeatBalanceManager { state.dataIPShortCut->cAlphaFieldNames(4))); ErrorsFound = true; } else if (NumAlpha > 3 && state.dataContaminantBalance->Contaminant.GenericContamSimulation) { - state.dataContaminantBalance->Contaminant.GenericContamOutdoorSchedPtr = ScheduleManager::GetScheduleIndex(state, AlphaName(4)); - if (state.dataContaminantBalance->Contaminant.GenericContamOutdoorSchedPtr == 0) { + if ((state.dataContaminantBalance->Contaminant.genericOutdoorSched = Sched::GetSchedule(state, AlphaName(4))) == nullptr) { ShowSevereError(state, format("{}, {} not found: {}", state.dataHeatBalMgr->CurrentModuleObject, @@ -2077,12 +2074,13 @@ namespace HeatBalanceManager { void GetIncidentSolarMultiplier(EnergyPlusData &state, bool &ErrorsFound) { + static constexpr std::string_view RoutineName("GetIncidentSolarMultiplier: "); + static constexpr std::string_view routineName = "GetIncidentSolarMultiplier"; + auto &s_mat = state.dataMaterial; auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; cCurrentModuleObject = "SurfaceProperty:IncidentSolarMultiplier"; - static constexpr std::string_view RoutineName("GetIncidentSolarMultiplier: "); - state.dataSurface->TotSurfIncSolMultiplier = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); if (state.dataSurface->TotSurfIncSolMultiplier <= 0) return; @@ -2109,6 +2107,8 @@ namespace HeatBalanceManager { state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + // Assign surface number int SurfNum = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(1), state.dataSurface->Surface); if (SurfNum == 0) { @@ -2150,20 +2150,19 @@ namespace HeatBalanceManager { ErrorsFound = true; continue; } - int ScheduleIdx = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); - // Schedule not found but schedule field is not empty, user had the wrong schedule name - if (ScheduleIdx == 0 && !(state.dataIPShortCut->cAlphaArgs(2).empty())) { - ShowSevereError(state, "Invalid Incident Solar Multiplier Schedule Name in SurfaceProperty:IncidentSolarMultiplier"); - continue; - } + Surf.hasIncSolMultiplier = true; auto &SurfIncSolMult = state.dataSurface->SurfIncSolMultiplier(SurfNum); SurfIncSolMult.Name = state.dataIPShortCut->cAlphaArgs(1); SurfIncSolMult.SurfaceIdx = SurfNum; SurfIncSolMult.Scaler = state.dataIPShortCut->rNumericArgs(1); - SurfIncSolMult.SchedPtr = ScheduleIdx; - } - } + + if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { + } else if ((SurfIncSolMult.sched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2)); + } + } // for (Loop) + } // GetIncidentSolarMultiplier() void GetZoneLocalEnvData(EnergyPlusData &state, bool &ErrorsFound) // Error flag indicator (true if errors found) { @@ -2686,10 +2685,10 @@ namespace HeatBalanceManager { if (state.dataGlobal->BeginDayFlag && !state.dataGlobal->WarmupFlag && state.dataGlobal->KindOfSim == Constant::KindOfSim::RunPeriodWeather && state.dataSysVars->ReportExtShadingSunlitFrac) { - for (int iHour = 1; iHour <= 24; ++iHour) { // Do for all hours. - for (int TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { + for (int iHour = 1; iHour <= Constant::iHoursInDay; ++iHour) { // Do for all hours. + for (int TS = 1; TS <= state.dataGlobal->TimeStepsInHour; ++TS) { constexpr const char *ShdFracFmt1(" {:02}/{:02} {:02}:{:02},"); - if (TS == state.dataGlobal->NumOfTimeStepInHour) { + if (TS == state.dataGlobal->TimeStepsInHour) { print(state.files.shade, ShdFracFmt1, state.dataEnvrn->Month, state.dataEnvrn->DayOfMonth, iHour, 0); } else { print(state.files.shade, @@ -2697,7 +2696,7 @@ namespace HeatBalanceManager { state.dataEnvrn->Month, state.dataEnvrn->DayOfMonth, iHour - 1, - (60 / state.dataGlobal->NumOfTimeStepInHour) * TS); + (60 / state.dataGlobal->TimeStepsInHour) * TS); } for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { constexpr const char *ShdFracFmt2("{:10.8F},"); @@ -2723,30 +2722,30 @@ namespace HeatBalanceManager { SetOutAirNodes(state); for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { if (state.dataHeatBal->Zone(ZoneNum).LinkedOutAirNode > 0) { - if (state.dataLoopNodes->Node(state.dataHeatBal->Zone(ZoneNum).LinkedOutAirNode).OutAirDryBulbSchedNum > 0) { - state.dataHeatBal->Zone(ZoneNum).OutDryBulbTemp = ScheduleManager::GetCurrentScheduleValue( - state, state.dataLoopNodes->Node(state.dataHeatBal->Zone(ZoneNum).LinkedOutAirNode).OutAirDryBulbSchedNum); + if (state.dataLoopNodes->Node(state.dataHeatBal->Zone(ZoneNum).LinkedOutAirNode).outAirDryBulbSched != nullptr) { + state.dataHeatBal->Zone(ZoneNum).OutDryBulbTemp = + state.dataLoopNodes->Node(state.dataHeatBal->Zone(ZoneNum).LinkedOutAirNode).outAirDryBulbSched->getCurrentVal(); } else { state.dataHeatBal->Zone(ZoneNum).OutDryBulbTemp = state.dataLoopNodes->Node(state.dataHeatBal->Zone(ZoneNum).LinkedOutAirNode).OutAirDryBulb; } - if (state.dataLoopNodes->Node(state.dataHeatBal->Zone(ZoneNum).LinkedOutAirNode).OutAirWetBulbSchedNum > 0) { - state.dataHeatBal->Zone(ZoneNum).OutWetBulbTemp = ScheduleManager::GetCurrentScheduleValue( - state, state.dataLoopNodes->Node(state.dataHeatBal->Zone(ZoneNum).LinkedOutAirNode).OutAirWetBulbSchedNum); + if (state.dataLoopNodes->Node(state.dataHeatBal->Zone(ZoneNum).LinkedOutAirNode).outAirWetBulbSched != nullptr) { + state.dataHeatBal->Zone(ZoneNum).OutWetBulbTemp = + state.dataLoopNodes->Node(state.dataHeatBal->Zone(ZoneNum).LinkedOutAirNode).outAirWetBulbSched->getCurrentVal(); } else { state.dataHeatBal->Zone(ZoneNum).OutWetBulbTemp = state.dataLoopNodes->Node(state.dataHeatBal->Zone(ZoneNum).LinkedOutAirNode).OutAirWetBulb; } - if (state.dataLoopNodes->Node(state.dataHeatBal->Zone(ZoneNum).LinkedOutAirNode).OutAirWindSpeedSchedNum > 0) { - state.dataHeatBal->Zone(ZoneNum).WindSpeed = ScheduleManager::GetCurrentScheduleValue( - state, state.dataLoopNodes->Node(state.dataHeatBal->Zone(ZoneNum).LinkedOutAirNode).OutAirWindSpeedSchedNum); + if (state.dataLoopNodes->Node(state.dataHeatBal->Zone(ZoneNum).LinkedOutAirNode).outAirWindSpeedSched != nullptr) { + state.dataHeatBal->Zone(ZoneNum).WindSpeed = + state.dataLoopNodes->Node(state.dataHeatBal->Zone(ZoneNum).LinkedOutAirNode).outAirWindSpeedSched->getCurrentVal(); } else { state.dataHeatBal->Zone(ZoneNum).WindSpeed = state.dataLoopNodes->Node(state.dataHeatBal->Zone(ZoneNum).LinkedOutAirNode).OutAirWindSpeed; } - if (state.dataLoopNodes->Node(state.dataHeatBal->Zone(ZoneNum).LinkedOutAirNode).OutAirWindDirSchedNum > 0) { - state.dataHeatBal->Zone(ZoneNum).WindDir = ScheduleManager::GetCurrentScheduleValue( - state, state.dataLoopNodes->Node(state.dataHeatBal->Zone(ZoneNum).LinkedOutAirNode).OutAirWindDirSchedNum); + if (state.dataLoopNodes->Node(state.dataHeatBal->Zone(ZoneNum).LinkedOutAirNode).outAirWindDirSched != nullptr) { + state.dataHeatBal->Zone(ZoneNum).WindDir = + state.dataLoopNodes->Node(state.dataHeatBal->Zone(ZoneNum).LinkedOutAirNode).outAirWindDirSched->getCurrentVal(); } else { state.dataHeatBal->Zone(ZoneNum).WindDir = state.dataLoopNodes->Node(state.dataHeatBal->Zone(ZoneNum).LinkedOutAirNode).OutAirWindDir; @@ -2846,15 +2845,13 @@ namespace HeatBalanceManager { state.dataHeatBalFanSys->ZoneReOrder = 0; state.dataHeatBalFanSys->TempTstatAir.dimension(state.dataGlobal->NumOfZones, DataHeatBalance::ZoneInitialTemp); if (state.dataContaminantBalance->Contaminant.CO2Simulation) { - state.dataContaminantBalance->OutdoorCO2 = - ScheduleManager::GetCurrentScheduleValue(state, state.dataContaminantBalance->Contaminant.CO2OutdoorSchedPtr); + state.dataContaminantBalance->OutdoorCO2 = state.dataContaminantBalance->Contaminant.CO2OutdoorSched->getCurrentVal(); state.dataContaminantBalance->ZoneAirCO2.dimension(state.dataGlobal->NumOfZones, state.dataContaminantBalance->OutdoorCO2); state.dataContaminantBalance->ZoneAirCO2Temp.dimension(state.dataGlobal->NumOfZones, state.dataContaminantBalance->OutdoorCO2); state.dataContaminantBalance->ZoneAirCO2Avg.dimension(state.dataGlobal->NumOfZones, state.dataContaminantBalance->OutdoorCO2); } if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) { - state.dataContaminantBalance->OutdoorGC = - ScheduleManager::GetCurrentScheduleValue(state, state.dataContaminantBalance->Contaminant.GenericContamOutdoorSchedPtr); + state.dataContaminantBalance->OutdoorGC = state.dataContaminantBalance->Contaminant.genericOutdoorSched->getCurrentVal(); state.dataContaminantBalance->ZoneAirGC.dimension(state.dataGlobal->NumOfZones, state.dataContaminantBalance->OutdoorGC); state.dataContaminantBalance->ZoneAirGCTemp.dimension(state.dataGlobal->NumOfZones, state.dataContaminantBalance->OutdoorGC); state.dataContaminantBalance->ZoneAirGCAvg.dimension(state.dataGlobal->NumOfZones, state.dataContaminantBalance->OutdoorGC); @@ -2875,12 +2872,12 @@ namespace HeatBalanceManager { state.dataHeatBalMgr->WarmupLoadDiff.dimension(state.dataGlobal->NumOfZones, 0.0); state.dataHeatBalMgr->TempZone.dimension(state.dataGlobal->NumOfZones, 0.0); state.dataHeatBalMgr->LoadZone.dimension(state.dataGlobal->NumOfZones, 0.0); - state.dataHeatBalMgr->TempZoneRpt.dimension(state.dataGlobal->NumOfZones, state.dataGlobal->NumOfTimeStepInHour * 24, 0.0); - state.dataHeatBalMgr->LoadZoneRpt.dimension(state.dataGlobal->NumOfZones, state.dataGlobal->NumOfTimeStepInHour * 24, 0.0); - state.dataHeatBalMgr->MaxLoadZoneRpt.dimension(state.dataGlobal->NumOfZones, state.dataGlobal->NumOfTimeStepInHour * 24, 0.0); + state.dataHeatBalMgr->TempZoneRpt.dimension(state.dataGlobal->NumOfZones, state.dataGlobal->TimeStepsInHour * Constant::iHoursInDay, 0.0); + state.dataHeatBalMgr->LoadZoneRpt.dimension(state.dataGlobal->NumOfZones, state.dataGlobal->TimeStepsInHour * Constant::iHoursInDay, 0.0); + state.dataHeatBalMgr->MaxLoadZoneRpt.dimension(state.dataGlobal->NumOfZones, state.dataGlobal->TimeStepsInHour * Constant::iHoursInDay, 0.0); state.dataHeatBalMgr->WarmupConvergenceValues.allocate(state.dataGlobal->NumOfZones); - state.dataHeatBalMgr->TempZoneRptStdDev.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); - state.dataHeatBalMgr->LoadZoneRptStdDev.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); + state.dataHeatBalMgr->TempZoneRptStdDev.allocate(state.dataGlobal->TimeStepsInHour * Constant::iHoursInDay); + state.dataHeatBalMgr->LoadZoneRptStdDev.allocate(state.dataGlobal->TimeStepsInHour * Constant::iHoursInDay); // MassConservation.allocate( NumOfZones ); state.dataHeatBalFanSys->CrossedColdThreshRepPeriod.allocate(state.dataGlobal->NumOfZones, state.dataWeather->TotThermalReportPers); @@ -3014,8 +3011,9 @@ namespace HeatBalanceManager { // Update interior movable insulation flag--needed at the end of a zone time step so that the interior radiant // exchange algorithm knows whether there has been a change in interior movable insulation or not. if (state.dataSurface->AnyMovableInsulation) { - for (int surfNum : state.dataHeatBalSurf->SurfMovInsulIndexList) { - state.dataHeatBalSurf->SurfMovInsulIntPresentPrevTS(surfNum) = state.dataHeatBalSurf->SurfMovInsulIntPresent(surfNum); + for (int surfNum : state.dataSurface->intMovInsulSurfNums) { + auto &movInsul = state.dataSurface->intMovInsuls(surfNum); + movInsul.presentPrevTS = movInsul.present; } } @@ -3296,9 +3294,8 @@ namespace HeatBalanceManager { using EconomicTariff::UpdateUtilityBills; // added for computing annual utility costs using NodeInputManager::CalcMoreNodeInfo; using OutputReportTabular::UpdateTabularReports; - using ScheduleManager::ReportScheduleValues; - ReportScheduleValues(state); + Sched::ReportScheduleVals(state); if (!state.dataGlobal->WarmupFlag && state.dataGlobal->DoOutputReporting) { if (!state.dataGlobal->DoingSizing) { @@ -3592,7 +3589,6 @@ namespace HeatBalanceManager { // Using/Aliasing using namespace DataStringGlobals; using DataSystemVariables::CheckForActualFilePath; - using General::POLYF; // POLYF ! Polynomial in cosine of angle of incidence // SUBROUTINE PARAMETER DEFINITIONS: Array1D_string const NumName(5, {"1", "2", "3", "4", "5"}); @@ -3624,26 +3620,31 @@ namespace HeatBalanceManager { int FrDivNum; // FrameDivider number Array1D WinHeight(2); // Height, width for glazing system (m) Array1D WinWidth(2); - Array1D UValCenter(2); // Center of glass U-value (W/m2-K) for glazing system - Array1D SCCenter(2); // Center of glass shading coefficient for glazing system - Array1D SHGCCenter(2); // Center of glass solar heat gain coefficient for glazing system - Array1D TVisCenter(2); // Center of glass visible transmittance for glazing system - Array1D Tsol(11); // Solar transmittance vs incidence angle; diffuse trans. - Array2D AbsSol(11, 5); // Solar absorptance vs inc. angle in each glass layer - Array1D Rfsol(11); // Front solar reflectance vs inc. angle - Array1D Rbsol(11); // Back solar reflectance vs inc. angle - Array1D Tvis(11); // Visible transmittance vs inc. angle - Array1D Rfvis(11); // Front visible reflectance vs inc. angle - Array1D Rbvis(11); // Back visible reflectance vs inc. angle - Array1D CosPhiIndepVar(10); // Cosine of incidence angle from 0 to 90 deg in 10 deg increments - int IPhi; // Incidence angle counter - Real64 Phi; // Incidence angle (deg) - Array1D CosPhi(10); // Cosine of incidence angle - Array1D tsolFit(10); // Fitted solar transmittance vs incidence angle - Array1D tvisFit(10); // Fitted visible transmittance vs incidence angle - Array1D rfsolFit(10); // Fitted solar front reflectance vs incidence angle - Array2D solabsFit(5, 10); // Fitted solar absorptance vs incidence angle for each glass layer - Array1D_string DividerType(2); // Divider type: DividedLite or Suspended + Array1D UValCenter(2); // Center of glass U-value (W/m2-K) for glazing system + Array1D SCCenter(2); // Center of glass shading coefficient for glazing system + Array1D SHGCCenter(2); // Center of glass solar heat gain coefficient for glazing system + Array1D TVisCenter(2); // Center of glass visible transmittance for glazing system + Array1D TsolTemp(Window::numPhis + 1); // Solar transmittance vs incidence angle; diffuse trans. + std::array Tsol; + Array2D AbsSolTemp(Window::maxGlassLayers, Window::numPhis + 1); // Solar absorptance vs inc. angle in each glass layer + Array1D> AbsSol(Window::maxGlassLayers); // Solar absorptance vs inc. angle in each glass layer + Array1D RfsolTemp(Window::numPhis + 1); // Front solar reflectance vs inc. angle + std::array Rfsol; + Array1D RbsolTemp(Window::numPhis + 1); // Back solar reflectance vs inc. angle + std::array Rbsol; + Array1D TvisTemp(Window::numPhis + 1); // Visible transmittance vs inc. angle + std::array Tvis; + Array1D RfvisTemp(Window::numPhis + 1); // Front visible reflectance vs inc. angle + std::array Rfvis; + Array1D RbvisTemp(Window::numPhis + 1); // Back visible reflectance vs inc. angle + std::array Rbvis; + + std::array tsolFit; // Fitted solar transmittance vs incidence angle + std::array tvisFit; // Fitted visible transmittance vs incidence angle + std::array rfsolFit; // Fitted solar front reflectance vs incidence angle + Array1D> solabsFit( + Window::maxGlassLayers); // Fitted solar absorptance vs incidence angle for each glass layer + Array1D_string DividerType(2); // Divider type: DividedLite or Suspended Real64 FrameWidth; Real64 MullionWidth; Real64 FrameProjectionOut; @@ -4134,17 +4135,19 @@ namespace HeatBalanceManager { if (NextLine.eof) goto Label1000; ++FileLineCount; + // When pulling in develop, the following two blocks appear to have been modified in develop, + // but removed entirely in this branch. I'm going to leave them commented. // Pre-calculate constants - for (IPhi = 1; IPhi <= 10; ++IPhi) { - CosPhiIndepVar(IPhi) = std::cos((IPhi - 1) * 10.0 * Constant::DegToRadians); - } + // for (IPhi = 1; IPhi <= 10; ++IPhi) { + // CosPhiIndepVar(IPhi) = std::cos((IPhi - 1) * 10.0 * Constant::DegToRad); + //} // Pre-calculate constants - for (IPhi = 1; IPhi <= 10; ++IPhi) { - Phi = double(IPhi - 1) * 10.0; - CosPhi(IPhi) = std::cos(Phi * Constant::DegToRadians); - if (std::abs(CosPhi(IPhi)) < 0.0001) CosPhi(IPhi) = 0.0; - } + // for (IPhi = 1; IPhi <= 10; ++IPhi) { + // Phi = double(IPhi - 1) * 10.0; + // CosPhi(IPhi) = std::cos(Phi * Constant::DegToRad); + // if (std::abs(CosPhi(IPhi)) < 0.0001) CosPhi(IPhi) = 0.0; + //} for (IGlSys = 1; IGlSys <= NGlSys; ++IGlSys) { ConstrNum = state.dataHeatBal->TotConstructs - NGlSys + IGlSys; @@ -4186,7 +4189,7 @@ namespace HeatBalanceManager { thisConstruct.AbsDiffShade = 0.0; thisConstruct.AbsDiffBackShade = 0.0; thisConstruct.ShadeAbsorpThermal = 0.0; - thisConstruct.AbsBeamShadeCoef = 0.0; + std::fill(thisConstruct.AbsBeamShadeCoef.begin(), thisConstruct.AbsBeamShadeCoef.end(), 0.0); thisConstruct.AbsDiffIn = 0.0; thisConstruct.AbsDiffOut = 0.0; thisConstruct.TransDiff = 0.0; @@ -4195,20 +4198,18 @@ namespace HeatBalanceManager { thisConstruct.ReflectSolDiffFront = 0.0; thisConstruct.ReflectVisDiffBack = 0.0; thisConstruct.ReflectVisDiffFront = 0.0; - thisConstruct.TransSolBeamCoef = 0.0; - thisConstruct.TransVisBeamCoef = 0.0; - thisConstruct.ReflSolBeamFrontCoef = 0.0; - thisConstruct.ReflSolBeamBackCoef = 0.0; + std::fill(thisConstruct.TransSolBeamCoef.begin(), thisConstruct.TransSolBeamCoef.end(), 0.0); + std::fill(thisConstruct.TransVisBeamCoef.begin(), thisConstruct.TransVisBeamCoef.end(), 0.0); + std::fill(thisConstruct.ReflSolBeamFrontCoef.begin(), thisConstruct.ReflSolBeamFrontCoef.end(), 0.0); + std::fill(thisConstruct.ReflSolBeamBackCoef.begin(), thisConstruct.ReflSolBeamBackCoef.end(), 0.0); thisConstruct.W5FrameDivider = 0; thisConstruct.TotLayers = NGlass(IGlSys) + NGaps(IGlSys); thisConstruct.TotGlassLayers = NGlass(IGlSys); thisConstruct.TotSolidLayers = NGlass(IGlSys); for (int Layer = 1; Layer <= state.dataHeatBal->MaxSolidWinLayers; ++Layer) { - for (int index = 1; index <= DataSurfaces::MaxPolyCoeff; ++index) { - thisConstruct.AbsBeamCoef(Layer)(index) = 0.0; - thisConstruct.AbsBeamBackCoef(Layer)(index) = 0.0; - } + std::fill(thisConstruct.AbsBeamCoef(Layer).begin(), thisConstruct.AbsBeamCoef(Layer).end(), 0.0); + std::fill(thisConstruct.AbsBeamBackCoef(Layer).begin(), thisConstruct.AbsBeamBackCoef(Layer).end(), 0.0); } for (IGlass = 1; IGlass <= NGlass(IGlSys); ++IGlass) { @@ -4242,25 +4243,26 @@ namespace HeatBalanceManager { NextLine = W5DataFile.readLine(); if (NextLine.eof) goto Label1000; ++FileLineCount; - if (!readItem(NextLine.data.substr(5), Tsol)) { + if (!readItem(NextLine.data.substr(5), TsolTemp)) { ShowSevereError(state, "HeatBalanceManager: SearchWindow5DataFile: Error in Read of TSol values."); ShowContinueError(state, format("Line (~{}) in error (first 100 characters)={}", FileLineCount, NextLine.data.substr(0, 100))); ErrorsFound = true; - } else if (any_lt(Tsol, 0.0) || any_gt(Tsol, 1.0)) { + } else if (any_lt(TsolTemp, 0.0) || any_gt(TsolTemp, 1.0)) { ShowSevereError(state, "HeatBalanceManager: SearchWindow5DataFile: Error in Read of TSol values. (out of range [0,1])"); ShowContinueError(state, format("Line (~{}) in error (first 100 characters)={}", FileLineCount, NextLine.data.substr(0, 100))); ErrorsFound = true; } + for (IGlass = 1; IGlass <= NGlass(IGlSys); ++IGlass) { NextLine = W5DataFile.readLine(); ++FileLineCount; - if (!readItem(NextLine.data.substr(5), AbsSol(_, IGlass))) { + if (!readItem(NextLine.data.substr(5), AbsSolTemp(IGlass, _))) { ShowSevereError(state, format("HeatBalanceManager: SearchWindow5DataFile: Error in Read of AbsSol values. For Glass={}", IGlass)); ShowContinueError(state, format("Line (~{}) in error (first 100 characters)={}", FileLineCount, NextLine.data.substr(0, 100))); ErrorsFound = true; - } else if (any_lt(AbsSol(_, IGlass), 0.0) || any_gt(AbsSol(_, IGlass), 1.0)) { + } else if (any_lt(AbsSolTemp(IGlass, _), 0.0) || any_gt(AbsSolTemp(IGlass, _), 1.0)) { ShowSevereError( state, format("HeatBalanceManager: SearchWindow5DataFile: Error in Read of AbsSol values. (out of range [0,1]) For Glass={}", @@ -4275,48 +4277,48 @@ namespace HeatBalanceManager { DataLine(ILine) = NextLine.data; } - if (!readItem(DataLine(1).substr(5), Rfsol)) { + if (!readItem(DataLine(1).substr(5), RfsolTemp)) { ShowSevereError(state, "HeatBalanceManager: SearchWindow5DataFile: Error in Read of RfSol values."); ShowContinueError(state, format("Line (~{}) in error (first 100 characters)={}", FileLineCount + 1, DataLine(1).substr(0, 100))); ErrorsFound = true; - } else if (any_lt(Rfsol, 0.0) || any_gt(Rfsol, 1.0)) { + } else if (any_lt(RfsolTemp, 0.0) || any_gt(RfsolTemp, 1.0)) { ShowSevereError(state, "HeatBalanceManager: SearchWindow5DataFile: Error in Read of RfSol values. (out of range [0,1])"); ShowContinueError(state, format("Line (~{}) in error (first 100 characters)={}", FileLineCount + 1, DataLine(1).substr(0, 100))); ErrorsFound = true; } - if (!readItem(DataLine(2).substr(5), Rbsol)) { + if (!readItem(DataLine(2).substr(5), RbsolTemp)) { ShowSevereError(state, "HeatBalanceManager: SearchWindow5DataFile: Error in Read of RbSol values."); ShowContinueError(state, format("Line (~{}) in error (first 100 characters)={}", FileLineCount + 2, DataLine(2).substr(0, 100))); ErrorsFound = true; - } else if (any_lt(Rbsol, 0.0) || any_gt(Rbsol, 1.0)) { + } else if (any_lt(RbsolTemp, 0.0) || any_gt(RbsolTemp, 1.0)) { ShowSevereError(state, "HeatBalanceManager: SearchWindow5DataFile: Error in Read of RbSol values. (out of range [0,1])"); ShowContinueError(state, format("Line (~{}) in error (first 100 characters)={}", FileLineCount + 2, DataLine(2).substr(0, 100))); ErrorsFound = true; } - if (!readItem(DataLine(3).substr(5), Tvis)) { + if (!readItem(DataLine(3).substr(5), TvisTemp)) { ShowSevereError(state, "HeatBalanceManager: SearchWindow5DataFile: Error in Read of Tvis values."); ShowContinueError(state, format("Line (~{}) in error (first 100 characters)={}", FileLineCount + 3, DataLine(3).substr(0, 100))); ErrorsFound = true; - } else if (any_lt(Tvis, 0.0) || any_gt(Tvis, 1.0)) { + } else if (any_lt(TvisTemp, 0.0) || any_gt(TvisTemp, 1.0)) { ShowSevereError(state, "HeatBalanceManager: SearchWindow5DataFile: Error in Read of Tvis values. (out of range [0,1])"); ShowContinueError(state, format("Line (~{}) in error (first 100 characters)={}", FileLineCount + 3, DataLine(3).substr(0, 100))); ErrorsFound = true; } - if (!readItem(DataLine(4).substr(5), Rfvis)) { + if (!readItem(DataLine(4).substr(5), RfvisTemp)) { ShowSevereError(state, "HeatBalanceManager: SearchWindow5DataFile: Error in Read of Rfvis values."); ShowContinueError(state, format("Line (~{}) in error (first 100 characters)={}", FileLineCount + 4, DataLine(4).substr(0, 100))); ErrorsFound = true; - } else if (any_lt(Rfvis, 0.0) || any_gt(Rfvis, 1.0)) { + } else if (any_lt(RfvisTemp, 0.0) || any_gt(RfvisTemp, 1.0)) { ShowSevereError(state, "HeatBalanceManager: SearchWindow5DataFile: Error in Read of Rfvis values. (out of range [0,1])"); ShowContinueError(state, format("Line (~{}) in error (first 100 characters)={}", FileLineCount + 4, DataLine(4).substr(0, 100))); ErrorsFound = true; } - if (!readItem(DataLine(5).substr(5), Rbvis)) { + if (!readItem(DataLine(5).substr(5), RbvisTemp)) { ShowSevereError(state, "HeatBalanceManager: SearchWindow5DataFile: Error in Read of Rbvis values."); ShowContinueError(state, format("Line (~{}) in error (first 100 characters)={}", FileLineCount + 5, DataLine(5).substr(0, 100))); ErrorsFound = true; - } else if (any_lt(Rbvis, 0.0) || any_gt(Rbvis, 1.0)) { + } else if (any_lt(RbvisTemp, 0.0) || any_gt(RbvisTemp, 1.0)) { ShowSevereError(state, "HeatBalanceManager: SearchWindow5DataFile: Error in Read of Rbvis values. (out of range [0,1])"); ShowContinueError(state, format("Line (~{}) in error (first 100 characters)={}", FileLineCount + 5, DataLine(5).substr(0, 100))); ErrorsFound = true; @@ -4330,28 +4332,44 @@ namespace HeatBalanceManager { "of above errors", DesiredConstructionName)); + for (int iPhi = 0; iPhi < Window::numPhis; ++iPhi) { + Tsol[iPhi] = TsolTemp(iPhi + 1); + Tvis[iPhi] = TvisTemp(iPhi + 1); + Rfsol[iPhi] = RfsolTemp(iPhi + 1); + Rbsol[iPhi] = RbsolTemp(iPhi + 1); + Rfvis[iPhi] = RfvisTemp(iPhi + 1); + Rbvis[iPhi] = RbvisTemp(iPhi + 1); + } + + for (IGlass = 1; IGlass <= NGlass(IGlSys); ++IGlass) { + for (int iPhi = 0; iPhi < Window::numPhis; ++iPhi) { + AbsSol(IGlass)[iPhi] = AbsSolTemp(IGlass, iPhi + 1); + } + } + // Hemis - thisConstruct.TransDiff = Tsol(11); - thisConstruct.TransDiffVis = Tvis(11); - thisConstruct.ReflectSolDiffFront = Rfsol(11); - thisConstruct.ReflectSolDiffBack = Rbsol(11); - thisConstruct.ReflectVisDiffFront = Rfvis(11); - thisConstruct.ReflectVisDiffBack = Rbvis(11); - - Window::W5LsqFit(CosPhiIndepVar, Tsol, 6, 1, 10, thisConstruct.TransSolBeamCoef); - Window::W5LsqFit(CosPhiIndepVar, Tvis, 6, 1, 10, thisConstruct.TransVisBeamCoef); - Window::W5LsqFit(CosPhiIndepVar, Rfsol, 6, 1, 10, thisConstruct.ReflSolBeamFrontCoef); + thisConstruct.TransDiff = TsolTemp(11); + thisConstruct.TransDiffVis = TvisTemp(11); + thisConstruct.ReflectSolDiffFront = RfsolTemp(11); + thisConstruct.ReflectSolDiffBack = RbsolTemp(11); + thisConstruct.ReflectVisDiffFront = RfvisTemp(11); + thisConstruct.ReflectVisDiffBack = RbvisTemp(11); + + // Using pre-calculated/hard-coded cosPhis in this module is okay. Shrug. + Window::W5LsqFit(Window::cosPhis, Tsol, thisConstruct.TransSolBeamCoef); + Window::W5LsqFit(Window::cosPhis, Tvis, thisConstruct.TransVisBeamCoef); + Window::W5LsqFit(Window::cosPhis, Rfsol, thisConstruct.ReflSolBeamFrontCoef); for (IGlass = 1; IGlass <= NGlass(IGlSys); ++IGlass) { - Window::W5LsqFit(CosPhiIndepVar, AbsSol(_, IGlass), 6, 1, 10, thisConstruct.AbsBeamCoef(IGlass)); + Window::W5LsqFit(Window::cosPhis, AbsSol(IGlass), thisConstruct.AbsBeamCoef(IGlass)); } // For comparing fitted vs. input distribution in incidence angle - for (IPhi = 1; IPhi <= 10; ++IPhi) { - tsolFit(IPhi) = POLYF(CosPhi(IPhi), thisConstruct.TransSolBeamCoef); - tvisFit(IPhi) = POLYF(CosPhi(IPhi), thisConstruct.TransVisBeamCoef); - rfsolFit(IPhi) = POLYF(CosPhi(IPhi), thisConstruct.ReflSolBeamFrontCoef); + for (int iPhi = 0; iPhi < Window::numPhis; ++iPhi) { + tsolFit[iPhi] = Window::POLYF(Window::cosPhis[iPhi], thisConstruct.TransSolBeamCoef); + tvisFit[iPhi] = Window::POLYF(Window::cosPhis[iPhi], thisConstruct.TransVisBeamCoef); + rfsolFit[iPhi] = Window::POLYF(Window::cosPhis[iPhi], thisConstruct.ReflSolBeamFrontCoef); for (IGlass = 1; IGlass <= NGlass(IGlSys); ++IGlass) { - solabsFit(IGlass, IPhi) = POLYF(CosPhi(IPhi), thisConstruct.AbsBeamCoef(IGlass)); + solabsFit(IGlass)[iPhi] = Window::POLYF(Window::cosPhis[iPhi], thisConstruct.AbsBeamCoef(IGlass)); } } // end @@ -4764,9 +4782,10 @@ namespace HeatBalanceManager { bool &errorsFound // If errors found in input ) { + static constexpr std::string_view routineName = "CreateAirBoundaryConstructions"; + auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; cCurrentModuleObject = "Construction:AirBoundary"; - static constexpr std::string_view RoutineName = "CreateAirBoundaryConstructions"; int numAirBoundaryConstructs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); if (numAirBoundaryConstructs > 0) { auto const instances = state.dataInputProcessing->inputProcessor->epJSON.find(cCurrentModuleObject); @@ -4782,6 +4801,9 @@ namespace HeatBalanceManager { for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { auto const &fields = instance.value(); std::string const &thisObjectName = instance.key(); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, thisObjectName}; + state.dataInputProcessing->inputProcessor->markObjectAsUsed(cCurrentModuleObject, thisObjectName); if (GlobalNames::VerifyUniqueInterObjectName( @@ -4798,33 +4820,30 @@ namespace HeatBalanceManager { // Air Exchange Method std::string airMethod = "None"; - if (fields.find("air_exchange_method") != fields.end()) { - airMethod = fields.at("air_exchange_method").get(); + if (auto found = fields.find("air_exchange_method"); + found != fields.end()) { // find("x") followed by at("x") is the same lookup twice + airMethod = found.value().get(); } if (Util::SameString(airMethod, "SimpleMixing")) { thisConstruct.TypeIsAirBoundaryMixing = true; - if (fields.find("simple_mixing_air_changes_per_hour") != fields.end()) { - thisConstruct.AirBoundaryACH = fields.at("simple_mixing_air_changes_per_hour").get(); + if (auto found = fields.find("simple_mixing_air_changes_per_hour"); found != fields.end()) { + thisConstruct.AirBoundaryACH = found.value().get(); } else { if (!state.dataInputProcessing->inputProcessor->getDefaultValue( state, cCurrentModuleObject, "simple_mixing_air_changes_per_hour", thisConstruct.AirBoundaryACH)) { errorsFound = true; } } - if (fields.find("simple_mixing_schedule_name") != fields.end()) { - const std::string &schedName = fields.at("simple_mixing_schedule_name").get(); - thisConstruct.AirBoundaryMixingSched = ScheduleManager::GetScheduleIndex(state, Util::makeUPPER(schedName)); - if (thisConstruct.AirBoundaryMixingSched == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid (not found) Simple Mixing Schedule Name=\"{}\".", - RoutineName, - cCurrentModuleObject, - thisConstruct.Name, - schedName)); + + if (auto found = fields.find("simple_mixing_schedule_name"); found != fields.end()) { + std::string schedName = found.value().get(); // .get() creates and returns a new string, no & + if ((thisConstruct.airBoundaryMixingSched = Sched::GetSchedule(state, Util::makeUPPER(schedName))) == nullptr) { + ShowSevereItemNotFound(state, eoh, "Simple Mixing Schedule Name", schedName); errorsFound = true; } } else { - thisConstruct.AirBoundaryMixingSched = ScheduleManager::ScheduleAlwaysOn; + thisConstruct.airBoundaryMixingSched = + Sched::GetScheduleAlwaysOn(state); // Not an availability manager, but defaults to constant-1.0 } } } @@ -4843,7 +4862,8 @@ namespace HeatBalanceManager { // window layers // SUBROUTINE PARAMETER DEFINITIONS: - constexpr const char *RoutineName("GetScheduledSurfaceGains: "); + static constexpr std::string_view RoutineName("GetScheduledSurfaceGains: "); + static constexpr std::string_view routineName = "GetScheduledSurfaceGains"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumArgs; @@ -4853,7 +4873,6 @@ namespace HeatBalanceManager { int IOStat; int SurfNum; int ConstrNum; - int ScheduleNum; //----------------------------------------------------------------------- // SurfaceProperty:SolarIncidentInside @@ -4890,22 +4909,14 @@ namespace HeatBalanceManager { state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + state.dataSurface->SurfIncSolSSG(Loop).Name = state.dataIPShortCut->cAlphaArgs(1); // Assign surface number SurfNum = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(2), state.dataSurface->Surface); if (SurfNum == 0) { - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(2))); - ShowContinueError( - state, - format("{} entered value = \"{}\" no corresponding surface (ref BuildingSurface:Detailed) has been found in the input file.", - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2)); ErrorsFound = true; } else { state.dataSurface->SurfIncSolSSG(Loop).SurfPtr = SurfNum; @@ -4927,38 +4938,15 @@ namespace HeatBalanceManager { // Assign construction number ConstrNum = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(3), state.dataConstruction->Construct); if (ConstrNum == 0) { - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(3))); - ShowContinueError( - state, - format("{} entered value = \"{}\" no corresponding construction (ref Construction) has been found in the input file.", - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3)); ErrorsFound = true; } else { state.dataSurface->SurfIncSolSSG(Loop).ConstrPtr = ConstrNum; } - // Assign schedule number - ScheduleNum = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(4)); - if (ScheduleNum == 0) { - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(4))); - ShowContinueError(state, - format("{} entered value = \"{}\" no corresponding schedule has been found in the input file.", - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4))); + if ((state.dataSurface->SurfIncSolSSG(Loop).sched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(4))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4)); ErrorsFound = true; - } else { - state.dataSurface->SurfIncSolSSG(Loop).SchedPtr = ScheduleNum; } } } @@ -4988,22 +4976,14 @@ namespace HeatBalanceManager { state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + state.dataSurface->FenLayAbsSSG(Loop).Name = state.dataIPShortCut->cAlphaArgs(1); // Assign surface number SurfNum = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(2), state.dataSurface->Surface); if (SurfNum == 0) { - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(2))); - ShowContinueError( - state, - format("{} entered value = \"{}\" no corresponding surface (ref BuildingSurface:Detailed) has been found in the input file.", - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2)); ErrorsFound = true; } else { state.dataSurface->FenLayAbsSSG(Loop).SurfPtr = SurfNum; @@ -5011,19 +4991,9 @@ namespace HeatBalanceManager { // Assign construction number ConstrNum = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(3), state.dataConstruction->Construct); - auto const &thisConstruct = state.dataConstruction->Construct(ConstrNum); + auto const &thisConstruct = state.dataConstruction->Construct(ConstrNum); // Why is this before the error check? if (ConstrNum == 0) { - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(3))); - ShowContinueError( - state, - format("{} entered value = \"{}\" no corresponding construction (ref Construction) has been found in the input file.", - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3)); ErrorsFound = true; } else { state.dataSurface->FenLayAbsSSG(Loop).ConstrPtr = ConstrNum; @@ -5051,28 +5021,20 @@ namespace HeatBalanceManager { ErrorsFound = true; } - if (!allocated(state.dataSurface->FenLayAbsSSG(Loop).SchedPtrs)) { - state.dataSurface->FenLayAbsSSG(Loop).SchedPtrs.allocate(NumOfScheduledLayers); + if (!allocated(state.dataSurface->FenLayAbsSSG(Loop).scheds)) { + state.dataSurface->FenLayAbsSSG(Loop).scheds.allocate(NumOfScheduledLayers); } state.dataSurface->FenLayAbsSSG(Loop).NumOfSched = NumOfScheduledLayers; for (int i = 1; i <= NumOfScheduledLayers; ++i) { - ScheduleNum = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(i + 3)); - if (ScheduleNum == 0) { - ShowSevereError(state, - format("{}{}=\"{}, object. Illegal value for {} has been found.", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(NumOfScheduledLayers + 3))); - ShowContinueError(state, - format("{} entered value = \"{}\" no corresponding schedule has been found in the input file.", - state.dataIPShortCut->cAlphaFieldNames(NumOfScheduledLayers + 3), - state.dataIPShortCut->cAlphaArgs(NumOfScheduledLayers + 3))); + if ((state.dataSurface->FenLayAbsSSG(Loop).scheds(i) = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(i + 3))) == + nullptr) { + ShowSevereItemNotFound(state, + eoh, + state.dataIPShortCut->cAlphaFieldNames(NumOfScheduledLayers + 3), + state.dataIPShortCut->cAlphaArgs(NumOfScheduledLayers + 3)); ErrorsFound = true; - } else { - state.dataSurface->FenLayAbsSSG(Loop).SchedPtrs(i) = ScheduleNum; } } } @@ -5301,7 +5263,7 @@ namespace HeatBalanceManager { windowThermalModel.SDScalar = s_ipsc->rNumericArgs(1); if ((s_ipsc->rNumericArgs(1) < 0.0) || (s_ipsc->rNumericArgs(1) > 1.0)) { - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} should be >= 0.0 and <= 1.0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(1), s_ipsc->rNumericArgs(1))); @@ -5319,21 +5281,21 @@ namespace HeatBalanceManager { windowThermalModel.VacuumPressureLimit = s_ipsc->rNumericArgs(2); if (s_ipsc->rNumericArgs(2) <= 0.0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} must be > 0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(2), s_ipsc->rNumericArgs(2))); } windowThermalModel.InitialTemperature = s_ipsc->rNumericArgs(3); if (s_ipsc->rNumericArgs(3) <= 0.0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} must be > 0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(3), s_ipsc->rNumericArgs(3))); } windowThermalModel.InitialPressure = s_ipsc->rNumericArgs(4); if (s_ipsc->rNumericArgs(4) <= 0.0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} must be > 0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(4), s_ipsc->rNumericArgs(4))); } } @@ -5413,11 +5375,11 @@ namespace HeatBalanceManager { if (NumCols != 2 && NumCols != 1) { ErrorsFound = true; - ShowSevereCustomMessage(state, - eoh, - format("{} entered value=\"{}\" invalid matrix dimensions. Basis matrix dimension can only be 2 x 1.", - locAlphaFieldNames(5), - locAlphaArgs(5))); + ShowSevereCustom(state, + eoh, + format("{} entered value=\"{}\" invalid matrix dimensions. Basis matrix dimension can only be 2 x 1.", + locAlphaFieldNames(5), + locAlphaArgs(5))); } thisConstruct.BSDFInput.BasisMat.allocate(NumCols, NumRows); MatrixDataManager::Get2DMatrix(state, thisConstruct.BSDFInput.BasisMatIndex, thisConstruct.BSDFInput.BasisMat); @@ -5437,7 +5399,7 @@ namespace HeatBalanceManager { if (mod((NumAlphas - 9), 3) != 0) { // throw warning if incomplete field set ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} is missing some of the layers or/and gaps.", locAlphaArgs(1))); + ShowSevereCustom(state, eoh, format("{} is missing some of the layers or/and gaps.", locAlphaArgs(1))); } if (thisConstruct.BSDFInput.BasisSymmetryType == DataBSDFWindow::BasisSymmetry::None) { @@ -5455,7 +5417,7 @@ namespace HeatBalanceManager { if (NumRows != NBasis) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Solar front transmittance matrix \"{}\" is not the same size as it is defined by basis definition. Basis " @@ -5466,7 +5428,7 @@ namespace HeatBalanceManager { if (NumRows != NumCols) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Solar front transmittance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(6))); @@ -5480,7 +5442,7 @@ namespace HeatBalanceManager { thisConstruct.BSDFInput.SolFrtTrans.allocate(NumCols, NumRows); if (thisConstruct.BSDFInput.SolFrtTransIndex == 0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Solar front transmittance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(6))); @@ -5498,7 +5460,7 @@ namespace HeatBalanceManager { if (NumRows != NBasis) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Solar back reflectance matrix \"{}\" is not the same size as it is defined by basis definition. Basis size " @@ -5509,14 +5471,14 @@ namespace HeatBalanceManager { if (NumRows != NumCols) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Solar back reflectance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(7))); } thisConstruct.BSDFInput.SolBkRefl.allocate(NumCols, NumRows); if (thisConstruct.BSDFInput.SolBkReflIndex == 0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Solar back reflectance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(7))); } else { MatrixDataManager::Get2DMatrix(state, thisConstruct.BSDFInput.SolBkReflIndex, thisConstruct.BSDFInput.SolBkRefl); @@ -5532,7 +5494,7 @@ namespace HeatBalanceManager { if (NumRows != NBasis) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Visible front transmittance matrix \"{}\" is not the same size as it is defined by basis definition. Basis " @@ -5543,7 +5505,7 @@ namespace HeatBalanceManager { if (NumRows != NumCols) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Visible front transmittance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(8))); @@ -5552,7 +5514,7 @@ namespace HeatBalanceManager { thisConstruct.BSDFInput.VisFrtTrans.allocate(NumCols, NumRows); if (thisConstruct.BSDFInput.VisFrtTransIndex == 0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Visible front transmittance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(8))); @@ -5570,25 +5532,24 @@ namespace HeatBalanceManager { if (NumRows != NBasis) { ErrorsFound = true; - ShowSevereCustomMessage( - state, - eoh, - format("Visible back reflectance matrix \"{}\" is not the same size as it is defined by basis definition. Basis " - "size is defined by Matrix:TwoDimension = \"{}\".", - locAlphaArgs(9), - locAlphaArgs(5))); + ShowSevereCustom(state, + eoh, + format("Visible back reflectance matrix \"{}\" is not the same size as it is defined by basis definition. Basis " + "size is defined by Matrix:TwoDimension = \"{}\".", + locAlphaArgs(9), + locAlphaArgs(5))); } if (NumRows != NumCols) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Visible back reflectance \"{}\" must have the same number of rows and columns.", locAlphaArgs(9))); } thisConstruct.BSDFInput.VisBkRefl.allocate(NumCols, NumRows); if (thisConstruct.BSDFInput.VisBkReflIndex == 0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Visble back reflectance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(9))); } else { MatrixDataManager::Get2DMatrix(state, thisConstruct.BSDFInput.VisBkReflIndex, thisConstruct.BSDFInput.VisBkRefl); @@ -5616,37 +5577,35 @@ namespace HeatBalanceManager { if (NumRows != 1) { ErrorsFound = true; - ShowSevereCustomMessage(state, - eoh, - format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have only one row.", - locAlphaArgs(AlphaIndex), - currentOpticalLayer)); + ShowSevereCustom(state, + eoh, + format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have only one row.", + locAlphaArgs(AlphaIndex), + currentOpticalLayer)); } if (NumCols != NBasis) { ErrorsFound = true; - ShowSevereCustomMessage( - state, - eoh, - format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have same number of columns " - "as it is defined by basis matrix." - "Matrix has {} number of columns, while basis definition specifies {} number of columns.", - locAlphaArgs(AlphaIndex), - currentOpticalLayer, - NumCols, - NBasis)); + ShowSevereCustom(state, + eoh, + format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have same number of columns " + "as it is defined by basis matrix." + "Matrix has {} number of columns, while basis definition specifies {} number of columns.", + locAlphaArgs(AlphaIndex), + currentOpticalLayer, + NumCols, + NBasis)); } thisConstruct.BSDFInput.Layer(currentOpticalLayer).AbsNcols = NumCols; thisConstruct.BSDFInput.Layer(currentOpticalLayer).FrtAbs.allocate(NumCols, NumRows); if (thisConstruct.BSDFInput.Layer(currentOpticalLayer).FrtAbsIndex == 0) { ErrorsFound = true; - ShowSevereCustomMessage( - state, - eoh, - format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} is missing from the input file.", - locAlphaArgs(AlphaIndex), - currentOpticalLayer)); + ShowSevereCustom(state, + eoh, + format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} is missing from the input file.", + locAlphaArgs(AlphaIndex), + currentOpticalLayer)); } else { MatrixDataManager::Get2DMatrix(state, thisConstruct.BSDFInput.Layer(currentOpticalLayer).FrtAbsIndex, @@ -5664,36 +5623,34 @@ namespace HeatBalanceManager { if (NumRows != 1) { ErrorsFound = true; - ShowSevereCustomMessage(state, - eoh, - format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have only one row.", - locAlphaArgs(AlphaIndex), - currentOpticalLayer)); + ShowSevereCustom(state, + eoh, + format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have only one row.", + locAlphaArgs(AlphaIndex), + currentOpticalLayer)); } if (NumCols != NBasis) { ErrorsFound = true; - ShowSevereCustomMessage( - state, - eoh, - format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have same number of columns as " - "it is defined by basis matrix." - "Matrix has {} number of columns, while basis definition specifies {} number of columns.", - locAlphaArgs(AlphaIndex), - currentOpticalLayer, - NumCols, - NBasis)); + ShowSevereCustom(state, + eoh, + format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have same number of columns as " + "it is defined by basis matrix." + "Matrix has {} number of columns, while basis definition specifies {} number of columns.", + locAlphaArgs(AlphaIndex), + currentOpticalLayer, + NumCols, + NBasis)); } thisConstruct.BSDFInput.Layer(currentOpticalLayer).BkAbs.allocate(NumCols, NumRows); if (thisConstruct.BSDFInput.Layer(currentOpticalLayer).BkAbsIndex == 0) { ErrorsFound = true; - ShowSevereCustomMessage( - state, - eoh, - format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} is missing from the input file.", - locAlphaArgs(AlphaIndex), - currentOpticalLayer)); + ShowSevereCustom(state, + eoh, + format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} is missing from the input file.", + locAlphaArgs(AlphaIndex), + currentOpticalLayer)); } else { MatrixDataManager::Get2DMatrix(state, thisConstruct.BSDFInput.Layer(currentOpticalLayer).BkAbsIndex, @@ -5716,7 +5673,7 @@ namespace HeatBalanceManager { if (NumRows != NBasis) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Solar front transmittance matrix \"{}\" is not the same size as it is defined by basis definition. Basis " @@ -5727,7 +5684,7 @@ namespace HeatBalanceManager { if (NumRows != NumCols) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Solar front transmittance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(6))); @@ -5736,7 +5693,7 @@ namespace HeatBalanceManager { thisConstruct.BSDFInput.SolFrtTrans.allocate(NBasis, NBasis); if (thisConstruct.BSDFInput.SolFrtTransIndex == 0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Solar front transmittance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(6))); @@ -5759,7 +5716,7 @@ namespace HeatBalanceManager { if (NumRows != NBasis) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Solar back reflectance matrix \"{}\" is not the same size as it is defined by basis definition. Basis size " @@ -5770,14 +5727,14 @@ namespace HeatBalanceManager { if (NumRows != NumCols) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Solar back reflectance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(7))); } thisConstruct.BSDFInput.SolBkRefl.allocate(NBasis, NBasis); if (thisConstruct.BSDFInput.SolBkReflIndex == 0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Solar back reflectance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(7))); } else { MatrixDataManager::Get2DMatrix(state, thisConstruct.BSDFInput.SolBkReflIndex, state.dataBSDFWindow->BSDFTempMtrx); @@ -5797,7 +5754,7 @@ namespace HeatBalanceManager { if (NumRows != NBasis) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Visible front transmittance matrix \"{}\" is not the same size as it is defined by basis definition. Basis " @@ -5808,7 +5765,7 @@ namespace HeatBalanceManager { if (NumRows != NumCols) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Visible front transmittance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(8))); @@ -5817,7 +5774,7 @@ namespace HeatBalanceManager { thisConstruct.BSDFInput.VisFrtTrans.allocate(NBasis, NBasis); if (thisConstruct.BSDFInput.VisFrtTransIndex == 0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Visible front transmittance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(8))); @@ -5839,25 +5796,24 @@ namespace HeatBalanceManager { if (NumRows != NBasis) { ErrorsFound = true; - ShowSevereCustomMessage( - state, - eoh, - format("Visible back reflectance matrix \"{}\" is not the same size as it is defined by basis definition. Basis " - "size is defined by Matrix:TwoDimension = \"{}\".", - locAlphaArgs(9), - locAlphaArgs(5))); + ShowSevereCustom(state, + eoh, + format("Visible back reflectance matrix \"{}\" is not the same size as it is defined by basis definition. Basis " + "size is defined by Matrix:TwoDimension = \"{}\".", + locAlphaArgs(9), + locAlphaArgs(5))); } if (NumRows != NumCols) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Visible back reflectance matrix \"{}\" must have the same number of rows and columns.", locAlphaArgs(9))); } thisConstruct.BSDFInput.VisBkRefl.allocate(NBasis, NBasis); if (thisConstruct.BSDFInput.VisBkReflIndex == 0) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Visible back reflectance Matrix:TwoDimension = \"{}\" is missing from the input file.", locAlphaArgs(9))); } else { MatrixDataManager::Get2DMatrix(state, thisConstruct.BSDFInput.VisBkReflIndex, state.dataBSDFWindow->BSDFTempMtrx); @@ -5894,25 +5850,24 @@ namespace HeatBalanceManager { if (NumRows != 1) { ErrorsFound = true; - ShowSevereCustomMessage(state, - eoh, - format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have only one row.", - locAlphaArgs(AlphaIndex), - currentOpticalLayer)); + ShowSevereCustom(state, + eoh, + format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have only one row.", + locAlphaArgs(AlphaIndex), + currentOpticalLayer)); } if (NumCols != NBasis) { ErrorsFound = true; - ShowSevereCustomMessage( - state, - eoh, - format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have same number of columns " - "as it is defined by basis matrix." - "Matrix has {} number of columns, while basis definition specifies {} number of columns.", - locAlphaArgs(AlphaIndex), - currentOpticalLayer, - NumCols, - NBasis)); + ShowSevereCustom(state, + eoh, + format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have same number of columns " + "as it is defined by basis matrix." + "Matrix has {} number of columns, while basis definition specifies {} number of columns.", + locAlphaArgs(AlphaIndex), + currentOpticalLayer, + NumCols, + NBasis)); } thisConstruct.BSDFInput.Layer(currentOpticalLayer).AbsNcols = NumCols; @@ -5920,12 +5875,11 @@ namespace HeatBalanceManager { if (thisConstruct.BSDFInput.Layer(currentOpticalLayer).FrtAbsIndex == 0) { ErrorsFound = true; - ShowSevereCustomMessage( - state, - eoh, - format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} is missing from the input file.", - locAlphaArgs(AlphaIndex), - currentOpticalLayer)); + ShowSevereCustom(state, + eoh, + format("Front absorbtance Matrix:TwoDimension = \"{}\" for layer {} is missing from the input file.", + locAlphaArgs(AlphaIndex), + currentOpticalLayer)); } else { MatrixDataManager::Get2DMatrix(state, thisConstruct.BSDFInput.Layer(currentOpticalLayer).FrtAbsIndex, @@ -5943,37 +5897,35 @@ namespace HeatBalanceManager { if (NumRows != 1) { ErrorsFound = true; - ShowSevereCustomMessage(state, - eoh, - format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have only one row.", - locAlphaArgs(AlphaIndex), - currentOpticalLayer)); + ShowSevereCustom(state, + eoh, + format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have only one row.", + locAlphaArgs(AlphaIndex), + currentOpticalLayer)); } if (NumCols != NBasis) { ErrorsFound = true; - ShowSevereCustomMessage( - state, - eoh, - format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have same number of columns as " - "it is defined by basis matrix." - "Matrix has {} number of columns, while basis definition specifies {} number of columns.", - locAlphaArgs(AlphaIndex), - currentOpticalLayer, - NumCols, - NBasis)); + ShowSevereCustom(state, + eoh, + format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} must have same number of columns as " + "it is defined by basis matrix." + "Matrix has {} number of columns, while basis definition specifies {} number of columns.", + locAlphaArgs(AlphaIndex), + currentOpticalLayer, + NumCols, + NBasis)); } thisConstruct.BSDFInput.Layer(currentOpticalLayer).BkAbs.allocate(NumCols, NumRows); if (thisConstruct.BSDFInput.Layer(currentOpticalLayer).BkAbsIndex == 0) { ErrorsFound = true; - ShowSevereCustomMessage( - state, - eoh, - format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} is missing from the input file.", - locAlphaArgs(AlphaIndex), - currentOpticalLayer)); + ShowSevereCustom(state, + eoh, + format("Back absorbtance Matrix:TwoDimension = \"{}\" for layer {} is missing from the input file.", + locAlphaArgs(AlphaIndex), + currentOpticalLayer)); } else { MatrixDataManager::Get2DMatrix(state, thisConstruct.BSDFInput.Layer(currentOpticalLayer).BkAbsIndex, diff --git a/src/EnergyPlus/HeatBalanceManager.hh b/src/EnergyPlus/HeatBalanceManager.hh index 7b415723c7b..9d22345168e 100644 --- a/src/EnergyPlus/HeatBalanceManager.hh +++ b/src/EnergyPlus/HeatBalanceManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -227,6 +227,10 @@ struct HeatBalanceMgrData : BaseGlobalStruct Array1D WarmupConvergenceValues; SurfaceOctreeCube surfaceOctree; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/HeatBalanceSurfaceManager.cc b/src/EnergyPlus/HeatBalanceSurfaceManager.cc index d121537afdd..21e46287008 100644 --- a/src/EnergyPlus/HeatBalanceSurfaceManager.cc +++ b/src/EnergyPlus/HeatBalanceSurfaceManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -88,7 +88,6 @@ #include #include #include -#include #include #include #include @@ -133,7 +132,7 @@ namespace EnergyPlus::HeatBalanceSurfaceManager { // PURPOSE OF THIS MODULE: // To encapsulate the data and algorithms required to -// manage the simluation of the surface heat balance for the building. +// manage the simulation of the surface heat balance for the building. // REFERENCES: // The heat balance method is outlined in the "TARP Reference Manual", NIST, NBSIR 83-2655, Feb 1983. @@ -224,13 +223,11 @@ void UpdateVariableAbsorptances(EnergyPlusData &state) auto const *thisMaterial = s_mat->materials(thisConstruct.LayerPoint(1)); assert(thisMaterial != nullptr); if (thisMaterial->absorpVarCtrlSignal == Material::VariableAbsCtrlSignal::Scheduled) { - if (thisMaterial->absorpThermalVarSchedIdx > 0) { - state.dataHeatBalSurf->SurfAbsThermalExt(surfNum) = - max(min(ScheduleManager::GetCurrentScheduleValue(state, thisMaterial->absorpThermalVarSchedIdx), 0.9999), 0.0001); + if (thisMaterial->absorpThermalVarSched != nullptr) { + state.dataHeatBalSurf->SurfAbsThermalExt(surfNum) = max(min(thisMaterial->absorpThermalVarSched->getCurrentVal(), 0.9999), 0.0001); } - if (thisMaterial->absorpSolarVarSchedIdx > 0) { - state.dataHeatBalSurf->SurfAbsSolarExt(surfNum) = - max(min(ScheduleManager::GetCurrentScheduleValue(state, thisMaterial->absorpThermalVarSchedIdx), 0.9999), 0.0001); + if (thisMaterial->absorpSolarVarSched != nullptr) { + state.dataHeatBalSurf->SurfAbsSolarExt(surfNum) = max(min(thisMaterial->absorpThermalVarSched->getCurrentVal(), 0.9999), 0.0001); } } else { Real64 triggerValue; @@ -754,8 +751,10 @@ void GatherForPredefinedReport(EnergyPlusData &state) auto const &construct = state.dataConstruction->Construct(surface.Construction); auto const &thisZone = state.dataHeatBal->Zone(surface.Zone); mult = thisZone.Multiplier * thisZone.ListMultiplier; + auto const &thisSpace = state.dataHeatBal->space(surface.spaceNum); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchOpCons, surfName, construct.Name); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchOpZone, surfName, thisZone.Name); + OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchOpSpace, surfName, thisSpace.Name); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchOpRefl, surfName, 1 - construct.OutsideAbsorpSolar); OutputReportPredefined::PreDefTableEntry( state, state.dataOutRptPredefined->pdchOpUfactNoFilm, surfName, state.dataHeatBal->NominalU(surface.Construction), 3); @@ -785,7 +784,10 @@ void GatherForPredefinedReport(EnergyPlusData &state) auto &construct = state.dataConstruction->Construct(surface.Construction); auto const &thisZone = state.dataHeatBal->Zone(surface.Zone); mult = thisZone.Multiplier * thisZone.ListMultiplier * surface.Multiplier; + auto const &thisSpace = state.dataHeatBal->space(surface.spaceNum); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchFenCons, surfName, construct.Name); + OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchFenZone, surfName, thisZone.Name); + OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchFenSpace, surfName, thisSpace.Name); // if the construction report is requested the SummerSHGC is already calculated if (construct.SummerSHGC != 0) { SHGCSummer = construct.SummerSHGC; @@ -996,7 +998,7 @@ void GatherForPredefinedReport(EnergyPlusData &state) surfName, WindowShadingControlTypeNames[int(state.dataSurface->WindowShadingControl(curWSC).shadingControlType)]); - // output list of all possible shading contructions for shaded windows including those with storms + // output list of all possible shading constructions for shaded windows including those with storms std::string names; for (int construction : surface.shadedConstructionList) { if (!names.empty()) names.append("; "); @@ -1020,8 +1022,11 @@ void GatherForPredefinedReport(EnergyPlusData &state) case DataSurfaces::SurfaceClass::Door: { auto const &thisZone = state.dataHeatBal->Zone(surface.Zone); mult = thisZone.Multiplier * thisZone.ListMultiplier; + auto const &thisSpace = state.dataHeatBal->space(surface.spaceNum); OutputReportPredefined::PreDefTableEntry( state, state.dataOutRptPredefined->pdchDrCons, surfName, state.dataConstruction->Construct(surface.Construction).Name); + OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchDrZone, surfName, thisZone.Name); + OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchDrSpace, surfName, thisSpace.Name); OutputReportPredefined::PreDefTableEntry( state, state.dataOutRptPredefined->pdchDrUfactNoFilm, surfName, state.dataHeatBal->NominalU(surface.Construction), 3); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchDrGrArea, surfName, surface.GrossArea * mult); @@ -1039,8 +1044,10 @@ void GatherForPredefinedReport(EnergyPlusData &state) auto const &construct = state.dataConstruction->Construct(surface.Construction); auto const &thisZone = state.dataHeatBal->Zone(surface.Zone); mult = thisZone.Multiplier * thisZone.ListMultiplier; + auto const &thisSpace = state.dataHeatBal->space(surface.spaceNum); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchIntOpCons, surfName, construct.Name); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchIntOpZone, surfName, thisZone.Name); + OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchIntOpSpace, surfName, thisSpace.Name); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchIntOpAdjSurf, surfName, surface.ExtBoundCondName); OutputReportPredefined::PreDefTableEntry( state, state.dataOutRptPredefined->pdchIntOpRefl, surfName, 1 - construct.OutsideAbsorpSolar); @@ -1071,9 +1078,12 @@ void GatherForPredefinedReport(EnergyPlusData &state) auto const &construct = state.dataConstruction->Construct(surface.Construction); auto const &thisZone = state.dataHeatBal->Zone(surface.Zone); mult = thisZone.Multiplier * thisZone.ListMultiplier * surface.Multiplier; + auto const &thisSpace = state.dataHeatBal->space(surface.spaceNum); if (!has_prefix(surface.Name, "iz-")) { // don't count created interzone surfaces that are mirrors of other surfaces OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchIntFenCons, surfName, construct.Name); + OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchIntFenZone, surfName, thisZone.Name); + OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchIntFenSpace, surfName, thisSpace.Name); // include the frame area if present windowArea = surface.GrossArea; if (surface.FrameDivider != 0) { @@ -1115,7 +1125,10 @@ void GatherForPredefinedReport(EnergyPlusData &state) auto const &construct = state.dataConstruction->Construct(surface.Construction); auto const &thisZone = state.dataHeatBal->Zone(surface.Zone); mult = thisZone.Multiplier * thisZone.ListMultiplier; + auto const &thisSpace = state.dataHeatBal->space(surface.spaceNum); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchIntDrCons, surfName, construct.Name); + OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchIntDrZone, surfName, thisZone.Name); + OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchIntDrSpace, surfName, thisSpace.Name); OutputReportPredefined::PreDefTableEntry( state, state.dataOutRptPredefined->pdchIntDrUfactNoFilm, surfName, state.dataHeatBal->NominalU(surface.Construction), 3); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchIntDrGrArea, surfName, surface.GrossArea * mult); @@ -1479,14 +1492,7 @@ void AllocateSurfaceHeatBalArrays(EnergyPlusData &state) state.dataSurface->SurfSkySolarInc.dimension(state.dataSurface->TotSurfaces, 0); state.dataSurface->SurfGndSolarInc.dimension(state.dataSurface->TotSurfaces, 0); - // allocate movable insulation arrays - if (state.dataSurface->AnyMovableInsulation) { - state.dataHeatBalSurf->SurfMovInsulExtPresent.dimension(state.dataSurface->TotSurfaces, false); - state.dataHeatBalSurf->SurfMovInsulIntPresent.dimension(state.dataSurface->TotSurfaces, false); - state.dataHeatBalSurf->SurfMovInsulIntPresentPrevTS.dimension(state.dataSurface->TotSurfaces, false); - state.dataHeatBalSurf->SurfMovInsulHExt.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataHeatBalSurf->SurfMovInsulHInt.dimension(state.dataSurface->TotSurfaces, 0.0); - } + state.dataHeatBalSurf->SurfAbsSolarExt.dimension(state.dataSurface->TotSurfaces, 0.0); state.dataHeatBalSurf->SurfAbsThermalExt.dimension(state.dataSurface->TotSurfaces, 0.0); state.dataHeatBalSurf->SurfRoughnessExt.dimension(state.dataSurface->TotSurfaces, Material::SurfaceRoughness::Invalid); @@ -2127,7 +2133,7 @@ void InitThermalAndFluxHistories(EnergyPlusData &state) for (auto &thisEnclosure : state.dataViewFactor->EnclRadInfo) { thisEnclosure.MRT = DataHeatBalance::ZoneInitialTemp; } - // Reset spaceHeatBalance even if doSpaceHeatBalance is false, beause spaceHB is used to gether zoneHB in some cases + // Reset spaceHeatBalance even if doSpaceHeatBalance is false, because spaceHB is used to gether zoneHB in some cases for (auto &thisSpaceHB : state.dataZoneTempPredictorCorrector->spaceHeatBalance) { new (&thisSpaceHB) ZoneTempPredictorCorrector::SpaceHeatBalanceData(); // Initialize the Zone Humidity Ratio here so that it is available for EMPD implementations @@ -2336,21 +2342,24 @@ void EvalOutsideMovableInsulation(EnergyPlusData &state) { // This subroutine determines whether or not outside movable insulation on opaque surfaces is present at the current time. auto &s_mat = state.dataMaterial; - for (int SurfNum : state.dataHeatBalSurf->SurfMovInsulIndexList) { - Real64 MovInsulSchedVal = ScheduleManager::GetCurrentScheduleValue(state, state.dataSurface->SurfSchedMovInsulExt(SurfNum)); + auto &s_surf = state.dataSurface; + + for (int SurfNum : s_surf->extMovInsulSurfNums) { + auto &movInsul = s_surf->extMovInsuls(SurfNum); + Real64 MovInsulSchedVal = movInsul.sched->getCurrentVal(); if (MovInsulSchedVal <= 0) { // Movable insulation not present at current time - state.dataHeatBalSurf->SurfMovInsulExtPresent(SurfNum) = false; - int ConstrNum = state.dataSurface->SurfActiveConstruction(SurfNum); + movInsul.present = false; + int ConstrNum = s_surf->SurfActiveConstruction(SurfNum); auto const *thisMaterial = s_mat->materials(state.dataConstruction->Construct(ConstrNum).LayerPoint(1)); state.dataHeatBalSurf->SurfAbsSolarExt(SurfNum) = thisMaterial->AbsorpSolar; state.dataHeatBalSurf->SurfAbsThermalExt(SurfNum) = thisMaterial->AbsorpThermal; state.dataHeatBalSurf->SurfRoughnessExt(SurfNum) = thisMaterial->Roughness; continue; } - int const matNum = state.dataSurface->SurfMaterialMovInsulExt(SurfNum); - auto const *mat = s_mat->materials(matNum); - state.dataHeatBalSurf->SurfMovInsulExtPresent(SurfNum) = true; - state.dataHeatBalSurf->SurfMovInsulHExt(SurfNum) = 1.0 / (MovInsulSchedVal * mat->Resistance); + + auto const *mat = s_mat->materials(movInsul.matNum); + movInsul.present = true; + movInsul.H = 1.0 / (MovInsulSchedVal * mat->Resistance); if (mat->group == Material::Group::Glass || mat->group == Material::Group::GlassEQL) { auto const *matGlass = dynamic_cast(mat); assert(matGlass != nullptr); @@ -2366,23 +2375,24 @@ void EvalOutsideMovableInsulation(EnergyPlusData &state) void EvalInsideMovableInsulation(EnergyPlusData &state) { auto &s_mat = state.dataMaterial; + auto &s_surf = state.dataSurface; // This subroutine determines whether or not inside movable insulation is present at the current time. - for (int SurfNum : state.dataHeatBalSurf->SurfMovInsulIndexList) { - Real64 MovInsulSchedVal = ScheduleManager::GetCurrentScheduleValue(state, state.dataSurface->SurfSchedMovInsulInt(SurfNum)); + for (int SurfNum : s_surf->intMovInsulSurfNums) { + auto &movInsul = s_surf->intMovInsuls(SurfNum); + Real64 MovInsulSchedVal = movInsul.sched->getCurrentVal(); if (MovInsulSchedVal <= 0.0) { // Movable insulation not present at current time - state.dataHeatBalSurf->SurfMovInsulIntPresent(SurfNum) = false; - int ConstrNum = state.dataSurface->SurfActiveConstruction(SurfNum); + movInsul.present = false; + int ConstrNum = s_surf->SurfActiveConstruction(SurfNum); auto const &thisConstruct = state.dataConstruction->Construct(ConstrNum); state.dataHeatBalSurf->SurfAbsSolarInt(SurfNum) = thisConstruct.InsideAbsorpSolar; state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum) = thisConstruct.InsideAbsorpThermal; continue; } - int const matNum = state.dataSurface->SurfMaterialMovInsulInt(SurfNum); - auto const *mat = s_mat->materials(matNum); + auto const *mat = s_mat->materials(movInsul.matNum); - state.dataHeatBalSurf->SurfMovInsulIntPresent(SurfNum) = true; - state.dataHeatBalSurf->SurfMovInsulHInt(SurfNum) = 1.0 / (MovInsulSchedVal * mat->Resistance); + movInsul.present = true; + movInsul.H = 1.0 / (MovInsulSchedVal * mat->Resistance); if (mat->group == Material::Group::Glass || mat->group == Material::Group::GlassEQL) { // Glass is insulating? auto const *matGlass = dynamic_cast(mat); assert(matGlass != nullptr); @@ -2427,7 +2437,6 @@ void InitSolarHeatGains(EnergyPlusData &state) // Using/Aliasing using Dayltg::TransTDD; - using General::POLYF; using SolarShading::CalcInteriorSolarDistribution; using namespace DataWindowEquivalentLayer; using SolarShading::SurfaceScheduledSolarInc; @@ -2836,7 +2845,7 @@ void InitSolarHeatGains(EnergyPlusData &state) state.dataHeatBal->EnclSolQSDifSol(enclNum) *= state.dataViewFactor->EnclSolInfo(enclNum).solVMULT; } - // RJH - 09-12-07 commented out report varariable calcs here since they refer to old distribution method + // RJH - 09-12-07 commented out report variable calcs here since they refer to old distribution method // DO SurfNum = 1, TotSurfaces // IF (.NOT. Surface(SurfNum)%HeatTransSurf) CYCLE //!!! Following may need to be removed or changed when shelves are considered in adjacent reflection calculations @@ -3087,7 +3096,7 @@ void InitSolarHeatGains(EnergyPlusData &state) Real64 interpFac = surfShade.blind.slatAngInterpFac; Real64 AbsDiffBlind; - // For constructions, have to do interpolation wheather we have movable slats or not + // For constructions, have to do interpolation whether we have movable slats or not for (int Lay = 1; Lay <= TotGlassLay; ++Lay) { auto const &dfAbsSlatLo = constructionSh.layerSlatBlindDfAbs(Lay)[slatIdxLo]; auto const &dfAbsSlatHi = constructionSh.layerSlatBlindDfAbs(Lay)[slatIdxHi]; @@ -3172,7 +3181,7 @@ void InitSolarHeatGains(EnergyPlusData &state) } state.dataHeatBal->SurfWinQRadSWwinAbsTotEnergy(SurfNum) = state.dataHeatBal->SurfWinQRadSWwinAbsTot(SurfNum) * state.dataGlobal->TimeStepZoneSec; - // Need to do it this way for now beaucse of scheduled surface gains. They do work only with + // Need to do it this way for now because of scheduled surface gains. They do work only with // BSDF windows and overwriting absorbtances will work only for ordinary windows // } else if ( SurfaceWindow( SurfNum ).WindowModelType != WindowModel:: BSDF && // SurfaceWindow( SurfNum ).WindowModelType != WindowModel:: EQL && @@ -3196,11 +3205,11 @@ void InitSolarHeatGains(EnergyPlusData &state) for (int Lay = 1; Lay <= TotSolidLay; ++Lay) { if (SurfSolAbs != 0) { state.dataSurface->SurfWinA(SurfNum, Lay) = - ScheduleManager::GetCurrentScheduleValue(state, state.dataSurface->FenLayAbsSSG(SurfSolAbs).SchedPtrs(Lay)); + state.dataSurface->FenLayAbsSSG(SurfSolAbs).scheds(Lay)->getCurrentVal(); // ABWin(Lay) = SurfWinA(SurfNum,Lay) state.dataHeatBal->SurfWinQRadSWwinAbs(SurfNum, Lay) = state.dataSurface->SurfWinA(SurfNum, Lay); } else { - // Several notes about this equation. First part is accounting for duffuse solar radiation for the ground + // Several notes about this equation. First part is accounting for diffuse solar radiation for the ground // and from the sky. Second item (SurfWinA(SurfNum,Lay) * BeamSolar) is accounting for absorbed solar // radiation originating from beam on exterior side. Third item (SurfWinACFOverlap(SurfNum,Lay)) is // accounting for absorptances from beam hitting back of the window which passes through rest of exterior @@ -3229,7 +3238,7 @@ void InitSolarHeatGains(EnergyPlusData &state) for (int Lay = 1; Lay <= TotSolidLay; ++Lay) { // Absorbed window components include: // (1) beam solar radiation absorbed by all layers in the fenestration - // (2) sky and ground reflected duffuse solar radiation absorbed by all layers + // (2) sky and ground reflected diffuse solar radiation absorbed by all layers // (3) diffuse short wave incident on the inside face of the fenestration. The short wave internal sources // include light, ... state.dataHeatBalSurfMgr->AbsDiffWin(Lay) = state.dataConstruction->Construct(ConstrNum).AbsDiffFrontEQL(Lay); @@ -3326,8 +3335,8 @@ void InitSolarHeatGains(EnergyPlusData &state) // (A window shade or blind, if present, is assumed to not shade the frame, so no special // treatment of frame solar needed if window has an exterior shade or blind.) if (FrArea > 0.0) { - Real64 FrIncSolarOut = BeamFaceInc; // Total solar incident on outside offrame including solar - Real64 FrIncSolarIn = 0.0; // Total solar incident on inside offrame including solar on frame projection (W/m2) + Real64 FrIncSolarOut = BeamFaceInc; // Total solar incident on outside of frame including solar + Real64 FrIncSolarIn = 0.0; // Total solar incident on inside of frame including solar on frame projection (W/m2) Real64 TransDiffGl = 0.0; // Diffuse solar transmittance if (FrProjOut > 0.0 || FrProjIn > 0.0) { Real64 BeamFrHorFaceInc = @@ -3341,13 +3350,13 @@ void InitSolarHeatGains(EnergyPlusData &state) // Beam solar on outside of frame FrIncSolarOut += (BeamFrHorFaceInc + BeamFrVertFaceInc) * FrProjOut; if (FrProjIn > 0.0) { - Real64 TransGl = General::POLYF(CosInc, thisConstruct.TransSolBeamCoef); + Real64 TransGl = Window::POLYF(CosInc, thisConstruct.TransSolBeamCoef); TransDiffGl = thisConstruct.TransDiff; if (ShadeFlag == DataSurfaces::WinShadingType::SwitchableGlazing) { // Switchable glazing Real64 SwitchFac = state.dataSurface->SurfWinSwitchingFactor(SurfNum); int ConstrNumSh = Surface(SurfNum).activeShadedConstruction; auto const &constructionSh = state.dataConstruction->Construct(ConstrNumSh); - Real64 TransGlSh = General::POLYF(CosInc, constructionSh.TransSolBeamCoef); + Real64 TransGlSh = Window::POLYF(CosInc, constructionSh.TransSolBeamCoef); TransGl = Window::InterpSw(SwitchFac, TransGl, TransGlSh); Real64 TransDiffGlSh = constructionSh.TransDiff; TransDiffGl = Window::InterpSw(SwitchFac, TransDiffGl, TransDiffGlSh); @@ -3433,14 +3442,14 @@ void InitSolarHeatGains(EnergyPlusData &state) DivIncSolarOutBm = BeamFaceInc + BeamDivHorFaceInc + BeamDivVertFaceInc; DivIncSolarOutDif = DifSolarFaceInc * (1.0 + state.dataSurface->SurfWinProjCorrDivOut(SurfNum)); if (DivProjIn > 0.0) { - Real64 TransGl = General::POLYF(CosInc, thisConstruct.TransSolBeamCoef); + Real64 TransGl = Window::POLYF(CosInc, thisConstruct.TransSolBeamCoef); Real64 TransDiffGl = thisConstruct.TransDiff; // Diffuse solar transmittance if (ShadeFlag == DataSurfaces::WinShadingType::SwitchableGlazing) { // Switchable glazing Real64 SwitchFac = state.dataSurface->SurfWinSwitchingFactor(SurfNum); int ConstrNumSh = Surface(SurfNum).activeShadedConstruction; auto const &constructionSh = state.dataConstruction->Construct(ConstrNumSh); - Real64 TransGlSh = General::POLYF(CosInc, constructionSh.TransSolBeamCoef); + Real64 TransGlSh = Window::POLYF(CosInc, constructionSh.TransSolBeamCoef); // Outer glass solar trans, refl, absorptance if switched TransGl = Window::InterpSw(SwitchFac, TransGl, TransGlSh); Real64 TransDiffGlSh = constructionSh.TransDiff; @@ -3476,7 +3485,7 @@ void InitSolarHeatGains(EnergyPlusData &state) // Exterior shade, screen or blind } else if (ShadeFlag == DataSurfaces::WinShadingType::ExtBlind) { // Exterior blind - auto &surfShade = state.dataSurface->surfShades(SurfNum); + auto const &surfShade = state.dataSurface->surfShades(SurfNum); int profIdxLo = surfShade.blind.profAngIdxLo; int profIdxHi = surfShade.blind.profAngIdxHi; @@ -3774,22 +3783,25 @@ void InitIntSolarDistribution(EnergyPlusData &state) state.dataHeatBalSurf->SurfQdotRadLightsInPerArea(SurfNum) += state.dataHeatBal->EnclSolQSWRadLights(solEnclosureNum) * AbsIntSurfVis; // Calculate absorbed solar on outside if movable exterior insulation in place - if (state.dataSurface->AnyMovableInsulation && - state.dataHeatBalSurf->SurfMovInsulExtPresent(SurfNum)) { // Movable outside insulation in place - Real64 AbsExt = state.dataHeatBalSurf->SurfAbsSolarExt(SurfNum); - auto const *thisMaterial = s_mat->materials(thisConstruct.LayerPoint(1)); - state.dataHeatBalSurf->SurfQRadSWOutMvIns(SurfNum) = - state.dataHeatBalSurf->SurfOpaqQRadSWOutAbs(SurfNum) * AbsExt / thisMaterial->AbsorpSolar; - // For transparent insulation, allow some sunlight to get through the movable insulation. - // The equation below is derived by taking what is transmitted through the layer and applying - // the fraction that is absorbed plus the back reflected portion (first order reflection only) - // to the plane between the transparent insulation and the exterior surface face. - auto const *matMovInsul = s_mat->materials(state.dataSurface->SurfMaterialMovInsulExt(SurfNum)); - auto const *matFenMovInsul = dynamic_cast(matMovInsul); - Real64 transMovInsul = (matFenMovInsul != nullptr) ? matFenMovInsul->Trans : 0.0; - - state.dataHeatBalSurf->SurfOpaqQRadSWOutAbs(SurfNum) = transMovInsul * state.dataHeatBalSurf->SurfQRadSWOutMvIns(SurfNum) * - ((thisMaterial->AbsorpSolar / AbsExt) + (1 - thisMaterial->AbsorpSolar)); + if (state.dataSurface->AnyMovableInsulation) { + auto &movInsul = state.dataSurface->extMovInsuls(SurfNum); + if (movInsul.present) { + Real64 AbsExt = state.dataHeatBalSurf->SurfAbsSolarExt(SurfNum); + auto const *thisMaterial = s_mat->materials(thisConstruct.LayerPoint(1)); + state.dataHeatBalSurf->SurfQRadSWOutMvIns(SurfNum) = + state.dataHeatBalSurf->SurfOpaqQRadSWOutAbs(SurfNum) * AbsExt / thisMaterial->AbsorpSolar; + // For transparent insulation, allow some sunlight to get through the movable insulation. + // The equation below is derived by taking what is transmitted through the layer and applying + // the fraction that is absorbed plus the back reflected portion (first order reflection only) + // to the plane between the transparent insulation and the exterior surface face. + auto const *matMovInsul = s_mat->materials(movInsul.matNum); + auto const *matFenMovInsul = dynamic_cast(matMovInsul); + Real64 transMovInsul = (matFenMovInsul != nullptr) ? matFenMovInsul->Trans : 0.0; + + state.dataHeatBalSurf->SurfOpaqQRadSWOutAbs(SurfNum) = + transMovInsul * state.dataHeatBalSurf->SurfQRadSWOutMvIns(SurfNum) * + ((thisMaterial->AbsorpSolar / AbsExt) + (1 - thisMaterial->AbsorpSolar)); + } } // RJH 08/30/07 - Add SurfWinInitialDifSolInAbs, SurfWinInitialDifSolwinAbs, and SurfWinInitialDifSolAbsByShade // calced in CalcWinTransDifSolInitialDistribution to SurfOpaqQRadSWInAbs, SurfWinQRadSWwinAbs, and SurfWinIntSWAbsByShade here @@ -3819,16 +3831,17 @@ void InitIntSolarDistribution(EnergyPlusData &state) state.dataViewFactor->EnclRadInfo(radEnclosureNum).radQThermalRad * state.dataViewFactor->EnclRadInfo(radEnclosureNum).radThermAbsMult * state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum); } else { - state.dataHeatBalSurfMgr->curQL = state.dataViewFactor->EnclRadInfo(radEnclosureNum).radQThermalRad; + // radiant value prior to adjustment for pulse for load component report + Real64 const curQL = state.dataViewFactor->EnclRadInfo(radEnclosureNum).radQThermalRad; // for the loads component report during the special sizing run increase the radiant portion // a small amount to create a "pulse" of heat that is used for the - state.dataHeatBalSurfMgr->adjQL = - state.dataHeatBalSurfMgr->curQL + state.dataViewFactor->EnclRadInfo(radEnclosureNum).FloorArea * pulseMultipler; + // radiant value including adjustment for pulse for load component report + Real64 const adjQL = curQL + state.dataViewFactor->EnclRadInfo(radEnclosureNum).FloorArea * pulseMultipler; // ITABSF is the Inside Thermal Absorptance // EnclRadThermAbsMult is a multiplier for each zone/enclosure // SurfQdotRadIntGainsInPerArea is the thermal radiation absorbed on inside surfaces state.dataHeatBal->SurfQdotRadIntGainsInPerArea(SurfNum) = - state.dataHeatBalSurfMgr->adjQL * state.dataViewFactor->EnclRadInfo(radEnclosureNum).radThermAbsMult * + adjQL * state.dataViewFactor->EnclRadInfo(radEnclosureNum).radThermAbsMult * state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum); } @@ -3956,16 +3969,17 @@ void InitIntSolarDistribution(EnergyPlusData &state) state.dataViewFactor->EnclRadInfo(radEnclosureNum).radQThermalRad * state.dataViewFactor->EnclRadInfo(radEnclosureNum).radThermAbsMult * state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum); } else { - state.dataHeatBalSurfMgr->curQL = state.dataViewFactor->EnclRadInfo(radEnclosureNum).radQThermalRad; + // radiant value prior to adjustment for pulse for load component report + Real64 const curQL = state.dataViewFactor->EnclRadInfo(radEnclosureNum).radQThermalRad; // for the loads component report during the special sizing run increase the radiant portion // a small amount to create a "pulse" of heat that is used for the - state.dataHeatBalSurfMgr->adjQL = - state.dataHeatBalSurfMgr->curQL + state.dataViewFactor->EnclRadInfo(radEnclosureNum).FloorArea * pulseMultipler; + // radiant value including adjustment for pulse for load component report + Real64 const adjQL = curQL + state.dataViewFactor->EnclRadInfo(radEnclosureNum).FloorArea * pulseMultipler; // ITABSF is the Inside Thermal Absorptance // EnclRadThermAbsMult is a multiplier for each zone/radiant enclosure // SurfQdotRadIntGainsInPerArea is the thermal radiation absorbed on inside surfaces state.dataHeatBal->SurfQdotRadIntGainsInPerArea(SurfNum) = - state.dataHeatBalSurfMgr->adjQL * state.dataViewFactor->EnclRadInfo(radEnclosureNum).radThermAbsMult * + adjQL * state.dataViewFactor->EnclRadInfo(radEnclosureNum).radThermAbsMult * state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum); } // Radiations absorbed by the window layers coming from zone side @@ -4247,7 +4261,7 @@ void ComputeIntSWAbsorpFactors(EnergyPlusData &state) // Window with shade, screen or blind if (ConstrNumSh != 0) { - auto &constrSh = state.dataConstruction->Construct(ConstrNumSh); + auto const &constrSh = state.dataConstruction->Construct(ConstrNumSh); if (ANY_SHADE_SCREEN(ShadeFlag)) { TransDiffWin = constrSh.TransDiff; DiffAbsShade = constrSh.AbsDiffBackShade; @@ -4459,7 +4473,7 @@ void InitEMSControlledSurfaceProperties(EnergyPlusData &state) // DATE WRITTEN April 2011 // PURPOSE OF THIS SUBROUTINE: - // initialize material and construction surface properties if being overriden by EMS + // initialize material and construction surface properties if being overridden by EMS // METHODOLOGY EMPLOYED: // update solar, thermal and visible absorptance values when actuated by EMS @@ -4525,7 +4539,7 @@ void InitEMSControlledConstructions(EnergyPlusData &state) // DATE WRITTEN Jan 2012 // PURPOSE OF THIS SUBROUTINE: - // change construction on surface if overriden by EMS + // change construction on surface if overridden by EMS state.dataGlobal->AnyConstrOverridesInModel = false; for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { @@ -4542,7 +4556,7 @@ void InitEMSControlledConstructions(EnergyPlusData &state) if (state.dataSurface->SurfEMSConstructionOverrideON(SurfNum) && (state.dataSurface->SurfEMSConstructionOverrideValue(SurfNum) > 0)) { if (state.dataConstruction->Construct(state.dataSurface->SurfEMSConstructionOverrideValue(SurfNum)) - .TypeIsWindow) { // okay, allways allow windows + .TypeIsWindow) { // okay, always allow windows state.dataRuntimeLang->EMSConstructActuatorChecked(state.dataSurface->SurfEMSConstructionOverrideValue(SurfNum), SurfNum) = true; state.dataRuntimeLang->EMSConstructActuatorIsOkay(state.dataSurface->SurfEMSConstructionOverrideValue(SurfNum), SurfNum) = true; } @@ -4568,7 +4582,7 @@ void InitEMSControlledConstructions(EnergyPlusData &state) true; if (state.dataConstruction->Construct(surface.Construction).NumHistories != state.dataConstruction->Construct(state.dataSurface->SurfEMSConstructionOverrideValue(SurfNum)).NumHistories) { - // thow warning, but allow + // throw warning, but allow ShowWarningError(state, "InitEMSControlledConstructions: EMS Construction State Actuator may be unrealistic, incompatible " "CTF timescales are being used."); @@ -4609,7 +4623,7 @@ void InitEMSControlledConstructions(EnergyPlusData &state) if (state.dataConstruction->Construct(surface.Construction).SourceSinkPresent) { if (!state.dataConstruction->Construct(state.dataSurface->SurfEMSConstructionOverrideValue(SurfNum)).SourceSinkPresent) { - // thow warning, and do not allow + // throw warning, and do not allow ShowSevereError(state, "InitEMSControlledConstructions: EMS Construction State Actuator not valid."); ShowContinueError(state, format("Construction named = {} has internal source/sink", @@ -4640,7 +4654,7 @@ void InitEMSControlledConstructions(EnergyPlusData &state) true; if (state.dataHeatBalFiniteDiffMgr->ConstructFD(surface.Construction).TotNodes != state.dataHeatBalFiniteDiffMgr->ConstructFD(state.dataSurface->SurfEMSConstructionOverrideValue(SurfNum)).TotNodes) { - // thow warning, and do not allow + // throw warning, and do not allow ShowSevereError(state, "InitEMSControlledConstructions: EMS Construction State Actuator not valid."); ShowContinueError(state, format("Construction named = {} has number of finite difference nodes ={}", @@ -4663,7 +4677,7 @@ void InitEMSControlledConstructions(EnergyPlusData &state) if (state.dataConstruction->Construct(surface.Construction).SourceSinkPresent) { if (!state.dataConstruction->Construct(state.dataSurface->SurfEMSConstructionOverrideValue(SurfNum)).SourceSinkPresent) { - // thow warning, and do not allow + // throw warning, and do not allow ShowSevereError(state, "InitEMSControlledConstructions: EMS Construction State Actuator not valid."); ShowContinueError(state, format("Construction named = {} has internal source/sink", @@ -5074,7 +5088,7 @@ void UpdateThermalHistories(EnergyPlusData &state) state.dataHeatBalSurf->SurfCTFConstInPart(SurfNum); // Heat source/sink term for radiant systems // Only HT opaq surfaces are evaluated, previous if (surface.Class == SurfaceClass::Floor || surface.Class == SurfaceClass::Wall || // surface.Class == SurfaceClass::IntMass || surface.Class == SurfaceClass::Roof || surface.Class == SurfaceClass::Door) checks are - // reduncant. + // redundant. if (construct.SourceSinkPresent) { SurfInsideFluxHistCurr += state.dataHeatBalSurf->SurfQsrcHist(SurfNum, 1) * construct.CTFSourceIn[0]; } @@ -5484,7 +5498,7 @@ void CalcThermalResilience(EnergyPlusData &state) // The current formula for determining the humidex was developed by J. M. Masterton and F. A. Richardson of // Canada's Atmospheric Environment Service in 1979. // Reference: Masterson, J., and F. Richardson, 1979: Humidex, a method of quantifying human - // discomfort due to excessive heat and humidity CLI 1-79, Environment Canada, Atmosheric Environment Servic + // discomfort due to excessive heat and humidity CLI 1-79, Environment Canada, Atmospheric Environment Service // using OutputProcessor::ReqRepVars; if (state.dataHeatBalSurfMgr->ManageSurfaceHeatBalancefirstTime) { for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { @@ -5642,8 +5656,7 @@ void ReportThermalResilience(EnergyPlusData &state) for (int iPeople = 1; iPeople <= state.dataHeatBal->TotPeople; ++iPeople) { int ZoneNum = state.dataHeatBal->People(iPeople).ZonePtr; state.dataHeatBal->Resilience(ZoneNum).ZoneNumOcc = - state.dataHeatBal->People(iPeople).NumberOfPeople * - ScheduleManager::GetCurrentScheduleValue(state, state.dataHeatBal->People(iPeople).NumberOfPeoplePtr); + state.dataHeatBal->People(iPeople).NumberOfPeople * state.dataHeatBal->People(iPeople).sched->getCurrentVal(); state.dataHeatBal->Resilience(ZoneNum).ZonePierceSETLastStep = state.dataHeatBal->Resilience(ZoneNum).ZonePierceSET; if (state.dataHeatBal->People(iPeople).Pierce) { state.dataHeatBal->Resilience(ZoneNum).ZonePierceSET = state.dataThermalComforts->ThermalComfortData(iPeople).PierceSET; @@ -5893,8 +5906,9 @@ void ReportThermalResilience(EnergyPlusData &state) } Real64 Temperature = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).ZTAV; - Real64 CoolingSetpoint = state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ZoneNum); - Real64 HeatingSetpoint = state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ZoneNum); + auto const &zoneTstatSetpt = state.dataHeatBalFanSys->zoneTstatSetpts(ZoneNum); + Real64 CoolingSetpoint = zoneTstatSetpt.setptHi; + Real64 HeatingSetpoint = zoneTstatSetpt.setptLo; if ((CoolingSetpoint > 0) && (Temperature > CoolingSetpoint)) { state.dataHeatBal->Resilience(ZoneNum).ZoneUnmetDegreeHourBins[0] += (Temperature - CoolingSetpoint) * state.dataGlobal->TimeStepZone; @@ -6159,11 +6173,8 @@ void ReportCO2Resilience(EnergyPlusData &state) } if (Constant::KindOfSim::RunPeriodWeather == state.dataGlobal->KindOfSim && !state.dataGlobal->WarmupFlag) { - for (int iPeople = 1; iPeople <= state.dataHeatBal->TotPeople; ++iPeople) { - int ZoneNum = state.dataHeatBal->People(iPeople).ZonePtr; - state.dataHeatBal->Resilience(ZoneNum).ZoneNumOcc = - state.dataHeatBal->People(iPeople).NumberOfPeople * - ScheduleManager::GetCurrentScheduleValue(state, state.dataHeatBal->People(iPeople).NumberOfPeoplePtr); + for (auto const &people : state.dataHeatBal->People) { + state.dataHeatBal->Resilience(people.ZonePtr).ZoneNumOcc = people.NumberOfPeople * people.sched->getCurrentVal(); } Array1D_bool reportPeriodFlags; @@ -6250,11 +6261,8 @@ void ReportVisualResilience(EnergyPlusData &state) } if (Constant::KindOfSim::RunPeriodWeather == state.dataGlobal->KindOfSim && !state.dataGlobal->WarmupFlag) { - for (int iPeople = 1; iPeople <= state.dataHeatBal->TotPeople; ++iPeople) { - int ZoneNum = state.dataHeatBal->People(iPeople).ZonePtr; - state.dataHeatBal->Resilience(ZoneNum).ZoneNumOcc = - state.dataHeatBal->People(iPeople).NumberOfPeople * - ScheduleManager::GetCurrentScheduleValue(state, state.dataHeatBal->People(iPeople).NumberOfPeoplePtr); + for (auto const &people : state.dataHeatBal->People) { + state.dataHeatBal->Resilience(people.ZonePtr).ZoneNumOcc = people.NumberOfPeople * people.sched->getCurrentVal(); } // Accumulate across daylighting controls first for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { @@ -6569,17 +6577,17 @@ void ReportSurfaceHeatBalance(EnergyPlusData &state) } if (state.dataGlobal->ZoneSizingCalc && state.dataGlobal->CompLoadReportIsReq) { - int TimeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; + // This is by surface, so it works for both space and zone component loads + int TimeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->TimeStepsInHour + state.dataGlobal->TimeStep; + auto &surfCLDayTS = state.dataOutRptTab->surfCompLoads[state.dataSize->CurOverallSimDay - 1].ts[TimeStepInDay - 1]; for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { auto const &thisSpace = state.dataHeatBal->space(spaceNum); int firstSurf = thisSpace.OpaqOrIntMassSurfaceFirst; int lastSurf = thisSpace.OpaqOrIntMassSurfaceLast; for (int surfNum = firstSurf; surfNum <= lastSurf; ++surfNum) { - state.dataOutRptTab->lightSWRadSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, surfNum) = - state.dataHeatBalSurf->SurfQdotRadLightsInRep(surfNum); - state.dataOutRptTab->feneSolarRadSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, surfNum) = - state.dataHeatBalSurf->SurfQdotRadSolarInRep(surfNum); + surfCLDayTS.surf[surfNum - 1].lightSWRadSeq = state.dataHeatBalSurf->SurfQdotRadLightsInRep(surfNum); + surfCLDayTS.surf[surfNum - 1].feneSolarRadSeq = state.dataHeatBalSurf->SurfQdotRadSolarInRep(surfNum); } firstSurf = thisSpace.OpaqOrWinSurfaceFirst; lastSurf = thisSpace.OpaqOrWinSurfaceLast; @@ -6587,13 +6595,10 @@ void ReportSurfaceHeatBalance(EnergyPlusData &state) auto const &surface = state.dataSurface->Surface(surfNum); if (!state.dataGlobal->WarmupFlag) { if (state.dataGlobal->isPulseZoneSizing) { - state.dataOutRptTab->loadConvectedWithPulse(state.dataSize->CurOverallSimDay, TimeStepInDay, surfNum) = - state.dataHeatBalSurf->SurfQdotConvInRep(surfNum); + surfCLDayTS.surf[surfNum - 1].loadConvectedWithPulse = state.dataHeatBalSurf->SurfQdotConvInRep(surfNum); } else { - state.dataOutRptTab->loadConvectedNormal(state.dataSize->CurOverallSimDay, TimeStepInDay, surfNum) = - state.dataHeatBalSurf->SurfQdotConvInRep(surfNum); - state.dataOutRptTab->netSurfRadSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, surfNum) = - state.dataHeatBalSurf->SurfQdotRadNetLWInPerArea(surfNum) * surface.Area; + surfCLDayTS.surf[surfNum - 1].loadConvectedNormal = state.dataHeatBalSurf->SurfQdotConvInRep(surfNum); + surfCLDayTS.surf[surfNum - 1].netSurfRadSeq = state.dataHeatBalSurf->SurfQdotRadNetLWInPerArea(surfNum) * surface.Area; } } } @@ -6677,8 +6682,8 @@ void ReportNonRepresentativeSurfaceResults(EnergyPlusData &state) void ReportIntMovInsInsideSurfTemp(EnergyPlusData &state) { state.dataHeatBalSurf->SurfTempInMovInsRep = state.dataHeatBalSurf->SurfTempIn; - for (int SurfNum : state.dataHeatBalSurf->SurfMovInsulIndexList) { - if (state.dataHeatBalSurf->SurfMovInsulIntPresent(SurfNum)) { + for (int SurfNum : state.dataSurface->intMovInsulSurfNums) { + if (state.dataSurface->intMovInsuls(SurfNum).present) { state.dataHeatBalSurf->SurfTempInMovInsRep(SurfNum) = state.dataHeatBalSurf->SurfTempInTmp(SurfNum); } } @@ -6730,8 +6735,6 @@ void CalcHeatBalanceOutsideSurf(EnergyPlusData &state, // using namespace DataHeatBalSurface; // using namespace DataSurfaces; // using HeatBalanceIntRadExchange::CalcInteriorRadExchange; - // using ScheduleManager::GetCurrentScheduleValue; - // using ScheduleManager::GetScheduleIndex; // using namespace Psychrometrics; // using EcoRoofManager::CalcEcoRoof; // @@ -6793,8 +6796,7 @@ void CalcHeatBalanceOutsideSurf(EnergyPlusData &state, // Calculate heat extract due to additional heat flux source term as the surface boundary condition for (int surfNum : state.dataSurface->allOutsideSourceSurfaceList) { - state.dataHeatBalSurf->SurfQAdditionalHeatSourceOutside(surfNum) = - EnergyPlus::ScheduleManager::GetCurrentScheduleValue(state, Surface(surfNum).OutsideHeatSourceTermSchedule); + state.dataHeatBalSurf->SurfQAdditionalHeatSourceOutside(surfNum) = Surface(surfNum).outsideHeatSourceTermSched->getCurrentVal(); } for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { // Loop through all surfaces... for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { @@ -6959,9 +6961,8 @@ void CalcHeatBalanceOutsideSurf(EnergyPlusData &state, state.dataSurface->OSC(OPtr).TOutsideSurfPast = state.dataHeatBalSurf->SurfOutsideTempHist(1)(SurfNum); } - if (state.dataSurface->OSC(OPtr).ConstTempScheduleIndex != 0) { // Determine outside temperature from schedule - state.dataSurface->OSC(OPtr).ConstTemp = - ScheduleManager::GetCurrentScheduleValue(state, state.dataSurface->OSC(OPtr).ConstTempScheduleIndex); + if (state.dataSurface->OSC(OPtr).constTempSched != nullptr) { // Determine outside temperature from schedule + state.dataSurface->OSC(OPtr).ConstTemp = state.dataSurface->OSC(OPtr).constTempSched->getCurrentVal(); } // Allow for modification of TemperatureCoefficient with unitary sine wave. @@ -7030,9 +7031,8 @@ void CalcHeatBalanceOutsideSurf(EnergyPlusData &state, state.dataSurface->OSC(OPtr).TOutsideSurfPast = state.dataHeatBalSurf->SurfOutsideTempHist(1)(SurfNum); } - if (state.dataSurface->OSC(OPtr).ConstTempScheduleIndex != 0) { // Determine outside temperature from schedule - state.dataSurface->OSC(OPtr).ConstTemp = - ScheduleManager::GetCurrentScheduleValue(state, state.dataSurface->OSC(OPtr).ConstTempScheduleIndex); + if (state.dataSurface->OSC(OPtr).constTempSched != nullptr) { // Determine outside temperature from schedule + state.dataSurface->OSC(OPtr).ConstTemp = state.dataSurface->OSC(OPtr).constTempSched->getCurrentVal(); } state.dataHeatBalSurf->SurfHConvExt(SurfNum) = state.dataSurface->OSC(OPtr).SurfFilmCoef; @@ -7093,7 +7093,7 @@ void CalcHeatBalanceOutsideSurf(EnergyPlusData &state, } // This ends the calculations for this surface and goes on to the next SurfNum } break; - case DataSurfaces::OtherSideCondModeledExt: { // A surface with other side conditions determined from seperate, dynamic component + case DataSurfaces::OtherSideCondModeledExt: { // A surface with other side conditions determined from separate, dynamic component // modeling that defines the "outside environment" // First, set up the outside convection coefficient and the exterior temperature // boundary condition for the surface @@ -7168,12 +7168,12 @@ void CalcHeatBalanceOutsideSurf(EnergyPlusData &state, } // Roughness index of the exterior surface Material::SurfaceRoughness RoughSurf = state.dataHeatBalSurf->SurfRoughnessExt(SurfNum); - // Thermal absoptance of the exterior surface + // Thermal absorptance of the exterior surface Real64 AbsThermSurf = state.dataHeatBalSurf->SurfAbsThermalExt(SurfNum); HMovInsul = 0; // Check for outside movable insulation - if (state.dataSurface->AnyMovableInsulation && state.dataHeatBalSurf->SurfMovInsulExtPresent(SurfNum)) { - HMovInsul = state.dataHeatBalSurf->SurfMovInsulHExt(SurfNum); + if (state.dataSurface->AnyMovableInsulation && state.dataSurface->extMovInsuls(SurfNum).present) { + HMovInsul = state.dataSurface->extMovInsuls(SurfNum).H; } // Check for exposure to wind (exterior environment) @@ -7335,8 +7335,7 @@ void CalcHeatBalanceOutsideSurf(EnergyPlusData &state, Real64 SrdSurfViewFac = state.dataSurface->SurroundingSurfsProperty(SrdSurfsNum).SurroundingSurfs(SrdSurfNum).ViewFactor; // Absolute temperature of a surrounding surface Real64 SrdSurfTempAbs = - ScheduleManager::GetCurrentScheduleValue( - state, state.dataSurface->SurroundingSurfsProperty(SrdSurfsNum).SurroundingSurfs(SrdSurfNum).TempSchNum) + + state.dataSurface->SurroundingSurfsProperty(SrdSurfsNum).SurroundingSurfs(SrdSurfNum).tempSched->getCurrentVal() + Constant::Kelvin; state.dataHeatBalSurf->SurfQRadLWOutSrdSurfs(SurfNum) += Constant::StefanBoltzmann * AbsThermSurf * SrdSurfViewFac * (pow_4(SrdSurfTempAbs) - pow_4(TSurf)); @@ -7618,7 +7617,7 @@ void CalcHeatBalanceInsideSurf2(EnergyPlusData &state, // Calculate heat extract due to additional heat flux source term as the surface boundary condition for (int surfNum : state.dataSurface->allInsideSourceSurfaceList) { state.dataHeatBalSurf->SurfQAdditionalHeatSourceInside(surfNum) = - EnergyPlus::ScheduleManager::GetCurrentScheduleValue(state, state.dataSurface->Surface(surfNum).InsideHeatSourceTermSchedule); + state.dataSurface->Surface(surfNum).insideHeatSourceTermSched->getCurrentVal(); } // Calculate Kiva instances @@ -7827,7 +7826,7 @@ void CalcHeatBalanceInsideSurf2(EnergyPlusData &state, state.dataHeatBalSurf->SurfTempIn(SurfNum) = state.dataHeatBalSurf->SurfTempInTmp(SurfNum); } else { // Standard surface or interzone surface - bool movableInsulPresent = state.dataSurface->AnyMovableInsulation && state.dataHeatBalSurf->SurfMovInsulIntPresent(SurfNum); + bool movableInsulPresent = state.dataSurface->AnyMovableInsulation && state.dataSurface->intMovInsuls(SurfNum).present; if (!movableInsulPresent) { // No movable insulation present, normal heat balance equation if (surface.HeatTransferAlgorithm == DataSurfaces::HeatTransferModel::CTF || @@ -7976,14 +7975,14 @@ void CalcHeatBalanceInsideSurf2(EnergyPlusData &state, state.dataHeatBalSurf->SurfTempIn(SurfNum) = state.dataHeatBalSurf->SurfTempInTmp(SurfNum); } else { // Movable insulation present - Real64 HMovInsul = state.dataHeatBalSurf->SurfMovInsulHInt(SurfNum); + Real64 HMovInsul = state.dataSurface->intMovInsuls(SurfNum).H; if (construct.SourceSinkPresent) { ShowSevereError(state, "Interior movable insulation is not valid with embedded sources/sinks"); ShowContinueError(state, format("Construction {} contains an internal source or sink but also uses", construct.Name)); ShowContinueError(state, format("interior movable insulation {} for a surface with that construction.", - s_mat->materials(state.dataSurface->SurfMaterialMovInsulInt(SurfNum))->Name)); + s_mat->materials(state.dataSurface->intMovInsuls(SurfNum).matNum)->Name)); ShowContinueError(state, "This is not currently allowed because the heat balance equations do not currently accommodate " "this combination."); @@ -8461,7 +8460,7 @@ void CalcHeatBalanceInsideSurf2CTFOnly(EnergyPlusData &state, // Calculate heat extract due to additional heat flux source term as the surface boundary condition for (int surfNum : state.dataSurface->allInsideSourceSurfaceList) { state.dataHeatBalSurf->SurfQAdditionalHeatSourceInside(surfNum) = - EnergyPlus::ScheduleManager::GetCurrentScheduleValue(state, state.dataSurface->Surface(surfNum).InsideHeatSourceTermSchedule); + state.dataSurface->Surface(surfNum).insideHeatSourceTermSched->getCurrentVal(); } // Set up coefficient arrays prior to calculations and precalc terms that do no change during iteration - non-window surfaces @@ -8623,9 +8622,11 @@ void CalcHeatBalanceInsideSurf2CTFOnly(EnergyPlusData &state, // Loop over non-window surfaces (includes TubularDaylightingDomes) for (int surfNum = firstNonWinSurf; surfNum <= lastNonWinSurf; ++surfNum) { - bool movableInsulPresent = state.dataSurface->AnyMovableInsulation && state.dataHeatBalSurf->SurfMovInsulIntPresent(surfNum); + auto &movInsul = state.dataSurface->intMovInsuls(surfNum); + + bool movableInsulPresent = state.dataSurface->AnyMovableInsulation && movInsul.present; if (movableInsulPresent) { // Movable insulation present, recalc surface temps - Real64 HMovInsul = state.dataHeatBalSurf->SurfMovInsulHInt(surfNum); + Real64 HMovInsul = movInsul.H; Real64 F1 = HMovInsul / (HMovInsul + state.dataHeatBalSurf->SurfHConvInt(surfNum) + DataHeatBalSurface::IterDampConst); state.dataHeatBalSurf->SurfTempIn(surfNum) = (state.dataHeatBalSurf->SurfCTFConstInPart(surfNum) + state.dataHeatBalSurf->SurfOpaqQRadSWInAbs(surfNum) + @@ -9199,11 +9200,11 @@ void CalcOutsideSurfTemp(EnergyPlusData &state, if (surface.SurfHasSurroundingSurfProperty) { int SrdSurfsNum = surface.SurfSurroundingSurfacesNum; - if (state.dataSurface->SurroundingSurfsProperty(SrdSurfsNum).SkyTempSchNum != 0) { - TSky = ScheduleManager::GetCurrentScheduleValue(state, state.dataSurface->SurroundingSurfsProperty(SrdSurfsNum).SkyTempSchNum); + if (state.dataSurface->SurroundingSurfsProperty(SrdSurfsNum).skyTempSched != nullptr) { + TSky = state.dataSurface->SurroundingSurfsProperty(SrdSurfsNum).skyTempSched->getCurrentVal(); } - if (state.dataSurface->SurroundingSurfsProperty(SrdSurfsNum).GroundTempSchNum != 0) { - TGround = ScheduleManager::GetCurrentScheduleValue(state, state.dataSurface->SurroundingSurfsProperty(SrdSurfsNum).GroundTempSchNum); + if (state.dataSurface->SurroundingSurfsProperty(SrdSurfsNum).groundTempSched != nullptr) { + TGround = state.dataSurface->SurroundingSurfsProperty(SrdSurfsNum).groundTempSched->getCurrentVal(); } TSrdSurfs = state.dataSurface->Surface(SurfNum).SrdSurfTemp; } @@ -9405,7 +9406,7 @@ void CalcOutsideSurfTemp(EnergyPlusData &state, ShowContinueError(state, format("Construction {} contains an internal source or sink but also uses", construct.Name)); ShowContinueError(state, format("exterior movable insulation {} for a surface with that construction.", - s_mat->materials(state.dataSurface->SurfMaterialMovInsulExt(SurfNum))->Name)); + s_mat->materials(state.dataSurface->extMovInsuls(SurfNum).matNum)->Name)); ShowContinueError(state, "This is not currently allowed because the heat balance equations do not currently accommodate this combination."); ErrorFlag = true; @@ -9499,7 +9500,8 @@ void CalcExteriorVentedCavity(EnergyPlusData &state, int const SurfNum) // index state.dataHeatBal->ExtVentedCavity(CavNum).HcPlen = HcPlen; state.dataHeatBal->ExtVentedCavity(CavNum).PassiveACH = (MdotVent / RhoAir) * - (1.0 / (state.dataHeatBal->ExtVentedCavity(CavNum).ProjArea * state.dataHeatBal->ExtVentedCavity(CavNum).PlenGapThick)) * Constant::SecInHour; + (1.0 / (state.dataHeatBal->ExtVentedCavity(CavNum).ProjArea * state.dataHeatBal->ExtVentedCavity(CavNum).PlenGapThick)) * + Constant::rSecsInHour; state.dataHeatBal->ExtVentedCavity(CavNum).PassiveMdotVent = MdotVent; state.dataHeatBal->ExtVentedCavity(CavNum).PassiveMdotWind = VdotWind * RhoAir; state.dataHeatBal->ExtVentedCavity(CavNum).PassiveMdotTherm = VdotThermal * RhoAir; @@ -9529,39 +9531,35 @@ void GatherComponentLoadsSurfAbsFact(EnergyPlusData &state) // METHODOLOGY EMPLOYED: // Save sequence of values for report during sizing. + // This is by surface, so it works for both space and zone component loads if (state.dataGlobal->CompLoadReportIsReq && !state.dataGlobal->isPulseZoneSizing) { - int TimeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; - for (int enclosureNum = 1; enclosureNum <= state.dataViewFactor->NumOfRadiantEnclosures; ++enclosureNum) { - state.dataOutRptTab->TMULTseq(state.dataSize->CurOverallSimDay, TimeStepInDay, enclosureNum) = - state.dataViewFactor->EnclRadInfo(enclosureNum).radThermAbsMult; - } + int TimeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->TimeStepsInHour + state.dataGlobal->TimeStep; + auto &surfCLDayTS = state.dataOutRptTab->surfCompLoads[state.dataSize->CurOverallSimDay - 1].ts[TimeStepInDay - 1]; for (int jSurf = 1; jSurf <= state.dataSurface->TotSurfaces; ++jSurf) { auto const &surface = state.dataSurface->Surface(jSurf); if (!surface.HeatTransSurf || surface.Zone == 0) continue; // Skip non-heat transfer surfaces if (surface.Class == DataSurfaces::SurfaceClass::TDD_Dome) continue; // Skip tubular daylighting device domes - state.dataOutRptTab->ITABSFseq(state.dataSize->CurOverallSimDay, TimeStepInDay, jSurf) = state.dataHeatBalSurf->SurfAbsThermalInt(jSurf); + surfCLDayTS.surf[jSurf - 1].ITABSFseq = state.dataHeatBalSurf->SurfAbsThermalInt(jSurf); + surfCLDayTS.surf[jSurf - 1].TMULTseq = state.dataViewFactor->EnclRadInfo(surface.RadEnclIndex).radThermAbsMult; } } } Real64 GetSurfIncidentSolarMultiplier(EnergyPlusData &state, int SurfNum) { - if (state.dataSurface->Surface(SurfNum).hasIncSolMultiplier) { - if (state.dataSurface->SurfIncSolMultiplier(SurfNum).SchedPtr > 0) { - return ScheduleManager::GetCurrentScheduleValue(state, state.dataSurface->SurfIncSolMultiplier(SurfNum).SchedPtr) * - state.dataSurface->SurfIncSolMultiplier(SurfNum).Scaler; - } else { - return state.dataSurface->SurfIncSolMultiplier(SurfNum).Scaler; - } - } else { + if (!state.dataSurface->Surface(SurfNum).hasIncSolMultiplier) { return 1.0; + } else if (state.dataSurface->SurfIncSolMultiplier(SurfNum).sched != nullptr) { + return state.dataSurface->SurfIncSolMultiplier(SurfNum).sched->getCurrentVal() * state.dataSurface->SurfIncSolMultiplier(SurfNum).Scaler; + } else { + return state.dataSurface->SurfIncSolMultiplier(SurfNum).Scaler; } } void InitSurfacePropertyViewFactors(EnergyPlusData &state) { - // purpuse: + // purpose: // Initializes sky and ground surfaces view factors of exterior surfaces // used by SurfaceProperty:LocalEnvironment // view factors are constant hence should be set only once @@ -9683,8 +9681,8 @@ void GetGroundSurfacesTemperatureAverage(EnergyPlusData &state) for (int gSurfNum = 1; gSurfNum <= GndSurfsProperty.NumGndSurfs; gSurfNum++) { GndSurfViewFactor = GndSurfsProperty.GndSurfs(gSurfNum).ViewFactor; if (GndSurfViewFactor == 0.0) continue; - if (GndSurfsProperty.GndSurfs(gSurfNum).TempSchPtr == 0) continue; - GndSurfaceTemp = ScheduleManager::GetCurrentScheduleValue(state, GndSurfsProperty.GndSurfs(gSurfNum).TempSchPtr); + if (GndSurfsProperty.GndSurfs(gSurfNum).tempSched == nullptr) continue; + GndSurfaceTemp = GndSurfsProperty.GndSurfs(gSurfNum).tempSched->getCurrentVal(); GndSurfaceTempSum += GndSurfViewFactor * pow_4(GndSurfaceTemp + Constant::Kelvin); } if (GndSurfaceTempSum == 0.0) { @@ -9698,7 +9696,7 @@ void GetGroundSurfacesTemperatureAverage(EnergyPlusData &state) void GetGroundSurfacesReflectanceAverage(EnergyPlusData &state) { - // returns ground surfaces average reflectance (dimenssionless) + // returns ground surfaces average reflectance (dimensionless) // ground reflectance viewed by a building exterior surface // ground surfaces reflectance weighed using view factors @@ -9716,8 +9714,8 @@ void GetGroundSurfacesReflectanceAverage(EnergyPlusData &state) Real64 GndSurfRefl = 0.0; Real64 GndSurfsReflSum = 0.0; for (int gSurfNum = 1; gSurfNum <= GndSurfsProperty.NumGndSurfs; gSurfNum++) { - if (GndSurfsProperty.GndSurfs(gSurfNum).ReflSchPtr == 0) continue; - GndSurfRefl = ScheduleManager::GetCurrentScheduleValue(state, GndSurfsProperty.GndSurfs(gSurfNum).ReflSchPtr); + if (GndSurfsProperty.GndSurfs(gSurfNum).reflSched == nullptr) continue; + GndSurfRefl = GndSurfsProperty.GndSurfs(gSurfNum).reflSched->getCurrentVal(); GndSurfsReflSum += GndSurfsProperty.GndSurfs(gSurfNum).ViewFactor * GndSurfRefl; } if (GndSurfsReflSum == 0.0) { @@ -9731,7 +9729,7 @@ void GetGroundSurfacesReflectanceAverage(EnergyPlusData &state) void ReSetGroundSurfacesViewFactor(EnergyPlusData &state, int const SurfNum) { - // resets ground veiew factors based on view factors identity + // resets ground view factors based on view factors identity // the ground view factor value is set to the first element // when the ground view factor input field is blank @@ -9764,8 +9762,7 @@ void GetSurroundingSurfacesTemperatureAverage(EnergyPlusData &state) Real64 SrdSurfaceTempSum = 0.0; auto &SrdSurfsProperty = state.dataSurface->SurroundingSurfsProperty(surface.SurfSurroundingSurfacesNum); for (int SrdSurfNum = 1; SrdSurfNum <= SrdSurfsProperty.TotSurroundingSurface; SrdSurfNum++) { - SrdSurfaceTemp = - ScheduleManager::GetCurrentScheduleValue(state, SrdSurfsProperty.SurroundingSurfs(SrdSurfNum).TempSchNum) + Constant::Kelvin; + SrdSurfaceTemp = SrdSurfsProperty.SurroundingSurfs(SrdSurfNum).tempSched->getCurrentVal() + Constant::Kelvin; SrdSurfaceTempSum += SrdSurfsProperty.SurroundingSurfs(SrdSurfNum).ViewFactor * pow_4(SrdSurfaceTemp); } surface.SrdSurfTemp = root_4(SrdSurfaceTempSum / surface.ViewFactorSrdSurfs) - Constant::Kelvin; diff --git a/src/EnergyPlus/HeatBalanceSurfaceManager.hh b/src/EnergyPlus/HeatBalanceSurfaceManager.hh index caaef860db2..ea61f94eb0e 100644 --- a/src/EnergyPlus/HeatBalanceSurfaceManager.hh +++ b/src/EnergyPlus/HeatBalanceSurfaceManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -236,9 +236,6 @@ struct HeatBalSurfMgr : BaseGlobalStruct Array2D DiffuseArray; - Real64 curQL = 0.0; // radiant value prior to adjustment for pulse for load component report - Real64 adjQL = 0.0; // radiant value including adjustment for pulse for load component report - bool ManageSurfaceHeatBalancefirstTime = true; bool InitSurfaceHeatBalancefirstTime = true; bool UpdateThermalHistoriesFirstTimeFlag = true; @@ -267,6 +264,10 @@ struct HeatBalSurfMgr : BaseGlobalStruct Array1D AbsDiffWinSky = Array1D(DataWindowEquivalentLayer::CFSMAXNL); // Sky diffuse solar absorptance of glass layers //Tuned Made static + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } @@ -286,8 +287,6 @@ struct HeatBalSurfMgr : BaseGlobalStruct ZoneAESum.clear(); DiffuseArray.clear(); - curQL = 0.0; - adjQL = 0.0; ManageSurfaceHeatBalancefirstTime = true; InitSurfaceHeatBalancefirstTime = true; diff --git a/src/EnergyPlus/HeatPumpWaterToWaterCOOLING.cc b/src/EnergyPlus/HeatPumpWaterToWaterCOOLING.cc index db7141f1015..6ac9e281ccb 100644 --- a/src/EnergyPlus/HeatPumpWaterToWaterCOOLING.cc +++ b/src/EnergyPlus/HeatPumpWaterToWaterCOOLING.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -181,6 +181,7 @@ void GetGshpInput(EnergyPlusData &state) // information from the input file, count the number of // GSHPs and begin to fill the // arrays associated with the typeGSHP. + static constexpr std::string_view routineName = "GetGshpInput"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int GSHPNum; // Gshp counter @@ -206,6 +207,8 @@ void GetGshpInput(EnergyPlusData &state) auto &thisGSHP = state.dataHPWaterToWaterClg->GSHP(GSHPNum); state.dataInputProcessing->inputProcessor->getObjectItem(state, ModuleCompNameUC, GSHPNum, AlphArray, NumAlphas, NumArray, NumNums, IOStat); + ErrorObjectHeader eoh{routineName, ModuleCompNameUC, AlphArray(1)}; + thisGSHP.Name = AlphArray(1); thisGSHP.WWHPPlantTypeOfNum = DataPlant::PlantEquipmentType::HPWaterPECooling; @@ -353,18 +356,17 @@ void GetGshpInput(EnergyPlusData &state) thisGSHP.LoadSideWaterMassFlowRate = 0.0; thisGSHP.IsOn = false; thisGSHP.MustRun = true; + + if ((thisGSHP.refrig = Fluid::GetRefrig(state, GSHPRefrigerant)) == nullptr) { + ShowSevereItemNotFound(state, eoh, "Refrigerant", GSHPRefrigerant); + ErrorsFound = true; + } } if (ErrorsFound) { ShowFatalError(state, "Errors Found in getting Gshp input"); } - state.dataHPWaterToWaterClg->GSHPRefrigIndex = FluidProperties::GetRefrigNum(state, GSHPRefrigerant); - if (state.dataHPWaterToWaterClg->GSHPRefrigIndex == 0) { - ShowFatalError(state, format("Refrigerant for {} not found, should have been={}", ModuleCompName, GSHPRefrigerant)); - ShowFatalError(state, format("FluidProperties:* objects for {} must be included in the idf file.", GSHPRefrigerant)); - } - // CurrentModuleObject='HeatPump:WaterToWater:ParameterEstimation:Cooling' for (GSHPNum = 1; GSHPNum <= state.dataHPWaterToWaterClg->NumGSHPs; ++GSHPNum) { auto &thisGSHP = state.dataHPWaterToWaterClg->GSHP(GSHPNum); @@ -489,20 +491,12 @@ void GshpPeCoolingSpecs::initialize(EnergyPlusData &state) this->MustRun = true; this->beginEnvironFlag = false; - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); this->LoadSideDesignMassFlow = this->LoadSideVolFlowRate * rho; PlantUtilities::InitComponentNodes(state, 0.0, this->LoadSideDesignMassFlow, this->LoadSideInletNodeNum, this->LoadSideOutletNodeNum); - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); this->SourceSideDesignMassFlow = this->SourceSideVolFlowRate * rho; PlantUtilities::InitComponentNodes(state, 0.0, this->SourceSideDesignMassFlow, this->SourceSideInletNodeNum, this->SourceSideOutletNodeNum); @@ -660,17 +654,10 @@ void GshpPeCoolingSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad) initialQLoad = 0.0; IterationCount = 0; - CpSourceSide = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName, - this->SourceSideWaterInletTemp, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex, - RoutineName); + CpSourceSide = + state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).glycol->getSpecificHeat(state, this->SourceSideWaterInletTemp, RoutineName); - CpLoadSide = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName, - this->LoadSideWaterInletTemp, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex, - RoutineName); + CpLoadSide = state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).glycol->getSpecificHeat(state, this->LoadSideWaterInletTemp, RoutineName); // Determine effectiveness of Load Side LoadSideEffect = 1.0 - std::exp(-this->LoadSideUACoeff / (CpLoadSide * this->LoadSideWaterMassFlowRate)); @@ -689,10 +676,8 @@ void GshpPeCoolingSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad) this->SourceSideWaterInletTemp + initialQSource / (SourceSideEffect * CpSourceSide * this->SourceSideWaterMassFlowRate); // Determine the evaporating and condensing pressures - SourceSidePressure = FluidProperties::GetSatPressureRefrig( - state, GSHPRefrigerant, SourceSideRefridgTemp, state.dataHPWaterToWaterClg->GSHPRefrigIndex, RoutineName); - LoadSidePressure = FluidProperties::GetSatPressureRefrig( - state, GSHPRefrigerant, LoadSideRefridgTemp, state.dataHPWaterToWaterClg->GSHPRefrigIndex, RoutineName); + SourceSidePressure = this->refrig->getSatPressure(state, SourceSideRefridgTemp, RoutineName); + LoadSidePressure = this->refrig->getSatPressure(state, LoadSideRefridgTemp, RoutineName); if (SourceSidePressure < this->LowPressCutoff) { ShowSevereError(state, format("{}=\"{}\" Cooling Source Side Pressure Less than the Design Minimum", ModuleCompName, this->Name)); @@ -738,20 +723,17 @@ void GshpPeCoolingSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad) // Determine the Source Side Outlet Enthalpy qual = 1.0; - LoadSideOutletEnth = FluidProperties::GetSatEnthalpyRefrig( - state, GSHPRefrigerant, LoadSideRefridgTemp, qual, state.dataHPWaterToWaterClg->GSHPRefrigIndex, RoutineNameLoadSideRefridgTemp); + LoadSideOutletEnth = this->refrig->getSatEnthalpy(state, LoadSideRefridgTemp, qual, RoutineNameLoadSideRefridgTemp); qual = 0.0; - SourceSideOutletEnth = FluidProperties::GetSatEnthalpyRefrig( - state, GSHPRefrigerant, SourceSideRefridgTemp, qual, state.dataHPWaterToWaterClg->GSHPRefrigIndex, RoutineNameSourceSideRefridgTemp); + SourceSideOutletEnth = this->refrig->getSatEnthalpy(state, SourceSideRefridgTemp, qual, RoutineNameSourceSideRefridgTemp); // Determine Load Side Outlet Enthalpy // Determine superheated temperature of the LoadSide outlet/compressor inlet CompressInletTemp = LoadSideRefridgTemp + this->SuperheatTemp; // Determine the enathalpy of the super heated fluid at Source Side outlet - SuperHeatEnth = FluidProperties::GetSupHeatEnthalpyRefrig( - state, GSHPRefrigerant, CompressInletTemp, LoadSidePressure, state.dataHPWaterToWaterClg->GSHPRefrigIndex, RoutineNameCompressInletTemp); + SuperHeatEnth = this->refrig->getSupHeatEnthalpy(state, CompressInletTemp, LoadSidePressure, RoutineNameCompressInletTemp); // Determining the suction state of the fluid from inlet state involves interation // Method employed... @@ -759,8 +741,7 @@ void GshpPeCoolingSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad) // check that with the inlet enthalpy ( as suction loss is isenthalpic). Iterate till desired accuracy is reached // this routine was reenginerred from HVACsim + takes pressure in Pascals, tolrance, refrgerant # R22 =6 - CompSuctionSatTemp = FluidProperties::GetSatTemperatureRefrig( - state, GSHPRefrigerant, SuctionPr, state.dataHPWaterToWaterClg->GSHPRefrigIndex, RoutineNameSuctionPr); + CompSuctionSatTemp = this->refrig->getSatTemperature(state, SuctionPr, RoutineNameSuctionPr); T110 = CompSuctionSatTemp; // Shoot into the super heated region @@ -769,8 +750,7 @@ void GshpPeCoolingSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad) while (true) { CompSuctionTemp = 0.5 * (T110 + T111); - CompSuctionEnth = FluidProperties::GetSupHeatEnthalpyRefrig( - state, GSHPRefrigerant, CompSuctionTemp, SuctionPr, state.dataHPWaterToWaterClg->GSHPRefrigIndex, RoutineNameCompSuctionTemp); + CompSuctionEnth = this->refrig->getSupHeatEnthalpy(state, CompSuctionTemp, SuctionPr, RoutineNameCompSuctionTemp); if (std::abs(CompSuctionEnth - SuperHeatEnth) / SuperHeatEnth < 0.0001) { goto LOOP_exit; @@ -785,8 +765,7 @@ void GshpPeCoolingSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad) LOOP_exit:; // Determine the Mass flow rate of refrigerant - CompSuctionDensity = FluidProperties::GetSupHeatDensityRefrig( - state, GSHPRefrigerant, CompSuctionTemp, SuctionPr, state.dataHPWaterToWaterClg->GSHPRefrigIndex, RoutineNameCompSuctionTemp); + CompSuctionDensity = this->refrig->getSupHeatDensity(state, CompSuctionTemp, SuctionPr, RoutineNameCompSuctionTemp); MassRef = this->CompPistonDisp * CompSuctionDensity * (1 + this->CompClearanceFactor - this->CompClearanceFactor * std::pow(DischargePr / SuctionPr, 1 / gamma)); diff --git a/src/EnergyPlus/HeatPumpWaterToWaterCOOLING.hh b/src/EnergyPlus/HeatPumpWaterToWaterCOOLING.hh index 257dff06e0a..727a671da79 100644 --- a/src/EnergyPlus/HeatPumpWaterToWaterCOOLING.hh +++ b/src/EnergyPlus/HeatPumpWaterToWaterCOOLING.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -70,6 +70,8 @@ namespace HeatPumpWaterToWaterCOOLING { // Members std::string Name; // user identifier DataPlant::PlantEquipmentType WWHPPlantTypeOfNum; + + Fluid::RefrigProps *refrig = nullptr; bool Available; // need an array of logicals--load identifiers of available equipment bool ON; // simulate the machine at it's operating part load ratio Real64 COP; // Coefficient of Performance of the machine @@ -170,10 +172,13 @@ struct HeatPumpWaterToWaterCOOLINGData : BaseGlobalStruct { int NumGSHPs = 0; - int GSHPRefrigIndex = 0; bool GetWWHPCoolingInput = true; Array1D GSHP; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } @@ -181,7 +186,6 @@ struct HeatPumpWaterToWaterCOOLINGData : BaseGlobalStruct void clear_state() override { this->NumGSHPs = 0; - this->GSHPRefrigIndex = 0; this->GetWWHPCoolingInput = true; this->GSHP.deallocate(); } diff --git a/src/EnergyPlus/HeatPumpWaterToWaterHEATING.cc b/src/EnergyPlus/HeatPumpWaterToWaterHEATING.cc index b2448cc8586..e1b369940b2 100644 --- a/src/EnergyPlus/HeatPumpWaterToWaterHEATING.cc +++ b/src/EnergyPlus/HeatPumpWaterToWaterHEATING.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -186,6 +186,7 @@ void GetGshpInput(EnergyPlusData &state) // GSHPs and begin to fill the // arrays associated with the type GSHP. + static constexpr std::string_view routineName = "GetGshpInput"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumAlphas; // Number of elements in the alpha array int NumNums; // Number of elements in the numeric array @@ -209,6 +210,8 @@ void GetGshpInput(EnergyPlusData &state) auto &thisGSHP = state.dataHPWaterToWaterHtg->GSHP(GSHPNum); state.dataInputProcessing->inputProcessor->getObjectItem(state, ModuleCompNameUC, GSHPNum, AlphArray, NumAlphas, NumArray, NumNums, IOStat); + ErrorObjectHeader eoh{routineName, ModuleCompNameUC, AlphArray(1)}; + thisGSHP.Name = AlphArray(1); thisGSHP.WWHPPlantType = DataPlant::PlantEquipmentType::HPWaterPEHeating; @@ -343,17 +346,17 @@ void GetGshpInput(EnergyPlusData &state) // save the design source side flow rate for use by plant loop sizing algorithms PlantUtilities::RegisterPlantCompDesignFlow(state, thisGSHP.SourceSideInletNodeNum, 0.5 * thisGSHP.SourceSideVolFlowRate); + + if ((thisGSHP.refrig = Fluid::GetRefrig(state, GSHPRefrigerant)) == nullptr) { + ShowSevereItemNotFound(state, eoh, "Refrigerant", GSHPRefrigerant); + ErrorsFound = true; + } } if (ErrorsFound) { ShowFatalError(state, format("Errors Found in getting {} Input", ModuleCompNameUC)); } - state.dataHPWaterToWaterHtg->GSHPRefrigIndex = FluidProperties::GetRefrigNum(state, GSHPRefrigerant); - if (state.dataHPWaterToWaterHtg->GSHPRefrigIndex == 0) { - ShowFatalError(state, format("Refrigerant for {} not found, should have been={}", ModuleCompName, GSHPRefrigerant)); - } - // CurrentModuleObject='HeatPump:WaterToWater:ParameterEstimation:Heating' for (int GSHPNum = 1; GSHPNum <= state.dataHPWaterToWaterHtg->NumGSHPs; ++GSHPNum) { auto &thisGSHP = state.dataHPWaterToWaterHtg->GSHP(GSHPNum); @@ -479,20 +482,12 @@ void GshpPeHeatingSpecs::initialize(EnergyPlusData &state) this->MustRun = true; this->beginEnvironFlag = false; - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); this->LoadSideDesignMassFlow = this->LoadSideVolFlowRate * rho; PlantUtilities::InitComponentNodes(state, 0.0, this->LoadSideDesignMassFlow, this->LoadSideInletNodeNum, this->LoadSideOutletNodeNum); - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); this->SourceSideDesignMassFlow = this->SourceSideVolFlowRate * rho; PlantUtilities::InitComponentNodes(state, 0.0, this->SourceSideDesignMassFlow, this->SourceSideInletNodeNum, this->SourceSideOutletNodeNum); @@ -613,17 +608,11 @@ void GshpPeHeatingSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad) Real64 initialQLoad = 0.0; int IterationCount = 0; - Real64 CpSourceSide = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName, - this->SourceSideWaterInletTemp, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpSourceSide = + state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).glycol->getSpecificHeat(state, this->SourceSideWaterInletTemp, RoutineName); - Real64 CpLoadSide = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName, - this->LoadSideWaterInletTemp, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpLoadSide = + state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).glycol->getSpecificHeat(state, this->LoadSideWaterInletTemp, RoutineName); // Determine effectiveness of Source Side (the Evaporator in heating mode) Real64 SourceSideEffect = 1.0 - std::exp(-this->SourceSideUACoeff / (CpSourceSide * this->SourceSideWaterMassFlowRate)); @@ -640,10 +629,8 @@ void GshpPeHeatingSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad) Real64 LoadSideTemp = this->LoadSideWaterInletTemp + initialQLoad / (LoadSideEffect * CpLoadSide * this->LoadSideWaterMassFlowRate); // Determine the evaporating and condensing pressures - Real64 SourceSidePressure = FluidProperties::GetSatPressureRefrig( - state, GSHPRefrigerant, SourceSideTemp, state.dataHPWaterToWaterHtg->GSHPRefrigIndex, RoutineNameSourceSideTemp); - Real64 LoadSidePressure = FluidProperties::GetSatPressureRefrig( - state, GSHPRefrigerant, LoadSideTemp, state.dataHPWaterToWaterHtg->GSHPRefrigIndex, RoutineNameLoadSideTemp); + Real64 SourceSidePressure = this->refrig->getSatPressure(state, SourceSideTemp, RoutineNameSourceSideTemp); + Real64 LoadSidePressure = this->refrig->getSatPressure(state, LoadSideTemp, RoutineNameLoadSideTemp); // check cutoff pressures if (SourceSidePressure < this->LowPressCutoff) { @@ -682,31 +669,23 @@ void GshpPeHeatingSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad) // Determine the Source Side Outlet Enthalpy Real64 qualOne = 1.0; - Real64 SourceSideOutletEnth = FluidProperties::GetSatEnthalpyRefrig( - state, GSHPRefrigerant, SourceSideTemp, qualOne, state.dataHPWaterToWaterHtg->GSHPRefrigIndex, RoutineNameSourceSideTemp); + Real64 SourceSideOutletEnth = this->refrig->getSatEnthalpy(state, SourceSideTemp, qualOne, RoutineNameSourceSideTemp); // Determine Load Side Outlet Enthalpy Real64 qualZero = 0.0; - Real64 LoadSideOutletEnth = FluidProperties::GetSatEnthalpyRefrig( - state, GSHPRefrigerant, LoadSideTemp, qualZero, state.dataHPWaterToWaterHtg->GSHPRefrigIndex, RoutineNameLoadSideTemp); + Real64 LoadSideOutletEnth = this->refrig->getSatEnthalpy(state, LoadSideTemp, qualZero, RoutineNameLoadSideTemp); // Determine superheated temperature of the Source Side outlet/compressor inlet Real64 CompressInletTemp = SourceSideTemp + this->SuperheatTemp; // Determine the enathalpy of the super heated fluid at Source Side outlet - Real64 SuperHeatEnth = FluidProperties::GetSupHeatEnthalpyRefrig(state, - GSHPRefrigerant, - CompressInletTemp, - SourceSidePressure, - state.dataHPWaterToWaterHtg->GSHPRefrigIndex, - RoutineNameCompressInletTemp); + Real64 SuperHeatEnth = this->refrig->getSupHeatEnthalpy(state, CompressInletTemp, SourceSidePressure, RoutineNameCompressInletTemp); // Determining the suction state of the fluid from inlet state involves interation // Method employed... // Determine the saturated temp at suction pressure, shoot out into the superheated region find the enthalpy // check that with the inlet enthalpy ( as suction loss is isenthalpic). Iterate till desired accuracy is reached - CompSuctionSatTemp = FluidProperties::GetSatTemperatureRefrig( - state, GSHPRefrigerant, SuctionPr, state.dataHPWaterToWaterHtg->GSHPRefrigIndex, RoutineNameSuctionPr); + CompSuctionSatTemp = this->refrig->getSatTemperature(state, SuctionPr, RoutineNameSuctionPr); Real64 T110 = CompSuctionSatTemp; // Shoot into the super heated region @@ -716,8 +695,7 @@ void GshpPeHeatingSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad) while (true) { CompSuctionTemp = 0.5 * (T110 + T111); - CompSuctionEnth = FluidProperties::GetSupHeatEnthalpyRefrig( - state, GSHPRefrigerant, CompSuctionTemp, SuctionPr, state.dataHPWaterToWaterHtg->GSHPRefrigIndex, RoutineNameCompSuctionTemp); + CompSuctionEnth = this->refrig->getSupHeatEnthalpy(state, CompSuctionTemp, SuctionPr, RoutineNameCompSuctionTemp); if (std::abs(CompSuctionEnth - SuperHeatEnth) / SuperHeatEnth < 0.0001) { break; } @@ -730,8 +708,7 @@ void GshpPeHeatingSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad) } // Determine the Mass flow rate of refrigerant - CompSuctionDensity = FluidProperties::GetSupHeatDensityRefrig( - state, GSHPRefrigerant, CompSuctionTemp, SuctionPr, state.dataHPWaterToWaterHtg->GSHPRefrigIndex, RoutineNameCompSuctionTemp); + CompSuctionDensity = this->refrig->getSupHeatDensity(state, CompSuctionTemp, SuctionPr, RoutineNameCompSuctionTemp); Real64 MassRef = this->CompPistonDisp * CompSuctionDensity * (1.0 + this->CompClearanceFactor - this->CompClearanceFactor * std::pow(DischargePr / SuctionPr, 1.0 / gamma)); diff --git a/src/EnergyPlus/HeatPumpWaterToWaterHEATING.hh b/src/EnergyPlus/HeatPumpWaterToWaterHEATING.hh index d431aa8535b..2f0d28256ee 100644 --- a/src/EnergyPlus/HeatPumpWaterToWaterHEATING.hh +++ b/src/EnergyPlus/HeatPumpWaterToWaterHEATING.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -70,29 +70,31 @@ namespace HeatPumpWaterToWaterHEATING { // Members std::string Name; // user identifier DataPlant::PlantEquipmentType WWHPPlantType; // equipment type num - bool Available; // need an array of logicals--load identifiers of available equipment - bool ON; // simulate the machine at it's operating part load ratio - Real64 COP; // Coefficient of Performance of the machine - Real64 NomCap; // Nominal Capacity of the HeatPump - Real64 MinPartLoadRat; // Minimum operating Part Load Ratio - Real64 MaxPartLoadRat; // Maximum operating Part Load Ratio - Real64 OptPartLoadRat; // Optimal operating Part Load Ratio - Real64 LoadSideVolFlowRate; // Design Flow Rate on the Load side m3/sec - Real64 LoadSideDesignMassFlow; // Design flow rate (kg/s) - Real64 SourceSideVolFlowRate; // Design Flow Rate on th Source Side m3/sec - Real64 SourceSideDesignMassFlow; // Design flow rate (kg/s) - int SourceSideInletNodeNum; // Node number on the inlet side of the plant - int SourceSideOutletNodeNum; // Node number on the outlet side of the plant - int LoadSideInletNodeNum; // Node number on the inlet side of the Load Side - int LoadSideOutletNodeNum; // Node number on the outlet side of the Load Side - Real64 SourceSideUACoeff; // Source Side heat transfer coeff W/K - Real64 LoadSideUACoeff; // Load Side heat transfer coeff W/K - Real64 CompPistonDisp; // compressor piston displacement m3 - Real64 CompClearanceFactor; // compressor clearance factor - Real64 CompSucPressDrop; // deltap , compressor suction and discharge pressure drop Pascals - Real64 SuperheatTemp; // deltatsh , super heating °C - Real64 PowerLosses; // constant part of electro mechanical power losses watts Joules/sec - Real64 LossFactor; // loss factor used ot define the electro mechanical + + Fluid::RefrigProps *refrig = nullptr; + bool Available; // need an array of logicals--load identifiers of available equipment + bool ON; // simulate the machine at it's operating part load ratio + Real64 COP; // Coefficient of Performance of the machine + Real64 NomCap; // Nominal Capacity of the HeatPump + Real64 MinPartLoadRat; // Minimum operating Part Load Ratio + Real64 MaxPartLoadRat; // Maximum operating Part Load Ratio + Real64 OptPartLoadRat; // Optimal operating Part Load Ratio + Real64 LoadSideVolFlowRate; // Design Flow Rate on the Load side m3/sec + Real64 LoadSideDesignMassFlow; // Design flow rate (kg/s) + Real64 SourceSideVolFlowRate; // Design Flow Rate on th Source Side m3/sec + Real64 SourceSideDesignMassFlow; // Design flow rate (kg/s) + int SourceSideInletNodeNum; // Node number on the inlet side of the plant + int SourceSideOutletNodeNum; // Node number on the outlet side of the plant + int LoadSideInletNodeNum; // Node number on the inlet side of the Load Side + int LoadSideOutletNodeNum; // Node number on the outlet side of the Load Side + Real64 SourceSideUACoeff; // Source Side heat transfer coeff W/K + Real64 LoadSideUACoeff; // Load Side heat transfer coeff W/K + Real64 CompPistonDisp; // compressor piston displacement m3 + Real64 CompClearanceFactor; // compressor clearance factor + Real64 CompSucPressDrop; // deltap , compressor suction and discharge pressure drop Pascals + Real64 SuperheatTemp; // deltatsh , super heating °C + Real64 PowerLosses; // constant part of electro mechanical power losses watts Joules/sec + Real64 LossFactor; // loss factor used ot define the electro mechanical // loss that is supposed to be proportional to the theoretical power Real64 HighPressCutoff; // Maximum Design Pressure on the Load Side Pascals Real64 LowPressCutoff; // Minimum Design Pressure on the Source Side Pascals @@ -166,18 +168,20 @@ namespace HeatPumpWaterToWaterHEATING { struct HeatPumpWaterToWaterHEATINGData : BaseGlobalStruct { - int GSHPRefrigIndex = 0; int NumGSHPs = 0; bool GetWWHPHeatingInput = true; Array1D GSHP; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } void clear_state() override { - this->GSHPRefrigIndex = 0; this->NumGSHPs = 0; this->GetWWHPHeatingInput = true; this->GSHP.deallocate(); diff --git a/src/EnergyPlus/HeatPumpWaterToWaterSimple.cc b/src/EnergyPlus/HeatPumpWaterToWaterSimple.cc index ec365e8c315..696375a7094 100644 --- a/src/EnergyPlus/HeatPumpWaterToWaterSimple.cc +++ b/src/EnergyPlus/HeatPumpWaterToWaterSimple.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -729,30 +729,14 @@ void GshpSpecs::InitWatertoWaterHP(EnergyPlusData &state, this->MustRun = true; if (this->WWHPType == DataPlant::PlantEquipmentType::HPWaterEFHeating) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); this->LoadSideDesignMassFlow = this->RatedLoadVolFlowHeat * rho; - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); this->SourceSideDesignMassFlow = this->RatedSourceVolFlowHeat * rho; } else if (this->WWHPType == DataPlant::PlantEquipmentType::HPWaterEFCooling) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); this->LoadSideDesignMassFlow = this->RatedLoadVolFlowCool * rho; - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); this->SourceSideDesignMassFlow = this->RatedSourceVolFlowCool * rho; } @@ -806,7 +790,7 @@ void GshpSpecs::InitWatertoWaterHP(EnergyPlusData &state, state, this->reportLoadSideMassFlowRate, this->LoadSideInletNodeNum, this->LoadSideOutletNodeNum, this->LoadPlantLoc); PlantUtilities::SetComponentFlowRate( state, this->reportSourceSideMassFlowRate, this->SourceSideInletNodeNum, this->SourceSideOutletNodeNum, this->SourcePlantLoc); - // if there's no flowin one, turn the entire "heat pump off" + // if there's no flowing one, turn the entire "heat pump off" if (this->reportLoadSideMassFlowRate <= 0.0 || this->reportSourceSideMassFlowRate <= 0.0) { this->reportLoadSideMassFlowRate = 0.0; @@ -881,29 +865,13 @@ void GshpSpecs::sizeCoolingWaterToWaterHP(EnergyPlusData &state) // store flow rate right away regardless of PlantFirstSizesOkayToFinalize so that data are available this->RatedLoadVolFlowCool = tmpLoadSideVolFlowRate; } - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex, - RoutineName); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).glycol->getSpecificHeat(state, Constant::CWInitConvTemp, RoutineName); tmpCoolingCap = Cp * rho * state.dataSize->PlantSizData(pltLoadSizNum).DeltaT * tmpLoadSideVolFlowRate; } else if (this->companionIdentified && this->RatedLoadVolFlowHeat > 0.0) { tmpLoadSideVolFlowRate = this->RatedLoadVolFlowHeat; - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex, - RoutineName); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).glycol->getSpecificHeat(state, Constant::CWInitConvTemp, RoutineName); tmpCoolingCap = Cp * rho * state.dataSize->PlantSizData(pltLoadSizNum).DeltaT * tmpLoadSideVolFlowRate; } else { if (this->ratedCapCoolWasAutoSized) tmpCoolingCap = 0.0; @@ -1069,16 +1037,8 @@ void GshpSpecs::sizeCoolingWaterToWaterHP(EnergyPlusData &state) if (!this->ratedLoadVolFlowCoolWasAutoSized) tmpLoadSideVolFlowRate = this->RatedLoadVolFlowCool; int pltSourceSizNum = state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).PlantSizNum; if (pltSourceSizNum > 0) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex, - RoutineName); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).glycol->getSpecificHeat(state, Constant::CWInitConvTemp, RoutineName); tmpSourceSideVolFlowRate = tmpCoolingCap * (1.0 + (1.0 / this->refCOP)) / (state.dataSize->PlantSizData(pltSourceSizNum).DeltaT * Cp * rho); } else { tmpSourceSideVolFlowRate = tmpLoadSideVolFlowRate; // set source side flow equal to load side flow, assumption @@ -1237,29 +1197,13 @@ void GshpSpecs::sizeHeatingWaterToWaterHP(EnergyPlusData &state) // PlantFirstSizesOkayToFinalize is true this->RatedLoadVolFlowHeat = tmpLoadSideVolFlowRate; } - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex, - RoutineName); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).glycol->getSpecificHeat(state, Constant::HWInitConvTemp, RoutineName); tmpHeatingCap = Cp * rho * state.dataSize->PlantSizData(pltLoadSizNum).DeltaT * tmpLoadSideVolFlowRate; } else if (this->companionIdentified && this->RatedLoadVolFlowCool > 0.0) { tmpLoadSideVolFlowRate = this->RatedLoadVolFlowCool; - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex, - RoutineName); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).glycol->getSpecificHeat(state, Constant::HWInitConvTemp, RoutineName); tmpHeatingCap = Cp * rho * state.dataSize->PlantSizData(pltLoadSizNum).DeltaT * tmpLoadSideVolFlowRate; } else { if (this->ratedCapHeatWasAutoSized) tmpHeatingCap = 0.0; @@ -1424,16 +1368,8 @@ void GshpSpecs::sizeHeatingWaterToWaterHP(EnergyPlusData &state) if (!this->ratedLoadVolFlowHeatWasAutoSized) tmpLoadSideVolFlowRate = this->RatedLoadVolFlowHeat; int pltSourceSizNum = state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).PlantSizNum; if (pltSourceSizNum > 0) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex, - RoutineName); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).glycol->getSpecificHeat(state, Constant::HWInitConvTemp, RoutineName); tmpSourceSideVolFlowRate = tmpHeatingCap * (1.0 - (1.0 / this->refCOP)) / (state.dataSize->PlantSizData(pltSourceSizNum).DeltaT * Cp * rho); } else { tmpSourceSideVolFlowRate = tmpLoadSideVolFlowRate; // set source side flow equal to load side flow, assumption @@ -1565,7 +1501,7 @@ void GshpSpecs::CalcWatertoWaterHPCooling(EnergyPlusData &state, Real64 const My // RE-ENGINEERED // PURPOSE OF THIS SUBROUTINE: - // This routine simulate the heat pump peformance in cooling mode + // This routine simulate the heat pump performance in cooling mode // REFERENCES: // (1) Tang,C.C.. 2005. Modeling Packaged Heat Pumps in a Quasi-Steady @@ -1622,17 +1558,9 @@ void GshpSpecs::CalcWatertoWaterHPCooling(EnergyPlusData &state, Real64 const My return; } - rhoLoadSide = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName, - LoadSideInletTemp, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex, - RoutineName); + rhoLoadSide = state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).glycol->getDensity(state, LoadSideInletTemp, RoutineName); - rhoSourceSide = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName, - SourceSideInletTemp, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex, - RoutineName); + rhoSourceSide = state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).glycol->getDensity(state, SourceSideInletTemp, RoutineName); func1 = ((LoadSideInletTemp + CelsiustoKelvin) / Tref); func2 = ((SourceSideInletTemp + CelsiustoKelvin) / Tref); @@ -1697,17 +1625,9 @@ void GshpSpecs::CalcWatertoWaterHPCooling(EnergyPlusData &state, Real64 const My QSource *= PartLoadRatio; } - CpLoadSide = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName, - LoadSideInletTemp, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex, - RoutineName); + CpLoadSide = state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).glycol->getSpecificHeat(state, LoadSideInletTemp, RoutineName); - CpSourceSide = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName, - SourceSideInletTemp, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex, - RoutineName); + CpSourceSide = state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).glycol->getSpecificHeat(state, SourceSideInletTemp, RoutineName); LoadSideOutletTemp = LoadSideInletTemp - QLoad / (LoadSideMassFlowRate * CpLoadSide); SourceSideOutletTemp = SourceSideInletTemp + QSource / (SourceSideMassFlowRate * CpSourceSide); @@ -1731,7 +1651,7 @@ void GshpSpecs::CalcWatertoWaterHPHeating(EnergyPlusData &state, Real64 const My // RE-ENGINEERED // PURPOSE OF THIS SUBROUTINE: - // This routine simulate the heat pump peformance in heating mode + // This routine simulate the heat pump performance in heating mode // REFERENCES: // (1) Tang,C.C.. 2005. Modeling Packaged Heat Pumps in a Quasi-Steady @@ -1786,17 +1706,9 @@ void GshpSpecs::CalcWatertoWaterHPHeating(EnergyPlusData &state, Real64 const My if (!this->MustRun) { return; } - rhoLoadSide = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName, - LoadSideInletTemp, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex, - RoutineName); - - rhoSourceSide = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName, - SourceSideInletTemp, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex, - RoutineName); + rhoLoadSide = state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).glycol->getDensity(state, LoadSideInletTemp, RoutineName); + + rhoSourceSide = state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).glycol->getDensity(state, SourceSideInletTemp, RoutineName); func1 = ((LoadSideInletTemp + CelsiustoKelvin) / Tref); func2 = ((SourceSideInletTemp + CelsiustoKelvin) / Tref); @@ -1860,17 +1772,9 @@ void GshpSpecs::CalcWatertoWaterHPHeating(EnergyPlusData &state, Real64 const My QSource *= PartLoadRatio; } - CpLoadSide = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidName, - LoadSideInletTemp, - state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).FluidIndex, - RoutineName); - - CpSourceSide = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidName, - SourceSideInletTemp, - state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).FluidIndex, - RoutineName); + CpLoadSide = state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).glycol->getSpecificHeat(state, LoadSideInletTemp, RoutineName); + + CpSourceSide = state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).glycol->getSpecificHeat(state, SourceSideInletTemp, RoutineName); LoadSideOutletTemp = LoadSideInletTemp + QLoad / (LoadSideMassFlowRate * CpLoadSide); SourceSideOutletTemp = SourceSideInletTemp - QSource / (SourceSideMassFlowRate * CpSourceSide); diff --git a/src/EnergyPlus/HeatPumpWaterToWaterSimple.hh b/src/EnergyPlus/HeatPumpWaterToWaterSimple.hh index 868eb95b4c1..5581e466aa9 100644 --- a/src/EnergyPlus/HeatPumpWaterToWaterSimple.hh +++ b/src/EnergyPlus/HeatPumpWaterToWaterSimple.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -210,6 +210,10 @@ struct HeatPumpWaterToWaterSimpleData : BaseGlobalStruct Array1D GSHP; std::unordered_map HeatPumpWaterUniqueNames; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/HeatRecovery.cc b/src/EnergyPlus/HeatRecovery.cc index 7fcd2cf1432..f2b98a7a1ce 100644 --- a/src/EnergyPlus/HeatRecovery.cc +++ b/src/EnergyPlus/HeatRecovery.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -249,6 +249,7 @@ namespace HeatRecovery { int IOStatus; // Used in GetObjectItem bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine constexpr std::string_view RoutineName = "GetHeatRecoveryInput: "; // include trailing blank space + constexpr std::string_view routineName = "GetHeatRecoveryInput"; auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; int NumAirToAirPlateExchs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "HeatExchanger:AirToAir:FlatPlate"); @@ -283,6 +284,8 @@ namespace HeatRecovery { state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; int const ExchNum = ExchIndex; auto &thisExchanger = state.dataHeatRecovery->ExchCond(ExchNum); thisExchanger.NumericFieldNames.allocate(NumNumbers); @@ -298,20 +301,10 @@ namespace HeatRecovery { thisExchanger.Name = state.dataIPShortCut->cAlphaArgs(1); thisExchanger.type = HVAC::HXType::AirToAir_FlatPlate; if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { - thisExchanger.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisExchanger.SchedPtr = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); - if (thisExchanger.SchedPtr == 0) { - ShowSevereError(state, - format("{}{}: invalid {} entered ={} for {}={}", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2), - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1))); - ErrorsFound = true; - } + thisExchanger.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisExchanger.availSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2)); + ErrorsFound = true; } constexpr std::array(HXConfiguration::Num)> hxConfigurationNamesUC = { @@ -400,6 +393,8 @@ namespace HeatRecovery { state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; int const ExchNum = ExchIndex + NumAirToAirPlateExchs; auto &thisExchanger = state.dataHeatRecovery->ExchCond(ExchNum); thisExchanger.NumericFieldNames.allocate(NumNumbers); @@ -415,20 +410,10 @@ namespace HeatRecovery { thisExchanger.Name = state.dataIPShortCut->cAlphaArgs(1); thisExchanger.type = HVAC::HXType::AirToAir_Generic; if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { - thisExchanger.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisExchanger.SchedPtr = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); - if (thisExchanger.SchedPtr == 0) { - ShowSevereError(state, - format("{}{}: invalid {} entered ={} for {}={}", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2), - state.dataIPShortCut->cAlphaFieldNames(1), - thisExchanger.Name)); - ErrorsFound = true; - } + thisExchanger.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisExchanger.availSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2)); + ErrorsFound = true; } thisExchanger.NomSupAirVolFlow = state.dataIPShortCut->rNumericArgs(1); thisExchanger.HeatEffectSensible100 = state.dataIPShortCut->rNumericArgs(2); @@ -550,6 +535,9 @@ namespace HeatRecovery { state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + int const ExchNum = ExchIndex + NumAirToAirPlateExchs + NumAirToAirGenericExchs; auto &thisExchanger = state.dataHeatRecovery->ExchCond(ExchNum); thisExchanger.NumericFieldNames.allocate(NumNumbers); @@ -565,20 +553,10 @@ namespace HeatRecovery { thisExchanger.Name = state.dataIPShortCut->cAlphaArgs(1); thisExchanger.type = HVAC::HXType::Desiccant_Balanced; if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { - thisExchanger.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisExchanger.SchedPtr = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); - if (thisExchanger.SchedPtr == 0) { - ShowSevereError(state, - format("{}{}: invalid {} entered ={} for {}={}", - RoutineName, - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2), - state.dataIPShortCut->cAlphaFieldNames(1), - thisExchanger.Name)); - ErrorsFound = true; - } + thisExchanger.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisExchanger.availSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2)); + ErrorsFound = true; } // desiccant HX's usually refer to process and regeneration air streams // In this module, Sup = Regeneration nodes and Sec = Process nodes @@ -1502,8 +1480,8 @@ namespace HeatRecovery { state.dataHeatRecovery->FullLoadOutAirHumRat = state.dataVariableSpeedCoils->VarSpeedCoil(CompanionCoilIndex).OutletAirHumRat; } else if (CompanionCoilType_Num == HVAC::CoilDX_Cooling) { // Use the new coil option: - state.dataHeatRecovery->FullLoadOutAirTemp = state.dataCoilCooingDX->coilCoolingDXs[CompanionCoilIndex].outletAirDryBulbTemp; - state.dataHeatRecovery->FullLoadOutAirHumRat = state.dataCoilCooingDX->coilCoolingDXs[CompanionCoilIndex].outletAirHumRat; + state.dataHeatRecovery->FullLoadOutAirTemp = state.dataCoilCoolingDX->coilCoolingDXs[CompanionCoilIndex].outletAirDryBulbTemp; + state.dataHeatRecovery->FullLoadOutAirHumRat = state.dataCoilCoolingDX->coilCoolingDXs[CompanionCoilIndex].outletAirHumRat; } else { // } @@ -1666,7 +1644,7 @@ namespace HeatRecovery { this->Name, this->type == HVAC::HXType::AirToAir_FlatPlate ? "Flat Plate" - : (this->type == HVAC::HXType::Desiccant_Balanced ? "Dessicant Balanced" : "Generic")); + : (this->type == HVAC::HXType::Desiccant_Balanced ? "Desiccant Balanced" : "Generic")); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchAirHRPlateOrRotary, this->Name, @@ -1689,7 +1667,7 @@ namespace HeatRecovery { void HeatExchCond::CalcAirToAirPlateHeatExch(EnergyPlusData &state, - bool const HXUnitOn, // flag to simulate heat exchager heat recovery + bool const HXUnitOn, // flag to simulate heat exchanger heat recovery ObjexxFCL::Optional_bool_const EconomizerFlag, // economizer flag pass by air loop or OA sys ObjexxFCL::Optional_bool_const HighHumCtrlFlag // high humidity control flag passed by airloop or OA sys ) @@ -1745,7 +1723,7 @@ namespace HeatRecovery { UnitSecMassFlow = min(this->NomSecAirMassFlow, this->SecInMassFlow); } - if (ScheduleManager::GetCurrentScheduleValue(state, this->SchedPtr) <= 0.0) UnitOn = false; + if (this->availSched->getCurrentVal() <= 0.0) UnitOn = false; if (this->SupInMassFlow <= HVAC::SmallMassFlow) UnitOn = false; if (this->SecInMassFlow <= HVAC::SmallMassFlow) UnitOn = false; if (!HXUnitOn) UnitOn = false; @@ -1904,7 +1882,7 @@ namespace HeatRecovery { // School Advanced Ventilation Engineering Software http://www.epa.gov/iaq/schooldesign/saves.html // SUBROUTINE PARAMETER DEFINITIONS: - Real64 constexpr ErrorTol(0.001); // error tolerence + Real64 constexpr ErrorTol(0.001); // error tolerance // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int SupOutNode; @@ -1972,7 +1950,7 @@ namespace HeatRecovery { this->SecBypassMassFlow = 0.0; } // Unit is scheduled OFF, so bypass heat exchange calcs - if (ScheduleManager::GetCurrentScheduleValue(state, this->SchedPtr) <= 0.0) UnitOn = false; + if (this->availSched->getCurrentVal() <= 0.0) UnitOn = false; //! Economizer is active, so bypass heat exchange calcs. This applies to both flat plate and rotary HX's if ((EconomizerActiveFlag || HighHumCtrlActiveFlag) && this->EconoLockOut) { UnitOn = false; @@ -2172,7 +2150,7 @@ namespace HeatRecovery { ControlFraction = 0.0; } if (this->ExchConfig == HXConfigurationType::Rotary) { - // Rotory HX's never get bypassed, rotational speed is modulated + // Rotary HX's never get bypassed, rotational speed is modulated this->SensEffectiveness *= ControlFraction; this->LatEffectiveness *= ControlFraction; } else { // HX is a plate heat exchanger, bypass air to control SA temperature @@ -2397,7 +2375,7 @@ namespace HeatRecovery { void HeatExchCond::CalcDesiccantBalancedHeatExch( EnergyPlusData &state, - bool const HXUnitOn, // flag to simulate heat exchager heat recovery + bool const HXUnitOn, // flag to simulate heat exchanger heat recovery bool const FirstHVACIteration, // First HVAC iteration flag HVAC::FanOp const fanOp, // Supply air fan operating mode (1=cycling, 2=constant) Real64 const PartLoadRatio, // Part load ratio requested of DX compressor @@ -2422,7 +2400,7 @@ namespace HeatRecovery { // METHODOLOGY EMPLOYED: // This is an empirical heat exchanger model. The model uses heat exchanger performance data to - // calculate the air temperature and humidity ratio of the leaving upply and secondary air streams. + // calculate the air temperature and humidity ratio of the leaving supply and secondary air streams. // Humidity control can enable/disable heat recovery through the use of the HXUnitOn Subroutine argument. // Using/Aliasing @@ -2493,7 +2471,7 @@ namespace HeatRecovery { } // Unit is scheduled OFF, so bypass heat exchange calcs - if (ScheduleManager::GetCurrentScheduleValue(state, this->SchedPtr) <= 0.0) UnitOn = false; + if (this->availSched->getCurrentVal() <= 0.0) UnitOn = false; // Determine if unit is ON or OFF based on air mass flow through the supply and secondary airstreams and operation flag if (this->SupInMassFlow <= HVAC::SmallMassFlow) UnitOn = false; if (this->SecInMassFlow <= HVAC::SmallMassFlow) UnitOn = false; @@ -2631,7 +2609,7 @@ namespace HeatRecovery { } else if (CompanionCoilType > 0 && CompanionCoilIndex > -1) { if (CompanionCoilType == HVAC::CoilDX_Cooling) { - HXPartLoadRatio = state.dataCoilCooingDX->coilCoolingDXs[CompanionCoilIndex].partLoadRatioReport; + HXPartLoadRatio = state.dataCoilCoolingDX->coilCoolingDXs[CompanionCoilIndex].partLoadRatioReport; } else if (CompanionCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { HXPartLoadRatio = state.dataVariableSpeedCoils->VarSpeedCoil(CompanionCoilIndex).PartLoadRatio; } else { @@ -2859,13 +2837,13 @@ namespace HeatRecovery { this->LatEffectiveness *= Curve::CurveValue(state, this->CoolEffectLatentCurveIndex, HXAirVolFlowRatio); } } - // calculation of local variable Csup can be 0, gaurd against divide by 0. + // calculation of local variable Csup can be 0, guard against divide by 0. TempSupOut = TempSupIn + this->SensEffectiveness * SafeDiv(CMin, CSup) * (TempSecIn - TempSupIn); QSensTrans = CSup * (TempSupIn - TempSupOut); // Csec cannot be 0 in this subroutine TempSecOut = TempSecIn + QSensTrans / CSec; Error = (TempSecOut - TempThreshold); - // recalculate DFFraction until convergence, gaurd against divide by 0 (unlikely). + // recalculate DFFraction until convergence, guard against divide by 0 (unlikely). DFFraction = max(0.0, min(1.0, DFFraction * SafeDiv((TempSecIn - TempSecOut), (TempSecIn - TempThreshold)))); ++Iter; } @@ -3133,7 +3111,7 @@ namespace HeatRecovery { } break; case HXConfiguration::CrossFlowBothUnmixed: { // CROSS FLOW BOTH UNMIXED Temp = Z * std::pow(NTU, -0.22); - Eps = 1.0 - std::exp((std::exp(-NTU * Temp) - 1.0) / Temp); + Eps = 1.0 - std::exp(std::expm1(-NTU * Temp) / Temp); } break; case HXConfiguration::CrossFlowOther: { // CROSS FLOW, Cmax MIXED, Cmin UNMIXED Eps = (1.0 - std::exp(-Z * (1.0 - std::exp(-NTU)))) / Z; @@ -3221,13 +3199,13 @@ namespace HeatRecovery { } } break; case HXConfiguration::ParallelFlow: { // PARALLEL FLOW - NTU = -std::log(-Eps - Eps * Z + 1.0) / (Z + 1.0); + NTU = -std::log1p(-Eps - Eps * Z) / (Z + 1.0); } break; case HXConfiguration::CrossFlowBothUnmixed: { // CROSS FLOW BOTH UNMIXED NTU = GetNTUforCrossFlowBothUnmixed(state, Eps, Z); } break; case HXConfiguration::CrossFlowOther: { // CROSS FLOW, Cmax MIXED, Cmin UNMIXED - NTU = -std::log(1.0 + std::log(1.0 - Eps * Z) / Z); + NTU = -std::log1p(std::log(1.0 - Eps * Z) / Z); } break; default: { ShowFatalError(state, format("HeatRecovery: Illegal flow arrangement in CalculateNTUfromEpsAndZ, Value={}", FlowArr)); @@ -3273,7 +3251,7 @@ namespace HeatRecovery { int SolFla; // Flag of solver Real64 constexpr NTU0(0.0); // lower bound for NTU Real64 constexpr NTU1(50.0); // upper bound for NTU - auto f = [Eps, Z](Real64 const NTU) { return 1.0 - std::exp((std::exp(-std::pow(NTU, 0.78) * Z) - 1.0) / Z * std::pow(NTU, 0.22)) - Eps; }; + auto f = [Eps, Z](Real64 const NTU) { return 1.0 - std::exp(std::expm1(-std::pow(NTU, 0.78) * Z) / Z * std::pow(NTU, 0.22)) - Eps; }; General::SolveRoot(state, Acc, MaxIte, SolFla, NTU, f, NTU0, NTU1); if (SolFla == -2) { @@ -3303,7 +3281,7 @@ namespace HeatRecovery { // PURPOSE OF THIS SUBROUTINE: // To verify that the empirical model's independent variables are within the limits used during the - // developement of the empirical model. + // development of the empirical model. // METHODOLOGY EMPLOYED: // The empirical models used for simulating a desiccant enhanced cooling coil are based on a limited data set. @@ -3404,7 +3382,7 @@ namespace HeatRecovery { ShowContinueError(state, state.dataHeatRecovery->BalDesDehumPerfData(this->PerfDataIndex).T_ProcInHumRatError.buffer2); ShowContinueError(state, state.dataHeatRecovery->BalDesDehumPerfData(this->PerfDataIndex).T_ProcInHumRatError.buffer3); ShowContinueError(state, - "...Using process inlet air humidity ratios that are outside the regeneratoin outlet air temperature equation " + "...Using process inlet air humidity ratios that are outside the regeneration outlet air temperature equation " "model boundaries may adversely affect desiccant model performance."); } else { ShowRecurringWarningErrorAtEnd(state, @@ -3444,7 +3422,7 @@ namespace HeatRecovery { thisError.TimeStepSysLast = TimeStepSys; thisError.CurrentEndTimeLast = thisError.CurrentEndTime; - // If regen and procees inlet temperatures are the same the coil is off, do not print out of bounds warning for this case + // If regen and process inlet temperatures are the same the coil is off, do not print out of bounds warning for this case if (std::abs(T_RegenInTemp - T_ProcInTemp) < SMALL) { state.dataHeatRecovery->BalDesDehumPerfData(this->PerfDataIndex).T_RegenInTempError.print = false; state.dataHeatRecovery->BalDesDehumPerfData(this->PerfDataIndex).T_RegenInHumRatError.print = false; @@ -3667,7 +3645,7 @@ namespace HeatRecovery { // PURPOSE OF THIS SUBROUTINE: // To verify that the empirical model's independent variables are within the limits used during the - // developement of the empirical model. + // development of the empirical model. // METHODOLOGY EMPLOYED: // The empirical models used for simulating a desiccant enhanced cooling coil are based on a limited data set. @@ -3807,7 +3785,7 @@ namespace HeatRecovery { thisError.TimeStepSysLast = TimeStepSys; thisError.CurrentEndTimeLast = thisError.CurrentEndTime; - // If regen and procees inlet temperatures are the same the coil is off, do not print out of bounds warning for this case + // If regen and process inlet temperatures are the same the coil is off, do not print out of bounds warning for this case if (std::abs(H_RegenInTemp - H_ProcInTemp) < SMALL) { state.dataHeatRecovery->BalDesDehumPerfData(this->PerfDataIndex).H_RegenInTempError.print = false; state.dataHeatRecovery->BalDesDehumPerfData(this->PerfDataIndex).H_RegenInHumRatError.print = false; @@ -4031,7 +4009,7 @@ namespace HeatRecovery { // PURPOSE OF THIS SUBROUTINE: // To verify that the empirical model's independent variables are within the limits used during the - // developement of the empirical model. + // development of the empirical model. // METHODOLOGY EMPLOYED: // The empirical models used for simulating a desiccant enhanced cooling coil are based on a limited data set. @@ -4192,7 +4170,7 @@ namespace HeatRecovery { // PURPOSE OF THIS SUBROUTINE: // To verify that the empirical model's independent variables are within the limits used during the - // developement of the empirical model. + // development of the empirical model. // METHODOLOGY EMPLOYED: // The empirical models used for simulating a desiccant enhanced cooling coil are based on a limited data set. @@ -4462,7 +4440,7 @@ namespace HeatRecovery { return; } - // If regen and procees inlet temperatures are the same the coil is off, do not print out of bounds warning for this case + // If regen and process inlet temperatures are the same the coil is off, do not print out of bounds warning for this case if (std::abs(T_RegenInTemp - T_ProcInTemp) < SMALL) { state.dataHeatRecovery->BalDesDehumPerfData(this->PerfDataIndex).regenInRelHumTempErr.print = false; state.dataHeatRecovery->BalDesDehumPerfData(this->PerfDataIndex).procInRelHumTempErr.print = false; @@ -4638,7 +4616,7 @@ namespace HeatRecovery { return; } - // If regen and procees inlet temperatures are the same the coil is off, do not print out of bounds warning for this case + // If regen and process inlet temperatures are the same the coil is off, do not print out of bounds warning for this case if (std::abs(H_RegenInTemp - H_ProcInTemp) < SMALL) { state.dataHeatRecovery->BalDesDehumPerfData(this->PerfDataIndex).regenInRelHumHumRatErr.print = false; state.dataHeatRecovery->BalDesDehumPerfData(this->PerfDataIndex).procInRelHumHumRatErr.print = false; @@ -4927,7 +4905,7 @@ namespace HeatRecovery { // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: - // This function looks up the given Generic HX and the voluetric air flow rate. + // This function looks up the given Generic HX and the volumetric air flow rate. // If incorrect HX name is given, ErrorsFound is returned as true and air flow rate as zero. // Obtains and Allocates heat exchanger related parameters from input file @@ -4960,7 +4938,7 @@ namespace HeatRecovery { // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: - // This function looks up the given Generic HX and the voluetric air flow rate. + // This function looks up the given Generic HX and the volumetric air flow rate. // If incorrect HX name is given, ErrorsFound is returned as true and air flow rate as zero. // Obtains and Allocates heat exchanger related parameters from input file diff --git a/src/EnergyPlus/HeatRecovery.hh b/src/EnergyPlus/HeatRecovery.hh index 518ec873657..99239ce55fd 100644 --- a/src/EnergyPlus/HeatRecovery.hh +++ b/src/EnergyPlus/HeatRecovery.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -111,7 +111,7 @@ namespace HeatRecovery { std::string Name; // name of component HVAC::HXType type = HVAC::HXType::Invalid; std::string HeatExchPerfName; // Desiccant balanced heat exchanger performance data name - int SchedPtr = 0; // index of schedule + Sched::Schedule *availSched = nullptr; // schedule // availability ? HXConfiguration FlowArr = HXConfiguration::Invalid; // flow Arrangement: bool EconoLockOut = false; Real64 hARatio = 0.0; // ratio of supply side h*A to secondary side h*A @@ -502,6 +502,10 @@ struct HeatRecoveryData : BaseGlobalStruct Array1D ExchCond; Array1D BalDesDehumPerfData; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/HeatingCoils.cc b/src/EnergyPlus/HeatingCoils.cc index 7ed94619dc5..ffa2128e2df 100644 --- a/src/EnergyPlus/HeatingCoils.cc +++ b/src/EnergyPlus/HeatingCoils.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -254,6 +254,7 @@ namespace HeatingCoils { // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName = "GetHeatingCoilInput: "; // include trailing blank space + static constexpr std::string_view routineName = "GetHeatingCoilInput"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: std::string CurrentModuleObject; // for ease in getting objects @@ -338,6 +339,7 @@ namespace HeatingCoils { cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; heatingCoilNumericFields.FieldNames.allocate(state.dataHeatingCoils->MaxNums); heatingCoilNumericFields.FieldNames = cNumericFields; @@ -346,22 +348,11 @@ namespace HeatingCoils { state, CurrentModuleObject, Alphas(1), state.dataHeatingCoils->InputErrorsFound, CurrentModuleObject + " Name"); heatingCoil.Name = Alphas(1); - heatingCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { - heatingCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - heatingCoil.SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); - if (heatingCoil.SchedPtr == 0) { - ShowSevereError(state, - format("{}{}: Invalid {} entered ={} for {}={}", - RoutineName, - CurrentModuleObject, - cAlphaFields(2), - Alphas(2), - cAlphaFields(1), - Alphas(1))); - state.dataHeatingCoils->InputErrorsFound = true; - } + heatingCoil.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((heatingCoil.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + state.dataHeatingCoils->InputErrorsFound = true; } heatingCoil.HeatingCoilType = "Heating"; @@ -468,6 +459,7 @@ namespace HeatingCoils { cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; heatingCoilNumericFields.FieldNames.allocate(state.dataHeatingCoils->MaxNums); heatingCoilNumericFields.FieldNames = cNumericFields; @@ -475,22 +467,11 @@ namespace HeatingCoils { GlobalNames::VerifyUniqueCoilName( state, CurrentModuleObject, Alphas(1), state.dataHeatingCoils->InputErrorsFound, CurrentModuleObject + " Name"); heatingCoil.Name = Alphas(1); - heatingCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { - heatingCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - heatingCoil.SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); - if (heatingCoil.SchedPtr == 0) { - ShowSevereError(state, - format("{}{}: Invalid {} entered ={} for {}={}", - RoutineName, - CurrentModuleObject, - cAlphaFields(2), - Alphas(2), - cAlphaFields(1), - Alphas(1))); - state.dataHeatingCoils->InputErrorsFound = true; - } + heatingCoil.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((heatingCoil.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + state.dataHeatingCoils->InputErrorsFound = true; } heatingCoil.HeatingCoilType = "Heating"; @@ -605,6 +586,7 @@ namespace HeatingCoils { cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; heatingCoilNumericFields.FieldNames.allocate(state.dataHeatingCoils->MaxNums); heatingCoilNumericFields.FieldNames = cNumericFields; @@ -612,22 +594,11 @@ namespace HeatingCoils { GlobalNames::VerifyUniqueCoilName( state, CurrentModuleObject, Alphas(1), state.dataHeatingCoils->InputErrorsFound, CurrentModuleObject + " Name"); heatingCoil.Name = Alphas(1); - heatingCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { - heatingCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - heatingCoil.SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); - if (heatingCoil.SchedPtr == 0) { - ShowSevereError(state, - format("{}{}: Invalid {} entered ={} for {}={}", - RoutineName, - CurrentModuleObject, - cAlphaFields(2), - Alphas(2), - cAlphaFields(1), - Alphas(1))); - state.dataHeatingCoils->InputErrorsFound = true; - } + heatingCoil.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((heatingCoil.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + state.dataHeatingCoils->InputErrorsFound = true; } heatingCoil.HeatingCoilType = "Heating"; @@ -802,6 +773,8 @@ namespace HeatingCoils { cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + heatingCoilNumericFields.FieldNames.allocate(state.dataHeatingCoils->MaxNums); heatingCoilNumericFields.FieldNames = cNumericFields; @@ -809,22 +782,12 @@ namespace HeatingCoils { GlobalNames::VerifyUniqueCoilName( state, CurrentModuleObject, Alphas(1), state.dataHeatingCoils->InputErrorsFound, CurrentModuleObject + " Name"); heatingCoil.Name = Alphas(1); - heatingCoil.Schedule = Alphas(2); + if (lAlphaBlanks(2)) { - heatingCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - heatingCoil.SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); - if (heatingCoil.SchedPtr == 0) { - ShowSevereError(state, - format("{}{}: Invalid {} entered ={} for {}={}", - RoutineName, - CurrentModuleObject, - cAlphaFields(2), - Alphas(2), - cAlphaFields(1), - Alphas(1))); - state.dataHeatingCoils->InputErrorsFound = true; - } + heatingCoil.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((heatingCoil.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + state.dataHeatingCoils->InputErrorsFound = true; } heatingCoil.HeatingCoilType = "Heating"; @@ -992,6 +955,7 @@ namespace HeatingCoils { cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; heatingCoilNumericFields.FieldNames.allocate(state.dataHeatingCoils->MaxNums); heatingCoilNumericFields.FieldNames = cNumericFields; @@ -999,32 +963,14 @@ namespace HeatingCoils { GlobalNames::VerifyUniqueCoilName( state, CurrentModuleObject, Alphas(1), state.dataHeatingCoils->InputErrorsFound, CurrentModuleObject + " Name"); heatingCoil.Name = Alphas(1); - heatingCoil.Schedule = Alphas(2); if (lAlphaBlanks(2)) { - heatingCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - heatingCoil.SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); - if (heatingCoil.SchedPtr == 0) { - ShowSevereError(state, - format("{}{}: Invalid {} entered ={} for {}={}", - RoutineName, - CurrentModuleObject, - cAlphaFields(2), - Alphas(2), - cAlphaFields(1), - Alphas(1))); - state.dataHeatingCoils->InputErrorsFound = true; - } - } - - // check availability schedule for values between 0 and 1 - if (heatingCoil.SchedPtr > 0) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, heatingCoil.SchedPtr, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{} = \"{}\"", CurrentModuleObject, heatingCoil.Name)); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFields(2), Alphas(2))); - ShowContinueError(state, "Schedule values must be (>=0., <=1.)"); - state.dataHeatingCoils->InputErrorsFound = true; - } + heatingCoil.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((heatingCoil.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + state.dataHeatingCoils->InputErrorsFound = true; + } else if (!heatingCoil.availSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFields(2), Alphas(2), Clusive::In, 0.0, Clusive::In, 1.0); + state.dataHeatingCoils->InputErrorsFound = true; } heatingCoil.HeatingCoilType = "Heating"; @@ -1247,7 +1193,7 @@ namespace HeatingCoils { state.dataHeatingCoils->InputErrorsFound = true; } DataHeatBalance::HeatReclaimDataBase &HeatReclaim = - state.dataCoilCooingDX->coilCoolingDXs[heatingCoil.ReclaimHeatingSourceIndexNum].reclaimHeat; + state.dataCoilCoolingDX->coilCoolingDXs[heatingCoil.ReclaimHeatingSourceIndexNum].reclaimHeat; if (!allocated(HeatReclaim.HVACDesuperheaterReclaimedHeat)) { HeatReclaim.HVACDesuperheaterReclaimedHeat.allocate(state.dataHeatingCoils->NumDesuperheaterCoil); std::fill(HeatReclaim.HVACDesuperheaterReclaimedHeat.begin(), HeatReclaim.HVACDesuperheaterReclaimedHeat.end(), 0.0); @@ -1588,7 +1534,7 @@ namespace HeatingCoils { } case HeatObjTypes::COIL_COOLING_DX_NEW: DataHeatBalance::HeatReclaimDataBase &HeatReclaim = - state.dataCoilCooingDX->coilCoolingDXs[heatingCoil.ReclaimHeatingSourceIndexNum].reclaimHeat; + state.dataCoilCoolingDX->coilCoolingDXs[heatingCoil.ReclaimHeatingSourceIndexNum].reclaimHeat; if (!allocated(HeatReclaim.HVACDesuperheaterReclaimedHeat)) { HeatReclaim.HVACDesuperheaterReclaimedHeat.allocate(state.dataHeatingCoils->NumDesuperheaterCoil); std::fill(HeatReclaim.HVACDesuperheaterReclaimedHeat.begin(), HeatReclaim.HVACDesuperheaterReclaimedHeat.end(), 0.0); @@ -1889,8 +1835,7 @@ namespace HeatingCoils { // Also the coil has to be scheduled to be available. // Control output to meet load QCoilReq (QCoilReq is passed in if load controlled, otherwise QCoilReq=-999) - if ((AirMassFlow > 0.0 && heatingCoil.NominalCapacity > 0.0) && - (ScheduleManager::GetCurrentScheduleValue(state, heatingCoil.SchedPtr) > 0.0) && (QCoilReq > 0.0)) { + if ((AirMassFlow > 0.0 && heatingCoil.NominalCapacity > 0.0) && (heatingCoil.availSched->getCurrentVal() > 0.0) && (QCoilReq > 0.0)) { // check to see if the Required heating capacity is greater than the user specified capacity. if (QCoilReq > heatingCoil.NominalCapacity) { @@ -1906,9 +1851,8 @@ namespace HeatingCoils { heatingCoil.ElecUseLoad = HeatingCoilLoad / Effic; // Control coil output to meet a setpoint temperature. - } else if ((AirMassFlow > 0.0 && heatingCoil.NominalCapacity > 0.0) && - (ScheduleManager::GetCurrentScheduleValue(state, heatingCoil.SchedPtr) > 0.0) && (QCoilReq == DataLoopNode::SensedLoadFlagValue) && - (std::abs(TempSetPoint - TempAirIn) > HVAC::TempControlTol)) { + } else if ((AirMassFlow > 0.0 && heatingCoil.NominalCapacity > 0.0) && (heatingCoil.availSched->getCurrentVal() > 0.0) && + (QCoilReq == DataLoopNode::SensedLoadFlagValue) && (std::abs(TempSetPoint - TempAirIn) > HVAC::TempControlTol)) { QCoilCap = CapacitanceAir * (TempSetPoint - TempAirIn); // check to see if setpoint above enetering temperature. If not, set @@ -2038,8 +1982,7 @@ namespace HeatingCoils { Real64 OutdoorPressure = state.dataEnvrn->OutBaroPress; - if ((AirMassFlow > 0.0) && (ScheduleManager::GetCurrentScheduleValue(state, heatingCoil.SchedPtr) > 0.0) && - ((CycRatio > 0.0) || (SpeedRatio > 0.0))) { + if ((AirMassFlow > 0.0) && (heatingCoil.availSched->getCurrentVal() > 0.0) && ((CycRatio > 0.0) || (SpeedRatio > 0.0))) { if (StageNum > 1) { @@ -2209,8 +2152,7 @@ namespace HeatingCoils { // Also the coil has to be scheduled to be available. // Control output to meet load QCoilReq (QCoilReq is passed in if load controlled, otherwise QCoilReq=-999) - if ((AirMassFlow > 0.0 && heatingCoil.NominalCapacity > 0.0) && - (ScheduleManager::GetCurrentScheduleValue(state, heatingCoil.SchedPtr) > 0.0) && (QCoilReq > 0.0)) { + if ((AirMassFlow > 0.0 && heatingCoil.NominalCapacity > 0.0) && (heatingCoil.availSched->getCurrentVal() > 0.0) && (QCoilReq > 0.0)) { // check to see if the Required heating capacity is greater than the user specified capacity. if (QCoilReq > heatingCoil.NominalCapacity) { @@ -2230,9 +2172,8 @@ namespace HeatingCoils { heatingCoil.ParasiticFuelRate = heatingCoil.ParasiticFuelCapacity * (1.0 - PartLoadRat); // Control coil output to meet a setpoint temperature. - } else if ((AirMassFlow > 0.0 && heatingCoil.NominalCapacity > 0.0) && - (ScheduleManager::GetCurrentScheduleValue(state, heatingCoil.SchedPtr) > 0.0) && (QCoilReq == DataLoopNode::SensedLoadFlagValue) && - (std::abs(TempSetPoint - TempAirIn) > HVAC::TempControlTol)) { + } else if ((AirMassFlow > 0.0 && heatingCoil.NominalCapacity > 0.0) && (heatingCoil.availSched->getCurrentVal() > 0.0) && + (QCoilReq == DataLoopNode::SensedLoadFlagValue) && (std::abs(TempSetPoint - TempAirIn) > HVAC::TempControlTol)) { QCoilCap = CapacitanceAir * (TempSetPoint - TempAirIn); // check to see if setpoint above entering temperature. If not, set @@ -2419,8 +2360,7 @@ namespace HeatingCoils { Real64 InletAirHumRat = heatingCoil.InletAirHumRat; Real64 OutdoorPressure = state.dataEnvrn->OutBaroPress; - if ((AirMassFlow > 0.0) && (ScheduleManager::GetCurrentScheduleValue(state, heatingCoil.SchedPtr) > 0.0) && - ((CycRatio > 0.0) || (SpeedRatio > 0.0))) { + if ((AirMassFlow > 0.0) && (heatingCoil.availSched->getCurrentVal() > 0.0) && ((CycRatio > 0.0) || (SpeedRatio > 0.0))) { if (StageNum > 1) { @@ -2699,7 +2639,7 @@ namespace HeatingCoils { case HeatObjTypes::COIL_COOLING_DX_NEW: // get RTF and NominalCapacity from Coil:CoolingDX { - auto const &thisCoolingCoil = state.dataCoilCooingDX->coilCoolingDXs[SourceID]; + auto const &thisCoolingCoil = state.dataCoilCoolingDX->coilCoolingDXs[SourceID]; heatingCoil.RTF = thisCoolingCoil.runTimeFraction; heatingCoil.NominalCapacity = thisCoolingCoil.reclaimHeat.AvailCapacity * Effic - thisCoolingCoil.reclaimHeat.WaterHeatingDesuperheaterReclaimedHeatTotal; @@ -2714,7 +2654,7 @@ namespace HeatingCoils { } // Control output to meet load (QCoilReq) - if ((AirMassFlow > 0.0) && (ScheduleManager::GetCurrentScheduleValue(state, heatingCoil.SchedPtr) > 0.0) && (QCoilReq > 0.0)) { + if ((AirMassFlow > 0.0) && (heatingCoil.availSched->getCurrentVal() > 0.0) && (QCoilReq > 0.0)) { // check to see if the Required heating capacity is greater than the available heating capacity. if (QCoilReq > heatingCoil.NominalCapacity) { @@ -2735,9 +2675,8 @@ namespace HeatingCoils { } // Control coil output to meet a setpoint temperature. - } else if ((AirMassFlow > 0.0 && heatingCoil.NominalCapacity > 0.0) && - (ScheduleManager::GetCurrentScheduleValue(state, heatingCoil.SchedPtr) > 0.0) && (QCoilReq == DataLoopNode::SensedLoadFlagValue) && - (std::abs(TempSetPoint - TempAirIn) > HVAC::TempControlTol)) { + } else if ((AirMassFlow > 0.0 && heatingCoil.NominalCapacity > 0.0) && (heatingCoil.availSched->getCurrentVal() > 0.0) && + (QCoilReq == DataLoopNode::SensedLoadFlagValue) && (std::abs(TempSetPoint - TempAirIn) > HVAC::TempControlTol)) { QCoilCap = CapacitanceAir * (TempSetPoint - TempAirIn); // check to see if setpoint is above entering air temperature. If not, set output to zero. @@ -2978,7 +2917,7 @@ namespace HeatingCoils { ShowFatalError(state, "Program terminates due to preceding conditions."); } CompIndex = CoilNum; - Value = ScheduleManager::GetCurrentScheduleValue(state, state.dataHeatingCoils->HeatingCoil(CoilNum).SchedPtr); // not scheduled? + Value = state.dataHeatingCoils->HeatingCoil(CoilNum).availSched->getCurrentVal(); // not scheduled? } else { int CoilNum = CompIndex; if (CoilNum > state.dataHeatingCoils->NumHeatingCoils || CoilNum < 1) { @@ -3000,7 +2939,7 @@ namespace HeatingCoils { HVAC::cAllCoilTypes(state.dataHeatingCoils->HeatingCoil(CoilNum).HCoilType_Num))); ShowFatalError(state, "Program terminates due to preceding conditions."); } - Value = ScheduleManager::GetCurrentScheduleValue(state, state.dataHeatingCoils->HeatingCoil(CoilNum).SchedPtr); // not scheduled? + Value = state.dataHeatingCoils->HeatingCoil(CoilNum).availSched->getCurrentVal(); // not scheduled? } } @@ -3068,10 +3007,10 @@ namespace HeatingCoils { return CoilCapacity; } - int GetCoilAvailScheduleIndex(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem + Sched::Schedule *GetCoilAvailSched(EnergyPlusData &state, + std::string const &CoilType, // must match coil types in this module + std::string const &CoilName, // must match coil names for the coil type + bool &ErrorsFound // set to true if problem ) { @@ -3091,14 +3030,13 @@ namespace HeatingCoils { } int WhichCoil = 0; - int AvailSchIndex = 0; int FoundType = Util::FindItem(CoilType, HVAC::cAllCoilTypes, HVAC::NumAllCoilTypes); if (FoundType == HVAC::Coil_HeatingElectric || FoundType == HVAC::Coil_HeatingElectric_MultiStage || FoundType == HVAC::Coil_HeatingGasOrOtherFuel || FoundType == HVAC::Coil_HeatingGas_MultiStage || FoundType == HVAC::Coil_HeatingDesuperheater) { WhichCoil = Util::FindItem(CoilName, state.dataHeatingCoils->HeatingCoil); if (WhichCoil != 0) { - AvailSchIndex = state.dataHeatingCoils->HeatingCoil(WhichCoil).SchedPtr; + return state.dataHeatingCoils->HeatingCoil(WhichCoil).availSched; } } else { WhichCoil = 0; @@ -3107,10 +3045,9 @@ namespace HeatingCoils { if (WhichCoil == 0) { ShowSevereError(state, format("GetCoilAvailScheduleIndex: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); ErrorsFound = true; - AvailSchIndex = 0; } - return AvailSchIndex; + return nullptr; } int GetCoilInletNode(EnergyPlusData &state, diff --git a/src/EnergyPlus/HeatingCoils.hh b/src/EnergyPlus/HeatingCoils.hh index aa17c58dbe5..2b68e775d8d 100644 --- a/src/EnergyPlus/HeatingCoils.hh +++ b/src/EnergyPlus/HeatingCoils.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -88,8 +88,7 @@ namespace HeatingCoils { std::string HeatingCoilModel; // Type of HeatingCoil ie. Simple, Detailed, etc. int HCoilType_Num = 0; Constant::eFuel FuelType = Constant::eFuel::Invalid; // Type of fuel used, reference resource type integers - std::string Schedule; // HeatingCoil Operation Schedule - int SchedPtr = 0; // Pointer to the correct schedule + Sched::Schedule *availSched = nullptr; // availability schedule int InsuffTemperatureWarn = 0; // Used for recurring error message Real64 InletAirMassFlowRate = 0.0; // MassFlow through the HeatingCoil being Simulated [kg/Sec] Real64 OutletAirMassFlowRate = 0.0; @@ -221,10 +220,10 @@ namespace HeatingCoils { bool &ErrorsFound // set to true if problem ); - int GetCoilAvailScheduleIndex(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem + Sched::Schedule *GetCoilAvailSched(EnergyPlusData &state, + std::string const &CoilType, // must match coil types in this module + std::string const &CoilName, // must match coil names for the coil type + bool &ErrorsFound // set to true if problem ); int GetCoilInletNode(EnergyPlusData &state, @@ -316,6 +315,10 @@ struct HeatingCoilsData : BaseGlobalStruct Array1D_bool ShowSingleWarning; // Used for single warning message for desuperheater coil Array1D_bool MyEnvrnFlag; // one time environment flag + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/HighTempRadiantSystem.cc b/src/EnergyPlus/HighTempRadiantSystem.cc index 245b5ea1acd..aafee1adde1 100644 --- a/src/EnergyPlus/HighTempRadiantSystem.cc +++ b/src/EnergyPlus/HighTempRadiantSystem.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -206,6 +206,7 @@ namespace HighTempRadiantSystem { // METHODOLOGY EMPLOYED: // Standard EnergyPlus methodology. + static constexpr std::string_view routineName = "GetHighTempRadiantSystem"; // SUBROUTINE PARAMETER DEFINITIONS: Real64 constexpr MaxCombustionEffic = 1.0; // Limit the combustion efficiency to perfection @@ -216,7 +217,7 @@ namespace HighTempRadiantSystem { int constexpr iHeatCAPMAlphaNum = 4; // get input index to High Temperature Radiant system heating capacity sizing method int constexpr iHeatDesignCapacityNumericNum = 1; // get input index to High Temperature Radiant system heating capacity int constexpr iHeatCapacityPerFloorAreaNumericNum = 2; // index to High Temperature Radiant system heating capacity per floor area sizing - int constexpr iHeatFracOfAutosizedCapacityNumericNum = 3; // index to system capacity sizing as fraction of autozized heating capacity + int constexpr iHeatFracOfAutosizedCapacityNumericNum = 3; // index to system capacity sizing as fraction of autosized heating capacity // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 FracOfRadPotentiallyLost; // Difference between unity and AllFracsSummed for error reporting @@ -253,27 +254,19 @@ namespace HighTempRadiantSystem { state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + state.dataHighTempRadSys->HighTempRadSysNumericFields(Item).FieldNames.allocate(NumNumbers); state.dataHighTempRadSys->HighTempRadSysNumericFields(Item).FieldNames = ""; state.dataHighTempRadSys->HighTempRadSysNumericFields(Item).FieldNames = state.dataIPShortCut->cNumericFieldNames; // General user input data highTempRadSys.Name = state.dataIPShortCut->cAlphaArgs(1); - highTempRadSys.SchedName = state.dataIPShortCut->cAlphaArgs(2); if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { - highTempRadSys.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - highTempRadSys.SchedPtr = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); - if (highTempRadSys.SchedPtr == 0) { - ShowSevereError(state, - format("{}: invalid {} entered ={} for {} = {}", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2), - state.dataIPShortCut->cAlphaFieldNames(1), - state.dataIPShortCut->cAlphaArgs(1))); - ErrorsFound = true; - } + highTempRadSys.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((highTempRadSys.availSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2)); + ErrorsFound = true; } highTempRadSys.ZonePtr = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(3), state.dataHeatBal->Zone); @@ -457,11 +450,9 @@ namespace HighTempRadiantSystem { ShowContinueError(state, "Thus, the throttling range value has been reset to 1.0"); } - highTempRadSys.SetptSched = state.dataIPShortCut->cAlphaArgs(7); - highTempRadSys.SetptSchedPtr = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(7)); - if ((highTempRadSys.SetptSchedPtr == 0) && (!state.dataIPShortCut->lAlphaFieldBlanks(7))) { - ShowSevereError(state, format("{} not found: {}", state.dataIPShortCut->cAlphaFieldNames(7), state.dataIPShortCut->cAlphaArgs(7))); - ShowContinueError(state, format("Occurs for {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); + if (state.dataIPShortCut->lAlphaFieldBlanks(7)) { + } else if ((highTempRadSys.setptSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(7))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(7), state.dataIPShortCut->cAlphaArgs(7)); ErrorsFound = true; } @@ -650,7 +641,7 @@ namespace HighTempRadiantSystem { } if (!state.dataGlobal->SysSizingCalc && state.dataHighTempRadSys->MySizeFlag(RadSysNum)) { - // for each radiant systen do the sizing once. + // for each radiant system do the sizing once. SizeHighTempRadiantSystem(state, RadSysNum); state.dataHighTempRadSys->MySizeFlag(RadSysNum) = false; } @@ -799,7 +790,7 @@ namespace HighTempRadiantSystem { int ZoneNum = thisHTR.ZonePtr; Real64 HeatFrac = 0.0; // fraction of maximum energy input to radiant system [dimensionless] - if (ScheduleManager::GetCurrentScheduleValue(state, thisHTR.SchedPtr) <= 0) { + if (thisHTR.availSched->getCurrentVal() <= 0) { // Unit is off or has no load upon it; set the flow rates to zero and then // simulate the components with the no flow conditions @@ -809,7 +800,7 @@ namespace HighTempRadiantSystem { // high temperature radiant heater (temperature controlled) // Determine the current setpoint temperature and the temperature at which the unit should be completely off - Real64 SetPtTemp = ScheduleManager::GetCurrentScheduleValue(state, thisHTR.SetptSchedPtr); + Real64 SetPtTemp = thisHTR.setptSched->getCurrentVal(); Real64 OffTemp = SetPtTemp + 0.5 * thisHTR.ThrottlRange; auto const &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); Real64 OpTemp = (thisZoneHB.MAT + thisZoneHB.MRT) / 2.0; // Approximate the "operative" temperature @@ -886,13 +877,13 @@ namespace HighTempRadiantSystem { int ZoneNum = thisHTR.ZonePtr; thisHTR.QHTRRadSource = 0.0; - if (ScheduleManager::GetCurrentScheduleValue(state, thisHTR.SchedPtr) > 0) { + if (thisHTR.availSched->getCurrentVal() > 0) { // Unit is scheduled on-->this section is intended to control the output of the // high temperature radiant heater (temperature controlled) // Determine the current setpoint temperature and the temperature at which the unit should be completely off - Real64 SetPtTemp = ScheduleManager::GetCurrentScheduleValue(state, thisHTR.SetptSchedPtr); + Real64 SetPtTemp = thisHTR.setptSched->getCurrentVal(); // Now, distribute the radiant energy of all systems to the appropriate // surfaces, to people, and the air; determine the latent portion @@ -950,7 +941,7 @@ namespace HighTempRadiantSystem { HeatBalanceSurfaceManager::CalcHeatBalanceInsideSurf(state, ZoneNum); // Redetermine the current value of the controlling temperature - auto &thisZoneHBMod = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); + auto const &thisZoneHBMod = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); switch (thisHTR.ControlType) { case RadControlType::MATControl: { ZoneTemp = thisZoneHBMod.MAT; diff --git a/src/EnergyPlus/HighTempRadiantSystem.hh b/src/EnergyPlus/HighTempRadiantSystem.hh index 9d2e4ab6c40..8b10703db30 100644 --- a/src/EnergyPlus/HighTempRadiantSystem.hh +++ b/src/EnergyPlus/HighTempRadiantSystem.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -82,27 +82,25 @@ namespace HighTempRadiantSystem { { // Members // Input data - std::string Name; // name of hydronic radiant system - std::string SchedName; // availability schedule - int SchedPtr; // index to schedule - int ZonePtr; // Point to this zone in the Zone derived type - Constant::eResource HeaterType; // Type of heater (NaturalGas or Electricity) - Real64 MaxPowerCapac; // Maximum capacity of the radiant heater in Watts - Real64 CombustionEffic; // Combustion efficiency (only valid for a gas heater) - Real64 FracRadiant; // Fraction of heater power that is given off as radiant heat - Real64 FracLatent; // Fraction of heater power that is given off as latent heat - Real64 FracLost; // Fraction of heater power that is lost to the outside environment - Real64 FracConvect; // Fraction of heater power that is given off as convective heat + std::string Name; // name of hydronic radiant system + Sched::Schedule *availSched = nullptr; // availability schedule + int ZonePtr; // Point to this zone in the Zone derived type + Constant::eResource HeaterType; // Type of heater (NaturalGas or Electricity) + Real64 MaxPowerCapac; // Maximum capacity of the radiant heater in Watts + Real64 CombustionEffic; // Combustion efficiency (only valid for a gas heater) + Real64 FracRadiant; // Fraction of heater power that is given off as radiant heat + Real64 FracLatent; // Fraction of heater power that is given off as latent heat + Real64 FracLost; // Fraction of heater power that is lost to the outside environment + Real64 FracConvect; // Fraction of heater power that is given off as convective heat // (by definition this is 1 minus the sum of all other fractions) - RadControlType ControlType; // Control type for the system (MAT, MRT, or op temp) - Real64 ThrottlRange; // Throttling range for heating [C] - std::string SetptSched; // Schedule name for the zone setpoint temperature - int SetptSchedPtr; // Schedule index for the zone setpoint temperature - Real64 FracDistribPerson; // Fraction of fraction radiant incident on a "person" in the space - int TotSurfToDistrib; // Total number of surfaces the heater sends radiation to - Array1D_string SurfaceName; // Surface name in the list of surfaces heater sends radiation to - Array1D_int SurfacePtr; // Surface number in the list of surfaces heater sends radiation to - Array1D FracDistribToSurf; // Fraction of fraction radiant incident on the surface + RadControlType ControlType; // Control type for the system (MAT, MRT, or op temp) + Real64 ThrottlRange; // Throttling range for heating [C] + Sched::Schedule *setptSched = nullptr; // Schedule for the zone setpoint temperature + Real64 FracDistribPerson; // Fraction of fraction radiant incident on a "person" in the space + int TotSurfToDistrib; // Total number of surfaces the heater sends radiation to + Array1D_string SurfaceName; // Surface name in the list of surfaces heater sends radiation to + Array1D_int SurfacePtr; // Surface number in the list of surfaces heater sends radiation to + Array1D FracDistribToSurf; // Fraction of fraction radiant incident on the surface // Other parameters Real64 ZeroHTRSourceSumHATsurf; // used in baseboard energy balance Real64 QHTRRadSource; // Need to keep the last value in case we are still iterating @@ -126,11 +124,11 @@ namespace HighTempRadiantSystem { // Default Constructor HighTempRadiantSystemData() - : SchedPtr(0), ZonePtr(0), HeaterType(Constant::eResource::Invalid), MaxPowerCapac(0.0), CombustionEffic(0.0), FracRadiant(0.0), - FracLatent(0.0), FracLost(0.0), FracConvect(0.0), ControlType(RadControlType::Invalid), ThrottlRange(0.0), SetptSchedPtr(0), - FracDistribPerson(0.0), TotSurfToDistrib(0), ZeroHTRSourceSumHATsurf(0.0), QHTRRadSource(0.0), QHTRRadSrcAvg(0.0), - LastSysTimeElapsed(0.0), LastTimeStepSys(0.0), LastQHTRRadSrc(0.0), ElecPower(0.0), ElecEnergy(0.0), GasPower(0.0), GasEnergy(0.0), - HeatPower(0.0), HeatEnergy(0.0), HeatingCapMethod(DataSizing::DesignSizingType::Invalid), ScaledHeatingCapacity(0.0) + : ZonePtr(0), HeaterType(Constant::eResource::Invalid), MaxPowerCapac(0.0), CombustionEffic(0.0), FracRadiant(0.0), FracLatent(0.0), + FracLost(0.0), FracConvect(0.0), ControlType(RadControlType::Invalid), ThrottlRange(0.0), FracDistribPerson(0.0), TotSurfToDistrib(0), + ZeroHTRSourceSumHATsurf(0.0), QHTRRadSource(0.0), QHTRRadSrcAvg(0.0), LastSysTimeElapsed(0.0), LastTimeStepSys(0.0), + LastQHTRRadSrc(0.0), ElecPower(0.0), ElecEnergy(0.0), GasPower(0.0), GasEnergy(0.0), HeatPower(0.0), HeatEnergy(0.0), + HeatingCapMethod(DataSizing::DesignSizingType::Invalid), ScaledHeatingCapacity(0.0) { } }; @@ -201,6 +199,10 @@ struct HighTempRadiantSystemData : BaseGlobalStruct bool MyEnvrnFlag = true; bool ZoneEquipmentListChecked = false; // True after the Zone Equipment List has been checked for items + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/Humidifiers.cc b/src/EnergyPlus/Humidifiers.cc index e59b1dd8ec6..3cddf1625ca 100644 --- a/src/EnergyPlus/Humidifiers.cc +++ b/src/EnergyPlus/Humidifiers.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -103,7 +103,6 @@ namespace Humidifiers { // Using/Aliasing using namespace DataLoopNode; using HVAC::SmallMassFlow; - using namespace ScheduleManager; void SimHumidifier(EnergyPlusData &state, std::string_view CompName, // name of the humidifier unit @@ -215,6 +214,7 @@ namespace Humidifiers { // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetHumidifierInputs: "); // include trailing blank space + static constexpr std::string_view routineName = "GetHumidifierInputs"; // include trailing blank space // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int HumidifierIndex; // loop index @@ -276,28 +276,20 @@ namespace Humidifiers { lAlphaBlanks, cAlphaFields, cNumericFields); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; HumNum = HumidifierIndex; auto &Humidifier = state.dataHumidifiers->Humidifier(HumNum); GlobalNames::VerifyUniqueInterObjectName( state, state.dataHumidifiers->HumidifierUniqueNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); Humidifier.Name = Alphas(1); Humidifier.HumType = HumidType::Electric; - Humidifier.Sched = Alphas(2); + if (lAlphaBlanks(2)) { - Humidifier.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - Humidifier.SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (Humidifier.SchedPtr == 0) { - ShowSevereError(state, - format("{}{}: invalid {} entered ={} for {}={}", - RoutineName, - CurrentModuleObject, - cAlphaFields(2), - Alphas(2), - cAlphaFields(1), - Alphas(1))); - ErrorsFound = true; - } + Humidifier.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((Humidifier.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } Humidifier.NomCapVol = Numbers(1); Humidifier.NomPower = Numbers(2); @@ -348,28 +340,21 @@ namespace Humidifiers { lAlphaBlanks, cAlphaFields, cNumericFields); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + HumNum = NumElecSteamHums + HumidifierIndex; auto &Humidifier = state.dataHumidifiers->Humidifier(HumNum); GlobalNames::VerifyUniqueInterObjectName( state, state.dataHumidifiers->HumidifierUniqueNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); Humidifier.Name = Alphas(1); Humidifier.HumType = HumidType::Gas; - Humidifier.Sched = Alphas(2); + if (lAlphaBlanks(2)) { - Humidifier.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - Humidifier.SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (Humidifier.SchedPtr == 0) { - ShowSevereError(state, - format("{}{}: invalid {} entered ={} for {}={}", - RoutineName, - CurrentModuleObject, - cAlphaFields(2), - Alphas(2), - cAlphaFields(1), - Alphas(1))); - ErrorsFound = true; - } + Humidifier.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((Humidifier.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } Humidifier.NomCapVol = Numbers(1); Humidifier.NomPower = Numbers(2); // nominal gas use rate for gas fired steam humidifier @@ -708,8 +693,6 @@ namespace Humidifiers { // Using/Aliasing using DataSizing::AutoSize; - using FluidProperties::GetSatEnthalpyRefrig; - using FluidProperties::GetSpecificHeatGlycol; using Psychrometrics::PsyRhoAirFnPbTdbW; using Psychrometrics::RhoH2O; @@ -862,12 +845,12 @@ namespace Humidifiers { } NomCap = RhoH2O(Constant::InitConvTemp) * NomCapVol; - int RefrigerantIndex = FluidProperties::GetRefrigNum(state, format(fluidNameSteam)); - int WaterIndex = FluidProperties::GetGlycolNum(state, format(fluidNameWater)); - SteamSatEnthalpy = GetSatEnthalpyRefrig(state, format(fluidNameSteam), TSteam, 1.0, RefrigerantIndex, CalledFrom); - WaterSatEnthalpy = GetSatEnthalpyRefrig(state, format(fluidNameSteam), TSteam, 0.0, RefrigerantIndex, CalledFrom); - WaterSpecHeatAvg = 0.5 * (GetSpecificHeatGlycol(state, format(fluidNameWater), TSteam, WaterIndex, CalledFrom) + - GetSpecificHeatGlycol(state, format(fluidNameWater), Tref, WaterIndex, CalledFrom)); + + auto *water = Fluid::GetWater(state); + auto *steam = Fluid::GetSteam(state); + SteamSatEnthalpy = steam->getSatEnthalpy(state, TSteam, 1.0, CalledFrom); + WaterSatEnthalpy = steam->getSatEnthalpy(state, TSteam, 0.0, CalledFrom); + WaterSpecHeatAvg = 0.5 * (water->getSpecificHeat(state, TSteam, CalledFrom) + water->getSpecificHeat(state, Tref, CalledFrom)); NominalPower = NomCap * ((SteamSatEnthalpy - WaterSatEnthalpy) + WaterSpecHeatAvg * (TSteam - Tref)); if (NomPower == AutoSize) { @@ -1004,7 +987,7 @@ namespace Humidifiers { UnitOn = true; if (HumRatSet <= 0.0) UnitOn = false; if (AirInMassFlowRate <= SmallMassFlow) UnitOn = false; - if (GetCurrentScheduleValue(state, SchedPtr) <= 0.0) UnitOn = false; + if (availSched->getCurrentVal() <= 0.0) UnitOn = false; if (AirInHumRat >= HumRatSet) UnitOn = false; HumRatSatIn = PsyWFnTdbRhPb(state, AirInTemp, 1.0, state.dataEnvrn->OutBaroPress, RoutineName); if (AirInHumRat >= HumRatSatIn) UnitOn = false; @@ -1117,7 +1100,7 @@ namespace Humidifiers { } if (WaterAdd > 0.0) { ElecUseRate = (WaterAdd / NomCap) * NomPower + FanPower + StandbyPower; - } else if (GetCurrentScheduleValue(state, SchedPtr) > 0.0) { + } else if (availSched->getCurrentVal() > 0.0) { ElecUseRate = StandbyPower; } else { ElecUseRate = 0.0; @@ -1146,8 +1129,6 @@ namespace Humidifiers { // Using/Aliasing using Curve::CurveValue; - using FluidProperties::GetSatEnthalpyRefrig; - using FluidProperties::GetSpecificHeatGlycol; using Psychrometrics::PsyHFnTdbW; using Psychrometrics::PsyTdbFnHW; using Psychrometrics::PsyWFnTdbRhPb; @@ -1234,12 +1215,12 @@ namespace Humidifiers { CurMakeupWaterTemp = state.dataEnvrn->WaterMainsTemp; } Tref = CurMakeupWaterTemp; - int RefrigerantIndex = FluidProperties::GetRefrigNum(state, format(fluidNameSteam)); - int WaterIndex = FluidProperties::GetGlycolNum(state, format(fluidNameWater)); - SteamSatEnthalpy = GetSatEnthalpyRefrig(state, format(fluidNameSteam), TSteam, 1.0, RefrigerantIndex, RoutineName); - WaterSatEnthalpy = GetSatEnthalpyRefrig(state, format(fluidNameSteam), TSteam, 0.0, RefrigerantIndex, RoutineName); - WaterSpecHeatAvg = 0.5 * (GetSpecificHeatGlycol(state, format(fluidNameWater), TSteam, WaterIndex, RoutineName) + - GetSpecificHeatGlycol(state, format(fluidNameWater), Tref, WaterIndex, RoutineName)); + + auto *water = Fluid::GetWater(state); + auto *steam = Fluid::GetSteam(state); + SteamSatEnthalpy = steam->getSatEnthalpy(state, TSteam, 1.0, RoutineName); + WaterSatEnthalpy = steam->getSatEnthalpy(state, TSteam, 0.0, RoutineName); + WaterSpecHeatAvg = 0.5 * (water->getSpecificHeat(state, TSteam, RoutineName) + water->getSpecificHeat(state, Tref, RoutineName)); GasUseRateAtRatedEff = WaterAdd * ((SteamSatEnthalpy - WaterSatEnthalpy) + WaterSpecHeatAvg * (TSteam - Tref)) / ThermalEffRated; } PartLoadRatio = GasUseRateAtRatedEff / NomPower; @@ -1254,7 +1235,7 @@ namespace Humidifiers { } AuxElecUseRate = FanPower + StandbyPower; - } else if (GetCurrentScheduleValue(state, SchedPtr) > 0.0) { + } else if (availSched->getCurrentVal() > 0.0) { AuxElecUseRate = StandbyPower; } else { AuxElecUseRate = 0.0; diff --git a/src/EnergyPlus/Humidifiers.hh b/src/EnergyPlus/Humidifiers.hh index 91989b2fabb..29ee6e26afb 100644 --- a/src/EnergyPlus/Humidifiers.hh +++ b/src/EnergyPlus/Humidifiers.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -64,8 +64,6 @@ struct EnergyPlusData; namespace Humidifiers { static constexpr std::array HumidifierType = {"Humidifier:Steam:Electric", "Humidifier:Steam:Gas"}; - constexpr std::string_view fluidNameSteam = "STEAM"; - constexpr std::string_view fluidNameWater = "WATER"; enum class HumidType { @@ -90,39 +88,38 @@ namespace Humidifiers { private: public: // Members - std::string Name; // unique name of component - HumidType HumType; // Pointer to Humidifier in list of humidifiers - int EquipIndex; // Pointer to Humidifier in list of humidifiers - std::string Sched; // name of availability schedule - int SchedPtr; // index of availability schedule - Real64 NomCapVol; // nominal capacity [m3/s of water] - Real64 NomCap; // nominal capacity [kg/s of water] - Real64 NomPower; // power consumption at full output [watts] - Real64 ThermalEffRated; // rated thermal efficiency of the gas fired humidifier [-] - Real64 CurMakeupWaterTemp; // makeup water temperature from main water [C] - int EfficiencyCurvePtr; // index to efficiency curve - InletWaterTemp InletWaterTempOption; // type inlet water temperature fixed or variable - Real64 FanPower; // nominal fan power [watts] - Real64 StandbyPower; // standby power consumption [watts] - int AirInNode; // air inlet node of humidifier - int AirOutNode; // air outlet node of humidifier - Real64 AirInTemp; // inlet air temperature [C] - Real64 AirInHumRat; // inlet air humidity ratio [kg water / kg air] - Real64 AirInEnthalpy; // inlet air specific enthalpy [J/kg] - Real64 AirInMassFlowRate; // inlet air mass flow rate [kg/s] - Real64 AirOutTemp; // outlet air temperature [C] - Real64 AirOutHumRat; // outlet air humidity ratio [kg water / kg air] - Real64 AirOutEnthalpy; // outlet air specific enthalpy [J/kg] - Real64 AirOutMassFlowRate; // outlet air mass flow rate [kg/s] - Real64 HumRatSet; // humidity ratio setpoint [kg water / kg air] - Real64 WaterAdd; // water output (and consumption) [kg/s] - Real64 ElecUseEnergy; // electricity consumption [J] - Real64 ElecUseRate; // electricity consumption [W] - Real64 WaterCons; // water consumption in cubic meters - Real64 WaterConsRate; // water consumption rate in m3/s - bool SuppliedByWaterSystem; // true means there is storage tank, otherwise mains - int WaterTankID; // index pointer to water storage tank - int WaterTankDemandARRID; // index pointer to WaterStorage Demand arrays. + std::string Name; // unique name of component + HumidType HumType; // Pointer to Humidifier in list of humidifiers + int EquipIndex; // Pointer to Humidifier in list of humidifiers + Sched::Schedule *availSched = nullptr; // availability schedule + Real64 NomCapVol; // nominal capacity [m3/s of water] + Real64 NomCap; // nominal capacity [kg/s of water] + Real64 NomPower; // power consumption at full output [watts] + Real64 ThermalEffRated; // rated thermal efficiency of the gas fired humidifier [-] + Real64 CurMakeupWaterTemp; // makeup water temperature from main water [C] + int EfficiencyCurvePtr; // index to efficiency curve + InletWaterTemp InletWaterTempOption; // type inlet water temperature fixed or variable + Real64 FanPower; // nominal fan power [watts] + Real64 StandbyPower; // standby power consumption [watts] + int AirInNode; // air inlet node of humidifier + int AirOutNode; // air outlet node of humidifier + Real64 AirInTemp; // inlet air temperature [C] + Real64 AirInHumRat; // inlet air humidity ratio [kg water / kg air] + Real64 AirInEnthalpy; // inlet air specific enthalpy [J/kg] + Real64 AirInMassFlowRate; // inlet air mass flow rate [kg/s] + Real64 AirOutTemp; // outlet air temperature [C] + Real64 AirOutHumRat; // outlet air humidity ratio [kg water / kg air] + Real64 AirOutEnthalpy; // outlet air specific enthalpy [J/kg] + Real64 AirOutMassFlowRate; // outlet air mass flow rate [kg/s] + Real64 HumRatSet; // humidity ratio setpoint [kg water / kg air] + Real64 WaterAdd; // water output (and consumption) [kg/s] + Real64 ElecUseEnergy; // electricity consumption [J] + Real64 ElecUseRate; // electricity consumption [W] + Real64 WaterCons; // water consumption in cubic meters + Real64 WaterConsRate; // water consumption rate in m3/s + bool SuppliedByWaterSystem; // true means there is storage tank, otherwise mains + int WaterTankID; // index pointer to water storage tank + int WaterTankDemandARRID; // index pointer to WaterStorage Demand arrays. Real64 TankSupplyVdot; Real64 TankSupplyVol; Real64 StarvedSupplyVdot; @@ -140,13 +137,13 @@ namespace Humidifiers { // Default Constructor HumidifierData() - : HumType(HumidType::Invalid), EquipIndex(0), SchedPtr(0), NomCapVol(0.0), NomCap(0.0), NomPower(0.0), ThermalEffRated(1.0), - CurMakeupWaterTemp(0.0), EfficiencyCurvePtr(0), InletWaterTempOption(InletWaterTemp::Invalid), FanPower(0.0), StandbyPower(0.0), - AirInNode(0), AirOutNode(0), AirInTemp(0.0), AirInHumRat(0.0), AirInEnthalpy(0.0), AirInMassFlowRate(0.0), AirOutTemp(0.0), - AirOutHumRat(0.0), AirOutEnthalpy(0.0), AirOutMassFlowRate(0.0), HumRatSet(0.0), WaterAdd(0.0), ElecUseEnergy(0.0), ElecUseRate(0.0), - WaterCons(0.0), WaterConsRate(0.0), SuppliedByWaterSystem(false), WaterTankID(0), WaterTankDemandARRID(0), TankSupplyVdot(0.0), - TankSupplyVol(0.0), StarvedSupplyVdot(0.0), StarvedSupplyVol(0.0), TankSupplyID(0), MySizeFlag(true), MyEnvrnFlag(true), - MySetPointCheckFlag(true), ThermalEff(0.0), GasUseRate(0.0), GasUseEnergy(0.0), AuxElecUseRate(0.0), AuxElecUseEnergy(0.0) + : HumType(HumidType::Invalid), EquipIndex(0), NomCapVol(0.0), NomCap(0.0), NomPower(0.0), ThermalEffRated(1.0), CurMakeupWaterTemp(0.0), + EfficiencyCurvePtr(0), InletWaterTempOption(InletWaterTemp::Invalid), FanPower(0.0), StandbyPower(0.0), AirInNode(0), AirOutNode(0), + AirInTemp(0.0), AirInHumRat(0.0), AirInEnthalpy(0.0), AirInMassFlowRate(0.0), AirOutTemp(0.0), AirOutHumRat(0.0), AirOutEnthalpy(0.0), + AirOutMassFlowRate(0.0), HumRatSet(0.0), WaterAdd(0.0), ElecUseEnergy(0.0), ElecUseRate(0.0), WaterCons(0.0), WaterConsRate(0.0), + SuppliedByWaterSystem(false), WaterTankID(0), WaterTankDemandARRID(0), TankSupplyVdot(0.0), TankSupplyVol(0.0), StarvedSupplyVdot(0.0), + StarvedSupplyVol(0.0), TankSupplyID(0), MySizeFlag(true), MyEnvrnFlag(true), MySetPointCheckFlag(true), ThermalEff(0.0), + GasUseRate(0.0), GasUseEnergy(0.0), AuxElecUseRate(0.0), AuxElecUseEnergy(0.0) { } @@ -197,6 +194,10 @@ struct HumidifiersData : BaseGlobalStruct Array1D Humidifier; std::unordered_map HumidifierUniqueNames; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/HybridEvapCoolingModel.cc b/src/EnergyPlus/HybridEvapCoolingModel.cc index 43fc5c8108d..43826675439 100644 --- a/src/EnergyPlus/HybridEvapCoolingModel.cc +++ b/src/EnergyPlus/HybridEvapCoolingModel.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -90,8 +90,8 @@ namespace HybridEvapCoolingModel { using Curve::CurveValue; using Curve::GetCurveIndex; using Curve::GetCurveMinMaxValues; - using ScheduleManager::GetCurrentScheduleValue; +// Ummm these will have to go #define DEF_Tdb 0 #define DEF_RH 1 @@ -126,7 +126,7 @@ namespace HybridEvapCoolingModel { bool CMode::InitializeOutdoorAirHumidityRatioConstraints(Real64 min, Real64 max) { // minimum 0.00 maximum 0.10, units kgWater / kgDryAir - // note Mode0 will not be considerd when outside air absolute humidity is below the value in this field. + // note Mode0 will not be considered when outside air absolute humidity is below the value in this field. // note If this field is blank, the lower constraint on outside air humidity ratio will be 0.00 kgWater / kgDryAir., default 0.00 // the upper constraint on outside air humidity ratio will be 0.10 kgWater / kgDryAir, default 0.10 Minimum_Outdoor_Air_Humidity_Ratio = min; @@ -154,7 +154,7 @@ namespace HybridEvapCoolingModel { bool CMode::InitializeReturnAirHumidityRatioConstraints(Real64 min, Real64 max) { // minimum 0.00 maximum 0.10, units kgWater / kgDryAir - // note Mode0 will not be considerd when outside air absolute humidity is below the value in this field. + // note Mode0 will not be considered when outside air absolute humidity is below the value in this field. // note If this field is blank, the lower constraint on outside air humidity ratio will be 0.00 kgWater / kgDryAir., default 0.00 // the upper constraint on outside air humidity ratio will be 0.10 kgWater / kgDryAir, default 0.10 Minimum_Return_Air_Humidity_Ratio = min; @@ -425,7 +425,7 @@ namespace HybridEvapCoolingModel { // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // Does the processing of each of the seperate modes + // Does the processing of each of the separate modes // METHODOLOGY EMPLOYED: // As the number of modes defined in the idf is not known until its read in, this method uses two counters to keep track of the inputs in the @@ -713,7 +713,7 @@ namespace HybridEvapCoolingModel { } } - bool Model::MeetsSupplyAirTOC(EnergyPlusData &state, Real64 Tsupplyair) + bool Model::MeetsSupplyAirTOC([[maybe_unused]] EnergyPlusData &state, Real64 Tsupplyair) { // SUBROUTINE INFORMATION: // AUTHOR Spencer Maxwell Dutton @@ -722,7 +722,7 @@ namespace HybridEvapCoolingModel { // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // To check to see if this this particular setting (combination of mode, OSAF and Msa) meets the required minumum + // To check to see if this this particular setting (combination of mode, OSAF and Msa) meets the required minimum // supply air temperature specified in the schedules // METHODOLOGY EMPLOYED: @@ -734,17 +734,17 @@ namespace HybridEvapCoolingModel { // Using/Aliasing Real64 MinSAT = 10; Real64 MaxSAT = 20; - if (TsaMin_schedule_pointer > 0) { - MinSAT = GetCurrentScheduleValue(state, TsaMin_schedule_pointer); + if (TsaMinSched != nullptr) { + MinSAT = TsaMinSched->getCurrentVal(); } - if (TsaMax_schedule_pointer > 0) { - MaxSAT = GetCurrentScheduleValue(state, TsaMax_schedule_pointer); + if (TsaMaxSched != nullptr) { + MaxSAT = TsaMaxSched->getCurrentVal(); } if (Tsupplyair < MinSAT || Tsupplyair > MaxSAT) return false; return true; } - bool Model::MeetsSupplyAirRHOC(EnergyPlusData &state, Real64 SupplyW) + bool Model::MeetsSupplyAirRHOC([[maybe_unused]] EnergyPlusData &state, Real64 SupplyW) { // SUBROUTINE INFORMATION: // AUTHOR Spencer Maxwell Dutton @@ -753,7 +753,7 @@ namespace HybridEvapCoolingModel { // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // To check to see if this this particular setting (combination of mode, OSAF and Msa) meets the required minumum + // To check to see if this this particular setting (combination of mode, OSAF and Msa) meets the required minimum // supply air relative humidity specified in the schedules // METHODOLOGY EMPLOYED: @@ -765,40 +765,38 @@ namespace HybridEvapCoolingModel { // Using/Aliasing Real64 MinRH = 0; Real64 MaxRH = 1; - if (RHsaMin_schedule_pointer > 0) { - MinRH = GetCurrentScheduleValue(state, RHsaMin_schedule_pointer); + if (RHsaMinSched != nullptr) { + MinRH = RHsaMinSched->getCurrentVal(); } - if (RHsaMax_schedule_pointer > 0) { - MaxRH = GetCurrentScheduleValue(state, RHsaMax_schedule_pointer); + if (RHsaMaxSched != nullptr) { + MaxRH = RHsaMaxSched->getCurrentVal(); } if (SupplyW < MinRH || SupplyW > MaxRH) return false; return true; } Model::Model() - : Initialized(false), ZoneNum(0), SchedPtr(0), SystemMaximumSupplyAirFlowRate(0.0), ScalingFactor(0.0), - ScaledSystemMaximumSupplyAirMassFlowRate(0.0), UnitOn(0), UnitTotalCoolingRate(0.0), UnitTotalCoolingEnergy(0.0), - UnitSensibleCoolingRate(0.0), UnitSensibleCoolingEnergy(0.0), UnitLatentCoolingRate(0.0), UnitLatentCoolingEnergy(0.0), - SystemTotalCoolingRate(0.0), SystemTotalCoolingEnergy(0.0), SystemSensibleCoolingRate(0.0), SystemSensibleCoolingEnergy(0.0), - SystemLatentCoolingRate(0.0), SystemLatentCoolingEnergy(0.0), UnitTotalHeatingRate(0.0), UnitTotalHeatingEnergy(0.0), - UnitSensibleHeatingRate(0.0), UnitSensibleHeatingEnergy(0.0), UnitLatentHeatingRate(0.0), UnitLatentHeatingEnergy(0.0), - SystemTotalHeatingRate(0.0), SystemTotalHeatingEnergy(0.0), SystemSensibleHeatingRate(0.0), SystemSensibleHeatingEnergy(0.0), - SystemLatentHeatingRate(0.0), SystemLatentHeatingEnergy(0.0), SupplyFanElectricPower(0.0), SupplyFanElectricEnergy(0.0), - SecondaryFuelConsumptionRate(0.0), SecondaryFuelConsumption(0.0), ThirdFuelConsumptionRate(0.0), ThirdFuelConsumption(0.0), - WaterConsumptionRate(0.0), WaterConsumption(0.0), QSensZoneOut(0), QLatentZoneOut(0), QLatentZoneOutMass(0), ExternalStaticPressure(0.0), - RequestedHumdificationMass(0.0), RequestedHumdificationLoad(0.0), RequestedHumdificationEnergy(0.0), RequestedDeHumdificationMass(0.0), - RequestedDeHumdificationLoad(0.0), RequestedDeHumdificationEnergy(0.0), RequestedLoadToHeatingSetpoint(0.0), - RequestedLoadToCoolingSetpoint(0.0), TsaMin_schedule_pointer(0), TsaMax_schedule_pointer(0), RHsaMin_schedule_pointer(0), - RHsaMax_schedule_pointer(0), PrimaryMode(0), PrimaryModeRuntimeFraction(0.0), averageOSAF(0), ErrorCode(0), InletNode(0), OutletNode(0), - SecondaryInletNode(0), SecondaryOutletNode(0), FinalElectricalPower(0.0), FinalElectricalEnergy(0.0), InletMassFlowRate(0.0), - InletTemp(0.0), InletWetBulbTemp(0.0), InletHumRat(0.0), InletEnthalpy(0.0), InletPressure(0.0), InletRH(0.0), - OutletVolumetricFlowRate(0.0), OutletMassFlowRate(0.0), PowerLossToAir(0.0), FanHeatTemp(0.0), OutletTemp(0.0), OutletWetBulbTemp(0.0), - OutletHumRat(0.0), OutletEnthalpy(0.0), OutletPressure(0.0), OutletRH(0.0), SecInletMassFlowRate(0.0), SecInletTemp(0.0), - SecInletWetBulbTemp(0.0), SecInletHumRat(0.0), SecInletEnthalpy(0.0), SecInletPressure(0.0), SecInletRH(0.0), SecOutletMassFlowRate(0.0), - SecOutletTemp(0.0), SecOutletWetBulbTemp(0.0), SecOutletHumRat(0.0), SecOutletEnthalpy(0.0), SecOutletPressure(0.0), SecOutletRH(0.0), - Wsa(0.0), SupplyVentilationAir(0.0), SupplyVentilationVolume(0.0), OutdoorAir(false), MinOA_Msa(0.0), OARequirementsPtr(0), Tsa(0.0), - ModeCounter(0), CoolingRequested(false), HeatingRequested(false), VentilationRequested(false), DehumidificationRequested(false), - HumidificationRequested(false) + : Initialized(false), ZoneNum(0), SystemMaximumSupplyAirFlowRate(0.0), ScalingFactor(0.0), ScaledSystemMaximumSupplyAirMassFlowRate(0.0), + UnitOn(0), UnitTotalCoolingRate(0.0), UnitTotalCoolingEnergy(0.0), UnitSensibleCoolingRate(0.0), UnitSensibleCoolingEnergy(0.0), + UnitLatentCoolingRate(0.0), UnitLatentCoolingEnergy(0.0), SystemTotalCoolingRate(0.0), SystemTotalCoolingEnergy(0.0), + SystemSensibleCoolingRate(0.0), SystemSensibleCoolingEnergy(0.0), SystemLatentCoolingRate(0.0), SystemLatentCoolingEnergy(0.0), + UnitTotalHeatingRate(0.0), UnitTotalHeatingEnergy(0.0), UnitSensibleHeatingRate(0.0), UnitSensibleHeatingEnergy(0.0), + UnitLatentHeatingRate(0.0), UnitLatentHeatingEnergy(0.0), SystemTotalHeatingRate(0.0), SystemTotalHeatingEnergy(0.0), + SystemSensibleHeatingRate(0.0), SystemSensibleHeatingEnergy(0.0), SystemLatentHeatingRate(0.0), SystemLatentHeatingEnergy(0.0), + SupplyFanElectricPower(0.0), SupplyFanElectricEnergy(0.0), SecondaryFuelConsumptionRate(0.0), SecondaryFuelConsumption(0.0), + ThirdFuelConsumptionRate(0.0), ThirdFuelConsumption(0.0), WaterConsumptionRate(0.0), WaterConsumption(0.0), QSensZoneOut(0), + QLatentZoneOut(0), QLatentZoneOutMass(0), ExternalStaticPressure(0.0), RequestedHumidificationMass(0.0), RequestedHumidificationLoad(0.0), + RequestedHumidificationEnergy(0.0), RequestedDeHumidificationMass(0.0), RequestedDeHumidificationLoad(0.0), + RequestedDeHumidificationEnergy(0.0), RequestedLoadToHeatingSetpoint(0.0), RequestedLoadToCoolingSetpoint(0.0), PrimaryMode(0), + PrimaryModeRuntimeFraction(0.0), averageOSAF(0), ErrorCode(0), InletNode(0), OutletNode(0), SecondaryInletNode(0), SecondaryOutletNode(0), + FinalElectricalPower(0.0), FinalElectricalEnergy(0.0), InletMassFlowRate(0.0), InletTemp(0.0), InletWetBulbTemp(0.0), InletHumRat(0.0), + InletEnthalpy(0.0), InletPressure(0.0), InletRH(0.0), OutletVolumetricFlowRate(0.0), OutletMassFlowRate(0.0), PowerLossToAir(0.0), + FanHeatTemp(0.0), OutletTemp(0.0), OutletWetBulbTemp(0.0), OutletHumRat(0.0), OutletEnthalpy(0.0), OutletPressure(0.0), OutletRH(0.0), + SecInletMassFlowRate(0.0), SecInletTemp(0.0), SecInletWetBulbTemp(0.0), SecInletHumRat(0.0), SecInletEnthalpy(0.0), SecInletPressure(0.0), + SecInletRH(0.0), SecOutletMassFlowRate(0.0), SecOutletTemp(0.0), SecOutletWetBulbTemp(0.0), SecOutletHumRat(0.0), SecOutletEnthalpy(0.0), + SecOutletPressure(0.0), SecOutletRH(0.0), Wsa(0.0), SupplyVentilationAir(0.0), SupplyVentilationVolume(0.0), OutdoorAir(false), + MinOA_Msa(0.0), OARequirementsPtr(0), Tsa(0.0), ModeCounter(0), CoolingRequested(false), HeatingRequested(false), + VentilationRequested(false), DehumidificationRequested(false), HumidificationRequested(false) { WarnOnceFlag = false; count_EnvironmentConditionsMetOnce = 0; @@ -991,7 +989,7 @@ namespace HybridEvapCoolingModel { // METHODOLOGY EMPLOYED: // For longer simulation timesteps this model can consider partial runtime fractions - // operating in different settings for a fraction of the total simulation time step reducing the likelyhood of over conditioning. + // operating in different settings for a fraction of the total simulation time step reducing the likelihood of over conditioning. // Intensive variables that do not depend on system size (like temperature, pressure,etc), and extensive variables (variable whose values // depend on the quantity of substance) are handled differently // @@ -1000,7 +998,7 @@ namespace HybridEvapCoolingModel { // resultant time step average mass flow rate would be 1 kg/s. // Intensive values in each part runtime fraction are first multiplied by the Scaled Supply Air Mass Flow Rate for each setting - // and then once all the various runtime fractions are added up, the resultant is divided by the overal time step average Scaled Supply Air + // and then once all the various runtime fractions are added up, the resultant is divided by the overall time step average Scaled Supply Air // Mass Flow Rate // // REFERENCES: @@ -1011,7 +1009,7 @@ namespace HybridEvapCoolingModel { Real64 MassFlowDependentDenominator = 0; Real64 value = 0; - for (auto &thisOperatingSettings : CurrentOperatingSettings) { + for (auto const &thisOperatingSettings : CurrentOperatingSettings) { switch (val) { case SYSTEMOUTPUTS::VENTILATION_AIR_V: value = thisOperatingSettings.ScaledSupply_Air_Ventilation_Volume; @@ -1199,14 +1197,14 @@ namespace HybridEvapCoolingModel { // -> settings that do are stored in the a container (Settings) // 3) Iterate through all the settings in Settings // - // 4) Calculate the setting zone sensible cooling and heating load and humidifcation and dehumidifcation. + // 4) Calculate the setting zone sensible cooling and heating load and humidification and dehumidification. // 5) Test to see if conditioning and humidification loads are met. // 6) Calculate setting power consumption, use the setting delivered ventilation and loads to calculate the // 7) minimum runtime fraction needed to meet those loads, then assuming that part runtime fraction calculate the setting part run time power // use. 8) If the setting meets both the conditioning and humidification loads then test to see if its optimal in terms of energy use. // ->if so, save that setting as the current optimal. // ->if not ignore it. - // If the setting failed ot meet either the conditioning or humidification loads, then + // If the setting failed to meet either the conditioning or humidification loads, then // -> firstly check to see if no previous other setting (in this calculation step) has met both the load and humidification requirements // -> if so // -> check if this setting meets the conditioning load (only) @@ -1224,7 +1222,7 @@ namespace HybridEvapCoolingModel { // -> if so: then ignore it. // ->if not, then a previous setting is better than this one by default, and so ignore it. // 9) Identify error states if the no setting meets the environmental conditions, or the supply air humidity or temperature constraints. - // 10) if we met the load set operating settings to be a combination of the optimal setting at the minium required runtime fraction + // 10) if we met the load set operating settings to be a combination of the optimal setting at the minimum required runtime fraction // 11) if we partly met the load then do the best we can and run full out in that optimal setting. // 12) if we didn't even partially meet the load make sure the operational settings are just the standby mode. // 13) generate summary statistics for warnings. @@ -1483,12 +1481,12 @@ namespace HybridEvapCoolingModel { bool Humidification_load_met = false; - Real64 RequestedDeHumdificationLoad = StepIns.ZoneDehumidificationLoad; - if (DehumidificationRequested && latentRoomORZone > RequestedDeHumdificationLoad) { + Real64 RequestedDeHumidificationLoad = StepIns.ZoneDehumidificationLoad; + if (DehumidificationRequested && latentRoomORZone > RequestedDeHumidificationLoad) { Humidification_load_met = true; } - Real64 RequestedHumdificationLoad = StepIns.ZoneMoistureLoad; - if (HumidificationRequested && latentRoomORZone < RequestedHumdificationLoad) { + Real64 RequestedHumidificationLoad = StepIns.ZoneMoistureLoad; + if (HumidificationRequested && latentRoomORZone < RequestedHumidificationLoad) { Humidification_load_met = true; } @@ -1581,7 +1579,7 @@ namespace HybridEvapCoolingModel { count_SAT_OC_MetOnce++; ErrorCode = 3; } - // if we met the load set operating settings to be a combination of the optimal setting at the minium required runtime fraction + // if we met the load set operating settings to be a combination of the optimal setting at the minimum required runtime fraction if (DidWeMeetLoad) { // add first setting to operating modes ErrorCode = 0; @@ -1677,7 +1675,7 @@ namespace HybridEvapCoolingModel { // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // retunrs the primary mode of operation + // returns the primary mode of operation // METHODOLOGY EMPLOYED: // @@ -1724,7 +1722,7 @@ namespace HybridEvapCoolingModel { // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // Sets member boolean variables to establish if the Cooling, Heating, ventilation or dehumidifcation needs are met. + // Sets member boolean variables to establish if the Cooling, Heating, ventilation or dehumidification needs are met. // METHODOLOGY EMPLOYED: // @@ -1764,7 +1762,7 @@ namespace HybridEvapCoolingModel { // doStep is passed some variables that could have just used the class members, but this adds clarity about whats needed, especially helpful in // unit testing void Model::doStep(EnergyPlusData &state, - Real64 RequestedCoolingLoad, // in joules, cooling load as negitive + Real64 RequestedCoolingLoad, // in joules, cooling load as negative Real64 RequestedHeatingLoad, // in joules, heating load as positive Real64 OutputRequiredToHumidify, // Load required to meet humidifying setpoint (>0 = a humidify load) [kgWater/s] Real64 OutputRequiredToDehumidify, // Load required to meet dehumidifying setpoint (<0 = a dehumidify load) [kgWater/s] @@ -1785,7 +1783,7 @@ namespace HybridEvapCoolingModel { // CoolingRequested, HeatingRequested, VentilationRequested, DehumidificationRequested, HumidificationRequested // 4)Take the first operating mode which is always standby and calculate the use curves to determine performance metrics for // the standby mode including energy use and other outputs - // 5)Test system availbility status and go into standby if unit is off or not needed (booleans listed in 3 are all false) + // 5)Test system availability status and go into standby if unit is off or not needed (booleans listed in 3 are all false) // 6) Set the operating conditions and respective part load fractions. // 7) Set timestep average outlet condition, considering all operating conditions and runtimes. // METHODOLOGY EMPLOYED: @@ -1798,13 +1796,13 @@ namespace HybridEvapCoolingModel { RequestedLoadToHeatingSetpoint = RequestedHeatingLoad; RequestedLoadToCoolingSetpoint = RequestedCoolingLoad; Real64 LambdaRa = Psychrometrics::PsyHfgAirFnWTdb(0, InletTemp); - RequestedHumdificationMass = OutputRequiredToHumidify; - RequestedHumdificationLoad = OutputRequiredToHumidify * LambdaRa; // [W]; - RequestedHumdificationEnergy = OutputRequiredToHumidify * LambdaRa * state.dataHVACGlobal->TimeStepSysSec; // [j] + RequestedHumidificationMass = OutputRequiredToHumidify; + RequestedHumidificationLoad = OutputRequiredToHumidify * LambdaRa; // [W]; + RequestedHumidificationEnergy = OutputRequiredToHumidify * LambdaRa * state.dataHVACGlobal->TimeStepSysSec; // [j] - RequestedDeHumdificationMass = OutputRequiredToDehumidify; - RequestedDeHumdificationLoad = OutputRequiredToDehumidify * LambdaRa; // [W]; - RequestedDeHumdificationEnergy = OutputRequiredToDehumidify * LambdaRa * state.dataHVACGlobal->TimeStepSysSec; // [j] + RequestedDeHumidificationMass = OutputRequiredToDehumidify; + RequestedDeHumidificationLoad = OutputRequiredToDehumidify * LambdaRa; // [W]; + RequestedDeHumidificationEnergy = OutputRequiredToDehumidify * LambdaRa * state.dataHVACGlobal->TimeStepSysSec; // [j] MinOA_Msa = DesignMinVR; // as mass flow kg/s @@ -1819,8 +1817,8 @@ namespace HybridEvapCoolingModel { StepIns.RequestedCoolingLoad = -RequestedCoolingLoad; // Cooling positive now, heating negative StepIns.RequestedHeatingLoad = -RequestedHeatingLoad; // Cooling positive now, heating negative - StepIns.ZoneMoistureLoad = RequestedHumdificationLoad; - StepIns.ZoneDehumidificationLoad = RequestedDeHumdificationLoad; + StepIns.ZoneMoistureLoad = RequestedHumidificationLoad; + StepIns.ZoneDehumidificationLoad = RequestedDeHumidificationLoad; StepIns.MinimumOA = DesignMinVR; // calculate W humidity ratios for outdoor air and return air Real64 Wosa = PsyWFnTdbRhPb(state, StepIns.Tosa, StepIns.RHosa, state.dataEnvrn->OutBaroPress); @@ -1835,7 +1833,7 @@ namespace HybridEvapCoolingModel { if (SetStandByMode(state, Mode, StepIns.Tosa, Wosa, StepIns.Tra, Wra)) { std::string ObjectID = Name.c_str(); ShowSevereError(state, - format("Standby mode not defined correctly, as the mode is defined there are zero combinations of acceptible outside air " + format("Standby mode not defined correctly, as the mode is defined there are zero combinations of acceptable outside air " "fractions and supply air mass flow rate, called in object {}", ObjectID)); } @@ -1843,7 +1841,7 @@ namespace HybridEvapCoolingModel { UnitOn = 1; bool ForceOff = false; StandBy = false; - if (GetCurrentScheduleValue(state, SchedPtr) <= 0 || availStatus == Avail::Status::ForceOff) { + if (availSched->getCurrentVal() <= 0 || availStatus == Avail::Status::ForceOff) { UnitOn = 0; ForceOff = true; } @@ -1876,7 +1874,7 @@ namespace HybridEvapCoolingModel { Real64 QSensSystemOut = 0; Real64 QLatentSystemOut = 0; // Even if its off or in standby we still need to continue to calculate standby loads - // All powers are calculated in Watts amd energies in Joules + // All powers are calculated in Watts and energies in Joules SupplyVentilationVolume = CalculateTimeStepAverage(SYSTEMOUTPUTS::VENTILATION_AIR_V); if (state.dataEnvrn->StdRhoAir > 1) { diff --git a/src/EnergyPlus/HybridEvapCoolingModel.hh b/src/EnergyPlus/HybridEvapCoolingModel.hh index c4309a2eea7..283a8d7ec38 100644 --- a/src/EnergyPlus/HybridEvapCoolingModel.hh +++ b/src/EnergyPlus/HybridEvapCoolingModel.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -57,7 +57,6 @@ // ObjexxFCL Headers #include -#include #define MINIMUM_LOAD_TO_ACTIVATE 0.5 // (kw) sets a minimum load to avoid the system fluttering on and off. #define IMPLAUSIBLE_POWER 10000000 @@ -230,14 +229,13 @@ namespace HybridEvapCoolingModel { Model(); // Default Constructor - std::string Name; // user identifier - std::string Schedule; // Availability Schedule Name - bool Initialized; // initialization flag ensures the system object is initialized only once. - int ZoneNum; // stores the current zone associated with the system, this is currently not used but is expected to be used in the next set of - // functionality additions. - int SchedPtr; // Pointer to the correct schedule - int ZoneNodeNum; // index of zone air node in node structure - std::string AvailManagerListName; // Name of an availability manager list object + std::string Name; // user identifier + bool Initialized; // initialization flag ensures the system object is initialized only once. + int ZoneNum; // stores the current zone associated with the system, this is currently not used but is expected to be used in the next set of + // functionality additions. + Sched::Schedule *availSched = nullptr; // Pointer to the correct schedule + int ZoneNodeNum; // index of zone air node in node structure + std::string AvailManagerListName; // Name of an availability manager list object Avail::Status availStatus = Avail::Status::NoAction; Real64 SystemMaximumSupplyAirFlowRate; // taken from IDF N1, the system max supply flow rate in m3/s. @@ -288,18 +286,18 @@ namespace HybridEvapCoolingModel { Real64 QLatentZoneOut; // W Real64 QLatentZoneOutMass; // kg/s Real64 ExternalStaticPressure; // - Real64 RequestedHumdificationMass; - Real64 RequestedHumdificationLoad; - Real64 RequestedHumdificationEnergy; - Real64 RequestedDeHumdificationMass; - Real64 RequestedDeHumdificationLoad; - Real64 RequestedDeHumdificationEnergy; + Real64 RequestedHumidificationMass; + Real64 RequestedHumidificationLoad; + Real64 RequestedHumidificationEnergy; + Real64 RequestedDeHumidificationMass; + Real64 RequestedDeHumidificationLoad; + Real64 RequestedDeHumidificationEnergy; Real64 RequestedLoadToHeatingSetpoint; Real64 RequestedLoadToCoolingSetpoint; - int TsaMin_schedule_pointer; - int TsaMax_schedule_pointer; - int RHsaMin_schedule_pointer; - int RHsaMax_schedule_pointer; + Sched::Schedule *TsaMinSched = nullptr; + Sched::Schedule *TsaMaxSched = nullptr; + Sched::Schedule *RHsaMinSched = nullptr; + Sched::Schedule *RHsaMaxSched = nullptr; int PrimaryMode; Real64 PrimaryModeRuntimeFraction; Real64 averageOSAF; diff --git a/src/EnergyPlus/HybridModel.cc b/src/EnergyPlus/HybridModel.cc index 48e06543b2a..2203c229dad 100644 --- a/src/EnergyPlus/HybridModel.cc +++ b/src/EnergyPlus/HybridModel.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -83,9 +83,6 @@ namespace HybridModel { void GetHybridModelZone(EnergyPlusData &state) { - - using ScheduleManager::GetScheduleIndex; - Array1D_bool lAlphaFieldBlanks(16, false); Array1D_bool lNumericFieldBlanks(4, false); std::string CurrentModuleObject; // to assist in getting input @@ -99,7 +96,7 @@ namespace HybridModel { state.dataHybridModel->NumOfHybridModelZones = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); if (state.dataHybridModel->NumOfHybridModelZones > 0) { - state.dataHybridModel->HybridModelZone.allocate(state.dataGlobal->NumOfZones); + state.dataHybridModel->hybridModelZones.allocate(state.dataGlobal->NumOfZones); bool ErrorsFound = false; // If errors detected in input int NumAlphas = 0; // Number of Alphas for each GetobjectItem call int NumNumbers = 0; // Number of Numbers for each GetobjectItem call @@ -122,42 +119,43 @@ namespace HybridModel { ZonePtr = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone); // "Zone" is a 1D array, cAlphaArgs(2) is the zone name if (ZonePtr > 0) { - state.dataHybridModel->HybridModelZone(ZonePtr).Name = cAlphaArgs(1); // Zone HybridModel name + auto &hmZone = state.dataHybridModel->hybridModelZones(ZonePtr); + hmZone.Name = cAlphaArgs(1); // Zone HybridModel name state.dataHybridModel->FlagHybridModel_TM = Util::SameString(cAlphaArgs(3), "Yes"); // Calculate thermal mass option state.dataHybridModel->FlagHybridModel_AI = Util::SameString(cAlphaArgs(4), "Yes"); // Calculate infiltration rate option state.dataHybridModel->FlagHybridModel_PC = Util::SameString(cAlphaArgs(5), "Yes"); // Calculate people count option // Pointers used to help decide which unknown parameter to solve // Zone Air Infiltration Rate and Zone Internal Thermal Mass calculations cannot be performed simultaneously - int TemperatureSchPtr = GetScheduleIndex(state, cAlphaArgs(6)); - int HumidityRatioSchPtr = GetScheduleIndex(state, cAlphaArgs(7)); - int CO2ConcentrationSchPtr = GetScheduleIndex(state, cAlphaArgs(8)); + Sched::Schedule *temperatureSched = Sched::GetSchedule(state, cAlphaArgs(6)); + Sched::Schedule *humidityRatioSched = Sched::GetSchedule(state, cAlphaArgs(7)); + Sched::Schedule *CO2ConcentrationSched = Sched::GetSchedule(state, cAlphaArgs(8)); // Not used for now - int PeopleActivityLevelSchPtr = GetScheduleIndex(state, cAlphaArgs(9)); - int PeopleSensibleFractionSchPtr = GetScheduleIndex(state, cAlphaArgs(10)); - int PeopleRadiantFractionSchPtr = GetScheduleIndex(state, cAlphaArgs(11)); - int PeopleCO2GenRateSchPtr = GetScheduleIndex(state, cAlphaArgs(12)); + Sched::Schedule *peopleActivityLevelSched = Sched::GetSchedule(state, cAlphaArgs(9)); + Sched::Schedule *peopleSensibleFractionSched = Sched::GetSchedule(state, cAlphaArgs(10)); + Sched::Schedule *peopleRadiantFractionSched = Sched::GetSchedule(state, cAlphaArgs(11)); + Sched::Schedule *peopleCO2GenRateSched = Sched::GetSchedule(state, cAlphaArgs(12)); // Pointers used to help decide wheather to include system supply terms in the inverse algorithms - int SupplyAirTemperatureSchPtr = GetScheduleIndex(state, cAlphaArgs(13)); - int SupplyAirMassFlowRateSchPtr = GetScheduleIndex(state, cAlphaArgs(14)); - int SupplyAirHumidityRatioSchPtr = GetScheduleIndex(state, cAlphaArgs(15)); - int SupplyAirCO2ConcentrationSchPtr = GetScheduleIndex(state, cAlphaArgs(16)); + Sched::Schedule *supplyAirTemperatureSched = Sched::GetSchedule(state, cAlphaArgs(13)); + Sched::Schedule *supplyAirMassFlowRateSched = Sched::GetSchedule(state, cAlphaArgs(14)); + Sched::Schedule *supplyAirHumidityRatioSched = Sched::GetSchedule(state, cAlphaArgs(15)); + Sched::Schedule *supplyAirCO2ConcentrationSched = Sched::GetSchedule(state, cAlphaArgs(16)); // Note: Internal thermal mass can be calculated only with measured temperature. - // Air infiltration rate can be calculated with either measured temperature, humifity ratio, or CO2 - // concentration. People count can be calculated with either measured temperature, humifity ratio, or CO2 + // Air infiltration rate can be calculated with either measured temperature, humidity ratio, or CO2 + // concentration. People count can be calculated with either measured temperature, humidity ratio, or CO2 // concentration. // Initially set all flags to be false - state.dataHybridModel->HybridModelZone(ZonePtr).InternalThermalMassCalc_T = false; - state.dataHybridModel->HybridModelZone(ZonePtr).InfiltrationCalc_T = false; - state.dataHybridModel->HybridModelZone(ZonePtr).InfiltrationCalc_H = false; - state.dataHybridModel->HybridModelZone(ZonePtr).InfiltrationCalc_C = false; - state.dataHybridModel->HybridModelZone(ZonePtr).PeopleCountCalc_T = false; - state.dataHybridModel->HybridModelZone(ZonePtr).PeopleCountCalc_H = false; - state.dataHybridModel->HybridModelZone(ZonePtr).PeopleCountCalc_C = false; + hmZone.InternalThermalMassCalc_T = false; + hmZone.InfiltrationCalc_T = false; + hmZone.InfiltrationCalc_H = false; + hmZone.InfiltrationCalc_C = false; + hmZone.PeopleCountCalc_T = false; + hmZone.PeopleCountCalc_H = false; + hmZone.PeopleCountCalc_C = false; // Scenario 1: Only one unknown parameter to solve // Scenario 1-1: To solve thermal mass @@ -174,11 +172,11 @@ namespace HybridModel { ErrorsFound = true; } - if (TemperatureSchPtr == 0) { + if (temperatureSched == nullptr) { ShowSevereError(state, format("Measured Zone Air Tempearture Schedule is not defined for: {}", CurrentModuleObject)); ErrorsFound = true; } else { - state.dataHybridModel->HybridModelZone(ZonePtr).InternalThermalMassCalc_T = true; + hmZone.InternalThermalMassCalc_T = true; } } @@ -189,9 +187,9 @@ namespace HybridModel { format("Field \"{}\" and \"{}\" cannot be both set to YES.", cAlphaFieldNames(4), cAlphaFieldNames(5))); ErrorsFound = true; } - if (TemperatureSchPtr == 0 && HumidityRatioSchPtr == 0 && CO2ConcentrationSchPtr == 0) { + if (temperatureSched == nullptr && humidityRatioSched == nullptr && CO2ConcentrationSched == nullptr) { // Show fatal error if no measurement schedule is provided - ShowSevereError(state, format("No measured envrionmental parameter is provided for: {}", CurrentModuleObject)); + ShowSevereError(state, format("No measured environmental parameter is provided for: {}", CurrentModuleObject)); ShowContinueError(state, format("One of the field \"{}\", \"{}\", or {}\" must be provided for the HybridModel:Zone.", cAlphaFieldNames(6), @@ -199,38 +197,38 @@ namespace HybridModel { cAlphaFieldNames(8))); ErrorsFound = true; } else { - if (TemperatureSchPtr > 0 && !state.dataHybridModel->FlagHybridModel_TM) { + if (temperatureSched != nullptr && !state.dataHybridModel->FlagHybridModel_TM) { // Temperature schedule is provided, igonore humidity ratio and CO2 concentration schedules. - state.dataHybridModel->HybridModelZone(ZonePtr).InfiltrationCalc_T = true; - if (HumidityRatioSchPtr > 0) { + hmZone.InfiltrationCalc_T = true; + if (humidityRatioSched != nullptr) { ShowWarningError(state, format("Field \"{}\" is provided.", cAlphaFieldNames(6))); ShowContinueError(state, format("Field \"{}\" will not be used.", cAlphaFieldNames(7))); } - if (CO2ConcentrationSchPtr > 0) { + if (CO2ConcentrationSched != nullptr) { ShowWarningError(state, format("Field \"{}\" is provided.", cAlphaFieldNames(6))); ShowContinueError(state, format("Field \"{}\" will not be used.", cAlphaFieldNames(8))); } } - if (HumidityRatioSchPtr > 0 && TemperatureSchPtr == 0) { + if (humidityRatioSched != nullptr && temperatureSched == nullptr) { // Humidity ratio schedule is provided, ignore CO2 concentration schedule. - state.dataHybridModel->HybridModelZone(ZonePtr).InfiltrationCalc_H = true; - if (CO2ConcentrationSchPtr > 0) { + hmZone.InfiltrationCalc_H = true; + if (CO2ConcentrationSched != nullptr) { ShowWarningError(state, format("Field \"{}\" is provided.", cAlphaFieldNames(7))); ShowContinueError(state, format("Field \"{}\" will not be used.", cAlphaFieldNames(8))); } } - if (CO2ConcentrationSchPtr > 0 && TemperatureSchPtr == 0 && HumidityRatioSchPtr == 0) { + if (CO2ConcentrationSched != nullptr && temperatureSched == nullptr && humidityRatioSched == nullptr) { // Only CO2 concentration schedule is provided. - state.dataHybridModel->HybridModelZone(ZonePtr).InfiltrationCalc_C = true; + hmZone.InfiltrationCalc_C = true; } } } // Scenario 1-3: To solve people count if (state.dataHybridModel->FlagHybridModel_PC) { - if (TemperatureSchPtr == 0 && HumidityRatioSchPtr == 0 && CO2ConcentrationSchPtr == 0) { + if (temperatureSched == nullptr && humidityRatioSched == nullptr && CO2ConcentrationSched == nullptr) { // Show fatal error if no measurement schedule is provided - ShowSevereError(state, format("No measured envrionmental parameter is provided for: {}", CurrentModuleObject)); + ShowSevereError(state, format("No measured environmental parameter is provided for: {}", CurrentModuleObject)); ShowContinueError(state, format("One of the field \"{}\", \"{}\", or {}\" must be provided for the HybridModel:Zone.", cAlphaFieldNames(6), @@ -238,143 +236,123 @@ namespace HybridModel { cAlphaFieldNames(8))); ErrorsFound = true; } else { - if (TemperatureSchPtr > 0 && !state.dataHybridModel->FlagHybridModel_TM) { + if (temperatureSched != nullptr && !state.dataHybridModel->FlagHybridModel_TM) { // Temperature schedule is provided, igonore humidity ratio and CO2 concentration schedules. - state.dataHybridModel->HybridModelZone(ZonePtr).PeopleCountCalc_T = true; - if (HumidityRatioSchPtr > 0) { + hmZone.PeopleCountCalc_T = true; + if (humidityRatioSched != nullptr) { ShowWarningError( state, - "The meausured air humidity ratio schedule will not be used since measured air temperature is provided."); + "The measured air humidity ratio schedule will not be used since measured air temperature is provided."); } - if (CO2ConcentrationSchPtr > 0) { + if (CO2ConcentrationSched != nullptr) { ShowWarningError( state, - "The meausured air CO2 concentration schedule will not be used since measured air temperature is provided."); + "The measured air CO2 concentration schedule will not be used since measured air temperature is provided."); } } - if (HumidityRatioSchPtr > 0 && TemperatureSchPtr == 0) { + if (humidityRatioSched != nullptr && temperatureSched == nullptr) { // Humidity ratio schedule is provided, ignore CO2 concentration schedule. - state.dataHybridModel->HybridModelZone(ZonePtr).PeopleCountCalc_H = true; - if (CO2ConcentrationSchPtr > 0) { + hmZone.PeopleCountCalc_H = true; + if (CO2ConcentrationSched != nullptr) { ShowWarningError(state, - "The meausured air CO2 concentration schedule will not be used since measured air humidity " + "The measured air CO2 concentration schedule will not be used since measured air humidity " "ratio is provided."); } } - if (CO2ConcentrationSchPtr > 0 && TemperatureSchPtr == 0 && HumidityRatioSchPtr == 0) { + if (CO2ConcentrationSched != nullptr && temperatureSched == nullptr && humidityRatioSched == nullptr) { // Only CO2 concentration schedule is provided. - state.dataHybridModel->HybridModelZone(ZonePtr).PeopleCountCalc_C = true; + hmZone.PeopleCountCalc_C = true; } } } // Decide if system supply terms are valid to be included in the inverse solution - if (SupplyAirTemperatureSchPtr > 0 && SupplyAirMassFlowRateSchPtr > 0 && SupplyAirHumidityRatioSchPtr) { - if (state.dataHybridModel->HybridModelZone(ZonePtr).InfiltrationCalc_T || - state.dataHybridModel->HybridModelZone(ZonePtr).PeopleCountCalc_T) { - state.dataHybridModel->HybridModelZone(ZonePtr).IncludeSystemSupplyParameters = true; + if (supplyAirTemperatureSched != nullptr && supplyAirMassFlowRateSched != nullptr && supplyAirHumidityRatioSched != nullptr) { + if (hmZone.InfiltrationCalc_T || hmZone.PeopleCountCalc_T) { + hmZone.IncludeSystemSupplyParameters = true; } else { ShowWarningError(state, - format("Field \"{}\", {}, and \"{}\" will not be used in the inverse balance euqation.", + format("Field \"{}\", {}, and \"{}\" will not be used in the inverse balance equation.", cAlphaFieldNames(13), cAlphaFieldNames(14), cAlphaFieldNames(15))); } } - if (SupplyAirHumidityRatioSchPtr && SupplyAirMassFlowRateSchPtr > 0) { - if (state.dataHybridModel->HybridModelZone(ZonePtr).InfiltrationCalc_H || - state.dataHybridModel->HybridModelZone(ZonePtr).PeopleCountCalc_H) { - state.dataHybridModel->HybridModelZone(ZonePtr).IncludeSystemSupplyParameters = true; + if (supplyAirHumidityRatioSched != nullptr && supplyAirMassFlowRateSched != nullptr) { + if (hmZone.InfiltrationCalc_H || hmZone.PeopleCountCalc_H) { + hmZone.IncludeSystemSupplyParameters = true; } else { ShowWarningError(state, - format("Field \"{}\" and \"{}\" will not be used in the inverse balance euqation.", + format("Field \"{}\" and \"{}\" will not be used in the inverse balance equation.", cAlphaFieldNames(15), cAlphaFieldNames(14))); } } - if (SupplyAirCO2ConcentrationSchPtr > 0 && SupplyAirMassFlowRateSchPtr > 0) { - if (state.dataHybridModel->HybridModelZone(ZonePtr).InfiltrationCalc_C || - state.dataHybridModel->HybridModelZone(ZonePtr).PeopleCountCalc_C) { - state.dataHybridModel->HybridModelZone(ZonePtr).IncludeSystemSupplyParameters = true; + if (supplyAirCO2ConcentrationSched != nullptr && supplyAirMassFlowRateSched != nullptr) { + if (hmZone.InfiltrationCalc_C || hmZone.PeopleCountCalc_C) { + hmZone.IncludeSystemSupplyParameters = true; } else { ShowWarningError(state, - format("Field \"{}\" and \"{}\" will not be used in the inverse balance euqation.", + format("Field \"{}\" and \"{}\" will not be used in the inverse balance equation.", cAlphaFieldNames(16), cAlphaFieldNames(14))); } } // Flags showing Hybrid Modeling settings - state.dataHybridModel->FlagHybridModel = state.dataHybridModel->HybridModelZone(ZonePtr).InternalThermalMassCalc_T || - state.dataHybridModel->HybridModelZone(ZonePtr).InfiltrationCalc_T || - state.dataHybridModel->HybridModelZone(ZonePtr).InfiltrationCalc_H || - state.dataHybridModel->HybridModelZone(ZonePtr).InfiltrationCalc_C || - state.dataHybridModel->HybridModelZone(ZonePtr).PeopleCountCalc_T || - state.dataHybridModel->HybridModelZone(ZonePtr).PeopleCountCalc_H || - state.dataHybridModel->HybridModelZone(ZonePtr).PeopleCountCalc_C; - - if (state.dataHybridModel->HybridModelZone(ZonePtr).InternalThermalMassCalc_T || - state.dataHybridModel->HybridModelZone(ZonePtr).InfiltrationCalc_T || - state.dataHybridModel->HybridModelZone(ZonePtr).PeopleCountCalc_T) { - state.dataHybridModel->HybridModelZone(ZonePtr).ZoneMeasuredTemperatureSchedulePtr = GetScheduleIndex(state, cAlphaArgs(6)); + state.dataHybridModel->FlagHybridModel = hmZone.InternalThermalMassCalc_T || hmZone.InfiltrationCalc_T || + hmZone.InfiltrationCalc_H || hmZone.InfiltrationCalc_C || hmZone.PeopleCountCalc_T || + hmZone.PeopleCountCalc_H || hmZone.PeopleCountCalc_C; + + if (hmZone.InternalThermalMassCalc_T || hmZone.InfiltrationCalc_T || hmZone.PeopleCountCalc_T) { + hmZone.measuredTempSched = temperatureSched; } - if (state.dataHybridModel->HybridModelZone(ZonePtr).InfiltrationCalc_H || - state.dataHybridModel->HybridModelZone(ZonePtr).PeopleCountCalc_H) { - state.dataHybridModel->HybridModelZone(ZonePtr).ZoneMeasuredHumidityRatioSchedulePtr = GetScheduleIndex(state, cAlphaArgs(7)); + if (hmZone.InfiltrationCalc_H || hmZone.PeopleCountCalc_H) { + hmZone.measuredHumRatSched = humidityRatioSched; } - if (state.dataHybridModel->HybridModelZone(ZonePtr).InfiltrationCalc_C || - state.dataHybridModel->HybridModelZone(ZonePtr).PeopleCountCalc_C) { - state.dataHybridModel->HybridModelZone(ZonePtr).ZoneMeasuredCO2ConcentrationSchedulePtr = - GetScheduleIndex(state, cAlphaArgs(8)); + if (hmZone.InfiltrationCalc_C || hmZone.PeopleCountCalc_C) { + hmZone.measuredCO2ConcSched = CO2ConcentrationSched; } - if (state.dataHybridModel->HybridModelZone(ZonePtr).IncludeSystemSupplyParameters) { - state.dataHybridModel->HybridModelZone(ZonePtr).ZoneSupplyAirTemperatureSchedulePtr = GetScheduleIndex(state, cAlphaArgs(13)); - state.dataHybridModel->HybridModelZone(ZonePtr).ZoneSupplyAirMassFlowRateSchedulePtr = - GetScheduleIndex(state, cAlphaArgs(14)); - state.dataHybridModel->HybridModelZone(ZonePtr).ZoneSupplyAirHumidityRatioSchedulePtr = - GetScheduleIndex(state, cAlphaArgs(15)); - state.dataHybridModel->HybridModelZone(ZonePtr).ZoneSupplyAirCO2ConcentrationSchedulePtr = - GetScheduleIndex(state, cAlphaArgs(16)); + if (hmZone.IncludeSystemSupplyParameters) { + hmZone.supplyAirTempSched = supplyAirTemperatureSched; + hmZone.supplyAirMassFlowRateSched = supplyAirMassFlowRateSched; + hmZone.supplyAirHumRatSched = supplyAirHumidityRatioSched; + hmZone.supplyAirCO2ConcSched = supplyAirCO2ConcentrationSched; } // Get optional people related schedules - if (state.dataHybridModel->HybridModelZone(ZonePtr).PeopleCountCalc_T || - state.dataHybridModel->HybridModelZone(ZonePtr).PeopleCountCalc_H || - state.dataHybridModel->HybridModelZone(ZonePtr).PeopleCountCalc_C) { - if (PeopleActivityLevelSchPtr > 0) { - state.dataHybridModel->HybridModelZone(ZonePtr).ZonePeopleActivityLevelSchedulePtr = - GetScheduleIndex(state, cAlphaArgs(9)); + if (hmZone.PeopleCountCalc_T || hmZone.PeopleCountCalc_H || hmZone.PeopleCountCalc_C) { + if (peopleActivityLevelSched != nullptr) { + hmZone.peopleActivityLevelSched = peopleActivityLevelSched; } else { ShowWarningError( state, format("Field \"{}\": default people activity level is not provided, default value of 130W/person will be used.", cAlphaFieldNames(9))); } - if (PeopleSensibleFractionSchPtr > 0) { - state.dataHybridModel->HybridModelZone(ZonePtr).ZonePeopleSensibleFractionSchedulePtr = - GetScheduleIndex(state, cAlphaArgs(10)); + if (peopleSensibleFractionSched != nullptr) { + hmZone.peopleSensibleFracSched = peopleSensibleFractionSched; } else { ShowWarningError( state, format("Field \"{}\": default people sensible heat rate is not provided, default value of 0.6 will be used.", cAlphaFieldNames(10))); } - if (PeopleRadiantFractionSchPtr > 0) { - state.dataHybridModel->HybridModelZone(ZonePtr).ZonePeopleRadiationFractionSchedulePtr = - GetScheduleIndex(state, cAlphaArgs(11)); + if (peopleRadiantFractionSched != nullptr) { + hmZone.peopleRadiantFracSched = peopleRadiantFractionSched; } else { ShowWarningError(state, format("Field \"{}\": default people radiant heat portion (of sensible heat) is not provided, default " "value of 0.7 will be used.", cAlphaFieldNames(11))); } - if (PeopleCO2GenRateSchPtr > 0) { - state.dataHybridModel->HybridModelZone(ZonePtr).ZonePeopleCO2GenRateSchedulePtr = GetScheduleIndex(state, cAlphaArgs(12)); + if (peopleCO2GenRateSched != nullptr) { + hmZone.peopleCO2GenRateSched = peopleCO2GenRateSched; } else { ShowWarningError(state, format("Field \"{}\": default people CO2 generation rate is not provided, default value of 0.0000000382 " @@ -385,17 +363,17 @@ namespace HybridModel { if (state.dataHybridModel->FlagHybridModel) { // prepare start and end date for Hybrid Modeling - state.dataHybridModel->HybridModelZone(ZonePtr).ZoneMeasuredTemperatureStartMonth = rNumericArgs(1); - state.dataHybridModel->HybridModelZone(ZonePtr).ZoneMeasuredTemperatureStartDate = rNumericArgs(2); - state.dataHybridModel->HybridModelZone(ZonePtr).ZoneMeasuredTemperatureEndMonth = rNumericArgs(3); - state.dataHybridModel->HybridModelZone(ZonePtr).ZoneMeasuredTemperatureEndDate = rNumericArgs(4); + hmZone.measuredTempStartMonth = rNumericArgs(1); + hmZone.measuredTempStartDate = rNumericArgs(2); + hmZone.measuredTempEndMonth = rNumericArgs(3); + hmZone.measuredTempEndDate = rNumericArgs(4); { int const HMDayArr[12] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; - int HybridModelStartMonth = state.dataHybridModel->HybridModelZone(ZonePtr).ZoneMeasuredTemperatureStartMonth; - int HybridModelStartDate = state.dataHybridModel->HybridModelZone(ZonePtr).ZoneMeasuredTemperatureStartDate; - int HybridModelEndMonth = state.dataHybridModel->HybridModelZone(ZonePtr).ZoneMeasuredTemperatureEndMonth; - int HybridModelEndDate = state.dataHybridModel->HybridModelZone(ZonePtr).ZoneMeasuredTemperatureEndDate; + int HybridModelStartMonth = hmZone.measuredTempStartMonth; + int HybridModelStartDate = hmZone.measuredTempStartDate; + int HybridModelEndMonth = hmZone.measuredTempEndMonth; + int HybridModelEndDate = hmZone.measuredTempEndDate; int HMStartDay = 0; int HMEndDay = 0; @@ -407,15 +385,13 @@ namespace HybridModel { HMEndDay = HMDayArr[HybridModelEndMonth - 1]; } - state.dataHybridModel->HybridModelZone(ZonePtr).HybridStartDayOfYear = HMStartDay + HybridModelStartDate; - state.dataHybridModel->HybridModelZone(ZonePtr).HybridEndDayOfYear = HMEndDay + HybridModelEndDate; + hmZone.HybridStartDayOfYear = HMStartDay + HybridModelStartDate; + hmZone.HybridEndDayOfYear = HMEndDay + HybridModelEndDate; } } // Output variable - if (state.dataHybridModel->HybridModelZone(ZonePtr).InfiltrationCalc_T || - state.dataHybridModel->HybridModelZone(ZonePtr).InfiltrationCalc_H || - state.dataHybridModel->HybridModelZone(ZonePtr).InfiltrationCalc_C) { + if (hmZone.InfiltrationCalc_T || hmZone.InfiltrationCalc_H || hmZone.InfiltrationCalc_C) { SetupOutputVariable(state, "Zone Infiltration Hybrid Model Air Change Rate", Constant::Units::ach, @@ -431,9 +407,7 @@ namespace HybridModel { OutputProcessor::StoreType::Average, state.dataHeatBal->Zone(ZonePtr).Name); } - if (state.dataHybridModel->HybridModelZone(ZonePtr).PeopleCountCalc_T || - state.dataHybridModel->HybridModelZone(ZonePtr).PeopleCountCalc_H || - state.dataHybridModel->HybridModelZone(ZonePtr).PeopleCountCalc_C) { + if (hmZone.PeopleCountCalc_T || hmZone.PeopleCountCalc_H || hmZone.PeopleCountCalc_C) { SetupOutputVariable(state, "Zone Hybrid Model People Count", Constant::Units::None, @@ -442,7 +416,7 @@ namespace HybridModel { OutputProcessor::StoreType::Average, state.dataHeatBal->Zone(ZonePtr).Name); } - if (state.dataHybridModel->HybridModelZone(ZonePtr).InternalThermalMassCalc_T) { + if (hmZone.InternalThermalMassCalc_T) { SetupOutputVariable(state, "Zone Hybrid Model Thermal Mass Multiplier", Constant::Units::None, @@ -451,6 +425,12 @@ namespace HybridModel { OutputProcessor::StoreType::Average, state.dataHeatBal->Zone(ZonePtr).Name); } + + // ZoneAirMassFlowConservation should not be activated during the Hybrid Modeling infiltration calculations + if (hmZone.InfiltrationCalc_T && state.dataHeatBal->ZoneAirMassFlow.EnforceZoneMassBalance) { + state.dataHeatBal->ZoneAirMassFlow.EnforceZoneMassBalance = false; + ShowWarningError(state, "ZoneAirMassFlowConservation is deactivated when Hybrid Modeling is performed."); + } } else { ShowSevereError( state, @@ -459,17 +439,11 @@ namespace HybridModel { } } - // ZoneAirMassFlowConservation should not be activated during the Hybrid Modeling infiltration calculations - if (state.dataHybridModel->HybridModelZone(ZonePtr).InfiltrationCalc_T && state.dataHeatBal->ZoneAirMassFlow.EnforceZoneMassBalance) { - state.dataHeatBal->ZoneAirMassFlow.EnforceZoneMassBalance = false; - ShowWarningError(state, "ZoneAirMassFlowConservation is deactivated when Hybrid Modeling is performed."); - } - // RoomAirModelType should be Mixing if Hybrid Modeling is performed for the zone if (state.dataHybridModel->FlagHybridModel) { - for (ZonePtr = 1; ZonePtr <= state.dataGlobal->NumOfZones; ZonePtr++) { - if ((state.dataHybridModel->HybridModelZone(ZonePtr).InternalThermalMassCalc_T || - state.dataHybridModel->HybridModelZone(ZonePtr).InfiltrationCalc_T) && + for (int ZonePtr = 1; ZonePtr <= state.dataGlobal->NumOfZones; ZonePtr++) { + auto &hmZone = state.dataHybridModel->hybridModelZones(ZonePtr); + if ((hmZone.InternalThermalMassCalc_T || hmZone.InfiltrationCalc_T) && (state.dataRoomAir->AirModel(ZonePtr).AirModel != RoomAir::RoomAirModel::Mixing)) { state.dataRoomAir->AirModel(ZonePtr).AirModel = RoomAir::RoomAirModel::Mixing; ShowWarningError(state, "Room Air Model Type should be Mixing if Hybrid Modeling is performed for the zone."); diff --git a/src/EnergyPlus/HybridModel.hh b/src/EnergyPlus/HybridModel.hh index d5067a6c37d..b1ab754d266 100644 --- a/src/EnergyPlus/HybridModel.hh +++ b/src/EnergyPlus/HybridModel.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -74,52 +74,39 @@ namespace HybridModel { // Types - struct HybridModelProperties + struct HybridModelZone { // Members std::string Name; - int ZoneMeasuredTemperatureSchedulePtr; - int ZoneMeasuredHumidityRatioSchedulePtr; - int ZoneMeasuredCO2ConcentrationSchedulePtr; - - int ZonePeopleActivityLevelSchedulePtr; - int ZonePeopleSensibleFractionSchedulePtr; - int ZonePeopleRadiationFractionSchedulePtr; - int ZonePeopleCO2GenRateSchedulePtr; - - int ZoneSupplyAirTemperatureSchedulePtr; - int ZoneSupplyAirMassFlowRateSchedulePtr; - int ZoneSupplyAirHumidityRatioSchedulePtr; - int ZoneSupplyAirCO2ConcentrationSchedulePtr; - - bool InternalThermalMassCalc_T; // Calculate thermal mass flag with measured temperature - bool InfiltrationCalc_T; // Calculate air infiltration rate flag with measured temperature - bool InfiltrationCalc_H; // Calculate air infiltration rate flag with measured humidity ratio - bool InfiltrationCalc_C; // Calculate air infiltration rate flag with measured CO2 concentration - bool PeopleCountCalc_T; // Calculate zone people count flag with measured temperature - bool PeopleCountCalc_H; // Calculate zone people count flag with measured humidity ratio - bool PeopleCountCalc_C; // Calculate zone people count flag with measured CO2 concentration - bool IncludeSystemSupplyParameters; // Flag to decide whether to include system supply terms - - int ZoneMeasuredTemperatureStartMonth; - int ZoneMeasuredTemperatureStartDate; - int ZoneMeasuredTemperatureEndMonth; - int ZoneMeasuredTemperatureEndDate; - int HybridStartDayOfYear; // Hybrid model start date of year - int HybridEndDayOfYear; // Hybrid model end date of year - - // Default Constructor - HybridModelProperties() - : ZoneMeasuredTemperatureSchedulePtr(0), ZoneMeasuredHumidityRatioSchedulePtr(0), ZoneMeasuredCO2ConcentrationSchedulePtr(0), - ZonePeopleActivityLevelSchedulePtr(0), ZonePeopleSensibleFractionSchedulePtr(0), ZonePeopleRadiationFractionSchedulePtr(0), - ZonePeopleCO2GenRateSchedulePtr(0), ZoneSupplyAirTemperatureSchedulePtr(0), ZoneSupplyAirMassFlowRateSchedulePtr(0), - ZoneSupplyAirHumidityRatioSchedulePtr(0), ZoneSupplyAirCO2ConcentrationSchedulePtr(0), InternalThermalMassCalc_T(false), - InfiltrationCalc_T(false), InfiltrationCalc_H(false), InfiltrationCalc_C(false), PeopleCountCalc_T(false), PeopleCountCalc_H(false), - PeopleCountCalc_C(false), IncludeSystemSupplyParameters(false), ZoneMeasuredTemperatureStartMonth(0), - ZoneMeasuredTemperatureStartDate(0), ZoneMeasuredTemperatureEndMonth(0), ZoneMeasuredTemperatureEndDate(0), HybridStartDayOfYear(0), - HybridEndDayOfYear(0) - { - } + Sched::Schedule *measuredTempSched = nullptr; + Sched::Schedule *measuredHumRatSched = nullptr; + Sched::Schedule *measuredCO2ConcSched = nullptr; + + Sched::Schedule *peopleActivityLevelSched = nullptr; + Sched::Schedule *peopleSensibleFracSched = nullptr; + Sched::Schedule *peopleRadiantFracSched = nullptr; + Sched::Schedule *peopleCO2GenRateSched = nullptr; + + Sched::Schedule *supplyAirTempSched = nullptr; + Sched::Schedule *supplyAirMassFlowRateSched = nullptr; + Sched::Schedule *supplyAirHumRatSched = nullptr; + Sched::Schedule *supplyAirCO2ConcSched = nullptr; + + bool InternalThermalMassCalc_T = false; // Calculate thermal mass flag with measured temperature + bool InfiltrationCalc_T = false; // Calculate air infiltration rate flag with measured temperature + bool InfiltrationCalc_H = false; // Calculate air infiltration rate flag with measured humidity ratio + bool InfiltrationCalc_C = false; // Calculate air infiltration rate flag with measured CO2 concentration + bool PeopleCountCalc_T = false; // Calculate zone people count flag with measured temperature + bool PeopleCountCalc_H = false; // Calculate zone people count flag with measured humidity ratio + bool PeopleCountCalc_C = false; // Calculate zone people count flag with measured CO2 concentration + bool IncludeSystemSupplyParameters = false; // Flag to decide whether to include system supply terms + + int measuredTempStartMonth = 0; + int measuredTempStartDate = 0; + int measuredTempEndMonth = 0; + int measuredTempEndDate = 0; + int HybridStartDayOfYear = 0; // Hybrid model start date of year + int HybridEndDayOfYear = 0; // Hybrid model end date of year }; // Object Data @@ -141,7 +128,11 @@ struct HybridModelData : BaseGlobalStruct int NumOfHybridModelZones = 0; // Number of hybrid model zones in the model std::string CurrentModuleObject; // to assist in getting input - Array1D HybridModelZone; + Array1D hybridModelZones; + + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } void init_state([[maybe_unused]] EnergyPlusData &state) override { @@ -155,7 +146,7 @@ struct HybridModelData : BaseGlobalStruct this->FlagHybridModel_PC = false; this->NumOfHybridModelZones = 0; this->CurrentModuleObject.clear(); - this->HybridModelZone.deallocate(); + this->hybridModelZones.deallocate(); } }; diff --git a/src/EnergyPlus/HybridUnitaryAirConditioners.cc b/src/EnergyPlus/HybridUnitaryAirConditioners.cc index 26f24c4997d..678e6f3bbea 100644 --- a/src/EnergyPlus/HybridUnitaryAirConditioners.cc +++ b/src/EnergyPlus/HybridUnitaryAirConditioners.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -200,12 +200,12 @@ void InitZoneHybridUnitaryAirConditioners(EnergyPlusData &state, } state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitNum).RequestedLoadToHeatingSetpoint = 0; state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitNum).RequestedLoadToCoolingSetpoint = 0; - state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitNum).RequestedHumdificationMass = 0; - state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitNum).RequestedHumdificationLoad = 0; - state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitNum).RequestedHumdificationEnergy = 0; - state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitNum).RequestedDeHumdificationMass = 0; - state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitNum).RequestedDeHumdificationLoad = 0; - state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitNum).RequestedDeHumdificationEnergy = 0; + state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitNum).RequestedHumidificationMass = 0; + state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitNum).RequestedHumidificationLoad = 0; + state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitNum).RequestedHumidificationEnergy = 0; + state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitNum).RequestedDeHumidificationMass = 0; + state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitNum).RequestedDeHumidificationLoad = 0; + state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitNum).RequestedDeHumidificationEnergy = 0; state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitNum).UnitTotalCoolingRate = 0.0; state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitNum).UnitTotalCoolingEnergy = 0.0; @@ -325,7 +325,7 @@ void InitZoneHybridUnitaryAirConditioners(EnergyPlusData &state, void CalcZoneHybridUnitaryAirConditioners(EnergyPlusData &state, int const UnitNum, // unit number int const ZoneNum, // number of zone being served - Real64 &SensibleOutputProvided, // sensible capacity delivered to zone cooling negitive + Real64 &SensibleOutputProvided, // sensible capacity delivered to zone cooling negative Real64 &LatentOutputProvided // Latent add/removal (kg/s), dehumid = negative ) { @@ -354,7 +354,7 @@ void CalcZoneHybridUnitaryAirConditioners(EnergyPlusData &state, SensibleOutputProvided = 0; LatentOutputProvided = 0; - // taking class members out of the object and then using them in the calcualtion is odd but its for clarity with unit testing. + // taking class members out of the object and then using them in the calculation is odd but its for clarity with unit testing. EnvDryBulbT = state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitNum).SecInletTemp; // degrees C AirTempRoom = state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitNum).InletTemp; // degrees C EnvRelHumm = state.dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(UnitNum).SecInletRH; // RH @@ -442,9 +442,8 @@ void GetInputZoneHybridUnitaryAirConditioners(EnergyPlusData &state, bool &Error // RE-ENGINEERED na // Using/Aliasing - using BranchNodeConnections::TestCompSet; - using namespace ScheduleManager; using BranchNodeConnections::SetUpCompSets; + using BranchNodeConnections::TestCompSet; using NodeInputManager::GetOnlySingleNode; using namespace DataLoopNode; std::string cCurrentModuleObject; // Object type for getting and error messages @@ -510,16 +509,11 @@ void GetInputZoneHybridUnitaryAirConditioners(EnergyPlusData &state, bool &Error // A1, \field Name hybridUnitaryAC.Name = Alphas(1); // A2, \field Availability Schedule Name - hybridUnitaryAC.Schedule = Alphas(2); if (lAlphaBlanks(2)) { - hybridUnitaryAC.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - hybridUnitaryAC.SchedPtr = GetScheduleIndex(state, Alphas(2)); - if (hybridUnitaryAC.SchedPtr == 0) { - ShowSevereError(state, format("Invalid {}={}", cAlphaFields(2), Alphas(2))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } + hybridUnitaryAC.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((hybridUnitaryAC.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } // A3, \field Availability Manager List Name if (!lAlphaBlanks(3)) { @@ -527,40 +521,31 @@ void GetInputZoneHybridUnitaryAirConditioners(EnergyPlusData &state, bool &Error } // A4, \field Minimum Supply Air Temperature Schedule Named - if (!lAlphaBlanks(4)) { - hybridUnitaryAC.TsaMin_schedule_pointer = GetScheduleIndex(state, Alphas(4)); - if (hybridUnitaryAC.TsaMin_schedule_pointer == 0) { - ShowSevereError(state, format("Invalid {}={}", cAlphaFields(4), Alphas(4))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } + if (lAlphaBlanks(4)) { + } else if ((hybridUnitaryAC.TsaMinSched = Sched::GetSchedule(state, Alphas(4))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(4), Alphas(4)); + ErrorsFound = true; } + // A5, \field Maximum Supply Air Temperature Schedule Name - if (!lAlphaBlanks(5)) { - hybridUnitaryAC.TsaMax_schedule_pointer = GetScheduleIndex(state, Alphas(5)); - if (hybridUnitaryAC.TsaMax_schedule_pointer == 0) { - ShowSevereError(state, format("Invalid {}={}", cAlphaFields(5), Alphas(5))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } + if (lAlphaBlanks(5)) { + } else if ((hybridUnitaryAC.TsaMaxSched = Sched::GetSchedule(state, Alphas(5))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(5), Alphas(5)); + ErrorsFound = true; } + // A6, \field Minimum Supply Air Humidity Ratio Schedule Name - if (!lAlphaBlanks(6)) { - hybridUnitaryAC.RHsaMin_schedule_pointer = GetScheduleIndex(state, Alphas(6)); - if (hybridUnitaryAC.RHsaMin_schedule_pointer == 0) { - ShowSevereError(state, format("Invalid {}={}", cAlphaFields(6), Alphas(6))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } + if (lAlphaBlanks(6)) { + } else if ((hybridUnitaryAC.RHsaMinSched = Sched::GetSchedule(state, Alphas(6))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(6), Alphas(6)); + ErrorsFound = true; } + // A7, \field Maximum Supply Air Humidity Ratio Schedule Name - if (!lAlphaBlanks(7)) { - hybridUnitaryAC.RHsaMax_schedule_pointer = GetScheduleIndex(state, Alphas(7)); - if (hybridUnitaryAC.RHsaMax_schedule_pointer == 0) { - ShowSevereError(state, format("Invalid {}={}", cAlphaFields(7), Alphas(7))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } + if (lAlphaBlanks(7)) { + } else if ((hybridUnitaryAC.RHsaMaxSched = Sched::GetSchedule(state, Alphas(7))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(7), Alphas(7)); + ErrorsFound = true; } // A8, \field Method to Choose Value of Controlled Inputs @@ -1117,21 +1102,21 @@ void GetInputZoneHybridUnitaryAirConditioners(EnergyPlusData &state, bool &Error SetupOutputVariable(state, "Zone Hybrid Unitary HVAC Dehumidification Load to Humidistat Setpoint Moisture Transfer Rate", Constant::Units::kg_s, - hybridUnitaryAC.RequestedDeHumdificationMass, + hybridUnitaryAC.RequestedDeHumidificationMass, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, hybridUnitaryAC.Name); SetupOutputVariable(state, "Zone Hybrid Unitary HVAC Dehumidification Load to Humidistat Setpoint Heat Transfer Rate", Constant::Units::W, - hybridUnitaryAC.RequestedDeHumdificationLoad, + hybridUnitaryAC.RequestedDeHumidificationLoad, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, hybridUnitaryAC.Name); SetupOutputVariable(state, - "Zone Hybrid Unitary HVAC DehumidificationLoad to Humidistat Setpoint Heat Tansfer Energy", + "Zone Hybrid Unitary HVAC Dehumidification Load to Humidistat Setpoint Heat Transfer Energy", Constant::Units::J, - hybridUnitaryAC.RequestedDeHumdificationEnergy, + hybridUnitaryAC.RequestedDeHumidificationEnergy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, hybridUnitaryAC.Name); @@ -1139,21 +1124,21 @@ void GetInputZoneHybridUnitaryAirConditioners(EnergyPlusData &state, bool &Error SetupOutputVariable(state, "Zone Hybrid Unitary HVAC Humidification Load to Humidistat Setpoint Moisture Transfer Rate", Constant::Units::kg_s, - hybridUnitaryAC.RequestedHumdificationMass, + hybridUnitaryAC.RequestedHumidificationMass, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, hybridUnitaryAC.Name); SetupOutputVariable(state, "Zone Hybrid Unitary HVAC Humidification Load to Humidistat Setpoint Heat Transfer Rate", Constant::Units::W, - hybridUnitaryAC.RequestedHumdificationLoad, + hybridUnitaryAC.RequestedHumidificationLoad, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, hybridUnitaryAC.Name); SetupOutputVariable(state, - "Zone Hybrid Unitary HVAC Humidification Load to Humidistat Setpoint Heat Tansfer Energy", + "Zone Hybrid Unitary HVAC Humidification Load to Humidistat Setpoint Heat Transfer Energy", Constant::Units::J, - hybridUnitaryAC.RequestedHumdificationEnergy, + hybridUnitaryAC.RequestedHumidificationEnergy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, hybridUnitaryAC.Name); diff --git a/src/EnergyPlus/HybridUnitaryAirConditioners.hh b/src/EnergyPlus/HybridUnitaryAirConditioners.hh index c93210bcff9..b13055127f2 100644 --- a/src/EnergyPlus/HybridUnitaryAirConditioners.hh +++ b/src/EnergyPlus/HybridUnitaryAirConditioners.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -116,6 +116,10 @@ struct HybridUnitaryAirConditionersData : BaseGlobalStruct Array1D_bool MyFanFlag; Array1D_bool MyZoneEqFlag; // used to set up zone equipment availability managers + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ICEngineElectricGenerator.cc b/src/EnergyPlus/ICEngineElectricGenerator.cc index 0a69998a723..0c1839a2735 100644 --- a/src/EnergyPlus/ICEngineElectricGenerator.cc +++ b/src/EnergyPlus/ICEngineElectricGenerator.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -748,11 +748,7 @@ namespace ICEngineElectricGenerator { HRecRatio = 1.0; Real64 HeatRecInTemp = state.dataLoopNodes->Node(this->HeatRecInletNodeNum).Temp; - Real64 HeatRecCp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidName, - HeatRecInTemp, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 HeatRecCp = state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).glycol->getSpecificHeat(state, HeatRecInTemp, RoutineName); // Don't divide by zero - Note This also results in no heat recovery when // design Mdot for Heat Recovery - Specified on Chiller Input - is zero @@ -876,11 +872,7 @@ namespace ICEngineElectricGenerator { if (this->MySizeAndNodeInitFlag && (!this->MyPlantScanFlag) && this->HeatRecActive) { // size mass flow rate - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); this->DesignHeatRecMassFlowRate = rho * this->DesignHeatRecVolFlowRate; this->HeatRecMdotDesign = this->DesignHeatRecMassFlowRate; diff --git a/src/EnergyPlus/ICEngineElectricGenerator.hh b/src/EnergyPlus/ICEngineElectricGenerator.hh index b3e093e9dbd..dc6394e38be 100644 --- a/src/EnergyPlus/ICEngineElectricGenerator.hh +++ b/src/EnergyPlus/ICEngineElectricGenerator.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -186,6 +186,10 @@ struct ICEngineElectricGeneratorData : BaseGlobalStruct bool getICEInput = true; // When TRUE, calls subroutine to read input file. Array1D ICEngineGenerator; // dimension to number of machines + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/IOFiles.cc b/src/EnergyPlus/IOFiles.cc index 3c811670530..935c2215b86 100644 --- a/src/EnergyPlus/IOFiles.cc +++ b/src/EnergyPlus/IOFiles.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/IOFiles.hh b/src/EnergyPlus/IOFiles.hh index c2ea2bc6dec..32a227ec5af 100644 --- a/src/EnergyPlus/IOFiles.hh +++ b/src/EnergyPlus/IOFiles.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/IceThermalStorage.cc b/src/EnergyPlus/IceThermalStorage.cc index a6d19af28d0..6b1a2cb76f3 100644 --- a/src/EnergyPlus/IceThermalStorage.cc +++ b/src/EnergyPlus/IceThermalStorage.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -224,11 +224,7 @@ namespace IceThermalStorage { } Real64 DemandMdot = this->DesignMassFlowRate; - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - TempIn, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, TempIn, RoutineName); Real64 MyLoad2 = (DemandMdot * Cp * (TempIn - TempSetPt)); MyLoad = MyLoad2; @@ -361,17 +357,13 @@ namespace IceThermalStorage { } // Calculate the current load on the ice storage unit - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - TempIn, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, TempIn, RoutineName); // Estimated load on the ice storage unit [W] Real64 LocalLoad = this->MassFlowRate * Cp * (TempIn - TempSetPt); // Determine what the status is regarding the ice storage unit and the loop level flow - if ((std::abs(LocalLoad) <= SmallestLoad) || (ScheduleManager::GetCurrentScheduleValue(state, this->ScheduleIndex) <= 0)) { + if ((std::abs(LocalLoad) <= SmallestLoad) || (this->availSched->getCurrentVal() <= 0)) { // No real load on the ice storage device or ice storage OFF--bypass all of the flow and leave the tank alone this->CompLoad = 0.0; this->OutletTemp = TempIn; @@ -680,6 +672,8 @@ namespace IceThermalStorage { // heating and cooling loops and begin to fill the // arrays associated with the type PlantLoopProps. + static constexpr std::string_view routineName = "GetIceStorageInput"; + bool ErrorsFound; ErrorsFound = false; // Always need to reset this since there are multiple types of ice storage systems @@ -815,6 +809,9 @@ namespace IceThermalStorage { state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + Util::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), state.dataIPShortCut->cCurrentModuleObject, ErrorsFound); ++state.dataIceThermalStorage->TotalNumIceStorage; @@ -823,26 +820,19 @@ namespace IceThermalStorage { state.dataIceThermalStorage->DetailedIceStorage(iceNum).Name = state.dataIPShortCut->cAlphaArgs(1); // Detailed ice storage name // Get and verify availability schedule - state.dataIceThermalStorage->DetailedIceStorage(iceNum).ScheduleName = - state.dataIPShortCut->cAlphaArgs(2); // Detailed ice storage availability schedule name if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { - state.dataIceThermalStorage->DetailedIceStorage(iceNum).ScheduleIndex = ScheduleManager::ScheduleAlwaysOn; - } else { - state.dataIceThermalStorage->DetailedIceStorage(iceNum).ScheduleIndex = - ScheduleManager::GetScheduleIndex(state, state.dataIceThermalStorage->DetailedIceStorage(iceNum).ScheduleName); - if (state.dataIceThermalStorage->DetailedIceStorage(iceNum).ScheduleIndex == 0) { - ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError(state, - format("Entered in {}={}", state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ErrorsFound = true; - } + state.dataIceThermalStorage->DetailedIceStorage(iceNum).availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((state.dataIceThermalStorage->DetailedIceStorage(iceNum).availSched = + Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2)); + ErrorsFound = true; } // Get and Verify ITS nominal Capacity (user input is in GJ, internal value is in W-hr) // Convert GJ to J by multiplying by 10^9 // Convert J to W-hr by dividing by number of seconds in an hour (3600) state.dataIceThermalStorage->DetailedIceStorage(iceNum).NomCapacity = - state.dataIPShortCut->rNumericArgs(1) * (1.e+09) / (Constant::SecInHour); + state.dataIPShortCut->rNumericArgs(1) * (1.e+09) / Constant::rSecsInHour; if (state.dataIPShortCut->rNumericArgs(1) <= 0.0) { ShowSevereError(state, @@ -1525,7 +1515,7 @@ namespace IceThermalStorage { // There are three possible to calculate QiceMax // with ChillerCapacity(Chiller+ITS), ITS capacity(ITS), and QchillerMax(Chiller). //-------------------------------------------------------- - // Calcualte QiceMax with QiceMaxByChiller, QiceMaxByITS, QchillerMax + // Calculate QiceMax with QiceMaxByChiller, QiceMaxByITS, QchillerMax //-------------------------------------------------------- // Calculate Qice charge max by Chiller with Twb and UAIceCh Real64 QiceMaxByChiller; @@ -1562,7 +1552,7 @@ namespace IceThermalStorage { } // Check Uact for Discharging Process //-------------------------------------------------------- - // Calcualte possible ITSChargingRate with Uact, Then error check + // Calculate possible ITSChargingRate with Uact, Then error check //-------------------------------------------------------- // Calculate possible ITSChargingRate with Uact Real64 Qice = Uact * this->ITSNomCap / TimeInterval; //[W] @@ -1617,7 +1607,7 @@ namespace IceThermalStorage { // Qice is maximized when ChillerInletTemp and ChillerOutletTemp(input data) is almost same due to LMTD method. // Qice is minimized(=0) when ChillerInletTemp is almost same as FreezTemp(=0). - // Initilize + // Initialize Real64 Tfr = FreezTempIP; Real64 ChOutletTemp = TempSItoIP(chillerOutletTemp); //[degF] = ConvertSItoIP[degC] // Chiller outlet temp must be below freeze temp, or else no charge @@ -1684,11 +1674,8 @@ namespace IceThermalStorage { //---------------------------- int loopNum = this->plantLoc.loopNum; - Real64 CpFluid = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(loopNum).FluidName, - state.dataLoopNodes->Node(this->PltInletNodeNum).Temp, - state.dataPlnt->PlantLoop(loopNum).FluidIndex, - RoutineName); + Real64 CpFluid = + state.dataPlnt->PlantLoop(loopNum).glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->PltInletNodeNum).Temp, RoutineName); // Calculate Umyload based on MyLoad from E+ Real64 Umyload = -myLoad * TimeInterval / this->ITSNomCap; @@ -1710,7 +1697,7 @@ namespace IceThermalStorage { // Qice is calculate input U which is within boundary between Umin and Umax. Real64 Qice = Uact * this->ITSNomCap / TimeInterval; - // Qice cannot exceed MaxCap calulated by CalcIceStorageCapacity + // Qice cannot exceed MaxCap calculated by CalcIceStorageCapacity // Note Qice is negative here, MaxCap is positive Qice = max(Qice, -MaxCap); @@ -1923,7 +1910,7 @@ namespace IceThermalStorage { } } - void UpdateIceFractions(EnergyPlusData &state) + void UpdateIceFractions(EnergyPlusData const &state) { // SUBROUTINE INFORMATION: diff --git a/src/EnergyPlus/IceThermalStorage.hh b/src/EnergyPlus/IceThermalStorage.hh index a9e5e2271bf..b66b5780fda 100644 --- a/src/EnergyPlus/IceThermalStorage.hh +++ b/src/EnergyPlus/IceThermalStorage.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -59,6 +59,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -177,10 +178,9 @@ namespace IceThermalStorage { struct DetailedIceStorageData : PlantComponent { - std::string Name; // User identifier - std::string ScheduleName; // User identifier - int ScheduleIndex; // Plant inlet node number for ice storage unit - Real64 NomCapacity; // Design storage capacity of Ice Thermal Storage system [W-hr] + std::string Name; // User identifier // What kind of a comment is this? + Sched::Schedule *availSched; // schedule (availability?) + Real64 NomCapacity; // Design storage capacity of Ice Thermal Storage system [W-hr] // (User input for this parameter in GJ--need to convert to W-hr) int PlantInNodeNum; // Plant inlet node number for ice storage unit int PlantOutNodeNum; // Plant outlet node number for ice storage unit @@ -231,13 +231,13 @@ namespace IceThermalStorage { // Default Constructor DetailedIceStorageData() - : ScheduleIndex(0), NomCapacity(0.0), PlantInNodeNum(0), PlantOutNodeNum(0), plantLoc{}, DesignMassFlowRate(0.0), MapNum(0), - DischargeCurveNum(0), ChargeCurveNum(0), CurveFitTimeStep(1.0), DischargeParaElecLoad(0.0), ChargeParaElecLoad(0.0), TankLossCoeff(0.0), - FreezingTemp(0.0), CompLoad(0.0), IceFracChange(0.0), IceFracRemaining(1.0), IceFracOnCoil(1.0), DischargingRate(0.0), - DischargingEnergy(0.0), ChargingRate(0.0), ChargingEnergy(0.0), MassFlowRate(0.0), BypassMassFlowRate(0.0), TankMassFlowRate(0.0), - InletTemp(0.0), OutletTemp(0.0), TankOutletTemp(0.0), ParasiticElecRate(0.0), ParasiticElecEnergy(0.0), DischargeIterErrors(0), - DischargeErrorCount(0), ChargeIterErrors(0), ChargeErrorCount(0), ResetXForITSFlag(false), MyEnvrnFlag(true), CheckEquipName(true), - MyPlantScanFlag(true), MyEnvrnFlag2(true) + : NomCapacity(0.0), PlantInNodeNum(0), PlantOutNodeNum(0), plantLoc{}, DesignMassFlowRate(0.0), MapNum(0), DischargeCurveNum(0), + ChargeCurveNum(0), CurveFitTimeStep(1.0), DischargeParaElecLoad(0.0), ChargeParaElecLoad(0.0), TankLossCoeff(0.0), FreezingTemp(0.0), + CompLoad(0.0), IceFracChange(0.0), IceFracRemaining(1.0), IceFracOnCoil(1.0), DischargingRate(0.0), DischargingEnergy(0.0), + ChargingRate(0.0), ChargingEnergy(0.0), MassFlowRate(0.0), BypassMassFlowRate(0.0), TankMassFlowRate(0.0), InletTemp(0.0), + OutletTemp(0.0), TankOutletTemp(0.0), ParasiticElecRate(0.0), ParasiticElecEnergy(0.0), DischargeIterErrors(0), DischargeErrorCount(0), + ChargeIterErrors(0), ChargeErrorCount(0), ResetXForITSFlag(false), MyEnvrnFlag(true), CheckEquipName(true), MyPlantScanFlag(true), + MyEnvrnFlag2(true) { } @@ -279,7 +279,7 @@ namespace IceThermalStorage { Real64 TempIPtoSI(Real64 Temp); - void UpdateIceFractions(EnergyPlusData &state); + void UpdateIceFractions(EnergyPlusData const &state); } // namespace IceThermalStorage @@ -293,6 +293,10 @@ struct IceThermalStorageData : BaseGlobalStruct EPVector SimpleIceStorage; EPVector DetailedIceStorage; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/IndoorGreen.cc b/src/EnergyPlus/IndoorGreen.cc index a8aa8536a33..4e4194da0cc 100644 --- a/src/EnergyPlus/IndoorGreen.cc +++ b/src/EnergyPlus/IndoorGreen.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -85,7 +85,7 @@ namespace IndoorGreen { // PURPOSE OF THIS SUBROUTINE: // This subroutine simulates the thermal performance of indoor living walls including the grow lights. // This subroutine interacts with inside surface heat balance, zone air heat balance and zone air moisture balance in EnergyPlus. - auto &lw = state.dataIndoorGreen; + auto const &lw = state.dataIndoorGreen; if (lw->getInputFlag) { bool ErrorsFound(false); const char *RoutineName("IndoorLivingWall: "); // include trailing blank space @@ -108,46 +108,46 @@ namespace IndoorGreen { // PURPOSE OF THIS SUBROUTINE: // Get the input for the indoor living wall objects and store the input data in the indoorGreens array. - auto &lw = state.dataIndoorGreen; - auto &ip = state.dataInputProcessing->inputProcessor; + auto &s_lw = state.dataIndoorGreen; + auto &s_ip = state.dataInputProcessing->inputProcessor; + auto &s_ipsc = state.dataIPShortCut; + static constexpr std::string_view RoutineName("GetIndoorLivingWallInput: "); std::string_view cCurrentModuleObject = "IndoorLivingWall"; // match the idd int NumNums; // Number of real numbers returned by GetObjectItem int NumAlphas; // Number of alphanumerics returned by GetObjectItem int IOStat; // Status flag from GetObjectItem - Real64 SchMin; - Real64 SchMax; - lw->NumIndoorGreen = ip->getNumObjectsFound(state, cCurrentModuleObject); - if (lw->NumIndoorGreen > 0) lw->indoorGreens.allocate(lw->NumIndoorGreen); // Allocate the IndoorGreen input data array - for (int IndoorGreenNum = 1; IndoorGreenNum <= lw->NumIndoorGreen; ++IndoorGreenNum) { - auto &ig = lw->indoorGreens(IndoorGreenNum); - ip->getObjectItem(state, - cCurrentModuleObject, - IndoorGreenNum, - state.dataIPShortCut->cAlphaArgs, - NumAlphas, - state.dataIPShortCut->rNumericArgs, - NumNums, - IOStat, - state.dataIPShortCut->lNumericFieldBlanks, - state.dataIPShortCut->lAlphaFieldBlanks, - state.dataIPShortCut->cAlphaFieldNames, - state.dataIPShortCut->cNumericFieldNames); - ErrorObjectHeader eoh{RoutineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; - Util::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); - ig.Name = state.dataIPShortCut->cAlphaArgs(1); - ig.SurfName = state.dataIPShortCut->cAlphaArgs(2); - ig.SurfPtr = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(2), state.dataSurface->Surface); + s_lw->NumIndoorGreen = s_ip->getNumObjectsFound(state, cCurrentModuleObject); + if (s_lw->NumIndoorGreen > 0) s_lw->indoorGreens.allocate(s_lw->NumIndoorGreen); // Allocate the IndoorGreen input data array + for (int IndoorGreenNum = 1; IndoorGreenNum <= s_lw->NumIndoorGreen; ++IndoorGreenNum) { + auto &ig = s_lw->indoorGreens(IndoorGreenNum); + s_ip->getObjectItem(state, + cCurrentModuleObject, + IndoorGreenNum, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + ErrorObjectHeader eoh{RoutineName, cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + Util::IsNameEmpty(state, s_ipsc->cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); + ig.Name = s_ipsc->cAlphaArgs(1); + ig.SurfName = s_ipsc->cAlphaArgs(2); + ig.SurfPtr = Util::FindItemInList(s_ipsc->cAlphaArgs(2), state.dataSurface->Surface); if (ig.SurfPtr <= 0) { - ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2)); + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); ErrorsFound = true; } else { - if (state.dataSurface->Surface(ig.SurfPtr).InsideHeatSourceTermSchedule > 0) { + if (state.dataSurface->Surface(ig.SurfPtr).insideHeatSourceTermSched != nullptr) { ShowSevereError(state, format("The indoor green surface {} has an Inside Face Heat Source Term Schedule defined. This surface cannot " "also be used for indoor green.", - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } ig.ZonePtr = state.dataSurface->Surface(ig.SurfPtr).Zone; @@ -157,194 +157,123 @@ namespace IndoorGreen { ShowSevereError(state, format("{}=\"{}\", invalid {} entered={}, {} is not assoicated with a thermal zone or space", RoutineName, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2), + s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } else if (state.dataSurface->Surface(ig.SurfPtr).ExtBoundCond < 0 || state.dataSurface->Surface(ig.SurfPtr).HeatTransferAlgorithm != DataSurfaces::HeatTransferModel::CTF) { ShowSevereError(state, format("{}=\"{}\", invalid {} entered={}, not a valid surface for indoor green module", RoutineName, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } } - ig.SchedPtr = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(3)); - if (ig.SchedPtr == 0) { - ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3)); + + if ((ig.sched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3)); + ErrorsFound = true; + } else if (!ig.sched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3), Clusive::In, 0.0); ErrorsFound = true; - } else { // check min/max on schedule - SchMin = ScheduleManager::GetScheduleMinValue(state, ig.SchedPtr); - SchMax = ScheduleManager::GetScheduleMaxValue(state, ig.SchedPtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (SchMin < 0.0) { - ShowSevereError(state, - format("{}=\"{}\", {}, minimum is < 0.0", - RoutineName, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(3))); - ShowContinueError( - state, - format("Schedule=\"{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", state.dataIPShortCut->cAlphaArgs(3), SchMin)); - ErrorsFound = true; - } - if (SchMax < 0.0) { - ShowSevereError(state, - format("{}=\"{}\", {}, maximum is < 0.0", - RoutineName, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(3))); - ShowContinueError( - state, - format("Schedule=\"{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", state.dataIPShortCut->cAlphaArgs(3), SchMin)); - ErrorsFound = true; - } - } } ig.etCalculationMethod = ETCalculationMethod::PenmanMonteith; // default - ig.etCalculationMethod = static_cast(getEnumValue(etCalculationMethodsUC, state.dataIPShortCut->cAlphaArgs(4))); + ig.etCalculationMethod = static_cast(getEnumValue(etCalculationMethodsUC, s_ipsc->cAlphaArgs(4))); ig.lightingMethod = LightingMethod::LED; // default - ig.lightingMethod = static_cast(getEnumValue(lightingMethodsUC, state.dataIPShortCut->cAlphaArgs(5))); + ig.lightingMethod = static_cast(getEnumValue(lightingMethodsUC, s_ipsc->cAlphaArgs(5))); + switch (ig.lightingMethod) { case LightingMethod::LED: { - ig.SchedLEDPtr = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(6)); - if (ig.SchedLEDPtr == 0) { - ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(6), state.dataIPShortCut->cAlphaArgs(6)); + if ((ig.ledSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(6))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(6), s_ipsc->cAlphaArgs(6)); + ErrorsFound = true; + } else if (!ig.ledSched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, s_ipsc->cAlphaFieldNames(6), s_ipsc->cAlphaArgs(6), Clusive::In, 0.0); ErrorsFound = true; - } else { // check min/max on schedule - SchMin = ScheduleManager::GetScheduleMinValue(state, ig.SchedLEDPtr); - SchMax = ScheduleManager::GetScheduleMaxValue(state, ig.SchedLEDPtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (SchMin < 0.0) { - ShowSevereError(state, - format("{}=\"{}\", {}, minimum is < 0.0", - RoutineName, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(6))); - ShowContinueError( - state, - format("Schedule=\"{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", state.dataIPShortCut->cAlphaArgs(6), SchMin)); - ErrorsFound = true; - } - if (SchMax < 0.0) { - ShowSevereError(state, - format("{}=\"{}\", {}, maximum is < 0.0", - RoutineName, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(6))); - ShowContinueError( - state, - format("Schedule=\"{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", state.dataIPShortCut->cAlphaArgs(6), SchMin)); - ErrorsFound = true; - } - } } } break; case LightingMethod::Daylighting: { - ig.LightRefPtr = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(7), + ig.LightRefPtr = Util::FindItemInList(s_ipsc->cAlphaArgs(7), state.dataDayltg->DaylRefPt, &EnergyPlus::Dayltg::RefPointData::Name); // Field: Daylighting Reference Point Name - ig.LightControlPtr = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(7), + ig.LightControlPtr = Util::FindItemInList(s_ipsc->cAlphaArgs(7), state.dataDayltg->daylightControl, &EnergyPlus::Dayltg::DaylightingControl::Name); // Field: Daylighting Control Name if (ig.LightControlPtr == 0) { - ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(7), state.dataIPShortCut->cAlphaArgs(7)); + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(7), s_ipsc->cAlphaArgs(7)); ErrorsFound = true; continue; } } break; case LightingMethod::LEDDaylighting: { - ig.LightRefPtr = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(7), + ig.LightRefPtr = Util::FindItemInList(s_ipsc->cAlphaArgs(7), state.dataDayltg->DaylRefPt, &EnergyPlus::Dayltg::RefPointData::Name); // Field: Daylighting Reference Point Name - ig.LightControlPtr = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(7), + ig.LightControlPtr = Util::FindItemInList(s_ipsc->cAlphaArgs(7), state.dataDayltg->daylightControl, &EnergyPlus::Dayltg::DaylightingControl::Name); // Field: Daylighting Control Name if (ig.LightControlPtr == 0) { - ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(7), state.dataIPShortCut->cAlphaArgs(7)); + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(7), s_ipsc->cAlphaArgs(7)); ErrorsFound = true; continue; } - ig.SchedLEDDaylightTargetPtr = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(8)); - if (ig.SchedLEDDaylightTargetPtr == 0) { - ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(8), state.dataIPShortCut->cAlphaArgs(8)); + + if ((ig.ledDaylightTargetSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(8))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(8), s_ipsc->cAlphaArgs(8)); + ErrorsFound = true; + } else if (!ig.ledDaylightTargetSched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, s_ipsc->cAlphaFieldNames(8), s_ipsc->cAlphaArgs(8), Clusive::In, 0.0); ErrorsFound = true; - } else { // check min/max on schedule - SchMin = ScheduleManager::GetScheduleMinValue(state, ig.SchedLEDDaylightTargetPtr); - SchMax = ScheduleManager::GetScheduleMaxValue(state, ig.SchedLEDDaylightTargetPtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (SchMin < 0.0) { - ShowSevereError(state, - format("{}=\"{}\", {}, minimum is < 0.0", - RoutineName, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(8))); - ShowContinueError( - state, - format("Schedule=\"{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", state.dataIPShortCut->cAlphaArgs(8), SchMin)); - ErrorsFound = true; - } - if (SchMax < 0.0) { - ShowSevereError(state, - format("{}=\"{}\", {}, maximum is < 0.0", - RoutineName, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(8))); - ShowContinueError( - state, - format("Schedule=\"{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", state.dataIPShortCut->cAlphaArgs(8), SchMin)); - ErrorsFound = true; - } - } } } break; + default: break; } - ig.LeafArea = state.dataIPShortCut->rNumericArgs(1); + ig.LeafArea = s_ipsc->rNumericArgs(1); if (ig.LeafArea < 0) { ShowSevereError(state, format("{}=\"{}\", invalid {} entered={}", RoutineName, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(1), - state.dataIPShortCut->rNumericArgs(1))); + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(1), + s_ipsc->rNumericArgs(1))); ErrorsFound = true; } - ig.LEDNominalPPFD = state.dataIPShortCut->rNumericArgs(2); + ig.LEDNominalPPFD = s_ipsc->rNumericArgs(2); if (ig.LEDNominalPPFD < 0) { ShowSevereError(state, format("{}=\"{}\", invalid {} entered={}", RoutineName, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(2), - state.dataIPShortCut->rNumericArgs(2))); + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(2), + s_ipsc->rNumericArgs(2))); ErrorsFound = true; } - ig.LEDNominalEleP = state.dataIPShortCut->rNumericArgs(3); + ig.LEDNominalEleP = s_ipsc->rNumericArgs(3); if (ig.LEDNominalEleP < 0) { ShowSevereError(state, format("{}=\"{}\", invalid {} entered={}", RoutineName, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(3), - state.dataIPShortCut->rNumericArgs(3))); + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(3), + s_ipsc->rNumericArgs(3))); ErrorsFound = true; } - ig.LEDRadFraction = state.dataIPShortCut->rNumericArgs(4); + ig.LEDRadFraction = s_ipsc->rNumericArgs(4); if (ig.LEDRadFraction < 0 || ig.LEDRadFraction > 1.0) { ShowSevereError(state, format("{}=\"{}\", invalid {} entered={}", RoutineName, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cNumericFieldNames(4), - state.dataIPShortCut->rNumericArgs(4))); + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(4), + s_ipsc->rNumericArgs(4))); ErrorsFound = true; } if (state.dataGlobal->AnyEnergyManagementSystemInModel) { @@ -459,7 +388,7 @@ namespace IndoorGreen { } } - void InitIndoorGreen(EnergyPlusData &state) + void InitIndoorGreen(EnergyPlusData const &state) { // Set the reporting variables to zero at each timestep. for (auto &ig : state.dataIndoorGreen->indoorGreens) { @@ -518,7 +447,7 @@ namespace IndoorGreen { } switch (ig.lightingMethod) { case LightingMethod::LED: { - ig.ZPPFD = ScheduleManager::GetCurrentScheduleValue(state, ig.SchedLEDPtr) * ig.LEDNominalPPFD; // PPFD + ig.ZPPFD = ig.ledSched->getCurrentVal() * ig.LEDNominalPPFD; // PPFD ig.LEDActualPPFD = ig.LEDNominalPPFD; ig.LEDActualEleP = ig.LEDNominalEleP; ig.LEDActualEleCon = ig.LEDNominalEleP * Timestep; @@ -533,8 +462,9 @@ namespace IndoorGreen { 77; // To be updated currently only take one reference point; 77 conversion factor from Lux to PPFD } } break; + case LightingMethod::LEDDaylighting: { - Real64 a = ScheduleManager::GetCurrentScheduleValue(state, ig.SchedLEDDaylightTargetPtr); + Real64 a = ig.ledDaylightTargetSched->getCurrentVal(); Real64 b = 0; if (!state.dataDayltg->CalcDayltghCoefficients_firstTime && state.dataEnvrn->SunIsUp) { b = state.dataDayltg->daylightControl(ig.LightControlPtr).refPts(1).lums[DataSurfaces::iLum_Illum] / @@ -564,9 +494,8 @@ namespace IndoorGreen { ig.ETRate = ETBaseFunction(state, ZonePreTemp, ZonePreHum, ZonePPFD, ZoneVPD, LAI, SwitchF); } Real64 effectivearea = std::min(ig.LeafArea, LAI * state.dataSurface->Surface(ig.SurfPtr).Area); - ETTotal = - ig.ETRate * Timestep * effectivearea * - ScheduleManager::GetCurrentScheduleValue(state, ig.SchedPtr); // kg; this unit area should be surface area instead of total leaf area + ETTotal = ig.ETRate * Timestep * effectivearea * + ig.sched->getCurrentVal(); // kg; this unit area should be surface area instead of total leaf area Real64 hfg = Psychrometrics::PsyHfgAirFnWTdb(ZonePreHum, ZonePreTemp) / std::pow(10, 6); // Latent heat of vaporization (MJ/kg) ig.LambdaET = ETTotal * hfg * std::pow(10, 6) / state.dataSurface->Surface(ig.SurfPtr).Area / Timestep; // (W/m2)) rhoair = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, ZonePreTemp, ZonePreHum); diff --git a/src/EnergyPlus/IndoorGreen.hh b/src/EnergyPlus/IndoorGreen.hh index 58e664bff8c..686e982a860 100644 --- a/src/EnergyPlus/IndoorGreen.hh +++ b/src/EnergyPlus/IndoorGreen.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -81,16 +81,15 @@ namespace IndoorGreen { std::string Name; std::string ZoneName; std::string SurfName; - std::string Schedule; - int SchedPtr = 0; - int SchedLEDPtr = 0; - int LightRefPtr = 0; // daylight reference point number; - int LightControlPtr = 0; // daylight control point number; - int SchedLEDDaylightTargetPtr = 0; // LED-Daylight PPFD setpoint schedule pointer - Real64 LeafArea = 0.0; // one-sided leaf area - Real64 LEDNominalPPFD = 0.0; // nominal PPFD for LED grow light (PPFD) - Real64 LEDNominalEleP = 0.0; // nominal power for total LED grow light (W) - Real64 LEDRadFraction = 0.0; // radiant fraction of LED grow light (0-1) + Sched::Schedule *sched = nullptr; + Sched::Schedule *ledSched = nullptr; + int LightRefPtr = 0; // daylight reference point number; + int LightControlPtr = 0; // daylight control point number; + Sched::Schedule *ledDaylightTargetSched = nullptr; // LED-Daylight PPFD setpoint schedule + Real64 LeafArea = 0.0; // one-sided leaf area + Real64 LEDNominalPPFD = 0.0; // nominal PPFD for LED grow light (PPFD) + Real64 LEDNominalEleP = 0.0; // nominal power for total LED grow light (W) + Real64 LEDRadFraction = 0.0; // radiant fraction of LED grow light (0-1) Real64 ZCO2 = 400; Real64 ZVPD = 0.0; // vapor pressure deficit (pa) Real64 ZPPFD = 0; // PPFD @@ -117,7 +116,7 @@ namespace IndoorGreen { void SimIndoorGreen(EnergyPlusData &state); void GetIndoorGreenInput(EnergyPlusData &state, bool &ErrorsFound); void SetIndoorGreenOutput(EnergyPlusData &state); - void InitIndoorGreen(EnergyPlusData &state); + void InitIndoorGreen(EnergyPlusData const &state); void ETModel(EnergyPlusData &state); Real64 ETBaseFunction(EnergyPlusData &state, Real64 ZonePreTemp, Real64 ZonePreHum, Real64 ZonePPFD, Real64 VPD, Real64 LAI, Real64 SwitchF); @@ -129,6 +128,10 @@ struct IndoorGreenData : BaseGlobalStruct bool getInputFlag = true; Array1D indoorGreens; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/InputProcessing/CsvParser.cc b/src/EnergyPlus/InputProcessing/CsvParser.cc index e4f86d42bdb..4efaaad4be6 100644 --- a/src/EnergyPlus/InputProcessing/CsvParser.cc +++ b/src/EnergyPlus/InputProcessing/CsvParser.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/InputProcessing/CsvParser.hh b/src/EnergyPlus/InputProcessing/CsvParser.hh index 7a32ad21f92..bb7a305c5ea 100644 --- a/src/EnergyPlus/InputProcessing/CsvParser.hh +++ b/src/EnergyPlus/InputProcessing/CsvParser.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/InputProcessing/DataStorage.hh b/src/EnergyPlus/InputProcessing/DataStorage.hh index e1f58fac48c..04f46996f18 100644 --- a/src/EnergyPlus/InputProcessing/DataStorage.hh +++ b/src/EnergyPlus/InputProcessing/DataStorage.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/InputProcessing/IdfParser.cc b/src/EnergyPlus/InputProcessing/IdfParser.cc index f6a3869db05..5218180141b 100644 --- a/src/EnergyPlus/InputProcessing/IdfParser.cc +++ b/src/EnergyPlus/InputProcessing/IdfParser.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/InputProcessing/IdfParser.hh b/src/EnergyPlus/InputProcessing/IdfParser.hh index 7ca3a26c229..3ea5f689276 100644 --- a/src/EnergyPlus/InputProcessing/IdfParser.hh +++ b/src/EnergyPlus/InputProcessing/IdfParser.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/InputProcessing/InputProcessor.cc b/src/EnergyPlus/InputProcessing/InputProcessor.cc index b66d70f7d01..2bb20b1c390 100644 --- a/src/EnergyPlus/InputProcessing/InputProcessor.cc +++ b/src/EnergyPlus/InputProcessing/InputProcessor.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -648,7 +648,7 @@ std::string InputProcessor::getAlphaFieldValue(json const &ep_object, json const Real64 InputProcessor::getRealFieldValue(json const &ep_object, json const &schema_obj_props, std::string const &fieldName) { // Return the value of fieldName in ep_object as a Real64. - // If the field value is a string, then assum autosize and return Constant::AutoCalculate(-99999). + // If the field value is a string, then assume autosize and return Constant::AutoCalculate(-99999). // If the field is not present in ep_object then return its default if there is one, or return 0.0 auto it = ep_object.find(fieldName); if (it != ep_object.end()) { @@ -681,7 +681,7 @@ Real64 InputProcessor::getRealFieldValue(json const &ep_object, json const &sche int InputProcessor::getIntFieldValue(json const &ep_object, json const &schema_obj_props, std::string const &fieldName) { // Return the value of fieldName in ep_object as an integer. - // If the field value is a string, then assume autosize or autocalulate and return Constant::AutoCalculate(-99999). + // If the field value is a string, then assume autosize or autocalculate and return Constant::AutoCalculate(-99999). // If the field is not present in ep_object then return its default if there is one, or return 0 auto const &schema_field_obj = schema_obj_props[fieldName]; @@ -1473,7 +1473,7 @@ void InputProcessor::reportIDFRecordsStats(EnergyPlusData &state) state.dataOutput->iNumberOfDefaultedFields = 0; // Number of defaulted fields in IDF state.dataOutput->iTotalFieldsWithDefaults = 0; // Total number of fields that could be defaulted state.dataOutput->iNumberOfAutoSizedFields = 0; // Number of autosized fields in IDF - state.dataOutput->iTotalAutoSizableFields = 0; // Total number of autosizeable fields + state.dataOutput->iTotalAutoSizableFields = 0; // Total number of autosizable fields state.dataOutput->iNumberOfAutoCalcedFields = 0; // Number of autocalculated fields state.dataOutput->iTotalAutoCalculatableFields = 0; // Total number of autocalculatable fields @@ -1710,7 +1710,7 @@ void InputProcessor::preProcessorCheck(EnergyPlusData &state, bool &PreP_Fatal) // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // This routine checks for existance of "Preprocessor Message" object and + // This routine checks for existence of "Preprocessor Message" object and // performs appropriate action. // METHODOLOGY EMPLOYED: diff --git a/src/EnergyPlus/InputProcessing/InputProcessor.hh b/src/EnergyPlus/InputProcessing/InputProcessor.hh index 548672f99c3..ffe62f1938d 100644 --- a/src/EnergyPlus/InputProcessing/InputProcessor.hh +++ b/src/EnergyPlus/InputProcessing/InputProcessor.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -324,6 +324,10 @@ struct DataInputProcessing : BaseGlobalStruct { std::unique_ptr inputProcessor = InputProcessor::factory(); + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/InputProcessing/InputValidation.cc b/src/EnergyPlus/InputProcessing/InputValidation.cc index 859ca3444dc..e4e2aee9614 100644 --- a/src/EnergyPlus/InputProcessing/InputValidation.cc +++ b/src/EnergyPlus/InputProcessing/InputValidation.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/InputProcessing/InputValidation.hh b/src/EnergyPlus/InputProcessing/InputValidation.hh index 7eb19b102ed..17ae099a5bf 100644 --- a/src/EnergyPlus/InputProcessing/InputValidation.hh +++ b/src/EnergyPlus/InputProcessing/InputValidation.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/IntegratedHeatPump.cc b/src/EnergyPlus/IntegratedHeatPump.cc index 801d5d6707a..6a12ab136ca 100644 --- a/src/EnergyPlus/IntegratedHeatPump.cc +++ b/src/EnergyPlus/IntegratedHeatPump.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/IntegratedHeatPump.hh b/src/EnergyPlus/IntegratedHeatPump.hh index 59ab4dcf512..1aac62921c5 100644 --- a/src/EnergyPlus/IntegratedHeatPump.hh +++ b/src/EnergyPlus/IntegratedHeatPump.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -350,6 +350,10 @@ struct IntegratedHeatPumpGlobalData : BaseGlobalStruct bool GetCoilsInputFlag = true; EPVector IntegratedHeatPumps; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/InternalHeatGains.cc b/src/EnergyPlus/InternalHeatGains.cc index d6d7315043e..ccc90568497 100644 --- a/src/EnergyPlus/InternalHeatGains.cc +++ b/src/EnergyPlus/InternalHeatGains.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -127,6 +127,67 @@ namespace InternalHeatGains { using namespace DataHeatBalance; using namespace DataSurfaces; + static constexpr std::array IntGainTypesPeople = {DataHeatBalance::IntGainType::People}; + static constexpr std::array IntGainTypesLight = {DataHeatBalance::IntGainType::Lights}; + static constexpr std::array IntGainTypesEquip = {DataHeatBalance::IntGainType::ElectricEquipment, + DataHeatBalance::IntGainType::ElectricEquipmentITEAirCooled, + DataHeatBalance::IntGainType::GasEquipment, + DataHeatBalance::IntGainType::HotWaterEquipment, + DataHeatBalance::IntGainType::SteamEquipment, + DataHeatBalance::IntGainType::OtherEquipment, + DataHeatBalance::IntGainType::IndoorGreen}; + static constexpr std::array IntGainTypesRefrig = { + DataHeatBalance::IntGainType::RefrigerationCase, + DataHeatBalance::IntGainType::RefrigerationCompressorRack, + DataHeatBalance::IntGainType::RefrigerationSystemAirCooledCondenser, + DataHeatBalance::IntGainType::RefrigerationSystemSuctionPipe, + DataHeatBalance::IntGainType::RefrigerationSecondaryReceiver, + DataHeatBalance::IntGainType::RefrigerationSecondaryPipe, + DataHeatBalance::IntGainType::RefrigerationWalkIn, + DataHeatBalance::IntGainType::RefrigerationTransSysAirCooledGasCooler, + DataHeatBalance::IntGainType::RefrigerationTransSysSuctionPipeMT, + DataHeatBalance::IntGainType::RefrigerationTransSysSuctionPipeLT}; + static constexpr std::array IntGainTypesWaterUse = {DataHeatBalance::IntGainType::WaterUseEquipment, + DataHeatBalance::IntGainType::WaterHeaterMixed, + DataHeatBalance::IntGainType::WaterHeaterStratified}; + static constexpr std::array IntGainTypesHvacLoss = { + DataHeatBalance::IntGainType::ZoneBaseboardOutdoorTemperatureControlled, + DataHeatBalance::IntGainType::ThermalStorageChilledWaterMixed, + DataHeatBalance::IntGainType::ThermalStorageChilledWaterStratified, + DataHeatBalance::IntGainType::PipeIndoor, + DataHeatBalance::IntGainType::Pump_VarSpeed, + DataHeatBalance::IntGainType::Pump_ConSpeed, + DataHeatBalance::IntGainType::Pump_Cond, + DataHeatBalance::IntGainType::PumpBank_VarSpeed, + DataHeatBalance::IntGainType::PumpBank_ConSpeed, + DataHeatBalance::IntGainType::PlantComponentUserDefined, + DataHeatBalance::IntGainType::CoilUserDefined, + DataHeatBalance::IntGainType::ZoneHVACForcedAirUserDefined, + DataHeatBalance::IntGainType::AirTerminalUserDefined, + DataHeatBalance::IntGainType::PackagedTESCoilTank, + DataHeatBalance::IntGainType::FanSystemModel, + DataHeatBalance::IntGainType::SecCoolingDXCoilSingleSpeed, + DataHeatBalance::IntGainType::SecHeatingDXCoilSingleSpeed, + DataHeatBalance::IntGainType::SecCoolingDXCoilTwoSpeed, + DataHeatBalance::IntGainType::SecCoolingDXCoilMultiSpeed, + DataHeatBalance::IntGainType::SecHeatingDXCoilMultiSpeed}; + static constexpr std::array IntGainTypesPowerGen = { + DataHeatBalance::IntGainType::GeneratorFuelCell, + DataHeatBalance::IntGainType::GeneratorMicroCHP, + DataHeatBalance::IntGainType::ElectricLoadCenterTransformer, + DataHeatBalance::IntGainType::ElectricLoadCenterInverterSimple, + DataHeatBalance::IntGainType::ElectricLoadCenterInverterFunctionOfPower, + DataHeatBalance::IntGainType::ElectricLoadCenterInverterLookUpTable, + DataHeatBalance::IntGainType::ElectricLoadCenterStorageLiIonNmcBattery, + DataHeatBalance::IntGainType::ElectricLoadCenterStorageBattery, + DataHeatBalance::IntGainType::ElectricLoadCenterStorageSimple, + DataHeatBalance::IntGainType::ElectricLoadCenterConverter}; + // Explicitly list internal gains not gathered here + static constexpr std::array ExcludedIntGainTypes = { + DataHeatBalance::IntGainType::ZoneContaminantSourceAndSinkCarbonDioxide, + DataHeatBalance::IntGainType::DaylightingDeviceTubular, + DataHeatBalance::IntGainType::ZoneContaminantSourceAndSinkGenericContam}; + void ManageInternalHeatGains(EnergyPlusData &state, ObjexxFCL::Optional_bool_const InitOnly) // when true, just calls the get input, if appropriate and returns. { @@ -190,8 +251,6 @@ namespace InternalHeatGains { // ZoneBaseboard:OutdoorTemperatureControlled // Using/Aliasing - using namespace ScheduleManager; - using namespace OutputReportPredefined; using namespace DataLoopNode; using Curve::GetCurveIndex; @@ -199,6 +258,7 @@ namespace InternalHeatGains { // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetInternalHeatGains: "); + static constexpr std::string_view routineName = "GetInternalHeatGains"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int IOStat; @@ -210,8 +270,6 @@ namespace InternalHeatGains { Real64 OthTot; // Total Other load for calculating other load per square meter Real64 HWETot; // Total Hot Water Equipment for calculating HWE per square meter Real64 StmTot; // Total Steam for calculating Steam per square meter - Real64 SchMin; - Real64 SchMax; // Formats static constexpr std::string_view Format_720(" Zone Internal Gains Nominal, {},{:.2R},{:.1R},"); @@ -256,7 +314,7 @@ namespace InternalHeatGains { const std::string bbModuleObject = "ZoneBaseboard:OutdoorTemperatureControlled"; const std::string contamSSModuleObject = "ZoneContaminantSourceAndSink:CarbonDioxide"; - // Because there are occassions where getObjectItem will be called a second time within the routine (#9680) + // Because there are occasions where getObjectItem will be called a second time within the routine (#9680) // We should use local arrays instead of state.dataIPShortCut int IHGNumAlphas = 0; int IHGNumNumbers = 0; @@ -318,6 +376,7 @@ namespace InternalHeatGains { IHGAlphaFieldNames, IHGNumericFieldNames); + ErrorObjectHeader eoh{routineName, peopleModuleObject, IHGAlphas(1)}; // Create one People instance for every space associated with this People input object auto &thisPeopleInput = peopleObjects(peopleInputNum); for (int Item1 = 1; Item1 <= thisPeopleInput.numOfSpaces; ++Item1) { @@ -329,59 +388,23 @@ namespace InternalHeatGains { thisPeople.spaceIndex = spaceNum; thisPeople.ZonePtr = zoneNum; - thisPeople.NumberOfPeoplePtr = GetScheduleIndex(state, IHGAlphas(3)); - SchMin = 0.0; - SchMax = 0.0; - if (thisPeople.NumberOfPeoplePtr == 0) { - if (Item1 == 1) { // only show error on first one - if (IHGAlphaFieldBlanks(3)) { - ShowSevereError( - state, - format("{}{}=\"{}\", {} is required.", RoutineName, peopleModuleObject, IHGAlphas(1), IHGAlphaFieldNames(3))); - } else { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered={}", - RoutineName, - peopleModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(3), - IHGAlphas(3))); - } + thisPeople.sched = Sched::GetSchedule(state, IHGAlphas(3)); + + if (Item1 == 1) { // only show error on first one + if (IHGAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(3)); + ErrorsFound = true; + } else if (thisPeople.sched == nullptr) { + ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3)); + ErrorsFound = true; + } else if (!thisPeople.sched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3), Clusive::In, 0.0); ErrorsFound = true; - } - } else { // check min/max on schedule - SchMin = GetScheduleMinValue(state, thisPeople.NumberOfPeoplePtr); - SchMax = GetScheduleMaxValue(state, thisPeople.NumberOfPeoplePtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (Item1 == 1) { - if (SchMin < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, minimum is < 0.0", - RoutineName, - peopleModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(3))); - ShowContinueError(state, - format("Schedule=\"{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", IHGAlphas(3), SchMin)); - ErrorsFound = true; - } - if (SchMax < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, maximum is < 0.0", - RoutineName, - peopleModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(3))); - ShowContinueError(state, - format("Schedule=\"{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", IHGAlphas(3), SchMax)); - ErrorsFound = true; - } - } } } // Number of people calculation method. - { + { // Why open a new scope here std::string const &peopleMethod = IHGAlphas(4); if (peopleMethod == "PEOPLE") { // Set space load fraction @@ -491,8 +514,8 @@ namespace InternalHeatGains { } // Calculate nominal min/max people - thisPeople.NomMinNumberPeople = thisPeople.NumberOfPeople * SchMin; - thisPeople.NomMaxNumberPeople = thisPeople.NumberOfPeople * SchMax; + thisPeople.NomMinNumberPeople = thisPeople.NumberOfPeople * thisPeople.sched->getMinVal(state); + thisPeople.NomMaxNumberPeople = thisPeople.NumberOfPeople * thisPeople.sched->getMaxVal(state); if (zoneNum > 0) { state.dataHeatBal->Zone(zoneNum).TotOccupants += thisPeople.NumberOfPeople; @@ -557,84 +580,44 @@ namespace InternalHeatGains { ErrorsFound = true; } - thisPeople.ActivityLevelPtr = GetScheduleIndex(state, IHGAlphas(5)); - if (thisPeople.ActivityLevelPtr == 0) { - if (Item1 == 1) { - if (IHGAlphaFieldBlanks(5)) { - ShowSevereError( - state, - format("{}{}=\"{}\", {} is required.", RoutineName, peopleModuleObject, IHGAlphas(1), IHGAlphaFieldNames(5))); - } else { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered={}", - RoutineName, - peopleModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(5), - IHGAlphas(5))); - } + thisPeople.activityLevelSched = Sched::GetSchedule(state, IHGAlphas(5)); + + if (Item1 == 1) { + if (IHGAlphaFieldBlanks(5)) { + ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(5)); ErrorsFound = true; - } - } else { // Check values in Schedule - SchMin = GetScheduleMinValue(state, thisPeople.ActivityLevelPtr); - SchMax = GetScheduleMaxValue(state, thisPeople.ActivityLevelPtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (Item1 == 1) { - if (SchMin < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {} minimum is < 0.0", - RoutineName, - peopleModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(5))); - ShowContinueError(state, - format("Schedule=\"{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", IHGAlphas(5), SchMin)); - ErrorsFound = true; - } - if (SchMax < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {} maximum is < 0.0", - RoutineName, - peopleModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(5))); - ShowContinueError(state, - format("Schedule=\"{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", IHGAlphas(5), SchMax)); - ErrorsFound = true; - } - } - } else if (SchMin < 70.0 || SchMax > 1000.0) { - if (Item1 == 1) { - ShowWarningError( - state, format("{}{}=\"{}\", {} values", RoutineName, peopleModuleObject, IHGAlphas(1), IHGAlphaFieldNames(5))); - ShowContinueError(state, "fall outside typical range [70,1000] W/person for Thermal Comfort Reporting."); - ShowContinueError(state, format("Odd comfort values may result; Schedule=\"{}\".", IHGAlphas(5))); - ShowContinueError(state, format("Entered min/max range=[{:.1R},] W/person.{:.1R}", SchMin, SchMax)); - } + } else if (thisPeople.activityLevelSched == nullptr) { + ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(5), IHGAlphas(5)); + ErrorsFound = true; + } else if (!thisPeople.activityLevelSched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(5), IHGAlphas(5), Clusive::In, 0.0); + ErrorsFound = true; + } else if (!thisPeople.activityLevelSched->checkMinMaxVals(state, Clusive::In, 70.0, Clusive::In, 1000.0)) { + Sched::ShowWarningBadMinMax(state, + eoh, + IHGAlphaFieldNames(5), + IHGAlphas(5), + Clusive::In, + 70.0, + Clusive::In, + 1000.0, + "Values fall outside of typical w/person range for thermal comfort reporting."); } } // Following is an optional parameter (ASHRAE 55 warnings if (IHGNumAlphas >= 6) { - if (Util::SameString(IHGAlphas(6), "Yes")) { - thisPeople.Show55Warning = true; - } else if (!Util::SameString(IHGAlphas(6), "No") && !IHGAlphaFieldBlanks(6)) { - if (Item1 == 1) { - ShowSevereError(state, - format("{}{}=\"{}\", {} field should be Yes or No", - RoutineName, - peopleModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(6))); - ShowContinueError(state, format("...Field value=\"{}\" is invalid.", IHGAlphas(6))); - ErrorsFound = true; - } + if (BooleanSwitch bs = getYesNoValue(IHGAlphas(6)); bs != BooleanSwitch::Invalid) { + thisPeople.Show55Warning = static_cast(bs); + } else if (Item1 == 1) { + ShowSevereInvalidKey(state, eoh, IHGAlphaFieldNames(6), IHGAlphas(6)); + ErrorsFound = true; } } if (IHGNumAlphas > 6) { // Optional parameters present--thermal comfort data follows... int lastOption = 0; - state.dataInternalHeatGains->UsingThermalComfort = false; + bool usingThermalComfort = false; if (IHGNumAlphas > 20) { lastOption = 20; } else { @@ -669,54 +652,48 @@ namespace InternalHeatGains { for (int OptionNum = NumFirstTCModel; OptionNum <= lastOption; ++OptionNum) { - { + { // Why are we starting a nested scope immediately after opening up a scope? std::string const &thermalComfortType = IHGAlphas(OptionNum); if (thermalComfortType == "FANGER") { thisPeople.Fanger = true; - state.dataInternalHeatGains->UsingThermalComfort = true; + usingThermalComfort = true; } else if (thermalComfortType == "PIERCE") { thisPeople.Pierce = true; state.dataHeatBal->AnyThermalComfortPierceModel = true; - state.dataInternalHeatGains->UsingThermalComfort = true; + usingThermalComfort = true; } else if (thermalComfortType == "KSU") { thisPeople.KSU = true; state.dataHeatBal->AnyThermalComfortKSUModel = true; - state.dataInternalHeatGains->UsingThermalComfort = true; + usingThermalComfort = true; } else if (thermalComfortType == "ADAPTIVEASH55") { thisPeople.AdaptiveASH55 = true; state.dataHeatBal->AdaptiveComfortRequested_ASH55 = true; - state.dataInternalHeatGains->UsingThermalComfort = true; + usingThermalComfort = true; } else if (thermalComfortType == "ADAPTIVECEN15251") { thisPeople.AdaptiveCEN15251 = true; state.dataHeatBal->AdaptiveComfortRequested_CEN15251 = true; - state.dataInternalHeatGains->UsingThermalComfort = true; + usingThermalComfort = true; } else if (thermalComfortType == "COOLINGEFFECTASH55") { thisPeople.CoolingEffectASH55 = true; state.dataHeatBal->AnyThermalComfortCoolingEffectModel = true; - state.dataInternalHeatGains->UsingThermalComfort = true; + usingThermalComfort = true; } else if (thermalComfortType == "ANKLEDRAFTASH55") { thisPeople.AnkleDraftASH55 = true; state.dataHeatBal->AnyThermalComfortAnkleDraftModel = true; - state.dataInternalHeatGains->UsingThermalComfort = true; + usingThermalComfort = true; } else if (thermalComfortType == "") { // Blank input field--just ignore this } else { // An invalid keyword was entered--warn but ignore if (Item1 == 1) { - ShowWarningError(state, - format("{}{}=\"{}\", invalid {} Option={}", - RoutineName, - peopleModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(OptionNum), - IHGAlphas(OptionNum))); + ShowWarningInvalidKey(state, eoh, IHGAlphaFieldNames(OptionNum), IHGAlphas(OptionNum), ""); ShowContinueError(state, "Valid Values are \"Fanger\", \"Pierce\", \"KSU\", \"AdaptiveASH55\", " "\"AdaptiveCEN15251\", \"CoolingEffectASH55\", \"AnkleDraftASH55\""); @@ -725,7 +702,7 @@ namespace InternalHeatGains { } } - if (state.dataInternalHeatGains->UsingThermalComfort) { + if (usingThermalComfort) { // Set the default value of MRTCalcType as 'EnclosureAveraged' thisPeople.MRTCalcType = DataHeatBalance::CalcMRT::EnclosureAveraged; @@ -791,297 +768,133 @@ namespace InternalHeatGains { ShowContinueError(state, "...Valid values are \"EnclosureAveraged\", \"SurfaceWeighted\", \"AngleFactor\"."); } } break; - } + } // switch (thisPeople.MRTCalcType) if (!IHGAlphaFieldBlanks(9)) { - thisPeople.WorkEffPtr = GetScheduleIndex(state, IHGAlphas(9)); - if (thisPeople.WorkEffPtr == 0) { - if (Item1 == 1) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered={}", - RoutineName, - peopleModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(9), - IHGAlphas(9))); + thisPeople.workEffSched = Sched::GetSchedule(state, IHGAlphas(9)); + } + + if (Item1 == 1) { + if (IHGAlphaFieldBlanks(9)) { + if (ModelWithAdditionalInputs) { + ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(9)); + ShowContinueError(state, + "It is required when Thermal Comfort Model Type is one of " + "\"Fanger\", \"Pierce\", \"KSU\", \"CoolingEffectASH55\" or \"AnkleDraftASH55\""); ErrorsFound = true; } - } else { // check min/max on schedule - SchMin = GetScheduleMinValue(state, thisPeople.WorkEffPtr); - SchMax = GetScheduleMaxValue(state, thisPeople.WorkEffPtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (SchMin < 0.0) { - if (Item1 == 1) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, minimum is < 0.0", - RoutineName, - peopleModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(9))); - ShowContinueError( - state, - format("Schedule=\"{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", IHGAlphas(9), SchMin)); - ErrorsFound = true; - } - } - if (SchMax < 0.0) { - if (Item1 == 1) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, maximum is < 0.0", - RoutineName, - peopleModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(9))); - ShowContinueError( - state, - format("Schedule=\"{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", IHGAlphas(9), SchMax)); - ErrorsFound = true; - } - } - } - if (SchMax > 1.0) { - if (Item1 == 1) { - ShowWarningError(state, - format("{}{}=\"{}\", {}, maximum is > 1.0", - RoutineName, - peopleModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(9))); - ShowContinueError(state, - format("Schedule=\"{}\"; Entered min/max range=[{:.1R},{:.1R}] Work Efficiency.", - IHGAlphas(9), - SchMin, - SchMax)); - } - } - } - } else if (ModelWithAdditionalInputs) { - if (Item1 == 1) { - ShowSevereError(state, - format("{}{}=\"{}\", blank {}. {} is required when Thermal Comfort Model Type is one of " - "\"Fanger\", \"Pierce\", \"KSU\", \"CoolingEffectASH55\" or \"AnkleDraftASH55\"", - RoutineName, - peopleModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(9), - IHGAlphaFieldNames(9))); + } else if (thisPeople.workEffSched == nullptr) { + ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(9), IHGAlphas(9)); + ErrorsFound = true; + } else if (!thisPeople.workEffSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, IHGAlphaFieldNames(9), IHGAlphas(9), Clusive::In, 0.0, Clusive::In, 1.0); ErrorsFound = true; } } - if (!IHGAlphaFieldBlanks(10) || !IHGAlphas(10).empty()) { - thisPeople.clothingType = static_cast(getEnumValue(clothingTypeNamesUC, IHGAlphas(10))); - if (thisPeople.clothingType == ClothingType::Invalid) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {}, value ={}", - RoutineName, - peopleModuleObject, - thisPeople.Name, - IHGAlphaFieldNames(10), - IHGAlphas(10))); - ShowContinueError(state, - format(R"(...Valid values are "{}", "{}", "{}")", - clothingTypeNamesUC[0], - clothingTypeNamesUC[1], - clothingTypeNamesUC[2])); - ErrorsFound = true; - } + if (IHGAlphas(10).empty()) { // Using IHGAlphaFieldBlanks(10) doesn't work because this value is defaulted + } else if ((thisPeople.clothingType = static_cast(getEnumValue(clothingTypeNamesUC, IHGAlphas(10)))) == + ClothingType::Invalid) { + ShowSevereInvalidKey(state, eoh, IHGAlphaFieldNames(10), IHGAlphas(10)); + ErrorsFound = true; + + } else { + switch (thisPeople.clothingType) { - case ClothingType::InsulationSchedule: - thisPeople.clothingType = ClothingType::InsulationSchedule; - thisPeople.ClothingPtr = GetScheduleIndex(state, IHGAlphas(12)); - if (thisPeople.ClothingPtr == 0 && ModelWithAdditionalInputs) { - if (Item1 == 1) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered=\"{}\".", - RoutineName, - peopleModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(12), - IHGAlphas(12))); - ErrorsFound = true; - } - } else { // check min/max on schedule - SchMin = GetScheduleMinValue(state, thisPeople.ClothingPtr); - SchMax = GetScheduleMaxValue(state, thisPeople.ClothingPtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (SchMin < 0.0) { - if (Item1 == 1) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, minimum is < 0.0", - RoutineName, - peopleModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(12))); - ShowContinueError(state, - format("Schedule=\"{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", - IHGAlphas(12), - SchMin)); - ErrorsFound = true; - } - } - if (SchMax < 0.0) { - if (Item1 == 1) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, maximum is < 0.0", - RoutineName, - peopleModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(12))); - ShowContinueError(state, - format("Schedule=\"{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", - IHGAlphas(12), - SchMax)); - ErrorsFound = true; - } + + case ClothingType::InsulationSchedule: { + + thisPeople.clothingSched = Sched::GetSchedule(state, IHGAlphas(12)); + if (Item1 == 1) { + if (IHGAlphaFieldBlanks(12)) { + if (ModelWithAdditionalInputs) { + ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(12), IHGAlphaFieldNames(10), IHGAlphas(10)); + ErrorsFound = true; } - } - if (SchMax > 2.0) { - if (Item1 == 1) { - ShowWarningError(state, - format("{}{}=\"{}\", {}, maximum is > 2.0", - RoutineName, - peopleModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(12))); - ShowContinueError(state, - format("Schedule=\"{}\"; Entered min/max range=[{:.1R},{:.1R}] Clothing.", - IHGAlphas(12), - SchMin, - SchMax)); + } else if (thisPeople.clothingSched == nullptr) { + if (ModelWithAdditionalInputs) { + ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(12), IHGAlphas(12)); + ErrorsFound = true; } + } else if (!thisPeople.clothingSched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(12), IHGAlphas(12), Clusive::In, 0.0); + ErrorsFound = true; + } else if (!thisPeople.clothingSched->checkMaxVal(state, Clusive::In, 2.0)) { + Sched::ShowWarningBadMax(state, eoh, IHGAlphaFieldNames(12), IHGAlphas(12), Clusive::In, 2.0, ""); } } - break; - - case ClothingType::DynamicAshrae55: - break; // nothing extra to do, at least for now - - case ClothingType::CalculationSchedule: - thisPeople.ClothingMethodPtr = GetScheduleIndex(state, IHGAlphas(11)); - if (thisPeople.ClothingMethodPtr == 0) { - if (Item1 == 1) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered=\"{}\".", - RoutineName, - peopleModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(11), - IHGAlphas(11))); + } break; + + case ClothingType::DynamicAshrae55: { + } break; // nothing extra to do, at least for now + + case ClothingType::CalculationSchedule: { + thisPeople.clothingMethodSched = Sched::GetSchedule(state, IHGAlphas(11)); + + if (Item1 == 1) { + if (thisPeople.clothingMethodSched == nullptr) { + ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(11), IHGAlphas(11)); ErrorsFound = true; } } - if (CheckScheduleValue(state, thisPeople.ClothingMethodPtr, 1)) { - thisPeople.ClothingPtr = GetScheduleIndex(state, IHGAlphas(12)); - if (thisPeople.ClothingPtr == 0) { + + if (thisPeople.clothingMethodSched->hasVal(state, 1)) { + if ((thisPeople.clothingSched = Sched::GetSchedule(state, IHGAlphas(12))) == nullptr) { if (Item1 == 1) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered=\"{}\".", - RoutineName, - peopleModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(12), - IHGAlphas(12))); + ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(12), IHGAlphas(12)); ErrorsFound = true; } } } - break; - default: - break; // nothing to do for the other cases - } + } break; + + default: { + } break; // nothing to do for the other cases + } // switch (thisPeople.clothingType) } - if (!IHGAlphaFieldBlanks(13)) { - thisPeople.AirVelocityPtr = GetScheduleIndex(state, IHGAlphas(13)); - if (thisPeople.AirVelocityPtr == 0) { - if (Item1 == 1) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered=\"{}\".", - RoutineName, - peopleModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(13), - IHGAlphas(13))); + if (IHGAlphaFieldBlanks(13)) { + } else { + thisPeople.airVelocitySched = Sched::GetSchedule(state, IHGAlphas(13)); + } + + if (Item1 == 1) { + if (IHGAlphaFieldBlanks(13)) { + if (ModelWithAdditionalInputs) { + ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(13)); + ShowContinueError(state, + "Required when Thermal Comfort Model Type is one of " + "\"Fanger\", \"Pierce\", \"KSU\", \"CoolingEffectASH55\" or \"AnkleDraftASH55\""); ErrorsFound = true; } - } else { // check min/max on schedule - SchMin = GetScheduleMinValue(state, thisPeople.AirVelocityPtr); - SchMax = GetScheduleMaxValue(state, thisPeople.AirVelocityPtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (SchMin < 0.0) { - if (Item1 == 1) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, minimum is < 0.0", - RoutineName, - peopleModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(13))); - ShowContinueError( - state, - format("Schedule=\"{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", IHGAlphas(13), SchMin)); - ErrorsFound = true; - } - } - if (SchMax < 0.0) { - if (Item1 == 1) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, maximum is < 0.0", - RoutineName, - peopleModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(13))); - ShowContinueError( - state, - format("Schedule=\"{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", IHGAlphas(13), SchMax)); - ErrorsFound = true; - } - } - } - } - } else if (ModelWithAdditionalInputs) { - if (Item1 == 1) { - ShowSevereError(state, - format("{}{}=\"{}\", blank {}. {} is required when Thermal Comfort Model Type is one of " - "\"Fanger\", \"Pierce\", \"KSU\", \"CoolingEffectASH55\" or \"AnkleDraftASH55\"", - RoutineName, - peopleModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(13), - IHGAlphaFieldNames(13))); + } else if (thisPeople.airVelocitySched == nullptr) { + ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(13), IHGAlphas(13)); + ErrorsFound = true; + } else if (!thisPeople.airVelocitySched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(13), IHGAlphas(13), Clusive::In, 0.0); ErrorsFound = true; } } - int indexAnkleAirVelPtr = 21; - if (!IHGAlphaFieldBlanks(indexAnkleAirVelPtr) || !IHGAlphas(indexAnkleAirVelPtr).empty()) { - thisPeople.AnkleAirVelocityPtr = GetScheduleIndex(state, IHGAlphas(indexAnkleAirVelPtr)); - if (thisPeople.AnkleAirVelocityPtr == 0) { - if (Item1 == 1) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered=\"{}\".", - RoutineName, - peopleModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(indexAnkleAirVelPtr), - IHGAlphas(indexAnkleAirVelPtr))); + if (IHGAlphas(21).empty()) { // Using IHGAlphaFieldBlanks(21) doesn't work because this field has a default + } else { + thisPeople.ankleAirVelocitySched = Sched::GetSchedule(state, IHGAlphas(21)); + } + + if (Item1 == 1) { + if (IHGAlphaFieldBlanks(21)) { + if (thisPeople.AnkleDraftASH55) { + ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(21), IHGAlphas(21)); + ShowContinueError(state, + "Required when Thermal Comfort Model Type is one of " + "\"Fanger\", \"Pierce\", \"KSU\", \"CoolingEffectASH55\" or \"AnkleDraftASH55\""); ErrorsFound = true; } - } - } else if (thisPeople.AnkleDraftASH55) { - if (Item1 == 1) { - ShowSevereError(state, - format("{}{}=\"{}\", blank {}. {} is required when Thermal Comfort Model Type is one of " - "\"Fanger\", \"Pierce\", \"KSU\", \"CoolingEffectASH55\" or \"AnkleDraftASH55\"", - RoutineName, - peopleModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(indexAnkleAirVelPtr), - IHGAlphaFieldNames(indexAnkleAirVelPtr))); + } else if (thisPeople.ankleAirVelocitySched == nullptr) { + ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(21), IHGAlphas(21)); ErrorsFound = true; } } - } // usingthermalcomfort block } // ...end of thermal comfort data IF-THEN block (IHGNumAlphass > 6) @@ -1141,11 +954,10 @@ namespace InternalHeatGains { Real64 maxOccupLoad = 0.0; int OptionNum = 0; for (int Loop1 = 1; Loop1 <= state.dataHeatBal->TotPeople; ++Loop1) { - if (state.dataHeatBal->People(Loop1).ZonePtr != Loop) continue; - if (maxOccupLoad < GetScheduleMaxValue(state, state.dataHeatBal->People(Loop1).NumberOfPeoplePtr) * - state.dataHeatBal->People(Loop1).NumberOfPeople) { - maxOccupLoad = GetScheduleMaxValue(state, state.dataHeatBal->People(Loop1).NumberOfPeoplePtr) * - state.dataHeatBal->People(Loop1).NumberOfPeople; + auto const &people = state.dataHeatBal->People(Loop1); + if (people.ZonePtr != Loop) continue; + if (maxOccupLoad < people.sched->getCurrentVal() * people.NumberOfPeople) { + maxOccupLoad = people.sched->getCurrentVal() * people.NumberOfPeople; OptionNum = Loop1; } } @@ -1165,7 +977,7 @@ namespace InternalHeatGains { ShowContinueError(state, format("Check values in People={}, Number of People Schedule={}", state.dataHeatBal->People(OptionNum).Name, - GetScheduleName(state, state.dataHeatBal->People(OptionNum).NumberOfPeoplePtr))); + state.dataHeatBal->People(OptionNum).sched->getCurrentVal())); } } } @@ -1189,6 +1001,8 @@ namespace InternalHeatGains { // Lights // Declared in state because the lights inputs are needed for demand manager int numLightsStatements = 0; + Real64 sumArea = 0.0; // sum of floor area for all lights objects + Real64 sumPower = 0.0; // sum of power for all lights objects setupIHGZonesAndSpaces( state, lightsModuleObject, state.dataInternalHeatGains->lightsObjects, numLightsStatements, state.dataHeatBal->TotLights, ErrorsFound); @@ -1211,8 +1025,11 @@ namespace InternalHeatGains { IHGAlphaFieldNames, IHGNumericFieldNames); + ErrorObjectHeader eoh{routineName, lightsModuleObject, IHGAlphas(1)}; + auto &thisLightsInput = state.dataInternalHeatGains->lightsObjects(lightsInputNum); // Create one Lights instance for every space associated with this Lights input object + // Why? Why can't multple spaces share a single lights instance? for (int Item1 = 1; Item1 <= thisLightsInput.numOfSpaces; ++Item1) { ++lightsNum; auto &thisLights = state.dataHeatBal->Lights(lightsNum); @@ -1222,54 +1039,20 @@ namespace InternalHeatGains { thisLights.spaceIndex = spaceNum; thisLights.ZonePtr = zoneNum; - thisLights.SchedPtr = GetScheduleIndex(state, IHGAlphas(3)); - SchMin = 0.0; - SchMax = 0.0; - if (thisLights.SchedPtr == 0) { - if (Item1 == 1) { - if (IHGAlphaFieldBlanks(3)) { - ShowSevereError( - state, - format("{}{}=\"{}\", {} is required.", RoutineName, lightsModuleObject, IHGAlphas(1), IHGAlphaFieldNames(3))); - } else { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered={}", - RoutineName, - lightsModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(3), - IHGAlphas(3))); - } + if (!IHGAlphaFieldBlanks(3)) { + thisLights.sched = Sched::GetSchedule(state, IHGAlphas(3)); + } + + if (Item1 == 1) { + if (IHGAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(3)); + ErrorsFound = true; + } else if (thisLights.sched == nullptr) { + ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3)); + ErrorsFound = true; + } else if (!thisLights.sched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3), Clusive::In, 0.0); ErrorsFound = true; - } - } else { // check min/max on schedule - SchMin = GetScheduleMinValue(state, thisLights.SchedPtr); - SchMax = GetScheduleMaxValue(state, thisLights.SchedPtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (Item1 == 1) { - if (SchMin < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, minimum is < 0.0", - RoutineName, - lightsModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(3))); - ShowContinueError(state, - format("Schedule=\"{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", IHGAlphas(3), SchMin)); - ErrorsFound = true; - } - if (SchMax < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, maximum is < 0.0", - RoutineName, - lightsModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(3))); - ShowContinueError(state, - format("Schedule=\"{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", IHGAlphas(3), SchMax)); - ErrorsFound = true; - } - } } } @@ -1380,8 +1163,8 @@ namespace InternalHeatGains { } // Calculate nominal min/max lighting level - thisLights.NomMinDesignLevel = thisLights.DesignLevel * SchMin; - thisLights.NomMaxDesignLevel = thisLights.DesignLevel * SchMax; + thisLights.NomMinDesignLevel = thisLights.DesignLevel * thisLights.sched->getMinVal(state); + thisLights.NomMaxDesignLevel = thisLights.DesignLevel * thisLights.sched->getMaxVal(state); thisLights.FractionReturnAir = IHGNumbers(4); thisLights.FractionRadiant = IHGNumbers(5); @@ -1568,8 +1351,8 @@ namespace InternalHeatGains { std::string liteName = state.dataHeatBal->Lights(lightsNum2).Name; Real64 mult = state.dataHeatBal->Zone(zoneNum).Multiplier * state.dataHeatBal->Zone(zoneNum).ListMultiplier; Real64 spaceArea = state.dataHeatBal->space(spaceNum).FloorArea; - state.dataInternalHeatGains->sumArea += spaceArea * mult; - state.dataInternalHeatGains->sumPower += state.dataHeatBal->Lights(lightsNum2).DesignLevel * mult; + sumArea += spaceArea * mult; + sumPower += state.dataHeatBal->Lights(lightsNum2).DesignLevel * mult; PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtZone, liteName, state.dataHeatBal->Zone(zoneNum).Name); PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtSpace, liteName, state.dataHeatBal->space(spaceNum).Name); PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtSpaceType, liteName, state.dataHeatBal->space(spaceNum).spaceType); @@ -1584,10 +1367,7 @@ namespace InternalHeatGains { state, state.dataOutRptPredefined->pdchInLtPower, liteName, state.dataHeatBal->Lights(lightsNum2).DesignLevel * mult); PreDefTableEntry( state, state.dataOutRptPredefined->pdchInLtEndUse, liteName, state.dataHeatBal->Lights(lightsNum2).EndUseSubcategory); - PreDefTableEntry(state, - state.dataOutRptPredefined->pdchInLtSchd, - liteName, - GetScheduleName(state, state.dataHeatBal->Lights(lightsNum2).SchedPtr)); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtSchd, liteName, state.dataHeatBal->Lights(lightsNum2).sched->Name); PreDefTableEntry( state, state.dataOutRptPredefined->pdchInLtRetAir, liteName, state.dataHeatBal->Lights(lightsNum2).FractionReturnAir, 4); } // Item1 - Number of Lights instances @@ -1624,17 +1404,14 @@ namespace InternalHeatGains { } } // TotLights > 0 check // add total line to lighting summary table - if (state.dataInternalHeatGains->sumArea > 0.0) { - PreDefTableEntry(state, - state.dataOutRptPredefined->pdchInLtDens, - "Interior Lighting Total", - state.dataInternalHeatGains->sumPower / state.dataInternalHeatGains->sumArea, + if (sumArea > 0.0) { + PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtDens, "Interior Lighting Total", sumPower / sumArea, 4); // line 792 } else { PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtDens, "Interior Lighting Total", DataPrecisionGlobals::constant_zero, 4); } - PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtArea, "Interior Lighting Total", state.dataInternalHeatGains->sumArea); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtPower, "Interior Lighting Total", state.dataInternalHeatGains->sumPower); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtArea, "Interior Lighting Total", sumArea); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtPower, "Interior Lighting Total", sumPower); // ElectricEquipment // Declared in state because the lights inputs are needed for demand manager @@ -1664,6 +1441,8 @@ namespace InternalHeatGains { IHGAlphaFieldNames, IHGNumericFieldNames); + ErrorObjectHeader eoh{routineName, elecEqModuleObject, IHGAlphas(1)}; + auto &thisElecEqInput = state.dataInternalHeatGains->zoneElectricObjects(elecEqInputNum); for (int Item1 = 1; Item1 <= thisElecEqInput.numOfSpaces; ++Item1) { ++elecEqNum; @@ -1674,46 +1453,17 @@ namespace InternalHeatGains { thisZoneElectric.spaceIndex = spaceNum; thisZoneElectric.ZonePtr = zoneNum; - thisZoneElectric.SchedPtr = GetScheduleIndex(state, IHGAlphas(3)); - SchMin = 0.0; - SchMax = 0.0; - if (thisZoneElectric.SchedPtr == 0) { - if (IHGAlphaFieldBlanks(3)) { - ShowSevereError( - state, format("{}{}=\"{}\", {} is required.", RoutineName, elecEqModuleObject, IHGAlphas(1), IHGAlphaFieldNames(3))); - } else { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered={}", - RoutineName, - elecEqModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(3), - IHGAlphas(3))); - } + // Why are error messages not guarded by (Item1 == 1) checks for equipment? + + if (IHGAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(3)); + ErrorsFound = true; + } else if ((thisZoneElectric.sched = Sched::GetSchedule(state, IHGAlphas(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3)); + ErrorsFound = true; + } else if (!thisZoneElectric.sched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3), Clusive::In, 0.0); ErrorsFound = true; - } else { // check min/max on schedule - SchMin = GetScheduleMinValue(state, thisZoneElectric.SchedPtr); - SchMax = GetScheduleMaxValue(state, thisZoneElectric.SchedPtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (SchMin < 0.0) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", {}, minimum is < 0.0", RoutineName, elecEqModuleObject, IHGAlphas(1), IHGAlphaFieldNames(3))); - ShowContinueError(state, - format("Schedule=\"{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", IHGAlphas(3), SchMin)); - ErrorsFound = true; - } - if (SchMax < 0.0) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", {}, maximum is < 0.0", RoutineName, elecEqModuleObject, IHGAlphas(1), IHGAlphaFieldNames(3))); - ShowContinueError(state, - format("Schedule=\"{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", IHGAlphas(3), SchMax)); - ErrorsFound = true; - } - } } // Electric equipment design level calculation method. @@ -1827,8 +1577,8 @@ namespace InternalHeatGains { } // Calculate nominal min/max equipment level - thisZoneElectric.NomMinDesignLevel = thisZoneElectric.DesignLevel * SchMin; - thisZoneElectric.NomMaxDesignLevel = thisZoneElectric.DesignLevel * SchMax; + thisZoneElectric.NomMinDesignLevel = thisZoneElectric.DesignLevel * thisZoneElectric.sched->getMinVal(state); + thisZoneElectric.NomMaxDesignLevel = thisZoneElectric.DesignLevel * thisZoneElectric.sched->getMaxVal(state); thisZoneElectric.FractionLatent = IHGNumbers(4); thisZoneElectric.FractionRadiant = IHGNumbers(5); @@ -1896,6 +1646,8 @@ namespace InternalHeatGains { IHGAlphaFieldNames, IHGNumericFieldNames); + ErrorObjectHeader eoh{routineName, gasEqModuleObject, IHGAlphas(1)}; + auto &thisGasEqInput = zoneGasObjects(gasEqInputNum); for (int Item1 = 1; Item1 <= thisGasEqInput.numOfSpaces; ++Item1) { ++gasEqNum; @@ -1906,55 +1658,21 @@ namespace InternalHeatGains { thisZoneGas.spaceIndex = spaceNum; thisZoneGas.ZonePtr = zoneNum; - thisZoneGas.SchedPtr = GetScheduleIndex(state, IHGAlphas(3)); - SchMin = 0.0; - SchMax = 0.0; - if (thisZoneGas.SchedPtr == 0) { - if (Item1 == 1) { - if (IHGAlphaFieldBlanks(3)) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", {} is required.", RoutineName, gasEqModuleObject, thisGasEqInput.Name, IHGAlphaFieldNames(3))); - } else { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered={}", - RoutineName, - gasEqModuleObject, - thisGasEqInput.Name, - IHGAlphaFieldNames(3), - IHGAlphas(3))); - } + if (!IHGAlphaFieldBlanks(3)) { + thisZoneGas.sched = Sched::GetSchedule(state, IHGAlphas(3)); + } + + // And here for gas, we are guarding with (Item1 == 1) again + if (Item1 == 1) { + if (IHGAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(3)); + ErrorsFound = true; + } else if (thisZoneGas.sched == nullptr) { + ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3)); + ErrorsFound = true; + } else if (!thisZoneGas.sched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3), Clusive::In, 0.0); ErrorsFound = true; - } - } else { // check min/max on schedule - SchMin = GetScheduleMinValue(state, thisZoneGas.SchedPtr); - SchMax = GetScheduleMaxValue(state, thisZoneGas.SchedPtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (Item1 == 1) { - if (SchMin < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, minimum is < 0.0", - RoutineName, - gasEqModuleObject, - thisGasEqInput.Name, - IHGAlphaFieldNames(3))); - ShowContinueError(state, - format("Schedule=\"{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", IHGAlphas(3), SchMin)); - ErrorsFound = true; - } - if (SchMax < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, maximum is < 0.0", - RoutineName, - gasEqModuleObject, - thisGasEqInput.Name, - IHGAlphaFieldNames(3))); - ShowContinueError(state, - format("Schedule=\"{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", IHGAlphas(3), SchMax)); - ErrorsFound = true; - } - } } } @@ -2053,22 +1771,15 @@ namespace InternalHeatGains { } else { if (Item1 == 1) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {}, value ={}", - RoutineName, - gasEqModuleObject, - thisGasEqInput.Name, - IHGAlphaFieldNames(4), - IHGAlphas(4))); - ShowContinueError(state, "...Valid values are \"EquipmentLevel\", \"Watts/Area\", \"Watts/Person\"."); + ShowSevereInvalidKey(state, eoh, IHGAlphaFieldNames(4), IHGAlphas(4)); ErrorsFound = true; } } } // Calculate nominal min/max equipment level - thisZoneGas.NomMinDesignLevel = thisZoneGas.DesignLevel * SchMin; - thisZoneGas.NomMaxDesignLevel = thisZoneGas.DesignLevel * SchMax; + thisZoneGas.NomMinDesignLevel = thisZoneGas.DesignLevel * thisZoneGas.sched->getMinVal(state); + thisZoneGas.NomMaxDesignLevel = thisZoneGas.DesignLevel * thisZoneGas.sched->getMaxVal(state); thisZoneGas.FractionLatent = IHGNumbers(4); thisZoneGas.FractionRadiant = IHGNumbers(5); @@ -2165,6 +1876,8 @@ namespace InternalHeatGains { IHGAlphaFieldNames, IHGNumericFieldNames); + ErrorObjectHeader eoh{routineName, hwEqModuleObject, IHGAlphas(1)}; + auto &thisHWEqInput = hotWaterEqObjects(hwEqInputNum); for (int Item1 = 1; Item1 <= thisHWEqInput.numOfSpaces; ++Item1) { ++hwEqNum; @@ -2175,51 +1888,15 @@ namespace InternalHeatGains { thisZoneHWEq.spaceIndex = spaceNum; thisZoneHWEq.ZonePtr = zoneNum; - thisZoneHWEq.SchedPtr = GetScheduleIndex(state, IHGAlphas(3)); - SchMin = 0.0; - SchMax = 0.0; - if (thisZoneHWEq.SchedPtr == 0) { - if (IHGAlphaFieldBlanks(3)) { - ShowSevereError( - state, - format("{}{}=\"{}\", {} is required.", RoutineName, hwEqModuleObject, thisHWEqInput.Name, IHGAlphaFieldNames(3))); - } else { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered={}", - RoutineName, - hwEqModuleObject, - thisHWEqInput.Name, - IHGAlphaFieldNames(3), - IHGAlphas(3))); - } + if (IHGAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(3)); + ErrorsFound = true; + } else if ((thisZoneHWEq.sched = Sched::GetSchedule(state, IHGAlphas(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3)); + ErrorsFound = true; + } else if (!thisZoneHWEq.sched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3), Clusive::In, 0.0); ErrorsFound = true; - } else { // check min/max on schedule - SchMin = GetScheduleMinValue(state, thisZoneHWEq.SchedPtr); - SchMax = GetScheduleMaxValue(state, thisZoneHWEq.SchedPtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (SchMin < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, minimum is < 0.0", - RoutineName, - hwEqModuleObject, - thisHWEqInput.Name, - IHGAlphaFieldNames(3))); - ShowContinueError(state, - format("Schedule=\"{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", IHGAlphas(3), SchMin)); - ErrorsFound = true; - } - if (SchMax < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, maximum is < 0.0", - RoutineName, - hwEqModuleObject, - thisHWEqInput.Name, - IHGAlphaFieldNames(3))); - ShowContinueError(state, - format("Schedule=\"{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", IHGAlphas(3), SchMax)); - ErrorsFound = true; - } - } } // Hot Water equipment design level calculation method. @@ -2333,8 +2010,8 @@ namespace InternalHeatGains { } // Calculate nominal min/max equipment level - thisZoneHWEq.NomMinDesignLevel = thisZoneHWEq.DesignLevel * SchMin; - thisZoneHWEq.NomMaxDesignLevel = thisZoneHWEq.DesignLevel * SchMax; + thisZoneHWEq.NomMinDesignLevel = thisZoneHWEq.DesignLevel * thisZoneHWEq.sched->getMinVal(state); + thisZoneHWEq.NomMaxDesignLevel = thisZoneHWEq.DesignLevel * thisZoneHWEq.sched->getMaxVal(state); thisZoneHWEq.FractionLatent = IHGNumbers(4); thisZoneHWEq.FractionRadiant = IHGNumbers(5); @@ -2401,6 +2078,8 @@ namespace InternalHeatGains { IHGAlphaFieldNames, IHGNumericFieldNames); + ErrorObjectHeader eoh{routineName, stmEqModuleObject, IHGAlphas(1)}; + auto &thisStmEqInput = steamEqObjects(stmEqInputNum); for (int Item1 = 1; Item1 <= thisStmEqInput.numOfSpaces; ++Item1) { ++stmEqNum; @@ -2410,52 +2089,16 @@ namespace InternalHeatGains { thisZoneStmEq.Name = thisStmEqInput.names(Item1); thisZoneStmEq.spaceIndex = spaceNum; thisZoneStmEq.ZonePtr = zoneNum; - - thisZoneStmEq.SchedPtr = GetScheduleIndex(state, IHGAlphas(3)); - SchMin = 0.0; - SchMax = 0.0; - if (thisZoneStmEq.SchedPtr == 0) { - if (IHGAlphaFieldBlanks(3)) { - ShowSevereError( - state, - format("{}{}=\"{}\", {} is required.", RoutineName, stmEqModuleObject, thisStmEqInput.Name, IHGAlphaFieldNames(3))); - } else { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered={}", - RoutineName, - stmEqModuleObject, - thisStmEqInput.Name, - IHGAlphaFieldNames(3), - IHGAlphas(3))); - } - ErrorsFound = true; - } else { // check min/max on schedule - SchMin = GetScheduleMinValue(state, thisZoneStmEq.SchedPtr); - SchMax = GetScheduleMaxValue(state, thisZoneStmEq.SchedPtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (SchMin < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, minimum is < 0.0", - RoutineName, - stmEqModuleObject, - thisStmEqInput.Name, - IHGAlphaFieldNames(3))); - ShowContinueError(state, - format("Schedule=\"{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", IHGAlphas(3), SchMin)); - ErrorsFound = true; - } - if (SchMax < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, maximum is < 0.0", - RoutineName, - stmEqModuleObject, - thisStmEqInput.Name, - IHGAlphaFieldNames(3))); - ShowContinueError(state, - format("Schedule=\"{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", IHGAlphas(3), SchMax)); - ErrorsFound = true; - } - } + + if (IHGAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(3)); + ErrorsFound = true; + } else if ((thisZoneStmEq.sched = Sched::GetSchedule(state, IHGAlphas(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3)); + ErrorsFound = true; + } else if (!thisZoneStmEq.sched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3), Clusive::In, 0.0); + ErrorsFound = true; } // Steam equipment design level calculation method. @@ -2568,8 +2211,8 @@ namespace InternalHeatGains { } // Calculate nominal min/max equipment level - thisZoneStmEq.NomMinDesignLevel = thisZoneStmEq.DesignLevel * SchMin; - thisZoneStmEq.NomMaxDesignLevel = thisZoneStmEq.DesignLevel * SchMax; + thisZoneStmEq.NomMinDesignLevel = thisZoneStmEq.DesignLevel * thisZoneStmEq.sched->getMinVal(state); + thisZoneStmEq.NomMaxDesignLevel = thisZoneStmEq.DesignLevel * thisZoneStmEq.sched->getMaxVal(state); thisZoneStmEq.FractionLatent = IHGNumbers(4); thisZoneStmEq.FractionRadiant = IHGNumbers(5); @@ -2641,6 +2284,8 @@ namespace InternalHeatGains { IHGAlphaFieldNames, IHGNumericFieldNames); + ErrorObjectHeader eoh{routineName, othEqModuleObject, IHGAlphas(1)}; + auto &thisOthEqInput = otherEqObjects(othEqInputNum); for (int Item1 = 1; Item1 <= thisOthEqInput.numOfSpaces; ++Item1) { ++othEqNum; @@ -2694,27 +2339,15 @@ namespace InternalHeatGains { } } - thisZoneOthEq.SchedPtr = GetScheduleIndex(state, IHGAlphas(4)); - SchMin = 0.0; - SchMax = 0.0; - if (thisZoneOthEq.SchedPtr == 0) { - if (IHGAlphaFieldBlanks(4)) { - ShowSevereError( - state, - format("{}{}=\"{}\", {} is required.", RoutineName, othEqModuleObject, thisOthEqInput.Name, IHGAlphaFieldNames(4))); - } else { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered={}", - RoutineName, - othEqModuleObject, - thisOthEqInput.Name, - IHGAlphaFieldNames(4), - IHGAlphas(4))); - } + if (IHGAlphaFieldBlanks(4)) { + ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(4)); + ErrorsFound = true; + } else if ((thisZoneOthEq.sched = Sched::GetSchedule(state, IHGAlphas(4))) == nullptr) { + ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(4), IHGAlphas(4)); + ErrorsFound = true; + } else if (!thisZoneOthEq.sched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(4), IHGAlphas(4), Clusive::In, 0.0); ErrorsFound = true; - } else { // check min/max on schedule - SchMin = GetScheduleMinValue(state, thisZoneOthEq.SchedPtr); - SchMax = GetScheduleMaxValue(state, thisZoneOthEq.SchedPtr); } // equipment design level calculation method. @@ -2822,8 +2455,8 @@ namespace InternalHeatGains { } // Calculate nominal min/max equipment level - thisZoneOthEq.NomMinDesignLevel = thisZoneOthEq.DesignLevel * SchMin; - thisZoneOthEq.NomMaxDesignLevel = thisZoneOthEq.DesignLevel * SchMax; + thisZoneOthEq.NomMinDesignLevel = thisZoneOthEq.DesignLevel * thisZoneOthEq.sched->getMinVal(state); + thisZoneOthEq.NomMaxDesignLevel = thisZoneOthEq.DesignLevel * thisZoneOthEq.sched->getMaxVal(state); thisZoneOthEq.FractionLatent = IHGNumbers(4); thisZoneOthEq.FractionRadiant = IHGNumbers(5); @@ -2920,6 +2553,8 @@ namespace InternalHeatGains { IHGAlphaFieldNames, IHGNumericFieldNames); + ErrorObjectHeader eoh{routineName, itEqModuleObject, IHGAlphas(1)}; + auto &thisITEqInput = iTEqObjects(itEqInputNum); for (int Item1 = 1; Item1 <= thisITEqInput.numOfSpaces; ++Item1) { ++itEqNum; @@ -3035,90 +2670,29 @@ namespace InternalHeatGains { } if (IHGAlphaFieldBlanks(5)) { - thisZoneITEq.OperSchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisZoneITEq.OperSchedPtr = GetScheduleIndex(state, IHGAlphas(5)); - } - SchMin = 0.0; - SchMax = 0.0; - if (thisZoneITEq.OperSchedPtr == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered={}", - RoutineName, - itEqModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(5), - IHGAlphas(5))); + thisZoneITEq.operSched = Sched::GetScheduleAlwaysOn(state); // Not an availability schedule, but default is constant-1.0 + } else if ((thisZoneITEq.operSched = Sched::GetSchedule(state, IHGAlphas(5))) == nullptr) { + ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(5), IHGAlphas(5)); + ErrorsFound = true; + } else if (!thisZoneITEq.operSched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(5), IHGAlphas(5), Clusive::In, 0.0); ErrorsFound = true; - } else { // check min/max on schedule - SchMin = GetScheduleMinValue(state, thisZoneITEq.OperSchedPtr); - SchMax = GetScheduleMaxValue(state, thisZoneITEq.OperSchedPtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (SchMin < 0.0) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", {}, minimum is < 0.0", RoutineName, itEqModuleObject, IHGAlphas(1), IHGAlphaFieldNames(5))); - ShowContinueError(state, - format("Schedule=\"{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", IHGAlphas(5), SchMin)); - ErrorsFound = true; - } - if (SchMax < 0.0) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", {}, maximum is < 0.0", RoutineName, itEqModuleObject, IHGAlphas(1), IHGAlphaFieldNames(5))); - ShowContinueError(state, - format("Schedule=\"{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", IHGAlphas(5), SchMax)); - ErrorsFound = true; - } - } } if (IHGAlphaFieldBlanks(6)) { - thisZoneITEq.CPULoadSchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisZoneITEq.CPULoadSchedPtr = GetScheduleIndex(state, IHGAlphas(6)); - } - SchMin = 0.0; - SchMax = 0.0; - if (thisZoneITEq.CPULoadSchedPtr == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered={}", - RoutineName, - itEqModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(6), - IHGAlphas(6))); + thisZoneITEq.cpuLoadSched = + Sched::GetScheduleAlwaysOn(state); // not an availability schedule, but default is constant-1.0 + } else if ((thisZoneITEq.cpuLoadSched = Sched::GetSchedule(state, IHGAlphas(6))) == nullptr) { + ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(6), IHGAlphas(6)); + ErrorsFound = true; + } else if (!thisZoneITEq.cpuLoadSched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(6), IHGAlphas(6), Clusive::In, 0.0); ErrorsFound = true; - } else { // check min/max on schedule - SchMin = GetScheduleMinValue(state, thisZoneITEq.CPULoadSchedPtr); - SchMax = GetScheduleMaxValue(state, thisZoneITEq.CPULoadSchedPtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (SchMin < 0.0) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", {}, minimum is < 0.0", RoutineName, itEqModuleObject, IHGAlphas(1), IHGAlphaFieldNames(6))); - ShowContinueError(state, - format("Schedule=\"{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", IHGAlphas(6), SchMin)); - ErrorsFound = true; - } - if (SchMax < 0.0) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", {}, maximum is < 0.0", RoutineName, itEqModuleObject, IHGAlphas(1), IHGAlphaFieldNames(6))); - ShowContinueError(state, - format("Schedule=\"{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", IHGAlphas(6), SchMax)); - ErrorsFound = true; - } - } } // Calculate nominal min/max equipment level - thisZoneITEq.NomMinDesignLevel = thisZoneITEq.DesignTotalPower * SchMin; - thisZoneITEq.NomMaxDesignLevel = thisZoneITEq.DesignTotalPower * SchMax; + thisZoneITEq.NomMinDesignLevel = thisZoneITEq.DesignTotalPower * thisZoneITEq.cpuLoadSched->getMinVal(state); + thisZoneITEq.NomMaxDesignLevel = thisZoneITEq.DesignTotalPower * thisZoneITEq.cpuLoadSched->getMaxVal(state); thisZoneITEq.DesignFanPowerFrac = IHGNumbers(4); thisZoneITEq.DesignFanPower = thisZoneITEq.DesignFanPowerFrac * thisZoneITEq.DesignTotalPower; @@ -3281,65 +2855,47 @@ namespace InternalHeatGains { thisZoneITEq.EndUseSubcategoryUPS = "ITE-UPS"; } if (thisZoneITEq.FlowControlWithApproachTemps) { - if (!IHGAlphaFieldBlanks(20)) { - thisZoneITEq.SupplyApproachTempSch = GetScheduleIndex(state, IHGAlphas(20)); - if (thisZoneITEq.SupplyApproachTempSch == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered={}", - RoutineName, - itEqModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(20), - IHGAlphas(20))); - ErrorsFound = true; - } - } else { + if (IHGAlphaFieldBlanks(20)) { if (!hasSupplyApproachTemp) { - ShowSevereError(state, format("{}{} \"{}\"", RoutineName, itEqModuleObject, IHGAlphas(1))); - ShowContinueError( + ShowSevereCustom( state, + eoh, format("For {}= FlowControlWithApproachTemperatures, either {} or {} is required, but both are left blank.", IHGAlphaFieldNames(3), IHGNumericFieldNames(10), IHGAlphaFieldNames(20))); ErrorsFound = true; } + } else if ((thisZoneITEq.supplyApproachTempSched = Sched::GetSchedule(state, IHGAlphas(20))) == nullptr) { + ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(20), IHGAlphas(20)); + ErrorsFound = true; } - if (!IHGAlphaFieldBlanks(21)) { - thisZoneITEq.ReturnApproachTempSch = GetScheduleIndex(state, IHGAlphas(21)); - if (thisZoneITEq.ReturnApproachTempSch == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered={}", - RoutineName, - itEqModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(20), - IHGAlphas(20))); - ErrorsFound = true; - } - } else { + if (IHGAlphaFieldBlanks(21)) { if (!hasReturnApproachTemp) { - ShowSevereError(state, format("{}{} \"{}\"", RoutineName, itEqModuleObject, IHGAlphas(1))); - ShowContinueError( + ShowSevereCustom( state, + eoh, format("For {}= FlowControlWithApproachTemperatures, either {} or {} is required, but both are left blank.", IHGAlphaFieldNames(3), IHGNumericFieldNames(11), IHGAlphaFieldNames(21))); ErrorsFound = true; } + } else if ((thisZoneITEq.returnApproachTempSched = Sched::GetSchedule(state, IHGAlphas(21))) == nullptr) { + ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(20), IHGAlphas(20)); + ErrorsFound = true; } } if (thisZoneITEq.FlowControlWithApproachTemps) { Real64 TAirInSizing = 0.0; - // Set the TAirInSizing to the maximun setpoint value to do sizing based on the maximum fan and cpu power of the ite + // Set the TAirInSizing to the maximum setpoint value to do sizing based on the maximum fan and cpu power of the ite // object SetPointManager::GetSetPointManagerInputs(state); for (auto *spm : state.dataSetPointManager->spms) { if (spm->type != SetPointManager::SPMType::SZCooling) continue; - auto *spmSZC = dynamic_cast(spm); + auto const *spmSZC = dynamic_cast(spm); assert(spmSZC != nullptr); if (spmSZC->ctrlZoneNum == zoneNum) { TAirInSizing = spmSZC->maxSetTemp; @@ -3403,6 +2959,8 @@ namespace InternalHeatGains { IHGAlphaFieldNames, IHGNumericFieldNames); + ErrorObjectHeader eoh{routineName, bbModuleObject, IHGAlphas(1)}; + auto &thisBBHeatInput = zoneBBHeatObjects(bbHeatInputNum); for (int Item1 = 1; Item1 <= thisBBHeatInput.numOfSpaces; ++Item1) { ++bbHeatNum; @@ -3413,49 +2971,15 @@ namespace InternalHeatGains { thisZoneBBHeat.spaceIndex = spaceNum; thisZoneBBHeat.ZonePtr = zoneNum; - thisZoneBBHeat.SchedPtr = GetScheduleIndex(state, IHGAlphas(3)); - if (thisZoneBBHeat.SchedPtr == 0) { - if (IHGAlphaFieldBlanks(3)) { - ShowSevereError( - state, - format("{}{}=\"{}\", {} is required.", RoutineName, bbModuleObject, thisBBHeatInput.Name, IHGAlphaFieldNames(3))); - } else { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered={}", - RoutineName, - bbModuleObject, - thisBBHeatInput.Name, - IHGAlphaFieldNames(3), - IHGAlphas(3))); - } + if (IHGAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(3)); + ErrorsFound = true; + } else if ((thisZoneBBHeat.sched = Sched::GetSchedule(state, IHGAlphas(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3)); + ErrorsFound = true; + } else if (!thisZoneBBHeat.sched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3), Clusive::In, 0.0); ErrorsFound = true; - } else { // check min/max on schedule - SchMin = GetScheduleMinValue(state, thisZoneBBHeat.SchedPtr); - SchMax = GetScheduleMaxValue(state, thisZoneBBHeat.SchedPtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (SchMin < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, minimum is < 0.0", - RoutineName, - bbModuleObject, - thisBBHeatInput.Name, - IHGAlphaFieldNames(3))); - ShowContinueError(state, - format("Schedule=\"{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", IHGAlphas(3), SchMin)); - ErrorsFound = true; - } - if (SchMax < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, maximum is < 0.0", - RoutineName, - bbModuleObject, - thisBBHeatInput.Name, - IHGAlphaFieldNames(3))); - ShowContinueError(state, - format("Schedule=\"{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", IHGAlphas(3), SchMax)); - ErrorsFound = true; - } - } } if (IHGNumAlphas > 3) { @@ -3544,6 +3068,8 @@ namespace InternalHeatGains { IHGAlphaFieldBlanks, IHGAlphaFieldNames, IHGNumericFieldNames); + + ErrorObjectHeader eoh{routineName, contamSSModuleObject, IHGAlphas(1)}; Util::IsNameEmpty(state, IHGAlphas(1), contamSSModuleObject, ErrorsFound); state.dataHeatBal->ZoneCO2Gen(Loop).Name = IHGAlphas(1); @@ -3557,40 +3083,15 @@ namespace InternalHeatGains { ErrorsFound = true; } - state.dataHeatBal->ZoneCO2Gen(Loop).SchedPtr = GetScheduleIndex(state, IHGAlphas(3)); - if (state.dataHeatBal->ZoneCO2Gen(Loop).SchedPtr == 0) { - if (IHGAlphaFieldBlanks(3)) { - ShowSevereError(state, - format("{}{}=\"{}\", {} is required.", RoutineName, contamSSModuleObject, IHGAlphas(1), IHGAlphaFieldNames(3))); - } else { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered={}", - RoutineName, - contamSSModuleObject, - IHGAlphas(1), - IHGAlphaFieldNames(3), - IHGAlphas(3))); - } + if (IHGAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(3)); + ErrorsFound = true; + } else if ((state.dataHeatBal->ZoneCO2Gen(Loop).sched = Sched::GetSchedule(state, IHGAlphas(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3)); + ErrorsFound = true; + } else if (!state.dataHeatBal->ZoneCO2Gen(Loop).sched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3), Clusive::In, 0.0); ErrorsFound = true; - } else { // check min/max on schedule - SchMin = GetScheduleMinValue(state, state.dataHeatBal->ZoneCO2Gen(Loop).SchedPtr); - SchMax = GetScheduleMaxValue(state, state.dataHeatBal->ZoneCO2Gen(Loop).SchedPtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (SchMin < 0.0) { - ShowSevereError( - state, - format("{}{}=\"{}\", {}, minimum is < 0.0", RoutineName, contamSSModuleObject, IHGAlphas(1), IHGAlphaFieldNames(3))); - ShowContinueError(state, format("Schedule=\"{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", IHGAlphas(3), SchMin)); - ErrorsFound = true; - } - if (SchMax < 0.0) { - ShowSevereError( - state, - format("{}{}=\"{}\", {}, maximum is < 0.0", RoutineName, contamSSModuleObject, IHGAlphas(1), IHGAlphaFieldNames(3))); - ShowContinueError(state, format("Schedule=\"{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", IHGAlphas(3), SchMax)); - ErrorsFound = true; - } - } } state.dataHeatBal->ZoneCO2Gen(Loop).CO2DesignRate = IHGNumbers(1); @@ -3636,7 +3137,6 @@ namespace InternalHeatGains { if (ErrorsFound) { ShowFatalError(state, format("{}Errors found in Getting Internal Gains Input, Program Stopped", RoutineName)); } - setupIHGOutputs(state); static constexpr std::string_view Format_721( @@ -3646,75 +3146,64 @@ namespace InternalHeatGains { "Heat\n"); print(state.files.eio, Format_721); + for (int Loop = 1; Loop <= state.dataGlobal->NumOfZones; ++Loop) { - LightTot = 0.0; - ElecTot = 0.0; - GasTot = 0.0; - OthTot = 0.0; - HWETot = 0.0; - StmTot = 0.0; + auto &zone = state.dataHeatBal->Zone(Loop); + + Real64 LightTot = 0.0; + Real64 ElecTot = 0.0; + Real64 GasTot = 0.0; + Real64 OthTot = 0.0; + Real64 HWETot = 0.0; + Real64 StmTot = 0.0; std::string BBHeatInd = "No"; // Yes if BBHeat in zone, no if not. - for (int Loop1 = 1; Loop1 <= state.dataHeatBal->TotLights; ++Loop1) { - if (state.dataHeatBal->Lights(Loop1).ZonePtr != Loop) continue; - LightTot += state.dataHeatBal->Lights(Loop1).DesignLevel; + + for (auto const &lights : state.dataHeatBal->Lights) { + if (lights.ZonePtr == Loop) LightTot += lights.DesignLevel; } - for (int Loop1 = 1; Loop1 <= state.dataHeatBal->TotElecEquip; ++Loop1) { - if (state.dataHeatBal->ZoneElectric(Loop1).ZonePtr != Loop) continue; - ElecTot += state.dataHeatBal->ZoneElectric(Loop1).DesignLevel; + for (auto const &elecEq : state.dataHeatBal->ZoneElectric) { + if (elecEq.ZonePtr == Loop) ElecTot += elecEq.DesignLevel; } - for (int Loop1 = 1; Loop1 <= state.dataHeatBal->TotITEquip; ++Loop1) { - if (state.dataHeatBal->ZoneITEq(Loop1).ZonePtr != Loop) continue; - ElecTot += state.dataHeatBal->ZoneITEq(Loop1).DesignTotalPower; + for (auto const &itEq : state.dataHeatBal->ZoneITEq) { + if (itEq.ZonePtr == Loop) ElecTot += itEq.DesignTotalPower; // Should this not be itTot? } - for (int Loop1 = 1; Loop1 <= state.dataHeatBal->TotGasEquip; ++Loop1) { - if (state.dataHeatBal->ZoneGas(Loop1).ZonePtr != Loop) continue; - GasTot += state.dataHeatBal->ZoneGas(Loop1).DesignLevel; + for (auto const &gasEq : state.dataHeatBal->ZoneGas) { + if (gasEq.ZonePtr == Loop) GasTot += gasEq.DesignLevel; } - for (int Loop1 = 1; Loop1 <= state.dataHeatBal->TotOthEquip; ++Loop1) { - if (state.dataHeatBal->ZoneOtherEq(Loop1).ZonePtr != Loop) continue; - OthTot += state.dataHeatBal->ZoneOtherEq(Loop1).DesignLevel; + for (auto const &otherEq : state.dataHeatBal->ZoneOtherEq) { + if (otherEq.ZonePtr == Loop) OthTot += otherEq.DesignLevel; } - for (int Loop1 = 1; Loop1 <= state.dataHeatBal->TotStmEquip; ++Loop1) { - if (state.dataHeatBal->ZoneSteamEq(Loop1).ZonePtr != Loop) continue; - StmTot += state.dataHeatBal->ZoneSteamEq(Loop1).DesignLevel; + for (auto const &steamEq : state.dataHeatBal->ZoneSteamEq) { + if (steamEq.ZonePtr == Loop) StmTot += steamEq.DesignLevel; } - for (int Loop1 = 1; Loop1 <= state.dataHeatBal->TotHWEquip; ++Loop1) { - if (state.dataHeatBal->ZoneHWEq(Loop1).ZonePtr != Loop) continue; - HWETot += state.dataHeatBal->ZoneHWEq(Loop1).DesignLevel; + for (auto const &hotWaterEq : state.dataHeatBal->ZoneHWEq) { + if (hotWaterEq.ZonePtr == Loop) HWETot += hotWaterEq.DesignLevel; } - for (int Loop1 = 1; Loop1 <= state.dataHeatBal->TotBBHeat; ++Loop1) { - if (state.dataHeatBal->ZoneBBHeat(Loop1).ZonePtr != Loop) continue; - BBHeatInd = "Yes"; + for (auto const &bbHeat : state.dataHeatBal->ZoneBBHeat) { + if (bbHeat.ZonePtr == Loop) BBHeatInd = "Yes"; } - state.dataHeatBal->Zone(Loop).InternalHeatGains = LightTot + ElecTot + GasTot + OthTot + HWETot + StmTot; - if (state.dataHeatBal->Zone(Loop).FloorArea > 0.0) { - print(state.files.eio, - Format_720, - state.dataHeatBal->Zone(Loop).Name, - state.dataHeatBal->Zone(Loop).FloorArea, - state.dataHeatBal->Zone(Loop).TotOccupants); - print_and_divide_if_greater_than_zero(state.dataHeatBal->Zone(Loop).FloorArea, state.dataHeatBal->Zone(Loop).TotOccupants); - print(state.files.eio, "{:.3R},", state.dataHeatBal->Zone(Loop).TotOccupants / state.dataHeatBal->Zone(Loop).FloorArea); - print(state.files.eio, "{:.3R},", LightTot / state.dataHeatBal->Zone(Loop).FloorArea); - print(state.files.eio, "{:.3R},", ElecTot / state.dataHeatBal->Zone(Loop).FloorArea); - print(state.files.eio, "{:.3R},", GasTot / state.dataHeatBal->Zone(Loop).FloorArea); - print(state.files.eio, "{:.3R},", OthTot / state.dataHeatBal->Zone(Loop).FloorArea); - print(state.files.eio, "{:.3R},", HWETot / state.dataHeatBal->Zone(Loop).FloorArea); - print(state.files.eio, "{:.3R},", StmTot / state.dataHeatBal->Zone(Loop).FloorArea); - print(state.files.eio, - "{:.3R},{}\n", - state.dataHeatBal->Zone(Loop).InternalHeatGains / state.dataHeatBal->Zone(Loop).FloorArea, - BBHeatInd); + + zone.InternalHeatGains = LightTot + ElecTot + GasTot + OthTot + HWETot + StmTot; + if (zone.FloorArea > 0.0) { + print(state.files.eio, Format_720, zone.Name, zone.FloorArea, zone.TotOccupants); + print_and_divide_if_greater_than_zero(zone.FloorArea, zone.TotOccupants); + print(state.files.eio, "{:.3R},", zone.TotOccupants / zone.FloorArea); + print(state.files.eio, "{:.3R},", LightTot / zone.FloorArea); + print(state.files.eio, "{:.3R},", ElecTot / zone.FloorArea); + print(state.files.eio, "{:.3R},", GasTot / zone.FloorArea); + print(state.files.eio, "{:.3R},", OthTot / zone.FloorArea); + print(state.files.eio, "{:.3R},", HWETot / zone.FloorArea); + print(state.files.eio, "{:.3R},", StmTot / zone.FloorArea); + print(state.files.eio, "{:.3R},{}\n", zone.InternalHeatGains / zone.FloorArea, BBHeatInd); } else { - print(state.files.eio, - Format_720, - state.dataHeatBal->Zone(Loop).Name, - state.dataHeatBal->Zone(Loop).FloorArea, - state.dataHeatBal->Zone(Loop).TotOccupants); + print(state.files.eio, Format_720, zone.Name, zone.FloorArea, zone.TotOccupants); print(state.files.eio, "0.0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,{}\n", BBHeatInd); } } + for (int Loop = 1; Loop <= state.dataHeatBal->TotPeople; ++Loop) { + auto &people = state.dataHeatBal->People(Loop); + if (Loop == 1) { print(state.files.eio, Format_723, @@ -3726,8 +3215,7 @@ namespace InternalHeatGains { "Minimum Number of People for Weekends/Holidays, Maximum Number of People for Weekends /Holidays," "Minimum Number of People for Summer Design Days, Maximum Number of People for Summer Design Days," "Minimum Number of People for Winter Design Days, Maximum Number of People for Winter Design Days"); - if (state.dataHeatBal->People(Loop).Fanger || state.dataHeatBal->People(Loop).Pierce || state.dataHeatBal->People(Loop).KSU || - state.dataHeatBal->People(Loop).CoolingEffectASH55 || state.dataHeatBal->People(Loop).AnkleDraftASH55) { + if (people.Fanger || people.Pierce || people.KSU || people.CoolingEffectASH55 || people.AnkleDraftASH55) { print(state.files.eio, ",MRT Calculation Type,Work Efficiency, Clothing Insulation Calculation Method,Clothing " "Insulation Calculation Method Schedule,Clothing,Air Velocity,Fanger Calculation,Pierce " @@ -3737,126 +3225,96 @@ namespace InternalHeatGains { } } - int ZoneNum = state.dataHeatBal->People(Loop).ZonePtr; - - if (ZoneNum == 0) { - print(state.files.eio, Format_724, "People-Illegal Zone specified", state.dataHeatBal->People(Loop).Name); + if (people.ZonePtr == 0) { + print(state.files.eio, Format_724, "People-Illegal Zone specified", people.Name); continue; } - print(state.files.eio, - Format_722, - "People", - state.dataHeatBal->People(Loop).Name, - GetScheduleName(state, state.dataHeatBal->People(Loop).NumberOfPeoplePtr), - state.dataHeatBal->Zone(ZoneNum).Name, - state.dataHeatBal->Zone(ZoneNum).FloorArea, - state.dataHeatBal->Zone(ZoneNum).TotOccupants); + auto const &zone = state.dataHeatBal->Zone(people.ZonePtr); - print(state.files.eio, "{:.1R},", state.dataHeatBal->People(Loop).NumberOfPeople); + print(state.files.eio, Format_722, "People", people.Name, people.sched->Name, zone.Name, zone.FloorArea, zone.TotOccupants); + print(state.files.eio, "{:.1R},", people.NumberOfPeople); - print_and_divide_if_greater_than_zero(state.dataHeatBal->People(Loop).NumberOfPeople, state.dataHeatBal->Zone(ZoneNum).FloorArea); + print_and_divide_if_greater_than_zero(people.NumberOfPeople, zone.FloorArea); - if (state.dataHeatBal->People(Loop).NumberOfPeople > 0.0) { - print_and_divide_if_greater_than_zero(state.dataHeatBal->Zone(ZoneNum).FloorArea, state.dataHeatBal->People(Loop).NumberOfPeople); + if (people.NumberOfPeople > 0.0) { + print_and_divide_if_greater_than_zero(zone.FloorArea, people.NumberOfPeople); } else { print(state.files.eio, "N/A,"); } - print(state.files.eio, "{:.3R},", state.dataHeatBal->People(Loop).FractionRadiant); - print(state.files.eio, "{:.3R},", state.dataHeatBal->People(Loop).FractionConvected); - if (state.dataHeatBal->People(Loop).UserSpecSensFrac == Constant::AutoCalculate) { + print(state.files.eio, "{:.3R},", people.FractionRadiant); + print(state.files.eio, "{:.3R},", people.FractionConvected); + if (people.UserSpecSensFrac == Constant::AutoCalculate) { print(state.files.eio, "AutoCalculate,"); } else { - print(state.files.eio, "{:.3R},", state.dataHeatBal->People(Loop).UserSpecSensFrac); + print(state.files.eio, "{:.3R},", people.UserSpecSensFrac); } - print(state.files.eio, "{},", GetScheduleName(state, state.dataHeatBal->People(Loop).ActivityLevelPtr)); + print(state.files.eio, "{},", people.activityLevelSched->Name); - if (state.dataHeatBal->People(Loop).Show55Warning) { - print(state.files.eio, "Yes,"); - } else { - print(state.files.eio, "No,"); - } - print(state.files.eio, "{:.4R},", state.dataHeatBal->People(Loop).CO2RateFactor); - print(state.files.eio, "{:.1R},", state.dataHeatBal->People(Loop).NomMinNumberPeople); - print(state.files.eio, "{:.1R},", state.dataHeatBal->People(Loop).NomMaxNumberPeople); + print(state.files.eio, "{},", yesNoNames[(int)people.Show55Warning]); + print(state.files.eio, "{:.4R},", people.CO2RateFactor); + print(state.files.eio, "{:.1R},", people.NomMinNumberPeople); + print(state.files.eio, "{:.1R},", people.NomMaxNumberPeople); + + Real64 SchMin, SchMax; - auto &thisPeople = state.dataHeatBal->People(Loop); // weekdays - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, thisPeople.NumberOfPeoplePtr, DayTypeGroup::Weekday); - print(state.files.eio, "{:.1R},", thisPeople.NumberOfPeople * SchMin); - print(state.files.eio, "{:.1R},", thisPeople.NumberOfPeople * SchMax); + std::tie(SchMin, SchMax) = people.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::Weekday); + print(state.files.eio, "{:.1R},", people.NumberOfPeople * SchMin); + print(state.files.eio, "{:.1R},", people.NumberOfPeople * SchMax); // weekends/holidays - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, thisPeople.NumberOfPeoplePtr, DayTypeGroup::WeekEndHoliday); - print(state.files.eio, "{:.1R},", thisPeople.NumberOfPeople * SchMin); - print(state.files.eio, "{:.1R},", thisPeople.NumberOfPeople * SchMax); + std::tie(SchMin, SchMax) = people.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WeekEndHoliday); + print(state.files.eio, "{:.1R},", people.NumberOfPeople * SchMin); + print(state.files.eio, "{:.1R},", people.NumberOfPeople * SchMax); // summer design days - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, thisPeople.NumberOfPeoplePtr, DayTypeGroup::SummerDesignDay); - print(state.files.eio, "{:.1R},", thisPeople.NumberOfPeople * SchMin); - print(state.files.eio, "{:.1R},", thisPeople.NumberOfPeople * SchMax); + std::tie(SchMin, SchMax) = people.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::SummerDesignDay); + print(state.files.eio, "{:.1R},", people.NumberOfPeople * SchMin); + print(state.files.eio, "{:.1R},", people.NumberOfPeople * SchMax); // winter design days - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, thisPeople.NumberOfPeoplePtr, DayTypeGroup::WinterDesignDay); - print(state.files.eio, "{:.1R},", thisPeople.NumberOfPeople * SchMin); - print(state.files.eio, "{:.1R},", thisPeople.NumberOfPeople * SchMax); + std::tie(SchMin, SchMax) = people.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WinterDesignDay); + print(state.files.eio, "{:.1R},", people.NumberOfPeople * SchMin); + print(state.files.eio, "{:.1R},", people.NumberOfPeople * SchMax); - if (state.dataHeatBal->People(Loop).Fanger || state.dataHeatBal->People(Loop).Pierce || state.dataHeatBal->People(Loop).KSU || - state.dataHeatBal->People(Loop).CoolingEffectASH55 || state.dataHeatBal->People(Loop).AnkleDraftASH55) { + if (people.Fanger || people.Pierce || people.KSU || people.CoolingEffectASH55 || people.AnkleDraftASH55) { - if (state.dataHeatBal->People(Loop).MRTCalcType == DataHeatBalance::CalcMRT::EnclosureAveraged) { + if (people.MRTCalcType == DataHeatBalance::CalcMRT::EnclosureAveraged) { print(state.files.eio, "Zone Averaged,"); - } else if (state.dataHeatBal->People(Loop).MRTCalcType == DataHeatBalance::CalcMRT::SurfaceWeighted) { + } else if (people.MRTCalcType == DataHeatBalance::CalcMRT::SurfaceWeighted) { print(state.files.eio, "Surface Weighted,"); - } else if (state.dataHeatBal->People(Loop).MRTCalcType == DataHeatBalance::CalcMRT::AngleFactor) { + } else if (people.MRTCalcType == DataHeatBalance::CalcMRT::AngleFactor) { print(state.files.eio, "Angle Factor,"); } else { print(state.files.eio, "N/A,"); } - print(state.files.eio, "{},", GetScheduleName(state, state.dataHeatBal->People(Loop).WorkEffPtr)); + print(state.files.eio, "{},", people.workEffSched ? people.workEffSched->Name : ""); - print(state.files.eio, clothingTypeEIOStrings[static_cast(state.dataHeatBal->People(Loop).clothingType)]); + print(state.files.eio, clothingTypeEIOStrings[(int)people.clothingType]); - if (state.dataHeatBal->People(Loop).clothingType == ClothingType::CalculationSchedule) { - print(state.files.eio, "{},", GetScheduleName(state, state.dataHeatBal->People(Loop).ClothingMethodPtr)); + if (people.clothingType == ClothingType::CalculationSchedule) { + print(state.files.eio, "{},", people.clothingMethodSched->Name); } else { print(state.files.eio, "N/A,"); } - print(state.files.eio, "{},", GetScheduleName(state, state.dataHeatBal->People(Loop).ClothingPtr)); - print(state.files.eio, "{},", GetScheduleName(state, state.dataHeatBal->People(Loop).AirVelocityPtr)); + print(state.files.eio, "{},", people.clothingSched ? people.clothingSched->Name : ""); + print(state.files.eio, "{},", people.airVelocitySched ? people.airVelocitySched->Name : ""); - if (state.dataHeatBal->People(Loop).Fanger) { - print(state.files.eio, "Yes,"); - } else { - print(state.files.eio, "No,"); - } - if (state.dataHeatBal->People(Loop).Pierce) { - print(state.files.eio, "Yes,"); - } else { - print(state.files.eio, "No,"); - } - if (state.dataHeatBal->People(Loop).KSU) { - print(state.files.eio, "Yes,"); - } else { - print(state.files.eio, "No,"); - } - if (state.dataHeatBal->People(Loop).CoolingEffectASH55) { - print(state.files.eio, "Yes,"); - } else { - print(state.files.eio, "No,"); - } - if (state.dataHeatBal->People(Loop).AnkleDraftASH55) { - print(state.files.eio, "Yes\n"); - } else { - print(state.files.eio, "No\n"); - } - } else { - print(state.files.eio, "\n"); + print(state.files.eio, "{},", yesNoNames[(int)people.Fanger]); + print(state.files.eio, "{},", yesNoNames[(int)people.Pierce]); + print(state.files.eio, "{},", yesNoNames[(int)people.KSU]); + print(state.files.eio, "{},", yesNoNames[(int)people.CoolingEffectASH55]); + print(state.files.eio, "{}", yesNoNames[(int)people.AnkleDraftASH55]); } + print(state.files.eio, "\n"); } + for (int Loop = 1; Loop <= state.dataHeatBal->TotLights; ++Loop) { + auto &lights = state.dataHeatBal->Lights(Loop); + if (Loop == 1) { print(state.files.eio, Format_723, @@ -3870,57 +3328,56 @@ namespace InternalHeatGains { "Minimum Lighting Level for Winter Design Days {W}, Maximum Lighting Level for Winter Design Days {W}\n"); } - int ZoneNum = state.dataHeatBal->Lights(Loop).ZonePtr; - - if (ZoneNum == 0) { - print(state.files.eio, "Lights-Illegal Zone specified", state.dataHeatBal->Lights(Loop).Name); + if (lights.ZonePtr == 0) { + print(state.files.eio, "Lights-Illegal Zone specified", lights.Name); continue; } - print(state.files.eio, - Format_722, - "Lights", - state.dataHeatBal->Lights(Loop).Name, - GetScheduleName(state, state.dataHeatBal->Lights(Loop).SchedPtr), - state.dataHeatBal->Zone(ZoneNum).Name, - state.dataHeatBal->Zone(ZoneNum).FloorArea, - state.dataHeatBal->Zone(ZoneNum).TotOccupants); - - print(state.files.eio, "{:.3R},", state.dataHeatBal->Lights(Loop).DesignLevel); - - print_and_divide_if_greater_than_zero(state.dataHeatBal->Lights(Loop).DesignLevel, state.dataHeatBal->Zone(ZoneNum).FloorArea); - print_and_divide_if_greater_than_zero(state.dataHeatBal->Lights(Loop).DesignLevel, state.dataHeatBal->Zone(ZoneNum).TotOccupants); - - print(state.files.eio, "{:.3R},", state.dataHeatBal->Lights(Loop).FractionReturnAir); - print(state.files.eio, "{:.3R},", state.dataHeatBal->Lights(Loop).FractionRadiant); - print(state.files.eio, "{:.3R},", state.dataHeatBal->Lights(Loop).FractionShortWave); - print(state.files.eio, "{:.3R},", state.dataHeatBal->Lights(Loop).FractionConvected); - print(state.files.eio, "{:.3R},", state.dataHeatBal->Lights(Loop).FractionReplaceable); - print(state.files.eio, "{},", state.dataHeatBal->Lights(Loop).EndUseSubcategory); - print(state.files.eio, "{:.3R},", state.dataHeatBal->Lights(Loop).NomMinDesignLevel); - print(state.files.eio, "{:.3R},", state.dataHeatBal->Lights(Loop).NomMaxDesignLevel); + + auto const &zone = state.dataHeatBal->Zone(lights.ZonePtr); + + print(state.files.eio, Format_722, "Lights", lights.Name, lights.sched->Name, zone.Name, zone.FloorArea, zone.TotOccupants); + + print(state.files.eio, "{:.3R},", lights.DesignLevel); + + print_and_divide_if_greater_than_zero(lights.DesignLevel, zone.FloorArea); + print_and_divide_if_greater_than_zero(lights.DesignLevel, zone.TotOccupants); + + print(state.files.eio, "{:.3R},", lights.FractionReturnAir); + print(state.files.eio, "{:.3R},", lights.FractionRadiant); + print(state.files.eio, "{:.3R},", lights.FractionShortWave); + print(state.files.eio, "{:.3R},", lights.FractionConvected); + print(state.files.eio, "{:.3R},", lights.FractionReplaceable); + print(state.files.eio, "{},", lights.EndUseSubcategory); + print(state.files.eio, "{:.3R},", lights.NomMinDesignLevel); + print(state.files.eio, "{:.3R},", lights.NomMaxDesignLevel); auto &light = state.dataHeatBal->Lights(Loop); + + Real64 SchMin, SchMax; // weekdays - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, light.SchedPtr, DayTypeGroup::Weekday); + std::tie(SchMin, SchMax) = light.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::Weekday); print(state.files.eio, "{:.3R},", light.DesignLevel * SchMin); print(state.files.eio, "{:.1R},", light.DesignLevel * SchMax); // weekends/holidays - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, light.SchedPtr, DayTypeGroup::WeekEndHoliday); + std::tie(SchMin, SchMax) = light.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WeekEndHoliday); print(state.files.eio, "{:.3R},", light.DesignLevel * SchMin); print(state.files.eio, "{:.3R},", light.DesignLevel * SchMax); // summer design days - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, light.SchedPtr, DayTypeGroup::SummerDesignDay); + std::tie(SchMin, SchMax) = light.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::SummerDesignDay); print(state.files.eio, "{:.3R},", light.DesignLevel * SchMin); print(state.files.eio, "{:.3R},", light.DesignLevel * SchMax); // winter design days - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, light.SchedPtr, DayTypeGroup::WinterDesignDay); + std::tie(SchMin, SchMax) = light.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WinterDesignDay); print(state.files.eio, "{:.3R},", light.DesignLevel * SchMin); print(state.files.eio, "{:.3R}\n", light.DesignLevel * SchMax); } + for (int Loop = 1; Loop <= state.dataHeatBal->TotElecEquip; ++Loop) { + auto &elecEq = state.dataHeatBal->ZoneElectric(Loop); + if (Loop == 1) { print(state.files.eio, Format_723, @@ -3934,56 +3391,53 @@ namespace InternalHeatGains { "Minimum Equipment Level for Winter Design Days {W}, Maximum Equipment Level for Winter Design Days {W}\n"); } - int ZoneNum = state.dataHeatBal->ZoneElectric(Loop).ZonePtr; - - if (ZoneNum == 0) { - print(state.files.eio, Format_724, "Electric Equipment-Illegal Zone specified", state.dataHeatBal->ZoneElectric(Loop).Name); + if (elecEq.ZonePtr == 0) { + print(state.files.eio, Format_724, "Electric Equipment-Illegal Zone specified", elecEq.Name); continue; } - print(state.files.eio, - Format_722, - "ElectricEquipment", - state.dataHeatBal->ZoneElectric(Loop).Name, - GetScheduleName(state, state.dataHeatBal->ZoneElectric(Loop).SchedPtr), - state.dataHeatBal->Zone(ZoneNum).Name, - state.dataHeatBal->Zone(ZoneNum).FloorArea, - state.dataHeatBal->Zone(ZoneNum).TotOccupants); - - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneElectric(Loop).DesignLevel); - - print_and_divide_if_greater_than_zero(state.dataHeatBal->ZoneElectric(Loop).DesignLevel, state.dataHeatBal->Zone(ZoneNum).FloorArea); - print_and_divide_if_greater_than_zero(state.dataHeatBal->ZoneElectric(Loop).DesignLevel, state.dataHeatBal->Zone(ZoneNum).TotOccupants); - - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneElectric(Loop).FractionLatent); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneElectric(Loop).FractionRadiant); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneElectric(Loop).FractionLost); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneElectric(Loop).FractionConvected); - print(state.files.eio, "{},", state.dataHeatBal->ZoneElectric(Loop).EndUseSubcategory); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneElectric(Loop).NomMinDesignLevel); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneElectric(Loop).NomMaxDesignLevel); - - auto &electric = state.dataHeatBal->ZoneElectric(Loop); + + auto &zone = state.dataHeatBal->Zone(elecEq.ZonePtr); + + print(state.files.eio, Format_722, "ElectricEquipment", elecEq.Name, elecEq.sched->Name, zone.Name, zone.FloorArea, zone.TotOccupants); + print(state.files.eio, "{:.3R},", elecEq.DesignLevel); + + print_and_divide_if_greater_than_zero(elecEq.DesignLevel, zone.FloorArea); + print_and_divide_if_greater_than_zero(elecEq.DesignLevel, zone.TotOccupants); + + print(state.files.eio, "{:.3R},", elecEq.FractionLatent); + print(state.files.eio, "{:.3R},", elecEq.FractionRadiant); + print(state.files.eio, "{:.3R},", elecEq.FractionLost); + print(state.files.eio, "{:.3R},", elecEq.FractionConvected); + print(state.files.eio, "{},", elecEq.EndUseSubcategory); + print(state.files.eio, "{:.3R},", elecEq.NomMinDesignLevel); + print(state.files.eio, "{:.3R},", elecEq.NomMaxDesignLevel); + + Real64 SchMin, SchMax; + // weekdays - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, electric.SchedPtr, DayTypeGroup::Weekday); - print(state.files.eio, "{:.3R},", electric.DesignLevel * SchMin); - print(state.files.eio, "{:.3R},", electric.DesignLevel * SchMax); + std::tie(SchMin, SchMax) = elecEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::Weekday); + print(state.files.eio, "{:.3R},", elecEq.DesignLevel * SchMin); + print(state.files.eio, "{:.3R},", elecEq.DesignLevel * SchMax); // weekends/holidays - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, electric.SchedPtr, DayTypeGroup::WeekEndHoliday); - print(state.files.eio, "{:.3R},", electric.DesignLevel * SchMin); - print(state.files.eio, "{:.3R},", electric.DesignLevel * SchMax); + std::tie(SchMin, SchMax) = elecEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WeekEndHoliday); + print(state.files.eio, "{:.3R},", elecEq.DesignLevel * SchMin); + print(state.files.eio, "{:.3R},", elecEq.DesignLevel * SchMax); // summer design days - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, electric.SchedPtr, DayTypeGroup::SummerDesignDay); - print(state.files.eio, "{:.3R},", electric.DesignLevel * SchMin); - print(state.files.eio, "{:.3R},", electric.DesignLevel * SchMax); + std::tie(SchMin, SchMax) = elecEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::SummerDesignDay); + print(state.files.eio, "{:.3R},", elecEq.DesignLevel * SchMin); + print(state.files.eio, "{:.3R},", elecEq.DesignLevel * SchMax); // winter design days - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, electric.SchedPtr, DayTypeGroup::WinterDesignDay); - print(state.files.eio, "{:.3R},", electric.DesignLevel * SchMin); - print(state.files.eio, "{:.3R}\n", electric.DesignLevel * SchMax); + std::tie(SchMin, SchMax) = elecEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WinterDesignDay); + print(state.files.eio, "{:.3R},", elecEq.DesignLevel * SchMin); + print(state.files.eio, "{:.3R}\n", elecEq.DesignLevel * SchMax); } + for (int Loop = 1; Loop <= state.dataHeatBal->TotGasEquip; ++Loop) { + auto &gasEq = state.dataHeatBal->ZoneGas(Loop); + if (Loop == 1) { print(state.files.eio, Format_723, @@ -3997,58 +3451,52 @@ namespace InternalHeatGains { "Minimum Equipment Level for Winter Design Days {W}, Maximum Equipment Level for Winter Design Days {W}\n"); } - int ZoneNum = state.dataHeatBal->ZoneGas(Loop).ZonePtr; - - if (ZoneNum == 0) { - print(state.files.eio, Format_724, "Gas Equipment-Illegal Zone specified", state.dataHeatBal->ZoneGas(Loop).Name); + if (gasEq.ZonePtr == 0) { + print(state.files.eio, Format_724, "Gas Equipment-Illegal Zone specified", gasEq.Name); continue; } - print(state.files.eio, - Format_722, - "GasEquipment", - state.dataHeatBal->ZoneGas(Loop).Name, - GetScheduleName(state, state.dataHeatBal->ZoneGas(Loop).SchedPtr), - state.dataHeatBal->Zone(ZoneNum).Name, - state.dataHeatBal->Zone(ZoneNum).FloorArea, - state.dataHeatBal->Zone(ZoneNum).TotOccupants); - - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneGas(Loop).DesignLevel); - - print_and_divide_if_greater_than_zero(state.dataHeatBal->ZoneGas(Loop).DesignLevel, state.dataHeatBal->Zone(ZoneNum).FloorArea); - print_and_divide_if_greater_than_zero(state.dataHeatBal->ZoneGas(Loop).DesignLevel, state.dataHeatBal->Zone(ZoneNum).TotOccupants); - - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneGas(Loop).FractionLatent); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneGas(Loop).FractionRadiant); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneGas(Loop).FractionLost); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneGas(Loop).FractionConvected); - print(state.files.eio, "{},", state.dataHeatBal->ZoneGas(Loop).EndUseSubcategory); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneGas(Loop).NomMinDesignLevel); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneGas(Loop).NomMaxDesignLevel); - - auto &gas = state.dataHeatBal->ZoneGas(Loop); + auto &zone = state.dataHeatBal->Zone(gasEq.ZonePtr); + + print(state.files.eio, Format_722, "GasEquipment", gasEq.Name, gasEq.sched->Name, zone.Name, zone.FloorArea, zone.TotOccupants); + print(state.files.eio, "{:.3R},", gasEq.DesignLevel); + + print_and_divide_if_greater_than_zero(gasEq.DesignLevel, zone.FloorArea); + print_and_divide_if_greater_than_zero(gasEq.DesignLevel, zone.TotOccupants); + + print(state.files.eio, "{:.3R},", gasEq.FractionLatent); + print(state.files.eio, "{:.3R},", gasEq.FractionRadiant); + print(state.files.eio, "{:.3R},", gasEq.FractionLost); + print(state.files.eio, "{:.3R},", gasEq.FractionConvected); + print(state.files.eio, "{},", gasEq.EndUseSubcategory); + print(state.files.eio, "{:.3R},", gasEq.NomMinDesignLevel); + print(state.files.eio, "{:.3R},", gasEq.NomMaxDesignLevel); + + Real64 SchMin, SchMax; // weekdays - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, gas.SchedPtr, DayTypeGroup::Weekday); - print(state.files.eio, "{:.3R},", gas.DesignLevel * SchMin); - print(state.files.eio, "{:.3R},", gas.DesignLevel * SchMax); + std::tie(SchMin, SchMax) = gasEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::Weekday); + print(state.files.eio, "{:.3R},", gasEq.DesignLevel * SchMin); + print(state.files.eio, "{:.3R},", gasEq.DesignLevel * SchMax); // weekends/holidays - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, gas.SchedPtr, DayTypeGroup::WeekEndHoliday); - print(state.files.eio, "{:.3R},", gas.DesignLevel * SchMin); - print(state.files.eio, "{:.3R},", gas.DesignLevel * SchMax); + std::tie(SchMin, SchMax) = gasEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WeekEndHoliday); + print(state.files.eio, "{:.3R},", gasEq.DesignLevel * SchMin); + print(state.files.eio, "{:.3R},", gasEq.DesignLevel * SchMax); // summer design days - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, gas.SchedPtr, DayTypeGroup::SummerDesignDay); - print(state.files.eio, "{:.3R},", gas.DesignLevel * SchMin); - print(state.files.eio, "{:.3R},", gas.DesignLevel * SchMax); + std::tie(SchMin, SchMax) = gasEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::SummerDesignDay); + print(state.files.eio, "{:.3R},", gasEq.DesignLevel * SchMin); + print(state.files.eio, "{:.3R},", gasEq.DesignLevel * SchMax); // winter design days - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, gas.SchedPtr, DayTypeGroup::WinterDesignDay); - print(state.files.eio, "{:.3R},", gas.DesignLevel * SchMin); - print(state.files.eio, "{:.3R}\n", gas.DesignLevel * SchMax); + std::tie(SchMin, SchMax) = gasEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WinterDesignDay); + print(state.files.eio, "{:.3R},", gasEq.DesignLevel * SchMin); + print(state.files.eio, "{:.3R}\n", gasEq.DesignLevel * SchMax); } for (int Loop = 1; Loop <= state.dataHeatBal->TotHWEquip; ++Loop) { + auto &hotWaterEq = state.dataHeatBal->ZoneHWEq(Loop); + if (Loop == 1) { print(state.files.eio, Format_723, @@ -4062,58 +3510,60 @@ namespace InternalHeatGains { "Minimum Equipment Level for Winter Design Days {W}, Maximum Equipment Level for Winter Design Days {W}\n"); } - int ZoneNum = state.dataHeatBal->ZoneHWEq(Loop).ZonePtr; - - if (ZoneNum == 0) { - print(state.files.eio, Format_724, "Hot Water Equipment-Illegal Zone specified", state.dataHeatBal->ZoneHWEq(Loop).Name); + if (hotWaterEq.ZonePtr == 0) { + print(state.files.eio, Format_724, "Hot Water Equipment-Illegal Zone specified", hotWaterEq.Name); continue; } + auto const &zone = state.dataHeatBal->Zone(hotWaterEq.ZonePtr); + print(state.files.eio, Format_722, "HotWaterEquipment", - state.dataHeatBal->ZoneHWEq(Loop).Name, - GetScheduleName(state, state.dataHeatBal->ZoneHWEq(Loop).SchedPtr), - state.dataHeatBal->Zone(ZoneNum).Name, - state.dataHeatBal->Zone(ZoneNum).FloorArea, - state.dataHeatBal->Zone(ZoneNum).TotOccupants); - - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneHWEq(Loop).DesignLevel); - - print_and_divide_if_greater_than_zero(state.dataHeatBal->ZoneHWEq(Loop).DesignLevel, state.dataHeatBal->Zone(ZoneNum).FloorArea); - print_and_divide_if_greater_than_zero(state.dataHeatBal->ZoneHWEq(Loop).DesignLevel, state.dataHeatBal->Zone(ZoneNum).TotOccupants); - - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneHWEq(Loop).FractionLatent); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneHWEq(Loop).FractionRadiant); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneHWEq(Loop).FractionLost); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneHWEq(Loop).FractionConvected); - print(state.files.eio, "{},", state.dataHeatBal->ZoneHWEq(Loop).EndUseSubcategory); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneHWEq(Loop).NomMinDesignLevel); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneHWEq(Loop).NomMaxDesignLevel); - - auto &hweq = state.dataHeatBal->ZoneHWEq(Loop); + hotWaterEq.Name, + hotWaterEq.sched->Name, + zone.Name, + zone.FloorArea, + zone.TotOccupants); + + print(state.files.eio, "{:.3R},", hotWaterEq.DesignLevel); + + print_and_divide_if_greater_than_zero(hotWaterEq.DesignLevel, zone.FloorArea); + print_and_divide_if_greater_than_zero(hotWaterEq.DesignLevel, zone.TotOccupants); + + print(state.files.eio, "{:.3R},", hotWaterEq.FractionLatent); + print(state.files.eio, "{:.3R},", hotWaterEq.FractionRadiant); + print(state.files.eio, "{:.3R},", hotWaterEq.FractionLost); + print(state.files.eio, "{:.3R},", hotWaterEq.FractionConvected); + print(state.files.eio, "{},", hotWaterEq.EndUseSubcategory); + print(state.files.eio, "{:.3R},", hotWaterEq.NomMinDesignLevel); + print(state.files.eio, "{:.3R},", hotWaterEq.NomMaxDesignLevel); + + Real64 SchMin, SchMax; // weekdays - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, hweq.SchedPtr, DayTypeGroup::Weekday); - print(state.files.eio, "{:.3R},", hweq.DesignLevel * SchMin); - print(state.files.eio, "{:.3R},", hweq.DesignLevel * SchMax); + std::tie(SchMin, SchMax) = hotWaterEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::Weekday); + print(state.files.eio, "{:.3R},", hotWaterEq.DesignLevel * SchMin); + print(state.files.eio, "{:.3R},", hotWaterEq.DesignLevel * SchMax); // weekends/holidays - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, hweq.SchedPtr, DayTypeGroup::WeekEndHoliday); - print(state.files.eio, "{:.3R},", hweq.DesignLevel * SchMin); - print(state.files.eio, "{:.3R},", hweq.DesignLevel * SchMax); + std::tie(SchMin, SchMax) = hotWaterEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WeekEndHoliday); + print(state.files.eio, "{:.3R},", hotWaterEq.DesignLevel * SchMin); + print(state.files.eio, "{:.3R},", hotWaterEq.DesignLevel * SchMax); // summer design days - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, hweq.SchedPtr, DayTypeGroup::SummerDesignDay); - print(state.files.eio, "{:.3R},", hweq.DesignLevel * SchMin); - print(state.files.eio, "{:.3R},", hweq.DesignLevel * SchMax); + std::tie(SchMin, SchMax) = hotWaterEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::SummerDesignDay); + print(state.files.eio, "{:.3R},", hotWaterEq.DesignLevel * SchMin); + print(state.files.eio, "{:.3R},", hotWaterEq.DesignLevel * SchMax); // winter design days - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, hweq.SchedPtr, DayTypeGroup::WinterDesignDay); - print(state.files.eio, "{:.3R},", hweq.DesignLevel * SchMin); - print(state.files.eio, "{:.3R}\n", hweq.DesignLevel * SchMax); + std::tie(SchMin, SchMax) = hotWaterEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WinterDesignDay); + print(state.files.eio, "{:.3R},", hotWaterEq.DesignLevel * SchMin); + print(state.files.eio, "{:.3R}\n", hotWaterEq.DesignLevel * SchMax); } for (int Loop = 1; Loop <= state.dataHeatBal->TotStmEquip; ++Loop) { + auto &steamEq = state.dataHeatBal->ZoneSteamEq(Loop); + if (Loop == 1) { print(state.files.eio, Format_723, @@ -4127,55 +3577,47 @@ namespace InternalHeatGains { "Minimum Equipment Level for Winter Design Days {W}, Maximum Equipment Level for Winter Design Days {W}\n"); } - int ZoneNum = state.dataHeatBal->ZoneSteamEq(Loop).ZonePtr; - - if (ZoneNum == 0) { - print(state.files.eio, Format_724, "Steam Equipment-Illegal Zone specified", state.dataHeatBal->ZoneSteamEq(Loop).Name); + if (steamEq.ZonePtr == 0) { + print(state.files.eio, Format_724, "Steam Equipment-Illegal Zone specified", steamEq.Name); continue; } - print(state.files.eio, - Format_722, - "SteamEquipment", - state.dataHeatBal->ZoneSteamEq(Loop).Name, - GetScheduleName(state, state.dataHeatBal->ZoneSteamEq(Loop).SchedPtr), - state.dataHeatBal->Zone(ZoneNum).Name, - state.dataHeatBal->Zone(ZoneNum).FloorArea, - state.dataHeatBal->Zone(ZoneNum).TotOccupants); - - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneSteamEq(Loop).DesignLevel); - - print_and_divide_if_greater_than_zero(state.dataHeatBal->ZoneSteamEq(Loop).DesignLevel, state.dataHeatBal->Zone(ZoneNum).FloorArea); - print_and_divide_if_greater_than_zero(state.dataHeatBal->ZoneSteamEq(Loop).DesignLevel, state.dataHeatBal->Zone(ZoneNum).TotOccupants); - - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneSteamEq(Loop).FractionLatent); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneSteamEq(Loop).FractionRadiant); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneSteamEq(Loop).FractionLost); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneSteamEq(Loop).FractionConvected); - print(state.files.eio, "{},", state.dataHeatBal->ZoneSteamEq(Loop).EndUseSubcategory); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneSteamEq(Loop).NomMinDesignLevel); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneSteamEq(Loop).NomMaxDesignLevel); - - auto &stmeq = state.dataHeatBal->ZoneSteamEq(Loop); + auto &zone = state.dataHeatBal->Zone(steamEq.ZonePtr); + + print(state.files.eio, Format_722, "SteamEquipment", steamEq.Name, steamEq.sched->Name, zone.Name, zone.FloorArea, zone.TotOccupants); + print(state.files.eio, "{:.3R},", steamEq.DesignLevel); + + print_and_divide_if_greater_than_zero(steamEq.DesignLevel, zone.FloorArea); + print_and_divide_if_greater_than_zero(steamEq.DesignLevel, zone.TotOccupants); + + print(state.files.eio, "{:.3R},", steamEq.FractionLatent); + print(state.files.eio, "{:.3R},", steamEq.FractionRadiant); + print(state.files.eio, "{:.3R},", steamEq.FractionLost); + print(state.files.eio, "{:.3R},", steamEq.FractionConvected); + print(state.files.eio, "{},", steamEq.EndUseSubcategory); + print(state.files.eio, "{:.3R},", steamEq.NomMinDesignLevel); + print(state.files.eio, "{:.3R},", steamEq.NomMaxDesignLevel); + + Real64 SchMin, SchMax; // weekdays - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, stmeq.SchedPtr, DayTypeGroup::Weekday); - print(state.files.eio, "{:.3R},", stmeq.DesignLevel * SchMin); - print(state.files.eio, "{:.3R},", stmeq.DesignLevel * SchMax); + std::tie(SchMin, SchMax) = steamEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::Weekday); + print(state.files.eio, "{:.3R},", steamEq.DesignLevel * SchMin); + print(state.files.eio, "{:.3R},", steamEq.DesignLevel * SchMax); // weekends/holidays - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, stmeq.SchedPtr, DayTypeGroup::WeekEndHoliday); - print(state.files.eio, "{:.3R},", stmeq.DesignLevel * SchMin); - print(state.files.eio, "{:.3R},", stmeq.DesignLevel * SchMax); + std::tie(SchMin, SchMax) = steamEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WeekEndHoliday); + print(state.files.eio, "{:.3R},", steamEq.DesignLevel * SchMin); + print(state.files.eio, "{:.3R},", steamEq.DesignLevel * SchMax); // summer design days - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, stmeq.SchedPtr, DayTypeGroup::SummerDesignDay); - print(state.files.eio, "{:.3R},", stmeq.DesignLevel * SchMin); - print(state.files.eio, "{:.3R},", stmeq.DesignLevel * SchMax); + std::tie(SchMin, SchMax) = steamEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::SummerDesignDay); + print(state.files.eio, "{:.3R},", steamEq.DesignLevel * SchMin); + print(state.files.eio, "{:.3R},", steamEq.DesignLevel * SchMax); // winter design days - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, stmeq.SchedPtr, DayTypeGroup::WinterDesignDay); - print(state.files.eio, "{:.3R},", stmeq.DesignLevel * SchMin); - print(state.files.eio, "{:.3R}\n", stmeq.DesignLevel * SchMax); + std::tie(SchMin, SchMax) = steamEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WinterDesignDay); + print(state.files.eio, "{:.3R},", steamEq.DesignLevel * SchMin); + print(state.files.eio, "{:.3R}\n", steamEq.DesignLevel * SchMax); } for (int Loop = 1; Loop <= state.dataHeatBal->TotOthEquip; ++Loop) { @@ -4192,57 +3634,54 @@ namespace InternalHeatGains { "Minimum Equipment Level for Winter Design Days {W}, Maximum Equipment Level for Winter Design Days {W}\n"); } - int ZoneNum = state.dataHeatBal->ZoneOtherEq(Loop).ZonePtr; + auto &otherEq = state.dataHeatBal->ZoneOtherEq(Loop); - if (ZoneNum == 0) { - print(state.files.eio, Format_724, "Other Equipment-Illegal Zone specified", state.dataHeatBal->ZoneOtherEq(Loop).Name); + if (otherEq.ZonePtr == 0) { + print(state.files.eio, Format_724, "Other Equipment-Illegal Zone specified", otherEq.Name); continue; } - print(state.files.eio, - Format_722, - "OtherEquipment", - state.dataHeatBal->ZoneOtherEq(Loop).Name, - GetScheduleName(state, state.dataHeatBal->ZoneOtherEq(Loop).SchedPtr), - state.dataHeatBal->Zone(ZoneNum).Name, - state.dataHeatBal->Zone(ZoneNum).FloorArea, - state.dataHeatBal->Zone(ZoneNum).TotOccupants); - - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneOtherEq(Loop).DesignLevel); - - print_and_divide_if_greater_than_zero(state.dataHeatBal->ZoneOtherEq(Loop).DesignLevel, state.dataHeatBal->Zone(ZoneNum).FloorArea); - print_and_divide_if_greater_than_zero(state.dataHeatBal->ZoneOtherEq(Loop).DesignLevel, state.dataHeatBal->Zone(ZoneNum).TotOccupants); - - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneOtherEq(Loop).FractionLatent); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneOtherEq(Loop).FractionRadiant); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneOtherEq(Loop).FractionLost); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneOtherEq(Loop).FractionConvected); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneOtherEq(Loop).NomMinDesignLevel); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneOtherEq(Loop).NomMaxDesignLevel); - - auto &other = state.dataHeatBal->ZoneOtherEq(Loop); + auto const &zone = state.dataHeatBal->Zone(otherEq.ZonePtr); + + print(state.files.eio, Format_722, "OtherEquipment", otherEq.Name, otherEq.sched->Name, zone.Name, zone.FloorArea, zone.TotOccupants); + print(state.files.eio, "{:.3R},", otherEq.DesignLevel); + + print_and_divide_if_greater_than_zero(otherEq.DesignLevel, zone.FloorArea); + print_and_divide_if_greater_than_zero(otherEq.DesignLevel, zone.TotOccupants); + + print(state.files.eio, "{:.3R},", otherEq.FractionLatent); + print(state.files.eio, "{:.3R},", otherEq.FractionRadiant); + print(state.files.eio, "{:.3R},", otherEq.FractionLost); + print(state.files.eio, "{:.3R},", otherEq.FractionConvected); + print(state.files.eio, "{:.3R},", otherEq.NomMinDesignLevel); + print(state.files.eio, "{:.3R},", otherEq.NomMaxDesignLevel); + + Real64 SchMin, SchMax; + // weekdays - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, other.SchedPtr, DayTypeGroup::Weekday); - print(state.files.eio, "{:.3R},", other.DesignLevel * SchMin); - print(state.files.eio, "{:.3R},", other.DesignLevel * SchMax); + std::tie(SchMin, SchMax) = otherEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::Weekday); + print(state.files.eio, "{:.3R},", otherEq.DesignLevel * SchMin); + print(state.files.eio, "{:.3R},", otherEq.DesignLevel * SchMax); // weekends/holidays - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, other.SchedPtr, DayTypeGroup::WeekEndHoliday); - print(state.files.eio, "{:.3R},", other.DesignLevel * SchMin); - print(state.files.eio, "{:.3R},", other.DesignLevel * SchMax); + std::tie(SchMin, SchMax) = otherEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WeekEndHoliday); + print(state.files.eio, "{:.3R},", otherEq.DesignLevel * SchMin); + print(state.files.eio, "{:.3R},", otherEq.DesignLevel * SchMax); // summer design days - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, other.SchedPtr, DayTypeGroup::SummerDesignDay); - print(state.files.eio, "{:.3R},", other.DesignLevel * SchMin); - print(state.files.eio, "{:.3R},", other.DesignLevel * SchMax); + std::tie(SchMin, SchMax) = otherEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::SummerDesignDay); + print(state.files.eio, "{:.3R},", otherEq.DesignLevel * SchMin); + print(state.files.eio, "{:.3R},", otherEq.DesignLevel * SchMax); // winter design days - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, other.SchedPtr, DayTypeGroup::WinterDesignDay); - print(state.files.eio, "{:.3R},", other.DesignLevel * SchMin); - print(state.files.eio, "{:.3R}\n", other.DesignLevel * SchMax); + std::tie(SchMin, SchMax) = otherEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WinterDesignDay); + print(state.files.eio, "{:.3R},", otherEq.DesignLevel * SchMin); + print(state.files.eio, "{:.3R}\n", otherEq.DesignLevel * SchMax); } for (int Loop = 1; Loop <= state.dataHeatBal->TotITEquip; ++Loop) { + auto &itEq = state.dataHeatBal->ZoneITEq(Loop); + if (Loop == 1) { print(state.files.eio, Format_723, @@ -4258,60 +3697,61 @@ namespace InternalHeatGains { "Design Air Volume Flow Rate {m3/s}\n"); } - int ZoneNum = state.dataHeatBal->ZoneITEq(Loop).ZonePtr; - - if (ZoneNum == 0) { - print(state.files.eio, Format_724, "ElectricEquipment:ITE:AirCooled-Illegal Zone specified", state.dataHeatBal->ZoneITEq(Loop).Name); + if (itEq.ZonePtr == 0) { + print(state.files.eio, Format_724, "ElectricEquipment:ITE:AirCooled-Illegal Zone specified", itEq.Name); continue; } + + auto const &zone = state.dataHeatBal->Zone(itEq.ZonePtr); print(state.files.eio, Format_722, "ElectricEquipment:ITE:AirCooled", - state.dataHeatBal->ZoneITEq(Loop).Name, - GetScheduleName(state, state.dataHeatBal->ZoneITEq(Loop).OperSchedPtr), - state.dataHeatBal->Zone(ZoneNum).Name, - state.dataHeatBal->Zone(ZoneNum).FloorArea, - state.dataHeatBal->Zone(ZoneNum).TotOccupants); + itEq.Name, + itEq.operSched->Name, + zone.Name, + zone.FloorArea, + zone.TotOccupants); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneITEq(Loop).DesignTotalPower); + print(state.files.eio, "{:.3R},", itEq.DesignTotalPower); - print_and_divide_if_greater_than_zero(state.dataHeatBal->ZoneITEq(Loop).DesignTotalPower, state.dataHeatBal->Zone(ZoneNum).FloorArea); - print_and_divide_if_greater_than_zero(state.dataHeatBal->ZoneITEq(Loop).DesignTotalPower, state.dataHeatBal->Zone(ZoneNum).TotOccupants); + print_and_divide_if_greater_than_zero(itEq.DesignTotalPower, zone.FloorArea); + print_and_divide_if_greater_than_zero(itEq.DesignTotalPower, zone.TotOccupants); // ElectricEquipment:ITE:AirCooled is 100% convective print(state.files.eio, "1.0,"); - print(state.files.eio, "{},", state.dataHeatBal->ZoneITEq(Loop).EndUseSubcategoryCPU); - print(state.files.eio, "{},", state.dataHeatBal->ZoneITEq(Loop).EndUseSubcategoryFan); - print(state.files.eio, "{},", state.dataHeatBal->ZoneITEq(Loop).EndUseSubcategoryUPS); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneITEq(Loop).NomMinDesignLevel); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneITEq(Loop).NomMaxDesignLevel); + print(state.files.eio, "{},", itEq.EndUseSubcategoryCPU); + print(state.files.eio, "{},", itEq.EndUseSubcategoryFan); + print(state.files.eio, "{},", itEq.EndUseSubcategoryUPS); + print(state.files.eio, "{:.3R},", itEq.NomMinDesignLevel); + print(state.files.eio, "{:.3R},", itEq.NomMaxDesignLevel); - auto &iteq = state.dataHeatBal->ZoneITEq(Loop); + Real64 SchMin, SchMax; // weekdays - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, iteq.OperSchedPtr, DayTypeGroup::Weekday); - print(state.files.eio, "{:.3R},", iteq.DesignTotalPower * SchMin); - print(state.files.eio, "{:.3R},", iteq.DesignTotalPower * SchMax); + std::tie(SchMin, SchMax) = itEq.operSched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::Weekday); + print(state.files.eio, "{:.3R},", itEq.DesignTotalPower * SchMin); + print(state.files.eio, "{:.3R},", itEq.DesignTotalPower * SchMax); // weekends/holidays - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, iteq.OperSchedPtr, DayTypeGroup::WeekEndHoliday); - print(state.files.eio, "{:.3R},", iteq.DesignTotalPower * SchMin); - print(state.files.eio, "{:.3R},", iteq.DesignTotalPower * SchMax); + std::tie(SchMin, SchMax) = itEq.operSched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WeekEndHoliday); + print(state.files.eio, "{:.3R},", itEq.DesignTotalPower * SchMin); + print(state.files.eio, "{:.3R},", itEq.DesignTotalPower * SchMax); // summer design days - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, iteq.OperSchedPtr, DayTypeGroup::SummerDesignDay); - print(state.files.eio, "{:.3R},", iteq.DesignTotalPower * SchMin); - print(state.files.eio, "{:.3R},", iteq.DesignTotalPower * SchMax); + std::tie(SchMin, SchMax) = itEq.operSched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::SummerDesignDay); + print(state.files.eio, "{:.3R},", itEq.DesignTotalPower * SchMin); + print(state.files.eio, "{:.3R},", itEq.DesignTotalPower * SchMax); // winter design days - std::tie(SchMin, SchMax) = getScheduleMinMaxByDayType(state, iteq.OperSchedPtr, DayTypeGroup::WinterDesignDay); - print(state.files.eio, "{:.3R},", iteq.DesignTotalPower * SchMin); - print(state.files.eio, "{:.3R},", iteq.DesignTotalPower * SchMax); + std::tie(SchMin, SchMax) = itEq.operSched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WinterDesignDay); + print(state.files.eio, "{:.3R},", itEq.DesignTotalPower * SchMin); + print(state.files.eio, "{:.3R},", itEq.DesignTotalPower * SchMax); - print(state.files.eio, "{:.10R}\n", state.dataHeatBal->ZoneITEq(Loop).DesignAirVolFlowRate); + print(state.files.eio, "{:.10R}\n", itEq.DesignAirVolFlowRate); } for (int Loop = 1; Loop <= state.dataHeatBal->TotBBHeat; ++Loop) { + auto &bbHeat = state.dataHeatBal->ZoneBBHeat(Loop); if (Loop == 1) { print(state.files.eio, Format_723, @@ -4320,31 +3760,29 @@ namespace InternalHeatGains { "{W},High Temperature {C},Fraction Radiant,Fraction Convected,End-Use Subcategory\n"); } - int ZoneNum = state.dataHeatBal->ZoneBBHeat(Loop).ZonePtr; - - if (ZoneNum == 0) { - print(state.files.eio, - Format_724, - "Outdoor Controlled Baseboard Heat-Illegal Zone specified", - state.dataHeatBal->ZoneBBHeat(Loop).Name); + if (bbHeat.ZonePtr == 0) { + print(state.files.eio, Format_724, "Outdoor Controlled Baseboard Heat-Illegal Zone specified", bbHeat.Name); continue; } + + auto const &zone = state.dataHeatBal->Zone(bbHeat.ZonePtr); + print(state.files.eio, Format_722, "Outdoor Controlled Baseboard Heat", - state.dataHeatBal->ZoneBBHeat(Loop).Name, - GetScheduleName(state, state.dataHeatBal->ZoneBBHeat(Loop).SchedPtr), - state.dataHeatBal->Zone(ZoneNum).Name, - state.dataHeatBal->Zone(ZoneNum).FloorArea, - state.dataHeatBal->Zone(ZoneNum).TotOccupants); - - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneBBHeat(Loop).CapatLowTemperature); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneBBHeat(Loop).LowTemperature); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneBBHeat(Loop).CapatHighTemperature); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneBBHeat(Loop).HighTemperature); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneBBHeat(Loop).FractionRadiant); - print(state.files.eio, "{:.3R},", state.dataHeatBal->ZoneBBHeat(Loop).FractionConvected); - print(state.files.eio, "{}\n", state.dataHeatBal->ZoneBBHeat(Loop).EndUseSubcategory); + bbHeat.Name, + bbHeat.sched->Name, + zone.Name, + zone.FloorArea, + zone.TotOccupants); + + print(state.files.eio, "{:.3R},", bbHeat.CapatLowTemperature); + print(state.files.eio, "{:.3R},", bbHeat.LowTemperature); + print(state.files.eio, "{:.3R},", bbHeat.CapatHighTemperature); + print(state.files.eio, "{:.3R},", bbHeat.HighTemperature); + print(state.files.eio, "{:.3R},", bbHeat.FractionRadiant); + print(state.files.eio, "{:.3R},", bbHeat.FractionConvected); + print(state.files.eio, "{}\n", bbHeat.EndUseSubcategory); } } @@ -7028,7 +6466,7 @@ namespace InternalHeatGains { state.dataHeatBal->space(spaceNum).Name); } - // Not applicable for space until space has it's own air temeratures + // Not applicable for space until space has it's own air temperatures // Setup Output Variable(state, // "Space ITE Adjusted Return Air Temperature", // Constant::Units::W, @@ -7350,7 +6788,6 @@ namespace InternalHeatGains { // that are independent of the zone air temperature. // Using/Aliasing - using namespace ScheduleManager; using Dayltg::FigureTDDZoneGains; using FuelCellElectricGenerator::FigureFuelCellZoneGains; using MicroCHPElectricGenerator::FigureMicroCHPZoneGains; @@ -7534,7 +6971,8 @@ namespace InternalHeatGains { int NZ = state.dataHeatBal->People(Loop).ZonePtr; int spaceNum = thisPeople.spaceIndex; auto const &thisSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum); - NumberOccupants = thisPeople.NumberOfPeople * GetCurrentScheduleValue(state, thisPeople.NumberOfPeoplePtr); + NumberOccupants = thisPeople.NumberOfPeople * thisPeople.sched->getCurrentVal(); + if (thisPeople.EMSPeopleOn) NumberOccupants = thisPeople.EMSNumberOfPeople; TotalPeopleGain = 0.0; @@ -7542,7 +6980,7 @@ namespace InternalHeatGains { auto &thisZoneRep = state.dataHeatBal->ZonePreDefRep(NZ); if (NumberOccupants > 0.0) { - ActivityLevel_WperPerson = GetCurrentScheduleValue(state, thisPeople.ActivityLevelPtr); + ActivityLevel_WperPerson = thisPeople.activityLevelSched->getCurrentVal(); TotalPeopleGain = NumberOccupants * ActivityLevel_WperPerson; // if the user did not specify a sensible fraction, calculate the sensible heat gain if (thisPeople.UserSpecSensFrac == Constant::AutoCalculate) { @@ -7594,7 +7032,7 @@ namespace InternalHeatGains { auto &thisLights = state.dataHeatBal->Lights(Loop); int NZ = thisLights.ZonePtr; int spaceNum = thisLights.spaceIndex; - Q = thisLights.DesignLevel * GetCurrentScheduleValue(state, thisLights.SchedPtr); + Q = thisLights.DesignLevel * thisLights.sched->getCurrentVal(); if (state.dataDayltg->ZoneDaylight(NZ).totRefPts > 0) { if (thisLights.FractionReplaceable > 0.0) { // FractionReplaceable can only be 0 or 1 for these models @@ -7654,7 +7092,7 @@ namespace InternalHeatGains { for (int Loop = 1; Loop <= state.dataHeatBal->TotElecEquip; ++Loop) { auto &thisElecEq = state.dataHeatBal->ZoneElectric(Loop); - Q = thisElecEq.DesignLevel * GetCurrentScheduleValue(state, thisElecEq.SchedPtr); + Q = thisElecEq.DesignLevel * thisElecEq.sched->getCurrentVal(); // Reduce equipment power due to demand limiting if (thisElecEq.ManageDemand && (Q > thisElecEq.DemandLimit)) Q = thisElecEq.DemandLimit; @@ -7679,7 +7117,7 @@ namespace InternalHeatGains { for (int Loop = 1; Loop <= state.dataHeatBal->TotGasEquip; ++Loop) { auto &thisGasEq = state.dataHeatBal->ZoneGas(Loop); - Q = thisGasEq.DesignLevel * GetCurrentScheduleValue(state, thisGasEq.SchedPtr); + Q = thisGasEq.DesignLevel * thisGasEq.sched->getCurrentVal(); // Set Q to EMS override if being called for by EMs if (thisGasEq.EMSZoneEquipOverrideOn) Q = thisGasEq.EMSEquipPower; @@ -7702,7 +7140,7 @@ namespace InternalHeatGains { for (int Loop = 1; Loop <= state.dataHeatBal->TotOthEquip; ++Loop) { auto &thisOtherEq = state.dataHeatBal->ZoneOtherEq(Loop); - Q = thisOtherEq.DesignLevel * GetCurrentScheduleValue(state, thisOtherEq.SchedPtr); + Q = thisOtherEq.DesignLevel * thisOtherEq.sched->getCurrentVal(); // Set Q to EMS override if being called for by EMs if (thisOtherEq.EMSZoneEquipOverrideOn) Q = thisOtherEq.EMSEquipPower; @@ -7726,7 +7164,7 @@ namespace InternalHeatGains { for (int Loop = 1; Loop <= state.dataHeatBal->TotHWEquip; ++Loop) { auto &thisHWEq = state.dataHeatBal->ZoneHWEq(Loop); - Q = thisHWEq.DesignLevel * GetCurrentScheduleValue(state, thisHWEq.SchedPtr); + Q = thisHWEq.DesignLevel * thisHWEq.sched->getCurrentVal(); // Set Q to EMS override if being called for by EMs if (thisHWEq.EMSZoneEquipOverrideOn) Q = thisHWEq.EMSEquipPower; @@ -7748,7 +7186,7 @@ namespace InternalHeatGains { for (int Loop = 1; Loop <= state.dataHeatBal->TotStmEquip; ++Loop) { auto &thisSteamEq = state.dataHeatBal->ZoneSteamEq(Loop); - Q = thisSteamEq.DesignLevel * GetCurrentScheduleValue(state, thisSteamEq.SchedPtr); + Q = thisSteamEq.DesignLevel * thisSteamEq.sched->getCurrentVal(); // Set Q to EMS override if being called for by EMs if (thisSteamEq.EMSZoneEquipOverrideOn) Q = thisSteamEq.EMSEquipPower; @@ -7781,7 +7219,7 @@ namespace InternalHeatGains { } else { Q = thisBBHeat.CapatLowTemperature; } - Q *= GetCurrentScheduleValue(state, thisBBHeat.SchedPtr); + Q *= thisBBHeat.sched->getCurrentVal(); // set with EMS value if being called for. if (thisBBHeat.EMSZoneBaseboardOverrideOn) Q = thisBBHeat.EMSZoneBaseboardPower; @@ -7800,7 +7238,7 @@ namespace InternalHeatGains { for (int Loop = 1; Loop <= state.dataHeatBal->TotCO2Gen; ++Loop) { int NZ = state.dataHeatBal->ZoneCO2Gen(Loop).ZonePtr; state.dataHeatBal->ZoneCO2Gen(Loop).CO2GainRate = - state.dataHeatBal->ZoneCO2Gen(Loop).CO2DesignRate * GetCurrentScheduleValue(state, state.dataHeatBal->ZoneCO2Gen(Loop).SchedPtr); + state.dataHeatBal->ZoneCO2Gen(Loop).CO2DesignRate * state.dataHeatBal->ZoneCO2Gen(Loop).sched->getCurrentVal(); state.dataHeatBal->ZoneRpt(NZ).CO2Rate += state.dataHeatBal->ZoneCO2Gen(Loop).CO2GainRate; } @@ -7853,21 +7291,23 @@ namespace InternalHeatGains { state.dataHeatBal->SurfQdotRadIntGainsInPerArea(SurfNum) = thisEnclosure.radQThermalRad * thisEnclosure.radThermAbsMult * state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum); } else { - state.dataInternalHeatGains->curQL = thisEnclosure.radQThermalRad; + // radiant value prior to adjustment for pulse for load component report + Real64 const curQL = thisEnclosure.radQThermalRad; // for the loads component report during the special sizing run increase the radiant portion // a small amount to create a "pulse" of heat that is used for the delayed loads - state.dataInternalHeatGains->adjQL = state.dataInternalHeatGains->curQL + thisEnclosure.FloorArea * pulseMultipler; + // radiant value including adjustment for pulse for load component report + Real64 const adjQL = curQL + thisEnclosure.FloorArea * pulseMultipler; // ITABSF is the Inside Thermal Absorptance // EnclRadThermAbsMult is a multiplier for each zone // SurfQdotRadIntGainsInPerArea is the thermal radiation absorbed on inside surfaces state.dataHeatBal->SurfQdotRadIntGainsInPerArea(SurfNum) = - state.dataInternalHeatGains->adjQL * thisEnclosure.radThermAbsMult * state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum); + adjQL * thisEnclosure.radThermAbsMult * state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum); // store the magnitude and time of the pulse state.dataOutRptTab->radiantPulseTimestep(state.dataSize->CurOverallSimDay, zoneNum) = - (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; + (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->TimeStepsInHour + state.dataGlobal->TimeStep; state.dataOutRptTab->radiantPulseReceived(state.dataSize->CurOverallSimDay, SurfNum) = - (state.dataInternalHeatGains->adjQL - state.dataInternalHeatGains->curQL) * thisEnclosure.radThermAbsMult * - state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum) * state.dataSurface->Surface(SurfNum).Area; + (adjQL - curQL) * thisEnclosure.radThermAbsMult * state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum) * + state.dataSurface->Surface(SurfNum).Area; } } } @@ -7883,16 +7323,13 @@ namespace InternalHeatGains { // PURPOSE OF THIS SUBROUTINE: // This subroutine currently creates the values for standard "zone loads" reporting // from the heat balance module. - - // Using/Aliasing - - for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { - if (state.dataHeatBal->Zone(ZoneNum).HasAdjustedReturnTempByITE && state.dataHeatBal->Zone(ZoneNum).HasLtsRetAirGain) { + for (auto const &zone : state.dataHeatBal->Zone) { + if (zone.HasAdjustedReturnTempByITE && zone.HasLtsRetAirGain) { ShowFatalError(state, "Return air heat gains from lights are not allowed when Air Flow Calculation Method = " "FlowControlWithApproachTemperatures in zones with ITE objects."); } - if (state.dataHeatBal->Zone(ZoneNum).HasAdjustedReturnTempByITE && state.dataHeatBal->Zone(ZoneNum).HasAirFlowWindowReturn) { + if (zone.HasAdjustedReturnTempByITE && zone.HasAirFlowWindowReturn) { ShowFatalError(state, "Return air heat gains from windows are not allowed when Air Flow Calculation Method = " "FlowControlWithApproachTemperatures in zones with ITE objects."); @@ -7912,7 +7349,6 @@ namespace InternalHeatGains { // This broken into a separate subroutine, because the calculations are more detailed than the other // types of internal gains. - using ScheduleManager::GetCurrentScheduleValue; using namespace Psychrometrics; using Curve::CurveValue; using HVAC::SmallAirVolFlow; @@ -8046,10 +7482,10 @@ namespace InternalHeatGains { for (int Loop = 1; Loop <= state.dataHeatBal->TotITEquip; ++Loop) { // Get schedules int NZ = state.dataHeatBal->ZoneITEq(Loop).ZonePtr; - auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(NZ); + auto const &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(NZ); int spaceNum = state.dataHeatBal->ZoneITEq(Loop).spaceIndex; - OperSchedFrac = GetCurrentScheduleValue(state, state.dataHeatBal->ZoneITEq(Loop).OperSchedPtr); - CPULoadSchedFrac = GetCurrentScheduleValue(state, state.dataHeatBal->ZoneITEq(Loop).CPULoadSchedPtr); + OperSchedFrac = state.dataHeatBal->ZoneITEq(Loop).operSched->getCurrentVal(); + CPULoadSchedFrac = state.dataHeatBal->ZoneITEq(Loop).cpuLoadSched->getCurrentVal(); // Determine inlet air temperature and humidity AirConnection = state.dataHeatBal->ZoneITEq(Loop).AirConnectionType; @@ -8058,8 +7494,8 @@ namespace InternalHeatGains { if (state.dataHeatBal->ZoneITEq(Loop).FlowControlWithApproachTemps) { TSupply = state.dataLoopNodes->Node(SupplyNodeNum).Temp; WSupply = state.dataLoopNodes->Node(SupplyNodeNum).HumRat; - if (state.dataHeatBal->ZoneITEq(Loop).SupplyApproachTempSch != 0) { - TAirIn = TSupply + GetCurrentScheduleValue(state, state.dataHeatBal->ZoneITEq(Loop).SupplyApproachTempSch); + if (state.dataHeatBal->ZoneITEq(Loop).supplyApproachTempSched != nullptr) { + TAirIn = TSupply + state.dataHeatBal->ZoneITEq(Loop).supplyApproachTempSched->getCurrentVal(); } else { TAirIn = TSupply + state.dataHeatBal->ZoneITEq(Loop).SupplyApproachTemp; } @@ -8104,13 +7540,13 @@ namespace InternalHeatGains { if (state.dataGlobal->DoingSizing && state.dataHeatBal->ZoneITEq(Loop).FlowControlWithApproachTemps) { TAirInDesign = state.dataHeatBal->ZoneITEq(Loop).SizingTAirIn; - if (state.dataHeatBal->ZoneITEq(Loop).SupplyApproachTempSch != 0) { - TAirInDesign = TAirInDesign + GetCurrentScheduleValue(state, state.dataHeatBal->ZoneITEq(Loop).SupplyApproachTempSch); + if (state.dataHeatBal->ZoneITEq(Loop).supplyApproachTempSched != nullptr) { + TAirInDesign = TAirInDesign + state.dataHeatBal->ZoneITEq(Loop).supplyApproachTempSched->getCurrentVal(); } else { TAirInDesign = TAirInDesign + state.dataHeatBal->ZoneITEq(Loop).SupplyApproachTemp; } - OperSchedFrac = GetCurrentScheduleValue(state, state.dataHeatBal->ZoneITEq(Loop).OperSchedPtr); - CPULoadSchedFrac = GetCurrentScheduleValue(state, state.dataHeatBal->ZoneITEq(Loop).CPULoadSchedPtr); + OperSchedFrac = state.dataHeatBal->ZoneITEq(Loop).operSched->getCurrentVal(); + CPULoadSchedFrac = state.dataHeatBal->ZoneITEq(Loop).cpuLoadSched->getCurrentVal(); } CPUPower = max(state.dataHeatBal->ZoneITEq(Loop).DesignCPUPower * OperSchedFrac * @@ -8312,9 +7748,9 @@ namespace InternalHeatGains { totalGain = 0; totalRate = 0; for (int i : it->second) { - if (state.dataHeatBal->ZoneITEq(i).ReturnApproachTempSch != 0) { + if (state.dataHeatBal->ZoneITEq(i).returnApproachTempSched != nullptr) { TAirReturn = state.dataHeatBal->ZoneITEq(i).AirOutletDryBulbT + - GetCurrentScheduleValue(state, state.dataHeatBal->ZoneITEq(i).ReturnApproachTempSch); + state.dataHeatBal->ZoneITEq(i).returnApproachTempSched->getCurrentVal(); } else { TAirReturn = state.dataHeatBal->ZoneITEq(i).AirOutletDryBulbT + state.dataHeatBal->ZoneITEq(i).ReturnApproachTemp; } @@ -9121,8 +8557,9 @@ namespace InternalHeatGains { Real64 SumReturnAirConvectionGainsByTypes( EnergyPlusData &state, - int const ZoneNum, // zone index pointer for which zone to sum gains for - gsl::span GainTypeARR // variable length 1-d array of integer valued gain types + int const ZoneNum, // zone index pointer for which zone to sum gains for + gsl::span GainTypeARR, // variable length 1-d array of integer valued gain types + int const spaceIndex // space index pointer, sum gains only for this space ) { @@ -9138,16 +8575,27 @@ namespace InternalHeatGains { int NumberOfTypes = GainTypeARR.size(); - for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { - if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) { - continue; + // TODO MJW: This could be refactored to avoid duplicate code, but for now . . . . + if (spaceIndex > 0) { + for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceIndex).numberOfDevices; ++DeviceNum) { + for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) { + if (state.dataHeatBal->spaceIntGainDevices(spaceIndex).device(DeviceNum).CompType == GainTypeARR[TypeNum]) { + SumReturnAirGainRate += state.dataHeatBal->spaceIntGainDevices(spaceIndex).device(DeviceNum).ReturnAirConvGainRate; + } + } } + } else { + for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { + if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) { + continue; + } - for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) { - for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) { + for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) { + for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) { - if (state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompType == GainTypeARR[TypeNum]) { - SumReturnAirGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).ReturnAirConvGainRate; + if (state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompType == GainTypeARR[TypeNum]) { + SumReturnAirGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).ReturnAirConvGainRate; + } } } } @@ -9229,6 +8677,32 @@ namespace InternalHeatGains { return SumRadiationGainRate; } + Real64 SumEnclosureInternalRadiationGainsByTypes( + EnergyPlusData &state, + int const enclosureNum, // enclosure to sum gains for + gsl::span GainTypeARR) // variable length 1-d array of enum valued gain types + { + // Return value + Real64 SumRadiationGainRate(0.0); + + int NumberOfTypes = GainTypeARR.size(); + + for (int spaceNum : state.dataViewFactor->EnclRadInfo(enclosureNum).spaceNums) { + if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) { + continue; + } + for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) { + for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) { + if (state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompType == GainTypeARR[TypeNum]) { + SumRadiationGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).RadiantGainRate; + } + } + } + } + + return SumRadiationGainRate; + } + void SumAllInternalLatentGains(EnergyPlusData &state, int const ZoneNum // zone index pointer for which zone to sum gains for ) @@ -9459,7 +8933,7 @@ namespace InternalHeatGains { // DATE WRITTEN Feb. 2012 // PURPOSE OF THIS SUBROUTINE: - // worker routine for summing all the internal gain types based on the existing subrotine SumAllInternalCO2Gains + // worker routine for summing all the internal gain types based on the existing subroutine SumAllInternalCO2Gains // Return value Real64 SumGCGainRate(0.0); @@ -9494,120 +8968,57 @@ namespace InternalHeatGains { // Using/Aliasing using namespace DataHeatBalance; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - static constexpr std::array IntGainTypesPeople = {DataHeatBalance::IntGainType::People}; - static constexpr std::array IntGainTypesLight = {DataHeatBalance::IntGainType::Lights}; - static constexpr std::array IntGainTypesEquip = {DataHeatBalance::IntGainType::ElectricEquipment, - DataHeatBalance::IntGainType::ElectricEquipmentITEAirCooled, - DataHeatBalance::IntGainType::GasEquipment, - DataHeatBalance::IntGainType::HotWaterEquipment, - DataHeatBalance::IntGainType::SteamEquipment, - DataHeatBalance::IntGainType::OtherEquipment, - DataHeatBalance::IntGainType::IndoorGreen}; - static constexpr std::array IntGainTypesRefrig = { - DataHeatBalance::IntGainType::RefrigerationCase, - DataHeatBalance::IntGainType::RefrigerationCompressorRack, - DataHeatBalance::IntGainType::RefrigerationSystemAirCooledCondenser, - DataHeatBalance::IntGainType::RefrigerationSystemSuctionPipe, - DataHeatBalance::IntGainType::RefrigerationSecondaryReceiver, - DataHeatBalance::IntGainType::RefrigerationSecondaryPipe, - DataHeatBalance::IntGainType::RefrigerationWalkIn, - DataHeatBalance::IntGainType::RefrigerationTransSysAirCooledGasCooler, - DataHeatBalance::IntGainType::RefrigerationTransSysSuctionPipeMT, - DataHeatBalance::IntGainType::RefrigerationTransSysSuctionPipeLT}; - static constexpr std::array IntGainTypesWaterUse = {DataHeatBalance::IntGainType::WaterUseEquipment, - DataHeatBalance::IntGainType::WaterHeaterMixed, - DataHeatBalance::IntGainType::WaterHeaterStratified}; - static constexpr std::array IntGainTypesHvacLoss = { - DataHeatBalance::IntGainType::ZoneBaseboardOutdoorTemperatureControlled, - DataHeatBalance::IntGainType::ThermalStorageChilledWaterMixed, - DataHeatBalance::IntGainType::ThermalStorageChilledWaterStratified, - DataHeatBalance::IntGainType::PipeIndoor, - DataHeatBalance::IntGainType::Pump_VarSpeed, - DataHeatBalance::IntGainType::Pump_ConSpeed, - DataHeatBalance::IntGainType::Pump_Cond, - DataHeatBalance::IntGainType::PumpBank_VarSpeed, - DataHeatBalance::IntGainType::PumpBank_ConSpeed, - DataHeatBalance::IntGainType::PlantComponentUserDefined, - DataHeatBalance::IntGainType::CoilUserDefined, - DataHeatBalance::IntGainType::ZoneHVACForcedAirUserDefined, - DataHeatBalance::IntGainType::AirTerminalUserDefined, - DataHeatBalance::IntGainType::PackagedTESCoilTank, - DataHeatBalance::IntGainType::FanSystemModel, - DataHeatBalance::IntGainType::SecCoolingDXCoilSingleSpeed, - DataHeatBalance::IntGainType::SecHeatingDXCoilSingleSpeed, - DataHeatBalance::IntGainType::SecCoolingDXCoilTwoSpeed, - DataHeatBalance::IntGainType::SecCoolingDXCoilMultiSpeed, - DataHeatBalance::IntGainType::SecHeatingDXCoilMultiSpeed}; - static constexpr std::array IntGainTypesPowerGen = { - DataHeatBalance::IntGainType::GeneratorFuelCell, - DataHeatBalance::IntGainType::GeneratorMicroCHP, - DataHeatBalance::IntGainType::ElectricLoadCenterTransformer, - DataHeatBalance::IntGainType::ElectricLoadCenterInverterSimple, - DataHeatBalance::IntGainType::ElectricLoadCenterInverterFunctionOfPower, - DataHeatBalance::IntGainType::ElectricLoadCenterInverterLookUpTable, - DataHeatBalance::IntGainType::ElectricLoadCenterStorageLiIonNmcBattery, - DataHeatBalance::IntGainType::ElectricLoadCenterStorageBattery, - DataHeatBalance::IntGainType::ElectricLoadCenterStorageSimple, - DataHeatBalance::IntGainType::ElectricLoadCenterConverter}; - // Explicitly list internal gains not gathered here - static constexpr std::array ExcludedIntGainTypes = { - DataHeatBalance::IntGainType::ZoneContaminantSourceAndSinkCarbonDioxide, - DataHeatBalance::IntGainType::DaylightingDeviceTubular, - DataHeatBalance::IntGainType::ZoneContaminantSourceAndSinkGenericContam}; + if (state.dataGlobal->CompLoadReportIsReq && !state.dataGlobal->isPulseZoneSizing) { + int TimeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->TimeStepsInHour + state.dataGlobal->TimeStep; + for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { + auto &znCLDayTS = state.dataOutRptTab->znCompLoads[state.dataSize->CurOverallSimDay - 1].ts[TimeStepInDay - 1].spacezone[iZone - 1]; + gatherCompLoadIntGain2(state, znCLDayTS, iZone); + } + for (int iEncl = 1; iEncl <= state.dataViewFactor->NumOfRadiantEnclosures; ++iEncl) { + auto &enclCLDayTS = state.dataOutRptTab->enclCompLoads[state.dataSize->CurOverallSimDay - 1].ts[TimeStepInDay - 1].encl[iEncl - 1]; + enclCLDayTS.peopleRadSeq = SumEnclosureInternalRadiationGainsByTypes(state, iEncl, IntGainTypesPeople); + enclCLDayTS.lightLWRadSeq = SumEnclosureInternalRadiationGainsByTypes(state, iEncl, IntGainTypesLight); + enclCLDayTS.equipRadSeq = SumEnclosureInternalRadiationGainsByTypes(state, iEncl, IntGainTypesEquip); + enclCLDayTS.hvacLossRadSeq = SumEnclosureInternalRadiationGainsByTypes(state, iEncl, IntGainTypesHvacLoss); + enclCLDayTS.powerGenRadSeq = SumEnclosureInternalRadiationGainsByTypes(state, iEncl, IntGainTypesPowerGen); + } + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + for (int iSpace = 1; iSpace <= state.dataGlobal->NumOfZones; ++iSpace) { + auto &spCLDayTS = + state.dataOutRptTab->spCompLoads[state.dataSize->CurOverallSimDay - 1].ts[TimeStepInDay - 1].spacezone[iSpace - 1]; + gatherCompLoadIntGain2(state, spCLDayTS, state.dataHeatBal->space(iSpace).zoneNum, iSpace); + } + } + } + } + void + gatherCompLoadIntGain2(EnergyPlusData &state, OutputReportTabular::compLoadsSpaceZone &szCompLoadDayTS, int const zoneNum, int const spaceNum) + { // Make sure all types of internal gains have been gathered assert((int)(size(IntGainTypesPeople) + size(IntGainTypesLight) + size(IntGainTypesEquip) + size(IntGainTypesRefrig) + size(IntGainTypesWaterUse) + size(IntGainTypesHvacLoss) + size(IntGainTypesPowerGen) + size(ExcludedIntGainTypes)) == (int)DataHeatBalance::IntGainType::Num); - if (state.dataGlobal->CompLoadReportIsReq && !state.dataGlobal->isPulseZoneSizing) { - int TimeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; - for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { - state.dataOutRptTab->peopleInstantSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalConvectionGainsByTypes(state, iZone, IntGainTypesPeople); - state.dataOutRptTab->peopleLatentSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalLatentGainsByTypes(state, iZone, IntGainTypesPeople); - state.dataOutRptTab->peopleRadSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalRadiationGainsByTypes(state, iZone, IntGainTypesPeople); - - state.dataOutRptTab->lightInstantSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalConvectionGainsByTypes(state, iZone, IntGainTypesLight); - state.dataOutRptTab->lightRetAirSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumReturnAirConvectionGainsByTypes(state, iZone, IntGainTypesLight); - state.dataOutRptTab->lightLWRadSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalRadiationGainsByTypes(state, iZone, IntGainTypesLight); - - state.dataOutRptTab->equipInstantSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalConvectionGainsByTypes(state, iZone, IntGainTypesEquip); - state.dataOutRptTab->equipLatentSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalLatentGainsByTypes(state, iZone, IntGainTypesEquip); - state.dataOutRptTab->equipRadSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalRadiationGainsByTypes(state, iZone, IntGainTypesEquip); - - state.dataOutRptTab->refrigInstantSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalConvectionGainsByTypes(state, iZone, IntGainTypesRefrig); - state.dataOutRptTab->refrigRetAirSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumReturnAirConvectionGainsByTypes(state, iZone, IntGainTypesRefrig); - state.dataOutRptTab->refrigLatentSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalLatentGainsByTypes(state, iZone, IntGainTypesRefrig); - - state.dataOutRptTab->waterUseInstantSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalConvectionGainsByTypes(state, iZone, IntGainTypesWaterUse); - state.dataOutRptTab->waterUseLatentSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalLatentGainsByTypes(state, iZone, IntGainTypesWaterUse); - - state.dataOutRptTab->hvacLossInstantSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalConvectionGainsByTypes(state, iZone, IntGainTypesHvacLoss); - state.dataOutRptTab->hvacLossRadSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalRadiationGainsByTypes(state, iZone, IntGainTypesHvacLoss); - - state.dataOutRptTab->powerGenInstantSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalConvectionGainsByTypes(state, iZone, IntGainTypesPowerGen); - state.dataOutRptTab->powerGenRadSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalRadiationGainsByTypes(state, iZone, IntGainTypesPowerGen); - } - } + szCompLoadDayTS.peopleInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesPeople, spaceNum); + szCompLoadDayTS.peopleLatentSeq = SumInternalLatentGainsByTypes(state, zoneNum, IntGainTypesPeople, spaceNum); + + szCompLoadDayTS.lightInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesLight, spaceNum); + szCompLoadDayTS.lightRetAirSeq = SumReturnAirConvectionGainsByTypes(state, zoneNum, IntGainTypesLight, spaceNum); + + szCompLoadDayTS.equipInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesEquip, spaceNum); + szCompLoadDayTS.equipLatentSeq = SumInternalLatentGainsByTypes(state, zoneNum, IntGainTypesEquip, spaceNum); + + szCompLoadDayTS.refrigInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesRefrig, spaceNum); + szCompLoadDayTS.refrigRetAirSeq = SumReturnAirConvectionGainsByTypes(state, zoneNum, IntGainTypesRefrig, spaceNum); + szCompLoadDayTS.refrigLatentSeq = SumInternalLatentGainsByTypes(state, zoneNum, IntGainTypesRefrig, spaceNum); + + szCompLoadDayTS.waterUseInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesWaterUse, spaceNum); + szCompLoadDayTS.waterUseLatentSeq = SumInternalLatentGainsByTypes(state, zoneNum, IntGainTypesWaterUse, spaceNum); + + szCompLoadDayTS.hvacLossInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesHvacLoss, spaceNum); + + szCompLoadDayTS.powerGenInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesPowerGen, spaceNum); } int GetInternalGainDeviceIndex(EnergyPlusData &state, @@ -9739,7 +9150,6 @@ namespace InternalHeatGains { } return sumReturnAirGainRate; } - } // namespace InternalHeatGains } // namespace EnergyPlus diff --git a/src/EnergyPlus/InternalHeatGains.hh b/src/EnergyPlus/InternalHeatGains.hh index a44469c5e89..b0f78156a4c 100644 --- a/src/EnergyPlus/InternalHeatGains.hh +++ b/src/EnergyPlus/InternalHeatGains.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -55,6 +55,7 @@ // EnergyPlus Headers #include #include +#include #include namespace EnergyPlus { @@ -166,9 +167,9 @@ namespace InternalHeatGains { Real64 SumReturnAirConvectionGainsByTypes( EnergyPlusData &state, - int const ZoneNum, // zone index pointer for which zone to sum gains for - gsl::span GainTypeARR // variable length 1-d array of enum valued gain types - ); + int const ZoneNum, // zone index pointer for which zone to sum gains for + gsl::span GainTypeARR, // variable length 1-d array of enum valued gain types + int const spaceIndex = 0); // space index pointer, sum gains only for this space Real64 SumAllSpaceInternalRadiationGains(EnergyPlusData &state, int const SpaceNum // space index pointer for which space to sum gains for @@ -180,6 +181,11 @@ namespace InternalHeatGains { gsl::span GainTypeARR, // variable length 1-d array of enum valued gain types int const spaceIndex = 0); // space index pointer, sum gains only for this space + Real64 SumEnclosureInternalRadiationGainsByTypes( + EnergyPlusData &state, + int const enclosureNum, // enclosure to sum gains for + gsl::span GainTypeARR); // variable length 1-d array of enum valued gain types + void SumAllInternalLatentGains(EnergyPlusData &state, int const ZoneNum // zone index pointer for which zone to sum gains for ); @@ -221,6 +227,11 @@ namespace InternalHeatGains { void GatherComponentLoadsIntGain(EnergyPlusData &state); + void gatherCompLoadIntGain2(EnergyPlusData &state, + OutputReportTabular::compLoadsSpaceZone &szCompLoadDayTS, + int const zoneNum, + int const spaceNum = 0); + } // namespace InternalHeatGains struct InternalHeatGainsData : BaseGlobalStruct @@ -229,31 +240,22 @@ struct InternalHeatGainsData : BaseGlobalStruct bool GetInternalHeatGainsInputFlag = true; // Controls the GET routine calling (limited to first time) bool ErrorsFound = false; // if errors were found in the input - // static variables extracted from functions - bool UsingThermalComfort = false; - Real64 sumArea = 0.0; - Real64 sumPower = 0.0; - Real64 curQL = 0.0; // radiant value prior to adjustment for pulse for load component report - Real64 adjQL = 0.0; // radiant value including adjustment for pulse for load component report - // Declared here because they are needed later for the demand manager, other types of internal gain inputs are local EPVector lightsObjects; EPVector zoneElectricObjects; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } void clear_state() override { - this->GetInternalHeatGainsInputFlag = true; this->ErrorsFound = false; - this->UsingThermalComfort = false; - this->sumArea = 0.0; - this->sumPower = 0.0; - this->curQL = 0.0; - this->adjQL = 0.0; } }; diff --git a/src/EnergyPlus/LowTempRadiantSystem.cc b/src/EnergyPlus/LowTempRadiantSystem.cc index ed815c3fcc1..254cb1adbd7 100644 --- a/src/EnergyPlus/LowTempRadiantSystem.cc +++ b/src/EnergyPlus/LowTempRadiantSystem.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -128,7 +128,7 @@ namespace LowTempRadiantSystem { // (b) constant flow, variable controlled temperature heating/cooling radiant // system; (c) electric resistance heating radiant system. Systems (a) and // (b) are hydronic systems--one which varies hydronic flow as the key control - // paramter (a) and one which varies the inlet hydronic temperature while + // parameter (a) and one which varies the inlet hydronic temperature while // keeping the flow rate through the radiant system constant (b). In system // (b), the injection rate from the main water loop is varied to obtain the // proper inlet temperature. @@ -146,7 +146,6 @@ namespace LowTempRadiantSystem { constexpr std::string_view cConstantFlowSystem("ZoneHVAC:LowTemperatureRadiant:ConstantFlow"); constexpr std::string_view OnePerSurf("OnePerSurface"); constexpr std::string_view CalcFromLength("CalculateFromCircuitLength"); - constexpr std::string_view fluidNameWater("WATER"); // DERIVED TYPE DEFINITIONS: @@ -274,12 +273,13 @@ namespace LowTempRadiantSystem { using DataSizing::HeatingDesignCapacity; using NodeInputManager::GetOnlySingleNode; - using ScheduleManager::GetScheduleIndex; using namespace DataLoopNode; using namespace DataSurfaceLists; // SUBROUTINE PARAMETER DEFINITIONS: constexpr std::string_view RoutineName("GetLowTempRadiantSystem: "); // include trailing blank space + constexpr std::string_view routineName = "GetLowTempRadiantSystem"; + constexpr std::string_view Off("Off"); constexpr std::string_view SimpleOff("SimpleOff"); constexpr std::string_view VariableOff("VariableOff"); @@ -288,7 +288,7 @@ namespace LowTempRadiantSystem { int constexpr iHeatCapacityPerFloorAreaNumericNum( 2); // get input index to Low Temperature Radiant system electric heating capacity per floor area sizing int constexpr iHeatFracOfAutosizedCapacityNumericNum( - 3); // get input index to Low Temperature Radiant system electric heating capacity sizing as fraction of autozized heating capacity + 3); // get input index to Low Temperature Radiant system electric heating capacity sizing as fraction of autosized heating capacity // SUBROUTINE LOCAL VARIABLE DECLARATIONS: std::string CurrentModuleObject; // for ease in getting objects @@ -298,7 +298,6 @@ namespace LowTempRadiantSystem { Array1D_bool AssignedAsRadiantSurface; // Set to true when a surface is part of a radiant system int CheckSurfNum; // Surface number to check to see if it has already been used by a radiant system bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine - int GlycolIndex; // Index of 'Water' in glycol data structure int IOStatus; // Used in GetObjectItem int Item; // Item to be "gotten" int MaxAlphas; // Maximum number of alphas for these input keywords @@ -375,30 +374,26 @@ namespace LowTempRadiantSystem { state.dataLowTempRadSys->HydrRadSys.allocate(state.dataLowTempRadSys->NumOfHydrLowTempRadSys); if (state.dataLowTempRadSys->NumOfHydrLowTempRadSys > 0) { - GlycolIndex = FluidProperties::GetGlycolNum(state, fluidNameWater); - for (auto &e : state.dataLowTempRadSys->HydrRadSys) - e.GlycolIndex = GlycolIndex; - if (GlycolIndex == 0) { + auto *water = Fluid::GetWater(state); + if (water == nullptr) { ShowSevereError(state, "Hydronic radiant systems: no water property data found in input"); ErrorsFound = true; } - } else { + for (auto &e : state.dataLowTempRadSys->HydrRadSys) - e.GlycolIndex = 0; + e.water = water; } state.dataLowTempRadSys->CFloRadSys.allocate(state.dataLowTempRadSys->NumOfCFloLowTempRadSys); if (state.dataLowTempRadSys->NumOfCFloLowTempRadSys > 0) { - GlycolIndex = FluidProperties::GetGlycolNum(state, fluidNameWater); - for (auto &e : state.dataLowTempRadSys->CFloRadSys) - e.GlycolIndex = GlycolIndex; - if (GlycolIndex == 0) { + auto *water = Fluid::GetWater(state); + if (water == nullptr) { ShowSevereError(state, "Constant flow radiant systems: no water property data found in input"); ErrorsFound = true; } - } else { + for (auto &e : state.dataLowTempRadSys->CFloRadSys) - e.GlycolIndex = 0; + e.water = water; } state.dataLowTempRadSys->ElecRadSys.allocate(state.dataLowTempRadSys->NumOfElecLowTempRadSys); @@ -431,6 +426,8 @@ namespace LowTempRadiantSystem { cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + state.dataLowTempRadSys->HydronicRadiantSysDesign(Item).FieldNames.allocate(NumNumbers); state.dataLowTempRadSys->HydronicRadiantSysDesign(Item).FieldNames = ""; state.dataLowTempRadSys->HydronicRadiantSysDesign(Item).FieldNames = cNumericFields; @@ -506,11 +503,9 @@ namespace LowTempRadiantSystem { thisRadSysDesign.HotThrottlRange = Numbers(6); - thisRadSysDesign.HotSetptSched = Alphas(6); - thisRadSysDesign.HotSetptSchedPtr = GetScheduleIndex(state, thisRadSysDesign.HotSetptSched); - if ((thisRadSysDesign.HotSetptSchedPtr == 0) && (!lAlphaBlanks(6))) { - ShowSevereError(state, format("{} not found: {}", cAlphaFields(6), Alphas(6))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, Alphas(1))); + if (lAlphaBlanks(6)) { + } else if ((thisRadSysDesign.heatSetptSched = Sched::GetSchedule(state, Alphas(6))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(6), Alphas(6)); ErrorsFound = true; } @@ -562,11 +557,9 @@ namespace LowTempRadiantSystem { thisRadSysDesign.ColdThrottlRange = Numbers(9); - thisRadSysDesign.ColdSetptSched = Alphas(8); - thisRadSysDesign.ColdSetptSchedPtr = GetScheduleIndex(state, Alphas(8)); - if ((thisRadSysDesign.ColdSetptSchedPtr == 0) && (!lAlphaBlanks(8))) { - ShowSevereError(state, format("{} not found: {}", cAlphaFields(8), Alphas(8))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, Alphas(1))); + if (lAlphaBlanks(8)) { + } else if ((thisRadSysDesign.coolSetptSched = Sched::GetSchedule(state, Alphas(8))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(8), Alphas(8)); ErrorsFound = true; } @@ -582,14 +575,9 @@ namespace LowTempRadiantSystem { thisRadSysDesign.CondDewPtDeltaT = Numbers(10); - thisRadSysDesign.schedNameChangeoverDelay = Alphas(10); - if (!lAlphaBlanks(10)) { - thisRadSysDesign.schedPtrChangeoverDelay = GetScheduleIndex(state, thisRadSysDesign.schedNameChangeoverDelay); - if (thisRadSysDesign.schedPtrChangeoverDelay == 0) { - ShowWarningError(state, format("{} not found for {}", cAlphaFields(10), thisRadSysDesign.schedNameChangeoverDelay)); - ShowContinueError(state, format("This occurs for {} = {}", cAlphaFields(1), Alphas(1))); - ShowContinueError(state, "As a result, no changeover delay will be used for this radiant system."); - } + if (lAlphaBlanks(10)) { + } else if ((thisRadSysDesign.changeoverDelaySched = Sched::GetSchedule(state, Alphas(10))) == nullptr) { + ShowWarningItemNotFound(state, eoh, cAlphaFields(10), Alphas(10), "No changeover delay will be used for this radiant system."); } VarFlowRadDesignNames(Item) = Alphas(1); @@ -613,6 +601,8 @@ namespace LowTempRadiantSystem { cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + state.dataLowTempRadSys->HydronicRadiantSysNumericFields(Item).FieldNames.allocate(NumNumbers); state.dataLowTempRadSys->HydronicRadiantSysNumericFields(Item).FieldNames = ""; state.dataLowTempRadSys->HydronicRadiantSysNumericFields(Item).FieldNames = cNumericFields; @@ -633,16 +623,11 @@ namespace LowTempRadiantSystem { VarFlowRadDesignData variableFlowDesignDataObject{state.dataLowTempRadSys->HydronicRadiantSysDesign( thisRadSys.DesignObjectPtr)}; // Contains the data for variable flow hydronic systems - thisRadSys.SchedName = Alphas(3); if (lAlphaBlanks(3)) { - thisRadSys.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisRadSys.SchedPtr = GetScheduleIndex(state, Alphas(3)); - if (thisRadSys.SchedPtr == 0) { - ShowSevereError(state, format("{} not found for {}", cAlphaFields(2), Alphas(1))); - ShowContinueError(state, format("Missing {} is {}", cAlphaFields(3), Alphas(3))); - ErrorsFound = true; - } + thisRadSys.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisRadSys.availSched = Sched::GetSchedule(state, Alphas(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(3), Alphas(3)); + ErrorsFound = true; } thisRadSys.ZoneName = Alphas(4); @@ -757,7 +742,7 @@ namespace LowTempRadiantSystem { } if ((thisRadSys.WaterVolFlowMaxHeat == AutoSize) && (lAlphaBlanks(6) || lAlphaBlanks(7) || (thisRadSys.HotWaterInNode <= 0) || (thisRadSys.HotWaterOutNode <= 0) || - (variableFlowDesignDataObject.HotSetptSchedPtr == 0))) { + (variableFlowDesignDataObject.heatSetptSched == nullptr))) { ShowSevereError(state, "Hydronic radiant systems may not be autosized without specification of nodes or schedules."); ShowContinueError(state, format("Occurs in {} (heating input) = {}", CurrentModuleObject, Alphas(1))); ErrorsFound = true; @@ -824,13 +809,14 @@ namespace LowTempRadiantSystem { thisRadSys.NumCircCalcMethod = CircuitCalc::OneCircuit; } - thisRadSys.schedPtrChangeoverDelay = variableFlowDesignDataObject.schedPtrChangeoverDelay; + thisRadSys.changeoverDelaySched = variableFlowDesignDataObject.changeoverDelaySched; thisRadSys.CircLength = Numbers(6); if ((thisRadSys.WaterVolFlowMaxCool == AutoSize) && (variableFlowDesignDataObject.DesignCoolingCapMethod == 0 || lAlphaBlanks(8) || lAlphaBlanks(9) || - (thisRadSys.ColdWaterInNode <= 0) || (thisRadSys.ColdWaterOutNode <= 0) || (variableFlowDesignDataObject.ColdSetptSchedPtr == 0))) { + (thisRadSys.ColdWaterInNode <= 0) || (thisRadSys.ColdWaterOutNode <= 0) || + (variableFlowDesignDataObject.coolSetptSched == nullptr))) { ShowSevereError(state, "Hydronic radiant systems may not be autosized without specification of nodes or schedules"); ShowContinueError(state, format("Occurs in {} (cooling input) ={}", CurrentModuleObject, Alphas(1))); ErrorsFound = true; @@ -854,6 +840,8 @@ namespace LowTempRadiantSystem { cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + state.dataLowTempRadSys->CflowRadiantSysDesign(Item).FieldNames.allocate(NumNumbers); state.dataLowTempRadSys->CflowRadiantSysDesign(Item).FieldNames = ""; state.dataLowTempRadSys->CflowRadiantSysDesign(Item).FieldNames = cNumericFields; @@ -889,14 +877,9 @@ namespace LowTempRadiantSystem { } thisRadSysDesign.CondDewPtDeltaT = Numbers(7); - thisRadSysDesign.schedNameChangeoverDelay = Alphas(5); - if (!lAlphaBlanks(5)) { - thisRadSysDesign.schedPtrChangeoverDelay = GetScheduleIndex(state, thisRadSysDesign.schedNameChangeoverDelay); - if (thisRadSysDesign.schedPtrChangeoverDelay == 0) { - ShowWarningError(state, format("{} not found for {}", cAlphaFields(5), thisRadSysDesign.schedNameChangeoverDelay)); - ShowContinueError(state, format("This occurs for {} = {}", cAlphaFields(1), Alphas(1))); - ShowContinueError(state, "As a result, no changeover delay will be used for this radiant system."); - } + if (lAlphaBlanks(5)) { + } else if ((thisRadSysDesign.changeoverDelaySched = Sched::GetSchedule(state, Alphas(5))) == nullptr) { + ShowWarningItemNotFound(state, eoh, cAlphaFields(5), Alphas(5), "No changeover delay will be used for this radiant system."); } CFlowRadDesignNames(Item) = Alphas(1); } @@ -917,6 +900,9 @@ namespace LowTempRadiantSystem { lAlphaBlanks, cAlphaFields, cNumericFields); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + GlobalNames::VerifyUniqueInterObjectName( state, state.dataLowTempRadSys->LowTempRadUniqueNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); ++BaseNum; @@ -932,16 +918,11 @@ namespace LowTempRadiantSystem { ConstantFlowRadDesignData ConstantFlowRadDesignDataObject{ state.dataLowTempRadSys->CflowRadiantSysDesign(thisCFloSys.DesignObjectPtr)}; // Contains the data for variable flow hydronic systems - thisCFloSys.SchedName = Alphas(3); if (lAlphaBlanks(3)) { - thisCFloSys.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisCFloSys.SchedPtr = GetScheduleIndex(state, Alphas(3)); - if (thisCFloSys.SchedPtr == 0) { - ShowSevereError(state, format("{} not found for {}", cAlphaFields(3), Alphas(1))); - ShowContinueError(state, format("Missing {} is {}", cAlphaFields(3), Alphas(3))); - ErrorsFound = true; - } + thisCFloSys.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisCFloSys.availSched = Sched::GetSchedule(state, Alphas(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(3), Alphas(3)); + ErrorsFound = true; } thisCFloSys.ZoneName = Alphas(4); @@ -1007,11 +988,10 @@ namespace LowTempRadiantSystem { // Process pump input for constant flow (hydronic) radiant system thisCFloSys.WaterVolFlowMax = Numbers(2); - thisCFloSys.VolFlowSched = Alphas(6); - thisCFloSys.VolFlowSchedPtr = GetScheduleIndex(state, thisCFloSys.VolFlowSched); - if ((thisCFloSys.VolFlowSchedPtr == 0) && (!lAlphaBlanks(6))) { - ShowSevereError(state, format("{} not found: {}", cAlphaFields(6), Alphas(6))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, Alphas(1))); + + if (lAlphaBlanks(6)) { + } else if ((thisCFloSys.volFlowSched = Sched::GetSchedule(state, Alphas(6))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(6), Alphas(6)); ErrorsFound = true; } thisCFloSys.NomPumpHead = Numbers(3); @@ -1042,35 +1022,28 @@ namespace LowTempRadiantSystem { TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(7), Alphas(8), "Hot Water Nodes"); } - thisCFloSys.HotWaterHiTempSched = Alphas(9); - thisCFloSys.HotWaterHiTempSchedPtr = GetScheduleIndex(state, Alphas(9)); - if ((thisCFloSys.HotWaterHiTempSchedPtr == 0) && (!lAlphaBlanks(9))) { - ShowSevereError(state, format("{} not found: {}", cAlphaFields(9), Alphas(9))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, Alphas(1))); + if (lAlphaBlanks(9)) { + } else if ((thisCFloSys.hotWaterHiTempSched = Sched::GetSchedule(state, Alphas(9))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(9), Alphas(9)); ErrorsFound = true; } - thisCFloSys.HotWaterLoTempSched = Alphas(10); - thisCFloSys.HotWaterLoTempSchedPtr = GetScheduleIndex(state, Alphas(10)); - if ((thisCFloSys.HotWaterLoTempSchedPtr == 0) && (!lAlphaBlanks(10))) { - ShowSevereError(state, format("{} not found: {}", cAlphaFields(10), Alphas(10))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, Alphas(1))); + if (lAlphaBlanks(10)) { + } else if ((thisCFloSys.hotWaterLoTempSched = Sched::GetSchedule(state, Alphas(10))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(10), Alphas(10)); ErrorsFound = true; } - thisCFloSys.HotCtrlHiTempSched = Alphas(11); - thisCFloSys.HotCtrlHiTempSchedPtr = GetScheduleIndex(state, Alphas(11)); - if ((thisCFloSys.HotCtrlHiTempSchedPtr == 0) && (!lAlphaBlanks(11))) { - ShowSevereError(state, format("{} not found: {}", cAlphaFields(11), Alphas(11))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, Alphas(1))); + // This may look like a weird thing to do, but it's equivalent to a nested if and also uses less nesting + if (lAlphaBlanks(11)) { + } else if ((thisCFloSys.hotCtrlHiTempSched = Sched::GetSchedule(state, Alphas(11))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(11), Alphas(11)); ErrorsFound = true; } - thisCFloSys.HotCtrlLoTempSched = Alphas(12); - thisCFloSys.HotCtrlLoTempSchedPtr = GetScheduleIndex(state, Alphas(12)); - if ((thisCFloSys.HotCtrlLoTempSchedPtr == 0) && (!lAlphaBlanks(12))) { - ShowSevereError(state, format("{} not found: {}", cAlphaFields(12), Alphas(12))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, Alphas(1))); + if (lAlphaBlanks(12)) { + } else if ((thisCFloSys.hotCtrlLoTempSched = Sched::GetSchedule(state, Alphas(12))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(12), Alphas(12)); ErrorsFound = true; } @@ -1099,35 +1072,27 @@ namespace LowTempRadiantSystem { TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(13), Alphas(14), "Chilled Water Nodes"); } - thisCFloSys.ColdWaterHiTempSched = Alphas(15); - thisCFloSys.ColdWaterHiTempSchedPtr = GetScheduleIndex(state, Alphas(15)); - if ((thisCFloSys.ColdWaterHiTempSchedPtr == 0) && (!lAlphaBlanks(15))) { - ShowSevereError(state, format("{} not found: {}", cAlphaFields(15), Alphas(15))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, Alphas(1))); + if (lAlphaBlanks(15)) { + } else if ((thisCFloSys.coldWaterHiTempSched = Sched::GetSchedule(state, Alphas(15))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(15), Alphas(15)); ErrorsFound = true; } - thisCFloSys.ColdWaterLoTempSched = Alphas(16); - thisCFloSys.ColdWaterLoTempSchedPtr = GetScheduleIndex(state, Alphas(16)); - if ((thisCFloSys.ColdWaterLoTempSchedPtr == 0) && (!lAlphaBlanks(16))) { - ShowSevereError(state, format("{} not found: {}", cAlphaFields(16), Alphas(16))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, Alphas(1))); + if (lAlphaBlanks(16)) { + } else if ((thisCFloSys.coldWaterLoTempSched = Sched::GetSchedule(state, Alphas(16))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(16), Alphas(16)); ErrorsFound = true; } - thisCFloSys.ColdCtrlHiTempSched = Alphas(17); - thisCFloSys.ColdCtrlHiTempSchedPtr = GetScheduleIndex(state, Alphas(17)); - if ((thisCFloSys.ColdCtrlHiTempSchedPtr == 0) && (!lAlphaBlanks(17))) { - ShowSevereError(state, format("{} not found: {}", cAlphaFields(17), Alphas(17))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, Alphas(1))); + if (lAlphaBlanks(17)) { + } else if ((thisCFloSys.coldCtrlHiTempSched = Sched::GetSchedule(state, Alphas(17))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(17), Alphas(17)); ErrorsFound = true; } - thisCFloSys.ColdCtrlLoTempSched = Alphas(18); - thisCFloSys.ColdCtrlLoTempSchedPtr = GetScheduleIndex(state, Alphas(18)); - if ((thisCFloSys.ColdCtrlLoTempSchedPtr == 0) && (!lAlphaBlanks(18))) { - ShowSevereError(state, format("{} not found: {}", cAlphaFields(19), Alphas(18))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, Alphas(1))); + if (lAlphaBlanks(18)) { + } else if ((thisCFloSys.coldCtrlLoTempSched = Sched::GetSchedule(state, Alphas(18))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(18), Alphas(18)); ErrorsFound = true; } @@ -1139,7 +1104,7 @@ namespace LowTempRadiantSystem { thisCFloSys.NumCircCalcMethod = CircuitCalc::OneCircuit; } - thisCFloSys.schedPtrChangeoverDelay = ConstantFlowRadDesignDataObject.schedPtrChangeoverDelay; + thisCFloSys.changeoverDelaySched = ConstantFlowRadDesignDataObject.changeoverDelaySched; thisCFloSys.CircLength = Numbers(5); } @@ -1162,6 +1127,8 @@ namespace LowTempRadiantSystem { cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + state.dataLowTempRadSys->ElecRadSysNumericFields(Item).FieldNames.allocate(NumNumbers); state.dataLowTempRadSys->ElecRadSysNumericFields(Item).FieldNames = ""; state.dataLowTempRadSys->ElecRadSysNumericFields(Item).FieldNames = cNumericFields; @@ -1177,16 +1144,11 @@ namespace LowTempRadiantSystem { thisElecSys.Name = Alphas(1); - thisElecSys.SchedName = Alphas(2); if (lAlphaBlanks(2)) { - thisElecSys.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisElecSys.SchedPtr = GetScheduleIndex(state, Alphas(2)); - if (thisElecSys.SchedPtr == 0) { - ShowSevereError(state, format("{} not found for{}", cAlphaFields(2), Alphas(1))); - ShowContinueError(state, format("Incorrect {} = {}", cAlphaFields(2), Alphas(2))); - ErrorsFound = true; - } + thisElecSys.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisElecSys.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } thisElecSys.ZoneName = Alphas(3); @@ -1317,15 +1279,11 @@ namespace LowTempRadiantSystem { thisElecSys.ThrottlRange = Numbers(4); - thisElecSys.SetptSched = Alphas(8); - thisElecSys.SetptSchedPtr = GetScheduleIndex(state, Alphas(8)); - if (thisElecSys.SetptSchedPtr == 0) { - if (lAlphaBlanks(8)) { - ShowSevereError(state, format("{} must be input, missing for {}", cAlphaFields(8), Alphas(1))); - } else { - ShowSevereError(state, format("{} not found for {}", cAlphaFields(8), Alphas(8))); - ShowContinueError(state, format("Incorrect {} = {}", cAlphaFields(8), Alphas(8))); - } + if (lAlphaBlanks(8)) { + ShowSevereEmptyField(state, eoh, cAlphaFields(8)); + ErrorsFound = true; + } else if ((thisElecSys.setptSched = Sched::GetSchedule(state, Alphas(8))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(8), Alphas(8)); ErrorsFound = true; } } @@ -1902,12 +1860,10 @@ namespace LowTempRadiantSystem { using DataSizing::AutoSize; using DataZoneEquipment::CheckZoneEquipmentList; - using FluidProperties::GetDensityGlycol; using PlantUtilities::InitComponentNodes; using PlantUtilities::ScanPlantLoopsForObject; using PlantUtilities::SetComponentFlowRate; - using ScheduleManager::GetCurrentScheduleValue; // SUBROUTINE PARAMETER DEFINITIONS: Real64 constexpr ZeroTol(0.0000001); // Smallest non-zero value allowed @@ -2141,35 +2097,32 @@ namespace LowTempRadiantSystem { SizeLowTempRadiantSystem(state, RadSysNum, SystemType); state.dataLowTempRadSys->MySizeFlagHydr(RadSysNum) = false; - int ColdSetptSchedPtr(0), HotSetptSchedPtr(0); + Sched::Schedule *coldSetptSched = nullptr, *hotSetptSched = nullptr; if (SystemType == LowTempRadiantSystem::SystemType::HydronicSystem) { VarFlowRadDesignData variableFlowDesignDataObject{state.dataLowTempRadSys->HydronicRadiantSysDesign( state.dataLowTempRadSys->HydrRadSys(RadSysNum).DesignObjectPtr)}; // Contains the data for variable flow hydronic systems; - ColdSetptSchedPtr = variableFlowDesignDataObject.ColdSetptSchedPtr; - HotSetptSchedPtr = variableFlowDesignDataObject.HotSetptSchedPtr; + coldSetptSched = variableFlowDesignDataObject.coolSetptSched; + hotSetptSched = variableFlowDesignDataObject.heatSetptSched; } // Can this system actually do cooling? if ((state.dataLowTempRadSys->HydrRadSys(RadSysNum).WaterVolFlowMaxCool > 0.0) && (state.dataLowTempRadSys->HydrRadSys(RadSysNum).ColdWaterInNode > 0) && - (state.dataLowTempRadSys->HydrRadSys(RadSysNum).ColdWaterOutNode > 0) && ColdSetptSchedPtr > 0) { + (state.dataLowTempRadSys->HydrRadSys(RadSysNum).ColdWaterOutNode > 0) && (coldSetptSched != nullptr)) { state.dataLowTempRadSys->HydrRadSys(RadSysNum).CoolingSystem = true; } // Can this system actually do heating? if ((state.dataLowTempRadSys->HydrRadSys(RadSysNum).WaterVolFlowMaxHeat > 0.0) && (state.dataLowTempRadSys->HydrRadSys(RadSysNum).HotWaterInNode > 0) && - (state.dataLowTempRadSys->HydrRadSys(RadSysNum).HotWaterOutNode > 0) && (HotSetptSchedPtr > 0)) { + (state.dataLowTempRadSys->HydrRadSys(RadSysNum).HotWaterOutNode > 0) && (hotSetptSched != nullptr)) { state.dataLowTempRadSys->HydrRadSys(RadSysNum).HeatingSystem = true; } // set design mass flow rates if (state.dataLowTempRadSys->HydrRadSys(RadSysNum).HotWaterInNode > 0) { - rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(state.dataLowTempRadSys->HydrRadSys(RadSysNum).HWPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(state.dataLowTempRadSys->HydrRadSys(RadSysNum).HWPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(state.dataLowTempRadSys->HydrRadSys(RadSysNum).HWPlantLoc.loopNum) + .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); state.dataLowTempRadSys->HydrRadSys(RadSysNum).WaterFlowMaxHeat = rho * state.dataLowTempRadSys->HydrRadSys(RadSysNum).WaterVolFlowMaxHeat; InitComponentNodes(state, @@ -2179,11 +2132,8 @@ namespace LowTempRadiantSystem { state.dataLowTempRadSys->HydrRadSys(RadSysNum).HotWaterOutNode); } if (state.dataLowTempRadSys->HydrRadSys(RadSysNum).ColdWaterInNode > 0) { - rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(state.dataLowTempRadSys->HydrRadSys(RadSysNum).CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(state.dataLowTempRadSys->HydrRadSys(RadSysNum).CWPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(state.dataLowTempRadSys->HydrRadSys(RadSysNum).CWPlantLoc.loopNum) + .glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); state.dataLowTempRadSys->HydrRadSys(RadSysNum).WaterFlowMaxCool = rho * state.dataLowTempRadSys->HydrRadSys(RadSysNum).WaterVolFlowMaxCool; InitComponentNodes(state, @@ -2202,11 +2152,8 @@ namespace LowTempRadiantSystem { // set design mass flow rates if (state.dataLowTempRadSys->CFloRadSys(RadSysNum).HotWaterInNode > 0) { - rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(state.dataLowTempRadSys->CFloRadSys(RadSysNum).HWPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(state.dataLowTempRadSys->CFloRadSys(RadSysNum).HWPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(state.dataLowTempRadSys->CFloRadSys(RadSysNum).HWPlantLoc.loopNum) + .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); state.dataLowTempRadSys->CFloRadSys(RadSysNum).HotDesignWaterMassFlowRate = rho * state.dataLowTempRadSys->CFloRadSys(RadSysNum).WaterVolFlowMax; InitComponentNodes(state, @@ -2216,11 +2163,8 @@ namespace LowTempRadiantSystem { state.dataLowTempRadSys->CFloRadSys(RadSysNum).HotWaterOutNode); } if (state.dataLowTempRadSys->CFloRadSys(RadSysNum).ColdWaterInNode > 0) { - rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(state.dataLowTempRadSys->CFloRadSys(RadSysNum).CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(state.dataLowTempRadSys->CFloRadSys(RadSysNum).CWPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(state.dataLowTempRadSys->CFloRadSys(RadSysNum).CWPlantLoc.loopNum) + .glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); state.dataLowTempRadSys->CFloRadSys(RadSysNum).ColdDesignWaterMassFlowRate = rho * state.dataLowTempRadSys->CFloRadSys(RadSysNum).WaterVolFlowMax; InitComponentNodes(state, @@ -2386,10 +2330,10 @@ namespace LowTempRadiantSystem { if ((state.dataLowTempRadSys->CFloRadSys(RadSysNum).WaterVolFlowMax > 0.0) && (state.dataLowTempRadSys->CFloRadSys(RadSysNum).HotWaterInNode > 0) && (state.dataLowTempRadSys->CFloRadSys(RadSysNum).HotWaterOutNode > 0) && - (state.dataLowTempRadSys->CFloRadSys(RadSysNum).HotWaterHiTempSchedPtr > 0) && - (state.dataLowTempRadSys->CFloRadSys(RadSysNum).HotWaterLoTempSchedPtr > 0) && - (state.dataLowTempRadSys->CFloRadSys(RadSysNum).HotCtrlHiTempSchedPtr > 0) && - (state.dataLowTempRadSys->CFloRadSys(RadSysNum).HotCtrlLoTempSchedPtr > 0)) { + (state.dataLowTempRadSys->CFloRadSys(RadSysNum).hotWaterHiTempSched != nullptr) && + (state.dataLowTempRadSys->CFloRadSys(RadSysNum).hotWaterLoTempSched != nullptr) && + (state.dataLowTempRadSys->CFloRadSys(RadSysNum).hotCtrlHiTempSched != nullptr) && + (state.dataLowTempRadSys->CFloRadSys(RadSysNum).hotCtrlLoTempSched != nullptr)) { state.dataLowTempRadSys->CFloRadSys(RadSysNum).HeatingSystem = true; } @@ -2397,10 +2341,10 @@ namespace LowTempRadiantSystem { if ((state.dataLowTempRadSys->CFloRadSys(RadSysNum).WaterVolFlowMax > 0.0) && (state.dataLowTempRadSys->CFloRadSys(RadSysNum).ColdWaterInNode > 0) && (state.dataLowTempRadSys->CFloRadSys(RadSysNum).ColdWaterOutNode > 0) && - (state.dataLowTempRadSys->CFloRadSys(RadSysNum).ColdWaterHiTempSchedPtr > 0) && - (state.dataLowTempRadSys->CFloRadSys(RadSysNum).ColdWaterLoTempSchedPtr > 0) && - (state.dataLowTempRadSys->CFloRadSys(RadSysNum).ColdCtrlHiTempSchedPtr > 0) && - (state.dataLowTempRadSys->CFloRadSys(RadSysNum).ColdCtrlLoTempSchedPtr > 0)) { + (state.dataLowTempRadSys->CFloRadSys(RadSysNum).coldWaterHiTempSched != nullptr) && + (state.dataLowTempRadSys->CFloRadSys(RadSysNum).coldWaterLoTempSched != nullptr) && + (state.dataLowTempRadSys->CFloRadSys(RadSysNum).coldCtrlHiTempSched != nullptr) && + (state.dataLowTempRadSys->CFloRadSys(RadSysNum).coldCtrlLoTempSched != nullptr)) { state.dataLowTempRadSys->CFloRadSys(RadSysNum).CoolingSystem = true; } } @@ -2475,8 +2419,8 @@ namespace LowTempRadiantSystem { state.dataLowTempRadSys->CFloRadSys(RadSysNum).WaterMassFlowRate = 0.0; // Initialize the appropriate node data if (state.dataLowTempRadSys->CFloRadSys(RadSysNum).HeatingSystem) { - if (state.dataLowTempRadSys->CFloRadSys(RadSysNum).VolFlowSchedPtr > 0) { - CurrentFlowSchedule = GetCurrentScheduleValue(state, state.dataLowTempRadSys->CFloRadSys(RadSysNum).VolFlowSchedPtr); + if (state.dataLowTempRadSys->CFloRadSys(RadSysNum).volFlowSched != nullptr) { + CurrentFlowSchedule = state.dataLowTempRadSys->CFloRadSys(RadSysNum).volFlowSched->getCurrentVal(); } else { CurrentFlowSchedule = 1.0; // Allow user to avoid putting in a schedule (defaults to constant flow at all times) } @@ -2498,8 +2442,8 @@ namespace LowTempRadiantSystem { state.dataLowTempRadSys->CFloRadSys(RadSysNum).HWPlantLoc); } if (state.dataLowTempRadSys->CFloRadSys(RadSysNum).CoolingSystem) { - if (state.dataLowTempRadSys->CFloRadSys(RadSysNum).VolFlowSchedPtr > 0) { - CurrentFlowSchedule = GetCurrentScheduleValue(state, state.dataLowTempRadSys->CFloRadSys(RadSysNum).VolFlowSchedPtr); + if (state.dataLowTempRadSys->CFloRadSys(RadSysNum).volFlowSched != nullptr) { + CurrentFlowSchedule = state.dataLowTempRadSys->CFloRadSys(RadSysNum).volFlowSched->getCurrentVal(); } else { CurrentFlowSchedule = 1.0; // Allow user to avoid putting in a schedule (defaults to constant flow at all times) } @@ -2535,18 +2479,18 @@ namespace LowTempRadiantSystem { { // Since this is only called when the operating mode is something other than "not operating", // the status from the previous system time step is what it did in the last or previous time step. - // So, we can update the last status of the system using this information before reseting things + // So, we can update the last status of the system using this information before resetting things // to "not operating". this->lastOperatingMode = this->OperatingMode; if (state.dataGlobal->BeginDayFlag) { // The begin day flag is set which mean this is the first time step of the day. // This also means that the previous time step was the last time step of yesterday. - // So, the day should be the previous day, the hour should bethe last hour of the + // So, the day should be the previous day, the hour should be the last hour of the // day, and the time step should be the last time step. this->lastDayOfSim = state.dataGlobal->DayOfSim - 1; - this->lastHourOfDay = int(Constant::HoursInDay); - this->lastTimeStep = state.dataGlobal->NumOfTimeStepInHour; + this->lastHourOfDay = Constant::iHoursInDay; + this->lastTimeStep = state.dataGlobal->TimeStepsInHour; } else if (state.dataGlobal->BeginHourFlag) { // It's not the beginning of the day but it is the beginning of an hour other than // the first hour. This means that the previous time step was the previous hour of @@ -2554,7 +2498,7 @@ namespace LowTempRadiantSystem { // be the previous hour, and the time step should be the last time step. this->lastDayOfSim = state.dataGlobal->DayOfSim; this->lastHourOfDay = state.dataGlobal->HourOfDay - 1; - this->lastTimeStep = state.dataGlobal->NumOfTimeStepInHour; + this->lastTimeStep = state.dataGlobal->TimeStepsInHour; } else if (state.dataGlobal->BeginTimeStepFlag) { // It's neither the beginning of the day nor the beginning of an hour but it is the start // of a time step other than the first time step in the hour. So, the day should be the @@ -2586,17 +2530,17 @@ namespace LowTempRadiantSystem { if (this->OperatingMode == this->lastOperatingMode) return; // always let it continue to operating in the same mode - if (this->schedPtrChangeoverDelay == 0) return; // user not requesting any delays (no schedule entered) so let it do whatever is requested + if (this->changeoverDelaySched == nullptr) return; // user not requesting any delays (no schedule entered) so let it do whatever is requested - Real64 currentChangeoverDelay = ScheduleManager::GetCurrentScheduleValue(state, this->schedPtrChangeoverDelay); + Real64 currentChangeoverDelay = this->changeoverDelaySched->getCurrentVal(); if (currentChangeoverDelay <= 0.0) return; // delay is zero so let it do whatever it requested // At this point, the radiant system is trying to switch modes from the previous time step, the user is requesting a delay in the changeover, // and the requested delay is greater than zero. Calculate what the current time is in hours from the start of the simulation Real64 timeCurrent = 24.0 * float(state.dataGlobal->DayOfSim - 1) + float(state.dataGlobal->HourOfDay - 1) + - float(state.dataGlobal->TimeStep - 1) / float(state.dataGlobal->NumOfTimeStepInHour); + float(state.dataGlobal->TimeStep - 1) / float(state.dataGlobal->TimeStepsInHour); Real64 timeLast = 24.0 * float(this->lastDayOfSim - 1) + float(this->lastHourOfDay - 1) + - float(this->lastTimeStep - 1) / float(state.dataGlobal->NumOfTimeStepInHour); + float(this->lastTimeStep - 1) / float(state.dataGlobal->TimeStepsInHour); Real64 actualTimeDifference = timeCurrent - timeLast; // If the time difference is not longer than the user delay, then the system should not switch modes and needs to be turned off. @@ -2629,8 +2573,6 @@ namespace LowTempRadiantSystem { // Using/Aliasing using namespace DataSizing; - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSpecificHeatGlycol; using HVAC::AutoCalculateSizing; using HVAC::CoolingCapacitySizing; using HVAC::HeatingCapacitySizing; @@ -2659,12 +2601,12 @@ namespace LowTempRadiantSystem { Real64 rho; Real64 Cp; bool IsAutoSize(false); // Indicator to autosize - Real64 WaterVolFlowMaxHeatDes(0.0); // Design hot water flow for reproting + Real64 WaterVolFlowMaxHeatDes(0.0); // Design hot water flow for reporting Real64 WaterVolFlowMaxHeatUser(0.0); // User hard-sized hot water flow for - Real64 WaterVolFlowMaxCoolDes(0.0); // Design chilled water flow for reproting - Real64 WaterVolFlowMaxCoolUser(0.0); // User hard-sized chilled water flow for reproting - Real64 TubeLengthDes(0.0); // Design tube length for reproting - Real64 TubeLengthUser(0.0); // User hard-sized tube length for reproting + Real64 WaterVolFlowMaxCoolDes(0.0); // Design chilled water flow for reporting + Real64 WaterVolFlowMaxCoolUser(0.0); // User hard-sized chilled water flow for reporting + Real64 TubeLengthDes(0.0); // Design tube length for reporting + Real64 TubeLengthUser(0.0); // User hard-sized tube length for reporting std::string CompName; // component name std::string CompType; // component type std::string SizingString; // input field sizing description (e.g., Nominal Capacity) @@ -2674,8 +2616,8 @@ namespace LowTempRadiantSystem { int CapSizingMethod; // capacity sizing methods (HeatingDesignCapacity, CapacityPerFloorArea, FractionOfAutosizedCoolingCapacity, and // FractionOfAutosizedHeatingCapacity ) Real64 DesCoilLoad; // design autosized or user specified capacity - Real64 WaterVolFlowMaxDes; // Design water volume flow rate for reproting - Real64 WaterVolFlowMaxUser; // User hard-sized water volume flow rate for reproting + Real64 WaterVolFlowMaxDes; // Design water volume flow rate for reporting + Real64 WaterVolFlowMaxUser; // User hard-sized water volume flow rate for reporting DesCoilLoad = 0.0; state.dataSize->DataScalableCapSizingON = false; @@ -2900,18 +2842,10 @@ namespace LowTempRadiantSystem { ErrorsFound); if (PltSizHeatNum > 0) { if (DesCoilLoad >= SmallLoad) { - rho = GetDensityGlycol( - state, - state.dataPlnt->PlantLoop(state.dataLowTempRadSys->HydrRadSys(RadSysNum).HWPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(state.dataLowTempRadSys->HydrRadSys(RadSysNum).HWPlantLoc.loopNum).FluidIndex, - RoutineName); - Cp = GetSpecificHeatGlycol( - state, - state.dataPlnt->PlantLoop(state.dataLowTempRadSys->HydrRadSys(RadSysNum).HWPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(state.dataLowTempRadSys->HydrRadSys(RadSysNum).HWPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(state.dataLowTempRadSys->HydrRadSys(RadSysNum).HWPlantLoc.loopNum) + .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); + Cp = state.dataPlnt->PlantLoop(state.dataLowTempRadSys->HydrRadSys(RadSysNum).HWPlantLoc.loopNum) + .glycol->getSpecificHeat(state, Constant::HWInitConvTemp, RoutineName); WaterVolFlowMaxHeatDes = DesCoilLoad / (state.dataSize->PlantSizData(PltSizHeatNum).DeltaT * Cp * rho); } else { WaterVolFlowMaxHeatDes = 0.0; @@ -3079,18 +3013,10 @@ namespace LowTempRadiantSystem { ErrorsFound); if (PltSizCoolNum > 0) { if (DesCoilLoad >= SmallLoad) { - rho = GetDensityGlycol( - state, - state.dataPlnt->PlantLoop(state.dataLowTempRadSys->HydrRadSys(RadSysNum).CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(state.dataLowTempRadSys->HydrRadSys(RadSysNum).CWPlantLoc.loopNum).FluidIndex, - RoutineName); - Cp = GetSpecificHeatGlycol( - state, - state.dataPlnt->PlantLoop(state.dataLowTempRadSys->HydrRadSys(RadSysNum).CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(state.dataLowTempRadSys->HydrRadSys(RadSysNum).CWPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(state.dataLowTempRadSys->HydrRadSys(RadSysNum).CWPlantLoc.loopNum) + .glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); + Cp = state.dataPlnt->PlantLoop(state.dataLowTempRadSys->HydrRadSys(RadSysNum).CWPlantLoc.loopNum) + .glycol->getSpecificHeat(state, Constant::CWInitConvTemp, RoutineName); WaterVolFlowMaxCoolDes = DesCoilLoad / (state.dataSize->PlantSizData(PltSizCoolNum).DeltaT * Cp * rho); } else { WaterVolFlowMaxCoolDes = 0.0; @@ -3258,18 +3184,10 @@ namespace LowTempRadiantSystem { } if (PltSizHeatNum > 0) { if (state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).NonAirSysDesHeatLoad >= SmallLoad) { - rho = GetDensityGlycol( - state, - state.dataPlnt->PlantLoop(state.dataLowTempRadSys->CFloRadSys(RadSysNum).HWPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(state.dataLowTempRadSys->CFloRadSys(RadSysNum).HWPlantLoc.loopNum).FluidIndex, - "SizeLowTempRadiantSystem"); - Cp = GetSpecificHeatGlycol( - state, - state.dataPlnt->PlantLoop(state.dataLowTempRadSys->CFloRadSys(RadSysNum).HWPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(state.dataLowTempRadSys->CFloRadSys(RadSysNum).HWPlantLoc.loopNum).FluidIndex, - "SizeLowTempRadiantSystem"); + rho = state.dataPlnt->PlantLoop(state.dataLowTempRadSys->CFloRadSys(RadSysNum).HWPlantLoc.loopNum) + .glycol->getDensity(state, Constant::HWInitConvTemp, "SizeLowTempRadiantSystem"); + Cp = state.dataPlnt->PlantLoop(state.dataLowTempRadSys->CFloRadSys(RadSysNum).HWPlantLoc.loopNum) + .glycol->getSpecificHeat(state, Constant::HWInitConvTemp, "SizeLowTempRadiantSystem"); WaterVolFlowMaxHeatDes = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).NonAirSysDesHeatLoad / (state.dataSize->PlantSizData(PltSizHeatNum).DeltaT * Cp * rho); } else { @@ -3296,18 +3214,10 @@ namespace LowTempRadiantSystem { } if (PltSizCoolNum > 0) { if (state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).NonAirSysDesCoolLoad >= SmallLoad) { - rho = GetDensityGlycol( - state, - state.dataPlnt->PlantLoop(state.dataLowTempRadSys->CFloRadSys(RadSysNum).CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(state.dataLowTempRadSys->CFloRadSys(RadSysNum).CWPlantLoc.loopNum).FluidIndex, - "SizeLowTempRadiantSystem"); - Cp = GetSpecificHeatGlycol( - state, - state.dataPlnt->PlantLoop(state.dataLowTempRadSys->CFloRadSys(RadSysNum).CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(state.dataLowTempRadSys->CFloRadSys(RadSysNum).CWPlantLoc.loopNum).FluidIndex, - "SizeLowTempRadiantSystem"); + rho = state.dataPlnt->PlantLoop(state.dataLowTempRadSys->CFloRadSys(RadSysNum).CWPlantLoc.loopNum) + .glycol->getDensity(state, Constant::CWInitConvTemp, "SizeLowTempRadiantSystem"); + Cp = state.dataPlnt->PlantLoop(state.dataLowTempRadSys->CFloRadSys(RadSysNum).CWPlantLoc.loopNum) + .glycol->getSpecificHeat(state, Constant::CWInitConvTemp, "SizeLowTempRadiantSystem"); WaterVolFlowMaxCoolDes = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).NonAirSysDesCoolLoad / (state.dataSize->PlantSizData(PltSizCoolNum).DeltaT * Cp * rho); } else { @@ -3515,7 +3425,6 @@ namespace LowTempRadiantSystem { using DataHeatBalance::ZoneData; using HVAC::SmallLoad; using PlantUtilities::SetComponentFlowRate; - using ScheduleManager::GetCurrentScheduleValue; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 ActWaterFlow; // actual water flow for heating or cooling [kg/sec] @@ -3535,7 +3444,7 @@ namespace LowTempRadiantSystem { this->OperatingMode = NotOperating; SysRunning = true; - if (GetCurrentScheduleValue(state, this->SchedPtr) <= 0) { + if (this->availSched->getCurrentVal() <= 0) { // Unit is off or has no load upon it; set the flow rates to zero and then // simulate the components with the no flow conditions @@ -3559,21 +3468,21 @@ namespace LowTempRadiantSystem { ControlTemp = this->setRadiantSystemControlTemperature(state, variableFlowDesignDataObject.VarFlowControlType); - if (variableFlowDesignDataObject.HotSetptSchedPtr > 0) { + if (variableFlowDesignDataObject.heatSetptSched != nullptr) { // OffTempHeat = this->setOffTemperatureLowTemperatureRadiantSystem(state, this->HotSetptSchedPtr, // this->HotThrottlRange); Real64 a; - a = variableFlowDesignDataObject.HotThrottlRange; + a = variableFlowDesignDataObject.HotThrottlRange; // Why are we doing this? OffTempHeat = this->setOffTemperatureLowTemperatureRadiantSystem(state, - variableFlowDesignDataObject.HotSetptSchedPtr, + variableFlowDesignDataObject.heatSetptSched, variableFlowDesignDataObject.HotThrottlRange, variableFlowDesignDataObject.VarFlowSetpointType); } else { // This system is not capable of heating, set OffTempHeat to something really low OffTempHeat = state.dataLowTempRadSys->LowTempHeating; } - if (variableFlowDesignDataObject.ColdSetptSchedPtr > 0) { + if (variableFlowDesignDataObject.coolSetptSched != nullptr) { OffTempCool = this->setOffTemperatureLowTemperatureRadiantSystem(state, - variableFlowDesignDataObject.ColdSetptSchedPtr, + variableFlowDesignDataObject.coolSetptSched, -variableFlowDesignDataObject.ColdThrottlRange, variableFlowDesignDataObject.VarFlowSetpointType); } else { // This system is not capable of cooling, set OffTempCool to something really high @@ -4147,10 +4056,8 @@ namespace LowTempRadiantSystem { // Using/Aliasing using DataHeatBalance::ZoneData; - using FluidProperties::GetSpecificHeatGlycol; using HVAC::SmallLoad; using PlantUtilities::SetComponentFlowRate; - using ScheduleManager::GetCurrentScheduleValue; // SUBROUTINE PARAMETER DEFINITIONS: Real64 constexpr LowCpFluidValue(100.0); // lowest allowed Cp fluid value (to avoid dividing by zero) [J/kg-K] @@ -4181,7 +4088,7 @@ namespace LowTempRadiantSystem { SysRunning = true; // default to running and turn off only if not running state.dataLowTempRadSys->VarOffCond = false; - if (GetCurrentScheduleValue(state, this->SchedPtr) <= 0) SysRunning = false; + if (this->availSched->getCurrentVal() <= 0) SysRunning = false; if (SysRunning) { // Unit is probably on-->this section is intended to control the water // mass flow rate being sent to the radiant system @@ -4191,13 +4098,13 @@ namespace LowTempRadiantSystem { SetPointTemp = this->setRadiantSystemControlTemperature(state, ConstantFlowDesignDataObject.ConstFlowControlType); // Avoid problems when there is no heating or cooling control because the system only cools or heats - if (this->HotCtrlHiTempSchedPtr > 0) { - OffTempHeat = GetCurrentScheduleValue(state, this->HotCtrlHiTempSchedPtr); + if (this->hotCtrlHiTempSched != nullptr) { + OffTempHeat = this->hotCtrlHiTempSched->getCurrentVal(); } else { OffTempHeat = state.dataLowTempRadSys->LowTempHeating; } - if (this->ColdCtrlLoTempSchedPtr > 0) { - OffTempCool = GetCurrentScheduleValue(state, this->ColdCtrlLoTempSchedPtr); + if (this->coldCtrlLoTempSched != nullptr) { + OffTempCool = this->coldCtrlLoTempSched->getCurrentVal(); } else { OffTempCool = state.dataLowTempRadSys->HighTempCooling; } @@ -4221,16 +4128,16 @@ namespace LowTempRadiantSystem { } else { // It is a heating system so set all of the values for controls - SetPointTempHi = GetCurrentScheduleValue(state, this->HotCtrlHiTempSchedPtr); - SetPointTempLo = GetCurrentScheduleValue(state, this->HotCtrlLoTempSchedPtr); + SetPointTempHi = this->hotCtrlHiTempSched->getCurrentVal(); + SetPointTempLo = this->hotCtrlLoTempSched->getCurrentVal(); if (SetPointTempHi < SetPointTempLo) { ShowSevereError(state, format("Heating setpoint temperature mismatch in{}", this->Name)); ShowContinueError(state, "High setpoint temperature is less than low setpoint temperature--check your schedule input"); ShowFatalError(state, "Preceding condition causes termination."); } - WaterTempHi = GetCurrentScheduleValue(state, this->HotWaterHiTempSchedPtr); - WaterTempLo = GetCurrentScheduleValue(state, this->HotWaterLoTempSchedPtr); + WaterTempHi = this->hotWaterHiTempSched->getCurrentVal(); + WaterTempLo = this->hotWaterLoTempSched->getCurrentVal(); if (WaterTempHi < WaterTempLo) { ShowSevereError(state, format("Heating water temperature mismatch in{}", this->Name)); ShowContinueError(state, "High water temperature is less than low water temperature--check your schedule input"); @@ -4260,16 +4167,16 @@ namespace LowTempRadiantSystem { } else { // It is a cooling system so set all of the values for controls - SetPointTempHi = GetCurrentScheduleValue(state, this->ColdCtrlHiTempSchedPtr); - SetPointTempLo = GetCurrentScheduleValue(state, this->ColdCtrlLoTempSchedPtr); + SetPointTempHi = this->coldCtrlHiTempSched->getCurrentVal(); + SetPointTempLo = this->coldCtrlLoTempSched->getCurrentVal(); if (SetPointTempHi < SetPointTempLo) { ShowSevereError(state, format("Cooling setpoint temperature mismatch in{}", this->Name)); ShowContinueError(state, "High setpoint temperature is less than low setpoint temperature--check your schedule input"); ShowFatalError(state, "Preceding condition causes termination."); } - WaterTempHi = GetCurrentScheduleValue(state, this->ColdWaterHiTempSchedPtr); - WaterTempLo = GetCurrentScheduleValue(state, this->ColdWaterLoTempSchedPtr); + WaterTempHi = this->coldWaterHiTempSched->getCurrentVal(); + WaterTempLo = this->coldWaterLoTempSched->getCurrentVal(); if (WaterTempHi < WaterTempLo) { ShowSevereError(state, format("Cooling water temperature mismatch in{}", this->Name)); ShowContinueError(state, "High water temperature is less than low water temperature--check your schedule input"); @@ -4297,7 +4204,7 @@ namespace LowTempRadiantSystem { } if (SysRunning) { - CpFluid = GetSpecificHeatGlycol(state, fluidNameWater, RadInTemp, this->GlycolIndex, RoutineName); + CpFluid = this->water->getSpecificHeat(state, RadInTemp, RoutineName); } if ((!SysRunning) || (CpFluid < LowCpFluidValue)) { @@ -4337,11 +4244,8 @@ namespace LowTempRadiantSystem { // Determine pump flow rate and pump heat addition this->PumpMassFlowRate = this->WaterMassFlowRate; // Set in InitLowTempRadiantSystem - if (this->VolFlowSchedPtr > 0) { - PumpPartLoadRat = GetCurrentScheduleValue(state, this->VolFlowSchedPtr); - } else { - PumpPartLoadRat = 1.0; - } + PumpPartLoadRat = (this->volFlowSched != nullptr) ? this->volFlowSched->getCurrentVal() : 1.0; + this->PumpPower = PumpPartLoadRat * this->NomPowerUse; ShaftPower = this->PumpPower * ConstantFlowDesignDataObject.MotorEffic; // This adds the pump heat based on User input for the pump (same as in Pump module) @@ -4651,7 +4555,6 @@ namespace LowTempRadiantSystem { auto &Zone = state.dataHeatBal->Zone; // Using/Aliasing - using FluidProperties::GetSpecificHeatGlycol; using PlantUtilities::SetComponentFlowRate; // SUBROUTINE PARAMETER DEFINITIONS: @@ -4821,7 +4724,7 @@ namespace LowTempRadiantSystem { Cl = Ch + ((Ci * (Cc + Cb * Cf) + Cj * (Cf + Ce * Cc)) / (1.0 - Ce * Cb)); Mdot = WaterMassFlow * this->SurfaceFrac(RadSurfNum); - Cp = GetSpecificHeatGlycol(state, fluidNameWater, WaterTempIn, this->GlycolIndex, RoutineName); + Cp = this->water->getSpecificHeat(state, WaterTempIn, RoutineName); if (!Iteration) { @@ -5083,7 +4986,7 @@ namespace LowTempRadiantSystem { TotalRadSysPower *= ZoneMult; if (this->WaterMassFlowRate > 0.0) { - Cp = GetSpecificHeatGlycol(state, fluidNameWater, WaterTempIn, this->GlycolIndex, RoutineName); + Cp = this->water->getSpecificHeat(state, WaterTempIn, RoutineName); this->WaterOutletTemp = this->WaterInletTemp - (TotalRadSysPower / (this->WaterMassFlowRate * Cp)); if ((std::abs(this->WaterOutletTemp - WaterOutletTempCheck) > TempCheckLimit) && (std::abs(TotalRadSysPower) > ZeroSystemResp)) { // If the total system power is zero, that means we have shut down and the temperatures won't match because of that @@ -5138,12 +5041,12 @@ namespace LowTempRadiantSystem { Real64 ConstantFlowRadiantSystemData::calculateCurrentDailyAverageODB(EnergyPlusData &state) { Real64 sum = 0.0; - for (int hourNumber = 1; hourNumber <= Constant::HoursInDay; ++hourNumber) { - for (int timeStepNumber = 1; timeStepNumber <= state.dataGlobal->NumOfTimeStepInHour; ++timeStepNumber) { + for (int hourNumber = 1; hourNumber <= Constant::iHoursInDay; ++hourNumber) { + for (int timeStepNumber = 1; timeStepNumber <= state.dataGlobal->TimeStepsInHour; ++timeStepNumber) { sum += state.dataWeather->wvarsHrTsToday(timeStepNumber, hourNumber).OutDryBulbTemp; } } - return sum / double(Constant::HoursInDay * state.dataGlobal->NumOfTimeStepInHour); + return sum / (Constant::rHoursInDay * state.dataGlobal->TimeStepsInHour); } void ElectricRadiantSystemData::calculateLowTemperatureRadiantSystem(EnergyPlusData &state, @@ -5179,7 +5082,6 @@ namespace LowTempRadiantSystem { // Using/Aliasing using DataHeatBalance::ZoneData; using HVAC::SmallLoad; - using ScheduleManager::GetCurrentScheduleValue; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 ControlTemp; // Temperature of the parameter that is controlling the radiant system @@ -5194,7 +5096,7 @@ namespace LowTempRadiantSystem { HeatFrac = 0.0; auto &Surface = state.dataSurface->Surface; - if (GetCurrentScheduleValue(state, this->SchedPtr) <= 0.0) { + if (this->availSched->getCurrentVal() <= 0.0) { // Unit is off; set the heat source terms to zero for (RadSurfNum = 1; RadSurfNum <= this->NumOfSurfaces; ++RadSurfNum) { @@ -5208,7 +5110,7 @@ namespace LowTempRadiantSystem { // that the unit should be on or not // Determine the current setpoint temperature and the temperature at which the unit should be completely off - OffTemp = this->setOffTemperatureLowTemperatureRadiantSystem(state, this->SetptSchedPtr, this->ThrottlRange, this->SetpointType); + OffTemp = this->setOffTemperatureLowTemperatureRadiantSystem(state, this->setptSched, this->ThrottlRange, this->SetpointType); // Determine the control temperature--what the setpoint/offtemp is being compared to for unit operation @@ -5282,7 +5184,6 @@ namespace LowTempRadiantSystem { { // Using/Aliasing - using FluidProperties::GetSpecificHeatGlycol; using PlantUtilities::SafeCopyPlantNode; using PlantUtilities::SetComponentFlowRate; @@ -5315,11 +5216,7 @@ namespace LowTempRadiantSystem { waterOutletNode = this->HotWaterOutNode; waterMassFlow = Node(waterInletNode).MassFlowRate; - cpWater = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum).FluidName, - Node(waterInletNode).Temp, - state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum).FluidIndex, - RoutineName); + cpWater = state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum).glycol->getSpecificHeat(state, Node(waterInletNode).Temp, RoutineName); if (this->OperatingMode == HeatingMode) { if ((cpWater > 0.0) && (waterMassFlow > 0.0)) { @@ -5342,11 +5239,7 @@ namespace LowTempRadiantSystem { waterOutletNode = this->ColdWaterOutNode; waterMassFlow = Node(waterInletNode).MassFlowRate; - cpWater = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Node(waterInletNode).Temp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + cpWater = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getSpecificHeat(state, Node(waterInletNode).Temp, RoutineName); if (this->OperatingMode == CoolingMode) { if ((cpWater > 0.0) && (waterMassFlow > 0.0)) { @@ -5368,7 +5261,6 @@ namespace LowTempRadiantSystem { { // Using/Aliasing - using FluidProperties::GetSpecificHeatGlycol; using PlantUtilities::SafeCopyPlantNode; using PlantUtilities::SetComponentFlowRate; @@ -5545,11 +5437,11 @@ namespace LowTempRadiantSystem { } Real64 RadiantSystemBaseData::setOffTemperatureLowTemperatureRadiantSystem(EnergyPlusData &state, - const int scheduleIndex, + Sched::Schedule const *sched, const Real64 throttlingRange, LowTempRadiantSetpointTypes SetpointControlType) { - Real64 scheduleValue = ScheduleManager::GetCurrentScheduleValue(state, scheduleIndex); + Real64 scheduleValue = sched->getCurrentVal(); switch (SetpointControlType) { case LowTempRadiantSetpointTypes::HalfFlowPower: return scheduleValue + 0.5 * throttlingRange; @@ -5598,9 +5490,6 @@ namespace LowTempRadiantSystem { // Heat exchanger information also from Incropera and DeWitt. // Code based loosely on code from IBLAST program (research version) - // Using/Aliasing - using FluidProperties::GetSpecificHeatGlycol; - // Return value Real64 calculateHXEffectivenessTerm; @@ -5687,18 +5576,10 @@ namespace LowTempRadiantSystem { // arguments are glycol name, temperature, and concentration switch (this->OperatingMode) { case HeatingMode: { - CpWater = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum).FluidName, - Temperature, - state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum).FluidIndex, - RoutineName); + CpWater = state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum).glycol->getSpecificHeat(state, Temperature, RoutineName); } break; case CoolingMode: { - CpWater = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Temperature, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + CpWater = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getSpecificHeat(state, Temperature, RoutineName); } break; default: { assert(false); @@ -5934,7 +5815,6 @@ namespace LowTempRadiantSystem { // Using/Aliasing Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - using FluidProperties::GetSpecificHeatGlycol; constexpr std::string_view routineName("ReportConstantFlowSystem"); Real64 cpFluid; // Specific heat of the fluid in the radiant system @@ -5957,11 +5837,8 @@ namespace LowTempRadiantSystem { // in another routine, but just in case...). if (this->OperatingMode == HeatingMode) { - cpFluid = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->HotWaterInNode).Temp, - state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum).FluidIndex, - routineName); + cpFluid = state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->HotWaterInNode).Temp, routineName); this->HeatPower = totalRadSysPower; if (this->PumpMassFlowRate > 0.0) { @@ -5971,11 +5848,8 @@ namespace LowTempRadiantSystem { } } else if (this->OperatingMode == CoolingMode) { - cpFluid = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->ColdWaterInNode).Temp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - routineName); + cpFluid = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->ColdWaterInNode).Temp, routineName); this->CoolPower = -totalRadSysPower; this->PumpInletTemp = this->WaterInletTemp - (this->PumpHeattoFluid / (this->PumpMassFlowRate * cpFluid)); diff --git a/src/EnergyPlus/LowTempRadiantSystem.hh b/src/EnergyPlus/LowTempRadiantSystem.hh index 6ce58b4c4ab..dbe7c884e2a 100644 --- a/src/EnergyPlus/LowTempRadiantSystem.hh +++ b/src/EnergyPlus/LowTempRadiantSystem.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -55,6 +55,7 @@ #include #include #include +#include #include #include @@ -139,19 +140,18 @@ namespace LowTempRadiantSystem { struct RadiantSystemBaseData { // Members - std::string Name; // name of hydronic radiant system - std::string SchedName; // availability schedule - int SchedPtr = 0; // index to schedule - std::string ZoneName; // Name of zone the system is serving - int ZonePtr = 0; // Point to this zone in the Zone derived type - std::string SurfListName; // Name of surface/surface list that is the radiant system - int NumOfSurfaces = 0; // Number of surfaces included in this radiant system (coordinated control) - Array1D_int SurfacePtr; // Pointer to the surface(s) in the Surface derived type - Array1D_string SurfaceName; // Name of surfaces that are the radiant system (can be one or more) - Array1D SurfaceFrac; // Fraction of flow/pipe length or electric power for a particular surface - Real64 TotalSurfaceArea = 0.0; // Total surface area for all surfaces that are part of this radiant system - Real64 ZeroLTRSourceSumHATsurf = 0.0; // Equal to SumHATsurf for all the walls in a zone with no source - Array1D QRadSysSrcAvg; // Average source over the time step for a particular radiant surface + std::string Name; // name of hydronic radiant system + Sched::Schedule *availSched = nullptr; // index to schedule + std::string ZoneName; // Name of zone the system is serving + int ZonePtr = 0; // Point to this zone in the Zone derived type + std::string SurfListName; // Name of surface/surface list that is the radiant system + int NumOfSurfaces = 0; // Number of surfaces included in this radiant system (coordinated control) + Array1D_int SurfacePtr; // Pointer to the surface(s) in the Surface derived type + Array1D_string SurfaceName; // Name of surfaces that are the radiant system (can be one or more) + Array1D SurfaceFrac; // Fraction of flow/pipe length or electric power for a particular surface + Real64 TotalSurfaceArea = 0.0; // Total surface area for all surfaces that are part of this radiant system + Real64 ZeroLTRSourceSumHATsurf = 0.0; // Equal to SumHATsurf for all the walls in a zone with no source + Array1D QRadSysSrcAvg; // Average source over the time step for a particular radiant surface // Record keeping variables used to calculate QRadSysSrcAvg locally Array1D LastQRadSysSrc; // Need to keep the last value in case we are still iterating Real64 LastSysTimeElapsed; // Need to keep the last value in case we are still iterating @@ -188,7 +188,7 @@ namespace LowTempRadiantSystem { virtual void calculateLowTemperatureRadiantSystem(EnergyPlusData &state, Real64 &LoadMet) = 0; Real64 setOffTemperatureLowTemperatureRadiantSystem(EnergyPlusData &state, - int const scheduleIndex, + Sched::Schedule const *sched, Real64 const throttlingRange, LowTempRadiantSetpointTypes SetpointControlType); @@ -216,19 +216,19 @@ namespace LowTempRadiantSystem { int ColdWaterInNode = 0; // cold water inlet node int ColdWaterOutNode = 0; // cold water outlet node PlantLocation CWPlantLoc{}; - int GlycolIndex = 0; // Index to Glycol (Water) Properties + Fluid::GlycolProps *water = nullptr; // Water properties + int CondErrIndex = 0; // Error index for recurring warning messages Real64 CondCausedTimeOff = 0.0; // Amount of time condensation did or could have turned system off bool CondCausedShutDown = false; // .TRUE. when condensation predicted at surface CircuitCalc NumCircCalcMethod = - CircuitCalc::Invalid; // Calculation method for number of circuits per surface; 1=1 per surface, 2=use cicuit length - Real64 CircLength = 0.0; // Circuit length {m} - std::string schedNameChangeoverDelay; // changeover delay schedule - int schedPtrChangeoverDelay = 0; // Pointer to the schedule for the changeover delay in hours - int lastOperatingMode = NotOperating; // Last mode of operation (heating or cooling) - int lastDayOfSim = 1; // Last day of simulation radiant system operated in lastOperatingMode - int lastHourOfDay = 1; // Last hour of the day radiant system operated in lastOperatingMode - int lastTimeStep = 1; // Last time step radiant system operated in lastOperatingMode + CircuitCalc::Invalid; // Calculation method for number of circuits per surface; 1=1 per surface, 2=use cicuit length + Real64 CircLength = 0.0; // Circuit length {m} + Sched::Schedule *changeoverDelaySched = nullptr; // schedule for the changeover delay in hours + int lastOperatingMode = NotOperating; // Last mode of operation (heating or cooling) + int lastDayOfSim = 1; // Last day of simulation radiant system operated in lastOperatingMode + int lastHourOfDay = 1; // Last hour of the day radiant system operated in lastOperatingMode + int lastTimeStep = 1; // Last time step radiant system operated in lastOperatingMode // Other parameters bool EMSOverrideOnWaterMdot = false; Real64 EMSWaterMdotOverrideValue = 0.0; @@ -329,15 +329,13 @@ namespace LowTempRadiantSystem { Real64 DesignScaledHeatingCapacity = 0.0; // - Low Temp Radiant system scaled maximum heating capacity {W} or scalable variable of zone HVAC equipment, // {-}, or {W/m2} - Real64 HotThrottlRange = 0.0; // Throttling range for heating [C] - std::string HotSetptSched; // Schedule name for the zone setpoint temperature - int HotSetptSchedPtr = 0; // Schedule index for the zone setpoint temperature - Real64 ColdThrottlRange = 0.0; // Throttling range for cooling [C] + Real64 HotThrottlRange = 0.0; // Throttling range for heating [C] + Sched::Schedule *heatSetptSched = nullptr; // Schedule index for the zone setpoint temperature + Real64 ColdThrottlRange = 0.0; // Throttling range for cooling [C] Array1D_string FieldNames; CondContrlType CondCtrlType = CondContrlType::CondCtrlSimpleOff; // Condensation control type (initialize to simple off) Real64 CondDewPtDeltaT = 1.0; // Diff between surface temperature and dew point for cond. shut-off - std::string ColdSetptSched; // Schedule name for the zone setpoint temperature - int ColdSetptSchedPtr = 0; // Schedule index for the zone setpoint temperature + Sched::Schedule *coolSetptSched = nullptr; // Schedule index for the zone setpoint temperature std::string DesignCoolingCapMethodInput; int DesignCoolingCapMethod = 0; // - Method for Low Temp Radiant system cooling capacity scaledsizing calculation (CoolingDesignCapacity, // CapacityPerFloorArea, FracOfAutosizedCoolingCapacity) @@ -359,36 +357,23 @@ namespace LowTempRadiantSystem { Real64 WaterMassFlowRate = 0.0; // current flow rate through system (calculated) Real64 HotWaterMassFlowRate = 0.0; // current hot water flow rate through heating side of system (calculated) Real64 ChWaterMassFlowRate = 0.0; // current chilled water flow rate through cooling side of system (calculated) - std::string VolFlowSched; // schedule of maximum flow at the current time std::string designObjectName; // Design Object int DesignObjectPtr = 0; - int VolFlowSchedPtr = 0; // index to the volumetric flow schedule - Real64 NomPumpHead = 0.0; // nominal head of the constant flow pump - Real64 NomPowerUse = 0.0; // nominal power use of the constant flow pump - Real64 PumpEffic = 0.0; // overall efficiency of the pump (calculated) - std::string HotWaterHiTempSched; // Schedule name for the highest water temperature - int HotWaterHiTempSchedPtr = 0; // Schedule index for the highest water temperature - std::string HotWaterLoTempSched; // Schedule name for the lowest water temperature - int HotWaterLoTempSchedPtr = 0; // Schedule index for the lowest water temperature - std::string HotCtrlHiTempSched; // Schedule name for the highest control temperature - // (where the lowest water temperature is requested) - int HotCtrlHiTempSchedPtr = 0; // Schedule index for the highest control temperature + Sched::Schedule *volFlowSched = nullptr; // index to the volumetric flow schedule + Real64 NomPumpHead = 0.0; // nominal head of the constant flow pump + Real64 NomPowerUse = 0.0; // nominal power use of the constant flow pump + Real64 PumpEffic = 0.0; // overall efficiency of the pump (calculated) + Sched::Schedule *hotWaterHiTempSched = nullptr; // Schedule for the highest water temperature + Sched::Schedule *hotWaterLoTempSched = nullptr; // Schedule for the lowest water temperature + Sched::Schedule *hotCtrlHiTempSched = nullptr; // Schedule for the highest control temperature // (where the lowest water temperature is requested) - std::string HotCtrlLoTempSched; // Schedule name for the lowest control temperature + Sched::Schedule *hotCtrlLoTempSched = nullptr; // Schedule for the lowest control temperature // (where the highest water temperature is requested) - int HotCtrlLoTempSchedPtr = 0; // Schedule index for the lowest control temperature - // (where the highest water temperature is requested) - std::string ColdWaterHiTempSched; // Schedule name for the highest water temperature - int ColdWaterHiTempSchedPtr = 0; // Schedule index for the highest water temperature - std::string ColdWaterLoTempSched; // Schedule name for the lowest water temperature - int ColdWaterLoTempSchedPtr = 0; // Schedule index for the lowest water temperature - std::string ColdCtrlHiTempSched; // Schedule name for the highest control temperature - // (where the lowest water temperature is requested) - int ColdCtrlHiTempSchedPtr = 0; // Schedule index for the highest control temperature + Sched::Schedule *coldWaterHiTempSched = nullptr; // Schedule for the highest water temperature + Sched::Schedule *coldWaterLoTempSched = nullptr; // Schedule for the lowest water temperature + Sched::Schedule *coldCtrlHiTempSched = nullptr; // Schedule for the highest control temperature // (where the lowest water temperature is requested) - std::string ColdCtrlLoTempSched; // Schedule name for the lowest control temperature - // (where the highest water temperature is requested) - int ColdCtrlLoTempSchedPtr = 0; // Schedule index for the lowest control temperature + Sched::Schedule *coldCtrlLoTempSched = nullptr; // Schedule for the lowest control temperature // (where the highest water temperature is requested) Real64 WaterInjectionRate = 0.0; // water injection mass flow rate from main loop Real64 WaterRecircRate = 0.0; // water recirculation rate (outlet from radiant system recirculated) @@ -454,10 +439,9 @@ namespace LowTempRadiantSystem { { // Members // Input data - Real64 MaxElecPower = 0.0; // Maximum electric power that can be supplied to surface, Watts - Real64 ThrottlRange = 0.0; // Throttling range for heating [C] - std::string SetptSched; // Schedule name for the zone setpoint temperature - int SetptSchedPtr = 0; // Schedule index for the zone setpoint temperature + Real64 MaxElecPower = 0.0; // Maximum electric power that can be supplied to surface, Watts + Real64 ThrottlRange = 0.0; // Throttling range for heating [C] + Sched::Schedule *setptSched = nullptr; // Schedule for the zone setpoint temperature // Other parameters // Report data Real64 ElecPower = 0.0; // heating sent to panel in Watts @@ -600,6 +584,10 @@ struct LowTempRadiantSystemData : BaseGlobalStruct Array1D CflowRadiantSysDesign; Array1D HydronicRadiantSysDesign; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/Material.cc b/src/EnergyPlus/Material.cc index 1e466e5cdc4..59bef3f097f 100644 --- a/src/EnergyPlus/Material.cc +++ b/src/EnergyPlus/Material.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -485,8 +485,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if if (mat->windowOpticalData == Window::OpticalDataModel::Spectral) { if (s_ipsc->lAlphaFieldBlanks(3)) { - ShowSevereCustomMessage( - state, eoh, format("{} = Spectral but {} is blank.", s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaFieldNames(3))); + ShowSevereCustom(state, eoh, format("{} = Spectral but {} is blank.", s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaFieldNames(3))); ErrorsFound = true; } else if ((mat->GlassSpectralDataPtr = Util::FindItemInList(s_ipsc->cAlphaArgs(3), s_mat->SpectralData)) == 0) { ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3)); @@ -499,82 +498,82 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if if (s_ipsc->rNumericArgs(2) + s_ipsc->rNumericArgs(3) > 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(2), s_ipsc->cNumericFieldNames(3))); + ShowSevereCustom(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(2), s_ipsc->cNumericFieldNames(3))); } if (s_ipsc->rNumericArgs(2) + s_ipsc->rNumericArgs(4) > 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(2), s_ipsc->cNumericFieldNames(4))); + ShowSevereCustom(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(2), s_ipsc->cNumericFieldNames(4))); } if (s_ipsc->rNumericArgs(5) + s_ipsc->rNumericArgs(6) > 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(5), s_ipsc->cNumericFieldNames(6))); + ShowSevereCustom(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(5), s_ipsc->cNumericFieldNames(6))); } if (s_ipsc->rNumericArgs(5) + s_ipsc->rNumericArgs(7) > 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(5), s_ipsc->cNumericFieldNames(7))); + ShowSevereCustom(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(5), s_ipsc->cNumericFieldNames(7))); } if (s_ipsc->rNumericArgs(8) + s_ipsc->rNumericArgs(9) > 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(8), s_ipsc->cNumericFieldNames(9))); + ShowSevereCustom(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(8), s_ipsc->cNumericFieldNames(9))); } if (s_ipsc->rNumericArgs(8) + s_ipsc->rNumericArgs(10) > 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(8), s_ipsc->cNumericFieldNames(10))); + ShowSevereCustom(state, eoh, format("{} + {} not <= 1.0", s_ipsc->cNumericFieldNames(8), s_ipsc->cNumericFieldNames(10))); } if (s_ipsc->rNumericArgs(2) < 0.0) { - ShowSevereCustomMessage(state, eoh, format("{} not >= 0.0", s_ipsc->cNumericFieldNames(2))); + ShowSevereCustom(state, eoh, format("{} not >= 0.0", s_ipsc->cNumericFieldNames(2))); ErrorsFound = true; } if (s_ipsc->rNumericArgs(2) > 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} not <= 1.0", s_ipsc->cNumericFieldNames(2))); + ShowSevereCustom(state, eoh, format("{} not <= 1.0", s_ipsc->cNumericFieldNames(2))); } if (s_ipsc->rNumericArgs(3) < 0.0 || s_ipsc->rNumericArgs(3) > 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} not >= 0.0 and <= 1.0", s_ipsc->cNumericFieldNames(3))); + ShowSevereCustom(state, eoh, format("{} not >= 0.0 and <= 1.0", s_ipsc->cNumericFieldNames(3))); } if (s_ipsc->rNumericArgs(4) < 0.0 || s_ipsc->rNumericArgs(4) > 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} not >= 0.0 and <= 1.0", s_ipsc->cNumericFieldNames(4))); + ShowSevereCustom(state, eoh, format("{} not >= 0.0 and <= 1.0", s_ipsc->cNumericFieldNames(4))); } if (s_ipsc->rNumericArgs(5) < 0.0) { - ShowWarningCustomMessage(state, eoh, format("{} not >= 0.0", s_ipsc->cNumericFieldNames(5))); + ShowWarningCustom(state, eoh, format("{} not >= 0.0", s_ipsc->cNumericFieldNames(5))); } if (s_ipsc->rNumericArgs(5) > 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} not <= 1.0", s_ipsc->cNumericFieldNames(5))); + ShowSevereCustom(state, eoh, format("{} not <= 1.0", s_ipsc->cNumericFieldNames(5))); } if (s_ipsc->rNumericArgs(6) < 0.0 || s_ipsc->rNumericArgs(6) > 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} not >= 0.0 and <= 1.0", s_ipsc->cNumericFieldNames(6))); + ShowSevereCustom(state, eoh, format("{} not >= 0.0 and <= 1.0", s_ipsc->cNumericFieldNames(6))); } if (s_ipsc->rNumericArgs(7) < 0.0 || s_ipsc->rNumericArgs(7) > 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} not >= 0.0 and <= 1.0", s_ipsc->cNumericFieldNames(7))); + ShowSevereCustom(state, eoh, format("{} not >= 0.0 and <= 1.0", s_ipsc->cNumericFieldNames(7))); } } if (s_ipsc->rNumericArgs(8) > 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} not <= 1.0", s_ipsc->cNumericFieldNames(8))); + ShowSevereCustom(state, eoh, format("{} not <= 1.0", s_ipsc->cNumericFieldNames(8))); } if (s_ipsc->rNumericArgs(9) <= 0.0 || s_ipsc->rNumericArgs(9) >= 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} not > 0.0 and < 1.0", s_ipsc->cNumericFieldNames(9))); + ShowSevereCustom(state, eoh, format("{} not > 0.0 and < 1.0", s_ipsc->cNumericFieldNames(9))); } if (s_ipsc->rNumericArgs(10) <= 0.0 || s_ipsc->rNumericArgs(10) >= 1.0) { @@ -585,17 +584,17 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if if (s_ipsc->rNumericArgs(11) <= 0.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} not > 0.0", s_ipsc->cNumericFieldNames(11))); + ShowSevereCustom(state, eoh, format("{} not > 0.0", s_ipsc->cNumericFieldNames(11))); } if (s_ipsc->rNumericArgs(13) < 0.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} not > 0.0", s_ipsc->cNumericFieldNames(13))); + ShowSevereCustom(state, eoh, format("{} not > 0.0", s_ipsc->cNumericFieldNames(13))); } if (s_ipsc->rNumericArgs(14) < 0.0 || s_ipsc->rNumericArgs(14) >= 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} not > 0.0 and < 1.0", s_ipsc->cNumericFieldNames(14))); + ShowSevereCustom(state, eoh, format("{} not > 0.0 and < 1.0", s_ipsc->cNumericFieldNames(14))); } if (s_ipsc->cAlphaArgs(4) == "") { @@ -631,38 +630,38 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if GetCurveMinMaxValues(state, mat->GlassSpecAngTransDataPtr, minAngValue, maxAngValue, minLamValue, maxLamValue); if (minAngValue > 1.0e-6) { ErrorsFound = true; - ShowSevereCustomMessage(state, - eoh, - format("{} requires the minumum value = 0.0 in the entered table name={}", - s_ipsc->cAlphaFieldNames(5), - s_ipsc->cAlphaArgs(5))); + ShowSevereCustom(state, + eoh, + format("{} requires the minumum value = 0.0 in the entered table name={}", + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); } if (std::abs(maxAngValue - 90.0) > 1.0e-6) { ErrorsFound = true; - ShowSevereCustomMessage(state, - eoh, - format("{} requires the maximum value = 90.0 in the entered table name={}", - s_ipsc->cAlphaFieldNames(5), - s_ipsc->cAlphaArgs(5))); + ShowSevereCustom(state, + eoh, + format("{} requires the maximum value = 90.0 in the entered table name={}", + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); } if (minLamValue < 0.1) { ErrorsFound = true; - ShowSevereCustomMessage(state, - eoh, - format("{} requires the minumum value = 0.1 micron in the entered table name={}", - s_ipsc->cAlphaFieldNames(5), - s_ipsc->cAlphaArgs(5))); + ShowSevereCustom(state, + eoh, + format("{} requires the minumum value = 0.1 micron in the entered table name={}", + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); } if (maxLamValue > 4.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, - eoh, - format("{} requires the maximum value = 4.0 microns in the entered table name={}", - s_ipsc->cAlphaFieldNames(5), - s_ipsc->cAlphaArgs(5))); + ShowSevereCustom(state, + eoh, + format("{} requires the maximum value = 4.0 microns in the entered table name={}", + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); } } @@ -684,35 +683,35 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if GetCurveMinMaxValues(state, mat->GlassSpecAngFRefleDataPtr, minAngValue, maxAngValue, minLamValue, maxLamValue); if (minAngValue > 1.0e-6) { ErrorsFound = true; - ShowSevereCustomMessage(state, - eoh, - format("{} requires the minumum value = 0.0 in the entered table name={}", - s_ipsc->cAlphaFieldNames(5), - s_ipsc->cAlphaArgs(5))); + ShowSevereCustom(state, + eoh, + format("{} requires the minumum value = 0.0 in the entered table name={}", + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); } if (std::abs(maxAngValue - 90.0) > 1.0e-6) { ErrorsFound = true; - ShowSevereCustomMessage(state, - eoh, - format("{} requires the maximum value = 90.0 in the entered table name={}", - s_ipsc->cAlphaFieldNames(5), - s_ipsc->cAlphaArgs(5))); + ShowSevereCustom(state, + eoh, + format("{} requires the maximum value = 90.0 in the entered table name={}", + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); } if (minLamValue < 0.1) { ErrorsFound = true; - ShowSevereCustomMessage(state, - eoh, - format("{} requires the minumum value = 0.1 micron in the entered table name={}", - s_ipsc->cAlphaFieldNames(5), - s_ipsc->cAlphaArgs(5))); + ShowSevereCustom(state, + eoh, + format("{} requires the minumum value = 0.1 micron in the entered table name={}", + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); } if (maxLamValue > 4.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, - eoh, - format("{} requires the maximum value = 4.0 microns in the entered table name={}", - s_ipsc->cAlphaFieldNames(5), - s_ipsc->cAlphaArgs(5))); + ShowSevereCustom(state, + eoh, + format("{} requires the maximum value = 4.0 microns in the entered table name={}", + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); } } @@ -734,35 +733,35 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if GetCurveMinMaxValues(state, mat->GlassSpecAngBRefleDataPtr, minAngValue, maxAngValue, minLamValue, maxLamValue); if (minAngValue > 1.0e-6) { ErrorsFound = true; - ShowSevereCustomMessage(state, - eoh, - format("{} requires the minumum value = 0.0 in the entered table name={}", - s_ipsc->cAlphaFieldNames(5), - s_ipsc->cAlphaArgs(5))); + ShowSevereCustom(state, + eoh, + format("{} requires the minumum value = 0.0 in the entered table name={}", + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); } if (std::abs(maxAngValue - 90.0) > 1.0e-6) { ErrorsFound = true; - ShowSevereCustomMessage(state, - eoh, - format("{} requires the maximum value = 90.0 in the entered table name={}", - s_ipsc->cAlphaFieldNames(5), - s_ipsc->cAlphaArgs(5))); + ShowSevereCustom(state, + eoh, + format("{} requires the maximum value = 90.0 in the entered table name={}", + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); } if (minLamValue < 0.1) { ErrorsFound = true; - ShowSevereCustomMessage(state, - eoh, - format("{} requires the minumum value = 0.1 micron in the entered table name={}", - s_ipsc->cAlphaFieldNames(5), - s_ipsc->cAlphaArgs(5))); + ShowSevereCustom(state, + eoh, + format("{} requires the minumum value = 0.1 micron in the entered table name={}", + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); } if (maxLamValue > 4.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, - eoh, - format("{} requires the maximum value = 4.0 microns in the entered table name={}", - s_ipsc->cAlphaFieldNames(5), - s_ipsc->cAlphaArgs(5))); + ShowSevereCustom(state, + eoh, + format("{} requires the maximum value = 4.0 microns in the entered table name={}", + s_ipsc->cAlphaFieldNames(5), + s_ipsc->cAlphaArgs(5))); } } } @@ -841,7 +840,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if if (s_ipsc->rNumericArgs(6) + s_ipsc->rNumericArgs(7) >= 1.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} + {} not < 1.0", s_ipsc->cNumericFieldNames(6), s_ipsc->cNumericFieldNames(7))); + ShowSevereCustom(state, eoh, format("{} + {} not < 1.0", s_ipsc->cNumericFieldNames(6), s_ipsc->cNumericFieldNames(7))); } if (s_ipsc->cAlphaArgs(2) == "") { @@ -1024,11 +1023,11 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if if (matGas->gases[0].vis.c0 <= 0.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} not > 0.0", s_ipsc->cNumericFieldNames(5))); + ShowSevereCustom(state, eoh, format("{} not > 0.0", s_ipsc->cNumericFieldNames(5))); } if (matGas->gases[0].cp.c0 <= 0.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} not > 0.0", s_ipsc->cNumericFieldNames(8))); + ShowSevereCustom(state, eoh, format("{} not > 0.0", s_ipsc->cNumericFieldNames(8))); } if (matGas->gases[0].wght <= 0.0) { ErrorsFound = true; @@ -1993,7 +1992,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if // Minimum and maximum slat angles allowed by slat geometry if (matBlind->SlatWidth > matBlind->SlatSeparation) { - MinSlatAngGeom = std::asin(matBlind->SlatThickness / (matBlind->SlatThickness + matBlind->SlatSeparation)) / Constant::DegToRadians; + MinSlatAngGeom = std::asin(matBlind->SlatThickness / (matBlind->SlatThickness + matBlind->SlatSeparation)) / Constant::DegToRad; } else { MinSlatAngGeom = 0.0; } @@ -2340,7 +2339,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if s_mat->materialMap.insert_or_assign(nameUC, mat->Num); if (NumNums + 1 != NumAlphas) { - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("Check number of {} compared to number of {}", s_ipsc->cAlphaFieldNames(2), s_ipsc->cNumericFieldNames(1))); ErrorsFound = true; continue; @@ -2365,7 +2364,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if auto *matGlass = s_mat->materials(matRef.matNum); // test that named material is of the right type if (matGlass->group != Group::Glass) { - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} = {}, Material is not a window glazing ", s_ipsc->cAlphaFieldNames(1 + iMatRef), s_ipsc->cAlphaArgs(1 + iMatRef))); @@ -2462,13 +2461,13 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if mat->Thickness = s_ipsc->rNumericArgs(1); if (s_ipsc->rNumericArgs(1) <= 0.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} must be > 0, entered {:.2R}", s_ipsc->cNumericFieldNames(1), s_ipsc->rNumericArgs(1))); + ShowSevereCustom(state, eoh, format("{} must be > 0, entered {:.2R}", s_ipsc->cNumericFieldNames(1), s_ipsc->rNumericArgs(1))); } mat->Pressure = s_ipsc->rNumericArgs(2); if (s_ipsc->rNumericArgs(2) <= 0.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, eoh, format("{} must be > 0, entered {:.2R}", s_ipsc->cNumericFieldNames(2), s_ipsc->rNumericArgs(2))); + ShowSevereCustom(state, eoh, format("{} must be > 0, entered {:.2R}", s_ipsc->cNumericFieldNames(2), s_ipsc->rNumericArgs(2))); } if (!s_ipsc->lAlphaFieldBlanks(2)) { @@ -2609,73 +2608,103 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if if (s_ipsc->rNumericArgs(1) <= 0.0) { ErrorsFound = true; - ShowSevereCustomMessage( - state, eoh, format("{} must be > 0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(1), s_ipsc->rNumericArgs(1))); + ShowSevereCustom(state, eoh, format("{} must be > 0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(1), s_ipsc->rNumericArgs(1))); } if (s_ipsc->rNumericArgs(2) <= 0.0) { ErrorsFound = true; - ShowSevereCustomMessage( - state, eoh, format("{} must be > 0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(2), s_ipsc->rNumericArgs(2))); + ShowSevereCustom(state, eoh, format("{} must be > 0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(2), s_ipsc->rNumericArgs(2))); } if ((s_ipsc->rNumericArgs(3) < 0.0) || (s_ipsc->rNumericArgs(3) > 1.0)) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} value must be >= 0 and <= 1, entered value = {:.2R}", s_ipsc->cNumericFieldNames(3), s_ipsc->rNumericArgs(3))); } if ((s_ipsc->rNumericArgs(4) <= 0.0) || (s_ipsc->rNumericArgs(4) > 1.0)) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} value must be >= 0 and <= 1, entered value = {:.2R}", s_ipsc->cNumericFieldNames(4), s_ipsc->rNumericArgs(4))); } if ((s_ipsc->rNumericArgs(5) <= 0.0) || (s_ipsc->rNumericArgs(5) > 1.0)) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} value must be >= 0 and <= 1, entered value = {:.2R}", s_ipsc->cNumericFieldNames(5), s_ipsc->rNumericArgs(5))); } if ((s_ipsc->rNumericArgs(6) < 0.0) || (s_ipsc->rNumericArgs(6) > 1.0)) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} must be >= 0 or <= 1, entered value = {:.2R}", s_ipsc->cNumericFieldNames(6), s_ipsc->rNumericArgs(6))); } if ((s_ipsc->rNumericArgs(7) < 0.0) || (s_ipsc->rNumericArgs(7) > 1.0)) { ErrorsFound = true; - ShowSevereCustomMessage( - state, eoh, format("{} must be >=0 or <=1, entered {:.2R}", s_ipsc->cNumericFieldNames(7), s_ipsc->rNumericArgs(7))); + ShowSevereCustom(state, eoh, format("{} must be >=0 or <=1, entered {:.2R}", s_ipsc->cNumericFieldNames(7), s_ipsc->rNumericArgs(7))); } if ((s_ipsc->rNumericArgs(8) < 0.0) || (s_ipsc->rNumericArgs(8) > 1.0)) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} must be >=0 or <=1, entered value = {:.2R}", s_ipsc->cNumericFieldNames(8), s_ipsc->rNumericArgs(8))); } if ((s_ipsc->rNumericArgs(9) < 0.0) || (s_ipsc->rNumericArgs(9) > 1.0)) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} must be >=0 or <=1, entered value = {:.2R}", s_ipsc->cNumericFieldNames(9), s_ipsc->rNumericArgs(9))); } if ((s_ipsc->rNumericArgs(10) < 0.0) || (s_ipsc->rNumericArgs(10) > 1.0)) { ErrorsFound = true; - ShowSevereCustomMessage( + ShowSevereCustom( state, eoh, format("{} must be >=0 or <=1, entered value = {:.2R}", s_ipsc->cNumericFieldNames(10), s_ipsc->rNumericArgs(10))); } if ((mat->LayerType == TARCOGParams::TARCOGLayerType::VENETBLIND_HORIZ) || (mat->LayerType == TARCOGParams::TARCOGLayerType::VENETBLIND_VERT)) { - if ((s_ipsc->rNumericArgs(16) > 0.0) && (s_ipsc->rNumericArgs(16) < (s_ipsc->rNumericArgs(11) / 2))) { + if (s_ipsc->rNumericArgs(11) <= 0.0) { ErrorsFound = true; - ShowSevereCustomMessage(state, - eoh, - format("{} must be = 0 or greater than SlatWidth/2, entered value = {:.2R}", - s_ipsc->cNumericFieldNames(16), - s_ipsc->rNumericArgs(16))); + ShowSevereCustom( + state, eoh, format("{} must be >0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(11), s_ipsc->rNumericArgs(11))); + } + + if (s_ipsc->rNumericArgs(12) <= 0.0) { + ErrorsFound = true; + ShowSevereCustom( + state, eoh, format("{} must be >0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(12), s_ipsc->rNumericArgs(12))); + } + + if (s_ipsc->rNumericArgs(13) <= 0.0) { + ErrorsFound = true; + ShowSevereCustom( + state, eoh, format("{} must be >0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(13), s_ipsc->rNumericArgs(13))); + } + + if ((s_ipsc->rNumericArgs(14) < -90.0) || (s_ipsc->rNumericArgs(14) > 90.0)) { + ErrorsFound = true; + ShowSevereCustom( + state, + eoh, + format("{} must be >=-90 and <=90, entered value = {:.2R}", s_ipsc->cNumericFieldNames(14), s_ipsc->rNumericArgs(14))); + } + + if (s_ipsc->rNumericArgs(15) <= 0.0) { + ErrorsFound = true; + ShowSevereCustom( + state, eoh, format("{} must be >0, entered value = {:.2R}", s_ipsc->cNumericFieldNames(15), s_ipsc->rNumericArgs(15))); + } + + if ((s_ipsc->rNumericArgs(16) < 0.0) || + ((s_ipsc->rNumericArgs(16) > 0.0) && (s_ipsc->rNumericArgs(16) < (s_ipsc->rNumericArgs(11) / 2)))) { + ErrorsFound = true; + ShowSevereCustom(state, + eoh, + format("{} must be = 0 or greater than SlatWidth/2, entered value = {:.2R}", + s_ipsc->cNumericFieldNames(16), + s_ipsc->rNumericArgs(16))); } } @@ -2812,13 +2841,13 @@ void GetVariableAbsorptanceInput(EnergyPlusData &state, bool &errorsFound) mat->absorpVarCtrlSignal = VariableAbsCtrlSignal::SurfaceTemperature; // default value mat->absorpVarCtrlSignal = static_cast(getEnumValue(variableAbsCtrlSignalNamesUC, s_ipsc->cAlphaArgs(3))); - // init to 0 as GetScheduleIndex returns 0 for not-found schedule + mat->absorpThermalVarFuncIdx = Curve::GetCurveIndex(state, s_ipsc->cAlphaArgs(4)); - mat->absorpThermalVarSchedIdx = ScheduleManager::GetScheduleIndex(state, s_ipsc->cAlphaArgs(5)); + mat->absorpThermalVarSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(5)); mat->absorpSolarVarFuncIdx = Curve::GetCurveIndex(state, s_ipsc->cAlphaArgs(6)); - mat->absorpSolarVarSchedIdx = ScheduleManager::GetScheduleIndex(state, s_ipsc->cAlphaArgs(7)); + mat->absorpSolarVarSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(7)); if (mat->absorpVarCtrlSignal == VariableAbsCtrlSignal::Scheduled) { - if ((mat->absorpThermalVarSchedIdx == 0) && (mat->absorpSolarVarSchedIdx == 0)) { + if ((mat->absorpThermalVarSched == nullptr) && (mat->absorpSolarVarSched == nullptr)) { ShowSevereError( state, format("{}: Control signal \"Scheduled\" is chosen but both thermal and solar absorptance schedules are undefined, for object {}", @@ -2846,7 +2875,7 @@ void GetVariableAbsorptanceInput(EnergyPlusData &state, bool &errorsFound) errorsFound = true; return; } - if ((mat->absorpThermalVarSchedIdx > 0) || (mat->absorpSolarVarSchedIdx > 0)) { + if ((mat->absorpThermalVarSched != nullptr) || (mat->absorpSolarVarSched != nullptr)) { ShowWarningError(state, format("{}: Non-schedule control signal is chosen. Thermal or solar absorptance schedule name is going to be " "ignored, for object {}", @@ -2921,7 +2950,7 @@ void GetWindowGlassSpectralData(EnergyPlusData &state, bool &ErrorsFound) // set specData.Name = s_ipsc->cAlphaArgs(1); int TotLam = NumNums / 4; if (mod(NumNums, 4) != 0) { - ShowWarningCustomMessage( + ShowWarningCustom( state, eoh, format("{} of items in data set is not a multiple of 4 (Wavelength,Trans,ReflFront,ReflBack), remainder items set to 0.0", NumNums)); @@ -2930,7 +2959,7 @@ void GetWindowGlassSpectralData(EnergyPlusData &state, bool &ErrorsFound) // set } if (TotLam > MaxSpectralDataElements) { - ShowSevereCustomMessage(state, eoh, format("More than {} entries in set ({})", MaxSpectralDataElements, NumNums)); + ShowSevereCustom(state, eoh, format("More than {} entries in set ({})", MaxSpectralDataElements, NumNums)); ErrorsFound = true; continue; } diff --git a/src/EnergyPlus/Material.hh b/src/EnergyPlus/Material.hh index 292984f4fdc..ec4d4ebd067 100644 --- a/src/EnergyPlus/Material.hh +++ b/src/EnergyPlus/Material.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -255,9 +256,9 @@ namespace Material { // dynamic thermal and solar absorptance coating parameters VariableAbsCtrlSignal absorpVarCtrlSignal = VariableAbsCtrlSignal::Invalid; - int absorpThermalVarSchedIdx = 0; + Sched::Schedule *absorpThermalVarSched = nullptr; int absorpThermalVarFuncIdx = 0; - int absorpSolarVarSchedIdx = 0; + Sched::Schedule *absorpSolarVarSched = nullptr; int absorpSolarVarFuncIdx = 0; bool hasEMPD = false; @@ -964,6 +965,10 @@ struct MaterialData : BaseGlobalStruct Array1D WindowThermalModel; Array1D SpectralData; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/MatrixDataManager.cc b/src/EnergyPlus/MatrixDataManager.cc index f7fb608268d..94c871d9f20 100644 --- a/src/EnergyPlus/MatrixDataManager.cc +++ b/src/EnergyPlus/MatrixDataManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/MatrixDataManager.hh b/src/EnergyPlus/MatrixDataManager.hh index ec630344c2f..4d927315032 100644 --- a/src/EnergyPlus/MatrixDataManager.hh +++ b/src/EnergyPlus/MatrixDataManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -130,6 +130,10 @@ struct MatrixDataManagerData : BaseGlobalStruct Array1D MatData; int NumMats; // number of matracies in input file + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/MicroCHPElectricGenerator.cc b/src/EnergyPlus/MicroCHPElectricGenerator.cc index 8694908e136..861040d07fd 100644 --- a/src/EnergyPlus/MicroCHPElectricGenerator.cc +++ b/src/EnergyPlus/MicroCHPElectricGenerator.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -134,6 +134,7 @@ void GetMicroCHPGeneratorInput(EnergyPlusData &state) // METHODOLOGY EMPLOYED: // EnergyPlus input processor + static constexpr std::string_view routineName = "GetMicroCHPGeneratorInput"; Array1D_string AlphArray(25); // character string data Array1D NumArray(200); // numeric data TODO deal with allocatable for extensible @@ -266,7 +267,7 @@ void GetMicroCHPGeneratorInput(EnergyPlusData &state) } if (!(allocated(state.dataCHPElectGen->MicroCHP))) { - state.dataCHPElectGen->MicroCHP.allocate(state.dataCHPElectGen->NumMicroCHPs); // inits handeled in derived type definitions + state.dataCHPElectGen->MicroCHP.allocate(state.dataCHPElectGen->NumMicroCHPs); // inits handled in derived type definitions } // load in Micro CHPs @@ -283,6 +284,9 @@ void GetMicroCHPGeneratorInput(EnergyPlusData &state) state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, state.dataIPShortCut->cCurrentModuleObject, AlphArray(1)}; + Util::IsNameEmpty(state, AlphArray(1), state.dataIPShortCut->cCurrentModuleObject, ErrorsFound); // GENERATOR:MICRO CHP, @@ -372,14 +376,10 @@ void GetMicroCHPGeneratorInput(EnergyPlusData &state) } if (state.dataIPShortCut->lAlphaFieldBlanks(9)) { - state.dataCHPElectGen->MicroCHP(GeneratorNum).AvailabilitySchedID = ScheduleManager::ScheduleAlwaysOn; - } else { - state.dataCHPElectGen->MicroCHP(GeneratorNum).AvailabilitySchedID = ScheduleManager::GetScheduleIndex(state, AlphArray(9)); - if (state.dataCHPElectGen->MicroCHP(GeneratorNum).AvailabilitySchedID == 0) { - ShowSevereError(state, format("Invalid, {} = {}", state.dataIPShortCut->cAlphaFieldNames(9), AlphArray(9))); - ShowContinueError(state, format("Entered in {}={}", state.dataIPShortCut->cCurrentModuleObject, AlphArray(1))); - ErrorsFound = true; - } + state.dataCHPElectGen->MicroCHP(GeneratorNum).availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((state.dataCHPElectGen->MicroCHP(GeneratorNum).availSched = Sched::GetSchedule(state, AlphArray(9))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(9), AlphArray(9)); + ErrorsFound = true; } state.dataCHPElectGen->MicroCHP(GeneratorNum).A42Model.TengLast = 20.0; // inits state.dataCHPElectGen->MicroCHP(GeneratorNum).A42Model.TempCWOutLast = 20.0; // inits @@ -696,11 +696,8 @@ void MicroCHPDataStruct::onInitLoopEquip(EnergyPlusData &state, const EnergyPlus { static constexpr std::string_view RoutineName("MicroCHPDataStruct::onInitLoopEquip"); - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->PlantInletNodeID).Temp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum) + .glycol->getDensity(state, state.dataLoopNodes->Node(this->PlantInletNodeID).Temp, RoutineName); if (this->A42Model.InternalFlowControl) { // got a curve this->PlantMassFlowRateMax = 2.0 * Curve::CurveValue( @@ -884,7 +881,7 @@ void MicroCHPDataStruct::CalcMicroCHPNoNormalizeGeneratorModel(EnergyPlusData &s Real64 ThermEff = 0.0; switch (CurrentOpMode) { - case DataGenerators::OperatingMode::Off: { // same as standby in model spec but no Pnet standby electicity losses. + case DataGenerators::OperatingMode::Off: { // same as standby in model spec but no Pnet standby electricity losses. Qgenss = 0.0; TcwIn = state.dataLoopNodes->Node(this->PlantInletNodeID).Temp; // C @@ -959,7 +956,7 @@ void MicroCHPDataStruct::CalcMicroCHPNoNormalizeGeneratorModel(EnergyPlusData &s NdotFuel = MdotFuel / state.dataGenerator->FuelSupply(this->FuelSupplyID).KmolPerSecToKgPerSec; Qgross = NdotFuel * (state.dataGenerator->FuelSupply(this->FuelSupplyID).LHV * 1000.0 * 1000.0); - for (int i = 1; i <= 20; ++i) { // iterating here could add use of seach method + for (int i = 1; i <= 20; ++i) { // iterating here could add use of search method Pnetss = Qgross * ElecEff; if (this->A42Model.InternalFlowControl) { MdotCW = GeneratorDynamicsManager::FuncDetermineCWMdotForInternalFlowControl(state, this->DynamicsControlID, Pnetss, TcwIn); @@ -1066,7 +1063,7 @@ void MicroCHPDataStruct::CalcMicroCHPNoNormalizeGeneratorModel(EnergyPlusData &s NdotFuel = MdotFuel / state.dataGenerator->FuelSupply(this->FuelSupplyID).KmolPerSecToKgPerSec; Qgross = NdotFuel * (state.dataGenerator->FuelSupply(this->FuelSupplyID).LHV * 1000.0 * 1000.0); - for (int i = 1; i <= 20; ++i) { // iterating here, could add use of seach method error signal + for (int i = 1; i <= 20; ++i) { // iterating here, could add use of search method error signal Pnetss = Qgross * ElecEff; if (this->A42Model.InternalFlowControl) { MdotCW = GeneratorDynamicsManager::FuncDetermineCWMdotForInternalFlowControl(state, this->DynamicsControlID, Pnetss, TcwIn); @@ -1159,11 +1156,7 @@ void MicroCHPDataStruct::CalcMicroCHPNoNormalizeGeneratorModel(EnergyPlusData &s Teng = FuncDetermineEngineTemp( TcwOut, this->A42Model.MCeng, this->A42Model.UAhx, this->A42Model.UAskin, thisAmbientTemp, Qgenss, this->A42Model.TengLast, dt); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - TcwIn, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getSpecificHeat(state, TcwIn, RoutineName); TcwOut = FuncDetermineCoolantWaterExitTemp(TcwIn, this->A42Model.MCcw, this->A42Model.UAhx, MdotCW * Cp, Teng, this->A42Model.TempCWOutLast, dt); @@ -1219,7 +1212,7 @@ Real64 FuncDetermineEngineTemp(Real64 const TcwOut, // hot water leaving temp // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: - // Calculate engine temperaure, + // Calculate engine temperature, // METHODOLOGY EMPLOYED: // model is dynamic in that previous condition affects current timestep @@ -1248,7 +1241,7 @@ Real64 FuncDetermineCoolantWaterExitTemp(Real64 const TcwIn, // hot water i // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: - // Calculate coolan water leaving temperaure, + // Calculate coolant water leaving temperature, // METHODOLOGY EMPLOYED: // model is dynamic in that previous condition affects current timestep @@ -1376,11 +1369,7 @@ void MicroCHPDataStruct::CalcUpdateHeatRecovery(EnergyPlusData &state) const state.dataLoopNodes->Node(this->PlantOutletNodeID).Temp = this->A42Model.TcwOut; - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - this->A42Model.TcwIn, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getSpecificHeat(state, this->A42Model.TcwIn, RoutineName); state.dataLoopNodes->Node(this->PlantOutletNodeID).Enthalpy = this->A42Model.TcwOut * Cp; } @@ -1411,11 +1400,7 @@ void MicroCHPDataStruct::UpdateMicroCHPGeneratorRecords(EnergyPlusData &state) / this->A42Model.ACEnergyGen = this->A42Model.Pnet * state.dataHVACGlobal->TimeStepSysSec; // energy produced (J) this->A42Model.QdotHX = this->A42Model.UAhx * (this->A42Model.Teng - this->A42Model.TcwOut); // heat recovered rate (W) - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - this->A42Model.TcwIn, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getSpecificHeat(state, this->A42Model.TcwIn, RoutineName); this->A42Model.QdotHR = this->PlantMassFlowRate * Cp * (this->A42Model.TcwOut - this->A42Model.TcwIn); this->A42Model.TotalHeatEnergyRec = this->A42Model.QdotHR * state.dataHVACGlobal->TimeStepSysSec; // heat recovered energy (J) @@ -1426,12 +1411,12 @@ void MicroCHPDataStruct::UpdateMicroCHPGeneratorRecords(EnergyPlusData &state) / this->A42Model.FuelCompressPower = state.dataGenerator->FuelSupply(this->FuelSupplyID).PfuelCompEl; // electrical power used by fuel supply compressor [W] this->A42Model.FuelCompressEnergy = - state.dataGenerator->FuelSupply(this->FuelSupplyID).PfuelCompEl * state.dataHVACGlobal->TimeStepSys * Constant::SecInHour; // elect energy + state.dataGenerator->FuelSupply(this->FuelSupplyID).PfuelCompEl * state.dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; // elect energy this->A42Model.FuelCompressSkinLoss = state.dataGenerator->FuelSupply(this->FuelSupplyID).QskinLoss; // heat rate of losses.by fuel supply compressor [W] this->A42Model.FuelEnergyHHV = this->A42Model.NdotFuel * state.dataGenerator->FuelSupply(this->FuelSupplyID).HHV * state.dataGenerator->FuelSupply(this->FuelSupplyID).KmolPerSecToKgPerSec * state.dataHVACGlobal->TimeStepSys * - Constant::SecInHour; + Constant::rSecsInHour; // reporting: Fuel Energy used (W) this->A42Model.FuelEnergyUseRateHHV = this->A42Model.NdotFuel * state.dataGenerator->FuelSupply(this->FuelSupplyID).HHV * state.dataGenerator->FuelSupply(this->FuelSupplyID).KmolPerSecToKgPerSec; diff --git a/src/EnergyPlus/MicroCHPElectricGenerator.hh b/src/EnergyPlus/MicroCHPElectricGenerator.hh index bf67f5b7635..fc4e1d47166 100644 --- a/src/EnergyPlus/MicroCHPElectricGenerator.hh +++ b/src/EnergyPlus/MicroCHPElectricGenerator.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -176,10 +176,10 @@ namespace MicroCHPElectricGenerator { int AirInletNodeID; std::string AirOutletNodeName; int AirOutletNodeID; - int FuelSupplyID; // index for fuel supply data structure - int DynamicsControlID; // index in GeneratorDynamics data where control issues are handled - int AvailabilitySchedID; // index for availability schedule - PlantLocation CWPlantLoc; // cooling water plant loop component index + int FuelSupplyID; // index for fuel supply data structure + int DynamicsControlID; // index in GeneratorDynamics data where control issues are handled + Sched::Schedule *availSched = nullptr; // index for availability schedule + PlantLocation CWPlantLoc; // cooling water plant loop component index bool CheckEquipName; bool MySizeFlag; bool MyEnvrnFlag; @@ -189,8 +189,8 @@ namespace MicroCHPElectricGenerator { // Default Constructor MicroCHPDataStruct() : NomEff(0.0), ZoneID(0), PlantInletNodeID(0), PlantOutletNodeID(0), PlantMassFlowRate(0.0), PlantMassFlowRateMax(0.0), - PlantMassFlowRateMaxWasAutoSized(false), AirInletNodeID(0), AirOutletNodeID(0), FuelSupplyID(0), DynamicsControlID(0), - AvailabilitySchedID(0), CWPlantLoc{}, CheckEquipName(true), MySizeFlag(true), MyEnvrnFlag(true), MyPlantScanFlag(true), myFlag(true) + PlantMassFlowRateMaxWasAutoSized(false), AirInletNodeID(0), AirOutletNodeID(0), FuelSupplyID(0), DynamicsControlID(0), CWPlantLoc{}, + CheckEquipName(true), MySizeFlag(true), MyEnvrnFlag(true), MyPlantScanFlag(true), myFlag(true) { } @@ -276,6 +276,10 @@ struct MicroCHPElectricGeneratorData : BaseGlobalStruct bool MyOneTimeFlag = true; bool MyEnvrnFlag = true; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/MicroturbineElectricGenerator.cc b/src/EnergyPlus/MicroturbineElectricGenerator.cc index 22791b28da1..002879a1cd1 100644 --- a/src/EnergyPlus/MicroturbineElectricGenerator.cc +++ b/src/EnergyPlus/MicroturbineElectricGenerator.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -418,7 +418,7 @@ void GetMTGeneratorInput(EnergyPlusData &state) Real64 RefFuelUseMdot = (state.dataMircoturbElectGen->MTGenerator(GeneratorNum).RefElecPowerOutput / state.dataMircoturbElectGen->MTGenerator(GeneratorNum).RefElecEfficiencyLHV) / (state.dataMircoturbElectGen->MTGenerator(GeneratorNum).FuelLowerHeatingValue * 1000.0); - // Output of Ancillary Power Modifer Curve (function of temps and fuel flow) + // Output of Ancillary Power Modifier Curve (function of temps and fuel flow) Real64 AncillaryPowerOutput = Curve::CurveValue(state, state.dataMircoturbElectGen->MTGenerator(GeneratorNum).AncillaryPowerFuelCurveNum, RefFuelUseMdot); if (std::abs(AncillaryPowerOutput - 1.0) > 0.1) { @@ -1251,11 +1251,7 @@ void MTGeneratorSpecs::CalcMTGeneratorModel(EnergyPlusData &state, if (this->HeatRecActive) { HeatRecInTemp = state.dataLoopNodes->Node(this->HeatRecInletNodeNum).Temp; - HeatRecCp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidName, - HeatRecInTemp, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidIndex, - RoutineName); + HeatRecCp = state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).glycol->getSpecificHeat(state, HeatRecInTemp, RoutineName); heatRecMdot = state.dataLoopNodes->Node(this->HeatRecInletNodeNum).MassFlowRate; } else { HeatRecInTemp = 0.0; @@ -1585,11 +1581,7 @@ void MTGeneratorSpecs::CalcMTGeneratorModel(EnergyPlusData &state, // Calculate heat recovery rate modifier curve output (function of water [volumetric] flow rate) if (this->HeatRecRateFWaterFlowCurveNum > 0) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidName, - HeatRecInTemp, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).glycol->getDensity(state, HeatRecInTemp, RoutineName); // Heat recovery fluid flow rate (m3/s) Real64 HeatRecVolFlowRate = heatRecMdot / rho; @@ -1958,11 +1950,7 @@ void MTGeneratorSpecs::oneTimeInit(EnergyPlusData &state) if (this->MySizeAndNodeInitFlag && (!this->MyPlantScanFlag) && this->HeatRecActive) { // size mass flow rate - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); this->DesignHeatRecMassFlowRate = rho * this->RefHeatRecVolFlowRate; this->HeatRecMaxMassFlowRate = rho * this->HeatRecMaxVolFlowRate; diff --git a/src/EnergyPlus/MicroturbineElectricGenerator.hh b/src/EnergyPlus/MicroturbineElectricGenerator.hh index 2b72a7adf4a..34079bf41e6 100644 --- a/src/EnergyPlus/MicroturbineElectricGenerator.hh +++ b/src/EnergyPlus/MicroturbineElectricGenerator.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -235,6 +235,10 @@ struct MicroturbineElectricGeneratorData : BaseGlobalStruct bool GetMTInput = true; EPVector MTGenerator; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/MixedAir.cc b/src/EnergyPlus/MixedAir.cc index d10119a85d4..42e4a7fa0c2 100644 --- a/src/EnergyPlus/MixedAir.cc +++ b/src/EnergyPlus/MixedAir.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -132,7 +132,6 @@ namespace EnergyPlus::MixedAir { using namespace DataLoopNode; using namespace DataAirLoop; using namespace DataEnvironment; -using namespace ScheduleManager; using namespace DataSizing; using namespace FaultsManager; @@ -431,7 +430,7 @@ void SimOAComponent(EnergyPlusData &state, bool const FirstHVACIteration, int &CompIndex, int const AirLoopNum, // air loop index for economizer lockout coordination - bool const Sim, // if TRUE, simulate component; if FALSE, just set the coil exisitence flags + bool const Sim, // if TRUE, simulate component; if FALSE, just set the coil existence flags int const OASysNum, // index to outside air system bool &OAHeatingCoil, // TRUE indicates a heating coil has been found bool &OACoolingCoil, // TRUE indicates a cooling coil has been found @@ -1153,6 +1152,7 @@ void GetOAControllerInputs(EnergyPlusData &state) // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetOAControllerInputs: "); // include trailing blank space + static constexpr std::string_view routineName = "GetOAControllerInputs"; // include trailing blank space // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumArg; // Number of arguments from GetObjectDefMaxArgs call @@ -1238,7 +1238,7 @@ void GetOAControllerInputs(EnergyPlusData &state) ErrorsFound); // add applicable faults identifier to avoid string comparison at each time step - // loop through each fault for each OA controller and determine economizer faultys + // loop through each fault for each OA controller and determine economizer faults for (int i = 1; i <= state.dataFaultsMgr->NumFaultyEconomizer; ++i) { if (state.dataFaultsMgr->FaultsEconomizer(i).ControllerTypeEnum != iController_AirEconomizer) continue; if (Util::SameString(state.dataMixedAir->OAController(OutAirNum).Name, state.dataFaultsMgr->FaultsEconomizer(i).ControllerName)) { @@ -1291,21 +1291,19 @@ void GetOAControllerInputs(EnergyPlusData &state) cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, AlphArray(1)}; + int MechVentZoneCount = 0; int NumGroups = (NumAlphas + NumNums - 5) / 3; // Number of extensible input groups of the VentilationMechanical object if (mod((NumAlphas + NumNums - 5), 3) != 0) ++NumGroups; thisVentilationMechanical.Name = AlphArray(1); // no need to check if AlphaArray(1) is empty since Json will catch missing required fields - thisVentilationMechanical.SchName = AlphArray(2); + if (lAlphaBlanks(2)) { - thisVentilationMechanical.SchPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisVentilationMechanical.SchPtr = GetScheduleIndex(state, AlphArray(2)); // convert schedule name to pointer - if (thisVentilationMechanical.SchPtr == 0) { - ShowSevereError( - state, format("{}=\"{}\" invalid {}=\"{}\" not found.", CurrentModuleObject, AlphArray(1), cAlphaFields(2), AlphArray(2))); - ErrorsFound = true; - } + thisVentilationMechanical.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisVentilationMechanical.availSched = Sched::GetSchedule(state, AlphArray(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), AlphArray(2)); + ErrorsFound = true; } // Adding new flag for DCV @@ -1567,8 +1565,8 @@ void GetOAControllerInputs(EnergyPlusData &state) thisVentMechZone.ZoneOAFlowRate = curOARequirements.OAFlowPerZone; thisVentMechZone.ZoneOAACHRate = curOARequirements.OAFlowACH; thisVentMechZone.ZoneOAFlowMethod = curOARequirements.OAFlowMethod; - thisVentMechZone.ZoneOASchPtr = curOARequirements.OAFlowFracSchPtr; - thisVentMechZone.OAPropCtlMinRateSchPtr = curOARequirements.OAPropCtlMinRateSchPtr; + thisVentMechZone.zoneOASched = curOARequirements.oaFlowFracSched; + thisVentMechZone.oaPropCtlMinRateSched = curOARequirements.oaPropCtlMinRateSched; if (thisVentilationMechanical.SystemOAMethod == DataSizing::SysOAMethod::ProportionalControlDesOARate) { if (thisVentMechZone.ZoneOAPeopleRate == 0.0 && thisVentMechZone.ZoneOAAreaRate == 0.0) { ShowSevereError( @@ -1591,7 +1589,8 @@ void GetOAControllerInputs(EnergyPlusData &state) thisVentMechZone.ZoneOAFlowRate = 0.0; thisVentMechZone.ZoneOAACHRate = 0.0; thisVentMechZone.ZoneOAFlowMethod = OAFlowCalcMethod::PerPerson; - thisVentMechZone.ZoneOASchPtr = ScheduleManager::ScheduleAlwaysOn; + thisVentMechZone.zoneOASched = + Sched::GetScheduleAlwaysOn(state); // defaults to constant-1.0. TODO: what is this really suppoed to be? ShowWarningError(state, format("{}{}=\"{}", RoutineName, CurrentModuleObject, thisVentilationMechanical.Name)); ShowContinueError( state, format("Cannot locate a matching DesignSpecification:OutdoorAir object for Zone=\"{}\".", thisVentMechZone.name)); @@ -1602,7 +1601,7 @@ void GetOAControllerInputs(EnergyPlusData &state) auto const &curZoneAirDistribution(state.dataSize->ZoneAirDistribution(zoneAirDistObjIndex)); thisVentMechZone.ZoneADEffCooling = curZoneAirDistribution.ZoneADEffCooling; thisVentMechZone.ZoneADEffHeating = curZoneAirDistribution.ZoneADEffHeating; - thisVentMechZone.ZoneADEffSchPtr = curZoneAirDistribution.ZoneADEffSchPtr; + thisVentMechZone.zoneADEffSched = curZoneAirDistribution.zoneADEffSched; thisVentMechZone.ZoneSecondaryRecirculation = curZoneAirDistribution.ZoneSecondaryRecirculation; } else { // use defaults thisVentMechZone.ZoneADEffCooling = 1.0; @@ -1774,28 +1773,23 @@ void GetOAControllerInputs(EnergyPlusData &state) "{Yes/No},System Outdoor Air Method,Zone Maximum Outdoor Air Fraction,Number of Zones,Zone Name,DSOA " "Name,DSZAD Name"); print(state.files.eio, "{}\n", Format_700); - for (int VentMechNum = 1; VentMechNum <= state.dataMixedAir->NumVentMechControllers; ++VentMechNum) { - auto &thisVentilationMechanical(state.dataMixedAir->VentilationMechanical(VentMechNum)); - print(state.files.eio, " Controller:MechanicalVentilation,{},{},", thisVentilationMechanical.Name, thisVentilationMechanical.SchName); + for (auto const &ventMech : state.dataMixedAir->VentilationMechanical) { + print(state.files.eio, " Controller:MechanicalVentilation,{},{},", ventMech.Name, ventMech.availSched ? ventMech.availSched->Name : ""); - if (thisVentilationMechanical.DCVFlag) { - print(state.files.eio, "Yes,"); - } else { - print(state.files.eio, "No,"); - } + print(state.files.eio, format("{},", yesNoNames[(int)ventMech.DCVFlag])); - if (thisVentilationMechanical.SystemOAMethod != DataSizing::SysOAMethod::Invalid) { - print(state.files.eio, printSysOAMethod[static_cast(thisVentilationMechanical.SystemOAMethod)]); + if (ventMech.SystemOAMethod != DataSizing::SysOAMethod::Invalid) { + print(state.files.eio, printSysOAMethod[(int)ventMech.SystemOAMethod]); } else { print(state.files.eio, "Invalid/Unknown,"); } - print(state.files.eio, "{:.2R},", thisVentilationMechanical.ZoneMaxOAFraction); - print(state.files.eio, "{},", thisVentilationMechanical.NumofVentMechZones); + print(state.files.eio, "{:.2R},", ventMech.ZoneMaxOAFraction); + print(state.files.eio, "{},", ventMech.NumofVentMechZones); - for (int jZone = 1; jZone <= thisVentilationMechanical.NumofVentMechZones; ++jZone) { - auto &thisVentMechZone = thisVentilationMechanical.VentMechZone(jZone); - if (jZone < thisVentilationMechanical.NumofVentMechZones) { + for (int jZone = 1; jZone <= ventMech.NumofVentMechZones; ++jZone) { + auto &thisVentMechZone = ventMech.VentMechZone(jZone); + if (jZone < ventMech.NumofVentMechZones) { print(state.files.eio, "{},{},{},", state.dataHeatBal->Zone(thisVentMechZone.zoneNum).Name, @@ -2022,9 +2016,9 @@ void ProcessOAControllerInputs(EnergyPlusData &state, std::string_view const CurrentModuleObject, int const OutAirNum, Array1D_string const &AlphArray, - int &NumAlphas, + int const NumAlphas, Array1D const &NumArray, - int &NumNums, + int const NumNums, Array1D_bool const &lNumericBlanks, // Unused Array1D_bool const &lAlphaBlanks, Array1D_string const &cAlphaFields, @@ -2047,6 +2041,9 @@ void ProcessOAControllerInputs(EnergyPlusData &state, // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetOAControllerInputs: "); // include trailing blank space + static constexpr std::string_view routineName = "GetOAControllerInputs"; + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, AlphArray(1)}; state.dataMixedAir->OAController(OutAirNum).Name = AlphArray(1); state.dataMixedAir->OAController(OutAirNum).ControllerType = MixedAirControllerType::ControllerOutsideAir; @@ -2182,31 +2179,29 @@ void ProcessOAControllerInputs(EnergyPlusData &state, DataLoopNode::ConnectionType::Sensor, NodeInputManager::CompFluidStream::Primary, ObjectIsNotParent); - state.dataMixedAir->OAController(OutAirNum).MinOASch = AlphArray(11); - state.dataMixedAir->OAController(OutAirNum).MinOASchPtr = GetScheduleIndex(state, AlphArray(11)); - if (state.dataMixedAir->OAController(OutAirNum).MinOASchPtr == 0 && (!lAlphaBlanks(11))) { - ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\" not found.", CurrentModuleObject, AlphArray(1), cAlphaFields(11), AlphArray(11))); + + if (lAlphaBlanks(11)) { + } else if ((state.dataMixedAir->OAController(OutAirNum).minOASched = Sched::GetSchedule(state, AlphArray(11))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(11), AlphArray(11)); ErrorsFound = true; } // Changed by Amit for new feature implementation - state.dataMixedAir->OAController(OutAirNum).MinOAflowSch = AlphArray(12); - state.dataMixedAir->OAController(OutAirNum).MinOAflowSchPtr = GetScheduleIndex(state, AlphArray(12)); - if (state.dataMixedAir->OAController(OutAirNum).MinOAflowSchPtr == 0 && (!lAlphaBlanks(12))) { - ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\" not found.", CurrentModuleObject, AlphArray(1), cAlphaFields(12), AlphArray(12))); + if (lAlphaBlanks(12)) { + } else if ((state.dataMixedAir->OAController(OutAirNum).minOAflowSched = Sched::GetSchedule(state, AlphArray(12))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(12), AlphArray(12)); ErrorsFound = true; } - state.dataMixedAir->OAController(OutAirNum).MaxOAflowSch = AlphArray(13); - state.dataMixedAir->OAController(OutAirNum).MaxOAflowSchPtr = GetScheduleIndex(state, AlphArray(13)); - if (state.dataMixedAir->OAController(OutAirNum).MaxOAflowSchPtr == 0 && (!lAlphaBlanks(13))) { - ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\" not found.", CurrentModuleObject, AlphArray(1), cAlphaFields(13), AlphArray(13))); + if (lAlphaBlanks(13)) { + } else if ((state.dataMixedAir->OAController(OutAirNum).maxOAflowSched = Sched::GetSchedule(state, AlphArray(13))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(13), AlphArray(13)); ErrorsFound = true; } state.dataMixedAir->OAController(OutAirNum).VentilationMechanicalName = AlphArray(14); // Check for a time of day economizer control schedule - state.dataMixedAir->OAController(OutAirNum).EconomizerOASchedPtr = GetScheduleIndex(state, AlphArray(15)); + state.dataMixedAir->OAController(OutAirNum).economizerOASched = Sched::GetSchedule(state, AlphArray(15)); // High humidity control option can be used with any economizer flag if (Util::SameString(AlphArray(16), "Yes")) { @@ -2722,14 +2717,14 @@ void InitOAController(EnergyPlusData &state, int const OAControllerNum, bool con tempMechVentZone.ZoneOAFlowRate = thisMechVentZone.ZoneOAFlowRate; tempMechVentZone.ZoneOAACHRate = thisMechVentZone.ZoneOAACHRate; tempMechVentZone.ZoneOAFlowMethod = thisMechVentZone.ZoneOAFlowMethod; - tempMechVentZone.ZoneOASchPtr = thisMechVentZone.ZoneOASchPtr; + tempMechVentZone.zoneOASched = thisMechVentZone.zoneOASched; tempMechVentZone.ZoneDesignSpecOAObjIndex = thisMechVentZone.ZoneDesignSpecOAObjIndex; tempMechVentZone.ZoneDesignSpecOAObjName = thisMechVentZone.ZoneDesignSpecOAObjName; // new DCV tempMechVentZone.ZoneADEffCooling = thisMechVentZone.ZoneADEffCooling; tempMechVentZone.ZoneADEffHeating = thisMechVentZone.ZoneADEffHeating; - tempMechVentZone.ZoneADEffSchPtr = thisMechVentZone.ZoneADEffSchPtr; + tempMechVentZone.zoneADEffSched = thisMechVentZone.zoneADEffSched; } // Sum outside air per unit floor area for each mechanical ventilation object only once per simulation @@ -2775,21 +2770,19 @@ void InitOAController(EnergyPlusData &state, int const OAControllerNum, bool con OAFlowCalcMethodNames[static_cast(thisMechVentZone.ZoneOAFlowMethod)]); OutputReportPredefined::PreDefTableEntry( state, state.dataOutRptPredefined->pdchDCVType, zoneName, SysOAMethodNames[static_cast(vent_mech.SystemOAMethod)]); - if (thisMechVentZone.ZoneOASchPtr > 0) { + if (thisMechVentZone.zoneOASched != nullptr) { OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchDCVOASchName, zoneName, GetScheduleName(state, thisMechVentZone.ZoneOASchPtr)); + state, state.dataOutRptPredefined->pdchDCVOASchName, zoneName, thisMechVentZone.zoneOASched->Name); } else { OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchDCVOASchName, zoneName, ""); } // added for new DCV inputs - if (thisMechVentZone.ZoneADEffSchPtr > 0) { + if (thisMechVentZone.zoneADEffSched != nullptr) { OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchDCVZoneADEffCooling, zoneName, ""); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchDCVZoneADEffHeating, zoneName, ""); - OutputReportPredefined::PreDefTableEntry(state, - state.dataOutRptPredefined->pdchDCVZoneADEffSchName, - zoneName, - GetScheduleName(state, thisMechVentZone.ZoneADEffSchPtr)); + OutputReportPredefined::PreDefTableEntry( + state, state.dataOutRptPredefined->pdchDCVZoneADEffSchName, zoneName, thisMechVentZone.zoneADEffSched->Name); } else { OutputReportPredefined::PreDefTableEntry( state, state.dataOutRptPredefined->pdchDCVZoneADEffCooling, zoneName, thisMechVentZone.ZoneADEffCooling, 2); @@ -3121,13 +3114,13 @@ void InitOAController(EnergyPlusData &state, int const OAControllerNum, bool con OAFlowMethod == OAFlowCalcMethod::Max) { TotalPeopleOAFlow += state.dataHeatBal->ZoneIntGain(ZoneNum).NOFOCC * state.dataHeatBal->Zone(ZoneNum).Multiplier * state.dataHeatBal->Zone(ZoneNum).ListMultiplier * thisVentMechZone.ZoneOAPeopleRate * - GetCurrentScheduleValue(state, thisVentMechZone.ZoneOASchPtr); + thisVentMechZone.zoneOASched->getCurrentVal(); } } vent_mech.TotPeopleOAFlow = TotalPeopleOAFlow; } } else { - // Stand Alone ERV does not require a termperature setpoint schedule, make setpoint equal to lower economizer limit + // Stand Alone ERV does not require a temperature setpoint schedule, make setpoint equal to lower economizer limit thisOAController.MixSetTemp = thisOAController.TempLowLim; } } @@ -3193,10 +3186,10 @@ void InitOAController(EnergyPlusData &state, int const OAControllerNum, bool con for (int i = 1; i <= thisOAController.NumFaultyEconomizer; ++i) { int j = thisOAController.EconmizerFaultNum(i); Real64 rSchVal = 0.0; - if (GetCurrentScheduleValue(state, state.dataFaultsMgr->FaultsEconomizer(j).availSchedNum) > 0.0) { + if (state.dataFaultsMgr->FaultsEconomizer(j).availSched->getCurrentVal() > 0.0) { rSchVal = 1.0; - if (state.dataFaultsMgr->FaultsEconomizer(j).severitySchedNum > 0) { - rSchVal = GetCurrentScheduleValue(state, state.dataFaultsMgr->FaultsEconomizer(j).severitySchedNum); + if (state.dataFaultsMgr->FaultsEconomizer(j).severitySched != nullptr) { + rSchVal = state.dataFaultsMgr->FaultsEconomizer(j).severitySched->getCurrentVal(); } } else { continue; // no fault @@ -3365,7 +3358,7 @@ void OAControllerProps::CalcOAController(EnergyPlusData &state, int const AirLoo this->HeatRecoveryBypassStatus = 0; // HR bypass status for reporting this->HRHeatingCoilActive = 0; // resets report variable this->MixedAirTempAtMinOAFlow = state.dataLoopNodes->Node(this->RetNode).Temp; // track return T - this->HighHumCtrlStatus = 0; // high humdity control status for reporting + this->HighHumCtrlStatus = 0; // high humidity control status for reporting this->OAFractionRpt = 0.0; // actual OA fraction for reporting this->EconoActive = false; // DataAirLoop variable (OA Controllers) @@ -3400,8 +3393,8 @@ void OAControllerProps::CalcOAController(EnergyPlusData &state, int const AirLoo } } Real64 MinOASchedVal = 1.0; // value of the minimum outside air schedule - if (this->MinOASchPtr > 0) { - MinOASchedVal = GetCurrentScheduleValue(state, this->MinOASchPtr); + if (this->minOASched != nullptr) { + MinOASchedVal = this->minOASched->getCurrentVal(); MinOASchedVal = min(max(MinOASchedVal, 0.0), 1.0); OutAirMinFrac *= MinOASchedVal; this->OALimitingFactor = OALimitFactor::Limits; @@ -3516,8 +3509,8 @@ void OAControllerProps::CalcOAController(EnergyPlusData &state, int const AirLoo } // Apply Minimum Fraction of Outdoor Air Schedule - if (this->MinOAflowSchPtr > 0) { - Real64 MinOAflowfracVal = GetCurrentScheduleValue(state, this->MinOAflowSchPtr); + if (this->minOAflowSched != nullptr) { + Real64 MinOAflowfracVal = this->minOAflowSched->getCurrentVal(); MinOAflowfracVal = min(max(MinOAflowfracVal, 0.0), 1.0); OutAirMinFrac = max(MinOAflowfracVal, OutAirMinFrac); Real64 minOAFracMassFlowRate = this->MixMassFlow * MinOAflowfracVal; @@ -3529,8 +3522,8 @@ void OAControllerProps::CalcOAController(EnergyPlusData &state, int const AirLoo // Apply Maximum Fraction of Outdoor Air Schedule Real64 currentMaxOAMassFlowRate = this->MaxOAMassFlowRate; - if (this->MaxOAflowSchPtr > 0) { - Real64 MaxOAflowfracVal = GetCurrentScheduleValue(state, this->MaxOAflowSchPtr); + if (this->maxOAflowSched != nullptr) { + Real64 MaxOAflowfracVal = this->maxOAflowSched->getCurrentVal(); MaxOAflowfracVal = min(max(MaxOAflowfracVal, 0.0), 1.0); currentMaxOAMassFlowRate = min(this->MaxOAMassFlowRate, this->MixMassFlow * MaxOAflowfracVal); OutAirMinFrac = min(MaxOAflowfracVal, OutAirMinFrac); @@ -3665,22 +3658,22 @@ Real64 VentilationMechanicalProps::CalcMechVentController(EnergyPlusData &state, Real64 SysEv; // System ventilation efficiency Real64 NodeTemp; // node temperature Real64 NodeHumRat; // node humidity ratio - Real64 ZoneMaxCO2 = 0.0; // Breathing-zone CO2 concentartion + Real64 ZoneMaxCO2 = 0.0; // Breathing-zone CO2 concentration Real64 ZoneMinCO2 = 0.0; // Minimum CO2 concentration in zone Real64 ZoneOAMin = 0.0; // Minimum Zone OA flow rate when the zone is unoccupied (i.e. ZoneOAPeople = 0) Real64 ZoneOAMax = 0.0; // Maximum Zone OA flow rate (ZoneOAPeople + ZoneOACalc[static_cast(DataSizing::OAFlowCalcMethod::PerArea)]) Real64 MechVentOAMassFlow = 0.0; // Apply mechanical ventilation only when it is available/allowed - if (GetCurrentScheduleValue(state, this->SchPtr) > 0) { + if (this->availSched->getCurrentVal() > 0) { Real64 SysOAMassFlow = 0.0; // System supply OA mass flow rate [kg/s] if (this->SystemOAMethod == DataSizing::SysOAMethod::IAQP) { // IAQP for CO2 control for (int ZoneIndex = 1; ZoneIndex <= this->NumofVentMechZones; ++ZoneIndex) { auto &thisMechVentZone = this->VentMechZone(ZoneIndex); int ZoneNum = thisMechVentZone.zoneNum; - SysOAMassFlow += state.dataContaminantBalance->ZoneSysContDemand(ZoneNum).OutputRequiredToCO2SP * - GetCurrentScheduleValue(state, thisMechVentZone.ZoneOASchPtr); + SysOAMassFlow += + state.dataContaminantBalance->ZoneSysContDemand(ZoneNum).OutputRequiredToCO2SP * thisMechVentZone.zoneOASched->getCurrentVal(); } MechVentOAMassFlow = SysOAMassFlow; } else if (this->SystemOAMethod == DataSizing::SysOAMethod::IAQPGC) { @@ -3688,8 +3681,8 @@ Real64 VentilationMechanicalProps::CalcMechVentController(EnergyPlusData &state, for (int ZoneIndex = 1; ZoneIndex <= this->NumofVentMechZones; ++ZoneIndex) { auto &thisMechVentZone = this->VentMechZone(ZoneIndex); int ZoneNum = thisMechVentZone.zoneNum; - SysOAMassFlow += state.dataContaminantBalance->ZoneSysContDemand(ZoneNum).OutputRequiredToGCSP * - GetCurrentScheduleValue(state, thisMechVentZone.ZoneOASchPtr); + SysOAMassFlow += + state.dataContaminantBalance->ZoneSysContDemand(ZoneNum).OutputRequiredToGCSP * thisMechVentZone.zoneOASched->getCurrentVal(); } MechVentOAMassFlow = SysOAMassFlow; } else if (this->SystemOAMethod == DataSizing::SysOAMethod::IAQPCOM) { @@ -3698,16 +3691,16 @@ Real64 VentilationMechanicalProps::CalcMechVentController(EnergyPlusData &state, for (int ZoneIndex = 1; ZoneIndex <= this->NumofVentMechZones; ++ZoneIndex) { auto &thisMechVentZone = this->VentMechZone(ZoneIndex); int ZoneNum = thisMechVentZone.zoneNum; - SysOAMassFlow += state.dataContaminantBalance->ZoneSysContDemand(ZoneNum).OutputRequiredToCO2SP * - GetCurrentScheduleValue(state, thisMechVentZone.ZoneOASchPtr); + SysOAMassFlow += + state.dataContaminantBalance->ZoneSysContDemand(ZoneNum).OutputRequiredToCO2SP * thisMechVentZone.zoneOASched->getCurrentVal(); } MechVentOAMassFlow = SysOAMassFlow; SysOAMassFlow = 0.0; for (int ZoneIndex = 1; ZoneIndex <= this->NumofVentMechZones; ++ZoneIndex) { auto &thisMechVentZone = this->VentMechZone(ZoneIndex); int ZoneNum = thisMechVentZone.zoneNum; - SysOAMassFlow += state.dataContaminantBalance->ZoneSysContDemand(ZoneNum).OutputRequiredToGCSP * - GetCurrentScheduleValue(state, thisMechVentZone.ZoneOASchPtr); + SysOAMassFlow += + state.dataContaminantBalance->ZoneSysContDemand(ZoneNum).OutputRequiredToGCSP * thisMechVentZone.zoneOASched->getCurrentVal(); } MechVentOAMassFlow = max(SysOAMassFlow, MechVentOAMassFlow); } else { @@ -3721,7 +3714,7 @@ Real64 VentilationMechanicalProps::CalcMechVentController(EnergyPlusData &state, auto &thisMechVentZone = this->VentMechZone(ZoneIndex); int ZoneNum = thisMechVentZone.zoneNum; auto const &curZone(state.dataHeatBal->Zone(ZoneNum)); - Real64 multiplier = curZone.Multiplier * curZone.ListMultiplier * GetCurrentScheduleValue(state, thisMechVentZone.ZoneOASchPtr); + Real64 multiplier = curZone.Multiplier * curZone.ListMultiplier * thisMechVentZone.zoneOASched->getCurrentVal(); // Calc the zone OA flow rate based on the people component // ZoneIntGain(ZoneNum)%NOFOCC is the number of occupants of a zone at each time step, already counting the occupant schedule @@ -3800,7 +3793,7 @@ Real64 VentilationMechanicalProps::CalcMechVentController(EnergyPlusData &state, // Assign references auto &curZone(state.dataHeatBal->Zone(ZoneNum)); auto &curZoneSysEnergyDemand(state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneEquipConfigNum)); - Real64 multiplier = curZone.Multiplier * curZone.ListMultiplier * GetCurrentScheduleValue(state, thisMechVentZone.ZoneOASchPtr); + Real64 multiplier = curZone.Multiplier * curZone.ListMultiplier * thisMechVentZone.zoneOASched->getCurrentVal(); // Calc the zone OA flow rate based on the people component // ZoneIntGain(ZoneNum)%NOFOCC is the number of occupants of a zone at each time step, already counting the occupant schedule @@ -3848,10 +3841,9 @@ Real64 VentilationMechanicalProps::CalcMechVentController(EnergyPlusData &state, // Calc the zone supplied OA flow rate counting the zone air distribution effectiveness // First check whether the zone air distribution effectiveness schedule exists, if yes uses it; // otherwise uses the inputs of zone distribution effectiveness in cooling mode or heating mode - int ADEffSchPtr = thisMechVentZone.ZoneADEffSchPtr; - if (ADEffSchPtr > 0) { + if (thisMechVentZone.zoneADEffSched != nullptr) { // Get schedule value for the zone air distribution effectiveness - ZoneEz = GetCurrentScheduleValue(state, ADEffSchPtr); + ZoneEz = thisMechVentZone.zoneADEffSched->getCurrentVal(); } else { Real64 ZoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).TotalOutputRequired; @@ -3875,18 +3867,18 @@ Real64 VentilationMechanicalProps::CalcMechVentController(EnergyPlusData &state, this->SystemOAMethod == DataSizing::SysOAMethod::ProportionalControlDesOcc || this->SystemOAMethod == DataSizing::SysOAMethod::ProportionalControlDesOARate) { // Check whether "Carbon Dioxide Control Availability Schedule" for ZoneControl:ContaminantController is specified - if (curZone.ZoneContamControllerSchedIndex > 0.0) { + if (curZone.zoneContamControllerSched != nullptr) { // Check the availability schedule value for ZoneControl:ContaminantController - Real64 ZoneContamControllerSched = GetCurrentScheduleValue(state, curZone.ZoneContamControllerSchedIndex); - if (ZoneContamControllerSched > 0.0) { + Real64 ZoneContamControllerSchedVal = curZone.zoneContamControllerSched->getCurrentVal(); + if (ZoneContamControllerSchedVal > 0.0) { ZoneOAMin = ZoneOACalc[static_cast(DataSizing::OAFlowCalcMethod::PerArea)] / ZoneEz; ZoneOAMax = (ZoneOACalc[static_cast(DataSizing::OAFlowCalcMethod::PerArea)] + ZoneOACalc[static_cast(DataSizing::OAFlowCalcMethod::PerPerson)]) / ZoneEz; if (this->SystemOAMethod == DataSizing::SysOAMethod::ProportionalControlDesOARate) { ZoneOAMax = ZoneOABZ / ZoneEz; - if (thisMechVentZone.OAPropCtlMinRateSchPtr > 0) { - ZoneOAMin = ZoneOAMax * GetCurrentScheduleValue(state, thisMechVentZone.OAPropCtlMinRateSchPtr); + if (thisMechVentZone.oaPropCtlMinRateSched != nullptr) { + ZoneOAMin = ZoneOAMax * thisMechVentZone.oaPropCtlMinRateSched->getCurrentVal(); } else { ZoneOAMin = ZoneOAMax; } @@ -3919,10 +3911,10 @@ Real64 VentilationMechanicalProps::CalcMechVentController(EnergyPlusData &state, if (ZoneOACalc[static_cast(DataSizing::OAFlowCalcMethod::PerPerson)] > 0.0) { if (state.dataContaminantBalance->ZoneCO2GainFromPeople(ZoneNum) > 0.0) { - if (curZone.ZoneMinCO2SchedIndex > 0.0) { + if (curZone.zoneMinCO2Sched != nullptr) { // Take the schedule value of "Minimum Carbon Dioxide Concentration Schedule Name" // in the ZoneControl:ContaminantController - ZoneMinCO2 = GetCurrentScheduleValue(state, curZone.ZoneMinCO2SchedIndex); + ZoneMinCO2 = curZone.zoneMinCO2Sched->getCurrentVal(); } else { ZoneMinCO2 = state.dataContaminantBalance->OutdoorCO2; } @@ -3932,15 +3924,14 @@ Real64 VentilationMechanicalProps::CalcMechVentController(EnergyPlusData &state, // Accumulate CO2 generation from people at design occupancy and current activity level Real64 CO2PeopleGeneration = 0.0; for (int const PeopleNum : thisMechVentZone.peopleIndexes) { - CO2PeopleGeneration += - state.dataHeatBal->People(PeopleNum).NumberOfPeople * - state.dataHeatBal->People(PeopleNum).CO2RateFactor * - GetCurrentScheduleValue(state, state.dataHeatBal->People(PeopleNum).ActivityLevelPtr); + CO2PeopleGeneration += state.dataHeatBal->People(PeopleNum).NumberOfPeople * + state.dataHeatBal->People(PeopleNum).CO2RateFactor * + state.dataHeatBal->People(PeopleNum).activityLevelSched->getCurrentVal(); } ZoneMaxCO2 = state.dataContaminantBalance->OutdoorCO2 + (CO2PeopleGeneration * curZone.Multiplier * curZone.ListMultiplier * 1.0e6) / ZoneOAMax; - } else if (curZone.ZoneMaxCO2SchedIndex > 0.0) { - ZoneMaxCO2 = GetCurrentScheduleValue(state, curZone.ZoneMaxCO2SchedIndex); + } else if (curZone.zoneMaxCO2Sched != nullptr) { + ZoneMaxCO2 = curZone.zoneMaxCO2Sched->getCurrentVal(); } else { ZoneMaxCO2 = state.dataContaminantBalance->OutdoorCO2 + (state.dataContaminantBalance->ZoneCO2GainFromPeople(ZoneNum) * curZone.Multiplier * @@ -4403,8 +4394,8 @@ void OAControllerProps::CalcOAEconomizer(EnergyPlusData &state, // Check time of day economizer schedule, enable economizer if schedule value > 0 EconomizerAirFlowScheduleValue = 0.0; - if (this->EconomizerOASchedPtr > 0) { - EconomizerAirFlowScheduleValue = GetCurrentScheduleValue(state, this->EconomizerOASchedPtr); + if (this->economizerOASched != nullptr) { + EconomizerAirFlowScheduleValue = this->economizerOASched->getCurrentVal(); if (EconomizerAirFlowScheduleValue > 0.0) { EconomizerOperationFlag = true; OutAirSignal = 1.0; @@ -4444,7 +4435,7 @@ void OAControllerProps::CalcOAEconomizer(EnergyPlusData &state, } else { - // simulate OA System if equipment exists other than the mixer (e.g., heating/cooling coil, HX, ect.) + // simulate OA System if equipment exists other than the mixer (e.g., heating/cooling coil, HX, etc.) // 1 - check min OA flow result if (this->FixedMin) { @@ -4637,7 +4628,7 @@ void OAMixerProps::CalcOAMixer(EnergyPlusData &state) // Define a recirculation mass flow rate Real64 RecircMassFlowRate = this->RetMassFlowRate - this->RelMassFlowRate; // In certain low flow conditions the return air mass flow rate can be below the outside air value established - // by the user. This check will ensure that this condition does not result in unphysical air properties. + // by the user. This check will ensure that this condition does not result in non-physical air properties. if (RecircMassFlowRate < 0.0) { RecircMassFlowRate = 0.0; this->RelMassFlowRate = this->RetMassFlowRate; @@ -5340,7 +5331,7 @@ bool CheckForControllerWaterCoil(EnergyPlusData &state, // DATE WRITTEN May 2009 // PURPOSE OF THIS FUNCTION: - // This routine checks the controller list for existance of the reference coil. + // This routine checks the controller list for existence of the reference coil. if (state.dataMixedAir->GetOASysInputFlag) { GetOutsideAirSysInputs(state); diff --git a/src/EnergyPlus/MixedAir.hh b/src/EnergyPlus/MixedAir.hh index 026ca0c8f5a..5af6484583c 100644 --- a/src/EnergyPlus/MixedAir.hh +++ b/src/EnergyPlus/MixedAir.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -169,14 +169,13 @@ namespace MixedAir { EconoOp Econo = EconoOp::NoEconomizer; // 0 = NoEconomizer, 1 = FixedDryBulb, 2 = FixedEnthalpy, 3=DifferentialDryBulb, // 4=DifferentialEnthalpy, 5=FixedDewPointAndDryBulb, 6 = ElectronicEnthalpy, // 7 =DifferentialDryBulbAndEnthalpy - bool EconBypass = false; // ModulateFlow =FALSE , MinimumFlowWithBypass =TRUE - int MixNode = 0; // Controlled node (mixed air node) - int OANode = 0; // Actuated node (outside air node) - int InletNode = 0; // Inlet Air Node for into Mixer (BTG Nov 2004) - int RelNode = 0; // Relief Air Node Number - int RetNode = 0; // Return Air Node Number - std::string MinOASch; // Name of the minimum outside air schedule - int MinOASchPtr = 0; // Index to the minimum outside air schedule + bool EconBypass = false; // ModulateFlow =FALSE , MinimumFlowWithBypass =TRUE + int MixNode = 0; // Controlled node (mixed air node) + int OANode = 0; // Actuated node (outside air node) + int InletNode = 0; // Inlet Air Node for into Mixer (BTG Nov 2004) + int RelNode = 0; // Relief Air Node Number + int RetNode = 0; // Return Air Node Number + Sched::Schedule *minOASched = nullptr; // minimum outside air schedule Real64 RelMassFlow = 0.0; Real64 OAMassFlow = 0.0; Real64 ExhMassFlow = 0.0; @@ -208,11 +207,9 @@ namespace MixedAir { Real64 HighRHOAFlowRatio = 1.0; // Modify ratio with respect to maximum outdoor air flow rate (high RH) bool ModifyDuringHighOAMoisture = false; // flag to Modify outdoor air flow, TRUE when modify any time, FALSE when modify only when indoor air // humrat is less than outdoor HR - int EconomizerOASchedPtr = 0; // schedule to modify outdoor air flow - std::string MinOAflowSch; // Name of the Minimum fraction of Design/Mixed Mass of air - std::string MaxOAflowSch; // Name of the Maximum fraction of Design/Mixed Mass of air - int MinOAflowSchPtr = 0; // Index to the Minimum Fraction of Outdoor Air Schedule - int MaxOAflowSchPtr = 0; // Index to the Maximum Fraction of Outdoor Air Schedule + Sched::Schedule *economizerOASched = nullptr; // schedule to modify outdoor air flow + Sched::Schedule *minOAflowSched = nullptr; // Index to the Minimum Fraction of Outdoor Air Schedule + Sched::Schedule *maxOAflowSched = nullptr; // Index to the Maximum Fraction of Outdoor Air Schedule // Economizer Status, which is currently following the EconomizerOperationFlag, might be something like "Economizer status // indicates when the conditions are favorable for the economizer to operate (i.e., none of the control limits have been exceeded). // While this status signal indicates favorable conditions for economizer operation, it does not guarantee that the air-side @@ -264,38 +261,37 @@ namespace MixedAir { struct VentilationMechanicalZoneProps { - std::string name; // name of mech vent zone - int zoneNum = 0; // Actual zones number - Real64 ZoneOAAreaRate = 0.0; // Mechanical ventilation rate (m3/s/m2) for each zone - Real64 ZoneOAPeopleRate = 0.0; // Mechanical ventilation rate (m3/s/person) for each zone - Real64 ZoneOAFlowRate = 0.0; // OA Flow Rate (m3/s/zone) for each zone - Real64 ZoneOAACHRate = 0.0; // OA ACH (m3/s/volume) for each zone - int ZoneDesignSpecOAObjIndex = 0; // index of the design specification outdoor air object for each zone - std::string ZoneDesignSpecOAObjName; // name of the design specification outdoor air object for each zone - Real64 ZoneADEffCooling = 1.0; // Zone air distribution effectiveness in cooling mode for each zone - Real64 ZoneADEffHeating = 1.0; // Zone air distribution effectiveness in heating mode for each zone - int ZoneADEffSchPtr = 0; // Pointer to the zone air distribution effectiveness schedule for each zone - int ZoneDesignSpecADObjIndex = 0; // index of the design specification zone air distribution object for each zone - std::string ZoneDesignSpecADObjName; // name of the design specification zone air distribution object for each zone - Real64 ZoneSecondaryRecirculation = 0.0; // zone air secondary recirculation ratio for each zone + std::string name; // name of mech vent zone + int zoneNum = 0; // Actual zones number + Real64 ZoneOAAreaRate = 0.0; // Mechanical ventilation rate (m3/s/m2) for each zone + Real64 ZoneOAPeopleRate = 0.0; // Mechanical ventilation rate (m3/s/person) for each zone + Real64 ZoneOAFlowRate = 0.0; // OA Flow Rate (m3/s/zone) for each zone + Real64 ZoneOAACHRate = 0.0; // OA ACH (m3/s/volume) for each zone + int ZoneDesignSpecOAObjIndex = 0; // index of the design specification outdoor air object for each zone + std::string ZoneDesignSpecOAObjName; // name of the design specification outdoor air object for each zone + Real64 ZoneADEffCooling = 1.0; // Zone air distribution effectiveness in cooling mode for each zone + Real64 ZoneADEffHeating = 1.0; // Zone air distribution effectiveness in heating mode for each zone + Sched::Schedule *zoneADEffSched = nullptr; // air distribution effectiveness schedule for each zone + int ZoneDesignSpecADObjIndex = 0; // index of the design specification zone air distribution object for each zone + std::string ZoneDesignSpecADObjName; // name of the design specification zone air distribution object for each zone + Real64 ZoneSecondaryRecirculation = 0.0; // zone air secondary recirculation ratio for each zone DataSizing::OAFlowCalcMethod ZoneOAFlowMethod = DataSizing::OAFlowCalcMethod::PerPerson; // OA flow method for each zone - int ZoneOASchPtr = 0; // Index to the outdoor air schedule for each zone (from DesignSpecification:OutdoorAir or default) - Real64 OAPropCtlMinRateSchPtr = 0; // Outdoor design OA flow rate schedule from DesignSpecification:OutdoorAir + Sched::Schedule *zoneOASched = nullptr; // Outdoor air schedule for each zone (from DesignSpecification:OutdoorAir or default) + Sched::Schedule *oaPropCtlMinRateSched = nullptr; // Outdoor design OA flow rate schedule from DesignSpecification:OutdoorAir EPVector peopleIndexes; // List of People objects in this zone (for SystemOAMethod == DataSizing::SysOAMethod::ProportionalControlDesOcc) }; struct VentilationMechanicalProps // Derived type for Ventilation:Mechanical data { // Members - std::string Name; // Name of Ventilation:Mechanical object - std::string SchName; // Name of the mechanical ventilation schedule - int SchPtr = 0; // Index to the mechanical ventilation schedule - bool DCVFlag = false; // if true, implement OA based on demand controlled ventilation - int NumofVentMechZones = 0; // Number of zones with mechanical ventilation - Real64 TotAreaOAFlow = 0.0; // Total outdoor air flow rate for all zones per area (m3/s/m2) - Real64 TotPeopleOAFlow = 0.0; // Total outdoor air flow rate for all PEOPLE objects in zones (m3/s) - Real64 TotZoneOAFlow = 0.0; // Total outdoor air flow rate for all zones (m3/s) - Real64 TotZoneOAACH = 0.0; // Total outdoor air flow rate for all zones Air Changes per hour (m3/s/m3) + std::string Name; // Name of Ventilation:Mechanical object + Sched::Schedule *availSched = nullptr; // Mechanical ventilation schedule + bool DCVFlag = false; // if true, implement OA based on demand controlled ventilation + int NumofVentMechZones = 0; // Number of zones with mechanical ventilation + Real64 TotAreaOAFlow = 0.0; // Total outdoor air flow rate for all zones per area (m3/s/m2) + Real64 TotPeopleOAFlow = 0.0; // Total outdoor air flow rate for all PEOPLE objects in zones (m3/s) + Real64 TotZoneOAFlow = 0.0; // Total outdoor air flow rate for all zones (m3/s) + Real64 TotZoneOAACH = 0.0; // Total outdoor air flow rate for all zones Air Changes per hour (m3/s/m3) DataSizing::SysOAMethod SystemOAMethod = DataSizing::SysOAMethod::Invalid; // System Outdoor Air Method - SOAM_ZoneSum, SOAM_VRP, SOAM_VRPL Real64 ZoneMaxOAFraction = 1.0; // Zone maximum outdoor air fraction int CO2MaxMinLimitErrorCount = 0; // Counter when max CO2 concentration < min CO2 concentration for SOAM_ProportionalControlSchOcc @@ -404,9 +400,9 @@ namespace MixedAir { std::string_view CurrentModuleObject, int OutAirNum, Array1D_string const &AlphArray, - int &NumAlphas, + int const NumAlphas, Array1D const &NumArray, - int &NumNums, + int const NumNums, Array1D_bool const &lNumericBlanks, // Unused Array1D_bool const &lAlphaBlanks, Array1D_string const &cAlphaFields, @@ -521,6 +517,10 @@ struct MixedAirData : BaseGlobalStruct Array1D_bool OAControllerMySizeFlag; Array1D_bool MechVentCheckFlag; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/MixerComponent.cc b/src/EnergyPlus/MixerComponent.cc index 028bbc11175..566944ecbc9 100644 --- a/src/EnergyPlus/MixerComponent.cc +++ b/src/EnergyPlus/MixerComponent.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/MixerComponent.hh b/src/EnergyPlus/MixerComponent.hh index 3cadbc9359f..d9a46b140d6 100644 --- a/src/EnergyPlus/MixerComponent.hh +++ b/src/EnergyPlus/MixerComponent.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -162,6 +162,10 @@ struct MixerComponentData : BaseGlobalStruct Array1D_bool CheckEquipName; EPVector MixerCond; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/MoistureBalanceEMPDManager.cc b/src/EnergyPlus/MoistureBalanceEMPDManager.cc index f3cc5f01728..0ab04e5019d 100644 --- a/src/EnergyPlus/MoistureBalanceEMPDManager.cc +++ b/src/EnergyPlus/MoistureBalanceEMPDManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -200,8 +200,7 @@ void GetMoistureBalanceEMPDInput(EnergyPlusData &state) auto *mat = s_mat->materials(matNum); if (mat->group != Material::Group::Regular || mat->ROnly) { - ShowSevereCustomMessage( - state, eoh, "Reference Material is not appropriate type for EMPD properties, must have regular properties (L,Cp,K,D)"); + ShowSevereCustom(state, eoh, "Reference Material is not appropriate type for EMPD properties, must have regular properties (L,Cp,K,D)"); ErrorsFound = true; continue; } diff --git a/src/EnergyPlus/MoistureBalanceEMPDManager.hh b/src/EnergyPlus/MoistureBalanceEMPDManager.hh index ba1b728b9d4..02129e4a60b 100644 --- a/src/EnergyPlus/MoistureBalanceEMPDManager.hh +++ b/src/EnergyPlus/MoistureBalanceEMPDManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -132,6 +132,10 @@ struct MoistureBalanceEMPDManagerData : BaseGlobalStruct int ErrCount = 0; bool OneTimeFlag = true; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/MundtSimMgr.cc b/src/EnergyPlus/MundtSimMgr.cc index 372cc81b9b2..11102615750 100644 --- a/src/EnergyPlus/MundtSimMgr.cc +++ b/src/EnergyPlus/MundtSimMgr.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -756,7 +756,7 @@ namespace RoomAir { int hbSurfNum = state.dataMundtSimMgr->ZoneData(ZoneNum).HBsurfaceIndexes(SurfNum); DeltaTemp = state.dataMundtSimMgr->MundtAirSurf(SurfNum, state.dataMundtSimMgr->MundtZoneNum).TMeanAir - state.dataMundtSimMgr->LineNode(state.dataMundtSimMgr->TstatNodeID, state.dataMundtSimMgr->MundtZoneNum).Temp; - state.dataHeatBal->SurfTempEffBulkAir(hbSurfNum) = state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ZoneNum) + DeltaTemp; + state.dataHeatBal->SurfTempEffBulkAir(hbSurfNum) = state.dataHeatBalFanSys->zoneTstatSetpts(ZoneNum).setpt + DeltaTemp; // set flag for reference air temperature state.dataSurface->SurfTAirRef(hbSurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; state.dataSurface->SurfTAirRefRpt(hbSurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(hbSurfNum)]; @@ -770,7 +770,7 @@ namespace RoomAir { int ZoneNodeNum = state.dataHeatBal->Zone(ZoneNum).SystemZoneNodeNumber; DeltaTemp = state.dataMundtSimMgr->LineNode(state.dataMundtSimMgr->ReturnNodeID, state.dataMundtSimMgr->MundtZoneNum).Temp - state.dataMundtSimMgr->LineNode(state.dataMundtSimMgr->TstatNodeID, state.dataMundtSimMgr->MundtZoneNum).Temp; - state.dataLoopNodes->Node(ZoneNodeNum).Temp = state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ZoneNum) + DeltaTemp; + state.dataLoopNodes->Node(ZoneNodeNum).Temp = state.dataHeatBalFanSys->zoneTstatSetpts(ZoneNum).setpt + DeltaTemp; // d) Thermostat air temperature -> TempTstatAir(ZoneNum) state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum) .ZT; // for indirect coupling, control air temp is equal to mean air temp? diff --git a/src/EnergyPlus/MundtSimMgr.hh b/src/EnergyPlus/MundtSimMgr.hh index 9bd695cb18b..d52c4f18e52 100644 --- a/src/EnergyPlus/MundtSimMgr.hh +++ b/src/EnergyPlus/MundtSimMgr.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -168,6 +168,10 @@ struct MundtSimMgrData : BaseGlobalStruct Array2D MundtAirSurf; // surfaces Array1D FloorSurf; // floor + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/NodeInputManager.cc b/src/EnergyPlus/NodeInputManager.cc index 2d39a19384a..096a7257175 100644 --- a/src/EnergyPlus/NodeInputManager.cc +++ b/src/EnergyPlus/NodeInputManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -80,8 +80,6 @@ namespace EnergyPlus::NodeInputManager { using namespace DataLoopNode; using namespace BranchNodeConnections; -constexpr const char *fluidNameSteam("STEAM"); - void GetNodeNums(EnergyPlusData &state, std::string const &Name, // Name for which to obtain information int &NumNodes, // Number of nodes accompanying this Name @@ -962,10 +960,6 @@ void CalcMoreNodeInfo(EnergyPlusData &state) // stored in MoreNodeInfo. // Using/Aliasing - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSatDensityRefrig; - using FluidProperties::GetSatEnthalpyRefrig; - using FluidProperties::GetSpecificHeatGlycol; using Psychrometrics::CPCW; using Psychrometrics::PsyCpAirFnW; using Psychrometrics::PsyHFnTdbW; @@ -974,7 +968,6 @@ void CalcMoreNodeInfo(EnergyPlusData &state) using Psychrometrics::PsyTdpFnWPb; using Psychrometrics::PsyTwbFnTdbWPb; using Psychrometrics::RhoH2O; - using ScheduleManager::GetCurrentScheduleValue; // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("CalcMoreNodeInfo"); @@ -982,15 +975,15 @@ void CalcMoreNodeInfo(EnergyPlusData &state) auto &RhoAirStdInit = state.dataNodeInputMgr->RhoAirStdInit; auto &RhoWaterStdInit = state.dataNodeInputMgr->RhoWaterStdInit; - auto &NodeWetBulbSchedPtr = state.dataNodeInputMgr->NodeWetBulbSchedPtr; + auto &NodeWetBulbScheds = state.dataNodeInputMgr->NodeWetBulbScheds; auto &NodeRelHumidityRepReq = state.dataNodeInputMgr->NodeRelHumidityRepReq; - auto &NodeRelHumiditySchedPtr = state.dataNodeInputMgr->NodeRelHumiditySchedPtr; + auto &NodeRelHumidityScheds = state.dataNodeInputMgr->NodeRelHumidityScheds; auto &NodeDewPointRepReq = state.dataNodeInputMgr->NodeDewPointRepReq; - auto &NodeDewPointSchedPtr = state.dataNodeInputMgr->NodeDewPointSchedPtr; + auto &NodeDewPointScheds = state.dataNodeInputMgr->NodeDewPointScheds; auto &NodeSpecificHeatRepReq = state.dataNodeInputMgr->NodeSpecificHeatRepReq; - auto &NodeSpecificHeatSchedPtr = state.dataNodeInputMgr->NodeSpecificHeatSchedPtr; + auto &NodeSpecificHeatScheds = state.dataNodeInputMgr->NodeSpecificHeatScheds; auto &nodeReportingStrings = state.dataNodeInputMgr->nodeReportingStrings; - auto &nodeFluidNames = state.dataNodeInputMgr->nodeFluidNames; + auto &nodeFluids = state.dataNodeInputMgr->nodeFluids; Real64 SteamDensity; Real64 EnthSteamInDry; Real64 RhoAirCurrent; // temporary value for current air density f(baro, db , W) @@ -1002,60 +995,61 @@ void CalcMoreNodeInfo(EnergyPlusData &state) RhoAirStdInit = state.dataEnvrn->StdRhoAir; RhoWaterStdInit = RhoH2O(Constant::InitConvTemp); state.dataNodeInputMgr->NodeWetBulbRepReq.allocate(state.dataLoopNodes->NumOfNodes); - NodeWetBulbSchedPtr.allocate(state.dataLoopNodes->NumOfNodes); + NodeWetBulbScheds.allocate(state.dataLoopNodes->NumOfNodes); NodeRelHumidityRepReq.allocate(state.dataLoopNodes->NumOfNodes); - NodeRelHumiditySchedPtr.allocate(state.dataLoopNodes->NumOfNodes); + NodeRelHumidityScheds.allocate(state.dataLoopNodes->NumOfNodes); NodeDewPointRepReq.allocate(state.dataLoopNodes->NumOfNodes); - NodeDewPointSchedPtr.allocate(state.dataLoopNodes->NumOfNodes); + NodeDewPointScheds.allocate(state.dataLoopNodes->NumOfNodes); NodeSpecificHeatRepReq.allocate(state.dataLoopNodes->NumOfNodes); - NodeSpecificHeatSchedPtr.allocate(state.dataLoopNodes->NumOfNodes); + NodeSpecificHeatScheds.allocate(state.dataLoopNodes->NumOfNodes); nodeReportingStrings.reserve(state.dataLoopNodes->NumOfNodes); - nodeFluidNames.reserve(state.dataLoopNodes->NumOfNodes); + nodeFluids.reserve(state.dataLoopNodes->NumOfNodes); state.dataNodeInputMgr->NodeWetBulbRepReq = false; - NodeWetBulbSchedPtr = 0; + NodeWetBulbScheds = nullptr; NodeRelHumidityRepReq = false; - NodeRelHumiditySchedPtr = 0; + NodeRelHumidityScheds = nullptr; NodeDewPointRepReq = false; - NodeDewPointSchedPtr = 0; + NodeDewPointScheds = nullptr; NodeSpecificHeatRepReq = false; - NodeSpecificHeatSchedPtr = 0; + NodeSpecificHeatScheds = nullptr; for (int iNode = 1; iNode <= state.dataLoopNodes->NumOfNodes; ++iNode) { nodeReportingStrings.push_back(std::string(NodeReportingCalc + state.dataLoopNodes->NodeID(iNode))); - nodeFluidNames.push_back(FluidProperties::GetGlycolNameByIndex(state, state.dataLoopNodes->Node(iNode).FluidIndex)); + nodeFluids.push_back( + (state.dataLoopNodes->Node(iNode).FluidIndex == 0) ? nullptr : state.dataFluid->glycols(state.dataLoopNodes->Node(iNode).FluidIndex)); for (auto const *reqVar : state.dataOutputProcessor->reqVars) { if (Util::SameString(reqVar->key, state.dataLoopNodes->NodeID(iNode)) || reqVar->key.empty()) { if (Util::SameString(reqVar->name, "System Node Wetbulb Temperature")) { state.dataNodeInputMgr->NodeWetBulbRepReq(iNode) = true; - NodeWetBulbSchedPtr(iNode) = reqVar->SchedPtr; + NodeWetBulbScheds(iNode) = reqVar->sched; } else if (Util::SameString(reqVar->name, "System Node Relative Humidity")) { NodeRelHumidityRepReq(iNode) = true; - NodeRelHumiditySchedPtr(iNode) = reqVar->SchedPtr; + NodeRelHumidityScheds(iNode) = reqVar->sched; } else if (Util::SameString(reqVar->name, "System Node Dewpoint Temperature")) { NodeDewPointRepReq(iNode) = true; - NodeDewPointSchedPtr(iNode) = reqVar->SchedPtr; + NodeDewPointScheds(iNode) = reqVar->sched; } else if (Util::SameString(reqVar->name, "System Node Specific Heat")) { NodeSpecificHeatRepReq(iNode) = true; - NodeSpecificHeatSchedPtr(iNode) = reqVar->SchedPtr; + NodeSpecificHeatScheds(iNode) = reqVar->sched; } } } if (EMSManager::CheckIfNodeMoreInfoSensedByEMS(state, iNode, "System Node Wetbulb Temperature")) { state.dataNodeInputMgr->NodeWetBulbRepReq(iNode) = true; - NodeWetBulbSchedPtr(iNode) = 0; + NodeWetBulbScheds(iNode) = nullptr; } if (EMSManager::CheckIfNodeMoreInfoSensedByEMS(state, iNode, "System Node Relative Humidity")) { NodeRelHumidityRepReq(iNode) = true; - NodeRelHumiditySchedPtr(iNode) = 0; + NodeRelHumidityScheds(iNode) = nullptr; } if (EMSManager::CheckIfNodeMoreInfoSensedByEMS(state, iNode, "System Node Dewpoint Temperature")) { NodeDewPointRepReq(iNode) = true; - NodeDewPointSchedPtr(iNode) = 0; + NodeDewPointScheds(iNode) = nullptr; } if (EMSManager::CheckIfNodeMoreInfoSensedByEMS(state, iNode, "System Node Specific Heat")) { NodeSpecificHeatRepReq(iNode) = true; - NodeSpecificHeatSchedPtr(iNode) = 0; + NodeSpecificHeatScheds(iNode) = nullptr; } } state.dataNodeInputMgr->CalcMoreNodeInfoMyOneTimeFlag = false; @@ -1066,26 +1060,26 @@ void CalcMoreNodeInfo(EnergyPlusData &state) bool ReportRelHumidity = false; bool ReportDewPoint = false; bool ReportSpecificHeat = false; - if (state.dataNodeInputMgr->NodeWetBulbRepReq(iNode) && NodeWetBulbSchedPtr(iNode) > 0) { - ReportWetBulb = (GetCurrentScheduleValue(state, NodeWetBulbSchedPtr(iNode)) > 0.0); - } else if (state.dataNodeInputMgr->NodeWetBulbRepReq(iNode) && NodeWetBulbSchedPtr(iNode) == 0) { + if (state.dataNodeInputMgr->NodeWetBulbRepReq(iNode) && NodeWetBulbScheds(iNode) != nullptr) { + ReportWetBulb = (NodeWetBulbScheds(iNode)->getCurrentVal() > 0.0); + } else if (state.dataNodeInputMgr->NodeWetBulbRepReq(iNode) && NodeWetBulbScheds(iNode) == nullptr) { ReportWetBulb = true; } else if (state.dataLoopNodes->Node(iNode).SPMNodeWetBulbRepReq) { ReportWetBulb = true; } - if (NodeRelHumidityRepReq(iNode) && NodeRelHumiditySchedPtr(iNode) > 0) { - ReportRelHumidity = (GetCurrentScheduleValue(state, NodeRelHumiditySchedPtr(iNode)) > 0.0); - } else if (NodeRelHumidityRepReq(iNode) && NodeRelHumiditySchedPtr(iNode) == 0) { + if (NodeRelHumidityRepReq(iNode) && NodeRelHumidityScheds(iNode) != nullptr) { + ReportRelHumidity = (NodeRelHumidityScheds(iNode)->getCurrentVal() > 0.0); + } else if (NodeRelHumidityRepReq(iNode) && NodeRelHumidityScheds(iNode) == nullptr) { ReportRelHumidity = true; } - if (NodeDewPointRepReq(iNode) && NodeDewPointSchedPtr(iNode) > 0) { - ReportDewPoint = (GetCurrentScheduleValue(state, NodeDewPointSchedPtr(iNode)) > 0.0); - } else if (NodeDewPointRepReq(iNode) && NodeDewPointSchedPtr(iNode) == 0) { + if (NodeDewPointRepReq(iNode) && NodeDewPointScheds(iNode) != nullptr) { + ReportDewPoint = (NodeDewPointScheds(iNode)->getCurrentVal() > 0.0); + } else if (NodeDewPointRepReq(iNode) && NodeDewPointScheds(iNode) == nullptr) { ReportDewPoint = true; } - if (NodeSpecificHeatRepReq(iNode) && NodeSpecificHeatSchedPtr(iNode) > 0) { - ReportSpecificHeat = (GetCurrentScheduleValue(state, NodeSpecificHeatSchedPtr(iNode)) > 0.0); - } else if (NodeSpecificHeatRepReq(iNode) && NodeSpecificHeatSchedPtr(iNode) == 0) { + if (NodeSpecificHeatRepReq(iNode) && NodeSpecificHeatScheds(iNode) != nullptr) { + ReportSpecificHeat = (NodeSpecificHeatScheds(iNode)->getCurrentVal() > 0.0); + } else if (NodeSpecificHeatRepReq(iNode) && NodeSpecificHeatScheds(iNode) == nullptr) { ReportSpecificHeat = true; } // calculate the volume flow rate @@ -1134,26 +1128,14 @@ void CalcMoreNodeInfo(EnergyPlusData &state) } else if (state.dataLoopNodes->Node(iNode).FluidType == DataLoopNode::NodeFluidType::Water) { if (!((state.dataLoopNodes->Node(iNode).FluidIndex > 0) && - (state.dataLoopNodes->Node(iNode).FluidIndex <= state.dataFluidProps->glycols.isize()))) { + (state.dataLoopNodes->Node(iNode).FluidIndex <= state.dataFluid->glycols.isize()))) { rho = RhoWaterStdInit; rhoStd = RhoWaterStdInit; Cp = CPCW(state.dataLoopNodes->Node(iNode).Temp); } else { - Cp = GetSpecificHeatGlycol(state, - nodeFluidNames[iNode - 1], - state.dataLoopNodes->Node(iNode).Temp, - state.dataLoopNodes->Node(iNode).FluidIndex, - nodeReportingStrings[iNode - 1]); - rhoStd = GetDensityGlycol(state, - nodeFluidNames[iNode - 1], - Constant::InitConvTemp, - state.dataLoopNodes->Node(iNode).FluidIndex, - nodeReportingStrings[iNode - 1]); - rho = GetDensityGlycol(state, - nodeFluidNames[iNode - 1], - state.dataLoopNodes->Node(iNode).Temp, - state.dataLoopNodes->Node(iNode).FluidIndex, - nodeReportingStrings[iNode - 1]); + Cp = nodeFluids[iNode - 1]->getSpecificHeat(state, state.dataLoopNodes->Node(iNode).Temp, nodeReportingStrings[iNode - 1]); + rhoStd = nodeFluids[iNode - 1]->getDensity(state, Constant::InitConvTemp, nodeReportingStrings[iNode - 1]); + rho = nodeFluids[iNode - 1]->getDensity(state, state.dataLoopNodes->Node(iNode).Temp, nodeReportingStrings[iNode - 1]); } state.dataLoopNodes->MoreNodeInfo(iNode).VolFlowRateStdRho = state.dataLoopNodes->Node(iNode).MassFlowRate / rhoStd; @@ -1165,18 +1147,11 @@ void CalcMoreNodeInfo(EnergyPlusData &state) state.dataLoopNodes->MoreNodeInfo(iNode).RelHumidity = 100.0; } else if (state.dataLoopNodes->Node(iNode).FluidType == DataLoopNode::NodeFluidType::Steam) { if (state.dataLoopNodes->Node(iNode).Quality == 1.0) { - SteamDensity = GetSatDensityRefrig(state, - fluidNameSteam, - state.dataLoopNodes->Node(iNode).Temp, - state.dataLoopNodes->Node(iNode).Quality, - state.dataLoopNodes->Node(iNode).FluidIndex, - RoutineName); - EnthSteamInDry = GetSatEnthalpyRefrig(state, - fluidNameSteam, - state.dataLoopNodes->Node(iNode).Temp, - state.dataLoopNodes->Node(iNode).Quality, - state.dataLoopNodes->Node(iNode).FluidIndex, - RoutineName); + auto *steam = Fluid::GetSteam(state); + SteamDensity = + steam->getSatDensity(state, state.dataLoopNodes->Node(iNode).Temp, state.dataLoopNodes->Node(iNode).Quality, RoutineName); + EnthSteamInDry = + steam->getSatEnthalpy(state, state.dataLoopNodes->Node(iNode).Temp, state.dataLoopNodes->Node(iNode).Quality, RoutineName); state.dataLoopNodes->MoreNodeInfo(iNode).VolFlowRateStdRho = state.dataLoopNodes->Node(iNode).MassFlowRate / SteamDensity; state.dataLoopNodes->MoreNodeInfo(iNode).ReportEnthalpy = EnthSteamInDry; state.dataLoopNodes->MoreNodeInfo(iNode).WetBulbTemp = 0.0; diff --git a/src/EnergyPlus/NodeInputManager.hh b/src/EnergyPlus/NodeInputManager.hh index 1e9270a5b52..5c8a489651e 100644 --- a/src/EnergyPlus/NodeInputManager.hh +++ b/src/EnergyPlus/NodeInputManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -56,6 +56,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -175,15 +176,19 @@ struct NodeInputManagerData : BaseGlobalStruct Real64 RhoAirStdInit; Real64 RhoWaterStdInit; - Array1D_int NodeWetBulbSchedPtr; + Array1D NodeWetBulbScheds; Array1D_bool NodeRelHumidityRepReq; - Array1D_int NodeRelHumiditySchedPtr; + Array1D NodeRelHumidityScheds; Array1D_bool NodeDewPointRepReq; - Array1D_int NodeDewPointSchedPtr; + Array1D NodeDewPointScheds; Array1D_bool NodeSpecificHeatRepReq; - Array1D_int NodeSpecificHeatSchedPtr; + Array1D NodeSpecificHeatScheds; std::vector nodeReportingStrings; - std::vector nodeFluidNames; + std::vector nodeFluids; + + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } void init_state([[maybe_unused]] EnergyPlusData &state) override { diff --git a/src/EnergyPlus/NonZoneEquipmentManager.cc b/src/EnergyPlus/NonZoneEquipmentManager.cc index 2d8594036af..e6619316cd7 100644 --- a/src/EnergyPlus/NonZoneEquipmentManager.cc +++ b/src/EnergyPlus/NonZoneEquipmentManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/NonZoneEquipmentManager.hh b/src/EnergyPlus/NonZoneEquipmentManager.hh index bc66f5cf7ce..a2301211ec3 100644 --- a/src/EnergyPlus/NonZoneEquipmentManager.hh +++ b/src/EnergyPlus/NonZoneEquipmentManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/OutAirNodeManager.cc b/src/EnergyPlus/OutAirNodeManager.cc index 379a7765189..a9bf45a41b0 100644 --- a/src/EnergyPlus/OutAirNodeManager.cc +++ b/src/EnergyPlus/OutAirNodeManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -131,11 +131,11 @@ namespace OutAirNodeManager { // Using/Aliasing using namespace NodeInputManager; - using ScheduleManager::GetScheduleIndex; // Locals // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetOutAirNodesInput: "); // include trailing blank space + static constexpr std::string_view routineName = "GetOutAirNodesInput"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumOutAirInletNodeLists; @@ -271,6 +271,8 @@ namespace OutAirNodeManager { cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + ErrInList = false; // To support HVAC diagram, every outside inlet node must have a unique fluid stream number // GetNodeNums will increment the value across a node list, the starting value must be incremented @@ -321,40 +323,28 @@ namespace OutAirNodeManager { state.dataGlobal->AnyLocalEnvironmentsInModel = true; } - if (NumAlphas > 1 && !lAlphaBlanks(2)) { - state.dataLoopNodes->Node(NodeNums(1)).OutAirDryBulbSchedNum = GetScheduleIndex(state, Alphas(2)); - if (state.dataLoopNodes->Node(NodeNums(1)).OutAirDryBulbSchedNum == 0) { - ShowSevereError(state, format("{}{}=\"{}\", invalid schedule.", RoutineName, CurrentModuleObject, cAlphaFields(2))); - ShowContinueError(state, format("Dry Bulb Temperature Schedule not found=\"{}\".", Alphas(2))); - ErrorsFound = true; - } + if (NumAlphas <= 1 || lAlphaBlanks(2)) { + } else if ((state.dataLoopNodes->Node(NodeNums(1)).outAirDryBulbSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } - if (NumAlphas > 2 && !lAlphaBlanks(3)) { - state.dataLoopNodes->Node(NodeNums(1)).OutAirWetBulbSchedNum = GetScheduleIndex(state, Alphas(3)); - if (state.dataLoopNodes->Node(NodeNums(1)).OutAirWetBulbSchedNum == 0) { - ShowSevereError(state, format("{}{}=\"{}\", invalid schedule.", RoutineName, CurrentModuleObject, cAlphaFields(3))); - ShowContinueError(state, format("Wet Bulb Temperature Schedule not found=\"{}\".", Alphas(3))); - ErrorsFound = true; - } + if (NumAlphas <= 2 || lAlphaBlanks(3)) { + } else if ((state.dataLoopNodes->Node(NodeNums(1)).outAirWetBulbSched = Sched::GetSchedule(state, Alphas(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(3), Alphas(3)); + ErrorsFound = true; } - if (NumAlphas > 3 && !lAlphaBlanks(4)) { - state.dataLoopNodes->Node(NodeNums(1)).OutAirWindSpeedSchedNum = GetScheduleIndex(state, Alphas(4)); - if (state.dataLoopNodes->Node(NodeNums(1)).OutAirWindSpeedSchedNum == 0) { - ShowSevereError(state, format("{}{}=\"{}\", invalid schedule.", RoutineName, CurrentModuleObject, cAlphaFields(4))); - ShowContinueError(state, format("Wind Speed Schedule not found=\"{}\".", Alphas(4))); - ErrorsFound = true; - } + if (NumAlphas <= 3 || lAlphaBlanks(4)) { + } else if ((state.dataLoopNodes->Node(NodeNums(1)).outAirWindSpeedSched = Sched::GetSchedule(state, Alphas(4))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(4), Alphas(4)); + ErrorsFound = true; } - if (NumAlphas > 4 && !lAlphaBlanks(5)) { - state.dataLoopNodes->Node(NodeNums(1)).OutAirWindDirSchedNum = GetScheduleIndex(state, Alphas(5)); - if (state.dataLoopNodes->Node(NodeNums(1)).OutAirWindDirSchedNum == 0) { - ShowSevereError(state, format("{}{}=\"{}\", invalid schedule.", RoutineName, CurrentModuleObject, cAlphaFields(5))); - ShowContinueError(state, format("Wind Direction Schedule not found=\"{}\".", Alphas(5))); - ErrorsFound = true; - } + if (NumAlphas <= 4 || lAlphaBlanks(5)) { + } else if ((state.dataLoopNodes->Node(NodeNums(1)).outAirWindDirSched = Sched::GetSchedule(state, Alphas(5))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(5), Alphas(5)); + ErrorsFound = true; } if (NumAlphas > 8) { @@ -363,8 +353,8 @@ namespace OutAirNodeManager { ErrorsFound = true; continue; } - if (state.dataLoopNodes->Node(NodeNums(1)).OutAirDryBulbSchedNum > 0 || - state.dataLoopNodes->Node(NodeNums(1)).OutAirWetBulbSchedNum > 0) { + if (state.dataLoopNodes->Node(NodeNums(1)).outAirDryBulbSched != nullptr || + state.dataLoopNodes->Node(NodeNums(1)).outAirWetBulbSched != nullptr) { state.dataLoopNodes->Node(NodeNums(1)).IsLocalNode = true; } } @@ -557,7 +547,6 @@ namespace OutAirNodeManager { using Psychrometrics::PsyHFnTdbW; using Psychrometrics::PsyTwbFnTdbWPb; using Psychrometrics::PsyWFnTdbTwbPb; - using ScheduleManager::GetCurrentScheduleValue; // Set node data to global values if (state.dataLoopNodes->Node(NodeNum).Height < 0.0) { @@ -576,21 +565,17 @@ namespace OutAirNodeManager { if (InitCall) { // Set node data to local air node values if defined - if (state.dataLoopNodes->Node(NodeNum).OutAirDryBulbSchedNum != 0) { - state.dataLoopNodes->Node(NodeNum).OutAirDryBulb = - GetCurrentScheduleValue(state, state.dataLoopNodes->Node(NodeNum).OutAirDryBulbSchedNum); + if (state.dataLoopNodes->Node(NodeNum).outAirDryBulbSched != nullptr) { + state.dataLoopNodes->Node(NodeNum).OutAirDryBulb = state.dataLoopNodes->Node(NodeNum).outAirDryBulbSched->getCurrentVal(); } - if (state.dataLoopNodes->Node(NodeNum).OutAirWetBulbSchedNum != 0) { - state.dataLoopNodes->Node(NodeNum).OutAirWetBulb = - GetCurrentScheduleValue(state, state.dataLoopNodes->Node(NodeNum).OutAirWetBulbSchedNum); + if (state.dataLoopNodes->Node(NodeNum).outAirWetBulbSched != nullptr) { + state.dataLoopNodes->Node(NodeNum).OutAirWetBulb = state.dataLoopNodes->Node(NodeNum).outAirWetBulbSched->getCurrentVal(); } - if (state.dataLoopNodes->Node(NodeNum).OutAirWindSpeedSchedNum != 0) { - state.dataLoopNodes->Node(NodeNum).OutAirWindSpeed = - GetCurrentScheduleValue(state, state.dataLoopNodes->Node(NodeNum).OutAirWindSpeedSchedNum); + if (state.dataLoopNodes->Node(NodeNum).outAirWindSpeedSched != nullptr) { + state.dataLoopNodes->Node(NodeNum).OutAirWindSpeed = state.dataLoopNodes->Node(NodeNum).outAirWindSpeedSched->getCurrentVal(); } - if (state.dataLoopNodes->Node(NodeNum).OutAirWindDirSchedNum != 0) { - state.dataLoopNodes->Node(NodeNum).OutAirWindDir = - GetCurrentScheduleValue(state, state.dataLoopNodes->Node(NodeNum).OutAirWindDirSchedNum); + if (state.dataLoopNodes->Node(NodeNum).outAirWindDirSched != nullptr) { + state.dataLoopNodes->Node(NodeNum).OutAirWindDir = state.dataLoopNodes->Node(NodeNum).outAirWindDirSched->getCurrentVal(); } // Set node data to EMS overwritten values if defined @@ -610,8 +595,10 @@ namespace OutAirNodeManager { if (state.dataLoopNodes->Node(NodeNum).OutAirWetBulb > state.dataLoopNodes->Node(NodeNum).OutAirDryBulb) { state.dataLoopNodes->Node(NodeNum).OutAirWetBulb = state.dataLoopNodes->Node(NodeNum).OutAirDryBulb; } - if (state.dataLoopNodes->Node(NodeNum).OutAirWetBulbSchedNum == 0 && !state.dataLoopNodes->Node(NodeNum).EMSOverrideOutAirWetBulb && - (state.dataLoopNodes->Node(NodeNum).EMSOverrideOutAirDryBulb || state.dataLoopNodes->Node(NodeNum).OutAirDryBulbSchedNum != 0)) { + if (state.dataLoopNodes->Node(NodeNum).outAirWetBulbSched == nullptr && + !state.dataLoopNodes->Node(NodeNum).EMSOverrideOutAirWetBulb && + (state.dataLoopNodes->Node(NodeNum).EMSOverrideOutAirDryBulb || + state.dataLoopNodes->Node(NodeNum).outAirDryBulbSched != nullptr)) { state.dataLoopNodes->Node(NodeNum).HumRat = state.dataEnvrn->OutHumRat; state.dataLoopNodes->Node(NodeNum).OutAirWetBulb = PsyTwbFnTdbWPb( state, state.dataLoopNodes->Node(NodeNum).OutAirDryBulb, state.dataEnvrn->OutHumRat, state.dataEnvrn->OutBaroPress); diff --git a/src/EnergyPlus/OutAirNodeManager.hh b/src/EnergyPlus/OutAirNodeManager.hh index fb1d9398248..9a77bdae625 100644 --- a/src/EnergyPlus/OutAirNodeManager.hh +++ b/src/EnergyPlus/OutAirNodeManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -90,6 +90,10 @@ struct OutAirNodeManagerData : BaseGlobalStruct { } + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void clear_state() override { this->OutsideAirNodeList.deallocate(); diff --git a/src/EnergyPlus/OutdoorAirUnit.cc b/src/EnergyPlus/OutdoorAirUnit.cc index 0bcfee8c6d0..281170ba70a 100644 --- a/src/EnergyPlus/OutdoorAirUnit.cc +++ b/src/EnergyPlus/OutdoorAirUnit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -114,7 +114,6 @@ namespace OutdoorAirUnit { using HVAC::SmallAirVolFlow; using HVAC::SmallLoad; using HVAC::SmallMassFlow; - using namespace ScheduleManager; using namespace Psychrometrics; // component types addressed by this module @@ -218,7 +217,6 @@ namespace OutdoorAirUnit { using BranchNodeConnections::SetUpCompSets; using BranchNodeConnections::TestCompSet; using NodeInputManager::GetOnlySingleNode; - using ScheduleManager::GetScheduleIndex; using SteamCoils::GetCoilAirInletNode; using SteamCoils::GetCoilAirOutletNode; using SteamCoils::GetCoilMaxSteamFlowRate; @@ -312,20 +310,11 @@ namespace OutdoorAirUnit { thisOutAirUnit.Name = state.dataIPShortCut->cAlphaArgs(1); // A2 - thisOutAirUnit.SchedName = state.dataIPShortCut->cAlphaArgs(2); if (lAlphaBlanks(2)) { - thisOutAirUnit.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - thisOutAirUnit.SchedPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); // convert schedule name to pointer - if (thisOutAirUnit.SchedPtr == 0) { - ShowSevereError(state, - format("{}=\"{}\" invalid {}=\"{}\" not found.", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaArgs(2), - state.dataIPShortCut->cAlphaArgs(2))); - ErrorsFound = true; - } + thisOutAirUnit.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisOutAirUnit.availSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaArgs(2), state.dataIPShortCut->cAlphaArgs(2)); + ErrorsFound = true; } // A3 @@ -354,16 +343,11 @@ namespace OutdoorAirUnit { // N1 thisOutAirUnit.OutAirVolFlow = NumArray(1); // A4 - thisOutAirUnit.OutAirSchedName = state.dataIPShortCut->cAlphaArgs(4); - // convert schedule name to pointer - thisOutAirUnit.OutAirSchedPtr = GetScheduleIndex(state, thisOutAirUnit.OutAirSchedName); - if (thisOutAirUnit.OutAirSchedPtr == 0) { - ShowSevereError(state, - format("{}=\"{}\" invalid {}=\"{}\" not found.", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - cAlphaFields(4), - state.dataIPShortCut->cAlphaArgs(4))); + if (lAlphaBlanks(4)) { + ShowSevereEmptyField(state, eoh, cAlphaFields(4)); + ErrorsFound = true; + } else if ((thisOutAirUnit.outAirSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(4))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(4), state.dataIPShortCut->cAlphaArgs(4)); ErrorsFound = true; } @@ -383,7 +367,7 @@ namespace OutdoorAirUnit { auto *fan = state.dataFans->fans(thisOutAirUnit.SFan_Index); thisOutAirUnit.supFanType = fan->type; thisOutAirUnit.SFanMaxAirVolFlow = fan->maxAirFlowRate; - thisOutAirUnit.SFanAvailSchedPtr = fan->availSchedNum; + thisOutAirUnit.supFanAvailSched = fan->availSched; } // A6 :Fan Place thisOutAirUnit.supFanPlace = static_cast(getEnumValue(HVAC::fanPlaceNamesUC, state.dataIPShortCut->cAlphaArgs(6))); @@ -414,7 +398,7 @@ namespace OutdoorAirUnit { auto *fan = state.dataFans->fans(thisOutAirUnit.ExtFan_Index); thisOutAirUnit.extFanType = fan->type; thisOutAirUnit.EFanMaxAirVolFlow = fan->maxAirFlowRate; - thisOutAirUnit.ExtFanAvailSchedPtr = fan->availSchedNum; + thisOutAirUnit.extFanAvailSched = fan->availSched; } thisOutAirUnit.ExtFan = true; } @@ -433,33 +417,28 @@ namespace OutdoorAirUnit { } } // A8 - thisOutAirUnit.ExtAirSchedName = state.dataIPShortCut->cAlphaArgs(8); + // convert schedule name to pointer - thisOutAirUnit.ExtOutAirSchedPtr = GetScheduleIndex(state, thisOutAirUnit.ExtAirSchedName); if (thisOutAirUnit.ExtFan) { - if ((thisOutAirUnit.ExtOutAirSchedPtr == 0) || (lNumericBlanks(2))) { - ShowSevereError(state, - format("{}=\"{}\" invalid {}=\"{}\" not found.", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - cAlphaFields(8), - state.dataIPShortCut->cAlphaArgs(8))); + if (lAlphaBlanks(8)) { + ShowSevereEmptyField(state, eoh, cAlphaFields(8)); ErrorsFound = true; - } else { - if ((thisOutAirUnit.ExtOutAirSchedPtr != thisOutAirUnit.OutAirSchedPtr) && - (!state.dataHeatBal->ZoneAirMassFlow.EnforceZoneMassBalance)) { - ShowWarningError( - state, - format("{}=\"{}\", different schedule inputs for outdoor air and exhaust air schedules may cause unbalanced mass flow.", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, - format("{}={} and {}={}", - cAlphaFields(4), - state.dataIPShortCut->cAlphaArgs(4), - cAlphaFields(8), - state.dataIPShortCut->cAlphaArgs(8))); - } + } else if ((thisOutAirUnit.extAirSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(8))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(8), state.dataIPShortCut->cAlphaArgs(8)); + ErrorsFound = true; + } else if ((thisOutAirUnit.extAirSched != thisOutAirUnit.outAirSched) && + (!state.dataHeatBal->ZoneAirMassFlow.EnforceZoneMassBalance)) { + ShowWarningError( + state, + format("{}=\"{}\", different schedule inputs for outdoor air and exhaust air schedules may cause unbalanced mass flow.", + CurrentModuleObject, + state.dataIPShortCut->cAlphaArgs(1))); + ShowContinueError(state, + format("{}={} and {}={}", + cAlphaFields(4), + state.dataIPShortCut->cAlphaArgs(4), + cAlphaFields(8), + state.dataIPShortCut->cAlphaArgs(8))); } SetUpCompSets( @@ -467,52 +446,31 @@ namespace OutdoorAirUnit { } // Process the unit control type - if (!lAlphaBlanks(9)) { - constexpr std::array(OAUnitCtrlType::Num)> ctrlTypeNamesUC = { + if (lAlphaBlanks(9)) { + ShowWarningEmptyField(state, eoh, cAlphaFields(9), "Control reset to Unconditioned Control."); + thisOutAirUnit.controlType = OAUnitCtrlType::Neutral; + } else { + constexpr std::array ctrlTypeNamesUC = { "NEUTRALCONTROL", "INVALID-UNCONDITIONED", "TEMPERATURECONTROL"}; - OAUnitCtrlType const tmpCtrlType = static_cast(getEnumValue(ctrlTypeNamesUC, state.dataIPShortCut->cAlphaArgs(9))); - switch (tmpCtrlType) { - case OAUnitCtrlType::Neutral: - case OAUnitCtrlType::Temperature: + OAUnitCtrlType tmpCtrlType = static_cast(getEnumValue(ctrlTypeNamesUC, state.dataIPShortCut->cAlphaArgs(9))); + if (tmpCtrlType == OAUnitCtrlType::Invalid) { + ShowWarningEmptyField(state, eoh, cAlphaFields(9), "Control reset to Unconditioned Control."); + } else if (tmpCtrlType == OAUnitCtrlType::Neutral || tmpCtrlType == OAUnitCtrlType::Temperature) { thisOutAirUnit.controlType = tmpCtrlType; - break; - default: - break; // just leave it alone, nothing was done here } - } else { - ShowSevereError(state, - format(R"({}="{}" invalid {}="{}".)", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - cAlphaFields(9), - state.dataIPShortCut->cAlphaArgs(9))); - ShowContinueError(state, "Control reset to Unconditioned Control."); - thisOutAirUnit.controlType = OAUnitCtrlType::Neutral; } // A10:High Control Temp : - thisOutAirUnit.HiCtrlTempSched = state.dataIPShortCut->cAlphaArgs(10); - thisOutAirUnit.HiCtrlTempSchedPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(10)); - if ((thisOutAirUnit.HiCtrlTempSchedPtr == 0) && (!lAlphaBlanks(10))) { - ShowSevereError(state, - format(R"({}="{}" invalid {}="{}" not found.)", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - cAlphaFields(10), - state.dataIPShortCut->cAlphaArgs(9))); + if (lAlphaBlanks(10)) { + } else if ((thisOutAirUnit.hiCtrlTempSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(10))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(10), state.dataIPShortCut->cAlphaArgs(10)); ErrorsFound = true; } // A11:Low Control Temp : - thisOutAirUnit.LoCtrlTempSched = state.dataIPShortCut->cAlphaArgs(11); - thisOutAirUnit.LoCtrlTempSchedPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(11)); - if ((thisOutAirUnit.LoCtrlTempSchedPtr == 0) && (!lAlphaBlanks(11))) { - ShowSevereError(state, - format(R"({}="{}" invalid {}="{}" not found.)", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - cAlphaFields(11), - state.dataIPShortCut->cAlphaArgs(10))); + if (lAlphaBlanks(11)) { + } else if ((thisOutAirUnit.loCtrlTempSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(11))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(11), state.dataIPShortCut->cAlphaArgs(11)); ErrorsFound = true; } @@ -717,7 +675,7 @@ namespace OutdoorAirUnit { thisOutAirUnit.OAEquip(CompNum).MinVolWaterFlow = 0.0; // below: no extra error needed if steam properties not in input // file because getting the steam coil will have done that. - thisOutAirUnit.OAEquip(CompNum).FluidIndex = FluidProperties::GetRefrigNum(state, "STEAM"); + thisOutAirUnit.OAEquip(CompNum).FluidIndex = Fluid::GetRefrigNum(state, "STEAM"); break; } case CompType::WaterCoil_DetailedCool: { @@ -844,7 +802,7 @@ namespace OutdoorAirUnit { break; } case CompType::Desiccant: { - // Futher Enhancement + // Future Enhancement // CASE('DEHUMIDIFIER:DESICCANT:SYSTEM') // thisOutAirUnit%OAEquip(CompNum)%Type= CompType::Desiccant break; @@ -1114,11 +1072,9 @@ namespace OutdoorAirUnit { // Using/Aliasing using DataZoneEquipment::CheckZoneEquipmentList; - using FluidProperties::GetDensityGlycol; using HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil; using PlantUtilities::InitComponentNodes; using PlantUtilities::ScanPlantLoopsForObject; - using ScheduleManager::GetCurrentScheduleValue; using SteamCoils::GetCoilMaxSteamFlowRate; using WaterCoils::SimulateWaterCoilComponents; @@ -1135,7 +1091,7 @@ namespace OutdoorAirUnit { int const InNode = thisOutAirUnit.AirInletNode; int const OutNode = thisOutAirUnit.AirOutletNode; int const OutsideAirNode = thisOutAirUnit.OutsideAirNode; - Real64 const OAFrac = GetCurrentScheduleValue(state, thisOutAirUnit.OutAirSchedPtr); + Real64 const OAFrac = thisOutAirUnit.outAirSched->getCurrentVal(); if (state.dataOutdoorAirUnit->MyOneTimeFlag) { @@ -1225,7 +1181,7 @@ namespace OutdoorAirUnit { if (thisOutAirUnit.ExtFan) { // set the exhaust air mass flow rate from input - Real64 const EAFrac = GetCurrentScheduleValue(state, thisOutAirUnit.ExtOutAirSchedPtr); + Real64 const EAFrac = thisOutAirUnit.extAirSched->getCurrentVal(); thisOutAirUnit.ExtAirMassFlow = RhoAir * EAFrac * thisOutAirUnit.ExtAirVolFlow; thisOutAirUnit.EMaxAirMassFlow = RhoAir * EAFrac * thisOutAirUnit.EFanMaxAirVolFlow; @@ -1247,11 +1203,8 @@ namespace OutdoorAirUnit { CompTypeNames[static_cast(thisOutAirUnit.OAEquip(compLoop).Type)], thisOutAirUnit.OAEquip(compLoop).ComponentName, errFlag); - Real64 const rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(thisOutAirUnit.OAEquip(compLoop).plantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(thisOutAirUnit.OAEquip(compLoop).plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 const rho = state.dataPlnt->PlantLoop(thisOutAirUnit.OAEquip(compLoop).plantLoc.loopNum) + .glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); thisOutAirUnit.OAEquip(compLoop).MaxWaterMassFlow = rho * thisOutAirUnit.OAEquip(compLoop).MaxVolWaterFlow; thisOutAirUnit.OAEquip(compLoop).MinWaterMassFlow = rho * thisOutAirUnit.OAEquip(compLoop).MinVolWaterFlow; InitComponentNodes(state, @@ -1267,11 +1220,8 @@ namespace OutdoorAirUnit { CompTypeNames[static_cast(thisOutAirUnit.OAEquip(compLoop).Type)], thisOutAirUnit.OAEquip(compLoop).ComponentName, errFlag); - Real64 const rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(thisOutAirUnit.OAEquip(compLoop).plantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(thisOutAirUnit.OAEquip(compLoop).plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 const rho = state.dataPlnt->PlantLoop(thisOutAirUnit.OAEquip(compLoop).plantLoc.loopNum) + .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); thisOutAirUnit.OAEquip(compLoop).MaxWaterMassFlow = rho * thisOutAirUnit.OAEquip(compLoop).MaxVolWaterFlow; thisOutAirUnit.OAEquip(compLoop).MinWaterMassFlow = rho * thisOutAirUnit.OAEquip(compLoop).MinVolWaterFlow; InitComponentNodes(state, @@ -1283,13 +1233,8 @@ namespace OutdoorAirUnit { if (thisOutAirUnit.OAEquip(compLoop).Type == CompType::SteamCoil_AirHeat) { thisOutAirUnit.OAEquip(compLoop).MaxVolWaterFlow = GetCoilMaxSteamFlowRate(state, thisOutAirUnit.OAEquip(compLoop).ComponentIndex, errFlag); - Real64 const rho = FluidProperties::GetSatDensityRefrig( - state, - state.dataPlnt->PlantLoop(thisOutAirUnit.OAEquip(compLoop).plantLoc.loopNum).FluidName, - Constant::SteamInitConvTemp, - 1.0, - state.dataPlnt->PlantLoop(thisOutAirUnit.OAEquip(compLoop).plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 const rho = state.dataPlnt->PlantLoop(thisOutAirUnit.OAEquip(compLoop).plantLoc.loopNum) + .steam->getSatDensity(state, Constant::SteamInitConvTemp, 1.0, RoutineName); thisOutAirUnit.OAEquip(compLoop).MaxWaterMassFlow = rho * thisOutAirUnit.OAEquip(compLoop).MaxVolWaterFlow; thisOutAirUnit.OAEquip(compLoop).MinWaterMassFlow = rho * thisOutAirUnit.OAEquip(compLoop).MinVolWaterFlow; InitComponentNodes(state, @@ -1304,11 +1249,8 @@ namespace OutdoorAirUnit { CompTypeNames[static_cast(thisOutAirUnit.OAEquip(compLoop).Type)], thisOutAirUnit.OAEquip(compLoop).ComponentName, errFlag); - Real64 const rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(thisOutAirUnit.OAEquip(compLoop).plantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(thisOutAirUnit.OAEquip(compLoop).plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 const rho = state.dataPlnt->PlantLoop(thisOutAirUnit.OAEquip(compLoop).plantLoc.loopNum) + .glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); thisOutAirUnit.OAEquip(compLoop).MaxWaterMassFlow = rho * thisOutAirUnit.OAEquip(compLoop).MaxVolWaterFlow; thisOutAirUnit.OAEquip(compLoop).MinWaterMassFlow = rho * thisOutAirUnit.OAEquip(compLoop).MinVolWaterFlow; InitComponentNodes(state, @@ -1348,9 +1290,8 @@ namespace OutdoorAirUnit { // set the exhaust air mass flow rate from input if (thisOutAirUnit.ExtFan) { - Real64 const EAFrac = GetCurrentScheduleValue(state, thisOutAirUnit.ExtOutAirSchedPtr); - if (thisOutAirUnit.ExtFanAvailSchedPtr > 0.0) { - thisOutAirUnit.ExtAirMassFlow = RhoAir * EAFrac * thisOutAirUnit.ExtAirVolFlow; + if (thisOutAirUnit.extFanAvailSched != nullptr) { + thisOutAirUnit.ExtAirMassFlow = RhoAir * thisOutAirUnit.ExtAirVolFlow * thisOutAirUnit.extAirSched->getCurrentVal(); } else { thisOutAirUnit.ExtAirMassFlow = 0.0; } @@ -1404,7 +1345,7 @@ namespace OutdoorAirUnit { // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // This subroutine is for sizing zoen outdoor air control unit components for which flow rates have not been + // This subroutine is for sizing zone outdoor air control unit components for which flow rates have not been // specified in the input. // METHODOLOGY EMPLOYED: @@ -1603,7 +1544,6 @@ namespace OutdoorAirUnit { auto &TurnFansOn = state.dataHVACGlobal->TurnFansOn; using HeatingCoils::CheckHeatingCoilSchedule; using HVACHXAssistedCoolingCoil::CheckHXAssistedCoolingCoilSchedule; - using ScheduleManager::GetCurrentScheduleValue; // Locals @@ -1625,14 +1565,14 @@ namespace OutdoorAirUnit { Real64 SetPointTemp; // temperature that will be used to control the radiant system [Celsius] Real64 HiCtrlTemp; // Current high point in setpoint temperature range Real64 LoCtrlTemp; // Current low point in setpoint temperature range - Real64 AirInEnt; // RE-calcualte the Enthalpy of supply air + Real64 AirInEnt; // RE-calculate the Enthalpy of supply air Real64 AirOutletTemp = 0.0; Real64 ZoneSupAirEnt; // Specific humidity ratio of inlet air (kg moisture / kg moist air) // Latent output Real64 LatentOutput; // Latent (moisture) add/removal rate, negative is dehumidification [kg/s] Real64 SpecHumOut; // Specific humidity ratio of outlet air (kg moisture / kg moist air) Real64 SpecHumIn; // Specific humidity ratio of inlet air (kg moisture / kg moist air) - Real64 ZoneAirEnt; // zone air enthalphy J/kg + Real64 ZoneAirEnt; // zone air enthalpy J/kg // initialize local variables int const InletNode = thisOutAirUnit.AirInletNode; // Unit air inlet node, only used if ExtFan @@ -1644,8 +1584,8 @@ namespace OutdoorAirUnit { thisOutAirUnit.CompOutSetTemp = 0.0; thisOutAirUnit.FanEffect = false; - if ((GetCurrentScheduleValue(state, thisOutAirUnit.SchedPtr) <= 0) || (GetCurrentScheduleValue(state, thisOutAirUnit.OutAirSchedPtr) <= 0) || - ((GetCurrentScheduleValue(state, thisOutAirUnit.SFanAvailSchedPtr) <= 0) && !TurnFansOn) || TurnFansOff) { + if ((thisOutAirUnit.availSched->getCurrentVal() <= 0) || (thisOutAirUnit.outAirSched->getCurrentVal() <= 0) || + ((thisOutAirUnit.supFanAvailSched->getCurrentVal() <= 0) && !TurnFansOn) || TurnFansOff) { // System is off or has no load upon the unit; set the flow rates to zero and then // simulate the components with the no flow conditions if (thisOutAirUnit.ExtFan) { @@ -1753,8 +1693,8 @@ namespace OutdoorAirUnit { } break; case OAUnitCtrlType::Temperature: { SetPointTemp = DesOATemp; - HiCtrlTemp = GetCurrentScheduleValue(state, thisOutAirUnit.HiCtrlTempSchedPtr); - LoCtrlTemp = GetCurrentScheduleValue(state, thisOutAirUnit.LoCtrlTempSchedPtr); + HiCtrlTemp = thisOutAirUnit.hiCtrlTempSched->getCurrentVal(); + LoCtrlTemp = thisOutAirUnit.loCtrlTempSched->getCurrentVal(); if ((DesOATemp <= HiCtrlTemp) && (DesOATemp >= LoCtrlTemp)) { thisOutAirUnit.OperatingMode = Operation::NeutralMode; AirOutletTemp = DesOATemp; @@ -1913,7 +1853,6 @@ namespace OutdoorAirUnit { using HVAC::SmallLoad; using HVACDXHeatPumpSystem::SimDXHeatPumpSystem; using HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil; - using ScheduleManager::GetCurrentScheduleValue; using WaterCoils::SimulateWaterCoilComponents; // SUBROUTINE LOCAL VARIABLE DEFINITIONS diff --git a/src/EnergyPlus/OutdoorAirUnit.hh b/src/EnergyPlus/OutdoorAirUnit.hh index 977c9c4f3fc..6bee320e909 100644 --- a/src/EnergyPlus/OutdoorAirUnit.hh +++ b/src/EnergyPlus/OutdoorAirUnit.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -151,7 +151,7 @@ namespace OutdoorAirUnit { int CoilWaterOutletNode; DataPlant::PlantEquipmentType CoilType; PlantLocation plantLoc; - int FluidIndex; // used in Steam... + int FluidIndex = 0; Real64 MaxVolWaterFlow; Real64 MaxWaterMassFlow; Real64 MinVolWaterFlow; @@ -162,8 +162,8 @@ namespace OutdoorAirUnit { // Default Constructor OAEquipList() : Type(CompType::Invalid), ComponentIndex(0), CoilAirInletNode(0), CoilAirOutletNode(0), CoilWaterInletNode(0), CoilWaterOutletNode(0), - CoilType(DataPlant::PlantEquipmentType::Invalid), plantLoc{}, FluidIndex(0), MaxVolWaterFlow(0.0), MaxWaterMassFlow(0.0), - MinVolWaterFlow(0.0), MinWaterMassFlow(0.0), FirstPass(true) + CoilType(DataPlant::PlantEquipmentType::Invalid), plantLoc{}, MaxVolWaterFlow(0.0), MaxWaterMassFlow(0.0), MinVolWaterFlow(0.0), + MinWaterMassFlow(0.0), FirstPass(true) { } }; @@ -172,48 +172,43 @@ namespace OutdoorAirUnit { { // Members // Input data - std::string Name; // name of unit - std::string SchedName; // availability schedule - int SchedPtr; // index to schedule - std::string ZoneName; // Name of zone the system is serving - int ZonePtr; // Point to this zone in the Zone derived type - int ZoneNodeNum; // index of zone air node in node structure - std::string UnitControlType; // Control type for the system + std::string Name; // name of unit + Sched::Schedule *availSched = nullptr; // availability + std::string ZoneName; // Name of zone the system is serving + int ZonePtr; // Point to this zone in the Zone derived type + int ZoneNodeNum; // index of zone air node in node structure + std::string UnitControlType; // Control type for the system // (Neutral and setpoint temperatrue) - OAUnitCtrlType controlType; // Unit Control type indicator - int AirInletNode; // inlet air node number - int AirOutletNode; // outlet air node number - std::string SFanName; // name of supply fan - int SFan_Index; // index in fan structure - HVAC::FanType supFanType; // type of fan in cFanTypes - int SFanAvailSchedPtr; // supply fan availability sched from fan object - HVAC::FanPlace supFanPlace; // fan placement; blow through and draw through - Real64 FanCorTemp; // correction temperature - bool FanEffect; // .TRUE. if unit has a fan type of draw through - int SFanOutletNode; // supply fan outlet node number - std::string ExtFanName; // name of exhaust fan - int ExtFan_Index; // index in fan structure - HVAC::FanType extFanType; // type of fan in cFanTypes - int ExtFanAvailSchedPtr; // exhaust fan availability sched from fan object - bool ExtFan; // true if there is an exhaust fan - std::string OutAirSchedName; // schedule of fraction for outside air (all controls) - int OutAirSchedPtr; // index to schedule - int OutsideAirNode; // outside air node number - Real64 OutAirVolFlow; // m3/s - Real64 OutAirMassFlow; // kg/s - Real64 ExtAirVolFlow; // m3/s - Real64 ExtAirMassFlow; // kg/s - std::string ExtAirSchedName; // schedule of fraction for exhaust air - int ExtOutAirSchedPtr; // index to schedule - Real64 SMaxAirMassFlow; // kg/s - Real64 EMaxAirMassFlow; // kg/s - Real64 SFanMaxAirVolFlow; // m3/s - Real64 EFanMaxAirVolFlow; // m3/s - std::string HiCtrlTempSched; // Schedule name for the High Control Air temperature - int HiCtrlTempSchedPtr; // Schedule index for the High Control Air temperature - std::string LoCtrlTempSched; // Schedule name for the Low Control Air temperature - int LoCtrlTempSchedPtr; // Schedule index for the Low Control Air temperature - Operation OperatingMode; // operating condition( NeutralMode, HeatingMode, CoolingMode) + OAUnitCtrlType controlType; // Unit Control type indicator + int AirInletNode; // inlet air node number + int AirOutletNode; // outlet air node number + std::string SFanName; // name of supply fan + int SFan_Index; // index in fan structure + HVAC::FanType supFanType; // type of fan in cFanTypes + Sched::Schedule *supFanAvailSched = nullptr; // supply fan availability sched from fan object + HVAC::FanPlace supFanPlace; // fan placement; blow through and draw through + Real64 FanCorTemp; // correction temperature + bool FanEffect; // .TRUE. if unit has a fan type of draw through + int SFanOutletNode; // supply fan outlet node number + std::string ExtFanName; // name of exhaust fan + int ExtFan_Index; // index in fan structure + HVAC::FanType extFanType; // type of fan in cFanTypes + Sched::Schedule *extFanAvailSched = nullptr; // exhaust fan availability sched from fan object + bool ExtFan; // true if there is an exhaust fan + Sched::Schedule *outAirSched = nullptr; // schedule of fraction for outside air (all controls) + int OutsideAirNode; // outside air node number + Real64 OutAirVolFlow; // m3/s + Real64 OutAirMassFlow; // kg/s + Real64 ExtAirVolFlow; // m3/s + Real64 ExtAirMassFlow; // kg/s + Sched::Schedule *extAirSched = nullptr; // schedule of fraction for exhaust air + Real64 SMaxAirMassFlow; // kg/s + Real64 EMaxAirMassFlow; // kg/s + Real64 SFanMaxAirVolFlow; // m3/s + Real64 EFanMaxAirVolFlow; // m3/s + Sched::Schedule *hiCtrlTempSched = nullptr; // Schedule name for the High Control Air temperature + Sched::Schedule *loCtrlTempSched = nullptr; // Schedule name for the Low Control Air temperature + Operation OperatingMode; // operating condition( NeutralMode, HeatingMode, CoolingMode) int ControlCompTypeNum; int CompErrIndex; Real64 AirMassFlow; // kg/s @@ -243,15 +238,14 @@ namespace OutdoorAirUnit { // Default Constructor OAUnitData() - : SchedPtr(0), ZonePtr(0), ZoneNodeNum(0), controlType(OAUnitCtrlType::Invalid), AirInletNode(0), AirOutletNode(0), SFan_Index(0), - supFanType(HVAC::FanType::Invalid), SFanAvailSchedPtr(0), supFanPlace(HVAC::FanPlace::Invalid), FanCorTemp(0.0), FanEffect(false), - SFanOutletNode(0), ExtFan_Index(0), extFanType(HVAC::FanType::Invalid), ExtFanAvailSchedPtr(0), ExtFan(false), OutAirSchedPtr(0), - OutsideAirNode(0), OutAirVolFlow(0.0), OutAirMassFlow(0.0), ExtAirVolFlow(0.0), ExtAirMassFlow(0.0), ExtOutAirSchedPtr(0), - SMaxAirMassFlow(0.0), EMaxAirMassFlow(0.0), SFanMaxAirVolFlow(0.0), EFanMaxAirVolFlow(0.0), HiCtrlTempSchedPtr(0), - LoCtrlTempSchedPtr(0), OperatingMode(Operation::Invalid), ControlCompTypeNum(0), CompErrIndex(0), AirMassFlow(0.0), FlowError(false), - NumComponents(0), CompOutSetTemp(0.0), TotCoolingRate(0.0), TotCoolingEnergy(0.0), SensCoolingRate(0.0), SensCoolingEnergy(0.0), - LatCoolingRate(0.0), LatCoolingEnergy(0.0), ElecFanRate(0.0), ElecFanEnergy(0.0), SensHeatingEnergy(0.0), SensHeatingRate(0.0), - LatHeatingEnergy(0.0), LatHeatingRate(0.0), TotHeatingEnergy(0.0), TotHeatingRate(0.0), FirstPass(true) + : ZonePtr(0), ZoneNodeNum(0), controlType(OAUnitCtrlType::Invalid), AirInletNode(0), AirOutletNode(0), SFan_Index(0), + supFanType(HVAC::FanType::Invalid), supFanPlace(HVAC::FanPlace::Invalid), FanCorTemp(0.0), FanEffect(false), SFanOutletNode(0), + ExtFan_Index(0), extFanType(HVAC::FanType::Invalid), ExtFan(false), OutsideAirNode(0), OutAirVolFlow(0.0), OutAirMassFlow(0.0), + ExtAirVolFlow(0.0), ExtAirMassFlow(0.0), SMaxAirMassFlow(0.0), EMaxAirMassFlow(0.0), SFanMaxAirVolFlow(0.0), EFanMaxAirVolFlow(0.0), + OperatingMode(Operation::Invalid), ControlCompTypeNum(0), CompErrIndex(0), AirMassFlow(0.0), FlowError(false), NumComponents(0), + CompOutSetTemp(0.0), TotCoolingRate(0.0), TotCoolingEnergy(0.0), SensCoolingRate(0.0), SensCoolingEnergy(0.0), LatCoolingRate(0.0), + LatCoolingEnergy(0.0), ElecFanRate(0.0), ElecFanEnergy(0.0), SensHeatingEnergy(0.0), SensHeatingRate(0.0), LatHeatingEnergy(0.0), + LatHeatingRate(0.0), TotHeatingEnergy(0.0), TotHeatingRate(0.0), FirstPass(true) { } }; @@ -333,6 +327,10 @@ struct OutdoorAirUnitData : BaseGlobalStruct bool HeatActive = false; bool CoolActive = false; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/OutputProcessor.cc b/src/EnergyPlus/OutputProcessor.cc index 455ab0c4c3c..d388cf57f5c 100644 --- a/src/EnergyPlus/OutputProcessor.cc +++ b/src/EnergyPlus/OutputProcessor.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -120,7 +120,7 @@ namespace OutputProcessor { // Functions - int DetermineMinuteForReporting(EnergyPlusData &state) + int DetermineMinuteForReporting(EnergyPlusData const &state) { // FUNCTION INFORMATION: @@ -182,7 +182,7 @@ namespace OutputProcessor { op->OutputInitialized = true; - op->TimeStepZoneSec = double(state.dataGlobal->MinutesPerTimeStep) * 60.0; + op->TimeStepZoneSec = double(state.dataGlobal->MinutesInTimeStep) * 60.0; state.files.mtd.ensure_open(state, "InitializeMeters", state.files.outputControl.mtd); } // InitializeOutput() @@ -310,7 +310,7 @@ namespace OutputProcessor { // Make sure that input has been read GetReportVariableInput(state); - auto &op = state.dataOutputProcessor; + auto const &op = state.dataOutputProcessor; for (int iReqVar = 0; iReqVar < (int)op->reqVars.size(); ++iReqVar) { auto *reqVar = op->reqVars[iReqVar]; @@ -329,7 +329,7 @@ namespace OutputProcessor { bool Dup = false; // op->ReportList is allocated to a large value, so we can't use a std::find_if on it (why not?) for (int iReqVar2 : reqVarList) { - if (op->reqVars[iReqVar2]->freq == reqVar->freq && op->reqVars[iReqVar2]->SchedPtr == reqVar->SchedPtr) { + if (op->reqVars[iReqVar2]->freq == reqVar->freq && op->reqVars[iReqVar2]->sched == reqVar->sched) { Dup = true; break; } @@ -447,8 +447,6 @@ namespace OutputProcessor { // \object-list ScheduleNames constexpr std::string_view routineName = "GetReportVariableInput"; - // Using/Aliasing - using ScheduleManager::GetScheduleIndex; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumAlpha; @@ -531,8 +529,8 @@ namespace OutputProcessor { // Schedule information if (lAlphaBlanks(4)) { - reqVar->SchedPtr = 0; - } else if ((reqVar->SchedPtr = GetScheduleIndex(state, Util::makeUPPER(cAlphaArgs(4)))) == 0) { + reqVar->sched = nullptr; + } else if ((reqVar->sched = Sched::GetSchedule(state, cAlphaArgs(4))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(4), cAlphaArgs(4)); ErrorsFound = true; } @@ -671,11 +669,9 @@ namespace OutputProcessor { Array1D_string NamesOfKeys; // Specific key name Array1D_int IndexesForKeyVar; // Array index - std::vector onCustomMeterVarNums; Array1D_int VarsOnSourceMeter; - bool BigErrorsFound; - BigErrorsFound = false; + bool BigErrorsFound = false; int numCustomMeters = 0, numCustomDecMeters = 0; std::vector customMeterNames; @@ -747,7 +743,7 @@ namespace OutputProcessor { } std::string meterOrVarNameUC = Util::makeUPPER(ipsc->cAlphaArgs(fldIndex + 1)); - std::string::size_type lbrackPos = index(meterOrVarNameUC, '['); + lbrackPos = index(meterOrVarNameUC, '['); if (lbrackPos != std::string::npos) meterOrVarNameUC.erase(lbrackPos); // A custom meter cannot reference another custom meter @@ -782,12 +778,12 @@ namespace OutputProcessor { units = srcMeter->units; itemsAssigned = true; } else if (units != srcMeter->units) { - ShowWarningCustomMessage(state, - eoh, - format(R"(Meter:Custom="{}", differing units in {}="{}".)", - ipsc->cAlphaArgs(1), - ipsc->cAlphaFieldNames(fldIndex + 1), - meterOrVarNameUC)); + ShowWarningCustom(state, + eoh, + format(R"(Meter:Custom="{}", differing units in {}="{}".)", + ipsc->cAlphaArgs(1), + ipsc->cAlphaFieldNames(fldIndex + 1), + meterOrVarNameUC)); ShowContinueError(state, format("...will not be shown with the Meter results; units for meter={}, units for this variable={}.", Constant::unitNames[(int)units], @@ -803,12 +799,12 @@ namespace OutputProcessor { // Has to be a summed variable if (srcDDVar->storeType != StoreType::Sum) { - ShowWarningCustomMessage(state, // Is clang-format formatting things like this? This is gross. - eoh, - format(R"(Meter:Custom="{}", variable not summed variable {}="{}".)", - ipsc->cAlphaArgs(1), - ipsc->cAlphaFieldNames(fldIndex + 1), - meterOrVarNameUC)); + ShowWarningCustom(state, + eoh, + format(R"(Meter:Custom="{}", variable not summed variable {}="{}".)", + ipsc->cAlphaArgs(1), + ipsc->cAlphaFieldNames(fldIndex + 1), + meterOrVarNameUC)); ShowContinueError(state, format("...will not be shown with the Meter results; units for meter={}, units for this variable={}.", Constant::unitNames[(int)units], @@ -822,7 +818,7 @@ namespace OutputProcessor { units = srcDDVar->units; // Otherwise it has to match the existing units } else if (units != srcDDVar->units) { - ShowWarningCustomMessage( + ShowWarningCustom( state, eoh, format("differing units in {}=\"{}\".", ipsc->cAlphaFieldNames(fldIndex + 1), meterOrVarNameUC)); ShowContinueError(state, format("...will not be shown with the Meter results; units for meter={}, units for this variable={}.", @@ -915,7 +911,7 @@ namespace OutputProcessor { for (int fldIndex = 3; fldIndex <= NumAlpha; fldIndex += 2) { // No need to check for empty fields std::string meterOrVarNameUC = Util::makeUPPER(ipsc->cAlphaArgs(fldIndex + 1)); - std::string::size_type lbrackPos = index(meterOrVarNameUC, '['); + lbrackPos = index(meterOrVarNameUC, '['); if (lbrackPos != std::string::npos) meterOrVarNameUC.erase(lbrackPos); // No need to check for custom source meters @@ -929,11 +925,11 @@ namespace OutputProcessor { // Check for duplicates if (std::find(meter->srcMeterNums.begin(), meter->srcMeterNums.end(), srcMeterNum) != meter->srcMeterNums.end()) { - ShowWarningCustomMessage(state, - eoh, - format("{}=\"{}\" referenced multiple times, only first instance will be used", - ipsc->cAlphaFieldNames(fldIndex + 1), - meterOrVarNameUC)); + ShowWarningCustom(state, + eoh, + format("{}=\"{}\" referenced multiple times, only first instance will be used", + ipsc->cAlphaFieldNames(fldIndex + 1), + meterOrVarNameUC)); continue; } @@ -962,10 +958,10 @@ namespace OutputProcessor { // No need to check for empty keys for (int keyOutVarNum : srcDDVar->keyOutVarNums) { if (std::find(meter->srcVarNums.begin(), meter->srcVarNums.end(), keyOutVarNum) != meter->srcVarNums.end()) { - ShowWarningCustomMessage(state, - eoh, - format("Output variable \"{}\" referenced multiple times (directly or via meter)", - op->outVars[keyOutVarNum]->keyColonNameUC)); + ShowWarningCustom(state, + eoh, + format("Output variable \"{}\" referenced multiple times (directly or via meter)", + op->outVars[keyOutVarNum]->keyColonNameUC)); } else { meter->srcVarNums.push_back(keyOutVarNum); @@ -976,10 +972,10 @@ namespace OutputProcessor { for (int keyOutVarNum : srcDDVar->keyOutVarNums) { if (op->outVars[keyOutVarNum]->keyUC == ipsc->cAlphaArgs(fldIndex)) { if (std::find(meter->srcVarNums.begin(), meter->srcVarNums.end(), keyOutVarNum) != meter->srcVarNums.end()) { - ShowWarningCustomMessage(state, - eoh, - format("Output variable \"{}\" referenced multiple times (directly or via meter)", - op->outVars[keyOutVarNum]->keyColonNameUC)); + ShowWarningCustom(state, + eoh, + format("Output variable \"{}\" referenced multiple times (directly or via meter)", + op->outVars[keyOutVarNum]->keyColonNameUC)); } else { meter->srcVarNums.push_back(keyOutVarNum); op->outVars[keyOutVarNum]->meterNums.push_back(meterNum); @@ -1079,7 +1075,7 @@ namespace OutputProcessor { } std::string meterOrVarNameUC = Util::makeUPPER(ipsc->cAlphaArgs(fldIndex + 1)); - std::string::size_type lbrackPos = index(meterOrVarNameUC, '['); + lbrackPos = index(meterOrVarNameUC, '['); if (lbrackPos != std::string::npos) meterOrVarNameUC.erase(lbrackPos); // A custom meter cannot reference another custom meter @@ -1103,12 +1099,12 @@ namespace OutputProcessor { units = srcMeter->units; itemsAssigned = true; } else if (units != srcMeter->units) { - ShowWarningCustomMessage(state, - eoh, - format(R"(Meter:Custom="{}", differing units in {}="{}".)", - ipsc->cAlphaArgs(1), - ipsc->cAlphaFieldNames(fldIndex + 1), - meterOrVarNameUC)); + ShowWarningCustom(state, + eoh, + format(R"(Meter:Custom="{}", differing units in {}="{}".)", + ipsc->cAlphaArgs(1), + ipsc->cAlphaFieldNames(fldIndex + 1), + meterOrVarNameUC)); ShowContinueError(state, format("...will not be shown with the Meter results; units for meter={}, units for this variable={}.", Constant::unitNames[(int)units], @@ -1124,12 +1120,12 @@ namespace OutputProcessor { // Has to be a summed variable if (srcDDVar->storeType != StoreType::Sum) { - ShowWarningCustomMessage(state, - eoh, - format(R"(Meter:Custom="{}", variable not summed variable {}="{}".)", - ipsc->cAlphaArgs(1), - ipsc->cAlphaFieldNames(fldIndex + 1), - meterOrVarNameUC)); + ShowWarningCustom(state, + eoh, + format(R"(Meter:Custom="{}", variable not summed variable {}="{}".)", + ipsc->cAlphaArgs(1), + ipsc->cAlphaFieldNames(fldIndex + 1), + meterOrVarNameUC)); ShowContinueError(state, format("...will not be shown with the Meter results; units for meter={}, units for this variable={}.", Constant::unitNames[(int)units], @@ -1143,7 +1139,7 @@ namespace OutputProcessor { units = srcDDVar->units; // Otherwise it has to match the existing units } else if (units != srcDDVar->units) { - ShowWarningCustomMessage( + ShowWarningCustom( state, eoh, format("differing units in {}=\"{}\".", ipsc->cAlphaFieldNames(fldIndex + 1), meterOrVarNameUC)); ShowContinueError(state, format("...will not be shown with the Meter results; units for meter={}, units for this variable={}.", @@ -1250,7 +1246,7 @@ namespace OutputProcessor { for (int fldIndex = 4; fldIndex <= NumAlpha; fldIndex += 2) { // No need to check for empty fields std::string meterOrVarNameUC = Util::makeUPPER(ipsc->cAlphaArgs(fldIndex + 1)); - std::string::size_type lbrackPos = index(meterOrVarNameUC, '['); + lbrackPos = index(meterOrVarNameUC, '['); if (lbrackPos != std::string::npos) meterOrVarNameUC.erase(lbrackPos); // No need to check for custom source meters @@ -1264,11 +1260,11 @@ namespace OutputProcessor { // Check for duplicates if (std::find(meter->srcMeterNums.begin(), meter->srcMeterNums.end(), srcMeterNum) != meter->srcMeterNums.end()) { - ShowWarningCustomMessage(state, - eoh, - format("{}=\"{}\" referenced multiple times, only first instance will be used", - ipsc->cAlphaFieldNames(fldIndex + 1), - meterOrVarNameUC)); + ShowWarningCustom(state, + eoh, + format("{}=\"{}\" referenced multiple times, only first instance will be used", + ipsc->cAlphaFieldNames(fldIndex + 1), + meterOrVarNameUC)); continue; } @@ -1297,10 +1293,10 @@ namespace OutputProcessor { // No need to check for empty keys for (int keyOutVarNum : srcDDVar->keyOutVarNums) { if (std::find(meter->srcVarNums.begin(), meter->srcVarNums.end(), keyOutVarNum) != meter->srcVarNums.end()) { - ShowWarningCustomMessage(state, - eoh, - format("Output variable \"{}\" referenced multiple times (directly or via meter)", - op->outVars[keyOutVarNum]->keyColonNameUC)); + ShowWarningCustom(state, + eoh, + format("Output variable \"{}\" referenced multiple times (directly or via meter)", + op->outVars[keyOutVarNum]->keyColonNameUC)); } else { meter->srcVarNums.push_back(keyOutVarNum); @@ -1311,10 +1307,10 @@ namespace OutputProcessor { for (int keyOutVarNum : srcDDVar->keyOutVarNums) { if (op->outVars[keyOutVarNum]->keyUC == ipsc->cAlphaArgs(fldIndex)) { if (std::find(meter->srcVarNums.begin(), meter->srcVarNums.end(), keyOutVarNum) != meter->srcVarNums.end()) { - ShowWarningCustomMessage(state, - eoh, - format("Output variable \"{}\" referenced multiple times (directly or via meter)", - op->outVars[keyOutVarNum]->keyColonNameUC)); + ShowWarningCustom(state, + eoh, + format("Output variable \"{}\" referenced multiple times (directly or via meter)", + op->outVars[keyOutVarNum]->keyColonNameUC)); } else { meter->srcVarNums.push_back(keyOutVarNum); op->outVars[keyOutVarNum]->meterNums.push_back(meterNum); @@ -1703,7 +1699,7 @@ namespace OutputProcessor { // Resets the accumulating meter values. Needed after warmup period is over to // reset the totals on meters so that they are not accumulated over the warmup period - auto &op = state.dataOutputProcessor; + auto const &op = state.dataOutputProcessor; for (auto *meter : op->meters) { for (int iPeriod = (int)ReportFreq::Hour; iPeriod < (int)ReportFreq::Num; ++iPeriod) { @@ -1772,7 +1768,7 @@ namespace OutputProcessor { EndMinute, StartMinute, state.dataEnvrn->DSTIndicator, - ScheduleManager::dayTypeNames[CurDayType]); + Sched::dayTypeNames[CurDayType]); if (rfMetersTS.dataFrameEnabled()) { rfMetersTS.newRow( state.dataEnvrn->Month, state.dataEnvrn->DayOfMonth, state.dataGlobal->HourOfDay, EndMinute, state.dataGlobal->CalendarYear); @@ -1795,7 +1791,7 @@ namespace OutputProcessor { EndMinute, StartMinute, state.dataEnvrn->DSTIndicator, - ScheduleManager::dayTypeNames[CurDayType]); + Sched::dayTypeNames[CurDayType]); PrintESOTimeStamp = false; } @@ -1874,7 +1870,7 @@ namespace OutputProcessor { -1, // EndMinute -1, // StartMinute state.dataEnvrn->DSTIndicator, - ScheduleManager::dayTypeNames[CurDayType]); + Sched::dayTypeNames[CurDayType]); } break; case ReportFreq::Day: { @@ -1890,7 +1886,7 @@ namespace OutputProcessor { -1, // EndMinute -1, // StartMinute state.dataEnvrn->DSTIndicator, - ScheduleManager::dayTypeNames[CurDayType]); + Sched::dayTypeNames[CurDayType]); } break; case ReportFreq::Month: { @@ -1966,7 +1962,7 @@ namespace OutputProcessor { // in the data structure. // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - auto &op = state.dataOutputProcessor; + auto const &op = state.dataOutputProcessor; for (auto *meter : op->meters) { auto &period = meter->periodFinYrSM; @@ -2423,7 +2419,6 @@ namespace OutputProcessor { // and the SQL database // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - auto &op = state.dataOutputProcessor; auto &rf = state.dataResultsFramework->resultsFramework; auto &sql = state.dataSQLiteProcedures->sqlite; @@ -2431,7 +2426,7 @@ namespace OutputProcessor { ? unitNameCustomEMS : ((units == Constant::Units::Invalid) ? "" : Constant::unitNames[(int)units]); - std::string schedString = (SchedPtr != 0) ? state.dataScheduleMgr->Schedule(SchedPtr).Name : ""; + std::string schedString = (sched != nullptr) ? sched->Name : ""; if (state.files.eso.good()) { print(state.files.eso, @@ -2448,7 +2443,7 @@ namespace OutputProcessor { if (freq == ReportFreq::Hour || freq == ReportFreq::Day || freq == ReportFreq::Month || freq == ReportFreq::Year || freq == ReportFreq::Simulation) - op->freqTrackingVariables[(int)freq] = true; + state.dataOutputProcessor->freqTrackingVariables[(int)freq] = true; if (sql) { sql->createSQLiteReportDictionaryRecord(ReportID, storeType, indexGroup, key, name, timeStepType, unitsString, freq, false, schedString); @@ -2623,7 +2618,7 @@ namespace OutputProcessor { } if (sql) { - sql->createSQLiteReportDataRecord(RptNum, Value, freq, MinVal, MinValDate, MaxVal, MaxValDate, state.dataGlobal->MinutesPerTimeStep); + sql->createSQLiteReportDataRecord(RptNum, Value, freq, MinVal, MinValDate, MaxVal, MaxValDate, state.dataGlobal->MinutesInTimeStep); } if ((freq == ReportFreq::EachCall) || (freq == ReportFreq::TimeStep) || (freq == ReportFreq::Hour)) { // -1, 0, 1 @@ -2736,8 +2731,6 @@ namespace OutputProcessor { // easier maintenance and writing of data to the SQL database. // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - std::string MaxOut; // Character for Max out string - std::string MinOut; // Character for Min out string auto &rf = state.dataResultsFramework->resultsFramework; auto &sql = state.dataSQLiteProcedures->sqlite; @@ -3018,7 +3011,7 @@ void SetupOutputVariable(EnergyPlusData &state, var->units = units; if (units == Constant::Units::customEMS) var->unitNameCustomEMS = customUnitName; var->freq = freq; - var->SchedPtr = 0; + var->sched = nullptr; var->ReportID = ++op->ReportNumberCounter; var->Which = &ActualVariable; var->ZoneMult = ZoneMult; @@ -3042,7 +3035,7 @@ void SetupOutputVariable(EnergyPlusData &state, // freq != ReportFreq::Hour if (freq == ReportFreq::Hour) { var->freq = op->reqVars[reqVarNum]->freq; - var->SchedPtr = op->reqVars[reqVarNum]->SchedPtr; + var->sched = op->reqVars[reqVarNum]->sched; } var->writeReportDictionaryItem(state); @@ -3133,10 +3126,10 @@ void SetupOutputVariable(EnergyPlusData &state, if (freq != ReportFreq::Hour) { var->freq = freq; - var->SchedPtr = 0; + var->sched = nullptr; } else { var->freq = op->reqVars[reqVarNum]->freq; - var->SchedPtr = op->reqVars[reqVarNum]->SchedPtr; + var->sched = op->reqVars[reqVarNum]->sched; } var->writeReportDictionaryItem(state); @@ -3160,7 +3153,6 @@ void UpdateDataandReport(EnergyPlusData &state, OutputProcessor::TimeStepType co // Using/Aliasing using namespace OutputProcessor; using General::EncodeMonDayHrMin; - using ScheduleManager::GetCurrentScheduleValue; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: bool TimePrint(true); // True if the time needs to be printed @@ -3190,7 +3182,7 @@ void UpdateDataandReport(EnergyPlusData &state, OutputProcessor::TimeStepType co TimePrint = true; Real64 rxTime = (MinuteNow - StartMinute) / - double(state.dataGlobal->MinutesPerTimeStep); // (MinuteNow-StartMinute)/REAL(MinutesPerTimeStep,r64) - for execution time + double(state.dataGlobal->MinutesInTimeStep); // (MinuteNow-StartMinute)/REAL(MinutesPerTimeStep,r64) - for execution time if (rf->timeSeriesEnabled()) { // R and I data frames for TimeStepType::TimeStepZone @@ -3255,7 +3247,7 @@ void UpdateDataandReport(EnergyPlusData &state, OutputProcessor::TimeStepType co // End of "record keeping" Report if applicable if (!var->Report) continue; - if (var->SchedPtr > 0 && GetCurrentScheduleValue(state, var->SchedPtr) == 0.0) continue; + if (var->sched != nullptr && var->sched->getCurrentVal() == 0.0) continue; var->tsStored = true; if (!var->thisTSStored) { @@ -3284,7 +3276,7 @@ void UpdateDataandReport(EnergyPlusData &state, OutputProcessor::TimeStepType co op->TimeValue[(int)t_TimeStepTypeKey].CurMinute, StartMinute, state.dataEnvrn->DSTIndicator, - ScheduleManager::dayTypeNames[CurDayType]); + Sched::dayTypeNames[CurDayType]); op->LHourP = state.dataGlobal->HourOfDay; op->LStartMin = StartMinute; op->LEndMin = op->TimeValue[(int)t_TimeStepTypeKey].CurMinute; @@ -3350,7 +3342,7 @@ void UpdateDataandReport(EnergyPlusData &state, OutputProcessor::TimeStepType co if (var->timeStepType != TimeStepType::Zone && var->timeStepType != TimeStepType::System) continue; bool ReportNow = true; - if (var->SchedPtr > 0) ReportNow = (GetCurrentScheduleValue(state, var->SchedPtr) != 0.0); // SetReportNow(RVar%SchedPtr) + if (var->sched != nullptr) ReportNow = (var->sched->getCurrentVal() != 0.0); // SetReportNow(RVar%SchedPtr) if (!ReportNow || !var->Report) { var->TSValue = 0.0; } @@ -3382,7 +3374,7 @@ void UpdateDataandReport(EnergyPlusData &state, OutputProcessor::TimeStepType co op->TimeValue[(int)var->timeStepType].CurMinute, StartMinute, state.dataEnvrn->DSTIndicator, - ScheduleManager::dayTypeNames[CurDayType]); + Sched::dayTypeNames[CurDayType]); op->LHourP = state.dataGlobal->HourOfDay; op->LStartMin = StartMinute; op->LEndMin = op->TimeValue[(int)var->timeStepType].CurMinute; @@ -3426,7 +3418,7 @@ void UpdateDataandReport(EnergyPlusData &state, OutputProcessor::TimeStepType co -1, // EndMinute -1, // startMinute state.dataEnvrn->DSTIndicator, - ScheduleManager::dayTypeNames[CurDayType]); + Sched::dayTypeNames[CurDayType]); TimePrint = false; } @@ -3496,7 +3488,7 @@ void UpdateDataandReport(EnergyPlusData &state, OutputProcessor::TimeStepType co -1, // EndMinute -1, // StartMinute state.dataEnvrn->DSTIndicator, - ScheduleManager::dayTypeNames[CurDayType]); + Sched::dayTypeNames[CurDayType]); TimePrint = false; } if (rf->timeSeriesEnabled()) { @@ -3730,7 +3722,7 @@ void UpdateMeterReporting(EnergyPlusData &state) int NumReqMeterFOs; bool ErrorsFound(false); // If errors detected in input - auto &op = state.dataOutputProcessor; + auto const &op = state.dataOutputProcessor; auto &ipsc = state.dataIPShortCut; GetCustomMeterInput(state, ErrorsFound); @@ -3748,7 +3740,7 @@ void UpdateMeterReporting(EnergyPlusData &state) name.erase(varnameLen); } - auto &op = state.dataOutputProcessor; + auto const &op = state.dataOutputProcessor; std::string::size_type wildCardPosition = index(name, '*'); @@ -3947,7 +3939,7 @@ void SetInitialMeterReportingAndOutputNames(EnergyPlusData &state, } // if (CumulativeIndicator) } // SetInitialMeterReportingAndOutputNames() -int GetMeterIndex(EnergyPlusData &state, std::string const &name) +int GetMeterIndex(EnergyPlusData const &state, std::string const &name) { // FUNCTION INFORMATION: @@ -3959,13 +3951,13 @@ int GetMeterIndex(EnergyPlusData &state, std::string const &name) // for the meter name. If none active for this run, a zero is returned. This is used later to // obtain a meter "value". - auto &op = state.dataOutputProcessor; + auto const &op = state.dataOutputProcessor; auto found = op->meterMap.find(name); return (found != op->meterMap.end()) ? found->second : -1; } // GetMeterIndex() -Constant::eResource GetMeterResourceType(EnergyPlusData &state, int const MeterNumber) // Which Meter Number (from GetMeterIndex) +Constant::eResource GetMeterResourceType(EnergyPlusData const &state, int const MeterNumber) // Which Meter Number (from GetMeterIndex) { // FUNCTION INFORMATION: @@ -3978,7 +3970,7 @@ Constant::eResource GetMeterResourceType(EnergyPlusData &state, int const MeterN return (MeterNumber != -1) ? state.dataOutputProcessor->meters[MeterNumber]->resource : Constant::eResource::Invalid; } // GetMeterResourceType() -Real64 GetCurrentMeterValue(EnergyPlusData &state, int const MeterNumber) // Which Meter Number (from GetMeterIndex) +Real64 GetCurrentMeterValue(EnergyPlusData const &state, int const MeterNumber) // Which Meter Number (from GetMeterIndex) { // FUNCTION INFORMATION: @@ -4012,7 +4004,7 @@ Real64 GetInstantMeterValue(EnergyPlusData &state, if (meterNum == -1) return InstantMeterValue; - auto &op = state.dataOutputProcessor; + auto const &op = state.dataOutputProcessor; auto *meter = op->meters[meterNum]; if (meter->type == MeterType::Normal || meter->type == MeterType::Custom) { @@ -4072,12 +4064,11 @@ Real64 GetInternalVariableValue(EnergyPlusData &state, // Using/Aliasing using namespace OutputProcessor; - using ScheduleManager::GetCurrentScheduleValue; // Return value Real64 resultVal; // value returned - auto &op = state.dataOutputProcessor; + auto const &op = state.dataOutputProcessor; // Select based on variable type: integer, real, or meter if (varType == VariableType::Invalid) { // Variable not a found variable @@ -4094,7 +4085,7 @@ Real64 GetInternalVariableValue(EnergyPlusData &state, } else if (varType == VariableType::Meter) { resultVal = GetCurrentMeterValue(state, keyVarIndex); } else if (varType == VariableType::Schedule) { - resultVal = GetCurrentScheduleValue(state, keyVarIndex); + resultVal = state.dataSched->schedules[keyVarIndex]->getCurrentVal(); } else { resultVal = 0.0; } @@ -4123,12 +4114,11 @@ Real64 GetInternalVariableValueExternalInterface(EnergyPlusData &state, // Using/Aliasing using namespace OutputProcessor; - using ScheduleManager::GetCurrentScheduleValue; // Return value Real64 resultVal; // value returned - auto &op = state.dataOutputProcessor; + auto const &op = state.dataOutputProcessor; // Select based on variable type: integer, REAL(r64), or meter if (varType == VariableType::Invalid) { // Variable not a found variable @@ -4142,7 +4132,7 @@ Real64 GetInternalVariableValueExternalInterface(EnergyPlusData &state, } else if (varType == VariableType::Meter) { resultVal = GetCurrentMeterValue(state, keyVarIndex); } else if (varType == VariableType::Schedule) { - resultVal = GetCurrentScheduleValue(state, keyVarIndex); + resultVal = state.dataSched->schedules[keyVarIndex]->getCurrentVal(); } else { resultVal = 0.0; } @@ -4150,7 +4140,7 @@ Real64 GetInternalVariableValueExternalInterface(EnergyPlusData &state, return resultVal; } // GetInternalVariableValueExternalInterface() -int GetNumMeteredVariables(EnergyPlusData &state, +int GetNumMeteredVariables(EnergyPlusData const &state, [[maybe_unused]] std::string const &ComponentType, // Given Component Type std::string const &ComponentName // Given Component Name (user defined) ) @@ -4167,7 +4157,7 @@ int GetNumMeteredVariables(EnergyPlusData &state, // FUNCTION LOCAL VARIABLE DECLARATIONS: int NumVariables = 0; - auto &op = state.dataOutputProcessor; + auto const &op = state.dataOutputProcessor; for (auto *var : op->outVars) { // Pos=INDEX(RVariableTypes(Loop)%VarName,':') @@ -4280,13 +4270,10 @@ void GetVariableKeyCountandType(EnergyPlusData &state, // When the variable is found, the variable type (varType) is set and the // number of associated keys is counted. - // Using/Aliasing using namespace OutputProcessor; - using ScheduleManager::GetScheduleIndex; - using ScheduleManager::GetScheduleType; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - auto &op = state.dataOutputProcessor; + auto const &op = state.dataOutputProcessor; varType = VariableType::Invalid; numKeys = 0; @@ -4305,11 +4292,11 @@ void GetVariableKeyCountandType(EnergyPlusData &state, units = ddOutVar->units; numKeys = ddOutVar->keyOutVarNums.size(); - } else if (auto found = op->meterMap.find(nameUC); found != op->meterMap.end()) { + } else if (auto found2 = op->meterMap.find(nameUC); found2 != op->meterMap.end()) { // Search Meters if not found in integers or reals // Use the GetMeterIndex function // Meters do not have keys, so only one will be found - int meterNum = found->second; + int meterNum = found2->second; numKeys = 1; varType = VariableType::Meter; units = op->meters[meterNum]->units; @@ -4318,13 +4305,15 @@ void GetVariableKeyCountandType(EnergyPlusData &state, } else { // Search schedules if not found in integers, reals, or meters - // Use the GetScheduleIndex function // Schedules do not have keys, so only one will be found - int schedNum = GetScheduleIndex(state, nameUC); - if (schedNum > 0) { + auto *sched = Sched::GetSchedule(state, nameUC); + if (sched != nullptr) { numKeys = 1; varType = VariableType::Schedule; - units = static_cast(getEnumValue(Constant::unitNamesUC, Util::makeUPPER(GetScheduleType(state, schedNum)))); + if (sched->schedTypeNum != Sched::SchedNum_Invalid) { + std::string const &schedTypeName = state.dataSched->scheduleTypes[sched->schedTypeNum]->Name; + units = static_cast(getEnumValue(Constant::unitNamesUC, schedTypeName)); + } storeType = StoreType::Average; timeStepType = TimeStepType::Zone; } @@ -4359,14 +4348,13 @@ void GetVariableKeys(EnergyPlusData &state, // Using/Aliasing using namespace OutputProcessor; - using ScheduleManager::GetScheduleIndex; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: std::string nameUC = Util::makeUPPER(varName); - auto &op = state.dataOutputProcessor; // Select based on variable type: integer, real, or meter if (varType == VariableType::Integer || varType == VariableType::Real) { + auto const &op = state.dataOutputProcessor; auto found = op->ddOutVarMap.find(nameUC); if (found == op->ddOutVarMap.end()) return; @@ -4396,7 +4384,7 @@ void GetVariableKeys(EnergyPlusData &state, if (size(keyOutVarNums) == 0) { ShowFatalError(state, "Invalid array size in GetVariableKeys"); } - keyOutVarNums(1) = GetScheduleIndex(state, varName); + keyOutVarNums(1) = Sched::GetScheduleNum(state, varName); keyNames(1) = "Environment"; } else { // do nothing @@ -4415,7 +4403,7 @@ bool ReportingThisVariable(EnergyPlusData &state, std::string const &RepVarName) // if user has requested this variable be reported. using namespace OutputProcessor; - auto &op = state.dataOutputProcessor; + auto const &op = state.dataOutputProcessor; std::string name = Util::makeUPPER(RepVarName); @@ -4533,8 +4521,8 @@ void ProduceRDDMDD(EnergyPlusData &state) bool DoReport; bool SortByName; - auto &op = state.dataOutputProcessor; - auto &rf = state.dataResultsFramework->resultsFramework; + auto const &op = state.dataOutputProcessor; + auto const &rf = state.dataResultsFramework->resultsFramework; // See if Report Variables should be turned on SortByName = false; @@ -4609,11 +4597,9 @@ void ProduceRDDMDD(EnergyPlusData &state) while (ddVar->Next != -1) { ddVar = op->ddOutVars[ddVar->Next]; - std::string_view timeStepName = timeStepTypeNames[(int)ddVar->timeStepType]; - std::string_view storeTypeName = storeTypeNames[(int)ddVar->storeType]; - std::string_view varName = ddVar->name; - std::string_view unitName = - (ddVar->units == Constant::Units::customEMS) ? ddVar->unitNameCustomEMS : Constant::unitNames[(int)ddVar->units]; + timeStepName = timeStepTypeNames[(int)ddVar->timeStepType]; + storeTypeName = storeTypeNames[(int)ddVar->storeType]; + varName = ddVar->name; if (op->ProduceReportVDD == ReportVDD::Yes) { print(state.files.rdd, "{},{},{} [{}]\n", timeStepName, storeTypeName, varName, unitName); @@ -4647,7 +4633,7 @@ void ProduceRDDMDD(EnergyPlusData &state) state.files.mdd.close(); } // ProduceRDDMDD() -int AddDDOutVar(EnergyPlusData &state, +int AddDDOutVar(EnergyPlusData const &state, std::string_view const name, // Variable Name OutputProcessor::TimeStepType const timeStepType, OutputProcessor::StoreType const storeType, @@ -4669,7 +4655,7 @@ int AddDDOutVar(EnergyPlusData &state, using namespace OutputProcessor; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - auto &op = state.dataOutputProcessor; + auto const &op = state.dataOutputProcessor; std::string nameUC = Util::makeUPPER(name); diff --git a/src/EnergyPlus/OutputProcessor.hh b/src/EnergyPlus/OutputProcessor.hh index ccadcc8073f..be127c7b7bf 100644 --- a/src/EnergyPlus/OutputProcessor.hh +++ b/src/EnergyPlus/OutputProcessor.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -63,6 +63,7 @@ #include #include #include +#include // Third party Headers #include "re2/re2.h" @@ -444,7 +445,7 @@ namespace OutputProcessor { int maxValueDate = 0; // Date stamp of maximum int minValueDate = 0; // Date stamp of minimum int ReportID = 0; // Report variable ID number - int SchedPtr = 0; // If scheduled, this points to the schedule + Sched::Schedule *sched = nullptr; // If scheduled, this is schedule int ZoneMult = 1; // If metered, Zone Multiplier is applied int ZoneListMult = 1; // If metered, Zone List Multiplier is applied @@ -517,8 +518,7 @@ namespace OutputProcessor { std::string key = ""; // Could be blank or "*" std::string name = ""; // Name of Variable ReportFreq freq = ReportFreq::Hour; // Reporting Frequency - int SchedPtr = 0; // Index of the Schedule - std::string SchedName = ""; // Schedule Name + Sched::Schedule *sched = nullptr; // Schedule bool Used = false; // True when this combination (key, varname, frequency) has been set bool is_simple_string = true; // Whether the Key potentially includes a Regular Expression pattern @@ -622,7 +622,7 @@ namespace OutputProcessor { Array1D_string spaceTypeName; // Array of space type names }; - int DetermineMinuteForReporting(EnergyPlusData &state); + int DetermineMinuteForReporting(EnergyPlusData const &state); void InitializeOutput(EnergyPlusData &state); @@ -824,11 +824,11 @@ void SetInitialMeterReportingAndOutputNames(EnergyPlusData &state, bool CumulativeIndicator // true if this is a Cumulative meter reporting ); -int GetMeterIndex(EnergyPlusData &state, std::string const &MeterName); +int GetMeterIndex(EnergyPlusData const &state, std::string const &MeterName); -Constant::eResource GetMeterResourceType(EnergyPlusData &state, int MeterNumber); // Which Meter Number (from GetMeterIndex) +Constant::eResource GetMeterResourceType(EnergyPlusData const &state, int MeterNumber); // Which Meter Number (from GetMeterIndex) -Real64 GetCurrentMeterValue(EnergyPlusData &state, int MeterNumber); // Which Meter Number (from GetMeterIndex) +Real64 GetCurrentMeterValue(EnergyPlusData const &state, int MeterNumber); // Which Meter Number (from GetMeterIndex) Real64 GetInstantMeterValue(EnergyPlusData &state, int MeterNumber, // Which Meter Number (from GetMeterIndex) @@ -845,7 +845,7 @@ Real64 GetInternalVariableValueExternalInterface(EnergyPlusData &state, int keyVarIndex // Array index ); -int GetNumMeteredVariables(EnergyPlusData &state, +int GetNumMeteredVariables(EnergyPlusData const &state, std::string const &ComponentType, // Given Component Type std::string const &ComponentName // Given Component Name (user defined) ); @@ -877,7 +877,7 @@ void InitPollutionMeterReporting(EnergyPlusData &state, OutputProcessor::ReportF void ProduceRDDMDD(EnergyPlusData &state); -int AddDDOutVar(EnergyPlusData &state, +int AddDDOutVar(EnergyPlusData const &state, std::string_view const nameUC, // Variable Name OutputProcessor::TimeStepType TimeStepType, OutputProcessor::StoreType StateType, @@ -942,6 +942,10 @@ struct OutputProcessorData : BaseGlobalStruct int maxNumEndUseSpaceTypes = 1; EPVector EndUseCategory; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/OutputReportData.cc b/src/EnergyPlus/OutputReportData.cc index 1393cbfb5b6..28f30928cfe 100644 --- a/src/EnergyPlus/OutputReportData.cc +++ b/src/EnergyPlus/OutputReportData.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -53,7 +53,6 @@ #include #include #include -#include // EnergyPlus Headers #include diff --git a/src/EnergyPlus/OutputReportData.hh b/src/EnergyPlus/OutputReportData.hh index 620895c9461..a10e9e1217d 100644 --- a/src/EnergyPlus/OutputReportData.hh +++ b/src/EnergyPlus/OutputReportData.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -56,7 +56,6 @@ #include #include #include -#include // EnergyPlus Headers #include diff --git a/src/EnergyPlus/OutputReportPredefined.cc b/src/EnergyPlus/OutputReportPredefined.cc index 91269722de7..cc348475438 100644 --- a/src/EnergyPlus/OutputReportPredefined.cc +++ b/src/EnergyPlus/OutputReportPredefined.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -95,7 +95,7 @@ namespace OutputReportPredefined { // Climate Summary Report - auto &s(state.dataOutRptPredefined); + auto const &s = state.dataOutRptPredefined; s->pdrClim = newPreDefReport(state, "ClimaticDataSummary", "Clim", "Climatic Data Summary"); @@ -127,6 +127,7 @@ namespace OutputReportPredefined { s->pdchOpCons = newPreDefColumn(state, s->pdstOpaque, "Construction"); s->pdchOpZone = newPreDefColumn(state, s->pdstOpaque, "Zone"); + s->pdchOpSpace = newPreDefColumn(state, s->pdstOpaque, "Space"); s->pdchOpRefl = newPreDefColumn(state, s->pdstOpaque, "Reflectance"); s->pdchOpUfactFilm = newPreDefColumn(state, s->pdstOpaque, "U-Factor with Film [W/m2-K]"); s->pdchOpUfactNoFilm = newPreDefColumn(state, s->pdstOpaque, "U-Factor no Film [W/m2-K]"); @@ -140,6 +141,7 @@ namespace OutputReportPredefined { s->pdchIntOpCons = newPreDefColumn(state, s->pdstIntOpaque, "Construction"); s->pdchIntOpZone = newPreDefColumn(state, s->pdstIntOpaque, "Zone"); + s->pdchIntOpSpace = newPreDefColumn(state, s->pdstIntOpaque, "Space"); s->pdchIntOpAdjSurf = newPreDefColumn(state, s->pdstIntOpaque, "Adjacent Surface"); s->pdchIntOpRefl = newPreDefColumn(state, s->pdstIntOpaque, "Reflectance"); s->pdchIntOpUfactFilm = newPreDefColumn(state, s->pdstIntOpaque, "U-Factor with Film [W/m2-K]"); @@ -153,6 +155,8 @@ namespace OutputReportPredefined { s->pdstFen = newPreDefSubTable(state, s->pdrEnvelope, "Exterior Fenestration"); s->pdchFenCons = newPreDefColumn(state, s->pdstFen, "Construction"); + s->pdchFenZone = newPreDefColumn(state, s->pdstFen, "Zone"); + s->pdchFenSpace = newPreDefColumn(state, s->pdstFen, "Space"); s->pdchFenFrameDivName = newPreDefColumn(state, s->pdstFen, "Frame and Divider"); s->pdchFenGlassAreaOf1 = newPreDefColumn(state, s->pdstFen, "Glass Area [m2]"); s->pdchFenFrameAreaOf1 = newPreDefColumn(state, s->pdstFen, "Frame Area [m2]"); @@ -188,6 +192,8 @@ namespace OutputReportPredefined { s->pdstIntFen = newPreDefSubTable(state, s->pdrEnvelope, "Interior Fenestration"); s->pdchIntFenCons = newPreDefColumn(state, s->pdstIntFen, "Construction"); + s->pdchIntFenZone = newPreDefColumn(state, s->pdstIntFen, "Zone"); + s->pdchIntFenSpace = newPreDefColumn(state, s->pdstIntFen, "Space"); s->pdchIntFenAreaOf1 = newPreDefColumn(state, s->pdstIntFen, "Area of One Opening [m2]"); s->pdchIntFenArea = newPreDefColumn(state, s->pdstIntFen, "Area of Openings [m2]"); s->pdchIntFenUfact = newPreDefColumn(state, s->pdstIntFen, "Glass U-Factor [W/m2-K]"); @@ -202,6 +208,8 @@ namespace OutputReportPredefined { s->pdstDoor = newPreDefSubTable(state, s->pdrEnvelope, "Exterior Door"); s->pdchDrCons = newPreDefColumn(state, s->pdstDoor, "Construction"); + s->pdchDrZone = newPreDefColumn(state, s->pdstDoor, "Zone"); + s->pdchDrSpace = newPreDefColumn(state, s->pdstDoor, "Space"); s->pdchDrUfactFilm = newPreDefColumn(state, s->pdstDoor, "U-Factor with Film [W/m2-K]"); s->pdchDrUfactNoFilm = newPreDefColumn(state, s->pdstDoor, "U-Factor no Film [W/m2-K]"); s->pdchDrGrArea = newPreDefColumn(state, s->pdstDoor, "Gross Area [m2]"); @@ -210,6 +218,8 @@ namespace OutputReportPredefined { s->pdstIntDoor = newPreDefSubTable(state, s->pdrEnvelope, "Interior Door"); s->pdchIntDrCons = newPreDefColumn(state, s->pdstIntDoor, "Construction"); + s->pdchIntDrZone = newPreDefColumn(state, s->pdstIntDoor, "Zone"); + s->pdchIntDrSpace = newPreDefColumn(state, s->pdstIntDoor, "Space"); s->pdchIntDrUfactFilm = newPreDefColumn(state, s->pdstIntDoor, "U-Factor with Film [W/m2-K]"); s->pdchIntDrUfactNoFilm = newPreDefColumn(state, s->pdstIntDoor, "U-Factor no Film [W/m2-K]"); s->pdchIntDrGrArea = newPreDefColumn(state, s->pdstIntDoor, "Gross Area [m2]"); @@ -818,13 +828,13 @@ namespace OutputReportPredefined { s->pdchCoilEntHumRatIdealPeak = newPreDefColumn(state, s->pdstCoilSummaryCoilSelection, "Coil Entering Air Humidity Ratio at Ideal Loads Peak [kgWater/kgDryAir]"); s->pdchCoilEntEnthalpyIdealPeak = - newPreDefColumn(state, s->pdstCoilSummaryCoilSelection, "Coil Entering Air Enthalpy at Ideal Loads Peak [J/KG-K]"); + newPreDefColumn(state, s->pdstCoilSummaryCoilSelection, "Coil Entering Air Enthalpy at Ideal Loads Peak [J/kg]"); s->pdchCoilLvgDryBulbIdealPeak = newPreDefColumn(state, s->pdstCoilSummaryCoilSelection, "Coil Leaving Air Drybulb at Ideal Loads Peak [C]"); s->pdchCoilLvgWetBulbIdealPeak = newPreDefColumn(state, s->pdstCoilSummaryCoilSelection, "Coil Leaving Air Wetbulb at Ideal Loads Peak [C]"); s->pdchCoilLvgHumRatIdealPeak = newPreDefColumn(state, s->pdstCoilSummaryCoilSelection, "Coil Leaving Air Humidity Ratio at Ideal Loads Peak [kgWater/kgDryAir]"); s->pdchCoilLvgEnthalpyIdealPeak = - newPreDefColumn(state, s->pdstCoilSummaryCoilSelection, "Coil Leaving Air Enthalpy at Ideal Loads Peak [J/KG-K]"); + newPreDefColumn(state, s->pdstCoilSummaryCoilSelection, "Coil Leaving Air Enthalpy at Ideal Loads Peak [J/kg]"); s->pdchCoilWaterMassFlowIdealPeak = newPreDefColumn(state, s->pdstCoilSummaryCoilSelection, "Coil Plant Fluid Mass Flow Rate at Ideal Loads Peak [kg/s]"); s->pdchCoilEntWaterTempIdealPeak = @@ -863,13 +873,13 @@ namespace OutputReportPredefined { s->pdchCoilRatedEntHumRat = newPreDefColumn(state, s->pdstCoilSummaryCoilSelection, "Coil Entering Air Humidity Ratio at Rating Conditions [kgWater/kgDryAir]"); s->pdchCoilRatedEntEnthalpy = - newPreDefColumn(state, s->pdstCoilSummaryCoilSelection, "Coil Entering Air Enthalpy at Rating Conditions [J/KG-K]"); + newPreDefColumn(state, s->pdstCoilSummaryCoilSelection, "Coil Entering Air Enthalpy at Rating Conditions [J/kg]"); s->pdchCoilRatedLvgDryBulb = newPreDefColumn(state, s->pdstCoilSummaryCoilSelection, "Coil Leaving Air Drybulb at Rating Conditions [C]"); s->pdchCoilRatedLvgWetBulb = newPreDefColumn(state, s->pdstCoilSummaryCoilSelection, "Coil Leaving Air Wetbulb at Rating Conditions [C]"); s->pdchCoilRatedLvgHumRat = newPreDefColumn(state, s->pdstCoilSummaryCoilSelection, "Coil Leaving Air Humidity Ratio at Rating Conditions [kgWater/kgDryAir]"); s->pdchCoilRatedLvgEnthalpy = - newPreDefColumn(state, s->pdstCoilSummaryCoilSelection, "Coil Leaving Air Enthalpy at Rating Conditions [J/KG-K]"); + newPreDefColumn(state, s->pdstCoilSummaryCoilSelection, "Coil Leaving Air Enthalpy at Rating Conditions [J/kg]"); // Std 229 New Table "Coil Connections" s->pdstCoilConnections = newPreDefSubTable(state, s->pdrCoilSizingDetailsTable, "Coil Connections"); diff --git a/src/EnergyPlus/OutputReportPredefined.hh b/src/EnergyPlus/OutputReportPredefined.hh index 42820c0c763..753295e6fbb 100644 --- a/src/EnergyPlus/OutputReportPredefined.hh +++ b/src/EnergyPlus/OutputReportPredefined.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -482,6 +482,7 @@ struct OutputReportPredefinedData : BaseGlobalStruct int pdstOpaque = 0; int pdchOpCons = 0; int pdchOpZone = 0; + int pdchOpSpace = 0; int pdchOpRefl = 0; int pdchOpUfactFilm = 0; int pdchOpUfactNoFilm = 0; @@ -493,6 +494,7 @@ struct OutputReportPredefinedData : BaseGlobalStruct int pdstIntOpaque = 0; int pdchIntOpCons = 0; int pdchIntOpZone = 0; + int pdchIntOpSpace = 0; int pdchIntOpAdjSurf = 0; int pdchIntOpRefl = 0; int pdchIntOpUfactFilm = 0; @@ -504,6 +506,8 @@ struct OutputReportPredefinedData : BaseGlobalStruct int pdchIntOpDir = 0; int pdstFen = 0; int pdchFenCons = 0; + int pdchFenZone = 0; + int pdchFenSpace = 0; int pdchFenFrameDivName = 0; int pdchFenAreaOf1 = 0; int pdchFenGlassAreaOf1 = 0; @@ -537,18 +541,24 @@ struct OutputReportPredefinedData : BaseGlobalStruct int pdstDoor = 0; int pdchDrCons = 0; + int pdchDrZone = 0; + int pdchDrSpace = 0; int pdchDrUfactFilm = 0; int pdchDrUfactNoFilm = 0; int pdchDrGrArea = 0; int pdchDrParent = 0; int pdstIntDoor = 0; int pdchIntDrCons = 0; + int pdchIntDrZone = 0; + int pdchIntDrSpace = 0; int pdchIntDrUfactFilm = 0; int pdchIntDrUfactNoFilm = 0; int pdchIntDrGrArea = 0; int pdchIntDrParent = 0; int pdstIntFen = 0; int pdchIntFenCons = 0; + int pdchIntFenZone = 0; + int pdchIntFenSpace = 0; int pdchIntFenAreaOf1 = 0; int pdchIntFenArea = 0; int pdchIntFenUfact = 0; @@ -1537,6 +1547,10 @@ struct OutputReportPredefinedData : BaseGlobalStruct Array1D CompSizeTableEntry; Array1D ShadowRelate; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index bbf5530f5bc..0e4de9c32c3 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -553,7 +553,7 @@ void InitializeTabularMonthly(EnergyPlusData &state) // NOTE: // The bulk of this routine used to be part of the the // GetInputTabularMonthly routine but when predefined - // monthly reports were added this routine was seperated + // monthly reports were added this routine was separated // from input. // REFERENCES: @@ -1028,9 +1028,6 @@ void GetInputTabularTimeBins(EnergyPlusData &state) // REFERENCES: // na - // Using/Aliasing - using ScheduleManager::GetScheduleIndex; - // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // na @@ -1056,6 +1053,8 @@ void GetInputTabularTimeBins(EnergyPlusData &state) Array1D_int objVarIDs; Array1D_string objNames; + static constexpr std::string_view routineName = "GetInputTabularTimeBins"; + auto &ort = state.dataOutRptTab; if (!state.files.outputControl.writeTabular(state)) { @@ -1099,20 +1098,17 @@ void GetInputTabularTimeBins(EnergyPlusData &state) state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, AlphArray(1)}; + ort->OutputTableBinned(iInObj).keyValue = AlphArray(1); ort->OutputTableBinned(iInObj).varOrMeter = AlphArray(2); // if a schedule has been specified assign - if (len(AlphArray(3)) > 0) { - ort->OutputTableBinned(iInObj).ScheduleName = AlphArray(3); - ort->OutputTableBinned(iInObj).scheduleIndex = GetScheduleIndex(state, AlphArray(3)); - if (ort->OutputTableBinned(iInObj).scheduleIndex == 0) { - ShowWarningError( - state, - format("{}: invalid {}=\"{}\" - not found.", CurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(3), AlphArray(3))); - } - } else { - ort->OutputTableBinned(iInObj).scheduleIndex = 0; // flag value for no schedule used + if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { + } else if ((ort->OutputTableBinned(iInObj).sched = Sched::GetSchedule(state, AlphArray(3))) == nullptr) { + ShowWarningItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), AlphArray(3), ""); } + // validate the kind of variable - not used internally except for validation if (len(AlphArray(4)) > 0) { if (!(Util::SameString(AlphArray(4), "ENERGY") || Util::SameString(AlphArray(4), "DEMAND") || @@ -1779,7 +1775,7 @@ void GetInputOutputTableSummaryReports(EnergyPlusData &state) ort->endUseNames(static_cast(Constant::EndUse::Cogeneration) + 1) = "Cogeneration"; auto &op = state.dataOutputProcessor; - // End use subs must be dynamically allocated to accomodate the end use with the most subcategories + // End use subs must be dynamically allocated to accommodate the end use with the most subcategories ort->meterNumEndUseSubBEPS.allocate(op->MaxNumSubcategories, static_cast(Constant::EndUse::Num), numResourceTypes); ort->meterNumEndUseSpTypeBEPS.allocate(op->maxNumEndUseSpaceTypes, static_cast(Constant::EndUse::Num), numResourceTypes); for (int endUse = 1; endUse <= static_cast(Constant::EndUse::Num); ++endUse) { @@ -2831,7 +2827,8 @@ void GetInputFuelAndPollutionFactors(EnergyPlusData &state) Real64 curSourceFactor; bool fuelFactorUsed; bool fFScheduleUsed; - int ffScheduleIndex; + Sched::Schedule *ffSched = nullptr; + auto &ort = state.dataOutRptTab; // set the default factors for source energy - they will be overwritten if the user sets any values @@ -2863,7 +2860,7 @@ void GetInputFuelAndPollutionFactors(EnergyPlusData &state) // + gatherTotalsBEPS(5)*sourceFactorSteam & !steam // ) / largeConversionFactor - GetFuelFactorInfo(state, Constant::eFuel::NaturalGas, fuelFactorUsed, curSourceFactor, fFScheduleUsed, ffScheduleIndex); + GetFuelFactorInfo(state, Constant::eFuel::NaturalGas, fuelFactorUsed, curSourceFactor, fFScheduleUsed, &ffSched); if (fuelFactorUsed) { ort->sourceFactorNaturalGas = curSourceFactor; ort->fuelfactorsused(2) = true; @@ -2873,10 +2870,10 @@ void GetInputFuelAndPollutionFactors(EnergyPlusData &state) if (fFScheduleUsed) { ort->fuelFactorSchedulesUsed = true; ort->ffSchedUsed(2) = true; - ort->ffSchedIndex(2) = ffScheduleIndex; + ort->ffScheds(2) = ffSched; } - GetFuelFactorInfo(state, Constant::eFuel::FuelOilNo2, fuelFactorUsed, curSourceFactor, fFScheduleUsed, ffScheduleIndex); + GetFuelFactorInfo(state, Constant::eFuel::FuelOilNo2, fuelFactorUsed, curSourceFactor, fFScheduleUsed, &ffSched); if (fuelFactorUsed) { ort->sourceFactorFuelOil2 = curSourceFactor; ort->fuelfactorsused(7) = true; @@ -2886,10 +2883,10 @@ void GetInputFuelAndPollutionFactors(EnergyPlusData &state) if (fFScheduleUsed) { ort->fuelFactorSchedulesUsed = true; ort->ffSchedUsed(11) = true; - ort->ffSchedIndex(11) = ffScheduleIndex; + ort->ffScheds(11) = ffSched; } - GetFuelFactorInfo(state, Constant::eFuel::FuelOilNo1, fuelFactorUsed, curSourceFactor, fFScheduleUsed, ffScheduleIndex); + GetFuelFactorInfo(state, Constant::eFuel::FuelOilNo1, fuelFactorUsed, curSourceFactor, fFScheduleUsed, &ffSched); if (fuelFactorUsed) { ort->sourceFactorFuelOil1 = curSourceFactor; ort->fuelfactorsused(6) = true; @@ -2899,10 +2896,10 @@ void GetInputFuelAndPollutionFactors(EnergyPlusData &state) if (fFScheduleUsed) { ort->fuelFactorSchedulesUsed = true; ort->ffSchedUsed(10) = true; - ort->ffSchedIndex(10) = ffScheduleIndex; + ort->ffScheds(10) = ffSched; } - GetFuelFactorInfo(state, Constant::eFuel::Coal, fuelFactorUsed, curSourceFactor, fFScheduleUsed, ffScheduleIndex); + GetFuelFactorInfo(state, Constant::eFuel::Coal, fuelFactorUsed, curSourceFactor, fFScheduleUsed, &ffSched); if (fuelFactorUsed) { ort->sourceFactorCoal = curSourceFactor; ort->fuelfactorsused(5) = true; @@ -2912,10 +2909,10 @@ void GetInputFuelAndPollutionFactors(EnergyPlusData &state) if (fFScheduleUsed) { ort->fuelFactorSchedulesUsed = true; ort->ffSchedUsed(9) = true; - ort->ffSchedIndex(9) = ffScheduleIndex; + ort->ffScheds(9) = ffSched; } - GetFuelFactorInfo(state, Constant::eFuel::Electricity, fuelFactorUsed, curSourceFactor, fFScheduleUsed, ffScheduleIndex); + GetFuelFactorInfo(state, Constant::eFuel::Electricity, fuelFactorUsed, curSourceFactor, fFScheduleUsed, &ffSched); if (fuelFactorUsed) { ort->sourceFactorElectric = curSourceFactor; ort->fuelfactorsused(1) = true; @@ -2925,10 +2922,10 @@ void GetInputFuelAndPollutionFactors(EnergyPlusData &state) if (fFScheduleUsed) { ort->fuelFactorSchedulesUsed = true; ort->ffSchedUsed(1) = true; - ort->ffSchedIndex(1) = ffScheduleIndex; + ort->ffScheds(1) = ffSched; } - GetFuelFactorInfo(state, Constant::eFuel::Gasoline, fuelFactorUsed, curSourceFactor, fFScheduleUsed, ffScheduleIndex); + GetFuelFactorInfo(state, Constant::eFuel::Gasoline, fuelFactorUsed, curSourceFactor, fFScheduleUsed, &ffSched); if (fuelFactorUsed) { ort->sourceFactorGasoline = curSourceFactor; ort->fuelfactorsused(3) = true; @@ -2938,10 +2935,10 @@ void GetInputFuelAndPollutionFactors(EnergyPlusData &state) if (fFScheduleUsed) { ort->fuelFactorSchedulesUsed = true; ort->ffSchedUsed(6) = true; - ort->ffSchedIndex(6) = ffScheduleIndex; + ort->ffScheds(6) = ffSched; } - GetFuelFactorInfo(state, Constant::eFuel::Propane, fuelFactorUsed, curSourceFactor, fFScheduleUsed, ffScheduleIndex); + GetFuelFactorInfo(state, Constant::eFuel::Propane, fuelFactorUsed, curSourceFactor, fFScheduleUsed, &ffSched); if (fuelFactorUsed) { ort->sourceFactorPropane = curSourceFactor; ort->fuelfactorsused(8) = true; @@ -2951,10 +2948,10 @@ void GetInputFuelAndPollutionFactors(EnergyPlusData &state) if (fFScheduleUsed) { ort->fuelFactorSchedulesUsed = true; ort->ffSchedUsed(12) = true; - ort->ffSchedIndex(12) = ffScheduleIndex; + ort->ffScheds(12) = ffSched; } - GetFuelFactorInfo(state, Constant::eFuel::Diesel, fuelFactorUsed, curSourceFactor, fFScheduleUsed, ffScheduleIndex); + GetFuelFactorInfo(state, Constant::eFuel::Diesel, fuelFactorUsed, curSourceFactor, fFScheduleUsed, &ffSched); if (fuelFactorUsed) { ort->sourceFactorDiesel = curSourceFactor; ort->fuelfactorsused(4) = true; @@ -2964,40 +2961,40 @@ void GetInputFuelAndPollutionFactors(EnergyPlusData &state) if (fFScheduleUsed) { ort->fuelFactorSchedulesUsed = true; ort->ffSchedUsed(8) = true; - ort->ffSchedIndex(8) = ffScheduleIndex; + ort->ffScheds(8) = ffSched; } - GetFuelFactorInfo(state, Constant::eFuel::DistrictCooling, fuelFactorUsed, curSourceFactor, fFScheduleUsed, ffScheduleIndex); + GetFuelFactorInfo(state, Constant::eFuel::DistrictCooling, fuelFactorUsed, curSourceFactor, fFScheduleUsed, &ffSched); if (fuelFactorUsed) { ort->ffUsed(3) = true; } ort->SourceFactors(3) = curSourceFactor; if (fFScheduleUsed) { ort->ffSchedUsed(3) = true; - ort->ffSchedIndex(3) = ffScheduleIndex; + ort->ffScheds(3) = ffSched; } - GetFuelFactorInfo(state, Constant::eFuel::DistrictHeatingWater, fuelFactorUsed, curSourceFactor, fFScheduleUsed, ffScheduleIndex); + GetFuelFactorInfo(state, Constant::eFuel::DistrictHeatingWater, fuelFactorUsed, curSourceFactor, fFScheduleUsed, &ffSched); if (fuelFactorUsed) { ort->ffUsed(4) = true; } ort->SourceFactors(4) = curSourceFactor; if (fFScheduleUsed) { ort->ffSchedUsed(4) = true; - ort->ffSchedIndex(4) = ffScheduleIndex; + ort->ffScheds(4) = ffSched; } - GetFuelFactorInfo(state, Constant::eFuel::DistrictHeatingSteam, fuelFactorUsed, curSourceFactor, fFScheduleUsed, ffScheduleIndex); + GetFuelFactorInfo(state, Constant::eFuel::DistrictHeatingSteam, fuelFactorUsed, curSourceFactor, fFScheduleUsed, &ffSched); if (fuelFactorUsed) { ort->ffUsed(5) = true; } ort->SourceFactors(5) = curSourceFactor; if (fFScheduleUsed) { ort->ffSchedUsed(5) = true; - ort->ffSchedIndex(5) = ffScheduleIndex; + ort->ffScheds(5) = ffSched; } - GetFuelFactorInfo(state, Constant::eFuel::OtherFuel1, fuelFactorUsed, curSourceFactor, fFScheduleUsed, ffScheduleIndex); + GetFuelFactorInfo(state, Constant::eFuel::OtherFuel1, fuelFactorUsed, curSourceFactor, fFScheduleUsed, &ffSched); if (fuelFactorUsed) { ort->sourceFactorOtherFuel1 = curSourceFactor; ort->fuelfactorsused(11) = true; // should be source number @@ -3007,10 +3004,10 @@ void GetInputFuelAndPollutionFactors(EnergyPlusData &state) if (fFScheduleUsed) { ort->fuelFactorSchedulesUsed = true; ort->ffSchedUsed(13) = true; - ort->ffSchedIndex(13) = ffScheduleIndex; + ort->ffScheds(13) = ffSched; } - GetFuelFactorInfo(state, Constant::eFuel::OtherFuel2, fuelFactorUsed, curSourceFactor, fFScheduleUsed, ffScheduleIndex); + GetFuelFactorInfo(state, Constant::eFuel::OtherFuel2, fuelFactorUsed, curSourceFactor, fFScheduleUsed, &ffSched); if (fuelFactorUsed) { ort->sourceFactorOtherFuel2 = curSourceFactor; ort->fuelfactorsused(12) = true; // should be source number @@ -3020,7 +3017,7 @@ void GetInputFuelAndPollutionFactors(EnergyPlusData &state) if (fFScheduleUsed) { ort->fuelFactorSchedulesUsed = true; ort->ffSchedUsed(14) = true; - ort->ffSchedIndex(14) = ffScheduleIndex; + ort->ffScheds(14) = ffSched; } GetEnvironmentalImpactFactorInfo( @@ -3106,8 +3103,8 @@ void OpenOutputTabularFile(EnergyPlusData &state) tbl_stream << " " << std::setw(2) << ort->td(5) << ':' << std::setw(2) << ort->td(6) << ':' << std::setw(2) << ort->td(7) << std::setfill(' ') << '\n'; tbl_stream << " - EnergyPlus\n"; - tbl_stream << "\n"; tbl_stream << "\n"; + tbl_stream << "\n"; tbl_stream << "\n"; tbl_stream << "

Table of Contents

\n"; tbl_stream << "\n"; @@ -3338,10 +3335,10 @@ void WriteTableOfContents(EnergyPlusData &state) } for (int iInput = 1; iInput <= ort->OutputTableBinnedCount; ++iInput) { if (ort->OutputTableBinned(iInput).numTables > 0) { - if (ort->OutputTableBinned(iInput).scheduleIndex == 0) { + if (ort->OutputTableBinned(iInput).sched == nullptr) { tbl_stream << "

" << ort->OutputTableBinned(iInput).varOrMeter << "

|\n"; } else { - tbl_stream << "

" << ort->OutputTableBinned(iInput).varOrMeter << " [" << ort->OutputTableBinned(iInput).ScheduleName + tbl_stream << "

" << ort->OutputTableBinned(iInput).varOrMeter << " [" << ort->OutputTableBinned(iInput).sched->Name << "]

|\n"; } for (int jTable = 1; jTable <= ort->OutputTableBinned(iInput).numTables; ++jTable) { @@ -3358,12 +3355,12 @@ void WriteTableOfContents(EnergyPlusData &state) ort->OutputTableBinned(iInput).varOrMeter, Constant::unitNames[(int)ort->OutputTableBinned(iInput).units]); } - if (ort->OutputTableBinned(iInput).scheduleIndex == 0) { + if (ort->OutputTableBinned(iInput).sched == nullptr) { tbl_stream << "BinObjVarID(curTable).namesOfObj) << "\">" << ort->BinObjVarID(curTable).namesOfObj << " | \n"; } else { tbl_stream << "OutputTableBinned(iInput).ScheduleName, + << MakeAnchorName(curName + ort->OutputTableBinned(iInput).sched->Name, ort->BinObjVarID(curTable).namesOfObj) << "\">" << ort->BinObjVarID(curTable).namesOfObj << " | \n"; } @@ -3433,12 +3430,9 @@ void GatherBinResultsForTimestep(EnergyPlusData &state, OutputProcessor::TimeSte // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // Gathers the data each timesetp and adds the length of the + // Gathers the data each timestep and adds the length of the // timestep to the appropriate bin. - // Using/Aliasing - using ScheduleManager::GetCurrentScheduleValue; - // Locals // SUBROUTINE ARGUMENT DEFINITIONS: @@ -3467,18 +3461,10 @@ void GatherBinResultsForTimestep(EnergyPlusData &state, OutputProcessor::TimeSte for (int iInObj = 1; iInObj <= ort->OutputTableBinnedCount; ++iInObj) { // get values of array for current object being referenced - int const curScheduleIndex = ort->OutputTableBinned(iInObj).scheduleIndex; + auto *sched = ort->OutputTableBinned(iInObj).sched; // if a schedule was used, check if it was non-zero value - bool gatherThisTime = false; - if (curScheduleIndex != 0) { - if (GetCurrentScheduleValue(state, curScheduleIndex) != 0.0) { - gatherThisTime = true; - } else { - gatherThisTime = false; - } - } else { - gatherThisTime = true; - } + bool gatherThisTime = (sched == nullptr) || (sched->getCurrentVal() != 0.0); + if (gatherThisTime) { Real64 const &curIntervalStart = ort->OutputTableBinned(iInObj).intervalStart; Real64 const &curIntervalSize = ort->OutputTableBinned(iInObj).intervalSize; @@ -3496,9 +3482,9 @@ void GatherBinResultsForTimestep(EnergyPlusData &state, OutputProcessor::TimeSte Real64 curValue = GetInternalVariableValue(state, curTypeOfVar, ort->BinObjVarID(repIndex).varMeterNum); // per MJW when a summed variable is used divide it by the length of the time step if (ort->OutputTableBinned(iInObj).avgSum == OutputProcessor::StoreType::Sum) { // if it is a summed variable - curValue /= (elapsedTime * Constant::SecInHour); + curValue /= (elapsedTime * Constant::rSecsInHour); } - // round the value to the number of signficant digits used in the final output report + // round the value to the number of significant digits used in the final output report if (curIntervalSize < 1) { curValue = round(curValue * 10000.0) / 10000.0; // four significant digits } else if (curIntervalSize >= 10) { @@ -3885,17 +3871,18 @@ void GatherBEPSResultsForTimestep(EnergyPlusData &state, OutputProcessor::TimeSt // Water // Steam // DistrictCooling - // DistrictHeating + // DistrictHeatingWater + // DistrictHeatingSteam using DataStringGlobals::CharComma; using DataStringGlobals::CharSpace; using DataStringGlobals::CharTab; auto &ort = state.dataOutRptTab; - auto &op = state.dataOutputProcessor; // if no beps report is called then skip if ((ort->displayTabularBEPS || ort->displayLEEDSummary) && (t_timeStepType == OutputProcessor::TimeStepType::Zone)) { + auto &op = state.dataOutputProcessor; // add the current time to the total elapsed time // FOLLOWING LINE MOVED TO UPDATETABULARREPORTS because used even when beps is not called // gatherElapsedTimeBEPS = gatherElapsedTimeBEPS + TimeStepZone @@ -4041,7 +4028,6 @@ void GatherSourceEnergyEndUseResultsForTimestep(EnergyPlusData &state, using DataStringGlobals::CharComma; using DataStringGlobals::CharSpace; using DataStringGlobals::CharTab; - using ScheduleManager::GetCurrentScheduleValue; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: @@ -4067,8 +4053,8 @@ void GatherSourceEnergyEndUseResultsForTimestep(EnergyPlusData &state, if (ort->ffSchedUsed(iResource)) { int const curMeterNumber = ort->meterNumTotalsBEPS(iResource); if (curMeterNumber > -1) { - Real64 const curMeterValue = GetCurrentMeterValue(state, curMeterNumber) * - GetCurrentScheduleValue(state, ort->ffSchedIndex(iResource)) * ort->SourceFactors(iResource); + Real64 const curMeterValue = + GetCurrentMeterValue(state, curMeterNumber) * ort->ffScheds(iResource)->getCurrentVal() * ort->SourceFactors(iResource); ort->gatherTotalsBySourceBEPS(iResource) += curMeterValue; } } else { @@ -4083,8 +4069,8 @@ void GatherSourceEnergyEndUseResultsForTimestep(EnergyPlusData &state, if (ort->ffSchedUsed(iResource)) { int const curMeterNumber = ort->meterNumEndUseBEPS(iResource, jEndUse); if (curMeterNumber > -1) { - Real64 const curMeterValue = GetCurrentMeterValue(state, curMeterNumber) * - GetCurrentScheduleValue(state, ort->ffSchedIndex(iResource)) * ort->SourceFactors(iResource); + Real64 const curMeterValue = + GetCurrentMeterValue(state, curMeterNumber) * ort->ffScheds(iResource)->getCurrentVal() * ort->SourceFactors(iResource); ort->gatherEndUseBySourceBEPS(iResource, jEndUse) += curMeterValue; } } else { @@ -4536,7 +4522,7 @@ void GatherHeatGainReport(EnergyPlusData &state, OutputProcessor::TimeStepType t // The following two columns are derived based on the values of the other columns and need to be computed on every HVAC timestep. // Opaque Surface Conduction and Other Heat Addition // Opaque Surface Conduction and Other Heat Removal - // For variables that are updated on a zone timestep basis, the values are used on the HVAC timestep but are ratioed by the + // For variables that are updated on a zone timestep basis, the values are used on the HVAC timestep but are ratio-ed by the // timestep lengths. // The peak reports follow a similar example. @@ -4721,7 +4707,7 @@ void GatherHeatGainReport(EnergyPlusData &state, OutputProcessor::TimeStepType t // Opaque Surface Conduction and Other Heat Addition // Opaque Surface Conduction and Other Heat Removal for (state.dataOutRptTab->iZoneGHGR = 1; state.dataOutRptTab->iZoneGHGR <= state.dataGlobal->NumOfZones; ++state.dataOutRptTab->iZoneGHGR) { - // ZonePreDefRep variables above already inlude zone list and group multipliers + // ZonePreDefRep variables above already include zone list and group multipliers state.dataOutRptTab->totalGHGR = ZonePreDefRep(state.dataOutRptTab->iZoneGHGR).SHGSAnPeoplAdd + ZonePreDefRep(state.dataOutRptTab->iZoneGHGR).SHGSAnLiteAdd + ZonePreDefRep(state.dataOutRptTab->iZoneGHGR).SHGSAnZoneEqHt + ZonePreDefRep(state.dataOutRptTab->iZoneGHGR).SHGSAnZoneEqCl + @@ -6179,9 +6165,6 @@ void FillRemainingPredefinedEntries(EnergyPlusData &state) int iTotalAutoSizableFields = state.dataOutput->iTotalAutoSizableFields; int iTotalFieldsWithDefaults = state.dataOutput->iTotalFieldsWithDefaults; - using ScheduleManager::GetScheduleName; - using ScheduleManager::ScheduleAverageHoursPerWeek; - Real64 consumptionTotal; auto const &ort = state.dataOutRptTab; @@ -6207,7 +6190,7 @@ void FillRemainingPredefinedEntries(EnergyPlusData &state) PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtAvgHrSchd, thisLight.Name, - ScheduleAverageHoursPerWeek(state, thisLight.SchedPtr, StartOfWeek, state.dataEnvrn->CurrentYearIsLeapYear)); + thisLight.sched->getAverageWeeklyHoursFullLoad(state, StartOfWeek, state.dataEnvrn->CurrentYearIsLeapYear)); // average operating hours per week if (ort->gatherElapsedTimeBEPS > 0) { state.dataOutRptTab->HrsPerWeek = 24 * 7 * thisLight.SumTimeNotZeroCons / ort->gatherElapsedTimeBEPS; @@ -6216,7 +6199,7 @@ void FillRemainingPredefinedEntries(EnergyPlusData &state) // full load hours per week if ((thisLight.DesignLevel * ort->gatherElapsedTimeBEPS) > 0) { state.dataOutRptTab->HrsPerWeek = - 24 * 7 * thisLight.SumConsumption / (thisLight.DesignLevel * ort->gatherElapsedTimeBEPS * Constant::SecInHour); + 24 * 7 * thisLight.SumConsumption / (thisLight.DesignLevel * ort->gatherElapsedTimeBEPS * Constant::rSecsInHour); PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtFullLoadHrs, thisLight.Name, state.dataOutRptTab->HrsPerWeek); } PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtConsump, thisLight.Name, thisLight.SumConsumption * mult / 1000000000.0); @@ -6233,7 +6216,7 @@ void FillRemainingPredefinedEntries(EnergyPlusData &state) PreDefTableEntry(state, state.dataOutRptPredefined->pdchExLtAvgHrSchd, thisLight.Name, - ScheduleAverageHoursPerWeek(state, thisLight.SchedPtr, StartOfWeek, state.dataEnvrn->CurrentYearIsLeapYear)); + thisLight.sched->getAverageWeeklyHoursFullLoad(state, StartOfWeek, state.dataEnvrn->CurrentYearIsLeapYear)); } // average operating hours per week if (ort->gatherElapsedTimeBEPS > 0) { @@ -6243,7 +6226,7 @@ void FillRemainingPredefinedEntries(EnergyPlusData &state) // full load hours per week if ((thisLight.DesignLevel * ort->gatherElapsedTimeBEPS) > 0) { state.dataOutRptTab->HrsPerWeek = - 24 * 7 * thisLight.SumConsumption / (thisLight.DesignLevel * ort->gatherElapsedTimeBEPS * Constant::SecInHour); + 24 * 7 * thisLight.SumConsumption / (thisLight.DesignLevel * ort->gatherElapsedTimeBEPS * Constant::rSecsInHour); PreDefTableEntry(state, state.dataOutRptPredefined->pdchExLtFullLoadHrs, thisLight.Name, state.dataOutRptTab->HrsPerWeek); } PreDefTableEntry(state, state.dataOutRptPredefined->pdchExLtConsump, thisLight.Name, thisLight.SumConsumption / 1000000000.0); @@ -6416,7 +6399,7 @@ void FillRemainingPredefinedEntries(EnergyPlusData &state) PreDefTableEntry(state, state.dataOutRptPredefined->pdchOaTaBzTmAboveUnocc, thisZone.Name, thisZonePreDefRep.TotVentTimeNonZeroUnocc); if (thisZone.isNominalOccupied && (thisZonePreDefRep.TotTimeOcc > 0.0)) { - Real64 totTimeOccSec = thisZonePreDefRep.TotTimeOcc * Constant::SecInHour; + Real64 totTimeOccSec = thisZonePreDefRep.TotTimeOcc * Constant::rSecsInHour; // Mechanical ventilation Real64 mechVent = thisZonePreDefRep.MechVentVolTotalOccStdDen / totTimeOccSec; PreDefTableEntry(state, state.dataOutRptPredefined->pdchOaOccBzMechVent, thisZone.Name, mechVent, 4); @@ -6511,7 +6494,7 @@ void FillRemainingPredefinedEntries(EnergyPlusData &state) if (thisSysPreDefRep.TimeOccupiedTotal > 0.0) { // Average Outdoor Air During Occupancy by Airloop - Real64 totTimeOccSec = thisSysPreDefRep.TimeOccupiedTotal * Constant::SecInHour; + Real64 totTimeOccSec = thisSysPreDefRep.TimeOccupiedTotal * Constant::rSecsInHour; PreDefTableEntry( state, state.dataOutRptPredefined->pdchOaOccAlMechVent, thisPrimaryAirSys.Name, thisSysPreDefRep.MechVentTotalOcc / totTimeOccSec, 4); PreDefTableEntry( @@ -6536,7 +6519,7 @@ void FillRemainingPredefinedEntries(EnergyPlusData &state) int time = state.dataSysRpts->SysPreDefRep(sysNum).TimeAtOALimitOcc[static_cast(limitingFactorType)]; if (time > 0) { return state.dataSysRpts->SysPreDefRep(sysNum).MechVentTotAtLimitOcc[static_cast(limitingFactorType)] / - (time * Constant::SecInHour); + (time * Constant::rSecsInHour); } else { return 0.0; } @@ -6879,22 +6862,22 @@ void FillRemainingPredefinedEntries(EnergyPlusData &state) PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedGenData, "Total gross floor area [m2]", "-"); } // LEED schedule sub table - for (long iSch = 1; iSch <= state.dataScheduleMgr->NumSchedules; ++iSch) { - std::string curSchName = state.dataScheduleMgr->Schedule(iSch).Name; - std::string curSchType = ScheduleManager::GetScheduleType(state, iSch); - if (Util::SameString(curSchType, "FRACTION")) { - PreDefTableEntry(state, - state.dataOutRptPredefined->pdchLeedEflhEflh, - curSchName, - ScheduleManager::ScheduleAnnualFullLoadHours(state, iSch, StartOfWeek, state.dataEnvrn->CurrentYearIsLeapYear), - 0); - PreDefTableEntry(state, - state.dataOutRptPredefined->pdchLeedEflhNonZerHrs, - curSchName, - ScheduleManager::ScheduleHoursGT1perc(state, iSch, StartOfWeek, state.dataEnvrn->CurrentYearIsLeapYear), - 0); - } + for (auto *sched : state.dataSched->schedules) { + if (sched->schedTypeNum == -1) continue; + if (!Util::SameString(state.dataSched->scheduleTypes[sched->schedTypeNum]->Name, "FRACTION")) continue; + + PreDefTableEntry(state, + state.dataOutRptPredefined->pdchLeedEflhEflh, + sched->Name, + sched->getAnnualHoursFullLoad(state, StartOfWeek, state.dataEnvrn->CurrentYearIsLeapYear), + 0); + PreDefTableEntry(state, + state.dataOutRptPredefined->pdchLeedEflhNonZerHrs, + sched->Name, + sched->getAnnualHoursGreaterThan1Percent(state, StartOfWeek, state.dataEnvrn->CurrentYearIsLeapYear), + 0); } + // fill the LEED setpoint table ZoneTempPredictorCorrector::FillPredefinedTableOnThermostatSetpoints(state); ZoneTempPredictorCorrector::FillPredefinedTableOnThermostatSchedules(state); @@ -6968,6 +6951,7 @@ void WriteMonthlyTables(EnergyPlusData &state) rowHead(15) = "Minimum of Months"; rowHead(16) = "Maximum of Months"; + // Why is this a map? If the enum/integer is the independent variable/index, it should be a std::array. std::unordered_map aggString = { {AggType::SumOrAvg, ""}, {AggType::Maximum, " Maximum "}, @@ -7460,10 +7444,10 @@ void WriteTimeBinTables(EnergyPlusData &state) tableBody(numCols, 2) = "Total"; for (int iTable = 1; iTable <= curNumTables; ++iTable) { int const repIndex = firstReport + (iTable - 1); - if (ort->OutputTableBinned(iInObj).scheduleIndex == 0) { + if (ort->OutputTableBinned(iInObj).sched == nullptr) { repNameWithUnitsandscheduleName = curNameAndUnits; } else { - repNameWithUnitsandscheduleName = curNameAndUnits + " [" + ort->OutputTableBinned(iInObj).ScheduleName + ']'; + repNameWithUnitsandscheduleName = curNameAndUnits + " [" + ort->OutputTableBinned(iInObj).sched->Name + ']'; } if (produceTabular) { WriteReportHeaders( @@ -7720,7 +7704,7 @@ void WriteBEPSTable(EnergyPlusData &state) collapsedTotal(10) = ort->gatherTotalsBEPS(14); // other fuel 2 collapsedTotal(11) = ort->gatherTotalsBEPS(3); // district cooling <- purchased cooling collapsedTotal(12) = ort->gatherTotalsBEPS(4); // district heating water <- purchased heating - collapsedTotal(13) = ort->gatherTotalsBEPS(5); // distrcit heating steam <- purchased heating + collapsedTotal(13) = ort->gatherTotalsBEPS(5); // district heating steam <- purchased heating collapsedTotal(14) = ort->gatherTotalsBEPS(7); // water if (produceTabular) { @@ -7892,7 +7876,7 @@ void WriteBEPSTable(EnergyPlusData &state) } else { ort->OverallNetEnergyFromStorage = 0.0; } - // determine which resource is the primary heating resourse + // determine which resource is the primary heating resource int resourcePrimaryHeating = 0; Real64 heatingMaximum = 0.0; for (int iResource = 1; iResource <= 13; ++iResource) { // don't do water @@ -8193,7 +8177,7 @@ void WriteBEPSTable(EnergyPlusData &state) tableBody(1, 1) = RealToStr(ort->sourceFactorElectric, 3); } else if (ort->gatherTotalsBEPS(1) > SmallValue) { tableBody(1, 1) = "Effective Factor = " + RealToStr(ort->gatherTotalsBySourceBEPS(1) / ort->gatherTotalsBEPS(1), 3) + - " (calculated using schedule \"" + ScheduleManager::GetScheduleName(state, ort->ffSchedIndex(1)) + "\")"; + " (calculated using schedule \"" + ort->ffScheds(1)->Name + "\")"; } else { tableBody(1, 1) = "N/A"; } @@ -8202,7 +8186,7 @@ void WriteBEPSTable(EnergyPlusData &state) tableBody(1, 2) = RealToStr(ort->sourceFactorNaturalGas, 3); } else if (ort->gatherTotalsBEPS(2) > SmallValue) { tableBody(1, 2) = "Effective Factor = " + RealToStr(ort->gatherTotalsBySourceBEPS(2) / ort->gatherTotalsBEPS(2), 3) + - " (calculated using schedule \"" + ScheduleManager::GetScheduleName(state, ort->ffSchedIndex(2)) + "\")"; + " (calculated using schedule \"" + ort->ffScheds(2)->Name + "\")"; } else { tableBody(1, 2) = "N/A"; } @@ -8217,7 +8201,7 @@ void WriteBEPSTable(EnergyPlusData &state) tableBody(1, 6) = RealToStr(ort->sourceFactorGasoline, 3); } else if (ort->gatherTotalsBEPS(6) > SmallValue) { tableBody(1, 6) = "Effective Factor = " + RealToStr(ort->gatherTotalsBySourceBEPS(6) / ort->gatherTotalsBEPS(6), 3) + - " (calculated using schedule \"" + ScheduleManager::GetScheduleName(state, ort->ffSchedIndex(6)) + "\")"; + " (calculated using schedule \"" + ort->ffScheds(6)->Name + "\")"; } else { tableBody(1, 6) = "N/A"; } @@ -8226,7 +8210,7 @@ void WriteBEPSTable(EnergyPlusData &state) tableBody(1, 7) = RealToStr(ort->sourceFactorDiesel, 3); } else if (ort->gatherTotalsBEPS(8) > SmallValue) { tableBody(1, 7) = "Effective Factor = " + RealToStr(ort->gatherTotalsBySourceBEPS(8) / ort->gatherTotalsBEPS(8), 3) + - " (calculated using schedule \"" + ScheduleManager::GetScheduleName(state, ort->ffSchedIndex(8)) + "\")"; + " (calculated using schedule \"" + ort->ffScheds(8)->Name + "\")"; } else { tableBody(1, 7) = "N/A"; } @@ -8235,7 +8219,7 @@ void WriteBEPSTable(EnergyPlusData &state) tableBody(1, 8) = RealToStr(ort->sourceFactorCoal, 3); } else if (ort->gatherTotalsBEPS(9) > SmallValue) { tableBody(1, 8) = "Effective Factor = " + RealToStr(ort->gatherTotalsBySourceBEPS(9) / ort->gatherTotalsBEPS(9), 3) + - " (calculated using schedule \"" + ScheduleManager::GetScheduleName(state, ort->ffSchedIndex(9)) + "\")"; + " (calculated using schedule \"" + ort->ffScheds(9)->Name + "\")"; } else { tableBody(1, 8) = "N/A"; } @@ -8244,7 +8228,7 @@ void WriteBEPSTable(EnergyPlusData &state) tableBody(1, 9) = RealToStr(ort->sourceFactorFuelOil1, 3); } else if (ort->gatherTotalsBEPS(10) > SmallValue) { tableBody(1, 9) = "Effective Factor = " + RealToStr(ort->gatherTotalsBySourceBEPS(10) / ort->gatherTotalsBEPS(10), 3) + - " (calculated using schedule \"" + ScheduleManager::GetScheduleName(state, ort->ffSchedIndex(10)) + "\")"; + " (calculated using schedule \"" + ort->ffScheds(10)->Name + "\")"; } else { tableBody(1, 9) = "N/A"; } @@ -8253,7 +8237,7 @@ void WriteBEPSTable(EnergyPlusData &state) tableBody(1, 10) = RealToStr(ort->sourceFactorFuelOil2, 3); } else if (ort->gatherTotalsBEPS(11) > SmallValue) { tableBody(1, 10) = "Effective Factor = " + RealToStr(ort->gatherTotalsBySourceBEPS(11) / ort->gatherTotalsBEPS(11), 3) + - " (calculated using schedule \"" + ScheduleManager::GetScheduleName(state, ort->ffSchedIndex(11)) + "\")"; + " (calculated using schedule \"" + ort->ffScheds(11)->Name + "\")"; } else { tableBody(1, 10) = "N/A"; } @@ -8262,7 +8246,7 @@ void WriteBEPSTable(EnergyPlusData &state) tableBody(1, 11) = RealToStr(ort->sourceFactorPropane, 3); } else if (ort->gatherTotalsBEPS(12) > SmallValue) { tableBody(1, 11) = "Effective Factor = " + RealToStr(ort->gatherTotalsBySourceBEPS(12) / ort->gatherTotalsBEPS(12), 3) + - " (calculated using schedule \"" + ScheduleManager::GetScheduleName(state, ort->ffSchedIndex(12)) + "\")"; + " (calculated using schedule \"" + ort->ffScheds(12)->Name + "\")"; } else { tableBody(1, 11) = "N/A"; } @@ -8271,7 +8255,7 @@ void WriteBEPSTable(EnergyPlusData &state) tableBody(1, 12) = RealToStr(ort->sourceFactorOtherFuel1, 3); } else if (ort->gatherTotalsBEPS(13) > SmallValue) { tableBody(1, 12) = "Effective Factor = " + RealToStr(ort->gatherTotalsBySourceBEPS(13) / ort->gatherTotalsBEPS(13), 3) + - " (calculated using schedule \"" + ScheduleManager::GetScheduleName(state, ort->ffSchedIndex(13)) + "\")"; + " (calculated using schedule \"" + ort->ffScheds(13)->Name + "\")"; } else { tableBody(1, 12) = "N/A"; } @@ -8280,7 +8264,7 @@ void WriteBEPSTable(EnergyPlusData &state) tableBody(1, 13) = RealToStr(ort->sourceFactorOtherFuel2, 3); } else if (ort->gatherTotalsBEPS(14) > SmallValue) { tableBody(1, 13) = "Effective Factor = " + RealToStr(ort->gatherTotalsBySourceBEPS(14) / ort->gatherTotalsBEPS(14), 3) + - " (calculated using schedule \"" + ScheduleManager::GetScheduleName(state, ort->ffSchedIndex(14)) + "\")"; + " (calculated using schedule \"" + ort->ffScheds(14)->Name + "\")"; } else { tableBody(1, 13) = "N/A"; } @@ -9719,7 +9703,7 @@ void writeBEPSEndUseBySubCatOrSpaceType(EnergyPlusData &state, WriteTable(state, tableBody, rowHead, columnHead, columnWidth); } Array1D_string rowHeadTemp(rowHead); - // Before outputing to SQL, we forward fill the End use column (rowHead) + // Before outputting to SQL, we forward fill the End use column (rowHead) // for better sql queries FillRowHead(rowHeadTemp); @@ -10192,7 +10176,7 @@ void WriteDemandEndUseSummary(EnergyPlusData &state) // show the headers of the report WriteReportHeaders(state, "Demand End Use Components Summary", "Entire Facility", OutputProcessor::StoreType::Average); - Real64 ipElectricityConversion = 1.0; // declare here so that last one used is correct for LEEED section + Real64 ipElectricityConversion = 1.0; // declare here so that last one used is correct for LEED section for (int iUnitSystem = 0; iUnitSystem <= 1; iUnitSystem++) { UnitsStyle unitsStyle_cur = ort->unitsStyle; bool produceTabular = true; @@ -10554,7 +10538,7 @@ void WriteDemandEndUseSummary(EnergyPlusData &state) } Array1D_string rowHeadTemp(rowHead); - // Before outputing to SQL, we forward fill the End use column (rowHead) (cf #7481) + // Before outputting to SQL, we forward fill the End use column (rowHead) (cf #7481) // for better sql queries FillRowHead(rowHeadTemp); @@ -10686,7 +10670,7 @@ void WriteCompCostTable(EnergyPlusData &state) // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - auto &ort = state.dataOutRptTab; + auto const &ort = state.dataOutRptTab; if (!state.dataCostEstimateManager->DoCostEstimate) { return; @@ -10961,12 +10945,10 @@ void WriteVeriSumTable(EnergyPlusData &state) using DataSurfaces::OtherSideCondModeledExt; using DataSurfaces::SurfaceClass; using General::SafeDivide; - using ScheduleManager::GetScheduleName; - using ScheduleManager::ScheduleAverageHoursPerWeek; auto const &ort = state.dataOutRptTab; - // all arrays are in the format: (row, columnm) + // all arrays are in the format: (row, column) if (!ort->displayTabularVeriSum) { return; } @@ -11048,7 +11030,7 @@ void WriteVeriSumTable(EnergyPlusData &state) SIunit = "[m3]"; LookupSItoIP(state, SIunit, state.dataOutRptTab->unitConvIndexWVST, state.dataOutRptTab->m3_unitName); state.dataOutRptTab->m3_unitConv = ConvertIP(state, state.dataOutRptTab->unitConvIndexWVST, 1.0); - SIunit = "[W/m2]"; + // SIunit = "[W/m2]"; // LookupSItoIP(state, SIunit, state.dataOutRptTab->unitConvIndexWVST, state.dataOutRptTab->Wm2_unitName); state.dataOutRptTab->Wm2_unitName = "[W/ft2]"; state.dataOutRptTab->Wm2_unitConv = 0.3048 * 0.3048; // ConvertIP(state, state.dataOutRptTab->unitConvIndexWVST, 1.0); @@ -11496,7 +11478,7 @@ void WriteVeriSumTable(EnergyPlusData &state) auto const &thisZone = state.dataHeatBal->Zone(iZone); rowHead(iZone) = thisZone.Name; - if (state.dataHybridModel->HybridModelZone(iZone).InternalThermalMassCalc_T) { + if (state.dataHybridModel->hybridModelZones(iZone).InternalThermalMassCalc_T) { tableBody(1, iZone) = "Yes"; } else { tableBody(1, iZone) = "No"; @@ -12914,7 +12896,7 @@ void WriteSETHoursTableReportingPeriod(EnergyPlusData &state, } } -std::string RetrieveEntryFromTableBody(Array2D_string &tableBody, int const rowIndex, int const columnIndex) +std::string RetrieveEntryFromTableBody(Array2D_string const &tableBody, int const rowIndex, int const columnIndex) { return trimmed(ljustified(tableBody(columnIndex, rowIndex))); } @@ -14107,7 +14089,7 @@ void WriteSurfaceShadowing(EnergyPlusData &state) // Using/Aliasing using namespace DataShadowingCombinations; - auto &ort = state.dataOutRptTab; + auto const &ort = state.dataOutRptTab; // displaySurfaceShadowing = false for debugging if (!ort->displaySurfaceShadowing) { @@ -14394,7 +14376,7 @@ int unitsFromHeading(EnergyPlusData &state, std::string &heading) return (unitConv); } -// Jan 2021: Overloaded this function to accomondate dual units output needs +// Jan 2021: Overloaded this function to accommodate dual units output needs // changes the heading that contains and SI to IP as well as providing the unit conversion index // Glazer Nov 2016 int unitsFromHeading(EnergyPlusData &state, std::string &heading, UnitsStyle unitsStyle_para) @@ -14414,7 +14396,7 @@ int unitsFromHeading(EnergyPlusData &state, std::string &heading, UnitsStyle uni return (unitConv); } -// function that returns a vector of strings when given a string with comma delimitters +// function that returns a vector of strings when given a string with comma delimiters // Glazer Nov 2016 std::vector splitCommaString(std::string const &inputString) { @@ -14446,6 +14428,12 @@ void AddTOCLoadComponentTableSummaries(EnergyPlusData &state) if (state.dataGlobal->CompLoadReportIsReq) { if (ort->displayZoneComponentLoadSummary) { + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + for (int iSpace = 1; iSpace <= state.dataGlobal->NumOfZones; ++iSpace) { + if (!state.dataZoneEquip->ZoneEquipConfig(state.dataHeatBal->space(iSpace).zoneNum).IsControlled) continue; + AddTOCEntry(state, "Space Component Load Summary", state.dataHeatBal->space(iSpace).Name); + } + } for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { if (!state.dataZoneEquip->ZoneEquipConfig(iZone).IsControlled) continue; AddTOCEntry(state, "Zone Component Load Summary", state.dataHeatBal->Zone(iZone).Name); @@ -14467,146 +14455,79 @@ void AllocateLoadComponentArrays(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Jason Glazer // DATE WRITTEN April 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Allocate the arrays related to the load component report - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: auto const &ort = state.dataOutRptTab; if (!ort->AllocateLoadComponentArraysDoAllocate) { return; } + + Real64 timeStepsInDay = state.dataGlobal->TimeStepsInHour * Constant::rHoursInDay; + // For many of the following arrays the last dimension is the number of environments and is same as sizing arrays ort->radiantPulseTimestep.allocate({0, state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays}, state.dataGlobal->NumOfZones); ort->radiantPulseTimestep = 0; ort->radiantPulseReceived.allocate({0, state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays}, state.dataSurface->TotSurfaces); ort->radiantPulseReceived = 0.0; - ort->loadConvectedNormal.allocate(state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, - {0, state.dataGlobal->NumOfTimeStepInHour * 24}, - state.dataSurface->TotSurfaces); - ort->loadConvectedNormal = 0.0; - ort->loadConvectedWithPulse.allocate(state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, - {0, state.dataGlobal->NumOfTimeStepInHour * 24}, - state.dataSurface->TotSurfaces); - ort->loadConvectedWithPulse = 0.0; - ort->netSurfRadSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); - ort->netSurfRadSeq = 0.0; - ort->decayCurveCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); + ort->decayCurveCool.allocate(timeStepsInDay, state.dataSurface->TotSurfaces); ort->decayCurveCool = 0.0; - ort->decayCurveHeat.allocate(state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); + ort->decayCurveHeat.allocate(timeStepsInDay, state.dataSurface->TotSurfaces); ort->decayCurveHeat = 0.0; - ort->ITABSFseq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); - ort->ITABSFseq = 0.0; - ort->TMULTseq.allocate(state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, - state.dataGlobal->NumOfTimeStepInHour * 24, - state.dataViewFactor->NumOfRadiantEnclosures); - ort->TMULTseq = 0.0; - ort->peopleInstantSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->peopleInstantSeq = 0.0; - ort->peopleLatentSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->peopleLatentSeq = 0.0; - ort->peopleRadSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->peopleRadSeq = 0.0; - ort->lightInstantSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->lightInstantSeq = 0.0; - ort->lightRetAirSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->lightRetAirSeq = 0.0; - ort->lightLWRadSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->lightLWRadSeq = 0.0; - ort->lightSWRadSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); - ort->lightSWRadSeq = 0.0; - ort->equipInstantSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->equipInstantSeq = 0.0; - ort->equipLatentSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->equipLatentSeq = 0.0; - ort->equipRadSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->equipRadSeq = 0.0; - ort->refrigInstantSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->refrigInstantSeq = 0.0; - ort->refrigRetAirSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->refrigRetAirSeq = 0.0; - ort->refrigLatentSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->refrigLatentSeq = 0.0; - ort->waterUseInstantSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->waterUseInstantSeq = 0.0; - ort->waterUseLatentSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->waterUseLatentSeq = 0.0; - ort->hvacLossInstantSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->hvacLossInstantSeq = 0.0; - ort->hvacLossRadSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->hvacLossRadSeq = 0.0; - ort->powerGenInstantSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->powerGenInstantSeq = 0.0; - ort->powerGenRadSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->powerGenRadSeq = 0.0; - ort->infilInstantSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->infilInstantSeq = 0.0; - ort->infilLatentSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->infilLatentSeq = 0.0; - ort->zoneVentInstantSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->zoneVentInstantSeq = 0.0; - ort->zoneVentLatentSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->zoneVentLatentSeq = 0.0; - ort->interZoneMixInstantSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->interZoneMixInstantSeq = 0.0; - ort->interZoneMixLatentSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->interZoneMixLatentSeq = 0.0; - ort->feneCondInstantSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->feneCondInstantSeq = 0.0; - ort->feneSolarRadSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); - ort->feneSolarRadSeq = 0.0; + + Real64 const numTSinDay = state.dataGlobal->TimeStepsInHour * Constant::rHoursInDay; + + ort->surfCompLoads.resize(state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays); + for (auto &day : ort->surfCompLoads) { + day.ts.resize(numTSinDay); + for (auto &ts : day.ts) { + ts.surf.resize(state.dataSurface->TotSurfaces); + } + } + + ort->enclCompLoads.resize(state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays); + for (auto &day : ort->enclCompLoads) { + day.ts.resize(numTSinDay); + for (auto &ts : day.ts) { + ts.encl.resize(state.dataViewFactor->NumOfRadiantEnclosures); + } + } + + ort->znCompLoads.resize(state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays); + for (auto &day : ort->znCompLoads) { + day.ts.resize(numTSinDay); + for (auto &ts : day.ts) { + ts.spacezone.resize(state.dataGlobal->NumOfZones); + } + } + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + ort->spCompLoads.resize(state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays); + for (auto &day : ort->spCompLoads) { + day.ts.resize(numTSinDay); + for (auto &ts : day.ts) { + ts.spacezone.resize(state.dataGlobal->numSpaces); + } + } + } + ort->AllocateLoadComponentArraysDoAllocate = false; } -void DeallocateLoadComponentArrays(EnergyPlusData &state) +void DeallocateLoadComponentArrays(EnergyPlusData const &state) { // SUBROUTINE INFORMATION: // AUTHOR Jason Glazer // DATE WRITTEN August 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Deallocate the arrays related to the load component report that will not // be needed in the reporting. - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: auto const &ort = state.dataOutRptTab; ort->radiantPulseTimestep.deallocate(); ort->radiantPulseReceived.deallocate(); - ort->loadConvectedWithPulse.deallocate(); } void ComputeLoadComponentDecayCurve(EnergyPlusData &state) @@ -14615,8 +14536,6 @@ void ComputeLoadComponentDecayCurve(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Jason Glazer // DATE WRITTEN August 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Determines the load component decay curve based on normal and pulse results from zone sizing. @@ -14625,73 +14544,58 @@ void ComputeLoadComponentDecayCurve(EnergyPlusData &state) // Decay curve is the fraction of the heat convected from a surface over the initial radiant heat // absorbed by the surface. - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 diff; auto const &ort = state.dataOutRptTab; - for (state.dataOutRptTab->SurfNumCLCDC = 1; state.dataOutRptTab->SurfNumCLCDC <= state.dataSurface->TotSurfaces; - ++state.dataOutRptTab->SurfNumCLCDC) { - state.dataOutRptTab->ZoneNumCLCDC = state.dataSurface->Surface(state.dataOutRptTab->SurfNumCLCDC).Zone; - if (state.dataOutRptTab->ZoneNumCLCDC == 0) continue; - if (!state.dataZoneEquip->ZoneEquipConfig(state.dataOutRptTab->ZoneNumCLCDC).IsControlled) continue; - state.dataOutRptTab->CoolDesSelectedCLCDC = state.dataSize->CalcFinalZoneSizing(state.dataOutRptTab->ZoneNumCLCDC).CoolDDNum; + for (int surfNum = 1; surfNum <= state.dataSurface->TotSurfaces; ++surfNum) { + int const zoneNum = state.dataSurface->Surface(surfNum).Zone; + if (zoneNum == 0) continue; + if (!state.dataZoneEquip->ZoneEquipConfig(zoneNum).IsControlled) continue; + int const spaceNum = state.dataSurface->Surface(surfNum).spaceNum; + int coolDesSelected = state.dataSize->CalcFinalZoneSizing(zoneNum).CoolDDNum; // loop over timesteps after pulse occurred - if (state.dataOutRptTab->CoolDesSelectedCLCDC != 0) { - state.dataOutRptTab->TimeOfPulseCLCDC = - ort->radiantPulseTimestep(state.dataOutRptTab->CoolDesSelectedCLCDC, state.dataOutRptTab->ZoneNumCLCDC); + if (coolDesSelected != 0) { + auto &surfCLClDay = ort->surfCompLoads[coolDesSelected - 1]; + int timeOfPulse = ort->radiantPulseTimestep(coolDesSelected, zoneNum); // if the CoolDesSelected time is on a different day than // when the pulse occurred, need to scan back and find when // the pulse occurred. - if (state.dataOutRptTab->TimeOfPulseCLCDC == 0) { - for (int i = state.dataOutRptTab->CoolDesSelectedCLCDC; i >= 1; --i) { - state.dataOutRptTab->TimeOfPulseCLCDC = ort->radiantPulseTimestep(i, state.dataOutRptTab->ZoneNumCLCDC); - if (state.dataOutRptTab->TimeOfPulseCLCDC != 0) break; + if (timeOfPulse == 0) { + for (int i = coolDesSelected; i >= 1; --i) { + timeOfPulse = ort->radiantPulseTimestep(i, zoneNum); + if (timeOfPulse != 0) break; } } - if (state.dataOutRptTab->TimeOfPulseCLCDC == 0) state.dataOutRptTab->TimeOfPulseCLCDC = 1; - for (state.dataOutRptTab->TimeStepCLCDC = state.dataOutRptTab->TimeOfPulseCLCDC; - state.dataOutRptTab->TimeStepCLCDC <= state.dataGlobal->NumOfTimeStepInHour * 24; - ++state.dataOutRptTab->TimeStepCLCDC) { - if (ort->radiantPulseReceived(state.dataOutRptTab->CoolDesSelectedCLCDC, state.dataOutRptTab->SurfNumCLCDC) != 0.0) { - diff = ort->loadConvectedWithPulse( - state.dataOutRptTab->CoolDesSelectedCLCDC, state.dataOutRptTab->TimeStepCLCDC, state.dataOutRptTab->SurfNumCLCDC) - - ort->loadConvectedNormal( - state.dataOutRptTab->CoolDesSelectedCLCDC, state.dataOutRptTab->TimeStepCLCDC, state.dataOutRptTab->SurfNumCLCDC); - ort->decayCurveCool(state.dataOutRptTab->TimeStepCLCDC - state.dataOutRptTab->TimeOfPulseCLCDC + 1, - state.dataOutRptTab->SurfNumCLCDC) = - -diff / ort->radiantPulseReceived(state.dataOutRptTab->CoolDesSelectedCLCDC, state.dataOutRptTab->SurfNumCLCDC); + if (timeOfPulse == 0) timeOfPulse = 1; + for (int timeStep = timeOfPulse; timeStep <= state.dataGlobal->TimeStepsInHour * Constant::rHoursInDay; ++timeStep) { + if (ort->radiantPulseReceived(coolDesSelected, surfNum) != 0.0) { + auto &surfClDayTS = surfCLClDay.ts[timeStep - 1].surf[surfNum - 1]; + diff = surfClDayTS.loadConvectedWithPulse - surfClDayTS.loadConvectedNormal; + ort->decayCurveCool(timeStep - timeOfPulse + 1, surfNum) = -diff / ort->radiantPulseReceived(coolDesSelected, surfNum); } else { - ort->decayCurveCool(state.dataOutRptTab->TimeStepCLCDC - state.dataOutRptTab->TimeOfPulseCLCDC + 1, - state.dataOutRptTab->SurfNumCLCDC) = 0.0; + ort->decayCurveCool(timeStep - timeOfPulse + 1, surfNum) = 0.0; } } } - state.dataOutRptTab->HeatDesSelectedCLCDC = state.dataSize->CalcFinalZoneSizing(state.dataOutRptTab->ZoneNumCLCDC).HeatDDNum; - if (state.dataOutRptTab->HeatDesSelectedCLCDC != 0) { - state.dataOutRptTab->TimeOfPulseCLCDC = - ort->radiantPulseTimestep(state.dataOutRptTab->HeatDesSelectedCLCDC, state.dataOutRptTab->ZoneNumCLCDC); + int const heatDesSelected = state.dataSize->CalcFinalZoneSizing(zoneNum).HeatDDNum; + if (heatDesSelected != 0) { + auto &surfCLHtDay = ort->surfCompLoads[heatDesSelected - 1]; + int timeOfPulse = ort->radiantPulseTimestep(heatDesSelected, zoneNum); // scan back to the day that the heating pulse occurs, if necessary - if (state.dataOutRptTab->TimeOfPulseCLCDC == 0) { - for (int i = state.dataOutRptTab->HeatDesSelectedCLCDC; i >= 1; --i) { - state.dataOutRptTab->TimeOfPulseCLCDC = ort->radiantPulseTimestep(i, state.dataOutRptTab->ZoneNumCLCDC); - if (state.dataOutRptTab->TimeOfPulseCLCDC != 0) break; + if (timeOfPulse == 0) { + for (int i = heatDesSelected; i >= 1; --i) { + timeOfPulse = ort->radiantPulseTimestep(i, zoneNum); + if (timeOfPulse != 0) break; } } - if (state.dataOutRptTab->TimeOfPulseCLCDC == 0) state.dataOutRptTab->TimeOfPulseCLCDC = 1; - for (state.dataOutRptTab->TimeStepCLCDC = state.dataOutRptTab->TimeOfPulseCLCDC; - state.dataOutRptTab->TimeStepCLCDC <= state.dataGlobal->NumOfTimeStepInHour * 24; - ++state.dataOutRptTab->TimeStepCLCDC) { - if (ort->radiantPulseReceived(state.dataOutRptTab->HeatDesSelectedCLCDC, state.dataOutRptTab->SurfNumCLCDC) != 0.0) { - diff = ort->loadConvectedWithPulse( - state.dataOutRptTab->HeatDesSelectedCLCDC, state.dataOutRptTab->TimeStepCLCDC, state.dataOutRptTab->SurfNumCLCDC) - - ort->loadConvectedNormal( - state.dataOutRptTab->HeatDesSelectedCLCDC, state.dataOutRptTab->TimeStepCLCDC, state.dataOutRptTab->SurfNumCLCDC); - ort->decayCurveHeat(state.dataOutRptTab->TimeStepCLCDC - state.dataOutRptTab->TimeOfPulseCLCDC + 1, - state.dataOutRptTab->SurfNumCLCDC) = - -diff / ort->radiantPulseReceived(state.dataOutRptTab->HeatDesSelectedCLCDC, state.dataOutRptTab->SurfNumCLCDC); + if (timeOfPulse == 0) timeOfPulse = 1; + for (int timeStep = timeOfPulse; timeStep <= state.dataGlobal->TimeStepsInHour * Constant::rHoursInDay; ++timeStep) { + if (ort->radiantPulseReceived(heatDesSelected, surfNum) != 0.0) { + auto &surfHtDayTS = surfCLHtDay.ts[timeStep - 1].surf[surfNum - 1]; + diff = surfHtDayTS.loadConvectedWithPulse - surfHtDayTS.loadConvectedNormal; + ort->decayCurveHeat(timeStep - timeOfPulse + 1, surfNum) = -diff / ort->radiantPulseReceived(heatDesSelected, surfNum); } else { - ort->decayCurveHeat(state.dataOutRptTab->TimeStepCLCDC - state.dataOutRptTab->TimeOfPulseCLCDC + 1, - state.dataOutRptTab->SurfNumCLCDC) = 0.0; + ort->decayCurveHeat(timeStep - timeOfPulse + 1, surfNum) = 0.0; } } } @@ -14715,7 +14619,7 @@ void ComputeLoadComponentDecayCurve(EnergyPlusData &state) "Radiant to Convective Decay Curves for Cooling", thisZone.Name, state.dataSurface->Surface(kSurf).Name); - for (int jTime = 1; jTime <= min(state.dataGlobal->NumOfTimeStepInHour * 24, 36); ++jTime) { + for (int jTime = 1; jTime <= min(int(state.dataGlobal->TimeStepsInHour * Constant::iHoursInDay), 36); ++jTime) { print(state.files.eio, ",{:6.3F}", ort->decayCurveCool(jTime, kSurf)); } // put a line feed at the end of the line @@ -14729,7 +14633,7 @@ void ComputeLoadComponentDecayCurve(EnergyPlusData &state) "Radiant to Convective Decay Curves for Heating", thisZone.Name, state.dataSurface->Surface(kSurf).Name); - for (int jTime = 1; jTime <= min(state.dataGlobal->NumOfTimeStepInHour * 24, 36); ++jTime) { + for (int jTime = 1; jTime <= min(int(state.dataGlobal->TimeStepsInHour * Constant::iHoursInDay), 36); ++jTime) { print(state.files.eio, ",{:6.3F}", ort->decayCurveHeat(jTime, kSurf)); } // put a line feed at the end of the line @@ -14744,8 +14648,6 @@ void GatherComponentLoadsSurface(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Jason Glazer // DATE WRITTEN September 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Gather values during sizing used for loads component report. @@ -14757,28 +14659,52 @@ void GatherComponentLoadsSurface(EnergyPlusData &state) auto const &ort = state.dataOutRptTab; if (state.dataGlobal->CompLoadReportIsReq && !state.dataGlobal->isPulseZoneSizing) { - state.dataOutRptTab->TimeStepInDayGCLS = - (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; - ort->feneCondInstantSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLS, _) = 0.0; - for (state.dataOutRptTab->iSurfGCLS = 1; state.dataOutRptTab->iSurfGCLS <= state.dataSurface->TotSurfaces; ++state.dataOutRptTab->iSurfGCLS) { - state.dataOutRptTab->ZoneNumGCLS = state.dataSurface->Surface(state.dataOutRptTab->iSurfGCLS).Zone; - if (state.dataOutRptTab->ZoneNumGCLS == 0) continue; - if (state.dataSurface->Surface(state.dataOutRptTab->iSurfGCLS).Class != DataSurfaces::SurfaceClass::Window) continue; + int timeStepInDayGCLS = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->TimeStepsInHour + state.dataGlobal->TimeStep; + auto &znCLDayTS = ort->znCompLoads[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLS - 1]; + for (auto &zone : znCLDayTS.spacezone) { + zone.feneCondInstantSeq = 0.0; + } + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + auto &spCLDayTS = ort->spCompLoads[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLS - 1]; + for (auto &space : spCLDayTS.spacezone) { + space.feneCondInstantSeq = 0.0; + } + } + for (int iSurfGCLS = 1; iSurfGCLS <= state.dataSurface->TotSurfaces; ++iSurfGCLS) { + int zoneNumGCLS = state.dataSurface->Surface(iSurfGCLS).Zone; + if (zoneNumGCLS == 0) continue; + if (state.dataSurface->Surface(iSurfGCLS).Class != DataSurfaces::SurfaceClass::Window) continue; // IF (.not. ZoneEquipConfig(ZoneNum)%IsControlled) CYCLE - ort->feneCondInstantSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLS, state.dataOutRptTab->ZoneNumGCLS) += - state.dataSurface->SurfWinGainConvGlazToZoneRep(state.dataOutRptTab->iSurfGCLS) + - state.dataSurface->SurfWinConvHeatFlowNatural(state.dataOutRptTab->iSurfGCLS) + - state.dataSurface->SurfWinGainConvShadeToZoneRep(state.dataOutRptTab->iSurfGCLS) + - state.dataSurface->SurfWinGainFrameDividerToZoneRep(state.dataOutRptTab->iSurfGCLS); + Real64 surfCond = state.dataSurface->SurfWinGainConvGlazToZoneRep(iSurfGCLS) + state.dataSurface->SurfWinConvHeatFlowNatural(iSurfGCLS) + + state.dataSurface->SurfWinGainConvShadeToZoneRep(iSurfGCLS) + + state.dataSurface->SurfWinGainFrameDividerToZoneRep(iSurfGCLS); + znCLDayTS.spacezone[zoneNumGCLS - 1].feneCondInstantSeq += surfCond; + + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + int spaceNum = state.dataSurface->Surface(iSurfGCLS).spaceNum; + ort->spCompLoads[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLS - 1].spacezone[spaceNum - 1].feneCondInstantSeq += + surfCond; + } + // for now assume zero instant solar - may change related // to how blinds and shades absorb solar radiation and // convect that heat that timestep. // feneSolarInstantSeq(ZoneNum,TimeStepInDay,CurOverallSimDay) = 0 } + for (int izone = 1; izone <= state.dataGlobal->NumOfZones; ++izone) { Real64 tubularGain = 0.0; tubularGain = InternalHeatGains::SumInternalConvectionGainsByTypes(state, izone, OutputReportTabular::IntGainTypesTubularGCLS); - ort->feneCondInstantSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLS, izone) += tubularGain; + znCLDayTS.spacezone[izone - 1].feneCondInstantSeq += tubularGain; + } + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + auto &spCLDayTS = ort->spCompLoads[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLS - 1]; + for (int ispace = 1; ispace <= state.dataGlobal->NumOfZones; ++ispace) { + Real64 tubularGain = 0.0; + int zone = state.dataHeatBal->space(ispace).zoneNum; + tubularGain = InternalHeatGains::SumInternalConvectionGainsByTypes(state, zone, OutputReportTabular::IntGainTypesTubularGCLS, ispace); + spCLDayTS.spacezone[ispace - 1].feneCondInstantSeq += tubularGain; + } } } } @@ -14788,8 +14714,6 @@ void GatherComponentLoadsHVAC(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Jason Glazer // DATE WRITTEN September 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Gather values during sizing used for loads component report. @@ -14797,76 +14721,62 @@ void GatherComponentLoadsHVAC(EnergyPlusData &state) // METHODOLOGY EMPLOYED: // Save sequence of values for report during sizing. - // Using/Aliasing - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - if (!(state.dataGlobal->CompLoadReportIsReq && !state.dataGlobal->isPulseZoneSizing)) { return; } - auto &ort = state.dataOutRptTab; - Real64 const TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - state.dataOutRptTab->TimeStepInDayGCLH = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; - for (state.dataOutRptTab->iZoneGCLH = 1; state.dataOutRptTab->iZoneGCLH <= state.dataGlobal->NumOfZones; ++state.dataOutRptTab->iZoneGCLH) { - ort->infilInstantSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) = - ((state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).InfilHeatGain - - state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).InfilHeatLoss) / - TimeStepSysSec); // zone infiltration - if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { - ort->infilInstantSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) += - (state.afn->AirflowNetworkReportData(state.dataOutRptTab->iZoneGCLH).MultiZoneInfiSenGainW - - state.afn->AirflowNetworkReportData(state.dataOutRptTab->iZoneGCLH).MultiZoneInfiSenLossW); // air flow network - } - ort->infilLatentSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) = - ((state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).InfilLatentGain - - state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).InfilLatentLoss) / - TimeStepSysSec); // zone infiltration - if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { - ort->infilLatentSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) += - (state.afn->AirflowNetworkReportData(state.dataOutRptTab->iZoneGCLH).MultiZoneInfiLatGainW - - state.afn->AirflowNetworkReportData(state.dataOutRptTab->iZoneGCLH).MultiZoneInfiLatLossW); // air flow network - } - - ort->zoneVentInstantSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) = - ((state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).VentilHeatGain - - state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).VentilHeatLoss) / - TimeStepSysSec); // zone ventilation - if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { - ort->zoneVentInstantSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) += - (state.afn->AirflowNetworkReportData(state.dataOutRptTab->iZoneGCLH).MultiZoneVentSenGainW - - state.afn->AirflowNetworkReportData(state.dataOutRptTab->iZoneGCLH).MultiZoneVentSenLossW); // air flow network - } - ort->zoneVentLatentSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) = - ((state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).VentilLatentGain - - state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).VentilLatentLoss) / - TimeStepSysSec); // zone ventilation + int timeStepInDayGCLH = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->TimeStepsInHour + state.dataGlobal->TimeStep; + auto &znCompLoadDayTS = state.dataOutRptTab->znCompLoads[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLH - 1]; + for (int iZoneGCLH = 1; iZoneGCLH <= state.dataGlobal->NumOfZones; ++iZoneGCLH) { + auto &znCompLoadDayTSZone = znCompLoadDayTS.spacezone[iZoneGCLH - 1]; + auto &zoneAirRpt = state.dataHeatBal->ZnAirRpt(iZoneGCLH); + gatherSpaceZoneCompLoadsHVAC(znCompLoadDayTSZone, zoneAirRpt, state.dataHVACGlobal->TimeStepSysSec); if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { - ort->zoneVentInstantSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) += - (state.afn->AirflowNetworkReportData(state.dataOutRptTab->iZoneGCLH).MultiZoneVentLatGainW - - state.afn->AirflowNetworkReportData(state.dataOutRptTab->iZoneGCLH).MultiZoneVentLatLossW); // air flow network - } - - ort->interZoneMixInstantSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) = - ((state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).MixHeatGain - - state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).MixHeatLoss) / - TimeStepSysSec); // zone mixing - if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { - ort->interZoneMixInstantSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) += - (state.afn->AirflowNetworkReportData(state.dataOutRptTab->iZoneGCLH).MultiZoneMixSenGainW - - state.afn->AirflowNetworkReportData(state.dataOutRptTab->iZoneGCLH).MultiZoneMixSenLossW); // air flow network - } - ort->interZoneMixLatentSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) = - ((state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).MixLatentGain - - state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).MixLatentLoss) / - TimeStepSysSec); // zone mixing - if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { - ort->interZoneMixLatentSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) += - (state.afn->AirflowNetworkReportData(state.dataOutRptTab->iZoneGCLH).MultiZoneMixLatGainW - - state.afn->AirflowNetworkReportData(state.dataOutRptTab->iZoneGCLH).MultiZoneMixLatLossW); // air flow network + znCompLoadDayTSZone.infilInstantSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiSenGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiSenLossW); // air flow network + znCompLoadDayTSZone.infilLatentSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiLatGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiLatLossW); // air flow network + znCompLoadDayTSZone.zoneVentInstantSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentSenGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentSenLossW); // air flow network + znCompLoadDayTSZone.zoneVentInstantSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentLatGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentLatLossW); // air flow network + znCompLoadDayTSZone.interZoneMixInstantSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixSenGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixSenLossW); // air flow network + znCompLoadDayTSZone.interZoneMixLatentSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixLatGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixLatLossW); // air flow network + } + } + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + auto &spCompLoadDayTS = state.dataOutRptTab->spCompLoads[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLH - 1]; + for (int iSpace = 1; iSpace <= state.dataGlobal->numSpaces; ++iSpace) { + auto &spCompLoadDayTSSpace = spCompLoadDayTS.spacezone[iSpace - 1]; + auto &spaceAirRpt = state.dataHeatBal->spaceAirRpt(iSpace); + gatherSpaceZoneCompLoadsHVAC(spCompLoadDayTSSpace, spaceAirRpt, state.dataHVACGlobal->TimeStepSysSec); + if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { + auto &space = state.dataHeatBal->space(iSpace); + auto const &znCompLoadDayTSZone = znCompLoadDayTS.spacezone[space.zoneNum - 1]; + spCompLoadDayTSSpace.infilInstantSeq = space.fracZoneVolume * znCompLoadDayTSZone.infilInstantSeq; + spCompLoadDayTSSpace.infilLatentSeq = space.fracZoneVolume * znCompLoadDayTSZone.infilLatentSeq; + spCompLoadDayTSSpace.zoneVentInstantSeq = space.fracZoneVolume * znCompLoadDayTSZone.zoneVentInstantSeq; + spCompLoadDayTSSpace.zoneVentInstantSeq = space.fracZoneVolume * znCompLoadDayTSZone.zoneVentInstantSeq; + spCompLoadDayTSSpace.interZoneMixInstantSeq = space.fracZoneVolume * znCompLoadDayTSZone.interZoneMixInstantSeq; + spCompLoadDayTSSpace.interZoneMixLatentSeq = space.fracZoneVolume * znCompLoadDayTSZone.interZoneMixLatentSeq; + } } } } +void gatherSpaceZoneCompLoadsHVAC(OutputReportTabular::compLoadsSpaceZone &szCompLoadDayTS, + DataHeatBalance::AirReportVars const &szAirRpt, + Real64 const timeStepSysSec) +{ + szCompLoadDayTS.infilInstantSeq = ((szAirRpt.InfilHeatGain - szAirRpt.InfilHeatLoss) / timeStepSysSec); // zone infiltration + szCompLoadDayTS.infilLatentSeq = ((szAirRpt.InfilLatentGain - szAirRpt.InfilLatentLoss) / timeStepSysSec); // zone infiltration + szCompLoadDayTS.zoneVentInstantSeq = ((szAirRpt.VentilHeatGain - szAirRpt.VentilHeatLoss) / timeStepSysSec); // zone ventilation + szCompLoadDayTS.zoneVentLatentSeq = ((szAirRpt.VentilLatentGain - szAirRpt.VentilLatentLoss) / timeStepSysSec); // zone ventilation + szCompLoadDayTS.interZoneMixInstantSeq = ((szAirRpt.MixHeatGain - szAirRpt.MixHeatLoss) / timeStepSysSec); // zone mixing + szCompLoadDayTS.interZoneMixLatentSeq = ((szAirRpt.MixLatentGain - szAirRpt.MixLatentLoss) / timeStepSysSec); // zone mixing +} + void WriteLoadComponentSummaryTables(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -14940,20 +14850,16 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) // Delayed components are moved into this function so that we can calculate them one zone at a time // with Array1D - Array1D peopleDelaySeqHeat; - Array1D peopleDelaySeqCool; - Array1D lightDelaySeqHeat; - Array1D lightDelaySeqCool; - Array1D equipDelaySeqHeat; - Array1D equipDelaySeqCool; - Array1D hvacLossDelaySeqHeat; - Array1D hvacLossDelaySeqCool; - Array1D powerGenDelaySeqHeat; - Array1D powerGenDelaySeqCool; - Array1D feneSolarDelaySeqHeat; - Array1D feneSolarDelaySeqCool; - Array2D surfDelaySeqHeat; - Array2D surfDelaySeqCool; + Array1D peopleDelaySeq; + Array1D lightDelaySeq; + Array1D equipDelaySeq; + Array1D hvacLossDelaySeq; + Array1D powerGenDelaySeq; + Array1D feneSolarDelaySeq; + Array2D surfDelaySeq; + + Array1D SpaceHeatCompLoadTables; // for space level component load summary output tables + Array1D SpaceCoolCompLoadTables; Array1D ZoneHeatCompLoadTables; // for zone level component load summary output tables Array1D ZoneCoolCompLoadTables; @@ -14968,7 +14874,7 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) Array1D FacilityZonesHeatCompLoadTables; // zone results used for facility report - never directly output Array1D FacilityZonesCoolCompLoadTables; - // Jan 2021: The following variable is redudant in the original code, deleting the line + // Jan 2021: The following variable is redundant in the original code, deleting the line // CompLoadTablesType curCompLoadTable; // active component load table for (int iUnitSystem = 0; iUnitSystem <= 1; iUnitSystem++) { @@ -14977,38 +14883,42 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) bool produceSQLite = false; if (produceDualUnitsFlags(iUnitSystem, ort->unitsStyle, ort->unitsStyle_SQLite, unitsStyle_cur, produceTabular, produceSQLite)) break; - // adjusted initilization location to after variable declaration for loops 2021-01-11 - peopleDelaySeqHeat.dimension(state.dataGlobal->NumOfTimeStepInHour * 24, 0.0); - peopleDelaySeqHeat = 0.0; - peopleDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); - peopleDelaySeqCool = 0.0; - lightDelaySeqHeat.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); - lightDelaySeqHeat = 0.0; - lightDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); - lightDelaySeqCool = 0.0; - equipDelaySeqHeat.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); - equipDelaySeqHeat = 0.0; - equipDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); - equipDelaySeqCool = 0.0; - hvacLossDelaySeqHeat.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); - hvacLossDelaySeqHeat = 0.0; - hvacLossDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); - hvacLossDelaySeqCool = 0.0; - powerGenDelaySeqHeat.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); - powerGenDelaySeqHeat = 0.0; - powerGenDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); - powerGenDelaySeqCool = 0.0; - feneSolarDelaySeqHeat.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); - feneSolarDelaySeqHeat = 0.0; - feneSolarDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); - feneSolarDelaySeqCool = 0.0; - surfDelaySeqHeat.allocate(state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); - surfDelaySeqHeat = 0.0; - surfDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); - surfDelaySeqCool = 0.0; + Real64 timeStepsInDay = state.dataGlobal->TimeStepsInHour * Constant::rHoursInDay; + + // adjusted initialization location to after variable declaration for loops 2021-01-11 + peopleDelaySeq.dimension(timeStepsInDay, 0.0); + peopleDelaySeq = 0.0; + lightDelaySeq.allocate(timeStepsInDay); + lightDelaySeq = 0.0; + equipDelaySeq.allocate(timeStepsInDay); + equipDelaySeq = 0.0; + hvacLossDelaySeq.allocate(timeStepsInDay); + hvacLossDelaySeq = 0.0; + powerGenDelaySeq.allocate(timeStepsInDay); + powerGenDelaySeq = 0.0; + feneSolarDelaySeq.allocate(timeStepsInDay); + feneSolarDelaySeq = 0.0; + surfDelaySeq.allocate(timeStepsInDay, state.dataSurface->TotSurfaces); + surfDelaySeq = 0.0; // initialize arrays if (ort->displayZoneComponentLoadSummary) { + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + SpaceHeatCompLoadTables.allocate(state.dataGlobal->numSpaces); + for (auto &e : SpaceHeatCompLoadTables) { + e.cells.allocate(LoadCompCol::PerArea, LoadCompRow::GrdTot); + e.cells = 0.; + e.cellUsed.allocate(LoadCompCol::PerArea, LoadCompRow::GrdTot); + e.cellUsed = false; + } + SpaceCoolCompLoadTables.allocate(state.dataGlobal->numSpaces); + for (auto &e : SpaceCoolCompLoadTables) { + e.cells.allocate(LoadCompCol::PerArea, LoadCompRow::GrdTot); + e.cells = 0.; + e.cellUsed.allocate(LoadCompCol::PerArea, LoadCompRow::GrdTot); + e.cellUsed = false; + } + } ZoneHeatCompLoadTables.allocate(state.dataGlobal->NumOfZones); for (auto &e : ZoneHeatCompLoadTables) { e.cells.allocate(LoadCompCol::PerArea, LoadCompRow::GrdTot); @@ -15086,103 +14996,63 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) } // get the zone areas needed later + Array1D spaceComponentAreas; Array1D ZoneComponentAreas; ZoneComponentAreas.allocate(state.dataGlobal->NumOfZones); - GetZoneComponentAreas(state, ZoneComponentAreas); + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + spaceComponentAreas.allocate(state.dataGlobal->numSpaces); + } + GetZoneComponentAreas(state, ZoneComponentAreas, spaceComponentAreas); // ZoneComponentLoadSummary if (ort->displayZoneComponentLoadSummary) { + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + for (int iSpace = 1; iSpace <= state.dataGlobal->numSpaces; ++iSpace) { + // Yes, check if the zone is controlled, not the space for this + int zoneNum = state.dataHeatBal->space(iSpace).zoneNum; + if (!state.dataZoneEquip->ZoneEquipConfig(zoneNum).IsControlled) continue; + if (allocated(state.dataSize->CalcFinalSpaceSizing)) { + computeSpaceZoneCompLoads(state, + state.dataSize->CalcFinalSpaceSizing(iSpace), + SpaceCoolCompLoadTables(iSpace), + SpaceHeatCompLoadTables(iSpace), + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + ort->spCompLoads, + surfDelaySeq, + spaceComponentAreas(iSpace), + zoneNum, + iSpace); + } + } + } for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { if (!state.dataZoneEquip->ZoneEquipConfig(iZone).IsControlled) continue; if (allocated(state.dataSize->CalcFinalZoneSizing)) { - auto const &thisCalcFinalZoneSizing = state.dataSize->CalcFinalZoneSizing(iZone); - coolDesSelected = thisCalcFinalZoneSizing.CoolDDNum; - ZoneCoolCompLoadTables(iZone).desDayNum = coolDesSelected; - timeCoolMax = thisCalcFinalZoneSizing.TimeStepNumAtCoolMax; - ZoneCoolCompLoadTables(iZone).timeStepMax = timeCoolMax; - - GetDelaySequences(state, - coolDesSelected, - true, - iZone, - peopleDelaySeqCool, - equipDelaySeqCool, - hvacLossDelaySeqCool, - powerGenDelaySeqCool, - lightDelaySeqCool, - feneSolarDelaySeqCool, - ort->feneCondInstantSeq, - surfDelaySeqCool); - ComputeTableBodyUsingMovingAvg(state, - ZoneCoolCompLoadTables(iZone).cells, - ZoneCoolCompLoadTables(iZone).cellUsed, - coolDesSelected, - timeCoolMax, - iZone, - peopleDelaySeqCool, - equipDelaySeqCool, - hvacLossDelaySeqCool, - powerGenDelaySeqCool, - lightDelaySeqCool, - feneSolarDelaySeqCool, - ort->feneCondInstantSeq, - surfDelaySeqCool); - CollectPeakZoneConditions(state, ZoneCoolCompLoadTables(iZone), coolDesSelected, timeCoolMax, iZone, true); - // send latent load info to coil summary report - state.dataRptCoilSelection->coilSelectionReportObj->setZoneLatentLoadCoolingIdealPeak( - iZone, ZoneCoolCompLoadTables(iZone).cells(LoadCompCol::Latent, LoadCompRow::GrdTot)); - - heatDesSelected = thisCalcFinalZoneSizing.HeatDDNum; - ZoneHeatCompLoadTables(iZone).desDayNum = heatDesSelected; - timeHeatMax = thisCalcFinalZoneSizing.TimeStepNumAtHeatMax; - ZoneHeatCompLoadTables(iZone).timeStepMax = timeHeatMax; - - GetDelaySequences(state, - heatDesSelected, - false, - iZone, - peopleDelaySeqHeat, - equipDelaySeqHeat, - hvacLossDelaySeqHeat, - powerGenDelaySeqHeat, - lightDelaySeqHeat, - feneSolarDelaySeqHeat, - ort->feneCondInstantSeq, - surfDelaySeqHeat); - ComputeTableBodyUsingMovingAvg(state, - ZoneHeatCompLoadTables(iZone).cells, - ZoneHeatCompLoadTables(iZone).cellUsed, - heatDesSelected, - timeHeatMax, - iZone, - peopleDelaySeqHeat, - equipDelaySeqHeat, - hvacLossDelaySeqHeat, - powerGenDelaySeqHeat, - lightDelaySeqHeat, - feneSolarDelaySeqHeat, - ort->feneCondInstantSeq, - surfDelaySeqHeat); - CollectPeakZoneConditions(state, ZoneHeatCompLoadTables(iZone), heatDesSelected, timeHeatMax, iZone, false); - - // send latent load info to coil summary report - state.dataRptCoilSelection->coilSelectionReportObj->setZoneLatentLoadHeatingIdealPeak( - iZone, ZoneHeatCompLoadTables(iZone).cells(LoadCompCol::Latent, LoadCompRow::GrdTot)); - - AddAreaColumnForZone(iZone, ZoneComponentAreas, ZoneCoolCompLoadTables(iZone)); - AddAreaColumnForZone(iZone, ZoneComponentAreas, ZoneHeatCompLoadTables(iZone)); - - AddTotalRowsForLoadSummary(ZoneCoolCompLoadTables(iZone)); - AddTotalRowsForLoadSummary(ZoneHeatCompLoadTables(iZone)); - - ComputePeakDifference(ZoneCoolCompLoadTables(iZone)); - ComputePeakDifference(ZoneHeatCompLoadTables(iZone)); - - // We delay the potential application of SI to IP conversion and actual output until after both the - // AirLoopComponentLoadSummary and FacilityComponentLoadSummary have been processed because below we try to retrieve the info - // directly when the timestamp would match (cf #7356), and if we converted right now, we would apply the conversion twice + computeSpaceZoneCompLoads(state, + state.dataSize->CalcFinalZoneSizing(iZone), + ZoneCoolCompLoadTables(iZone), + ZoneHeatCompLoadTables(iZone), + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + ort->znCompLoads, + surfDelaySeq, + ZoneComponentAreas(iZone), + iZone); } } + // We delay the potential application of SI to IP conversion and actual output until after both the + // AirLoopComponentLoadSummary and FacilityComponentLoadSummary have been processed because below we try + // to retrieve the info directly when the timestamp would match (cf #7356), and if we converted right + // now, we would apply the conversion twice } // AirLoopComponentLoadSummary @@ -15267,30 +15137,30 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) coolDesSelected, true, iZone, - peopleDelaySeqCool, - equipDelaySeqCool, - hvacLossDelaySeqCool, - powerGenDelaySeqCool, - lightDelaySeqCool, - feneSolarDelaySeqCool, - ort->feneCondInstantSeq, - surfDelaySeqCool); + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + ort->znCompLoads, + surfDelaySeq); ComputeTableBodyUsingMovingAvg(state, airLoopZonesCoolCompLoadTables.cells, airLoopZonesCoolCompLoadTables.cellUsed, coolDesSelected, timeCoolMax, iZone, - peopleDelaySeqCool, - equipDelaySeqCool, - hvacLossDelaySeqCool, - powerGenDelaySeqCool, - lightDelaySeqCool, - feneSolarDelaySeqCool, - ort->feneCondInstantSeq, - surfDelaySeqCool); + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + ort->znCompLoads, + surfDelaySeq); CollectPeakZoneConditions(state, airLoopZonesCoolCompLoadTables, coolDesSelected, timeCoolMax, iZone, true); - AddAreaColumnForZone(iZone, ZoneComponentAreas, airLoopZonesCoolCompLoadTables); + AddAreaColumnForZone(ZoneComponentAreas(iZone), airLoopZonesCoolCompLoadTables); } if (ort->displayZoneComponentLoadSummary && (airLoopZonesHeatCompLoadTables.desDayNum == ZoneHeatCompLoadTables(iZone).desDayNum) && @@ -15304,30 +15174,30 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) heatDesSelected, false, iZone, - peopleDelaySeqHeat, - equipDelaySeqHeat, - hvacLossDelaySeqHeat, - powerGenDelaySeqHeat, - lightDelaySeqHeat, - feneSolarDelaySeqHeat, - ort->feneCondInstantSeq, - surfDelaySeqHeat); + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + ort->znCompLoads, + surfDelaySeq); ComputeTableBodyUsingMovingAvg(state, airLoopZonesHeatCompLoadTables.cells, airLoopZonesHeatCompLoadTables.cellUsed, heatDesSelected, timeHeatMax, iZone, - peopleDelaySeqHeat, - equipDelaySeqHeat, - hvacLossDelaySeqHeat, - powerGenDelaySeqHeat, - lightDelaySeqHeat, - feneSolarDelaySeqHeat, - ort->feneCondInstantSeq, - surfDelaySeqHeat); + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + ort->znCompLoads, + surfDelaySeq); CollectPeakZoneConditions(state, airLoopZonesHeatCompLoadTables, heatDesSelected, timeHeatMax, iZone, false); - AddAreaColumnForZone(iZone, ZoneComponentAreas, airLoopZonesHeatCompLoadTables); + AddAreaColumnForZone(ZoneComponentAreas(iZone), airLoopZonesHeatCompLoadTables); } } // combine the zones for each air loop @@ -15422,30 +15292,30 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) coolDesSelected, true, iZone, - peopleDelaySeqCool, - equipDelaySeqCool, - hvacLossDelaySeqCool, - powerGenDelaySeqCool, - lightDelaySeqCool, - feneSolarDelaySeqCool, - ort->feneCondInstantSeq, - surfDelaySeqCool); + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + ort->znCompLoads, + surfDelaySeq); ComputeTableBodyUsingMovingAvg(state, facilityZonesCoolCompLoadTables.cells, facilityZonesCoolCompLoadTables.cellUsed, coolDesSelected, timeCoolMax, iZone, - peopleDelaySeqCool, - equipDelaySeqCool, - hvacLossDelaySeqCool, - powerGenDelaySeqCool, - lightDelaySeqCool, - feneSolarDelaySeqCool, - ort->feneCondInstantSeq, - surfDelaySeqCool); + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + ort->znCompLoads, + surfDelaySeq); CollectPeakZoneConditions(state, facilityZonesCoolCompLoadTables, coolDesSelected, timeCoolMax, iZone, true); - AddAreaColumnForZone(iZone, ZoneComponentAreas, facilityZonesCoolCompLoadTables); + AddAreaColumnForZone(ZoneComponentAreas(iZone), facilityZonesCoolCompLoadTables); } facilityZonesCoolCompLoadTables.timeStepMax = timeCoolMax; facilityZonesCoolCompLoadTables.desDayNum = coolDesSelected; @@ -15459,30 +15329,30 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) heatDesSelected, false, iZone, - peopleDelaySeqHeat, - equipDelaySeqHeat, - hvacLossDelaySeqHeat, - powerGenDelaySeqHeat, - lightDelaySeqHeat, - feneSolarDelaySeqHeat, - ort->feneCondInstantSeq, - surfDelaySeqHeat); + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + ort->znCompLoads, + surfDelaySeq); ComputeTableBodyUsingMovingAvg(state, facilityZonesHeatCompLoadTables.cells, facilityZonesHeatCompLoadTables.cellUsed, heatDesSelected, timeHeatMax, iZone, - peopleDelaySeqHeat, - equipDelaySeqHeat, - hvacLossDelaySeqHeat, - powerGenDelaySeqHeat, - lightDelaySeqHeat, - feneSolarDelaySeqHeat, - ort->feneCondInstantSeq, - surfDelaySeqHeat); + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + ort->znCompLoads, + surfDelaySeq); CollectPeakZoneConditions(state, facilityZonesHeatCompLoadTables, heatDesSelected, timeHeatMax, iZone, false); - AddAreaColumnForZone(iZone, ZoneComponentAreas, facilityZonesHeatCompLoadTables); + AddAreaColumnForZone(ZoneComponentAreas(iZone), facilityZonesHeatCompLoadTables); } facilityZonesHeatCompLoadTables.timeStepMax = timeHeatMax; facilityZonesHeatCompLoadTables.desDayNum = heatDesSelected; @@ -15531,6 +15401,31 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) produceSQLite); } + // SpaceComponentLoadSummary: Now we convert and Display + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + if (ort->displayZoneComponentLoadSummary) { + for (int iSpace = 1; iSpace <= state.dataGlobal->numSpaces; ++iSpace) { + // Test if *zone* is controlled, not space, for sizing + if (!state.dataZoneEquip->ZoneEquipConfig(state.dataHeatBal->space(iSpace).zoneNum).IsControlled) continue; + if (allocated(state.dataSize->CalcFinalSpaceSizing)) { + LoadSummaryUnitConversion(state, SpaceCoolCompLoadTables(iSpace), unitsStyle_cur); + LoadSummaryUnitConversion(state, SpaceHeatCompLoadTables(iSpace), unitsStyle_cur); + + OutputCompLoadSummary(state, + OutputType::Space, + SpaceCoolCompLoadTables(iSpace), + SpaceHeatCompLoadTables(iSpace), + iSpace, + unitsStyle_cur, + produceTabular, + produceSQLite); + } + } + } + SpaceHeatCompLoadTables.deallocate(); + SpaceCoolCompLoadTables.deallocate(); + } + // ZoneComponentLoadSummary: Now we convert and Display if (ort->displayZoneComponentLoadSummary) { for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { @@ -15566,23 +15461,118 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) FacilityZonesHeatCompLoadTables.deallocate(); FacilityZonesCoolCompLoadTables.deallocate(); - peopleDelaySeqHeat.deallocate(); - peopleDelaySeqCool.deallocate(); - lightDelaySeqHeat.deallocate(); - lightDelaySeqCool.deallocate(); - equipDelaySeqHeat.deallocate(); - equipDelaySeqCool.deallocate(); - hvacLossDelaySeqHeat.deallocate(); - hvacLossDelaySeqCool.deallocate(); - powerGenDelaySeqHeat.deallocate(); - powerGenDelaySeqCool.deallocate(); - feneSolarDelaySeqHeat.deallocate(); - feneSolarDelaySeqCool.deallocate(); - surfDelaySeqHeat.deallocate(); - surfDelaySeqCool.deallocate(); + peopleDelaySeq.deallocate(); + lightDelaySeq.deallocate(); + equipDelaySeq.deallocate(); + hvacLossDelaySeq.deallocate(); + powerGenDelaySeq.deallocate(); + feneSolarDelaySeq.deallocate(); + surfDelaySeq.deallocate(); } } +void computeSpaceZoneCompLoads(EnergyPlusData &state, + DataSizing::ZoneSizingData const &calcFinalSizing, + CompLoadTablesType &coolCompLoadTables, + CompLoadTablesType &heatCompLoadTables, + Array1D &peopleDelaySeq, + Array1D &equipDelaySeq, + Array1D &hvacLossDelaySeq, + Array1D &powerGenDelaySeq, + Array1D &lightDelaySeq, + Array1D &feneSolarDelaySeq, + std::vector &szCompLoadLoc, + Array2D &surfDelaySeq, + ZompComponentAreasType &componentAreas, + int const iZone, + int const iSpace) +{ + int coolDesSelected = calcFinalSizing.CoolDDNum; + coolCompLoadTables.desDayNum = coolDesSelected; + int timeCoolMax = calcFinalSizing.TimeStepNumAtCoolMax; + coolCompLoadTables.timeStepMax = timeCoolMax; + + GetDelaySequences(state, + coolDesSelected, + true, + iZone, + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + szCompLoadLoc, + surfDelaySeq, + iSpace); + ComputeTableBodyUsingMovingAvg(state, + coolCompLoadTables.cells, + coolCompLoadTables.cellUsed, + coolDesSelected, + timeCoolMax, + iZone, + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + szCompLoadLoc, + surfDelaySeq, + iSpace); + CollectPeakZoneConditions(state, coolCompLoadTables, coolDesSelected, timeCoolMax, iZone, true, iSpace); + // send latent load info to coil summary report + state.dataRptCoilSelection->coilSelectionReportObj->setZoneLatentLoadCoolingIdealPeak( + iZone, coolCompLoadTables.cells(LoadCompCol::Latent, LoadCompRow::GrdTot)); + + int heatDesSelected = calcFinalSizing.HeatDDNum; + heatCompLoadTables.desDayNum = heatDesSelected; + int timeHeatMax = calcFinalSizing.TimeStepNumAtHeatMax; + heatCompLoadTables.timeStepMax = timeHeatMax; + + GetDelaySequences(state, + heatDesSelected, + false, + iZone, + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + szCompLoadLoc, + surfDelaySeq, + iSpace); + ComputeTableBodyUsingMovingAvg(state, + heatCompLoadTables.cells, + heatCompLoadTables.cellUsed, + heatDesSelected, + timeHeatMax, + iZone, + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + szCompLoadLoc, + surfDelaySeq, + iSpace); + CollectPeakZoneConditions(state, heatCompLoadTables, heatDesSelected, timeHeatMax, iZone, false, iSpace); + + // send latent load info to coil summary report + state.dataRptCoilSelection->coilSelectionReportObj->setZoneLatentLoadHeatingIdealPeak( + iZone, heatCompLoadTables.cells(LoadCompCol::Latent, LoadCompRow::GrdTot)); + + AddAreaColumnForZone(componentAreas, coolCompLoadTables); + AddAreaColumnForZone(componentAreas, heatCompLoadTables); + + AddTotalRowsForLoadSummary(coolCompLoadTables); + AddTotalRowsForLoadSummary(heatCompLoadTables); + + ComputePeakDifference(coolCompLoadTables); + ComputePeakDifference(heatCompLoadTables); +} // populate the delay sequence arrays for the component load summary table output void GetDelaySequences(EnergyPlusData &state, int const desDaySelected, @@ -15594,22 +15584,21 @@ void GetDelaySequences(EnergyPlusData &state, Array1D &powerGenDelaySeq, Array1D &lightDelaySeq, Array1D &feneSolarDelaySeq, - Array3D &feneCondInstantSeq, - Array2D &surfDelaySeq) + std::vector &szCompLoadLoc, + Array2D &surfDelaySeq, + int const iSpace) { // static bool initAdjFenDone(false); moved to anonymous namespace for unit testing auto &ort = state.dataOutRptTab; - - if (!ort->initAdjFenDone) { - state.dataOutRptTab->adjFenDone.allocate(state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, - state.dataGlobal->NumOfTimeStepInHour * 24, - state.dataGlobal->NumOfZones); - state.dataOutRptTab->adjFenDone = false; - ort->initAdjFenDone = true; - } + int const szNumMinus1 = (iSpace == 0) ? zoneIndex - 1 : iSpace - 1; // space or zone num minus 1 for vector + // reset to zero + surfDelaySeq = 0.0; if (desDaySelected != 0) { + auto const &surfCLDay = ort->surfCompLoads[desDaySelected - 1]; + auto const &enclCLDay = ort->enclCompLoads[desDaySelected - 1]; + auto &szCLDay = szCompLoadLoc[desDaySelected - 1]; Array2D decayCurve; if (isCooling) { @@ -15618,7 +15607,7 @@ void GetDelaySequences(EnergyPlusData &state, decayCurve = ort->decayCurveHeat; } - for (int kTimeStep = 1; kTimeStep <= state.dataGlobal->NumOfTimeStepInHour * 24; ++kTimeStep) { + for (int kTimeStep = 1; kTimeStep <= state.dataGlobal->TimeStepsInHour * Constant::iHoursInDay; ++kTimeStep) { Real64 peopleConvIntoZone = 0.0; Real64 equipConvIntoZone = 0.0; Real64 hvacLossConvIntoZone = 0.0; @@ -15630,10 +15619,10 @@ void GetDelaySequences(EnergyPlusData &state, // code from ComputeDelayedComponents starts for (int spaceNum : state.dataHeatBal->Zone(zoneIndex).spaceIndexes) { + if ((iSpace > 0) && (spaceNum != iSpace)) continue; auto const &thisSpace = state.dataHeatBal->space(spaceNum); for (int jSurf = thisSpace.HTSurfaceFirst; jSurf <= thisSpace.HTSurfaceLast; ++jSurf) { - int radEnclosureNum = state.dataSurface->Surface(jSurf).RadEnclIndex; - + int const radEnclosureNum = state.dataSurface->Surface(jSurf).RadEnclIndex; // for each time step, step back through time and apply decay curve to radiant heat for each end use absorbed in each surface Real64 peopleConvFromSurf = 0.0; Real64 equipConvFromSurf = 0.0; @@ -15645,17 +15634,19 @@ void GetDelaySequences(EnergyPlusData &state, for (int mStepBack = 1; mStepBack <= kTimeStep; ++mStepBack) { int sourceStep = kTimeStep - mStepBack + 1; - Real64 thisQRadThermInAbsMult = ort->TMULTseq(desDaySelected, sourceStep, radEnclosureNum) * - ort->ITABSFseq(desDaySelected, sourceStep, jSurf) * state.dataSurface->Surface(jSurf).Area * - decayCurve(mStepBack, jSurf); - peopleConvFromSurf += ort->peopleRadSeq(desDaySelected, sourceStep, zoneIndex) * thisQRadThermInAbsMult; - equipConvFromSurf += ort->equipRadSeq(desDaySelected, sourceStep, zoneIndex) * thisQRadThermInAbsMult; - hvacLossConvFromSurf += ort->hvacLossRadSeq(desDaySelected, sourceStep, zoneIndex) * thisQRadThermInAbsMult; - powerGenConvFromSurf += ort->powerGenRadSeq(desDaySelected, sourceStep, zoneIndex) * thisQRadThermInAbsMult; - lightLWConvFromSurf += ort->lightLWRadSeq(desDaySelected, sourceStep, zoneIndex) * thisQRadThermInAbsMult; + auto &compLoadTS = szCLDay.ts[sourceStep - 1].spacezone[szNumMinus1]; + auto const &surfCLDayTS = surfCLDay.ts[sourceStep - 1].surf[jSurf - 1]; + auto const &enclCLDayTS = enclCLDay.ts[sourceStep - 1].encl[radEnclosureNum - 1]; + Real64 thisQRadThermInAbsMult = + surfCLDayTS.TMULTseq * surfCLDayTS.ITABSFseq * state.dataSurface->Surface(jSurf).Area * decayCurve(mStepBack, jSurf); + peopleConvFromSurf += enclCLDayTS.peopleRadSeq * thisQRadThermInAbsMult; + equipConvFromSurf += enclCLDayTS.equipRadSeq * thisQRadThermInAbsMult; + hvacLossConvFromSurf += enclCLDayTS.hvacLossRadSeq * thisQRadThermInAbsMult; + powerGenConvFromSurf += enclCLDayTS.powerGenRadSeq * thisQRadThermInAbsMult; + lightLWConvFromSurf += enclCLDayTS.lightLWRadSeq * thisQRadThermInAbsMult; // short wave is already accumulated by surface - lightSWConvFromSurf += ort->lightSWRadSeq(desDaySelected, sourceStep, jSurf) * decayCurve(mStepBack, jSurf); - feneSolarConvFromSurf += ort->feneSolarRadSeq(desDaySelected, sourceStep, jSurf) * decayCurve(mStepBack, jSurf); + lightSWConvFromSurf += surfCLDayTS.lightSWRadSeq * decayCurve(mStepBack, jSurf); + feneSolarConvFromSurf += surfCLDayTS.feneSolarRadSeq * decayCurve(mStepBack, jSurf); } // for mStepBack peopleConvIntoZone += peopleConvFromSurf; @@ -15669,14 +15660,15 @@ void GetDelaySequences(EnergyPlusData &state, // determine the remaining convective heat from the surfaces that are not based // on any of these other loads // negative because heat from surface should be positive + auto &surfCLDaykTS = surfCLDay.ts[kTimeStep - 1].surf[jSurf - 1]; surfDelaySeq(kTimeStep, jSurf) = - -ort->loadConvectedNormal(desDaySelected, kTimeStep, jSurf) - ort->netSurfRadSeq(desDaySelected, kTimeStep, jSurf) - + -surfCLDaykTS.loadConvectedNormal - surfCLDaykTS.netSurfRadSeq - (peopleConvFromSurf + equipConvFromSurf + hvacLossConvFromSurf + powerGenConvFromSurf + lightLWConvFromSurf + lightSWConvFromSurf + feneSolarConvFromSurf); // remove net radiant for the surface - // also remove the net radiant component on the instanteous conduction for fenestration + // also remove the net radiant component on the instantaneous conduction for fenestration if (state.dataSurface->Surface(jSurf).Class == DataSurfaces::SurfaceClass::Window) { - adjFeneSurfNetRadSeq += ort->netSurfRadSeq(desDaySelected, kTimeStep, jSurf); + adjFeneSurfNetRadSeq += surfCLDaykTS.netSurfRadSeq; } } // for jSurf } @@ -15687,10 +15679,11 @@ void GetDelaySequences(EnergyPlusData &state, // combine short wave (visible) and long wave (thermal) impacts lightDelaySeq(kTimeStep) = lightLWConvIntoZone + lightSWConvIntoZone; feneSolarDelaySeq(kTimeStep) = feneSolarConvIntoZone; - // also remove the net radiant component on the instanteous conduction for fenestration - if (!state.dataOutRptTab->adjFenDone(desDaySelected, kTimeStep, zoneIndex)) { - feneCondInstantSeq(desDaySelected, kTimeStep, zoneIndex) -= adjFeneSurfNetRadSeq; - state.dataOutRptTab->adjFenDone(desDaySelected, kTimeStep, zoneIndex) = true; + // also remove the net radiant component on the instantaneous conduction for fenestration + auto &szCompLoadDayTS = szCLDay.ts[kTimeStep - 1].spacezone[szNumMinus1]; + if (!szCompLoadDayTS.adjFenDone) { + szCompLoadDayTS.feneCondInstantSeq -= adjFeneSurfNetRadSeq; + szCompLoadDayTS.adjFenDone = true; } } // for kTimeStep @@ -15712,8 +15705,9 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, Array1D const &powerGenDelaySeq, Array1D const &lightDelaySeq, Array1D const &feneSolarDelaySeq, - Array3D const &feneCondInstantSeq, - Array2D const &surfDelaySeq) + std::vector &szCompLoadLoc, + Array2D const &surfDelaySeq, + int const iSpace) { Array1D AvgData; // sequence data to be averaging Array1D delayOpaque; // hold values for report for delayed opaque @@ -15721,16 +15715,23 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, resultCells = 0.; resCellsUsd = false; delayOpaque.allocate(LoadCompRow::GrdTot); - AvgData.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); + Real64 numTSinDay = state.dataGlobal->TimeStepsInHour * Constant::iHoursInDay; + AvgData.allocate(numTSinDay); + int const szNumMinus1 = (iSpace == 0) ? zoneIndex - 1 : iSpace - 1; // space or zone num minus 1 for vector if (desDaySelected != 0 && timeOfMax != 0) { // Don't update/average original array data // PEOPLE - AvgData = state.dataOutRptTab->peopleInstantSeq(desDaySelected, _, zoneIndex); + auto &compLoadDay = szCompLoadLoc[desDaySelected - 1]; + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].peopleInstantSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::People) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::People) = true; - AvgData = state.dataOutRptTab->peopleLatentSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].peopleLatentSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::Latent, LoadCompRow::People) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::Latent, LoadCompRow::People) = true; @@ -15740,11 +15741,15 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, resCellsUsd(LoadCompCol::SensDelay, LoadCompRow::People) = true; // LIGHTS - AvgData = state.dataOutRptTab->lightInstantSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].lightInstantSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::Lights) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::Lights) = true; - AvgData = state.dataOutRptTab->lightRetAirSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].lightRetAirSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensRA, LoadCompRow::Lights) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensRA, LoadCompRow::Lights) = true; @@ -15754,11 +15759,15 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, resCellsUsd(LoadCompCol::SensDelay, LoadCompRow::Lights) = true; // EQUIPMENT - AvgData = state.dataOutRptTab->equipInstantSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].equipInstantSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::Equip) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::Equip) = true; - AvgData = state.dataOutRptTab->equipLatentSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].equipLatentSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::Latent, LoadCompRow::Equip) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::Latent, LoadCompRow::Equip) = true; @@ -15768,31 +15777,43 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, resCellsUsd(LoadCompCol::SensDelay, LoadCompRow::Equip) = true; // REFRIGERATION EQUIPMENT - AvgData = state.dataOutRptTab->refrigInstantSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].refrigInstantSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::Refrig) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::Refrig) = true; - AvgData = state.dataOutRptTab->refrigRetAirSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].refrigRetAirSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensRA, LoadCompRow::Refrig) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensRA, LoadCompRow::Refrig) = true; - AvgData = state.dataOutRptTab->refrigLatentSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].refrigLatentSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::Latent, LoadCompRow::Refrig) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::Latent, LoadCompRow::Refrig) = true; // WATER USE EQUIPMENT - AvgData = state.dataOutRptTab->waterUseInstantSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].waterUseInstantSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::WaterUse) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::WaterUse) = true; - AvgData = state.dataOutRptTab->waterUseLatentSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].waterUseLatentSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::Latent, LoadCompRow::WaterUse) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::Latent, LoadCompRow::WaterUse) = true; // HVAC EQUIPMENT LOSSES - AvgData = state.dataOutRptTab->hvacLossInstantSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].hvacLossInstantSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::HvacLoss) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::HvacLoss) = true; @@ -15802,7 +15823,9 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, resCellsUsd(LoadCompCol::SensDelay, LoadCompRow::HvacLoss) = true; // POWER GENERATION EQUIPMENT - AvgData = state.dataOutRptTab->powerGenInstantSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].powerGenInstantSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::PowerGen) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::PowerGen) = true; @@ -15821,37 +15844,51 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, resCellsUsd(LoadCompCol::Latent, LoadCompRow::DOAS) = true; // INFILTRATION - AvgData = state.dataOutRptTab->infilInstantSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].infilInstantSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::Infil) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::Infil) = true; - AvgData = state.dataOutRptTab->infilLatentSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].infilLatentSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::Latent, LoadCompRow::Infil) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::Latent, LoadCompRow::Infil) = true; // ZONE VENTILATION - AvgData = state.dataOutRptTab->zoneVentInstantSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].zoneVentInstantSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::ZoneVent) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::ZoneVent) = true; - AvgData = state.dataOutRptTab->zoneVentLatentSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].zoneVentLatentSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::Latent, LoadCompRow::ZoneVent) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::Latent, LoadCompRow::ZoneVent) = true; // INTERZONE MIXING - AvgData = state.dataOutRptTab->interZoneMixInstantSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].interZoneMixInstantSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::IntZonMix) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::IntZonMix) = true; - AvgData = state.dataOutRptTab->interZoneMixLatentSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].interZoneMixLatentSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::Latent, LoadCompRow::IntZonMix) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::Latent, LoadCompRow::IntZonMix) = true; // FENESTRATION CONDUCTION - AvgData = feneCondInstantSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].feneCondInstantSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::FeneCond) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::FeneCond) = true; @@ -15956,16 +15993,23 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, } // for the load summary report add values the peak conditions subtable -void CollectPeakZoneConditions( - EnergyPlusData &state, CompLoadTablesType &compLoad, int const desDaySelected, int const timeOfMax, int const zoneIndex, bool const isCooling) +void CollectPeakZoneConditions(EnergyPlusData &state, + CompLoadTablesType &compLoad, + int const desDaySelected, + int const timeOfMax, + int const zoneIndex, + bool const isCooling, + int const spaceIndex) { if (timeOfMax != 0) { auto const &thisZone = state.dataHeatBal->Zone(zoneIndex); - auto const &thisCalcFinalZoneSizing = state.dataSize->CalcFinalZoneSizing(zoneIndex); - Real64 mult = thisZone.Multiplier * thisZone.ListMultiplier; + auto const &szCalcFinalSizing = + (spaceIndex == 0) ? state.dataSize->CalcFinalZoneSizing(zoneIndex) : state.dataSize->CalcFinalSpaceSizing(spaceIndex); + auto const &szFinalSizing = (spaceIndex == 0) ? state.dataSize->FinalZoneSizing(zoneIndex) : state.dataSize->FinalSpaceSizing(spaceIndex); + if (mult == 0.0) mult = 1.0; if (isCooling) { @@ -15976,53 +16020,49 @@ void CollectPeakZoneConditions( state.dataWeather->DesDayInput(desDaySelected).DayOfMonth, state.dataRptCoilSelection->coilSelectionReportObj->getTimeText(state, timeOfMax)); } else { - compLoad.peakDateHrMin = thisCalcFinalZoneSizing.CoolPeakDateHrMin; + compLoad.peakDateHrMin = szCalcFinalSizing.CoolPeakDateHrMin; } // Outside Dry Bulb Temperature - compLoad.outsideDryBulb = thisCalcFinalZoneSizing.CoolOutTempSeq(timeOfMax); + compLoad.outsideDryBulb = szCalcFinalSizing.CoolOutTempSeq(timeOfMax); // Outside Wet Bulb Temperature // use standard air pressure because air pressure is not tracked with sizing data - if (thisCalcFinalZoneSizing.CoolOutHumRatSeq(timeOfMax) < 1.0 && thisCalcFinalZoneSizing.CoolOutHumRatSeq(timeOfMax) > 0.0) { - compLoad.outsideWetBulb = Psychrometrics::PsyTwbFnTdbWPb(state, - thisCalcFinalZoneSizing.CoolOutTempSeq(timeOfMax), - thisCalcFinalZoneSizing.CoolOutHumRatSeq(timeOfMax), - state.dataEnvrn->StdBaroPress); + if (szCalcFinalSizing.CoolOutHumRatSeq(timeOfMax) < 1.0 && szCalcFinalSizing.CoolOutHumRatSeq(timeOfMax) > 0.0) { + compLoad.outsideWetBulb = Psychrometrics::PsyTwbFnTdbWPb( + state, szCalcFinalSizing.CoolOutTempSeq(timeOfMax), szCalcFinalSizing.CoolOutHumRatSeq(timeOfMax), state.dataEnvrn->StdBaroPress); } // Outside Humidity Ratio at Peak - compLoad.outsideHumRatio = thisCalcFinalZoneSizing.CoolOutHumRatSeq(timeOfMax); + compLoad.outsideHumRatio = szCalcFinalSizing.CoolOutHumRatSeq(timeOfMax); // Zone Dry Bulb Temperature - compLoad.zoneDryBulb = thisCalcFinalZoneSizing.CoolZoneTempSeq(timeOfMax); + compLoad.zoneDryBulb = szCalcFinalSizing.CoolZoneTempSeq(timeOfMax); - // Zone Relative Humdity + // Zone Relative Humidity // use standard air pressure because air pressure is not tracked with sizing data - compLoad.zoneRelHum = Psychrometrics::PsyRhFnTdbWPb(state, - thisCalcFinalZoneSizing.CoolZoneTempSeq(timeOfMax), - thisCalcFinalZoneSizing.CoolZoneHumRatSeq(timeOfMax), - state.dataEnvrn->StdBaroPress); + compLoad.zoneRelHum = Psychrometrics::PsyRhFnTdbWPb( + state, szCalcFinalSizing.CoolZoneTempSeq(timeOfMax), szCalcFinalSizing.CoolZoneHumRatSeq(timeOfMax), state.dataEnvrn->StdBaroPress); // Zone Humidity Ratio at Peak - compLoad.zoneHumRatio = thisCalcFinalZoneSizing.CoolZoneHumRatSeq(timeOfMax); + compLoad.zoneHumRatio = szCalcFinalSizing.CoolZoneHumRatSeq(timeOfMax); // Peak Design Sensible Load - compLoad.peakDesSensLoad = thisCalcFinalZoneSizing.DesCoolLoad / mult; // change sign + compLoad.peakDesSensLoad = szCalcFinalSizing.DesCoolLoad / mult; // change sign // Design Peak Load - compLoad.designPeakLoad = state.dataSize->FinalZoneSizing(zoneIndex).DesCoolLoad / mult; + compLoad.designPeakLoad = szFinalSizing.DesCoolLoad / mult; // Supply air temperature - if (thisCalcFinalZoneSizing.ZnCoolDgnSAMethod == DataSizing::SupplyAirTemperature) { - compLoad.supAirTemp = thisCalcFinalZoneSizing.CoolDesTemp; + if (szCalcFinalSizing.ZnCoolDgnSAMethod == DataSizing::SupplyAirTemperature) { + compLoad.supAirTemp = szCalcFinalSizing.CoolDesTemp; } else { - Real64 DeltaTemp = -std::abs(thisCalcFinalZoneSizing.CoolDesTempDiff); - compLoad.supAirTemp = DeltaTemp + thisCalcFinalZoneSizing.ZoneTempAtCoolPeak; + Real64 DeltaTemp = -std::abs(szCalcFinalSizing.CoolDesTempDiff); + compLoad.supAirTemp = DeltaTemp + szCalcFinalSizing.ZoneTempAtCoolPeak; } // Main fan air flow - compLoad.mainFanAirFlow = thisCalcFinalZoneSizing.DesCoolVolFlow; + compLoad.mainFanAirFlow = szCalcFinalSizing.DesCoolVolFlow; } else { // Time of Peak Load @@ -16032,57 +16072,53 @@ void CollectPeakZoneConditions( state.dataWeather->DesDayInput(desDaySelected).DayOfMonth, state.dataRptCoilSelection->coilSelectionReportObj->getTimeText(state, timeOfMax)); } else { - compLoad.peakDateHrMin = thisCalcFinalZoneSizing.HeatPeakDateHrMin; + compLoad.peakDateHrMin = szCalcFinalSizing.HeatPeakDateHrMin; } // Outside Dry Bulb Temperature - compLoad.outsideDryBulb = thisCalcFinalZoneSizing.HeatOutTempSeq(timeOfMax); + compLoad.outsideDryBulb = szCalcFinalSizing.HeatOutTempSeq(timeOfMax); // Outside Wet Bulb Temperature // use standard air pressure because air pressure is not tracked with sizing data - if (thisCalcFinalZoneSizing.HeatOutHumRatSeq(timeOfMax) < 1.0 && thisCalcFinalZoneSizing.HeatOutHumRatSeq(timeOfMax) > 0.0) { - compLoad.outsideWetBulb = Psychrometrics::PsyTwbFnTdbWPb(state, - thisCalcFinalZoneSizing.HeatOutTempSeq(timeOfMax), - thisCalcFinalZoneSizing.HeatOutHumRatSeq(timeOfMax), - state.dataEnvrn->StdBaroPress); + if (szCalcFinalSizing.HeatOutHumRatSeq(timeOfMax) < 1.0 && szCalcFinalSizing.HeatOutHumRatSeq(timeOfMax) > 0.0) { + compLoad.outsideWetBulb = Psychrometrics::PsyTwbFnTdbWPb( + state, szCalcFinalSizing.HeatOutTempSeq(timeOfMax), szCalcFinalSizing.HeatOutHumRatSeq(timeOfMax), state.dataEnvrn->StdBaroPress); } // Outside Humidity Ratio at Peak - compLoad.outsideHumRatio = thisCalcFinalZoneSizing.HeatOutHumRatSeq(timeOfMax); + compLoad.outsideHumRatio = szCalcFinalSizing.HeatOutHumRatSeq(timeOfMax); // Zone Dry Bulb Temperature - compLoad.zoneDryBulb = thisCalcFinalZoneSizing.HeatZoneTempSeq(timeOfMax); + compLoad.zoneDryBulb = szCalcFinalSizing.HeatZoneTempSeq(timeOfMax); - // Zone Relative Humdity + // Zone Relative Humidity // use standard air pressure because air pressure is not tracked with sizing data - compLoad.zoneRelHum = Psychrometrics::PsyRhFnTdbWPb(state, - thisCalcFinalZoneSizing.HeatZoneTempSeq(timeOfMax), - thisCalcFinalZoneSizing.HeatZoneHumRatSeq(timeOfMax), - state.dataEnvrn->StdBaroPress); + compLoad.zoneRelHum = Psychrometrics::PsyRhFnTdbWPb( + state, szCalcFinalSizing.HeatZoneTempSeq(timeOfMax), szCalcFinalSizing.HeatZoneHumRatSeq(timeOfMax), state.dataEnvrn->StdBaroPress); // Zone Humidity Ratio at Peak - compLoad.zoneHumRatio = thisCalcFinalZoneSizing.HeatZoneHumRatSeq(timeOfMax); + compLoad.zoneHumRatio = szCalcFinalSizing.HeatZoneHumRatSeq(timeOfMax); // Peak Design Sensible Load - compLoad.peakDesSensLoad = -thisCalcFinalZoneSizing.DesHeatLoad / mult; // change sign + compLoad.peakDesSensLoad = -szCalcFinalSizing.DesHeatLoad / mult; // change sign // Design Peak Load - compLoad.designPeakLoad = -state.dataSize->FinalZoneSizing(zoneIndex).DesHeatLoad / mult; + compLoad.designPeakLoad = -szFinalSizing.DesHeatLoad / mult; // Supply air temperature - if (thisCalcFinalZoneSizing.ZnHeatDgnSAMethod == DataSizing::SupplyAirTemperature) { - compLoad.supAirTemp = thisCalcFinalZoneSizing.HeatDesTemp; + if (szCalcFinalSizing.ZnHeatDgnSAMethod == DataSizing::SupplyAirTemperature) { + compLoad.supAirTemp = szCalcFinalSizing.HeatDesTemp; } else { - Real64 DeltaTemp = -std::abs(thisCalcFinalZoneSizing.HeatDesTempDiff); - compLoad.supAirTemp = DeltaTemp + thisCalcFinalZoneSizing.ZoneTempAtHeatPeak; + Real64 DeltaTemp = -std::abs(szCalcFinalSizing.HeatDesTempDiff); + compLoad.supAirTemp = DeltaTemp + szCalcFinalSizing.ZoneTempAtHeatPeak; } // Main fan air flow - compLoad.mainFanAirFlow = thisCalcFinalZoneSizing.DesHeatVolFlow; + compLoad.mainFanAirFlow = szCalcFinalSizing.DesHeatVolFlow; } // Outside air flow - compLoad.outsideAirFlow = thisCalcFinalZoneSizing.MinOA; + compLoad.outsideAirFlow = szCalcFinalSizing.MinOA; // outside air % if (compLoad.mainFanAirFlow != 0.) { @@ -16107,12 +16143,22 @@ void CollectPeakZoneConditions( } // Number of people - Real64 const totNumPeople = std::accumulate(state.dataHeatBal->People.cbegin(), - state.dataHeatBal->People.cend(), - 0.0, - [&zoneIndex](const Real64 &sum, const DataHeatBalance::PeopleData &people) { - return zoneIndex == people.ZonePtr ? (sum + people.NumberOfPeople) : sum; - }); + Real64 totNumPeople = 0; + if (spaceIndex == 0) { + totNumPeople = std::accumulate(state.dataHeatBal->People.cbegin(), + state.dataHeatBal->People.cend(), + 0.0, + [&zoneIndex](const Real64 &sum, const DataHeatBalance::PeopleData &people) { + return zoneIndex == people.ZonePtr ? (sum + people.NumberOfPeople) : sum; + }); + } else { + totNumPeople = std::accumulate(state.dataHeatBal->People.cbegin(), + state.dataHeatBal->People.cend(), + 0.0, + [&spaceIndex](const Real64 &sum, const DataHeatBalance::PeopleData &people) { + return spaceIndex == people.spaceIndex ? (sum + people.NumberOfPeople) : sum; + }); + } compLoad.numPeople = totNumPeople; } } @@ -16141,118 +16187,137 @@ void ComputeEngineeringChecks(CompLoadTablesType &compLoad) } // gather the areas used in the load component tables -void GetZoneComponentAreas(EnergyPlusData &state, Array1D &areas) +void GetZoneComponentAreas(EnergyPlusData &state, Array1D &znAreas, Array1D &spAreas) { - using namespace DataSurfaces; - for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { - areas(iZone).floor = state.dataHeatBal->Zone(iZone).FloorArea; + znAreas(iZone).floor = state.dataHeatBal->Zone(iZone).FloorArea; + } + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + for (int iSpace = 1; iSpace <= state.dataGlobal->numSpaces; ++iSpace) { + spAreas(iSpace).floor = state.dataHeatBal->space(iSpace).FloorArea; + } } + bool isZone = true; for (auto const &curSurface : state.dataSurface->Surface) { - if (!curSurface.HeatTransSurf) { - continue; - } - bool isExterior = curSurface.ExtBoundCond == ExternalEnvironment || curSurface.ExtBoundCond == OtherSideCondModeledExt; - bool isTouchingGround = - curSurface.ExtBoundCond == Ground || curSurface.ExtBoundCond == GroundFCfactorMethod || curSurface.ExtBoundCond == KivaFoundation; - int curZoneIndex = curSurface.Zone; - // ZoneData curZone = Zone(curSurface.Zone); - if (curSurface.Class == SurfaceClass::Wall) { - if (isExterior) { - areas(curZoneIndex).extWall += curSurface.GrossArea; - } else if (isTouchingGround) { - areas(curZoneIndex).grndCntWall += curSurface.GrossArea; - } else { - areas(curZoneIndex).intZoneWall += curSurface.GrossArea; - } - } else if (curSurface.Class == SurfaceClass::Roof) { - if (isExterior) { - areas(curZoneIndex).roof += curSurface.GrossArea; - } else { - areas(curZoneIndex).ceiling += curSurface.GrossArea; - } - } else if (curSurface.Class == SurfaceClass::Floor) { - if (isExterior) { - areas(curZoneIndex).extFloor += curSurface.GrossArea; - } else if (isTouchingGround) { - areas(curZoneIndex).grndCntFloor += curSurface.GrossArea; - } else { - areas(curZoneIndex).intZoneFloor += curSurface.GrossArea; - } - } else if (curSurface.Class == SurfaceClass::Window || curSurface.Class == SurfaceClass::TDD_Dome) { - areas(curZoneIndex).fenestration += curSurface.GrossArea; - } else if (curSurface.Class == SurfaceClass::Door || curSurface.Class == SurfaceClass::GlassDoor) { - areas(curZoneIndex).door += curSurface.GrossArea; + if (!curSurface.HeatTransSurf) continue; + addSurfaceArea(curSurface, znAreas, isZone); + } + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + isZone = false; + for (auto const &curSurface : state.dataSurface->Surface) { + addSurfaceArea(curSurface, spAreas, isZone); + } + } +} +void addSurfaceArea(DataSurfaces::SurfaceData const &surf, Array1D &areas, bool isZone) +{ + bool isExterior = surf.ExtBoundCond == DataSurfaces::ExternalEnvironment || surf.ExtBoundCond == DataSurfaces::OtherSideCondModeledExt; + bool isTouchingGround = surf.ExtBoundCond == DataSurfaces::Ground || surf.ExtBoundCond == DataSurfaces::GroundFCfactorMethod || + surf.ExtBoundCond == DataSurfaces::KivaFoundation; + int curIndex = (isZone) ? surf.Zone : surf.spaceNum; + switch (surf.Class) { + case DataSurfaces::SurfaceClass::Wall: { + if (isExterior) { + areas(curIndex).extWall += surf.GrossArea; + } else if (isTouchingGround) { + areas(curIndex).grndCntWall += surf.GrossArea; + } else { + areas(curIndex).intZoneWall += surf.GrossArea; + } + } break; + case DataSurfaces::SurfaceClass::Roof: { + if (isExterior) { + areas(curIndex).roof += surf.GrossArea; + } else { + areas(curIndex).ceiling += surf.GrossArea; + } + } break; + case DataSurfaces::SurfaceClass::Floor: { + if (isExterior) { + areas(curIndex).extFloor += surf.GrossArea; + } else if (isTouchingGround) { + areas(curIndex).grndCntFloor += surf.GrossArea; + } else { + areas(curIndex).intZoneFloor += surf.GrossArea; } + } break; + case DataSurfaces::SurfaceClass::Window: + case DataSurfaces::SurfaceClass::TDD_Dome: { + areas(curIndex).fenestration += surf.GrossArea; + } break; + case DataSurfaces::SurfaceClass::Door: + case DataSurfaces::SurfaceClass::GlassDoor: { + areas(curIndex).door += surf.GrossArea; + } break; } } // adds the area column for the load component tables -void AddAreaColumnForZone(int const zoneNum, Array1D const &compAreas, CompLoadTablesType &compLoad) +void AddAreaColumnForZone(ZompComponentAreasType const &compAreas, CompLoadTablesType &compLoad) { - compLoad.cells(LoadCompCol::Area, LoadCompRow::People) = compAreas(zoneNum).floor; + compLoad.cells(LoadCompCol::Area, LoadCompRow::People) = compAreas.floor; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::People) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::Lights) = compAreas(zoneNum).floor; + compLoad.cells(LoadCompCol::Area, LoadCompRow::Lights) = compAreas.floor; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::Lights) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::Equip) = compAreas(zoneNum).floor; + compLoad.cells(LoadCompCol::Area, LoadCompRow::Equip) = compAreas.floor; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::Equip) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::Refrig) = compAreas(zoneNum).floor; + compLoad.cells(LoadCompCol::Area, LoadCompRow::Refrig) = compAreas.floor; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::Refrig) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::WaterUse) = compAreas(zoneNum).floor; + compLoad.cells(LoadCompCol::Area, LoadCompRow::WaterUse) = compAreas.floor; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::WaterUse) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::Infil) = compAreas(zoneNum).extWall; + compLoad.cells(LoadCompCol::Area, LoadCompRow::Infil) = compAreas.extWall; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::Infil) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::Roof) = compAreas(zoneNum).roof; + compLoad.cells(LoadCompCol::Area, LoadCompRow::Roof) = compAreas.roof; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::Roof) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::IntZonCeil) = compAreas(zoneNum).ceiling; + compLoad.cells(LoadCompCol::Area, LoadCompRow::IntZonCeil) = compAreas.ceiling; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::IntZonCeil) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::OtherRoof) = compAreas(zoneNum).roof; + compLoad.cells(LoadCompCol::Area, LoadCompRow::OtherRoof) = compAreas.roof; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::OtherRoof) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::ExtWall) = compAreas(zoneNum).extWall; + compLoad.cells(LoadCompCol::Area, LoadCompRow::ExtWall) = compAreas.extWall; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::ExtWall) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::IntZonWall) = compAreas(zoneNum).intZoneWall; + compLoad.cells(LoadCompCol::Area, LoadCompRow::IntZonWall) = compAreas.intZoneWall; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::IntZonWall) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::GrdWall) = compAreas(zoneNum).grndCntWall; + compLoad.cells(LoadCompCol::Area, LoadCompRow::GrdWall) = compAreas.grndCntWall; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::GrdWall) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::OtherWall) = compAreas(zoneNum).extWall; + compLoad.cells(LoadCompCol::Area, LoadCompRow::OtherWall) = compAreas.extWall; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::OtherWall) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::ExtFlr) = compAreas(zoneNum).extFloor; + compLoad.cells(LoadCompCol::Area, LoadCompRow::ExtFlr) = compAreas.extFloor; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::ExtFlr) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::IntZonFlr) = compAreas(zoneNum).intZoneFloor; + compLoad.cells(LoadCompCol::Area, LoadCompRow::IntZonFlr) = compAreas.intZoneFloor; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::IntZonFlr) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::GrdFlr) = compAreas(zoneNum).grndCntFloor; + compLoad.cells(LoadCompCol::Area, LoadCompRow::GrdFlr) = compAreas.grndCntFloor; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::GrdFlr) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::OtherFlr) = compAreas(zoneNum).intZoneFloor; + compLoad.cells(LoadCompCol::Area, LoadCompRow::OtherFlr) = compAreas.intZoneFloor; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::OtherFlr) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::FeneCond) = compAreas(zoneNum).fenestration; + compLoad.cells(LoadCompCol::Area, LoadCompRow::FeneCond) = compAreas.fenestration; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::FeneCond) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::FeneSolr) = compAreas(zoneNum).fenestration; + compLoad.cells(LoadCompCol::Area, LoadCompRow::FeneSolr) = compAreas.fenestration; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::FeneSolr) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::OpqDoor) = compAreas(zoneNum).door; + compLoad.cells(LoadCompCol::Area, LoadCompRow::OpqDoor) = compAreas.door; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::OpqDoor) = true; } -// Used for the AirLoop and Facility level load component tables to sum the results from invidual zones +// Used for the AirLoop and Facility level load component tables to sum the results from individual zones void CombineLoadCompResults(CompLoadTablesType &compLoadTotal, CompLoadTablesType const &compLoadPartial, Real64 const multiplier) { // sum the main results @@ -16408,7 +16473,7 @@ void LoadSummaryUnitConversion(EnergyPlusData &state, CompLoadTablesType &compLo compLoadTotal.cndPumpPerFlow *= powerPerFlowLiquidConversion; } -// Jan 2021: Overloaded the function with addtional parameters for dual units; +// Jan 2021: Overloaded the function with additional parameters for dual units; // used overloading since the original function was checked in an existing test unit. // apply unit conversions to the load components summary tables void LoadSummaryUnitConversion(EnergyPlusData &state, CompLoadTablesType &compLoadTotal, UnitsStyle unitsStyle_para) @@ -16467,7 +16532,7 @@ void LoadSummaryUnitConversion(EnergyPlusData &state, CompLoadTablesType &compLo } // make a list of the zones for the airloop component loads report -void CreateListOfZonesForAirLoop(EnergyPlusData &state, CompLoadTablesType &compLoad, Array1D_int const &zoneToAirLoop, int const curAirLoop) +void CreateListOfZonesForAirLoop(EnergyPlusData const &state, CompLoadTablesType &compLoad, Array1D_int const &zoneToAirLoop, int const curAirLoop) { int counter = 0; for (int zi = 1; zi <= state.dataGlobal->NumOfZones; ++zi) { @@ -16496,7 +16561,11 @@ void OutputCompLoadSummary(EnergyPlusData &state, std::string zoneAirLoopFacilityName; bool writeOutput = false; - if (kind == OutputType::Zone && ort->displayZoneComponentLoadSummary) { + if (kind == OutputType::Space && ort->displayZoneComponentLoadSummary) { + reportName = "Space Component Load Summary"; + zoneAirLoopFacilityName = state.dataHeatBal->space(zoneOrAirLoopIndex).Name; + writeOutput = true; + } else if (kind == OutputType::Zone && ort->displayZoneComponentLoadSummary) { reportName = "Zone Component Load Summary"; zoneAirLoopFacilityName = state.dataHeatBal->Zone(zoneOrAirLoopIndex).Name; writeOutput = true; @@ -16684,7 +16753,7 @@ void OutputCompLoadSummary(EnergyPlusData &state, tableBody(1, 3) = RealToStr(curCompLoad.outsideWetBulb, 2); // Outside Wet Bulb Temperature tableBody(1, 4) = RealToStr(curCompLoad.outsideHumRatio, 5); // Outside Humidity Ratio at Peak tableBody(1, 5) = RealToStr(curCompLoad.zoneDryBulb, 2); // Zone Dry Bulb Temperature - tableBody(1, 6) = RealToStr(100 * curCompLoad.zoneRelHum, 2); // Zone Relative Humdity + tableBody(1, 6) = RealToStr(100 * curCompLoad.zoneRelHum, 2); // Zone Relative Humidity tableBody(1, 7) = RealToStr(curCompLoad.zoneHumRatio, 5); // Zone Humidity Ratio at Peak } tableBody(1, 8) = RealToStr(curCompLoad.supAirTemp, 2); // supply air temperature @@ -16735,7 +16804,7 @@ void OutputCompLoadSummary(EnergyPlusData &state, rowHead(4) = "Floor Area per Total Capacity [m2/W]"; rowHead(5) = "Total Capacity per Floor Area [W/m2]"; // rowHead( 6 ) = "Chiller Pump Power per Flow [W-s/m3]"; // facility only - // rowHead( 7 ) = "Condenser Pump Power per Flor [W-s/m3]"; // facility only + // rowHead( 7 ) = "Condenser Pump Power per Flow [W-s/m3]"; // facility only rowHead(6) = "Number of People"; } else { rowHead(1) = "Outside Air Fraction [fraction]"; @@ -17025,10 +17094,10 @@ void WriteTable(EnergyPlusData &state, int rowsRowLabels = isize(rowLabels); int colsColumnLabels = isize(columnLabels); int const colsWidthColumn = isize(widthColumn); - // check size of arrays for consistancy and if inconsistent use smaller value + // check size of arrays for consistency and if inconsistent use smaller value // and display warning if (rowsBody != rowsRowLabels) { - ShowWarningError(state, "REPORT:TABLE Inconsistant number of rows."); + ShowWarningError(state, "REPORT:TABLE Inconsistent number of rows."); rowsBody = min(rowsBody, rowsRowLabels); rowsRowLabels = rowsBody; } @@ -17043,7 +17112,7 @@ void WriteTable(EnergyPlusData &state, rowUnitStrings.allocate(rowsBody); columnUnitStrings.allocate(colsBody); bodyEsc.allocate(colsBody, rowsBody); - // create new array to hold multiple line column lables + // create new array to hold multiple line column labels colLabelMulti.allocate(colsColumnLabels, 50); colLabelMulti = blank; // set array to blank int maxNumColLabelRows = 0; @@ -17187,7 +17256,7 @@ void WriteTable(EnergyPlusData &state, // end the table tbl_stream << "\n"; if (!footnoteText.empty()) { - tbl_stream << fmt::format("{}\n", footnoteText); + tbl_stream << fmt::format("
{}
\n", footnoteText); } tbl_stream << "

\n"; } else if (thisStyle == TableStyle::XML) { @@ -17315,7 +17384,11 @@ void WriteTable(EnergyPlusData &state, } } if (!footnoteText.empty()) { - tbl_stream << fmt::format(" {}\n", footnoteText); + if (footnoteText.find("\n", footnoteText); + } else { + tbl_stream << fmt::format(" {}\n", footnoteText); + } } } } else { @@ -17744,13 +17817,13 @@ void ResetMonthlyGathering(EnergyPlusData &state) } } -void ResetBinGathering(EnergyPlusData &state) +void ResetBinGathering(EnergyPlusData const &state) { // Jason Glazer - October 2015 // Reset all timebins gathering arrays to zero for multi-year simulations // so that only last year is reported in tabular reports Real64 constexpr bigVal(0.0); // used with HUGE: Value doesn't matter, only type: Initialize so compiler doesn't warn about use uninitialized - auto &ort = state.dataOutRptTab; + auto const &ort = state.dataOutRptTab; // clear the binning arrays to zeros for (auto &e : ort->BinResults) { @@ -17776,12 +17849,12 @@ void ResetBinGathering(EnergyPlusData &state) } } -void ResetBEPSGathering(EnergyPlusData &state) +void ResetBEPSGathering(EnergyPlusData const &state) { // Jason Glazer - October 2015 // Reset all ABUPS gathering arrays to zero for multi-year simulations // so that only last year is reported in tabular reports - auto &ort = state.dataOutRptTab; + auto const &ort = state.dataOutRptTab; ort->gatherTotalsBEPS = 0.0; ort->gatherEndUseBEPS = 0.0; ort->gatherEndUseSubBEPS = 0.0; @@ -17809,22 +17882,22 @@ void ResetBEPSGathering(EnergyPlusData &state) ort->gatherWaterEndUseTotal = 0.0; } -void ResetSourceEnergyEndUseGathering(EnergyPlusData &state) +void ResetSourceEnergyEndUseGathering(EnergyPlusData const &state) { // Jason Glazer - October 2015 // Reset all source energy end use table gathering arrays to zero for multi-year simulations // so that only last year is reported in tabular reports - auto &ort = state.dataOutRptTab; + auto const &ort = state.dataOutRptTab; ort->gatherTotalsBySourceBEPS = 0.0; ort->gatherEndUseBySourceBEPS = 0.0; } -void ResetPeakDemandGathering(EnergyPlusData &state) +void ResetPeakDemandGathering(EnergyPlusData const &state) { // Jason Glazer - October 2015 // Reset all demand end use components table gathering arrays to zero for multi-year simulations // so that only last year is reported in tabular reports - auto &ort = state.dataOutRptTab; + auto const &ort = state.dataOutRptTab; ort->gatherDemandTotal = 0.0; ort->gatherDemandTimeStamp = 0; ort->gatherDemandEndUse = 0.0; @@ -18973,7 +19046,7 @@ Real64 ConvertIPdelta(EnergyPlusData &state, int const unitConvIndex, Real64 con // PURPOSE OF THIS SUBROUTINE: // Apply the selected unit conversion to the input value // expressed in SI units to result in IP units. This routine - // only uses the mulitplier and NOT the offset and is appropriate + // only uses the multiplier and NOT the offset and is appropriate // when the number being converted is a difference or delta // between values (such as a temperature difference). @@ -19025,7 +19098,7 @@ void GetUnitConversion(EnergyPlusData &state, int const unitConvIndex, Real64 &m // PURPOSE OF THIS SUBROUTINE: // Return of the multiplier and adder for the given // SI to IP unit conversion. - // SI = (IP * multipier) + offset + // SI = (IP * multiplier) + offset // This function could be replaced by referencing the // array directly but does include some checking of the // bounds of the array. @@ -19078,7 +19151,7 @@ Real64 getSpecificUnitMultiplier(EnergyPlusData &state, std::string const &SIuni // SI to IP unit conversion. No offset is provided so // it cannot be used to convert units such as temperatures // that include an offset. - // SI = (IP * multipier) + offset + // SI = (IP * multiplier) + offset // Unlike LookupSItoIP, this function does not expect more // the units in the two input parameters. No hints or // defaults are used since both the SI and IP units are @@ -19140,7 +19213,7 @@ Real64 getSpecificUnitDivider(EnergyPlusData &state, std::string const &SIunit, // SI to IP unit conversion. No offset is provided so // it cannot be used to convert units such as temperatures // that include an offset. - // SI = (IP * multipier) + offset + // SI = (IP * multiplier) + offset // Unlike LookupSItoIP, this function does not expect more // the units in the two input parameters. No hints or // defaults are used since both the SI and IP units are diff --git a/src/EnergyPlus/OutputReportTabular.hh b/src/EnergyPlus/OutputReportTabular.hh index e0b30a2a535..4f59e784cd7 100644 --- a/src/EnergyPlus/OutputReportTabular.hh +++ b/src/EnergyPlus/OutputReportTabular.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -65,6 +65,7 @@ #include #include #include +#include #include #include #include @@ -198,6 +199,7 @@ namespace OutputReportTabular { enum class OutputType { Invalid = -1, + Space, Zone, AirLoop, Facility, @@ -269,8 +271,7 @@ namespace OutputReportTabular { OutputProcessor::StoreType avgSum = OutputProcessor::StoreType::Average; // Variable is Averaged=1 or Summed=2 OutputProcessor::TimeStepType stepType = OutputProcessor::TimeStepType::Zone; // Variable time step is Zone=1 or HVAC=2 Constant::Units units = Constant::Units::Invalid; // the units enumeration - std::string ScheduleName; // the name of the schedule - int scheduleIndex = 0; // index to the schedule specified - if no schedule use zero + Sched::Schedule *sched = nullptr; // index to the schedule specified - if no schedule use zero }; struct BinResultsType @@ -489,6 +490,86 @@ namespace OutputReportTabular { } }; + struct compLoadsSurface + { + Real64 loadConvectedNormal = 0.0; + Real64 loadConvectedWithPulse = 0.0; + Real64 netSurfRadSeq = 0.0; + Real64 ITABSFseq = 0.0; // used for determining the radiant fraction on each surface + Real64 TMULTseq = 0.0; // used for determining the radiant fraction on each surface + Real64 lightSWRadSeq = 0.0; // short wave visible radiation + Real64 feneSolarRadSeq = 0.0; + }; + + struct compLoadsTimeStepSurfaces + { + std::vector surf; + }; + + struct componentLoadsSurf + { + std::vector ts; + }; + + struct compLoadsSpaceZone + { + Real64 peopleInstantSeq = 0.0; + Real64 peopleLatentSeq = 0.0; + + Real64 lightInstantSeq = 0.0; + Real64 lightRetAirSeq = 0.0; + + Real64 equipInstantSeq = 0.0; + Real64 equipLatentSeq = 0.0; + + Real64 refrigInstantSeq = 0.0; + Real64 refrigRetAirSeq = 0.0; + Real64 refrigLatentSeq = 0.0; + + Real64 waterUseInstantSeq = 0.0; + Real64 waterUseLatentSeq = 0.0; + + Real64 hvacLossInstantSeq = 0.0; + + Real64 powerGenInstantSeq = 0.0; + Real64 powerGenRadSeq = 0.0; + Real64 infilInstantSeq = 0.0; + Real64 infilLatentSeq = 0.0; + + Real64 zoneVentInstantSeq = 0.0; + Real64 zoneVentLatentSeq = 0.0; + + Real64 interZoneMixInstantSeq = 0.0; + Real64 interZoneMixLatentSeq = 0.0; + + Real64 feneCondInstantSeq = 0.0; + bool adjFenDone = false; + }; + struct compLoadsTimeStepSpZn + { + std::vector spacezone; + }; + struct componentLoadsSpZn + { + std::vector ts; + }; + + struct compLoadsEnclosure + { + Real64 peopleRadSeq = 0.0; + Real64 lightLWRadSeq = 0.0; // long wave thermal radiation + Real64 equipRadSeq = 0.0; + Real64 hvacLossRadSeq = 0.0; + Real64 powerGenRadSeq = 0.0; + }; + struct compLoadsTimeStepEncl + { + std::vector encl; + }; + struct componentLoadsEncl + { + std::vector ts; + }; // Functions std::ofstream &open_tbl_stream(EnergyPlusData &state, int const iStyle, fs::path const &filePath, bool output_to_file = true); @@ -717,7 +798,7 @@ namespace OutputReportTabular { Real64 const unitConvMultiplier = 1.0); // return the table entry of the rowIndex-th row and columnIndex-th col - std::string RetrieveEntryFromTableBody(Array2D_string &tableBody, int const rowIndex, int const columnIndex); + std::string RetrieveEntryFromTableBody(Array2D_string const &tableBody, int const rowIndex, int const columnIndex); void WriteHourOfSafetyTable(EnergyPlusData &state, int const columnNum, @@ -767,7 +848,7 @@ namespace OutputReportTabular { void AllocateLoadComponentArrays(EnergyPlusData &state); - void DeallocateLoadComponentArrays(EnergyPlusData &state); + void DeallocateLoadComponentArrays(EnergyPlusData const &state); void ComputeLoadComponentDecayCurve(EnergyPlusData &state); @@ -775,8 +856,28 @@ namespace OutputReportTabular { void GatherComponentLoadsHVAC(EnergyPlusData &state); + void gatherSpaceZoneCompLoadsHVAC(OutputReportTabular::compLoadsSpaceZone &compLoadDayTS, + DataHeatBalance::AirReportVars const &szAirRpt, + Real64 const timeStepSysSec); + void WriteLoadComponentSummaryTables(EnergyPlusData &state); + void computeSpaceZoneCompLoads(EnergyPlusData &state, + DataSizing::ZoneSizingData const &calcFinalSizing, + CompLoadTablesType &coolCompLoadTables, + CompLoadTablesType &heatCompLoadTables, + Array1D &peopleDelaySeq, + Array1D &equipDelaySeq, + Array1D &hvacLossDelaySeq, + Array1D &powerGenDelaySeq, + Array1D &lightDelaySeq, + Array1D &feneSolarDelaySeq, + std::vector &szCompLoadLoc, + Array2D &surfDelaySeq, + ZompComponentAreasType &componentAreas, + int const iZone, + int const iSpace = 0); + void GetDelaySequences(EnergyPlusData &state, int desDaySelected, bool isCooling, @@ -787,8 +888,9 @@ namespace OutputReportTabular { Array1D &powerGenDelaySeq, Array1D &lightDelaySeq, Array1D &feneSolarDelaySeq, - Array3D &feneCondInstantSeq, - Array2D &surfDelaySeq); + std::vector &szCompLoadLoc, + Array2D &surfDelaySeq, + int const iSpace = 0); void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, Array2D &resultCells, @@ -802,17 +904,20 @@ namespace OutputReportTabular { Array1D const &powerGenDelaySeq, Array1D const &lightDelaySeq, Array1D const &feneSolarDelaySeq, - Array3D const &feneCondInstantSeqLoc, - Array2D const &surfDelaySeq); + std::vector &szCompLoadLoc, + Array2D const &surfDelaySeq, + int const iSpace = 0); - void - CollectPeakZoneConditions(EnergyPlusData &state, CompLoadTablesType &compLoad, int desDaySelected, int timeOfMax, int zoneIndex, bool isCooling); + void CollectPeakZoneConditions( + EnergyPlusData &state, CompLoadTablesType &compLoad, int desDaySelected, int timeOfMax, int zoneIndex, bool isCooling, int spaceIndex = 0); void ComputeEngineeringChecks(CompLoadTablesType &compLoad); - void GetZoneComponentAreas(EnergyPlusData &state, Array1D &areas); + void GetZoneComponentAreas(EnergyPlusData &state, Array1D &znAreas, Array1D &spAreas); - void AddAreaColumnForZone(int zoneNum, Array1D const &compAreas, CompLoadTablesType &compLoadTotal); + void addSurfaceArea(DataSurfaces::SurfaceData const &curSurface, Array1D &areas, bool isZone); + + void AddAreaColumnForZone(ZompComponentAreasType const &compAreas, CompLoadTablesType &compLoadTotal); void CombineLoadCompResults(CompLoadTablesType &compLoadTotal, CompLoadTablesType const &compLoadPartial, Real64 multiplier); @@ -824,7 +929,7 @@ namespace OutputReportTabular { void LoadSummaryUnitConversion(EnergyPlusData &state, CompLoadTablesType &compLoadTotal, UnitsStyle unitsStyle_para); - void CreateListOfZonesForAirLoop(EnergyPlusData &state, CompLoadTablesType &compLoad, Array1D_int const &zoneToAirLoop, int curAirLoop); + void CreateListOfZonesForAirLoop(EnergyPlusData const &state, CompLoadTablesType &compLoad, Array1D_int const &zoneToAirLoop, int curAirLoop); void OutputCompLoadSummary(EnergyPlusData &state, EnergyPlus::OutputReportTabular::OutputType kind, @@ -891,13 +996,13 @@ namespace OutputReportTabular { void ResetMonthlyGathering(EnergyPlusData &state); - void ResetBinGathering(EnergyPlusData &state); + void ResetBinGathering(EnergyPlusData const &state); - void ResetBEPSGathering(EnergyPlusData &state); + void ResetBEPSGathering(EnergyPlusData const &state); - void ResetSourceEnergyEndUseGathering(EnergyPlusData &state); + void ResetSourceEnergyEndUseGathering(EnergyPlusData const &state); - void ResetPeakDemandGathering(EnergyPlusData &state); + void ResetPeakDemandGathering(EnergyPlusData const &state); void ResetHeatGainGathering(EnergyPlusData &state); @@ -1044,7 +1149,7 @@ struct OutputReportTabularData : BaseGlobalStruct Array1D_bool ffUsed = Array1D_bool(OutputReportTabular::numResourceTypes, false); Array1D SourceFactors = Array1D(OutputReportTabular::numResourceTypes, 0.0); Array1D_bool ffSchedUsed = Array1D_bool(OutputReportTabular::numResourceTypes, false); - Array1D_int ffSchedIndex = Array1D_int(OutputReportTabular::numResourceTypes, 0); + Array1D ffScheds = Array1D(OutputReportTabular::numResourceTypes, nullptr); Array2D_int meterNumEndUseBEPS = Array2D_int(OutputReportTabular::numResourceTypes, static_cast(Constant::EndUse::Num), -1); Array3D_int meterNumEndUseSubBEPS; Array3D_int meterNumEndUseSpTypeBEPS; @@ -1155,50 +1260,13 @@ struct OutputReportTabularData : BaseGlobalStruct // arrays related to pulse and load component reporting Array2D_int radiantPulseTimestep; Array2D radiantPulseReceived; - Array3D loadConvectedNormal; - Array3D loadConvectedWithPulse; - Array3D netSurfRadSeq; Array2D decayCurveCool; Array2D decayCurveHeat; - Array3D ITABSFseq; // used for determining the radiant fraction on each surface - Array3D TMULTseq; // used for determining the radiant fraction on each surface - - Array3D peopleInstantSeq; - Array3D peopleLatentSeq; - Array3D peopleRadSeq; - - Array3D lightInstantSeq; - Array3D lightRetAirSeq; - Array3D lightLWRadSeq; // long wave thermal radiation - Array3D lightSWRadSeq; // short wave visible radiation - Array3D equipInstantSeq; - Array3D equipLatentSeq; - Array3D equipRadSeq; - - Array3D refrigInstantSeq; - Array3D refrigRetAirSeq; - Array3D refrigLatentSeq; - - Array3D waterUseInstantSeq; - Array3D waterUseLatentSeq; - - Array3D hvacLossInstantSeq; - Array3D hvacLossRadSeq; - - Array3D powerGenInstantSeq; - Array3D powerGenRadSeq; - Array3D infilInstantSeq; - Array3D infilLatentSeq; - - Array3D zoneVentInstantSeq; - Array3D zoneVentLatentSeq; - - Array3D interZoneMixInstantSeq; - Array3D interZoneMixLatentSeq; - - Array3D feneCondInstantSeq; - Array3D feneSolarRadSeq; + std::vector surfCompLoads; // Surface component loads by day, timestep, then surface + std::vector znCompLoads; // Zone component loads by day, timestep, then zone + std::vector spCompLoads; // Space component loads by day, timestep, then space + std::vector enclCompLoads; // Enclosure component loads by day, timestep, then enclsoure int maxUniqueKeyCount = 0; @@ -1306,18 +1374,6 @@ struct OutputReportTabularData : BaseGlobalStruct int indexUnitConvWCS = 0; Real64 curValueSIWCS = 0.0; Real64 curValueWCS = 0.0; - int ZoneNumCLCDC = 0; - int SurfNumCLCDC = 0; - int TimeStepCLCDC = 0; - int TimeOfPulseCLCDC = 0; - int CoolDesSelectedCLCDC = 0; // design day selected for cooling - int HeatDesSelectedCLCDC = 0; // design day selected for heating - int iSurfGCLS = 0; - int ZoneNumGCLS = 0; - int TimeStepInDayGCLS = 0; - int iZoneGCLH = 0; - int TimeStepInDayGCLH = 0; - Array3D_bool adjFenDone; Real64 BigNumRMG = 0.0; int foundGsui = 0; int iUnitGsui = 0; @@ -1331,6 +1387,10 @@ struct OutputReportTabularData : BaseGlobalStruct std::string curColHeadWithSI; std::string curColHead; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } @@ -1389,7 +1449,7 @@ struct OutputReportTabularData : BaseGlobalStruct this->ffUsed = Array1D_bool(OutputReportTabular::numResourceTypes, false); this->SourceFactors = Array1D(OutputReportTabular::numResourceTypes, 0.0); this->ffSchedUsed = Array1D_bool(OutputReportTabular::numResourceTypes, false); - this->ffSchedIndex = Array1D_int(OutputReportTabular::numResourceTypes, 0); + this->ffScheds = Array1D(OutputReportTabular::numResourceTypes, nullptr); this->meterNumEndUseBEPS = Array2D_int(OutputReportTabular::numResourceTypes, static_cast(Constant::EndUse::Num), 0); this->meterNumEndUseSubBEPS.deallocate(); this->meterNumEndUseSpTypeBEPS.deallocate(); @@ -1475,40 +1535,13 @@ struct OutputReportTabularData : BaseGlobalStruct this->DesignDayCount = 0; this->radiantPulseTimestep.deallocate(); this->radiantPulseReceived.deallocate(); - this->loadConvectedNormal.deallocate(); - this->loadConvectedWithPulse.deallocate(); - this->netSurfRadSeq.deallocate(); this->decayCurveCool.deallocate(); this->decayCurveHeat.deallocate(); - this->ITABSFseq.deallocate(); - this->TMULTseq.deallocate(); - this->peopleInstantSeq.deallocate(); - this->peopleLatentSeq.deallocate(); - this->peopleRadSeq.deallocate(); - this->lightInstantSeq.deallocate(); - this->lightRetAirSeq.deallocate(); - this->lightLWRadSeq.deallocate(); - this->lightSWRadSeq.deallocate(); - this->equipInstantSeq.deallocate(); - this->equipLatentSeq.deallocate(); - this->equipRadSeq.deallocate(); - this->refrigInstantSeq.deallocate(); - this->refrigRetAirSeq.deallocate(); - this->refrigLatentSeq.deallocate(); - this->waterUseInstantSeq.deallocate(); - this->waterUseLatentSeq.deallocate(); - this->hvacLossInstantSeq.deallocate(); - this->hvacLossRadSeq.deallocate(); - this->powerGenInstantSeq.deallocate(); - this->powerGenRadSeq.deallocate(); - this->infilInstantSeq.deallocate(); - this->infilLatentSeq.deallocate(); - this->zoneVentInstantSeq.deallocate(); - this->zoneVentLatentSeq.deallocate(); - this->interZoneMixInstantSeq.deallocate(); - this->interZoneMixLatentSeq.deallocate(); - this->feneCondInstantSeq.deallocate(); - this->feneSolarRadSeq.deallocate(); + this->surfCompLoads.clear(); + this->znCompLoads.clear(); + this->spCompLoads.clear(); + this->enclCompLoads.clear(); + this->maxUniqueKeyCount = 0; this->activeSubTableName.clear(); this->activeReportNameNoSpace.clear(); @@ -1612,18 +1645,6 @@ struct OutputReportTabularData : BaseGlobalStruct this->indexUnitConvWCS = 0; this->curValueSIWCS = 0.0; this->curValueWCS = 0.0; - this->ZoneNumCLCDC = 0; - this->SurfNumCLCDC = 0; - this->TimeStepCLCDC = 0; - this->TimeOfPulseCLCDC = 0; - this->CoolDesSelectedCLCDC = 0; // design day selected for cooling - this->HeatDesSelectedCLCDC = 0; // design day selected for heating - this->iSurfGCLS = 0; - this->ZoneNumGCLS = 0; - this->TimeStepInDayGCLS = 0; - this->iZoneGCLH = 0; - this->TimeStepInDayGCLH = 0; - this->adjFenDone.clear(); this->BigNumRMG = 0.0; this->foundGsui = 0; this->iUnitGsui = 0; diff --git a/src/EnergyPlus/OutputReportTabularAnnual.cc b/src/EnergyPlus/OutputReportTabularAnnual.cc index fe42ff37954..cc2c2668a68 100644 --- a/src/EnergyPlus/OutputReportTabularAnnual.cc +++ b/src/EnergyPlus/OutputReportTabularAnnual.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -56,7 +56,6 @@ #include #include #include -#include // EnergyPlus Headers #include @@ -96,10 +95,7 @@ void GetInputTabularAnnual(EnergyPlusData &state) int IOStat; // IO Status when calling get input subroutine // static bool ErrorsFound( false ); int objCount(0); - int indexNums(0); - std::string curVarMtr(""); - std::string curAggTyp(""); - int curNumDgts(2); + int curNumDgts; AnnualFieldSet::AggregationKind curAgg(AnnualFieldSet::AggregationKind::sumOrAvg); auto &annualTables = state.dataOutputReportTabularAnnual->annualTables; @@ -128,7 +124,7 @@ void GetInputTabularAnnual(EnergyPlusData &state) annualTables.push_back(AnnualTable(state, alphArray(1), alphArray(2), alphArray(3))); // the remaining fields are repeating in groups of three and need to be added to the data structure for (jAlpha = 4; jAlpha <= numAlphas; jAlpha += 2) { - curVarMtr = alphArray(jAlpha); + std::string curVarMtr = alphArray(jAlpha); if (curVarMtr.empty()) { ShowWarningError(state, format("{}: Blank column specified in '{}', need to provide a variable or meter or EMS variable name ", @@ -141,7 +137,7 @@ void GetInputTabularAnnual(EnergyPlusData &state) } else { curAgg = AnnualFieldSet::AggregationKind::sumOrAvg; // if missing aggregation type use SumOrAverage } - indexNums = 1 + (jAlpha - 3) / 2; // compute the corresponding field index in the numArray + int indexNums = 1 + (jAlpha - 3) / 2; // compute the corresponding field index in the numArray if (indexNums <= numNums) { curNumDgts = numArray(indexNums); } else { @@ -180,7 +176,6 @@ void AnnualTable::setupGathering(EnergyPlusData &state) // This method is used after GetInput for REPORT:TABLE:ANNUAL to set up how output variables, meters, // input fields, and ems variables are gathered. { - int keyCount = 0; OutputProcessor::VariableType typeVar = OutputProcessor::VariableType::Invalid; OutputProcessor::StoreType avgSumVar; OutputProcessor::TimeStepType stepTypeVar; @@ -195,7 +190,7 @@ void AnnualTable::setupGathering(EnergyPlusData &state) std::vector::iterator fldStIt; for (fldStIt = m_annualFields.begin(); fldStIt != m_annualFields.end(); ++fldStIt) { - keyCount = fldStIt->getVariableKeyCountandTypeFromFldSt(state, typeVar, avgSumVar, stepTypeVar, unitsVar); + int keyCount = fldStIt->getVariableKeyCountandTypeFromFldSt(state, typeVar, avgSumVar, stepTypeVar, unitsVar); fldStIt->getVariableKeysFromFldSt(state, typeVar, keyCount, fldStIt->m_namesOfKeys, fldStIt->m_indexesForKeyVar); for (std::string nm : fldStIt->m_namesOfKeys) { std::string nmUpper = nm; @@ -337,10 +332,8 @@ void AnnualTable::gatherForTimestep(EnergyPlusData &state, OutputProcessor::Time bool activeMinMax = false; bool activeHoursShown = false; // if schedule is used and the current value is zero, don't gather values - if (m_scheduleNum != 0) { - if (ScheduleManager::GetCurrentScheduleValue(state, m_scheduleNum) == 0.0) { - return; - } + if (m_sched != nullptr && m_sched->getCurrentVal() == 0.0) { + return; } // loop through the fields std::vector::iterator fldStIt; @@ -1294,8 +1287,6 @@ void AnnualTable::convertUnitForDeferredResults(EnergyPlusData &state, { Real64 curConversionFactor; Real64 curConversionOffset; - std::string varNameWithUnits; - int indexUnitConv; std::string curUnits; std::string energyUnitsString; Real64 curSI; @@ -1303,7 +1294,8 @@ void AnnualTable::convertUnitForDeferredResults(EnergyPlusData &state, Real64 energyUnitsConversionFactor = AnnualTable::setEnergyUnitStringAndFactor(unitsStyle, energyUnitsString); // do the unit conversions if (unitsStyle == OutputReportTabular::UnitsStyle::InchPound || unitsStyle == OutputReportTabular::UnitsStyle::InchPoundExceptElectricity) { - varNameWithUnits = format("{} [{}]", fldStIt->m_variMeter, Constant::unitNames[(int)fldStIt->m_varUnits]); + int indexUnitConv; + std::string varNameWithUnits = format("{} [{}]", fldStIt->m_variMeter, Constant::unitNames[(int)fldStIt->m_varUnits]); OutputReportTabular::LookupSItoIP(state, varNameWithUnits, indexUnitConv, curUnits); OutputReportTabular::GetUnitConversion(state, indexUnitConv, curConversionFactor, curConversionOffset, curUnits); } else { // just do the Joule conversion @@ -1342,7 +1334,6 @@ std::vector AnnualTable::calculateBins(int const numberOfBins, Real64 &timeBelowBottomBin) { std::vector returnBins(0.0); - int binNum = 0; returnBins.resize(numberOfBins); Real64 intervalSize = (topOfBins - bottomOfBins) / float(numberOfBins); timeAboveTopBin = 0.0; @@ -1357,7 +1348,7 @@ std::vector AnnualTable::calculateBins(int const numberOfBins, timeAboveTopBin += *elapsedTimeIt; } else { // determine which bin the results are in - binNum = int((*valueIt - bottomOfBins) / intervalSize); + int binNum = int((*valueIt - bottomOfBins) / intervalSize); if (binNum < numberOfBins && binNum >= 0) { returnBins[binNum] += *elapsedTimeIt; } @@ -1388,8 +1379,7 @@ void AnnualTable::clearTable() { m_name = ""; m_filter = ""; - m_scheduleName = ""; - m_scheduleNum = 0; + m_sched = nullptr; m_objectNames.clear(); m_annualFields.clear(); } @@ -1401,7 +1391,7 @@ std::vector AnnualTable::inspectTable() std::vector ret; ret.push_back(m_name); ret.push_back(m_filter); - ret.push_back(m_scheduleName); + ret.push_back(m_sched->Name); return ret; } diff --git a/src/EnergyPlus/OutputReportTabularAnnual.hh b/src/EnergyPlus/OutputReportTabularAnnual.hh index 3a991ddb4ba..62a43e41e98 100644 --- a/src/EnergyPlus/OutputReportTabularAnnual.hh +++ b/src/EnergyPlus/OutputReportTabularAnnual.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -57,7 +57,6 @@ #include #include #include -#include // EnergyPlus Headers #include @@ -92,18 +91,17 @@ namespace OutputReportTabularAnnual { { public: // Default Constructor - AnnualTable() : m_name(""), m_filter(""), m_scheduleName(""), m_scheduleNum(0){}; + AnnualTable() : m_name(""), m_filter(""){}; // Member Constructor - AnnualTable(EnergyPlusData &state, std::string name, std::string filter, std::string scheduleName) + AnnualTable(EnergyPlusData &state, std::string name, std::string filter, std::string schedName) { m_name = name; m_filter = filter; - m_scheduleName = scheduleName; - if (!m_scheduleName.empty()) { - m_scheduleNum = ScheduleManager::GetScheduleIndex(state, m_scheduleName); // index to the period schedule + if (!schedName.empty()) { + m_sched = Sched::GetSchedule(state, schedName); // index to the period schedule } else { - m_scheduleNum = 0; + m_sched = nullptr; } }; @@ -137,8 +135,7 @@ namespace OutputReportTabularAnnual { std::string m_name; // identifier std::string m_filter; - std::string m_scheduleName; - int m_scheduleNum; + Sched::Schedule *m_sched = nullptr; std::vector m_objectNames; // for each row of annual table std::vector m_annualFields; // for each column @@ -181,6 +178,10 @@ struct OutputReportTabularAnnualData : BaseGlobalStruct std::vector annualTables; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/OutputReports.cc b/src/EnergyPlus/OutputReports.cc index e8876f46e42..9321f3293ac 100644 --- a/src/EnergyPlus/OutputReports.cc +++ b/src/EnergyPlus/OutputReports.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -952,14 +952,11 @@ void DetailsForSurfaces(EnergyPlusData &state, int const RptType) // (1=Vertices // SUBROUTINE LOCAL VARIABLE DECLARATIONS: std::string BaseSurfName; std::string ConstructionName; - std::string ScheduleName; std::string IntConvCoeffCalc; std::string ExtConvCoeffCalc; Real64 NominalUwithConvCoeffs; std::string cNominalU; std::string cNominalUwithConvCoeffs; - std::string cSchedMin; - std::string cSchedMax; std::string SolarDiffusing; std::string AlgoName; @@ -1030,10 +1027,13 @@ void DetailsForSurfaces(EnergyPlusData &state, int const RptType) // (1=Vertices int surf2 = 0; for (int surf : state.dataSurface->AllSurfaceListReportOrder) { surf2 = surf; - auto &thisSurface = state.dataSurface->Surface(surf); + auto const &thisSurface = state.dataSurface->Surface(surf); if (thisSurface.Zone != 0) break; } if ((surf2 - 1) > 0) { + std::string ScheduleName; + std::string cSchedMin; + std::string cSchedMax; *eiostream << "Shading Surfaces," << "Number of Shading Surfaces," << surf2 - 1 << '\n'; for (int surf : state.dataSurface->AllSurfaceListReportOrder) { @@ -1043,10 +1043,10 @@ void DetailsForSurfaces(EnergyPlusData &state, int const RptType) // (1=Vertices *eiostream << "Shading Surface," << thisSurface.Name << "," << cSurfaceClass(thisSurface.Class) << "," << thisSurface.BaseSurfName << "," << AlgoName << ","; if (RptType == 10) { - if (thisSurface.SchedShadowSurfIndex > 0) { - ScheduleName = ScheduleManager::GetScheduleName(state, thisSurface.SchedShadowSurfIndex); - cSchedMin = format("{:.2R}", ScheduleManager::GetScheduleMinValue(state, thisSurface.SchedShadowSurfIndex)); - cSchedMax = format("{:.2R}", ScheduleManager::GetScheduleMaxValue(state, thisSurface.SchedShadowSurfIndex)); + if (thisSurface.shadowSurfSched != nullptr) { + ScheduleName = thisSurface.shadowSurfSched->Name; + cSchedMin = format("{:.2R}", thisSurface.shadowSurfSched->getMinVal(state)); + cSchedMax = format("{:.2R}", thisSurface.shadowSurfSched->getMinVal(state)); } else { ScheduleName = ""; cSchedMin = "0.0"; @@ -1060,10 +1060,10 @@ void DetailsForSurfaces(EnergyPlusData &state, int const RptType) // (1=Vertices } else if (RptType == 1) { *eiostream << fmt::to_string(thisSurface.Sides) << ","; } else { - if (thisSurface.SchedShadowSurfIndex > 0) { - ScheduleName = ScheduleManager::GetScheduleName(state, thisSurface.SchedShadowSurfIndex); - cSchedMin = format("{:.2R}", ScheduleManager::GetScheduleMinValue(state, thisSurface.SchedShadowSurfIndex)); - cSchedMax = format("{:.2R}", ScheduleManager::GetScheduleMaxValue(state, thisSurface.SchedShadowSurfIndex)); + if (thisSurface.shadowSurfSched != nullptr) { + ScheduleName = thisSurface.shadowSurfSched->Name; + cSchedMin = format("{:.2R}", thisSurface.shadowSurfSched->getMinVal(state)); + cSchedMax = format("{:.2R}", thisSurface.shadowSurfSched->getMinVal(state)); } else { ScheduleName = ""; cSchedMin = "0.0"; @@ -1352,7 +1352,7 @@ void CostInfoOut(EnergyPlusData &state) uniqueSurf.dimension(state.dataSurface->TotSurfaces, true); for (int surf : state.dataSurface->AllSurfaceListReportOrder) { - auto &thisSurface = state.dataSurface->Surface(surf); + auto const &thisSurface = state.dataSurface->Surface(surf); if (thisSurface.ExtBoundCond > 0) { if (thisSurface.ExtBoundCond < surf) { // already cycled through uniqueSurf(surf) = false; @@ -1425,7 +1425,6 @@ void VRMLOut(EnergyPlusData &state, const std::string &PolygonAction, const std: "WALL", "WINDOW", "FIXEDSHADE", "SUBSHADE", "ROOF", "FLOOR", "BLDGSHADE"}; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - std::string ShadeType; bool ThickPolyline(false); bool RegularPolyline(false); std::string PolylineWidth(" 0.55"); @@ -1502,10 +1501,8 @@ void VRMLOut(EnergyPlusData &state, const std::string &PolygonAction, const std: if (thisSurface.Class == DataSurfaces::SurfaceClass::Detached_F) colorindex = Color::FixedShade; if (thisSurface.Class == DataSurfaces::SurfaceClass::Detached_B) colorindex = Color::BldgShade; if (thisSurface.Class == DataSurfaces::SurfaceClass::Detached_F) { - ShadeType = "Fixed Shading"; print(wrlfile, "# Fixed Shading:{}\n", thisSurface.Name); } else if (thisSurface.Class == DataSurfaces::SurfaceClass::Detached_B) { - ShadeType = "Building Shading"; print(wrlfile, "# Building Shading:{}", thisSurface.Name); } print(wrlfile, Format_801, colorstring[static_cast(colorindex)], "Surf", surf); diff --git a/src/EnergyPlus/OutputReports.hh b/src/EnergyPlus/OutputReports.hh index 38bba0052a0..072f552617b 100644 --- a/src/EnergyPlus/OutputReports.hh +++ b/src/EnergyPlus/OutputReports.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -81,6 +81,10 @@ struct OutputReportsData : BaseGlobalStruct bool optiondone = false; std::string lastoption; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/OutsideEnergySources.cc b/src/EnergyPlus/OutsideEnergySources.cc index 452a0703452..d134d1823d9 100644 --- a/src/EnergyPlus/OutsideEnergySources.cc +++ b/src/EnergyPlus/OutsideEnergySources.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -146,6 +146,8 @@ void GetOutsideEnergySourcesInput(EnergyPlusData &state) // component arrays. Data items in the component arrays // are initialized. Output variables are set up. + static constexpr std::string_view routineName = "GetOutsideEnergySourcesInput"; + // GET NUMBER OF ALL EQUIPMENT TYPES int const NumDistrictUnitsHeatWater = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "DistrictHeating:Water"); int const NumDistrictUnitsCool = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "DistrictCooling"); @@ -175,7 +177,7 @@ void GetOutsideEnergySourcesInput(EnergyPlusData &state) EnergyType = DataPlant::PlantEquipmentType::PurchHotWater; heatWaterIndex++; thisIndex = heatWaterIndex; - } else if (EnergySourceNum > NumDistrictUnitsHeatWater && EnergySourceNum <= NumDistrictUnitsHeatWater + NumDistrictUnitsCool) { + } else if (EnergySourceNum <= NumDistrictUnitsHeatWater + NumDistrictUnitsCool) { state.dataIPShortCut->cCurrentModuleObject = "DistrictCooling"; objType = DataLoopNode::ConnectionObjectType::DistrictCooling; nodeNames = "Chilled Water Nodes"; @@ -204,6 +206,8 @@ void GetOutsideEnergySourcesInput(EnergyPlusData &state) state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames); + ErrorObjectHeader eoh{routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + if (EnergySourceNum > 1) { GlobalNames::VerifyUniqueInterObjectName(state, state.dataOutsideEnergySrcs->EnergySourceUniqueNames, @@ -269,32 +273,22 @@ void GetOutsideEnergySourcesInput(EnergyPlusData &state) state.dataOutsideEnergySrcs->EnergySource(EnergySourceNum).EnergyTransfer = 0.0; state.dataOutsideEnergySrcs->EnergySource(EnergySourceNum).EnergyRate = 0.0; state.dataOutsideEnergySrcs->EnergySource(EnergySourceNum).EnergyType = EnergyType; - if (!state.dataIPShortCut->lAlphaFieldBlanks(4)) { - state.dataOutsideEnergySrcs->EnergySource(EnergySourceNum).CapFractionSchedNum = - ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(4)); - if (state.dataOutsideEnergySrcs->EnergySource(EnergySourceNum).CapFractionSchedNum == 0) { - ShowSevereError(state, - format("{}=\"{}\", is not valid", - state.dataIPShortCut->cCurrentModuleObject, - state.dataOutsideEnergySrcs->EnergySource(EnergySourceNum).Name)); - ShowContinueError(state, - format("{}=\"{}\" was not found.", state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4))); - ErrorsFound = true; - } - if (!ScheduleManager::CheckScheduleValueMinMax( - state, state.dataOutsideEnergySrcs->EnergySource(EnergySourceNum).CapFractionSchedNum, true, 0.0)) { - ShowWarningError(state, - format("{}=\"{}\", is not valid", - state.dataIPShortCut->cCurrentModuleObject, - state.dataOutsideEnergySrcs->EnergySource(EnergySourceNum).Name)); - ShowContinueError(state, - format("{}=\"{}\" should not have negative values.", - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4))); - ShowContinueError(state, "Negative values will be treated as zero, and the simulation continues."); - } - } else { - state.dataOutsideEnergySrcs->EnergySource(EnergySourceNum).CapFractionSchedNum = ScheduleManager::ScheduleAlwaysOn; + + if (state.dataIPShortCut->lAlphaFieldBlanks(4)) { + state.dataOutsideEnergySrcs->EnergySource(EnergySourceNum).capFractionSched = + Sched::GetScheduleAlwaysOn(state); // Defaults to constant-1.0 + } else if ((state.dataOutsideEnergySrcs->EnergySource(EnergySourceNum).capFractionSched = + Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(4))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4)); + ErrorsFound = true; + } else if (!state.dataOutsideEnergySrcs->EnergySource(EnergySourceNum).capFractionSched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowWarningBadMin(state, + eoh, + state.dataIPShortCut->cAlphaFieldNames(4), + state.dataIPShortCut->cAlphaArgs(4), + Clusive::In, + 0.0, + "Negative values will be treated as zero, and the simulation continues."); } } @@ -370,20 +364,14 @@ void OutsideEnergySourceSpecs::size(EnergyPlusData &state) Real64 NomCapDes; if (this->EnergyType == DataPlant::PlantEquipmentType::PurchChilledWater || this->EnergyType == DataPlant::PlantEquipmentType::PurchHotWater) { - Real64 const rho = - FluidProperties::GetDensityGlycol(state, loop.FluidName, Constant::InitConvTemp, loop.FluidIndex, format("Size {}", typeName)); - Real64 const Cp = - FluidProperties::GetSpecificHeatGlycol(state, loop.FluidName, Constant::InitConvTemp, loop.FluidIndex, format("Size {}", typeName)); + Real64 const rho = loop.glycol->getDensity(state, Constant::InitConvTemp, format("Size {}", typeName)); + Real64 const Cp = loop.glycol->getSpecificHeat(state, Constant::InitConvTemp, format("Size {}", typeName)); NomCapDes = Cp * rho * state.dataSize->PlantSizData(PltSizNum).DeltaT * state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate; } else { // this->EnergyType == DataPlant::TypeOf_PurchSteam - Real64 const tempSteam = FluidProperties::GetSatTemperatureRefrig( - state, loop.FluidName, state.dataEnvrn->StdBaroPress, loop.FluidIndex, format("Size {}", typeName)); - Real64 const rhoSteam = - FluidProperties::GetSatDensityRefrig(state, loop.FluidName, tempSteam, 1.0, loop.FluidIndex, format("Size {}", typeName)); - Real64 const EnthSteamDry = - FluidProperties::GetSatEnthalpyRefrig(state, loop.FluidName, tempSteam, 1.0, loop.FluidIndex, format("Size {}", typeName)); - Real64 const EnthSteamWet = - FluidProperties::GetSatEnthalpyRefrig(state, loop.FluidName, tempSteam, 0.0, loop.FluidIndex, format("Size {}", typeName)); + Real64 const tempSteam = loop.steam->getSatTemperature(state, state.dataEnvrn->StdBaroPress, format("Size {}", typeName)); + Real64 const rhoSteam = loop.steam->getSatDensity(state, tempSteam, 1.0, format("Size {}", typeName)); + Real64 const EnthSteamDry = loop.steam->getSatEnthalpy(state, tempSteam, 1.0, format("Size {}", typeName)); + Real64 const EnthSteamWet = loop.steam->getSatEnthalpy(state, tempSteam, 0.0, format("Size {}", typeName)); Real64 const LatentHeatSteam = EnthSteamDry - EnthSteamWet; NomCapDes = rhoSteam * state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate * LatentHeatSteam; } @@ -457,7 +445,7 @@ void OutsideEnergySourceSpecs::calculate(EnergyPlusData &state, bool runFlag, Re Real64 const LoopMaxMdot = state.dataPlnt->PlantLoop(LoopNum).MaxMassFlowRate; // apply power limit from input - Real64 CapFraction = ScheduleManager::GetCurrentScheduleValue(state, this->CapFractionSchedNum); + Real64 CapFraction = this->capFractionSched->getCurrentVal(); CapFraction = max(0.0, CapFraction); // ensure non negative Real64 const CurrentCap = this->NomCap * CapFraction; if (std::abs(MyLoad) > CurrentCap) { @@ -474,8 +462,7 @@ void OutsideEnergySourceSpecs::calculate(EnergyPlusData &state, bool runFlag, Re if ((this->MassFlowRate > 0.0) && runFlag) { if (this->EnergyType == DataPlant::PlantEquipmentType::PurchChilledWater || this->EnergyType == DataPlant::PlantEquipmentType::PurchHotWater) { - Real64 const Cp = FluidProperties::GetSpecificHeatGlycol( - state, state.dataPlnt->PlantLoop(LoopNum).FluidName, this->InletTemp, state.dataPlnt->PlantLoop(LoopNum).FluidIndex, RoutineName); + Real64 const Cp = state.dataPlnt->PlantLoop(LoopNum).glycol->getSpecificHeat(state, this->InletTemp, RoutineName); this->OutletTemp = (MyLoad + this->MassFlowRate * Cp * this->InletTemp) / (this->MassFlowRate * Cp); // apply loop limits on temperature result to keep in check if (this->OutletTemp < LoopMinTemp) { @@ -488,12 +475,11 @@ void OutsideEnergySourceSpecs::calculate(EnergyPlusData &state, bool runFlag, Re } } else if (this->EnergyType == DataPlant::PlantEquipmentType::PurchSteam) { // determine mass flow rate based on inlet temp, saturate temp at // atmospheric pressure, Cp of inlet condensate, and MyLoad - Real64 SatTempAtmPress = - FluidProperties::GetSatTemperatureRefrig(state, loop.FluidName, DataEnvironment::StdPressureSeaLevel, loop.FluidIndex, RoutineName); - Real64 CpCondensate = FluidProperties::GetSpecificHeatGlycol(state, loop.FluidName, this->InletTemp, loop.FluidIndex, RoutineName); + Real64 SatTempAtmPress = loop.steam->getSatTemperature(state, DataEnvironment::StdPressureSeaLevel, RoutineName); + Real64 CpCondensate = loop.glycol->getSpecificHeat(state, this->InletTemp, RoutineName); Real64 deltaTsensible = SatTempAtmPress - this->InletTemp; - Real64 EnthSteamInDry = FluidProperties::GetSatEnthalpyRefrig(state, loop.FluidName, this->InletTemp, 1.0, loop.FluidIndex, RoutineName); - Real64 EnthSteamOutWet = FluidProperties::GetSatEnthalpyRefrig(state, loop.FluidName, this->InletTemp, 0.0, loop.FluidIndex, RoutineName); + Real64 EnthSteamInDry = loop.steam->getSatEnthalpy(state, this->InletTemp, 1.0, RoutineName); + Real64 EnthSteamOutWet = loop.steam->getSatEnthalpy(state, this->InletTemp, 0.0, RoutineName); Real64 LatentHeatSteam = EnthSteamInDry - EnthSteamOutWet; this->MassFlowRate = MyLoad / (LatentHeatSteam + (CpCondensate * deltaTsensible)); PlantUtilities::SetComponentFlowRate(state, this->MassFlowRate, this->InletNodeNum, this->OutletNodeNum, this->plantLoc); diff --git a/src/EnergyPlus/OutsideEnergySources.hh b/src/EnergyPlus/OutsideEnergySources.hh index e71d68a1e19..60b4526ffe9 100644 --- a/src/EnergyPlus/OutsideEnergySources.hh +++ b/src/EnergyPlus/OutsideEnergySources.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -72,7 +72,7 @@ namespace OutsideEnergySources { std::string Name; // user identifier Real64 NomCap = 0.0; // design nominal capacity of district service bool NomCapWasAutoSized = false; // ture if Nominal Capacity was autosize on input - int CapFractionSchedNum = 0; // capacity modifier schedule number + Sched::Schedule *capFractionSched = nullptr; // capacity modifier schedule number int InletNodeNum = 0; // Node number on the inlet side of the plant int OutletNodeNum = 0; // Node number on the inlet side of the plant Real64 EnergyTransfer = 0.0; // cooling energy provided in time step @@ -130,6 +130,10 @@ struct OutsideEnergySourcesData : BaseGlobalStruct Array1D EnergySource; std::unordered_map EnergySourceUniqueNames; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/PVWatts.cc b/src/EnergyPlus/PVWatts.cc index e53d76f6cd6..790f651a9e6 100644 --- a/src/EnergyPlus/PVWatts.cc +++ b/src/EnergyPlus/PVWatts.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -388,7 +388,7 @@ namespace PVWatts { Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; // We only run this once for each zone time step. - const int NumTimeStepsToday_loc = state.dataGlobal->HourOfDay * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; + const int NumTimeStepsToday_loc = state.dataGlobal->HourOfDay * state.dataGlobal->TimeStepsInHour + state.dataGlobal->TimeStep; if (NumTimeStepsToday_ != NumTimeStepsToday_loc) { NumTimeStepsToday_ = NumTimeStepsToday_loc; } else { @@ -402,7 +402,7 @@ namespace PVWatts { ssc_data_set_number(pvwattsData_, "month", state.dataEnvrn->Month); ssc_data_set_number(pvwattsData_, "day", state.dataEnvrn->DayOfMonth); ssc_data_set_number(pvwattsData_, "hour", state.dataGlobal->HourOfDay - 1); - ssc_data_set_number(pvwattsData_, "minute", (state.dataGlobal->TimeStep - 0.5) * state.dataGlobal->MinutesPerTimeStep); + ssc_data_set_number(pvwattsData_, "minute", (state.dataGlobal->TimeStep - 0.5) * state.dataGlobal->MinutesInTimeStep); // Weather Conditions ssc_data_set_number(pvwattsData_, "beam", state.dataEnvrn->BeamSolarRad); diff --git a/src/EnergyPlus/PVWatts.hh b/src/EnergyPlus/PVWatts.hh index 672c06f9707..50fa288cebc 100644 --- a/src/EnergyPlus/PVWatts.hh +++ b/src/EnergyPlus/PVWatts.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/PackagedThermalStorageCoil.cc b/src/EnergyPlus/PackagedThermalStorageCoil.cc index c56067863b8..ce94431f1e9 100644 --- a/src/EnergyPlus/PackagedThermalStorageCoil.cc +++ b/src/EnergyPlus/PackagedThermalStorageCoil.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -198,17 +198,14 @@ void GetTESCoilInput(EnergyPlusData &state) // Using/Aliasing using BranchNodeConnections::TestCompSet; using DataZoneEquipment::FindControlledZoneIndexFromSystemNodeNumberForZone; - using FluidProperties::CheckFluidPropertyName; - using FluidProperties::GetFluidDensityTemperatureLimits; - using FluidProperties::GetFluidSpecificHeatTemperatureLimits; using GlobalNames::VerifyUniqueCoilName; using NodeInputManager::GetOnlySingleNode; - using ScheduleManager::GetScheduleIndex; using WaterManager::SetupTankDemandComponent; using WaterManager::SetupTankSupplyComponent; // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetTESCoilInput: "); // include trailing blank space + static constexpr std::string_view routineName = "GetTESCoilInput"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumAlphas = 0; // Number of alphas in input @@ -239,6 +236,9 @@ void GetTESCoilInput(EnergyPlusData &state) state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + Util::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); // ErrorsFound will be set to True if problem was found, left untouched otherwise @@ -246,15 +246,12 @@ void GetTESCoilInput(EnergyPlusData &state) thisTESCoil.Name = state.dataIPShortCut->cAlphaArgs(1); if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { - thisTESCoil.AvailSchedNum = ScheduleManager::ScheduleAlwaysOn; - } else { - thisTESCoil.AvailSchedNum = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); - if (thisTESCoil.AvailSchedNum == 0) { - ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, cCurrentModuleObject, thisTESCoil.Name)); - ShowContinueError(state, format("...{}=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); - ErrorsFound = true; - } + thisTESCoil.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisTESCoil.availSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2)); + ErrorsFound = true; } + thisTESCoil.ModeControlType = static_cast(getEnumValue(modeControlStrings, state.dataIPShortCut->cAlphaArgs(3))); if (thisTESCoil.ModeControlType == PTSCCtrlType::Invalid) { ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, cCurrentModuleObject, thisTESCoil.Name)); @@ -262,17 +259,13 @@ void GetTESCoilInput(EnergyPlusData &state) ShowContinueError(state, "Available choices are ScheduledModes or EMSControlled"); ErrorsFound = true; } - if (state.dataIPShortCut->lAlphaFieldBlanks(4)) { - if (thisTESCoil.ModeControlType == PTSCCtrlType::ScheduledOpModes) { - ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, cCurrentModuleObject, thisTESCoil.Name)); - ShowContinueError(state, format("{} is blank but a schedule is needed", state.dataIPShortCut->cAlphaFieldNames(4))); + + if (thisTESCoil.ModeControlType == PTSCCtrlType::ScheduledOpModes) { + if (state.dataIPShortCut->lAlphaFieldBlanks(4)) { + ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(4)); ErrorsFound = true; - } - } else { - thisTESCoil.ControlModeSchedNum = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(4)); - if (thisTESCoil.ControlModeSchedNum == 0 && thisTESCoil.ModeControlType == PTSCCtrlType::ScheduledOpModes) { - ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, cCurrentModuleObject, thisTESCoil.Name)); - ShowContinueError(state, format("...{}=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4))); + } else if ((thisTESCoil.controlModeSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(4))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4)); ErrorsFound = true; } } @@ -285,7 +278,7 @@ void GetTESCoilInput(EnergyPlusData &state) break; case MediaType::Water: thisTESCoil.StorageFluidName = "WATER"; - thisTESCoil.StorageFluidIndex = FluidProperties::GetGlycolNum(state, "WATER"); + thisTESCoil.glycol = Fluid::GetWater(state); break; default: ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, cCurrentModuleObject, thisTESCoil.Name)); @@ -294,28 +287,13 @@ void GetTESCoilInput(EnergyPlusData &state) ErrorsFound = true; } + thisTESCoil.StorageFluidName = state.dataIPShortCut->cAlphaArgs(6); if (Util::SameString(state.dataIPShortCut->cAlphaArgs(5), "USERDEFINEDFLUIDTYPE")) { - if (!(state.dataIPShortCut->lAlphaFieldBlanks(6))) { - thisTESCoil.StorageFluidName = state.dataIPShortCut->cAlphaArgs(6); - if (CheckFluidPropertyName(state, state.dataIPShortCut->cAlphaArgs(6)) == 0) { - ShowSevereError(state, format("{}{}=\"{}\", missing fluid data", RoutineName, cCurrentModuleObject, thisTESCoil.Name)); - ShowContinueError( - state, format("Check that fluid property data have been input for fluid name = {}", state.dataIPShortCut->cAlphaArgs(6))); - ErrorsFound = true; - } else { - thisTESCoil.StorageFluidIndex = FluidProperties::GetGlycolNum(state, state.dataIPShortCut->cAlphaArgs(6)); - if (thisTESCoil.StorageFluidIndex == 0) { - ShowSevereError(state, format("{}{}=\"{}\", invalid fluid data", RoutineName, cCurrentModuleObject, thisTESCoil.Name)); - ShowContinueError(state, - format("Check that correct fluid property data have been input for fluid name = {}", - state.dataIPShortCut->cAlphaArgs(6))); - ErrorsFound = true; - } - } - - } else { - ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, cCurrentModuleObject, thisTESCoil.Name)); - ShowContinueError(state, "Storage Type is set to UserDefinedFluidType but no name of fluid was entered."); + if (!state.dataIPShortCut->lAlphaFieldBlanks(6)) { + ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(6)); + ErrorsFound = true; + } else if ((thisTESCoil.glycol = Fluid::GetGlycol(state, state.dataIPShortCut->cAlphaArgs(6))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(6), state.dataIPShortCut->cAlphaArgs(6)); ErrorsFound = true; } } @@ -1462,14 +1440,10 @@ void GetTESCoilInput(EnergyPlusData &state) thisTESCoil.BasinHeaterSetpointTemp = state.dataIPShortCut->rNumericArgs(39); if (state.dataIPShortCut->lAlphaFieldBlanks(59)) { - thisTESCoil.BasinHeaterAvailSchedNum = ScheduleManager::ScheduleAlwaysOn; - } else { - thisTESCoil.BasinHeaterAvailSchedNum = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(59)); - if (thisTESCoil.BasinHeaterAvailSchedNum == 0) { - ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, cCurrentModuleObject, thisTESCoil.Name)); - ShowContinueError(state, format("...{}=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(59), state.dataIPShortCut->cAlphaArgs(59))); - ErrorsFound = true; - } + thisTESCoil.basinHeaterAvailSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisTESCoil.basinHeaterAvailSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(59))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(59), state.dataIPShortCut->cAlphaArgs(59)); + ErrorsFound = true; } if (state.dataIPShortCut->lAlphaFieldBlanks(60)) { @@ -1558,15 +1532,15 @@ void GetTESCoilInput(EnergyPlusData &state) if (!state.dataIPShortCut->lNumericFieldBlanks(42)) { thisTESCoil.MinimumFluidTankTempLimit = state.dataIPShortCut->rNumericArgs(42); } else { - GetFluidDensityTemperatureLimits(state, thisTESCoil.StorageFluidIndex, TminRho, TmaxRho); - GetFluidSpecificHeatTemperatureLimits(state, thisTESCoil.StorageFluidIndex, TminCp, TmaxCp); + thisTESCoil.glycol->getDensityTemperatureLimits(state, TminRho, TmaxRho); + thisTESCoil.glycol->getSpecificHeatTemperatureLimits(state, TminCp, TmaxCp); thisTESCoil.MinimumFluidTankTempLimit = max(TminRho, TminCp); } if (!state.dataIPShortCut->lNumericFieldBlanks(43)) { thisTESCoil.MaximumFluidTankTempLimit = state.dataIPShortCut->rNumericArgs(43); } else { - GetFluidDensityTemperatureLimits(state, thisTESCoil.StorageFluidIndex, TminRho, TmaxRho); - GetFluidSpecificHeatTemperatureLimits(state, thisTESCoil.StorageFluidIndex, TminCp, TmaxCp); + thisTESCoil.glycol->getDensityTemperatureLimits(state, TminRho, TmaxRho); + thisTESCoil.glycol->getSpecificHeatTemperatureLimits(state, TminCp, TmaxCp); thisTESCoil.MaximumFluidTankTempLimit = min(TmaxRho, TmaxCp); } } @@ -1886,7 +1860,6 @@ void InitTESCoil(EnergyPlusData &state, int &TESCoilNum) // Using/Aliasing using PlantUtilities::ScanPlantLoopsForObject; - using ScheduleManager::GetCurrentScheduleValue; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: auto &thisTESCoil = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum); @@ -1999,9 +1972,9 @@ void InitTESCoil(EnergyPlusData &state, int &TESCoilNum) } // determine control mode - if (GetCurrentScheduleValue(state, thisTESCoil.AvailSchedNum) != 0.0) { + if (thisTESCoil.availSched->getCurrentVal() != 0.0) { if (thisTESCoil.ModeControlType == PTSCCtrlType::ScheduledOpModes) { - Real64 const tmpSchedValue = GetCurrentScheduleValue(state, thisTESCoil.ControlModeSchedNum); + Real64 const tmpSchedValue = thisTESCoil.controlModeSched->getCurrentVal(); // check if value is valid if (tmpSchedValue > static_cast(PTSCOperatingMode::Invalid) && tmpSchedValue < static_cast(PTSCOperatingMode::Num)) { thisTESCoil.CurControlMode = static_cast(tmpSchedValue); @@ -2144,8 +2117,6 @@ void SizeTESCoil(EnergyPlusData &state, int &TESCoilNum) // Using/Aliasing using namespace DataSizing; using namespace OutputReportPredefined; - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSpecificHeatGlycol; // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("SizeTESCoil "); @@ -2369,18 +2340,15 @@ void SizeTESCoil(EnergyPlusData &state, int &TESCoilNum) // for fluid tanks, assume a 10C deltaT or diff between max and min, whichever is smaller deltaT = min(FluidTankSizingDeltaT, (thisTESCoil.MaximumFluidTankTempLimit - thisTESCoil.MinimumFluidTankTempLimit)); - - rho = GetDensityGlycol( - state, thisTESCoil.StorageFluidName, Constant::CWInitConvTemp, thisTESCoil.StorageFluidIndex, calcTESWaterStorageTank); - Cp = GetSpecificHeatGlycol( - state, thisTESCoil.StorageFluidName, Constant::CWInitConvTemp, thisTESCoil.StorageFluidIndex, calcTESWaterStorageTank); + rho = thisTESCoil.glycol->getDensity(state, Constant::CWInitConvTemp, calcTESWaterStorageTank); + Cp = thisTESCoil.glycol->getSpecificHeat(state, Constant::CWInitConvTemp, calcTESWaterStorageTank); if (thisTESCoil.DischargeOnlyRatedDischargeCap > 0.0 && thisTESCoil.DischargeOnlyModeAvailable) { thisTESCoil.FluidStorageVolume = - (thisTESCoil.DischargeOnlyRatedDischargeCap * thisTESCoil.StorageCapacitySizingFactor * Constant::SecInHour) / + (thisTESCoil.DischargeOnlyRatedDischargeCap * thisTESCoil.StorageCapacitySizingFactor * Constant::rSecsInHour) / (rho * Cp * deltaT); } else { thisTESCoil.FluidStorageVolume = - (thisTESCoil.CoolingOnlyRatedTotCap * thisTESCoil.StorageCapacitySizingFactor * Constant::SecInHour) / (rho * Cp * deltaT); + (thisTESCoil.CoolingOnlyRatedTotCap * thisTESCoil.StorageCapacitySizingFactor * Constant::rSecsInHour) / (rho * Cp * deltaT); } BaseSizer::reportSizerOutput( state, "Coil:Cooling:DX:SingleSpeed:ThermalStorage", thisTESCoil.Name, "Fluid Storage Volume [m3]", thisTESCoil.FluidStorageVolume); @@ -2390,9 +2358,9 @@ void SizeTESCoil(EnergyPlusData &state, int &TESCoilNum) if (thisTESCoil.IceStorageCapacity == Constant::AutoCalculate) { if (thisTESCoil.DischargeOnlyRatedDischargeCap > 0.0 && thisTESCoil.DischargeOnlyModeAvailable) { thisTESCoil.IceStorageCapacity = - thisTESCoil.DischargeOnlyRatedDischargeCap * thisTESCoil.StorageCapacitySizingFactor * Constant::SecInHour; + thisTESCoil.DischargeOnlyRatedDischargeCap * thisTESCoil.StorageCapacitySizingFactor * Constant::rSecsInHour; } else { - thisTESCoil.IceStorageCapacity = thisTESCoil.CoolingOnlyRatedTotCap * thisTESCoil.StorageCapacitySizingFactor * Constant::SecInHour; + thisTESCoil.IceStorageCapacity = thisTESCoil.CoolingOnlyRatedTotCap * thisTESCoil.StorageCapacitySizingFactor * Constant::rSecsInHour; } BaseSizer::reportSizerOutput(state, "Coil:Cooling:DX:SingleSpeed:ThermalStorage", @@ -2437,8 +2405,6 @@ void CalcTESCoilOffMode(EnergyPlusData &state, int const TESCoilNum) // MODIFIED na // RE-ENGINEERED na - // Using/Aliasing - using ScheduleManager::GetCurrentScheduleValue; Real64 const TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: @@ -2446,7 +2412,7 @@ void CalcTESCoilOffMode(EnergyPlusData &state, int const TESCoilNum) // coil is off; just pass through conditions Real64 StandbyAncillaryPower = 0.0; - if (GetCurrentScheduleValue(state, thisTESCoil.AvailSchedNum) != 0.0) { + if (thisTESCoil.availSched->getCurrentVal() != 0.0) { StandbyAncillaryPower = thisTESCoil.AncillaryControlsPower; } @@ -2770,8 +2736,6 @@ void CalcTESCoilCoolingAndChargeMode(EnergyPlusData &state, // Using/Aliasing Real64 const TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSpecificHeatGlycol; // SUBROUTINE PARAMETER DEFINITIONS: int constexpr MaxIter(30); @@ -2825,9 +2789,9 @@ void CalcTESCoilCoolingAndChargeMode(EnergyPlusData &state, if ((sTES > thisTESCoil.MinimumFluidTankTempLimit) && (sTES < thisTESCoil.MaximumFluidTankTempLimit)) { TESCanBeCharged = true; // find charge limit to reach limits - Real64 const rho = GetDensityGlycol(state, thisTESCoil.StorageFluidName, sTES, thisTESCoil.StorageFluidIndex, RoutineName); + Real64 const rho = thisTESCoil.glycol->getDensity(state, sTES, RoutineName); Real64 const TankMass = rho * thisTESCoil.FluidStorageVolume; - Real64 const CpTank = GetSpecificHeatGlycol(state, thisTESCoil.StorageFluidName, sTES, thisTESCoil.StorageFluidIndex, RoutineName); + Real64 const CpTank = thisTESCoil.glycol->getSpecificHeat(state, sTES, RoutineName); // simple linear approximation of DT/Dt term in McpDT/Dt QdotChargeLimit = TankMass * CpTank * (sTES - thisTESCoil.MinimumFluidTankTempLimit) / TimeStepSysSec; } else { @@ -3180,8 +3144,6 @@ void CalcTESCoilCoolingAndDischargeMode(EnergyPlusData &state, // Using/Aliasing Real64 const TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSpecificHeatGlycol; // SUBROUTINE PARAMETER DEFINITIONS: int constexpr MaxIter(30); @@ -3234,9 +3196,9 @@ void CalcTESCoilCoolingAndDischargeMode(EnergyPlusData &state, sTES = thisTESCoil.FluidTankTempFinalLastTimestep; if ((sTES >= thisTESCoil.MinimumFluidTankTempLimit) && (sTES < thisTESCoil.MaximumFluidTankTempLimit)) { TESHasSomeCharge = true; - Real64 const rho = GetDensityGlycol(state, thisTESCoil.StorageFluidName, sTES, thisTESCoil.StorageFluidIndex, RoutineName); + Real64 const rho = thisTESCoil.glycol->getDensity(state, sTES, RoutineName); Real64 const TankMass = rho * thisTESCoil.FluidStorageVolume; - Real64 const CpTank = GetSpecificHeatGlycol(state, thisTESCoil.StorageFluidName, sTES, thisTESCoil.StorageFluidIndex, RoutineName); + Real64 const CpTank = thisTESCoil.glycol->getSpecificHeat(state, sTES, RoutineName); // simple linear approximation of DT/Dt term in McpDT/Dt QdotDischargeLimit = TankMass * CpTank * (thisTESCoil.MaximumFluidTankTempLimit - sTES) / TimeStepSysSec; } else { @@ -3527,8 +3489,6 @@ void CalcTESCoilChargeOnlyMode(EnergyPlusData &state, int const TESCoilNum) // Using/Aliasing Real64 const TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSpecificHeatGlycol; // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("CalcTESCoilChargeOnlyMode"); @@ -3592,11 +3552,11 @@ void CalcTESCoilChargeOnlyMode(EnergyPlusData &state, int const TESCoilNum) TESCanBeCharged = true; // find charge limit to reach limits // density of water in tank (kg/m3) - Real64 const rho = GetDensityGlycol(state, thisTESCoil.StorageFluidName, sTES, thisTESCoil.StorageFluidIndex, RoutineName); + Real64 const rho = thisTESCoil.glycol->getDensity(state, sTES, RoutineName); // Mass of water in tank (kg) Real64 const TankMass = rho * thisTESCoil.FluidStorageVolume; // Specific heat of water in tank (J/kg K) - Real64 const CpTank = GetSpecificHeatGlycol(state, thisTESCoil.StorageFluidName, sTES, thisTESCoil.StorageFluidIndex, RoutineName); + Real64 const CpTank = thisTESCoil.glycol->getSpecificHeat(state, sTES, RoutineName); // simple linear approximation of DT/Dt term in McpDT/Dt QdotChargeLimit = TankMass * CpTank * (sTES - thisTESCoil.MinimumFluidTankTempLimit) / TimeStepSysSec; } else { @@ -3691,8 +3651,6 @@ void CalcTESCoilDischargeOnlyMode(EnergyPlusData &state, int const TESCoilNum, R // Using/Aliasing Real64 const TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSpecificHeatGlycol; // SUBROUTINE PARAMETER DEFINITIONS: int constexpr MaxIter(30); @@ -3714,11 +3672,11 @@ void CalcTESCoilDischargeOnlyMode(EnergyPlusData &state, int const TESCoilNum, R if ((sTES >= thisTESCoil.MinimumFluidTankTempLimit) && (sTES < thisTESCoil.MaximumFluidTankTempLimit)) { TESHasSomeCharge = true; // density of water in tank (kg/m3) - Real64 const rho = GetDensityGlycol(state, thisTESCoil.StorageFluidName, sTES, thisTESCoil.StorageFluidIndex, StorageTankName); + Real64 const rho = thisTESCoil.glycol->getDensity(state, sTES, StorageTankName); // Mass of water in tank (kg) Real64 const TankMass = rho * thisTESCoil.FluidStorageVolume; // Specific heat of water in tank (J/kg K) - Real64 const CpTank = GetSpecificHeatGlycol(state, thisTESCoil.StorageFluidName, sTES, thisTESCoil.StorageFluidIndex, StorageTankName); + Real64 const CpTank = thisTESCoil.glycol->getSpecificHeat(state, sTES, StorageTankName); // simple linear approximation of DT/Dt term in McpDT/Dt QdotDischargeLimit = TankMass * CpTank * (thisTESCoil.MaximumFluidTankTempLimit - sTES) / TimeStepSysSec; } else { @@ -3993,8 +3951,6 @@ void CalcTESWaterStorageTank(EnergyPlusData &state, int const TESCoilNum) // Using/Aliasing Real64 const TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSpecificHeatGlycol; using WaterThermalTanks::WaterThermalTankData; auto &thisTESCoil = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum); @@ -4022,11 +3978,11 @@ void CalcTESWaterStorageTank(EnergyPlusData &state, int const TESCoilNum) // Source side inlet temperature (C) Real64 const SourceInletTemp = thisTESCoil.FluidTankTempFinalLastTimestep; // density of water in tank (kg/m3) - Real64 const rho = GetDensityGlycol(state, thisTESCoil.StorageFluidName, TankTemp, thisTESCoil.StorageFluidIndex, RoutineName); + Real64 const rho = thisTESCoil.glycol->getDensity(state, TankTemp, RoutineName); // Mass of water in tank (kg) Real64 const TankMass = rho * thisTESCoil.FluidStorageVolume; // Specific heat of water in tank (J/kg K) - Real64 const CpTank = GetSpecificHeatGlycol(state, thisTESCoil.StorageFluidName, TankTemp, thisTESCoil.StorageFluidIndex, RoutineName); + Real64 const CpTank = thisTESCoil.glycol->getSpecificHeat(state, TankTemp, RoutineName); // Use side flow rate, including effectiveness factor (kg/s) Real64 const UseMassFlowRate = thisTESCoil.TESPlantConnectionAvailable @@ -4057,11 +4013,9 @@ void CalcTESWaterStorageTank(EnergyPlusData &state, int const TESCoilNum) if (thisTESCoil.TESPlantConnectionAvailable) { // Specific heat of fluid in plant connection (J/kg K) - Real64 const CpPlantConnection = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(thisTESCoil.TESPlantLoopNum).FluidName, - state.dataLoopNodes->Node(thisTESCoil.TESPlantInletNodeNum).Temp, - state.dataPlnt->PlantLoop(thisTESCoil.TESPlantLoopNum).FluidIndex, - calcTESIceStorageTank); + Real64 const CpPlantConnection = + state.dataPlnt->PlantLoop(thisTESCoil.TESPlantLoopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(thisTESCoil.TESPlantInletNodeNum).Temp, calcTESIceStorageTank); thisTESCoil.QdotPlant = state.dataLoopNodes->Node(thisTESCoil.TESPlantInletNodeNum).MassFlowRate * CpPlantConnection * thisTESCoil.TESPlantEffectiveness * (UseInletTemp - NewTankTemp); @@ -4103,7 +4057,6 @@ void CalcTESIceStorageTank(EnergyPlusData &state, int const TESCoilNum) // Using/Aliasing Real64 const TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - using FluidProperties::GetSpecificHeatGlycol; // SUBROUTINE PARAMETER DEFINITIONS: constexpr Real64 FreezingTemp(0.0); // zero degrees C @@ -4124,11 +4077,7 @@ void CalcTESIceStorageTank(EnergyPlusData &state, int const TESCoilNum) if (thisTESCoil.TESPlantConnectionAvailable) { auto const &inletNode = state.dataLoopNodes->Node(thisTESCoil.TESPlantInletNodeNum); - Real64 const Cp = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(thisTESCoil.TESPlantLoopNum).FluidName, - inletNode.Temp, - state.dataPlnt->PlantLoop(thisTESCoil.TESPlantLoopNum).FluidIndex, - RoutineName); + Real64 const Cp = state.dataPlnt->PlantLoop(thisTESCoil.TESPlantLoopNum).glycol->getSpecificHeat(state, inletNode.Temp, RoutineName); thisTESCoil.QdotPlant = inletNode.MassFlowRate * Cp * thisTESCoil.TESPlantEffectiveness * (inletNode.Temp - FreezingTemp); thisTESCoil.Q_Plant = thisTESCoil.QdotPlant * TimeStepSysSec; @@ -4175,11 +4124,10 @@ void UpdateColdWeatherProtection(EnergyPlusData &state, int const TESCoilNum) // Using/Aliasing Real64 const TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - using ScheduleManager::GetCurrentScheduleValue; if ((state.dataLoopNodes->Node(state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).StorageAmbientNodeNum).Temp < state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ColdWeatherMinimumTempLimit) && - (GetCurrentScheduleValue(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).AvailSchedNum) != 0.0)) { + (state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).availSched->getCurrentVal() != 0.0)) { state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElectColdWeatherPower = state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ColdWeatherAncillaryPower; @@ -4207,7 +4155,7 @@ void UpdateEvaporativeCondenserBasinHeater(EnergyPlusData &state, int const TESC CalcBasinHeaterPower(state, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).BasinHeaterPowerFTempDiff, - state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).BasinHeaterAvailSchedNum, + state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).basinHeaterAvailSched, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).BasinHeaterSetpointTemp, state.dataPackagedThermalStorageCoil->TESCoil(TESCoilNum).ElectEvapCondBasinHeaterPower); diff --git a/src/EnergyPlus/PackagedThermalStorageCoil.hh b/src/EnergyPlus/PackagedThermalStorageCoil.hh index 3f126290599..369366e2ebe 100644 --- a/src/EnergyPlus/PackagedThermalStorageCoil.hh +++ b/src/EnergyPlus/PackagedThermalStorageCoil.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -59,6 +59,7 @@ #include #include #include +#include #include namespace EnergyPlus { @@ -128,12 +129,12 @@ namespace PackagedThermalStorageCoil { struct PackagedTESCoolingCoilStruct { // Members - std::string Name; // Name of TES cooling package - int AvailSchedNum; // pointer to availability schedule - PTSCCtrlType ModeControlType; // how are operation modes controlled - int ControlModeSchedNum; // pointer to control schedule if used - bool EMSControlModeOn; // if true, then EMS actuator has been used - Real64 EMSControlModeValue; // value to use from EMS actuator for control mode + std::string Name; // Name of TES cooling package + Sched::Schedule *availSched = nullptr; // availability schedule + PTSCCtrlType ModeControlType; // how are operation modes controlled + Sched::Schedule *controlModeSched = nullptr; // control schedule if used + bool EMSControlModeOn; // if true, then EMS actuator has been used + Real64 EMSControlModeValue; // value to use from EMS actuator for control mode PTSCOperatingMode CurControlMode = PTSCOperatingMode::Off; int curControlModeReport = static_cast(PTSCOperatingMode::Off); int ControlModeErrorIndex; @@ -309,7 +310,7 @@ namespace PackagedThermalStorageCoil { Real64 EvapCondPumpElecNomPower; // Nominal power input to the evap condenser water circulation pump [W] Real64 EvapCondPumpElecEnergy; // Electric energy used by condenser water circulation pump [J] Real64 BasinHeaterPowerFTempDiff; // Basin heater power for evaporatively cooled condensers [W/K] - int BasinHeaterAvailSchedNum; // basin heater availability schedule pointer num + Sched::Schedule *basinHeaterAvailSched = nullptr; // basin heater availability schedule pointer num Real64 BasinHeaterSetpointTemp; // evap water basin temperature setpoint [C] EvapWaterSupply EvapWaterSupplyMode; // where does evap water come from std::string EvapWaterSupplyName; // name of water source e.g. water storage tank @@ -320,9 +321,10 @@ namespace PackagedThermalStorageCoil { int CondensateTankID; int CondensateTankSupplyARRID; // TES tank - MediaType StorageMedia; // water/fluid or ice based TES - std::string StorageFluidName; // if user defined, name of fluid type - int StorageFluidIndex; // if user defined, index of fluid type + MediaType StorageMedia; // water/fluid or ice based TES + std::string StorageFluidName; // if user defined, name of fluid type + Fluid::GlycolProps *glycol = nullptr; + Real64 FluidStorageVolume; // volume of water in storage tank for water systems [m3/s] Real64 IceStorageCapacity; // capacity of storage in J Real64 StorageCapacitySizingFactor; // storage time used to autocalculate capacity [hr] @@ -376,8 +378,8 @@ namespace PackagedThermalStorageCoil { // Default Constructor PackagedTESCoolingCoilStruct() - : AvailSchedNum(0), ModeControlType(PTSCCtrlType::Invalid), ControlModeSchedNum(0), EMSControlModeOn(false), EMSControlModeValue(0.0), - ControlModeErrorIndex(0), RatedEvapAirVolFlowRate(0.0), RatedEvapAirMassFlowRate(0.0), EvapAirInletNodeNum(0), EvapAirOutletNodeNum(0), + : ModeControlType(PTSCCtrlType::Invalid), EMSControlModeOn(false), EMSControlModeValue(0.0), ControlModeErrorIndex(0), + RatedEvapAirVolFlowRate(0.0), RatedEvapAirMassFlowRate(0.0), EvapAirInletNodeNum(0), EvapAirOutletNodeNum(0), CoolingOnlyModeIsAvailable(false), CoolingOnlyRatedTotCap(0.0), CoolingOnlyRatedSHR(0.0), CoolingOnlyRatedCOP(0.0), CoolingOnlyCapFTempCurve(0), CoolingOnlyCapFTempObjectNum(0), CoolingOnlyCapFFlowCurve(0), CoolingOnlyCapFFlowObjectNum(0), CoolingOnlyEIRFTempCurve(0), CoolingOnlyEIRFTempObjectNum(0), CoolingOnlyEIRFFlowCurve(0), CoolingOnlyEIRFFlowObjectNum(0), @@ -417,19 +419,19 @@ namespace PackagedThermalStorageCoil { AncillaryControlsPower(0.0), ColdWeatherMinimumTempLimit(0.0), ColdWeatherAncillaryPower(0.0), CondAirInletNodeNum(0), CondAirOutletNodeNum(0), CondenserAirVolumeFlow(0.0), CondenserAirFlowSizingFactor(0.0), CondenserAirMassFlow(0.0), EvapCondEffect(0.0), CondInletTemp(0.0), EvapCondPumpElecNomPower(0.0), EvapCondPumpElecEnergy(0.0), BasinHeaterPowerFTempDiff(0.0), - BasinHeaterAvailSchedNum(0), BasinHeaterSetpointTemp(0.0), EvapWaterSupplyMode(EvapWaterSupply::WaterSupplyFromMains), - EvapWaterSupTankID(0), EvapWaterTankDemandARRID(0), CondensateCollectMode(CondensateAction::Discard), CondensateTankID(0), - CondensateTankSupplyARRID(0), StorageMedia(MediaType::Invalid), StorageFluidIndex(0), FluidStorageVolume(0.0), IceStorageCapacity(0.0), - StorageCapacitySizingFactor(0.0), MinimumFluidTankTempLimit(0.0), MaximumFluidTankTempLimit(100.0), RatedFluidTankTemp(0.0), - StorageAmbientNodeNum(0), StorageUA(0.0), TESPlantConnectionAvailable(false), TESPlantInletNodeNum(0), TESPlantOutletNodeNum(0), - TESPlantLoopNum(0), TESPlantLoopSideNum(DataPlant::LoopSideLocation::Invalid), TESPlantBranchNum(0), TESPlantCompNum(0), - TESPlantDesignVolumeFlowRate(0.0), TESPlantDesignMassFlowRate(0.0), TESPlantEffectiveness(0.0), TimeElapsed(0.0), IceFracRemain(0.0), - IceFracRemainLastTimestep(0.0), FluidTankTempFinal(0.0), FluidTankTempFinalLastTimestep(0.0), QdotPlant(0.0), Q_Plant(0.0), - QdotAmbient(0.0), Q_Ambient(0.0), QdotTES(0.0), Q_TES(0.0), ElecCoolingPower(0.0), ElecCoolingEnergy(0.0), EvapTotCoolingRate(0.0), - EvapTotCoolingEnergy(0.0), EvapSensCoolingRate(0.0), EvapSensCoolingEnergy(0.0), EvapLatCoolingRate(0.0), EvapLatCoolingEnergy(0.0), - RuntimeFraction(0.0), CondenserRuntimeFraction(0.0), ElectColdWeatherPower(0.0), ElectColdWeatherEnergy(0.0), - ElectEvapCondBasinHeaterPower(0.0), ElectEvapCondBasinHeaterEnergy(0.0), EvapWaterConsumpRate(0.0), EvapWaterConsump(0.0), - EvapWaterStarvMakupRate(0.0), EvapWaterStarvMakup(0.0), EvapCondPumpElecPower(0.0), EvapCondPumpElecConsumption(0.0) + BasinHeaterSetpointTemp(0.0), EvapWaterSupplyMode(EvapWaterSupply::WaterSupplyFromMains), EvapWaterSupTankID(0), + EvapWaterTankDemandARRID(0), CondensateCollectMode(CondensateAction::Discard), CondensateTankID(0), CondensateTankSupplyARRID(0), + StorageMedia(MediaType::Invalid), FluidStorageVolume(0.0), IceStorageCapacity(0.0), StorageCapacitySizingFactor(0.0), + MinimumFluidTankTempLimit(0.0), MaximumFluidTankTempLimit(100.0), RatedFluidTankTemp(0.0), StorageAmbientNodeNum(0), StorageUA(0.0), + TESPlantConnectionAvailable(false), TESPlantInletNodeNum(0), TESPlantOutletNodeNum(0), TESPlantLoopNum(0), + TESPlantLoopSideNum(DataPlant::LoopSideLocation::Invalid), TESPlantBranchNum(0), TESPlantCompNum(0), TESPlantDesignVolumeFlowRate(0.0), + TESPlantDesignMassFlowRate(0.0), TESPlantEffectiveness(0.0), TimeElapsed(0.0), IceFracRemain(0.0), IceFracRemainLastTimestep(0.0), + FluidTankTempFinal(0.0), FluidTankTempFinalLastTimestep(0.0), QdotPlant(0.0), Q_Plant(0.0), QdotAmbient(0.0), Q_Ambient(0.0), + QdotTES(0.0), Q_TES(0.0), ElecCoolingPower(0.0), ElecCoolingEnergy(0.0), EvapTotCoolingRate(0.0), EvapTotCoolingEnergy(0.0), + EvapSensCoolingRate(0.0), EvapSensCoolingEnergy(0.0), EvapLatCoolingRate(0.0), EvapLatCoolingEnergy(0.0), RuntimeFraction(0.0), + CondenserRuntimeFraction(0.0), ElectColdWeatherPower(0.0), ElectColdWeatherEnergy(0.0), ElectEvapCondBasinHeaterPower(0.0), + ElectEvapCondBasinHeaterEnergy(0.0), EvapWaterConsumpRate(0.0), EvapWaterConsump(0.0), EvapWaterStarvMakupRate(0.0), + EvapWaterStarvMakup(0.0), EvapCondPumpElecPower(0.0), EvapCondPumpElecConsumption(0.0) { } }; @@ -502,6 +504,10 @@ struct PackagedThermalStorageCoilData : BaseGlobalStruct Array1D_bool MyEnvrnFlag; // flag for init once at start of environment Array1D_bool MyWarmupFlag; // flag for init after warmup complete + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.cc b/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.cc index 222beab8b28..3697d3e3572 100644 --- a/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.cc +++ b/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -95,12 +95,12 @@ namespace Material { Tau2 = this->deltaTempMeltingHigh; if (updatedTempTDT < TempLowPCM) { phaseChangeState = Phase::Crystallized; - } else if (updatedTempTDT >= TempLowPCM && updatedTempTDT <= TempHighPCM) { + } else if (updatedTempTDT <= TempHighPCM) { phaseChangeState = Phase::Melting; if (prevPhaseChangeState == Phase::Freezing || prevPhaseChangeState == Phase::Transition) { phaseChangeState = Phase::Transition; } - } else if (updatedTempTDT > TempHighPCM) { + } else { phaseChangeState = Phase::Liquid; } } else { // phaseChangeDeltaT > 0 @@ -109,12 +109,12 @@ namespace Material { Tau2 = this->deltaTempFreezingHigh; if (updatedTempTDT < TempLowPCF) { phaseChangeState = Phase::Crystallized; - } else if (updatedTempTDT >= TempLowPCF && updatedTempTDT <= TempHighPCF) { + } else if (updatedTempTDT <= TempHighPCF) { phaseChangeState = Phase::Freezing; if (prevPhaseChangeState == Phase::Melting || prevPhaseChangeState == Phase::Transition) { phaseChangeState = Phase::Transition; } - } else if (updatedTempTDT > TempHighPCF) { + } else { phaseChangeState = Phase::Liquid; } } @@ -266,13 +266,11 @@ namespace Material { return (Cp1 + DEta1); } else if (T == criticalTemperature) { return (EnthalpyNew - EnthalpyOld) / (temperatureCurrent - temperaturePrev); - } else if (T > criticalTemperature) { + } else { Real64 DEta2 = (this->totalLatentHeat * (T - criticalTemperature) * exp(-2 * std::abs(T - criticalTemperature) / tau2)) / (tau2 * std::abs(T - criticalTemperature)); Real64 Cp2 = this->specificHeatLiquid; return Cp2 + DEta2; - } else { - return 0; } } @@ -352,26 +350,25 @@ namespace Material { auto *mat = s_mat->materials(matNum); if (mat->group != Group::Regular) { - ShowSevereCustomMessage(state, eoh, format("Material {} is not a Regular material.", mat->Name)); + ShowSevereCustom(state, eoh, format("Material {} is not a Regular material.", mat->Name)); ErrorsFound = true; continue; } if (mat->hasPCM) { - ShowSevereCustomMessage( - state, eoh, format("Material {} already has {} properties defined.", mat->Name, s_ipsc->cCurrentModuleObject)); + ShowSevereCustom(state, eoh, format("Material {} already has {} properties defined.", mat->Name, s_ipsc->cCurrentModuleObject)); ErrorsFound = true; continue; } if (mat->hasEMPD) { - ShowSevereCustomMessage(state, eoh, format("Material {} already has EMPD properties defined.", mat->Name)); + ShowSevereCustom(state, eoh, format("Material {} already has EMPD properties defined.", mat->Name)); ErrorsFound = true; continue; } if (mat->hasHAMT) { - ShowSevereCustomMessage(state, eoh, format("Material {} already has HAMT properties defined.", mat->Name)); + ShowSevereCustom(state, eoh, format("Material {} already has HAMT properties defined.", mat->Name)); ErrorsFound = true; continue; } diff --git a/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.hh b/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.hh index d0e87ddef26..d5c01daa842 100644 --- a/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.hh +++ b/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -143,6 +143,10 @@ struct HysteresisPhaseChangeData : BaseGlobalStruct bool getHysteresisModels = true; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/PhotovoltaicThermalCollectors.cc b/src/EnergyPlus/PhotovoltaicThermalCollectors.cc index 1dcca089a10..711bff799f0 100644 --- a/src/EnergyPlus/PhotovoltaicThermalCollectors.cc +++ b/src/EnergyPlus/PhotovoltaicThermalCollectors.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -186,6 +186,8 @@ namespace PhotovoltaicThermalCollectors { // PURPOSE OF THIS SUBROUTINE: // Get input for PVT Simple objects + static constexpr std::string_view routineName = "GetPVTSimpleCollectorsInput"; + int Item; // Item to be "gotten" int NumAlphas; // Number of Alphas for each GetObjectItem call int NumNumbers; // Number of Numbers for each GetObjectItem call @@ -206,20 +208,24 @@ namespace PhotovoltaicThermalCollectors { state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + auto &thisTmpSimplePVTperf = tmpSimplePVTperf(Item); thisTmpSimplePVTperf.Name = state.dataIPShortCut->cAlphaArgs(1); thisTmpSimplePVTperf.ThermEfficMode = static_cast(getEnumValue(ThermEfficTypeNamesUC, Util::makeUPPER(state.dataIPShortCut->cAlphaArgs(2)))); thisTmpSimplePVTperf.ThermalActiveFract = state.dataIPShortCut->rNumericArgs(1); thisTmpSimplePVTperf.ThermEffic = state.dataIPShortCut->rNumericArgs(2); - thisTmpSimplePVTperf.ThermEffSchedNum = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(3)); - if ((thisTmpSimplePVTperf.ThermEffSchedNum == 0) && (thisTmpSimplePVTperf.ThermEfficMode == ThermEfficEnum::SCHEDULED)) { - ShowSevereError(state, - format("GetPVTSimpleCollectorsInput: Invalid efficiency schedule name passed={}, object type={}, object name={}", - state.dataIPShortCut->cAlphaArgs(3), - state.dataIPShortCut->cCurrentModuleObject, - thisTmpSimplePVTperf.Name)); - ErrorsFound = true; + + if (thisTmpSimplePVTperf.ThermEfficMode == ThermEfficEnum::SCHEDULED) { + if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3)); + ErrorsFound = true; + } else if ((thisTmpSimplePVTperf.thermEffSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3)); + ErrorsFound = true; + } } thisTmpSimplePVTperf.SurfEmissivity = state.dataIPShortCut->rNumericArgs(3); } @@ -229,16 +235,13 @@ namespace PhotovoltaicThermalCollectors { { // PURPOSE OF THIS SUBROUTINE: // Get input for BIPVT objects + static constexpr std::string_view routineName = "GetBIPVTCollectorsInput"; int Item; // Item to be "gotten" int NumAlphas; // Number of Alphas for each GetObjectItem call int NumNumbers; // Number of Numbers for each GetObjectItem call int IOStatus; // Used in GetObjectItem - int Found; - bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine using DataSurfaces::OSCMData; - using ScheduleManager::GetScheduleIndex; - using ScheduleManager::ScheduleAlwaysOn; tmpBIPVTperf.allocate(NumBIPVTPerform); for (Item = 1; Item <= NumBIPVTPerform; ++Item) { @@ -254,17 +257,19 @@ namespace PhotovoltaicThermalCollectors { state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + auto &thisTmpBIPVTperf = tmpBIPVTperf(Item); thisTmpBIPVTperf.Name = state.dataIPShortCut->cAlphaArgs(1); thisTmpBIPVTperf.OSCMName = state.dataIPShortCut->cAlphaArgs(2); - Found = Util::FindItemInList(thisTmpBIPVTperf.OSCMName, state.dataSurface->OSCM); + int Found = Util::FindItemInList(thisTmpBIPVTperf.OSCMName, state.dataSurface->OSCM); if (Found == 0) { ShowSevereError(state, format("GetBIPVTCollectorsInput: Invalid outside model name={}, object type={}, object name={}", thisTmpBIPVTperf.OSCMName, state.dataIPShortCut->cCurrentModuleObject, thisTmpBIPVTperf.Name)); - ErrorsFound = true; } thisTmpBIPVTperf.OSCMPtr = Found; thisTmpBIPVTperf.PVEffGapWidth = state.dataIPShortCut->rNumericArgs(1); @@ -280,19 +285,12 @@ namespace PhotovoltaicThermalCollectors { thisTmpBIPVTperf.ThGlass = state.dataIPShortCut->rNumericArgs(11); thisTmpBIPVTperf.RIndGlass = state.dataIPShortCut->rNumericArgs(12); thisTmpBIPVTperf.ECoffGlass = state.dataIPShortCut->rNumericArgs(13); + if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { - thisTmpBIPVTperf.SchedPtr = ScheduleAlwaysOn; - } else { - thisTmpBIPVTperf.SchedPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(3)); - if (thisTmpBIPVTperf.SchedPtr == 0) { - ShowSevereError(state, - format("GetBIPVTCollectorsInput: Invalid schedule name ={}, object type={}, object name={}", - state.dataIPShortCut->cAlphaArgs(3), - state.dataIPShortCut->cCurrentModuleObject, - thisTmpBIPVTperf.Name)); - ErrorsFound = true; - continue; - } + thisTmpBIPVTperf.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisTmpBIPVTperf.availSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3)); + continue; } } } @@ -701,11 +699,7 @@ namespace PhotovoltaicThermalCollectors { switch (this->WorkingFluidType) { case WorkingFluidEnum::LIQUID: { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->WPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->WPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->WPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); this->MaxMassFlowRate = this->DesignVolFlowRate * rho; @@ -772,13 +766,13 @@ namespace PhotovoltaicThermalCollectors { } Real64 DesignVolFlowRateDes = 0.0; // Autosize design volume flow for reporting - int PltSizNum = 0; // Plant Sizing index corresponding to CurLoopNum bool ErrorsFound = false; if (this->WorkingFluidType == WorkingFluidEnum::LIQUID) { if (!allocated(state.dataSize->PlantSizData)) return; if (!allocated(state.dataPlnt->PlantLoop)) return; + int PltSizNum = 0; // Plant Sizing index corresponding to CurLoopNum if (this->WPlantLoc.loopNum > 0) { PltSizNum = state.dataPlnt->PlantLoop(this->WPlantLoc.loopNum).PlantSizNum; @@ -867,7 +861,7 @@ namespace PhotovoltaicThermalCollectors { } } else { CheckSysSizing(state, "SolarCollector:FlatPlate:PhotovoltaicThermal", this->Name); - auto &thisFinalSysSizing(state.dataSize->FinalSysSizing(state.dataSize->CurSysNum)); + auto const &thisFinalSysSizing = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum); if (state.dataSize->CurOASysNum > 0) { DesignVolFlowRateDes = thisFinalSysSizing.DesOutAirVolFlow; } else { @@ -1052,7 +1046,7 @@ namespace PhotovoltaicThermalCollectors { Eff = this->Simple.ThermEffic; } break; case ThermEfficEnum::SCHEDULED: { - Eff = ScheduleManager::GetCurrentScheduleValue(state, this->Simple.ThermEffSchedNum); + Eff = this->Simple.thermEffSched->getCurrentVal(); this->Simple.ThermEffic = Eff; } break; default: @@ -1190,7 +1184,6 @@ namespace PhotovoltaicThermalCollectors { // ??? static std::string const RoutineName("CalcBIPVTcollectors"); - using ScheduleManager::GetCurrentScheduleValue; int InletNode = this->HVACInletNodeNum; Real64 mdot = this->MassFlowRate; @@ -1202,7 +1195,7 @@ namespace PhotovoltaicThermalCollectors { Real64 Tcollector(Tinlet); this->OperatingMode = PVTMode::Heating; - if (this->HeatingUseful && this->BypassDamperOff && (GetCurrentScheduleValue(state, this->BIPVT.SchedPtr) > 0.0)) { + if (this->HeatingUseful && this->BypassDamperOff && (this->BIPVT.availSched->getCurrentVal() > 0.0)) { if ((state.dataLoopNodes->Node(this->HVACOutletNodeNum).TempSetPoint - Tinlet) > 0.1) { calculateBIPVTMaxHeatGain(state, @@ -1229,7 +1222,7 @@ namespace PhotovoltaicThermalCollectors { this->Report.BypassStatus = BypassFraction; if (PotentialHeatGain > 0.0) this->BIPVT.LastCollectorTemp = Tcollector; - } else if (this->CoolingUseful && this->BypassDamperOff && (GetCurrentScheduleValue(state, this->BIPVT.SchedPtr) > 0.0)) { + } else if (this->CoolingUseful && this->BypassDamperOff && (this->BIPVT.availSched->getCurrentVal() > 0.0)) { this->OperatingMode = PVTMode::Cooling; if ((Tinlet - state.dataLoopNodes->Node(this->HVACOutletNodeNum).TempSetPoint) > 0.1) { @@ -1450,11 +1443,10 @@ namespace PhotovoltaicThermalCollectors { 110.4)); // Sutherland's formula https://www.grc.nasa.gov/www/k-12/airplane/viscosity.html Sutherland's constant = 198.72 R // converted to K =>110.4. At 273.15, Viscosity is 1.71E-5 as per Incropera, et al 6th ed. Temp range approx 273K - 373K k_air = 0.000000000015207 * std::pow(t_film + 273.15, 3.0) - 0.000000048574 * std::pow(t_film + 273.15, 2.0) + - 0.00010184 * (t_film + 273.15) - 0.00039333; // Dumas, A., and Trancossi, M., SAE Technical Papers, 2009 - prandtl_air = 0.680 + 0.000000469 * std::pow(t_film + 273.15 - 540.0, 2.0); // The Schock Absorber Handbook, 2nd Ed. John C. Dixon 2007 - density_air = 101.3 / (0.287 * (t_film + 273.15)); // Ideal gas law - diffusivity_air = k_air / (cp_amb * density_air); // definition - kin_viscosity_air = mu_air / density_air; // definition + 0.00010184 * (t_film + 273.15) - 0.00039333; // Dumas, A., and Trancossi, M., SAE Technical Papers, 2009 + density_air = 101.3 / (0.287 * (t_film + 273.15)); // Ideal gas law + diffusivity_air = k_air / (cp_amb * density_air); // definition + kin_viscosity_air = mu_air / density_air; // definition // duffie and beckman correlation for nat convection - This is for exterior raleigh = (gravity * (1.0 / (0.5 * (tamb + tpvg) + 273.15)) * (std::max((Real64)(0.000001), std::abs(tpvg - tamb))) * std::pow(dhyd, 3)) / @@ -1643,17 +1635,17 @@ namespace PhotovoltaicThermalCollectors { // PURPOSE OF THIS SUBROUTINE: // Solve a system of linear equations using Gaussian elimination and back substitution method. - Real64 sum, dummy1, dummy2, mm, small(1.0e-10); - int i, j, ii, p, k, m(3); - bool coeff_not_zero; + int p; + int constexpr m = 3; + Real64 constexpr small = 1.0e-10; - for (i = 0; i < m; i++) { + for (int i = 0; i < m; i++) { y[i] = 0.0; } - for (i = 0; i <= (m - 2); i++) { - coeff_not_zero = false; - for (j = i; j <= (m - 1); j++) { + for (int i = 0; i <= (m - 2); i++) { + bool coeff_not_zero = false; + for (int j = i; j <= (m - 1); j++) { if (std::abs(jj[j * m + i]) > small) { coeff_not_zero = true; p = j; @@ -1663,20 +1655,20 @@ namespace PhotovoltaicThermalCollectors { if (coeff_not_zero) { if (p != i) { - dummy2 = f[i]; + Real64 dummy2 = f[i]; f[i] = f[p]; f[p] = dummy2; - for (j = 0; j <= (m - 1); j++) { - dummy1 = jj[i * m + j]; + for (int j = 0; j <= (m - 1); j++) { + Real64 dummy1 = jj[i * m + j]; jj[i * m + j] = jj[p * m + j]; jj[p * m + j] = dummy1; } } - for (j = (i + 1); j <= (m - 1); j++) { + for (int j = (i + 1); j <= (m - 1); j++) { if (std::abs(jj[i * m + i]) < small) jj[i * m + i] = small; - mm = jj[j * m + i] / jj[i * m + i]; + Real64 mm = jj[j * m + i] / jj[i * m + i]; f[j] = f[j] - mm * f[i]; - for (k = 0; k <= (m - 1); k++) { + for (int k = 0; k <= (m - 1); k++) { jj[j * m + k] = jj[j * m + k] - mm * jj[i * m + k]; } } @@ -1684,10 +1676,10 @@ namespace PhotovoltaicThermalCollectors { } if (std::abs(jj[(m - 1) * m + m - 1]) < small) jj[(m - 1) * m + m - 1] = small; y[m - 1] = f[m - 1] / jj[(m - 1) * m + m - 1]; - sum = 0.0; - for (i = 0; i <= (m - 2); i++) { - ii = m - 2 - i; - for (j = ii; j <= (m - 1); j++) { + Real64 sum = 0.0; + for (int i = 0; i <= (m - 2); i++) { + int ii = m - 2 - i; + for (int j = ii; j <= (m - 1); j++) { sum = sum + jj[ii * m + j] * y[j]; } if (std::abs(jj[ii * m + ii]) < small) jj[ii * m + ii] = small; @@ -1745,25 +1737,19 @@ namespace PhotovoltaicThermalCollectors { // SUBROUTINE INFORMATION: // AUTHOR Brent Griffith // DATE WRITTEN August 2008 - // MODIFIED na - // RE-ENGINEERED na - - int InletNode; - int OutletNode; - int thisOSCM; { switch (this->WorkingFluidType) { case WorkingFluidEnum::LIQUID: { - InletNode = this->PlantInletNodeNum; - OutletNode = this->PlantOutletNodeNum; + int InletNode = this->PlantInletNodeNum; + int OutletNode = this->PlantOutletNodeNum; PlantUtilities::SafeCopyPlantNode(state, InletNode, OutletNode); state.dataLoopNodes->Node(OutletNode).Temp = this->Report.ToutletWorkFluid; } break; case WorkingFluidEnum::AIR: { - InletNode = this->HVACInletNodeNum; - OutletNode = this->HVACOutletNodeNum; + int InletNode = this->HVACInletNodeNum; + int OutletNode = this->HVACOutletNodeNum; // Set the outlet nodes for properties that just pass through & not used state.dataLoopNodes->Node(OutletNode).Quality = state.dataLoopNodes->Node(InletNode).Quality; @@ -1782,7 +1768,7 @@ namespace PhotovoltaicThermalCollectors { // update the OtherSideConditionsModel coefficients for BIPVT if (this->ModelType == PVTModelType::BIPVT) { - thisOSCM = this->BIPVT.OSCMPtr; + int thisOSCM = this->BIPVT.OSCMPtr; state.dataSurface->OSCM(thisOSCM).TConv = this->BIPVT.Tplen; state.dataSurface->OSCM(thisOSCM).HConv = this->BIPVT.HcPlen; state.dataSurface->OSCM(thisOSCM).TRad = this->BIPVT.Tcoll; diff --git a/src/EnergyPlus/PhotovoltaicThermalCollectors.hh b/src/EnergyPlus/PhotovoltaicThermalCollectors.hh index 96e8be2d34c..fab788e09a8 100644 --- a/src/EnergyPlus/PhotovoltaicThermalCollectors.hh +++ b/src/EnergyPlus/PhotovoltaicThermalCollectors.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -97,7 +97,7 @@ namespace PhotovoltaicThermalCollectors { Real64 ThermalActiveFract = 0.0; // fraction of surface area with active thermal collection ThermEfficEnum ThermEfficMode = ThermEfficEnum::FIXED; // setting for how therm effic is determined Real64 ThermEffic = 0.0; // fixed or current Therm efficiency - int ThermEffSchedNum = 0; // pointer to schedule for therm effic (if any) + Sched::Schedule *thermEffSched = nullptr; // pointer to schedule for therm effic (if any) Real64 SurfEmissivity = 0.0; // surface emittance in long wave IR Real64 LastCollectorTemp = 0.0; // store previous temperature }; @@ -105,27 +105,27 @@ namespace PhotovoltaicThermalCollectors { struct BIPVTModelStruct { std::string Name; - std::string OSCMName; // OtherSideConditionsModel - int OSCMPtr = 0; // OtherSideConditionsModel index - int SchedPtr = 0; // Availablity schedule - Real64 PVEffGapWidth = 0.0; // Effective Gap Plenum Behind PV modules (m) - Real64 PVCellTransAbsProduct = 0.0; // PV cell Transmittance-Absorptance prodiuct - Real64 BackMatTranAbsProduct = 0.0; // Backing Material Normal Transmittance-Absorptance Product - Real64 CladTranAbsProduct = 0.0; // Cladding Normal Transmittance-Absorptance Product - Real64 PVAreaFract = 0.0; // Fraction of collector gross area covered by PV module - Real64 PVCellAreaFract = 0.0; // Fraction of PV cell area to module area - Real64 PVRTop = 0.0; // PV module top thermal resistance (m2-DegC/W) - Real64 PVRBot = 0.0; // PV module bottom thermal resistance (m2-DegC/W) - Real64 PVGEmiss = 0.0; // Emissivity PV modules - Real64 BackMatEmiss = 0.0; // Emissivity of backing material - Real64 ThGlass = 0.0; // Glass thickness (m) - Real64 RIndGlass = 0.0; // Glass refraction index - Real64 ECoffGlass = 0.0; // Glass extinction coefficient - Real64 LastCollectorTemp = 0.0; // store previous temperature (DegC) - Real64 Tplen = 20.0; // modeled drybulb temperature for air through BIPVT channel (DegC) - Real64 Tcoll = 20.0; // modeled temperature of BIPVT channel surface on PV side (DegC) - Real64 HrPlen = 1.0; // Modeled radiation coef for OSCM (W/m2-C) - Real64 HcPlen = 10.0; // Modeled Convection coef for OSCM (W/m2-C) + std::string OSCMName; // OtherSideConditionsModel + int OSCMPtr = 0; // OtherSideConditionsModel index + Sched::Schedule *availSched = nullptr; // Availablity schedule + Real64 PVEffGapWidth = 0.0; // Effective Gap Plenum Behind PV modules (m) + Real64 PVCellTransAbsProduct = 0.0; // PV cell Transmittance-Absorptance prodiuct + Real64 BackMatTranAbsProduct = 0.0; // Backing Material Normal Transmittance-Absorptance Product + Real64 CladTranAbsProduct = 0.0; // Cladding Normal Transmittance-Absorptance Product + Real64 PVAreaFract = 0.0; // Fraction of collector gross area covered by PV module + Real64 PVCellAreaFract = 0.0; // Fraction of PV cell area to module area + Real64 PVRTop = 0.0; // PV module top thermal resistance (m2-DegC/W) + Real64 PVRBot = 0.0; // PV module bottom thermal resistance (m2-DegC/W) + Real64 PVGEmiss = 0.0; // Emissivity PV modules + Real64 BackMatEmiss = 0.0; // Emissivity of backing material + Real64 ThGlass = 0.0; // Glass thickness (m) + Real64 RIndGlass = 0.0; // Glass refraction index + Real64 ECoffGlass = 0.0; // Glass extinction coefficient + Real64 LastCollectorTemp = 0.0; // store previous temperature (DegC) + Real64 Tplen = 20.0; // modeled drybulb temperature for air through BIPVT channel (DegC) + Real64 Tcoll = 20.0; // modeled temperature of BIPVT channel surface on PV side (DegC) + Real64 HrPlen = 1.0; // Modeled radiation coef for OSCM (W/m2-C) + Real64 HcPlen = 10.0; // Modeled Convection coef for OSCM (W/m2-C) }; struct PVTReportStruct @@ -256,6 +256,10 @@ struct PhotovoltaicThermalCollectorsData : BaseGlobalStruct int NumPVT = 0; // count of all types of PVT in input file Array1D PVT; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/Photovoltaics.cc b/src/EnergyPlus/Photovoltaics.cc index c0915d7d42a..09c6723683a 100644 --- a/src/EnergyPlus/Photovoltaics.cc +++ b/src/EnergyPlus/Photovoltaics.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -173,7 +173,7 @@ namespace Photovoltaics { CalcSimplePV(state, PVnum); } break; case PVModel::TRNSYS: { - // 'PhotovoltaicPeformance:EquivalentOne-Diode' (aka. 5-parameter TRNSYS type 180 model) + // 'PhotovoltaicPerformance:EquivalentOne-Diode' (aka. 5-parameter TRNSYS type 180 model) InitTRNSYSPV(state, PVnum); CalcTRNSYSPV(state, PVnum, RunFlag); @@ -206,16 +206,16 @@ namespace Photovoltaics { // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // provide a "get" method to collect results for individual electic load centers. + // provide a "get" method to collect results for individual electric load centers. // Using/Aliasing using PhotovoltaicThermalCollectors::GetPVTThermalPowerProduction; GeneratorPower = state.dataPhotovoltaic->PVarray(GeneratorIndex).Report.DCPower; GeneratorEnergy = state.dataPhotovoltaic->PVarray(GeneratorIndex).Report.DCEnergy; - auto &thisPVarray = state.dataPhotovoltaic->PVarray; + auto const &thisPVarray = state.dataPhotovoltaic->PVarray(GeneratorIndex); // PVT may add thermal - if (thisPVarray(GeneratorIndex).CellIntegrationMode == CellIntegration::PVTSolarCollector) { + if (thisPVarray.CellIntegrationMode == CellIntegration::PVTSolarCollector) { // get result for thermal power generation GetPVTThermalPowerProduction(state, GeneratorIndex, ThermalPower, ThermalEnergy); } else { @@ -248,9 +248,9 @@ namespace Photovoltaics { using namespace DataHeatBalance; using PhotovoltaicThermalCollectors::GetPVTmodelIndex; - using ScheduleManager::GetScheduleIndex; using TranspiredCollector::GetTranspiredCollectorIndex; + static constexpr std::string_view routineName = "GetPVInput"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int PVnum; // working variable for do loop through pv arrays int SurfNum; // working variable for surface id in Heat Balance domain @@ -324,7 +324,7 @@ namespace Photovoltaics { ShowWarningError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "Surface is not exposed to solar, check surface bounday condition"); + ShowContinueError(state, "Surface is not exposed to solar, check surface boundary condition"); } state.dataPhotovoltaic->PVarray(PVnum).Zone = GetPVZone(state, state.dataPhotovoltaic->PVarray(PVnum).SurfacePtr); @@ -468,6 +468,9 @@ namespace Photovoltaics { state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + if (Util::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), cCurrentModuleObject, ErrorsFound)) { continue; } @@ -495,12 +498,14 @@ namespace Photovoltaics { } tmpSimpleModuleParams(ModNum).PVEfficiency = state.dataIPShortCut->rNumericArgs(2); - tmpSimpleModuleParams(ModNum).EffSchedPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(3)); - if ((tmpSimpleModuleParams(ModNum).EffSchedPtr == 0) && (tmpSimpleModuleParams(ModNum).EfficencyInputMode == Efficiency::Scheduled)) { - ShowSevereError(state, format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3))); - ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "Did not find schedule"); - ErrorsFound = true; + if (tmpSimpleModuleParams(ModNum).EfficencyInputMode == Efficiency::Scheduled) { + if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3)); + ErrorsFound = true; + } else if ((tmpSimpleModuleParams(ModNum).effSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3)); + ErrorsFound = true; + } } } } @@ -806,7 +811,6 @@ namespace Photovoltaics { // Using/Aliasing Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - using ScheduleManager::GetCurrentScheduleValue; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int ThisSurf; // working index ptr to Surface arrays @@ -822,7 +826,7 @@ namespace Photovoltaics { Eff = state.dataPhotovoltaic->PVarray(thisPV).SimplePVModule.PVEfficiency; } break; case Efficiency::Scheduled: { // get from schedule - Eff = GetCurrentScheduleValue(state, state.dataPhotovoltaic->PVarray(thisPV).SimplePVModule.EffSchedPtr); + Eff = state.dataPhotovoltaic->PVarray(thisPV).SimplePVModule.effSched->getCurrentVal(); state.dataPhotovoltaic->PVarray(thisPV).SimplePVModule.PVEfficiency = Eff; } break; default: { @@ -836,7 +840,7 @@ namespace Photovoltaics { state.dataHeatBal->SurfQRadSWOutIncident( ThisSurf); // active solar cellsurface net area | solar conversion efficiency | solar incident - // store sink term in appropriate place for surface heat transfer itegration + // store sink term in appropriate place for surface heat transfer integration state.dataPhotovoltaic->PVarray(thisPV).SurfaceSink = state.dataPhotovoltaic->PVarray(thisPV).Report.DCPower; // array energy, power * timestep @@ -919,7 +923,7 @@ namespace Photovoltaics { // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // Calculate various PV system peformance indicies at the current timestep + // Calculate various PV system performance indices at the current timestep // METHODOLOGY EMPLOYED: // adapted code from a set of F77 routines by G. Barker that implement the model @@ -949,11 +953,11 @@ namespace Photovoltaics { thisPVarray.SNLPVinto.IcDiffuse = state.dataHeatBal->SurfQRadSWOutIncident(ThisSurf) - state.dataHeatBal->SurfQRadSWOutIncidentBeam(ThisSurf); //(W/ m2)(was kJ/hr m2) thisPVarray.SNLPVinto.IncidenceAngle = - std::acos(state.dataHeatBal->SurfCosIncidenceAngle(ThisSurf)) / Constant::DegToRadians; // (deg) from dataHeatBalance - thisPVarray.SNLPVinto.ZenithAngle = std::acos(state.dataEnvrn->SOLCOS(3)) / Constant::DegToRadians; //(degrees), - thisPVarray.SNLPVinto.Tamb = state.dataSurface->SurfOutDryBulbTemp(ThisSurf); //(deg. C) - thisPVarray.SNLPVinto.WindSpeed = state.dataSurface->SurfOutWindSpeed(ThisSurf); // (m/s) - thisPVarray.SNLPVinto.Altitude = state.dataEnvrn->Elevation; // from DataEnvironment via USE + std::acos(state.dataHeatBal->SurfCosIncidenceAngle(ThisSurf)) / Constant::DegToRad; // (deg) from dataHeatBalance + thisPVarray.SNLPVinto.ZenithAngle = std::acos(state.dataEnvrn->SOLCOS(3)) / Constant::DegToRad; //(degrees), + thisPVarray.SNLPVinto.Tamb = state.dataSurface->SurfOutDryBulbTemp(ThisSurf); //(deg. C) + thisPVarray.SNLPVinto.WindSpeed = state.dataSurface->SurfOutWindSpeed(ThisSurf); // (m/s) + thisPVarray.SNLPVinto.Altitude = state.dataEnvrn->Elevation; // from DataEnvironment via USE if (((thisPVarray.SNLPVinto.IcBeam + thisPVarray.SNLPVinto.IcDiffuse) > DataPhotovoltaics::MinIrradiance) && (RunFlag)) { @@ -1071,7 +1075,7 @@ namespace Photovoltaics { thisPVarray.SNLPVModule.BVoc0, thisPVarray.SNLPVModule.mBVoc); - // Calculate Vmp: voltagea at maximum powerpoint + // Calculate Vmp: voltage at maximum powerpoint thisPVarray.SNLPVCalc.Vmp = SandiaVmp(thisPVarray.SNLPVCalc.Tcell, Ee, thisPVarray.SNLPVModule.Vmp0, @@ -1263,15 +1267,13 @@ namespace Photovoltaics { Real64 VA; Real64 VOCA; Real64 PA; - int CC; - int K; Real64 CellTemp(0.0); // cell temperature in Kelvin Real64 CellTempC; // cell temperature in degrees C // if the cell temperature mode is 2, convert the timestep to seconds if (state.dataPhotovoltaicState->firstTime && state.dataPhotovoltaic->PVarray(PVnum).CellIntegrationMode == CellIntegration::DecoupledUllebergDynamic) { - state.dataPhotovoltaicState->PVTimeStep = double(state.dataGlobal->MinutesPerTimeStep) * 60.0; // Seconds per time step + state.dataPhotovoltaicState->PVTimeStep = double(state.dataGlobal->MinutesInTimeStep) * 60.0; // Seconds per time step } state.dataPhotovoltaicState->firstTime = false; @@ -1281,14 +1283,14 @@ namespace Photovoltaics { // convert ambient temperature from C to K Tambient = state.dataSurface->SurfOutDryBulbTemp(state.dataPhotovoltaic->PVarray(PVnum).SurfacePtr) + Constant::Kelvin; - auto &thisPVarray = state.dataPhotovoltaic->PVarray; + auto const &thisPVarray = state.dataPhotovoltaic->PVarray(PVnum); if ((state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVcalc.Insolation > MinInsolation) && (RunFlag)) { // set initial values for eta iteration loop DummyErr = 2.0 * ERR; - CC = 1; EtaOld = EtaIni; + int K; // Begin DO WHILE loop - until the error tolerance is reached. ETA = 0.0; @@ -1332,7 +1334,7 @@ namespace Photovoltaics { CellTemp += Constant::Kelvin; } break; case CellIntegration::PVTSolarCollector: { - GetPVTTsColl(state, thisPVarray(PVnum).PVTPtr, CellTemp); + GetPVTTsColl(state, thisPVarray.PVTPtr, CellTemp); CellTemp += Constant::Kelvin; } break; default: @@ -1357,7 +1359,7 @@ namespace Photovoltaics { state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.Vmp + state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.RefVoc) / state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.Imp; - // temperature depencence + // temperature dependence IL = state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVcalc.Insolation / state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.RefInsolation * (ILRef + state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.TempCoefIsc * @@ -1369,7 +1371,7 @@ namespace Photovoltaics { state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.CellsInSeries / AARef * (1.0 - state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.RefTemperature / CellTemp)); - // compute short curcuit current and open circuit voltage + // compute short circuit current and open circuit voltage // NEWTON --> ISC (STARTVALUE: ISCG1 - BASED ON IL=ISC) ISCG1 = IL; @@ -1394,7 +1396,6 @@ namespace Photovoltaics { PM / state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVcalc.Insolation / state.dataPhotovoltaic->PVarray(PVnum).TRNSYSPVModule.Area; DummyErr = std::abs((ETA - EtaOld) / EtaOld); EtaOld = ETA; - ++CC; } // while @@ -1422,7 +1423,7 @@ namespace Photovoltaics { CellTemp += Constant::Kelvin; } break; case CellIntegration::PVTSolarCollector: { - GetPVTTsColl(state, thisPVarray(PVnum).PVTPtr, CellTemp); + GetPVTTsColl(state, thisPVarray.PVTPtr, CellTemp); CellTemp += Constant::Kelvin; } break; default: { @@ -1473,7 +1474,7 @@ namespace Photovoltaics { Real64 const AA, // passed in from CalcPV Real64 const EPS, // passed in from CalcPV Real64 &II, // current [A] - Real64 &VV, // voltage [V] + Real64 const VV, // voltage [V] Real64 &PP // power [W] ) { @@ -1540,10 +1541,10 @@ namespace Photovoltaics { Real64 &B, Real64 &P, int &K, - Real64 &IO, - Real64 &IL, - Real64 &RSER, - Real64 &AA, + Real64 const IO, + Real64 const IL, + Real64 const RSER, + Real64 const AA, Real64 const EPS, int const KMAX) { @@ -1753,7 +1754,7 @@ namespace Photovoltaics { // METHODOLOGY EMPLOYED: // apply sandia temperature model, This is module temp or back of - // of the panel. A seperate correction handles delta T for actual cell + // of the panel. A separate correction handles delta T for actual cell // REFERENCES: // from G. Barker's TRNSYS implementation @@ -1906,7 +1907,7 @@ namespace Photovoltaics { Real64 AbsoluteAirMass; if (SolZen < 89.9) { - Real64 const AM(1.0 / (std::cos(SolZen * Constant::DegToRadians) + 0.5057 * std::pow(96.08 - SolZen, -1.634))); + Real64 const AM(1.0 / (std::cos(SolZen * Constant::DegToRad) + 0.5057 * std::pow(96.08 - SolZen, -1.634))); AbsoluteAirMass = std::exp(-0.0001184 * Altitude) * AM; } else { Real64 constexpr AM(36.32); // evaluated above at SolZen = 89.9 issue #5528 @@ -1930,7 +1931,7 @@ namespace Photovoltaics { // AUTHOR G. Barker // DATE WRITTEN // MODIFIED na - // RE-ENGINEERED B. Griffit F77-> f90 + // RE-ENGINEERED B. Griffith F77-> f90 // PURPOSE OF THIS FUNCTION: // Returns the result of Sandia Air Mass function @@ -2229,7 +2230,7 @@ namespace Photovoltaics { // SUBROUTINE INFORMATION: // AUTHOR B. Griffith - // DATE WRITTEN Janauray 2004 + // DATE WRITTEN January 2004 // MODIFIED na // RE-ENGINEERED na diff --git a/src/EnergyPlus/Photovoltaics.hh b/src/EnergyPlus/Photovoltaics.hh index fecd98cf9ad..5feae9e230d 100644 --- a/src/EnergyPlus/Photovoltaics.hh +++ b/src/EnergyPlus/Photovoltaics.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -127,7 +127,7 @@ namespace Photovoltaics { Real64 const AA, // passed in from CalcPV Real64 const EPS, // passed in from CalcPV Real64 &II, // current [A] - Real64 &VV, // voltage [V] + Real64 const VV, // voltage [V] Real64 &PP // power [W] ); @@ -149,10 +149,10 @@ namespace Photovoltaics { Real64 &B, Real64 &P, int &K, - Real64 &IO, - Real64 &IL, - Real64 &RSER, - Real64 &AA, + Real64 const IO, + Real64 const IL, + Real64 const RSER, + Real64 const AA, Real64 const EPS, int const KMAX); @@ -334,6 +334,10 @@ struct PhotovoltaicStateData : BaseGlobalStruct Real64 PVTimeStep; // internal timestep (in seconds) for cell temperature mode 3 Array1D_bool MyEnvrnFlag; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/PierceSurface.hh b/src/EnergyPlus/PierceSurface.hh index 9c07e476352..a0126a072e2 100644 --- a/src/EnergyPlus/PierceSurface.hh +++ b/src/EnergyPlus/PierceSurface.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/PipeHeatTransfer.cc b/src/EnergyPlus/PipeHeatTransfer.cc index b894207c80e..98244f05a65 100644 --- a/src/EnergyPlus/PipeHeatTransfer.cc +++ b/src/EnergyPlus/PipeHeatTransfer.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -120,9 +120,6 @@ enum class PipeIndoorBoundaryType }; constexpr std::array(PipeIndoorBoundaryType::Num)> pipeIndoorBoundaryTypeNamesUC = {"ZONE", "SCHEDULE"}; -// Using/Aliasing -using namespace GroundTemperatureManager; - // Functions PlantComponent *PipeHTData::factory(EnergyPlusData &state, DataPlant::PlantEquipmentType objectType, std::string const &objectName) @@ -133,11 +130,10 @@ PlantComponent *PipeHTData::factory(EnergyPlusData &state, DataPlant::PlantEquip state.dataPipeHT->GetPipeInputFlag = false; } // Now look for this particular pipe in the list - for (auto &pipe : state.dataPipeHT->PipeHT) { - if (pipe.Type == objectType && pipe.Name == objectName) { - return &pipe; - } - } + auto thisObj = std::find_if(state.dataPipeHT->PipeHT.begin(), + state.dataPipeHT->PipeHT.end(), + [&objectType, &objectName](const PipeHTData &myObj) { return myObj.Type == objectType && myObj.Name == objectName; }); + if (thisObj != state.dataPipeHT->PipeHT.end()) return thisObj; // If we didn't find it, fatal ShowFatalError(state, format("PipeHTFactory: Error getting inputs for pipe named: {}", objectName)); // Shut up the compiler @@ -207,14 +203,12 @@ void GetPipesHeatTransfer(EnergyPlusData &state) using NodeInputManager::GetOnlySingleNode; using namespace DataLoopNode; using OutAirNodeManager::CheckOutAirNodeNumber; - using ScheduleManager::GetScheduleIndex; static constexpr std::string_view routineName = "GetPipeHeatTransfer"; // SUBROUTINE PARAMETER DEFINITIONS: int constexpr NumPipeSections(20); int constexpr NumberOfDepthNodes(8); // Number of nodes in the cartesian grid-Should be an even # for now - Real64 const SecondsInHour(Constant::SecInHour); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: bool ErrorsFound(false); // Set to true if errors in input, @@ -226,7 +220,6 @@ void GetPipesHeatTransfer(EnergyPlusData &state) int NumOfPipeHTInt; // Number of Pipe Heat Transfer objects int NumOfPipeHTExt; // Number of Pipe Heat Transfer objects int NumOfPipeHTUG; // Number of Pipe Heat Transfer objects - int NumSections; // total number of sections in pipe auto &s_ipsc = state.dataIPShortCut; auto &s_mat = state.dataMaterial; @@ -336,16 +329,15 @@ void GetPipesHeatTransfer(EnergyPlusData &state) case PipeIndoorBoundaryType::Schedule: state.dataPipeHT->PipeHT(Item).EnvironmentPtr = EnvrnPtr::ScheduleEnv; - state.dataPipeHT->PipeHT(Item).EnvrSchedule = s_ipsc->cAlphaArgs(7); - state.dataPipeHT->PipeHT(Item).EnvrSchedPtr = GetScheduleIndex(state, state.dataPipeHT->PipeHT(Item).EnvrSchedule); - state.dataPipeHT->PipeHT(Item).EnvrVelSchedule = s_ipsc->cAlphaArgs(8); - state.dataPipeHT->PipeHT(Item).EnvrVelSchedPtr = GetScheduleIndex(state, state.dataPipeHT->PipeHT(Item).EnvrVelSchedule); - if (state.dataPipeHT->PipeHT(Item).EnvrSchedPtr == 0) { + + state.dataPipeHT->PipeHT(Item).envrSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(7)); + state.dataPipeHT->PipeHT(Item).envrVelSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(8)); + if (state.dataPipeHT->PipeHT(Item).envrSched == nullptr) { ShowSevereError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(7), s_ipsc->cAlphaArgs(7))); ShowContinueError(state, format("Entered in {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } - if (state.dataPipeHT->PipeHT(Item).EnvrVelSchedPtr == 0) { + if (state.dataPipeHT->PipeHT(Item).envrVelSched == nullptr) { ShowSevereError(state, format("Invalid {}={}", s_ipsc->cAlphaFieldNames(8), s_ipsc->cAlphaArgs(8))); ShowContinueError(state, format("Entered in {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; @@ -642,8 +634,7 @@ void GetPipesHeatTransfer(EnergyPlusData &state) state.dataPipeHT->PipeHT(Item).DomainDepth = state.dataPipeHT->PipeHT(Item).PipeDepth * 2.0; state.dataPipeHT->PipeHT(Item).SoilDiffusivity = state.dataPipeHT->PipeHT(Item).SoilConductivity / (state.dataPipeHT->PipeHT(Item).SoilDensity * state.dataPipeHT->PipeHT(Item).SoilCp); - state.dataPipeHT->PipeHT(Item).SoilDiffusivityPerDay = - state.dataPipeHT->PipeHT(Item).SoilDiffusivity * SecondsInHour * Constant::HoursInDay; + state.dataPipeHT->PipeHT(Item).SoilDiffusivityPerDay = state.dataPipeHT->PipeHT(Item).SoilDiffusivity * Constant::rSecsInDay; // Mesh the cartesian domain state.dataPipeHT->PipeHT(Item).NumDepthNodes = NumberOfDepthNodes; @@ -664,7 +655,13 @@ void GetPipesHeatTransfer(EnergyPlusData &state) } // Get ground temperature model - state.dataPipeHT->PipeHT(Item).groundTempModel = GetGroundTempModelAndInit(state, s_ipsc->cAlphaArgs(7), s_ipsc->cAlphaArgs(8)); + GroundTemp::ModelType gtmType = static_cast(getEnumValue(GroundTemp::modelTypeNamesUC, s_ipsc->cAlphaArgs(7))); + if (gtmType == GroundTemp::ModelType::Invalid) { + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(7), s_ipsc->cAlphaArgs(7)); + ErrorsFound = true; + } + + state.dataPipeHT->PipeHT(Item).groundTempModel = GroundTemp::GetGroundTempModelAndInit(state, gtmType, s_ipsc->cAlphaArgs(8)); // Select number of pipe sections. Hanby's optimal number of 20 section is selected. state.dataPipeHT->PipeHT(Item).NumSections = NumPipeSections; @@ -835,7 +832,7 @@ void PipeHTData::ValidatePipeConstruction(EnergyPlusData &state, Real64 Resistance = 0.0; Real64 TotThickness = 0.0; - auto &s_mat = state.dataMaterial; + auto const &s_mat = state.dataMaterial; // CTF stuff int TotalLayers = state.dataConstruction->Construct(ConstructionNum).TotLayers; @@ -912,9 +909,6 @@ void PipeHTData::InitPipesHeatTransfer(EnergyPlusData &state, bool const FirstHV // Using/Aliasing Real64 SysTimeElapsed = state.dataHVACGlobal->SysTimeElapsed; Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSpecificHeatGlycol; - using ScheduleManager::GetCurrentScheduleValue; // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("InitPipesHeatTransfer"); @@ -1020,7 +1014,7 @@ void PipeHTData::InitPipesHeatTransfer(EnergyPlusData &state, bool const FirstHV state.dataPipeHT->nsvEnvironmentTemp = state.dataZoneTempPredictorCorrector->zoneHeatBalance(this->EnvrZonePtr).MAT; } break; case EnvrnPtr::ScheduleEnv: { - state.dataPipeHT->nsvEnvironmentTemp = GetCurrentScheduleValue(state, this->EnvrSchedPtr); + state.dataPipeHT->nsvEnvironmentTemp = this->envrSched->getCurrentVal(); } break; case EnvrnPtr::None: { // default to outside temp state.dataPipeHT->nsvEnvironmentTemp = state.dataEnvrn->OutDryBulbTemp; @@ -1092,16 +1086,9 @@ void PipeHTData::InitPipesHeatTransfer(EnergyPlusData &state, bool const FirstHV // Even though the loop eventually has no flow rate, it appears it initializes to a value, then converges to OFF // Thus, this is called at the beginning of every time step once. - this->FluidSpecHeat = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - state.dataPipeHT->nsvInletTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); - this->FluidDensity = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - state.dataPipeHT->nsvInletTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + this->FluidSpecHeat = + state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, state.dataPipeHT->nsvInletTemp, RoutineName); + this->FluidDensity = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, state.dataPipeHT->nsvInletTemp, RoutineName); // At this point, for all Pipe:Interior objects we should zero out the energy and rate arrays this->FluidHeatLossRate = 0.0; @@ -1678,10 +1665,6 @@ Real64 PipeHTData::CalcPipeHeatTransCoef(EnergyPlusData &state, // Heat exchanger information also from Incropera and DeWitt. // Code based loosely on code from IBLAST program (research version) - // Using/Aliasing - using FluidProperties::GetConductivityGlycol; - using FluidProperties::GetViscosityGlycol; - // Return value Real64 CalcPipeHeatTransCoef; @@ -1728,12 +1711,9 @@ Real64 PipeHTData::CalcPipeHeatTransCoef(EnergyPlusData &state, } // look up conductivity and viscosity - Kactual = GetConductivityGlycol( - state, state.dataPlnt->PlantLoop(LoopNum).FluidName, this->FluidTemp(0), state.dataPlnt->PlantLoop(LoopNum).FluidIndex, RoutineName); // W/m-K - MUactual = - GetViscosityGlycol( - state, state.dataPlnt->PlantLoop(LoopNum).FluidName, this->FluidTemp(0), state.dataPlnt->PlantLoop(LoopNum).FluidIndex, RoutineName) / - 1000.0; // Note fluid properties routine returns mPa-s, we need Pa-s + Kactual = state.dataPlnt->PlantLoop(LoopNum).glycol->getConductivity(state, this->FluidTemp(0), RoutineName); // W/m-K + MUactual = state.dataPlnt->PlantLoop(LoopNum).glycol->getViscosity(state, this->FluidTemp(0), RoutineName) / + 1000.0; // Note fluid properties routine returns mPa-s, we need Pa-s // Calculate the Reynold's number from RE=(4*Mdot)/(Pi*Mu*Diameter) - as RadiantSysLowTemp ReD = 4.0 * MassFlowRate / (Constant::Pi * MUactual * Diameter); @@ -1777,9 +1757,6 @@ Real64 PipeHTData::OutsidePipeHeatTransCoef(EnergyPlusData &state) // Fundamentals of Heat and Mass Transfer: Incropera and DeWitt, 4th ed. // p. 369-370 (Eq. 7:55b) - // Using/Aliasing - using ScheduleManager::GetCurrentScheduleValue; - // Return value Real64 OutsidePipeHeatTransCoef; @@ -1823,8 +1800,8 @@ Real64 PipeHTData::OutsidePipeHeatTransCoef(EnergyPlusData &state) case DataPlant::PlantEquipmentType::PipeInterior: { switch (this->EnvironmentPtr) { case EnvrnPtr::ScheduleEnv: { - AirTemp = GetCurrentScheduleValue(state, this->EnvrSchedPtr); - AirVel = GetCurrentScheduleValue(state, this->EnvrVelSchedPtr); + AirTemp = this->envrSched->getCurrentVal(); + AirVel = this->envrVelSched->getCurrentVal(); } break; case EnvrnPtr::ZoneEnv: { AirTemp = state.dataZoneTempPredictorCorrector->zoneHeatBalance(this->EnvrZonePtr).MAT; @@ -1922,12 +1899,8 @@ Real64 PipeHTData::TBND(EnergyPlusData &state, // REFERENCES: See Module Level Description // Using/Aliasing - Real64 curSimTime = state.dataGlobal->DayOfSim * Constant::SecsInDay; - Real64 TBND; - - TBND = this->groundTempModel->getGroundTempAtTimeInSeconds(state, z, curSimTime); - - return TBND; + Real64 curSimTime = state.dataGlobal->DayOfSim * Constant::rSecsInDay; + return this->groundTempModel->getGroundTempAtTimeInSeconds(state, z, curSimTime); } void PipeHTData::oneTimeInit([[maybe_unused]] EnergyPlusData &state) diff --git a/src/EnergyPlus/PipeHeatTransfer.hh b/src/EnergyPlus/PipeHeatTransfer.hh index 3eb9c5f4de8..7088e9f48ca 100644 --- a/src/EnergyPlus/PipeHeatTransfer.hh +++ b/src/EnergyPlus/PipeHeatTransfer.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -61,7 +61,7 @@ #include #include #include -#include +#include #include #include #include @@ -73,9 +73,6 @@ struct EnergyPlusData; namespace PipeHeatTransfer { - // Using/Aliasing - using namespace GroundTemperatureManager; - enum class EnvrnPtr { Invalid = -1, @@ -105,23 +102,21 @@ namespace PipeHeatTransfer { // Members // Input data std::string Name; - std::string Construction; // construction object name - std::string Environment; // keyword: 'Schedule', 'OutdoorAir', 'Zone' - std::string EnvrSchedule; // temperature schedule for environmental temp - std::string EnvrVelSchedule; // temperature schedule for environmental temp - std::string EnvrAirNode; // outside air node providing environmental temp - Real64 Length; // total pipe length [m] - Real64 PipeID; // pipe inside diameter [m] - std::string InletNode; // inlet node name - std::string OutletNode; // outlet node name - int InletNodeNum; // inlet node number - int OutletNodeNum; // outlet node number - DataPlant::PlantEquipmentType Type; // Type of pipe + std::string Construction; // construction object name + std::string Environment; // keyword: 'Schedule', 'OutdoorAir', 'Zone' + Sched::Schedule *envrSched = nullptr; // temperature schedule for environmental temp + Sched::Schedule *envrVelSched = nullptr; // temperature schedule for environmental temp + std::string EnvrAirNode; // outside air node providing environmental temp + Real64 Length; // total pipe length [m] + Real64 PipeID; // pipe inside diameter [m] + std::string InletNode; // inlet node name + std::string OutletNode; // outlet node name + int InletNodeNum; // inlet node number + int OutletNodeNum; // outlet node number + DataPlant::PlantEquipmentType Type; // Type of pipe // derived data int ConstructionNum; // construction ref number EnvrnPtr EnvironmentPtr; - int EnvrSchedPtr; // pointer to schedule used to set environmental temp - int EnvrVelSchedPtr; // pointer to schedule used to set environmental temp int EnvrZonePtr; // pointer to zone number used to set environmental temp int EnvrAirNodeNum; // pointer to outside air node used to set environmental temp int NumSections; // total number of nodes along pipe length @@ -183,7 +178,7 @@ namespace PipeHeatTransfer { Real64 ZoneHeatGainRate; // Lagged energy summation for zone heat gain {W} PlantLocation plantLoc; bool CheckEquipName; - std::shared_ptr groundTempModel; + GroundTemp::BaseGroundTempsModel *groundTempModel; // non-owning pointer // Report data Real64 FluidInletTemp; // inlet temperature [C] @@ -200,12 +195,12 @@ namespace PipeHeatTransfer { // Default Constructor PipeHTData() : Length(0.0), PipeID(0.0), InletNodeNum(0), OutletNodeNum(0), Type(DataPlant::PlantEquipmentType::Invalid), ConstructionNum(0), - EnvironmentPtr(EnvrnPtr::None), EnvrSchedPtr(0), EnvrVelSchedPtr(0), EnvrZonePtr(0), EnvrAirNodeNum(0), NumSections(0), - FluidSpecHeat(0.0), FluidDensity(0.0), MaxFlowRate(0.0), InsideArea(0.0), OutsideArea(0.0), SectionArea(0.0), PipeHeatCapacity(0.0), - PipeOD(0.0), PipeCp(0.0), PipeDensity(0.0), PipeConductivity(0.0), InsulationOD(0.0), InsulationCp(0.0), InsulationDensity(0.0), - InsulationConductivity(0.0), InsulationThickness(0.0), InsulationResistance(0.0), CurrentSimTime(0.0), PreviousSimTime(0.0), - NumDepthNodes(0), PipeNodeDepth(0), PipeNodeWidth(0), PipeDepth(0.0), DomainDepth(0.0), dSregular(0.0), OutdoorConvCoef(0.0), - SoilMaterialNum(0), MonthOfMinSurfTemp(0), MinSurfTemp(0.0), SoilDensity(0.0), SoilDepth(0.0), SoilCp(0.0), SoilConductivity(0.0), + EnvironmentPtr(EnvrnPtr::None), EnvrZonePtr(0), EnvrAirNodeNum(0), NumSections(0), FluidSpecHeat(0.0), FluidDensity(0.0), + MaxFlowRate(0.0), InsideArea(0.0), OutsideArea(0.0), SectionArea(0.0), PipeHeatCapacity(0.0), PipeOD(0.0), PipeCp(0.0), + PipeDensity(0.0), PipeConductivity(0.0), InsulationOD(0.0), InsulationCp(0.0), InsulationDensity(0.0), InsulationConductivity(0.0), + InsulationThickness(0.0), InsulationResistance(0.0), CurrentSimTime(0.0), PreviousSimTime(0.0), NumDepthNodes(0), PipeNodeDepth(0), + PipeNodeWidth(0), PipeDepth(0.0), DomainDepth(0.0), dSregular(0.0), OutdoorConvCoef(0.0), SoilMaterialNum(0), MonthOfMinSurfTemp(0), + MinSurfTemp(0.0), SoilDensity(0.0), SoilDepth(0.0), SoilCp(0.0), SoilConductivity(0.0), SoilRoughness(Material::SurfaceRoughness::Invalid), SoilThermAbs(0.0), SoilSolarAbs(0.0), CoefA1(0.0), CoefA2(0.0), FourierDS(0.0), SoilDiffusivity(0.0), SoilDiffusivityPerDay(0.0), BeginSimInit(true), BeginSimEnvrn(true), FirstHVACupdateFlag(true), BeginEnvrnupdateFlag(true), SolarExposed(true), SumTK(0.0), ZoneHeatGainRate(0.0), plantLoc{}, CheckEquipName(true), @@ -286,6 +281,10 @@ struct PipeHeatTransferData : BaseGlobalStruct Array1D PipeHT; std::unordered_map PipeHTUniqueNames; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/Pipes.cc b/src/EnergyPlus/Pipes.cc index e5c2dc3de54..8291009eef7 100644 --- a/src/EnergyPlus/Pipes.cc +++ b/src/EnergyPlus/Pipes.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Pipes.hh b/src/EnergyPlus/Pipes.hh index 6dc05b9e964..72ff9835d5a 100644 --- a/src/EnergyPlus/Pipes.hh +++ b/src/EnergyPlus/Pipes.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -108,6 +108,10 @@ struct PipesData : BaseGlobalStruct EPVector LocalPipe; std::unordered_map LocalPipeUniqueNames; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/Plant/Branch.cc b/src/EnergyPlus/Plant/Branch.cc index 40faec31643..af254961848 100644 --- a/src/EnergyPlus/Plant/Branch.cc +++ b/src/EnergyPlus/Plant/Branch.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Plant/Branch.hh b/src/EnergyPlus/Plant/Branch.hh index 6722f7240a3..9f48378e8a9 100644 --- a/src/EnergyPlus/Plant/Branch.hh +++ b/src/EnergyPlus/Plant/Branch.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Plant/CallingOrder.hh b/src/EnergyPlus/Plant/CallingOrder.hh index e7e6ebe9f15..5b7ecd4d9a2 100644 --- a/src/EnergyPlus/Plant/CallingOrder.hh +++ b/src/EnergyPlus/Plant/CallingOrder.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Plant/Component.cc b/src/EnergyPlus/Plant/Component.cc index 54837093f9b..7372b12f8a8 100644 --- a/src/EnergyPlus/Plant/Component.cc +++ b/src/EnergyPlus/Plant/Component.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -126,5 +126,11 @@ namespace DataPlant { return state.dataPlnt->PlantLoop(plantLoc.loopNum).LoopSide(plantLoc.loopSideNum).Branch(plantLoc.branchNum).Comp(plantLoc.compNum); } + Real64 CompData::getDynamicMaxCapacity(EnergyPlusData &state) const + { + if (this->compPtr == NULL) return this->MaxLoad; + Real64 possibleLoad = this->compPtr->getDynamicMaxCapacity(state); + return (possibleLoad == 0) ? this->MaxLoad : possibleLoad; + } } // namespace DataPlant } // namespace EnergyPlus diff --git a/src/EnergyPlus/Plant/Component.hh b/src/EnergyPlus/Plant/Component.hh index f86542cde55..3f13e70d5c5 100644 --- a/src/EnergyPlus/Plant/Component.hh +++ b/src/EnergyPlus/Plant/Component.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -89,7 +89,7 @@ namespace DataPlant { false, // "Pipe:Indoor" false, // "Pipe:Underground" false, // "DistrictCooling" - false, // "DistrictHeating" + false, // "DistrictHeating:Water" (steam is at the end) false, // "ThermalStorage:Ice:Detailed" false, // "ThermalStorage:Ice:Simple" false, // "TemperingValve" @@ -158,7 +158,8 @@ namespace DataPlant { false, // "AirTerminal:SingleDuct:ConstantVolume:FourPipeBeam" false, // "ZoneHVAC:CoolingPanel:RadiantConvective:Water" false, // "HeatPump:PlantLoop:EIR:Cooling" - false // "HeatPump:PlantLoop:EIR:Heating" + false, // "HeatPump:PlantLoop:EIR:Heating" + false // "DistrictHeating:Steam" }; struct CompData @@ -229,6 +230,8 @@ namespace DataPlant { void oneTimeInit(EnergyPlusData &state) const; static CompData &getPlantComponent(EnergyPlusData &state, PlantLocation const &plantLoc); + + Real64 getDynamicMaxCapacity(EnergyPlusData &state) const; }; } // namespace DataPlant } // namespace EnergyPlus diff --git a/src/EnergyPlus/Plant/ConnectedLoopData.hh b/src/EnergyPlus/Plant/ConnectedLoopData.hh index dc9d8a94f70..48ef8624913 100644 --- a/src/EnergyPlus/Plant/ConnectedLoopData.hh +++ b/src/EnergyPlus/Plant/ConnectedLoopData.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Plant/Connection.hh b/src/EnergyPlus/Plant/Connection.hh index 90b54226ead..324bf82c90d 100644 --- a/src/EnergyPlus/Plant/Connection.hh +++ b/src/EnergyPlus/Plant/Connection.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Plant/DataPlant.hh b/src/EnergyPlus/Plant/DataPlant.hh index 7a98fa1f2f1..9db7c083162 100644 --- a/src/EnergyPlus/Plant/DataPlant.hh +++ b/src/EnergyPlus/Plant/DataPlant.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -53,7 +53,6 @@ // ObjexxFCL Headers #include -#include // EnergyPlus Headers #include @@ -407,6 +406,10 @@ struct DataPlantData : BaseGlobalStruct std::array, static_cast(DataPlant::LoopSideLocation::Num)> VentRepCond; Array1D PlantCallingOrderInfo; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/Plant/Enums.hh b/src/EnergyPlus/Plant/Enums.hh index a8ef2ea229f..eabb723133a 100644 --- a/src/EnergyPlus/Plant/Enums.hh +++ b/src/EnergyPlus/Plant/Enums.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Plant/EquipAndOperations.cc b/src/EnergyPlus/Plant/EquipAndOperations.cc index 96d2871e845..07866466d45 100644 --- a/src/EnergyPlus/Plant/EquipAndOperations.cc +++ b/src/EnergyPlus/Plant/EquipAndOperations.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -248,7 +248,7 @@ namespace DataPlant { int numHXsOnSupervisedLoops = 0; for (int LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) { if (this->PlantLoopIndicesBeingSupervised(LoopNum) > 0) { - // search for any Heat axchangers on loop supply side + // search for any Heat exchangers on loop supply side auto &this_plant_loopside(state.dataPlnt->PlantLoop(LoopNum).LoopSide(DataPlant::LoopSideLocation::Supply)); for (int BranchNum = 1; BranchNum <= this_plant_loopside.TotalBranches; ++BranchNum) { for (int CompNum = 1; CompNum <= this_plant_loopside.Branch(BranchNum).TotalComponents; ++CompNum) { @@ -883,11 +883,9 @@ namespace DataPlant { // Calculate load on primary chilled water loop and store in PrimaryPlantCoolingLoad Real64 CW_RetMdot = state.dataLoopNodes->Node(this->PlantOps.PrimaryChWLoopSupInletNode).MassFlowRate; - Real64 const CpCW = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->PlantOps.PrimaryChWLoopIndex).FluidName, - state.dataLoopNodes->Node(this->PlantOps.PrimaryChWLoopSupInletNode).Temp, - state.dataPlnt->PlantLoop(this->PlantOps.PrimaryChWLoopIndex).FluidIndex, - "DetermineCurrentPlantLoads"); + Real64 const CpCW = state.dataPlnt->PlantLoop(this->PlantOps.PrimaryChWLoopIndex) + .glycol->getSpecificHeat( + state, state.dataLoopNodes->Node(this->PlantOps.PrimaryChWLoopSupInletNode).Temp, "DetermineCurrentPlantLoads"); Real64 CW_Qdot = min(0.0, CW_RetMdot * CpCW * @@ -899,11 +897,9 @@ namespace DataPlant { // int HWSupInletNode = this->PlantOps.PrimaryHWLoopSupInletNode; // state.dataPlnt->PlantLoop(this->PlantOps.PrimaryHWLoopIndex).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).NodeNumIn; Real64 HW_RetMdot = state.dataLoopNodes->Node(this->PlantOps.PrimaryHWLoopSupInletNode).MassFlowRate; - Real64 const CpHW = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->PlantOps.PrimaryHWLoopIndex).FluidName, - state.dataLoopNodes->Node(this->PlantOps.PrimaryHWLoopSupInletNode).Temp, - state.dataPlnt->PlantLoop(this->PlantOps.PrimaryHWLoopIndex).FluidIndex, - "DetermineCurrentPlantLoads"); + Real64 const CpHW = state.dataPlnt->PlantLoop(this->PlantOps.PrimaryHWLoopIndex) + .glycol->getSpecificHeat( + state, state.dataLoopNodes->Node(this->PlantOps.PrimaryHWLoopSupInletNode).Temp, "DetermineCurrentPlantLoads"); Real64 HW_Qdot = max(0.0, @@ -1372,20 +1368,14 @@ namespace DataPlant { // step 2. calculate the loads to adjust the // returns to hit the associated setpoints at their current mass flow Real64 const CpCW = - FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->DedicatedHR_HeatingPLHP.sourceSidePlantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(inletChWReturnNodeNum).Temp, - state.dataPlnt->PlantLoop(this->DedicatedHR_HeatingPLHP.sourceSidePlantLoc.loopNum).FluidIndex, - "EvaluateChillerHeaterChangeoverOpScheme"); + state.dataPlnt->PlantLoop(this->DedicatedHR_HeatingPLHP.sourceSidePlantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(inletChWReturnNodeNum).Temp, "EvaluateChillerHeaterChangeoverOpScheme"); Real64 CW_Qdot = CW_RetMdot * CpCW * (this->Setpoint.SecCW - state.dataLoopNodes->Node(inletChWReturnNodeNum).Temp); // power = Mdot Cp Delta T, cooling load is negative Real64 const CpHW = - FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->DedicatedHR_CoolingPLHP.sourceSidePlantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(inletHWReturnNodeNum).Temp, - state.dataPlnt->PlantLoop(this->DedicatedHR_CoolingPLHP.sourceSidePlantLoc.loopNum).FluidIndex, - "EvaluateChillerHeaterChangeoverOpScheme"); + state.dataPlnt->PlantLoop(this->DedicatedHR_CoolingPLHP.sourceSidePlantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(inletHWReturnNodeNum).Temp, "EvaluateChillerHeaterChangeoverOpScheme"); Real64 HW_Qdot = HW_RetMdot * CpHW * (this->Setpoint.SecHW - state.dataLoopNodes->Node(inletHWReturnNodeNum).Temp); // power = Mdot Cp Delta T // store for reporting @@ -1423,12 +1413,12 @@ namespace DataPlant { } // step 4. check that there is sufficient flow in source side for chosen leader to avoid runaway plant conditions on source side - // if not, see if other side could run benefically as leader and switch to it if so + // if not, see if other side could run beneficially as leader and switch to it if so // Real64 FlowImbalanceRatioThreshold = 10.0; // TODO, check with TRANE engineering about WWHP operating limits wrt to relative flows (real // // systems have a pumped sided arm flow situation and do not have low flow problems) // if (CoolLedNeed) { - // if (CW_RetMdot / HW_RetMdot > FlowImbalanceRatioThreshold) { // insuficient flow in source side relative to load side + // if (CW_RetMdot / HW_RetMdot > FlowImbalanceRatioThreshold) { // insufficient flow in source side relative to load side // CoolLedNeed = false; // // if (HW_Qdot > 1.0) { // // HeatLedNeed = true; @@ -1436,7 +1426,7 @@ namespace DataPlant { // } //} // if (HeatLedNeed) { - // if (HW_RetMdot / CW_RetMdot > FlowImbalanceRatioThreshold) { // insuficient flow in source side relative to load side + // if (HW_RetMdot / CW_RetMdot > FlowImbalanceRatioThreshold) { // insufficient flow in source side relative to load side // HeatLedNeed = false; // // if (CW_Qdot < -1.0) { // // CoolLedNeed = true; @@ -1549,11 +1539,11 @@ namespace DataPlant { void ChillerHeaterSupervisoryOperationData::ProcessAndSetAuxilBoiler(EnergyPlusData &state) { // Check for boiler used as auxiliary or supplemental - // Assume boilers are in-line on supply side outlet branch, typically on secodary loop but may be on primary loop + // Assume boilers are in-line on supply side outlet branch, typically on secondary loop but may be on primary loop this->Report.BoilerAux_OpMode = 0; if (this->PlantOps.numBoilers <= 0) return; - // first intialize them to be off + // first initialize them to be off if (this->PlantOps.numBoilers > 0) { for (int BoilerNum = 1; BoilerNum <= this->PlantOps.numBoilers; ++BoilerNum) { state.dataPlnt->PlantLoop(this->PlantBoilerComps(BoilerNum).loopNum) @@ -1604,12 +1594,8 @@ namespace DataPlant { Real64 Tin = state.dataLoopNodes->Node(inletBoilerNodeNum).Temp; Real64 Mdot = state.dataLoopNodes->Node(inletBoilerNodeNum).MassFlowRate; - Real64 const CpHW = - FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->PlantBoilerComps(BoilerNum).loopNum).FluidName, - Tin, - state.dataPlnt->PlantLoop(this->PlantBoilerComps(BoilerNum).loopNum).FluidIndex, - "ChillerHeaterSupervisoryOperationData::ProcessAndSetAuxilBoiler"); + Real64 const CpHW = state.dataPlnt->PlantLoop(this->PlantBoilerComps(BoilerNum).loopNum) + .glycol->getSpecificHeat(state, Tin, "ChillerHeaterSupervisoryOperationData::ProcessAndSetAuxilBoiler"); Real64 LoadToSetpoint = max(0.0, Mdot * CpHW * (HWsetpt - Tin)); int pltSizNum = state.dataPlnt->PlantLoop(this->PlantBoilerComps(BoilerNum).loopNum).PlantSizNum; Real64 const thresholdPlantLoad = diff --git a/src/EnergyPlus/Plant/EquipAndOperations.hh b/src/EnergyPlus/Plant/EquipAndOperations.hh index 281bf5a2ba6..bf81fdad0ca 100644 --- a/src/EnergyPlus/Plant/EquipAndOperations.hh +++ b/src/EnergyPlus/Plant/EquipAndOperations.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -52,6 +52,7 @@ #include #include #include +#include #include namespace EnergyPlus::DataPlant { @@ -258,31 +259,29 @@ struct ChillerHeaterSupervisoryOperationData struct OperationData { // Members - std::string Name; // The name of each item in the list - std::string TypeOf; // The 'keyWord' identifying each item in the list - DataPlant::OpScheme Type; // Op scheme type (from keyword) - std::string Sched; // The name of the schedule associated with the list - int SchedPtr; // ALLOCATABLE to the schedule (for valid schedules) - bool Available; // TRUE = designated component or operation scheme available - int NumEquipLists; // number of equipment lists - int CurListPtr; // points to the current equipment list - Array1D EquipList; // Component type list - int EquipListNumForLastStage; // points to the equipment list with the highest upper limit - std::string ReferenceNodeName; // DELTA CTRL ONLY--for calculation of delta Temp - int ReferenceNodeNumber; // DELTA CTRL ONLY--for calculation of delta Temp - int ErlSimProgramMngr; // EMS:ProgramManager to always run when this model is called - int ErlInitProgramMngr; // EMS:ProgramManager to run when this model is initialized and setup - int initPluginLocation; // If Python Plugins are used to init this, this defines the location in the plugin structure - int simPluginLocation; // If Python Plugins are used to simulate this, this defines the location in the plugin structure - Real64 EMSIntVarLoopDemandRate; // EMS internal variable for loop-level demand rate, neg cooling [W] + std::string Name; // The name of each item in the list + std::string TypeOf; // The 'keyWord' identifying each item in the list + DataPlant::OpScheme Type; // Op scheme type (from keyword) + Sched::Schedule *sched = nullptr; // schedule associated with the list + bool Available; // TRUE = designated component or operation scheme available + int NumEquipLists; // number of equipment lists + int CurListPtr; // points to the current equipment list + Array1D EquipList; // Component type list + int EquipListNumForLastStage; // points to the equipment list with the highest upper limit + std::string ReferenceNodeName; // DELTA CTRL ONLY--for calculation of delta Temp + int ReferenceNodeNumber; // DELTA CTRL ONLY--for calculation of delta Temp + int ErlSimProgramMngr; // EMS:ProgramManager to always run when this model is called + int ErlInitProgramMngr; // EMS:ProgramManager to run when this model is initialized and setup + int initPluginLocation; // If Python Plugins are used to init this, this defines the location in the plugin structure + int simPluginLocation; // If Python Plugins are used to simulate this, this defines the location in the plugin structure + Real64 EMSIntVarLoopDemandRate; // EMS internal variable for loop-level demand rate, neg cooling [W] bool MyEnvrnFlag; ChillerHeaterSupervisoryOperationData *ChillerHeaterSupervisoryOperation = nullptr; // Default Constructor OperationData() - : Type(DataPlant::OpScheme::Invalid), SchedPtr(0), Available(false), NumEquipLists(0), CurListPtr(0), EquipListNumForLastStage(0), - ReferenceNodeNumber(0), ErlSimProgramMngr(0), ErlInitProgramMngr(0), initPluginLocation(-1), simPluginLocation(-1), - EMSIntVarLoopDemandRate(0.0), MyEnvrnFlag(true) + : Type(DataPlant::OpScheme::Invalid), Available(false), NumEquipLists(0), CurListPtr(0), EquipListNumForLastStage(0), ReferenceNodeNumber(0), + ErlSimProgramMngr(0), ErlInitProgramMngr(0), initPluginLocation(-1), simPluginLocation(-1), EMSIntVarLoopDemandRate(0.0), MyEnvrnFlag(true) { } }; diff --git a/src/EnergyPlus/Plant/Loop.cc b/src/EnergyPlus/Plant/Loop.cc index cc894f9a7c9..f82acf09f92 100644 --- a/src/EnergyPlus/Plant/Loop.cc +++ b/src/EnergyPlus/Plant/Loop.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -133,7 +133,7 @@ void PlantLoopData::CalcUnmetPlantDemand(EnergyPlusData &state) if (this->FluidType == DataLoopNode::NodeFluidType::Water) { - Cp = FluidProperties::GetSpecificHeatGlycol(state, this->FluidName, TargetTemp, this->FluidIndex, RoutineName); + Cp = this->glycol->getSpecificHeat(state, TargetTemp, RoutineName); switch (this->LoopDemandCalcScheme) { case DataPlant::LoopDemandCalcScheme::SingleSetPoint: { @@ -177,7 +177,7 @@ void PlantLoopData::CalcUnmetPlantDemand(EnergyPlusData &state) } else if (this->FluidType == DataLoopNode::NodeFluidType::Steam) { - Cp = FluidProperties::GetSpecificHeatGlycol(state, this->FluidName, TargetTemp, this->FluidIndex, RoutineName); + Cp = this->glycol->getSpecificHeat(state, TargetTemp, RoutineName); switch (this->LoopDemandCalcScheme) { case DataPlant::LoopDemandCalcScheme::SingleSetPoint: { @@ -188,10 +188,8 @@ void PlantLoopData::CalcUnmetPlantDemand(EnergyPlusData &state) // Calculate the delta temperature DeltaTemp = LoopSetPointTemperature - TargetTemp; - EnthalpySteamSatVapor = - FluidProperties::GetSatEnthalpyRefrig(state, this->FluidName, LoopSetPointTemperature, 1.0, this->FluidIndex, RoutineNameAlt); - EnthalpySteamSatLiquid = - FluidProperties::GetSatEnthalpyRefrig(state, this->FluidName, LoopSetPointTemperature, 0.0, this->FluidIndex, RoutineNameAlt); + EnthalpySteamSatVapor = this->steam->getSatEnthalpy(state, LoopSetPointTemperature, 1.0, RoutineNameAlt); + EnthalpySteamSatLiquid = this->steam->getSatEnthalpy(state, LoopSetPointTemperature, 0.0, RoutineNameAlt); LatentHeatSteam = EnthalpySteamSatVapor - EnthalpySteamSatLiquid; diff --git a/src/EnergyPlus/Plant/Loop.hh b/src/EnergyPlus/Plant/Loop.hh index b47883626f6..1d25a96b544 100644 --- a/src/EnergyPlus/Plant/Loop.hh +++ b/src/EnergyPlus/Plant/Loop.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -48,6 +48,7 @@ #ifndef PlantTopologyLoop_hh_INCLUDED #define PlantTopologyLoop_hh_INCLUDED +#include #include #include @@ -89,10 +90,14 @@ namespace DataPlant { std::string Name; // Name of the component list std::string FluidName; // Name of the fluid specified for this loop DataLoopNode::NodeFluidType FluidType; // Type of fluid in the loop - int FluidIndex; // Index for Fluid in FluidProperties - int MFErrIndex; // for recurring mass flow errors - int MFErrIndex1; // for recurring mass flow errors - int MFErrIndex2; // for recurring mass flow errors + int FluidIndex = 0; + + Fluid::GlycolProps *glycol = nullptr; + Fluid::RefrigProps *steam = nullptr; + + int MFErrIndex; // for recurring mass flow errors + int MFErrIndex1; // for recurring mass flow errors + int MFErrIndex2; // for recurring mass flow errors // (see CheckPlantMixerSplitterConsistency) // Loop Operating Setpoints and Limits int TempSetPointNodeNum; // Node Number for Loop Temp SP associated with SP manager @@ -149,12 +154,11 @@ namespace DataPlant { // Default Constructor PlantLoopData() - : FluidType(DataLoopNode::NodeFluidType::Blank), FluidIndex(1), // default to water - MFErrIndex(0), MFErrIndex1(0), MFErrIndex2(0), TempSetPointNodeNum(0), MaxBranch(0), MinTemp(0.0), MaxTemp(0.0), MinTempErrIndex(0), - MaxTempErrIndex(0), MinVolFlowRate(0.0), MaxVolFlowRate(0.0), MaxVolFlowRateWasAutoSized(false), MinMassFlowRate(0.0), - MaxMassFlowRate(0.0), Volume(0.0), VolumeWasAutoSized(false), CirculationTime(2.0), Mass(0.0), EMSCtrl(false), EMSValue(0.0), - NumOpSchemes(0), LoadDistribution(DataPlant::LoadingScheme::Invalid), PlantSizNum(0), - LoopDemandCalcScheme(DataPlant::LoopDemandCalcScheme::Invalid), CommonPipeType(DataPlant::CommonPipeType::No), + : FluidType(DataLoopNode::NodeFluidType::Blank), MFErrIndex(0), MFErrIndex1(0), MFErrIndex2(0), TempSetPointNodeNum(0), MaxBranch(0), + MinTemp(0.0), MaxTemp(0.0), MinTempErrIndex(0), MaxTempErrIndex(0), MinVolFlowRate(0.0), MaxVolFlowRate(0.0), + MaxVolFlowRateWasAutoSized(false), MinMassFlowRate(0.0), MaxMassFlowRate(0.0), Volume(0.0), VolumeWasAutoSized(false), + CirculationTime(2.0), Mass(0.0), EMSCtrl(false), EMSValue(0.0), NumOpSchemes(0), LoadDistribution(DataPlant::LoadingScheme::Invalid), + PlantSizNum(0), LoopDemandCalcScheme(DataPlant::LoopDemandCalcScheme::Invalid), CommonPipeType(DataPlant::CommonPipeType::No), EconPlantSideSensedNodeNum(0), EconCondSideSensedNodeNum(0), EconPlacement(0), EconBranch(0), EconComp(0), EconControlTempDiff(0.0), LoopHasConnectionComp(false), TypeOfLoop(LoopType::Invalid), PressureSimType(DataPlant::PressSimType::NoPressure), HasPressureComponents(false), PressureDrop(0.0), UsePressureForPumpCalcs(false), PressureEffectiveK(0.0), CoolingDemand(0.0), diff --git a/src/EnergyPlus/Plant/LoopSide.cc b/src/EnergyPlus/Plant/LoopSide.cc index 150d6cea60d..89879cd67b2 100644 --- a/src/EnergyPlus/Plant/LoopSide.cc +++ b/src/EnergyPlus/Plant/LoopSide.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -45,7 +45,6 @@ // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. -#include #include #include @@ -66,8 +65,6 @@ namespace EnergyPlus { namespace DataPlant { - static constexpr std::string_view fluidNameSteam("STEAM"); - void HalfLoopData::solve(EnergyPlusData &state, bool const FirstHVACIteration, bool &ReSimOtherSideNeeded) { @@ -737,8 +734,7 @@ namespace DataPlant { if (thisPlantLoop.FluidType == DataLoopNode::NodeFluidType::Water) { - Real64 Cp = - FluidProperties::GetSpecificHeatGlycol(state, thisPlantLoop.FluidName, WeightedInletTemp, thisPlantLoop.FluidIndex, RoutineName); + Real64 Cp = thisPlantLoop.glycol->getSpecificHeat(state, WeightedInletTemp, RoutineName); { @@ -810,8 +806,7 @@ namespace DataPlant { } else if (thisPlantLoop.FluidType == DataLoopNode::NodeFluidType::Steam) { - Real64 Cp = - FluidProperties::GetSpecificHeatGlycol(state, thisPlantLoop.FluidName, WeightedInletTemp, thisPlantLoop.FluidIndex, RoutineName); + Real64 Cp = thisPlantLoop.glycol->getSpecificHeat(state, WeightedInletTemp, RoutineName); { @@ -823,10 +818,9 @@ namespace DataPlant { // Calculate the delta temperature Real64 DeltaTemp = LoopSetPointTemperature - WeightedInletTemp; - Real64 EnthalpySteamSatVapor = - FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, LoopSetPointTemperature, 1.0, this->refrigIndex, RoutineNameAlt); - Real64 EnthalpySteamSatLiquid = - FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, LoopSetPointTemperature, 0.0, this->refrigIndex, RoutineNameAlt); + auto *steam = Fluid::GetSteam(state); + Real64 EnthalpySteamSatVapor = steam->getSatEnthalpy(state, LoopSetPointTemperature, 1.0, RoutineNameAlt); + Real64 EnthalpySteamSatLiquid = steam->getSatEnthalpy(state, LoopSetPointTemperature, 0.0, RoutineNameAlt); Real64 LatentHeatSteam = EnthalpySteamSatVapor - EnthalpySteamSatLiquid; @@ -934,7 +928,7 @@ namespace DataPlant { LoopFlowStatus FlowPriorityStatus = component.FlowPriority; // reference - auto &node_with_request(state.dataLoopNodes->Node(NodeToCheckRequest)); + auto const &node_with_request = state.dataLoopNodes->Node(NodeToCheckRequest); if (!DataPlant::PlantEquipmentTypeIsPump[static_cast(component.Type)]) { @@ -1998,11 +1992,7 @@ namespace DataPlant { Real64 const InletTemp(state.dataLoopNodes->Node(InletNode).Temp); Real64 const OutletTemp(state.dataLoopNodes->Node(OutletNode).Temp); Real64 const AverageTemp((InletTemp + OutletTemp) / 2.0); - Real64 const ComponentCp(FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - AverageTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName)); + Real64 const ComponentCp(state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, AverageTemp, RoutineName)); // Calculate the load altered by this component Real64 const LoadAlteration(ComponentMassFlowRate * ComponentCp * (OutletTemp - InletTemp)); diff --git a/src/EnergyPlus/Plant/LoopSide.hh b/src/EnergyPlus/Plant/LoopSide.hh index 28e363f0fdb..1fd6a6ba110 100644 --- a/src/EnergyPlus/Plant/LoopSide.hh +++ b/src/EnergyPlus/Plant/LoopSide.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -136,7 +136,6 @@ namespace DataPlant { Real64 LoadToLoopSetPointThatWasntMet; // Unmet Demand Real64 InitialDemandToLoopSetPointSAVED; std::string loopSideDescription; - int refrigIndex; // Index denoting refrigerant used (possibly steam) // report variables Real64 LoopSetPtDemandAtInlet; Real64 ThisSideLoadAlterations; @@ -155,7 +154,7 @@ namespace DataPlant { LoopSideInlet_CapExcessStorageTimeReport(0.0), LoopSideInlet_TotalTime(0.0), InletNode(0.0, 0.0), OutletNode(0.0, 0.0), flowRequestNeedIfOn(0.0), flowRequestNeedAndTurnOn(0.0), flowRequestFinal(0.0), hasConstSpeedBranchPumps(false), InitialDemandToLoopSetPoint(0.0), CurrentAlterationsToDemand(0.0), UpdatedDemandToLoopSetPoint(0.0), - LoadToLoopSetPointThatWasntMet(0.0), InitialDemandToLoopSetPointSAVED(0.0), refrigIndex(0), LoopSetPtDemandAtInlet(0.0), + LoadToLoopSetPointThatWasntMet(0.0), InitialDemandToLoopSetPointSAVED(0.0), LoopSetPtDemandAtInlet(0.0), ThisSideLoadAlterations(0.0), plantLoc{} { } diff --git a/src/EnergyPlus/Plant/LoopSidePumpInformation.hh b/src/EnergyPlus/Plant/LoopSidePumpInformation.hh index 864b38441e4..b0c501f0baf 100644 --- a/src/EnergyPlus/Plant/LoopSidePumpInformation.hh +++ b/src/EnergyPlus/Plant/LoopSidePumpInformation.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Plant/MeterData.hh b/src/EnergyPlus/Plant/MeterData.hh index 6b376797980..f5ab939a806 100644 --- a/src/EnergyPlus/Plant/MeterData.hh +++ b/src/EnergyPlus/Plant/MeterData.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Plant/MixerData.hh b/src/EnergyPlus/Plant/MixerData.hh index db140efcb83..7a738aa8d4f 100644 --- a/src/EnergyPlus/Plant/MixerData.hh +++ b/src/EnergyPlus/Plant/MixerData.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Plant/PlantConvergencePoint.hh b/src/EnergyPlus/Plant/PlantConvergencePoint.hh index 906a7ef4fa8..d015b42f15e 100644 --- a/src/EnergyPlus/Plant/PlantConvergencePoint.hh +++ b/src/EnergyPlus/Plant/PlantConvergencePoint.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Plant/PlantLocation.hh b/src/EnergyPlus/Plant/PlantLocation.hh index 860a0580c78..93bed382760 100644 --- a/src/EnergyPlus/Plant/PlantLocation.hh +++ b/src/EnergyPlus/Plant/PlantLocation.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Plant/PlantManager.cc b/src/EnergyPlus/Plant/PlantManager.cc index fe4308a50fc..0b408917d8c 100644 --- a/src/EnergyPlus/Plant/PlantManager.cc +++ b/src/EnergyPlus/Plant/PlantManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -51,7 +51,6 @@ // ObjexxFCL Headers #include -#include #include // EnergyPlus Headers @@ -144,15 +143,13 @@ using namespace DataPlant; using namespace DataBranchAirLoopPlant; using namespace DataLoopNode; -static constexpr std::string_view fluidNameSteam("STEAM"); - void ManagePlantLoops(EnergyPlusData &state, bool const FirstHVACIteration, bool &SimAirLoops, // True when the air loops need to be (re)simulated bool &SimZoneEquipment, // True when zone equipment components need to be (re)simulated [[maybe_unused]] bool &SimNonZoneEquipment, // True when non-zone equipment components need to be (re)simulated bool &SimPlantLoops, // True when some part of Plant needs to be (re)simulated - bool &SimElecCircuits // True when electic circuits need to be (re)simulated + bool &SimElecCircuits // True when electric circuits need to be (re)simulated ) { @@ -284,7 +281,6 @@ void GetPlantLoopData(EnergyPlusData &state) // calls the Input Processor to retrieve data from input file. // Using/Aliasing - using ScheduleManager::GetScheduleIndex; using SetPointManager::IsNodeOnSetPtManager; HVAC::CtrlVarType localTempSetPt = HVAC::CtrlVarType::Temp; using NodeInputManager::GetOnlySingleNode; @@ -293,6 +289,7 @@ void GetPlantLoopData(EnergyPlusData &state) // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetPlant/CondenserLoopData: "); + static constexpr std::string_view routineName = "GetPlant/CondenserLoopData"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int LoopNum; // DO loop counter for loops @@ -336,6 +333,10 @@ void GetPlantLoopData(EnergyPlusData &state) auto &this_loop(state.dataPlnt->PlantLoop(LoopNum)); auto &this_demand_side(this_loop.LoopSide(DataPlant::LoopSideLocation::Demand)); auto &this_supply_side(this_loop.LoopSide(DataPlant::LoopSideLocation::Supply)); + + ErrorObjectHeader eoh; + eoh.routineName = routineName; + DataLoopNode::ConnectionObjectType objType; if (LoopNum <= state.dataHVACGlobal->NumPlantLoops) { PlantLoopNum = LoopNum; @@ -354,6 +355,9 @@ void GetPlantLoopData(EnergyPlusData &state) state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + eoh.objectType = CurrentModuleObject; + eoh.objectName = Alpha(1); } else { CondLoopNum = LoopNum - state.dataHVACGlobal->NumPlantLoops; this_loop.TypeOfLoop = LoopType::Condenser; @@ -371,41 +375,53 @@ void GetPlantLoopData(EnergyPlusData &state) _, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + eoh.objectType = CurrentModuleObject; + eoh.objectName = Alpha(1); } + Util::IsNameEmpty(state, Alpha(1), CurrentModuleObject, ErrorsFound); this_loop.Name = Alpha(1); // Load the Plant Loop Name if (Util::SameString(Alpha(2), "STEAM")) { + // A steam loop needs both the refrigerant (i.e., + // liquid-vapor mixture) properties and the glycol (liquid + // properties) for the condensate. The way this was done + // is that both Water (glycol) and Steam (refrig) were at + // index 1 in their respective arrays and so they could + // use a single index, and because the index was pre-set + // the FluidName was never consulted. That's not a very + // robust way of doing things. this_loop.FluidType = DataLoopNode::NodeFluidType::Steam; this_loop.FluidName = Alpha(2); + this_loop.FluidIndex = 1; + this_loop.glycol = Fluid::GetWater(state); + this_loop.steam = Fluid::GetSteam(state); + } else if (Util::SameString(Alpha(2), "WATER")) { this_loop.FluidType = DataLoopNode::NodeFluidType::Water; this_loop.FluidName = Alpha(2); - this_loop.FluidIndex = FluidProperties::GetGlycolNum(state, Alpha(2)); + this_loop.FluidIndex = 1; + this_loop.glycol = Fluid::GetWater(state); + } else if (Util::SameString(Alpha(2), "USERDEFINEDFLUIDTYPE")) { this_loop.FluidType = DataLoopNode::NodeFluidType::Water; this_loop.FluidName = Alpha(3); // check for valid fluid name - NumFluids = FluidProperties::CheckFluidPropertyName(state, Alpha(3)); - if (NumFluids == 0) { - ShowSevereError(state, CurrentModuleObject + "=\"" + Alpha(1) + "\", missing fluid data for Plant loop."); + this_loop.glycol = Fluid::GetGlycol(state, Alpha(3)); + if (this_loop.glycol == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), Alpha(3)); ErrorsFound = true; } else { - this_loop.FluidIndex = FluidProperties::GetGlycolNum(state, Alpha(3)); - if (this_loop.FluidIndex == 0) { - ShowSevereError(state, CurrentModuleObject + "=\"" + Alpha(1) + "\", invalid glycol fluid data for Plant loop."); - ErrorsFound = true; - } + this_loop.FluidIndex = this_loop.glycol->Num; } + } else { - ShowWarningError(state, - "Input error: " + state.dataIPShortCut->cAlphaFieldNames(2) + '=' + Alpha(2) + " entered, in " + CurrentModuleObject + - '=' + Alpha(1)); - ShowContinueError(state, "Will default to Water."); + ShowWarningInvalidKey(state, eoh, state.dataIPShortCut->cAlphaFieldNames(2), Alpha(2), "Water"); this_loop.FluidType = DataLoopNode::NodeFluidType::Water; this_loop.FluidName = "WATER"; - this_loop.FluidIndex = FluidProperties::GetGlycolNum(state, "WATER"); + this_loop.FluidIndex = 1; + this_loop.glycol = Fluid::GetWater(state); } this_loop.OperationScheme = Alpha(4); // Load the Plant Control Scheme Priority List @@ -1648,11 +1664,11 @@ void GetPlantInput(EnergyPlusData &state) for (LoopNum = 1; LoopNum <= state.dataHVACGlobal->NumPlantLoops; ++LoopNum) { // set up references for this loop - auto &this_plant_loop(state.dataPlnt->PlantLoop(LoopNum)); - auto &this_plant_supply(this_plant_loop.LoopSide(LoopSideLocation::Supply)); - auto &this_vent_plant_supply(state.dataPlnt->VentRepPlant[static_cast(LoopSideLocation::Supply)](LoopNum)); - auto &this_plant_demand(this_plant_loop.LoopSide(LoopSideLocation::Demand)); - auto &this_vent_plant_demand(state.dataPlnt->VentRepPlant[static_cast(LoopSideLocation::Demand)](LoopNum)); + auto &this_plant_loop = state.dataPlnt->PlantLoop(LoopNum); + auto const &this_plant_supply = this_plant_loop.LoopSide(LoopSideLocation::Supply); + auto &this_vent_plant_supply = state.dataPlnt->VentRepPlant[static_cast(LoopSideLocation::Supply)](LoopNum); + auto const &this_plant_demand = this_plant_loop.LoopSide(LoopSideLocation::Demand); + auto &this_vent_plant_demand = state.dataPlnt->VentRepPlant[static_cast(LoopSideLocation::Demand)](LoopNum); this_vent_plant_supply.Name = this_plant_loop.Name; this_vent_plant_supply.NodeNumIn = this_plant_supply.NodeNumIn; @@ -1665,8 +1681,8 @@ void GetPlantInput(EnergyPlusData &state) for (BranchNum = 1; BranchNum <= this_vent_plant_supply.TotalBranches; ++BranchNum) { - auto &this_plant_supply_branch(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum)); - auto &this_vent_plant_supply_branch(state.dataPlnt->VentRepPlant[static_cast(LoopSideLocation::Supply)](LoopNum).Branch(BranchNum)); + auto const &this_plant_supply_branch = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum); + auto &this_vent_plant_supply_branch = state.dataPlnt->VentRepPlant[static_cast(LoopSideLocation::Supply)](LoopNum).Branch(BranchNum); this_vent_plant_supply_branch.Name = this_plant_supply_branch.Name; this_vent_plant_supply_branch.NodeNumIn = this_plant_supply_branch.NodeNumIn; @@ -1681,9 +1697,10 @@ void GetPlantInput(EnergyPlusData &state) CompNum <= state.dataPlnt->VentRepPlant[static_cast(LoopSideLocation::Supply)](LoopNum).Branch(BranchNum).TotalComponents; ++CompNum) { - auto &this_plant_supply_comp(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).Comp(CompNum)); - auto &this_vent_plant_supply_comp( - state.dataPlnt->VentRepPlant[static_cast(LoopSideLocation::Supply)](LoopNum).Branch(BranchNum).Comp(CompNum)); + auto const &this_plant_supply_comp = + state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).Comp(CompNum); + auto &this_vent_plant_supply_comp = + state.dataPlnt->VentRepPlant[static_cast(LoopSideLocation::Supply)](LoopNum).Branch(BranchNum).Comp(CompNum); this_vent_plant_supply_comp.Name = this_plant_supply_comp.Name; this_vent_plant_supply_comp.TypeOf = this_plant_supply_comp.TypeOf; @@ -1707,8 +1724,8 @@ void GetPlantInput(EnergyPlusData &state) for (BranchNum = 1; BranchNum <= this_vent_plant_demand.TotalBranches; ++BranchNum) { - auto &this_plant_demand_branch(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum)); - auto &this_vent_plant_demand_branch(state.dataPlnt->VentRepPlant[static_cast(LoopSideLocation::Demand)](LoopNum).Branch(BranchNum)); + auto const &this_plant_demand_branch = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum); + auto &this_vent_plant_demand_branch = state.dataPlnt->VentRepPlant[static_cast(LoopSideLocation::Demand)](LoopNum).Branch(BranchNum); this_vent_plant_demand_branch.Name = this_plant_demand_branch.Name; this_vent_plant_demand_branch.NodeNumIn = this_plant_demand_branch.NodeNumIn; @@ -1721,9 +1738,10 @@ void GetPlantInput(EnergyPlusData &state) for (CompNum = 1; CompNum <= this_vent_plant_demand_branch.TotalComponents; ++CompNum) { - auto &this_plant_demand_comp(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum).Comp(CompNum)); - auto &this_vent_plant_demand_comp( - state.dataPlnt->VentRepPlant[static_cast(LoopSideLocation::Demand)](LoopNum).Branch(BranchNum).Comp(CompNum)); + auto const &this_plant_demand_comp = + state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum).Comp(CompNum); + auto &this_vent_plant_demand_comp = + state.dataPlnt->VentRepPlant[static_cast(LoopSideLocation::Demand)](LoopNum).Branch(BranchNum).Comp(CompNum); this_vent_plant_demand_comp.Name = this_plant_demand_comp.Name; this_vent_plant_demand_comp.TypeOf = this_plant_demand_comp.TypeOf; @@ -2205,7 +2223,6 @@ void InitializeLoops(EnergyPlusData &state, bool const FirstHVACIteration) // tr // temperature changes. Branch levels for all branches are also set. // Using/Aliasing - using ScheduleManager::GetCurrentScheduleValue; using namespace DataSizing; using EMSManager::CheckIfNodeSetPointManagedByEMS; @@ -2238,7 +2255,7 @@ void InitializeLoops(EnergyPlusData &state, bool const FirstHVACIteration) // tr // demand. Long term, I recommend that we: // 1. specify the setpointmanager:plant object name (not the node name) in the plantloop/condloop objects // 2. write a new setpoint manager (setpointmanager:plant) that is more suitable for plant use and - // accomodates AIR and GROUND setpoints...with offsets. + // accommodates AIR and GROUND setpoints...with offsets. //***************************************************************** // ONE TIME LOOP NODE SETPOINT CHECK @@ -2369,7 +2386,7 @@ void InitializeLoops(EnergyPlusData &state, bool const FirstHVACIteration) // tr // END First Pass SIZING INIT //***************************************************************** //***************************************************************** - // BEGIN Resizing Pass for HVAC Sizing Simultion Adjustments + // BEGIN Resizing Pass for HVAC Sizing Simulation Adjustments //***************************************************************** if (state.dataGlobal->RedoSizesHVACSimulation && !state.dataPlnt->PlantReSizingCompleted) { @@ -2522,9 +2539,6 @@ void ReInitPlantLoopsAtFirstHVACIteration(EnergyPlusData &state) // called from SimHVAC to reset mass flow rate requests // this contains all the initializations - // Using/Aliasing - using ScheduleManager::GetCurrentScheduleValue; - // SUBROUTINE PARAMETER DEFINITIONS: Real64 constexpr StartQuality(1.0); Real64 constexpr StartHumRat(0.0); @@ -2616,20 +2630,12 @@ void ReInitPlantLoopsAtFirstHVACIteration(EnergyPlusData &state) state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).OutletNode.MassFlowRateHistory = 0.0; if (state.dataPlnt->PlantLoop(LoopNum).FluidType != DataLoopNode::NodeFluidType::Steam) { - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(LoopNum).FluidName, - LoopSetPointTemp, - state.dataPlnt->PlantLoop(LoopNum).FluidIndex, - RoutineNameAlt); + Cp = state.dataPlnt->PlantLoop(LoopNum).glycol->getSpecificHeat(state, LoopSetPointTemp, RoutineNameAlt); StartEnthalpy = Cp * LoopSetPointTemp; } // Use Min/Max flow rates to initialize loop if (state.dataPlnt->PlantLoop(LoopNum).FluidType == DataLoopNode::NodeFluidType::Water) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(LoopNum).FluidName, - LoopSetPointTemp, - state.dataPlnt->PlantLoop(LoopNum).FluidIndex, - RoutineNameAlt); + rho = state.dataPlnt->PlantLoop(LoopNum).glycol->getDensity(state, LoopSetPointTemp, RoutineNameAlt); LoopMaxMassFlowRate = state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate * rho; LoopMinMassFlowRate = state.dataPlnt->PlantLoop(LoopNum).MinVolFlowRate * rho; @@ -2637,11 +2643,12 @@ void ReInitPlantLoopsAtFirstHVACIteration(EnergyPlusData &state) // use saturated liquid of steam at the loop setpoint temp as the starting enthalpy for a water loop if (state.dataPlnt->PlantLoop(LoopNum).FluidType == DataLoopNode::NodeFluidType::Steam) { SteamTemp = 100.0; - SteamDensity = FluidProperties::GetSatDensityRefrig( - state, fluidNameSteam, SteamTemp, 1.0, state.dataPlnt->PlantLoop(LoopNum).FluidIndex, RoutineName); + auto *steam = Fluid::GetSteam(state); + state.dataPlnt->PlantLoop(LoopNum).FluidIndex = steam->Num; + + SteamDensity = steam->getSatDensity(state, SteamTemp, 1.0, RoutineName); LoopMaxMassFlowRate = state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate * SteamDensity; - StartEnthalpy = FluidProperties::GetSatEnthalpyRefrig( - state, fluidNameSteam, LoopSetPointTemp, 0.0, state.dataPlnt->PlantLoop(LoopNum).FluidIndex, RoutineName); + StartEnthalpy = steam->getSatEnthalpy(state, LoopSetPointTemp, 0.0, RoutineName); LoopMinMassFlowRate = state.dataPlnt->PlantLoop(LoopNum).MinVolFlowRate * SteamDensity; } @@ -2810,12 +2817,12 @@ void ReInitPlantLoopsAtFirstHVACIteration(EnergyPlusData &state) for (OpNum = 1; OpNum <= state.dataPlnt->PlantLoop(LoopNum).NumOpSchemes; ++OpNum) { // If the operating scheme is scheduled "OFF", go to next scheme state.dataPlnt->PlantLoop(LoopNum).OpScheme(OpNum).Available = - GetCurrentScheduleValue(state, state.dataPlnt->PlantLoop(LoopNum).OpScheme(OpNum).SchedPtr) > 0.0; + state.dataPlnt->PlantLoop(LoopNum).OpScheme(OpNum).sched->getCurrentVal() > 0.0; } } } -void UpdateNodeThermalHistory(EnergyPlusData &state) +void UpdateNodeThermalHistory(EnergyPlusData const &state) { // SUBROUTINE INFORMATION: @@ -2862,7 +2869,7 @@ void CheckPlantOnAbort(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Brent Griffith - // DATE WRITTEN Septemeber 2006 + // DATE WRITTEN September 2006 // MODIFIED na // RE-ENGINEERED na @@ -2894,7 +2901,6 @@ void CheckPlantOnAbort(EnergyPlusData &state) if (!(allocated(state.dataPlnt->PlantLoop))) return; for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) { - int constexpr numLoopSides = 2; for (DataPlant::LoopSideLocation SideNum : DataPlant::LoopSideKeys) { if (!(state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Splitter.Exists)) continue; @@ -3333,14 +3339,9 @@ void SizePlantLoop(EnergyPlusData &state, // should now have plant volume, calculate plant volume's mass for fluid type if (state.dataPlnt->PlantLoop(LoopNum).FluidType == DataLoopNode::NodeFluidType::Water) { - FluidDensity = FluidProperties::GetDensityGlycol( - state, state.dataPlnt->PlantLoop(LoopNum).FluidName, Constant::InitConvTemp, state.dataPlnt->PlantLoop(LoopNum).FluidIndex, RoutineName); - if (PlantSizNum > 0 && allocated(state.dataSize->PlantSizData)) { // method only works if sizing delta T is avaiable - Real64 cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(LoopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(LoopNum).FluidIndex, - RoutineName); + FluidDensity = state.dataPlnt->PlantLoop(LoopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); + if (PlantSizNum > 0 && allocated(state.dataSize->PlantSizData)) { // method only works if sizing delta T is available + Real64 cp = state.dataPlnt->PlantLoop(LoopNum).glycol->getSpecificHeat(state, Constant::InitConvTemp, RoutineName); Real64 DesignPlantCapacity = cp * FluidDensity * state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate * state.dataSize->PlantSizData(PlantSizNum).DeltaT; state.dataSize->PlantSizData(PlantSizNum).DesCapacity = DesignPlantCapacity; // store it for later use in scaling @@ -3349,8 +3350,9 @@ void SizePlantLoop(EnergyPlusData &state, } } } else if (state.dataPlnt->PlantLoop(LoopNum).FluidType == DataLoopNode::NodeFluidType::Steam) { - FluidDensity = - FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, 100.0, 1.0, state.dataPlnt->PlantLoop(LoopNum).FluidIndex, RoutineName); + auto *steam = Fluid::GetSteam(state); + state.dataPlnt->PlantLoop(LoopNum).FluidIndex = steam->Num; + FluidDensity = steam->getSatDensity(state, 100.0, 1.0, RoutineName); } else { assert(false); } @@ -3477,11 +3479,9 @@ void ResizePlantLoopLevelSizes(EnergyPlusData &state, int const LoopNum // Suppl // should now have plant volume, calculate plant volume's mass for fluid type if (state.dataPlnt->PlantLoop(LoopNum).FluidType == DataLoopNode::NodeFluidType::Water) { - FluidDensity = FluidProperties::GetDensityGlycol( - state, state.dataPlnt->PlantLoop(LoopNum).FluidName, Constant::InitConvTemp, state.dataPlnt->PlantLoop(LoopNum).FluidIndex, RoutineName); + FluidDensity = state.dataPlnt->PlantLoop(LoopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); } else if (state.dataPlnt->PlantLoop(LoopNum).FluidType == DataLoopNode::NodeFluidType::Steam) { - FluidDensity = - FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, 100.0, 1.0, state.dataPlnt->PlantLoop(LoopNum).FluidIndex, RoutineName); + FluidDensity = Fluid::GetSteam(state)->getSatDensity(state, 100.0, 1.0, RoutineName); } else { assert(false); } @@ -3506,7 +3506,7 @@ void SetupInitialPlantCallingOrder(EnergyPlusData &state) // METHODOLOGY EMPLOYED: // simple rule-based allocation of which order to call the half loops - // initially just mimicing historical practice until a better set of rules is + // initially just mimicking historical practice until a better set of rules is // developed // 1. first call all plant demand sides // 2. second call all plant supply sides @@ -3558,7 +3558,7 @@ void RevisePlantCallingOrder(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Brent Griffith - // DATE WRITTEN april 2011 + // DATE WRITTEN April 2011 // MODIFIED na // RE-ENGINEERED na @@ -4509,7 +4509,7 @@ void CheckIfAnyPlant(EnergyPlusData &state) // determine if any plant loops will be ever be set up // METHODOLOGY EMPLOYED: - // use input processor ot find number of plant loops + // use input processor to find number of plant loops // Using/Aliasing // SUBROUTINE LOCAL VARIABLE DECLARATIONS: @@ -4540,7 +4540,7 @@ void CheckOngoingPlantWarnings(EnergyPlusData &state) ShowWarningError( state, "Plant Loop: " + state.dataPlnt->PlantLoop(LoopNum).Name + " Demand Side is storing excess heat the majority of the time."); ShowContinueError(state, - format("Excesss Storage Time={:.2R}[hr], Total Loop Active Time={:.2R}[hr]", + format("Excess Storage Time={:.2R}[hr], Total Loop Active Time={:.2R}[hr]", state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).LoopSideInlet_CapExcessStorageTime, state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).LoopSideInlet_TotalTime)); } @@ -4549,7 +4549,7 @@ void CheckOngoingPlantWarnings(EnergyPlusData &state) ShowWarningError( state, "Plant Loop: " + state.dataPlnt->PlantLoop(LoopNum).Name + " Supply Side is storing excess heat the majority of the time."); ShowContinueError(state, - format("Excesss Storage Time={:.2R}[hr], Total Loop Active Time={:.2R}[hr]", + format("Excess Storage Time={:.2R}[hr], Total Loop Active Time={:.2R}[hr]", state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).LoopSideInlet_CapExcessStorageTime, state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).LoopSideInlet_TotalTime)); } diff --git a/src/EnergyPlus/Plant/PlantManager.hh b/src/EnergyPlus/Plant/PlantManager.hh index a132fd5b985..dca0e0686c5 100644 --- a/src/EnergyPlus/Plant/PlantManager.hh +++ b/src/EnergyPlus/Plant/PlantManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -118,7 +118,7 @@ namespace PlantManager { void ReInitPlantLoopsAtFirstHVACIteration(EnergyPlusData &state); - void UpdateNodeThermalHistory(EnergyPlusData &state); + void UpdateNodeThermalHistory(EnergyPlusData const &state); void CheckPlantOnAbort(EnergyPlusData &state); @@ -176,6 +176,10 @@ struct PlantMgrData : BaseGlobalStruct int newCallingIndex = 0; PlantManager::EmptyPlantComponent dummyPlantComponent; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/Plant/ReportBranchData.hh b/src/EnergyPlus/Plant/ReportBranchData.hh index b7e16a3b809..74ea9cac7df 100644 --- a/src/EnergyPlus/Plant/ReportBranchData.hh +++ b/src/EnergyPlus/Plant/ReportBranchData.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Plant/ReportCompData.hh b/src/EnergyPlus/Plant/ReportCompData.hh index 6721be90215..39071f0126f 100644 --- a/src/EnergyPlus/Plant/ReportCompData.hh +++ b/src/EnergyPlus/Plant/ReportCompData.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Plant/ReportLoopData.hh b/src/EnergyPlus/Plant/ReportLoopData.hh index 90c6e227612..d34d6580918 100644 --- a/src/EnergyPlus/Plant/ReportLoopData.hh +++ b/src/EnergyPlus/Plant/ReportLoopData.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Plant/SplitterData.hh b/src/EnergyPlus/Plant/SplitterData.hh index 994e5576a2b..84dc39b9779 100644 --- a/src/EnergyPlus/Plant/SplitterData.hh +++ b/src/EnergyPlus/Plant/SplitterData.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/Plant/Subcomponents.hh b/src/EnergyPlus/Plant/Subcomponents.hh index 77df0390d82..3c574c67ac5 100644 --- a/src/EnergyPlus/Plant/Subcomponents.hh +++ b/src/EnergyPlus/Plant/Subcomponents.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/PlantCentralGSHP.cc b/src/EnergyPlus/PlantCentralGSHP.cc index 64630dd0ea5..06609bd38d5 100644 --- a/src/EnergyPlus/PlantCentralGSHP.cc +++ b/src/EnergyPlus/PlantCentralGSHP.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -311,17 +311,10 @@ void WrapperSpecs::SizeWrapper(EnergyPlusData &state) // each individual chiller heater module is sized to be capable of supporting the total load on the wrapper if (PltSizNum > 0) { if (state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow && tmpEvapVolFlowRate > 0.0) { - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); - - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = + state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getSpecificHeat(state, Constant::CWInitConvTemp, RoutineName); + + Real64 rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); tmpNomCap = Cp * rho * state.dataSize->PlantSizData(PltSizNum).DeltaT * tmpEvapVolFlowRate; if (!this->ChillerHeater(NumChillerHeater).RefCapCoolingWasAutoSized) tmpNomCap = this->ChillerHeater(NumChillerHeater).RefCapCooling; @@ -412,17 +405,11 @@ void WrapperSpecs::SizeWrapper(EnergyPlusData &state) // each individual chiller heater module is sized to be capable of supporting the total load on the wrapper if (PltSizCondNum > 0) { if (state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->GLHEPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->GLHEPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = + state.dataPlnt->PlantLoop(this->GLHEPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); // TODO: JM 2018-12-06 I wonder why Cp isn't calculated at the same temp as rho... - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->GLHEPlantLoc.loopNum).FluidName, - this->ChillerHeater(NumChillerHeater).TempRefCondInCooling, - state.dataPlnt->PlantLoop(this->GLHEPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->GLHEPlantLoc.loopNum) + .glycol->getSpecificHeat(state, this->ChillerHeater(NumChillerHeater).TempRefCondInCooling, RoutineName); tmpCondVolFlowRate = tmpNomCap * (1.0 + (1.0 / this->ChillerHeater(NumChillerHeater).RefCOPCooling) * this->ChillerHeater(NumChillerHeater).OpenMotorEff) / @@ -553,6 +540,8 @@ void GetWrapperInput(EnergyPlusData &state) // PURPOSE OF THIS SUBROUTINE: // This routine will get the input required by the Wrapper model. + static constexpr std::string_view routineName = "GetWrapperInput"; + bool ErrorsFound(false); // True when input errors are found int NumAlphas; // Number of elements in the alpha array int NumNums; // Number of elements in the numeric array @@ -583,6 +572,8 @@ void GetWrapperInput(EnergyPlusData &state) state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + ErrorObjectHeader eoh{routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + state.dataPlantCentralGSHP->Wrapper(WrapperNum).Name = state.dataIPShortCut->cAlphaArgs(1); // initialize nth chiller heater index (including identical units) for current wrapper @@ -677,9 +668,10 @@ void GetWrapperInput(EnergyPlusData &state) state.dataPlantCentralGSHP->Wrapper(WrapperNum).AncillaryPower = state.dataIPShortCut->rNumericArgs(1); if (state.dataIPShortCut->lAlphaFieldBlanks(9)) { - state.dataPlantCentralGSHP->Wrapper(WrapperNum).SchedPtr = 0; - } else { - state.dataPlantCentralGSHP->Wrapper(WrapperNum).SchedPtr = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(9)); + // Leave this as nullptr + } else if ((state.dataPlantCentralGSHP->Wrapper(WrapperNum).ancillaryPowerSched = + Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(9))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(9), state.dataIPShortCut->cAlphaArgs(9)); } int NumberOfComp = (NumAlphas - 9) / 3; @@ -700,23 +692,21 @@ void GetWrapperInput(EnergyPlusData &state) state.dataPlantCentralGSHP->Wrapper(WrapperNum).WrapperComp(Comp).WrapperPerformanceObjectType = state.dataIPShortCut->cAlphaArgs(loop); state.dataPlantCentralGSHP->Wrapper(WrapperNum).WrapperComp(Comp).WrapperComponentName = state.dataIPShortCut->cAlphaArgs(loop + 1); + if (state.dataIPShortCut->lAlphaFieldBlanks(loop + 2)) { - state.dataPlantCentralGSHP->Wrapper(WrapperNum).WrapperComp(Comp).CHSchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - state.dataPlantCentralGSHP->Wrapper(WrapperNum).WrapperComp(Comp).CHSchedPtr = - ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(loop + 2)); - if (state.dataPlantCentralGSHP->Wrapper(WrapperNum).WrapperComp(Comp).CHSchedPtr == 0) { - state.dataPlantCentralGSHP->Wrapper(WrapperNum).WrapperComp(Comp).CHSchedPtr = ScheduleManager::ScheduleAlwaysOn; - ShowWarningError(state, "Chiller Heater Modules Control Schedule Name not found"); - ShowContinueError(state, - format(" for {}= {}", - state.dataPlantCentralGSHP->Wrapper(WrapperNum).WrapperComp(Comp).WrapperPerformanceObjectType, - state.dataPlantCentralGSHP->Wrapper(WrapperNum).WrapperComp(Comp).WrapperComponentName)); - ShowContinueError( - state, format(" in the object {}= {}", state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "The Control Schedule is treated as AlwaysOn instead."); - } + state.dataPlantCentralGSHP->Wrapper(WrapperNum).WrapperComp(Comp).chSched = + Sched::GetScheduleAlwaysOn(state); // Not an availability schedule, but defaults to constant-1.0 + } else if ((state.dataPlantCentralGSHP->Wrapper(WrapperNum).WrapperComp(Comp).chSched = + Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(loop + 2))) == nullptr) { + state.dataPlantCentralGSHP->Wrapper(WrapperNum).WrapperComp(Comp).chSched = + Sched::GetScheduleAlwaysOn(state); // Not an availabilty schedule, but defaults to constant-1.0 + ShowWarningItemNotFound(state, + eoh, + state.dataIPShortCut->cAlphaFieldNames(loop + 2), + state.dataIPShortCut->cAlphaArgs(loop + 2), + "The Control Schedule is treated as AlwaysOn instead."); } + state.dataPlantCentralGSHP->Wrapper(WrapperNum).WrapperComp(Comp).WrapperIdenticalObjectNum = state.dataIPShortCut->rNumericArgs(1 + Comp); if (state.dataPlantCentralGSHP->Wrapper(WrapperNum).WrapperComp(Comp).WrapperPerformanceObjectType == @@ -1690,11 +1680,7 @@ void WrapperSpecs::initialize(EnergyPlusData &state, this->GLHEVolFlowRate += this->ChillerHeater(ChillerHeaterNum).CondVolFlowRate; } - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); this->CHWMassFlowRateMax = this->CHWVolFlowRate * rho; this->HWMassFlowRateMax = this->HWVolFlowRate * rho; @@ -1899,26 +1885,14 @@ void WrapperSpecs::CalcChillerModel(EnergyPlusData &state) Real64 CondMassFlowRate; // Condenser mass flow rate // Check whether this chiller heater needs to run - if (EvaporatorLoad > 0.0 && (ScheduleManager::GetCurrentScheduleValue(state, this->WrapperComp(CompNum).CHSchedPtr) > 0.0)) { + if (EvaporatorLoad > 0.0 && (this->WrapperComp(CompNum).chSched->getCurrentVal() > 0.0)) { IsLoadCoolRemaining = true; // Calculate density ratios to adjust mass flow rates from initialized ones // Hot water temperature is known, but evaporator mass flow rates will be adjusted in the following "Do" loop - Real64 InitDensity = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); - Real64 EvapDensity = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - EvapInletTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); - Real64 CondDensity = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - CondInletTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 InitDensity = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); + Real64 EvapDensity = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, EvapInletTemp, RoutineName); + Real64 CondDensity = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, CondInletTemp, RoutineName); // Calculate density ratios to adjust mass flow rates from initialized ones @@ -1947,8 +1921,7 @@ void WrapperSpecs::CalcChillerModel(EnergyPlusData &state) } // Chiller heater is on when cooling load for this chiller heater remains and chilled water available - if (IsLoadCoolRemaining && (EvapMassFlowRate > 0) && - (ScheduleManager::GetCurrentScheduleValue(state, this->WrapperComp(CompNum).CHSchedPtr) > 0)) { + if (IsLoadCoolRemaining && (EvapMassFlowRate > 0) && (this->WrapperComp(CompNum).chSched->getCurrentVal() > 0)) { // Indicate current mode is cooling-only mode. Simultaneous clg/htg mode will be set later CurrentMode = 1; @@ -1992,11 +1965,7 @@ void WrapperSpecs::CalcChillerModel(EnergyPlusData &state) state.dataPlantCentralGSHP->ChillerCapFT = this->calcChillerCapFT(state, ChillerHeaterNum, EvapOutletTempSetPoint, CondTempforCurve); // Calculate the specific heat of chilled water - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - EvapInletTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getSpecificHeat(state, EvapInletTemp, RoutineName); // Calculate cooling load this chiller should meet and the other chillers are demanded EvapOutletTempSetPoint = state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).TempSetPointNodeNum).TempSetPoint; @@ -2086,11 +2055,7 @@ void WrapperSpecs::CalcChillerModel(EnergyPlusData &state) } if (CondMassFlowRate > DataBranchAirLoopPlant::MassFlowTolerance) { - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->GLHEPlantLoc.loopNum).FluidName, - CondInletTemp, - state.dataPlnt->PlantLoop(this->GLHEPlantLoc.loopNum).FluidIndex, - RoutineNameElecEIRChiller); + Cp = state.dataPlnt->PlantLoop(this->GLHEPlantLoc.loopNum).glycol->getSpecificHeat(state, CondInletTemp, RoutineNameElecEIRChiller); CondOutletTemp = QCondenser / CondMassFlowRate / Cp + CondInletTemp; } else { ShowSevereError( @@ -2189,7 +2154,6 @@ void WrapperSpecs::CalcChillerHeaterModel(EnergyPlusData &state) // 1. DOE-2 Engineers Manual, Version 2.1A, November 1982, LBL-11353 static constexpr std::string_view RoutineName("CalcChillerHeaterModel"); - static constexpr std::string_view RoutineNameElecEIRChiller("CalcElectricEIRChillerModel"); bool IsLoadHeatRemaining; // Ture if heating load remains for this chiller heater bool NextCompIndicator(false); // Component indicator when identical chiller heaters exist @@ -2256,26 +2220,14 @@ void WrapperSpecs::CalcChillerHeaterModel(EnergyPlusData &state) Real64 EvapMassFlowRate; // Evaporator mass flow rate through this chiller heater // Check to see if this chiller heater needs to run - if (CondenserLoad > 0.0 && (ScheduleManager::GetCurrentScheduleValue(state, this->WrapperComp(CompNum).CHSchedPtr) > 0)) { + if (CondenserLoad > 0.0 && (this->WrapperComp(CompNum).chSched->getCurrentVal() > 0)) { IsLoadHeatRemaining = true; // Calculate density ratios to adjust mass flow rates from initialized ones // Hot water temperature is known, but condenser mass flow rates will be adjusted in the following "Do" loop - Real64 InitDensity = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); - Real64 EvapDensity = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - EvapInletTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); - Real64 CondDensity = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - CondInletTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 InitDensity = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); + Real64 EvapDensity = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, EvapInletTemp, RoutineName); + Real64 CondDensity = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, CondInletTemp, RoutineName); // Calculate density ratios to adjust mass flow rates from initialized ones Real64 HWDensityRatio = CondDensity / InitDensity; @@ -2348,12 +2300,11 @@ void WrapperSpecs::CalcChillerHeaterModel(EnergyPlusData &state) } // End of mode determination } // End of system operation determinatoin - if (IsLoadHeatRemaining && CondMassFlowRate > 0.0 && - (ScheduleManager::GetCurrentScheduleValue(state, this->WrapperComp(CompNum).CHSchedPtr) > 0)) { // System is on + if (IsLoadHeatRemaining && CondMassFlowRate > 0.0 && (this->WrapperComp(CompNum).chSched->getCurrentVal() > 0)) { // System is on // Operation mode if (this->SimulHtgDominant) { if (this->ChillerHeater(ChillerHeaterNum).Report.QEvapSimul == 0.0) { - CurrentMode = 5; // No cooling necessary + CurrentMode = 5; // No cooling necessary // Why is this not an enum? } else { // Heat recovery mode. Both chilled water and hot water loops are connected. No condenser flow. CurrentMode = 3; } @@ -2419,11 +2370,8 @@ void WrapperSpecs::CalcChillerHeaterModel(EnergyPlusData &state) PartLoadRat = 0.0; } - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum).FluidName, - this->ChillerHeater(ChillerHeaterNum).EvapInletNode.Temp, - state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum) + .glycol->getSpecificHeat(state, this->ChillerHeater(ChillerHeaterNum).EvapInletNode.Temp, RoutineName); // Calculate evaporator heat transfer if (EvapMassFlowRate > DataBranchAirLoopPlant::MassFlowTolerance) { @@ -2585,11 +2533,7 @@ void WrapperSpecs::adjustChillerHeaterCondFlowTemp(EnergyPlusData &state, { // Based on whether this is variable or constant flow, adjust either flow or outlet temperature and also the load static constexpr std::string_view RoutineName("adjustChillerHeaterCondFlowTemp"); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum).FluidName, - CondInletTemp, - state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum).glycol->getSpecificHeat(state, CondInletTemp, RoutineName); if (this->VariableFlowCH) { // Variable Flow (adjust flow and condenser load as needed) Real64 CondMassFlowRateCalc = QCondenser / CondDeltaTemp / Cp; @@ -2618,11 +2562,7 @@ void WrapperSpecs::adjustChillerHeaterEvapFlowTemp( // Adjust flow and outlet temperature for the evaporator side without modifying the heat transfer rate Real64 constexpr lowLoad = 0.001; static constexpr std::string_view routineName("adjustChillerHeaterEvapFlowTemp"); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum).FluidName, - evapInletTemp, - state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum).FluidIndex, - routineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum).glycol->getSpecificHeat(state, evapInletTemp, routineName); Real64 evapDeltaTemp = evapInletTemp - evapOutletTemp; if ((qEvaporator < lowLoad) || (evapDeltaTemp <= 0.0)) { @@ -2640,8 +2580,10 @@ void WrapperSpecs::adjustChillerHeaterEvapFlowTemp( } } -Real64 -WrapperSpecs::setChillerHeaterCondTemp(EnergyPlusData &state, int const numChillerHeater, Real64 const condEnteringTemp, Real64 const condLeavingTemp) +Real64 WrapperSpecs::setChillerHeaterCondTemp([[maybe_unused]] EnergyPlusData &state, + int const numChillerHeater, + Real64 const condEnteringTemp, + Real64 const condLeavingTemp) { Real64 setChillerHeaterCondTemp; if (this->ChillerHeater(numChillerHeater).CondMode == CondenserModeTemperature::EnteringCondenser) { @@ -2683,7 +2625,7 @@ Real64 WrapperSpecs::calcChillerCapFT(EnergyPlusData &state, int const numChille return chillCapFT; } -void WrapperSpecs::checkEvapOutletTemp(EnergyPlusData &state, +void WrapperSpecs::checkEvapOutletTemp([[maybe_unused]] EnergyPlusData &state, int const numChillerHeater, Real64 &evapOutletTemp, Real64 const lowTempLimitEout, @@ -2888,8 +2830,8 @@ void WrapperSpecs::CalcWrapperModel(EnergyPlusData &state, Real64 &MyLoad, int c HWOutletTemp = HWInletTemp; - if (ScheduleManager::GetCurrentScheduleValue(state, this->SchedPtr) > 0) { - WrapperElecPowerCool += (this->AncillaryPower * ScheduleManager::GetCurrentScheduleValue(state, this->SchedPtr)); + if (this->ancillaryPowerSched != nullptr) { + WrapperElecPowerCool += (this->AncillaryPower * this->ancillaryPowerSched->getCurrentVal()); } state.dataLoopNodes->Node(this->CHWOutletNodeNum).Temp = CHWOutletTemp; @@ -3102,8 +3044,8 @@ void WrapperSpecs::CalcWrapperModel(EnergyPlusData &state, Real64 &MyLoad, int c } // Add ancilliary power if scheduled - if (ScheduleManager::GetCurrentScheduleValue(state, this->SchedPtr) > 0) { - WrapperElecPowerCool += (this->AncillaryPower * ScheduleManager::GetCurrentScheduleValue(state, this->SchedPtr)); + if (this->ancillaryPowerSched != nullptr) { + WrapperElecPowerCool += (this->AncillaryPower * this->ancillaryPowerSched->getCurrentVal()); } // Electricity should be counted once for cooling in this mode @@ -3216,8 +3158,8 @@ void WrapperSpecs::CalcWrapperModel(EnergyPlusData &state, Real64 &MyLoad, int c } // Check if ancilliary power is used - if (ScheduleManager::GetCurrentScheduleValue(state, this->SchedPtr) > 0) { - WrapperElecPowerHeat += (this->AncillaryPower * ScheduleManager::GetCurrentScheduleValue(state, this->SchedPtr)); + if (this->ancillaryPowerSched != nullptr) { + WrapperElecPowerHeat += (this->AncillaryPower * this->ancillaryPowerSched->getCurrentVal()); } // Electricity should be counted once @@ -3280,8 +3222,8 @@ void WrapperSpecs::CalcWrapperModel(EnergyPlusData &state, Real64 &MyLoad, int c CHWOutletTemp = CHWInletTemp; // Add ancilliary power if necessary - if (ScheduleManager::GetCurrentScheduleValue(state, this->SchedPtr) > 0) { - WrapperElecPowerHeat += (this->AncillaryPower * ScheduleManager::GetCurrentScheduleValue(state, this->SchedPtr)); + if (this->ancillaryPowerSched != nullptr) { + WrapperElecPowerHeat += (this->AncillaryPower * this->ancillaryPowerSched->getCurrentVal()); } } // End of calculations diff --git a/src/EnergyPlus/PlantCentralGSHP.hh b/src/EnergyPlus/PlantCentralGSHP.hh index f359393f1ec..0b213d3e0bc 100644 --- a/src/EnergyPlus/PlantCentralGSHP.hh +++ b/src/EnergyPlus/PlantCentralGSHP.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -107,9 +107,9 @@ namespace PlantCentralGSHP { std::string WrapperComponentName; // Component name int WrapperPerformanceObjectIndex; // Component index in the input array int WrapperIdenticalObjectNum; // Number of identical objects - int CHSchedPtr; // Index to schedule + Sched::Schedule *chSched = nullptr; // schedule - WrapperComponentSpecs() : WrapperPerformanceObjectIndex(0), WrapperIdenticalObjectNum(0), CHSchedPtr(0) + WrapperComponentSpecs() : WrapperPerformanceObjectIndex(0), WrapperIdenticalObjectNum(0) { } }; @@ -329,27 +329,27 @@ namespace PlantCentralGSHP { struct WrapperSpecs : PlantComponent { - std::string Name; // User identifier - bool VariableFlowCH; // True if all chiller heaters are variable flow control - int SchedPtr; // Schedule value for ancillary power control - int CHSchedPtr; // Schedule value for individual chiller heater control - CondenserType ControlMode; // SmartMixing or FullyMixing - int CHWInletNodeNum; // Node number on the inlet side of the plant (Chilled Water side) - int CHWOutletNodeNum; // Node number on the outlet side of the plant (Chilled Water side) - int HWInletNodeNum; // Node number on the inlet side of the plant (Hot Water side) - int HWOutletNodeNum; // Node number on the outlet side of the plant (Hot Water side) - int GLHEInletNodeNum; // Node number on the inlet side of the plant (GLHE Water side) - int GLHEOutletNodeNum; // Node number on the outlet side of the plant (GLHE Water side) - int NumOfComp; // Number of Components under the wrapper - Real64 CHWMassFlowRate; // Chilled water mass flow rate - Real64 HWMassFlowRate; // Hot water mass flow rate - Real64 GLHEMassFlowRate; // Condenser water mass flow rate - Real64 CHWMassFlowRateMax; // Maximum chilled water mass flow rate - Real64 HWMassFlowRateMax; // Maximum hot water mass flow rate - Real64 GLHEMassFlowRateMax; // Maximum condenser water mass flow rate - Real64 WrapperCoolingLoad; // Cooling demand for the central heat pump system - Real64 WrapperHeatingLoad; // Heating demand for the central heat pump system - Real64 AncillaryPower; // Wrapper Ancillary Power + std::string Name; // User identifier + bool VariableFlowCH; // True if all chiller heaters are variable flow control + Sched::Schedule *ancillaryPowerSched = nullptr; // Schedule value for ancillary power control + Sched::Schedule *chSched = nullptr; // Schedule value for individual chiller heater control + CondenserType ControlMode; // SmartMixing or FullyMixing + int CHWInletNodeNum; // Node number on the inlet side of the plant (Chilled Water side) + int CHWOutletNodeNum; // Node number on the outlet side of the plant (Chilled Water side) + int HWInletNodeNum; // Node number on the inlet side of the plant (Hot Water side) + int HWOutletNodeNum; // Node number on the outlet side of the plant (Hot Water side) + int GLHEInletNodeNum; // Node number on the inlet side of the plant (GLHE Water side) + int GLHEOutletNodeNum; // Node number on the outlet side of the plant (GLHE Water side) + int NumOfComp; // Number of Components under the wrapper + Real64 CHWMassFlowRate; // Chilled water mass flow rate + Real64 HWMassFlowRate; // Hot water mass flow rate + Real64 GLHEMassFlowRate; // Condenser water mass flow rate + Real64 CHWMassFlowRateMax; // Maximum chilled water mass flow rate + Real64 HWMassFlowRateMax; // Maximum hot water mass flow rate + Real64 GLHEMassFlowRateMax; // Maximum condenser water mass flow rate + Real64 WrapperCoolingLoad; // Cooling demand for the central heat pump system + Real64 WrapperHeatingLoad; // Heating demand for the central heat pump system + Real64 AncillaryPower; // Wrapper Ancillary Power Array1D WrapperComp; Array1D ChillerHeater; // Dimension to number of machines bool CoolSetPointErrDone; // true if setpoint warning issued @@ -376,14 +376,13 @@ namespace PlantCentralGSHP { bool mySizesReported; WrapperSpecs() - : VariableFlowCH(false), SchedPtr(0), CHSchedPtr(0), ControlMode(CondenserType::Invalid), CHWInletNodeNum(0), CHWOutletNodeNum(0), - HWInletNodeNum(0), HWOutletNodeNum(0), GLHEInletNodeNum(0), GLHEOutletNodeNum(0), NumOfComp(0), CHWMassFlowRate(0.0), - HWMassFlowRate(0.0), GLHEMassFlowRate(0.0), CHWMassFlowRateMax(0.0), HWMassFlowRateMax(0.0), GLHEMassFlowRateMax(0.0), - WrapperCoolingLoad(0.0), WrapperHeatingLoad(0.0), AncillaryPower(0.0), CoolSetPointErrDone(false), HeatSetPointErrDone(false), - CoolSetPointSetToLoop(false), HeatSetPointSetToLoop(false), ChillerHeaterNums(0), CWPlantLoc{}, HWPlantLoc{}, GLHEPlantLoc{}, - CHWMassFlowIndex(0), HWMassFlowIndex(0), GLHEMassFlowIndex(0), SizingFactor(1.0), CHWVolFlowRate(0.0), HWVolFlowRate(0.0), - GLHEVolFlowRate(0.0), MyWrapperFlag(true), MyWrapperEnvrnFlag(true), SimulClgDominant(false), SimulHtgDominant(false), - setupOutputVarsFlag(true), mySizesReported(false) + : VariableFlowCH(false), ControlMode(CondenserType::Invalid), CHWInletNodeNum(0), CHWOutletNodeNum(0), HWInletNodeNum(0), + HWOutletNodeNum(0), GLHEInletNodeNum(0), GLHEOutletNodeNum(0), NumOfComp(0), CHWMassFlowRate(0.0), HWMassFlowRate(0.0), + GLHEMassFlowRate(0.0), CHWMassFlowRateMax(0.0), HWMassFlowRateMax(0.0), GLHEMassFlowRateMax(0.0), WrapperCoolingLoad(0.0), + WrapperHeatingLoad(0.0), AncillaryPower(0.0), CoolSetPointErrDone(false), HeatSetPointErrDone(false), CoolSetPointSetToLoop(false), + HeatSetPointSetToLoop(false), ChillerHeaterNums(0), CWPlantLoc{}, HWPlantLoc{}, GLHEPlantLoc{}, CHWMassFlowIndex(0), HWMassFlowIndex(0), + GLHEMassFlowIndex(0), SizingFactor(1.0), CHWVolFlowRate(0.0), HWVolFlowRate(0.0), GLHEVolFlowRate(0.0), MyWrapperFlag(true), + MyWrapperEnvrnFlag(true), SimulClgDominant(false), SimulHtgDominant(false), setupOutputVarsFlag(true), mySizesReported(false) { } @@ -479,6 +478,10 @@ struct PlantCentralGSHPData : BaseGlobalStruct EPVector Wrapper; EPVector ChillerHeater; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/PlantChillers.cc b/src/EnergyPlus/PlantChillers.cc index b5ebfc224c5..f1c8aa0e008 100644 --- a/src/EnergyPlus/PlantChillers.cc +++ b/src/EnergyPlus/PlantChillers.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -169,6 +169,7 @@ namespace PlantChillers { // required by the Electric Chiller model. static constexpr std::string_view RoutineName("GetElectricChillerInput: "); // include trailing blank space + static constexpr std::string_view routineName = "GetElectricChillerInput"; int NumAlphas; // Number of elements in the alpha array int NumNums; // Number of elements in the numeric array @@ -204,6 +205,9 @@ namespace PlantChillers { state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + Util::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), state.dataIPShortCut->cCurrentModuleObject, ErrorsFound); // ErrorsFound will be set to True if problem was found, left untouched otherwise @@ -513,22 +517,10 @@ namespace PlantChillers { thisChiller.HeatRecCapacityFraction = 1.0; } - if (NumAlphas > 10) { - if (!state.dataIPShortCut->lAlphaFieldBlanks(11)) { - thisChiller.HeatRecInletLimitSchedNum = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(11)); - if (thisChiller.HeatRecInletLimitSchedNum == 0) { - ShowSevereError( - state, - format("{}{}=\"{}\"", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError( - state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(11), state.dataIPShortCut->cAlphaArgs(11))); - ErrorsFound = true; - } - } else { - thisChiller.HeatRecInletLimitSchedNum = 0; - } - } else { - thisChiller.HeatRecInletLimitSchedNum = 0; + if (NumAlphas <= 10 || state.dataIPShortCut->lAlphaFieldBlanks(11)) { + } else if ((thisChiller.heatRecInletLimitSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(11))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(11), state.dataIPShortCut->cAlphaArgs(11)); + ErrorsFound = true; } if (NumAlphas > 11) { @@ -592,18 +584,15 @@ namespace PlantChillers { } } - if (!state.dataIPShortCut->lAlphaFieldBlanks(10)) { - thisChiller.BasinHeaterSchedulePtr = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(10)); - if (thisChiller.BasinHeaterSchedulePtr == 0) { - ShowWarningError( - state, - format("{}, \"{}\" {} \"{}\" was not found. Basin heater operation will not be modeled and the simulation continues", - state.dataIPShortCut->cCurrentModuleObject, - thisChiller.Name, - state.dataIPShortCut->cAlphaFieldNames(10), - state.dataIPShortCut->cAlphaArgs(10))); - } + if (state.dataIPShortCut->lAlphaFieldBlanks(10)) { + } else if ((thisChiller.basinHeaterSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(10))) == nullptr) { + ShowWarningItemNotFound(state, + eoh, + state.dataIPShortCut->cAlphaFieldNames(10), + state.dataIPShortCut->cAlphaArgs(10), + "Basin heater operation will not be modeled and the simulation continues"); } + if (NumAlphas > 12) { thisChiller.EndUseSubcategory = state.dataIPShortCut->cAlphaArgs(13); } else { @@ -873,11 +862,7 @@ namespace PlantChillers { if (this->MyEnvrnFlag && state.dataGlobal->BeginEnvrnFlag && (state.dataPlnt->PlantFirstSizesOkayToFinalize)) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); this->EvapMassFlowRateMax = rho * this->EvapVolFlowRate; PlantUtilities::InitComponentNodes(state, 0.0, this->EvapMassFlowRateMax, this->EvapInletNodeNum, this->EvapOutletNodeNum); @@ -887,11 +872,7 @@ namespace PlantChillers { state.dataLoopNodes->Node(this->CondInletNodeNum).Temp = this->TempDesCondIn; // old behavior, still want? - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); this->CondMassFlowRateMax = rho * this->CondVolFlowRate; @@ -914,11 +895,7 @@ namespace PlantChillers { } if (this->HeatRecActive) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); this->DesignHeatRecMassFlowRate = rho * this->DesignHeatRecVolFlowRate; PlantUtilities::InitComponentNodes( @@ -1048,16 +1025,8 @@ namespace PlantChillers { Real64 tmpNomCap = this->NomCap; if (PltSizNum > 0) { if (state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getSpecificHeat(state, Constant::CWInitConvTemp, RoutineName); tmpNomCap = Cp * rho * state.dataSize->PlantSizData(PltSizNum).DeltaT * state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate * this->SizFac; } else { @@ -1170,16 +1139,8 @@ namespace PlantChillers { Real64 tmpCondVolFlowRate = this->CondVolFlowRate; if (PltSizCondNum > 0 && PltSizNum > 0) { if (state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow && tmpNomCap > 0.0) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - this->TempDesCondIn, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - this->TempDesCondIn, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getDensity(state, this->TempDesCondIn, RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getSpecificHeat(state, this->TempDesCondIn, RoutineName); tmpCondVolFlowRate = tmpNomCap * (1.0 + 1.0 / this->COP) / (state.dataSize->PlantSizData(PltSizCondNum).DeltaT * Cp * rho); } else { if (this->CondVolFlowRateWasAutoSized) tmpCondVolFlowRate = 0.0; @@ -1454,7 +1415,7 @@ namespace PlantChillers { if (this->CondenserType == DataPlant::CondenserType::EvapCooled) { CalcBasinHeaterPower( - state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); + state, this->BasinHeaterPowerFTempDiff, this->basinHeaterSched, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); } this->PrintMessage = false; return; @@ -1468,7 +1429,13 @@ namespace PlantChillers { PlantUtilities::SetComponentFlowRate(state, this->CondMassFlowRate, this->CondInletNodeNum, this->CondOutletNodeNum, this->CDPlantLoc); PlantUtilities::PullCompInterconnectTrigger( state, this->CWPlantLoc, this->CondMassFlowIndex, this->CDPlantLoc, DataPlant::CriteriaType::MassFlowRate, this->CondMassFlowRate); - if (this->CondMassFlowRate < DataBranchAirLoopPlant::MassFlowTolerance) return; + if (this->CondMassFlowRate < DataBranchAirLoopPlant::MassFlowTolerance) { + MyLoad = 0.0; + this->EvapMassFlowRate = 0.0; + PlantUtilities::SetComponentFlowRate( + state, this->EvapMassFlowRate, this->EvapInletNodeNum, this->EvapOutletNodeNum, this->CWPlantLoc); + return; + } } // LOAD LOCAL VARIABLES FROM DATA STRUCTURE (for code readability) @@ -1596,11 +1563,8 @@ namespace PlantChillers { } this->partLoadRatio = OperPartLoadRat; - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp, RoutineName); // If FlowLock is True, the new resolved mdot is used to update Power, QEvap, Qcond, and // condenser side outlet temperature. @@ -1707,7 +1671,7 @@ namespace PlantChillers { MyLoad = 0.0; if (this->CondenserType == DataPlant::CondenserType::EvapCooled) { CalcBasinHeaterPower( - state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); + state, this->BasinHeaterPowerFTempDiff, this->basinHeaterSched, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); } this->PrintMessage = false; return; @@ -1831,7 +1795,7 @@ namespace PlantChillers { } if (this->QEvaporator == 0.0 && this->CondenserType == DataPlant::CondenserType::EvapCooled) { CalcBasinHeaterPower( - state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); + state, this->BasinHeaterPowerFTempDiff, this->basinHeaterSched, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); } } // This is the end of the FlowLock Block @@ -1843,11 +1807,7 @@ namespace PlantChillers { if (this->CondMassFlowRate > DataBranchAirLoopPlant::MassFlowTolerance) { // If Heat Recovery specified for this vapor compression chiller, then Qcondenser will be adjusted by this subroutine if (this->HeatRecActive) this->calcHeatRecovery(state, this->QCondenser, this->CondMassFlowRate, condInletTemp, this->QHeatRecovered); - Real64 CpCond = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - condInletTemp, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpCond = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getSpecificHeat(state, condInletTemp, RoutineName); this->CondOutletTemp = this->QCondenser / this->CondMassFlowRate / CpCond + condInletTemp; } else { ShowSevereError(state, format("CalcElectricChillerModel: Condenser flow = 0, for ElectricChiller={}", this->Name)); @@ -1934,19 +1894,11 @@ namespace PlantChillers { this->HeatRecInletTemp = state.dataLoopNodes->Node(this->HeatRecInletNodeNum).Temp; Real64 HeatRecMassFlowRate = state.dataLoopNodes->Node(this->HeatRecInletNodeNum).MassFlowRate; - Real64 CpHeatRec = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidName, - this->HeatRecInletTemp, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpHeatRec = state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).glycol->getSpecificHeat(state, this->HeatRecInletTemp, RoutineName); Real64 CpCond; if (this->CondenserType == DataPlant::CondenserType::WaterCooled) { - CpCond = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - condInletTemp, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + CpCond = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getSpecificHeat(state, condInletTemp, RoutineName); } else { CpCond = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(this->CondInletNodeNum).HumRat); } @@ -1981,8 +1933,8 @@ namespace PlantChillers { QHeatRec = min(QHeatRec, this->HeatRecMaxCapacityLimit); } // check if limit on inlet is present and exceeded. - if (this->HeatRecInletLimitSchedNum > 0) { - Real64 HeatRecHighInletLimit = ScheduleManager::GetCurrentScheduleValue(state, this->HeatRecInletLimitSchedNum); + if (this->heatRecInletLimitSched != nullptr) { + Real64 HeatRecHighInletLimit = this->heatRecInletLimitSched->getCurrentVal(); if (this->HeatRecInletTemp > HeatRecHighInletLimit) { // shut down heat recovery QHeatRec = 0.0; } @@ -2231,6 +2183,7 @@ namespace PlantChillers { // Locals // PARAMETERS static constexpr std::string_view RoutineName("GetEngineDrivenChillerInput: "); // include trailing blank space + static constexpr std::string_view routineName = "GetEngineDrivenChillerInput"; int NumAlphas; // Number of elements in the alpha array int NumNums; // Number of elements in the numeric array @@ -2265,6 +2218,9 @@ namespace PlantChillers { state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + Util::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), state.dataIPShortCut->cCurrentModuleObject, ErrorsFound); // ErrorsFound will be set to True if problem was found, left untouched otherwise @@ -2657,16 +2613,13 @@ namespace PlantChillers { } } - if (!state.dataIPShortCut->lAlphaFieldBlanks(16)) { - thisChiller.BasinHeaterSchedulePtr = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(16)); - if (thisChiller.BasinHeaterSchedulePtr == 0) { - ShowWarningError(state, - format("{}, \"{}\" TRIM(state.dataIPShortCut->cAlphaFieldNames(16)) \"{}\" was not found. Basin heater " - "operation will not be modeled and the simulation continues", - state.dataIPShortCut->cCurrentModuleObject, - thisChiller.Name, - state.dataIPShortCut->cAlphaArgs(16))); - } + if (state.dataIPShortCut->lAlphaFieldBlanks(16)) { + } else if ((thisChiller.basinHeaterSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(16))) == nullptr) { + ShowWarningItemNotFound(state, + eoh, + state.dataIPShortCut->cAlphaFieldNames(16), + state.dataIPShortCut->cAlphaArgs(16), + "Basin heater operation will not be modeled and the simulation continues"); } if (NumNums > 30) { @@ -2965,11 +2918,7 @@ namespace PlantChillers { // Initialize critical Demand Side Variables if (this->MyEnvrnFlag && state.dataGlobal->BeginEnvrnFlag && (state.dataPlnt->PlantFirstSizesOkayToFinalize)) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); this->EvapMassFlowRateMax = rho * this->EvapVolFlowRate; PlantUtilities::InitComponentNodes(state, 0.0, this->EvapMassFlowRateMax, this->EvapInletNodeNum, this->EvapOutletNodeNum); @@ -2980,11 +2929,7 @@ namespace PlantChillers { state.dataLoopNodes->Node(this->CondInletNodeNum).Temp = this->TempDesCondIn; - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); this->CondMassFlowRateMax = rho * this->CondVolFlowRate; @@ -3006,11 +2951,7 @@ namespace PlantChillers { } if (this->HeatRecActive) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); this->DesignHeatRecMassFlowRate = rho * this->DesignHeatRecVolFlowRate; PlantUtilities::InitComponentNodes( @@ -3099,16 +3040,8 @@ namespace PlantChillers { if (PltSizNum > 0) { if (state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getSpecificHeat(state, Constant::CWInitConvTemp, RoutineName); tmpNomCap = Cp * rho * state.dataSize->PlantSizData(PltSizNum).DeltaT * state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate * this->SizFac; } else { @@ -3220,17 +3153,9 @@ namespace PlantChillers { if (PltSizCondNum > 0 && PltSizNum > 0) { if (state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow && tmpNomCap > 0.0) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - this->TempDesCondIn, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); - - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - this->TempDesCondIn, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getDensity(state, this->TempDesCondIn, RoutineName); + + Real64 Cp = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getSpecificHeat(state, this->TempDesCondIn, RoutineName); tmpCondVolFlowRate = tmpNomCap * (1.0 + 1.0 / this->COP) / (state.dataSize->PlantSizData(PltSizCondNum).DeltaT * Cp * rho); } else { if (this->CondVolFlowRateWasAutoSized) tmpCondVolFlowRate = 0.0; @@ -3498,7 +3423,7 @@ namespace PlantChillers { // calculate end time of current time step Real64 CurrentEndTime = state.dataGlobal->CurrentTime + state.dataHVACGlobal->SysTimeElapsed; - // Print warning messages only when valid and only for the first ocurrance. Let summary provide statistics. + // Print warning messages only when valid and only for the first occurrence. Let summary provide statistics. // Wait for next time step to print warnings. If simulation iterates, print out // the warning for the last iteration only. Must wait for next time step to accomplish this. // If a warning occurs and the simulation down shifts, the warning is not valid. @@ -3544,7 +3469,7 @@ namespace PlantChillers { if (this->CondenserType == DataPlant::CondenserType::EvapCooled) { CalcBasinHeaterPower( - state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); + state, this->BasinHeaterPowerFTempDiff, this->basinHeaterSched, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); } this->PrintMessage = false; return; @@ -3593,7 +3518,13 @@ namespace PlantChillers { PlantUtilities::SetComponentFlowRate(state, this->CondMassFlowRate, this->CondInletNodeNum, this->CondOutletNodeNum, this->CDPlantLoc); PlantUtilities::PullCompInterconnectTrigger( state, this->CWPlantLoc, this->CondMassFlowIndex, this->CDPlantLoc, DataPlant::CriteriaType::MassFlowRate, this->CondMassFlowRate); - if (this->CondMassFlowRate < DataBranchAirLoopPlant::MassFlowTolerance) return; + if (this->CondMassFlowRate < DataBranchAirLoopPlant::MassFlowTolerance) { + MyLoad = 0.0; + this->EvapMassFlowRate = 0.0; + PlantUtilities::SetComponentFlowRate( + state, this->EvapMassFlowRate, this->EvapInletNodeNum, this->EvapOutletNodeNum, this->CWPlantLoc); + return; + } } // LOAD LOCAL VARIABLES FROM DATA STRUCTURE (for code readability) @@ -3660,11 +3591,8 @@ namespace PlantChillers { OperPartLoadRat = 0.0; } - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp, RoutineName); // If FlowLock is True, the new resolved mdot is used to update Power, QEvap, Qcond, and // condenser side outlet temperature. @@ -3679,7 +3607,7 @@ namespace PlantChillers { } this->Power = FracFullLoadPower * FullLoadPowerRat * AvailChillerCap / COPLocal * FRAC; - // Either set the flow to the Constant value or caluclate the flow for the variable volume + // Either set the flow to the Constant value or calculate the flow for the variable volume if ((this->FlowMode == DataPlant::FlowMode::Constant) || (this->FlowMode == DataPlant::FlowMode::NotModulated)) { // Start by assuming max (design) flow this->EvapMassFlowRate = this->EvapMassFlowRateMax; @@ -3763,7 +3691,7 @@ namespace PlantChillers { MyLoad = 0.0; if (this->CondenserType == DataPlant::CondenserType::EvapCooled) { CalcBasinHeaterPower( - state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); + state, this->BasinHeaterPowerFTempDiff, this->basinHeaterSched, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); } this->PrintMessage = false; return; @@ -3889,7 +3817,7 @@ namespace PlantChillers { } if (this->QEvaporator == 0.0 && this->CondenserType == DataPlant::CondenserType::EvapCooled) { CalcBasinHeaterPower( - state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); + state, this->BasinHeaterPowerFTempDiff, this->basinHeaterSched, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); } } // This is the end of the FlowLock Block @@ -3901,11 +3829,7 @@ namespace PlantChillers { if (this->CondenserType == DataPlant::CondenserType::WaterCooled) { if (this->CondMassFlowRate > DataBranchAirLoopPlant::MassFlowTolerance) { - Real64 CpCond = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - this->CondInletTemp, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpCond = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getSpecificHeat(state, this->CondInletTemp, RoutineName); this->CondOutletTemp = this->QCondenser / this->CondMassFlowRate / CpCond + this->CondInletTemp; } else { ShowSevereError(state, format("CalcEngineDrivenChillerModel: Condenser flow = 0, for EngineDrivenChiller={}", this->Name)); @@ -4056,11 +3980,7 @@ namespace PlantChillers { this->HeatRecMdotActual = state.dataLoopNodes->Node(this->HeatRecInletNodeNum).MassFlowRate; this->HeatRecInletTemp = state.dataLoopNodes->Node(this->HeatRecInletNodeNum).Temp; - Real64 cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidName, - this->HeatRecInletTemp, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 cp = state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).glycol->getSpecificHeat(state, this->HeatRecInletTemp, RoutineName); // Don't divide by zero - Note This also results in no heat recovery when // design Mdot for Heat Recovery - Specified on Chiller Input - is zero @@ -4289,6 +4209,7 @@ namespace PlantChillers { // EnergyPlus input processor static constexpr std::string_view RoutineName("GetGTChillerInput: "); // include trailing blank space + static constexpr std::string_view routineName = "GetGTChillerInput"; int NumAlphas; // Number of elements in the alpha array int NumNums; // Number of elements in the numeric array @@ -4322,6 +4243,9 @@ namespace PlantChillers { state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + Util::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), state.dataIPShortCut->cCurrentModuleObject, ErrorsFound); // ErrorsFound will be set to True if problem was found, left untouched otherwise @@ -4678,16 +4602,13 @@ namespace PlantChillers { } } - if (!state.dataIPShortCut->lAlphaFieldBlanks(11)) { - thisChiller.BasinHeaterSchedulePtr = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(11)); - if (thisChiller.BasinHeaterSchedulePtr == 0) { - ShowWarningError(state, - format("{}, \"{}\" TRIM(state.dataIPShortCut->cAlphaFieldNames(11)) \"{}\" was not found. Basin heater " - "operation will not be modeled and the simulation continues", - state.dataIPShortCut->cCurrentModuleObject, - thisChiller.Name, - state.dataIPShortCut->cAlphaArgs(11))); - } + if (state.dataIPShortCut->lAlphaFieldBlanks(11)) { + } else if ((thisChiller.basinHeaterSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(11))) == nullptr) { + ShowWarningItemNotFound(state, + eoh, + state.dataIPShortCut->cAlphaFieldNames(11), + state.dataIPShortCut->cAlphaArgs(11), + "Basin heater operation will not be modeled and the simulation continues"); } if (NumNums > 49) { @@ -4950,11 +4871,7 @@ namespace PlantChillers { if (this->MyEnvrnFlag && state.dataGlobal->BeginEnvrnFlag && (state.dataPlnt->PlantFirstSizesOkayToFinalize)) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); this->EvapMassFlowRateMax = rho * this->EvapVolFlowRate; PlantUtilities::InitComponentNodes(state, 0.0, this->EvapMassFlowRateMax, this->EvapInletNodeNum, this->EvapOutletNodeNum); @@ -4964,11 +4881,7 @@ namespace PlantChillers { state.dataLoopNodes->Node(this->CondInletNodeNum).Temp = this->TempDesCondIn; - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); this->CondMassFlowRateMax = rho * this->CondVolFlowRate; @@ -4990,11 +4903,7 @@ namespace PlantChillers { } if (this->HeatRecActive) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); this->DesignHeatRecMassFlowRate = rho * this->DesignHeatRecVolFlowRate; PlantUtilities::InitComponentNodes( @@ -5083,16 +4992,8 @@ namespace PlantChillers { if (PltSizNum > 0) { if (state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getSpecificHeat(state, Constant::CWInitConvTemp, RoutineName); tmpNomCap = Cp * rho * state.dataSize->PlantSizData(PltSizNum).DeltaT * state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate * this->SizFac; } else { @@ -5208,16 +5109,8 @@ namespace PlantChillers { if (PltSizCondNum > 0 && PltSizNum > 0) { if (state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow && tmpNomCap > 0.0) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - this->TempDesCondIn, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - this->TempDesCondIn, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getDensity(state, this->TempDesCondIn, RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getSpecificHeat(state, this->TempDesCondIn, RoutineName); tmpCondVolFlowRate = tmpNomCap * (1.0 + 1.0 / this->COP) / (state.dataSize->PlantSizData(PltSizCondNum).DeltaT * Cp * rho); } else { if (this->CondVolFlowRateWasAutoSized) tmpCondVolFlowRate = 0.0; @@ -5555,7 +5448,7 @@ namespace PlantChillers { if (this->CondenserType == DataPlant::CondenserType::EvapCooled) { CalcBasinHeaterPower( - state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); + state, this->BasinHeaterPowerFTempDiff, this->basinHeaterSched, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); } this->PrintMessage = false; return; @@ -5605,7 +5498,13 @@ namespace PlantChillers { PlantUtilities::PullCompInterconnectTrigger( state, this->CWPlantLoc, this->CondMassFlowIndex, this->CDPlantLoc, DataPlant::CriteriaType::MassFlowRate, this->CondMassFlowRate); - if (this->CondMassFlowRate < DataBranchAirLoopPlant::MassFlowTolerance) return; + if (this->CondMassFlowRate < DataBranchAirLoopPlant::MassFlowTolerance) { + MyLoad = 0.0; + this->EvapMassFlowRate = 0.0; + PlantUtilities::SetComponentFlowRate( + state, this->EvapMassFlowRate, this->EvapInletNodeNum, this->EvapOutletNodeNum, this->CWPlantLoc); + return; + } } // LOAD LOCAL VARIABLES FROM DATA STRUCTURE (for code readability) @@ -5665,11 +5564,8 @@ namespace PlantChillers { OperPartLoadRat = 0.0; } - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp, RoutineName); // If FlowLock is True, the new resolved mdot is used to update Power, QEvap, Qcond, and // condenser side outlet temperature. if (state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).LoopSide(this->CWPlantLoc.loopSideNum).FlowLock == DataPlant::FlowLock::Unlocked) { @@ -5683,7 +5579,7 @@ namespace PlantChillers { } this->Power = FracFullLoadPower * FullLoadPowerRat * AvailChillerCap / COP * FRAC; - // Either set the flow to the Constant value or caluclate the flow for the variable volume + // Either set the flow to the Constant value or calculate the flow for the variable volume if ((this->FlowMode == DataPlant::FlowMode::Constant) || (this->FlowMode == DataPlant::FlowMode::NotModulated)) { // Start by assuming max (design) flow this->EvapMassFlowRate = this->EvapMassFlowRateMax; @@ -5760,7 +5656,7 @@ namespace PlantChillers { MyLoad = 0.0; if (this->CondenserType == DataPlant::CondenserType::EvapCooled) { CalcBasinHeaterPower( - state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); + state, this->BasinHeaterPowerFTempDiff, this->basinHeaterSched, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); } this->PrintMessage = false; return; @@ -5878,7 +5774,7 @@ namespace PlantChillers { } if (this->QEvaporator == 0.0 && this->CondenserType == DataPlant::CondenserType::EvapCooled) { CalcBasinHeaterPower( - state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); + state, this->BasinHeaterPowerFTempDiff, this->basinHeaterSched, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); } } // This is the end of the FlowLock Block @@ -5891,11 +5787,7 @@ namespace PlantChillers { if (this->CondenserType == DataPlant::CondenserType::WaterCooled) { if (this->CondMassFlowRate > DataBranchAirLoopPlant::MassFlowTolerance) { - Real64 CpCond = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - condInletTemp, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpCond = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getSpecificHeat(state, condInletTemp, RoutineName); this->CondOutletTemp = this->QCondenser / this->CondMassFlowRate / CpCond + condInletTemp; } else { ShowSevereError(state, format("CalcGasTurbineChillerModel: Condenser flow = 0, for GasTurbineChiller={}", this->Name)); @@ -5970,11 +5862,8 @@ namespace PlantChillers { // This mdot is input specified mdot "Desired Flowrate", already set at node in init routine heatRecMdot = state.dataLoopNodes->Node(this->HeatRecInletNodeNum).MassFlowRate; this->HeatRecInletTemp = state.dataLoopNodes->Node(this->HeatRecInletNodeNum).Temp; - Real64 HeatRecCp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidName, - this->HeatRecInletTemp, - state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).FluidIndex, - RoutineNameHeatRecovery); + Real64 HeatRecCp = state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum) + .glycol->getSpecificHeat(state, this->HeatRecInletTemp, RoutineNameHeatRecovery); // Don't divide by zero if ((heatRecMdot > 0.0) && (HeatRecCp > 0.0)) { @@ -6260,6 +6149,7 @@ namespace PlantChillers { // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetConstCOPChillerInput: "); // include trailing blank space + static constexpr std::string_view routineName = "GetConstCOPChillerInput"; // include trailing blank space // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumAlphas; // Number of elements in the alpha array @@ -6296,6 +6186,8 @@ namespace PlantChillers { state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; Util::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), state.dataIPShortCut->cCurrentModuleObject, ErrorsFound); // ErrorsFound will be set to True if problem was found, left untouched otherwise @@ -6539,16 +6431,13 @@ namespace PlantChillers { } } - if (!state.dataIPShortCut->lAlphaFieldBlanks(8)) { - thisChiller.BasinHeaterSchedulePtr = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(8)); - if (thisChiller.BasinHeaterSchedulePtr == 0) { - ShowWarningError(state, - format("{}, \"{}\" TRIM(state.dataIPShortCut->cAlphaFieldNames(8)) \"{}\" was not found. Basin heater operation " - "will not be modeled and the simulation continues", - state.dataIPShortCut->cCurrentModuleObject, - thisChiller.Name, - state.dataIPShortCut->cAlphaArgs(8))); - } + if (state.dataIPShortCut->lAlphaFieldBlanks(8)) { + } else if ((thisChiller.basinHeaterSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(8))) == nullptr) { + ShowWarningItemNotFound(state, + eoh, + state.dataIPShortCut->cAlphaFieldNames(8), + state.dataIPShortCut->cAlphaArgs(8), + "Basin heater operation will not be modeled and the simulation continues"); } if (!state.dataIPShortCut->lAlphaFieldBlanks(9)) { @@ -6749,11 +6638,7 @@ namespace PlantChillers { // Initialize critical Demand Side Variables at the beginning of each environment if (this->MyEnvrnFlag && state.dataGlobal->BeginEnvrnFlag && (state.dataPlnt->PlantFirstSizesOkayToFinalize)) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); this->EvapMassFlowRateMax = this->EvapVolFlowRate * rho; PlantUtilities::InitComponentNodes(state, 0.0, this->EvapMassFlowRateMax, this->EvapInletNodeNum, this->EvapOutletNodeNum); @@ -6762,11 +6647,7 @@ namespace PlantChillers { state.dataLoopNodes->Node(this->CondInletNodeNum).Temp = TempDesCondIn; - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); this->CondMassFlowRateMax = rho * this->CondVolFlowRate; @@ -6858,16 +6739,8 @@ namespace PlantChillers { if (PltSizNum > 0) { if (state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getSpecificHeat(state, Constant::CWInitConvTemp, RoutineName); tmpNomCap = Cp * rho * state.dataSize->PlantSizData(PltSizNum).DeltaT * state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate * this->SizFac; } else { @@ -6986,16 +6859,8 @@ namespace PlantChillers { if (this->CondenserType == DataPlant::CondenserType::WaterCooled) { if (PltSizCondNum > 0 && PltSizNum > 0) { if (state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow && tmpNomCap > 0.0) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - 29.44, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - 29.44, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getDensity(state, 29.44, RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getSpecificHeat(state, 29.44, RoutineName); tmpCondVolFlowRate = tmpNomCap * (1.0 + 1.0 / this->COP) / (state.dataSize->PlantSizData(PltSizCondNum).DeltaT * Cp * rho); } else { if (this->CondVolFlowRateWasAutoSized) tmpCondVolFlowRate = 0.0; @@ -7238,7 +7103,7 @@ namespace PlantChillers { if (this->CondenserType == DataPlant::CondenserType::EvapCooled) { CalcBasinHeaterPower( - state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); + state, this->BasinHeaterPowerFTempDiff, this->basinHeaterSched, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); } this->PrintMessage = false; return; @@ -7248,7 +7113,7 @@ namespace PlantChillers { // calculate end time of current time step Real64 const CurrentEndTime = state.dataGlobal->CurrentTime + state.dataHVACGlobal->SysTimeElapsed; - // Print warning messages only when valid and only for the first ocurrance. Let summary provide statistics. + // Print warning messages only when valid and only for the first occurrence. Let summary provide statistics. // Wait for next time step to print warnings. If simulation iterates, print out // the warning for the last iteration only. Must wait for next time step to accomplish this. // If a warning occurs and the simulation down shifts, the warning is not valid. @@ -7313,24 +7178,27 @@ namespace PlantChillers { PlantUtilities::PullCompInterconnectTrigger( state, this->CWPlantLoc, this->CondMassFlowIndex, this->CDPlantLoc, DataPlant::CriteriaType::MassFlowRate, this->CondMassFlowRate); - if (this->CondMassFlowRate < DataBranchAirLoopPlant::MassFlowTolerance) return; + if (this->CondMassFlowRate < DataBranchAirLoopPlant::MassFlowTolerance) { + MyLoad = 0.0; + this->EvapMassFlowRate = 0.0; + PlantUtilities::SetComponentFlowRate( + state, this->EvapMassFlowRate, this->EvapInletNodeNum, this->EvapOutletNodeNum, this->CWPlantLoc); + return; + } } // If FlowLock is True, the new resolved mdot is used to update Power, QEvap, Qcond, and // condenser side outlet temperature. // local for fluid specif heat, for evaporator - Real64 const Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp, - state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 const Cp = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp, RoutineName); if (state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).LoopSide(this->CWPlantLoc.loopSideNum).FlowLock == DataPlant::FlowLock::Unlocked) { this->PossibleSubcooling = false; this->QEvaporator = std::abs(MyLoad); - // Either set the flow to the Constant value or caluclate the flow for the variable volume + // Either set the flow to the Constant value or calculate the flow for the variable volume if ((this->FlowMode == DataPlant::FlowMode::Constant) || (this->FlowMode == DataPlant::FlowMode::NotModulated)) { // Start by assuming max (design) flow @@ -7413,13 +7281,13 @@ namespace PlantChillers { MyLoad = 0.0; if (this->CondenserType == DataPlant::CondenserType::EvapCooled) { CalcBasinHeaterPower( - state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); + state, this->BasinHeaterPowerFTempDiff, this->basinHeaterSched, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); } this->PrintMessage = false; return; } - // Recalculate the Delts Temp + // Recalculate the Delta Temp if (this->PossibleSubcooling) { this->QEvaporator = std::abs(MyLoad); EvapDeltaTemp = this->QEvaporator / this->EvapMassFlowRate / Cp; @@ -7501,7 +7369,7 @@ namespace PlantChillers { } if (this->QEvaporator == 0.0 && this->CondenserType == DataPlant::CondenserType::EvapCooled) { CalcBasinHeaterPower( - state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); + state, this->BasinHeaterPowerFTempDiff, this->basinHeaterSched, this->BasinHeaterSetPointTemp, this->BasinHeaterPower); } } // This is the end of the FlowLock Block @@ -7515,11 +7383,7 @@ namespace PlantChillers { if (this->CondenserType == DataPlant::CondenserType::WaterCooled) { // local for fluid specif heat, for condenser - Real64 const CpCond = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidName, - CondInletTemp, - state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 const CpCond = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getSpecificHeat(state, CondInletTemp, RoutineName); if (this->CondMassFlowRate > DataBranchAirLoopPlant::MassFlowTolerance) { this->CondOutletTemp = this->QCondenser / this->CondMassFlowRate / CpCond + CondInletTemp; } else { diff --git a/src/EnergyPlus/PlantChillers.hh b/src/EnergyPlus/PlantChillers.hh index a67380b0711..0b5a2a3a98f 100644 --- a/src/EnergyPlus/PlantChillers.hh +++ b/src/EnergyPlus/PlantChillers.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -77,39 +77,39 @@ namespace PlantChillers { Real64 OptPartLoadRat; // (GT BEST) optimal operating frac full load Real64 TempDesCondIn; // C - (GT ADJTC(1)The design secondary loop fluid // temperature at the chiller condenser side inlet - Real64 TempRiseCoef; // (GT ADJTC(2)) correction factor for off ChillDesign oper. - Real64 TempDesEvapOut; // C - (GT ADJTC(3)The design primary loop fluid - DataPlant::CondenserType CondenserType; // Type of Condenser - Air or Water Cooled - Real64 NomCap; // design nominal capacity of chiller - bool NomCapWasAutoSized; // true if NomCap was autosize on input - Real64 COP; // COP - DataPlant::FlowMode FlowMode; // one of 3 modes for component flow during operation - bool ModulatedFlowSetToLoop; // True if the setpoint is missing at the outlet node - bool ModulatedFlowErrDone; // true if setpoint warning issued - bool HRSPErrDone; // TRUE if set point warning issued for heat recovery loop - int EvapInletNodeNum; // Node number on the inlet side of the plant - int EvapOutletNodeNum; // Node number on the outlet side of the plant - int CondInletNodeNum; // Node number on the inlet side of the condenser - int CondOutletNodeNum; // Node number on the outlet side of the condenser - Real64 EvapVolFlowRate; // m**3/s - design nominal water volumetric flow rate through the evaporator - bool EvapVolFlowRateWasAutoSized; // true if autosized design evap flow rate on input - Real64 EvapMassFlowRateMax; // kg/s - design water mass flow rate through evaporator - Real64 CondVolFlowRate; // m**3/s - design nominal water volumetric flow rate through the condenser - bool CondVolFlowRateWasAutoSized; // true if previous was autosized - Real64 CondMassFlowRateMax; // kg/s - design water mass flow rate through condenser - PlantLocation CWPlantLoc; // chilled water plant loop component index - PlantLocation CDPlantLoc; // condenser water plant loop component index - Real64 SizFac; // sizing factor - Real64 BasinHeaterPowerFTempDiff; // Basin heater capacity per degree C below setpoint (W/C) - Real64 BasinHeaterSetPointTemp; // Setpoint temperature for basin heater operation (C) - int BasinHeaterSchedulePtr; // Pointer to basin heater schedule - int ErrCount1; // for recurring error messages - int ErrCount2; // for recurring error messages - std::string MsgBuffer1; // - buffer to print warning messages on following time step - std::string MsgBuffer2; // - buffer to print warning messages on following time step - Real64 MsgDataLast; // value of data when warning occurred (passed to Recurring Warn) - bool PrintMessage; // logical to determine if message is valid - int MsgErrorCount; // number of occurrences of warning + Real64 TempRiseCoef; // (GT ADJTC(2)) correction factor for off ChillDesign oper. + Real64 TempDesEvapOut; // C - (GT ADJTC(3)The design primary loop fluid + DataPlant::CondenserType CondenserType; // Type of Condenser - Air or Water Cooled + Real64 NomCap; // design nominal capacity of chiller + bool NomCapWasAutoSized; // true if NomCap was autosize on input + Real64 COP; // COP + DataPlant::FlowMode FlowMode; // one of 3 modes for component flow during operation + bool ModulatedFlowSetToLoop; // True if the setpoint is missing at the outlet node + bool ModulatedFlowErrDone; // true if setpoint warning issued + bool HRSPErrDone; // TRUE if set point warning issued for heat recovery loop + int EvapInletNodeNum; // Node number on the inlet side of the plant + int EvapOutletNodeNum; // Node number on the outlet side of the plant + int CondInletNodeNum; // Node number on the inlet side of the condenser + int CondOutletNodeNum; // Node number on the outlet side of the condenser + Real64 EvapVolFlowRate; // m**3/s - design nominal water volumetric flow rate through the evaporator + bool EvapVolFlowRateWasAutoSized; // true if autosized design evap flow rate on input + Real64 EvapMassFlowRateMax; // kg/s - design water mass flow rate through evaporator + Real64 CondVolFlowRate; // m**3/s - design nominal water volumetric flow rate through the condenser + bool CondVolFlowRateWasAutoSized; // true if previous was autosized + Real64 CondMassFlowRateMax; // kg/s - design water mass flow rate through condenser + PlantLocation CWPlantLoc; // chilled water plant loop component index + PlantLocation CDPlantLoc; // condenser water plant loop component index + Real64 SizFac; // sizing factor + Real64 BasinHeaterPowerFTempDiff; // Basin heater capacity per degree C below setpoint (W/C) + Real64 BasinHeaterSetPointTemp; // Setpoint temperature for basin heater operation (C) + Sched::Schedule *basinHeaterSched = nullptr; // basin heater schedule + int ErrCount1; // for recurring error messages + int ErrCount2; // for recurring error messages + std::string MsgBuffer1; // - buffer to print warning messages on following time step + std::string MsgBuffer2; // - buffer to print warning messages on following time step + Real64 MsgDataLast; // value of data when warning occurred (passed to Recurring Warn) + bool PrintMessage; // logical to determine if message is valid + int MsgErrorCount; // number of occurrences of warning bool CheckEquipName; bool PossibleSubcooling; // flag to indicate chiller is doing less cooling that requested int CondMassFlowIndex; @@ -151,8 +151,8 @@ namespace PlantChillers { EvapInletNodeNum(0), EvapOutletNodeNum(0), CondInletNodeNum(0), CondOutletNodeNum(0), EvapVolFlowRate(0.0), EvapVolFlowRateWasAutoSized(false), EvapMassFlowRateMax(0.0), CondVolFlowRate(0.0), CondVolFlowRateWasAutoSized(false), CondMassFlowRateMax(0.0), CWPlantLoc{}, CDPlantLoc{}, SizFac(0.0), BasinHeaterPowerFTempDiff(0.0), BasinHeaterSetPointTemp(0.0), - BasinHeaterSchedulePtr(0), ErrCount1(0), ErrCount2(0), MsgDataLast(0.0), PrintMessage(false), MsgErrorCount(0), CheckEquipName(true), - PossibleSubcooling(false), CondMassFlowIndex(0), FaultyChillerSWTFlag(false), FaultyChillerSWTIndex(0), FaultyChillerSWTOffset(0.0), + ErrCount1(0), ErrCount2(0), MsgDataLast(0.0), PrintMessage(false), MsgErrorCount(0), CheckEquipName(true), PossibleSubcooling(false), + CondMassFlowIndex(0), FaultyChillerSWTFlag(false), FaultyChillerSWTIndex(0), FaultyChillerSWTOffset(0.0), FaultyChillerFoulingFlag(false), FaultyChillerFoulingIndex(0), FaultyChillerFoulingFactor(1.0), MyFlag(true), MyEnvrnFlag(true), TimeStepSysLast(0.0), CurrentEndTimeLast(0.0), CondMassFlowRate(0.0), EvapMassFlowRate(0.0), CondOutletTemp(0.0), EvapOutletTemp(0.0), // C - evaporator outlet temperature, water side @@ -191,23 +191,23 @@ namespace PlantChillers { { // Members // temperature at the chiller evaporator side outlet - Array1D CapRatCoef; // (Electric RCAVC() ) coeff of cap ratio poly fit - Array1D PowerRatCoef; // (Electric ADJEC() ) coeff of power rat poly fit - Array1D FullLoadCoef; // (Electric RPWRC() ) coeff of full load poly. fit - Real64 TempLowLimitEvapOut; // C - low temperature shut off - Real64 DesignHeatRecVolFlowRate; // m3/s, Design Water mass flow rate through heat recovery loop - bool DesignHeatRecVolFlowRateWasAutoSized; // true if previous was input autosize. - Real64 DesignHeatRecMassFlowRate; // kg/s, Design Water mass flow rate through heat recovery loop - bool HeatRecActive; // True entered Heat Rec Vol Flow Rate >0 - int HeatRecInletNodeNum; // Node number on the heat recovery inlet side of the condenser - int HeatRecOutletNodeNum; // Node number on the heat recovery outlet side of the condenser - Real64 HeatRecCapacityFraction; // user input for heat recovery capacity fraction [] - Real64 HeatRecMaxCapacityLimit; // Capacity limit for Heat recovery, one time calc [W] - int HeatRecSetPointNodeNum; // index for system node with the heat recover leaving setpoint - int HeatRecInletLimitSchedNum; // index for schedule for the inlet high limit for heat recovery operation - PlantLocation HRPlantLoc; // heat recovery water plant loop component index - std::string EndUseSubcategory; // identifier use for the end use subcategory - Real64 CondOutletHumRat; // kg/kg - condenser outlet humditiy ratio, air side + Array1D CapRatCoef; // (Electric RCAVC() ) coeff of cap ratio poly fit + Array1D PowerRatCoef; // (Electric ADJEC() ) coeff of power rat poly fit + Array1D FullLoadCoef; // (Electric RPWRC() ) coeff of full load poly. fit + Real64 TempLowLimitEvapOut; // C - low temperature shut off + Real64 DesignHeatRecVolFlowRate; // m3/s, Design Water mass flow rate through heat recovery loop + bool DesignHeatRecVolFlowRateWasAutoSized; // true if previous was input autosize. + Real64 DesignHeatRecMassFlowRate; // kg/s, Design Water mass flow rate through heat recovery loop + bool HeatRecActive; // True entered Heat Rec Vol Flow Rate >0 + int HeatRecInletNodeNum; // Node number on the heat recovery inlet side of the condenser + int HeatRecOutletNodeNum; // Node number on the heat recovery outlet side of the condenser + Real64 HeatRecCapacityFraction; // user input for heat recovery capacity fraction [] + Real64 HeatRecMaxCapacityLimit; // Capacity limit for Heat recovery, one time calc [W] + int HeatRecSetPointNodeNum; // index for system node with the heat recover leaving setpoint + Sched::Schedule *heatRecInletLimitSched = nullptr; // schedule for the inlet high limit for heat recovery operation + PlantLocation HRPlantLoc; // heat recovery water plant loop component index + std::string EndUseSubcategory; // identifier use for the end use subcategory + Real64 CondOutletHumRat; // kg/kg - condenser outlet humidity ratio, air side Real64 ActualCOP; Real64 QHeatRecovery; Real64 EnergyHeatRecovery; @@ -226,9 +226,9 @@ namespace PlantChillers { ElectricChillerSpecs() : CapRatCoef(3, 0.0), PowerRatCoef(3, 0.0), FullLoadCoef(3, 0.0), TempLowLimitEvapOut(0.0), DesignHeatRecVolFlowRate(0.0), DesignHeatRecVolFlowRateWasAutoSized(false), DesignHeatRecMassFlowRate(0.0), HeatRecActive(false), HeatRecInletNodeNum(0), - HeatRecOutletNodeNum(0), HeatRecCapacityFraction(0.0), HeatRecMaxCapacityLimit(0.0), HeatRecSetPointNodeNum(0), - HeatRecInletLimitSchedNum(0), HRPlantLoc{}, CondOutletHumRat(0.0), ActualCOP(0.0), QHeatRecovery(0.0), EnergyHeatRecovery(0.0), - HeatRecInletTemp(0.0), HeatRecMdot(0.0), ChillerCondAvgTemp(0.0) + HeatRecOutletNodeNum(0), HeatRecCapacityFraction(0.0), HeatRecMaxCapacityLimit(0.0), HeatRecSetPointNodeNum(0), HRPlantLoc{}, + CondOutletHumRat(0.0), ActualCOP(0.0), QHeatRecovery(0.0), EnergyHeatRecovery(0.0), HeatRecInletTemp(0.0), HeatRecMdot(0.0), + ChillerCondAvgTemp(0.0) { } @@ -521,6 +521,10 @@ struct PlantChillersData : BaseGlobalStruct EPVector GTChiller; EPVector ConstCOPChiller; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/PlantComponent.hh b/src/EnergyPlus/PlantComponent.hh index 976a92a4c53..2588825878b 100644 --- a/src/EnergyPlus/PlantComponent.hh +++ b/src/EnergyPlus/PlantComponent.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -90,6 +90,11 @@ public: { } + virtual Real64 getDynamicMaxCapacity([[maybe_unused]] EnergyPlusData &state) + { + return 0.0; + } + virtual void getCurrentPower([[maybe_unused]] EnergyPlusData &state, [[maybe_unused]] Real64 &power) { } diff --git a/src/EnergyPlus/PlantComponentTemperatureSources.cc b/src/EnergyPlus/PlantComponentTemperatureSources.cc index 03089902c9f..31fa87992fd 100644 --- a/src/EnergyPlus/PlantComponentTemperatureSources.cc +++ b/src/EnergyPlus/PlantComponentTemperatureSources.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -132,11 +132,7 @@ namespace PlantComponentTemperatureSources { // Initialize critical Demand Side Variables at the beginning of each environment if (this->MyEnvironFlag && state.dataGlobal->BeginEnvrnFlag && (state.dataPlnt->PlantFirstSizesOkayToFinalize)) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); this->MassFlowRateMax = this->DesVolFlowRate * rho; PlantUtilities::InitComponentNodes(state, 0.0, this->MassFlowRateMax, this->InletNodeNum, this->OutletNodeNum); @@ -150,15 +146,11 @@ namespace PlantComponentTemperatureSources { // OK, so we can set up the inlet and boundary temperatures now this->InletTemp = state.dataLoopNodes->Node(this->InletNodeNum).Temp; if (this->tempSpecType == TempSpecType::Schedule) { - this->BoundaryTemp = ScheduleManager::GetCurrentScheduleValue(state, this->TempSpecScheduleNum); + this->BoundaryTemp = this->tempSpecSched->getCurrentVal(); } // Calculate specific heat - Real64 cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->BoundaryTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, this->BoundaryTemp, RoutineName); // Calculate deltaT Real64 delta_temp = this->BoundaryTemp - this->InletTemp; @@ -364,11 +356,7 @@ namespace PlantComponentTemperatureSources { if (this->MassFlowRate > 0.0) { this->OutletTemp = this->BoundaryTemp; - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->BoundaryTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, this->BoundaryTemp, RoutineName); this->HeatRate = this->MassFlowRate * Cp * (this->OutletTemp - this->InletTemp); this->HeatEnergy = this->HeatRate * state.dataHVACGlobal->TimeStepSysSec; } else { @@ -455,6 +443,8 @@ namespace PlantComponentTemperatureSources { // N2 , \field Boundary Temperature // A5 ; \field Source Temperature Schedule Name + static constexpr std::string_view routineName = "GetWaterSourceInput"; + // LOCAL VARIABLES: int NumAlphas; // Number of elements in the alpha array int NumNums; // Number of elements in the numeric array @@ -489,6 +479,9 @@ namespace PlantComponentTemperatureSources { state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + Util::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); state.dataPlantCompTempSrc->WaterSource(SourceNum).Name = state.dataIPShortCut->cAlphaArgs(1); @@ -530,15 +523,9 @@ namespace PlantComponentTemperatureSources { state.dataPlantCompTempSrc->WaterSource(SourceNum).BoundaryTemp = state.dataIPShortCut->rNumericArgs(2); } else if (state.dataIPShortCut->cAlphaArgs(4) == "SCHEDULED") { state.dataPlantCompTempSrc->WaterSource(SourceNum).tempSpecType = TempSpecType::Schedule; - state.dataPlantCompTempSrc->WaterSource(SourceNum).TempSpecScheduleName = state.dataIPShortCut->cAlphaArgs(5); - state.dataPlantCompTempSrc->WaterSource(SourceNum).TempSpecScheduleNum = - ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(5)); - if (state.dataPlantCompTempSrc->WaterSource(SourceNum).TempSpecScheduleNum == 0) { - ShowSevereError(state, format("Input error for {}={}", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, - format("Invalid schedule name in field {}={}", - state.dataIPShortCut->cAlphaFieldNames(5), - state.dataIPShortCut->cAlphaArgs(5))); + if ((state.dataPlantCompTempSrc->WaterSource(SourceNum).tempSpecSched = + Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(5))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5)); ErrorsFound = true; } } else { diff --git a/src/EnergyPlus/PlantComponentTemperatureSources.hh b/src/EnergyPlus/PlantComponentTemperatureSources.hh index 86ffcc20826..bb4aced0b64 100644 --- a/src/EnergyPlus/PlantComponentTemperatureSources.hh +++ b/src/EnergyPlus/PlantComponentTemperatureSources.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -88,8 +88,7 @@ namespace PlantComponentTemperatureSources { Real64 EMSOverrideValueMassFlowRateMax; // value to use if EMS is overriding max mass flow Real64 MassFlowRate; TempSpecType tempSpecType; // temperature specification type - std::string TempSpecScheduleName; - int TempSpecScheduleNum; + Sched::Schedule *tempSpecSched = nullptr; Real64 BoundaryTemp; Real64 OutletTemp; // may be different if the flow is off Real64 InletTemp; @@ -106,8 +105,8 @@ namespace PlantComponentTemperatureSources { WaterSourceSpecs() : InletNodeNum(0), OutletNodeNum(0), DesVolFlowRate(0.0), DesVolFlowRateWasAutoSized(false), MassFlowRateMax(0.0), EMSOverrideOnMassFlowRateMax(false), EMSOverrideValueMassFlowRateMax(0.0), MassFlowRate(0.0), tempSpecType(TempSpecType::Invalid), - TempSpecScheduleNum(0), BoundaryTemp(0.0), OutletTemp(0.0), InletTemp(0.0), HeatRate(0.0), HeatEnergy(0.0), plantLoc{}, SizFac(0.0), - CheckEquipName(true), MyFlag(true), MyEnvironFlag(true), IsThisSized(false) + BoundaryTemp(0.0), OutletTemp(0.0), InletTemp(0.0), HeatRate(0.0), HeatEnergy(0.0), plantLoc{}, SizFac(0.0), CheckEquipName(true), + MyFlag(true), MyEnvironFlag(true), IsThisSized(false) { } @@ -153,6 +152,10 @@ struct PlantCompTempSrcData : BaseGlobalStruct bool getWaterSourceInput = true; EPVector WaterSource; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/PlantCondLoopOperation.cc b/src/EnergyPlus/PlantCondLoopOperation.cc index 9e5efcff68e..2a16a3ad2fd 100644 --- a/src/EnergyPlus/PlantCondLoopOperation.cc +++ b/src/EnergyPlus/PlantCondLoopOperation.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -102,12 +102,11 @@ namespace EnergyPlus::PlantCondLoopOperation { // Using/Aliasing using namespace DataPlant; -using FluidProperties::GetSpecificHeatGlycol; using HVAC::SmallLoad; void ManagePlantLoadDistribution(EnergyPlusData &state, PlantLocation const &plantLoc, // PlantLoop data structure Location struct - Real64 &LoopDemand, + Real64 const LoopDemand, Real64 &RemLoopDemand, bool const FirstHVACIteration, bool &LoopShutDownFlag, // EMS flag to tell loop solver to shut down pumps @@ -334,11 +333,9 @@ void GetPlantOperationInput(EnergyPlusData &state, bool &GetInputOK) // PlantEquipmentOperationSchemes // CondenserEquipmentOperationSchemes - // Using/Aliasing - using ScheduleManager::GetScheduleIndex; - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetPlantOperationInput: "); // include trailing blank space + static constexpr std::string_view routineName = "GetPlantOperationInput"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int LoopNum; // Loop counter (Plant or Cond) @@ -403,6 +400,9 @@ void GetPlantOperationInput(EnergyPlusData &state, bool &GetInputOK) state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + state.dataPlnt->PlantLoop(LoopNum).NumOpSchemes = (NumAlphas - 1) / 3; if (state.dataPlnt->PlantLoop(LoopNum).NumOpSchemes > 0) { state.dataPlnt->PlantLoop(LoopNum).OpScheme.clear(); @@ -455,17 +455,11 @@ void GetPlantOperationInput(EnergyPlusData &state, bool &GetInputOK) } state.dataPlnt->PlantLoop(LoopNum).OpScheme(Num).Name = state.dataIPShortCut->cAlphaArgs(Num * 3); - state.dataPlnt->PlantLoop(LoopNum).OpScheme(Num).Sched = state.dataIPShortCut->cAlphaArgs(Num * 3 + 1); - state.dataPlnt->PlantLoop(LoopNum).OpScheme(Num).SchedPtr = - GetScheduleIndex(state, state.dataPlnt->PlantLoop(LoopNum).OpScheme(Num).Sched); - if (state.dataPlnt->PlantLoop(LoopNum).OpScheme(Num).SchedPtr == 0) { - ShowSevereError(state, - format("{}Invalid {} = \"{}\", entered in {}= \"{}\".", - RoutineName, - state.dataIPShortCut->cAlphaFieldNames(Num * 3 + 1), - state.dataIPShortCut->cAlphaArgs(Num * 3 + 1), - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1))); + + if ((state.dataPlnt->PlantLoop(LoopNum).OpScheme(Num).sched = + Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(Num * 3 + 1))) == nullptr) { + ShowSevereItemNotFound( + state, eoh, state.dataIPShortCut->cAlphaFieldNames(Num * 3 + 1), state.dataIPShortCut->cAlphaArgs(Num * 3 + 1)); ErrorsFound = true; } } @@ -1361,12 +1355,13 @@ void FindCompSPInput(EnergyPlusData &state, // PlantEquipmentOperation:ComponentSetPoint // PlantEquipmentOperation:ThermalEnergyStorage + static constexpr std::string_view routineName = "FindCompSPInput"; + // Using/Aliasing using namespace DataLoopNode; using NodeInputManager::GetOnlySingleNode; using namespace DataSizing; using EMSManager::CheckIfNodeSetPointManagedByEMS; - using ScheduleManager::GetScheduleIndex; using SetPointManager::SetUpNewScheduledTESSetPtMgr; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: @@ -1395,6 +1390,7 @@ void FindCompSPInput(EnergyPlusData &state, for (int Num = 1; Num <= NumSchemes; ++Num) { state.dataInputProcessing->inputProcessor->getObjectItem( state, CurrentModuleObject, Num, state.dataIPShortCut->cAlphaArgs, NumAlphas, state.dataIPShortCut->rNumericArgs, NumNums, IOStat); + if (Util::SameString(state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).Name, state.dataIPShortCut->cAlphaArgs(1))) break; if (Num == NumSchemes) { ShowSevereError(state, @@ -1412,29 +1408,23 @@ void FindCompSPInput(EnergyPlusData &state, state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).NumEquipLists = 1; state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList.allocate(1); state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).EquipList(1).NumComps = (NumAlphas - 1) / 5; - int ChargeSchedPtr; - int OnPeakSchedPtr; + + Sched::Schedule *chargeSched = nullptr; + Sched::Schedule *onPeakSched = nullptr; + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; if (CurrentModuleObject == "PlantEquipmentOperation:ThermalEnergyStorage") { // Read all of the additional parameters for ice storage control scheme and error check various parameters - std::string OnPeakSchedName = state.dataIPShortCut->cAlphaArgs(2); - OnPeakSchedPtr = GetScheduleIndex(state, OnPeakSchedName); - if (OnPeakSchedPtr == 0) { - ShowSevereError(state, - format("Could not find On Peak Schedule {} in {}{}\".", - OnPeakSchedName, - CurrentModuleObject, - state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).Name)); + onPeakSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(2)); + if (onPeakSched == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2)); ErrorsFound = true; } - std::string ChargeSchedName = state.dataIPShortCut->cAlphaArgs(3); - ChargeSchedPtr = GetScheduleIndex(state, ChargeSchedName); - if (ChargeSchedPtr == 0) { - ShowSevereError(state, - format("Could not find Charging Availability Schedule {} in {}{}\".", - ChargeSchedName, - CurrentModuleObject, - state.dataPlnt->PlantLoop(LoopNum).OpScheme(SchemeNum).Name)); + + chargeSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(3)); + if (chargeSched == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3)); ErrorsFound = true; } NonChargCHWTemp = state.dataIPShortCut->rNumericArgs(1); @@ -1568,8 +1558,8 @@ void FindCompSPInput(EnergyPlusData &state, // detailed input that is necessary to get thermal energy storage to work from the simpler input. SetUpNewScheduledTESSetPtMgr( state, - OnPeakSchedPtr, - ChargeSchedPtr, + onPeakSched, + chargeSched, NonChargCHWTemp, OffPeakCHWTemp, CompOpType, @@ -2527,8 +2517,6 @@ void InitLoadDistribution(EnergyPlusData &state, bool const FirstHVACIteration) // Using/Aliasing using EMSManager::ManageEMS; - using ScheduleManager::GetCurrentScheduleValue; - using ScheduleManager::GetScheduleIndex; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: DataPlant::LoopSideLocation LoopSidePtr; @@ -2831,7 +2819,7 @@ void InitLoadDistribution(EnergyPlusData &state, bool const FirstHVACIteration) continue; } - if (GetCurrentScheduleValue(state, this_op_scheme.SchedPtr) > 0.0) { + if (this_op_scheme.sched->getCurrentVal() > 0.0) { this_op_scheme.Available = true; for (int ListNum = 1, ListNum_end = this_op_scheme.NumEquipLists; ListNum <= ListNum_end; ++ListNum) { auto &this_equip_list = this_op_scheme.EquipList(ListNum); @@ -3482,11 +3470,7 @@ void AdjustChangeInLoadByHowServed(EnergyPlusData &state, CurMassFlowRate = state.dataLoopNodes->Node(this_component.NodeNumIn).MassFlowRate; ToutLowLimit = this_component.MinOutletTemp; Tinlet = state.dataLoopNodes->Node(this_component.NodeNumIn).Temp; - CurSpecHeat = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(plantLoc.loopNum).FluidName, - Tinlet, - state.dataPlnt->PlantLoop(plantLoc.loopNum).FluidIndex, - RoutineName); + CurSpecHeat = state.dataPlnt->PlantLoop(plantLoc.loopNum).glycol->getSpecificHeat(state, Tinlet, RoutineName); QdotTmp = CurMassFlowRate * CurSpecHeat * (Tinlet - ToutLowLimit); // !- Don't correct if Q is zero, as this could indicate a component which this hasn't been implemented or not yet turned on @@ -3570,11 +3554,7 @@ void AdjustChangeInLoadByHowServed(EnergyPlusData &state, CurMassFlowRate = state.dataLoopNodes->Node(this_component.NodeNumIn).MassFlowRate; ToutLowLimit = this_component.MinOutletTemp; Tinlet = state.dataLoopNodes->Node(this_component.NodeNumIn).Temp; - CurSpecHeat = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(plantLoc.loopNum).FluidName, - Tinlet, - state.dataPlnt->PlantLoop(plantLoc.loopNum).FluidIndex, - RoutineName); + CurSpecHeat = state.dataPlnt->PlantLoop(plantLoc.loopNum).glycol->getSpecificHeat(state, Tinlet, RoutineName); QdotTmp = CurMassFlowRate * CurSpecHeat * (Tinlet - ToutLowLimit); // !- Don't correct if Q is zero, as this could indicate a component which this hasn't been implemented or not yet turned @@ -3591,11 +3571,7 @@ void AdjustChangeInLoadByHowServed(EnergyPlusData &state, CurMassFlowRate = state.dataLoopNodes->Node(this_component.NodeNumIn).MassFlowRate; ToutHiLimit = this_component.MaxOutletTemp; Tinlet = state.dataLoopNodes->Node(this_component.NodeNumIn).Temp; - CurSpecHeat = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(plantLoc.loopNum).FluidName, - Tinlet, - state.dataPlnt->PlantLoop(plantLoc.loopNum).FluidIndex, - RoutineName); + CurSpecHeat = state.dataPlnt->PlantLoop(plantLoc.loopNum).glycol->getSpecificHeat(state, Tinlet, RoutineName); QdotTmp = CurMassFlowRate * CurSpecHeat * (ToutHiLimit - Tinlet); if (CurMassFlowRate > 0.0) { @@ -3631,7 +3607,6 @@ void FindCompSPLoad(EnergyPlusData &state, // Using/Aliasing using DataLoopNode::SensedNodeFlagValue; - using FluidProperties::GetDensityGlycol; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: @@ -3673,19 +3648,17 @@ void FindCompSPLoad(EnergyPlusData &state, // load local variables from the data structures CompMinLoad = this_component.MinLoad; - CompMaxLoad = this_component.MaxLoad; + CompMaxLoad = this_component.getDynamicMaxCapacity(state); CompOptLoad = this_component.OptLoad; DemandNode = state.dataPlnt->PlantLoop(plantLoc.loopNum).OpScheme(OpSchemePtr).EquipList(ListPtr).Comp(CompPtr).DemandNodeNum; SetPtNode = state.dataPlnt->PlantLoop(plantLoc.loopNum).OpScheme(OpSchemePtr).EquipList(ListPtr).Comp(CompPtr).SetPointNodeNum; TempIn = state.dataLoopNodes->Node(DemandNode).Temp; - rho = GetDensityGlycol( - state, state.dataPlnt->PlantLoop(plantLoc.loopNum).FluidName, TempIn, state.dataPlnt->PlantLoop(plantLoc.loopNum).FluidIndex, RoutineName); + rho = state.dataPlnt->PlantLoop(plantLoc.loopNum).glycol->getDensity(state, TempIn, RoutineName); DemandMdot = state.dataPlnt->PlantLoop(plantLoc.loopNum).OpScheme(OpSchemePtr).EquipList(ListPtr).Comp(CompPtr).SetPointFlowRate * rho; // DemandMDot is a constant design flow rate, next based on actual current flow rate for accurate current demand? ActualMdot = state.dataLoopNodes->Node(DemandNode).MassFlowRate; - CurSpecHeat = GetSpecificHeatGlycol( - state, state.dataPlnt->PlantLoop(plantLoc.loopNum).FluidName, TempIn, state.dataPlnt->PlantLoop(plantLoc.loopNum).FluidIndex, RoutineName); + CurSpecHeat = state.dataPlnt->PlantLoop(plantLoc.loopNum).glycol->getSpecificHeat(state, TempIn, RoutineName); if ((ActualMdot > 0.0) && (ActualMdot != DemandMdot)) { DemandMdot = ActualMdot; } @@ -4260,7 +4233,7 @@ void ActivateEMSControls(EnergyPlusData &state, PlantLocation const &plantLoc, b CurMassFlowRate = state.dataLoopNodes->Node(this_comp.NodeNumIn).MassFlowRate; ToutLowLimit = this_comp.MinOutletTemp; Tinlet = state.dataLoopNodes->Node(this_comp.NodeNumIn).Temp; - CurSpecHeat = GetSpecificHeatGlycol(state, this_loop.FluidName, Tinlet, this_loop.FluidIndex, RoutineName); + CurSpecHeat = this_loop.glycol->getSpecificHeat(state, Tinlet, RoutineName); QTemporary = CurMassFlowRate * CurSpecHeat * (Tinlet - ToutLowLimit); //- Don't correct if Q is zero, as this could indicate a component which this hasn't been implemented diff --git a/src/EnergyPlus/PlantCondLoopOperation.hh b/src/EnergyPlus/PlantCondLoopOperation.hh index 6061012b1b8..791a13168d1 100644 --- a/src/EnergyPlus/PlantCondLoopOperation.hh +++ b/src/EnergyPlus/PlantCondLoopOperation.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -59,7 +59,7 @@ namespace PlantCondLoopOperation { void ManagePlantLoadDistribution(EnergyPlusData &state, PlantLocation const &plantLoc, // PlantLoop data structure Location struct - Real64 &LoopDemand, + Real64 const LoopDemand, Real64 &RemLoopDemand, bool const FirstHVACIteration, bool &LoopShutDownFlag, // EMS flag to tell loop solver to shut down pumps @@ -185,6 +185,10 @@ struct PlantCondLoopOperationData : BaseGlobalStruct bool LoadSupervisoryChillerHeaterOpScheme = true; Array1D ChillerHeaterSupervisoryOperationSchemes; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/PlantHeatExchangerFluidToFluid.cc b/src/EnergyPlus/PlantHeatExchangerFluidToFluid.cc index 31d1dbb94b8..91159a24cdd 100644 --- a/src/EnergyPlus/PlantHeatExchangerFluidToFluid.cc +++ b/src/EnergyPlus/PlantHeatExchangerFluidToFluid.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -175,6 +175,7 @@ void GetFluidHeatExchangerInput(EnergyPlusData &state) // get input for heat exchanger model static constexpr std::string_view RoutineName("GetFluidHeatExchangerInput: "); + static constexpr std::string_view routineName = "GetFluidHeatExchangerInput"; bool ErrorsFound(false); int NumAlphas; // Number of elements in the alpha array @@ -222,20 +223,18 @@ void GetFluidHeatExchangerInput(EnergyPlusData &state) lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, cAlphaArgs(1)}; + Util::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); state.dataPlantHXFluidToFluid->FluidHX(CompLoop).Name = cAlphaArgs(1); if (lAlphaFieldBlanks(2)) { - state.dataPlantHXFluidToFluid->FluidHX(CompLoop).AvailSchedNum = ScheduleManager::ScheduleAlwaysOn; - } else { - state.dataPlantHXFluidToFluid->FluidHX(CompLoop).AvailSchedNum = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(2)); - if (state.dataPlantHXFluidToFluid->FluidHX(CompLoop).AvailSchedNum <= 0) { - ShowSevereError(state, format("{}{}=\"{}\", invalid entry.", RoutineName, cCurrentModuleObject, cAlphaArgs(1))); - ShowContinueError(state, format("Invalid {} = {}", cAlphaFieldNames(2), cAlphaArgs(2))); - ShowContinueError(state, "Schedule was not found "); - ErrorsFound = true; - } + state.dataPlantHXFluidToFluid->FluidHX(CompLoop).availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((state.dataPlantHXFluidToFluid->FluidHX(CompLoop).availSched = Sched::GetSchedule(state, cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2)); + ErrorsFound = true; } state.dataPlantHXFluidToFluid->FluidHX(CompLoop).DemandSideLoop.inletNodeNum = @@ -648,11 +647,7 @@ void HeatExchangerStruct::initialize(EnergyPlusData &state) if (state.dataGlobal->BeginEnvrnFlag && this->MyEnvrnFlag && (state.dataPlnt->PlantFirstSizesOkayToFinalize)) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->DemandSideLoop.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->DemandSideLoop.loopNum).FluidIndex, - RoutineNameNoColon); + Real64 rho = state.dataPlnt->PlantLoop(this->DemandSideLoop.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineNameNoColon); this->DemandSideLoop.MassFlowRateMax = rho * this->DemandSideLoop.DesignVolumeFlowRate; PlantUtilities::InitComponentNodes(state, this->DemandSideLoop.MassFlowRateMin, @@ -660,11 +655,7 @@ void HeatExchangerStruct::initialize(EnergyPlusData &state) this->DemandSideLoop.inletNodeNum, this->DemandSideLoop.outletNodeNum); - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->SupplySideLoop.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->SupplySideLoop.loopNum).FluidIndex, - RoutineNameNoColon); + rho = state.dataPlnt->PlantLoop(this->SupplySideLoop.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineNameNoColon); this->SupplySideLoop.MassFlowRateMax = rho * this->SupplySideLoop.DesignVolumeFlowRate; PlantUtilities::InitComponentNodes(state, this->SupplySideLoop.MassFlowRateMin, @@ -807,17 +798,10 @@ void HeatExchangerStruct::size(EnergyPlusData &state) Real64 tmpDeltaTSupLoop = state.dataSize->PlantSizData(PltSizNumSupSide).DeltaT; if (tmpSupSideDesignVolFlowRate >= HVAC::SmallWaterVolFlow) { - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->SupplySideLoop.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->SupplySideLoop.loopNum).FluidIndex, - RoutineName); + Real64 Cp = + state.dataPlnt->PlantLoop(this->SupplySideLoop.loopNum).glycol->getSpecificHeat(state, Constant::InitConvTemp, RoutineName); - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->SupplySideLoop.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->SupplySideLoop.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->SupplySideLoop.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); Real64 tmpDesCap = Cp * rho * tmpDeltaTSupLoop * tmpSupSideDesignVolFlowRate; if (state.dataPlnt->PlantFirstSizesOkayToFinalize) this->UA = tmpDesCap / tmpDeltaTloopToLoop; @@ -901,17 +885,9 @@ void HeatExchangerStruct::size(EnergyPlusData &state) } } - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->SupplySideLoop.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->SupplySideLoop.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->SupplySideLoop.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); Real64 SupSideMdot = this->SupplySideLoop.DesignVolumeFlowRate * rho; - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->DemandSideLoop.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->DemandSideLoop.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->DemandSideLoop.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); Real64 DmdSideMdot = this->DemandSideLoop.DesignVolumeFlowRate * rho; this->calculate(state, SupSideMdot, DmdSideMdot); @@ -946,7 +922,7 @@ void HeatExchangerStruct::control(EnergyPlusData &state, Real64 MyLoad, bool Fir // check if available by schedule bool ScheduledOff; - Real64 AvailSchedValue = ScheduleManager::GetCurrentScheduleValue(state, this->AvailSchedNum); + Real64 AvailSchedValue = this->availSched->getCurrentVal(); if (AvailSchedValue <= 0) { ScheduledOff = true; } else { @@ -996,11 +972,8 @@ void HeatExchangerStruct::control(EnergyPlusData &state, Real64 MyLoad, bool Fir state, mdotSupSide, this->SupplySideLoop.inletNodeNum, this->SupplySideLoop.outletNodeNum, this->SupplySideLoop); if (mdotSupSide > DataBranchAirLoopPlant::MassFlowTolerance) { // if supply side loop has massflow, request demand side flow - Real64 cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->SupplySideLoop.loopNum).FluidName, - this->SupplySideLoop.InletTemp, - state.dataPlnt->PlantLoop(this->SupplySideLoop.loopNum).FluidIndex, - RoutineName); + Real64 cp = state.dataPlnt->PlantLoop(this->SupplySideLoop.loopNum) + .glycol->getSpecificHeat(state, this->SupplySideLoop.InletTemp, RoutineName); Real64 TargetLeavingTemp = this->SupplySideLoop.InletTemp - std::abs(MyLoad) / (cp * mdotSupSide); this->findDemandSideLoopFlow(state, TargetLeavingTemp, HXAction::CoolingSupplySideLoop); @@ -1031,11 +1004,8 @@ void HeatExchangerStruct::control(EnergyPlusData &state, Real64 MyLoad, bool Fir PlantUtilities::SetComponentFlowRate( state, mdotSupSide, this->SupplySideLoop.inletNodeNum, this->SupplySideLoop.outletNodeNum, this->SupplySideLoop); if (mdotSupSide > DataBranchAirLoopPlant::MassFlowTolerance) { - Real64 cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->SupplySideLoop.loopNum).FluidName, - this->SupplySideLoop.InletTemp, - state.dataPlnt->PlantLoop(this->SupplySideLoop.loopNum).FluidIndex, - RoutineName); + Real64 cp = state.dataPlnt->PlantLoop(this->SupplySideLoop.loopNum) + .glycol->getSpecificHeat(state, this->SupplySideLoop.InletTemp, RoutineName); Real64 TargetLeavingTemp = this->SupplySideLoop.InletTemp + std::abs(MyLoad) / (cp * mdotSupSide); this->findDemandSideLoopFlow(state, TargetLeavingTemp, HXAction::HeatingSupplySideLoop); @@ -1503,18 +1473,12 @@ void HeatExchangerStruct::calculate(EnergyPlusData &state, Real64 const SupSideM Real64 DmdSideLoopInletTemp = state.dataLoopNodes->Node(this->DemandSideLoop.inletNodeNum).Temp; // specific heat of fluid entering from supply side loop at inlet temp - Real64 SupSideLoopInletCp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->SupplySideLoop.loopNum).FluidName, - SupSideLoopInletTemp, - state.dataPlnt->PlantLoop(this->SupplySideLoop.loopNum).FluidIndex, - RoutineName); + Real64 SupSideLoopInletCp = + state.dataPlnt->PlantLoop(this->SupplySideLoop.loopNum).glycol->getSpecificHeat(state, SupSideLoopInletTemp, RoutineName); // specific heat of fluid entering from demand side loop at inlet temp - Real64 DmdSideLoopInletCp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->DemandSideLoop.loopNum).FluidName, - DmdSideLoopInletTemp, - state.dataPlnt->PlantLoop(this->DemandSideLoop.loopNum).FluidIndex, - RoutineName); + Real64 DmdSideLoopInletCp = + state.dataPlnt->PlantLoop(this->DemandSideLoop.loopNum).glycol->getSpecificHeat(state, DmdSideLoopInletTemp, RoutineName); Real64 SupSideCapRate = SupSideMdot * SupSideLoopInletCp; Real64 DmdSideCapRate = DmdSideMdot * DmdSideLoopInletCp; diff --git a/src/EnergyPlus/PlantHeatExchangerFluidToFluid.hh b/src/EnergyPlus/PlantHeatExchangerFluidToFluid.hh index bc9099c2b64..0aba6b8c2a2 100644 --- a/src/EnergyPlus/PlantHeatExchangerFluidToFluid.hh +++ b/src/EnergyPlus/PlantHeatExchangerFluidToFluid.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -154,7 +154,7 @@ namespace PlantHeatExchangerFluidToFluid { { // Members std::string Name; - int AvailSchedNum; + Sched::Schedule *availSched = nullptr; FluidHXType HeatExchangeModelType; Real64 UA; bool UAWasAutoSized; // true is UA was autosized on input @@ -186,12 +186,11 @@ namespace PlantHeatExchangerFluidToFluid { // Default Constructor HeatExchangerStruct() - : AvailSchedNum(0), HeatExchangeModelType(FluidHXType::Invalid), UA(0.0), UAWasAutoSized(false), controlMode(ControlType::Invalid), - SetPointNodeNum(0), TempControlTol(0.0), ControlSignalTemp(CtrlTempType::Invalid), MinOperationTemp(-99999.0), - MaxOperationTemp(99999.0), ComponentType(DataPlant::PlantEquipmentType::Invalid), SizingFactor(1.0), HeatTransferRate(0.0), - HeatTransferEnergy(0.0), Effectiveness(0.0), OperationStatus(0.0), DmdSideModulatSolvNoConvergeErrorCount(0), - DmdSideModulatSolvNoConvergeErrorIndex(0), DmdSideModulatSolvFailErrorCount(0), DmdSideModulatSolvFailErrorIndex(0), - MyOneTimeFlag(true), MyFlag(true), MyEnvrnFlag(true) + : HeatExchangeModelType(FluidHXType::Invalid), UA(0.0), UAWasAutoSized(false), controlMode(ControlType::Invalid), SetPointNodeNum(0), + TempControlTol(0.0), ControlSignalTemp(CtrlTempType::Invalid), MinOperationTemp(-99999.0), MaxOperationTemp(99999.0), + ComponentType(DataPlant::PlantEquipmentType::Invalid), SizingFactor(1.0), HeatTransferRate(0.0), HeatTransferEnergy(0.0), + Effectiveness(0.0), OperationStatus(0.0), DmdSideModulatSolvNoConvergeErrorCount(0), DmdSideModulatSolvNoConvergeErrorIndex(0), + DmdSideModulatSolvFailErrorCount(0), DmdSideModulatSolvFailErrorIndex(0), MyOneTimeFlag(true), MyFlag(true), MyEnvrnFlag(true) { } @@ -234,6 +233,10 @@ struct PlantHeatExchangerFluidToFluidData : BaseGlobalStruct bool GetInput = true; EPVector FluidHX; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/PlantLoadProfile.cc b/src/EnergyPlus/PlantLoadProfile.cc index fa976ca3efe..b342c47770e 100644 --- a/src/EnergyPlus/PlantLoadProfile.cc +++ b/src/EnergyPlus/PlantLoadProfile.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -96,11 +96,10 @@ PlantComponent *PlantProfileData::factory(EnergyPlusData &state, std::string con state.dataPlantLoadProfile->GetPlantLoadProfileInputFlag = false; } // Now look for this particular pipe in the list - for (auto &plp : state.dataPlantLoadProfile->PlantProfile) { - if (plp.Name == objectName) { - return &plp; - } - } + auto thisObj = std::find_if(state.dataPlantLoadProfile->PlantProfile.begin(), + state.dataPlantLoadProfile->PlantProfile.end(), + [&objectName](const PlantProfileData &plp) { return plp.Name == objectName; }); + if (thisObj != state.dataPlantLoadProfile->PlantProfile.end()) return thisObj; // If we didn't find it, fatal ShowFatalError(state, format("PlantLoadProfile::factory: Error getting inputs for pipe named: {}", objectName)); // Shut up the compiler @@ -142,11 +141,7 @@ void PlantProfileData::simulate(EnergyPlusData &state, if (this->FluidType == PlantLoopFluidType::Water) { if (this->MassFlowRate > 0.0) { - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->InletTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, this->InletTemp, RoutineName); DeltaTemp = this->Power / (this->MassFlowRate * Cp); } else { this->Power = 0.0; @@ -155,29 +150,13 @@ void PlantProfileData::simulate(EnergyPlusData &state, this->OutletTemp = this->InletTemp - DeltaTemp; } else if (this->FluidType == PlantLoopFluidType::Steam) { if (this->MassFlowRate > 0.0 && this->Power > 0.0) { - Real64 EnthSteamInDry = FluidProperties::GetSatEnthalpyRefrig(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->InletTemp, - 1.0, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); - Real64 EnthSteamOutWet = FluidProperties::GetSatEnthalpyRefrig(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->InletTemp, - 0.0, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 EnthSteamInDry = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).steam->getSatEnthalpy(state, this->InletTemp, 1.0, RoutineName); + Real64 EnthSteamOutWet = + state.dataPlnt->PlantLoop(this->plantLoc.loopNum).steam->getSatEnthalpy(state, this->InletTemp, 0.0, RoutineName); Real64 LatentHeatSteam = EnthSteamInDry - EnthSteamOutWet; - Real64 SatTemp = FluidProperties::GetSatTemperatureRefrig(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - DataEnvironment::StdPressureSeaLevel, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); - Real64 CpWater = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - SatTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 SatTemp = + state.dataPlnt->PlantLoop(this->plantLoc.loopNum).steam->getSatTemperature(state, DataEnvironment::StdPressureSeaLevel, RoutineName); + Real64 CpWater = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, SatTemp, RoutineName); // Steam Mass Flow Rate Required this->MassFlowRate = this->Power / (LatentHeatSteam + this->DegOfSubcooling * CpWater); @@ -232,26 +211,14 @@ void PlantProfileData::InitPlantProfile(EnergyPlusData &state) state.dataLoopNodes->Node(OutletNode).Temp = 0.0; if (this->FluidType == PlantLoopFluidType::Water) { - FluidDensityInit = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + FluidDensityInit = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); } else { //(this->FluidType == PlantLoopFluidType::Steam) - Real64 SatTempAtmPress = FluidProperties::GetSatTemperatureRefrig(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - DataEnvironment::StdPressureSeaLevel, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); - FluidDensityInit = FluidProperties::GetSatDensityRefrig(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - SatTempAtmPress, - 1.0, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 SatTempAtmPress = + state.dataPlnt->PlantLoop(this->plantLoc.loopNum).steam->getSatTemperature(state, DataEnvironment::StdPressureSeaLevel, RoutineName); + FluidDensityInit = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).steam->getSatDensity(state, SatTempAtmPress, 1.0, RoutineName); } - Real64 MaxFlowMultiplier = ScheduleManager::GetScheduleMaxValue(state, this->FlowRateFracSchedule); + Real64 MaxFlowMultiplier = this->flowRateFracSched->getMaxVal(state); PlantUtilities::InitComponentNodes( state, 0.0, this->PeakVolFlowRate * FluidDensityInit * MaxFlowMultiplier, this->InletNode, this->OutletNode); @@ -266,27 +233,18 @@ void PlantProfileData::InitPlantProfile(EnergyPlusData &state) if (!state.dataGlobal->BeginEnvrnFlag) this->Init = true; this->InletTemp = state.dataLoopNodes->Node(InletNode).Temp; - this->Power = ScheduleManager::GetCurrentScheduleValue(state, this->LoadSchedule); + this->Power = this->loadSched->getCurrentVal(); if (this->EMSOverridePower) this->Power = this->EMSPowerValue; if (this->FluidType == PlantLoopFluidType::Water) { - FluidDensityInit = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->InletTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + FluidDensityInit = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, this->InletTemp, RoutineName); } else { //(this->FluidType == PlantLoopFluidType::Steam) - FluidDensityInit = FluidProperties::GetSatDensityRefrig(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->InletTemp, - 1.0, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + FluidDensityInit = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).steam->getSatDensity(state, this->InletTemp, 1.0, RoutineName); } // Get the scheduled mass flow rate - this->VolFlowRate = this->PeakVolFlowRate * ScheduleManager::GetCurrentScheduleValue(state, this->FlowRateFracSchedule); + this->VolFlowRate = this->PeakVolFlowRate * this->flowRateFracSched->getCurrentVal(); this->MassFlowRate = this->VolFlowRate * FluidDensityInit; @@ -342,10 +300,8 @@ void PlantProfileData::ReportPlantProfile(EnergyPlusData &state) } void PlantProfileData::oneTimeInit_new(EnergyPlusData &state) { - bool errFlag; - if (allocated(state.dataPlnt->PlantLoop)) { - errFlag = false; + bool errFlag = false; PlantUtilities::ScanPlantLoopsForObject(state, this->Name, this->Type, this->plantLoc, errFlag, _, _, _, _, _); if (errFlag) { ShowFatalError(state, "InitPlantProfile: Program terminated for previous conditions."); @@ -375,15 +331,12 @@ void GetPlantProfileInput(EnergyPlusData &state) // PURPOSE OF THIS SUBROUTINE: // Gets the plant load profile input from the input file and sets up the objects. + static constexpr std::string_view routineName = "GetPlantProfileInput"; + // Using/Aliasing using namespace DataLoopNode; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine - int IOStatus; // Used in GetObjectItem - int NumAlphas; // Number of Alphas for each GetObjectItem call - int NumNumbers; // Number of Numbers for each GetObjectItem call - int ProfileNum; // PLANT LOAD PROFILE (PlantProfile) object number auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; cCurrentModuleObject = "LoadProfile:Plant"; @@ -391,8 +344,12 @@ void GetPlantProfileInput(EnergyPlusData &state) if (state.dataPlantLoadProfile->NumOfPlantProfile > 0) { state.dataPlantLoadProfile->PlantProfile.allocate(state.dataPlantLoadProfile->NumOfPlantProfile); + bool ErrorsFound = false; // Set to true if errors in input, fatal at end of routine + int IOStatus; // Used in GetObjectItem + int NumAlphas; // Number of Alphas for each GetObjectItem call + int NumNumbers; // Number of Numbers for each GetObjectItem call - for (ProfileNum = 1; ProfileNum <= state.dataPlantLoadProfile->NumOfPlantProfile; ++ProfileNum) { + for (int ProfileNum = 1; ProfileNum <= state.dataPlantLoadProfile->NumOfPlantProfile; ++ProfileNum) { state.dataInputProcessing->inputProcessor->getObjectItem(state, cCurrentModuleObject, ProfileNum, @@ -405,6 +362,9 @@ void GetPlantProfileInput(EnergyPlusData &state) _, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + Util::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); state.dataPlantLoadProfile->PlantProfile(ProfileNum).Name = state.dataIPShortCut->cAlphaArgs(1); @@ -461,32 +421,17 @@ void GetPlantProfileInput(EnergyPlusData &state) ObjectIsNotParent); } - state.dataPlantLoadProfile->PlantProfile(ProfileNum).LoadSchedule = - ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(4)); - - if (state.dataPlantLoadProfile->PlantProfile(ProfileNum).LoadSchedule == 0) { - ShowSevereError(state, - format("{}=\"{}\" The Schedule for {} called {} was not found.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4))); + if ((state.dataPlantLoadProfile->PlantProfile(ProfileNum).loadSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(4))) == + nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4)); ErrorsFound = true; } state.dataPlantLoadProfile->PlantProfile(ProfileNum).PeakVolFlowRate = state.dataIPShortCut->rNumericArgs(1); - state.dataPlantLoadProfile->PlantProfile(ProfileNum).FlowRateFracSchedule = - ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(5)); - - if (state.dataPlantLoadProfile->PlantProfile(ProfileNum).FlowRateFracSchedule == 0) { - ShowSevereError(state, - format("{}=\"{}\" The Schedule for {} called {} was not found.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(5), - state.dataIPShortCut->cAlphaArgs(5))); - + if ((state.dataPlantLoadProfile->PlantProfile(ProfileNum).flowRateFracSched = + Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(5))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5)); ErrorsFound = true; } diff --git a/src/EnergyPlus/PlantLoadProfile.hh b/src/EnergyPlus/PlantLoadProfile.hh index cf37e9d0064..6ca23c78134 100644 --- a/src/EnergyPlus/PlantLoadProfile.hh +++ b/src/EnergyPlus/PlantLoadProfile.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -87,16 +87,16 @@ namespace PlantLoadProfile { int InletNode; Real64 InletTemp; // Inlet temperature (C) int OutletNode; - Real64 OutletTemp; // Outlet temperature (C) - int LoadSchedule; // Pointer to schedule object - bool EMSOverridePower; // if true, then EMS is calling to override power level - Real64 EMSPowerValue; // value EMS is directing to use for power [W] - Real64 PeakVolFlowRate; // Peak volumetric flow rate, also water consumption rate (m3/s) - int FlowRateFracSchedule; // Pointer to schedule object - Real64 VolFlowRate; // Volumetric flow rate (m3/s) - Real64 MassFlowRate; // Mass flow rate (kg/s) - Real64 DegOfSubcooling = 0.0; // Degree of subcooling in steam outlet - Real64 LoopSubcoolReturn = 0.0; // Loop subcooling for steam return + Real64 OutletTemp; // Outlet temperature (C) + Sched::Schedule *loadSched = nullptr; // load schedule + bool EMSOverridePower; // if true, then EMS is calling to override power level + Real64 EMSPowerValue; // value EMS is directing to use for power [W] + Real64 PeakVolFlowRate; // Peak volumetric flow rate, also water consumption rate (m3/s) + Sched::Schedule *flowRateFracSched = nullptr; // flow rate fraction schedule + Real64 VolFlowRate; // Volumetric flow rate (m3/s) + Real64 MassFlowRate; // Mass flow rate (kg/s) + Real64 DegOfSubcooling = 0.0; // Degree of subcooling in steam outlet + Real64 LoopSubcoolReturn = 0.0; // Loop subcooling for steam return bool EMSOverrideMassFlow; Real64 EMSMassFlowValue; // Report variables @@ -108,9 +108,8 @@ namespace PlantLoadProfile { // Default Constructor PlantProfileData() : Type(DataPlant::PlantEquipmentType::Invalid), plantLoc{}, Init(true), InitSizing(true), InletNode(0), InletTemp(0.0), OutletNode(0), - OutletTemp(0.0), LoadSchedule(0), EMSOverridePower(false), EMSPowerValue(0.0), PeakVolFlowRate(0.0), FlowRateFracSchedule(0), - VolFlowRate(0.0), MassFlowRate(0.0), EMSOverrideMassFlow(false), EMSMassFlowValue(0.0), Power(0.0), Energy(0.0), HeatingEnergy(0.0), - CoolingEnergy(0.0) + OutletTemp(0.0), EMSOverridePower(false), EMSPowerValue(0.0), PeakVolFlowRate(0.0), VolFlowRate(0.0), MassFlowRate(0.0), + EMSOverrideMassFlow(false), EMSMassFlowValue(0.0), Power(0.0), Energy(0.0), HeatingEnergy(0.0), CoolingEnergy(0.0) { } @@ -150,6 +149,10 @@ struct PlantLoadProfileData : BaseGlobalStruct int NumOfPlantProfile = 0; Array1D PlantProfile; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/PlantLoopHeatPumpEIR.cc b/src/EnergyPlus/PlantLoopHeatPumpEIR.cc index 0c9cb47fff3..bf0a166d1e1 100644 --- a/src/EnergyPlus/PlantLoopHeatPumpEIR.cc +++ b/src/EnergyPlus/PlantLoopHeatPumpEIR.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -142,11 +142,8 @@ void EIRPlantLoopHeatPump::simulate( if (this->running) { if (this->sysControlType == ControlType::Setpoint) { Real64 leavingSetpoint = state.dataLoopNodes->Node(this->loadSideNodes.outlet).TempSetPoint; - Real64 CurSpecHeat = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->loadSidePlantLoc.loopNum).FluidName, - loadSideInletTemp, - state.dataPlnt->PlantLoop(this->loadSidePlantLoc.loopNum).FluidIndex, - "EIRPlantLoopHeatPump::simulate"); + Real64 CurSpecHeat = state.dataPlnt->PlantLoop(this->loadSidePlantLoc.loopNum) + .glycol->getSpecificHeat(state, loadSideInletTemp, "EIRPlantLoopHeatPump::simulate"); Real64 controlLoad = this->loadSideMassFlowRate * CurSpecHeat * (leavingSetpoint - loadSideInletTemp); this->doPhysics(state, controlLoad); @@ -492,11 +489,8 @@ void EIRPlantLoopHeatPump::calcAvailableCapacity(EnergyPlusData &state, Real64 c Real64 sourceSideHeatTransfer = this->calcQsource(availableCapacity * partLoadRatio, this->powerUsage); // check to see if souce side outlet temp exceeds limit and reduce PLR if necessary auto &thisSourcePlantLoop = state.dataPlnt->PlantLoop(this->sourceSidePlantLoc.loopNum); - Real64 const CpSrc = FluidProperties::GetSpecificHeatGlycol(state, - thisSourcePlantLoop.FluidName, - this->sourceSideInletTemp, - thisSourcePlantLoop.FluidIndex, - "EIRPlantLoopHeatPump::calcLoadSideHeatTransfer()"); + Real64 const CpSrc = + thisSourcePlantLoop.glycol->getSpecificHeat(state, this->sourceSideInletTemp, "EIRPlantLoopHeatPump::calcLoadSideHeatTransfer()"); Real64 const sourceMCp = this->sourceSideMassFlowRate * CpSrc; Real64 const tempSourceOutletTemp = this->calcSourceOutletTemp(this->sourceSideInletTemp, sourceSideHeatTransfer / sourceMCp); if (this->EIRHPType == DataPlant::PlantEquipmentType::HeatPumpEIRHeating && tempSourceOutletTemp < this->minSourceTempLimit) { @@ -541,7 +535,7 @@ Real64 EIRPlantLoopHeatPump::heatingCapacityModifierASHP(EnergyPlusData &state) } } -void EIRPlantLoopHeatPump::setPartLoadAndCyclingRatio(EnergyPlusData &state, Real64 &partLoadRatio) +void EIRPlantLoopHeatPump::setPartLoadAndCyclingRatio([[maybe_unused]] EnergyPlusData &state, Real64 &partLoadRatio) { // Initialize cycling ratio to 1.0 Real64 cyclingRatio = 1.0; @@ -562,11 +556,8 @@ void EIRPlantLoopHeatPump::calcLoadSideHeatTransfer(EnergyPlusData &state, Real6 { // evaluate the actual current operating load side heat transfer rate auto &thisLoadPlantLoop = state.dataPlnt->PlantLoop(this->loadSidePlantLoc.loopNum); - Real64 CpLoad = FluidProperties::GetSpecificHeatGlycol(state, - thisLoadPlantLoop.FluidName, - state.dataLoopNodes->Node(this->loadSideNodes.inlet).Temp, - thisLoadPlantLoop.FluidIndex, - "EIRPlantLoopHeatPump::calcLoadSideHeatTransfer()"); + Real64 CpLoad = thisLoadPlantLoop.glycol->getSpecificHeat( + state, state.dataLoopNodes->Node(this->loadSideNodes.inlet).Temp, "EIRPlantLoopHeatPump::calcLoadSideHeatTransfer()"); Real64 const operatingPLR = this->partLoadRatio * this->cyclingRatio; this->loadSideHeatTransfer = availableCapacity * operatingPLR; @@ -618,11 +609,8 @@ void EIRPlantLoopHeatPump::calcSourceSideHeatTransferWSHP(EnergyPlusData &state) // calculate source side outlet conditions auto &thisSourcePlantLoop = state.dataPlnt->PlantLoop(this->sourceSidePlantLoc.loopNum); - Real64 const CpSrc = FluidProperties::GetSpecificHeatGlycol(state, - thisSourcePlantLoop.FluidName, - this->sourceSideInletTemp, - thisSourcePlantLoop.FluidIndex, - "EIRPlantLoopHeatPump::calcSourceSideHeatTransferWSHP()"); + Real64 const CpSrc = + thisSourcePlantLoop.glycol->getSpecificHeat(state, this->sourceSideInletTemp, "EIRPlantLoopHeatPump::calcSourceSideHeatTransferWSHP()"); Real64 const sourceMCp = this->sourceSideMassFlowRate * CpSrc; this->sourceSideOutletTemp = this->calcSourceOutletTemp(this->sourceSideInletTemp, this->sourceSideHeatTransfer / sourceMCp); @@ -666,11 +654,8 @@ void EIRPlantLoopHeatPump::calcHeatRecoveryHeatTransferASHP(EnergyPlusData &stat // calculate heat recovery side outlet conditions auto &thisHeatRecoveryPlantLoop = state.dataPlnt->PlantLoop(this->heatRecoveryPlantLoc.loopNum); - Real64 const CpHR = FluidProperties::GetSpecificHeatGlycol(state, - thisHeatRecoveryPlantLoop.FluidName, - this->heatRecoveryInletTemp, - thisHeatRecoveryPlantLoop.FluidIndex, - "EIRPlantLoopHeatPump::calcHeatRecoveryHeatTransferASHP()"); + Real64 const CpHR = thisHeatRecoveryPlantLoop.glycol->getSpecificHeat( + state, this->heatRecoveryInletTemp, "EIRPlantLoopHeatPump::calcHeatRecoveryHeatTransferASHP()"); Real64 const hRecoveryMCp = this->heatRecoveryMassFlowRate * CpHR; if (this->heatRecoveryMassFlowRate > 0.0) { this->heatRecoveryOutletTemp = this->calcHROutletTemp(this->heatRecoveryInletTemp, this->heatRecoveryRate / hRecoveryMCp); @@ -713,7 +698,7 @@ void EIRPlantLoopHeatPump::calcHeatRecoveryHeatTransferASHP(EnergyPlusData &stat } } -void EIRPlantLoopHeatPump::setHeatRecoveryOperatingStatusASHP(EnergyPlusData &state, bool FirstHVACIteration) +void EIRPlantLoopHeatPump::setHeatRecoveryOperatingStatusASHP([[maybe_unused]] EnergyPlusData &state, [[maybe_unused]] bool FirstHVACIteration) { if (!this->running) { if (this->heatRecoveryAvailable) { @@ -966,20 +951,12 @@ void EIRPlantLoopHeatPump::onInitLoopEquip(EnergyPlusData &state, [[maybe_unused if (state.dataGlobal->BeginEnvrnFlag && this->envrnInit && state.dataPlnt->PlantFirstSizesOkayToFinalize) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->loadSidePlantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->loadSidePlantLoc.loopNum).FluidIndex, - routineName); + Real64 rho = state.dataPlnt->PlantLoop(this->loadSidePlantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, routineName); this->loadSideDesignMassFlowRate = rho * this->loadSideDesignVolFlowRate; PlantUtilities::InitComponentNodes(state, 0.0, this->loadSideDesignMassFlowRate, this->loadSideNodes.inlet, this->loadSideNodes.outlet); if (this->waterSource) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->sourceSidePlantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->sourceSidePlantLoc.loopNum).FluidIndex, - routineName); + rho = state.dataPlnt->PlantLoop(this->sourceSidePlantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, routineName); this->sourceSideDesignMassFlowRate = rho * this->sourceSideDesignVolFlowRate; PlantUtilities::InitComponentNodes( state, 0.0, this->sourceSideDesignMassFlowRate, this->sourceSideNodes.inlet, this->sourceSideNodes.outlet); @@ -988,11 +965,7 @@ void EIRPlantLoopHeatPump::onInitLoopEquip(EnergyPlusData &state, [[maybe_unused this->sourceSideDesignMassFlowRate = rho * this->sourceSideDesignVolFlowRate; // heat recovery if (this->heatRecoveryAvailable) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->heatRecoveryPlantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->heatRecoveryPlantLoc.loopNum).FluidIndex, - routineName); + rho = state.dataPlnt->PlantLoop(this->heatRecoveryPlantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, routineName); this->heatRecoveryDesignMassFlowRate = rho * this->heatRecoveryDesignVolFlowRate; PlantUtilities::InitComponentNodes( state, 0.0, this->heatRecoveryDesignMassFlowRate, this->heatRecoveryNodes.inlet, this->heatRecoveryNodes.outlet); @@ -1052,16 +1025,10 @@ void EIRPlantLoopHeatPump::sizeLoadSide(EnergyPlusData &state) (this->EIRHPType == DataPlant::PlantEquipmentType::HeatPumpEIRHeating) ? Constant::HWInitConvTemp : Constant::CWInitConvTemp; // I guess I can assume the plant fluids are the same for HW and CW. So only the sizing type is an issue on which to use. - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->loadSidePlantLoc.loopNum).FluidName, - loadSideInitTemp, - state.dataPlnt->PlantLoop(this->loadSidePlantLoc.loopNum).FluidIndex, - "EIRPlantLoopHeatPump::sizeLoadSide()"); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->loadSidePlantLoc.loopNum).FluidName, - loadSideInitTemp, - state.dataPlnt->PlantLoop(this->loadSidePlantLoc.loopNum).FluidIndex, - "EIRPlantLoopHeatPump::sizeLoadSide()"); + Real64 rho = + state.dataPlnt->PlantLoop(this->loadSidePlantLoc.loopNum).glycol->getDensity(state, loadSideInitTemp, "EIRPlantLoopHeatPump::sizeLoadSide()"); + Real64 Cp = state.dataPlnt->PlantLoop(this->loadSidePlantLoc.loopNum) + .glycol->getSpecificHeat(state, loadSideInitTemp, "EIRPlantLoopHeatPump::sizeLoadSide()"); int pltLoadSizNum = state.dataPlnt->PlantLoop(this->loadSidePlantLoc.loopNum).PlantSizNum; if (pltLoadSizNum > 0) { @@ -1084,18 +1051,17 @@ void EIRPlantLoopHeatPump::sizeLoadSide(EnergyPlusData &state) Real64 compCp = Cp; Real64 compDeltaT = deltaT; if (compLoopNum > 0) { - compRho = FluidProperties::GetDensityGlycol( - state, - state.dataPlnt->PlantLoop(compLoopNum).FluidName, - this->EIRHPType == DataPlant::PlantEquipmentType::HeatPumpEIRCooling ? Constant::HWInitConvTemp : Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(compLoopNum).FluidIndex, - "EIRPlantLoopHeatPump::sizeLoadSide()"); - compCp = FluidProperties::GetSpecificHeatGlycol( - state, - state.dataPlnt->PlantLoop(compLoopNum).FluidName, - this->EIRHPType == DataPlant::PlantEquipmentType::HeatPumpEIRCooling ? Constant::HWInitConvTemp : Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(compLoopNum).FluidIndex, - "EIRPlantLoopHeatPump::sizeLoadSide()"); + compRho = state.dataPlnt->PlantLoop(compLoopNum) + .glycol->getDensity(state, + this->EIRHPType == DataPlant::PlantEquipmentType::HeatPumpEIRCooling ? Constant::HWInitConvTemp + : Constant::CWInitConvTemp, + "EIRPlantLoopHeatPump::sizeLoadSide()"); + compCp = + state.dataPlnt->PlantLoop(compLoopNum) + .glycol->getSpecificHeat(state, + this->EIRHPType == DataPlant::PlantEquipmentType::HeatPumpEIRCooling ? Constant::HWInitConvTemp + : Constant::CWInitConvTemp, + "EIRPlantLoopHeatPump::sizeLoadSide()"); compDeltaT = state.dataSize->PlantSizData(compLoopNum).DeltaT; } if (this->EIRHPType == DataPlant::PlantEquipmentType::HeatPumpEIRCooling) { @@ -1140,16 +1106,10 @@ void EIRPlantLoopHeatPump::sizeLoadSide(EnergyPlusData &state) (this->EIRHPType == DataPlant::PlantEquipmentType::HeatPumpEIRCooling) ? Constant::HWInitConvTemp : Constant::CWInitConvTemp; int compLoopNum = this->companionHeatPumpCoil->loadSidePlantLoc.loopNum; if (compLoopNum > 0) { - Real64 const compRho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(compLoopNum).FluidName, - compLoadSideInitTemp, - state.dataPlnt->PlantLoop(compLoopNum).FluidIndex, - "EIRPlantLoopHeatPump::sizeLoadSide()"); - Real64 const compCp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(compLoopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(compLoopNum).FluidIndex, - "EIRPlantLoopHeatPump::sizeLoadSide()"); + Real64 const compRho = state.dataPlnt->PlantLoop(compLoopNum) + .glycol->getDensity(state, compLoadSideInitTemp, "EIRPlantLoopHeatPump::sizeLoadSide()"); + Real64 const compCp = state.dataPlnt->PlantLoop(compLoopNum) + .glycol->getSpecificHeat(state, Constant::CWInitConvTemp, "EIRPlantLoopHeatPump::sizeLoadSide()"); rho = compRho; Cp = compCp; } @@ -1319,16 +1279,10 @@ void EIRPlantLoopHeatPump::sizeSrcSideWSHP(EnergyPlusData &state) Real64 sourceSideInitTemp = (this->EIRHPType == DataPlant::PlantEquipmentType::HeatPumpEIRCooling) ? Constant::CWInitConvTemp : Constant::HWInitConvTemp; - Real64 const rhoSrc = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->loadSidePlantLoc.loopNum).FluidName, - sourceSideInitTemp, - state.dataPlnt->PlantLoop(this->loadSidePlantLoc.loopNum).FluidIndex, - "EIRPlantLoopHeatPump::sizeSrcSideWSHP()"); - Real64 const CpSrc = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->loadSidePlantLoc.loopNum).FluidName, - sourceSideInitTemp, - state.dataPlnt->PlantLoop(this->loadSidePlantLoc.loopNum).FluidIndex, - "EIRPlantLoopHeatPump::sizeSrcSideWSHP()"); + Real64 const rhoSrc = state.dataPlnt->PlantLoop(this->loadSidePlantLoc.loopNum) + .glycol->getDensity(state, sourceSideInitTemp, "EIRPlantLoopHeatPump::sizeSrcSideWSHP()"); + Real64 const CpSrc = state.dataPlnt->PlantLoop(this->loadSidePlantLoc.loopNum) + .glycol->getSpecificHeat(state, sourceSideInitTemp, "EIRPlantLoopHeatPump::sizeSrcSideWSHP()"); // To start we need to override the calculated load side flow // rate if it was actually hard-sized @@ -1544,16 +1498,10 @@ void EIRPlantLoopHeatPump::sizeHeatRecoveryASHP(EnergyPlusData &state) std::string_view const typeName = DataPlant::PlantEquipTypeNames[static_cast(this->EIRHPType)]; Real64 heatRecoveryInitTemp = (this->EIRHPType == DataPlant::PlantEquipmentType::HeatPumpEIRCooling) ? Constant::HWInitConvTemp : Constant::CWInitConvTemp; - Real64 const rhoHR = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->heatRecoveryPlantLoc.loopNum).FluidName, - heatRecoveryInitTemp, - state.dataPlnt->PlantLoop(this->heatRecoveryPlantLoc.loopNum).FluidIndex, - "EIRPlantLoopHeatPump::sizeHeatRecoveryASHP()"); - Real64 const CpHR = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->heatRecoveryPlantLoc.loopNum).FluidName, - heatRecoveryInitTemp, - state.dataPlnt->PlantLoop(this->heatRecoveryPlantLoc.loopNum).FluidIndex, - "EIRPlantLoopHeatPump::sizeHeatRecoveryASHP()"); + Real64 const rhoHR = state.dataPlnt->PlantLoop(this->heatRecoveryPlantLoc.loopNum) + .glycol->getDensity(state, heatRecoveryInitTemp, "EIRPlantLoopHeatPump::sizeHeatRecoveryASHP()"); + Real64 const CpHR = state.dataPlnt->PlantLoop(this->heatRecoveryPlantLoc.loopNum) + .glycol->getSpecificHeat(state, heatRecoveryInitTemp, "EIRPlantLoopHeatPump::sizeHeatRecoveryASHP()"); // calculate an auto-sized value for heat recovery design flow regardless of whether it was auto-sized or not int plantHRSizingIndex = state.dataPlnt->PlantLoop(this->heatRecoveryPlantLoc.loopNum).PlantSizNum; @@ -2496,6 +2444,15 @@ bool EIRPlantLoopHeatPump::thermosiphonDisabled(EnergyPlusData &state) } } +Real64 EIRPlantLoopHeatPump::getDynamicMaxCapacity(EnergyPlusData &state) +{ + Real64 sourceInletTemp = state.dataLoopNodes->Node(this->sourceSideNodes.inlet).Temp; + Real64 loadSideOutletSetpointTemp = this->getLoadSideOutletSetPointTemp(state); + // evaluate capacity modifier curve and determine load side heat transfer + Real64 capacityModifierFuncTemp = Curve::CurveValue(state, this->capFuncTempCurveIndex, loadSideOutletSetpointTemp, sourceInletTemp); + return this->referenceCapacity * capacityModifierFuncTemp * heatingCapacityModifierASHP(state); +} + void EIRPlantLoopHeatPump::report(EnergyPlusData &state) { @@ -2558,8 +2515,7 @@ void EIRFuelFiredHeatPump::doPhysics(EnergyPlusData &state, Real64 currentLoad) } DataPlant::PlantLoopData &thisLoadPlantLoop = state.dataPlnt->PlantLoop(this->loadSidePlantLoc.loopNum); - Real64 CpLoad = FluidProperties::GetSpecificHeatGlycol( - state, thisLoadPlantLoop.FluidName, thisInletNode.Temp, thisLoadPlantLoop.FluidIndex, "PLFFHPEIR::simulate()"); + Real64 CpLoad = thisLoadPlantLoop.glycol->getSpecificHeat(state, thisInletNode.Temp, "PLFFHPEIR::simulate()"); // Set the current load equal to the FFHP load Real64 FFHPloadSideLoad = currentLoad; // this->loadSidePlantLoad = MyLoad; @@ -2941,8 +2897,7 @@ void EIRFuelFiredHeatPump::doPhysics(EnergyPlusData &state, Real64 currentLoad) Real64 CpSrc = 0.0; if (this->waterSource) { auto &thisSourcePlantLoop = state.dataPlnt->PlantLoop(this->sourceSidePlantLoc.loopNum); - CpSrc = FluidProperties::GetSpecificHeatGlycol( - state, thisSourcePlantLoop.FluidName, this->sourceSideInletTemp, thisSourcePlantLoop.FluidIndex, "PLFFHPEIR::simulate()"); + CpSrc = thisSourcePlantLoop.glycol->getSpecificHeat(state, this->sourceSideInletTemp, "PLFFHPEIR::simulate()"); } else if (this->airSource) { CpSrc = Psychrometrics::PsyCpAirFnW(state.dataEnvrn->OutHumRat); } @@ -3751,4 +3706,40 @@ void EIRFuelFiredHeatPump::report(EnergyPlusData &state) state.dataLoopNodes->Node(this->sourceSideNodes.outlet).Temp = this->sourceSideOutletTemp; } +Real64 EIRFuelFiredHeatPump::getDynamicMaxCapacity(EnergyPlusData &state) +{ + // Source (air) side temperature variable + auto &thisSourceSideInletNode = state.dataLoopNodes->Node(this->sourceSideNodes.inlet); + Real64 oaTempforCurve = + (this->oaTempCurveInputVar == OATempCurveVar::WetBulb) + ? Psychrometrics::PsyTwbFnTdbWPb( + state, thisSourceSideInletNode.Temp, thisSourceSideInletNode.HumRat, thisSourceSideInletNode.Press, "PLFFHPEIR::doPhysics()") + : thisSourceSideInletNode.Temp; + + // Load (water) side temperature variable + Real64 waterTempforCurve = state.dataLoopNodes->Node(this->loadSideNodes.inlet).Temp; + if (this->waterTempCurveInputVar == WaterTempCurveVar::LeavingCondenser || this->waterTempCurveInputVar == WaterTempCurveVar::LeavingEvaporator) { + if (this->flowMode == DataPlant::FlowMode::LeavingSetpointModulated) { + DataPlant::PlantLoopData &thisLoadPlantLoop = state.dataPlnt->PlantLoop(this->loadSidePlantLoc.loopNum); + auto &thisLoadSideOutletNode = state.dataLoopNodes->Node(this->loadSideNodes.outlet); + if (thisLoadPlantLoop.LoopDemandCalcScheme == DataPlant::LoopDemandCalcScheme::SingleSetPoint) { + waterTempforCurve = thisLoadSideOutletNode.TempSetPoint; + } else { + if (this->EIRHPType == DataPlant::PlantEquipmentType::HeatPumpFuelFiredCooling) { + waterTempforCurve = thisLoadSideOutletNode.TempSetPointHi; + } else { + waterTempforCurve = thisLoadSideOutletNode.TempSetPointLo; + } + } + } else { + // If not SP modulated then use actual outlet temp from last iteration? + waterTempforCurve = state.dataLoopNodes->Node(this->loadSideNodes.outlet).Temp; + } + } + + // evaluate capacity modifier curve and determine load side heat transfer + Real64 capacityModifierFuncTemp = Curve::CurveValue(state, this->capFuncTempCurveIndex, waterTempforCurve, oaTempforCurve); + return this->referenceCapacity * capacityModifierFuncTemp; +} + } // namespace EnergyPlus::EIRPlantLoopHeatPumps diff --git a/src/EnergyPlus/PlantLoopHeatPumpEIR.hh b/src/EnergyPlus/PlantLoopHeatPumpEIR.hh index 6995689dec3..c822dbee9f1 100644 --- a/src/EnergyPlus/PlantLoopHeatPumpEIR.hh +++ b/src/EnergyPlus/PlantLoopHeatPumpEIR.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -331,6 +331,8 @@ namespace EIRPlantLoopHeatPumps { void oneTimeInit(EnergyPlusData &state) override; bool thermosiphonDisabled(EnergyPlusData &state); + + Real64 getDynamicMaxCapacity(EnergyPlusData &state) override; }; struct EIRFuelFiredHeatPump : public EIRPlantLoopHeatPump @@ -410,14 +412,15 @@ namespace EIRPlantLoopHeatPumps { int eirAuxElecFPLRErrorIndex = 0; // Override parent methods to be declared - void doPhysics(EnergyPlusData &state, Real64 currentLoad); + void doPhysics(EnergyPlusData &state, Real64 currentLoad) override; void sizeSrcSideASHP(EnergyPlusData &state); // 2022-05-18: may not need this one - void resetReportingVariables(); + void resetReportingVariables() override; static PlantComponent *factory(EnergyPlusData &state, DataPlant::PlantEquipmentType hp_type, const std::string &hp_name); static void pairUpCompanionCoils(EnergyPlusData &state); static void processInputForEIRPLHP(EnergyPlusData &state); - void oneTimeInit(EnergyPlusData &state); - void report(EnergyPlusData &state); + void oneTimeInit(EnergyPlusData &state) override; + void report(EnergyPlusData &state) override; + Real64 getDynamicMaxCapacity(EnergyPlusData &state) override; // New or specialized functions for derived struct virtual ~EIRFuelFiredHeatPump() = default; @@ -430,6 +433,10 @@ struct EIRPlantLoopHeatPumpsData : BaseGlobalStruct std::vector heatPumps; bool getInputsPLHP = true; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } @@ -445,6 +452,10 @@ struct EIRFuelFiredHeatPumpsData : BaseGlobalStruct std::vector heatPumps; bool getInputsFFHP = true; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/PlantPipingSystemsManager.cc b/src/EnergyPlus/PlantPipingSystemsManager.cc index b52c9540d17..4c4b4c1f78c 100644 --- a/src/EnergyPlus/PlantPipingSystemsManager.cc +++ b/src/EnergyPlus/PlantPipingSystemsManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -206,11 +206,11 @@ namespace PlantPipingSystemsManager { // The time init should be done here before we DoOneTimeInits because the DoOneTimeInits // includes a ground temperature initialization, which is based on the Cur%CurSimTimeSeconds variable // which would be carried over from the previous environment - thisDomain.Cur.CurSimTimeStepSize = state.dataGlobal->TimeStepZone * Constant::SecInHour; + thisDomain.Cur.CurSimTimeStepSize = state.dataGlobal->TimeStepZone * Constant::rSecsInHour; thisDomain.Cur.CurSimTimeSeconds = - ((state.dataGlobal->DayOfSim - 1) * 24 + (state.dataGlobal->HourOfDay - 1) + + ((state.dataGlobal->DayOfSim - 1) * Constant::iHoursInDay + (state.dataGlobal->HourOfDay - 1) + (state.dataGlobal->TimeStep - 1) * state.dataGlobal->TimeStepZone + state.dataHVACGlobal->SysTimeElapsed) * - Constant::SecInHour; + Constant::rSecsInHour; // There are also some inits that are "close to one time" inits...( one-time in standalone, each envrn in E+ ) if ((state.dataGlobal->BeginSimFlag && thisDomain.BeginSimInit) || (state.dataGlobal->BeginEnvrnFlag && thisDomain.BeginSimEnvironment)) { @@ -488,7 +488,7 @@ namespace PlantPipingSystemsManager { // RE-ENGINEERED na // SUBROUTINE PARAMETER DEFINITIONS: - static constexpr std::string_view RoutineName("ReadGeneralDomainInputs"); + static constexpr std::string_view routineName = "ReadGeneralDomainInputs"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumAlphas; // Number of Alphas for each GetObjectItem call @@ -512,6 +512,8 @@ namespace PlantPipingSystemsManager { state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + ErrorObjectHeader eoh{routineName, ObjName_ug_GeneralDomain, state.dataIPShortCut->cAlphaArgs(1)}; + auto &thisDomain = state.dataPlantPipingSysMgr->domains[DomainNum - 1]; // Get the name, validate @@ -531,7 +533,7 @@ namespace PlantPipingSystemsManager { } else if (meshDistribution == "SYMMETRICGEOMETRIC") { thisDomain.Mesh.X.thisMeshDistribution = MeshDistribution::SymmetricGeometric; if (mod(thisDomain.Mesh.X.RegionMeshCount, 2) != 0) { - ShowWarningError(state, format("PipingSystems:{}: Invalid mesh type-count combination.", RoutineName)); + ShowWarningError(state, format("PipingSystems:{}: Invalid mesh type-count combination.", routineName)); ShowContinueError(state, format("Instance:{}={}", ObjName_ug_GeneralDomain, thisDomain.Name)); ShowContinueError(state, "An ODD-valued X mesh count was found in the input for symmetric geometric configuration."); ShowContinueError(state, "This is invalid, mesh count incremented UP by one to next EVEN value."); @@ -542,7 +544,7 @@ namespace PlantPipingSystemsManager { } } else { IssueSevereInputFieldError(state, - RoutineName, + routineName, ObjName_ug_GeneralDomain, state.dataIPShortCut->cAlphaArgs(1), state.dataIPShortCut->cAlphaFieldNames(2), @@ -561,7 +563,7 @@ namespace PlantPipingSystemsManager { } else if (meshDistribution == "SYMMETRICGEOMETRIC") { thisDomain.Mesh.Y.thisMeshDistribution = MeshDistribution::SymmetricGeometric; if (mod(thisDomain.Mesh.Y.RegionMeshCount, 2) != 0) { - ShowWarningError(state, format("PipingSystems:{}: Invalid mesh type-count combination.", RoutineName)); + ShowWarningError(state, format("PipingSystems:{}: Invalid mesh type-count combination.", routineName)); ShowContinueError(state, format("Instance:{}={}", ObjName_ug_GeneralDomain, thisDomain.Name)); ShowContinueError(state, "An ODD-valued Y mesh count was found in the input for symmetric geometric configuration."); ShowContinueError(state, "This is invalid, mesh count incremented UP by one to next EVEN value."); @@ -572,7 +574,7 @@ namespace PlantPipingSystemsManager { } } else { IssueSevereInputFieldError(state, - RoutineName, + routineName, ObjName_ug_GeneralDomain, state.dataIPShortCut->cAlphaArgs(1), state.dataIPShortCut->cAlphaFieldNames(3), @@ -591,7 +593,7 @@ namespace PlantPipingSystemsManager { } else if (meshDistribution == "SYMMETRICGEOMETRIC") { thisDomain.Mesh.Z.thisMeshDistribution = MeshDistribution::SymmetricGeometric; if (mod(thisDomain.Mesh.Z.RegionMeshCount, 2) != 0) { - ShowWarningError(state, format("PipingSystems:{}: Invalid mesh type-count combination.", RoutineName)); + ShowWarningError(state, format("PipingSystems:{}: Invalid mesh type-count combination.", routineName)); ShowContinueError(state, format("Instance:{}={}", ObjName_ug_GeneralDomain, thisDomain.Name)); ShowContinueError(state, "An ODD-valued Z mesh count was found in the input for symmetric geometric configuration."); ShowContinueError(state, "This is invalid, mesh count incremented UP by one to next EVEN value."); @@ -602,7 +604,7 @@ namespace PlantPipingSystemsManager { } } else { IssueSevereInputFieldError(state, - RoutineName, + routineName, ObjName_ug_GeneralDomain, state.dataIPShortCut->cAlphaArgs(1), state.dataIPShortCut->cAlphaFieldNames(4), @@ -628,7 +630,7 @@ namespace PlantPipingSystemsManager { thisDomain.HasBasement = false; } else { IssueSevereInputFieldError(state, - RoutineName, + routineName, ObjName_ug_GeneralDomain, state.dataIPShortCut->cAlphaArgs(1), state.dataIPShortCut->cAlphaFieldNames(7), @@ -656,7 +658,7 @@ namespace PlantPipingSystemsManager { thisDomain.BasementZone.Width = state.dataIPShortCut->rNumericArgs(CurIndex); if (thisDomain.BasementZone.Width <= 0.0) { IssueSevereInputFieldError(state, - RoutineName, + routineName, ObjName_ug_GeneralDomain, state.dataIPShortCut->cAlphaArgs(1), state.dataIPShortCut->cNumericFieldNames(CurIndex), @@ -669,7 +671,7 @@ namespace PlantPipingSystemsManager { thisDomain.BasementZone.Depth = state.dataIPShortCut->rNumericArgs(CurIndex); if (thisDomain.BasementZone.Depth <= 0.0) { IssueSevereInputFieldError(state, - RoutineName, + routineName, ObjName_ug_GeneralDomain, state.dataIPShortCut->cAlphaArgs(1), state.dataIPShortCut->cNumericFieldNames(CurIndex), @@ -686,7 +688,7 @@ namespace PlantPipingSystemsManager { thisDomain.BasementZone.ShiftPipesByWidth = false; } else { IssueSevereInputFieldError(state, - RoutineName, + routineName, ObjName_ug_GeneralDomain, state.dataIPShortCut->cAlphaArgs(1), state.dataIPShortCut->cAlphaFieldNames(CurIndex), @@ -702,7 +704,7 @@ namespace PlantPipingSystemsManager { Util::FindItemInList(thisDomain.BasementZone.WallBoundaryOSCMName, state.dataSurface->OSCM); if (thisDomain.BasementZone.WallBoundaryOSCMIndex <= 0) { IssueSevereInputFieldError(state, - RoutineName, + routineName, ObjName_ug_GeneralDomain, state.dataIPShortCut->cAlphaArgs(1), state.dataIPShortCut->cAlphaFieldNames(CurIndex), @@ -714,7 +716,7 @@ namespace PlantPipingSystemsManager { if (wallIndexes.empty()) { IssueSevereInputFieldError( state, - RoutineName, + routineName, ObjName_ug_GeneralDomain, state.dataIPShortCut->cAlphaArgs(1), state.dataIPShortCut->cAlphaFieldNames(CurIndex), @@ -732,7 +734,7 @@ namespace PlantPipingSystemsManager { Util::FindItemInList(thisDomain.BasementZone.FloorBoundaryOSCMName, state.dataSurface->OSCM); if (thisDomain.BasementZone.FloorBoundaryOSCMIndex <= 0) { IssueSevereInputFieldError(state, - RoutineName, + routineName, ObjName_ug_GeneralDomain, state.dataIPShortCut->cAlphaArgs(1), state.dataIPShortCut->cAlphaFieldNames(CurIndex), @@ -744,7 +746,7 @@ namespace PlantPipingSystemsManager { if (floorIndexes.empty()) { IssueSevereInputFieldError( state, - RoutineName, + routineName, ObjName_ug_GeneralDomain, state.dataIPShortCut->cAlphaArgs(1), state.dataIPShortCut->cAlphaFieldNames(CurIndex), @@ -768,7 +770,13 @@ namespace PlantPipingSystemsManager { int const NumCircuitsInThisDomain = int(state.dataIPShortCut->rNumericArgs(20)); // Need to store the ground temp stuff because it will get wiped out in the call to the circuit factory - std::string const groundTempType = state.dataIPShortCut->cAlphaArgs(5); + GroundTemp::ModelType gtmType = + static_cast(getEnumValue(GroundTemp::modelTypeNamesUC, state.dataIPShortCut->cAlphaArgs(5))); + if (gtmType == GroundTemp::ModelType::Invalid) { + ShowSevereInvalidKey(state, eoh, state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5)); + ErrorsFound = true; + } + std::string const groundTempName = state.dataIPShortCut->cAlphaArgs(6); // Need to loop once to store the names ahead of time because calling the segment factory will override cAlphaArgs @@ -778,7 +786,7 @@ namespace PlantPipingSystemsManager { CurIndex = CircuitCtr + NumAlphasBeforePipeCircOne; if (state.dataIPShortCut->lAlphaFieldBlanks(CurIndex)) { IssueSevereInputFieldError(state, - RoutineName, + routineName, ObjName_Segment, state.dataIPShortCut->cAlphaArgs(1), state.dataIPShortCut->cAlphaFieldNames(CurIndex), @@ -794,7 +802,7 @@ namespace PlantPipingSystemsManager { } // Initialize ground temperature model and get pointer reference - thisDomain.groundTempModel = GetGroundTempModelAndInit(state, groundTempType, groundTempName); + thisDomain.groundTempModel = GroundTemp::GetGroundTempModelAndInit(state, gtmType, groundTempName); } } @@ -1078,8 +1086,14 @@ namespace PlantPipingSystemsManager { thisDomain.NumSlabCells = thisDomain.Mesh.Y.RegionMeshCount; // Need to clean this out at some point + GroundTemp::ModelType gtmType = static_cast(getEnumValue(GroundTemp::modelTypeNamesUC, s_ipsc->cAlphaArgs(2))); + if (gtmType == GroundTemp::ModelType::Invalid) { + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); + ErrorsFound = true; + } + // Farfield model - thisDomain.groundTempModel = GetGroundTempModelAndInit(state, s_ipsc->cAlphaArgs(2), s_ipsc->cAlphaArgs(3)); + thisDomain.groundTempModel = GroundTemp::GetGroundTempModelAndInit(state, gtmType, s_ipsc->cAlphaArgs(3)); // Other parameters thisDomain.SimControls.Convergence_CurrentToPrevIteration = 0.001; @@ -1368,9 +1382,14 @@ namespace PlantPipingSystemsManager { ErrorsFound = true; } + GroundTemp::ModelType gtmType = static_cast(getEnumValue(GroundTemp::modelTypeNamesUC, s_ipsc->cAlphaArgs(2))); + if (gtmType == GroundTemp::ModelType::Invalid) { + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); + ErrorsFound = true; + } // Farfield ground temperature model -- note this will overwrite the DataIPShortCuts variables // so any other processing below this line won't have access to the cAlphaArgs, etc., here - thisDomain.groundTempModel = GetGroundTempModelAndInit(state, s_ipsc->cAlphaArgs(2), s_ipsc->cAlphaArgs(3)); + thisDomain.groundTempModel = GroundTemp::GetGroundTempModelAndInit(state, gtmType, s_ipsc->cAlphaArgs(3)); // Total surface area Real64 ThisArea = 0.0; @@ -1789,6 +1808,8 @@ namespace PlantPipingSystemsManager { // MODIFIED na // RE-ENGINEERED na + constexpr std::string_view routineName = "ReadHorizontalTrenchInputs"; + // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumAlphas; // Number of Alphas for each GetObjectItem call int NumNumbers; // Number of Numbers for each GetObjectItem call @@ -1829,6 +1850,8 @@ namespace PlantPipingSystemsManager { auto &thisDomain = state.dataPlantPipingSysMgr->domains[DomainCtr - 1]; + ErrorObjectHeader eoh{routineName, ObjName_HorizTrench, s_ipsc->cAlphaArgs(1)}; + // Get the name, validate std::string thisTrenchName = s_ipsc->cAlphaArgs(1); Util::IsNameEmpty(state, s_ipsc->cAlphaArgs(1), s_ipsc->cCurrentModuleObject, ErrorsFound); @@ -1873,9 +1896,15 @@ namespace PlantPipingSystemsManager { // then we can loop through and allow the factory to be called and carry on thisDomain.circuits.push_back(Circuit::factory(state, thisTrenchName, ErrorsFound)); + GroundTemp::ModelType gtmType = static_cast(getEnumValue(GroundTemp::modelTypeNamesUC, s_ipsc->cAlphaArgs(4))); + if (gtmType == GroundTemp::ModelType::Invalid) { + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4)); + ErrorsFound = true; + } + // Farfield model parameters -- this is pushed down pretty low because it internally calls GetObjectItem // using DataIPShortCuts, so it will overwrite the cAlphaArgs and rNumericArgs values - thisDomain.groundTempModel = GetGroundTempModelAndInit(state, s_ipsc->cAlphaArgs(4), s_ipsc->cAlphaArgs(5)); + thisDomain.groundTempModel = GroundTemp::GetGroundTempModelAndInit(state, gtmType, s_ipsc->cAlphaArgs(5)); //******* Then we'll do the segments *******! for (int ThisCircuitPipeSegmentCounter = 1; ThisCircuitPipeSegmentCounter <= NumPipeSegments; ++ThisCircuitPipeSegmentCounter) { @@ -2098,11 +2127,7 @@ namespace PlantPipingSystemsManager { } // Once we find ourselves on the plant loop, we can do other things - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(thisCircuit->plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(thisCircuit->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(thisCircuit->plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); thisCircuit->DesignMassFlowRate = thisCircuit->DesignVolumeFlowRate * rho; thisCircuit->NeedToFindOnPlantLoop = false; } @@ -2333,7 +2358,7 @@ namespace PlantPipingSystemsManager { return (LocalMax < this->SimControls.Convergence_CurrentToPrevIteration); } - bool IsConverged_PipeCurrentToPrevIteration(Circuit *thisCircuit, CartesianCell const &CellToCheck) + bool IsConverged_PipeCurrentToPrevIteration(Circuit const *thisCircuit, CartesianCell const &CellToCheck) { // FUNCTION INFORMATION: @@ -4346,13 +4371,13 @@ namespace PlantPipingSystemsManager { Latitude_Radians = Constant::Pi / 180.0 * Latitude_Degrees; // The day of year at this point in the simulation - DayOfYear = int(this->Cur.CurSimTimeSeconds / Constant::SecsInDay); + DayOfYear = int(this->Cur.CurSimTimeSeconds / Constant::rSecsInDay); // The number of seconds into the current day - CurSecondsIntoToday = int(mod(this->Cur.CurSimTimeSeconds, Constant::SecsInDay)); + CurSecondsIntoToday = int(mod(this->Cur.CurSimTimeSeconds, Constant::rSecsInDay)); // The number of hours into today - HourOfDay = int(CurSecondsIntoToday / Constant::SecInHour); + HourOfDay = int(CurSecondsIntoToday / Constant::rSecsInHour); // For convenience convert to Kelvin once CurAirTempK = this->Cur.CurAirTemp + 273.15; @@ -5367,7 +5392,7 @@ namespace PlantPipingSystemsManager { cell.PipeCellData.Insulation.Temperature = Numerator / Denominator; } - void SimulateRadialPipeCell(Circuit *thisCircuit, CartesianCell &cell) + void SimulateRadialPipeCell(Circuit const *thisCircuit, CartesianCell &cell) { // SUBROUTINE INFORMATION: @@ -5432,7 +5457,7 @@ namespace PlantPipingSystemsManager { cell.PipeCellData.Pipe.Temperature = Numerator / Denominator; } - void SimulateFluidCell(Circuit *thisCircuit, CartesianCell &cell, Real64 const FlowRate, Real64 const EnteringFluidTemp) + void SimulateFluidCell(Circuit const *thisCircuit, CartesianCell &cell, Real64 const FlowRate, Real64 const EnteringFluidTemp) { // SUBROUTINE INFORMATION: @@ -5676,26 +5701,12 @@ namespace PlantPipingSystemsManager { // retrieve fluid properties based on the circuit inlet temperature -- which varies during the simulation // but need to verify the value of inlet temperature during warm up, etc. - FluidCp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(thisCircuit->plantLoc.loopNum).FluidName, - thisCircuit->InletTemperature, - state.dataPlnt->PlantLoop(thisCircuit->plantLoc.loopNum).FluidIndex, - RoutineName); - FluidDensity = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(thisCircuit->plantLoc.loopNum).FluidName, - thisCircuit->InletTemperature, - state.dataPlnt->PlantLoop(thisCircuit->plantLoc.loopNum).FluidIndex, - RoutineName); - FluidConductivity = FluidProperties::GetConductivityGlycol(state, - state.dataPlnt->PlantLoop(thisCircuit->plantLoc.loopNum).FluidName, - thisCircuit->InletTemperature, - state.dataPlnt->PlantLoop(thisCircuit->plantLoc.loopNum).FluidIndex, - RoutineName); - FluidViscosity = FluidProperties::GetViscosityGlycol(state, - state.dataPlnt->PlantLoop(thisCircuit->plantLoc.loopNum).FluidName, - thisCircuit->InletTemperature, - state.dataPlnt->PlantLoop(thisCircuit->plantLoc.loopNum).FluidIndex, - RoutineName); + FluidCp = state.dataPlnt->PlantLoop(thisCircuit->plantLoc.loopNum).glycol->getSpecificHeat(state, thisCircuit->InletTemperature, RoutineName); + FluidDensity = state.dataPlnt->PlantLoop(thisCircuit->plantLoc.loopNum).glycol->getDensity(state, thisCircuit->InletTemperature, RoutineName); + FluidConductivity = + state.dataPlnt->PlantLoop(thisCircuit->plantLoc.loopNum).glycol->getConductivity(state, thisCircuit->InletTemperature, RoutineName); + FluidViscosity = + state.dataPlnt->PlantLoop(thisCircuit->plantLoc.loopNum).glycol->getViscosity(state, thisCircuit->InletTemperature, RoutineName); // Doesn't anyone care about poor Ludwig Prandtl? FluidPrandtl = 3.0; diff --git a/src/EnergyPlus/PlantPipingSystemsManager.hh b/src/EnergyPlus/PlantPipingSystemsManager.hh index 2fe66bd9068..a6f106a52f8 100644 --- a/src/EnergyPlus/PlantPipingSystemsManager.hh +++ b/src/EnergyPlus/PlantPipingSystemsManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -63,7 +63,7 @@ #include #include #include -#include +#include #include #include #include @@ -83,9 +83,6 @@ namespace PlantPipingSystemsManager { extern std::string const ObjName_ZoneCoupled_Slab; extern std::string const ObjName_ZoneCoupled_Basement; - // Using/Aliasing - using namespace GroundTemperatureManager; - enum class SegmentFlow { Invalid = -1, @@ -774,7 +771,7 @@ namespace PlantPipingSystemsManager { BaseThermalPropertySet HorizInsProperties; BaseThermalPropertySet VertInsProperties; SimulationControl SimControls; - std::shared_ptr groundTempModel; + GroundTemp::BaseGroundTempsModel *groundTempModel; // non-owning pointer BasementZoneInfo BasementZone; MoistureInfo Moisture; // "Internal" data structure variables @@ -1062,11 +1059,11 @@ namespace PlantPipingSystemsManager { void SimulateRadialInsulationCell(CartesianCell &ThisCell); - void SimulateRadialPipeCell(Circuit *thisCircuit, CartesianCell &ThisCell); + void SimulateRadialPipeCell(Circuit const *thisCircuit, CartesianCell &ThisCell); - void SimulateFluidCell(Circuit *thisCircuit, CartesianCell &ThisCell, Real64 FlowRate, Real64 EnteringFluidTemp); + void SimulateFluidCell(Circuit const *thisCircuit, CartesianCell &ThisCell, Real64 FlowRate, Real64 EnteringFluidTemp); - bool IsConverged_PipeCurrentToPrevIteration(Circuit *thisCircuit, CartesianCell const &CellToCheck); + bool IsConverged_PipeCurrentToPrevIteration(Circuit const *thisCircuit, CartesianCell const &CellToCheck); } // namespace PlantPipingSystemsManager @@ -1082,6 +1079,10 @@ struct PlantPipingSysMgrData : BaseGlobalStruct std::vector segments; std::unordered_map GroundDomainUniqueNames; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/PlantPressureSystem.cc b/src/EnergyPlus/PlantPressureSystem.cc index 0512ee9a99a..d1a5ab9cd1d 100644 --- a/src/EnergyPlus/PlantPressureSystem.cc +++ b/src/EnergyPlus/PlantPressureSystem.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -369,14 +369,11 @@ void BranchPressureDrop(EnergyPlusData &state, // Using/Aliasing using Curve::CurveValue; using Curve::PressureCurveValue; - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetViscosityGlycol; // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("CalcPlantPressureSystem"); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int FluidIndex; // Plant loop level Fluid Index int InletNodeNum; // Component inlet node number DataBranchAirLoopPlant::PressureCurveType pressureCurveType; // Type of curve used to evaluate pressure drop int PressureCurveIndex; // Curve index for PerfCurve structure @@ -394,7 +391,6 @@ void BranchPressureDrop(EnergyPlusData &state, } // Get data from data structure - FluidIndex = state.dataPlnt->PlantLoop(LoopNum).FluidIndex; InletNodeNum = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).NodeNumIn; pressureCurveType = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).PressureCurveType; PressureCurveIndex = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).PressureCurveIndex; @@ -402,8 +398,8 @@ void BranchPressureDrop(EnergyPlusData &state, // Get nodal conditions NodeMassFlow = state.dataLoopNodes->Node(InletNodeNum).MassFlowRate; NodeTemperature = state.dataLoopNodes->Node(InletNodeNum).Temp; - NodeDensity = GetDensityGlycol(state, std::string(), NodeTemperature, FluidIndex, RoutineName); - NodeViscosity = GetViscosityGlycol(state, std::string(), NodeTemperature, FluidIndex, RoutineName); + NodeDensity = state.dataPlnt->PlantLoop(LoopNum).glycol->getDensity(state, NodeTemperature, RoutineName); + NodeViscosity = state.dataPlnt->PlantLoop(LoopNum).glycol->getViscosity(state, NodeTemperature, RoutineName); // Call the appropriate pressure calculation routine switch (pressureCurveType) { @@ -820,7 +816,7 @@ Real64 ResolveLoopFlowVsPressure(EnergyPlusData &state, // find a more realistic operating point for the plant. // METHODOLOGY EMPLOYED: - // Pressure drop of complete loop is found for a perticular flow rate. + // Pressure drop of complete loop is found for a particular flow rate. // i.e. pressuredrop = K * massflow ^ 2 // System curve is then solved with pump curve already entered // and flow rate provided by the pump will be calculated. @@ -829,8 +825,6 @@ Real64 ResolveLoopFlowVsPressure(EnergyPlusData &state, // Using/Aliasing using Curve::CurveValue; - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetViscosityGlycol; // Return value Real64 ResolvedLoopMassFlowRate; @@ -849,7 +843,6 @@ Real64 ResolveLoopFlowVsPressure(EnergyPlusData &state, Real64 PhiPump; Real64 PhiSystem; Real64 PsiPump; - int FluidIndex; int Iteration; Real64 LocalSystemMassFlow; Real64 LoopEffectiveK; @@ -860,13 +853,12 @@ Real64 ResolveLoopFlowVsPressure(EnergyPlusData &state, Real64 DampingFactor; // Get loop level data - FluidIndex = state.dataPlnt->PlantLoop(LoopNum).FluidIndex; LoopEffectiveK = state.dataPlnt->PlantLoop(LoopNum).PressureEffectiveK; SystemPressureDrop = LoopEffectiveK * pow_2(SystemMassFlow); // Read data off the node data structure NodeTemperature = state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).LoopSide(DataPlant::LoopSideLocation::Supply).NodeNumIn).Temp; - NodeDensity = GetDensityGlycol(state, std::string(), NodeTemperature, FluidIndex, RoutineName); + NodeDensity = state.dataPlnt->PlantLoop(LoopNum).glycol->getDensity(state, NodeTemperature, RoutineName); // Store the passed in (requested, design) flow to the local value for performing iterations LocalSystemMassFlow = SystemMassFlow; @@ -912,7 +904,7 @@ Real64 ResolveLoopFlowVsPressure(EnergyPlusData &state, // Get the pump curve value from the curve manager PsiPump = CurveValue(state, PumpCurveNum, PhiPump); - // Calcuate Pump Pressure rise + // Calculate Pump Pressure rise PumpPressureRise = PsiPump * NodeDensity * pow_2(PumpSpeed) * pow_2(PumpImpellerDia); // Convergence Criteria Based on Pressure diff --git a/src/EnergyPlus/PlantPressureSystem.hh b/src/EnergyPlus/PlantPressureSystem.hh index 7c490d773c7..960ecf8ea37 100644 --- a/src/EnergyPlus/PlantPressureSystem.hh +++ b/src/EnergyPlus/PlantPressureSystem.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -124,6 +124,10 @@ struct PlantPressureSysData : BaseGlobalStruct int ZeroKWarningCounter = 0; int MaxIterWarningCounter = 0; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/PlantUtilities.cc b/src/EnergyPlus/PlantUtilities.cc index 252dc923965..b204d918aa1 100644 --- a/src/EnergyPlus/PlantUtilities.cc +++ b/src/EnergyPlus/PlantUtilities.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -860,8 +860,6 @@ void PullCompInterconnectTrigger(EnergyPlusData &state, // SUBROUTINE INFORMATION: // AUTHOR Edwin Lee // DATE WRITTEN September 2010 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Provides a generic means for components to trigger interconnected loop sides sim flags @@ -881,13 +879,6 @@ void PullCompInterconnectTrigger(EnergyPlusData &state, // associated component. Therefore whenever we come in with a non-zero index, we will just // verify that the stored loop/side/branch/comp matches - // Using/Aliasing - using DataPlant::CriteriaDelta_HeatTransferRate; - using DataPlant::CriteriaDelta_MassFlowRate; - using DataPlant::CriteriaDelta_Temperature; - - CriteriaData CurCriteria; // for convenience - if (UniqueCriteriaCheckIndex <= 0) { // If we don't yet have an index, we need to initialize // We need to start by allocating, or REallocating the array @@ -897,9 +888,10 @@ void PullCompInterconnectTrigger(EnergyPlusData &state, // Store the unique name and location state.dataPlantUtilities->CriteriaChecks(CurrentNumChecksStored).CallingCompLoopNum = plantLoc.loopNum; state.dataPlantUtilities->CriteriaChecks(CurrentNumChecksStored).CallingCompLoopSideNum = plantLoc.loopSideNum; - state.dataPlantUtilities->CriteriaChecks(CurrentNumChecksStored).CallingCompBranchNum = plantLoc.branchNum; - state.dataPlantUtilities->CriteriaChecks(CurrentNumChecksStored).CallingCompCompNum = plantLoc.compNum; + if (plantLoc.loopNum == 0 || plantLoc.loopSideNum == DataPlant::LoopSideLocation::Invalid) { + assert(false); // check that component has been set up correctly + } // Since this was the first pass, it is safe to assume something has changed! // Therefore we'll set the sim flag to true state.dataPlnt->PlantLoop(ConnectedPlantLoc.loopNum).LoopSide(ConnectedPlantLoc.loopSideNum).SimLoopSideNeeded = true; @@ -913,33 +905,27 @@ void PullCompInterconnectTrigger(EnergyPlusData &state, // sim flag status based on the criteria type // First store the current check in a single variable instead of array for readability - CurCriteria = state.dataPlantUtilities->CriteriaChecks(UniqueCriteriaCheckIndex); - - // Check to make sure we didn't reuse the index in multiple components - if (CurCriteria.CallingCompLoopNum != plantLoc.loopNum || CurCriteria.CallingCompLoopSideNum != plantLoc.loopSideNum || - CurCriteria.CallingCompBranchNum != plantLoc.branchNum || CurCriteria.CallingCompCompNum != plantLoc.compNum) { - // Diagnostic fatal: component does not properly utilize unique indexing - } + CriteriaData CurCriteria = state.dataPlantUtilities->CriteriaChecks(UniqueCriteriaCheckIndex); // Initialize, then check if we are out of range switch (CriteriaType) { case DataPlant::CriteriaType::MassFlowRate: { - if (std::abs(CurCriteria.ThisCriteriaCheckValue - CriteriaValue) > CriteriaDelta_MassFlowRate) { + if (std::abs(CurCriteria.ThisCriteriaCheckValue - CriteriaValue) > DataPlant::CriteriaDelta_MassFlowRate) { state.dataPlnt->PlantLoop(ConnectedPlantLoc.loopNum).LoopSide(ConnectedPlantLoc.loopSideNum).SimLoopSideNeeded = true; } } break; case DataPlant::CriteriaType::Temperature: { - if (std::abs(CurCriteria.ThisCriteriaCheckValue - CriteriaValue) > CriteriaDelta_Temperature) { + if (std::abs(CurCriteria.ThisCriteriaCheckValue - CriteriaValue) > DataPlant::CriteriaDelta_Temperature) { state.dataPlnt->PlantLoop(ConnectedPlantLoc.loopNum).LoopSide(ConnectedPlantLoc.loopSideNum).SimLoopSideNeeded = true; } } break; case DataPlant::CriteriaType::HeatTransferRate: { - if (std::abs(CurCriteria.ThisCriteriaCheckValue - CriteriaValue) > CriteriaDelta_HeatTransferRate) { + if (std::abs(CurCriteria.ThisCriteriaCheckValue - CriteriaValue) > DataPlant::CriteriaDelta_HeatTransferRate) { state.dataPlnt->PlantLoop(ConnectedPlantLoc.loopNum).LoopSide(ConnectedPlantLoc.loopSideNum).SimLoopSideNeeded = true; } } break; default: - // Diagnostic fatal: improper criteria type + assert(false); break; } @@ -976,9 +962,6 @@ void UpdateChillerComponentCondenserSide(EnergyPlusData &state, // check if anything changed or doesn't agree and set simulation flags. // update outlet conditions if needed or possible - // Using/Aliasing - using FluidProperties::GetSpecificHeatGlycol; - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("UpdateChillerComponentCondenserSide"); @@ -1009,8 +992,7 @@ void UpdateChillerComponentCondenserSide(EnergyPlusData &state, // use current mass flow rate and inlet temp from Node and recalculate outlet temp if (state.dataLoopNodes->Node(InletNodeNum).MassFlowRate > DataBranchAirLoopPlant::MassFlowTolerance) { // update node outlet conditions - Cp = GetSpecificHeatGlycol( - state, state.dataPlnt->PlantLoop(LoopNum).FluidName, ModelInletTemp, state.dataPlnt->PlantLoop(LoopNum).FluidIndex, RoutineName); + Cp = state.dataPlnt->PlantLoop(LoopNum).glycol->getSpecificHeat(state, ModelInletTemp, RoutineName); state.dataLoopNodes->Node(OutletNodeNum).Temp = state.dataLoopNodes->Node(InletNodeNum).Temp + ModelCondenserHeatRate / (state.dataLoopNodes->Node(InletNodeNum).MassFlowRate * Cp); } @@ -1068,9 +1050,6 @@ void UpdateComponentHeatRecoverySide(EnergyPlusData &state, // check if anything changed or doesn't agree and set simulation flags. // update outlet conditions if needed or possible - // Using/Aliasing - using FluidProperties::GetSpecificHeatGlycol; - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("UpdateComponentHeatRecoverySide"); @@ -1100,8 +1079,7 @@ void UpdateComponentHeatRecoverySide(EnergyPlusData &state, // use current mass flow rate and inlet temp from Node and recalculate outlet temp if (state.dataLoopNodes->Node(InletNodeNum).MassFlowRate > DataBranchAirLoopPlant::MassFlowTolerance) { // update node outlet conditions - Cp = GetSpecificHeatGlycol( - state, state.dataPlnt->PlantLoop(LoopNum).FluidName, ModelInletTemp, state.dataPlnt->PlantLoop(LoopNum).FluidIndex, RoutineName); + Cp = state.dataPlnt->PlantLoop(LoopNum).glycol->getSpecificHeat(state, ModelInletTemp, RoutineName); state.dataLoopNodes->Node(OutletNodeNum).Temp = state.dataLoopNodes->Node(InletNodeNum).Temp + ModelRecoveryHeatRate / (state.dataLoopNodes->Node(InletNodeNum).MassFlowRate * Cp); } diff --git a/src/EnergyPlus/PlantUtilities.hh b/src/EnergyPlus/PlantUtilities.hh index 309cea0b34d..4e63884a8f6 100644 --- a/src/EnergyPlus/PlantUtilities.hh +++ b/src/EnergyPlus/PlantUtilities.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -210,18 +210,9 @@ namespace PlantUtilities { struct CriteriaData { // Members - int CallingCompLoopNum; // for debug error handling - DataPlant::LoopSideLocation CallingCompLoopSideNum; // for debug error handling - int CallingCompBranchNum; // for debug error handling - int CallingCompCompNum; // for debug error handling - Real64 ThisCriteriaCheckValue; // the previous value, to check the current against - - // Default Constructor - CriteriaData() - : CallingCompLoopNum(0), CallingCompLoopSideNum(DataPlant::LoopSideLocation::Invalid), CallingCompBranchNum(0), CallingCompCompNum(0), - ThisCriteriaCheckValue(0.0) - { - } + int CallingCompLoopNum = 0; // for debug error handling + DataPlant::LoopSideLocation CallingCompLoopSideNum = DataPlant::LoopSideLocation::Invalid; // for debug error handling + Real64 ThisCriteriaCheckValue = 0.0; // the previous value, to check the current against }; } // namespace PlantUtilities @@ -231,6 +222,10 @@ struct PlantUtilitiesData : BaseGlobalStruct Array1D CriteriaChecks; // stores criteria information + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/PlantValves.cc b/src/EnergyPlus/PlantValves.cc index 0a0a2e00e71..cf7fd234495 100644 --- a/src/EnergyPlus/PlantValves.cc +++ b/src/EnergyPlus/PlantValves.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -300,9 +300,9 @@ namespace PlantValves { for (auto &thisPlantLoop : state.dataPlnt->PlantLoop) { for (auto &thisLoopSide : thisPlantLoop.LoopSide) { int branchCtr = 0; - for (auto &thisBranch : thisLoopSide.Branch) { + for (auto const &thisBranch : thisLoopSide.Branch) { branchCtr++; - for (auto &thisComp : thisBranch.Comp) { + for (auto const &thisComp : thisBranch.Comp) { if ((thisComp.Type == DataPlant::PlantEquipmentType::ValveTempering) && (thisComp.Name == this->Name)) { // we found it. @@ -341,9 +341,9 @@ namespace PlantValves { } // has mixer // is pump node really the outlet of a branch with a pump? - for (auto &thisInnerBranch : thisLoopSide.Branch) { + for (auto const &thisInnerBranch : thisLoopSide.Branch) { if (thisInnerBranch.NodeNumOut == this->PltPumpOutletNodeNum) { - for (auto &thisInnerComp : thisInnerBranch.Comp) { + for (auto const &thisInnerComp : thisInnerBranch.Comp) { if (DataPlant::PlantEquipmentTypeIsPump[static_cast(thisInnerComp.Type)]) { PumpOutNodeOkay = true; } diff --git a/src/EnergyPlus/PlantValves.hh b/src/EnergyPlus/PlantValves.hh index bce6571a534..7468afd67cb 100644 --- a/src/EnergyPlus/PlantValves.hh +++ b/src/EnergyPlus/PlantValves.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -121,6 +121,10 @@ struct PlantValvesData : BaseGlobalStruct int NumTemperingValves = 0; EPVector TemperValve; // dimension to No. of TemperingValve objects + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/Platform.hh b/src/EnergyPlus/Platform.hh index dce875bf2a4..35b9ded188d 100644 --- a/src/EnergyPlus/Platform.hh +++ b/src/EnergyPlus/Platform.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -57,18 +57,18 @@ // Clang-Specific #ifndef __has_attribute -#define __has_attribute(x) 0 +# define __has_attribute(x) 0 #endif // Force inlining #ifndef ALWAYS_INLINE -#if defined(__GNUC__) || (defined(__clang__) && __has_attribute(always_inline)) -#define ALWAYS_INLINE inline __attribute__((__always_inline__)) -#elif defined(_MSC_VER) || defined(__INTEL_COMPILER) -#define ALWAYS_INLINE __forceinline -#else -#define ALWAYS_INLINE inline -#endif +# if defined(__GNUC__) || (defined(__clang__) && __has_attribute(always_inline)) +# define ALWAYS_INLINE inline __attribute__((__always_inline__)) +# elif defined(_MSC_VER) || defined(__INTEL_COMPILER) +# define ALWAYS_INLINE __forceinline +# else +# define ALWAYS_INLINE inline +# endif #endif #endif diff --git a/src/EnergyPlus/PluginManager.cc b/src/EnergyPlus/PluginManager.cc index 74b8addda9a..3125fabe703 100644 --- a/src/EnergyPlus/PluginManager.cc +++ b/src/EnergyPlus/PluginManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -59,19 +59,19 @@ #if LINK_WITH_PYTHON -#ifdef _DEBUG +# ifdef _DEBUG // We don't want to try to import a debug build of Python here // so if we are building a Debug build of the C++ code, we need // to undefine _DEBUG during the #include command for Python.h. // Otherwise it will fail -#undef _DEBUG -#include -#define _DEBUG -#else -#include -#endif - -#include +# undef _DEBUG +# include +# define _DEBUG +# else +# include +# endif + +# include template <> struct fmt::formatter { // parse is inherited from formatter. @@ -181,7 +181,7 @@ std::string pythonStringForUsage([[maybe_unused]] const EnergyPlusData &state) } #endif -void PluginManager::setupOutputVariables(EnergyPlusData &state) +void PluginManager::setupOutputVariables([[maybe_unused]] EnergyPlusData &state) { #if LINK_WITH_PYTHON // with the PythonPlugin:Variables all set in memory, we can now set them up as outputs as needed @@ -461,6 +461,22 @@ void initPython(EnergyPlusData &state, fs::path const &pathToPythonPackages) // Py_Initialize(); Py_InitializeFromConfig(&config); } + +// GilGrabber is an RAII helper that will ensure we release the GIL (including if we end up throwing) +struct GilGrabber +{ + GilGrabber() + { + gil = PyGILState_Ensure(); + } + ~GilGrabber() + { + PyGILState_Release(gil); + } + + PyGILState_STATE gil; +}; + #endif // LINK_WITH_PYTHON PluginManager::PluginManager(EnergyPlusData &state) : eplusRunningViaPythonAPI(state.dataPluginManager->eplusRunningViaPythonAPI) @@ -484,8 +500,8 @@ PluginManager::PluginManager(EnergyPlusData &state) : eplusRunningViaPythonAPI(s initPython(state, pathToPythonPackages); - // Take control of the global interpreter lock while we are here, make sure to release it... - PyGILState_STATE gil = PyGILState_Ensure(); + // Take control of the global interpreter lock, which will be released via RAII + GilGrabber gil_grabber; // call this once to allow us to add to, and report, sys.path later as needed PyRun_SimpleString("import sys"); // allows us to report sys.path later @@ -679,8 +695,8 @@ PluginManager::PluginManager(EnergyPlusData &state) : eplusRunningViaPythonAPI(s } } - // Release the global interpreter lock - PyGILState_Release(gil); + // Release the global interpreter lock is done via RAII + // setting up output variables deferred until later in the simulation setup process #else // need to alert only if a plugin instance is found @@ -1103,8 +1119,8 @@ bool PluginInstance::run(EnergyPlusData &state, EMSManager::EMSCallFrom iCalledF return false; } - // Get control of the global interpreter lock - PyGILState_STATE gil = PyGILState_Ensure(); + // Take control of the global interpreter lock, which will be released via RAII + GilGrabber gil_grabber; // then call the main function // static const PyObject oneArgObjFormat = Py_BuildValue)("O"); @@ -1119,7 +1135,6 @@ bool PluginInstance::run(EnergyPlusData &state, EMSManager::EMSCallFrom iCalledF } else { ShowContinueError(state, "This could happen for any number of reasons, check the plugin code."); } - PyGILState_Release(gil); ShowFatalError(state, format("Program terminates after call to {}() on {} failed!", functionNameAsString, this->stringIdentifier)); } if (PyLong_Check(pFunctionResponse)) { // NOLINT(hicpp-signed-bitwise) @@ -1127,12 +1142,10 @@ bool PluginInstance::run(EnergyPlusData &state, EMSManager::EMSCallFrom iCalledF if (exitCode == 0) { // success } else if (exitCode == 1) { - PyGILState_Release(gil); ShowFatalError(state, format("Python Plugin \"{}\" returned 1 to indicate EnergyPlus should abort", this->stringIdentifier)); } } else { std::string const functionNameAsString(functionName); // only convert to string if an error occurs - PyGILState_Release(gil); ShowFatalError( state, format("Invalid return from {}() on class \"{}, make sure it returns an integer exit code, either zero (success) or one (failure)", @@ -1141,10 +1154,8 @@ bool PluginInstance::run(EnergyPlusData &state, EMSManager::EMSCallFrom iCalledF } Py_DECREF(pFunctionResponse); // PyObject_CallFunction returns new reference, decrement if (state.dataPluginManager->apiErrorFlag) { - PyGILState_Release(gil); ShowFatalError(state, "API problems encountered while running plugin cause program termination."); } - PyGILState_Release(gil); return true; } #else diff --git a/src/EnergyPlus/PluginManager.hh b/src/EnergyPlus/PluginManager.hh index 50fa4cc396c..d132effc8ff 100644 --- a/src/EnergyPlus/PluginManager.hh +++ b/src/EnergyPlus/PluginManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -60,10 +60,10 @@ #include #if LINK_WITH_PYTHON -#ifndef PyObject_HEAD +# ifndef PyObject_HEAD struct _object; using PyObject = _object; -#endif +# endif #endif namespace EnergyPlus { @@ -246,6 +246,10 @@ struct PluginManagerData : BaseGlobalStruct bool eplusRunningViaPythonAPI = false; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/PollutionModule.cc b/src/EnergyPlus/PollutionModule.cc index a05573c2b94..59747e43abc 100644 --- a/src/EnergyPlus/PollutionModule.cc +++ b/src/EnergyPlus/PollutionModule.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -138,9 +138,6 @@ void SetupPollutionCalculations(EnergyPlusData &state) // METHODOLOGY EMPLOYED: // Uses the status flags to trigger events. - // Using/Aliasing - using ScheduleManager::GetScheduleIndex; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumPolluteRpt; int NumAlphas; @@ -304,41 +301,24 @@ void GetPollutionFactorInput(EnergyPlusData &state) pollCoeff.used = true; pollCoeff.sourceCoeff = ipsc->rNumericArgs(1); - if (!ipsc->lAlphaFieldBlanks(2)) { - pollCoeff.sourceSchedNum = ScheduleManager::GetScheduleIndex(state, ipsc->cAlphaArgs(2)); - if (pollCoeff.sourceSchedNum == 0) { - ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(2), ipsc->cAlphaArgs(2)); - ErrorsFound = true; - } else if (!ScheduleManager::CheckScheduleValueMinMax(state, pollCoeff.sourceSchedNum, true, 0.0)) { - ShowSevereError(state, - format("{}: {}, invalid {}=\"{}\" invalid values.", - ipsc->cCurrentModuleObject, - Constant::eFuelNames[(int)fuel], - ipsc->cAlphaFieldNames(2), - ipsc->cAlphaArgs(2))); - ShowContinueError(state, "Schedule values must be (>=0.)."); - ErrorsFound = true; - } + if (ipsc->lAlphaFieldBlanks(2)) { + } else if ((pollCoeff.sourceSched = Sched::GetSchedule(state, ipsc->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(2), ipsc->cAlphaArgs(2)); + ErrorsFound = true; + } else if (!pollCoeff.sourceSched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, ipsc->cAlphaFieldNames(2), ipsc->cAlphaArgs(2), Clusive::In, 0.0); + ErrorsFound = true; } for (int iPollutant = 0; iPollutant < (int)Pollutant::Num; ++iPollutant) { pollCoeff.pollutantCoeffs[iPollutant] = ipsc->rNumericArgs(iPollutant + 2); - if (!ipsc->lAlphaFieldBlanks(iPollutant + 3)) { - - pollCoeff.pollutantSchedNums[iPollutant] = ScheduleManager::GetScheduleIndex(state, ipsc->cAlphaArgs(iPollutant + 3)); - if (pollCoeff.pollutantSchedNums[iPollutant] == 0) { - ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(iPollutant + 3), ipsc->cAlphaArgs(iPollutant + 3)); - ErrorsFound = true; - } else if (!ScheduleManager::CheckScheduleValueMinMax(state, pollCoeff.pollutantSchedNums[iPollutant], true, 0.0)) { - ShowSevereError(state, - format("{}: {}, invalid {}=\"{}\" invalid values.", - ipsc->cCurrentModuleObject, - Constant::eFuelNames[(int)fuel], - ipsc->cAlphaFieldNames(iPollutant + 3), - ipsc->cAlphaArgs(iPollutant + 3))); - ShowContinueError(state, "Schedule values must be (>=0.)."); - ErrorsFound = true; - } + if (ipsc->lAlphaFieldBlanks(iPollutant + 3)) { + } else if ((pollCoeff.pollutantScheds[iPollutant] = Sched::GetSchedule(state, ipsc->cAlphaArgs(iPollutant + 3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(iPollutant + 3), ipsc->cAlphaArgs(iPollutant + 3)); + ErrorsFound = true; + } else if (!pollCoeff.pollutantScheds[iPollutant]->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, ipsc->cAlphaFieldNames(iPollutant + 3), ipsc->cAlphaArgs(iPollutant + 3), Clusive::In, 0.0); + ErrorsFound = true; } } // for (iPollutant) @@ -612,8 +592,8 @@ void CalcPollution(EnergyPlusData &state) // Why are these two the exceptions? if (iPoll != (int)Pollutant::Water && iPoll != (int)Pollutant::NuclearLow) pollutantVal *= 0.001; - if (pollCoeff.pollutantSchedNums[iPoll] != 0) { - pollutantVal *= ScheduleManager::GetCurrentScheduleValue(state, pollCoeff.pollutantSchedNums[iPoll]); + if (pollCoeff.pollutantScheds[iPoll] != nullptr) { + pollutantVal *= pollCoeff.pollutantScheds[iPoll]->getCurrentVal(); } pollComp.pollutantVals[iPoll] = pm->facilityMeterFuelComponentVals[(int)pollFuelComp] * 1.0e-6 * pollutantVal; } @@ -636,8 +616,8 @@ void CalcPollution(EnergyPlusData &state) pollCompElecSurplusSold.sourceVal = pm->facilityMeterFuelComponentVals[(int)PollFuelComponent::ElectricitySurplusSold] * pollCoeffElec.sourceCoeff; - if (pollCoeffElec.sourceSchedNum != 0) { - Real64 pollCoeffElecSchedVal = ScheduleManager::GetCurrentScheduleValue(state, pollCoeffElec.sourceSchedNum); + if (pollCoeffElec.sourceSched != nullptr) { + Real64 pollCoeffElecSchedVal = pollCoeffElec.sourceSched->getCurrentVal(); pollCompElec.sourceVal *= pollCoeffElecSchedVal; pollCompElecPurchased.sourceVal *= pollCoeffElecSchedVal; pollCompElecSurplusSold.sourceVal *= pollCoeffElecSchedVal; @@ -647,8 +627,8 @@ void CalcPollution(EnergyPlusData &state) auto const &pollCoeffGas = pm->pollCoeffs[(int)PollFuel::NaturalGas]; auto &pollCompGas = pm->pollComps[(int)PollFuelComponent::NaturalGas]; pollCompGas.sourceVal = pm->facilityMeterVals[(int)PollFacilityMeter::NaturalGas] * pollCoeffGas.sourceCoeff; - if (pollCoeffGas.sourceSchedNum != 0) { - pollCompGas.sourceVal *= ScheduleManager::GetCurrentScheduleValue(state, pollCoeffGas.sourceSchedNum); + if (pollCoeffGas.sourceSched != nullptr) { + pollCompGas.sourceVal *= pollCoeffGas.sourceSched->getCurrentVal(); } for (PollFuel pollFuel : {PollFuel::FuelOil1, @@ -664,8 +644,8 @@ void CalcPollution(EnergyPlusData &state) auto &pollComp = pm->pollComps[(int)pollFuelComponent]; pollComp.sourceVal = pm->facilityMeterFuelComponentVals[(int)pollFuelComponent] * pollCoeff.sourceCoeff; - if (pollCoeff.sourceSchedNum != 0) { - pollComp.sourceVal *= ScheduleManager::GetCurrentScheduleValue(state, pollCoeff.sourceSchedNum); + if (pollCoeff.sourceSched != nullptr) { + pollComp.sourceVal *= pollCoeff.sourceSched->getCurrentVal(); } } // for (pollFuelComponent) } // CalcPollution() @@ -735,7 +715,7 @@ void GetFuelFactorInfo(EnergyPlusData &state, bool &fuelFactorUsed, // return value true if user has entered this fuel Real64 &fuelSourceFactor, // if used, the source factor bool &fuelFactorScheduleUsed, // if true, schedules for this fuel are used - int &ffScheduleIndex // if schedules for this fuel are used, return schedule index + Sched::Schedule **ffSched // if schedules for this fuel are used, return schedule index ) { @@ -746,7 +726,7 @@ void GetFuelFactorInfo(EnergyPlusData &state, // PURPOSE OF THIS SUBROUTINE: // This routine allows access to data inside this module from other modules (specifically the // output tabular reports. - auto &pm = state.dataPollution; + auto const &pm = state.dataPollution; if (pm->GetInputFlagPollution) { GetPollutionFactorInput(state); @@ -756,7 +736,7 @@ void GetFuelFactorInfo(EnergyPlusData &state, fuelFactorUsed = false; fuelSourceFactor = 0.0; fuelFactorScheduleUsed = false; - ffScheduleIndex = 0; + *ffSched = nullptr; PollFuel pollFuel = fuel2pollFuel[(int)fuel]; auto const &pollCoeff = pm->pollCoeffs[(int)pollFuel]; @@ -764,11 +744,11 @@ void GetFuelFactorInfo(EnergyPlusData &state, if (pollCoeff.used) { fuelFactorUsed = true; fuelSourceFactor = pollCoeff.sourceCoeff; - if (pollCoeff.sourceSchedNum == 0) { + if (pollCoeff.sourceSched == nullptr) { fuelFactorScheduleUsed = false; } else { fuelFactorScheduleUsed = true; - ffScheduleIndex = pollCoeff.sourceSchedNum; + *ffSched = pollCoeff.sourceSched; } } else { fuelSourceFactor = pollFuelFactors[(int)pollFuel]; diff --git a/src/EnergyPlus/PollutionModule.hh b/src/EnergyPlus/PollutionModule.hh index 9f63d86c6ed..afb912ca592 100644 --- a/src/EnergyPlus/PollutionModule.hh +++ b/src/EnergyPlus/PollutionModule.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -196,8 +196,8 @@ namespace Pollution { PollFuel::OtherFuel1, // OtherFuel1 PollFuel::OtherFuel2, // OtherFuel2 PollFuel::Electricity, // DistrictCooling - PollFuel::NaturalGas, // DistrictHeating - PollFuel::NaturalGas, // Steam + PollFuel::NaturalGas, // DistrictHeatingWater + PollFuel::NaturalGas, // DistrictHeatingSteam }; constexpr std::array pollFuel2fuel = { @@ -320,8 +320,8 @@ namespace Pollution { bool used = false; Real64 sourceCoeff = 0.0; std::array pollutantCoeffs = {0.0}; - int sourceSchedNum = 0; - std::array pollutantSchedNums = {0}; + Sched::Schedule *sourceSched = nullptr; + std::array pollutantScheds = {0}; }; void CalculatePollution(EnergyPlusData &state); @@ -338,12 +338,13 @@ namespace Pollution { void ReadEnergyMeters(EnergyPlusData &state); - void GetFuelFactorInfo(EnergyPlusData &state, - Constant::eFuel fuel, // input fuel name (standard from Tabular reports) - bool &fuelFactorUsed, // return value true if user has entered this fuel - Real64 &fuelSourceFactor, // if used, the source factor - bool &fuelFactorScheduleUsed, // if true, schedules for this fuel are used - int &ffScheduleIndex // if schedules for this fuel are used, return schedule index + void + GetFuelFactorInfo(EnergyPlusData &state, + Constant::eFuel fuel, // input fuel name (standard from Tabular reports) + bool &fuelFactorUsed, // return value true if user has entered this fuel + Real64 &fuelSourceFactor, // if used, the source factor + bool &fuelFactorScheduleUsed, // if true, schedules for this fuel are used + Sched::Schedule **ffSched // if schedules for this fuel are used, return schedule pointer (need pointer to pointer to do this) ); void GetEnvironmentalImpactFactorInfo(EnergyPlusData &state, @@ -387,6 +388,10 @@ struct PollutionData : BaseGlobalStruct Real64 PurchCoolCOP = 0.0; Real64 SteamConvEffic = 0.0; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/PondGroundHeatExchanger.cc b/src/EnergyPlus/PondGroundHeatExchanger.cc index 2c760a70f8f..bcb5e379858 100644 --- a/src/EnergyPlus/PondGroundHeatExchanger.cc +++ b/src/EnergyPlus/PondGroundHeatExchanger.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -114,7 +114,6 @@ namespace EnergyPlus::PondGroundHeatExchanger { // ASHRAE Transactions. 106(2):107-121. Real64 constexpr StefBoltzmann(5.6697e-08); // Stefan-Boltzmann constant -constexpr std::string_view fluidNameWater = "WATER"; void PondGroundHeatExchangerData::simulate(EnergyPlusData &state, [[maybe_unused]] const PlantLocation &calledFromLocation, @@ -207,7 +206,10 @@ void GetPondGroundHeatExchanger(EnergyPlusData &state) state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); - state.dataPondGHE->PondGHE(Item).WaterIndex = FluidProperties::GetGlycolNum(state, fluidNameWater); + if ((state.dataPondGHE->PondGHE(Item).water = Fluid::GetWater(state)) == nullptr) { + ShowSevereError(state, "Fluid Properties for WATER not found"); + ErrorsFound = true; + } // General user input data state.dataPondGHE->PondGHE(Item).Name = state.dataIPShortCut->cAlphaArgs(1); @@ -469,26 +471,22 @@ void PondGroundHeatExchangerData::CalcPondGroundHeatExchanger(EnergyPlusData &st static constexpr std::string_view RoutineName("CalcPondGroundHeatExchanger"); - Real64 PondMass = this->Depth * this->Area * - FluidProperties::GetDensityGlycol( - state, fluidNameWater, max(this->PondTemp, DataPrecisionGlobals::constant_zero), this->WaterIndex, RoutineName); - - Real64 SpecificHeat = FluidProperties::GetSpecificHeatGlycol( - state, fluidNameWater, max(this->PondTemp, DataPrecisionGlobals::constant_zero), this->WaterIndex, RoutineName); + Real64 PondMass = this->Depth * this->Area * this->water->getDensity(state, max(this->PondTemp, 0.0), RoutineName); + Real64 SpecificHeat = this->water->getSpecificHeat(state, max(this->PondTemp, 0.0), RoutineName); Real64 Flux = this->CalcTotalFLux(state, this->PondTemp); Real64 PondTempStar = - this->PastBulkTemperature + 0.5 * Constant::SecInHour * state.dataHVACGlobal->TimeStepSys * Flux / (SpecificHeat * PondMass); + this->PastBulkTemperature + 0.5 * Constant::rSecsInHour * state.dataHVACGlobal->TimeStepSys * Flux / (SpecificHeat * PondMass); Real64 FluxStar = this->CalcTotalFLux(state, PondTempStar); Real64 PondTempStarStar = - this->PastBulkTemperature + 0.5 * Constant::SecInHour * state.dataHVACGlobal->TimeStepSys * FluxStar / (SpecificHeat * PondMass); + this->PastBulkTemperature + 0.5 * Constant::rSecsInHour * state.dataHVACGlobal->TimeStepSys * FluxStar / (SpecificHeat * PondMass); Real64 FluxStarStar = this->CalcTotalFLux(state, PondTempStarStar); Real64 PondTempStarStarStar = - this->PastBulkTemperature + Constant::SecInHour * state.dataHVACGlobal->TimeStepSys * FluxStarStar / (SpecificHeat * PondMass); + this->PastBulkTemperature + Constant::rSecsInHour * state.dataHVACGlobal->TimeStepSys * FluxStarStar / (SpecificHeat * PondMass); - this->PondTemp = this->PastBulkTemperature + Constant::SecInHour * state.dataHVACGlobal->TimeStepSys * + this->PondTemp = this->PastBulkTemperature + Constant::rSecsInHour * state.dataHVACGlobal->TimeStepSys * (Flux + 2.0 * FluxStar + 2.0 * FluxStarStar + this->CalcTotalFLux(state, PondTempStarStarStar)) / (6.0 * SpecificHeat * PondMass); } @@ -571,11 +569,7 @@ Real64 PondGroundHeatExchangerData::CalcTotalFLux(EnergyPlusData &state, Real64 Real64 FluxSolAbsorbed = CalcSolarFlux(state); // specific heat from fluid prop routines - Real64 SpecHeat = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - max(this->InletTemp, 0.0), - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 SpecHeat = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, max(this->InletTemp, 0.0), RoutineName); // heat transfer with fluid - heat exchanger analogy. // convective flux @@ -713,21 +707,9 @@ Real64 PondGroundHeatExchangerData::CalcEffectiveness(EnergyPlusData &state, // evaluate properties at pipe fluid temperature for given pipe fluid - Real64 SpecificHeat = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - InsideTemperature, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); - Real64 Conductivity = FluidProperties::GetConductivityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - InsideTemperature, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); - Real64 Viscosity = FluidProperties::GetViscosityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - InsideTemperature, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - CalledFrom); + Real64 SpecificHeat = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, InsideTemperature, CalledFrom); + Real64 Conductivity = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getConductivity(state, InsideTemperature, CalledFrom); + Real64 Viscosity = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getViscosity(state, InsideTemperature, CalledFrom); // Calculate the Reynold's number from RE=(4*Mdot)/(Pi*Mu*Diameter) Real64 ReynoldsNum = 4.0 * massFlowRate / (Constant::Pi * Viscosity * this->TubeInDiameter * this->NumCircuits); @@ -747,20 +729,19 @@ Real64 PondGroundHeatExchangerData::CalcEffectiveness(EnergyPlusData &state, Real64 ConvCoefIn = Conductivity * NusseltNum / this->TubeInDiameter; // now find properties of pond water - always assume pond fluid is water - Real64 WaterSpecHeat = FluidProperties::GetSpecificHeatGlycol(state, fluidNameWater, max(PondTemperature, 0.0), this->WaterIndex, CalledFrom); - Real64 WaterConductivity = FluidProperties::GetConductivityGlycol(state, fluidNameWater, max(PondTemperature, 0.0), this->WaterIndex, CalledFrom); - Real64 WaterViscosity = FluidProperties::GetViscosityGlycol(state, fluidNameWater, max(PondTemperature, 0.0), this->WaterIndex, CalledFrom); - Real64 WaterDensity = FluidProperties::GetDensityGlycol(state, fluidNameWater, max(PondTemperature, 0.0), this->WaterIndex, CalledFrom); + Real64 WaterSpecHeat = this->water->getSpecificHeat(state, max(PondTemperature, 0.0), CalledFrom); + Real64 WaterConductivity = this->water->getConductivity(state, max(PondTemperature, 0.0), CalledFrom); + Real64 WaterViscosity = this->water->getViscosity(state, max(PondTemperature, 0.0), CalledFrom); + Real64 WaterDensity = this->water->getDensity(state, max(PondTemperature, 0.0), CalledFrom); // derived properties for natural convection coefficient // expansion coef (Beta) = -1/Rho. dRho/dT // The following code includes some slight modifications from Simon's original code. // It guarantees that the delta T is 10C and also avoids the problems associated with // water hitting a maximum density at around 4C. (RKS) - Real64 ExpansionCoef = - -(FluidProperties::GetDensityGlycol(state, fluidNameWater, max(PondTemperature, 10.0) + 5.0, this->WaterIndex, CalledFrom) - - FluidProperties::GetDensityGlycol(state, fluidNameWater, max(PondTemperature, 10.0) - 5.0, this->WaterIndex, CalledFrom)) / - (10.0 * WaterDensity); + Real64 ExpansionCoef = -(this->water->getDensity(state, max(PondTemperature, 10.0) + 5.0, CalledFrom) - + this->water->getDensity(state, max(PondTemperature, 10.0) - 5.0, CalledFrom)) / + (10.0 * WaterDensity); Real64 ThermDiff = WaterConductivity / (WaterDensity * WaterSpecHeat); PrantlNum = WaterViscosity * WaterSpecHeat / WaterConductivity; @@ -813,7 +794,7 @@ Real64 PondGroundHeatExchangerData::CalcEffectiveness(EnergyPlusData &state, _, "[C]", "[C]"); - if (this->ConsecutiveFrozen >= state.dataGlobal->NumOfTimeStepInHour * 30) { + if (this->ConsecutiveFrozen >= state.dataGlobal->TimeStepsInHour * 30) { ShowFatalError(state, format("GroundHeatExchanger:Pond=\"{}\" has been frozen for 30 consecutive hours. Program terminates.", this->Name)); } @@ -842,11 +823,7 @@ void PondGroundHeatExchangerData::UpdatePondGroundHeatExchanger(EnergyPlusData & // Calculate the water side outlet conditions and set the // appropriate conditions on the correct HVAC node. - Real64 CpFluid = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->InletTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpFluid = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, this->InletTemp, RoutineName); PlantUtilities::SafeCopyPlantNode(state, InletNodeNum, OutletNodeNum); @@ -898,16 +875,8 @@ void PondGroundHeatExchangerData::oneTimeInit(EnergyPlusData &state) if (errFlag) { ShowFatalError(state, "InitPondGroundHeatExchanger: Program terminated due to previous condition(s)."); } - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - DataPrecisionGlobals::constant_zero, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - DataPrecisionGlobals::constant_zero, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, 0.0, RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, 0.0, RoutineName); this->DesignMassFlowRate = Constant::Pi / 4.0 * pow_2(this->TubeInDiameter) * DesignVelocity * rho * this->NumCircuits; this->DesignCapacity = this->DesignMassFlowRate * Cp * 10.0; // assume 10C delta T? PlantUtilities::InitComponentNodes(state, 0.0, this->DesignMassFlowRate, this->InletNodeNum, this->OutletNodeNum); diff --git a/src/EnergyPlus/PondGroundHeatExchanger.hh b/src/EnergyPlus/PondGroundHeatExchanger.hh index c58af1868da..c19368151e0 100644 --- a/src/EnergyPlus/PondGroundHeatExchanger.hh +++ b/src/EnergyPlus/PondGroundHeatExchanger.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -55,6 +55,7 @@ #include #include #include +#include #include #include @@ -102,7 +103,7 @@ namespace PondGroundHeatExchanger { bool MyFlag; bool setupOutputVarsFlag; - int WaterIndex; + Fluid::GlycolProps *water = nullptr; bool firstTimeThrough; @@ -111,8 +112,7 @@ namespace PondGroundHeatExchanger { : DesignMassFlowRate(0.0), DesignCapacity(0.0), Depth(0.0), Area(0.0), TubeInDiameter(0.0), TubeOutDiameter(0.0), TubeConductivity(0.0), GrndConductivity(0.0), CircuitLength(0.0), BulkTemperature(0.0), PastBulkTemperature(0.0), NumCircuits(0), InletNodeNum(0), OutletNodeNum(0), FrozenErrIndex(0), ConsecutiveFrozen(0), plantLoc{}, InletTemp(0.0), OutletTemp(0.0), MassFlowRate(0.0), - PondTemp(0.0), HeatTransferRate(0.0), Energy(0.0), OneTimeFlag(true), MyFlag(true), setupOutputVarsFlag(true), WaterIndex(0), - firstTimeThrough(true) + PondTemp(0.0), HeatTransferRate(0.0), Energy(0.0), OneTimeFlag(true), MyFlag(true), setupOutputVarsFlag(true), firstTimeThrough(true) { } @@ -159,6 +159,10 @@ struct PondGroundHeatExchangerData : BaseGlobalStruct int NumOfPondGHEs = 0; Array1D PondGHE; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/PoweredInductionUnits.cc b/src/EnergyPlus/PoweredInductionUnits.cc index 07523f92033..2a2032b721f 100644 --- a/src/EnergyPlus/PoweredInductionUnits.cc +++ b/src/EnergyPlus/PoweredInductionUnits.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -112,14 +112,10 @@ using HVAC::SmallAirVolFlow; using HVAC::SmallLoad; using HVAC::SmallMassFlow; using HVAC::SmallTempDiff; -using namespace ScheduleManager; using Psychrometrics::PsyCpAirFnW; using Psychrometrics::PsyHFnTdbW; using SteamCoils::SimulateSteamCoilComponents; -constexpr const char *fluidNameSteam("STEAM"); -constexpr const char *fluidNameWater("WATER"); - void SimPIU(EnergyPlusData &state, std::string_view CompName, // name of the PIU bool const FirstHVACIteration, // TRUE if first HVAC iteration in time step @@ -263,7 +259,7 @@ void GetPIUs(EnergyPlusData &state) state.dataPowerInductionUnits->PiuUniqueNames.reserve(static_cast(state.dataPowerInductionUnits->NumPIUs)); state.dataPowerInductionUnits->CheckEquipName.dimension(state.dataPowerInductionUnits->NumPIUs, true); - int PIUNum{0}; + int PIUNum = 0; auto &ip = state.dataInputProcessing->inputProcessor; // loop over Series PIUs; get and load the input data for (const std::string cCurrentModuleObject : {"AirTerminal:SingleDuct:SeriesPIU:Reheat", "AirTerminal:SingleDuct:ParallelPIU:Reheat"}) { @@ -275,6 +271,8 @@ void GetPIUs(EnergyPlusData &state) ++PIUNum; auto const &fields = instance.value(); + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, instance.key()}; + GlobalNames::VerifyUniqueInterObjectName( state, state.dataPowerInductionUnits->PiuUniqueNames, Util::makeUPPER(instance.key()), cCurrentModuleObject, "Name", ErrorsFound); auto &thisPIU = state.dataPowerInductionUnits->PIU(PIUNum); @@ -286,19 +284,16 @@ void GetPIUs(EnergyPlusData &state) } else if (cCurrentModuleObject == "AirTerminal:SingleDuct:ParallelPIU:Reheat") { thisPIU.UnitType_Num = DataDefineEquip::ZnAirLoopEquipType::SingleDuct_ParallelPIU_Reheat; } - thisPIU.Sched = ip->getAlphaFieldValue(fields, objectSchemaProps, "availability_schedule_name"); - if (!thisPIU.Sched.empty()) { - thisPIU.SchedPtr = ScheduleManager::GetScheduleIndex(state, thisPIU.Sched); - if (thisPIU.SchedPtr == 0) { - ShowWarningError( - state, - format("GetPIUs {}=\"{}\", invalid Availability Schedule Name = {}", cCurrentModuleObject, thisPIU.Name, thisPIU.Sched)); - ShowContinueError(state, "Set the default as Always On. Simulation continues."); - thisPIU.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } - } else { - thisPIU.SchedPtr = ScheduleManager::ScheduleAlwaysOn; + + std::string schedName = ip->getAlphaFieldValue(fields, objectSchemaProps, "availability_schedule_name"); + if (schedName.empty()) { + thisPIU.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((thisPIU.availSched = Sched::GetSchedule(state, Util::makeUPPER(schedName))) == nullptr) { + ShowWarningItemNotFound( + state, eoh, "Availability Schedule Name", schedName, "Set the default as Always On. Simulation continues."); + thisPIU.availSched = Sched::GetScheduleAlwaysOn(state); } + if (cCurrentModuleObject == "AirTerminal:SingleDuct:SeriesPIU:Reheat") { thisPIU.MaxTotAirVolFlow = ip->getRealFieldValue(fields, objectSchemaProps, "maximum_air_flow_rate"); } @@ -323,8 +318,8 @@ void GetPIUs(EnergyPlusData &state) } case HtgCoilType::SteamAirHeating: { thisPIU.HCoil_PlantType = DataPlant::PlantEquipmentType::CoilSteamAirHeating; - thisPIU.HCoil_FluidIndex = FluidProperties::GetRefrigNum(state, "STEAM"); - if (thisPIU.HCoil_FluidIndex == 0) { + thisPIU.HCoil_fluid = Fluid::GetSteam(state); + if (thisPIU.HCoil_fluid == nullptr) { ShowSevereError(state, format("{} Steam Properties for {} not found.", RoutineName, thisPIU.Name)); if (SteamMessageNeeded) { ShowContinueError(state, "Steam Fluid Properties should have been included in the input file."); @@ -407,7 +402,6 @@ void GetPIUs(EnergyPlusData &state) // find fan type // test if Fan:SystemModel fan of this name exists - ErrorObjectHeader eoh{routineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(8)}; if ((thisPIU.Fan_Index = Fans::GetFanIndex(state, thisPIU.FanName)) == 0) { ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(8), thisPIU.FanName); ErrorsFound = true; @@ -415,7 +409,7 @@ void GetPIUs(EnergyPlusData &state) // Assert that this is a constant volume fan? auto *fan = state.dataFans->fans(thisPIU.Fan_Index); thisPIU.fanType = fan->type; - thisPIU.FanAvailSchedPtr = fan->availSchedNum; + thisPIU.fanAvailSched = fan->availSched; } thisPIU.HCoil = ip->getAlphaFieldValue(fields, objectSchemaProps, "reheat_coil_name"); @@ -556,8 +550,8 @@ void GetPIUs(EnergyPlusData &state) ShowFatalError(state, format("{} Errors found in getting input. Preceding conditions cause termination.", RoutineName)); } - for (int PIUNum = 1; PIUNum <= state.dataPowerInductionUnits->NumPIUs; ++PIUNum) { - auto &thisPIU = state.dataPowerInductionUnits->PIU(PIUNum); + for (int PIURpt = 1; PIURpt <= state.dataPowerInductionUnits->NumPIUs; ++PIURpt) { + auto &thisPIU = state.dataPowerInductionUnits->PIU(PIURpt); // Setup Report variables for the PIUs SetupOutputVariable(state, @@ -608,35 +602,35 @@ void GetPIUs(EnergyPlusData &state) thisPIU.TotMassFlowRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataPowerInductionUnits->PIU(PIUNum).Name); + state.dataPowerInductionUnits->PIU(PIURpt).Name); SetupOutputVariable(state, "Zone Air Terminal Primary Air Mass Flow Rate", Constant::Units::kg_s, thisPIU.PriMassFlowRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataPowerInductionUnits->PIU(PIUNum).Name); + state.dataPowerInductionUnits->PIU(PIURpt).Name); SetupOutputVariable(state, "Zone Air Terminal Secondary Air Mass Flow Rate", Constant::Units::kg_s, thisPIU.SecMassFlowRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataPowerInductionUnits->PIU(PIUNum).Name); + state.dataPowerInductionUnits->PIU(PIURpt).Name); SetupOutputVariable(state, "Zone Air Terminal Outlet Discharge Air Temperature", Constant::Units::C, thisPIU.DischargeAirTemp, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataPowerInductionUnits->PIU(PIUNum).Name); + state.dataPowerInductionUnits->PIU(PIURpt).Name); SetupOutputVariable(state, "Zone Air Terminal Current Operation Control Stage", Constant::Units::unknown, thisPIU.CurOperationControlStage, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataPowerInductionUnits->PIU(PIUNum).Name); + state.dataPowerInductionUnits->PIU(PIURpt).Name); } } @@ -723,11 +717,7 @@ void InitPIU(EnergyPlusData &state, if (thisPIU.HotControlNode > 0) { // plant upgrade note? why no separate handling of steam coil? add it ? // local plant fluid density - Real64 const rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(thisPIU.HWplantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(thisPIU.HWplantLoc.loopNum).FluidIndex, - RoutineName); + Real64 const rho = state.dataPlnt->PlantLoop(thisPIU.HWplantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); thisPIU.MaxHotWaterFlow = rho * thisPIU.MaxVolHotWaterFlow; thisPIU.MinHotWaterFlow = rho * thisPIU.MinVolHotWaterFlow; @@ -797,7 +787,7 @@ void InitPIU(EnergyPlusData &state, // Do the start of HVAC time step initializations if (FirstHVACIteration) { // check for upstream zero flow. If nonzero and schedule ON, set primary flow to max - if (GetCurrentScheduleValue(state, thisPIU.SchedPtr) > 0.0 && state.dataLoopNodes->Node(PriNode).MassFlowRate > 0.0) { + if (thisPIU.availSched->getCurrentVal() > 0.0 && state.dataLoopNodes->Node(PriNode).MassFlowRate > 0.0) { if (thisPIU.UnitType == "AirTerminal:SingleDuct:SeriesPIU:Reheat") { state.dataLoopNodes->Node(PriNode).MassFlowRate = thisPIU.MaxPriAirMassFlow; state.dataLoopNodes->Node(SecNode).MassFlowRate = max(0.0, thisPIU.MaxTotAirMassFlow - thisPIU.MaxPriAirMassFlow); @@ -810,7 +800,7 @@ void InitPIU(EnergyPlusData &state, state.dataLoopNodes->Node(SecNode).MassFlowRate = 0.0; } // reset the max and min avail flows - if (GetCurrentScheduleValue(state, thisPIU.SchedPtr) > 0.0 && state.dataLoopNodes->Node(PriNode).MassFlowRateMaxAvail > 0.0) { + if (thisPIU.availSched->getCurrentVal() > 0.0 && state.dataLoopNodes->Node(PriNode).MassFlowRateMaxAvail > 0.0) { if (thisPIU.UnitType == "AirTerminal:SingleDuct:SeriesPIU:Reheat") { state.dataLoopNodes->Node(PriNode).MassFlowRateMaxAvail = thisPIU.MaxPriAirMassFlow; state.dataLoopNodes->Node(PriNode).MassFlowRateMinAvail = thisPIU.MinPriAirMassFlow; @@ -853,8 +843,6 @@ void SizePIU(EnergyPlusData &state, int const PIUNum) // Using/Aliasing using namespace DataSizing; - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSpecificHeatGlycol; using SteamCoils::GetCoilSteamInletNode; using SteamCoils::GetCoilSteamOutletNode; using WaterCoils::GetCoilWaterInletNode; @@ -1210,16 +1198,10 @@ void SizePIU(EnergyPlusData &state, int const PIUNum) Real64 const DesMassFlow = state.dataEnvrn->StdRhoAir * TermUnitSizing(CurTermUnitSizingNum).AirVolFlow; DesCoilLoad = PsyCpAirFnW(CoilOutHumRat) * DesMassFlow * (CoilOutTemp - CoilInTemp); - Real64 const rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(thisPIU.HWplantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(thisPIU.HWplantLoc.loopNum).FluidIndex, - RoutineName); - Real64 const Cp = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(thisPIU.HWplantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(thisPIU.HWplantLoc.loopNum).FluidIndex, - RoutineName); + Real64 const rho = state.dataPlnt->PlantLoop(thisPIU.HWplantLoc.loopNum) + .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); + Real64 const Cp = state.dataPlnt->PlantLoop(thisPIU.HWplantLoc.loopNum) + .glycol->getSpecificHeat(state, Constant::HWInitConvTemp, RoutineName); MaxVolHotWaterFlowDes = DesCoilLoad / (state.dataSize->PlantSizData(PltSizHeatNum).DeltaT * Cp * rho); } else { @@ -1230,8 +1212,6 @@ void SizePIU(EnergyPlusData &state, int const PIUNum) ShowContinueError(state, format("Occurs in{} Object={}", thisPIU.UnitType, thisPIU.Name)); ErrorsFound = true; } - } - if (IsAutoSize) { thisPIU.MaxVolHotWaterFlow = MaxVolHotWaterFlowDes; BaseSizer::reportSizerOutput( state, thisPIU.UnitType, thisPIU.Name, "Design Size Maximum Reheat Water Flow Rate [m3/s]", MaxVolHotWaterFlowDes); @@ -1307,16 +1287,12 @@ void SizePIU(EnergyPlusData &state, int const PIUNum) Real64 const DesMassFlow = state.dataEnvrn->StdRhoAir * TermUnitSizing(CurTermUnitSizingNum).AirVolFlow; DesCoilLoad = PsyCpAirFnW(CoilOutHumRat) * DesMassFlow * (CoilOutTemp - CoilInTemp); Real64 constexpr TempSteamIn = 100.00; - Real64 const EnthSteamInDry = - FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, TempSteamIn, 1.0, thisPIU.HCoil_FluidIndex, RoutineName); - Real64 const EnthSteamOutWet = - FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, TempSteamIn, 0.0, thisPIU.HCoil_FluidIndex, RoutineName); + Real64 const EnthSteamInDry = thisPIU.HCoil_fluid->getSatEnthalpy(state, TempSteamIn, 1.0, RoutineName); + Real64 const EnthSteamOutWet = thisPIU.HCoil_fluid->getSatEnthalpy(state, TempSteamIn, 0.0, RoutineName); Real64 const LatentHeatSteam = EnthSteamInDry - EnthSteamOutWet; - Real64 const SteamDensity = - FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, thisPIU.HCoil_FluidIndex, RoutineName); - int DummyWaterIndex = 1; - Real64 const Cp = GetSpecificHeatGlycol( - state, fluidNameWater, state.dataSize->PlantSizData(PltSizHeatNum).ExitTemp, DummyWaterIndex, RoutineName); + Real64 const SteamDensity = thisPIU.HCoil_fluid->getSatDensity(state, TempSteamIn, 1.0, RoutineName); + Real64 const Cp = + Fluid::GetWater(state)->getSpecificHeat(state, state.dataSize->PlantSizData(PltSizHeatNum).ExitTemp, RoutineName); MaxVolHotSteamFlowDes = DesCoilLoad / (SteamDensity * (LatentHeatSteam + state.dataSize->PlantSizData(PltSizHeatNum).DeltaT * Cp)); } else { @@ -1327,8 +1303,6 @@ void SizePIU(EnergyPlusData &state, int const PIUNum) ShowContinueError(state, format("Occurs in{} Object={}", thisPIU.UnitType, thisPIU.Name)); ErrorsFound = true; } - } - if (IsAutoSize) { thisPIU.MaxVolHotSteamFlow = MaxVolHotSteamFlowDes; BaseSizer::reportSizerOutput( state, thisPIU.UnitType, thisPIU.Name, "Design Size Maximum Reheat Steam Flow [m3/s]", MaxVolHotSteamFlowDes); @@ -1420,8 +1394,6 @@ void CalcSeriesPIU(EnergyPlusData &state, // Using/Aliasing using namespace DataZoneEnergyDemands; - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSpecificHeatGlycol; using HeatingCoils::SimulateHeatingCoilComponents; using MixerComponent::SimAirMixer; using PlantUtilities::SetComponentFlowRate; @@ -1476,10 +1448,10 @@ void CalcSeriesPIU(EnergyPlusData &state, MinWaterFlow = state.dataLoopNodes->Node(thisPIU.HotControlNode).MassFlowRateMinAvail; } } - if (GetCurrentScheduleValue(state, thisPIU.SchedPtr) <= 0.0) { + if (thisPIU.availSched->getCurrentVal() <= 0.0) { UnitOn = false; } - if ((GetCurrentScheduleValue(state, thisPIU.FanAvailSchedPtr) <= 0.0 || state.dataHVACGlobal->TurnFansOff) && !state.dataHVACGlobal->TurnFansOn) { + if ((thisPIU.fanAvailSched->getCurrentVal() <= 0.0 || state.dataHVACGlobal->TurnFansOff) && !state.dataHVACGlobal->TurnFansOn) { UnitOn = false; } if (thisPIU.PriAirMassFlow <= SmallMassFlow || PriAirMassFlowMax <= SmallMassFlow) { @@ -1609,7 +1581,7 @@ void CalcSeriesPIU(EnergyPlusData &state, (state.dataLoopNodes->Node(thisPIU.HCoilInAirNode).Temp - state.dataLoopNodes->Node(ZoneNode).Temp); // check if heating coil is off - if (((!UnitOn) || (QActualHeating < SmallLoad) || (state.dataHeatBalFanSys->TempControlType(ZoneNum) == HVAC::ThermostatType::SingleCooling) || + if (((!UnitOn) || (QActualHeating < SmallLoad) || (state.dataHeatBalFanSys->TempControlType(ZoneNum) == HVAC::SetptType::SingleCool) || (thisPIU.PriAirMassFlow > PriAirMassFlowMin)) && (thisPIU.heatingOperatingMode != HeatOpModeType::StagedHeatFirstStage)) { // reheat is off during the first stage of heating thisPIU.heatingOperatingMode = HeatOpModeType::HeaterOff; @@ -1802,7 +1774,7 @@ void CalcParallelPIU(EnergyPlusData &state, MinWaterFlow = state.dataLoopNodes->Node(thisPIU.HotControlNode).MassFlowRateMinAvail; } } - if (GetCurrentScheduleValue(state, thisPIU.SchedPtr) <= 0.0) { + if (thisPIU.availSched->getCurrentVal() <= 0.0) { UnitOn = false; } if (thisPIU.PriAirMassFlow <= SmallMassFlow || PriAirMassFlowMax <= SmallMassFlow) { @@ -1959,7 +1931,7 @@ void CalcParallelPIU(EnergyPlusData &state, (state.dataLoopNodes->Node(thisPIU.HCoilInAirNode).Temp - state.dataLoopNodes->Node(ZoneNode).Temp); // check if heating coil is off - if (((!UnitOn) || (QActualHeating < SmallLoad) || (state.dataHeatBalFanSys->TempControlType(ZoneNum) == HVAC::ThermostatType::SingleCooling) || + if (((!UnitOn) || (QActualHeating < SmallLoad) || (state.dataHeatBalFanSys->TempControlType(ZoneNum) == HVAC::SetptType::SingleCool) || (thisPIU.PriAirMassFlow > PriAirMassFlowMin)) && (thisPIU.heatingOperatingMode != HeatOpModeType::StagedHeatFirstStage)) { // reheat is off during the first stage of heating thisPIU.heatingOperatingMode = HeatOpModeType::HeaterOff; @@ -2076,18 +2048,18 @@ void CalcParallelPIU(EnergyPlusData &state, void ReportCurOperatingControlStage(EnergyPlusData &state, int const piuNum, bool const unitOn, HeatOpModeType heaterMode, CoolOpModeType coolingMode) { - int undetermined(-1); - int off(0); - int constantVolumeCooling(1); - int constantVolumeHeating(2); - int deadband(3); - int variableSpeedFirstStageCooling(4); - int variableSpeedSecondStageCooling(5); - int variableSpeedStagedHeatFirstStageHeating(6); - int variableSpeedStagedHeatSecondStageHeating(7); - int variableSpeedModulatedHeatFirstStageHeating(8); - int variableSpeedModulatedHeatSecondStageHeating(9); - int variableSpeedModulatedHeatThirdStageHeating(10); + int constexpr undetermined = -1; + int constexpr off = 0; + int constexpr constantVolumeCooling = 1; + int constexpr constantVolumeHeating = 2; + int constexpr deadband = 3; + int constexpr variableSpeedFirstStageCooling = 4; + int constexpr variableSpeedSecondStageCooling = 5; + int constexpr variableSpeedStagedHeatFirstStageHeating = 6; + int constexpr variableSpeedStagedHeatSecondStageHeating = 7; + int constexpr variableSpeedModulatedHeatFirstStageHeating = 8; + int constexpr variableSpeedModulatedHeatSecondStageHeating = 9; + int constexpr variableSpeedModulatedHeatThirdStageHeating = 10; state.dataPowerInductionUnits->PIU(piuNum).CurOperationControlStage = undetermined; @@ -2137,7 +2109,7 @@ void CalcVariableSpeedPIUCoolingBehavior(EnergyPlusData &state, Real64 const zoneLoad, Real64 const loadToHeatSetPt, Real64 const priAirMassFlowMin, - Real64 const priAirMassFlowMax) + [[maybe_unused]] Real64 const priAirMassFlowMax) { auto &thisPIU = state.dataPowerInductionUnits->PIU(piuNum); thisPIU.coolingOperatingMode = CoolOpModeType::CoolerOff; @@ -2166,13 +2138,13 @@ void CalcVariableSpeedPIUCoolingBehavior(EnergyPlusData &state, } else { // check how much cooling provided at max fan and primary air state.dataLoopNodes->Node(thisPIU.PriAirInNode).MassFlowRate = thisPIU.MaxPriAirMassFlow; - Real64 TotAirMassFlow = thisPIU.MaxTotAirMassFlow; + TotAirMassFlow = thisPIU.MaxTotAirMassFlow; state.dataLoopNodes->Node(thisPIU.SecAirInNode).MassFlowRate = max(0.0, TotAirMassFlow - thisPIU.MaxPriAirMassFlow); Real64 qdotDelivMaxFan = CalcVariableSpeedPIUQdotDelivered(state, piuNum, zoneNode, false, TotAirMassFlow, 1.0); if (zoneLoad <= qdotDelivMaxFan) { // not going to make it just run at max thisPIU.PriAirMassFlow = thisPIU.PriAirMassFlow; - Real64 TotAirMassFlow = thisPIU.MaxTotAirMassFlow; + TotAirMassFlow = thisPIU.MaxTotAirMassFlow; thisPIU.SecAirMassFlow = max(0.0, TotAirMassFlow - thisPIU.PriAirMassFlow); thisPIU.heatingOperatingMode = HeatOpModeType::HeaterOff; thisPIU.coolingOperatingMode = CoolOpModeType::CoolSecondStage; @@ -2200,7 +2172,7 @@ void CalcVariableSpeedPIUCoolingBehavior(EnergyPlusData &state, ShowFatalError(state, format("Series PIU control failed for {}:{}", thisPIU.UnitType, thisPIU.Name)); } else { thisPIU.PriAirMassFlow = coolSignal * (thisPIU.MaxPriAirMassFlow - thisPIU.MinPriAirMassFlow) + thisPIU.MinPriAirMassFlow; - Real64 TotAirMassFlow = coolSignal * (thisPIU.MaxTotAirMassFlow - thisPIU.MinTotAirMassFlow) + thisPIU.MinTotAirMassFlow; + TotAirMassFlow = coolSignal * (thisPIU.MaxTotAirMassFlow - thisPIU.MinTotAirMassFlow) + thisPIU.MinTotAirMassFlow; thisPIU.SecAirMassFlow = max(0.0, TotAirMassFlow - thisPIU.PriAirMassFlow); thisPIU.heatingOperatingMode = HeatOpModeType::HeaterOff; thisPIU.coolingOperatingMode = CoolOpModeType::CoolFirstStage; diff --git a/src/EnergyPlus/PoweredInductionUnits.hh b/src/EnergyPlus/PoweredInductionUnits.hh index 4f08c45596a..e55ca16e944 100644 --- a/src/EnergyPlus/PoweredInductionUnits.hh +++ b/src/EnergyPlus/PoweredInductionUnits.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -56,6 +56,7 @@ #include #include #include +#include #include #include @@ -130,8 +131,7 @@ namespace PoweredInductionUnits { std::string Name; // name of unit std::string UnitType; // type of unit DataDefineEquip::ZnAirLoopEquipType UnitType_Num; // index for type of unit - std::string Sched; // availability schedule - int SchedPtr; // index to schedule + Sched::Schedule *availSched = nullptr; // availability schedule Real64 MaxTotAirVolFlow; // m3/s (series) Real64 MaxTotAirMassFlow; // kg/s (series) Real64 MaxPriAirVolFlow; // m3/s @@ -149,17 +149,17 @@ namespace PoweredInductionUnits { int HCoilInAirNode; // unit mixed air node number int ControlCompTypeNum; int CompErrIndex; - std::string MixerName; // name of air mixer component - int Mixer_Num; // index for type of mixer - std::string FanName; // name of fan component - HVAC::FanType fanType; // index for fan type - int Fan_Index; // store index for this fan - int FanAvailSchedPtr; // index to fan availability schedule - HtgCoilType HCoilType; // index for heating coil type + std::string MixerName; // name of air mixer component + int Mixer_Num; // index for type of mixer + std::string FanName; // name of fan component + HVAC::FanType fanType; // index for fan type + int Fan_Index; // store index for this fan + Sched::Schedule *fanAvailSched = nullptr; // fan availability schedule + HtgCoilType HCoilType; // index for heating coil type DataPlant::PlantEquipmentType HCoil_PlantType; std::string HCoil; // name of heating coil component int HCoil_Index; // index to this heating coil - int HCoil_FluidIndex; + Fluid::RefrigProps *HCoil_fluid = nullptr; Real64 MaxVolHotWaterFlow; // m3/s Real64 MaxVolHotSteamFlow; // m3/s Real64 MaxHotWaterFlow; // kg/s @@ -207,15 +207,15 @@ namespace PoweredInductionUnits { int plenumIndex = 0; // Default Constructor PowIndUnitData() - : UnitType_Num(DataDefineEquip::ZnAirLoopEquipType::Invalid), SchedPtr(0), MaxTotAirVolFlow(0.0), MaxTotAirMassFlow(0.0), - MaxPriAirVolFlow(0.0), MaxPriAirMassFlow(0.0), MinPriAirFlowFrac(0.0), MinPriAirMassFlow(0.0), PriDamperPosition(0.0), - MaxSecAirVolFlow(0.0), MaxSecAirMassFlow(0.0), FanOnFlowFrac(0.0), FanOnAirMassFlow(0.0), PriAirInNode(0), SecAirInNode(0), - OutAirNode(0), HCoilInAirNode(0), ControlCompTypeNum(0), CompErrIndex(0), Mixer_Num(0), fanType(HVAC::FanType::Invalid), Fan_Index(0), - FanAvailSchedPtr(0), HCoilType(HtgCoilType::Invalid), HCoil_PlantType(DataPlant::PlantEquipmentType::Invalid), HCoil_Index(0), - HCoil_FluidIndex(0), MaxVolHotWaterFlow(0.0), MaxVolHotSteamFlow(0.0), MaxHotWaterFlow(0.0), MaxHotSteamFlow(0.0), - MinVolHotWaterFlow(0.0), MinHotSteamFlow(0.0), MinVolHotSteamFlow(0.0), MinHotWaterFlow(0.0), HotControlNode(0), HotCoilOutNodeNum(0), - HotControlOffset(0.0), HWplantLoc{}, ADUNum(0), InducesPlenumAir(false), HeatingRate(0.0), HeatingEnergy(0.0), SensCoolRate(0.0), - SensCoolEnergy(0.0), CtrlZoneNum(0), ctrlZoneInNodeIndex(0), AirLoopNum(0), OutdoorAirFlowRate(0.0) + : UnitType_Num(DataDefineEquip::ZnAirLoopEquipType::Invalid), MaxTotAirVolFlow(0.0), MaxTotAirMassFlow(0.0), MaxPriAirVolFlow(0.0), + MaxPriAirMassFlow(0.0), MinPriAirFlowFrac(0.0), MinPriAirMassFlow(0.0), PriDamperPosition(0.0), MaxSecAirVolFlow(0.0), + MaxSecAirMassFlow(0.0), FanOnFlowFrac(0.0), FanOnAirMassFlow(0.0), PriAirInNode(0), SecAirInNode(0), OutAirNode(0), HCoilInAirNode(0), + ControlCompTypeNum(0), CompErrIndex(0), Mixer_Num(0), fanType(HVAC::FanType::Invalid), Fan_Index(0), HCoilType(HtgCoilType::Invalid), + HCoil_PlantType(DataPlant::PlantEquipmentType::Invalid), HCoil_Index(0), MaxVolHotWaterFlow(0.0), MaxVolHotSteamFlow(0.0), + MaxHotWaterFlow(0.0), MaxHotSteamFlow(0.0), MinVolHotWaterFlow(0.0), MinHotSteamFlow(0.0), MinVolHotSteamFlow(0.0), + MinHotWaterFlow(0.0), HotControlNode(0), HotCoilOutNodeNum(0), HotControlOffset(0.0), HWplantLoc{}, ADUNum(0), InducesPlenumAir(false), + HeatingRate(0.0), HeatingEnergy(0.0), SensCoolRate(0.0), SensCoolEnergy(0.0), CtrlZoneNum(0), ctrlZoneInNodeIndex(0), AirLoopNum(0), + OutdoorAirFlowRate(0.0) { } @@ -321,6 +321,10 @@ struct PoweredInductionUnitsData : BaseGlobalStruct Array1D_bool MySizeFlag; Array1D_bool MyPlantScanFlag; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/PsychCacheData.hh b/src/EnergyPlus/PsychCacheData.hh index ffae5d320db..3dfd972fe8a 100644 --- a/src/EnergyPlus/PsychCacheData.hh +++ b/src/EnergyPlus/PsychCacheData.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -78,15 +78,15 @@ enum class PsychrometricFunction : int }; #ifdef EP_nocache_Psychrometrics -#undef EP_cache_PsyTwbFnTdbWPb -#undef EP_cache_PsyPsatFnTemp -#undef EP_cache_PsyTsatFnPb -#undef EP_cache_PsyTsatFnHPb +# undef EP_cache_PsyTwbFnTdbWPb +# undef EP_cache_PsyPsatFnTemp +# undef EP_cache_PsyTsatFnPb +# undef EP_cache_PsyTsatFnHPb #else -#define EP_cache_PsyTwbFnTdbWPb -#define EP_cache_PsyPsatFnTemp -#define EP_cache_PsyTsatFnPb -#define EP_cache_PsyTsatFnHPb +# define EP_cache_PsyTwbFnTdbWPb +# define EP_cache_PsyPsatFnTemp +# define EP_cache_PsyTsatFnPb +# define EP_cache_PsyTsatFnHPb #endif #ifdef EP_cache_PsyTwbFnTdbWPb @@ -181,6 +181,10 @@ struct PsychrometricCacheData : BaseGlobalStruct std::array(PsychrometricFunction::Num)> NumIterations; #endif + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/Psychrometrics.cc b/src/EnergyPlus/Psychrometrics.cc index b1698cc608d..76d718ee973 100644 --- a/src/EnergyPlus/Psychrometrics.cc +++ b/src/EnergyPlus/Psychrometrics.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -49,7 +49,7 @@ #include // ObjexxFCL Headers -#include +// #include // EnergyPlus Headers #include @@ -63,15 +63,15 @@ namespace EnergyPlus { #ifdef EP_nocache_Psychrometrics -#undef EP_cache_PsyTwbFnTdbWPb -#undef EP_cache_PsyPsatFnTemp -#undef EP_cache_PsyTsatFnPb -#undef EP_cache_PsyTsatFnHPb +# undef EP_cache_PsyTwbFnTdbWPb +# undef EP_cache_PsyPsatFnTemp +# undef EP_cache_PsyTsatFnPb +# undef EP_cache_PsyTsatFnHPb #else -#define EP_cache_PsyTwbFnTdbWPb -#define EP_cache_PsyPsatFnTemp -#define EP_cache_PsyTsatFnPb -#define EP_cache_PsyTsatFnHPb +# define EP_cache_PsyTwbFnTdbWPb +# define EP_cache_PsyPsatFnTemp +# define EP_cache_PsyTsatFnPb +# define EP_cache_PsyTsatFnHPb #endif namespace Psychrometrics { @@ -285,8 +285,6 @@ namespace Psychrometrics { // FUNCTION INFORMATION: // AUTHOR Linda Lawrie/Amir Roth // DATE WRITTEN August 2011 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Provide a "cache" of results for the given arguments and wetbulb (twb) output result. @@ -295,32 +293,12 @@ namespace Psychrometrics { // Use grid shifting and masking to provide hash into the cache. Use Equivalence to // make Fortran ignore "types". - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Return value - Real64 Twb_result; // result=> Temperature Wet-Bulb {C} - - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - // FUNCTION PARAMETER DEFINITIONS: std::uint64_t constexpr Grid_Shift = 64 - 12 - twbprecision_bits; - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - -#ifdef EP_psych_stats +# ifdef EP_psych_stats ++state.dataPsychCache->NumTimesCalled[static_cast(PsychrometricFunction::TwbFnTdbWPb_cache)]; -#endif +# endif DISABLE_WARNING_PUSH DISABLE_WARNING_STRICT_ALIASING @@ -359,11 +337,7 @@ namespace Psychrometrics { cached_Twb[hash].Twb = PsyTwbFnTdbWPb_raw(state, Tdb_tag_r, W_tag_r, Pb_tag_r, CalledFrom); } - // Twbresult_last = cached_Twb(hash)%Twb - // Twb_result = Twbresult_last - Twb_result = cached_Twb[hash].Twb; - - return Twb_result; + return cached_Twb[hash].Twb; } Real64 PsyTwbFnTdbWPb_raw(EnergyPlusData &state, @@ -420,14 +394,13 @@ namespace Psychrometrics { Real64 PSatstar; // Saturation pressure at wet bulb temperature int iter; // Iteration counter int icvg; // Iteration convergence flag - bool FlagError; // set when errors should be flagged #ifdef EP_psych_stats ++state.dataPsychCache->NumTimesCalled[static_cast(PsychrometricFunction::TwbFnTdbWPb)]; #endif // CHECK TDB IN RANGE. - FlagError = false; + bool FlagError = false; #ifdef EP_psych_errors if (TDB <= -100.0 || TDB >= 200.0) { if (!state.dataGlobal->WarmupFlag) { @@ -963,7 +936,7 @@ namespace Psychrometrics { if (H >= 0.0) { Hloc = max(0.00001, H); - } else if (H < 0.0) { + } else { Hloc = min(-0.00001, H); } @@ -1326,16 +1299,15 @@ namespace Psychrometrics { // na // FUNCTION LOCAL VARIABLE DECLARATIONS: - bool FlagError; // set when errors should be flagged - Real64 tSat; // Water temperature guess - int iter; // Iteration counter + Real64 tSat; // Water temperature guess + int iter; // Iteration counter #ifdef EP_psych_stats ++state.dataPsychCache->NumTimesCalled[static_cast(PsychrometricFunction::TsatFnPb)]; #endif // Check press in range. - FlagError = false; + bool FlagError = false; #ifdef EP_psych_errors if (!state.dataGlobal->WarmupFlag) { if (Press <= 0.0017 || Press >= 1555000.0) { @@ -1364,18 +1336,17 @@ namespace Psychrometrics { return state.dataPsychrometrics->tSat_Save; } state.dataPsychrometrics->Press_Save = Press; + iter = 0; if (state.dataPsychrometrics->useInterpolationPsychTsatFnPb) { int n_sample = 1651; // sample bin size = 64 Pa; continous sample size = 1651 // CSpline interpolation tSat = CSplineint(n_sample, Press); // Cubic spline interpolation - iter = 0; } else { // Uses an iterative process to determine the saturation temperature at a given // pressure by correlating saturated water vapor as a function of temperature. // Initial guess of boiling temperature tSat = 100.0; - iter = 0; // If above 1555000,set value of Temp corresponding to Saturation Pressure of 1555000 Pascal. if (Press >= 1555000.0) { diff --git a/src/EnergyPlus/Psychrometrics.hh b/src/EnergyPlus/Psychrometrics.hh index b3ebe4d2cb1..f67a9abe86f 100644 --- a/src/EnergyPlus/Psychrometrics.hh +++ b/src/EnergyPlus/Psychrometrics.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -54,7 +54,7 @@ // ObjexxFCL Headers #include -#include +// #include // EnergyPlus Headers #include @@ -70,15 +70,15 @@ namespace EnergyPlus { struct EnergyPlusData; #ifdef EP_nocache_Psychrometrics -#undef EP_cache_PsyTwbFnTdbWPb -#undef EP_cache_PsyPsatFnTemp -#undef EP_cache_PsyTsatFnPb -#undef EP_cache_PsyTsatFnHPb +# undef EP_cache_PsyTwbFnTdbWPb +# undef EP_cache_PsyPsatFnTemp +# undef EP_cache_PsyTsatFnPb +# undef EP_cache_PsyTsatFnHPb #else -#define EP_cache_PsyTwbFnTdbWPb -#define EP_cache_PsyPsatFnTemp -#define EP_cache_PsyTsatFnPb -#define EP_cache_PsyTsatFnHPb +# define EP_cache_PsyTwbFnTdbWPb +# define EP_cache_PsyPsatFnTemp +# define EP_cache_PsyTsatFnPb +# define EP_cache_PsyTsatFnHPb #endif // Adapted from: https://www.fluentcpp.com/2019/08/30/how-to-disable-a-warning-in-cpp/ @@ -999,10 +999,10 @@ namespace Psychrometrics { // but the () and [] operator overloads for Array1D (which stores the cache) only uses 32bit lookups // this seems ... very bad. This problem will be fixed when we get rid of Array1D // at which time this warning disable should be removed. -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4244) -#endif +# ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable : 4244) +# endif inline Real64 PsyPsatFnTemp(EnergyPlusData &state, Real64 const T, // dry-bulb temperature {C} @@ -1026,9 +1026,9 @@ namespace Psychrometrics { // integer(i64), parameter :: Grid_Mask=NOT(ISHFT(1_i64, Grid_Shift)-1) std::uint64_t constexpr Grid_Shift = 64 - 12 - psatprecision_bits; -#ifdef EP_psych_stats +# ifdef EP_psych_stats ++state.dataPsychCache->NumTimesCalled[static_cast(PsychrometricFunction::PsatFnTemp_cache)]; -#endif +# endif DISABLE_WARNING_PUSH DISABLE_WARNING_STRICT_ALIASING @@ -1086,9 +1086,9 @@ namespace Psychrometrics { // FUNCTION LOCAL VARIABLE DECLARATIONS: -#ifdef EP_psych_stats +# ifdef EP_psych_stats ++state.dataPsychCache->NumTimesCalled[static_cast(PsychrometricFunction::TwbFnTdbWPb_cache)]; -#endif +# endif DISABLE_WARNING_PUSH DISABLE_WARNING_STRICT_ALIASING // cppcheck-suppress invalidPointerCast @@ -1507,9 +1507,9 @@ namespace Psychrometrics { return cTsat.Tsat; // saturation temperature } -#ifdef _MSC_VER -#pragma warning(pop) -#endif +# ifdef _MSC_VER +# pragma warning(pop) +# endif #else Real64 PsyTsatFnPb(EnergyPlusData &state, @@ -1702,11 +1702,15 @@ struct PsychrometricsData : BaseGlobalStruct bool ReportErrors = true; bool useInterpolationPsychTsatFnPb = false; - void init_state(EnergyPlusData &state) override + void init_constant_state(EnergyPlusData &state) override { Psychrometrics::InitializePsychRoutines(state); } + void init_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void clear_state() override { iPsyErrIndex.fill(0); diff --git a/src/EnergyPlus/Pumps.cc b/src/EnergyPlus/Pumps.cc index b22f78716f8..5c46c43d2d7 100644 --- a/src/EnergyPlus/Pumps.cc +++ b/src/EnergyPlus/Pumps.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -51,7 +51,7 @@ // ObjexxFCL Headers #include -#include +// #include // EnergyPlus Headers #include @@ -107,9 +107,6 @@ using HVAC::SmallWaterVolFlow; static constexpr std::array(PumpType::Num)> pumpTypeIDFNames = { "Pump:VariableSpeed", "Pump:ConstantSpeed", "Pump:VariableSpeed:Condensate", "HeaderedPumps:VariableSpeed", "HeaderedPumps:ConstantSpeed"}; -static constexpr std::string_view fluidNameSteam("STEAM"); -static constexpr std::string_view fluidNameWater("WATER"); - void SimPumps(EnergyPlusData &state, std::string const &PumpName, // Name of pump to be managed int const LoopNum, // Plant loop number @@ -217,16 +214,13 @@ void GetPumpInput(EnergyPlusData &state) using Curve::GetCurveIndex; using Curve::GetCurveMinMaxValues; using DataSizing::AutoSize; - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSatDensityRefrig; using NodeInputManager::GetOnlySingleNode; - using ScheduleManager::CheckScheduleValueMinMax; - using ScheduleManager::GetScheduleIndex; // SUBROUTINE PARAMETER DEFINITIONS: Real64 constexpr StartTemp(100.0); // Standard Temperature across code to calculated Steam density static constexpr std::string_view RoutineName("GetPumpInput: "); - static constexpr std::string_view RoutineNameNoColon("GetPumpInput"); + static constexpr std::string_view routineName = "GetPumpInput"; + static constexpr std::array(PumpControlType::Num)> pumpCtrlTypeNamesUC{"CONTINUOUS", "INTERMITTENT"}; static constexpr std::array(ControlTypeVFD::Num)> controlTypeVFDNamesUC{"MANUALCONTROL", "PRESSURESETPOINTCONTROL"}; @@ -240,7 +234,6 @@ void GetPumpInput(EnergyPlusData &state) int IOStat; // IO Status when calling get input subroutine bool ErrorsFound; int TempCurveIndex; - std::string TempCurveType; int NumVarSpeedPumps = 0; int NumConstSpeedPumps = 0; int NumCondensatePumps = 0; @@ -290,6 +283,8 @@ void GetPumpInput(EnergyPlusData &state) thisInput->cAlphaFieldNames, thisInput->cNumericFieldNames); + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, thisInput->cAlphaArgs(1)}; + GlobalNames::VerifyUniqueInterObjectName( state, state.dataPumps->PumpUniqueNames, thisInput->cAlphaArgs(1), cCurrentModuleObject, thisInput->cAlphaFieldNames(1), ErrorsFound); thisPump.Name = thisInput->cAlphaArgs(1); @@ -327,14 +322,11 @@ void GetPumpInput(EnergyPlusData &state) thisPump.PumpControl = PumpControlType::Continuous; } - // Input the optional schedule for the pump - if (!thisInput->cAlphaArgs(5).empty()) { // Initialized to zero, don't get a schedule for an empty - thisPump.PumpScheduleIndex = GetScheduleIndex(state, thisInput->cAlphaArgs(5)); - if (thisPump.PumpScheduleIndex <= 0) { - ShowWarningError(state, - format("{}{}=\"{}\", Invalid {}", RoutineName, cCurrentModuleObject, thisPump.Name, thisInput->cAlphaFieldNames(5))); - ShowContinueError(state, format("Schedule named =[{}]. was not found and will not be used.", thisInput->cAlphaArgs(5))); - } + // Input the optional schedule for the pump, this is a flow modifier schedule so blank/missing means Always On. + if (thisInput->cAlphaArgs(5).empty()) { + thisPump.flowRateSched = nullptr; + } else if ((thisPump.flowRateSched = Sched::GetSchedule(state, thisInput->cAlphaArgs(5))) == nullptr) { + ShowWarningItemNotFound(state, eoh, thisInput->cAlphaFieldNames(5), thisInput->cAlphaArgs(5), ""); } thisPump.NomVolFlowRate = thisInput->rNumericArgs(1); @@ -406,53 +398,59 @@ void GetPumpInput(EnergyPlusData &state) thisPump.HasVFD = true; thisPump.VFD.VFDControlType = static_cast(getEnumValue(controlTypeVFDNamesUC, Util::makeUPPER(state.dataIPShortCut->cAlphaArgs(7)))); + switch (thisPump.VFD.VFDControlType) { + case ControlTypeVFD::VFDManual: { - thisPump.VFD.ManualRPMSchedIndex = GetScheduleIndex(state, thisInput->cAlphaArgs(8)); - if (thisPump.VFD.ManualRPMSchedIndex <= 0) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", At least one scheduled VFD schedule input was invalid.", RoutineName, cCurrentModuleObject, thisPump.Name)); - ShowContinueError(state, "Verify that all of the pressure and rpm schedules referenced in the input fields actually exist."); + if ((thisPump.VFD.manualRPMSched = Sched::GetSchedule(state, thisInput->cAlphaArgs(8))) == nullptr) { + ShowSevereItemNotFound(state, eoh, thisInput->cAlphaFieldNames(8), thisInput->cAlphaArgs(8)); ErrorsFound = true; - } else if (!CheckScheduleValueMinMax(state, thisPump.VFD.ManualRPMSchedIndex, false, 0.0) || - !CheckScheduleValueMinMax(state, thisPump.VFD.ManualRPMSchedIndex, false, 0.0)) { - ShowSevereError( - state, - format("{}{}=\"{}\", A pump rpm schedule had zero value. Ensure all entries in the schedule are greater than zero.", - RoutineName, - cCurrentModuleObject, - thisPump.Name)); + } else if (!thisPump.VFD.manualRPMSched->checkMinVal(state, Clusive::Ex, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, thisInput->cAlphaFieldNames(8), thisInput->cAlphaArgs(8), Clusive::Ex, 0.0); ErrorsFound = true; } } break; + case ControlTypeVFD::VFDAutomatic: { - thisPump.VFD.LowerPsetSchedIndex = GetScheduleIndex(state, thisInput->cAlphaArgs(9)); - thisPump.VFD.UpperPsetSchedIndex = GetScheduleIndex(state, thisInput->cAlphaArgs(10)); - thisPump.VFD.MinRPMSchedIndex = GetScheduleIndex(state, thisInput->cAlphaArgs(11)); - thisPump.VFD.MaxRPMSchedIndex = GetScheduleIndex(state, thisInput->cAlphaArgs(12)); - if (min(thisPump.VFD.LowerPsetSchedIndex, - thisPump.VFD.UpperPsetSchedIndex, - thisPump.VFD.MinRPMSchedIndex, - thisPump.VFD.MaxRPMSchedIndex) <= 0) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", At least one scheduled VFD schedule input was invalid.", RoutineName, cCurrentModuleObject, thisPump.Name)); - ShowContinueError(state, "Verify that all of the pressure and rpm schedules referenced in the input fields actually exist."); + if (thisInput->lAlphaFieldBlanks(9)) { + ShowSevereEmptyField(state, eoh, thisInput->cAlphaFieldNames(9)); ErrorsFound = true; - } else if (!CheckScheduleValueMinMax(state, thisPump.VFD.MinRPMSchedIndex, false, 0.0) || - !CheckScheduleValueMinMax(state, thisPump.VFD.MaxRPMSchedIndex, false, 0.0)) { - ShowSevereError( - state, - format("{}{}=\"{}\", A pump rpm schedule had zero value. Ensure all entries in the schedule are greater than zero.", - RoutineName, - cCurrentModuleObject, - thisPump.Name)); + } else if ((thisPump.VFD.lowerPsetSched = Sched::GetSchedule(state, thisInput->cAlphaArgs(9))) == nullptr) { + ShowSevereItemNotFound(state, eoh, thisInput->cAlphaFieldNames(9), thisInput->cAlphaArgs(9)); + ErrorsFound = true; + } + + if (thisInput->lAlphaFieldBlanks(10)) { + ShowSevereEmptyField(state, eoh, thisInput->cAlphaFieldNames(10)); + ErrorsFound = true; + } else if ((thisPump.VFD.upperPsetSched = Sched::GetSchedule(state, thisInput->cAlphaArgs(10))) == nullptr) { + ShowSevereItemNotFound(state, eoh, thisInput->cAlphaFieldNames(10), thisInput->cAlphaArgs(10)); + ErrorsFound = true; + } + + if (thisInput->lAlphaFieldBlanks(11)) { + ShowSevereEmptyField(state, eoh, thisInput->cAlphaFieldNames(11)); + ErrorsFound = true; + } else if ((thisPump.VFD.minRPMSched = Sched::GetSchedule(state, thisInput->cAlphaArgs(11))) == nullptr) { + ShowSevereItemNotFound(state, eoh, thisInput->cAlphaFieldNames(11), thisInput->cAlphaArgs(11)); + ErrorsFound = true; + } else if (!thisPump.VFD.minRPMSched->checkMinVal(state, Clusive::Ex, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, thisInput->cAlphaFieldNames(11), thisInput->cAlphaArgs(11), Clusive::Ex, 0.0); + ErrorsFound = true; + } + + if (thisInput->lAlphaFieldBlanks(12)) { + ShowSevereEmptyField(state, eoh, thisInput->cAlphaFieldNames(12)); + ErrorsFound = true; + } else if ((thisPump.VFD.maxRPMSched = Sched::GetSchedule(state, thisInput->cAlphaArgs(12))) == nullptr) { + ShowSevereItemNotFound(state, eoh, thisInput->cAlphaFieldNames(12), thisInput->cAlphaArgs(12)); + ErrorsFound = true; + } else if (!thisPump.VFD.maxRPMSched->checkMinVal(state, Clusive::Ex, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, thisInput->cAlphaFieldNames(12), thisInput->cAlphaArgs(12), Clusive::Ex, 0.0); ErrorsFound = true; } } break; + default: { ShowSevereError(state, format("{}{}=\"{}\", VFD Control type entered is invalid. Use one of the key choice entries.", @@ -536,6 +534,8 @@ void GetPumpInput(EnergyPlusData &state) thisInput->cAlphaFieldNames, thisInput->cNumericFieldNames); + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + GlobalNames::VerifyUniqueInterObjectName( state, state.dataPumps->PumpUniqueNames, thisInput->cAlphaArgs(1), cCurrentModuleObject, thisInput->cAlphaFieldNames(1), ErrorsFound); thisPump.Name = thisInput->cAlphaArgs(1); @@ -596,13 +596,10 @@ void GetPumpInput(EnergyPlusData &state) } // Input the optional schedule for the pump - if (!thisInput->cAlphaArgs(5).empty()) { // Initialized to zero, don't get a schedule for an empty - thisPump.PumpScheduleIndex = GetScheduleIndex(state, thisInput->cAlphaArgs(5)); - if (thisPump.PumpScheduleIndex <= 0) { - ShowWarningError(state, - format("{}{}=\"{}\", Invalid {}", RoutineName, cCurrentModuleObject, thisPump.Name, thisInput->cAlphaFieldNames(5))); - ShowContinueError(state, format("Schedule named =[{}]. was not found and will not be used.", thisInput->cAlphaArgs(5))); - } + if (thisInput->lAlphaFieldBlanks(5)) { + thisPump.flowRateSched = nullptr; + } else if ((thisPump.flowRateSched = Sched::GetSchedule(state, thisInput->cAlphaArgs(5))) == nullptr) { + ShowWarningItemNotFound(state, eoh, thisInput->cAlphaFieldNames(5), thisInput->cAlphaArgs(5), ""); } // Input pressure related data such as pressure curve and impeller size/rotational speed @@ -697,6 +694,8 @@ void GetPumpInput(EnergyPlusData &state) thisInput->cAlphaFieldNames, thisInput->cNumericFieldNames); + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, thisInput->cAlphaArgs(1)}; + GlobalNames::VerifyUniqueInterObjectName( state, state.dataPumps->PumpUniqueNames, thisInput->cAlphaArgs(1), cCurrentModuleObject, thisInput->cAlphaFieldNames(1), ErrorsFound); thisPump.Name = thisInput->cAlphaArgs(1); @@ -727,13 +726,10 @@ void GetPumpInput(EnergyPlusData &state) thisPump.PumpControl = PumpControlType::Intermittent; // Input the optional schedule for the pump - if (!thisInput->cAlphaArgs(4).empty()) { // Initialized to zero, don't get a schedule for an empty - thisPump.PumpScheduleIndex = GetScheduleIndex(state, thisInput->cAlphaArgs(4)); - if (thisPump.PumpScheduleIndex <= 0) { - ShowWarningError(state, - format("{}{}=\"{}\", Invalid {}", RoutineName, cCurrentModuleObject, thisPump.Name, thisInput->cAlphaFieldNames(4))); - ShowContinueError(state, format("Schedule named =[{}]. was not found and will not be used.", thisInput->cAlphaArgs(4))); - } + if (thisInput->cAlphaArgs(4).empty()) { + thisPump.flowRateSched = nullptr; + } else if ((thisPump.flowRateSched = Sched::GetSchedule(state, thisInput->cAlphaArgs(4))) == nullptr) { + ShowWarningItemNotFound(state, eoh, thisInput->cAlphaFieldNames(4), thisInput->cAlphaArgs(4)); } thisPump.NomSteamVolFlowRate = thisInput->rNumericArgs(1); @@ -779,8 +775,8 @@ void GetPumpInput(EnergyPlusData &state) thisPump.NomVolFlowRateWasAutoSized = true; } else { // Calc Condensate Pump Water Volume Flow Rate - SteamDensity = GetSatDensityRefrig(state, fluidNameSteam, StartTemp, 1.0, thisPump.FluidIndex, RoutineNameNoColon); - TempWaterDensity = GetDensityGlycol(state, fluidNameWater, Constant::InitConvTemp, DummyWaterIndex, RoutineName); + SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, StartTemp, 1.0, routineName); + TempWaterDensity = Fluid::GetWater(state)->getDensity(state, Constant::InitConvTemp, routineName); thisPump.NomVolFlowRate = (thisPump.NomSteamVolFlowRate * SteamDensity) / TempWaterDensity; } @@ -830,6 +826,8 @@ void GetPumpInput(EnergyPlusData &state) thisInput->cAlphaFieldNames, thisInput->cNumericFieldNames); + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, thisInput->cAlphaArgs(1)}; + GlobalNames::VerifyUniqueInterObjectName( state, state.dataPumps->PumpUniqueNames, thisInput->cAlphaArgs(1), cCurrentModuleObject, thisInput->cAlphaFieldNames(1), ErrorsFound); thisPump.Name = thisInput->cAlphaArgs(1); @@ -883,13 +881,10 @@ void GetPumpInput(EnergyPlusData &state) } // Input the optional schedule for the pump - if (!thisInput->cAlphaArgs(6).empty()) { // Initialized to zero, don't get a schedule for an empty - thisPump.PumpScheduleIndex = GetScheduleIndex(state, thisInput->cAlphaArgs(6)); - if (thisPump.PumpScheduleIndex <= 0) { - ShowWarningError(state, - format("{}{}=\"{}\", Invalid {}", RoutineName, cCurrentModuleObject, thisPump.Name, thisInput->cAlphaFieldNames(6))); - ShowContinueError(state, format("Schedule named =[{}]. was not found and will not be used.", thisInput->cAlphaArgs(6))); - } + if (thisInput->cAlphaArgs(6).empty()) { // Initialized to zero, don't get a schedule for an empty + thisPump.flowRateSched = nullptr; + } else if ((thisPump.flowRateSched = Sched::GetSchedule(state, thisInput->cAlphaArgs(6))) == nullptr) { + ShowWarningItemNotFound(state, eoh, thisInput->cAlphaFieldNames(6), thisInput->cAlphaArgs(6)); } thisPump.NomVolFlowRate = thisInput->rNumericArgs(1); @@ -977,6 +972,8 @@ void GetPumpInput(EnergyPlusData &state) thisInput->cAlphaFieldNames, thisInput->cNumericFieldNames); + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, thisInput->cAlphaArgs(1)}; + GlobalNames::VerifyUniqueInterObjectName( state, state.dataPumps->PumpUniqueNames, thisInput->cAlphaArgs(1), cCurrentModuleObject, thisInput->cAlphaFieldNames(1), ErrorsFound); thisPump.Name = thisInput->cAlphaArgs(1); @@ -1029,13 +1026,10 @@ void GetPumpInput(EnergyPlusData &state) } // Input the optional schedule for the pump - if (!thisInput->cAlphaArgs(6).empty()) { // Initialized to zero, don't get a schedule for an empty - thisPump.PumpScheduleIndex = GetScheduleIndex(state, thisInput->cAlphaArgs(6)); - if (thisPump.PumpScheduleIndex <= 0) { - ShowWarningError(state, - format("{}{}=\"{}\", Invalid {}", RoutineName, cCurrentModuleObject, thisPump.Name, thisInput->cAlphaFieldNames(6))); - ShowContinueError(state, format("Schedule named =[{}]. was not found and will not be used.", thisInput->cAlphaArgs(6))); - } + if (thisInput->lAlphaFieldBlanks(6)) { + thisPump.flowRateSched = nullptr; + } else if ((thisPump.flowRateSched = Sched::GetSchedule(state, thisInput->cAlphaArgs(6))) == nullptr) { + ShowWarningItemNotFound(state, eoh, thisInput->cAlphaFieldNames(6), thisInput->cAlphaArgs(6), ""); } thisPump.NomVolFlowRate = thisInput->rNumericArgs(1); @@ -1353,8 +1347,6 @@ void InitializePumps(EnergyPlusData &state, int const PumpNum) // This subroutine does one-time and begin-envrn inits for the pump // Using/Aliasing - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSatDensityRefrig; using PlantUtilities::InitComponentNodes; using PlantUtilities::ScanPlantLoopsForObject; @@ -1365,46 +1357,38 @@ void InitializePumps(EnergyPlusData &state, int const PumpNum) static constexpr std::string_view RoutineName("PlantPumps::InitializePumps "); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int InletNode; // pump inlet node number - int OutletNode; // pump outlet node number Real64 TotalEffic; Real64 SteamDensity; // Density of working fluid - int DummyWaterIndex(1); Real64 TempWaterDensity; - bool errFlag; Real64 mdotMax; // local fluid mass flow rate maximum Real64 mdotMin; // local fluid mass flow rate minimum - int plloopnum; DataPlant::LoopSideLocation lsnum; - int brnum; - int cpnum; // Set some variables for convenience auto &thisPump = state.dataPumps->PumpEquip(PumpNum); - InletNode = thisPump.InletNodeNum; - OutletNode = thisPump.OutletNodeNum; + int InletNode = thisPump.InletNodeNum; + int OutletNode = thisPump.OutletNodeNum; // One time inits if (thisPump.PumpOneTimeFlag) { - errFlag = false; + bool errFlag = false; ScanPlantLoopsForObject(state, thisPump.Name, thisPump.TypeOf_Num, thisPump.plantLoc, errFlag, _, _, _, _, _); - plloopnum = thisPump.plantLoc.loopNum; + int plloopnum = thisPump.plantLoc.loopNum; lsnum = thisPump.plantLoc.loopSideNum; - brnum = thisPump.plantLoc.branchNum; - cpnum = thisPump.plantLoc.compNum; + int brnum = thisPump.plantLoc.branchNum; + int cpnum = thisPump.plantLoc.compNum; if (plloopnum > 0 && lsnum != DataPlant::LoopSideLocation::Invalid && brnum > 0 && cpnum > 0) { auto &thisPumpLoc = state.dataPlnt->PlantLoop(plloopnum).LoopSide(lsnum).Branch(brnum); - auto &thisLoopNodeID = state.dataLoopNodes->NodeID; if (thisPumpLoc.Comp(cpnum).NodeNumIn != InletNode || thisPumpLoc.Comp(cpnum).NodeNumOut != OutletNode) { ShowSevereError( state, format("InitializePumps: {}=\"{}\", non-matching nodes.", pumpTypeIDFNames[static_cast(thisPump.pumpType)], thisPump.Name)); ShowContinueError(state, format("...in Branch={}, Component referenced with:", thisPumpLoc.Name)); - ShowContinueError(state, format("...Inlet Node={}", thisLoopNodeID(thisPumpLoc.Comp(cpnum).NodeNumIn))); - ShowContinueError(state, format("...Outlet Node={}", thisLoopNodeID(thisPumpLoc.Comp(cpnum).NodeNumOut))); - ShowContinueError(state, format("...Pump Inlet Node={}", thisLoopNodeID(InletNode))); - ShowContinueError(state, format("...Pump Outlet Node={}", thisLoopNodeID(OutletNode))); + ShowContinueError(state, format("...Inlet Node={}", state.dataLoopNodes->NodeID(thisPumpLoc.Comp(cpnum).NodeNumIn))); + ShowContinueError(state, format("...Outlet Node={}", state.dataLoopNodes->NodeID(thisPumpLoc.Comp(cpnum).NodeNumOut))); + ShowContinueError(state, format("...Pump Inlet Node={}", state.dataLoopNodes->NodeID(InletNode))); + ShowContinueError(state, format("...Pump Outlet Node={}", state.dataLoopNodes->NodeID(OutletNode))); errFlag = true; } } else { // CR9292 @@ -1498,9 +1482,8 @@ void InitializePumps(EnergyPlusData &state, int const PumpNum) // Begin environment inits if (thisPump.PumpInitFlag && state.dataGlobal->BeginEnvrnFlag) { if (thisPump.pumpType == PumpType::Cond) { - - TempWaterDensity = GetDensityGlycol(state, fluidNameWater, Constant::InitConvTemp, DummyWaterIndex, RoutineName); - SteamDensity = GetSatDensityRefrig(state, fluidNameSteam, StartTemp, 1.0, thisPump.FluidIndex, RoutineName); + TempWaterDensity = Fluid::GetWater(state)->getDensity(state, Constant::InitConvTemp, RoutineName); + SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, StartTemp, 1.0, RoutineName); thisPump.NomVolFlowRate = (thisPump.NomSteamVolFlowRate * SteamDensity) / TempWaterDensity; // set the maximum flow rate on the outlet node @@ -1519,7 +1502,7 @@ void InitializePumps(EnergyPlusData &state, int const PumpNum) } else { auto &thisPumpPlant = state.dataPlnt->PlantLoop(thisPump.plantLoc.loopNum); - TempWaterDensity = GetDensityGlycol(state, thisPumpPlant.FluidName, Constant::InitConvTemp, thisPumpPlant.FluidIndex, RoutineName); + TempWaterDensity = thisPumpPlant.glycol->getDensity(state, Constant::InitConvTemp, RoutineName); mdotMax = thisPump.NomVolFlowRate * TempWaterDensity; // mdotMin = PumpEquip(PumpNum)%MinVolFlowRate * TempWaterDensity // see note above @@ -1539,7 +1522,7 @@ void InitializePumps(EnergyPlusData &state, int const PumpNum) if (!state.dataGlobal->BeginEnvrnFlag) thisPump.PumpInitFlag = true; // zero out module level working variables - auto &daPumps = state.dataPumps; + auto const &daPumps = state.dataPumps; daPumps->PumpMassFlowRate = 0.0; daPumps->PumpHeattoFluid = 0.0; daPumps->Power = 0.0; @@ -1579,10 +1562,8 @@ void SetupPumpMinMaxFlows(EnergyPlusData &state, int const LoopNum, int const Pu // These values are also bounded by EMS overridable limit of max flow rate. // Using/Aliasing - using FluidProperties::GetDensityGlycol; using PlantPressureSystem::ResolveLoopFlowVsPressure; using PlantUtilities::BoundValueToWithinTwoValues; - using ScheduleManager::GetCurrentScheduleValue; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int InletNode; // pump inlet node number @@ -1608,13 +1589,8 @@ void SetupPumpMinMaxFlows(EnergyPlusData &state, int const LoopNum, int const Pu InletNodeMax = thisInNode.MassFlowRateMaxAvail; InletNodeMin = thisInNode.MassFlowRateMinAvail; - // Retrive the pump speed fraction from the pump schedule - if (thisPump.PumpScheduleIndex != 0) { - PumpSchedFraction = GetCurrentScheduleValue(state, thisPump.PumpScheduleIndex); - PumpSchedFraction = BoundValueToWithinTwoValues(PumpSchedFraction, 0.0, 1.0); - } else { - PumpSchedFraction = 1.0; - } + // Retrieve the pump speed fraction from the pump schedule (if any) + PumpSchedFraction = (thisPump.flowRateSched != nullptr) ? std::clamp(thisPump.flowRateSched->getCurrentVal(), 0.0, 1.0) : 1.0; // User specified min/max mass flow rates for pump PumpOverridableMaxLimit = thisPump.MassFlowRateMax; @@ -1638,7 +1614,7 @@ void SetupPumpMinMaxFlows(EnergyPlusData &state, int const LoopNum, int const Pu // Let the user know that his input file is overconstrained } - auto &thisPumpPlant = state.dataPlnt->PlantLoop(thisPump.plantLoc.loopNum); + auto const &thisPumpPlant = state.dataPlnt->PlantLoop(thisPump.plantLoc.loopNum); switch (thisPump.pumpType) { case PumpType::VarSpeed: { @@ -1646,7 +1622,7 @@ void SetupPumpMinMaxFlows(EnergyPlusData &state, int const LoopNum, int const Pu switch (thisPump.VFD.VFDControlType) { case ControlTypeVFD::VFDManual: { // Evaluate the schedule if it exists and put the fraction into a local variable - PumpSchedRPM = GetCurrentScheduleValue(state, thisPump.VFD.ManualRPMSchedIndex); + PumpSchedRPM = thisPump.VFD.manualRPMSched->getCurrentVal(); // Convert the RPM to rot/sec for calculation routine thisPump.RotSpeed = PumpSchedRPM / 60.0; // Resolve the new mass flow rate based on current pressure characteristics @@ -1756,11 +1732,7 @@ void CalcPumps(EnergyPlusData &state, int const PumpNum, Real64 const FlowReques // Energy Calculations, ASHRAE, 1993, pp2-10 to 2-15 // Using/Aliasing - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSpecificHeatGlycol; - using PlantUtilities::SetComponentFlowRate; - using ScheduleManager::GetCurrentScheduleValue; // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("PlantPumps:CalcPumps: "); @@ -1831,8 +1803,8 @@ void CalcPumps(EnergyPlusData &state, int const PumpNum, Real64 const FlowReques // Get RPM value for reporting as output // RPM is calculated using pump affinity laws for rotation speed if (thisPumpPlant.UsePressureForPumpCalcs && thisPump.HasVFD) { - RotSpeed_Min = GetCurrentScheduleValue(state, thisPump.VFD.MinRPMSchedIndex); - RotSpeed_Max = GetCurrentScheduleValue(state, thisPump.VFD.MaxRPMSchedIndex); + RotSpeed_Min = thisPump.VFD.minRPMSched ? thisPump.VFD.minRPMSched->getCurrentVal() : 0.0; + RotSpeed_Max = thisPump.VFD.maxRPMSched ? thisPump.VFD.maxRPMSched->getCurrentVal() : 0.0; if (thisPump.PumpMassFlowRateMaxRPM < DataBranchAirLoopPlant::MassFlowTolerance || thisPump.PumpMassFlowRateMinRPM < DataBranchAirLoopPlant::MassFlowTolerance) { thisPump.VFD.PumpActualRPM = 0.0; @@ -1887,7 +1859,7 @@ void CalcPumps(EnergyPlusData &state, int const PumpNum, Real64 const FlowReques } // density used for volumetric flow calculations - LoopDensity = GetDensityGlycol(state, thisPumpPlant.FluidName, thisInNode.Temp, thisPumpPlant.FluidIndex, RoutineName); + LoopDensity = thisPumpPlant.glycol->getDensity(state, thisInNode.Temp, RoutineName); //****************************! //***** CALCULATE POWER (1) **! @@ -2017,10 +1989,6 @@ void SizePump(EnergyPlusData &state, int const PumpNum) // METHODOLOGY EMPLOYED: // Obtains flow rates from the plant sizing array. - // Using/Aliasing - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSatDensityRefrig; - // SUBROUTINE PARAMETER DEFINITIONS: Real64 constexpr StartTemp(100.0); // Standard Temperature across code to calculated Steam density static constexpr std::string_view RoutineName("PlantPumps::InitSimVars "); @@ -2042,9 +2010,9 @@ void SizePump(EnergyPlusData &state, int const PumpNum) // Calculate density at InitConvTemp once here, to remove RhoH2O calls littered throughout if (thisPump.plantLoc.loopNum > 0) { auto &thisPumpPlant = state.dataPlnt->PlantLoop(thisPump.plantLoc.loopNum); - TempWaterDensity = GetDensityGlycol(state, thisPumpPlant.FluidName, Constant::InitConvTemp, thisPumpPlant.FluidIndex, RoutineName); + TempWaterDensity = thisPumpPlant.glycol->getDensity(state, Constant::InitConvTemp, RoutineName); } else { - TempWaterDensity = GetDensityGlycol(state, fluidNameWater, Constant::InitConvTemp, DummyWaterIndex, RoutineName); + TempWaterDensity = Fluid::GetWater(state)->getDensity(state, Constant::InitConvTemp, RoutineName); } PlantSizNum = 0; @@ -2065,7 +2033,7 @@ void SizePump(EnergyPlusData &state, int const PumpNum) for (int BranchNum = 1; BranchNum <= thisPumpLoop.TotalBranches; ++BranchNum) { auto &thisPumpBranch = thisPumpLoop.Branch(BranchNum); for (int CompNum = 1; CompNum <= thisPumpBranch.TotalComponents; ++CompNum) { - auto &thisPumpComp = thisPumpBranch.Comp(CompNum); + auto const &thisPumpComp = thisPumpBranch.Comp(CompNum); if (thisPump.InletNodeNum == thisPumpComp.NodeNumIn && thisPump.OutletNodeNum == thisPumpComp.NodeNumOut) { if (thisPumpBranch.PumpSizFac > 0.0) { PumpSizFac = thisPumpBranch.PumpSizFac; @@ -2090,8 +2058,8 @@ void SizePump(EnergyPlusData &state, int const PumpNum) if (!thisPumpPlant.LoopSide(thisPump.plantLoc.loopSideNum).BranchPumpsExist) { // size pump to full flow of plant loop if (thisPump.pumpType == PumpType::Cond) { - TempWaterDensity = GetDensityGlycol(state, fluidNameWater, Constant::InitConvTemp, DummyWaterIndex, RoutineName); - SteamDensity = GetSatDensityRefrig(state, fluidNameSteam, StartTemp, 1.0, thisPump.FluidIndex, RoutineNameSizePumps); + TempWaterDensity = Fluid::GetWater(state)->getDensity(state, Constant::InitConvTemp, RoutineName); + SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, StartTemp, 1.0, RoutineNameSizePumps); thisPump.NomSteamVolFlowRate = thisPlantSize.DesVolFlowRate * PumpSizFac; thisPump.NomVolFlowRate = thisPump.NomSteamVolFlowRate * SteamDensity / TempWaterDensity; } else { @@ -2101,8 +2069,8 @@ void SizePump(EnergyPlusData &state, int const PumpNum) // Distribute sizes evenly across all branch pumps DesVolFlowRatePerBranch = thisPlantSize.DesVolFlowRate / thisPumpPlant.LoopSide(thisPump.plantLoc.loopSideNum).TotalPumps; if (thisPump.pumpType == PumpType::Cond) { - TempWaterDensity = GetDensityGlycol(state, fluidNameWater, Constant::InitConvTemp, DummyWaterIndex, RoutineName); - SteamDensity = GetSatDensityRefrig(state, fluidNameSteam, StartTemp, 1.0, thisPump.FluidIndex, RoutineNameSizePumps); + TempWaterDensity = Fluid::GetWater(state)->getDensity(state, Constant::InitConvTemp, RoutineName); + SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, StartTemp, 1.0, RoutineNameSizePumps); thisPump.NomSteamVolFlowRate = DesVolFlowRatePerBranch * PumpSizFac; thisPump.NomVolFlowRate = thisPump.NomSteamVolFlowRate * SteamDensity / TempWaterDensity; } else { @@ -2223,8 +2191,8 @@ void ReportPumps(EnergyPlusData &state, int const PumpNum) PumpType = thisPump.pumpType; OutletNode = thisPump.OutletNodeNum; - auto &thisOutNode = state.dataLoopNodes->Node(OutletNode); - auto &daPumps = state.dataPumps; + auto const &thisOutNode = state.dataLoopNodes->Node(OutletNode); + auto const &daPumps = state.dataPumps; if (daPumps->PumpMassFlowRate <= DataBranchAirLoopPlant::MassFlowTolerance) { new (&(state.dataPumps->PumpEquipReport(PumpNum))) ReportVars(); @@ -2325,12 +2293,8 @@ void GetRequiredMassFlowRate(EnergyPlusData &state, Real64 &PumpMaxMassFlowRateVFDRange) { // Using/Aliasing - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSpecificHeatGlycol; - using PlantPressureSystem::ResolveLoopFlowVsPressure; using PlantUtilities::SetComponentFlowRate; - using ScheduleManager::GetCurrentScheduleValue; Real64 PumpMassFlowRateMaxPress(0.0); // Maximum mass flow rate associated with maximum pressure limit Real64 PumpMassFlowRateMinPress(0.0); // Minimum mass flow rate associated with minimum pressure limit @@ -2341,14 +2305,14 @@ void GetRequiredMassFlowRate(EnergyPlusData &state, auto &thisPump = state.dataPumps->PumpEquip(PumpNum); - RotSpeed_Min = GetCurrentScheduleValue(state, thisPump.VFD.MinRPMSchedIndex); - RotSpeed_Max = GetCurrentScheduleValue(state, thisPump.VFD.MaxRPMSchedIndex); - MinPress = GetCurrentScheduleValue(state, thisPump.VFD.LowerPsetSchedIndex); - MaxPress = GetCurrentScheduleValue(state, thisPump.VFD.UpperPsetSchedIndex); + RotSpeed_Min = thisPump.VFD.minRPMSched->getCurrentVal(); + RotSpeed_Max = thisPump.VFD.maxRPMSched->getCurrentVal(); + MinPress = thisPump.VFD.lowerPsetSched->getCurrentVal(); + MaxPress = thisPump.VFD.upperPsetSched->getCurrentVal(); // Calculate maximum and minimum mass flow rate associated with maximun and minimum RPM if (thisPump.plantLoc.loopNum > 0) { - auto &thisPlantLoop = state.dataPlnt->PlantLoop(thisPump.plantLoc.loopNum); + auto const &thisPlantLoop = state.dataPlnt->PlantLoop(thisPump.plantLoc.loopNum); if (thisPlantLoop.UsePressureForPumpCalcs && thisPlantLoop.PressureSimType == DataPlant::PressSimType::FlowCorrection && thisPlantLoop.PressureDrop > 0.0) { thisPump.PumpMassFlowRateMaxRPM = ResolveLoopFlowVsPressure(state, @@ -2377,7 +2341,7 @@ void GetRequiredMassFlowRate(EnergyPlusData &state, // Calculate maximum and minimum mass flow rate associated with operating pressure range if (thisPump.plantLoc.loopNum > 0) { - auto &thisPlantLoop = state.dataPlnt->PlantLoop(LoopNum); + auto const &thisPlantLoop = state.dataPlnt->PlantLoop(LoopNum); if (thisPlantLoop.PressureEffectiveK > 0.0) { PumpMassFlowRateMaxPress = std::sqrt(MaxPress / thisPlantLoop.PressureEffectiveK); PumpMassFlowRateMinPress = std::sqrt(MinPress / thisPlantLoop.PressureEffectiveK); diff --git a/src/EnergyPlus/Pumps.hh b/src/EnergyPlus/Pumps.hh index 955c13a2169..2b9ac6673db 100644 --- a/src/EnergyPlus/Pumps.hh +++ b/src/EnergyPlus/Pumps.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -52,6 +52,7 @@ #include #include #include +// #include namespace EnergyPlus { @@ -113,11 +114,11 @@ namespace Pumps { { // Members std::string Name; - int ManualRPMSchedIndex = 0; - int LowerPsetSchedIndex = 0; - int UpperPsetSchedIndex = 0; - int MinRPMSchedIndex = 0; - int MaxRPMSchedIndex = 0; + Sched::Schedule *manualRPMSched = nullptr; + Sched::Schedule *lowerPsetSched = nullptr; + Sched::Schedule *upperPsetSched = nullptr; + Sched::Schedule *minRPMSched = nullptr; + Sched::Schedule *maxRPMSched = nullptr; ControlTypeVFD VFDControlType = ControlTypeVFD::Invalid; // VFDControlType Real64 MaxRPM = 0.0; // Maximum RPM range value - schedule limit Real64 MinRPM = 0.0; // Minimum RPM range value - schedule limit @@ -133,30 +134,30 @@ namespace Pumps { DataPlant::PlantEquipmentType TypeOf_Num = DataPlant::PlantEquipmentType::Invalid; // pump type of number in reference to the dataplant values PlantLocation plantLoc = {0, DataPlant::LoopSideLocation::Invalid, 0, 0}; PumpControlType PumpControl = PumpControlType::Invalid; // Integer equivalent of PumpControlType - int PumpScheduleIndex = 0; // Schedule Pointer + Sched::Schedule *flowRateSched = nullptr; // Flow rate modifier schedule, blank/missing --> AlwaysOn int InletNodeNum = 0; // Node number on the inlet side of the plant int OutletNodeNum = 0; // Node number on the outlet side of the plant PumpBankControlSeq SequencingScheme = PumpBankControlSeq::Invalid; // Optimal, Sequential, User-Defined - int FluidIndex = 0; // Index for Fluid Properties - int NumPumpsInBank = 0; // Node number on the inlet side of the plant - int PowerErrIndex1 = 0; // for recurring errors - int PowerErrIndex2 = 0; // for recurring errors - Real64 MinVolFlowRateFrac = 0.0; // minimum schedule value fraction modifier - Real64 NomVolFlowRate = 0.0; // design nominal capacity of Pump - bool NomVolFlowRateWasAutoSized = false; // true if previous was autosize on input - Real64 MassFlowRateMax = 0.0; // design nominal capacity of Pump - bool EMSMassFlowOverrideOn = false; // if true, then EMS is calling to override flow requests. - Real64 EMSMassFlowValue = 0.0; // EMS value to use for mass flow rate [kg/s] - Real64 NomSteamVolFlowRate = 0.0; // For Steam Pump - bool NomSteamVolFlowRateWasAutoSized = false; // true if steam volume flow rate was autosize on input - Real64 MinVolFlowRate = 0.0; // For a Variable Flow Pump this is the minimum capacity during operation. - bool minVolFlowRateWasAutosized = false; // true if minimum flow rate was autosize on input - Real64 MassFlowRateMin = 0.0; // For a Variable Flow Pump this is the minimum capacity during operation. - Real64 NomPumpHead = 0.0; // design nominal head pressure of Pump, [Pa] - bool EMSPressureOverrideOn = false; // if true, EMS is calling to override pump pressure - Real64 EMSPressureOverrideValue = 0.0; // EMS value to use for pressure [Pa] - Real64 NomPowerUse = 0.0; // design nominal capacity of Pump - bool NomPowerUseWasAutoSized = false; // true if power was autosize on input + // Fluid::RefrigProps *fluid = nullptr; // Index for Fluid Properties + int NumPumpsInBank = 0; // Node number on the inlet side of the plant + int PowerErrIndex1 = 0; // for recurring errors + int PowerErrIndex2 = 0; // for recurring errors + Real64 MinVolFlowRateFrac = 0.0; // minimum schedule value fraction modifier + Real64 NomVolFlowRate = 0.0; // design nominal capacity of Pump + bool NomVolFlowRateWasAutoSized = false; // true if previous was autosize on input + Real64 MassFlowRateMax = 0.0; // design nominal capacity of Pump + bool EMSMassFlowOverrideOn = false; // if true, then EMS is calling to override flow requests. + Real64 EMSMassFlowValue = 0.0; // EMS value to use for mass flow rate [kg/s] + Real64 NomSteamVolFlowRate = 0.0; // For Steam Pump + bool NomSteamVolFlowRateWasAutoSized = false; // true if steam volume flow rate was autosize on input + Real64 MinVolFlowRate = 0.0; // For a Variable Flow Pump this is the minimum capacity during operation. + bool minVolFlowRateWasAutosized = false; // true if minimum flow rate was autosize on input + Real64 MassFlowRateMin = 0.0; // For a Variable Flow Pump this is the minimum capacity during operation. + Real64 NomPumpHead = 0.0; // design nominal head pressure of Pump, [Pa] + bool EMSPressureOverrideOn = false; // if true, EMS is calling to override pump pressure + Real64 EMSPressureOverrideValue = 0.0; // EMS value to use for pressure [Pa] + Real64 NomPowerUse = 0.0; // design nominal capacity of Pump + bool NomPowerUseWasAutoSized = false; // true if power was autosize on input PowerSizingMethod powerSizingMethod = PowerSizingMethod::SizePowerPerFlowPerPressure; // which method is used for sizing nominal power use Real64 powerPerFlowScalingFactor = 348701.1; // design electric power per unit flow rate (22 W/gpm) Real64 powerPerFlowPerPressureScalingFactor = (1 / .78); // design shaft power per unit flow rate per unit head (legacy impeller efficiency) @@ -249,6 +250,10 @@ struct PumpsData : BaseGlobalStruct EPVector PumpEquipReport; std::unordered_map PumpUniqueNames; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/PurchasedAirManager.cc b/src/EnergyPlus/PurchasedAirManager.cc index af26373459a..60df273d3c3 100644 --- a/src/EnergyPlus/PurchasedAirManager.cc +++ b/src/EnergyPlus/PurchasedAirManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -50,7 +50,7 @@ // ObjexxFCL Headers #include -#include +// #include #include // EnergyPlus Headers @@ -112,7 +112,6 @@ namespace EnergyPlus::PurchasedAirManager { // humidity ratio are adjusted to meet the zone load. // Using/Aliasing -using namespace ScheduleManager; using Psychrometrics::PsyCpAirFnW; using Psychrometrics::PsyHFnTdbW; using Psychrometrics::PsyRhoAirFnPbTdbW; @@ -214,7 +213,9 @@ void GetPurchasedAir(EnergyPlusData &state) // SUBROUTINE LOCAL VARIABLE DECLARATIONS: static constexpr std::string_view RoutineName("GetPurchasedAir: "); // include trailing blank space - bool ErrorsFound(false); // If errors detected in input + static constexpr std::string_view routineName = "GetPurchasedAir"; + + bool ErrorsFound(false); // If errors detected in input auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; cCurrentModuleObject = "ZoneHVAC:IdealLoadsAirSystem"; @@ -248,6 +249,8 @@ void GetPurchasedAir(EnergyPlusData &state) state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + state.dataPurchasedAirMgr->PurchAirNumericFields(PurchAirNum).FieldNames.allocate(NumNums); state.dataPurchasedAirMgr->PurchAirNumericFields(PurchAirNum).FieldNames = ""; state.dataPurchasedAirMgr->PurchAirNumericFields(PurchAirNum).FieldNames = state.dataIPShortCut->cNumericFieldNames; @@ -255,18 +258,11 @@ void GetPurchasedAir(EnergyPlusData &state) PurchAir(PurchAirNum).Name = state.dataIPShortCut->cAlphaArgs(1); // get optional availability schedule - PurchAir(PurchAirNum).AvailSched = state.dataIPShortCut->cAlphaArgs(2); if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { - PurchAir(PurchAirNum).AvailSchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - PurchAir(PurchAirNum).AvailSchedPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); - if (PurchAir(PurchAirNum).AvailSchedPtr == 0) { - ShowSevereError(state, format("{}{}=\"{} invalid data", RoutineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError( - state, - format("Invalid-not found {}=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); - ErrorsFound = true; - } + PurchAir(PurchAirNum).availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((PurchAir(PurchAirNum).availSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2)); + ErrorsFound = true; } // Purchased air supply air node is an outlet node PurchAir(PurchAirNum).ZoneSupplyAirNodeNum = GetOnlySingleNode(state, @@ -401,33 +397,21 @@ void GetPurchasedAir(EnergyPlusData &state) PurchAir(PurchAirNum).MaxCoolTotCap = state.dataIPShortCut->rNumericArgs(8); // get optional heating availability schedule - PurchAir(PurchAirNum).HeatSched = state.dataIPShortCut->cAlphaArgs(8); if (state.dataIPShortCut->lAlphaFieldBlanks(8)) { - PurchAir(PurchAirNum).HeatSchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - PurchAir(PurchAirNum).HeatSchedPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(8)); - if (PurchAir(PurchAirNum).HeatSchedPtr == 0) { - ShowSevereError(state, format("{}{}=\"{} invalid data", RoutineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError( - state, - format("Invalid-not found {}=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(8), state.dataIPShortCut->cAlphaArgs(8))); - ErrorsFound = true; - } + PurchAir(PurchAirNum).heatAvailSched = Sched::GetScheduleAlwaysOn(state); + } else if ((PurchAir(PurchAirNum).heatAvailSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(8))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(8), state.dataIPShortCut->cAlphaArgs(8)); + ErrorsFound = true; } + // get optional cooling availability schedule - PurchAir(PurchAirNum).CoolSched = state.dataIPShortCut->cAlphaArgs(9); if (state.dataIPShortCut->lAlphaFieldBlanks(9)) { - PurchAir(PurchAirNum).CoolSchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - PurchAir(PurchAirNum).CoolSchedPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(9)); - if (PurchAir(PurchAirNum).CoolSchedPtr == 0) { - ShowSevereError(state, format("{}{}=\"{} invalid data", RoutineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError( - state, - format("Invalid-not found {}=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(9), state.dataIPShortCut->cAlphaArgs(9))); - ErrorsFound = true; - } + PurchAir(PurchAirNum).coolAvailSched = Sched::GetScheduleAlwaysOn(state); + } else if ((PurchAir(PurchAirNum).coolAvailSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(9))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(9), state.dataIPShortCut->cAlphaArgs(9)); + ErrorsFound = true; } + // get Dehumidification control type if (Util::SameString(state.dataIPShortCut->cAlphaArgs(10), "None")) { PurchAir(PurchAirNum).DehumidCtrlType = HumControl::None; @@ -1302,21 +1286,22 @@ void InitPurchasedAir(EnergyPlusData &state, int const PurchAirNum, int const Co state.dataPurchasedAirMgr->InitPurchasedAirMyEnvrnFlag(PurchAirNum) = true; } + auto const &zoneTstatSetpt = state.dataHeatBalFanSys->zoneTstatSetpts(ControlledZoneNum); + // These initializations are done every iteration // check that supply air temps can meet the zone thermostat setpoints - if (PurchAir.MinCoolSuppAirTemp > state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ControlledZoneNum) && - state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ControlledZoneNum) != 0 && PurchAir.CoolingLimit == LimitType::NoLimit) { + if (PurchAir.MinCoolSuppAirTemp > zoneTstatSetpt.setptHi && zoneTstatSetpt.setptHi != 0 && PurchAir.CoolingLimit == LimitType::NoLimit) { // Check if the unit is scheduled off UnitOn = true; - // IF (PurchAir%AvailSchedPtr > 0) THEN - if (GetCurrentScheduleValue(state, PurchAir.AvailSchedPtr) <= 0) { + // IF (PurchAir(PurchAirNum)%AvailSchedPtr > 0) THEN + if (PurchAir.availSched->getCurrentVal() <= 0) { UnitOn = false; } // END IF // Check if cooling available bool CoolOn = true; - // IF (PurchAir%CoolSchedPtr > 0) THEN - if (GetCurrentScheduleValue(state, PurchAir.CoolSchedPtr) <= 0) { + // IF (PurchAir(PurchAirNum)%CoolSchedPtr > 0) THEN + if (PurchAir.coolAvailSched->getCurrentVal() <= 0) { CoolOn = false; } // END IF @@ -1331,7 +1316,7 @@ void InitPurchasedAir(EnergyPlusData &state, int const PurchAirNum, int const Co format("..the minimum supply air temperature for cooling [{:.2R}] is greater than the zone cooling mean air " "temperature (MAT) setpoint [{:.2R}].", PurchAir.MinCoolSuppAirTemp, - state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ControlledZoneNum))); + zoneTstatSetpt.setptHi)); ShowContinueError(state, "..For operative and comfort thermostat controls, the MAT setpoint is computed."); ShowContinueError(state, "..This error may indicate that the mean radiant temperature or another comfort factor is too warm."); ShowContinueError(state, "Unit availability is nominally ON and Cooling availability is nominally ON."); @@ -1351,19 +1336,20 @@ void InitPurchasedAir(EnergyPlusData &state, int const PurchAirNum, int const Co "C"); } } - if (PurchAir.MaxHeatSuppAirTemp < state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ControlledZoneNum) && - state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ControlledZoneNum) != 0 && PurchAir.HeatingLimit == LimitType::NoLimit) { + + if (PurchAir.MaxHeatSuppAirTemp < zoneTstatSetpt.setptLo && zoneTstatSetpt.setptLo != 0 && PurchAir.HeatingLimit == LimitType::NoLimit) { // Check if the unit is scheduled off UnitOn = true; - // IF (PurchAir%AvailSchedPtr > 0) THEN - if (GetCurrentScheduleValue(state, PurchAir.AvailSchedPtr) <= 0) { + // IF (PurchAir(PurchAirNum)%AvailSchedPtr > 0) THEN + if (PurchAir.availSched->getCurrentVal() <= 0) { UnitOn = false; } // END IF // Check if heating and cooling available + bool HeatOn = true; - // IF (PurchAir%HeatSchedPtr > 0) THEN - if (GetCurrentScheduleValue(state, PurchAir.HeatSchedPtr) <= 0) { + // IF (PurchAir(PurchAirNum)%HeatSchedPtr > 0) THEN + if (PurchAir.heatAvailSched->getCurrentVal() <= 0) { HeatOn = false; } // END IF @@ -1378,7 +1364,7 @@ void InitPurchasedAir(EnergyPlusData &state, int const PurchAirNum, int const Co format("..the maximum supply air temperature for heating [{:.2R}] is less than the zone mean air temperature " "heating setpoint [{:.2R}].", PurchAir.MaxHeatSuppAirTemp, - state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ControlledZoneNum))); + zoneTstatSetpt.setptLo)); ShowContinueError(state, "..For operative and comfort thermostat controls, the MAT setpoint is computed."); ShowContinueError(state, "..This error may indicate that the mean radiant temperature or another comfort factor is too cold."); ShowContinueError(state, "Unit availability is nominally ON and Heating availability is nominally ON."); @@ -1990,7 +1976,7 @@ void CalcPurchAirLoads(EnergyPlusData &state, int RecircNodeNum; // Return air or zone exhaust node OpMode OperatingMode; // current operating mode, Off, Heat, Cool, or DeadBand Real64 SupplyMassFlowRate; // System supply air mass flow rate [kg/s] - Real64 SupplyMassFlowRateForHumid; // System supply air mass flow rate required to meet humdification load [kg/s] + Real64 SupplyMassFlowRateForHumid; // System supply air mass flow rate required to meet humidification load [kg/s] Real64 SupplyMassFlowRateForDehum; // System supply air mass flow rate required to meet dehumidification load [kg/s] Real64 SupplyMassFlowRateForCool; // System supply air mass flow rate required to meet sensible cooling load[kg/s] Real64 SupplyMassFlowRateForHeat; // System supply air mass flow rate required to meet sensible heating load[kg/s] @@ -2000,10 +1986,10 @@ void CalcPurchAirLoads(EnergyPlusData &state, Real64 OAVolFlowRate; // Outdoor air volume flow rate at standard density [m3/s] Real64 MinOASensOutput; // Minimum Outdoor air sensible output [W], <0 means OA is cooler than zone air Real64 MinOALatOutput; // Minimum Outdoor air moisture load [kg/s] - Real64 SensOutput; // Sensible output [W] (psitive means heating, negative means cooling) + Real64 SensOutput; // Sensible output [W] (positive means heating, negative means cooling) Real64 HeatSensOutput; // Heating sensible output [W] - Real64 CoolSensOutput; // Cooling sensible output [W] (positive value menas cooling) - Real64 LatOutput; // Latent output [W] (positive value means hudmification, negative means dehumidification) + Real64 CoolSensOutput; // Cooling sensible output [W] (positive value means cooling) + Real64 LatOutput; // Latent output [W] (positive value means humidification, negative means dehumidification) Real64 CoolLatOutput; // Cooling latent output [W] (positive value means dehumidification) Real64 CoolTotOutput; // Cooling total output [W] (positive value means cooling) Real64 DeltaT; // Delta temperature - reused in multiple places @@ -2013,8 +1999,8 @@ void CalcPurchAirLoads(EnergyPlusData &state, Real64 MdotZnHumidSP; // Load required to meet humidifying setpoint [kgWater/s] (>0 = a humidify load) Real64 MdotZnDehumidSP; // Load required to meet dehumidifying setpoint [kgWater/s] (<0 = a dehumidify load) bool UnitOn; - bool HeatOn; // Flag for heating and humidification availbility schedule, true if heating is on - bool CoolOn; // Flag for cooling and dehumidification availbility schedule, true if cooling is on + bool HeatOn; // Flag for heating and humidification availability schedule, true if heating is on + bool CoolOn; // Flag for cooling and dehumidification availability schedule, true if cooling is on bool EconoOn; // Flag for economizer operation, true if economizer is on Real64 SupplyHumRatOrig; // Supply inlet to zone humidity ratio before saturation check [kgWater/kgDryAir] Real64 SupplyHumRatSat; // Supply inlet to zone humidity ratio saturation at SupplyTemp [kgWater/kgDryAir] @@ -2063,21 +2049,18 @@ void CalcPurchAirLoads(EnergyPlusData &state, } // Check if the unit is scheduled off - // IF (PurchAir%AvailSchedPtr > 0) THEN - if (GetCurrentScheduleValue(state, PurchAir.AvailSchedPtr) <= 0) { + if (PurchAir.availSched->getCurrentVal() <= 0) { UnitOn = false; } // END IF // Check if heating and cooling available HeatOn = true; - // IF (PurchAir%HeatSchedPtr > 0) THEN - if (GetCurrentScheduleValue(state, PurchAir.HeatSchedPtr) <= 0) { + if (PurchAir.heatAvailSched->getCurrentVal() <= 0) { HeatOn = false; } - // END IF + CoolOn = true; - // IF (PurchAir%CoolSchedPtr > 0) THEN - if (GetCurrentScheduleValue(state, PurchAir.CoolSchedPtr) <= 0) { + if (PurchAir.coolAvailSched->getCurrentVal() <= 0) { CoolOn = false; } // END IF @@ -2106,7 +2089,7 @@ void CalcPurchAirLoads(EnergyPlusData &state, // Check if cooling of the supply air stream is required // Cooling operation - if ((MinOASensOutput >= QZnCoolSP) && (state.dataHeatBalFanSys->TempControlType(ControlledZoneNum) != HVAC::ThermostatType::SingleHeating)) { + if ((MinOASensOutput >= QZnCoolSP) && (state.dataHeatBalFanSys->TempControlType(ControlledZoneNum) != HVAC::SetptType::SingleHeat)) { OperatingMode = OpMode::Cool; // Calculate supply mass flow, temp and humidity with the following constraints: // Min cooling supply temp @@ -2369,7 +2352,7 @@ void CalcPurchAirLoads(EnergyPlusData &state, break; } // Limit supply humidity ratio to saturation at supply outlet temp - // If saturation exceeded, then honor capacity limit and set to dew point at supplyenthalpy + // If saturation exceeded, then honor capacity limit and set to dew point at supply enthalpy SupplyHumRatOrig = PurchAir.SupplyHumRat; SupplyHumRatSat = PsyWFnTdbRhPb(state, PurchAir.SupplyTemp, 1.0, state.dataEnvrn->OutBaroPress, RoutineName); @@ -2406,8 +2389,7 @@ void CalcPurchAirLoads(EnergyPlusData &state, } // Heating or no-load operation } else { // Heating or no-load case - if ((MinOASensOutput < QZnHeatSP) && - (state.dataHeatBalFanSys->TempControlType(ControlledZoneNum) != HVAC::ThermostatType::SingleCooling)) { + if ((MinOASensOutput < QZnHeatSP) && (state.dataHeatBalFanSys->TempControlType(ControlledZoneNum) != HVAC::SetptType::SingleCool)) { OperatingMode = OpMode::Heat; } else { // DeadBand mode shuts off heat recovery and economizer OperatingMode = OpMode::DeadBand; @@ -2636,7 +2618,7 @@ void CalcPurchAirLoads(EnergyPlusData &state, } // Cooling or heating required if (SupplyMassFlowRate > 0.0) { - // EMS override point Purch air supply temp and humidty ratio ..... but only if unit is on, SupplyMassFlowRate>0.0 + // EMS override point Purch air supply temp and humidity ratio ..... but only if unit is on, SupplyMassFlowRate>0.0 if (PurchAir.EMSOverrideSupplyTempOn) { PurchAir.SupplyTemp = PurchAir.EMSValueSupplyTemp; } @@ -2674,7 +2656,7 @@ void CalcPurchAirLoads(EnergyPlusData &state, PurchAir.SupplyHumRat = PurchAir.MixedAirHumRat; } - // Double-check if saturation exceeded, then thow warning, shouldn't happen here, don't reset, just warn + // Double-check if saturation exceeded, then throw warning, shouldn't happen here, don't reset, just warn SupplyHumRatOrig = PurchAir.SupplyHumRat; SupplyHumRatSat = PsyWFnTdbRhPb(state, PurchAir.SupplyTemp, 1.0, state.dataEnvrn->OutBaroPress, RoutineName); @@ -3004,7 +2986,7 @@ void UpdatePurchasedAir(EnergyPlusData &state, int const PurchAirNum, bool const bool FirstCall; bool SupPathInletChanged; - FirstCall = true; // just used to avoid redundant calulations + FirstCall = true; // just used to avoid redundant calculations SupPathInletChanged = false; // don't care if something changes auto &PurchAir = state.dataPurchasedAirMgr->PurchAir(PurchAirNum); @@ -3137,7 +3119,7 @@ Real64 GetPurchasedAirOutAirMassFlow(EnergyPlusData &state, int const PurchAirNu // lookup function for OA inlet mass flow for ventilation rate reporting // METHODOLOGY EMPLOYED: - // most analagous functions look up an outside air node but this function + // most analogous functions look up an outside air node but this function // gets the actual mass flow of outdoor air, following the features of the model if (state.dataPurchasedAirMgr->GetPurchAirInputFlag) { @@ -3226,7 +3208,7 @@ Real64 GetPurchasedAirMixedAirTemp(EnergyPlusData &state, int const PurchAirNum) // lookup function for mixed air Temp for ventilation rate reporting // METHODOLOGY EMPLOYED: - // most analagous functions look up an outside air node but this function + // most analogous functions look up an outside air node but this function // gets the actual mass flow of outdoor air, following the features of the model if (state.dataPurchasedAirMgr->GetPurchAirInputFlag) { @@ -3315,13 +3297,13 @@ void InitializePlenumArrays(EnergyPlusData &state, int const PurchAirNum) // PurchAirPlenumArrays( 1 ).IsSimulated( 1 ) = true, ideal loads air system #1 has been simulated this iteration // PurchAirPlenumArrays( 1 ).IsSimulated( 2 ) = false, ideal loads air system #3 has not yet been simulated this iteration // - // Ideal loads air sytems keep track of which plenum they are connected to + // Ideal loads air systems keep track of which plenum they are connected to // PurchAir( 1 ).PlenumArrayIndex = 1 // PurchAir( 1 ).ReturnPlenumName = ReturnPlenum2; // PurchAir( 3 ).PlenumArrayIndex = 1 // PurchAir( 3 ).ReturnPlenumName = ReturnPlenum2; // - // The ideal loads air sytems also keep track of which item they are in the int and bool arrays + // The ideal loads air systems also keep track of which item they are in the int and bool arrays // PurchAir( 1 ).PurchAirArrayIndex = 1 // PurchAir( 3 ).PurchAirArrayIndex = 2 // @@ -3334,7 +3316,7 @@ void InitializePlenumArrays(EnergyPlusData &state, int const PurchAirNum) // PurchAirPlenumArrays( 2 ).IsSimulated( 2 ) = false, ideal loads air system #5 has not yet been simulated this iteration // PurchAirPlenumArrays( 2 ).IsSimulated( 3 ) = false, ideal loads air system #6 has not yet been simulated this iteration // - // Ideal loads air sytems keep track of which plenum they are connected to + // Ideal loads air systems keep track of which plenum they are connected to // PurchAir( 2 ).PlenumArrayIndex = 2; // PurchAir( 2 ).ReturnPlenumName = ReturnPlenum3; // PurchAir( 5 ).PlenumArrayIndex = 2; @@ -3342,7 +3324,7 @@ void InitializePlenumArrays(EnergyPlusData &state, int const PurchAirNum) // PurchAir( 6 ).PlenumArrayIndex = 2; // PurchAir( 6 ).ReturnPlenumName = ReturnPlenum3; // - // The ideal loads air sytems also keep track of which item they are in the int and bool arrays + // The ideal loads air systems also keep track of which item they are in the int and bool arrays // PurchAir( 2 ).PurchAirArrayIndex = 1; // PurchAir( 5 ).PurchAirArrayIndex = 2; // PurchAir( 6 ).PurchAirArrayIndex = 3; diff --git a/src/EnergyPlus/PurchasedAirManager.hh b/src/EnergyPlus/PurchasedAirManager.hh index d8c7ee1c36d..63e463d0ac2 100644 --- a/src/EnergyPlus/PurchasedAirManager.hh +++ b/src/EnergyPlus/PurchasedAirManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -144,15 +144,14 @@ namespace PurchasedAirManager { struct ZonePurchasedAir { // Members - std::string cObjectName; // Name of the object from IDD - std::string Name; // Name or identifier of this piece of equipment - std::string AvailSched; // System availability schedule - int AvailSchedPtr; // Index to system availability schedule - int ZoneSupplyAirNodeNum; // Node number of zone supply air node for purchased air - int ZoneExhaustAirNodeNum; // Node number of zone exhaust air node for purchased air - int PlenumExhaustAirNodeNum; // Node number of plenum exhaust air node - int ReturnPlenumIndex; // Index of return plenum - int PurchAirArrayIndex; // Index to sub-array that links ideal loads air system to index of sub-array + std::string cObjectName; // Name of the object from IDD + std::string Name; // Name or identifier of this piece of equipment + Sched::Schedule *availSched = nullptr; // System availability schedule + int ZoneSupplyAirNodeNum; // Node number of zone supply air node for purchased air + int ZoneExhaustAirNodeNum; // Node number of zone exhaust air node for purchased air + int PlenumExhaustAirNodeNum; // Node number of plenum exhaust air node + int ReturnPlenumIndex; // Index of return plenum + int PurchAirArrayIndex; // Index to sub-array that links ideal loads air system to index of sub-array std::string ReturnPlenumName; int ZoneRecircAirNodeNum; // Node number of recirculation air node for purchased air // same as exhaust node if specified, otherwise zone return node @@ -166,13 +165,11 @@ namespace PurchasedAirManager { Real64 MaxHeatSensCap; // Maximum heating sensible capacity [W] LimitType CoolingLimit; // Cooling capacity limit type - NoLimit, LimitFlowRate, LimitCapacity, // or LimitFlowRateAndCapacity - Real64 MaxCoolVolFlowRate; // Maximum cooling supply air flow [m3/s] - Real64 MaxCoolTotCap; // Maximum cooling total capacity [W] - std::string HeatSched; // Heating availablity schedule - int HeatSchedPtr; // Index to heating availability schedule - std::string CoolSched; // Cooling availability schedule - int CoolSchedPtr; // Index to the cooling availability schedule - HumControl DehumidCtrlType; // Dehumidification control type - ConstantSensibleHeatRatio, + Real64 MaxCoolVolFlowRate; // Maximum cooling supply air flow [m3/s] + Real64 MaxCoolTotCap; // Maximum cooling total capacity [W] + Sched::Schedule *heatAvailSched = nullptr; // Heating availability schedule + Sched::Schedule *coolAvailSched = nullptr; // Index to the cooling availability schedule + HumControl DehumidCtrlType; // Dehumidification control type - ConstantSensibleHeatRatio, // Humidistat, or ConstantSupplyHumidityRatio Real64 CoolSHR; // Cooling sensible heat ratio HumControl HumidCtrlType; // Humidification control type - None, @@ -182,27 +179,27 @@ namespace PurchasedAirManager { // OccupancySchedule, or CO2SetPoint Econ EconomizerType; // Outdoor air economizer type - NoEconomizer, // DifferentialDryBulb, or DifferentialEnthalpy - bool OutdoorAir; // Is there outdoor air? - int OutdoorAirNodeNum; // Node number of the outdoor air inlet node - HeatRecovery HtRecType; // Outdoor air heat recovery type - None, Sensible, Enthalpy - Real64 HtRecSenEff; // Sensible heat recovery effectiveness - Real64 HtRecLatEff; // Latent heat recovery effectiveness - int OAFlowFracSchPtr; // Fraction schedule applied to total OA requirement - Real64 MaxHeatMassFlowRate; // The maximum heating air mass flow rate [kg/s] - Real64 MaxCoolMassFlowRate; // The maximum cooling air mass flow rate [kg/s] - bool EMSOverrideMdotOn; // if true, then EMS is calling to override supply mass flow rate - Real64 EMSValueMassFlowRate; // Value EMS is directing to use for supply mass flow rate [kg/s] - bool EMSOverrideOAMdotOn; // if true, then EMS is calling to override OA mass flow rate - Real64 EMSValueOAMassFlowRate; // Value EMS is directing to use for OA mass flow rate [kg/s] - bool EMSOverrideSupplyTempOn; // if true, then EMS is calling to override supply temperature - Real64 EMSValueSupplyTemp; // Value EMS is directing to use for supply temperature [C] - bool EMSOverrideSupplyHumRatOn; // if true, then EMS is calling to override supply humidity ratio - Real64 EMSValueSupplyHumRat; // Value EMS is directing to use for supply humidity ratio [kgWater/kgDryAir] - Real64 MinOAMassFlowRate; // The minimum required outdoor air mass flow rate [kg/s] - Real64 OutdoorAirMassFlowRate; // The outdoor air mass flow rate [kg/s] - Real64 OutdoorAirVolFlowRateStdRho; // The outdoor air volume flow rate using standard density [m3/s] - Real64 SupplyAirMassFlowRate; // Supply air mass flow rate [kg/s] - Real64 SupplyAirVolFlowRateStdRho; // supply air volume flow using standard density [m3/s] + bool OutdoorAir; // Is there outdoor air? + int OutdoorAirNodeNum; // Node number of the outdoor air inlet node + HeatRecovery HtRecType; // Outdoor air heat recovery type - None, Sensible, Enthalpy + Real64 HtRecSenEff; // Sensible heat recovery effectiveness + Real64 HtRecLatEff; // Latent heat recovery effectiveness + Sched::Schedule *oaFlowFracSched = nullptr; // Fraction schedule applied to total OA requirement + Real64 MaxHeatMassFlowRate; // The maximum heating air mass flow rate [kg/s] + Real64 MaxCoolMassFlowRate; // The maximum cooling air mass flow rate [kg/s] + bool EMSOverrideMdotOn; // if true, then EMS is calling to override supply mass flow rate + Real64 EMSValueMassFlowRate; // Value EMS is directing to use for supply mass flow rate [kg/s] + bool EMSOverrideOAMdotOn; // if true, then EMS is calling to override OA mass flow rate + Real64 EMSValueOAMassFlowRate; // Value EMS is directing to use for OA mass flow rate [kg/s] + bool EMSOverrideSupplyTempOn; // if true, then EMS is calling to override supply temperature + Real64 EMSValueSupplyTemp; // Value EMS is directing to use for supply temperature [C] + bool EMSOverrideSupplyHumRatOn; // if true, then EMS is calling to override supply humidity ratio + Real64 EMSValueSupplyHumRat; // Value EMS is directing to use for supply humidity ratio [kgWater/kgDryAir] + Real64 MinOAMassFlowRate; // The minimum required outdoor air mass flow rate [kg/s] + Real64 OutdoorAirMassFlowRate; // The outdoor air mass flow rate [kg/s] + Real64 OutdoorAirVolFlowRateStdRho; // The outdoor air volume flow rate using standard density [m3/s] + Real64 SupplyAirMassFlowRate; // Supply air mass flow rate [kg/s] + Real64 SupplyAirVolFlowRateStdRho; // supply air volume flow using standard density [m3/s] // Intermediate results Real64 HtRecSenOutput; // Sensible heating/cooling rate from heat recovery (<0 means cooling) [W] Real64 HtRecLatOutput; // Latent heating/cooling rate from heat recovery (<0 means cooling or dehumidfying) [W] @@ -281,20 +278,19 @@ namespace PurchasedAirManager { // Default Constructor ZonePurchasedAir() - : AvailSchedPtr(0), ZoneSupplyAirNodeNum(0), ZoneExhaustAirNodeNum(0), PlenumExhaustAirNodeNum(0), ReturnPlenumIndex(0), - PurchAirArrayIndex(0), ZoneRecircAirNodeNum(0), MaxHeatSuppAirTemp(0.0), MinCoolSuppAirTemp(0.0), MaxHeatSuppAirHumRat(0.0), - MinCoolSuppAirHumRat(0.0), HeatingLimit(LimitType::Invalid), MaxHeatVolFlowRate(0.0), MaxHeatSensCap(0.0), - CoolingLimit(LimitType::Invalid), MaxCoolVolFlowRate(0.0), MaxCoolTotCap(0.0), HeatSchedPtr(0), CoolSchedPtr(0), - DehumidCtrlType(HumControl::Invalid), CoolSHR(0.0), HumidCtrlType(HumControl::Invalid), OARequirementsPtr(0), DCVType(DCV::Invalid), - EconomizerType(Econ::Invalid), OutdoorAir(false), OutdoorAirNodeNum(0), HtRecType(HeatRecovery::Invalid), HtRecSenEff(0.0), - HtRecLatEff(0.0), OAFlowFracSchPtr(0), MaxHeatMassFlowRate(0.0), MaxCoolMassFlowRate(0.0), EMSOverrideMdotOn(false), - EMSValueMassFlowRate(0.0), EMSOverrideOAMdotOn(false), EMSValueOAMassFlowRate(0.0), EMSOverrideSupplyTempOn(false), - EMSValueSupplyTemp(0.0), EMSOverrideSupplyHumRatOn(false), EMSValueSupplyHumRat(0.0), MinOAMassFlowRate(0.0), - OutdoorAirMassFlowRate(0.0), OutdoorAirVolFlowRateStdRho(0.0), SupplyAirMassFlowRate(0.0), SupplyAirVolFlowRateStdRho(0.0), - HtRecSenOutput(0.0), HtRecLatOutput(0.0), OASenOutput(0.0), OALatOutput(0.0), SenOutputToZone(0.0), LatOutputToZone(0.0), - SenCoilLoad(0.0), LatCoilLoad(0.0), OAFlowMaxCoolOutputError(0), OAFlowMaxHeatOutputError(0), SaturationOutputError(0), - OAFlowMaxCoolOutputIndex(0), OAFlowMaxHeatOutputIndex(0), SaturationOutputIndex(0), CoolErrIndex(0), HeatErrIndex(0), - SenHeatEnergy(0.0), LatHeatEnergy(0.0), TotHeatEnergy(0.0), SenCoolEnergy(0.0), LatCoolEnergy(0.0), TotCoolEnergy(0.0), + : ZoneSupplyAirNodeNum(0), ZoneExhaustAirNodeNum(0), PlenumExhaustAirNodeNum(0), ReturnPlenumIndex(0), PurchAirArrayIndex(0), + ZoneRecircAirNodeNum(0), MaxHeatSuppAirTemp(0.0), MinCoolSuppAirTemp(0.0), MaxHeatSuppAirHumRat(0.0), MinCoolSuppAirHumRat(0.0), + HeatingLimit(LimitType::Invalid), MaxHeatVolFlowRate(0.0), MaxHeatSensCap(0.0), CoolingLimit(LimitType::Invalid), + MaxCoolVolFlowRate(0.0), MaxCoolTotCap(0.0), DehumidCtrlType(HumControl::Invalid), CoolSHR(0.0), HumidCtrlType(HumControl::Invalid), + OARequirementsPtr(0), DCVType(DCV::Invalid), EconomizerType(Econ::Invalid), OutdoorAir(false), OutdoorAirNodeNum(0), + HtRecType(HeatRecovery::Invalid), HtRecSenEff(0.0), HtRecLatEff(0.0), MaxHeatMassFlowRate(0.0), MaxCoolMassFlowRate(0.0), + EMSOverrideMdotOn(false), EMSValueMassFlowRate(0.0), EMSOverrideOAMdotOn(false), EMSValueOAMassFlowRate(0.0), + EMSOverrideSupplyTempOn(false), EMSValueSupplyTemp(0.0), EMSOverrideSupplyHumRatOn(false), EMSValueSupplyHumRat(0.0), + MinOAMassFlowRate(0.0), OutdoorAirMassFlowRate(0.0), OutdoorAirVolFlowRateStdRho(0.0), SupplyAirMassFlowRate(0.0), + SupplyAirVolFlowRateStdRho(0.0), HtRecSenOutput(0.0), HtRecLatOutput(0.0), OASenOutput(0.0), OALatOutput(0.0), SenOutputToZone(0.0), + LatOutputToZone(0.0), SenCoilLoad(0.0), LatCoilLoad(0.0), OAFlowMaxCoolOutputError(0), OAFlowMaxHeatOutputError(0), + SaturationOutputError(0), OAFlowMaxCoolOutputIndex(0), OAFlowMaxHeatOutputIndex(0), SaturationOutputIndex(0), CoolErrIndex(0), + HeatErrIndex(0), SenHeatEnergy(0.0), LatHeatEnergy(0.0), TotHeatEnergy(0.0), SenCoolEnergy(0.0), LatCoolEnergy(0.0), TotCoolEnergy(0.0), ZoneSenHeatEnergy(0.0), ZoneLatHeatEnergy(0.0), ZoneTotHeatEnergy(0.0), ZoneSenCoolEnergy(0.0), ZoneLatCoolEnergy(0.0), ZoneTotCoolEnergy(0.0), OASenHeatEnergy(0.0), OALatHeatEnergy(0.0), OATotHeatEnergy(0.0), OASenCoolEnergy(0.0), OALatCoolEnergy(0.0), OATotCoolEnergy(0.0), HtRecSenHeatEnergy(0.0), HtRecLatHeatEnergy(0.0), HtRecTotHeatEnergy(0.0), HtRecSenCoolEnergy(0.0), @@ -408,6 +404,10 @@ struct PurchasedAirManagerData : BaseGlobalStruct Array1D TempPurchAirPlenumArrays; // Used to save the indices of scalable sizing object for zone HVAC + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/PythonEngine.cc b/src/EnergyPlus/PythonEngine.cc index a01f7177820..ef5a28a27da 100644 --- a/src/EnergyPlus/PythonEngine.cc +++ b/src/EnergyPlus/PythonEngine.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -51,19 +51,19 @@ #include #if LINK_WITH_PYTHON -#ifdef _DEBUG +# ifdef _DEBUG // We don't want to try to import a debug build of Python here // so if we are building a Debug build of the C++ code, we need // to undefine _DEBUG during the #include command for Python.h. // Otherwise it will fail -#undef _DEBUG -#include -#define _DEBUG -#else -#include -#endif - -#include +# undef _DEBUG +# include +# define _DEBUG +# else +# include +# endif + +# include namespace fmt { template <> struct formatter { diff --git a/src/EnergyPlus/PythonEngine.hh b/src/EnergyPlus/PythonEngine.hh index 41c4dd26cea..c091d4b64b6 100644 --- a/src/EnergyPlus/PythonEngine.hh +++ b/src/EnergyPlus/PythonEngine.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -51,10 +51,10 @@ #include #if LINK_WITH_PYTHON -#ifndef PyObject_HEAD +# ifndef PyObject_HEAD struct _object; using PyObject = _object; -#endif +# endif #endif namespace EnergyPlus { diff --git a/src/EnergyPlus/RefrigeratedCase.cc b/src/EnergyPlus/RefrigeratedCase.cc index ec4e4873db0..1cbb9abe433 100644 --- a/src/EnergyPlus/RefrigeratedCase.cc +++ b/src/EnergyPlus/RefrigeratedCase.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -52,7 +52,7 @@ // ObjexxFCL Headers #include #include -#include +// #include // EnergyPlus Headers #include @@ -114,7 +114,7 @@ namespace EnergyPlus::RefrigeratedCase { // sensible case credit). The case (evaporator) fans are assumed to be disabled during hot-gas or // electric defrost modes. A stocking schedule (W/m) is available for added load if desired. // Walk-In coolers are simulated based on the specified sum of the conductance*area of each wall and door facing -// up to three (extendible) zones. Two types of doors are specified, stock doors and glass doors. For each category +// up to three (extensible) zones. Two types of doors are specified, stock doors and glass doors. For each category // of doors, schedules for door openings are used with ASHRAE models for infiltration // which are a function of the height of the door. That // infiltration is used to calculate the latent load on the cooler and the latent case credits for each zone. @@ -305,10 +305,9 @@ void GetRefrigerationInput(EnergyPlusData &state) static constexpr std::string_view TrackMessage("from refrigerated case"); static constexpr std::string_view RoutineName("GetRefrigerationInput: "); + static constexpr std::string_view routineName = "GetRefrigerationInput"; static constexpr std::string_view TrackMessageAlt("GetInput in RefrigeratedCase"); - static constexpr std::string_view RoutineNameNoColon("GetRefrigerationInput"); - int constexpr AlwaysOn(-1); // -1 pointer sent to schedule manager returns a value of 1.0 // input in both watts and flow rate int constexpr NumWIAlphaFieldsBeforeZoneInput(9); // Used to cycle through zones on input for walk in coolers int constexpr NumWIAlphaFieldsPerZone(4); // Used to cycle through zones on input for walk in coolers @@ -319,17 +318,15 @@ void GetRefrigerationInput(EnergyPlusData &state) Real64 constexpr CondARI490DelT(15.0); // Rated sat cond temp - wet bulb air T for evap-cooled Cond w R22, ARI490 Real64 constexpr CondARI490Tcond(40.6); // Rated sat cond temp for evap-cooled cond with R22, ARI 490 Real64 constexpr DelEvapTDefault(5.0); // default difference between case T and evap T (C) - Real64 constexpr HoursPerDay(24.0); - Real64 constexpr SecondsPerHour(3600.0); - Real64 constexpr DefaultCascadeCondApproach(3.0); // Cascade condenser approach temperature difference (deltaC) - Real64 constexpr DefaultCircRate(2.5); // Phase change liquid overfeed circulating rate (ASHRAE definition) - Real64 constexpr DefaultWISurfaceUValue(0.3154); // equiv R18 in Archaic American units (W/m2-delta T) - Real64 constexpr DefaultWIUValueGlassDr(1.136); // equiv R5 in Archaic American units (W/m2-delta T) - Real64 constexpr DefaultWIUValueStockDr(0.3785); // equiv R15 in Archaic American units (W/m2-delta T) - Real64 constexpr DefaultWIHeightGlassDr(1.5); // glass door height in walk-in cooler (m) - Real64 constexpr DefaultWIHeightStockDr(3.0); // stock door height in walk-in cooler (m) - Real64 constexpr PumpImpellerEfficiency(0.78); // same as used in pump auto-sizing, dimensionless - Real64 constexpr PumpMotorEfficiency(0.85); // suggested as average value in ITT/Gould pump references, + Real64 constexpr DefaultCascadeCondApproach(3.0); // Cascade condenser approach temperature difference (deltaC) + Real64 constexpr DefaultCircRate(2.5); // Phase change liquid overfeed circulating rate (ASHRAE definition) + Real64 constexpr DefaultWISurfaceUValue(0.3154); // equiv R18 in Archaic American units (W/m2-delta T) + Real64 constexpr DefaultWIUValueGlassDr(1.136); // equiv R5 in Archaic American units (W/m2-delta T) + Real64 constexpr DefaultWIUValueStockDr(0.3785); // equiv R15 in Archaic American units (W/m2-delta T) + Real64 constexpr DefaultWIHeightGlassDr(1.5); // glass door height in walk-in cooler (m) + Real64 constexpr DefaultWIHeightStockDr(3.0); // stock door height in walk-in cooler (m) + Real64 constexpr PumpImpellerEfficiency(0.78); // same as used in pump auto-sizing, dimensionless + Real64 constexpr PumpMotorEfficiency(0.85); // suggested as average value in ITT/Gould pump references, Array1D_string Alphas; // Alpha items for object Array1D_string cAlphaFieldNames; // Alpha field names (from input processor) @@ -503,7 +500,7 @@ void GetRefrigerationInput(EnergyPlusData &state) if (NumCompressorLists > 0) CompressorLists.allocate(NumCompressorLists); if (state.dataRefrigCase->NumSimulationTransferLoadLists > 0) TransferLoadList.allocate(state.dataRefrigCase->NumSimulationTransferLoadLists); - DayValues.allocate(state.dataGlobal->NumOfTimeStepInHour, 24); + DayValues.allocate(state.dataGlobal->TimeStepsInHour, Constant::iHoursInDay); state.dataRefrigCase->RefrigPresentInZone.dimension(state.dataGlobal->NumOfZones, false); state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, "Refrigeration:Case", MaxNumArgs, MaxNumAlphasCase, MaxNumNumbersCase); @@ -589,6 +586,8 @@ void GetRefrigerationInput(EnergyPlusData &state) cAlphaFieldNames, cNumericFieldNames); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + ++NumDisplayCases; AlphaNum = 1; @@ -596,30 +595,14 @@ void GetRefrigerationInput(EnergyPlusData &state) RefrigCase(CaseNum).Name = Alphas(AlphaNum); AlphaNum = 2; - if (!lAlphaBlanks(AlphaNum)) { - RefrigCase(CaseNum).SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(AlphaNum)); // convert schedule name to pointer - if (RefrigCase(CaseNum).SchedPtr == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} not found: {}", - RoutineName, - CurrentModuleObject, - RefrigCase(CaseNum).Name, - cAlphaFieldNames(AlphaNum), - Alphas(AlphaNum))); - ErrorsFound = true; - } // ptr == 0 - } else { // no schedule specified - RefrigCase(CaseNum).SchedPtr = AlwaysOn; - } // not blank - - // check availability schedule for values between 0 and 1 - if (RefrigCase(CaseNum).SchedPtr > 0) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, RefrigCase(CaseNum).SchedPtr, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, RefrigCase(CaseNum).Name)); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFieldNames(AlphaNum), Alphas(AlphaNum))); - ShowContinueError(state, "schedule values must be (>=0., <=1.)"); - ErrorsFound = true; - } + if (lAlphaBlanks(AlphaNum)) { + RefrigCase(CaseNum).availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((RefrigCase(CaseNum).availSched = Sched::GetSchedule(state, Alphas(AlphaNum))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(AlphaNum), Alphas(AlphaNum)); + ErrorsFound = true; + } else if (!RefrigCase(CaseNum).availSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFieldNames(AlphaNum), Alphas(AlphaNum), Clusive::In, 0.0, Clusive::In, 1.0); + ErrorsFound = true; } // Get the Zone node number from the zone name entered by the user @@ -823,30 +806,14 @@ void GetRefrigerationInput(EnergyPlusData &state) RefrigCase(CaseNum).LightingPower = RefrigCase(CaseNum).RatedLightingPower; } // blank input - if (!lAlphaBlanks(6)) { - RefrigCase(CaseNum).LightingSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(6)); // convert schedule name to pointer - if (RefrigCase(CaseNum).LightingSchedPtr == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} not found: {}", - RoutineName, - CurrentModuleObject, - RefrigCase(CaseNum).Name, - cAlphaFieldNames(6), - Alphas(6))); - ErrorsFound = true; - } // ptr == 0 - } else { // no schedule specified - RefrigCase(CaseNum).LightingSchedPtr = AlwaysOn; - } // not blank - - // check lighting schedule for values between 0 and 1 - if (RefrigCase(CaseNum).LightingSchedPtr > 0) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, RefrigCase(CaseNum).LightingSchedPtr, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, RefrigCase(CaseNum).Name)); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFieldNames(6), Alphas(6))); - ShowContinueError(state, "schedule values must be (>=0., <=1.)"); - ErrorsFound = true; - } + if (lAlphaBlanks(6)) { + RefrigCase(CaseNum).lightingSched = Sched::GetScheduleAlwaysOn(state); // Not an availability schedule, but defaults to constant-1.0 + } else if ((RefrigCase(CaseNum).lightingSched = Sched::GetSchedule(state, Alphas(6))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(6), Alphas(6)); + ErrorsFound = true; + } else if (!RefrigCase(CaseNum).lightingSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFieldNames(6), Alphas(6), Clusive::In, 0.0, Clusive::In, 1.0); + ErrorsFound = true; } NumNum = 12; @@ -1071,84 +1038,56 @@ void GetRefrigerationInput(EnergyPlusData &state) ErrorsFound = true; } - RefrigCase(CaseNum).DefrostSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(9)); // convert schedule name to pointer - if (RefrigCase(CaseNum).DefrostSchedPtr == 0 && RefrigCase(CaseNum).defrostType != RefCaseDefrostType::None) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} not found: {}", - RoutineName, - CurrentModuleObject, - RefrigCase(CaseNum).Name, - cAlphaFieldNames(9), - Alphas(9))); - ShowContinueError(state, format("required when {}=\"{}\".", cAlphaFieldNames(8), Alphas(8))); + if (RefrigCase(CaseNum).defrostType == RefCaseDefrostType::None) { + } else if (lAlphaBlanks(9)) { + ShowSevereEmptyField(state, eoh, cAlphaFieldNames(9)); + ErrorsFound = true; + } else if ((RefrigCase(CaseNum).defrostSched = Sched::GetSchedule(state, Alphas(9))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(9), Alphas(9)); + ErrorsFound = true; + } else if (!RefrigCase(CaseNum).defrostSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFieldNames(9), Alphas(9), Clusive::In, 0.0, Clusive::In, 1.0); ErrorsFound = true; } - // check defrost schedule for values between 0 and 1 - if (RefrigCase(CaseNum).DefrostSchedPtr > 0) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, RefrigCase(CaseNum).DefrostSchedPtr, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{}{}=\"{}\".", RoutineName, CurrentModuleObject, RefrigCase(CaseNum).Name)); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFieldNames(9), Alphas(9))); - ShowContinueError(state, "schedule values must be (>=0., <=1.)"); - ErrorsFound = true; - } - } // Note that next section counting number cycles and setting maxkgfrost not used now, but may be in the future. // count the number of defrost cycles // Flag for counting defrost cycles - bool StartCycle = false; int NumDefCycles = 0; - DayValues = 0.0; - ScheduleManager::GetScheduleValuesForDay(state, RefrigCase(CaseNum).DefrostSchedPtr, DayValues, 1); - for (int HRNum = 1; HRNum <= 24; ++HRNum) { - for (int TSNum = 1; TSNum <= state.dataGlobal->NumOfTimeStepInHour; ++TSNum) { - if (DayValues(TSNum, HRNum) > 0.0) { - if (!StartCycle) { - ++NumDefCycles; - StartCycle = true; - } - } else { + + if (RefrigCase(CaseNum).defrostSched != nullptr) { + bool StartCycle = false; + std::vector const &dayVals = RefrigCase(CaseNum).defrostSched->getDayVals(state, 1); + for (int i = 0; i < Constant::iHoursInDay * state.dataGlobal->TimeStepsInHour; ++i) { + if (dayVals[i] == 0.0) { StartCycle = false; + } else if (!StartCycle) { + ++NumDefCycles; + StartCycle = true; } } } if (NumDefCycles > 0) { // calculate maximum frost formation based on defrost schedule, heat of vaporization+fusion for water = 2833.0 kJ/kg - RefrigCase(CaseNum).MaxKgFrost = (RefrigCase(CaseNum).RateTotCapPerLength * RefrigCase(CaseNum).RatedLHR * - RefrigCase(CaseNum).RatedRTF * SecondsPerHour * HoursPerDay / 1000.0 / 2833.0) / - (NumDefCycles); + RefrigCase(CaseNum).MaxKgFrost = + (RefrigCase(CaseNum).RateTotCapPerLength * RefrigCase(CaseNum).RatedLHR * RefrigCase(CaseNum).RatedRTF * Constant::rSecsInHour * + Constant::rHoursInDay / 1000.0 / 2833.0) / // Parenthesize!!! + (NumDefCycles); } else { RefrigCase(CaseNum).MaxKgFrost = 9999999.9; } // some defrost types do not use drip-down schedules, use same defrost schedule pointer in that case - if (!lAlphaBlanks(10)) { - RefrigCase(CaseNum).DefrostDripDownSchedPtr = - ScheduleManager::GetScheduleIndex(state, Alphas(10)); // convert schedule name to pointer - if (RefrigCase(CaseNum).DefrostDripDownSchedPtr == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} not found: {}", - RoutineName, - CurrentModuleObject, - RefrigCase(CaseNum).Name, - cAlphaFieldNames(10), - Alphas(10))); - ErrorsFound = true; - } - } else { - RefrigCase(CaseNum).DefrostDripDownSchedPtr = RefrigCase(CaseNum).DefrostSchedPtr; - } - - // check defrost drip-down schedule for values between 0 and 1 - if (RefrigCase(CaseNum).DefrostDripDownSchedPtr > 0 && (!lAlphaBlanks(10))) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, RefrigCase(CaseNum).DefrostDripDownSchedPtr, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{}{}=\"{}\".", RoutineName, CurrentModuleObject, RefrigCase(CaseNum).Name)); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFieldNames(10), Alphas(10))); - ShowContinueError(state, "schedule values must be (>=0., <=1.)"); - ErrorsFound = true; - } + if (lAlphaBlanks(10)) { + RefrigCase(CaseNum).defrostDripDownSched = RefrigCase(CaseNum).defrostSched; + } else if ((RefrigCase(CaseNum).defrostDripDownSched = Sched::GetSchedule(state, Alphas(10))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(10), Alphas(10)); + ErrorsFound = true; + } else if (!RefrigCase(CaseNum).defrostDripDownSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFieldNames(10), Alphas(10), Clusive::In, 0.0, Clusive::In, 1.0); + ErrorsFound = true; } if (Util::SameString(Alphas(11), "CaseTemperatureMethod")) { @@ -1280,20 +1219,10 @@ void GetRefrigerationInput(EnergyPlusData &state) CaseRAFraction(RefrigCase(CaseNum).ActualZoneNum).ZoneName = RefrigCase(CaseNum).ZoneName; } - RefrigCase(CaseNum).StockingSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(13)); // convert schedule name to pointer - if (!lAlphaBlanks(13)) { - if (RefrigCase(CaseNum).StockingSchedPtr == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} not found: {}", - RoutineName, - CurrentModuleObject, - RefrigCase(CaseNum).Name, - cAlphaFieldNames(13), - Alphas(13))); - ErrorsFound = true; - } - } else { - RefrigCase(CaseNum).StockingSchedPtr = 0; + if (lAlphaBlanks(13)) { + } else if ((RefrigCase(CaseNum).stockingSched = Sched::GetSchedule(state, Alphas(13))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(13), Alphas(13)); + ErrorsFound = true; } // calculate sensible case load at design conditions @@ -1321,30 +1250,13 @@ void GetRefrigerationInput(EnergyPlusData &state) ErrorsFound = true; } - RefrigCase(CaseNum).CaseCreditFracSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(14)); // convert schedule name to pointer - if (!lAlphaBlanks(14)) { - if (RefrigCase(CaseNum).CaseCreditFracSchedPtr == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} not found: {}", - RoutineName, - CurrentModuleObject, - RefrigCase(CaseNum).Name, - cAlphaFieldNames(14), - Alphas(14))); - ErrorsFound = true; - } - } else { - RefrigCase(CaseNum).CaseCreditFracSchedPtr = 0; - } - - // check case credit fraction schedule for values between 0 and 1 - if (RefrigCase(CaseNum).CaseCreditFracSchedPtr > 0) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, RefrigCase(CaseNum).CaseCreditFracSchedPtr, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{}{}=\"{}\".", RoutineName, CurrentModuleObject, RefrigCase(CaseNum).Name)); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFieldNames(14), Alphas(14))); - ShowContinueError(state, "schedule values must be (>=0., <=1.)"); - ErrorsFound = true; - } + if (lAlphaBlanks(14)) { + } else if ((RefrigCase(CaseNum).caseCreditFracSched = Sched::GetSchedule(state, Alphas(14))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(14), Alphas(14)); + ErrorsFound = true; + } else if (!RefrigCase(CaseNum).caseCreditFracSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFieldNames(14), Alphas(14), Clusive::In, 0.0, Clusive::In, 1.0); + ErrorsFound = true; } RefrigCase(CaseNum).DesignRatedCap = RefrigCase(CaseNum).RateTotCapPerLength * RefrigCase(CaseNum).Length; @@ -1410,34 +1322,21 @@ void GetRefrigerationInput(EnergyPlusData &state) lAlphaBlanks, cAlphaFieldNames, cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + Util::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound); WalkIn(WalkInID).Name = Alphas(1); - if (!lAlphaBlanks(2)) { - WalkIn(WalkInID).SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (WalkIn(WalkInID).SchedPtr == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} not found: {}", - RoutineName, - CurrentModuleObject, - WalkIn(WalkInID).Name, - cAlphaFieldNames(2), - Alphas(2))); - ErrorsFound = true; - } // ptr == 0 - } else { // no schedule specified - WalkIn(WalkInID).SchedPtr = AlwaysOn; - } // not blank - - // check availability schedule for values between 0 and 1 - if (WalkIn(WalkInID).SchedPtr > 0) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, WalkIn(WalkInID).SchedPtr, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, WalkIn(WalkInID).Name)); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFieldNames(2), Alphas(2))); - ShowContinueError(state, "schedule values must be (>=0., <=1.)"); - ErrorsFound = true; - } + if (lAlphaBlanks(2)) { + WalkIn(WalkInID).availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((WalkIn(WalkInID).availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), Alphas(2)); + ErrorsFound = true; + } else if (!WalkIn(WalkInID).availSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFieldNames(2), Alphas(2), Clusive::In, 0.0, Clusive::In, 1.0); + ErrorsFound = true; } WalkIn(WalkInID).DesignRatedCap = Numbers(1); @@ -1474,31 +1373,14 @@ void GetRefrigerationInput(EnergyPlusData &state) } AlphaNum = 3; - if (!lAlphaBlanks(AlphaNum)) { - WalkIn(WalkInID).HeaterSchedPtr = - ScheduleManager::GetScheduleIndex(state, Alphas(AlphaNum)); // convert heater schedule name to pointer - if (WalkIn(WalkInID).HeaterSchedPtr == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} not found: {}", - RoutineName, - CurrentModuleObject, - WalkIn(WalkInID).Name, - cAlphaFieldNames(AlphaNum), - Alphas(AlphaNum))); - ErrorsFound = true; - } // ptr == 0 - } else { // no schedule specified - WalkIn(WalkInID).HeaterSchedPtr = AlwaysOn; - } // not blank - - // check heater schedule for values between 0 and 1 - if (WalkIn(WalkInID).HeaterSchedPtr > 0) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, WalkIn(WalkInID).HeaterSchedPtr, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, WalkIn(WalkInID).Name)); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFieldNames(AlphaNum), Alphas(AlphaNum))); - ShowContinueError(state, "schedule values must be (>=0., <=1.)"); - ErrorsFound = true; - } + if (lAlphaBlanks(AlphaNum)) { + WalkIn(WalkInID).heaterSched = Sched::GetScheduleAlwaysOn(state); // Not an availability schedule, but defaults to constant-1.0 + } else if ((WalkIn(WalkInID).heaterSched = Sched::GetSchedule(state, Alphas(AlphaNum))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(AlphaNum), Alphas(AlphaNum)); + ErrorsFound = true; + } else if (!WalkIn(WalkInID).heaterSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFieldNames(AlphaNum), Alphas(AlphaNum), Clusive::In, 0.0, Clusive::In, 1.0); + ErrorsFound = true; } if (!lNumericBlanks(5) && Numbers(5) > 0.0) { @@ -1537,30 +1419,14 @@ void GetRefrigerationInput(EnergyPlusData &state) } AlphaNum = 4; - if (!lAlphaBlanks(AlphaNum)) { - WalkIn(WalkInID).LightingSchedPtr = - ScheduleManager::GetScheduleIndex(state, Alphas(AlphaNum)); // convert lighting schedule name to pointer - if (WalkIn(WalkInID).LightingSchedPtr == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} not found: {}", - RoutineName, - CurrentModuleObject, - WalkIn(WalkInID).Name, - cAlphaFieldNames(AlphaNum), - Alphas(AlphaNum))); - ErrorsFound = true; - } // ptr == 0 - } else { // no schedule specified - WalkIn(WalkInID).LightingSchedPtr = AlwaysOn; - } // schedule name not blank - // check Lighting schedule for values between 0 and 1 - if (WalkIn(WalkInID).LightingSchedPtr > 0) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, WalkIn(WalkInID).LightingSchedPtr, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, WalkIn(WalkInID).Name)); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFieldNames(AlphaNum), Alphas(AlphaNum))); - ShowContinueError(state, "schedule values must be (>=0., <=1.)"); - ErrorsFound = true; - } + if (lAlphaBlanks(AlphaNum)) { + WalkIn(WalkInID).lightingSched = Sched::GetScheduleAlwaysOn(state); // Not an availability schedule, but defaults to constant-1.0 + } else if ((WalkIn(WalkInID).lightingSched = Sched::GetSchedule(state, Alphas(AlphaNum))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(AlphaNum), Alphas(AlphaNum)); + ErrorsFound = true; + } else if (!WalkIn(WalkInID).lightingSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFieldNames(AlphaNum), Alphas(AlphaNum), Clusive::In, 0.0, Clusive::In, 1.0); + ErrorsFound = true; } // Input walk-in cooler defrost information @@ -1602,53 +1468,29 @@ void GetRefrigerationInput(EnergyPlusData &state) // convert defrost schedule name to pointer AlphaNum = 7; - WalkIn(WalkInID).DefrostSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(AlphaNum)); - if (WalkIn(WalkInID).DefrostSchedPtr == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} not found: {}", - RoutineName, - CurrentModuleObject, - WalkIn(WalkInID).Name, - cAlphaFieldNames(AlphaNum), - Alphas(AlphaNum))); + + if (lAlphaBlanks(AlphaNum)) { + ShowSevereEmptyField(state, eoh, cAlphaFieldNames(AlphaNum)); + ErrorsFound = true; + } else if ((WalkIn(WalkInID).defrostSched = Sched::GetSchedule(state, Alphas(AlphaNum))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(AlphaNum), Alphas(AlphaNum)); + ErrorsFound = true; + } else if (!WalkIn(WalkInID).defrostSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFieldNames(AlphaNum), Alphas(AlphaNum), Clusive::In, 0.0, Clusive::In, 1.0); ErrorsFound = true; - } - // check defrost schedule for values between 0 and 1 - if (WalkIn(WalkInID).DefrostSchedPtr > 0) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, WalkIn(WalkInID).DefrostSchedPtr, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{}{} = \"{}\"", RoutineName, CurrentModuleObject, WalkIn(WalkInID).Name)); - ShowContinueError(state, format("Error found in {}={}", cAlphaFieldNames(AlphaNum), Alphas(AlphaNum))); - ShowContinueError(state, "schedule values must be (>=0., <=1.)"); - ErrorsFound = true; - } } // convert defrost drip-down schedule name to pointer // some defrost types do not use drip-down schedules, use same defrost schedule pointer in that case AlphaNum = 8; - if (!lAlphaBlanks(AlphaNum)) { - WalkIn(WalkInID).DefrostDripDownSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(AlphaNum)); - if (WalkIn(WalkInID).DefrostDripDownSchedPtr == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} not found: {}", - RoutineName, - CurrentModuleObject, - WalkIn(WalkInID).Name, - cAlphaFieldNames(AlphaNum), - Alphas(AlphaNum))); - ErrorsFound = true; - } - // check schedule for values between 0 and 1 - if (WalkIn(WalkInID).DefrostDripDownSchedPtr > 0) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, WalkIn(WalkInID).DefrostDripDownSchedPtr, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, WalkIn(WalkInID).Name)); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFieldNames(AlphaNum), Alphas(AlphaNum))); - ShowContinueError(state, "schedule values must be (>=0., <=1.)"); - ErrorsFound = true; - } - } - } else { // blank input so use drip down schedule for defrost - WalkIn(WalkInID).DefrostDripDownSchedPtr = WalkIn(WalkInID).DefrostSchedPtr; + if (lAlphaBlanks(AlphaNum)) { // blank input so use drip down schedule for defrost + WalkIn(WalkInID).defrostDripDownSched = WalkIn(WalkInID).defrostSched; + } else if ((WalkIn(WalkInID).defrostDripDownSched = Sched::GetSchedule(state, Alphas(AlphaNum))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(AlphaNum), Alphas(AlphaNum)); + ErrorsFound = true; + } else if (!WalkIn(WalkInID).defrostDripDownSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFieldNames(AlphaNum), Alphas(AlphaNum), Clusive::In, 0.0, Clusive::In, 1.0); + ErrorsFound = true; } if (WalkIn(WalkInID).defrostType == WalkinClrDefrostType::OffCycle || WalkIn(WalkInID).defrostType == WalkinClrDefrostType::None) { @@ -1690,20 +1532,10 @@ void GetRefrigerationInput(EnergyPlusData &state) // convert restocking schedule name to pointer, default of 0.1 is assigned inside walkin subroutine if blank AlphaNum = 9; if (lAlphaBlanks(AlphaNum)) { - WalkIn(WalkInID).StockingSchedPtr = 0; - } else { - WalkIn(WalkInID).StockingSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(AlphaNum)); - if (WalkIn(WalkInID).StockingSchedPtr == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} not found: {}", - RoutineName, - CurrentModuleObject, - WalkIn(WalkInID).Name, - cAlphaFieldNames(AlphaNum), - Alphas(AlphaNum))); - ErrorsFound = true; - } - } // blank + } else if ((WalkIn(WalkInID).stockingSched = Sched::GetSchedule(state, Alphas(AlphaNum))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(AlphaNum), Alphas(AlphaNum)); + ErrorsFound = true; + } WalkIn(WalkInID).DesignRefrigInventory = 0.0; if (!lNumericBlanks(10)) WalkIn(WalkInID).DesignRefrigInventory = Numbers(10); @@ -1748,11 +1580,11 @@ void GetRefrigerationInput(EnergyPlusData &state) if (!allocated(WalkIn(WalkInID).SurfaceArea)) WalkIn(WalkInID).SurfaceArea.allocate(NumZones) = 0.0; if (!allocated(WalkIn(WalkInID).UValue)) WalkIn(WalkInID).UValue.allocate(NumZones) = 0.0; if (!allocated(WalkIn(WalkInID).UValueGlassDr)) WalkIn(WalkInID).UValueGlassDr.allocate(NumZones) = 0.0; - if (!allocated(WalkIn(WalkInID).GlassDoorOpenSchedPtr)) WalkIn(WalkInID).GlassDoorOpenSchedPtr.allocate(NumZones) = 0; + if (!allocated(WalkIn(WalkInID).glassDoorOpenScheds)) WalkIn(WalkInID).glassDoorOpenScheds.allocate(NumZones) = nullptr; // What is this? if (!allocated(WalkIn(WalkInID).AreaGlassDr)) WalkIn(WalkInID).AreaGlassDr.allocate(NumZones) = 0.0; if (!allocated(WalkIn(WalkInID).HeightGlassDr)) WalkIn(WalkInID).HeightGlassDr.allocate(NumZones) = 0.0; if (!allocated(WalkIn(WalkInID).UValueStockDr)) WalkIn(WalkInID).UValueStockDr.allocate(NumZones) = 0.0; - if (!allocated(WalkIn(WalkInID).StockDoorOpenSchedPtr)) WalkIn(WalkInID).StockDoorOpenSchedPtr.allocate(NumZones) = 0; + if (!allocated(WalkIn(WalkInID).stockDoorOpenScheds)) WalkIn(WalkInID).stockDoorOpenScheds.allocate(NumZones) = nullptr; // What is this? if (!allocated(WalkIn(WalkInID).StockDoorProtectType)) WalkIn(WalkInID).StockDoorProtectType.allocate(NumZones) = WIStockDoor::Invalid; if (!allocated(WalkIn(WalkInID).AreaStockDr)) WalkIn(WalkInID).AreaStockDr.allocate(NumZones) = 0.0; if (!allocated(WalkIn(WalkInID).HeightStockDr)) WalkIn(WalkInID).HeightStockDr.allocate(NumZones) = 0.0; @@ -1843,36 +1675,14 @@ void GetRefrigerationInput(EnergyPlusData &state) // convert door opening schedule name to pointer, default of 0.1 is assigned inside walkin subroutine if blank if (lAlphaBlanks(AStart + 1)) { - WalkIn(WalkInID).GlassDoorOpenSchedPtr(ZoneID) = 0; - } else { - WalkIn(WalkInID).GlassDoorOpenSchedPtr(ZoneID) = ScheduleManager::GetScheduleIndex(state, Alphas(AStart + 1)); - if (WalkIn(WalkInID).GlassDoorOpenSchedPtr(ZoneID) == 0) { - ShowSevereError(state, - format(R"({}{}="{}", Zone="{}", invalid {} not found: {})", - RoutineName, - CurrentModuleObject, - WalkIn(WalkInID).Name, - WalkIn(WalkInID).ZoneName(ZoneID), - cAlphaFieldNames(AStart + 1), - Alphas(AStart + 1))); - ErrorsFound = true; - } else { - // check schedule for values between 0 and 1 - if (!ScheduleManager::CheckScheduleValueMinMax( - state, WalkIn(WalkInID).GlassDoorOpenSchedPtr(ZoneID), ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, - format(R"({}{}="{}", Zone="{}")", - RoutineName, - CurrentModuleObject, - WalkIn(WalkInID).Name, - WalkIn(WalkInID).ZoneName(ZoneID))); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFieldNames(AStart + 1), Alphas(AStart + 1))); - ShowContinueError(state, "schedule values must be (>=0., <=1.)"); - ErrorsFound = true; - } // schedule values outside range - } // have schedule pointer - } // blank on door opening schedule (AStart + 1) - } // have glassdoor area facing zone (blank on lNumericBlanks(NStart+2)) + } else if ((WalkIn(WalkInID).glassDoorOpenScheds(ZoneID) = Sched::GetSchedule(state, Alphas(AStart + 1))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(AStart + 1), Alphas(AStart + 1)); + ErrorsFound = true; + } else if (!WalkIn(WalkInID).glassDoorOpenScheds(ZoneID)->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFieldNames(AStart + 1), Alphas(AStart + 1), Clusive::In, 0.0, Clusive::In, 1.0); + ErrorsFound = true; + } // blank on door opening schedule (AStart + 1) + } // have glassdoor area facing zone (blank on lNumericBlanks(NStart+2)) // start IF set for stock doors in this zone WalkIn(WalkInID).AreaStockDr(ZoneID) = 0.0; @@ -1889,35 +1699,13 @@ void GetRefrigerationInput(EnergyPlusData &state) // convert door opening schedule name to pointer, default of 0.1 is assigned inside walkin subroutine if blank if (lAlphaBlanks(AStart + 2)) { - WalkIn(WalkInID).StockDoorOpenSchedPtr(ZoneID) = 0; - } else { - WalkIn(WalkInID).StockDoorOpenSchedPtr(ZoneID) = ScheduleManager::GetScheduleIndex(state, Alphas(AStart + 2)); - if (WalkIn(WalkInID).StockDoorOpenSchedPtr(ZoneID) == 0) { - ShowSevereError(state, - format(R"({}{}="{}", Zone="{}", invalid {} not found: {})", - RoutineName, - CurrentModuleObject, - WalkIn(WalkInID).Name, - WalkIn(WalkInID).ZoneName(ZoneID), - cAlphaFieldNames(AStart + 2), - Alphas(AStart + 2))); - ErrorsFound = true; - } else { - // check schedule for values between 0 and 1 - if (!ScheduleManager::CheckScheduleValueMinMax( - state, WalkIn(WalkInID).StockDoorOpenSchedPtr(ZoneID), ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, - format(R"({}{}="{}", Zone="{}")", - RoutineName, - CurrentModuleObject, - WalkIn(WalkInID).Name, - WalkIn(WalkInID).ZoneName(ZoneID))); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFieldNames(AStart + 2), Alphas(AStart + 2))); - ShowContinueError(state, "schedule values must be (>=0., <=1.)"); - ErrorsFound = true; - } // schedule values outside range - } // have schedule pointer - } // blank on door opening schedule (AStart + 2) + } else if ((WalkIn(WalkInID).stockDoorOpenScheds(ZoneID) = Sched::GetSchedule(state, Alphas(AStart + 2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(AStart + 2), Alphas(AStart + 2)); + ErrorsFound = true; + } else if (!WalkIn(WalkInID).stockDoorOpenScheds(ZoneID)->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFieldNames(AStart + 2), Alphas(AStart + 2), Clusive::In, 0.0, Clusive::In, 1.0); + ErrorsFound = true; + } // blank on door opening schedule (AStart + 2) if (lAlphaBlanks(AStart + 3) || Util::SameString(Alphas(AStart + 3), "AirCurtain")) { // default air curtain @@ -1963,36 +1751,23 @@ void GetRefrigerationInput(EnergyPlusData &state) lAlphaBlanks, cAlphaFieldNames, cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + Util::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound); WarehouseCoil(CoilID).Name = Alphas(AlphaNum); // A2 ++AlphaNum; - if (!lAlphaBlanks(AlphaNum)) { - WarehouseCoil(CoilID).SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(AlphaNum)); // convert schedule name to pointer - if (WarehouseCoil(CoilID).SchedPtr == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} not found: {}", - RoutineName, - CurrentModuleObject, - WarehouseCoil(CoilID).Name, - cAlphaFieldNames(AlphaNum), - Alphas(AlphaNum))); - ErrorsFound = true; - } // ptr == 0 - } else { // no schedule specified - WarehouseCoil(CoilID).SchedPtr = AlwaysOn; - } // not blank - - // check availability schedule for values between 0 and 1 - if (WarehouseCoil(CoilID).SchedPtr > 0) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, WarehouseCoil(CoilID).SchedPtr, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, WarehouseCoil(CoilID).Name)); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFieldNames(AlphaNum), Alphas(AlphaNum))); - ShowContinueError(state, "schedule values must be (>=0., <=1.)"); - ErrorsFound = true; - } + if (lAlphaBlanks(AlphaNum)) { + WarehouseCoil(CoilID).availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((WarehouseCoil(CoilID).availSched = Sched::GetSchedule(state, Alphas(AlphaNum))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(AlphaNum), Alphas(AlphaNum)); + ErrorsFound = true; + } else if (!WarehouseCoil(CoilID).availSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFieldNames(AlphaNum), Alphas(AlphaNum), Clusive::In, 0.0, Clusive::In, 1.0); + ErrorsFound = true; } // Input capacity rating type @@ -2463,36 +2238,20 @@ void GetRefrigerationInput(EnergyPlusData &state) if (!lNumericBlanks(NumNum)) { WarehouseCoil(CoilID).HeaterPower = Numbers(NumNum); } else { - ShowSevereError(state, - std::string{RoutineName} + CurrentModuleObject + "=\"" + WarehouseCoil(CoilID).Name + "\", " + - cNumericFieldNames(NumNum) + " must be input "); + ShowSevereEmptyField(state, eoh, cNumericFieldNames(NumNum)); ErrorsFound = true; } ++AlphaNum; // A6 - if (!lAlphaBlanks(AlphaNum)) { - WarehouseCoil(CoilID).HeaterSchedPtr = - ScheduleManager::GetScheduleIndex(state, Alphas(AlphaNum)); // convert heater schedule name to pointer - if (WarehouseCoil(CoilID).HeaterSchedPtr == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} not found: {}", - RoutineName, - CurrentModuleObject, - WarehouseCoil(CoilID).Name, - cAlphaFieldNames(AlphaNum), - Alphas(AlphaNum))); - ErrorsFound = true; - } else { // check heater schedule for values between 0 and 1 - if (!ScheduleManager::CheckScheduleValueMinMax(state, WarehouseCoil(CoilID).HeaterSchedPtr, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, WarehouseCoil(CoilID).Name)); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFieldNames(AlphaNum), Alphas(AlphaNum))); - ShowContinueError(state, "schedule values must be (>=0., <=1.)"); - ErrorsFound = true; - } // heater schedule ptr == 0 - } // htr sched == 0 - } else { // lalphaBlanks, no schedule specified - WarehouseCoil(CoilID).HeaterSchedPtr = AlwaysOn; - } // not blank + if (lAlphaBlanks(AlphaNum)) { + WarehouseCoil(CoilID).heaterAvailSched = Sched::GetScheduleAlwaysOn(state); + } else if ((WarehouseCoil(CoilID).heaterAvailSched = Sched::GetSchedule(state, Alphas(AlphaNum))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(AlphaNum), Alphas(AlphaNum)); + ErrorsFound = true; + } else if (!WarehouseCoil(CoilID).heaterAvailSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFieldNames(AlphaNum), Alphas(AlphaNum), Clusive::In, 0.0, Clusive::In, 1.0); + ErrorsFound = true; + } // Input fan control type ++AlphaNum; // A7 @@ -2583,50 +2342,29 @@ void GetRefrigerationInput(EnergyPlusData &state) // convert defrost schedule name to pointer ++AlphaNum; // A10 - WarehouseCoil(CoilID).DefrostSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(AlphaNum)); - if (WarehouseCoil(CoilID).DefrostSchedPtr == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} not found: {}", - RoutineName, - CurrentModuleObject, - WarehouseCoil(CoilID).Name, - cAlphaFieldNames(AlphaNum), - Alphas(AlphaNum))); + if (lAlphaBlanks(AlphaNum)) { + ShowSevereEmptyField(state, eoh, cAlphaFieldNames(AlphaNum)); ErrorsFound = true; - } else { // check defrost schedule for values between 0 and 1 - if (!ScheduleManager::CheckScheduleValueMinMax(state, WarehouseCoil(CoilID).DefrostSchedPtr, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{}{} = \"{}\"", RoutineName, CurrentModuleObject, WarehouseCoil(CoilID).Name)); - ShowContinueError(state, format("Error found in {}={}", cAlphaFieldNames(AlphaNum), Alphas(AlphaNum))); - ShowContinueError(state, "schedule values must be (>=0., <=1.)"); - ErrorsFound = true; - } // checkschedulevalueMinMax - } // check for valid schedule name + } else if ((WarehouseCoil(CoilID).defrostSched = Sched::GetSchedule(state, Alphas(AlphaNum))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(AlphaNum), Alphas(AlphaNum)); + ErrorsFound = true; + } else if (!WarehouseCoil(CoilID).defrostSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFieldNames(AlphaNum), Alphas(AlphaNum), Clusive::In, 0.0, Clusive::In, 1.0); + ErrorsFound = true; + } // check for valid schedule name // convert defrost drip-down schedule name to pointer // some defrost types do not use drip-down schedules, use same defrost schedule pointer in that case ++AlphaNum; // A11 - if (!lAlphaBlanks(AlphaNum)) { - WarehouseCoil(CoilID).DefrostDripDownSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(AlphaNum)); - if (WarehouseCoil(CoilID).DefrostDripDownSchedPtr == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} not found: {}", - RoutineName, - CurrentModuleObject, - WarehouseCoil(CoilID).Name, - cAlphaFieldNames(AlphaNum), - Alphas(AlphaNum))); - ErrorsFound = true; - } else { // check schedule for values between 0 and 1 - if (!ScheduleManager::CheckScheduleValueMinMax(state, WarehouseCoil(CoilID).DefrostDripDownSchedPtr, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, WarehouseCoil(CoilID).Name)); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFieldNames(AlphaNum), Alphas(AlphaNum))); - ShowContinueError(state, "schedule values must be (>=0., <=1.)"); - ErrorsFound = true; - } // Check schedule value between 0 and 1 - } // Check if drip down schedule name is valid - } else { // .not. lAlphaBlanks so use drip down schedule for defrost - WarehouseCoil(CoilID).DefrostDripDownSchedPtr = WarehouseCoil(CoilID).DefrostSchedPtr; - } // .not. lAlphaBlanks + if (lAlphaBlanks(AlphaNum)) { + WarehouseCoil(CoilID).defrostDripDownSched = WarehouseCoil(CoilID).defrostSched; + } else if ((WarehouseCoil(CoilID).defrostDripDownSched = Sched::GetSchedule(state, Alphas(AlphaNum))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(AlphaNum), Alphas(AlphaNum)); + ErrorsFound = true; + } else if (!WarehouseCoil(CoilID).defrostDripDownSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFieldNames(AlphaNum), Alphas(AlphaNum), Clusive::In, 0.0, Clusive::In, 1.0); + ErrorsFound = true; + } // check for valid schedule name ++NumNum; // N14 if (WarehouseCoil(CoilID).defrostType == DefrostType::OffCycle || WarehouseCoil(CoilID).defrostType == DefrostType::None) { @@ -2712,36 +2450,23 @@ void GetRefrigerationInput(EnergyPlusData &state) lAlphaBlanks, cAlphaFieldNames, cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + AlphaNum = 1; Util::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound); AirChillerSet(SetID).Name = Alphas(AlphaNum); AlphaNum = 2; - if (!lAlphaBlanks(AlphaNum)) { - AirChillerSet(SetID).SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(AlphaNum)); // convert schedule name to pointer - if (AirChillerSet(SetID).SchedPtr == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} not found: {}", - RoutineName, - CurrentModuleObject, - AirChillerSet(SetID).Name, - cAlphaFieldNames(AlphaNum), - Alphas(AlphaNum))); - ErrorsFound = true; - } // ptr == 0 - } else { // no schedule specified - AirChillerSet(SetID).SchedPtr = AlwaysOn; - } // not blank - - // check availability schedule for values between 0 and 1 - if (AirChillerSet(SetID).SchedPtr > 0) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, AirChillerSet(SetID).SchedPtr, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, AirChillerSet(SetID).Name)); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFieldNames(AlphaNum), Alphas(AlphaNum))); - ShowContinueError(state, "schedule values must be (>=0., <=1.)"); - ErrorsFound = true; - } + if (lAlphaBlanks(AlphaNum)) { + AirChillerSet(SetID).availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((AirChillerSet(SetID).availSched = Sched::GetSchedule(state, Alphas(AlphaNum))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(AlphaNum), Alphas(AlphaNum)); + ErrorsFound = true; + } else if (!AirChillerSet(SetID).availSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFieldNames(AlphaNum), Alphas(AlphaNum), Clusive::In, 0.0, Clusive::In, 1.0); + ErrorsFound = true; } ++AlphaNum; @@ -2937,6 +2662,8 @@ void GetRefrigerationInput(EnergyPlusData &state) lAlphaBlanks, cAlphaFieldNames, cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; Util::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound); RefrigRack(RackNum).Name = Alphas(1); @@ -3094,23 +2821,12 @@ void GetRefrigerationInput(EnergyPlusData &state) // Get outlet temperature schedule for variable flow case if (RefrigRack(RackNum).FlowType == CndsrFlowType::VariableFlow) { if (lAlphaBlanks(9)) { - RefrigRack(RackNum).OutletTempSchedPtr = 0; - } else { - RefrigRack(RackNum).OutletTempSchedPtr = - ScheduleManager::GetScheduleIndex(state, Alphas(9)); // convert schedule name to pointer - } - if (RefrigRack(RackNum).OutletTempSchedPtr == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} : {}", - RoutineName, - CurrentModuleObject, - RefrigRack(RackNum).Name, - cAlphaFieldNames(9), - Alphas(9))); - ShowContinueError(state, "A schedule with this name is not defined in this input data file."); + } else if ((RefrigRack(RackNum).outletTempSched = Sched::GetSchedule(state, Alphas(9))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(9), Alphas(9)); ErrorsFound = true; } } + // Get volumetric flow rate if applicable if (RefrigRack(RackNum).FlowType == CndsrFlowType::ConstantFlow) { RefrigRack(RackNum).DesVolFlowRate = Numbers(3); @@ -3140,28 +2856,12 @@ void GetRefrigerationInput(EnergyPlusData &state) // Get evaporative cooled condenser input if (lAlphaBlanks(10)) { - RefrigRack(RackNum).EvapSchedPtr = 0; - } else { - RefrigRack(RackNum).EvapSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(10)); // convert schedule name to pointer - // check availability schedule for values >= 0 - if (RefrigRack(RackNum).EvapSchedPtr > 0) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, RefrigRack(RackNum).EvapSchedPtr, true, 0.0)) { - ShowSevereError(state, format("{}{}=\"{}\" .", RoutineName, CurrentModuleObject, RefrigRack(RackNum).Name)); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFieldNames(10), Alphas(10))); - ShowContinueError(state, "schedule values must be (>=0.)."); - ErrorsFound = true; - } - } else { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} = {}", - RoutineName, - CurrentModuleObject, - RefrigRack(RackNum).Name, - cAlphaFieldNames(10), - Alphas(10))); - ShowContinueError(state, "A schedule with this name is not defined in this input data file."); - ErrorsFound = true; - } + } else if ((RefrigRack(RackNum).evapAvailSched = Sched::GetSchedule(state, Alphas(10))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(10), Alphas(10)); + ErrorsFound = true; + } else if (!RefrigRack(RackNum).evapAvailSched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, cAlphaFieldNames(10), Alphas(10), Clusive::In, 0.0); + ErrorsFound = true; } RefrigRack(RackNum).EvapEffect = Numbers(7); @@ -3449,7 +3149,7 @@ void GetRefrigerationInput(EnergyPlusData &state) if (state.dataRefrigCase->NumRefrigSystems > 0 && state.dataRefrigCase->NumRefrigCondensers == 0) { ShowSevereError(state, - "Refrigeration:System objects were found during input processing, however no Rrefrigeration condenser objects (which " + "Refrigeration:System objects were found during input processing, however no Refrigeration condenser objects (which " "may be either: "); ShowContinueError(state, " Refrigeration:Condenser:AirCooled, Refrigeration:Condenser:WaterCooled, " @@ -3632,6 +3332,8 @@ void GetRefrigerationInput(EnergyPlusData &state) cAlphaFieldNames, cNumericFieldNames); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + GlobalNames::VerifyUniqueInterObjectName( state, state.dataRefrigCase->UniqueCondenserNames, Alphas(1), CurrentModuleObject, cAlphaFieldNames(1), ErrorsFound); Condenser(CondNum).Name = Alphas(1); @@ -3847,29 +3549,13 @@ void GetRefrigerationInput(EnergyPlusData &state) } if (lAlphaBlanks(5)) { - Condenser(CondNum).EvapSchedPtr = 0; - } else { - Condenser(CondNum).EvapSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(5)); // convert schedule name to pointer - // check availability schedule for values >= 0 - if (Condenser(CondNum).EvapSchedPtr > 0) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, Condenser(CondNum).EvapSchedPtr, true, 0.0)) { - ShowSevereError(state, format("{}{}=\"{}\" .", RoutineName, CurrentModuleObject, Condenser(CondNum).Name)); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFieldNames(5), Alphas(5))); - ShowContinueError(state, "schedule values must be (>=0.)."); - ErrorsFound = true; - } - } else { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} = {}", - RoutineName, - CurrentModuleObject, - Condenser(CondNum).Name, - cAlphaFieldNames(5), - Alphas(5))); - ShowContinueError(state, "A schedule with this name is not defined in this input data file."); - ErrorsFound = true; - } - } // Set Evap Schedule Pointer + } else if ((Condenser(CondNum).evapAvailSched = Sched::GetSchedule(state, Alphas(5))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(5), Alphas(5)); + ErrorsFound = true; + } else if (!Condenser(CondNum).evapAvailSched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, cAlphaFieldNames(5), Alphas(5), Clusive::In, 0.0); + ErrorsFound = true; + } Condenser(CondNum).EndUseSubcategory = ""; if (!lAlphaBlanks(6)) Condenser(CondNum).EndUseSubcategory = Alphas(6); @@ -3903,6 +3589,8 @@ void GetRefrigerationInput(EnergyPlusData &state) cAlphaFieldNames, cNumericFieldNames); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + GlobalNames::VerifyUniqueInterObjectName( state, state.dataRefrigCase->UniqueCondenserNames, Alphas(1), CurrentModuleObject, cAlphaFieldNames(1), ErrorsFound); Condenser(CondNum).Name = Alphas(1); @@ -4010,20 +3698,8 @@ void GetRefrigerationInput(EnergyPlusData &state) // Get outlet temperature schedule for variable flow case if (Condenser(CondNum).FlowType == CndsrFlowType::VariableFlow) { if (lAlphaBlanks(5)) { - Condenser(CondNum).OutletTempSchedPtr = 0; - } else { - Condenser(CondNum).OutletTempSchedPtr = - ScheduleManager::GetScheduleIndex(state, Alphas(5)); // convert schedule name to pointer - } - if (Condenser(CondNum).OutletTempSchedPtr == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} = {}", - RoutineName, - CurrentModuleObject, - Condenser(CondNum).Name, - cAlphaFieldNames(5), - Alphas(5))); - ShowContinueError(state, "A schedule with this name is not defined in this input data file."); + } else if ((Condenser(CondNum).outletTempSched = Sched::GetSchedule(state, Alphas(5))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(5), Alphas(5)); ErrorsFound = true; } } // Outlet temperature schedule @@ -4421,6 +4097,8 @@ void GetRefrigerationInput(EnergyPlusData &state) lAlphaBlanks, cAlphaFieldNames, cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; Util::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound); Secondary(SecondaryNum).Name = Alphas(1); @@ -4594,6 +4272,16 @@ void GetRefrigerationInput(EnergyPlusData &state) AlphaNum = 4; Secondary(SecondaryNum).FluidName = Alphas(AlphaNum); + if (Secondary(SecondaryNum).FluidName.empty()) { + ShowSevereEmptyField(state, eoh, cAlphaFieldNames(AlphaNum)); + ErrorsFound = true; + } else if ((Secondary(SecondaryNum).glycol = Fluid::GetGlycol(state, Secondary(SecondaryNum).FluidName)) != nullptr) { + } else if ((Secondary(SecondaryNum).refrig = Fluid::GetRefrig(state, Secondary(SecondaryNum).FluidName)) != nullptr) { + } else { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(AlphaNum), Alphas(AlphaNum)); + ErrorsFound = true; + } + // Error messages for refrigerants and glycols already found in fluidproperties // Note remainder of inputs for secondary don't follow IDD input order because of different interpretations @@ -4658,11 +4346,9 @@ void GetRefrigerationInput(EnergyPlusData &state) TBrineInRated = TBrineOutRated + Secondary(SecondaryNum).TRangeDifRated; Real64 TBrineAverage = (TBrineOutRated + TBrineInRated) / 2.0; Secondary(SecondaryNum).TBrineAverage = TBrineAverage; - DensityBrineRated = FluidProperties::GetDensityGlycol( - state, Secondary(SecondaryNum).FluidName, TBrineAverage, Secondary(SecondaryNum).FluidID, TrackMessage); + DensityBrineRated = Secondary(SecondaryNum).glycol->getDensity(state, TBrineAverage, TrackMessage); Secondary(SecondaryNum).DensityBrineRated = DensityBrineRated; - CpBrineRated = FluidProperties::GetSpecificHeatGlycol( - state, Secondary(SecondaryNum).FluidName, TBrineAverage, Secondary(SecondaryNum).FluidID, TrackMessage); + CpBrineRated = Secondary(SecondaryNum).glycol->getSpecificHeat(state, TBrineAverage, TrackMessage); Secondary(SecondaryNum).CpBrineRated = CpBrineRated; // Users can input either design brine flow (m3/s), or capacity in W, or both. Now have @@ -4742,24 +4428,11 @@ void GetRefrigerationInput(EnergyPlusData &state) Secondary(SecondaryNum).CircRate = DefaultCircRate; if (!lNumericBlanks(10)) Secondary(SecondaryNum).CircRate = Numbers(10); - DensityPhaseChange = FluidProperties::GetSatDensityRefrig(state, - Secondary(SecondaryNum).FluidName, - Secondary(SecondaryNum).TCondense, - 0.0, - Secondary(SecondaryNum).FluidID, - TrackMessageAlt); - DeltaHPhaseChange = FluidProperties::GetSatEnthalpyRefrig(state, - Secondary(SecondaryNum).FluidName, - Secondary(SecondaryNum).TCondense, - 1.0, - Secondary(SecondaryNum).FluidID, - TrackMessageAlt) - - FluidProperties::GetSatEnthalpyRefrig(state, - Secondary(SecondaryNum).FluidName, - Secondary(SecondaryNum).TCondense, - 0.0, - Secondary(SecondaryNum).FluidID, - TrackMessageAlt); + DensityPhaseChange = + Secondary(SecondaryNum).refrig->getSatDensity(state, Secondary(SecondaryNum).TCondense, 0.0, TrackMessageAlt); + DeltaHPhaseChange = + Secondary(SecondaryNum).refrig->getSatEnthalpy(state, Secondary(SecondaryNum).TCondense, 1.0, TrackMessageAlt) - + Secondary(SecondaryNum).refrig->getSatEnthalpy(state, Secondary(SecondaryNum).TCondense, 0.0, TrackMessageAlt); // TotRatedFlowVol= capacity*circrate/deltahphasechange/density Real64 CalcTotFlowVol = @@ -4952,7 +4625,7 @@ void GetRefrigerationInput(EnergyPlusData &state) ShowWarningError( state, format("{}{}=\"{}\", {} not found even though {} is greater than zero. Distribution piping heat gain will not be " - "calculated unless a Zone is defined to deterimine the environmental temperature surrounding the piping.", + "calculated unless a Zone is defined to determine the environmental temperature surrounding the piping.", RoutineName, CurrentModuleObject, Secondary(SecondaryNum).Name, @@ -5013,7 +4686,7 @@ void GetRefrigerationInput(EnergyPlusData &state) ShowWarningError( state, format("{}{}=\"{}\", {} not found even though {} is greater than zero. Receiver heat gain will not be calculated unless " - "a Zone is defined to deterimine the environmental temperature surrounding the Receiver.", + "a Zone is defined to determine the environmental temperature surrounding the Receiver.", RoutineName, CurrentModuleObject, Secondary(SecondaryNum).Name, @@ -5506,6 +5179,8 @@ void GetRefrigerationInput(EnergyPlusData &state) lAlphaBlanks, cAlphaFieldNames, cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; Util::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound); System(RefrigSysNum).Name = Alphas(1); @@ -5978,6 +5653,13 @@ void GetRefrigerationInput(EnergyPlusData &state) AlphaNum = 6; System(RefrigSysNum).RefrigerantName = Alphas(AlphaNum); + if (System(RefrigSysNum).RefrigerantName.empty()) { + ShowSevereEmptyField(state, eoh, Alphas(AlphaNum)); + ErrorsFound = true; + } else if ((System(RefrigSysNum).refrig = Fluid::GetRefrig(state, System(RefrigSysNum).RefrigerantName)) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(AlphaNum), Alphas(AlphaNum)); + ErrorsFound = true; + } // error messages for refrigerants already found in fluidproperties AlphaNum = 7; @@ -6072,7 +5754,7 @@ void GetRefrigerationInput(EnergyPlusData &state) ShowSevereError( state, format("{}{}=\"{}\", System Node Number not found for {} = {} even though {} is greater than zero. Suction piping heat gain " - "cannot be calculated unless a Zone is defined to deterimine the environmental temperature surrounding the piping.", + "cannot be calculated unless a Zone is defined to determine the environmental temperature surrounding the piping.", RoutineName, CurrentModuleObject, System(RefrigSysNum).Name, @@ -6230,16 +5912,12 @@ void GetRefrigerationInput(EnergyPlusData &state) // Determine intercooler pressure and temperature at design conditions if (System(RefrigSysNum).NumStages == 2) { - Real64 PCond = FluidProperties::GetSatPressureRefrig(state, - System(RefrigSysNum).RefrigerantName, - Condenser(System(RefrigSysNum).CondenserNum(1)).RatedTCondense, - System(RefrigSysNum).RefIndex, - RoutineName); - Real64 PEvap = FluidProperties::GetSatPressureRefrig( - state, System(RefrigSysNum).RefrigerantName, System(RefrigSysNum).TEvapDesign, System(RefrigSysNum).RefIndex, RoutineName); + Real64 PCond = + System(RefrigSysNum).refrig->getSatPressure(state, Condenser(System(RefrigSysNum).CondenserNum(1)).RatedTCondense, RoutineName); + Real64 PEvap = System(RefrigSysNum).refrig->getSatPressure(state, System(RefrigSysNum).TEvapDesign, RoutineName); System(RefrigSysNum).PIntercooler = std::sqrt(PCond * PEvap); - System(RefrigSysNum).TIntercooler = FluidProperties::GetSatTemperatureRefrig( - state, System(RefrigSysNum).RefrigerantName, System(RefrigSysNum).PIntercooler, System(RefrigSysNum).RefIndex, RoutineName); + System(RefrigSysNum).TIntercooler = + System(RefrigSysNum).refrig->getSatTemperature(state, System(RefrigSysNum).PIntercooler, RoutineName); } // NumStages // Sum capacity of single-stage compressors or low-stage compressors if two-stage system @@ -6260,7 +5938,7 @@ void GetRefrigerationInput(EnergyPlusData &state) NominalTotalCompCap += Compressor(CompNum).NomCap; ++Compressor(CompNum).NumSysAttach; } // NumStages - } else { // Transcritical compressor attached to subcritical refigeration cycle + } else { // Transcritical compressor attached to subcritical refrigeration cycle ShowSevereError(state, format("{}{}. A transcritical compressor is attached to a subcritical refrigeration system.", RoutineName, @@ -6285,7 +5963,7 @@ void GetRefrigerationInput(EnergyPlusData &state) Condenser(System(RefrigSysNum).CondenserNum(1)).RatedTCondense); NominalTotalHiStageCompCap += Compressor(CompNum).NomCap; ++Compressor(CompNum).NumSysAttach; - } else { // Transcritical compressor attached to subcritical refigeration cycle + } else { // Transcritical compressor attached to subcritical refrigeration cycle ShowSevereError(state, format("{}{}. A transcritical compressor is attached to a subcritical refrigeration system.", RoutineName, @@ -6462,6 +6140,9 @@ void GetRefrigerationInput(EnergyPlusData &state) lAlphaBlanks, cAlphaFieldNames, cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + Util::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound); TransSystem(TransRefrigSysNum).Name = Alphas(1); @@ -6469,6 +6150,13 @@ void GetRefrigerationInput(EnergyPlusData &state) // Read refrigerant for this system AlphaNum = 8; TransSystem(TransRefrigSysNum).RefrigerantName = Alphas(AlphaNum); + if (TransSystem(TransRefrigSysNum).RefrigerantName.empty()) { + ShowSevereEmptyField(state, eoh, Alphas(AlphaNum)); + ErrorsFound = true; + } else if ((TransSystem(TransRefrigSysNum).refrig = Fluid::GetRefrig(state, TransSystem(TransRefrigSysNum).RefrigerantName)) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(AlphaNum), Alphas(AlphaNum)); + ErrorsFound = true; + } // error messages for refrigerants already found in fluidproperties // Read Transcritical System Type: SingleStage or TwoStage @@ -6845,13 +6533,11 @@ void GetRefrigerationInput(EnergyPlusData &state) CompNum = TransSystem(TransRefrigSysNum).CompressorNumHP(CompIndex); if (Compressor(CompNum).TransFlag) { // Calculate nominal capacity of transcritical Compressor - Real64 GCOutletH = - FluidProperties::GetSupHeatEnthalpyRefrig(state, - TransSystem(TransRefrigSysNum).RefrigerantName, - GasCooler(TransSystem(TransRefrigSysNum).GasCoolerNum(1)).RatedOutletT, - GasCooler(TransSystem(TransRefrigSysNum).GasCoolerNum(1)).RatedOutletP, - RefrigIndex, - RoutineNameNoColon); + Real64 GCOutletH = TransSystem(TransRefrigSysNum) + .refrig->getSupHeatEnthalpy(state, + GasCooler(TransSystem(TransRefrigSysNum).GasCoolerNum(1)).RatedOutletT, + GasCooler(TransSystem(TransRefrigSysNum).GasCoolerNum(1)).RatedOutletP, + routineName); Compressor(CompNum).NomCap = Curve::CurveValue( state, Compressor(CompNum).TransCapacityCurvePtr, TransSystem(TransRefrigSysNum).TEvapDesignMT, GCOutletH); NominalTotalCompCapHP += Compressor(CompNum).NomCap; @@ -6948,8 +6634,8 @@ void GetRefrigerationInput(EnergyPlusData &state) } // Check receiver temperature against minimum condensing temperature (from gas cooler input) and design evaporator temperatures - TransSystem(TransRefrigSysNum).TReceiver = FluidProperties::GetSatTemperatureRefrig( - state, TransSystem(TransRefrigSysNum).RefrigerantName, TransSystem(TransRefrigSysNum).PReceiver, RefrigIndex, RoutineNameNoColon); + TransSystem(TransRefrigSysNum).TReceiver = + TransSystem(TransRefrigSysNum).refrig->getSatTemperature(state, TransSystem(TransRefrigSysNum).PReceiver, routineName); if (TransSystem(TransRefrigSysNum).TReceiver > GasCooler(TransSystem(TransRefrigSysNum).GasCoolerNum(NumGasCoolers)).MinCondTemp) { ShowWarningError(state, format("{}{}=\"{}: The receiver temperature ({:.2R}C) is greater than the minimum condensing temperature " @@ -7008,7 +6694,7 @@ void GetRefrigerationInput(EnergyPlusData &state) // Check subcooler effectiveness value, must be value between 0 and 1 if ((TransSystem(TransRefrigSysNum).SCEffectiveness < 0) || (TransSystem(TransRefrigSysNum).SCEffectiveness > 1)) { ShowSevereError(state, - format("{}{}=\"{}: The value for subcooler effectivness is invalid. The subcooler effectivenss must be a value " + format("{}{}=\"{}: The value for subcooler effectiveness is invalid. The subcooler effectiveness must be a value " "greater than or equal to zero and less than or equal to one.", RoutineName, CurrentModuleObject, @@ -7040,7 +6726,7 @@ void GetRefrigerationInput(EnergyPlusData &state) cNumericFieldNames(3))); ShowContinueError(state, " The medium temperature suction piping heat gain cannot be calculated unless a Zone is defined to " - "deterimine the environmental temperature surrounding the piping."); + "determine the environmental temperature surrounding the piping."); ErrorsFound = true; } else { state.dataRefrigCase->RefrigPresentInZone(TransSystem(TransRefrigSysNum).SuctionPipeActualZoneNumMT) = true; @@ -7084,7 +6770,7 @@ void GetRefrigerationInput(EnergyPlusData &state) cNumericFieldNames(4))); ShowContinueError(state, " The low temperature suction piping heat gain cannot be calculated unless a Zone is defined to " - "deterimine the environmental temperature surrounding the piping."); + "determine the environmental temperature surrounding the piping."); ErrorsFound = true; } else { state.dataRefrigCase->RefrigPresentInZone(TransSystem(TransRefrigSysNum).SuctionPipeActualZoneNumLT) = true; @@ -7848,7 +7534,7 @@ void SetupReportInput(EnergyPlusData &state) // Report walkin variables that are specified for each zone exposed to the walkin // For "IDOut" variable in SetupOutputVariable, need to create a single name that includes - // both the walk-in name and the zone name - see "Walkin_and_zone_name" concatination + // both the walk-in name and the zone name - see "Walkin_and_zone_name" concatenation // This new variable name is important if using an rvi file! for (int zoneId = 1; zoneId <= walkin.NumZones; ++zoneId) { @@ -7980,7 +7666,7 @@ void SetupReportInput(EnergyPlusData &state) coil.TotalElecConsumption, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - coil.Name); // components are metered seperately + coil.Name); // components are metered separately SetupOutputVariable(state, "Refrigeration Zone Air Chiller Fan Electricity Rate", Constant::Units::W, @@ -10390,7 +10076,7 @@ void InitRefrigeration(EnergyPlusData &state) } } - // Accumulative and carry-over variables are not zeroed at start of each time step, only at begining of environment + // Accumulative and carry-over variables are not zeroed at start of each time step, only at beginning of environment if (state.dataGlobal->BeginEnvrnFlag && state.dataRefrigCase->InitRefrigerationMyBeginEnvrnFlag) { if (state.dataRefrigCase->NumSimulationCases > 0) { for (int i = RefrigCase.l(), e = RefrigCase.u(); i <= e; ++i) { @@ -10450,7 +10136,7 @@ void InitRefrigeration(EnergyPlusData &state) System(systemId).LSHXTransEnergy = 0.0; } - if (state.dataGlobal->NumOfTimeStepInHour > 0.0) state.dataRefrigCase->TimeStepFraction = 1.0 / double(state.dataGlobal->NumOfTimeStepInHour); + if (state.dataGlobal->TimeStepsInHour > 0.0) state.dataRefrigCase->TimeStepFraction = 1.0 / double(state.dataGlobal->TimeStepsInHour); state.dataRefrigCase->InitRefrigerationMyBeginEnvrnFlag = false; } // ( DataGlobals::BeginEnvrnFlag && MyBeginEnvrnFlag ) @@ -10651,11 +10337,7 @@ void InitRefrigerationPlantConnections(EnergyPlusData &state) ShowFatalError(state, "InitRefrigerationPlantConnections: Program terminated due to previous condition(s)."); } - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(Condenser(RefCondLoop).plantLoc.loopNum).FluidName, - 20.0, - state.dataPlnt->PlantLoop(Condenser(RefCondLoop).plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(Condenser(RefCondLoop).plantLoc.loopNum).glycol->getDensity(state, 20.0, RoutineName); if (Condenser(RefCondLoop).FlowType == CndsrFlowType::ConstantFlow) { Condenser(RefCondLoop).MassFlowRateMax = Condenser(RefCondLoop).DesVolFlowRate * rho; @@ -10682,11 +10364,7 @@ void InitRefrigerationPlantConnections(EnergyPlusData &state) ShowFatalError(state, "InitRefrigerationPlantConnections: Program terminated due to previous condition(s)."); } - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(RefrigRack(RefCompRackLoop).plantLoc.loopNum).FluidName, - 20.0, - state.dataPlnt->PlantLoop(RefrigRack(RefCompRackLoop).plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(RefrigRack(RefCompRackLoop).plantLoc.loopNum).glycol->getDensity(state, 20.0, RoutineName); if (RefrigRack(RefCompRackLoop).FlowType == CndsrFlowType::ConstantFlow) { RefrigRack(RefCompRackLoop).MassFlowRateMax = RefrigRack(RefCompRackLoop).DesVolFlowRate * rho; @@ -10707,11 +10385,7 @@ void InitRefrigerationPlantConnections(EnergyPlusData &state) for (int RefCondLoop = 1; RefCondLoop <= state.dataRefrigCase->NumRefrigCondensers; ++RefCondLoop) { if (Condenser(RefCondLoop).CondenserType != DataHeatBalance::RefrigCondenserType::Water) continue; - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(Condenser(RefCondLoop).plantLoc.loopNum).FluidName, - 20.0, - state.dataPlnt->PlantLoop(Condenser(RefCondLoop).plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(Condenser(RefCondLoop).plantLoc.loopNum).glycol->getDensity(state, 20.0, RoutineName); if (Condenser(RefCondLoop).FlowType == CndsrFlowType::ConstantFlow) { Condenser(RefCondLoop).MassFlowRateMax = Condenser(RefCondLoop).DesVolFlowRate * rho; @@ -10725,11 +10399,7 @@ void InitRefrigerationPlantConnections(EnergyPlusData &state) for (int RefCompRackLoop = 1; RefCompRackLoop <= state.dataRefrigCase->NumRefrigeratedRacks; ++RefCompRackLoop) { if (RefrigRack(RefCompRackLoop).CondenserType != DataHeatBalance::RefrigCondenserType::Water) continue; - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(RefrigRack(RefCompRackLoop).plantLoc.loopNum).FluidName, - 20.0, - state.dataPlnt->PlantLoop(RefrigRack(RefCompRackLoop).plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(RefrigRack(RefCompRackLoop).plantLoc.loopNum).glycol->getDensity(state, 20.0, RoutineName); if (RefrigRack(RefCompRackLoop).FlowType == CndsrFlowType::ConstantFlow) { RefrigRack(RefCompRackLoop).MassFlowRateMax = RefrigRack(RefCompRackLoop).DesVolFlowRate * rho; @@ -10811,7 +10481,7 @@ void RefrigRackData::CalcRackSystem(EnergyPlusData &state) // In that subroutine, dispatch coils within each set in order specified for each zone // Below will assign loads to refrigeration system or secondary loop // Note that this routine will go through all refrigeration systems, but loads for multiple systems - // with interactions will not be known for the intital calls with first HVAC time step. They will, + // with interactions will not be known for the initial calls with first HVAC time step. They will, // however, be repeated when the last chiller set is called from ZoneEquipmentManager // that's why important where init goes, don't want to zero out data should keep if (state.dataRefrigCase->UseSysTimeStep) { @@ -10886,7 +10556,7 @@ void RefrigRackData::CalcRackSystem(EnergyPlusData &state) // IF schedule exists, evap condenser can be scheduled OFF // Check schedule to determine evap condenser availability - if (this->EvapSchedPtr > 0 && ScheduleManager::GetCurrentScheduleValue(state, this->EvapSchedPtr) == 0) EvapAvail = false; + if (this->evapAvailSched != nullptr && this->evapAvailSched->getCurrentVal() == 0) EvapAvail = false; // Evaporative condensers will have their water flow shut off in cold months to avoid // 'spectacular' icing problems. Ideally, the user will use the evaporative schedule input @@ -11030,28 +10700,28 @@ void RefrigRackData::ReportRackSystem(EnergyPlusData &state, int const RackNum) // PURPOSE OF THIS SUBROUTINE: // To report compressor rack variables - Real64 LocalTimeStep = state.dataGlobal->TimeStepZone; - if (state.dataRefrigCase->UseSysTimeStep) LocalTimeStep = state.dataHVACGlobal->TimeStepSys; + Real64 localTimeStep = (state.dataRefrigCase->UseSysTimeStep) ? state.dataHVACGlobal->TimeStepSys : state.dataGlobal->TimeStepZone; + Real64 localTimeStepSec = localTimeStep * Constant::rSecsInHour; this->RackCompressorPower = state.dataRefrigCase->TotalCompressorPower; - this->RackElecConsumption = state.dataRefrigCase->TotalCompressorPower * LocalTimeStep * Constant::SecInHour; + this->RackElecConsumption = state.dataRefrigCase->TotalCompressorPower * localTimeStepSec; this->ActualCondenserFanPower = state.dataRefrigCase->TotalCondenserFanPower; - this->CondenserFanConsumption = state.dataRefrigCase->TotalCondenserFanPower * LocalTimeStep * Constant::SecInHour; + this->CondenserFanConsumption = state.dataRefrigCase->TotalCondenserFanPower * localTimeStepSec; this->RackCapacity = state.dataRefrigCase->TotalRackDeliveredCapacity; - this->RackCoolingEnergy = state.dataRefrigCase->TotalRackDeliveredCapacity * LocalTimeStep * Constant::SecInHour; + this->RackCoolingEnergy = state.dataRefrigCase->TotalRackDeliveredCapacity * localTimeStepSec; this->RackCompressorCOP = state.dataRefrigCase->CompressorCOPactual; this->SensHVACCreditHeatRate = state.dataRefrigCase->RackSenCreditToHVAC; - this->SensHVACCreditHeat = state.dataRefrigCase->RackSenCreditToHVAC * LocalTimeStep * Constant::SecInHour; + this->SensHVACCreditHeat = state.dataRefrigCase->RackSenCreditToHVAC * localTimeStepSec; this->SensZoneCreditHeatRate = state.dataRefrigCase->RackSenCreditToZone; - this->SensZoneCreditHeat = state.dataRefrigCase->RackSenCreditToZone * LocalTimeStep * Constant::SecInHour; + this->SensZoneCreditHeat = state.dataRefrigCase->RackSenCreditToZone * localTimeStepSec; this->EvapWaterConsumpRate = state.dataRefrigCase->TotalEvapWaterUseRate; - this->EvapWaterConsumption = state.dataRefrigCase->TotalEvapWaterUseRate * LocalTimeStep * Constant::SecInHour; + this->EvapWaterConsumption = state.dataRefrigCase->TotalEvapWaterUseRate * localTimeStepSec; this->ActualEvapPumpPower = state.dataRefrigCase->TotalCondenserPumpPower; - this->EvapPumpConsumption = state.dataRefrigCase->TotalCondenserPumpPower * LocalTimeStep * Constant::SecInHour; + this->EvapPumpConsumption = state.dataRefrigCase->TotalCondenserPumpPower * localTimeStepSec; this->BasinHeaterPower = state.dataRefrigCase->TotalBasinHeatPower; - this->BasinHeaterConsumption = state.dataRefrigCase->TotalBasinHeatPower * LocalTimeStep * Constant::SecInHour; + this->BasinHeaterConsumption = state.dataRefrigCase->TotalBasinHeatPower * localTimeStepSec; this->CondLoad = state.dataRefrigCase->TotalCondenserHeat; - this->CondEnergy = state.dataRefrigCase->TotalCondenserHeat * LocalTimeStep * Constant::SecInHour; + this->CondEnergy = state.dataRefrigCase->TotalCondenserHeat * localTimeStepSec; // Set total rack heat rejection used for heat reclaim. Do not allow heat reclaim on stand alone (indoor) display cases. if (this->HeatRejectionLocation == HeatRejLocation::Zone) { state.dataHeatBal->HeatReclaimRefrigeratedRack(RackNum).AvailCapacity = 0.0; @@ -11152,12 +10822,12 @@ void RefrigCaseData::CalculateCase(EnergyPlusData &state) // Absolute pointer to // case schedule should be coincident with the zone time step otherwise the simulation proceeds // Current value of case operating (availability) schedule - Real64 CaseSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->SchedPtr); + Real64 CaseSchedule = this->availSched->getCurrentVal(); if (CaseSchedule <= 0) return; // get defrost schedule if (this->defrostType > RefCaseDefrostType::None) { - DefrostSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->DefrostSchedPtr); - DefrostDripDownSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->DefrostDripDownSchedPtr); + DefrostSchedule = this->defrostSched->getCurrentVal(); + DefrostDripDownSchedule = this->defrostDripDownSched->getCurrentVal(); // next statement In case user doesn't understand concept of drip down schedule DefrostDripDownSchedule = max(DefrostDripDownSchedule, DefrostSchedule); } else { @@ -11165,24 +10835,15 @@ void RefrigCaseData::CalculateCase(EnergyPlusData &state) // Absolute pointer to DefrostDripDownSchedule = 0.0; } - Real64 StockingSchedule(0.0); // Current value of product stocking schedule (W/m) - // get product stocking schedule and load due to product stocking, if no schedule exists load is 0 - if (this->StockingSchedPtr > 0) { - StockingSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->StockingSchedPtr); - } else { - StockingSchedule = 0.0; - } + Real64 StockingSchedule = (this->stockingSched != nullptr) ? this->stockingSched->getCurrentVal() : 0.0; + // get lighting schedule and total load due to lighting - Real64 LightingSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->LightingSchedPtr); + Real64 LightingSchedule = this->lightingSched->getCurrentVal(); // if case credit reduction fraction schedule exists, modify both sensible and latent case credits // according to schedule - used to account for variable case envelope, such as night covers. - if (this->CaseCreditFracSchedPtr != 0) { - CaseCreditFraction = ScheduleManager::GetCurrentScheduleValue(state, this->CaseCreditFracSchedPtr); - } else { - CaseCreditFraction = 1.0; - } + CaseCreditFraction = (this->caseCreditFracSched != nullptr) ? this->caseCreditFracSched->getCurrentVal() : 1.0; // CALCULATE AUX LOADS DUE TO LIGHTS, FAN AND STOCKING TotalLightingLoad = this->DesignLighting * LightingSchedule; @@ -11342,7 +11003,7 @@ void RefrigCaseData::CalculateCase(EnergyPlusData &state) // Absolute pointer to // Reduce defrost heat load on case by amount of ice melted during time step // However, don't reduce the defrost capacity applied - DefrostLoad_Actual = DefrostCap_Actual - FrostMeltedKg * IceMeltEnthalpy / state.dataGlobal->TimeStepZone / Constant::SecInHour; + DefrostLoad_Actual = DefrostCap_Actual - FrostMeltedKg * IceMeltEnthalpy / state.dataGlobal->TimeStepZone / Constant::rSecsInHour; if (!state.dataGlobal->WarmupFlag) { // avoid reverse dd test problems // keep running total of defrost energy above that needed to melt frost for use in evaluating @@ -11372,7 +11033,7 @@ void RefrigCaseData::CalculateCase(EnergyPlusData &state) // Absolute pointer to Real64 TotalLoad_Actual = SensibleLoadTotal + LatentLoad + DefrostLoad_Actual; // Rate needed to serve all stored energy during single time step (W) - Real64 StoredEnergyRate = this->StoredEnergy / state.dataGlobal->TimeStepZone / Constant::SecInHour; + Real64 StoredEnergyRate = this->StoredEnergy / state.dataGlobal->TimeStepZone / Constant::rSecsInHour; Real64 LoadRequested = TotalLoad_Actual + StoredEnergyRate; // prorate available cooling capacity for portion of time off due to drip down. @@ -11505,7 +11166,7 @@ void RefrigCaseData::CalculateCase(EnergyPlusData &state) // Absolute pointer to ShowContinueError(state, " Total Cooling Capacity."); } else { ShowContinueError(state, - " This case has insufficient capacity to meet excess energy associated with a zone enviroment temperature " + " This case has insufficient capacity to meet excess energy associated with a zone environment temperature " "greater than the design ambient for the case."); ShowContinueError(state, " Refer to documentation for further explanation of "); ShowContinueError(state, " Total Cooling Capacity."); @@ -11517,7 +11178,7 @@ void RefrigCaseData::CalculateCase(EnergyPlusData &state) // Absolute pointer to ShowContinueError(state, " recommendations regarding Total Cooling Capacity, Sensible Heat Ratio, and Defrost Capacity."); } else { ShowContinueError(state, - " This case has insufficient capacity to meet excess energy associated with a zone enviroment temperature " + " This case has insufficient capacity to meet excess energy associated with a zone environment temperature " "greater than the design ambient for the case."); ShowContinueError(state, " Refer to documentation for further explanation of "); ShowContinueError(state, " Total Cooling Capacity."); @@ -11612,20 +11273,12 @@ void RefrigCondenserData::simulate(EnergyPlusData &state, // Make demand request on first HVAC iteration // get cooling fluid properties - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(PlantLoc.loopNum).FluidName, - this->InletTemp, - state.dataPlnt->PlantLoop(PlantLoc.loopNum).FluidIndex, - RoutineName); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(PlantLoc.loopNum).FluidName, - this->InletTemp, - state.dataPlnt->PlantLoop(PlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(PlantLoc.loopNum).glycol->getDensity(state, this->InletTemp, RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(PlantLoc.loopNum).glycol->getSpecificHeat(state, this->InletTemp, RoutineName); if (this->FlowType == CndsrFlowType::VariableFlow && state.dataRefrigCase->TotalCondenserHeat > 0.0) { - this->OutletTemp = ScheduleManager::GetCurrentScheduleValue(state, this->OutletTempSchedPtr); + this->OutletTemp = this->outletTempSched->getCurrentVal(); if (this->OutletTemp == this->InletTemp) { @@ -11772,19 +11425,11 @@ void RefrigRackData::simulate(EnergyPlusData &state, // Make demand request on first HVAC iteration // get cooling fluid properties - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(PlantLoc.loopNum).FluidName, - this->InletTemp, - state.dataPlnt->PlantLoop(PlantLoc.loopNum).FluidIndex, - RoutineName); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(PlantLoc.loopNum).FluidName, - this->InletTemp, - state.dataPlnt->PlantLoop(PlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(PlantLoc.loopNum).glycol->getDensity(state, this->InletTemp, RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(PlantLoc.loopNum).glycol->getSpecificHeat(state, this->InletTemp, RoutineName); if (this->FlowType == CndsrFlowType::VariableFlow && state.dataRefrigCase->TotalCondenserHeat > 0.0) { - this->OutletTemp = ScheduleManager::GetCurrentScheduleValue(state, this->OutletTempSchedPtr); + this->OutletTemp = this->outletTempSched->getCurrentVal(); if (this->OutletTemp == this->InletTemp) { @@ -11942,8 +11587,8 @@ void SimulateDetailedRefrigerationSystems(EnergyPlusData &state) auto &AirChillerSet = state.dataRefrigCase->AirChillerSet; auto &CoilSysCredit = state.dataRefrigCase->CoilSysCredit; - Real64 LocalTimeStep = state.dataGlobal->TimeStepZone; - if (state.dataRefrigCase->UseSysTimeStep) LocalTimeStep = state.dataHVACGlobal->TimeStepSys; + Real64 localTimeStep = (state.dataRefrigCase->UseSysTimeStep) ? state.dataHVACGlobal->TimeStepSys : state.dataGlobal->TimeStepZone; + Real64 localTimeStepSec = localTimeStep * Constant::rSecsInHour; // Cascade condenser assumes a constant approach delta T (Tcond - Tevap), not f(load) @@ -11954,7 +11599,7 @@ void SimulateDetailedRefrigerationSystems(EnergyPlusData &state) // In that subroutine, dispatch coils within each set in order specified for each zone // Below will assign loads to refrigeration system or secondary loop // Note that this routine will go through all refrigeration systems, but loads for multiple systems - // with interactions will not be known for the intital calls with first HVAC time step. They will, + // with interactions will not be known for the initial calls with first HVAC time step. They will, // however, be repeated when the last chiller set is called from ZoneEquipmentManager // that's why important where init goes, don't want to zero out data should keep if (state.dataRefrigCase->UseSysTimeStep) { @@ -12159,11 +11804,9 @@ void SimulateDetailedRefrigerationSystems(EnergyPlusData &state) // only calc detailed system if have load (could be zero first time through if only load is cascade condenser) thisSys.TotalSystemLoad = thisSys.TotalCoolingLoad + thisSys.SumSecondaryLoopLoad + thisSys.SumMechSCLoad + thisSys.SumCascadeLoad; if (thisSys.TotalSystemLoad > 0.0) { - thisSys.CpSatVapEvap = FluidProperties::GetSatSpecificHeatRefrig( - state, thisSys.RefrigerantName, thisSys.TEvapNeeded, 1.0, thisSys.RefIndex, RoutineName); - thisSys.HCaseOut = FluidProperties::GetSatEnthalpyRefrig( - state, thisSys.RefrigerantName, thisSys.TEvapNeeded, 1.0, thisSys.RefIndex, RoutineName) + - thisSys.CpSatVapEvap * CaseSuperheat; + thisSys.CpSatVapEvap = thisSys.refrig->getSatSpecificHeat(state, thisSys.TEvapNeeded, 1.0, RoutineName); + thisSys.HCaseOut = + thisSys.refrig->getSatEnthalpy(state, thisSys.TEvapNeeded, 1.0, RoutineName) + thisSys.CpSatVapEvap * CaseSuperheat; // Establish estimates to start solution loop switch (Condenser(thisSys.CondenserNum(1)).CondenserType) { case DataHeatBalance::RefrigCondenserType::Air: { @@ -12186,10 +11829,8 @@ void SimulateDetailedRefrigerationSystems(EnergyPlusData &state) } // Produce first time step estimates, assume no subcoolers - thisSys.HSatLiqCond = - FluidProperties::GetSatEnthalpyRefrig(state, thisSys.RefrigerantName, thisSys.TCondense, 0.0, thisSys.RefIndex, RoutineName); - thisSys.CpSatLiqCond = FluidProperties::GetSatSpecificHeatRefrig( - state, thisSys.RefrigerantName, thisSys.TCondense, 0.0, thisSys.RefIndex, RoutineName); + thisSys.HSatLiqCond = thisSys.refrig->getSatEnthalpy(state, thisSys.TCondense, 0.0, RoutineName); + thisSys.CpSatLiqCond = thisSys.refrig->getSatSpecificHeat(state, thisSys.TCondense, 0.0, RoutineName); thisSys.HCaseIn = thisSys.HSatLiqCond - thisSys.CpSatLiqCond * Condenser(thisSys.CondenserNum(1)).RatedSubcool; thisSys.RefMassFlowtoLoads = thisSys.TotalSystemLoad / (thisSys.HCaseOut - thisSys.HCaseIn); thisSys.RefMassFlowComps = thisSys.RefMassFlowtoLoads; @@ -12233,7 +11874,7 @@ void SimulateDetailedRefrigerationSystems(EnergyPlusData &state) "of the refrigeration loads, ", thisSys.HiStageWarnIndex1); ShowRecurringContinueErrorAtEnd( - state, " subcooler loads (if any), and low-stage compressor loads for this sytem.", thisSys.HiStageWarnIndex2); + state, " subcooler loads (if any), and low-stage compressor loads for this system.", thisSys.HiStageWarnIndex2); } // Hi-stage capacity<(load+LSHX load + lo-stage compressor load) } // CoilFlag (Numcoils > 0) and load > capacity @@ -12273,7 +11914,7 @@ void SimulateDetailedRefrigerationSystems(EnergyPlusData &state) if (state.dataRefrigCase->ShowUnmetEnergyWarning(SysNum)) { ShowWarningError(state, format("Refrigeration:System: {}", thisSys.Name)); ShowContinueError(state, " The specified compressors for this system are unable to meet "); - ShowContinueError(state, " the sum of the refrigerated case loads and subcooler loads (if any) for this sytem."); + ShowContinueError(state, " the sum of the refrigerated case loads and subcooler loads (if any) for this system."); state.dataRefrigCase->ShowUnmetEnergyWarning(SysNum) = false; } // show warning } // > mylarge number @@ -12283,7 +11924,7 @@ void SimulateDetailedRefrigerationSystems(EnergyPlusData &state) ShowWarningError(state, format("Refrigeration:System: {}", thisSys.Name)); ShowContinueError(state, " The specified high-stage compressors for this system are unable to meet "); ShowContinueError(state, " the sum of the refrigerated case loads, subcooler loads (if any) and "); - ShowContinueError(state, " low-stage compressor loads for this sytem."); + ShowContinueError(state, " low-stage compressor loads for this system."); state.dataRefrigCase->ShowHiStageUnmetEnergyWarning(SysNum) = false; } // show warning } // > mylarge number @@ -12306,9 +11947,9 @@ void SimulateDetailedRefrigerationSystems(EnergyPlusData &state) // Report variables thisSys.TotTransferLoad = thisSys.SumMechSCLoad - thisSys.SumMechSCBenefit + thisSys.SumSecondaryLoopLoad + thisSys.SumCascadeLoad; - thisSys.TotTransferEnergy = thisSys.TotTransferLoad * LocalTimeStep * Constant::SecInHour; - thisSys.PipeHeatEnergy = thisSys.PipeHeatLoad * LocalTimeStep * Constant::SecInHour; - thisSys.TotalCoolingEnergy = thisSys.TotalCoolingLoad * LocalTimeStep * Constant::SecInHour; + thisSys.TotTransferEnergy = thisSys.TotTransferLoad * localTimeStepSec; + thisSys.PipeHeatEnergy = thisSys.PipeHeatLoad * localTimeStepSec; + thisSys.TotalCoolingEnergy = thisSys.TotalCoolingLoad * localTimeStepSec; } //(((.NOT. UseSysTimeStep).AND.(.NOT. System(SysNum)%CoilFlag)).OR.((UseSysTimeStep).AND.(System(SysNum)%CoilFlag))).and.not // WarmupFlag } // SysNum = 1,NumRefrigSystems @@ -12325,7 +11966,7 @@ void SimulateDetailedRefrigerationSystems(EnergyPlusData &state) auto &coil = WarehouseCoil(CoilID); if (coil.ZoneNum != ZoneNum) continue; zoneCredit.SenCreditToZoneRate -= coil.SensCreditRate; - zoneCredit.SenCreditToZoneEnergy = zoneCredit.SenCreditToZoneRate * LocalTimeStep * Constant::SecInHour; + zoneCredit.SenCreditToZoneEnergy = zoneCredit.SenCreditToZoneRate * localTimeStepSec; zoneCredit.LatKgPerS_ToZoneRate -= coil.LatKgPerS_ToZone; zoneCredit.LatCreditToZoneRate -= coil.LatCreditRate; zoneCredit.LatCreditToZoneEnergy -= coil.LatCreditEnergy; @@ -12360,8 +12001,8 @@ void SimulateDetailedTransRefrigSystems(EnergyPlusData &state) auto &GasCooler = state.dataRefrigCase->GasCooler; auto &WalkIn = state.dataRefrigCase->WalkIn; - Real64 LocalTimeStep = state.dataGlobal->TimeStepZone; - if (state.dataRefrigCase->UseSysTimeStep) LocalTimeStep = state.dataHVACGlobal->TimeStepSys; + Real64 localTimeStep = (state.dataRefrigCase->UseSysTimeStep) ? state.dataHVACGlobal->TimeStepSys : state.dataGlobal->TimeStepZone; + Real64 localTimeStepSec = localTimeStep * Constant::rSecsInHour; // Do transcritical CO2 refrigeration system loop outside of iterative solution to initialize time step and // calculate case and and walk-ins (that won't change during balance of refrigeration system iterations) @@ -12474,25 +12115,17 @@ void SimulateDetailedTransRefrigSystems(EnergyPlusData &state) sys.TotalSystemLoad = sys.TotalSystemLoadLT + sys.TotalSystemLoadMT; if (sys.TotalSystemLoad > 0.0) { if (sys.TransSysType == 2) { - sys.CpSatVapEvapLT = - FluidProperties::GetSatSpecificHeatRefrig(state, sys.RefrigerantName, sys.TEvapNeededLT, 1.0, sys.RefIndex, RoutineName); - sys.HCaseOutLT = - FluidProperties::GetSatEnthalpyRefrig(state, sys.RefrigerantName, sys.TEvapNeededLT, 1.0, sys.RefIndex, RoutineName) + - sys.CpSatVapEvapLT * TransCaseSuperheat; + sys.CpSatVapEvapLT = sys.refrig->getSatSpecificHeat(state, sys.TEvapNeededLT, 1.0, RoutineName); + sys.HCaseOutLT = sys.refrig->getSatEnthalpy(state, sys.TEvapNeededLT, 1.0, RoutineName) + sys.CpSatVapEvapLT * TransCaseSuperheat; } - sys.CpSatVapEvapMT = - FluidProperties::GetSatSpecificHeatRefrig(state, sys.RefrigerantName, sys.TEvapNeededMT, 1.0, sys.RefIndex, RoutineName); - sys.HCaseOutMT = - FluidProperties::GetSatEnthalpyRefrig(state, sys.RefrigerantName, sys.TEvapNeededMT, 1.0, sys.RefIndex, RoutineName) + - sys.CpSatVapEvapMT * TransCaseSuperheat; + sys.CpSatVapEvapMT = sys.refrig->getSatSpecificHeat(state, sys.TEvapNeededMT, 1.0, RoutineName); + sys.HCaseOutMT = sys.refrig->getSatEnthalpy(state, sys.TEvapNeededMT, 1.0, RoutineName) + sys.CpSatVapEvapMT * TransCaseSuperheat; // Produce first time step estimates. // Assume no subcoolers and neglect flow through bypass. - sys.TReceiver = FluidProperties::GetSatTemperatureRefrig(state, sys.RefrigerantName, sys.PReceiver, sys.RefIndex, RoutineName); - sys.HSatLiqReceiver = - FluidProperties::GetSatEnthalpyRefrig(state, sys.RefrigerantName, sys.TReceiver, 0.0, sys.RefIndex, RoutineName); - sys.CpSatLiqReceiver = - FluidProperties::GetSatSpecificHeatRefrig(state, sys.RefrigerantName, sys.TReceiver, 0.0, sys.RefIndex, RoutineName); + sys.TReceiver = sys.refrig->getSatTemperature(state, sys.PReceiver, RoutineName); + sys.HSatLiqReceiver = sys.refrig->getSatEnthalpy(state, sys.TReceiver, 0.0, RoutineName); + sys.CpSatLiqReceiver = sys.refrig->getSatSpecificHeat(state, sys.TReceiver, 0.0, RoutineName); sys.HCaseInMT = sys.HSatLiqReceiver; sys.HCaseInLT = sys.HSatLiqReceiver; sys.RefMassFlowtoLTLoads = 0.0; @@ -12530,7 +12163,7 @@ void SimulateDetailedTransRefrigSystems(EnergyPlusData &state) if (state.dataRefrigCase->ShowUnmetEnergyWarningTrans(SysNum)) { ShowWarningError(state, format("Refrigeration:TranscriticalSystem: {}", sys.Name)); ShowContinueError(state, " The specified compressors for this system are unable to meet "); - ShowContinueError(state, " the sum of the refrigerated case loads and subcooler loads (if any) for this sytem."); + ShowContinueError(state, " the sum of the refrigerated case loads and subcooler loads (if any) for this system."); state.dataRefrigCase->ShowUnmetEnergyWarningTrans(SysNum) = false; } // show warning } // > mylarge number @@ -12546,8 +12179,8 @@ void SimulateDetailedTransRefrigSystems(EnergyPlusData &state) } // Reject heat to zone // Report variables - sys.PipeHeatEnergy = (sys.PipeHeatLoadMT + sys.PipeHeatLoadLT) * LocalTimeStep * Constant::SecInHour; - sys.TotalCoolingEnergy = (sys.TotalCoolingLoadMT + sys.TotalCoolingLoadMT) * LocalTimeStep * Constant::SecInHour; + sys.PipeHeatEnergy = (sys.PipeHeatLoadMT + sys.PipeHeatLoadLT) * localTimeStepSec; + sys.TotalCoolingEnergy = (sys.TotalCoolingLoadMT + sys.TotalCoolingLoadMT) * localTimeStepSec; } //(.NOT. UseSysTimeStep).AND. (.not. WarmupFlag) } // SysNum = 1,NumTransRefrigSystems @@ -12765,8 +12398,8 @@ void RefrigSystemData::CalculateCondensers(EnergyPlusData &state, int const SysN Real64 TotalLoadFromThisSystem(0.0); // total heat rejection load from the detailed system id'd in subroutine call [W] Real64 TotalLoadFromSystems; // total heat rejection load from all systems served by this condenser [W] - Real64 LocalTimeStep = state.dataGlobal->TimeStepZone; - if (state.dataRefrigCase->UseSysTimeStep) LocalTimeStep = state.dataHVACGlobal->TimeStepSys; + Real64 localTimeStep = (state.dataRefrigCase->UseSysTimeStep) ? state.dataHVACGlobal->TimeStepSys : state.dataGlobal->TimeStepZone; + Real64 localTimeStepSec = localTimeStep * Constant::rSecsInHour; // Initialize this condenser for this time step state.dataRefrigCase->TotalCondenserPumpPower = 0.0; @@ -12895,15 +12528,15 @@ void RefrigSystemData::CalculateCondensers(EnergyPlusData &state, int const SysN // 'spectacular' icing problems. Ideally, the user will use the evaporative schedule input // to set such a schedule. However, sometimes, users will use a single input deck to model // one building in multiple climates, and may not think to put in such a schedule in the colder - // climates. To accomodate such applications, the variable EvapCutOutTdb is used as an extra + // climates. To accommodate such applications, the variable EvapCutOutTdb is used as an extra // check. if (OutDbTemp < EvapCutOutTdb) EvapAvail = false; // Check schedule to determine evap condenser availability // IF schedule exists, evap condenser can be scheduled OFF - if ((condenser.CondenserType == DataHeatBalance::RefrigCondenserType::Evap) && (condenser.EvapSchedPtr > 0) && - (ScheduleManager::GetCurrentScheduleValue(state, condenser.EvapSchedPtr) == 0)) + if ((condenser.CondenserType == DataHeatBalance::RefrigCondenserType::Evap) && (condenser.evapAvailSched != nullptr) && + (condenser.evapAvailSched->getCurrentVal() == 0)) EvapAvail = false; // Calculate condensing temperatures for air-cooled and evap-cooled @@ -12989,7 +12622,7 @@ void RefrigSystemData::CalculateCondensers(EnergyPlusData &state, int const SysN } break; case FanSpeedCtrlType::TwoSpeed: { // low speed setting of 1/2 fan speed can give up to 60% of capacity. - // 1/2 speed corresonds to ~1/8 power consumption (FanHalfSpeedRatio = 1/(2**2.5) = 0.1768) + // 1/2 speed corresponds to ~1/8 power consumption (FanHalfSpeedRatio = 1/(2**2.5) = 0.1768) // dampers are used to control flow within those two ranges as in FanConstantSpeed Real64 const air_vol_fan_power_fac(std::exp(1.0 - AirVolRatio) * RatedFanPower); ActualFanPower = AirVolRatio * air_vol_fan_power_fac; @@ -13068,15 +12701,15 @@ void RefrigSystemData::CalculateCondensers(EnergyPlusData &state, int const SysN } // Condenser type = water, (evap or air), or cascade condenser.ActualFanPower = ActualFanPower; - condenser.FanElecEnergy = ActualFanPower * LocalTimeStep * Constant::SecInHour; + condenser.FanElecEnergy = ActualFanPower * localTimeStepSec; condenser.EvapWaterConsumpRate = state.dataRefrigCase->TotalEvapWaterUseRate; - condenser.EvapWaterConsumption = state.dataRefrigCase->TotalEvapWaterUseRate * LocalTimeStep * Constant::SecInHour; + condenser.EvapWaterConsumption = state.dataRefrigCase->TotalEvapWaterUseRate * localTimeStepSec; condenser.ActualEvapPumpPower = state.dataRefrigCase->TotalCondenserPumpPower; - condenser.EvapPumpConsumption = state.dataRefrigCase->TotalCondenserPumpPower * LocalTimeStep * Constant::SecInHour; + condenser.EvapPumpConsumption = state.dataRefrigCase->TotalCondenserPumpPower * localTimeStepSec; condenser.BasinHeaterPower = state.dataRefrigCase->TotalBasinHeatPower; - condenser.BasinHeaterConsumption = state.dataRefrigCase->TotalBasinHeatPower * LocalTimeStep * Constant::SecInHour; + condenser.BasinHeaterConsumption = state.dataRefrigCase->TotalBasinHeatPower * localTimeStepSec; condenser.CondLoad = state.dataRefrigCase->TotalCondenserHeat; - condenser.CondEnergy = state.dataRefrigCase->TotalCondenserHeat * LocalTimeStep * Constant::SecInHour; + condenser.CondEnergy = state.dataRefrigCase->TotalCondenserHeat * localTimeStepSec; condenser.CondCreditWarnIndex1 = CondCreditWarnIndex1; condenser.CondCreditWarnIndex2 = CondCreditWarnIndex2; condenser.CondCreditWarnIndex3 = CondCreditWarnIndex3; @@ -13084,11 +12717,11 @@ void RefrigSystemData::CalculateCondensers(EnergyPlusData &state, int const SysN condenser.CondCreditWarnIndex5 = CondCreditWarnIndex5; condenser.CondCreditWarnIndex6 = CondCreditWarnIndex6; condenser.CondCreditWarnIndex7 = CondCreditWarnIndex7; - condenser.ExternalEnergyRecovered = condenser.ExternalHeatRecoveredLoad * LocalTimeStep * Constant::SecInHour; - condenser.InternalEnergyRecovered = condenser.InternalHeatRecoveredLoad * LocalTimeStep * Constant::SecInHour; - condenser.TotalHeatRecoveredEnergy = condenser.TotalHeatRecoveredLoad * LocalTimeStep * Constant::SecInHour; + condenser.ExternalEnergyRecovered = condenser.ExternalHeatRecoveredLoad * localTimeStepSec; + condenser.InternalEnergyRecovered = condenser.InternalHeatRecoveredLoad * localTimeStepSec; + condenser.TotalHeatRecoveredEnergy = condenser.TotalHeatRecoveredLoad * localTimeStepSec; this->NetHeatRejectLoad = state.dataRefrigCase->TotalCondenserHeat * TotalLoadFromThisSystem / TotalLoadFromSystems; - this->NetHeatRejectEnergy = this->NetHeatRejectLoad * LocalTimeStep * Constant::SecInHour; + this->NetHeatRejectEnergy = this->NetHeatRejectLoad * localTimeStepSec; // set water system demand request (if needed) if (condenser.EvapWaterSupplyMode == WaterSupply::FromTank) { @@ -13151,8 +12784,8 @@ void TransRefrigSystemData::CalcGasCooler(EnergyPlusData &state, int const SysNu Real64 TotalLoadFromSystems; // Total heat rejection load from all systems served by this condenser [W] Real64 TotalLoadFromThisSystem(0.0); // Total heat rejection load from the detailed system identified in subroutine call [W] - Real64 LocalTimeStep = state.dataGlobal->TimeStepZone; - if (state.dataRefrigCase->UseSysTimeStep) LocalTimeStep = state.dataHVACGlobal->TimeStepSys; + Real64 localTimeStep = (state.dataRefrigCase->UseSysTimeStep) ? state.dataHVACGlobal->TimeStepSys : state.dataGlobal->TimeStepZone; + Real64 localTimeStepSec = localTimeStep * Constant::rSecsInHour; // Initialize this gas cooler for this time step ActualFanPower = 0.0; @@ -13211,31 +12844,25 @@ void TransRefrigSystemData::CalcGasCooler(EnergyPlusData &state, int const SysNu if (cooler.PGasCoolerOut < 7.5e6) { // Ensure gas cooler pressure is at least 7.5 MPa for transcritical operation cooler.PGasCoolerOut = 7.5e6; } - cooler.HGasCoolerOut = FluidProperties::GetSupHeatEnthalpyRefrig( - state, this->RefrigerantName, cooler.TGasCoolerOut, cooler.PGasCoolerOut, this->RefIndex, RoutineName); + cooler.HGasCoolerOut = this->refrig->getSupHeatEnthalpy(state, cooler.TGasCoolerOut, cooler.PGasCoolerOut, RoutineName); cooler.TransOpFlag = true; } else { // Gas cooler in subcritical operation cooler.TGasCoolerOut = OutDbTemp + cooler.SubcriticalTempDiff; if (cooler.TGasCoolerOut > 30.978) { // Gas temperature should be less than critical temperature cooler.PGasCoolerOut = 7.2e6; // Fix the pressure to be subcritical - cooler.TGasCoolerOut = - FluidProperties::GetSatTemperatureRefrig(state, this->RefrigerantName, cooler.PGasCoolerOut, this->RefIndex, RoutineName); + cooler.TGasCoolerOut = this->refrig->getSatTemperature(state, cooler.PGasCoolerOut, RoutineName); } else if (cooler.TGasCoolerOut > cooler.MinCondTemp) { // Allow condensing temperature to float above the minimum - cooler.PGasCoolerOut = - FluidProperties::GetSatPressureRefrig(state, this->RefrigerantName, cooler.TGasCoolerOut, this->RefIndex, RoutineName); + cooler.PGasCoolerOut = this->refrig->getSatPressure(state, cooler.TGasCoolerOut, RoutineName); } else { // Don't allow condensing temperature to drop below minimum cooler.TGasCoolerOut = cooler.MinCondTemp; - cooler.PGasCoolerOut = - FluidProperties::GetSatPressureRefrig(state, this->RefrigerantName, cooler.TGasCoolerOut, this->RefIndex, RoutineName); + cooler.PGasCoolerOut = this->refrig->getSatPressure(state, cooler.TGasCoolerOut, RoutineName); } - cooler.HGasCoolerOut = - FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, cooler.TGasCoolerOut, 0.0, this->RefIndex, RoutineName); + cooler.HGasCoolerOut = this->refrig->getSatEnthalpy(state, cooler.TGasCoolerOut, 0.0, RoutineName); cooler.TransOpFlag = false; } // (OutDbTemp > TransitionTemperature) if (cooler.TGasCoolerOut < 30.978) { - cooler.CpGasCoolerOut = - FluidProperties::GetSatSpecificHeatRefrig(state, this->RefrigerantName, cooler.TGasCoolerOut, 0.0, this->RefIndex, RoutineName); + cooler.CpGasCoolerOut = this->refrig->getSatSpecificHeat(state, cooler.TGasCoolerOut, 0.0, RoutineName); } else { cooler.CpGasCoolerOut = 0.0; } @@ -13256,7 +12883,7 @@ void TransRefrigSystemData::CalcGasCooler(EnergyPlusData &state, int const SysNu } break; case FanSpeedCtrlType::TwoSpeed: { // low speed setting of 1/2 fan speed can give up to 60% of capacity. - // 1/2 speed corresonds to ~1/8 power consumption (FanHalfSpeedRatio = 1/(2**2.5) = 0.1768) + // 1/2 speed corresponds to ~1/8 power consumption (FanHalfSpeedRatio = 1/(2**2.5) = 0.1768) // dampers are used to control flow within those two ranges as in FanConstantSpeed ActualFanPower = AirVolRatio * std::exp(1.0 - AirVolRatio) * RatedFanPower; if (CapFac < CapFac60Percent) ActualFanPower = ((AirVolRatio + 0.4) * (FanHalfSpeedRatio)) * std::exp(1.0 - AirVolRatio) * RatedFanPower; @@ -13266,14 +12893,14 @@ void TransRefrigSystemData::CalcGasCooler(EnergyPlusData &state, int const SysNu } // fan speed control type cooler.ActualFanPower = ActualFanPower; - cooler.FanElecEnergy = ActualFanPower * LocalTimeStep * Constant::SecInHour; + cooler.FanElecEnergy = ActualFanPower * localTimeStepSec; cooler.GasCoolerLoad = TotalGasCoolerHeat; - cooler.GasCoolerEnergy = TotalGasCoolerHeat * LocalTimeStep * Constant::SecInHour; + cooler.GasCoolerEnergy = TotalGasCoolerHeat * localTimeStepSec; cooler.GasCoolerCreditWarnIndex = GasCoolerCreditWarnIndex; - cooler.InternalEnergyRecovered = cooler.InternalHeatRecoveredLoad * LocalTimeStep * Constant::SecInHour; - cooler.TotalHeatRecoveredEnergy = cooler.TotalHeatRecoveredLoad * LocalTimeStep * Constant::SecInHour; + cooler.InternalEnergyRecovered = cooler.InternalHeatRecoveredLoad * localTimeStepSec; + cooler.TotalHeatRecoveredEnergy = cooler.TotalHeatRecoveredLoad * localTimeStepSec; this->NetHeatRejectLoad = TotalGasCoolerHeat * TotalLoadFromThisSystem / TotalLoadFromSystems; - this->NetHeatRejectEnergy = this->NetHeatRejectLoad * LocalTimeStep * Constant::SecInHour; + this->NetHeatRejectEnergy = this->NetHeatRejectLoad * localTimeStepSec; } void RefrigSystemData::CalculateCompressors(EnergyPlusData &state) @@ -13335,13 +12962,12 @@ void RefrigSystemData::CalculateCompressors(EnergyPlusData &state) auto &Condenser = state.dataRefrigCase->Condenser; auto &Compressor = state.dataRefrigCase->Compressor; - Real64 LocalTimeStep = state.dataGlobal->TimeStepZone; - if (state.dataRefrigCase->UseSysTimeStep) LocalTimeStep = state.dataHVACGlobal->TimeStepSys; - Real64 const LocalTimeStepSec(LocalTimeStep * Constant::SecInHour); + Real64 localTimeStep = (state.dataRefrigCase->UseSysTimeStep) ? state.dataHVACGlobal->TimeStepSys : state.dataGlobal->TimeStepZone; + Real64 localTimeStepSec = localTimeStep * Constant::rSecsInHour; int CondID = this->CondenserNum(1); auto const &Condenser1 = Condenser(CondID); - Real64 const AccumLoad = max(0.0, (this->UnmetEnergy / LocalTimeStepSec)); // Load due to previously unmet compressor loads + Real64 const AccumLoad = max(0.0, (this->UnmetEnergy / localTimeStepSec)); // Load due to previously unmet compressor loads Real64 const NeededCapacity_base(this->TotalSystemLoad + AccumLoad + this->PipeHeatLoad + this->LSHXTrans); // Before dispatching compressors, zero sum of compressor outputs and zero each compressor @@ -13384,12 +13010,9 @@ void RefrigSystemData::CalculateCompressors(EnergyPlusData &state) NeededCapacity = NeededCapacity_base; // because compressor capacity rated from txv to comp inlet TsatforPdisch = this->TCondense + DelTDischPipes; // need (Psat of (Tcond + delT corresponding to delP disch Pipes)) TsatforPsuct = this->TEvapNeeded - DelTSuctPipes; // need (Psat of (Tevap - delT corresponding to del P suct Pipes)) - HsatVaporforTevapneeded = - FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TEvapNeeded, 1.0, this->RefIndex, RoutineName); - this->HSatLiqCond = - FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TCondense, 0.0, this->RefIndex, RoutineName); - this->CpSatLiqCond = - FluidProperties::GetSatSpecificHeatRefrig(state, this->RefrigerantName, this->TCondense, 0.0, this->RefIndex, RoutineName); + HsatVaporforTevapneeded = this->refrig->getSatEnthalpy(state, this->TEvapNeeded, 1.0, RoutineName); + this->HSatLiqCond = this->refrig->getSatEnthalpy(state, this->TCondense, 0.0, RoutineName); + this->CpSatLiqCond = this->refrig->getSatSpecificHeat(state, this->TCondense, 0.0, RoutineName); // HCaseIn is a function of the condenser rated subcooling, not the compressor rated subcooling // TCompIn needs to include case superheat as well as Temp change from lshx subcoolers // Calculate both here unless set previously by subcooler subroutine @@ -13403,31 +13026,26 @@ void RefrigSystemData::CalculateCompressors(EnergyPlusData &state) } else { // subcooler subroutine has been called to calc TCompIn and HCaseIn this->HCompIn = this->HCaseOut + this->CpSatVapEvap * (this->TCompIn - (this->TEvapNeeded + CaseSuperheat)); } // whether or not subcooler routine used - PSuction = FluidProperties::GetSatPressureRefrig(state, this->RefrigerantName, TsatforPsuct, this->RefIndex, RoutineName); + PSuction = this->refrig->getSatPressure(state, TsatforPsuct, RoutineName); NumComps = this->NumCompressors; } else { // Low-stage side of two-stage system - PCond = FluidProperties::GetSatPressureRefrig(state, this->RefrigerantName, this->TCondense, this->RefIndex, RoutineName); - PEvap = FluidProperties::GetSatPressureRefrig(state, this->RefrigerantName, this->TEvapNeeded, this->RefIndex, RoutineName); + PCond = this->refrig->getSatPressure(state, this->TCondense, RoutineName); + PEvap = this->refrig->getSatPressure(state, this->TEvapNeeded, RoutineName); this->PIntercooler = std::sqrt(PCond * PEvap); - this->TIntercooler = - FluidProperties::GetSatTemperatureRefrig(state, this->RefrigerantName, this->PIntercooler, this->RefIndex, RoutineName); + this->TIntercooler = this->refrig->getSatTemperature(state, this->PIntercooler, RoutineName); NeededCapacity = NeededCapacity_base; // because compressor capacity rated from txv to comp inlet TsatforPdisch = this->TIntercooler + DelTDischPipes; // need (Psat of (Tinter + delT corresponding to delP disch Pipes)) TsatforPsuct = this->TEvapNeeded - DelTSuctPipes; // need (Psat of (Tevap - delT corresponding to del P suct Pipes)) - HsatVaporforTevapneeded = - FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TEvapNeeded, 1.0, this->RefIndex, RoutineName); - this->HSatLiqCond = - FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TCondense, 0.0, this->RefIndex, RoutineName); - this->CpSatLiqCond = - FluidProperties::GetSatSpecificHeatRefrig(state, this->RefrigerantName, this->TCondense, 0.0, this->RefIndex, RoutineName); + HsatVaporforTevapneeded = this->refrig->getSatEnthalpy(state, this->TEvapNeeded, 1.0, RoutineName); + this->HSatLiqCond = this->refrig->getSatEnthalpy(state, this->TCondense, 0.0, RoutineName); + this->CpSatLiqCond = this->refrig->getSatSpecificHeat(state, this->TCondense, 0.0, RoutineName); // HCaseIn is a function of the condenser rated subcooling, not the compressor rated subcooling // TCompIn needs to include case superheat as well as Temp change from lshx subcoolers // Calculate both here unless set previously by subcooler subroutine // HCaseOut corresponds to (tevapneeded + case superheat) if (this->NumSubcoolers == 0) { // No subcooler on this system if (this->IntercoolerType == 1) { // Flash Intercooler - this->HCaseIn = - FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TIntercooler, 0.0, this->RefIndex, RoutineName); + this->HCaseIn = this->refrig->getSatEnthalpy(state, this->TIntercooler, 0.0, RoutineName); this->TLiqInActual = this->TIntercooler; } else if (this->IntercoolerType == 2) { // Shell-and-Coil Intercooler this->TLiqInActual = this->TCondense - Condenser1.RatedSubcool - @@ -13439,45 +13057,37 @@ void RefrigSystemData::CalculateCompressors(EnergyPlusData &state) } else { // subcooler subroutine has been called to calc TCompIn and HCaseIn this->HCompIn = this->HCaseOut + this->CpSatVapEvap * (this->TCompIn - (this->TEvapNeeded + CaseSuperheat)); } // whether or not subcooler routine used - PSuction = FluidProperties::GetSatPressureRefrig(state, this->RefrigerantName, TsatforPsuct, this->RefIndex, RoutineName); + PSuction = this->refrig->getSatPressure(state, TsatforPsuct, RoutineName); NumComps = this->NumCompressors; } // NumStages } else { // Two-stage system, high-stage side NeededCapacity = NeededCapacity_base + this->TotCompPower; TsatforPdisch = this->TCondense + DelTDischPipes; TsatforPsuct = this->TIntercooler; - HsatVaporforTevapneeded = - FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TIntercooler, 1.0, this->RefIndex, RoutineName); - // HSatLiqCond = FluidProperties::GetSatEnthalpyRefrig(state, RefrigerantName, TCondense, 0.0, RefIndex, + HsatVaporforTevapneeded = this->refrig->getSatEnthalpy(state, this->TIntercooler, 1.0, RoutineName); + // HSatLiqCond = Fluid::GetSatEnthalpyRefrig(state, RefrigerantName, TCondense, 0.0, RefIndex, // RoutineName //); ////Autodesk:Tuned These don't change for 2nd stage - // CpSatLiqCond = FluidProperties::GetSatSpecificHeatRefrig(RefrigerantName, TCondense, 0.0, RefIndex, + // CpSatLiqCond = Fluid::GetSatSpecificHeatRefrig(RefrigerantName, TCondense, 0.0, RefIndex, // RoutineName ); ////Autodesk:Tuned These don't change for 2nd stage this->HCaseIn = this->HSatLiqCond - this->CpSatLiqCond * Condenser1.RatedSubcool; this->TCompIn = this->TIntercooler; // System(SysNum)%TLiqInActual = System(SysNum)%TCondense-Condenser(System(SysNum)%CondenserNum(1))%RatedSubcool this->HCompIn = HsatVaporforTevapneeded; - PSuction = FluidProperties::GetSatPressureRefrig(state, this->RefrigerantName, TsatforPsuct, this->RefIndex, RoutineName); + PSuction = this->refrig->getSatPressure(state, TsatforPsuct, RoutineName); NumComps = this->NumHiStageCompressors; } // StageIndex // dispatch compressors to meet load, note they were listed in compressor list in dispatch order - DensityActual = FluidProperties::GetSupHeatDensityRefrig(state, - this->RefrigerantName, - this->TCompIn, - PSuction, - this->RefIndex, - RoutineName); // Autodesk:Tuned Hoisted out of CompIndex loop - TotalEnthalpyChangeActual = this->HCompIn - this->HCaseIn; // Autodesk:Tuned Hoisted out of CompIndex loop - if (this->NumStages == 2) { // Autodesk:Tuned Hoisted out of CompIndex loop + DensityActual = this->refrig->getSupHeatDensity(state, this->TCompIn, PSuction, RoutineName); // Autodesk:Tuned Hoisted out of CompIndex loop + TotalEnthalpyChangeActual = this->HCompIn - this->HCaseIn; // Autodesk:Tuned Hoisted out of CompIndex loop + if (this->NumStages == 2) { // Autodesk:Tuned Hoisted out of CompIndex loop if (StageIndex == 1) { - HCaseInRated_base = - FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TIntercooler, 0.0, this->RefIndex, RoutineName); + HCaseInRated_base = this->refrig->getSatEnthalpy(state, this->TIntercooler, 0.0, RoutineName); } else if (StageIndex == 2) { - HCompInRated_base = - FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TIntercooler, 1.0, this->RefIndex, RoutineName); + HCompInRated_base = this->refrig->getSatEnthalpy(state, this->TIntercooler, 1.0, RoutineName); } } for (int CompIndex = 1; CompIndex <= NumComps; ++CompIndex) { @@ -13542,7 +13152,7 @@ void RefrigSystemData::CalculateCompressors(EnergyPlusData &state) } // Compressor SuperheatRatingType CaseEnthalpyChangeRated = HCompInRated - HCaseInRated; - DensityRated = FluidProperties::GetSupHeatDensityRefrig(state, this->RefrigerantName, TempInRated, PSuction, this->RefIndex, RoutineName); + DensityRated = this->refrig->getSupHeatDensity(state, TempInRated, PSuction, RoutineName); // Adjust capacity and mass flow to reflect the specific volume change due to superheating and // the increase in capacity due to extra subcooling MassCorrection = DensityActual / DensityRated; @@ -13551,7 +13161,7 @@ void RefrigSystemData::CalculateCompressors(EnergyPlusData &state) compressor.Capacity = CapacityCorrection * Curve::CurveValue(state, compressor.CapacityCurvePtr, TsatforPsuct, TsatforPdisch); compressor.MassFlow = compressor.Capacity / TotalEnthalpyChangeActual; - // calculate load factor for last compressor addded + // calculate load factor for last compressor added // assumes either cycling or part load eff = full load eff for last compressor if (StageIndex == 1) { // Single-stage or low-stage compressors if ((this->TotCompCapacity + compressor.Capacity) >= NeededCapacity) { @@ -13562,8 +13172,8 @@ void RefrigSystemData::CalculateCompressors(EnergyPlusData &state) this->TotCompCapacity += compressor.Capacity; this->RefMassFlowComps += compressor.MassFlow; this->TotCompPower += compressor.Power; - compressor.ElecConsumption = compressor.Power * LocalTimeStepSec; - compressor.CoolingEnergy = compressor.Capacity * LocalTimeStepSec; + compressor.ElecConsumption = compressor.Power * localTimeStepSec; + compressor.CoolingEnergy = compressor.Capacity * localTimeStepSec; compressor.LoadFactor = LFLastComp; break; // numcomps do } else { //>= needed capacity @@ -13581,8 +13191,8 @@ void RefrigSystemData::CalculateCompressors(EnergyPlusData &state) this->RefMassFlowHiStageComps += compressor.MassFlow; this->TotHiStageCompPower += compressor.Power; this->FlowRatioIntercooler = this->RefMassFlowComps / this->RefMassFlowHiStageComps; - compressor.ElecConsumption = compressor.Power * LocalTimeStepSec; - compressor.CoolingEnergy = compressor.Capacity * LocalTimeStepSec; + compressor.ElecConsumption = compressor.Power * localTimeStepSec; + compressor.CoolingEnergy = compressor.Capacity * localTimeStepSec; compressor.LoadFactor = LFLastComp; break; // numcomps do } else { //>= needed capacity @@ -13591,8 +13201,8 @@ void RefrigSystemData::CalculateCompressors(EnergyPlusData &state) this->TotHiStageCompPower += compressor.Power; } //>= needed capacity } // StageIndex - compressor.ElecConsumption = compressor.Power * LocalTimeStepSec; - compressor.CoolingEnergy = compressor.Capacity * LocalTimeStepSec; + compressor.ElecConsumption = compressor.Power * localTimeStepSec; + compressor.CoolingEnergy = compressor.Capacity * localTimeStepSec; compressor.LoadFactor = 1.0; } // NumComps } @@ -13602,13 +13212,13 @@ void RefrigSystemData::CalculateCompressors(EnergyPlusData &state) this->HCompOut = this->HCompIn + this->TotCompPower / this->RefMassFlowComps; // error found 9/19/2011, was System(SysNum)%TotCompPower*LocalTimeStep*DataGlobals::SecInHour/System(SysNum)%RefMassFlowComps } else { // High-stage compressors (only for two-stage systems) - HHiStageCompIn = FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TIntercooler, 1.0, this->RefIndex, RoutineName); + HHiStageCompIn = this->refrig->getSatEnthalpy(state, this->TIntercooler, 1.0, RoutineName); this->HCompOut = HHiStageCompIn + this->TotHiStageCompPower / this->RefMassFlowHiStageComps; } // Calculate superheat energy available for desuperheaters - HSatVapCondense = FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TCondense, 1.0, this->RefIndex, RoutineName); - CpSatVapCondense = FluidProperties::GetSatSpecificHeatRefrig(state, this->RefrigerantName, this->TCondense, 1.0, this->RefIndex, RoutineName); + HSatVapCondense = this->refrig->getSatEnthalpy(state, this->TCondense, 1.0, RoutineName); + CpSatVapCondense = this->refrig->getSatSpecificHeat(state, this->TCondense, 1.0, RoutineName); if (this->NumStages == 1) { // Single-stage systems state.dataHeatBal->HeatReclaimRefrigCondenser(CondID).AvailCapacity = this->RefMassFlowComps * (this->HCompOut - HSatVapCondense); } else { // Two-stage systems @@ -13621,13 +13231,13 @@ void RefrigSystemData::CalculateCompressors(EnergyPlusData &state) state.dataHeatBal->HeatReclaimRefrigCondenser(CondID).AvailTemperature = (TsatforPdisch + TCompOutEstimate) / 2.0; this->AverageCompressorCOP = this->TotCompCapacity / (this->TotCompPower + this->TotHiStageCompPower); - this->TotCompElecConsump = this->TotCompPower * LocalTimeStepSec; + this->TotCompElecConsump = this->TotCompPower * localTimeStepSec; if (this->NumStages == 2) { - this->TotHiStageCompElecConsump = this->TotHiStageCompPower * LocalTimeStepSec; + this->TotHiStageCompElecConsump = this->TotHiStageCompPower * localTimeStepSec; this->TotCompElecConsumpTwoStage = this->TotCompElecConsump + this->TotHiStageCompElecConsump; } - this->TotCompCoolingEnergy = this->TotCompCapacity * LocalTimeStepSec; - this->TotHiStageCompCoolingEnergy = this->TotHiStageCompCapacity * LocalTimeStepSec; + this->TotCompCoolingEnergy = this->TotCompCapacity * localTimeStepSec; + this->TotHiStageCompCoolingEnergy = this->TotHiStageCompCapacity * localTimeStepSec; } void TransRefrigSystemData::CalculateTransCompressors(EnergyPlusData &state) @@ -13650,7 +13260,7 @@ void TransRefrigSystemData::CalculateTransCompressors(EnergyPlusData &state) // REFERENCES: // ANSI/AHRI. 2004. Standard 540, Standard for Performance Rating of Positive Displacement Refrigerant - // Comprssors and Compressor Units. Arlington, VA: Air-Conditioning, Heating, and Refrigeration + // Compressors and Compressor Units. Arlington, VA: Air-Conditioning, Heating, and Refrigeration // Institute. // Ge, Y.T., and S.A. Tassou. 2011. Performance evaluation and optimal design of supermarket refrigeration // systems with supermarket model "SuperSim", Part I: Model description and validation. International @@ -13689,8 +13299,8 @@ void TransRefrigSystemData::CalculateTransCompressors(EnergyPlusData &state) Real64 HGCOutlet; // Enthalpy at gas cooler outlet, J/kg Real64 HIdeal; // Ideal enthalpy at subcooler (for 100% effectiveness) Real64 HsatLiqforTevapNeededMT; // Enthalpy of saturated liquid at MT evaporator, J/kg - Real64 HsatVaporforTevapneededMT; // Enthlapy of saturated vapor at MT evaporator (transcritical cycle), J/kg - Real64 HsatVaporforTevapneededLT; // Enthlapy of saturated vapor at LT evaporator (transcritical cycle), J/kg + Real64 HsatVaporforTevapneededMT; // Enthalpy of saturated vapor at MT evaporator (transcritical cycle), J/kg + Real64 HsatVaporforTevapneededLT; // Enthalpy of saturated vapor at LT evaporator (transcritical cycle), J/kg Real64 LFLastComp; // Load factor for last compressor dispatched Real64 MassCorrectionLT; // Mass flow at existing subcool/superheat over cap at rated conditions for LT loads Real64 MassCorrectionMT; // Mass flow at existing subcool/superheat over cap at rated conditions for MT loads @@ -13718,28 +13328,27 @@ void TransRefrigSystemData::CalculateTransCompressors(EnergyPlusData &state) auto &Compressor = state.dataRefrigCase->Compressor; auto &GasCooler = state.dataRefrigCase->GasCooler; - Real64 LocalTimeStep = state.dataGlobal->TimeStepZone; - if (state.dataRefrigCase->UseSysTimeStep) LocalTimeStep = state.dataHVACGlobal->TimeStepSys; + Real64 localTimeStep = (state.dataRefrigCase->UseSysTimeStep) ? state.dataHVACGlobal->TimeStepSys : state.dataGlobal->TimeStepZone; + Real64 localTimeStepSec = localTimeStep * Constant::rSecsInHour; // Determine refrigerating capacity needed // Load due to previously unmet low temperature compressor loads (transcritical system) Real64 AccumLoadLT; NeededCapacityLT = 0.0; if (this->TransSysType == 2) { - AccumLoadLT = max(0.0, (this->UnmetEnergyLT / LocalTimeStep / Constant::SecInHour)); + AccumLoadLT = max(0.0, (this->UnmetEnergyLT / localTimeStep / Constant::rSecsInHour)); // localTimeStep / rSecsInHour? NeededCapacityLT = this->TotalSystemLoadLT + AccumLoadLT + this->PipeHeatLoadLT; } // (TransSystem(SysNum)%TransSysType == 2) // Load due to previously unmet medium temperature compressor loads (transcritical system) - Real64 AccumLoadMT = max(0.0, (this->UnmetEnergyMT / LocalTimeStep / Constant::SecInHour)); + Real64 AccumLoadMT = max(0.0, (this->UnmetEnergyMT / localTimeStep / Constant::rSecsInHour)); NeededCapacityMT = this->TotalSystemLoadMT + AccumLoadMT + this->PipeHeatLoadMT; // Determine refrigerant properties at receiver - this->CpSatLiqReceiver = - FluidProperties::GetSatSpecificHeatRefrig(state, this->RefrigerantName, this->TReceiver, 0.0, this->RefIndex, RoutineName); + this->CpSatLiqReceiver = this->refrig->getSatSpecificHeat(state, this->TReceiver, 0.0, RoutineName); // Enthalpy at the receiver bypass, J/kg - Real64 HReceiverBypass = FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TReceiver, 1.0, this->RefIndex, RoutineName); + Real64 HReceiverBypass = this->refrig->getSatEnthalpy(state, this->TReceiver, 1.0, RoutineName); // Determine refrigerant properties at low temperature (LT) loads (if present) // Dispatch low pressure (LP) compressors as necessary @@ -13750,13 +13359,10 @@ void TransRefrigSystemData::CalculateTransCompressors(EnergyPlusData &state) this->HCompInLP = this->HCaseOutLT + this->PipeHeatLoadLT / this->RefMassFlowtoLTLoads; TsatforPsucLT = this->TEvapNeededLT; TsatforPdisLT = this->TEvapNeededMT; - HsatVaporforTevapneededLT = - FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TEvapNeededLT, 1.0, this->RefIndex, RoutineName); - HsatLiqforTevapNeededMT = - FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TEvapNeededMT, 0.0, this->RefIndex, RoutineName); - PSuctionLT = FluidProperties::GetSatPressureRefrig(state, this->RefrigerantName, TsatforPsucLT, this->RefIndex, RoutineName); - DensityActualLT = - FluidProperties::GetSupHeatDensityRefrig(state, this->RefrigerantName, this->TCompInLP, PSuctionLT, this->RefIndex, RoutineName); + HsatVaporforTevapneededLT = this->refrig->getSatEnthalpy(state, this->TEvapNeededLT, 1.0, RoutineName); + HsatLiqforTevapNeededMT = this->refrig->getSatEnthalpy(state, this->TEvapNeededMT, 0.0, RoutineName); + PSuctionLT = this->refrig->getSatPressure(state, TsatforPsucLT, RoutineName); + DensityActualLT = this->refrig->getSupHeatDensity(state, this->TCompInLP, PSuctionLT, RoutineName); TotalEnthalpyChangeActualLT = this->HCompInLP - this->HCaseInLT; // Dispatch low pressure (LP) compressors @@ -13784,8 +13390,7 @@ void TransRefrigSystemData::CalculateTransCompressors(EnergyPlusData &state) HCaseInRatedLT = HsatLiqforTevapNeededMT - this->CpSatLiqReceiver * compressor.RatedSubcool; } break; case CompRatingType::LiquidTemperature: { // have rated liquid temperature stored in "RatedSubcool" - HCaseInRatedLT = - FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, compressor.RatedSubcool, 0.0, this->RefIndex, RoutineName); + HCaseInRatedLT = this->refrig->getSatEnthalpy(state, compressor.RatedSubcool, 0.0, RoutineName); } break; default: break; @@ -13798,16 +13403,14 @@ void TransRefrigSystemData::CalculateTransCompressors(EnergyPlusData &state) case CompRatingType::ReturnGasTemperature: { // have rated compressor inlet temperature stored in // "CompRatingType::Superheat" TempInRatedLP = compressor.RatedSuperheat; - HCompInRatedLP = FluidProperties::GetSupHeatEnthalpyRefrig( - state, this->RefrigerantName, compressor.RatedSuperheat, PSuctionLT, this->RefIndex, RoutineName); + HCompInRatedLP = this->refrig->getSupHeatEnthalpy(state, compressor.RatedSuperheat, PSuctionLT, RoutineName); } break; default: break; } CaseEnthalpyChangeRatedLT = HCompInRatedLP - HCaseInRatedLT; - DensityRatedLP = - FluidProperties::GetSupHeatDensityRefrig(state, this->RefrigerantName, TempInRatedLP, PSuctionLT, this->RefIndex, RoutineName); + DensityRatedLP = this->refrig->getSupHeatDensity(state, TempInRatedLP, PSuctionLT, RoutineName); // Adjust capacity and mass flow to reflect the specific volume change due to superheating and // the increase in capacity due to extra subcooling @@ -13817,8 +13420,8 @@ void TransRefrigSystemData::CalculateTransCompressors(EnergyPlusData &state) compressor.Power = Curve::CurveValue(state, compressor.ElecPowerCurvePtr, TsatforPsucLT, TsatforPdisLT); compressor.Capacity = CapacityCorrectionLT * Curve::CurveValue(state, compressor.CapacityCurvePtr, TsatforPsucLT, TsatforPdisLT); compressor.MassFlow = compressor.Capacity / TotalEnthalpyChangeActualLT; - compressor.ElecConsumption = compressor.Power * LocalTimeStep * Constant::SecInHour; - compressor.CoolingEnergy = compressor.Capacity * LocalTimeStep * Constant::SecInHour; + compressor.ElecConsumption = compressor.Power * localTimeStepSec; + compressor.CoolingEnergy = compressor.Capacity * localTimeStepSec; compressor.LoadFactor = 1.0; if ((this->TotCompCapacityLP + compressor.Capacity) >= NeededCapacityLT) { LFLastComp = (NeededCapacityLT - this->TotCompCapacityLP) / compressor.Capacity; @@ -13828,8 +13431,8 @@ void TransRefrigSystemData::CalculateTransCompressors(EnergyPlusData &state) this->TotCompCapacityLP += compressor.Capacity; this->RefMassFlowCompsLP += compressor.MassFlow; this->TotCompPowerLP += compressor.Power; - compressor.ElecConsumption = compressor.Power * LocalTimeStep * Constant::SecInHour; - compressor.CoolingEnergy = compressor.Capacity * LocalTimeStep * Constant::SecInHour; + compressor.ElecConsumption = compressor.Power * localTimeStepSec; + compressor.CoolingEnergy = compressor.Capacity * localTimeStepSec; compressor.LoadFactor = LFLastComp; break; } else { @@ -13849,10 +13452,9 @@ void TransRefrigSystemData::CalculateTransCompressors(EnergyPlusData &state) } else { // Transcritical system is operating in subcritical region TsatforPdisMT = GasCooler(this->GasCoolerNum(1)).TGasCoolerOut; } - PSuctionMT = FluidProperties::GetSatPressureRefrig(state, this->RefrigerantName, TsatforPsucMT, this->RefIndex, RoutineName); + PSuctionMT = this->refrig->getSatPressure(state, TsatforPsucMT, RoutineName); PGCOutlet = GasCooler(this->GasCoolerNum(1)).PGasCoolerOut; - HsatVaporforTevapneededMT = - FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TEvapNeededMT, 1.0, this->RefIndex, RoutineName); + HsatVaporforTevapneededMT = this->refrig->getSatEnthalpy(state, this->TEvapNeededMT, 1.0, RoutineName); this->HCaseInMT = this->HSatLiqReceiver; // Enthalpy of refrigerant after leaving medium temperature loads and low pressure compressors @@ -13868,8 +13470,7 @@ void TransRefrigSystemData::CalculateTransCompressors(EnergyPlusData &state) if ((GasCooler(this->GasCoolerNum(1)).HGasCoolerOut + this->DelHSubcoolerDis) > this->HSatLiqReceiver) { for (Iter = 1; Iter <= 15; ++Iter) { // Maximum of 15 iterations to find receiver quality QualityReceiver = (Xu + Xl) / 2.0; - Real64 Hnew = - FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TReceiver, QualityReceiver, this->RefIndex, RoutineName); + Real64 Hnew = this->refrig->getSatEnthalpy(state, this->TReceiver, QualityReceiver, RoutineName); // estimated QualityReceiver is too high if (Hnew > (GasCooler(this->GasCoolerNum(1)).HGasCoolerOut + this->DelHSubcoolerDis)) { @@ -13890,11 +13491,11 @@ void TransRefrigSystemData::CalculateTransCompressors(EnergyPlusData &state) (this->RefMassFlowtoLTLoads + this->RefMassFlowtoMTLoads + this->RefMassFlowReceiverBypass); // Iterate to find the suction temperature entering subcooler - Xl = FluidProperties::GetSatTemperatureRefrig(state, this->RefrigerantName, PSuctionMT, this->RefIndex, RoutineName); + Xl = this->refrig->getSatTemperature(state, PSuctionMT, RoutineName); Xu = Xl + 50.0; for (Iter = 1; Iter <= 15; ++Iter) { // Maximum of 15 iterations Xnew = (Xu + Xl) / 2.0; - Real64 Hnew = FluidProperties::GetSupHeatEnthalpyRefrig(state, this->RefrigerantName, Xnew, PSuctionMT, this->RefIndex, RoutineName); + Real64 Hnew = this->refrig->getSupHeatEnthalpy(state, Xnew, PSuctionMT, RoutineName); if (Hnew > this->HCompInHP) { // xnew is too high Xu = Xnew; } else { // xnew is too low @@ -13905,8 +13506,7 @@ void TransRefrigSystemData::CalculateTransCompressors(EnergyPlusData &state) TSubcoolerColdIn = Xnew; // Modify receiver inlet enthalpy and HP compressor inlet enthalpy to account for subcooler - HIdeal = FluidProperties::GetSupHeatEnthalpyRefrig( - state, this->RefrigerantName, GasCooler(this->GasCoolerNum(1)).TGasCoolerOut, PSuctionMT, this->RefIndex, RoutineName); + HIdeal = this->refrig->getSupHeatEnthalpy(state, GasCooler(this->GasCoolerNum(1)).TGasCoolerOut, PSuctionMT, RoutineName); // Only use subcooler if suction gas inlet temperature less than gas cooler outlet temperature if (TSubcoolerColdIn < GasCooler(this->GasCoolerNum(1)).TGasCoolerOut) { SubcoolEffect = this->SCEffectiveness; @@ -13918,11 +13518,11 @@ void TransRefrigSystemData::CalculateTransCompressors(EnergyPlusData &state) this->DelHSubcoolerDis = -this->DelHSubcoolerSuc; // Iterate to find the temperature at the inlet of the high pressure (HP) compressors - Xl = FluidProperties::GetSatTemperatureRefrig(state, this->RefrigerantName, PSuctionMT, this->RefIndex, RoutineName); + Xl = this->refrig->getSatTemperature(state, PSuctionMT, RoutineName); Xu = Xl + 50.0; for (Iter = 1; Iter <= 15; ++Iter) { // Maximum of 15 iterations Xnew = (Xu + Xl) / 2.0; - Real64 Hnew = FluidProperties::GetSupHeatEnthalpyRefrig(state, this->RefrigerantName, Xnew, PSuctionMT, this->RefIndex, RoutineName); + Real64 Hnew = this->refrig->getSupHeatEnthalpy(state, Xnew, PSuctionMT, RoutineName); if (Hnew > this->HCompInHP) { // xnew is too high Xu = Xnew; } else { // xnew is too low @@ -13935,8 +13535,7 @@ void TransRefrigSystemData::CalculateTransCompressors(EnergyPlusData &state) // For capacity correction of HP compressors, consider subcooler, receiver, MT loads, LT loads and LP compressors // to constitute the "load". The actual and rated conditions at the exit of the gas cooler and the inlet of the // HP compressors are used for capacity correction calculations. - DensityActualMT = - FluidProperties::GetSupHeatDensityRefrig(state, this->RefrigerantName, this->TCompInHP, PSuctionMT, this->RefIndex, RoutineName); + DensityActualMT = this->refrig->getSupHeatDensity(state, this->TCompInHP, PSuctionMT, RoutineName); TotalEnthalpyChangeActualMT = this->HCompInHP - GasCooler(this->GasCoolerNum(1)).HGasCoolerOut; // Dispatch HP compressors @@ -13974,8 +13573,7 @@ void TransRefrigSystemData::CalculateTransCompressors(EnergyPlusData &state) } break; case CompRatingType::LiquidTemperature: { // have rated liquid temperature stored in "RatedSubcool" if (!GasCooler(this->GasCoolerNum(1)).TransOpFlag) { // Subcritical operation - HCaseInRatedMT = - FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, compressor.RatedSubcool, 0.0, this->RefIndex, RoutineName); + HCaseInRatedMT = this->refrig->getSatEnthalpy(state, compressor.RatedSubcool, 0.0, RoutineName); } else { // Transcritical operation HCaseInRatedMT = GasCooler(this->GasCoolerNum(1)).HGasCoolerOut; } // (.NOT.GasCooler(SysNum)%TransOpFlag) @@ -13990,16 +13588,14 @@ void TransRefrigSystemData::CalculateTransCompressors(EnergyPlusData &state) } break; case CompRatingType::ReturnGasTemperature: { // have rated compressor inlet temperature stored in "RatedSuperheat" TempInRatedHP = compressor.RatedSuperheat; - HCompInRatedHP = FluidProperties::GetSupHeatEnthalpyRefrig( - state, this->RefrigerantName, compressor.RatedSuperheat, PSuctionMT, this->RefIndex, RoutineName); + HCompInRatedHP = this->refrig->getSupHeatEnthalpy(state, compressor.RatedSuperheat, PSuctionMT, RoutineName); } break; default: break; } CaseEnthalpyChangeRatedMT = HCompInRatedHP - HCaseInRatedMT; - DensityRatedHP = - FluidProperties::GetSupHeatDensityRefrig(state, this->RefrigerantName, TempInRatedHP, PSuctionMT, this->RefIndex, RoutineName); + DensityRatedHP = this->refrig->getSupHeatDensity(state, TempInRatedHP, PSuctionMT, RoutineName); // Adjust capacity and mass flow to reflect the specific volume change due to superheating and // the increase in capacity due to extra subcooling MassCorrectionMT = DensityActualMT / DensityRatedHP; @@ -14014,8 +13610,8 @@ void TransRefrigSystemData::CalculateTransCompressors(EnergyPlusData &state) } // (GasCooler(SysNum)%TransOpFlag) // Mass flow through HP compressors is HP compressor refrigerating capacity divided by MT load, LT load and LP compressor power compressor.MassFlow = TotalRefMassFlow * compressor.Capacity / (NeededCapacityMT + NeededCapacityLT + this->TotCompPowerLP); - compressor.ElecConsumption = compressor.Power * LocalTimeStep * Constant::SecInHour; - compressor.CoolingEnergy = compressor.Capacity * LocalTimeStep * Constant::SecInHour; + compressor.ElecConsumption = compressor.Power * localTimeStepSec; + compressor.CoolingEnergy = compressor.Capacity * localTimeStepSec; compressor.LoadFactor = 1.0; // calculate load factor for last compressor added // assumes either cycling or part load eff = full load eff for last compressor @@ -14027,8 +13623,8 @@ void TransRefrigSystemData::CalculateTransCompressors(EnergyPlusData &state) this->TotCompCapacityHP += compressor.Capacity; this->RefMassFlowCompsHP += compressor.MassFlow; this->TotCompPowerHP += compressor.Power; - compressor.ElecConsumption = compressor.Power * LocalTimeStep * Constant::SecInHour; - compressor.CoolingEnergy = compressor.Capacity * LocalTimeStep * Constant::SecInHour; + compressor.ElecConsumption = compressor.Power * localTimeStepSec; + compressor.CoolingEnergy = compressor.Capacity * localTimeStepSec; compressor.LoadFactor = LFLastComp; break; } else { @@ -14043,8 +13639,8 @@ void TransRefrigSystemData::CalculateTransCompressors(EnergyPlusData &state) this->RefMassFlowComps = this->RefMassFlowCompsLP + this->RefMassFlowCompsHP; this->TotCompCapacity = this->TotCompCapacityHP + this->TotCompCapacityLP; this->AverageCompressorCOP = (this->TotCompCapacityHP - this->TotCompPowerLP) / (this->TotCompPowerLP + this->TotCompPowerHP); - this->TotCompElecConsump = (this->TotCompPowerLP + this->TotCompPowerHP) * LocalTimeStep * Constant::SecInHour; - this->TotCompCoolingEnergy = (this->TotCompCapacityLP + this->TotCompCapacityHP) * LocalTimeStep * Constant::SecInHour; + this->TotCompElecConsump = (this->TotCompPowerLP + this->TotCompPowerHP) * localTimeStepSec; + this->TotCompCoolingEnergy = (this->TotCompCapacityLP + this->TotCompCapacityHP) * localTimeStepSec; } void RefrigSystemData::CalculateSubcoolers(EnergyPlusData &state) @@ -14074,31 +13670,28 @@ void RefrigSystemData::CalculateSubcoolers(EnergyPlusData &state) auto &Condenser = state.dataRefrigCase->Condenser; auto &Subcooler = state.dataRefrigCase->Subcooler; - Real64 LocalTimeStep = state.dataGlobal->TimeStepZone; - if (state.dataRefrigCase->UseSysTimeStep) LocalTimeStep = state.dataHVACGlobal->TimeStepSys; + Real64 localTimeStep = (state.dataRefrigCase->UseSysTimeStep) ? state.dataHVACGlobal->TimeStepSys : state.dataGlobal->TimeStepZone; + Real64 localTimeStepSec = localTimeStep * Constant::rSecsInHour; // HCaseIn has to be recalculated as the starting point for the subcoolers here because // of the multiple number of iterations through this subroutine and because Tcondense is evolving. if (this->NumStages == 1) { // Single-stage compression system - this->HSatLiqCond = FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TCondense, 0.0, this->RefIndex, RoutineName); - this->CpSatLiqCond = - FluidProperties::GetSatSpecificHeatRefrig(state, this->RefrigerantName, this->TCondense, 0.0, this->RefIndex, RoutineName); + this->HSatLiqCond = this->refrig->getSatEnthalpy(state, this->TCondense, 0.0, RoutineName); + this->CpSatLiqCond = this->refrig->getSatSpecificHeat(state, this->TCondense, 0.0, RoutineName); this->HCaseIn = this->HSatLiqCond - this->CpSatLiqCond * Condenser(this->CondenserNum(1)).RatedSubcool; // Two-stage compression with flash intercooler } else if (this->NumStages == 2 && this->IntercoolerType == 1) { - this->HSatLiqCond = FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TCondense, 0.0, this->RefIndex, RoutineName); - this->CpSatLiqCond = - FluidProperties::GetSatSpecificHeatRefrig(state, this->RefrigerantName, this->TCondense, 0.0, this->RefIndex, RoutineName); - this->HCaseIn = FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TIntercooler, 0.0, this->RefIndex, RoutineName); + this->HSatLiqCond = this->refrig->getSatEnthalpy(state, this->TCondense, 0.0, RoutineName); + this->CpSatLiqCond = this->refrig->getSatSpecificHeat(state, this->TCondense, 0.0, RoutineName); + this->HCaseIn = this->refrig->getSatEnthalpy(state, this->TIntercooler, 0.0, RoutineName); // Two-stage compression with shell-and-coil intercooler } else if (this->NumStages == 2 && this->IntercoolerType == 2) { TLiqInActualLocal = this->TCondense - Condenser(this->CondenserNum(1)).RatedSubcool - this->IntercoolerEffectiveness * (this->TCondense - Condenser(this->CondenserNum(1)).RatedSubcool - this->TIntercooler); - this->HSatLiqCond = FluidProperties::GetSatEnthalpyRefrig(state, this->RefrigerantName, this->TCondense, 0.0, this->RefIndex, RoutineName); - this->CpSatLiqCond = - FluidProperties::GetSatSpecificHeatRefrig(state, this->RefrigerantName, this->TCondense, 0.0, this->RefIndex, RoutineName); + this->HSatLiqCond = this->refrig->getSatEnthalpy(state, this->TCondense, 0.0, RoutineName); + this->CpSatLiqCond = this->refrig->getSatSpecificHeat(state, this->TCondense, 0.0, RoutineName); this->HCaseIn = this->HSatLiqCond - this->CpSatLiqCond * (this->TCondense - TLiqInActualLocal); } // NumStages and IntercoolerType @@ -14137,7 +13730,7 @@ void RefrigSystemData::CalculateSubcoolers(EnergyPlusData &state) int SysProvideID = cooler.MechSourceSysID; System(SysProvideID).MechSCLoad(SubcoolerID) = mechSCLoad; cooler.MechSCTransLoad = mechSCLoad; - cooler.MechSCTransEnergy = mechSCLoad * LocalTimeStep * Constant::SecInHour; + cooler.MechSCTransEnergy = mechSCLoad * localTimeStepSec; // Reset inlet temperature for any LSHX that follows this mech subcooler TLiqInActualLocal = ControlTLiqOut; this->TCompIn = this->TEvapNeeded + CaseSuperheat; @@ -14152,7 +13745,7 @@ void RefrigSystemData::CalculateSubcoolers(EnergyPlusData &state) this->TCompIn = TVapInActual + SubcoolerSupHeat; this->HCaseIn -= SubcoolLoad / this->RefMassFlowtoLoads; this->LSHXTrans = SubcoolLoad; - this->LSHXTransEnergy = SubcoolLoad * LocalTimeStep * Constant::SecInHour; + this->LSHXTransEnergy = SubcoolLoad * localTimeStepSec; } break; default: break; @@ -14385,7 +13978,7 @@ void ReportRefrigerationComponents(EnergyPlusData &state) } //((NumSimulationSubcoolers - NumSimulationMechSubcoolers) > 0) if (state.dataRefrigCase->NumTransRefrigSystems > 0) { - print(state.files.eio, "{}\n", Format_120); // Intro to detailed transcriticial refrigeration system + print(state.files.eio, "{}\n", Format_120); // Intro to detailed transcritical refrigeration system print(state.files.eio, "{}\n", Format_121); // Detailed system header if (state.dataRefrigCase->NumSimulationCases > 0) { print(state.files.eio, "{}\n", Format_105); // Case header @@ -15000,23 +14593,19 @@ void WalkInData::CalculateWalkIn(EnergyPlusData &state) // Absolute pointer to Real64 DensitySqRtFactor(0.0); // from ASHRAE 2010 eq 12 page 24.4 for door infiltration // Current value of WalkIn operating (availability) schedule - Real64 WalkInSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->SchedPtr); + Real64 WalkInSchedule = this->availSched->getCurrentVal(); if (WalkInSchedule <= 0) return; // GET OTHER SCHEDULES - DefrostSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->DefrostSchedPtr); - Real64 DefrostDripDownSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->DefrostDripDownSchedPtr); + DefrostSchedule = this->defrostSched->getCurrentVal(); + Real64 DefrostDripDownSchedule = this->defrostDripDownSched->getCurrentVal(); // next statement In case user doesn't understand concept of drip down schedule DefrostDripDownSchedule = max(DefrostDripDownSchedule, DefrostSchedule); // next four values optional, so set to default before checking for schedule - Real64 StockingLoad(0.0); // Total load due to stocking WalkIn product (W) - Real64 LightingSchedule = 1.0; - Real64 HeaterSchedule = 1.0; - Real64 CircFanSchedule = 1.0; - if (this->StockingSchedPtr > 0) StockingLoad = ScheduleManager::GetCurrentScheduleValue(state, this->StockingSchedPtr); - if (this->LightingSchedPtr > 0) LightingSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->LightingSchedPtr); - if (this->HeaterSchedPtr > 0) HeaterSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->HeaterSchedPtr); - if (this->CircFanSchedPtr > 0) CircFanSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->CircFanSchedPtr); + Real64 StockingLoad = (this->stockingSched != nullptr) ? this->stockingSched->getCurrentVal() : 0.0; + Real64 LightingSchedule = (this->lightingSched != nullptr) ? this->lightingSched->getCurrentVal() : 1.0; + Real64 HeaterSchedule = (this->heaterSched != nullptr) ? this->heaterSched->getCurrentVal() : 1.0; + Real64 CircFanSchedule = (this->circFanAvailSched != nullptr) ? this->circFanAvailSched->getCurrentVal() : 1.0; // Set local subroutine variables for convenience Real64 TWalkIn = this->Temperature; // WalkIn operating temperature (C) @@ -15110,8 +14699,7 @@ void WalkInData::CalculateWalkIn(EnergyPlusData &state) // Absolute pointer to DrArea = StockDoorArea; // if exists, get Stock Door Zone schedule Real64 DoorOpenFactor = DefaultWalkInDoorOpenFactor; - if (this->StockDoorOpenSchedPtr(ZoneID) > 0) - DoorOpenFactor = ScheduleManager::GetCurrentScheduleValue(state, this->StockDoorOpenSchedPtr(ZoneID)); + if (this->stockDoorOpenScheds(ZoneID) != nullptr) DoorOpenFactor = this->stockDoorOpenScheds(ZoneID)->getCurrentVal(); FullFlowInfLoad = 0.221 * DrArea * (EnthalpyZoneAir - EnthalpyAirWalkIn) * DensityAirWalkIn * DensitySqRtFactor * std::sqrt(Gravity * DrHeight) * DensityFactorFm; @@ -15128,8 +14716,7 @@ void WalkInData::CalculateWalkIn(EnergyPlusData &state) // Absolute pointer to DrArea = GlassDoorArea; // get Glass Door Zone schedule Real64 DoorOpenFactor = DefaultWalkInDoorOpenFactor; // default value - if (this->GlassDoorOpenSchedPtr(ZoneID) > 0) - DoorOpenFactor = ScheduleManager::GetCurrentScheduleValue(state, this->GlassDoorOpenSchedPtr(ZoneID)); + if (this->glassDoorOpenScheds(ZoneID) != nullptr) DoorOpenFactor = this->glassDoorOpenScheds(ZoneID)->getCurrentVal(); FullFlowInfLoad = 0.221 * DrArea * (EnthalpyZoneAir - EnthalpyAirWalkIn) * DensityAirWalkIn * DensitySqRtFactor * std::sqrt(Gravity * DrHeight) * DensityFactorFm; @@ -15146,7 +14733,7 @@ void WalkInData::CalculateWalkIn(EnergyPlusData &state) // Absolute pointer to MassDryAirRate * (HumRatioZoneAir - HumRatioAirWalkIn); // Walk in cooler removes water at this rate in this zone (kg/s) // Just as with cases, we assume no latent credit (water removal = 0) to zone or load on cooler during dripdown // To be consistent with the treatment of refrigerated cases, latent load - // and latent credit are bothbased on reducing the infiltrating vapor to ice. (This is + // and latent credit are both based on reducing the infiltrating vapor to ice. (This is // slightly greater than if the latent credit were based upon condensing out the water as liquid.) // then it would be: ZoneLatentLoad = -WaterRemovRate * WaterToVaporEnthalpy * (1.0d0-DefrostDripDownSchedule) ZoneLatentLoad = -WaterRemovRate * IcetoVaporEnthalpy * (1.0 - DefrostDripDownSchedule); @@ -15245,7 +14832,7 @@ void WalkInData::CalculateWalkIn(EnergyPlusData &state) // Absolute pointer to // Reduce defrost heat load on walkin by amount of ice melted during time step Real64 FrostChangekg = min(AvailDefrostEnergy / IceMeltEnthalpy, StartFrostKg); if (FrostChangekg < StartFrostKg) { - DefrostLoad -= FrostChangekg * IceMeltEnthalpy / state.dataGlobal->TimeStepZone / Constant::SecInHour; + DefrostLoad -= FrostChangekg * IceMeltEnthalpy / state.dataGlobal->TimeStepZone / Constant::rSecsInHour; if (!state.dataGlobal->WarmupFlag) this->KgFrost = StartFrostKg - FrostChangekg; // DefrostSchedule not changed } else { // all frost melted during time step, so need to terminate defrost @@ -15270,7 +14857,7 @@ void WalkInData::CalculateWalkIn(EnergyPlusData &state) // Absolute pointer to } else { // Not temperature control type Real64 FrostChangekg = min(DefrostEnergy / IceMeltEnthalpy, StartFrostKg); // Reduce defrost heat load on walkin by amount of ice melted during time step - DefrostLoad -= FrostChangekg * IceMeltEnthalpy / state.dataGlobal->TimeStepZone / Constant::SecInHour; + DefrostLoad -= FrostChangekg * IceMeltEnthalpy / state.dataGlobal->TimeStepZone / Constant::rSecsInHour; if (!state.dataGlobal->WarmupFlag) this->KgFrost = StartFrostKg - FrostChangekg; // DefrostSchedule not changed } // Temperature termination control type @@ -15308,7 +14895,7 @@ void WalkInData::CalculateWalkIn(EnergyPlusData &state) // Absolute pointer to // run full out until the temperature is brought back down. // Rate needed to serve all stored energy during single time step (W) - Real64 StoredEnergyRate = this->StoredEnergy / state.dataGlobal->TimeStepZone / Constant::SecInHour; + Real64 StoredEnergyRate = this->StoredEnergy / state.dataGlobal->TimeStepZone / Constant::rSecsInHour; Real64 LoadRequested = LoadTotal + StoredEnergyRate; // Load necessary to meet current and all stored energy needs (W) Real64 LatentCapApplied; // Walk In latent capacity at specific operating conditions @@ -15437,8 +15024,8 @@ void SecondaryLoopData::CalculateSecondary(EnergyPlusData &state, int const Seco auto &WalkIn = state.dataRefrigCase->WalkIn; auto &WarehouseCoil = state.dataRefrigCase->WarehouseCoil; - Real64 LocalTimeStep = state.dataGlobal->TimeStepZone; - if (state.dataRefrigCase->UseSysTimeStep) LocalTimeStep = state.dataHVACGlobal->TimeStepSys; + Real64 localTimeStep = (state.dataRefrigCase->UseSysTimeStep) ? state.dataHVACGlobal->TimeStepSys : state.dataGlobal->TimeStepZone; + Real64 localTimeStepSec = localTimeStep * Constant::rSecsInHour; switch (this->FluidType) { case SecFluidType::AlwaysLiquid: { @@ -15513,7 +15100,7 @@ void SecondaryLoopData::CalculateSecondary(EnergyPlusData &state, int const Seco int CoilID = this->CoilNum(CoilIndex); // already CALL CalculateCoil(CoilID) for each coil, dispatched in coilset order for each zone // increment TotalCoolingLoad for each system - // here will find out if secondary can serve total load, if not will derate coil outout/case credits + // here will find out if secondary can serve total load, if not will derate coil output/case credits RefrigerationLoad += WarehouseCoil(CoilID).TotalCoolingLoad; TotalHotDefrostCondCredit += WarehouseCoil(CoilID).HotDefrostCondCredit; } // NumCoils on secondary system @@ -15606,7 +15193,7 @@ void SecondaryLoopData::CalculateSecondary(EnergyPlusData &state, int const Seco // (e.g. as it may be following defrost cycles on cases or walk-ins served by secondary loop) // save the unmet/stored load to be met in succeeding time steps. if (this->NumCoils == 0) { - StoredEnergyRate = max(0.0, (this->UnmetEnergy / state.dataGlobal->TimeStepZone / Constant::SecInHour)); + StoredEnergyRate = max(0.0, (this->UnmetEnergy / state.dataGlobal->TimeStepZone / Constant::rSecsInHour)); // Load necessary to meet current and all stored energy needs (W) Real64 LoadRequested = TotalLoad + StoredEnergyRate; if (this->MaxLoad > LoadRequested) { @@ -15637,16 +15224,16 @@ void SecondaryLoopData::CalculateSecondary(EnergyPlusData &state, int const Seco // Bug TotalCoolingLoad not set but used below } // no air coils on secondary loop this->PumpPowerTotal = TotalPumpPower; - this->PumpElecEnergyTotal = TotalPumpPower * LocalTimeStep * Constant::SecInHour; + this->PumpElecEnergyTotal = TotalPumpPower * localTimeStepSec; this->TotalRefrigLoad = RefrigerationLoad; - this->TotalRefrigEnergy = RefrigerationLoad * LocalTimeStep * Constant::SecInHour; - this->TotalCoolingEnergy = TotalCoolingLoad * LocalTimeStep * Constant::SecInHour; + this->TotalRefrigEnergy = RefrigerationLoad * localTimeStepSec; + this->TotalCoolingEnergy = TotalCoolingLoad * localTimeStepSec; this->FlowVolActual = VolFlowRate; this->HotDefrostCondCredit = TotalHotDefrostCondCredit; this->DistPipeHeatGain = distPipeHeatGain; - this->DistPipeHeatGainEnergy = distPipeHeatGain * LocalTimeStep * Constant::SecInHour; + this->DistPipeHeatGainEnergy = distPipeHeatGain * localTimeStepSec; this->ReceiverHeatGain = receiverHeatGain; - this->ReceiverHeatGainEnergy = receiverHeatGain * LocalTimeStep * Constant::SecInHour; + this->ReceiverHeatGainEnergy = receiverHeatGain * localTimeStepSec; } void SumZoneImpacts(EnergyPlusData &state) @@ -15824,7 +15411,7 @@ void SimAirChillerSet(EnergyPlusData &state, RemainingOutputToCoolingSP = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).RemainingOutputReqToCoolSP; // RemainingOutputToCoolingSP in Watts, < 0 for cooling demand - if (RemainingOutputToCoolingSP < 0.0 && state.dataHeatBalFanSys->TempControlType(ZoneNum) != HVAC::ThermostatType::SingleHeating) { + if (RemainingOutputToCoolingSP < 0.0 && state.dataHeatBalFanSys->TempControlType(ZoneNum) != HVAC::SetptType::SingleHeat) { AirChillerSet(AirChillerSetPtr).QZnReqSens = RemainingOutputToCoolingSP; } else { AirChillerSet(AirChillerSetPtr).QZnReqSens = 0.0; @@ -15868,7 +15455,7 @@ void AirChillerSetData::CalculateAirChillerSets(EnergyPlusData &state) // Note, all coils in a coil set are in the same zone // the coils may be served by different detailed systems // The coils are dispatched to meet the load specified in the previous time step in order listed in coilset object - AirChillerSetSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->SchedPtr); + AirChillerSetSchedule = this->availSched->getCurrentVal(); if (AirChillerSetSchedule <= 0.0) return; QZNReqSens = this->QZnReqSens; @@ -16009,17 +15596,16 @@ void WarehouseCoilData::CalculateCoil(EnergyPlusData &state, Real64 const QZnReq static constexpr std::string_view TrackMessage("from RefrigeratedCase:CalculateCoil"); - Real64 CoilSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->SchedPtr); // Current value of Coil operating (availability) schedule + Real64 CoilSchedule = this->availSched->getCurrentVal(); // Current value of Coil operating (availability) schedule if (CoilSchedule <= 0.0) return; - Real64 DefrostSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->DefrostSchedPtr); // Coil defrost schedule, between 0 and 1 - Real64 DefrostDripDownSchedule = ScheduleManager::GetCurrentScheduleValue( - state, this->DefrostDripDownSchedPtr); // Coil drip-down schedule (allows coil to drain after defrost) + Real64 DefrostSchedule = this->defrostSched->getCurrentVal(); // Coil defrost schedule, between 0 and 1 + Real64 DefrostDripDownSchedule = this->defrostDripDownSched->getCurrentVal(); // Coil drip-down schedule (allows coil to drain after defrost) // next statement In case user doesn't understand concept of drip down schedule DefrostDripDownSchedule = max(DefrostDripDownSchedule, DefrostSchedule); // next value optional, so set to default before checking for schedule Real64 HeaterSchedule = 1.0; // zero to one - if (this->HeaterSchedPtr > 0) HeaterSchedule = ScheduleManager::GetCurrentScheduleValue(state, this->HeaterSchedPtr); + if (this->heaterAvailSched != nullptr) HeaterSchedule = this->heaterAvailSched->getCurrentVal(); // Set local subroutine variables for convenience FanSpeedCtrlType FanSpeedControlType = this->FanType; @@ -16234,7 +15820,7 @@ void WarehouseCoilData::CalculateCoil(EnergyPlusData &state, Real64 const QZnReq } break; case FanSpeedCtrlType::TwoSpeed: { // low speed setting of 1/2 fan speed can give up to 60% of capacity. - // 1/2 speed corresonds to ~1/8 power consumption (FanHalfSpeedRatio = 1/(2**2.5) = 0.1768) + // 1/2 speed corresponds to ~1/8 power consumption (FanHalfSpeedRatio = 1/(2**2.5) = 0.1768) // dampers are used to control flow within those two ranges as in FanConstantSpeed if (CapFac < CapFac60Percent) { FanPowerActual = ((AirVolRatio + 0.4) * (FanHalfSpeedRatio)) * std::exp(1.0 - AirVolRatio) * FanPowerMax; @@ -16311,7 +15897,7 @@ void WarehouseCoilData::CalculateCoil(EnergyPlusData &state, Real64 const QZnReq // Reduce defrost heat load on walkin by amount of ice melted during time step FrostChangekg = min(AvailDefrostEnergy / IceMeltEnthalpy, StartFrostKg); if (FrostChangekg < StartFrostKg) { - DefrostLoad -= FrostChangekg * IceMeltEnthalpy / state.dataHVACGlobal->TimeStepSys / Constant::SecInHour; + DefrostLoad -= FrostChangekg * IceMeltEnthalpy / state.dataHVACGlobal->TimeStepSys / Constant::rSecsInHour; if (!state.dataGlobal->WarmupFlag) this->KgFrost = StartFrostKg - FrostChangekg; // DefrostSchedule not changed because ice not all melted, temp term not triggered } else { // all frost melted during time step, so need to terminate defrost @@ -16339,7 +15925,7 @@ void WarehouseCoilData::CalculateCoil(EnergyPlusData &state, Real64 const QZnReq // Reduce defrost heat load on the zone by amount of ice melted during time step // But DefrostSchedule not changed FrostChangekg = max(0.0, min((DefrostEnergy / IceMeltEnthalpy), StartFrostKg)); - DefrostLoad -= FrostChangekg * IceMeltEnthalpy / state.dataHVACGlobal->TimeStepSys / Constant::SecInHour; + DefrostLoad -= FrostChangekg * IceMeltEnthalpy / state.dataHVACGlobal->TimeStepSys / Constant::rSecsInHour; if (!state.dataGlobal->WarmupFlag) this->KgFrost = StartFrostKg - FrostChangekg; } // Temperature termination vs. time-clock control type diff --git a/src/EnergyPlus/RefrigeratedCase.hh b/src/EnergyPlus/RefrigeratedCase.hh index 8f031c07130..ed6a4005562 100644 --- a/src/EnergyPlus/RefrigeratedCase.hh +++ b/src/EnergyPlus/RefrigeratedCase.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -55,6 +55,7 @@ #include #include #include +#include #include namespace EnergyPlus { @@ -285,7 +286,7 @@ namespace RefrigeratedCase { std::string Name; // Name of refrigerated display case std::string ZoneName; // Zone or Location of Display Case int NumSysAttach = 0; // Number of systems attached to case, error if /=1 - int SchedPtr = 0; // Index to the correct availability schedule + Sched::Schedule *availSched = nullptr; // Availability schedule int ZoneNodeNum = 0; // Index to Zone Node int ActualZoneNum = 0; // Index to Zone int ZoneRANode = 0; // Node number of return node in zone @@ -305,7 +306,7 @@ namespace RefrigeratedCase { Real64 OperatingFanPower = 0.0; // Operating power of refrigerated case fan [W/m] Real64 RatedLightingPower = 0.0; // Rated (consis w RateTotCapPerLength) power of refrigerated case lights [W/m] Real64 LightingPower = 0.0; // Installed power of refrigerated case lights [W/m] - int LightingSchedPtr = 0; // Index to the correct case lighting schedule + Sched::Schedule *lightingSched = nullptr; // case lighting schedule Real64 AntiSweatPower = 0.0; // Rated power of refrigerated case anti-sweat heaters [W/m] Real64 MinimumASPower = 0.0; // Minimum power output of case anti-sweat heaters [W/m] ASHtrCtrlType AntiSweatControlType = ASHtrCtrlType::Invalid; // Type of anti-sweat heater control: @@ -314,30 +315,30 @@ namespace RefrigeratedCase { Real64 Height = 0.0; // case height for AS heater with heat balance control RefCaseDefrostType defrostType = RefCaseDefrostType::Invalid; // Case defrost control type, Off-cycle,Timed,Hot-gas,Electric Real64 DefrostPower = 0.0; // Rated power of refrigerated case defrost [W/m] - int DefrostSchedPtr = 0; // Index to the correct defrost schedule - int DefrostDripDownSchedPtr = 0; // Index to the correct fail-safe schedule + Sched::Schedule *defrostSched = nullptr; // defrost schedule + Sched::Schedule *defrostDripDownSched = nullptr; // correct fail-safe schedule Real64 Length = 0.0; // Length of refrigerated case [m] Real64 Temperature = 0.0; // Rated case temperature [C] Real64 RAFrac = 0.0; // HVAC under case return air fraction [0-1] - int StockingSchedPtr = 0; // Index to the correct product stocking schedule + Sched::Schedule *stockingSched = nullptr; // product stocking schedule Real64 LightingFractionToCase = 0.0; // Fraction of lighting energy that directly contributes to the // case cooling load. The remainder contributes to the zone load // (air heat balance). Real64 ASHeaterFractionToCase = 0.0; // Fraction of anti-sweat heater energy that results in a direct // heat load to the case. The remainder is a heating load // to the zone where the refrigerated case is located. - Real64 DesignSensCaseCredit = 0.0; // Design sensible case credit applied to zone load - Real64 EvapTempDesign = 0.0; // Design evaporator temperature - Real64 RefrigInventory = 0.0; // Design refrigerant inventory [kg/m] - Real64 DesignRefrigInventory = 0.0; // Design refrigerant inventory [kg total for the case] - Real64 DesignRatedCap = 0.0; // Design total case capacity=RatedTotCap*Length [W] - Real64 DesignLatentCap = 0.0; // Design latent case capacity=DesignRAtedCap*LatentHeatRatio*RTF [W] - Real64 DesignDefrostCap = 0.0; // Design defrost case capacity=DefrostPower*Length [W] - Real64 DesignLighting = 0.0; // Design case lighting=LightingPower*Length [W] - Real64 DesignFanPower = 0.0; // Design power of case fan=Operatingpower*Length [W] - Real64 StoredEnergy = 0.0; // Cumulative Stored Energy not met by evaporator [J] - Real64 StoredEnergySaved = 0.0; // Cumulative Stored Energy not met by evaporator [J] - int CaseCreditFracSchedPtr = 0; // Index to the case credit reduction schedule + Real64 DesignSensCaseCredit = 0.0; // Design sensible case credit applied to zone load + Real64 EvapTempDesign = 0.0; // Design evaporator temperature + Real64 RefrigInventory = 0.0; // Design refrigerant inventory [kg/m] + Real64 DesignRefrigInventory = 0.0; // Design refrigerant inventory [kg total for the case] + Real64 DesignRatedCap = 0.0; // Design total case capacity=RatedTotCap*Length [W] + Real64 DesignLatentCap = 0.0; // Design latent case capacity=DesignRAtedCap*LatentHeatRatio*RTF [W] + Real64 DesignDefrostCap = 0.0; // Design defrost case capacity=DefrostPower*Length [W] + Real64 DesignLighting = 0.0; // Design case lighting=LightingPower*Length [W] + Real64 DesignFanPower = 0.0; // Design power of case fan=Operatingpower*Length [W] + Real64 StoredEnergy = 0.0; // Cumulative Stored Energy not met by evaporator [J] + Real64 StoredEnergySaved = 0.0; // Cumulative Stored Energy not met by evaporator [J] + Sched::Schedule *caseCreditFracSched = nullptr; // case credit reduction schedule // Report Variables Real64 TotalCoolingLoad = 0.0; // Refrigerated case total cooling rate (W) Real64 TotalCoolingEnergy = 0.0; // Refrigerated case total cooling energy (J) @@ -456,7 +457,7 @@ namespace RefrigeratedCase { Real64 EvapPumpConsumption = 0.0; // Evaporative cooling water pump electric consumption (J) Real64 EvapWaterConsumpRate = 0.0; // Evaporative condenser water consumption rate (m3/s) Real64 EvapWaterConsumption = 0.0; // Evaporative condenser water consumption (m3) - int EvapSchedPtr = 0; // Index to the correct evap condenser availability schedule + Sched::Schedule *evapAvailSched = nullptr; // evap condenser availability schedule Real64 BasinHeaterPowerFTempDiff = 0.0; // Basin heater capacity per degree K below setpoint (W/K) Real64 BasinHeaterSetPointTemp = 2.0; // Setpoint temperature for basin heater operation (C) Real64 BasinHeaterPower = 0.0; // Power demand from basin heater (W) @@ -499,7 +500,7 @@ namespace RefrigeratedCase { int PlantTypeOfNum = 0; // Water-cooled condenser plant equipment type PlantLocation plantLoc; // Water-cooled condenser plant location Real64 OutletTemp = 0.0; // Water-cooling condenser outlet temperature (C) - int OutletTempSchedPtr = 0; // Schedule pointer for condenser outlet temp setting + Sched::Schedule *outletTempSched = nullptr; // Schedule for condenser outlet temp setting Real64 VolFlowRate = 0.0; // Water-cooled condenser volumetric flow rate (m3/s) Real64 DesVolFlowRate = 0.0; // Water-cooled condenser design volumetric flow rate (m3/s) Real64 MassFlowRate = 0.0; // Water-cooled condenser mass flow rate (kg/s) @@ -554,8 +555,9 @@ namespace RefrigeratedCase { struct RefrigSystemData { - std::string Name; // Name of refrigeration system - std::string RefrigerantName; // Name of refrigerant, must match name in FluidName + std::string Name; // Name of refrigeration system + std::string RefrigerantName; // Name of refrigerant, must match name in FluidName + Fluid::RefrigProps *refrig = nullptr; std::string EndUseSubcategory; // Used for reporting purposes bool SystemRejectHeatToZone = false; // Flag to show air-cooled condenser located inside zone bool CoilFlag = false; // Flag to show if coil type load on system (even if below in a secondary) @@ -589,7 +591,6 @@ namespace RefrigeratedCase { int NumNonCascadeLoads = 0; // Sum of NumCases, NumWalk-Ins, NumCoils, and NumSecondarys int NumCascadeLoads = 0; // Number of cascade condensers cooled by this system int NumTransferLoads = 0; // Sum of NumCascadeLoads and NumSecondarys - int RefIndex = 0; // Index number of refrigerant, automatically assigned on first call to fluid property // and used thereafter int SuctionPipeActualZoneNum = 0; // ID number for zone where suction pipes gain heat int SuctionPipeZoneNodeNum = 0; // ID number for zone node where suction pipes gain heat @@ -699,6 +700,8 @@ namespace RefrigeratedCase { std::string Name; // Name of transcritical CO2 refrigeration system std::string RefrigerantName; // Name of refrigerant, must match name in FluidName // (see fluidpropertiesrefdata.idf) + Fluid::RefrigProps *refrig = nullptr; + std::string EndUseSubcategory; // Used for reporting purposes bool SystemRejectHeatToZone = false; // Flag to show air-cooled gas cooler located inside zone Array1D_int CaseNumMT; // absolute Index of medium temperature cases (allocated NumCasesMT) @@ -715,7 +718,6 @@ namespace RefrigeratedCase { int NumGasCoolers = 1; // Number of gas coolers on this system int NumWalkInsLT = 0; // Number of low temperature walk in coolers on this system int NumWalkInsMT = 0; // Number of medium temperature walk in coolers on this system - int RefIndex = 0; // Index number of refrigerant, automatically assigned on first call to fluid property // and used thereafter int SuctionPipeActualZoneNumMT = 0; // ID number for zone where medium temperature suction pipes gain heat int SuctionPipeZoneNodeNumMT = 0; // ID number for zone node where medium temperature suction pipes gain heat @@ -864,14 +866,14 @@ namespace RefrigeratedCase { int HighFlowWarnIndex = 0; // Water outlet high flow warning index int HighInletWarnIndex = 0; // Water inlet high temp warning index int InletNode = 0; // Water-cooled condenser inlet node number - int EvapSchedPtr = 0; // Index to the correct evap condenser availability schedule + Sched::Schedule *evapAvailSched = nullptr; // Evap condenser availability schedule WaterSupply EvapWaterSupplyMode = WaterSupply::FromMains; // Source of water for evap condenser cooling int EvapWaterSupTankID = 0; // TankID when evap condenser uses water from storage tank int EvapWaterTankDemandARRID = 0; // Demand index when evap condenser uses water from storage tank int OutletNode = 0; // Water-cooled condenser outlet node number int PlantTypeOfNum = 0; // Water-cooled condenser plant equipment type PlantLocation plantLoc; // Water-cooled condenser plant location - int OutletTempSchedPtr = 0; // Schedule pointer for condenser outlet temp setting + Sched::Schedule *outletTempSched = nullptr; // Schedule for condenser outlet temp setting int InletAirNodeNum = 0; // Inlet air node number, can be outside or in a zone int InletAirZoneNum = 0; // Inlet air zone number, if located in a zone FanSpeedCtrlType FanSpeedControlType = FanSpeedCtrlType::Invalid; // fixed, two-speed, or variable @@ -1087,9 +1089,11 @@ namespace RefrigeratedCase { struct SecondaryLoopData { - bool CoilFlag = false; // Flag to show if coil type load on secondary system - std::string Name; // Name of refrigeration system - std::string FluidName; // Name of circulating fluid + bool CoilFlag = false; // Flag to show if coil type load on secondary system + std::string Name; // Name of refrigeration system + std::string FluidName; // Name of circulating fluid + Fluid::GlycolProps *glycol = nullptr; + Fluid::RefrigProps *refrig = nullptr; std::string EndUseSubcategory; // Used for reporting purposes Array1D_int CaseNum; // Absolute Index of cases (dimensioned 1 to NumCases) Array1D_int CoilNum; // Absolute Index of coils (dimensioned 1 to NumCoils) @@ -1098,7 +1102,6 @@ namespace RefrigeratedCase { int DistPipeZoneNodeNum = 0; // ID number for zone node where distribution pipe gain heat Real64 DistPipeZoneHeatGain = 0.0; // ! sensible heat gain rate to zone with pipe SecFluidType FluidType = SecFluidType::Invalid; // Indicates whether fluid always liquid or undergoes phase change - int FluidID = 0; // Numerical ID used for calls to properties subroutine int NumSysAttach = 0; // Used to check for non-unique and unused secondary loops int NumPumps = 0; // Number of pumps (or pump stages) serving this system int NumCases = 0; // Number of Cases served by this secondary loop @@ -1183,19 +1186,19 @@ namespace RefrigeratedCase { std::string Name; // Name of walk in cooler Array1D_string ZoneName; // Names of zones exchanging energy with cooler - int CircFanSchedPtr = 0; // Index to the correct availability schedule - int DefrostDripDownSchedPtr = 0; // Index to the correct fail-safe schedule - int DefrostSchedPtr = 0; // Index to the correct defrost schedule + Sched::Schedule *circFanAvailSched = nullptr; // Index to the correct availability schedule + Sched::Schedule *defrostDripDownSched = nullptr; // fail-safe schedule + Sched::Schedule *defrostSched = nullptr; // defrost schedule DefrostCtrlType DefrostControlType = DefrostCtrlType::Invalid; // WalkIn defrost control type, Timed,Frost level WalkinClrDefrostType defrostType = WalkinClrDefrostType::Invalid; // WalkIn defrost type, Hot-gas,Electric, Hot-brine - int HeaterSchedPtr = 0; // Index to the correct availability schedule - int LightingSchedPtr = 0; // Index to the correct WalkIn lighting schedule + Sched::Schedule *heaterSched = nullptr; // heater availability schedule + Sched::Schedule *lightingSched = nullptr; // walkIn lighting schedule int NumSysAttach = 0; // Number of systems attached to WalkIn, error if /=1 int NumZones = 0; // Number of zones exchanging energy with WalkIn - int SchedPtr = 0; // Index to the correct availability schedule - int StockingSchedPtr = 0; // Index to the correct product stocking schedule - Array1D_int GlassDoorOpenSchedPtr; // Index to the door opening schedule - Array1D_int StockDoorOpenSchedPtr; // Index to the door opening schedule + Sched::Schedule *availSched = nullptr; // availability schedule + Sched::Schedule *stockingSched = nullptr; // product stocking schedule + Array1D glassDoorOpenScheds; // door opening schedule + Array1D stockDoorOpenScheds; // door opening schedule Array1D StockDoorProtectType; // Index to door protection type Array1D_int ZoneNodeNum; // Index to Zone Node Array1D_int ZoneNum; // Index to Zone @@ -1313,16 +1316,16 @@ namespace RefrigeratedCase { bool SecStatusLast = false; // Flag to show if this is the last coil on a particular secondary bool SysStatusFirst = false; // Flag to show if this is the first coil on a particular primary bool SysStatusLast = false; // Flag to show if this is the last coil on a particular primary - int CoilFanSchedPtr = 0; // Index to the correct availability schedule - int DefrostDripDownSchedPtr = 0; // Index to the correct fail-safe schedule - int DefrostSchedPtr = 0; // Index to the correct defrost schedule + Sched::Schedule *coilFanAvaildSched = nullptr; // availability schedule + Sched::Schedule *defrostDripDownSched = nullptr; // fail-safe schedule + Sched::Schedule *defrostSched = nullptr; // defrost schedule DefrostCtrlType DefrostControlType = DefrostCtrlType::Invalid; // Coil defrost control type, Timed,Frost level DefrostType defrostType = DefrostType::Invalid; // Coil defrost type, Hot-gas,Electric, Hot-brine FanSpeedCtrlType FanType = FanSpeedCtrlType::Invalid; // Index to coil fan type (fixed, two-speed, etc.) - int HeaterSchedPtr = 0; // Index to the correct availability schedule + Sched::Schedule *heaterAvailSched = nullptr; // availability schedule int NumSysAttach = 0; // Number of refrigerating systems cooling this coil (error check purpose) RatingType ratingType = RatingType::Invalid; // Indicates which type of manufacturer's rating is used - int SchedPtr = 0; // Index to the correct availability schedule + Sched::Schedule *availSched = nullptr; // availability schedule int SCIndex = 0; // IDs which of European standard conditions is used for rating int SecServeID = 0; // Index to the refrigeration system serving this coil SHRCorrectionType SHRCorrType = SHRCorrectionType::Invalid; // Index to type of correction for sensible heat ratio @@ -1426,13 +1429,13 @@ namespace RefrigeratedCase { Array1D_int CoilNum; // ID number of Individual Chiller in set int ChillerSetID = 0; // ID number for this set of chillers (all serving one zone, // but can be chilled by multi systems) - int SchedPtr = 0; // Schedule to take whole set off-line if needed - int NodeNumInlet = 0; // Node ID Number of inlet for chiller set as a whole, not identified for specific coils - int NodeNumOutlet = 0; // Node ID Number of outlet for chiller set as a whole, not identified for specific coils - int NumCoils = 0; // Number of individual chillers in set - int ZoneNum = 0; // ID number of zone where chiller set is located - int ZoneNodeNum = 0; // ID number of zone node giving mixed conditions of zone where chiller set is located - Real64 QZnReqSens = 0.0; // Sensible heat needed by the zone to reach setpoint [W] + Sched::Schedule *availSched = nullptr; // Schedule to take whole set off-line if needed // availability? + int NodeNumInlet = 0; // Node ID Number of inlet for chiller set as a whole, not identified for specific coils + int NodeNumOutlet = 0; // Node ID Number of outlet for chiller set as a whole, not identified for specific coils + int NumCoils = 0; // Number of individual chillers in set + int ZoneNum = 0; // ID number of zone where chiller set is located + int ZoneNodeNum = 0; // ID number of zone node giving mixed conditions of zone where chiller set is located + Real64 QZnReqSens = 0.0; // Sensible heat needed by the zone to reach setpoint [W] void CalculateAirChillerSets(EnergyPlusData &state); }; @@ -1626,6 +1629,10 @@ struct RefrigeratedCaseData : BaseGlobalStruct Real64 MyStepStartTimeSaved = 0.0; // Used to determine whether the system time step is a repetition Real64 TimeStepFraction = 0.0; // Used to calculate my current time + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ReportCoilSelection.cc b/src/EnergyPlus/ReportCoilSelection.cc index defc4a2b2d2..ceea33a21a1 100644 --- a/src/EnergyPlus/ReportCoilSelection.cc +++ b/src/EnergyPlus/ReportCoilSelection.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -575,7 +575,7 @@ void ReportCoilSelection::doAirLoopSetup(EnergyPlusData &state, int const coilVe int zoneIndex = state.dataAirLoop->AirToZoneNodeInfo(c->airloopNum).HeatCtrlZoneNums(loopZone); // see if this zone is new or already in list bool found = false; - for (auto &z : c->zoneNum) { + for (auto const &z : c->zoneNum) { if (z == zoneIndex) { found = true; break; @@ -725,30 +725,16 @@ void ReportCoilSelection::doFinalProcessingOfCoilData(EnergyPlusData &state) c->plantLoopName = state.dataPlnt->PlantLoop(c->waterLoopNum).Name; if (state.dataSize->PlantSizData(c->pltSizNum).LoopType != DataSizing::TypeOfPlantLoop::Steam) { - c->rhoFluid = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(c->waterLoopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(c->waterLoopNum).FluidIndex, - "ReportCoilSelection::doFinalProcessingOfCoilData"); - - c->cpFluid = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(c->waterLoopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(c->waterLoopNum).FluidIndex, - "ReportCoilSelection::doFinalProcessingOfCoilData"); + c->rhoFluid = state.dataPlnt->PlantLoop(c->waterLoopNum) + .glycol->getDensity(state, Constant::InitConvTemp, "ReportCoilSelection::doFinalProcessingOfCoilData"); + + c->cpFluid = state.dataPlnt->PlantLoop(c->waterLoopNum) + .glycol->getSpecificHeat(state, Constant::InitConvTemp, "ReportCoilSelection::doFinalProcessingOfCoilData"); } else { // steam loop - c->rhoFluid = FluidProperties::GetSatDensityRefrig(state, - state.dataPlnt->PlantLoop(c->waterLoopNum).FluidName, - 100.0, - 1.0, - state.dataPlnt->PlantLoop(c->waterLoopNum).FluidIndex, - "ReportCoilSelection::doFinalProcessingOfCoilData"); - c->cpFluid = FluidProperties::GetSatSpecificHeatRefrig(state, - state.dataPlnt->PlantLoop(c->waterLoopNum).FluidName, - 100.0, - 0.0, - state.dataPlnt->PlantLoop(c->waterLoopNum).FluidIndex, - "ReportCoilSelection::doFinalProcessingOfCoilData"); + c->rhoFluid = state.dataPlnt->PlantLoop(c->waterLoopNum) + .steam->getSatDensity(state, 100.0, 1.0, "ReportCoilSelection::doFinalProcessingOfCoilData"); + c->cpFluid = state.dataPlnt->PlantLoop(c->waterLoopNum) + .steam->getSatSpecificHeat(state, 100.0, 0.0, "ReportCoilSelection::doFinalProcessingOfCoilData"); } c->plantDesMaxMassFlowRate = state.dataPlnt->PlantLoop(c->waterLoopNum).MaxMassFlowRate; if (c->plantDesMaxMassFlowRate > 0.0 && c->coilDesWaterMassFlow > 0.0) { @@ -817,7 +803,6 @@ void ReportCoilSelection::doFinalProcessingOfCoilData(EnergyPlusData &state) c->coilDesWaterTempDiff = -999.0; c->plantDesCapacity = -999.0; c->coilCapPrcntPlantCap = -999.0; - c->coilFlowPrcntPlantFlow = -999.0; } c->cpDryAir = Psychrometrics::PsyCpAirFnW(0.0); @@ -1084,30 +1069,15 @@ void ReportCoilSelection::setCoilWaterFlowPltSizNum(EnergyPlusData &state, if (c->waterLoopNum > 0 && c->pltSizNum > 0) { if (state.dataSize->PlantSizData(c->pltSizNum).LoopType != DataSizing::TypeOfPlantLoop::Steam) { - c->rhoFluid = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(c->waterLoopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(c->waterLoopNum).FluidIndex, - "ReportCoilSelection::setCoilWaterFlow"); - - c->cpFluid = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(c->waterLoopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(c->waterLoopNum).FluidIndex, - "ReportCoilSelection::setCoilWaterFlow"); + c->rhoFluid = + state.dataPlnt->PlantLoop(c->waterLoopNum).glycol->getDensity(state, Constant::InitConvTemp, "ReportCoilSelection::setCoilWaterFlow"); + + c->cpFluid = state.dataPlnt->PlantLoop(c->waterLoopNum) + .glycol->getSpecificHeat(state, Constant::InitConvTemp, "ReportCoilSelection::setCoilWaterFlow"); } else { // steam loop - c->rhoFluid = FluidProperties::GetSatDensityRefrig(state, - state.dataPlnt->PlantLoop(c->waterLoopNum).FluidName, - 100.0, - 1.0, - state.dataPlnt->PlantLoop(c->waterLoopNum).FluidIndex, - "ReportCoilSelection::setCoilWaterFlow"); - c->cpFluid = FluidProperties::GetSatSpecificHeatRefrig(state, - state.dataPlnt->PlantLoop(c->waterLoopNum).FluidName, - 100.0, - 0.0, - state.dataPlnt->PlantLoop(c->waterLoopNum).FluidIndex, - "ReportCoilSelection::setCoilWaterFlow"); + c->rhoFluid = state.dataPlnt->PlantLoop(c->waterLoopNum).steam->getSatDensity(state, 100.0, 1.0, "ReportCoilSelection::setCoilWaterFlow"); + c->cpFluid = + state.dataPlnt->PlantLoop(c->waterLoopNum).steam->getSatSpecificHeat(state, 100.0, 0.0, "ReportCoilSelection::setCoilWaterFlow"); } } if (c->rhoFluid > 0.0) { @@ -1269,7 +1239,7 @@ void ReportCoilSelection::setCoilCoolingCapacity( SysSizPeakDDNum(curSysNum).TimeStepAtCoolFlowPk(SysSizPeakDDNum(curSysNum).CoolFlowPeakDD)); } - auto &finalSysSizing = state.dataSize->FinalSysSizing(curSysNum); + auto const &finalSysSizing = state.dataSize->FinalSysSizing(curSysNum); c->isCoilSizingForTotalLoad = (finalSysSizing.coolingPeakLoad == DataSizing::PeakLoad::TotalCooling); c->oaPeakTemp = finalSysSizing.OutTempAtCoolPeak; c->oaPeakVolFlow = finalSysSizing.DesOutAirVolFlow; @@ -1645,7 +1615,7 @@ void ReportCoilSelection::setCoilHeatingCapacity( } } else if (curZoneEqNum > 0 && allocated(state.dataSize->FinalZoneSizing)) { - auto &finalZoneSizing = state.dataSize->FinalZoneSizing(curZoneEqNum); + auto const &finalZoneSizing = state.dataSize->FinalZoneSizing(curZoneEqNum); c->zoneNum.resize(1); c->zoneName.resize(1); c->zoneNum[0] = curZoneEqNum; @@ -1667,7 +1637,7 @@ void ReportCoilSelection::setCoilHeatingCapacity( c->rmSensibleAtPeak = finalZoneSizing.DesHeatLoad; - auto &zoneEqSizing = state.dataSize->ZoneEqSizing(curZoneEqNum); + auto const &zoneEqSizing = state.dataSize->ZoneEqSizing(curZoneEqNum); if (zoneEqSizing.OAVolFlow > 0.0) { c->oaPeakVolFlow = zoneEqSizing.OAVolFlow; } else if (zoneEqSizing.ATMixerVolFlow > 0.0) { @@ -1809,15 +1779,15 @@ void ReportCoilSelection::setCoilHeatingCapacity( if (state.dataSize->DataFlowUsedForSizing > 0.0) { // flow has been set in global, so use it c->coilDesVolFlow = state.dataSize->DataFlowUsedForSizing; } else if (curZoneEqNum > 0 && allocated(state.dataSize->FinalZoneSizing)) { - auto &finalZoneSizing = state.dataSize->FinalZoneSizing(curZoneEqNum); + auto const &finalZoneSizing = state.dataSize->FinalZoneSizing(curZoneEqNum); if (finalZoneSizing.DesHeatMassFlow >= HVAC::SmallMassFlow) { c->coilDesMassFlow = finalZoneSizing.DesHeatMassFlow; c->coilDesVolFlow = c->coilDesMassFlow / state.dataEnvrn->StdRhoAir; } } else if (curSysNum > 0 && curSysNum <= int(state.dataSize->FinalSysSizing.size())) { - auto &finalSysSizing = state.dataSize->FinalSysSizing(curSysNum); + auto const &finalSysSizing = state.dataSize->FinalSysSizing(curSysNum); if (curOASysNum > 0 && allocated(state.dataSize->OASysEqSizing)) { - auto &oASysEqSizing = state.dataSize->OASysEqSizing(curSysNum); + auto const &oASysEqSizing = state.dataSize->OASysEqSizing(curSysNum); if (oASysEqSizing.AirFlow) { c->coilDesVolFlow = oASysEqSizing.AirVolFlow; } else if (oASysEqSizing.HeatingAirFlow) { @@ -1829,7 +1799,7 @@ void ReportCoilSelection::setCoilHeatingCapacity( if (state.dataSize->DataFlowUsedForSizing > 0.0) { c->coilDesVolFlow = state.dataSize->DataFlowUsedForSizing; } else if (curSysNum > 0 && allocated(state.dataSize->UnitarySysEqSizing)) { - auto &unitarySysEqSizing = state.dataSize->UnitarySysEqSizing(curSysNum); + auto const &unitarySysEqSizing = state.dataSize->UnitarySysEqSizing(curSysNum); if (unitarySysEqSizing.AirFlow) { c->coilDesVolFlow = unitarySysEqSizing.AirVolFlow; } else if (unitarySysEqSizing.HeatingAirFlow) { @@ -2006,9 +1976,9 @@ std::string ReportCoilSelection::getTimeText(EnergyPlusData &state, int const ti int timeStepIndex(0); int hourPrint; for (int hourCounter = 1; hourCounter <= 24; ++hourCounter) { - for (int timeStepCounter = 1; timeStepCounter <= state.dataGlobal->NumOfTimeStepInHour; ++timeStepCounter) { + for (int timeStepCounter = 1; timeStepCounter <= state.dataGlobal->TimeStepsInHour; ++timeStepCounter) { ++timeStepIndex; - minutes += state.dataGlobal->MinutesPerTimeStep; + minutes += state.dataGlobal->MinutesInTimeStep; if (minutes == 60) { minutes = 0; hourPrint = hourCounter; @@ -2060,7 +2030,7 @@ bool ReportCoilSelection::isCompTypeCoil(std::string const &compType // string c void ReportCoilSelection::setZoneLatentLoadCoolingIdealPeak(int const zoneIndex, Real64 const zoneCoolingLatentLoad) { // loop over all the coils and the zones in the coils and if this zone index is in the coil - for (auto &c : coilSelectionDataObjs) { + for (auto const &c : coilSelectionDataObjs) { if (c->isCooling) { for (std::size_t zoneInd = 0; zoneInd < c->zoneNum.size(); ++zoneInd) { @@ -2076,7 +2046,7 @@ void ReportCoilSelection::setZoneLatentLoadCoolingIdealPeak(int const zoneIndex, void ReportCoilSelection::setZoneLatentLoadHeatingIdealPeak(int const zoneIndex, Real64 const zoneHeatingLatentLoad) { // loop over all the coils and the zones in the coils and if this zone index is in the coil - for (auto &c : coilSelectionDataObjs) { + for (auto const &c : coilSelectionDataObjs) { if (c->isHeating) { for (std::size_t zoneInd = 0; zoneInd < c->zoneNum.size(); ++zoneInd) { diff --git a/src/EnergyPlus/ReportCoilSelection.hh b/src/EnergyPlus/ReportCoilSelection.hh index 5c15590f019..8be2540c3c6 100644 --- a/src/EnergyPlus/ReportCoilSelection.hh +++ b/src/EnergyPlus/ReportCoilSelection.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -456,6 +456,10 @@ struct ReportCoilSelectionData : BaseGlobalStruct std::unique_ptr coilSelectionReportObj; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ResultsFramework.cc b/src/EnergyPlus/ResultsFramework.cc index 0649abad7e9..3a2ae75cfec 100644 --- a/src/EnergyPlus/ResultsFramework.cc +++ b/src/EnergyPlus/ResultsFramework.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -715,8 +715,6 @@ namespace ResultsFramework { if (data.empty()) return; updateReportFreq(reportingFrequency); std::vector indices; - std::unordered_set seen; - std::string search_string; std::string reportFrequency = data.at("ReportFrequency").get(); if (reportFrequency == "Detailed-HVAC" || reportFrequency == "Detailed-Zone") { @@ -724,7 +722,7 @@ namespace ResultsFramework { } auto const &columns = data.at("Cols"); for (auto const &column : columns) { - search_string = + std::string search_string = fmt::format("{0} [{1}]({2})", column.at("Variable").get(), column.at("Units").get(), reportFrequency); auto found = std::find(outputVariables.begin(), outputVariables.end(), search_string); if (found == outputVariables.end()) { diff --git a/src/EnergyPlus/ResultsFramework.hh b/src/EnergyPlus/ResultsFramework.hh index d8af9cc1c8d..4039b4aab9a 100644 --- a/src/EnergyPlus/ResultsFramework.hh +++ b/src/EnergyPlus/ResultsFramework.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -574,6 +574,10 @@ struct ResultsFrameworkData : BaseGlobalStruct std::unique_ptr resultsFramework = std::make_unique(); + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ReturnAirPathManager.cc b/src/EnergyPlus/ReturnAirPathManager.cc index 701d2edc1f0..58b9e30b75d 100644 --- a/src/EnergyPlus/ReturnAirPathManager.cc +++ b/src/EnergyPlus/ReturnAirPathManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -111,17 +111,9 @@ namespace ReturnAirPathManager { using NodeInputManager::GetOnlySingleNode; using namespace DataLoopNode; - // Locals - int PathNum; - int CompNum; - int NumAlphas; - int NumNums; - int IOStat; - int Counter; //////////// hoisted into namespace //////////////////////////////////////////////// // static bool ErrorsFound( false ); //////////////////////////////////////////////////////////////////////////////////// - bool IsNotOK; // Flag to verify name bool ErrorsFound = false; @@ -133,10 +125,13 @@ namespace ReturnAirPathManager { state.dataZoneEquip->NumReturnAirPaths = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); if (state.dataZoneEquip->NumReturnAirPaths > 0) { + int NumAlphas; + int NumNums; + int IOStat; state.dataZoneEquip->ReturnAirPath.allocate(state.dataZoneEquip->NumReturnAirPaths); - for (PathNum = 1; PathNum <= state.dataZoneEquip->NumReturnAirPaths; ++PathNum) { + for (int PathNum = 1; PathNum <= state.dataZoneEquip->NumReturnAirPaths; ++PathNum) { state.dataInputProcessing->inputProcessor->getObjectItem(state, cCurrentModuleObject, @@ -170,13 +165,14 @@ namespace ReturnAirPathManager { state.dataZoneEquip->ReturnAirPath(PathNum).ComponentName = ""; state.dataZoneEquip->ReturnAirPath(PathNum).ComponentIndex.allocate(state.dataZoneEquip->ReturnAirPath(PathNum).NumOfComponents); state.dataZoneEquip->ReturnAirPath(PathNum).ComponentIndex = 0; - Counter = 3; + int Counter = 3; - for (CompNum = 1; CompNum <= state.dataZoneEquip->ReturnAirPath(PathNum).NumOfComponents; ++CompNum) { + for (int CompNum = 1; CompNum <= state.dataZoneEquip->ReturnAirPath(PathNum).NumOfComponents; ++CompNum) { if ((Util::SameString(state.dataIPShortCut->cAlphaArgs(Counter), "AirLoopHVAC:ZoneMixer")) || (Util::SameString(state.dataIPShortCut->cAlphaArgs(Counter), "AirLoopHVAC:ReturnPlenum"))) { + bool IsNotOK; // Flag to verify name state.dataZoneEquip->ReturnAirPath(PathNum).ComponentType(CompNum) = state.dataIPShortCut->cAlphaArgs(Counter); state.dataZoneEquip->ReturnAirPath(PathNum).ComponentName(CompNum) = state.dataIPShortCut->cAlphaArgs(Counter + 1); ValidateComponent(state, diff --git a/src/EnergyPlus/ReturnAirPathManager.hh b/src/EnergyPlus/ReturnAirPathManager.hh index 62fd1f16658..d3b0a9eeb01 100644 --- a/src/EnergyPlus/ReturnAirPathManager.hh +++ b/src/EnergyPlus/ReturnAirPathManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -74,6 +74,10 @@ struct ReturnAirPathMgr : BaseGlobalStruct bool GetInputFlag = true; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/RoomAirModelAirflowNetwork.cc b/src/EnergyPlus/RoomAirModelAirflowNetwork.cc index 01fbcadae2a..8ce4745ec6e 100644 --- a/src/EnergyPlus/RoomAirModelAirflowNetwork.cc +++ b/src/EnergyPlus/RoomAirModelAirflowNetwork.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -48,7 +48,7 @@ // ObjexxFCL Headers #include #include -#include +// #include // EnergyPlus Headers #include @@ -124,7 +124,7 @@ namespace RoomAir { // METHODOLOGY EMPLOYED: // calls subroutines (LOL) - auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(zoneNum); + auto const &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(zoneNum); // model control volume for each roomAir:node in the zone. for (int roomAirNodeNum = 1; roomAirNodeNum <= afnZoneInfo.NumOfAirNodes; ++roomAirNodeNum) { @@ -174,7 +174,6 @@ namespace RoomAir { Array1D_bool NodeFound; // True if a node is found. Array1D_bool EquipFound; - bool ErrorsFound = false; Array1D SupplyFrac; Array1D ReturnFrac; @@ -184,9 +183,9 @@ namespace RoomAir { for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(iZone); if (!afnZoneInfo.IsUsed) continue; - int NumSurfs = 0; + int NumSurfs = 0; // NumSurfs isn't used anywhere? for (int spaceNum : state.dataHeatBal->Zone(iZone).spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); + auto const &thisSpace = state.dataHeatBal->space(spaceNum); NumSurfs += thisSpace.HTSurfaceLast - thisSpace.HTSurfaceFirst + 1; } @@ -231,7 +230,7 @@ namespace RoomAir { if (allocated(state.dataZoneEquip->ZoneEquipConfig) && allocated(state.dataZoneEquip->ZoneEquipList)) { int MaxNodeNum = 0; int MaxEquipNum = 0; - ErrorsFound = false; + bool ErrorsFound = false; for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { if (!state.dataHeatBal->Zone(iZone).IsControlled) continue; MaxEquipNum = max(MaxEquipNum, state.dataZoneEquip->ZoneEquipList(iZone).NumOfEquipTypes); @@ -614,7 +613,7 @@ namespace RoomAir { // PURPOSE OF THIS SUBROUTINE: // update variables - auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(zoneNum); + auto const &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(zoneNum); if (!afnZoneInfo.IsUsed) return; @@ -788,7 +787,7 @@ namespace RoomAir { int surfCount = 0; for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); + auto const &thisSpace = state.dataHeatBal->space(spaceNum); for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { ++surfCount; if (afnZoneInfo.ControlAirNodeID == roomAirNodeNum) { @@ -831,14 +830,14 @@ namespace RoomAir { if (state.dataSurface->SurfWinHeatGain(SurfNum) >= 0.0) { state.dataSurface->SurfWinHeatGainRep(SurfNum) = state.dataSurface->SurfWinHeatGain(SurfNum); state.dataSurface->SurfWinHeatGainRepEnergy(SurfNum) = - state.dataSurface->SurfWinHeatGainRep(SurfNum) * state.dataGlobal->TimeStepZone * Constant::SecInHour; + state.dataSurface->SurfWinHeatGainRep(SurfNum) * state.dataGlobal->TimeStepZone * Constant::rSecsInHour; } else { state.dataSurface->SurfWinHeatLossRep(SurfNum) = -state.dataSurface->SurfWinHeatGain(SurfNum); state.dataSurface->SurfWinHeatLossRepEnergy(SurfNum) = - state.dataSurface->SurfWinHeatLossRep(SurfNum) * state.dataGlobal->TimeStepZone * Constant::SecInHour; + state.dataSurface->SurfWinHeatLossRep(SurfNum) * state.dataGlobal->TimeStepZone * Constant::rSecsInHour; } state.dataSurface->SurfWinHeatTransferRepEnergy(SurfNum) = - state.dataSurface->SurfWinHeatGain(SurfNum) * state.dataGlobal->TimeStepZone * Constant::SecInHour; + state.dataSurface->SurfWinHeatGain(SurfNum) * state.dataGlobal->TimeStepZone * Constant::rSecsInHour; } } @@ -936,7 +935,7 @@ namespace RoomAir { int surfCount = 1; for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); + auto const &thisSpace = state.dataHeatBal->space(spaceNum); for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum, ++surfCount) { auto const &surf = state.dataSurface->Surface(SurfNum); if (surf.Class == SurfaceClass::Window) continue; @@ -952,13 +951,13 @@ namespace RoomAir { if (!afnZoneInfo.Node(roomAirNodeNum).SurfMask(surfCount)) continue; } - auto &HMassConvInFD = state.dataMstBal->HMassConvInFD; - auto &RhoVaporSurfIn = state.dataMstBal->RhoVaporSurfIn; - auto &RhoVaporAirIn = state.dataMstBal->RhoVaporAirIn; + auto const &HMassConvInFD = state.dataMstBal->HMassConvInFD(SurfNum); + auto &RhoVaporSurfIn = state.dataMstBal->RhoVaporSurfIn(SurfNum); + auto &RhoVaporAirIn = state.dataMstBal->RhoVaporAirIn(SurfNum); if (surf.HeatTransferAlgorithm == DataSurfaces::HeatTransferModel::HAMT) { UpdateHeatBalHAMT(state, SurfNum); - SumHmAW += HMassConvInFD(SurfNum) * surf.Area * (RhoVaporSurfIn(SurfNum) - RhoVaporAirIn(SurfNum)); + SumHmAW += HMassConvInFD * surf.Area * (RhoVaporSurfIn - RhoVaporAirIn); Real64 RhoAirZone = PsyRhoAirFnPbTdbW( state, @@ -966,35 +965,34 @@ namespace RoomAir { state.dataZoneTempPredictorCorrector->zoneHeatBalance(surf.Zone).MAT, PsyRhFnTdbRhov(state, state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataSurface->Surface(SurfNum).Zone).MAT, - RhoVaporAirIn(SurfNum), + RhoVaporAirIn, "RhoAirZone")); - Real64 Wsurf = - PsyWFnTdbRhPb(state, - state.dataHeatBalSurf->SurfTempInTmp(SurfNum), - PsyRhFnTdbRhov(state, state.dataHeatBalSurf->SurfTempInTmp(SurfNum), RhoVaporSurfIn(SurfNum), "Wsurf"), - state.dataEnvrn->OutBaroPress); + Real64 Wsurf = PsyWFnTdbRhPb(state, + state.dataHeatBalSurf->SurfTempInTmp(SurfNum), + PsyRhFnTdbRhov(state, state.dataHeatBalSurf->SurfTempInTmp(SurfNum), RhoVaporSurfIn, "Wsurf"), + state.dataEnvrn->OutBaroPress); - SumHmARa += HMassConvInFD(SurfNum) * surf.Area * RhoAirZone; - SumHmARaW += HMassConvInFD(SurfNum) * surf.Area * RhoAirZone * Wsurf; + SumHmARa += HMassConvInFD * surf.Area * RhoAirZone; + SumHmARaW += HMassConvInFD * surf.Area * RhoAirZone * Wsurf; } else if (surf.HeatTransferAlgorithm == DataSurfaces::HeatTransferModel::EMPD) { UpdateMoistureBalanceEMPD(state, SurfNum); - RhoVaporSurfIn(SurfNum) = state.dataMstBalEMPD->RVSurface(SurfNum); - - SumHmAW += HMassConvInFD(SurfNum) * surf.Area * (RhoVaporSurfIn(SurfNum) - RhoVaporAirIn(SurfNum)); - SumHmARa += HMassConvInFD(SurfNum) * surf.Area * - PsyRhoAirFnPbTdbW( - state, - state.dataEnvrn->OutBaroPress, - state.dataHeatBalSurf->SurfTempInTmp(SurfNum), - PsyWFnTdbRhPb(state, - state.dataHeatBalSurf->SurfTempInTmp(SurfNum), - PsyRhFnTdbRhovLBnd0C(state, state.dataHeatBalSurf->SurfTempInTmp(SurfNum), RhoVaporAirIn(SurfNum)), - state.dataEnvrn->OutBaroPress)); - SumHmARaW += HMassConvInFD(SurfNum) * surf.Area * RhoVaporSurfIn(SurfNum); + RhoVaporSurfIn = state.dataMstBalEMPD->RVSurface(SurfNum); + + SumHmAW += HMassConvInFD * surf.Area * (RhoVaporSurfIn - RhoVaporAirIn); + SumHmARa += + HMassConvInFD * surf.Area * + PsyRhoAirFnPbTdbW(state, + state.dataEnvrn->OutBaroPress, + state.dataHeatBalSurf->SurfTempInTmp(SurfNum), + PsyWFnTdbRhPb(state, + state.dataHeatBalSurf->SurfTempInTmp(SurfNum), + PsyRhFnTdbRhovLBnd0C(state, state.dataHeatBalSurf->SurfTempInTmp(SurfNum), RhoVaporAirIn), + state.dataEnvrn->OutBaroPress)); + SumHmARaW += HMassConvInFD * surf.Area * RhoVaporSurfIn; } } // for (SurfNum) } // for (spaceNum) diff --git a/src/EnergyPlus/RoomAirModelAirflowNetwork.hh b/src/EnergyPlus/RoomAirModelAirflowNetwork.hh index c2d5d907798..f648c43d19a 100644 --- a/src/EnergyPlus/RoomAirModelAirflowNetwork.hh +++ b/src/EnergyPlus/RoomAirModelAirflowNetwork.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -105,6 +105,10 @@ struct RoomAirModelAirflowNetworkData : BaseGlobalStruct bool OneTimeFlagConf = true; bool EnvrnFlag = true; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/RoomAirModelManager.cc b/src/EnergyPlus/RoomAirModelManager.cc index 4d4057c42af..47d0e27d06d 100644 --- a/src/EnergyPlus/RoomAirModelManager.cc +++ b/src/EnergyPlus/RoomAirModelManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -54,7 +54,7 @@ #include #include #include -#include +// #include // EnergyPlus Headers #include @@ -257,8 +257,6 @@ namespace RoomAir { // Using/Aliasing using DataZoneEquipment::EquipConfiguration; - using ScheduleManager::GetScheduleIndex; - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view routineName = "GetUserDefinedPatternData: "; @@ -323,20 +321,15 @@ namespace RoomAir { airPatternZoneInfo.Name = ipsc->cAlphaArgs(1); // Name of this Control Object airPatternZoneInfo.ZoneName = ipsc->cAlphaArgs(2); // Zone Name - airPatternZoneInfo.AvailSched = ipsc->cAlphaArgs(3); if (ipsc->lAlphaFieldBlanks(3)) { - airPatternZoneInfo.AvailSchedID = ScheduleManager::ScheduleAlwaysOn; - } else { - airPatternZoneInfo.AvailSchedID = GetScheduleIndex(state, ipsc->cAlphaArgs(3)); - if (airPatternZoneInfo.AvailSchedID == 0) { - ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(3), ipsc->cAlphaArgs(3)); - ErrorsFound = true; - } + airPatternZoneInfo.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((airPatternZoneInfo.availSched = Sched::GetSchedule(state, ipsc->cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(3), ipsc->cAlphaArgs(3)); + ErrorsFound = true; } - airPatternZoneInfo.PatternCntrlSched = ipsc->cAlphaArgs(4); // Schedule Name for Leading Pattern Control for this Zone - airPatternZoneInfo.PatternSchedID = GetScheduleIndex(state, ipsc->cAlphaArgs(4)); - if (airPatternZoneInfo.PatternSchedID == 0) { + if (ipsc->lAlphaFieldBlanks(4)) { + } else if ((airPatternZoneInfo.patternSched = Sched::GetSchedule(state, ipsc->cAlphaArgs(4))) == nullptr) { ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(4), ipsc->cAlphaArgs(4)); ErrorsFound = true; } @@ -346,7 +339,7 @@ namespace RoomAir { // figure number of surfaces for this zone airPatternZoneInfo.totNumSurfs = 0; for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); + auto const &thisSpace = state.dataHeatBal->space(spaceNum); airPatternZoneInfo.totNumSurfs += thisSpace.HTSurfaceLast - thisSpace.HTSurfaceFirst + 1; } // allocate nested derived type for surface info @@ -355,7 +348,7 @@ namespace RoomAir { // Fill in what we know for nested structure for surfaces int thisSurfinZone = 0; for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); + auto const &thisSpace = state.dataHeatBal->space(spaceNum); for (int thisHBsurfID = thisSpace.HTSurfaceFirst; thisHBsurfID <= thisSpace.HTSurfaceLast; ++thisHBsurfID) { ++thisSurfinZone; if (state.dataSurface->Surface(thisHBsurfID).Class == DataSurfaces::SurfaceClass::IntMass) { @@ -696,7 +689,7 @@ namespace RoomAir { } else { int NumOfSurfs = 0; for (int spaceNum : state.dataHeatBal->Zone(airNode.ZonePtr).spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); + auto const &thisSpace = state.dataHeatBal->space(spaceNum); NumOfSurfs += thisSpace.HTSurfaceLast - thisSpace.HTSurfaceFirst + 1; } airNode.SurfMask.allocate(NumOfSurfs); @@ -744,7 +737,7 @@ namespace RoomAir { auto const &zone = state.dataHeatBal->Zone(airNode.ZonePtr); int NumOfSurfs = 0; for (int spaceNum : zone.spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); + auto const &thisSpace = state.dataHeatBal->space(spaceNum); NumOfSurfs += thisSpace.HTSurfaceLast - thisSpace.HTSurfaceFirst + 1; } @@ -763,7 +756,7 @@ namespace RoomAir { for (int ListSurfNum = 4; ListSurfNum <= NumAlphas; ++ListSurfNum) { int thisSurfinZone = 0; for (int spaceNum : zone.spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); + auto const &thisSpace = state.dataHeatBal->space(spaceNum); for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { ++thisSurfinZone; if (ipsc->cAlphaArgs(ListSurfNum) == state.dataSurface->Surface(SurfNum).Name) { @@ -891,9 +884,6 @@ namespace RoomAir { // METHODOLOGY EMPLOYED: // Use input processor to get input from idf file - // Using/Aliasing - using namespace ScheduleManager; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: constexpr std::string_view routineName = "GetDisplacementVentData"; int IOStat; @@ -941,7 +931,7 @@ namespace RoomAir { if (ipsc->lAlphaFieldBlanks(2)) { ShowSevereEmptyField(state, eoh, ipsc->cAlphaFieldNames(2)); ErrorsFound = true; - } else if ((zoneDV3N.SchedGainsPtr = GetScheduleIndex(state, ipsc->cAlphaArgs(2))) == 0) { + } else if ((zoneDV3N.gainsSched = Sched::GetSchedule(state, ipsc->cAlphaArgs(2))) == nullptr) { ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(2), ipsc->cAlphaArgs(2)); ErrorsFound = true; } @@ -966,9 +956,6 @@ namespace RoomAir { // METHODOLOGY EMPLOYED: // Use input processor to get input from idf file - // Using/Aliasing - using namespace ScheduleManager; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: constexpr std::string_view routineName = "GetCrossVentData"; @@ -1015,7 +1002,7 @@ namespace RoomAir { if (ipsc->lAlphaFieldBlanks(2)) { ShowSevereEmptyField(state, eoh, ipsc->cAlphaFieldNames(2)); ErrorsFound = true; - } else if ((zoneCV.SchedGainsPtr = GetScheduleIndex(state, ipsc->cAlphaArgs(2))) == 0) { + } else if ((zoneCV.gainsSched = Sched::GetSchedule(state, ipsc->cAlphaArgs(2))) == nullptr) { ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(2), ipsc->cAlphaArgs(2)); ErrorsFound = true; } @@ -1086,9 +1073,6 @@ namespace RoomAir { // METHODOLOGY EMPLOYED: // Use input processor to get input from idf file - // Using/Aliasing - using namespace ScheduleManager; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: constexpr std::string_view routineName = "GetUFADZoneData"; @@ -1252,7 +1236,6 @@ namespace RoomAir { // Using/Aliasing using InternalHeatGains::GetInternalGainDeviceIndex; - using ScheduleManager::GetScheduleIndex; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: constexpr std::string_view routineName = "GetRoomAirflowNetworkData"; @@ -1339,7 +1322,7 @@ namespace RoomAir { roomAFNZoneInfo.totNumSurfs = 0; for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); + auto const &thisSpace = state.dataHeatBal->space(spaceNum); roomAFNZoneInfo.totNumSurfs += thisSpace.HTSurfaceLast - thisSpace.HTSurfaceFirst + 1; } } // for (Loop) @@ -1429,7 +1412,7 @@ namespace RoomAir { int NumSurfsThisNode = NumAlphas - 1; int NumOfSurfs = 0; // What is this used for? for (int spaceNum : state.dataHeatBal->Zone(iZone).spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); + auto const &thisSpace = state.dataHeatBal->space(spaceNum); NumOfSurfs += thisSpace.HTSurfaceLast - thisSpace.HTSurfaceFirst + 1; } @@ -1451,7 +1434,7 @@ namespace RoomAir { int thisSurfinZone = 0; for (int ListSurfNum = 2; ListSurfNum <= NumAlphas; ++ListSurfNum) { for (int spaceNum : state.dataHeatBal->Zone(iZone).spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); + auto const &thisSpace = state.dataHeatBal->space(spaceNum); for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { ++thisSurfinZone; if (ipsc->cAlphaArgs(ListSurfNum) == state.dataSurface->Surface(SurfNum).Name) { @@ -1648,13 +1631,11 @@ namespace RoomAir { roomAFNNodeHVAC.SupplyFraction = ipsc->rNumericArgs(iEquipArg); roomAFNNodeHVAC.ReturnFraction = ipsc->rNumericArgs(iEquipArg); - // get equipment index - int EquipIndex = 0; + // get equipment type for (int thisZoneEquipNum = 1; thisZoneEquipNum <= state.dataZoneEquip->ZoneEquipList(iZone).NumOfEquipTypes; ++thisZoneEquipNum) { if (Util::SameString(state.dataZoneEquip->ZoneEquipList(iZone).EquipName(thisZoneEquipNum), roomAFNNodeHVAC.Name) && roomAFNNodeHVAC.zoneEquipType == state.dataZoneEquip->ZoneEquipList(iZone).EquipType(thisZoneEquipNum)) { - EquipIndex = state.dataZoneEquip->ZoneEquipList(iZone).EquipIndex(thisZoneEquipNum); break; } } @@ -1701,7 +1682,7 @@ namespace RoomAir { for (int iGain = 1; iGain <= roomAFNNode.NumIntGains; ++iGain) { auto &intGain = roomAFNNode.IntGain(iGain); if (intGain.FractionCheck) continue; - Real64 SumFraction = roomAFNNode.IntGainsFractions(iGain); + SumFraction = roomAFNNode.IntGainsFractions(iGain); intGain.FractionCheck = true; for (int iRoomAFNNode2 = 1; iRoomAFNNode2 <= roomAFNZoneInfo.NumOfAirNodes; ++iRoomAFNNode2) { @@ -1783,11 +1764,8 @@ namespace RoomAir { Real64 constexpr BaseDischargeCoef(0.62); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - bool SetZoneAux; Array1D_int AuxSurf; - int MaxSurf; Array2D_int AuxAirflowNetworkSurf; - int ZoneEquipConfigNum; // counter // Do the one time initializations if (state.dataRoomAir->MyOneTimeFlag) { @@ -1841,26 +1819,23 @@ namespace RoomAir { state.dataRoomAir->HDoor = 0.0; int contWall = 0, contFloor = 0, contCeiling = 0, contWindow = 0, contInternal = 0, contDoor = 0; - int contWallBeg = 0, contFloorBeg = 0, contCeilingBeg = 0, contWindowBeg = 0, contInternalBeg = 0, contDoorBeg = 0; - int contWallLast = 0, contFloorLast = 0, contCeilingLast = 0, contWindowLast = 0, contInternalLast = 0, contDoorLast = 0; // Put the surface and zone information in Apos and PosZ arrays for (int ZNum = 1; ZNum <= state.dataGlobal->NumOfZones; ++ZNum) { // advance ONE position in the arrays PosZ because this is a new zone - contWallBeg = contWall + 1; - contFloorBeg = contFloor + 1; - contCeilingBeg = contCeiling + 1; - contWindowBeg = contWindow + 1; - contInternalBeg = contInternal + 1; - contDoorBeg = contDoor + 1; - SetZoneAux = true; + int contWallBeg = contWall + 1; + int contFloorBeg = contFloor + 1; + int contCeilingBeg = contCeiling + 1; + int contWindowBeg = contWindow + 1; + int contInternalBeg = contInternal + 1; + int contDoorBeg = contDoor + 1; Real64 Z1ofZone = std::numeric_limits::max(); Real64 Z2ofZone = std::numeric_limits::lowest(); // cycle in this zone for all the surfaces for (int spaceNum : state.dataHeatBal->Zone(ZNum).spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); + auto const &thisSpace = state.dataHeatBal->space(spaceNum); for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { auto const &surf = state.dataSurface->Surface(SurfNum); @@ -1900,12 +1875,12 @@ namespace RoomAir { } } // for (SurfNum) - contWallLast = contWall; - contFloorLast = contFloor; - contCeilingLast = contCeiling; - contWindowLast = contWindow; - contDoorLast = contDoor; - contInternalLast = contInternal; + int contWallLast = contWall; + int contFloorLast = contFloor; + int contCeilingLast = contCeiling; + int contWindowLast = contWindow; + int contDoorLast = contDoor; + int contInternalLast = contInternal; // PosZ_Wall (... + 1) has the Begin Wall reference in Apos_Wall for the ZNum // PosZ_Wall (... + 2) has the End Wall reference in Apos_Wall for the ZNum state.dataRoomAir->PosZ_Wall(ZNum).beg = contWallBeg; @@ -1948,7 +1923,7 @@ namespace RoomAir { } } // calculate maximum number of airflow network surfaces in a single zone - MaxSurf = AuxSurf(1); + int MaxSurf = AuxSurf(1); for (int iZone = 2; iZone <= state.dataGlobal->NumOfZones; ++iZone) { if (AuxSurf(iZone) > MaxSurf) MaxSurf = AuxSurf(iZone); } @@ -2456,7 +2431,7 @@ namespace RoomAir { if (state.dataRoomAir->AirModel(iZone).AirModel != RoomAirModel::CrossVent) continue; // don't set these up if they don't make sense - ZoneEquipConfigNum = ZoneNum; // Where does this ZoneNum come from? + int ZoneEquipConfigNum = ZoneNum; // Where does this ZoneNum come from? auto const &zone = state.dataHeatBal->Zone(iZone); // check whether this zone is a controlled zone or not diff --git a/src/EnergyPlus/RoomAirModelManager.hh b/src/EnergyPlus/RoomAirModelManager.hh index 6f2082797fb..8fffa1d0e8f 100644 --- a/src/EnergyPlus/RoomAirModelManager.hh +++ b/src/EnergyPlus/RoomAirModelManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/RoomAirModelUserTempPattern.cc b/src/EnergyPlus/RoomAirModelUserTempPattern.cc index 6a0738ea74e..ae244eb47f5 100644 --- a/src/EnergyPlus/RoomAirModelUserTempPattern.cc +++ b/src/EnergyPlus/RoomAirModelUserTempPattern.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -49,7 +49,7 @@ #include #include #include -#include +// #include #include // EnergyPlus Headers @@ -170,7 +170,7 @@ void GetSurfHBDataForTempDistModel(EnergyPlusData &state, int const ZoneNum) // auto &patternZoneInfo = state.dataRoomAir->AirPatternZoneInfo(ZoneNum); auto const &zoneHeatBal = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); - // intialize in preperation for calculations + // initialize in preparation for calculations patternZoneInfo.Tstat = zoneHeatBal.MAT; patternZoneInfo.Tleaving = zoneHeatBal.MAT; patternZoneInfo.Texhaust = zoneHeatBal.MAT; @@ -198,11 +198,10 @@ void CalcTempDistModel(EnergyPlusData &state, int const ZoneNum) // index number // Using/Aliasing using General::FindNumberInList; - using ScheduleManager::GetCurrentScheduleValue; auto &patternZoneInfo = state.dataRoomAir->AirPatternZoneInfo(ZoneNum); // first determine availability - Real64 AvailTest = GetCurrentScheduleValue(state, patternZoneInfo.AvailSchedID); + Real64 AvailTest = patternZoneInfo.availSched->getCurrentVal(); if ((AvailTest != 1.0) || (!patternZoneInfo.IsUsed)) { // model not to be used. Use complete mixing method @@ -217,7 +216,7 @@ void CalcTempDistModel(EnergyPlusData &state, int const ZoneNum) // index number } else { // choose pattern and call subroutine - int CurntPatternKey = GetCurrentScheduleValue(state, patternZoneInfo.PatternSchedID); + int CurntPatternKey = patternZoneInfo.patternSched->getCurrentVal(); int CurPatrnID = FindNumberInList(CurntPatternKey, state.dataRoomAir->AirPattern, &TemperaturePattern::PatrnID); @@ -300,7 +299,7 @@ void FigureHeightPattern(EnergyPlusData &state, int const PattrnID, int const Zo // treat profile as lookup table and interpolate // Using/Aliasing - using FluidProperties::FindArrayIndex; + using Fluid::FindArrayIndex; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: @@ -357,7 +356,7 @@ void FigureTwoGradInterpPattern(EnergyPlusData &state, int const PattrnID, int c Real64 Grad; // vertical temperature gradient C/m auto &patternZoneInfo = state.dataRoomAir->AirPatternZoneInfo(ZoneNum); - auto &pattern = state.dataRoomAir->AirPattern(PattrnID); + auto const &pattern = state.dataRoomAir->AirPattern(PattrnID); if (state.dataRoomAirModelTempPattern->MyOneTimeFlag2) { state.dataRoomAirModelTempPattern->SetupOutputFlag.dimension(state.dataGlobal->NumOfZones, true); // init @@ -491,7 +490,7 @@ void FigureConstGradPattern(EnergyPlusData &state, int const PattrnID, int const // DATE WRITTEN August 2005 auto &patternZoneInfo = state.dataRoomAir->AirPatternZoneInfo(ZoneNum); - auto &pattern = state.dataRoomAir->AirPattern(PattrnID); + auto const &pattern = state.dataRoomAir->AirPattern(PattrnID); Real64 Tmean = patternZoneInfo.TairMean; // MAT Real64 Grad = pattern.GradPatrn.Gradient; // Vertical temperature gradient @@ -539,7 +538,7 @@ Real64 FigureNDheightInZone(EnergyPlusData &state, int const thisHBsurf) // inde Real64 ZMin = 0.0; int Count = 0; for (int spaceNum : zone.spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); + auto const &thisSpace = state.dataHeatBal->space(spaceNum); for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { auto const &surf = state.dataSurface->Surface(SurfNum); if (surf.Class == DataSurfaces::SurfaceClass::Floor) { @@ -644,7 +643,7 @@ void SetSurfHBDataForTempDistModel(EnergyPlusData &state, int const ZoneNum) // // What if ZoneNodeID is 0? auto &zoneNode = state.dataLoopNodes->Node(patternZoneInfo.ZoneNodeID); - auto &zone = state.dataHeatBal->Zone(ZoneNum); + auto const &zone = state.dataHeatBal->Zone(ZoneNum); auto &zoneHeatBal = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); int ZoneMult = zone.Multiplier * zone.ListMultiplier; @@ -673,7 +672,7 @@ void SetSurfHBDataForTempDistModel(EnergyPlusData &state, int const ZoneNum) // if (zone.HasAirFlowWindowReturn) { for (int spaceNum : zone.spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); + auto const &thisSpace = state.dataHeatBal->space(spaceNum); for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { if (state.dataSurface->SurfWinAirflowThisTS(SurfNum) > 0.0 && state.dataSurface->SurfWinAirflowDestination(SurfNum) == DataSurfaces::WindowAirFlowDestination::Return) { @@ -733,7 +732,7 @@ void SetSurfHBDataForTempDistModel(EnergyPlusData &state, int const ZoneNum) // Real64 H2OHtOfVap = PsyHgAirFnWTdb(zoneNode.HumRat, returnNode.Temp); - // Include impact of under case returns for refrigerated display cases when updateing return node + // Include impact of under case returns for refrigerated display cases when updating return node // humidity ratio if (!zone.NoHeatToReturnAir) { if (MassFlowRA > 0) { @@ -772,7 +771,7 @@ void SetSurfHBDataForTempDistModel(EnergyPlusData &state, int const ZoneNum) // // set results for all surface for (int spaceNum : zone.spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); + auto const &thisSpace = state.dataHeatBal->space(spaceNum); for (int i = thisSpace.HTSurfaceFirst, j = 0; i <= thisSpace.HTSurfaceLast; ++i) { state.dataHeatBal->SurfTempEffBulkAir(i) = patternZoneInfo.Surf(++j).TadjacentAir; } @@ -780,7 +779,7 @@ void SetSurfHBDataForTempDistModel(EnergyPlusData &state, int const ZoneNum) // // set flag for reference air temperature mode for (int spaceNum : zone.spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); + auto const &thisSpace = state.dataHeatBal->space(spaceNum); for (int i = thisSpace.HTSurfaceFirst; i <= thisSpace.HTSurfaceLast; ++i) { state.dataSurface->SurfTAirRef(i) = DataSurfaces::RefAirTemp::AdjacentAirTemp; state.dataSurface->SurfTAirRefRpt(i) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(i)]; diff --git a/src/EnergyPlus/RoomAirModelUserTempPattern.hh b/src/EnergyPlus/RoomAirModelUserTempPattern.hh index 20b0eda7a34..00acf9501ca 100644 --- a/src/EnergyPlus/RoomAirModelUserTempPattern.hh +++ b/src/EnergyPlus/RoomAirModelUserTempPattern.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -124,6 +124,10 @@ struct RoomAirModelUserTempPatternData : BaseGlobalStruct Array1D_bool MyEnvrnFlag; // flag for init once at start of environment Array1D_bool SetupOutputFlag; // flag to set up output variable one-time if 2-grad model used + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/RootFinder.cc b/src/EnergyPlus/RootFinder.cc index 33d6b880a62..5a821a5ae4e 100644 --- a/src/EnergyPlus/RootFinder.cc +++ b/src/EnergyPlus/RootFinder.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -49,7 +49,7 @@ #include // ObjexxFCL Headers -#include +// #include // EnergyPlus Headers #include diff --git a/src/EnergyPlus/RootFinder.hh b/src/EnergyPlus/RootFinder.hh index 2391a3349cb..fb8a3f52dcb 100644 --- a/src/EnergyPlus/RootFinder.hh +++ b/src/EnergyPlus/RootFinder.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/RuntimeLanguageProcessor.cc b/src/EnergyPlus/RuntimeLanguageProcessor.cc index 55dc9cd6380..ac4594bbf8f 100644 --- a/src/EnergyPlus/RuntimeLanguageProcessor.cc +++ b/src/EnergyPlus/RuntimeLanguageProcessor.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -53,7 +53,7 @@ #include #include #include -#include +// #include #include #include #include @@ -118,10 +118,10 @@ void InitializeRuntimeLanguage(EnergyPlusData &state) // value(7) Seconds (0-59) // value(8) Milliseconds (0-999) - std::string datestring; // supposedly returns blank when no date available. - if (state.dataRuntimeLangProcessor->InitializeOnce) { + std::string datestring; // supposedly returns blank when no date available. + state.dataRuntimeLang->emsVarBuiltInStart = state.dataRuntimeLang->NumErlVariables + 1; state.dataRuntimeLang->False = SetErlValueNumber(0.0); @@ -136,7 +136,7 @@ void InitializeRuntimeLanguage(EnergyPlusData &state) state.dataRuntimeLangProcessor->OnVariableNum = NewEMSVariable(state, "ON", 0, state.dataRuntimeLang->True); state.dataRuntimeLangProcessor->PiVariableNum = NewEMSVariable(state, "PI", 0, SetErlValueNumber(Constant::Pi)); state.dataRuntimeLangProcessor->TimeStepsPerHourVariableNum = - NewEMSVariable(state, "TIMESTEPSPERHOUR", 0, SetErlValueNumber(double(state.dataGlobal->NumOfTimeStepInHour))); + NewEMSVariable(state, "TIMESTEPSPERHOUR", 0, SetErlValueNumber(double(state.dataGlobal->TimeStepsInHour))); // Create dynamic built-in variables state.dataRuntimeLangProcessor->YearVariableNum = NewEMSVariable(state, "YEAR", 0); @@ -1967,11 +1967,11 @@ ErlValueType EvaluateExpression(EnergyPlusData &state, int const ExpressionNum, break; case ErlFunc::DegToRad: - ReturnValue = SetErlValueNumber(Operand(1).Number * Constant::DegToRadians); + ReturnValue = SetErlValueNumber(Operand(1).Number * Constant::DegToRad); break; case ErlFunc::RadToDeg: - ReturnValue = SetErlValueNumber(Operand(1).Number / Constant::DegToRadians); + ReturnValue = SetErlValueNumber(Operand(1).Number / Constant::DegToRad); break; case ErlFunc::Exp: @@ -2545,7 +2545,7 @@ ErlValueType EvaluateExpression(EnergyPlusData &state, int const ExpressionNum, case ErlFunc::TodayLiquidPrecip: { int iHour = (Operand(1).Number + 1); // Operand 1 is hour from 0:23 int iTimeStep = Operand(2).Number; - if ((iHour > 0) && (iHour <= 24) && (iTimeStep > 0) && (iTimeStep <= state.dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= 24) && (iTimeStep > 0) && (iTimeStep <= state.dataGlobal->TimeStepsInHour)) { auto const &today = state.dataWeather->wvarsHrTsToday(iTimeStep, iHour); ReturnValue.initialized = true; ReturnValue.Type = Value::Number; @@ -2621,7 +2621,7 @@ ErlValueType EvaluateExpression(EnergyPlusData &state, int const ExpressionNum, case ErlFunc::TomorrowLiquidPrecip: { int iHour = (Operand(1).Number + 1); // Operand 1 is hour from 0:23 int iTimeStep = Operand(2).Number; - if ((iHour > 0) && (iHour <= Constant::HoursInDay) && (iTimeStep > 0) && (iTimeStep <= state.dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= Constant::iHoursInDay) && (iTimeStep > 0) && (iTimeStep <= state.dataGlobal->TimeStepsInHour)) { auto const &tomorrow = state.dataWeather->wvarsHrTsTomorrow(iTimeStep, iHour); ReturnValue.initialized = true; ReturnValue.Type = Value::Number; diff --git a/src/EnergyPlus/RuntimeLanguageProcessor.hh b/src/EnergyPlus/RuntimeLanguageProcessor.hh index 9e223bcaf15..7db4661461b 100644 --- a/src/EnergyPlus/RuntimeLanguageProcessor.hh +++ b/src/EnergyPlus/RuntimeLanguageProcessor.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -225,6 +225,10 @@ struct RuntimeLanguageProcessorData : BaseGlobalStruct Array1D Token; Array1D PEToken; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/SQLiteProcedures.cc b/src/EnergyPlus/SQLiteProcedures.cc index 731e3ece0d8..4b33b732454 100644 --- a/src/EnergyPlus/SQLiteProcedures.cc +++ b/src/EnergyPlus/SQLiteProcedures.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -104,8 +104,6 @@ bool ParseSQLiteInput(EnergyPlusData &state, bool &writeOutputToSQLite, bool &wr return input; }; - auto &sql_ort = state.dataOutRptTab; - // There can only be 1 "Output:SQLite" auto const instance = instances.value().begin(); auto const &fields = instance.value(); @@ -123,6 +121,8 @@ bool ParseSQLiteInput(EnergyPlusData &state, bool &writeOutputToSQLite, bool &wr } { // "unit_conversion_for_tabular_data" std::string tabularDataUnitConversion = find_input(fields, "unit_conversion_for_tabular_data"); + auto const &sql_ort = state.dataOutRptTab; + if ("UseOutputControlTableStyles" == tabularDataUnitConversion) { // Jan 2021 Note: Since here we do not know weather sql_ort->unitsStyle has been processed or not, // the value "NotFound" is used for the option "UseOutputControlTableStyles" at this point; @@ -184,13 +184,13 @@ void CreateSQLiteZoneExtendedOutput(EnergyPlusData &state) for (int groupNum = 1; groupNum <= state.dataHeatBal->NumOfZoneGroups; ++groupNum) { state.dataSQLiteProcedures->sqlite->addZoneGroupData(groupNum, state.dataHeatBal->ZoneGroup(groupNum)); } - for (int scheduleNumber = 1, numberOfSchedules = ScheduleManager::GetNumberOfSchedules(state); scheduleNumber <= numberOfSchedules; - ++scheduleNumber) { - state.dataSQLiteProcedures->sqlite->addScheduleData(scheduleNumber, - ScheduleManager::GetScheduleName(state, scheduleNumber), - ScheduleManager::GetScheduleType(state, scheduleNumber), - ScheduleManager::GetScheduleMinValue(state, scheduleNumber), - ScheduleManager::GetScheduleMaxValue(state, scheduleNumber)); + for (auto *sched : state.dataSched->schedules) { + state.dataSQLiteProcedures->sqlite->addScheduleData( + sched->Num, + sched->Name, + (sched->schedTypeNum == -1) ? "" : state.dataSched->scheduleTypes[sched->schedTypeNum]->Name, + sched->getMinVal(state), + sched->getMaxVal(state)); } for (int surfaceNumber = 1; surfaceNumber <= state.dataSurface->TotSurfaces; ++surfaceNumber) { auto const &surface = state.dataSurface->Surface(surfaceNumber); @@ -1577,7 +1577,6 @@ void SQLite::createSQLiteTimeIndexRecord(OutputProcessor::ReportFreq const repor bool const warmupFlag) { if (m_writeOutputToSQLite) { - int intStartMinute = 0; int intervalInMinutes = 60; static std::vector lastDayOfMonth = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; @@ -1595,7 +1594,7 @@ void SQLite::createSQLiteTimeIndexRecord(OutputProcessor::ReportFreq const repor ++m_sqlDBTimeIndex; int intEndMinute = static_cast(endMinute + 0.5); - intStartMinute = static_cast(startMinute + 0.5); + int intStartMinute = static_cast(startMinute + 0.5); int t_hour = hour; intervalInMinutes = intEndMinute - intStartMinute; adjustReportingHourAndMinutes(t_hour, intEndMinute); @@ -2296,7 +2295,7 @@ bool SQLite::NominalLighting::insertIntoSQLite(sqlite3_stmt *insertStmt) sqliteBindInteger(insertStmt, 1, number); sqliteBindText(insertStmt, 2, name); sqliteBindForeignKey(insertStmt, 3, zonePtr); - sqliteBindForeignKey(insertStmt, 4, schedulePtr); + sqliteBindForeignKey(insertStmt, 4, sched->Num); sqliteBindDouble(insertStmt, 5, designLevel); sqliteBindDouble(insertStmt, 6, fractionReturnAir); sqliteBindDouble(insertStmt, 7, fractionRadiant); @@ -2316,13 +2315,13 @@ bool SQLite::NominalPeople::insertIntoSQLite(sqlite3_stmt *insertStmt) sqliteBindText(insertStmt, 2, name); sqliteBindForeignKey(insertStmt, 3, zonePtr); sqliteBindDouble(insertStmt, 4, numberOfPeople); - sqliteBindForeignKey(insertStmt, 5, numberOfPeoplePtr); - sqliteBindForeignKey(insertStmt, 6, activityLevelPtr); + sqliteBindForeignKey(insertStmt, 5, numberOfPeopleSched ? numberOfPeopleSched->Num : -1); + sqliteBindForeignKey(insertStmt, 6, activityLevelSched ? activityLevelSched->Num : -1); sqliteBindDouble(insertStmt, 7, fractionRadiant); sqliteBindDouble(insertStmt, 8, fractionConvected); - sqliteBindForeignKey(insertStmt, 9, workEffPtr); - sqliteBindForeignKey(insertStmt, 10, clothingPtr); - sqliteBindForeignKey(insertStmt, 11, airVelocityPtr); + sqliteBindForeignKey(insertStmt, 9, workEffSched ? workEffSched->Num : -1); + sqliteBindForeignKey(insertStmt, 10, clothingSched ? clothingSched->Num : -1); + sqliteBindForeignKey(insertStmt, 11, airVelocitySched ? airVelocitySched->Num : -1); sqliteBindLogical(insertStmt, 12, fanger); sqliteBindLogical(insertStmt, 13, pierce); sqliteBindLogical(insertStmt, 14, ksu); @@ -2343,7 +2342,7 @@ bool SQLite::NominalElectricEquipment::insertIntoSQLite(sqlite3_stmt *insertStmt sqliteBindInteger(insertStmt, 1, number); sqliteBindText(insertStmt, 2, name); sqliteBindForeignKey(insertStmt, 3, zonePtr); - sqliteBindForeignKey(insertStmt, 4, schedulePtr); + sqliteBindForeignKey(insertStmt, 4, sched->Num); sqliteBindDouble(insertStmt, 5, designLevel); sqliteBindDouble(insertStmt, 6, fractionLatent); sqliteBindDouble(insertStmt, 7, fractionRadiant); @@ -2361,7 +2360,7 @@ bool SQLite::NominalGasEquipment::insertIntoSQLite(sqlite3_stmt *insertStmt) sqliteBindInteger(insertStmt, 1, number); sqliteBindText(insertStmt, 2, name); sqliteBindForeignKey(insertStmt, 3, zonePtr); - sqliteBindForeignKey(insertStmt, 4, schedulePtr); + sqliteBindForeignKey(insertStmt, 4, sched->Num); sqliteBindDouble(insertStmt, 5, designLevel); sqliteBindDouble(insertStmt, 6, fractionLatent); sqliteBindDouble(insertStmt, 7, fractionRadiant); @@ -2379,7 +2378,7 @@ bool SQLite::NominalSteamEquipment::insertIntoSQLite(sqlite3_stmt *insertStmt) sqliteBindInteger(insertStmt, 1, number); sqliteBindText(insertStmt, 2, name); sqliteBindForeignKey(insertStmt, 3, zonePtr); - sqliteBindForeignKey(insertStmt, 4, schedulePtr); + sqliteBindForeignKey(insertStmt, 4, sched->Num); sqliteBindDouble(insertStmt, 5, designLevel); sqliteBindDouble(insertStmt, 6, fractionLatent); sqliteBindDouble(insertStmt, 7, fractionRadiant); @@ -2397,7 +2396,7 @@ bool SQLite::NominalHotWaterEquipment::insertIntoSQLite(sqlite3_stmt *insertStmt sqliteBindInteger(insertStmt, 1, number); sqliteBindText(insertStmt, 2, name); sqliteBindForeignKey(insertStmt, 3, zonePtr); - sqliteBindForeignKey(insertStmt, 4, schedulePtr); + sqliteBindForeignKey(insertStmt, 4, sched->Num); sqliteBindDouble(insertStmt, 5, designLevel); sqliteBindDouble(insertStmt, 6, fractionLatent); sqliteBindDouble(insertStmt, 7, fractionRadiant); @@ -2415,7 +2414,7 @@ bool SQLite::NominalOtherEquipment::insertIntoSQLite(sqlite3_stmt *insertStmt) sqliteBindInteger(insertStmt, 1, number); sqliteBindText(insertStmt, 2, name); sqliteBindForeignKey(insertStmt, 3, zonePtr); - sqliteBindForeignKey(insertStmt, 4, schedulePtr); + sqliteBindForeignKey(insertStmt, 4, sched->Num); sqliteBindDouble(insertStmt, 5, designLevel); sqliteBindDouble(insertStmt, 6, fractionLatent); sqliteBindDouble(insertStmt, 7, fractionRadiant); @@ -2433,7 +2432,7 @@ bool SQLite::NominalBaseboardHeat::insertIntoSQLite(sqlite3_stmt *insertStmt) sqliteBindInteger(insertStmt, 1, number); sqliteBindText(insertStmt, 2, name); sqliteBindForeignKey(insertStmt, 3, zonePtr); - sqliteBindForeignKey(insertStmt, 4, schedPtr); + sqliteBindForeignKey(insertStmt, 4, sched->Num); sqliteBindDouble(insertStmt, 5, capatLowTemperature); sqliteBindDouble(insertStmt, 6, lowTemperature); sqliteBindDouble(insertStmt, 7, capatHighTemperature); @@ -2452,7 +2451,7 @@ bool SQLite::Infiltration::insertIntoSQLite(sqlite3_stmt *insertStmt) sqliteBindInteger(insertStmt, 1, number); sqliteBindText(insertStmt, 2, name); sqliteBindForeignKey(insertStmt, 3, zonePtr); - sqliteBindForeignKey(insertStmt, 4, schedPtr); + sqliteBindForeignKey(insertStmt, 4, sched->Num); sqliteBindDouble(insertStmt, 5, designLevel); int rc = sqliteStepCommand(insertStmt); @@ -2465,7 +2464,7 @@ bool SQLite::Ventilation::insertIntoSQLite(sqlite3_stmt *insertStmt) sqliteBindInteger(insertStmt, 1, number); sqliteBindText(insertStmt, 2, name); sqliteBindForeignKey(insertStmt, 3, zonePtr); - sqliteBindForeignKey(insertStmt, 4, schedPtr); + sqliteBindForeignKey(insertStmt, 4, sched->Num); sqliteBindDouble(insertStmt, 5, designLevel); int rc = sqliteStepCommand(insertStmt); @@ -2611,7 +2610,7 @@ SQLiteProcedures::SQLiteProcedures(std::shared_ptr const &errorStr { sqlite3 *m_connection = nullptr; if (m_writeOutputToSQLite) { - int rc = -1; + int rc; bool ok = true; std::string const dbName_utf8 = FileSystem::toGenericString(dbName); diff --git a/src/EnergyPlus/SQLiteProcedures.hh b/src/EnergyPlus/SQLiteProcedures.hh index db4a46761c1..cebaaee91eb 100644 --- a/src/EnergyPlus/SQLiteProcedures.hh +++ b/src/EnergyPlus/SQLiteProcedures.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -668,7 +668,7 @@ private: int const nominalLightingNumber, DataHeatBalance::LightsData const &nominalLightingData) : SQLiteData(errorStream, db), number(nominalLightingNumber), name(nominalLightingData.Name), zonePtr(nominalLightingData.ZonePtr), - schedulePtr(nominalLightingData.SchedPtr), designLevel(nominalLightingData.DesignLevel), + sched(nominalLightingData.sched), designLevel(nominalLightingData.DesignLevel), fractionReturnAir(nominalLightingData.FractionReturnAir), fractionRadiant(nominalLightingData.FractionRadiant), fractionShortWave(nominalLightingData.FractionShortWave), fractionReplaceable(nominalLightingData.FractionReplaceable), fractionConvected(nominalLightingData.FractionConvected), endUseSubcategory(nominalLightingData.EndUseSubcategory) @@ -681,7 +681,7 @@ private: int const number; std::string const &name; int const &zonePtr; - int const &schedulePtr; + Sched::Schedule const *sched; double const &designLevel; double const &fractionReturnAir; double const &fractionRadiant; @@ -699,10 +699,10 @@ private: int const nominalPeopleNumber, DataHeatBalance::PeopleData const &nominalPeopleData) : SQLiteData(errorStream, db), number(nominalPeopleNumber), name(nominalPeopleData.Name), zonePtr(nominalPeopleData.ZonePtr), - numberOfPeople(nominalPeopleData.NumberOfPeople), numberOfPeoplePtr(nominalPeopleData.NumberOfPeoplePtr), - activityLevelPtr(nominalPeopleData.ActivityLevelPtr), fractionRadiant(nominalPeopleData.FractionRadiant), - fractionConvected(nominalPeopleData.FractionConvected), workEffPtr(nominalPeopleData.WorkEffPtr), - clothingPtr(nominalPeopleData.ClothingPtr), airVelocityPtr(nominalPeopleData.AirVelocityPtr), fanger(nominalPeopleData.Fanger), + numberOfPeople(nominalPeopleData.NumberOfPeople), numberOfPeopleSched(nominalPeopleData.sched), + activityLevelSched(nominalPeopleData.activityLevelSched), fractionRadiant(nominalPeopleData.FractionRadiant), + fractionConvected(nominalPeopleData.FractionConvected), workEffSched(nominalPeopleData.workEffSched), + clothingSched(nominalPeopleData.clothingSched), airVelocitySched(nominalPeopleData.airVelocitySched), fanger(nominalPeopleData.Fanger), pierce(nominalPeopleData.Pierce), ksu(nominalPeopleData.KSU), mrtCalcType(nominalPeopleData.MRTCalcType), surfacePtr(nominalPeopleData.SurfacePtr), angleFactorListName(nominalPeopleData.AngleFactorListName), angleFactorListPtr(nominalPeopleData.AngleFactorListPtr), userSpecSensFrac(nominalPeopleData.UserSpecSensFrac), @@ -717,13 +717,13 @@ private: std::string const &name; int const &zonePtr; double const &numberOfPeople; - int const &numberOfPeoplePtr; - int const &activityLevelPtr; + Sched::Schedule const *numberOfPeopleSched; + Sched::Schedule const *activityLevelSched; double const &fractionRadiant; double const &fractionConvected; - int const &workEffPtr; - int const &clothingPtr; - int const &airVelocityPtr; + Sched::Schedule const *workEffSched; + Sched::Schedule const *clothingSched; + Sched::Schedule const *airVelocitySched; bool const &fanger; bool const &pierce; bool const &ksu; @@ -743,7 +743,7 @@ private: int const nominalElectricEquipmentNumber, DataHeatBalance::ZoneEquipData const &nominalElectricEquipmentData) : SQLiteData(errorStream, db), number(nominalElectricEquipmentNumber), name(nominalElectricEquipmentData.Name), - zonePtr(nominalElectricEquipmentData.ZonePtr), schedulePtr(nominalElectricEquipmentData.SchedPtr), + zonePtr(nominalElectricEquipmentData.ZonePtr), sched(nominalElectricEquipmentData.sched), designLevel(nominalElectricEquipmentData.DesignLevel), fractionLatent(nominalElectricEquipmentData.FractionLatent), fractionRadiant(nominalElectricEquipmentData.FractionRadiant), fractionLost(nominalElectricEquipmentData.FractionLost), fractionConvected(nominalElectricEquipmentData.FractionConvected), endUseSubcategory(nominalElectricEquipmentData.EndUseSubcategory) @@ -756,7 +756,7 @@ private: int const number; std::string const &name; int const &zonePtr; - int const &schedulePtr; + Sched::Schedule const *sched; double const &designLevel; double const &fractionLatent; double const &fractionRadiant; @@ -773,10 +773,10 @@ private: int const nominalGasEquipmentNumber, DataHeatBalance::ZoneEquipData const &nominalGasEquipmentData) : SQLiteData(errorStream, db), number(nominalGasEquipmentNumber), name(nominalGasEquipmentData.Name), - zonePtr(nominalGasEquipmentData.ZonePtr), schedulePtr(nominalGasEquipmentData.SchedPtr), - designLevel(nominalGasEquipmentData.DesignLevel), fractionLatent(nominalGasEquipmentData.FractionLatent), - fractionRadiant(nominalGasEquipmentData.FractionRadiant), fractionLost(nominalGasEquipmentData.FractionLost), - fractionConvected(nominalGasEquipmentData.FractionConvected), endUseSubcategory(nominalGasEquipmentData.EndUseSubcategory) + zonePtr(nominalGasEquipmentData.ZonePtr), sched(nominalGasEquipmentData.sched), designLevel(nominalGasEquipmentData.DesignLevel), + fractionLatent(nominalGasEquipmentData.FractionLatent), fractionRadiant(nominalGasEquipmentData.FractionRadiant), + fractionLost(nominalGasEquipmentData.FractionLost), fractionConvected(nominalGasEquipmentData.FractionConvected), + endUseSubcategory(nominalGasEquipmentData.EndUseSubcategory) { } @@ -786,7 +786,7 @@ private: int const number; std::string const &name; int const &zonePtr; - int const &schedulePtr; + Sched::Schedule const *sched; double const &designLevel; double const &fractionLatent; double const &fractionRadiant; @@ -803,10 +803,10 @@ private: int const nominalSteamEquipmentNumber, DataHeatBalance::ZoneEquipData const &nominalSteamEquipmentData) : SQLiteData(errorStream, db), number(nominalSteamEquipmentNumber), name(nominalSteamEquipmentData.Name), - zonePtr(nominalSteamEquipmentData.ZonePtr), schedulePtr(nominalSteamEquipmentData.SchedPtr), - designLevel(nominalSteamEquipmentData.DesignLevel), fractionLatent(nominalSteamEquipmentData.FractionLatent), - fractionRadiant(nominalSteamEquipmentData.FractionRadiant), fractionLost(nominalSteamEquipmentData.FractionLost), - fractionConvected(nominalSteamEquipmentData.FractionConvected), endUseSubcategory(nominalSteamEquipmentData.EndUseSubcategory) + zonePtr(nominalSteamEquipmentData.ZonePtr), sched(nominalSteamEquipmentData.sched), designLevel(nominalSteamEquipmentData.DesignLevel), + fractionLatent(nominalSteamEquipmentData.FractionLatent), fractionRadiant(nominalSteamEquipmentData.FractionRadiant), + fractionLost(nominalSteamEquipmentData.FractionLost), fractionConvected(nominalSteamEquipmentData.FractionConvected), + endUseSubcategory(nominalSteamEquipmentData.EndUseSubcategory) { } @@ -816,7 +816,7 @@ private: int const number; std::string const &name; int const &zonePtr; - int const &schedulePtr; + Sched::Schedule const *sched; double const &designLevel; double const &fractionLatent; double const &fractionRadiant; @@ -833,7 +833,7 @@ private: int const nominalHotWaterEquipmentNumber, DataHeatBalance::ZoneEquipData const &nominalHotWaterEquipmentData) : SQLiteData(errorStream, db), number(nominalHotWaterEquipmentNumber), name(nominalHotWaterEquipmentData.Name), - zonePtr(nominalHotWaterEquipmentData.ZonePtr), schedulePtr(nominalHotWaterEquipmentData.SchedPtr), + zonePtr(nominalHotWaterEquipmentData.ZonePtr), sched(nominalHotWaterEquipmentData.sched), designLevel(nominalHotWaterEquipmentData.DesignLevel), fractionLatent(nominalHotWaterEquipmentData.FractionLatent), fractionRadiant(nominalHotWaterEquipmentData.FractionRadiant), fractionLost(nominalHotWaterEquipmentData.FractionLost), fractionConvected(nominalHotWaterEquipmentData.FractionConvected), endUseSubcategory(nominalHotWaterEquipmentData.EndUseSubcategory) @@ -846,7 +846,7 @@ private: int const number; std::string const &name; int const &zonePtr; - int const &schedulePtr; + Sched::Schedule const *sched; double const &designLevel; double const &fractionLatent; double const &fractionRadiant; @@ -863,10 +863,10 @@ private: int const nominalOtherEquipmentNumber, DataHeatBalance::ZoneEquipData const &nominalOtherEquipmentData) : SQLiteData(errorStream, db), number(nominalOtherEquipmentNumber), name(nominalOtherEquipmentData.Name), - zonePtr(nominalOtherEquipmentData.ZonePtr), schedulePtr(nominalOtherEquipmentData.SchedPtr), - designLevel(nominalOtherEquipmentData.DesignLevel), fractionLatent(nominalOtherEquipmentData.FractionLatent), - fractionRadiant(nominalOtherEquipmentData.FractionRadiant), fractionLost(nominalOtherEquipmentData.FractionLost), - fractionConvected(nominalOtherEquipmentData.FractionConvected), endUseSubcategory(nominalOtherEquipmentData.EndUseSubcategory) + zonePtr(nominalOtherEquipmentData.ZonePtr), sched(nominalOtherEquipmentData.sched), designLevel(nominalOtherEquipmentData.DesignLevel), + fractionLatent(nominalOtherEquipmentData.FractionLatent), fractionRadiant(nominalOtherEquipmentData.FractionRadiant), + fractionLost(nominalOtherEquipmentData.FractionLost), fractionConvected(nominalOtherEquipmentData.FractionConvected), + endUseSubcategory(nominalOtherEquipmentData.EndUseSubcategory) { } @@ -876,7 +876,7 @@ private: int const number; std::string const &name; int const &zonePtr; - int const &schedulePtr; + Sched::Schedule const *sched; double const &designLevel; double const &fractionLatent; double const &fractionRadiant; @@ -893,7 +893,7 @@ private: int const nominalBaseboardHeatNumber, DataHeatBalance::BBHeatData const &nominalBaseboardHeatData) : SQLiteData(errorStream, db), number(nominalBaseboardHeatNumber), name(nominalBaseboardHeatData.Name), - zonePtr(nominalBaseboardHeatData.ZonePtr), schedPtr(nominalBaseboardHeatData.SchedPtr), + zonePtr(nominalBaseboardHeatData.ZonePtr), sched(nominalBaseboardHeatData.sched), capatLowTemperature(nominalBaseboardHeatData.CapatLowTemperature), lowTemperature(nominalBaseboardHeatData.LowTemperature), capatHighTemperature(nominalBaseboardHeatData.CapatHighTemperature), highTemperature(nominalBaseboardHeatData.HighTemperature), fractionRadiant(nominalBaseboardHeatData.FractionRadiant), fractionConvected(nominalBaseboardHeatData.FractionConvected), @@ -907,7 +907,7 @@ private: int const number; std::string const &name; int const &zonePtr; - int const &schedPtr; + Sched::Schedule const *sched; double const &capatLowTemperature; double const &lowTemperature; double const &capatHighTemperature; @@ -925,7 +925,7 @@ private: int const infiltrationNumber, DataHeatBalance::InfiltrationData const &infiltrationData) : SQLiteData(errorStream, db), number(infiltrationNumber), name(infiltrationData.Name), zonePtr(infiltrationData.ZonePtr), - schedPtr(infiltrationData.SchedPtr), designLevel(infiltrationData.DesignLevel) + sched(infiltrationData.sched), designLevel(infiltrationData.DesignLevel) { } @@ -935,7 +935,7 @@ private: int const number; std::string const &name; int const &zonePtr; - int const &schedPtr; + Sched::Schedule const *sched; double const &designLevel; }; @@ -947,7 +947,7 @@ private: int const ventilationNumber, DataHeatBalance::VentilationData const &ventilationData) : SQLiteData(errorStream, db), number(ventilationNumber), name(ventilationData.Name), zonePtr(ventilationData.ZonePtr), - schedPtr(ventilationData.SchedPtr), designLevel(ventilationData.DesignLevel) + sched(ventilationData.availSched), designLevel(ventilationData.DesignLevel) { } @@ -957,7 +957,7 @@ private: int const number; std::string const &name; int const &zonePtr; - int const &schedPtr; + Sched::Schedule const *sched; double const &designLevel; }; @@ -1012,6 +1012,10 @@ void CreateSQLiteZoneExtendedOutput(EnergyPlusData &state); struct SQLiteProceduresData : BaseGlobalStruct { std::unique_ptr sqlite; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/SZVAVModel.cc b/src/EnergyPlus/SZVAVModel.cc index 854b944ecff..980e1376632 100644 --- a/src/EnergyPlus/SZVAVModel.cc +++ b/src/EnergyPlus/SZVAVModel.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -51,7 +51,6 @@ #include // ObjexxFCL Headers -#include #include // EnergyPlus Headers @@ -165,13 +164,13 @@ namespace SZVAVModel { // model attempts to control air flow rate and coil capacity in specific operating regions: // Region 1 (R1) - minimum air flow rate at modulated coil capacity (up to min/max temperature limits) - // Region 2 (R2) - modultated air flow rate and coil capacity (up to max air flow rate while maintaining min/max temperature limits) + // Region 2 (R2) - modulated air flow rate and coil capacity (up to max air flow rate while maintaining min/max temperature limits) // Region 3 (R3) - maximum air flow rate and modulated/increased coil capacity (allow increased capacity at full air flow rate to meet // remaining load) // // | | | | ^ ^ = supply air temperature // | | | | ^ * = supply air flow rate - // | | |^^^^| <--- maximum supply air temperture + // | | |^^^^| <--- maximum supply air temperature // | | ^ | | // | | ^ | | // ***********| | ^ | |************** <-- max unit air flow rate @@ -333,7 +332,7 @@ namespace SZVAVModel { } } else { // not enough capacity at this air flow rate. Unit does have enough capacity a full water/air, otherwise wouldn't be here // this is different from the PTUnit and UnitarySys routines in this module - // find the water flow rate that meets the min load at region 1/2 bounday + // find the water flow rate that meets the min load at region 1/2 boundary if (SZVAVModel.HCoilType_Num == FanCoilUnits::HCoil::Water || !HeatingLoad) { auto f = // (AUTO_OK_LAMBDA) [&state, SysIndex, FirstHVACIteration, &SZVAVModel, ZoneLoad, coilFluidInletNode, maxCoilFluidFlow, minAirMassFlow]( @@ -630,13 +629,13 @@ namespace SZVAVModel { // model attempts to control air flow rate and coil capacity in specific operating regions: // Region 1 (R1) - minimum air flow rate at modulated coil capacity (up to min/max temperature limits) - // Region 2 (R2) - modultated air flow rate and coil capacity (up to max air flow rate while maintaining min/max temperature limits) + // Region 2 (R2) - modulated air flow rate and coil capacity (up to max air flow rate while maintaining min/max temperature limits) // Region 3 (R3) - maximum air flow rate and modulated/increased coil capacity (allow increased capacity at full air flow rate to meet // remaining load) // // | | | | ^ ^ = supply air temperature // | | | | ^ * = supply air flow rate - // | | |^^^^| <--- maximum supply air temperture + // | | |^^^^| <--- maximum supply air temperature // | | ^ | | // | | ^ | | // ***********| | ^ | |************** <-- max unit air flow rate diff --git a/src/EnergyPlus/SZVAVModel.hh b/src/EnergyPlus/SZVAVModel.hh index 313c51bcab3..54fc5faadd2 100644 --- a/src/EnergyPlus/SZVAVModel.hh +++ b/src/EnergyPlus/SZVAVModel.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/ScheduleManager.cc b/src/EnergyPlus/ScheduleManager.cc index 83184a58b25..d376829f9c4 100644 --- a/src/EnergyPlus/ScheduleManager.cc +++ b/src/EnergyPlus/ScheduleManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -49,9 +49,6 @@ #include // ObjexxFCL Headers -#include -#include -#include #include // EnergyPlus Headers @@ -63,7 +60,7 @@ #include #include #include -#include +// #include #include #include #include @@ -74,7 +71,7 @@ namespace EnergyPlus { -namespace ScheduleManager { +namespace Sched { // Module containing the Schedule Manager routines // MODULE INFORMATION: @@ -94,56 +91,205 @@ namespace ScheduleManager { // Proposal for Schedule Manager in EnergyPlus (Rick Strand) // MODULE PARAMETER DEFINITIONS - static constexpr std::string_view BlankString; + int GetScheduleTypeNum(EnergyPlusData &state, std::string const &name) + { + auto const &s_sched = state.dataSched; + for (int i = 0; i < (int)s_sched->scheduleTypes.size(); ++i) + if (s_sched->scheduleTypes[i]->Name == name) return i; + return -1; + } + + Real64 ScheduleBase::getMinVal(EnergyPlusData &state) + { + if (!isMinMaxSet) setMinMaxVals(state); + return minVal; + } + + Real64 ScheduleBase::getMaxVal(EnergyPlusData &state) + { + if (!isMinMaxSet) setMinMaxVals(state); + return maxVal; + } + // Day types are 1-based for EMS and output and other uses, so add a dummy - constexpr std::array(DayType::Num)> dayTypeNames{"dummy", - "Sunday", - "Monday", - "Tuesday", - "Wednesday", - "Thursday", - "Friday", - "Saturday", - "Holiday", - "SummerDesignDay", - "WinterDesignDay", - "CustomDay1", - "CustomDay2"}; - - constexpr std::array(DayType::Num)> dayTypeNamesUC{"dummy", - "SUNDAY", - "MONDAY", - "TUESDAY", - "WEDNESDAY", - "THURSDAY", - "FRIDAY", - "SATURDAY", - "HOLIDAY", - "SUMMERDESIGNDAY", - "WINTERDESIGNDAY", - "CUSTOMDAY1", - "CUSTOMDAY2"}; - - int constexpr numScheduleTypeLimitUnitTypes = 14; - static constexpr std::array(numScheduleTypeLimitUnitTypes)> scheduleTypeLimitUnitTypes{"DIMENSIONLESS", - "TEMPERATURE", - "DELTATEMPERATURE", - "PRECIPITATIONRATE", - "ANGLE", - "CONVECTIONCOEFFICIENT", - "ACTIVITYLEVEL", - "VELOCITY", - "CAPACITY", - "POWER", - "AVAILABILITY", - "PERCENT", - "CONTROL", - "MODE"}; - - constexpr std::array(OutputReportLevel::Num)> outputScheduleReportLevelNames = {"Hourly", "Timestep"}; - constexpr std::array(OutputReportLevel::Num)> outputScheduleReportLevelNamesUC = {"HOURLY", "TIMESTEP"}; - constexpr std::array(ScheduleInterpolation::Num)> interpolationTypes = {"No", "Average", "Linear"}; - constexpr std::array(ScheduleInterpolation::Num)> interpolationTypesUC = {"NO", "AVERAGE", "LINEAR"}; + constexpr std::array dayTypeNames = {"Unused", + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + "Holiday", + "SummerDesignDay", + "WinterDesignDay", + "CustomDay1", + "CustomDay2"}; + + constexpr std::array dayTypeNamesUC = {"UNUSED", + "SUNDAY", + "MONDAY", + "TUESDAY", + "WEDNESDAY", + "THURSDAY", + "FRIDAY", + "SATURDAY", + "HOLIDAY", + "SUMMERDESIGNDAY", + "WINTERDESIGNDAY", + "CUSTOMDAY1", + "CUSTOMDAY2"}; + + static constexpr std::array limitUnitNamesUC = {"DIMENSIONLESS", + "TEMPERATURE", + "DELTATEMPERATURE", + "PRECIPITATIONRATE", + "ANGLE", + "CONVECTIONCOEFFICIENT", + "ACTIVITYLEVEL", + "VELOCITY", + "CAPACITY", + "POWER", + "AVAILABILITY", + "PERCENT", + "CONTROL", + "MODE"}; + + constexpr std::array reportLevelNames = {"Hourly", "Timestep"}; + constexpr std::array reportLevelNamesUC = {"HOURLY", "TIMESTEP"}; + constexpr std::array interpolationNames = {"No", "Average", "Linear"}; + constexpr std::array interpolationNamesUC = {"NO", "AVERAGE", "LINEAR"}; + + bool DaySchedule::checkValsForLimitViolations(EnergyPlusData &state) const + { + auto &s_sched = state.dataSched; + + if (this->schedTypeNum == SchedNum_Invalid) return false; + auto *schedType = s_sched->scheduleTypes[this->schedTypeNum]; + if (!schedType->isLimited) return false; + + for (int i = 0; i < Constant::iHoursInDay * state.dataGlobal->TimeStepsInHour; ++i) + if (this->tsVals[i] < schedType->minVal || this->tsVals[i] > schedType->maxVal) return true; + + return false; + } // ScheduleDay::checkValsForLimitViolations() + + bool DaySchedule::checkValsForBadIntegers(EnergyPlusData &state) const + { + auto &s_sched = state.dataSched; + if (this->schedTypeNum == SchedNum_Invalid) return false; + auto *schedType = s_sched->scheduleTypes[this->schedTypeNum]; + if (schedType->isReal) return false; + // Make sure each is integer + for (int i = 0; i < Constant::iHoursInDay * state.dataGlobal->TimeStepsInHour; ++i) + if (this->tsVals[i] != int(this->tsVals[i])) return true; + return false; + } // ScheduleDay::checkValsForBadIntegers() + + void DaySchedule::populateFromMinuteVals(EnergyPlusData &state, std::array const &minuteVals) + { + auto &s_glob = state.dataGlobal; + if (this->interpolation == Interpolation::Average) { + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) { + int begMin = 0; + int endMin = s_glob->MinutesInTimeStep - 1; + for (int ts = 0; ts < s_glob->TimeStepsInHour; ++ts) { + Real64 accum = 0.0; + for (int iMin = begMin; iMin <= endMin; ++iMin) { + accum += minuteVals[hr * Constant::iMinutesInHour + iMin]; + } + this->tsVals[hr * s_glob->TimeStepsInHour + ts] = accum / double(s_glob->MinutesInTimeStep); + this->sumTsVals += this->tsVals[hr * s_glob->TimeStepsInHour + ts]; + begMin = endMin + 1; + endMin += s_glob->MinutesInTimeStep; + } + } + } else { + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) { + int endMinute = s_glob->MinutesInTimeStep - 1; + for (int ts = 0; ts < s_glob->TimeStepsInHour; ++ts) { + this->tsVals[hr * s_glob->TimeStepsInHour + ts] = minuteVals[hr * Constant::iMinutesInHour + endMinute]; + this->sumTsVals += this->tsVals[hr * s_glob->TimeStepsInHour + ts]; + endMinute += s_glob->MinutesInTimeStep; + } + } + } + } // ScheduleDay::populateFromHrMinVals() + + ScheduleConstant *AddScheduleConstant(EnergyPlusData &state, std::string const &name) + { + auto const &s_sched = state.dataSched; + + auto *sched = new ScheduleConstant; + sched->Name = name; + sched->Num = (int)s_sched->schedules.size(); + s_sched->schedules.push_back(sched); + s_sched->scheduleMap.insert_or_assign(std::move(Util::makeUPPER(sched->Name)), sched->Num); + + sched->type = SchedType::Constant; + return sched; + } // AddScheduleConstant() + + ScheduleDetailed *AddScheduleDetailed(EnergyPlusData &state, std::string const &name) + { + auto const &s_sched = state.dataSched; + + auto *sched = new ScheduleDetailed; + sched->Name = name; + + sched->Num = (int)s_sched->schedules.size(); + s_sched->schedules.push_back(sched); + s_sched->scheduleMap.insert_or_assign(std::move(Util::makeUPPER(sched->Name)), sched->Num); + + sched->type = SchedType::Year; + return sched; + } // AddScheduleDetailed() + + DaySchedule *AddDaySchedule(EnergyPlusData &state, std::string const &name) + { + auto &s_glob = state.dataGlobal; + auto &s_sched = state.dataSched; + + auto *daySched = new DaySchedule; + daySched->Name = name; + + daySched->Num = (int)s_sched->daySchedules.size(); + s_sched->daySchedules.push_back(daySched); + s_sched->dayScheduleMap.insert_or_assign(std::move(Util::makeUPPER(daySched->Name)), daySched->Num); + + daySched->tsVals.resize(Constant::iHoursInDay * s_glob->TimeStepsInHour); + + return daySched; + } // AddDaySchedule() + + WeekSchedule *AddWeekSchedule(EnergyPlusData &state, std::string const &name) + { + auto const &s_sched = state.dataSched; + + auto *weekSched = new WeekSchedule; + weekSched->Name = name; + + weekSched->Num = (int)s_sched->weekSchedules.size(); + s_sched->weekSchedules.push_back(weekSched); + s_sched->weekScheduleMap.insert_or_assign(std::move(Util::makeUPPER(weekSched->Name)), weekSched->Num); + + return weekSched; + } // AddWeekSchedule() + + void InitConstantScheduleData(EnergyPlusData &state) + { + // Create ScheduleAlwaysOn and ScheduleAlwaysOff + // Create constant schedules + auto *schedOff = AddScheduleConstant(state, "Constant-0.0"); + assert(schedOff->Num == SchedNum_AlwaysOff); + schedOff->currentVal = 0.0; + schedOff->isUsed = true; // Suppress unused warnings + + auto *schedOn = AddScheduleConstant(state, "Constant-1.0"); + assert(schedOn->Num == SchedNum_AlwaysOn); + schedOn->currentVal = 1.0; + schedOn->isUsed = true; // Suppress unused warnings + } void ProcessScheduleInput(EnergyPlusData &state) { @@ -151,7 +297,6 @@ namespace ScheduleManager { // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 // MODIFIED Rui Zhang February 2010 - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine processes the schedules input for EnergyPlus. @@ -169,15 +314,10 @@ namespace ScheduleManager { // Locals // SUBROUTINE PARAMETER DEFINITIONS: - constexpr std::string_view RoutineName = "ProcessScheduleInput: "; + constexpr std::string_view routineName = "ProcessScheduleInput"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Array1D_int DaysInYear(366); - int LoopIndex; - int InLoopIndex; - int DayIndex; - int WeekIndex; Array1D_string Alphas; Array1D_string cAlphaFields; Array1D_string cNumericFields; @@ -187,59 +327,35 @@ namespace ScheduleManager { int NumAlphas; int NumNumbers; int Status; - int StartMonth; - int StartDay; + int EndMonth; int EndDay; int StartPointer; int EndPointer; int NumPointer; - int Count; - int CheckIndex; bool ErrorsFound(false); bool NumErrorFlag; - int SchedTypePtr; + std::string CFld; // Character field for error message // CHARACTER(len=20) CFld1 ! Character field for error message - int NumHrDaySchedules; // Number of "hourly" dayschedules - int NumIntDaySchedules; // Number of "interval" dayschedules - int NumExternalInterfaceSchedules; // Number of "PtolemyServer ExternalInterface" "compact" Schedules - int NumExternalInterfaceFunctionalMockupUnitImportSchedules; // Number of "FunctionalMockupUnitImport ExternalInterface" - // "compact" Schedules ! added for FMU Import - int NumExternalInterfaceFunctionalMockupUnitExportSchedules; // Number of "FunctionalMockupUnitExport ExternalInterface" - // "compact" Schedules ! added for FMU Export - int NumLstDaySchedules; // Number of "list" dayschedules - int NumRegDaySchedules; // Number of hourly+interval+list dayschedules - int NumRegWeekSchedules; // Number of "regular" Weekschedules - int NumRegSchedules; // Number of "regular" Schedules - int NumCptWeekSchedules; // Number of "compact" WeekSchedules - int NumCptSchedules; // Number of "compact" Schedules - int NumCommaFileSchedules; // Number of Schedule:File schedules - int NumConstantSchedules; // Number of "constant" schedules - int NumCSVAllColumnsSchedules = 0; // Number of imported shading schedules - int NumCommaFileShading; // Number of shading csv schedules - int TS; // Counter for Num Of Time Steps in Hour - int Hr; // Hour Counter - Array2D MinuteValue; // Temporary for processing interval schedules - Array2D_bool SetMinuteValue; // Temporary for processing interval schedules + + std::array minuteVals; + std::array setMinuteVals; + int NumFields; - int SCount; // LOGICAL RptSchedule + int RptLevel; - int CurMinute; int MinutesPerItem; int NumExpectedItems; - int MaxNums; - int MaxAlps; - int AddWeekSch; - int AddDaySch; - Array1D_bool AllDays(maxDayTypes); - Array1D_bool TheseDays(maxDayTypes); + std::array allDays; + std::array theseDays; bool ErrorHere; int SchNum; int WkCount; int DyCount; int NumField; + int Count; Weather::DateType PDateType; int PWeekDay; int ThruField; @@ -249,135 +365,128 @@ namespace ScheduleManager { std::string CurrentThrough; std::string LastFor; std::string errmsg; - int kdy; // for SCHEDULE:FILE int rowCnt; + std::string subString; - int iDay; - int hDay; - int jHour; - int kDayType; - Real64 curHrVal; - std::string::size_type sPos; - std::string CurrentModuleObject; // for ease in getting objects int MaxNums1; char ColumnSep; bool FileIntervalInterpolated; int rowLimitCount; int skiprowCount; int curcolCount; - int numHourlyValues; int numerrors = 0; - int ifld; - int hrLimitCount; - if (state.dataScheduleMgr->ScheduleInputProcessed) { + auto const &s_glob = state.dataGlobal; + auto const &s_ip = state.dataInputProcessing->inputProcessor; + auto const &s_sched = state.dataSched; + + if (s_sched->ScheduleInputProcessed) { return; } - state.dataScheduleMgr->ScheduleInputProcessed = true; - MaxNums = 1; // Need at least 1 number because it's used as a local variable in the Schedule Types loop - MaxAlps = 0; + s_sched->ScheduleInputProcessed = true; - CurrentModuleObject = "ScheduleTypeLimits"; - state.dataScheduleMgr->NumScheduleTypes = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); - if (state.dataScheduleMgr->NumScheduleTypes > 0) { - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); + int MaxNums = 1; // Need at least 1 number because it's used as a local variable in the Schedule Types loop + int MaxAlps = 0; + + std::string CurrentModuleObject = "ScheduleTypeLimits"; + int NumScheduleTypes = s_ip->getNumObjectsFound(state, CurrentModuleObject); + if (NumScheduleTypes > 0) { + s_ip->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); MaxNums = max(MaxNums, NumNumbers); MaxAlps = max(MaxAlps, NumAlphas); } CurrentModuleObject = "Schedule:Day:Hourly"; - NumHrDaySchedules = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int NumHrDaySchedules = s_ip->getNumObjectsFound(state, CurrentModuleObject); if (NumHrDaySchedules > 0) { - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); + s_ip->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); MaxNums = max(MaxNums, NumNumbers); MaxAlps = max(MaxAlps, NumAlphas); } CurrentModuleObject = "Schedule:Day:Interval"; - NumIntDaySchedules = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int NumIntDaySchedules = s_ip->getNumObjectsFound(state, CurrentModuleObject); if (NumIntDaySchedules > 0) { - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); + s_ip->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); MaxNums = max(MaxNums, NumNumbers); MaxAlps = max(MaxAlps, NumAlphas); } CurrentModuleObject = "Schedule:Day:List"; - NumLstDaySchedules = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int NumLstDaySchedules = s_ip->getNumObjectsFound(state, CurrentModuleObject); if (NumLstDaySchedules > 0) { - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); + s_ip->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); MaxNums = max(MaxNums, NumNumbers); MaxAlps = max(MaxAlps, NumAlphas); } CurrentModuleObject = "Schedule:Week:Daily"; - NumRegWeekSchedules = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int NumRegWeekSchedules = s_ip->getNumObjectsFound(state, CurrentModuleObject); if (NumRegWeekSchedules > 0) { - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); + s_ip->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); MaxNums = max(MaxNums, NumNumbers); MaxAlps = max(MaxAlps, NumAlphas); } CurrentModuleObject = "Schedule:Week:Compact"; - NumCptWeekSchedules = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int NumCptWeekSchedules = s_ip->getNumObjectsFound(state, CurrentModuleObject); if (NumCptWeekSchedules > 0) { - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); + s_ip->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); MaxNums = max(MaxNums, NumNumbers); MaxAlps = max(MaxAlps, NumAlphas); } CurrentModuleObject = "Schedule:Year"; - NumRegSchedules = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int NumRegSchedules = s_ip->getNumObjectsFound(state, CurrentModuleObject); if (NumRegSchedules > 0) { - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); + s_ip->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); MaxNums = max(MaxNums, NumNumbers); MaxAlps = max(MaxAlps, NumAlphas); } CurrentModuleObject = "Schedule:Compact"; - NumCptSchedules = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int NumCptSchedules = s_ip->getNumObjectsFound(state, CurrentModuleObject); if (NumCptSchedules > 0) { - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); + s_ip->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); MaxNums = max(MaxNums, NumNumbers); MaxAlps = max(MaxAlps, NumAlphas + 1); } CurrentModuleObject = "Schedule:File"; - NumCommaFileSchedules = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int NumCommaFileSchedules = s_ip->getNumObjectsFound(state, CurrentModuleObject); if (NumCommaFileSchedules > 0) { - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); + s_ip->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); MaxNums = max(MaxNums, NumNumbers); MaxAlps = max(MaxAlps, NumAlphas); } CurrentModuleObject = "Schedule:Constant"; - NumConstantSchedules = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int NumConstantSchedules = s_ip->getNumObjectsFound(state, CurrentModuleObject); if (NumConstantSchedules > 0) { - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); + s_ip->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); MaxNums = max(MaxNums, NumNumbers); MaxAlps = max(MaxAlps, NumAlphas); } CurrentModuleObject = "ExternalInterface:Schedule"; - NumExternalInterfaceSchedules = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int NumExternalInterfaceSchedules = s_ip->getNumObjectsFound(state, CurrentModuleObject); // added for FMI if (NumExternalInterfaceSchedules > 0) { - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); + s_ip->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); MaxNums = max(MaxNums, NumNumbers); MaxAlps = max(MaxAlps, NumAlphas + 1); } // added for FMU Import CurrentModuleObject = "ExternalInterface:FunctionalMockupUnitImport:To:Schedule"; - NumExternalInterfaceFunctionalMockupUnitImportSchedules = - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int NumExternalInterfaceFunctionalMockupUnitImportSchedules = s_ip->getNumObjectsFound(state, CurrentModuleObject); if (NumExternalInterfaceFunctionalMockupUnitImportSchedules > 0) { - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); + s_ip->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); MaxNums = max(MaxNums, NumNumbers); MaxAlps = max(MaxAlps, NumAlphas + 1); } // added for FMU Export CurrentModuleObject = "ExternalInterface:FunctionalMockupUnitExport:To:Schedule"; - NumExternalInterfaceFunctionalMockupUnitExportSchedules = - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int NumExternalInterfaceFunctionalMockupUnitExportSchedules = s_ip->getNumObjectsFound(state, CurrentModuleObject); if (NumExternalInterfaceFunctionalMockupUnitExportSchedules > 0) { - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); + s_ip->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); MaxNums = max(MaxNums, NumNumbers); MaxAlps = max(MaxAlps, NumAlphas + 1); } CurrentModuleObject = "Output:Schedules"; - state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); + s_ip->getObjectDefMaxArgs(state, CurrentModuleObject, Count, NumAlphas, NumNumbers); MaxNums = max(MaxNums, NumNumbers); MaxAlps = max(MaxAlps, NumAlphas); @@ -389,18 +498,14 @@ namespace ScheduleManager { lNumericBlanks.dimension(MaxNums, true); // Prescan to determine extra day and week schedules due to compact schedule input - AddWeekSch = 0; - AddDaySch = 0; CurrentModuleObject = "Schedule:Compact"; MaxNums1 = 0; - for (LoopIndex = 1; LoopIndex <= NumCptSchedules; ++LoopIndex) { - state.dataInputProcessing->inputProcessor->getObjectItem( - state, CurrentModuleObject, LoopIndex, Alphas, NumAlphas, Numbers, NumNumbers, Status); + + for (int LoopIndex = 1; LoopIndex <= NumCptSchedules; ++LoopIndex) { + s_ip->getObjectItem(state, CurrentModuleObject, LoopIndex, Alphas, NumAlphas, Numbers, NumNumbers, Status); // # 'THROUGH" => Number of additional week schedules // # 'FOR' => Number of additional day schedules for (Count = 3; Count <= NumAlphas; ++Count) { - if (has_prefix(Alphas(Count), "THROUGH")) ++AddWeekSch; - if (has_prefix(Alphas(Count), "FOR")) ++AddDaySch; if (has_prefix(Alphas(Count), "UNTIL")) ++MaxNums1; } } @@ -413,29 +518,11 @@ namespace ScheduleManager { Numbers.dimension(MaxNums, 0.0); // Maximum Numbers possible lNumericBlanks.dimension(MaxNums, true); } + // add week and day schedules for each FILE:COMMA schedule - AddWeekSch += NumCommaFileSchedules * 366; // number of days/year because need a week for each day - AddDaySch += NumCommaFileSchedules * 366; // number of days/year - AddWeekSch += NumConstantSchedules; - AddDaySch += NumConstantSchedules; - // add week and day schedules for each ExternalInterface:Schedule schedule - AddWeekSch += NumExternalInterfaceSchedules * 366; // number of days/year because need a week for each day - AddDaySch += NumExternalInterfaceSchedules; // one day schedule for ExternalInterface to update during run time - // added for FMU Import - // add week and day schedules for each ExternalInterface:FunctionalMockupUnitImport:Schedule - AddWeekSch += NumExternalInterfaceFunctionalMockupUnitImportSchedules * 366; // number of days/year - // because need a week for each day - AddDaySch += NumExternalInterfaceFunctionalMockupUnitImportSchedules; // one day schedule for ExternalInterface - // to update during run time - // added for FMU Export - // add week and day schedules for each ExternalInterface:FunctionalMockupUnitExport:Schedule - AddWeekSch += NumExternalInterfaceFunctionalMockupUnitExportSchedules * 366; // number of days/year - // because need a week for each day - AddDaySch += NumExternalInterfaceFunctionalMockupUnitExportSchedules; // one day schedule for ExternalInterface - // to update during run time CurrentModuleObject = "Schedule:File:Shading"; - NumCommaFileShading = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int NumCommaFileShading = s_ip->getNumObjectsFound(state, CurrentModuleObject); NumAlphas = 0; NumNumbers = 0; if (NumCommaFileShading > 1) { @@ -444,18 +531,18 @@ namespace ScheduleManager { std::map::iterator schedule_file_shading_result; if (NumCommaFileShading != 0) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - CurrentModuleObject, - 1, - Alphas, - NumAlphas, - Numbers, - NumNumbers, - Status, - lNumericBlanks, - lAlphaBlanks, - cAlphaFields, - cNumericFields); + s_ip->getObjectItem(state, + CurrentModuleObject, + 1, + Alphas, + NumAlphas, + Numbers, + NumNumbers, + Status, + lNumericBlanks, + lAlphaBlanks, + cAlphaFields, + cNumericFields); std::string ShadingSunlitFracFileName = Alphas(1); std::string contextString = CurrentModuleObject + ", " + cAlphaFields(1) + ": "; @@ -466,22 +553,22 @@ namespace ScheduleManager { } if (state.dataEnvrn->CurrentYearIsLeapYear) { - rowLimitCount = 366 * 24 * state.dataGlobal->NumOfTimeStepInHour; + rowLimitCount = 366 * Constant::iHoursInDay * s_glob->TimeStepsInHour; } else { - rowLimitCount = 365 * 24 * state.dataGlobal->NumOfTimeStepInHour; + rowLimitCount = 365 * Constant::iHoursInDay * s_glob->TimeStepsInHour; } ColumnSep = CharComma; - schedule_file_shading_result = state.dataScheduleMgr->UniqueProcessedExternalFiles.find(state.files.TempFullFilePath.filePath); - if (schedule_file_shading_result == state.dataScheduleMgr->UniqueProcessedExternalFiles.end()) { + schedule_file_shading_result = s_sched->UniqueProcessedExternalFiles.find(state.files.TempFullFilePath.filePath); + if (schedule_file_shading_result == s_sched->UniqueProcessedExternalFiles.end()) { FileSystem::FileTypes const ext = FileSystem::getFileType(state.files.TempFullFilePath.filePath); if (FileSystem::is_flat_file_type(ext)) { auto const schedule_data = FileSystem::readFile(state.files.TempFullFilePath.filePath); CsvParser csvParser; skiprowCount = 1; // make sure to parse header row only for Schedule:File:Shading - auto it = state.dataScheduleMgr->UniqueProcessedExternalFiles.emplace(state.files.TempFullFilePath.filePath, - csvParser.decode(schedule_data, ColumnSep, skiprowCount)); + auto it = s_sched->UniqueProcessedExternalFiles.emplace(state.files.TempFullFilePath.filePath, + csvParser.decode(schedule_data, ColumnSep, skiprowCount)); if (csvParser.hasErrors()) { for (const auto &[error, isContinued] : csvParser.errors()) { if (isContinued) { @@ -497,12 +584,12 @@ namespace ScheduleManager { } else if (FileSystem::is_all_json_type(ext)) { auto schedule_data = FileSystem::readJSON(state.files.TempFullFilePath.filePath); auto it = // (AUTO_OK_ITER) - state.dataScheduleMgr->UniqueProcessedExternalFiles.emplace(state.files.TempFullFilePath.filePath, std::move(schedule_data)); + s_sched->UniqueProcessedExternalFiles.emplace(state.files.TempFullFilePath.filePath, std::move(schedule_data)); schedule_file_shading_result = it.first; } else { ShowSevereError(state, - fmt::format(R"({}{}="{}", {}="{}" has an unknown file extension and cannot be read by this program.)", - RoutineName, + fmt::format(R"({}: {}="{}", {}="{}" has an unknown file extension and cannot be read by this program.)", + routineName, CurrentModuleObject, Alphas(1), cAlphaFields(3), @@ -513,13 +600,13 @@ namespace ScheduleManager { auto const &column_json = schedule_file_shading_result->second["values"].at(0); // assume there is at least 1 column rowCnt = column_json.size(); - NumCSVAllColumnsSchedules = + int NumCSVAllColumnsSchedules = schedule_file_shading_result->second["header"].get>().size() - 1; // -1 to account for timestamp column if (schedule_file_shading_result->second["header"].back().get() == "()") { ShowWarningError(state, - format("{}{}=\"{}\" Removing last column of the CSV since it has '()' for the surface name.", - RoutineName, + format("{}: {}=\"{}\" Removing last column of the CSV since it has '()' for the surface name.", + routineName, CurrentModuleObject, Alphas(1))); ShowContinueError(state, "This was a problem in E+ 22.2.0 and below, consider removing it from the file to suppress this warning."); @@ -530,9 +617,9 @@ namespace ScheduleManager { if (rowCnt != rowLimitCount) { if (rowCnt < rowLimitCount) { - ShowSevereError(state, format("{}{}=\"{}\" {} data values read.", RoutineName, CurrentModuleObject, Alphas(1), rowCnt)); + ShowSevereError(state, format("{}: {}=\"{}\" {} data values read.", routineName, CurrentModuleObject, Alphas(1), rowCnt)); } else if (rowCnt > rowLimitCount) { - ShowSevereError(state, format("{}{}=\"{}\" too many data values read.", RoutineName, CurrentModuleObject, Alphas(1))); + ShowSevereError(state, format("{}: {}=\"{}\" too many data values read.", routineName, CurrentModuleObject, Alphas(1))); } ShowContinueError( state, @@ -541,56 +628,19 @@ namespace ScheduleManager { } // schedule values have been filled into the CSVAllColumnNameAndValues map. - state.dataScheduleMgr->ScheduleFileShadingProcessed = true; + s_sched->ScheduleFileShadingProcessed = true; if (numerrors > 0) { ShowWarningError( state, - format("{}{}=\"{}\" {} records had errors - these values are set to 0.", RoutineName, CurrentModuleObject, Alphas(1), numerrors)); + format( + "{}:{}=\"{}\" {} records had errors - these values are set to 0.", routineName, CurrentModuleObject, Alphas(1), numerrors)); } } - // add week and day schedules for each ExternalInterface:FunctionalMockupUnitExport:Schedule - AddWeekSch += NumCSVAllColumnsSchedules * 366; // number of days/year - // because need a week for each day - AddDaySch += NumCSVAllColumnsSchedules * 366; - // to update during run time - - // include additional schedules in with count - NumRegDaySchedules = NumHrDaySchedules + NumIntDaySchedules + NumLstDaySchedules; - state.dataScheduleMgr->NumDaySchedules = NumRegDaySchedules + AddDaySch; - state.dataScheduleMgr->NumWeekSchedules = NumRegWeekSchedules + NumCptWeekSchedules + AddWeekSch; - state.dataScheduleMgr->NumSchedules = NumRegSchedules + NumCptSchedules + NumCommaFileSchedules + NumConstantSchedules + - NumExternalInterfaceSchedules + NumExternalInterfaceFunctionalMockupUnitImportSchedules + - NumExternalInterfaceFunctionalMockupUnitExportSchedules + NumCSVAllColumnsSchedules; - //! Most initializations in the schedule data structures are taken care of in //! the definitions (see above) - state.dataScheduleMgr->ScheduleType.allocate({0, state.dataScheduleMgr->NumScheduleTypes}); - - state.dataScheduleMgr->DaySchedule.allocate({0, state.dataScheduleMgr->NumDaySchedules}); - state.dataScheduleMgr->UniqueDayScheduleNames.reserve(static_cast(state.dataScheduleMgr->NumDaySchedules)); - // Initialize - for (LoopIndex = 0; LoopIndex <= state.dataScheduleMgr->NumDaySchedules; ++LoopIndex) { - state.dataScheduleMgr->DaySchedule(LoopIndex).TSValue.allocate(state.dataGlobal->NumOfTimeStepInHour, 24); - for (Count = 1; Count <= 24; ++Count) { - for (TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { - state.dataScheduleMgr->DaySchedule(LoopIndex).TSValue(TS, Count) = 0.0; - } - } - } - - state.dataScheduleMgr->WeekSchedule.allocate({0, state.dataScheduleMgr->NumWeekSchedules}); - state.dataScheduleMgr->UniqueWeekScheduleNames.reserve(static_cast(state.dataScheduleMgr->NumWeekSchedules)); - - state.dataScheduleMgr->Schedule.allocate({-1, state.dataScheduleMgr->NumSchedules}); - state.dataScheduleMgr->UniqueScheduleNames.reserve(static_cast(state.dataScheduleMgr->NumSchedules)); - state.dataScheduleMgr->Schedule(-1).ScheduleTypePtr = -1; - state.dataScheduleMgr->Schedule(-1).WeekSchedulePointer = 1; - state.dataScheduleMgr->Schedule(0).ScheduleTypePtr = 0; - state.dataScheduleMgr->Schedule(0).WeekSchedulePointer = 0; - print(state.files.audit.ensure_open(state, "ProcessScheduleInput", state.files.outputControl.audit), "{}\n", " Processing Schedule Input -- Start"); @@ -598,88 +648,74 @@ namespace ScheduleManager { //!! Get Schedule Types CurrentModuleObject = "ScheduleTypeLimits"; - for (LoopIndex = 1; LoopIndex <= state.dataScheduleMgr->NumScheduleTypes; ++LoopIndex) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - CurrentModuleObject, - LoopIndex, - Alphas, - NumAlphas, - Numbers, - NumNumbers, - Status, - lNumericBlanks, - lAlphaBlanks, - cAlphaFields, - cNumericFields); - Util::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound); - - state.dataScheduleMgr->ScheduleType(LoopIndex).Name = Alphas(1); - if (lNumericBlanks(1) || lNumericBlanks(2)) { - state.dataScheduleMgr->ScheduleType(LoopIndex).Limited = false; - } else if (!lNumericBlanks(1) && !lNumericBlanks(2)) { - state.dataScheduleMgr->ScheduleType(LoopIndex).Limited = true; + for (int Loop = 1; Loop <= NumScheduleTypes; ++Loop) { + s_ip->getObjectItem(state, + CurrentModuleObject, + Loop, + Alphas, + NumAlphas, + Numbers, + NumNumbers, + Status, + lNumericBlanks, + lAlphaBlanks, + cAlphaFields, + cNumericFields); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + + if (s_sched->scheduleTypeMap.find(Alphas(1)) != s_sched->scheduleTypeMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; + continue; } + + auto *schedType = new ScheduleType; + schedType->Name = Alphas(1); + + schedType->Num = (int)s_sched->scheduleTypes.size(); + s_sched->scheduleTypes.push_back(schedType); + s_sched->scheduleTypeMap.insert_or_assign(schedType->Name, schedType->Num); + + schedType->isLimited = !lNumericBlanks(1) && !lNumericBlanks(2); + if (!lNumericBlanks(1)) { - state.dataScheduleMgr->ScheduleType(LoopIndex).Minimum = Numbers(1); + schedType->minVal = Numbers(1); } if (!lNumericBlanks(2)) { - state.dataScheduleMgr->ScheduleType(LoopIndex).Maximum = Numbers(2); + schedType->maxVal = Numbers(2); } - if (state.dataScheduleMgr->ScheduleType(LoopIndex).Limited) { + + if (schedType->isLimited) { if (Alphas(2) == "DISCRETE" || Alphas(2) == "INTEGER") { - state.dataScheduleMgr->ScheduleType(LoopIndex).IsReal = false; + schedType->isReal = false; + } else if (Alphas(2) == "CONTINUOUS" || Alphas(2) == "REAL") { + schedType->isReal = true; } else { - if (Alphas(2) != "CONTINUOUS" && Alphas(2) != "REAL") { - ShowWarningError(state, - format("{}{}=\"{}\", invalid {}={}", - RoutineName, - CurrentModuleObject, - state.dataScheduleMgr->ScheduleType(LoopIndex).Name, - cAlphaFields(2), - Alphas(2))); - ErrorsFound = true; - } - state.dataScheduleMgr->ScheduleType(LoopIndex).IsReal = true; + ShowSevereInvalidKey(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } } - if (NumAlphas >= 3) { - if (!lAlphaBlanks(3)) { - state.dataScheduleMgr->ScheduleType(LoopIndex).UnitType = getEnumValue(scheduleTypeLimitUnitTypes, Alphas(3)) + 1; - if (state.dataScheduleMgr->ScheduleType(LoopIndex).UnitType == 0) { - ShowWarningError( - state, - format("{}{}=\"{}\", {}=\"{}\" is invalid.", RoutineName, CurrentModuleObject, Alphas(1), cAlphaFields(3), Alphas(3))); - } + + if (NumAlphas >= 3 && !lAlphaBlanks(3)) { + schedType->limitUnits = static_cast(getEnumValue(limitUnitNamesUC, Alphas(3))); + if (schedType->limitUnits == LimitUnits::Invalid) { + ShowSevereInvalidKey(state, eoh, cAlphaFields(3), Alphas(3)); + ErrorsFound = true; } } - if (state.dataScheduleMgr->ScheduleType(LoopIndex).Limited) { - if (state.dataScheduleMgr->ScheduleType(LoopIndex).Minimum > state.dataScheduleMgr->ScheduleType(LoopIndex).Maximum) { - if (state.dataScheduleMgr->ScheduleType(LoopIndex).IsReal) { - ShowSevereError(state, - format("{}{}=\"{}\", {} [{:.2R}] > {} [{:.2R}].", - RoutineName, - CurrentModuleObject, - Alphas(1), - cNumericFields(1), - state.dataScheduleMgr->ScheduleType(LoopIndex).Minimum, - cNumericFields(2), - state.dataScheduleMgr->ScheduleType(LoopIndex).Maximum)); - ShowContinueError(state, " Other warning/severes about schedule values may appear."); - } else { - ShowSevereError(state, - format("{}{}=\"{}\", {} [{:.0R}] > {} [{:.0R}].", - RoutineName, - CurrentModuleObject, - Alphas(1), - cNumericFields(1), - state.dataScheduleMgr->ScheduleType(LoopIndex).Minimum, - cNumericFields(2), - state.dataScheduleMgr->ScheduleType(LoopIndex).Maximum)); - ShowContinueError(state, " Other warning/severes about schedule values may appear."); - } + + if (schedType->isLimited && schedType->minVal > schedType->maxVal) { + if (schedType->isReal) { + ShowSevereCustom( + state, eoh, format("{} [{:.2R}] > {} [{:.2R}].", cNumericFields(1), schedType->minVal, cNumericFields(2), schedType->maxVal)); + } else { + ShowSevereCustom( + state, eoh, format("{} [{:.0R}] > {} [{:.0R}].", cNumericFields(1), schedType->minVal, cNumericFields(2), schedType->maxVal)); } + ShowContinueError(state, " Other warning/severes about schedule values may appear."); } - } + } // for (Loop) //!! Get Day Schedules (all types) @@ -687,475 +723,340 @@ namespace ScheduleManager { Count = 0; CurrentModuleObject = "Schedule:Day:Hourly"; - for (LoopIndex = 1; LoopIndex <= NumHrDaySchedules; ++LoopIndex) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - CurrentModuleObject, - LoopIndex, - Alphas, - NumAlphas, - Numbers, - NumNumbers, - Status, - lNumericBlanks, - lAlphaBlanks, - cAlphaFields, - cNumericFields); - GlobalNames::VerifyUniqueInterObjectName( - state, state.dataScheduleMgr->UniqueDayScheduleNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - ++Count; - state.dataScheduleMgr->DaySchedule(Count).Name = Alphas(1); - // Validate ScheduleType - if (state.dataScheduleMgr->NumScheduleTypes > 0) { - CheckIndex = Util::FindItemInList(Alphas(2), state.dataScheduleMgr->ScheduleType({1, state.dataScheduleMgr->NumScheduleTypes})); - if (CheckIndex == 0) { - if (!lAlphaBlanks(2)) { - ShowWarningError(state, - format("{}{}=\"{}\", {}=\"{}\" not found -- will not be validated", - RoutineName, - CurrentModuleObject, - Alphas(1), - cAlphaFields(2), - Alphas(2))); - } else { - ShowWarningError(state, - format("{}{}=\"{}\", Blank {} input -- will not be validated.", - RoutineName, - CurrentModuleObject, - Alphas(1), - cAlphaFields(2))); - } - } else { - state.dataScheduleMgr->DaySchedule(Count).ScheduleTypePtr = CheckIndex; - } + for (int Loop = 1; Loop <= NumHrDaySchedules; ++Loop) { + s_ip->getObjectItem(state, + CurrentModuleObject, + Loop, + Alphas, + NumAlphas, + Numbers, + NumNumbers, + Status, + lNumericBlanks, + lAlphaBlanks, + cAlphaFields, + cNumericFields); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + + if (s_sched->dayScheduleMap.find(Alphas(1)) != s_sched->dayScheduleMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; + continue; } - for (Hr = 1; Hr <= 24; ++Hr) { - state.dataScheduleMgr->DaySchedule(Count).TSValue({1, state.dataGlobal->NumOfTimeStepInHour}, Hr) = Numbers(Hr); + + auto *daySched = AddDaySchedule(state, Alphas(1)); + + // Validate ScheduleType + if (lAlphaBlanks(2)) { + ShowWarningEmptyField(state, eoh, cAlphaFields(2)); + ShowContinueError(state, "Schedule will not be validated."); + } else if ((daySched->schedTypeNum = GetScheduleTypeNum(state, Alphas(2))) == SchedNum_Invalid) { + ShowWarningItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ShowContinueError(state, "Schedule will not be validated."); } - state.dataScheduleMgr->DaySchedule(Count).IntervalInterpolated = ScheduleInterpolation::No; - SchedTypePtr = state.dataScheduleMgr->DaySchedule(Count).ScheduleTypePtr; - if (state.dataScheduleMgr->ScheduleType(SchedTypePtr).Limited) { - if (any_lt(state.dataScheduleMgr->DaySchedule(Count).TSValue, state.dataScheduleMgr->ScheduleType(SchedTypePtr).Minimum) || - any_gt(state.dataScheduleMgr->DaySchedule(Count).TSValue, state.dataScheduleMgr->ScheduleType(SchedTypePtr).Maximum)) { - ShowWarningError(state, - format("{}{}=\"{}\", Values are outside of range for {}={}", - RoutineName, - CurrentModuleObject, - Alphas(1), - cAlphaFields(2), - Alphas(2))); + + daySched->interpolation = Interpolation::No; + + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) { + for (int ts = 0; ts < s_glob->TimeStepsInHour; ++ts) { + daySched->tsVals[hr * s_glob->TimeStepsInHour + ts] = Numbers(hr + 1); + daySched->sumTsVals += daySched->tsVals[hr * s_glob->TimeStepsInHour + ts]; } } - if (!state.dataScheduleMgr->ScheduleType(SchedTypePtr).IsReal) { - // Make sure each is integer - NumErrorFlag = false; // only show error message once - for (Hr = 1; Hr <= 24; ++Hr) { - for (TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { - if (state.dataScheduleMgr->DaySchedule(Count).TSValue(TS, Hr) != - int(state.dataScheduleMgr->DaySchedule(Count).TSValue(TS, Hr))) { - if (!NumErrorFlag) { - ShowWarningError(state, - format("{}{}=\"{}\", One or more values are not integer as required by {}={}", - RoutineName, - CurrentModuleObject, - Alphas(1), - cAlphaFields(2), - Alphas(2))); - NumErrorFlag = true; - } - } - } - } + + if (daySched->checkValsForLimitViolations(state)) { + ShowWarningCustom(state, eoh, format("Values are outside of range for {}={}", cAlphaFields(2), Alphas(2))); + } + + if (daySched->checkValsForBadIntegers(state)) { + ShowWarningCustom(state, eoh, format("One or more values are not integer in {}={}", cAlphaFields(2), Alphas(2))); } - } - MinuteValue.allocate(60, 24); - SetMinuteValue.allocate(60, 24); + } // for (Loop) //!! Get "DaySchedule:Interval" CurrentModuleObject = "Schedule:Day:Interval"; - for (LoopIndex = 1; LoopIndex <= NumIntDaySchedules; ++LoopIndex) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - CurrentModuleObject, - LoopIndex, - Alphas, - NumAlphas, - Numbers, - NumNumbers, - Status, - lNumericBlanks, - lAlphaBlanks, - cAlphaFields, - cNumericFields); - GlobalNames::VerifyUniqueInterObjectName( - state, state.dataScheduleMgr->UniqueDayScheduleNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - ++Count; - state.dataScheduleMgr->DaySchedule(Count).Name = Alphas(1); + for (int Loop = 1; Loop <= NumIntDaySchedules; ++Loop) { + s_ip->getObjectItem(state, + CurrentModuleObject, + Loop, + Alphas, + NumAlphas, + Numbers, + NumNumbers, + Status, + lNumericBlanks, + lAlphaBlanks, + cAlphaFields, + cNumericFields); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + + if (s_sched->dayScheduleMap.find(Alphas(1)) != s_sched->dayScheduleMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; + continue; + } + + auto *daySched = AddDaySchedule(state, Alphas(1)); + // Validate ScheduleType - if (state.dataScheduleMgr->NumScheduleTypes > 0) { - CheckIndex = Util::FindItemInList(Alphas(2), state.dataScheduleMgr->ScheduleType({1, state.dataScheduleMgr->NumScheduleTypes})); - if (CheckIndex == 0) { - if (!lAlphaBlanks(2)) { - ShowWarningError(state, - format("{}{}=\"{}\", {}=\"{}\" not found -- will not be validated", - RoutineName, - CurrentModuleObject, - Alphas(1), - cAlphaFields(2), - Alphas(2))); - } else { - ShowWarningError(state, - format("{}{}=\"{}\", Blank {} input -- will not be validated.", - RoutineName, - CurrentModuleObject, - Alphas(1), - cAlphaFields(2))); - } - } else { - state.dataScheduleMgr->DaySchedule(Count).ScheduleTypePtr = CheckIndex; - } + if (lAlphaBlanks(2)) { + ShowWarningEmptyField(state, eoh, cAlphaFields(2)); + ShowContinueError(state, "Schedule will not be validated."); + } else if ((daySched->schedTypeNum = GetScheduleTypeNum(state, Alphas(2))) == SchedNum_Invalid) { + ShowWarningItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ShowContinueError(state, "Schedule will not be validated."); } + NumFields = NumAlphas - 3; // check to see if numfield=0 if (NumFields == 0) { - ShowSevereError( - state, format("{}{}=\"{}\", Insufficient data entered for a full schedule day.", RoutineName, CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("...Number of interval fields = = [{}].", NumFields)); + ShowSevereCustom(state, + eoh, + format("Insufficient data entered for a full schedule day." + "Number of interval fields == [{}].", + NumFields)); ErrorsFound = true; } // Depending on value of "Interpolate" field, the value for each time step in each hour gets processed: - state.dataScheduleMgr->DaySchedule(Count).IntervalInterpolated = - static_cast(getEnumValue(interpolationTypesUC, Alphas(3))); - if (state.dataScheduleMgr->DaySchedule(Count).IntervalInterpolated == ScheduleInterpolation::Invalid) { - ShowSevereError( - state, - format( - "{}{}=\"{}Invalid value for \"{}\" field=\"{}\"", RoutineName, CurrentModuleObject, Alphas(1), cAlphaFields(3), Alphas(3))); + daySched->interpolation = static_cast(getEnumValue(interpolationNamesUC, Alphas(3))); + if (daySched->interpolation == Interpolation::Invalid) { + ShowSevereInvalidKey(state, eoh, cAlphaFields(3), Alphas(3)); ErrorsFound = true; } + ProcessIntervalFields(state, Alphas({4, _}), Numbers, NumFields, NumNumbers, - MinuteValue, - SetMinuteValue, + minuteVals, + setMinuteVals, ErrorsFound, Alphas(1), CurrentModuleObject, - state.dataScheduleMgr->DaySchedule(Count).IntervalInterpolated); - if (state.dataScheduleMgr->DaySchedule(Count).IntervalInterpolated == ScheduleInterpolation::Average) { - for (Hr = 1; Hr <= 24; ++Hr) { - SCount = 1; - CurMinute = state.dataGlobal->MinutesPerTimeStep; - for (TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { - state.dataScheduleMgr->DaySchedule(Count).TSValue(TS, Hr) = - sum(MinuteValue({SCount, CurMinute}, Hr)) / double(state.dataGlobal->MinutesPerTimeStep); - SCount = CurMinute + 1; - CurMinute += state.dataGlobal->MinutesPerTimeStep; - } - } - } else { - for (Hr = 1; Hr <= 24; ++Hr) { - CurMinute = state.dataGlobal->MinutesPerTimeStep; - for (TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { - state.dataScheduleMgr->DaySchedule(Count).TSValue(TS, Hr) = MinuteValue(CurMinute, Hr); - CurMinute += state.dataGlobal->MinutesPerTimeStep; - } - } + daySched->interpolation); + + // Now parcel into TS Value.... tsVals.resize() was called in AddDaySchedule() + daySched->populateFromMinuteVals(state, minuteVals); + + if (daySched->checkValsForLimitViolations(state)) { + ShowWarningCustom(state, eoh, format("Values are outside of range for {}={}", cAlphaFields(2), Alphas(2))); } - SchedTypePtr = state.dataScheduleMgr->DaySchedule(Count).ScheduleTypePtr; - if (!state.dataScheduleMgr->ScheduleType(SchedTypePtr).IsReal) { - // Make sure each is integer - NumErrorFlag = false; // only show error message once - for (Hr = 1; Hr <= 24; ++Hr) { - for (TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { - if (state.dataScheduleMgr->DaySchedule(Count).TSValue(TS, Hr) != - int(state.dataScheduleMgr->DaySchedule(Count).TSValue(TS, Hr))) { - if (!NumErrorFlag) { - ShowWarningError(state, - format("{}{}=\"{}\", , One or more values are not integer as required by {}={}", - RoutineName, - CurrentModuleObject, - Alphas(1), - cAlphaFields(2), - Alphas(2))); - NumErrorFlag = true; - } - } - } - } + if (daySched->checkValsForBadIntegers(state)) { + ShowWarningCustom(state, eoh, format("One or more values are not integer in {}={}", cAlphaFields(2), Alphas(2))); } } //!! Get "DaySchedule:List" CurrentModuleObject = "Schedule:Day:List"; - for (LoopIndex = 1; LoopIndex <= NumLstDaySchedules; ++LoopIndex) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - CurrentModuleObject, - LoopIndex, - Alphas, - NumAlphas, - Numbers, - NumNumbers, - Status, - lNumericBlanks, - lAlphaBlanks, - cAlphaFields, - cNumericFields); - GlobalNames::VerifyUniqueInterObjectName( - state, state.dataScheduleMgr->UniqueDayScheduleNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - ++Count; - state.dataScheduleMgr->DaySchedule(Count).Name = Alphas(1); + for (int Loop = 1; Loop <= NumLstDaySchedules; ++Loop) { + s_ip->getObjectItem(state, + CurrentModuleObject, + Loop, + Alphas, + NumAlphas, + Numbers, + NumNumbers, + Status, + lNumericBlanks, + lAlphaBlanks, + cAlphaFields, + cNumericFields); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + + if (s_sched->dayScheduleMap.find(Alphas(1)) != s_sched->dayScheduleMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; + continue; + } + + auto *daySched = AddDaySchedule(state, Alphas(1)); + // Validate ScheduleType - if (state.dataScheduleMgr->NumScheduleTypes > 0) { - CheckIndex = Util::FindItemInList(Alphas(2), state.dataScheduleMgr->ScheduleType({1, state.dataScheduleMgr->NumScheduleTypes})); - if (CheckIndex == 0) { - if (!lAlphaBlanks(2)) { - ShowWarningError(state, - format("{}{}=\"{}\", {}=\"{}\" not found -- will not be validated", - RoutineName, - CurrentModuleObject, - Alphas(1), - cAlphaFields(2), - Alphas(2))); - } else { - ShowWarningError(state, - format("{}{}=\"{}\", Blank {} input -- will not be validated.", - RoutineName, - CurrentModuleObject, - Alphas(1), - cAlphaFields(2))); - } - } else { - state.dataScheduleMgr->DaySchedule(Count).ScheduleTypePtr = CheckIndex; - } + if (lAlphaBlanks(2)) { + ShowWarningEmptyField(state, eoh, cAlphaFields(2)); + ShowContinueError(state, "Schedule will not be validated."); + } else if ((daySched->schedTypeNum = GetScheduleTypeNum(state, Alphas(2))) == SchedNum_Invalid) { + ShowWarningItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ShowContinueError(state, "Schedule will not be validated."); } // Depending on value of "Interpolate" field, the value for each time step in each hour gets processed: - if (Util::SameString(Alphas(3), "NO")) { - state.dataScheduleMgr->DaySchedule(Count).IntervalInterpolated = ScheduleInterpolation::No; - } else if (Util::SameString(Alphas(3), "AVERAGE")) { - state.dataScheduleMgr->DaySchedule(Count).IntervalInterpolated = ScheduleInterpolation::Average; - } else if (Util::SameString(Alphas(3), "LINEAR")) { - state.dataScheduleMgr->DaySchedule(Count).IntervalInterpolated = ScheduleInterpolation::Linear; - } else { - ShowSevereError( - state, - format( - "{}{}=\"{}Invalid value for \"{}\" field=\"{}\"", RoutineName, CurrentModuleObject, Alphas(1), cAlphaFields(3), Alphas(3))); - ErrorsFound = true; - } + daySched->interpolation = static_cast(getEnumValue(interpolationNamesUC, Alphas(3))); // check to see if there are any fields if (Numbers(1) <= 0.0) { - ShowSevereError( - state, format("{}{}=\"{}\", Insufficient data entered for a full schedule day.", RoutineName, CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("...Minutes per Item field = [{}].", Numbers(1))); + ShowSevereCustom(state, + eoh, + format("Insufficient data entered for a full schedule day." + "...Minutes per Item field = [{}].", + Numbers(1))); ErrorsFound = true; continue; } if (NumNumbers < 25) { - ShowSevereError( - state, format("{}{}=\"{}\", Insufficient data entered for a full schedule day.", RoutineName, CurrentModuleObject, Alphas(1))); - ShowContinueError(state, - format("...Minutes per Item field = [{}] and only [{}] to apply to list fields.", Numbers(1), NumNumbers - 1)); + ShowSevereCustom(state, + eoh, + format("Insufficient data entered for a full schedule day." + "...Minutes per Item field = [{}] and only [{}] to apply to list fields.", + Numbers(1), + NumNumbers - 1)); ErrorsFound = true; continue; } + MinutesPerItem = int(Numbers(1)); NumExpectedItems = 1440 / MinutesPerItem; if ((NumNumbers - 1) != NumExpectedItems) { - ShowSevereError(state, - format("{}{}=\"{}, Number of Entered Items={}", - RoutineName, - CurrentModuleObject, - Alphas(1), - format("{} not equal number of expected items={}", NumNumbers - 1, NumExpectedItems))); - ShowContinueError(state, format("based on {} field value={}", cNumericFields(1), MinutesPerItem)); + ShowSevereCustom(state, + eoh, + format("Number of Entered Items={} not equal number of expected items={}" + "based on {}={}", + NumNumbers - 1, + NumExpectedItems, + cNumericFields(1), + MinutesPerItem)); ErrorsFound = true; continue; } - if (mod(60, MinutesPerItem) != 0) { - ShowSevereError(state, format("{}{}=\"{}", RoutineName, CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("Requested {} field value ({}) not evenly divisible into 60", cNumericFields(1), MinutesPerItem)); + if (mod(Constant::iMinutesInHour, MinutesPerItem) != 0) { + ShowSevereCustom(state, eoh, format("{}={} not evenly divisible into 60", cNumericFields(1), MinutesPerItem)); ErrorsFound = true; continue; } // Number of numbers in the Numbers list okay to process - Hr = 1; - CurMinute = MinutesPerItem; - SCount = 1; - for (NumFields = 2; NumFields <= NumNumbers; ++NumFields) { - MinuteValue({SCount, CurMinute}, Hr) = Numbers(NumFields); - SCount = CurMinute + 1; - CurMinute += MinutesPerItem; - if (CurMinute > 60) { - CurMinute = MinutesPerItem; - SCount = 1; - ++Hr; + int hr = 0; + int begMin = 0; + int endMin = MinutesPerItem - 1; + for (int NumFields = 2; NumFields <= NumNumbers; ++NumFields) { + for (int iMin = begMin; iMin <= endMin; ++iMin) { + minuteVals[hr * Constant::iMinutesInHour + iMin] = Numbers(NumFields); + } + begMin = endMin + 1; + endMin += MinutesPerItem; + if (endMin >= Constant::iMinutesInHour) { + endMin = MinutesPerItem - 1; + begMin = 0; + ++hr; } } - // Now parcel into TS Value.... + // Now parcel into TS Value.... tsVals.resize() was called in AddDaySchedule() + daySched->populateFromMinuteVals(state, minuteVals); - if (state.dataScheduleMgr->DaySchedule(Count).IntervalInterpolated == ScheduleInterpolation::Average) { - for (Hr = 1; Hr <= 24; ++Hr) { - SCount = 1; - CurMinute = state.dataGlobal->MinutesPerTimeStep; - for (TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { - state.dataScheduleMgr->DaySchedule(Count).TSValue(TS, Hr) = - sum(MinuteValue({SCount, CurMinute}, Hr)) / double(state.dataGlobal->MinutesPerTimeStep); - SCount = CurMinute + 1; - CurMinute += state.dataGlobal->MinutesPerTimeStep; - } - } - } else { - for (Hr = 1; Hr <= 24; ++Hr) { - CurMinute = state.dataGlobal->MinutesPerTimeStep; - for (TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { - state.dataScheduleMgr->DaySchedule(Count).TSValue(TS, Hr) = MinuteValue(CurMinute, Hr); - CurMinute += state.dataGlobal->MinutesPerTimeStep; - } - } + if (daySched->checkValsForLimitViolations(state)) { + ShowWarningCustom(state, eoh, format("Values are outside of range for {}={}", cAlphaFields(2), Alphas(2))); } - SchedTypePtr = state.dataScheduleMgr->DaySchedule(Count).ScheduleTypePtr; - if (state.dataScheduleMgr->ScheduleType(SchedTypePtr).Limited) { - if (any_lt(state.dataScheduleMgr->DaySchedule(Count).TSValue, state.dataScheduleMgr->ScheduleType(SchedTypePtr).Minimum) || - any_gt(state.dataScheduleMgr->DaySchedule(Count).TSValue, state.dataScheduleMgr->ScheduleType(SchedTypePtr).Maximum)) { - ShowWarningError(state, - format("{}{}=\"{}\", Values are outside of range for {}={}", - RoutineName, - CurrentModuleObject, - Alphas(1), - cAlphaFields(2), - Alphas(2))); - } - } - if (!state.dataScheduleMgr->ScheduleType(SchedTypePtr).IsReal) { - // Make sure each is integer - NumErrorFlag = false; // only show error message once - for (Hr = 1; Hr <= 24; ++Hr) { - for (TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { - if (state.dataScheduleMgr->DaySchedule(Count).TSValue(TS, Hr) != - int(state.dataScheduleMgr->DaySchedule(Count).TSValue(TS, Hr))) { - if (!NumErrorFlag) { - ShowWarningError(state, - format("{}{}=\"{}\", , One or more values are not integer as required by {}={}", - RoutineName, - CurrentModuleObject, - Alphas(1), - cAlphaFields(2), - Alphas(2))); - NumErrorFlag = true; - } - } - } - } + if (daySched->checkValsForBadIntegers(state)) { + ShowWarningCustom(state, eoh, format("One or more values are not integer for {}={}", cAlphaFields(2), Alphas(2))); } } //!! Get Week Schedules - regular CurrentModuleObject = "Schedule:Week:Daily"; - for (LoopIndex = 1; LoopIndex <= NumRegWeekSchedules; ++LoopIndex) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - CurrentModuleObject, - LoopIndex, - Alphas, - NumAlphas, - Numbers, - NumNumbers, - Status, - lNumericBlanks, - lAlphaBlanks, - cAlphaFields, - cNumericFields); - GlobalNames::VerifyUniqueInterObjectName( - state, state.dataScheduleMgr->UniqueWeekScheduleNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - state.dataScheduleMgr->WeekSchedule(LoopIndex).Name = Alphas(1); - // Rest of Alphas are processed into Pointers - for (InLoopIndex = 1; InLoopIndex <= maxDayTypes; ++InLoopIndex) { - DayIndex = Util::FindItemInList(Alphas(InLoopIndex + 1), state.dataScheduleMgr->DaySchedule({1, NumRegDaySchedules})); - if (DayIndex == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", {} \"{}\" not Found", - RoutineName, - CurrentModuleObject, - Alphas(1), - cAlphaFields(InLoopIndex + 1), - Alphas(InLoopIndex + 1)), - OptionalOutputFileRef{state.files.audit}); + for (int Loop = 1; Loop <= NumRegWeekSchedules; ++Loop) { + s_ip->getObjectItem(state, + CurrentModuleObject, + Loop, + Alphas, + NumAlphas, + Numbers, + NumNumbers, + Status, + lNumericBlanks, + lAlphaBlanks, + cAlphaFields, + cNumericFields); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + + if (s_sched->weekScheduleMap.find(Alphas(1)) != s_sched->weekScheduleMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; + continue; + } + + auto *weekSched = AddWeekSchedule(state, Alphas(1)); + + // Rest of Alphas are processed into schedule nums + for (int iDayType = 1; iDayType < (int)DayType::Num; ++iDayType) { + if ((weekSched->dayScheds[iDayType] = GetDaySchedule(state, Alphas(iDayType + 1))) == nullptr) { + ShowSevereItemNotFoundAudit(state, eoh, cAlphaFields(iDayType + 1), Alphas(iDayType + 1)); ErrorsFound = true; - } else { - state.dataScheduleMgr->WeekSchedule(LoopIndex).DaySchedulePointer(InLoopIndex) = DayIndex; } - } + } // for (iDayType) } //!! Get Week Schedules - compact Count = NumRegWeekSchedules; CurrentModuleObject = "Schedule:Week:Compact"; - for (LoopIndex = 1; LoopIndex <= NumCptWeekSchedules; ++LoopIndex) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - CurrentModuleObject, - LoopIndex, - Alphas, - NumAlphas, - Numbers, - NumNumbers, - Status, - lNumericBlanks, - lAlphaBlanks, - cAlphaFields, - cNumericFields); - if (Count > 0) { - GlobalNames::VerifyUniqueInterObjectName( - state, state.dataScheduleMgr->UniqueWeekScheduleNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - } - ++Count; - state.dataScheduleMgr->WeekSchedule(Count).Name = Alphas(1); - AllDays = false; - // Rest of Alphas are processed into Pointers - for (InLoopIndex = 2; InLoopIndex <= NumAlphas; InLoopIndex += 2) { - DayIndex = Util::FindItemInList(Alphas(InLoopIndex + 1), state.dataScheduleMgr->DaySchedule({1, NumRegDaySchedules})); - if (DayIndex == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", {} \"{}\" not Found", - RoutineName, - CurrentModuleObject, - Alphas(1), - cAlphaFields(InLoopIndex + 1), - Alphas(InLoopIndex + 1)), - OptionalOutputFileRef{state.files.audit}); - ShowContinueError(state, format("ref: {} \"{}\"", cAlphaFields(InLoopIndex), Alphas(InLoopIndex))); + for (int Loop = 1; Loop <= NumCptWeekSchedules; ++Loop) { + s_ip->getObjectItem(state, + CurrentModuleObject, + Loop, + Alphas, + NumAlphas, + Numbers, + NumNumbers, + Status, + lNumericBlanks, + lAlphaBlanks, + cAlphaFields, + cNumericFields); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + + if (s_sched->weekScheduleMap.find(Alphas(1)) != s_sched->weekScheduleMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; + continue; + } + + auto *weekSched = AddWeekSchedule(state, Alphas(1)); + + std::fill(allDays.begin(), allDays.end(), false); + // Rest of Alphas are processed into schedule indices + for (int idx = 2; idx <= NumAlphas; idx += 2) { + auto *daySched = GetDaySchedule(state, Alphas(idx + 1)); + if (daySched == nullptr) { + ShowSevereItemNotFoundAudit(state, eoh, cAlphaFields(idx + 1), Alphas(idx + 1)); + ShowContinueError(state, format("ref: {} \"{}\"", cAlphaFields(idx), Alphas(idx))); ErrorsFound = true; } else { - TheseDays = false; + std::fill(theseDays.begin(), theseDays.end(), false); ErrorHere = false; - ProcessForDayTypes(state, Alphas(InLoopIndex), TheseDays, AllDays, ErrorHere); + ProcessForDayTypes(state, Alphas(idx), theseDays, allDays, ErrorHere); if (ErrorHere) { - ShowContinueError(state, format("{}{}=\"{}", RoutineName, CurrentModuleObject, Alphas(1))); + ShowContinueError(state, format("{}: {}=\"{}", routineName, CurrentModuleObject, Alphas(1))); ErrorsFound = true; } else { - for (Hr = 1; Hr <= maxDayTypes; ++Hr) { - if (TheseDays(Hr)) { - state.dataScheduleMgr->WeekSchedule(Count).DaySchedulePointer(Hr) = DayIndex; + for (int iDayType = 1; iDayType < (int)DayType::Num; ++iDayType) { + if (theseDays[iDayType]) { + weekSched->dayScheds[iDayType] = daySched; } } } } } + // Have processed all named days, check to make sure all given - if (!all(AllDays)) { - ShowSevereError(state, format("{}{}=\"{}\", Missing some day assignments", RoutineName, CurrentModuleObject, Alphas(1))); + for (int iDayType = iDayType_Sun; iDayType < (int)DayType::Num; ++iDayType) { + if (allDays[iDayType] == true) continue; + ShowSevereError(state, format("{}: {}=\"{}\", Missing some day assignments", routineName, CurrentModuleObject, Alphas(1))); ErrorsFound = true; + break; } } NumRegWeekSchedules = Count; @@ -1165,122 +1066,100 @@ namespace ScheduleManager { //!! Get Regular Schedules CurrentModuleObject = "Schedule:Year"; - for (LoopIndex = 1; LoopIndex <= NumRegSchedules; ++LoopIndex) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - CurrentModuleObject, - LoopIndex, - Alphas, - NumAlphas, - Numbers, - NumNumbers, - Status, - lNumericBlanks, - lAlphaBlanks, - cAlphaFields, - cNumericFields); - GlobalNames::VerifyUniqueInterObjectName( - state, state.dataScheduleMgr->UniqueScheduleNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - state.dataScheduleMgr->Schedule(LoopIndex).Name = Alphas(1); - state.dataScheduleMgr->Schedule(LoopIndex).SchType = SchedType::ScheduleInput_year; + for (int Loop = 1; Loop <= NumRegSchedules; ++Loop) { + s_ip->getObjectItem(state, + CurrentModuleObject, + Loop, + Alphas, + NumAlphas, + Numbers, + NumNumbers, + Status, + lNumericBlanks, + lAlphaBlanks, + cAlphaFields, + cNumericFields); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + + if (s_sched->scheduleMap.find(Alphas(1)) != s_sched->scheduleMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; + continue; + } + + auto *sched = AddScheduleDetailed(state, Alphas(1)); + // Validate ScheduleType - if (state.dataScheduleMgr->NumScheduleTypes > 0) { - CheckIndex = Util::FindItemInList(Alphas(2), state.dataScheduleMgr->ScheduleType({1, state.dataScheduleMgr->NumScheduleTypes})); - if (CheckIndex == 0) { - if (!lAlphaBlanks(2)) { - ShowWarningError(state, - format("{}{}=\"{}\", {}=\"{}\" not found -- will not be validated", - RoutineName, - CurrentModuleObject, - Alphas(1), - cAlphaFields(2), - Alphas(2))); - } else { - ShowWarningError(state, - format("{}{}=\"{}\", Blank {} input -- will not be validated.", - RoutineName, - CurrentModuleObject, - Alphas(1), - cAlphaFields(2))); - } - } else { - state.dataScheduleMgr->Schedule(LoopIndex).ScheduleTypePtr = CheckIndex; - } + if (lAlphaBlanks(2)) { + ShowWarningEmptyField(state, eoh, cAlphaFields(2)); + ShowContinueError(state, "Schedule will not be validated."); + } else if ((sched->schedTypeNum = GetScheduleTypeNum(state, Alphas(2))) == 0) { + ShowWarningItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ShowContinueError(state, "Schedule will not be validated."); } - NumPointer = 0; - DaysInYear = 0; + + int NumPointer = 0; + + std::array daysInYear; + std::fill(daysInYear.begin(), daysInYear.end(), 0); + // Rest of Alphas (Weekschedules) are processed into Pointers - for (InLoopIndex = 3; InLoopIndex <= NumAlphas; ++InLoopIndex) { - WeekIndex = Util::FindItemInList(Alphas(InLoopIndex), state.dataScheduleMgr->WeekSchedule({1, NumRegWeekSchedules})); - if (WeekIndex == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}=\"{}\" not found.", - RoutineName, - CurrentModuleObject, - Alphas(1), - cAlphaFields(InLoopIndex), - Alphas(InLoopIndex)), - OptionalOutputFileRef{state.files.audit}); + for (int idx = 3; idx <= NumAlphas; ++idx) { + auto *weekSched = GetWeekSchedule(state, Alphas(idx)); + if (weekSched == nullptr) { + ShowSevereItemNotFoundAudit(state, eoh, cAlphaFields(idx), Alphas(idx)); ErrorsFound = true; + continue; + } + + // Process for month, day + int StartMonth = int(Numbers(NumPointer + 1)); + int StartDay = int(Numbers(NumPointer + 2)); + int EndMonth = int(Numbers(NumPointer + 3)); + int EndDay = int(Numbers(NumPointer + 4)); + NumPointer += 4; + int StartPointer = General::OrdinalDay(StartMonth, StartDay, 1); + int EndPointer = General::OrdinalDay(EndMonth, EndDay, 1); + if (StartPointer <= EndPointer) { + for (int Count = StartPointer; Count <= EndPointer; ++Count) { + ++daysInYear[Count]; + sched->weekScheds[Count] = weekSched; + } } else { - // Process for month, day - StartMonth = int(Numbers(NumPointer + 1)); - StartDay = int(Numbers(NumPointer + 2)); - EndMonth = int(Numbers(NumPointer + 3)); - EndDay = int(Numbers(NumPointer + 4)); - NumPointer += 4; - StartPointer = General::OrdinalDay(StartMonth, StartDay, 1); - EndPointer = General::OrdinalDay(EndMonth, EndDay, 1); - if (StartPointer <= EndPointer) { - for (Count = StartPointer; Count <= EndPointer; ++Count) { - ++DaysInYear(Count); - state.dataScheduleMgr->Schedule(LoopIndex).WeekSchedulePointer(Count) = WeekIndex; - } - } else { - for (Count = StartPointer; Count <= 366; ++Count) { - ++DaysInYear(Count); - state.dataScheduleMgr->Schedule(LoopIndex).WeekSchedulePointer(Count) = WeekIndex; - } - for (Count = 1; Count <= EndPointer; ++Count) { - ++DaysInYear(Count); - state.dataScheduleMgr->Schedule(LoopIndex).WeekSchedulePointer(Count) = WeekIndex; - } + for (int Count = StartPointer; Count <= 366; ++Count) { + ++daysInYear[Count]; + sched->weekScheds[Count] = weekSched; + } + for (int Count = 1; Count <= EndPointer; ++Count) { + ++daysInYear[Count]; + sched->weekScheds[Count] = weekSched; } } } + // Perform Error checks on this item // Do special test for Feb 29. Make equal to Feb 28. - if (DaysInYear(60) == 0) { - DaysInYear(60) = DaysInYear(59); - state.dataScheduleMgr->Schedule(LoopIndex).WeekSchedulePointer(60) = - state.dataScheduleMgr->Schedule(LoopIndex).WeekSchedulePointer(59); - } - if (any_eq(DaysInYear, 0)) { - ShowSevereError(state, - format("{}{}=\"{}\" has missing days in its schedule pointers", - RoutineName, - CurrentModuleObject, - state.dataScheduleMgr->Schedule(LoopIndex).Name), - OptionalOutputFileRef{state.files.audit}); - ErrorsFound = true; + if (daysInYear[60] == 0) { + daysInYear[60] = daysInYear[59]; + sched->weekScheds[60] = sched->weekScheds[59]; } - if (any_gt(DaysInYear, 1)) { - ShowSevereError(state, - format("{}{}=\"{}\" has overlapping days in its schedule pointers", - RoutineName, - CurrentModuleObject, - state.dataScheduleMgr->Schedule(LoopIndex).Name), - OptionalOutputFileRef{state.files.audit}); - ErrorsFound = true; + + for (int iDay = 1; iDay <= 366; ++iDay) { + if (daysInYear[iDay] == 0) { + ShowSevereCustomAudit(state, eoh, "has missing days in its schedule pointers"); + ErrorsFound = true; + break; + } else if (daysInYear[iDay] > 1) { + ShowSevereCustomAudit(state, eoh, "has overlapping days in its schedule pointers"); + ErrorsFound = true; + break; + } } - if (state.dataGlobal->AnyEnergyManagementSystemInModel) { // setup constant schedules as actuators - SetupEMSActuator(state, - "Schedule:Year", - state.dataScheduleMgr->Schedule(LoopIndex).Name, - "Schedule Value", - "[ ]", - state.dataScheduleMgr->Schedule(LoopIndex).EMSActuatedOn, - state.dataScheduleMgr->Schedule(LoopIndex).EMSValue); + // What does it mean to actuate a schedule? + if (s_glob->AnyEnergyManagementSystemInModel) { // setup constant schedules as actuators + SetupEMSActuator(state, "Schedule:Year", sched->Name, "Schedule Value", "[ ]", sched->EMSActuatedOn, sched->EMSVal); } } @@ -1305,49 +1184,45 @@ namespace ScheduleManager { // A5 , \field Complex Field #3 SchNum = NumRegSchedules; - AddWeekSch = NumRegWeekSchedules; - AddDaySch = NumRegDaySchedules; CurrentModuleObject = "Schedule:Compact"; - for (LoopIndex = 1; LoopIndex <= NumCptSchedules; ++LoopIndex) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - CurrentModuleObject, - LoopIndex, - Alphas, - NumAlphas, - Numbers, - NumNumbers, - Status, - lNumericBlanks, - lAlphaBlanks, - cAlphaFields, - cNumericFields); - GlobalNames::VerifyUniqueInterObjectName( - state, state.dataScheduleMgr->UniqueScheduleNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - ++SchNum; - state.dataScheduleMgr->Schedule(SchNum).Name = Alphas(1); - state.dataScheduleMgr->Schedule(SchNum).SchType = SchedType::ScheduleInput_compact; + for (int Loop = 1; Loop <= NumCptSchedules; ++Loop) { + s_ip->getObjectItem(state, + CurrentModuleObject, + Loop, + Alphas, + NumAlphas, + Numbers, + NumNumbers, + Status, + lNumericBlanks, + lAlphaBlanks, + cAlphaFields, + cNumericFields); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + + if (s_sched->scheduleMap.find(Alphas(1)) != s_sched->scheduleMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; + continue; + } + + auto *sched = AddScheduleDetailed(state, Alphas(1)); + sched->type = SchedType::Compact; + // Validate ScheduleType - CheckIndex = Util::FindItemInList(Alphas(2), state.dataScheduleMgr->ScheduleType({1, state.dataScheduleMgr->NumScheduleTypes})); - if (CheckIndex == 0) { - if (!lAlphaBlanks(2)) { - ShowWarningError(state, - format("{}{}=\"{}\", {}=\"{}\" not found -- will not be validated", - RoutineName, - CurrentModuleObject, - Alphas(1), - cAlphaFields(2), - Alphas(2))); - } else { - ShowWarningError( - state, - format( - "{}{}=\"{}\", Blank {} input -- will not be validated.", RoutineName, CurrentModuleObject, Alphas(1), cAlphaFields(2))); - } - } else { - state.dataScheduleMgr->Schedule(SchNum).ScheduleTypePtr = CheckIndex; + if (lAlphaBlanks(2)) { + ShowWarningEmptyField(state, eoh, cAlphaFields(2)); + ShowContinueError(state, "Schedule will not be validated."); + } else if ((sched->schedTypeNum = GetScheduleTypeNum(state, Alphas(2))) == SchedNum_Invalid) { + ShowWarningItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ShowContinueError(state, "Schedule will not be validated."); } + NumPointer = 0; - DaysInYear = 0; + + std::array daysInYear; + std::fill(daysInYear.begin() + 1, daysInYear.end(), 0); // Process the "complex" fields -- so named because they are not a 1:1 correspondence // as other objects are NumField = 3; @@ -1358,139 +1233,103 @@ namespace ScheduleManager { while (NumField < NumAlphas) { // Process "Through" if (!has_prefix(Alphas(NumField), "THROUGH:") && !has_prefix(Alphas(NumField), "THROUGH")) { - ShowSevereError(state, - format("{}{}=\"{}\", Expecting \"Through:\" date", - RoutineName, - CurrentModuleObject, - state.dataScheduleMgr->Schedule(SchNum).Name)); - ShowContinueError(state, format("Instead, found entry={}", Alphas(NumField))); + ShowSevereCustom(state, eoh, format("Expecting \"Through:\" date, instead found entry={}", Alphas(NumField))); ErrorsFound = true; goto Through_exit; - } else { - if (Alphas(NumField)[7] == ':') { - sPos = 8; - } else { - sPos = 7; - } - Alphas(NumField).erase(0, sPos); - strip(Alphas(NumField)); } + + int sPos = (Alphas(NumField)[7] == ':') ? 8 : 7; + Alphas(NumField).erase(0, sPos); + strip(Alphas(NumField)); + CurrentThrough = Alphas(NumField); ErrorHere = false; ProcessDateString(state, Alphas(NumField), EndMonth, EndDay, PWeekDay, PDateType, ErrorHere); if (PDateType == Weather::DateType::NthDayInMonth || PDateType == Weather::DateType::LastDayInMonth) { - ShowSevereError(state, - format("{}{}=\"{}\", Invalid \"Through:\" date", - RoutineName, - CurrentModuleObject, - state.dataScheduleMgr->Schedule(SchNum).Name)); - ShowContinueError(state, format("Found entry={}", Alphas(NumField))); + ShowSevereCustom(state, eoh, format("Invalid \"Through:\" date, found entry={}", Alphas(NumField))); ErrorsFound = true; goto Through_exit; - } else if (ErrorHere) { - ShowSevereError(state, - format("{}{}=\"{}\", Invalid \"Through:\" date", - RoutineName, - CurrentModuleObject, - state.dataScheduleMgr->Schedule(SchNum).Name)); - ShowContinueError(state, format("Found entry={}", Alphas(NumField))); + } + + if (ErrorHere) { + ShowSevereCustom(state, eoh, "Invalid \"Through:\" date"); ErrorsFound = true; goto Through_exit; - } else { - EndPointer = General::OrdinalDay(EndMonth, EndDay, 1); - if (EndPointer == 366) { - if (FullYearSet) { - ShowSevereError(state, - format("{}{}=\"{}\", New \"Through\" entry when \"full year\" already set", - RoutineName, - CurrentModuleObject, - state.dataScheduleMgr->Schedule(SchNum).Name)); - ShowContinueError(state, format("\"Through\" field={}", CurrentThrough)); - ErrorsFound = true; - } - FullYearSet = true; + } + + EndPointer = General::OrdinalDay(EndMonth, EndDay, 1); + if (EndPointer == 366) { + if (FullYearSet) { + ShowSevereCustom( + state, eoh, format("New \"Through\" entry when \"full year\" already set \"Through\" field={}", CurrentThrough)); + ErrorsFound = true; } + FullYearSet = true; } + ++WkCount; - ++AddWeekSch; - state.dataScheduleMgr->WeekSchedule(AddWeekSch).Name = format("{}_wk_{}", Alphas(1), WkCount); - state.dataScheduleMgr->WeekSchedule(AddWeekSch).Used = true; - for (Hr = StartPointer; Hr <= EndPointer; ++Hr) { - state.dataScheduleMgr->Schedule(SchNum).WeekSchedulePointer(Hr) = AddWeekSch; - ++DaysInYear(Hr); + + auto *weekSched = AddWeekSchedule(state, format("{}_wk_{}", Alphas(1), WkCount)); + weekSched->isUsed = true; + + for (int iDay = StartPointer; iDay <= EndPointer; ++iDay) { + sched->weekScheds[iDay] = weekSched; + ++daysInYear[iDay]; } + StartPointer = EndPointer + 1; ThruField = NumField; - AllDays = false; + std::fill(allDays.begin(), allDays.end(), false); ++NumField; + while (NumField < NumAlphas) { // Continues until next "Through" if (has_prefix(Alphas(NumField), "THROUGH")) goto For_exit; // "For" must be next, adds to "# Day Schedules" - if (has_prefix(Alphas(NumField), "FOR")) { - ++DyCount; - ++AddDaySch; - state.dataScheduleMgr->DaySchedule(AddDaySch).Name = format("{}_dy_{}", Alphas(1), DyCount); - state.dataScheduleMgr->DaySchedule(AddDaySch).ScheduleTypePtr = state.dataScheduleMgr->Schedule(SchNum).ScheduleTypePtr; - state.dataScheduleMgr->DaySchedule(AddDaySch).Used = true; - TheseDays = false; - ErrorHere = false; - LastFor = Alphas(NumField); - ProcessForDayTypes(state, Alphas(NumField), TheseDays, AllDays, ErrorHere); - if (ErrorHere) { - ShowContinueError(state, format("ref {}=\"{}\"", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("ref Through field={}", Alphas(ThruField))); - ErrorsFound = true; - } else { - for (Hr = 1; Hr <= maxDayTypes; ++Hr) { - if (TheseDays(Hr)) { - state.dataScheduleMgr->WeekSchedule(AddWeekSch).DaySchedulePointer(Hr) = AddDaySch; - } - } - } - } else { - ShowSevereError( - state, - format( - "{}{}=\"{}\", Looking for \"For\" field, found={}", RoutineName, CurrentModuleObject, Alphas(1), Alphas(NumField))); + if (!has_prefix(Alphas(NumField), "FOR")) { + ShowSevereCustom(state, eoh, format("Looking for \"For\" field, found={}", Alphas(NumField))); ErrorsFound = true; - // CALL ShowSevereError(state, RoutineName//TRIM(CurrentModuleObject)//'="'//TRIM(Schedule(SchNum)%Name)// & - // '", Expecting "For:" day types') - // CALL ShowContinueError(state, 'Instead, found entry='//TRIM(Alphas(NumField))) goto Through_exit; } + + ++DyCount; + + auto *daySched = AddDaySchedule(state, format("{}_dy_{}", Alphas(1), DyCount)); + + daySched->schedTypeNum = sched->schedTypeNum; + daySched->isUsed = true; + + std::fill(theseDays.begin(), theseDays.end(), false); + ErrorHere = false; + LastFor = Alphas(NumField); + ProcessForDayTypes(state, Alphas(NumField), theseDays, allDays, ErrorHere); + if (ErrorHere) { + ShowContinueError(state, format("ref {}=\"{}\"", CurrentModuleObject, Alphas(1))); + ShowContinueError(state, format("ref Through field={}", Alphas(ThruField))); + ErrorsFound = true; + } else { + for (int iDayType = 1; iDayType < (int)DayType::Num; ++iDayType) { + if (theseDays[iDayType]) { + weekSched->dayScheds[iDayType] = daySched; + } + } + } + // Check for "Interpolate" ++NumField; - if (has_prefix(Alphas(NumField), "INTERPOLATE")) { + if (has_prefix(Alphas(NumField), "INTERPOLATE") || !has_prefix(Alphas(NumField), "UNTIL")) { if (has(Alphas(NumField), "NO")) { - state.dataScheduleMgr->DaySchedule(AddDaySch).IntervalInterpolated = ScheduleInterpolation::No; + daySched->interpolation = Interpolation::No; } else if (has(Alphas(NumField), "AVERAGE")) { - state.dataScheduleMgr->DaySchedule(AddDaySch).IntervalInterpolated = ScheduleInterpolation::Average; + daySched->interpolation = Interpolation::Average; } else if (has(Alphas(NumField), "LINEAR")) { - state.dataScheduleMgr->DaySchedule(AddDaySch).IntervalInterpolated = ScheduleInterpolation::Linear; + daySched->interpolation = Interpolation::Linear; } else { - ShowSevereError(state, - std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + "Invalid value for \"" + - cAlphaFields(NumField) + "\" field=\"" + Alphas(NumField) + "\""); + ShowSevereInvalidKey(state, eoh, cAlphaFields(NumField), Alphas(NumField)); ErrorsFound = true; } ++NumField; - } else { - if (!has_prefix(Alphas(NumField), "UNTIL")) { - if (has(Alphas(NumField), "NO")) { - state.dataScheduleMgr->DaySchedule(AddDaySch).IntervalInterpolated = ScheduleInterpolation::No; - } else if (has(Alphas(NumField), "AVERAGE")) { - state.dataScheduleMgr->DaySchedule(AddDaySch).IntervalInterpolated = ScheduleInterpolation::Average; - } else if (has(Alphas(NumField), "LINEAR")) { - state.dataScheduleMgr->DaySchedule(AddDaySch).IntervalInterpolated = ScheduleInterpolation::Linear; - } else { - ShowSevereError( - state, - format("{}{}=\"{}\", Illegal Field entered ={}", RoutineName, CurrentModuleObject, Alphas(1), Alphas(NumField))); - ErrorsFound = true; - } - ++NumField; - } } + NumNumbers = 0; xxcount = 0; UntilFld = NumField; @@ -1504,25 +1343,20 @@ namespace ScheduleManager { ++NumNumbers; Numbers(NumNumbers) = Util::ProcessNumber(Alphas(NumField), ErrorHere); if (ErrorHere) { - ShowSevereError(state, format("{}=\"{}\"", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, - format("Until field=[{}] has illegal value field=[{}].", Alphas(NumField - 1), Alphas(NumField))); + ShowSevereCustom( + state, eoh, format("Until field=[{}] has illegal value field=[{}].", Alphas(NumField - 1), Alphas(NumField))); ErrorsFound = true; } ++NumField; - Alphas(UntilFld + xxcount) = Alphas(NumField); // Incase next is "until" + Alphas(UntilFld + xxcount) = Alphas(NumField); // In case next is "until" } else { - ShowSevereError(state, - format("{}{}=\"{}\", Looking for \"Until\" field, found={}", - RoutineName, - CurrentModuleObject, - Alphas(1), - Alphas(NumField))); + ShowSevereCustom(state, eoh, format("Looking for \"Until\" field, found={}", Alphas(NumField))); ErrorsFound = true; goto Through_exit; } if (Alphas(NumField).empty()) break; } + // Process Untils, Numbers if (NumNumbers > 0) { NumFields = NumNumbers; @@ -1532,94 +1366,58 @@ namespace ScheduleManager { Numbers, NumFields, NumNumbers, - MinuteValue, - SetMinuteValue, + minuteVals, + setMinuteVals, ErrorHere, - state.dataScheduleMgr->DaySchedule(AddDaySch).Name, + daySched->Name, CurrentModuleObject + " DaySchedule Fields", - state.dataScheduleMgr->DaySchedule(AddDaySch).IntervalInterpolated); + daySched->interpolation); // Depending on value of "Interpolate" field, the value for each time step in each hour gets processed: if (ErrorHere) { ShowContinueError(state, format("ref {}=\"{}\"", CurrentModuleObject, Alphas(1))); ErrorsFound = true; } - if (state.dataScheduleMgr->DaySchedule(AddDaySch).IntervalInterpolated == - ScheduleInterpolation::No) { // No validation done on the value of the interpolation field - for (Hr = 1; Hr <= 24; ++Hr) { - CurMinute = state.dataGlobal->MinutesPerTimeStep; - for (TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { - state.dataScheduleMgr->DaySchedule(AddDaySch).TSValue(TS, Hr) = MinuteValue(CurMinute, Hr); - CurMinute += state.dataGlobal->MinutesPerTimeStep; - } - } - } else { - for (Hr = 1; Hr <= 24; ++Hr) { - SCount = 1; - CurMinute = state.dataGlobal->MinutesPerTimeStep; - for (TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { - // tempval=SUM(MinuteValue(Hr,SCount:CurMinute))/REAL(MinutesPerTimeStep,r64) - state.dataScheduleMgr->DaySchedule(AddDaySch).TSValue(TS, Hr) = - sum(MinuteValue({SCount, CurMinute}, Hr)) / double(state.dataGlobal->MinutesPerTimeStep); - SCount = CurMinute + 1; - CurMinute += state.dataGlobal->MinutesPerTimeStep; - } - } - } + + daySched->populateFromMinuteVals(state, minuteVals); } } + For_exit:; - if (!all(AllDays)) { - ShowWarningError(state, - format("{}{}=\"{}\" has missing day types in Through={}", - RoutineName, - CurrentModuleObject, - state.dataScheduleMgr->Schedule(SchNum).Name, - CurrentThrough)); + for (int iDayType = iDayType_Sun; iDayType < (int)DayType::Num; ++iDayType) { + if (allDays[iDayType] == true) continue; + + ShowWarningCustom(state, eoh, format("has missing day types in Through={}", CurrentThrough)); ShowContinueError(state, format("Last \"For\" field={}", LastFor)); - errmsg = "Missing day types=,"; - for (kdy = 1; kdy <= maxDayTypes; ++kdy) { - if (AllDays(kdy)) continue; + std::string errmsg = "Missing day types=,"; + for (int kDayType = iDayType_Sun; kDayType < (int)DayType::Num; ++kDayType) { + if (allDays[kDayType]) continue; errmsg.erase(errmsg.length() - 1); - errmsg += "\"" + static_cast(dayTypeNames[kdy]) + "\",-"; + errmsg = format("{} \"{}\",-", errmsg, dayTypeNames[kDayType]); } errmsg.erase(errmsg.length() - 2); ShowContinueError(state, errmsg); ShowContinueError(state, "Missing day types will have 0.0 as Schedule Values"); + break; } } + Through_exit:; - if (DaysInYear(60) == 0) { - DaysInYear(60) = DaysInYear(59); - state.dataScheduleMgr->Schedule(LoopIndex).WeekSchedulePointer(60) = - state.dataScheduleMgr->Schedule(LoopIndex).WeekSchedulePointer(59); + if (daysInYear[60] == 0) { + daysInYear[60] = daysInYear[59]; + sched->weekScheds[60] = sched->weekScheds[59]; } - if (any_eq(DaysInYear, 0)) { - ShowSevereError(state, - format("{}{}=\"{}\" has missing days in its schedule pointers", - RoutineName, - CurrentModuleObject, - state.dataScheduleMgr->Schedule(SchNum).Name), - OptionalOutputFileRef{state.files.audit}); + + if (std::find(daysInYear.begin() + 1, daysInYear.end(), 0) != daysInYear.end()) { + ShowSevereCustomAudit(state, eoh, "has missing days in its schedule pointers"); ErrorsFound = true; } - if (any_gt(DaysInYear, 1)) { - ShowSevereError(state, - format("{}{}=\"{}\" has overlapping days in its schedule pointers", - RoutineName, - CurrentModuleObject, - state.dataScheduleMgr->Schedule(SchNum).Name), - OptionalOutputFileRef{state.files.audit}); + if (std::find_if(daysInYear.begin() + 1, daysInYear.end(), [](int i) { return i > 1; }) != daysInYear.end()) { + ShowSevereCustomAudit(state, eoh, "has overlapping days in its schedule pointers"); ErrorsFound = true; } - if (state.dataGlobal->AnyEnergyManagementSystemInModel) { // setup constant schedules as actuators - SetupEMSActuator(state, - "Schedule:Compact", - state.dataScheduleMgr->Schedule(SchNum).Name, - "Schedule Value", - "[ ]", - state.dataScheduleMgr->Schedule(SchNum).EMSActuatedOn, - state.dataScheduleMgr->Schedule(SchNum).EMSValue); + if (s_glob->AnyEnergyManagementSystemInModel) { // setup constant schedules as actuators + SetupEMSActuator(state, "Schedule:Compact", sched->Name, "Schedule Value", "[ ]", sched->EMSActuatedOn, sched->EMSVal); } } @@ -1672,46 +1470,40 @@ namespace ScheduleManager { // \maximum 60 // continue adding to SchNum,AddWeekSch,AddDaySch + CurrentModuleObject = "Schedule:File"; - for (LoopIndex = 1; LoopIndex <= NumCommaFileSchedules; ++LoopIndex) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - CurrentModuleObject, - LoopIndex, - Alphas, - NumAlphas, - Numbers, - NumNumbers, - Status, - lNumericBlanks, - lAlphaBlanks, - cAlphaFields, - cNumericFields); - GlobalNames::VerifyUniqueInterObjectName( - state, state.dataScheduleMgr->UniqueScheduleNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - ++SchNum; - state.dataScheduleMgr->Schedule(SchNum).Name = Alphas(1); - state.dataScheduleMgr->Schedule(SchNum).SchType = SchedType::ScheduleInput_file; + for (int Loop = 1; Loop <= NumCommaFileSchedules; ++Loop) { + s_ip->getObjectItem(state, + CurrentModuleObject, + Loop, + Alphas, + NumAlphas, + Numbers, + NumNumbers, + Status, + lNumericBlanks, + lAlphaBlanks, + cAlphaFields, + cNumericFields); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + + if (s_sched->scheduleMap.find(Alphas(1)) != s_sched->scheduleMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; + continue; + } + + auto *sched = AddScheduleDetailed(state, Alphas(1)); + sched->type = SchedType::File; + // Validate ScheduleType - if (state.dataScheduleMgr->NumScheduleTypes > 0) { - CheckIndex = 0; - if (!lAlphaBlanks(2)) - CheckIndex = Util::FindItemInList(Alphas(2), state.dataScheduleMgr->ScheduleType({1, state.dataScheduleMgr->NumScheduleTypes})); - if (CheckIndex == 0) { - if (!lAlphaBlanks(2)) { - ShowWarningError(state, - format("ProcessScheduleInput: For {}=\"{}\", {}=\"{}\" not found -- will not be validated", - CurrentModuleObject, - Alphas(1), - cAlphaFields(2), - Alphas(2))); - } else { - ShowWarningError( - state, - format("For {}=\"{}\", Blank {} input -- will not be validated.", CurrentModuleObject, Alphas(1), cAlphaFields(2))); - } - } else { - state.dataScheduleMgr->Schedule(SchNum).ScheduleTypePtr = CheckIndex; - } + if (lAlphaBlanks(2)) { + ShowWarningEmptyField(state, eoh, cAlphaFields(2)); + ShowContinueError(state, "Schedule will not be validated."); + } else if ((sched->schedTypeNum = GetScheduleTypeNum(state, Alphas(2))) == SchedNum_Invalid) { + ShowWarningItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ShowContinueError(state, "Schedule will not be validated."); } // Numbers(1) - which column @@ -1720,10 +1512,10 @@ namespace ScheduleManager { skiprowCount = Numbers(2); if (Numbers(3) == 0) Numbers(3) = 8760.0; if (Numbers(3) != 8760 && Numbers(3) != 8784) { - ShowSevereError( + ShowSevereCustom( state, - format("{}{}=\"{}\", {} must = 8760 or 8784 (for a leap year)", RoutineName, CurrentModuleObject, Alphas(1), cNumericFields(3))); - ShowContinueError(state, format("..Value for field = {:.0T}, Schedule not processed.", Numbers(3))); + eoh, + format("{} must = 8760 or 8784 (for a leap year). Value = {:.0T}, Schedule not processed.", cNumericFields(3), Numbers(3))); ErrorsFound = true; continue; } @@ -1738,65 +1530,60 @@ namespace ScheduleManager { } else if (Util::SameString(Alphas(4), "space")) { ColumnSep = CharSpace; } else { - ShowSevereError( - state, format("{}{}=\"{}\", {} illegal value=\"{}\".", RoutineName, CurrentModuleObject, Alphas(1), cAlphaFields(4), Alphas(4))); - ShowContinueError(state, "..must be Comma, Semicolon, Tab, or Space."); + ShowSevereInvalidKey(state, eoh, cAlphaFields(4), Alphas(4), "..must be Comma, Semicolon, Tab, or Space."); ErrorsFound = true; continue; } // Depending on value of "Interpolate" field, the value for each time step in each hour gets processed: - FileIntervalInterpolated = false; - if (lAlphaBlanks(5)) Alphas(5) = "NO"; - if (Alphas(5) != "NO" && Alphas(5) != "YES") { - ShowSevereError( - state, - format( - "{}{}=\"{}Invalid value for \"{}\" field=\"{}\"", RoutineName, CurrentModuleObject, Alphas(1), cAlphaFields(5), Alphas(5))); - ErrorsFound = true; - } else if (Alphas(5) != "YES") { // No validation done on the value of the interpolation field - FileIntervalInterpolated = false; - } else { - FileIntervalInterpolated = true; + Interpolation interp = Interpolation::No; + + if (!lAlphaBlanks(5)) { + if (BooleanSwitch bs = getYesNoValue(Alphas(5)); bs != BooleanSwitch::Invalid) { + interp = static_cast(bs) ? Interpolation::Average : Interpolation::Linear; + } else { + ShowSevereInvalidKey(state, eoh, cAlphaFields(5), Alphas(5)); + ErrorsFound = true; + } } - state.dataScheduleMgr->Schedule(SchNum).UseDaylightSaving = true; + sched->UseDaylightSaving = true; if ((Alphas(6)) == "NO") { - state.dataScheduleMgr->Schedule(SchNum).UseDaylightSaving = false; + sched->UseDaylightSaving = false; } // is it a sub-hourly schedule or not? - MinutesPerItem = 60; + int MinutesPerItem = Constant::iMinutesInHour; if (NumNumbers > 3) { MinutesPerItem = int(Numbers(4)); - NumExpectedItems = 1440 / MinutesPerItem; - if (mod(60, MinutesPerItem) != 0) { - ShowSevereError(state, format("{}{}=\"{}", RoutineName, CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("Requested {} field value ({}) not evenly divisible into 60", cNumericFields(4), MinutesPerItem)); + // int NumExpectedItems = 1440 / MinutesPerItem; + if (mod(Constant::iMinutesInHour, MinutesPerItem) != 0) { + ShowSevereCustom( + state, eoh, format("Requested {} field value ({}) not evenly divisible into 60", cNumericFields(4), MinutesPerItem)); ErrorsFound = true; continue; } } - numHourlyValues = Numbers(3); - rowLimitCount = (Numbers(3) * 60.0) / MinutesPerItem; - hrLimitCount = 60 / MinutesPerItem; + int numHourlyValues = Numbers(3); + int rowLimitCount = (Numbers(3) * Constant::rMinutesInHour) / MinutesPerItem; + int hrLimitCount = Constant::iMinutesInHour / MinutesPerItem; - std::string contextString = CurrentModuleObject + "=\"" + Alphas(1) + "\", " + cAlphaFields(3) + ": "; + std::string contextString = format("{}=\"{}\", {}: ", CurrentModuleObject, Alphas(1), cAlphaFields(3)); state.files.TempFullFilePath.filePath = CheckForActualFilePath(state, Alphas(3), contextString); // Setup file reading parameters if (state.files.TempFullFilePath.filePath.empty()) { ErrorsFound = true; } else { - auto result = state.dataScheduleMgr->UniqueProcessedExternalFiles.find(state.files.TempFullFilePath.filePath); - if (result == state.dataScheduleMgr->UniqueProcessedExternalFiles.end()) { + auto result = s_sched->UniqueProcessedExternalFiles.find(state.files.TempFullFilePath.filePath); + if (result == s_sched->UniqueProcessedExternalFiles.end()) { FileSystem::FileTypes const ext = FileSystem::getFileType(state.files.TempFullFilePath.filePath); if (FileSystem::is_flat_file_type(ext)) { auto const schedule_data = FileSystem::readFile(state.files.TempFullFilePath.filePath); CsvParser csvParser; - auto it = state.dataScheduleMgr->UniqueProcessedExternalFiles.emplace( - state.files.TempFullFilePath.filePath, csvParser.decode(schedule_data, ColumnSep, skiprowCount)); + auto it = s_sched->UniqueProcessedExternalFiles.emplace(state.files.TempFullFilePath.filePath, + csvParser.decode(schedule_data, ColumnSep, skiprowCount)); if (csvParser.hasErrors()) { for (const auto &[error, isContinued] : csvParser.errors()) { if (isContinued) { @@ -1810,17 +1597,14 @@ namespace ScheduleManager { } result = it.first; } else if (FileSystem::is_all_json_type(ext)) { - auto it = state.dataScheduleMgr->UniqueProcessedExternalFiles.emplace( - state.files.TempFullFilePath.filePath, FileSystem::readJSON(state.files.TempFullFilePath.filePath)); + auto it = s_sched->UniqueProcessedExternalFiles.emplace(state.files.TempFullFilePath.filePath, + FileSystem::readJSON(state.files.TempFullFilePath.filePath)); result = it.first; } else { - ShowSevereError(state, - fmt::format(R"({}{}="{}", {}="{}" has an unknown file extension and cannot be read by this program.)", - RoutineName, - CurrentModuleObject, - Alphas(1), - cAlphaFields(3), - Alphas(3))); + ShowSevereCustom( + state, + eoh, + format("{} = {} has an unknown file extension and cannot be read by this program.", cAlphaFields(3), Alphas(3))); ShowFatalError(state, "Program terminates due to previous condition."); } } @@ -1832,35 +1616,27 @@ namespace ScheduleManager { // schedule values have been filled into the hourlyFileValues array. if (numerrors > 0) { - ShowWarningError(state, - format("{}{}=\"{}\" {} records had errors - these values are set to 0.", - RoutineName, - CurrentModuleObject, - Alphas(1), - numerrors)); - ShowContinueError(state, "Use Output:Diagnostics,DisplayExtraWarnings; to see individual records in error."); - } - if (rowCnt < rowLimitCount) { - ShowWarningError( - state, - format( - "{}{}=\"{}\" less than {} hourly values read from file.", RoutineName, CurrentModuleObject, Alphas(1), numHourlyValues)); - ShowContinueError(state, format("..Number read={}.", (rowCnt * 60) / MinutesPerItem)); + ShowWarningCustom(state, + eoh, + format("{} records had errors - these values are set to 0." + "Use Output:Diagnostics,DisplayExtraWarnings; to see individual records in error.", + numerrors)); } + if (rowCnt < rowLimitCount) { - ShowWarningError( - state, format("{}{}=\"{}\" less than specified hourly values read from file.", RoutineName, CurrentModuleObject, Alphas(1))); - ShowContinueError(state, - format("..Specified Number of Hourly Values={} Actual number of hourly values included={}", + ShowWarningCustom(state, + eoh, + format("less than {} hourly values read from file." + "..Number read={}.", numHourlyValues, - (rowCnt * 60) / MinutesPerItem)); + (rowCnt * Constant::iMinutesInHour) / MinutesPerItem)); } // process the data into the normal schedule data structures // note -- schedules are ALWAYS 366 days so some special measures have to be done at 29 Feb "day of year" (60) - iDay = 0; - hDay = 0; - ifld = 0; + int iDay = 0; + int hDay = 0; + int ifld = 0; while (true) { // create string of which day of year ++iDay; @@ -1868,76 +1644,59 @@ namespace ScheduleManager { if (iDay > 366) break; // increment both since a week schedule is being defined for each day so that a day is valid // no matter what the day type that is used in a design day. - ++AddWeekSch; - ++AddDaySch; + + // define day schedule + auto *daySched = AddDaySchedule(state, format("{}_dy_{}", Alphas(1), iDay)); + daySched->schedTypeNum = sched->schedTypeNum; + // define week schedule - state.dataScheduleMgr->WeekSchedule(AddWeekSch).Name = fmt::format("{}_wk_{}", Alphas(1), iDay); + auto *weekSched = AddWeekSchedule(state, format("{}_wk_{}", Alphas(1), iDay)); + // for all day types point the week schedule to the newly defined day schedule - for (kDayType = 1; kDayType <= maxDayTypes; ++kDayType) { - state.dataScheduleMgr->WeekSchedule(AddWeekSch).DaySchedulePointer(kDayType) = AddDaySch; + for (int kDayType = 1; kDayType < (int)DayType::Num; ++kDayType) { + weekSched->dayScheds[kDayType] = daySched; } - // day schedule - state.dataScheduleMgr->DaySchedule(AddDaySch).Name = fmt::format("{}_dy_{}", Alphas(1), iDay); - state.dataScheduleMgr->DaySchedule(AddDaySch).ScheduleTypePtr = state.dataScheduleMgr->Schedule(SchNum).ScheduleTypePtr; + // schedule is pointing to the week schedule - state.dataScheduleMgr->Schedule(SchNum).WeekSchedulePointer(iDay) = AddWeekSch; - if (MinutesPerItem == 60) { - for (jHour = 1; jHour <= 24; ++jHour) { - curHrVal = column_values[ifld]; // hourlyFileValues((hDay - 1) * 24 + jHour) + sched->weekScheds[iDay] = weekSched; + + if (MinutesPerItem == Constant::iMinutesInHour) { + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) { + Real64 curHrVal = column_values[ifld]; // hourlyFileValues((hDay - 1) * 24 + jHour) ++ifld; - for (TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { - state.dataScheduleMgr->DaySchedule(AddDaySch).TSValue(TS, jHour) = curHrVal; + for (int ts = 0; ts < s_glob->TimeStepsInHour; ++ts) { + daySched->tsVals[hr * s_glob->TimeStepsInHour + ts] = curHrVal; + daySched->sumTsVals += daySched->tsVals[hr * s_glob->TimeStepsInHour + ts]; } } } else { // Minutes Per Item < 60 - for (Hr = 1; Hr <= 24; ++Hr) { - CurMinute = MinutesPerItem; - SCount = 1; - for (NumFields = 1; NumFields <= hrLimitCount; ++NumFields) { - MinuteValue({SCount, CurMinute}, Hr) = column_values[ifld]; - ++ifld; - SCount = CurMinute + 1; - CurMinute += MinutesPerItem; - } - } - if (FileIntervalInterpolated) { - for (Hr = 1; Hr <= 24; ++Hr) { - SCount = 1; - CurMinute = state.dataGlobal->MinutesPerTimeStep; - for (TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { - state.dataScheduleMgr->DaySchedule(AddDaySch).TSValue(TS, Hr) = - sum(MinuteValue({SCount, CurMinute}, Hr)) / double(state.dataGlobal->MinutesPerTimeStep); - SCount = CurMinute + 1; - CurMinute += state.dataGlobal->MinutesPerTimeStep; - } - } - } else { - for (Hr = 1; Hr <= 24; ++Hr) { - CurMinute = state.dataGlobal->MinutesPerTimeStep; - for (TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { - state.dataScheduleMgr->DaySchedule(AddDaySch).TSValue(TS, Hr) = MinuteValue(CurMinute, Hr); - CurMinute += state.dataGlobal->MinutesPerTimeStep; + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) { + int endMin = MinutesPerItem - 1; + int begMin = 0; + for (int NumFields = 1; NumFields <= hrLimitCount; ++NumFields) { + for (int iMin = begMin; iMin <= endMin; ++iMin) { + minuteVals[hr * Constant::iMinutesInHour + iMin] = column_values[ifld]; } + + ++ifld; + begMin = endMin + 1; + endMin += MinutesPerItem; } } + + daySched->interpolation = interp; + daySched->populateFromMinuteVals(state, minuteVals); } if (iDay == 59 && rowCnt < 8784 * hrLimitCount) { // 28 Feb // Dup 28 Feb to 29 Feb (60) ++iDay; - state.dataScheduleMgr->Schedule(SchNum).WeekSchedulePointer(iDay) = - state.dataScheduleMgr->Schedule(SchNum).WeekSchedulePointer(iDay - 1); + sched->weekScheds[iDay] = sched->weekScheds[iDay - 1]; } } } - if (state.dataGlobal->AnyEnergyManagementSystemInModel) { // setup constant schedules as actuators - SetupEMSActuator(state, - "Schedule:File", - state.dataScheduleMgr->Schedule(SchNum).Name, - "Schedule Value", - "[ ]", - state.dataScheduleMgr->Schedule(SchNum).EMSActuatedOn, - state.dataScheduleMgr->Schedule(SchNum).EMSValue); + if (s_glob->AnyEnergyManagementSystemInModel) { // setup constant schedules as actuators + SetupEMSActuator(state, "Schedule:File", sched->Name, "Schedule Value", "[ ]", sched->EMSActuatedOn, sched->EMSVal); } } @@ -1955,394 +1714,332 @@ namespace ScheduleManager { if (column == 0) continue; // Skip timestamp column and any duplicate column, which will be 0 as well since it won't be found. auto const column_values = values_json.at(column).get>(); // (AUTO_OK_OBJ) - std::string curName = fmt::format("{}_shading", header); - GlobalNames::VerifyUniqueInterObjectName( - state, state.dataScheduleMgr->UniqueScheduleNames, curName, CurrentModuleObject, cAlphaFields(1), ErrorsFound); - ++SchNum; - state.dataScheduleMgr->Schedule(SchNum).Name = curName; - state.dataScheduleMgr->Schedule(SchNum).SchType = SchedType::ScheduleInput_file; + std::string curName = format("{}_shading", header); + std::string curNameUC = Util::makeUPPER(curName); + + if (s_sched->scheduleMap.find(curNameUC) != s_sched->scheduleMap.end()) { + ShowSevereError(state, format("Duplicate schedule name {}", curName)); + ErrorsFound = true; + continue; + } + + auto *schedShading = AddScheduleDetailed(state, curName); + schedShading->type = SchedType::File; - iDay = 0; - ifld = 0; + int iDay = 0; + int ifld = 0; while (true) { // create string of which day of year ++iDay; if (iDay > 366) { break; } - // increment both since a week schedule is being defined for each day so that a day is valid - // no matter what the day type that is used in a design day. - ++AddWeekSch; - ++AddDaySch; + + // day schedule + auto *daySched = AddDaySchedule(state, format("{}_dy_{}", curName, iDay)); + daySched->schedTypeNum = schedShading->schedTypeNum; + // define week schedule - state.dataScheduleMgr->WeekSchedule(AddWeekSch).Name = fmt::format("{}_wk_{}", curName, iDay); + auto *weekSched = AddWeekSchedule(state, format("{}_wk_{}", curName, iDay)); + // for all day types point the week schedule to the newly defined day schedule - for (kDayType = 1; kDayType <= maxDayTypes; ++kDayType) { - state.dataScheduleMgr->WeekSchedule(AddWeekSch).DaySchedulePointer(kDayType) = AddDaySch; + for (int kDayType = 1; kDayType < (int)DayType::Num; ++kDayType) { + weekSched->dayScheds[kDayType] = daySched; } - // day schedule - state.dataScheduleMgr->DaySchedule(AddDaySch).Name = fmt::format("{}_dy_{}", curName, iDay); - state.dataScheduleMgr->DaySchedule(AddDaySch).ScheduleTypePtr = state.dataScheduleMgr->Schedule(SchNum).ScheduleTypePtr; + // schedule is pointing to the week schedule - state.dataScheduleMgr->Schedule(SchNum).WeekSchedulePointer(iDay) = AddWeekSch; + schedShading->weekScheds[iDay] = weekSched; - for (jHour = 1; jHour <= 24; ++jHour) { - for (TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { - state.dataScheduleMgr->DaySchedule(AddDaySch).TSValue(TS, jHour) = column_values[ifld]; + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) { + for (int ts = 0; ts < s_glob->TimeStepsInHour; ++ts) { + daySched->tsVals[hr * s_glob->TimeStepsInHour + ts] = column_values[ifld]; ++ifld; } } + if (iDay == 59 && !state.dataEnvrn->CurrentYearIsLeapYear) { // 28 Feb // Dup 28 Feb to 29 Feb (60) ++iDay; - state.dataScheduleMgr->Schedule(SchNum).WeekSchedulePointer(iDay) = - state.dataScheduleMgr->Schedule(SchNum).WeekSchedulePointer(iDay - 1); + schedShading->weekScheds[iDay] = schedShading->weekScheds[iDay - 1]; } } } } - MinuteValue.deallocate(); - SetMinuteValue.deallocate(); - // Constant Schedules CurrentModuleObject = "Schedule:Constant"; - for (LoopIndex = 1; LoopIndex <= NumConstantSchedules; ++LoopIndex) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - CurrentModuleObject, - LoopIndex, - Alphas, - NumAlphas, - Numbers, - NumNumbers, - Status, - lNumericBlanks, - lAlphaBlanks, - cAlphaFields, - cNumericFields); - GlobalNames::VerifyUniqueInterObjectName( - state, state.dataScheduleMgr->UniqueScheduleNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - ++SchNum; - state.dataScheduleMgr->Schedule(SchNum).Name = Alphas(1); - state.dataScheduleMgr->Schedule(SchNum).SchType = SchedType::ScheduleInput_constant; + for (int Loop = 1; Loop <= NumConstantSchedules; ++Loop) { + s_ip->getObjectItem(state, + CurrentModuleObject, + Loop, + Alphas, + NumAlphas, + Numbers, + NumNumbers, + Status, + lNumericBlanks, + lAlphaBlanks, + cAlphaFields, + cNumericFields); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + + if (s_sched->scheduleMap.find(Alphas(1)) != s_sched->scheduleMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; + continue; + } + + auto *sched = AddScheduleConstant(state, Alphas(1)); + // Validate ScheduleType - if (state.dataScheduleMgr->NumScheduleTypes > 0) { - CheckIndex = Util::FindItemInList(Alphas(2), state.dataScheduleMgr->ScheduleType({1, state.dataScheduleMgr->NumScheduleTypes})); - if (CheckIndex == 0) { - if (!lAlphaBlanks(2)) { - ShowWarningError(state, - format("{}{}=\"{}\", {}=\"{}\" not found -- will not be validated", - RoutineName, - CurrentModuleObject, - Alphas(1), - cAlphaFields(2), - Alphas(2))); - } else { - ShowWarningError(state, - format("{}{}=\"{}\", Blank {} input -- will not be validated.", - RoutineName, - CurrentModuleObject, - Alphas(1), - cAlphaFields(2))); - } - } else { - state.dataScheduleMgr->Schedule(SchNum).ScheduleTypePtr = CheckIndex; - } + if (lAlphaBlanks(2)) { // No warning here for constant schedules + ShowWarningEmptyField(state, eoh, cAlphaFields(2)); + ShowContinueError(state, "Schedule will not be validated."); + } else if ((sched->schedTypeNum = GetScheduleTypeNum(state, Alphas(2))) == SchedNum_Invalid) { + ShowWarningItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ShowContinueError(state, "Schedule will not be validated."); } - ++AddWeekSch; - ++AddDaySch; - // define week schedule - state.dataScheduleMgr->WeekSchedule(AddWeekSch).Name = Alphas(1) + "_wk_"; - // for all day types point the week schedule to the newly defined day schedule - for (kDayType = 1; kDayType <= maxDayTypes; ++kDayType) { - state.dataScheduleMgr->WeekSchedule(AddWeekSch).DaySchedulePointer(kDayType) = AddDaySch; - } - // day schedule - state.dataScheduleMgr->DaySchedule(AddDaySch).Name = Alphas(1) + "_dy_"; - state.dataScheduleMgr->DaySchedule(AddDaySch).ScheduleTypePtr = state.dataScheduleMgr->Schedule(SchNum).ScheduleTypePtr; - // schedule is pointing to the week schedule - state.dataScheduleMgr->Schedule(SchNum).WeekSchedulePointer = AddWeekSch; - curHrVal = Numbers(1); - state.dataScheduleMgr->DaySchedule(AddDaySch).TSValue = Numbers(1); - - if (state.dataGlobal->AnyEnergyManagementSystemInModel) { // setup constant schedules as actuators - SetupEMSActuator(state, - "Schedule:Constant", - state.dataScheduleMgr->Schedule(SchNum).Name, - "Schedule Value", - "[ ]", - state.dataScheduleMgr->Schedule(SchNum).EMSActuatedOn, - state.dataScheduleMgr->Schedule(SchNum).EMSValue); + + sched->currentVal = Numbers(1); + sched->tsVals.resize(Constant::iHoursInDay * s_glob->TimeStepsInHour); + for (int i = 0; i < Constant::iHoursInDay * s_glob->TimeStepsInHour; ++i) + sched->tsVals[i] = sched->currentVal; + + if (s_glob->AnyEnergyManagementSystemInModel) { // setup constant schedules as actuators + SetupEMSActuator(state, "Schedule:Constant", sched->Name, "Schedule Value", "[ ]", sched->EMSActuatedOn, sched->EMSVal); } } CurrentModuleObject = "ExternalInterface:Schedule"; - for (LoopIndex = 1; LoopIndex <= NumExternalInterfaceSchedules; ++LoopIndex) { - - state.dataInputProcessing->inputProcessor->getObjectItem(state, - CurrentModuleObject, - LoopIndex, - Alphas, - NumAlphas, - Numbers, - NumNumbers, - Status, - lNumericBlanks, - lAlphaBlanks, - cAlphaFields, - cNumericFields); - GlobalNames::VerifyUniqueInterObjectName( - state, state.dataScheduleMgr->UniqueScheduleNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - ++SchNum; - state.dataScheduleMgr->Schedule(SchNum).Name = Alphas(1); - state.dataScheduleMgr->Schedule(SchNum).SchType = SchedType::ScheduleInput_external; + for (int Loop = 1; Loop <= NumExternalInterfaceSchedules; ++Loop) { + s_ip->getObjectItem(state, + CurrentModuleObject, + Loop, + Alphas, + NumAlphas, + Numbers, + NumNumbers, + Status, + lNumericBlanks, + lAlphaBlanks, + cAlphaFields, + cNumericFields); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + + if (s_sched->scheduleMap.find(Alphas(1)) != s_sched->scheduleMap.end()) { + ShowSevereDuplicateName(state, eoh); + ErrorsFound = true; + continue; + } + + auto *sched = AddScheduleDetailed(state, Alphas(1)); + sched->type = SchedType::External; // Validate ScheduleType - CheckIndex = Util::FindItemInList(Alphas(2), state.dataScheduleMgr->ScheduleType({1, state.dataScheduleMgr->NumScheduleTypes})); - if (CheckIndex == 0) { - if (!lAlphaBlanks(2)) { - ShowWarningError(state, - format("{}{}=\"{}\", {}=\"{}\" not found -- will not be validated", - RoutineName, - CurrentModuleObject, - Alphas(1), - cAlphaFields(2), - Alphas(2))); - } else { - ShowWarningError( - state, - format( - "{}{}=\"{}\", Blank {} input -- will not be validated.", RoutineName, CurrentModuleObject, Alphas(1), cAlphaFields(2))); - } - } else { - state.dataScheduleMgr->Schedule(SchNum).ScheduleTypePtr = CheckIndex; - } - ++AddWeekSch; - state.dataScheduleMgr->WeekSchedule(AddWeekSch).Name = Alphas(1); - state.dataScheduleMgr->WeekSchedule(AddWeekSch).Used = true; - for (Hr = 1; Hr <= 366; ++Hr) { - state.dataScheduleMgr->Schedule(SchNum).WeekSchedulePointer(Hr) = AddWeekSch; - } - ++AddDaySch; - state.dataScheduleMgr->DaySchedule(AddDaySch).Name = Alphas(1); - state.dataScheduleMgr->DaySchedule(AddDaySch).ScheduleTypePtr = state.dataScheduleMgr->Schedule(SchNum).ScheduleTypePtr; - state.dataScheduleMgr->DaySchedule(AddDaySch).Used = true; - for (Hr = 1; Hr <= maxDayTypes; ++Hr) { - state.dataScheduleMgr->WeekSchedule(AddWeekSch).DaySchedulePointer(Hr) = AddDaySch; + if (lAlphaBlanks(2)) { + ShowWarningEmptyField(state, eoh, cAlphaFields(2)); + ShowContinueError(state, "Schedule will not be validated."); + } else if ((sched->schedTypeNum = GetScheduleTypeNum(state, Alphas(2))) == SchedNum_Invalid) { + ShowWarningItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ShowContinueError(state, "Schedule will not be validated."); } + + // TODO: I'm not sure this Jazz is necessary + // Add day schedule + auto *daySched = AddDaySchedule(state, format("{}_xi_dy_", Alphas(1))); + daySched->isUsed = true; + daySched->schedTypeNum = sched->schedTypeNum; + // Initialize the ExternalInterface day schedule for the ExternalInterface compact schedule. // It will be overwritten during run time stepping after the warm up period if (NumNumbers < 1) { - ShowWarningError( - state, - format("{}{}=\"{}\", initial value is not numeric or is missing. Fix idf file.", RoutineName, CurrentModuleObject, Alphas(1))); + ShowWarningCustom(state, eoh, "Initial value is not numeric or is missing. Fix idf file."); NumErrorFlag = true; } - ExternalInterfaceSetSchedule(state, AddDaySch, Numbers(1)); - } - // added for FMU Import - CurrentModuleObject = "ExternalInterface:FunctionalMockupUnitImport:To:Schedule"; - for (LoopIndex = 1; LoopIndex <= NumExternalInterfaceFunctionalMockupUnitImportSchedules; ++LoopIndex) { - - state.dataInputProcessing->inputProcessor->getObjectItem(state, - CurrentModuleObject, - LoopIndex, - Alphas, - NumAlphas, - Numbers, - NumNumbers, - Status, - lNumericBlanks, - lAlphaBlanks, - cAlphaFields, - cNumericFields); - - if (NumExternalInterfaceSchedules >= 1) { - GlobalNames::VerifyUniqueInterObjectName( - state, - state.dataScheduleMgr->UniqueScheduleNames, - Alphas(1), - CurrentModuleObject, - cAlphaFields(1) + "(defined as an ExternalInterface:Schedule and ExternalInterface:FunctionalMockupUnitImport:To:Schedule. This " - "will cause the schedule to be overwritten by PtolemyServer and FunctionalMockUpUnitImport)", - ErrorsFound); - } else { - GlobalNames::VerifyUniqueInterObjectName( - state, state.dataScheduleMgr->UniqueScheduleNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); + ExternalInterfaceSetSchedule(state, daySched->Num, Numbers(1)); + + auto *weekSched = AddWeekSchedule(state, format("{}_xi_wk_", Alphas(1))); + weekSched->isUsed = true; + for (int iDayType = 1; iDayType < (int)DayType::Num; ++iDayType) { + weekSched->dayScheds[iDayType] = daySched; } - ++SchNum; - state.dataScheduleMgr->Schedule(SchNum).Name = Alphas(1); - state.dataScheduleMgr->Schedule(SchNum).SchType = SchedType::ScheduleInput_external; - // Validate ScheduleType - CheckIndex = Util::FindItemInList(Alphas(2), state.dataScheduleMgr->ScheduleType({1, state.dataScheduleMgr->NumScheduleTypes})); - if (CheckIndex == 0) { - if (!lAlphaBlanks(2)) { - ShowWarningError(state, - format("{}{}=\"{}\", {}=\"{}\" not found -- will not be validated", - RoutineName, - CurrentModuleObject, - Alphas(1), - cAlphaFields(2), - Alphas(2))); - } else { - ShowWarningError( + for (int iDay = 1; iDay <= 366; ++iDay) { + sched->weekScheds[iDay] = weekSched; + } + } // for (Loop) + + // added for FMU Import + CurrentModuleObject = "ExternalInterface:FunctionalMockupUnitImport:To:Schedule"; + for (int Loop = 1; Loop <= NumExternalInterfaceFunctionalMockupUnitImportSchedules; ++Loop) { + s_ip->getObjectItem(state, + CurrentModuleObject, + Loop, + Alphas, + NumAlphas, + Numbers, + NumNumbers, + Status, + lNumericBlanks, + lAlphaBlanks, + cAlphaFields, + cNumericFields); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + + if (s_sched->scheduleMap.find(Alphas(1)) != s_sched->scheduleMap.end()) { + ShowSevereDuplicateName(state, eoh); + if (NumExternalInterfaceSchedules >= 1) { + ShowContinueError( state, - format( - "{}{}=\"{}\", Blank {} input -- will not be validated.", RoutineName, CurrentModuleObject, Alphas(1), cAlphaFields(2))); + format("{} defined as an ExternalInterface:Schedule and ExternalInterface:FunctionalMockupUnitImport:To:Schedule." + "This will cause the schedule to be overwritten by PtolemyServer and FunctionalMockUpUnitImport)", + cAlphaFields(1))); } - } else { - state.dataScheduleMgr->Schedule(SchNum).ScheduleTypePtr = CheckIndex; - } - ++AddWeekSch; - state.dataScheduleMgr->WeekSchedule(AddWeekSch).Name = Alphas(1); - state.dataScheduleMgr->WeekSchedule(AddWeekSch).Used = true; - for (Hr = 1; Hr <= 366; ++Hr) { - state.dataScheduleMgr->Schedule(SchNum).WeekSchedulePointer(Hr) = AddWeekSch; + ErrorsFound = true; + continue; } - ++AddDaySch; - state.dataScheduleMgr->DaySchedule(AddDaySch).Name = Alphas(1); - state.dataScheduleMgr->DaySchedule(AddDaySch).ScheduleTypePtr = state.dataScheduleMgr->Schedule(SchNum).ScheduleTypePtr; - state.dataScheduleMgr->DaySchedule(AddDaySch).Used = true; - for (Hr = 1; Hr <= maxDayTypes; ++Hr) { - state.dataScheduleMgr->WeekSchedule(AddWeekSch).DaySchedulePointer(Hr) = AddDaySch; + + auto *sched = AddScheduleDetailed(state, Alphas(1)); + sched->type = SchedType::External; + + // Validate ScheduleType + if (lAlphaBlanks(2)) { + ShowWarningEmptyField(state, eoh, cAlphaFields(2)); + ShowContinueError(state, "Schedule will not be validated."); + } else if ((sched->schedTypeNum = GetScheduleTypeNum(state, Alphas(2))) == SchedNum_Invalid) { + ShowWarningItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ShowContinueError(state, "Schedule will not be validated."); } + + // TODO: I'm not sure this Jazz is necessary + // Add day schedule + auto *daySched = AddDaySchedule(state, format("{}_xi_dy_", Alphas(1))); + daySched->isUsed = true; + daySched->schedTypeNum = sched->schedTypeNum; + // Initialize the ExternalInterface day schedule for the ExternalInterface compact schedule. // It will be overwritten during run time stepping after the warm up period if (NumNumbers < 1) { - ShowWarningError( - state, - format("{}{}=\"{}\", initial value is not numeric or is missing. Fix idf file.", RoutineName, CurrentModuleObject, Alphas(1))); + ShowWarningCustom(state, eoh, "Initial value is not numeric or is missing. Fix idf file."); NumErrorFlag = true; } - ExternalInterfaceSetSchedule(state, AddDaySch, Numbers(1)); + ExternalInterfaceSetSchedule(state, daySched->Num, Numbers(1)); + + auto *weekSched = AddWeekSchedule(state, format("{}_xi_wk_", Alphas(1))); + weekSched->isUsed = true; + for (int iDayType = 1; iDayType < (int)DayType::Num; ++iDayType) { + weekSched->dayScheds[iDayType] = daySched; + } + + for (int iDay = 1; iDay <= 366; ++iDay) { + sched->weekScheds[iDay] = weekSched; + } } // added for FMU Export CurrentModuleObject = "ExternalInterface:FunctionalMockupUnitExport:To:Schedule"; - for (LoopIndex = 1; LoopIndex <= NumExternalInterfaceFunctionalMockupUnitExportSchedules; ++LoopIndex) { - state.dataInputProcessing->inputProcessor->getObjectItem(state, - CurrentModuleObject, - LoopIndex, - Alphas, - NumAlphas, - Numbers, - NumNumbers, - Status, - lNumericBlanks, - lAlphaBlanks, - cAlphaFields, - cNumericFields); - - if (NumExternalInterfaceSchedules >= 1) { - GlobalNames::VerifyUniqueInterObjectName( - state, - state.dataScheduleMgr->UniqueScheduleNames, - Alphas(1), - CurrentModuleObject, - cAlphaFields(1) + "(defined as an ExternalInterface:Schedule and ExternalInterface:FunctionalMockupUnitExport:To:Schedule. This " - "will cause the schedule to be overwritten by PtolemyServer and FunctionalMockUpUnitExport)", - ErrorsFound); - } else { - GlobalNames::VerifyUniqueInterObjectName( - state, state.dataScheduleMgr->UniqueScheduleNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); + for (int Loop = 1; Loop <= NumExternalInterfaceFunctionalMockupUnitExportSchedules; ++Loop) { + s_ip->getObjectItem(state, + CurrentModuleObject, + Loop, + Alphas, + NumAlphas, + Numbers, + NumNumbers, + Status, + lNumericBlanks, + lAlphaBlanks, + cAlphaFields, + cNumericFields); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + + if (s_sched->scheduleMap.find(Alphas(1)) != s_sched->scheduleMap.end()) { + ShowSevereDuplicateName(state, eoh); + if (NumExternalInterfaceSchedules >= 1) { + ShowContinueError( + state, + format("{} defined as an ExternalInterface:Schedule and ExternalInterface:FunctionalMockupUnitImport:To:Schedule." + "This will cause the schedule to be overwritten by PtolemyServer and FunctionalMockUpUnitImport)", + cAlphaFields(1))); + } + ErrorsFound = true; + continue; } - ++SchNum; - state.dataScheduleMgr->Schedule(SchNum).Name = Alphas(1); - state.dataScheduleMgr->Schedule(SchNum).SchType = SchedType::ScheduleInput_external; + auto *sched = AddScheduleDetailed(state, Alphas(1)); + sched->type = SchedType::External; // Validate ScheduleType - CheckIndex = Util::FindItemInList(Alphas(2), state.dataScheduleMgr->ScheduleType({1, state.dataScheduleMgr->NumScheduleTypes})); - if (CheckIndex == 0) { - if (!lAlphaBlanks(2)) { - ShowWarningError(state, - format("{}{}=\"{}\", {}=\"{}\" not found -- will not be validated", - RoutineName, - CurrentModuleObject, - Alphas(1), - cAlphaFields(2), - Alphas(2))); - } else { - ShowWarningError( - state, - format( - "{}{}=\"{}\", Blank {} input -- will not be validated.", RoutineName, CurrentModuleObject, Alphas(1), cAlphaFields(2))); - } - } else { - state.dataScheduleMgr->Schedule(SchNum).ScheduleTypePtr = CheckIndex; - } - ++AddWeekSch; - state.dataScheduleMgr->WeekSchedule(AddWeekSch).Name = Alphas(1); - state.dataScheduleMgr->WeekSchedule(AddWeekSch).Used = true; - for (Hr = 1; Hr <= 366; ++Hr) { - state.dataScheduleMgr->Schedule(SchNum).WeekSchedulePointer(Hr) = AddWeekSch; - } - ++AddDaySch; - state.dataScheduleMgr->DaySchedule(AddDaySch).Name = Alphas(1); - state.dataScheduleMgr->DaySchedule(AddDaySch).ScheduleTypePtr = state.dataScheduleMgr->Schedule(SchNum).ScheduleTypePtr; - state.dataScheduleMgr->DaySchedule(AddDaySch).Used = true; - for (Hr = 1; Hr <= maxDayTypes; ++Hr) { - state.dataScheduleMgr->WeekSchedule(AddWeekSch).DaySchedulePointer(Hr) = AddDaySch; + if (lAlphaBlanks(2)) { + ShowWarningEmptyField(state, eoh, cAlphaFields(2)); + ShowContinueError(state, "Schedule will not be validated."); + } else if ((sched->schedTypeNum = GetScheduleTypeNum(state, Alphas(2))) == SchedNum_Invalid) { + ShowWarningItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ShowContinueError(state, "Schedule will not be validated."); } + + // TODO: I'm not sure this Jazz is necessary + // Add day schedule + auto *daySched = AddDaySchedule(state, format("{}_xi_dy_", Alphas(1))); + daySched->isUsed = true; + daySched->schedTypeNum = sched->schedTypeNum; + // Initialize the ExternalInterface day schedule for the ExternalInterface compact schedule. // It will be overwritten during run time stepping after the warm up period if (NumNumbers < 1) { - ShowWarningError( - state, - format("{}{}=\"{}\", initial value is not numeric or is missing. Fix idf file.", RoutineName, CurrentModuleObject, Alphas(1))); + ShowWarningCustom(state, eoh, "Initial value is not numeric or is missing. Fix idf file."); NumErrorFlag = true; } - ExternalInterfaceSetSchedule(state, AddDaySch, Numbers(1)); - } + ExternalInterfaceSetSchedule(state, daySched->Num, Numbers(1)); + + auto *weekSched = AddWeekSchedule(state, format("{}_xi_wk_", Alphas(1))); + weekSched->isUsed = true; + for (int iDayType = 1; iDayType < (int)DayType::Num; ++iDayType) { + weekSched->dayScheds[iDayType] = daySched; + } + + std::fill(sched->weekScheds.begin() + 1, sched->weekScheds.end(), weekSched); + } // for (Loop) // Validate by ScheduleLimitsType - for (SchNum = 1; SchNum <= state.dataScheduleMgr->NumSchedules; ++SchNum) { - NumPointer = state.dataScheduleMgr->Schedule(SchNum).ScheduleTypePtr; - if (!state.dataScheduleMgr->ScheduleType(NumPointer).Limited) continue; - if (CheckScheduleValueMinMax(state, - SchNum, - ">=", - state.dataScheduleMgr->ScheduleType(NumPointer).Minimum, - "<=", - state.dataScheduleMgr->ScheduleType(NumPointer).Maximum)) - continue; - ShowSevereError(state, - format("{}Schedule=\"{}\" has values outside its Schedule Type ({}) range", - RoutineName, - state.dataScheduleMgr->Schedule(SchNum).Name, - state.dataScheduleMgr->ScheduleType(NumPointer).Name)); - ShowContinueError(state, - format(" Minimum should be >={:.3R} and Maximum should be <={:.3R}", - state.dataScheduleMgr->ScheduleType(NumPointer).Minimum, - state.dataScheduleMgr->ScheduleType(NumPointer).Maximum)); - ErrorsFound = true; + for (auto *sched : s_sched->schedules) { + + if (sched->schedTypeNum == SchedNum_Invalid) continue; + + auto const *schedType = s_sched->scheduleTypes[sched->schedTypeNum]; + if (!schedType->isLimited) continue; + + if (!sched->checkMinMaxVals(state, Clusive::In, schedType->minVal, Clusive::In, schedType->maxVal)) { + ErrorObjectHeader eoh{routineName, "Schedule", sched->Name}; + ShowSevereBadMinMax(state, eoh, "", "", Clusive::In, schedType->minVal, Clusive::In, schedType->maxVal); + ErrorsFound = true; + } } if (ErrorsFound) { - ShowFatalError(state, format("{}Preceding Errors cause termination.", RoutineName)); + ShowFatalError(state, format("{}: Preceding Errors cause termination.", routineName)); } - if (state.dataScheduleMgr->NumScheduleTypes + state.dataScheduleMgr->NumDaySchedules + state.dataScheduleMgr->NumWeekSchedules + - state.dataScheduleMgr->NumSchedules > - 0) { // Report to EIO file + if (s_sched->scheduleTypes.size() + s_sched->daySchedules.size() + s_sched->weekSchedules.size() + s_sched->schedules.size() > 0) { CurrentModuleObject = "Output:Schedules"; - NumFields = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + NumFields = s_ip->getNumObjectsFound(state, CurrentModuleObject); // RptSchedule=.FALSE. RptLevel = 1; - for (Count = 1; Count <= NumFields; ++Count) { - state.dataInputProcessing->inputProcessor->getObjectItem( - state, CurrentModuleObject, Count, Alphas, NumAlphas, Numbers, NumNumbers, Status); - // RptSchedule=.TRUE. + for (int Count = 1; Count <= NumFields; ++Count) { + s_ip->getObjectItem(state, CurrentModuleObject, Count, Alphas, NumAlphas, Numbers, NumNumbers, Status); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; // IDD only allows Hourly or Timestep as valid values on the required field, anything else should be an error in the input processor - OutputReportLevel reportLevel = - static_cast(getEnumValue(outputScheduleReportLevelNamesUC, Alphas(1))); // NOLINT(modernize-use-auto) - if (reportLevel == OutputReportLevel::Invalid) { - ShowWarningError(state, format("{}Report for Schedules should specify \"HOURLY\" or \"TIMESTEP\" (\"DETAILED\")", RoutineName)); - ShowContinueError(state, "HOURLY report will be done"); - reportLevel = OutputReportLevel::Hourly; + ReportLevel reportLevel = static_cast(getEnumValue(reportLevelNamesUC, Alphas(1))); + if (reportLevel == ReportLevel::Invalid) { + ShowWarningInvalidKey(state, eoh, cAlphaFields(1), Alphas(1), "HOURLY report will be done"); + reportLevel = ReportLevel::Hourly; } ReportScheduleDetails(state, reportLevel); } @@ -2356,16 +2053,15 @@ namespace ScheduleManager { lNumericBlanks.deallocate(); print(state.files.audit, "{}\n", " Processing Schedule Input -- Complete"); - } + } // ProcessScheduleInput() void ReportScheduleDetails(EnergyPlusData &state, - OutputReportLevel const LevelOfDetail) // =1: hourly; =2: timestep; = 3: make IDF excerpt + ReportLevel const LevelOfDetail) // =1: hourly; =2: timestep; = 3: make IDF excerpt { // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN January 2003 // MODIFIED February 2008 - add IDF outputs (compact schedules) - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine puts the details of the Schedules on the .eio file (Inits file). @@ -2388,32 +2084,35 @@ namespace ScheduleManager { Array2D_string RoundTSValue; std::string_view constexpr SchDFmtdata{",{}"}; - ShowMinute.allocate(state.dataGlobal->NumOfTimeStepInHour); - TimeHHMM.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); - RoundTSValue.allocate(state.dataGlobal->NumOfTimeStepInHour, 24); + auto const &s_glob = state.dataGlobal; + auto const &s_sched = state.dataSched; + + ShowMinute.allocate(s_glob->TimeStepsInHour); + TimeHHMM.allocate(s_glob->TimeStepsInHour * Constant::iHoursInDay); + RoundTSValue.allocate(s_glob->TimeStepsInHour, Constant::iHoursInDay); ShowMinute = std::string{}; TimeHHMM = std::string{}; RoundTSValue = std::string{}; - int CurMinute = state.dataGlobal->MinutesPerTimeStep; - for (int Count = 1; Count <= state.dataGlobal->NumOfTimeStepInHour - 1; ++Count) { + int CurMinute = s_glob->MinutesInTimeStep; + for (int Count = 1; Count <= s_glob->TimeStepsInHour - 1; ++Count) { ShowMinute(Count) = format("{:02}", CurMinute); - CurMinute += state.dataGlobal->MinutesPerTimeStep; + CurMinute += s_glob->MinutesInTimeStep; } - ShowMinute(state.dataGlobal->NumOfTimeStepInHour) = "00"; + ShowMinute(s_glob->TimeStepsInHour) = "00"; switch (LevelOfDetail) { - case OutputReportLevel::Hourly: - case OutputReportLevel::TimeStep: + case ReportLevel::Hourly: + case ReportLevel::TimeStep: { NumF = 1; - for (int Hr = 1; Hr <= 24; ++Hr) { - if (LevelOfDetail == OutputReportLevel::TimeStep) { - for (int TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour - 1; ++TS) { - TimeHHMM(NumF) = format("{}:{}", HrField[Hr - 1], ShowMinute(TS)); + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) { + if (LevelOfDetail == ReportLevel::TimeStep) { + for (int ts = 1; ts <= s_glob->TimeStepsInHour - 1; ++ts) { + TimeHHMM(NumF) = format("{}:{}", HrField[hr], ShowMinute(ts)); ++NumF; } } - TimeHHMM(NumF) = format("{}:{}", HrField[Hr], ShowMinute(state.dataGlobal->NumOfTimeStepInHour)); + TimeHHMM(NumF) = format("{}:{}", HrField[hr + 1], ShowMinute(s_glob->TimeStepsInHour)); ++NumF; } --NumF; @@ -2422,7 +2121,7 @@ namespace ScheduleManager { { std::string_view constexpr SchTFmt0("! Schedule Details Report={} =====================\n"); std::string_view constexpr SchDFmt{",{}"}; - print(state.files.eio, SchTFmt0, outputScheduleReportLevelNames[static_cast(LevelOfDetail)]); + print(state.files.eio, SchTFmt0, reportLevelNames[(int)LevelOfDetail]); std::string_view constexpr SchTFmt("! ,Name,Limited? {Yes/No},Minimum,Maximum,Continuous? {Yes/No - Discrete}"); print(state.files.eio, "{}\n", SchTFmt); @@ -2434,27 +2133,27 @@ namespace ScheduleManager { print(state.files.eio, "\n"); // SchWFmt Header (WeekSchedule) std::string SchWFmt("! ,Name"); - for (int Count = 1; Count <= maxDayTypes; ++Count) { - SchWFmt += "," + static_cast(dayTypeNames[Count]); + for (int Count = 1; Count < (int)DayType::Num; ++Count) { + SchWFmt = format("{},{}", SchWFmt, dayTypeNames[Count]); } print(state.files.eio, "{}\n", SchWFmt); std::string_view constexpr SchSFmt("! ,Name,ScheduleType,{Until Date,WeekSchedule}** Repeated until Dec 31"); print(state.files.eio, "{}\n", SchSFmt); } - for (int Count = 1; Count <= state.dataScheduleMgr->NumScheduleTypes; ++Count) { - if (state.dataScheduleMgr->ScheduleType(Count).Limited) { + for (auto const *schedType : s_sched->scheduleTypes) { + if (schedType->isLimited) { NoAverageLinear = "Average"; - Num1 = format("{:.2R}", state.dataScheduleMgr->ScheduleType(Count).Minimum); + Num1 = format("{:.2R}", schedType->minVal); strip(Num1); - Num2 = format("{:.2R}", state.dataScheduleMgr->ScheduleType(Count).Maximum); + Num2 = format("{:.2R}", schedType->maxVal); strip(Num2); - if (state.dataScheduleMgr->ScheduleType(Count).IsReal) { + if (schedType->isReal) { YesNo2 = "Yes"; } else { YesNo2 = "No"; - Num1 = fmt::to_string(static_cast(state.dataScheduleMgr->ScheduleType(Count).Minimum)); - Num2 = fmt::to_string(static_cast(state.dataScheduleMgr->ScheduleType(Count).Maximum)); + Num1 = fmt::to_string((int)schedType->minVal); + Num2 = fmt::to_string((int)schedType->maxVal); } } else { NoAverageLinear = "No"; @@ -2463,110 +2162,114 @@ namespace ScheduleManager { YesNo2 = "N/A"; } std::string_view constexpr SchTFmtdata("ScheduleTypeLimits,{},{},{},{},{}\n"); - print(state.files.eio, SchTFmtdata, state.dataScheduleMgr->ScheduleType(Count).Name, NoAverageLinear, Num1, Num2, YesNo2); + print(state.files.eio, SchTFmtdata, schedType->Name, NoAverageLinear, Num1, Num2, YesNo2); } - for (int Count = 1; Count <= state.dataScheduleMgr->NumDaySchedules; ++Count) { - NoAverageLinear = interpolationTypes[static_cast(state.dataScheduleMgr->DaySchedule(Count).IntervalInterpolated)]; - for (int Hr = 1; Hr <= 24; ++Hr) { - for (int TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { - RoundTSValue(TS, Hr) = format("{:.2R}", state.dataScheduleMgr->DaySchedule(Count).TSValue(TS, Hr)); + for (auto *daySched : s_sched->daySchedules) { + + NoAverageLinear = interpolationNames[(int)daySched->interpolation]; + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) { + for (int ts = 0; ts < s_glob->TimeStepsInHour; ++ts) { + RoundTSValue(ts + 1, hr + 1) = format("{:.2R}", daySched->tsVals[hr * s_glob->TimeStepsInHour + ts]); } } std::string_view constexpr SchDFmtdata0("DaySchedule,{},{},{},{}"); - print(state.files.eio, - SchDFmtdata0, - state.dataScheduleMgr->DaySchedule(Count).Name, - state.dataScheduleMgr->ScheduleType(state.dataScheduleMgr->DaySchedule(Count).ScheduleTypePtr).Name, - NoAverageLinear, - "Values:"); + print( + state.files.eio, SchDFmtdata0, daySched->Name, s_sched->scheduleTypes[daySched->schedTypeNum]->Name, NoAverageLinear, "Values:"); + switch (LevelOfDetail) { - case OutputReportLevel::Hourly: - for (int Hr = 1; Hr <= 24; ++Hr) { - print(state.files.eio, SchDFmtdata, RoundTSValue(state.dataGlobal->NumOfTimeStepInHour, Hr)); + case ReportLevel::Hourly: { + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) { + print(state.files.eio, SchDFmtdata, RoundTSValue(s_glob->TimeStepsInHour, hr + 1)); } - break; - case OutputReportLevel::TimeStep: - for (int Hr = 1; Hr <= 24; ++Hr) { - for (int TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { - print(state.files.eio, SchDFmtdata, RoundTSValue(TS, Hr)); + } break; + + case ReportLevel::TimeStep: { + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) { + for (int ts = 0; ts < s_glob->TimeStepsInHour; ++ts) { + print(state.files.eio, SchDFmtdata, RoundTSValue(ts + 1, hr + 1)); } } - break; + } break; default: assert(false); } print(state.files.eio, "\n"); } - for (int Count = 1; Count <= state.dataScheduleMgr->NumWeekSchedules; ++Count) { + for (auto *weekSched : s_sched->weekSchedules) { + std::string_view constexpr SchWFmtdata("Schedule:Week:Daily,{}"); - print(state.files.eio, SchWFmtdata, state.dataScheduleMgr->WeekSchedule(Count).Name); - for (NumF = 1; NumF <= maxDayTypes; ++NumF) { - print(state.files.eio, - ",{}", - state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(Count).DaySchedulePointer(NumF)).Name); + print(state.files.eio, SchWFmtdata, weekSched->Name); + + for (int NumF = 1; NumF < (int)DayType::Num; ++NumF) { + print(state.files.eio, ",{}", weekSched->dayScheds[NumF]->Name); } print(state.files.eio, "\n"); } - for (int Count = 1; Count <= state.dataScheduleMgr->NumSchedules; ++Count) { - NumF = 1; - print(state.files.eio, - "Schedule,{},{}", - state.dataScheduleMgr->Schedule(Count).Name, - state.dataScheduleMgr->ScheduleType(state.dataScheduleMgr->Schedule(Count).ScheduleTypePtr).Name); + for (auto *sched : s_sched->schedules) { + + if (sched->type == SchedType::Constant) continue; + + auto *schedDetailed = dynamic_cast(sched); + assert(schedDetailed != nullptr); + + int NumF = 1; + print(state.files.eio, "Schedule,{},{}", schedDetailed->Name, s_sched->scheduleTypes[sched->schedTypeNum]->Name); while (NumF <= 366) { - int TS = state.dataScheduleMgr->Schedule(Count).WeekSchedulePointer(NumF); + + auto *weekSched = schedDetailed->weekScheds[NumF]; std::string_view constexpr ThruFmt(",Through {} {:02},{}"); - while (state.dataScheduleMgr->Schedule(Count).WeekSchedulePointer(NumF) == TS && NumF <= 366) { + while (schedDetailed->weekScheds[NumF] == weekSched && NumF <= 366) { if (NumF == 366) { General::InvOrdinalDay(NumF, PMon, PDay, 1); - print(state.files.eio, ThruFmt, Months[PMon - 1], PDay, state.dataScheduleMgr->WeekSchedule(TS).Name); + print(state.files.eio, ThruFmt, Months[PMon - 1], PDay, weekSched->Name); } ++NumF; if (NumF > 366) break; // compound If might have a problem unless this included. } if (NumF <= 366) { General::InvOrdinalDay(NumF - 1, PMon, PDay, 1); - print(state.files.eio, ThruFmt, Months[PMon - 1], PDay, state.dataScheduleMgr->WeekSchedule(TS).Name); + print(state.files.eio, ThruFmt, Months[PMon - 1], PDay, weekSched->Name); } } print(state.files.eio, "\n"); } - break; + } break; + default: break; } // So this section of the code was not accessible. The input processor would never have let anything but hourly or timestep on the object // This code is obviously not covered by any of our integration or unit tests. - // for (Count = 1; Count <= state.dataScheduleMgr->NumSchedules; ++Count) { + // for (Count = 1; Count <= s_sched->NumSchedules; ++Count) { // print(state.files.debug, "\n"); // print(state.files.debug, " Schedule:Compact,\n"); - // print(state.files.debug, " {}, !- Name\n", state.dataScheduleMgr->Schedule(Count).Name); + // print(state.files.debug, " {}, !- Name\n", s_sched->Schedule(Count).Name); // print(state.files.debug, // " {}, !- ScheduleTypeLimits\n", - // state.dataScheduleMgr->ScheduleType(state.dataScheduleMgr->Schedule(Count).ScheduleTypePtr).Name); + // s_sched->ScheduleType(s_sched->Schedule(Count).ScheduleTypePtr).Name); // NumF = 1; // while (NumF <= 366) { - // TS = state.dataScheduleMgr->Schedule(Count).WeekSchedulePointer(NumF); - // while (state.dataScheduleMgr->Schedule(Count).WeekSchedulePointer(NumF) == TS && NumF <= 366) { + // TS = s_sched->Schedule(Count).WeekSchedulePointer(NumF); + // while (s_sched->Schedule(Count).WeekSchedulePointer(NumF) == TS && NumF <= 366) { // if (NumF == 366) { // General::InvOrdinalDay(NumF, PMon, PDay, 1); // print(state.files.debug, " Through: {}/{},\n", PMon, PDay); // iDayP = 0; // for (DT = 2; DT <= 6; ++DT) { // print(state.files.debug, " For: {},\n", ValidDayTypes(DT)); - // iWeek = state.dataScheduleMgr->Schedule(Count).WeekSchedulePointer(NumF - 1); - // iDay = state.dataScheduleMgr->WeekSchedule(iWeek).DaySchedulePointer(DT); + // iWeek = s_sched->Schedule(Count).WeekSchedulePointer(NumF - 1); + // iDay = s_sched->WeekSchedule(iWeek).DaySchedulePointer(DT); // if (iDay != iDayP) { // for (Hr = 1; Hr <= 24; ++Hr) { // print(state.files.debug, // " Until: {}:{},{:.2R},\n", // Hr, - // ShowMinute(state.dataGlobal->NumOfTimeStepInHour), - // state.dataScheduleMgr->DaySchedule(iDay).TSValue(state.dataGlobal->NumOfTimeStepInHour, Hr)); + // ShowMinute(s_glob->NumOfTimeStepInHour), + // s_sched->DaySchedule(iDay).TSValue(s_glob->NumOfTimeStepInHour, Hr)); // } // } else { // print(state.files.debug, " Same as previous\n"); @@ -2575,15 +2278,15 @@ namespace ScheduleManager { // } // DT = 1; // print(state.files.debug, " For: {},\n", ValidDayTypes(DT)); - // iWeek = state.dataScheduleMgr->Schedule(Count).WeekSchedulePointer(NumF - 1); - // iDay = state.dataScheduleMgr->WeekSchedule(iWeek).DaySchedulePointer(DT); + // iWeek = s_sched->Schedule(Count).WeekSchedulePointer(NumF - 1); + // iDay = s_sched->WeekSchedule(iWeek).DaySchedulePointer(DT); // if (iDay != iDayP) { // for (Hr = 1; Hr <= 24; ++Hr) { // print(state.files.debug, // " Until: {}:{},{:.2R},\n", // Hr, - // ShowMinute(state.dataGlobal->NumOfTimeStepInHour), - // state.dataScheduleMgr->DaySchedule(iDay).TSValue(state.dataGlobal->NumOfTimeStepInHour, Hr)); + // ShowMinute(s_glob->NumOfTimeStepInHour), + // s_sched->DaySchedule(iDay).TSValue(s_glob->NumOfTimeStepInHour, Hr)); // } // } else { // print(state.files.debug, " Same as previous\n"); @@ -2591,15 +2294,15 @@ namespace ScheduleManager { // iDayP = iDay; // for (DT = 7; DT <= MaxDayTypes; ++DT) { // print(state.files.debug, " For: {},\n", ValidDayTypes(DT)); - // iWeek = state.dataScheduleMgr->Schedule(Count).WeekSchedulePointer(NumF - 1); - // iDay = state.dataScheduleMgr->WeekSchedule(iWeek).DaySchedulePointer(DT); + // iWeek = s_sched->Schedule(Count).WeekSchedulePointer(NumF - 1); + // iDay = s_sched->WeekSchedule(iWeek).DaySchedulePointer(DT); // if (iDay != iDayP) { // for (Hr = 1; Hr <= 24; ++Hr) { // print(state.files.debug, // " Until: {}:{},{:.2R},\n", // Hr, - // ShowMinute(state.dataGlobal->NumOfTimeStepInHour), - // state.dataScheduleMgr->DaySchedule(iDay).TSValue(state.dataGlobal->NumOfTimeStepInHour, Hr)); + // ShowMinute(s_glob->NumOfTimeStepInHour), + // s_sched->DaySchedule(iDay).TSValue(s_glob->NumOfTimeStepInHour, Hr)); // } // } else { // print(state.files.debug, " Same as previous\n"); @@ -2616,15 +2319,15 @@ namespace ScheduleManager { // iDayP = 0; // for (DT = 2; DT <= 6; ++DT) { // print(state.files.debug, " For: {},\n", ValidDayTypes(DT)); - // iWeek = state.dataScheduleMgr->Schedule(Count).WeekSchedulePointer(NumF - 1); - // iDay = state.dataScheduleMgr->WeekSchedule(iWeek).DaySchedulePointer(DT); + // iWeek = s_sched->Schedule(Count).WeekSchedulePointer(NumF - 1); + // iDay = s_sched->WeekSchedule(iWeek).DaySchedulePointer(DT); // if (iDay != iDayP) { // for (Hr = 1; Hr <= 24; ++Hr) { // print(state.files.debug, // " Until: {}:{},{:.2R},\n", // Hr, - // ShowMinute(state.dataGlobal->NumOfTimeStepInHour), - // state.dataScheduleMgr->DaySchedule(iDay).TSValue(state.dataGlobal->NumOfTimeStepInHour, Hr)); + // ShowMinute(s_glob->NumOfTimeStepInHour), + // s_sched->DaySchedule(iDay).TSValue(s_glob->NumOfTimeStepInHour, Hr)); // } // } else { // print(state.files.debug, " Same as previous\n"); @@ -2633,15 +2336,15 @@ namespace ScheduleManager { // } // DT = 1; // print(state.files.debug, " For: {},\n", ValidDayTypes(DT)); - // iWeek = state.dataScheduleMgr->Schedule(Count).WeekSchedulePointer(NumF - 1); - // iDay = state.dataScheduleMgr->WeekSchedule(iWeek).DaySchedulePointer(DT); + // iWeek = s_sched->Schedule(Count).WeekSchedulePointer(NumF - 1); + // iDay = s_sched->WeekSchedule(iWeek).DaySchedulePointer(DT); // if (iDay != iDayP) { // for (Hr = 1; Hr <= 24; ++Hr) { // print(state.files.debug, // " Until: {}:{},{:.2R},\n", // Hr, - // ShowMinute(state.dataGlobal->NumOfTimeStepInHour), - // state.dataScheduleMgr->DaySchedule(iDay).TSValue(state.dataGlobal->NumOfTimeStepInHour, Hr)); + // ShowMinute(s_glob->NumOfTimeStepInHour), + // s_sched->DaySchedule(iDay).TSValue(s_glob->NumOfTimeStepInHour, Hr)); // } // } else { // print(state.files.debug, " Same as previous\n"); @@ -2649,15 +2352,15 @@ namespace ScheduleManager { // iDayP = iDay; // for (DT = 7; DT <= MaxDayTypes; ++DT) { // print(state.files.debug, " For: {},\n", ValidDayTypes(DT)); - // iWeek = state.dataScheduleMgr->Schedule(Count).WeekSchedulePointer(NumF - 1); - // iDay = state.dataScheduleMgr->WeekSchedule(iWeek).DaySchedulePointer(DT); + // iWeek = s_sched->Schedule(Count).WeekSchedulePointer(NumF - 1); + // iDay = s_sched->WeekSchedule(iWeek).DaySchedulePointer(DT); // if (iDay != iDayP) { // for (Hr = 1; Hr <= 24; ++Hr) { // print(state.files.debug, // " Until: {}:{},{:.2R},\n", // Hr, - // ShowMinute(state.dataGlobal->NumOfTimeStepInHour), - // state.dataScheduleMgr->DaySchedule(iDay).TSValue(state.dataGlobal->NumOfTimeStepInHour, Hr)); + // ShowMinute(s_glob->NumOfTimeStepInHour), + // s_sched->DaySchedule(iDay).TSValue(s_glob->NumOfTimeStepInHour, Hr)); // } // } else { // print(state.files.debug, " Same as previous\n"); @@ -2671,67 +2374,19 @@ namespace ScheduleManager { ShowMinute.deallocate(); TimeHHMM.deallocate(); RoundTSValue.deallocate(); - } + } // ReportScheduleDetails() - Real64 GetCurrentScheduleValue(EnergyPlusData &state, int const ScheduleIndex) + Real64 GetCurrentScheduleValue(EnergyPlusData const &state, int const schedNum) { - // FUNCTION INFORMATION: - // AUTHOR Linda K. Lawrie - // DATE WRITTEN September 1997 - // MODIFIED August 2011; adapt Autodesk changes (time reduction) - // RE-ENGINEERED na - - // PURPOSE OF THIS FUNCTION: - // This function returns the hourly schedule value for the current day. - - // METHODOLOGY EMPLOYED: - // Use internal Schedule data structure to return value. Note that missing values in - // input will equate to 0 indices in arrays -- which has been set up to return legally with - // 0.0 values. - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Return value - - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - // na - - // Checking if valid index is passed is necessary - if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOn) { - return 1.0; - } else if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOff) { - return 0.0; - } else if (!state.dataScheduleMgr->Schedule(ScheduleIndex).EMSActuatedOn) { - return state.dataScheduleMgr->Schedule(ScheduleIndex) - .CurrentValue; // This block probably unecessary, UpdateScheduleValues already does it - } else { - return state.dataScheduleMgr->Schedule(ScheduleIndex).EMSValue; - } + // Wrapper for method + return state.dataSched->schedules[schedNum]->getCurrentVal(); } - void UpdateScheduleValues(EnergyPlusData &state) + void UpdateScheduleVals(EnergyPlusData &state) { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN August 2011; adapted from Autodesk (time reduction) - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This routine calculates all the scheduled values as a time reduction measure and @@ -2739,49 +2394,23 @@ namespace ScheduleManager { // METHODOLOGY EMPLOYED: // Use internal Schedule data structure to calculate current value. Note that missing values in - // input will equate to 0 indices in arrays -- which has been set up to return legally with - // 0.0 values. - - // REFERENCES: - // na - - // Using/Aliasing - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - - if (!state.dataScheduleMgr->ScheduleInputProcessed) { - ProcessScheduleInput(state); - state.dataScheduleMgr->ScheduleInputProcessed = true; - } + auto const &s_sched = state.dataSched; + auto const &s_glob = state.dataGlobal; - for (int ScheduleIndex = 1; ScheduleIndex <= state.dataScheduleMgr->NumSchedules; ++ScheduleIndex) { - if (state.dataScheduleMgr->Schedule(ScheduleIndex).EMSActuatedOn) { - state.dataScheduleMgr->Schedule(ScheduleIndex).CurrentValue = state.dataScheduleMgr->Schedule(ScheduleIndex).EMSValue; + for (auto *sched : s_sched->schedules) { + if (sched->EMSActuatedOn) { + sched->currentVal = sched->EMSVal; } else { - state.dataScheduleMgr->Schedule(ScheduleIndex).CurrentValue = - LookUpScheduleValue(state, ScheduleIndex, state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep); + sched->currentVal = sched->getHrTsVal(state, s_glob->HourOfDay, s_glob->TimeStep); } } } - Real64 LookUpScheduleValue(EnergyPlusData &state, - int const ScheduleIndex, - int const ThisHour, - int const ThisTimeStep // Negative => unspecified - ) + Real64 ScheduleDetailed::getHrTsVal(EnergyPlusData &state, + int hr, + int ts // Negative => unspecified + ) const { // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie @@ -2789,42 +2418,27 @@ namespace ScheduleManager { // PURPOSE OF THIS FUNCTION: // This function provides a method to look up schedule values for any hour, timestep, day // of the year (rather than just the "current time"). + auto const &s_glob = state.dataGlobal; - // Return value - Real64 scheduleValue(0.0); - - if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOn) { - return 1.0; - } else if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOff) { - return 0.0; - } - - if (!state.dataScheduleMgr->ScheduleInputProcessed) { - ProcessScheduleInput(state); - state.dataScheduleMgr->ScheduleInputProcessed = true; - } - - if (state.dataScheduleMgr->Schedule(ScheduleIndex).EMSActuatedOn) { - return state.dataScheduleMgr->Schedule(ScheduleIndex).EMSValue; - } + if (this->EMSActuatedOn) return this->EMSVal; // so, current date, but maybe TimeStep added // Hourly Value - if (ThisHour > 24) { - ShowFatalError(state, format("LookUpScheduleValue called with thisHour={}", ThisHour)); + if (hr > Constant::iHoursInDay) { + ShowFatalError(state, format("LookUpScheduleValue called with thisHour={}", hr)); } - int thisHour = ThisHour + state.dataEnvrn->DSTIndicator * state.dataScheduleMgr->Schedule(ScheduleIndex).UseDaylightSaving; + int thisHr = hr + state.dataEnvrn->DSTIndicator * this->UseDaylightSaving; int thisDayOfYear = state.dataEnvrn->DayOfYear_Schedule; int thisDayOfWeek = state.dataEnvrn->DayOfWeek; - int thisHolidayIndex = state.dataEnvrn->HolidayIndex; - if (thisHour > 24) { // In case HourOfDay is 24 and DSTIndicator is 1, you're actually the next day + int thisHolidayNum = state.dataEnvrn->HolidayIndex; + if (thisHr > Constant::iHoursInDay) { // In case HourOfDay is 24 and DSTIndicator is 1, you're actually the next day thisDayOfYear += 1; - thisHour -= 24; + thisHr -= Constant::iHoursInDay; thisDayOfWeek = state.dataEnvrn->DayOfWeekTomorrow; - thisHolidayIndex = state.dataEnvrn->HolidayIndexTomorrow; + thisHolidayNum = state.dataEnvrn->HolidayIndexTomorrow; } // In the case where DST is applied on 12/31 at 24:00, which is the case for a Southern Hemisphere location for eg @@ -2833,276 +2447,181 @@ namespace ScheduleManager { thisDayOfYear = 1; } - int WeekSchedulePointer = state.dataScheduleMgr->Schedule(ScheduleIndex).WeekSchedulePointer(thisDayOfYear); - int DaySchedulePointer; - - if (thisHolidayIndex > 0) { - DaySchedulePointer = state.dataScheduleMgr->WeekSchedule(WeekSchedulePointer).DaySchedulePointer(thisHolidayIndex); - } else { - DaySchedulePointer = state.dataScheduleMgr->WeekSchedule(WeekSchedulePointer).DaySchedulePointer(thisDayOfWeek); - } + auto const *weekSched = this->weekScheds[thisDayOfYear]; + auto const *daySched = (thisHolidayNum > 0) ? weekSched->dayScheds[thisHolidayNum] : weekSched->dayScheds[thisDayOfWeek]; // If Unspecified or equal to zero, use NumOfTimeStepInHour, otherwise use supplied - int thisTimeStep = ThisTimeStep > 0 ? ThisTimeStep : state.dataGlobal->NumOfTimeStepInHour; - scheduleValue = state.dataScheduleMgr->DaySchedule(DaySchedulePointer).TSValue(thisTimeStep, thisHour); + if (ts <= 0) ts = s_glob->TimeStepsInHour; - return scheduleValue; - } + return daySched->tsVals[(thisHr - 1) * s_glob->TimeStepsInHour + (ts - 1)]; + } // ScheduleDetailed::getHrTsVal() - int GetScheduleIndex(EnergyPlusData &state, std::string const &ScheduleName) + Real64 ScheduleConstant::getHrTsVal([[maybe_unused]] EnergyPlusData &state, [[maybe_unused]] int hr, [[maybe_unused]] int ts) const { - // FUNCTION INFORMATION: - // AUTHOR Linda K. Lawrie - // DATE WRITTEN September 1997 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS FUNCTION: - // This function returns the internal pointer to Schedule "ScheduleName". - - // Return value - int GetScheduleIndex; - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - int DayCtr; - int WeekCtr; + return this->currentVal; + } // ScheduleConstant::getHrTsVal() - if (!state.dataScheduleMgr->ScheduleInputProcessed) { - ProcessScheduleInput(state); - state.dataScheduleMgr->ScheduleInputProcessed = true; - } - - if (state.dataScheduleMgr->NumSchedules > 0) { - GetScheduleIndex = Util::FindItemInList(ScheduleName, state.dataScheduleMgr->Schedule({1, state.dataScheduleMgr->NumSchedules})); - if (GetScheduleIndex > 0) { - if (!state.dataScheduleMgr->Schedule(GetScheduleIndex).Used) { - state.dataScheduleMgr->Schedule(GetScheduleIndex).Used = true; - for (WeekCtr = 1; WeekCtr <= 366; ++WeekCtr) { - if (state.dataScheduleMgr->Schedule(GetScheduleIndex).WeekSchedulePointer(WeekCtr) > 0) { - state.dataScheduleMgr->WeekSchedule(state.dataScheduleMgr->Schedule(GetScheduleIndex).WeekSchedulePointer(WeekCtr)).Used = - true; - for (DayCtr = 1; DayCtr <= maxDayTypes; ++DayCtr) { - state.dataScheduleMgr - ->DaySchedule(state.dataScheduleMgr - ->WeekSchedule(state.dataScheduleMgr->Schedule(GetScheduleIndex).WeekSchedulePointer(WeekCtr)) - .DaySchedulePointer(DayCtr)) - .Used = true; - } - } - } - } - } - } else { - GetScheduleIndex = 0; - } + Sched::Schedule *GetScheduleAlwaysOn(EnergyPlusData &state) + { + return state.dataSched->schedules[SchedNum_AlwaysOn]; + } - return GetScheduleIndex; + Sched::Schedule *GetScheduleAlwaysOff(EnergyPlusData &state) + { + return state.dataSched->schedules[SchedNum_AlwaysOff]; } - std::string GetScheduleType(EnergyPlusData &state, int const ScheduleIndex) + Sched::Schedule *GetSchedule(EnergyPlusData &state, std::string const &name) { // FUNCTION INFORMATION: - // AUTHOR Jason Glazer - // DATE WRITTEN July 2007 - // MODIFIED na - // RE-ENGINEERED na + // AUTHOR Linda K. Lawrie + // DATE WRITTEN September 1997 // PURPOSE OF THIS FUNCTION: - // This function returns the internal pointer to Schedule "ScheduleName" (actually, it doesn't do that) - - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: + // This function returns the internal pointer to Schedule "ScheduleName". + auto const &s_sched = state.dataSched; - // Return value - std::string TypeOfSchedule; + auto found = s_sched->scheduleMap.find(name); + if (found == s_sched->scheduleMap.end()) return nullptr; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: + int schedNum = found->second; - // FUNCTION PARAMETER DEFINITIONS: - // na + auto *sched = s_sched->schedules[schedNum]; - // INTERFACE BLOCK SPECIFICATIONS - // na + if (!sched->isUsed) { + sched->isUsed = true; - // DERIVED TYPE DEFINITIONS - // na + if (sched->type != SchedType::Constant) { - // FUNCTION LOCAL VARIABLE DECLARATIONS: - int curSchType; + auto *schedDetailed = dynamic_cast(sched); + assert(schedDetailed != nullptr); - if (!state.dataScheduleMgr->ScheduleInputProcessed) { - ProcessScheduleInput(state); - state.dataScheduleMgr->ScheduleInputProcessed = true; - } + schedDetailed->isUsed = true; + for (int iWeek = 1; iWeek <= 366; ++iWeek) { + if (auto *weekSched = schedDetailed->weekScheds[iWeek]; weekSched != nullptr) { + if (weekSched->isUsed) continue; - if ((ScheduleIndex > 0) && (ScheduleIndex <= state.dataScheduleMgr->NumSchedules)) { - curSchType = state.dataScheduleMgr->Schedule(ScheduleIndex).ScheduleTypePtr; - if ((curSchType > 0) && (curSchType <= state.dataScheduleMgr->NumScheduleTypes)) { - TypeOfSchedule = state.dataScheduleMgr->ScheduleType(curSchType).Name; - } else { - TypeOfSchedule = ""; + weekSched->isUsed = true; + for (int iDayType = 1; iDayType < (int)DayType::Num; ++iDayType) { + auto *daySched = weekSched->dayScheds[iDayType]; + daySched->isUsed = true; + } + } + } } - } else { - TypeOfSchedule = ""; } - return TypeOfSchedule; + return sched; + } // GetSchedule() + + int GetScheduleNum(EnergyPlusData &state, std::string const &name) + { + auto *sched = GetSchedule(state, name); + return (sched == nullptr) ? -1 : sched->Num; } - int GetDayScheduleIndex(EnergyPlusData &state, std::string &ScheduleName) + Sched::WeekSchedule *GetWeekSchedule(EnergyPlusData &state, std::string const &name) { - // FUNCTION INFORMATION: - // AUTHOR Linda K. Lawrie - // DATE WRITTEN August 2003 - // MODIFIED na - // RE-ENGINEERED na + auto const &s_sched = state.dataSched; - // PURPOSE OF THIS FUNCTION: - // This function returns the internal pointer to Day Schedule "ScheduleName". + auto found = s_sched->weekScheduleMap.find(name); + if (found == s_sched->weekScheduleMap.end()) return nullptr; - // Return value - int GetDayScheduleIndex; + int weekSchedNum = found->second; - if (!state.dataScheduleMgr->ScheduleInputProcessed) { - ProcessScheduleInput(state); - state.dataScheduleMgr->ScheduleInputProcessed = true; - } + auto *weekSched = s_sched->weekSchedules[weekSchedNum]; - if (state.dataScheduleMgr->NumDaySchedules > 0) { - GetDayScheduleIndex = Util::FindItemInList(ScheduleName, state.dataScheduleMgr->DaySchedule({1, state.dataScheduleMgr->NumDaySchedules})); - if (GetDayScheduleIndex > 0) { - state.dataScheduleMgr->DaySchedule(GetDayScheduleIndex).Used = true; + if (!weekSched->isUsed) { + weekSched->isUsed = true; + for (int iDayType = 1; iDayType < (int)DayType::Num; ++iDayType) { + auto *daySched = weekSched->dayScheds[iDayType]; + if (daySched == nullptr) continue; + daySched->isUsed = true; } - } else { - GetDayScheduleIndex = 0; } + return weekSched; + } // GetWeekSchedule() - return GetDayScheduleIndex; + int GetWeekScheduleNum(EnergyPlusData &state, std::string const &name) + { + auto *weekSched = GetWeekSchedule(state, name); + return (weekSched == nullptr) ? -1 : weekSched->Num; } - void GetScheduleValuesForDay(EnergyPlusData &state, - int const ScheduleIndex, - Array2S DayValues, - ObjexxFCL::Optional_int_const JDay, - ObjexxFCL::Optional_int_const CurDayofWeek) + Sched::DaySchedule *GetDaySchedule(EnergyPlusData &state, std::string const &name) { - // SUBROUTINE INFORMATION: + // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 - // MODIFIED na - // RE-ENGINEERED na - // PURPOSE OF THIS SUBROUTINE: - // This subroutine returns an entire day's worth of schedule values. + // PURPOSE OF THIS FUNCTION: + // This function returns the internal pointer to Schedule "ScheduleName". + auto const &s_sched = state.dataSched; - // METHODOLOGY EMPLOYED: - // Use internal data to fill DayValues array. + auto found = s_sched->dayScheduleMap.find(name); + if (found == s_sched->dayScheduleMap.end()) return nullptr; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int WeekSchedulePointer; - int DaySchedulePointer; + int daySchedNum = found->second; - if (!state.dataScheduleMgr->ScheduleInputProcessed) { - ProcessScheduleInput(state); - state.dataScheduleMgr->ScheduleInputProcessed = true; - } + auto *daySched = s_sched->daySchedules[daySchedNum]; - if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOn) { - DayValues({1, state.dataGlobal->NumOfTimeStepInHour}, {1, 24}) = 1.0; - return; - } else if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOff) { - DayValues({1, state.dataGlobal->NumOfTimeStepInHour}, {1, 24}) = 0.0; - return; - } + daySched->isUsed = true; - // Determine which Week Schedule is used - if (!present(JDay)) { - WeekSchedulePointer = state.dataScheduleMgr->Schedule(ScheduleIndex).WeekSchedulePointer(state.dataEnvrn->DayOfYear_Schedule); - } else { - WeekSchedulePointer = state.dataScheduleMgr->Schedule(ScheduleIndex).WeekSchedulePointer(JDay); - } + return daySched; + } // GetDaySchedule() - // Now, which day? - if (!present(CurDayofWeek)) { - if (state.dataEnvrn->HolidayIndex > 0) { - DaySchedulePointer = state.dataScheduleMgr->WeekSchedule(WeekSchedulePointer).DaySchedulePointer(state.dataEnvrn->HolidayIndex); - } else { - DaySchedulePointer = state.dataScheduleMgr->WeekSchedule(WeekSchedulePointer).DaySchedulePointer(state.dataEnvrn->DayOfWeek); - } - } else if (CurDayofWeek <= 7 && state.dataEnvrn->HolidayIndex > 0) { - DaySchedulePointer = state.dataScheduleMgr->WeekSchedule(WeekSchedulePointer).DaySchedulePointer(state.dataEnvrn->HolidayIndex); - } else { - DaySchedulePointer = state.dataScheduleMgr->WeekSchedule(WeekSchedulePointer).DaySchedulePointer(CurDayofWeek); - } + int GetDayScheduleNum(EnergyPlusData &state, std::string const &name) + { + auto *daySched = GetDaySchedule(state, name); + return (daySched == nullptr) ? -1 : daySched->Num; + } - // Return Values - DayValues({1, state.dataGlobal->NumOfTimeStepInHour}, {1, 24}) = state.dataScheduleMgr->DaySchedule(DaySchedulePointer).TSValue; + void ScheduleConstant::setMinMaxVals([[maybe_unused]] EnergyPlusData &state) + { + assert(!isMinMaxSet); + minVal = maxVal = currentVal; + isMinMaxSet = true; } - void GetSingleDayScheduleValues(EnergyPlusData &state, - int const DayScheduleIndex, // Index of the DaySchedule for values - Array2S DayValues // Returned set of values - ) + std::vector const &ScheduleConstant::getDayVals(EnergyPlusData &state, [[maybe_unused]] int jDay, [[maybe_unused]] int dayofWeek) { - // SUBROUTINE INFORMATION: - // AUTHOR Linda K. Lawrie - // DATE WRITTEN August 2003 - // MODIFIED na - // RE-ENGINEERED na + auto const &s_glob = state.dataGlobal; + if ((int)tsVals.size() != Constant::iHoursInDay * s_glob->TimeStepsInHour) { + this->tsVals.resize(Constant::iHoursInDay * s_glob->TimeStepsInHour); + std::fill(this->tsVals.begin(), this->tsVals.end(), this->currentVal); + } + return this->tsVals; + } // ScheduleConstant::getDayVals() + std::vector const &ScheduleDetailed::getDayVals(EnergyPlusData &state, int jDay, int dayOfWeek) + { // PURPOSE OF THIS SUBROUTINE: - // This subroutine returns an entire day's worth of schedule values for a specified Day Schedule Index item. - - // METHODOLOGY EMPLOYED: - // Use internal data to fill DayValues array. - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Argument array dimensioning - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na + // This subroutine returns an entire day's worth of schedule values. + auto const &s_env = state.dataEnvrn; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // na + // Determine which Week Schedule is used + auto const *weekSched = this->weekScheds[(jDay == -1) ? state.dataEnvrn->DayOfYear_Schedule : jDay]; - if (!state.dataScheduleMgr->ScheduleInputProcessed) { - ProcessScheduleInput(state); - state.dataScheduleMgr->ScheduleInputProcessed = true; + DaySchedule *daySched = nullptr; + // Now, which day? + if (dayOfWeek == -1) { + daySched = weekSched->dayScheds[(s_env->HolidayIndex > 0) ? s_env->HolidayIndex : s_env->DayOfWeek]; + } else if (dayOfWeek <= 7 && s_env->HolidayIndex > 0) { + daySched = weekSched->dayScheds[s_env->HolidayIndex]; + } else { + daySched = weekSched->dayScheds[dayOfWeek]; } - // Return Values - DayValues({1, state.dataGlobal->NumOfTimeStepInHour}, {1, 24}) = state.dataScheduleMgr->DaySchedule(DayScheduleIndex).TSValue; - } + return daySched->getDayVals(state); + } // ScheduleDetailed::getDayVals() void ExternalInterfaceSetSchedule(EnergyPlusData &state, - int &ScheduleIndex, - Real64 &Value // The new value for the schedule + int schedNum, + Real64 value // The new value for the schedule ) { // FUNCTION INFORMATION: // AUTHOR Michael Wetter // DATE WRITTEN February 2010 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine sets all values of the schedule referenced by 'ScheduleIndex' @@ -3111,108 +2630,55 @@ namespace ScheduleManager { // real-time data by referencing a schedule. This allows overwriting setpoint // for supervisory controls or internal gains obtained from real-time occupancy // measurements. + auto const &s_glob = state.dataGlobal; + auto const &s_sched = state.dataSched; + auto *daySched = s_sched->daySchedules[schedNum]; - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // Using/Aliasing - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - int TS; // Counter for Num Of Time Steps in Hour - int Hr; // Hour Counter - - // Assign the value of the variable - for (Hr = 1; Hr <= 24; ++Hr) { - for (TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { - state.dataScheduleMgr->DaySchedule(ScheduleIndex).TSValue(TS, Hr) = Value; + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) { + for (int ts = 0; ts < s_glob->TimeStepsInHour; ++ts) { + daySched->tsVals[hr * s_glob->TimeStepsInHour + ts] = value; } } - } + } // ExternalInterfaceSetSchedule() void ProcessIntervalFields(EnergyPlusData &state, Array1S_string const Untils, Array1S const Numbers, int const NumUntils, int const NumNumbers, - Array2A MinuteValue, - Array2A_bool SetMinuteValue, + std::array &minuteVals, + std::array &setMinuteVals, bool &ErrorsFound, - std::string const &DayScheduleName, // Name (used for errors) - std::string const &ErrContext, // Context (used for errors) - ScheduleInterpolation interpolationKind // enumeration on how to interpolate values in schedule + std::string const &DayScheduleName, // Name (used for errors) + std::string const &ErrContext, // Context (used for errors) + Interpolation interpolation // enumeration on how to interpolate values in schedule ) { // SUBROUTINE INFORMATION: // AUTHOR // DATE WRITTEN - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine processes the "interval" fields with/without optional "until" in front of // time (hh:mm). - // METHODOLOGY EMPLOYED: - // na. - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Argument array dimensioning - MinuteValue.dim(60, 24); - SetMinuteValue.dim(60, 24); - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int Count; - std::string::size_type Pos; int HHField; int MMField; - int Hr; - int Min; - int SHr; // starting hour - int SMin; // starting minute - int EHr; // ending hour - int EMin; // ending minute + + int begHr = 0; // starting hour + int begMin = 0; // starting minute + int endHr = -1; // ending hour + int endMin = -1; // ending minute std::string::size_type sFld; + int totalMinutes; Real64 incrementPerMinute; Real64 curValue; - MinuteValue = 0.0; - SetMinuteValue = false; - SHr = 1; - SMin = 1; - EHr = 0; - EMin = 0; + std::fill(minuteVals.begin(), minuteVals.end(), 0.0); + std::fill(setMinuteVals.begin(), setMinuteVals.end(), false); + sFld = 0; Real64 StartValue = 0; @@ -3227,31 +2693,32 @@ namespace ScheduleManager { return; } - for (Count = 1; Count <= NumUntils; ++Count) { - Pos = index(Untils(Count), "UNTIL"); + for (int Count = 1; Count <= NumUntils; ++Count) { + std::string const &until = Untils(Count); + int Pos = index(until, "UNTIL"); if (Pos == 0) { - if (Untils(Count)[5] == ':') { + if (until[5] == ':') { sFld = 6; } else { sFld = 5; } - DecodeHHMMField(state, Untils(Count).substr(sFld), HHField, MMField, ErrorsFound, DayScheduleName, Untils(Count), interpolationKind); - } else if (Pos == std::string::npos) { - DecodeHHMMField(state, Untils(Count), HHField, MMField, ErrorsFound, DayScheduleName, Untils(Count), interpolationKind); + DecodeHHMMField(state, until.substr(sFld), HHField, MMField, ErrorsFound, DayScheduleName, until, interpolation); + } else if (Pos == (int)std::string::npos) { + DecodeHHMMField(state, until, HHField, MMField, ErrorsFound, DayScheduleName, until, interpolation); } else { // Until found but wasn't first field - ShowSevereError(state, format("ProcessScheduleInput: ProcessIntervalFields, Invalid \"Until\" field encountered={}", Untils(Count))); + ShowSevereError(state, format("ProcessScheduleInput: ProcessIntervalFields, Invalid \"Until\" field encountered={}", until)); ShowContinueError(state, format("Occurred in Day Schedule={}", DayScheduleName)); ErrorsFound = true; continue; } // Field decoded - if (HHField < 0 || HHField > 24 || MMField < 0 || MMField > 60) { - ShowSevereError(state, format("ProcessScheduleInput: ProcessIntervalFields, Invalid \"Until\" field encountered={}", Untils(Count))); + if (HHField < 0 || HHField > Constant::iHoursInDay || MMField < 0 || MMField > Constant::iMinutesInHour) { + ShowSevereError(state, format("ProcessScheduleInput: ProcessIntervalFields, Invalid \"Until\" field encountered={}", until)); ShowContinueError(state, format("Occurred in Day Schedule={}", DayScheduleName)); ErrorsFound = true; continue; } - if (HHField == 24 && MMField > 0 && MMField < 60) { + if (HHField == Constant::iHoursInDay && MMField > 0 && MMField < Constant::iMinutesInHour) { ShowWarningError(state, format("ProcessScheduleInput: ProcessIntervalFields, Invalid \"Until\" field encountered={}", Untils(Count))); ShowContinueError(state, format("Occurred in Day Schedule={}", DayScheduleName)); ShowContinueError(state, "Terminating the field at 24:00"); @@ -3260,16 +2727,15 @@ namespace ScheduleManager { // Fill in values if (MMField == 0) { - EHr = HHField + 1; - EMin = 60; - } - if (MMField < 60) { - EHr = HHField + 1; - EMin = MMField; + endHr = HHField - 1; + endMin = Constant::iMinutesInHour - 1; + } else if (MMField < Constant::iMinutesInHour) { + endHr = HHField; + endMin = MMField - 1; } - if (interpolationKind == ScheduleInterpolation::Linear) { - totalMinutes = (EHr - SHr) * 60 + (EMin - SMin) + 1; + if (interpolation == Interpolation::Linear) { + totalMinutes = (endHr - begHr) * Constant::iMinutesInHour + (endMin - begMin) + 1; if (totalMinutes == 0) totalMinutes = 1; // protect future division if (Count == 1) { StartValue = Numbers(Count); // assume first period is flat @@ -3282,9 +2748,23 @@ namespace ScheduleManager { curValue = StartValue + incrementPerMinute; } - if (SHr == EHr) { - for (Min = SMin; Min <= EMin; ++Min) { - if (SetMinuteValue(Min, SHr)) { + if (begHr > endHr) { + if (begHr == endHr + 1 && begMin == 0 && endMin == Constant::iMinutesInHour - 1) { + ShowWarningError(state, + format("ProcessScheduleInput: ProcessIntervalFields, Processing time fields, zero time interval detected, {}={}", + ErrContext, + DayScheduleName)); + } else { + ShowSevereError(state, + format("ProcessScheduleInput: ProcessIntervalFields, Processing time fields, overlapping times detected, {}={}", + ErrContext, + DayScheduleName)); + ErrorsFound = true; + } + + } else if (begHr == endHr) { + for (int iMin = begMin; iMin <= endMin; ++iMin) { + if (setMinuteVals[begHr * Constant::iMinutesInHour + iMin] == true) { ShowSevereError( state, format("ProcessScheduleInput: ProcessIntervalFields, Processing time fields, overlapping times detected, {}={}", @@ -3293,128 +2773,124 @@ namespace ScheduleManager { ErrorsFound = true; goto UntilLoop_exit; } - if (interpolationKind == ScheduleInterpolation::Linear) { - MinuteValue(Min, EHr) = curValue; + } + + if (interpolation == Interpolation::Linear) { + for (int iMin = begMin; iMin <= endMin; ++iMin) { + minuteVals[begHr * Constant::iMinutesInHour + iMin] = curValue; curValue += incrementPerMinute; - SetMinuteValue(Min, SHr) = true; - } else { - MinuteValue(Min, SHr) = Numbers(Count); - SetMinuteValue(Min, SHr) = true; + setMinuteVals[begHr * Constant::iMinutesInHour + iMin] = true; + } + } else { + for (int iMin = begMin; iMin <= endMin; ++iMin) { + minuteVals[begHr * Constant::iMinutesInHour + iMin] = Numbers(Count); + setMinuteVals[begHr * Constant::iMinutesInHour + iMin] = true; } } - SMin = EMin + 1; - if (SMin > 60) { - ++SHr; - SMin = 1; + + begMin = endMin + 1; + if (begMin >= Constant::iMinutesInHour) { + ++begHr; + begMin = 0; } - } else if (EHr < SHr) { - ShowSevereError(state, - format("ProcessScheduleInput: ProcessIntervalFields, Processing time fields, overlapping times detected, {}={}", - ErrContext, - DayScheduleName)); - ErrorsFound = true; - } else { - if (interpolationKind == ScheduleInterpolation::Linear) { - for (Min = SMin; Min <= 60; ++Min) { // for portion of starting hour - MinuteValue(Min, SHr) = curValue; + + } else { // begHr < endHr + if (interpolation == Interpolation::Linear) { + for (int iMin = begMin; iMin <= Constant::iMinutesInHour - 1; ++iMin) { // for portion of starting hour + minuteVals[begHr * Constant::iMinutesInHour + iMin] = curValue; curValue += incrementPerMinute; - SetMinuteValue(Min, SHr) = true; + setMinuteVals[begHr * Constant::iMinutesInHour + iMin] = true; } - for (Hr = SHr + 1; Hr <= EHr - 1; ++Hr) { // for intermediate hours - for (Min = 1; Min <= 60; ++Min) { - MinuteValue(Min, Hr) = curValue; + + for (int iHr = begHr + 1; iHr <= endHr - 1; ++iHr) { // for intermediate hours + for (int iMin = 0; iMin <= Constant::iMinutesInHour - 1; ++iMin) { + minuteVals[iHr * Constant::iMinutesInHour + iMin] = curValue; curValue += incrementPerMinute; - SetMinuteValue(Min, Hr) = true; + setMinuteVals[iHr * Constant::iMinutesInHour + iMin] = true; } } - for (Min = 1; Min <= EMin; ++Min) { // for ending hour - MinuteValue(Min, EHr) = curValue; + + for (int iMin = 0; iMin <= endMin; ++iMin) { // for ending hour + minuteVals[endHr * Constant::iMinutesInHour + iMin] = curValue; curValue += incrementPerMinute; - SetMinuteValue(Min, EHr) = true; + setMinuteVals[endHr * Constant::iMinutesInHour + iMin] = true; } + } else { // either no interpolation or "average" interpolation (average just is when the interval does not match the timestep) - for (Min = SMin; Min <= 60; ++Min) { // for portion of starting hour - MinuteValue(Min, SHr) = Numbers(Count); - SetMinuteValue(Min, SHr) = true; + // Fill values for first hour (which may not start at minute 0) + // For std::fill the end marker has to be 1 past the last position you want to fill + for (int iMin = begMin; iMin <= Constant::iMinutesInHour; ++iMin) { + minuteVals[begHr * Constant::iMinutesInHour + iMin] = Numbers(Count); + setMinuteVals[begHr * Constant::iMinutesInHour + iMin] = true; } - for (Hr = SHr + 1; Hr <= EHr - 1; ++Hr) { // for intermediate hours - MinuteValue(_, Hr) = Numbers(Count); - SetMinuteValue(_, Hr) = true; + + // Fill values for middle hours (which start at minute 0 and end in minute 59) + if ((begHr + 1) <= (endHr - 1)) { + for (int iHr = begHr + 1; iHr <= endHr - 1; ++iHr) { + for (int iMin = 0; iMin <= Constant::iMinutesInHour - 1; ++iMin) { + minuteVals[iHr * Constant::iMinutesInHour + iMin] = Numbers(Count); + setMinuteVals[iHr * Constant::iMinutesInHour + iMin] = true; + } + } } - for (Min = 1; Min <= EMin; ++Min) { // for ending hour - MinuteValue(Min, EHr) = Numbers(Count); - SetMinuteValue(Min, EHr) = true; + + // Fill values for last hour (which starts at minute 0 but may end on minute that isn't 59) + for (int iMin = 0; iMin <= endMin; ++iMin) { + minuteVals[endHr * Constant::iMinutesInHour + iMin] = Numbers(Count); + setMinuteVals[endHr * Constant::iMinutesInHour + iMin] = true; } } - SHr = EHr; - SMin = EMin + 1; - if (SMin > 60) { - ++SHr; - SMin = 1; + + begHr = endHr; + begMin = endMin + 1; + if (begMin >= Constant::iMinutesInHour) { + ++begHr; + begMin = 0; } } } UntilLoop_exit:; - if (!all(SetMinuteValue)) { - ShowSevereError(state, - format("ProcessScheduleInput: ProcessIntervalFields, Processing time fields, incomplete day detected, {}={}", - ErrContext, - DayScheduleName)); - ErrorsFound = true; + for (int iMin = 0; iMin < Constant::iMinutesInDay; ++iMin) { + if (setMinuteVals[iMin] == false) { + ShowSevereError(state, + format("ProcessScheduleInput: ProcessIntervalFields, Processing time fields, incomplete day detected, {}={}", + ErrContext, + DayScheduleName)); + ErrorsFound = true; + } } } void DecodeHHMMField(EnergyPlusData &state, - std::string const &FieldValue, // Input field value - int &RetHH, // Returned "hour" - int &RetMM, // Returned "minute" - bool &ErrorsFound, // True if errors found in this field - std::string const &DayScheduleName, // originating day schedule name - std::string const &FullFieldValue, // Full Input field value - ScheduleInterpolation interpolationKind // enumeration on how to interpolate values in schedule + std::string const &FieldValue, // Input field value + int &RetHH, // Returned "hour" + int &RetMM, // Returned "minute" + bool &ErrorsFound, // True if errors found in this field + std::string const &DayScheduleName, // originating day schedule name + std::string const &FullFieldValue, // Full Input field value + Interpolation interpolation // enumeration on how to interpolate values in schedule ) { // SUBROUTINE INFORMATION: // AUTHOR Linda K Lawrie // DATE WRITTEN January 2003 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: + // This subroutine decodes a hhmm date field input as part of the "until" time in a schedule // representation. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 rRetHH; // real Returned "hour" - Real64 rRetMM; // real Returned "minute" - bool nonIntegral; std::string hHour; std::string mMinute; std::string String = stripped(FieldValue); std::string::size_type const Pos = index(String, ':'); - nonIntegral = false; + bool nonIntegral = false; + + auto const &s_glob = state.dataGlobal; if (Pos == std::string::npos) { ShowSevereError(state, format("ProcessScheduleInput: DecodeHHMMField, Invalid \"until\" field submitted (no : separator in hh:mm)={}", @@ -3426,7 +2902,7 @@ namespace ScheduleManager { RetHH = 0; } else { bool error = false; - rRetHH = Util::ProcessNumber(String.substr(0, Pos), error); + Real64 rRetHH = Util::ProcessNumber(String.substr(0, Pos), error); RetHH = int(rRetHH); if (double(RetHH) != rRetHH || error || rRetHH < 0.0) { if (double(RetHH) != rRetHH && rRetHH >= 0.0) { @@ -3449,7 +2925,7 @@ namespace ScheduleManager { String.erase(0, Pos + 1); bool error = false; - rRetMM = Util::ProcessNumber(String, error); + Real64 rRetMM = Util::ProcessNumber(String, error); RetMM = int(rRetMM); if (double(RetMM) != rRetMM || error || rRetMM < 0.0) { if (double(RetMM) != rRetMM && rRetMM >= 0.0) { @@ -3470,10 +2946,12 @@ namespace ScheduleManager { } if (nonIntegral) { + std::string hHour; // these haven't been initialized? + std::string mMinute; ShowContinueError(state, format("Until value to be used will be: {:2.2F}:{:2.2F}", hHour, mMinute)); } - if (interpolationKind == ScheduleInterpolation::No) { - if (!isMinuteMultipleOfTimestep(RetMM, state.dataGlobal->MinutesPerTimeStep)) { + if (interpolation == Interpolation::No) { + if (!isMinuteMultipleOfTimestep(RetMM, s_glob->MinutesInTimeStep)) { ShowWarningError( state, format( @@ -3494,375 +2972,253 @@ namespace ScheduleManager { } void ProcessForDayTypes(EnergyPlusData &state, - std::string const &ForDayField, // Field containing the "FOR:..." - Array1D_bool &TheseDays, // Array to contain returned "true" days - Array1D_bool &AlReady, // Array of days already done - bool &ErrorsFound // Will be true if error found. + std::string const &ForDayField, // Field containing the "FOR:..." + std::array &these, // Array to contain returned "true" days + std::array &already, // Array of days already done + bool &ErrorsFound // Will be true if error found. ) { // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN February 2003 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine processes a field "For: day types" and returns // those day types (can be multiple) from field. - - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Argument array dimensioning - EP_SIZE_CHECK(TheseDays, maxDayTypes); - EP_SIZE_CHECK(AlReady, maxDayTypes); - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int DayT; - bool OneValid; - bool DupAssignment; + bool OneValid = false; + bool DupAssignment = false; - OneValid = false; - DupAssignment = false; // Just test for specific days if (has(ForDayField, "WEEKDAY")) { - TheseDays({2, 6}) = true; - if (any(AlReady({2, 6}))) { + these[iDayType_Mon] = these[iDayType_Tue] = these[iDayType_Wed] = these[iDayType_Thu] = these[iDayType_Fri] = true; + if (already[iDayType_Mon] || already[iDayType_Tue] || already[iDayType_Wed] || already[iDayType_Thu] || already[iDayType_Fri]) { DupAssignment = true; - } else { - AlReady({2, 6}) = true; } + already[iDayType_Mon] = already[iDayType_Tue] = already[iDayType_Wed] = already[iDayType_Thu] = already[iDayType_Fri] = true; OneValid = true; } - if (has(ForDayField, "MONDAY")) { - TheseDays(2) = true; - if (AlReady(2)) { + if (has(ForDayField, "MONDAY")) { // Should this be an else-if + these[iDayType_Mon] = true; + if (already[iDayType_Mon]) { DupAssignment = true; } else { - AlReady(2) = true; + already[iDayType_Mon] = true; } OneValid = true; } if (has(ForDayField, "TUESDAY")) { - TheseDays(3) = true; - if (AlReady(3)) { + these[iDayType_Tue] = true; + if (already[iDayType_Tue]) { DupAssignment = true; } else { - AlReady(3) = true; + already[iDayType_Tue] = true; } OneValid = true; } if (has(ForDayField, "WEDNESDAY")) { - TheseDays(4) = true; - if (AlReady(4)) { + these[iDayType_Wed] = true; + if (already[iDayType_Wed]) { DupAssignment = true; } else { - AlReady(4) = true; + already[iDayType_Wed] = true; } OneValid = true; } if (has(ForDayField, "THURSDAY")) { - TheseDays(5) = true; - if (AlReady(5)) { + these[iDayType_Thu] = true; + if (already[iDayType_Thu]) { DupAssignment = true; } else { - AlReady(5) = true; + already[iDayType_Thu] = true; } OneValid = true; } if (has(ForDayField, "FRIDAY")) { - TheseDays(6) = true; - if (AlReady(6)) { + these[iDayType_Fri] = true; + if (already[iDayType_Fri]) { DupAssignment = true; } else { - AlReady(6) = true; + already[iDayType_Fri] = true; } OneValid = true; } if (has(ForDayField, "WEEKEND")) { - TheseDays(1) = true; - TheseDays(7) = true; - if (AlReady(1)) { - DupAssignment = true; - } else { - AlReady(1) = true; - } - if (AlReady(7)) { + these[iDayType_Sun] = these[iDayType_Sat] = true; + if (already[iDayType_Sun] || already[iDayType_Sat]) { DupAssignment = true; - } else { - AlReady(7) = true; } + already[iDayType_Sun] = already[iDayType_Sat] = true; OneValid = true; } + if (has(ForDayField, "SATURDAY")) { - TheseDays(7) = true; - if (AlReady(7)) { + these[iDayType_Sat] = true; + if (already[iDayType_Sat]) { DupAssignment = true; } else { - AlReady(7) = true; + already[iDayType_Sat] = true; } OneValid = true; } if (has(ForDayField, "SUNDAY")) { - TheseDays(1) = true; - if (AlReady(1)) { + these[iDayType_Sun] = true; + if (already[iDayType_Sun]) { DupAssignment = true; } else { - AlReady(1) = true; + already[iDayType_Sun] = true; } OneValid = true; } if (has(ForDayField, "CUSTOMDAY1")) { - TheseDays(11) = true; - if (AlReady(11)) { + these[iDayType_Cus1] = true; + if (already[iDayType_Cus1]) { DupAssignment = true; } else { - AlReady(11) = true; + already[iDayType_Cus1] = true; } OneValid = true; } if (has(ForDayField, "CUSTOMDAY2")) { - TheseDays(12) = true; - if (AlReady(12)) { + these[iDayType_Cus2] = true; + if (already[iDayType_Cus2]) { DupAssignment = true; } else { - AlReady(12) = true; + already[iDayType_Cus2] = true; } OneValid = true; } if (has(ForDayField, "ALLDAY")) { - TheseDays({1, maxDayTypes}) = true; - if (any(AlReady)) { - DupAssignment = true; - } else { - AlReady = true; + for (int iDay = 0; iDay < (int)DayType::Num; ++iDay) { + these[iDay] = true; + if (already[iDay]) { + DupAssignment = true; + } else { + already[iDay] = true; + } } OneValid = true; } if (has(ForDayField, "HOLIDAY")) { - TheseDays(8) = true; - if (AlReady(8)) { + these[iDayType_Hol] = true; + if (already[iDayType_Hol]) { DupAssignment = true; } else { - AlReady(8) = true; + already[iDayType_Hol] = true; } OneValid = true; } if (has(ForDayField, "SUMMER")) { - TheseDays(9) = true; - if (AlReady(9)) { + these[iDayType_SumDes] = true; + if (already[iDayType_SumDes]) { DupAssignment = true; } else { - AlReady(9) = true; + already[iDayType_SumDes] = true; } OneValid = true; } if (has(ForDayField, "WINTER")) { - TheseDays(10) = true; - if (AlReady(10)) { + these[iDayType_WinDes] = true; + if (already[iDayType_WinDes]) { DupAssignment = true; } else { - AlReady(10) = true; + already[iDayType_WinDes] = true; } OneValid = true; } if (has(ForDayField, "ALLOTHERDAY")) { - for (DayT = 1; DayT <= maxDayTypes; ++DayT) { - if (AlReady(DayT)) continue; - TheseDays(DayT) = true; - AlReady(DayT) = true; + for (int iDay = 0; iDay < (int)DayType::Num; ++iDay) { + if (!already[iDay]) { + these[iDay] = already[iDay] = true; + } } OneValid = true; } if (DupAssignment) { - ShowSevereError(state, - format("ProcessScheduleInput: ProcessForDayTypes, Duplicate assignment attempted in \"for\" days field={}", ForDayField)); + ShowSevereError(state, format("ProcessForDayTypes: Duplicate assignment attempted in \"for\" days field={}", ForDayField)); ErrorsFound = true; } if (!OneValid) { - ShowSevereError(state, - format("ProcessScheduleInput: ProcessForDayTypes, No valid day assignments found in \"for\" days field={}", ForDayField)); + ShowSevereError(state, format("ProcessForDayTypes: No valid day assignments found in \"for\" days field={}", ForDayField)); ErrorsFound = true; } - } + } // ProcessScheduleInput() - void SetScheduleMinMax(EnergyPlusData &state, int SchedNum) + void DaySchedule::setMinMaxVals([[maybe_unused]] EnergyPlusData &state) { - auto &sched = state.dataScheduleMgr->Schedule(SchedNum); - if (sched.MaxMinSet) return; + assert(!this->isMinMaxSet); - if (state.dataScheduleMgr->CheckScheduleValueMinMaxRunOnceOnly) { - for (int Loop = 0; Loop <= state.dataScheduleMgr->NumDaySchedules; ++Loop) { - auto &daySched = state.dataScheduleMgr->DaySchedule(Loop); - daySched.TSValMin = minval(daySched.TSValue); - daySched.TSValMax = maxval(daySched.TSValue); - } - state.dataScheduleMgr->CheckScheduleValueMinMaxRunOnceOnly = false; - } + auto const &s_glob = state.dataGlobal; - auto const &wkSched = state.dataScheduleMgr->WeekSchedule(sched.WeekSchedulePointer(1)); - auto const &daySched = state.dataScheduleMgr->DaySchedule(wkSched.DaySchedulePointer(1)); - Real64 MinValue = daySched.TSValMin; - Real64 MaxValue = daySched.TSValMax; - for (int DayT = 2; DayT <= maxDayTypes; ++DayT) { - auto const &daySched = state.dataScheduleMgr->DaySchedule(wkSched.DaySchedulePointer(DayT)); - MinValue = min(MinValue, daySched.TSValMin); - MaxValue = max(MaxValue, daySched.TSValMax); - } - int prevWkSch = -999; // set to a value that would never occur - for (int Loop = 2; Loop <= 366; ++Loop) { - int WkSch = sched.WeekSchedulePointer(Loop); - if (WkSch != prevWkSch) { // skip if same as previous week (very common) - auto const &wkSched = state.dataScheduleMgr->WeekSchedule(WkSch); - for (int DayT = 1; DayT <= maxDayTypes; ++DayT) { - auto const &daySched = state.dataScheduleMgr->DaySchedule(wkSched.DaySchedulePointer(DayT)); - MinValue = min(MinValue, daySched.TSValMin); - MaxValue = max(MaxValue, daySched.TSValMax); - } - prevWkSch = WkSch; - } + this->minVal = this->maxVal = this->tsVals[0]; + for (int i = 0; i < Constant::iHoursInDay * s_glob->TimeStepsInHour; ++i) { + Real64 value = this->tsVals[i]; + if (value < this->minVal) + this->minVal = value; + else if (value > this->maxVal) + this->maxVal = value; } - sched.MaxMinSet = true; - sched.MinValue = MinValue; - sched.MaxValue = MaxValue; + + this->isMinMaxSet = true; } - bool CheckScheduleValueMinMax(EnergyPlusData &state, - int const ScheduleIndex, // Which Schedule being tested - bool const includeOrEquals, // Minimum indicator ('>', '>=') - Real64 const Minimum // Minimum desired value - ) + void WeekSchedule::setMinMaxVals(EnergyPlusData &state) { - // FUNCTION INFORMATION: - // AUTHOR Linda K. Lawrie - // DATE WRITTEN February 2003 - // MODIFIED na - // RE-ENGINEERED na + assert(!this->isMinMaxSet); - // PURPOSE OF THIS FUNCTION: - // This function checks the indicated schedule values for validity. Uses the ScheduleIndex - // from (GetScheduleIndex), a minimum and a maximum -- one or other optional to check "internals". + auto *daySched1 = this->dayScheds[1]; + if (!daySched1->isMinMaxSet) daySched1->setMinMaxVals(state); - // METHODOLOGY EMPLOYED: - // Schedule data structure stores this on first validity check. If there, then is returned else - // looks up minimum and maximum values for the schedule and then sets result of function based on - // requested minimum/maximum checks. + this->minVal = daySched1->minVal; + this->maxVal = daySched1->maxVal; - // FUNCTION LOCAL VARIABLE DECLARATIONS: - Real64 MinValue(0.0); // For total minimum - Real64 MaxValue(0.0); // For total maximum - - if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOn) { - MinValue = 1.0; - MaxValue = 1.0; - } else if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOff) { - MinValue = 0.0; - MaxValue = 0.0; - } else if (ScheduleIndex < 1 || ScheduleIndex > state.dataScheduleMgr->NumSchedules) { - ShowFatalError(state, "CheckScheduleValueMinMax called with ScheduleIndex out of range"); - } + auto *daySchedPrev = daySched1; + for (int iDay = 2; iDay < (int)DayType::Num; ++iDay) { + auto *daySched = this->dayScheds[iDay]; + if (daySched == daySchedPrev) continue; - if (ScheduleIndex > 0) { - if (!state.dataScheduleMgr->Schedule(ScheduleIndex).MaxMinSet) { // Set Minimum/Maximums for this schedule - SetScheduleMinMax(state, ScheduleIndex); - } - MinValue = state.dataScheduleMgr->Schedule(ScheduleIndex).MinValue; - MinValue = state.dataScheduleMgr->Schedule(ScheduleIndex).MinValue; + if (!daySched->isMinMaxSet) daySched->setMinMaxVals(state); + if (daySched->minVal < this->minVal) this->minVal = daySched->minVal; + if (daySched->maxVal > this->maxVal) this->maxVal = daySched->maxVal; + daySchedPrev = daySched; } - // Min/max for schedule has been set. Test. - if (includeOrEquals) { - return FLT_EPSILON >= Minimum - state.dataScheduleMgr->Schedule(ScheduleIndex).MinValue; - } else { - return state.dataScheduleMgr->Schedule(ScheduleIndex).MinValue > Minimum; - } - } + this->isMinMaxSet = true; + } // ScheduleWeek::setMinMaxVals() - bool CheckScheduleValueMinMax(EnergyPlusData &state, - int const schedNum, // Which Schedule being tested - std::string_view MinString, // Minimum indicator ('>', '>=') - Real64 const Minimum, // Minimum desired value - std::string_view MaxString, // Maximum indicator ('<', ',=') - Real64 const Maximum) // Maximum desired value + void ScheduleDetailed::setMinMaxVals(EnergyPlusData &state) { - Clusivity clusiveMin = (MinString == ">=") ? Clusivity::Inclusive : ((MinString == ">") ? Clusivity::Exclusive : Clusivity::Invalid); - Clusivity clusiveMax = (MaxString == "<=") ? Clusivity::Inclusive : ((MaxString == "<") ? Clusivity::Exclusive : Clusivity::Invalid); - - if (clusiveMin == Clusivity::Invalid) ShowFatalError(state, format("CheckScheduleValueMinMax: illegal MinString {}", MinString)); - if (clusiveMax == Clusivity::Invalid) ShowFatalError(state, format("CheckScheduleValueMinMax: illegal MaxString {}", MaxString)); + assert(!this->isMinMaxSet); - return CheckScheduleValueMinMax(state, schedNum, clusiveMin, Minimum, clusiveMax, Maximum); - } + auto *weekSched1 = this->weekScheds[1]; + if (!weekSched1->isMinMaxSet) weekSched1->setMinMaxVals(state); - bool CheckScheduleValueMinMax(EnergyPlusData &state, - int const schedNum, // Which Schedule being tested - Clusivity clusiveMin, // Minimum indicator ('>', '>=') - Real64 const Minimum, // Minimum desired value - Clusivity clusiveMax, // Maximum indicator ('<', ',=') - Real64 const Maximum // Maximum desired value - ) - { - // FUNCTION INFORMATION: - // AUTHOR Linda K. Lawrie - // DATE WRITTEN February 2003 + this->minVal = weekSched1->minVal; + this->maxVal = weekSched1->maxVal; - // PURPOSE OF THIS FUNCTION: - // This function checks the indicated schedule values for validity. Uses the ScheduleIndex - // from (GetScheduleIndex), a minimum and a maximum -- one or other optional to check "internals". + auto *weekSchedPrev = weekSched1; - // METHODOLOGY EMPLOYED: - // Schedule data structure stores this on first validity check. If there, then is returned else - // looks up minimum and maximum values for the schedule and then sets result of function based on - // requested minimum/maximum checks. + for (int iWeek = 2; iWeek <= 366; ++iWeek) { + auto *weekSched = this->weekScheds[iWeek]; + if (iWeek == 366 && weekSched == nullptr) continue; + if (weekSched == weekSchedPrev) continue; + if (!weekSched->isMinMaxSet) weekSched->setMinMaxVals(state); - bool MinValueOk = true; - bool MaxValueOk = true; - - if (schedNum == ScheduleManager::ScheduleAlwaysOn) { - assert(clusiveMin == Clusivity::Inclusive && clusiveMax == Clusivity::Inclusive); - MinValueOk = (Minimum == 1.0); - MaxValueOk = (Maximum == 1.0); - } else if (schedNum == ScheduleManager::ScheduleAlwaysOff) { - assert(clusiveMin == Clusivity::Inclusive && clusiveMax == Clusivity::Inclusive); - MinValueOk = (Minimum == 0.0); - MaxValueOk = (Maximum == 0.0); - } else if (schedNum > 0 && schedNum <= state.dataScheduleMgr->NumSchedules) { - auto &sched = state.dataScheduleMgr->Schedule(schedNum); - if (!sched.MaxMinSet) { - SetScheduleMinMax(state, schedNum); - } - MinValueOk = (clusiveMin == Clusivity::Exclusive) ? (sched.MinValue > Minimum) : (FLT_EPSILON >= Minimum - sched.MinValue); - MaxValueOk = (clusiveMax == Clusivity::Exclusive) ? (sched.MaxValue < Maximum) : (sched.MaxValue - Maximum <= FLT_EPSILON); - } else { - ShowFatalError(state, "CheckScheduleValueMinMax called with ScheduleIndex out of range"); + if (weekSched->minVal < this->minVal) this->minVal = weekSched->minVal; + if (weekSched->maxVal > this->maxVal) this->maxVal = weekSched->maxVal; + weekSchedPrev = weekSched; } - return (MinValueOk && MaxValueOk); + this->isMinMaxSet = true; } - bool CheckScheduleValueMinMax(EnergyPlusData &state, - int const schedNum, // Which Schedule being tested - std::string const &MinString, // Minimum indicator ('>', '>=') - Real32 const Minimum // Minimum desired value + bool CheckScheduleValueMin(EnergyPlusData &state, + int const schedNum, // Which Schedule being tested + Clusive clu, + Real64 const min // Minimum desired value ) { // FUNCTION INFORMATION: @@ -3870,836 +3226,268 @@ namespace ScheduleManager { // DATE WRITTEN February 2003 // PURPOSE OF THIS FUNCTION: - // This function checks the indicated schedule values for validity. Uses the ScheduleIndex - // from (GetScheduleIndex), a minimum and a maximum -- one or other optional to check "internals". + // This function checks the indicated schedule values for validity. // METHODOLOGY EMPLOYED: // Schedule data structure stores this on first validity check. If there, then is returned else // looks up minimum and maximum values for the schedule and then sets result of function based on // requested minimum/maximum checks. - Real64 MinValue(0.0); // For total minimum + return state.dataSched->schedules[schedNum]->checkMinVal(state, clu, min); + } - if (schedNum == ScheduleManager::ScheduleAlwaysOn) { - MinValue = 1.0; - } else if (schedNum == ScheduleManager::ScheduleAlwaysOff) { - MinValue = 0.0; - } else if (schedNum > 0 && schedNum > state.dataScheduleMgr->NumSchedules) { - if (!state.dataScheduleMgr->Schedule(schedNum).MaxMinSet) { // Set Minimum/Maximums for this schedule - SetScheduleMinMax(state, schedNum); - } - MinValue = state.dataScheduleMgr->Schedule(schedNum).MinValue = MinValue; - } else { - ShowFatalError(state, "CheckScheduleValueMinMax called with ScheduleIndex out of range"); + bool ScheduleBase::checkMinVal(EnergyPlusData &state, Clusive clu, Real64 min) + { + if (!this->isMinMaxSet) { // Set Minimum/Maximums for this schedule + this->setMinMaxVals(state); + } + + // Min/max for schedule has been set. Test. + return (clu == Clusive::In) ? (FLT_EPSILON >= min - this->minVal) : (this->minVal > min); + } // ScheduleDetailed::checkMinVal() + + bool ScheduleBase::checkMaxVal(EnergyPlusData &state, Clusive cluMax, Real64 const max) + { + if (!this->isMinMaxSet) { + this->setMinMaxVals(state); } - return (MinString == ">") ? (MinValue > Minimum) : (FLT_EPSILON >= Minimum - MinValue); + return (cluMax == Clusive::Ex) ? (this->maxVal < max) : (this->maxVal - max <= FLT_EPSILON); } - bool CheckScheduleValueMinMax(EnergyPlusData &state, - int const schedNum, // Which Schedule being tested - std::string const &MinString, // Minimum indicator ('>', '>=') - Real32 const Minimum, // Minimum desired value - std::string const &MaxString, // Maximum indicator ('<', ',=') - Real32 const Maximum // Maximum desired value - ) + bool ScheduleBase::checkMinMaxVals(EnergyPlusData &state, + Clusive cluMin, // Minimum indicator ('>', '>=') + Real64 const min, // Minimum desired value + Clusive cluMax, // Maximum indicator ('<', ',=') + Real64 const max) // Maximum desired value { // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN February 2003 // PURPOSE OF THIS FUNCTION: - // This function checks the indicated schedule values for validity. Uses the ScheduleIndex - // from (GetScheduleIndex), a minimum and a maximum -- one or other optional to check "internals". + // This function checks the indicated schedule values for validity. // METHODOLOGY EMPLOYED: // Schedule data structure stores this on first validity check. If there, then is returned else // looks up minimum and maximum values for the schedule and then sets result of function based on // requested minimum/maximum checks. - bool MinValueOk; - bool MaxValueOk; - - if (schedNum == ScheduleManager::ScheduleAlwaysOn) { - MinValueOk = (Minimum == 1.0); - MaxValueOk = (Maximum == 1.0); - } else if (schedNum == ScheduleManager::ScheduleAlwaysOff) { - MinValueOk = (Minimum == 0.0); - MaxValueOk = (Maximum == 0.0); - } else if (schedNum > 0 && schedNum <= state.dataScheduleMgr->NumSchedules) { - auto const &sched = state.dataScheduleMgr->Schedule(schedNum); - if (!sched.MaxMinSet) { // Set Minimum/Maximums for this schedule - SetScheduleMinMax(state, schedNum); - } - - MinValueOk = (MinString == ">") ? (sched.MinValue > Minimum) : (FLT_EPSILON >= Minimum - sched.MinValue); - MaxValueOk = (MaxString == "<") ? (sched.MaxValue < Maximum) : (sched.MaxValue - Maximum <= FLT_EPSILON); - } else { - MinValueOk = MaxValueOk = false; - ShowFatalError(state, "CheckScheduleValueMinMax called with ScheduleIndex out of range"); + if (!this->isMinMaxSet) { + this->setMinMaxVals(state); } - return (MinValueOk && MaxValueOk); - } + bool minOk = (cluMin == Clusive::Ex) ? (this->minVal > min) : (FLT_EPSILON >= min - this->minVal); + bool maxOk = (cluMax == Clusive::Ex) ? (this->maxVal < max) : (this->maxVal - max <= FLT_EPSILON); - bool CheckScheduleValue(EnergyPlusData &state, - int const ScheduleIndex, // Which Schedule being tested - Real64 const Value // Actual desired value + return (minOk && maxOk); + } // ScheduleBase::checkMinMaxVals() + + bool CheckScheduleValueMinMax(EnergyPlusData &state, + int const schedNum, // Which Schedule being tested + Clusive cluMin, // Minimum indicator ('>', '>=') + Real64 const min, // Minimum desired value + Clusive cluMax, // Maximum indicator ('<', ',=') + Real64 const max // Maximum desired value ) { - // FUNCTION INFORMATION: - // AUTHOR Linda K. Lawrie - // DATE WRITTEN November 2004 - // MODIFIED na - // RE-ENGINEERED na + // Wrapper for method + return state.dataSched->schedules[schedNum]->checkMinMaxVals(state, cluMin, min, cluMax, max); + } // CheckScheduleValueMinMax() - // PURPOSE OF THIS FUNCTION: - // This function checks the indicated schedule value for validity. Uses the ScheduleIndex - // from (GetScheduleIndex). + bool ScheduleConstant::hasVal([[maybe_unused]] EnergyPlusData &state, Real64 const value) const + { + return value == this->currentVal; + } // ScheduleConstant::hasVal() - // METHODOLOGY EMPLOYED: - // This routine is best used with "discrete" schedules. The routine must traverse all values - // in the schedule and compares by equality. + bool ScheduleDetailed::hasVal(EnergyPlusData &state, Real64 const value) const + { + auto const &s_sched = state.dataSched; + auto const &s_glob = state.dataGlobal; - // REFERENCES: - // na + // These arrays make sure you don't check the same day or week schedule twice + std::vector weekSchedChecked; + weekSchedChecked.resize(s_sched->weekSchedules.size()); + std::fill(weekSchedChecked.begin(), weekSchedChecked.end(), false); - // USE STATEMENTS: - // na + std::vector daySchedChecked; + daySchedChecked.resize(s_sched->daySchedules.size()); + std::fill(daySchedChecked.begin(), daySchedChecked.end(), false); - // Return value - bool CheckScheduleValue; + for (int iWeek = 1; iWeek <= 366; ++iWeek) { + auto const *weekSched = this->weekScheds[iWeek]; + if (weekSchedChecked[weekSched->Num]) continue; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: + for (int iDay = 1; iDay < (int)DayType::Num; ++iDay) { + auto const *daySched = weekSched->dayScheds[iDay]; + if (daySchedChecked[daySched->Num]) continue; - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - int Loop; // Loop Control variable - int DayT; // Day Type Loop control - int WkSch; // Pointer for WeekSchedule value - - CheckScheduleValue = false; - - if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOn) { - CheckScheduleValue = (Value == 1.0); - } else if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOff) { - CheckScheduleValue = (Value == 0.0); - } else if (ScheduleIndex < 1 || ScheduleIndex > state.dataScheduleMgr->NumSchedules) { - ShowFatalError(state, "CheckScheduleValue called with ScheduleIndex out of range"); - } - - if (ScheduleIndex > 0) { - CheckScheduleValue = false; - for (Loop = 1; Loop <= 366; ++Loop) { - WkSch = state.dataScheduleMgr->Schedule(ScheduleIndex).WeekSchedulePointer(Loop); - for (DayT = 1; DayT <= maxDayTypes; ++DayT) { - if (any_eq(state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(DayT)).TSValue, - Value)) { - CheckScheduleValue = true; - goto DayLoop_exit; - } + for (int i = 0; i < Constant::iHoursInDay * s_glob->TimeStepsInHour; ++i) { + if (daySched->tsVals[i] == value) return true; } + daySchedChecked[daySched->Num] = true; } - DayLoop_exit:; + weekSchedChecked[weekSched->Num] = true; } - return CheckScheduleValue; - } + return false; + } // ScheduleDetailed::hasVal() bool CheckScheduleValue(EnergyPlusData &state, - int const ScheduleIndex, // Which Schedule being tested - int const Value // Actual desired value + int const schedNum, // Which Schedule being tested + Real64 const value // Actual desired value ) { - // FUNCTION INFORMATION: - // AUTHOR Linda K. Lawrie - // DATE WRITTEN November 2004 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS FUNCTION: - // This function checks the indicated schedule value for validity. Uses the ScheduleIndex - // from (GetScheduleIndex). - - // METHODOLOGY EMPLOYED: - // This routine is best used with "discrete" schedules. The routine must traverse all values - // in the schedule and compares by equality. - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Return value - bool CheckScheduleValue; - - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - int Loop; // Loop Control variable - int DayT; // Day Type Loop control - int WkSch; // Pointer for WeekSchedule value - - CheckScheduleValue = false; - if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOn) { - CheckScheduleValue = (Value == 1); - } else if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOff) { - CheckScheduleValue = (Value == 0); - } else if (ScheduleIndex < 1 || ScheduleIndex > state.dataScheduleMgr->NumSchedules) { - ShowFatalError(state, "CheckScheduleValue called with ScheduleIndex out of range"); - } - - if (ScheduleIndex > 0) { - for (Loop = 1; Loop <= 366; ++Loop) { - WkSch = state.dataScheduleMgr->Schedule(ScheduleIndex).WeekSchedulePointer(Loop); - for (DayT = 1; DayT <= maxDayTypes; ++DayT) { - if (any_eq(state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(DayT)).TSValue, - double(Value))) { - CheckScheduleValue = true; - goto DayLoop_exit; - } - } - } - DayLoop_exit:; - } - - return CheckScheduleValue; + // Method wrapper + return state.dataSched->schedules[schedNum]->hasVal(state, value); } - bool CheckDayScheduleValueMinMax(EnergyPlusData &state, - int const ScheduleIndex, // Which Day Schedule being tested - Real64 const Minimum, // Minimum desired value - bool const exclusiveMin, // Minimum indicator ('>', '>=') - Real64 const Maximum, // Maximum desired value - bool const exclusiveMax // Maximum indicator ('<', ',=') - ) + bool CheckDayScheduleMinValues(EnergyPlusData &state, + int const schedNum, // Which Day Schedule being tested + Clusive cluMin, + Real64 const min) { - // FUNCTION INFORMATION: - // AUTHOR Linda K. Lawrie - // DATE WRITTEN February 2003 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS FUNCTION: - // This function checks the indicated schedule values for validity. Uses the ScheduleIndex - // from (GetScheduleIndex), a minimum and a maximum -- one or other optional to check "internals". - - // METHODOLOGY EMPLOYED: - // Schedule data structure stores this on first validity check. If there, then is returned else - // looks up minimum and maximum values for the schedule and then sets result of function based on - // requested minimum/maximum checks. - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Return value - bool CheckDayScheduleValueMinMax; - - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - Real64 MinValue(0.0); // For total minimum - Real64 MaxValue(0.0); // For total maximum - bool MinValueOk; - bool MaxValueOk; - - if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOn) { - MinValue = 1.0; - MaxValue = 1.0; - } else if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOff) { - MinValue = 0.0; - MaxValue = 0.0; - } else if (ScheduleIndex < 1 || ScheduleIndex > state.dataScheduleMgr->NumDaySchedules) { - ShowFatalError(state, "CheckDayScheduleValueMinMax called with ScheduleIndex out of range"); - } - - if (ScheduleIndex > 0) { - MinValue = minval(state.dataScheduleMgr->DaySchedule(ScheduleIndex).TSValue); - MaxValue = maxval(state.dataScheduleMgr->DaySchedule(ScheduleIndex).TSValue); - } - - // Min/max for schedule has been set. Test. - MinValueOk = true; - MaxValueOk = true; + // Method wrapper + return state.dataSched->daySchedules[schedNum]->checkMinVal(state, cluMin, min); + } // CheckDayScheduleMinValues() - if (exclusiveMin) { - MinValueOk = (MinValue > Minimum); - } else { - MinValueOk = (FLT_EPSILON >= Minimum - MinValue); - } - - if (exclusiveMax) { - MaxValueOk = (MaxValue < Maximum); - } else { - MaxValueOk = (MaxValue - Maximum <= FLT_EPSILON); - } - - CheckDayScheduleValueMinMax = (MinValueOk && MaxValueOk); - - return CheckDayScheduleValueMinMax; - } - - bool CheckDayScheduleValueMinMax(EnergyPlusData &state, - int const ScheduleIndex, // Which Day Schedule being tested - Real64 const Minimum, // Minimum desired value - bool const exclusiveMin // Minimum indicator ('>', '>=') - ) + bool ScheduleConstant::hasFractionalVal([[maybe_unused]] EnergyPlusData &state) const { - // FUNCTION INFORMATION: - // AUTHOR Linda K. Lawrie - // DATE WRITTEN February 2003 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS FUNCTION: - // This function checks the indicated schedule values for validity. Uses the ScheduleIndex - // from (GetScheduleIndex), a minimum and a maximum -- one or other optional to check "internals". + return (this->currentVal > 0.0) && (this->currentVal < 1.0); + } // ScheduleYear::hasFractionalVal() - // METHODOLOGY EMPLOYED: - // Schedule data structure stores this on first validity check. If there, then is returned else - // looks up minimum and maximum values for the schedule and then sets result of function based on - // requested minimum/maximum checks. - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Return value - bool CheckDayScheduleValueMinMax; - - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - Real64 MinValue(0.0); // For total minimum - bool MinValueOk; - - if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOn) { - MinValue = 1.0; - } else if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOff) { - MinValue = 0.0; - } else if (ScheduleIndex < 1 || ScheduleIndex > state.dataScheduleMgr->NumDaySchedules) { - ShowFatalError(state, "CheckDayScheduleValueMinMax called with ScheduleIndex out of range"); - } - - if (ScheduleIndex > 0) { - MinValue = minval(state.dataScheduleMgr->DaySchedule(ScheduleIndex).TSValue); - } - - // Min/max for schedule has been set. Test. - MinValueOk = true; - - if (exclusiveMin) { - MinValueOk = (MinValue > Minimum); - } else { - MinValueOk = (FLT_EPSILON >= Minimum - MinValue); - } - - CheckDayScheduleValueMinMax = MinValueOk; - - return CheckDayScheduleValueMinMax; - } - - bool HasFractionalScheduleValue(EnergyPlusData &state, int const ScheduleIndex) // Which Schedule being tested + bool ScheduleDetailed::hasFractionalVal(EnergyPlusData &state) const { - // FUNCTION INFORMATION: - // AUTHOR Linda K. Lawrie - // DATE WRITTEN March 2008 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS FUNCTION: - // This function returns true if the schedule contains fractional - // values [>0, <1]. - - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Return value - bool HasFractions; // True if the schedule has fractional values + auto const &s_sched = state.dataSched; + auto const &s_glob = state.dataGlobal; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na + // These arrays make sure you don't check the same day or week schedule twice + std::vector weekSchedChecked; + weekSchedChecked.resize(s_sched->weekSchedules.size()); + std::fill(weekSchedChecked.begin(), weekSchedChecked.end(), false); - // DERIVED TYPE DEFINITIONS - // na + std::vector daySchedChecked; + daySchedChecked.resize(s_sched->daySchedules.size()); + std::fill(daySchedChecked.begin(), daySchedChecked.end(), false); - // FUNCTION LOCAL VARIABLE DECLARATIONS: - int WkSch; - int DayT; - int Loop; - int Hour; - int TStep; + for (int iWeek = 1; iWeek <= 366; ++iWeek) { + auto const *weekSched = this->weekScheds[iWeek]; + if (weekSchedChecked[weekSched->Num]) continue; - if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOn || ScheduleIndex == ScheduleManager::ScheduleAlwaysOff) { - - } else if (ScheduleIndex < 1 || ScheduleIndex > state.dataScheduleMgr->NumSchedules) { - ShowFatalError(state, "HasFractionalScheduleValue called with ScheduleIndex out of range"); - } + for (int iDay = 1; iDay < (int)DayType::Num; ++iDay) { + auto const *daySched = weekSched->dayScheds[iDay]; + if (daySchedChecked[daySched->Num]) continue; - HasFractions = false; - - if (ScheduleIndex > 0) { - WkSch = state.dataScheduleMgr->Schedule(ScheduleIndex).WeekSchedulePointer(1); - for (DayT = 1; DayT <= maxDayTypes; ++DayT) { - for (Hour = 1; Hour <= 24; ++Hour) { - for (TStep = 1; TStep <= state.dataGlobal->NumOfTimeStepInHour; ++TStep) { - if (state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(DayT)) - .TSValue(TStep, Hour) > 0.0 && - state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(DayT)) - .TSValue(TStep, Hour) < 1.0) { - HasFractions = true; - goto DayTLoop_exit; - } - } - } - } - DayTLoop_exit:; - if (!HasFractions) { - for (Loop = 2; Loop <= 366; ++Loop) { - WkSch = state.dataScheduleMgr->Schedule(ScheduleIndex).WeekSchedulePointer(Loop); - for (DayT = 1; DayT <= maxDayTypes; ++DayT) { - for (Hour = 1; Hour <= 24; ++Hour) { - for (TStep = 1; TStep <= state.dataGlobal->NumOfTimeStepInHour; ++TStep) { - if (state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(DayT)) - .TSValue(TStep, Hour) > 0.0 && - state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(DayT)) - .TSValue(TStep, Hour) < 1.0) { - HasFractions = true; - goto DayTLoop2_exit; - } - } - } - } - DayTLoop2_exit:; + for (int i = 0; i < Constant::iHoursInDay * s_glob->TimeStepsInHour; ++i) { + if (daySched->tsVals[i] > 0.0 && daySched->tsVals[i] < 1.0) return true; } + daySchedChecked[daySched->Num] = true; } + weekSchedChecked[weekSched->Num] = true; } - return HasFractions; - } + return false; + } // ScheduleDetailed::hasFractionalVal() - Real64 GetScheduleMinValue(EnergyPlusData &state, int const ScheduleIndex) // Which Schedule being tested + std::pair ScheduleConstant::getMinMaxValsByDayType([[maybe_unused]] EnergyPlusData &state, + [[maybe_unused]] DayTypeGroup const days) { - // FUNCTION INFORMATION: - // AUTHOR Linda K. Lawrie - // DATE WRITTEN February 2004 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS FUNCTION: - // This function returns the minimum value used by a schedule over - // the entire year. - - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Return value - Real64 MinimumValue; // Minimum value for schedule - - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - Real64 MinValue(0.0); - Real64 MaxValue(0.0); - int WkSch; - int DayT; - int Loop; - - if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOn) { - MinValue = 1.0; - MaxValue = 1.0; - } else if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOff) { - MinValue = 0.0; - MaxValue = 0.0; - } else if (ScheduleIndex < 1 || ScheduleIndex > state.dataScheduleMgr->NumSchedules) { - ShowFatalError(state, "GetScheduleMinValue called with ScheduleIndex out of range"); - } - - if (ScheduleIndex > 0) { - if (!state.dataScheduleMgr->Schedule(ScheduleIndex).MaxMinSet) { // Set Minimum/Maximums for this schedule - WkSch = state.dataScheduleMgr->Schedule(ScheduleIndex).WeekSchedulePointer(1); - MinValue = minval(state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(1)).TSValue); - MaxValue = maxval(state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(1)).TSValue); - for (DayT = 2; DayT <= maxDayTypes; ++DayT) { - MinValue = - min(MinValue, - minval(state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(DayT)).TSValue)); - MaxValue = - max(MaxValue, - maxval(state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(DayT)).TSValue)); - } - int prevWkSch = -999; // set to a value that would never occur - for (Loop = 2; Loop <= 366; ++Loop) { - WkSch = state.dataScheduleMgr->Schedule(ScheduleIndex).WeekSchedulePointer(Loop); - if (WkSch != prevWkSch) { // skip if same as previous week (very common) - for (DayT = 1; DayT <= maxDayTypes; ++DayT) { - MinValue = min( - MinValue, - minval( - state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(DayT)).TSValue)); - MaxValue = max( - MaxValue, - maxval( - state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(DayT)).TSValue)); - } - prevWkSch = WkSch; - } - } - state.dataScheduleMgr->Schedule(ScheduleIndex).MaxMinSet = true; - state.dataScheduleMgr->Schedule(ScheduleIndex).MinValue = MinValue; - state.dataScheduleMgr->Schedule(ScheduleIndex).MaxValue = MaxValue; - } + return std::make_pair(this->currentVal, this->currentVal); + } // ScheduleConstant::getMinMaxValsByDayType() - // Min/max for schedule has been set. - MinimumValue = state.dataScheduleMgr->Schedule(ScheduleIndex).MinValue; - } else { - MinimumValue = MinValue; - } - - return MinimumValue; - } - - Real64 GetScheduleMaxValue(EnergyPlusData &state, int const ScheduleIndex) // Which Schedule being tested - { - // FUNCTION INFORMATION: - // AUTHOR Linda K. Lawrie - // DATE WRITTEN February 2004 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS FUNCTION: - // This function returns the maximum value used by a schedule over - // the entire year. - - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Return value - Real64 MaximumValue; // Maximum value for schedule - - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - Real64 MinValue(0.0); - Real64 MaxValue(0.0); - int WkSch; - int DayT; - int Loop; - - if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOn) { - MinValue = 1.0; - MaxValue = 1.0; - } else if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOff) { - MinValue = 0.0; - MaxValue = 0.0; - } else if (ScheduleIndex < 1 || ScheduleIndex > state.dataScheduleMgr->NumSchedules) { - ShowFatalError(state, "CheckScheduleMaxValue called with ScheduleIndex out of range"); - } - - if (ScheduleIndex > 0) { - if (!state.dataScheduleMgr->Schedule(ScheduleIndex).MaxMinSet) { // Set Minimum/Maximums for this schedule - WkSch = state.dataScheduleMgr->Schedule(ScheduleIndex).WeekSchedulePointer(1); - MinValue = minval(state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(1)).TSValue); - MaxValue = maxval(state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(1)).TSValue); - for (DayT = 2; DayT <= maxDayTypes; ++DayT) { - MinValue = - min(MinValue, - minval(state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(DayT)).TSValue)); - MaxValue = - max(MaxValue, - maxval(state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(DayT)).TSValue)); - } - int prevWkSch = -999; // set to a value that would never occur - for (Loop = 2; Loop <= 366; ++Loop) { - WkSch = state.dataScheduleMgr->Schedule(ScheduleIndex).WeekSchedulePointer(Loop); - if (WkSch != prevWkSch) { // skip if same as previous week (very common) - for (DayT = 1; DayT <= maxDayTypes; ++DayT) { - MinValue = min( - MinValue, - minval( - state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(DayT)).TSValue)); - MaxValue = max( - MaxValue, - maxval( - state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(DayT)).TSValue)); - } - prevWkSch = WkSch; - } - } - state.dataScheduleMgr->Schedule(ScheduleIndex).MaxMinSet = true; - state.dataScheduleMgr->Schedule(ScheduleIndex).MinValue = MinValue; - state.dataScheduleMgr->Schedule(ScheduleIndex).MaxValue = MaxValue; - } - - // Min/max for schedule has been set. - - MaximumValue = state.dataScheduleMgr->Schedule(ScheduleIndex).MaxValue; - } else { - MaximumValue = MaxValue; - } - - return MaximumValue; - } - - std::pair getScheduleMinMaxByDayType(EnergyPlusData &state, int const ScheduleIndex, DayTypeGroup const days) + std::pair ScheduleDetailed::getMinMaxValsByDayType(EnergyPlusData &state, DayTypeGroup const days) { // J. Glazer - March 2024 // finds the minimum and maximum for a specific set of day types for a given schedule - Real64 MinValue = Constant::BigNumber; - Real64 MaxValue = -Constant::BigNumber; - // Sun Mon Tues Wed Thur Fri Sat Hol Summer Winter Cust1 Cust2 - constexpr std::array dayTypeFilterWkDy = {false, true, true, true, true, true, false, false, false, false, false, false}; - constexpr std::array dayTypeFilterWeHo = {true, false, false, false, false, false, true, true, false, false, false, false}; - // Sun Mon Tues Wed Thur Fri Sat Hol Summer Winter Cust1 Cust2 - constexpr std::array dayTypeFilterSumDsDy = { - false, false, false, false, false, false, false, false, true, false, false, false}; - constexpr std::array dayTypeFilterWinDsDy = { - false, false, false, false, false, false, false, false, false, true, false, false}; - constexpr std::array dayTypeFilterNone = { - false, false, false, false, false, false, false, false, false, false, false, false}; - if (ScheduleIndex > 0 && ScheduleIndex <= state.dataScheduleMgr->NumSchedules) { - int curDayTypeGroup = static_cast(days); - auto &curSch = state.dataScheduleMgr->Schedule(ScheduleIndex); - if (!curSch.MaxMinSet) { - SetScheduleMinMax(state, ScheduleIndex); - } - if (!curSch.MaxMinByDayTypeSet[curDayTypeGroup]) { - std::array dayTypeFilter; - switch (days) { - case DayTypeGroup::Weekday: - dayTypeFilter = dayTypeFilterWkDy; - break; - case DayTypeGroup::WeekEndHoliday: - dayTypeFilter = dayTypeFilterWeHo; - break; - case DayTypeGroup::SummerDesignDay: - dayTypeFilter = dayTypeFilterSumDsDy; - break; - case DayTypeGroup::WinterDesignDay: - dayTypeFilter = dayTypeFilterWinDsDy; - break; - default: - dayTypeFilter = dayTypeFilterNone; - break; - } - int prevWkSch = -999; // set to a value that would never occur - for (int iDayOfYear = 1; iDayOfYear <= 366; ++iDayOfYear) { - int WkSch = curSch.WeekSchedulePointer(iDayOfYear); - if (WkSch != prevWkSch) { // skip if same as previous week (very common) - auto &weekSch = state.dataScheduleMgr->WeekSchedule(WkSch); - for (int jType = 1; jType <= maxDayTypes; ++jType) { - if (dayTypeFilter[jType - 1]) { - auto &daySch = state.dataScheduleMgr->DaySchedule(weekSch.DaySchedulePointer(jType)); - // use precalcuated min and max from SetScheduleMinMax - MinValue = min(MinValue, daySch.TSValMin); - MaxValue = max(MaxValue, daySch.TSValMax); - } - } - prevWkSch - WkSch; - } - } - if (MinValue == Constant::BigNumber) MinValue = 0; - if (MaxValue == -Constant::BigNumber) MaxValue = 0; - // store for the next call of the same schedule - curSch.MaxByDayType[curDayTypeGroup] = MaxValue; - curSch.MinByDayType[curDayTypeGroup] = MinValue; - curSch.MaxMinByDayTypeSet[curDayTypeGroup] = true; - } else { - // retrieve previously found min and max by day type - MaxValue = curSch.MaxByDayType[curDayTypeGroup]; - MinValue = curSch.MinByDayType[curDayTypeGroup]; - } - } else if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOn) { - MinValue = 1.0; - MaxValue = 1.0; - } else if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOff) { - MinValue = 0.0; - MaxValue = 0.0; - } else { - ShowFatalError(state, "getScheduleMinMaxByDayType called with ScheduleIndex out of range"); - } - return std::make_pair(MinValue, MaxValue); - } + constexpr std::array, (int)DayTypeGroup::Num> dayTypeFilters = {{ + // Unused Sun Mon Tues Wed Thur Fri Sat Hol Summer Winter Cust1 Cust2 + {false, false, true, true, true, true, true, false, false, false, false, false, false}, // Weekday + {false, true, false, false, false, false, false, true, true, false, false, false, false}, // WeekendHoliday + {false, false, false, false, false, false, false, false, false, true, false, false, false}, // SummerDesign + {false, false, false, false, false, false, false, false, false, false, true, false, false} // WinterDesign + }}; - std::string GetScheduleName(EnergyPlusData &state, int const ScheduleIndex) - { - // FUNCTION INFORMATION: - // AUTHOR Linda K. Lawrie - // DATE WRITTEN February 2008 - // MODIFIED na - // RE-ENGINEERED na + auto const &s_sched = state.dataSched; - // PURPOSE OF THIS FUNCTION: - // This function returns the schedule name from the Schedule Index. + if (!this->isMinMaxSet) this->setMinMaxVals(state); - // METHODOLOGY EMPLOYED: - // na + if (!this->MaxMinByDayTypeSet[(int)days]) { - // REFERENCES: - // na + bool firstSet = true; + std::array const &dayTypeFilter = dayTypeFilters[(int)days]; - // USE STATEMENTS: - // na + // These arrays make sure you don't check the same day or week schedule twice + std::vector weekSchedChecked; + weekSchedChecked.resize(s_sched->weekSchedules.size()); + std::fill(weekSchedChecked.begin(), weekSchedChecked.end(), false); - // Return value - std::string ScheduleName; + std::vector daySchedChecked; + daySchedChecked.resize(s_sched->daySchedules.size()); + std::fill(daySchedChecked.begin(), daySchedChecked.end(), false); - // Locals - // FUNCTION ARGUMENT DEFINITIONS: + this->MinByDayType[(int)days] = this->MaxByDayType[(int)days] = 0.0; - // FUNCTION PARAMETER DEFINITIONS: - // na + for (int iDay = 1; iDay <= 366; ++iDay) { + auto const *weekSched = this->weekScheds[iDay]; + if (weekSchedChecked[weekSched->Num]) continue; - // INTERFACE BLOCK SPECIFICATIONS - // na + for (int jDayType = 1; jDayType < (int)DayType::Num; ++jDayType) { + if (!dayTypeFilter[jDayType]) continue; - // DERIVED TYPE DEFINITIONS - // na + auto *daySched = weekSched->dayScheds[jDayType]; + if (daySchedChecked[daySched->Num]) continue; - // FUNCTION LOCAL VARIABLE DECLARATIONS: - // na + if (!daySched->isMinMaxSet) daySched->setMinMaxVals(state); - if (!state.dataScheduleMgr->ScheduleInputProcessed) { - ProcessScheduleInput(state); - state.dataScheduleMgr->ScheduleInputProcessed = true; - } + if (firstSet) { + this->MinByDayType[(int)days] = daySched->minVal; + this->MaxByDayType[(int)days] = daySched->maxVal; + firstSet = false; + } else { + this->MinByDayType[(int)days] = min(this->MinByDayType[(int)days], daySched->minVal); + this->MaxByDayType[(int)days] = max(this->MaxByDayType[(int)days], daySched->maxVal); + } - if (ScheduleIndex > 0) { - ScheduleName = state.dataScheduleMgr->Schedule(ScheduleIndex).Name; - } else if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOn) { - ScheduleName = "Constant-1.0"; - } else if (ScheduleIndex == ScheduleManager::ScheduleAlwaysOff) { - ScheduleName = "Constant-0.0"; - } else { - ScheduleName = "N/A-Invalid"; + daySchedChecked[daySched->Num] = true; + } + weekSchedChecked[weekSched->Num] = true; + } + this->MaxMinByDayTypeSet[(int)days] = true; } + return std::make_pair(this->MinByDayType[(int)days], this->MaxByDayType[(int)days]); + } // ScheduleDetailed::getMinMaxValsByDayType() - return ScheduleName; - } - - void ReportScheduleValues(EnergyPlusData &state) + void ReportScheduleVals(EnergyPlusData &state) { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN February 2004 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine puts the proper current schedule values into the "reporting" // slot for later reporting. + auto const &s_sched = state.dataSched; - if (!state.dataScheduleMgr->ScheduleInputProcessed) { - ProcessScheduleInput(state); - state.dataScheduleMgr->ScheduleInputProcessed = true; - } + if (s_sched->DoScheduleReportingSetup) { // CurrentModuleObject='Any Schedule' + for (auto *sched : s_sched->schedules) { + // No variables for the built-in AlwaysOn and AlwaysOff schedules + if (sched->Num == SchedNum_AlwaysOff || sched->Num == SchedNum_AlwaysOn) continue; - if (state.dataScheduleMgr->DoScheduleReportingSetup) { // CurrentModuleObject='Any Schedule' - for (int ScheduleIndex = 1; ScheduleIndex <= state.dataScheduleMgr->NumSchedules; ++ScheduleIndex) { // Set Up Reporting SetupOutputVariable(state, "Schedule Value", Constant::Units::None, - state.dataScheduleMgr->Schedule(ScheduleIndex).CurrentValue, + sched->currentVal, OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, - state.dataScheduleMgr->Schedule(ScheduleIndex).Name); + sched->Name); } - state.dataScheduleMgr->DoScheduleReportingSetup = false; + s_sched->DoScheduleReportingSetup = false; } // TODO: Is this needed? // Why is it doing exactly the same as UpdateScheduleValues? - UpdateScheduleValues(state); + UpdateScheduleVals(state); } void ReportOrphanSchedules(EnergyPlusData &state) @@ -4707,56 +3495,49 @@ namespace ScheduleManager { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN April 2008 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // In response to CR7498, report orphan (unused) schedule items. - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - bool NeedOrphanMessage; - bool NeedUseMessage; - int Item; - int NumCount; + bool NeedOrphanMessage = true; + bool NeedUseMessage = false; + int NumCount = 0; - NeedOrphanMessage = true; - NeedUseMessage = false; - NumCount = 0; + auto const &s_sched = state.dataSched; + auto const &s_glob = state.dataGlobal; - for (Item = 1; Item <= state.dataScheduleMgr->NumSchedules; ++Item) { - if (state.dataScheduleMgr->Schedule(Item).Used) continue; - if (NeedOrphanMessage && state.dataGlobal->DisplayUnusedSchedules) { + for (auto const *sched : s_sched->schedules) { + if (sched->isUsed) continue; + if (NeedOrphanMessage && s_glob->DisplayUnusedSchedules) { ShowWarningError(state, "The following schedule names are \"Unused Schedules\". These schedules are in the idf"); ShowContinueError(state, " file but are never obtained by the simulation and therefore are NOT used."); NeedOrphanMessage = false; } - if (state.dataGlobal->DisplayUnusedSchedules) { - ShowMessage( - state, - format("Schedule:Year or Schedule:Compact or Schedule:File or Schedule:Constant={}", state.dataScheduleMgr->Schedule(Item).Name)); + if (s_glob->DisplayUnusedSchedules) { + ShowMessage(state, format("Schedule:Year or Schedule:Compact or Schedule:File or Schedule:Constant={}", sched->Name)); } else { ++NumCount; } } if (NumCount > 0) { - ShowMessage(state, fmt::format("There are {} unused schedules in input.", NumCount)); + ShowMessage(state, format("There are {} unused schedules in input.", NumCount)); NeedUseMessage = true; } NeedOrphanMessage = true; NumCount = 0; - for (Item = 1; Item <= state.dataScheduleMgr->NumWeekSchedules; ++Item) { - if (state.dataScheduleMgr->WeekSchedule(Item).Used) continue; - if (state.dataScheduleMgr->WeekSchedule(Item).Name == BlankString) continue; - if (NeedOrphanMessage && state.dataGlobal->DisplayUnusedSchedules) { + for (auto *weekSched : s_sched->weekSchedules) { + if (weekSched->isUsed) continue; + if (weekSched->Name.empty()) continue; + if (NeedOrphanMessage && s_glob->DisplayUnusedSchedules) { ShowWarningError(state, "The following week schedule names are \"Unused Schedules\". These schedules are in the idf"); ShowContinueError(state, " file but are never obtained by the simulation and therefore are NOT used."); NeedOrphanMessage = false; } - if (state.dataGlobal->DisplayUnusedSchedules) { - ShowMessage(state, format("Schedule:Week:Daily or Schedule:Week:Compact={}", state.dataScheduleMgr->WeekSchedule(Item).Name)); + if (s_glob->DisplayUnusedSchedules) { + ShowMessage(state, format("Schedule:Week:Daily or Schedule:Week:Compact={}", weekSched->Name)); } else { ++NumCount; } @@ -4770,193 +3551,313 @@ namespace ScheduleManager { NeedOrphanMessage = true; NumCount = 0; - for (Item = 1; Item <= state.dataScheduleMgr->NumDaySchedules; ++Item) { - if (state.dataScheduleMgr->DaySchedule(Item).Used) continue; - if (state.dataScheduleMgr->DaySchedule(Item).Name == BlankString) continue; - if (NeedOrphanMessage && state.dataGlobal->DisplayUnusedSchedules) { + for (auto *daySched : s_sched->daySchedules) { + if (daySched->isUsed) continue; + if (daySched->Name.empty()) continue; + if (NeedOrphanMessage && s_glob->DisplayUnusedSchedules) { ShowWarningError(state, "The following day schedule names are \"Unused Schedules\". These schedules are in the idf"); ShowContinueError(state, " file but are never obtained by the simulation and therefore are NOT used."); NeedOrphanMessage = false; } - if (state.dataGlobal->DisplayUnusedSchedules) { - ShowMessage( - state, - format("Schedule:Day:Hourly or Schedule:Day:Interval or Schedule:Day:List={}", state.dataScheduleMgr->DaySchedule(Item).Name)); + + if (s_glob->DisplayUnusedSchedules) { + ShowMessage(state, format("Schedule:Day:Hourly or Schedule:Day:Interval or Schedule:Day:List={}", daySched->Name)); } else { ++NumCount; } } if (NumCount > 0) { - ShowMessage(state, fmt::format("There are {} unused day schedules in input.", NumCount)); + ShowMessage(state, format("There are {} unused day schedules in input.", NumCount)); NeedUseMessage = true; } if (NeedUseMessage) ShowMessage(state, "Use Output:Diagnostics,DisplayUnusedSchedules; to see them."); + } // ReportOrphanSchedules() + + // returns the annual full load hours for a schedule - essentially the sum of the hourly values + Real64 ScheduleConstant::getAnnualHoursFullLoad([[maybe_unused]] EnergyPlusData &state, + int const StartDayOfWeek, // Day of week for start of year + bool const isLeapYear // true if it is a leap year containing February 29 + ) + { + if (StartDayOfWeek < iDayType_Sun || StartDayOfWeek > iDayType_Sat) return 0.0; // Assert this instead? + + int DaysInYear = (isLeapYear) ? 366 : 365; + return DaysInYear * Constant::iHoursInDay * this->currentVal; } // returns the annual full load hours for a schedule - essentially the sum of the hourly values - Real64 ScheduleAnnualFullLoadHours(EnergyPlusData &state, - int const ScheduleIndex, // Which Schedule being tested - int const StartDayOfWeek, // Day of week for start of year - bool const isItLeapYear // true if it is a leap year containing February 29 + Real64 ScheduleDetailed::getAnnualHoursFullLoad(EnergyPlusData &state, + int const StartDayOfWeek, // Day of week for start of year + bool const isLeapYear // true if it is a leap year containing February 29 ) { // J. Glazer - July 2017 // adapted from Linda K. Lawrie original code for ScheduleAverageHoursPerWeek() + auto const &s_glob = state.dataGlobal; - int DaysInYear; - - if (isItLeapYear) { - DaysInYear = 366; - } else { - DaysInYear = 365; - } - - if (ScheduleIndex < ScheduleManager::ScheduleAlwaysOn || ScheduleIndex > state.dataScheduleMgr->NumSchedules) { - ShowFatalError(state, "ScheduleAnnualFullLoadHours called with ScheduleIndex out of range"); - } + int DaysInYear = (isLeapYear) ? 366 : 365; int DayT = StartDayOfWeek; Real64 TotalHours = 0.0; - if (DayT == 0) return TotalHours; + if (DayT < iDayType_Sun || DayT > iDayType_Sat) return TotalHours; - for (int Loop = 1; Loop <= DaysInYear; ++Loop) { - int WkSch = state.dataScheduleMgr->Schedule(ScheduleIndex).WeekSchedulePointer(Loop); - TotalHours += sum(state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(DayT)).TSValue) / - double(state.dataGlobal->NumOfTimeStepInHour); + for (int iDay = 1; iDay <= DaysInYear; ++iDay) { + auto const *weekSched = this->weekScheds[iDay]; + auto const *daySched = weekSched->dayScheds[DayT]; + + TotalHours += daySched->sumTsVals / double(s_glob->TimeStepsInHour); ++DayT; - if (DayT > 7) DayT = 1; + if (DayT > iDayType_Sat) DayT = iDayType_Sun; } return TotalHours; } // returns the average number of hours per week based on the schedule index provided - Real64 ScheduleAverageHoursPerWeek(EnergyPlusData &state, - int const ScheduleIndex, // Which Schedule being tested - int const StartDayOfWeek, // Day of week for start of year - bool const isItLeapYear // true if it is a leap year containing February 29 + Real64 Schedule::getAverageWeeklyHoursFullLoad(EnergyPlusData &state, + int const StartDayOfWeek, // Day of week for start of year + bool const isLeapYear // true if it is a leap year containing February 29 ) { // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN August 2006 // MODIFIED September 2012; Glazer - CR8849 - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function returns the "average" hours per week for a schedule over // the entire year. - // Return value - - Real64 WeeksInYear; - - if (isItLeapYear) { - WeeksInYear = 366.0 / 7.0; - } else { - WeeksInYear = 365.0 / 7.0; - } - - if (ScheduleIndex < ScheduleManager::ScheduleAlwaysOn || ScheduleIndex > state.dataScheduleMgr->NumSchedules) { - ShowFatalError(state, "ScheduleAverageHoursPerWeek called with ScheduleIndex out of range"); - } - - Real64 TotalHours = ScheduleAnnualFullLoadHours(state, ScheduleIndex, StartDayOfWeek, isItLeapYear); - - return TotalHours / WeeksInYear; // Ok to return a fraction since WeeksInYear we know is always non-zero + Real64 WeeksInYear = (isLeapYear) ? (366.0 / 7.0) : (365.0 / 7.0); + return this->getAnnualHoursFullLoad(state, StartDayOfWeek, isLeapYear) / WeeksInYear; } // returns the annual hours greater than 1% for a schedule - essentially the number of hours with any operation - Real64 ScheduleHoursGT1perc(EnergyPlusData &state, - int const ScheduleIndex, // Which Schedule being tested - int const StartDayOfWeek, // Day of week for start of year - bool const isItLeapYear // true if it is a leap year containing February 29 + Real64 ScheduleDetailed::getAnnualHoursGreaterThan1Percent(EnergyPlusData &state, + int const StartDayOfWeek, // Day of week for start of year + bool const isItLeapYear // true if it is a leap year containing February 29 ) { // J. Glazer - July 2017 // adapted from Linda K. Lawrie original code for ScheduleAverageHoursPerWeek() + auto const &s_glob = state.dataGlobal; - int DaysInYear; - - if (isItLeapYear) { - DaysInYear = 366; - } else { - DaysInYear = 365; - } - - if (ScheduleIndex < ScheduleManager::ScheduleAlwaysOn || ScheduleIndex > state.dataScheduleMgr->NumSchedules) { - ShowFatalError(state, "ScheduleHoursGT1perc called with ScheduleIndex out of range"); - } + int DaysInYear = (isItLeapYear) ? 366 : 365; int DayT = StartDayOfWeek; Real64 TotalHours = 0.0; - if (DayT == 0) return TotalHours; + if (DayT < iDayType_Sun || DayT > iDayType_Sat) return TotalHours; - for (int Loop = 1; Loop <= DaysInYear; ++Loop) { - int WkSch = state.dataScheduleMgr->Schedule(ScheduleIndex).WeekSchedulePointer(Loop); - for (int hrOfDay = 1; hrOfDay <= 24; ++hrOfDay) { - for (int TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { - if (state.dataScheduleMgr->DaySchedule(state.dataScheduleMgr->WeekSchedule(WkSch).DaySchedulePointer(DayT)) - .TSValue(TS, hrOfDay)) { - TotalHours += state.dataGlobal->TimeStepZone; - } + for (int iDay = 1; iDay <= DaysInYear; ++iDay) { + auto const *weekSched = this->weekScheds[iDay]; + auto const *daySched = weekSched->dayScheds[DayT]; + for (int i = 0; i < Constant::iHoursInDay * s_glob->TimeStepsInHour; ++i) { + if (daySched->tsVals[i] > 0.0) { + TotalHours += s_glob->TimeStepZone; } } ++DayT; - if (DayT > 7) DayT = 1; + if (DayT > iDayType_Sat) DayT = iDayType_Sun; } return TotalHours; - } + } // ScheduleDetailed::getAnnualHoursGreaterThan1Percent() - int GetNumberOfSchedules(EnergyPlusData &state) + // returns the annual hours greater than 1% for a schedule - essentially the number of hours with any operation + Real64 ScheduleConstant::getAnnualHoursGreaterThan1Percent([[maybe_unused]] EnergyPlusData &state, + int const StartDayOfWeek, // Day of week for start of year + bool const isItLeapYear // true if it is a leap year containing February 29 + ) { - // FUNCTION INFORMATION: - // AUTHOR Greg Stark - // DATE WRITTEN September 2008 - // MODIFIED na - // RE-ENGINEERED na + int DaysInYear = (isItLeapYear) ? 366 : 365; - // PURPOSE OF THIS FUNCTION: - // This function returns the number of schedules. + if (StartDayOfWeek < iDayType_Sun || StartDayOfWeek > iDayType_Sat) return 0.0; // Assert this instead? - // METHODOLOGY EMPLOYED: - // na + return (this->currentVal > 0.0) ? (Constant::rHoursInDay * DaysInYear) : 0; + } // ScheduleConstant::getHoursGreaterThan1Percent() + + // returns the temperature value from a schedule at a certain time for the first day of the week in either January or July + std::tuple + ScheduleDetailed::getValAndCountOnDay(EnergyPlusData &state, bool const isSummer, DayType const dayOfWeek, int const hourOfDay) + { + // J.Glazer - Aug 2017 - // REFERENCES: - // na + auto const &s_glob = state.dataGlobal; - // USE STATEMENTS: - // na + // determine month to use based on hemiphere and season + int month; + if (isSummer) { + month = (state.dataEnvrn->Latitude > 0.) ? 7 : 1; + } else { + month = (state.dataEnvrn->Latitude > 0.) ? 1 : 7; + } - // Return value - int NumberOfSchedules; + std::string monthName = (month == 1) ? "January" : "July"; - // Locals - // FUNCTION ARGUMENT DEFINITIONS: + int jdateSelect = General::nthDayOfWeekOfMonth(state, (int)dayOfWeek, 1, month); + + // determine number of days in year + int DaysInYear = (state.dataEnvrn->CurrentYearIsLeapYear) ? 366 : 365; + + // should adjust date if lands on a holiday but for now assume that it does not + + // adjust time of day for daylight savings time + int hourSelect = hourOfDay + state.dataWeather->DSTIndex(jdateSelect); + + // get the value at the selected time + int constexpr firstTimeStep = 1; + auto const *weekSched = this->weekScheds[jdateSelect]; + auto const *daySched = weekSched->dayScheds[(int)dayOfWeek]; + + Real64 value = daySched->tsVals[(hourSelect - 1) * state.dataGlobal->TimeStepsInHour + (firstTimeStep - 1)]; + int countOfSame = 0; + + // count the number of times with that same value + for (int jdateOfYear = 1; jdateOfYear <= DaysInYear; ++jdateOfYear) { + auto const *wSched = this->weekScheds[jdateOfYear]; + if (wSched == weekSched) { // if same week schedule can short circuit rest of testing and increment counter + ++countOfSame; + continue; + } + + auto const *dSched = wSched->dayScheds[(int)dayOfWeek]; + if (dSched == daySched) { // if same day schedule can short circuit rest of testing and increment counter + ++countOfSame; + continue; + } + + if (dSched->tsVals[(hourSelect - 1) * s_glob->TimeStepsInHour + (firstTimeStep - 1)] == value) { + ++countOfSame; + } + } - // FUNCTION PARAMETER DEFINITIONS: - // na + return std::make_tuple(value, countOfSame, monthName); + } // ScheduleDetailed::getValAndCountOnDay() - // INTERFACE BLOCK SPECIFICATIONS - // na + // returns the temperature value from a schedule at a certain time for the first day of the week in either January or July + std::tuple ScheduleConstant::getValAndCountOnDay(EnergyPlusData &state, + bool const isSummer, + [[maybe_unused]] DayType const dayOfWeek, + [[maybe_unused]] int const hourOfDay) + { + // determine month to use based on hemiphere and season + int month; + if (isSummer) { + month = (state.dataEnvrn->Latitude > 0.) ? 7 : 1; + } else { + month = (state.dataEnvrn->Latitude > 0.) ? 1 : 7; + } - // DERIVED TYPE DEFINITIONS - // na + std::string monthName = (month == 1) ? "January" : "July"; + int DaysInYear = (state.dataEnvrn->CurrentYearIsLeapYear) ? 366 : 365; + return std::make_tuple(this->currentVal, DaysInYear, monthName); + } // ScheduleConstant::getValAndCountOnDay() - // FUNCTION LOCAL VARIABLE DECLARATIONS: - // na + void ShowSevereBadMin(EnergyPlusData &state, + ErrorObjectHeader const &eoh, + std::string_view fieldName, + std::string_view fieldVal, + Clusive cluMin, + Real64 minVal, + std::string_view msg) + { + ShowSevereError(state, format("{}: {} = {}", eoh.routineName, eoh.objectType, eoh.objectName)); + ShowContinueError( + state, format("{} = {}, schedule contains values that are {} {}", fieldName, fieldVal, cluMin == Clusive::In ? "<" : "<=", minVal)); + if (!msg.empty()) ShowContinueError(state, format("{}", msg)); + } - NumberOfSchedules = state.dataScheduleMgr->NumSchedules; + void ShowSevereBadMax(EnergyPlusData &state, + ErrorObjectHeader const &eoh, + std::string_view fieldName, + std::string_view fieldVal, + Clusive cluMax, + Real64 maxVal, + std::string_view msg) + { + ShowSevereError(state, format("{}: {} = {}", eoh.routineName, eoh.objectType, eoh.objectName)); + ShowContinueError( + state, format("{} = {}, schedule contains values that are {} {}", fieldName, fieldVal, cluMax == Clusive::In ? ">" : ">=", maxVal)); + if (!msg.empty()) ShowContinueError(state, format("{}", msg)); + } - return NumberOfSchedules; + void ShowSevereBadMinMax(EnergyPlusData &state, + ErrorObjectHeader const &eoh, + std::string_view fieldName, + std::string_view fieldVal, + Clusive cluMin, + Real64 minVal, + Clusive cluMax, + Real64 maxVal, + std::string_view msg) + { + ShowSevereError(state, format("{}: {} = {}", eoh.routineName, eoh.objectType, eoh.objectName)); + ShowContinueError(state, + format("{} = {}, schedule contains values that are {} {} and/or {} {}", + fieldName, + fieldVal, + cluMin == Clusive::In ? "<" : "<=", + minVal, + cluMax == Clusive::In ? ">" : ">=", + maxVal)); + if (!msg.empty()) ShowContinueError(state, format("{}", msg)); + } + + void ShowWarningBadMin(EnergyPlusData &state, + ErrorObjectHeader const &eoh, + std::string_view fieldName, + std::string_view fieldVal, + Clusive cluMin, + Real64 minVal, + std::string_view msg) + { + ShowWarningError(state, format("{}: {} = {}", eoh.routineName, eoh.objectType, eoh.objectName)); + ShowContinueError( + state, format("{} = {}, schedule contains values that are {} {}", fieldName, fieldVal, cluMin == Clusive::In ? "<" : "<=", minVal)); + if (!msg.empty()) ShowContinueError(state, format("{}", msg)); + } + + void ShowWarningBadMax(EnergyPlusData &state, + ErrorObjectHeader const &eoh, + std::string_view fieldName, + std::string_view fieldVal, + Clusive cluMax, + Real64 maxVal, + std::string_view msg) + { + ShowWarningError(state, format("{}: {} = {}", eoh.routineName, eoh.objectType, eoh.objectName)); + ShowContinueError( + state, format("{} = {}, schedule contains values that are {} {}", fieldName, fieldVal, cluMax == Clusive::In ? ">" : ">=", maxVal)); + if (!msg.empty()) ShowContinueError(state, format("{}", msg)); + } + + void ShowWarningBadMinMax(EnergyPlusData &state, + ErrorObjectHeader const &eoh, + std::string_view fieldName, + std::string_view fieldVal, + Clusive cluMin, + Real64 minVal, + Clusive cluMax, + Real64 maxVal, + std::string_view msg) + { + ShowWarningError(state, format("{}: {} = {}", eoh.routineName, eoh.objectType, eoh.objectName)); + ShowContinueError(state, + format("{} = {}, schedule contains values that are {} {} and/or {} {}", + fieldName, + fieldVal, + cluMin == Clusive::In ? "<" : "<=", + minVal, + cluMax == Clusive::In ? ">" : ">=", + maxVal)); + if (!msg.empty()) ShowContinueError(state, format("{}", msg)); } -} // namespace ScheduleManager +} // namespace Sched } // namespace EnergyPlus diff --git a/src/EnergyPlus/ScheduleManager.hh b/src/EnergyPlus/ScheduleManager.hh index 72343930f4a..26d5e88787a 100644 --- a/src/EnergyPlus/ScheduleManager.hh +++ b/src/EnergyPlus/ScheduleManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -51,31 +51,29 @@ // ObjexxFCL Headers #include #include -#include -#include -#include -#include // EnergyPlus Headers #include #include #include +#include namespace EnergyPlus { // Forward declarations struct EnergyPlusData; -namespace ScheduleManager { +namespace Sched { - constexpr int ScheduleAlwaysOn = -1; - constexpr int ScheduleAlwaysOff = 0; + constexpr int SchedNum_Invalid = -1; + constexpr int SchedNum_AlwaysOff = 0; + constexpr int SchedNum_AlwaysOn = 1; enum class DayType { Invalid = -1, - Dummy = 0, - Sunday = 1, + Unused, // This is annoying. Will get rid of it later + Sunday, Monday, Tuesday, Wednesday, @@ -90,32 +88,44 @@ namespace ScheduleManager { Num }; - int constexpr maxDayTypes = static_cast(DayType::Num) - 1; - extern const std::array(DayType::Num)> dayTypeNames; - extern const std::array(DayType::Num)> dayTypeNamesUC; + constexpr int iDayType_Sun = (int)DayType::Sunday; + constexpr int iDayType_Mon = (int)DayType::Monday; + constexpr int iDayType_Tue = (int)DayType::Tuesday; + constexpr int iDayType_Wed = (int)DayType::Wednesday; + constexpr int iDayType_Thu = (int)DayType::Thursday; + constexpr int iDayType_Fri = (int)DayType::Friday; + constexpr int iDayType_Sat = (int)DayType::Saturday; + constexpr int iDayType_Hol = (int)DayType::Holiday; + constexpr int iDayType_SumDes = (int)DayType::SummerDesignDay; + constexpr int iDayType_WinDes = (int)DayType::WinterDesignDay; + constexpr int iDayType_Cus1 = (int)DayType::CustomDay1; + constexpr int iDayType_Cus2 = (int)DayType::CustomDay2; + + extern const std::array dayTypeNames; + extern const std::array dayTypeNamesUC; enum class DayTypeGroup { Invalid = -1, - Weekday = 1, + Weekday, WeekEndHoliday, SummerDesignDay, WinterDesignDay, Num }; - enum class SchedType : int + enum class SchedType { Invalid = -1, - ScheduleInput_year = 1, - ScheduleInput_compact = 2, - ScheduleInput_file = 3, - ScheduleInput_constant = 4, - ScheduleInput_external = 5, + Year, + Compact, + File, + Constant, + External, Num }; - enum class OutputReportLevel + enum class ReportLevel { Invalid = -1, Hourly, @@ -123,7 +133,7 @@ namespace ScheduleManager { Num }; - enum class ScheduleInterpolation + enum class Interpolation { Invalid = -1, No, // no interpolation @@ -132,308 +142,419 @@ namespace ScheduleManager { Num }; - enum class Clusivity + enum class LimitUnits { Invalid = -1, - Inclusive, - Exclusive, + Dimensionless, + Temperature, + DeltaTemperature, + PrecipitationRate, + Angle, + ConvectionCoefficient, + ActivityLevel, + Velocity, + Capacity, + Power, + Availability, + Percent, + Control, + Mode, Num }; - struct ScheduleTypeData + struct ScheduleType { // Members - std::string Name; // Schedule Type Name - bool Limited; // True if this Schedule Type has limits - Real64 Minimum; // Minimum for limited schedule - Real64 Maximum; // Maximum for limited schedule - bool IsReal; // True if this is a "real" schedule, false if integer - int UnitType; // reference ScheduleTypeLimit table - - // Default Constructor - ScheduleTypeData() : Limited(false), Minimum(0.0), Maximum(0.0), IsReal(true), UnitType(0) - { - } + std::string Name; // Schedule Type Name + int Num; // index in vector, useful sometimes + bool isLimited = false; // True if this Schedule Type has limits + Real64 minVal = 0.0; // Minimum for limited schedule + Real64 maxVal = 0.0; // Maximum for limited schedule + bool isReal = true; // True if this is a "real" schedule, false if integer + LimitUnits limitUnits = LimitUnits::Invalid; }; - struct DayScheduleData + struct ScheduleBase { - // Members - std::string Name; // Day Schedule Name - int ScheduleTypePtr; // Index of Schedule Type - ScheduleInterpolation IntervalInterpolated; // Indicator for interval interpolation. If not "interpolated", False. Else True - bool Used; // Indicator for this schedule being "used". - Array2D TSValue; // Value array by simulation timestep - Real64 TSValMax; // maximum of all TSValue's - Real64 TSValMin; // minimum of all TSValue's - - // Default Constructor - DayScheduleData() : ScheduleTypePtr(0), IntervalInterpolated(ScheduleInterpolation::No), Used(false), TSValMax(0.0), TSValMin(0.0) + std::string Name; + int Num = SchedNum_Invalid; + bool isUsed = false; + + Real64 maxVal = 0.0; // maximum of all TSValue's + Real64 minVal = 0.0; // minimum of all TSValue's + bool isMinMaxSet = false; + + ScheduleBase(){}; + + virtual void can_instantiate() = 0; // abstract base class + + virtual void setMinMaxVals(EnergyPlusData &state) = 0; + Real64 getMinVal(EnergyPlusData &state); + Real64 getMaxVal(EnergyPlusData &state); + + bool checkMinMaxVals(EnergyPlusData &state, Clusive cluMin, Real64 const min, Clusive cluMax, Real64 const max); + bool checkMinVal(EnergyPlusData &state, Clusive cluMin, Real64 const min); + bool checkMaxVal(EnergyPlusData &state, Clusive cluMax, Real64 const max); + }; + + struct DayOrYearSchedule : ScheduleBase + { + DayOrYearSchedule(){}; + virtual ~DayOrYearSchedule(){}; + + virtual std::vector const &getDayVals([[maybe_unused]] EnergyPlusData &state, int jDay = -1, int dayOfWeek = -1) = 0; + }; + + struct DaySchedule : DayOrYearSchedule + { + int schedTypeNum = SchedNum_Invalid; // Index of Schedule Type + + Interpolation interpolation = Interpolation::No; // Indicator for interval interpolation. If not "interpolated", False. Else True + std::vector tsVals; // Value array by simulation timestep + Real64 sumTsVals = 0.0; + + DaySchedule() { } + virtual ~DaySchedule() + { + } + void can_instantiate() + { + assert(false); + } // makes class concrete, but don't call this + + bool checkValsForLimitViolations(EnergyPlusData &state) const; + bool checkValsForBadIntegers(EnergyPlusData &state) const; + void populateFromMinuteVals(EnergyPlusData &state, std::array const &minuteVals); + std::vector const &getDayVals([[maybe_unused]] EnergyPlusData &state, int jDay = -1, int dayOfWeek = -1) + { + return tsVals; + } + void setMinMaxVals(EnergyPlusData &state); }; - struct WeekScheduleData + struct WeekSchedule : public ScheduleBase { // Members - std::string Name; // Week Schedule Name - bool Used; // Indicator for this schedule being "used". - Array1D_int DaySchedulePointer; // Index of Day Schedule + std::array dayScheds = {nullptr}; - // Default Constructor - WeekScheduleData() : Used(false), DaySchedulePointer(maxDayTypes, 0) + WeekSchedule() + { + } + virtual ~WeekSchedule() { } + void can_instantiate() + { + assert(false); + } // makes class concrete, but don't call this + + void setMinMaxVals(EnergyPlusData &state); }; - struct ScheduleData + struct Schedule : public DayOrYearSchedule { - // Members - std::string Name; // Schedule Name - int ScheduleTypePtr; // Index of Schedule Type - Array1D_int WeekSchedulePointer; // one created for each day of possible simulation - SchedType SchType = SchedType::Invalid; // what kind of object has been input. - bool Used; // Indicator for this schedule being "used". - bool MaxMinSet; // Max/min values have been stored for this schedule - Real64 MaxValue; // Maximum value for this schedule - Real64 MinValue; // Minimum value for this schedule - std::array(DayType::Num)> MaxMinByDayTypeSet{ - false}; // minimum and maximum values by daytype have been stored for this schedule - std::array(DayType::Num)> MinByDayType{0.0}; // minimum values by daytype for this schedule - std::array(DayType::Num)> MaxByDayType{0.0}; // maximum values by daytype for this schedule - Real64 CurrentValue; // For Reporting - bool EMSActuatedOn; // indicates if EMS computed - Real64 EMSValue; // EMS value - bool UseDaylightSaving; // Toggles between daylight saving option to be inclused as "No" or "Yes" (default) - - // Default Constructor - ScheduleData() - : ScheduleTypePtr(0), WeekSchedulePointer(366, 0), Used(false), MaxMinSet(false), MaxValue(0.0), MinValue(0.0), CurrentValue(0.0), - EMSActuatedOn(false), EMSValue(0.0), UseDaylightSaving(true) + SchedType type = SchedType::Invalid; + + int schedTypeNum = SchedNum_Invalid; // Index of Schedule Type + bool EMSActuatedOn = false; // indicates if EMS computed + Real64 EMSVal = 0.0; // EMS value + + Real64 currentVal = 0.0; + + Schedule() + { + type = SchedType::Constant; + } + + virtual ~Schedule(){}; + + Real64 getCurrentVal() const { + return EMSActuatedOn ? EMSVal : currentVal; } + + // Looks up a given Schedule value for an hour & timestep, minding whether DST is enabled or not + // Negative ts => unspecified, will use TimeStepsInHour + virtual Real64 getHrTsVal(EnergyPlusData &state, int hr, int ts = -1) const = 0; + virtual bool hasVal(EnergyPlusData &state, Real64 const val) const = 0; + virtual bool hasFractionalVal(EnergyPlusData &state) const = 0; + + virtual std::pair getMinMaxValsByDayType(EnergyPlusData &state, DayTypeGroup const days) = 0; + + Real64 getAverageWeeklyHoursFullLoad(EnergyPlusData &state, int const startDayOfWeek, bool const isLeapYear); + virtual Real64 getAnnualHoursFullLoad(EnergyPlusData &state, int const StartDayOfWeek, bool const isLeapYear) = 0; + virtual Real64 getAnnualHoursGreaterThan1Percent(EnergyPlusData &state, int const StartDayOfWeek, bool const isLeapYear) = 0; + virtual std::tuple + getValAndCountOnDay(EnergyPlusData &state, bool const isSummer, DayType const dayOfWeek, int const hourOfDay) = 0; }; - // Functions + struct ScheduleConstant : public Schedule + { + std::vector tsVals; - void ProcessScheduleInput(EnergyPlusData &state); + ScheduleConstant() + { + type = SchedType::Constant; + } - void ReportScheduleDetails(EnergyPlusData &state, OutputReportLevel const LevelOfDetail); + virtual ~ScheduleConstant(){}; - // Returns the CurrentScheduleValue - Real64 GetCurrentScheduleValue(EnergyPlusData &state, int const ScheduleIndex); + void can_instantiate() + { + assert(false); + } // makes class concrete, but don't call this - // Updates each schedule value to the current timestep - // Uses EMS value if actuated, otherwise calls LookUpScheduleValue with ThisHour=DataGlobals::HourOfDay, ThisTimeStep=DataGlobals::TimeStep - void UpdateScheduleValues(EnergyPlusData &state); + // Looks up a given Schedule value for an hour & timestep, minding whether DST is enabled or not + // Negative ts => unspecified, will use TimeStepsInHour + Real64 getHrTsVal(EnergyPlusData &state, int hr, int ts = -1) const; - // Looks up a given Schedule value for an hour & timestep, minding whether DST is enabled or not - Real64 LookUpScheduleValue(EnergyPlusData &state, - int const ScheduleIndex, - int const ThisHour, - int const ThisTimeStep = -1 // Negative => unspecified, will use NumOfTimeStepInHour - ); + std::vector const &getDayVals(EnergyPlusData &state, int jDay = -1, int dayOfWeek = -1); - int GetScheduleIndex(EnergyPlusData &state, std::string const &ScheduleName); + bool hasVal(EnergyPlusData &state, Real64 const val) const; + bool hasFractionalVal(EnergyPlusData &state) const; - std::string GetScheduleType(EnergyPlusData &state, int const ScheduleIndex); + void setMinMaxVals(EnergyPlusData &state); - int GetDayScheduleIndex(EnergyPlusData &state, std::string &ScheduleName); + std::pair getMinMaxValsByDayType(EnergyPlusData &state, DayTypeGroup const days); - void GetScheduleValuesForDay(EnergyPlusData &state, - int const ScheduleIndex, - Array2S DayValues, - ObjexxFCL::Optional_int_const JDay = _, - ObjexxFCL::Optional_int_const CurDayofWeek = _); + Real64 getAnnualHoursFullLoad(EnergyPlusData &state, int const StartDayOfWeek, bool const isLeapYear); + Real64 getAnnualHoursGreaterThan1Percent(EnergyPlusData &state, int const StartDayOfWeek, bool const isLeapYear); - void GetSingleDayScheduleValues(EnergyPlusData &state, - int const DayScheduleIndex, // Index of the DaySchedule for values - Array2S DayValues // Returned set of values - ); + std::tuple + getValAndCountOnDay(EnergyPlusData &state, bool const isSummer, DayType const dayOfWeek, int const hourOfDay); + }; - void ExternalInterfaceSetSchedule(EnergyPlusData &state, - int &ScheduleIndex, - Real64 &Value // The new value for the schedule - ); + struct ScheduleDetailed : public Schedule + { + // Members + std::array weekScheds = {nullptr}; // one created for each day of possible simulation + std::array MaxMinByDayTypeSet = {false}; // minimum and maximum values by daytype have been stored + std::array MinByDayType = {0.0}; // minimum values by daytype for this schedule + std::array MaxByDayType = {0.0}; // maximum values by daytype for this schedule + bool UseDaylightSaving = true; // Toggles between daylight saving option to be inclused as "No" or "Yes" (default) - void ProcessIntervalFields(EnergyPlusData &state, - Array1S_string const Untils, - Array1S const Numbers, - int const NumUntils, - int const NumNumbers, - Array2A MinuteValue, - Array2A_bool SetMinuteValue, - bool &ErrorsFound, - std::string const &DayScheduleName, // Name (used for errors) - std::string const &ErrContext, // Context (used for errors) - ScheduleInterpolation interpolationKind // enumeration on how to interpolate values in schedule - ); + ScheduleDetailed() + { + type = SchedType::Year; + } - void DecodeHHMMField(EnergyPlusData &state, - std::string const &FieldValue, // Input field value - int &RetHH, // Returned "hour" - int &RetMM, // Returned "minute" - bool &ErrorsFound, // True if errors found in this field - std::string const &DayScheduleName, // originating day schedule name - std::string const &FullFieldValue, // Full Input field value - ScheduleInterpolation interpolationKind // enumeration on how to interpolate values in schedule - ); + ~ScheduleDetailed() + { + } - bool isMinuteMultipleOfTimestep(int minute, int numMinutesPerTimestep); + void can_instantiate() + { + assert(false); + } // makes class concrete, but don't call this - void ProcessForDayTypes(EnergyPlusData &state, - std::string const &ForDayField, // Field containing the "FOR:..." - Array1D_bool &TheseDays, // Array to contain returned "true" days - Array1D_bool &AlReady, // Array of days already done - bool &ErrorsFound // Will be true if error found. - ); + std::vector const &getDayVals(EnergyPlusData &state, int jDay = -1, int dayOfWeek = -1); - bool CheckScheduleValueMinMax(EnergyPlusData &state, - int const ScheduleIndex, // Which Schedule being tested - bool includeOrEquals, // Minimum indicator ('>', '>=') - Real64 const Minimum // Minimum desired value - ); + bool hasVal(EnergyPlusData &state, Real64 const val) const; + bool hasFractionalVal(EnergyPlusData &state) const; - bool CheckScheduleValueMinMax(EnergyPlusData &state, - int const ScheduleIndex, // Which Schedule being tested - std::string_view MinString, // Minimum indicator ('>', '>=') - Real64 const Minimum, // Minimum desired value - std::string_view MaxString, // Maximum indicator ('<', ',=') - Real64 const Maximum // Maximum desired value - ); + void setMinMaxVals(EnergyPlusData &state); - bool CheckScheduleValueMinMax(EnergyPlusData &state, - int const ScheduleIndex, // Which Schedule being tested - Clusivity clusiveMin, // true ? '>' : '>=' - Real64 const Minimum, // Minimum desired value - Clusivity clusiveMax, // true ? '<' : '<=' - Real64 const Maximum // Maximum desired value - ); + // Looks up a given Schedule value for an hour & timestep, minding whether DST is enabled or not + // Negative ts => unspecified, will use TimeStepsInHour + Real64 getHrTsVal(EnergyPlusData &state, int hr, int ts = -1) const; - bool CheckScheduleValueMinMax(EnergyPlusData &state, - int const ScheduleIndex, // Which Schedule being tested - std::string const &MinString, // Minimum indicator ('>', '>=') - Real32 const Minimum // Minimum desired value - ); + std::pair getMinMaxValsByDayType(EnergyPlusData &state, DayTypeGroup const days); - bool CheckScheduleValueMinMax(EnergyPlusData &state, - int const ScheduleIndex, // Which Schedule being tested - std::string const &MinString, // Minimum indicator ('>', '>=') - Real32 const Minimum, // Minimum desired value - std::string const &MaxString, // Maximum indicator ('<', ',=') - Real32 const Maximum // Maximum desired value - ); + Real64 getAnnualHoursFullLoad(EnergyPlusData &state, int const StartDayOfWeek, bool const isLeapYear); + Real64 getAnnualHoursGreaterThan1Percent(EnergyPlusData &state, int const StartDayOfWeek, bool const isLeapYear); - bool CheckScheduleValue(EnergyPlusData &state, - int const ScheduleIndex, // Which Schedule being tested - Real64 const Value // Actual desired value - ); + std::tuple + getValAndCountOnDay(EnergyPlusData &state, bool const isSummer, DayType const dayOfWeek, int const hourOfDay); + }; - bool CheckScheduleValue(EnergyPlusData &state, - int const ScheduleIndex, // Which Schedule being tested - int const Value // Actual desired value - ); + // Functions + ScheduleDetailed *AddScheduleDetailed(EnergyPlusData &state, std::string const &name); + ScheduleConstant *AddScheduleConstant(EnergyPlusData &state, std::string const &name); + DaySchedule *AddDaySchedule(EnergyPlusData &state, std::string const &name); + WeekSchedule *AddWeekSchedule(EnergyPlusData &state, std::string const &name); - bool CheckDayScheduleValueMinMax(EnergyPlusData &state, - int const ScheduleIndex, // Which Day Schedule being tested - Real64 const Minimum, // Minimum desired value - bool const exclusiveMin, // Minimum indicator ('>', '>=') - Real64 const Maximum, // Maximum desired value - bool const exclusiveMax // Maximum indicator ('<', ',=') - ); + void ProcessScheduleInput(EnergyPlusData &state); - bool CheckDayScheduleValueMinMax(EnergyPlusData &state, - int const ScheduleIndex, // Which Day Schedule being tested - Real64 const Minimum, // Minimum desired value - bool const exclusiveMin // Minimum indicator ('>', '>=') - ); + void InitConstantScheduleData(EnergyPlusData &state); - bool HasFractionalScheduleValue(EnergyPlusData &state, int const ScheduleIndex); // Which Schedule being tested + void ReportScheduleDetails(EnergyPlusData &state, ReportLevel const LevelOfDetail); - Real64 GetScheduleMinValue(EnergyPlusData &state, int const ScheduleIndex); // Which Schedule being tested + // Returns the CurrentScheduleValue + Real64 GetHrTsScheduleVal(EnergyPlusData &state, int const schedNum, int const hr, int const ts = -1); + // Updates each schedule value to the current timestep - Real64 GetScheduleMaxValue(EnergyPlusData &state, int const ScheduleIndex); // Which Schedule being tested + // Uses EMS value if actuated, otherwise calls LookUpScheduleValue with ThisHour=DataGlobals::HourOfDay, ThisTimeStep=DataGlobals::TimeStep + void UpdateScheduleVals(EnergyPlusData &state); - std::pair getScheduleMinMaxByDayType(EnergyPlusData &state, int const ScheduleIndex, DayTypeGroup const days); + int GetScheduleTypeNum(EnergyPlusData &state, std::string const &name); - std::string GetScheduleName(EnergyPlusData &state, int const ScheduleIndex); + int GetDayScheduleNum(EnergyPlusData &state, std::string const &name); + DaySchedule *GetDaySchedule(EnergyPlusData &state, std::string const &name); - void ReportScheduleValues(EnergyPlusData &state); + int GetWeekScheduleNum(EnergyPlusData &state, std::string const &name); + WeekSchedule *GetWeekSchedule(EnergyPlusData &state, std::string const &name); - void ReportOrphanSchedules(EnergyPlusData &state); + int GetScheduleNum(EnergyPlusData &state, std::string const &name); + Schedule *GetSchedule(EnergyPlusData &state, std::string const &name); + Schedule *GetScheduleAlwaysOn(EnergyPlusData &state); + Schedule *GetScheduleAlwaysOff(EnergyPlusData &state); - Real64 ScheduleAnnualFullLoadHours(EnergyPlusData &state, - int const ScheduleIndex, // Which Schedule being tested - int const StartDayOfWeek, // Day of week for start of year - bool const isItLeapYear // true if it is a leap year containing February 29 + void ExternalInterfaceSetSchedule(EnergyPlusData &state, + int schedNum, + Real64 val // The new value for the schedule ); - Real64 ScheduleAverageHoursPerWeek(EnergyPlusData &state, - int const ScheduleIndex, // Which Schedule being tested - int const StartDayOfWeek, // Day of week for start of year - bool const isItLeapYear // true if it is a leap year containing February 29 + void ProcessIntervalFields(EnergyPlusData &state, + Array1S_string const Untils, + Array1S const Numbers, + int const NumUntils, + int const NumNumbers, + std::array &minuteVals, + std::array &setMinuteVals, + bool &ErrorsFound, + std::string const &DayScheduleName, // Name (used for errors) + std::string const &ErrContext, // Context (used for errors) + Interpolation interpolation // enumeration on how to interpolate values in schedule ); - Real64 ScheduleHoursGT1perc(EnergyPlusData &state, - int const ScheduleIndex, // Which Schedule being tested - int const StartDayOfWeek, // Day of week for start of year - bool const isItLeapYear // true if it is a leap year containing February 29 + void DecodeHHMMField(EnergyPlusData &state, + std::string const &FieldVal, // Input field value + int &RetHH, // Returned "hour" + int &RetMM, // Returned "minute" + bool &ErrorsFound, // True if errors found in this field + std::string const &DayScheduleName, // originating day schedule name + std::string const &FullFieldValue, // Full Input field value + Interpolation interpolation // enumeration on how to interpolate values in schedule ); - int GetNumberOfSchedules(EnergyPlusData &state); + bool isMinuteMultipleOfTimestep(int minute, int numMinutesPerTimestep); + + void ProcessForDayTypes(EnergyPlusData &state, + std::string const &ForDayField, // Field containing the "FOR:..." + std::array &theseDays, // Array to contain returned "true" days + std::array &allDays, // Array of days already done + bool &ErrorsFound // Will be true if error found. + ); + + void ReportScheduleVals(EnergyPlusData &state); + + void ReportOrphanSchedules(EnergyPlusData &state); -} // namespace ScheduleManager + void ShowSevereBadMin(EnergyPlusData &state, + ErrorObjectHeader const &eoh, + std::string_view schedField, + std::string_view schedName, + Clusive cluMin, + Real64 min, + std::string_view msg = {}); + + void ShowWarningBadMin(EnergyPlusData &state, + ErrorObjectHeader const &eoh, + std::string_view schedField, + std::string_view schedName, + Clusive cluMin, + Real64 min, + std::string_view msg = {}); + + void ShowSevereBadMax(EnergyPlusData &state, + ErrorObjectHeader const &eoh, + std::string_view schedField, + std::string_view schedName, + Clusive cluMax, + Real64 max, + std::string_view msg = {}); + + void ShowWarningBadMax(EnergyPlusData &state, + ErrorObjectHeader const &eoh, + std::string_view schedField, + std::string_view schedName, + Clusive cluMax, + Real64 max, + std::string_view msg = {}); + + void ShowSevereBadMinMax(EnergyPlusData &state, + ErrorObjectHeader const &eoh, + std::string_view schedField, + std::string_view schedName, + Clusive cluMin, + Real64 min, + Clusive cluMax, + Real64 max, + std::string_view msg = {}); + + void ShowWarningBadMinMax(EnergyPlusData &state, + ErrorObjectHeader const &eoh, + std::string_view schedField, + std::string_view schedName, + Clusive cluMin, + Real64 min, + Clusive cluMax, + Real64 max, + std::string_view msg = {}); + +} // namespace Sched struct ScheduleManagerData : BaseGlobalStruct { - bool CheckScheduleValueMinMaxRunOnceOnly = true; + bool CheckScheduleValMinMaxRunOnceOnly = true; bool DoScheduleReportingSetup = true; - std::unordered_map UniqueDayScheduleNames; - std::unordered_map UniqueWeekScheduleNames; - std::unordered_map UniqueScheduleNames; std::map UniqueProcessedExternalFiles; - // Integer Variables for the Module - int NumScheduleTypes = 0; - int NumDaySchedules = 0; - int NumWeekSchedules = 0; - int NumSchedules = 0; - // Logical Variables for Module bool ScheduleInputProcessed = false; // This is false until the Schedule Input has been processed. bool ScheduleFileShadingProcessed = false; // This is false unless there is a Schedule:File:Shading object. // Object Data - Array1D ScheduleType; // Allowed Schedule Types - Array1D DaySchedule; // Day Schedule Storage - Array1D WeekSchedule; // Week Schedule Storage - Array1D Schedule; // Schedule Storage + std::vector scheduleTypes; // Allowed Schedule Types + std::vector schedules; // Year schedule + std::vector daySchedules; + std::vector weekSchedules; + + std::map scheduleTypeMap; + std::map scheduleMap; + std::map dayScheduleMap; + std::map weekScheduleMap; + + void init_constant_state(EnergyPlusData &state) override + { + Sched::InitConstantScheduleData(state); + } - void init_state([[maybe_unused]] EnergyPlusData &state) override + void init_state(EnergyPlusData &state) override { + Sched::ProcessScheduleInput(state); } void clear_state() override { - CheckScheduleValueMinMaxRunOnceOnly = true; - UniqueDayScheduleNames.clear(); - UniqueWeekScheduleNames.clear(); - UniqueScheduleNames.clear(); + CheckScheduleValMinMaxRunOnceOnly = true; UniqueProcessedExternalFiles.clear(); DoScheduleReportingSetup = true; - NumScheduleTypes = 0; - NumDaySchedules = 0; - NumWeekSchedules = 0; - NumSchedules = 0; - ScheduleInputProcessed = false; ScheduleFileShadingProcessed = false; - ScheduleType.clear(); // Allowed Schedule Types - DaySchedule.clear(); // Day Schedule Storage - WeekSchedule.clear(); // Week Schedule Storage - Schedule.clear(); // Schedule Storage + for (int i = 0; i < (int)scheduleTypes.size(); ++i) + delete scheduleTypes[i]; + scheduleTypes.clear(); // Allowed Schedule Types + scheduleTypeMap.clear(); + + for (int i = 0; i < (int)schedules.size(); ++i) + delete schedules[i]; + schedules.clear(); // Schedule Storage + scheduleMap.clear(); + + for (int i = 0; i < (int)daySchedules.size(); ++i) + delete daySchedules[i]; + daySchedules.clear(); + dayScheduleMap.clear(); + + for (int i = 0; i < (int)weekSchedules.size(); ++i) + delete weekSchedules[i]; + weekSchedules.clear(); + weekScheduleMap.clear(); } }; diff --git a/src/EnergyPlus/SetPointManager.cc b/src/EnergyPlus/SetPointManager.cc index 3a186e22279..f1dd75cb466 100644 --- a/src/EnergyPlus/SetPointManager.cc +++ b/src/EnergyPlus/SetPointManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -132,7 +132,6 @@ namespace EnergyPlus::SetPointManager { using namespace DataLoopNode; using namespace DataAirLoop; -using namespace ScheduleManager; using namespace Curve; using Psychrometrics::PsyCpAirFnW; using Psychrometrics::PsyHFnTdbW; @@ -284,7 +283,7 @@ void ManageSetPoints(EnergyPlusData &state) } } // ManageSetPoints() -int GetSetPointManagerIndex(EnergyPlusData &state, std::string const &Name) +int GetSetPointManagerIndex(EnergyPlusData const &state, std::string const &Name) { auto found = state.dataSetPointManager->spmMap.find(Name); return (found != state.dataSetPointManager->spmMap.end()) ? found->second : 0; @@ -350,9 +349,6 @@ void GetSetPointManagerInputData(EnergyPlusData &state, bool &ErrorsFound) using NodeInputManager::GetNodeNums; using NodeInputManager::GetOnlySingleNode; - using ScheduleManager::CheckScheduleValueMinMax; - using ScheduleManager::GetScheduleIndex; - // Locals // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view routineName = "GetSetPointManagerInputs"; @@ -686,8 +682,7 @@ void GetSetPointManagerInputData(EnergyPlusData &state, bool &ErrorsFound) assert(spmS != nullptr); std::string schedName = ip->getAlphaFieldValue(fields, props, "schedule_name"); - spmS->schedNum = GetScheduleIndex(state, schedName); - if (spmS->schedNum == 0) { + if ((spmS->sched = Sched::GetSchedule(state, Util::makeUPPER(schedName))) == nullptr) { ShowSevereItemNotFound(state, eoh, "schedule_name", schedName); ErrorsFound = true; } @@ -705,15 +700,13 @@ void GetSetPointManagerInputData(EnergyPlusData &state, bool &ErrorsFound) } std::string schedHiName = ip->getAlphaFieldValue(fields, props, "high_setpoint_schedule_name"); - spmSD->schedNumHi = GetScheduleIndex(state, schedHiName); - if (spmSD->schedNumHi == 0) { + if ((spmSD->hiSched = Sched::GetSchedule(state, Util::makeUPPER(schedHiName))) == nullptr) { ShowSevereItemNotFound(state, eoh, "high_setpoint_schedule_name", schedHiName); ErrorsFound = true; } std::string schedLoName = ip->getAlphaFieldValue(fields, props, "low_setpoint_schedule_name"); - spmSD->schedNumLo = GetScheduleIndex(state, schedLoName); - if (spmSD->schedNumLo == 0) { + if ((spmSD->loSched = Sched::GetSchedule(state, Util::makeUPPER(schedLoName))) == nullptr) { ShowSevereItemNotFound(state, eoh, "low_setpoint_schedule_name", schedLoName); ErrorsFound = true; } @@ -740,21 +733,11 @@ void GetSetPointManagerInputData(EnergyPlusData &state, bool &ErrorsFound) // Get optional input: schedule and 2nd reset rule if (auto foundSched = fields.find("schedule_name"); foundSched != fields.end()) { std::string schedName = Util::makeUPPER(foundSched.value().get()); - spmOA->schedNum = GetScheduleIndex(state, schedName); - if (spmOA->schedNum == 0) { + if ((spmOA->sched = Sched::GetSchedule(state, Util::makeUPPER(schedName))) == nullptr) { ShowSevereItemNotFound(state, eoh, "schedule_name", schedName); ErrorsFound = true; - } - - Real64 minValSched = GetScheduleMinValue(state, spmOA->schedNum); - Real64 maxValSched = GetScheduleMaxValue(state, spmOA->schedNum); - if ((minValSched < 1.0) || (maxValSched > 2.0)) { - ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", routineName, cCurrentModuleObject, name)); - ShowContinueError(state, "..Schedule Values for the Outdoor Reset Schedule must be either 1 or 2"); - ShowContinueError(state, format("..Minimum Schedule Value = {} ", minValSched)); - ShowContinueError(state, format("..Maximum Schedule Value = {} ", minValSched)); - ShowContinueError( - state, format("..Adjust the schedule values so that all of them are either 1 or 2 in schedule = \"{}\"", schedName)); + } else if (!spmOA->sched->checkMinMaxVals(state, Clusive::In, 1.0, Clusive::In, 2.0)) { + Sched::ShowSevereBadMinMax(state, eoh, "schedule_name", schedName, Clusive::In, 1.0, Clusive::In, 2.0); ErrorsFound = true; } @@ -765,8 +748,8 @@ void GetSetPointManagerInputData(EnergyPlusData &state, bool &ErrorsFound) spmOA->highSetPt2 = found.value().get(); if (auto found = fields.find("outdoor_high_temperature_2"); found != fields.end()) spmOA->high2 = found.value().get(); if (spmOA->high2 < spmOA->low2) { - ShowWarningError(state, format("{}: {}=\"{}\", invalid field.", routineName, cCurrentModuleObject, spmOA->Name)); - ShowContinueError(state, + ShowWarningCustom(state, + eoh, format("...{}=[{:.1R}] is less than {}=[{:.1R}].", "outdoor_high_temperature_2", spmOA->high2, @@ -774,7 +757,7 @@ void GetSetPointManagerInputData(EnergyPlusData &state, bool &ErrorsFound) spmOA->low2)); } } else { // !foundSched - spmOA->schedNum = 0; + spmOA->sched = nullptr; spmOA->lowSetPt2 = 0.0; spmOA->low2 = 0.0; spmOA->highSetPt2 = 0.0; @@ -1057,8 +1040,7 @@ void GetSetPointManagerInputData(EnergyPlusData &state, bool &ErrorsFound) assert(spmRAB != nullptr); std::string schedName = ip->getAlphaFieldValue(fields, props, "temperature_setpoint_schedule_name"); - spmRAB->schedNum = GetScheduleIndex(state, schedName); - if (spmRAB->schedNum == 0) { + if ((spmRAB->sched = Sched::GetSchedule(state, Util::makeUPPER(schedName))) == nullptr) { ShowSevereItemNotFound(state, eoh, "temperature_setpoint_schedule_name", schedName); ErrorsFound = true; } @@ -1152,8 +1134,7 @@ void GetSetPointManagerInputData(EnergyPlusData &state, bool &ErrorsFound) std::string condenserEnteringTempSchedName = ip->getAlphaFieldValue(fields, props, "default_condenser_entering_water_temperature_schedule_name"); - spmCET->condenserEnteringTempSchedNum = GetScheduleIndex(state, condenserEnteringTempSchedName); - if (spmCET->condenserEnteringTempSchedNum == 0) { + if ((spmCET->condenserEnteringTempSched = Sched::GetSchedule(state, Util::makeUPPER(condenserEnteringTempSchedName))) == nullptr) { ShowSevereItemNotFound(state, eoh, "default_condenser_entering_water_temperature_schedule_name", condenserEnteringTempSchedName); ErrorsFound = true; } @@ -1311,8 +1292,7 @@ void GetSetPointManagerInputData(EnergyPlusData &state, bool &ErrorsFound) if (spmRWT->returnTempType == ReturnTempType::Scheduled) { std::string schedName = ip->getAlphaFieldValue(fields, props, "return_temperature_setpoint_scheduled_name"); - spmRWT->returnTempSchedNum = GetScheduleIndex(state, schedName); - if (spmRWT->returnTempSchedNum == 0) { + if ((spmRWT->returnTempSched = Sched::GetSchedule(state, Util::makeUPPER(schedName))) == nullptr) { ShowSevereItemNotFound(state, eoh, "return_temperature_setpoint_scheduled_name", schedName); ErrorsFound = true; } @@ -1610,7 +1590,7 @@ void InitSetPointManagers(EnergyPlusData &state) // SetpointManager:MultiZone:Humidity:Minimum // SetpointManager:MultiZone:Humidity:Maximum // Sep 2010 B.A. Nigusse, FSEC/UCF - // Added control varibles for SetpointManage:Scheduled + // Added control variables for SetpointManage:Scheduled // Jan 2022 Wooyoung Jung, Jeremy Lerond and Jian Zhang, PNNL // Added new setpoint managers: // SetpointManager:SystemNodeReset:Temperature @@ -1698,8 +1678,7 @@ void InitSetPointManagers(EnergyPlusData &state) } // still need to validate... if (spmSZH->ctrlZoneNum == 0) { // didn't find - ShowSevereCustomMessage( - state, eoh, format("could not find Controlled Zone={}", state.dataHeatBal->Zone(spmSZH->ctrlZoneNum).Name)); + ShowSevereCustom(state, eoh, format("could not find Controlled Zone={}", state.dataHeatBal->Zone(spmSZH->ctrlZoneNum).Name)); ErrorsFound = true; } else { // make sure humidity controlled zone @@ -1728,7 +1707,6 @@ void InitSetPointManagers(EnergyPlusData &state) int MixedAirNode = 0; int InletBranchNum = 0; int LoopInNode = 0; - bool LookForFan = false; // find the index in the ZoneEquipConfig array of the control zone (the one with the main or only thermostat) int ConZoneNum = 0; @@ -1774,6 +1752,7 @@ void InitSetPointManagers(EnergyPlusData &state) LoopInNode = primaryAirSystem.Branch(InletBranchNum).NodeNumIn; // get the supply fan inlet and outlet nodes if (MixedAirNode > 0) { + bool LookForFan = false; for (auto const &branch : primaryAirSystem.Branch) { for (auto const &comp : branch.Comp) { if (MixedAirNode == comp.NodeNumIn) { @@ -1871,7 +1850,7 @@ void InitSetPointManagers(EnergyPlusData &state) ErrorsFound = true; } - auto &primaryAirSystem = state.dataAirSystemsData->PrimaryAirSystems(spmRAB->airLoopNum); + auto const &primaryAirSystem = state.dataAirSystemsData->PrimaryAirSystems(spmRAB->airLoopNum); if (primaryAirSystem.RABExists) { spmRAB->rabMixInNodeNum = primaryAirSystem.RABMixInNode; spmRAB->supMixInNodeNum = primaryAirSystem.SupMixInNode; @@ -1985,7 +1964,7 @@ void InitSetPointManagers(EnergyPlusData &state) auto &branch = plantLoop.LoopSide(LoopSideLocation::Demand).Branch(BranchNum); for (int CompNum = 1; CompNum <= branch.TotalComponents; ++CompNum) { - auto &comp = branch.Comp(CompNum); + auto const &comp = branch.Comp(CompNum); switch (comp.Type) { case PlantEquipmentType::Chiller_Absorption: @@ -2093,7 +2072,7 @@ void InitSetPointManagers(EnergyPlusData &state) for (int BranchNum2 = 1; BranchNum2 <= supplySide2.TotalBranches; ++BranchNum2) { auto &branch2 = supplySide2.Branch(BranchNum2); for (int CompNum2 = 1; CompNum2 <= branch2.TotalComponents; ++CompNum2) { - auto &comp2 = branch2.Comp(CompNum2); + auto const &comp2 = branch2.Comp(CompNum2); InitType = comp2.Type; if (InitType == ChillerType) { ++NumChiller; @@ -2102,7 +2081,7 @@ void InitSetPointManagers(EnergyPlusData &state) for (int BranchNum3 = 1; BranchNum3 <= supplySide2.TotalBranches; ++BranchNum3) { auto &branch3 = supplySide2.Branch(BranchNum3); for (int CompNum3 = 1; CompNum3 <= branch3.TotalComponents; ++CompNum3) { - auto &comp3 = branch3.Comp(CompNum3); + auto const &comp3 = branch3.Comp(CompNum3); InitType = comp3.Type; if (InitType == PlantEquipmentType::PumpVariableSpeed || InitType == PlantEquipmentType::PumpConstantSpeed) { @@ -2164,7 +2143,7 @@ void InitSetPointManagers(EnergyPlusData &state) for (int ctrlNodeNum : spmS->ctrlNodeNums) { auto &node = state.dataLoopNodes->Node(ctrlNodeNum); - Real64 SchedValue = GetCurrentScheduleValue(state, spmS->schedNum); + Real64 SchedValue = spmS->sched->getCurrentVal(); // Initialize scheduled setpoints switch (spmS->ctrlVar) { case HVAC::CtrlVarType::Temp: { @@ -2206,8 +2185,8 @@ void InitSetPointManagers(EnergyPlusData &state) for (int ctrlNodeNum : spmSD->ctrlNodeNums) { auto &node = state.dataLoopNodes->Node(ctrlNodeNum); if (spmSD->ctrlVar == HVAC::CtrlVarType::Temp) { - node.TempSetPointHi = GetCurrentScheduleValue(state, spmSD->schedNumHi); - node.TempSetPointLo = GetCurrentScheduleValue(state, spmSD->schedNumLo); + node.TempSetPointHi = spmSD->hiSched->getCurrentVal(); + node.TempSetPointLo = spmSD->loSched->getCurrentVal(); node.TempSetPoint = (node.TempSetPointHi + node.TempSetPointLo) / 2.0; } } @@ -2469,7 +2448,7 @@ void InitSetPointManagers(EnergyPlusData &state) case SPMType::CondenserEnteringTemp: { auto *spmCER = dynamic_cast(spm); assert(spmCER != nullptr); - Real64 SchedValue = GetCurrentScheduleValue(state, spmCER->condenserEnteringTempSchedNum); + Real64 SchedValue = spmCER->condenserEnteringTempSched->getCurrentVal(); for (int ctrlNodeNum : spmCER->ctrlNodeNums) { if (spmCER->ctrlVar == HVAC::CtrlVarType::Temp) { state.dataLoopNodes->Node(ctrlNodeNum).TempSetPoint = SchedValue; @@ -2478,7 +2457,7 @@ void InitSetPointManagers(EnergyPlusData &state) } break; case SPMType::IdealCondenserEnteringTemp: { - auto *spmICER = dynamic_cast(spm); + auto const *spmICER = dynamic_cast(spm); assert(spmICER != nullptr); if (spmICER->ctrlVar == HVAC::CtrlVarType::Temp) { @@ -2489,7 +2468,7 @@ void InitSetPointManagers(EnergyPlusData &state) } break; case SPMType::SZOneStageCooling: { - auto *spmSZOSC = dynamic_cast(spm); + auto const *spmSZOSC = dynamic_cast(spm); assert(spmSZOSC != nullptr); if (spmSZOSC->ctrlVar == HVAC::CtrlVarType::Temp) { @@ -2500,7 +2479,7 @@ void InitSetPointManagers(EnergyPlusData &state) } break; case SPMType::SZOneStageHeating: { - auto *spmSZOSH = dynamic_cast(spm); + auto const *spmSZOSH = dynamic_cast(spm); assert(spmSZOSH != nullptr); if (spmSZOSH->ctrlVar == HVAC::CtrlVarType::Temp) { @@ -2615,7 +2594,7 @@ void SimSetPointManagers(EnergyPlusData &state) } } // SimSetPointManagers() -void SPMScheduled::calculate(EnergyPlusData &state) +void SPMScheduled::calculate([[maybe_unused]] EnergyPlusData &state) { // SUBROUTINE INFORMATION: // AUTHOR Fred Buhl @@ -2623,10 +2602,10 @@ void SPMScheduled::calculate(EnergyPlusData &state) // PURPOSE OF THIS SUBROUTINE: // Set the setpoint using a simple schedule. - this->setPt = GetCurrentScheduleValue(state, this->schedNum); + this->setPt = this->sched->getCurrentVal(); } // SPMScheduled::calculate() -void SPMTESScheduled::calculate(EnergyPlusData &state) +void SPMTESScheduled::calculate([[maybe_unused]] EnergyPlusData &state) { // SUBROUTINE INFORMATION: // AUTHOR Rick Strand @@ -2641,8 +2620,8 @@ void SPMTESScheduled::calculate(EnergyPlusData &state) // Locals Real64 constexpr OnVal(0.5); - Real64 CurSchValOnPeak = GetCurrentScheduleValue(state, this->schedNum); - Real64 CurSchValCharge = GetCurrentScheduleValue(state, this->schedNumCharge); + Real64 CurSchValOnPeak = this->sched->getCurrentVal(); + Real64 CurSchValCharge = this->chargeSched->getCurrentVal(); // CtrlType bug // if (this->CompOpType == DataPlant::CtrlType::CoolingOp) { // this is some sort of chiller @@ -2661,7 +2640,7 @@ void SPMTESScheduled::calculate(EnergyPlusData &state) } } // SPMTESSScheduled::calculate() -void SPMScheduledDual::calculate(EnergyPlusData &state) +void SPMScheduledDual::calculate([[maybe_unused]] EnergyPlusData &state) { // SUBROUTINE INFORMATION: // AUTHOR Richard Liesen @@ -2669,18 +2648,18 @@ void SPMScheduledDual::calculate(EnergyPlusData &state) // PURPOSE OF THIS SUBROUTINE: // Set the both setpoint using a simple schedule. - this->setPtHi = GetCurrentScheduleValue(state, this->schedNumHi); - this->setPtLo = GetCurrentScheduleValue(state, this->schedNumLo); + this->setPtHi = this->hiSched->getCurrentVal(); + this->setPtLo = this->loSched->getCurrentVal(); } // SPMScheduledDual::calculate() void SPMOutsideAir::calculate(EnergyPlusData &state) { - Real64 SchedVal = (this->schedNum > 0) ? GetCurrentScheduleValue(state, this->schedNum) : 0.0; + Real64 SchedVal = (this->sched != nullptr) ? this->sched->getCurrentVal() : 0.0; if (SchedVal == 2.0) { this->setPt = interpSetPoint(this->low2, this->high2, state.dataEnvrn->OutDryBulbTemp, this->lowSetPt2, this->highSetPt2); } else { - if ((this->schedNum > 0) && (SchedVal != 1.0)) { // Since schedule is optional, only check this if the user entered a schedule + if ((this->sched != nullptr) && (SchedVal != 1.0)) { // Since schedule is optional, only check this if the user entered a schedule ++this->setPtErrorCount; if (this->setPtErrorCount <= 10) { ShowSevereError(state, @@ -2936,8 +2915,8 @@ void SPMMixedAir::calculate(EnergyPlusData &state) this->setPt = refNode.TempSetPoint - (fanOutNode.Temp - fanInNode.Temp); if (this->coolCoilInNodeNum > 0 && this->coolCoilOutNodeNum > 0) { - auto &coolCoilInNode = state.dataLoopNodes->Node(this->coolCoilInNodeNum); - auto &coolCoilOutNode = state.dataLoopNodes->Node(this->coolCoilOutNodeNum); + auto const &coolCoilInNode = state.dataLoopNodes->Node(this->coolCoilInNodeNum); + auto const &coolCoilOutNode = state.dataLoopNodes->Node(this->coolCoilOutNodeNum); Real64 dtFan = fanOutNode.Temp - fanInNode.Temp; Real64 dtCoolCoil = coolCoilInNode.Temp - coolCoilOutNode.Temp; if (dtCoolCoil > 0.0 && this->minCoolCoilOutTemp > state.dataEnvrn->OutDryBulbTemp) { @@ -3088,7 +3067,7 @@ void SPMTempest::calculate(EnergyPlusData &state) for (int iZoneNum = 1; iZoneNum <= airToZoneNode.NumZonesCooled; ++iZoneNum) { int CtrlZoneNum = airToZoneNode.CoolCtrlZoneNums(iZoneNum); auto &zoneInletNode = state.dataLoopNodes->Node(airToZoneNode.CoolZoneInletNodes(iZoneNum)); - auto &zoneNode = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneNode); + auto const &zoneNode = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneNode); Real64 ZoneMassFlowMax = zoneInletNode.MassFlowRateMax; Real64 ZoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(CtrlZoneNum).TotalOutputRequired; @@ -3118,7 +3097,7 @@ void SPMTempest::calculate(EnergyPlusData &state) for (int iZoneNum = 1; iZoneNum <= airToZoneNode.NumZonesHeated; ++iZoneNum) { int CtrlZoneNum = airToZoneNode.HeatCtrlZoneNums(iZoneNum); auto &zoneInletNode = state.dataLoopNodes->Node(airToZoneNode.HeatZoneInletNodes(iZoneNum)); - auto &zoneNode = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneNode); + auto const &zoneNode = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneNode); Real64 ZoneMassFlowMax = zoneInletNode.MassFlowRateMax; Real64 ZoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(CtrlZoneNum).TotalOutputRequired; Real64 ZoneTemp = zoneNode.Temp; @@ -3137,7 +3116,7 @@ void SPMTempest::calculate(EnergyPlusData &state) for (int iZoneNum = 1; iZoneNum <= airToZoneNode.NumZonesCooled; ++iZoneNum) { int CtrlZoneNum = airToZoneNode.CoolCtrlZoneNums(iZoneNum); auto &zoneInletNode = state.dataLoopNodes->Node(airToZoneNode.CoolZoneInletNodes(iZoneNum)); - auto &zoneNode = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneNode); + auto const &zoneNode = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneNode); Real64 ZoneMassFlowMax = zoneInletNode.MassFlowRateMax; Real64 ZoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(CtrlZoneNum).TotalOutputRequired; Real64 ZoneTemp = zoneNode.Temp; @@ -3193,7 +3172,7 @@ void SPMWarmestTempFlow::calculate(EnergyPlusData &state) for (int iZoneNum = 1; iZoneNum <= airToZoneNode.NumZonesCooled; ++iZoneNum) { int CtrlZoneNum = airToZoneNode.CoolCtrlZoneNums(iZoneNum); auto &zoneInletNode = state.dataLoopNodes->Node(airToZoneNode.CoolZoneInletNodes(iZoneNum)); - auto &zoneNode = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneNode); + auto const &zoneNode = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneNode); Real64 ZoneMassFlowMax = zoneInletNode.MassFlowRateMax; Real64 ZoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(CtrlZoneNum).TotalOutputRequired; @@ -3261,8 +3240,8 @@ void SPMReturnAirBypassFlow::calculate(EnergyPlusData &state) // DATE WRITTEN July 2005 // PURPOSE OF THIS SUBROUTINE: - // Given the desired setpoint temperature, calulate the flow rate through the - // return asir branch that will deliver the desired temperature at the loop outlet + // Given the desired setpoint temperature, calculate the flow rate through the + // return air branch that will deliver the desired temperature at the loop outlet // node. auto &mixerRABInNode = state.dataLoopNodes->Node(this->rabMixInNodeNum); @@ -3270,7 +3249,7 @@ void SPMReturnAirBypassFlow::calculate(EnergyPlusData &state) auto &mixerOutNode = state.dataLoopNodes->Node(this->mixOutNodeNum); auto &loopOutNode = state.dataLoopNodes->Node(this->sysOutNodeNum); - Real64 TempSetPt = GetCurrentScheduleValue(state, this->schedNum); + Real64 TempSetPt = this->sched->getCurrentVal(); Real64 TempSetPtMod = TempSetPt - (loopOutNode.Temp - mixerOutNode.Temp); Real64 SupFlow = mixerSupInNode.MassFlowRate; Real64 TempSup = mixerSupInNode.Temp; @@ -3377,9 +3356,9 @@ void SPMMultiZoneHum::calculate(EnergyPlusData &state) for (int iZoneNum = 1; iZoneNum <= airToZoneNode.NumZonesCooled; ++iZoneNum) { int CtrlZoneNum = airToZoneNode.CoolCtrlZoneNums(iZoneNum); - auto &zoneInletNode = state.dataLoopNodes->Node(airToZoneNode.CoolZoneInletNodes(iZoneNum)); - auto &zoneNode = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneNode); - auto &zoneMoistureDemand = state.dataZoneEnergyDemand->ZoneSysMoistureDemand(CtrlZoneNum); + auto const &zoneInletNode = state.dataLoopNodes->Node(airToZoneNode.CoolZoneInletNodes(iZoneNum)); + auto const &zoneNode = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneNode); + auto const &zoneMoistureDemand = state.dataZoneEnergyDemand->ZoneSysMoistureDemand(CtrlZoneNum); Real64 ZoneMassFlowRate = zoneInletNode.MassFlowRate; Real64 MoistureLoad = (this->type == SPMType::MZMinHum || this->type == SPMType::MZMinHumAverage) ? zoneMoistureDemand.OutputRequiredToHumidifyingSP @@ -3458,7 +3437,7 @@ void SPMFollowOutsideAirTemp::calculate(EnergyPlusData &state) // Set the setpoint based on outdoor air dry-bulb/wet-bulb temperature // METHODOLOGY EMPLOYED: - // Based on reference temperature type specifed in the setpoint manager, + // Based on reference temperature type specified in the setpoint manager, // the setpoint is calculated as OutWetBulbTemp(Or OutDryBulbTemp) + Offset. // The sign convention is that a positive Offset will increase the resulting setpoint. // Final value of the setpoint is limited by the Max and Min limit specified in the setpoint manager. @@ -3482,7 +3461,7 @@ void SPMFollowSysNodeTemp::calculate(EnergyPlusData &state) // to generate setpoint on a second system node. If the reference node is also designated // to be an outdoor air (intake) node, then this setpoint manager can be used to follow // outdoor air conditions that are adjusted for altitude. - // Also, based on reference temperature type specifed in the setpoint manager, the out door air wet-bulb + // Also, based on reference temperature type specified in the setpoint manager, the out door air wet-bulb // or dry-bulb temperature at the reference node could be used. // A temperature offset will be applied to the value obtained from the reference system node. // If this value is zero, and the limits are met, then the resulting setpoint will be exactly the same @@ -3510,7 +3489,7 @@ void SPMFollowGroundTemp::calculate(EnergyPlusData &state) // Set the setpoint based on current ground temperature // METHODOLOGY EMPLOYED: - // Based on reference ground temperature object type specifed in the setpoint manager, + // Based on reference ground temperature object type specified in the setpoint manager, // the setpoint is calculated as GroundTemperature + Offset. // The sign convention is that a positive Offset will increase the resulting setpoint. // Final value of the setpoint is limited by the Max and Min limit specified in the setpoint manager. @@ -3536,13 +3515,12 @@ void SPMCondenserEnteringTemp::calculate(EnergyPlusData &state) // and two other curves to place boundary conditions on the optimal setpoint value. // Using/Aliasing - using ScheduleManager::GetCurrentScheduleValue; using namespace DataPlant; auto &dspm = state.dataSetPointManager; // Current timestep's condenser water entering setpoint - Real64 CondenserEnteringTempSetPoint = GetCurrentScheduleValue(state, this->condenserEnteringTempSchedNum); + Real64 CondenserEnteringTempSetPoint = this->condenserEnteringTempSched->getCurrentVal(); auto &supplyLoop = state.dataPlnt->PlantLoop(this->plantPloc.loopNum).LoopSide(LoopSideLocation::Supply); auto &supplyComp = supplyLoop.Branch(this->plantPloc.branchNum).Comp(this->plantPloc.compNum); @@ -3669,7 +3647,7 @@ void SPMCondenserEnteringTemp::calculate(EnergyPlusData &state) SetPoint = dspm->CET_DesignEnteringCondenserTemp + 1.0; } else if ((state.dataEnvrn->OutWetBulbTemp >= dspm->CET_MinActualWetBulbTemp) && (this->towerDesignInletAirWetBulbTemp >= dspm->CET_DesignMinWetBulbTemp) && (dspm->CET_CurMinLift > this->minLift)) { - // Boundaries are satified; use optimized condenser entering water temp + // Boundaries are satisfied; use optimized condenser entering water temp SetPoint = dspm->CET_OptCondenserEnteringTemp; } else { // Boundaries violated; Reset to scheduled value of condenser water entering setpoint @@ -3880,7 +3858,7 @@ void SPMReturnWaterTemp::calculate(EnergyPlusData &state) // fluidIndex = state.dataPlnt->PlantLoop(this->plantLoopNum).FluidIndex; // // we don't need fluid names since we have a real index, so just pass in the temperature and get properties // Real64 const avgTemp = (returnNode.Temp + supplyNode.Temp) / 2; - // Real64 const cp = FluidProperties::GetSpecificHeatGlycol(state, "", avgTemp, fluidIndex, "ReturnWaterChWSetPointManager::calculate"); + // Real64 const cp = Fluid::GetSpecificHeatGlycol(state, "", avgTemp, fluidIndex, "ReturnWaterChWSetPointManager::calculate"); // Real64 const Qdemand = mdot * cp * deltaT; // check for strange conditions @@ -3894,8 +3872,8 @@ void SPMReturnWaterTemp::calculate(EnergyPlusData &state) // greater than zero if the input type is scheduled, and the useReturnTempSetpoint flag is only // true if the input type is specified as such Real64 T_return_target = this->returnTempConstantTarget; - if (this->returnTempSchedNum > 0) { - T_return_target = GetCurrentScheduleValue(state, this->returnTempSchedNum); + if (this->returnTempSched != nullptr) { + T_return_target = this->returnTempSched->getCurrentVal(); } else if (this->returnTempType == ReturnTempType::Setpoint) { if (returnNode.TempSetPoint != SensedNodeFlagValue) { T_return_target = returnNode.TempSetPoint; @@ -3905,7 +3883,7 @@ void SPMReturnWaterTemp::calculate(EnergyPlusData &state) "The manager is specified to look to the return node setpoint to find a target return temperature, but the node " "setpoint was invalid"); ShowContinueError(state, - format("Verify that a separate sepoint manager is specified to set the setpoint on the return node named \"{}\"", + format("Verify that a separate setpoint manager is specified to set the setpoint on the return node named \"{}\"", state.dataLoopNodes->NodeID(this->returnNodeNum))); ShowContinueError(state, "Or change the target return temperature input type to constant or scheduled"); ShowFatalError(state, "Missing reference setpoint"); @@ -3935,18 +3913,14 @@ void SPMIdealCondenserEnteringTemp::SetupMeteredVarsForSetPt(EnergyPlusData &sta using namespace DataPlant; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - std::string TypeOfComp; - std::string NameOfComp; - Array1D meteredVars; - int NumVariables; auto &plantLoop = state.dataPlnt->PlantLoop(this->chillerPloc.loopNum); auto &supplySide = plantLoop.LoopSide(this->chillerPloc.loopSideNum); auto &chillerBranch = supplySide.Branch(this->chillerPloc.branchNum); auto &chillerComp = chillerBranch.Comp(this->chillerPloc.compNum); - NumVariables = GetNumMeteredVariables(state, chillerComp.TypeOf, chillerComp.Name); + int NumVariables = GetNumMeteredVariables(state, chillerComp.TypeOf, chillerComp.Name); meteredVars.allocate(NumVariables); GetMeteredVariables(state, chillerComp.Name, meteredVars); @@ -4370,7 +4344,7 @@ void ResetHumidityRatioCtrlVarType(EnergyPlusData &state, int const NodeNum) // DATE WRITTEN August 2015 // PURPOSE OF THIS SUBROUTINE: - // Resets setpoint control variable type to "Maximum Humidty Ratio" if control variable type + // Resets setpoint control variable type to "Maximum Humidity Ratio" if control variable type // is "Humidity Ratio". // METHODOLOGY EMPLOYED: @@ -4453,8 +4427,8 @@ HVAC::CtrlVarType GetHumidityRatioVariableType(EnergyPlusData &state, int const } // GetHumidityRatioVariableType() void SetUpNewScheduledTESSetPtMgr(EnergyPlusData &state, - int const SchedPtr, - int const SchedPtrCharge, + Sched::Schedule *sched, + Sched::Schedule *chargeSched, Real64 NonChargeCHWTemp, Real64 ChargeCHWTemp, DataPlant::CtrlType CompOpType, @@ -4479,8 +4453,8 @@ void SetUpNewScheduledTESSetPtMgr(EnergyPlusData &state, state.dataSetPointManager->spms.push_back(spm); state.dataSetPointManager->spmMap.insert_or_assign(spm->Name, state.dataSetPointManager->spms.size()); - spm->schedNum = SchedPtr; - spm->schedNumCharge = SchedPtrCharge; + spm->sched = sched; + spm->chargeSched = chargeSched; spm->nonChargeCHWTemp = NonChargeCHWTemp; spm->chargeCHWTemp = ChargeCHWTemp; spm->compOpType = CompOpType; @@ -4520,7 +4494,7 @@ bool GetCoilFreezingCheckFlag(EnergyPlusData &state, int const spmNum) state.dataSetPointManager->GetInputFlag = false; } - auto *spmMA = dynamic_cast(state.dataSetPointManager->spms(spmNum)); + auto const *spmMA = dynamic_cast(state.dataSetPointManager->spms(spmNum)); assert(spmMA != nullptr); return spmMA->freezeCheckEnable; } // GetCoilFreezingCheckFlag() diff --git a/src/EnergyPlus/SetPointManager.hh b/src/EnergyPlus/SetPointManager.hh index d3ddac62ea3..f8cd971d85b 100644 --- a/src/EnergyPlus/SetPointManager.hh +++ b/src/EnergyPlus/SetPointManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -166,15 +166,15 @@ namespace SetPointManager { struct SPMScheduled : SPMBase // Derived type for Scheduled Setpoint Manager data { - int schedNum = 0; + Sched::Schedule *sched = nullptr; void calculate(EnergyPlusData &state) override; }; struct SPMScheduledDual : SPMBase // Derived type for Scheduled Dual Setpoint Manager { - int schedNumHi = 0; - int schedNumLo = 0; + Sched::Schedule *hiSched = nullptr; + Sched::Schedule *loSched = nullptr; Real64 setPtHi = 0.0; Real64 setPtLo = 0.0; @@ -184,11 +184,12 @@ namespace SetPointManager { struct SPMOutsideAir : SPMBase // Derived type for Outside Air Setpoint Manager Data { // Members + Sched::Schedule *sched = nullptr; + Real64 lowSetPt1 = 0.0; // 1st setpoint at outside low Real64 low1 = 0.0; // 1st Outside low Real64 highSetPt1 = 0.0; // 1st setpoint at outside high Real64 high1 = 0.0; // 1st Outside high - int schedNum = 0; // Schedule index int invalidSchedValErrorIndex = 0; // index for recurring error when schedule is not 1 or 2 int setPtErrorCount = 0; // countfor recurring error when schedule is not 1 or 2 Real64 lowSetPt2 = 0.0; // 2nd setpoint at outside low (optional) @@ -288,7 +289,7 @@ namespace SetPointManager { struct SPMReturnAirBypassFlow : SPMBase { // Members - int schedNum = 0; // index of the above schedule + Sched::Schedule *sched = nullptr; Real64 FlowSetPt = 0; // mass flow rate setpoint (kg/s) int rabMixInNodeNum = 0; int supMixInNodeNum = 0; @@ -343,14 +344,14 @@ namespace SetPointManager { struct SPMCondenserEnteringTemp : SPMBase // derived type for SetpointManager:CondenserEnteringReset data { // Members - int condenserEnteringTempSchedNum = 0; // default condenser entering water temperature schedule Index - Real64 towerDesignInletAirWetBulbTemp = 0; // cooling tower design inlet air wetbulb temperature - int minTowerDesignWetBulbCurveNum = 0; // minimum design wetbulb temperature curve name - int minOAWetBulbCurveNum = 0; // minimum outside air wetbulb temperature curve name - int optCondenserEnteringTempCurveNum = 0; // optimized condenser entering water temperature curve name - Real64 minLift = 0.0; // minimum lift - Real64 maxCondenserEnteringTemp = 0.0; // maximum condenser entering water temp - PlantLocation plantPloc; // plant side chiller index + Sched::Schedule *condenserEnteringTempSched = nullptr; // default condenser entering water temperature schedule Index + Real64 towerDesignInletAirWetBulbTemp = 0; // cooling tower design inlet air wetbulb temperature + int minTowerDesignWetBulbCurveNum = 0; // minimum design wetbulb temperature curve name + int minOAWetBulbCurveNum = 0; // minimum outside air wetbulb temperature curve name + int optCondenserEnteringTempCurveNum = 0; // optimized condenser entering water temperature curve name + Real64 minLift = 0.0; // minimum lift + Real64 maxCondenserEnteringTemp = 0.0; // maximum condenser entering water temp + PlantLocation plantPloc; // plant side chiller index PlantLocation demandPloc; DataPlant::PlantEquipmentType chillerType; // chiller type number @@ -420,13 +421,13 @@ namespace SetPointManager { struct SPMReturnWaterTemp : SPMBase // derived type for SetpointManager:SupplyResetForReturnTemperature:ChilledWater data { // Members - int returnNodeNum = 0; // node ID for the plant supply-side return node - int supplyNodeNum = 0; // node ID for the plant supply-side supply node - int returnTempSchedNum = 0; // the index in Schedules array for the scheduled return temperature; zero if not used - Real64 returnTempConstantTarget = 0.0; // the constant value used as the return temperature target; used if schedule index is zero - Real64 currentSupplySetPt = 0.0; // the current supply setpoint temperature - int plantLoopNum = 0; // the index for the plant loop for this manager, zero if not initialized - int plantSetPtNodeNum = 0; // the index for the node where the plant setpoint is set, need to look up after Plant is established + int returnNodeNum = 0; // node ID for the plant supply-side return node + int supplyNodeNum = 0; // node ID for the plant supply-side supply node + Sched::Schedule *returnTempSched = nullptr; // scheduled return temperature + Real64 returnTempConstantTarget = 0.0; // the constant value used as the return temperature target; used if schedule index is zero + Real64 currentSupplySetPt = 0.0; // the current supply setpoint temperature + int plantLoopNum = 0; // the index for the plant loop for this manager, zero if not initialized + int plantSetPtNodeNum = 0; // the index for the node where the plant setpoint is set, need to look up after Plant is established ReturnTempType returnTempType = ReturnTempType::Invalid; // Calculation method @@ -437,8 +438,8 @@ namespace SetPointManager { struct SPMTESScheduled : SPMBase // Derived type for Scheduled TES Setpoint Manager data { // Members - int schedNum = 0; - int schedNumCharge = 0; + Sched::Schedule *sched = nullptr; // Default is AlwaysOff + Sched::Schedule *chargeSched = nullptr; // Default is AlwaysOff int ctrlNodeNum = 0; Real64 nonChargeCHWTemp = 0.0; Real64 chargeCHWTemp = 0.0; @@ -459,7 +460,7 @@ namespace SetPointManager { void calculate(EnergyPlusData &state) override; }; - int GetSetPointManagerIndex(EnergyPlusData &state, std::string const &Name); + int GetSetPointManagerIndex(EnergyPlusData const &state, std::string const &Name); void ManageSetPoints(EnergyPlusData &state); @@ -492,8 +493,8 @@ namespace SetPointManager { HVAC::CtrlVarType GetHumidityRatioVariableType(EnergyPlusData &state, int CtrlNodeNum); void SetUpNewScheduledTESSetPtMgr(EnergyPlusData &state, - int SchedPtr, - int SchedPtrCharge, + Sched::Schedule *onPeakSched, + Sched::Schedule *chargeSched, Real64 NonChargeCHWTemp, Real64 ChargeCHWTemp, DataPlant::CtrlType CompOpType, @@ -541,6 +542,10 @@ struct SetPointManagerData : BaseGlobalStruct Real64 CET_OptCondenserEnteringTemp = 0.0; Real64 CET_CurMinLift = 0.0; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/Shape.hh b/src/EnergyPlus/Shape.hh index ec91e8b34aa..7d27f6d9eb0 100644 --- a/src/EnergyPlus/Shape.hh +++ b/src/EnergyPlus/Shape.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/SimAirServingZones.cc b/src/EnergyPlus/SimAirServingZones.cc index 5a8ccc20e53..b481e3b2fa8 100644 --- a/src/EnergyPlus/SimAirServingZones.cc +++ b/src/EnergyPlus/SimAirServingZones.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -53,7 +53,6 @@ // ObjexxFCL Headers #include #include -#include #include // EnergyPlus Headers @@ -128,8 +127,7 @@ namespace EnergyPlus::SimAirServingZones { // air systems. // METHODOLOGY EMPLOYED: -// Successive iteration forward from the return air inlet -// to the supply air outlets. +// Successive iteration forward from the return air inlet to the supply air outlets. using namespace DataLoopNode; using namespace DataAirLoop; @@ -172,7 +170,7 @@ void ManageAirLoops(EnergyPlusData &state, // Call the AirLoop Simulation if (state.dataGlobal->SysSizingCalc) { SizeAirLoops(state); - } else if (!state.dataGlobal->SysSizingCalc) { + } else { SimAirLoops(state, FirstHVACIteration, SimZoneEquipment); } @@ -285,16 +283,15 @@ void GetAirPathData(EnergyPlusData &state) int NumParams; int MaxNumbers; int MaxAlphas; - Array1D_string Alphas; // alpha strings returned by GetObjectItem - Array1D_string cAlphaFields; // Alpha field names - Array1D_bool lAlphaBlanks; // Logical array, alpha field input BLANK = .TRUE. - std::string CurrentModuleObject; // Object type for getting and error messages - int NumNodes; // number of nodes returned by GetNodeNums - Array1D_int NodeNums; // node numbers returned by GetNodeNums - int NodeNum; // a node number - int AirSysNum; // an air system (air loop) number - int OANum; // outside air system index - int NumInList; + Array1D_string Alphas; // alpha strings returned by GetObjectItem + Array1D_string cAlphaFields; // Alpha field names + Array1D_bool lAlphaBlanks; // Logical array, alpha field input BLANK = .TRUE. + std::string CurrentModuleObject; // Object type for getting and error messages + int NumNodes; // number of nodes returned by GetNodeNums + Array1D_int NodeNums; // node numbers returned by GetNodeNums + int NodeNum; // a node number + int AirSysNum; // an air system (air loop) number + int OANum; // outside air system index int OAMixNum; // outside air mixer index int IOStat; // status number returned by GetObjectItem int NumControllers; // number of controllers @@ -387,7 +384,7 @@ void GetAirPathData(EnergyPlusData &state) cAlphaFields = ""; lAlphaBlanks = true; - state.dataSimAirServingZones->NumOfTimeStepInDay = state.dataGlobal->NumOfTimeStepInHour * 24; + state.dataSimAirServingZones->NumOfTimeStepInDay = state.dataGlobal->TimeStepsInHour * Constant::iHoursInDay; state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, "NodeList", NumParams, NumAlphas, NumNumbers); NodeNums.dimension(NumParams, 0); @@ -1348,7 +1345,7 @@ void GetAirPathData(EnergyPlusData &state) OANum = GetNumOASystems(state); for (int OASysNum = 1; OASysNum <= OANum; ++OASysNum) { - NumInList = GetOACompListNumber(state, OASysNum); + int NumInList = GetOACompListNumber(state, OASysNum); for (int OACompNum = 1; OACompNum <= NumInList; ++OACompNum) { CompType_Num = GetOACompTypeNum(state, OASysNum, OACompNum); if (CompType_Num == CompType::WaterCoil_DetailedCool || CompType_Num == CompType::WaterCoil_SimpleHeat || @@ -1856,7 +1853,7 @@ void InitAirLoops(EnergyPlusData &state, bool const FirstHVACIteration) // TRUE // now fill out AirLoopZoneInfo for cleaner struct of zones attached to air loop, moved from MixedAir to here for use with Std. 62.1 int MaxNumAirLoopZones = 0; for (int AirLoopNum = 1; AirLoopNum <= numPrimaryAirSys; ++AirLoopNum) { - auto &thisAirToZoneNodeInfo = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum); + auto const &thisAirToZoneNodeInfo = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum); int NumAirLoopZones = thisAirToZoneNodeInfo.NumZonesCooled + thisAirToZoneNodeInfo.NumZonesHeated; // NumZonesCooled + NumZonesHeated must be > 0 or Fatal error is issued in SimAirServingZones MaxNumAirLoopZones = max(MaxNumAirLoopZones, NumAirLoopZones); // Max number of zones on any air loop being simulated @@ -2058,7 +2055,7 @@ void InitAirLoops(EnergyPlusData &state, bool const FirstHVACIteration) // TRUE if (!state.dataGlobal->SysSizingCalc && state.dataSimAirServingZones->InitAirLoopsBranchSizingFlag) { for (int AirLoopNum = 1; AirLoopNum <= numPrimaryAirSys; ++AirLoopNum) { - auto &thisPrimaryAirSys = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum); + auto const &thisPrimaryAirSys = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum); for (int BranchNum = 1; BranchNum <= thisPrimaryAirSys.NumBranches; ++BranchNum) { SizeAirLoopBranches(state, AirLoopNum, BranchNum); @@ -2779,7 +2776,6 @@ void SolveAirLoopControllers( // SUBROUTINE INFORMATION // AUTHOR: Dimitri Curtil (LBNL) // DATE WRITTEN: Feb 2006 - // MODIFIED: // RE-ENGINEERED: This is reengineered code that used to be in SimAirLoops() // PURPOSE OF THIS SUBROUTINE: @@ -2793,8 +2789,6 @@ void SolveAirLoopControllers( // (2) The controllers and their actions are simulated. // (3) Steps 2 and 3 are repeated until the control criteria are satisfied. - // REFERENCES: None - // Using/Aliasing using namespace DataHVACControllers; using General::CreateSysTimeIntervalString; @@ -2814,10 +2808,6 @@ void SolveAirLoopControllers( // Maximum iterations of an air system/controllers simulation sequence int constexpr MaxIter(50); - // INTERFACE BLOCK DEFINITIONS: None - - // DERIVED TYPE DEFINITIONS: None - // SUBROUTINE LOCAL VARIABLE DEFINITIONS // TRUE if controller supports speculative warm restart bool AllowWarmRestartFlag; @@ -3225,7 +3215,6 @@ void ReSolveAirLoopControllers( // SUBROUTINE INFORMATION // AUTHOR: Dimitri Curtil (LBNL) // DATE WRITTEN: Feb 2006 - // MODIFIED: // RE-ENGINEERED: This is new code // PURPOSE OF THIS SUBROUTINE: @@ -3265,7 +3254,7 @@ void ReSolveAirLoopControllers( // Note that it is not used by ManageControllers() in the WARM_RESTART mode. bool IsUpToDateFlag; - auto &PrimaryAirSystems = state.dataAirSystemsData->PrimaryAirSystems; + auto &primaryAirSystems = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum); // To track number of calls to SimAirLoopComponents() for each air loop // Represents the most computationally expensive operation in the iteration. @@ -3278,16 +3267,16 @@ void ReSolveAirLoopControllers( state.dataSimAirServingZones->BypassOAControllerRSALC = false; // not exactly sure of this but it seems all controllers need to be simulated -- don't bypass IsUpToDateFlag = false; - PrimaryAirSystems(AirLoopNum).ControlConverged = false; + primaryAirSystems.ControlConverged = false; // This call to ManageControllers reinitializes the controllers actuated variables to zero // E.g., actuator inlet water flow - for (AirLoopControlNum = 1; AirLoopControlNum <= PrimaryAirSystems(AirLoopNum).NumControllers; ++AirLoopControlNum) { + for (AirLoopControlNum = 1; AirLoopControlNum <= primaryAirSystems.NumControllers; ++AirLoopControlNum) { // BypassOAController is false here since we want to simulate the controller during ReSolveAirLoopControllers calls ? ManageControllers(state, - PrimaryAirSystems(AirLoopNum).ControllerName(AirLoopControlNum), - PrimaryAirSystems(AirLoopNum).ControllerIndex(AirLoopControlNum), + primaryAirSystems.ControllerName(AirLoopControlNum), + primaryAirSystems.ControllerIndex(AirLoopControlNum), FirstHVACIteration, AirLoopNum, ControllerOperation::WarmRestart, @@ -3303,13 +3292,13 @@ void ReSolveAirLoopControllers( // Check that all active controllers are still convergence // Check that actuated variables are within min/max constraints - for (AirLoopControlNum = 1; AirLoopControlNum <= PrimaryAirSystems(AirLoopNum).NumControllers; ++AirLoopControlNum) { + for (AirLoopControlNum = 1; AirLoopControlNum <= primaryAirSystems.NumControllers; ++AirLoopControlNum) { ControllerConvergedFlag = false; ManageControllers(state, - PrimaryAirSystems(AirLoopNum).ControllerName(AirLoopControlNum), - PrimaryAirSystems(AirLoopNum).ControllerIndex(AirLoopControlNum), + primaryAirSystems.ControllerName(AirLoopControlNum), + primaryAirSystems.ControllerIndex(AirLoopControlNum), FirstHVACIteration, AirLoopNum, ControllerOperation::End, @@ -3317,7 +3306,7 @@ void ReSolveAirLoopControllers( IsUpToDateFlag, state.dataSimAirServingZones->BypassOAControllerRSALC); - PrimaryAirSystems(AirLoopNum).ControlConverged(AirLoopControlNum) = ControllerConvergedFlag; + primaryAirSystems.ControlConverged(AirLoopControlNum) = ControllerConvergedFlag; AirLoopConvergedFlag = AirLoopConvergedFlag && ControllerConvergedFlag; @@ -3337,8 +3326,6 @@ void SimAirLoopComponents(EnergyPlusData &state, // SUBROUTINE INFORMATION // AUTHOR: Dimitri Curtil (LBNL) // DATE WRITTEN: Feb 2006 - // MODIFIED: - // RE-ENGINEERED: // PURPOSE OF THIS SUBROUTINE: // This simulates all components on a particular air loop in the primary air system. @@ -3354,36 +3341,29 @@ void SimAirLoopComponents(EnergyPlusData &state, // Sets duct type of current branch to CurDuctType defined in MODULE DataSizing // Upon exiting, resets both counters to 0. - // SUBROUTINE LOCAL VARIABLE DEFINITIONS: None - int BranchNum; // Branch DO loop index - int CompNum; // Component DO loop index - // std::string CompType; // Component type - // std::string CompName; // Component name - CompType CompType_Num; // Numeric equivalent for CompType + auto &primaryAirSystems = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum); - auto &PrimaryAirSystems = state.dataAirSystemsData->PrimaryAirSystems; - - for (BranchNum = 1; BranchNum <= PrimaryAirSystems(AirLoopNum).NumBranches; ++BranchNum) { // loop over all branches in air system + for (int BranchNum = 1; BranchNum <= primaryAirSystems.NumBranches; ++BranchNum) { // loop over all branches in air system UpdateBranchConnections(state, AirLoopNum, BranchNum, BeforeBranchSim); state.dataSize->CurBranchNum = BranchNum; - state.dataSize->CurDuctType = PrimaryAirSystems(AirLoopNum).Branch(BranchNum).DuctType; + state.dataSize->CurDuctType = primaryAirSystems.Branch(BranchNum).DuctType; // Loop over components in branch - for (CompNum = 1; CompNum <= PrimaryAirSystems(AirLoopNum).Branch(BranchNum).TotalComponents; ++CompNum) { + for (int CompNum = 1; CompNum <= primaryAirSystems.Branch(BranchNum).TotalComponents; ++CompNum) { // CompType = PrimaryAirSystem( AirLoopNum ).Branch( BranchNum ).Comp( CompNum ).TypeOf; // CompName = PrimaryAirSystem( AirLoopNum ).Branch( BranchNum ).Comp( CompNum ).Name; - CompType_Num = PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).CompType_Num; + CompType CompType_Num = primaryAirSystems.Branch(BranchNum).Comp(CompNum).CompType_Num; // Simulate each component on PrimaryAirSystem(AirLoopNum)%Branch(BranchNum)%Name SimAirLoopComponent(state, - PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).Name, + primaryAirSystems.Branch(BranchNum).Comp(CompNum).Name, CompType_Num, FirstHVACIteration, AirLoopNum, - PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).CompIndex, - PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).compPointer, + primaryAirSystems.Branch(BranchNum).Comp(CompNum).CompIndex, + primaryAirSystems.Branch(BranchNum).Comp(CompNum).compPointer, AirLoopNum, BranchNum, CompNum); @@ -3450,7 +3430,7 @@ void SimAirLoopComponent(EnergyPlusData &state, bool CoolingActive = false; bool HeatingActive = false; - auto &AirLoopControlInfo = state.dataAirLoop->AirLoopControlInfo; + auto &airLoopControlInfo = state.dataAirLoop->AirLoopControlInfo(AirLoopNum); switch (CompType_Num) { case CompType::OAMixer_Num: { // 'OUTSIDE AIR SYSTEM' @@ -3616,13 +3596,13 @@ void SimAirLoopComponent(EnergyPlusData &state, CompName, FirstHVACIteration, CompIndex, - AirLoopControlInfo(AirLoopNum).fanOp, + airLoopControlInfo.fanOp, state.dataAirLoop->AirLoopFlow(AirLoopNum).FanPLR, _, _, _, - AirLoopControlInfo(AirLoopNum).EconoActive, - AirLoopControlInfo(AirLoopNum).HighHumCtrlActive); + airLoopControlInfo.EconoActive, + airLoopControlInfo.HighHumCtrlActive); // Ducts } break; @@ -3657,8 +3637,8 @@ void SimAirLoopComponent(EnergyPlusData &state, // Set AirLoopControlInfo flag to identify coil operation for "Air Loop Coils" // Any coil operation from multiple coils causes flag to be TRUE // Flag is reset at beginning of each iteration (Subroutine SimHVAC) - AirLoopControlInfo(AirLoopNum).CoolingActiveFlag = AirLoopControlInfo(AirLoopNum).CoolingActiveFlag || CoolingActive; - AirLoopControlInfo(AirLoopNum).HeatingActiveFlag = AirLoopControlInfo(AirLoopNum).HeatingActiveFlag || HeatingActive; + airLoopControlInfo.CoolingActiveFlag = airLoopControlInfo.CoolingActiveFlag || CoolingActive; + airLoopControlInfo.HeatingActiveFlag = airLoopControlInfo.HeatingActiveFlag || HeatingActive; } void UpdateBranchConnections(EnergyPlusData &state, @@ -5053,7 +5033,7 @@ void UpdateSysSizing(EnergyPlusData &state, Constant::CallIndicator const CallIn Real64 termunitsizingtemp; // (1.0+termunitsizing(ctrlzone)%inducrat) Real64 VozClg(0.0); // corrected (for ventilation efficiency) zone outside air flow rate [m3/s] - numOfTimeStepInDay = state.dataGlobal->NumOfTimeStepInHour * 24; + numOfTimeStepInDay = state.dataGlobal->TimeStepsInHour * Constant::iHoursInDay; // allocate scratch arrays if (!allocated(state.dataSize->SensCoolCapTemp)) { @@ -5176,7 +5156,7 @@ void UpdateSysSizing(EnergyPlusData &state, Constant::CallIndicator const CallIn } // End of begin day loop over primary air systems } break; case Constant::CallIndicator::DuringDay: { - TimeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + + TimeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->TimeStepsInHour + state.dataGlobal->TimeStep; // calculate current zone time step index // Correct the zone return temperature in ZoneSizing for the case of induction units. The calc in @@ -6276,7 +6256,7 @@ void UpdateSysSizing(EnergyPlusData &state, Constant::CallIndicator const CallIn // cooling flow rates and associated data for (DDNum = 1; DDNum <= state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays; ++DDNum) { - auto &sysSizing = state.dataSize->SysSizing(DDNum, AirLoopNum); + auto const &sysSizing = state.dataSize->SysSizing(DDNum, AirLoopNum); if (sysSizing.SensCoolCap > state.dataSize->SensCoolCapTemp(AirLoopNum)) { state.dataSize->SysSizPeakDDNum(AirLoopNum).SensCoolPeakDD = DDNum; state.dataSize->SysSizPeakDDNum(AirLoopNum).cSensCoolPeakDDDate = state.dataSize->DesDayWeath(DDNum).DateString; @@ -6409,7 +6389,7 @@ void UpdateSysSizing(EnergyPlusData &state, Constant::CallIndicator const CallIn for (int ZonesCooledNum = 1; ZonesCooledNum <= NumZonesCooled; ++ZonesCooledNum) { // loop over cooled zones int TermUnitSizingIndex = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).TermUnitCoolSizingIndex(ZonesCooledNum); - auto &termUnitSizing = state.dataSize->TermUnitSizing(TermUnitSizingIndex); + auto const &termUnitSizing = state.dataSize->TermUnitSizing(TermUnitSizingIndex); // save the system cooling supply air temp state.dataSize->TermUnitFinalZoneSizing(TermUnitSizingIndex).DesCoolCoilInTempTU = state.dataSize->CalcSysSizing(AirLoopNum).CoolSupTemp; @@ -6427,7 +6407,7 @@ void UpdateSysSizing(EnergyPlusData &state, Constant::CallIndicator const CallIn CoolDDNum = state.dataSize->TermUnitFinalZoneSizing(TermUnitSizingIndex).CoolDDNum; CoolTimeStepNum = state.dataSize->TermUnitFinalZoneSizing(TermUnitSizingIndex).TimeStepNumAtCoolMax; if (CoolDDNum == 0) { - auto &zoneCFS = state.dataSize->CalcFinalZoneSizing(state.dataSize->TermUnitFinalZoneSizing(TermUnitSizingIndex).ZoneNum); + auto const &zoneCFS = state.dataSize->CalcFinalZoneSizing(state.dataSize->TermUnitFinalZoneSizing(TermUnitSizingIndex).ZoneNum); OutAirTemp += zoneCFS.CoolOutTemp * coolMassFlow / (1.0 + termUnitSizing.InducRat); OutAirHumRat += zoneCFS.CoolOutHumRat * coolMassFlow / (1.0 + termUnitSizing.InducRat); } else { @@ -6478,7 +6458,7 @@ void UpdateSysSizing(EnergyPlusData &state, Constant::CallIndicator const CallIn for (int ZonesHeatedNum = 1; ZonesHeatedNum <= NumZonesHeated; ++ZonesHeatedNum) { // loop over the heated zones int TermUnitSizingIndex = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).TermUnitHeatSizingIndex(ZonesHeatedNum); - auto &termUnitSizing = state.dataSize->TermUnitSizing(TermUnitSizingIndex); + auto const &termUnitSizing = state.dataSize->TermUnitSizing(TermUnitSizingIndex); // save the system heating supply air temp state.dataSize->TermUnitFinalZoneSizing(TermUnitSizingIndex).DesHeatCoilInTempTU = state.dataSize->CalcSysSizing(AirLoopNum).HeatSupTemp; @@ -6497,7 +6477,8 @@ void UpdateSysSizing(EnergyPlusData &state, Constant::CallIndicator const CallIn HeatDDNum = state.dataSize->TermUnitFinalZoneSizing(TermUnitSizingIndex).HeatDDNum; HeatTimeStepNum = state.dataSize->TermUnitFinalZoneSizing(TermUnitSizingIndex).TimeStepNumAtHeatMax; if (HeatDDNum == 0) { - auto &zoneCFS = state.dataSize->CalcFinalZoneSizing(state.dataSize->TermUnitFinalZoneSizing(TermUnitSizingIndex).ZoneNum); + auto const &zoneCFS = + state.dataSize->CalcFinalZoneSizing(state.dataSize->TermUnitFinalZoneSizing(TermUnitSizingIndex).ZoneNum); OutAirTemp += zoneCFS.HeatOutTemp * heatMassFlow / (1.0 + termUnitSizing.InducRat); OutAirHumRat += zoneCFS.HeatOutHumRat * heatMassFlow / (1.0 + termUnitSizing.InducRat); } else { @@ -6532,7 +6513,7 @@ void UpdateSysSizing(EnergyPlusData &state, Constant::CallIndicator const CallIn for (int ZonesCooledNum = 1; ZonesCooledNum <= NumZonesCooled; ++ZonesCooledNum) { // loop over the cooled zones int TermUnitSizingIndex = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).TermUnitCoolSizingIndex(ZonesCooledNum); - auto &termUnitSizing = state.dataSize->TermUnitSizing(TermUnitSizingIndex); + auto const &termUnitSizing = state.dataSize->TermUnitSizing(TermUnitSizingIndex); // save the system heating supply air temp state.dataSize->TermUnitFinalZoneSizing(TermUnitSizingIndex).DesHeatCoilInTempTU = state.dataSize->CalcSysSizing(AirLoopNum).HeatSupTemp; @@ -6551,7 +6532,8 @@ void UpdateSysSizing(EnergyPlusData &state, Constant::CallIndicator const CallIn HeatDDNum = state.dataSize->TermUnitFinalZoneSizing(TermUnitSizingIndex).HeatDDNum; HeatTimeStepNum = state.dataSize->TermUnitFinalZoneSizing(TermUnitSizingIndex).TimeStepNumAtHeatMax; if (HeatDDNum == 0) { - auto &zoneCFS = state.dataSize->CalcFinalZoneSizing(state.dataSize->TermUnitFinalZoneSizing(TermUnitSizingIndex).ZoneNum); + auto const &zoneCFS = + state.dataSize->CalcFinalZoneSizing(state.dataSize->TermUnitFinalZoneSizing(TermUnitSizingIndex).ZoneNum); OutAirTemp += zoneCFS.HeatOutTemp * heatMassFlow / (1.0 + termUnitSizing.InducRat); OutAirHumRat += zoneCFS.HeatOutHumRat * heatMassFlow / (1.0 + termUnitSizing.InducRat); } else { @@ -6995,9 +6977,9 @@ void UpdateSysSizing(EnergyPlusData &state, Constant::CallIndicator const CallIn Minutes = 0; TimeStepIndex = 0; for (HourCounter = 1; HourCounter <= 24; ++HourCounter) { - for (TimeStepCounter = 1; TimeStepCounter <= state.dataGlobal->NumOfTimeStepInHour; ++TimeStepCounter) { + for (TimeStepCounter = 1; TimeStepCounter <= state.dataGlobal->TimeStepsInHour; ++TimeStepCounter) { ++TimeStepIndex; - Minutes += state.dataGlobal->MinutesPerTimeStep; + Minutes += state.dataGlobal->MinutesInTimeStep; if (Minutes == 60) { Minutes = 0; HourPrint = HourCounter; @@ -7465,8 +7447,6 @@ bool CheckWaterCoilOnPrimaryAirLoopBranch(EnergyPlusData &state, SimAirServingZo // primary air loop branch. Searches for water coil name and type that match // components list in primary air systems. - auto &PrimaryAirSystems = state.dataAirSystemsData->PrimaryAirSystems; - if (state.dataSimAirServingZones->GetAirLoopInputFlag) { // First time subroutine has been entered GetAirPathData(state); // Get air loop descriptions from input file state.dataSimAirServingZones->GetAirLoopInputFlag = false; @@ -7474,10 +7454,11 @@ bool CheckWaterCoilOnPrimaryAirLoopBranch(EnergyPlusData &state, SimAirServingZo if (state.dataHVACGlobal->NumPrimaryAirSys > 0) { for (int AirSysNum = 1; AirSysNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirSysNum) { - for (int BranchNum = 1; BranchNum <= PrimaryAirSystems(AirSysNum).NumBranches; ++BranchNum) { - for (int CompNum = 1; CompNum <= PrimaryAirSystems(AirSysNum).Branch(BranchNum).TotalComponents; ++CompNum) { - if ((CompTypeNum == PrimaryAirSystems(AirSysNum).Branch(BranchNum).Comp(CompNum).CompType_Num) && - Util::SameString(CompName, PrimaryAirSystems(AirSysNum).Branch(BranchNum).Comp(CompNum).Name)) { + auto const &primaryAirSystems = state.dataAirSystemsData->PrimaryAirSystems(AirSysNum); + for (int BranchNum = 1; BranchNum <= primaryAirSystems.NumBranches; ++BranchNum) { + for (int CompNum = 1; CompNum <= primaryAirSystems.Branch(BranchNum).TotalComponents; ++CompNum) { + if ((CompTypeNum == primaryAirSystems.Branch(BranchNum).Comp(CompNum).CompType_Num) && + Util::SameString(CompName, primaryAirSystems.Branch(BranchNum).Comp(CompNum).Name)) { return true; } } @@ -7498,8 +7479,6 @@ bool CheckWaterCoilOnOASystem(EnergyPlusData &state, SimAirServingZones::CompTyp using MixedAir::GetNumOASystems; using MixedAir::GetOutsideAirSysInputs; - auto &OutsideAirSys = state.dataAirLoop->OutsideAirSys; - if (state.dataMixedAir->GetOASysInputFlag) { GetOutsideAirSysInputs(state); state.dataMixedAir->GetOASysInputFlag = false; @@ -7507,9 +7486,10 @@ bool CheckWaterCoilOnOASystem(EnergyPlusData &state, SimAirServingZones::CompTyp int NumOASys = GetNumOASystems(state); if (NumOASys > 0) { for (int OASysNum = 1; OASysNum <= NumOASys; ++OASysNum) { - for (int OACompNum = 1; OACompNum <= OutsideAirSys(OASysNum).NumComponents; ++OACompNum) { - if ((CompTypeNum == OutsideAirSys(OASysNum).ComponentTypeEnum(OACompNum)) && - (Util::SameString(CompName, OutsideAirSys(OASysNum).ComponentName(OACompNum)))) { + auto &outsideAirSys = state.dataAirLoop->OutsideAirSys(OASysNum); + for (int OACompNum = 1; OACompNum <= outsideAirSys.NumComponents; ++OACompNum) { + if ((CompTypeNum == outsideAirSys.ComponentTypeEnum(OACompNum)) && + (Util::SameString(CompName, outsideAirSys.ComponentName(OACompNum)))) { return true; } } diff --git a/src/EnergyPlus/SimAirServingZones.hh b/src/EnergyPlus/SimAirServingZones.hh index b745e95c801..f7ba78cb58a 100644 --- a/src/EnergyPlus/SimAirServingZones.hh +++ b/src/EnergyPlus/SimAirServingZones.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -278,6 +278,10 @@ struct SimAirServingZonesData : BaseGlobalStruct std::string ErrEnvironmentName; std::string ErrEnvironmentNameSolveWaterCoilController; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/SimulationManager.cc b/src/EnergyPlus/SimulationManager.cc index 4f5808e0f65..21a332066d3 100644 --- a/src/EnergyPlus/SimulationManager.cc +++ b/src/EnergyPlus/SimulationManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -57,7 +57,6 @@ extern "C" { // ObjexxFCL Headers #include #include -#include #include #include @@ -178,7 +177,6 @@ namespace SimulationManager { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: bool ErrorsFound(false); - bool TerminalError(false); bool oneTimeUnderwaterBoundaryCheck = true; bool AnyUnderwaterBoundaries = false; @@ -209,6 +207,7 @@ namespace SimulationManager { state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "RunPeriod:CustomRange") > 0 || state.dataSysVars->FullAnnualRun); state.dataErrTracking->AskForConnectionsReport = false; // set to false until sizing is finished + state.init_constant_state(state); state.init_state(state); CheckForMisMatchedEnvironmentSpecifications(state); @@ -280,9 +279,10 @@ namespace SimulationManager { state.dataReportFlag->DoWeatherInitReporting = true; // Note: All the inputs have been 'gotten' by the time we get here. - bool ErrFound = false; if (state.dataGlobal->DoOutputReporting) { DisplayString(state, "Reporting Surfaces"); + bool ErrFound = false; + bool TerminalError = false; ReportSurfaces(state); @@ -332,7 +332,7 @@ namespace SimulationManager { if (state.dataSQLiteProcedures->sqlite) { state.dataSQLiteProcedures->sqlite->sqliteBegin(); - state.dataSQLiteProcedures->sqlite->updateSQLiteSimulationRecord(1, state.dataGlobal->NumOfTimeStepInHour); + state.dataSQLiteProcedures->sqlite->updateSQLiteSimulationRecord(1, state.dataGlobal->TimeStepsInHour); state.dataSQLiteProcedures->sqlite->sqliteCommit(); } @@ -453,7 +453,7 @@ namespace SimulationManager { state.dataGlobal->BeginHourFlag = true; state.dataGlobal->EndHourFlag = false; - for (state.dataGlobal->TimeStep = 1; state.dataGlobal->TimeStep <= state.dataGlobal->NumOfTimeStepInHour; + for (state.dataGlobal->TimeStep = 1; state.dataGlobal->TimeStep <= state.dataGlobal->TimeStepsInHour; ++state.dataGlobal->TimeStep) { if (state.dataGlobal->stopSimulation) break; @@ -465,8 +465,8 @@ namespace SimulationManager { Weather::UpdateUnderwaterBoundaries(state); } - if (state.dataEnvrn->varyingLocationSchedIndexLat > 0 || state.dataEnvrn->varyingLocationSchedIndexLong > 0 || - state.dataEnvrn->varyingOrientationSchedIndex > 0) { + if (state.dataEnvrn->varyingLocationLatSched != nullptr || state.dataEnvrn->varyingLocationLongSched != nullptr || + state.dataEnvrn->varyingOrientationSched != nullptr) { Weather::UpdateLocationAndOrientation(state); } @@ -480,7 +480,7 @@ namespace SimulationManager { // Note also that BeginTimeStepFlag, EndTimeStepFlag, and the // SubTimeStepFlags can/will be set/reset in the HVAC Manager. - if (state.dataGlobal->TimeStep == state.dataGlobal->NumOfTimeStepInHour) { + if (state.dataGlobal->TimeStep == state.dataGlobal->TimeStepsInHour) { state.dataGlobal->EndHourFlag = true; if (state.dataGlobal->HourOfDay == 24) { state.dataGlobal->EndDayFlag = true; @@ -764,63 +764,63 @@ namespace SimulationManager { state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); - state.dataGlobal->NumOfTimeStepInHour = Number(1); + state.dataGlobal->TimeStepsInHour = Number(1); if (state.dataSysVars->ciForceTimeStep) { - state.dataGlobal->NumOfTimeStepInHour = 2; // Force 30 minute time steps on CI + state.dataGlobal->TimeStepsInHour = 2; // Force 30 minute time steps on CI } - if (state.dataGlobal->NumOfTimeStepInHour <= 0 || state.dataGlobal->NumOfTimeStepInHour > 60) { - Alphas(1) = fmt::to_string(state.dataGlobal->NumOfTimeStepInHour); + if (state.dataGlobal->TimeStepsInHour <= 0 || state.dataGlobal->TimeStepsInHour > 60) { + Alphas(1) = fmt::to_string(state.dataGlobal->TimeStepsInHour); ShowWarningError(state, format("{}: Requested number ({}) invalid, Defaulted to 4", CurrentModuleObject, Alphas(1))); - state.dataGlobal->NumOfTimeStepInHour = 4; - } else if (mod(60, state.dataGlobal->NumOfTimeStepInHour) != 0) { + state.dataGlobal->TimeStepsInHour = 4; + } else if (mod(60, state.dataGlobal->TimeStepsInHour) != 0) { MinInt = 9999; for (Num = 1; Num <= 12; ++Num) { - if (std::abs(state.dataGlobal->NumOfTimeStepInHour - Div60[Num - 1]) > MinInt) continue; - MinInt = state.dataGlobal->NumOfTimeStepInHour - Div60[Num - 1]; + if (std::abs(state.dataGlobal->TimeStepsInHour - Div60[Num - 1]) > MinInt) continue; + MinInt = state.dataGlobal->TimeStepsInHour - Div60[Num - 1]; Which = Num; } ShowWarningError(state, format("{}: Requested number ({}) not evenly divisible into 60, defaulted to nearest ({}).", CurrentModuleObject, - state.dataGlobal->NumOfTimeStepInHour, + state.dataGlobal->TimeStepsInHour, Div60[Which - 1])); - state.dataGlobal->NumOfTimeStepInHour = Div60[Which - 1]; + state.dataGlobal->TimeStepsInHour = Div60[Which - 1]; } - if (CondFDAlgo && state.dataGlobal->NumOfTimeStepInHour < 20) { + if (CondFDAlgo && state.dataGlobal->TimeStepsInHour < 20) { ShowWarningError(state, format("{}: Requested number ({}) cannot be used when Conduction Finite Difference algorithm is selected.", CurrentModuleObject, - state.dataGlobal->NumOfTimeStepInHour)); + state.dataGlobal->TimeStepsInHour)); ShowContinueError(state, format("...{} is set to 20.", CurrentModuleObject)); - state.dataGlobal->NumOfTimeStepInHour = 20; + state.dataGlobal->TimeStepsInHour = 20; } - if (state.dataGlobal->NumOfTimeStepInHour < 4 && state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Zone") > 0) { + if (state.dataGlobal->TimeStepsInHour < 4 && state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Zone") > 0) { ShowWarningError(state, format("{}: Requested number ({}) is less than the suggested minimum of 4.", CurrentModuleObject, - state.dataGlobal->NumOfTimeStepInHour)); + state.dataGlobal->TimeStepsInHour)); ShowContinueError(state, format("Please see entry for {} in Input/Output Reference for discussion of considerations.", CurrentModuleObject)); } } else if (Num == 0 && state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Zone") > 0 && !CondFDAlgo) { ShowWarningError(state, format("No {} object found. Number of TimeSteps in Hour defaulted to 4.", CurrentModuleObject)); - state.dataGlobal->NumOfTimeStepInHour = 4; + state.dataGlobal->TimeStepsInHour = 4; } else if (Num == 0 && !CondFDAlgo) { - state.dataGlobal->NumOfTimeStepInHour = 4; + state.dataGlobal->TimeStepsInHour = 4; } else if (Num == 0 && state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Zone") > 0 && CondFDAlgo) { ShowWarningError(state, format("No {} object found. Number of TimeSteps in Hour defaulted to 20.", CurrentModuleObject)); ShowContinueError(state, "...Due to presence of Conduction Finite Difference Algorithm selection."); - state.dataGlobal->NumOfTimeStepInHour = 20; + state.dataGlobal->TimeStepsInHour = 20; } else if (Num == 0 && CondFDAlgo) { - state.dataGlobal->NumOfTimeStepInHour = 20; + state.dataGlobal->TimeStepsInHour = 20; } else { ShowSevereError(state, format("Too many {} Objects found.", CurrentModuleObject)); ErrorsFound = true; } - state.dataGlobal->TimeStepZone = 1.0 / double(state.dataGlobal->NumOfTimeStepInHour); - state.dataGlobal->MinutesPerTimeStep = state.dataGlobal->TimeStepZone * 60; - state.dataGlobal->TimeStepZoneSec = state.dataGlobal->TimeStepZone * Constant::SecInHour; + state.dataGlobal->TimeStepZone = 1.0 / double(state.dataGlobal->TimeStepsInHour); + state.dataGlobal->MinutesInTimeStep = state.dataGlobal->TimeStepZone * 60; + state.dataGlobal->TimeStepZoneSec = state.dataGlobal->TimeStepZone * Constant::rSecsInHour; CurrentModuleObject = "ConvergenceLimits"; Num = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); @@ -838,8 +838,8 @@ namespace SimulationManager { state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); MinInt = int(Number(1)); - if (MinInt > state.dataGlobal->MinutesPerTimeStep) { - MinInt = state.dataGlobal->MinutesPerTimeStep; + if (MinInt > state.dataGlobal->MinutesInTimeStep) { + MinInt = state.dataGlobal->MinutesInTimeStep; } if (MinInt < 0 || MinInt > 60) { ShowWarningError( @@ -1182,10 +1182,10 @@ namespace SimulationManager { if (overrideTimestep) { ShowWarningError(state, "Due to PerformancePrecisionTradeoffs Override Mode, the Number of TimeSteps has been changed to 1."); - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStepZone = 1.0 / double(state.dataGlobal->NumOfTimeStepInHour); - state.dataGlobal->MinutesPerTimeStep = state.dataGlobal->TimeStepZone * 60; - state.dataGlobal->TimeStepZoneSec = state.dataGlobal->TimeStepZone * Constant::SecInHour; + state.dataGlobal->TimeStepsInHour = 1; + state.dataGlobal->TimeStepZone = 1.0 / double(state.dataGlobal->TimeStepsInHour); + state.dataGlobal->MinutesInTimeStep = state.dataGlobal->TimeStepZone * Constant::rMinutesInHour; + state.dataGlobal->TimeStepZoneSec = state.dataGlobal->TimeStepZone * Constant::rSecsInHour; state.dataGlobal->OverrideTimestep = true; } if (overrideZoneAirHeatBalAlg) { @@ -1209,8 +1209,8 @@ namespace SimulationManager { ShowWarningError( state, "Due to PerformancePrecisionTradeoffs Override Mode, the minimum System TimeSteps has been changed to 1 hr."); int MinTimeStepSysOverrideValue = 60.0; - if (MinTimeStepSysOverrideValue > state.dataGlobal->MinutesPerTimeStep) { - MinTimeStepSysOverrideValue = state.dataGlobal->MinutesPerTimeStep; + if (MinTimeStepSysOverrideValue > state.dataGlobal->MinutesInTimeStep) { + MinTimeStepSysOverrideValue = state.dataGlobal->MinutesInTimeStep; } state.dataConvergeParams->MinTimeStepSys = MinTimeStepSysOverrideValue / 60.0; state.dataHVACGlobal->LimitNumSysSteps = int(state.dataGlobal->TimeStepZone / state.dataConvergeParams->MinTimeStepSys); @@ -1248,7 +1248,7 @@ namespace SimulationManager { print(state.files.eio, "{}\n", "! , #TimeSteps, Minutes per TimeStep {minutes}"); static constexpr std::string_view Format_731(" Timesteps per Hour, {:2}, {:2}\n"); - print(state.files.eio, Format_731, state.dataGlobal->NumOfTimeStepInHour, state.dataGlobal->MinutesPerTimeStep); + print(state.files.eio, Format_731, state.dataGlobal->TimeStepsInHour, state.dataGlobal->MinutesInTimeStep); print(state.files.eio, "{}\n", @@ -1321,7 +1321,7 @@ namespace SimulationManager { Alphas(2) = "ScriptF"; } Alphas(3) = overrideModeValue; - Alphas(4) = fmt::to_string(state.dataGlobal->NumOfTimeStepInHour); + Alphas(4) = fmt::to_string(state.dataGlobal->TimeStepsInHour); if (state.dataHeatBal->OverrideZoneAirSolutionAlgo) { Alphas(5) = "Yes"; } else { @@ -1372,11 +1372,11 @@ namespace SimulationManager { // unused0909743 Format(' Display Extra Warnings',2(', ',A)) // ENDIF if (state.dataGlobal->createPerfLog) { - writeIntialPerfLogValues(state, overrideModeValue); + writeInitialPerfLogValues(state, overrideModeValue); } } - void writeIntialPerfLogValues(EnergyPlusData &state, std::string const ¤tOverrideModeValue) + void writeInitialPerfLogValues(EnergyPlusData &state, std::string const ¤tOverrideModeValue) // write the input related portions of the .perflog // J.Glazer February 2020 { @@ -1390,7 +1390,7 @@ namespace SimulationManager { Util::appendPerfLog(state, "Zone Radiant Exchange Algorithm", "ScriptF"); } Util::appendPerfLog(state, "Override Mode", currentOverrideModeValue); - Util::appendPerfLog(state, "Number of Timesteps per Hour", fmt::to_string(state.dataGlobal->NumOfTimeStepInHour)); + Util::appendPerfLog(state, "Number of Timesteps per Hour", fmt::to_string(state.dataGlobal->TimeStepsInHour)); Util::appendPerfLog(state, "Minimum Number of Warmup Days", fmt::to_string(state.dataHeatBal->MinNumberOfWarmupDays)); Util::appendPerfLog(state, "SuppressAllBeginEnvironmentResets", bool_to_string(state.dataEnvrn->forceBeginEnvResetSuppress)); Util::appendPerfLog(state, "Minimum System Timestep", format("{:.1R}", state.dataConvergeParams->MinTimeStepSys * 60.0)); @@ -1539,8 +1539,6 @@ namespace SimulationManager { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN January 2009 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // EnergyPlus does not automatically produce any results files. Because of this, users may not request @@ -1548,26 +1546,22 @@ namespace SimulationManager { // results should be produced (either sizing periods or weather files are run) but no reports are // requested. - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - bool SimPeriods; - bool ReportingRequested; - - ReportingRequested = false; - SimPeriods = (state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:DesignDay") > 0 || - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileDays") > 0 || - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileConditionType") > 0 || - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "RunPeriod") > 0); + bool SimPeriods = (state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:DesignDay") > 0 || + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileDays") > 0 || + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileConditionType") > 0 || + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "RunPeriod") > 0); if ((state.dataGlobal->DoDesDaySim || state.dataGlobal->DoWeathSim || state.dataGlobal->DoPureLoadCalc) && SimPeriods) { - ReportingRequested = (state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Output:Table:SummaryReports") > 0 || - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Output:Table:TimeBins") > 0 || - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Output:Table:Monthly") > 0 || - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Output:Table:Annual") > 0 || - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Output:Variable") > 0 || - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Output:Meter") > 0 || - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Output:Meter:MeterFileOnly") > 0 || - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Output:Meter:Cumulative") > 0 || - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Output:Meter:Cumulative:MeterFileOnly") > 0); + bool ReportingRequested = + (state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Output:Table:SummaryReports") > 0 || + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Output:Table:TimeBins") > 0 || + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Output:Table:Monthly") > 0 || + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Output:Table:Annual") > 0 || + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Output:Variable") > 0 || + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Output:Meter") > 0 || + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Output:Meter:MeterFileOnly") > 0 || + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Output:Meter:Cumulative") > 0 || + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Output:Meter:Cumulative:MeterFileOnly") > 0); // Not testing for : Output:SQLite or Output:EnvironmentalImpactFactors if (!ReportingRequested) { ShowWarningError(state, "No reporting elements have been requested. No simulation results produced."); @@ -1905,7 +1899,7 @@ namespace SimulationManager { // do an end of day, end of environment time step state.dataGlobal->HourOfDay = 24; - state.dataGlobal->TimeStep = state.dataGlobal->NumOfTimeStepInHour; + state.dataGlobal->TimeStep = state.dataGlobal->TimeStepsInHour; state.dataGlobal->EndEnvrnFlag = true; if (state.dataSysVars->DeveloperFlag) @@ -2650,9 +2644,9 @@ namespace SimulationManager { // EXTERNAL SUBROUTINES: void Resimulate(EnergyPlusData &state, - bool &ResimExt, // Flag to resimulate the exterior energy use simulation - bool &ResimHB, // Flag to resimulate the heat balance simulation (including HVAC) - bool &ResimHVAC // Flag to resimulate the HVAC simulation + bool const ResimExt, // Flag to resimulate the exterior energy use simulation + bool const ResimHB, // Flag to resimulate the heat balance simulation (including HVAC) + bool &ResimHVAC // Flag to resimulate the HVAC simulation ) { diff --git a/src/EnergyPlus/SimulationManager.hh b/src/EnergyPlus/SimulationManager.hh index 86f23c4a5d7..cffc7f90346 100644 --- a/src/EnergyPlus/SimulationManager.hh +++ b/src/EnergyPlus/SimulationManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -64,7 +64,7 @@ namespace SimulationManager { void GetProjectData(EnergyPlusData &state); - void writeIntialPerfLogValues(EnergyPlusData &state, std::string const ¤tOverrideModeValue); + void writeInitialPerfLogValues(EnergyPlusData &state, std::string const ¤tOverrideModeValue); std::string bool_to_string(bool logical); @@ -99,6 +99,11 @@ struct SimulationManagerData : BaseGlobalStruct bool RunControlInInput = false; bool PreP_Fatal = false; bool WarningOut = true; + + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state(EnergyPlusData &state) override { SimulationManager::OpenOutputFiles(state); @@ -115,9 +120,9 @@ struct SimulationManagerData : BaseGlobalStruct }; void Resimulate(EnergyPlusData &state, - bool &ResimExt, // Flag to resimulate the exterior energy use simulation - bool &ResimHB, // Flag to resimulate the heat balance simulation (including HVAC) - bool &ResimHVAC // Flag to resimulate the HVAC simulation + bool const ResimExt, // Flag to resimulate the exterior energy use simulation + bool const ResimHB, // Flag to resimulate the heat balance simulation (including HVAC) + bool &ResimHVAC // Flag to resimulate the HVAC simulation ); } // namespace EnergyPlus diff --git a/src/EnergyPlus/SingleDuct.cc b/src/EnergyPlus/SingleDuct.cc index b52e65d8fd2..7fbafbed007 100644 --- a/src/EnergyPlus/SingleDuct.cc +++ b/src/EnergyPlus/SingleDuct.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -50,7 +50,6 @@ // ObjexxFCL Headers #include -#include // EnergyPlus Headers #include @@ -98,8 +97,6 @@ namespace EnergyPlus::SingleDuct { // MODULE INFORMATION: // AUTHOR Richard J. Liesen // DATE WRITTEN January 2000 -// MODIFIED na -// RE-ENGINEERED na // PURPOSE OF THIS MODULE: // To encapsulate the data and algorithms required to @@ -115,12 +112,8 @@ using HVAC::SmallMassFlow; using namespace DataSizing; using Psychrometrics::PsyCpAirFnW; using Psychrometrics::PsyRhoAirFnPbTdbW; -using namespace ScheduleManager; using namespace SteamCoils; -static constexpr std::string_view fluidNameSteam("STEAM"); -static constexpr std::string_view fluidNameWater("WATER"); - void SimulateSingleDuct( EnergyPlusData &state, std::string_view CompName, bool const FirstHVACIteration, int const ZoneNum, int const ZoneNodeNum, int &CompIndex) { @@ -128,16 +121,12 @@ void SimulateSingleDuct( // SUBROUTINE INFORMATION: // AUTHOR Richard Liesen // DATE WRITTEN January 2000 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine manages Sys system simulation. // It is called from the ManageZoneEquip // at the system time step. - // Using/Aliasing - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int SysNum; // The Sys that you are currently loading input into @@ -222,8 +211,6 @@ void GetSysInput(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Richard Liesen // DATE WRITTEN April 1998 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine is the main routine to call other input routines and Get routines @@ -366,262 +353,195 @@ void GetSysInput(EnergyPlusData &state) cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + state.dataSingleDuct->SysNumGSI = state.dataSingleDuct->SysIndexGSI; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysNum = state.dataSingleDuct->SysNumGSI; + + auto &airTerm = state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI); + airTerm.SysNum = state.dataSingleDuct->SysNumGSI; GlobalNames::VerifyUniqueInterObjectName( state, state.dataSingleDuct->SysUniqueNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName = Alphas(1); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType = CurrentModuleObject; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysType_Num = SysType::SingleDuctVAVReheat; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp = Alphas(7); - if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Fuel")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::Gas; - } else if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Electric")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::Electric; - } else if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Water")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::SimpleHeating; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_PlantType = - DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; - } else if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Steam")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::SteamAirHeating; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_PlantType = - DataPlant::PlantEquipmentType::CoilSteamAirHeating; - } else if (!state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp.empty()) { - ShowSevereError( - state, format("Illegal {} = {}.", cAlphaFields(8), state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp)); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + airTerm.SysName = Alphas(1); + airTerm.sysType = CurrentModuleObject; + airTerm.SysType_Num = SysType::SingleDuctVAVReheat; + airTerm.ReheatComp = Alphas(7); + if (Util::SameString(airTerm.ReheatComp, "Coil:Heating:Fuel")) { + airTerm.ReheatComp_Num = HeatingCoilType::Gas; + } else if (Util::SameString(airTerm.ReheatComp, "Coil:Heating:Electric")) { + airTerm.ReheatComp_Num = HeatingCoilType::Electric; + } else if (Util::SameString(airTerm.ReheatComp, "Coil:Heating:Water")) { + airTerm.ReheatComp_Num = HeatingCoilType::SimpleHeating; + airTerm.ReheatComp_PlantType = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; + } else if (Util::SameString(airTerm.ReheatComp, "Coil:Heating:Steam")) { + airTerm.ReheatComp_Num = HeatingCoilType::SteamAirHeating; + airTerm.ReheatComp_PlantType = DataPlant::PlantEquipmentType::CoilSteamAirHeating; + } else if (!airTerm.ReheatComp.empty()) { + ShowSevereError(state, format("Illegal {} = {}.", cAlphaFields(8), airTerm.ReheatComp)); + ShowContinueError(state, format("Occurs in {} = {}", airTerm.sysType, airTerm.SysName)); ErrorsFound = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName = Alphas(8); - ValidateComponent(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType); + airTerm.ReheatName = Alphas(8); + ValidateComponent(state, airTerm.ReheatComp, airTerm.ReheatName, IsNotOK, airTerm.sysType); if (IsNotOK) { - ShowContinueError(state, - format("In {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError(state, format("In {} = {}", airTerm.sysType, airTerm.SysName)); ErrorsFound = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).Schedule = Alphas(2); if (lAlphaBlanks(2)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = GetScheduleIndex(state, Alphas(2)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr == 0) { - ShowSevereError(state, format("{} = {} not found.", cAlphaFields(2), Alphas(2))); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ErrorsFound = true; - } + airTerm.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((airTerm.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } // For node connections, this object is both a parent and a non-parent, because the // VAV damper is not called out as a separate component, its nodes must be connected // as ObjectIsNotParent. But for the reheat coil, the nodes are connected as ObjectIsParent - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum = - GetOnlySingleNode(state, - Alphas(3), - ErrorsFound, - DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctVAVReheat, - Alphas(1), - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Outlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent, - cAlphaFields(3)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum = - GetOnlySingleNode(state, - Alphas(4), - ErrorsFound, - DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctVAVReheat, - Alphas(1), - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Inlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent, - cAlphaFields(4)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxAirVolFlowRate = Numbers(1); + airTerm.OutletNodeNum = GetOnlySingleNode(state, + Alphas(3), + ErrorsFound, + DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctVAVReheat, + Alphas(1), + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Outlet, + NodeInputManager::CompFluidStream::Primary, + ObjectIsNotParent, + cAlphaFields(3)); + airTerm.InletNodeNum = GetOnlySingleNode(state, + Alphas(4), + ErrorsFound, + DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctVAVReheat, + Alphas(1), + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Inlet, + NodeInputManager::CompFluidStream::Primary, + ObjectIsNotParent, + cAlphaFields(4)); + airTerm.MaxAirVolFlowRate = Numbers(1); if (Util::SameString(Alphas(5), "Constant")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod = MinFlowFraction::Constant; + airTerm.ZoneMinAirFracMethod = MinFlowFraction::Constant; } else if (Util::SameString(Alphas(5), "FixedFlowRate")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod = MinFlowFraction::Fixed; + airTerm.ZoneMinAirFracMethod = MinFlowFraction::Fixed; } else if (Util::SameString(Alphas(5), "Scheduled")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod = MinFlowFraction::Scheduled; + airTerm.ZoneMinAirFracMethod = MinFlowFraction::Scheduled; } else { ShowSevereError(state, format("{} = {} not found.", cAlphaFields(5), Alphas(5))); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError(state, format("Occurs in {} = {}", airTerm.sysType, airTerm.SysName)); ErrorsFound = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = Numbers(2); + airTerm.ZoneMinAirFracDes = Numbers(2); if (lNumericBlanks(2)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ConstantMinAirFracSetByUser = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DesignMinAirFrac = 0.0; + airTerm.ConstantMinAirFracSetByUser = false; + airTerm.DesignMinAirFrac = 0.0; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ConstantMinAirFracSetByUser = true; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DesignMinAirFrac = Numbers(2); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod == MinFlowFraction::Fixed) { + airTerm.ConstantMinAirFracSetByUser = true; + airTerm.DesignMinAirFrac = Numbers(2); + if (airTerm.ZoneMinAirFracMethod == MinFlowFraction::Fixed) { ShowWarningError(state, format("Since {} = {}, input for {} will be ignored.", cAlphaFields(5), Alphas(5), cNumericFields(2))); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = 0.0; + ShowContinueError(state, format("Occurs in {} = {}", airTerm.sysType, airTerm.SysName)); + airTerm.ZoneMinAirFracDes = 0.0; } } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneFixedMinAir = Numbers(3); + airTerm.ZoneFixedMinAir = Numbers(3); if (lNumericBlanks(3)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).FixedMinAirSetByUser = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DesignMinAirFrac = 0.0; + airTerm.FixedMinAirSetByUser = false; + airTerm.DesignMinAirFrac = 0.0; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).FixedMinAirSetByUser = true; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DesignMinAirFrac = Numbers(3); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod == MinFlowFraction::Constant) { + airTerm.FixedMinAirSetByUser = true; + airTerm.DesignMinAirFrac = Numbers(3); + if (airTerm.ZoneMinAirFracMethod == MinFlowFraction::Constant) { ShowWarningError(state, format("Since {} = {}, input for {} will be ignored.", cAlphaFields(5), Alphas(5), cNumericFields(3))); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneFixedMinAir = 0.0; + ShowContinueError(state, format("Occurs in {} = {}", airTerm.sysType, airTerm.SysName)); + airTerm.ZoneFixedMinAir = 0.0; } } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracSchPtr = GetScheduleIndex(state, Alphas(6)); - if ((state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracSchPtr == 0) && - (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod == MinFlowFraction::Scheduled)) { - ShowSevereError(state, format("{} = {} not found.", cAlphaFields(6), Alphas(6))); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ShowContinueError(state, "A valid schedule is required"); + if (airTerm.ZoneMinAirFracMethod != MinFlowFraction::Scheduled) { + } else if (lAlphaBlanks(6)) { + ShowSevereEmptyField(state, eoh, cAlphaFields(6)); + ErrorsFound = true; + } else if ((airTerm.zoneMinAirFracSched = Sched::GetSchedule(state, Alphas(6))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(6), Alphas(6)); + ErrorsFound = true; + } else if (!airTerm.zoneMinAirFracSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFields(6), Alphas(6), Clusive::In, 0.0, Clusive::In, 1.0); ErrorsFound = true; - } else if ((state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracSchPtr > 0) && - (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod == MinFlowFraction::Scheduled)) { - // check range of values in schedule - if (!CheckScheduleValueMinMax( - state, state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracSchPtr, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("Error found in {} = {}", cAlphaFields(6), Alphas(6))); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ShowContinueError(state, "Schedule values must be (>=0., <=1.)"); - } } // The reheat coil control node is necessary for hot water and steam reheat, but not necessary for // electric or gas reheat. - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num != HeatingCoilType::Gas && - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num != HeatingCoilType::Electric) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::SteamAirHeating) { + if (airTerm.ReheatComp_Num != HeatingCoilType::Gas && airTerm.ReheatComp_Num != HeatingCoilType::Electric) { + if (airTerm.ReheatComp_Num == HeatingCoilType::SteamAirHeating) { IsNotOK = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatControlNode = - GetCoilSteamInletNode(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); + airTerm.ReheatControlNode = GetCoilSteamInletNode(state, airTerm.ReheatComp, airTerm.ReheatName, IsNotOK); if (IsNotOK) { - ShowContinueError(state, - format("..Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError(state, format("..Occurs in {} = {}", airTerm.sysType, airTerm.SysName)); ErrorsFound = true; } } else { IsNotOK = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatControlNode = - GetCoilWaterInletNode(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); + airTerm.ReheatControlNode = GetCoilWaterInletNode(state, airTerm.ReheatComp, airTerm.ReheatName, IsNotOK); if (IsNotOK) { - ShowContinueError(state, - format("..Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError(state, format("..Occurs in {} = {}", airTerm.sysType, airTerm.SysName)); ErrorsFound = true; } } } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode = - GetOnlySingleNode(state, - Alphas(9), - ErrorsFound, - DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctVAVReheat, - Alphas(1), - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Outlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsParent, - cAlphaFields(9)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::SteamAirHeating) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatSteamVolFlow = Numbers(4); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatSteamVolFlow = Numbers(5); + airTerm.ReheatAirOutletNode = GetOnlySingleNode(state, + Alphas(9), + ErrorsFound, + DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctVAVReheat, + Alphas(1), + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Outlet, + NodeInputManager::CompFluidStream::Primary, + ObjectIsParent, + cAlphaFields(9)); + if (airTerm.ReheatComp_Num == HeatingCoilType::SteamAirHeating) { + airTerm.MaxReheatSteamVolFlow = Numbers(4); + airTerm.MinReheatSteamVolFlow = Numbers(5); } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatWaterVolFlow = Numbers(4); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatWaterVolFlow = Numbers(5); + airTerm.MaxReheatWaterVolFlow = Numbers(4); + airTerm.MinReheatWaterVolFlow = Numbers(5); } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset = Numbers(6); + airTerm.ControllerOffset = Numbers(6); // Set default convergence tolerance - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset <= 0.0) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset = 0.001; + if (airTerm.ControllerOffset <= 0.0) { + airTerm.ControllerOffset = 0.001; } if (Util::SameString(Alphas(10), "Reverse")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperHeatingAction = Action::Reverse; + airTerm.DamperHeatingAction = Action::Reverse; } else if (Util::SameString(Alphas(10), "Normal")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperHeatingAction = Action::Normal; + airTerm.DamperHeatingAction = Action::Normal; } else if (Util::SameString(Alphas(10), "ReverseWithLimits")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperHeatingAction = Action::ReverseWithLimits; + airTerm.DamperHeatingAction = Action::ReverseWithLimits; } else { ShowSevereError(state, format("{} = {} not found.", cAlphaFields(10), Alphas(10))); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError(state, format("Occurs in {} = {}", airTerm.sysType, airTerm.SysName)); ErrorsFound = true; } // Register component set data TestCompSet(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum), - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode), + airTerm.sysType, + airTerm.SysName, + state.dataLoopNodes->NodeID(airTerm.InletNodeNum), + state.dataLoopNodes->NodeID(airTerm.ReheatAirOutletNode), "Air Nodes"); for (ADUNum = 1; ADUNum <= (int)state.dataDefineEquipment->AirDistUnit.size(); ++ADUNum) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode == - state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum) { - state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum = ADUNum; + if (airTerm.ReheatAirOutletNode == state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum) { + state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = airTerm.InletNodeNum; + airTerm.ADUNum = ADUNum; break; } } // one assumes if there isn't one assigned, it's an error? - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum == 0) { + if (airTerm.ADUNum == 0) { ShowSevereError(state, - format("{}No matching Air Distribution Unit, for System = [{},{}].", - RoutineName, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ShowContinueError( - state, - format("...should have outlet node = {}", - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode))); + format("{}No matching Air Distribution Unit, for System = [{},{}].", RoutineName, airTerm.sysType, airTerm.SysName)); + ShowContinueError(state, format("...should have outlet node = {}", state.dataLoopNodes->NodeID(airTerm.ReheatAirOutletNode))); ErrorsFound = true; } else { @@ -629,140 +549,101 @@ void GetSysInput(EnergyPlusData &state) for (CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue; for (SupAirIn = 1; SupAirIn <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumInletNodes; ++SupAirIn) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode == - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(SupAirIn)) { + if (airTerm.ReheatAirOutletNode == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(SupAirIn)) { if (state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode > 0) { ShowSevereError(state, "Error in connecting a terminal unit to a zone"); - ShowContinueError(state, - format("{} already connects to another zone", - state.dataLoopNodes->NodeID( - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode))); - ShowContinueError(state, - format("Occurs for terminal unit {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError( + state, format("{} already connects to another zone", state.dataLoopNodes->NodeID(airTerm.ReheatAirOutletNode))); + ShowContinueError(state, format("Occurs for terminal unit {} = {}", airTerm.sysType, airTerm.SysName)); ShowContinueError(state, "Check terminal unit node names for errors"); ErrorsFound = true; } else { - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) - .TermUnitSizingNum = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).TermUnitSizingIndex; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) - .ZoneEqNum = CtrlZone; + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = airTerm.InletNodeNum; + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = airTerm.ReheatAirOutletNode; + state.dataDefineEquipment->AirDistUnit(airTerm.ADUNum).TermUnitSizingNum = + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).TermUnitSizingIndex; + state.dataDefineEquipment->AirDistUnit(airTerm.ADUNum).ZoneEqNum = CtrlZone; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneNum = CtrlZone; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneInNodeIndex = SupAirIn; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneFloorArea = - state.dataHeatBal->Zone(CtrlZone).FloorArea * state.dataHeatBal->Zone(CtrlZone).Multiplier * - state.dataHeatBal->Zone(CtrlZone).ListMultiplier; + airTerm.CtrlZoneNum = CtrlZone; + airTerm.CtrlZoneInNodeIndex = SupAirIn; + airTerm.ZoneFloorArea = state.dataHeatBal->Zone(CtrlZone).FloorArea * state.dataHeatBal->Zone(CtrlZone).Multiplier * + state.dataHeatBal->Zone(CtrlZone).ListMultiplier; } } } } if (Numbers(7) == Constant::AutoCalculate) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxAirVolFlowRateDuringReheat = Numbers(7); + airTerm.MaxAirVolFlowRateDuringReheat = Numbers(7); } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxAirVolFlowRateDuringReheat = - Numbers(7) * state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneFloorArea; + airTerm.MaxAirVolFlowRateDuringReheat = Numbers(7) * airTerm.ZoneFloorArea; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxAirVolFractionDuringReheat = Numbers(8); + airTerm.MaxAirVolFractionDuringReheat = Numbers(8); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperHeatingAction != Action::ReverseWithLimits) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxAirVolFlowRateDuringReheat > 0.0) { + if (airTerm.DamperHeatingAction != Action::ReverseWithLimits) { + if (airTerm.MaxAirVolFlowRateDuringReheat > 0.0) { ShowWarningError(state, format("Since {} = {}, input for {} will be ignored.", cAlphaFields(10), Alphas(10), cNumericFields(7))); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError(state, format("Occurs in {} = {}", airTerm.sysType, airTerm.SysName)); } - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxAirVolFractionDuringReheat > 0.0) { + if (airTerm.MaxAirVolFractionDuringReheat > 0.0) { ShowWarningError(state, format("Since {} = {}, input for {} will be ignored.", cAlphaFields(10), Alphas(10), cNumericFields(8))); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError(state, format("Occurs in {} = {}", airTerm.sysType, airTerm.SysName)); } } // Maximum reheat air temperature, i.e. the maximum supply air temperature leaving the reheat coil if (!lNumericBlanks(9)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatTemp = Numbers(9); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatTempSetByUser = true; + airTerm.MaxReheatTemp = Numbers(9); + airTerm.MaxReheatTempSetByUser = true; } else { // user does not specify maximum supply air temperature // sd_airterminal(SysNum)%MaxReheatTemp = 35.0D0 !C - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatTempSetByUser = false; + airTerm.MaxReheatTempSetByUser = false; } if (!lAlphaBlanks(11)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OARequirementsPtr = - Util::FindItemInList(Alphas(11), state.dataSize->OARequirements); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OARequirementsPtr == 0) { + airTerm.OARequirementsPtr = Util::FindItemInList(Alphas(11), state.dataSize->OARequirements); + if (airTerm.OARequirementsPtr == 0) { ShowSevereError(state, format("{} = {} not found.", cAlphaFields(11), Alphas(11))); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError(state, format("Occurs in {} = {}", airTerm.sysType, airTerm.SysName)); ErrorsFound = true; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).NoOAFlowInputFromUser = false; + airTerm.NoOAFlowInputFromUser = false; } } if (lAlphaBlanks(12)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFrac = 1.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchExist = false; - } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchPtr = GetScheduleIndex(state, Alphas(12)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchPtr == 0) { - ShowSevereError(state, format("{} = {} not found.", cAlphaFields(12), Alphas(12))); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ErrorsFound = true; - } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchExist = true; + airTerm.ZoneTurndownMinAirFrac = 1.0; + } else if ((airTerm.zoneTurndownMinAirFracSched = Sched::GetSchedule(state, Alphas(12))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(12), Alphas(12)); + ErrorsFound = true; } - ValidateComponent(state, Alphas(7), Alphas(8), IsNotOK, state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType); + ValidateComponent(state, Alphas(7), Alphas(8), IsNotOK, airTerm.sysType); if (IsNotOK) { - ShowContinueError(state, - format("In {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError(state, format("In {} = {}", airTerm.sysType, airTerm.SysName)); ErrorsFound = true; } // Add reheat coil to component sets array - SetUpCompSets(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, - Alphas(7), - Alphas(8), - Alphas(3), - Alphas(9)); + SetUpCompSets(state, airTerm.sysType, airTerm.SysName, Alphas(7), Alphas(8), Alphas(3), Alphas(9)); // Setup the Average damper Position output variable SetupOutputVariable(state, "Zone Air Terminal VAV Damper Position", Constant::Units::None, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperPosition, + airTerm.DamperPosition, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName); + airTerm.SysName); SetupOutputVariable(state, "Zone Air Terminal Minimum Air Flow Fraction", Constant::Units::None, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracReport, + airTerm.ZoneMinAirFracReport, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName); + airTerm.SysName); } // end Number of Sys Loop @@ -784,196 +665,147 @@ void GetSysInput(EnergyPlusData &state) cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; state.dataSingleDuct->SysNumGSI = state.dataSingleDuct->SysIndexGSI + state.dataSingleDuct->NumVAVSysGSI; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysNum = state.dataSingleDuct->SysNumGSI; + + auto &airTerm = state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI); + airTerm.SysNum = state.dataSingleDuct->SysNumGSI; GlobalNames::VerifyUniqueInterObjectName( state, state.dataSingleDuct->SysUniqueNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName = Alphas(1); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType = CurrentModuleObject; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysType_Num = SysType::SingleDuctCBVAVReheat; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp = Alphas(5); - if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Fuel")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::Gas; - } else if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Electric")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::Electric; - } else if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Water")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::SimpleHeating; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_PlantType = - DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; - } else if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Steam")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::SteamAirHeating; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_PlantType = - DataPlant::PlantEquipmentType::CoilSteamAirHeating; - } else if (!state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp.empty()) { - ShowSevereError( - state, format("Illegal {} = {}.", cAlphaFields(5), state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp)); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + airTerm.SysName = Alphas(1); + airTerm.sysType = CurrentModuleObject; + airTerm.SysType_Num = SysType::SingleDuctCBVAVReheat; + airTerm.ReheatComp = Alphas(5); + if (Util::SameString(airTerm.ReheatComp, "Coil:Heating:Fuel")) { + airTerm.ReheatComp_Num = HeatingCoilType::Gas; + } else if (Util::SameString(airTerm.ReheatComp, "Coil:Heating:Electric")) { + airTerm.ReheatComp_Num = HeatingCoilType::Electric; + } else if (Util::SameString(airTerm.ReheatComp, "Coil:Heating:Water")) { + airTerm.ReheatComp_Num = HeatingCoilType::SimpleHeating; + airTerm.ReheatComp_PlantType = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; + } else if (Util::SameString(airTerm.ReheatComp, "Coil:Heating:Steam")) { + airTerm.ReheatComp_Num = HeatingCoilType::SteamAirHeating; + airTerm.ReheatComp_PlantType = DataPlant::PlantEquipmentType::CoilSteamAirHeating; + } else if (!airTerm.ReheatComp.empty()) { + ShowSevereError(state, format("Illegal {} = {}.", cAlphaFields(5), airTerm.ReheatComp)); + ShowContinueError(state, format("Occurs in {} = {}", airTerm.sysType, airTerm.SysName)); ErrorsFound = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName = Alphas(6); - ValidateComponent(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType); + airTerm.ReheatName = Alphas(6); + ValidateComponent(state, airTerm.ReheatComp, airTerm.ReheatName, IsNotOK, airTerm.sysType); if (IsNotOK) { - ShowContinueError(state, - format("In {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError(state, format("In {} = {}", airTerm.sysType, airTerm.SysName)); ErrorsFound = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).Schedule = Alphas(2); + if (lAlphaBlanks(2)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = GetScheduleIndex(state, Alphas(2)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr == 0) { - ShowSevereError(state, format("{} = {} not found.", cAlphaFields(2), Alphas(2))); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ErrorsFound = true; - } + airTerm.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((airTerm.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } // For node connections, this object is both a parent and a non-parent, because the // VAV damper is not called out as a separate component, its nodes must be connected // as ObjectIsNotParent. But for the reheat coil, the nodes are connected as ObjectIsParent - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum = - GetOnlySingleNode(state, - Alphas(3), - ErrorsFound, - DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctVAVHeatAndCoolReheat, - Alphas(1), - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Outlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent, - cAlphaFields(3)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum = - GetOnlySingleNode(state, - Alphas(4), - ErrorsFound, - DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctVAVHeatAndCoolReheat, - Alphas(1), - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Inlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent, - cAlphaFields(4)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxAirVolFlowRate = Numbers(1); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = Numbers(2); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes < 0.0) { - ShowWarningError(state, - format("{} \"{}\"", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + airTerm.OutletNodeNum = GetOnlySingleNode(state, + Alphas(3), + ErrorsFound, + DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctVAVHeatAndCoolReheat, + Alphas(1), + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Outlet, + NodeInputManager::CompFluidStream::Primary, + ObjectIsNotParent, + cAlphaFields(3)); + airTerm.InletNodeNum = GetOnlySingleNode(state, + Alphas(4), + ErrorsFound, + DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctVAVHeatAndCoolReheat, + Alphas(1), + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Inlet, + NodeInputManager::CompFluidStream::Primary, + ObjectIsNotParent, + cAlphaFields(4)); + airTerm.MaxAirVolFlowRate = Numbers(1); + airTerm.ZoneMinAirFracDes = Numbers(2); + if (airTerm.ZoneMinAirFracDes < 0.0) { + ShowWarningError(state, format("{} \"{}\"", airTerm.sysType, airTerm.SysName)); ShowContinueError(state, format("{} must be greater than or equal to 0. Resetting to 0 and the simulation continues.", cNumericFields(2))); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = 0.0; + airTerm.ZoneMinAirFracDes = 0.0; } - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes > 1.0) { - ShowWarningError(state, - format("{} \"{}\"", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + if (airTerm.ZoneMinAirFracDes > 1.0) { + ShowWarningError(state, format("{} \"{}\"", airTerm.sysType, airTerm.SysName)); ShowContinueError(state, format("{} must be less than or equal to 1. Resetting to 1 and the simulation continues.", cNumericFields(2))); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = 1.0; + airTerm.ZoneMinAirFracDes = 1.0; } // The reheat coil control node is necessary for hot water and steam reheat, but not necessary for // electric or gas reheat. - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::Gas || - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::Electric) { + if (airTerm.ReheatComp_Num == HeatingCoilType::Gas || airTerm.ReheatComp_Num == HeatingCoilType::Electric) { } else { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::SteamAirHeating) { + if (airTerm.ReheatComp_Num == HeatingCoilType::SteamAirHeating) { IsNotOK = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatControlNode = - GetCoilSteamInletNode(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); + airTerm.ReheatControlNode = GetCoilSteamInletNode(state, airTerm.ReheatComp, airTerm.ReheatName, IsNotOK); if (IsNotOK) { - ShowContinueError(state, - format("..Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError(state, format("..Occurs in {} = {}", airTerm.sysType, airTerm.SysName)); ErrorsFound = true; } } else { IsNotOK = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatControlNode = - GetCoilWaterInletNode(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); + airTerm.ReheatControlNode = GetCoilWaterInletNode(state, airTerm.ReheatComp, airTerm.ReheatName, IsNotOK); if (IsNotOK) { - ShowContinueError(state, - format("..Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError(state, format("..Occurs in {} = {}", airTerm.sysType, airTerm.SysName)); ErrorsFound = true; } } // END IF } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode = - GetOnlySingleNode(state, - Alphas(7), - ErrorsFound, - DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctVAVHeatAndCoolReheat, - Alphas(1), - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Outlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsParent, - cAlphaFields(7)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::SteamAirHeating) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatSteamVolFlow = Numbers(3); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatSteamVolFlow = Numbers(4); + airTerm.ReheatAirOutletNode = GetOnlySingleNode(state, + Alphas(7), + ErrorsFound, + DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctVAVHeatAndCoolReheat, + Alphas(1), + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Outlet, + NodeInputManager::CompFluidStream::Primary, + ObjectIsParent, + cAlphaFields(7)); + if (airTerm.ReheatComp_Num == HeatingCoilType::SteamAirHeating) { + airTerm.MaxReheatSteamVolFlow = Numbers(3); + airTerm.MinReheatSteamVolFlow = Numbers(4); } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatWaterVolFlow = Numbers(3); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatWaterVolFlow = Numbers(4); + airTerm.MaxReheatWaterVolFlow = Numbers(3); + airTerm.MinReheatWaterVolFlow = Numbers(4); } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset = Numbers(5); + airTerm.ControllerOffset = Numbers(5); // Set default convergence tolerance - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset <= 0.0) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset = 0.001; + if (airTerm.ControllerOffset <= 0.0) { + airTerm.ControllerOffset = 0.001; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperHeatingAction = Action::Reverse; + airTerm.DamperHeatingAction = Action::Reverse; // Register component set data TestCompSet(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum), - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode), + airTerm.sysType, + airTerm.SysName, + state.dataLoopNodes->NodeID(airTerm.InletNodeNum), + state.dataLoopNodes->NodeID(airTerm.ReheatAirOutletNode), "Air Nodes"); for (ADUNum = 1; ADUNum <= (int)state.dataDefineEquipment->AirDistUnit.size(); ++ADUNum) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode == - state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum) { - state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum = ADUNum; + if (airTerm.ReheatAirOutletNode == state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum) { + state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = airTerm.InletNodeNum; + airTerm.ADUNum = ADUNum; break; } } // one assumes if there isn't one assigned, it's an error? - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum == 0) { + if (airTerm.ADUNum == 0) { ShowSevereError(state, - format("{}No matching Air Distribution Unit, for System = [{},{}].", - RoutineName, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ShowContinueError( - state, - format("...should have outlet node = {}", - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode))); + format("{}No matching Air Distribution Unit, for System = [{},{}].", RoutineName, airTerm.sysType, airTerm.SysName)); + ShowContinueError(state, format("...should have outlet node = {}", state.dataLoopNodes->NodeID(airTerm.ReheatAirOutletNode))); ErrorsFound = true; } else { @@ -981,90 +813,62 @@ void GetSysInput(EnergyPlusData &state) for (CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue; for (SupAirIn = 1; SupAirIn <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumInletNodes; ++SupAirIn) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode == - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(SupAirIn)) { + if (airTerm.ReheatAirOutletNode == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(SupAirIn)) { if (state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode > 0) { ShowSevereError(state, "Error in connecting a terminal unit to a zone"); - ShowContinueError(state, - format("{} already connects to another zone", - state.dataLoopNodes->NodeID( - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode))); - ShowContinueError(state, - format("Occurs for terminal unit {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError( + state, format("{} already connects to another zone", state.dataLoopNodes->NodeID(airTerm.ReheatAirOutletNode))); + ShowContinueError(state, format("Occurs for terminal unit {} = {}", airTerm.sysType, airTerm.SysName)); ShowContinueError(state, "Check terminal unit node names for errors"); ErrorsFound = true; } else { - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) - .TermUnitSizingNum = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).TermUnitSizingIndex; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) - .ZoneEqNum = CtrlZone; + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = airTerm.InletNodeNum; + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = airTerm.ReheatAirOutletNode; + state.dataDefineEquipment->AirDistUnit(airTerm.ADUNum).TermUnitSizingNum = + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).TermUnitSizingIndex; + state.dataDefineEquipment->AirDistUnit(airTerm.ADUNum).ZoneEqNum = CtrlZone; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneNum = CtrlZone; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneInNodeIndex = SupAirIn; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneFloorArea = - state.dataHeatBal->Zone(CtrlZone).FloorArea * state.dataHeatBal->Zone(CtrlZone).Multiplier * - state.dataHeatBal->Zone(CtrlZone).ListMultiplier; + airTerm.CtrlZoneNum = CtrlZone; + airTerm.CtrlZoneInNodeIndex = SupAirIn; + airTerm.ZoneFloorArea = state.dataHeatBal->Zone(CtrlZone).FloorArea * state.dataHeatBal->Zone(CtrlZone).Multiplier * + state.dataHeatBal->Zone(CtrlZone).ListMultiplier; } } } } if (!lNumericBlanks(6)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatTemp = Numbers(6); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatTempSetByUser = true; + airTerm.MaxReheatTemp = Numbers(6); + airTerm.MaxReheatTempSetByUser = true; } else { // user does not specify maximum supply air temperature // sd_airterminal(SysNum)%MaxReheatTemp = 35.0D0 !C - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatTempSetByUser = false; + airTerm.MaxReheatTempSetByUser = false; } - ValidateComponent(state, Alphas(5), Alphas(6), IsNotOK, state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType); + ValidateComponent(state, Alphas(5), Alphas(6), IsNotOK, airTerm.sysType); if (IsNotOK) { - ShowContinueError(state, - format("In {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError(state, format("In {} = {}", airTerm.sysType, airTerm.SysName)); ErrorsFound = true; } if (lAlphaBlanks(8)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFrac = 1.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchExist = false; - } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchPtr = GetScheduleIndex(state, Alphas(8)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchPtr == 0) { - ShowSevereError(state, format("{} = {} not found.", cAlphaFields(8), Alphas(8))); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ErrorsFound = true; - } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchExist = true; + airTerm.ZoneTurndownMinAirFrac = 1.0; + } else if ((airTerm.zoneTurndownMinAirFracSched = Sched::GetSchedule(state, Alphas(8))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(8), Alphas(8)); + ErrorsFound = true; } // Add reheat coil to component sets array - SetUpCompSets(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, - Alphas(5), - Alphas(6), - Alphas(3), - Alphas(7)); + SetUpCompSets(state, airTerm.sysType, airTerm.SysName, Alphas(5), Alphas(6), Alphas(3), Alphas(7)); // Setup the Average damper Position output variable SetupOutputVariable(state, "Zone Air Terminal VAV Damper Position", Constant::Units::None, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperPosition, + airTerm.DamperPosition, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName); + airTerm.SysName); } // end Number of VAVHeatandCool Sys Loop @@ -1086,176 +890,135 @@ void GetSysInput(EnergyPlusData &state) cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + state.dataSingleDuct->SysNumGSI = state.dataSingleDuct->SysIndexGSI + state.dataSingleDuct->NumVAVSysGSI + state.dataSingleDuct->NumCBVAVSysGSI; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysNum = state.dataSingleDuct->SysNumGSI; + auto &airTerm = state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI); + + airTerm.SysNum = state.dataSingleDuct->SysNumGSI; GlobalNames::VerifyUniqueInterObjectName( state, state.dataSingleDuct->SysUniqueNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName = Alphas(1); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType = CurrentModuleObject; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysType_Num = SysType::SingleDuctConstVolReheat; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp = Alphas(5); - if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Fuel")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::Gas; - } else if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Electric")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::Electric; - } else if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Water")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::SimpleHeating; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_PlantType = - DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; - } else if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Steam")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::SteamAirHeating; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_PlantType = - DataPlant::PlantEquipmentType::CoilSteamAirHeating; + airTerm.SysName = Alphas(1); + airTerm.sysType = CurrentModuleObject; + airTerm.SysType_Num = SysType::SingleDuctConstVolReheat; + airTerm.ReheatComp = Alphas(5); + if (Util::SameString(airTerm.ReheatComp, "Coil:Heating:Fuel")) { + airTerm.ReheatComp_Num = HeatingCoilType::Gas; + } else if (Util::SameString(airTerm.ReheatComp, "Coil:Heating:Electric")) { + airTerm.ReheatComp_Num = HeatingCoilType::Electric; + } else if (Util::SameString(airTerm.ReheatComp, "Coil:Heating:Water")) { + airTerm.ReheatComp_Num = HeatingCoilType::SimpleHeating; + airTerm.ReheatComp_PlantType = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; + } else if (Util::SameString(airTerm.ReheatComp, "Coil:Heating:Steam")) { + airTerm.ReheatComp_Num = HeatingCoilType::SteamAirHeating; + airTerm.ReheatComp_PlantType = DataPlant::PlantEquipmentType::CoilSteamAirHeating; } else { - ShowSevereError( - state, format("Illegal {} = {}.", cAlphaFields(5), state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp)); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowSevereError(state, format("Illegal {} = {}.", cAlphaFields(5), airTerm.ReheatComp)); + ShowContinueError(state, format("Occurs in {} = {}", airTerm.sysType, airTerm.SysName)); ErrorsFound = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName = Alphas(6); - ValidateComponent(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType); + airTerm.ReheatName = Alphas(6); + ValidateComponent(state, airTerm.ReheatComp, airTerm.ReheatName, IsNotOK, airTerm.sysType); if (IsNotOK) { - ShowContinueError(state, - format("In {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError(state, format("In {} = {}", airTerm.sysType, airTerm.SysName)); ErrorsFound = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).Schedule = Alphas(2); + if (lAlphaBlanks(2)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = GetScheduleIndex(state, Alphas(2)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr == 0) { - ShowSevereError(state, format("{} = {} not found.", cAlphaFields(2), Alphas(2))); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ErrorsFound = true; - } + airTerm.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((airTerm.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum = - GetOnlySingleNode(state, - Alphas(3), - ErrorsFound, - DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctConstantVolumeReheat, - Alphas(1), - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Outlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsParent, - cAlphaFields(3)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum = - GetOnlySingleNode(state, - Alphas(4), - ErrorsFound, - DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctConstantVolumeReheat, - Alphas(1), - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Inlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsParent, - cAlphaFields(4)); + + airTerm.OutletNodeNum = GetOnlySingleNode(state, + Alphas(3), + ErrorsFound, + DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctConstantVolumeReheat, + Alphas(1), + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Outlet, + NodeInputManager::CompFluidStream::Primary, + ObjectIsParent, + cAlphaFields(3)); + airTerm.InletNodeNum = GetOnlySingleNode(state, + Alphas(4), + ErrorsFound, + DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctConstantVolumeReheat, + Alphas(1), + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Inlet, + NodeInputManager::CompFluidStream::Primary, + ObjectIsParent, + cAlphaFields(4)); // The reheat coil control node is necessary for hot water reheat, but not necessary for // electric or gas reheat. - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::Gas || - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::Electric) { + if (airTerm.ReheatComp_Num == HeatingCoilType::Gas || airTerm.ReheatComp_Num == HeatingCoilType::Electric) { } else { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::SteamAirHeating) { + if (airTerm.ReheatComp_Num == HeatingCoilType::SteamAirHeating) { IsNotOK = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatControlNode = - GetCoilSteamInletNode(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); + airTerm.ReheatControlNode = GetCoilSteamInletNode(state, airTerm.ReheatComp, airTerm.ReheatName, IsNotOK); if (IsNotOK) { - ShowContinueError(state, - format("..Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError(state, format("..Occurs in {} = {}", airTerm.sysType, airTerm.SysName)); ErrorsFound = true; } } else { IsNotOK = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatControlNode = - GetCoilWaterInletNode(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); + airTerm.ReheatControlNode = GetCoilWaterInletNode(state, airTerm.ReheatComp, airTerm.ReheatName, IsNotOK); if (IsNotOK) { - ShowContinueError(state, - format("..Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError(state, format("..Occurs in {} = {}", airTerm.sysType, airTerm.SysName)); ErrorsFound = true; } } } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxAirVolFlowRate = Numbers(1); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod = MinFlowFraction::MinFracNotUsed; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperHeatingAction = Action::HeatingNotUsed; - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::SteamAirHeating) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatSteamVolFlow = Numbers(2); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatSteamVolFlow = Numbers(3); + airTerm.ReheatAirOutletNode = airTerm.OutletNodeNum; + airTerm.MaxAirVolFlowRate = Numbers(1); + airTerm.ZoneMinAirFracDes = 0.0; + airTerm.ZoneMinAirFracMethod = MinFlowFraction::MinFracNotUsed; + airTerm.DamperHeatingAction = Action::HeatingNotUsed; + if (airTerm.ReheatComp_Num == HeatingCoilType::SteamAirHeating) { + airTerm.MaxReheatSteamVolFlow = Numbers(2); + airTerm.MinReheatSteamVolFlow = Numbers(3); } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatWaterVolFlow = Numbers(2); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatWaterVolFlow = Numbers(3); + airTerm.MaxReheatWaterVolFlow = Numbers(2); + airTerm.MinReheatWaterVolFlow = Numbers(3); } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset = Numbers(4); + airTerm.ControllerOffset = Numbers(4); // Set default convergence tolerance - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset <= 0.0) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset = 0.001; + if (airTerm.ControllerOffset <= 0.0) { + airTerm.ControllerOffset = 0.001; } // Maximum reheat air temperature, i.e. the maximum supply air temperature leaving the reheat coil if (!lNumericBlanks(5)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatTemp = Numbers(5); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatTempSetByUser = true; + airTerm.MaxReheatTemp = Numbers(5); + airTerm.MaxReheatTempSetByUser = true; } else { // user does not specify maximum supply air temperature // sd_airterminal(SysNum)%MaxReheatTemp = 35.0D0 !C - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatTempSetByUser = false; + airTerm.MaxReheatTempSetByUser = false; } // Register component set data TestCompSet(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum), - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum), + airTerm.sysType, + airTerm.SysName, + state.dataLoopNodes->NodeID(airTerm.InletNodeNum), + state.dataLoopNodes->NodeID(airTerm.OutletNodeNum), "Air Nodes"); for (ADUNum = 1; ADUNum <= (int)state.dataDefineEquipment->AirDistUnit.size(); ++ADUNum) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode == - state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum) { - state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum = ADUNum; + if (airTerm.ReheatAirOutletNode == state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum) { + state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = airTerm.InletNodeNum; + airTerm.ADUNum = ADUNum; break; } } // one assumes if there isn't one assigned, it's an error? - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum == 0) { + if (airTerm.ADUNum == 0) { ShowSevereError(state, - format("{}No matching Air Distribution Unit, for System = [{},{}].", - RoutineName, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ShowContinueError( - state, - format("...should have outlet node = {}", - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode))); + format("{}No matching Air Distribution Unit, for System = [{},{}].", RoutineName, airTerm.sysType, airTerm.SysName)); + ShowContinueError(state, format("...should have outlet node = {}", state.dataLoopNodes->NodeID(airTerm.ReheatAirOutletNode))); ErrorsFound = true; } else { @@ -1263,57 +1026,38 @@ void GetSysInput(EnergyPlusData &state) for (CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue; for (SupAirIn = 1; SupAirIn <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumInletNodes; ++SupAirIn) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum == - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(SupAirIn)) { + if (airTerm.OutletNodeNum == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(SupAirIn)) { if (state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode > 0) { ShowSevereError(state, "Error in connecting a terminal unit to a zone"); ShowContinueError(state, - format("{} already connects to another zone", - state.dataLoopNodes->NodeID( - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum))); - ShowContinueError(state, - format("Occurs for terminal unit {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + format("{} already connects to another zone", state.dataLoopNodes->NodeID(airTerm.OutletNodeNum))); + ShowContinueError(state, format("Occurs for terminal unit {} = {}", airTerm.sysType, airTerm.SysName)); ShowContinueError(state, "Check terminal unit node names for errors"); ErrorsFound = true; } else { - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) - .TermUnitSizingNum = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).TermUnitSizingIndex; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) - .ZoneEqNum = CtrlZone; + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = airTerm.InletNodeNum; + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = airTerm.OutletNodeNum; + state.dataDefineEquipment->AirDistUnit(airTerm.ADUNum).TermUnitSizingNum = + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).TermUnitSizingIndex; + state.dataDefineEquipment->AirDistUnit(airTerm.ADUNum).ZoneEqNum = CtrlZone; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneNum = CtrlZone; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneInNodeIndex = SupAirIn; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneFloorArea = - state.dataHeatBal->Zone(CtrlZone).FloorArea * state.dataHeatBal->Zone(CtrlZone).Multiplier * - state.dataHeatBal->Zone(CtrlZone).ListMultiplier; + airTerm.CtrlZoneNum = CtrlZone; + airTerm.CtrlZoneInNodeIndex = SupAirIn; + airTerm.ZoneFloorArea = state.dataHeatBal->Zone(CtrlZone).FloorArea * state.dataHeatBal->Zone(CtrlZone).Multiplier * + state.dataHeatBal->Zone(CtrlZone).ListMultiplier; } } } } - ValidateComponent(state, Alphas(5), Alphas(6), IsNotOK, state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType); + ValidateComponent(state, Alphas(5), Alphas(6), IsNotOK, airTerm.sysType); if (IsNotOK) { - ShowContinueError(state, - format("In {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError(state, format("In {} = {}", airTerm.sysType, airTerm.SysName)); ErrorsFound = true; } // Add reheat coil to component sets array - SetUpCompSets(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, - Alphas(5), - Alphas(6), - Alphas(4), - Alphas(3)); + SetUpCompSets(state, airTerm.sysType, airTerm.SysName, Alphas(5), Alphas(6), Alphas(4), Alphas(3)); // Setup the Average damper Position output variable // BG removed 9-10-2009 during work on CR 7770, constant volume has no damper @@ -1340,94 +1084,80 @@ void GetSysInput(EnergyPlusData &state) cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + state.dataSingleDuct->SysNumGSI = state.dataSingleDuct->SysIndexGSI + state.dataSingleDuct->NumVAVSysGSI + state.dataSingleDuct->NumCBVAVSysGSI + state.dataSingleDuct->NumConstVolSys; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysNum = state.dataSingleDuct->SysNumGSI; + auto &airTerm = state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI); + + airTerm.SysNum = state.dataSingleDuct->SysNumGSI; GlobalNames::VerifyUniqueInterObjectName( state, state.dataSingleDuct->SysUniqueNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName = Alphas(1); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType = CurrentModuleObject; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysType_Num = SysType::SingleDuctConstVolNoReheat; + airTerm.SysName = Alphas(1); + airTerm.sysType = CurrentModuleObject; + airTerm.SysType_Num = SysType::SingleDuctConstVolNoReheat; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).Schedule = Alphas(2); if (lAlphaBlanks(2)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = GetScheduleIndex(state, Alphas(2)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr == 0) { - ShowSevereError(state, format("{} = {} not found.", cAlphaFields(2), Alphas(2))); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ErrorsFound = true; - } + airTerm.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((airTerm.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum = - GetOnlySingleNode(state, - Alphas(3), - ErrorsFound, - DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctConstantVolumeNoReheat, - Alphas(1), - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Inlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent, - cAlphaFields(3)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum = - GetOnlySingleNode(state, - Alphas(4), - ErrorsFound, - DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctConstantVolumeNoReheat, - Alphas(1), - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Outlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent, - cAlphaFields(4)); - - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxAirVolFlowRate = Numbers(1); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod = MinFlowFraction::MinFracNotUsed; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperHeatingAction = Action::HeatingNotUsed; - - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatControlNode = 0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatWaterVolFlow = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatSteamVolFlow = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatWaterVolFlow = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatSteamVolFlow = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset = 0.000001; + + airTerm.InletNodeNum = GetOnlySingleNode(state, + Alphas(3), + ErrorsFound, + DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctConstantVolumeNoReheat, + Alphas(1), + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Inlet, + NodeInputManager::CompFluidStream::Primary, + ObjectIsNotParent, + cAlphaFields(3)); + airTerm.OutletNodeNum = GetOnlySingleNode(state, + Alphas(4), + ErrorsFound, + DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctConstantVolumeNoReheat, + Alphas(1), + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Outlet, + NodeInputManager::CompFluidStream::Primary, + ObjectIsNotParent, + cAlphaFields(4)); + + airTerm.MaxAirVolFlowRate = Numbers(1); + airTerm.ZoneMinAirFracDes = 0.0; + airTerm.ZoneMinAirFracMethod = MinFlowFraction::MinFracNotUsed; + airTerm.DamperHeatingAction = Action::HeatingNotUsed; + + airTerm.ReheatControlNode = 0; + airTerm.ReheatAirOutletNode = airTerm.OutletNodeNum; + airTerm.MaxReheatWaterVolFlow = 0.0; + airTerm.MaxReheatSteamVolFlow = 0.0; + airTerm.MinReheatWaterVolFlow = 0.0; + airTerm.MinReheatSteamVolFlow = 0.0; + airTerm.ControllerOffset = 0.000001; // Register component set data TestCompSet(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum), - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum), + airTerm.sysType, + airTerm.SysName, + state.dataLoopNodes->NodeID(airTerm.InletNodeNum), + state.dataLoopNodes->NodeID(airTerm.OutletNodeNum), "Air Nodes"); for (ADUNum = 1; ADUNum <= (int)state.dataDefineEquipment->AirDistUnit.size(); ++ADUNum) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum == - state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum) { - state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum = ADUNum; + if (airTerm.OutletNodeNum == state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum) { + state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = airTerm.InletNodeNum; + airTerm.ADUNum = ADUNum; break; } } // one assumes if there isn't one assigned, it's an error? - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum == 0) { + if (airTerm.ADUNum == 0) { ShowSevereError(state, - format("{}No matching Air Distribution Unit, for System = [{},{}].", - RoutineName, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ShowContinueError( - state, - format("...should have outlet node = {}", - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum))); + format("{}No matching Air Distribution Unit, for System = [{},{}].", RoutineName, airTerm.sysType, airTerm.SysName)); + ShowContinueError(state, format("...should have outlet node = {}", state.dataLoopNodes->NodeID(airTerm.OutletNodeNum))); ErrorsFound = true; } else { @@ -1435,67 +1165,52 @@ void GetSysInput(EnergyPlusData &state) for (CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue; for (SupAirIn = 1; SupAirIn <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumInletNodes; ++SupAirIn) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum == - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(SupAirIn)) { + if (airTerm.OutletNodeNum == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(SupAirIn)) { if (state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode > 0) { ShowSevereError(state, "Error in connecting a terminal unit to a zone"); ShowContinueError(state, - format("{} already connects to another zone", - state.dataLoopNodes->NodeID( - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum))); - ShowContinueError(state, - format("Occurs for terminal unit {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + format("{} already connects to another zone", state.dataLoopNodes->NodeID(airTerm.OutletNodeNum))); + ShowContinueError(state, format("Occurs for terminal unit {} = {}", airTerm.sysType, airTerm.SysName)); ShowContinueError(state, "Check terminal unit node names for errors"); ErrorsFound = true; } else { - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) - .TermUnitSizingNum = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).TermUnitSizingIndex; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) - .ZoneEqNum = CtrlZone; + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = airTerm.InletNodeNum; + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = airTerm.OutletNodeNum; + state.dataDefineEquipment->AirDistUnit(airTerm.ADUNum).TermUnitSizingNum = + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).TermUnitSizingIndex; + state.dataDefineEquipment->AirDistUnit(airTerm.ADUNum).ZoneEqNum = CtrlZone; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneNum = CtrlZone; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneInNodeIndex = SupAirIn; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneFloorArea = - state.dataHeatBal->Zone(CtrlZone).FloorArea * state.dataHeatBal->Zone(CtrlZone).Multiplier * - state.dataHeatBal->Zone(CtrlZone).ListMultiplier; + airTerm.CtrlZoneNum = CtrlZone; + airTerm.CtrlZoneInNodeIndex = SupAirIn; + airTerm.ZoneFloorArea = state.dataHeatBal->Zone(CtrlZone).FloorArea * state.dataHeatBal->Zone(CtrlZone).Multiplier * + state.dataHeatBal->Zone(CtrlZone).ListMultiplier; } } } } if (lAlphaBlanks(5)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).NoOAFlowInputFromUser = true; + airTerm.NoOAFlowInputFromUser = true; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OARequirementsPtr = - Util::FindItemInList(Alphas(5), state.dataSize->OARequirements); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OARequirementsPtr == 0) { + airTerm.OARequirementsPtr = Util::FindItemInList(Alphas(5), state.dataSize->OARequirements); + if (airTerm.OARequirementsPtr == 0) { ShowSevereError(state, format("{}{}=\"{}\", invalid data.", RoutineName, CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("..invalid {}=\"{}\".", cAlphaFields(5), Alphas(5))); ErrorsFound = true; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).NoOAFlowInputFromUser = false; + airTerm.NoOAFlowInputFromUser = false; } } if (lAlphaBlanks(6)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OAPerPersonMode = - DataZoneEquipment::PerPersonVentRateMode::DCVByCurrentLevel; + airTerm.OAPerPersonMode = DataZoneEquipment::PerPersonVentRateMode::DCVByCurrentLevel; } else { if (Alphas(6) == "CURRENTOCCUPANCY") { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OAPerPersonMode = - DataZoneEquipment::PerPersonVentRateMode::DCVByCurrentLevel; + airTerm.OAPerPersonMode = DataZoneEquipment::PerPersonVentRateMode::DCVByCurrentLevel; } else if (Alphas(6) == "DESIGNOCCUPANCY") { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OAPerPersonMode = - DataZoneEquipment::PerPersonVentRateMode::ByDesignLevel; + airTerm.OAPerPersonMode = DataZoneEquipment::PerPersonVentRateMode::ByDesignLevel; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OAPerPersonMode = - DataZoneEquipment::PerPersonVentRateMode::DCVByCurrentLevel; + airTerm.OAPerPersonMode = DataZoneEquipment::PerPersonVentRateMode::DCVByCurrentLevel; ShowWarningError(state, format("{}{}=\"{}\", invalid data.", RoutineName, CurrentModuleObject, Alphas(1))); ShowContinueError(state, format("..invalid {}=\"{}\". The default input of CurrentOccupancy is assigned", cAlphaFields(6), Alphas(6))); @@ -1506,17 +1221,17 @@ void GetSysInput(EnergyPlusData &state) // model results related actuators SetupEMSActuator(state, "AirTerminal:SingleDuct:ConstantVolume:NoReheat", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, + airTerm.SysName, "Mass Flow Rate", "[kg/s]", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).EMSOverrideAirFlow, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).EMSMassFlowRateValue); + airTerm.EMSOverrideAirFlow, + airTerm.EMSMassFlowRateValue); // model input related internal variables SetupEMSInternalVariable(state, "AirTerminal:SingleDuct:ConstantVolume:NoReheat Maximum Mass Flow Rate", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, + airTerm.SysName, "[kg/s]", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).AirMassFlowRateMax); + airTerm.AirMassFlowRateMax); } } // End Number of Sys Loop @@ -1539,165 +1254,131 @@ void GetSysInput(EnergyPlusData &state) cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; state.dataSingleDuct->SysNumGSI = state.dataSingleDuct->SysIndexGSI + state.dataSingleDuct->NumVAVSysGSI + state.dataSingleDuct->NumCBVAVSysGSI + state.dataSingleDuct->NumConstVolSys + state.dataSingleDuct->NumCVNoReheatSysGSI; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysNum = state.dataSingleDuct->SysNumGSI; + auto &airTerm = state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI); + + airTerm.SysNum = state.dataSingleDuct->SysNumGSI; GlobalNames::VerifyUniqueInterObjectName( state, state.dataSingleDuct->SysUniqueNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName = Alphas(1); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType = CurrentModuleObject; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysType_Num = SysType::SingleDuctVAVNoReheat; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp = ""; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName = ""; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).Schedule = Alphas(2); + airTerm.SysName = Alphas(1); + airTerm.sysType = CurrentModuleObject; + airTerm.SysType_Num = SysType::SingleDuctVAVNoReheat; + airTerm.ReheatComp = ""; + airTerm.ReheatName = ""; + if (lAlphaBlanks(2)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = GetScheduleIndex(state, Alphas(2)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr == 0) { - ShowSevereError(state, format("{} = {} not found.", cAlphaFields(2), Alphas(2))); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ErrorsFound = true; - } + airTerm.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((airTerm.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum = - GetOnlySingleNode(state, - Alphas(3), - ErrorsFound, - DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctVAVNoReheat, - Alphas(1), - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Outlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent, - cAlphaFields(3)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum = - GetOnlySingleNode(state, - Alphas(4), - ErrorsFound, - DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctVAVNoReheat, - Alphas(1), - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Inlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent, - cAlphaFields(4)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxAirVolFlowRate = Numbers(1); + + airTerm.OutletNodeNum = GetOnlySingleNode(state, + Alphas(3), + ErrorsFound, + DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctVAVNoReheat, + Alphas(1), + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Outlet, + NodeInputManager::CompFluidStream::Primary, + ObjectIsNotParent, + cAlphaFields(3)); + airTerm.InletNodeNum = GetOnlySingleNode(state, + Alphas(4), + ErrorsFound, + DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctVAVNoReheat, + Alphas(1), + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Inlet, + NodeInputManager::CompFluidStream::Primary, + ObjectIsNotParent, + cAlphaFields(4)); + airTerm.MaxAirVolFlowRate = Numbers(1); if (Util::SameString(Alphas(5), "Constant")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod = MinFlowFraction::Constant; + airTerm.ZoneMinAirFracMethod = MinFlowFraction::Constant; } else if (Util::SameString(Alphas(5), "FixedFlowRate")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod = MinFlowFraction::Fixed; + airTerm.ZoneMinAirFracMethod = MinFlowFraction::Fixed; } else if (Util::SameString(Alphas(5), "Scheduled")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod = MinFlowFraction::Scheduled; + airTerm.ZoneMinAirFracMethod = MinFlowFraction::Scheduled; } else { ShowSevereError(state, format("{} = {} not found.", cAlphaFields(5), Alphas(5))); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError(state, format("Occurs in {} = {}", airTerm.sysType, airTerm.SysName)); ErrorsFound = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = Numbers(2); + airTerm.ZoneMinAirFracDes = Numbers(2); if (lNumericBlanks(2)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ConstantMinAirFracSetByUser = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = 0.0; + airTerm.ConstantMinAirFracSetByUser = false; + airTerm.ZoneMinAirFracDes = 0.0; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ConstantMinAirFracSetByUser = true; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = Numbers(2); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod == MinFlowFraction::Fixed) { + airTerm.ConstantMinAirFracSetByUser = true; + airTerm.ZoneMinAirFracDes = Numbers(2); + if (airTerm.ZoneMinAirFracMethod == MinFlowFraction::Fixed) { ShowWarningError(state, format("Since {} = {}, input for {} will be ignored.", cAlphaFields(5), Alphas(5), cNumericFields(2))); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = 0.0; + ShowContinueError(state, format("Occurs in {} = {}", airTerm.sysType, airTerm.SysName)); + airTerm.ZoneMinAirFracDes = 0.0; } } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneFixedMinAir = Numbers(3); + airTerm.ZoneFixedMinAir = Numbers(3); if (lNumericBlanks(3)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).FixedMinAirSetByUser = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DesignFixedMinAir = 0.0; + airTerm.FixedMinAirSetByUser = false; + airTerm.DesignFixedMinAir = 0.0; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).FixedMinAirSetByUser = true; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DesignFixedMinAir = Numbers(3); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod == MinFlowFraction::Constant) { + airTerm.FixedMinAirSetByUser = true; + airTerm.DesignFixedMinAir = Numbers(3); + if (airTerm.ZoneMinAirFracMethod == MinFlowFraction::Constant) { ShowWarningError(state, format("Since {} = {}, input for {} will be ignored.", cAlphaFields(5), Alphas(5), cNumericFields(3))); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneFixedMinAir = 0.0; + ShowContinueError(state, format("Occurs in {} = {}", airTerm.sysType, airTerm.SysName)); + airTerm.ZoneFixedMinAir = 0.0; } } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracSchPtr = GetScheduleIndex(state, Alphas(6)); - if ((state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracSchPtr == 0) && - (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod == MinFlowFraction::Scheduled)) { - ShowSevereError(state, format("{} = {} not found.", cAlphaFields(6), Alphas(6))); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ShowContinueError(state, "A valid schedule is required"); + + if (airTerm.ZoneMinAirFracMethod != MinFlowFraction::Scheduled) { + } else if (lAlphaBlanks(6)) { + ShowSevereEmptyField(state, eoh, cAlphaFields(6)); + ErrorsFound = true; + } else if ((airTerm.zoneMinAirFracSched = Sched::GetSchedule(state, Alphas(6))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(6), Alphas(6)); + ErrorsFound = true; + } else if (!airTerm.zoneMinAirFracSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFields(6), Alphas(6), Clusive::In, 0.0, Clusive::In, 1.0); ErrorsFound = true; - } else if ((state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracSchPtr > 0) && - (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracMethod == MinFlowFraction::Scheduled)) { - // check range of values in schedule - if (!CheckScheduleValueMinMax( - state, state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracSchPtr, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("Error found in {} = {}", cAlphaFields(6), Alphas(6))); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ShowContinueError(state, "Schedule values must be (>=0., <=1.)"); - } } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatControlNode = 0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatWaterVolFlow = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatSteamVolFlow = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatWaterVolFlow = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatSteamVolFlow = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset = 0.000001; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperHeatingAction = Action::HeatingNotUsed; + airTerm.ReheatControlNode = 0; + airTerm.ReheatAirOutletNode = airTerm.OutletNodeNum; + airTerm.MaxReheatWaterVolFlow = 0.0; + airTerm.MaxReheatSteamVolFlow = 0.0; + airTerm.MinReheatWaterVolFlow = 0.0; + airTerm.MinReheatSteamVolFlow = 0.0; + airTerm.ControllerOffset = 0.000001; + airTerm.DamperHeatingAction = Action::HeatingNotUsed; // Register component set data TestCompSet(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum), - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum), + airTerm.sysType, + airTerm.SysName, + state.dataLoopNodes->NodeID(airTerm.InletNodeNum), + state.dataLoopNodes->NodeID(airTerm.OutletNodeNum), "Air Nodes"); for (ADUNum = 1; ADUNum <= (int)state.dataDefineEquipment->AirDistUnit.size(); ++ADUNum) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum == - state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum) { - state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum = ADUNum; + if (airTerm.OutletNodeNum == state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum) { + state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = airTerm.InletNodeNum; + airTerm.ADUNum = ADUNum; break; } } // one assumes if there isn't one assigned, it's an error? - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum == 0) { + if (airTerm.ADUNum == 0) { ShowSevereError(state, - format("{}No matching Air Distribution Unit, for System = [{},{}].", - RoutineName, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ShowContinueError( - state, - format("...should have outlet node = {}", - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode))); + format("{}No matching Air Distribution Unit, for System = [{},{}].", RoutineName, airTerm.sysType, airTerm.SysName)); + ShowContinueError(state, format("...should have outlet node = {}", state.dataLoopNodes->NodeID(airTerm.ReheatAirOutletNode))); ErrorsFound = true; } else { @@ -1705,86 +1386,63 @@ void GetSysInput(EnergyPlusData &state) for (CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue; for (SupAirIn = 1; SupAirIn <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumInletNodes; ++SupAirIn) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode == - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(SupAirIn)) { + if (airTerm.ReheatAirOutletNode == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(SupAirIn)) { if (state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode > 0) { ShowSevereError(state, "Error in connecting a terminal unit to a zone"); - ShowContinueError(state, - format("{} already connects to another zone", - state.dataLoopNodes->NodeID( - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode))); - ShowContinueError(state, - format("Occurs for terminal unit {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError( + state, format("{} already connects to another zone", state.dataLoopNodes->NodeID(airTerm.ReheatAirOutletNode))); + ShowContinueError(state, format("Occurs for terminal unit {} = {}", airTerm.sysType, airTerm.SysName)); ShowContinueError(state, "Check terminal unit node names for errors"); ErrorsFound = true; } else { - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) - .TermUnitSizingNum = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).TermUnitSizingIndex; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) - .ZoneEqNum = CtrlZone; + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = airTerm.InletNodeNum; + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = airTerm.ReheatAirOutletNode; + state.dataDefineEquipment->AirDistUnit(airTerm.ADUNum).TermUnitSizingNum = + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).TermUnitSizingIndex; + state.dataDefineEquipment->AirDistUnit(airTerm.ADUNum).ZoneEqNum = CtrlZone; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneNum = CtrlZone; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneInNodeIndex = SupAirIn; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneFloorArea = - state.dataHeatBal->Zone(CtrlZone).FloorArea * state.dataHeatBal->Zone(CtrlZone).Multiplier * - state.dataHeatBal->Zone(CtrlZone).ListMultiplier; + airTerm.CtrlZoneNum = CtrlZone; + airTerm.CtrlZoneInNodeIndex = SupAirIn; + airTerm.ZoneFloorArea = state.dataHeatBal->Zone(CtrlZone).FloorArea * state.dataHeatBal->Zone(CtrlZone).Multiplier * + state.dataHeatBal->Zone(CtrlZone).ListMultiplier; } } } } if (!lAlphaBlanks(7)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OARequirementsPtr = - Util::FindItemInList(Alphas(7), state.dataSize->OARequirements); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OARequirementsPtr == 0) { + airTerm.OARequirementsPtr = Util::FindItemInList(Alphas(7), state.dataSize->OARequirements); + if (airTerm.OARequirementsPtr == 0) { ShowSevereError(state, format("{} = {} not found.", cAlphaFields(7), Alphas(7))); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError(state, format("Occurs in {} = {}", airTerm.sysType, airTerm.SysName)); ErrorsFound = true; } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).NoOAFlowInputFromUser = false; + airTerm.NoOAFlowInputFromUser = false; } } if (lAlphaBlanks(8)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFrac = 1.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchExist = false; - } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchPtr = GetScheduleIndex(state, Alphas(8)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchPtr == 0) { - ShowSevereError(state, format("{} = {} not found.", cAlphaFields(8), Alphas(8))); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ErrorsFound = true; - } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchExist = true; + airTerm.ZoneTurndownMinAirFrac = 1.0; + } else if ((airTerm.zoneTurndownMinAirFracSched = Sched::GetSchedule(state, Alphas(8))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(8), Alphas(8)); + ErrorsFound = true; } // Setup the Average damper Position output variable SetupOutputVariable(state, "Zone Air Terminal VAV Damper Position", Constant::Units::None, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperPosition, + airTerm.DamperPosition, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName); + airTerm.SysName); SetupOutputVariable(state, "Zone Air Terminal Minimum Air Flow Fraction", Constant::Units::None, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracReport, + airTerm.ZoneMinAirFracReport, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName); + airTerm.SysName); } // end Number of Sys Loop @@ -1806,111 +1464,91 @@ void GetSysInput(EnergyPlusData &state) cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; state.dataSingleDuct->SysNumGSI = state.dataSingleDuct->SysIndexGSI + state.dataSingleDuct->NumVAVSysGSI + state.dataSingleDuct->NumCBVAVSysGSI + state.dataSingleDuct->NumConstVolSys + state.dataSingleDuct->NumCVNoReheatSysGSI + state.dataSingleDuct->NumNoRHVAVSysGSI; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysNum = state.dataSingleDuct->SysNumGSI; + auto &airTerm = state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI); + + airTerm.SysNum = state.dataSingleDuct->SysNumGSI; GlobalNames::VerifyUniqueInterObjectName( state, state.dataSingleDuct->SysUniqueNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName = Alphas(1); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType = CurrentModuleObject; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysType_Num = SysType::SingleDuctCBVAVNoReheat; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp = ""; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName = ""; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).Schedule = Alphas(2); + airTerm.SysName = Alphas(1); + airTerm.sysType = CurrentModuleObject; + airTerm.SysType_Num = SysType::SingleDuctCBVAVNoReheat; + airTerm.ReheatComp = ""; + airTerm.ReheatName = ""; + if (lAlphaBlanks(2)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = GetScheduleIndex(state, Alphas(2)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr == 0) { - ShowSevereError(state, format("{} = {} not found.", cAlphaFields(2), Alphas(2))); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ErrorsFound = true; - } + airTerm.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((airTerm.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum = - GetOnlySingleNode(state, - Alphas(3), - ErrorsFound, - DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctVAVHeatAndCoolNoReheat, - Alphas(1), - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Outlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent, - cAlphaFields(3)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum = - GetOnlySingleNode(state, - Alphas(4), - ErrorsFound, - DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctVAVHeatAndCoolNoReheat, - Alphas(1), - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Inlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent, - cAlphaFields(4)); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxAirVolFlowRate = Numbers(1); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = Numbers(2); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes < 0.0) { - ShowWarningError(state, - format("{} = \"{}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + + airTerm.OutletNodeNum = GetOnlySingleNode(state, + Alphas(3), + ErrorsFound, + DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctVAVHeatAndCoolNoReheat, + Alphas(1), + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Outlet, + NodeInputManager::CompFluidStream::Primary, + ObjectIsNotParent, + cAlphaFields(3)); + airTerm.InletNodeNum = GetOnlySingleNode(state, + Alphas(4), + ErrorsFound, + DataLoopNode::ConnectionObjectType::AirTerminalSingleDuctVAVHeatAndCoolNoReheat, + Alphas(1), + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Inlet, + NodeInputManager::CompFluidStream::Primary, + ObjectIsNotParent, + cAlphaFields(4)); + airTerm.MaxAirVolFlowRate = Numbers(1); + airTerm.ZoneMinAirFracDes = Numbers(2); + if (airTerm.ZoneMinAirFracDes < 0.0) { + ShowWarningError(state, format("{} = \"{}", airTerm.sysType, airTerm.SysName)); ShowContinueError(state, format("{} must be greater than or equal to 0. Resetting to 0 and the simulation continues.", cNumericFields(2))); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = 0.0; + airTerm.ZoneMinAirFracDes = 0.0; } - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes > 1.0) { - ShowWarningError(state, - format("{} = \"{}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + if (airTerm.ZoneMinAirFracDes > 1.0) { + ShowWarningError(state, format("{} = \"{}", airTerm.sysType, airTerm.SysName)); ShowContinueError(state, format("{} must be less than or equal to 1. Resetting to 1 and the simulation continues.", cNumericFields(2))); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = 1.0; + airTerm.ZoneMinAirFracDes = 1.0; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatControlNode = 0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatWaterVolFlow = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatSteamVolFlow = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatWaterVolFlow = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatSteamVolFlow = 0.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset = 0.000001; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperHeatingAction = Action::HeatingNotUsed; + airTerm.ReheatControlNode = 0; + airTerm.ReheatAirOutletNode = airTerm.OutletNodeNum; + airTerm.MaxReheatWaterVolFlow = 0.0; + airTerm.MaxReheatSteamVolFlow = 0.0; + airTerm.MinReheatWaterVolFlow = 0.0; + airTerm.MinReheatSteamVolFlow = 0.0; + airTerm.ControllerOffset = 0.000001; + airTerm.DamperHeatingAction = Action::HeatingNotUsed; // Register component set data TestCompSet(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum), - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum), + airTerm.sysType, + airTerm.SysName, + state.dataLoopNodes->NodeID(airTerm.InletNodeNum), + state.dataLoopNodes->NodeID(airTerm.OutletNodeNum), "Air Nodes"); for (ADUNum = 1; ADUNum <= (int)state.dataDefineEquipment->AirDistUnit.size(); ++ADUNum) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum == - state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum) { - state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum = ADUNum; + if (airTerm.OutletNodeNum == state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum) { + state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = airTerm.InletNodeNum; + airTerm.ADUNum = ADUNum; break; } } // one assumes if there isn't one assigned, it's an error? - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum == 0) { + if (airTerm.ADUNum == 0) { ShowSevereError(state, - format("{}No matching Air Distribution Unit, for System = [{},{}].", - RoutineName, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ShowContinueError( - state, - format("...should have outlet node = {}", - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode))); + format("{}No matching Air Distribution Unit, for System = [{},{}].", RoutineName, airTerm.sysType, airTerm.SysName)); + ShowContinueError(state, format("...should have outlet node = {}", state.dataLoopNodes->NodeID(airTerm.ReheatAirOutletNode))); ErrorsFound = true; } else { @@ -1918,64 +1556,45 @@ void GetSysInput(EnergyPlusData &state) for (CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue; for (SupAirIn = 1; SupAirIn <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumInletNodes; ++SupAirIn) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode == - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(SupAirIn)) { + if (airTerm.ReheatAirOutletNode == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(SupAirIn)) { if (state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode > 0) { ShowSevereError(state, "Error in connecting a terminal unit to a zone"); - ShowContinueError(state, - format("{} already connects to another zone", - state.dataLoopNodes->NodeID( - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode))); - ShowContinueError(state, - format("Occurs for terminal unit {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError( + state, format("{} already connects to another zone", state.dataLoopNodes->NodeID(airTerm.ReheatAirOutletNode))); + ShowContinueError(state, format("Occurs for terminal unit {} = {}", airTerm.sysType, airTerm.SysName)); ShowContinueError(state, "Check terminal unit node names for errors"); ErrorsFound = true; } else { - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) - .TermUnitSizingNum = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).TermUnitSizingIndex; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) - .ZoneEqNum = CtrlZone; + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = airTerm.InletNodeNum; + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = airTerm.ReheatAirOutletNode; + state.dataDefineEquipment->AirDistUnit(airTerm.ADUNum).TermUnitSizingNum = + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).TermUnitSizingIndex; + state.dataDefineEquipment->AirDistUnit(airTerm.ADUNum).ZoneEqNum = CtrlZone; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneNum = CtrlZone; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneInNodeIndex = SupAirIn; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneFloorArea = - state.dataHeatBal->Zone(CtrlZone).FloorArea * state.dataHeatBal->Zone(CtrlZone).Multiplier * - state.dataHeatBal->Zone(CtrlZone).ListMultiplier; + airTerm.CtrlZoneNum = CtrlZone; + airTerm.CtrlZoneInNodeIndex = SupAirIn; + airTerm.ZoneFloorArea = state.dataHeatBal->Zone(CtrlZone).FloorArea * state.dataHeatBal->Zone(CtrlZone).Multiplier * + state.dataHeatBal->Zone(CtrlZone).ListMultiplier; } } } } if (lAlphaBlanks(5)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFrac = 1.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchExist = false; - } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchPtr = GetScheduleIndex(state, Alphas(5)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchPtr == 0) { - ShowSevereError(state, format("{} = {} not found.", cAlphaFields(5), Alphas(5))); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ErrorsFound = true; - } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchExist = true; + airTerm.ZoneTurndownMinAirFrac = 1.0; + } else if ((airTerm.zoneTurndownMinAirFracSched = Sched::GetSchedule(state, Alphas(5))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(5), Alphas(5)); + ErrorsFound = true; } // Setup the Average damper Position output variable SetupOutputVariable(state, "Zone Air Terminal VAV Damper Position", Constant::Units::None, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperPosition, + airTerm.DamperPosition, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName); + airTerm.SysName); } // end Number of VAVHeatandCool:NoReheat Sys Loop @@ -2004,80 +1623,43 @@ void GetSysInput(EnergyPlusData &state) state.dataSingleDuct->NumCBVAVSysGSI + state.dataSingleDuct->NumConstVolSys + state.dataSingleDuct->NumCVNoReheatSysGSI + state.dataSingleDuct->NumNoRHVAVSysGSI + state.dataSingleDuct->NumNoRHCBVAVSysGSI; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysNum = state.dataSingleDuct->SysNumGSI; + auto &airTerm = state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI); + airTerm.SysNum = state.dataSingleDuct->SysNumGSI; GlobalNames::VerifyUniqueInterObjectName( state, state.dataSingleDuct->SysUniqueNames, Alphas(1), CurrentModuleObject, cAlphaFields(1), ErrorsFound); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName = Alphas(1); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType = CurrentModuleObject; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysType_Num = SysType::SingleDuctVAVReheatVSFan; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp = Alphas(7); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName = Alphas(8); + airTerm.SysName = Alphas(1); + airTerm.sysType = CurrentModuleObject; + airTerm.SysType_Num = SysType::SingleDuctVAVReheatVSFan; + airTerm.ReheatComp = Alphas(7); + airTerm.ReheatName = Alphas(8); IsNotOK = false; - if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Fuel")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::Gas; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode = - GetHeatingCoilOutletNode(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatCoilMaxCapacity = - GetHeatingCoilCapacity(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); - if (IsNotOK) - ShowContinueError(state, - format("Occurs for terminal unit {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - } else if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Electric")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::Electric; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode = - GetHeatingCoilOutletNode(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatCoilMaxCapacity = - GetHeatingCoilCapacity(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); - if (IsNotOK) - ShowContinueError(state, - format("Occurs for terminal unit {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - } else if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Water")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::SimpleHeating; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_PlantType = - DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; - } else if (Util::SameString(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, "Coil:Heating:Steam")) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num = HeatingCoilType::SteamAirHeating; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_PlantType = - DataPlant::PlantEquipmentType::CoilSteamAirHeating; - } else if (!state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp.empty()) { - ShowSevereError( - state, format("Illegal {} = {}.", cAlphaFields(7), state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp)); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + if (Util::SameString(airTerm.ReheatComp, "Coil:Heating:Fuel")) { + airTerm.ReheatComp_Num = HeatingCoilType::Gas; + airTerm.ReheatAirOutletNode = GetHeatingCoilOutletNode(state, airTerm.ReheatComp, airTerm.ReheatName, IsNotOK); + airTerm.ReheatCoilMaxCapacity = GetHeatingCoilCapacity(state, airTerm.ReheatComp, airTerm.ReheatName, IsNotOK); + if (IsNotOK) ShowContinueError(state, format("Occurs for terminal unit {} = {}", airTerm.sysType, airTerm.SysName)); + } else if (Util::SameString(airTerm.ReheatComp, "Coil:Heating:Electric")) { + airTerm.ReheatComp_Num = HeatingCoilType::Electric; + airTerm.ReheatAirOutletNode = GetHeatingCoilOutletNode(state, airTerm.ReheatComp, airTerm.ReheatName, IsNotOK); + airTerm.ReheatCoilMaxCapacity = GetHeatingCoilCapacity(state, airTerm.ReheatComp, airTerm.ReheatName, IsNotOK); + if (IsNotOK) ShowContinueError(state, format("Occurs for terminal unit {} = {}", airTerm.sysType, airTerm.SysName)); + } else if (Util::SameString(airTerm.ReheatComp, "Coil:Heating:Water")) { + airTerm.ReheatComp_Num = HeatingCoilType::SimpleHeating; + airTerm.ReheatComp_PlantType = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; + } else if (Util::SameString(airTerm.ReheatComp, "Coil:Heating:Steam")) { + airTerm.ReheatComp_Num = HeatingCoilType::SteamAirHeating; + airTerm.ReheatComp_PlantType = DataPlant::PlantEquipmentType::CoilSteamAirHeating; + } else if (!airTerm.ReheatComp.empty()) { + ShowSevereError(state, format("Illegal {} = {}.", cAlphaFields(7), airTerm.ReheatComp)); + ShowContinueError(state, format("Occurs in {} = {}", airTerm.sysType, airTerm.SysName)); ErrorsFound = true; } - ValidateComponent(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType); + ValidateComponent(state, airTerm.ReheatComp, airTerm.ReheatName, IsNotOK, airTerm.sysType); if (IsNotOK) { - ShowContinueError(state, - format("In {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError(state, format("In {} = {}", airTerm.sysType, airTerm.SysName)); ErrorsFound = true; } - auto &airTerm = state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI); airTerm.fanType = static_cast(getEnumValue(HVAC::fanTypeNamesUC, Alphas(5))); if (airTerm.fanType != HVAC::FanType::VAV && airTerm.fanType != HVAC::FanType::SystemModel) { @@ -2100,40 +1682,28 @@ void GetSysInput(EnergyPlusData &state) dynamic_cast(state.dataFans->fans(airTerm.Fan_Index))->isSecondaryDriver = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).Schedule = Alphas(2); if (lAlphaBlanks(2)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr = GetScheduleIndex(state, Alphas(2)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SchedPtr == 0) { - ShowSevereError(state, format("{} = {} not found.", cAlphaFields(2), Alphas(2))); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ErrorsFound = true; - } + airTerm.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((airTerm.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } - AirTermSysInletNodeName = state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum); + AirTermSysInletNodeName = state.dataLoopNodes->NodeID(airTerm.InletNodeNum); if (!Util::SameString(Alphas(3), AirTermSysInletNodeName)) { ShowWarningError(state, - format("{}Invalid air terminal object air inlet node name in {} = {}", - RoutineName, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + format("{}Invalid air terminal object air inlet node name in {} = {}", RoutineName, airTerm.sysType, airTerm.SysName)); ShowContinueError(state, format(" Specified air inlet node name is = {}.", Alphas(3))); ShowContinueError(state, format(" Expected air inlet node name is = {}.", AirTermSysInletNodeName)); // ErrorsFound = true; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxAirVolFlowRate = Numbers(1); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxHeatAirVolFlowRate = Numbers(2); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneMinAirFracDes = Numbers(3); + airTerm.MaxAirVolFlowRate = Numbers(1); + airTerm.MaxHeatAirVolFlowRate = Numbers(2); + airTerm.ZoneMinAirFracDes = Numbers(3); // The reheat coil control node is necessary for hot water reheat, but not necessary for // electric or gas reheat. - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::Gas || - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::Electric) { + if (airTerm.ReheatComp_Num == HeatingCoilType::Gas || airTerm.ReheatComp_Num == HeatingCoilType::Electric) { // IF(.NOT. lAlphaBlanks(6)) THEN // CALL ShowWarningError(state, 'In '//TRIM(sd_airterminal(SysNum)%SysType)//' = ' // TRIM(sd_airterminal(SysNum)%SysName) & // // ' the '//TRIM(cAlphaFields(6))//' is not needed and will be ignored.') @@ -2145,18 +1715,11 @@ void GetSysInput(EnergyPlusData &state) // // ' the '//TRIM(cAlphaFields(6))//' is undefined') // ErrorsFound=.TRUE. // END IF - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::SteamAirHeating) { + if (airTerm.ReheatComp_Num == HeatingCoilType::SteamAirHeating) { IsNotOK = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatControlNode = - GetCoilSteamInletNode(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); + airTerm.ReheatControlNode = GetCoilSteamInletNode(state, airTerm.ReheatComp, airTerm.ReheatName, IsNotOK); if (IsNotOK) { - ShowContinueError(state, - format("..Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError(state, format("..Occurs in {} = {}", airTerm.sysType, airTerm.SysName)); ErrorsFound = true; } else { // A4, \field Unit supply air outlet node @@ -2164,16 +1727,9 @@ void GetSysInput(EnergyPlusData &state) // \note same as zone inlet node // \type alpha IsNotOK = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode = - GetCoilAirOutletNode(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); + airTerm.ReheatAirOutletNode = GetCoilAirOutletNode(state, airTerm.ReheatComp, airTerm.ReheatName, IsNotOK); if (IsNotOK) { - ShowContinueError(state, - format("..Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError(state, format("..Occurs in {} = {}", airTerm.sysType, airTerm.SysName)); ErrorsFound = true; } } @@ -2181,16 +1737,9 @@ void GetSysInput(EnergyPlusData &state) // DataLoopNode::NodeFluidType::Steam,DataLoopNode::NodeConnectionType::Actuator,1,ObjectIsParent) } else { IsNotOK = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatControlNode = - GetCoilWaterInletNode(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); + airTerm.ReheatControlNode = GetCoilWaterInletNode(state, airTerm.ReheatComp, airTerm.ReheatName, IsNotOK); if (IsNotOK) { - ShowContinueError(state, - format("..Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError(state, format("..Occurs in {} = {}", airTerm.sysType, airTerm.SysName)); ErrorsFound = true; } else { // A4, \field Unit supply air outlet node @@ -2198,16 +1747,9 @@ void GetSysInput(EnergyPlusData &state) // \note same as zone inlet node // \type alpha IsNotOK = false; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode = - GetCoilOutletNode(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatName, - IsNotOK); + airTerm.ReheatAirOutletNode = GetCoilOutletNode(state, airTerm.ReheatComp, airTerm.ReheatName, IsNotOK); if (IsNotOK) { - ShowContinueError(state, - format("..Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError(state, format("..Occurs in {} = {}", airTerm.sysType, airTerm.SysName)); ErrorsFound = true; } } @@ -2222,61 +1764,49 @@ void GetSysInput(EnergyPlusData &state) // sd_airterminal(SysNum)%ReheatAirOutletNode = & // GetOnlySingleNode(state, Alphas(4),ErrorsFound,sd_airterminal(SysNum)%SysType,Alphas(1), & // DataLoopNode::NodeFluidType::Air,DataLoopNode::NodeConnectionType::Outlet,1,ObjectIsParent) - AirTermSysOutletNodeName = - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode); + AirTermSysOutletNodeName = state.dataLoopNodes->NodeID(airTerm.ReheatAirOutletNode); if (!Util::SameString(Alphas(4), AirTermSysOutletNodeName)) { ShowWarningError(state, - format("{}Invalid air terminal object air outlet node name in {} = {}", - RoutineName, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + format("{}Invalid air terminal object air outlet node name in {} = {}", RoutineName, airTerm.sysType, airTerm.SysName)); ShowContinueError(state, format(" Specified air outlet node name is = {}.", Alphas(4))); ShowContinueError(state, format(" Expected air outlet node name is = {}.", AirTermSysOutletNodeName)); // ErrorsFound = true; } - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatComp_Num == HeatingCoilType::SteamAirHeating) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatSteamVolFlow = Numbers(4); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatSteamVolFlow = Numbers(5); + if (airTerm.ReheatComp_Num == HeatingCoilType::SteamAirHeating) { + airTerm.MaxReheatSteamVolFlow = Numbers(4); + airTerm.MinReheatSteamVolFlow = Numbers(5); } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MaxReheatWaterVolFlow = Numbers(4); - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).MinReheatWaterVolFlow = Numbers(5); + airTerm.MaxReheatWaterVolFlow = Numbers(4); + airTerm.MinReheatWaterVolFlow = Numbers(5); } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset = Numbers(6); + airTerm.ControllerOffset = Numbers(6); // Set default convergence tolerance - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset <= 0.0) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ControllerOffset = 0.001; + if (airTerm.ControllerOffset <= 0.0) { + airTerm.ControllerOffset = 0.001; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperHeatingAction = Action::HeatingNotUsed; + airTerm.DamperHeatingAction = Action::HeatingNotUsed; // Register component set data TestCompSet(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum), - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode), + airTerm.sysType, + airTerm.SysName, + state.dataLoopNodes->NodeID(airTerm.InletNodeNum), + state.dataLoopNodes->NodeID(airTerm.ReheatAirOutletNode), "Air Nodes"); for (ADUNum = 1; ADUNum <= (int)state.dataDefineEquipment->AirDistUnit.size(); ++ADUNum) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode == - state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum) { - state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum = ADUNum; + if (airTerm.ReheatAirOutletNode == state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum) { + state.dataDefineEquipment->AirDistUnit(ADUNum).InletNodeNum = airTerm.InletNodeNum; + airTerm.ADUNum = ADUNum; break; } } // one assumes if there isn't one assigned, it's an error? - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum == 0) { + if (airTerm.ADUNum == 0) { ShowSevereError(state, - format("{}No matching Air Distribution Unit, for System = [{},{}].", - RoutineName, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ShowContinueError( - state, - format("...should have outlet node = {}", - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode))); + format("{}No matching Air Distribution Unit, for System = [{},{}].", RoutineName, airTerm.sysType, airTerm.SysName)); + ShowContinueError(state, format("...should have outlet node = {}", state.dataLoopNodes->NodeID(airTerm.ReheatAirOutletNode))); ErrorsFound = true; } else { @@ -2286,89 +1816,67 @@ void GetSysInput(EnergyPlusData &state) for (CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue; for (SupAirIn = 1; SupAirIn <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumInletNodes; ++SupAirIn) { - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode == - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(SupAirIn)) { + if (airTerm.ReheatAirOutletNode == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(SupAirIn)) { IsNotOK = false; if (state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode > 0) { ShowSevereError(state, "Error in connecting a terminal unit to a zone"); - ShowContinueError(state, - format("{} already connects to another zone", - state.dataLoopNodes->NodeID( - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode))); - ShowContinueError(state, - format("Occurs for terminal unit {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError( + state, format("{} already connects to another zone", state.dataLoopNodes->NodeID(airTerm.ReheatAirOutletNode))); + ShowContinueError(state, format("Occurs for terminal unit {} = {}", airTerm.sysType, airTerm.SysName)); ShowContinueError(state, "Check terminal unit node names for errors"); ErrorsFound = true; } else { - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum; - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) - .TermUnitSizingNum = state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).TermUnitSizingIndex; - state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ADUNum) - .ZoneEqNum = CtrlZone; + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).InNode = airTerm.InletNodeNum; + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).OutNode = airTerm.ReheatAirOutletNode; + state.dataDefineEquipment->AirDistUnit(airTerm.ADUNum).TermUnitSizingNum = + state.dataZoneEquip->ZoneEquipConfig(CtrlZone).AirDistUnitCool(SupAirIn).TermUnitSizingIndex; + state.dataDefineEquipment->AirDistUnit(airTerm.ADUNum).ZoneEqNum = CtrlZone; } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneNum = CtrlZone; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).CtrlZoneInNodeIndex = SupAirIn; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneFloorArea = - state.dataHeatBal->Zone(CtrlZone).FloorArea * state.dataHeatBal->Zone(CtrlZone).Multiplier * - state.dataHeatBal->Zone(CtrlZone).ListMultiplier; + airTerm.CtrlZoneNum = CtrlZone; + airTerm.CtrlZoneInNodeIndex = SupAirIn; + airTerm.ZoneFloorArea = state.dataHeatBal->Zone(CtrlZone).FloorArea * state.dataHeatBal->Zone(CtrlZone).Multiplier * + state.dataHeatBal->Zone(CtrlZone).ListMultiplier; } } } } if (IsNotOK) { ShowWarningError(state, "Did not Match Supply Air Outlet Node to any Zone Node"); - ShowContinueError(state, - format("..Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); + ShowContinueError(state, format("..Occurs in {} = {}", airTerm.sysType, airTerm.SysName)); } if (lAlphaBlanks(9)) { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFrac = 1.0; - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchExist = false; - } else { - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchPtr = GetScheduleIndex(state, Alphas(9)); - if (state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchPtr == 0) { - ShowSevereError(state, format("{} = {} not found.", cAlphaFields(9), Alphas(9))); - ShowContinueError(state, - format("Occurs in {} = {}", - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName)); - ErrorsFound = true; - } - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ZoneTurndownMinAirFracSchExist = true; + airTerm.ZoneTurndownMinAirFrac = 1.0; + } else if ((airTerm.zoneTurndownMinAirFracSched = Sched::GetSchedule(state, Alphas(9))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(9), Alphas(9)); + ErrorsFound = true; } // Add reheat coil to component sets array SetUpCompSets(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, + airTerm.sysType, + airTerm.SysName, Alphas(7), Alphas(8), - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum), - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).ReheatAirOutletNode)); + state.dataLoopNodes->NodeID(airTerm.OutletNodeNum), + state.dataLoopNodes->NodeID(airTerm.ReheatAirOutletNode)); // Add fan to component sets array SetUpCompSets(state, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).sysType, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName, + airTerm.sysType, + airTerm.SysName, Alphas(5), Alphas(6), - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).InletNodeNum), - state.dataLoopNodes->NodeID(state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).OutletNodeNum)); + state.dataLoopNodes->NodeID(airTerm.InletNodeNum), + state.dataLoopNodes->NodeID(airTerm.OutletNodeNum)); // Setup the Average damper Position output variable SetupOutputVariable(state, "Zone Air Terminal VAV Damper Position", Constant::Units::None, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).DamperPosition, + airTerm.DamperPosition, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataSingleDuct->sd_airterminal(state.dataSingleDuct->SysNumGSI).SysName); + airTerm.SysName); } // common report variable for all single duct air terminals @@ -2434,8 +1942,6 @@ void SingleDuctAirTerminal::InitSys(EnergyPlusData &state, bool const FirstHVACI // SUBROUTINE INFORMATION: // AUTHOR Richard J. Liesen // DATE WRITTEN January 2000 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine is for initializations of the Sys Components. @@ -2457,10 +1963,6 @@ void SingleDuctAirTerminal::InitSys(EnergyPlusData &state, bool const FirstHVACI // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int InletNode; int OutletNode; - int SysIndex; - // static Array1D_bool MyEnvrnFlag; - // static Array1D_bool MySizeFlag; - // static Array1D_bool GetGasElecHeatCoilCap; // Gets autosized value of coil capacity Real64 SteamTemp; Real64 SteamDensity; Real64 rho; @@ -2469,19 +1971,6 @@ void SingleDuctAirTerminal::InitSys(EnergyPlusData &state, bool const FirstHVACI // static Array1D_bool PlantLoopScanFlag; // Do the Begin Simulation initializations - if (state.dataSingleDuct->InitSysFlag) { - - // MyEnvrnFlag.allocate(NumSDAirTerminal); - // MySizeFlag.allocate(NumSDAirTerminal); - // PlantLoopScanFlag.allocate(NumSDAirTerminal); - // GetGasElecHeatCoilCap.allocate(NumSDAirTerminal); - // MyEnvrnFlag = true; - // MySizeFlag = true; - // PlantLoopScanFlag = true; - // GetGasElecHeatCoilCap = true; - state.dataSingleDuct->InitSysFlag = false; - } - if (this->PlantLoopScanFlag && allocated(state.dataPlnt->PlantLoop)) { if ((this->ReheatComp_PlantType == DataPlant::PlantEquipmentType::CoilWaterSimpleHeating) || (this->ReheatComp_PlantType == DataPlant::PlantEquipmentType::CoilSteamAirHeating)) { @@ -2507,7 +1996,7 @@ void SingleDuctAirTerminal::InitSys(EnergyPlusData &state, bool const FirstHVACI if (!state.dataSingleDuct->ZoneEquipmentListChecked && state.dataZoneEquip->ZoneEquipInputsFilled) { state.dataSingleDuct->ZoneEquipmentListChecked = true; // Check to see if there is a Air Distribution Unit on the Zone Equipment List - for (SysIndex = 1; SysIndex <= state.dataSingleDuct->NumSDAirTerminal; ++SysIndex) { + for (int SysIndex = 1; SysIndex <= state.dataSingleDuct->NumSDAirTerminal; ++SysIndex) { if (state.dataSingleDuct->sd_airterminal(SysIndex).ADUNum == 0) continue; if (CheckZoneEquipmentList(state, "ZoneHVAC:AirDistributionUnit", @@ -2524,8 +2013,8 @@ void SingleDuctAirTerminal::InitSys(EnergyPlusData &state, bool const FirstHVACI } // get current time step air terminal box turndown minimum flow fraction - if (this->ZoneTurndownMinAirFracSchExist) { - this->ZoneTurndownMinAirFrac = ScheduleManager::GetCurrentScheduleValue(state, this->ZoneTurndownMinAirFracSchPtr); + if (this->zoneTurndownMinAirFracSched != nullptr) { + this->ZoneTurndownMinAirFrac = this->zoneTurndownMinAirFracSched->getCurrentVal(); } else { this->ZoneTurndownMinAirFrac = 1.0; } @@ -2565,11 +2054,7 @@ void SingleDuctAirTerminal::InitSys(EnergyPlusData &state, bool const FirstHVACI this->MassFlowDiff = 1.0e-10 * this->AirMassFlowRateMax; if (this->HWplantLoc.loopNum > 0 && this->ReheatComp_Num != HeatingCoilType::SteamAirHeating) { // protect early calls before plant is setup - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->HWplantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->HWplantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->HWplantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); } else { rho = 1000.0; } @@ -2583,21 +2068,21 @@ void SingleDuctAirTerminal::InitSys(EnergyPlusData &state, bool const FirstHVACI if (this->ReheatComp_Num == HeatingCoilType::SteamAirHeating) { SteamTemp = 100.0; - SteamDensity = FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, SteamTemp, 1.0, this->FluidIndex, RoutineNameFull); + SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, SteamTemp, 1.0, RoutineNameFull); this->MaxReheatSteamFlow = SteamDensity * this->MaxReheatSteamVolFlow; this->MinReheatSteamFlow = SteamDensity * this->MinReheatSteamVolFlow; } // get current environment air terminal box turndown minimum flow fraction Real64 CurrentEnvZoneTurndownMinAirFrac = 1.0; - if (this->ZoneTurndownMinAirFracSchExist) { - CurrentEnvZoneTurndownMinAirFrac = ScheduleManager::GetScheduleMinValue(state, this->ZoneTurndownMinAirFracSchPtr); + if (this->zoneTurndownMinAirFracSched != nullptr) { + CurrentEnvZoneTurndownMinAirFrac = this->zoneTurndownMinAirFracSched->getCurrentVal(); } if ((this->SysType_Num == SysType::SingleDuctVAVReheat || this->SysType_Num == SysType::SingleDuctCBVAVReheat) || (this->SysType_Num == SysType::SingleDuctCBVAVNoReheat)) { // need the lowest schedule value if (this->ZoneMinAirFracMethod == MinFlowFraction::Scheduled) { - this->ZoneMinAirFracDes = GetScheduleMinValue(state, this->ZoneMinAirFracSchPtr); + this->ZoneMinAirFracDes = this->zoneMinAirFracSched->getCurrentVal(); } state.dataLoopNodes->Node(OutletNode).MassFlowRateMin = state.dataLoopNodes->Node(OutletNode).MassFlowRateMax * this->ZoneMinAirFracDes * CurrentEnvZoneTurndownMinAirFrac; @@ -2656,21 +2141,21 @@ void SingleDuctAirTerminal::InitSys(EnergyPlusData &state, bool const FirstHVACI } if (this->ZoneMinAirFracMethod == MinFlowFraction::Scheduled) { - this->ZoneMinAirFracDes = GetCurrentScheduleValue(state, this->ZoneMinAirFracSchPtr); + this->ZoneMinAirFracDes = this->zoneMinAirFracSched->getCurrentVal(); // now reset inlet node min avail state.dataLoopNodes->Node(InletNode).MassFlowRateMinAvail = this->AirMassFlowRateMax * this->ZoneMinAirFracDes * this->ZoneTurndownMinAirFrac; } if (FirstHVACIteration) { // The first time through set the mass flow rate to the Max - if ((state.dataLoopNodes->Node(InletNode).MassFlowRate > 0.0) && (GetCurrentScheduleValue(state, this->SchedPtr) > 0.0)) { + if ((state.dataLoopNodes->Node(InletNode).MassFlowRate > 0.0) && (this->availSched->getCurrentVal() > 0.0)) { if (!(state.afn->distribution_simulated && state.afn->AirflowNetworkFanActivated)) { state.dataLoopNodes->Node(InletNode).MassFlowRate = this->AirMassFlowRateMax; } } else { state.dataLoopNodes->Node(InletNode).MassFlowRate = 0.0; } - if ((state.dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail > 0.0) && (GetCurrentScheduleValue(state, this->SchedPtr) > 0.0)) { + if ((state.dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail > 0.0) && (this->availSched->getCurrentVal() > 0.0)) { if (!(state.afn->distribution_simulated && state.afn->AirflowNetworkFanActivated)) { if (this->SysType_Num == SysType::SingleDuctConstVolNoReheat) { if (this->NoOAFlowInputFromUser) { @@ -2692,7 +2177,7 @@ void SingleDuctAirTerminal::InitSys(EnergyPlusData &state, bool const FirstHVACI state.dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail = 0.0; } - if ((state.dataLoopNodes->Node(InletNode).MassFlowRate > 0.0) && (GetCurrentScheduleValue(state, this->SchedPtr) > 0.0)) { + if ((state.dataLoopNodes->Node(InletNode).MassFlowRate > 0.0) && (this->availSched->getCurrentVal() > 0.0)) { if (!(state.afn->distribution_simulated && state.afn->AirflowNetworkFanActivated)) { state.dataLoopNodes->Node(InletNode).MassFlowRateMinAvail = this->AirMassFlowRateMax * this->ZoneMinAirFracDes * this->ZoneTurndownMinAirFrac; @@ -2709,7 +2194,7 @@ void SingleDuctAirTerminal::InitSys(EnergyPlusData &state, bool const FirstHVACI } else { if (this->SysType_Num == SysType::SingleDuctConstVolNoReheat) { if (!this->EMSOverrideAirFlow) { - if ((state.dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail > 0.0) && (GetCurrentScheduleValue(state, this->SchedPtr) > 0.0)) { + if ((state.dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail > 0.0) && (this->availSched->getCurrentVal() > 0.0)) { if (this->NoOAFlowInputFromUser) { if (state.dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail < state.dataLoopNodes->Node(InletNode).MassFlowRateMax) { state.dataLoopNodes->Node(InletNode).MassFlowRate = state.dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail; @@ -2785,8 +2270,6 @@ void SingleDuctAirTerminal::SizeSys(EnergyPlusData &state) // Obtains flow rates from the zone or system sizing arrays. // Using/Aliasing - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSpecificHeatGlycol; using General::SafeDivide; using PlantUtilities::MyPlantSizingIndex; using SteamCoils::GetCoilSteamInletNode; @@ -2801,63 +2284,38 @@ void SingleDuctAirTerminal::SizeSys(EnergyPlusData &state) // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int PltSizHeatNum; // index of plant sizing object for 1st heating loop - Real64 DesMassFlow; Real64 TempSteamIn; Real64 EnthSteamOutWet; Real64 EnthSteamInDry; Real64 LatentHeatSteam; Real64 SteamDensity; - bool ErrorsFound; bool PlantSizingErrorsFound; Real64 rho; // local fluid density Real64 Cp; // local fluid specific heat - bool IsAutoSize; - bool IsMaxFlowAutoSize; // Indicate if the maximum terminal flow is autosize - int AirLoopNum; // Air loop number - int SysSizNum; // System sizing number - Real64 MinMinFlowRatio(0.0); // the minimum minimum flow ratio - Real64 MaxAirVolFlowRateDes; // Autosized maximum air flow rate for reporting - Real64 MaxAirVolFlowRateUser; // Hardsized maximum air flow rate for reporting - Real64 MaxHeatAirVolFlowRateDes; // Autosized maximum heating air flow rate for reporting - Real64 MaxHeatAirVolFlowRateUser; // Hardsized maximum heating air flow rate for reporting - Real64 MinAirFlowFracDes; // Autosized minimum cooling air flow fraction for reporting - Real64 MinAirFlowFracUser; // User input minimum cooling air flow fraction for reporting - Real64 FixedMinAirDes; // Autosized minimum cooling air flow rate for reporting [m3/s] - Real64 FixedMinAirUser; // User input minimum cooling air flow rate for reporting [m3/s] - Real64 MaxAirVolFlowRateDuringReheatDes; // Autosized maximum air flow durign reheat for reporting - Real64 MaxAirVolFlowRateDuringReheatUser; // Hardsized maximum air flow durign reheat for reporting - Real64 MaxAirVolFractionDuringReheatDes; // Autosized maximum air fraction durign reheat for reporting - Real64 MaxAirVolFractionDuringReheatUser; // Hardsized maximum air flow durign reheat for reporting - Real64 MaxReheatWaterVolFlowDes; // Autosized reheat water flow or reporting - Real64 MaxReheatWaterVolFlowUser; // Hardsized reheat water flow for reporting - Real64 MaxReheatSteamVolFlowDes; // Autosized reheat steam flow for reporting - Real64 MaxReheatSteamVolFlowUser; // Hardsized reheat steam flow for reporting - - PltSizHeatNum = 0; - DesMassFlow = 0.0; - ErrorsFound = false; - IsAutoSize = false; - IsMaxFlowAutoSize = false; - MaxAirVolFlowRateDes = 0.0; - MaxAirVolFlowRateUser = 0.0; - MaxHeatAirVolFlowRateDes = 0.0; - MaxHeatAirVolFlowRateUser = 0.0; - MinAirFlowFracDes = 0.0; - MinAirFlowFracUser = 0.0; - FixedMinAirDes = 0.0; - FixedMinAirUser = 0.0; - MaxAirVolFlowRateDuringReheatDes = 0.0; - MaxAirVolFlowRateDuringReheatUser = 0.0; - MaxAirVolFractionDuringReheatDes = 0.0; - MaxAirVolFractionDuringReheatUser = 0.0; - MaxReheatWaterVolFlowDes = 0.0; - MaxReheatWaterVolFlowUser = 0.0; - MaxReheatSteamVolFlowDes = 0.0; - MaxReheatSteamVolFlowUser = 0.0; - MinMinFlowRatio = 0.0; - AirLoopNum = 0; - SysSizNum = 0; + + Real64 DesMassFlow = 0.0; + bool ErrorsFound = false; + bool IsAutoSize = false; + bool IsMaxFlowAutoSize = false; + Real64 MaxAirVolFlowRateDes = 0.0; // Autosized maximum air flow rate for reporting + Real64 MaxAirVolFlowRateUser = 0.0; // Hardsized maximum air flow rate for reporting + Real64 MaxHeatAirVolFlowRateDes = 0.0; // Autosized maximum heating air flow rate for reporting + Real64 MaxHeatAirVolFlowRateUser = 0.0; // Hardsized maximum heating air flow rate for reporting + Real64 MinAirFlowFracDes = 0.0; // Autosized minimum cooling air flow fraction for reporting + Real64 MinAirFlowFracUser = 0.0; // User input minimum cooling air flow fraction for reporting + Real64 FixedMinAirDes = 0.0; // Autosized minimum cooling air flow rate for reporting [m3/s] + Real64 FixedMinAirUser = 0.0; // User input minimum cooling air flow rate for reporting [m3/s] + Real64 MaxAirVolFlowRateDuringReheatDes = 0.0; // Autosized maximum air flow durign reheat for reporting + Real64 MaxAirVolFlowRateDuringReheatUser = 0.0; // Hardsized maximum air flow durign reheat for reporting + Real64 MaxAirVolFractionDuringReheatDes = 0.0; // Autosized maximum air fraction durign reheat for reporting + Real64 MaxAirVolFractionDuringReheatUser = 0.0; // Hardsized maximum air flow durign reheat for reporting + Real64 MaxReheatWaterVolFlowDes = 0.0; // Autosized reheat water flow or reporting + Real64 MaxReheatWaterVolFlowUser = 0.0; // Hardsized reheat water flow for reporting + Real64 MaxReheatSteamVolFlowDes = 0.0; // Autosized reheat steam flow for reporting + Real64 MaxReheatSteamVolFlowUser = 0.0; // Hardsized reheat steam flow for reporting + Real64 MinMinFlowRatio = 0.0; // the minimum minimum flow ratio + int SysSizNum = 0; // System sizing number int ZoneNum = this->CtrlZoneNum; @@ -2980,8 +2438,8 @@ void SingleDuctAirTerminal::SizeSys(EnergyPlusData &state) } // get design day terminal unit turndown minimum flow fraction - if (this->ZoneTurndownMinAirFracSchExist) { - this->ZoneTurndownMinAirFrac = ScheduleManager::GetCurrentScheduleValue(state, this->ZoneTurndownMinAirFracSchPtr); + if (this->zoneTurndownMinAirFracSched != nullptr) { + this->ZoneTurndownMinAirFrac = this->zoneTurndownMinAirFracSched->getCurrentVal(); } else { this->ZoneTurndownMinAirFrac = 1.0; } @@ -2989,7 +2447,7 @@ void SingleDuctAirTerminal::SizeSys(EnergyPlusData &state) // if a sizing run has been done, check if system sizing has been done for this system bool SizingDesRunThisAirSys = false; if (state.dataSize->SysSizingRunDone) { - AirLoopNum = state.dataZoneEquip->ZoneEquipConfig(this->CtrlZoneNum).InletNodeAirLoopNum(this->CtrlZoneInNodeIndex); + int AirLoopNum = state.dataZoneEquip->ZoneEquipConfig(this->CtrlZoneNum).InletNodeAirLoopNum(this->CtrlZoneInNodeIndex); if (AirLoopNum > 0) { CheckThisAirSystemForSizing(state, AirLoopNum, SizingDesRunThisAirSys); } @@ -3214,8 +2672,7 @@ void SingleDuctAirTerminal::SizeSys(EnergyPlusData &state) this->ZoneMinAirFracDes = min(1.0, SafeDivide(this->DesignFixedMinAir, this->MaxAirVolFlowRate)); } else { // use an average of min and max in schedule - this->ZoneMinAirFracDes = - (GetScheduleMinValue(state, this->ZoneMinAirFracSchPtr) + GetScheduleMaxValue(state, this->ZoneMinAirFracSchPtr)) / 2.0; + this->ZoneMinAirFracDes = (this->zoneMinAirFracSched->getMinVal(state) + this->zoneMinAirFracSched->getMaxVal(state)) / 2.0; } } @@ -3542,17 +2999,11 @@ void SingleDuctAirTerminal::SizeSys(EnergyPlusData &state) (state.dataSingleDuct->ZoneDesTempSS - state.dataSingleDuct->CoilInTempSS); if (state.dataSingleDuct->DesCoilLoadSS >= SmallLoad) { - rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->HWplantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->HWplantLoc.loopNum).FluidIndex, - RoutineName); + rho = + state.dataPlnt->PlantLoop(this->HWplantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); - Cp = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->HWplantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->HWplantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(this->HWplantLoc.loopNum) + .glycol->getSpecificHeat(state, Constant::HWInitConvTemp, RoutineName); MaxReheatWaterVolFlowDes = state.dataSingleDuct->DesCoilLoadSS / (state.dataSize->PlantSizData(PltSizHeatNum).DeltaT * Cp * rho); @@ -3564,8 +3015,6 @@ void SingleDuctAirTerminal::SizeSys(EnergyPlusData &state) ShowContinueError(state, format("Occurs in AirTerminal Object={}", this->SysName)); ErrorsFound = true; } - } - if (IsAutoSize) { this->MaxReheatWaterVolFlow = MaxReheatWaterVolFlowDes; BaseSizer::reportSizerOutput( state, this->sysType, this->SysName, "Design Size Maximum Reheat Water Flow Rate [m3/s]", MaxReheatWaterVolFlowDes); @@ -3661,19 +3110,13 @@ void SingleDuctAirTerminal::SizeSys(EnergyPlusData &state) (state.dataSingleDuct->ZoneDesTempSS - state.dataSingleDuct->CoilInTempSS); if (state.dataSingleDuct->DesCoilLoadSS >= SmallLoad) { TempSteamIn = 100.00; - EnthSteamInDry = - FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, TempSteamIn, 1.0, this->FluidIndex, RoutineNameFull); - EnthSteamOutWet = - FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, TempSteamIn, 0.0, this->FluidIndex, RoutineNameFull); + auto *steam = Fluid::GetSteam(state); + EnthSteamInDry = steam->getSatEnthalpy(state, TempSteamIn, 1.0, RoutineNameFull); + EnthSteamOutWet = steam->getSatEnthalpy(state, TempSteamIn, 0.0, RoutineNameFull); LatentHeatSteam = EnthSteamInDry - EnthSteamOutWet; - SteamDensity = - FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, this->FluidIndex, RoutineNameFull); - - Cp = GetSpecificHeatGlycol(state, - fluidNameWater, - state.dataSize->PlantSizData(PltSizHeatNum).ExitTemp, - state.dataSingleDuct->DummyWaterIndexSS, - RoutineName); + SteamDensity = steam->getSatDensity(state, TempSteamIn, 1.0, RoutineNameFull); + + Cp = Fluid::GetWater(state)->getSpecificHeat(state, state.dataSize->PlantSizData(PltSizHeatNum).ExitTemp, RoutineName); MaxReheatSteamVolFlowDes = state.dataSingleDuct->DesCoilLoadSS / (SteamDensity * (LatentHeatSteam + state.dataSize->PlantSizData(PltSizHeatNum).DeltaT * Cp)); } else { @@ -3684,8 +3127,6 @@ void SingleDuctAirTerminal::SizeSys(EnergyPlusData &state) ShowContinueError(state, format("Occurs in AirTerminal:SingleDuct:ConstantVolume:Reheat Object={}", this->SysName)); ErrorsFound = true; } - } - if (IsAutoSize) { this->MaxReheatSteamVolFlow = MaxReheatSteamVolFlowDes; BaseSizer::reportSizerOutput( state, this->sysType, this->SysName, "Design Size Maximum Reheat Steam Flow Rate [m3/s]", MaxReheatSteamVolFlowDes); @@ -3784,7 +3225,6 @@ void SingleDuctAirTerminal::SimVAV(EnergyPlusData &state, bool const FirstHVACIt // TH 3/2012: added supply air flow adjustment based on zone maximum outdoor // air fraction - a TRACE feature // Brent Griffith, 5/2012, general cleanup, fix negatives CR 8767, fix phantom coil flows CR 8854 - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine simulates the simple single duct volume VAV. @@ -3792,9 +3232,6 @@ void SingleDuctAirTerminal::SimVAV(EnergyPlusData &state, bool const FirstHVACIt // METHODOLOGY EMPLOYED: // There is method to this madness. - // REFERENCES: - // na - // Using/Aliasing using namespace DataZoneEnergyDemands; // unused USE DataHeatBalFanSys, ONLY: Mat @@ -3804,17 +3241,6 @@ void SingleDuctAirTerminal::SimVAV(EnergyPlusData &state, bool const FirstHVACIt using SteamCoils::SimulateSteamCoilComponents; using WaterCoils::SimulateWaterCoilComponents; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 MassFlow; // [kg/sec] Total Mass Flow Rate from Hot & Cold Inlets Real64 QTotLoad; // [Watts] Remaining load required for this zone @@ -3824,7 +3250,6 @@ void SingleDuctAirTerminal::SimVAV(EnergyPlusData &state, bool const FirstHVACIt Real64 DeltaTemp; int SysOutletNode; // The node number of the terminal unit outlet node int SysInletNode; // the node number of the terminal unit inlet node - int WaterControlNode; // This is the Actuated Reheat Control Node Real64 MaxFlowWater; // This is the value passed to the Controller depending if FirstHVACIteration or not Real64 MinFlowWater; // This is the value passed to the Controller depending if FirstHVACIteration or not Real64 QActualHeating; // the heating load seen by the reheat coil @@ -3860,8 +3285,7 @@ void SingleDuctAirTerminal::SimVAV(EnergyPlusData &state, bool const FirstHVACIt // if the massflow is below the minimum or greater than the Max it is set to either the Min // or the Max as specified for the VAV model. if ((QTotLoad < 0.0) && (this->sd_airterminalInlet.AirMassFlowRateMaxAvail > 0.0) && - (state.dataHeatBalFanSys->TempControlType(ZoneNum) != HVAC::ThermostatType::SingleHeating) && - (GetCurrentScheduleValue(state, this->SchedPtr) > 0.0)) { + (state.dataHeatBalFanSys->TempControlType(ZoneNum) != HVAC::SetptType::SingleHeat) && (this->availSched->getCurrentVal() > 0.0)) { // Calculate the flow required for cooling DeltaTemp = CpAirAvg * (this->sd_airterminalInlet.AirTemp - state.dataSingleDuct->ZoneTempSDAT); @@ -3900,8 +3324,8 @@ void SingleDuctAirTerminal::SimVAV(EnergyPlusData &state, bool const FirstHVACIt } } else if ((this->sd_airterminalInlet.AirMassFlowRateMaxAvail > 0.0) && - (QTotLoad >= 0.0 || state.dataHeatBalFanSys->TempControlType(ZoneNum) == HVAC::ThermostatType::SingleHeating) && - (GetCurrentScheduleValue(state, this->SchedPtr) > 0.0)) { + (QTotLoad >= 0.0 || state.dataHeatBalFanSys->TempControlType(ZoneNum) == HVAC::SetptType::SingleHeat) && + (this->availSched->getCurrentVal() > 0.0)) { // IF (sd_airterminal(SysNum)%DamperHeatingAction .EQ. ReverseAction .AND. this->sd_airterminalInlet%AirMassFlowRateMinAvail <= // SmallMassFlow) THEN // special case for heating: reverse action and damper allowed to close - set the minimum flow rate to a small but nonzero value @@ -3988,8 +3412,7 @@ void SingleDuctAirTerminal::SimVAV(EnergyPlusData &state, bool const FirstHVACIt // do the reheat calculation if there's some air nass flow (or the damper action is "reverse action"), the flow is <= minimum , // there's a heating requirement, and there's a thermostat with a heating setpoint // Reverse damper option is working only for water coils for now. - if ((MassFlow > SmallMassFlow) && (QActualHeating > 0.0) && - (state.dataHeatBalFanSys->TempControlType(ZoneNum) != HVAC::ThermostatType::SingleCooling)) { + if ((MassFlow > SmallMassFlow) && (QActualHeating > 0.0) && (state.dataHeatBalFanSys->TempControlType(ZoneNum) != HVAC::SetptType::SingleCool)) { // At this point we know that there is a heating requirement: i.e., the heating coil needs to // be activated (there's a zone heating load or there's a reheat requirement). There are 3 possible // situations: 1) the coil load can be met by variable temperature air (below the max heat temp) at @@ -4068,7 +3491,7 @@ void SingleDuctAirTerminal::SimVAV(EnergyPlusData &state, bool const FirstHVACIt MaxFlowWater = this->MaxReheatWaterFlow; MinFlowWater = this->MinReheatWaterFlow; } else { - WaterControlNode = this->ReheatControlNode; + int WaterControlNode = this->ReheatControlNode; MaxFlowWater = state.dataLoopNodes->Node(WaterControlNode).MassFlowRateMaxAvail; MinFlowWater = state.dataLoopNodes->Node(WaterControlNode).MassFlowRateMinAvail; } @@ -4268,7 +3691,6 @@ void SingleDuctAirTerminal::CalcOAMassFlow(EnergyPlusData &state, // AUTHOR R. Raustad (FSEC) // DATE WRITTEN Jan 2010 // MODIFIED Mangesh Basarkar, 06/2011: Modifying outside air based on airloop DCV flag - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Calculates the amount of outside air required based on optional user input. @@ -4277,26 +3699,12 @@ void SingleDuctAirTerminal::CalcOAMassFlow(EnergyPlusData &state, // METHODOLOGY EMPLOYED: // User input defines method used to calculate OA. - // REFERENCES: - // Using/Aliasing using Psychrometrics::PsyRhoAirFnPbTdbW; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // FUNCTION PARAMETER DEFINITIONS: bool constexpr UseMinOASchFlag(true); // Always use min OA schedule in calculations. - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // FUNCTION LOCAL VARIABLE DECLARATIONS: Real64 OAVolumeFlowRate; // outside air volume flow rate (m3/s) Real64 OAMassFlow; // outside air mass flow rate (kg/s) @@ -4330,18 +3738,11 @@ void SingleDuctAirTerminal::SimCBVAV(EnergyPlusData &state, bool const FirstHVAC // AUTHOR Richard Raustad // DATE WRITTEN August 2006 // MODIFIED KHL/TH 10/2010: added maximum supply air temperature leaving reheat coil - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine simulates the VAV box with varying airflow in heating and cooling. // Modified version of SimVAV. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - // Using/Aliasing using namespace DataZoneEnergyDemands; using HVAC::SmallLoad; @@ -4352,32 +3753,20 @@ void SingleDuctAirTerminal::SimCBVAV(EnergyPlusData &state, bool const FirstHVAC // unused USE DataHeatBalFanSys, ONLY: ZoneThermostatSetPointHi, ZoneThermostatSetPointLo using PlantUtilities::SetActuatedBranchFlowRate; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 MassFlow; // Total Mass Flow Rate from Hot & Cold Inlets [kg/sec] - Real64 QTotLoad; // Total load based on thermostat setpoint temperature [Watts] - Real64 QZnReq; // Total load to be met by terminal heater [Watts] - Real64 QToHeatSetPt; // Remaining load to heating setpoint [W] - Real64 QSupplyAir; // Zone load met by VAVHeatandCool system - Real64 CpAirZn; // Specific heat of zone air [J/kg-C] - Real64 CpAirSysIn; // Specific heat of VAVHeatandCool box entering air [J/kg-C] - Real64 DeltaTemp; // Temperature difference multiplied by specific heat [J/kg] - Real64 MaxFlowWater; // This is the value passed to the Controller depending if FirstHVACIteration or not - Real64 MinFlowWater; // This is the value passed to the Controller depending if FirstHVACIteration or not - Real64 LeakLoadMult; // Load multiplier to adjust for downstream leaks - int SysOutletNode; // The node number of the terminal unit outlet node - int SysInletNode; // The node number of the terminal unit inlet node - int WaterControlNode; // This is the Actuated Reheat Control Node + Real64 MassFlow; // Total Mass Flow Rate from Hot & Cold Inlets [kg/sec] + Real64 QTotLoad; // Total load based on thermostat setpoint temperature [Watts] + Real64 QZnReq; // Total load to be met by terminal heater [Watts] + Real64 QToHeatSetPt; // Remaining load to heating setpoint [W] + Real64 QSupplyAir; // Zone load met by VAVHeatandCool system + Real64 CpAirZn; // Specific heat of zone air [J/kg-C] + Real64 CpAirSysIn; // Specific heat of VAVHeatandCool box entering air [J/kg-C] + Real64 DeltaTemp; // Temperature difference multiplied by specific heat [J/kg] + Real64 MaxFlowWater; // This is the value passed to the Controller depending if FirstHVACIteration or not + Real64 MinFlowWater; // This is the value passed to the Controller depending if FirstHVACIteration or not + Real64 LeakLoadMult; // Load multiplier to adjust for downstream leaks + int SysOutletNode; // The node number of the terminal unit outlet node + int SysInletNode; // The node number of the terminal unit inlet node Real64 DummyMdot; Real64 QActualHeating; Real64 MinFlowFrac; // minimum flow fraction (and minimum damper position) @@ -4447,8 +3836,7 @@ void SingleDuctAirTerminal::SimCBVAV(EnergyPlusData &state, bool const FirstHVAC QActualHeating = QToHeatSetPt - MassFlow * CpAirZn * (this->sd_airterminalInlet.AirTemp - state.dataSingleDuct->ZoneTempSCBVAV); - if ((MassFlow > SmallMassFlow) && (QActualHeating > 0.0) && - (state.dataHeatBalFanSys->TempControlType(ZoneNum) != HVAC::ThermostatType::SingleCooling)) { + if ((MassFlow > SmallMassFlow) && (QActualHeating > 0.0) && (state.dataHeatBalFanSys->TempControlType(ZoneNum) != HVAC::SetptType::SingleCool)) { // VAVHeatandCool boxes operate at varying mass flow rates when reheating, VAV boxes operate at min flow // (MassFlow <= this->sd_airterminalInlet%AirMassFlowRateMinAvail) .AND. & // Per Fred Buhl, don't use DeadBandOrSetback to determine if heaters operate @@ -4523,7 +3911,7 @@ void SingleDuctAirTerminal::SimCBVAV(EnergyPlusData &state, bool const FirstHVAC MaxFlowWater = this->MaxReheatWaterFlow; MinFlowWater = this->MinReheatWaterFlow; } else { - WaterControlNode = this->ReheatControlNode; + int WaterControlNode = this->ReheatControlNode; MaxFlowWater = state.dataLoopNodes->Node(WaterControlNode).MassFlowRateMaxAvail; MinFlowWater = state.dataLoopNodes->Node(WaterControlNode).MassFlowRateMinAvail; } @@ -4692,8 +4080,6 @@ void SingleDuctAirTerminal::SimVAVVS(EnergyPlusData &state, bool const FirstHVAC // SUBROUTINE INFORMATION: // AUTHOR Fred Buhl // DATE WRITTEN July 2004 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine simulates a single duct VAV terminal unit with a variable-speed fan upstream @@ -4736,7 +4122,6 @@ void SingleDuctAirTerminal::SimVAVVS(EnergyPlusData &state, bool const FirstHVAC Real64 QNoHeatFanOff; // min heating - fan off, hot water at min flow [W] HeatingCoilType HCType; // heating coil type HVAC::FanType fanType; // fan type (as a number) - Real64 HCLoad; // load passed to a gas or electric heating coil [W] int FanOp; // 1 if fan is on; 0 if off. Real64 MaxCoolMassFlow; // air flow at max cooling [kg/s] Real64 MaxHeatMassFlow; // air flow at max heating [kg/s] @@ -4747,7 +4132,6 @@ void SingleDuctAirTerminal::SimVAVVS(EnergyPlusData &state, bool const FirstHVAC int SolFlag; Real64 ErrTolerance; Real64 MaxSteamCap; // steam coil capacity at full load - bool ErrorsFound; // returned from mining function call // The calculated load from the Heat Balance QTotLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).RemainingOutputRequired; @@ -4771,7 +4155,6 @@ void SingleDuctAirTerminal::SimVAVVS(EnergyPlusData &state, bool const FirstHVAC if (HCType == HeatingCoilType::SimpleHeating) { WaterControlNode = this->ReheatControlNode; - HCLoad = 0.0; if (FirstHVACIteration) { MaxFlowWater = this->MaxReheatWaterFlow; MinFlowWater = this->MinReheatWaterFlow; @@ -4782,14 +4165,12 @@ void SingleDuctAirTerminal::SimVAVVS(EnergyPlusData &state, bool const FirstHVAC } } else { WaterControlNode = 0; - HCLoad = BigLoad; MaxFlowWater = 0.0; MinFlowWater = 0.0; } if (HCType == HeatingCoilType::SteamAirHeating) { SteamControlNode = this->ReheatControlNode; - HCLoad = 0.0; if (FirstHVACIteration) { MaxFlowSteam = this->MaxReheatSteamFlow; MinFlowSteam = this->MinReheatSteamFlow; @@ -4799,7 +4180,6 @@ void SingleDuctAirTerminal::SimVAVVS(EnergyPlusData &state, bool const FirstHVAC } } else { SteamControlNode = 0; - HCLoad = BigLoad; MaxFlowSteam = 0.0; MinFlowSteam = 0.0; } @@ -4808,6 +4188,7 @@ void SingleDuctAirTerminal::SimVAVVS(EnergyPlusData &state, bool const FirstHVAC // region 1: active cooling with fan on FanOp = 1; if (HCType == HeatingCoilType::SteamAirHeating) { + bool ErrorsFound; // returned from mining function call this->CalcVAVVS(state, FirstHVACIteration, ZoneNodeNum, MinFlowSteam, 0.0, fanType, MaxCoolMassFlow, FanOp, QCoolFanOnMax); this->CalcVAVVS(state, FirstHVACIteration, ZoneNodeNum, MinFlowSteam, 0.0, fanType, MinMassFlow, FanOp, QCoolFanOnMin); // region 2: active heating with fan on @@ -5103,17 +4484,10 @@ void SingleDuctAirTerminal::SimConstVol(EnergyPlusData &state, bool const FirstH // AUTHOR Richard J. Liesen // DATE WRITTEN February 2000 // MODIFIED FB/KHL/TH 2/2011: added maximum supply air temperature leaving reheat coil - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine simulates the simple single duct constant volume systems. - // METHODOLOGY EMPLOYED: - // There is method to this madness. - - // REFERENCES: - // na - // Using/Aliasing using namespace DataZoneEnergyDemands; // unused USE DataHeatBalFanSys, ONLY: Mat @@ -5122,33 +4496,17 @@ void SingleDuctAirTerminal::SimConstVol(EnergyPlusData &state, bool const FirstH using SteamCoils::SimulateSteamCoilComponents; using WaterCoils::SimulateWaterCoilComponents; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 MassFlow; // [kg/sec] Total Mass Flow Rate from Hot & Cold Inlets - Real64 QZnReq; // [Watts] - Real64 QToHeatSetPt; // [W] remaining load to heating setpoint - Real64 CpAir; - int WaterControlNode; // This is the Actuated Reheat Control Node - Real64 MaxFlowWater; // This is the value passed to the Controller depending if FirstHVACIteration or not - Real64 MinFlowWater; // This is the value passed to the Controller depending if FirstHVACIteration or not - Real64 QActualHeating; // the heating load seen by the reheat coil - Real64 DummyMdot; // local fluid mass flow rate - - QToHeatSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).RemainingOutputReqToHeatSP; // The calculated load from the Heat Balance - MassFlow = this->sd_airterminalInlet.AirMassFlowRateMaxAvail; // System massflow is set to the Available + Real64 MaxFlowWater; // This is the value passed to the Controller depending if FirstHVACIteration or not + Real64 MinFlowWater; // This is the value passed to the Controller depending if FirstHVACIteration or not + Real64 DummyMdot; // local fluid mass flow rate + + Real64 QToHeatSetPt = + state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).RemainingOutputReqToHeatSP; // The calculated load from the Heat Balance + Real64 MassFlow = this->sd_airterminalInlet.AirMassFlowRateMaxAvail; // System massflow is set to the Available state.dataSingleDuct->QMax2SCV = QToHeatSetPt; state.dataSingleDuct->ZoneTempSCV = state.dataLoopNodes->Node(ZoneNodeNum).Temp; - CpAir = PsyCpAirFnW(state.dataLoopNodes->Node(ZoneNodeNum).HumRat); // zone air specific heat + Real64 CpAir = PsyCpAirFnW(state.dataLoopNodes->Node(ZoneNodeNum).HumRat); // zone air specific heat if (this->MaxReheatTempSetByUser) { state.dataSingleDuct->TAirMaxSCV = this->MaxReheatTemp; state.dataSingleDuct->QMaxSCV = CpAir * MassFlow * (state.dataSingleDuct->TAirMaxSCV - state.dataSingleDuct->ZoneTempSCV); @@ -5174,11 +4532,13 @@ void SingleDuctAirTerminal::SimConstVol(EnergyPlusData &state, bool const FirstH this->sd_airterminalOutlet.AirMassFlowRateMinAvail = this->sd_airterminalInlet.AirMassFlowRateMinAvail; this->UpdateSys(state); - QActualHeating = QToHeatSetPt - MassFlow * CpAir * (this->sd_airterminalInlet.AirTemp - state.dataSingleDuct->ZoneTempSCV); // reheat needed + Real64 QActualHeating = + QToHeatSetPt - MassFlow * CpAir * (this->sd_airterminalInlet.AirTemp - state.dataSingleDuct->ZoneTempSCV); // reheat needed // Now the massflow for reheating has been determined. If it is zero, or in SetBack, or the // system scheduled OFF then not operational and shut the system down. - if ((MassFlow > SmallMassFlow) && (QActualHeating > 0.0) && - (state.dataHeatBalFanSys->TempControlType(ZoneNum) != HVAC::ThermostatType::SingleCooling)) { + if ((MassFlow > SmallMassFlow) && (QActualHeating > 0.0) && (state.dataHeatBalFanSys->TempControlType(ZoneNum) != HVAC::SetptType::SingleCool)) { + + Real64 QZnReq; switch (this->ReheatComp_Num) { case HeatingCoilType::SimpleHeating: { // COIL:WATER:SIMPLEHEATING @@ -5198,7 +4558,7 @@ void SingleDuctAirTerminal::SimConstVol(EnergyPlusData &state, bool const FirstH MaxFlowWater = this->MaxReheatWaterFlow; MinFlowWater = this->MinReheatWaterFlow; } else { - WaterControlNode = this->ReheatControlNode; + int WaterControlNode = this->ReheatControlNode; MaxFlowWater = state.dataLoopNodes->Node(WaterControlNode).MassFlowRateMaxAvail; MinFlowWater = state.dataLoopNodes->Node(WaterControlNode).MassFlowRateMinAvail; } @@ -5312,8 +4672,6 @@ void SingleDuctAirTerminal::CalcVAVVS(EnergyPlusData &state, // SUBROUTINE INFORMATION: // AUTHOR Fred Buhl // DATE WRITTEN July 2004 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Simulate the components making up the VAV terminal unit with variable speed fan. @@ -5321,27 +4679,12 @@ void SingleDuctAirTerminal::CalcVAVVS(EnergyPlusData &state, // METHODOLOGY EMPLOYED: // Simulates the unit components sequentially in the air flow direction. - // REFERENCES: - // na - // Using/Aliasing using HeatingCoils::SimulateHeatingCoilComponents; using PlantUtilities::SetComponentFlowRate; using SteamCoils::SimulateSteamCoilComponents; using WaterCoils::SimulateWaterCoilComponents; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int FanInNode; // unit air inlet node (fan inlet) int FanOutNode; // fan outlet node (heating coil inlet node) @@ -5413,18 +4756,12 @@ void SingleDuctAirTerminal::UpdateSys(EnergyPlusData &state) const // SUBROUTINE INFORMATION: // AUTHOR Richard J. Liesen // DATE WRITTEN january 2000 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine updates the Syss. - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int OutletNode; - int InletNode; - - OutletNode = this->OutletNodeNum; - InletNode = this->InletNodeNum; + int OutletNode = this->OutletNodeNum; + int InletNode = this->InletNodeNum; if (this->SysType_Num == SysType::SingleDuctVAVReheat || this->SysType_Num == SysType::SingleDuctCBVAVReheat || this->SysType_Num == SysType::SingleDuctCBVAVNoReheat || this->SysType_Num == SysType::SingleDuctVAVNoReheat || @@ -5464,40 +4801,6 @@ void SingleDuctAirTerminal::UpdateSys(EnergyPlusData &state) const void SingleDuctAirTerminal::ReportSys(EnergyPlusData &state) // unused1208 { - // SUBROUTINE INFORMATION: - // AUTHOR Unknown - // DATE WRITTEN Unknown - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS SUBROUTINE: - // This subroutine updates the Sys report variables. - - // METHODOLOGY EMPLOYED: - // There is method to this madness. - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - - // Still needs to report the Sys power from this component - // set zone OA volume flow rate this->CalcOutdoorAirVolumeFlowRate(state); } @@ -5515,8 +4818,6 @@ void GetHVACSingleDuctSysIndex(EnergyPlusData &state, // SUBROUTINE INFORMATION: // AUTHOR Lixing Gu // DATE WRITTEN February 2006 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine sets an index for a given single duct system -- issues error message if that system @@ -5557,16 +4858,11 @@ void SimATMixer(EnergyPlusData &state, std::string const &SysName, bool const Fi { // SUBROUTINE INFORMATION: - // AUTHOR // DATE WRITTEN March 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE // Simulate an Air Terminal Mixer component - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - if (state.dataSingleDuct->GetATMixerFlag) { state.dataSingleDuct->GetATMixerFlag = false; } @@ -5592,10 +4888,7 @@ void GetATMixers(EnergyPlusData &state) { // SUBROUTINE INFORMATION: - // AUTHOR // DATE WRITTEN March 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE // Get input for inlet side air terminal mixers and store it in the inlet side air terminal mixer array @@ -6049,34 +5342,14 @@ void CalcATMixer(EnergyPlusData &state, int const SysNum) { // SUBROUTINE INFORMATION: - // AUTHOR // DATE WRITTEN March 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE // Calculate the mixed air flow and conditions in the air terminal mixer - // METHODOLOGY EMPLOYED: - - // REFERENCES: - // Using/Aliasing using Psychrometrics::PsyTdbFnHW; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS - - // SUBROUTINE PARAMETER DEFINITIONS: - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - state.dataSingleDuct->PriEnthalpyCATM = state.dataLoopNodes->Node(state.dataSingleDuct->SysATMixer(SysNum).PriInNode).Enthalpy; state.dataSingleDuct->PriHumRatCATM = state.dataLoopNodes->Node(state.dataSingleDuct->SysATMixer(SysNum).PriInNode).HumRat; state.dataSingleDuct->PriTempCATM = state.dataLoopNodes->Node(state.dataSingleDuct->SysATMixer(SysNum).PriInNode).Temp; @@ -6131,18 +5404,11 @@ void UpdateATMixer(EnergyPlusData &state, int const SysNum) { // SUBROUTINE INFORMATION: - // AUTHOR // DATE WRITTEN March 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE // Move the results of CalcATMixer to the affected nodes - // METHODOLOGY EMPLOYED: - - // REFERENCES: - // Using/Aliasing using namespace DataLoopNode; @@ -6202,8 +5468,6 @@ void GetATMixer(EnergyPlusData &state, // SUBROUTINE INFORMATION: // AUTHOR Fred Buhl // DATE WRITTEN April 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine gets: 1) the index of the named AT Mixer in the SysATMixer data array @@ -6251,48 +5515,12 @@ void GetATMixer(EnergyPlusData &state, } } -void SetATMixerPriFlow(EnergyPlusData &state, - int const ATMixerNum, // Air terminal mixer index - ObjexxFCL::Optional PriAirMassFlowRate // Air terminal mixer primary air mass flow rate [kg/s] -) -{ - - // SUBROUTINE INFORMATION: - // AUTHOR Fred Buhl - // DATE WRITTEN April 2012 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS SUBROUTINE: - // This Subroutine sets the primary air mass flow rate on the primary air inlet - // node of a terminal unit mixer component. - - // METHODOLOGY EMPLOYED: - // The flow is set to either the input PriAirMassFlowRate if this optional input - // parameter is present, or to the maximum available mass flow rate of the primary - // air inlet node. - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int PriAirNode; // air terminal mixer primary air inlet node number - - if (ATMixerNum <= 0) return; - PriAirNode = state.dataSingleDuct->SysATMixer(ATMixerNum).PriInNode; - if (present(PriAirMassFlowRate)) { - state.dataLoopNodes->Node(PriAirNode).MassFlowRate = PriAirMassFlowRate; - } else { - state.dataLoopNodes->Node(PriAirNode).MassFlowRate = state.dataLoopNodes->Node(PriAirNode).MassFlowRateMaxAvail; - } -} - void setATMixerSizingProperties(EnergyPlusData &state, int const inletATMixerIndex, // index to ATMixer at inlet of zone equipment int const controlledZoneNum, // controlled zone number int const curZoneEqNum // current zone equipment being simulated ) { - auto &ZoneEqSizing(state.dataSize->ZoneEqSizing); - auto &FinalSysSizing(state.dataSize->FinalSysSizing); - auto &FinalZoneSizing(state.dataSize->FinalZoneSizing); if (inletATMixerIndex == 0) return; // protect this function from bad inputs if (controlledZoneNum == 0) return; @@ -6302,28 +5530,29 @@ void setATMixerSizingProperties(EnergyPlusData &state, // ATMixer properties only affect coil sizing when the mixer is on the inlet side of zone equipment if (state.dataSingleDuct->SysATMixer(inletATMixerIndex).type == HVAC::MixerType::SupplySide) { // check if user has selected No to account for DOAS system - if (FinalZoneSizing.allocated() && state.dataSingleDuct->SysATMixer(inletATMixerIndex).printWarning) { - if (!FinalZoneSizing(curZoneEqNum).AccountForDOAS && FinalZoneSizing(curZoneEqNum).DOASControlStrategy != DOASControl::NeutralSup) { + if (state.dataSize->FinalZoneSizing.allocated() && state.dataSingleDuct->SysATMixer(inletATMixerIndex).printWarning) { + auto const &finalZoneSizing = state.dataSize->FinalZoneSizing(curZoneEqNum); + if (!finalZoneSizing.AccountForDOAS && finalZoneSizing.DOASControlStrategy != DOASControl::NeutralSup) { ShowWarningError(state, format("AirTerminal:SingleDuct:Mixer: {}", state.dataSingleDuct->SysATMixer(inletATMixerIndex).Name)); ShowContinueError( state, " Supply side Air Terminal Mixer does not adjust zone equipment coil sizing and may result in inappropriately sized coils."); - ShowContinueError(state, - format(" Set Account for Dedicated Outdoor Air System = Yes in Sizing:Zone object for zone = {}", - FinalZoneSizing(curZoneEqNum).ZoneName)); + ShowContinueError( + state, + format(" Set Account for Dedicated Outdoor Air System = Yes in Sizing:Zone object for zone = {}", finalZoneSizing.ZoneName)); } state.dataSingleDuct->SysATMixer(inletATMixerIndex).printWarning = false; } return; // do nothing else if this is a supply side ATMixer } // check if user has selected Yes to account for DOAS system - if (FinalZoneSizing.allocated() && state.dataSingleDuct->SysATMixer(inletATMixerIndex).printWarning) { - if (FinalZoneSizing(curZoneEqNum).AccountForDOAS && FinalZoneSizing(curZoneEqNum).DOASControlStrategy != DOASControl::NeutralSup) { + if (state.dataSize->FinalZoneSizing.allocated() && state.dataSingleDuct->SysATMixer(inletATMixerIndex).printWarning) { + auto const &finalZoneSizing = state.dataSize->FinalZoneSizing(curZoneEqNum); + if (finalZoneSizing.AccountForDOAS && finalZoneSizing.DOASControlStrategy != DOASControl::NeutralSup) { ShowWarningError(state, format("AirTerminal:SingleDuct:Mixer: {}", state.dataSingleDuct->SysATMixer(inletATMixerIndex).Name)); ShowContinueError(state, " Inlet side Air Terminal Mixer automatically adjusts zone equipment coil sizing."); - ShowContinueError(state, - format(" Set Account for Dedicated Outdoor Air System = No in Sizing:Zone object for zone = {}", - FinalZoneSizing(curZoneEqNum).ZoneName)); + ShowContinueError( + state, format(" Set Account for Dedicated Outdoor Air System = No in Sizing:Zone object for zone = {}", finalZoneSizing.ZoneName)); state.dataSingleDuct->SysATMixer(inletATMixerIndex).printWarning = false; } } @@ -6339,131 +5568,126 @@ void setATMixerSizingProperties(EnergyPlusData &state, CheckThisAirSystemForSizing(state, airLoopIndex, SizingDesRunThisAirSys); // check for Sizing:System object if (SizingDesRunThisAirSys) { + auto &finalSysSizing = state.dataSize->FinalSysSizing(airLoopIndex); + auto &zoneEqSizing = state.dataSize->ZoneEqSizing(curZoneEqNum); // set ATMixer outlet air flow rate in ZoneEqSizing array for ATMixer. If this value > 0, then the Sizer will know an ATMixer exists - ZoneEqSizing(curZoneEqNum).ATMixerVolFlow = state.dataSingleDuct->SysATMixer(inletATMixerIndex).DesignPrimaryAirVolRate; + zoneEqSizing.ATMixerVolFlow = state.dataSingleDuct->SysATMixer(inletATMixerIndex).DesignPrimaryAirVolRate; // If air loop has heating coil use SA conditions, else if OA sys has coils then use precool conditions, else use OA conditions if (state.dataAirSystemsData->PrimaryAirSystems(airLoopIndex).CentralHeatCoilExists) { // if central heating coil exists, ATMixer outlet is assumed to be at supply air conditions described in sizing input - ZoneEqSizing(curZoneEqNum).ATMixerHeatPriDryBulb = FinalSysSizing(airLoopIndex).HeatSupTemp; - ZoneEqSizing(curZoneEqNum).ATMixerHeatPriHumRat = FinalSysSizing(airLoopIndex).HeatSupHumRat; + zoneEqSizing.ATMixerHeatPriDryBulb = finalSysSizing.HeatSupTemp; + zoneEqSizing.ATMixerHeatPriHumRat = finalSysSizing.HeatSupHumRat; } else if (state.dataAirSystemsData->PrimaryAirSystems(airLoopIndex).NumOAHeatCoils > 0) { // if no central heating coil exists and an outdoor air coil does exist, then ATMixer outlet is mixture of preheat and return - if (FinalSysSizing(airLoopIndex).DesMainVolFlow == 0.0) { // protect divide by 0 + if (finalSysSizing.DesMainVolFlow == 0.0) { // protect divide by 0 // doesn't matter, just pick a condition - ZoneEqSizing(curZoneEqNum).ATMixerHeatPriDryBulb = FinalSysSizing(airLoopIndex).PreheatTemp; - ZoneEqSizing(curZoneEqNum).ATMixerHeatPriHumRat = FinalSysSizing(airLoopIndex).PreheatHumRat; + zoneEqSizing.ATMixerHeatPriDryBulb = finalSysSizing.PreheatTemp; + zoneEqSizing.ATMixerHeatPriHumRat = finalSysSizing.PreheatHumRat; } else { // mix preheat condition with return air condition based on OA frac. OA frac should nearly always be 1. // OA frac is based on air loop fraction, not ATMixer flow fraction since air loop can serve multiple ATMixers - Real64 OutAirFrac = FinalSysSizing(airLoopIndex).DesOutAirVolFlow / FinalSysSizing(airLoopIndex).DesMainVolFlow; + Real64 OutAirFrac = finalSysSizing.DesOutAirVolFlow / finalSysSizing.DesMainVolFlow; OutAirFrac = min(1.0, max(0.0, OutAirFrac)); // calculate humrat based on simple mixing - Real64 CoilInHumRatForSizing = - OutAirFrac * FinalSysSizing(airLoopIndex).PreheatHumRat + (1 - OutAirFrac) * FinalSysSizing(airLoopIndex).HeatRetHumRat; + Real64 CoilInHumRatForSizing = OutAirFrac * finalSysSizing.PreheatHumRat + (1 - OutAirFrac) * finalSysSizing.HeatRetHumRat; // calculate enthalpy based on simple mixing Real64 CoilInEnthalpyForSizing = - OutAirFrac * Psychrometrics::PsyHFnTdbW(FinalSysSizing(airLoopIndex).PreheatTemp, FinalSysSizing(airLoopIndex).PreheatHumRat) + - (1 - OutAirFrac) * - Psychrometrics::PsyHFnTdbW(FinalSysSizing(airLoopIndex).HeatRetTemp, FinalSysSizing(airLoopIndex).HeatRetHumRat); + OutAirFrac * Psychrometrics::PsyHFnTdbW(finalSysSizing.PreheatTemp, finalSysSizing.PreheatHumRat) + + (1 - OutAirFrac) * Psychrometrics::PsyHFnTdbW(finalSysSizing.HeatRetTemp, finalSysSizing.HeatRetHumRat); // back calculate temperature based on humrat and enthalpy state points Real64 CoilInTempForSizing = Psychrometrics::PsyTdbFnHW(CoilInEnthalpyForSizing, CoilInHumRatForSizing); - ZoneEqSizing(curZoneEqNum).ATMixerHeatPriDryBulb = CoilInTempForSizing; - ZoneEqSizing(curZoneEqNum).ATMixerHeatPriHumRat = CoilInHumRatForSizing; + zoneEqSizing.ATMixerHeatPriDryBulb = CoilInTempForSizing; + zoneEqSizing.ATMixerHeatPriHumRat = CoilInHumRatForSizing; } } else { // else no coils exist in air loop so mix OA condition with return air condition - if (FinalSysSizing(airLoopIndex).DesMainVolFlow == 0.0) { // protect divide by 0 + if (finalSysSizing.DesMainVolFlow == 0.0) { // protect divide by 0 // doesn't matter, just pick a condition - ZoneEqSizing(curZoneEqNum).ATMixerHeatPriDryBulb = FinalSysSizing(airLoopIndex).HeatOutTemp; - ZoneEqSizing(curZoneEqNum).ATMixerHeatPriHumRat = FinalSysSizing(airLoopIndex).HeatOutHumRat; + zoneEqSizing.ATMixerHeatPriDryBulb = finalSysSizing.HeatOutTemp; + zoneEqSizing.ATMixerHeatPriHumRat = finalSysSizing.HeatOutHumRat; } else { // OA frac is based on air loop fraction, not ATMixer flow fraction since air loop can serve multiple ATMixers - Real64 OutAirFrac = FinalSysSizing(airLoopIndex).DesOutAirVolFlow / FinalSysSizing(airLoopIndex).DesMainVolFlow; + Real64 OutAirFrac = finalSysSizing.DesOutAirVolFlow / finalSysSizing.DesMainVolFlow; OutAirFrac = min(1.0, max(0.0, OutAirFrac)); // calculate humrat based on simple mixing - Real64 CoilInHumRatForSizing = - OutAirFrac * FinalSysSizing(airLoopIndex).HeatOutHumRat + (1 - OutAirFrac) * FinalSysSizing(airLoopIndex).HeatRetHumRat; + Real64 CoilInHumRatForSizing = OutAirFrac * finalSysSizing.HeatOutHumRat + (1 - OutAirFrac) * finalSysSizing.HeatRetHumRat; // calculate enthalpy based on simple mixing Real64 CoilInEnthalpyForSizing = - OutAirFrac * Psychrometrics::PsyHFnTdbW(FinalSysSizing(airLoopIndex).HeatOutTemp, FinalSysSizing(airLoopIndex).HeatOutHumRat) + - (1 - OutAirFrac) * - Psychrometrics::PsyHFnTdbW(FinalSysSizing(airLoopIndex).HeatRetTemp, FinalSysSizing(airLoopIndex).HeatRetHumRat); + OutAirFrac * Psychrometrics::PsyHFnTdbW(finalSysSizing.HeatOutTemp, finalSysSizing.HeatOutHumRat) + + (1 - OutAirFrac) * Psychrometrics::PsyHFnTdbW(finalSysSizing.HeatRetTemp, finalSysSizing.HeatRetHumRat); // back calculate temperature based on humrat and enthalpy state points Real64 CoilInTempForSizing = Psychrometrics::PsyTdbFnHW(CoilInEnthalpyForSizing, CoilInHumRatForSizing); - ZoneEqSizing(curZoneEqNum).ATMixerHeatPriDryBulb = CoilInTempForSizing; - ZoneEqSizing(curZoneEqNum).ATMixerHeatPriHumRat = CoilInHumRatForSizing; + zoneEqSizing.ATMixerHeatPriDryBulb = CoilInTempForSizing; + zoneEqSizing.ATMixerHeatPriHumRat = CoilInHumRatForSizing; } } // If air loop has cooling coil use SA conditions, else if OA sys has coils then use precool conditions, else use OA conditions if (state.dataAirSystemsData->PrimaryAirSystems(airLoopIndex).CentralCoolCoilExists) { // if central cooling coil exists, ATMixer outlet is assumed to be at supply air conditions described in sizing input - ZoneEqSizing(curZoneEqNum).ATMixerCoolPriDryBulb = FinalSysSizing(airLoopIndex).CoolSupTemp; - ZoneEqSizing(curZoneEqNum).ATMixerCoolPriHumRat = FinalSysSizing(airLoopIndex).CoolSupHumRat; + zoneEqSizing.ATMixerCoolPriDryBulb = finalSysSizing.CoolSupTemp; + zoneEqSizing.ATMixerCoolPriHumRat = finalSysSizing.CoolSupHumRat; } else if (state.dataAirSystemsData->PrimaryAirSystems(airLoopIndex).NumOACoolCoils > 0) { // if no central cooling coil exists and an outdoor air coil does exist, then ATMixer outlet is mixture of precool and return - if (FinalSysSizing(airLoopIndex).DesMainVolFlow == 0.0) { // protect divide by 0 + if (finalSysSizing.DesMainVolFlow == 0.0) { // protect divide by 0 // doesn't matter, just pick a condition - ZoneEqSizing(curZoneEqNum).ATMixerCoolPriDryBulb = FinalSysSizing(airLoopIndex).PrecoolTemp; - ZoneEqSizing(curZoneEqNum).ATMixerCoolPriHumRat = FinalSysSizing(airLoopIndex).PrecoolHumRat; + zoneEqSizing.ATMixerCoolPriDryBulb = finalSysSizing.PrecoolTemp; + zoneEqSizing.ATMixerCoolPriHumRat = finalSysSizing.PrecoolHumRat; } else { // mix precool condition with return air condition based on OA frac. OA frac should nearly always be 1. // OA frac is based on air loop fraction, not ATMixer flow fraction since air loop can serve multiple ATMixers - Real64 OutAirFrac = FinalSysSizing(airLoopIndex).DesOutAirVolFlow / FinalSysSizing(airLoopIndex).DesMainVolFlow; + Real64 OutAirFrac = finalSysSizing.DesOutAirVolFlow / finalSysSizing.DesMainVolFlow; OutAirFrac = min(1.0, max(0.0, OutAirFrac)); // calculate humrat based on simple mixing - Real64 CoilInHumRatForSizing = - OutAirFrac * FinalSysSizing(airLoopIndex).PrecoolHumRat + (1 - OutAirFrac) * FinalSysSizing(airLoopIndex).RetHumRatAtCoolPeak; + Real64 CoilInHumRatForSizing = OutAirFrac * finalSysSizing.PrecoolHumRat + (1 - OutAirFrac) * finalSysSizing.RetHumRatAtCoolPeak; // calculate enthalpy based on simple mixing Real64 CoilInEnthalpyForSizing = - OutAirFrac * Psychrometrics::PsyHFnTdbW(FinalSysSizing(airLoopIndex).PrecoolTemp, FinalSysSizing(airLoopIndex).PrecoolHumRat) + - (1 - OutAirFrac) * - Psychrometrics::PsyHFnTdbW(FinalSysSizing(airLoopIndex).RetTempAtCoolPeak, FinalSysSizing(airLoopIndex).RetHumRatAtCoolPeak); + OutAirFrac * Psychrometrics::PsyHFnTdbW(finalSysSizing.PrecoolTemp, finalSysSizing.PrecoolHumRat) + + (1 - OutAirFrac) * Psychrometrics::PsyHFnTdbW(finalSysSizing.RetTempAtCoolPeak, finalSysSizing.RetHumRatAtCoolPeak); // back calculate temperature based on humrat and enthalpy state points Real64 CoilInTempForSizing = Psychrometrics::PsyTdbFnHW(CoilInEnthalpyForSizing, CoilInHumRatForSizing); - ZoneEqSizing(curZoneEqNum).ATMixerCoolPriDryBulb = CoilInTempForSizing; - ZoneEqSizing(curZoneEqNum).ATMixerCoolPriHumRat = CoilInHumRatForSizing; + zoneEqSizing.ATMixerCoolPriDryBulb = CoilInTempForSizing; + zoneEqSizing.ATMixerCoolPriHumRat = CoilInHumRatForSizing; } } else { // else no coils exist in air loop so mix OA condition with return air condition - if (FinalSysSizing(airLoopIndex).DesMainVolFlow == 0.0) { // protect divide by 0 + if (finalSysSizing.DesMainVolFlow == 0.0) { // protect divide by 0 // doesn't matter, just pick a condition - ZoneEqSizing(curZoneEqNum).ATMixerCoolPriDryBulb = FinalSysSizing(airLoopIndex).OutTempAtCoolPeak; - ZoneEqSizing(curZoneEqNum).ATMixerCoolPriHumRat = FinalSysSizing(airLoopIndex).OutHumRatAtCoolPeak; + zoneEqSizing.ATMixerCoolPriDryBulb = finalSysSizing.OutTempAtCoolPeak; + zoneEqSizing.ATMixerCoolPriHumRat = finalSysSizing.OutHumRatAtCoolPeak; } else { // OA frac is based on air loop fraction, not ATMixer flow fraction since air loop can serve multiple ATMixers - Real64 OutAirFrac = FinalSysSizing(airLoopIndex).DesOutAirVolFlow / FinalSysSizing(airLoopIndex).DesMainVolFlow; + Real64 OutAirFrac = finalSysSizing.DesOutAirVolFlow / finalSysSizing.DesMainVolFlow; OutAirFrac = min(1.0, max(0.0, OutAirFrac)); // calculate humrat based on simple mixing - Real64 CoilInHumRatForSizing = OutAirFrac * FinalSysSizing(airLoopIndex).OutHumRatAtCoolPeak + - (1 - OutAirFrac) * FinalSysSizing(airLoopIndex).RetHumRatAtCoolPeak; + Real64 CoilInHumRatForSizing = + OutAirFrac * finalSysSizing.OutHumRatAtCoolPeak + (1 - OutAirFrac) * finalSysSizing.RetHumRatAtCoolPeak; // calculate enthalpy based on simple mixing - Real64 CoilInEnthalpyForSizing = OutAirFrac * Psychrometrics::PsyHFnTdbW(FinalSysSizing(airLoopIndex).OutTempAtCoolPeak, - FinalSysSizing(airLoopIndex).OutHumRatAtCoolPeak) + - (1 - OutAirFrac) * Psychrometrics::PsyHFnTdbW(FinalSysSizing(airLoopIndex).RetTempAtCoolPeak, - FinalSysSizing(airLoopIndex).RetHumRatAtCoolPeak); + Real64 CoilInEnthalpyForSizing = + OutAirFrac * Psychrometrics::PsyHFnTdbW(finalSysSizing.OutTempAtCoolPeak, finalSysSizing.OutHumRatAtCoolPeak) + + (1 - OutAirFrac) * Psychrometrics::PsyHFnTdbW(finalSysSizing.RetTempAtCoolPeak, finalSysSizing.RetHumRatAtCoolPeak); // back calculate temperature based on humrat and enthalpy state points Real64 CoilInTempForSizing = Psychrometrics::PsyTdbFnHW(CoilInEnthalpyForSizing, CoilInHumRatForSizing); - ZoneEqSizing(curZoneEqNum).ATMixerCoolPriDryBulb = CoilInTempForSizing; - ZoneEqSizing(curZoneEqNum).ATMixerCoolPriHumRat = CoilInHumRatForSizing; + zoneEqSizing.ATMixerCoolPriDryBulb = CoilInTempForSizing; + zoneEqSizing.ATMixerCoolPriHumRat = CoilInHumRatForSizing; } } @@ -6501,22 +5725,21 @@ void SingleDuctAirTerminal::reportTerminalUnit(EnergyPlusData &state) OutputReportPredefined::PreDefTableEntry(state, orp->pdchAirTermTypeInp, adu.Name, this->sysType); OutputReportPredefined::PreDefTableEntry(state, orp->pdchAirTermPrimFlow, adu.Name, this->MaxAirVolFlowRate); OutputReportPredefined::PreDefTableEntry(state, orp->pdchAirTermSecdFlow, adu.Name, "n/a"); - if (this->ZoneMinAirFracSchPtr > 0) { - OutputReportPredefined::PreDefTableEntry( - state, orp->pdchAirTermMinFlowSch, adu.Name, ScheduleManager::GetScheduleName(state, this->ZoneMinAirFracSchPtr)); + if (this->zoneMinAirFracSched != nullptr) { + OutputReportPredefined::PreDefTableEntry(state, orp->pdchAirTermMinFlowSch, adu.Name, this->zoneMinAirFracSched->Name); } else { OutputReportPredefined::PreDefTableEntry(state, orp->pdchAirTermMinFlowSch, adu.Name, "n/a"); } OutputReportPredefined::PreDefTableEntry(state, orp->pdchAirTermMaxFlowReh, adu.Name, this->MaxAirVolFlowRateDuringReheat); std::string schName = "n/a"; if (this->OARequirementsPtr > 0) { - int minOAsch = state.dataSize->OARequirements(this->OARequirementsPtr).OAFlowFracSchPtr; - if (minOAsch > 0) schName = ScheduleManager::GetScheduleName(state, minOAsch); + auto const *minOASched = state.dataSize->OARequirements(this->OARequirementsPtr).oaFlowFracSched; + if (minOASched != nullptr) schName = minOASched->Name; } OutputReportPredefined::PreDefTableEntry(state, orp->pdchAirTermMinOAflowSch, adu.Name, schName); OutputReportPredefined::PreDefTableEntry(state, orp->pdchAirTermHeatCoilType, adu.Name, this->ReheatComp); OutputReportPredefined::PreDefTableEntry(state, orp->pdchAirTermCoolCoilType, adu.Name, "n/a"); - if ((int)this->fanType >= 0) { + if (this->fanType != HVAC::FanType::Invalid) { OutputReportPredefined::PreDefTableEntry(state, orp->pdchAirTermFanType, adu.Name, HVAC::fanTypeNames[(int)this->fanType]); } else { OutputReportPredefined::PreDefTableEntry(state, orp->pdchAirTermFanType, adu.Name, "n/a"); diff --git a/src/EnergyPlus/SingleDuct.hh b/src/EnergyPlus/SingleDuct.hh index 049d30498da..0de7e36788b 100644 --- a/src/EnergyPlus/SingleDuct.hh +++ b/src/EnergyPlus/SingleDuct.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -59,6 +59,7 @@ #include #include #include +#include #include #include @@ -134,8 +135,7 @@ namespace SingleDuct { std::string SysName; // Name of the Sys std::string sysType; // Type of Sys ie. VAV, Mixing, Inducing, etc. SysType SysType_Num; // Numeric Equivalent for System type - std::string Schedule; // Sys Operation Schedule - int SchedPtr; // Pointer to the correct schedule + Sched::Schedule *availSched = nullptr; // availability schedule std::string ReheatComp; // Type of the Reheat Coil Object HeatingCoilType ReheatComp_Num; // Numeric Equivalent in this module for Coil type int ReheatComp_Index; // Returned Index number from other routines @@ -155,13 +155,13 @@ namespace SingleDuct { Real64 ZoneMinAirFrac; // Fraction of supply air used as current minimum flow Real64 ZoneMinAirFracReport; // Fraction of supply air used as minimum flow for reporting (zero if terminal unit flow is zero) Real64 ZoneFixedMinAir; // Absolute minimum supply air flow - int ZoneMinAirFracSchPtr; // pointer to the schedule for min flow fraction - bool ConstantMinAirFracSetByUser; // record if user left field blank for constant min fraction. - bool FixedMinAirSetByUser; // record if user left field blank for constant min fraction. - Real64 DesignMinAirFrac; // store user entered constant min flow fract for design - Real64 DesignFixedMinAir; // store user entered constant min flow for design - int InletNodeNum; // terminal unit inlet node number; damper inlet node number - int OutletNodeNum; // damper outlet node number for VAV; unused by CV; coil air inlet node for VAV + Sched::Schedule *zoneMinAirFracSched = nullptr; // schedule for min flow fraction + bool ConstantMinAirFracSetByUser; // record if user left field blank for constant min fraction. + bool FixedMinAirSetByUser; // record if user left field blank for constant min fraction. + Real64 DesignMinAirFrac; // store user entered constant min flow fract for design + Real64 DesignFixedMinAir; // store user entered constant min flow for design + int InletNodeNum; // terminal unit inlet node number; damper inlet node number + int OutletNodeNum; // damper outlet node number for VAV; unused by CV; coil air inlet node for VAV // fan outlet node, coil inlet node for VAV VS Fan int ReheatControlNode; // hot water inlet node for heating coil int ReheatCoilOutletNode; // outlet node for heating coil @@ -181,7 +181,6 @@ namespace SingleDuct { Action DamperHeatingAction; Real64 DamperPosition; int ADUNum; // index of corresponding air distribution unit - int FluidIndex; // Refrigerant index int ErrCount1; // iteration limit exceeded in Hot Water Flow Calc int ErrCount1c; // iteration limit exceeded in Hot Water Flow Calc - continue int ErrCount2; // bad iterations limits in hot water flow calc @@ -206,9 +205,8 @@ namespace SingleDuct { DataZoneEquipment::PerPersonVentRateMode OAPerPersonMode; // mode for how per person rates are determined, DCV or design. bool EMSOverrideAirFlow; // if true, EMS is calling to override flow rate Real64 EMSMassFlowRateValue; // value EMS is directing to use for flow rate [kg/s] - int ZoneTurndownMinAirFracSchPtr; // pointer to the schedule for turndown minimum airflow fraction - Real64 ZoneTurndownMinAirFrac; // turndown minimum airflow fraction value, multiplier of zone design minimum air flow - bool ZoneTurndownMinAirFracSchExist; // if true, if zone turndown min air frac schedule exist + Sched::Schedule *zoneTurndownMinAirFracSched = nullptr; // schedule for turndown minimum airflow fraction + Real64 ZoneTurndownMinAirFrac; // turndown minimum airflow fraction value, multiplier of zone design minimum air flow bool MyEnvrnFlag; bool MySizeFlag; bool GetGasElecHeatCoilCap; // Gets autosized value of coil capacity @@ -222,22 +220,21 @@ namespace SingleDuct { // Default Constructor SingleDuctAirTerminal() - : SysNum(-1), SysType_Num(SysType::Invalid), SchedPtr(0), ReheatComp_Num(HeatingCoilType::None), ReheatComp_Index(0), + : SysNum(-1), SysType_Num(SysType::Invalid), ReheatComp_Num(HeatingCoilType::None), ReheatComp_Index(0), ReheatComp_PlantType(DataPlant::PlantEquipmentType::Invalid), fanType(HVAC::FanType::Invalid), Fan_Index(0), ControlCompTypeNum(0), CompErrIndex(0), MaxAirVolFlowRate(0.0), AirMassFlowRateMax(0.0), MaxHeatAirVolFlowRate(0.0), HeatAirMassFlowRateMax(0.0), ZoneMinAirFracMethod(MinFlowFraction::Constant), ZoneMinAirFracDes(0.0), ZoneMinAirFrac(0.0), ZoneMinAirFracReport(0.0), - ZoneFixedMinAir(0.0), ZoneMinAirFracSchPtr(0), ConstantMinAirFracSetByUser(false), FixedMinAirSetByUser(false), DesignMinAirFrac(0.0), - DesignFixedMinAir(0.0), InletNodeNum(0), OutletNodeNum(0), ReheatControlNode(0), ReheatCoilOutletNode(0), ReheatCoilMaxCapacity(0.0), - ReheatAirOutletNode(0), MaxReheatWaterVolFlow(0.0), MaxReheatSteamVolFlow(0.0), MaxReheatWaterFlow(0.0), MaxReheatSteamFlow(0.0), - MinReheatWaterVolFlow(0.0), MinReheatSteamVolFlow(0.0), MinReheatWaterFlow(0.0), MinReheatSteamFlow(0.0), ControllerOffset(0.0), - MaxReheatTemp(0.0), MaxReheatTempSetByUser(false), DamperHeatingAction(Action::HeatingNotUsed), DamperPosition(0.0), ADUNum(0), - FluidIndex(0), ErrCount1(0), ErrCount1c(0), ErrCount2(0), ZoneFloorArea(0.0), CtrlZoneNum(0), CtrlZoneInNodeIndex(0), - MaxAirVolFlowRateDuringReheat(0.0), MaxAirVolFractionDuringReheat(0.0), AirMassFlowDuringReheatMax(0.0), ZoneOutdoorAirMethod(0), - OutdoorAirFlowRate(0.0), NoOAFlowInputFromUser(true), OARequirementsPtr(0), AirLoopNum(0), HWplantLoc{}, SecInNode(0), - IterationLimit(0), IterationFailed(0), OAPerPersonMode(DataZoneEquipment::PerPersonVentRateMode::Invalid), EMSOverrideAirFlow(false), - EMSMassFlowRateValue(0.0), ZoneTurndownMinAirFracSchPtr(0), ZoneTurndownMinAirFrac(1.0), ZoneTurndownMinAirFracSchExist(false), - MyEnvrnFlag(true), MySizeFlag(true), GetGasElecHeatCoilCap(true), PlantLoopScanFlag(true), MassFlow1(0.0), MassFlow2(0.0), - MassFlow3(0.0), MassFlowDiff(0.0) + ZoneFixedMinAir(0.0), ConstantMinAirFracSetByUser(false), FixedMinAirSetByUser(false), DesignMinAirFrac(0.0), DesignFixedMinAir(0.0), + InletNodeNum(0), OutletNodeNum(0), ReheatControlNode(0), ReheatCoilOutletNode(0), ReheatCoilMaxCapacity(0.0), ReheatAirOutletNode(0), + MaxReheatWaterVolFlow(0.0), MaxReheatSteamVolFlow(0.0), MaxReheatWaterFlow(0.0), MaxReheatSteamFlow(0.0), MinReheatWaterVolFlow(0.0), + MinReheatSteamVolFlow(0.0), MinReheatWaterFlow(0.0), MinReheatSteamFlow(0.0), ControllerOffset(0.0), MaxReheatTemp(0.0), + MaxReheatTempSetByUser(false), DamperHeatingAction(Action::HeatingNotUsed), DamperPosition(0.0), ADUNum(0), ErrCount1(0), ErrCount1c(0), + ErrCount2(0), ZoneFloorArea(0.0), CtrlZoneNum(0), CtrlZoneInNodeIndex(0), MaxAirVolFlowRateDuringReheat(0.0), + MaxAirVolFractionDuringReheat(0.0), AirMassFlowDuringReheatMax(0.0), ZoneOutdoorAirMethod(0), OutdoorAirFlowRate(0.0), + NoOAFlowInputFromUser(true), OARequirementsPtr(0), AirLoopNum(0), HWplantLoc{}, SecInNode(0), IterationLimit(0), IterationFailed(0), + OAPerPersonMode(DataZoneEquipment::PerPersonVentRateMode::Invalid), EMSOverrideAirFlow(false), EMSMassFlowRateValue(0.0), + ZoneTurndownMinAirFrac(1.0), MyEnvrnFlag(true), MySizeFlag(true), GetGasElecHeatCoilCap(true), PlantLoopScanFlag(true), MassFlow1(0.0), + MassFlow2(0.0), MassFlow3(0.0), MassFlowDiff(0.0) { } @@ -343,11 +340,6 @@ namespace SingleDuct { int ZoneEquipOutletNode // zone equipment outlet node (used with inlet side mixers) ); - void SetATMixerPriFlow(EnergyPlusData &state, - int ATMixerNum, // Air terminal mixer index - ObjexxFCL::Optional PriAirMassFlowRate = _ // Air terminal mixer primary air mass flow rate [kg/s] - ); - void setATMixerSizingProperties(EnergyPlusData &state, int inletATMixerIndex, // index to ATMixer at inlet of zone equipment int controlledZoneNum, // controlled zone number @@ -368,7 +360,6 @@ struct SingleDuctData : BaseGlobalStruct int NumSDAirTerminal = 0; // The Number of single duct air terminals found in the Input bool GetInputFlag = true; // Flag set to make sure you get input once bool GetATMixerFlag = true; // Flag set to make sure you get input once - bool InitSysFlag = true; // Flag set to make sure you do begin simulation initializaztions once bool InitATMixerFlag = true; // Flag set to make sure you do begin simulation initializaztions once for mixer bool ZoneEquipmentListChecked = false; // True after the Zone Equipment List has been checked for items @@ -394,7 +385,7 @@ struct SingleDuctData : BaseGlobalStruct int CoilWaterOutletNodeSS = 0; int CoilSteamInletNodeSS = 0; int CoilSteamOutletNodeSS = 0; - int DummyWaterIndexSS = 1; + Fluid::GlycolProps *water = nullptr; Real64 UserInputMaxHeatAirVolFlowRateSS = 0.0; // user input for MaxHeatAirVolFlowRate Real64 MinAirMassFlowRevActSVAV = 0.0; // minimum air mass flow rate used in "reverse action" air mass flow rate calculation Real64 MaxAirMassFlowRevActSVAV = 0.0; // maximum air mass flow rate used in "reverse action" air mass flow rate calculation @@ -436,6 +427,10 @@ struct SingleDuctData : BaseGlobalStruct Real64 MinMassAirFlowSDAT = 0.0; // the air flow rate during heating for normal acting damper Real64 QZoneMax2SDAT = 0.0; // temporary variable + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/SizingAnalysisObjects.cc b/src/EnergyPlus/SizingAnalysisObjects.cc index ee6eb9d8ab8..7b46555eacf 100644 --- a/src/EnergyPlus/SizingAnalysisObjects.cc +++ b/src/EnergyPlus/SizingAnalysisObjects.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -128,7 +128,7 @@ int SizingLog::GetZtStepIndex(const ZoneTimestepObject tmpztStepStamp) vecIndex = envrnStartZtStepIndexMap[newEnvrnToSeedEnvrnMap[tmpztStepStamp.envrnNum]]; } - // next for safety sake, constrain index to lie inside correct envronment + // next for safety sake, constrain index to lie inside correct environment if (vecIndex < envrnStartZtStepIndexMap[newEnvrnToSeedEnvrnMap[tmpztStepStamp.envrnNum]]) { vecIndex = envrnStartZtStepIndexMap[newEnvrnToSeedEnvrnMap[tmpztStepStamp.envrnNum]]; // first step in environment } @@ -175,17 +175,14 @@ int SizingLog::GetSysStepZtStepIndex(ZoneTimestepObject tmpztStepStamp) void SizingLog::FillSysStep(ZoneTimestepObject tmpztStepStamp, SystemTimestepObject tmpSysStepStamp) { - int ztIndex(0); - int oldNumSubSteps(0); - int newNumSubSteps(0); + int newNumSubSteps; Real64 constexpr MinutesPerHour(60.0); - Real64 ZoneStepStartMinutes(0.0); - ztIndex = GetSysStepZtStepIndex(tmpztStepStamp); + int ztIndex = GetSysStepZtStepIndex(tmpztStepStamp); if (ztStepObj[ztIndex].hasSystemSubSteps) { - oldNumSubSteps = ztStepObj[ztIndex].numSubSteps; + int oldNumSubSteps = ztStepObj[ztIndex].numSubSteps; newNumSubSteps = round(tmpztStepStamp.timeStepDuration / tmpSysStepStamp.TimeStepDuration); if (newNumSubSteps != oldNumSubSteps) { ztStepObj[ztIndex].subSteps.resize(newNumSubSteps); @@ -199,7 +196,7 @@ void SizingLog::FillSysStep(ZoneTimestepObject tmpztStepStamp, SystemTimestepObj } // figure out which index this substep needs to go into - ZoneStepStartMinutes = tmpztStepStamp.stepStartMinute; + Real64 ZoneStepStartMinutes = tmpztStepStamp.stepStartMinute; tmpSysStepStamp.stStepsIntoZoneStep = round((((tmpSysStepStamp.CurMinuteStart - ZoneStepStartMinutes) / MinutesPerHour) / tmpSysStepStamp.TimeStepDuration)); @@ -220,7 +217,7 @@ void SizingLog::AverageSysTimeSteps() for (auto &zt : ztStepObj) { if (zt.numSubSteps > 0) { RunningSum = 0.0; - for (auto &SysT : zt.subSteps) { + for (auto const &SysT : zt.subSteps) { RunningSum += SysT.LogDataValue; } zt.logDataValue = RunningSum / double(zt.numSubSteps); @@ -254,15 +251,14 @@ void SizingLog::ProcessRunningAverage() ZoneTimestepObject SizingLog::GetLogVariableDataMax(EnergyPlusData &state) { - Real64 MaxVal; ZoneTimestepObject tmpztStepStamp; - MaxVal = 0.0; + Real64 MaxVal = 0.0; if (!ztStepObj.empty()) { tmpztStepStamp = ztStepObj[0]; } - for (auto &zt : ztStepObj) { + for (auto const &zt : ztStepObj) { if (zt.envrnNum > 0 && zt.kindOfSim != Constant::KindOfSim::Invalid && zt.runningAvgDataValue > MaxVal) { MaxVal = zt.runningAvgDataValue; tmpztStepStamp = zt; @@ -276,19 +272,13 @@ ZoneTimestepObject SizingLog::GetLogVariableDataMax(EnergyPlusData &state) Real64 SizingLog::GetLogVariableDataAtTimestamp(ZoneTimestepObject tmpztStepStamp) { int const index = GetZtStepIndex(tmpztStepStamp); - - Real64 const val = ztStepObj[index].runningAvgDataValue; - - return val; + return ztStepObj[index].runningAvgDataValue; } void SizingLog::ReInitLogForIteration() { ZoneTimestepObject tmpNullztStepObj; - - for (auto &zt : ztStepObj) { - zt = tmpNullztStepObj; - } + std::fill(ztStepObj.begin(), ztStepObj.end(), tmpNullztStepObj); } void SizingLog::SetupNewEnvironment(int const seedEnvrnNum, int const newEnvrnNum) @@ -298,8 +288,7 @@ void SizingLog::SetupNewEnvironment(int const seedEnvrnNum, int const newEnvrnNu int SizingLoggerFramework::SetupVariableSizingLog(EnergyPlusData &state, Real64 &rVariable, int stepsInAverage) { - int VectorLength(0); - int constexpr HoursPerDay(24); + int constexpr HoursPerDay = 24; SizingLog tmpLog(rVariable); tmpLog.NumOfEnvironmentsInLogSet = 0; @@ -323,10 +312,10 @@ int SizingLoggerFramework::SetupVariableSizingLog(EnergyPlusData &state, Real64 for (int i = 1; i <= state.dataWeather->NumOfEnvrn; ++i) { if (state.dataWeather->Environment(i).KindOfEnvrn == Constant::KindOfSim::DesignDay) { - tmpLog.ztStepCountByEnvrnMap[i] = HoursPerDay * state.dataGlobal->NumOfTimeStepInHour; + tmpLog.ztStepCountByEnvrnMap[i] = HoursPerDay * state.dataGlobal->TimeStepsInHour; } if (state.dataWeather->Environment(i).KindOfEnvrn == Constant::KindOfSim::RunPeriodDesign) { - tmpLog.ztStepCountByEnvrnMap[i] = HoursPerDay * state.dataGlobal->NumOfTimeStepInHour * state.dataWeather->Environment(i).TotalDays; + tmpLog.ztStepCountByEnvrnMap[i] = HoursPerDay * state.dataGlobal->TimeStepsInHour * state.dataWeather->Environment(i).TotalDays; } } @@ -340,7 +329,7 @@ int SizingLoggerFramework::SetupVariableSizingLog(EnergyPlusData &state, Real64 tmpLog.timeStepsInAverage = stepsInAverage; - VectorLength = stepSum; + int VectorLength = stepSum; tmpLog.NumOfStepsInLogSet = VectorLength; tmpLog.ztStepObj.resize(VectorLength); @@ -364,7 +353,7 @@ ZoneTimestepObject SizingLoggerFramework::PrepareZoneTimestepStamp(EnergyPlusDat // prepare current timing data once and then pass into fill routines // function used by both zone and system frequency log updates - int locDayOfSim(1); + int locDayOfSim; if (state.dataGlobal->WarmupFlag) { // DayOfSim not okay during warmup, keeps incrementing up during warmup days locDayOfSim = 1; @@ -379,16 +368,14 @@ ZoneTimestepObject SizingLoggerFramework::PrepareZoneTimestepStamp(EnergyPlusDat state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, *state.dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::Zone].TimeStep, - state.dataGlobal->NumOfTimeStepInHour); + state.dataGlobal->TimeStepsInHour); return tmpztStepStamp; } void SizingLoggerFramework::UpdateSizingLogValuesZoneStep(EnergyPlusData &state) { - ZoneTimestepObject tmpztStepStamp; - - tmpztStepStamp = PrepareZoneTimestepStamp(state); + ZoneTimestepObject tmpztStepStamp = PrepareZoneTimestepStamp(state); for (auto &l : logObjs) { l.FillZoneStep(tmpztStepStamp); @@ -397,12 +384,10 @@ void SizingLoggerFramework::UpdateSizingLogValuesZoneStep(EnergyPlusData &state) void SizingLoggerFramework::UpdateSizingLogValuesSystemStep(EnergyPlusData &state) { - Real64 constexpr MinutesPerHour(60.0); - ZoneTimestepObject tmpztStepStamp; + Real64 constexpr MinutesPerHour = 60.0; + ZoneTimestepObject tmpztStepStamp = PrepareZoneTimestepStamp(state); SystemTimestepObject tmpSysStepStamp; - tmpztStepStamp = PrepareZoneTimestepStamp(state); - // prepare system timestep stamp tmpSysStepStamp.CurMinuteEnd = state.dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::System].CurMinute; if (tmpSysStepStamp.CurMinuteEnd == 0.0) { @@ -538,7 +523,7 @@ void PlantCoinicidentAnalysis::ResolveDesignFlowRate(EnergyPlusData &state, int } } - // add a seperate eio summary report about what happened, did demand trap get used, what were the key values. + // add a separate eio summary report about what happened, did demand trap get used, what were the key values. if (!state.dataGlobal->sizingAnalysisEioHeaderDoneOnce) { print(state.files.eio, "{}", diff --git a/src/EnergyPlus/SizingAnalysisObjects.hh b/src/EnergyPlus/SizingAnalysisObjects.hh index 52c20c35990..c9e3378e2b2 100644 --- a/src/EnergyPlus/SizingAnalysisObjects.hh +++ b/src/EnergyPlus/SizingAnalysisObjects.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/SizingManager.cc b/src/EnergyPlus/SizingManager.cc index 0b76cbd122e..4b1d3a2dfd4 100644 --- a/src/EnergyPlus/SizingManager.cc +++ b/src/EnergyPlus/SizingManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -86,12 +86,9 @@ namespace EnergyPlus::SizingManager { // MODULE INFORMATION: // AUTHOR Fred Buhl // DATE WRITTEN December 2000 -// MODIFIED na -// RE-ENGINEERED na // PURPOSE OF THIS MODULE: -// This module contains the data and routines relating to managing the sizing -// simulations. +// This module contains the data and routines relating to managing the sizing simulations. // Using/Aliasing using namespace HeatBalanceManager; @@ -118,7 +115,7 @@ void ManageSizing(EnergyPlusData &state) // DATE WRITTEN December 2000 // PURPOSE OF THIS SUBROUTINE: - // This subroutine manages the sizing simulations (using design day condiions) + // This subroutine manages the sizing simulations (using design day conditions) // for zones, central air systems, and central plants and zone heating and cooling // METHODOLOGY EMPLOYED: @@ -127,9 +124,6 @@ void ManageSizing(EnergyPlusData &state) // Design day simulations are run again with central air systems supplied by // purchased hot and cold water, yielding central heating and cooling capacities. - auto &CalcSysSizing = state.dataSize->CalcSysSizing; - auto &SysSizPeakDDNum = state.dataSize->SysSizPeakDDNum; - // Using/Aliasing using SimAirServingZones::ManageAirLoops; using SimAirServingZones::UpdateSysSizing; @@ -155,15 +149,11 @@ void ManageSizing(EnergyPlusData &state) int TimeStepInDay(0); // time step number int LastMonth(0); int LastDayOfMonth(0); - int AirLoopNum(0); // air loop index std::string curName; int NumSizingPeriodsPerformed; int numZoneSizeIter; // number of times to repeat zone sizing calcs. 1 normal, 2 load component reporting - int iZoneCalcIter; // index for repeating the zone sizing calcs bool isUserReqCompLoadReport; - auto &FinalSysSizing = state.dataSize->FinalSysSizing; - TimeStepInDay = 0; state.dataSize->SysSizingRunDone = false; state.dataSize->ZoneSizingRunDone = false; @@ -172,7 +162,7 @@ void ManageSizing(EnergyPlusData &state) GetZoneAirDistribution(state); // get zone air distribution objects GetZoneHVACSizing(state); // get zone HVAC sizing object GetAirTerminalSizing(state); // get air terminal sizing object - GetSizingParams(state); // get the building level sizing paramets + GetSizingParams(state); // get the building level sizing parameters GetZoneSizingInput(state); // get the Zone Sizing input GetSystemSizingInput(state); // get the System Sizing input GetPlantSizingInput(state); // get the Plant Sizing input @@ -225,9 +215,6 @@ void ManageSizing(EnergyPlusData &state) if ((state.dataSize->NumZoneSizingInput > 0) && (state.dataGlobal->DoZoneSizing || state.dataGlobal->DoSystemSizing || state.dataGlobal->DoPlantSizing)) { - if (state.dataGlobal->DoDesDaySim || state.dataGlobal->DoWeathSim) { - state.dataGlobal->DoOutputReporting = false; - } state.dataGlobal->DoOutputReporting = false; state.dataGlobal->ZoneSizingCalc = true; Available = true; @@ -258,7 +245,7 @@ void ManageSizing(EnergyPlusData &state) SetupZoneSizing(state, ErrorsFound); // Should only be done ONCE state.dataGlobal->KickOffSizing = false; - for (iZoneCalcIter = 1; iZoneCalcIter <= numZoneSizeIter; ++iZoneCalcIter) { // normally this is performed once but if load component + for (int iZoneCalcIter = 1; iZoneCalcIter <= numZoneSizeIter; ++iZoneCalcIter) { // normally this is performed once but if load component // report is requested, these are repeated with a pulse in // each zone. @@ -334,12 +321,13 @@ void ManageSizing(EnergyPlusData &state) UpdateFacilitySizing(state, Constant::CallIndicator::BeginDay); } - for (state.dataGlobal->HourOfDay = 1; state.dataGlobal->HourOfDay <= 24; ++state.dataGlobal->HourOfDay) { // Begin hour loop ... + for (state.dataGlobal->HourOfDay = 1; state.dataGlobal->HourOfDay <= Constant::iHoursInDay; + ++state.dataGlobal->HourOfDay) { // Begin hour loop ... state.dataGlobal->BeginHourFlag = true; state.dataGlobal->EndHourFlag = false; - for (state.dataGlobal->TimeStep = 1; state.dataGlobal->TimeStep <= state.dataGlobal->NumOfTimeStepInHour; + for (state.dataGlobal->TimeStep = 1; state.dataGlobal->TimeStep <= state.dataGlobal->TimeStepsInHour; ++state.dataGlobal->TimeStep) { // Begin time step (TINC) loop ... state.dataGlobal->BeginTimeStepFlag = true; @@ -351,9 +339,9 @@ void ManageSizing(EnergyPlusData &state) // Note also that BeginTimeStepFlag, EndTimeStepFlag, and the // SubTimeStepFlags can/will be set/reset in the HVAC Manager. - if (state.dataGlobal->TimeStep == state.dataGlobal->NumOfTimeStepInHour) { + if (state.dataGlobal->TimeStep == state.dataGlobal->TimeStepsInHour) { state.dataGlobal->EndHourFlag = true; - if (state.dataGlobal->HourOfDay == 24) { + if (state.dataGlobal->HourOfDay == Constant::iHoursInDay) { state.dataGlobal->EndDayFlag = true; if ((!state.dataGlobal->WarmupFlag) && (state.dataGlobal->DayOfSim == state.dataGlobal->NumOfDayInEnvrn)) { state.dataGlobal->EndEnvrnFlag = true; @@ -372,8 +360,7 @@ void ManageSizing(EnergyPlusData &state) Weather::ManageWeather(state); if (!state.dataGlobal->WarmupFlag) { - TimeStepInDay = - (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; + TimeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->TimeStepsInHour + state.dataGlobal->TimeStep; if (state.dataGlobal->HourOfDay == 1 && state.dataGlobal->TimeStep == 1) { state.dataSize->DesDayWeath(state.dataSize->CurOverallSimDay).DateString = fmt::format("{}/{}", state.dataEnvrn->Month, state.dataEnvrn->DayOfMonth); @@ -518,12 +505,13 @@ void ManageSizing(EnergyPlusData &state) UpdateSysSizing(state, Constant::CallIndicator::BeginDay); } - for (state.dataGlobal->HourOfDay = 1; state.dataGlobal->HourOfDay <= 24; ++state.dataGlobal->HourOfDay) { // Begin hour loop ... + for (state.dataGlobal->HourOfDay = 1; state.dataGlobal->HourOfDay <= Constant::iHoursInDay; + ++state.dataGlobal->HourOfDay) { // Begin hour loop ... state.dataGlobal->BeginHourFlag = true; state.dataGlobal->EndHourFlag = false; - for (state.dataGlobal->TimeStep = 1; state.dataGlobal->TimeStep <= state.dataGlobal->NumOfTimeStepInHour; + for (state.dataGlobal->TimeStep = 1; state.dataGlobal->TimeStep <= state.dataGlobal->TimeStepsInHour; ++state.dataGlobal->TimeStep) { // Begin time step (TINC) loop ... state.dataGlobal->BeginTimeStepFlag = true; @@ -533,9 +521,9 @@ void ManageSizing(EnergyPlusData &state) // .TRUE. unless EndHourFlag is also .TRUE., etc. Note that the // EndEnvrnFlag and the EndSimFlag cannot be set during warmup. - if (state.dataGlobal->TimeStep == state.dataGlobal->NumOfTimeStepInHour) { + if (state.dataGlobal->TimeStep == state.dataGlobal->TimeStepsInHour) { state.dataGlobal->EndHourFlag = true; - if (state.dataGlobal->HourOfDay == 24) { + if (state.dataGlobal->HourOfDay == Constant::iHoursInDay) { state.dataGlobal->EndDayFlag = true; if ((!state.dataGlobal->WarmupFlag) && (state.dataGlobal->DayOfSim == state.dataGlobal->NumOfDayInEnvrn)) { state.dataGlobal->EndEnvrnFlag = true; @@ -623,23 +611,23 @@ void ManageSizing(EnergyPlusData &state) } if (state.dataSize->SysSizingRunDone) { - for (AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) { - curName = FinalSysSizing(AirLoopNum).AirPriLoopName; - PreDefTableEntry(state, state.dataOutRptPredefined->pdchSysSizCalcClAir, curName, CalcSysSizing(AirLoopNum).DesCoolVolFlow); - if (std::abs(CalcSysSizing(AirLoopNum).DesCoolVolFlow) <= 1.e-8) { - ShowWarningError(state, - format("{}Calculated Cooling Design Air Flow Rate for System={} is zero.", - RoutineName, - FinalSysSizing(AirLoopNum).AirPriLoopName)); + for (int AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) { + auto &calcSysSizing = state.dataSize->CalcSysSizing(AirLoopNum); + auto &sysSizPeakDDNum = state.dataSize->SysSizPeakDDNum(AirLoopNum); + auto &finalSysSizing = state.dataSize->FinalSysSizing(AirLoopNum); + + curName = finalSysSizing.AirPriLoopName; + PreDefTableEntry(state, state.dataOutRptPredefined->pdchSysSizCalcClAir, curName, calcSysSizing.DesCoolVolFlow); + if (std::abs(calcSysSizing.DesCoolVolFlow) <= 1.e-8) { + ShowWarningError( + state, format("{}Calculated Cooling Design Air Flow Rate for System={} is zero.", RoutineName, finalSysSizing.AirPriLoopName)); ShowContinueError(state, "Check Sizing:Zone and ZoneControl:Thermostat inputs."); } - PreDefTableEntry(state, state.dataOutRptPredefined->pdchSysSizUserClAir, curName, FinalSysSizing(AirLoopNum).DesCoolVolFlow); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchSysSizCalcHtAir, curName, CalcSysSizing(AirLoopNum).DesHeatVolFlow); - if (std::abs(CalcSysSizing(AirLoopNum).DesHeatVolFlow) <= 1.e-8) { - ShowWarningError(state, - format("{}Calculated Heating Design Air Flow Rate for System={} is zero.", - RoutineName, - FinalSysSizing(AirLoopNum).AirPriLoopName)); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchSysSizUserClAir, curName, finalSysSizing.DesCoolVolFlow); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchSysSizCalcHtAir, curName, calcSysSizing.DesHeatVolFlow); + if (std::abs(calcSysSizing.DesHeatVolFlow) <= 1.e-8) { + ShowWarningError( + state, format("{}Calculated Heating Design Air Flow Rate for System={} is zero.", RoutineName, finalSysSizing.AirPriLoopName)); ShowContinueError(state, "Check Sizing:Zone and ZoneControl:Thermostat inputs."); } std::string_view coolPeakLoadKind; @@ -647,22 +635,22 @@ void ManageSizing(EnergyPlusData &state) int coolPeakDD = 0; Real64 coolCap = 0.; int timeStepIndexAtPeakCoolLoad = 0; - if (FinalSysSizing(AirLoopNum).coolingPeakLoad == DataSizing::PeakLoad::SensibleCooling) { + if (finalSysSizing.coolingPeakLoad == DataSizing::PeakLoad::SensibleCooling) { coolPeakLoadKind = "Sensible"; - coolPeakDDDate = SysSizPeakDDNum(AirLoopNum).cSensCoolPeakDDDate; - coolPeakDD = SysSizPeakDDNum(AirLoopNum).SensCoolPeakDD; - coolCap = FinalSysSizing(AirLoopNum).SensCoolCap; - if (coolPeakDD > 0) timeStepIndexAtPeakCoolLoad = SysSizPeakDDNum(AirLoopNum).TimeStepAtSensCoolPk(coolPeakDD); - } else if (FinalSysSizing(AirLoopNum).coolingPeakLoad == DataSizing::PeakLoad::TotalCooling) { - if (FinalSysSizing(AirLoopNum).loadSizingType == DataSizing::LoadSizing::Latent && state.dataHeatBal->DoLatentSizing) { + coolPeakDDDate = sysSizPeakDDNum.cSensCoolPeakDDDate; + coolPeakDD = sysSizPeakDDNum.SensCoolPeakDD; + coolCap = finalSysSizing.SensCoolCap; + if (coolPeakDD > 0) timeStepIndexAtPeakCoolLoad = sysSizPeakDDNum.TimeStepAtSensCoolPk(coolPeakDD); + } else if (finalSysSizing.coolingPeakLoad == DataSizing::PeakLoad::TotalCooling) { + if (finalSysSizing.loadSizingType == DataSizing::LoadSizing::Latent && state.dataHeatBal->DoLatentSizing) { coolPeakLoadKind = "Total Based on Latent"; } else { coolPeakLoadKind = "Total"; } - coolPeakDDDate = SysSizPeakDDNum(AirLoopNum).cTotCoolPeakDDDate; - coolPeakDD = SysSizPeakDDNum(AirLoopNum).TotCoolPeakDD; - coolCap = FinalSysSizing(AirLoopNum).TotCoolCap; - if (coolPeakDD > 0) timeStepIndexAtPeakCoolLoad = SysSizPeakDDNum(AirLoopNum).TimeStepAtTotCoolPk(coolPeakDD); + coolPeakDDDate = sysSizPeakDDNum.cTotCoolPeakDDDate; + coolPeakDD = sysSizPeakDDNum.TotCoolPeakDD; + coolCap = finalSysSizing.TotCoolCap; + if (coolPeakDD > 0) timeStepIndexAtPeakCoolLoad = sysSizPeakDDNum.TimeStepAtTotCoolPk(coolPeakDD); } if (coolPeakDD > 0) { ReportSysSizing(state, @@ -670,9 +658,9 @@ void ManageSizing(EnergyPlusData &state) "Cooling", coolPeakLoadKind, coolCap, - CalcSysSizing(AirLoopNum).DesCoolVolFlow, - FinalSysSizing(AirLoopNum).DesCoolVolFlow, - FinalSysSizing(AirLoopNum).CoolDesDay, + calcSysSizing.DesCoolVolFlow, + finalSysSizing.DesCoolVolFlow, + finalSysSizing.CoolDesDay, coolPeakDDDate, timeStepIndexAtPeakCoolLoad); } else { @@ -681,37 +669,37 @@ void ManageSizing(EnergyPlusData &state) "Cooling", coolPeakLoadKind, coolCap, - CalcSysSizing(AirLoopNum).DesCoolVolFlow, - FinalSysSizing(AirLoopNum).DesCoolVolFlow, - FinalSysSizing(AirLoopNum).CoolDesDay, + calcSysSizing.DesCoolVolFlow, + finalSysSizing.DesCoolVolFlow, + finalSysSizing.CoolDesDay, coolPeakDDDate, 0); } - int heatPeakDD = SysSizPeakDDNum(AirLoopNum).HeatPeakDD; + int heatPeakDD = sysSizPeakDDNum.HeatPeakDD; if (heatPeakDD > 0) { ReportSysSizing(state, curName, "Heating", "Sensible", - FinalSysSizing(AirLoopNum).HeatCap, - CalcSysSizing(AirLoopNum).DesHeatVolFlow, - FinalSysSizing(AirLoopNum).DesHeatVolFlow, - FinalSysSizing(AirLoopNum).HeatDesDay, - SysSizPeakDDNum(AirLoopNum).cHeatPeakDDDate, - SysSizPeakDDNum(AirLoopNum).TimeStepAtHeatPk(heatPeakDD)); + finalSysSizing.HeatCap, + calcSysSizing.DesHeatVolFlow, + finalSysSizing.DesHeatVolFlow, + finalSysSizing.HeatDesDay, + sysSizPeakDDNum.cHeatPeakDDDate, + sysSizPeakDDNum.TimeStepAtHeatPk(heatPeakDD)); } else { ReportSysSizing(state, curName, "Heating", "Sensible", - FinalSysSizing(AirLoopNum).HeatCap, - CalcSysSizing(AirLoopNum).DesHeatVolFlow, - FinalSysSizing(AirLoopNum).DesHeatVolFlow, - FinalSysSizing(AirLoopNum).HeatDesDay, - SysSizPeakDDNum(AirLoopNum).cHeatPeakDDDate, + finalSysSizing.HeatCap, + calcSysSizing.DesHeatVolFlow, + finalSysSizing.DesHeatVolFlow, + finalSysSizing.HeatDesDay, + sysSizPeakDDNum.cHeatPeakDDDate, 0); } - PreDefTableEntry(state, state.dataOutRptPredefined->pdchSysSizUserHtAir, curName, FinalSysSizing(AirLoopNum).DesHeatVolFlow); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchSysSizUserHtAir, curName, finalSysSizing.DesHeatVolFlow); } // Deallocate arrays no longer needed state.dataSize->SysSizing.deallocate(); @@ -744,7 +732,7 @@ void ManageSizing(EnergyPlusData &state) } } -bool CalcdoLoadComponentPulseNow(EnergyPlusData &state, +bool CalcdoLoadComponentPulseNow(EnergyPlusData const &state, bool const isPulseZoneSizing, bool const WarmupFlag, int const HourOfDay, @@ -778,8 +766,6 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) // Also store zone level flow information for Standard 62.1 calculations, Vpz, Vpz_min, Vdz, and Vdz_min for both cooling and heating - auto &AirDistUnit = state.dataDefineEquipment->AirDistUnit; - auto &FinalSysSizing = state.dataSize->FinalSysSizing; auto &sd_airterminal = state.dataSingleDuct->sd_airterminal; if ((state.dataSize->NumSysSizInput > 0) && (state.dataGlobal->DoSystemSizing)) { // only if there is system sizing @@ -792,6 +778,7 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) state.dataGlobal->BeginEnvrnFlag = false; for (int AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) { + auto &finalSysSizing = state.dataSize->FinalSysSizing(AirLoopNum); // Mine data from ATUs to find new design heating flow rates and new maximum flow rates Real64 airLoopMaxFlowRateSum(0.0); Real64 airLoopHeatingMinimumFlowRateSum(0.0); @@ -800,8 +787,9 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) // sum up heating and max flows for any single duct systems, store 62.1 values by zone if (allocated(sd_airterminal) && state.dataSingleDuct->NumSDAirTerminal > 0) { for (int singleDuctATUNum = 1; singleDuctATUNum <= state.dataSingleDuct->NumSDAirTerminal; ++singleDuctATUNum) { + auto const &airDistUnit = state.dataDefineEquipment->AirDistUnit(sd_airterminal(singleDuctATUNum).ADUNum); if (AirLoopNum == sd_airterminal(singleDuctATUNum).AirLoopNum) { - int termUnitSizingIndex = AirDistUnit(sd_airterminal(singleDuctATUNum).ADUNum).TermUnitSizingNum; + int termUnitSizingIndex = airDistUnit.TermUnitSizingNum; airLoopMaxFlowRateSum += sd_airterminal(singleDuctATUNum).MaxAirVolFlowRate; state.dataSize->VpzClgByZone(termUnitSizingIndex) = @@ -871,7 +859,8 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) if (allocated(state.dataDualDuct->dd_airterminal) && state.dataDualDuct->NumDDAirTerminal > 0) { for (int dualDuctATUNum = 1; dualDuctATUNum <= state.dataDualDuct->NumDDAirTerminal; ++dualDuctATUNum) { if (AirLoopNum == state.dataDualDuct->dd_airterminal(dualDuctATUNum).AirLoopNum) { - int termUnitSizingIndex = AirDistUnit(state.dataDualDuct->dd_airterminal(dualDuctATUNum).ADUNum).TermUnitSizingNum; + auto const &airDistUnit = state.dataDefineEquipment->AirDistUnit(state.dataDualDuct->dd_airterminal(dualDuctATUNum).ADUNum); + int termUnitSizingIndex = airDistUnit.TermUnitSizingNum; airLoopMaxFlowRateSum += state.dataDualDuct->dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate; state.dataSize->VpzClgByZone(termUnitSizingIndex) = state.dataDualDuct->dd_airterminal(dualDuctATUNum).MaxAirVolFlowRate; // store std 62.1 value @@ -936,8 +925,9 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) // sum up heating and max flows for any PIU air terminals if (allocated(state.dataPowerInductionUnits->PIU) && state.dataPowerInductionUnits->NumPIUs > 0) { for (int pIUATUNum = 1; pIUATUNum <= state.dataPowerInductionUnits->NumPIUs; ++pIUATUNum) { + auto const &airDistUnit = state.dataDefineEquipment->AirDistUnit(state.dataPowerInductionUnits->PIU(pIUATUNum).ADUNum); if (AirLoopNum == state.dataPowerInductionUnits->PIU(pIUATUNum).AirLoopNum) { - int termUnitSizingIndex = AirDistUnit(state.dataPowerInductionUnits->PIU(pIUATUNum).ADUNum).TermUnitSizingNum; + int termUnitSizingIndex = airDistUnit.TermUnitSizingNum; auto &thisTermUnitFinalZoneSizing = state.dataSize->TermUnitFinalZoneSizing(termUnitSizingIndex); airLoopMaxFlowRateSum += state.dataPowerInductionUnits->PIU(pIUATUNum).MaxPriAirVolFlow; if (state.dataPowerInductionUnits->PIU(pIUATUNum).UnitType_Num == @@ -988,7 +978,7 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) state.dataPowerInductionUnits->PIU(pIUATUNum).MaxPriAirVolFlow; state.dataSize->VdzClgByZone(termUnitSizingIndex) = state.dataPowerInductionUnits->PIU(pIUATUNum) - .MaxPriAirVolFlow; // for Parallel PIU expect Fan off durign max cooling, so discharge is all primary + .MaxPriAirVolFlow; // for Parallel PIU expect Fan off during max cooling, so discharge is all primary state.dataSize->VdzMinClgByZone(termUnitSizingIndex) = state.dataPowerInductionUnits->PIU(pIUATUNum).MinPriAirFlowFrac * state.dataPowerInductionUnits->PIU(pIUATUNum).MaxPriAirVolFlow + @@ -1027,8 +1017,9 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) // dual path for std 62.1 if (allocated(IndUnit) && (NumIndUnits > 0)) { for (int indUnitNum = 1; indUnitNum <= NumIndUnits; ++indUnitNum) { + auto const &airDistUnit = state.dataDefineEquipment->AirDistUnit(IndUnit(indUnitNum).ADUNum); if (AirLoopNum == IndUnit(indUnitNum).AirLoopNum) { - int termUnitSizingIndex = AirDistUnit(IndUnit(indUnitNum).ADUNum).TermUnitSizingNum; + int termUnitSizingIndex = airDistUnit.TermUnitSizingNum; airLoopHeatingMaximumFlowRateSum += IndUnit(indUnitNum).MaxPriAirMassFlow / state.dataEnvrn->StdRhoAir; airLoopHeatingMinimumFlowRateSum += IndUnit(indUnitNum).MaxPriAirMassFlow / state.dataEnvrn->StdRhoAir; airLoopMaxFlowRateSum += IndUnit(indUnitNum).MaxPriAirMassFlow / state.dataEnvrn->StdRhoAir; @@ -1048,8 +1039,9 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) // sum up heating and max flows for any two pipe constant volume cooled beam terminal units if (allocated(state.dataHVACCooledBeam->CoolBeam) && (state.dataHVACCooledBeam->NumCB > 0)) { for (int coolBeamNum = 1; coolBeamNum <= state.dataHVACCooledBeam->NumCB; ++coolBeamNum) { + auto const &airDistUnit = state.dataDefineEquipment->AirDistUnit(state.dataHVACCooledBeam->CoolBeam(coolBeamNum).ADUNum); if (AirLoopNum == state.dataHVACCooledBeam->CoolBeam(coolBeamNum).AirLoopNum) { - int termUnitSizingIndex = AirDistUnit(state.dataHVACCooledBeam->CoolBeam(coolBeamNum).ADUNum).TermUnitSizingNum; + int termUnitSizingIndex = airDistUnit.TermUnitSizingNum; airLoopHeatingMaximumFlowRateSum += state.dataHVACCooledBeam->CoolBeam(coolBeamNum).MaxAirVolFlow; airLoopHeatingMinimumFlowRateSum += state.dataHVACCooledBeam->CoolBeam(coolBeamNum).MaxAirVolFlow; airLoopMaxFlowRateSum += state.dataHVACCooledBeam->CoolBeam(coolBeamNum).MaxAirVolFlow; @@ -1069,23 +1061,24 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) } // sum up heating and max flows for any four pipe cooled beam terminal units (the only one using the airTerminalPtr at this point) - if (allocated(AirDistUnit) && (int)state.dataDefineEquipment->AirDistUnit.size() > 0) { + if (allocated(state.dataDefineEquipment->AirDistUnit) && (int)state.dataDefineEquipment->AirDistUnit.size() > 0) { for (int aDUNum = 1; aDUNum <= (int)state.dataDefineEquipment->AirDistUnit.size(); ++aDUNum) { - if (AirDistUnit(aDUNum).airTerminalPtr.get() != nullptr) { - if (AirLoopNum == AirDistUnit(aDUNum).airTerminalPtr->getAirLoopNum()) { - airLoopHeatingMaximumFlowRateSum += AirDistUnit(aDUNum).airTerminalPtr->getPrimAirDesignVolFlow(); - airLoopHeatingMinimumFlowRateSum += AirDistUnit(aDUNum).airTerminalPtr->getPrimAirDesignVolFlow(); - airLoopMaxFlowRateSum += AirDistUnit(aDUNum).airTerminalPtr->getPrimAirDesignVolFlow(); + auto &airDistUnit = state.dataDefineEquipment->AirDistUnit(aDUNum); + if (airDistUnit.airTerminalPtr.get() != nullptr) { + if (AirLoopNum == airDistUnit.airTerminalPtr->getAirLoopNum()) { + airLoopHeatingMaximumFlowRateSum += airDistUnit.airTerminalPtr->getPrimAirDesignVolFlow(); + airLoopHeatingMinimumFlowRateSum += airDistUnit.airTerminalPtr->getPrimAirDesignVolFlow(); + airLoopMaxFlowRateSum += airDistUnit.airTerminalPtr->getPrimAirDesignVolFlow(); // store Std 62.1 values, have no modeling of secondary flow rates for induced flow from beam - int termUnitSizingIndex = AirDistUnit(aDUNum).airTerminalPtr->getTermUnitSizingIndex(); - state.dataSize->VpzClgByZone(termUnitSizingIndex) = AirDistUnit(aDUNum).airTerminalPtr->getPrimAirDesignVolFlow(); - state.dataSize->VpzMinClgByZone(termUnitSizingIndex) = AirDistUnit(aDUNum).airTerminalPtr->getPrimAirDesignVolFlow(); - state.dataSize->VpzHtgByZone(termUnitSizingIndex) = AirDistUnit(aDUNum).airTerminalPtr->getPrimAirDesignVolFlow(); - state.dataSize->VpzMinHtgByZone(termUnitSizingIndex) = AirDistUnit(aDUNum).airTerminalPtr->getPrimAirDesignVolFlow(); - state.dataSize->VdzClgByZone(termUnitSizingIndex) = AirDistUnit(aDUNum).airTerminalPtr->getPrimAirDesignVolFlow(); - state.dataSize->VdzMinClgByZone(termUnitSizingIndex) = AirDistUnit(aDUNum).airTerminalPtr->getPrimAirDesignVolFlow(); - state.dataSize->VdzHtgByZone(termUnitSizingIndex) = AirDistUnit(aDUNum).airTerminalPtr->getPrimAirDesignVolFlow(); - state.dataSize->VdzMinHtgByZone(termUnitSizingIndex) = AirDistUnit(aDUNum).airTerminalPtr->getPrimAirDesignVolFlow(); + int termUnitSizingIndex = airDistUnit.airTerminalPtr->getTermUnitSizingIndex(); + state.dataSize->VpzClgByZone(termUnitSizingIndex) = airDistUnit.airTerminalPtr->getPrimAirDesignVolFlow(); + state.dataSize->VpzMinClgByZone(termUnitSizingIndex) = airDistUnit.airTerminalPtr->getPrimAirDesignVolFlow(); + state.dataSize->VpzHtgByZone(termUnitSizingIndex) = airDistUnit.airTerminalPtr->getPrimAirDesignVolFlow(); + state.dataSize->VpzMinHtgByZone(termUnitSizingIndex) = airDistUnit.airTerminalPtr->getPrimAirDesignVolFlow(); + state.dataSize->VdzClgByZone(termUnitSizingIndex) = airDistUnit.airTerminalPtr->getPrimAirDesignVolFlow(); + state.dataSize->VdzMinClgByZone(termUnitSizingIndex) = airDistUnit.airTerminalPtr->getPrimAirDesignVolFlow(); + state.dataSize->VdzHtgByZone(termUnitSizingIndex) = airDistUnit.airTerminalPtr->getPrimAirDesignVolFlow(); + state.dataSize->VdzMinHtgByZone(termUnitSizingIndex) = airDistUnit.airTerminalPtr->getPrimAirDesignVolFlow(); } } } @@ -1094,8 +1087,9 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) // sum up flows for any air terminal mixers if (allocated(state.dataSingleDuct->SysATMixer) && (state.dataSingleDuct->NumATMixers > 0)) { for (int aTMixerNum = 1; aTMixerNum <= state.dataSingleDuct->NumATMixers; ++aTMixerNum) { + auto const &airDistUnit = state.dataDefineEquipment->AirDistUnit(state.dataSingleDuct->SysATMixer(aTMixerNum).ADUNum); if (AirLoopNum == state.dataSingleDuct->SysATMixer(aTMixerNum).AirLoopNum) { - int termUnitSizingIndex = AirDistUnit(state.dataSingleDuct->SysATMixer(aTMixerNum).ADUNum).TermUnitSizingNum; + int termUnitSizingIndex = airDistUnit.TermUnitSizingNum; airLoopHeatingMaximumFlowRateSum += state.dataSingleDuct->SysATMixer(aTMixerNum).DesignPrimaryAirVolRate; airLoopHeatingMinimumFlowRateSum += state.dataSingleDuct->SysATMixer(aTMixerNum).DesignPrimaryAirVolRate; airLoopMaxFlowRateSum += state.dataSingleDuct->SysATMixer(aTMixerNum).DesignPrimaryAirVolRate; @@ -1113,7 +1107,7 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) } } - std::string curName = FinalSysSizing(AirLoopNum).AirPriLoopName; + std::string curName = finalSysSizing.AirPriLoopName; BaseSizer::reportSizerOutput( state, "AirLoopHVAC", curName, "Sum of Air Terminal Maximum Heating Flow Rates [m3/s]", airLoopHeatingMaximumFlowRateSum); BaseSizer::reportSizerOutput( @@ -1121,77 +1115,74 @@ void ManageSystemSizingAdjustments(EnergyPlusData &state) BaseSizer::reportSizerOutput(state, "AirLoopHVAC", curName, "Sum of Air Terminal Maximum Flow Rates [m3/s]", airLoopMaxFlowRateSum); // Adjust system sizing info - if (allocated(FinalSysSizing)) { + if (allocated(state.dataSize->FinalSysSizing)) { // correct sizing design heating volume flow rate based on finalized air terminal unit operation - if (FinalSysSizing(AirLoopNum).SizingOption == + if (finalSysSizing.SizingOption == DataSizing::SizingConcurrence::NonCoincident) { // If non-coincident sizing method for this air loop, the we can use these sum's // from // air terminals directly - FinalSysSizing(AirLoopNum).DesHeatVolFlow = max(airLoopHeatingMaximumFlowRateSum, FinalSysSizing(AirLoopNum).DesHeatVolFlow); - FinalSysSizing(AirLoopNum).DesMainVolFlow = max(airLoopMaxFlowRateSum, FinalSysSizing(AirLoopNum).DesMainVolFlow); - if (FinalSysSizing(AirLoopNum).sysSizeCoolingDominant) { - FinalSysSizing(AirLoopNum).DesCoolVolFlow = FinalSysSizing(AirLoopNum).DesMainVolFlow; - FinalSysSizing(AirLoopNum).MassFlowAtCoolPeak = FinalSysSizing(AirLoopNum).DesCoolVolFlow * state.dataEnvrn->StdRhoAir; - } else if (FinalSysSizing(AirLoopNum).sysSizeHeatingDominant) { // make sure cooling is at least at minimum. - FinalSysSizing(AirLoopNum).DesCoolVolFlow = max(airLoopHeatingMinimumFlowRateSum, FinalSysSizing(AirLoopNum).DesCoolVolFlow); - FinalSysSizing(AirLoopNum).MassFlowAtCoolPeak = FinalSysSizing(AirLoopNum).DesCoolVolFlow * state.dataEnvrn->StdRhoAir; + finalSysSizing.DesHeatVolFlow = max(airLoopHeatingMaximumFlowRateSum, finalSysSizing.DesHeatVolFlow); + finalSysSizing.DesMainVolFlow = max(airLoopMaxFlowRateSum, finalSysSizing.DesMainVolFlow); + if (finalSysSizing.sysSizeCoolingDominant) { + finalSysSizing.DesCoolVolFlow = finalSysSizing.DesMainVolFlow; + finalSysSizing.MassFlowAtCoolPeak = finalSysSizing.DesCoolVolFlow * state.dataEnvrn->StdRhoAir; + } else if (finalSysSizing.sysSizeHeatingDominant) { // make sure cooling is at least at minimum. + finalSysSizing.DesCoolVolFlow = max(airLoopHeatingMinimumFlowRateSum, finalSysSizing.DesCoolVolFlow); + finalSysSizing.MassFlowAtCoolPeak = finalSysSizing.DesCoolVolFlow * state.dataEnvrn->StdRhoAir; } - } else if (FinalSysSizing(AirLoopNum).SizingOption == DataSizing::SizingConcurrence::Coincident) { + } else if (finalSysSizing.SizingOption == DataSizing::SizingConcurrence::Coincident) { - if (FinalSysSizing(AirLoopNum).sysSizeCoolingDominant) { // use minimum heating flow sum from air terminals + if (finalSysSizing.sysSizeCoolingDominant) { // use minimum heating flow sum from air terminals // know that minimum heating flow is a hard minimum regardless of concurrence situation, so make sure that design is at // least that high. - FinalSysSizing(AirLoopNum).DesHeatVolFlow = max(airLoopHeatingMinimumFlowRateSum, FinalSysSizing(AirLoopNum).DesHeatVolFlow); - FinalSysSizing(AirLoopNum).DesMainVolFlow = max(airLoopHeatingMinimumFlowRateSum, FinalSysSizing(AirLoopNum).DesMainVolFlow); - FinalSysSizing(AirLoopNum).DesCoolVolFlow = FinalSysSizing(AirLoopNum).DesMainVolFlow; - FinalSysSizing(AirLoopNum).MassFlowAtCoolPeak = FinalSysSizing(AirLoopNum).DesCoolVolFlow * state.dataEnvrn->StdRhoAir; - } else if (FinalSysSizing(AirLoopNum).sysSizeHeatingDominant) { // use maximum heating flow sum from air terminals - FinalSysSizing(AirLoopNum).DesHeatVolFlow = max(airLoopHeatingMaximumFlowRateSum, FinalSysSizing(AirLoopNum).DesHeatVolFlow); - FinalSysSizing(AirLoopNum).DesMainVolFlow = max(airLoopHeatingMaximumFlowRateSum, FinalSysSizing(AirLoopNum).DesMainVolFlow); + finalSysSizing.DesHeatVolFlow = max(airLoopHeatingMinimumFlowRateSum, finalSysSizing.DesHeatVolFlow); + finalSysSizing.DesMainVolFlow = max(airLoopHeatingMinimumFlowRateSum, finalSysSizing.DesMainVolFlow); + finalSysSizing.DesCoolVolFlow = finalSysSizing.DesMainVolFlow; + finalSysSizing.MassFlowAtCoolPeak = finalSysSizing.DesCoolVolFlow * state.dataEnvrn->StdRhoAir; + } else if (finalSysSizing.sysSizeHeatingDominant) { // use maximum heating flow sum from air terminals + finalSysSizing.DesHeatVolFlow = max(airLoopHeatingMaximumFlowRateSum, finalSysSizing.DesHeatVolFlow); + finalSysSizing.DesMainVolFlow = max(airLoopHeatingMaximumFlowRateSum, finalSysSizing.DesMainVolFlow); // make sure cooling is at least at minimum. - FinalSysSizing(AirLoopNum).DesCoolVolFlow = max(airLoopHeatingMinimumFlowRateSum, FinalSysSizing(AirLoopNum).DesCoolVolFlow); - FinalSysSizing(AirLoopNum).MassFlowAtCoolPeak = FinalSysSizing(AirLoopNum).DesCoolVolFlow * state.dataEnvrn->StdRhoAir; + finalSysSizing.DesCoolVolFlow = max(airLoopHeatingMinimumFlowRateSum, finalSysSizing.DesCoolVolFlow); + finalSysSizing.MassFlowAtCoolPeak = finalSysSizing.DesCoolVolFlow * state.dataEnvrn->StdRhoAir; } } // report out adjusted design flow rates BaseSizer::reportSizerOutput( - state, "AirLoopHVAC", curName, "Adjusted Heating Design Air Flow Rate [m3/s]", FinalSysSizing(AirLoopNum).DesHeatVolFlow); + state, "AirLoopHVAC", curName, "Adjusted Heating Design Air Flow Rate [m3/s]", finalSysSizing.DesHeatVolFlow); OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchSysSizAdjustedHtAir, curName, FinalSysSizing(AirLoopNum).DesHeatVolFlow, 4); + state, state.dataOutRptPredefined->pdchSysSizAdjustedHtAir, curName, finalSysSizing.DesHeatVolFlow, 4); BaseSizer::reportSizerOutput( - state, "AirLoopHVAC", curName, "Adjusted Cooling Design Air Flow Rate [m3/s]", FinalSysSizing(AirLoopNum).DesCoolVolFlow); + state, "AirLoopHVAC", curName, "Adjusted Cooling Design Air Flow Rate [m3/s]", finalSysSizing.DesCoolVolFlow); OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchSysSizAdjustedClAir, curName, FinalSysSizing(AirLoopNum).DesCoolVolFlow, 4); + state, state.dataOutRptPredefined->pdchSysSizAdjustedClAir, curName, finalSysSizing.DesCoolVolFlow, 4); BaseSizer::reportSizerOutput( - state, "AirLoopHVAC", curName, "Adjusted Main Design Air Flow Rate [m3/s]", FinalSysSizing(AirLoopNum).DesMainVolFlow); + state, "AirLoopHVAC", curName, "Adjusted Main Design Air Flow Rate [m3/s]", finalSysSizing.DesMainVolFlow); OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchSysSizAdjustedMainAir, curName, FinalSysSizing(AirLoopNum).DesMainVolFlow, 4); + state, state.dataOutRptPredefined->pdchSysSizAdjustedMainAir, curName, finalSysSizing.DesMainVolFlow, 4); // Autosize central heating min system air flow rate, using corrected design heating flow, using maximum heating flow summation - if (FinalSysSizing(AirLoopNum).SysAirMinFlowRatWasAutoSized) { - if (FinalSysSizing(AirLoopNum).DesMainVolFlow > 0.0) { // protect div by zero - FinalSysSizing(AirLoopNum).SysAirMinFlowRat = - FinalSysSizing(AirLoopNum).DesHeatVolFlow / FinalSysSizing(AirLoopNum).DesMainVolFlow; + if (finalSysSizing.SysAirMinFlowRatWasAutoSized) { + if (finalSysSizing.DesMainVolFlow > 0.0) { // protect div by zero + finalSysSizing.SysAirMinFlowRat = finalSysSizing.DesHeatVolFlow / finalSysSizing.DesMainVolFlow; } else { // big trouble anyway. - FinalSysSizing(AirLoopNum).SysAirMinFlowRat = 1.0; + finalSysSizing.SysAirMinFlowRat = 1.0; } BaseSizer::reportSizerOutput( - state, "AirLoopHVAC", curName, "Calculated Heating Air Flow Ratio []", FinalSysSizing(AirLoopNum).SysAirMinFlowRat); + state, "AirLoopHVAC", curName, "Calculated Heating Air Flow Ratio []", finalSysSizing.SysAirMinFlowRat); OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchSysSizCalcHeatFlowRatio, curName, FinalSysSizing(AirLoopNum).SysAirMinFlowRat, 4); - BaseSizer::reportSizerOutput( - state, "AirLoopHVAC", curName, "User Heating Air Flow Ratio []", FinalSysSizing(AirLoopNum).SysAirMinFlowRat); + state, state.dataOutRptPredefined->pdchSysSizCalcHeatFlowRatio, curName, finalSysSizing.SysAirMinFlowRat, 4); + BaseSizer::reportSizerOutput(state, "AirLoopHVAC", curName, "User Heating Air Flow Ratio []", finalSysSizing.SysAirMinFlowRat); OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchSysSizUserHeatFlowRatio, curName, FinalSysSizing(AirLoopNum).SysAirMinFlowRat, 4); + state, state.dataOutRptPredefined->pdchSysSizUserHeatFlowRatio, curName, finalSysSizing.SysAirMinFlowRat, 4); } else { - BaseSizer::reportSizerOutput( - state, "AirLoopHVAC", curName, "User Heating Air Flow Ratio []", FinalSysSizing(AirLoopNum).SysAirMinFlowRat); + BaseSizer::reportSizerOutput(state, "AirLoopHVAC", curName, "User Heating Air Flow Ratio []", finalSysSizing.SysAirMinFlowRat); OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchSysSizUserHeatFlowRatio, curName, FinalSysSizing(AirLoopNum).SysAirMinFlowRat, 4); + state, state.dataOutRptPredefined->pdchSysSizUserHeatFlowRatio, curName, finalSysSizing.SysAirMinFlowRat, 4); Real64 calcSysAirMinFlowRat(0.0); - if (FinalSysSizing(AirLoopNum).DesMainVolFlow > 0.0) { // protect div by zero - calcSysAirMinFlowRat = FinalSysSizing(AirLoopNum).DesHeatVolFlow / FinalSysSizing(AirLoopNum).DesMainVolFlow; + if (finalSysSizing.DesMainVolFlow > 0.0) { // protect div by zero + calcSysAirMinFlowRat = finalSysSizing.DesHeatVolFlow / finalSysSizing.DesMainVolFlow; } BaseSizer::reportSizerOutput(state, "AirLoopHVAC", curName, "Calculated Heating Air Flow Ratio []", calcSysAirMinFlowRat); OutputReportPredefined::PreDefTableEntry( @@ -1278,7 +1269,7 @@ void ManageSystemVentilationAdjustments(EnergyPlusData &state) } // Fill Vps for cooling VRP calculation, use cooling design flow rate as adjusted in ManageSystemSizingAdjustments ( to use - // conincident sizing result if available for block air flow + // coincident sizing result if available for block air flow state.dataSize->VpsClgBySys(AirLoopNum) = FinalSysSizing(AirLoopNum).DesCoolVolFlow; // Fill Vps for heating VRP calculation, use heating min by zone from air terminal scan in ManageSystemSizingAdjustments @@ -1341,9 +1332,9 @@ void ManageSystemVentilationAdjustments(EnergyPlusData &state) Real64 Ez_Clg = thisTermUnitFinalZoneSizing.ZoneADEffCooling; // user input in Zone Air Distribution design spec object Real64 Fc_Clg = 1.0 - (1.0 - Ez_Clg) * (1.0 - Er) * (1 - Ep_Clg); state.dataSize->FcByZoneCool(termUnitSizingIndex) = Fc_Clg; - state.dataSize->EvzByZoneCool(termUnitSizingIndex) = - (Fa_Clg + state.dataSize->XsBySysCool(AirLoopNum) * Fb_Clg - state.dataSize->ZdzClgByZone(termUnitSizingIndex) * Fc_Clg) / - Fa_Clg; + state.dataSize->EvzByZoneCool(termUnitSizingIndex) = (Fa_Clg + state.dataSize->XsBySysCool(AirLoopNum) * Fb_Clg - + state.dataSize->ZdzClgByZone(termUnitSizingIndex) * Ep_Clg * Fc_Clg) / + Fa_Clg; // note that SimAirServingZones::LimitZoneVentEff is intended only for single path per I/O ref // find Evz for heating @@ -1351,13 +1342,13 @@ void ManageSystemVentilationAdjustments(EnergyPlusData &state) Real64 Fa_Htg = Ep_Htg + (1.0 - Ep_Htg) * Er; state.dataSize->FaByZoneHeat(termUnitSizingIndex) = Fa_Htg; Real64 Fb_Htg = Ep_Htg; - state.dataSize->FbByZoneCool(termUnitSizingIndex) = Fb_Htg; + state.dataSize->FbByZoneHeat(termUnitSizingIndex) = Fb_Htg; Real64 Ez_Htg = thisTermUnitFinalZoneSizing.ZoneADEffHeating; // user input in Zone Air Distribution design spec object Real64 Fc_Htg = 1.0 - (1.0 - Ez_Htg) * (1.0 - Er) * (1 - Ep_Htg); state.dataSize->FcByZoneHeat(termUnitSizingIndex) = Fc_Htg; - state.dataSize->EvzByZoneHeat(termUnitSizingIndex) = - (Fa_Htg + state.dataSize->XsBySysHeat(AirLoopNum) * Fb_Htg - state.dataSize->ZdzHtgByZone(termUnitSizingIndex) * Fc_Htg) / - Fa_Htg; + state.dataSize->EvzByZoneHeat(termUnitSizingIndex) = (Fa_Htg + state.dataSize->XsBySysHeat(AirLoopNum) * Fb_Htg - + state.dataSize->ZdzHtgByZone(termUnitSizingIndex) * Ep_Htg * Fc_Htg) / + Fa_Htg; } else { // 62.1 ventilation rate procedure - single path zone state.dataSize->EvzByZoneCool(termUnitSizingIndex) = @@ -1422,7 +1413,7 @@ void ManageSystemVentilationAdjustments(EnergyPlusData &state) // redo VpzClgSumBySys( AirLoopNum ) with latest values, for reporting state.dataSize->VpzClgSumBySys(AirLoopNum) = 0.0; // Fill Vps for cooling VRP calculation, use cooling design flow rate as adjusted in ManageSystemSizingAdjustments ( to use - // conincident sizing result if available for block air flow + // coincident sizing result if available for block air flow state.dataSize->VpsClgBySys(AirLoopNum) = FinalSysSizing(AirLoopNum).DesCoolVolFlow; // Fill Vps for heating VRP calculation, use heating min by zone from air terminal scan in ManageSystemSizingAdjustments state.dataSize->VpsHtgBySys(AirLoopNum) = 0.0; @@ -2017,26 +2008,24 @@ void ManageSystemVentilationAdjustments(EnergyPlusData &state) void DetermineSystemPopulationDiversity(EnergyPlusData &state) { - auto &FinalSysSizing = state.dataSize->FinalSysSizing; - auto &SysSizInput = state.dataSize->SysSizInput; - // determine Pz sum, Ps, and D for each air system for standard 62.1 // first determine if any airloops use VRP, if not then don't need to march thru year of schedules for performance bool anyVRPinModel(false); for (int AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) { - if (FinalSysSizing(AirLoopNum).SystemOAMethod == SysOAMethod::VRP || FinalSysSizing(AirLoopNum).SystemOAMethod == SysOAMethod::SP) { + auto const &finalSysSizing = state.dataSize->FinalSysSizing(AirLoopNum); + if (finalSysSizing.SystemOAMethod == SysOAMethod::VRP || finalSysSizing.SystemOAMethod == SysOAMethod::SP) { anyVRPinModel = true; break; } } // First get the design (max) level of people in all zones connected to air loop for (int AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) { - int SysSizNum = - Util::FindItemInList(FinalSysSizing(AirLoopNum).AirPriLoopName, state.dataSize->SysSizInput, &SystemSizingInputData::AirPriLoopName); + auto const &finalSysSizing = state.dataSize->FinalSysSizing(AirLoopNum); + int SysSizNum = Util::FindItemInList(finalSysSizing.AirPriLoopName, state.dataSize->SysSizInput, &SystemSizingInputData::AirPriLoopName); if (SysSizNum == 0) SysSizNum = 1; // use first when none applicable // only retrieve data if the occupant density is set to be autosized - if (FinalSysSizing(AirLoopNum).OAAutoSized && SysSizInput(SysSizNum).OccupantDiversity == AutoSize) { + if (finalSysSizing.OAAutoSized && state.dataSize->SysSizInput(SysSizNum).OccupantDiversity == AutoSize) { auto &pzSumBySys = state.dataSize->PzSumBySys(AirLoopNum); pzSumBySys = 0.0; state.dataSize->PsBySys(AirLoopNum) = 0.0; @@ -2072,17 +2061,18 @@ void DetermineSystemPopulationDiversity(EnergyPlusData &state) state.dataEnvrn->DayOfWeek = dayOfWeekType; ++dayOfWeekType; if (dayOfWeekType > 7) dayOfWeekType = 1; - for (int hrOfDay = 1; hrOfDay <= 24; ++hrOfDay) { // loop over all hours in day - state.dataGlobal->HourOfDay = hrOfDay; // avoid crash in schedule manager - for (int TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { // loop over all timesteps in hour - state.dataGlobal->TimeStep = TS; // avoid crash in schedule manager + for (int hrOfDay = 1; hrOfDay <= Constant::iHoursInDay; ++hrOfDay) { // loop over all hours in day + state.dataGlobal->HourOfDay = hrOfDay; // avoid crash in schedule manager + for (int TS = 1; TS <= state.dataGlobal->TimeStepsInHour; ++TS) { // loop over all timesteps in hour + state.dataGlobal->TimeStep = TS; // avoid crash in schedule manager Real64 TSfraction(0.0); - if (state.dataGlobal->NumOfTimeStepInHour > 0.0) TSfraction = 1.0 / double(state.dataGlobal->NumOfTimeStepInHour); + if (state.dataGlobal->TimeStepsInHour > 0.0) TSfraction = 1.0 / double(state.dataGlobal->TimeStepsInHour); for (int AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) { // loop over all the air systems - int SysSizNum = Util::FindItemInList( - FinalSysSizing(AirLoopNum).AirPriLoopName, state.dataSize->SysSizInput, &SystemSizingInputData::AirPriLoopName); + auto const &finalSysSizing = state.dataSize->FinalSysSizing(AirLoopNum); + int SysSizNum = + Util::FindItemInList(finalSysSizing.AirPriLoopName, state.dataSize->SysSizInput, &SystemSizingInputData::AirPriLoopName); if (SysSizNum == 0) SysSizNum = 1; // use first when none applicable - if (FinalSysSizing(AirLoopNum).OAAutoSized && SysSizInput(SysSizNum).OccupantDiversity == AutoSize) { + if (finalSysSizing.OAAutoSized && state.dataSize->SysSizInput(SysSizNum).OccupantDiversity == AutoSize) { // Loop over all zones connected to air loop Real64 TotConcurrentPeopleOnSys = 0.0; @@ -2095,8 +2085,7 @@ void DetermineSystemPopulationDiversity(EnergyPlusData &state) (state.dataHeatBal->People(PeopleNum).NumberOfPeople * state.dataHeatBal->Zone(state.dataSize->FinalZoneSizing(CtrlZoneNum).ZoneNum).Multiplier * state.dataHeatBal->Zone(state.dataSize->FinalZoneSizing(CtrlZoneNum).ZoneNum).ListMultiplier); - Real64 schMultiplier = ScheduleManager::LookUpScheduleValue( - state, state.dataHeatBal->People(PeopleNum).NumberOfPeoplePtr, hrOfDay, TS); + Real64 schMultiplier = state.dataHeatBal->People(PeopleNum).sched->getHrTsVal(state, hrOfDay, TS); PeopleInZone = PeopleInZone * schMultiplier; TotConcurrentPeopleOnSys += PeopleInZone; } @@ -2119,7 +2108,7 @@ void DetermineSystemPopulationDiversity(EnergyPlusData &state) format("{:02}/{:02} {:02}:{:02}", Month, DayOfMonth, TimeHrsInt, TimeMinsInt); state.dataSize->PeakPsOccurrenceEnvironmentStringBySys(AirLoopNum) = "Full Year Schedule"; } - } // if autosizied and VRP + } // if autosized and VRP } // air loops } } @@ -2127,12 +2116,12 @@ void DetermineSystemPopulationDiversity(EnergyPlusData &state) // compute D for standard 62.1 by system for (int AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) { - int SysSizNum = - Util::FindItemInList(FinalSysSizing(AirLoopNum).AirPriLoopName, state.dataSize->SysSizInput, &SystemSizingInputData::AirPriLoopName); + auto const &finalSysSizing = state.dataSize->FinalSysSizing(AirLoopNum); + int SysSizNum = Util::FindItemInList(finalSysSizing.AirPriLoopName, state.dataSize->SysSizInput, &SystemSizingInputData::AirPriLoopName); if (SysSizNum == 0) SysSizNum = 1; // use first when none applicable // compute D if set to autosize - if (SysSizInput(SysSizNum).OccupantDiversity == AutoSize) { + if (state.dataSize->SysSizInput(SysSizNum).OccupantDiversity == AutoSize) { if (state.dataSize->PzSumBySys(AirLoopNum) > 0.0) { state.dataSize->DBySys(AirLoopNum) = state.dataSize->PsBySys(AirLoopNum) / state.dataSize->PzSumBySys(AirLoopNum); } else { @@ -2141,7 +2130,7 @@ void DetermineSystemPopulationDiversity(EnergyPlusData &state) state.dataSize->DBySys(AirLoopNum) = min(1.0, state.dataSize->DBySys(AirLoopNum)); } else { // set the occupant diversity based on user-specified value - state.dataSize->DBySys(AirLoopNum) = SysSizInput(SysSizNum).OccupantDiversity; + state.dataSize->DBySys(AirLoopNum) = state.dataSize->SysSizInput(SysSizNum).OccupantDiversity; } // For single zone systems, D should be 1.0. @@ -2151,7 +2140,7 @@ void DetermineSystemPopulationDiversity(EnergyPlusData &state) state, format("The {} air loop serves a single zone. The Occupant Diversity was calculated or set to a value less than 1.0. Single-zone air " "loops should have an Occupant Diversity of 1.0. The Occupant Diversity value for that air loop has been reset to 1.0", - FinalSysSizing(AirLoopNum).AirPriLoopName)); + finalSysSizing.AirPriLoopName)); } } } @@ -2172,17 +2161,11 @@ void GetOARequirements(EnergyPlusData &state) // This object requires only a name where the default values are assumed // if subsequent fields are not entered. - using ScheduleManager::CheckScheduleValueMinMax; - using ScheduleManager::GetScheduleIndex; - using ScheduleManager::GetScheduleMaxValue; - static constexpr std::string_view RoutineName("GetOARequirements: "); // include trailing blank space - int NumAlphas; // Number of Alphas for each GetObjectItem call - int NumNumbers; // Number of Numbers for each GetObjectItem call - int TotalArgs; // Total number of alpha and numeric arguments (max) for a - int IOStatus; // Used in GetObjectItem - bool ErrorsFound(false); // If errors detected in input + int NumAlphas; // Number of Alphas for each GetObjectItem call + int NumNumbers; // Number of Numbers for each GetObjectItem call + int TotalArgs; // Total number of alpha and numeric arguments (max) for a std::string CurrentModuleObject; // for ease in getting objects Array1D_string Alphas; // Alpha input items for object @@ -2207,6 +2190,8 @@ void GetOARequirements(EnergyPlusData &state) lNumericBlanks.dimension(NumNumbers, true); if (state.dataSize->NumOARequirements > 0) { + int IOStatus; // Used in GetObjectItem + bool ErrorsFound(false); // If errors detected in input state.dataSize->OARequirements.allocate(state.dataSize->NumOARequirements); // Start Loading the System Input @@ -2302,9 +2287,9 @@ void ProcessInputOARequirements(EnergyPlusData &state, std::string const &CurrentModuleObject, int const OAIndex, Array1D_string const &Alphas, - int &NumAlphas, + int const NumAlphas, Array1D const &Numbers, - int &NumNumbers, + int const NumNumbers, Array1D_bool const &lAlphaBlanks, Array1D_string const &cAlphaFields, bool &ErrorsFound // If errors found in input @@ -2314,8 +2299,6 @@ void ProcessInputOARequirements(EnergyPlusData &state, // SUBROUTINE INFORMATION: // AUTHOR R. Raustad - FSEC // DATE WRITTEN February 2010 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Obtains input data for the OA Requirements object and stores it in @@ -2326,25 +2309,10 @@ void ProcessInputOARequirements(EnergyPlusData &state, // This object requires only a name where the default values are assumed // if subsequent fields are not entered. - // REFERENCES: - // na - - using ScheduleManager::CheckScheduleValueMinMax; - using ScheduleManager::GetScheduleIndex; - using ScheduleManager::GetScheduleMaxValue; - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetOARequirements: "); // include trailing blank space + static constexpr std::string_view routineName = "GetOARequirements"; - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; auto &thisOARequirements(state.dataSize->OARequirements(OAIndex)); @@ -2406,41 +2374,23 @@ void ProcessInputOARequirements(EnergyPlusData &state, } // Set default schedule - state.dataSize->OARequirements(OAIndex).OAFlowFracSchPtr = ScheduleManager::ScheduleAlwaysOn; - if (NumAlphas > 2) { - if (!lAlphaBlanks(3)) { - state.dataSize->OARequirements(OAIndex).OAFlowFracSchPtr = GetScheduleIndex(state, Alphas(3)); - if (state.dataSize->OARequirements(OAIndex).OAFlowFracSchPtr > 0) { - if (!CheckScheduleValueMinMax(state, state.dataSize->OARequirements(OAIndex).OAFlowFracSchPtr, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{}{}=\"{}\",", RoutineName, CurrentModuleObject, state.dataSize->OARequirements(OAIndex).Name)); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFields(3), Alphas(3))); - ShowContinueError(state, "Schedule values must be (>=0., <=1.)"); - ErrorsFound = true; - } - } else { - ShowSevereError(state, format("{}{}=\"{}\",", RoutineName, CurrentModuleObject, state.dataSize->OARequirements(OAIndex).Name)); - ShowContinueError(state, format("...Not Found {}=\"{}\".", cAlphaFields(3), Alphas(3))); - ErrorsFound = true; - } - } + if (NumAlphas <= 2 || lAlphaBlanks(3)) { + state.dataSize->OARequirements(OAIndex).oaFlowFracSched = Sched::GetScheduleAlwaysOn(state); // Defaults to constant-1.0 + } else if ((state.dataSize->OARequirements(OAIndex).oaFlowFracSched = Sched::GetSchedule(state, Alphas(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(3), Alphas(3)); + ErrorsFound = true; + } else if (!state.dataSize->OARequirements(OAIndex).oaFlowFracSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFields(3), Alphas(3), Clusive::In, 0.0, Clusive::In, 1.0); + ErrorsFound = true; } - if (NumAlphas > 3) { - if (!lAlphaBlanks(4)) { - state.dataSize->OARequirements(OAIndex).OAPropCtlMinRateSchPtr = GetScheduleIndex(state, Alphas(4)); - if (state.dataSize->OARequirements(OAIndex).OAPropCtlMinRateSchPtr > 0) { - if (!CheckScheduleValueMinMax(state, state.dataSize->OARequirements(OAIndex).OAPropCtlMinRateSchPtr, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{}{}=\"{}\",", RoutineName, CurrentModuleObject, state.dataSize->OARequirements(OAIndex).Name)); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFields(4), Alphas(4))); - ShowContinueError(state, "Schedule values must be (>=0., <=1.)"); - ErrorsFound = true; - } - } else { - ShowSevereError(state, format("{}{}=\"{}\",", RoutineName, CurrentModuleObject, state.dataSize->OARequirements(OAIndex).Name)); - ShowContinueError(state, format("...Not Found {}=\"{}\".", cAlphaFields(4), Alphas(4))); - ErrorsFound = true; - } - } + if (NumAlphas <= 3 || lAlphaBlanks(4)) { + } else if ((state.dataSize->OARequirements(OAIndex).oaPropCtlMinRateSched = Sched::GetSchedule(state, Alphas(4))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(4), Alphas(4)); + ErrorsFound = true; + } else if (!state.dataSize->OARequirements(OAIndex).oaPropCtlMinRateSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFields(4), Alphas(4), Clusive::In, 0.0, Clusive::In, 1.0); + ErrorsFound = true; } } @@ -2450,8 +2400,6 @@ void GetZoneAirDistribution(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR T. Hong - LBNL // DATE WRITTEN March 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Obtains input data for the zone air distribution objects and stores it in @@ -2462,20 +2410,14 @@ void GetZoneAirDistribution(EnergyPlusData &state) // This object requires only a name where the default values are assumed // if subsequent fields are not entered. - // Using/Aliasing - using ScheduleManager::CheckScheduleValueMinMax; - using ScheduleManager::GetScheduleIndex; - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetZoneAirDistribution: "); // include trailing blank space + static constexpr std::string_view routineName = "GetZoneAirDistribution"; // include trailing blank space // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumAlphas; // Number of Alphas for each GetObjectItem call int NumNumbers; // Number of Numbers for each GetObjectItem call int TotalArgs; // Total number of alpha and numeric arguments (max) for a - int IOStatus; // Used in GetObjectItem - int ZADIndex; - bool ErrorsFound(false); // If errors detected in input std::string CurrentModuleObject; // for ease in getting objects Array1D_string Alphas; // Alpha input items for object @@ -2497,10 +2439,12 @@ void GetZoneAirDistribution(EnergyPlusData &state) lNumericBlanks.dimension(NumNumbers, true); if (state.dataSize->NumZoneAirDistribution > 0) { + int IOStatus; // Used in GetObjectItem + bool ErrorsFound(false); // If errors detected in input state.dataSize->ZoneAirDistribution.allocate(state.dataSize->NumZoneAirDistribution); // Start Loading the zone air distribution input - for (ZADIndex = 1; ZADIndex <= state.dataSize->NumZoneAirDistribution; ++ZADIndex) { + for (int ZADIndex = 1; ZADIndex <= state.dataSize->NumZoneAirDistribution; ++ZADIndex) { state.dataInputProcessing->inputProcessor->getObjectItem(state, CurrentModuleObject, @@ -2514,6 +2458,8 @@ void GetZoneAirDistribution(EnergyPlusData &state) lAlphaBlanks, cAlphaFields, cNumericFields); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; Util::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound); state.dataSize->ZoneAirDistribution(ZADIndex).Name = Alphas(1); @@ -2550,25 +2496,13 @@ void GetZoneAirDistribution(EnergyPlusData &state) state.dataSize->ZoneAirDistribution(ZADIndex).ZoneVentilationEff = 0.0; } - if (NumAlphas > 1) { - if (!lAlphaBlanks(2)) { - state.dataSize->ZoneAirDistribution(ZADIndex).ZoneADEffSchName = Alphas(2); - state.dataSize->ZoneAirDistribution(ZADIndex).ZoneADEffSchPtr = GetScheduleIndex(state, Alphas(2)); - if (state.dataSize->ZoneAirDistribution(ZADIndex).ZoneADEffSchPtr > 0) { - if (!CheckScheduleValueMinMax(state, state.dataSize->ZoneAirDistribution(ZADIndex).ZoneADEffSchPtr, false, 0.0)) { - ShowSevereError( - state, format("{}{}=\"{}\",", RoutineName, CurrentModuleObject, state.dataSize->ZoneAirDistribution(ZADIndex).Name)); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFields(2), Alphas(2))); - ShowContinueError(state, "Schedule values must be >0.0)"); - ErrorsFound = true; - } - } else { - ShowSevereError(state, - format("{}{}=\"{}\",", RoutineName, CurrentModuleObject, state.dataSize->ZoneAirDistribution(ZADIndex).Name)); - ShowContinueError(state, format("...Not Found {}=\"{}\".", cAlphaFields(2), Alphas(2))); - ErrorsFound = true; - } - } + if (NumAlphas <= 1 || lAlphaBlanks(2)) { + } else if ((state.dataSize->ZoneAirDistribution(ZADIndex).zoneADEffSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; + } else if (!state.dataSize->ZoneAirDistribution(ZADIndex).zoneADEffSched->checkMinVal(state, Clusive::Ex, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, cAlphaFields(2), Alphas(2), Clusive::Ex, 0.0); + ErrorsFound = true; } } @@ -2591,8 +2525,6 @@ void GetSizingParams(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Fred Buhl // DATE WRITTEN January 2002 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Obtains input data for the Sizing Parameters object and stores it in @@ -2601,17 +2533,14 @@ void GetSizingParams(EnergyPlusData &state) // METHODOLOGY EMPLOYED: // Uses InputProcessor "Get" routines to obtain data. - // Using/Aliasing - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumAlphas; // Number of Alphas for each GetObjectItem call int NumNumbers; // Number of Numbers for each GetObjectItem call int IOStatus; // Used in GetObjectItem - int NumSizParams; - int Temp; + auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; cCurrentModuleObject = "Sizing:Parameters"; - NumSizParams = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + int NumSizParams = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); if (NumSizParams == 1) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -2637,34 +2566,34 @@ void GetSizingParams(EnergyPlusData &state) state.dataSize->GlobalCoolSizingFactor = state.dataIPShortCut->rNumericArgs(2); } if (state.dataIPShortCut->lNumericFieldBlanks(3) || state.dataIPShortCut->rNumericArgs(3) <= 0.0) { - state.dataSize->NumTimeStepsInAvg = state.dataGlobal->NumOfTimeStepInHour; + state.dataSize->NumTimeStepsInAvg = state.dataGlobal->TimeStepsInHour; } else { state.dataSize->NumTimeStepsInAvg = int(state.dataIPShortCut->rNumericArgs(3)); } } else if (NumSizParams == 0) { state.dataSize->GlobalHeatSizingFactor = 1.0; state.dataSize->GlobalCoolSizingFactor = 1.0; - state.dataSize->NumTimeStepsInAvg = state.dataGlobal->NumOfTimeStepInHour; + state.dataSize->NumTimeStepsInAvg = state.dataGlobal->TimeStepsInHour; } else { ShowFatalError(state, format("{}: More than 1 occurrence of this object; only 1 allowed", cCurrentModuleObject)); } if (state.dataGlobal->OverrideTimestep) { - state.dataSize->NumTimeStepsInAvg = state.dataGlobal->NumOfTimeStepInHour; + state.dataSize->NumTimeStepsInAvg = state.dataGlobal->TimeStepsInHour; ShowWarningError(state, "Due to the use of the fast simulation mode, the time step for simulation and averaging window of sizing is overwritten to " "one hour. Original user inputs for averaging window and timestep are no longer used."); } - if (state.dataSize->NumTimeStepsInAvg < state.dataGlobal->NumOfTimeStepInHour) { + if (state.dataSize->NumTimeStepsInAvg < state.dataGlobal->TimeStepsInHour) { ShowWarningError(state, format("{}: note {} entered value=[{}] is less than 1 hour (i.e., {} timesteps).", cCurrentModuleObject, state.dataIPShortCut->cNumericFieldNames(3), state.dataSize->NumTimeStepsInAvg, - state.dataGlobal->NumOfTimeStepInHour)); + state.dataGlobal->TimeStepsInHour)); } cCurrentModuleObject = "OutputControl:Sizing:Style"; - Temp = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + int Temp = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); if (Temp == 0) { state.dataIPShortCut->cAlphaArgs(1) = "Comma"; @@ -2712,37 +2641,25 @@ void GetZoneSizingInput(EnergyPlusData &state) // AUTHOR Fred Buhl // DATE WRITTEN December 2000 // MODIFIED Mangesh Basarkar, 06/2011: Specifying zone outside air based on design specification object - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Obtains input data for zone sizing objects and stores it in // appropriate data structures. - // METHODOLOGY EMPLOYED: - // Uses InputProcessor "Get" routines to obtain data. - - // Using/Aliasing + static constexpr std::string_view routineName = "GetZoneSizingInput"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int ZoneSizIndex; // loop index int NumAlphas; // Number of Alphas for each GetObjectItem call int NumNumbers; // Number of Numbers for each GetObjectItem call int IOStatus; // Used in GetObjectItem bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine - int NumDesDays; // Number of design days in input int NumSizingZoneStatements; int Item; int Item1; - int ZLItem; bool errFlag; Array1D_string ZoneNames; int NumZones; int NumZoneLists; - int OAIndex; // Index of design specification object - int ObjIndex; // Index of zone air distribution effectiveness object name - bool DesHeatMaxAirFlowPerAreaUsrInp; - bool DesHeatMaxAirFlowUsrInp; - bool DesHeatMaxAirFlowFracUsrInp; struct GlobalMiscObject { @@ -2793,7 +2710,7 @@ void GetZoneSizingInput(EnergyPlusData &state) SizingZoneObjects(Item).Name = state.dataIPShortCut->cAlphaArgs(1); Item1 = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(1), ZoneNames, NumZones); - ZLItem = 0; + int ZLItem = 0; if (Item1 == 0 && NumZoneLists > 0) ZLItem = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(1), ZoneListNames); if (Item1 > 0) { SizingZoneObjects(Item).StartPtr = state.dataSize->NumZoneSizingInput + 1; @@ -2825,16 +2742,16 @@ void GetZoneSizingInput(EnergyPlusData &state) } if (state.dataSize->NumZoneSizingInput > 0) { - NumDesDays = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:DesignDay") + - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileDays") + - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileConditionType"); + int NumDesDays = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:DesignDay") + + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileDays") + + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileConditionType"); if (NumDesDays == 0 && (state.dataGlobal->DoZoneSizing || state.dataGlobal->DoSystemSizing || state.dataGlobal->DoPlantSizing)) { ShowSevereError(state, "Zone Sizing calculations need SizingPeriod:* input. None found."); ErrorsFound = true; } state.dataSize->ZoneSizingInput.allocate(state.dataSize->NumZoneSizingInput); - ZoneSizIndex = 0; + int ZoneSizIndex = 0; for (Item = 1; Item <= NumSizingZoneStatements; ++Item) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -2850,6 +2767,8 @@ void GetZoneSizingInput(EnergyPlusData &state) state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + for (Item1 = 1; Item1 <= SizingZoneObjects(Item).NumOfZones; ++Item1) { ++ZoneSizIndex; auto &zoneSizingIndex = state.dataSize->ZoneSizingInput(ZoneSizIndex); @@ -3010,7 +2929,8 @@ void GetZoneSizingInput(EnergyPlusData &state) // Getting zone OA parameters from Design Specification object if (!state.dataIPShortCut->lAlphaFieldBlanks(4)) { - OAIndex = Util::FindItemInList(state.dataSize->ZoneSizingInput(ZoneSizIndex).DesignSpecOAObjName, state.dataSize->OARequirements); + int OAIndex = + Util::FindItemInList(state.dataSize->ZoneSizingInput(ZoneSizIndex).DesignSpecOAObjName, state.dataSize->OARequirements); if (OAIndex > 0) { state.dataSize->ZoneSizingInput(ZoneSizIndex).ZoneDesignSpecOAIndex = OAIndex; } else { @@ -3153,7 +3073,7 @@ void GetZoneSizingInput(EnergyPlusData &state) // \default .002032 // \note default is .40 cfm/ft2 // \note This input is not currently used for autosizing any of the components. - DesHeatMaxAirFlowPerAreaUsrInp = false; + bool DesHeatMaxAirFlowPerAreaUsrInp = false; if (state.dataIPShortCut->lNumericFieldBlanks(14)) { if (state.dataIPShortCut->rNumericArgs(14) <= 0.0) { // in case someone changes the default in the IDD state.dataSize->ZoneSizingInput(ZoneSizIndex).DesHeatMaxAirFlowPerArea = 0.002032; @@ -3178,7 +3098,7 @@ void GetZoneSizingInput(EnergyPlusData &state) // \default .1415762 // \note default is 300 cfm // \note This input is not currently used for autosizing any of the components. - DesHeatMaxAirFlowUsrInp = false; + bool DesHeatMaxAirFlowUsrInp = false; if (state.dataIPShortCut->lNumericFieldBlanks(15)) { if (state.dataIPShortCut->rNumericArgs(15) <= 0.0) { // in case someone changes the default in the IDD state.dataSize->ZoneSizingInput(ZoneSizIndex).DesHeatMaxAirFlow = 0.1415762; @@ -3202,7 +3122,7 @@ void GetZoneSizingInput(EnergyPlusData &state) // \type real // \minimum 0 // \default 0.3 - DesHeatMaxAirFlowFracUsrInp = false; + bool DesHeatMaxAirFlowFracUsrInp = false; if (state.dataIPShortCut->lNumericFieldBlanks(16)) { if (state.dataIPShortCut->rNumericArgs(16) <= 0.0) { // in case someone changes the default in the IDD state.dataSize->ZoneSizingInput(ZoneSizIndex).DesHeatMaxAirFlowFrac = 0.3; @@ -3236,8 +3156,8 @@ void GetZoneSizingInput(EnergyPlusData &state) // A7, \field Zone Air Distribution Object Name and add its inputs if (!state.dataIPShortCut->lAlphaFieldBlanks(7)) { state.dataSize->ZoneSizingInput(ZoneSizIndex).ZoneAirDistEffObjName = state.dataIPShortCut->cAlphaArgs(7); - ObjIndex = Util::FindItemInList(state.dataSize->ZoneSizingInput(ZoneSizIndex).ZoneAirDistEffObjName, - state.dataSize->ZoneAirDistribution); + int ObjIndex = Util::FindItemInList(state.dataSize->ZoneSizingInput(ZoneSizIndex).ZoneAirDistEffObjName, + state.dataSize->ZoneAirDistribution); if (ObjIndex > 0) { state.dataSize->ZoneSizingInput(ZoneSizIndex).ZoneADEffCooling = state.dataSize->ZoneAirDistribution(ObjIndex).ZoneADEffCooling; @@ -3306,44 +3226,38 @@ void GetZoneSizingInput(EnergyPlusData &state) (state.dataIPShortCut->cAlphaArgs(12) == "SUPPLYAIRHUMIDITYRATIO") ? SupplyAirHumidityRatio : HumidityRatioDifference; zoneSizingIndex.LatentHeatDesHumRat = state.dataIPShortCut->rNumericArgs(21); zoneSizingIndex.HeatDesHumRatDiff = state.dataIPShortCut->rNumericArgs(22); - if (NumAlphas > 12 && !state.dataIPShortCut->lAlphaFieldBlanks(13)) { - zoneSizingIndex.zoneRHDehumidifySchIndex = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(13)); - if (zoneSizingIndex.zoneRHDehumidifySchIndex == 0) { - ShowWarningError(state, - format("{} = \"{}\", invalid Zone Humidistat Dehumidification Set Point Schedule Name = {}. Schedule will " - "not be used and simulation continues.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaArgs(13))); - } + + if (NumAlphas <= 12 || state.dataIPShortCut->lAlphaFieldBlanks(13)) { + } else if ((zoneSizingIndex.zoneRHDehumidifySched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(13))) == nullptr) { + ShowWarningItemNotFound(state, + eoh, + state.dataIPShortCut->cAlphaFieldNames(13), + state.dataIPShortCut->cAlphaArgs(13), + "Schedule will not be used and simulation continues."); } - if (NumAlphas > 13 && !state.dataIPShortCut->lAlphaFieldBlanks(14)) { - zoneSizingIndex.zoneRHHumidifySchIndex = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(14)); - if (zoneSizingIndex.zoneRHHumidifySchIndex == 0) { - ShowWarningError(state, - format("{} = \"{}\", invalid Zone Humidistat Humidification Set Point Schedule Name = {}. Schedule will " - "not be used and simulation continues.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaArgs(14))); - } else if (zoneSizingIndex.zoneRHDehumidifySchIndex) { - // check max and min of each schedule and compare RHHumidify > RHDehumidify and warn - Real64 maxHumidify = ScheduleManager::GetScheduleMaxValue(state, zoneSizingIndex.zoneRHHumidifySchIndex); - Real64 minDehumidify = ScheduleManager::GetScheduleMinValue(state, zoneSizingIndex.zoneRHDehumidifySchIndex); - if (maxHumidify > minDehumidify) { - ShowWarningError( - state, - format("{} = \"{}\", maximum value ({}%) of Zone Humidistat Humidification Set Point Schedule Name = {} is " - "greater than minimum value ({}%) of Zone Humidistat Dehumidifcation Set Point Schedule Name = {}. " - "Humidification set point will be limited by Dehumidification set point during zone sizing and simulation " - "continues.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - maxHumidify, - state.dataIPShortCut->cAlphaArgs(14), - minDehumidify, - state.dataIPShortCut->cAlphaArgs(13))); - } + + if (NumAlphas <= 13 || state.dataIPShortCut->lAlphaFieldBlanks(14)) { + } else if ((zoneSizingIndex.zoneRHHumidifySched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(14))) == nullptr) { + ShowWarningItemNotFound(state, + eoh, + state.dataIPShortCut->cAlphaFieldNames(14), + state.dataIPShortCut->cAlphaArgs(14), + "Schedule will not be used and simulation continues."); + } else if (zoneSizingIndex.zoneRHDehumidifySched) { + // check max and min of each schedule and compare RHHumidify > RHDehumidify and warn + Real64 maxHumidify = zoneSizingIndex.zoneRHHumidifySched->getMaxVal(state); + Real64 minDehumidify = zoneSizingIndex.zoneRHDehumidifySched->getMinVal(state); + if (maxHumidify > minDehumidify) { + ShowWarningCustom(state, + eoh, + format("Maximum value ({}%) of Zone Humidistat Humidification Set Point Schedule Name = {} is " + "greater than minimum value ({}%) of Zone Humidistat Dehumidifcation Set Point Schedule Name = {}. " + "Humidification set point will be limited by Dehumidification set point during zone sizing and " + "simulation continues.", + maxHumidify, + state.dataIPShortCut->cAlphaArgs(14), + minDehumidify, + state.dataIPShortCut->cAlphaArgs(13))); } } } @@ -3369,7 +3283,7 @@ void ReportTemperatureInputError( state.dataIPShortCut->rNumericArgs(paramNum - 2))); ShowContinueError(state, "This is not allowed. Please check and revise your input."); ErrorsFound = true; - } else { // then input is lower than comparison tempeature--just produce a warning for user to check input + } else { // then input is lower than comparison temperature--just produce a warning for user to check input ShowWarningError(state, format("{}=\"{}\" has invalid data.", cObjectName, state.dataIPShortCut->cAlphaArgs(1))); ShowContinueError(state, format("... incorrect {}=[{:.2R}] is less than [{:.2R}]", @@ -3388,32 +3302,24 @@ void GetZoneAndZoneListNames( // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN October 2010 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Get Zone and ZoneList Names so Sizing:Zone can use global ZoneList. // This is not a full validation of these objects -- only enough to fill // structures for the Sizing:Zone object. - // Using/Aliasing - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int Item; int Found; - int Item1; int NumAlphas; int NumNumbers; int IOStatus; - bool InErrFlag; // Preserve (no current use) the input status of ErrorsFound - InErrFlag = ErrorsFound; auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; cCurrentModuleObject = "Zone"; NumZones = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); ZoneNames.allocate(NumZones); - for (Item = 1; Item <= NumZones; ++Item) { + for (int Item = 1; Item <= NumZones; ++Item) { state.dataInputProcessing->inputProcessor->getObjectItem(state, cCurrentModuleObject, Item, @@ -3439,7 +3345,7 @@ void GetZoneAndZoneListNames( NumZoneLists = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); ZoneListNames.allocate(NumZoneLists); - for (Item = 1; Item <= NumZoneLists; ++Item) { + for (int Item = 1; Item <= NumZoneLists; ++Item) { state.dataInputProcessing->inputProcessor->getObjectItem(state, cCurrentModuleObject, Item, @@ -3461,7 +3367,7 @@ void GetZoneAndZoneListNames( } ZoneListNames(Item).Zones.allocate(NumAlphas - 1); ZoneListNames(Item).NumOfZones = NumAlphas - 1; - for (Item1 = 2; Item1 <= NumAlphas; ++Item1) { + for (int Item1 = 2; Item1 <= NumAlphas; ++Item1) { Found = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(Item1), ZoneNames, NumZones); ZoneListNames(Item).Zones(Item1 - 1) = Found; } @@ -3474,8 +3380,6 @@ void GetSystemSizingInput(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Fred Buhl // DATE WRITTEN January 2001 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Obtains input data for System Sizing objects and stores it in @@ -3484,8 +3388,6 @@ void GetSystemSizingInput(EnergyPlusData &state) // METHODOLOGY EMPLOYED: // Uses InputProcessor "Get" routines to obtain data. - // Using/Aliasing - // Sizing:System; constexpr int iNameAlphaNum = 1; // A1, \field AirLoop Name constexpr int iLoadTypeSizeAlphaNum = 2; // A2, \field Type of Load to Size On @@ -3532,7 +3434,6 @@ void GetSystemSizingInput(EnergyPlusData &state) int NumNumbers; // Number of Numbers for each GetObjectItem call int IOStatus; // Used in GetObjectItem bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine - int NumDesDays; // Number of design days in input auto &SysSizInput = state.dataSize->SysSizInput; @@ -3542,9 +3443,9 @@ void GetSystemSizingInput(EnergyPlusData &state) state.dataSize->NumSysSizInput = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); if (state.dataSize->NumSysSizInput > 0) { - NumDesDays = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:DesignDay") + - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileDays") + - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileConditionType"); + int NumDesDays = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:DesignDay") + + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileDays") + + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileConditionType"); if (NumDesDays == 0 && (state.dataGlobal->DoSystemSizing || state.dataGlobal->DoPlantSizing)) { ShowSevereError(state, "System Sizing calculations need SizingPeriod:* input. None found."); ErrorsFound = true; @@ -4059,8 +3960,6 @@ void GetPlantSizingInput(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Fred Buhl // DATE WRITTEN October 2001 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Obtains input data for Plant Sizing objects and stores it in @@ -4069,23 +3968,20 @@ void GetPlantSizingInput(EnergyPlusData &state) // METHODOLOGY EMPLOYED: // Uses InputProcessor "Get" routines to obtain data. - // Using/Aliasing - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int PltSizIndex; // loop index int NumAlphas; // Number of Alphas for each GetObjectItem call int NumNumbers; // Number of Numbers for each GetObjectItem call int IOStatus; // Used in GetObjectItem bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine - int NumDesDays; // Number of design days in input auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; cCurrentModuleObject = "Sizing:Plant"; state.dataSize->NumPltSizInput = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); if (state.dataSize->NumPltSizInput > 0) { - NumDesDays = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:DesignDay") + - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileDays") + - state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileConditionType"); + int NumDesDays = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:DesignDay") + + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileDays") + + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileConditionType"); if (NumDesDays == 0 && state.dataGlobal->DoPlantSizing) { ShowSevereError(state, "Plant Sizing calculations need SizingPeriod:* input"); ErrorsFound = true; @@ -4182,8 +4078,6 @@ void SetupZoneSizing(EnergyPlusData &state, bool &ErrorsFound) // SUBROUTINE INFORMATION: // AUTHOR L. Lawrie/F. Buhl // DATE WRITTEN March 2010 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // execute a few (1) time steps of a simulation to facilitate setting up model for zone sizing @@ -4247,8 +4141,8 @@ void SetupZoneSizing(EnergyPlusData &state, bool &ErrorsFound) // do an end of day, end of environment time step - state.dataGlobal->HourOfDay = 24; - state.dataGlobal->TimeStep = state.dataGlobal->NumOfTimeStepInHour; + state.dataGlobal->HourOfDay = Constant::iHoursInDay; + state.dataGlobal->TimeStep = state.dataGlobal->TimeStepsInHour; state.dataGlobal->EndEnvrnFlag = true; Weather::ManageWeather(state); @@ -4438,7 +4332,7 @@ void reportZoneSizingEio(EnergyPlusData &state, // SUBROUTINE INFORMATION: // AUTHOR Fred Buhl - // DATE WRITTEN Decenber 2001 + // DATE WRITTEN December 2001 // MODIFIED August 2008, Greg Stark // PURPOSE OF THIS SUBROUTINE: @@ -4562,9 +4456,9 @@ void ReportSysSizing(EnergyPlusData &state, } // convert an index for the timestep of the day into a hour minute string in the format 00:00 -std::string TimeIndexToHrMinString(EnergyPlusData &state, int timeIndex) +std::string TimeIndexToHrMinString(EnergyPlusData const &state, int timeIndex) { - int tMinOfDay = timeIndex * state.dataGlobal->MinutesPerTimeStep; + int tMinOfDay = timeIndex * state.dataGlobal->MinutesInTimeStep; int tHr = int(tMinOfDay / 60.); int tMin = tMinOfDay - tHr * 60; return format(PeakHrMinFmt, tHr, tMin); @@ -4575,8 +4469,6 @@ void GetZoneHVACSizing(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR B. Nigusse - FSEC // DATE WRITTEN July 2014 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Obtains input data for the ZoneHVAC sizing methods object and stores it in @@ -4587,8 +4479,6 @@ void GetZoneHVACSizing(EnergyPlusData &state) // This object requires only a name where the default values are assumed // if subsequent fields are not entered. - // Using/Aliasing - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetZoneHVACSizing: "); // include trailing blank space @@ -4613,12 +4503,12 @@ void GetZoneHVACSizing(EnergyPlusData &state) int iCoolCAPMAlphaNum; // get input index to Zone HVAC sizing chilled water flow method int iCoolDesignCapacityNumericNum; // get input index to Zone HVAC sizing chilled water flow int iCoolCapacityPerFloorAreaNumericNum; // get input index to Zone HVAC sizing cooling capacity per floor area - int iCoolFracOfAutosizedCapacityNumericNum; // get input index to Zone HVAC sizing capacity as fraction autozized cooling capacity + int iCoolFracOfAutosizedCapacityNumericNum; // get input index to Zone HVAC sizing capacity as fraction autosized cooling capacity int iHeatCAPMAlphaNum; // get input index to Zone HVAC sizing heating capacity int iHeatDesignCapacityNumericNum; // get input index to Zone HVAC sizing heating design capacity int iHeatCapacityPerFloorAreaNumericNum; // get input index to Zone HVAC sizing heating capacity per floor area - int iHeatFracOfAutosizedCapacityNumericNum; // get input index to Zone HVAC sizing capacity as fraction autozized cooling capacity + int iHeatFracOfAutosizedCapacityNumericNum; // get input index to Zone HVAC sizing capacity as fraction autosized cooling capacity iCoolSAFMAlphaNum = 2; // get input index to Zone HVAC sizing heat supp air flow method iMaxCoolAirVolFlowNumericNum = 1; // get input index to Zone HVAC sizing cool supply air flow @@ -4646,13 +4536,11 @@ void GetZoneHVACSizing(EnergyPlusData &state) iHeatCAPMAlphaNum = 6; // get input index to Zone HVAC sizing heating capacity iHeatDesignCapacityNumericNum = 16; // get input index to Zone HVAC sizing heating design capacity iHeatCapacityPerFloorAreaNumericNum = 17; // get input index to Zone HVAC sizing heating capacity per floor area - iHeatFracOfAutosizedCapacityNumericNum = 18; // get input index to Zone HVAC sizing capacity as fraction autozized heating capacity + iHeatFracOfAutosizedCapacityNumericNum = 18; // get input index to Zone HVAC sizing capacity as fraction autosized heating capacity int NumAlphas; // Number of Alphas for each GetObjectItem call int NumNumbers; // Number of Numbers for each GetObjectItem call int TotalArgs; // Total number of alpha and numeric arguments (max) for a - int IOStatus; // Used in GetObjectItem - int zSIndex; // index of "DesignSpecification:ZoneHVAC:Sizing" objects bool ErrorsFound(false); // If errors detected in input // REAL(r64) :: CalcAmt @@ -4676,10 +4564,11 @@ void GetZoneHVACSizing(EnergyPlusData &state) lNumericBlanks.dimension(NumNumbers, true); if (state.dataSize->NumZoneHVACSizing > 0) { + int IOStatus; // Used in GetObjectItem state.dataSize->ZoneHVACSizing.allocate(state.dataSize->NumZoneHVACSizing); // Start Loading the System Input - for (zSIndex = 1; zSIndex <= state.dataSize->NumZoneHVACSizing; ++zSIndex) { + for (int zSIndex = 1; zSIndex <= state.dataSize->NumZoneHVACSizing; ++zSIndex) { Alphas = ""; cAlphaFields = ""; @@ -5007,7 +4896,7 @@ void GetZoneHVACSizing(EnergyPlusData &state) ShowContinueError(state, format("Illegal {} = Autosize", cNumericFields(iNoCoolHeatFlowPerFracCoolNumericNum))); ErrorsFound = true; } else { - // user input frcation of cooling supply air flow rate during no cooling or heating area is saved in + // user input fraction of cooling supply air flow rate during no cooling or heating area is saved in // ZoneHVACSizing(zSIndex).MaxNoCoolHeatAirVolFlow state.dataSize->ZoneHVACSizing(zSIndex).RequestAutoSize = true; } @@ -5037,7 +4926,7 @@ void GetZoneHVACSizing(EnergyPlusData &state) ShowContinueError(state, format("Illegal {} = Autosize", cNumericFields(iNoCoolHeatFlowPerFracHeatNumericNum))); ErrorsFound = true; } else { - // user input frcation of heating supply air flow rate during no cooling or heating area is saved in + // user input fraction of heating supply air flow rate during no cooling or heating area is saved in // ZoneHVACSizing(zSIndex).MaxNoCoolHeatAirVolFlow state.dataSize->ZoneHVACSizing(zSIndex).RequestAutoSize = true; } @@ -5235,7 +5124,6 @@ void GetAirTerminalSizing(EnergyPlusData &state) int NumAlphas; // Number of Alphas for each GetObjectItem call int NumNumbers; // Number of Numbers for each GetObjectItem call int TotalArgs; // Total number of alpha and numeric arguments (max) for a - int IOStatus; // Used in GetObjectItem bool ErrorsFound(false); // If errors detected in input auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; cCurrentModuleObject = "DesignSpecification:AirTerminal:Sizing"; @@ -5243,6 +5131,7 @@ void GetAirTerminalSizing(EnergyPlusData &state) state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); if (state.dataSize->NumAirTerminalSizingSpec > 0) { + int IOStatus; // Used in GetObjectItem state.dataSize->AirTerminalSizingSpec.allocate(state.dataSize->NumAirTerminalSizingSpec); // Start Loading the System Input @@ -5278,10 +5167,10 @@ void GetAirTerminalSizing(EnergyPlusData &state) } } -// Update the sizing for the entire facilty to gather values for reporting - Glazer January 2017 +// Update the sizing for the entire facility to gather values for reporting - Glazer January 2017 void UpdateFacilitySizing([[maybe_unused]] EnergyPlusData &state, Constant::CallIndicator const CallIndicator) { - int NumOfTimeStepInDay = state.dataGlobal->NumOfTimeStepInHour * 24; + int NumOfTimeStepInDay = state.dataGlobal->TimeStepsInHour * Constant::iHoursInDay; auto &CalcFacilitySizing = state.dataSize->CalcFacilitySizing; auto &CalcFinalFacilitySizing = state.dataSize->CalcFinalFacilitySizing; @@ -5340,7 +5229,7 @@ void UpdateFacilitySizing([[maybe_unused]] EnergyPlusData &state, Constant::Call CalcFacilitySizing(state.dataSize->CurOverallSimDay).HeatDDNum = state.dataSize->CurOverallSimDay; CalcFacilitySizing(state.dataSize->CurOverallSimDay).CoolDDNum = state.dataSize->CurOverallSimDay; } else if (CallIndicator == Constant::CallIndicator::DuringDay) { - int TimeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; + int TimeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->TimeStepsInHour + state.dataGlobal->TimeStep; // save the results of the ideal zone component calculation in the CalcZoneSizing sequence variables Real64 sumCoolLoad = 0.; Real64 sumHeatLoad = 0.; @@ -5470,7 +5359,7 @@ void UpdateTermUnitFinalZoneSizing(EnergyPlusData &state) thisTUFZSizing.DesCoolMassFlow = thisTUFZSizing.DesCoolVolFlow * thisFZSizing.DesCoolDens; thisTUFZSizing.DesCoolMassFlow = max(thisTUFZSizing.DesCoolMassFlow, minOACoolMassFlow); thisTUFZSizing.DesCoolMassFlowNoOA = thisTUFZSizing.DesCoolVolFlowNoOA * thisFZSizing.DesCoolDens; - for (int timeIndex = 1; timeIndex <= (state.dataGlobal->NumOfTimeStepInHour * 24); ++timeIndex) { + for (int timeIndex = 1; timeIndex <= (state.dataGlobal->TimeStepsInHour * Constant::iHoursInDay); ++timeIndex) { thisTUFZSizing.CoolFlowSeq(timeIndex) = thisTUSizing.applyTermUnitSizingCoolFlow(thisFZSizing.CoolFlowSeq(timeIndex), thisFZSizing.CoolFlowSeqNoOA(timeIndex)); thisTUFZSizing.CoolFlowSeq(timeIndex) = max(thisTUFZSizing.CoolFlowSeq(timeIndex), minOACoolMassFlow); @@ -5503,7 +5392,7 @@ void UpdateTermUnitFinalZoneSizing(EnergyPlusData &state) thisTUFZSizing.DesHeatMassFlow = thisTUFZSizing.DesHeatVolFlow * thisFZSizing.DesHeatDens; thisTUFZSizing.DesHeatMassFlow = max(thisTUFZSizing.DesHeatMassFlow, minOAHeatMassFlow); thisTUFZSizing.DesHeatMassFlowNoOA = thisTUFZSizing.DesHeatVolFlowNoOA * thisFZSizing.DesHeatDens; - for (int timeIndex = 1; timeIndex <= (state.dataGlobal->NumOfTimeStepInHour * 24); ++timeIndex) { + for (int timeIndex = 1; timeIndex <= (state.dataGlobal->TimeStepsInHour * Constant::iHoursInDay); ++timeIndex) { thisTUFZSizing.HeatFlowSeq(timeIndex) = thisTUSizing.applyTermUnitSizingHeatFlow(thisFZSizing.HeatFlowSeq(timeIndex), thisFZSizing.HeatFlowSeqNoOA(timeIndex)); thisTUFZSizing.HeatFlowSeq(timeIndex) = max(thisTUFZSizing.HeatFlowSeq(timeIndex), minOAHeatMassFlow); diff --git a/src/EnergyPlus/SizingManager.hh b/src/EnergyPlus/SizingManager.hh index edcd461b46d..261dcce6384 100644 --- a/src/EnergyPlus/SizingManager.hh +++ b/src/EnergyPlus/SizingManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -81,7 +81,7 @@ namespace SizingManager { void ManageSizing(EnergyPlusData &state); bool CalcdoLoadComponentPulseNow( - EnergyPlusData &state, bool isPulseZoneSizing, bool WarmupFlag, int HourOfDay, int TimeStep, Constant::KindOfSim KindOfSim); + EnergyPlusData const &state, bool isPulseZoneSizing, bool WarmupFlag, int HourOfDay, int TimeStep, Constant::KindOfSim KindOfSim); void ManageSystemSizingAdjustments(EnergyPlusData &state); @@ -95,9 +95,9 @@ namespace SizingManager { std::string const &cCurrentModuleObject, int OAIndex, Array1D_string const &cAlphaArgs, - int &NumAlphas, + int const NumAlphas, Array1D const &rNumericArgs, - int &NumNumbers, + int const NumNumbers, Array1D_bool const &lAlphaFieldBlanks, Array1D_string const &cAlphaFieldNames, bool &ErrorsFound // If errors found in input @@ -166,7 +166,7 @@ namespace SizingManager { int TimeStepIndex // time step of the peak ); - std::string TimeIndexToHrMinString(EnergyPlusData &state, int timeIndex); + std::string TimeIndexToHrMinString(EnergyPlusData const &state, int timeIndex); void UpdateFacilitySizing(EnergyPlusData &state, Constant::CallIndicator CallIndicator); @@ -184,6 +184,10 @@ struct SizingManagerData : BaseGlobalStruct bool ReportSysSizingMyOneTimeFlag = true; bool runZeroingOnce = true; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/SolarCollectors.cc b/src/EnergyPlus/SolarCollectors.cc index 20efa9010b7..0ed6b20cbe8 100644 --- a/src/EnergyPlus/SolarCollectors.cc +++ b/src/EnergyPlus/SolarCollectors.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -50,7 +50,6 @@ // ObjexxFCL Headers #include -#include // EnergyPlus Headers #include @@ -92,8 +91,6 @@ namespace SolarCollectors { // must be connected to a WATER HEATER object on the supply side of the plant loop. Water is assumed to be // the heat transfer fluid. - static constexpr std::string_view fluidNameWater("WATER"); - PlantComponent *CollectorData::factory(EnergyPlusData &state, std::string const &objectName) { // Process the input data @@ -464,7 +461,7 @@ namespace SolarCollectors { ShowSevereError(state, format("{} = {}", CurrentModuleParamObject, state.dataIPShortCut->cAlphaArgs(1))); ShowContinueError( state, format("Illegal {} = {:.2R}", state.dataIPShortCut->cNumericFieldNames(1), state.dataIPShortCut->rNumericArgs(1))); - ShowContinueError(state, " Collector gross area must be always gretaer than zero."); + ShowContinueError(state, " Collector gross area must be always greater than zero."); ErrorsFound = true; } state.dataSolarCollectors->Parameters(ParametersNum).Volume = state.dataIPShortCut->rNumericArgs(2); @@ -472,7 +469,7 @@ namespace SolarCollectors { ShowSevereError(state, format("{} = {}", CurrentModuleParamObject, state.dataIPShortCut->cAlphaArgs(1))); ShowContinueError( state, format("Illegal {} = {:.2R}", state.dataIPShortCut->cNumericFieldNames(2), state.dataIPShortCut->rNumericArgs(2))); - ShowContinueError(state, " Collector water volume must be always gretaer than zero."); + ShowContinueError(state, " Collector water volume must be always greater than zero."); ErrorsFound = true; } // Note: this value is used to calculate the heat loss through the bottom and side of the collector @@ -517,7 +514,7 @@ namespace SolarCollectors { } // Solar absorptance of the absorber plate state.dataSolarCollectors->Parameters(ParametersNum).AbsorOfAbsPlate = state.dataIPShortCut->rNumericArgs(16); - // thermal emmissivity of the absorber plate + // thermal emissivity of the absorber plate state.dataSolarCollectors->Parameters(ParametersNum).EmissOfAbsPlate = state.dataIPShortCut->rNumericArgs(17); } // end of ParametersNum @@ -937,11 +934,7 @@ namespace SolarCollectors { if (state.dataGlobal->BeginEnvrnFlag && this->Init) { // Clear node initial conditions if (this->VolFlowRateMax > 0) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); this->MassFlowRateMax = this->VolFlowRateMax * rho; } else { @@ -974,14 +967,14 @@ namespace SolarCollectors { this->Tilt = state.dataSurface->Surface(SurfNum).Tilt; this->TiltR2V = std::abs(90.0 - Tilt); - this->CosTilt = std::cos(Tilt * Constant::DegToRadians); - this->SinTilt = std::sin(1.8 * Tilt * Constant::DegToRadians); + this->CosTilt = std::cos(Tilt * Constant::DegToRad); + this->SinTilt = std::sin(1.8 * Tilt * Constant::DegToRad); - // Diffuse reflectance of the cover for solar radiation diffusely reflected back from the absober - // plate to the cover. The diffuse solar radiation reflected back from the absober plate to the + // Diffuse reflectance of the cover for solar radiation diffusely reflected back from the absorber + // plate to the cover. The diffuse solar radiation reflected back from the absorber plate to the // cover is represented by the 60 degree equivalent incident angle. This diffuse reflectance is // used to calculate the transmittance - absorptance product (Duffie and Beckman, 1991) - Real64 Theta = 60.0 * Constant::DegToRadians; + Real64 Theta = 60.0 * Constant::DegToRad; Real64 TransSys = 0.0; Real64 RefSys = 0.0; Real64 AbsCover1 = 0.0; @@ -996,7 +989,7 @@ namespace SolarCollectors { // transmittance-absorptance product for sky diffuse radiation. Uses equivalent incident angle // of sky radiation (radians), and is calculated according to Brandemuehl and Beckman (1980): - Theta = (59.68 - 0.1388 * Tilt + 0.001497 * pow_2(Tilt)) * Constant::DegToRadians; + Theta = (59.68 - 0.1388 * Tilt + 0.001497 * pow_2(Tilt)) * Constant::DegToRad; this->CalcTransRefAbsOfCover(state, Theta, TransSys, RefSys, AbsCover1, AbsCover2); this->TauAlphaSkyDiffuse = TransSys * state.dataSolarCollectors->Parameters(ParamNum).AbsorOfAbsPlate / (1.0 - (1.0 - state.dataSolarCollectors->Parameters(ParamNum).AbsorOfAbsPlate) * this->RefDiffInnerCover); @@ -1005,7 +998,7 @@ namespace SolarCollectors { // transmittance-absorptance product for ground diffuse radiation. Uses equivalent incident angle // of ground radiation (radians), and is calculated according to Brandemuehl and Beckman (1980): - Theta = (90.0 - 0.5788 * Tilt + 0.002693 * pow_2(Tilt)) * Constant::DegToRadians; + Theta = (90.0 - 0.5788 * Tilt + 0.002693 * pow_2(Tilt)) * Constant::DegToRad; this->CalcTransRefAbsOfCover(state, Theta, TransSys, RefSys, AbsCover1, AbsCover2); this->TauAlphaGndDiffuse = TransSys * state.dataSolarCollectors->Parameters(ParamNum).AbsorOfAbsPlate / (1.0 - (1.0 - state.dataSolarCollectors->Parameters(ParamNum).AbsorOfAbsPlate) * this->RefDiffInnerCover); @@ -1094,10 +1087,10 @@ namespace SolarCollectors { Real64 tilt = state.dataSurface->Surface(SurfNum).Tilt; // Equivalent incident angle of sky radiation (radians) - Real64 ThetaSky = (59.68 - 0.1388 * tilt + 0.001497 * pow_2(tilt)) * Constant::DegToRadians; + Real64 ThetaSky = (59.68 - 0.1388 * tilt + 0.001497 * pow_2(tilt)) * Constant::DegToRad; // Equivalent incident angle of ground radiation (radians) - Real64 ThetaGnd = (90.0 - 0.5788 * tilt + 0.002693 * pow_2(tilt)) * Constant::DegToRadians; + Real64 ThetaGnd = (90.0 - 0.5788 * tilt + 0.002693 * pow_2(tilt)) * Constant::DegToRad; incidentAngleModifier = (state.dataHeatBal->SurfQRadSWOutIncidentBeam(SurfNum) * state.dataSolarCollectors->Parameters(ParamNum).IAM(state, ThetaBeam) + @@ -1115,11 +1108,7 @@ namespace SolarCollectors { Real64 massFlowRate = this->MassFlowRate; // Specific heat of collector fluid (J/kg-K) - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - inletTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, inletTemp, RoutineName); // Gross area of collector (m2) Real64 area = state.dataSurface->Surface(SurfNum).Area; @@ -1327,7 +1316,7 @@ namespace SolarCollectors { Real64 IAM; // cut off IAM for angles greater than 60 degrees. (CR 7534) - Real64 CutoffAngle = 60.0 * Constant::DegToRadians; + Real64 CutoffAngle = 60.0 * Constant::DegToRad; if (std::abs(IncidentAngle) > CutoffAngle) { // cut off, model curves not robust beyond cutoff // curves from FSEC/SRCC testing are only certified to 60 degrees, larger angles can cause numerical problems in curves IAM = 0.0; @@ -1405,18 +1394,10 @@ namespace SolarCollectors { Real64 massFlowRate = this->MassFlowRate; // Specific heat of collector fluid (J/kg-K) - Real64 Cpw = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - inletTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cpw = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, inletTemp, RoutineName); // density of collector fluid (kg/m3) - Real64 Rhow = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - inletTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Rhow = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, inletTemp, RoutineName); // calculate heat transfer coefficients and covers temperature: this->CalcHeatTransCoeffAndCoverTemp(state); @@ -1660,7 +1641,7 @@ namespace SolarCollectors { // DATE WRITTEN February 2012 // PURPOSE OF THIS SUBROUTINE: - // Calculates the transmitance, reflectance, and absorptance of the collector covers based on + // Calculates the transmittance, reflectance, and absorptance of the collector covers based on // solar collector optical parameters specified. // METHODOLOGY EMPLOYED: @@ -1692,7 +1673,7 @@ namespace SolarCollectors { AbsCover1 = 0.0; AbsCover2 = 0.0; - bool DiffRefFlag; // flag for calc. diffuse refl of cover from inside to outsidd + bool DiffRefFlag; // flag for calc. diffuse refl of cover from inside to outside if (present(InOUTFlag)) { DiffRefFlag = InOUTFlag; } else { @@ -2036,9 +2017,9 @@ namespace SolarCollectors { // PURPOSE OF THIS FUNCTION: // Calculates the free convection coefficient between the absorber plate and water. // METHODOLOGY EMPLOYED: - // The convection coefficient calculation were based on the Fujii and Imura emperical correlations + // The convection coefficient calculation were based on the Fujii and Imura empirical correlations // REFERENCES: - // T.Fujii, and H.Imura,Natural convection heat transfer from aplate with arbitrary inclination. + // T.Fujii, and H.Imura,Natural convection heat transfer from a plate with arbitrary inclination. // International Journal of Heat and Mass Transfer: 15(4), (1972), 755-764. Real64 hConvA2W; // convection coefficient, [W/m2K] @@ -2049,22 +2030,23 @@ namespace SolarCollectors { Real64 DeltaT = std::abs(TAbsorber - TWater); Real64 TReference = TAbsorber - 0.25 * (TAbsorber - TWater); // record fluid prop index for water - int WaterIndex = FluidProperties::GetGlycolNum(state, fluidNameWater); + + auto *water = Fluid::GetWater(state); // find properties of water - always assume water - Real64 WaterSpecHeat = FluidProperties::GetSpecificHeatGlycol(state, fluidNameWater, max(TReference, 0.0), WaterIndex, CalledFrom); - Real64 CondOfWater = FluidProperties::GetConductivityGlycol(state, fluidNameWater, max(TReference, 0.0), WaterIndex, CalledFrom); - Real64 VisOfWater = FluidProperties::GetViscosityGlycol(state, fluidNameWater, max(TReference, 0.0), WaterIndex, CalledFrom); - Real64 DensOfWater = FluidProperties::GetDensityGlycol(state, fluidNameWater, max(TReference, 0.0), WaterIndex, CalledFrom); + Real64 WaterSpecHeat = water->getSpecificHeat(state, max(TReference, 0.0), CalledFrom); + Real64 CondOfWater = water->getConductivity(state, max(TReference, 0.0), CalledFrom); + Real64 VisOfWater = water->getViscosity(state, max(TReference, 0.0), CalledFrom); + Real64 DensOfWater = water->getDensity(state, max(TReference, 0.0), CalledFrom); Real64 PrOfWater = VisOfWater * WaterSpecHeat / CondOfWater; // Requires a different reference temperature for volumetric expansion coefficient TReference = TWater - 0.25 * (TWater - TAbsorber); - Real64 VolExpWater = -(FluidProperties::GetDensityGlycol(state, fluidNameWater, max(TReference, 10.0) + 5.0, WaterIndex, CalledFrom) - - FluidProperties::GetDensityGlycol(state, fluidNameWater, max(TReference, 10.0) - 5.0, WaterIndex, CalledFrom)) / - (10.0 * DensOfWater); + Real64 VolExpWater = + -(water->getDensity(state, max(TReference, 10.0) + 5.0, CalledFrom) - water->getDensity(state, max(TReference, 10.0) - 5.0, CalledFrom)) / + (10.0 * DensOfWater); // Grashof number Real64 GrNum = gravity * VolExpWater * DensOfWater * DensOfWater * PrOfWater * DeltaT * pow_3(Lc) / pow_2(VisOfWater); - Real64 CosTilt = std::cos(TiltR2V * Constant::DegToRadians); + Real64 CosTilt = std::cos(TiltR2V * Constant::DegToRad); Real64 RaNum; // Raleigh number Real64 NuL; // Nusselt number @@ -2116,11 +2098,7 @@ namespace SolarCollectors { PlantUtilities::SafeCopyPlantNode(state, this->InletNode, this->OutletNode); // Set outlet node variables that are possibly changed state.dataLoopNodes->Node(this->OutletNode).Temp = this->OutletTemp; - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->OutletTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, this->OutletTemp, RoutineName); state.dataLoopNodes->Node(this->OutletNode).Enthalpy = Cp * state.dataLoopNodes->Node(this->OutletNode).Temp; } diff --git a/src/EnergyPlus/SolarCollectors.hh b/src/EnergyPlus/SolarCollectors.hh index 2ce8b0947e8..d8032cef7c5 100644 --- a/src/EnergyPlus/SolarCollectors.hh +++ b/src/EnergyPlus/SolarCollectors.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -261,6 +261,10 @@ struct SolarCollectorsData : BaseGlobalStruct std::unordered_map UniqueParametersNames; std::unordered_map UniqueCollectorNames; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/SolarReflectionManager.cc b/src/EnergyPlus/SolarReflectionManager.cc index 8cbecf1b3c9..ad655eb019a 100644 --- a/src/EnergyPlus/SolarReflectionManager.cc +++ b/src/EnergyPlus/SolarReflectionManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -49,9 +49,6 @@ #include #include -// ObjexxFCL Headers -#include - // EnergyPlus Headers #include #include @@ -90,7 +87,6 @@ namespace SolarReflectionManager { // Using/Aliasing using namespace DataHeatBalance; using namespace DataSurfaces; - using namespace ScheduleManager; using namespace DataEnvironment; using namespace DataVectorTypes; @@ -891,9 +887,6 @@ namespace SolarReflectionManager { // REFERENCES: // na - // Using/Aliasing - using General::POLYF; - // Locals // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Array1D ReflBmToDiffSolObs(state.dataSurface->MaxRecPts); // Irradiance at a receiving point for @@ -1034,7 +1027,7 @@ namespace SolarReflectionManager { state.dataSolarReflectionManager->SpecReflectance = 0.0; if (state.dataSurface->Surface(ReflSurfNum).Class == SurfaceClass::Window) { state.dataSolarReflectionManager->ConstrNumRefl = state.dataSurface->Surface(ReflSurfNum).Construction; - state.dataSolarReflectionManager->SpecReflectance = POLYF( + state.dataSolarReflectionManager->SpecReflectance = Window::POLYF( std::abs(state.dataSolarReflectionManager->CosIncAngRefl), state.dataConstruction->Construct(state.dataSolarReflectionManager->ConstrNumRefl).ReflSolBeamFrontCoef); } @@ -1043,7 +1036,7 @@ namespace SolarReflectionManager { state.dataSolarReflectionManager->ConstrNumRefl = state.dataSurface->SurfShadowGlazingConstruct(ReflSurfNum); state.dataSolarReflectionManager->SpecReflectance = state.dataSurface->SurfShadowGlazingFrac(ReflSurfNum) * - POLYF( + Window::POLYF( std::abs(state.dataSolarReflectionManager->CosIncAngRefl), state.dataConstruction->Construct(state.dataSolarReflectionManager->ConstrNumRefl).ReflSolBeamFrontCoef); } diff --git a/src/EnergyPlus/SolarReflectionManager.hh b/src/EnergyPlus/SolarReflectionManager.hh index b2de8fee820..c89cca68f41 100644 --- a/src/EnergyPlus/SolarReflectionManager.hh +++ b/src/EnergyPlus/SolarReflectionManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -176,6 +176,10 @@ struct SolarReflectionManagerData : BaseGlobalStruct Vector3 SurfVertToGndPt; // Vector from a vertex of possible obstructing surface to ground hit point (m) Vector3 SurfVert; // Surface vertex (m) + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/SolarShading.cc b/src/EnergyPlus/SolarShading.cc index 9aa58438b76..b67f14df029 100644 --- a/src/EnergyPlus/SolarShading.cc +++ b/src/EnergyPlus/SolarShading.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -53,7 +53,6 @@ // ObjexxFCL Headers #include -#include #include #include @@ -80,7 +79,7 @@ #include #include #include -#include +// #include #include #include #include @@ -382,7 +381,7 @@ void checkShadingSurfaceSchedules(EnergyPlusData &state) bool const anyPlugins = size(state.dataPluginManager->plugins) > 0; bool const runningByAPI = state.dataGlobal->eplusRunningViaAPI; bool const anyEMS = state.dataGlobal->AnyEnergyManagementSystemInModel; - if ((anyEMS && EMSManager::isScheduleManaged(state, thisSurface.SchedShadowSurfIndex)) || runningByAPI || anyPlugins) { + if ((anyEMS && EMSManager::isScheduleManaged(state, thisSurface.shadowSurfSched)) || runningByAPI || anyPlugins) { // Transmittance schedule definitely has an actuator or may have one via python plugin or API // Set not transparent so it won't be skipped during shading calcs thisSurface.IsTransparent = false; @@ -394,7 +393,7 @@ void checkShadingSurfaceSchedules(EnergyPlusData &state) ShowWarningError(state, format(R"(Shading Surface="{}", Transmittance Schedule Name="{}", is always transparent.)", thisSurface.Name, - state.dataScheduleMgr->Schedule(thisSurface.SchedShadowSurfIndex).Name)); + thisSurface.shadowSurfSched->Name)); ShowContinueError(state, "This shading surface will be ignored."); } } @@ -471,7 +470,7 @@ void GetShadowingInput(EnergyPlusData &state) state.dataIPShortCut->cAlphaArgs(aNum) = "Scheduled"; checkScheduledSurfacePresent(state); } else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(aNum), "Imported")) { - if (state.dataScheduleMgr->ScheduleFileShadingProcessed) { + if (state.dataSched->ScheduleFileShadingProcessed) { state.dataSysVars->shadingMethod = ShadingMethod::Imported; state.dataIPShortCut->cAlphaArgs(aNum) = "Imported"; } else { @@ -738,16 +737,12 @@ void processShadowingInput(EnergyPlusData &state) } if (state.dataSysVars->shadingMethod == DataSystemVariables::ShadingMethod::Imported) { - int ExtShadingSchedNum; - for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - ExtShadingSchedNum = ScheduleManager::GetScheduleIndex(state, state.dataSurface->Surface(SurfNum).Name + "_shading"); - if (ExtShadingSchedNum != 0) { - state.dataSurface->Surface(SurfNum).SurfSchedExternalShadingFrac = true; - state.dataSurface->Surface(SurfNum).SurfExternalShadingSchInd = ExtShadingSchedNum; + for (auto &surf : state.dataSurface->Surface) { + if ((surf.surfExternalShadingSched = Sched::GetSchedule(state, surf.Name + "_shading")) != nullptr) { + surf.SurfSchedExternalShadingFrac = true; } else { ShowWarningError(state, - format("processShadowingInput: sunlit fraction schedule not found for {} when using ImportedShading.", - state.dataSurface->Surface(SurfNum).Name)); + format("processShadowingInput: sunlit fraction schedule not found for {} when using ImportedShading.", surf.Name)); ShowContinueError(state, "These values are set to 1.0."); } } @@ -889,7 +884,7 @@ void AllocateModuleArrays(EnergyPlusData &state) state.dataSolarShading->SurfMultIsoSky.dimension(s_surf->TotSurfaces, 0.0); state.dataSolarShading->SurfMultCircumSolar.dimension(s_surf->TotSurfaces, 0.0); state.dataSolarShading->SurfMultHorizonZenith.dimension(s_surf->TotSurfaces, 0.0); - state.dataSolarShading->SurfWinRevealStatus.dimension(24, state.dataGlobal->NumOfTimeStepInHour, s_surf->TotSurfaces, 0); + state.dataSolarShading->SurfWinRevealStatus.dimension(24, state.dataGlobal->TimeStepsInHour, s_surf->TotSurfaces, 0); // Weiler-Atherton state.dataSolarShading->MAXHCArrayBounds = 2 * (s_surf->MaxVerticesPerSurface + 1); @@ -909,8 +904,8 @@ void AllocateModuleArrays(EnergyPlusData &state) state.dataSolarShading->XTEMP1.dimension(2 * (s_surf->MaxVerticesPerSurface + 1), 0.0); state.dataSolarShading->YTEMP1.dimension(2 * (s_surf->MaxVerticesPerSurface + 1), 0.0); - s_surf->SurfSunCosHourly.allocate(Constant::HoursInDay); - for (int hour = 1; hour <= Constant::HoursInDay; hour++) { + s_surf->SurfSunCosHourly.allocate(Constant::iHoursInDay); + for (int hour = 1; hour <= Constant::iHoursInDay; hour++) { s_surf->SurfSunCosHourly(hour) = 0.0; } s_surf->SurfSunlitArea.dimension(s_surf->TotSurfaces, 0.0); @@ -946,15 +941,15 @@ void AllocateModuleArrays(EnergyPlusData &state) s_surf->SurfWinInsideFrameCondensationFlag.dimension(s_surf->TotSurfaces, 0); s_surf->SurfWinInsideDividerCondensationFlag.dimension(s_surf->TotSurfaces, 0); - state.dataHeatBal->SurfSunlitFracHR.dimension(Constant::HoursInDay, s_surf->TotSurfaces, 0.0); - state.dataHeatBal->SurfSunlitFrac.dimension(Constant::HoursInDay, state.dataGlobal->NumOfTimeStepInHour, s_surf->TotSurfaces, 0.0); - state.dataHeatBal->SurfSunlitFracWithoutReveal.dimension(Constant::HoursInDay, state.dataGlobal->NumOfTimeStepInHour, s_surf->TotSurfaces, 0.0); + state.dataHeatBal->SurfSunlitFracHR.dimension(Constant::iHoursInDay, s_surf->TotSurfaces, 0.0); + state.dataHeatBal->SurfSunlitFrac.dimension(Constant::iHoursInDay, state.dataGlobal->TimeStepsInHour, s_surf->TotSurfaces, 0.0); + state.dataHeatBal->SurfSunlitFracWithoutReveal.dimension(Constant::iHoursInDay, state.dataGlobal->TimeStepsInHour, s_surf->TotSurfaces, 0.0); state.dataHeatBal->SurfWinBackSurfaces.dimension( - Constant::HoursInDay, state.dataGlobal->NumOfTimeStepInHour, state.dataBSDFWindow->MaxBkSurf, s_surf->TotSurfaces, 0); + Constant::iHoursInDay, state.dataGlobal->TimeStepsInHour, state.dataBSDFWindow->MaxBkSurf, s_surf->TotSurfaces, 0); state.dataHeatBal->SurfWinOverlapAreas.dimension( - Constant::HoursInDay, state.dataGlobal->NumOfTimeStepInHour, state.dataBSDFWindow->MaxBkSurf, s_surf->TotSurfaces, 0.0); - state.dataHeatBal->SurfCosIncAngHR.dimension(Constant::HoursInDay, s_surf->TotSurfaces, 0.0); - state.dataHeatBal->SurfCosIncAng.dimension(Constant::HoursInDay, state.dataGlobal->NumOfTimeStepInHour, s_surf->TotSurfaces, 0.0); + Constant::iHoursInDay, state.dataGlobal->TimeStepsInHour, state.dataBSDFWindow->MaxBkSurf, s_surf->TotSurfaces, 0.0); + state.dataHeatBal->SurfCosIncAngHR.dimension(Constant::iHoursInDay, s_surf->TotSurfaces, 0.0); + state.dataHeatBal->SurfCosIncAng.dimension(Constant::iHoursInDay, state.dataGlobal->TimeStepsInHour, s_surf->TotSurfaces, 0.0); state.dataHeatBal->ZoneTransSolar.dimension(state.dataViewFactor->NumOfSolarEnclosures, 0.0); state.dataHeatBal->ZoneBmSolFrExtWinsRep.dimension(state.dataViewFactor->NumOfSolarEnclosures, 0.0); @@ -2610,7 +2605,7 @@ void AnisoSkyViewFactors(EnergyPlusData &state) CosZenithAng = state.dataEnvrn->SOLCOS(3); ZenithAng = std::acos(CosZenithAng); - ZenithAngDeg = ZenithAng / Constant::DegToRadians; + ZenithAngDeg = ZenithAng / Constant::DegToRad; state.dataSolarShading->SurfAnisoSkyMult = 0.0; @@ -2707,7 +2702,7 @@ void CHKBKS(EnergyPlusData &state, // correspond to how CHKBKS is called // Jan 2002, FW: change error message // RE-ENGINEERED Lawrie, Oct 2000 - // Sep 2020: Revised the vector computation method to reliabily produce CVec, + // Sep 2020: Revised the vector computation method to reliably produce CVec, // and simplified the warning messages. // PURPOSE OF THIS SUBROUTINE: @@ -3071,7 +3066,7 @@ void CHKSBS(EnergyPlusData &state, // CALL ShowContinueError(state, 'Surface "'//TRIM(Surface(GRSNR)%Name)//'" '//TRIM(MSG(OverlapStatus))// & // ' SubSurface "'//TRIM(Surface(SBSNR)%Name)//'"') // IF (FirstSurroundError) THEN - // CALL ShowWarningError(state, 'Base Surface does not surround subsurface errors occuring...'// & + // CALL ShowWarningError(state, 'Base Surface does not surround subsurface errors occurring...'// & // 'Check that the SurfaceGeometry object is expressing the proper starting corner and '// & // 'direction [CounterClockwise/Clockwise]') // FirstSurroundError=.FALSE. @@ -4155,7 +4150,7 @@ void CLIPRECT(EnergyPlusData &state, int const NS2, int const NV1, int &NV3) } } - // update homogenous edges A,B,C + // update homogeneous edges A,B,C if (NV3 > 0) { Real64 const X_0(state.dataSolarShading->XTEMP[0]); Real64 const Y_0(state.dataSolarShading->YTEMP[0]); @@ -4769,7 +4764,6 @@ void CalcPerSolarBeam(EnergyPlusData &state, // Using/Aliasing - using ScheduleManager::LookUpScheduleValue; using WindowComplexManager::InitComplexWindows; using WindowComplexManager::UpdateComplexWindows; @@ -4809,7 +4803,7 @@ void CalcPerSolarBeam(EnergyPlusData &state, } } for (int hour = 1; hour <= 24; ++hour) { - for (int timestep = 1; timestep <= state.dataGlobal->NumOfTimeStepInHour; ++timestep) { + for (int timestep = 1; timestep <= state.dataGlobal->TimeStepsInHour; ++timestep) { for (int surfNum = firstSurf; surfNum <= lastSurf; ++surfNum) { state.dataHeatBal->SurfSunlitFrac(hour, timestep, surfNum) = 0.0; state.dataHeatBal->SurfCosIncAng(hour, timestep, surfNum) = 0.0; @@ -4818,7 +4812,7 @@ void CalcPerSolarBeam(EnergyPlusData &state, } } for (int hour = 1; hour <= 24; ++hour) { - for (int timestep = 1; timestep <= state.dataGlobal->NumOfTimeStepInHour; ++timestep) { + for (int timestep = 1; timestep <= state.dataGlobal->TimeStepsInHour; ++timestep) { for (int backSurfNum = 1; backSurfNum <= state.dataBSDFWindow->MaxBkSurf; ++backSurfNum) { for (int surfNum = firstSurf; surfNum <= lastSurf; ++surfNum) { state.dataHeatBal->SurfWinBackSurfaces(hour, timestep, backSurfNum, surfNum) = 0.0; @@ -4866,7 +4860,7 @@ void CalcPerSolarBeam(EnergyPlusData &state, if (!state.dataSysVars->DetailedSolarTimestepIntegration) { for (iHour = 1; iHour <= 24; ++iHour) { // Do for all hours - for (TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { + for (TS = 1; TS <= state.dataGlobal->TimeStepsInHour; ++TS) { FigureSunCosines(state, iHour, TS, AvgEqOfTime, AvgSinSolarDeclin, AvgCosSolarDeclin); } } @@ -4877,7 +4871,7 @@ void CalcPerSolarBeam(EnergyPlusData &state, UpdateComplexWindows(state); if (!state.dataSysVars->DetailedSolarTimestepIntegration) { for (iHour = 1; iHour <= 24; ++iHour) { // Do for all hours. - for (TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { + for (TS = 1; TS <= state.dataGlobal->TimeStepsInHour; ++TS) { FigureSolarBeamAtTimestep(state, iHour, TS); } // TimeStep Loop } // Hour Loop @@ -4914,7 +4908,7 @@ void FigureSunCosines(EnergyPlusData &state, auto &s_surf = state.dataSurface; - if (state.dataGlobal->NumOfTimeStepInHour != 1) { + if (state.dataGlobal->TimeStepsInHour != 1) { CurrentTime = double(iHour - 1) + double(iTimeStep) * (state.dataGlobal->TimeStepZone); } else { CurrentTime = double(iHour) + state.dataEnvrn->TS1TimeOffset; @@ -4923,7 +4917,7 @@ void FigureSunCosines(EnergyPlusData &state, // Save hourly values for use in DaylightingManager if (!state.dataSysVars->DetailedSolarTimestepIntegration) { - if (iTimeStep == state.dataGlobal->NumOfTimeStepInHour) s_surf->SurfSunCosHourly(iHour) = state.dataSolarShading->SUNCOS; + if (iTimeStep == state.dataGlobal->TimeStepsInHour) s_surf->SurfSunCosHourly(iHour) = state.dataSolarShading->SUNCOS; } else { s_surf->SurfSunCosHourly(iHour) = state.dataSolarShading->SUNCOS; } @@ -4944,7 +4938,6 @@ void FigureSolarBeamAtTimestep(EnergyPlusData &state, int const iHour, int const // This subroutine computes solar gain multipliers for beam solar using DataSystemVariables::ShadingMethod; - using ScheduleManager::LookUpScheduleValue; Real64 SurfArea; // Surface area. For walls, includes all window frame areas. Real64 Fac1WoShdg; // Intermediate calculation factor, without shading @@ -4965,7 +4958,7 @@ void FigureSolarBeamAtTimestep(EnergyPlusData &state, int const iHour, int const state.dataSolarShading->SUNCOS(2) * s_surf->Surface(SurfNum).OutNormVec(2) + state.dataSolarShading->SUNCOS(3) * s_surf->Surface(SurfNum).OutNormVec(3); if (!state.dataSysVars->DetailedSolarTimestepIntegration) { - if (iTimeStep == state.dataGlobal->NumOfTimeStepInHour) + if (iTimeStep == state.dataGlobal->TimeStepsInHour) state.dataHeatBal->SurfCosIncAngHR(iHour, SurfNum) = state.dataSolarShading->SurfSunCosTheta(SurfNum); } else { state.dataHeatBal->SurfCosIncAngHR(iHour, SurfNum) = state.dataSolarShading->SurfSunCosTheta(SurfNum); @@ -4976,9 +4969,9 @@ void FigureSolarBeamAtTimestep(EnergyPlusData &state, int const iHour, int const if ((state.dataSysVars->shadingMethod == ShadingMethod::Scheduled || state.dataSysVars->shadingMethod == ShadingMethod::Imported) && !state.dataGlobal->DoingSizing && state.dataGlobal->KindOfSim == Constant::KindOfSim::RunPeriodWeather) { for (int SurfNum = 1; SurfNum <= s_surf->TotSurfaces; ++SurfNum) { - if (s_surf->Surface(SurfNum).SurfSchedExternalShadingFrac) { - state.dataHeatBal->SurfSunlitFrac(iHour, iTimeStep, SurfNum) = - LookUpScheduleValue(state, s_surf->Surface(SurfNum).SurfExternalShadingSchInd, iHour, iTimeStep); + auto &surf = s_surf->Surface(SurfNum); + if (surf.SurfSchedExternalShadingFrac) { + state.dataHeatBal->SurfSunlitFrac(iHour, iTimeStep, SurfNum) = surf.surfExternalShadingSched->getHrTsVal(state, iHour, iTimeStep); } else { state.dataHeatBal->SurfSunlitFrac(iHour, iTimeStep, SurfNum) = 1.0; } @@ -4989,7 +4982,7 @@ void FigureSolarBeamAtTimestep(EnergyPlusData &state, int const iHour, int const if (s_surf->Surface(SurfNum).Area >= 1.e-10) { SurfArea = s_surf->Surface(SurfNum).NetAreaShadowCalc; if (!state.dataSysVars->DetailedSolarTimestepIntegration) { - if (iTimeStep == state.dataGlobal->NumOfTimeStepInHour) + if (iTimeStep == state.dataGlobal->TimeStepsInHour) state.dataHeatBal->SurfSunlitFracHR(iHour, SurfNum) = state.dataSolarShading->SurfSunlitArea(SurfNum) / SurfArea; } else { state.dataHeatBal->SurfSunlitFracHR(iHour, SurfNum) = state.dataSolarShading->SurfSunlitArea(SurfNum) / SurfArea; @@ -5881,12 +5874,6 @@ void SHDGSS(EnergyPlusData &state, // REFERENCES: // BLAST/IBLAST code, original author George Walton - // Using/Aliasing - using ScheduleManager::GetCurrentScheduleValue; - using ScheduleManager::GetScheduleMinValue; - using ScheduleManager::GetScheduleName; - using ScheduleManager::LookUpScheduleValue; - typedef Array2D::size_type size_type; int GSSNR; // General shadowing surface number int MainOverlapStatus; // Overlap status of the main overlap calculation not the check for @@ -5894,7 +5881,7 @@ void SHDGSS(EnergyPlusData &state, int NS1; // Number of the figure being overlapped int NS2; // Number of the figure doing overlapping int NS3; // Location to place results of overlap - Real64 SchValue; // Value for Schedule of shading transmittence + Real64 SchValue; // Value for Schedule of shading transmittance auto &s_surf = state.dataSurface; @@ -5936,14 +5923,14 @@ void SHDGSS(EnergyPlusData &state, if (notHeatTransSurf) { if (surface.IsTransparent) continue; // No shadow if shading surface is transparent - if (surface.SchedShadowSurfIndex > 0) { - if (LookUpScheduleValue(state, surface.SchedShadowSurfIndex, iHour) == 1.0) continue; + if (surface.shadowSurfSched != nullptr) { + if (surface.shadowSurfSched->getHrTsVal(state, iHour) == 1.0) continue; if (!state.dataSolarShading->CalcSkyDifShading) { - if (LookUpScheduleValue(state, surface.SchedShadowSurfIndex, iHour, TS) == 1.0) continue; + if (surface.shadowSurfSched->getHrTsVal(state, iHour, TS) == 1.0) continue; } } } - // Elimate shawdowing surfaces that is supposed to be disabled. + // Eliminate shadowing surfaces that is supposed to be disabled. if (state.dataSysVars->DisableAllSelfShading) { if (surface.Zone != 0) { continue; // Disable all shadowing surfaces in all zones. Attached shading surfaces are not part of a zone, zone value is 0. @@ -6028,9 +6015,9 @@ void SHDGSS(EnergyPlusData &state, } } HTRANS0(state, NS3, state.dataSolarShading->NumVertInShadowOrClippedSurface); - if (!state.dataSolarShading->CalcSkyDifShading) { + if (!state.dataSolarShading->CalcSkyDifShading && surface.shadowSurfSched != nullptr) { if (iHour != 0) { - SchValue = LookUpScheduleValue(state, surface.SchedShadowSurfIndex, iHour, TS); + SchValue = surface.shadowSurfSched->getHrTsVal(state, iHour, TS); } else { SchValue = surface.SchedMinValue; } @@ -6323,8 +6310,6 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // surfaces and interior solar radiation distribution using Dayltg::TransTDD; - using General::POLYF; - using ScheduleManager::GetCurrentScheduleValue; using namespace DataWindowEquivalentLayer; Array1D CFBoverlap; // Sum of boverlap for each back surface @@ -6509,7 +6494,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) int NGlass = thisConstruct.TotGlassLayers; Array1D AbWin(NGlass); // Factor for front beam radiation absorbed in window glass layer for (int Lay = 1; Lay <= NGlass; ++Lay) { - AbWin(Lay) = POLYF(CosInc, thisConstruct.AbsBeamCoef(Lay)) * CosInc * SunLitFract * + AbWin(Lay) = Window::POLYF(CosInc, thisConstruct.AbsBeamCoef(Lay)) * CosInc * SunLitFract * s_surf->SurfaceWindow(SurfNum).OutProjSLFracMult[state.dataGlobal->HourOfDay]; } if (!IS_SHADED_NO_GLARE_CTRL(ShadeFlag)) { @@ -6534,13 +6519,13 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) auto const &thisConstructSh = state.dataConstruction->Construct(ConstrNumSh); // Shade or switchable glazing on for (int Lay = 1; Lay <= NGlass; ++Lay) { - AbWinSh(Lay) = POLYF(CosInc, thisConstructSh.AbsBeamCoef(Lay)) * CosInc * FracSunLit; + AbWinSh(Lay) = Window::POLYF(CosInc, thisConstructSh.AbsBeamCoef(Lay)) * CosInc * FracSunLit; ADiffWinSh(Lay) = thisConstructSh.AbsDiff(Lay); } if (ShadeFlag == WinShadingType::IntShade) { // Exterior beam absorbed by INTERIOR SHADE // Note that AbsBeamShadeCoef includes effect of shade/glazing inter-reflection - Real64 AbsShade = POLYF(CosInc, - thisConstructSh.AbsBeamShadeCoef); // Interior shade or blind beam solar absorptance + Real64 AbsShade = Window::POLYF(CosInc, + thisConstructSh.AbsBeamShadeCoef); // Interior shade or blind beam solar absorptance state.dataSolarShading->SurfWinExtBeamAbsByShadFac(SurfNum) = (AbsShade * CosInc * SunLitFract * InOutProjSLFracMult + s_surf->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * thisConstructSh.AbsDiffShade) * @@ -6549,7 +6534,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) } else if (ShadeFlag == WinShadingType::ExtShade) { // Exterior beam absorbed by EXTERIOR SHADE state.dataSolarShading->SurfWinExtBeamAbsByShadFac(SurfNum) = thisConstructSh.AbsDiffShade * CosInc * SunLitFract; } else if (ShadeFlag == WinShadingType::BGShade) { // Exterior beam absorbed by BETWEEN-GLASS SHADE - Real64 AbsShade = POLYF(CosInc, thisConstructSh.AbsBeamShadeCoef); + Real64 AbsShade = Window::POLYF(CosInc, thisConstructSh.AbsBeamShadeCoef); state.dataSolarShading->SurfWinExtBeamAbsByShadFac(SurfNum) = AbsShade * CosInc * SunLitFract + s_surf->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * thisConstructSh.AbsDiffShade; @@ -6560,7 +6545,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) ProfAng = surfShade.blind.profAng; if (ShadeFlag == WinShadingType::IntBlind) { // Interior blind on - Real64 TBmBm = POLYF(CosInc, thisConstruct.TransSolBeamCoef); + Real64 TBmBm = Window::POLYF(CosInc, thisConstruct.TransSolBeamCoef); Real64 RGlDiffBack = thisConstruct.ReflectSolDiffBack; // Glazing system back diffuse solar reflectance Real64 RhoBlFront = FrontBeamDiffRefl; // Blind solar front beam reflectance Real64 RhoBlDiffFront = FrontDiffDiffRefl; // Blind solar front diffuse reflectance @@ -6597,8 +6582,8 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 RhoBlBack = BackBeamDiffRefl; // Blind solar back beam-diffuse reflectance Real64 RhoBlDiffBack = BackDiffDiffRefl; // Blind solar back diffuse reflectance Real64 RGlFront = - POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); // Glazing system solar front beam-beam reflectance - Real64 RGlDiffFront = thisConstruct.ReflectSolDiffFront; // Glazing system front diffuse solar reflectance + Window::POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); // Glazing system solar front beam-beam reflectance + Real64 RGlDiffFront = thisConstruct.ReflectSolDiffFront; // Glazing system front diffuse solar reflectance for (int Lay = 1; Lay <= NGlass; ++Lay) { Real64 ADiffWin = thisConstruct.AbsDiff(Lay); // Diffuse solar absorptance of glass layer, bare window Real64 AGlDiffFront = thisConstruct.AbsDiff(Lay); // Glass layer front diffuse solar absorptance @@ -6649,9 +6634,9 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 RScDifBack = screen->DfRef; Real64 RGlFront = - POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); // Glazing system solar front beam-beam reflectance - Real64 RGlDiffFront = thisConstruct.ReflectSolDiffFront; // Glazing system front diffuse solar reflectance - Real64 RGlDifFr = thisConstruct.ReflectSolDiffFront; // Diffuse front reflectance of glass + Window::POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); // Glazing system solar front beam-beam reflectance + Real64 RGlDiffFront = thisConstruct.ReflectSolDiffFront; // Glazing system front diffuse solar reflectance + Real64 RGlDifFr = thisConstruct.ReflectSolDiffFront; // Diffuse front reflectance of glass // Reduce the bare window absorbed beam by the screen beam transmittance and then account for // interreflections for (int Lay = 1; Lay <= NGlass; ++Lay) { @@ -6678,9 +6663,9 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 RScDifBack = screen->DfRef; Real64 RGlFront = - POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); // Glazing system solar front beam-beam reflectance - Real64 RGlDiffFront = thisConstruct.ReflectSolDiffFront; // Glazing system front diffuse solar reflectance - Real64 RGlDifFr = thisConstruct.ReflectSolDiffFront; // Diffuse front reflectance of glass + Window::POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); // Glazing system solar front beam-beam reflectance + Real64 RGlDiffFront = thisConstruct.ReflectSolDiffFront; // Glazing system front diffuse solar reflectance + Real64 RGlDifFr = thisConstruct.ReflectSolDiffFront; // Diffuse front reflectance of glass // Reduce the bare window absorbed beam by the screen beam transmittance and then account for // interreflections for (int Lay = 1; Lay <= NGlass; ++Lay) { @@ -6700,18 +6685,18 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) } else if (ShadeFlag == WinShadingType::BGBlind) { // Between-glass blind o // Isolated glass and blind properties at current incidence angle, profile angle and slat angle - Real64 t1 = POLYF(CosInc, - thisConstruct.tBareSolCoef(1)); // Bare-glass beam solar transmittance for glass layers 1,2 and 3 - Real64 t2 = POLYF(CosInc, thisConstruct.tBareSolCoef(2)); + Real64 t1 = Window::POLYF(CosInc, + thisConstruct.tBareSolCoef(1)); // Bare-glass beam solar trans for glass layers 1,2 and 3 + Real64 t2 = Window::POLYF(CosInc, thisConstruct.tBareSolCoef(2)); Real64 af1 = - POLYF(CosInc, - thisConstruct.afBareSolCoef(1)); // Bare-glass beam solar front absorptance for glass layers 1,2 and 3 - Real64 af2 = POLYF(CosInc, thisConstruct.afBareSolCoef(2)); - Real64 ab1 = - POLYF(CosInc, - thisConstruct.abBareSolCoef(1)); // Bare-glass beam solar back absorptance for glass layers 1,2 and 3 - Real64 ab2 = POLYF(CosInc, thisConstruct.abBareSolCoef(2)); - Real64 rf2 = POLYF(CosInc, thisConstruct.rfBareSolCoef(2)); + Window::POLYF(CosInc, + thisConstruct.afBareSolCoef(1)); // Bare-glass beam solar front abs for glass layers 1,2 and 3 + Real64 af2 = Window::POLYF(CosInc, thisConstruct.afBareSolCoef(2)); + Real64 ab1 = Window::POLYF( + CosInc, + thisConstruct.abBareSolCoef(1)); // Bare-glass beam solar back absorptance for glass layers 1,2 and 3 + Real64 ab2 = Window::POLYF(CosInc, thisConstruct.abBareSolCoef(2)); + Real64 rf2 = Window::POLYF(CosInc, thisConstruct.rfBareSolCoef(2)); Real64 td1 = thisConstruct.tBareSolDiff(1); // Bare-glass diffuse solar transmittance for glass layers 1,2 and 3 Real64 td2 = thisConstruct.tBareSolDiff(2); Real64 afd1 = thisConstruct.afBareSolDiff(1); // Bare-glass diffuse solar front absorptance for glass layers 1,2 and 3 @@ -6756,8 +6741,8 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) } else if (NGlass == 3) { Real64 t1t2 = t1 * t2; // t1*t2 Real64 td1td2 = td1 * td2; - Real64 af3 = POLYF(CosInc, thisConstruct.afBareSolCoef(3)); - Real64 rf3 = POLYF(CosInc, thisConstruct.rfBareSolCoef(3)); + Real64 af3 = Window::POLYF(CosInc, thisConstruct.afBareSolCoef(3)); + Real64 rf3 = Window::POLYF(CosInc, thisConstruct.rfBareSolCoef(3)); Real64 afd3 = thisConstruct.afBareSolDiff(3); Real64 rfd3 = thisConstruct.rfBareSolDiff(3); Real64 td2 = thisConstruct.tBareSolDiff(2); @@ -6844,11 +6829,11 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) } else if (s_surf->SurfWinWindowModelType(SurfNum) == WindowModel::EQL) { // call the ASHWAT fenestration model for optical properties - // determine the beam radiation absorptance and tranmittance of the + // determine the beam radiation absorptance and transmittance of the // the equivalent layer window model WindowEquivalentLayer::CalcEQLOpticalProperty(state, SurfNum, SolarArrays::BEAM, state.dataSolarShading->SurfWinAbsSolBeamEQL); auto &CFS = state.dataWindowEquivLayer->CFS; - // recalcuate the diffuse absorptance and transmittance of the + // recalculate the diffuse absorptance and transmittance of the // the equivalent layer window model if there is shade control int EQLNum = state.dataConstruction->Construct(surf.Construction).EQLConsPtr; // equivalent layer fenestration index if (CFS(EQLNum).ISControlled) { @@ -7001,9 +6986,9 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) state.dataDaylightingDevicesData->TDDPipe(PipeNum).TransSolBeam = TBmDif; // Report variable } else if (s_surf->SurfWinWindowModelType(SurfNum) == WindowModel::Detailed) { // Regular window if (!s_surf->SurfWinSolarDiffusing(SurfNum)) { // Clear glazing - TBmBm = POLYF(CosInc, thisConstruct.TransSolBeamCoef); //[-] + TBmBm = Window::POLYF(CosInc, thisConstruct.TransSolBeamCoef); //[-] } else { // Diffusing glazing - TBmDif = POLYF(CosInc, thisConstruct.TransSolBeamCoef); //[-] + TBmDif = Window::POLYF(CosInc, thisConstruct.TransSolBeamCoef); //[-] } } else if (s_surf->SurfWinWindowModelType(SurfNum) == WindowModel::BSDF) { // Need to check what effect, if any, defining these here has @@ -7047,10 +7032,10 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) if (s_surf->SurfWinWindowModelType(SurfNum) != WindowModel::EQL) { if (IS_SHADED_NO_GLARE_CTRL(ShadeFlag)) { // Shade or screen or blind on, or switchable glazing - // (note in the following that diffusing glass is not allowed in a window with shade, blind or switchable glazing) + // (note in the following that diffusing glass is not oallowed in a window with shade, blind or switchable glazing) if (ANY_SHADE(ShadeFlag) || ShadeFlag == WinShadingType::SwitchableGlazing) { // Shade on or switchable glazing - TBmAllShBlSc = POLYF(CosInc, thisConstructSh.TransSolBeamCoef); + TBmAllShBlSc = Window::POLYF(CosInc, thisConstructSh.TransSolBeamCoef); } else { // Blind or Screen on Real64 TScBmDif; // Beam-diffuse solar transmittance of screen @@ -7084,8 +7069,8 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 RScBack = BilinearInterp(b11.RefSolFront, b12.RefSolFront, b21.RefSolFront, b22.RefSolFront, coeffs); Real64 RScDifBack = screen->DfRef; - Real64 RGlBmFr = POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); // Beam front reflectance of glass - Real64 RGlDifFr = thisConstruct.ReflectSolDiffFront; // Diffuse front reflectance of glass + Real64 RGlBmFr = Window::POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); // Beam front reflectance of glass + Real64 RGlDifFr = thisConstruct.ReflectSolDiffFront; // Diffuse front reflectance of glass // beam transmittance (written in subroutine CalcScreenTransmittance each time step) TScBmBm = BilinearInterp(b11.BmTrans, b12.BmTrans, b21.BmTrans, b22.BmTrans, coeffs); TBmBmSc = TBmBm * TScBmBm; @@ -7106,8 +7091,8 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 RScBack = btar.RefSolFront; Real64 RScDifBack = screen->DfRef; - Real64 RGlBmFr = POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); // Beam front reflectance of glass - Real64 RGlDifFr = thisConstruct.ReflectSolDiffFront; // Diffuse front reflectance of glass + Real64 RGlBmFr = Window::POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); // Beam front reflectance of glass + Real64 RGlDifFr = thisConstruct.ReflectSolDiffFront; // Diffuse front reflectance of glass // beam transmittance (written in subroutine CalcScreenTransmittance each time step) TScBmBm = btar.BmTrans; TBmBmSc = TBmBm * TScBmBm; @@ -7128,7 +7113,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) if (ShadeFlag == WinShadingType::IntBlind) { Real64 RhoBlBmDifFr = FrontBeamDiffRefl; // Beam-diffuse front reflectance of blind Real64 RGlDifBk = thisConstruct.ReflectSolDiffBack; // Diffuse front reflectance of glass - Real64 RhoBlDifDifFr = FrontDiffDiffRefl; // Diffuse-diffuse front refectance of blind + Real64 RhoBlDifDifFr = FrontDiffDiffRefl; // Diffuse-diffuse front reflectance of blind // beam-beam and diffuse transmittance of exterior beam TBmBmBl = TBmBm * TBlBmBm; TBlDifDif = FrontDiffDiffTrans; @@ -7139,8 +7124,8 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) if (TBmDifShBlSc < 0.0) TBmDifShBlSc = 0.0; } else if (ShadeFlag == WinShadingType::ExtBlind) { Real64 RhoBlBmDifBk = BackBeamDiffRefl; // Beam-diffuse back reflectance of blind - Real64 RhoBlDifDifBk = BackDiffDiffRefl; // Diffuse-diffuse back refectance of blind - Real64 RGlBmFr = POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); + Real64 RhoBlDifDifBk = BackDiffDiffRefl; // Diffuse-diffuse back reflectance of blind + Real64 RGlBmFr = Window::POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); Real64 RGlDifFr = thisConstruct.ReflectSolDiffFront; // beam-beam and diffuse transmittance of exterior beam TBmBmBl = TBmBm * TBlBmBm; @@ -7157,11 +7142,11 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 rfshd = FrontDiffDiffRefl; Real64 rbshd = BackDiffDiffRefl; Real64 tfshBd = FrontBeamDiffTrans; - Real64 t1 = POLYF(CosInc, thisConstruct.tBareSolCoef(1)); - Real64 t2 = POLYF(CosInc, thisConstruct.tBareSolCoef(2)); + Real64 t1 = Window::POLYF(CosInc, thisConstruct.tBareSolCoef(1)); + Real64 t2 = Window::POLYF(CosInc, thisConstruct.tBareSolCoef(2)); Real64 tfshBB = surfShade.blind.bmBmTrans; if (NGlass == 2) { - Real64 rf2 = POLYF(CosInc, thisConstruct.rfBareSolCoef(2)); + Real64 rf2 = Window::POLYF(CosInc, thisConstruct.rfBareSolCoef(2)); Real64 rfshB = FrontBeamDiffRefl; Real64 rfd2 = thisConstruct.rfBareSolDiff(2); TBmBmBl = t1 * tfshBB * t2; @@ -7169,9 +7154,9 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) t1 * (tfshBB * rf2 * rbshB + tfshBd * (1.0 + rfd2 * rbshd) + rfshB * rbd1 * rfshd) * td2; } else { // NGlass = 3 Real64 t1t2 = t1 * t2; - Real64 t3 = POLYF(CosInc, thisConstruct.tBareSolCoef(3)); + Real64 t3 = Window::POLYF(CosInc, thisConstruct.tBareSolCoef(3)); Real64 td3 = thisConstruct.tBareSolDiff(3); - Real64 rf3 = POLYF(CosInc, thisConstruct.rfBareSolCoef(3)); + Real64 rf3 = Window::POLYF(CosInc, thisConstruct.rfBareSolCoef(3)); Real64 rbd2 = thisConstruct.rbBareSolDiff(2); Real64 rfd3 = thisConstruct.rfBareSolDiff(3); Real64 tfshd = FrontDiffDiffTrans; @@ -7390,8 +7375,9 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) auto &surfShadeBack = s_surf->surfShades(BackSurfNum); int ConstrNumBack = s_surf->SurfActiveConstruction(BackSurfNum); + auto const &constrBack = state.dataConstruction->Construct(ConstrNumBack); - int NBackGlass = state.dataConstruction->Construct(ConstrNumBack).TotGlassLayers; + int NBackGlass = constrBack.TotGlassLayers; // Irradiated (overlap) area for this back surface, projected onto window plane // (includes effect of shadowing on exterior window) Real64 AOverlap = @@ -7399,7 +7385,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // Back surface area irradiated by beam solar from an exterior window, projected onto window plane Real64 BOverlap = TBm * AOverlap * CosInc; //[m2] // AOverlap multiplied by exterior window beam transmittance and cosine of incidence angle - if (state.dataConstruction->Construct(ConstrNumBack).TransDiff <= 0.0) { + if (constrBack.TransDiff <= 0.0) { // Back surface is opaque interior or exterior wall // Interior solar absorptance of opaque surface @@ -7434,10 +7420,9 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // or interior window WITHOUT SHADING this timestep if (NOT_SHADED(ShadeFlagBack)) { for (int Lay = 1; Lay <= NBackGlass; ++Lay) { - state.dataSolarShading->SurfWinAbsBeam(Lay) = - POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).AbsBeamBackCoef(Lay)); + state.dataSolarShading->SurfWinAbsBeam(Lay) = Window::POLYF(CosIncBack, constrBack.AbsBeamBackCoef(Lay)); } - TransBeamWin = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).TransSolBeamCoef); + TransBeamWin = Window::POLYF(CosIncBack, constrBack.TransSolBeamCoef); } // Interior beam absorptance of glass layers and beam transmittance @@ -7445,9 +7430,9 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) if (ANY_SHADE(ShadeFlagBack)) { for (int Lay = 1; Lay <= state.dataConstruction->Construct(ConstrNumBackSh).TotGlassLayers; ++Lay) { state.dataSolarShading->SurfWinAbsBeam(Lay) = - POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBackSh).AbsBeamBackCoef(Lay)); + Window::POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBackSh).AbsBeamBackCoef(Lay)); } - TransBeamWin = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBackSh).TransSolBeamCoef); + TransBeamWin = Window::POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBackSh).TransSolBeamCoef); } // Interior beam absorbed by INTERIOR SHADE of back exterior window @@ -7460,15 +7445,14 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // Interior beam absorbed by EXTERIOR SHADE of back exterior window } else if (ShadeFlagBack == WinShadingType::ExtShade) { - Real64 RGlFront = state.dataConstruction->Construct(ConstrNumBack).ReflectSolDiffFront; + Real64 RGlFront = constrBack.ReflectSolDiffFront; auto const *matSh = s_mat->materials(state.dataConstruction->Construct(ConstrNumBackSh).LayerPoint(1)); auto const *matFenSh = dynamic_cast(matSh); assert(matFenSh != nullptr); Real64 AbsSh = matFenSh->AbsorpSolar; Real64 RhoSh = 1.0 - AbsSh - matFenSh->Trans; - Real64 AShBack = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).TransSolBeamCoef) * AbsSh / - (1.0 - RGlFront * RhoSh); + Real64 AShBack = Window::POLYF(CosIncBack, constrBack.TransSolBeamCoef) * AbsSh / (1.0 - RGlFront * RhoSh); BABSZone += BOverlap * AShBack; backSurfBeamSolInTrans += BOverlap * AShBack; state.dataSolarShading->SurfWinIntBeamAbsByShadFac(BackSurfNum) = @@ -7476,11 +7460,11 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // Interior beam absorbed by BETWEEN-GLASS SHADE of back exterior window } else if (ShadeFlagBack == WinShadingType::BGShade) { - Real64 rbd1k = state.dataConstruction->Construct(ConstrNumBack).rbBareSolDiff(1); - Real64 rfd2k = state.dataConstruction->Construct(ConstrNumBack).rfBareSolDiff(2); + Real64 rbd1k = constrBack.rbBareSolDiff(1); + Real64 rfd2k = constrBack.rfBareSolDiff(2); Real64 AShBack; // System shade absorptance for interior beam solar if (NBackGlass == 2) { - Real64 t2k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).tBareSolCoef(2)); + Real64 t2k = Window::POLYF(CosIncBack, constrBack.tBareSolCoef(2)); auto const *matShade = dynamic_cast( s_mat->materials(state.dataConstruction->Construct(ConstrNumBackSh).LayerPoint(3))); assert(matShade != nullptr); @@ -7489,10 +7473,10 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 AbsSh = min(1.0, max(0.0, 1 - TrSh - RhoSh)); // Shade material solar absorptance AShBack = t2k * (1 + RhoSh * rfd2k + TrSh * rbd1k) * AbsSh; } else { // NBackGlass = 3 - Real64 t3k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).tBareSolCoef(3)); - Real64 td2k = state.dataConstruction->Construct(ConstrNumBack).tBareSolDiff(2); - Real64 rbd2k = state.dataConstruction->Construct(ConstrNumBack).rbBareSolDiff(2); - Real64 rfd3k = state.dataConstruction->Construct(ConstrNumBack).rfBareSolDiff(3); + Real64 t3k = Window::POLYF(CosIncBack, constrBack.tBareSolCoef(3)); + Real64 td2k = constrBack.tBareSolDiff(2); + Real64 rbd2k = constrBack.rbBareSolDiff(2); + Real64 rfd3k = constrBack.rfBareSolDiff(3); auto const *matShade = dynamic_cast( s_mat->materials(state.dataConstruction->Construct(ConstrNumBackSh).LayerPoint(5))); assert(matShade != nullptr); @@ -7522,7 +7506,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) int profIdxHiBack = surfShadeBack.blind.profAngIdxHi; Real64 profInterpFacBack = surfShadeBack.blind.profAngInterpFac; - Real64 TGlBmBack = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).TransSolBeamCoef); + Real64 TGlBmBack = Window::POLYF(CosIncBack, constrBack.TransSolBeamCoef); Real64 TBlBmBmBack = matBlindBack->BeamBeamTrans(profAngBack, Constant::Pi - slatAngBack); // Blind solar back beam-diffuse transmittance @@ -7542,25 +7526,21 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Interp(btar.Sol.Bk.Bm[profIdxLoBack].Abs, btar.Sol.Bk.Bm[profIdxHiBack].Abs, profInterpFacBack); Real64 RhoBlDiffFront = FrontDiffDiffRefl; // Glazing system solar back beam-beam reflectance - Real64 RGlBack = POLYF(CosIncBack, - state.dataConstruction->Construct(ConstrNumBack) - .ReflSolBeamBackCoef); // Glazing system back diffuse solar reflectance - Real64 RGlDiffBack = state.dataConstruction->Construct(ConstrNumBack).ReflectSolDiffBack; + Real64 RGlBack = Window::POLYF( + CosIncBack, constrBack.ReflSolBeamBackCoef); // Glazing system back diffuse solar reflectance + Real64 RGlDiffBack = constrBack.ReflectSolDiffBack; for (int Lay = 1; Lay <= NBackGlass; ++Lay) { - Real64 AbWinBack = - POLYF(CosIncBack, - state.dataConstruction->Construct(ConstrNumBack) - .AbsBeamBackCoef(Lay)); // Factor for back beam radiation absorbed in window glass layer - Real64 AGlDiffBack = state.dataConstruction->Construct(ConstrNumBack) - .AbsDiffBack(Lay); // Glass layer back diffuse solar absorptance + Real64 AbWinBack = Window::POLYF( + CosIncBack, + constrBack.AbsBeamBackCoef(Lay)); // Factor for back beam radiation absorbed in window glass layer + Real64 AGlDiffBack = constrBack.AbsDiffBack(Lay); // Glass layer back diffuse solar absorptance state.dataSolarShading->SurfWinAbsBeam(Lay) = TBlBmBmBack * AbWinBack + ((TBlBmBmBack * RGlBack * RhoBlFront + TBlBmDiffBack) * AGlDiffBack / (1.0 - RGlDiffBack * RhoBlDiffFront)); } // Interior beam transmitted by exterior back window with INTERIOR BLIND - Real64 TGlDif = - state.dataConstruction->Construct(ConstrNumBack).TransDiff; // Bare diffuse transmittance of back window + Real64 TGlDif = constrBack.TransDiff; // Bare diffuse transmittance of back window TransBeamWin = TBlBmBmBack * (TGlBmBack + TGlDif * RGlBack * RhoBlFront / (1.0 - RGlDiffBack * RhoBlDiffFront)) + TBlBmDiffBack * TGlDif / (1.0 - RGlDiffBack * RhoBlDiffFront); @@ -7593,9 +7573,8 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Interp(btar.Sol.Bk.Bm[profIdxLoBack].Abs, btar.Sol.Bk.Bm[profIdxHiBack].Abs, profInterpFacBack); for (int Lay = 1; Lay <= NBackGlass; ++Lay) { - Real64 AbWinBack = - POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).AbsBeamBackCoef(Lay)); - Real64 AGlDiffFront = state.dataConstruction->Construct(ConstrNumBack).AbsDiff(Lay); + Real64 AbWinBack = Window::POLYF(CosIncBack, constrBack.AbsBeamBackCoef(Lay)); + Real64 AGlDiffFront = constrBack.AbsDiff(Lay); state.dataSolarShading->SurfWinAbsBeam(Lay) = AbWinBack + (TGlBmBack * AGlDiffFront * RhoBlBack / (1.0 - RhoBlBack * RGlDiffFront)); } @@ -7617,21 +7596,21 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) } else { // ShadeFlagBack == BGBlindOn - Real64 t1k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).tBareSolCoef(1)); - Real64 t2k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).tBareSolCoef(2)); - Real64 af2k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).afBareSolCoef(2)); - Real64 ab1k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).abBareSolCoef(1)); - Real64 ab2k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).abBareSolCoef(2)); - Real64 rb1k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).rbBareSolCoef(1)); - Real64 rb2k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).rbBareSolCoef(2)); - Real64 td1k = state.dataConstruction->Construct(ConstrNumBack).tBareSolDiff(1); - Real64 td2k = state.dataConstruction->Construct(ConstrNumBack).tBareSolDiff(2); - Real64 afd2k = state.dataConstruction->Construct(ConstrNumBack).afBareSolDiff(2); - Real64 abd1k = state.dataConstruction->Construct(ConstrNumBack).abBareSolDiff(1); - Real64 abd2k = state.dataConstruction->Construct(ConstrNumBack).abBareSolDiff(2); - Real64 rfd2k = state.dataConstruction->Construct(ConstrNumBack).rfBareSolDiff(2); - Real64 rbd1k = state.dataConstruction->Construct(ConstrNumBack).rbBareSolDiff(1); - Real64 rbd2k = state.dataConstruction->Construct(ConstrNumBack).rbBareSolDiff(2); + Real64 t1k = Window::POLYF(CosIncBack, constrBack.tBareSolCoef(1)); + Real64 t2k = Window::POLYF(CosIncBack, constrBack.tBareSolCoef(2)); + Real64 af2k = Window::POLYF(CosIncBack, constrBack.afBareSolCoef(2)); + Real64 ab1k = Window::POLYF(CosIncBack, constrBack.abBareSolCoef(1)); + Real64 ab2k = Window::POLYF(CosIncBack, constrBack.abBareSolCoef(2)); + Real64 rb1k = Window::POLYF(CosIncBack, constrBack.rbBareSolCoef(1)); + Real64 rb2k = Window::POLYF(CosIncBack, constrBack.rbBareSolCoef(2)); + Real64 td1k = constrBack.tBareSolDiff(1); + Real64 td2k = constrBack.tBareSolDiff(2); + Real64 afd2k = constrBack.afBareSolDiff(2); + Real64 abd1k = constrBack.abBareSolDiff(1); + Real64 abd2k = constrBack.abBareSolDiff(2); + Real64 rfd2k = constrBack.rfBareSolDiff(2); + Real64 rbd1k = constrBack.rbBareSolDiff(1); + Real64 rbd2k = constrBack.rbBareSolDiff(2); Real64 tfshBBk = matBlindBack->BeamBeamTrans(profAngBack, slatAngBack); Real64 tbshBBk = matBlindBack->BeamBeamTrans(profAngBack, Constant::Pi - slatAngBack); @@ -7669,11 +7648,11 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // Interior beam absorbed by BLIND on exterior back window with BETWEEN-GLASS BLIND ABlBack = t2k * (abshBk + tbshBBk * rb1k * afshBk + rbshBk * rfd2k * abshdk + tbshBdk * rbd1k * afshdk); } else { // NBackGlass = 3 - Real64 t3k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).tBareSolCoef(3)); - Real64 af3k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).afBareSolCoef(3)); - Real64 ab3k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).abBareSolCoef(3)); - Real64 afd3k = state.dataConstruction->Construct(ConstrNumBack).afBareSolDiff(3); - Real64 rfd3k = state.dataConstruction->Construct(ConstrNumBack).rfBareSolDiff(3); + Real64 t3k = Window::POLYF(CosIncBack, constrBack.tBareSolCoef(3)); + Real64 af3k = Window::POLYF(CosIncBack, constrBack.afBareSolCoef(3)); + Real64 ab3k = Window::POLYF(CosIncBack, constrBack.abBareSolCoef(3)); + Real64 afd3k = constrBack.afBareSolDiff(3); + Real64 rfd3k = constrBack.rfBareSolDiff(3); state.dataSolarShading->SurfWinAbsBeam(3) = ab3k + t3k * tbshBBk * (rb2k + t2k * rb1k * t2k) * tfshBBk * af3k + t3k * @@ -7706,8 +7685,8 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) } else if (ShadeFlagBack == WinShadingType::ExtScreen) { // Interior beam absorptance of GLASS LAYERS of exterior back window with EXTERIOR SCREEN - Real64 TGlBmBack = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).TransSolBeamCoef); - Real64 RGlDiffFront = state.dataConstruction->Construct(ConstrNumBack).ReflectSolDiffFront; + Real64 TGlBmBack = Window::POLYF(CosIncBack, constrBack.TransSolBeamCoef); + Real64 RGlDiffFront = constrBack.ReflectSolDiffFront; auto const *screen = dynamic_cast(s_mat->materials(ScNum)); assert(screen != nullptr); @@ -7736,8 +7715,8 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 RScBack = BilinearInterp(b11.RefSolFront, b12.RefSolFront, b21.RefSolFront, b22.RefSolFront, coeffs); Real64 RScDifBack = screen->DfRef; for (int Lay = 1; Lay <= NBackGlass; ++Lay) { - Real64 AbWinBack = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).AbsBeamBackCoef(Lay)); - Real64 AGlDiffFront = state.dataConstruction->Construct(ConstrNumBack).AbsDiff(Lay); + Real64 AbWinBack = Window::POLYF(CosIncBack, constrBack.AbsBeamBackCoef(Lay)); + Real64 AGlDiffFront = constrBack.AbsDiff(Lay); state.dataSolarShading->SurfWinAbsBeam(Lay) = AbWinBack + (TGlBmBack * AGlDiffFront * RScBack / (1.0 - RScDifBack * RGlDiffFront)); } @@ -7771,8 +7750,8 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 RScBack = btar.RefSolFront; Real64 RScDifBack = screen->DfRef; for (int Lay = 1; Lay <= NBackGlass; ++Lay) { - Real64 AbWinBack = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).AbsBeamBackCoef(Lay)); - Real64 AGlDiffFront = state.dataConstruction->Construct(ConstrNumBack).AbsDiff(Lay); + Real64 AbWinBack = Window::POLYF(CosIncBack, constrBack.AbsBeamBackCoef(Lay)); + Real64 AGlDiffFront = constrBack.AbsDiff(Lay); state.dataSolarShading->SurfWinAbsBeam(Lay) = AbWinBack + (TGlBmBack * AGlDiffFront * RScBack / (1.0 - RScDifBack * RGlDiffFront)); } @@ -7805,12 +7784,14 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 SwitchFac = s_surf->SurfWinSwitchingFactor(SurfNum); // Switching factor for a window Real64 AbsBeamWinSh; // Glass layer beam solar absorptance of a shaded window for (int Lay = 1; Lay <= NBackGlass; ++Lay) { - AbsBeamWinSh = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBackSh).AbsBeamBackCoef(Lay)); + AbsBeamWinSh = + Window::POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBackSh).AbsBeamBackCoef(Lay)); state.dataSolarShading->SurfWinAbsBeam(Lay) = Window::InterpSw(SwitchFac, state.dataSolarShading->SurfWinAbsBeam(Lay), AbsBeamWinSh); } // Beam solar transmittance of a shaded window - Real64 TransBeamWinSh = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBackSh).TransSolBeamCoef); + Real64 TransBeamWinSh = + Window::POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBackSh).TransSolBeamCoef); TransBeamWin = Window::InterpSw(SwitchFac, TransBeamWin, TransBeamWinSh); } @@ -7879,7 +7860,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) CFBoverlap = 0.0; // Calculate effects on all back surfaces for each of basis directions. Each of basis directions from the back of the - // window has to be considered as beam and therefore calcualte CFBoverlap for each of them + // window has to be considered as beam and therefore calculate CFBoverlap for each of them for (int CurTrnDir = 1; CurTrnDir <= state.dataBSDFWindow->ComplexWind(SurfNum).Geom(CurCplxFenState).Trn.NBasis; ++CurTrnDir) { Real64 CurLambda = state.dataBSDFWindow->ComplexWind(SurfNum) @@ -7900,6 +7881,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) for (int IBack = 1; IBack <= NBkSurf; ++IBack) { int BackSurfaceNumber = state.dataShadowComb->ShadowComb(BaseSurf).BackSurf(IBack); int ConstrNumBack = s_surf->Surface(BackSurfaceNumber).Construction; + auto const &constrBack = state.dataConstruction->Construct(ConstrNumBack); // Do not perform any calculation if surface is scheduled for incoming solar radiation int SurfSolIncPtr = SurfaceScheduledSolarInc(state, BackSurfaceNumber, ConstrNumBack); @@ -7916,7 +7898,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) CurTrnDir <= state.dataBSDFWindow->ComplexWind(SurfNum).Geom(CurCplxFenState).Trn.NBasis; ++CurTrnDir) { Real64 bestDot; // complex fenestration hits other complex fenestration, it is important to find - // matching beam directions. Beam leving one window will have certaing number for it's basis + // matching beam directions. Beam leaving one window will have certain number for it's basis // while same beam reaching back surface will have different beam number. This value is used // to keep best matching dot product for those directions Real64 curDot; // temporary variable for current dot product @@ -7951,15 +7933,15 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) babs * state.dataEnvrn->BeamSolarRad; //[W] // Absorptance from current back direction - int TotSolidLay = state.dataConstruction->Construct(ConstrNumBack).TotSolidLayers; + int TotSolidLay = constrBack.TotSolidLayers; for (int Lay = 1; Lay <= TotSolidLay; ++Lay) { // IF (ALLOCATED(Construct(ConstrNumBack)%BSDFInput)) THEN // CFDirBoverlap is energy transmitted for current basis beam. It is important to note that // AWinOverlap array needs to contain flux and not absorbed energy because later in the code // this will be multiplied with window area s_surf->SurfWinACFOverlap(BackSurfaceNumber, Lay) += - state.dataConstruction->Construct(ConstrNumBack).BSDFInput.Layer(Lay).BkAbs(bestBackTrn, 1) * - CFDirBoverlap(IBack, CurTrnDir) / s_surf->Surface(BackSurfaceNumber).Area; + constrBack.BSDFInput.Layer(Lay).BkAbs(bestBackTrn, 1) * CFDirBoverlap(IBack, CurTrnDir) / + s_surf->Surface(BackSurfaceNumber).Area; // END IF } @@ -7985,9 +7967,9 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) } } } else { - if (state.dataConstruction->Construct(ConstrNumBack).TransDiff <= 0.0) { + if (constrBack.TransDiff <= 0.0) { // Do not take into account this window if it is scheduled for surface gains - Real64 AbsIntSurf = state.dataConstruction->Construct(ConstrNumBack).InsideAbsorpSolar; + Real64 AbsIntSurf = constrBack.InsideAbsorpSolar; s_surf->SurfOpaqAI(BackSurfaceNumber) += CFBoverlap(IBack) * AbsIntSurf / s_surf->Surface(BackSurfaceNumber).Area; BABSZone += CFBoverlap(IBack) * AbsIntSurf; @@ -8012,7 +7994,8 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) if (s_surf->SurfWinWindowModelType(IBack) != WindowModel::EQL) continue; // only EQL back window is allowed int ConstrNumBack = s_surf->Surface(BackSurfNum).Construction; - int NBackGlass = state.dataConstruction->Construct(ConstrNumBack).TotGlassLayers; + auto const &constrBack = state.dataConstruction->Construct(ConstrNumBack); + int NBackGlass = constrBack.TotGlassLayers; // Irradiated (overlap) area for this back surface, projected onto window plane // (includes effect of shadowing on exterior window) @@ -8020,7 +8003,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) state.dataHeatBal->SurfWinOverlapAreas(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, IBack, SurfNum); Real64 BOverlap = TBm * AOverlap * CosInc; //[m2] - if (state.dataConstruction->Construct(ConstrNumBack).TransDiff <= 0.0) { + if (constrBack.TransDiff <= 0.0) { // Back surface is opaque interior or exterior wall Real64 AbsIntSurf = state.dataHeatBalSurf->SurfAbsSolarInt(BackSurfNum); @@ -8040,13 +8023,13 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 backSurfBeamSolInTrans = 0.0; // Fraction of BeamSolarRad transmitted out through window inside face [W] // Interior beam absorptance of glass layers and beam transmittance of back exterior & - // or interior window (treates windows with/without shades as defined) for this timestep + // or interior window (treats windows with/without shades as defined) for this timestep // call the ASHWAT fenestration model for beam radiation here WindowEquivalentLayer::CalcEQLOpticalProperty( state, BackSurfNum, SolarArrays::BEAM, state.dataSolarShading->SurfWinAbsSolBeamBackEQL); auto &CFS = state.dataWindowEquivLayer->CFS; - int EQLNum = state.dataConstruction->Construct(ConstrNumBack).EQLConsPtr; + int EQLNum = constrBack.EQLConsPtr; state.dataSolarShading->SurfWinAbsBeamEQL({1, CFS(EQLNum).NL}) = state.dataSolarShading->SurfWinAbsSolBeamBackEQL(1, {1, CFS(EQLNum).NL}); // get the interior beam transmitted through back exterior or interior EQL window @@ -8199,8 +8182,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) if (surf.SolarEnclIndex == enclosureNum) { Real64 AbsIntSurf = state.dataConstruction->Construct(surf.Construction).InsideAbsorpSolar; // SolarIntoZone = GetCurrentScheduleValue(SurfIncSolSSG(iSSG)%SchedPtr) * Surface(SurfNum)%Area - Real64 SolarIntoZone = - GetCurrentScheduleValue(state, s_surf->SurfIncSolSSG(iSSG).SchedPtr); // Solar radiation into zone to current surface + Real64 SolarIntoZone = s_surf->SurfIncSolSSG(iSSG).sched->getCurrentVal(); // Solar radiation into zone to current surface s_surf->SurfOpaqAI(SurfNum) = SolarIntoZone * AbsIntSurf; BABSZoneSSG += s_surf->SurfOpaqAI(SurfNum) * surf.Area; BTOTZoneSSG += SolarIntoZone * surf.Area; @@ -8430,7 +8412,6 @@ void CalcInteriorSolarDistributionWCESimple(EnergyPlusData &state) // gain into zone from exterior window, beam solar on exterior window transmitted as beam and/or diffuse // and interior beam from exterior window that is absorbed/transmitted by back surfaces - using ScheduleManager::GetCurrentScheduleValue; using namespace MultiLayerOptics; auto &s_surf = state.dataSurface; @@ -8493,8 +8474,8 @@ void CalcInteriorSolarDistributionWCESimple(EnergyPlusData &state) int CurrentState = s_surf->SurfaceWindow(SurfNum).ComplexFen.CurrentState; auto &cplxState = s_surf->SurfaceWindow(SurfNum).ComplexFen.State(CurrentState); for (size_t Lay = 1; Lay <= numOfLayers; ++Lay) { - // Simon: Imporant note about this equation is to use BeamSolarRad and not SurfQRadSWOutIncident - // is becuase BeamSolarRad is direct normal radiation (looking at the Sun) while SurfRadSWOutIncident + // Simon: Important note about this equation is to use BeamSolarRad and not SurfQRadSWOutIncident + // is because BeamSolarRad is direct normal radiation (looking at the Sun) while SurfRadSWOutIncident // is normal to window incidence. Since BSDF coefficients are taking into account angle of incidence, // BeamSolarRad should be used in this case state.dataHeatBal->SurfWinQRadSWwinAbs(SurfNum, Lay) = @@ -8595,13 +8576,14 @@ void CalcInteriorSolarDistributionWCESimple(EnergyPlusData &state) if (BackSurfNum == 0) break; // No more irradiated back surfaces for this exterior window int ConstrNumBack = s_surf->Surface(BackSurfNum).Construction; + auto const &constrBack = state.dataConstruction->Construct(ConstrNumBack); // NBackGlass = Construct( ConstrNumBack ).TotGlassLayers; // Irradiated (overlap) area for this back surface, projected onto window plane // (includes effect of shadowing on exterior window) Real64 AOverlap = state.dataHeatBal->SurfWinOverlapAreas(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, IBack, SurfNum); Real64 BOverlap = TBm * AOverlap * CosInc; //[m2] - if (state.dataConstruction->Construct(ConstrNumBack).TransDiff <= 0.0) { + if (constrBack.TransDiff <= 0.0) { // Back surface is opaque interior or exterior wall Real64 AbsIntSurf = state.dataHeatBalSurf->SurfAbsSolarInt(BackSurfNum); @@ -8837,7 +8819,7 @@ void SHDRVL(EnergyPlusData &state, // REFERENCES: // BLAST/IBLAST code, original author George Walton - int NVS; // Number of verticies + int NVS; // Number of vertices int constexpr None(0); // for use with RevealStatus int constexpr EntireWindowShadedByReveal(1); // for use with RevealStatus @@ -8950,7 +8932,7 @@ void SHDRVL(EnergyPlusData &state, state.dataSolarShading->YVS(N) = s_surf->ShadeV(SBSNR).YV(NVS + 1 - N); } - // Transform to homogenous coordinates + // Transform to homogeneous coordinates NS2 = state.dataSolarShading->LOCHCA + 1; state.dataSolarShading->LOCHCA = NS2; @@ -9249,7 +9231,7 @@ void SUN4(EnergyPlusData &state, // Compute the hour angle HrAngle = (15.0 * (12.0 - (CurrentTime + EqOfTime)) + (state.dataEnvrn->TimeZoneMeridian - state.dataEnvrn->Longitude)); - H = HrAngle * Constant::DegToRadians; + H = HrAngle * Constant::DegToRad; // Compute the cosine of the solar zenith angle. state.dataSolarShading->SUNCOS(3) = SinSolarDeclin * state.dataEnvrn->SinLatitude + CosSolarDeclin * state.dataEnvrn->CosLatitude * std::cos(H); @@ -9323,10 +9305,6 @@ void WindowShadingManager(EnergyPlusData &state) // REFERENCES: // na - // Using/Aliasing - using General::POLYF; - using ScheduleManager::GetCurrentScheduleValue; - int IConst; // Construction auto &s_mat = state.dataMaterial; @@ -9407,10 +9385,10 @@ void WindowShadingManager(EnergyPlusData &state) // Vis trans at normal incidence of unswitched glass. Counting the GlazedFrac if (IConst > 0) s_surf->SurfWinVisTransSelected(ISurf) = - POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac; + Window::POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac; // Window has shading control - // select the active window shading control and corresponding contructions + // select the active window shading control and corresponding constructions size_t indexWindowShadingControl = selectActiveWindowShadingControlIndex(state, ISurf); if (!s_surf->Surface(ISurf).windowShadingControlList.empty() && indexWindowShadingControl <= s_surf->Surface(ISurf).windowShadingControlList.size() - 1) { @@ -9437,9 +9415,9 @@ void WindowShadingManager(EnergyPlusData &state) Real64 SetPoint2 = s_surf->WindowShadingControl(IShadingCtrl).SetPoint2; // Second control setpoint bool SchedAllowsControl = true; // True if control schedule is not specified or is specified and schedule value = 1 - int SchedulePtr = s_surf->WindowShadingControl(IShadingCtrl).Schedule; - if (SchedulePtr != 0) { - if (s_surf->WindowShadingControl(IShadingCtrl).ShadingControlIsScheduled && GetCurrentScheduleValue(state, SchedulePtr) <= 0.0) + auto const *sched = s_surf->WindowShadingControl(IShadingCtrl).sched; + if (sched != nullptr) { + if (s_surf->WindowShadingControl(IShadingCtrl).ShadingControlIsScheduled && sched->getCurrentVal() <= 0.0) SchedAllowsControl = false; } @@ -9763,7 +9741,7 @@ void WindowShadingManager(EnergyPlusData &state) // Vis trans at normal incidence of fully switched glass IConst = s_surf->Surface(ISurf).activeShadedConstruction; s_surf->SurfWinVisTransSelected(ISurf) = - POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac; + Window::POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac; } // Slat angle control for blinds @@ -9845,7 +9823,7 @@ void WindowShadingManager(EnergyPlusData &state) } break; case SlatAngleControl::Scheduled: { // 'SCHEDULEDSLATANGLE' - slatAng = GetCurrentScheduleValue(state, s_surf->WindowShadingControl(IShadingCtrl).SlatAngleSchedule); + slatAng = s_surf->WindowShadingControl(IShadingCtrl).slatAngleSched->getCurrentVal(); slatAng = max(matBlind->MinSlatAngle, min(slatAng, matBlind->MaxSlatAngle)) * Constant::DegToRad; if ((slatAng <= state.dataSolarShading->ThetaSmall || slatAng >= state.dataSolarShading->ThetaBig) && @@ -9910,7 +9888,7 @@ void WindowShadingManager(EnergyPlusData &state) slatAng = Constant::DegToRad * surfShade.blind.slatAngDegEMSValue; } - // Slat angle is changing, need to recalcualte stored values + // Slat angle is changing, need to recalculate stored values if (slatAng != surfShade.blind.slatAng) { surfShade.blind.slatAng = slatAng; surfShade.blind.slatAngDeg = surfShade.blind.slatAng * Constant::RadToDeg; @@ -9944,7 +9922,7 @@ void WindowShadingManager(EnergyPlusData &state) } // End of check if interior or exterior or between glass blind in place // AR: don't need to do this anymore I don't think - // CALL CalcScreenTransmittance to intialized all screens prior to HB calc's + // CALL CalcScreenTransmittance to initialized all screens prior to HB calc's // if (s_surf->SurfWinShadingFlag(ISurf) == WinShadingType::ExtScreen && state.dataEnvrn->SunIsUp) { // CalcScreenTransmittance(state, ISurf); // } @@ -10084,7 +10062,7 @@ int selectActiveWindowShadingControlIndex(EnergyPlusData &state, int curSurface) for (std::size_t listIndex = 0; listIndex < s_surf->Surface(curSurface).windowShadingControlList.size(); ++listIndex) { int wsc = s_surf->Surface(curSurface).windowShadingControlList[listIndex]; // pick the first WindowShadingControl that has a non-zero schedule value - if (ScheduleManager::GetCurrentScheduleValue(state, s_surf->WindowShadingControl(wsc).Schedule) > 0.0) { + if (s_surf->WindowShadingControl(wsc).sched->getCurrentVal() > 0.0) { return listIndex; } } @@ -10108,9 +10086,6 @@ void WindowGapAirflowControl(EnergyPlusData &state) // REFERENCES: // na - // Using/Aliasing - using ScheduleManager::GetCurrentScheduleValue; - auto &s_surf = state.dataSurface; for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { @@ -10131,8 +10106,8 @@ void WindowGapAirflowControl(EnergyPlusData &state) } break; case WindowAirFlowControlType::Schedule: { if (s_surf->SurfWinAirflowHasSchedule(ISurf)) { - int SchedulePtr = s_surf->SurfWinAirflowSchedulePtr(ISurf); // Schedule pointer - Real64 ScheduleMult = GetCurrentScheduleValue(state, SchedulePtr); // Multiplier value from schedule + auto const *sched = s_surf->SurfWinAirflowScheds(ISurf); + Real64 ScheduleMult = sched->getCurrentVal(); // Multiplier value from schedule if (ScheduleMult < 0.0 || ScheduleMult > 1.0) { ShowFatalError( state, @@ -10232,9 +10207,9 @@ void SkyDifSolarShading(EnergyPlusData &state) state.dataSolarShading->SurfDifShdgRatioHoriz = 1.0; if (detailedShading) { state.dataSolarShading->SurfCurDifShdgRatioIsoSky.dimension(s_surf->TotSurfaces, 1.0); - state.dataSolarShading->SurfDifShdgRatioIsoSkyHRTS.allocate(state.dataGlobal->NumOfTimeStepInHour, 24, s_surf->TotSurfaces); + state.dataSolarShading->SurfDifShdgRatioIsoSkyHRTS.allocate(state.dataGlobal->TimeStepsInHour, 24, s_surf->TotSurfaces); state.dataSolarShading->SurfDifShdgRatioIsoSkyHRTS = 1.0; - state.dataSolarShading->SurfDifShdgRatioHorizHRTS.allocate(state.dataGlobal->NumOfTimeStepInHour, 24, s_surf->TotSurfaces); + state.dataSolarShading->SurfDifShdgRatioHorizHRTS.allocate(state.dataGlobal->TimeStepsInHour, 24, s_surf->TotSurfaces); state.dataSolarShading->SurfDifShdgRatioHorizHRTS = 1.0; } @@ -10374,9 +10349,9 @@ void SkyDifSolarShading(EnergyPlusData &state) if (state.dataSysVars->DetailedSkyDiffuseAlgorithm && s_surf->ShadingTransmittanceVaries && state.dataHeatBal->SolarDistribution != DataHeatBalance::Shadowing::Minimal) { for (int SurfNum = 1; SurfNum <= s_surf->TotSurfaces; ++SurfNum) { - state.dataSolarShading->SurfDifShdgRatioIsoSkyHRTS({1, state.dataGlobal->NumOfTimeStepInHour}, {1, 24}, SurfNum) = + state.dataSolarShading->SurfDifShdgRatioIsoSkyHRTS({1, state.dataGlobal->TimeStepsInHour}, {1, 24}, SurfNum) = state.dataSolarShading->SurfDifShdgRatioIsoSky(SurfNum); - state.dataSolarShading->SurfDifShdgRatioHorizHRTS({1, state.dataGlobal->NumOfTimeStepInHour}, {1, 24}, SurfNum) = + state.dataSolarShading->SurfDifShdgRatioHorizHRTS({1, state.dataGlobal->TimeStepsInHour}, {1, 24}, SurfNum) = state.dataSolarShading->SurfDifShdgRatioHoriz(SurfNum); } } @@ -10440,8 +10415,8 @@ void CalcWindowProfileAngles(EnergyPlusData &state) s_surf->SurfWinProfileAngVert(SurfNum) = 0.0; if (state.dataHeatBal->SurfCosIncAng(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, SurfNum) <= 0.0) continue; - ElevWin = Constant::PiOvr2 - surf.Tilt * Constant::DegToRadians; - AzimWin = surf.Azimuth * Constant::DegToRadians; + ElevWin = Constant::PiOvr2 - surf.Tilt * Constant::DegToRad; + AzimWin = surf.Azimuth * Constant::DegToRad; ProfileAngHor = std::atan(sin_ElevSun / std::abs(cos_ElevSun * std::cos(AzimWin - AzimSun))) - ElevWin; @@ -10472,8 +10447,8 @@ void CalcWindowProfileAngles(EnergyPlusData &state) // Constrain to 0 to pi if (ProfileAngVert > Constant::Pi) ProfileAngVert = Constant::TwoPi - ProfileAngVert; - s_surf->SurfWinProfileAngHor(SurfNum) = ProfileAngHor / Constant::DegToRadians; - s_surf->SurfWinProfileAngVert(SurfNum) = ProfileAngVert / Constant::DegToRadians; + s_surf->SurfWinProfileAngHor(SurfNum) = ProfileAngHor / Constant::DegToRad; + s_surf->SurfWinProfileAngVert(SurfNum) = ProfileAngVert / Constant::DegToRad; s_surf->SurfWinTanProfileAngHor(SurfNum) = std::abs(std::tan(ProfileAngHor)); s_surf->SurfWinTanProfileAngVert(SurfNum) = std::abs(std::tan(ProfileAngVert)); } @@ -10582,9 +10557,9 @@ void CalcFrameDividerShadow(EnergyPlusData &state, auto &surf = s_surf->Surface(SurfNum); GlArea = surf.Area; - ElevWin = Constant::PiOvr2 - surf.Tilt * Constant::DegToRadians; + ElevWin = Constant::PiOvr2 - surf.Tilt * Constant::DegToRad; ElevSun = Constant::PiOvr2 - std::acos(state.dataSolarShading->SUNCOS(3)); - AzimWin = surf.Azimuth * Constant::DegToRadians; + AzimWin = surf.Azimuth * Constant::DegToRad; AzimSun = std::atan2(state.dataSolarShading->SUNCOS(1), state.dataSolarShading->SUNCOS(2)); ProfileAngHor = std::atan(std::sin(ElevSun) / std::abs(std::cos(ElevSun) * std::cos(AzimWin - AzimSun))) - ElevWin; @@ -10756,10 +10731,6 @@ void CalcBeamSolarOnWinRevealSurface(EnergyPlusData &state) // REFERENCES // na - // USE STATEMENTS - // Using/Aliasing - using General::POLYF; - // Locals // SUBROUTINE ARGUMENT DEFINITIONS:na @@ -10880,8 +10851,8 @@ void CalcBeamSolarOnWinRevealSurface(EnergyPlusData &state) ConstrNumSh = s_surf->SurfWinActiveShadedConstruction(SurfNum); auto const &thisConstruct = state.dataConstruction->Construct(ConstrNum); - SolTransGlass = POLYF(state.dataHeatBal->SurfCosIncAng(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, SurfNum), - thisConstruct.TransSolBeamCoef); + SolTransGlass = Window::POLYF(state.dataHeatBal->SurfCosIncAng(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, SurfNum), + thisConstruct.TransSolBeamCoef); TanProfileAngVert = s_surf->SurfWinTanProfileAngVert(SurfNum); TanProfileAngHor = s_surf->SurfWinTanProfileAngHor(SurfNum); FrameDivNum = surf.FrameDivider; @@ -11110,14 +11081,14 @@ void CalcBeamSolarOnWinRevealSurface(EnergyPlusData &state) if (ShadeFlag == WinShadingType::SwitchableGlazing) { auto const &thisConstructSh = state.dataConstruction->Construct(ConstrNumSh); SolTransGlassSh = - POLYF(state.dataHeatBal->SurfCosIncAng(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, SurfNum), - thisConstructSh.TransSolBeamCoef); + Window::POLYF(state.dataHeatBal->SurfCosIncAng(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, SurfNum), + thisConstructSh.TransSolBeamCoef); SolTransGlass = Window::InterpSw(s_surf->SurfWinSwitchingFactor(SurfNum), SolTransGlass, SolTransGlassSh); DiffReflGlassSh = thisConstructSh.ReflectSolDiffBack; DiffReflGlass = Window::InterpSw(s_surf->SurfWinSwitchingFactor(SurfNum), DiffReflGlass, DiffReflGlassSh); } - // Calc beam solar sbsorbed (m2) + // Calc beam solar absorbed (m2) s_surf->SurfWinBmSolAbsdInsReveal(SurfNum) += A2ill * SolTransGlass * InsideRevealSolAbs * CosBeta * tmp_SunlitFracWithoutReveal; @@ -11534,7 +11505,6 @@ void CalcWinTransDifSolInitialDistribution(EnergyPlusData &state) // determined here using revised code from SUBROUTINE InitIntSolarDistribution // Using/Aliasing - using ScheduleManager::GetCurrentScheduleValue; using namespace DataViewFactorInformation; using namespace DataWindowEquivalentLayer; @@ -12093,7 +12063,6 @@ void CalcInteriorWinTransDifSolInitialDistribution(EnergyPlusData &state, // determined here using revised code from SUBROUTINE InitIntSolarDistribution // Using/Aliasing - using ScheduleManager::GetCurrentScheduleValue; using namespace DataViewFactorInformation; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: @@ -12556,7 +12525,7 @@ void CalcComplexWindowOverlap(EnergyPlusData &state, // HTRANS routine is using coordinates stored in XVS and YVS in order to calculate // surface area. Since both projections are equal to zero, then simply - // compy these values into XVS and YVS arrays + // copy these values into XVS and YVS arrays for (N = 1; N <= NVT; ++N) { state.dataSolarShading->XVS(N) = state.dataSolarShading->XVertex(N); state.dataSolarShading->YVS(N) = state.dataSolarShading->YVertex(N); @@ -12569,7 +12538,7 @@ void CalcComplexWindowOverlap(EnergyPlusData &state, for (IRay = 1; IRay <= Geom.Trn.NBasis; ++IRay) { // basis directions loop (on back surface) // For current basis direction calculate dot product between window surface // and basis direction. This will be used to calculate projection of each - // of the back surfaces to window surface for given basis direciton + // of the back surfaces to window surface for given basis direction SdotX = dot(s_surf->Surface(ISurf).lcsx, Geom.sTrn(IRay)); SdotY = dot(s_surf->Surface(ISurf).lcsy, Geom.sTrn(IRay)); SdotZ = dot(s_surf->Surface(ISurf).lcsz, Geom.sTrn(IRay)); @@ -12577,7 +12546,7 @@ void CalcComplexWindowOverlap(EnergyPlusData &state, YSp = -SdotY; ZSp = -SdotZ; - // Projection of shadows for current basis direciton + // Projection of shadows for current basis direction if (std::abs(ZSp) > Constant::SmallDistance) { XShadowProjection = XSp / ZSp; YShadowProjection = YSp / ZSp; @@ -12634,12 +12603,12 @@ void CalcComplexWindowOverlap(EnergyPlusData &state, Geom.AOverlap(KBkSurf, IRay) = state.dataSolarShading->HCAREA(state.dataSolarShading->LOCHCA); } // DO KBkSurf = 1 , NBkSurf - // If some of back surfaces is contained in base surface, then need to substract shadow of subsurface - // from shadow on base surface. Reson is that above shadowing algorithm is calculating shadow wihtout + // If some of back surfaces is contained in base surface, then need to subtract shadow of subsurface + // from shadow on base surface. Reason is that above shadowing algorithm is calculating shadow without // influence of subsurfaces for (KBkSurf = 1; KBkSurf <= Window.NBkSurf; ++KBkSurf) { // back surf loop BackSurfaceNumber = state.dataShadowComb->ShadowComb(BaseSurf).BackSurf(KBkSurf); - // CurBaseSurf is Current base surface number for shadow overlap calcualtions + // CurBaseSurf is Current base surface number for shadow overlap calculations int CurBaseSurf = s_surf->Surface(BackSurfaceNumber).BaseSurf; if (CurBaseSurf != BackSurfaceNumber) { // Search if that base surface in list of back surfaces for current window diff --git a/src/EnergyPlus/SolarShading.hh b/src/EnergyPlus/SolarShading.hh index 31878be083d..03075265a03 100644 --- a/src/EnergyPlus/SolarShading.hh +++ b/src/EnergyPlus/SolarShading.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -58,7 +58,7 @@ // Penumbra Headers #ifndef EP_NO_OPENGL -#include +# include #endif // EnergyPlus Headers @@ -511,6 +511,10 @@ struct SolarShadingData : BaseGlobalStruct std::vector cos_Theta; std::unique_ptr shd_stream; // Shading file stream + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/SplitterComponent.cc b/src/EnergyPlus/SplitterComponent.cc index 82ec44e0bf7..ffe1071351d 100644 --- a/src/EnergyPlus/SplitterComponent.cc +++ b/src/EnergyPlus/SplitterComponent.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/SplitterComponent.hh b/src/EnergyPlus/SplitterComponent.hh index 67473ee3827..d7dc7af3610 100644 --- a/src/EnergyPlus/SplitterComponent.hh +++ b/src/EnergyPlus/SplitterComponent.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -135,6 +135,10 @@ struct SplitterComponentData : BaseGlobalStruct Array1D SplitterCond; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/StandardRatings.cc b/src/EnergyPlus/StandardRatings.cc index 4f5a85f8348..3d9708d2517 100644 --- a/src/EnergyPlus/StandardRatings.cc +++ b/src/EnergyPlus/StandardRatings.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -48,9 +48,6 @@ // C++ Headers #include -// ObjexxFCL Headers -#include - // EnergyPlus Headers #include #include @@ -409,8 +406,6 @@ namespace StandardRatings { using namespace OutputReportPredefined; using Curve::CurveValue; using Curve::GetCurveName; - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSpecificHeatGlycol; using General::SolveRoot; Real64 constexpr Acc(0.0001); // Accuracy of result @@ -444,13 +439,13 @@ namespace StandardRatings { Real64 COPReduced(0.0); // COP at reduced capacity test conditions (100%, 75%, 50%, and 25%) Real64 LoadFactor(0.0); // Fractional "on" time for last stage at the desired reduced capacity, // (dimensionless) - Real64 DegradationCoeff(0.0); // Degradation coeficient, (dimenssionless) + Real64 DegradationCoeff(0.0); // Degradation coefficient, (dimensionless) Real64 ChillerCapFT_rated(0.0); // Chiller capacity fraction at AHRI rated conditions (evaluated as a function of temperature) Real64 ChillerCapFT(0.0); // Chiller capacity fraction (evaluated as a function of temperature) Real64 ChillerEIRFT_rated(0.0); // Chiller electric input ratio (EIR = 1 / COP) at AHRI rated conditions as a function of temperature Real64 ChillerEIRFT(0.0); // Chiller electric input ratio (EIR = 1 / COP) as a function of temperature Real64 ChillerEIRFPLR(0.0); // Chiller EIR as a function of part-load ratio (PLR) - Real64 PartLoadRatio(0.0); // Part load ratio (PLR) at which chiller is operatign at reduced capacity + Real64 PartLoadRatio(0.0); // Part load ratio (PLR) at which chiller is operating at reduced capacity int RedCapNum; // Integer counter for reduced capacity int SolFla; // Flag of solver @@ -531,17 +526,9 @@ namespace StandardRatings { } else if (ChillerType == DataPlant::PlantEquipmentType::Chiller_ElectricReformEIR) { EnteringWaterTempReduced = CondenserInletTemp; - Cp = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(CondLoopNum).FluidName, - EnteringWaterTempReduced, - state.dataPlnt->PlantLoop(CondLoopNum).FluidIndex, - RoutineName); - - Rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(CondLoopNum).FluidName, - EnteringWaterTempReduced, - state.dataPlnt->PlantLoop(CondLoopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(CondLoopNum).glycol->getSpecificHeat(state, EnteringWaterTempReduced, RoutineName); + + Rho = state.dataPlnt->PlantLoop(CondLoopNum).glycol->getDensity(state, EnteringWaterTempReduced, RoutineName); Real64 reducedPLR = ReducedPLR[RedCapNum]; CondenserOutletTemp0 = EnteringWaterTempReduced + 0.1; @@ -780,7 +767,7 @@ namespace StandardRatings { } } - // Note: We don't want unit conversio, here, but it's ok since W/W will convert to itself since the column heading has "SI" as a hint + // Note: We don't want unit conversion, here, but it's ok since W/W will convert to itself since the column heading has "SI" as a hint PreDefTableEntry(state, state.dataOutRptPredefined->pdchMechIPLVSI, ChillerName, IPLVValueSI, 2); PreDefTableEntry(state, state.dataOutRptPredefined->pdchMechIPLVIP, ChillerName, IPLVValueIP, 2); } @@ -973,18 +960,18 @@ namespace StandardRatings { // (1) Obtains the rated condition parameters: // heating capacity (User specified or Autosized Value), COP, Rated Air volume flow rate through the // DX Cooling Coil (User specified or autosized value) and Fan power per rated air flow rate - // (2) Evaluates the heating coil capacities for AHRI tests H1, H2 and H3 using the performance cuves and + // (2) Evaluates the heating coil capacities for AHRI tests H1, H2 and H3 using the performance curves and // input values specified at (1) above. Then net heating capacity is determined from the total heating capacity // of the DX coil at the AHRI test conditions and accounting for the INDOOR supply air fan heat. // (3) Calculates the electric power consumed by the DX Coil Unit (compressor + outdoor condenser fan). // The net electric power consumption is determined by adding the indoor fan electric power to the // electric power consumption by the DX Coil Condenser Fan and Compressor at the AHRI test conditions. // (4) High Temperature Heating Standard (Net) Rating Capacity and Low Temperature Heating Standard (Net) - // Rating Capacity capacity are determined using tests H1 adn H3 per ANSI/AHRI 210/240 2008. + // Rating Capacity capacity are determined using tests H1 and H3 per ANSI/AHRI 210/240 2008. // (5) The HSPF is evaluated from the total net heating capacity and total electric power // evaluated at the standard rated test conditions. For user specified region number, the outdoor temperatures - // are Binned (grouped) and fractioanl bin hours for each bin over the entire heating season are taken - // from AHRI 210/240. Then for each bin, building load, heat pump energy adn resistance space heating enegry are + // are Binned (grouped) and fractional bin hours for each bin over the entire heating season are taken + // from AHRI 210/240. Then for each bin, building load, heat pump energy and resistance space heating energy are // calculated. The sum of building load divided by sum of heat pump and resistance space heating over the // entire heating season gives the HSPF. The detailed calculation algorithms of calculating HSPF // are described in Engineering Reference. @@ -998,14 +985,14 @@ namespace StandardRatings { // conditions and accounting for the INDOOR supply air fan effect. The net total cooling capacity // is reported at the high (maximum) speed only. // (3) Calculates the electric power consumed by the DX Coil Unit (compressor + outdoor condenser fan). - // Evaluates the EIR capacity and flow fraction modifiers at A2, B2, B1, and F1 test coditions per + // Evaluates the EIR capacity and flow fraction modifiers at A2, B2, B1, and F1 test conditions per // AHRI/ANSI Std. 210/240 test procedure for multi-speed compressor. For any inter- - // mediate operating conditions (speed), the successive lower and the higher speed performnace are + // mediate operating conditions (speed), the successive lower and the higher speed performance are // weighed per the standard. Electric Power consumption is determined by adding the indoor fan // electric power to the electric power consumption by the outdoor DX Coil Fan and Compressor Power // at the AHRI test conditions. The net total cooling capacity is also corrected for the fan heat // effect for SEER calculation. - // Net Heatingg Capacity and HSPF + // Net Heating Capacity and HSPF // (4) Obtains the rated condition parameters: // Heating capacity (User specified or Autosized Value) // Rated Air volume flow rate through the DX Heating Coil (User specified or autosized value) @@ -1017,7 +1004,7 @@ namespace StandardRatings { // Evaluates the EIR capacity and flow fraction modifiers per AHRI/ANSI Std. 210/240 test procedures // for two speed compressor (H01, H11, H21, H31, H12, H22, and H32 ). This procedure was modified // for multispeed heat pumps. For any inter-mediate operating conditions (speed), the successive - // lower and the higher speed performnace are weighed per the standard. + // lower and the higher speed performance are weighed per the standard. // Electric Power consumption is determined by adding the supply fan electric power to the electric // power consumption by the outdoor DX Coil Fan and Compressor Power at the AHRI test conditions. // The net heating capacity is also corrected for the fan heat effect for SEER calculation. @@ -1078,14 +1065,14 @@ namespace StandardRatings { Real64 SEER_User(0.0); // Seasonal Energy Efficiency Ratio using user PLF curve in SI [W/W] Real64 SEER_Standard(0.0); // Seasonal Energy Efficiency Ratio using AHRI 210/240 PLF default curve & C_D in SI [W/W] Real64 EER(0.0); // Energy Efficiency Ratio using AHRI 210-240 2017 in SI [W/W] - Real64 IEER(0.0); // Integerated Energy Efficiency Ratio in SI [W/W] + Real64 IEER(0.0); // Integrated Energy Efficiency Ratio in SI [W/W] // SEER2 ANSI/AHRI 210/240 Standard 2023 Ratings Real64 SEER2_User(0.0); // Seasonal Energy Efficiency Ratio using user PLF curve in SI [W/W] Real64 SEER2_Standard(0.0); // Seasonal Energy Efficiency Ratio using AHRI 210/240 PLF default curve & C_D in SI [W/W] Real64 EER2(0.0); // Energy Efficiency Ratio using AHRI 210/140 - 2023 Real64 EER_2022(0.0); // Energy Efficiency Ratio in SI [W/W] - Real64 IEER_2022(0.0); // Integerated Energy Efficiency Ratio in SI [W/W] + Real64 IEER_2022(0.0); // Integrated Energy Efficiency Ratio in SI [W/W] Real64 HSPF(0.0); // Heating Seasonal Performance Factor in SI [W/W] Real64 NetHeatingCapRatedHighTemp(0.0); // Net Rated heating capacity at high temp [W] @@ -1366,7 +1353,7 @@ namespace StandardRatings { EIRFFlowCurveIndex(spnum), PLFFPLRCurveIndex(spnum)); } - // Calculate Net heatig capacity and HSPF & HSPF2 of multispeed DX heating coils + // Calculate Net heating capacity and HSPF & HSPF2 of multispeed DX heating coils std::map StandardRatingsResult = MultiSpeedDXHeatingCoilStandardRatings(state, DXCoilName, DXCoilType, @@ -1530,7 +1517,7 @@ namespace StandardRatings { Real64 NetCoolingCapRatedMaxSpeed2023(0.0); // net cooling capacity at maximum speed Real64 EER_2022(0.0); // Energy Efficiency Ratio in SI [W/W] - Real64 IEER_2022(0.0); // Integerated Energy Efficiency Ratio in SI [W/W] + Real64 IEER_2022(0.0); // Integrated Energy Efficiency Ratio in SI [W/W] Real64 NetCoolingCapRated2022(0.0); Real64 EER(0.0); @@ -1626,7 +1613,7 @@ namespace StandardRatings { Real64 NetCoolingCapRatedMaxSpeed2023(0.0); // net cooling capacity at maximum speed Real64 EER_2022(0.0); // Energy Efficiency Ratio in SI [W/W] - Real64 IEER_2022(0.0); // Integerated Energy Efficiency Ratio in SI [W/W] + Real64 IEER_2022(0.0); // Integrated Energy Efficiency Ratio in SI [W/W] Real64 NetCoolingCapRated2022(0.0); int constexpr ns = 2; @@ -1770,7 +1757,7 @@ namespace StandardRatings { // entire heating season [W] Real64 PartLoadFactor; Real64 LowTempCutOutFactor(0.0); // Factor which corresponds to compressor operation depending on outdoor temperature - Real64 OATempCompressorOff(0.0); // Minimum outdoor air temperature to turn the commpressor off, [C] + Real64 OATempCompressorOff(0.0); // Minimum outdoor air temperature to turn the compressor off, [C] Real64 HSPF(0.0); if (RegionNum == 5) { @@ -1896,7 +1883,7 @@ namespace StandardRatings { Real64 HeatingModeLoadFactor2023(0.0); // HSPF2 Heating mode load factor corresponding to an outdoor bin temperature [-] Real64 PartLoadFactor2023; Real64 CheckCOP2023(0.0); // HSPF2 Checking COP at an outdoor bin temperature against unity [-] - Real64 OATempCompressorOff2023(0.0); // HSPF2 Minimum outdoor air temperature to turn the commpressor off, [C] + Real64 OATempCompressorOff2023(0.0); // HSPF2 Minimum outdoor air temperature to turn the compressor off, [C] Real64 LowTempCutOutFactor2023(0.0); // Factor which corresponds to compressor operation depending on outdoor temperature Real64 HeatPumpElectricalEnergy2023(0.0); // HSPF2 Heatpump electrical energy corresponding to an outdoor bin temperature [W] Real64 ResistiveSpaceHeatingElectricalEnergy2023(0.0); // HSPF2 resistance heating electrical energy corresponding to an @@ -2009,12 +1996,12 @@ namespace StandardRatings { { Real64 NetHeatingCapRated(0.0); // Net Heating Coil capacity at Rated conditions, Real64 NetHeatingCapH3Test(0.0); // Net Heating Coil capacity at H3 test conditions - Real64 HSPF(0.0); // seasonale energy efficiency ratio of multi speed DX cooling coil + Real64 HSPF(0.0); // seasonal energy efficiency ratio of multi speed DX cooling coil // ANSI/AHRI 210/240 Standard 2023 Real64 NetHeatingCapRated_2023(0.0); // Net Heating Coil capacity at Rated conditions, Real64 NetHeatingCapH3Test_2023(0.0); // Net Heating Coil capacity at H3 test conditions - Real64 HSPF2_2023(0.0); // seasonale energy efficiency ratio of multi speed DX cooling coil + Real64 HSPF2_2023(0.0); // seasonal energy efficiency ratio of multi speed DX cooling coil Real64 IEER_2022(0.0); std::map StandardRatingsResults; // SUBROUTINE INFORMATION: @@ -2056,15 +2043,15 @@ namespace StandardRatings { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 TotalHeatingCapRated(0.0); // Heating Coil capacity at Rated conditions, without accounting supply fan heat [W] Real64 EIRRated(0.0); // EIR at Rated conditions [-] - Real64 TotCapTempModFacRated(0.0); // Total capacity as a function of temerature modifier at rated conditions [-] - Real64 EIRTempModFacRated(0.0); // EIR as a function of temerature modifier at rated conditions [-] + Real64 TotCapTempModFacRated(0.0); // Total capacity as a function of temperature modifier at rated conditions [-] + Real64 EIRTempModFacRated(0.0); // EIR as a function of temperature modifier at rated conditions [-] Real64 TotalHeatingCapH2Test(0.0); // Heating Coil capacity at H2 test conditions, without accounting supply fan heat [W] Real64 TotalHeatingCapH3Test(0.0); // Heating Coil capacity at H3 test conditions, without accounting supply fan heat [W] - Real64 CapTempModFacH2Test(0.0); // Total capacity as a function of temerature modifier at H2 test conditions [-] - Real64 EIRTempModFacH2Test(0.0); // EIR as a function of temerature modifier at H2 test conditions [-] + Real64 CapTempModFacH2Test(0.0); // Total capacity as a function of temperature modifier at H2 test conditions [-] + Real64 EIRTempModFacH2Test(0.0); // EIR as a function of temperature modifier at H2 test conditions [-] Real64 EIRH2Test(0.0); // EIR at H2 test conditions [-] - Real64 CapTempModFacH3Test(0.0); // Total capacity as a function of temerature modifier at H3 test conditions [-] - Real64 EIRTempModFacH3Test(0.0); // EIR as a function of temerature modifier at H3 test conditions [-] + Real64 CapTempModFacH3Test(0.0); // Total capacity as a function of temperature modifier at H3 test conditions [-] + Real64 EIRTempModFacH3Test(0.0); // EIR as a function of temperature modifier at H3 test conditions [-] Real64 EIRH3Test(0.0); // EIR at H3 test conditions [-] Real64 TotCapFlowModFac(0.0); // Total capacity modifier (function of actual supply air flow vs rated flow) Real64 EIRFlowModFac(0.0); // EIR modifier (function of actual supply air flow vs rated flow) @@ -2291,10 +2278,10 @@ namespace StandardRatings { Real64 EIRTempModFac(0.0); // EIR modifier (function of entering wetbulb, outside drybulb) [-] Real64 EIR(0.0); // Energy Efficiency Ratio at AHRI test conditions for SEER [-] Real64 LoadFactor(0.0); // Fractional "on" time for last stage at the desired reduced capacity, (dimensionless) - Real64 DegradationCoeff(0.0); // Degradation coeficient, (dimenssionless) + Real64 DegradationCoeff(0.0); // Degradation coefficient, (dimensionless) Real64 ElecPowerReducedCap(0.0); // Net power consumption (Cond Fan+Compressor) at reduced test condition [W] Real64 EERReduced(0.0); // EER at reduced capacity test conditions (100%, 75%, 50%, and 25%) - Real64 IEER = 0.0; // Integareted energy efficiency ratio of single speed DX cooling coil + Real64 IEER = 0.0; // Integrated energy efficiency ratio of single speed DX cooling coil Real64 NetCoolingCapRated = 0.0; // net cooling capacity of single speed DX cooling coil // Calculate the net cooling capacity at the rated conditions (19.44C WB and 35.0C DB ) @@ -4157,7 +4144,7 @@ namespace StandardRatings { Real64 cop_low = q_low / p_low; Real64 cop_int = q_int / p_int; - Real64 cop_full = q_full / p_full; + Real64 cop_full = q_full / p_full; // About half of the variables in this function are unused // Low Speed Real64 cop_int_bin = cop_low + (cop_int - cop_low) / (q_int - q_low) * (bl - q_low); // Equation 11.101 (AHRI-2023) q = bl * n; // 11.92 --> n is missing in the print ? @@ -6804,18 +6791,7 @@ namespace StandardRatings { } else { PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilIEERIP, CompName, "N/A"); } - addFootNoteSubTable(state, - state.dataOutRptPredefined->pdstDXCoolCoil, - "ANSI/AHRI ratings account for supply air fan heat and electric power.
" - "1 - EnergyPlus object type.
" - "2 - Capacity less than 65K Btu/h (19050 W) - calculated as per AHRI Standard 210/240-2017.
" - "  Capacity of 65K Btu/h (19050 W) to less than 135K Btu/hv (39565 W) - calculated as per AHRI " - "Standard 340/360-2007.
" - "  Capacity from 135K (39565 W) to 250K Btu/hr (73268 W) - calculated as per AHRI Standard 365-2009 - " - "Ratings not yet supported in EnergyPlus.
" - "3 - SEER (User) is calculated using user-input PLF curve and cooling coefficient of degradation.
" - "  SEER (Standard) is calculated using the default PLF curve and cooling coefficient of degradation" - "from the appropriate AHRI standard."); + addFootNoteSubTable(state, state.dataOutRptPredefined->pdstDXCoolCoil, StandardRatings::AHRI2017FOOTNOTE); } else { // ANSI/AHRI 210/240 Standard 2023 Ratings | SEER2 if (state.dataHVACGlobal->StandardRatingsMyCoolOneTimeFlag2) { @@ -6862,19 +6838,7 @@ namespace StandardRatings { } else { PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilIEERIP_2023, CompName, "N/A"); } - addFootNoteSubTable(state, - state.dataOutRptPredefined->pdstDXCoolCoil_2023, - "ANSI/AHRI ratings account for supply air fan heat and electric power.
" - "1 - EnergyPlus object type.
" - "2 - Capacity less than 65K Btu/h (19050 W) - calculated as per AHRI Standard 210/240-2023.
" - "  Capacity of 65K Btu/h (19050 W) to less than 135K Btu/h (39565 W) - calculated as per AHRI Standard " - "340/360-2022.
" - "  Capacity from 135K (39565 W) to 250K Btu/hr (73268 W) - calculated as per AHRI Standard 365-2009 - " - "Ratings not yet supported in EnergyPlus.
" - "3 - SEER2 (User) is calculated using user-input PLF curve and cooling coefficient of degradation.
" - "  SEER2 (Standard) is calculated using the default PLF curve and cooling coefficient of degradation" - "from the appropriate AHRI standard.
" - "4 - Value for the Full Speed of the coil."); + addFootNoteSubTable(state, state.dataOutRptPredefined->pdstDXCoolCoil_2023, StandardRatings::AHRI2023FOOTNOTE); } break; } @@ -6973,18 +6937,7 @@ namespace StandardRatings { } else { PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilIEERIP, CompName, "N/A"); } - addFootNoteSubTable(state, - state.dataOutRptPredefined->pdstDXCoolCoil, - "ANSI/AHRI ratings account for supply air fan heat and electric power.
" - "1 - EnergyPlus object type.
" - "2 - Capacity less than 65K Btu/h (19050 W) - calculated as per AHRI Standard 210/240-2017.
" - "  Capacity of 65K Btu/h (19050 W) to less than 135K Btu/h (39565 W) - calculated as per AHRI Standard " - "340/360-2007.
" - "  Capacity from 135K (39565 W) to 250K Btu/hr (73268 W) - calculated as per AHRI Standard 365-2009 - " - "Ratings not yet supported in EnergyPlus.
" - "3 - SEER (User) is calculated using user-input PLF curve and cooling coefficient of degradation.
" - "  SEER (Standard) is calculated using the default PLF curve and cooling coefficient of degradation" - "from the appropriate AHRI standard."); + addFootNoteSubTable(state, state.dataOutRptPredefined->pdstDXCoolCoil, StandardRatings::AHRI2017FOOTNOTE); } else { // ANSI/AHRI 210/240 Standard 2023 Ratings | SEER2 if (state.dataHVACGlobal->StandardRatingsMyCoolOneTimeFlag2) { @@ -7030,19 +6983,7 @@ namespace StandardRatings { } else { PreDefTableEntry(state, state.dataOutRptPredefined->pdchDXCoolCoilIEERIP_2023, CompName, "N/A"); } - addFootNoteSubTable(state, - state.dataOutRptPredefined->pdstDXCoolCoil_2023, - "ANSI/AHRI ratings account for supply air fan heat and electric power.
" - "1 - EnergyPlus object type.
" - "2 - Capacity less than 65K Btu/h (19050 W) - calculated as per AHRI Standard 210/240-2023.
" - "  Capacity of 65K Btu/h (19050 W) to less than 135K Btu/h (39565 W) - calculated as per AHRI Standard " - "340/360-2022.
" - "  Capacity from 135K (39565 W) to 250K Btu/hr (73268 W) - calculated as per AHRI Standard 365-2009 - " - "Ratings not yet supported in EnergyPlus.
" - "3 - SEER2 (User) is calculated using user-input PLF curve and cooling coefficient of degradation.
" - "  SEER2 (Standard) is calculated using the default PLF curve and cooling coefficient of degradation" - "from the appropriate AHRI standard.
" - "4 - Value for the Full Speed of the coil."); + addFootNoteSubTable(state, state.dataOutRptPredefined->pdstDXCoolCoil_2023, StandardRatings::AHRI2023FOOTNOTE); } break; diff --git a/src/EnergyPlus/StandardRatings.hh b/src/EnergyPlus/StandardRatings.hh index 301a69f0b2b..ba90834f980 100644 --- a/src/EnergyPlus/StandardRatings.hh +++ b/src/EnergyPlus/StandardRatings.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -58,6 +58,9 @@ #include #include +// C++ Headers +#include + namespace EnergyPlus { // Forward declarations @@ -76,6 +79,33 @@ namespace StandardRatings { Real64 constexpr HeatingOutdoorCoilInletAirDBTempH3Test(-8.33); // Outdoor air dry-bulb temp in degrees C (17F) // Test H3 (low and High Speed) Std. AHRI 210/240 + static constexpr std::string_view AHRI2017FOOTNOTE = R"html(

ANSI/AHRI ratings account for supply air fan heat and electric power.

+
    +
  1. EnergyPlus object type.
  2. +
  3. Capacity less than 65K Btu/h (19050 W) - calculated as per AHRI Standard 210/240-2017.
    + Capacity of 65K Btu/h (19050 W) to less than 135K Btu/h (39565 W) - calculated as per AHRI Standard 340/360-2007.
    + Capacity from 135K (39565 W) to 250K Btu/hr (73268 W) - calculated as per AHRI Standard 365-2009 - Ratings not yet supported in EnergyPlus. +
  4. +
  5. SEER (User) is calculated using user-input PLF curve and cooling coefficient of degradation.
    + SEER (Standard) is calculated using the default PLF curve and cooling coefficient of degradation from the appropriate AHRI standard. +
  6. +
)html"; + + static constexpr std::string_view AHRI2023FOOTNOTE = R"html(

ANSI/AHRI ratings account for supply air fan heat and electric power.

+
    +
  1. EnergyPlus object type.
  2. +
  3. + Capacity less than 65K Btu/h (19050 W) - calculated as per AHRI Standard 210/240-2023.
    + Capacity of 65K Btu/h (19050 W) to less than 135K Btu/h (39565 W) - calculated as per AHRI Standard 340/360-2022.
    + Capacity from 135K (39565 W) to 250K Btu/hr (73268 W) - calculated as per AHRI Standard 365-2009 - Ratings not yet supported in EnergyPlus. +
  4. +
  5. + SEER2 (User) is calculated using user-input PLF curve and cooling coefficient of degradation.
    + SEER2 (Standard) is calculated using the default PLF curve and cooling coefficient of degradation from the appropriate AHRI standard. +
  6. +
  7. Value for the Full Speed of the coil.
  8. +
)html"; + // Defrost strategy (heat pump only) enum class DefrostStrat { diff --git a/src/EnergyPlus/SteamBaseboardRadiator.cc b/src/EnergyPlus/SteamBaseboardRadiator.cc index aa6203b7481..4fae8d9914d 100644 --- a/src/EnergyPlus/SteamBaseboardRadiator.cc +++ b/src/EnergyPlus/SteamBaseboardRadiator.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -108,8 +108,6 @@ namespace SteamBaseboardRadiator { using DataZoneEquipment::CheckZoneEquipmentList; - static constexpr std::string_view fluidNameSteam("STEAM"); - void SimSteamBaseboard(EnergyPlusData &state, std::string const &EquipName, int const ControlledZoneNum, @@ -128,7 +126,6 @@ namespace SteamBaseboardRadiator { // This subroutine simulates the steam baseboards or radiators. using PlantUtilities::SetComponentFlowRate; - using ScheduleManager::GetCurrentScheduleValue; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int BaseboardNum; // index of unit in baseboard array @@ -143,7 +140,7 @@ namespace SteamBaseboardRadiator { // Find the correct Baseboard Equipment if (CompIndex == 0) { - BaseboardNum = Util::FindItemInList(EquipName, state.dataSteamBaseboardRadiator->SteamBaseboard, &SteamBaseboardParams::EquipID); + BaseboardNum = Util::FindItemInList(EquipName, state.dataSteamBaseboardRadiator->SteamBaseboard, &SteamBaseboardParams::Name); if (BaseboardNum == 0) { ShowFatalError(state, format("SimSteamBaseboard: Unit not found={}", EquipName)); } @@ -158,12 +155,12 @@ namespace SteamBaseboardRadiator { EquipName)); } if (state.dataSteamBaseboardRadiator->CheckEquipName(BaseboardNum)) { - if (EquipName != state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID) { + if (EquipName != state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name) { ShowFatalError(state, format("SimSteamBaseboard: Invalid CompIndex passed={}, Unit name={}, stored Unit Name for that index={}", BaseboardNum, EquipName, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID)); + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name)); } state.dataSteamBaseboardRadiator->CheckEquipName(BaseboardNum) = false; } @@ -180,7 +177,7 @@ namespace SteamBaseboardRadiator { .DesignObjectPtr)}; // Array that contains the design data for steam baseboard objects if (QZnReq > SmallLoad && !state.dataZoneEnergyDemand->CurDeadBandOrSetback(ControlledZoneNum) && - (GetCurrentScheduleValue(state, state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).SchedPtr) > 0.0)) { + (state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).availSched->getCurrentVal() > 0.0)) { // On the first HVAC iteration the system values are given to the controller, but after that // the demand limits are in place and there needs to be feedback to the Zone Equipment @@ -197,7 +194,7 @@ namespace SteamBaseboardRadiator { switch (state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipType) { case DataPlant::PlantEquipmentType::Baseboard_Rad_Conv_Steam: { // 'ZoneHVAC:Baseboard:RadiantConvective:Steam' ControlCompOutput(state, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID, + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name, state.dataSteamBaseboardRadiator->cCMO_BBRadiator_Steam, BaseboardNum, FirstHVACIteration, @@ -218,7 +215,7 @@ namespace SteamBaseboardRadiator { default: { ShowSevereError( state, - format("SimSteamBaseboard: Errors in Baseboard={}", state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID)); + format("SimSteamBaseboard: Errors in Baseboard={}", state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name)); ShowContinueError(state, format("Invalid or unimplemented equipment type={}", state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipType)); @@ -265,13 +262,13 @@ namespace SteamBaseboardRadiator { // REFERENCES: // HWBaseboardRadiator module + static constexpr std::string_view routineName = "GetSteamBaseboardInput"; + // Using/Aliasing using BranchNodeConnections::TestCompSet; using GlobalNames::VerifyUniqueBaseboardName; using NodeInputManager::GetOnlySingleNode; - using ScheduleManager::GetCurrentScheduleValue; - using ScheduleManager::GetScheduleIndex; using namespace DataSizing; // SUBROUTINE PARAMETER DEFINITIONS: @@ -287,7 +284,7 @@ namespace SteamBaseboardRadiator { int constexpr iHeatCapacityPerFloorAreaNumericNum( 1); // get input index to steam baseboard Radiator system electric heating capacity per floor area sizing int constexpr iHeatFracOfAutosizedCapacityNumericNum( - 2); // get input index to steam baseboard Radiator system electric heating capacity sizing as fraction of autozized heating capacity + 2); // get input index to steam baseboard Radiator system electric heating capacity sizing as fraction of autosized heating capacity // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int BaseboardNum; // Baseboard number @@ -318,7 +315,7 @@ namespace SteamBaseboardRadiator { state.dataSteamBaseboardRadiator->SteamBaseboardDesignNumericFields.allocate(state.dataSteamBaseboardRadiator->NumSteamBaseboardsDesign); state.dataSteamBaseboardRadiator->SteamBaseboardDesignNames.allocate(state.dataSteamBaseboardRadiator->NumSteamBaseboardsDesign); - // Get the data from the user input related to baseboard heater designobjects + // Get the data from the user input related to baseboard heater design objects for (BaseboardDesignNum = 1; BaseboardDesignNum <= state.dataSteamBaseboardRadiator->NumSteamBaseboardsDesign; ++BaseboardDesignNum) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -333,6 +330,7 @@ namespace SteamBaseboardRadiator { state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + Util::IsNameEmpty( state, state.dataIPShortCut->cAlphaArgs(1), state.dataSteamBaseboardRadiator->cCMO_BBRadiator_Steam_Design, ErrorsFound); state.dataSteamBaseboardRadiator->SteamBaseboardDesignNumericFields(BaseboardDesignNum).FieldNames.allocate(NumNumbers); @@ -517,6 +515,9 @@ namespace SteamBaseboardRadiator { state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, state.dataSteamBaseboardRadiator->cCMO_BBRadiator_Steam, state.dataIPShortCut->cAlphaArgs(1)}; + Util::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), state.dataSteamBaseboardRadiator->cCMO_BBRadiator_Steam, ErrorsFound); state.dataSteamBaseboardRadiator->SteamBaseboardNumericFields(BaseboardNum).FieldNames.allocate(NumNumbers); state.dataSteamBaseboardRadiator->SteamBaseboardNumericFields(BaseboardNum).FieldNames = ""; @@ -529,7 +530,7 @@ namespace SteamBaseboardRadiator { ErrorsFound, state.dataSteamBaseboardRadiator->cCMO_BBRadiator_Steam + " Name"); - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID = state.dataIPShortCut->cAlphaArgs(1); // Name of the baseboard + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name = state.dataIPShortCut->cAlphaArgs(1); // Name of the baseboard state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipType = DataPlant::PlantEquipmentType::Baseboard_Rad_Conv_Steam; //'ZoneHVAC:Baseboard:RadiantConvective:Steam' @@ -543,22 +544,12 @@ namespace SteamBaseboardRadiator { .DesignObjectPtr)}; // Contains the design data for steam baseboard object // Get schedule - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Schedule = state.dataIPShortCut->cAlphaArgs(3); if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).SchedPtr = - GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(3)); - if (state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).SchedPtr == 0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}=\"{}\" not found.", - RoutineName, - state.dataSteamBaseboardRadiator->cCMO_BBRadiator_Steam, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); - ErrorsFound = true; - } + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).availSched = + Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3)); + ErrorsFound = true; } // Get inlet node number @@ -601,7 +592,7 @@ namespace SteamBaseboardRadiator { ShowSevereError(state, format("{} = {}", state.dataSteamBaseboardRadiator->cCMO_BBRadiator_Steam, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID)); + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name)); ShowContinueError(state, format("Illegal {} = {:.7T}", state.dataIPShortCut->cNumericFieldNames(iHeatDesignCapacityNumericNum), @@ -612,7 +603,7 @@ namespace SteamBaseboardRadiator { ShowSevereError(state, format("{} = {}", state.dataSteamBaseboardRadiator->cCMO_BBRadiator_Steam, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID)); + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name)); ShowContinueError(state, format("Input for {} = {}", state.dataIPShortCut->cAlphaFieldNames(iHeatCAPMAlphaNum), @@ -702,7 +693,7 @@ namespace SteamBaseboardRadiator { if (state.dataZoneEquip->ZoneEquipList(ctrlZone).EquipType(zoneEquipTypeNum) == DataZoneEquipment::ZoneEquipType::BaseboardSteam && state.dataZoneEquip->ZoneEquipList(ctrlZone).EquipName(zoneEquipTypeNum) == - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID) { + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name) { state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).ZonePtr = ctrlZone; } } @@ -712,7 +703,7 @@ namespace SteamBaseboardRadiator { format("{}{}=\"{}\" is not on any ZoneHVAC:EquipmentList.", RoutineName, state.dataSteamBaseboardRadiator->cCMO_BBRadiator_Steam, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID)); + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name)); ErrorsFound = true; continue; } @@ -724,7 +715,7 @@ namespace SteamBaseboardRadiator { HeatBalanceIntRadExchange::GetRadiantSystemSurface( state, state.dataSteamBaseboardRadiator->cCMO_BBRadiator_Steam, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID, + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name, state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).ZonePtr, state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).SurfaceName(SurfNum), ErrorsFound); @@ -778,16 +769,13 @@ namespace SteamBaseboardRadiator { ShowContinueError(state, "The rest of the radiant energy delivered by the baseboard heater will be lost"); } - if (state.dataSteamBaseboardRadiator->SteamIndex == 0 && BaseboardNum == 1) { - state.dataSteamBaseboardRadiator->SteamIndex = FluidProperties::GetRefrigNum(state, "STEAM"); - if (state.dataSteamBaseboardRadiator->SteamIndex == 0) { - ShowSevereError(state, format("{}Steam Properties for {} not found.", RoutineName, state.dataIPShortCut->cAlphaArgs(1))); - if (SteamMessageNeeded) ShowContinueError(state, "Steam Fluid Properties should have been included in the input file."); - ErrorsFound = true; - SteamMessageNeeded = false; - } + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).steam = Fluid::GetSteam(state); + if (state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).steam == nullptr && BaseboardNum == 1) { + ShowSevereError(state, format("{}Steam Properties for {} not found.", RoutineName, state.dataIPShortCut->cAlphaArgs(1))); + if (SteamMessageNeeded) ShowContinueError(state, "Steam Fluid Properties should have been included in the input file."); + ErrorsFound = true; + SteamMessageNeeded = false; } - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).FluidIndex = state.dataSteamBaseboardRadiator->SteamIndex; } if (ErrorsFound) { @@ -805,7 +793,7 @@ namespace SteamBaseboardRadiator { state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).TotPower, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID); + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name); SetupOutputVariable(state, "Baseboard Convective Heating Rate", @@ -813,21 +801,21 @@ namespace SteamBaseboardRadiator { state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).ConvPower, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID); + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name); SetupOutputVariable(state, "Baseboard Radiant Heating Rate", Constant::Units::W, state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).RadPower, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID); + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name); SetupOutputVariable(state, "Baseboard Total Heating Energy", Constant::Units::J, state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).TotEnergy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID, + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name, Constant::eResource::EnergyTransfer, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::Baseboard); @@ -837,21 +825,21 @@ namespace SteamBaseboardRadiator { state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).ConvEnergy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID); + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name); SetupOutputVariable(state, "Baseboard Radiant Heating Energy", Constant::Units::J, state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).RadEnergy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID); + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name); SetupOutputVariable(state, "Baseboard Steam Energy", Constant::Units::J, state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Energy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID, + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name, Constant::eResource::PlantLoopHeatingDemand, OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::Baseboard); @@ -861,28 +849,28 @@ namespace SteamBaseboardRadiator { state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Power, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID); + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name); SetupOutputVariable(state, "Baseboard Steam Mass Flow Rate", Constant::Units::kg_s, state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).SteamMassFlowRate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID); + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name); SetupOutputVariable(state, "Baseboard Steam Inlet Temperature", Constant::Units::C, state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).SteamInletTemp, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID); + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name); SetupOutputVariable(state, "Baseboard Steam Outlet Temperature", Constant::Units::C, state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).SteamOutletTemp, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID); + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name); } } @@ -901,15 +889,13 @@ namespace SteamBaseboardRadiator { // This subroutine initializes the baseboard units. // METHODOLOGY EMPLOYED: - // The initialization subrotines both in high temperature radiant radiator + // The initialization subroutines both in high temperature radiant radiator // and convective only baseboard radiator are combined and modified. // The heater is assumed to be crossflow with both fluids unmixed. // REFERENCES: // Using/Aliasing - using FluidProperties::GetSatDensityRefrig; - using FluidProperties::GetSatEnthalpyRefrig; using PlantUtilities::InitComponentNodes; using PlantUtilities::ScanPlantLoopsForObject; @@ -937,14 +923,13 @@ namespace SteamBaseboardRadiator { if (!state.dataSteamBaseboardRadiator->ZoneEquipmentListChecked && state.dataZoneEquip->ZoneEquipInputsFilled) { state.dataSteamBaseboardRadiator->ZoneEquipmentListChecked = true; for (Loop = 1; Loop <= state.dataSteamBaseboardRadiator->NumSteamBaseboards; ++Loop) { - if (CheckZoneEquipmentList(state, - state.dataSteamBaseboardRadiator->cCMO_BBRadiator_Steam, - state.dataSteamBaseboardRadiator->SteamBaseboard(Loop).EquipID)) + if (CheckZoneEquipmentList( + state, state.dataSteamBaseboardRadiator->cCMO_BBRadiator_Steam, state.dataSteamBaseboardRadiator->SteamBaseboard(Loop).Name)) continue; ShowSevereError(state, format("InitBaseboard: Unit=[{},{}] is not on any ZoneHVAC:EquipmentList. It will not be simulated.", state.dataSteamBaseboardRadiator->cCMO_BBRadiator_Steam, - state.dataSteamBaseboardRadiator->SteamBaseboard(Loop).EquipID)); + state.dataSteamBaseboardRadiator->SteamBaseboard(Loop).Name)); } } @@ -952,7 +937,7 @@ namespace SteamBaseboardRadiator { if (allocated(state.dataPlnt->PlantLoop)) { errFlag = false; ScanPlantLoopsForObject(state, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID, + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name, state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipType, state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).plantLoc, errFlag, @@ -981,18 +966,9 @@ namespace SteamBaseboardRadiator { SteamInletNode = state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).SteamInletNode; state.dataLoopNodes->Node(SteamInletNode).Temp = 100.0; state.dataLoopNodes->Node(SteamInletNode).Press = 101325.0; - SteamDensity = GetSatDensityRefrig(state, - fluidNameSteam, - state.dataLoopNodes->Node(SteamInletNode).Temp, - 1.0, - state.dataLoopNodes->Node(SteamInletNode).FluidIndex, - RoutineName); - StartEnthSteam = GetSatEnthalpyRefrig(state, - fluidNameSteam, - state.dataLoopNodes->Node(SteamInletNode).Temp, - 1.0, - state.dataLoopNodes->Node(SteamInletNode).FluidIndex, - RoutineName); + auto *steam = Fluid::GetSteam(state); + SteamDensity = steam->getSatDensity(state, state.dataLoopNodes->Node(SteamInletNode).Temp, 1.0, RoutineName); + StartEnthSteam = steam->getSatEnthalpy(state, state.dataLoopNodes->Node(SteamInletNode).Temp, 1.0, RoutineName); state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).SteamMassFlowRateMax = SteamDensity * state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).SteamVolFlowRateMax; InitComponentNodes(state, @@ -1068,9 +1044,6 @@ namespace SteamBaseboardRadiator { // Using/Aliasing using namespace DataSizing; - using FluidProperties::GetSatDensityRefrig; - using FluidProperties::GetSatEnthalpyRefrig; - using FluidProperties::GetSatSpecificHeatRefrig; using HVAC::HeatingCapacitySizing; using PlantUtilities::RegisterPlantCompDesignFlow; @@ -1099,8 +1072,7 @@ namespace SteamBaseboardRadiator { bool PrintFlag; // TRUE when sizing information is reported in the eio file int CapSizingMethod(0); // capacity sizing methods (HeatingDesignCapacity, CapacityPerFloorArea, and FractionOfAutosizedHeatingCapacity ) - auto &ZoneEqSizing(state.dataSize->ZoneEqSizing); - auto &CurZoneEqNum(state.dataSize->CurZoneEqNum); + int &CurZoneEqNum = state.dataSize->CurZoneEqNum; SteamBaseboardDesignData SteamBaseboardDesignDataObject{state.dataSteamBaseboardRadiator->SteamBaseboardDesign( state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).DesignObjectPtr)}; // Contains the data for variable flow hydronic systems @@ -1124,17 +1096,18 @@ namespace SteamBaseboardRadiator { if (state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).SteamVolFlowRateMax > 0.0) { BaseSizer::reportSizerOutput(state, state.dataSteamBaseboardRadiator->cCMO_BBRadiator_Steam, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID, + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name, "User-Specified Maximum Water Flow Rate [m3/s]", state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).SteamVolFlowRateMax); } } else { CheckZoneSizing(state, state.dataSteamBaseboardRadiator->cCMO_BBRadiator_Steam, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID); + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name); + auto &zoneEqSizing = state.dataSize->ZoneEqSizing(CurZoneEqNum); CompType = state.dataSteamBaseboardRadiator->cCMO_BBRadiator_Steam; - CompName = state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID; + CompName = state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name; state.dataSize->DataFracOfAutosizedHeatingCapacity = 1.0; state.dataSize->DataZoneNumber = state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).ZonePtr; SizingMethod = HeatingCapacitySizing; @@ -1142,30 +1115,29 @@ namespace SteamBaseboardRadiator { PrintFlag = false; SizingString = state.dataSteamBaseboardRadiator->SteamBaseboardNumericFields(BaseboardNum).FieldNames(FieldNum) + " [W]"; CapSizingMethod = SteamBaseboardDesignDataObject.HeatingCapMethod; - ZoneEqSizing(CurZoneEqNum).SizingMethod(SizingMethod) = CapSizingMethod; + zoneEqSizing.SizingMethod(SizingMethod) = CapSizingMethod; if (CapSizingMethod == HeatingDesignCapacity || CapSizingMethod == CapacityPerFloorArea || CapSizingMethod == FractionOfAutosizedHeatingCapacity) { if (CapSizingMethod == HeatingDesignCapacity) { if (state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).ScaledHeatingCapacity == AutoSize) { CheckZoneSizing(state, CompType, CompName); - ZoneEqSizing(CurZoneEqNum).HeatingCapacity = true; - ZoneEqSizing(CurZoneEqNum).DesHeatingLoad = state.dataSize->FinalZoneSizing(CurZoneEqNum).NonAirSysDesHeatLoad; + zoneEqSizing.HeatingCapacity = true; + zoneEqSizing.DesHeatingLoad = state.dataSize->FinalZoneSizing(CurZoneEqNum).NonAirSysDesHeatLoad; } TempSize = state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).ScaledHeatingCapacity; } else if (CapSizingMethod == CapacityPerFloorArea) { - ZoneEqSizing(CurZoneEqNum).HeatingCapacity = true; - ZoneEqSizing(CurZoneEqNum).DesHeatingLoad = - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).ScaledHeatingCapacity * - state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea; - TempSize = ZoneEqSizing(CurZoneEqNum).DesHeatingLoad; + zoneEqSizing.HeatingCapacity = true; + zoneEqSizing.DesHeatingLoad = state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).ScaledHeatingCapacity * + state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea; + TempSize = zoneEqSizing.DesHeatingLoad; state.dataSize->DataScalableCapSizingON = true; } else if (CapSizingMethod == FractionOfAutosizedHeatingCapacity) { CheckZoneSizing(state, CompType, CompName); - ZoneEqSizing(CurZoneEqNum).HeatingCapacity = true; + zoneEqSizing.HeatingCapacity = true; state.dataSize->DataFracOfAutosizedHeatingCapacity = state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).ScaledHeatingCapacity; - ZoneEqSizing(CurZoneEqNum).DesHeatingLoad = state.dataSize->FinalZoneSizing(CurZoneEqNum).NonAirSysDesHeatLoad; + zoneEqSizing.DesHeatingLoad = state.dataSize->FinalZoneSizing(CurZoneEqNum).NonAirSysDesHeatLoad; TempSize = AutoSize; state.dataSize->DataScalableCapSizingON = true; } else { @@ -1183,31 +1155,12 @@ namespace SteamBaseboardRadiator { if (DesCoilLoad >= SmallLoad) { SteamInletTemp = 100.0; - EnthSteamInDry = GetSatEnthalpyRefrig(state, - fluidNameSteam, - SteamInletTemp, - 1.0, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).FluidIndex, - RoutineName); - EnthSteamOutWet = GetSatEnthalpyRefrig(state, - fluidNameSteam, - SteamInletTemp, - 0.0, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).FluidIndex, - RoutineName); + auto *steam = Fluid::GetSteam(state); + EnthSteamInDry = steam->getSatEnthalpy(state, SteamInletTemp, 1.0, RoutineName); + EnthSteamOutWet = steam->getSatEnthalpy(state, SteamInletTemp, 0.0, RoutineName); LatentHeatSteam = EnthSteamInDry - EnthSteamOutWet; - SteamDensity = GetSatDensityRefrig(state, - fluidNameSteam, - SteamInletTemp, - 1.0, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).FluidIndex, - RoutineName); - Cp = GetSatSpecificHeatRefrig(state, - fluidNameSteam, - SteamInletTemp, - 0.0, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).FluidIndex, - RoutineName); + SteamDensity = steam->getSatDensity(state, SteamInletTemp, 1.0, RoutineName); + Cp = steam->getSatSpecificHeat(state, SteamInletTemp, 0.0, RoutineName); SteamVolFlowRateMaxDes = DesCoilLoad / @@ -1220,7 +1173,7 @@ namespace SteamBaseboardRadiator { state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).SteamVolFlowRateMax = SteamVolFlowRateMaxDes; BaseSizer::reportSizerOutput(state, state.dataSteamBaseboardRadiator->cCMO_BBRadiator_Steam, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID, + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name, "Design Size Maximum Steam Flow Rate [m3/s]", SteamVolFlowRateMaxDes); } else { // Hard size with sizing data @@ -1229,10 +1182,10 @@ namespace SteamBaseboardRadiator { SteamVolFlowRateMaxUser = state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).SteamVolFlowRateMax; BaseSizer::reportSizerOutput(state, state.dataSteamBaseboardRadiator->cCMO_BBRadiator_Steam, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID, + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name, "Design Size Maximum Steam Flow Rate [m3/s]", SteamVolFlowRateMaxDes, - "User-Speicified Maximum Steam Flow Rate [m3/s]", + "User-Specified Maximum Steam Flow Rate [m3/s]", SteamVolFlowRateMaxUser); if (state.dataGlobal->DisplayExtraWarnings) { // Report difference between design size and user-specified values @@ -1241,7 +1194,7 @@ namespace SteamBaseboardRadiator { ShowMessage(state, format("SizeSteamBaseboard: Potential issue with equipment sizing for " "ZoneHVAC:Baseboard:RadiantConvective:Steam=\"{}\".", - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID)); + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name)); ShowContinueError(state, format("User-Specified Maximum Steam Flow Rate of {:.5R} [m3/s]", SteamVolFlowRateMaxUser)); ShowContinueError( @@ -1256,11 +1209,11 @@ namespace SteamBaseboardRadiator { } } else { if (IsAutoSize) { - // if there is no heating Sizing:Plant object and autosizng was requested, issue an error message + // if there is no heating Sizing:Plant object and autosizing was requested, issue an error message // first error will be issued by MyPlantSizingIndex ShowSevereError(state, "Autosizing of steam baseboard requires a heating loop Sizing:Plant object"); ShowContinueError(state, - format("Occurs in Baseboard Heater={}", state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID)); + format("Occurs in Baseboard Heater={}", state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name)); ErrorsFound = true; } } @@ -1294,11 +1247,7 @@ namespace SteamBaseboardRadiator { // REFERENCES: // Using/Aliasing - using FluidProperties::GetSatDensityRefrig; - using FluidProperties::GetSatEnthalpyRefrig; - using FluidProperties::GetSatSpecificHeatRefrig; using HVAC::SmallLoad; - using ScheduleManager::GetCurrentScheduleValue; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: @@ -1337,15 +1286,13 @@ namespace SteamBaseboardRadiator { SubcoolDeltaT = state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).DegOfSubcooling; if (QZnReq > SmallLoad && !state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) && SteamMassFlowRate > 0.0 && - GetCurrentScheduleValue(state, state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).SchedPtr) > 0) { + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).availSched->getCurrentVal() > 0) { // Unit is on - EnthSteamInDry = GetSatEnthalpyRefrig( - state, fluidNameSteam, SteamInletTemp, 1.0, state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).FluidIndex, RoutineName); - EnthSteamOutWet = GetSatEnthalpyRefrig( - state, fluidNameSteam, SteamInletTemp, 0.0, state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).FluidIndex, RoutineName); + auto *steam = Fluid::GetSteam(state); + EnthSteamInDry = steam->getSatEnthalpy(state, SteamInletTemp, 1.0, RoutineName); + EnthSteamOutWet = steam->getSatEnthalpy(state, SteamInletTemp, 0.0, RoutineName); LatentHeatSteam = EnthSteamInDry - EnthSteamOutWet; - Cp = GetSatSpecificHeatRefrig( - state, fluidNameSteam, SteamInletTemp, 0.0, state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).FluidIndex, RoutineName); + Cp = steam->getSatSpecificHeat(state, SteamInletTemp, 0.0, RoutineName); SteamBBHeat = SteamMassFlowRate * (LatentHeatSteam + SubcoolDeltaT * Cp); // Baseboard heating rate SteamOutletTemp = SteamInletTemp - SubcoolDeltaT; // Outlet temperature of steam // Estimate radiant heat addition @@ -1413,7 +1360,7 @@ namespace SteamBaseboardRadiator { // PURPOSE OF THIS SUBROUTINE: // METHODOLOGY EMPLOYED: - // The update subrotines both in high temperature radiant radiator + // The update subroutines both in high temperature radiant radiator // and convective only baseboard radiator are combined and modified. using PlantUtilities::SafeCopyPlantNode; @@ -1497,7 +1444,7 @@ namespace SteamBaseboardRadiator { // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // To distribute the gains from the steam basebaord heater + // To distribute the gains from the steam baseboard heater // as specified in the user input file. This includes distribution // of long wavelength radiant gains to surfaces and "people." @@ -1545,7 +1492,7 @@ namespace SteamBaseboardRadiator { ShowContinueError(state, format("Occurs in {} = {}", state.dataSteamBaseboardRadiator->cCMO_BBRadiator_Steam, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID)); + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name)); ShowContinueError(state, format("Radiation intensity = {:.2R} [W/m2]", ThisSurfIntensity)); ShowContinueError( state, @@ -1559,7 +1506,7 @@ namespace SteamBaseboardRadiator { ShowContinueError(state, format("Occurs in {} = {}", state.dataSteamBaseboardRadiator->cCMO_BBRadiator_Steam, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID)); + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name)); ShowContinueError( state, format("Assign a larger surface area or more surfaces in {}", state.dataSteamBaseboardRadiator->cCMO_BBRadiator_Steam)); @@ -1579,13 +1526,13 @@ namespace SteamBaseboardRadiator { // RE-ENGINEERED na state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).TotEnergy = - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).TotPower * state.dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).TotPower * state.dataHVACGlobal->TimeStepSysSec; state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Energy = state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Power * state.dataHVACGlobal->TimeStepSysSec; state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).ConvEnergy = - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).ConvPower * state.dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).ConvPower * state.dataHVACGlobal->TimeStepSysSec; state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).RadEnergy = - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).RadPower * state.dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).RadPower * state.dataHVACGlobal->TimeStepSysSec; } void @@ -1597,7 +1544,7 @@ namespace SteamBaseboardRadiator { [[maybe_unused]] const DataPlant::LoopSideLocation LoopSide, // Plant loop side index for where called from int &CompIndex, // Chiller number pointer [[maybe_unused]] bool const FirstHVACIteration, - bool &InitLoopEquip // If not zero, calculate the max load for operating conditions + bool const InitLoopEquip // If not zero, calculate the max load for operating conditions ) { @@ -1627,7 +1574,7 @@ namespace SteamBaseboardRadiator { // Find the correct baseboard if (CompIndex == 0) { - BaseboardNum = Util::FindItemInList(BaseboardName, state.dataSteamBaseboardRadiator->SteamBaseboard, &SteamBaseboardParams::EquipID); + BaseboardNum = Util::FindItemInList(BaseboardName, state.dataSteamBaseboardRadiator->SteamBaseboard, &SteamBaseboardParams::Name); if (BaseboardNum == 0) { ShowFatalError(state, format("UpdateSteamBaseboardPlantConnection: Specified baseboard not valid ={}", BaseboardName)); } @@ -1643,13 +1590,13 @@ namespace SteamBaseboardRadiator { BaseboardName)); } if (state.dataGlobal->KickOffSimulation) { - if (BaseboardName != state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID) { + if (BaseboardName != state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name) { ShowFatalError(state, format("UpdateSteamBaseboardPlantConnection: Invalid CompIndex passed={}, baseboard name={}, stored baseboard " "Name for that index={}", BaseboardNum, BaseboardName, - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).EquipID)); + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).Name)); } if (BaseboardType != DataPlant::PlantEquipmentType::Baseboard_Rad_Conv_Steam) { ShowFatalError(state, diff --git a/src/EnergyPlus/SteamBaseboardRadiator.hh b/src/EnergyPlus/SteamBaseboardRadiator.hh index 4610a904df8..d08868a1af7 100644 --- a/src/EnergyPlus/SteamBaseboardRadiator.hh +++ b/src/EnergyPlus/SteamBaseboardRadiator.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -55,6 +55,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -66,19 +67,18 @@ namespace SteamBaseboardRadiator { struct SteamBaseboardParams { // Members - std::string EquipID; + std::string Name; DataPlant::PlantEquipmentType EquipType; std::string designObjectName; // Design Object int DesignObjectPtr; - std::string Schedule; Array1D_string SurfaceName; Array1D_int SurfacePtr; int ZonePtr; - int SchedPtr; // Pointer to the correct schedule + Sched::Schedule *availSched = nullptr; int SteamInletNode; // Inlet steam baseboard node int SteamOutletNode; // Outlet steam baseboard node int TotSurfToDistrib; // Total numbers of the surfaces that the radiant heat gets distributed - int FluidIndex; // Fluid index for FluidProperties (Steam) + Fluid::RefrigProps *steam = nullptr; int ControlCompTypeNum; int CompErrIndex; Real64 DegOfSubcooling; // Temperature differences due to subcooling of the condensate [C] @@ -124,14 +124,14 @@ namespace SteamBaseboardRadiator { // Default Constructor SteamBaseboardParams() - : EquipType(DataPlant::PlantEquipmentType::Invalid), DesignObjectPtr(0), ZonePtr(0), SchedPtr(0), SteamInletNode(0), SteamOutletNode(0), - TotSurfToDistrib(0), FluidIndex(0), ControlCompTypeNum(0), CompErrIndex(0), DegOfSubcooling(0.0), SteamMassFlowRate(0.0), - SteamMassFlowRateMax(0.0), SteamVolFlowRateMax(0.0), SteamOutletTemp(0.0), SteamInletTemp(0.0), SteamInletEnthalpy(0.0), - SteamOutletEnthalpy(0.0), SteamInletPress(0.0), SteamOutletPress(0.0), SteamInletQuality(0.0), SteamOutletQuality(0.0), - FracRadiant(0.0), FracConvect(0.0), FracDistribPerson(0.0), TotPower(0.0), Power(0.0), ConvPower(0.0), RadPower(0.0), TotEnergy(0.0), - Energy(0.0), ConvEnergy(0.0), RadEnergy(0.0), plantLoc{}, BBLoadReSimIndex(0), BBMassFlowReSimIndex(0), BBInletTempFlowReSimIndex(0), - QBBSteamRadSource(0.0), QBBSteamRadSrcAvg(0.0), ZeroBBSteamSourceSumHATsurf(0.0), LastQBBSteamRadSrc(0.0), LastSysTimeElapsed(0.0), - LastTimeStepSys(0.0), ScaledHeatingCapacity(0.0) + : EquipType(DataPlant::PlantEquipmentType::Invalid), DesignObjectPtr(0), ZonePtr(0), SteamInletNode(0), SteamOutletNode(0), + TotSurfToDistrib(0), ControlCompTypeNum(0), CompErrIndex(0), DegOfSubcooling(0.0), SteamMassFlowRate(0.0), SteamMassFlowRateMax(0.0), + SteamVolFlowRateMax(0.0), SteamOutletTemp(0.0), SteamInletTemp(0.0), SteamInletEnthalpy(0.0), SteamOutletEnthalpy(0.0), + SteamInletPress(0.0), SteamOutletPress(0.0), SteamInletQuality(0.0), SteamOutletQuality(0.0), FracRadiant(0.0), FracConvect(0.0), + FracDistribPerson(0.0), TotPower(0.0), Power(0.0), ConvPower(0.0), RadPower(0.0), TotEnergy(0.0), Energy(0.0), ConvEnergy(0.0), + RadEnergy(0.0), plantLoc{}, BBLoadReSimIndex(0), BBMassFlowReSimIndex(0), BBInletTempFlowReSimIndex(0), QBBSteamRadSource(0.0), + QBBSteamRadSrcAvg(0.0), ZeroBBSteamSourceSumHATsurf(0.0), LastQBBSteamRadSrc(0.0), LastSysTimeElapsed(0.0), LastTimeStepSys(0.0), + ScaledHeatingCapacity(0.0) { } }; @@ -206,7 +206,7 @@ namespace SteamBaseboardRadiator { const DataPlant::LoopSideLocation LoopSide, // Plant loop side index for where called from int &CompIndex, // Chiller number pointer bool const FirstHVACIteration, - bool &InitLoopEquip // If not zero, calculate the max load for operating conditions + bool const InitLoopEquip // If not zero, calculate the max load for operating conditions ); } // namespace SteamBaseboardRadiator @@ -218,7 +218,6 @@ struct SteamBaseboardRadiatorData : BaseGlobalStruct std::string const cCMO_BBRadiator_Steam_Design = "ZoneHVAC:Baseboard:RadiantConvective:Steam:Design"; int NumSteamBaseboards = 0; int NumSteamBaseboardsDesign = 0; - int SteamIndex = 0; Array1D_bool MySizeFlag; Array1D_bool CheckEquipName; @@ -236,6 +235,10 @@ struct SteamBaseboardRadiatorData : BaseGlobalStruct Array1D SteamBaseboardDesignNumericFields; Array1D_string SteamBaseboardDesignNames; // Array that contains the names of Design objects + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } @@ -243,7 +246,6 @@ struct SteamBaseboardRadiatorData : BaseGlobalStruct void clear_state() override { NumSteamBaseboards = 0; - SteamIndex = 0; MySizeFlag.clear(); MyEnvrnFlag.clear(); CheckEquipName.clear(); diff --git a/src/EnergyPlus/SteamCoils.cc b/src/EnergyPlus/SteamCoils.cc index 7362e912db3..837020a62eb 100644 --- a/src/EnergyPlus/SteamCoils.cc +++ b/src/EnergyPlus/SteamCoils.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -50,7 +50,6 @@ // ObjexxFCL Headers #include -#include // EnergyPlus Headers #include @@ -99,9 +98,7 @@ namespace SteamCoils { using PlantUtilities::MyPlantSizingIndex; using PlantUtilities::ScanPlantLoopsForObject; - using namespace ScheduleManager; - static constexpr std::string_view fluidNameSteam("STEAM"); constexpr std::array(CoilControlType::Num)> coilControlTypeNames = {"TEMPERATURESETPOINTCONTROL", "ZONELOADCONTROL"}; @@ -219,6 +216,7 @@ namespace SteamCoils { // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetSteamCoilInput: "); // include trailing blank space + static constexpr std::string_view routineName = "GetSteamCoilInput"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int CoilNum; // The SteamCoil that you are currently loading input into @@ -271,22 +269,20 @@ namespace SteamCoils { lAlphaBlanks, cAlphaFields, cNumericFields); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, AlphArray(1)}; Util::IsNameEmpty(state, AlphArray(1), CurrentModuleObject, ErrorsFound); // ErrorsFound will be set to True if problem was found, left untouched otherwise VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); state.dataSteamCoils->SteamCoil(CoilNum).Name = AlphArray(1); - state.dataSteamCoils->SteamCoil(CoilNum).Schedule = AlphArray(2); + if (lAlphaBlanks(2)) { - state.dataSteamCoils->SteamCoil(CoilNum).SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - state.dataSteamCoils->SteamCoil(CoilNum).SchedPtr = GetScheduleIndex(state, AlphArray(2)); - if (state.dataSteamCoils->SteamCoil(CoilNum).SchedPtr == 0) { - ShowSevereError(state, format("{}{}=\"{}\", invalid data.", RoutineName, CurrentModuleObject, AlphArray(1))); - ShowContinueError(state, format("{} not found={}", cAlphaFields(2), AlphArray(2))); - ErrorsFound = true; - } + state.dataSteamCoils->SteamCoil(CoilNum).availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((state.dataSteamCoils->SteamCoil(CoilNum).availSched = Sched::GetSchedule(state, AlphArray(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), AlphArray(2)); + ErrorsFound = true; } state.dataSteamCoils->SteamCoil(CoilNum).SteamCoilTypeA = "Heating"; @@ -369,16 +365,12 @@ namespace SteamCoils { TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(3), AlphArray(4), "Steam Nodes"); TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(5), AlphArray(6), "Air Nodes"); - if (state.dataSteamCoils->SteamIndex == 0 && CoilNum == 1) { - state.dataSteamCoils->SteamIndex = FluidProperties::GetRefrigNum(state, "STEAM"); - if (state.dataSteamCoils->SteamIndex == 0) { - ShowSevereError(state, format("{}Steam Properties for {} not found.", RoutineName, AlphArray(1))); - ShowContinueError(state, "Steam Fluid Properties should have been included in the input file."); - ErrorsFound = true; - } + state.dataSteamCoils->SteamCoil(CoilNum).steam = Fluid::GetSteam(state); + if (state.dataSteamCoils->SteamCoil(CoilNum).steam == nullptr && CoilNum == 1) { + ShowSevereError(state, format("{}Steam Properties for {} not found.", RoutineName, AlphArray(1))); + ShowContinueError(state, "Steam Fluid Properties should have been included in the input file."); + ErrorsFound = true; } - - state.dataSteamCoils->SteamCoil(CoilNum).FluidIndex = state.dataSteamCoils->SteamIndex; } for (CoilNum = 1; CoilNum <= NumStmHeat; ++CoilNum) { @@ -466,8 +458,6 @@ namespace SteamCoils { // na // Using/Aliasing - using FluidProperties::GetSatDensityRefrig; - using FluidProperties::GetSatEnthalpyRefrig; using PlantUtilities::InitComponentNodes; // Locals @@ -566,18 +556,9 @@ namespace SteamCoils { state.dataLoopNodes->Node(SteamInletNode).Temp = 100.0; state.dataLoopNodes->Node(SteamInletNode).Press = 101325.0; - SteamDensity = GetSatDensityRefrig(state, - fluidNameSteam, - state.dataLoopNodes->Node(SteamInletNode).Temp, - 1.0, - state.dataLoopNodes->Node(SteamInletNode).FluidIndex, - RoutineName); - StartEnthSteam = GetSatEnthalpyRefrig(state, - fluidNameSteam, - state.dataLoopNodes->Node(SteamInletNode).Temp, - 1.0, - state.dataLoopNodes->Node(SteamInletNode).FluidIndex, - RoutineName); + auto *steam = Fluid::GetSteam(state); + SteamDensity = steam->getSatDensity(state, state.dataLoopNodes->Node(SteamInletNode).Temp, 1.0, RoutineName); + StartEnthSteam = steam->getSatEnthalpy(state, state.dataLoopNodes->Node(SteamInletNode).Temp, 1.0, RoutineName); state.dataLoopNodes->Node(SteamInletNode).Enthalpy = StartEnthSteam; state.dataLoopNodes->Node(SteamInletNode).Quality = 1.0; state.dataLoopNodes->Node(SteamInletNode).HumRat = 0.0; @@ -662,8 +643,6 @@ namespace SteamCoils { // Using/Aliasing using namespace DataSizing; - using FluidProperties::GetSatDensityRefrig; - using FluidProperties::GetSatEnthalpyRefrig; using PlantUtilities::RegisterPlantCompDesignFlow; // SUBROUTINE PARAMETER DEFINITIONS: @@ -814,20 +793,16 @@ namespace SteamCoils { // TempSteamIn=PlantSizData(PltSizSteamNum)%ExitTemp TempSteamIn = 100.0; // Should be from the PlantSizing object (ExitTemp) instead of hardwired to 100? // RefrigIndex is set during GetInput for this module - EnthSteamInDry = GetSatEnthalpyRefrig( - state, fluidNameSteam, TempSteamIn, 1.0, state.dataSteamCoils->SteamCoil(CoilNum).FluidIndex, RoutineName); - EnthSteamOutWet = GetSatEnthalpyRefrig( - state, fluidNameSteam, TempSteamIn, 0.0, state.dataSteamCoils->SteamCoil(CoilNum).FluidIndex, RoutineName); + EnthSteamInDry = state.dataSteamCoils->SteamCoil(CoilNum).steam->getSatEnthalpy(state, TempSteamIn, 1.0, RoutineName); + EnthSteamOutWet = state.dataSteamCoils->SteamCoil(CoilNum).steam->getSatEnthalpy(state, TempSteamIn, 0.0, RoutineName); LatentHeatSteam = EnthSteamInDry - EnthSteamOutWet; - SteamDensity = GetSatDensityRefrig( - state, fluidNameSteam, TempSteamIn, 1.0, state.dataSteamCoils->SteamCoil(CoilNum).FluidIndex, RoutineName); + SteamDensity = state.dataSteamCoils->SteamCoil(CoilNum).steam->getSatDensity(state, TempSteamIn, 1.0, RoutineName); // SteamCoil(CoilNum)%MaxSteamVolFlowRate = DesCoilLoad/(SteamDensity * LatentHeatSteam) // CpWater = GetSpecificHeatGlycol('WATER', & // TempSteamIn, & // PlantLoop(SteamCoil(CoilNum)%LoopNum)%FluidIndex, & // 'SizeSteamCoil') - CpWater = FluidProperties::GetSatSpecificHeatRefrig( - state, fluidNameSteam, TempSteamIn, 0.0, state.dataSteamCoils->SteamCoil(CoilNum).FluidIndex, RoutineName); + CpWater = state.dataSteamCoils->SteamCoil(CoilNum).steam->getSatSpecificHeat(state, TempSteamIn, 0.0, RoutineName); state.dataSteamCoils->SteamCoil(CoilNum).MaxSteamVolFlowRate = DesCoilLoad / (SteamDensity * (LatentHeatSteam + state.dataSteamCoils->SteamCoil(CoilNum).DegOfSubcooling * CpWater)); @@ -883,20 +858,16 @@ namespace SteamCoils { if (DesCoilLoad >= HVAC::SmallLoad) { TempSteamIn = 100.0; // RefrigIndex is set during GetInput for this module - EnthSteamInDry = GetSatEnthalpyRefrig( - state, fluidNameSteam, TempSteamIn, 1.0, state.dataSteamCoils->SteamCoil(CoilNum).FluidIndex, RoutineName); - EnthSteamOutWet = GetSatEnthalpyRefrig( - state, fluidNameSteam, TempSteamIn, 0.0, state.dataSteamCoils->SteamCoil(CoilNum).FluidIndex, RoutineName); + EnthSteamInDry = state.dataSteamCoils->SteamCoil(CoilNum).steam->getSatEnthalpy(state, TempSteamIn, 1.0, RoutineName); + EnthSteamOutWet = state.dataSteamCoils->SteamCoil(CoilNum).steam->getSatEnthalpy(state, TempSteamIn, 0.0, RoutineName); LatentHeatSteam = EnthSteamInDry - EnthSteamOutWet; - SteamDensity = GetSatDensityRefrig( - state, fluidNameSteam, TempSteamIn, 1.0, state.dataSteamCoils->SteamCoil(CoilNum).FluidIndex, RoutineName); + SteamDensity = state.dataSteamCoils->SteamCoil(CoilNum).steam->getSatDensity(state, TempSteamIn, 1.0, RoutineName); // SteamCoil(CoilNum)%MaxSteamVolFlowRate = DesCoilLoad/(SteamDensity * LatentHeatSteam) // CpWater = GetSpecificHeatGlycol('WATER', & // TempSteamIn, & // PlantLoop(SteamCoil(CoilNum)%LoopNum)%FluidIndex, & // 'SizeSteamCoil') - CpWater = FluidProperties::GetSatSpecificHeatRefrig( - state, fluidNameSteam, TempSteamIn, 0.0, state.dataSteamCoils->SteamCoil(CoilNum).FluidIndex, RoutineName); + CpWater = state.dataSteamCoils->SteamCoil(CoilNum).steam->getSatSpecificHeat(state, TempSteamIn, 0.0, RoutineName); state.dataSteamCoils->SteamCoil(CoilNum).MaxSteamVolFlowRate = DesCoilLoad / (SteamDensity * (LatentHeatSteam + state.dataSteamCoils->SteamCoil(CoilNum).DegOfSubcooling * CpWater)); @@ -1108,17 +1079,14 @@ namespace SteamCoils { case CoilControlType::ZoneLoadControl: if ((CapacitanceAir > 0.0) && ((state.dataSteamCoils->SteamCoil(CoilNum).InletSteamMassFlowRate) > 0.0) && - (GetCurrentScheduleValue(state, state.dataSteamCoils->SteamCoil(CoilNum).SchedPtr) > 0.0 || - state.dataSteamCoils->MySizeFlag(CoilNum)) && + (state.dataSteamCoils->SteamCoil(CoilNum).availSched->getCurrentVal() > 0.0 || state.dataSteamCoils->MySizeFlag(CoilNum)) && (QCoilReq > 0.0)) { // Steam heat exchangers would not have effectivness, since all of the steam is // converted to water and only then the steam trap allows it to leave the heat // exchanger, subsequently heat exchange is latent heat + subcooling. - EnthSteamInDry = FluidProperties::GetSatEnthalpyRefrig( - state, fluidNameSteam, TempSteamIn, 1.0, state.dataSteamCoils->SteamCoil(CoilNum).FluidIndex, RoutineName); - EnthSteamOutWet = FluidProperties::GetSatEnthalpyRefrig( - state, fluidNameSteam, TempSteamIn, 0.0, state.dataSteamCoils->SteamCoil(CoilNum).FluidIndex, RoutineName); + EnthSteamInDry = state.dataSteamCoils->SteamCoil(CoilNum).steam->getSatEnthalpy(state, TempSteamIn, 1.0, RoutineName); + EnthSteamOutWet = state.dataSteamCoils->SteamCoil(CoilNum).steam->getSatEnthalpy(state, TempSteamIn, 0.0, RoutineName); LatentHeatSteam = EnthSteamInDry - EnthSteamOutWet; @@ -1127,8 +1095,7 @@ namespace SteamCoils { // PlantLoop(SteamCoil(CoilNum)%LoopNum)%FluidIndex, & // 'CalcSteamAirCoil') - CpWater = FluidProperties::GetSatSpecificHeatRefrig( - state, fluidNameSteam, TempSteamIn, 0.0, state.dataSteamCoils->SteamCoil(CoilNum).FluidIndex, RoutineNameSizeSteamCoil); + CpWater = state.dataSteamCoils->SteamCoil(CoilNum).steam->getSatSpecificHeat(state, TempSteamIn, 0.0, RoutineNameSizeSteamCoil); // Max Heat Transfer QSteamCoilMaxHT = state.dataSteamCoils->SteamCoil(CoilNum).MaxSteamMassFlowRate * (LatentHeatSteam + SubcoolDeltaTemp * CpWater); @@ -1179,24 +1146,21 @@ namespace SteamCoils { // considering saturated state. // StdBaroPress=101325 - TempWaterAtmPress = FluidProperties::GetSatTemperatureRefrig( - state, fluidNameSteam, state.dataEnvrn->StdBaroPress, state.dataSteamCoils->SteamCoil(CoilNum).FluidIndex, RoutineName); + TempWaterAtmPress = + state.dataSteamCoils->SteamCoil(CoilNum).steam->getSatTemperature(state, state.dataEnvrn->StdBaroPress, RoutineName); // Point 4 at atm - loop delta subcool during return journery back to pump TempLoopOutToPump = TempWaterAtmPress - state.dataSteamCoils->SteamCoil(CoilNum).LoopSubcoolReturn; // Actual Steam Coil Outlet Enthalpy - EnthCoilOutlet = FluidProperties::GetSatEnthalpyRefrig( - state, fluidNameSteam, TempSteamIn, 0.0, state.dataSteamCoils->SteamCoil(CoilNum).FluidIndex, RoutineName) - - CpWater * SubcoolDeltaTemp; + EnthCoilOutlet = + state.dataSteamCoils->SteamCoil(CoilNum).steam->getSatEnthalpy(state, TempSteamIn, 0.0, RoutineName) - CpWater * SubcoolDeltaTemp; // Enthalpy at Point 4 - EnthAtAtmPress = FluidProperties::GetSatEnthalpyRefrig( - state, fluidNameSteam, TempWaterAtmPress, 0.0, state.dataSteamCoils->SteamCoil(CoilNum).FluidIndex, RoutineName); + EnthAtAtmPress = state.dataSteamCoils->SteamCoil(CoilNum).steam->getSatEnthalpy(state, TempWaterAtmPress, 0.0, RoutineName); // Reported value of coil outlet enthalpy at the node to match the node outlet temperature - CpWater = FluidProperties::GetSatSpecificHeatRefrig( - state, fluidNameSteam, TempLoopOutToPump, 0.0, state.dataSteamCoils->SteamCoil(CoilNum).FluidIndex, RoutineNameSizeSteamCoil); + CpWater = state.dataSteamCoils->SteamCoil(CoilNum).steam->getSatSpecificHeat(state, TempLoopOutToPump, 0.0, RoutineNameSizeSteamCoil); EnthPumpInlet = EnthAtAtmPress - CpWater * state.dataSteamCoils->SteamCoil(CoilNum).LoopSubcoolReturn; @@ -1223,25 +1187,21 @@ namespace SteamCoils { case CoilControlType::TemperatureSetPoint: // Control coil output to meet a Setpoint Temperature. if ((CapacitanceAir > 0.0) && ((state.dataSteamCoils->SteamCoil(CoilNum).InletSteamMassFlowRate) > 0.0) && - (GetCurrentScheduleValue(state, state.dataSteamCoils->SteamCoil(CoilNum).SchedPtr) > 0.0 || - state.dataSteamCoils->MySizeFlag(CoilNum)) && + (state.dataSteamCoils->SteamCoil(CoilNum).availSched->getCurrentVal() > 0.0 || state.dataSteamCoils->MySizeFlag(CoilNum)) && (std::abs(TempSetPoint - TempAirIn) > TempControlTol)) { // Steam heat exchangers would not have effectivness, since all of the steam is // converted to water and only then the steam trap allows it to leave the heat // exchanger, subsequently heat exchange is latent heat + subcooling. - EnthSteamInDry = FluidProperties::GetSatEnthalpyRefrig( - state, fluidNameSteam, TempSteamIn, 1.0, state.dataSteamCoils->SteamCoil(CoilNum).FluidIndex, RoutineName); - EnthSteamOutWet = FluidProperties::GetSatEnthalpyRefrig( - state, fluidNameSteam, TempSteamIn, 0.0, state.dataSteamCoils->SteamCoil(CoilNum).FluidIndex, RoutineName); + EnthSteamInDry = state.dataSteamCoils->SteamCoil(CoilNum).steam->getSatEnthalpy(state, TempSteamIn, 1.0, RoutineName); + EnthSteamOutWet = state.dataSteamCoils->SteamCoil(CoilNum).steam->getSatEnthalpy(state, TempSteamIn, 0.0, RoutineName); LatentHeatSteam = EnthSteamInDry - EnthSteamOutWet; // CpWater = GetSpecificHeatGlycol('WATER', & // TempSteamIn, & // PlantLoop(SteamCoil(CoilNum)%LoopNum)%FluidIndex, & // 'CalcSteamAirCoil') - CpWater = FluidProperties::GetSatSpecificHeatRefrig( - state, fluidNameSteam, TempSteamIn, 0.0, state.dataSteamCoils->SteamCoil(CoilNum).FluidIndex, RoutineNameSizeSteamCoil); + CpWater = state.dataSteamCoils->SteamCoil(CoilNum).steam->getSatSpecificHeat(state, TempSteamIn, 0.0, RoutineNameSizeSteamCoil); // Max Heat Transfer QSteamCoilMaxHT = state.dataSteamCoils->SteamCoil(CoilNum).MaxSteamMassFlowRate * (LatentHeatSteam + SubcoolDeltaTemp * CpWater); @@ -1351,23 +1311,21 @@ namespace SteamCoils { // considering saturated state. // StdBaroPress=101325 - TempWaterAtmPress = FluidProperties::GetSatTemperatureRefrig( - state, fluidNameSteam, state.dataEnvrn->StdBaroPress, state.dataSteamCoils->SteamCoil(CoilNum).FluidIndex, RoutineName); + TempWaterAtmPress = + state.dataSteamCoils->SteamCoil(CoilNum).steam->getSatTemperature(state, state.dataEnvrn->StdBaroPress, RoutineName); // Point 4 at atm - loop delta subcool during return journery back to pump TempLoopOutToPump = TempWaterAtmPress - state.dataSteamCoils->SteamCoil(CoilNum).LoopSubcoolReturn; // Actual Steam Coil Outlet Enthalpy - EnthCoilOutlet = FluidProperties::GetSatEnthalpyRefrig( - state, fluidNameSteam, TempSteamIn, 0.0, state.dataSteamCoils->SteamCoil(CoilNum).FluidIndex, RoutineName) - + EnthCoilOutlet = state.dataSteamCoils->SteamCoil(CoilNum).steam->getSatEnthalpy(state, TempSteamIn, 0.0, RoutineName) - CpWater * SubcoolDeltaTemp; // Enthalpy at Point 4 - EnthAtAtmPress = FluidProperties::GetSatEnthalpyRefrig( - state, fluidNameSteam, TempWaterAtmPress, 0.0, state.dataSteamCoils->SteamCoil(CoilNum).FluidIndex, RoutineName); + EnthAtAtmPress = state.dataSteamCoils->SteamCoil(CoilNum).steam->getSatEnthalpy(state, TempWaterAtmPress, 0.0, RoutineName); - CpWater = FluidProperties::GetSatSpecificHeatRefrig( - state, fluidNameSteam, TempLoopOutToPump, 0.0, state.dataSteamCoils->SteamCoil(CoilNum).FluidIndex, RoutineNameSizeSteamCoil); + CpWater = + state.dataSteamCoils->SteamCoil(CoilNum).steam->getSatSpecificHeat(state, TempLoopOutToPump, 0.0, RoutineNameSizeSteamCoil); // Reported value of coil outlet enthalpy at the node to match the node outlet temperature EnthPumpInlet = EnthAtAtmPress - CpWater * state.dataSteamCoils->SteamCoil(CoilNum).LoopSubcoolReturn; @@ -1607,7 +1565,7 @@ namespace SteamCoils { ShowFatalError(state, format("CheckSteamCoilSchedule: Coil not found={}", CompName)); } CompIndex = CoilNum; - Value = GetCurrentScheduleValue(state, state.dataSteamCoils->SteamCoil(CoilNum).SchedPtr); // not scheduled? + Value = state.dataSteamCoils->SteamCoil(CoilNum).availSched->getCurrentVal(); // not scheduled? } else { CoilNum = CompIndex; if (CoilNum > state.dataSteamCoils->NumSteamCoils || CoilNum < 1) { @@ -1624,7 +1582,7 @@ namespace SteamCoils { CompName, state.dataSteamCoils->SteamCoil(CoilNum).Name)); } - Value = GetCurrentScheduleValue(state, state.dataSteamCoils->SteamCoil(CoilNum).SchedPtr); // not scheduled? + Value = state.dataSteamCoils->SteamCoil(CoilNum).availSched->getCurrentVal(); // not scheduled? } } @@ -2183,7 +2141,7 @@ namespace SteamCoils { if (Util::SameString(CoilType, "Coil:Heating:Steam")) { WhichCoil = Util::FindItem(CoilName, state.dataSteamCoils->SteamCoil); if (WhichCoil != 0) { - AvailSchIndex = state.dataSteamCoils->SteamCoil(WhichCoil).SchedPtr; + AvailSchIndex = state.dataSteamCoils->SteamCoil(WhichCoil).availSched->Num; } } else { WhichCoil = 0; diff --git a/src/EnergyPlus/SteamCoils.hh b/src/EnergyPlus/SteamCoils.hh index 4eeb18c25af..0133739d11a 100644 --- a/src/EnergyPlus/SteamCoils.hh +++ b/src/EnergyPlus/SteamCoils.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -56,6 +56,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -76,43 +77,42 @@ namespace SteamCoils { struct SteamCoilEquipConditions { // Members - std::string Name; // Name of the SteamCoil - std::string SteamCoilTypeA; // Type of SteamCoil ie. Heating or Cooling - int SteamCoilType; // Type of SteamCoil ie. Heating or Cooling - int SteamCoilModel; // Type of SteamCoil ie. Simple, Detailed, etc. - std::string Schedule; // SteamCoil Operation Schedule - int SchedPtr; // Pointer to the correct schedule - Real64 InletAirMassFlowRate; // MassFlow through the SteamCoil being Simulated [kg/s] - Real64 OutletAirMassFlowRate; // MassFlow throught the SteamCoil being Simulated[kg/s] - Real64 InletAirTemp; // Inlet Air Temperature Operating Condition [C] - Real64 OutletAirTemp; // Outlet Air Temperature Operating Condition [C] - Real64 InletAirHumRat; // Inlet Air Humidity Ratio Operating Condition - Real64 OutletAirHumRat; // Outlet Air Humidity Ratio Calculated Condition - Real64 InletAirEnthalpy; // Inlet Air enthalpy [J/kg] - Real64 OutletAirEnthalpy; // Outlet Air enthalpy [J/kg] - Real64 TotSteamCoilLoad; // Total Load on the Coil [W] - Real64 SenSteamCoilLoad; // Sensible Load on the Coil [W] - Real64 TotSteamHeatingCoilEnergy; // Total Heating Coil energy of the Coil [J] - Real64 TotSteamCoolingCoilEnergy; // Total Cooling Coil energy of the Coil [J] - Real64 SenSteamCoolingCoilEnergy; // Sensible Cooling Coil energy of the Coil [J] - Real64 TotSteamHeatingCoilRate; // Total Heating Coil Rate on the Coil [W] - Real64 LoopLoss; // Loss in loop due to cond return to atm pressure - Real64 TotSteamCoolingCoilRate; // Total Cooling Coil Rate on the Coil [W] - Real64 SenSteamCoolingCoilRate; // Sensible Cooling Coil Rate on the Coil [W] - Real64 LeavingRelHum; // Simple Coil Latent Model requires User input for leaving RH - Real64 DesiredOutletTemp; // Temp desired at the outlet (C) - Real64 DesiredOutletHumRat; // Humudity Ratio desired at outlet (C) - Real64 InletSteamTemp; // Inlet Steam Temperature [C] - Real64 OutletSteamTemp; // Outlet Steam Temperature [C] - Real64 InletSteamMassFlowRate; // Inlet Steam Mass Flow Rate [Kg/s] - Real64 OutletSteamMassFlowRate; // Outlet Steam Mass Flow Rate [Kg/s] - Real64 MaxSteamVolFlowRate; // Maximum water Volume flow rate [m3/s] - Real64 MaxSteamMassFlowRate; // Maximum water mass flow rate [Kg/s] - Real64 InletSteamEnthalpy; // Inlet Water Enthalpy (J/Kg) - Real64 OutletWaterEnthalpy; // Outlet Water Enthalpy (J/kg) - Real64 InletSteamPress; // Pressure at steam inlet (Pa) - Real64 InletSteamQuality; // Quality of steam at inlet - Real64 OutletSteamQuality; // Quality of steam at outlet + std::string Name; // Name of the SteamCoil + std::string SteamCoilTypeA; // Type of SteamCoil ie. Heating or Cooling + int SteamCoilType; // Type of SteamCoil ie. Heating or Cooling + int SteamCoilModel; // Type of SteamCoil ie. Simple, Detailed, etc. + Sched::Schedule *availSched = nullptr; // operating schedule + Real64 InletAirMassFlowRate; // MassFlow through the SteamCoil being Simulated [kg/s] + Real64 OutletAirMassFlowRate; // MassFlow throught the SteamCoil being Simulated[kg/s] + Real64 InletAirTemp; // Inlet Air Temperature Operating Condition [C] + Real64 OutletAirTemp; // Outlet Air Temperature Operating Condition [C] + Real64 InletAirHumRat; // Inlet Air Humidity Ratio Operating Condition + Real64 OutletAirHumRat; // Outlet Air Humidity Ratio Calculated Condition + Real64 InletAirEnthalpy; // Inlet Air enthalpy [J/kg] + Real64 OutletAirEnthalpy; // Outlet Air enthalpy [J/kg] + Real64 TotSteamCoilLoad; // Total Load on the Coil [W] + Real64 SenSteamCoilLoad; // Sensible Load on the Coil [W] + Real64 TotSteamHeatingCoilEnergy; // Total Heating Coil energy of the Coil [J] + Real64 TotSteamCoolingCoilEnergy; // Total Cooling Coil energy of the Coil [J] + Real64 SenSteamCoolingCoilEnergy; // Sensible Cooling Coil energy of the Coil [J] + Real64 TotSteamHeatingCoilRate; // Total Heating Coil Rate on the Coil [W] + Real64 LoopLoss; // Loss in loop due to cond return to atm pressure + Real64 TotSteamCoolingCoilRate; // Total Cooling Coil Rate on the Coil [W] + Real64 SenSteamCoolingCoilRate; // Sensible Cooling Coil Rate on the Coil [W] + Real64 LeavingRelHum; // Simple Coil Latent Model requires User input for leaving RH + Real64 DesiredOutletTemp; // Temp desired at the outlet (C) + Real64 DesiredOutletHumRat; // Humudity Ratio desired at outlet (C) + Real64 InletSteamTemp; // Inlet Steam Temperature [C] + Real64 OutletSteamTemp; // Outlet Steam Temperature [C] + Real64 InletSteamMassFlowRate; // Inlet Steam Mass Flow Rate [Kg/s] + Real64 OutletSteamMassFlowRate; // Outlet Steam Mass Flow Rate [Kg/s] + Real64 MaxSteamVolFlowRate; // Maximum water Volume flow rate [m3/s] + Real64 MaxSteamMassFlowRate; // Maximum water mass flow rate [Kg/s] + Real64 InletSteamEnthalpy; // Inlet Water Enthalpy (J/Kg) + Real64 OutletWaterEnthalpy; // Outlet Water Enthalpy (J/kg) + Real64 InletSteamPress; // Pressure at steam inlet (Pa) + Real64 InletSteamQuality; // Quality of steam at inlet + Real64 OutletSteamQuality; // Quality of steam at outlet Real64 DegOfSubcooling; Real64 LoopSubcoolReturn; int AirInletNodeNum; // Inlet node number at air side @@ -121,7 +121,7 @@ namespace SteamCoils { int SteamOutletNodeNum; // SteamOutletNodeNum int TempSetPointNodeNum; // If applicable : node number that the temp setpoint exists. CoilControlType TypeOfCoil = CoilControlType::Invalid; // Control of Coil , temperature or Zone load - int FluidIndex; // Fluid index for FluidProperties (Steam) + Fluid::RefrigProps *steam = nullptr; // FluidProperties (Steam) PlantLocation plantLoc; // Location object for plant component for steam coil DataPlant::PlantEquipmentType CoilType; // plant level index for coil type Real64 OperatingCapacity; // capacity of steam coil at operating conditions (W) @@ -136,17 +136,16 @@ namespace SteamCoils { // Default Constructor SteamCoilEquipConditions() - : SteamCoilType(0), SteamCoilModel(0), SchedPtr(0), InletAirMassFlowRate(0.0), OutletAirMassFlowRate(0.0), InletAirTemp(0.0), - OutletAirTemp(0.0), InletAirHumRat(0.0), OutletAirHumRat(0.0), InletAirEnthalpy(0.0), OutletAirEnthalpy(0.0), TotSteamCoilLoad(0.0), - SenSteamCoilLoad(0.0), TotSteamHeatingCoilEnergy(0.0), TotSteamCoolingCoilEnergy(0.0), SenSteamCoolingCoilEnergy(0.0), - TotSteamHeatingCoilRate(0.0), LoopLoss(0.0), TotSteamCoolingCoilRate(0.0), SenSteamCoolingCoilRate(0.0), LeavingRelHum(0.0), - DesiredOutletTemp(0.0), DesiredOutletHumRat(0.0), InletSteamTemp(0.0), OutletSteamTemp(0.0), InletSteamMassFlowRate(0.0), - OutletSteamMassFlowRate(0.0), MaxSteamVolFlowRate(0.0), MaxSteamMassFlowRate(0.0), InletSteamEnthalpy(0.0), OutletWaterEnthalpy(0.0), - InletSteamPress(0.0), InletSteamQuality(0.0), OutletSteamQuality(0.0), DegOfSubcooling(0.0), LoopSubcoolReturn(0.0), AirInletNodeNum(0), - AirOutletNodeNum(0), SteamInletNodeNum(0), SteamOutletNodeNum(0), TempSetPointNodeNum(0), FluidIndex(0), plantLoc{}, - CoilType(DataPlant::PlantEquipmentType::Invalid), OperatingCapacity(0.0), DesiccantRegenerationCoil(false), DesiccantDehumNum(0), - FaultyCoilSATFlag(false), FaultyCoilSATIndex(0), FaultyCoilSATOffset(0.0), reportCoilFinalSizes(true), DesCoilCapacity(0.0), - DesAirVolFlow(0.0) + : SteamCoilType(0), SteamCoilModel(0), InletAirMassFlowRate(0.0), OutletAirMassFlowRate(0.0), InletAirTemp(0.0), OutletAirTemp(0.0), + InletAirHumRat(0.0), OutletAirHumRat(0.0), InletAirEnthalpy(0.0), OutletAirEnthalpy(0.0), TotSteamCoilLoad(0.0), SenSteamCoilLoad(0.0), + TotSteamHeatingCoilEnergy(0.0), TotSteamCoolingCoilEnergy(0.0), SenSteamCoolingCoilEnergy(0.0), TotSteamHeatingCoilRate(0.0), + LoopLoss(0.0), TotSteamCoolingCoilRate(0.0), SenSteamCoolingCoilRate(0.0), LeavingRelHum(0.0), DesiredOutletTemp(0.0), + DesiredOutletHumRat(0.0), InletSteamTemp(0.0), OutletSteamTemp(0.0), InletSteamMassFlowRate(0.0), OutletSteamMassFlowRate(0.0), + MaxSteamVolFlowRate(0.0), MaxSteamMassFlowRate(0.0), InletSteamEnthalpy(0.0), OutletWaterEnthalpy(0.0), InletSteamPress(0.0), + InletSteamQuality(0.0), OutletSteamQuality(0.0), DegOfSubcooling(0.0), LoopSubcoolReturn(0.0), AirInletNodeNum(0), AirOutletNodeNum(0), + SteamInletNodeNum(0), SteamOutletNodeNum(0), TempSetPointNodeNum(0), plantLoc{}, CoilType(DataPlant::PlantEquipmentType::Invalid), + OperatingCapacity(0.0), DesiccantRegenerationCoil(false), DesiccantDehumNum(0), FaultyCoilSATFlag(false), FaultyCoilSATIndex(0), + FaultyCoilSATOffset(0.0), reportCoilFinalSizes(true), DesCoilCapacity(0.0), DesAirVolFlow(0.0) { } }; @@ -258,10 +257,10 @@ namespace SteamCoils { bool &ErrorFlag // set to true if problem ); - int GetSteamCoilAvailScheduleIndex(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem + Sched::Schedule *GetSteamCoilAvailSchedule(EnergyPlusData &state, + std::string const &CoilType, // must match coil types in this module + std::string const &CoilName, // must match coil names for the coil type + bool &ErrorsFound // set to true if problem ); // sets data to a coil that is used as a regeneration air heating coil in @@ -277,7 +276,6 @@ namespace SteamCoils { struct SteamCoilsData : BaseGlobalStruct { - int SteamIndex = 0; int NumSteamCoils = 0; // The Number of SteamCoils found in the Input Array1D_bool MySizeFlag; Array1D_bool CoilWarningOnceFlag; @@ -289,6 +287,10 @@ struct SteamCoilsData : BaseGlobalStruct int ErrCount = 0; Array1D SteamCoil; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/StringUtilities.hh b/src/EnergyPlus/StringUtilities.hh index a97f2a660d6..497f734d792 100644 --- a/src/EnergyPlus/StringUtilities.hh +++ b/src/EnergyPlus/StringUtilities.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/SurfaceGeometry.cc b/src/EnergyPlus/SurfaceGeometry.cc index 2de47e03eb3..96c5a191987 100644 --- a/src/EnergyPlus/SurfaceGeometry.cc +++ b/src/EnergyPlus/SurfaceGeometry.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -52,7 +52,6 @@ #include // ObjexxFCL Headers -#include #include #include @@ -103,16 +102,10 @@ namespace SurfaceGeometry { // AUTHOR Linda Lawrie // DATE WRITTEN June 2000 // MODIFIED DJS (PSU Dec 2006) to add ecoroof - // RE-ENGINEERED na // PURPOSE OF THIS MODULE: // This module performs the functions required of the surface geometry. - using namespace DataEnvironment; - using namespace DataHeatBalance; - using namespace DataSurfaces; - using DataWindowEquivalentLayer::CFSMAXNL; - static std::string const BlankString; int constexpr UnenteredAdjacentZoneSurface = -998; // allows users to enter one zone surface ("Zone") @@ -121,8 +114,8 @@ namespace SurfaceGeometry { void AllocateSurfaceWindows(EnergyPlusData &state, int NumSurfaces) { - state.dataSurface->SurfWinA.dimension(state.dataSurface->TotSurfaces, CFSMAXNL + 1, 0.0); - state.dataSurface->SurfWinADiffFront.dimension(state.dataSurface->TotSurfaces, CFSMAXNL + 1, 0.0); + state.dataSurface->SurfWinA.dimension(state.dataSurface->TotSurfaces, DataWindowEquivalentLayer::CFSMAXNL + 1, 0.0); + state.dataSurface->SurfWinADiffFront.dimension(state.dataSurface->TotSurfaces, DataWindowEquivalentLayer::CFSMAXNL + 1, 0.0); state.dataSurface->SurfWinACFOverlap.dimension(state.dataSurface->TotSurfaces, state.dataHeatBal->MaxSolidWinLayers, 0.0); state.dataSurface->SurfWinFrameQRadOutAbs.dimension(NumSurfaces, 0); @@ -173,13 +166,13 @@ namespace SurfaceGeometry { state.dataSurface->SurfWinProfileAngHor.dimension(NumSurfaces, 0); state.dataSurface->SurfWinProfileAngVert.dimension(NumSurfaces, 0); - state.dataSurface->SurfWinShadingFlag.dimension(NumSurfaces, WinShadingType::ShadeOff); + state.dataSurface->SurfWinShadingFlag.dimension(NumSurfaces, DataSurfaces::WinShadingType::ShadeOff); state.dataSurface->SurfWinShadingFlagEMSOn.dimension(NumSurfaces, 0); state.dataSurface->SurfWinShadingFlagEMSValue.dimension(NumSurfaces, 0.0); state.dataSurface->SurfWinStormWinFlag.dimension(NumSurfaces, 0); state.dataSurface->SurfWinStormWinFlagPrevDay.dimension(NumSurfaces, 0); state.dataSurface->SurfWinFracTimeShadingDeviceOn.dimension(NumSurfaces, 0); - state.dataSurface->SurfWinExtIntShadePrevTS.dimension(NumSurfaces, WinShadingType::ShadeOff); + state.dataSurface->SurfWinExtIntShadePrevTS.dimension(NumSurfaces, DataSurfaces::WinShadingType::ShadeOff); state.dataSurface->SurfWinHasShadeOrBlindLayer.dimension(NumSurfaces, 0); state.dataSurface->SurfWinSurfDayLightInit.dimension(NumSurfaces, 0); state.dataSurface->SurfWinDaylFacPoint.dimension(NumSurfaces, 0); @@ -231,7 +224,7 @@ namespace SurfaceGeometry { state.dataSurface->SurfWinMaxAirflow.dimension(NumSurfaces, 0); state.dataSurface->SurfWinAirflowControlType.dimension(NumSurfaces, DataSurfaces::WindowAirFlowControlType::Invalid); state.dataSurface->SurfWinAirflowHasSchedule.dimension(NumSurfaces, 0); - state.dataSurface->SurfWinAirflowSchedulePtr.dimension(NumSurfaces, 0); + state.dataSurface->SurfWinAirflowScheds.dimension(NumSurfaces, nullptr); state.dataSurface->SurfWinAirflowThisTS.dimension(NumSurfaces, 0); state.dataSurface->SurfWinTAirflowGapOutlet.dimension(NumSurfaces, 0); state.dataSurface->SurfWinWindowCalcIterationsRep.dimension(NumSurfaces, 0); @@ -246,7 +239,7 @@ namespace SurfaceGeometry { state.dataSurface->SurfWinDividerHeatLoss.dimension(NumSurfaces, 0); state.dataSurface->SurfWinTCLayerTemp.dimension(NumSurfaces, 0); state.dataSurface->SurfWinSpecTemp.dimension(NumSurfaces, 0); - state.dataSurface->SurfWinWindowModelType.dimension(NumSurfaces, WindowModel::Detailed); + state.dataSurface->SurfWinWindowModelType.dimension(NumSurfaces, DataSurfaces::WindowModel::Detailed); state.dataSurface->SurfWinTDDPipeNum.dimension(NumSurfaces, 0); state.dataSurface->SurfWinStormWinConstr.dimension(NumSurfaces, 0); state.dataSurface->SurfActiveConstruction.dimension(NumSurfaces, 0); @@ -267,32 +260,30 @@ namespace SurfaceGeometry { // RE-ENGINEERED November 1997 (RKS,LKL) // PURPOSE OF THIS SUBROUTINE: - // This subroutine controls the processing of detached shadowing and - // zone surfaces for computing their vertices. + // This subroutine controls the processing of detached shadowing and zone surfaces for computing their vertices. static constexpr std::string_view RoutineName("SetUpZoneGeometry: "); // Zones must have been "gotten" before this call - // The RelNorth variables are used if "relative" coordinates are input as well - // as setting up DaylightingCoords + // The RelNorth variables are used if "relative" coordinates are input as well as setting up DaylightingCoords // these include building north axis and Building Rotation for Appendix G state.dataSurfaceGeometry->CosBldgRelNorth = - std::cos(-(state.dataHeatBal->BuildingAzimuth + state.dataHeatBal->BuildingRotationAppendixG) * Constant::DegToRadians); + std::cos(-(state.dataHeatBal->BuildingAzimuth + state.dataHeatBal->BuildingRotationAppendixG) * Constant::DegToRad); state.dataSurfaceGeometry->SinBldgRelNorth = - std::sin(-(state.dataHeatBal->BuildingAzimuth + state.dataHeatBal->BuildingRotationAppendixG) * Constant::DegToRadians); + std::sin(-(state.dataHeatBal->BuildingAzimuth + state.dataHeatBal->BuildingRotationAppendixG) * Constant::DegToRad); // these are only for Building Rotation for Appendix G when using world coordinate system - state.dataSurfaceGeometry->CosBldgRotAppGonly = std::cos(-state.dataHeatBal->BuildingRotationAppendixG * Constant::DegToRadians); - state.dataSurfaceGeometry->SinBldgRotAppGonly = std::sin(-state.dataHeatBal->BuildingRotationAppendixG * Constant::DegToRadians); + state.dataSurfaceGeometry->CosBldgRotAppGonly = std::cos(-state.dataHeatBal->BuildingRotationAppendixG * Constant::DegToRad); + state.dataSurfaceGeometry->SinBldgRotAppGonly = std::sin(-state.dataHeatBal->BuildingRotationAppendixG * Constant::DegToRad); state.dataSurfaceGeometry->CosZoneRelNorth.allocate(state.dataGlobal->NumOfZones); state.dataSurfaceGeometry->SinZoneRelNorth.allocate(state.dataGlobal->NumOfZones); for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { - state.dataSurfaceGeometry->CosZoneRelNorth(ZoneNum) = std::cos(-state.dataHeatBal->Zone(ZoneNum).RelNorth * Constant::DegToRadians); - state.dataSurfaceGeometry->SinZoneRelNorth(ZoneNum) = std::sin(-state.dataHeatBal->Zone(ZoneNum).RelNorth * Constant::DegToRadians); + state.dataSurfaceGeometry->CosZoneRelNorth(ZoneNum) = std::cos(-state.dataHeatBal->Zone(ZoneNum).RelNorth * Constant::DegToRad); + state.dataSurfaceGeometry->SinZoneRelNorth(ZoneNum) = std::sin(-state.dataHeatBal->Zone(ZoneNum).RelNorth * Constant::DegToRad); } GetSurfaceData(state, ErrorsFound); @@ -310,7 +301,7 @@ namespace SurfaceGeometry { if (!ErrorsFound && state.dataSurface->TotStormWin > 0) CreateStormWindowConstructions(state); - SetFlagForWindowConstructionWithShadeOrBlindLayer(state); + DataHeatBalance::SetFlagForWindowConstructionWithShadeOrBlindLayer(state); state.dataSurfaceGeometry->CosZoneRelNorth.deallocate(); state.dataSurfaceGeometry->SinZoneRelNorth.deallocate(); @@ -386,7 +377,8 @@ namespace SurfaceGeometry { thisZone.TotalSurfArea += state.dataSurface->SurfWinFrameArea(SurfNum); thisZone.HasWindow = true; thisSpace.totalSurfArea += state.dataSurface->SurfWinFrameArea(SurfNum); - if (((thisSurface.ExtBoundCond == ExternalEnvironment) || (thisSurface.ExtBoundCond == OtherSideCondModeledExt)) && + if (((thisSurface.ExtBoundCond == DataSurfaces::ExternalEnvironment) || + (thisSurface.ExtBoundCond == DataSurfaces::OtherSideCondModeledExt)) && (thisSurface.Class != SurfaceClass::TDD_Dome)) { thisZone.ExtWindowArea += thisSurface.GrossArea; thisSpace.extWindowArea += thisSurface.GrossArea; @@ -401,7 +393,8 @@ namespace SurfaceGeometry { } } } else { - if (thisSurface.ExtBoundCond == ExternalEnvironment || thisSurface.ExtBoundCond == OtherSideCondModeledExt) { + if (thisSurface.ExtBoundCond == DataSurfaces::ExternalEnvironment || + thisSurface.ExtBoundCond == DataSurfaces::OtherSideCondModeledExt) { thisZone.ExteriorTotalSurfArea += thisSurface.GrossArea; thisSpace.ExteriorTotalSurfArea += thisSurface.GrossArea; if (thisSurface.Class == SurfaceClass::Wall) { @@ -419,8 +412,8 @@ namespace SurfaceGeometry { thisSurface.Tilt); } } - } else if (thisSurface.ExtBoundCond == Ground || thisSurface.ExtBoundCond == GroundFCfactorMethod || - thisSurface.ExtBoundCond == KivaFoundation) { + } else if (thisSurface.ExtBoundCond == DataSurfaces::Ground || thisSurface.ExtBoundCond == DataSurfaces::GroundFCfactorMethod || + thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) { thisZone.ExteriorTotalGroundSurfArea += thisSurface.GrossArea; if (thisSurface.Class == SurfaceClass::Wall) { thisZone.ExtGrossGroundWallArea += thisSurface.GrossArea; @@ -456,7 +449,7 @@ namespace SurfaceGeometry { print(state.files.debug, "{},{:.2R},{:.2R}\n", thisZone.Name, thisZone.ExtGrossWallArea, thisZone.ExtWindowArea); } for (int spaceNum : thisZone.spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); + auto const &thisSpace = state.dataHeatBal->space(spaceNum); // Use AllSurfaceFirst which includes air boundaries for (int SurfNum = thisSpace.AllSurfaceFirst; SurfNum <= thisSpace.AllSurfaceLast; ++SurfNum) { auto &thisSurface = state.dataSurface->Surface(SurfNum); @@ -551,7 +544,7 @@ namespace SurfaceGeometry { thisZone.MaximumZ = state.dataSurface->Surface(thisZone.AllSurfaceFirst).Vertex(1).z; } for (int spaceNum : thisZone.spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); + auto const &thisSpace = state.dataHeatBal->space(spaceNum); for (int SurfNum = thisSpace.AllSurfaceFirst; SurfNum <= thisSpace.AllSurfaceLast; ++SurfNum) { auto &thisSurface = state.dataSurface->Surface(SurfNum); @@ -597,7 +590,7 @@ namespace SurfaceGeometry { for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - auto &thisSurface = state.dataSurface->Surface(SurfNum); + auto const &thisSurface = state.dataSurface->Surface(SurfNum); if (!thisSurface.HeatTransSurf && thisSurface.ZoneName == state.dataHeatBal->Zone(ZoneNum).Name) ++state.dataHeatBal->Zone(ZoneNum).NumShadingSurfaces; @@ -616,34 +609,18 @@ namespace SurfaceGeometry { } // zones for (int const SurfNum : state.dataSurface->AllSurfaceListReportOrder) { - auto &thisSurface = state.dataSurface->Surface(SurfNum); - bool isWithConvCoefValid = false; + auto const &thisSurface = state.dataSurface->Surface(SurfNum); Real64 NominalUwithConvCoeffs = 0.0; - std::string cNominalUwithConvCoeffs; - std::string cNominalU; if (thisSurface.Construction > 0 && thisSurface.Construction <= state.dataHeatBal->TotConstructs) { - NominalUwithConvCoeffs = ComputeNominalUwithConvCoeffs(state, SurfNum, isWithConvCoefValid); - if (isWithConvCoefValid) { - cNominalUwithConvCoeffs = format("{:.3R}", NominalUwithConvCoeffs); - } else { - cNominalUwithConvCoeffs = "[invalid]"; - } - if ((thisSurface.Class == SurfaceClass::Window) || (thisSurface.Class == SurfaceClass::TDD_Dome)) { - // SurfaceClass::Window also covers glass doors and TDD:Diffusers - cNominalU = "N/A"; - } else { - cNominalU = format("{:.3R}", state.dataHeatBal->NominalU(thisSurface.Construction)); - } - } else { - cNominalUwithConvCoeffs = "**"; - cNominalU = "**"; + bool isWithConvCoefValid = false; + NominalUwithConvCoeffs = DataHeatBalance::ComputeNominalUwithConvCoeffs(state, SurfNum, isWithConvCoefValid); } // populate the predefined report related to u-values with films // only exterior surfaces including underground DataSurfaces::SurfaceClass const SurfaceClass(thisSurface.Class); - if ((thisSurface.ExtBoundCond == ExternalEnvironment) || (thisSurface.ExtBoundCond == Ground) || - (thisSurface.ExtBoundCond == KivaFoundation) || (thisSurface.ExtBoundCond == GroundFCfactorMethod)) { + if ((thisSurface.ExtBoundCond == DataSurfaces::ExternalEnvironment) || (thisSurface.ExtBoundCond == DataSurfaces::Ground) || + (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) || (thisSurface.ExtBoundCond == DataSurfaces::GroundFCfactorMethod)) { if ((SurfaceClass == SurfaceClass::Wall) || (SurfaceClass == SurfaceClass::Floor) || (SurfaceClass == SurfaceClass::Roof)) { OutputReportPredefined::PreDefTableEntry( state, state.dataOutRptPredefined->pdchOpUfactFilm, thisSurface.Name, NominalUwithConvCoeffs, 3); @@ -680,7 +657,7 @@ namespace SurfaceGeometry { state.dataGlobal->NumOfZones, state.dataSurface->TotSurfaces - state.dataSurface->FixedShadingCount - state.dataSurface->BuildingShadingCount - state.dataSurface->AttachedShadingCount, - sum(state.dataHeatBal->Zone, &ZoneData::NumSubSurfaces)); + sum(state.dataHeatBal->Zone, &DataHeatBalance::ZoneData::NumSubSurfaces)); // Write Zone Information header to the initialization output file static constexpr std::string_view Format_721( @@ -790,8 +767,8 @@ namespace SurfaceGeometry { SetupEnclosuresAndAirBoundaries(state, state.dataViewFactor->EnclSolInfo, SurfaceGeometry::enclosureType::SolarEnclosures, ErrorsFound); // Do the Stratosphere check - SetZoneOutBulbTempAt(state); - CheckZoneOutBulbTempAt(state); + DataHeatBalance::SetZoneOutBulbTempAt(state); + DataHeatBalance::CheckZoneOutBulbTempAt(state); } void AllocateSurfaceArrays(EnergyPlusData &state) @@ -800,33 +777,13 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR Rick Strand // DATE WRITTEN February 1998 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // This subroutine allocates all of the arrays at the module level which - // require allocation. + // This subroutine allocates all of the arrays at the module level which require allocation. // METHODOLOGY EMPLOYED: // Allocation is dependent on the user input file. - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // na state.dataSurface->ShadeV.allocate(state.dataSurface->TotSurfaces); for (auto &e : state.dataSurface->ShadeV) e.NVert = 0; @@ -894,20 +851,12 @@ namespace SurfaceGeometry { state.dataSurface->SurfShadowDiffuseVisRefl.allocate(state.dataSurface->TotSurfaces); state.dataSurface->SurfShadowGlazingFrac.allocate(state.dataSurface->TotSurfaces); state.dataSurface->SurfShadowGlazingConstruct.allocate(state.dataSurface->TotSurfaces); - state.dataSurface->SurfMaterialMovInsulExt.allocate(state.dataSurface->TotSurfaces); - state.dataSurface->SurfMaterialMovInsulInt.allocate(state.dataSurface->TotSurfaces); - state.dataSurface->SurfSchedMovInsulExt.allocate(state.dataSurface->TotSurfaces); - state.dataSurface->SurfSchedMovInsulInt.allocate(state.dataSurface->TotSurfaces); for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { state.dataSurface->SurfShadowRecSurfNum(SurfNum) = 0; state.dataSurface->SurfShadowDiffuseSolRefl(SurfNum) = 0.0; state.dataSurface->SurfShadowDiffuseVisRefl(SurfNum) = 0.0; state.dataSurface->SurfShadowGlazingFrac(SurfNum) = 0.0; state.dataSurface->SurfShadowGlazingConstruct(SurfNum) = 0; - state.dataSurface->SurfMaterialMovInsulExt(SurfNum) = 0; - state.dataSurface->SurfMaterialMovInsulInt(SurfNum) = 0; - state.dataSurface->SurfSchedMovInsulExt(SurfNum) = 0; - state.dataSurface->SurfSchedMovInsulInt(SurfNum) = 0; } state.dataSurface->SurfExtEcoRoof.allocate(state.dataSurface->TotSurfaces); state.dataSurface->SurfExtCavityPresent.allocate(state.dataSurface->TotSurfaces); @@ -938,11 +887,14 @@ namespace SurfaceGeometry { for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { state.dataSurface->SurfLowTempErrCount(SurfNum) = 0; state.dataSurface->SurfHighTempErrCount(SurfNum) = 0; - state.dataSurface->surfIntConv(SurfNum) = SurfIntConv(); - state.dataSurface->surfExtConv(SurfNum) = SurfExtConv(); + state.dataSurface->surfIntConv(SurfNum) = DataSurfaces::SurfIntConv(); + state.dataSurface->surfExtConv(SurfNum) = DataSurfaces::SurfExtConv(); state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::Invalid; state.dataSurface->SurfTAirRefRpt(SurfNum) = static_cast(DataSurfaces::RefAirTemp::Invalid); } + + state.dataSurface->intMovInsuls.allocate(state.dataSurface->TotSurfaces); + state.dataSurface->extMovInsuls.allocate(state.dataSurface->TotSurfaces); } void GetSurfaceData(EnergyPlusData &state, bool &ErrorsFound) // If errors found in input @@ -1039,76 +991,33 @@ namespace SurfaceGeometry { // Surface%Vertex(1:) using namespace Vectors; - using ScheduleManager::GetScheduleMaxValue; - using ScheduleManager::GetScheduleMinValue; using namespace DataErrorTracking; static constexpr std::string_view RoutineName("GetSurfaceData: "); - int ConstrNum; // Construction number - int Found; // For matching interzone surfaces - int ConstrNumFound; // Construction number of matching interzone surface - bool NonMatch(false); // Error for non-matching interzone surfaces - int MovedSurfs; // Number of Moved Surfaces (when sorting into hierarchical structure) - bool SurfError(false); // General Surface Error, causes fatal error at end of routine - int TotLay; // Total layers in a construction - int TotLayFound; // Total layers in the construction of a matching interzone surface - int TotDetachedFixed; // Total Shading:Site:Detailed entries - int TotDetachedBldg; // Total Shading:Building:Detailed entries - int TotRectDetachedFixed; // Total Shading:Site entries - int TotRectDetachedBldg; // Total Shading:Building entries - int TotHTSurfs; // Number of BuildingSurface:Detailed items to obtain - int TotDetailedWalls; // Number of Wall:Detailed items to obtain - int TotDetailedRoofs; // Number of RoofCeiling:Detailed items to obtain - int TotDetailedFloors; // Number of Floor:Detailed items to obtain - int TotHTSubs; // Number of FenestrationSurface:Detailed items to obtain - int TotShdSubs; // Number of Shading:Zone:Detailed items to obtain - int TotIntMassSurfaces; // Number of InternalMass surfaces to obtain + int ConstrNum; // Construction number + int Found; // For matching interzone surfaces + int ConstrNumFound; // Construction number of matching interzone surface + bool NonMatch(false); // Error for non-matching interzone surfaces + int MovedSurfs; // Number of Moved Surfaces (when sorting into hierarchical structure) + bool SurfError(false); // General Surface Error, causes fatal error at end of routine + int TotLay; // Total layers in a construction + int TotLayFound; // Total layers in the construction of a matching interzone surface // Simple Surfaces (Rectangular) - int TotRectExtWalls; // Number of Exterior Walls to obtain - int TotRectIntWalls; // Number of Adiabatic Walls to obtain - int TotRectIZWalls; // Number of Interzone Walls to obtain - int TotRectUGWalls; // Number of Underground to obtain - int TotRectRoofs; // Number of Roofs to obtain - int TotRectCeilings; // Number of Adiabatic Ceilings to obtain - int TotRectIZCeilings; // Number of Interzone Ceilings to obtain - int TotRectGCFloors; // Number of Floors with Ground Contact to obtain - int TotRectIntFloors; // Number of Adiabatic Walls to obtain - int TotRectIZFloors; // Number of Interzone Floors to obtain - int TotRectWindows; - int TotRectDoors; - int TotRectGlazedDoors; - int TotRectIZWindows; - int TotRectIZDoors; - int TotRectIZGlazedDoors; - int TotOverhangs; - int TotOverhangsProjection; - int TotFins; - int TotFinsProjection; - bool RelWarning(false); - int ConstrNumSh; // Shaded construction number for a window - int LayNumOutside; // Outside material numbers for a shaded construction - int AddedSubSurfaces; // Subsurfaces (windows) added when windows reference Window5 Data File + int LayNumOutside; // Outside material numbers for a shaded construction // entries with two glazing systems int NeedToAddSurfaces; // Surfaces that will be added due to "unentered" other zone surface int NeedToAddSubSurfaces; // SubSurfaces that will be added due to "unentered" other zone surface - int CurNewSurf; - int FirstTotalSurfaces; - int NVert; - int Vert; - int n; + int CurNewSurf = 0; Real64 SurfWorldAz; Real64 SurfTilt; int MultFound; int MultSurfNum; - std::string MultString; bool SubSurfaceSevereDisplayed; bool subSurfaceError(false); bool errFlag; - int iTmp1; - int ErrCount; bool izConstDiff; // differences in construction for IZ surfaces bool izConstDiffMsg; // display message about hb diffs only once. @@ -1123,6 +1032,7 @@ namespace SurfaceGeometry { GetGeometryParameters(state, ErrorsFound); if (state.dataSurface->WorldCoordSystem) { + bool RelWarning = false; if (state.dataHeatBal->BuildingAzimuth != 0.0) RelWarning = true; for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { if (state.dataHeatBal->Zone(ZoneNum).RelNorth != 0.0) RelWarning = true; @@ -1153,40 +1063,40 @@ namespace SurfaceGeometry { } } - TotDetachedFixed = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Shading:Site:Detailed"); - TotDetachedBldg = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Shading:Building:Detailed"); - TotRectDetachedFixed = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Shading:Site"); - TotRectDetachedBldg = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Shading:Building"); - TotHTSurfs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "BuildingSurface:Detailed"); - TotDetailedWalls = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Wall:Detailed"); - TotDetailedRoofs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "RoofCeiling:Detailed"); - TotDetailedFloors = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Floor:Detailed"); - TotHTSubs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "FenestrationSurface:Detailed"); - TotShdSubs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Shading:Zone:Detailed"); - TotOverhangs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Shading:Overhang"); - TotOverhangsProjection = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Shading:Overhang:Projection"); - TotFins = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Shading:Fin"); - TotFinsProjection = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Shading:Fin:Projection"); - TotRectWindows = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Window"); - TotRectDoors = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Door"); - TotRectGlazedDoors = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "GlazedDoor"); - TotRectIZWindows = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Window:Interzone"); - TotRectIZDoors = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Door:Interzone"); - TotRectIZGlazedDoors = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "GlazedDoor:Interzone"); - TotRectExtWalls = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Wall:Exterior"); - TotRectIntWalls = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Wall:Adiabatic"); - TotRectIZWalls = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Wall:Interzone"); - TotRectUGWalls = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Wall:Underground"); - TotRectRoofs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Roof"); - TotRectCeilings = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Ceiling:Adiabatic"); - TotRectIZCeilings = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Ceiling:Interzone"); - TotRectGCFloors = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Floor:GroundContact"); - TotRectIntFloors = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Floor:Adiabatic"); - TotRectIZFloors = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Floor:Interzone"); + int TotDetachedFixed = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Shading:Site:Detailed"); + int TotDetachedBldg = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Shading:Building:Detailed"); + int TotRectDetachedFixed = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Shading:Site"); + int TotRectDetachedBldg = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Shading:Building"); + int TotHTSurfs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "BuildingSurface:Detailed"); + int TotDetailedWalls = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Wall:Detailed"); + int TotDetailedRoofs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "RoofCeiling:Detailed"); + int TotDetailedFloors = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Floor:Detailed"); + int TotHTSubs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "FenestrationSurface:Detailed"); + int TotShdSubs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Shading:Zone:Detailed"); + int TotOverhangs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Shading:Overhang"); + int TotOverhangsProjection = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Shading:Overhang:Projection"); + int TotFins = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Shading:Fin"); + int TotFinsProjection = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Shading:Fin:Projection"); + int TotRectWindows = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Window"); + int TotRectDoors = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Door"); + int TotRectGlazedDoors = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "GlazedDoor"); + int TotRectIZWindows = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Window:Interzone"); + int TotRectIZDoors = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Door:Interzone"); + int TotRectIZGlazedDoors = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "GlazedDoor:Interzone"); + int TotRectExtWalls = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Wall:Exterior"); + int TotRectIntWalls = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Wall:Adiabatic"); + int TotRectIZWalls = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Wall:Interzone"); + int TotRectUGWalls = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Wall:Underground"); + int TotRectRoofs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Roof"); + int TotRectCeilings = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Ceiling:Adiabatic"); + int TotRectIZCeilings = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Ceiling:Interzone"); + int TotRectGCFloors = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Floor:GroundContact"); + int TotRectIntFloors = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Floor:Adiabatic"); + int TotRectIZFloors = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Floor:Interzone"); state.dataSurface->TotOSC = 0; - TotIntMassSurfaces = GetNumIntMassSurfaces(state); + int TotIntMassSurfaces = GetNumIntMassSurfaces(state); state.dataSurface->TotSurfaces = (TotDetachedFixed + TotDetachedBldg + TotRectDetachedFixed + TotRectDetachedBldg) * 2 + TotHTSurfs + TotHTSubs + TotShdSubs * 2 + TotIntMassSurfaces + TotOverhangs * 2 + TotOverhangsProjection * 2 + @@ -1200,7 +1110,7 @@ namespace SurfaceGeometry { // SurfaceTmp structure is allocated via derived type initialization. int NumSurfs = 0; - AddedSubSurfaces = 0; + int AddedSubSurfaces = 0; state.dataErrTracking->AskForSurfacesReport = true; GetDetShdSurfaceData(state, ErrorsFound, NumSurfs, TotDetachedFixed, TotDetachedBldg); @@ -1275,69 +1185,70 @@ namespace SurfaceGeometry { AllocateSurfaceWindows(state, state.dataSurface->TotSurfaces); // Have to make room for added surfaces, if needed - FirstTotalSurfaces = NumSurfs + AddedSubSurfaces; + int FirstTotalSurfaces = NumSurfs + AddedSubSurfaces; if (NeedToAddSurfaces + NeedToAddSubSurfaces > 0) { state.dataSurfaceGeometry->SurfaceTmp.redimension(state.dataSurface->TotSurfaces); + CurNewSurf = FirstTotalSurfaces; } // add the "need to add" surfaces // Debug write(outputfiledebug,*) ' need to add ',NeedtoAddSurfaces+NeedToAddSubSurfaces - if (NeedToAddSurfaces + NeedToAddSubSurfaces > 0) CurNewSurf = FirstTotalSurfaces; for (int SurfNum = 1; SurfNum <= FirstTotalSurfaces; ++SurfNum) { - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond != UnenteredAdjacentZoneSurface) continue; + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); + if (surfTemp.ExtBoundCond != UnenteredAdjacentZoneSurface) continue; // Need to add surface ++CurNewSurf; // Debug write(outputfiledebug,*) ' adding surface=',curnewsurf state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf) = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); // Basic parameters are the same for both surfaces. - Found = Util::FindItemInList( - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName, state.dataHeatBal->Zone, state.dataGlobal->NumOfZones); + Found = Util::FindItemInList(surfTemp.ExtBoundCondName, state.dataHeatBal->Zone, state.dataGlobal->NumOfZones); if (Found == 0) continue; state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Zone = Found; state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).ZoneName = state.dataHeatBal->Zone(Found).Name; // Reverse Construction state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Construction = - AssignReverseConstructionNumber(state, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction, SurfError); + + DataHeatBalance::AssignReverseConstructionNumber(state, surfTemp.Construction, SurfError); state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).ConstructionStoredInputValue = state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Construction; // Reverse Vertices - NVert = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides; - for (Vert = 1; Vert <= state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides; ++Vert) { - state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Vertex(Vert) = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(NVert); + int NVert = surfTemp.Sides; + for (int Vert = 1; Vert <= surfTemp.Sides; ++Vert) { + state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Vertex(Vert) = surfTemp.Vertex(NVert); --NVert; } if (state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Sides > 2) { - CreateNewellAreaVector(state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Vertex, - state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Sides, - state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).NewellAreaVector); + Vectors::CreateNewellAreaVector(state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Vertex, + state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Sides, + state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).NewellAreaVector); state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).GrossArea = - VecLength(state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).NewellAreaVector); + Vectors::VecLength(state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).NewellAreaVector); state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Area = state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).GrossArea; state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).NetAreaShadowCalc = state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Area; - CreateNewellSurfaceNormalVector(state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Vertex, - state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Sides, - state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).NewellSurfaceNormalVector); - DetermineAzimuthAndTilt(state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Vertex, - SurfWorldAz, - SurfTilt, - state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).lcsx, - state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).lcsy, - state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).lcsz, - state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).NewellSurfaceNormalVector); + Vectors::CreateNewellSurfaceNormalVector(state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Vertex, + state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Sides, + state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).NewellSurfaceNormalVector); + Vectors::DetermineAzimuthAndTilt(state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Vertex, + SurfWorldAz, + SurfTilt, + state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).lcsx, + state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).lcsy, + state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).lcsz, + state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).NewellSurfaceNormalVector); state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Azimuth = SurfWorldAz; state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Tilt = SurfTilt; state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).convOrientation = Convect::GetSurfConvOrientation(state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Tilt); // Sine and cosine of azimuth and tilt - state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).SinAzim = std::sin(SurfWorldAz * Constant::DegToRadians); - state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).CosAzim = std::cos(SurfWorldAz * Constant::DegToRadians); - state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).SinTilt = std::sin(SurfTilt * Constant::DegToRadians); - state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).CosTilt = std::cos(SurfTilt * Constant::DegToRadians); + state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).SinAzim = std::sin(SurfWorldAz * Constant::DegToRad); + state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).CosAzim = std::cos(SurfWorldAz * Constant::DegToRad); + state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).SinTilt = std::sin(SurfTilt * Constant::DegToRad); + state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).CosTilt = std::cos(SurfTilt * Constant::DegToRad); // Outward normal unit vector (pointing away from room) state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).OutNormVec = state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).NewellSurfaceNormalVector; - for (n = 1; n <= 3; ++n) { + for (int n = 1; n <= 3; ++n) { if (std::abs(state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).OutNormVec(n) - 1.0) < 1.e-06) state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).OutNormVec(n) = +1.0; if (std::abs(state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).OutNormVec(n) + 1.0) < 1.e-06) @@ -1360,21 +1271,21 @@ namespace SurfaceGeometry { } // Change Name - state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Name = "iz-" + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name; + state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Name = "iz-" + surfTemp.Name; // Debug write(outputfiledebug,*) ' new surf name=',TRIM(SurfaceTmp(CurNewSurf)%Name) // Debug write(outputfiledebug,*) ' new surf in zone=',TRIM(surfacetmp(curnewsurf)%zoneName) state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).ExtBoundCond = UnreconciledZoneSurface; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = UnreconciledZoneSurface; - state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).ExtBoundCondName = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Name; + surfTemp.ExtBoundCond = UnreconciledZoneSurface; + state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).ExtBoundCondName = surfTemp.Name; + surfTemp.ExtBoundCondName = state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Name; if (state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Class == SurfaceClass::Roof || state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Class == SurfaceClass::Wall || state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Class == SurfaceClass::Floor) { // base surface - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Roof) { + if (surfTemp.Class == SurfaceClass::Roof) { state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Class = SurfaceClass::Floor; // Debug write(outputfiledebug,*) ' new surfaces is a floor' - } else if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Floor) { + } else if (surfTemp.Class == SurfaceClass::Floor) { state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Class = SurfaceClass::Roof; // Debug write(outputfiledebug,*) ' new surfaces is a roof' } @@ -1383,12 +1294,10 @@ namespace SurfaceGeometry { // Debug write(outputfiledebug,*) ' basesurf, extboundcondname=',TRIM(SurfaceTmp(CurNewSurf)%ExtBoundCondName) } else { // subsurface - Found = Util::FindItemInList("iz-" + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurfName, - state.dataSurfaceGeometry->SurfaceTmp, - FirstTotalSurfaces + CurNewSurf - 1); + Found = + Util::FindItemInList("iz-" + surfTemp.BaseSurfName, state.dataSurfaceGeometry->SurfaceTmp, FirstTotalSurfaces + CurNewSurf - 1); if (Found > 0) { - state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).BaseSurfName = - "iz-" + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurfName; + state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).BaseSurfName = "iz-" + surfTemp.BaseSurfName; state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).BaseSurf = Found; state.dataSurfaceGeometry->SurfaceTmp(Found).Area -= state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Area; if (state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Class == SurfaceClass::Window || @@ -1399,7 +1308,7 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->SurfaceTmp(Found).NetAreaShadowCalc -= state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Area; } state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).ExtBoundCond = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtBoundCond; - state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).ExtBoundCondName = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name; + state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).ExtBoundCondName = surfTemp.Name; state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).ExtSolar = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtSolar; state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).ExtWind = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtWind; state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf).Zone = state.dataSurfaceGeometry->SurfaceTmp(Found).Zone; @@ -1409,9 +1318,7 @@ namespace SurfaceGeometry { // Debug write(outputfiledebug,*) ' subsurf, basesurf=',TRIM('iz-'//SurfaceTmp(SurfNum)%BaseSurfName) } else { ShowSevereError(state, - format("{}Adding unentered subsurface, could not find base surface=iz-{}", - RoutineName, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurfName)); + format("{}Adding unentered subsurface, could not find base surface=iz-{}", RoutineName, surfTemp.BaseSurfName)); SurfError = true; } } @@ -1421,34 +1328,28 @@ namespace SurfaceGeometry { // sub-surfaces can be defined. Loop through surfaces and match with the sub-surface // names. for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - if (!state.dataSurfaceGeometry->SurfaceTmp(SurfNum).HeatTransSurf) continue; + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); + if (!surfTemp.HeatTransSurf) continue; // why are we doing this again? this should have already been done. - if (Util::SameString(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurfName, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)) { + if (Util::SameString(surfTemp.BaseSurfName, surfTemp.Name)) { Found = SurfNum; } else { - Found = Util::FindItemInList(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurfName, - state.dataSurfaceGeometry->SurfaceTmp, - state.dataSurface->TotSurfaces); + Found = Util::FindItemInList(surfTemp.BaseSurfName, state.dataSurfaceGeometry->SurfaceTmp, state.dataSurface->TotSurfaces); } if (Found > 0) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf = Found; + surfTemp.BaseSurf = Found; if (SurfNum != Found) { // for subsurfaces - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).HeatTransSurf) ++state.dataSurfaceGeometry->SurfaceTmp(Found).NumSubSurfaces; - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class < SurfaceClass::Window || - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class > SurfaceClass::TDD_Diffuser) { - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::None) { + if (surfTemp.HeatTransSurf) ++state.dataSurfaceGeometry->SurfaceTmp(Found).NumSubSurfaces; + if (surfTemp.Class < SurfaceClass::Window || surfTemp.Class > SurfaceClass::TDD_Diffuser) { + if (surfTemp.Class == SurfaceClass::None) { + ShowSevereError(state, format("{}Invalid SubSurface detected, Surface={}", RoutineName, surfTemp.Name)); + } else { ShowSevereError(state, - format("{}Invalid SubSurface detected, Surface={}", + format("{}Invalid SubSurface detected, Surface={}, class={} invalid class for subsurface", RoutineName, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); - } else { - ShowSevereError( - state, - format("{}Invalid SubSurface detected, Surface={}, class={} invalid class for subsurface", - RoutineName, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataSurfaceGeometry->BaseSurfCls(int(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class)))); + surfTemp.Name, + state.dataSurfaceGeometry->BaseSurfCls(int(surfTemp.Class)))); SurfError = true; } } @@ -1503,9 +1404,8 @@ namespace SurfaceGeometry { // Move all shading Surfaces to Front for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class != SurfaceClass::Detached_F && - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class != SurfaceClass::Detached_B && - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class != SurfaceClass::Shading) + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); + if (surfTemp.Class != SurfaceClass::Detached_F && surfTemp.Class != SurfaceClass::Detached_B && surfTemp.Class != SurfaceClass::Shading) continue; // A shading surface @@ -1523,20 +1423,21 @@ namespace SurfaceGeometry { for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { // Group air boundary surfaces first within each space for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); if (SurfaceTmpClassMoved(SurfNum)) continue; - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).spaceNum != spaceNum) continue; - int constNum = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction; + if (surfTemp.spaceNum != spaceNum) continue; + int constNum = surfTemp.Construction; if (constNum == 0) continue; if (!state.dataConstruction->Construct(constNum).TypeIsAirBoundary) continue; // An air boundary surface - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).IsAirBoundarySurf = true; + surfTemp.IsAirBoundarySurf = true; ++MovedSurfs; state.dataSurface->Surface(MovedSurfs) = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); // If base Surface Type (Wall, Floor, Roof/Ceiling) - if ((state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == state.dataSurfaceGeometry->BaseSurfIDs(1)) || - (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == state.dataSurfaceGeometry->BaseSurfIDs(2)) || - (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == state.dataSurfaceGeometry->BaseSurfIDs(3))) { + if ((surfTemp.Class == state.dataSurfaceGeometry->BaseSurfIDs(1)) || + (surfTemp.Class == state.dataSurfaceGeometry->BaseSurfIDs(2)) || + (surfTemp.Class == state.dataSurfaceGeometry->BaseSurfIDs(3))) { // Store list of moved surface numbers in reporting order. We use the old position, we'll reconcile later // We don't do it for Air Door/Air Windows yet, we want them listed below each base surf they belong to state.dataSurface->AllSurfaceListReportOrder.push_back(SurfNum); @@ -1550,12 +1451,13 @@ namespace SurfaceGeometry { for (const DataSurfaces::SurfaceClass Loop : state.dataSurfaceGeometry->BaseSurfIDs) { for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); if (SurfaceTmpClassMoved(SurfNum)) continue; - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone == 0) continue; + if (surfTemp.Zone == 0) continue; - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).spaceNum != spaceNum) continue; - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class != Loop) continue; + if (surfTemp.spaceNum != spaceNum) continue; + if (surfTemp.Class != Loop) continue; ++MovedSurfs; state.dataSurface->Surface(MovedSurfs) = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); @@ -1579,10 +1481,11 @@ namespace SurfaceGeometry { // Internal mass goes next for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - if (SurfaceTmpClassMoved(SurfNum)) continue; - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).spaceNum != spaceNum) continue; - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class != SurfaceClass::IntMass) continue; + + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); + if (surfTemp.spaceNum != spaceNum) continue; + if (surfTemp.Class != SurfaceClass::IntMass) continue; ++MovedSurfs; state.dataSurface->Surface(MovedSurfs) = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); oldToNewSurfNums(SurfNum) = MovedSurfs; @@ -1786,7 +1689,7 @@ namespace SurfaceGeometry { ++state.dataSurfaceGeometry->ErrCount2; if (state.dataSurfaceGeometry->ErrCount2 == 1 && !state.dataGlobal->DisplayExtraWarnings) { ShowWarningError(state, - format("{}CAUTION -- Interspace surfaces are occuring in the same space(s).", RoutineName)); + format("{}CAUTION -- Interspace surfaces are occurring in the same space(s).", RoutineName)); ShowContinueError( state, "...use Output:Diagnostics,DisplayExtraWarnings; to show more details on individual occurrences."); } @@ -1804,8 +1707,8 @@ namespace SurfaceGeometry { state.dataSurface->Surface(Found).ZoneName)); } } - ConstrNum = state.dataSurface->Surface(SurfNum).Construction; - ConstrNumFound = state.dataSurface->Surface(Found).Construction; + int ConstrNum = state.dataSurface->Surface(SurfNum).Construction; + int ConstrNumFound = state.dataSurface->Surface(Found).Construction; if (ConstrNum <= 0 || ConstrNumFound <= 0) continue; if (state.dataConstruction->Construct(ConstrNum).ReverseConstructionNumLayersWarning && state.dataConstruction->Construct(ConstrNumFound).ReverseConstructionNumLayersWarning) @@ -2159,7 +2062,8 @@ namespace SurfaceGeometry { RoutineName, state.dataSurface->Surface(SurfNum).Name, state.dataSurface->Surface(state.dataSurface->Surface(SurfNum).BaseSurf).Name, - cExtBoundCondition(state.dataSurface->Surface(state.dataSurface->Surface(SurfNum).BaseSurf).ExtBoundCond))); + DataSurfaces::cExtBoundCondition( + state.dataSurface->Surface(state.dataSurface->Surface(SurfNum).BaseSurf).ExtBoundCond))); SurfError = true; } else if (state.dataSurface->Surface(SurfNum).ExtBoundCond > 0) { ShowSevereError( @@ -2168,27 +2072,29 @@ namespace SurfaceGeometry { RoutineName, state.dataSurface->Surface(SurfNum).Name, state.dataSurface->Surface(state.dataSurface->Surface(SurfNum).BaseSurf).Name, - cExtBoundCondition(state.dataSurface->Surface(state.dataSurface->Surface(SurfNum).BaseSurf).ExtBoundCond))); + DataSurfaces::cExtBoundCondition( + state.dataSurface->Surface(state.dataSurface->Surface(SurfNum).BaseSurf).ExtBoundCond))); SurfError = true; - } else if (state.dataSurface->Surface(state.dataSurface->Surface(SurfNum).BaseSurf).ExtBoundCond == OtherSideCondModeledExt) { - ShowWarningError( - state, - format("{}Subsurface=\"{}\" exterior condition [{}] in a base surface=\"{}\" with exterior condition [{}]", - RoutineName, - state.dataSurface->Surface(SurfNum).Name, - cExtBoundCondition(state.dataSurface->Surface(SurfNum).ExtBoundCond), - state.dataSurface->Surface(state.dataSurface->Surface(SurfNum).BaseSurf).Name, - cExtBoundCondition(state.dataSurface->Surface(state.dataSurface->Surface(SurfNum).BaseSurf).ExtBoundCond))); + } else if (state.dataSurface->Surface(state.dataSurface->Surface(SurfNum).BaseSurf).ExtBoundCond == + DataSurfaces::OtherSideCondModeledExt) { + ShowWarningError(state, + format("{}Subsurface=\"{}\" exterior condition [{}] in a base surface=\"{}\" with exterior condition [{}]", + RoutineName, + state.dataSurface->Surface(SurfNum).Name, + DataSurfaces::cExtBoundCondition(state.dataSurface->Surface(SurfNum).ExtBoundCond), + state.dataSurface->Surface(state.dataSurface->Surface(SurfNum).BaseSurf).Name, + DataSurfaces::cExtBoundCondition( + state.dataSurface->Surface(state.dataSurface->Surface(SurfNum).BaseSurf).ExtBoundCond))); ShowContinueError(state, "...SubSurface will not use the exterior condition model of the base surface."); } else { - ShowSevereError( - state, - format("{}Subsurface=\"{}\" exterior condition [{}] in a base surface=\"{}\" with exterior condition [{}]", - RoutineName, - state.dataSurface->Surface(SurfNum).Name, - cExtBoundCondition(state.dataSurface->Surface(SurfNum).ExtBoundCond), - state.dataSurface->Surface(state.dataSurface->Surface(SurfNum).BaseSurf).Name, - cExtBoundCondition(state.dataSurface->Surface(state.dataSurface->Surface(SurfNum).BaseSurf).ExtBoundCond))); + ShowSevereError(state, + format("{}Subsurface=\"{}\" exterior condition [{}] in a base surface=\"{}\" with exterior condition [{}]", + RoutineName, + state.dataSurface->Surface(SurfNum).Name, + DataSurfaces::cExtBoundCondition(state.dataSurface->Surface(SurfNum).ExtBoundCond), + state.dataSurface->Surface(state.dataSurface->Surface(SurfNum).BaseSurf).Name, + DataSurfaces::cExtBoundCondition( + state.dataSurface->Surface(state.dataSurface->Surface(SurfNum).BaseSurf).ExtBoundCond))); SurfError = true; } if (!SubSurfaceSevereDisplayed && SurfError) { @@ -2213,7 +2119,7 @@ namespace SurfaceGeometry { format("{}Subsurface=\"{}\" exterior condition [{}] in a base surface=\"{}\" with exterior condition [adiabatic surface]", RoutineName, state.dataSurface->Surface(SurfNum).Name, - cExtBoundCondition(state.dataSurface->Surface(SurfNum).ExtBoundCond), + DataSurfaces::cExtBoundCondition(state.dataSurface->Surface(SurfNum).ExtBoundCond), state.dataSurface->Surface(state.dataSurface->Surface(SurfNum).BaseSurf).Name)); } if (!SubSurfaceSevereDisplayed) { @@ -2244,12 +2150,12 @@ namespace SurfaceGeometry { Real64 constexpr floorAreaTolerance(0.05); Real64 constexpr floorAreaPercentTolerance(floorAreaTolerance * 100.0); if (!SurfError) { - ErrCount = 0; + int ErrCount = 0; for (auto &thisSpace : state.dataHeatBal->space) { auto &thisZone = state.dataHeatBal->Zone(thisSpace.zoneNum); Real64 calcFloorArea = 0.0; // Calculated floor area used for this space for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { - auto &thisSurf = state.dataSurface->Surface(SurfNum); + auto const &thisSurf = state.dataSurface->Surface(SurfNum); if (thisSurf.Class == SurfaceClass::Floor) { thisZone.HasFloor = true; thisSpace.hasFloor = true; @@ -2430,7 +2336,7 @@ namespace SurfaceGeometry { auto &surf = state.dataSurface->Surface(SurfNum); if (!surf.HasShadeControl) continue; - ConstrNumSh = surf.activeShadedConstruction; + int ConstrNumSh = surf.activeShadedConstruction; if (ConstrNumSh <= 0) continue; auto &winShadeCtrl = state.dataSurface->WindowShadingControl(surf.activeWindowShadingControl); @@ -2458,7 +2364,7 @@ namespace SurfaceGeometry { ShowContinueError(state, format("WindowShadingControl {} has errors, program will terminate.", winShadeCtrl.Name)); } - if (winShadeCtrl.slatAngleControl != SlatAngleControl::Fixed) { + if (winShadeCtrl.slatAngleControl != DataSurfaces::SlatAngleControl::Fixed) { surfShade.blind.movableSlats = true; state.dataSurface->AnyMovableSlat = true; state.dataHeatBalSurf->SurfMovSlatsIndexList.push_back(SurfNum); @@ -2478,10 +2384,10 @@ namespace SurfaceGeometry { int priorBaseSurfNum = 0; for (int spaceNum : thisZone.spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); + auto const &thisSpace = state.dataHeatBal->space(spaceNum); if (thisSpace.HTSurfaceFirst == 0) continue; // Zone with no surfaces for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { - auto &thisSurf = state.dataSurface->Surface(SurfNum); + auto const &thisSurf = state.dataSurface->Surface(SurfNum); if (thisSurf.Class == SurfaceClass::Floor || thisSurf.Class == SurfaceClass::Wall || thisSurf.Class == SurfaceClass::Roof) ++OpaqueHTSurfs; if (thisSurf.Class == SurfaceClass::IntMass) ++InternalMassSurfs; @@ -2594,14 +2500,14 @@ namespace SurfaceGeometry { // Exclude non-exterior heat transfer surfaces (but not OtherSideCondModeledExt = -4 CR7640) if (surf.HeatTransSurf && surf.ExtBoundCond > 0) continue; - if (surf.HeatTransSurf && surf.ExtBoundCond == Ground) continue; - if (surf.HeatTransSurf && surf.ExtBoundCond == KivaFoundation) { + if (surf.HeatTransSurf && surf.ExtBoundCond == DataSurfaces::Ground) continue; + if (surf.HeatTransSurf && surf.ExtBoundCond == DataSurfaces::KivaFoundation) { state.dataSurface->AllHTKivaSurfaceList.push_back(SurfNum); if (!ErrorsFound) state.dataSurfaceGeometry->kivaManager.foundationInputs[surf.OSCPtr].surfaces.push_back(SurfNum); continue; } - if (surf.HeatTransSurf && surf.ExtBoundCond == OtherSideCoefNoCalcExt) continue; - if (surf.HeatTransSurf && surf.ExtBoundCond == OtherSideCoefCalcExt) continue; + if (surf.HeatTransSurf && surf.ExtBoundCond == DataSurfaces::OtherSideCoefNoCalcExt) continue; + if (surf.HeatTransSurf && surf.ExtBoundCond == DataSurfaces::OtherSideCoefCalcExt) continue; // Exclude windows and doors, i.e., consider only their base surfaces as possible obstructions if (surf.Class == SurfaceClass::Window || surf.Class == SurfaceClass::Door) continue; // Exclude duplicate shading surfaces @@ -2614,10 +2520,10 @@ namespace SurfaceGeometry { } // for (SurfNum) // Check for IRT surfaces in invalid places. - iTmp1 = 0; if (std::any_of(state.dataConstruction->Construct.begin(), state.dataConstruction->Construct.end(), [](Construction::ConstructionProps const &e) { return e.TypeIsIRT; })) { + int iTmp1 = 0; for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { auto &surf = state.dataSurface->Surface(SurfNum); if (!surf.HeatTransSurf) continue; // ignore shading surfaces @@ -2643,35 +2549,35 @@ namespace SurfaceGeometry { } // Populate SurfaceFilter lists - for (int iSurfaceFilter = 1; iSurfaceFilter < static_cast(SurfaceFilter::Num); ++iSurfaceFilter) + for (int iSurfaceFilter = 1; iSurfaceFilter < static_cast(DataSurfaces::SurfaceFilter::Num); ++iSurfaceFilter) state.dataSurface->SurfaceFilterLists[iSurfaceFilter].reserve(state.dataSurface->TotSurfaces); for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { auto const &surf = state.dataSurface->Surface(SurfNum); if (!surf.HeatTransSurf) continue; if (surf.ExtBoundCond > 0) { - state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllInteriorSurfaces)].push_back(SurfNum); + state.dataSurface->SurfaceFilterLists[static_cast(DataSurfaces::SurfaceFilter::AllInteriorSurfaces)].push_back(SurfNum); if (state.dataConstruction->Construct(surf.Construction).TypeIsWindow) { - state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllInteriorWindows)].push_back(SurfNum); + state.dataSurface->SurfaceFilterLists[static_cast(DataSurfaces::SurfaceFilter::AllInteriorWindows)].push_back(SurfNum); } else if (surf.Class == SurfaceClass::Wall) { - state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllInteriorWalls)].push_back(SurfNum); + state.dataSurface->SurfaceFilterLists[static_cast(DataSurfaces::SurfaceFilter::AllInteriorWalls)].push_back(SurfNum); } else if (surf.Class == SurfaceClass::Floor) { - state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllInteriorFloors)].push_back(SurfNum); + state.dataSurface->SurfaceFilterLists[static_cast(DataSurfaces::SurfaceFilter::AllInteriorFloors)].push_back(SurfNum); } else if (surf.Class == SurfaceClass::Roof) { - state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllInteriorRoofs)].push_back(SurfNum); - state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllInteriorCeilings)].push_back(SurfNum); + state.dataSurface->SurfaceFilterLists[static_cast(DataSurfaces::SurfaceFilter::AllInteriorRoofs)].push_back(SurfNum); + state.dataSurface->SurfaceFilterLists[static_cast(DataSurfaces::SurfaceFilter::AllInteriorCeilings)].push_back(SurfNum); } } else { - state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllExteriorSurfaces)].push_back(SurfNum); + state.dataSurface->SurfaceFilterLists[static_cast(DataSurfaces::SurfaceFilter::AllExteriorSurfaces)].push_back(SurfNum); if (state.dataConstruction->Construct(surf.Construction).TypeIsWindow) { - state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllExteriorWindows)].push_back(SurfNum); + state.dataSurface->SurfaceFilterLists[static_cast(DataSurfaces::SurfaceFilter::AllExteriorWindows)].push_back(SurfNum); } else if (surf.Class == SurfaceClass::Wall) { - state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllExteriorWalls)].push_back(SurfNum); + state.dataSurface->SurfaceFilterLists[static_cast(DataSurfaces::SurfaceFilter::AllExteriorWalls)].push_back(SurfNum); } else if (surf.Class == SurfaceClass::Floor) { - state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllExteriorFloors)].push_back(SurfNum); + state.dataSurface->SurfaceFilterLists[static_cast(DataSurfaces::SurfaceFilter::AllExteriorFloors)].push_back(SurfNum); } else if (surf.Class == SurfaceClass::Roof) { - state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllExteriorRoofs)].push_back(SurfNum); - state.dataSurface->SurfaceFilterLists[static_cast(SurfaceFilter::AllInteriorCeilings)].push_back(SurfNum); + state.dataSurface->SurfaceFilterLists[static_cast(DataSurfaces::SurfaceFilter::AllExteriorRoofs)].push_back(SurfNum); + state.dataSurface->SurfaceFilterLists[static_cast(DataSurfaces::SurfaceFilter::AllInteriorCeilings)].push_back(SurfNum); } } } // for (SurfNum) @@ -2770,18 +2676,19 @@ namespace SurfaceGeometry { state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "ZoneProperty:UserViewFactors:BySurfaceName") == 0) { for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); + auto const &thisSpace = state.dataHeatBal->space(spaceNum); for (int surfNum = thisSpace.HTSurfaceFirst; surfNum <= thisSpace.HTSurfaceLast; surfNum++) { auto &surface(state.dataSurface->Surface(surfNum)); // Conditions where surface always needs to be unique - bool forceUniqueSurface = - surface.HasShadeControl || - state.dataSurface->SurfWinAirflowSource(surfNum) != DataSurfaces::WindowAirFlowSource::Invalid || - state.dataConstruction->Construct(surface.Construction).SourceSinkPresent || surface.Class == SurfaceClass::TDD_Dome || - (surface.Class == SurfaceClass::Window && (surface.OriginalClass == SurfaceClass::TDD_Diffuser || - state.dataSurface->SurfWinWindowModelType(surfNum) != WindowModel::Detailed || - state.dataWindowManager->inExtWindowModel->isExternalLibraryModel() || - state.dataConstruction->Construct(surface.Construction).isTCWindow)); + bool forceUniqueSurface = surface.HasShadeControl || + state.dataSurface->SurfWinAirflowSource(surfNum) != DataSurfaces::WindowAirFlowSource::Invalid || + state.dataConstruction->Construct(surface.Construction).SourceSinkPresent || + surface.Class == SurfaceClass::TDD_Dome || + (surface.Class == SurfaceClass::Window && + (surface.OriginalClass == SurfaceClass::TDD_Diffuser || + state.dataSurface->SurfWinWindowModelType(surfNum) != DataSurfaces::WindowModel::Detailed || + state.dataWindowManager->inExtWindowModel->isExternalLibraryModel() || + state.dataConstruction->Construct(surface.Construction).isTCWindow)); if (!forceUniqueSurface) { state.dataSurface->Surface(surfNum).set_representative_surface(state, surfNum); } @@ -2790,13 +2697,6 @@ namespace SurfaceGeometry { } } - // Initialize surface with movable insulation index list - for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; SurfNum++) { - if (state.dataSurface->SurfMaterialMovInsulExt(SurfNum) > 0 || state.dataSurface->SurfMaterialMovInsulInt(SurfNum) > 0) { - state.dataHeatBalSurf->SurfMovInsulIndexList.push_back(SurfNum); - } - } - if (SurfError || ErrorsFound) { ErrorsFound = true; ShowFatalError(state, format("{}Errors discovered, program terminates.", RoutineName)); @@ -2942,12 +2842,11 @@ namespace SurfaceGeometry { bool &surfaceError // True if surface azimuths or tilts differ by more than error tolerance ) { - bool sameSurfNormal(false); // True if surface has the same surface normal within tolerance - bool baseSurfHoriz(false); // True if base surface is near horizontal - Real64 constexpr warningTolerance(30.0); - Real64 constexpr errorTolerance(90.0); + bool sameSurfNormal = false; // True if surface has the same surface normal within tolerance + Real64 constexpr warningTolerance = 30.0; + Real64 constexpr errorTolerance = 90.0; - surfaceError = false; + surfaceError = false; // True if surface has the same surface normal within tolerance // Check if base surface and subsurface have the same normal Vectors::CompareTwoVectors(baseSurface.NewellSurfaceNormalVector, subSurface.NewellSurfaceNormalVector, sameSurfNormal, 0.001); @@ -2960,6 +2859,7 @@ namespace SurfaceGeometry { subSurface.lcsz = baseSurface.lcsz; // } } else { + bool baseSurfHoriz = false; // True if base surface is near horizontal // // Not sure what this does, but keeping for now (MJW Dec 2015) // if (std::abs(subSurface.Azimuth - 360.0) < 0.01) { // subSurface.Azimuth = 360.0 - subSurface.Azimuth; @@ -3013,17 +2913,12 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN May 2000 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine reads in the "Surface Geometry" parameters, verifies them, // and sets "global" variables that will tell other routines how the surface // vertices are expected in input. - // METHODOLOGY EMPLOYED: - // na - // REFERENCES: // GlobalGeometryRules Definition // GlobalGeometryRules, @@ -3072,34 +2967,26 @@ namespace SurfaceGeometry { // \key Absolute // \note absolute -- same as world - // Using/Aliasing - // SUBROUTINE PARAMETER DEFINITIONS: static Array1D_string const FlCorners(4, {"UpperLeftCorner", "LowerLeftCorner", "LowerRightCorner", "UpperRightCorner"}); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int NumStmt; Array1D_string GAlphas(5); - int NAlphas; Array1D GNum(1); - int NNum; - int IOStat; - bool OK; - int Found; - std::string OutMsg; - int ZoneNum; // For loop counter - bool RelWarning(false); auto &s_ipsc = state.dataIPShortCut; s_ipsc->cCurrentModuleObject = "GlobalGeometryRules"; - NumStmt = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); - OutMsg = " Surface Geometry,"; + int NumStmt = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + std::string OutMsg = " Surface Geometry,"; { int const SELECT_CASE_var = NumStmt; if (SELECT_CASE_var == 1) { + int NNum; + int IOStat; + int NAlphas; // This is the valid case state.dataInputProcessing->inputProcessor->getObjectItem(state, s_ipsc->cCurrentModuleObject, @@ -3116,22 +3003,20 @@ namespace SurfaceGeometry { // Even though these will be validated, set defaults in case error here -- wont // cause aborts in later surface gets (hopefully) - state.dataSurface->Corner = UpperLeftCorner; + state.dataSurface->Corner = DataSurfaces::UpperLeftCorner; state.dataSurface->WorldCoordSystem = true; state.dataSurface->CCW = true; - OK = false; - Found = Util::FindItem(GAlphas(1), FlCorners, 4); + int Found = Util::FindItem(GAlphas(1), FlCorners, 4); if (Found == 0) { ShowSevereError(state, format("{}: Invalid {}={}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaFieldNames(1), GAlphas(1))); ErrorsFound = true; } else { state.dataSurface->Corner = Found; - OK = true; OutMsg += FlCorners(state.dataSurface->Corner) + ','; } - OK = false; + bool OK = false; if (Util::SameString(GAlphas(2), "CCW") || Util::SameString(GAlphas(2), "Counterclockwise")) { state.dataSurface->CCW = true; OutMsg += "Counterclockwise,"; @@ -3226,8 +3111,8 @@ namespace SurfaceGeometry { ShowContinueError(state, format("{}=\"{}\".", s_ipsc->cAlphaFieldNames(5), GAlphas(5))); } } else { - RelWarning = false; - for (ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { + bool RelWarning = false; + for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { if (state.dataHeatBal->Zone(ZoneNum).OriginX != 0.0) RelWarning = true; if (state.dataHeatBal->Zone(ZoneNum).OriginY != 0.0) RelWarning = true; if (state.dataHeatBal->Zone(ZoneNum).OriginZ != 0.0) RelWarning = true; @@ -3267,12 +3152,7 @@ namespace SurfaceGeometry { // This subroutine gets the Detached Shading Surface Data, // checks it for errors, etc. - // Using/Aliasing - using ScheduleManager::CheckScheduleValueMinMax; - using ScheduleManager::GetScheduleIndex; - using ScheduleManager::GetScheduleMaxValue; - using ScheduleManager::GetScheduleMinValue; - + static constexpr std::string_view routineName = "GetDetShdSurfaceData"; // SUBROUTINE PARAMETER DEFINITIONS: static Array1D_string const cModuleObjects(2, {"Shading:Site:Detailed", "Shading:Building:Detailed"}); @@ -3281,7 +3161,6 @@ namespace SurfaceGeometry { int NumAlphas; // Number of material alpha names being passed int NumNumbers; // Number of material properties being passed int Loop; - int Item; int ItemsToGet; SurfaceClass ClassItem; int numSides; @@ -3296,7 +3175,7 @@ namespace SurfaceGeometry { if ((TotDetachedFixed + TotDetachedBldg) == 0) return; - for (Item = 1; Item <= 2; ++Item) { + for (int Item = 1; Item <= 2; ++Item) { s_ipsc->cCurrentModuleObject = cModuleObjects(Item); if (Item == 1) { @@ -3329,6 +3208,8 @@ namespace SurfaceGeometry { s_ipsc->cAlphaFieldNames, s_ipsc->cNumericFieldNames); + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + if (GlobalNames::VerifyUniqueInterObjectName(state, state.dataSurfaceGeometry->UniqueSurfaceNames, s_ipsc->cAlphaArgs(1), @@ -3339,48 +3220,36 @@ namespace SurfaceGeometry { } ++SurfNum; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = s_ipsc->cAlphaArgs(1); // Set the Surface Name in the Derived Type - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = ClassItem; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).HeatTransSurf = false; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtSolar = true; + + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); + surfTemp.Name = s_ipsc->cAlphaArgs(1); // Set the Surface Name in the Derived Type + surfTemp.Class = ClassItem; + surfTemp.HeatTransSurf = false; + surfTemp.ExtSolar = true; // Base transmittance of a shadowing (sub)surface - if (!s_ipsc->lAlphaFieldBlanks(2)) { - // Schedule for a shadowing (sub)surface - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex = GetScheduleIndex(state, s_ipsc->cAlphaArgs(2)); - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex == 0) { - ShowSevereError(state, - format("{}=\"{}\", {} not found={}", - s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - s_ipsc->cAlphaFieldNames(2), - s_ipsc->cAlphaArgs(2))); - ErrorsFound = true; - } + + if (s_ipsc->lAlphaFieldBlanks(2)) { + surfTemp.shadowSurfSched = + nullptr; // Leaving this as nullptr rather than making AlwaysOff because the uses and tests are too varied + } else if ((surfTemp.shadowSurfSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); + ErrorsFound = true; + } else if (!surfTemp.shadowSurfSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2), Clusive::In, 0.0, Clusive::In, 1.0); + ErrorsFound = true; } else { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex = 0; - } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex != 0) { - if (!CheckScheduleValueMinMax(state, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, - format("{}=\"{}\", {}=\"{}\", values not in range [0,1].", - s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - s_ipsc->cAlphaFieldNames(2), - s_ipsc->cAlphaArgs(2))); - ErrorsFound = true; - } - SchedMinValue = GetScheduleMinValue(state, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedMinValue = SchedMinValue; - SchedMaxValue = GetScheduleMaxValue(state, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex); + SchedMinValue = surfTemp.shadowSurfSched->getMinVal(state); + surfTemp.SchedMinValue = SchedMinValue; + SchedMaxValue = surfTemp.shadowSurfSched->getCurrentVal(); if (SchedMinValue == 1.0) { // Set transparent for now, check for EMS actuators later in SolarShading::resetShadingSurfaceTransparency - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).IsTransparent = true; + surfTemp.IsTransparent = true; } if (SchedMinValue < 0.0) { ShowSevereError(state, format("{}=\"{}\", {}=\"{}\", has schedule values < 0.", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); ShowContinueError(state, "...Schedule values < 0 have no meaning for shading elements."); @@ -3392,7 +3261,7 @@ namespace SurfaceGeometry { ShowSevereError(state, format("{}=\"{}\", {}=\"{}\", has schedule values > 1.", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); ShowContinueError(state, "...Schedule values > 1 have no meaning for shading elements."); @@ -3403,43 +3272,41 @@ namespace SurfaceGeometry { } if (s_ipsc->lNumericFieldBlanks(1) || s_ipsc->rNumericArgs(1) == Constant::AutoCalculate) { numSides = (NumNumbers - 1) / 3; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = numSides; + surfTemp.Sides = numSides; if (mod(NumNumbers - 1, 3) != 0) { ShowWarningError(state, format("{}=\"{}\", {}", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - format("{} not even multiple of 3. Will read in {}", - s_ipsc->cNumericFieldNames(1), - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides))); + surfTemp.Name, + format("{} not even multiple of 3. Will read in {}", s_ipsc->cNumericFieldNames(1), surfTemp.Sides))); } if (numSides < 3) { ShowSevereError(state, format("{}=\"{}\", {} (autocalculate) must be >= 3. Only {} provided.", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cNumericFieldNames(1), - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides)); + surfTemp.Sides)); ErrorsFound = true; continue; } } else { numSides = (NumNumbers - 1) / 3; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = s_ipsc->rNumericArgs(1); - if (numSides > state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides) { + surfTemp.Sides = s_ipsc->rNumericArgs(1); + if (numSides > surfTemp.Sides) { ShowWarningError(state, format("{}=\"{}\", field {}={}", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cNumericFieldNames(1), - fmt::to_string(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides))); + fmt::to_string(surfTemp.Sides))); ShowContinueError( state, format("...but {} were entered. Only the indicated {} will be used.", numSides, s_ipsc->cNumericFieldNames(1))); } } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex.allocate(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); - GetVertices(state, SurfNum, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides, s_ipsc->rNumericArgs({2, _})); - CheckConvexity(state, SurfNum, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); + surfTemp.Vertex.allocate(surfTemp.Sides); + GetVertices(state, SurfNum, surfTemp.Sides, s_ipsc->rNumericArgs({2, _})); + CheckConvexity(state, SurfNum, surfTemp.Sides); if (state.dataReportFlag->MakeMirroredDetachedShading) { MakeMirrorSurface(state, SurfNum); } @@ -3459,14 +3326,10 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN January 2009 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Gets the simple, rectangular detached surfaces. - // Using/Aliasing - // SUBROUTINE PARAMETER DEFINITIONS: static Array1D_string const cModuleObjects(2, {"Shading:Site", "Shading:Building"}); @@ -3475,7 +3338,6 @@ namespace SurfaceGeometry { int NumAlphas; // Number of material alpha names being passed int NumNumbers; // Number of material properties being passed int Loop; - int Item; int ItemsToGet; SurfaceClass ClassItem; @@ -3486,7 +3348,7 @@ namespace SurfaceGeometry { } if (TotRectDetachedFixed + TotRectDetachedBldg == 0) return; - for (Item = 1; Item <= 2; ++Item) { + for (int Item = 1; Item <= 2; ++Item) { s_ipsc->cCurrentModuleObject = cModuleObjects(Item); if (Item == 1) { @@ -3529,24 +3391,25 @@ namespace SurfaceGeometry { } ++SurfNum; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = s_ipsc->cAlphaArgs(1); // Set the Surface Name in the Derived Type - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = ClassItem; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).HeatTransSurf = false; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtSolar = true; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth = s_ipsc->rNumericArgs(1); - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Detached_B && !state.dataSurface->WorldCoordSystem) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth += state.dataHeatBal->BuildingAzimuth; + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); + surfTemp.Name = s_ipsc->cAlphaArgs(1); // Set the Surface Name in the Derived Type + surfTemp.Class = ClassItem; + surfTemp.HeatTransSurf = false; + surfTemp.ExtSolar = true; + + surfTemp.Azimuth = s_ipsc->rNumericArgs(1); + if (surfTemp.Class == SurfaceClass::Detached_B && !state.dataSurface->WorldCoordSystem) { + surfTemp.Azimuth += state.dataHeatBal->BuildingAzimuth; } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Detached_B) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth += state.dataHeatBal->BuildingRotationAppendixG; + if (surfTemp.Class == SurfaceClass::Detached_B) { + surfTemp.Azimuth += state.dataHeatBal->BuildingRotationAppendixG; } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt = s_ipsc->rNumericArgs(2); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).convOrientation = - Convect::GetSurfConvOrientation(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt); + surfTemp.Tilt = s_ipsc->rNumericArgs(2); + surfTemp.convOrientation = Convect::GetSurfConvOrientation(surfTemp.Tilt); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = 4; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex.allocate(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); + surfTemp.Sides = 4; + surfTemp.Vertex.allocate(surfTemp.Sides); MakeRectangularVertices(state, SurfNum, @@ -3557,12 +3420,10 @@ namespace SurfaceGeometry { s_ipsc->rNumericArgs(7), state.dataSurfaceGeometry->RectSurfRefWorldCoordSystem); - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area <= 0.0) { - ShowSevereError(state, - format("{}=\"{}\", Surface Area <= 0.0; Entered Area={:.2T}", - s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area)); + if (surfTemp.Area <= 0.0) { + ShowSevereError( + state, + format("{}=\"{}\", Surface Area <= 0.0; Entered Area={:.2T}", s_ipsc->cCurrentModuleObject, surfTemp.Name, surfTemp.Area)); ErrorsFound = true; } @@ -3590,15 +3451,9 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN May 2000 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // This subroutine gets the HeatTransfer Surface Data, - // checks it for errors, etc. - - // METHODOLOGY EMPLOYED: - // na + // This subroutine gets the HeatTransfer Surface Data, checks it for errors, etc. // REFERENCES: // Heat Transfer Surface Definition @@ -3711,7 +3566,6 @@ namespace SurfaceGeometry { int ZoneNum; // DO loop counter (zones) int Found; // For matching interzone surfaces int Loop; - int Item; int ItemsToGet; int ClassItem; int ArgPointer; @@ -3724,7 +3578,7 @@ namespace SurfaceGeometry { GetFoundationData(state, ErrorsFound); NeedToAddSurfaces = 0; - for (Item = 1; Item <= 4; ++Item) { + for (int Item = 1; Item <= 4; ++Item) { s_ipsc->cCurrentModuleObject = cModuleObjects(Item); if (Item == 1) { @@ -3785,7 +3639,9 @@ namespace SurfaceGeometry { } ++SurfNum; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = s_ipsc->cAlphaArgs(1); // Set the Surface Name in the Derived Type + + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); + surfTemp.Name = s_ipsc->cAlphaArgs(1); // Set the Surface Name in the Derived Type ArgPointer = 2; if (Item == 1) { if (s_ipsc->cAlphaArgs(2) == "CEILING") s_ipsc->cAlphaArgs(2) = "ROOF"; @@ -3794,35 +3650,35 @@ namespace SurfaceGeometry { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } else { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = BaseSurfIDs(ClassItem); + surfTemp.Class = BaseSurfIDs(ClassItem); } ++ArgPointer; } else { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = BaseSurfIDs(ClassItem); + surfTemp.Class = BaseSurfIDs(ClassItem); } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction = + surfTemp.Construction = Util::FindItemInList(s_ipsc->cAlphaArgs(ArgPointer), state.dataConstruction->Construct, state.dataHeatBal->TotConstructs); - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction == 0) { + if (surfTemp.Construction == 0) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(ArgPointer), s_ipsc->cAlphaArgs(ArgPointer))); - } else if (state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).TypeIsWindow) { + } else if (state.dataConstruction->Construct(surfTemp.Construction).TypeIsWindow) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\" - has Window materials.", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(ArgPointer), s_ipsc->cAlphaArgs(ArgPointer))); if (Item == 1) { @@ -3831,30 +3687,28 @@ namespace SurfaceGeometry { ShowContinueError(state, format("...because Surface Type={}", BaseSurfCls(ClassItem))); } } else { - state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).IsUsed = true; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ConstructionStoredInputValue = - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction; + state.dataConstruction->Construct(surfTemp.Construction).IsUsed = true; + surfTemp.ConstructionStoredInputValue = surfTemp.Construction; } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).HeatTransSurf = true; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf = SurfNum; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurfName = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name; + surfTemp.HeatTransSurf = true; + surfTemp.BaseSurf = SurfNum; + surfTemp.BaseSurfName = surfTemp.Name; ++ArgPointer; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName = s_ipsc->cAlphaArgs(ArgPointer); - ZoneNum = Util::FindItemInList( - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName, state.dataHeatBal->Zone, state.dataGlobal->NumOfZones); + surfTemp.ZoneName = s_ipsc->cAlphaArgs(ArgPointer); + ZoneNum = Util::FindItemInList(surfTemp.ZoneName, state.dataHeatBal->Zone, state.dataGlobal->NumOfZones); if (ZoneNum != 0) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone = ZoneNum; + surfTemp.Zone = ZoneNum; } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(ArgPointer), s_ipsc->cAlphaArgs(ArgPointer))); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = SurfaceClass::Invalid; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName = "Unknown Zone"; + surfTemp.Class = SurfaceClass::Invalid; + surfTemp.ZoneName = "Unknown Zone"; ErrorsFound = true; } @@ -3863,25 +3717,25 @@ namespace SurfaceGeometry { int spaceNum = Util::FindItemInList(s_ipsc->cAlphaArgs(ArgPointer), state.dataHeatBal->space); if (spaceNum != 0) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).spaceNum = spaceNum; - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone != state.dataHeatBal->space(spaceNum).zoneNum) { + surfTemp.spaceNum = spaceNum; + if (surfTemp.Zone != state.dataHeatBal->space(spaceNum).zoneNum) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\" is not in the same zone as the surface.", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(ArgPointer), s_ipsc->cAlphaArgs(ArgPointer))); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = SurfaceClass::Invalid; + surfTemp.Class = SurfaceClass::Invalid; ErrorsFound = true; } } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\" not found.", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(ArgPointer), s_ipsc->cAlphaArgs(ArgPointer))); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = SurfaceClass::Invalid; + surfTemp.Class = SurfaceClass::Invalid; ErrorsFound = true; } } @@ -3889,18 +3743,16 @@ namespace SurfaceGeometry { // can take place. The conditions are set with a 0, -1, or -2, or all of the // zone names have to be looked at and generate the interzone array number ++ArgPointer; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = s_ipsc->cAlphaArgs(ArgPointer + 1); + surfTemp.ExtBoundCondName = s_ipsc->cAlphaArgs(ArgPointer + 1); if (Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "Outdoors")) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = ExternalEnvironment; - + surfTemp.ExtBoundCond = DataSurfaces::ExternalEnvironment; } else if (Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "Adiabatic")) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = UnreconciledZoneSurface; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name; + surfTemp.ExtBoundCond = UnreconciledZoneSurface; + surfTemp.ExtBoundCondName = surfTemp.Name; } else if (Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "Ground")) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = Ground; - + surfTemp.ExtBoundCond = DataSurfaces::Ground; if (state.dataSurfaceGeometry->NoGroundTempObjWarning) { if (!state.dataEnvrn->GroundTempInputs[(int)DataEnvironment::GroundTempType::BuildingSurface]) { ShowWarningError(state, @@ -3915,7 +3767,7 @@ namespace SurfaceGeometry { // Added for FCfactor method } else if (Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "GroundFCfactorMethod")) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = GroundFCfactorMethod; + surfTemp.ExtBoundCond = DataSurfaces::GroundFCfactorMethod; if (state.dataSurfaceGeometry->NoFCGroundTempObjWarning) { if (!state.dataEnvrn->GroundTempInputs[(int)DataEnvironment::GroundTempType::FCFactorMethod]) { ShowSevereError(state, @@ -3929,53 +3781,44 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->NoFCGroundTempObjWarning = false; } } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction > 0) { - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Wall && - !state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).TypeIsCfactorWall) { - ShowSevereError(state, - format("{}=\"{}\", invalid {}", - s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - s_ipsc->cAlphaFieldNames(ArgPointer))); - ShowContinueError( + if (surfTemp.Construction > 0) { + if (surfTemp.Class == SurfaceClass::Wall && !state.dataConstruction->Construct(surfTemp.Construction).TypeIsCfactorWall) { + ShowSevereError( state, - format("Construction=\"{}\" is not type Construction:CfactorUndergroundWall.", - state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).Name)); + format("{}=\"{}\", invalid {}", s_ipsc->cCurrentModuleObject, surfTemp.Name, s_ipsc->cAlphaFieldNames(ArgPointer))); + ShowContinueError(state, + format("Construction=\"{}\" is not type Construction:CfactorUndergroundWall.", + state.dataConstruction->Construct(surfTemp.Construction).Name)); ErrorsFound = true; } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Floor && - !state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).TypeIsFfactorFloor) { - ShowSevereError(state, - format("{}=\"{}\", invalid {}", - s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - s_ipsc->cAlphaFieldNames(ArgPointer))); - ShowContinueError( + if (surfTemp.Class == SurfaceClass::Floor && !state.dataConstruction->Construct(surfTemp.Construction).TypeIsFfactorFloor) { + ShowSevereError( state, - format("Construction=\"{}\" is not type Construction:FfactorGroundFloor.", - state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).Name)); + format("{}=\"{}\", invalid {}", s_ipsc->cCurrentModuleObject, surfTemp.Name, s_ipsc->cAlphaFieldNames(ArgPointer))); + ShowContinueError(state, + format("Construction=\"{}\" is not type Construction:FfactorGroundFloor.", + state.dataConstruction->Construct(surfTemp.Construction).Name)); ErrorsFound = true; } } } else if (Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "OtherSideCoefficients")) { - Found = Util::FindItemInList( - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName, state.dataSurface->OSC, state.dataSurface->TotOSC); + Found = Util::FindItemInList(surfTemp.ExtBoundCondName, state.dataSurface->OSC, state.dataSurface->TotOSC); if (Found == 0) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(ArgPointer + 1), s_ipsc->cAlphaArgs(ArgPointer + 1))); ShowContinueError(state, " no OtherSideCoefficients of that name."); ErrorsFound = true; } else { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OSCPtr = Found; + surfTemp.OSCPtr = Found; if (state.dataSurface->OSC(Found).SurfFilmCoef > 0.0) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = OtherSideCoefCalcExt; + surfTemp.ExtBoundCond = DataSurfaces::OtherSideCoefCalcExt; } else { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = OtherSideCoefNoCalcExt; + surfTemp.ExtBoundCond = DataSurfaces::OtherSideCoefNoCalcExt; } } @@ -3984,13 +3827,13 @@ namespace SurfaceGeometry { // this will be found on the second pass through the surface input // for flagging, set the value to UnreconciledZoneSurface // name (ExtBoundCondName) will be validated later. - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = UnreconciledZoneSurface; + surfTemp.ExtBoundCond = UnreconciledZoneSurface; if (s_ipsc->lAlphaFieldBlanks(ArgPointer + 1)) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name; + surfTemp.ExtBoundCondName = surfTemp.Name; ShowSevereError(state, format("{}=\"{}\", invalid {}=.", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(ArgPointer + 1))); ShowContinueError(state, format("..{}=\"Surface\" must be non-blank.", s_ipsc->cAlphaFieldNames(ArgPointer))); ShowContinueError(state, "..This surface will become an adiabatic surface - no doors/windows allowed."); @@ -3999,17 +3842,16 @@ namespace SurfaceGeometry { } else if (Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "Zone")) { // This is the code for an unmatched "other surface" // will be set up later. - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = UnenteredAdjacentZoneSurface; + surfTemp.ExtBoundCond = UnenteredAdjacentZoneSurface; // check OutsideFaceEnvironment for legal zone - Found = Util::FindItemInList( - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName, state.dataHeatBal->Zone, state.dataGlobal->NumOfZones); + Found = Util::FindItemInList(surfTemp.ExtBoundCondName, state.dataHeatBal->Zone, state.dataGlobal->NumOfZones); ++NeedToAddSurfaces; if (Found == 0) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(ArgPointer), s_ipsc->cAlphaArgs(ArgPointer))); ShowContinueError(state, "..Referenced as Zone for this surface."); @@ -4023,7 +3865,7 @@ namespace SurfaceGeometry { state, format("{}=\"{}\", using \"Foundation\" type Outside Boundary Condition requires specification of a weather file", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); + surfTemp.Name)); ShowContinueError(state, "Either place in.epw in the working directory or specify a weather file on the command line using -w " "/path/to/weather.epw"); @@ -4037,47 +3879,43 @@ namespace SurfaceGeometry { // Add default foundation if no other foundation object specified state.dataSurfaceGeometry->kivaManager.addDefaultFoundation(); } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OSCPtr = + surfTemp.OSCPtr = state.dataSurfaceGeometry->kivaManager.defaultIndex; // Reuse OSC pointer...shouldn't be used for non OSC surfaces anyway. } else { - Found = - state.dataSurfaceGeometry->kivaManager.findFoundation(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName); + Found = state.dataSurfaceGeometry->kivaManager.findFoundation(surfTemp.ExtBoundCondName); if (Found != (int)state.dataSurfaceGeometry->kivaManager.foundationInputs.size()) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OSCPtr = Found; + surfTemp.OSCPtr = Found; } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(ArgPointer + 1), s_ipsc->cAlphaArgs(ArgPointer + 1))); ErrorsFound = true; } } - if (state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).SourceSinkPresent) { - ShowSevereError(state, - format("{}=\"{}\", construction may not have an internal source/sink", - s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); + if (state.dataConstruction->Construct(surfTemp.Construction).SourceSinkPresent) { + ShowSevereError( + state, + format("{}=\"{}\", construction may not have an internal source/sink", s_ipsc->cCurrentModuleObject, surfTemp.Name)); ErrorsFound = true; } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = KivaFoundation; - + surfTemp.ExtBoundCond = DataSurfaces::KivaFoundation; } else if (Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "OtherSideConditionsModel")) { - Found = Util::FindItemInList( - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName, state.dataSurface->OSCM, state.dataSurface->TotOSCM); + Found = Util::FindItemInList(surfTemp.ExtBoundCondName, state.dataSurface->OSCM, state.dataSurface->TotOSCM); if (Found == 0) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(ArgPointer + 1), s_ipsc->cAlphaArgs(ArgPointer + 1))); ErrorsFound = true; } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OSCMPtr = Found; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = OtherSideCondModeledExt; + surfTemp.OSCMPtr = Found; + surfTemp.ExtBoundCond = DataSurfaces::OtherSideCondModeledExt; } else if (Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "GroundSlabPreprocessorAverage") || Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "GroundSlabPreprocessorCore") || @@ -4089,7 +3927,7 @@ namespace SurfaceGeometry { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(ArgPointer), s_ipsc->cAlphaArgs(ArgPointer))); ShowContinueError(state, "The ExpandObjects program has not been run or is not in your EnergyPlus.exe folder."); @@ -4099,7 +3937,7 @@ namespace SurfaceGeometry { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(ArgPointer), s_ipsc->cAlphaArgs(ArgPointer))); ShowContinueError(state, @@ -4111,25 +3949,25 @@ namespace SurfaceGeometry { ArgPointer += 2; // Set the logical flag for the exterior solar if (Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "SunExposed")) { - if ((state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond != ExternalEnvironment) && - (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond != OtherSideCondModeledExt)) { + if ((surfTemp.ExtBoundCond != DataSurfaces::ExternalEnvironment) && + (surfTemp.ExtBoundCond != DataSurfaces::OtherSideCondModeledExt)) { ShowWarningError(state, format("{}=\"{}\", {}=\"{}\".", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(ArgPointer), s_ipsc->cAlphaArgs(ArgPointer))); ShowContinueError(state, "..This surface is not exposed to External Environment. Sun exposure has no effect."); } else { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtSolar = true; + surfTemp.ExtSolar = true; } } else if (Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "NoSun")) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtSolar = false; + surfTemp.ExtSolar = false; } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(ArgPointer), s_ipsc->cAlphaArgs(ArgPointer))); ErrorsFound = true; @@ -4138,127 +3976,115 @@ namespace SurfaceGeometry { ++ArgPointer; // Set the logical flag for the exterior wind if (Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "WindExposed")) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtWind = true; + surfTemp.ExtWind = true; } else if (Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "NoWind")) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtWind = false; + surfTemp.ExtWind = false; } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(ArgPointer), s_ipsc->cAlphaArgs(ArgPointer))); ErrorsFound = true; } // Set the logical flag for the EcoRoof presented, this is only based on the flag in the construction type - // if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction > 0) - // state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtEcoRoof = - // state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).TypeIsEcoRoof; + // if (surfTemp.Construction > 0) + // surfTemp.ExtEcoRoof = + // state.dataConstruction->Construct(surfTemp.Construction).TypeIsEcoRoof; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorGround = s_ipsc->rNumericArgs(1); - if (s_ipsc->lNumericFieldBlanks(1)) state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorGround = Constant::AutoCalculate; + surfTemp.ViewFactorGround = s_ipsc->rNumericArgs(1); + if (s_ipsc->lNumericFieldBlanks(1)) surfTemp.ViewFactorGround = Constant::AutoCalculate; if (s_ipsc->lNumericFieldBlanks(2) || s_ipsc->rNumericArgs(2) == Constant::AutoCalculate) { numSides = (SurfaceNumProp - 2) / 3; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = numSides; + surfTemp.Sides = numSides; if (mod(SurfaceNumProp - 2, 3) != 0) { ShowWarningError(state, format("{}=\"{}\", {}", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - format("{} not even multiple of 3. Will read in {}", - s_ipsc->cNumericFieldNames(2), - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides))); + surfTemp.Name, + format("{} not even multiple of 3. Will read in {}", s_ipsc->cNumericFieldNames(2), surfTemp.Sides))); } if (numSides < 3) { ShowSevereError(state, format("{}=\"{}\", {} (autocalculate) must be >= 3. Only {} provided.", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cNumericFieldNames(2), - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides)); + surfTemp.Sides)); ErrorsFound = true; continue; } } else { numSides = (SurfaceNumProp - 2) / 3; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = s_ipsc->rNumericArgs(2); - if (numSides > state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides) { + surfTemp.Sides = s_ipsc->rNumericArgs(2); + if (numSides > surfTemp.Sides) { ShowWarningError(state, format("{}=\"{}\", field {}={}", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cNumericFieldNames(2), - fmt::to_string(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides))); + fmt::to_string(surfTemp.Sides))); ShowContinueError( state, format("...but {} were entered. Only the indicated {} will be used.", numSides, s_ipsc->cNumericFieldNames(2))); } } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex.allocate(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).NewVertex.allocate(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); - GetVertices(state, SurfNum, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides, s_ipsc->rNumericArgs({3, _})); - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area <= 0.0) { - ShowSevereError(state, - format("{}=\"{}\", Surface Area <= 0.0; Entered Area={:.2T}", - s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area)); + surfTemp.Vertex.allocate(surfTemp.Sides); + surfTemp.NewVertex.allocate(surfTemp.Sides); + GetVertices(state, SurfNum, surfTemp.Sides, s_ipsc->rNumericArgs({3, _})); + if (surfTemp.Area <= 0.0) { + ShowSevereError( + state, + format("{}=\"{}\", Surface Area <= 0.0; Entered Area={:.2T}", s_ipsc->cCurrentModuleObject, surfTemp.Name, surfTemp.Area)); ErrorsFound = true; } - CheckConvexity(state, SurfNum, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); + CheckConvexity(state, SurfNum, surfTemp.Sides); if (Util::SameString(s_ipsc->cAlphaArgs(5), "Surface")) { - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides != - static_cast(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex.size())) { + if (surfTemp.Sides != static_cast(surfTemp.Vertex.size())) { ShowSevereError(state, format("{}=\"{}\", After CheckConvexity, mismatch between Sides ({}) and size of Vertex ({}).", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex.size())); + surfTemp.Name, + surfTemp.Sides, + surfTemp.Vertex.size())); ShowContinueError(state, "CheckConvexity is used to verify the convexity of a surface and detect collinear points."); ErrorsFound = true; } } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction > 0) { + if (surfTemp.Construction > 0) { // Check wall height for the CFactor walls - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Wall && - state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).TypeIsCfactorWall) { - if (std::abs(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Height - - state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).Height) > 0.05) { - ShowWarningError(state, - format("{}=\"{}\", underground Wall Height = {:.2T}", - s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Height)); + if (surfTemp.Class == SurfaceClass::Wall && state.dataConstruction->Construct(surfTemp.Construction).TypeIsCfactorWall) { + if (std::abs(surfTemp.Height - state.dataConstruction->Construct(surfTemp.Construction).Height) > 0.05) { + ShowWarningError( + state, + format("{}=\"{}\", underground Wall Height = {:.2T}", s_ipsc->cCurrentModuleObject, surfTemp.Name, surfTemp.Height)); ShowContinueError(state, "..which does not match its construction height."); } } // Check area and perimeter for the FFactor floors - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Floor && - state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).TypeIsFfactorFloor) { - if (std::abs(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area - - state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).Area) > 0.1) { - ShowWarningError(state, - format("{}=\"{}\", underground Floor Area = {:.2T}", - s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area)); + if (surfTemp.Class == SurfaceClass::Floor && state.dataConstruction->Construct(surfTemp.Construction).TypeIsFfactorFloor) { + if (std::abs(surfTemp.Area - state.dataConstruction->Construct(surfTemp.Construction).Area) > 0.1) { + ShowWarningError( + state, + format("{}=\"{}\", underground Floor Area = {:.2T}", s_ipsc->cCurrentModuleObject, surfTemp.Name, surfTemp.Area)); ShowContinueError(state, "..which does not match its construction area."); } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Perimeter < - state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).PerimeterExposed - 0.1) { + if (surfTemp.Perimeter < state.dataConstruction->Construct(surfTemp.Construction).PerimeterExposed - 0.1) { ShowWarningError(state, format("{}=\"{}\", underground Floor Perimeter = {:.2T}", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Perimeter)); + surfTemp.Name, + surfTemp.Perimeter)); ShowContinueError(state, "..which is less than its construction exposed perimeter."); } } } + // Not sure if it's better to add this or guard in SolarShading.cc + // surfTemp.shadowSurfSched = nullptr } } // Item Looop // Check number of Vertex between base surface and Outside Boundary surface @@ -4275,7 +4101,7 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->SurfaceTmp(i).Name, state.dataSurfaceGeometry->SurfaceTmp(i).ExtBoundCondName)); ErrorsFound = true; - // If vertex size mistmatch + // If vertex size mismatch } else if (state.dataSurfaceGeometry->SurfaceTmp(i).Vertex.size() != state.dataSurfaceGeometry->SurfaceTmp(ExtSurfNum).Vertex.size()) { ShowSevereError(state, @@ -4315,14 +4141,10 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN December 2008 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Get simple (rectangular, LLC corner specified) walls - // Using/Aliasing - // SUBROUTINE PARAMETER DEFINITIONS: static Array1D_string const cModuleObjects(10, {"Wall:Exterior", @@ -4336,9 +4158,7 @@ namespace SurfaceGeometry { "Floor:Adiabatic", "Floor:Interzone"}); - int Item; int ItemsToGet; - int Loop; int NumAlphas; int NumNumbers; int IOStat; // IO Status when calling get input subroutine @@ -4351,14 +4171,14 @@ namespace SurfaceGeometry { auto &s_ipsc = state.dataIPShortCut; - for (Item = 1; Item <= 10; ++Item) { + for (int Item = 1; Item <= 10; ++Item) { s_ipsc->cCurrentModuleObject = cModuleObjects(Item); if (Item == 1) { ItemsToGet = TotRectExtWalls; GettingIZSurfaces = false; OtherSurfaceField = 0; - ExtBoundCondition = ExternalEnvironment; + ExtBoundCondition = DataSurfaces::ExternalEnvironment; ClassItem = 1; } else if (Item == 2) { ItemsToGet = TotRectIntWalls; @@ -4376,13 +4196,13 @@ namespace SurfaceGeometry { ItemsToGet = TotRectUGWalls; GettingIZSurfaces = false; OtherSurfaceField = 0; - ExtBoundCondition = Ground; + ExtBoundCondition = DataSurfaces::Ground; ClassItem = 1; } else if (Item == 5) { ItemsToGet = TotRectRoofs; GettingIZSurfaces = false; OtherSurfaceField = 0; - ExtBoundCondition = ExternalEnvironment; + ExtBoundCondition = DataSurfaces::ExternalEnvironment; ClassItem = 3; } else if (Item == 6) { ItemsToGet = TotRectCeilings; @@ -4400,7 +4220,7 @@ namespace SurfaceGeometry { ItemsToGet = TotRectGCFloors; GettingIZSurfaces = false; OtherSurfaceField = 0; - ExtBoundCondition = Ground; + ExtBoundCondition = DataSurfaces::Ground; ClassItem = 2; } else if (Item == 9) { ItemsToGet = TotRectIntFloors; @@ -4416,7 +4236,7 @@ namespace SurfaceGeometry { ClassItem = 2; } - for (Loop = 1; Loop <= ItemsToGet; ++Loop) { + for (int Loop = 1; Loop <= ItemsToGet; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, s_ipsc->cCurrentModuleObject, Loop, @@ -4447,53 +4267,53 @@ namespace SurfaceGeometry { } ++SurfNum; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = s_ipsc->cAlphaArgs(1); // Set the Surface Name in the Derived Type - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = BaseSurfIDs(ClassItem); // Set class number - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction = + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); + surfTemp.Name = s_ipsc->cAlphaArgs(1); // Set the Surface Name in the Derived Type + surfTemp.Class = BaseSurfIDs(ClassItem); // Set class number + + surfTemp.Construction = Util::FindItemInList(s_ipsc->cAlphaArgs(2), state.dataConstruction->Construct, state.dataHeatBal->TotConstructs); - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction == 0) { + if (surfTemp.Construction == 0) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); - } else if (state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).TypeIsWindow) { + } else if (state.dataConstruction->Construct(surfTemp.Construction).TypeIsWindow) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\" - has Window materials.", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(2))); ShowContinueError(state, format("...because {}={}", s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); } else { - state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).IsUsed = true; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ConstructionStoredInputValue = - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction; + state.dataConstruction->Construct(surfTemp.Construction).IsUsed = true; + surfTemp.ConstructionStoredInputValue = surfTemp.Construction; } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).HeatTransSurf = true; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf = SurfNum; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurfName = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name; + surfTemp.HeatTransSurf = true; + surfTemp.BaseSurf = SurfNum; + surfTemp.BaseSurfName = surfTemp.Name; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName = s_ipsc->cAlphaArgs(3); - ZoneNum = Util::FindItemInList( - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName, state.dataHeatBal->Zone, state.dataGlobal->NumOfZones); + surfTemp.ZoneName = s_ipsc->cAlphaArgs(3); + ZoneNum = Util::FindItemInList(surfTemp.ZoneName, state.dataHeatBal->Zone, state.dataGlobal->NumOfZones); if (ZoneNum != 0) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone = ZoneNum; + surfTemp.Zone = ZoneNum; } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3))); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = SurfaceClass::Invalid; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName = "Unknown Zone"; + surfTemp.Class = SurfaceClass::Invalid; + surfTemp.ZoneName = "Unknown Zone"; ErrorsFound = true; } @@ -4501,73 +4321,70 @@ namespace SurfaceGeometry { int spaceNum = Util::FindItemInList(s_ipsc->cAlphaArgs(4), state.dataHeatBal->space); if (spaceNum != 0) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).spaceNum = spaceNum; + surfTemp.spaceNum = spaceNum; } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4))); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = SurfaceClass::Invalid; + surfTemp.Class = SurfaceClass::Invalid; ErrorsFound = true; } } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = ExtBoundCondition; - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction > 0) { - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Wall && - state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).TypeIsCfactorWall && - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == Ground) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = GroundFCfactorMethod; - } else if (state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).TypeIsCfactorWall) { + surfTemp.ExtBoundCond = ExtBoundCondition; + if (surfTemp.Construction > 0) { + if (surfTemp.Class == SurfaceClass::Wall && state.dataConstruction->Construct(surfTemp.Construction).TypeIsCfactorWall && + surfTemp.ExtBoundCond == DataSurfaces::Ground) { + surfTemp.ExtBoundCond = DataSurfaces::GroundFCfactorMethod; + } else if (state.dataConstruction->Construct(surfTemp.Construction).TypeIsCfactorWall) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", Construction type is \"Construction:CfactorUndergroundWall\" but invalid for this object.", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); + surfTemp.Name)); } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Floor && - state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).TypeIsFfactorFloor && - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == Ground) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = GroundFCfactorMethod; - } else if (state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).TypeIsFfactorFloor) { + + if (surfTemp.Class == SurfaceClass::Floor && state.dataConstruction->Construct(surfTemp.Construction).TypeIsFfactorFloor && + surfTemp.ExtBoundCond == DataSurfaces::Ground) { + surfTemp.ExtBoundCond = DataSurfaces::GroundFCfactorMethod; + } else if (state.dataConstruction->Construct(surfTemp.Construction).TypeIsFfactorFloor) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", Construction type is \"Construction:FfactorGroundFloor\" but invalid for this object.", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); + surfTemp.Name)); } } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtSolar = false; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtWind = false; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorGround = Constant::AutoCalculate; + surfTemp.ExtSolar = false; + surfTemp.ExtWind = false; + surfTemp.ViewFactorGround = Constant::AutoCalculate; - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == ExternalEnvironment) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtSolar = true; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtWind = true; + if (surfTemp.ExtBoundCond == DataSurfaces::ExternalEnvironment) { + surfTemp.ExtSolar = true; + surfTemp.ExtWind = true; // Set the logical flag for the EcoRoof presented, this is only based on the flag in the construction type - // if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction > 0) - // state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtEcoRoof = - // state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).TypeIsEcoRoof; + // if (surfTemp.Construction > 0) + // surfTemp.ExtEcoRoof = + // state.dataConstruction->Construct(surfTemp.Construction).TypeIsEcoRoof; - } else if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == UnreconciledZoneSurface) { + } else if (surfTemp.ExtBoundCond == UnreconciledZoneSurface) { if (GettingIZSurfaces) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = s_ipsc->cAlphaArgs(OtherSurfaceField); - Found = Util::FindItemInList( - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName, state.dataHeatBal->Zone, state.dataGlobal->NumOfZones); + surfTemp.ExtBoundCondName = s_ipsc->cAlphaArgs(OtherSurfaceField); + Found = Util::FindItemInList(surfTemp.ExtBoundCondName, state.dataHeatBal->Zone, state.dataGlobal->NumOfZones); // see if match to zone, then it's an unentered other surface, else reconciled later if (Found > 0) { ++NeedToAddSurfaces; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = UnenteredAdjacentZoneSurface; + surfTemp.ExtBoundCond = UnenteredAdjacentZoneSurface; } } else { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name; + surfTemp.ExtBoundCondName = surfTemp.Name; } - } else if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == Ground) { - + } else if (surfTemp.ExtBoundCond == DataSurfaces::Ground) { if (state.dataSurfaceGeometry->NoGroundTempObjWarning) { if (!state.dataEnvrn->GroundTempInputs[(int)DataEnvironment::GroundTempType::BuildingSurface]) { ShowWarningError(state, @@ -4580,7 +4397,7 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->NoGroundTempObjWarning = false; } - } else if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == GroundFCfactorMethod) { + } else if (surfTemp.ExtBoundCond == DataSurfaces::GroundFCfactorMethod) { if (state.dataSurfaceGeometry->NoFCGroundTempObjWarning) { if (!state.dataEnvrn->GroundTempInputs[(int)DataEnvironment::GroundTempType::FCFactorMethod]) { ShowSevereError(state, @@ -4597,22 +4414,20 @@ namespace SurfaceGeometry { } // ... End of the ExtBoundCond logical IF Block - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth = s_ipsc->rNumericArgs(1); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt = s_ipsc->rNumericArgs(2); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).convOrientation = - Convect::GetSurfConvOrientation(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt); + surfTemp.Azimuth = s_ipsc->rNumericArgs(1); + surfTemp.Tilt = s_ipsc->rNumericArgs(2); + surfTemp.convOrientation = Convect::GetSurfConvOrientation(surfTemp.Tilt); if (!state.dataSurface->WorldCoordSystem) { if (ZoneNum != 0) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth += - state.dataHeatBal->BuildingAzimuth + state.dataHeatBal->Zone(ZoneNum).RelNorth; + surfTemp.Azimuth += state.dataHeatBal->BuildingAzimuth + state.dataHeatBal->Zone(ZoneNum).RelNorth; } } if (ZoneNum != 0) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth += state.dataHeatBal->BuildingRotationAppendixG; + surfTemp.Azimuth += state.dataHeatBal->BuildingRotationAppendixG; } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = 4; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex.allocate(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); + surfTemp.Sides = 4; + surfTemp.Vertex.allocate(surfTemp.Sides); MakeRectangularVertices(state, SurfNum, @@ -4623,48 +4438,35 @@ namespace SurfaceGeometry { s_ipsc->rNumericArgs(7), state.dataSurfaceGeometry->RectSurfRefWorldCoordSystem); - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area <= 0.0) { - ShowSevereError(state, - format("{}=\"{}\", Surface Area <= 0.0; Entered Area={:.2T}", - s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area)); + if (surfTemp.Area <= 0.0) { + ShowSevereError( + state, + format("{}=\"{}\", Surface Area <= 0.0; Entered Area={:.2T}", s_ipsc->cCurrentModuleObject, surfTemp.Name, surfTemp.Area)); ErrorsFound = true; } // Check wall height for the CFactor walls - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Wall && - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == GroundFCfactorMethod) { - if (std::abs(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Height - - state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).Height) > 0.05) { - ShowWarningError(state, - format("{}=\"{}\", underground Wall Height = {:.2T}", - s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Height)); + if (surfTemp.Class == SurfaceClass::Wall && surfTemp.ExtBoundCond == DataSurfaces::GroundFCfactorMethod) { + if (std::abs(surfTemp.Height - state.dataConstruction->Construct(surfTemp.Construction).Height) > 0.05) { + ShowWarningError( + state, + format("{}=\"{}\", underground Wall Height = {:.2T}", s_ipsc->cCurrentModuleObject, surfTemp.Name, surfTemp.Height)); ShowContinueError(state, "..which deos not match its construction height."); } } // Check area and perimeter for the FFactor floors - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Floor && - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == GroundFCfactorMethod) { - if (std::abs(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area - - state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).Area) > 0.1) { - ShowWarningError(state, - format("{}=\"{}\", underground Floor Area = {:.2T}", - s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area)); + if (surfTemp.Class == SurfaceClass::Floor && surfTemp.ExtBoundCond == DataSurfaces::GroundFCfactorMethod) { + if (std::abs(surfTemp.Area - state.dataConstruction->Construct(surfTemp.Construction).Area) > 0.1) { + ShowWarningError( + state, format("{}=\"{}\", underground Floor Area = {:.2T}", s_ipsc->cCurrentModuleObject, surfTemp.Name, surfTemp.Area)); ShowContinueError(state, "..which does not match its construction area."); } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Perimeter < - state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).PerimeterExposed - 0.1) { - ShowWarningError(state, - format("{}=\"{}\", underground Floor Perimeter = {:.2T}", - s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Perimeter)); + if (surfTemp.Perimeter < state.dataConstruction->Construct(surfTemp.Construction).PerimeterExposed - 0.1) { + ShowWarningError( + state, + format( + "{}=\"{}\", underground Floor Perimeter = {:.2T}", s_ipsc->cCurrentModuleObject, surfTemp.Name, surfTemp.Perimeter)); ShowContinueError(state, "..which is less than its construction exposed perimeter."); } } @@ -4685,78 +4487,46 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN December 2008 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This routine creates world/3d coordinates for rectangular surfaces using azimuth, tilt, LLC (X,Y,Z), length & height. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // Using/Aliasing - using namespace Vectors; - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 SurfAzimuth; // Surface Azimuth/Facing (same as Base Surface) - Real64 SurfTilt; // Tilt (same as Base Surface) Real64 XLLC; Real64 YLLC; Real64 ZLLC; - Real64 CosSurfAzimuth; - Real64 SinSurfAzimuth; - Real64 CosSurfTilt; - Real64 SinSurfTilt; Array1D XX(4); Array1D YY(4); Real64 Xb; Real64 Yb; Real64 Perimeter; - int n; int Vrt; - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone == 0 && - (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class != SurfaceClass::Detached_F && - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class != SurfaceClass::Detached_B)) - return; + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); + + if (surfTemp.Zone == 0 && (surfTemp.Class != SurfaceClass::Detached_F && surfTemp.Class != SurfaceClass::Detached_B)) return; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Height = Height; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Width = Length; + surfTemp.Height = Height; + surfTemp.Width = Length; + + Real64 SurfAzimuth = surfTemp.Azimuth; + Real64 SurfTilt = surfTemp.Tilt; + Real64 CosSurfAzimuth = std::cos(SurfAzimuth * Constant::DegToRad); + Real64 SinSurfAzimuth = std::sin(SurfAzimuth * Constant::DegToRad); + Real64 CosSurfTilt = std::cos(SurfTilt * Constant::DegToRad); + Real64 SinSurfTilt = std::sin(SurfTilt * Constant::DegToRad); - SurfAzimuth = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth; - SurfTilt = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt; - CosSurfAzimuth = std::cos(SurfAzimuth * Constant::DegToRadians); - SinSurfAzimuth = std::sin(SurfAzimuth * Constant::DegToRadians); - CosSurfTilt = std::cos(SurfTilt * Constant::DegToRadians); - SinSurfTilt = std::sin(SurfTilt * Constant::DegToRadians); if (!SurfWorldCoordSystem) { - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone > 0) { - Xb = XCoord * state.dataSurfaceGeometry->CosZoneRelNorth(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone) - - YCoord * state.dataSurfaceGeometry->SinZoneRelNorth(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone) + - state.dataHeatBal->Zone(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone).OriginX; - Yb = XCoord * state.dataSurfaceGeometry->SinZoneRelNorth(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone) + - YCoord * state.dataSurfaceGeometry->CosZoneRelNorth(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone) + - state.dataHeatBal->Zone(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone).OriginY; + if (surfTemp.Zone > 0) { + Xb = XCoord * state.dataSurfaceGeometry->CosZoneRelNorth(surfTemp.Zone) - + YCoord * state.dataSurfaceGeometry->SinZoneRelNorth(surfTemp.Zone) + state.dataHeatBal->Zone(surfTemp.Zone).OriginX; + Yb = XCoord * state.dataSurfaceGeometry->SinZoneRelNorth(surfTemp.Zone) + + YCoord * state.dataSurfaceGeometry->CosZoneRelNorth(surfTemp.Zone) + state.dataHeatBal->Zone(surfTemp.Zone).OriginY; XLLC = Xb * state.dataSurfaceGeometry->CosBldgRelNorth - Yb * state.dataSurfaceGeometry->SinBldgRelNorth; YLLC = Xb * state.dataSurfaceGeometry->SinBldgRelNorth + Yb * state.dataSurfaceGeometry->CosBldgRelNorth; - ZLLC = ZCoord + state.dataHeatBal->Zone(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone).OriginZ; + ZLLC = ZCoord + state.dataHeatBal->Zone(surfTemp.Zone).OriginZ; } else { - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Detached_B) { + if (surfTemp.Class == SurfaceClass::Detached_B) { Xb = XCoord; Yb = YCoord; XLLC = Xb * state.dataSurfaceGeometry->CosBldgRelNorth - Yb * state.dataSurfaceGeometry->SinBldgRelNorth; @@ -4773,7 +4543,7 @@ namespace SurfaceGeometry { Xb = XCoord; Yb = YCoord; ZLLC = ZCoord; - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class != SurfaceClass::Detached_F) { + if (surfTemp.Class != SurfaceClass::Detached_F) { XLLC = Xb * state.dataSurfaceGeometry->CosBldgRotAppGonly - Yb * state.dataSurfaceGeometry->SinBldgRotAppGonly; YLLC = Xb * state.dataSurfaceGeometry->SinBldgRotAppGonly + Yb * state.dataSurfaceGeometry->CosBldgRotAppGonly; } else { @@ -4791,68 +4561,54 @@ namespace SurfaceGeometry { YY(3) = 0.0; YY(2) = 0.0; - for (n = 1; n <= state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides; ++n) { + for (int n = 1; n <= surfTemp.Sides; ++n) { Vrt = n; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(Vrt).x = XLLC - XX(n) * CosSurfAzimuth - YY(n) * CosSurfTilt * SinSurfAzimuth; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(Vrt).y = YLLC + XX(n) * SinSurfAzimuth - YY(n) * CosSurfTilt * CosSurfAzimuth; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(Vrt).z = ZLLC + YY(n) * SinSurfTilt; - } - - CreateNewellAreaVector(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).NewellAreaVector); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).GrossArea = VecLength(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).NewellAreaVector); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).GrossArea; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).NetAreaShadowCalc = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area; - CreateNewellSurfaceNormalVector(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).NewellSurfaceNormalVector); - DetermineAzimuthAndTilt(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex, - SurfAzimuth, - SurfTilt, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).lcsx, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).lcsy, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).lcsz, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).NewellSurfaceNormalVector); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth = SurfAzimuth; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt = SurfTilt; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).convOrientation = - Convect::GetSurfConvOrientation(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt); + surfTemp.Vertex(Vrt).x = XLLC - XX(n) * CosSurfAzimuth - YY(n) * CosSurfTilt * SinSurfAzimuth; + surfTemp.Vertex(Vrt).y = YLLC + XX(n) * SinSurfAzimuth - YY(n) * CosSurfTilt * CosSurfAzimuth; + surfTemp.Vertex(Vrt).z = ZLLC + YY(n) * SinSurfTilt; + } + + Vectors::CreateNewellAreaVector(surfTemp.Vertex, surfTemp.Sides, surfTemp.NewellAreaVector); + surfTemp.GrossArea = Vectors::VecLength(surfTemp.NewellAreaVector); + surfTemp.Area = surfTemp.GrossArea; + surfTemp.NetAreaShadowCalc = surfTemp.Area; + Vectors::CreateNewellSurfaceNormalVector(surfTemp.Vertex, surfTemp.Sides, surfTemp.NewellSurfaceNormalVector); + Vectors::DetermineAzimuthAndTilt( + surfTemp.Vertex, SurfAzimuth, SurfTilt, surfTemp.lcsx, surfTemp.lcsy, surfTemp.lcsz, surfTemp.NewellSurfaceNormalVector); + surfTemp.Azimuth = SurfAzimuth; + surfTemp.Tilt = SurfTilt; + surfTemp.convOrientation = Convect::GetSurfConvOrientation(surfTemp.Tilt); // Sine and cosine of azimuth and tilt - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SinAzim = SinSurfAzimuth; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).CosAzim = CosSurfAzimuth; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SinTilt = SinSurfTilt; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).CosTilt = CosSurfTilt; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorGround = 0.5 * (1.0 - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).CosTilt); + surfTemp.SinAzim = SinSurfAzimuth; + surfTemp.CosAzim = CosSurfAzimuth; + surfTemp.SinTilt = SinSurfTilt; + surfTemp.CosTilt = CosSurfTilt; + surfTemp.ViewFactorGround = 0.5 * (1.0 - surfTemp.CosTilt); // Outward normal unit vector (pointing away from room) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OutNormVec = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).NewellSurfaceNormalVector; - for (n = 1; n <= 3; ++n) { - if (std::abs(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OutNormVec(n) - 1.0) < 1.e-06) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OutNormVec(n) = +1.0; - if (std::abs(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OutNormVec(n) + 1.0) < 1.e-06) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OutNormVec(n) = -1.0; - if (std::abs(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OutNormVec(n)) < 1.e-06) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OutNormVec(n) = 0.0; + + surfTemp.OutNormVec = surfTemp.NewellSurfaceNormalVector; + for (int n = 1; n <= 3; ++n) { + if (std::abs(surfTemp.OutNormVec(n) - 1.0) < 1.e-06) surfTemp.OutNormVec(n) = +1.0; + if (std::abs(surfTemp.OutNormVec(n) + 1.0) < 1.e-06) surfTemp.OutNormVec(n) = -1.0; + if (std::abs(surfTemp.OutNormVec(n)) < 1.e-06) surfTemp.OutNormVec(n) = 0.0; } // Can perform tests on this surface here - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorSky = 0.5 * (1.0 + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).CosTilt); + surfTemp.ViewFactorSky = 0.5 * (1.0 + surfTemp.CosTilt); // The following IR view factors are modified in subr. SkyDifSolarShading if there are shadowing // surfaces - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorSkyIR = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorSky; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorGroundIR = 0.5 * (1.0 - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).CosTilt); + surfTemp.ViewFactorSkyIR = surfTemp.ViewFactorSky; + surfTemp.ViewFactorGroundIR = 0.5 * (1.0 - surfTemp.CosTilt); - Perimeter = distance(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides), - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(1)); - for (Vrt = 2; Vrt <= state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides; ++Vrt) { - Perimeter += - distance(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(Vrt), state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(Vrt - 1)); + Perimeter = distance(surfTemp.Vertex(surfTemp.Sides), surfTemp.Vertex(1)); + for (Vrt = 2; Vrt <= surfTemp.Sides; ++Vrt) { + Perimeter += distance(surfTemp.Vertex(Vrt), surfTemp.Vertex(Vrt - 1)); } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Perimeter = Perimeter; + surfTemp.Perimeter = Perimeter; // Call to transform vertices - TransformVertsByAspect(state, SurfNum, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); + TransformVertsByAspect(state, SurfNum, surfTemp.Sides); } void GetHTSubSurfaceData(EnergyPlusData &state, @@ -4870,14 +4626,9 @@ namespace SurfaceGeometry { // AUTHOR Linda Lawrie // DATE WRITTEN May 2000 // MODIFIED August 2012 - line up subsurfaces with base surface types - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // This subroutine gets the HeatTransfer Sub Surface Data, - // checks it for errors, etc. - - // METHODOLOGY EMPLOYED: - // na + // This subroutine gets the HeatTransfer Sub Surface Data, checks it for errors, etc. // REFERENCES: // Heat Transfer Subsurface Definition @@ -4947,12 +4698,6 @@ namespace SurfaceGeometry { // \note for some internal calculations, but all coordinates are given in an "absolute" system. // N4-15 as indicated by the N3 value - // Using/Aliasing - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // data file entry with two glazing systems - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int IOStat; // IO Status when calling get input subroutine int SurfaceNumAlpha; // Number of material alpha names being passed @@ -5006,108 +4751,102 @@ namespace SurfaceGeometry { continue; } + ++SurfNum; + + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); + if (SurfaceNumProp < 12) { - ShowSevereError(state, - format("{}=\"{}\", Too few number of numeric args=[{}].", - s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - SurfaceNumProp)); + ShowSevereError( + state, format("{}=\"{}\", Too few number of numeric args=[{}].", s_ipsc->cCurrentModuleObject, surfTemp.Name, SurfaceNumProp)); ErrorsFound = true; } - ++SurfNum; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = s_ipsc->cAlphaArgs(1); // Set the Surface Name in the Derived Type + surfTemp.Name = s_ipsc->cAlphaArgs(1); // Set the Surface Name in the Derived Type ValidChk = Util::FindItemInList(s_ipsc->cAlphaArgs(2), SubSurfCls, 6); if (ValidChk == 0) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } else { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = SubSurfIDs(ValidChk); // Set class number + surfTemp.Class = SubSurfIDs(ValidChk); // Set class number } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction = - Util::FindItemInList(s_ipsc->cAlphaArgs(3), state.dataConstruction->Construct, state.dataHeatBal->TotConstructs); + surfTemp.Construction = Util::FindItemInList(s_ipsc->cAlphaArgs(3), state.dataConstruction->Construct, state.dataHeatBal->TotConstructs); - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction == 0) { + if (surfTemp.Construction == 0) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3))); ErrorsFound = true; continue; } else { - state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).IsUsed = true; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ConstructionStoredInputValue = - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction; + state.dataConstruction->Construct(surfTemp.Construction).IsUsed = true; + surfTemp.ConstructionStoredInputValue = surfTemp.Construction; } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Window || - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::GlassDoor || - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::TDD_Diffuser || - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::TDD_Dome) { + if (surfTemp.Class == SurfaceClass::Window || surfTemp.Class == SurfaceClass::GlassDoor || surfTemp.Class == SurfaceClass::TDD_Diffuser || + surfTemp.Class == SurfaceClass::TDD_Dome) { - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction != 0) { - auto &construction = state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction); + if (surfTemp.Construction != 0) { + auto const &construction = state.dataConstruction->Construct(surfTemp.Construction); if (!construction.TypeIsWindow && !construction.TypeIsAirBoundary) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\" has an opaque surface construction; it should have a window construction.", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); + surfTemp.Name)); } - if (state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).SourceSinkPresent) { + if (state.dataConstruction->Construct(surfTemp.Construction).SourceSinkPresent) { ErrorsFound = true; - ShowSevereError(state, - format("{}=\"{}\": Windows are not allowed to have embedded sources/sinks", - s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); + ShowSevereError( + state, + format("{}=\"{}\": Windows are not allowed to have embedded sources/sinks", s_ipsc->cCurrentModuleObject, surfTemp.Name)); } } - } else if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction != 0) { - if (state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).TypeIsWindow) { + } else if (surfTemp.Construction != 0) { + if (state.dataConstruction->Construct(surfTemp.Construction).TypeIsWindow) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\" - has Window materials.", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3))); ShowContinueError(state, format("...because {}={}", s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); } } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).HeatTransSurf = true; + surfTemp.HeatTransSurf = true; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurfName = s_ipsc->cAlphaArgs(4); + surfTemp.BaseSurfName = s_ipsc->cAlphaArgs(4); // The subsurface inherits properties from the base surface // Exterior conditions, Zone, etc. // We can figure out the base surface though, because they've all been entered - Found = Util::FindItemInList( - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurfName, state.dataSurfaceGeometry->SurfaceTmp, state.dataSurface->TotSurfaces); + Found = Util::FindItemInList(surfTemp.BaseSurfName, state.dataSurfaceGeometry->SurfaceTmp, state.dataSurface->TotSurfaces); if (Found > 0) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf = Found; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtBoundCond; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtBoundCondName; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtSolar = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtSolar; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtWind = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtWind; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone = state.dataSurfaceGeometry->SurfaceTmp(Found).Zone; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName = state.dataSurfaceGeometry->SurfaceTmp(Found).ZoneName; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OSCPtr = state.dataSurfaceGeometry->SurfaceTmp(Found).OSCPtr; + surfTemp.BaseSurf = Found; + surfTemp.ExtBoundCond = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtBoundCond; + surfTemp.ExtBoundCondName = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtBoundCondName; + surfTemp.ExtSolar = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtSolar; + surfTemp.ExtWind = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtWind; + surfTemp.Zone = state.dataSurfaceGeometry->SurfaceTmp(Found).Zone; + surfTemp.ZoneName = state.dataSurfaceGeometry->SurfaceTmp(Found).ZoneName; + surfTemp.OSCPtr = state.dataSurfaceGeometry->SurfaceTmp(Found).OSCPtr; if (state.dataSurfaceGeometry->SurfaceTmp(Found).ExtBoundCond == UnreconciledZoneSurface && state.dataSurfaceGeometry->SurfaceTmp(Found).ExtBoundCondName == state.dataSurfaceGeometry->SurfaceTmp(Found).Name) { // Adiabatic surface, no windows or doors allowed ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4))); ShowContinueError(state, "... adiabatic surfaces cannot have windows or doors."); @@ -5119,24 +4858,20 @@ namespace SurfaceGeometry { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4))); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName = "Unknown Zone"; + surfTemp.ZoneName = "Unknown Zone"; ErrorsFound = true; } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::TDD_Dome || - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::TDD_Diffuser) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = ExternalEnvironment; + if (surfTemp.Class == SurfaceClass::TDD_Dome || surfTemp.Class == SurfaceClass::TDD_Diffuser) { + surfTemp.ExtBoundCond = DataSurfaces::ExternalEnvironment; } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == ExternalEnvironment) { + if (surfTemp.ExtBoundCond == DataSurfaces::ExternalEnvironment) { if (!s_ipsc->lAlphaFieldBlanks(5)) { ShowWarningError(state, - format("{}=\"{}\", invalid field {}", - s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - s_ipsc->cAlphaFieldNames(5))); + format("{}=\"{}\", invalid field {}", s_ipsc->cCurrentModuleObject, surfTemp.Name, s_ipsc->cAlphaFieldNames(5))); ShowContinueError( state, format("...when Base surface uses \"Outdoors\" as {}, subsurfaces need to be blank to inherit the outdoor characteristics.", @@ -5145,39 +4880,34 @@ namespace SurfaceGeometry { } } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == UnreconciledZoneSurface) { // "Surface" Base Surface + if (surfTemp.ExtBoundCond == UnreconciledZoneSurface) { // "Surface" Base Surface if (!s_ipsc->lAlphaFieldBlanks(5)) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = s_ipsc->cAlphaArgs(5); + surfTemp.ExtBoundCondName = s_ipsc->cAlphaArgs(5); } else { ShowSevereError(state, - format("{}=\"{}\", invalid blank {}", - s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - s_ipsc->cAlphaFieldNames(5))); + format("{}=\"{}\", invalid blank {}", s_ipsc->cCurrentModuleObject, surfTemp.Name, s_ipsc->cAlphaFieldNames(5))); ShowContinueError( state, format("...when Base surface uses \"Surface\" as {}, subsurfaces must also specify specific surfaces in the adjacent zone.", s_ipsc->cAlphaFieldNames(5))); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = - s_ipsc->cAlphaArgs(5); // putting it as blank will not confuse things later. + surfTemp.ExtBoundCondName = s_ipsc->cAlphaArgs(5); // putting it as blank will not confuse things later. ErrorsFound = true; } } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == UnenteredAdjacentZoneSurface) { // "Zone" - unmatched interior surface + if (surfTemp.ExtBoundCond == UnenteredAdjacentZoneSurface) { // "Zone" - unmatched interior surface ++NeedToAddSurfaces; // ignoring window5datafiles for now -- will need to add. } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == OtherSideCoefNoCalcExt || - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == OtherSideCoefCalcExt) { + if (surfTemp.ExtBoundCond == DataSurfaces::OtherSideCoefNoCalcExt || surfTemp.ExtBoundCond == DataSurfaces::OtherSideCoefCalcExt) { if (!s_ipsc->lAlphaFieldBlanks(5)) { // Otherside Coef special Name Found = Util::FindItemInList(s_ipsc->cAlphaArgs(5), state.dataSurface->OSC, state.dataSurface->TotOSC); if (Found == 0) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaArgs(5))); ShowContinueError(state, "...base surface requires that this subsurface have OtherSideCoefficients -- not found."); @@ -5185,122 +4915,112 @@ namespace SurfaceGeometry { } else { // found // The following allows for a subsurface that has different characteristics than // the base surface with OtherSide Coeff -- do we want that or is it an error? - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OSCPtr = Found; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = s_ipsc->cAlphaArgs(5); + surfTemp.OSCPtr = Found; + surfTemp.ExtBoundCondName = s_ipsc->cAlphaArgs(5); if (state.dataSurface->OSC(Found).SurfFilmCoef > 0.0) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = OtherSideCoefCalcExt; + surfTemp.ExtBoundCond = DataSurfaces::OtherSideCoefCalcExt; } else { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = OtherSideCoefNoCalcExt; + surfTemp.ExtBoundCond = DataSurfaces::OtherSideCoefNoCalcExt; } } } } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == OtherSideCondModeledExt) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = ExternalEnvironment; + if (surfTemp.ExtBoundCond == DataSurfaces::OtherSideCondModeledExt) { + surfTemp.ExtBoundCond = DataSurfaces::ExternalEnvironment; } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName == BlankString) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name; + if (surfTemp.ExtBoundCondName == BlankString) { + surfTemp.ExtBoundCondName = surfTemp.Name; } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorGround = s_ipsc->rNumericArgs(1); - if (s_ipsc->lNumericFieldBlanks(1)) state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorGround = Constant::AutoCalculate; + surfTemp.ViewFactorGround = s_ipsc->rNumericArgs(1); + if (s_ipsc->lNumericFieldBlanks(1)) surfTemp.ViewFactorGround = Constant::AutoCalculate; if (s_ipsc->lNumericFieldBlanks(3) || s_ipsc->rNumericArgs(3) == Constant::AutoCalculate) { s_ipsc->rNumericArgs(3) = (SurfaceNumProp - 3) / 3; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = s_ipsc->rNumericArgs(3); + surfTemp.Sides = s_ipsc->rNumericArgs(3); if (mod(SurfaceNumProp - 3, 3) != 0) { ShowWarningError(state, format("{}=\"{}\", {}", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - format("{} not even multiple of 3. Will read in {}", - s_ipsc->cNumericFieldNames(3), - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides))); + surfTemp.Name, + format("{} not even multiple of 3. Will read in {}", s_ipsc->cNumericFieldNames(3), surfTemp.Sides))); } if (s_ipsc->rNumericArgs(3) < 3) { ShowSevereError(state, format("{}=\"{}\", {} (autocalculate) must be >= 3. Only {} provided.", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cNumericFieldNames(3), - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides)); + surfTemp.Sides)); ErrorsFound = true; continue; } } else { numSides = (SurfaceNumProp - 2) / 3; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = s_ipsc->rNumericArgs(3); - if (numSides > state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides) { + surfTemp.Sides = s_ipsc->rNumericArgs(3); + if (numSides > surfTemp.Sides) { ShowWarningError(state, format("{}=\"{}\", field {}={}", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cNumericFieldNames(3), - fmt::to_string(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides))); + fmt::to_string(surfTemp.Sides))); ShowContinueError(state, format("...but {} were entered. Only the indicated {} will be used.", numSides, s_ipsc->cNumericFieldNames(3))); } } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex.allocate(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Window || - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::GlassDoor || - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Door) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Multiplier = int(s_ipsc->rNumericArgs(2)); + surfTemp.Vertex.allocate(surfTemp.Sides); + if (surfTemp.Class == SurfaceClass::Window || surfTemp.Class == SurfaceClass::GlassDoor || surfTemp.Class == SurfaceClass::Door) + surfTemp.Multiplier = int(s_ipsc->rNumericArgs(2)); // Only windows, glass doors and doors can have Multiplier > 1: - if ((state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class != SurfaceClass::Window && - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class != SurfaceClass::GlassDoor && - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class != SurfaceClass::Door) && + if ((surfTemp.Class != SurfaceClass::Window && surfTemp.Class != SurfaceClass::GlassDoor && surfTemp.Class != SurfaceClass::Door) && s_ipsc->rNumericArgs(2) > 1.0) { ShowWarningError(state, format("{}=\"{}\", invalid {}=[{:.1T}].", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cNumericFieldNames(2), s_ipsc->rNumericArgs(2))); ShowContinueError(state, format("...because {}={} multiplier will be set to 1.0.", s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Multiplier = 1.0; + surfTemp.Multiplier = 1.0; } - GetVertices(state, SurfNum, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides, s_ipsc->rNumericArgs({4, _})); + GetVertices(state, SurfNum, surfTemp.Sides, s_ipsc->rNumericArgs({4, _})); - CheckConvexity(state, SurfNum, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).windowShadingControlList.clear(); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).activeWindowShadingControl = 0; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).HasShadeControl = false; + CheckConvexity(state, SurfNum, surfTemp.Sides); + surfTemp.windowShadingControlList.clear(); + surfTemp.activeWindowShadingControl = 0; + surfTemp.HasShadeControl = false; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).shadedConstructionList.clear(); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).activeShadedConstruction = 0; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).shadedStormWinConstructionList.clear(); + surfTemp.shadedConstructionList.clear(); + surfTemp.activeShadedConstruction = 0; + surfTemp.shadedStormWinConstructionList.clear(); - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Window || - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::GlassDoor || - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::TDD_Diffuser || - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::TDD_Dome) { + if (surfTemp.Class == SurfaceClass::Window || surfTemp.Class == SurfaceClass::GlassDoor || surfTemp.Class == SurfaceClass::TDD_Diffuser || + surfTemp.Class == SurfaceClass::TDD_Dome) { - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == OtherSideCoefNoCalcExt || - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == OtherSideCoefCalcExt) { - ShowSevereError(state, - format("{}=\"{}\", Other side coefficients are not allowed with windows.", - s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); + if (surfTemp.ExtBoundCond == DataSurfaces::OtherSideCoefNoCalcExt || surfTemp.ExtBoundCond == DataSurfaces::OtherSideCoefCalcExt) { + ShowSevereError( + state, + format("{}=\"{}\", Other side coefficients are not allowed with windows.", s_ipsc->cCurrentModuleObject, surfTemp.Name)); ErrorsFound = true; } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == Ground) { + if (surfTemp.ExtBoundCond == DataSurfaces::Ground) { ShowSevereError(state, format("{}=\"{}\", Exterior boundary condition = Ground is not allowed with windows.", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); + surfTemp.Name)); ErrorsFound = true; } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == KivaFoundation) { + if (surfTemp.ExtBoundCond == DataSurfaces::KivaFoundation) { ShowSevereError(state, format("{}=\"{}\", Exterior boundary condition = Foundation is not allowed with windows.", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); + surfTemp.Name)); ErrorsFound = true; } @@ -5308,18 +5028,18 @@ namespace SurfaceGeometry { CheckWindowShadingControlFrameDivider(state, "GetHTSubSurfaceData", ErrorsFound, SurfNum, 6); - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides == 3) { // Triangular window + if (surfTemp.Sides == 3) { // Triangular window if (!s_ipsc->cAlphaArgs(6).empty()) { ShowWarningError(state, format("{}=\"{}\", invalid {}=\"{}\".", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(6), s_ipsc->cAlphaArgs(6))); ShowContinueError(state, ".. because it is a triangular window and cannot have a frame or divider or reveal reflection."); ShowContinueError(state, "Frame, divider and reveal reflection will be ignored for this window."); } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).FrameDivider = 0; + surfTemp.FrameDivider = 0; } // End of check if window is triangular or rectangular } // check on non-opaquedoor subsurfaces @@ -5348,23 +5068,14 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN December 2008 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Get simple (rectangular, relative origin to base surface) windows, doors, glazed doors. - // Using/Aliasing - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // data file entry with two glazing systems - // SUBROUTINE PARAMETER DEFINITIONS: static Array1D_string const cModuleObjects(6, {"Window", "Door", "GlazedDoor", "Window:Interzone", "Door:Interzone", "GlazedDoor:Interzone"}); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int Item; int ItemsToGet; int Loop; int NumAlphas; @@ -5372,55 +5083,48 @@ namespace SurfaceGeometry { int IOStat; // IO Status when calling get input subroutine int Found; // For matching base surfaces bool GettingIZSurfaces; - int WindowShadingField; int FrameField; int OtherSurfaceField; int ClassItem; int IZFound; auto &s_ipsc = state.dataIPShortCut; - for (Item = 1; Item <= 6; ++Item) { + for (int Item = 1; Item <= 6; ++Item) { s_ipsc->cCurrentModuleObject = cModuleObjects(Item); if (Item == 1) { ItemsToGet = TotWindows; GettingIZSurfaces = false; - WindowShadingField = 4; FrameField = 5; OtherSurfaceField = 0; ClassItem = 1; } else if (Item == 2) { ItemsToGet = TotDoors; GettingIZSurfaces = false; - WindowShadingField = 0; FrameField = 0; OtherSurfaceField = 0; ClassItem = 2; } else if (Item == 3) { ItemsToGet = TotGlazedDoors; GettingIZSurfaces = false; - WindowShadingField = 4; FrameField = 5; OtherSurfaceField = 0; ClassItem = 3; } else if (Item == 4) { ItemsToGet = TotIZWindows; GettingIZSurfaces = true; - WindowShadingField = 0; FrameField = 0; OtherSurfaceField = 4; ClassItem = 1; } else if (Item == 5) { ItemsToGet = TotIZDoors; GettingIZSurfaces = true; - WindowShadingField = 0; FrameField = 0; OtherSurfaceField = 4; ClassItem = 2; } else { // Item = 6 ItemsToGet = TotIZGlazedDoors; GettingIZSurfaces = true; - WindowShadingField = 0; FrameField = 0; OtherSurfaceField = 4; ClassItem = 3; @@ -5457,91 +5161,89 @@ namespace SurfaceGeometry { } ++SurfNum; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = s_ipsc->cAlphaArgs(1); // Set the Surface Name in the Derived Type - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = SubSurfIDs(ClassItem); // Set class number + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); + + surfTemp.Name = s_ipsc->cAlphaArgs(1); // Set the Surface Name in the Derived Type + surfTemp.Class = SubSurfIDs(ClassItem); // Set class number - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction = + surfTemp.Construction = Util::FindItemInList(s_ipsc->cAlphaArgs(2), state.dataConstruction->Construct, state.dataHeatBal->TotConstructs); - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction == 0) { + if (surfTemp.Construction == 0) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); } else { - state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).IsUsed = true; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ConstructionStoredInputValue = - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction; + state.dataConstruction->Construct(surfTemp.Construction).IsUsed = true; + surfTemp.ConstructionStoredInputValue = surfTemp.Construction; } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Window || - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::GlassDoor) { + if (surfTemp.Class == SurfaceClass::Window || surfTemp.Class == SurfaceClass::GlassDoor) { + + if (surfTemp.Construction != 0) { + auto const &construction = state.dataConstruction->Construct(surfTemp.Construction); - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction != 0) { - auto &construction = state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction); if (!construction.TypeIsWindow && !construction.TypeIsAirBoundary) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\" has an opaque surface construction; it should have a window construction.", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); + surfTemp.Name)); } - if (state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).SourceSinkPresent) { + if (state.dataConstruction->Construct(surfTemp.Construction).SourceSinkPresent) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\": Windows are not allowed to have embedded sources/sinks", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); + surfTemp.Name)); } } - } else if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction != 0) { - if (state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).TypeIsWindow) { + } else if (surfTemp.Construction != 0) { + if (state.dataConstruction->Construct(surfTemp.Construction).TypeIsWindow) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\" - has Window materials.", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); } } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).HeatTransSurf = true; + surfTemp.HeatTransSurf = true; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurfName = s_ipsc->cAlphaArgs(3); + surfTemp.BaseSurfName = s_ipsc->cAlphaArgs(3); // The subsurface inherits properties from the base surface // Exterior conditions, Zone, etc. // We can figure out the base surface though, because they've all been entered - Found = Util::FindItemInList(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurfName, - state.dataSurfaceGeometry->SurfaceTmp, - state.dataSurface->TotSurfaces); + Found = Util::FindItemInList(surfTemp.BaseSurfName, state.dataSurfaceGeometry->SurfaceTmp, state.dataSurface->TotSurfaces); if (Found > 0) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf = Found; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtBoundCond; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtBoundCondName; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtSolar = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtSolar; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtWind = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtWind; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt = state.dataSurfaceGeometry->SurfaceTmp(Found).Tilt; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).convOrientation = - Convect::GetSurfConvOrientation(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth = state.dataSurfaceGeometry->SurfaceTmp(Found).Azimuth; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone = state.dataSurfaceGeometry->SurfaceTmp(Found).Zone; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName = state.dataSurfaceGeometry->SurfaceTmp(Found).ZoneName; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OSCPtr = state.dataSurfaceGeometry->SurfaceTmp(Found).OSCPtr; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorGround = state.dataSurfaceGeometry->SurfaceTmp(Found).ViewFactorGround; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorSky = state.dataSurfaceGeometry->SurfaceTmp(Found).ViewFactorSky; + surfTemp.BaseSurf = Found; + surfTemp.ExtBoundCond = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtBoundCond; + surfTemp.ExtBoundCondName = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtBoundCondName; + surfTemp.ExtSolar = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtSolar; + surfTemp.ExtWind = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtWind; + surfTemp.Tilt = state.dataSurfaceGeometry->SurfaceTmp(Found).Tilt; + surfTemp.convOrientation = Convect::GetSurfConvOrientation(surfTemp.Tilt); + surfTemp.Azimuth = state.dataSurfaceGeometry->SurfaceTmp(Found).Azimuth; + surfTemp.Zone = state.dataSurfaceGeometry->SurfaceTmp(Found).Zone; + surfTemp.ZoneName = state.dataSurfaceGeometry->SurfaceTmp(Found).ZoneName; + surfTemp.OSCPtr = state.dataSurfaceGeometry->SurfaceTmp(Found).OSCPtr; + surfTemp.ViewFactorGround = state.dataSurfaceGeometry->SurfaceTmp(Found).ViewFactorGround; + surfTemp.ViewFactorSky = state.dataSurfaceGeometry->SurfaceTmp(Found).ViewFactorSky; } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3))); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName = "Unknown Zone"; + surfTemp.ZoneName = "Unknown Zone"; ErrorsFound = true; continue; } @@ -5551,7 +5253,7 @@ namespace SurfaceGeometry { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\".", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3))); ShowContinueError(state, "... adiabatic surfaces cannot have windows or doors."); @@ -5560,45 +5262,39 @@ namespace SurfaceGeometry { "Interzone surfaces for transmission to result."); } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == UnreconciledZoneSurface) { // "Surface" Base Surface + if (surfTemp.ExtBoundCond == UnreconciledZoneSurface) { // "Surface" Base Surface if (!GettingIZSurfaces) { - ShowSevereError(state, - format("{}=\"{}\", invalid use of object", - s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); + ShowSevereError(state, format("{}=\"{}\", invalid use of object", s_ipsc->cCurrentModuleObject, surfTemp.Name)); ShowContinueError( state, format( "...when Base surface uses \"Surface\" as {}, subsurfaces must also specify specific surfaces in the adjacent zone.", s_ipsc->cAlphaFieldNames(5))); ShowContinueError(state, format("...Please use {}:Interzone to enter this surface.", s_ipsc->cCurrentModuleObject)); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = - BlankString; // putting it as blank will not confuse things later. + surfTemp.ExtBoundCondName = BlankString; // putting it as blank will not confuse things later. ErrorsFound = true; } } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == UnreconciledZoneSurface) { // "Surface" Base Surface + if (surfTemp.ExtBoundCond == UnreconciledZoneSurface) { // "Surface" Base Surface if (GettingIZSurfaces) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = s_ipsc->cAlphaArgs(OtherSurfaceField); - IZFound = Util::FindItemInList( - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName, state.dataHeatBal->Zone, state.dataGlobal->NumOfZones); - if (IZFound > 0) state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = UnenteredAdjacentZoneSurface; + surfTemp.ExtBoundCondName = s_ipsc->cAlphaArgs(OtherSurfaceField); + IZFound = Util::FindItemInList(surfTemp.ExtBoundCondName, state.dataHeatBal->Zone, state.dataGlobal->NumOfZones); + if (IZFound > 0) surfTemp.ExtBoundCond = UnenteredAdjacentZoneSurface; } else { // Interior Window - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name; + surfTemp.ExtBoundCondName = surfTemp.Name; } } // This is the parent's property: - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == - UnenteredAdjacentZoneSurface) { // OtherZone - unmatched interior surface + if (surfTemp.ExtBoundCond == UnenteredAdjacentZoneSurface) { // OtherZone - unmatched interior surface if (GettingIZSurfaces) { ++NeedToAddSubSurfaces; } else { // Interior Window ShowSevereError(state, format("{}=\"{}\", invalid Interzone Surface, specify {}:InterZone", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cCurrentModuleObject)); ShowContinueError(state, "...when base surface is an interzone surface, subsurface must also be an interzone surface."); ++NeedToAddSubSurfaces; @@ -5609,19 +5305,15 @@ namespace SurfaceGeometry { if (GettingIZSurfaces) { if (s_ipsc->lAlphaFieldBlanks(OtherSurfaceField)) { // blank -- set it up for unentered adjacent zone - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == - UnenteredAdjacentZoneSurface) { // already set but need Zone - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = - state.dataSurfaceGeometry->SurfaceTmp(Found).ExtBoundCondName; // base surface has it - } else if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == UnreconciledZoneSurface) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = - state.dataSurfaceGeometry->SurfaceTmp(Found).ZoneName; // base surface has it - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = UnenteredAdjacentZoneSurface; + if (surfTemp.ExtBoundCond == UnenteredAdjacentZoneSurface) { // already set but need Zone + surfTemp.ExtBoundCondName = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtBoundCondName; // base surface has it + } else if (surfTemp.ExtBoundCond == UnreconciledZoneSurface) { + surfTemp.ExtBoundCondName = state.dataSurfaceGeometry->SurfaceTmp(Found).ZoneName; // base surface has it + surfTemp.ExtBoundCond = UnenteredAdjacentZoneSurface; } else { // not correct boundary condition for interzone subsurface - ShowSevereError(state, - format("{}=\"{}\", invalid Base Surface type for Interzone Surface", - s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); + ShowSevereError( + state, + format("{}=\"{}\", invalid Base Surface type for Interzone Surface", s_ipsc->cCurrentModuleObject, surfTemp.Name)); ShowContinueError(state, "...when base surface is not an interzone surface, subsurface must also not be an interzone surface."); ErrorsFound = true; @@ -5629,78 +5321,68 @@ namespace SurfaceGeometry { } } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == OtherSideCondModeledExt) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = ExternalEnvironment; + if (surfTemp.ExtBoundCond == DataSurfaces::OtherSideCondModeledExt) { + surfTemp.ExtBoundCond = DataSurfaces::ExternalEnvironment; } // SurfaceTmp(SurfNum)%ViewFactorGround = AutoCalculate - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = 4; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex.allocate(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Window || - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::GlassDoor || - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Door) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Multiplier = int(s_ipsc->rNumericArgs(1)); - // Only windows, glass doors and doors can have Multiplier > 1: - if ((state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class != SurfaceClass::Window && - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class != SurfaceClass::GlassDoor && - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class != SurfaceClass::Door) && - s_ipsc->rNumericArgs(1) > 1.0) { + surfTemp.Sides = 4; + surfTemp.Vertex.allocate(surfTemp.Sides); + if (surfTemp.Class == SurfaceClass::Window || surfTemp.Class == SurfaceClass::GlassDoor || surfTemp.Class == SurfaceClass::Door) { + surfTemp.Multiplier = int(s_ipsc->rNumericArgs(1)); + } else if (s_ipsc->rNumericArgs(1) > 1.0) { ShowWarningError(state, format("{}=\"{}\", invalid {}=[{:.1T}].", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cNumericFieldNames(1), s_ipsc->rNumericArgs(1))); ShowContinueError(state, format("...because {}={} multiplier will be set to 1.0.", s_ipsc->cAlphaFieldNames(1), s_ipsc->cAlphaArgs(1))); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Multiplier = 1.0; + surfTemp.Multiplier = 1.0; } MakeRelativeRectangularVertices(state, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf, + surfTemp.BaseSurf, SurfNum, s_ipsc->rNumericArgs(2), s_ipsc->rNumericArgs(3), s_ipsc->rNumericArgs(4), s_ipsc->rNumericArgs(5)); - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area <= 0.0) { - ShowSevereError(state, - format("{}=\"{}\", Surface Area <= 0.0; Entered Area={:.2T}", - s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area)); + if (surfTemp.Area <= 0.0) { + ShowSevereError( + state, + format("{}=\"{}\", Surface Area <= 0.0; Entered Area={:.2T}", s_ipsc->cCurrentModuleObject, surfTemp.Name, surfTemp.Area)); ErrorsFound = true; } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).windowShadingControlList.clear(); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).activeWindowShadingControl = 0; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).HasShadeControl = false; + surfTemp.windowShadingControlList.clear(); + surfTemp.activeWindowShadingControl = 0; + surfTemp.HasShadeControl = false; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).shadedConstructionList.clear(); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).activeShadedConstruction = 0; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).shadedStormWinConstructionList.clear(); + surfTemp.shadedConstructionList.clear(); + surfTemp.activeShadedConstruction = 0; + surfTemp.shadedStormWinConstructionList.clear(); InitialAssociateWindowShadingControlFenestration(state, ErrorsFound, SurfNum); - if (!GettingIZSurfaces && (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Window || - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::GlassDoor)) { + if (!GettingIZSurfaces && (surfTemp.Class == SurfaceClass::Window || surfTemp.Class == SurfaceClass::GlassDoor)) { - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == OtherSideCoefNoCalcExt || - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == OtherSideCoefCalcExt) { - ShowSevereError(state, - format("{}=\"{}\", Other side coefficients are not allowed with windows.", - s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); + if (surfTemp.ExtBoundCond == DataSurfaces::OtherSideCoefNoCalcExt || + surfTemp.ExtBoundCond == DataSurfaces::OtherSideCoefCalcExt) { + ShowSevereError( + state, + format("{}=\"{}\", Other side coefficients are not allowed with windows.", s_ipsc->cCurrentModuleObject, surfTemp.Name)); ErrorsFound = true; } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == Ground) { + if (surfTemp.ExtBoundCond == DataSurfaces::Ground) { ShowSevereError(state, format("{}=\"{}\", Exterior boundary condition = Ground is not allowed with windows.", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); + surfTemp.Name)); ErrorsFound = true; } @@ -5726,17 +5408,12 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN December 2008 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This routine performs checks on WindowShadingControl settings and Frame/Divider Settings. - // Using/Aliasing - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int ConstrNumSh; // Construction number with Shade - int ConstrNum; // Construction number int ShDevNum; // Shading Device number int Lay; // Layer number int TotGlassLayers; // Number of glass layers in window construction @@ -5756,29 +5433,28 @@ namespace SurfaceGeometry { auto &s_ipsc = state.dataIPShortCut; auto &s_mat = state.dataMaterial; - for (std::size_t shadeControlIndex = 0; shadeControlIndex < state.dataSurfaceGeometry->SurfaceTmp(SurfNum).windowShadingControlList.size(); - ++shadeControlIndex) { - int WSCPtr = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).windowShadingControlList[shadeControlIndex]; + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); + + for (std::size_t shadeControlIndex = 0; shadeControlIndex < surfTemp.windowShadingControlList.size(); ++shadeControlIndex) { + int WSCPtr = surfTemp.windowShadingControlList[shadeControlIndex]; ConstrNumSh = 0; - if (!ErrorsFound && state.dataSurfaceGeometry->SurfaceTmp(SurfNum).HasShadeControl) { - ConstrNumSh = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).shadedConstructionList[shadeControlIndex]; + if (!ErrorsFound && surfTemp.HasShadeControl) { + ConstrNumSh = surfTemp.shadedConstructionList[shadeControlIndex]; if (ConstrNumSh > 0) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).activeShadedConstruction = ConstrNumSh; - } else { - if (ANY_INTERIOR_SHADE_BLIND(state.dataSurface->WindowShadingControl(WSCPtr).ShadingType) || - ANY_EXTERIOR_SHADE_BLIND_SCREEN(state.dataSurface->WindowShadingControl(WSCPtr).ShadingType)) { - ShDevNum = state.dataSurface->WindowShadingControl(WSCPtr).ShadingDevice; - if (ShDevNum > 0) { - CreateShadedWindowConstruction(state, SurfNum, WSCPtr, ShDevNum, shadeControlIndex); - ConstrNumSh = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).activeShadedConstruction; - } + surfTemp.activeShadedConstruction = ConstrNumSh; + } else if (ANY_INTERIOR_SHADE_BLIND(state.dataSurface->WindowShadingControl(WSCPtr).ShadingType) || + ANY_EXTERIOR_SHADE_BLIND_SCREEN(state.dataSurface->WindowShadingControl(WSCPtr).ShadingType)) { + ShDevNum = state.dataSurface->WindowShadingControl(WSCPtr).ShadingDevice; + if (ShDevNum > 0) { + CreateShadedWindowConstruction(state, SurfNum, WSCPtr, ShDevNum, shadeControlIndex); + ConstrNumSh = surfTemp.activeShadedConstruction; } } } // Error checks for shades and blinds - ConstrNum = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction; + int ConstrNum = surfTemp.Construction; if (!ErrorsFound && WSCPtr > 0 && ConstrNum > 0 && ConstrNumSh > 0) { if (ANY_INTERIOR_SHADE_BLIND(state.dataSurface->WindowShadingControl(WSCPtr).ShadingType)) { @@ -5801,7 +5477,7 @@ namespace SurfaceGeometry { ErrorsFound = true; ShowSevereError(state, format(" The glass and gas layers in the shaded and unshaded constructions do not match for window={}", - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); + surfTemp.Name)); ShowContinueError(state, format("Unshaded construction={}", state.dataConstruction->Construct(ConstrNum).Name)); ShowContinueError(state, format("Shaded construction={}", state.dataConstruction->Construct(ConstrNumSh).Name)); break; @@ -5829,7 +5505,7 @@ namespace SurfaceGeometry { ErrorsFound = true; ShowSevereError(state, format(" The glass and gas layers in the shaded and unshaded constructions do not match for window={}", - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); + surfTemp.Name)); ShowContinueError(state, format("Unshaded construction={}", state.dataConstruction->Construct(ConstrNum).Name)); ShowContinueError(state, format("Shaded construction={}", state.dataConstruction->Construct(ConstrNumSh).Name)); break; @@ -5839,13 +5515,12 @@ namespace SurfaceGeometry { if (ANY_BETWEENGLASS_SHADE_BLIND(state.dataSurface->WindowShadingControl(WSCPtr).ShadingType)) { // Divider not allowed with between-glass shade or blind - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).FrameDivider > 0) { - if (state.dataSurface->FrameDivider(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).FrameDivider).DividerWidth > 0.0) { - ShowWarningError( - state, format("A divider cannot be specified for window {}", state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); + if (surfTemp.FrameDivider > 0) { + if (state.dataSurface->FrameDivider(surfTemp.FrameDivider).DividerWidth > 0.0) { + ShowWarningError(state, format("A divider cannot be specified for window {}", surfTemp.Name)); ShowContinueError(state, ", which has a between-glass shade or blind."); ShowContinueError(state, "Calculation will proceed without the divider for this window."); - state.dataSurface->FrameDivider(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).FrameDivider).DividerWidth = 0.0; + state.dataSurface->FrameDivider(surfTemp.FrameDivider).DividerWidth = 0.0; } } // Check consistency of gap widths between unshaded and shaded constructions @@ -5893,7 +5568,7 @@ namespace SurfaceGeometry { MatGap1 = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(2 * TotGlassLayers - 2); MatGap2 = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(2 * TotGlassLayers); MatSh = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(2 * TotGlassLayers - 1); - if (state.dataSurface->WindowShadingControl(WSCPtr).ShadingType == WinShadingType::BGBlind) { + if (state.dataSurface->WindowShadingControl(WSCPtr).ShadingType == DataSurfaces::WinShadingType::BGBlind) { MatGapCalc = std::abs(s_mat->materials(MatGap)->Thickness - (s_mat->materials(MatGap1)->Thickness + s_mat->materials(MatGap2)->Thickness)); if (MatGapCalc > 0.001) { @@ -5904,9 +5579,7 @@ namespace SurfaceGeometry { ShowContinueError(state, "are inconsistent with the gap widths for shaded window construction " + state.dataConstruction->Construct(ConstrNumSh).Name); - ShowContinueError(state, - "for window " + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name + - ", which has a between-glass blind."); + ShowContinueError(state, "for window " + surfTemp.Name + ", which has a between-glass blind."); ShowContinueError( state, format("..Material={} thickness={:.3R} -", s_mat->materials(MatGap)->Name, s_mat->materials(MatGap)->Thickness)); @@ -5933,9 +5606,7 @@ namespace SurfaceGeometry { ShowContinueError(state, "are inconsistent with the gap widths for shaded window construction " + state.dataConstruction->Construct(ConstrNumSh).Name); - ShowContinueError(state, - "for window " + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name + - ", which has a between-glass shade."); + ShowContinueError(state, "for window " + surfTemp.Name + ", which has a between-glass shade."); ShowContinueError( state, format("..Material={} thickness={:.3R} -", s_mat->materials(MatGap)->Name, s_mat->materials(MatGap)->Thickness)); @@ -5960,7 +5631,7 @@ namespace SurfaceGeometry { } } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides != 3) { // Rectangular Window + if (surfTemp.Sides != 3) { // Rectangular Window // Initialize the FrameDivider number for this window. W5FrameDivider will be positive if // this window's construction came from the Window5 data file and that construction had an // associated frame or divider. It will be zero if the window's construction is not from the @@ -5968,32 +5639,30 @@ namespace SurfaceGeometry { // associated frame or divider. Note that if there is a FrameDivider candidate for this // window from the Window5 data file it is used instead of the window's input FrameDivider. - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction != 0) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).FrameDivider = - state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).W5FrameDivider; + if (surfTemp.Construction != 0) { + surfTemp.FrameDivider = state.dataConstruction->Construct(surfTemp.Construction).W5FrameDivider; // Warning if FrameAndDivider for this window is over-ridden by one from Window5 Data File - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).FrameDivider > 0 && !s_ipsc->lAlphaFieldBlanks(FrameField)) { + if (surfTemp.FrameDivider > 0 && !s_ipsc->lAlphaFieldBlanks(FrameField)) { ShowSevereError(state, format("{}=\"{}\", {}=\"{}\"", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(FrameField), s_ipsc->cAlphaArgs(FrameField))); ShowContinueError(state, format("will be replaced with FrameAndDivider from Window5 Data File entry {}", - state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).Name)); + state.dataConstruction->Construct(surfTemp.Construction).Name)); } - if (!s_ipsc->lAlphaFieldBlanks(FrameField) && state.dataSurfaceGeometry->SurfaceTmp(SurfNum).FrameDivider == 0) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).FrameDivider = - Util::FindItemInList(s_ipsc->cAlphaArgs(FrameField), state.dataSurface->FrameDivider); - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).FrameDivider == 0) { - if (!state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).WindowTypeEQL) { + if (!s_ipsc->lAlphaFieldBlanks(FrameField) && surfTemp.FrameDivider == 0) { + surfTemp.FrameDivider = Util::FindItemInList(s_ipsc->cAlphaArgs(FrameField), state.dataSurface->FrameDivider); + if (surfTemp.FrameDivider == 0) { + if (!state.dataConstruction->Construct(surfTemp.Construction).WindowTypeEQL) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\"", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(FrameField), s_ipsc->cAlphaArgs(FrameField))); ErrorsFound = true; @@ -6001,23 +5670,22 @@ namespace SurfaceGeometry { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\"", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(FrameField), s_ipsc->cAlphaArgs(FrameField))); ShowContinueError(state, "...Frame/Divider is not supported in Equivalent Layer Window model."); } } // Divider not allowed with between-glass shade or blind - for (int WSCPtr : state.dataSurfaceGeometry->SurfaceTmp(SurfNum).windowShadingControlList) { + for (int WSCPtr : surfTemp.windowShadingControlList) { if (!ErrorsFound && WSCPtr > 0 && ConstrNumSh > 0) { if (ANY_BETWEENGLASS_SHADE_BLIND(state.dataSurface->WindowShadingControl(WSCPtr).ShadingType)) { - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).FrameDivider > 0) { - if (state.dataSurface->FrameDivider(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).FrameDivider).DividerWidth > - 0.0) { + if (surfTemp.FrameDivider > 0) { + if (state.dataSurface->FrameDivider(surfTemp.FrameDivider).DividerWidth > 0.0) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\"", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(FrameField), s_ipsc->cAlphaArgs(FrameField))); ShowContinueError(state, @@ -6025,11 +5693,8 @@ namespace SurfaceGeometry { ShowContinueError(state, "Calculation will proceed without the divider for this window."); ShowContinueError( state, - format("Divider width = [{:.2R}].", - state.dataSurface->FrameDivider(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).FrameDivider) - .DividerWidth)); - state.dataSurface->FrameDivider(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).FrameDivider).DividerWidth = - 0.0; + format("Divider width = [{:.2R}].", state.dataSurface->FrameDivider(surfTemp.FrameDivider).DividerWidth)); + state.dataSurface->FrameDivider(surfTemp.FrameDivider).DividerWidth = 0.0; } } // End of check if window has divider } // End of check if window has a between-glass shade or blind @@ -6039,17 +5704,17 @@ namespace SurfaceGeometry { } // End of check if window has a construction } - if (state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).WindowTypeEQL) { - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).FrameDivider > 0) { + if (state.dataConstruction->Construct(surfTemp.Construction).WindowTypeEQL) { + if (surfTemp.FrameDivider > 0) { // Equivalent Layer window does not have frame/divider model ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}\"", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(FrameField), s_ipsc->cAlphaArgs(FrameField))); ShowContinueError(state, "Frame/Divider is not supported in Equivalent Layer Window model."); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).FrameDivider = 0; + surfTemp.FrameDivider = 0; } } } @@ -6066,34 +5731,19 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN December 2008 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This routine performs miscellaneous checks on subsurfaces: Windows, GlassDoors, Doors, Tubular Devices. - // Using/Aliasing - - using namespace DataErrorTracking; - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int NumShades; // count on number of shading layers - int Lay; // Layer number - int LayerPtr; // Layer pointer - int ConstrNum; // Construction number - int Found; // when item is found - auto &s_mat = state.dataMaterial; // Warning if window has multiplier > 1 and SolarDistribution = FullExterior or FullInteriorExterior - if ((state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Window || - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::GlassDoor) && + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); + if ((surfTemp.Class == SurfaceClass::Window || surfTemp.Class == SurfaceClass::GlassDoor) && static_cast(state.dataHeatBal->SolarDistribution) > static_cast(DataHeatBalance::Shadowing::Minimal) && - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Multiplier > 1.0) { + surfTemp.Multiplier > 1.0) { if (state.dataGlobal->DisplayExtraWarnings) { - ShowWarningError( - state, - format("{}: A Multiplier > 1.0 for window/glass door {}", cRoutineName, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); + ShowWarningError(state, format("{}: A Multiplier > 1.0 for window/glass door {}", cRoutineName, surfTemp.Name)); ShowContinueError(state, "in conjunction with SolarDistribution = FullExterior or FullInteriorExterior"); ShowContinueError(state, "can cause inaccurate shadowing on the window and/or"); ShowContinueError(state, "inaccurate interior solar distribution from the window."); @@ -6103,11 +5753,12 @@ namespace SurfaceGeometry { // Require that a construction referenced by a surface that is a window // NOT have a shading device layer; use WindowShadingControl to specify a shading device. - ConstrNum = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction; + + int ConstrNum = surfTemp.Construction; if (ConstrNum > 0) { - NumShades = 0; - for (Lay = 1; Lay <= state.dataConstruction->Construct(ConstrNum).TotLayers; ++Lay) { - LayerPtr = state.dataConstruction->Construct(ConstrNum).LayerPoint(Lay); + int NumShades = 0; + for (int Lay = 1; Lay <= state.dataConstruction->Construct(ConstrNum).TotLayers; ++Lay) { + int LayerPtr = state.dataConstruction->Construct(ConstrNum).LayerPoint(Lay); if (LayerPtr == 0) continue; // Error is caught already, will terminate later if (s_mat->materials(LayerPtr)->group == Material::Group::Shade || s_mat->materials(LayerPtr)->group == Material::Group::Blind || s_mat->materials(LayerPtr)->group == Material::Group::Screen) @@ -6123,13 +5774,12 @@ namespace SurfaceGeometry { // Disallow glass transmittance dirt factor for interior windows and glass doors - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond != ExternalEnvironment && - (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Window || - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::GlassDoor)) { - ConstrNum = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction; + if (surfTemp.ExtBoundCond != DataSurfaces::ExternalEnvironment && + (surfTemp.Class == SurfaceClass::Window || surfTemp.Class == SurfaceClass::GlassDoor)) { + ConstrNum = surfTemp.Construction; if (ConstrNum > 0) { - for (Lay = 1; Lay <= state.dataConstruction->Construct(ConstrNum).TotLayers; ++Lay) { - LayerPtr = state.dataConstruction->Construct(ConstrNum).LayerPoint(Lay); + for (int Lay = 1; Lay <= state.dataConstruction->Construct(ConstrNum).TotLayers; ++Lay) { + int LayerPtr = state.dataConstruction->Construct(ConstrNum).LayerPoint(Lay); auto const *mat = s_mat->materials(LayerPtr); if (mat->group != Material::Group::Glass) continue; @@ -6149,9 +5799,9 @@ namespace SurfaceGeometry { // (2) if two glazing systems (separated by a mullion) on Data File, create a second window // and adjust the dimensions of the original and second windows to those on the Data File - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction != 0) { + if (surfTemp.Construction != 0) { - if (state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).FromWindow5DataFile) { + if (state.dataConstruction->Construct(surfTemp.Construction).FromWindow5DataFile) { ModifyWindow(state, SurfNum, ErrorsFound, AddedSubSurfaces); @@ -6159,43 +5809,37 @@ namespace SurfaceGeometry { // Calculate net area for base surface (note that ModifyWindow, above, adjusts net area of // base surface for case where window construction is from Window5 Data File // In case there is in error in this window's base surface (i.e. none).. - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf > 0) { - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf).Area -= - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area; + if (surfTemp.BaseSurf > 0) { + state.dataSurfaceGeometry->SurfaceTmp(surfTemp.BaseSurf).Area -= surfTemp.Area; // Subtract TDD:DIFFUSER area from other side interzone surface - if ((state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::TDD_Diffuser) && - not_blank(state.dataSurfaceGeometry->SurfaceTmp(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf) - .ExtBoundCondName)) { // Base surface is an interzone surface + if ((surfTemp.Class == SurfaceClass::TDD_Diffuser) && + not_blank( + state.dataSurfaceGeometry->SurfaceTmp(surfTemp.BaseSurf).ExtBoundCondName)) { // Base surface is an interzone surface // Lookup interzone surface of the base surface // (Interzone surfaces have not been assigned yet, but all base surfaces should already be loaded.) - Found = Util::FindItemInList( - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf).ExtBoundCondName, - state.dataSurfaceGeometry->SurfaceTmp, - SurfNum); - if (Found != 0) state.dataSurfaceGeometry->SurfaceTmp(Found).Area -= state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area; + int Found = Util::FindItemInList(state.dataSurfaceGeometry->SurfaceTmp(surfTemp.BaseSurf).ExtBoundCondName, + state.dataSurfaceGeometry->SurfaceTmp, + SurfNum); + if (Found != 0) state.dataSurfaceGeometry->SurfaceTmp(Found).Area -= surfTemp.Area; } - if (state.dataSurfaceGeometry->SurfaceTmp(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf).Area <= 0.0) { + if (state.dataSurfaceGeometry->SurfaceTmp(surfTemp.BaseSurf).Area <= 0.0) { ShowSevereError(state, format("{}: Surface Openings have too much area for base surface={}", cRoutineName, - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf).Name)); - ShowContinueError(state, format("Opening Surface creating error={}", state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); + state.dataSurfaceGeometry->SurfaceTmp(surfTemp.BaseSurf).Name)); + ShowContinueError(state, format("Opening Surface creating error={}", surfTemp.Name)); ErrorsFound = true; } // Net area of base surface with unity window multipliers (used in shadowing checks) // For Windows, Glass Doors and Doors, just one area is subtracted. For the rest, should be // full area. - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Window || - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::GlassDoor) { - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf).NetAreaShadowCalc -= - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area / state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Multiplier; - } else if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Door) { // Door, TDD:Diffuser, TDD:DOME - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf).NetAreaShadowCalc -= - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area / state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Multiplier; + if (surfTemp.Class == SurfaceClass::Window || surfTemp.Class == SurfaceClass::GlassDoor) { + state.dataSurfaceGeometry->SurfaceTmp(surfTemp.BaseSurf).NetAreaShadowCalc -= surfTemp.Area / surfTemp.Multiplier; + } else if (surfTemp.Class == SurfaceClass::Door) { // Door, TDD:Diffuser, TDD:DOME + state.dataSurfaceGeometry->SurfaceTmp(surfTemp.BaseSurf).NetAreaShadowCalc -= surfTemp.Area / surfTemp.Multiplier; } else { - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf).NetAreaShadowCalc -= - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area; + state.dataSurfaceGeometry->SurfaceTmp(surfTemp.BaseSurf).NetAreaShadowCalc -= surfTemp.Area; } } } @@ -6214,76 +5858,40 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN December 2008 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This routine creates world/3d coordinates for rectangular surfaces using relative X and Z, length & height. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // Using/Aliasing - using namespace Vectors; - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 SurfAzimuth; // Surface Azimuth/Facing (same as Base Surface) - Real64 SurfTilt; // Tilt (same as Base Surface) - Real64 XLLC; - Real64 YLLC; - Real64 ZLLC; - Real64 CosSurfAzimuth; - Real64 SinSurfAzimuth; - Real64 CosSurfTilt; - Real64 SinSurfTilt; - Real64 BaseCosSurfAzimuth; - Real64 BaseSinSurfAzimuth; - Real64 BaseCosSurfTilt; - Real64 BaseSinSurfTilt; Array1D XX(4); Array1D YY(4); Real64 Perimeter; - int n; int Vrt; if (BaseSurfNum == 0) return; // invalid base surface, don't bother // Tilt and Facing (Azimuth) will be same as the Base Surface - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Height = Height; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Width = Length; - - SurfAzimuth = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth; - SurfTilt = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt; - CosSurfAzimuth = std::cos(SurfAzimuth * Constant::DegToRadians); - SinSurfAzimuth = std::sin(SurfAzimuth * Constant::DegToRadians); - CosSurfTilt = std::cos(SurfTilt * Constant::DegToRadians); - SinSurfTilt = std::sin(SurfTilt * Constant::DegToRadians); - BaseCosSurfAzimuth = state.dataSurfaceGeometry->SurfaceTmp(BaseSurfNum).CosAzim; - BaseSinSurfAzimuth = state.dataSurfaceGeometry->SurfaceTmp(BaseSurfNum).SinAzim; - BaseCosSurfTilt = state.dataSurfaceGeometry->SurfaceTmp(BaseSurfNum).CosTilt; - BaseSinSurfTilt = state.dataSurfaceGeometry->SurfaceTmp(BaseSurfNum).SinTilt; - - XLLC = state.dataSurfaceGeometry->SurfaceTmp(BaseSurfNum).Vertex(2).x - XCoord * BaseCosSurfAzimuth - - ZCoord * BaseCosSurfTilt * BaseSinSurfAzimuth; - YLLC = state.dataSurfaceGeometry->SurfaceTmp(BaseSurfNum).Vertex(2).y + XCoord * BaseSinSurfAzimuth - - ZCoord * BaseCosSurfTilt * BaseCosSurfAzimuth; - ZLLC = state.dataSurfaceGeometry->SurfaceTmp(BaseSurfNum).Vertex(2).z + ZCoord * BaseSinSurfTilt; + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); + surfTemp.Height = Height; + surfTemp.Width = Length; + + Real64 SurfAzimuth = surfTemp.Azimuth; + Real64 SurfTilt = surfTemp.Tilt; + Real64 CosSurfAzimuth = std::cos(SurfAzimuth * Constant::DegToRad); + Real64 SinSurfAzimuth = std::sin(SurfAzimuth * Constant::DegToRad); + Real64 CosSurfTilt = std::cos(SurfTilt * Constant::DegToRad); + Real64 SinSurfTilt = std::sin(SurfTilt * Constant::DegToRad); + Real64 BaseCosSurfAzimuth = state.dataSurfaceGeometry->SurfaceTmp(BaseSurfNum).CosAzim; + Real64 BaseSinSurfAzimuth = state.dataSurfaceGeometry->SurfaceTmp(BaseSurfNum).SinAzim; + Real64 BaseCosSurfTilt = state.dataSurfaceGeometry->SurfaceTmp(BaseSurfNum).CosTilt; + Real64 BaseSinSurfTilt = state.dataSurfaceGeometry->SurfaceTmp(BaseSurfNum).SinTilt; + + Real64 XLLC = state.dataSurfaceGeometry->SurfaceTmp(BaseSurfNum).Vertex(2).x - XCoord * BaseCosSurfAzimuth - + ZCoord * BaseCosSurfTilt * BaseSinSurfAzimuth; + Real64 YLLC = state.dataSurfaceGeometry->SurfaceTmp(BaseSurfNum).Vertex(2).y + XCoord * BaseSinSurfAzimuth - + ZCoord * BaseCosSurfTilt * BaseCosSurfAzimuth; + Real64 ZLLC = state.dataSurfaceGeometry->SurfaceTmp(BaseSurfNum).Vertex(2).z + ZCoord * BaseSinSurfTilt; XX(1) = 0.0; XX(2) = 0.0; @@ -6294,51 +5902,36 @@ namespace SurfaceGeometry { YY(3) = 0.0; YY(2) = 0.0; - for (n = 1; n <= state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides; ++n) { + for (int n = 1; n <= surfTemp.Sides; ++n) { Vrt = n; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(Vrt).x = XLLC - XX(n) * CosSurfAzimuth - YY(n) * CosSurfTilt * SinSurfAzimuth; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(Vrt).y = YLLC + XX(n) * SinSurfAzimuth - YY(n) * CosSurfTilt * CosSurfAzimuth; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(Vrt).z = ZLLC + YY(n) * SinSurfTilt; - } - - CreateNewellAreaVector(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).NewellAreaVector); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).GrossArea = VecLength(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).NewellAreaVector); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).GrossArea; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).NetAreaShadowCalc = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area; - CreateNewellSurfaceNormalVector(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).NewellSurfaceNormalVector); - DetermineAzimuthAndTilt(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex, - SurfAzimuth, - SurfTilt, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).lcsx, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).lcsy, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).lcsz, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).NewellSurfaceNormalVector); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth = SurfAzimuth; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt = SurfTilt; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).convOrientation = - Convect::GetSurfConvOrientation(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt); + surfTemp.Vertex(Vrt).x = XLLC - XX(n) * CosSurfAzimuth - YY(n) * CosSurfTilt * SinSurfAzimuth; + surfTemp.Vertex(Vrt).y = YLLC + XX(n) * SinSurfAzimuth - YY(n) * CosSurfTilt * CosSurfAzimuth; + surfTemp.Vertex(Vrt).z = ZLLC + YY(n) * SinSurfTilt; + } + + Vectors::CreateNewellAreaVector(surfTemp.Vertex, surfTemp.Sides, surfTemp.NewellAreaVector); + surfTemp.GrossArea = Vectors::VecLength(surfTemp.NewellAreaVector); + surfTemp.Area = surfTemp.GrossArea; + surfTemp.NetAreaShadowCalc = surfTemp.Area; + Vectors::CreateNewellSurfaceNormalVector(surfTemp.Vertex, surfTemp.Sides, surfTemp.NewellSurfaceNormalVector); + Vectors::DetermineAzimuthAndTilt( + surfTemp.Vertex, SurfAzimuth, SurfTilt, surfTemp.lcsx, surfTemp.lcsy, surfTemp.lcsz, surfTemp.NewellSurfaceNormalVector); + surfTemp.Azimuth = SurfAzimuth; + surfTemp.Tilt = SurfTilt; + surfTemp.convOrientation = Convect::GetSurfConvOrientation(surfTemp.Tilt); // Sine and cosine of azimuth and tilt - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SinAzim = SinSurfAzimuth; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).CosAzim = CosSurfAzimuth; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SinTilt = SinSurfTilt; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).CosTilt = CosSurfTilt; - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class != SurfaceClass::Window && - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class != SurfaceClass::GlassDoor && - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class != SurfaceClass::Door) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorGround = 0.5 * (1.0 - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).CosTilt); + surfTemp.SinAzim = SinSurfAzimuth; + surfTemp.CosAzim = CosSurfAzimuth; + surfTemp.SinTilt = SinSurfTilt; + surfTemp.CosTilt = CosSurfTilt; + if (surfTemp.Class != SurfaceClass::Window && surfTemp.Class != SurfaceClass::GlassDoor && surfTemp.Class != SurfaceClass::Door) + surfTemp.ViewFactorGround = 0.5 * (1.0 - surfTemp.CosTilt); // Outward normal unit vector (pointing away from room) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OutNormVec = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).NewellSurfaceNormalVector; - for (n = 1; n <= 3; ++n) { - if (std::abs(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OutNormVec(n) - 1.0) < 1.e-06) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OutNormVec(n) = +1.0; - if (std::abs(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OutNormVec(n) + 1.0) < 1.e-06) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OutNormVec(n) = -1.0; - if (std::abs(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OutNormVec(n)) < 1.e-06) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OutNormVec(n) = 0.0; + surfTemp.OutNormVec = surfTemp.NewellSurfaceNormalVector; + for (int n = 1; n <= 3; ++n) { + if (std::abs(surfTemp.OutNormVec(n) - 1.0) < 1.e-06) surfTemp.OutNormVec(n) = +1.0; + if (std::abs(surfTemp.OutNormVec(n) + 1.0) < 1.e-06) surfTemp.OutNormVec(n) = -1.0; + if (std::abs(surfTemp.OutNormVec(n)) < 1.e-06) surfTemp.OutNormVec(n) = 0.0; } // IF (SurfaceTmp(SurfNum)%Class == SurfaceClass::Roof .and. SurfTilt > 80.) THEN @@ -6352,29 +5945,27 @@ namespace SurfaceGeometry { // expected tilt of 180,'// & // ' for Surface='//TRIM(SurfaceTmp(SurfNum)%Name)// & // ', in Zone='//TRIM(SurfaceTmp(SurfNum)%ZoneName)), //, ENDIF, if, - // (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class, ==, SurfaceClass::Window, ||, - // state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class, ==, SurfaceClass::GlassDoor, ||, - // state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class, ==, SurfaceClass::Door), - // state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area, *=, - // state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Multiplier;, //, Can, perform, tests, on, this, surface, here, - // state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorSky, =, 0.5, *, (1.0, - // state.dataSurfaceGeometry->SurfaceTmp(SurfNum).CosTilt)); + // (surfTemp.Class, ==, SurfaceClass::Window, ||, + // surfTemp.Class, ==, SurfaceClass::GlassDoor, ||, + // surfTemp.Class, ==, SurfaceClass::Door), + // surfTemp.Area, *=, + // surfTemp.Multiplier;, //, Can, perform, tests, on, this, surface, here, + // surfTemp.ViewFactorSky, =, 0.5, *, (1.0, + // surfTemp.CosTilt)); // The following IR view factors are modified in subr. SkyDifSolarShading if there are shadowing // surfaces - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorSkyIR = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorSky; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorGroundIR = 0.5 * (1.0 - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).CosTilt); + surfTemp.ViewFactorSkyIR = surfTemp.ViewFactorSky; + surfTemp.ViewFactorGroundIR = 0.5 * (1.0 - surfTemp.CosTilt); - Perimeter = distance(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides), - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(1)); - for (Vrt = 2; Vrt <= state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides; ++Vrt) { - Perimeter += - distance(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(Vrt), state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(Vrt - 1)); + Perimeter = distance(surfTemp.Vertex(surfTemp.Sides), surfTemp.Vertex(1)); + for (Vrt = 2; Vrt <= surfTemp.Sides; ++Vrt) { + Perimeter += distance(surfTemp.Vertex(Vrt), surfTemp.Vertex(Vrt - 1)); } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Perimeter = Perimeter; + surfTemp.Perimeter = Perimeter; // Call to transform vertices - TransformVertsByAspect(state, SurfNum, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); + TransformVertsByAspect(state, SurfNum, surfTemp.Sides); } void GetAttShdSurfaceData(EnergyPlusData &state, @@ -6391,11 +5982,7 @@ namespace SurfaceGeometry { // This subroutine gets the HeatTransfer Surface Data, // checks it for errors, etc. - // Using/Aliasing - using ScheduleManager::CheckScheduleValueMinMax; - using ScheduleManager::GetScheduleIndex; - using ScheduleManager::GetScheduleMaxValue; - using ScheduleManager::GetScheduleMinValue; + static constexpr std::string_view routineName = "GetAttShdSurfaceData"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int IOStat; // IO Status when calling get input subroutine @@ -6433,6 +6020,8 @@ namespace SurfaceGeometry { s_ipsc->cAlphaFieldNames, s_ipsc->cNumericFieldNames); + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + if (GlobalNames::VerifyUniqueInterObjectName(state, state.dataSurfaceGeometry->UniqueSurfaceNames, s_ipsc->cAlphaArgs(1), @@ -6443,142 +6032,108 @@ namespace SurfaceGeometry { } ++SurfNum; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = s_ipsc->cAlphaArgs(1); // Set the Surface Name in the Derived Type - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = SurfaceClass::Shading; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).HeatTransSurf = false; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurfName = s_ipsc->cAlphaArgs(2); + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); + + surfTemp.Name = s_ipsc->cAlphaArgs(1); // Set the Surface Name in the Derived Type + surfTemp.Class = SurfaceClass::Shading; + surfTemp.HeatTransSurf = false; + surfTemp.BaseSurfName = s_ipsc->cAlphaArgs(2); // The subsurface inherits properties from the base surface // Exterior conditions, Zone, etc. // We can figure out the base surface though, because they've all been entered - Found = Util::FindItemInList( - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurfName, state.dataSurfaceGeometry->SurfaceTmp, state.dataSurface->TotSurfaces); + Found = Util::FindItemInList(surfTemp.BaseSurfName, state.dataSurfaceGeometry->SurfaceTmp, state.dataSurface->TotSurfaces); if (Found > 0) { // SurfaceTmp(SurfNum)%BaseSurf=Found - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtBoundCond; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtSolar = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtSolar; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtWind = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtWind; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone = - state.dataSurfaceGeometry->SurfaceTmp(Found).Zone; // Necessary to do relative coordinates in GetVertices below - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName = - state.dataSurfaceGeometry->SurfaceTmp(Found).ZoneName; // Necessary to have surface drawn in OutputReports + surfTemp.ExtBoundCond = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtBoundCond; + surfTemp.ExtSolar = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtSolar; + surfTemp.ExtWind = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtWind; + surfTemp.Zone = state.dataSurfaceGeometry->SurfaceTmp(Found).Zone; // Necessary to do relative coordinates in GetVertices below + surfTemp.ZoneName = state.dataSurfaceGeometry->SurfaceTmp(Found).ZoneName; // Necessary to have surface drawn in OutputReports } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == UnenteredAdjacentZoneSurface) { + if (surfTemp.ExtBoundCond == UnenteredAdjacentZoneSurface) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); ShowContinueError(state, "...trying to attach a shading device to an interzone surface."); ErrorsFound = true; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = - ExternalEnvironment; // reset so program won't crash during "add surfaces" + + surfTemp.ExtBoundCond = DataSurfaces::ExternalEnvironment; // reset so program won't crash during "add surfaces" } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == UnreconciledZoneSurface) { + if (surfTemp.ExtBoundCond == UnreconciledZoneSurface) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); ShowContinueError(state, "...trying to attach a shading device to an interior surface."); ErrorsFound = true; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = - ExternalEnvironment; // reset so program won't crash during "add surfaces" + + surfTemp.ExtBoundCond = DataSurfaces::ExternalEnvironment; // reset so program won't crash during "add surfaces" } - if (!s_ipsc->lAlphaFieldBlanks(3)) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex = GetScheduleIndex(state, s_ipsc->cAlphaArgs(3)); - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex == 0) { - ShowSevereError(state, - format("{}=\"{}\", {} not found=\"{}", - s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - s_ipsc->cAlphaFieldNames(3), - s_ipsc->cAlphaArgs(3))); - ErrorsFound = true; - } + if (s_ipsc->lAlphaFieldBlanks(3)) { + // Defaults to constant-0.0, but leave this as nullptr for now + } else if ((surfTemp.shadowSurfSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3)); + ErrorsFound = true; + } else if (!surfTemp.shadowSurfSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3), Clusive::In, 0.0, Clusive::In, 1.0); + ErrorsFound = true; } else { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex = 0; - } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex != 0) { - if (!CheckScheduleValueMinMax(state, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, - format("{}=\"{}\", {}=\"{}\", values not in range [0,1].", - s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - s_ipsc->cAlphaFieldNames(3), - s_ipsc->cAlphaArgs(3))); - ErrorsFound = true; - } - SchedMinValue = GetScheduleMinValue(state, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedMinValue = SchedMinValue; - SchedMaxValue = GetScheduleMaxValue(state, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex); + + SchedMinValue = surfTemp.shadowSurfSched->getMinVal(state); + surfTemp.SchedMinValue = SchedMinValue; + SchedMaxValue = surfTemp.shadowSurfSched->getMaxVal(state); if (SchedMinValue == 1.0) { // Set transparent for now, check for EMS actuators later in SolarShading::resetShadingSurfaceTransparency - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).IsTransparent = true; - } - if (SchedMinValue < 0.0) { - ShowSevereError(state, - format("{}=\"{}\", {}=\"{}\", has schedule values < 0.", - s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - s_ipsc->cAlphaFieldNames(2), - s_ipsc->cAlphaArgs(2))); - ShowContinueError(state, "...Schedule values < 0 have no meaning for shading elements."); + surfTemp.IsTransparent = true; } if (SchedMaxValue > 0.0) { state.dataSolarShading->anyScheduledShadingSurface = true; } - if (SchedMaxValue > 1.0) { - ShowSevereError(state, - format("{}=\"{}\", {}=\"{}\", has schedule values > 1.", - s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - s_ipsc->cAlphaFieldNames(2), - s_ipsc->cAlphaArgs(2))); - ShowContinueError(state, "...Schedule values > 1 have no meaning for shading elements."); - } - if (std::abs(SchedMinValue - SchedMaxValue) > Constant::OneMillionth) { + if (SchedMaxValue - SchedMinValue > Constant::OneMillionth) { state.dataSurface->ShadingTransmittanceVaries = true; } } + if (s_ipsc->lNumericFieldBlanks(1) || s_ipsc->rNumericArgs(1) == Constant::AutoCalculate) { s_ipsc->rNumericArgs(1) = (NumNumbers - 1) / 3; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = s_ipsc->rNumericArgs(1); + surfTemp.Sides = s_ipsc->rNumericArgs(1); if (mod(NumNumbers - 1, 3) != 0) { ShowWarningError(state, format("{}=\"{}\", {}", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - format("{} not even multiple of 3. Will read in {}", - s_ipsc->cNumericFieldNames(1), - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides))); + surfTemp.Name, + format("{} not even multiple of 3. Will read in {}", s_ipsc->cNumericFieldNames(1), surfTemp.Sides))); } if (s_ipsc->rNumericArgs(1) < 3) { ShowSevereError(state, format("{}=\"{}\", {} (autocalculate) must be >= 3. Only {} provided.", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cNumericFieldNames(1), - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides)); + surfTemp.Sides)); ErrorsFound = true; continue; } } else { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = s_ipsc->rNumericArgs(1); + surfTemp.Sides = s_ipsc->rNumericArgs(1); } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex.allocate(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); - GetVertices(state, SurfNum, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides, s_ipsc->rNumericArgs({2, _})); - CheckConvexity(state, SurfNum, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); + surfTemp.Vertex.allocate(surfTemp.Sides); + GetVertices(state, SurfNum, surfTemp.Sides, s_ipsc->rNumericArgs({2, _})); + CheckConvexity(state, SurfNum, surfTemp.Sides); // IF (SurfaceTmp(SurfNum)%Sides == 3) THEN // CALL ShowWarningError(state, TRIM(s_ipsc->cCurrentModuleObject)//'="'//TRIM(SurfaceTmp(SurfNum)%Name)// & // ' should not be triangular.') @@ -6586,9 +6141,9 @@ namespace SurfaceGeometry { // ErrorsFound=.TRUE. // ENDIF // Reset surface to be "detached" - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf = 0; + surfTemp.BaseSurf = 0; // SurfaceTmp(SurfNum)%BaseSurfName=' ' - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone = 0; + surfTemp.Zone = 0; // SurfaceTmp(SurfNum)%ZoneName=' ' if (state.dataReportFlag->MakeMirroredAttachedShading) { MakeMirrorSurface(state, SurfNum); @@ -6609,26 +6164,18 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN January 2009 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Get simple overhang and fin descriptions. - // Using/Aliasing - using namespace Vectors; - // SUBROUTINE PARAMETER DEFINITIONS: static Array1D_string const cModuleObjects(4, {"Shading:Overhang", "Shading:Overhang:Projection", "Shading:Fin", "Shading:Fin:Projection"}); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int Item; int ItemsToGet; - int Loop; int NumAlphas; int NumNumbers; int IOStat; // IO Status when calling get input subroutine - int Found; // For matching base surfaces Real64 Depth; Real64 Length; Real64 Xp; @@ -6646,7 +6193,7 @@ namespace SurfaceGeometry { state.dataHeatBal->SolarDistribution == DataHeatBalance::Shadowing::Minimal) { ShowWarningError(state, "Shading effects of Fins and Overhangs are ignored when Solar Distribution = MinimalShadowing"); } - for (Item = 1; Item <= 4; ++Item) { + for (int Item = 1; Item <= 4; ++Item) { s_ipsc->cCurrentModuleObject = cModuleObjects(Item); if (Item == 1) { @@ -6659,7 +6206,7 @@ namespace SurfaceGeometry { ItemsToGet = TotFinsProjection; } - for (Loop = 1; Loop <= ItemsToGet; ++Loop) { + for (int Loop = 1; Loop <= ItemsToGet; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, s_ipsc->cCurrentModuleObject, Loop, @@ -6683,57 +6230,55 @@ namespace SurfaceGeometry { } ++SurfNum; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = s_ipsc->cAlphaArgs(1); // Set the Surface Name in the Derived Type - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = SurfaceClass::Shading; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).HeatTransSurf = false; + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); + + surfTemp.Name = s_ipsc->cAlphaArgs(1); // Set the Surface Name in the Derived Type + surfTemp.Class = SurfaceClass::Shading; + surfTemp.HeatTransSurf = false; // this object references a window or door.... - Found = Util::FindItemInList(s_ipsc->cAlphaArgs(2), state.dataSurfaceGeometry->SurfaceTmp, state.dataSurface->TotSurfaces); + int Found = Util::FindItemInList(s_ipsc->cAlphaArgs(2), state.dataSurfaceGeometry->SurfaceTmp, state.dataSurface->TotSurfaces); if (Found > 0) { BaseSurfNum = state.dataSurfaceGeometry->SurfaceTmp(Found).BaseSurf; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurfName = state.dataSurfaceGeometry->SurfaceTmp(Found).BaseSurfName; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtBoundCond; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtSolar = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtSolar; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtWind = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtWind; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone = - state.dataSurfaceGeometry->SurfaceTmp(Found).Zone; // Necessary to do relative coordinates in GetVertices below - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName = - state.dataSurfaceGeometry->SurfaceTmp(Found).ZoneName; // Necessary to have surface drawn in OutputReports + surfTemp.BaseSurfName = state.dataSurfaceGeometry->SurfaceTmp(Found).BaseSurfName; + surfTemp.ExtBoundCond = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtBoundCond; + surfTemp.ExtSolar = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtSolar; + surfTemp.ExtWind = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtWind; + surfTemp.Zone = state.dataSurfaceGeometry->SurfaceTmp(Found).Zone; // Necessary to do relative coordinates in GetVertices below + surfTemp.ZoneName = state.dataSurfaceGeometry->SurfaceTmp(Found).ZoneName; // Necessary to have surface drawn in OutputReports } else { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); ErrorsFound = true; continue; } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == UnenteredAdjacentZoneSurface) { + if (surfTemp.ExtBoundCond == UnenteredAdjacentZoneSurface) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); ShowContinueError(state, "...trying to attach a shading device to an interzone surface."); ErrorsFound = true; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = - ExternalEnvironment; // reset so program won't crash during "add surfaces" + surfTemp.ExtBoundCond = DataSurfaces::ExternalEnvironment; // reset so program won't crash during "add surfaces" } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == UnreconciledZoneSurface) { + if (surfTemp.ExtBoundCond == UnreconciledZoneSurface) { ShowSevereError(state, format("{}=\"{}\", invalid {}=\"{}", s_ipsc->cCurrentModuleObject, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); ShowContinueError(state, "...trying to attach a shading device to an interior surface."); ErrorsFound = true; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = - ExternalEnvironment; // reset so program won't crash during "add surfaces" + surfTemp.ExtBoundCond = DataSurfaces::ExternalEnvironment; // reset so program won't crash during "add surfaces" } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex = 0; + surfTemp.shadowSurfSched = nullptr; //===== Overhang ===== @@ -6773,10 +6318,9 @@ namespace SurfaceGeometry { } TiltAngle = state.dataSurfaceGeometry->SurfaceTmp(Found).Tilt + s_ipsc->rNumericArgs(2); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt = TiltAngle; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).convOrientation = - Convect::GetSurfConvOrientation(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth = state.dataSurfaceGeometry->SurfaceTmp(Found).Azimuth; + surfTemp.Tilt = TiltAngle; + surfTemp.convOrientation = Convect::GetSurfConvOrientation(surfTemp.Tilt); + surfTemp.Azimuth = state.dataSurfaceGeometry->SurfaceTmp(Found).Azimuth; // Make it relative to surface origin..... Xp = state.dataSurfaceGeometry->SurfaceTmp(Found).Vertex(2).x - state.dataSurfaceGeometry->SurfaceTmp(BaseSurfNum).Vertex(2).x; @@ -6792,8 +6336,8 @@ namespace SurfaceGeometry { Yp * state.dataSurfaceGeometry->SurfaceTmp(BaseSurfNum).CosAzim * state.dataSurfaceGeometry->SurfaceTmp(BaseSurfNum).CosTilt + Zp * state.dataSurfaceGeometry->SurfaceTmp(BaseSurfNum).SinTilt; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = 4; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex.allocate(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); + surfTemp.Sides = 4; + surfTemp.Vertex.allocate(surfTemp.Sides); MakeRelativeRectangularVertices(state, BaseSurfNum, @@ -6807,8 +6351,8 @@ namespace SurfaceGeometry { // SurfaceTmp(SurfNum)%BaseSurfName=' ' // SurfaceTmp(SurfNum)%ZoneName=' ' - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf = 0; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone = 0; + surfTemp.BaseSurf = 0; + surfTemp.Zone = 0; // and mirror if (state.dataReportFlag->MakeMirroredAttachedShading) { @@ -6838,7 +6382,7 @@ namespace SurfaceGeometry { // for projection option: // N5, \field Left Depth as Fraction of Window/Door Width // \units m - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name + " Left"; + surfTemp.Name = surfTemp.Name + " Left"; Length = s_ipsc->rNumericArgs(2) + s_ipsc->rNumericArgs(3) + state.dataSurfaceGeometry->SurfaceTmp(Found).Height; if (Item == 3) { Depth = s_ipsc->rNumericArgs(5); @@ -6858,11 +6402,9 @@ namespace SurfaceGeometry { if (MakeFin) { TiltAngle = state.dataSurfaceGeometry->SurfaceTmp(Found).Tilt; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt = TiltAngle; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).convOrientation = - Convect::GetSurfConvOrientation(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth = - state.dataSurfaceGeometry->SurfaceTmp(Found).Azimuth - (180.0 - s_ipsc->rNumericArgs(4)); + surfTemp.Tilt = TiltAngle; + surfTemp.convOrientation = Convect::GetSurfConvOrientation(surfTemp.Tilt); + surfTemp.Azimuth = state.dataSurfaceGeometry->SurfaceTmp(Found).Azimuth - (180.0 - s_ipsc->rNumericArgs(4)); // Make it relative to surface origin..... @@ -6882,17 +6424,13 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->SurfaceTmp(BaseSurfNum).CosTilt + Zp * state.dataSurfaceGeometry->SurfaceTmp(BaseSurfNum).SinTilt; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).CosAzim = - std::cos(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth * Constant::DegToRadians); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SinAzim = - std::sin(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth * Constant::DegToRadians); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).CosTilt = - std::cos(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt * Constant::DegToRadians); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SinTilt = - std::sin(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt * Constant::DegToRadians); + surfTemp.CosAzim = std::cos(surfTemp.Azimuth * Constant::DegToRad); + surfTemp.SinAzim = std::sin(surfTemp.Azimuth * Constant::DegToRad); + surfTemp.CosTilt = std::cos(surfTemp.Tilt * Constant::DegToRad); + surfTemp.SinTilt = std::sin(surfTemp.Tilt * Constant::DegToRad); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = 4; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex.allocate(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); + surfTemp.Sides = 4; + surfTemp.Vertex.allocate(surfTemp.Sides); MakeRelativeRectangularVertices( state, BaseSurfNum, SurfNum, XLLC - s_ipsc->rNumericArgs(1), YLLC - s_ipsc->rNumericArgs(3), -Depth, Length); @@ -6901,8 +6439,8 @@ namespace SurfaceGeometry { // SurfaceTmp(SurfNum)%BaseSurfName=' ' // SurfaceTmp(SurfNum)%ZoneName=' ' - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf = 0; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone = 0; + surfTemp.BaseSurf = 0; + surfTemp.Zone = 0; // and mirror if (state.dataReportFlag->MakeMirroredAttachedShading) { @@ -6933,21 +6471,19 @@ namespace SurfaceGeometry { // \units m ++SurfNum; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = - s_ipsc->cAlphaArgs(1) + " Right"; // Set the Surface Name in the Derived Type - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = SurfaceClass::Shading; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).HeatTransSurf = false; + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); + surfTemp.Name = s_ipsc->cAlphaArgs(1) + " Right"; // Set the Surface Name in the Derived Type + surfTemp.Class = SurfaceClass::Shading; + surfTemp.HeatTransSurf = false; BaseSurfNum = state.dataSurfaceGeometry->SurfaceTmp(Found).BaseSurf; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurfName = state.dataSurfaceGeometry->SurfaceTmp(Found).BaseSurfName; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtBoundCond; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtSolar = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtSolar; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtWind = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtWind; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone = - state.dataSurfaceGeometry->SurfaceTmp(Found).Zone; // Necessary to do relative coordinates in GetVertices below - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName = - state.dataSurfaceGeometry->SurfaceTmp(Found).ZoneName; // Necessary to have surface drawn in OutputReports - - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex = 0; + surfTemp.BaseSurfName = state.dataSurfaceGeometry->SurfaceTmp(Found).BaseSurfName; + surfTemp.ExtBoundCond = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtBoundCond; + surfTemp.ExtSolar = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtSolar; + surfTemp.ExtWind = state.dataSurfaceGeometry->SurfaceTmp(Found).ExtWind; + surfTemp.Zone = state.dataSurfaceGeometry->SurfaceTmp(Found).Zone; // Necessary to do relative coordinates in GetVertices below + surfTemp.ZoneName = state.dataSurfaceGeometry->SurfaceTmp(Found).ZoneName; // Necessary to have surface drawn in OutputReports + + surfTemp.shadowSurfSched = nullptr; Length = s_ipsc->rNumericArgs(7) + s_ipsc->rNumericArgs(8) + state.dataSurfaceGeometry->SurfaceTmp(Found).Height; if (Item == 3) { Depth = s_ipsc->rNumericArgs(10); @@ -6985,22 +6521,16 @@ namespace SurfaceGeometry { Zp * state.dataSurfaceGeometry->SurfaceTmp(BaseSurfNum).SinTilt; TiltAngle = state.dataSurfaceGeometry->SurfaceTmp(Found).Tilt; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt = TiltAngle; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).convOrientation = - Convect::GetSurfConvOrientation(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth = - state.dataSurfaceGeometry->SurfaceTmp(Found).Azimuth - (180.0 - s_ipsc->rNumericArgs(9)); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).CosAzim = - std::cos(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth * Constant::DegToRadians); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SinAzim = - std::sin(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth * Constant::DegToRadians); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).CosTilt = - std::cos(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt * Constant::DegToRadians); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SinTilt = - std::sin(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt * Constant::DegToRadians); - - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides = 4; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex.allocate(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); + surfTemp.Tilt = TiltAngle; + surfTemp.convOrientation = Convect::GetSurfConvOrientation(surfTemp.Tilt); + surfTemp.Azimuth = state.dataSurfaceGeometry->SurfaceTmp(Found).Azimuth - (180.0 - s_ipsc->rNumericArgs(9)); + surfTemp.CosAzim = std::cos(surfTemp.Azimuth * Constant::DegToRad); + surfTemp.SinAzim = std::sin(surfTemp.Azimuth * Constant::DegToRad); + surfTemp.CosTilt = std::cos(surfTemp.Tilt * Constant::DegToRad); + surfTemp.SinTilt = std::sin(surfTemp.Tilt * Constant::DegToRad); + + surfTemp.Sides = 4; + surfTemp.Vertex.allocate(surfTemp.Sides); MakeRelativeRectangularVertices(state, BaseSurfNum, @@ -7014,8 +6544,8 @@ namespace SurfaceGeometry { // SurfaceTmp(SurfNum)%BaseSurfName=' ' // SurfaceTmp(SurfNum)%ZoneName=' ' - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf = 0; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone = 0; + surfTemp.BaseSurf = 0; + surfTemp.Zone = 0; // and mirror if (state.dataReportFlag->MakeMirroredAttachedShading) { @@ -7038,16 +6568,11 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN May 2000 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine gets the Internal Surface Data, // checks it for errors, etc. - // METHODOLOGY EMPLOYED: - // na - // REFERENCES: // Internal Mass Surface Definition // Surface:HeatTransfer:InternalMass, @@ -7069,20 +6594,13 @@ namespace SurfaceGeometry { // N2 ; \field Surface area // \units m2 - // Using/Aliasing - using namespace Vectors; - using General::CheckCreatedZoneItemName; - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetIntMassSurfaceData: "); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int IOStat; // IO Status when calling get input subroutine - int SurfaceNumAlpha; // Number of material alpha names being passed - int SurfaceNumArg; // Number of material properties being passed - int ZoneNum; // index to a zone - int NumIntMassSurfaces(0); // total count of internal mass surfaces - bool errFlag; // local error flag + int IOStat; // IO Status when calling get input subroutine + int SurfaceNumAlpha; // Number of material alpha names being passed + int SurfaceNumArg; // Number of material properties being passed auto &s_ipsc = state.dataIPShortCut; s_ipsc->cCurrentModuleObject = "InternalMass"; @@ -7092,8 +6610,8 @@ namespace SurfaceGeometry { state.dataSurface->IntMassObjects.allocate(TotIntMass); // scan for use of Zone lists in InternalMass objects - errFlag = false; - NumIntMassSurfaces = 0; + bool errFlag = false; + int NumIntMassSurfaces = 0; for (int Item = 1; Item <= TotIntMass; ++Item) { state.dataInputProcessing->inputProcessor->getObjectItem(state, s_ipsc->cCurrentModuleObject, @@ -7147,15 +6665,16 @@ namespace SurfaceGeometry { s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3))); ++SurfNum; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = SurfaceClass::Invalid; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName = "Unknown Zone"; + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); + surfTemp.Class = SurfaceClass::Invalid; + surfTemp.ZoneName = "Unknown Zone"; ErrorsFound = true; errFlag = true; } if (!s_ipsc->lAlphaFieldBlanks(4)) { state.dataSurface->IntMassObjects(Item).spaceOrSpaceListName = s_ipsc->cAlphaArgs(4); - int Item1 = Util::FindItemInList(s_ipsc->cAlphaArgs(4), state.dataHeatBal->space); + Item1 = Util::FindItemInList(s_ipsc->cAlphaArgs(4), state.dataHeatBal->space); int SLItem = 0; if (Item1 == 0 && int(state.dataHeatBal->spaceList.size()) > 0) SLItem = Util::FindItemInList(s_ipsc->cAlphaArgs(4), state.dataHeatBal->spaceList); @@ -7181,7 +6700,8 @@ namespace SurfaceGeometry { s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4))); ++SurfNum; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = SurfaceClass::Invalid; + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); + surfTemp.Class = SurfaceClass::Invalid; ErrorsFound = true; errFlag = true; } @@ -7215,7 +6735,6 @@ namespace SurfaceGeometry { } if (NumIntMassSurfaces > 0) { - int spaceNum = 0; for (int Loop = 1; Loop <= TotIntMass; ++Loop) { int numberOfZonesOrSpaces = 1; if (state.dataSurface->IntMassObjects(Loop).ZoneListActive) { @@ -7228,17 +6747,19 @@ namespace SurfaceGeometry { ++SurfNum; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction = state.dataSurface->IntMassObjects(Loop).Construction; + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); + surfTemp.Construction = state.dataSurface->IntMassObjects(Loop).Construction; if (!state.dataSurface->IntMassObjects(Loop).ZoneListActive && !state.dataSurface->IntMassObjects(Loop).spaceListActive) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone = state.dataSurface->IntMassObjects(Loop).ZoneOrZoneListPtr; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).spaceNum = state.dataSurface->IntMassObjects(Loop).spaceOrSpaceListPtr; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = state.dataSurface->IntMassObjects(Loop).Name; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = SurfaceClass::IntMass; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName = state.dataSurface->IntMassObjects(Loop).ZoneOrZoneListName; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).HeatTransSurf = true; + surfTemp.Zone = state.dataSurface->IntMassObjects(Loop).ZoneOrZoneListPtr; + surfTemp.spaceNum = state.dataSurface->IntMassObjects(Loop).spaceOrSpaceListPtr; + surfTemp.Name = state.dataSurface->IntMassObjects(Loop).Name; + surfTemp.Class = SurfaceClass::IntMass; + surfTemp.ZoneName = state.dataSurface->IntMassObjects(Loop).ZoneOrZoneListName; + surfTemp.HeatTransSurf = true; } else { + int ZoneNum = 0; // index to a zone if (state.dataSurface->IntMassObjects(Loop).ZoneListActive) { - CheckCreatedZoneItemName( + General::CheckCreatedZoneItemName( state, RoutineName, s_ipsc->cCurrentModuleObject, @@ -7249,52 +6770,50 @@ namespace SurfaceGeometry { state.dataSurface->IntMassObjects(Loop).Name, state.dataSurfaceGeometry->SurfaceTmp, SurfNum - 1, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, errFlag); ZoneNum = state.dataHeatBal->ZoneList(state.dataSurface->IntMassObjects(Loop).ZoneOrZoneListPtr).Zone(Item1); } else if (state.dataSurface->IntMassObjects(Loop).spaceListActive) { - spaceNum = state.dataHeatBal->spaceList(state.dataSurface->IntMassObjects(Loop).spaceOrSpaceListPtr).spaces(Item1); + int spaceNum = state.dataHeatBal->spaceList(state.dataSurface->IntMassObjects(Loop).spaceOrSpaceListPtr).spaces(Item1); ZoneNum = state.dataHeatBal->space(spaceNum).zoneNum; const std::string spaceName = state.dataHeatBal->space(spaceNum).Name; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name = spaceName + ' ' + state.dataSurface->IntMassObjects(Loop).Name; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).spaceNum = spaceNum; + surfTemp.Name = spaceName + ' ' + state.dataSurface->IntMassObjects(Loop).Name; + surfTemp.spaceNum = spaceNum; } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone = ZoneNum; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class = SurfaceClass::IntMass; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName = state.dataHeatBal->Zone(ZoneNum).Name; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).HeatTransSurf = true; + surfTemp.Zone = ZoneNum; + surfTemp.Class = SurfaceClass::IntMass; + surfTemp.ZoneName = state.dataHeatBal->Zone(ZoneNum).Name; + surfTemp.HeatTransSurf = true; if (errFlag) ErrorsFound = true; } if (state.dataSurface->IntMassObjects(Loop).Construction > 0) { if (state.dataConstruction->Construct(state.dataSurface->IntMassObjects(Loop).Construction).IsUsed) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ConstructionStoredInputValue = - state.dataSurface->IntMassObjects(Loop).Construction; + surfTemp.ConstructionStoredInputValue = state.dataSurface->IntMassObjects(Loop).Construction; } } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).GrossArea = state.dataSurface->IntMassObjects(Loop).GrossArea; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).GrossArea; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).NetAreaShadowCalc = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Width = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Height = 1.0; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt = 90.0; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).convOrientation = - Convect::GetSurfConvOrientation(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).CosTilt = 0.0; // Tuned Was std::cos( 90.0 * DegToRadians ) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SinTilt = 1.0; // Tuned Was std::sin( 90.0 * DegToRadians ) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth = 0.0; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).CosAzim = 1.0; // Tuned Was std::cos( 0.0 ) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SinAzim = 0.0; // Tuned Was std::sin( 0.0 ) + surfTemp.GrossArea = state.dataSurface->IntMassObjects(Loop).GrossArea; + surfTemp.Area = surfTemp.GrossArea; + surfTemp.NetAreaShadowCalc = surfTemp.Area; + surfTemp.Width = surfTemp.Area; + surfTemp.Height = 1.0; + surfTemp.Tilt = 90.0; + surfTemp.convOrientation = Convect::GetSurfConvOrientation(surfTemp.Tilt); + surfTemp.CosTilt = 0.0; // Tuned Was std::cos( 90.0 * DegToRadians ) + surfTemp.SinTilt = 1.0; // Tuned Was std::sin( 90.0 * DegToRadians ) + surfTemp.Azimuth = 0.0; + surfTemp.CosAzim = 1.0; // Tuned Was std::cos( 0.0 ) + surfTemp.SinAzim = 0.0; // Tuned Was std::sin( 0.0 ) // Outward normal unit vector (pointing away from room) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OutNormVec = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).lcsz; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorSky = 0.5; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtSolar = false; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtWind = false; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf = SurfNum; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurfName = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond = UnreconciledZoneSurface; + surfTemp.OutNormVec = surfTemp.lcsz; + surfTemp.ViewFactorSky = 0.5; + surfTemp.ExtSolar = false; + surfTemp.ExtWind = false; + surfTemp.BaseSurf = SurfNum; + surfTemp.BaseSurfName = surfTemp.Name; + surfTemp.ExtBoundCondName = surfTemp.Name; + surfTemp.ExtBoundCond = UnreconciledZoneSurface; } } } @@ -7305,17 +6824,14 @@ namespace SurfaceGeometry { { // Counts internal mass surfaces applied to zones and zone lists - // Using/Aliasing - int IOStat; // IO Status when calling get input subroutine int SurfaceNumAlpha; // Number of material alpha names being passed int SurfaceNumArg; // Number of material properties being passed - int NumIntMassSurf; // total count of internal mass surfaces auto &s_ipsc = state.dataIPShortCut; s_ipsc->cCurrentModuleObject = "InternalMass"; - NumIntMassSurf = 0; + int NumIntMassSurf = 0; int TotIntMass = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "InternalMass"); if (TotIntMass == 0) return NumIntMassSurf; @@ -7347,7 +6863,7 @@ namespace SurfaceGeometry { } if (!s_ipsc->lAlphaFieldBlanks(4)) { - int Item1 = Util::FindItemInList(s_ipsc->cAlphaArgs(4), state.dataHeatBal->space); + Item1 = Util::FindItemInList(s_ipsc->cAlphaArgs(4), state.dataHeatBal->space); int SLItem = 0; if (Item1 == 0 && int(state.dataHeatBal->spaceList.size()) > 0) SLItem = Util::FindItemInList(s_ipsc->cAlphaArgs(4), state.dataHeatBal->spaceList); @@ -7369,21 +6885,16 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR Fred Winkelmann // DATE WRITTEN Sept 2003 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Gets data for a Shading Surface Reflectance object. This is only called when the // Solar Distribution is to be calculated for reflectances. - // Using/Aliasing - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int IOStat; // IO Status when calling get input subroutine int NumAlpha; // Number of alpha names being passed int NumProp; // Number of properties being passed - int TotShadingSurfaceReflectance; // Total Shading Surface Refleftance statements + int TotShadingSurfaceReflectance; // Total Shading Surface Reflectance statements int Loop; // DO loop index int SurfNum; // Surface number int GlConstrNum; // Glazing construction number @@ -7432,19 +6943,16 @@ namespace SurfaceGeometry { // Check that associated surface is a shading surface WrongSurfaceType = false; - if (SurfNum != 0) { - auto const &surf = state.dataSurface->Surface(SurfNum); - if (!(surf.Class == SurfaceClass::Shading || surf.Class == SurfaceClass::Detached_F || surf.Class == SurfaceClass::Detached_B || - surf.Class == SurfaceClass::Overhang || surf.Class == SurfaceClass::Fin)) - WrongSurfaceType = true; - if (WrongSurfaceType) { - ShowSevereError(state, - format("GetShadingSurfReflectanceData: {}=\"{}\", surface is not a shading surface.", - s_ipsc->cCurrentModuleObject, - surf.Name)); - ErrorsFound = true; - continue; - } + auto const &surf = state.dataSurface->Surface(SurfNum); + if (!(surf.Class == SurfaceClass::Shading || surf.Class == SurfaceClass::Detached_F || surf.Class == SurfaceClass::Detached_B || + surf.Class == SurfaceClass::Overhang || surf.Class == SurfaceClass::Fin)) + WrongSurfaceType = true; + if (WrongSurfaceType) { + ShowSevereError( + state, + format("GetShadingSurfReflectanceData: {}=\"{}\", surface is not a shading surface.", s_ipsc->cCurrentModuleObject, surf.Name)); + ErrorsFound = true; + continue; } // If associated surface is a shading surface, set reflectance values @@ -7484,7 +6992,7 @@ namespace SurfaceGeometry { // Write reflectance values to .eio file. print(state.files.eio, "! ,Shading Surface Name,Shading Type,Diffuse Solar Reflectance, Diffuse " - "Visible Reflectance,Surface Glazing Fraction,Surface Glazing Contruction\n"); + "Visible Reflectance,Surface Glazing Fraction,Surface Glazing Construction\n"); for (SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { auto const &surf = state.dataSurface->Surface(SurfNum); @@ -7521,8 +7029,6 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR BGriffith // DATE WRITTEN January 2005 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // load input data for Exterior Vented Cavity Special case for heat transfer surfaces @@ -7533,10 +7039,7 @@ namespace SurfaceGeometry { // REFERENCES: // derived from SUBROUTINE GetTranspiredCollectorInput - // Using/Aliasing - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int Item; // Item to be "gotten" int NumAlphas; // Number of Alphas for each GetObjectItem call int NumNumbers; // Number of Numbers for each GetObjectItem call @@ -7553,8 +7056,6 @@ namespace SurfaceGeometry { constexpr Real64 AZITOL = 15.0; // Degree Azimuth Angle Tolerance constexpr Real64 TILTOL = 10.0; // Degree Tilt Angle Tolerance int SurfID; // local surface "pointer" - bool IsBlank; - bool ErrorInName; auto &s_ipsc = state.dataIPShortCut; s_ipsc->cCurrentModuleObject = "SurfaceProperty:ExteriorNaturalVentedCavity"; @@ -7585,8 +7086,8 @@ namespace SurfaceGeometry { s_ipsc->cAlphaFieldNames, s_ipsc->cNumericFieldNames); // first handle cAlphaArgs - ErrorInName = false; - IsBlank = false; + bool ErrorInName = false; + bool IsBlank = false; Util::VerifyName(state, s_ipsc->cAlphaArgs(1), @@ -7710,7 +7211,7 @@ namespace SurfaceGeometry { ErrorsFound = true; continue; } - if (state.dataSurface->Surface(Found).ExtBoundCond != OtherSideCondModeledExt) { + if (state.dataSurface->Surface(Found).ExtBoundCond != DataSurfaces::OtherSideCondModeledExt) { ShowSevereError(state, format("{}=\"{}\", is invalid", s_ipsc->cCurrentModuleObject, state.dataHeatBal->ExtVentedCavity(Item).Name)); ShowContinueError(state, @@ -7730,7 +7231,7 @@ namespace SurfaceGeometry { if (ErrorsFound) continue; // previous inner do loop may have detected problems that need to be cycle'd again to avoid crash - // now that we should have all the surfaces, do some preperations and checks. + // now that we should have all the surfaces, do some preparations and checks. // are they all similar tilt and azimuth? Issue warnings so people can do it if they really want Real64 const surfaceArea(sum_sub(state.dataSurface->Surface, &SurfaceData::Area, state.dataHeatBal->ExtVentedCavity(Item).SurfPtrs)); @@ -7870,6 +7371,7 @@ namespace SurfaceGeometry { void ExposedFoundationPerimeter::getData(EnergyPlusData &state, bool &ErrorsFound) { + static constexpr std::string_view routineName = "ExposedFoundationPerimeter::getData"; int IOStatus; // Used in GetObjectItem int NumAlphas; int NumNumbers; @@ -7896,6 +7398,9 @@ namespace SurfaceGeometry { s_ipsc->lAlphaFieldBlanks, s_ipsc->cAlphaFieldNames, s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(alpF)}; + int Found = Util::FindItemInList(s_ipsc->cAlphaArgs(alpF), state.dataSurface->Surface, state.dataSurface->TotSurfaces); if (Found == 0) { ShowSevereError(state, format("{}=\"{}\", did not find matching surface", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); @@ -8026,26 +7531,14 @@ namespace SurfaceGeometry { ErrorsFound = true; } for (int segNum = 0; segNum < numRemainingFields; segNum++) { - if (Util::SameString(s_ipsc->cAlphaArgs(alpF), "YES")) { - data.isExposedPerimeter.push_back(true); - } else if (Util::SameString(s_ipsc->cAlphaArgs(alpF), "NO")) { - data.isExposedPerimeter.push_back(false); - } else if (s_ipsc->lAlphaFieldBlanks(alpF)) { - ShowSevereError( - state, - format("{}: {}, {} set as calculation method, but no value has been set for {}. Must be \"Yes\" or \"No\".", - s_ipsc->cCurrentModuleObject, - state.dataSurface->Surface(Found).Name, - calculationMethod, - s_ipsc->cAlphaFieldNames(alpF))); + if (s_ipsc->lAlphaFieldBlanks(alpF)) { + ShowSevereEmptyField( + state, eoh, s_ipsc->cAlphaFieldNames(alpF), "Calculation Method", CalculationMethodUC[(int)calculationMethod]); ErrorsFound = true; + } else if (BooleanSwitch bs = getYesNoValue(s_ipsc->cAlphaArgs(alpF)); bs != BooleanSwitch::Invalid) { + data.isExposedPerimeter.push_back(static_cast(bs)); } else { - ShowSevereError(state, - format("{}: {}, {} invalid [{}]. Must be \"Yes\" or \"No\".", - s_ipsc->cCurrentModuleObject, - state.dataSurface->Surface(Found).Name, - s_ipsc->cAlphaFieldNames(alpF), - s_ipsc->cAlphaArgs(alpF))); + ShowSevereInvalidBool(state, eoh, s_ipsc->cAlphaFieldNames(alpF), s_ipsc->cAlphaArgs(alpF)); ErrorsFound = true; } alpF++; @@ -8070,38 +7563,23 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR X LUO // DATE WRITTEN July 2017 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // load input data for Outdoor Air Node for exterior surfaces - // Using/Aliasing - using namespace DataErrorTracking; - using DataLoopNode::ObjectIsParent; - using NodeInputManager::GetOnlySingleNode; - using OutAirNodeManager::CheckOutAirNodeNumber; - using ScheduleManager::GetScheduleIndex; - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetSurfaceLocalEnvData: "); + static constexpr std::string_view routineName = "GetSurfaceLocalEnvData"; - // INTERFACE BLOCK SPECIFICATIONS:na - // DERIVED TYPE DEFINITIONS:na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int NumAlpha; - int NumNumeric; - int IOStat; - - //----------------------------------------------------------------------- - // SurfaceProperty:LocalEnvironment - //----------------------------------------------------------------------- auto &s_ipsc = state.dataIPShortCut; s_ipsc->cCurrentModuleObject = "SurfaceProperty:LocalEnvironment"; state.dataSurface->TotSurfLocalEnv = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); if (state.dataSurface->TotSurfLocalEnv > 0) { + int NumAlpha; + int NumNumeric; + int IOStat; state.dataGlobal->AnyLocalEnvironmentsInModel = true; @@ -8125,6 +7603,9 @@ namespace SurfaceGeometry { s_ipsc->lAlphaFieldBlanks, s_ipsc->cAlphaFieldNames, s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + Util::IsNameEmpty(state, s_ipsc->cAlphaArgs(1), s_ipsc->cCurrentModuleObject, ErrorsFound); SurfLocalEnv.Name = s_ipsc->cAlphaArgs(1); @@ -8149,24 +7630,10 @@ namespace SurfaceGeometry { } // Assign Sunlit Fraction Schedule number - if (!s_ipsc->lAlphaFieldBlanks(3)) { - int SunlitFracSchedNum = GetScheduleIndex(state, s_ipsc->cAlphaArgs(3)); - if (SunlitFracSchedNum == 0) { - ShowSevereError(state, - format("{} {} = \"{}\", object. Illegal value for \"{}\" has been found.", - RoutineName, - s_ipsc->cCurrentModuleObject, - SurfLocalEnv.Name, - s_ipsc->cAlphaFieldNames(3))); - ShowContinueError( - state, - format("{} entered value = \"{}\", no corresponding sunlit fraction schedule has been found in the input file.", - s_ipsc->cAlphaFieldNames(3), - s_ipsc->cAlphaArgs(3))); - ErrorsFound = true; - } else { - SurfLocalEnv.SunlitFracSchedPtr = SunlitFracSchedNum; - } + if (s_ipsc->lAlphaFieldBlanks(3)) { + } else if ((SurfLocalEnv.sunlitFracSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3)); + ErrorsFound = true; } // Assign surrounding surfaces object number; @@ -8200,8 +7667,8 @@ namespace SurfaceGeometry { DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, - ObjectIsParent); - if (NodeNum == 0 && CheckOutAirNodeNumber(state, NodeNum)) { + DataLoopNode::ObjectIsParent); + if (NodeNum == 0 && OutAirNodeManager::CheckOutAirNodeNumber(state, NodeNum)) { ShowSevereError(state, format("{} {} = \"{}\", object. Illegal value for \"{}\" has been found.", RoutineName, @@ -8243,15 +7710,15 @@ namespace SurfaceGeometry { // Link surface properties to surface object for (int SurfLoop = 1; SurfLoop <= state.dataSurface->TotSurfaces; ++SurfLoop) { for (int Loop = 1; Loop <= state.dataSurface->TotSurfLocalEnv; ++Loop) { - auto &SurfLocalEnv = state.dataSurface->SurfLocalEnvironment(Loop); + auto const &SurfLocalEnv = state.dataSurface->SurfLocalEnvironment(Loop); if (SurfLocalEnv.SurfPtr == SurfLoop) { auto &surface = state.dataSurface->Surface(SurfLoop); if (SurfLocalEnv.OutdoorAirNodePtr != 0) { surface.SurfLinkedOutAirNode = SurfLocalEnv.OutdoorAirNodePtr; } - if (SurfLocalEnv.SunlitFracSchedPtr != 0) { + if (SurfLocalEnv.sunlitFracSched != nullptr) { surface.SurfSchedExternalShadingFrac = true; - surface.SurfExternalShadingSchInd = SurfLocalEnv.SunlitFracSchedPtr; + surface.surfExternalShadingSched = SurfLocalEnv.sunlitFracSched; } if (SurfLocalEnv.SurroundingSurfsPtr != 0) { surface.SurfHasSurroundingSurfProperty = true; @@ -8278,36 +7745,20 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR X LUO // DATE WRITTEN July 2017 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // load input data for surrounding surfaces properties for exterior surfaces + constexpr std::string_view routineName = "GetSurfaceSrdSurfsData"; - // Using/Aliasing - using namespace DataErrorTracking; - using DataLoopNode::ObjectIsParent; - using NodeInputManager::GetOnlySingleNode; - using OutAirNodeManager::CheckOutAirNodeNumber; - using ScheduleManager::GetScheduleIndex; - - // INTERFACE BLOCK SPECIFICATIONS:na - // DERIVED TYPE DEFINITIONS:na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int NumAlpha; - int NumNumeric; - int IOStat; - int TotSrdSurfProperties; - - //----------------------------------------------------------------------- - // SurfaceProperty:SurroundingSurfaces - //----------------------------------------------------------------------- auto &s_ipsc = state.dataIPShortCut; s_ipsc->cCurrentModuleObject = "SurfaceProperty:SurroundingSurfaces"; - TotSrdSurfProperties = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + int TotSrdSurfProperties = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); if (TotSrdSurfProperties > 0) { + int NumAlpha; + int NumNumeric; + int IOStat; if (!allocated(state.dataSurface->SurroundingSurfsProperty)) { state.dataSurface->SurroundingSurfsProperty.allocate(TotSrdSurfProperties); @@ -8329,6 +7780,9 @@ namespace SurfaceGeometry { s_ipsc->lAlphaFieldBlanks, s_ipsc->cAlphaFieldNames, s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + Util::IsNameEmpty(state, s_ipsc->cAlphaArgs(1), s_ipsc->cCurrentModuleObject, ErrorsFound); // A1: Name @@ -8341,8 +7795,9 @@ namespace SurfaceGeometry { } // A2: sky temp sch name - if (!s_ipsc->lAlphaFieldBlanks(2)) { - SrdSurfsProp.SkyTempSchNum = GetScheduleIndex(state, s_ipsc->cAlphaArgs(2)); + if (s_ipsc->lAlphaFieldBlanks(2)) { + } else if ((SrdSurfsProp.skyTempSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) { + ShowWarningItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); } // N2: ground view factor @@ -8352,8 +7807,9 @@ namespace SurfaceGeometry { } // A3: ground temp sch name - if (!s_ipsc->lAlphaFieldBlanks(3)) { - SrdSurfsProp.GroundTempSchNum = GetScheduleIndex(state, s_ipsc->cAlphaArgs(3)); + if (s_ipsc->lAlphaFieldBlanks(3)) { + } else if ((SrdSurfsProp.groundTempSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(3))) == nullptr) { + ShowWarningItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3)); } // The object requires at least one srd surface input, each surface requires a set of 3 fields (2 Alpha fields Name and Temp @@ -8374,9 +7830,18 @@ namespace SurfaceGeometry { SrdSurfsProp.TotSurroundingSurface = NumNumeric - 2; SrdSurfsProp.SurroundingSurfs.allocate(SrdSurfsProp.TotSurroundingSurface); for (int SurfLoop = 1; SurfLoop <= SrdSurfsProp.TotSurroundingSurface; ++SurfLoop) { - SrdSurfsProp.SurroundingSurfs(SurfLoop).Name = s_ipsc->cAlphaArgs(SurfLoop * 2 + 2); - SrdSurfsProp.SurroundingSurfs(SurfLoop).ViewFactor = s_ipsc->rNumericArgs(SurfLoop + 2); - SrdSurfsProp.SurroundingSurfs(SurfLoop).TempSchNum = GetScheduleIndex(state, s_ipsc->cAlphaArgs(SurfLoop * 2 + 3)); + auto &surroundSurf = SrdSurfsProp.SurroundingSurfs(SurfLoop); + surroundSurf.Name = s_ipsc->cAlphaArgs(SurfLoop * 2 + 2); + surroundSurf.ViewFactor = s_ipsc->rNumericArgs(SurfLoop + 2); + + // Added checking + if (s_ipsc->lAlphaFieldBlanks(SurfLoop * 2 + 3)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(SurfLoop * 2 + 3)); + ErrorsFound = true; + } else if ((surroundSurf.tempSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(SurfLoop * 2 + 3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(SurfLoop * 2 + 3), s_ipsc->cAlphaArgs(SurfLoop * 2 + 3)); + ErrorsFound = true; + } SrdSurfsProp.SurfsViewFactorSum += SrdSurfsProp.SurroundingSurfs(SurfLoop).ViewFactor; } } @@ -8385,6 +7850,8 @@ namespace SurfaceGeometry { void GetSurfaceGroundSurfsData(EnergyPlusData &state, bool &ErrorsFound) { + static constexpr std::string_view routineName = "GetSurfaceGroundSurfsData"; + auto &s_ipsc = state.dataIPShortCut; s_ipsc->cCurrentModuleObject = "SurfaceProperty:GroundSurfaces"; state.dataSurface->TotSurfPropGndSurfs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); @@ -8392,55 +7859,64 @@ namespace SurfaceGeometry { if (instances == state.dataInputProcessing->inputProcessor->epJSON.end()) { if (state.dataSurface->TotSurfPropGndSurfs > 0) ErrorsFound = true; return; - } else { - auto &instancesValue = instances.value(); - for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { - auto const &fields = instance.value(); - std::string const &thisObjectName = instance.key(); - GroundSurfacesProperty thisGndSurfsObj; - thisGndSurfsObj.Name = Util::makeUPPER(thisObjectName); - state.dataInputProcessing->inputProcessor->markObjectAsUsed(s_ipsc->cCurrentModuleObject, thisObjectName); - auto groundSurfaces = fields.find("ground_surfaces"); - if (groundSurfaces != fields.end()) { - auto &groundSurfacesArray = groundSurfaces.value(); - thisGndSurfsObj.NumGndSurfs = groundSurfacesArray.size(); - for (auto &groundSurface : groundSurfacesArray) { - GroundSurfacesData thisGndSurf; - auto GndSurfName = groundSurface.find("ground_surface_name"); - if (GndSurfName != groundSurface.end()) { - std::string ground_surf_name = GndSurfName.value().get(); - if (!ground_surf_name.empty()) { - thisGndSurf.Name = Util::makeUPPER(ground_surf_name); - } - } - auto groundSurfViewFactor = groundSurface.find("ground_surface_view_factor"); - if (groundSurfViewFactor != groundSurface.end()) { - thisGndSurf.ViewFactor = groundSurfViewFactor.value().get(); - thisGndSurfsObj.IsGroundViewFactorSet = true; + } + + auto &instancesValue = instances.value(); + for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { + auto const &fields = instance.value(); + std::string const &thisObjectName = instance.key(); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, thisObjectName}; + + DataSurfaces::GroundSurfacesProperty thisGndSurfsObj; + thisGndSurfsObj.Name = Util::makeUPPER(thisObjectName); + state.dataInputProcessing->inputProcessor->markObjectAsUsed(s_ipsc->cCurrentModuleObject, thisObjectName); + auto groundSurfaces = fields.find("ground_surfaces"); + if (groundSurfaces != fields.end()) { + auto &groundSurfacesArray = groundSurfaces.value(); + thisGndSurfsObj.NumGndSurfs = groundSurfacesArray.size(); + for (auto &groundSurface : groundSurfacesArray) { + DataSurfaces::GroundSurfacesData thisGndSurf; + auto GndSurfName = groundSurface.find("ground_surface_name"); + if (GndSurfName != groundSurface.end()) { + std::string ground_surf_name = GndSurfName.value().get(); + if (!ground_surf_name.empty()) { + thisGndSurf.Name = Util::makeUPPER(ground_surf_name); } - auto TempSchName = groundSurface.find("ground_surface_temperature_schedule_name"); - if (TempSchName != groundSurface.end()) { - std::string gnd_surf_TempSchName = TempSchName.value().get(); - if (!gnd_surf_TempSchName.empty()) { - thisGndSurf.TempSchPtr = ScheduleManager::GetScheduleIndex(state, Util::makeUPPER(gnd_surf_TempSchName)); - } + } + auto groundSurfViewFactor = groundSurface.find("ground_surface_view_factor"); + if (groundSurfViewFactor != groundSurface.end()) { + thisGndSurf.ViewFactor = groundSurfViewFactor.value().get(); + thisGndSurfsObj.IsGroundViewFactorSet = true; + } + auto TempSchName = groundSurface.find("ground_surface_temperature_schedule_name"); + if (TempSchName != groundSurface.end()) { + std::string schedName = TempSchName.value().get(); + if (schedName.empty()) { + } else if ((thisGndSurf.tempSched = Sched::GetSchedule(state, Util::makeUPPER(schedName))) == nullptr) { + ShowSevereItemNotFound(state, eoh, "Ground Surface Temperature Schedule Name", schedName); + ErrorsFound = true; } - auto ReflSchName = groundSurface.find("ground_surface_reflectance_schedule_name"); - if (ReflSchName != groundSurface.end()) { - std::string gnd_surf_ReflSchName = ReflSchName.value().get(); - if (!gnd_surf_ReflSchName.empty()) { - thisGndSurf.ReflSchPtr = ScheduleManager::GetScheduleIndex(state, Util::makeUPPER(gnd_surf_ReflSchName)); - } + } + + auto ReflSchName = groundSurface.find("ground_surface_reflectance_schedule_name"); + if (ReflSchName != groundSurface.end()) { + std::string schedName = ReflSchName.value().get(); + if (schedName.empty()) { + } else if ((thisGndSurf.reflSched = Sched::GetSchedule(state, Util::makeUPPER(schedName))) == nullptr) { + ShowSevereItemNotFound(state, eoh, "Ground Surface Reflectance Schedule Name", schedName); + ErrorsFound = true; } - thisGndSurfsObj.GndSurfs.push_back(thisGndSurf); } + thisGndSurfsObj.GndSurfs.push_back(thisGndSurf); } - for (int gSurfNum = 1; gSurfNum <= thisGndSurfsObj.NumGndSurfs; gSurfNum++) { - thisGndSurfsObj.SurfsViewFactorSum += thisGndSurfsObj.GndSurfs(gSurfNum).ViewFactor; - } - state.dataSurface->GroundSurfsProperty.push_back(thisGndSurfsObj); } - } + for (int gSurfNum = 1; gSurfNum <= thisGndSurfsObj.NumGndSurfs; gSurfNum++) { + thisGndSurfsObj.SurfsViewFactorSum += thisGndSurfsObj.GndSurfs(gSurfNum).ViewFactor; + } + state.dataSurface->GroundSurfsProperty.push_back(thisGndSurfsObj); + } // for (instance) + // set report variables if (state.dataSurface->TotSurfPropGndSurfs > 0) { for (int Loop = 1; Loop <= state.dataSurface->TotSurfPropGndSurfs; Loop++) { @@ -8448,7 +7924,7 @@ namespace SurfaceGeometry { bool SetReflSchReportVar = true; auto &thisGndSurfsObj = state.dataSurface->GroundSurfsProperty(Loop); for (int gSurfNum = 1; gSurfNum <= thisGndSurfsObj.NumGndSurfs; gSurfNum++) { - if (thisGndSurfsObj.GndSurfs(gSurfNum).TempSchPtr != 0 && SetTempSchReportVar) { + if (thisGndSurfsObj.GndSurfs(gSurfNum).tempSched != nullptr && SetTempSchReportVar) { SetupOutputVariable(state, "Surfaces Property Ground Surfaces Average Temperature", Constant::Units::C, @@ -8458,7 +7934,7 @@ namespace SurfaceGeometry { thisGndSurfsObj.Name); SetTempSchReportVar = false; } - if (thisGndSurfsObj.GndSurfs(gSurfNum).ReflSchPtr != 0 && SetReflSchReportVar) { + if (thisGndSurfsObj.GndSurfs(gSurfNum).reflSched != nullptr && SetReflSchReportVar) { SetupOutputVariable(state, "Surfaces Property Ground Surfaces Average Reflectance", Constant::Units::None, @@ -8479,23 +7955,13 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR B. Griffith, portions from ApplyConvectionValue by Linda Lawrie // DATE WRITTEN July 2012 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS SUBROUTINE: - // - - // Using/Aliasing + static constexpr std::string_view routineName = "GetSurfaceHeatTransferAlgorithmOverrides"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int CountHTAlgoObjectsSingleSurf; int CountHTAlgoObjectsMultiSurf; int CountHTAlgoObjectsSurfList; int IOStatus; // Used in GetObjectItem - bool ErrorsFoundSingleSurf(false); - bool ErrorsFoundMultiSurf(false); - bool ErrorsFoundSurfList(false); - bool ErrorsFoundByConstruct(false); DataSurfaces::HeatTransferModel tmpAlgoInput; int Item; int Item1; @@ -8534,13 +8000,15 @@ namespace SurfaceGeometry { s_ipsc->lAlphaFieldBlanks, s_ipsc->cAlphaFieldNames, s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; Found = Util::FindItemInList(s_ipsc->cAlphaArgs(1), state.dataSurface->Surface, state.dataSurface->TotSurfaces); if (Found == 0) { ShowSevereError(state, format("{}=\"{}\", did not find matching surface.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; - } else if (state.dataSurface->Surface(Found).InsideHeatSourceTermSchedule || - state.dataSurface->Surface(Found).OutsideHeatSourceTermSchedule) { + } else if (state.dataSurface->Surface(Found).insideHeatSourceTermSched != nullptr || + state.dataSurface->Surface(Found).outsideHeatSourceTermSched != nullptr) { ShowSevereError(state, format("{}=\"{}\", multiple SurfaceProperty:HeatBalanceSourceTerm objects applied to the same surface.", s_ipsc->cCurrentModuleObject, @@ -8548,44 +8016,30 @@ namespace SurfaceGeometry { ErrorsFound = true; } - if (!s_ipsc->lAlphaFieldBlanks(2)) { - state.dataSurface->Surface(Found).InsideHeatSourceTermSchedule = ScheduleManager::GetScheduleIndex(state, s_ipsc->cAlphaArgs(2)); - if (state.dataSurface->Surface(Found).InsideHeatSourceTermSchedule == 0) { - ShowSevereError(state, - format("{}=\"{}\", cannot find the matching Schedule: {}=\"{}", - s_ipsc->cCurrentModuleObject, - s_ipsc->cAlphaArgs(1), - s_ipsc->cAlphaFieldNames(2), - s_ipsc->cAlphaArgs(2))); - ErrorsFound = true; - } else { - state.dataSurface->allInsideSourceSurfaceList.emplace_back(Found); - } + if (s_ipsc->lAlphaFieldBlanks(2)) { + } else if ((state.dataSurface->Surface(Found).insideHeatSourceTermSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); + ErrorsFound = true; + } else { + state.dataSurface->allInsideSourceSurfaceList.emplace_back(Found); } - if (!s_ipsc->lAlphaFieldBlanks(3)) { - state.dataSurface->Surface(Found).OutsideHeatSourceTermSchedule = ScheduleManager::GetScheduleIndex(state, s_ipsc->cAlphaArgs(3)); - if (state.dataSurface->Surface(Found).OutsideHeatSourceTermSchedule == 0) { - ShowSevereError(state, - format("{}=\"{}\", cannot find the matching Schedule: {}=\"{}", - s_ipsc->cCurrentModuleObject, - s_ipsc->cAlphaArgs(1), - s_ipsc->cAlphaFieldNames(3), - s_ipsc->cAlphaArgs(3))); - ErrorsFound = true; - } else if (state.dataSurface->Surface(Found).OSCPtr > 0) { - ShowSevereError(state, - format("{}=\"SurfaceProperty:HeatBalanceSourceTerm\", cannot be specified for OtherSideCoefficient Surface={}", - s_ipsc->cCurrentModuleObject, - s_ipsc->cAlphaArgs(1))); - ErrorsFound = true; - } else { - state.dataSurface->allOutsideSourceSurfaceList.emplace_back(Found); - } + if (s_ipsc->lAlphaFieldBlanks(3)) { + } else if ((state.dataSurface->Surface(Found).outsideHeatSourceTermSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3)); + ErrorsFound = true; + } else if (state.dataSurface->Surface(Found).OSCPtr > 0) { + ShowSevereError(state, + format("{}=\"SurfaceProperty:HeatBalanceSourceTerm\", cannot be specified for OtherSideCoefficient Surface={}", + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1))); + ErrorsFound = true; + } else { + state.dataSurface->allOutsideSourceSurfaceList.emplace_back(Found); } - if (state.dataSurface->Surface(Found).OutsideHeatSourceTermSchedule == 0 && - state.dataSurface->Surface(Found).InsideHeatSourceTermSchedule == 0) { + if (state.dataSurface->Surface(Found).outsideHeatSourceTermSched == nullptr && + state.dataSurface->Surface(Found).insideHeatSourceTermSched == nullptr) { ShowSevereError( state, format("{}=\"{}\", no schedule defined for additional heat source.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; @@ -8613,7 +8067,7 @@ namespace SurfaceGeometry { s_ipsc->lAlphaFieldBlanks, s_ipsc->cAlphaFieldNames, s_ipsc->cNumericFieldNames); - ErrorsFoundSingleSurf = false; + bool ErrorsFoundSingleSurf = false; Found = Util::FindItemInList(s_ipsc->cAlphaArgs(1), state.dataSurface->Surface, state.dataSurface->TotSurfaces); if (Found == 0) { @@ -8670,7 +8124,7 @@ namespace SurfaceGeometry { s_ipsc->lAlphaFieldBlanks, s_ipsc->cAlphaFieldNames, s_ipsc->cNumericFieldNames); - ErrorsFoundMultiSurf = false; + bool ErrorsFoundMultiSurf = false; { std::string const &SELECT_CASE_var = s_ipsc->cAlphaArgs(3); @@ -8753,7 +8207,7 @@ namespace SurfaceGeometry { for (SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { auto &surf = state.dataSurface->Surface(SurfNum); if (!surf.HeatTransSurf) continue; - if (surf.ExtBoundCond != Ground) continue; // ground BC + if (surf.ExtBoundCond != DataSurfaces::Ground) continue; // ground BC if (state.dataConstruction->Construct(surf.Construction).TypeIsWindow) continue; SurfacesOfType = true; surf.HeatTransferAlgorithm = tmpAlgoInput; @@ -8843,7 +8297,7 @@ namespace SurfaceGeometry { s_ipsc->lAlphaFieldBlanks, s_ipsc->cAlphaFieldNames, s_ipsc->cNumericFieldNames); - ErrorsFoundSurfList = false; + bool ErrorsFoundSurfList = false; { std::string const &SELECT_CASE_var = s_ipsc->cAlphaArgs(2); @@ -8903,7 +8357,7 @@ namespace SurfaceGeometry { s_ipsc->lAlphaFieldBlanks, s_ipsc->cAlphaFieldNames, s_ipsc->cNumericFieldNames); - ErrorsFoundByConstruct = false; + bool ErrorsFoundByConstruct = false; { std::string const &SELECT_CASE_var = s_ipsc->cAlphaArgs(2); @@ -8952,7 +8406,7 @@ namespace SurfaceGeometry { // Change algorithm for Kiva and air boundary foundation surfaces for (auto &surf : state.dataSurface->Surface) { - if (surf.ExtBoundCond == KivaFoundation) { + if (surf.ExtBoundCond == DataSurfaces::KivaFoundation) { surf.HeatTransferAlgorithm = DataSurfaces::HeatTransferModel::Kiva; state.dataHeatBal->AnyKiva = true; } @@ -9145,7 +8599,7 @@ namespace SurfaceGeometry { for (Item = 1; Item <= state.dataSurface->TotSurfaces; ++Item) { if (state.dataSurface->Surface(Item).Class == SurfaceClass::Window || state.dataSurface->Surface(Item).Class == SurfaceClass::GlassDoor) { // todo, add complex fenestration switch HeatTransferModel_ComplexFenestration - if (state.dataSurface->SurfWinWindowModelType(Item) == WindowModel::BSDF) { + if (state.dataSurface->SurfWinWindowModelType(Item) == DataSurfaces::WindowModel::BSDF) { state.dataSurface->Surface(Item).HeatTransferAlgorithm = DataSurfaces::HeatTransferModel::ComplexFenestration; } else { state.dataSurface->Surface(Item).HeatTransferAlgorithm = DataSurfaces::HeatTransferModel::Window5; @@ -9207,10 +8661,10 @@ namespace SurfaceGeometry { int poppedVertexPos = -1; int keptVertexPos = -1; - for (size_t index = 0; index < nSides; ++index) { + for (index = 0; index < nSides; ++index) { size_t const prevIndex = (index == 0) ? nSides - 1 : index - 1; - Real64 &distanceThisToNext = distances[index]; - Real64 &distanceThisToPrev = distances[prevIndex]; + Real64 const &distanceThisToNext = distances[index]; + Real64 const &distanceThisToPrev = distances[prevIndex]; if ((distanceThisToNext >= Constant::OneCentimeter) && (distanceThisToPrev >= Constant::OneCentimeter)) { continue; } @@ -9240,8 +8694,6 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN May 2000 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine gets the surface vertices from the arrays @@ -9250,30 +8702,10 @@ namespace SurfaceGeometry { // a standard place for determining various properties of the surface // from the vertices. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // Using/Aliasing - using namespace Vectors; - - using namespace DataErrorTracking; - - // SUBROUTINE ARGUMENT DEFINITIONS: - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetVertices: "); - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int Ptr; // Pointer into Vertice array int n; // Loop counter int NSrc; // Used for CW -> CCW transformation int NTar; // Used for CW -> CCW transformation @@ -9284,7 +8716,6 @@ namespace SurfaceGeometry { Real64 Yb; // Intermediate calculation int ZoneNum; int ThisCorner; - std::string TiltString; Real64 ThisWidth; Real64 ThisHeight; // unused REAL(r64) :: ccwtest @@ -9295,14 +8726,16 @@ namespace SurfaceGeometry { Vector const TestVector(0.0, 0.0, 1.0); Vector temp; + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); + if (NSides > state.dataSurface->MaxVerticesPerSurface) state.dataSurface->MaxVerticesPerSurface = NSides; - Ptr = 1; + int Ptr = 1; for (n = 1; n <= NSides; ++n) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).x = Vertices(Ptr); + surfTemp.Vertex(n).x = Vertices(Ptr); ++Ptr; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).y = Vertices(Ptr); + surfTemp.Vertex(n).y = Vertices(Ptr); ++Ptr; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).z = Vertices(Ptr); + surfTemp.Vertex(n).z = Vertices(Ptr); ++Ptr; } @@ -9313,9 +8746,9 @@ namespace SurfaceGeometry { NSrc = NSides; NTar = 2; for (n = 1; n <= (NSides - 1) / 2; ++n) { - temp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(NSrc); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(NSrc) = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(NTar); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(NTar) = temp; + temp = surfTemp.Vertex(NSrc); + surfTemp.Vertex(NSrc) = surfTemp.Vertex(NTar); + surfTemp.Vertex(NTar) = temp; --NSrc; ++NTar; } @@ -9325,10 +8758,9 @@ namespace SurfaceGeometry { // 2/2011 - don't think the shading calculations have a corner preference. Will keep this for // consistency (for now) ThisCorner = state.dataSurface->Corner; - while (ThisCorner != UpperLeftCorner) { + while (ThisCorner != DataSurfaces::UpperLeftCorner) { if (NSides < 4) { - if (ThisCorner == UpperRightCorner) { - ThisCorner = UpperLeftCorner; + if (ThisCorner == DataSurfaces::UpperRightCorner) { break; } } @@ -9336,9 +8768,9 @@ namespace SurfaceGeometry { NSrc = ThisCorner + 1; if (NSrc > NSides) NSrc = 1; for (n = 1; n <= NSides - 1; ++n) { - temp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(NTar); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(NTar) = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(NSrc); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(NSrc) = temp; + temp = surfTemp.Vertex(NTar); + surfTemp.Vertex(NTar) = surfTemp.Vertex(NSrc); + surfTemp.Vertex(NSrc) = temp; ++NTar; ++NSrc; if (NTar > NSides) NTar = 1; @@ -9350,51 +8782,41 @@ namespace SurfaceGeometry { if (!state.dataSurface->WorldCoordSystem) { // Input in "relative" coordinates, use Building and Zone North Axes and Origins // to translate each point (including rotation for Appendix G) - ZoneNum = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone; + ZoneNum = surfTemp.Zone; if (ZoneNum > 0) { for (n = 1; n <= NSides; ++n) { - Xb = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).x * state.dataSurfaceGeometry->CosZoneRelNorth(ZoneNum) - - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).y * state.dataSurfaceGeometry->SinZoneRelNorth(ZoneNum) + - state.dataHeatBal->Zone(ZoneNum).OriginX; - Yb = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).x * state.dataSurfaceGeometry->SinZoneRelNorth(ZoneNum) + - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).y * state.dataSurfaceGeometry->CosZoneRelNorth(ZoneNum) + - state.dataHeatBal->Zone(ZoneNum).OriginY; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).x = - Xb * state.dataSurfaceGeometry->CosBldgRelNorth - Yb * state.dataSurfaceGeometry->SinBldgRelNorth; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).y = - Xb * state.dataSurfaceGeometry->SinBldgRelNorth + Yb * state.dataSurfaceGeometry->CosBldgRelNorth; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).z += state.dataHeatBal->Zone(ZoneNum).OriginZ; - } - } else if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Detached_B) { + Xb = surfTemp.Vertex(n).x * state.dataSurfaceGeometry->CosZoneRelNorth(ZoneNum) - + surfTemp.Vertex(n).y * state.dataSurfaceGeometry->SinZoneRelNorth(ZoneNum) + state.dataHeatBal->Zone(ZoneNum).OriginX; + Yb = surfTemp.Vertex(n).x * state.dataSurfaceGeometry->SinZoneRelNorth(ZoneNum) + + surfTemp.Vertex(n).y * state.dataSurfaceGeometry->CosZoneRelNorth(ZoneNum) + state.dataHeatBal->Zone(ZoneNum).OriginY; + surfTemp.Vertex(n).x = Xb * state.dataSurfaceGeometry->CosBldgRelNorth - Yb * state.dataSurfaceGeometry->SinBldgRelNorth; + surfTemp.Vertex(n).y = Xb * state.dataSurfaceGeometry->SinBldgRelNorth + Yb * state.dataSurfaceGeometry->CosBldgRelNorth; + surfTemp.Vertex(n).z += state.dataHeatBal->Zone(ZoneNum).OriginZ; + } + } else if (surfTemp.Class == SurfaceClass::Detached_B) { for (n = 1; n <= NSides; ++n) { - Xb = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).x; - Yb = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).y; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).x = - Xb * state.dataSurfaceGeometry->CosBldgRelNorth - Yb * state.dataSurfaceGeometry->SinBldgRelNorth; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).y = - Xb * state.dataSurfaceGeometry->SinBldgRelNorth + Yb * state.dataSurfaceGeometry->CosBldgRelNorth; + Xb = surfTemp.Vertex(n).x; + Yb = surfTemp.Vertex(n).y; + surfTemp.Vertex(n).x = Xb * state.dataSurfaceGeometry->CosBldgRelNorth - Yb * state.dataSurfaceGeometry->SinBldgRelNorth; + surfTemp.Vertex(n).y = Xb * state.dataSurfaceGeometry->SinBldgRelNorth + Yb * state.dataSurfaceGeometry->CosBldgRelNorth; } } } else { // if world coordinate only need to rotate for Appendix G - ZoneNum = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone; + ZoneNum = surfTemp.Zone; if (ZoneNum > 0) { for (n = 1; n <= NSides; ++n) { - Xb = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).x; - Yb = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).y; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).x = - Xb * state.dataSurfaceGeometry->CosBldgRotAppGonly - Yb * state.dataSurfaceGeometry->SinBldgRotAppGonly; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).y = - Xb * state.dataSurfaceGeometry->SinBldgRotAppGonly + Yb * state.dataSurfaceGeometry->CosBldgRotAppGonly; - } - } else if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Detached_B) { + Xb = surfTemp.Vertex(n).x; + Yb = surfTemp.Vertex(n).y; + surfTemp.Vertex(n).x = Xb * state.dataSurfaceGeometry->CosBldgRotAppGonly - Yb * state.dataSurfaceGeometry->SinBldgRotAppGonly; + surfTemp.Vertex(n).y = Xb * state.dataSurfaceGeometry->SinBldgRotAppGonly + Yb * state.dataSurfaceGeometry->CosBldgRotAppGonly; + } + } else if (surfTemp.Class == SurfaceClass::Detached_B) { for (n = 1; n <= NSides; ++n) { - Xb = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).x; - Yb = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).y; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).x = - Xb * state.dataSurfaceGeometry->CosBldgRotAppGonly - Yb * state.dataSurfaceGeometry->SinBldgRotAppGonly; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).y = - Xb * state.dataSurfaceGeometry->SinBldgRotAppGonly + Yb * state.dataSurfaceGeometry->CosBldgRotAppGonly; + Xb = surfTemp.Vertex(n).x; + Yb = surfTemp.Vertex(n).y; + surfTemp.Vertex(n).x = Xb * state.dataSurfaceGeometry->CosBldgRotAppGonly - Yb * state.dataSurfaceGeometry->SinBldgRotAppGonly; + surfTemp.Vertex(n).y = Xb * state.dataSurfaceGeometry->SinBldgRotAppGonly + Yb * state.dataSurfaceGeometry->CosBldgRotAppGonly; } } } @@ -9403,6 +8825,7 @@ namespace SurfaceGeometry { auto &surface = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); auto &vertices = surface.Vertex; auto &nSides = surface.Sides; + std::string TiltString; while (true) { PopCoincidentVertexReturn const popResult = checkPopCoincidentVertex(vertices); @@ -9425,8 +8848,8 @@ namespace SurfaceGeometry { ShowWarningError(state, format("{}Distance between two vertices < .01, possibly coincident. for Surface={}, in Zone={}", RoutineName, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName)); + surfTemp.Name, + surfTemp.ZoneName)); bool const printPoppedFirst = (poppedVertexIndex < keptVertexIndex) ? !(poppedVertexIndex == 1 && keptVertexIndex == nSides) : (poppedVertexIndex == nSides && keptVertexIndex == 1); @@ -9461,118 +8884,101 @@ namespace SurfaceGeometry { // No need to recompute perimeter, because it'll be done in the next iteration, until no popping or degenerate happens } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Perimeter = Perimeter; + surfTemp.Perimeter = Perimeter; - CreateNewellSurfaceNormalVector(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).NewellSurfaceNormalVector); - CreateNewellAreaVector(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).NewellAreaVector); + Vectors::CreateNewellSurfaceNormalVector(surfTemp.Vertex, surfTemp.Sides, surfTemp.NewellSurfaceNormalVector); + Vectors::CreateNewellAreaVector(surfTemp.Vertex, surfTemp.Sides, surfTemp.NewellAreaVector); // For surfaces with subsurfaces, the following two areas are turned into net areas later by // subtracting subsurface areas - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).GrossArea = VecLength(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).NewellAreaVector); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).GrossArea; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).NetAreaShadowCalc = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area; - DetermineAzimuthAndTilt(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex, - SurfWorldAz, - SurfTilt, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).lcsx, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).lcsy, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).lcsz, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).NewellSurfaceNormalVector); - dotp = dot(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).NewellSurfaceNormalVector, TestVector); - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Roof && dotp < -0.000001) { + surfTemp.GrossArea = Vectors::VecLength(surfTemp.NewellAreaVector); + surfTemp.Area = surfTemp.GrossArea; + surfTemp.NetAreaShadowCalc = surfTemp.Area; + Vectors::DetermineAzimuthAndTilt( + surfTemp.Vertex, SurfWorldAz, SurfTilt, surfTemp.lcsx, surfTemp.lcsy, surfTemp.lcsz, surfTemp.NewellSurfaceNormalVector); + dotp = dot(surfTemp.NewellSurfaceNormalVector, TestVector); + if (surfTemp.Class == SurfaceClass::Roof && dotp < -0.000001) { TiltString = format("{:.1R}", SurfTilt); ShowWarningError(state, format("{}Roof/Ceiling is upside down! Tilt angle=[{}], should be near 0, Surface=\"{}\", in Zone=\"{}\".", RoutineName, TiltString, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName)); + surfTemp.Name, + surfTemp.ZoneName)); ShowContinueError(state, "Automatic fix is attempted."); - ReverseAndRecalculate(state, SurfNum, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides, SurfWorldAz, SurfTilt); - } else if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Roof && SurfTilt > 80.0) { + ReverseAndRecalculate(state, SurfNum, surfTemp.Sides, SurfWorldAz, SurfTilt); + } else if (surfTemp.Class == SurfaceClass::Roof && SurfTilt > 80.0) { TiltString = format("{:.1R}", SurfTilt); ShowWarningError( state, format("{}Roof/Ceiling is not oriented correctly! Tilt angle=[{}], should be near 0, Surface=\"{}\", in Zone=\"{}\".", RoutineName, TiltString, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName)); + surfTemp.Name, + surfTemp.ZoneName)); } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Floor && dotp > 0.000001) { + if (surfTemp.Class == SurfaceClass::Floor && dotp > 0.000001) { TiltString = format("{:.1R}", SurfTilt); ShowWarningError(state, format("{}Floor is upside down! Tilt angle=[{}], should be near 180, Surface=\"{}\", in Zone=\"{}\".", RoutineName, TiltString, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName)); + surfTemp.Name, + surfTemp.ZoneName)); ShowContinueError(state, "Automatic fix is attempted."); - ReverseAndRecalculate(state, SurfNum, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides, SurfWorldAz, SurfTilt); - } else if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Floor && SurfTilt < 158.2) { // slope/grade = 40%! + ReverseAndRecalculate(state, SurfNum, surfTemp.Sides, SurfWorldAz, SurfTilt); + } else if (surfTemp.Class == SurfaceClass::Floor && SurfTilt < 158.2) { // slope/grade = 40%! TiltString = format("{:.1R}", SurfTilt); ShowWarningError(state, format("{}Floor is not oriented correctly! Tilt angle=[{}], should be near 180, Surface=\"{}\", in Zone=\"{}\".", RoutineName, TiltString, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName)); + surfTemp.Name, + surfTemp.ZoneName)); } - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth = SurfWorldAz; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt = SurfTilt; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).convOrientation = - Convect::GetSurfConvOrientation(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt); + surfTemp.Azimuth = SurfWorldAz; + surfTemp.Tilt = SurfTilt; + surfTemp.convOrientation = Convect::GetSurfConvOrientation(surfTemp.Tilt); // Sine and cosine of azimuth and tilt - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SinAzim = std::sin(SurfWorldAz * Constant::DegToRadians); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).CosAzim = std::cos(SurfWorldAz * Constant::DegToRadians); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SinTilt = std::sin(SurfTilt * Constant::DegToRadians); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).CosTilt = std::cos(SurfTilt * Constant::DegToRadians); - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorGround == Constant::AutoCalculate) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorGround = - 0.5 * (1.0 - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).CosTilt); + surfTemp.SinAzim = std::sin(SurfWorldAz * Constant::DegToRad); + surfTemp.CosAzim = std::cos(SurfWorldAz * Constant::DegToRad); + surfTemp.SinTilt = std::sin(SurfTilt * Constant::DegToRad); + surfTemp.CosTilt = std::cos(SurfTilt * Constant::DegToRad); + if (surfTemp.ViewFactorGround == Constant::AutoCalculate) { + surfTemp.ViewFactorGround = 0.5 * (1.0 - surfTemp.CosTilt); } // Outward normal unit vector (pointing away from room) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OutNormVec = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).NewellSurfaceNormalVector; + surfTemp.OutNormVec = surfTemp.NewellSurfaceNormalVector; for (n = 1; n <= 3; ++n) { - if (std::abs(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OutNormVec(n) - 1.0) < 1.e-06) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OutNormVec(n) = +1.0; - if (std::abs(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OutNormVec(n) + 1.0) < 1.e-06) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OutNormVec(n) = -1.0; - if (std::abs(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OutNormVec(n)) < 1.e-06) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OutNormVec(n) = 0.0; - } - - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Window || - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::GlassDoor || - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Door) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area *= state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Multiplier; + if (std::abs(surfTemp.OutNormVec(n) - 1.0) < 1.e-06) surfTemp.OutNormVec(n) = +1.0; + if (std::abs(surfTemp.OutNormVec(n) + 1.0) < 1.e-06) surfTemp.OutNormVec(n) = -1.0; + if (std::abs(surfTemp.OutNormVec(n)) < 1.e-06) surfTemp.OutNormVec(n) = 0.0; + } + + if (surfTemp.Class == SurfaceClass::Window || surfTemp.Class == SurfaceClass::GlassDoor || surfTemp.Class == SurfaceClass::Door) + surfTemp.Area *= surfTemp.Multiplier; // Can perform tests on this surface here - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorSky = 0.5 * (1.0 + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).CosTilt); + surfTemp.ViewFactorSky = 0.5 * (1.0 + surfTemp.CosTilt); // The following IR view factors are modified in subr. SkyDifSolarShading if there are shadowing // surfaces - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorSkyIR = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorSky; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorGroundIR = 0.5 * (1.0 - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).CosTilt); + surfTemp.ViewFactorSkyIR = surfTemp.ViewFactorSky; + surfTemp.ViewFactorGroundIR = 0.5 * (1.0 - surfTemp.CosTilt); // Call to transform vertices - TransformVertsByAspect(state, SurfNum, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides); + TransformVertsByAspect(state, SurfNum, surfTemp.Sides); } else { - ShowFatalError(state, - format("{}Called with less than 2 sides, Surface={}", RoutineName, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); + ShowFatalError(state, format("{}Called with less than 2 sides, Surface={}", RoutineName, surfTemp.Name)); } // Preliminary Height/Width - temp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(3) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(2); - ThisWidth = VecLength(temp); - temp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(2) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(1); - ThisHeight = VecLength(temp); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Height = ThisHeight; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Width = ThisWidth; + temp = surfTemp.Vertex(3) - surfTemp.Vertex(2); + ThisWidth = Vectors::VecLength(temp); + temp = surfTemp.Vertex(2) - surfTemp.Vertex(1); + ThisHeight = Vectors::VecLength(temp); + surfTemp.Height = ThisHeight; + surfTemp.Width = ThisWidth; } void ReverseAndRecalculate(EnergyPlusData &state, @@ -9586,33 +8992,14 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN February 2011 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This routine reverses the vertices for a surface (needed when roof/floor is upside down) // and recalculates the azimuth, etc for the surface. - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // Using/Aliasing - using namespace Vectors; - - // SUBROUTINE ARGUMENT DEFINITIONS: - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("ReverseAndRecalculate: "); - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int n; // Loop Control int RevPtr; // pointer for reversing vertices @@ -9621,48 +9008,43 @@ namespace SurfaceGeometry { // Object Data Array1D Vertices(NSides); // Vertices, in specified order + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); + for (n = 1; n <= NSides; ++n) { - Vertices(n) = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n); + Vertices(n) = surfTemp.Vertex(n); } RevPtr = NSides; for (n = 1; n <= NSides; ++n) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n) = Vertices(RevPtr); + surfTemp.Vertex(n) = Vertices(RevPtr); --RevPtr; } - print(state.files.debug, "Reversing Surface Name={}\n", state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name); + print(state.files.debug, "Reversing Surface Name={}\n", surfTemp.Name); for (n = 1; n <= NSides; ++n) { print(state.files.debug, "side={:5} abs coord vertex= {:18.13F} {:18.13F} {:18.13F}\n", n, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).x, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).y, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).z); - } - - CreateNewellSurfaceNormalVector(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).NewellSurfaceNormalVector); - DetermineAzimuthAndTilt(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex, - SurfAzimuth, - SurfTilt, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).lcsx, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).lcsy, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).lcsz, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).NewellSurfaceNormalVector); - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Roof && SurfTilt > 80.0) { + surfTemp.Vertex(n).x, + surfTemp.Vertex(n).y, + surfTemp.Vertex(n).z); + } + + Vectors::CreateNewellSurfaceNormalVector(surfTemp.Vertex, surfTemp.Sides, surfTemp.NewellSurfaceNormalVector); + Vectors::DetermineAzimuthAndTilt( + surfTemp.Vertex, SurfAzimuth, SurfTilt, surfTemp.lcsx, surfTemp.lcsy, surfTemp.lcsz, surfTemp.NewellSurfaceNormalVector); + if (surfTemp.Class == SurfaceClass::Roof && SurfTilt > 80.0) { TiltString = format("{:.1R}", SurfTilt); ShowWarningError( state, format("{}Roof/Ceiling is still upside down! Tilt angle=[{}], should be near 0, please fix manually.", RoutineName, TiltString)); } - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Floor && SurfTilt < 158.2) { // 40% grade! + if (surfTemp.Class == SurfaceClass::Floor && SurfTilt < 158.2) { // 40% grade! ShowWarningError( state, format("{}Floor is still upside down! Tilt angle=[{}], should be near 180, please fix manually.", RoutineName, TiltString)); } } - void MakeMirrorSurface(EnergyPlusData &state, int &SurfNum) // In=>Surface to Mirror, Out=>new Surface index + void MakeMirrorSurface(EnergyPlusData &state, int &SurfNum) // In=>Surface to Mirror, Out=>new Surface index // This is not good { // SUBROUTINE INFORMATION: @@ -9679,9 +9061,11 @@ namespace SurfaceGeometry { auto &newSurface = state.dataSurfaceGeometry->SurfaceTmp(SurfNum + 1); newSurface = origSurface; + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); + int nVert = origSurface.Sides; // Reverse the vertices in the original surface. Add "MIR-" to name. - for (int Vert = 1; Vert <= state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides; ++Vert) { + for (int Vert = 1; Vert <= surfTemp.Sides; ++Vert) { newSurface.Vertex(Vert) = origSurface.Vertex(nVert); --nVert; } @@ -9703,10 +9087,10 @@ namespace SurfaceGeometry { newSurface.convOrientation = Convect::GetSurfConvOrientation(newSurface.Tilt); // Sine and cosine of azimuth and tilt - newSurface.SinAzim = std::sin(SurfWorldAz * Constant::DegToRadians); - newSurface.CosAzim = std::cos(SurfWorldAz * Constant::DegToRadians); - newSurface.SinTilt = std::sin(SurfTilt * Constant::DegToRadians); - newSurface.CosTilt = std::cos(SurfTilt * Constant::DegToRadians); + newSurface.SinAzim = std::sin(SurfWorldAz * Constant::DegToRad); + newSurface.CosAzim = std::cos(SurfWorldAz * Constant::DegToRad); + newSurface.SinTilt = std::sin(SurfTilt * Constant::DegToRad); + newSurface.CosTilt = std::cos(SurfTilt * Constant::DegToRad); // Outward normal unit vector (pointing away from room) newSurface.OutNormVec = newSurface.NewellSurfaceNormalVector; for (int n = 1; n <= 3; ++n) { @@ -9739,16 +9123,13 @@ namespace SurfaceGeometry { // Shading Type = BetweenGlassShade or BetweenGlassBlind // Dec 2003 (FW): improve BetweenGlassBlind error messages // Feb 2009 (BG): improve error checking for OnIfScheduleAllows - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Reads in the window shading control information // from the input data file, interprets it and puts it in the derived type - // Using/Aliasing - using ScheduleManager::GetScheduleIndex; - // SUBROUTINE PARAMETER DEFINITIONS: + static constexpr std::string_view routineName = "GetWindowShadingControlData"; int constexpr NumValidShadingTypes(9); static Array1D_string const cValidShadingTypes(NumValidShadingTypes, @@ -9764,7 +9145,7 @@ namespace SurfaceGeometry { "BETWEENGLASSBLIND" // 9 }); - constexpr std::array(WindowShadingControlType::Num)> WindowShadingControlTypeNamesUC{ + constexpr std::array(DataSurfaces::WindowShadingControlType::Num)> WindowShadingControlTypeNamesUC{ "ALWAYSON", "ALWAYSOFF", "ONIFSCHEDULEALLOWS", @@ -9790,10 +9171,11 @@ namespace SurfaceGeometry { "ONIFHIGHSOLARORHIGHLUMINANCETILLSUNSET", "ONIFHIGHSOLARORHIGHLUMINANCETILLNEXTMORNING"}; - constexpr std::array(SlatAngleControl::Num)> SlatAngleNamesUC{ + constexpr std::array(DataSurfaces::SlatAngleControl::Num)> SlatAngleNamesUC{ "FIXEDSLATANGLE", "SCHEDULEDSLATANGLE", "BLOCKBEAMSOLAR"}; - constexpr std::array(MultiSurfaceControl::Num)> MultiSurfaceControlNamesUC = {"SEQUENTIAL", "GROUP"}; + constexpr std::array(DataSurfaces::MultiSurfaceControl::Num)> MultiSurfaceControlNamesUC = {"SEQUENTIAL", + "GROUP"}; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int IOStat; // IO Status when calling get input subroutine @@ -9803,8 +9185,6 @@ namespace SurfaceGeometry { int IShadedConst; // Construction number of shaded construction int IShadingDevice; // Material number of shading device int NLayers; // Layers in shaded construction - bool ErrorInName; - bool IsBlank; int Loop; bool BGShadeBlindError; // True if problem with construction that is supposed to have between-glass // shade or blind @@ -9835,8 +9215,11 @@ namespace SurfaceGeometry { s_ipsc->cAlphaFieldNames, s_ipsc->cNumericFieldNames); - ErrorInName = false; - IsBlank = false; + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + bool ErrorInName = false; + bool IsBlank = false; + Util::VerifyName(state, s_ipsc->cAlphaArgs(1), state.dataSurface->WindowShadingControl, @@ -9867,26 +9250,89 @@ namespace SurfaceGeometry { } windowShadingControl.SequenceNumber = int(s_ipsc->rNumericArgs(1)); + + // For upward compatibility change old "noninsulating" and "insulating" shade types to + // INTERIORSHADE or EXTERIORSHADE + if (s_ipsc->cAlphaArgs(3) == "INTERIORNONINSULATINGSHADE" || s_ipsc->cAlphaArgs(3) == "INTERIORINSULATINGSHADE") { + ShowWarningError(state, + format("{}=\"{}\" is using obsolete {}=\"{}\", changing to \"InteriorShade\"", + s_ipsc->cCurrentModuleObject, + windowShadingControl.Name, + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); + windowShadingControl.ShadingType = DataSurfaces::WinShadingType::IntShade; + s_ipsc->cAlphaArgs(3) = "INTERIORSHADE"; + } + if (s_ipsc->cAlphaArgs(3) == "EXTERIORNONINSULATINGSHADE" || s_ipsc->cAlphaArgs(3) == "EXTERIORINSULATINGSHADE") { + ShowWarningError(state, + format("{}=\"{}\" is using obsolete {}=\"{}\", changing to \"ExteriorShade\"", + s_ipsc->cCurrentModuleObject, + windowShadingControl.Name, + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); + windowShadingControl.ShadingType = DataSurfaces::WinShadingType::ExtShade; + s_ipsc->cAlphaArgs(3) = "EXTERIORSHADE"; + } + + // Check for illegal shading type name + Found = Util::FindItemInList(s_ipsc->cAlphaArgs(3), cValidShadingTypes, NumValidShadingTypes); + if (Found <= 1) { + ErrorsFound = true; + ShowSevereError(state, + format("{}=\"{}\" invalid {}=\"{}\".", + s_ipsc->cCurrentModuleObject, + windowShadingControl.Name, + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); + } else { + windowShadingControl.ShadingType = DataSurfaces::WinShadingType(Found); + } + // WindowShadingControl().getInputShadedConstruction is only used during GetInput process and is ultimately stored in // Surface().shadedConstructionList windowShadingControl.getInputShadedConstruction = Util::FindItemInList(s_ipsc->cAlphaArgs(4), state.dataConstruction->Construct, state.dataHeatBal->TotConstructs); windowShadingControl.ShadingDevice = Material::GetMaterialNum(state, s_ipsc->cAlphaArgs(9)); - windowShadingControl.Schedule = GetScheduleIndex(state, s_ipsc->cAlphaArgs(6)); + + if (s_ipsc->lAlphaFieldBlanks(6)) { + windowShadingControl.sched = Sched::GetScheduleAlwaysOn(state); // Not an availability schedule, but the default is constant-1.0 + } else if ((windowShadingControl.sched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(6))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(6), s_ipsc->cAlphaArgs(6)); + ErrorsFound = true; + } + windowShadingControl.SetPoint = s_ipsc->rNumericArgs(2); windowShadingControl.SetPoint2 = s_ipsc->rNumericArgs(3); windowShadingControl.ShadingControlIsScheduled = getYesNoValue(s_ipsc->cAlphaArgs(7)) == BooleanSwitch::Yes; windowShadingControl.GlareControlIsActive = getYesNoValue(s_ipsc->cAlphaArgs(8)) == BooleanSwitch::Yes; - windowShadingControl.SlatAngleSchedule = GetScheduleIndex(state, s_ipsc->cAlphaArgs(11)); + + if (windowShadingControl.ShadingType != DataSurfaces::WinShadingType::IntBlind && + windowShadingControl.ShadingType != DataSurfaces::WinShadingType::ExtBlind && + windowShadingControl.ShadingType != DataSurfaces::WinShadingType::BGBlind) { + } else if (s_ipsc->cAlphaArgs(10).empty()) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(10), s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3)); + ErrorsFound = true; + } else if ((windowShadingControl.slatAngleControl = static_cast( + getEnumValue(SlatAngleNamesUC, s_ipsc->cAlphaArgs(10)))) == DataSurfaces::SlatAngleControl::Invalid) { + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(10), s_ipsc->cAlphaArgs(10)); + ErrorsFound = true; + } else if (windowShadingControl.slatAngleControl != DataSurfaces::SlatAngleControl::Scheduled) { + } else if (s_ipsc->lAlphaFieldBlanks(11)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(11), s_ipsc->cAlphaFieldNames(10), s_ipsc->cAlphaArgs(10)); + ErrorsFound = true; + } else if ((windowShadingControl.slatAngleSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(11))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(11), s_ipsc->cAlphaArgs(11)); + ErrorsFound = true; + } // store the string for now and associate it after daylighting control objects are read windowShadingControl.DaylightingControlName = s_ipsc->cAlphaArgs(12); windowShadingControl.multiSurfaceControl = - static_cast(getEnumValue(MultiSurfaceControlNamesUC, Util::makeUPPER(s_ipsc->cAlphaArgs(13)))); + static_cast(getEnumValue(MultiSurfaceControlNamesUC, s_ipsc->cAlphaArgs(13))); - if (windowShadingControl.multiSurfaceControl == MultiSurfaceControl::Invalid) { - windowShadingControl.multiSurfaceControl = MultiSurfaceControl::Sequential; + if (windowShadingControl.multiSurfaceControl == DataSurfaces::MultiSurfaceControl::Invalid) { + windowShadingControl.multiSurfaceControl = DataSurfaces::MultiSurfaceControl::Sequential; ShowWarningError(state, format("{}=\"{}\" should be either SEQUENTIAL or GROUP {}=\"{}\", defaulting to \"SEQUENTIAL\"", s_ipsc->cCurrentModuleObject, @@ -9909,14 +9355,14 @@ namespace SurfaceGeometry { s_ipsc->cAlphaArgs(1))); } - windowShadingControl.shadingControlType = - static_cast(getEnumValue(WindowShadingControlTypeNamesUC, Util::makeUPPER(s_ipsc->cAlphaArgs(5)))); + windowShadingControl.shadingControlType = static_cast( + getEnumValue(WindowShadingControlTypeNamesUC, Util::makeUPPER(s_ipsc->cAlphaArgs(5)))); if (windowShadingControl.ShadingDevice > 0) { if (s_mat->materials(windowShadingControl.ShadingDevice)->group == Material::Group::Screen && - !(windowShadingControl.shadingControlType == WindowShadingControlType::AlwaysOn || - windowShadingControl.shadingControlType == WindowShadingControlType::AlwaysOff || - windowShadingControl.shadingControlType == WindowShadingControlType::OnIfScheduled)) { + !(windowShadingControl.shadingControlType == DataSurfaces::WindowShadingControlType::AlwaysOn || + windowShadingControl.shadingControlType == DataSurfaces::WindowShadingControlType::AlwaysOff || + windowShadingControl.shadingControlType == DataSurfaces::WindowShadingControlType::OnIfScheduled)) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\" for exterior screens.", @@ -9932,9 +9378,9 @@ namespace SurfaceGeometry { state.dataConstruction->Construct(windowShadingControl.getInputShadedConstruction).IsUsed = true; if (s_mat->materials(state.dataConstruction->Construct(windowShadingControl.getInputShadedConstruction).LayerPoint(1))->group == Material::Group::Screen && - !(windowShadingControl.shadingControlType == WindowShadingControlType::AlwaysOn || - windowShadingControl.shadingControlType == WindowShadingControlType::AlwaysOff || - windowShadingControl.shadingControlType == WindowShadingControlType::OnIfScheduled)) { + !(windowShadingControl.shadingControlType == DataSurfaces::WindowShadingControlType::AlwaysOn || + windowShadingControl.shadingControlType == DataSurfaces::WindowShadingControlType::AlwaysOff || + windowShadingControl.shadingControlType == DataSurfaces::WindowShadingControlType::OnIfScheduled)) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\" for exterior screens.", @@ -9961,35 +9407,26 @@ namespace SurfaceGeometry { } // Warning if setpoint is unintentionally zero - if (windowShadingControl.SetPoint == 0 && windowShadingControl.shadingControlType != WindowShadingControlType::AlwaysOn && - windowShadingControl.shadingControlType != WindowShadingControlType::AlwaysOff && - windowShadingControl.shadingControlType != WindowShadingControlType::OnIfScheduled && - windowShadingControl.shadingControlType != WindowShadingControlType::HiGlare) { + if (windowShadingControl.SetPoint == 0 && windowShadingControl.shadingControlType != DataSurfaces::WindowShadingControlType::AlwaysOn && + windowShadingControl.shadingControlType != DataSurfaces::WindowShadingControlType::AlwaysOff && + windowShadingControl.shadingControlType != DataSurfaces::WindowShadingControlType::OnIfScheduled && + windowShadingControl.shadingControlType != DataSurfaces::WindowShadingControlType::HiGlare) { ShowWarningError(state, format("{}=\"{}\", The first SetPoint is zero.", s_ipsc->cCurrentModuleObject, windowShadingControl.Name)); ShowContinueError(state, "..You may have forgotten to specify that setpoint."); } // Error checks - if (s_ipsc->cAlphaArgs(7) != "YES" && s_ipsc->cAlphaArgs(7) != "NO") { // Shading Control is Schedule field + if (BooleanSwitch bs = getYesNoValue(s_ipsc->cAlphaArgs(7)); bs == BooleanSwitch::Invalid) { // Shading Control is Schedule field + ShowSevereInvalidBool(state, eoh, s_ipsc->cAlphaFieldNames(7), s_ipsc->cAlphaArgs(7)); ErrorsFound = true; - ShowSevereError(state, - format("{}=\"{}\" invalid {}=\"{}\".", - s_ipsc->cCurrentModuleObject, - windowShadingControl.Name, - s_ipsc->cAlphaFieldNames(7), - s_ipsc->cAlphaArgs(7))); } - if (s_ipsc->cAlphaArgs(8) != "YES" && s_ipsc->cAlphaArgs(8) != "NO") { // Glare Control is Active field + + if (BooleanSwitch bs = getYesNoValue(s_ipsc->cAlphaArgs(8)); bs == BooleanSwitch::Invalid) { // Shading Control is Schedule field + ShowSevereInvalidBool(state, eoh, s_ipsc->cAlphaFieldNames(8), s_ipsc->cAlphaArgs(8)); ErrorsFound = true; - ShowSevereError(state, - format("{}=\"{}\" invalid {}=\"{}\".", - s_ipsc->cCurrentModuleObject, - windowShadingControl.Name, - s_ipsc->cAlphaFieldNames(8), - s_ipsc->cAlphaArgs(8))); } - if ((windowShadingControl.shadingControlType == WindowShadingControlType::OnIfScheduled) && + if ((windowShadingControl.shadingControlType == DataSurfaces::WindowShadingControlType::OnIfScheduled) && (!windowShadingControl.ShadingControlIsScheduled)) { // CR 7709 BG ErrorsFound = true; ShowSevereError(state, @@ -9999,50 +9436,9 @@ namespace SurfaceGeometry { s_ipsc->cAlphaFieldNames(7), s_ipsc->cAlphaFieldNames(5))); } - windowShadingControl.slatAngleControl = - static_cast(getEnumValue(SlatAngleNamesUC, Util::makeUPPER(s_ipsc->cAlphaArgs(10)))); - - // For upward compatibility change old "noninsulating" and "insulating" shade types to - // INTERIORSHADE or EXTERIORSHADE - if (s_ipsc->cAlphaArgs(3) == "INTERIORNONINSULATINGSHADE" || s_ipsc->cAlphaArgs(3) == "INTERIORINSULATINGSHADE") { - ShowWarningError(state, - format("{}=\"{}\" is using obsolete {}=\"{}\", changing to \"InteriorShade\"", - s_ipsc->cCurrentModuleObject, - windowShadingControl.Name, - s_ipsc->cAlphaFieldNames(3), - s_ipsc->cAlphaArgs(3))); - windowShadingControl.ShadingType = WinShadingType::IntShade; - s_ipsc->cAlphaArgs(3) = "INTERIORSHADE"; - } - if (s_ipsc->cAlphaArgs(3) == "EXTERIORNONINSULATINGSHADE" || s_ipsc->cAlphaArgs(3) == "EXTERIORINSULATINGSHADE") { - ShowWarningError(state, - format("{}=\"{}\" is using obsolete {}=\"{}\", changing to \"ExteriorShade\"", - s_ipsc->cCurrentModuleObject, - windowShadingControl.Name, - s_ipsc->cAlphaFieldNames(3), - s_ipsc->cAlphaArgs(3))); - windowShadingControl.ShadingType = WinShadingType::ExtShade; - s_ipsc->cAlphaArgs(3) = "EXTERIORSHADE"; - } - - if (windowShadingControl.shadingControlType == WindowShadingControlType::MeetDaylIlumSetp && - s_ipsc->cAlphaArgs(3) != "SWITCHABLEGLAZING") { - ErrorsFound = true; - ShowSevereError(state, - format("{}=\"{}\" invalid {}=\"{}\".", - s_ipsc->cCurrentModuleObject, - windowShadingControl.Name, - s_ipsc->cAlphaFieldNames(3), - s_ipsc->cAlphaArgs(3))); - ShowContinueError(state, - format("...{} must be SwitchableGlazing for this control, but entered type=\"{}\".", - s_ipsc->cAlphaFieldNames(3), - s_ipsc->cAlphaArgs(3))); - } - // Check for illegal shading type name - Found = Util::FindItemInList(s_ipsc->cAlphaArgs(3), cValidShadingTypes, NumValidShadingTypes); - if (Found <= 1) { + if (windowShadingControl.shadingControlType == DataSurfaces::WindowShadingControlType::MeetDaylIlumSetp && + windowShadingControl.ShadingType != DataSurfaces::WinShadingType::SwitchableGlazing) { ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\".", @@ -10050,11 +9446,13 @@ namespace SurfaceGeometry { windowShadingControl.Name, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3))); - } else { - windowShadingControl.ShadingType = WinShadingType(Found); + ShowContinueError(state, + format("...{} must be SwitchableGlazing for this control, but entered type=\"{}\".", + s_ipsc->cAlphaFieldNames(3), + s_ipsc->cAlphaArgs(3))); } - WinShadingType ShTyp = windowShadingControl.ShadingType; + DataSurfaces::WinShadingType ShTyp = windowShadingControl.ShadingType; IShadedConst = windowShadingControl.getInputShadedConstruction; IShadingDevice = windowShadingControl.ShadingDevice; @@ -10065,7 +9463,7 @@ namespace SurfaceGeometry { windowShadingControl.Name)); ErrorsFound = true; } else if (IShadedConst == 0 && IShadingDevice > 0) { - if (ShTyp == WinShadingType::SwitchableGlazing) { + if (ShTyp == DataSurfaces::WinShadingType::SwitchableGlazing) { ShowSevereError(state, format("{}=\"{}\" has {}= SwitchableGlazing but no matching shaded construction", s_ipsc->cCurrentModuleObject, @@ -10073,7 +9471,7 @@ namespace SurfaceGeometry { s_ipsc->cAlphaArgs(3))); ErrorsFound = true; } - if ((ShTyp == WinShadingType::IntShade || ShTyp == WinShadingType::ExtShade) && + if ((ShTyp == DataSurfaces::WinShadingType::IntShade || ShTyp == DataSurfaces::WinShadingType::ExtShade) && s_mat->materials(IShadingDevice)->group != Material::Group::Shade) { ShowSevereError(state, format("{}=\"{}\" has {}= InteriorShade or ExteriorShade but matching shading device is not a window shade", @@ -10083,7 +9481,7 @@ namespace SurfaceGeometry { ShowContinueError(state, format("{} in error=\"{}\".", s_ipsc->cAlphaFieldNames(8), s_mat->materials(IShadingDevice)->Name)); ErrorsFound = true; } - if ((ShTyp == WinShadingType::ExtScreen) && s_mat->materials(IShadingDevice)->group != Material::Group::Screen) { + if ((ShTyp == DataSurfaces::WinShadingType::ExtScreen) && s_mat->materials(IShadingDevice)->group != Material::Group::Screen) { ShowSevereError(state, format("{}=\"{}\" has {}= ExteriorScreen but matching shading device is not a window screen", s_ipsc->cCurrentModuleObject, @@ -10092,7 +9490,7 @@ namespace SurfaceGeometry { ShowContinueError(state, format("{} in error=\"{}\".", s_ipsc->cAlphaFieldNames(8), s_mat->materials(IShadingDevice)->Name)); ErrorsFound = true; } - if ((ShTyp == WinShadingType::IntBlind || ShTyp == WinShadingType::ExtBlind) && + if ((ShTyp == DataSurfaces::WinShadingType::IntBlind || ShTyp == DataSurfaces::WinShadingType::ExtBlind) && s_mat->materials(IShadingDevice)->group != Material::Group::Blind) { ShowSevereError(state, format("{}=\"{}\" has {}= InteriorBlind or ExteriorBlind but matching shading device is not a window blind", @@ -10102,7 +9500,7 @@ namespace SurfaceGeometry { ShowContinueError(state, format("{} in error=\"{}\".", s_ipsc->cAlphaFieldNames(8), s_mat->materials(IShadingDevice)->Name)); ErrorsFound = true; } - if (ShTyp == WinShadingType::BGShade || ShTyp == WinShadingType::BGBlind) { + if (ShTyp == DataSurfaces::WinShadingType::BGShade || ShTyp == DataSurfaces::WinShadingType::BGBlind) { ShowSevereError(state, format("{}=\"{}\" has {}= BetweenGlassShade or BetweenGlassBlind and", s_ipsc->cCurrentModuleObject, @@ -10132,7 +9530,7 @@ namespace SurfaceGeometry { BGShadeBlindError = false; IShadingDevice = 0; if (state.dataConstruction->Construct(IShadedConst).LayerPoint(NLayers) != 0) { - if (windowShadingControl.ShadingType == WinShadingType::IntShade) { + if (windowShadingControl.ShadingType == DataSurfaces::WinShadingType::IntShade) { IShadingDevice = state.dataConstruction->Construct(IShadedConst).LayerPoint(NLayers); if (s_mat->materials(state.dataConstruction->Construct(IShadedConst).LayerPoint(NLayers))->group != Material::Group::Shade) { ErrorsFound = true; @@ -10147,7 +9545,7 @@ namespace SurfaceGeometry { s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3))); } - } else if (windowShadingControl.ShadingType == WinShadingType::ExtShade) { + } else if (windowShadingControl.ShadingType == DataSurfaces::WinShadingType::ExtShade) { IShadingDevice = state.dataConstruction->Construct(IShadedConst).LayerPoint(1); if (s_mat->materials(state.dataConstruction->Construct(IShadedConst).LayerPoint(1))->group != Material::Group::Shade) { ErrorsFound = true; @@ -10162,7 +9560,7 @@ namespace SurfaceGeometry { s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3))); } - } else if (windowShadingControl.ShadingType == WinShadingType::ExtScreen) { + } else if (windowShadingControl.ShadingType == DataSurfaces::WinShadingType::ExtScreen) { IShadingDevice = state.dataConstruction->Construct(IShadedConst).LayerPoint(1); if (s_mat->materials(state.dataConstruction->Construct(IShadedConst).LayerPoint(1))->group != Material::Group::Screen) { ErrorsFound = true; @@ -10177,7 +9575,7 @@ namespace SurfaceGeometry { s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3))); } - } else if (windowShadingControl.ShadingType == WinShadingType::IntBlind) { + } else if (windowShadingControl.ShadingType == DataSurfaces::WinShadingType::IntBlind) { IShadingDevice = state.dataConstruction->Construct(IShadedConst).LayerPoint(NLayers); if (s_mat->materials(state.dataConstruction->Construct(IShadedConst).LayerPoint(NLayers))->group != Material::Group::Blind) { ErrorsFound = true; @@ -10192,7 +9590,7 @@ namespace SurfaceGeometry { s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3))); } - } else if (windowShadingControl.ShadingType == WinShadingType::ExtBlind) { + } else if (windowShadingControl.ShadingType == DataSurfaces::WinShadingType::ExtBlind) { IShadingDevice = state.dataConstruction->Construct(IShadedConst).LayerPoint(1); if (s_mat->materials(state.dataConstruction->Construct(IShadedConst).LayerPoint(1))->group != Material::Group::Blind) { ErrorsFound = true; @@ -10207,7 +9605,7 @@ namespace SurfaceGeometry { s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3))); } - } else if (windowShadingControl.ShadingType == WinShadingType::BGShade) { + } else if (windowShadingControl.ShadingType == DataSurfaces::WinShadingType::BGShade) { if (NLayers != 5 && NLayers != 7) BGShadeBlindError = true; if (NLayers == 5) { if (s_mat->materials(state.dataConstruction->Construct(IShadedConst).LayerPoint(3))->group != Material::Group::Shade) @@ -10228,10 +9626,10 @@ namespace SurfaceGeometry { ShowContinueError(state, format("of {}=\"{}\" should have two or three glass layers and a", s_ipsc->cAlphaFieldNames(3), - s_ipsc->cAlphaArgs(32))); + s_ipsc->cAlphaArgs(3))); ShowContinueError(state, "between-glass shade layer with a gas layer on each side."); } - } else if (windowShadingControl.ShadingType == WinShadingType::BGBlind) { + } else if (windowShadingControl.ShadingType == DataSurfaces::WinShadingType::BGBlind) { if (NLayers != 5 && NLayers != 7) BGShadeBlindError = true; if (NLayers == 5) { if (s_mat->materials(state.dataConstruction->Construct(IShadedConst).LayerPoint(3))->group != Material::Group::Blind) @@ -10258,7 +9656,7 @@ namespace SurfaceGeometry { } } if (IShadingDevice > 0) { - if ((ShTyp == WinShadingType::IntShade || ShTyp == WinShadingType::ExtShade) && + if ((ShTyp == DataSurfaces::WinShadingType::IntShade || ShTyp == DataSurfaces::WinShadingType::ExtShade) && s_mat->materials(IShadingDevice)->group != Material::Group::Shade) { ShowSevereError(state, format("{}=\"{}\" has {}= InteriorShade or ExteriorShade but matching shading device is not a window shade", @@ -10268,7 +9666,7 @@ namespace SurfaceGeometry { ShowContinueError(state, format("Shading Device in error=\"{}\".", s_mat->materials(IShadingDevice)->Name)); ErrorsFound = true; } - if ((ShTyp == WinShadingType::ExtScreen) && s_mat->materials(IShadingDevice)->group != Material::Group::Screen) { + if ((ShTyp == DataSurfaces::WinShadingType::ExtScreen) && s_mat->materials(IShadingDevice)->group != Material::Group::Screen) { ShowSevereError(state, format("{}=\"{}\" has {}= ExteriorScreen but matching shading device is not an exterior window screen.", s_ipsc->cCurrentModuleObject, @@ -10277,7 +9675,7 @@ namespace SurfaceGeometry { ShowContinueError(state, format("Shading Device in error=\"{}\".", s_mat->materials(IShadingDevice)->Name)); ErrorsFound = true; } - if ((ShTyp == WinShadingType::IntBlind || ShTyp == WinShadingType::ExtBlind) && + if ((ShTyp == DataSurfaces::WinShadingType::IntBlind || ShTyp == DataSurfaces::WinShadingType::ExtBlind) && s_mat->materials(IShadingDevice)->group != Material::Group::Blind) { ShowSevereError(state, format("{}=\"{}\" has {}= InteriorBlind or ExteriorBlind but matching shading device is not a window blind.", @@ -10292,44 +9690,42 @@ namespace SurfaceGeometry { } // End of loop over window shading controls } - void InitialAssociateWindowShadingControlFenestration(EnergyPlusData &state, bool &ErrorsFound, int &SurfNum) + void InitialAssociateWindowShadingControlFenestration(EnergyPlusData &state, bool &ErrorsFound, int SurfNum) { + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); // J.Glazer 2018 - operates on SurfaceTmp array before final indices are known for windows and sets the activeWindowShadingControl for (int iShadeCtrl = 1; iShadeCtrl <= state.dataSurface->TotWinShadingControl; ++iShadeCtrl) { int curShadedConstruction = state.dataSurface->WindowShadingControl(iShadeCtrl).getInputShadedConstruction; for (int jFeneRef = 1; jFeneRef <= state.dataSurface->WindowShadingControl(iShadeCtrl).FenestrationCount; ++jFeneRef) { - if (Util::SameString(state.dataSurface->WindowShadingControl(iShadeCtrl).FenestrationName(jFeneRef), - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)) { + if (Util::SameString(state.dataSurface->WindowShadingControl(iShadeCtrl).FenestrationName(jFeneRef), surfTemp.Name)) { state.dataGlobal->AndShadingControlInModel = true; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).HasShadeControl = true; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).windowShadingControlList.push_back(iShadeCtrl); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).activeWindowShadingControl = iShadeCtrl; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).shadedConstructionList.push_back(curShadedConstruction); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).activeShadedConstruction = curShadedConstruction; + surfTemp.HasShadeControl = true; + surfTemp.windowShadingControlList.push_back(iShadeCtrl); + surfTemp.activeWindowShadingControl = iShadeCtrl; + surfTemp.shadedConstructionList.push_back(curShadedConstruction); + surfTemp.activeShadedConstruction = curShadedConstruction; // check to make the window refenced is an exterior window - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond != ExternalEnvironment) { + if (surfTemp.ExtBoundCond != DataSurfaces::ExternalEnvironment) { ErrorsFound = true; ShowSevereError( state, format("InitialAssociateWindowShadingControlFenestration: \"{}\", invalid because it is not an exterior window.", - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); + surfTemp.Name)); ShowContinueError( state, format(".. It appears on WindowShadingControl object: \"{}", state.dataSurface->WindowShadingControl(iShadeCtrl).Name)); } // check to make sure the window is not using equivalent layer window construction - if (state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).WindowTypeEQL) { + if (state.dataConstruction->Construct(surfTemp.Construction).WindowTypeEQL) { ErrorsFound = true; - ShowSevereError(state, - format("InitialAssociateWindowShadingControlFenestration: =\"{}\", invalid \".", - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); + ShowSevereError(state, format("InitialAssociateWindowShadingControlFenestration: =\"{}\", invalid \".", surfTemp.Name)); ShowContinueError(state, ".. equivalent layer window model does not use shading control object."); ShowContinueError(state, ".. Shading control is set to none or zero, and simulation continues."); ShowContinueError( state, format(".. It appears on WindowShadingControl object: \"{}", state.dataSurface->WindowShadingControl(iShadeCtrl).Name)); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).activeWindowShadingControl = 0; + surfTemp.activeWindowShadingControl = 0; } } } @@ -10392,8 +9788,8 @@ namespace SurfaceGeometry { bool isWindowShadingControlSimilar(EnergyPlusData &state, int a, int b) { // Compares two window shading controls are the same except for the name, schedule name, construction, and material - auto &WindowShadingControlA = state.dataSurface->WindowShadingControl(a); - auto &WindowShadingControlB = state.dataSurface->WindowShadingControl(b); + auto const &WindowShadingControlA = state.dataSurface->WindowShadingControl(a); + auto const &WindowShadingControlB = state.dataSurface->WindowShadingControl(b); return (WindowShadingControlA.ZoneIndex == WindowShadingControlB.ZoneIndex && WindowShadingControlA.ShadingType == WindowShadingControlB.ShadingType && WindowShadingControlA.shadingControlType == WindowShadingControlB.shadingControlType && @@ -10413,25 +9809,15 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR Fred Winkelmann // DATE WRITTEN December 2003 - // MODIFIED na - - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // Reads in the storm window data from the input file, - // interprets it and puts it in the derived type - - // Using/Aliasing + // Reads in the storm window data from the input file, interprets it and puts it in the derived type // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int IOStat; // IO Status when calling get input subroutine int StormWinNumAlpha; // Number of alpha names being passed int StormWinNumProp; // Number of properties being passed - int StormWinNum; // Index for storm window number int loop; // Do loop counter - int SurfNum; // Surface number - int MatNum; // Material number auto &s_ipsc = state.dataIPShortCut; auto &s_mat = state.dataMaterial; @@ -10443,7 +9829,7 @@ namespace SurfaceGeometry { state.dataSurface->StormWindow.allocate(state.dataSurface->TotStormWin); - StormWinNum = 0; + int StormWinNum = 0; for (loop = 1; loop <= state.dataSurface->TotStormWin; ++loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -10544,7 +9930,7 @@ namespace SurfaceGeometry { for (StormWinNum = 1; StormWinNum <= state.dataSurface->TotStormWin; ++StormWinNum) { // Require BaseWindowNum be that of an exterior window - SurfNum = state.dataSurface->StormWindow(StormWinNum).BaseWindowNum; + int SurfNum = state.dataSurface->StormWindow(StormWinNum).BaseWindowNum; if (SurfNum == 0) { ShowSevereError(state, format("{}=\"{}\" invalid.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; @@ -10559,7 +9945,7 @@ namespace SurfaceGeometry { } // Require that storm window material be glass - MatNum = state.dataSurface->StormWindow(StormWinNum).StormWinMaterialNum; + int MatNum = state.dataSurface->StormWindow(StormWinNum).StormWinMaterialNum; if (SurfNum > 0) { if (MatNum == 0) { ShowSevereError(state, format("{}=\"{}\"", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); @@ -10576,10 +9962,7 @@ namespace SurfaceGeometry { ErrorsFound = true; } } - } - - // Error if base window has airflow control - if (SurfNum > 0) { + // Error if base window has airflow control if (state.dataSurface->SurfWinAirflowControlType(SurfNum) != DataSurfaces::WindowAirFlowControlType::Invalid) { ShowSevereError( state, @@ -10617,32 +10000,27 @@ namespace SurfaceGeometry { // DATE WRITTEN Feb 2003 // MODIFIED June 2003, FCW: add destination = return air; // more error messages - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Reads in the window airflow control information from the input data file, // interprets it and puts it in the SurfaceWindow derived type - // Using/Aliasing - using ScheduleManager::GetScheduleIndex; - static constexpr std::string_view routineName = "GetWindowGapAirflowControlData"; int IOStat; // IO Status when calling get input subroutine int ControlNumAlpha; // Number of control alpha names being passed int ControlNumProp; // Number of control properties being passed int TotWinAirflowControl; // Total window airflow control statements - bool WrongSurfaceType; // True if associated surface is not 2- or 3-pane exterior window int Loop; - int SurfNum; // Surface number int ConstrNum(0); // Construction number int ConstrNumSh; // Shaded Construction number int MatGapFlow; // Material number of gas in airflow gap of window's construction int MatGapFlow1; // Material number of gas on either side of a between-glass shade/blind int MatGapFlow2; - constexpr std::array(WindowAirFlowSource::Num)> WindowAirFlowSourceNamesUC{"INDOORAIR", "OUTDOORAIR"}; - constexpr std::array(WindowAirFlowDestination::Num)> WindowAirFlowDestinationNamesUC{ + constexpr std::array(DataSurfaces::WindowAirFlowSource::Num)> WindowAirFlowSourceNamesUC{"INDOORAIR", + "OUTDOORAIR"}; + constexpr std::array(DataSurfaces::WindowAirFlowDestination::Num)> WindowAirFlowDestinationNamesUC{ "INDOORAIR", "OUTDOORAIR", "RETURNAIR"}; // of the shaded construction of airflow window @@ -10669,14 +10047,16 @@ namespace SurfaceGeometry { s_ipsc->cAlphaFieldNames, s_ipsc->cNumericFieldNames); - SurfNum = Util::FindItemInList(s_ipsc->cAlphaArgs(1), state.dataSurface->Surface, state.dataSurface->TotSurfaces); + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + int SurfNum = Util::FindItemInList(s_ipsc->cAlphaArgs(1), state.dataSurface->Surface, state.dataSurface->TotSurfaces); if (SurfNum == 0) { ShowSevereError(state, format("{}=\"{}\" not found.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); ErrorsFound = true; } // Check that associated surface is a 2- or 3-pane exterior window - WrongSurfaceType = false; if (SurfNum != 0) { + bool WrongSurfaceType = false; auto const &surf = state.dataSurface->Surface(SurfNum); if (surf.Class != SurfaceClass::Window) WrongSurfaceType = true; if (surf.Class == SurfaceClass::Window) { @@ -10684,7 +10064,7 @@ namespace SurfaceGeometry { if (state.dataConstruction->Construct(ConstrNum).TotGlassLayers != 2 && state.dataConstruction->Construct(ConstrNum).TotGlassLayers != 3) WrongSurfaceType = true; - if (surf.ExtBoundCond != ExternalEnvironment) WrongSurfaceType = true; + if (surf.ExtBoundCond != DataSurfaces::ExternalEnvironment) WrongSurfaceType = true; } if (WrongSurfaceType) { ShowSevereError( @@ -10797,12 +10177,12 @@ namespace SurfaceGeometry { auto const &surf = state.dataSurface->Surface(SurfNum); state.dataSurface->AirflowWindows = true; state.dataSurface->SurfWinAirflowSource(SurfNum) = - static_cast(getEnumValue(WindowAirFlowSourceNamesUC, s_ipsc->cAlphaArgs(2))); + static_cast(getEnumValue(WindowAirFlowSourceNamesUC, s_ipsc->cAlphaArgs(2))); state.dataSurface->SurfWinAirflowDestination(SurfNum) = - static_cast(getEnumValue(WindowAirFlowDestinationNamesUC, s_ipsc->cAlphaArgs(3))); + static_cast(getEnumValue(WindowAirFlowDestinationNamesUC, s_ipsc->cAlphaArgs(3))); - if (state.dataSurface->SurfWinAirflowDestination(SurfNum) == WindowAirFlowDestination::Return) { + if (state.dataSurface->SurfWinAirflowDestination(SurfNum) == DataSurfaces::WindowAirFlowDestination::Return) { int controlledZoneNum = DataZoneEquipment::GetControlledZoneIndex(state, surf.ZoneName); if (controlledZoneNum > 0) { state.dataHeatBal->Zone(surf.Zone).HasAirFlowWindowReturn = true; @@ -10836,15 +10216,19 @@ namespace SurfaceGeometry { } } if (Util::SameString(s_ipsc->cAlphaArgs(4), "AlwaysOnAtMaximumFlow")) { - state.dataSurface->SurfWinAirflowControlType(SurfNum) = WindowAirFlowControlType::MaxFlow; + state.dataSurface->SurfWinAirflowControlType(SurfNum) = DataSurfaces::WindowAirFlowControlType::MaxFlow; } else if (Util::SameString(s_ipsc->cAlphaArgs(4), "AlwaysOff")) { - state.dataSurface->SurfWinAirflowControlType(SurfNum) = WindowAirFlowControlType::AlwaysOff; + state.dataSurface->SurfWinAirflowControlType(SurfNum) = DataSurfaces::WindowAirFlowControlType::AlwaysOff; } else if (Util::SameString(s_ipsc->cAlphaArgs(4), "ScheduledOnly")) { - state.dataSurface->SurfWinAirflowControlType(SurfNum) = WindowAirFlowControlType::Schedule; + state.dataSurface->SurfWinAirflowControlType(SurfNum) = DataSurfaces::WindowAirFlowControlType::Schedule; } state.dataSurface->SurfWinMaxAirflow(SurfNum) = s_ipsc->rNumericArgs(1); if (s_ipsc->cAlphaArgs(4) == "SCHEDULEDONLY" && s_ipsc->cAlphaArgs(5) == "YES") { if (s_ipsc->lAlphaFieldBlanks(6)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(6), s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4)); + ErrorsFound = true; + } else if ((state.dataSurface->SurfWinAirflowScheds(SurfNum) = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(6))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(6), s_ipsc->cAlphaArgs(6)); ErrorsFound = true; ShowSevereError(state, format("{}=\"{}\", has {}=\"{}\"", @@ -10859,20 +10243,14 @@ namespace SurfaceGeometry { s_ipsc->cAlphaFieldNames(6))); } else { state.dataSurface->SurfWinAirflowHasSchedule(SurfNum) = true; - state.dataSurface->SurfWinAirflowSchedulePtr(SurfNum) = GetScheduleIndex(state, s_ipsc->cAlphaArgs(6)); - if (state.dataSurface->SurfWinAirflowSchedulePtr(SurfNum) == 0) { + if ((state.dataSurface->SurfWinAirflowScheds(SurfNum) = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(6))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(6), s_ipsc->cAlphaArgs(6)); ErrorsFound = true; - ShowSevereError(state, - format("{}=\"{}\", invalid {}=\"{}\"", - s_ipsc->cCurrentModuleObject, - s_ipsc->cAlphaArgs(1), - s_ipsc->cAlphaFieldNames(6), - s_ipsc->cAlphaArgs(6))); } } } // Warning if associated window is an interior window - if (surf.ExtBoundCond != ExternalEnvironment && !ErrorsFound) + if (surf.ExtBoundCond != DataSurfaces::ExternalEnvironment && !ErrorsFound) ShowWarningError(state, format("{}=\"{}\", is an Interior window; cannot be an airflow window.", s_ipsc->cCurrentModuleObject, @@ -10933,7 +10311,6 @@ namespace SurfaceGeometry { static constexpr std::string_view routineName = "GetFoundationData"; auto &s_ipsc = state.dataIPShortCut; - auto &s_mat = state.dataMaterial; // Read Kiva Settings s_ipsc->cCurrentModuleObject = "Foundation:Kiva:Settings"; @@ -11040,7 +10417,7 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->kivaManager.timestep = 3600.; // seconds } else { // if (Util::SameString(s_ipsc->cAlphaArgs( alpF ), "Timestep")) state.dataSurfaceGeometry->kivaManager.settings.timestepType = HeatBalanceKivaManager::KivaManager::Settings::TIMESTEP; - state.dataSurfaceGeometry->kivaManager.timestep = state.dataGlobal->MinutesPerTimeStep * 60.; + state.dataSurfaceGeometry->kivaManager.timestep = state.dataGlobal->MinutesInTimeStep * 60.; } } alpF++; @@ -11058,6 +10435,7 @@ namespace SurfaceGeometry { int TotKivaFnds = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); if (TotKivaFnds > 0) { + auto &s_mat = state.dataMaterial; for (int Loop = 1; Loop <= TotKivaFnds; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, s_ipsc->cCurrentModuleObject, @@ -11535,14 +10913,10 @@ namespace SurfaceGeometry { // AUTHOR Linda Lawrie // DATE WRITTEN May 2000 // MODIFIED Jul 2011, M.J. Witte and C.O. Pedersen, add new fields to OSC for last T, max and min - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine gets the OtherSideCoefficient data. - // METHODOLOGY EMPLOYED: - // na - // REFERENCES: // Other Side Coefficient Definition // OtherSideCoefficients, @@ -11591,7 +10965,7 @@ namespace SurfaceGeometry { // \units hr // \default 24 // N9, \field Previous Other Side Temperature Coefficient - // \note This coeffient multiplies the other side temperature result from the + // \note This coefficient multiplies the other side temperature result from the // \note previous zone timestep // \type real // \default 0 @@ -11604,10 +10978,7 @@ namespace SurfaceGeometry { // \units C // \default 200 - // Using/Aliasing - - using ScheduleManager::GetScheduleIndex; - + static constexpr std::string_view routineName = "GetOSCData"; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: @@ -11616,9 +10987,6 @@ namespace SurfaceGeometry { int NumProps; int Loop; int IOStat; - int OSCNum; - bool ErrorInName; - bool IsBlank; std::string cOSCLimitsString; auto &s_ipsc = state.dataIPShortCut; @@ -11627,7 +10995,7 @@ namespace SurfaceGeometry { state.dataSurface->TotOSC = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); state.dataSurface->OSC.allocate(state.dataSurface->TotOSC); - OSCNum = 0; + int OSCNum = 0; for (Loop = 1; Loop <= state.dataSurface->TotOSC; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, s_ipsc->cCurrentModuleObject, @@ -11641,8 +11009,10 @@ namespace SurfaceGeometry { s_ipsc->lAlphaFieldBlanks, s_ipsc->cAlphaFieldNames, s_ipsc->cNumericFieldNames); - ErrorInName = false; - IsBlank = false; + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + bool ErrorInName = false; + bool IsBlank = false; Util::VerifyName( state, s_ipsc->cAlphaArgs(1), state.dataSurface->OSC, OSCNum, ErrorInName, IsBlank, s_ipsc->cCurrentModuleObject + " Name"); if (ErrorInName) { @@ -11662,36 +11032,17 @@ namespace SurfaceGeometry { state.dataSurface->OSC(OSCNum).ZoneAirTempCoef = s_ipsc->rNumericArgs(7); state.dataSurface->OSC(OSCNum).SinusoidPeriod = s_ipsc->rNumericArgs(8); - if ((!s_ipsc->lAlphaFieldBlanks(2)) && (NumAlphas != 1)) { // Const temp will come from schedule specified below. - state.dataSurface->OSC(OSCNum).ConstTempScheduleName = s_ipsc->cAlphaArgs(2); - if (!state.dataSurface->OSC(OSCNum).ConstTempScheduleName.empty()) { - state.dataSurface->OSC(OSCNum).ConstTempScheduleIndex = - GetScheduleIndex(state, state.dataSurface->OSC(OSCNum).ConstTempScheduleName); - if (state.dataSurface->OSC(OSCNum).ConstTempScheduleIndex == 0) { - ShowSevereError(state, - format("{}=\"{}\", invalid {}=\"{}", - s_ipsc->cCurrentModuleObject, - s_ipsc->cAlphaArgs(1), - s_ipsc->cAlphaFieldNames(2), - s_ipsc->cAlphaArgs(2))); - ErrorsFound = true; - } - } + if ((NumAlphas == 1) || s_ipsc->lAlphaFieldBlanks(2)) { // Const temp will come from schedule specified below. + } else if ((state.dataSurface->OSC(OSCNum).constTempSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); + ErrorsFound = true; } if (!s_ipsc->lAlphaFieldBlanks(3)) { - - if (Util::SameString(s_ipsc->cAlphaArgs(3), "No")) { - state.dataSurface->OSC(OSCNum).SinusoidalConstTempCoef = false; - } else if (Util::SameString(s_ipsc->cAlphaArgs(3), "Yes")) { - state.dataSurface->OSC(OSCNum).SinusoidalConstTempCoef = true; + if (BooleanSwitch bs = getYesNoValue(s_ipsc->cAlphaArgs(3)); bs != BooleanSwitch::Invalid) { + state.dataSurface->OSC(OSCNum).SinusoidalConstTempCoef = static_cast(bs); } else { - ShowSevereError(state, - format("{}=\"{}\", invalid {}=\"{}", - s_ipsc->cCurrentModuleObject, - s_ipsc->cAlphaArgs(1), - s_ipsc->cAlphaFieldNames(3), - s_ipsc->cAlphaArgs(3))); + ShowSevereInvalidBool(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3)); ErrorsFound = true; } } @@ -11750,44 +11101,22 @@ namespace SurfaceGeometry { } else { s_ipsc->cAlphaArgs(1) = "N/A"; } - if (state.dataSurface->OSC(Loop).ConstTempScheduleIndex != 0) { - s_ipsc->cAlphaArgs(2) = state.dataSurface->OSC(Loop).ConstTempScheduleName; - constexpr std::string_view format = "Other Side Coefficients,{},{},{},{:.3R},{:.3R},{:.3R},{:.3R},{:.3R},{},{},{:.3R},{:.3R},{}\n"; - print(state.files.eio, - format, - state.dataSurface->OSC(Loop).Name, - s_ipsc->cAlphaArgs(1), - "N/A", - state.dataSurface->OSC(Loop).ConstTempCoef, - state.dataSurface->OSC(Loop).ExtDryBulbCoef, - state.dataSurface->OSC(Loop).GroundTempCoef, - state.dataSurface->OSC(Loop).WindSpeedCoef, - state.dataSurface->OSC(Loop).ZoneAirTempCoef, - s_ipsc->cAlphaArgs(2), - s_ipsc->cAlphaArgs(3), - state.dataSurface->OSC(Loop).SinusoidPeriod, - state.dataSurface->OSC(Loop).TPreviousCoef, - cOSCLimitsString); - } else { - s_ipsc->cAlphaArgs(2) = "N/A"; - constexpr std::string_view format = - "Other Side Coefficients,{},{},{:.2R},{:.3R},{:.3R},{:.3R},{:.3R},{:.3R},{},{},{:.3R},{:.3R},{}\n"; - print(state.files.eio, - format, - state.dataSurface->OSC(Loop).Name, - s_ipsc->cAlphaArgs(1), - state.dataSurface->OSC(Loop).ConstTemp, - state.dataSurface->OSC(Loop).ConstTempCoef, - state.dataSurface->OSC(Loop).ExtDryBulbCoef, - state.dataSurface->OSC(Loop).GroundTempCoef, - state.dataSurface->OSC(Loop).WindSpeedCoef, - state.dataSurface->OSC(Loop).ZoneAirTempCoef, - s_ipsc->cAlphaArgs(2), - s_ipsc->cAlphaArgs(3), - state.dataSurface->OSC(Loop).SinusoidPeriod, - state.dataSurface->OSC(Loop).TPreviousCoef, - cOSCLimitsString); - } + + print(state.files.eio, + "Other Side Coefficients,{},{},{},{:.3R},{:.3R},{:.3R},{:.3R},{:.3R},{},{},{:.3R},{:.3R},{}\n", + state.dataSurface->OSC(Loop).Name, + s_ipsc->cAlphaArgs(1), + (state.dataSurface->OSC(Loop).constTempSched != nullptr) ? "N/A" : format("{:.2R}", state.dataSurface->OSC(Loop).ConstTemp), + state.dataSurface->OSC(Loop).ConstTempCoef, + state.dataSurface->OSC(Loop).ExtDryBulbCoef, + state.dataSurface->OSC(Loop).GroundTempCoef, + state.dataSurface->OSC(Loop).WindSpeedCoef, + state.dataSurface->OSC(Loop).ZoneAirTempCoef, + (state.dataSurface->OSC(Loop).constTempSched == nullptr) ? "N/A" : state.dataSurface->OSC(Loop).constTempSched->Name, + s_ipsc->cAlphaArgs(3), + state.dataSurface->OSC(Loop).SinusoidPeriod, + state.dataSurface->OSC(Loop).TPreviousCoef, + cOSCLimitsString); } } @@ -11797,15 +11126,10 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR Brent Griffith // DATE WRITTEN November 2004 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine gets the OtherSideConditionsModel data. - // METHODOLOGY EMPLOYED: - // na - // REFERENCES: // derived from GetOSCData subroutine by Linda Lawrie @@ -11821,16 +11145,10 @@ namespace SurfaceGeometry { // \key Vented PV Cavity // \key Hybrid PV Transpired Collector - // Using/Aliasing - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NumAlphas; int NumProps; - int Loop; int IOStat; - int OSCMNum; - bool ErrorInName; - bool IsBlank; auto &s_ipsc = state.dataIPShortCut; s_ipsc->cCurrentModuleObject = "SurfaceProperty:OtherSideConditionsModel"; @@ -11838,12 +11156,12 @@ namespace SurfaceGeometry { state.dataSurface->OSCM.allocate(state.dataSurface->TotOSCM); // OSCM is already initialized in derived type defn. - OSCMNum = 0; - for (Loop = 1; Loop <= state.dataSurface->TotOSCM; ++Loop) { + int OSCMNum = 0; + for (int Loop = 1; Loop <= state.dataSurface->TotOSCM; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem( state, s_ipsc->cCurrentModuleObject, Loop, s_ipsc->cAlphaArgs, NumAlphas, s_ipsc->rNumericArgs, NumProps, IOStat); - ErrorInName = false; - IsBlank = false; + bool ErrorInName = false; + bool IsBlank = false; Util::VerifyName( state, s_ipsc->cAlphaArgs(1), state.dataSurface->OSCM, OSCMNum, ErrorInName, IsBlank, s_ipsc->cCurrentModuleObject + " Name"); if (ErrorInName) { @@ -11917,7 +11235,7 @@ namespace SurfaceGeometry { } } - for (Loop = 1; Loop <= state.dataSurface->TotOSCM; ++Loop) { + for (int Loop = 1; Loop <= state.dataSurface->TotOSCM; ++Loop) { if (Loop == 1) { static constexpr std::string_view OSCMFormat1("! ,Name,Class\n"); print(state.files.eio, OSCMFormat1); @@ -11932,15 +11250,9 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN May 2000 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // This subroutine gets the movable insulation data that can be associated with - // a surface. - - // METHODOLOGY EMPLOYED: - // na + // This subroutine gets the movable insulation data that can be associated with a surface. // REFERENCES: // Movable Insulation Definition @@ -11963,19 +11275,12 @@ namespace SurfaceGeometry { // \type object-list // \object-list ScheduleNames - // Using/Aliasing - - using ScheduleManager::GetScheduleIndex; + static constexpr std::string_view routineName = "GetMovableInsulationInput"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int NAlphas; int NNums; int IOStat; - int Loop; - int NMatInsul; - int SurfNum; - int MaterNum; - int SchNum; enum class InsulationType { @@ -11990,8 +11295,8 @@ namespace SurfaceGeometry { auto &s_mat = state.dataMaterial; s_ipsc->cCurrentModuleObject = "SurfaceControl:MovableInsulation"; - NMatInsul = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); - for (Loop = 1; Loop <= NMatInsul; ++Loop) { + int NMatInsul = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + for (int Loop = 1; Loop <= NMatInsul; ++Loop) { state.dataInputProcessing->inputProcessor->getObjectItem(state, s_ipsc->cCurrentModuleObject, Loop, @@ -12004,170 +11309,166 @@ namespace SurfaceGeometry { s_ipsc->lAlphaFieldBlanks, s_ipsc->cAlphaFieldNames, s_ipsc->cNumericFieldNames); - SurfNum = Util::FindItemInList(s_ipsc->cAlphaArgs(2), state.dataSurface->Surface, state.dataSurface->TotSurfaces); - MaterNum = Material::GetMaterialNum(state, s_ipsc->cAlphaArgs(3)); - auto *thisMaterial = s_mat->materials(MaterNum); - SchNum = GetScheduleIndex(state, s_ipsc->cAlphaArgs(4)); + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + InsulationType insulationType = static_cast(getEnumValue(insulationTypeNamesUC, s_ipsc->cAlphaArgs(1))); if (insulationType == InsulationType::Invalid) { - ShowSevereError( - state, format("{}, {}=\"{}\", invalid data.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); - ShowContinueError(state, - format(" invalid {}=\"{}\", [should be Inside or Outside]", s_ipsc->cAlphaFieldNames(1), s_ipsc->cAlphaArgs(1))); + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(1), s_ipsc->cAlphaArgs(1)); + ErrorsFound = true; + continue; + } + + int SurfNum; + if ((SurfNum = Util::FindItemInList(s_ipsc->cAlphaArgs(2), state.dataSurface->Surface, state.dataSurface->TotSurfaces)) == 0) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); ErrorsFound = true; + continue; } - if (SurfNum == 0) { + + int MaterNum; + if ((MaterNum = Material::GetMaterialNum(state, s_ipsc->cAlphaArgs(3))) == 0) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3)); + ErrorsFound = true; + continue; + } + + Sched::Schedule *sched = nullptr; + if (s_ipsc->lAlphaFieldBlanks(4)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(4)); + ErrorsFound = true; + continue; + } else if ((sched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(4))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4)); + ErrorsFound = true; + continue; + } + + auto *thisMaterial = s_mat->materials(MaterNum); + + Array1D_string const cMaterialGroupType({-1, 18}, + {"invalid", + "Material/Material:NoMass", + "Material:AirGap", + "WindowMaterial:Shade", + "WindowMaterial:Glazing*", + "WindowMaterial:Gas", + "WindowMaterial:Blind", + "WindowMaterial:GasMixture", + "WindowMaterial:Screen", + "Material:RoofVegetation", + "Material:InfraredTransparent", + "WindowMaterial:SimpleGlazingSystem", + "WindowMaterial:ComplexShade", + "WindowMaterial:Gap", + "WindowMaterial:Glazing:EquivalentLayer", + "WindowMaterial:Shade:EquivalentLayer", + "WindowMaterial:Drape:EquivalentLayer", + "WindowMaterial:Blind:EquivalentLayer", + "WindowMaterial:Screen:EquivalentLayer", + "WindowMaterial:Gap:EquivalentLayer"}); + + Material::Group const MaterialLayerGroup = thisMaterial->group; + if ((MaterialLayerGroup == Material::Group::GlassSimple) || (MaterialLayerGroup == Material::Group::ShadeEQL) || + (MaterialLayerGroup == Material::Group::DrapeEQL) || (MaterialLayerGroup == Material::Group::BlindEQL) || + (MaterialLayerGroup == Material::Group::ScreenEQL) || (MaterialLayerGroup == Material::Group::WindowGapEQL)) { + ShowSevereError(state, format("Invalid movable insulation material for {}:", s_ipsc->cCurrentModuleObject)); ShowSevereError( - state, format("{}, {}=\"{}\", invalid data.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); - ShowContinueError(state, format(" invalid (not found) {}", s_ipsc->cAlphaFieldNames(2))); + state, format("...Movable insulation material type specified = {}", cMaterialGroupType(static_cast(MaterialLayerGroup)))); + ShowSevereError(state, format("...Movable insulation material name specified = {}", s_ipsc->cAlphaArgs(3))); ErrorsFound = true; - } else { - if (MaterNum == 0) { - ShowSevereError( - state, - format("{}, {}=\"{}\", invalid data.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); - ShowContinueError(state, format(" invalid (not found) {}=\"{}\"", s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3))); + } + + switch (insulationType) { + case InsulationType::Outside: { + auto &movInsul = state.dataSurface->extMovInsuls(SurfNum); + if (movInsul.matNum > 0) { + ShowSevereDuplicateAssignment( + state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2), s_mat->materials(movInsul.matNum)->Name); ErrorsFound = true; - } else { + } - Array1D_string const cMaterialGroupType({-1, 18}, - {"invalid", - "Material/Material:NoMass", - "Material:AirGap", - "WindowMaterial:Shade", - "WindowMaterial:Glazing*", - "WindowMaterial:Gas", - "WindowMaterial:Blind", - "WindowMaterial:GasMixture", - "WindowMaterial:Screen", - "Material:RoofVegetation", - "Material:InfraredTransparent", - "WindowMaterial:SimpleGlazingSystem", - "WindowMaterial:ComplexShade", - "WindowMaterial:Gap", - "WindowMaterial:Glazing:EquivalentLayer", - "WindowMaterial:Shade:EquivalentLayer", - "WindowMaterial:Drape:EquivalentLayer", - "WindowMaterial:Blind:EquivalentLayer", - "WindowMaterial:Screen:EquivalentLayer", - "WindowMaterial:Gap:EquivalentLayer"}); - - Material::Group const MaterialLayerGroup = thisMaterial->group; - if ((MaterialLayerGroup == Material::Group::GlassSimple) || (MaterialLayerGroup == Material::Group::ShadeEQL) || - (MaterialLayerGroup == Material::Group::DrapeEQL) || (MaterialLayerGroup == Material::Group::BlindEQL) || - (MaterialLayerGroup == Material::Group::ScreenEQL) || (MaterialLayerGroup == Material::Group::WindowGapEQL)) { - ShowSevereError(state, format("Invalid movable insulation material for {}:", s_ipsc->cCurrentModuleObject)); - ShowSevereError( - state, - format("...Movable insulation material type specified = {}", cMaterialGroupType(static_cast(MaterialLayerGroup)))); - ShowSevereError(state, format("...Movable insulation material name specified = {}", s_ipsc->cAlphaArgs(3))); + movInsul.matNum = MaterNum; + movInsul.sched = sched; + state.dataSurface->AnyMovableInsulation = true; + state.dataSurface->extMovInsulSurfNums.push_back(SurfNum); + + if (thisMaterial->Resistance <= 0.0) { + if (thisMaterial->Conductivity <= 0.0 || thisMaterial->Thickness <= 0.0) { + ShowSevereError(state, + format("{}, {}=\"{}\", invalid material.", + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); + ShowContinueError(state, "\"Outside\", invalid material for movable insulation."); + ShowContinueError(state, + format("Material=\"{}\",Resistance=[{:.3R}], must be > 0 for use in Movable Insulation.", + thisMaterial->Name, + thisMaterial->Resistance)); ErrorsFound = true; + } else if (thisMaterial->Conductivity > 0.0) { + thisMaterial->Resistance = thisMaterial->Thickness / thisMaterial->Conductivity; } - if (SchNum == 0) { - ShowSevereError( - state, - format("{}, {}=\"{}\", invalid data.", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); - ShowContinueError(state, format(" invalid (not found) {}=\"{}\"", s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4))); + } + + if (thisMaterial->Conductivity <= 0.0) { + if (thisMaterial->Resistance <= 0.0) { + ShowSevereError(state, + format("{}, {}=\"{}\", invalid material.", + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); + ShowContinueError(state, "\"Outside\", invalid material for movable insulation."); + ShowContinueError(state, + format("Material=\"{}\",Conductivity=[{:.3R}], must be > 0 for use in Movable Insulation.", + thisMaterial->Name, + thisMaterial->Conductivity)); ErrorsFound = true; - } else { - { - switch (insulationType) { - case InsulationType::Outside: - if (state.dataSurface->SurfMaterialMovInsulExt(SurfNum) > 0) { - ShowSevereError(state, - format("{}, {}=\"{}\", already assigned.", - s_ipsc->cCurrentModuleObject, - s_ipsc->cAlphaFieldNames(2), - s_ipsc->cAlphaArgs(2))); - ShowContinueError(state, - format("\"Outside\", was already assigned Material=\"{}\".", - s_mat->materials(state.dataSurface->SurfMaterialMovInsulInt(SurfNum))->Name)); - ShowContinueError(state, format("attempting to assign Material=\"{}\".", thisMaterial->Name)); - ErrorsFound = true; - } - state.dataSurface->SurfMaterialMovInsulExt(SurfNum) = MaterNum; - state.dataSurface->SurfSchedMovInsulExt(SurfNum) = SchNum; - state.dataSurface->AnyMovableInsulation = true; - if (thisMaterial->Resistance <= 0.0) { - if (thisMaterial->Conductivity <= 0.0 || thisMaterial->Thickness <= 0.0) { - ShowSevereError(state, - format("{}, {}=\"{}\", invalid material.", - s_ipsc->cCurrentModuleObject, - s_ipsc->cAlphaFieldNames(2), - s_ipsc->cAlphaArgs(2))); - ShowContinueError(state, "\"Outside\", invalid material for movable insulation."); - ShowContinueError(state, - format("Material=\"{}\",Resistance=[{:.3R}], must be > 0 for use in Movable Insulation.", - thisMaterial->Name, - thisMaterial->Resistance)); - ErrorsFound = true; - } else if (thisMaterial->Conductivity > 0.0) { - thisMaterial->Resistance = thisMaterial->Thickness / thisMaterial->Conductivity; - } - } - if (thisMaterial->Conductivity <= 0.0) { - if (thisMaterial->Resistance <= 0.0) { - ShowSevereError(state, - format("{}, {}=\"{}\", invalid material.", - s_ipsc->cCurrentModuleObject, - s_ipsc->cAlphaFieldNames(2), - s_ipsc->cAlphaArgs(2))); - ShowContinueError(state, "\"Outside\", invalid material for movable insulation."); - ShowContinueError(state, - format("Material=\"{}\",Conductivity=[{:.3R}], must be > 0 for use in Movable Insulation.", - thisMaterial->Name, - thisMaterial->Conductivity)); - ErrorsFound = true; - } - } - break; - case InsulationType::Inside: - if (state.dataSurface->SurfMaterialMovInsulInt(SurfNum) > 0) { - ShowSevereError(state, - s_ipsc->cCurrentModuleObject + ", " + s_ipsc->cAlphaFieldNames(2) + "=\"" + - s_ipsc->cAlphaArgs(2) + "\", already assigned."); - ShowContinueError(state, - "\"Inside\", was already assigned Material=\"" + - s_mat->materials(state.dataSurface->SurfMaterialMovInsulInt(SurfNum))->Name + "\"."); - ShowContinueError(state, "attempting to assign Material=\"" + thisMaterial->Name + "\"."); - ErrorsFound = true; - } - state.dataSurface->SurfMaterialMovInsulInt(SurfNum) = MaterNum; - state.dataSurface->SurfSchedMovInsulInt(SurfNum) = SchNum; - state.dataSurface->AnyMovableInsulation = true; - if (thisMaterial->Resistance <= 0.0) { - if (thisMaterial->Conductivity <= 0.0 || thisMaterial->Thickness <= 0.0) { - ShowSevereError(state, - format("{}, {}=\"{}\", invalid material.", - s_ipsc->cCurrentModuleObject, - s_ipsc->cAlphaFieldNames(2), - s_ipsc->cAlphaArgs(2))); - ShowContinueError(state, "\"Inside\", invalid material for movable insulation."); - ShowContinueError(state, - format("Material=\"{}\",Resistance=[{:.3R}], must be > 0 for use in Movable Insulation.", - thisMaterial->Name, - thisMaterial->Resistance)); - ErrorsFound = true; - } else if (thisMaterial->Conductivity > 0.0) { - thisMaterial->Resistance = thisMaterial->Thickness / thisMaterial->Conductivity; - } - } - break; - default: - assert(false); - } - } - if (state.dataSurface->Surface(SurfNum).Class == SurfaceClass::Window) { - ShowSevereError( - state, format("{}, {}=\"{}\"", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); - ShowContinueError(state, "invalid use on a Window. Use WindowShadingControl instead."); - ErrorsFound = true; - } } } + } break; + + case InsulationType::Inside: { + auto &movInsul = state.dataSurface->intMovInsuls(SurfNum); + if (movInsul.matNum > 0) { + ShowSevereDuplicateAssignment( + state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2), s_mat->materials(movInsul.matNum)->Name); + ErrorsFound = true; + } + + movInsul.matNum = MaterNum; + movInsul.sched = sched; + state.dataSurface->AnyMovableInsulation = true; + state.dataSurface->intMovInsulSurfNums.push_back(SurfNum); + if (thisMaterial->Resistance <= 0.0) { + if (thisMaterial->Conductivity <= 0.0 || thisMaterial->Thickness <= 0.0) { + ShowSevereError(state, + format("{}, {}=\"{}\", invalid material.", + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); + ShowContinueError(state, "\"Inside\", invalid material for movable insulation."); + ShowContinueError(state, + format("Material=\"{}\",Resistance=[{:.3R}], must be > 0 for use in Movable Insulation.", + thisMaterial->Name, + thisMaterial->Resistance)); + ErrorsFound = true; + } else if (thisMaterial->Conductivity > 0.0) { + thisMaterial->Resistance = thisMaterial->Thickness / thisMaterial->Conductivity; + } + } + } break; + default: { + assert(false); + } break; + } // switch (inulationType) + + if (state.dataSurface->Surface(SurfNum).Class == SurfaceClass::Window) { + ShowSevereError(state, format("{}, {}=\"{}\"", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2))); + ShowContinueError(state, "invalid use on a Window. Use WindowShadingControl instead."); + ErrorsFound = true; } - } - } + } // for (Loop) + } // GetMovableInsulationData() // Calculates the volume (m3) of a zone using the surfaces as possible. void CalculateZoneVolume(EnergyPlusData &state) @@ -12506,7 +11807,7 @@ namespace SurfaceGeometry { } // returns a vector of edges that are in both vectors - std::vector edgesInBoth(std::vector edges1, std::vector edges2) + std::vector edgesInBoth(std::vector const &edges1, std::vector const &edges2) { // J. Glazer - June 2017 // this is not optimized but the number of edges for a typical polyhedron is 12 and is probably rarely bigger than 20. @@ -12539,8 +11840,6 @@ namespace SurfaceGeometry { { // J. Glazer - March 2017 - using DataVectorTypes::Vector; - struct EdgeByPts { int start; @@ -12610,7 +11909,6 @@ namespace SurfaceGeometry { { // J. Glazer - March 2017 - using DataVectorTypes::Vector; std::vector uniqVertices; uniqVertices.reserve(zonePoly.NumSurfaceFaces * 6); @@ -12643,8 +11941,6 @@ namespace SurfaceGeometry { { // J. Glazer - March 2017 - using DataVectorTypes::Vector; - DataVectorTypes::Polyhedron updZonePoly = zonePoly; // set the return value to the original polyhedron describing the zone for (auto &updFace : updZonePoly.SurfaceFace) { @@ -12693,11 +11989,7 @@ namespace SurfaceGeometry { // so if you could all the unique vertices of the floor and ceiling, ignoring the z-coordinate, they // should always be even (they would be two but you might define multiple surfaces that meet in a corner) - using DataVectorTypes::Vector; - using DataVectorTypes::Vector2dCount; - using DataVectorTypes::Vector_2d; - - std::vector floorCeilingXY; + std::vector floorCeilingXY; floorCeilingXY.reserve(zonePoly.NumSurfaceFaces * 6); // make list of x and y coordinates for all faces that are on the floor or ceiling @@ -12707,13 +11999,13 @@ namespace SurfaceGeometry { state.dataSurface->Surface(curSurfNum).Class == SurfaceClass::Roof) { for (int jVertex = 1; jVertex <= zonePoly.SurfaceFace(iFace).NSides; ++jVertex) { Vector curVertex = zonePoly.SurfaceFace(iFace).FacePoints(jVertex); - Vector2dCount curXYc; + DataVectorTypes::Vector2dCount curXYc; curXYc.x = curVertex.x; curXYc.y = curVertex.y; curXYc.count = 1; bool found = false; - for (Vector2dCount &curFloorCeiling : floorCeilingXY) { // can't use just "auto" because updating floorCeilingXY - if (isAlmostEqual2dPt(curXYc, curFloorCeiling)) { // count ignored in comparison + for (DataVectorTypes::Vector2dCount &curFloorCeiling : floorCeilingXY) { // can't use just "auto" because updating floorCeilingXY + if (isAlmostEqual2dPt(curXYc, curFloorCeiling)) { // count ignored in comparison ++curFloorCeiling.count; found = true; break; @@ -12815,7 +12107,6 @@ namespace SurfaceGeometry { // approach: if opposite surfaces have opposite azimuth and same area, then check the distance between the // vertices( one counting backwards ) and if it is the same distance than assume that it is the same. - using DataVectorTypes::Vector; bool foundOppEqual = false; for (int iFace = 1; iFace <= zonePoly.NumSurfaceFaces; ++iFace) { int curSurfNum = zonePoly.SurfaceFace(iFace).SurfNum; @@ -12940,7 +12231,7 @@ namespace SurfaceGeometry { } // returns the index of vertex in a list that is in the same position in space as the given vertex - int findIndexOfVertex(DataVectorTypes::Vector vertexToFind, std::vector listOfVertices) + int findIndexOfVertex(DataVectorTypes::Vector vertexToFind, std::vector const &listOfVertices) { // J. Glazer - March 2017 @@ -13024,8 +12315,6 @@ namespace SurfaceGeometry { // Detached Shading, Base Surfaces, Attached Shading surfaces are represented in the // same manner as original. Subsurfaces (windows, doors) are a "relative coordinate". - using namespace Vectors; - static constexpr std::string_view RoutineName("ProcessSurfaceVertices: "); Real64 X1; // Intermediate Result @@ -13041,28 +12330,24 @@ namespace SurfaceGeometry { Real64 Zp; Real64 SurfWorldAz; // Surface Azimuth (facing) Real64 SurfTilt; // Surface Tilt - SurfaceShape ThisShape(SurfaceShape::None); + DataSurfaces::SurfaceShape ThisShape(DataSurfaces::SurfaceShape::None); bool BaseSurface; // True if a base surface or a detached shading surface Real64 ThisSurfAz; Real64 ThisSurfTilt; Real64 ThisReveal; Real64 ThisWidth; Real64 ThisHeight; - int FrDivNum; // Frame/divider number Real64 FrWidth; // Frame width for exterior windows (m) Real64 FrArea; // Frame area for exterior windows(m2) Real64 DivWidth; // Divider width for exterior windows (m) Real64 DivArea; // Divider area for exterior windows (m2) Real64 DivFrac; // Fraction of divider area without overlaps bool ErrorInSurface; // false/true, depending on pass through routine - bool SError; // Bool used for return value of calls to PlaneEquation bool HeatTransSurf; - bool IsCoPlanar; Real64 OutOfLine; - int LastVertexInError; // Object Data - PlaneEq BasePlane; + Vectors::PlaneEq BasePlane; Vector TVect; Vector CoordinateTransVector; @@ -13097,7 +12382,9 @@ namespace SurfaceGeometry { // IF (Surface(ThisSurf)%Name(1:3) /= 'Mir') THEN if (!surf.MirroredSurf) { - CalcCoPlanarNess(surf.Vertex, surf.Sides, IsCoPlanar, OutOfLine, LastVertexInError); + bool IsCoPlanar; + int LastVertexInError; + Vectors::CalcCoPlanarNess(surf.Vertex, surf.Sides, IsCoPlanar, OutOfLine, LastVertexInError); if (!IsCoPlanar) { if (OutOfLine > 0.01) { ShowSevereError(state, @@ -13127,22 +12414,22 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->Zpsv(n) = surf.Vertex(n).z; } TVect = surf.Vertex(3) - surf.Vertex(2); - ThisWidth = VecLength(TVect); + ThisWidth = Vectors::VecLength(TVect); TVect = surf.Vertex(2) - surf.Vertex(1); - ThisHeight = VecLength(TVect); + ThisHeight = Vectors::VecLength(TVect); surf.Width = ThisWidth; surf.Height = ThisHeight; // For a horizontal surface this is actually length! if (surf.Sides == 3) { - surf.Shape = SurfaceShape::Triangle; + surf.Shape = DataSurfaces::SurfaceShape::Triangle; } else if (surf.Sides == 4) { // Test for rectangularity if (isRectangle(state, ThisSurf)) { - surf.Shape = SurfaceShape::Rectangle; + surf.Shape = DataSurfaces::SurfaceShape::Rectangle; } else { - surf.Shape = SurfaceShape::Quadrilateral; + surf.Shape = DataSurfaces::SurfaceShape::Quadrilateral; } } else { // Surface( ThisSurf ).Sides > 4 - surf.Shape = SurfaceShape::Polygonal; + surf.Shape = DataSurfaces::SurfaceShape::Polygonal; if (std::abs(ThisHeight * ThisWidth - surf.GrossArea) > 0.001) { surf.Width = std::sqrt(surf.GrossArea); surf.Height = surf.Width; @@ -13159,10 +12446,10 @@ namespace SurfaceGeometry { // Retrieve base surface info Real64 const baseSurfWorldAz = state.dataSurface->Surface(ThisBaseSurface).Azimuth; Real64 const baseSurfTilt = state.dataSurface->Surface(ThisBaseSurface).Tilt; - Real64 const BaseCosAzimuth = std::cos(baseSurfWorldAz * Constant::DegToRadians); - Real64 const BaseSinAzimuth = std::sin(baseSurfWorldAz * Constant::DegToRadians); - Real64 const BaseCosTilt = std::cos(baseSurfTilt * Constant::DegToRadians); - Real64 const BaseSinTilt = std::sin(baseSurfTilt * Constant::DegToRadians); + Real64 const BaseCosAzimuth = std::cos(baseSurfWorldAz * Constant::DegToRad); + Real64 const BaseSinAzimuth = std::sin(baseSurfWorldAz * Constant::DegToRad); + Real64 const BaseCosTilt = std::cos(baseSurfTilt * Constant::DegToRad); + Real64 const BaseSinTilt = std::sin(baseSurfTilt * Constant::DegToRad); Real64 const BaseXLLC = state.dataSurface->Surface(ThisBaseSurface).Vertex(2).x; Real64 const BaseYLLC = state.dataSurface->Surface(ThisBaseSurface).Vertex(2).y; Real64 const BaseZLLC = state.dataSurface->Surface(ThisBaseSurface).Vertex(2).z; @@ -13170,11 +12457,11 @@ namespace SurfaceGeometry { if (HeatTransSurf) { if (surf.Sides == 4) { - ThisShape = SurfaceShape::RectangularDoorWindow; + ThisShape = DataSurfaces::SurfaceShape::RectangularDoorWindow; } else if (surf.Sides == 3 && surf.Class == SurfaceClass::Window) { - ThisShape = SurfaceShape::TriangularWindow; + ThisShape = DataSurfaces::SurfaceShape::TriangularWindow; } else if (surf.Sides == 3 && surf.Class == SurfaceClass::Door) { - ThisShape = SurfaceShape::TriangularDoor; + ThisShape = DataSurfaces::SurfaceShape::TriangularDoor; } else { assert(false); } @@ -13185,24 +12472,26 @@ namespace SurfaceGeometry { // left or right fin if (ThisSurfAz < 0.0) ThisSurfAz += 360.0; if (ThisSurfAz > state.dataSurface->Surface(surf.BaseSurf).Azimuth) { - ThisShape = SurfaceShape::RectangularLeftFin; + ThisShape = DataSurfaces::SurfaceShape::RectangularLeftFin; } else { - ThisShape = SurfaceShape::RectangularRightFin; + ThisShape = DataSurfaces::SurfaceShape::RectangularRightFin; } } else { - ThisShape = SurfaceShape::RectangularOverhang; + ThisShape = DataSurfaces::SurfaceShape::RectangularOverhang; } } // Setting relative coordinates for shadowing calculations for subsurfaces + bool SError; // Bool used for return value of calls to PlaneEquation switch (ThisShape) { - case SurfaceShape::RectangularDoorWindow: { // Rectangular heat transfer subsurface - PlaneEquation(state.dataSurface->Surface(surf.BaseSurf).Vertex, state.dataSurface->Surface(surf.BaseSurf).Sides, BasePlane, SError); + case DataSurfaces::SurfaceShape::RectangularDoorWindow: { // Rectangular heat transfer subsurface + Vectors::PlaneEquation( + state.dataSurface->Surface(surf.BaseSurf).Vertex, state.dataSurface->Surface(surf.BaseSurf).Sides, BasePlane, SError); if (SError) { ShowSevereError(state, format("{}Degenerate surface (likely two vertices equal):\"{}\".", RoutineName, surf.Name)); ErrorInSurface = true; } - ThisReveal = -Pt2Plane(surf.Vertex(2), BasePlane); + ThisReveal = -Vectors::Pt2Plane(surf.Vertex(2), BasePlane); if (std::abs(ThisReveal) < 0.0002) ThisReveal = 0.0; surf.Reveal = ThisReveal; Xp = surf.Vertex(2).x - BaseXLLC; @@ -13212,9 +12501,9 @@ namespace SurfaceGeometry { YLLC = -Xp * BaseSinAzimuth * BaseCosTilt - Yp * BaseCosAzimuth * BaseCosTilt + Zp * BaseSinTilt; ZLLC = Xp * BaseSinAzimuth * BaseSinTilt + Yp * BaseCosAzimuth * BaseSinTilt + Zp * BaseCosTilt; TVect = surf.Vertex(3) - surf.Vertex(2); - ThisWidth = VecLength(TVect); + ThisWidth = Vectors::VecLength(TVect); TVect = surf.Vertex(2) - surf.Vertex(1); - ThisHeight = VecLength(TVect); + ThisHeight = Vectors::VecLength(TVect); surf.Width = ThisWidth; surf.Height = ThisHeight; @@ -13246,8 +12535,8 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->Zpsv(3) = ZLLC; state.dataSurfaceGeometry->Zpsv(4) = ZLLC; - if (surf.Class == SurfaceClass::Window && surf.ExtBoundCond == ExternalEnvironment && surf.FrameDivider > 0) { - FrDivNum = surf.FrameDivider; + if (surf.Class == SurfaceClass::Window && surf.ExtBoundCond == DataSurfaces::ExternalEnvironment && surf.FrameDivider > 0) { + int FrDivNum = surf.FrameDivider; // Set flag for calculating beam solar reflection from outside and/or inside window reveal if ((surf.Reveal > 0.0 && state.dataSurface->FrameDivider(FrDivNum).OutsideRevealSolAbs > 0.0) || (state.dataSurface->FrameDivider(FrDivNum).InsideSillDepth > 0.0 && @@ -13331,14 +12620,15 @@ namespace SurfaceGeometry { } } } break; - case SurfaceShape::TriangularWindow: - case SurfaceShape::TriangularDoor: { - PlaneEquation(state.dataSurface->Surface(surf.BaseSurf).Vertex, state.dataSurface->Surface(surf.BaseSurf).Sides, BasePlane, SError); + case DataSurfaces::SurfaceShape::TriangularWindow: + case DataSurfaces::SurfaceShape::TriangularDoor: { + Vectors::PlaneEquation( + state.dataSurface->Surface(surf.BaseSurf).Vertex, state.dataSurface->Surface(surf.BaseSurf).Sides, BasePlane, SError); if (SError) { ShowSevereError(state, format("{}Degenerate surface (likely two vertices equal):\"{}\".", RoutineName, surf.Name)); ErrorInSurface = true; } - ThisReveal = -Pt2Plane(surf.Vertex(2), BasePlane); + ThisReveal = -Vectors::Pt2Plane(surf.Vertex(2), BasePlane); if (std::abs(ThisReveal) < 0.0002) ThisReveal = 0.0; surf.Reveal = ThisReveal; Xp = surf.Vertex(2).x - BaseXLLC; @@ -13348,11 +12638,10 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->Ypsv(2) = -Xp * BaseSinAzimuth * BaseCosTilt - Yp * BaseCosAzimuth * BaseCosTilt + Zp * BaseSinTilt; state.dataSurfaceGeometry->Zpsv(2) = Xp * BaseSinAzimuth * BaseSinTilt + Yp * BaseCosAzimuth * BaseSinTilt + Zp * BaseCosTilt; TVect = surf.Vertex(3) - surf.Vertex(2); - ThisWidth = VecLength(TVect); + ThisWidth = Vectors::VecLength(TVect); TVect = surf.Vertex(2) - surf.Vertex(1); - ThisHeight = VecLength(TVect); + ThisHeight = Vectors::VecLength(TVect); surf.Width = ThisWidth; - surf.Height = ThisHeight; // Effective height and width of a triangular window for use in calc of convective air flow // in gap between glass and shading device when shading device is present surf.Height = 4.0 * surf.Area / (3.0 * surf.Width); @@ -13372,7 +12661,7 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->Ypsv(3) = -Xp * BaseSinAzimuth * BaseCosTilt - Yp * BaseCosAzimuth * BaseCosTilt + Zp * BaseSinTilt; state.dataSurfaceGeometry->Zpsv(3) = Xp * BaseSinAzimuth * BaseSinTilt + Yp * BaseCosAzimuth * BaseSinTilt + Zp * BaseCosTilt; } break; - case SurfaceShape::RectangularOverhang: { + case DataSurfaces::SurfaceShape::RectangularOverhang: { Xp = surf.Vertex(2).x - BaseXLLC; Yp = surf.Vertex(2).y - BaseYLLC; Zp = surf.Vertex(2).z - BaseZLLC; @@ -13380,9 +12669,9 @@ namespace SurfaceGeometry { YLLC = -Xp * BaseSinAzimuth * BaseCosTilt - Yp * BaseCosAzimuth * BaseCosTilt + Zp * BaseSinTilt; ZLLC = Xp * BaseSinAzimuth * BaseSinTilt + Yp * BaseCosAzimuth * BaseSinTilt + Zp * BaseCosTilt; TVect = surf.Vertex(3) - surf.Vertex(2); - ThisWidth = VecLength(TVect); + ThisWidth = Vectors::VecLength(TVect); TVect = surf.Vertex(2) - surf.Vertex(1); - ThisHeight = VecLength(TVect); + ThisHeight = Vectors::VecLength(TVect); surf.Width = ThisWidth; surf.Height = ThisHeight; state.dataSurfaceGeometry->Xpsv(1) = XLLC; @@ -13398,7 +12687,7 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->Zpsv(2) = 0.0; state.dataSurfaceGeometry->Zpsv(3) = 0.0; } break; - case SurfaceShape::RectangularLeftFin: { + case DataSurfaces::SurfaceShape::RectangularLeftFin: { Xp = surf.Vertex(2).x - BaseXLLC; Yp = surf.Vertex(2).y - BaseYLLC; Zp = surf.Vertex(2).z - BaseZLLC; @@ -13406,9 +12695,9 @@ namespace SurfaceGeometry { YLLC = -Xp * BaseSinAzimuth * BaseCosTilt - Yp * BaseCosAzimuth * BaseCosTilt + Zp * BaseSinTilt; ZLLC = Xp * BaseSinAzimuth * BaseSinTilt + Yp * BaseCosAzimuth * BaseSinTilt + Zp * BaseCosTilt; TVect = surf.Vertex(3) - surf.Vertex(2); - ThisWidth = VecLength(TVect); + ThisWidth = Vectors::VecLength(TVect); TVect = surf.Vertex(2) - surf.Vertex(1); - ThisHeight = VecLength(TVect); + ThisHeight = Vectors::VecLength(TVect); surf.Width = ThisWidth; surf.Height = ThisHeight; state.dataSurfaceGeometry->Xpsv(1) = XLLC; @@ -13424,7 +12713,7 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->Zpsv(2) = 0.0; state.dataSurfaceGeometry->Zpsv(3) = 0.0; } break; - case SurfaceShape::RectangularRightFin: { + case DataSurfaces::SurfaceShape::RectangularRightFin: { Xp = surf.Vertex(2).x - BaseXLLC; Yp = surf.Vertex(2).y - BaseYLLC; Zp = surf.Vertex(2).z - BaseZLLC; @@ -13432,9 +12721,9 @@ namespace SurfaceGeometry { YLLC = -Xp * BaseSinAzimuth * BaseCosTilt - Yp * BaseCosAzimuth * BaseCosTilt + Zp * BaseSinTilt; ZLLC = Xp * BaseSinAzimuth * BaseSinTilt + Yp * BaseCosAzimuth * BaseSinTilt + Zp * BaseCosTilt; TVect = surf.Vertex(3) - surf.Vertex(2); - ThisWidth = VecLength(TVect); + ThisWidth = Vectors::VecLength(TVect); TVect = surf.Vertex(2) - surf.Vertex(1); - ThisHeight = VecLength(TVect); + ThisHeight = Vectors::VecLength(TVect); surf.Width = ThisWidth; surf.Height = ThisHeight; state.dataSurfaceGeometry->Xpsv(1) = XLLC; @@ -13544,10 +12833,6 @@ namespace SurfaceGeometry { state.dataSurface->ShadeV(ThisSurf).YV(n) += state.dataSurface->Surface(ThisBaseSurface).YShift; } } - - if (ErrorInSurface) { - ErrorsFound = true; - } } void CalcCoordinateTransformation(EnergyPlusData &state, @@ -13566,17 +12851,10 @@ namespace SurfaceGeometry { // through points 2 and 3 and the Y-axis goes through point 1 // of a plane figure in 3-d space. - // METHODOLOGY EMPLOYED: - // na - // REFERENCES: // 'NECAP' - NASA'S Energy-Cost Analysis Program - // Using/Aliasing - using namespace Vectors; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int I; // Loop Control Real64 Gamma; // Intermediate Result Real64 DotSelfX23; @@ -13594,7 +12872,7 @@ namespace SurfaceGeometry { if (DotSelfX23 <= Constant::OneMillionth) { ShowSevereError(state, format("CalcCoordinateTransformation: Invalid dot product, surface=\"{}\":", surf.Name)); - for (I = 1; I <= surf.Sides; ++I) { + for (int I = 1; I <= surf.Sides; ++I) { auto const &point = surf.Vertex(I); ShowContinueError(state, format(" ({:8.3F},{:8.3F},{:8.3F})", point.x, point.y, point.z)); } @@ -13619,28 +12897,22 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR Fred Winkelmann // DATE WRITTEN Nov 2001 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Creates a shaded window construction for windows whose WindowShadingControl // has a shading device specified instead of a shaded construction // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int ConstrNum; // Number of unshaded construction int ConstrNewSh; // Number of shaded construction that is created - std::string ShDevName; // Shading device material name - std::string ConstrName; // Unshaded construction name std::string ConstrNameSh; // Shaded construction name - int TotLayersOld; // Total layers in old (unshaded) construction - int TotLayersNew; // Total layers in new (shaded) construction - // INTEGER :: loop ! DO loop index auto &s_mat = state.dataMaterial; + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); + + std::string const &ShDevName = s_mat->materials(ShDevNum)->Name; + int ConstrNum = surfTemp.Construction; + std::string const &ConstrName = state.dataConstruction->Construct(ConstrNum).Name; - ShDevName = s_mat->materials(ShDevNum)->Name; - ConstrNum = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction; - ConstrName = state.dataConstruction->Construct(ConstrNum).Name; if (ANY_INTERIOR_SHADE_BLIND(state.dataSurface->WindowShadingControl(WSCPtr).ShadingType)) { ConstrNameSh = ConstrName + ':' + ShDevName + ":INT"; } else { @@ -13652,15 +12924,15 @@ namespace SurfaceGeometry { ConstrNewSh = Util::FindItemInList(ConstrNameSh, state.dataConstruction->Construct); if (ConstrNewSh > 0) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).shadedConstructionList[shadeControlIndex] = ConstrNewSh; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).activeShadedConstruction = ConstrNewSh; // set the active to the current for now + surfTemp.shadedConstructionList[shadeControlIndex] = ConstrNewSh; + surfTemp.activeShadedConstruction = ConstrNewSh; // set the active to the current for now } else { // Create new construction ConstrNewSh = state.dataHeatBal->TotConstructs + 1; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).shadedConstructionList[shadeControlIndex] = ConstrNewSh; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).activeShadedConstruction = ConstrNewSh; // set the active to the current for now + surfTemp.shadedConstructionList[shadeControlIndex] = ConstrNewSh; + surfTemp.activeShadedConstruction = ConstrNewSh; // set the active to the current for now state.dataHeatBal->TotConstructs = ConstrNewSh; state.dataConstruction->Construct.redimension(state.dataHeatBal->TotConstructs); state.dataHeatBal->NominalRforNominalUCalculation.redimension(state.dataHeatBal->TotConstructs); @@ -13672,15 +12944,15 @@ namespace SurfaceGeometry { state.dataConstruction->Construct(state.dataHeatBal->TotConstructs).setArraysBasedOnMaxSolidWinLayers(state); - TotLayersOld = state.dataConstruction->Construct(ConstrNum).TotLayers; - TotLayersNew = TotLayersOld + 1; + int TotLayersOld = state.dataConstruction->Construct(ConstrNum).TotLayers; + int TotLayersNew = TotLayersOld + 1; state.dataConstruction->Construct(ConstrNewSh).LayerPoint = 0; auto const *thisMaterialSh = s_mat->materials(ShDevNum); auto &thisConstructNewSh = state.dataConstruction->Construct(ConstrNewSh); - if (state.dataSurface->WindowShadingControl(WSCPtr).ShadingType == WinShadingType::IntShade || - state.dataSurface->WindowShadingControl(WSCPtr).ShadingType == WinShadingType::IntBlind) { + if (state.dataSurface->WindowShadingControl(WSCPtr).ShadingType == DataSurfaces::WinShadingType::IntShade || + state.dataSurface->WindowShadingControl(WSCPtr).ShadingType == DataSurfaces::WinShadingType::IntBlind) { // Interior shading device thisConstructNewSh.LayerPoint({1, TotLayersOld}) = state.dataConstruction->Construct(ConstrNum).LayerPoint({1, TotLayersOld}); thisConstructNewSh.LayerPoint(TotLayersNew) = ShDevNum; @@ -13729,17 +13001,17 @@ namespace SurfaceGeometry { thisConstructNewSh.AbsDiffShade = 0.0; thisConstructNewSh.AbsDiffBackShade = 0.0; thisConstructNewSh.ShadeAbsorpThermal = 0.0; - thisConstructNewSh.AbsBeamShadeCoef = 0.0; + std::fill(thisConstructNewSh.AbsBeamShadeCoef.begin(), thisConstructNewSh.AbsBeamShadeCoef.end(), 0.0); thisConstructNewSh.TransDiff = 0.0; thisConstructNewSh.TransDiffVis = 0.0; thisConstructNewSh.ReflectSolDiffBack = 0.0; thisConstructNewSh.ReflectSolDiffFront = 0.0; thisConstructNewSh.ReflectVisDiffBack = 0.0; thisConstructNewSh.ReflectVisDiffFront = 0.0; - thisConstructNewSh.TransSolBeamCoef = 0.0; - thisConstructNewSh.TransVisBeamCoef = 0.0; - thisConstructNewSh.ReflSolBeamFrontCoef = 0.0; - thisConstructNewSh.ReflSolBeamBackCoef = 0.0; + std::fill(thisConstructNewSh.TransSolBeamCoef.begin(), thisConstructNewSh.TransSolBeamCoef.end(), 0.0); + std::fill(thisConstructNewSh.TransVisBeamCoef.begin(), thisConstructNewSh.TransVisBeamCoef.end(), 0.0); + std::fill(thisConstructNewSh.ReflSolBeamFrontCoef.begin(), thisConstructNewSh.ReflSolBeamFrontCoef.end(), 0.0); + std::fill(thisConstructNewSh.ReflSolBeamBackCoef.begin(), thisConstructNewSh.ReflSolBeamBackCoef.end(), 0.0); thisConstructNewSh.W5FrameDivider = 0; thisConstructNewSh.FromWindow5DataFile = false; @@ -13751,10 +13023,8 @@ namespace SurfaceGeometry { thisConstructNewSh.IsUsed = true; for (int Layer = 1; Layer <= state.dataHeatBal->MaxSolidWinLayers; ++Layer) { - for (int index = 1; index <= DataSurfaces::MaxPolyCoeff; ++index) { - thisConstructNewSh.AbsBeamCoef(Layer)(index) = 0.0; - thisConstructNewSh.AbsBeamBackCoef(Layer)(index) = 0.0; - } + std::fill(thisConstructNewSh.AbsBeamCoef(Layer).begin(), thisConstructNewSh.AbsBeamCoef(Layer).end(), 0.0); + std::fill(thisConstructNewSh.AbsBeamBackCoef(Layer).begin(), thisConstructNewSh.AbsBeamBackCoef(Layer).end(), 0.0); } } } @@ -13785,7 +13055,7 @@ namespace SurfaceGeometry { int ConstrNewSt = Util::FindItemInList(ConstrNameSt, state.dataConstruction->Construct, state.dataHeatBal->TotConstructs); // Number of unshaded storm window construction that is created - // If necessary, create new material corresponding to the air layer between the storm winddow and the rest of the window + // If necessary, create new material corresponding to the air layer between the storm window and the rest of the window int MatNewStAir = createAirMaterialFromDistance(state, state.dataSurface->StormWindow(StormWinNum).StormWinDistance, "AIR:STORMWIN:"); if (ConstrNewSt == 0) { ConstrNewSt = createConstructionWithStorm( @@ -13802,8 +13072,7 @@ namespace SurfaceGeometry { // can be added. (A storm window can be added if there is an interior shade or blind and up to three // glass layers, or there is a between-glass shade or blind and two glass layers.) bool ShAndSt = false; // True if unshaded and shaded window can have a storm window - std::string ConstrNameSh = state.dataConstruction->Construct(curConstruction).Name; // Name of original shaded window construction - int TotLayers = state.dataConstruction->Construct(curConstruction).TotLayers; // Total layers in a construction + int TotLayers = state.dataConstruction->Construct(curConstruction).TotLayers; // Total layers in a construction int MatIntSh = state.dataConstruction->Construct(curConstruction).LayerPoint(TotLayers); // Material number of interior shade or blind int MatBetweenGlassSh = 0; // Material number of between-glass shade or blind if (TotLayers == 5) MatBetweenGlassSh = state.dataConstruction->Construct(curConstruction).LayerPoint(3); @@ -13823,12 +13092,11 @@ namespace SurfaceGeometry { } } if (ShAndSt) { - auto &surf = state.dataSurface->Surface(SurfNum); std::string ConstrNameStSh = "SHADEDCONSTRUCTIONWITHSTORMWIN:" + state.dataConstruction->Construct(iConstruction).Name + ":" + ChrNum; // Name of shaded construction with storm window int ConstrNewStSh = createConstructionWithStorm( state, ConstrNum, ConstrNameStSh, state.dataSurface->StormWindow(StormWinNum).StormWinMaterialNum, MatNewStAir); - surf.shadedStormWinConstructionList[iConstruction] = ConstrNewStSh; // put in same index as the shaded constuction + surf.shadedStormWinConstructionList[iConstruction] = ConstrNewStSh; // put in same index as the shaded construction } } // end of loop for shaded constructions } // end of loop over storm window objects @@ -13836,7 +13104,7 @@ namespace SurfaceGeometry { int createAirMaterialFromDistance(EnergyPlusData &state, Real64 distance, std::string_view namePrefix) { - auto &s_mat = state.dataMaterial; + auto const &s_mat = state.dataMaterial; int mmDistance = int(1000 * distance); // Thickness of air gap in mm (usually between storm window and rest of window) std::string MatNameStAir = format("{}{}MM", namePrefix, mmDistance); // Name of created air layer material @@ -13870,11 +13138,11 @@ namespace SurfaceGeometry { // create a new construction with storm based on an old construction and storm and gap materials int createConstructionWithStorm(EnergyPlusData &state, int oldConstruction, std::string name, int stormMaterial, int gapMaterial) { - auto &s_mat = state.dataMaterial; int newConstruct = Util::FindItemInList(name, state.dataConstruction->Construct, state.dataHeatBal->TotConstructs); // Number of shaded storm window construction that is created if (newConstruct == 0) { + auto &s_mat = state.dataMaterial; state.dataHeatBal->TotConstructs = state.dataHeatBal->TotConstructs + 1; newConstruct = state.dataHeatBal->TotConstructs; state.dataConstruction->Construct.redimension(state.dataHeatBal->TotConstructs); @@ -13933,17 +13201,17 @@ namespace SurfaceGeometry { thisConstruct.AbsDiffShade = 0.0; thisConstruct.AbsDiffBackShade = 0.0; thisConstruct.ShadeAbsorpThermal = 0.0; - thisConstruct.AbsBeamShadeCoef = 0.0; + std::fill(thisConstruct.AbsBeamShadeCoef.begin(), thisConstruct.AbsBeamShadeCoef.end(), 0.0); thisConstruct.TransDiff = 0.0; thisConstruct.TransDiffVis = 0.0; thisConstruct.ReflectSolDiffBack = 0.0; thisConstruct.ReflectSolDiffFront = 0.0; thisConstruct.ReflectVisDiffBack = 0.0; thisConstruct.ReflectVisDiffFront = 0.0; - thisConstruct.TransSolBeamCoef = 0.0; - thisConstruct.TransVisBeamCoef = 0.0; - thisConstruct.ReflSolBeamFrontCoef = 0.0; - thisConstruct.ReflSolBeamBackCoef = 0.0; + std::fill(thisConstruct.TransSolBeamCoef.begin(), thisConstruct.TransSolBeamCoef.end(), 0.0); + std::fill(thisConstruct.TransVisBeamCoef.begin(), thisConstruct.TransVisBeamCoef.end(), 0.0); + std::fill(thisConstruct.ReflSolBeamFrontCoef.begin(), thisConstruct.ReflSolBeamFrontCoef.end(), 0.0); + std::fill(thisConstruct.ReflSolBeamBackCoef.begin(), thisConstruct.ReflSolBeamBackCoef.end(), 0.0); thisConstruct.W5FrameDivider = 0; thisConstruct.FromWindow5DataFile = false; thisConstruct.W5FileMullionWidth = 0.0; @@ -13951,10 +13219,8 @@ namespace SurfaceGeometry { thisConstruct.W5FileGlazingSysWidth = 0.0; thisConstruct.W5FileGlazingSysHeight = 0.0; for (int Layer = 1; Layer <= state.dataHeatBal->MaxSolidWinLayers; ++Layer) { - for (int index = 1; index <= DataSurfaces::MaxPolyCoeff; ++index) { - thisConstruct.AbsBeamCoef(Layer)(index) = 0.0; - thisConstruct.AbsBeamBackCoef(Layer)(index) = 0.0; - } + std::fill(thisConstruct.AbsBeamCoef(Layer).begin(), thisConstruct.AbsBeamCoef(Layer).end(), 0.0); + std::fill(thisConstruct.AbsBeamBackCoef(Layer).begin(), thisConstruct.AbsBeamBackCoef(Layer).end(), 0.0); } } return (newConstruct); @@ -13975,7 +13241,6 @@ namespace SurfaceGeometry { // GrossArea and Perimeter of original window were not being recalculated. // October 2007, LKL: Net area for shading calculations was not being // recalculated. - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // If a window from the Window5DataFile has one glazing system, modify the @@ -13987,19 +13252,12 @@ namespace SurfaceGeometry { // on the Data File and the width and orientation of the mullion that separates // the glazing systems. - // Using/Aliasing - - using namespace Vectors; - - // Locals // SUBROUTINE ARGUMENT DEFINITIONS: - // If there is a second glazing systme on the Data File, SurfNum+1 + // If there is a second glazing system on the Data File, SurfNum+1 // has the construction of the second glazing system. // 2-glazing system Window5 data file entry - // DERIVED TYPE DEFINITIONS: - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 H; // Height and width of original window (m) Real64 W; @@ -14013,6 +13271,8 @@ namespace SurfaceGeometry { std::string Const2Name; // Name of construction of second glazing system // unused1208 REAL(r64) :: AreaNew ! Sum of areas of the two glazing systems (m2) + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); + struct rectangularwindow { // Members @@ -14028,17 +13288,16 @@ namespace SurfaceGeometry { Vector TVect; rectangularwindow OriginalCoord; - IConst = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction; + IConst = surfTemp.Construction; // Height and width of original window - TVect = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(3) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(2); - W = VecLength(TVect); // SQRT((X(3)-X(2))**2 + (Y(3)-Y(2))**2 + (Z(3)-Z(2))**2) - TVect = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(2) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(1); - H = VecLength(TVect); // SQRT((X(1)-X(2))**2 + (Y(1)-Y(2))**2 + (Z(1)-Z(2))**2) + TVect = surfTemp.Vertex(3) - surfTemp.Vertex(2); + W = Vectors::VecLength(TVect); // SQRT((X(3)-X(2))**2 + (Y(3)-Y(2))**2 + (Z(3)-Z(2))**2) + TVect = surfTemp.Vertex(2) - surfTemp.Vertex(1); + H = Vectors::VecLength(TVect); // SQRT((X(1)-X(2))**2 + (Y(1)-Y(2))**2 + (Z(1)-Z(2))**2) // Save coordinates of original window in case Window 5 data overwrites. - OriginalCoord.Vertex({1, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides}) = - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex({1, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides}); + OriginalCoord.Vertex({1, surfTemp.Sides}) = surfTemp.Vertex({1, surfTemp.Sides}); // Height and width of first glazing system h1 = state.dataConstruction->Construct(IConst).W5FileGlazingSysHeight; @@ -14057,7 +13316,7 @@ namespace SurfaceGeometry { if (state.dataGlobal->DisplayExtraWarnings) { ShowWarningError(state, format("SurfaceGeometry: ModifyWindow: Window {} uses the Window5 Data File Construction {}", - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, state.dataConstruction->Construct(IConst).Name)); ShowContinueError(state, format("The height {:.3R}(m) or width (m) of this window differs by more than 10%{:.3R}", H, W)); ShowContinueError(state, @@ -14070,25 +13329,23 @@ namespace SurfaceGeometry { } // Calculate net area for base surface - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf).Area -= - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area; - if (state.dataSurfaceGeometry->SurfaceTmp(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf).Area <= 0.0) { - ShowSevereError(state, - format("Subsurfaces have too much area for base surface={}", - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf).Name)); - ShowContinueError(state, format("Subsurface creating error={}", state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); + state.dataSurfaceGeometry->SurfaceTmp(surfTemp.BaseSurf).Area -= surfTemp.Area; + if (state.dataSurfaceGeometry->SurfaceTmp(surfTemp.BaseSurf).Area <= 0.0) { + ShowSevereError( + state, + format("Subsurfaces have too much area for base surface={}", state.dataSurfaceGeometry->SurfaceTmp(surfTemp.BaseSurf).Name)); + ShowContinueError(state, format("Subsurface creating error={}", surfTemp.Name)); ErrorsFound = true; } // Net area of base surface with unity window multipliers (used in shadowing checks) - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf).NetAreaShadowCalc -= - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area / state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Multiplier; + state.dataSurfaceGeometry->SurfaceTmp(surfTemp.BaseSurf).NetAreaShadowCalc -= surfTemp.Area / surfTemp.Multiplier; } else { // Two glazing systems on Window5 data file for this window // if exterior window, okay. - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond == ExternalEnvironment) { + if (surfTemp.ExtBoundCond == DataSurfaces::ExternalEnvironment) { // There are two glazing systems (separated by a vertical or horizontal mullion) on the Window5 Data File. // Fill in geometry data for the second window (corresponding to the second glazing system on the data file. // The first glazing system is assumed to be at left for vertical mullion, at bottom for horizontal mullion. @@ -14099,7 +13356,7 @@ namespace SurfaceGeometry { if (state.dataGlobal->DisplayExtraWarnings) { ShowMessage(state, format("SurfaceGeometry: ModifyWindow: Window {} has been replaced with the Window 5/6 two glazing system=\"{}\".", - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, state.dataConstruction->Construct(IConst).Name)); ShowContinueError(state, "Note that originally entered dimensions are overridden."); } else { @@ -14109,13 +13366,13 @@ namespace SurfaceGeometry { // Allocate another window AddWindow(state, SurfNum, ErrorsFound, AddedSubSurfaces); - } else if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond > 0) { // Interior window, specified ! not external environment + } else if (surfTemp.ExtBoundCond > 0) { // Interior window, specified ! not external environment if (state.dataGlobal->DisplayExtraWarnings) { ShowWarningError( state, format("SurfaceGeometry: ModifyWindow: Interior Window {} has been replaced with the Window 5/6 two glazing system=\"{}\".", - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + surfTemp.Name, state.dataConstruction->Construct(IConst).Name)); ShowContinueError( state, "Please check to make sure interior window is correct. Note that originally entered dimensions are overridden."); @@ -14127,9 +13384,7 @@ namespace SurfaceGeometry { } else { // Interior window, specified not entered - ShowSevereError(state, - format("SurfaceGeometry: ModifyWindow: Interior Window {} is a window in an adjacent zone.", - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); + ShowSevereError(state, format("SurfaceGeometry: ModifyWindow: Interior Window {} is a window in an adjacent zone.", surfTemp.Name)); ShowContinueError( state, format("Attempted to add/reverse Window 5/6 multiple glazing system=\"{}\".", state.dataConstruction->Construct(IConst).Name)); @@ -14149,21 +13404,14 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN Nov 2008 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This routine is called from ModifyWindow to add a window. Allows it to be // called in more than one place in the calling routine so as to be able to have // specific warnings or errors issued. - // Using/Aliasing - - using namespace Vectors; - - // Locals // SUBROUTINE ARGUMENT DEFINITIONS: - // If there is a second glazing systme on the Data File, SurfNum+1 + // If there is a second glazing system on the Data File, SurfNum+1 // has the construction of the second glazing system. // 2-glazing system Window5 data file entry @@ -14206,17 +13454,18 @@ namespace SurfaceGeometry { rectangularwindow NewCoord; rectangularwindow OriginalCoord; - IConst = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction; + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); + + IConst = surfTemp.Construction; // Height and width of original window - TVect = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(3) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(2); - W = VecLength(TVect); // SQRT((X(3)-X(2))**2 + (Y(3)-Y(2))**2 + (Z(3)-Z(2))**2) - TVect = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(2) - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(1); - H = VecLength(TVect); // SQRT((X(1)-X(2))**2 + (Y(1)-Y(2))**2 + (Z(1)-Z(2))**2) + TVect = surfTemp.Vertex(3) - surfTemp.Vertex(2); + W = Vectors::VecLength(TVect); // SQRT((X(3)-X(2))**2 + (Y(3)-Y(2))**2 + (Z(3)-Z(2))**2) + TVect = surfTemp.Vertex(2) - surfTemp.Vertex(1); + H = Vectors::VecLength(TVect); // SQRT((X(1)-X(2))**2 + (Y(1)-Y(2))**2 + (Z(1)-Z(2))**2) // Save coordinates of original window in case Window 5 data overwrites. - OriginalCoord.Vertex({1, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides}) = - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex({1, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides}); + OriginalCoord.Vertex({1, surfTemp.Sides}) = surfTemp.Vertex({1, surfTemp.Sides}); // Height and width of first glazing system h1 = state.dataConstruction->Construct(IConst).W5FileGlazingSysHeight; @@ -14230,71 +13479,53 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).Vertex.allocate(4); - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).Name = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name + ":2"; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).Name = surfTemp.Name + ":2"; state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).Construction = IConst2; state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).ConstructionStoredInputValue = IConst2; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).Class = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).Azimuth = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Azimuth; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).Class = surfTemp.Class; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).Azimuth = surfTemp.Azimuth; // Sine and cosine of azimuth and tilt - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).SinAzim = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SinAzim; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).CosAzim = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).CosAzim; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).SinTilt = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SinTilt; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).CosTilt = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).CosTilt; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).SinAzim = surfTemp.SinAzim; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).CosAzim = surfTemp.CosAzim; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).SinTilt = surfTemp.SinTilt; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).CosTilt = surfTemp.CosTilt; // Outward normal unit vector (pointing away from room) - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).Centroid = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Centroid; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).lcsx = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).lcsx; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).lcsy = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).lcsy; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).lcsz = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).lcsz; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).NewellAreaVector = - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).NewellAreaVector; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).OutNormVec = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OutNormVec; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).Reveal = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Reveal; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).Shape = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Shape; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).Sides = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).Tilt = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).convOrientation = - Convect::GetSurfConvOrientation(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Tilt); - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).HeatTransSurf = - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).HeatTransSurf; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).BaseSurfName = - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurfName; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).BaseSurf = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).ZoneName = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).Zone = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Zone; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).ExtBoundCondName = - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCondName; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).ExtBoundCond = - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtBoundCond; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).ExtSolar = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtSolar; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).ExtWind = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ExtWind; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).ViewFactorGround = - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorGround; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).ViewFactorSky = - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorSky; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).ViewFactorGroundIR = - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorGroundIR; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).ViewFactorSkyIR = - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ViewFactorSkyIR; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).OSCPtr = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).OSCPtr; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).SchedShadowSurfIndex = - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).SchedShadowSurfIndex; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).activeWindowShadingControl = - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).activeWindowShadingControl; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).windowShadingControlList = - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).windowShadingControlList; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).HasShadeControl = - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).HasShadeControl; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).activeShadedConstruction = - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).activeShadedConstruction; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).windowShadingControlList = - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).windowShadingControlList; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).Centroid = surfTemp.Centroid; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).lcsx = surfTemp.lcsx; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).lcsy = surfTemp.lcsy; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).lcsz = surfTemp.lcsz; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).NewellAreaVector = surfTemp.NewellAreaVector; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).OutNormVec = surfTemp.OutNormVec; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).Reveal = surfTemp.Reveal; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).Shape = surfTemp.Shape; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).Sides = surfTemp.Sides; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).Tilt = surfTemp.Tilt; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).convOrientation = Convect::GetSurfConvOrientation(surfTemp.Tilt); + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).HeatTransSurf = surfTemp.HeatTransSurf; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).BaseSurfName = surfTemp.BaseSurfName; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).BaseSurf = surfTemp.BaseSurf; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).ZoneName = surfTemp.ZoneName; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).Zone = surfTemp.Zone; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).ExtBoundCondName = surfTemp.ExtBoundCondName; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).ExtBoundCond = surfTemp.ExtBoundCond; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).ExtSolar = surfTemp.ExtSolar; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).ExtWind = surfTemp.ExtWind; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).ViewFactorGround = surfTemp.ViewFactorGround; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).ViewFactorSky = surfTemp.ViewFactorSky; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).ViewFactorGroundIR = surfTemp.ViewFactorGroundIR; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).ViewFactorSkyIR = surfTemp.ViewFactorSkyIR; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).OSCPtr = surfTemp.OSCPtr; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).shadowSurfSched = surfTemp.shadowSurfSched; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).activeWindowShadingControl = surfTemp.activeWindowShadingControl; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).windowShadingControlList = surfTemp.windowShadingControlList; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).HasShadeControl = surfTemp.HasShadeControl; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).activeShadedConstruction = surfTemp.activeShadedConstruction; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).windowShadingControlList = surfTemp.windowShadingControlList; state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).shadedStormWinConstructionList = - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).shadedStormWinConstructionList; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).FrameDivider = - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).FrameDivider; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).Multiplier = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Multiplier; - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).NetAreaShadowCalc = - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).NetAreaShadowCalc; + surfTemp.shadedStormWinConstructionList; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).FrameDivider = surfTemp.FrameDivider; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).Multiplier = surfTemp.Multiplier; + state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).NetAreaShadowCalc = surfTemp.NetAreaShadowCalc; MulWidth = state.dataConstruction->Construct(IConst).W5FileMullionWidth; w2 = state.dataConstruction->Construct(IConst2).W5FileGlazingSysWidth; @@ -14304,21 +13535,20 @@ namespace SurfaceGeometry { // area of the two glazing systems. Note that for Surface(SurfNum)%Class = 'Window' the effect // of a window multiplier is included in the glazing area. Note that frame areas are subtracted later. - AreaNew = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Multiplier * (h1 * w1 + h2 * w2); // both glazing systems + AreaNew = surfTemp.Multiplier * (h1 * w1 + h2 * w2); // both glazing systems // Adjust net area for base surface - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf).Area -= AreaNew; + state.dataSurfaceGeometry->SurfaceTmp(surfTemp.BaseSurf).Area -= AreaNew; // Net area of base surface with unity window multipliers (used in shadowing checks) - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf).NetAreaShadowCalc -= - AreaNew / state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Multiplier; + state.dataSurfaceGeometry->SurfaceTmp(surfTemp.BaseSurf).NetAreaShadowCalc -= AreaNew / surfTemp.Multiplier; // Reset area, etc. of original window - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Multiplier * (h1 * w1); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).GrossArea = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Area; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).NetAreaShadowCalc = h1 * w1; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Perimeter = 2 * (h1 + w1); - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Height = h1; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Width = w1; + surfTemp.Area = surfTemp.Multiplier * (h1 * w1); + surfTemp.GrossArea = surfTemp.Area; + surfTemp.NetAreaShadowCalc = h1 * w1; + surfTemp.Perimeter = 2 * (h1 + w1); + surfTemp.Height = h1; + surfTemp.Width = w1; // Set area, etc. of new window state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).Area = state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).Multiplier * (h2 * w2); @@ -14329,11 +13559,11 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).Height = h2; state.dataSurfaceGeometry->SurfaceTmp(state.dataSurface->TotSurfaces).Width = w2; - if (state.dataSurfaceGeometry->SurfaceTmp(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf).Area <= 0.0) { + if (state.dataSurfaceGeometry->SurfaceTmp(surfTemp.BaseSurf).Area <= 0.0) { ShowSevereError(state, format("SurfaceGeometry: ModifyWindow: Subsurfaces have too much area for base surface={}", - state.dataSurfaceGeometry->SurfaceTmp(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).BaseSurf).Name)); - ShowContinueError(state, format("Subsurface (window) creating error={}", state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name)); + state.dataSurfaceGeometry->SurfaceTmp(surfTemp.BaseSurf).Name)); + ShowContinueError(state, format("Subsurface (window) creating error={}", surfTemp.Name)); ShowContinueError(state, format("This window has been replaced by two windows from the Window5 Data File of total area {:.2R} m2", AreaNew)); ErrorsFound = true; @@ -14401,8 +13631,8 @@ namespace SurfaceGeometry { NewCoord.Vertex(4).y = ya + (dx / W) * (yb - ya); NewCoord.Vertex(4).z = za + (dx / W) * (zb - za); - for (loop = 1; loop <= state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides; ++loop) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(loop) = NewCoord.Vertex(loop); + for (loop = 1; loop <= surfTemp.Sides; ++loop) { + surfTemp.Vertex(loop) = NewCoord.Vertex(loop); } // Right-hand glazing @@ -14522,8 +13752,8 @@ namespace SurfaceGeometry { NewCoord.Vertex(4).y = ya + (dx / W) * (yb - ya); NewCoord.Vertex(4).z = za + (dx / W) * (zb - za); - for (loop = 1; loop <= state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Sides; ++loop) { - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(loop) = NewCoord.Vertex(loop); + for (loop = 1; loop <= surfTemp.Sides; ++loop) { + surfTemp.Vertex(loop) = NewCoord.Vertex(loop); } // Top glazing @@ -14595,8 +13825,6 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR Brent T Griffith // DATE WRITTEN April 2003 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Alter input for surface geometry @@ -14617,12 +13845,8 @@ namespace SurfaceGeometry { Array1D_string cAlphas(1); Array1D rNumerics(2); - int NAlphas; - int NNum; - int IOStat; auto &OldAspectRatio = state.dataSurfaceGeometry->OldAspectRatio; auto &NewAspectRatio = state.dataSurfaceGeometry->NewAspectRatio; - auto &transformPlane = state.dataSurfaceGeometry->transformPlane; int n; Real64 Xo; Real64 XnoRot; @@ -14634,9 +13858,15 @@ namespace SurfaceGeometry { // get user input... auto &s_ipsc = state.dataIPShortCut; + auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum); if (state.dataSurfaceGeometry->firstTime) { if (state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject) == 1) { + int NAlphas; + int NNum; + int IOStat; + auto &s_ipsc = state.dataIPShortCut; + auto &transformPlane = state.dataSurfaceGeometry->transformPlane; state.dataInputProcessing->inputProcessor->getObjectItem(state, CurrentModuleObject, 1, @@ -14670,9 +13900,9 @@ namespace SurfaceGeometry { if (state.dataSurfaceGeometry->noTransform) return; // check surface type. - if (!state.dataSurfaceGeometry->SurfaceTmp(SurfNum).HeatTransSurf) { + if (!surfTemp.HeatTransSurf) { // Site Shading do not get transformed. - if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Class == SurfaceClass::Detached_F) return; + if (surfTemp.Class == SurfaceClass::Detached_F) return; } // testing method of transforming x and y coordinates as follows @@ -14681,8 +13911,8 @@ namespace SurfaceGeometry { // try to first derotate it , transform by aspect and then rotate back. for (n = 1; n <= NSides; ++n) { - Xo = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).x; // world coordinates.... shifted by relative north angle... - Yo = state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).y; + Xo = surfTemp.Vertex(n).x; // world coordinates.... shifted by relative north angle... + Yo = surfTemp.Vertex(n).y; // next derotate the building XnoRot = Xo * state.dataSurfaceGeometry->CosBldgRelNorth + Yo * state.dataSurfaceGeometry->SinBldgRelNorth; YnoRot = Yo * state.dataSurfaceGeometry->CosBldgRelNorth - Xo * state.dataSurfaceGeometry->SinBldgRelNorth; @@ -14690,11 +13920,9 @@ namespace SurfaceGeometry { Xtrans = XnoRot * std::sqrt(NewAspectRatio / OldAspectRatio); Ytrans = YnoRot * std::sqrt(OldAspectRatio / NewAspectRatio); // rerotate - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).x = - Xtrans * state.dataSurfaceGeometry->CosBldgRelNorth - Ytrans * state.dataSurfaceGeometry->SinBldgRelNorth; + surfTemp.Vertex(n).x = Xtrans * state.dataSurfaceGeometry->CosBldgRelNorth - Ytrans * state.dataSurfaceGeometry->SinBldgRelNorth; - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Vertex(n).y = - Xtrans * state.dataSurfaceGeometry->SinBldgRelNorth + Ytrans * state.dataSurfaceGeometry->CosBldgRelNorth; + surfTemp.Vertex(n).y = Xtrans * state.dataSurfaceGeometry->SinBldgRelNorth + Ytrans * state.dataSurfaceGeometry->CosBldgRelNorth; } } @@ -14703,8 +13931,6 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR B. Griffith // DATE WRITTEN Feb. 2004 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // compute centroid of all the surfaces in the main @@ -14718,8 +13944,6 @@ namespace SurfaceGeometry { // (Algorithm would need to be changed for higher order // polygons with more than four sides). - using namespace Vectors; - auto &Triangle1 = state.dataSurfaceGeometry->Triangle1; auto &Triangle2 = state.dataSurfaceGeometry->Triangle2; static Vector const zero_vector(0.0); @@ -14758,11 +13982,11 @@ namespace SurfaceGeometry { } // get area fraction of triangles. - Real64 Tri1Area(AreaPolygon(3, Triangle1) / TotalArea); - Real64 Tri2Area(AreaPolygon(3, Triangle2) / TotalArea); + Real64 Tri1Area(Vectors::AreaPolygon(3, Triangle1) / TotalArea); + Real64 Tri2Area(Vectors::AreaPolygon(3, Triangle2) / TotalArea); // check if sum of fractions are slightly greater than 1.0 which is a symptom of the triangles for a non-convex - // quadralateral using the wrong two triangles + // quadrilateral using the wrong two triangles if ((Tri1Area + Tri2Area) > 1.05) { // if so repeat the process with the other two possible triangles (notice the vertices are in a different order this @@ -14775,8 +13999,8 @@ namespace SurfaceGeometry { Triangle2(3) = vertex(4); // get area fraction of triangles. - Real64 AreaTriangle1 = AreaPolygon(3, Triangle1); - Real64 AreaTriangle2 = AreaPolygon(3, Triangle2); + Real64 AreaTriangle1 = Vectors::AreaPolygon(3, Triangle1); + Real64 AreaTriangle2 = Vectors::AreaPolygon(3, Triangle2); TotalArea = AreaTriangle1 + AreaTriangle2; Tri1Area = AreaTriangle1 / TotalArea; Tri2Area = AreaTriangle2 / TotalArea; @@ -14833,7 +14057,7 @@ namespace SurfaceGeometry { surface.Centroid = centroid; if (centroid.z < 0.0) { - if (surface.ExtWind || surface.ExtBoundCond == ExternalEnvironment) ++negZcount; + if (surface.ExtWind || surface.ExtBoundCond == DataSurfaces::ExternalEnvironment) ++negZcount; } } // loop through surfaces @@ -14853,8 +14077,6 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR B. Griffith // DATE WRITTEN Dec. 2008 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // determine if Shading surfaces need full solar calcs because they @@ -14864,26 +14086,13 @@ namespace SurfaceGeometry { // METHODOLOGY EMPLOYED: // Mine solar renewables input and collect surface names. // find shading surfaces with names that match those in solar objects. - // setup flags for shading surfaces so that the solar renewables can resuse incident solar calcs + // setup flags for shading surfaces so that the solar renewables can reuse incident solar calcs // new solar component models that use shading surfaces will have to extend the code here. - // Using/Aliasing - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Array1D_string TmpCandidateSurfaceNames; Array1D_string TmpCandidateICSSurfaceNames; Array1D_string TmpCandidateICSBCTypeNames; - int NumCandidateNames; - int NumOfCollectors; - int NumOfICSUnits; - int NumOfFlatPlateUnits; - int NumPVTs; - int NumPVs; - int SurfNum; - int Found; - int CollectorNum; - int PVTnum; - int PVnum; int NumAlphas; // Number of alpha names being passed int NumNumbers; // Number of numeric parameters being passed int IOStatus; @@ -14891,16 +14100,16 @@ namespace SurfaceGeometry { auto &s_ipsc = state.dataIPShortCut; // First collect names of surfaces referenced by active solar components s_ipsc->cCurrentModuleObject = "SolarCollector:FlatPlate:Water"; - NumOfFlatPlateUnits = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + int NumOfFlatPlateUnits = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); s_ipsc->cCurrentModuleObject = "SolarCollector:FlatPlate:PhotovoltaicThermal"; - NumPVTs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + int NumPVTs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); s_ipsc->cCurrentModuleObject = "Generator:Photovoltaic"; - NumPVs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + int NumPVs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); s_ipsc->cCurrentModuleObject = "SolarCollector:IntegralCollectorStorage"; - NumOfICSUnits = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + int NumOfICSUnits = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); - NumCandidateNames = NumOfFlatPlateUnits + NumPVTs + NumPVs + NumOfICSUnits; - NumOfCollectors = NumOfFlatPlateUnits + NumOfICSUnits; + int NumCandidateNames = NumOfFlatPlateUnits + NumPVTs + NumPVs + NumOfICSUnits; + int NumOfCollectors = NumOfFlatPlateUnits + NumOfICSUnits; TmpCandidateSurfaceNames.allocate(NumCandidateNames); TmpCandidateICSSurfaceNames.allocate(NumOfCollectors); @@ -14908,7 +14117,7 @@ namespace SurfaceGeometry { if (NumOfCollectors > 0) { s_ipsc->cCurrentModuleObject = "SolarCollector:FlatPlate:Water"; - for (CollectorNum = 1; CollectorNum <= NumOfFlatPlateUnits; ++CollectorNum) { + for (int CollectorNum = 1; CollectorNum <= NumOfFlatPlateUnits; ++CollectorNum) { state.dataInputProcessing->inputProcessor->getObjectItem( state, s_ipsc->cCurrentModuleObject, CollectorNum, s_ipsc->cAlphaArgs, NumAlphas, s_ipsc->rNumericArgs, NumNumbers, IOStatus); @@ -14920,7 +14129,7 @@ namespace SurfaceGeometry { if (NumPVTs > 0) { s_ipsc->cCurrentModuleObject = "SolarCollector:FlatPlate:PhotovoltaicThermal"; - for (PVTnum = 1; PVTnum <= NumPVTs; ++PVTnum) { + for (int PVTnum = 1; PVTnum <= NumPVTs; ++PVTnum) { state.dataInputProcessing->inputProcessor->getObjectItem( state, s_ipsc->cCurrentModuleObject, PVTnum, s_ipsc->cAlphaArgs, NumAlphas, s_ipsc->rNumericArgs, NumNumbers, IOStatus); @@ -14931,7 +14140,7 @@ namespace SurfaceGeometry { if (NumPVs > 0) { s_ipsc->cCurrentModuleObject = "Generator:Photovoltaic"; - for (PVnum = 1; PVnum <= NumPVs; ++PVnum) { + for (int PVnum = 1; PVnum <= NumPVs; ++PVnum) { state.dataInputProcessing->inputProcessor->getObjectItem( state, s_ipsc->cCurrentModuleObject, PVnum, s_ipsc->cAlphaArgs, NumAlphas, s_ipsc->rNumericArgs, NumNumbers, IOStatus); TmpCandidateSurfaceNames(NumOfFlatPlateUnits + NumPVTs + PVnum) = s_ipsc->cAlphaArgs(2); @@ -14940,7 +14149,7 @@ namespace SurfaceGeometry { if (NumOfICSUnits > 0) { s_ipsc->cCurrentModuleObject = "SolarCollector:IntegralCollectorStorage"; - for (CollectorNum = 1; CollectorNum <= NumOfICSUnits; ++CollectorNum) { + for (int CollectorNum = 1; CollectorNum <= NumOfICSUnits; ++CollectorNum) { state.dataInputProcessing->inputProcessor->getObjectItem( state, s_ipsc->cCurrentModuleObject, CollectorNum, s_ipsc->cAlphaArgs, NumAlphas, s_ipsc->rNumericArgs, NumNumbers, IOStatus); TmpCandidateSurfaceNames(NumOfFlatPlateUnits + NumPVTs + NumPVs + CollectorNum) = s_ipsc->cAlphaArgs(3); @@ -14950,9 +14159,9 @@ namespace SurfaceGeometry { } // loop through all the surfaces - for (SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { + for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { auto &surf = state.dataSurface->Surface(SurfNum); - Found = Util::FindItemInList(surf.Name, TmpCandidateSurfaceNames, NumCandidateNames); + int Found = Util::FindItemInList(surf.Name, TmpCandidateSurfaceNames, NumCandidateNames); if (Found > 0) { if (!surf.HeatTransSurf) { // not BIPV, must be a shading surf with solar device // Setup missing values to allow shading surfaces to model incident solar and wind @@ -14963,7 +14172,7 @@ namespace SurfaceGeometry { // check if this surface is used for ICS collector mounting and has OthersideCondictionsModel as its // boundary condition if (NumOfICSUnits > 0) { - for (CollectorNum = 1; CollectorNum <= NumOfCollectors; ++CollectorNum) { + for (int CollectorNum = 1; CollectorNum <= NumOfCollectors; ++CollectorNum) { if (Util::SameString(surf.Name, TmpCandidateICSSurfaceNames(CollectorNum)) && Util::SameString(TmpCandidateICSBCTypeNames(CollectorNum), "OTHERSIDECONDITIONSMODEL")) { state.dataSurface->SurfIsICS(SurfNum) = true; @@ -15022,140 +14231,126 @@ namespace SurfaceGeometry { state, format("{}: Surface=\"{}\" uses Construction:AirBoundary in a non-interzone surface.", RoutineName, surf.Name)); } } else { - // Process air boundary - set surface properties and set up enclosures - // Radiant exchange - if (surf.IsAirBoundarySurf) { - // Boundary is grouped - assign enclosure - state.dataHeatBal->AnyAirBoundary = true; - int thisSideEnclosureNum = 0; - int otherSideEnclosureNum = 0; + // Process air boundary - set surface properties and set up enclosures Radiant exchange, Boundary is grouped - assign enclosure + state.dataHeatBal->AnyAirBoundary = true; + int thisSideEnclosureNum = 0; + int otherSideEnclosureNum = 0; + if (radiantSetup) { + // Radiant enclosure setup + constr.IsUsedCTF = false; + surf.HeatTransSurf = false; + surf.HeatTransferAlgorithm = DataSurfaces::HeatTransferModel::AirBoundaryNoHT; + thisSideEnclosureNum = state.dataHeatBal->space(surf.spaceNum).radiantEnclosureNum; + otherSideEnclosureNum = state.dataHeatBal->space(state.dataSurface->Surface(surf.ExtBoundCond).spaceNum).radiantEnclosureNum; + } else { + // Solar enclosure setup + thisSideEnclosureNum = state.dataHeatBal->space(surf.spaceNum).solarEnclosureNum; + otherSideEnclosureNum = state.dataHeatBal->space(state.dataSurface->Surface(surf.ExtBoundCond).spaceNum).solarEnclosureNum; + } + anyGroupedSpaces = true; + if ((thisSideEnclosureNum == 0) && (otherSideEnclosureNum == 0)) { + // Neither zone is assigned to an enclosure, so increment the counter and assign to both + ++enclosureNum; + auto &thisEnclosure = Enclosures(enclosureNum); + thisSideEnclosureNum = enclosureNum; + thisEnclosure.Name = format("{} Enclosure {}", RadiantOrSolar, enclosureNum); + thisEnclosure.spaceNames.push_back(state.dataHeatBal->space(surf.spaceNum).Name); + thisEnclosure.spaceNums.push_back(surf.spaceNum); + thisEnclosure.FloorArea += state.dataHeatBal->space(surf.spaceNum).FloorArea; + otherSideEnclosureNum = enclosureNum; + int otherSideSpaceNum = state.dataSurface->Surface(surf.ExtBoundCond).spaceNum; + if (otherSideSpaceNum != surf.spaceNum) { + thisEnclosure.spaceNames.push_back(state.dataHeatBal->space(otherSideSpaceNum).Name); + thisEnclosure.spaceNums.push_back(otherSideSpaceNum); + thisEnclosure.FloorArea += state.dataHeatBal->space(otherSideSpaceNum).FloorArea; + } if (radiantSetup) { - // Radiant enclosure setup - constr.IsUsedCTF = false; - surf.HeatTransSurf = false; - surf.HeatTransferAlgorithm = DataSurfaces::HeatTransferModel::AirBoundaryNoHT; - thisSideEnclosureNum = state.dataHeatBal->space(surf.spaceNum).radiantEnclosureNum; - otherSideEnclosureNum = - state.dataHeatBal->space(state.dataSurface->Surface(surf.ExtBoundCond).spaceNum).radiantEnclosureNum; + state.dataHeatBal->space(surf.spaceNum).radiantEnclosureNum = thisSideEnclosureNum; + state.dataHeatBal->space(state.dataSurface->Surface(surf.ExtBoundCond).spaceNum).radiantEnclosureNum = + otherSideEnclosureNum; } else { - // Solar enclosure setup - thisSideEnclosureNum = state.dataHeatBal->space(surf.spaceNum).solarEnclosureNum; - otherSideEnclosureNum = - state.dataHeatBal->space(state.dataSurface->Surface(surf.ExtBoundCond).spaceNum).solarEnclosureNum; - } - anyGroupedSpaces = true; - if ((thisSideEnclosureNum == 0) && (otherSideEnclosureNum == 0)) { - // Neither zone is assigned to an enclosure, so increment the counter and assign to both - ++enclosureNum; - auto &thisEnclosure = Enclosures(enclosureNum); - thisSideEnclosureNum = enclosureNum; - thisEnclosure.Name = format("{} Enclosure {}", RadiantOrSolar, enclosureNum); - thisEnclosure.spaceNames.push_back(state.dataHeatBal->space(surf.spaceNum).Name); - thisEnclosure.spaceNums.push_back(surf.spaceNum); - thisEnclosure.FloorArea += state.dataHeatBal->space(surf.spaceNum).FloorArea; - otherSideEnclosureNum = enclosureNum; - int otherSideSpaceNum = state.dataSurface->Surface(surf.ExtBoundCond).spaceNum; + thisEnclosure.ExtWindowArea += state.dataHeatBal->space(surf.spaceNum).extWindowArea; + thisEnclosure.TotalSurfArea += state.dataHeatBal->space(surf.spaceNum).totalSurfArea; if (otherSideSpaceNum != surf.spaceNum) { - thisEnclosure.spaceNames.push_back(state.dataHeatBal->space(otherSideSpaceNum).Name); - thisEnclosure.spaceNums.push_back(otherSideSpaceNum); - thisEnclosure.FloorArea += state.dataHeatBal->space(otherSideSpaceNum).FloorArea; - } - if (radiantSetup) { - state.dataHeatBal->space(surf.spaceNum).radiantEnclosureNum = thisSideEnclosureNum; - state.dataHeatBal->space(state.dataSurface->Surface(surf.ExtBoundCond).spaceNum).radiantEnclosureNum = - otherSideEnclosureNum; - } else { - thisEnclosure.ExtWindowArea += state.dataHeatBal->space(surf.spaceNum).extWindowArea; - thisEnclosure.TotalSurfArea += state.dataHeatBal->space(surf.spaceNum).totalSurfArea; - if (otherSideSpaceNum != surf.spaceNum) { - thisEnclosure.ExtWindowArea += state.dataHeatBal->space(otherSideSpaceNum).extWindowArea; - thisEnclosure.TotalSurfArea += state.dataHeatBal->space(otherSideSpaceNum).totalSurfArea; - } - state.dataHeatBal->space(surf.spaceNum).solarEnclosureNum = thisSideEnclosureNum; - state.dataHeatBal->space(state.dataSurface->Surface(surf.ExtBoundCond).spaceNum).solarEnclosureNum = - otherSideEnclosureNum; - } - } else if (thisSideEnclosureNum == 0) { - // Other side is assigned, so use that one for both - thisSideEnclosureNum = otherSideEnclosureNum; - auto &thisEnclosure = Enclosures(thisSideEnclosureNum); - thisEnclosure.spaceNames.push_back(state.dataHeatBal->space(surf.spaceNum).Name); - thisEnclosure.spaceNums.push_back(surf.spaceNum); - thisEnclosure.FloorArea += state.dataHeatBal->space(surf.spaceNum).FloorArea; - if (radiantSetup) { - state.dataHeatBal->space(surf.spaceNum).radiantEnclosureNum = thisSideEnclosureNum; - } else { - thisEnclosure.ExtWindowArea += state.dataHeatBal->space(surf.spaceNum).extWindowArea; - thisEnclosure.TotalSurfArea += state.dataHeatBal->space(surf.spaceNum).totalSurfArea; - state.dataHeatBal->space(surf.spaceNum).solarEnclosureNum = thisSideEnclosureNum; + thisEnclosure.ExtWindowArea += state.dataHeatBal->space(otherSideSpaceNum).extWindowArea; + thisEnclosure.TotalSurfArea += state.dataHeatBal->space(otherSideSpaceNum).totalSurfArea; } - } else if (otherSideEnclosureNum == 0) { - // This side is assigned, so use that one for both - otherSideEnclosureNum = thisSideEnclosureNum; - auto &thisEnclosure = Enclosures(thisSideEnclosureNum); - thisEnclosure.spaceNames.push_back(state.dataHeatBal->space(state.dataSurface->Surface(surf.ExtBoundCond).spaceNum).Name); - thisEnclosure.spaceNums.push_back(state.dataSurface->Surface(surf.ExtBoundCond).spaceNum); - thisEnclosure.FloorArea += state.dataHeatBal->space(state.dataSurface->Surface(surf.ExtBoundCond).spaceNum).FloorArea; + state.dataHeatBal->space(surf.spaceNum).solarEnclosureNum = thisSideEnclosureNum; + state.dataHeatBal->space(state.dataSurface->Surface(surf.ExtBoundCond).spaceNum).solarEnclosureNum = + otherSideEnclosureNum; + } + } else if (thisSideEnclosureNum == 0) { + // Other side is assigned, so use that one for both + thisSideEnclosureNum = otherSideEnclosureNum; + auto &thisEnclosure = Enclosures(thisSideEnclosureNum); + thisEnclosure.spaceNames.push_back(state.dataHeatBal->space(surf.spaceNum).Name); + thisEnclosure.spaceNums.push_back(surf.spaceNum); + thisEnclosure.FloorArea += state.dataHeatBal->space(surf.spaceNum).FloorArea; + if (radiantSetup) { + state.dataHeatBal->space(surf.spaceNum).radiantEnclosureNum = thisSideEnclosureNum; + } else { + thisEnclosure.ExtWindowArea += state.dataHeatBal->space(surf.spaceNum).extWindowArea; + thisEnclosure.TotalSurfArea += state.dataHeatBal->space(surf.spaceNum).totalSurfArea; + state.dataHeatBal->space(surf.spaceNum).solarEnclosureNum = thisSideEnclosureNum; + } + } else if (otherSideEnclosureNum == 0) { + // This side is assigned, so use that one for both + otherSideEnclosureNum = thisSideEnclosureNum; + auto &thisEnclosure = Enclosures(thisSideEnclosureNum); + thisEnclosure.spaceNames.push_back(state.dataHeatBal->space(state.dataSurface->Surface(surf.ExtBoundCond).spaceNum).Name); + thisEnclosure.spaceNums.push_back(state.dataSurface->Surface(surf.ExtBoundCond).spaceNum); + thisEnclosure.FloorArea += state.dataHeatBal->space(state.dataSurface->Surface(surf.ExtBoundCond).spaceNum).FloorArea; + if (radiantSetup) { + state.dataHeatBal->space(state.dataSurface->Surface(surf.ExtBoundCond).spaceNum).radiantEnclosureNum = + otherSideEnclosureNum; + } else { + thisEnclosure.ExtWindowArea += + state.dataHeatBal->space(state.dataSurface->Surface(surf.ExtBoundCond).spaceNum).extWindowArea; + thisEnclosure.TotalSurfArea += + state.dataHeatBal->space(state.dataSurface->Surface(surf.ExtBoundCond).spaceNum).totalSurfArea; + state.dataHeatBal->space(state.dataSurface->Surface(surf.ExtBoundCond).spaceNum).solarEnclosureNum = + otherSideEnclosureNum; + } + } else if (thisSideEnclosureNum != otherSideEnclosureNum) { + // If both sides are already assigned to an enclosure, then merge the two enclosures + auto const &thisEnclosure = Enclosures(thisSideEnclosureNum); + auto &otherEnclosure = Enclosures(otherSideEnclosureNum); + for (const auto &zName : thisEnclosure.spaceNames) { + otherEnclosure.spaceNames.push_back(zName); + } + for (int zNum : thisEnclosure.spaceNums) { + otherEnclosure.spaceNums.push_back(zNum); if (radiantSetup) { - state.dataHeatBal->space(state.dataSurface->Surface(surf.ExtBoundCond).spaceNum).radiantEnclosureNum = - otherSideEnclosureNum; + state.dataHeatBal->space(zNum).radiantEnclosureNum = otherSideEnclosureNum; } else { - thisEnclosure.ExtWindowArea += - state.dataHeatBal->space(state.dataSurface->Surface(surf.ExtBoundCond).spaceNum).extWindowArea; - thisEnclosure.TotalSurfArea += - state.dataHeatBal->space(state.dataSurface->Surface(surf.ExtBoundCond).spaceNum).totalSurfArea; - state.dataHeatBal->space(state.dataSurface->Surface(surf.ExtBoundCond).spaceNum).solarEnclosureNum = - otherSideEnclosureNum; + state.dataHeatBal->space(zNum).solarEnclosureNum = otherSideEnclosureNum; } - } else if (thisSideEnclosureNum != otherSideEnclosureNum) { - // If both sides are already assigned to an enclosure, then merge the two enclosures - auto &thisEnclosure = Enclosures(thisSideEnclosureNum); - auto &otherEnclosure = Enclosures(otherSideEnclosureNum); - for (const auto &zName : thisEnclosure.spaceNames) { - otherEnclosure.spaceNames.push_back(zName); - } - for (int zNum : thisEnclosure.spaceNums) { - otherEnclosure.spaceNums.push_back(zNum); + } + otherEnclosure.FloorArea += thisEnclosure.FloorArea; + otherEnclosure.ExtWindowArea += thisEnclosure.ExtWindowArea; + otherEnclosure.TotalSurfArea += thisEnclosure.TotalSurfArea; + // Move any enclosures beyond thisEnclosure down one slot - at this point all enclosures are named "Radiant + // Enclosure N" + for (int enclNum = thisSideEnclosureNum; enclNum < enclosureNum; ++enclNum) { + std::string saveName = Enclosures(enclNum).Name; + Enclosures(enclNum) = Enclosures(enclNum + 1); + Enclosures(enclNum).Name = saveName; + for (int sNum : Enclosures(enclNum).spaceNums) { if (radiantSetup) { - state.dataHeatBal->space(zNum).radiantEnclosureNum = otherSideEnclosureNum; + state.dataHeatBal->space(sNum).radiantEnclosureNum = enclNum; } else { - state.dataHeatBal->space(zNum).solarEnclosureNum = otherSideEnclosureNum; + state.dataHeatBal->space(sNum).solarEnclosureNum = enclNum; } } - otherEnclosure.FloorArea += thisEnclosure.FloorArea; - otherEnclosure.ExtWindowArea += thisEnclosure.ExtWindowArea; - otherEnclosure.TotalSurfArea += thisEnclosure.TotalSurfArea; - // Move any enclosures beyond thisEnclosure down one slot - at this point all enclosures are named "Radiant - // Enclosure N" - for (int enclNum = thisSideEnclosureNum; enclNum < enclosureNum; ++enclNum) { - std::string saveName = Enclosures(enclNum).Name; - Enclosures(enclNum) = Enclosures(enclNum + 1); - Enclosures(enclNum).Name = saveName; - for (int sNum : Enclosures(enclNum).spaceNums) { - if (radiantSetup) { - state.dataHeatBal->space(sNum).radiantEnclosureNum = enclNum; - } else { - state.dataHeatBal->space(sNum).solarEnclosureNum = enclNum; - } - } - } - // Clear the last rad enclosure and reduce the total number of enclosures by 1 - Enclosures(enclosureNum).Name.clear(); - Enclosures(enclosureNum).spaceNames.clear(); - Enclosures(enclosureNum).spaceNums.clear(); - Enclosures(enclosureNum).FloorArea = 0; - Enclosures(enclosureNum).ExtWindowArea = 0; - Enclosures(enclosureNum).TotalSurfArea = 0; - enclosureNum -= 1; - } - } else { - ErrorsFound = true; - ShowSevereError(state, format("{}: Surface={} uses Construction:AirBoundary with illegal option:", RoutineName, surf.Name)); - if (radiantSetup) { - ShowContinueError(state, "Radiant Exchange Method must be either GroupedSpaces or IRTSurface."); - } else { - ShowContinueError(state, "Solar and Daylighting Method must be either GroupedSpaces or InteriorWindow"); } + // Clear the last rad enclosure and reduce the total number of enclosures by 1 + Enclosures(enclosureNum).Name.clear(); + Enclosures(enclosureNum).spaceNames.clear(); + Enclosures(enclosureNum).spaceNums.clear(); + Enclosures(enclosureNum).FloorArea = 0; + Enclosures(enclosureNum).ExtWindowArea = 0; + Enclosures(enclosureNum).TotalSurfArea = 0; + enclosureNum -= 1; } if (solarSetup && constr.TypeIsAirBoundaryMixing) { // Set up mixing air boundaries only once, during solar setup @@ -15174,10 +14369,10 @@ namespace SurfaceGeometry { DataHeatBalance::AirBoundaryMixingSpecs newAirBoundaryMixing; newAirBoundaryMixing.space1 = spaceNum1; newAirBoundaryMixing.space2 = spaceNum2; - newAirBoundaryMixing.scheduleIndex = state.dataConstruction->Construct(surf.Construction).AirBoundaryMixingSched; + newAirBoundaryMixing.sched = state.dataConstruction->Construct(surf.Construction).airBoundaryMixingSched; Real64 mixingVolume = state.dataConstruction->Construct(surf.Construction).AirBoundaryACH * min(state.dataHeatBal->space(spaceNum1).Volume, state.dataHeatBal->space(spaceNum2).Volume) / - Constant::SecInHour; + Constant::rSecsInHour; newAirBoundaryMixing.mixingVolumeFlowRate = mixingVolume; state.dataHeatBal->airBoundaryMixing.push_back(newAirBoundaryMixing); } @@ -15340,7 +14535,6 @@ namespace SurfaceGeometry { // AUTHOR Tyler Hoyt // DATE WRITTEN December 2010 // MODIFIED CR8752 - incorrect note of non-convex polygons - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: This subroutine verifies the convexity of a // surface that is exposed to the sun in the case that full shading calculations @@ -15359,11 +14553,7 @@ namespace SurfaceGeometry { // REFERENCES: // http://mathworld.wolfram.com/ConvexPolygon.html - // Using/Aliasing - - using namespace DataErrorTracking; - - constexpr Real64 TurnThreshold(0.000001); // Sensitivity of convexity test, in radians + constexpr Real64 TurnThreshold = 0.000001; // Sensitivity of convexity test, in radians Real64 LastTheta = 0.0; // Angle between edge vectors bool SignFlag; // Direction of edge turn : true is right, false is left @@ -15588,22 +14778,20 @@ namespace SurfaceGeometry { // PURPOSE: Check if a 4-sided surface is a rectangle - using namespace Vectors; - - Real64 Diagonal1; // Length of diagonal of 4-sided figure from vertex 1 to vertex 3 (m) - Real64 Diagonal2; // Length of diagonal of 4-sided figure from vertex 2 to vertex 4 (m) - Real64 DotProd; // Dot product of two adjacent sides - to test for right angle - Real64 const cos89deg = std::cos(89.0 * Constant::DegToRadians); // tolerance for right angle - Vector Vect32; // normalized vector from vertex 3 to vertex 2 - Vector Vect21; // normalized vector from vertex 2 to vertex 1 + Real64 Diagonal1; // Length of diagonal of 4-sided figure from vertex 1 to vertex 3 (m) + Real64 Diagonal2; // Length of diagonal of 4-sided figure from vertex 2 to vertex 4 (m) + Real64 DotProd; // Dot product of two adjacent sides - to test for right angle + Real64 const cos89deg = std::cos(89.0 * Constant::DegToRad); // tolerance for right angle + Vector Vect32; // normalized vector from vertex 3 to vertex 2 + Vector Vect21; // normalized vector from vertex 2 to vertex 1 auto &surf = state.dataSurface->Surface(ThisSurf); - Diagonal1 = VecLength(surf.Vertex(1) - surf.Vertex(3)); - Diagonal2 = VecLength(surf.Vertex(2) - surf.Vertex(4)); + Diagonal1 = Vectors::VecLength(surf.Vertex(1) - surf.Vertex(3)); + Diagonal2 = Vectors::VecLength(surf.Vertex(2) - surf.Vertex(4)); // Test for rectangularity if (std::abs(Diagonal1 - Diagonal2) < 0.020) { // This tolerance based on coincident vertex tolerance of 0.01 - Vect32 = VecNormalize(surf.Vertex(3) - surf.Vertex(2)); - Vect21 = VecNormalize(surf.Vertex(2) - surf.Vertex(1)); + Vect32 = Vectors::VecNormalize(surf.Vertex(3) - surf.Vertex(2)); + Vect21 = Vectors::VecNormalize(surf.Vertex(2) - surf.Vertex(1)); DotProd = dot(Vect32, Vect21); if (std::abs(DotProd) <= cos89deg) { return true; @@ -15623,8 +14811,6 @@ namespace SurfaceGeometry { // SUBROUTINE INFORMATION: // AUTHOR R. Zhang, LBNL // DATE WRITTEN September 2016 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Processing of 4-sided but non-rectangular Window, Door or GlassDoor. @@ -15633,18 +14819,11 @@ namespace SurfaceGeometry { // METHODOLOGY EMPLOYED: // Transform the surface into an equivalent rectangular surface with the same area and aspect ratio. - Real64 BaseCosAzimuth; - Real64 BaseCosTilt; - Real64 BaseSinAzimuth; - Real64 BaseSinTilt; - Real64 SurfWorldAz; - Real64 SurfTilt; - Real64 AspectRatio; // Aspect ratio - Real64 NumSurfSides; // Number of surface sides - Real64 WidthEff; // Effective width of the surface - Real64 WidthMax; // X difference between the vertex on the most left and the one on the most right - Real64 HeightEff; // Effective height of the surface - Real64 HeightMax; // Y difference between the lowest and toppest vertices + Real64 AspectRatio; // Aspect ratio + Real64 WidthEff; // Effective width of the surface + Real64 WidthMax; // X difference between the vertex on the most left and the one on the most right + Real64 HeightEff; // Effective height of the surface + Real64 HeightMax; // Y difference between the lowest and highest vertices Real64 Xp; Real64 Yp; Real64 Zp; @@ -15667,13 +14846,13 @@ namespace SurfaceGeometry { return; } - SurfWorldAz = surf.Azimuth; - SurfTilt = surf.Tilt; - BaseCosAzimuth = std::cos(SurfWorldAz * Constant::DegToRadians); - BaseSinAzimuth = std::sin(SurfWorldAz * Constant::DegToRadians); - BaseCosTilt = std::cos(SurfTilt * Constant::DegToRadians); - BaseSinTilt = std::sin(SurfTilt * Constant::DegToRadians); - NumSurfSides = surf.Sides; + Real64 SurfWorldAz = surf.Azimuth; + Real64 SurfTilt = surf.Tilt; + Real64 BaseCosAzimuth = std::cos(SurfWorldAz * Constant::DegToRad); + Real64 BaseSinAzimuth = std::sin(SurfWorldAz * Constant::DegToRad); + Real64 BaseCosTilt = std::cos(SurfTilt * Constant::DegToRad); + Real64 BaseSinTilt = std::sin(SurfTilt * Constant::DegToRad); + int NumSurfSides = surf.Sides; // Calculate WidthMax and HeightMax WidthMax = 0.0; @@ -15797,13 +14976,13 @@ namespace SurfaceGeometry { } } - void GetGeoSummaryRoof(EnergyPlusData &state, GeoSummary &geoSummaryRoof) + void GetGeoSummaryRoof(EnergyPlusData const &state, GeoSummary &geoSummaryRoof) { std::vector uniqueRoofVertices; std::vector uniqEdgeOfSurfs; // I'm only partially using this for (const auto &surface : state.dataSurface->Surface) { - if (surface.ExtBoundCond != ExternalEnvironment) { + if (surface.ExtBoundCond != DataSurfaces::ExternalEnvironment) { continue; } if (!surface.HeatTransSurf) { diff --git a/src/EnergyPlus/SurfaceGeometry.hh b/src/EnergyPlus/SurfaceGeometry.hh index 1e26fbf4830..5dbc09cf049 100644 --- a/src/EnergyPlus/SurfaceGeometry.hh +++ b/src/EnergyPlus/SurfaceGeometry.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -260,7 +260,7 @@ namespace SurfaceGeometry { Real64 Xmin = 0; }; - void GetGeoSummaryRoof(EnergyPlusData &state, GeoSummary &geoSumRoof); + void GetGeoSummaryRoof(EnergyPlusData const &state, GeoSummary &geoSumRoof); class ExposedFoundationPerimeter { @@ -292,7 +292,7 @@ namespace SurfaceGeometry { void GetWindowShadingControlData(EnergyPlusData &state, bool &ErrorsFound); // If errors found in input - void InitialAssociateWindowShadingControlFenestration(EnergyPlusData &state, bool &ErrorsFound, int &SurfNum); + void InitialAssociateWindowShadingControlFenestration(EnergyPlusData &state, bool &ErrorsFound, int SurfNum); void FinalAssociateWindowShadingControlFenestration(EnergyPlusData &state, bool &ErrorsFound); @@ -333,7 +333,7 @@ namespace SurfaceGeometry { bool isEnclosedVolume(DataVectorTypes::Polyhedron const &zonePoly, std::vector &edgeNot2); - std::vector edgesInBoth(std::vector edges1, std::vector edges2); + std::vector edgesInBoth(std::vector const &edges1, std::vector const &edges2); bool edgesEqualOnSameSurface(EdgeOfSurf a, EdgeOfSurf b); @@ -365,7 +365,7 @@ namespace SurfaceGeometry { bool isAlmostEqual2dPt(DataVectorTypes::Vector_2d v1, DataVectorTypes::Vector_2d v2); - int findIndexOfVertex(DataVectorTypes::Vector vertexToFind, std::vector listOfVertices); + int findIndexOfVertex(DataVectorTypes::Vector vertexToFind, std::vector const &listOfVertices); Real64 distance(DataVectorTypes::Vector v1, DataVectorTypes::Vector v2); @@ -498,6 +498,10 @@ struct SurfaceGeometryData : BaseGlobalStruct Array1D B; int VertSize = 0; // size of X,Y,Z,A,B arrays + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/SurfaceGroundHeatExchanger.cc b/src/EnergyPlus/SurfaceGroundHeatExchanger.cc index e410a160e2d..2418fe6a8ab 100644 --- a/src/EnergyPlus/SurfaceGroundHeatExchanger.cc +++ b/src/EnergyPlus/SurfaceGroundHeatExchanger.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -50,7 +50,6 @@ // ObjexxFCL Headers #include -#include // EnergyPlus Headers #include @@ -183,8 +182,6 @@ namespace SurfaceGroundHeatExchanger { // Using/Aliasing using BranchNodeConnections::TestCompSet; - using FluidProperties::CheckFluidPropertyName; - using NodeInputManager::GetOnlySingleNode; using namespace DataLoopNode; @@ -1076,9 +1073,6 @@ namespace SurfaceGroundHeatExchanger { // Heat exchanger information also from Incropera and DeWitt. // Code based loosely on code from IBLAST program (research version) - // Using/Aliasing - using FluidProperties::GetSpecificHeatGlycol; - // Return value Real64 CalcHXEffectTerm; @@ -1163,11 +1157,7 @@ namespace SurfaceGroundHeatExchanger { this->InletTemp = max(this->InletTemp, 0.0); } } - CpWater = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - Temperature, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + CpWater = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, Temperature, RoutineName); // Calculate the Reynold's number from RE=(4*Mdot)/(Pi*Mu*Diameter) ReD = 4.0 * WaterMassFlow / (Constant::Pi * MUactual * this->TubeDiameter * this->TubeCircuits); @@ -1345,7 +1335,6 @@ namespace SurfaceGroundHeatExchanger { // Using/Aliasing Real64 SysTimeElapsed = state.dataHVACGlobal->SysTimeElapsed; Real64 TimeStepSys = state.dataHVACGlobal->TimeStepSys; - using FluidProperties::GetSpecificHeatGlycol; using PlantUtilities::SafeCopyPlantNode; // SUBROUTINE PARAMETER DEFINITIONS: @@ -1382,11 +1371,7 @@ namespace SurfaceGroundHeatExchanger { this->InletTemp = max(this->InletTemp, 0.0); } - CpFluid = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - this->InletTemp, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + CpFluid = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, this->InletTemp, RoutineName); SafeCopyPlantNode(state, this->InletNodeNum, this->OutletNodeNum); // check for flow @@ -1433,7 +1418,6 @@ namespace SurfaceGroundHeatExchanger { void SurfaceGroundHeatExchangerData::oneTimeInit_new(EnergyPlusData &state) { - using FluidProperties::GetDensityGlycol; using PlantUtilities::InitComponentNodes; using PlantUtilities::RegisterPlantCompDesignFlow; using PlantUtilities::ScanPlantLoopsForObject; @@ -1451,11 +1435,7 @@ namespace SurfaceGroundHeatExchanger { if (errFlag) { ShowFatalError(state, "InitSurfaceGroundHeatExchanger: Program terminated due to previous condition(s)."); } - rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, - DataPrecisionGlobals::constant_zero, - state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, 0.0, RoutineName); this->DesignMassFlowRate = Constant::Pi / 4.0 * pow_2(this->TubeDiameter) * DesignVelocity * rho * this->TubeCircuits; InitComponentNodes(state, 0.0, this->DesignMassFlowRate, this->InletNodeNum, this->OutletNodeNum); RegisterPlantCompDesignFlow(state, this->InletNodeNum, this->DesignMassFlowRate / rho); diff --git a/src/EnergyPlus/SurfaceGroundHeatExchanger.hh b/src/EnergyPlus/SurfaceGroundHeatExchanger.hh index ec9f8273977..6e99921a676 100644 --- a/src/EnergyPlus/SurfaceGroundHeatExchanger.hh +++ b/src/EnergyPlus/SurfaceGroundHeatExchanger.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -313,6 +313,10 @@ struct SurfaceGroundHeatExchangersData : BaseGlobalStruct Real64 TempBtm; // bottom surface temp Real64 TempTop; // top surface temp + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/SurfaceOctree.cc b/src/EnergyPlus/SurfaceOctree.cc index f388639d418..6a8906677ab 100644 --- a/src/EnergyPlus/SurfaceOctree.cc +++ b/src/EnergyPlus/SurfaceOctree.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/SurfaceOctree.hh b/src/EnergyPlus/SurfaceOctree.hh index e33dacadebf..84989fb0d8c 100644 --- a/src/EnergyPlus/SurfaceOctree.hh +++ b/src/EnergyPlus/SurfaceOctree.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/SwimmingPool.cc b/src/EnergyPlus/SwimmingPool.cc index ca74f2ae0a9..a6da8de307d 100644 --- a/src/EnergyPlus/SwimmingPool.cc +++ b/src/EnergyPlus/SwimmingPool.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -50,7 +50,6 @@ // ObjexxFCL Headers #include -#include // EnergyPlus Headers #include @@ -160,11 +159,13 @@ void GetSwimmingPool(EnergyPlusData &state) // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetSwimmingPool: "); // include trailing blank space - Real64 constexpr MinCoverFactor(0.0); // minimum value for cover factors - Real64 constexpr MaxCoverFactor(1.0); // maximum value for cover factors - Real64 constexpr MinDepth(0.05); // minimum average pool depth (to avoid obvious input errors) - Real64 constexpr MaxDepth(10.0); // maximum average pool depth (to avoid obvious input errors) - Real64 constexpr MinPowerFactor(0.0); // minimum power factor for miscellaneous equipment + static constexpr std::string_view routineName = "GetSwimmingPool"; + + Real64 constexpr MinCoverFactor(0.0); // minimum value for cover factors + Real64 constexpr MaxCoverFactor(1.0); // maximum value for cover factors + Real64 constexpr MinDepth(0.05); // minimum average pool depth (to avoid obvious input errors) + Real64 constexpr MaxDepth(10.0); // maximum average pool depth (to avoid obvious input errors) + Real64 constexpr MinPowerFactor(0.0); // minimum power factor for miscellaneous equipment // SUBROUTINE LOCAL VARIABLE DECLARATIONS: bool ErrorsFound(false); // Set to true if something goes wrong @@ -223,11 +224,17 @@ void GetSwimmingPool(EnergyPlusData &state) lAlphaBlanks, cAlphaFields, cNumericFields); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + Util::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound); state.dataSwimmingPools->Pool(Item).Name = Alphas(1); state.dataSwimmingPools->Pool(Item).SurfaceName = Alphas(2); state.dataSwimmingPools->Pool(Item).SurfacePtr = 0; + + state.dataSwimmingPools->Pool(Item).glycol = Fluid::GetWater(state); + for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { if (Util::SameString(state.dataSurface->Surface(SurfNum).Name, state.dataSwimmingPools->Pool(Item).SurfaceName)) { state.dataSwimmingPools->Pool(Item).SurfacePtr = SurfNum; @@ -247,26 +254,24 @@ void GetSwimmingPool(EnergyPlusData &state) ErrorsFound = true; } - state.dataSwimmingPools->Pool(Item).ActivityFactorSchedName = Alphas(3); - state.dataSwimmingPools->Pool(Item).ActivityFactorSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(3)); - if ((state.dataSwimmingPools->Pool(Item).ActivityFactorSchedPtr == 0) && (!lAlphaBlanks(3))) { - ShowSevereError(state, format("{} not found: {}", cAlphaFields(3), Alphas(3))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, Alphas(1))); + if (lAlphaBlanks(3)) { + } else if ((state.dataSwimmingPools->Pool(Item).activityFactorSched = Sched::GetSchedule(state, Alphas(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(3), Alphas(3)); ErrorsFound = true; } - state.dataSwimmingPools->Pool(Item).MakeupWaterSupplySchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(4)); - if ((state.dataSwimmingPools->Pool(Item).MakeupWaterSupplySchedPtr == 0) && (!lAlphaBlanks(4))) { - ShowSevereError(state, format("{} not found: {}", cAlphaFields(4), Alphas(4))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, Alphas(1))); + if (lAlphaBlanks(4)) { + } else if ((state.dataSwimmingPools->Pool(Item).makeupWaterSupplySched = Sched::GetSchedule(state, Alphas(4))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(4), Alphas(4)); ErrorsFound = true; } - state.dataSwimmingPools->Pool(Item).CoverSchedName = Alphas(5); - state.dataSwimmingPools->Pool(Item).CoverSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(5)); - if ((state.dataSwimmingPools->Pool(Item).CoverSchedPtr == 0) && (!lAlphaBlanks(5))) { - ShowSevereError(state, format("{} not found: {}", cAlphaFields(5), Alphas(5))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, Alphas(1))); + if (lAlphaBlanks(5)) { + } else if ((state.dataSwimmingPools->Pool(Item).coverSched = Sched::GetSchedule(state, Alphas(5))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(5), Alphas(5)); + ErrorsFound = true; + } else if (!state.dataSwimmingPools->Pool(Item).coverSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFields(5), Alphas(5), Clusive::In, 0.0, Clusive::In, 1.0); ErrorsFound = true; } @@ -356,16 +361,11 @@ void GetSwimmingPool(EnergyPlusData &state) state.dataSwimmingPools->Pool(Item).MiscPowerFactor = MinPowerFactor; } - state.dataSwimmingPools->Pool(Item).SetPtTempSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(8)); - if ((state.dataSwimmingPools->Pool(Item).SetPtTempSchedPtr == 0) && (!lAlphaBlanks(8))) { - ShowSevereError(state, format("{} not found: {}", cAlphaFields(8), Alphas(8))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, Alphas(1))); - ErrorsFound = true; - } if (lAlphaBlanks(8)) { - ShowSevereError(state, - format("{} left blank. This is NOT allowed as there must be a pool water setpoint temperature.", cAlphaFields(8))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, Alphas(1))); + ShowSevereEmptyField(state, eoh, cAlphaFields(8)); + ErrorsFound = true; + } else if ((state.dataSwimmingPools->Pool(Item).setPtTempSched = Sched::GetSchedule(state, Alphas(8))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(8), Alphas(8)); ErrorsFound = true; } @@ -377,19 +377,15 @@ void GetSwimmingPool(EnergyPlusData &state) state.dataSwimmingPools->Pool(Item).MaxNumOfPeople = 0.0; } - state.dataSwimmingPools->Pool(Item).PeopleSchedName = Alphas(9); - state.dataSwimmingPools->Pool(Item).PeopleSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(9)); - if ((state.dataSwimmingPools->Pool(Item).PeopleSchedPtr == 0) && (!lAlphaBlanks(9))) { - ShowSevereError(state, format("{} not found: {}", cAlphaFields(9), Alphas(9))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, Alphas(1))); + if (lAlphaBlanks(9)) { + } else if ((state.dataSwimmingPools->Pool(Item).peopleSched = Sched::GetSchedule(state, Alphas(9))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(9), Alphas(9)); ErrorsFound = true; } - state.dataSwimmingPools->Pool(Item).PeopleHeatGainSchedName = Alphas(10); - state.dataSwimmingPools->Pool(Item).PeopleHeatGainSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(10)); - if ((state.dataSwimmingPools->Pool(Item).PeopleHeatGainSchedPtr == 0) && (!lAlphaBlanks(10))) { - ShowSevereError(state, format("{} not found: {}", cAlphaFields(10), Alphas(10))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, Alphas(1))); + if (lAlphaBlanks(10)) { + } else if ((state.dataSwimmingPools->Pool(Item).peopleHeatGainSched = Sched::GetSchedule(state, Alphas(10))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(10), Alphas(10)); ErrorsFound = true; } } @@ -436,7 +432,7 @@ void SwimmingPoolData::ErrorCheckSetupPoolSurface( format("{} is a pool and is defined as a window. This is not allowed. A pool must be a floor that is NOT a window.", state.dataSurface->Surface(this->SurfacePtr).Name)); ErrorsFound = true; - } else if (state.dataSurface->SurfMaterialMovInsulInt(this->SurfacePtr) > 0) { + } else if (state.dataSurface->intMovInsuls(this->SurfacePtr).matNum > 0) { ShowSevereError(state, format("{} is a pool and has movable insulation. This is not allowed. Remove the movable insulation for this surface.", state.dataSurface->Surface(this->SurfacePtr).Name)); @@ -477,8 +473,8 @@ void SwimmingPoolData::initialize(EnergyPlusData &state, bool const FirstHVACIte Real64 constexpr MaxActivityFactor = 10.0; // Maximum value for activity factor (realistically) // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 HeatGainPerPerson = ScheduleManager::GetCurrentScheduleValue(state, this->PeopleHeatGainSchedPtr); - Real64 PeopleModifier = ScheduleManager::GetCurrentScheduleValue(state, this->PeopleSchedPtr); + Real64 HeatGainPerPerson = this->peopleHeatGainSched->getCurrentVal(); + Real64 PeopleModifier = this->peopleSched->getCurrentVal(); if (this->MyOneTimeFlag) { this->setupOutputVars(state); // Set up the output variables once here @@ -510,7 +506,7 @@ void SwimmingPoolData::initialize(EnergyPlusData &state, bool const FirstHVACIte this->WaterOutletTemp = 0.0; this->WaterMassFlowRate = 0.0; this->PeopleHeatGain = 0.0; - Real64 Density = FluidProperties::GetDensityGlycol(state, "WATER", this->PoolWaterTemp, this->GlycolIndex, RoutineName); + Real64 Density = this->glycol->getDensity(state, this->PoolWaterTemp, RoutineName); this->WaterMass = state.dataSurface->Surface(this->SurfacePtr).Area * this->AvgDepth * Density; this->WaterMassFlowRateMax = this->WaterVolFlowMax * Density; this->initSwimmingPoolPlantNodeFlow(state); @@ -535,15 +531,15 @@ void SwimmingPoolData::initialize(EnergyPlusData &state, bool const FirstHVACIte this->WaterInletTemp = state.dataLoopNodes->Node(this->WaterInletNode).Temp; // get the schedule values for different scheduled parameters - if (this->ActivityFactorSchedPtr > 0) { - this->CurActivityFactor = ScheduleManager::GetCurrentScheduleValue(state, this->ActivityFactorSchedPtr); + if (this->activityFactorSched != nullptr) { + this->CurActivityFactor = this->activityFactorSched->getCurrentVal(); if (this->CurActivityFactor < MinActivityFactor) { this->CurActivityFactor = MinActivityFactor; ShowWarningError(state, format("{}: Swimming Pool =\"{} Activity Factor Schedule =\"{} has a negative value. This is not allowed.", RoutineName, this->Name, - this->ActivityFactorSchedName)); + this->activityFactorSched->Name)); ShowContinueError(state, "The activity factor has been reset to zero."); } if (this->CurActivityFactor > MaxActivityFactor) { @@ -552,7 +548,7 @@ void SwimmingPoolData::initialize(EnergyPlusData &state, bool const FirstHVACIte format("{}: Swimming Pool =\"{} Activity Factor Schedule =\"{} has a value larger than 10. This is not allowed.", RoutineName, this->Name, - this->ActivityFactorSchedName)); + this->activityFactorSched->Name)); ShowContinueError(state, "The activity factor has been reset to unity."); } } else { @@ -560,33 +556,33 @@ void SwimmingPoolData::initialize(EnergyPlusData &state, bool const FirstHVACIte this->CurActivityFactor = 1.0; } - this->CurSetPtTemp = ScheduleManager::GetCurrentScheduleValue(state, this->SetPtTempSchedPtr); + this->CurSetPtTemp = this->setPtTempSched->getCurrentVal(); - if (this->MakeupWaterSupplySchedPtr > 0) { - this->CurMakeupWaterTemp = ScheduleManager::GetCurrentScheduleValue(state, this->MakeupWaterSupplySchedPtr); + if (this->makeupWaterSupplySched != nullptr) { + this->CurMakeupWaterTemp = this->makeupWaterSupplySched->getCurrentVal(); } else { // use water main temperaure if no schedule present in input this->CurMakeupWaterTemp = state.dataEnvrn->WaterMainsTemp; } // determine the current heat gain from people - if (this->PeopleHeatGainSchedPtr > 0) { + if (this->peopleHeatGainSched != nullptr) { if (HeatGainPerPerson < 0.0) { ShowWarningError(state, format("{}: Swimming Pool =\"{} Heat Gain Schedule =\"{} has a negative value. This is not allowed.", RoutineName, this->Name, - this->PeopleHeatGainSchedName)); + this->peopleHeatGainSched->Name)); ShowContinueError(state, "The heat gain per person has been reset to zero."); HeatGainPerPerson = 0.0; } - if (this->PeopleSchedPtr > 0) { + if (this->peopleSched != nullptr) { if (PeopleModifier < 0.0) { ShowWarningError(state, format("{}: Swimming Pool =\"{} People Schedule =\"{} has a negative value. This is not allowed.", RoutineName, this->Name, - this->PeopleSchedName)); + this->peopleSched->Name)); ShowContinueError(state, "The number of people has been reset to zero."); PeopleModifier = 0.0; } @@ -600,14 +596,15 @@ void SwimmingPoolData::initialize(EnergyPlusData &state, bool const FirstHVACIte this->PeopleHeatGain = PeopleModifier * HeatGainPerPerson * this->MaxNumOfPeople; // once cover schedule value is established, define the current values of the cover heat transfer factors - if (this->CoverSchedPtr > 0) { - this->CurCoverSchedVal = ScheduleManager::GetCurrentScheduleValue(state, this->CoverSchedPtr); + if (this->coverSched != nullptr) { + this->CurCoverSchedVal = this->coverSched->getCurrentVal(); + // Why is this checking done here as opposed to where the schedule is first retrieved? if (this->CurCoverSchedVal > 1.0) { ShowWarningError(state, format("{}: Swimming Pool =\"{} Cover Schedule =\"{} has a value greater than 1.0 (100%). This is not allowed.", RoutineName, this->Name, - this->CoverSchedName)); + this->coverSched->Name)); ShowContinueError(state, "The cover has been reset to one or fully covered."); this->CurCoverSchedVal = 1.0; } else if (this->CurCoverSchedVal < 0.0) { @@ -615,7 +612,7 @@ void SwimmingPoolData::initialize(EnergyPlusData &state, bool const FirstHVACIte format("{}: Swimming Pool =\"{} Cover Schedule =\"{} has a negative value. This is not allowed.", RoutineName, this->Name, - this->CoverSchedName)); + this->coverSched->Name)); ShowContinueError(state, "The cover has been reset to zero or uncovered."); this->CurCoverSchedVal = 0.0; } @@ -916,8 +913,7 @@ void SwimmingPoolData::calculate(EnergyPlusData &state) this->PeopleHeatGain / state.dataSurface->Surface(SurfNum).Area; // heat gain from people in pool (assumed to be all convective) // Get an estimate of the pool water specific heat - Real64 Cp = - FluidProperties::GetSpecificHeatGlycol(state, "WATER", this->PoolWaterTemp, this->GlycolIndex, RoutineName); // specific heat of pool water + Real64 Cp = this->glycol->getSpecificHeat(state, this->PoolWaterTemp, RoutineName); // specific heat of pool water Real64 TH22 = state.dataHeatBalSurf->SurfInsideTempHist(2)( SurfNum); // inside surface temperature at the previous time step equals the old pool water temperature @@ -1050,13 +1046,11 @@ void SwimmingPoolData::report(EnergyPlusData &state) this->PoolWaterTemp = state.dataHeatBalSurf->SurfInsideTempHist(1)(SurfNum); // Next calculate the amount of heating done by the plant loop - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, "WATER", this->PoolWaterTemp, this->GlycolIndex, - RoutineName); // specific heat of water + Real64 Cp = this->glycol->getSpecificHeat(state, this->PoolWaterTemp, RoutineName); // specific heat of water this->HeatPower = this->WaterMassFlowRate * Cp * (this->WaterInletTemp - this->PoolWaterTemp); // Now the power consumption of miscellaneous equipment - Real64 Density = FluidProperties::GetDensityGlycol(state, "WATER", this->PoolWaterTemp, this->GlycolIndex, - RoutineName); // density of water + Real64 Density = this->glycol->getDensity(state, this->PoolWaterTemp, RoutineName); // density of water if (Density > MinDensity) { this->MiscEquipPower = this->MiscPowerFactor * this->WaterMassFlowRate / Density; } else { @@ -1104,7 +1098,7 @@ void UpdatePoolSourceValAvg(EnergyPlusData &state, bool &SwimmingPoolOn) // .TRU if (state.dataSwimmingPools->NumSwimmingPools == 0) return; for (int PoolNum = 1; PoolNum <= state.dataSwimmingPools->NumSwimmingPools; ++PoolNum) { - auto &thisPool = state.dataSwimmingPools->Pool(PoolNum); + auto const &thisPool = state.dataSwimmingPools->Pool(PoolNum); if (thisPool.QPoolSrcAvg != 0.0) SwimmingPoolOn = true; int SurfNum = thisPool.SurfacePtr; // surface number index state.dataHeatBalFanSys->QPoolSurfNumerator(SurfNum) = thisPool.QPoolSrcAvg; diff --git a/src/EnergyPlus/SwimmingPool.hh b/src/EnergyPlus/SwimmingPool.hh index 2934261d176..7938862a3c8 100644 --- a/src/EnergyPlus/SwimmingPool.hh +++ b/src/EnergyPlus/SwimmingPool.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -77,40 +77,36 @@ namespace SwimmingPool { std::string WaterOutletNodeName; // water outlet node name int WaterOutletNode; // water outlet node number PlantLocation HWplantLoc; - Real64 WaterVolFlowMax; // maximum water flow rate for pool, m3/s - Real64 WaterMassFlowRateMax; // maximum water mass flow rate for pool, kg/s - Real64 AvgDepth; // average depth of the pool, m - Real64 ActivityFactor; // Activity factor for the pool - std::string ActivityFactorSchedName; // Activity factor schedule name - int ActivityFactorSchedPtr; // Activity factor schedule pointer - Real64 CurActivityFactor; // Current activity factor value - int MakeupWaterSupplySchedPtr; // Index to schedule for make-up water - Real64 CurMakeupWaterTemp; // Current makeup water temperature - std::string CoverSchedName; // Pool cover schedule name - int CoverSchedPtr; // Index to pool cover schedule - Real64 CurCoverSchedVal; // Current cover schedule value based on schedule - Real64 CoverEvapFactor; // Pool cover evaporation factor - Real64 CoverConvFactor; // Pool cover convective factor - Real64 CoverSWRadFactor; // Pool cover short-wavelength radiation factor - Real64 CoverLWRadFactor; // Pool cover long-wavelength radiation factor - Real64 CurCoverEvapFac; // Current pool cover evaporation factor - Real64 CurCoverConvFac; // Current pool cover convective factor - Real64 CurCoverSWRadFac; // Current pool cover short-wavelength radiation factor - Real64 CurCoverLWRadFac; // Current pool cover long-wavelength radiation factor - Real64 RadConvertToConvect; // LW and SW radiation converted to convective gain by pool cover in W/m2 - Real64 MiscPowerFactor; // Pool miscellaneous power equipment consumption coefficient in W/(kg/s) - int SetPtTempSchedPtr; // Schedule pointer for water setpoint temperature - Real64 CurSetPtTemp; // Current water setpoint temperature - Real64 MaxNumOfPeople; // Number of people in the pool as defined by user input - std::string PeopleSchedName; // Name of people schedule - int PeopleSchedPtr; // People schedule index - std::string PeopleHeatGainSchedName; // Name of people heat gain schedule - int PeopleHeatGainSchedPtr; // People heat gain schedule index - Real64 PeopleHeatGain; // Current heat gain from people - int GlycolIndex; // index in fluid property routines for water - Real64 WaterMass; // pool water mass - Real64 SatPressPoolWaterTemp; // Saturation pressure at the pool water temperature - Real64 PartPressZoneAirTemp; // Partial pressure of water vapor in the air + Real64 WaterVolFlowMax; // maximum water flow rate for pool, m3/s + Real64 WaterMassFlowRateMax; // maximum water mass flow rate for pool, kg/s + Real64 AvgDepth; // average depth of the pool, m + Real64 ActivityFactor; // Activity factor for the pool + Sched::Schedule *activityFactorSched = nullptr; // Activity factor schedule + Real64 CurActivityFactor; // Current activity factor value + Sched::Schedule *makeupWaterSupplySched = nullptr; // schedule for make-up water + Real64 CurMakeupWaterTemp; // Current makeup water temperature + Sched::Schedule *coverSched = nullptr; // pool cover schedule + Real64 CurCoverSchedVal; // Current cover schedule value based on schedule + Real64 CoverEvapFactor; // Pool cover evaporation factor + Real64 CoverConvFactor; // Pool cover convective factor + Real64 CoverSWRadFactor; // Pool cover short-wavelength radiation factor + Real64 CoverLWRadFactor; // Pool cover long-wavelength radiation factor + Real64 CurCoverEvapFac; // Current pool cover evaporation factor + Real64 CurCoverConvFac; // Current pool cover convective factor + Real64 CurCoverSWRadFac; // Current pool cover short-wavelength radiation factor + Real64 CurCoverLWRadFac; // Current pool cover long-wavelength radiation factor + Real64 RadConvertToConvect; // LW and SW radiation converted to convective gain by pool cover in W/m2 + Real64 MiscPowerFactor; // Pool miscellaneous power equipment consumption coefficient in W/(kg/s) + Sched::Schedule *setPtTempSched = nullptr; // Schedule for water setpoint temperature + Real64 CurSetPtTemp; // Current water setpoint temperature + Real64 MaxNumOfPeople; // Number of people in the pool as defined by user input + Sched::Schedule *peopleSched = nullptr; // People schedule + Sched::Schedule *peopleHeatGainSched = nullptr; // People heat gain schedule + Real64 PeopleHeatGain; // Current heat gain from people + Fluid::GlycolProps *glycol = nullptr; + Real64 WaterMass; // pool water mass + Real64 SatPressPoolWaterTemp; // Saturation pressure at the pool water temperature + Real64 PartPressZoneAirTemp; // Partial pressure of water vapor in the air // Report data Real64 PoolWaterTemp; // Average pool water temperature Real64 WaterInletTemp; // water inlet temperature @@ -142,16 +138,14 @@ namespace SwimmingPool { // Default Constructor SwimmingPoolData() : SurfacePtr(0), ZonePtr(0), WaterInletNode(0), WaterOutletNode(0), HWplantLoc{}, WaterVolFlowMax(0.0), WaterMassFlowRateMax(0.0), - AvgDepth(0.0), ActivityFactor(0.0), ActivityFactorSchedPtr(0), CurActivityFactor(0.0), MakeupWaterSupplySchedPtr(0), - CurMakeupWaterTemp(0.0), CoverSchedPtr(0), CurCoverSchedVal(0.0), CoverEvapFactor(0.0), CoverConvFactor(0.0), CoverSWRadFactor(0.0), - CoverLWRadFactor(0.0), CurCoverEvapFac(0.0), CurCoverConvFac(0.0), CurCoverSWRadFac(0.0), CurCoverLWRadFac(0.0), - RadConvertToConvect(0.0), MiscPowerFactor(0.0), SetPtTempSchedPtr(0), CurSetPtTemp(23.0), MaxNumOfPeople(0.0), PeopleSchedPtr(0), - PeopleHeatGainSchedPtr(0), PeopleHeatGain(0.0), GlycolIndex(0), WaterMass(0.0), SatPressPoolWaterTemp(0.0), PartPressZoneAirTemp(0.0), - PoolWaterTemp(23.0), WaterInletTemp(0.0), WaterOutletTemp(0.0), WaterMassFlowRate(0.0), MakeUpWaterMassFlowRate(0.0), - MakeUpWaterMass(0.0), MakeUpWaterVolFlowRate(0.0), MakeUpWaterVol(0.0), HeatPower(0.0), HeatEnergy(0.0), MiscEquipPower(0.0), - MiscEquipEnergy(0.0), RadConvertToConvectRep(0.0), EvapHeatLossRate(0.0), EvapEnergyLoss(0.0), MyOneTimeFlag(true), - MyEnvrnFlagGeneral(true), MyPlantScanFlagPool(true), QPoolSrcAvg(0.0), HeatTransCoefsAvg(0.0), ZeroPoolSourceSumHATsurf(0.0), - LastQPoolSrc(0.0), LastHeatTransCoefs(0.0), LastSysTimeElapsed(0.0), LastTimeStepSys(0.0) + AvgDepth(0.0), ActivityFactor(0.0), CurActivityFactor(0.0), CurMakeupWaterTemp(0.0), CurCoverSchedVal(0.0), CoverEvapFactor(0.0), + CoverConvFactor(0.0), CoverSWRadFactor(0.0), CoverLWRadFactor(0.0), CurCoverEvapFac(0.0), CurCoverConvFac(0.0), CurCoverSWRadFac(0.0), + CurCoverLWRadFac(0.0), RadConvertToConvect(0.0), MiscPowerFactor(0.0), CurSetPtTemp(23.0), MaxNumOfPeople(0.0), PeopleHeatGain(0.0), + WaterMass(0.0), SatPressPoolWaterTemp(0.0), PartPressZoneAirTemp(0.0), PoolWaterTemp(23.0), WaterInletTemp(0.0), WaterOutletTemp(0.0), + WaterMassFlowRate(0.0), MakeUpWaterMassFlowRate(0.0), MakeUpWaterMass(0.0), MakeUpWaterVolFlowRate(0.0), MakeUpWaterVol(0.0), + HeatPower(0.0), HeatEnergy(0.0), MiscEquipPower(0.0), MiscEquipEnergy(0.0), RadConvertToConvectRep(0.0), EvapHeatLossRate(0.0), + EvapEnergyLoss(0.0), MyOneTimeFlag(true), MyEnvrnFlagGeneral(true), MyPlantScanFlagPool(true), QPoolSrcAvg(0.0), HeatTransCoefsAvg(0.0), + ZeroPoolSourceSumHATsurf(0.0), LastQPoolSrc(0.0), LastHeatTransCoefs(0.0), LastSysTimeElapsed(0.0), LastTimeStepSys(0.0) { } @@ -218,6 +212,10 @@ struct SwimmingPoolsData : BaseGlobalStruct bool getSwimmingPoolInput = true; Array1D Pool; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/SystemAvailabilityManager.cc b/src/EnergyPlus/SystemAvailabilityManager.cc index 52f0d52936b..1678a018f80 100644 --- a/src/EnergyPlus/SystemAvailabilityManager.cc +++ b/src/EnergyPlus/SystemAvailabilityManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -52,7 +52,6 @@ // ObjexxFCL Headers #include #include -#include // EnergyPlus Headers #include @@ -107,8 +106,6 @@ namespace Avail { // USE STATEMENTS: // Use statements for data only modules - using namespace ScheduleManager; - static constexpr std::array managerTypeNamesUC = {"AVAILABILITYMANAGER:SCHEDULED", "AVAILABILITYMANAGER:SCHEDULEDON", "AVAILABILITYMANAGER:SCHEDULEDOFF", @@ -425,8 +422,9 @@ namespace Avail { schedMgr.Name = cAlphaArgs(1); schedMgr.type = ManagerType::Scheduled; - schedMgr.SchedPtr = GetScheduleIndex(state, cAlphaArgs(2)); - if (schedMgr.SchedPtr == 0) { + if (lAlphaFieldBlanks(2)) { + ShowSevereEmptyField(state, eoh, cAlphaFieldNames(2)); + } else if ((schedMgr.availSched = Sched::GetSchedule(state, cAlphaArgs(2))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2)); ErrorsFound = true; } @@ -469,8 +467,10 @@ namespace Avail { schedOnMgr.Name = cAlphaArgs(1); schedOnMgr.type = ManagerType::ScheduledOn; - schedOnMgr.SchedPtr = GetScheduleIndex(state, cAlphaArgs(2)); - if (schedOnMgr.SchedPtr == 0) { + if (lAlphaFieldBlanks(2)) { + ShowSevereEmptyField(state, eoh, cAlphaFieldNames(2)); + ErrorsFound = true; + } else if ((schedOnMgr.availSched = Sched::GetSchedule(state, cAlphaArgs(2))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2)); ErrorsFound = true; } @@ -513,8 +513,10 @@ namespace Avail { schedOffMgr.Name = cAlphaArgs(1); schedOffMgr.type = ManagerType::ScheduledOff; - schedOffMgr.SchedPtr = GetScheduleIndex(state, cAlphaArgs(2)); - if (schedOffMgr.SchedPtr == 0) { + if (lAlphaFieldBlanks(2)) { + ShowSevereEmptyField(state, eoh, cAlphaFieldNames(2)); + ErrorsFound = true; + } else if ((schedOffMgr.availSched = Sched::GetSchedule(state, cAlphaArgs(2))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2)); ErrorsFound = true; } @@ -558,17 +560,22 @@ namespace Avail { nightCycleMgr.Name = cAlphaArgs(1); nightCycleMgr.type = ManagerType::NightCycle; nightCycleMgr.TempTolRange = rNumericArgs(1); - CyclingTimeSteps = nint((rNumericArgs(2) / Constant::SecInHour) * double(state.dataGlobal->NumOfTimeStepInHour)); + CyclingTimeSteps = nint((rNumericArgs(2) / Constant::rSecsInHour) * double(state.dataGlobal->TimeStepsInHour)); CyclingTimeSteps = max(1, CyclingTimeSteps); nightCycleMgr.CyclingTimeSteps = CyclingTimeSteps; - nightCycleMgr.SchedPtr = GetScheduleIndex(state, cAlphaArgs(2)); - if (nightCycleMgr.SchedPtr == 0) { + + if (lAlphaFieldBlanks(2)) { + ShowSevereEmptyField(state, eoh, cAlphaFieldNames(2)); + ErrorsFound = true; + } else if ((nightCycleMgr.availSched = Sched::GetSchedule(state, cAlphaArgs(2))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2)); ErrorsFound = true; } - nightCycleMgr.FanSched = cAlphaArgs(3); - nightCycleMgr.FanSchedPtr = GetScheduleIndex(state, cAlphaArgs(3)); - if (nightCycleMgr.FanSchedPtr == 0) { + + if (lAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, cAlphaFieldNames(3)); + ErrorsFound = true; + } else if ((nightCycleMgr.fanSched = Sched::GetSchedule(state, cAlphaArgs(3))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(3), cAlphaArgs(3)); ErrorsFound = true; } @@ -719,14 +726,19 @@ namespace Avail { auto &optimumStartMgr = state.dataAvail->OptimumStartData(SysAvailNum); optimumStartMgr.Name = cAlphaArgs(1); optimumStartMgr.type = ManagerType::OptimumStart; - optimumStartMgr.SchedPtr = GetScheduleIndex(state, cAlphaArgs(2)); - if (optimumStartMgr.SchedPtr == 0) { + + if (lAlphaFieldBlanks(2)) { + ShowSevereEmptyField(state, eoh, cAlphaFieldNames(2)); + ErrorsFound = true; + } else if ((optimumStartMgr.availSched = Sched::GetSchedule(state, cAlphaArgs(2))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2)); ErrorsFound = true; } - optimumStartMgr.FanSched = cAlphaArgs(3); - optimumStartMgr.FanSchedPtr = GetScheduleIndex(state, cAlphaArgs(3)); - if (optimumStartMgr.FanSchedPtr == 0) { + + if (lAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, cAlphaFieldNames(3)); + ErrorsFound = true; + } else if ((optimumStartMgr.fanSched = Sched::GetSchedule(state, cAlphaArgs(3))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(3), cAlphaArgs(3)); ErrorsFound = true; } @@ -1049,14 +1061,10 @@ namespace Avail { loTurnOffMgr.Temp = rNumericArgs(1); - if (!lAlphaFieldBlanks(3)) { - loTurnOffMgr.SchedPtr = GetScheduleIndex(state, cAlphaArgs(3)); - if (loTurnOffMgr.SchedPtr == 0) { - ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(3), cAlphaArgs(3)); - ErrorsFound = true; - } - } else { - loTurnOffMgr.SchedPtr = 0; + if (lAlphaFieldBlanks(3)) { + } else if ((loTurnOffMgr.availSched = Sched::GetSchedule(state, cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(3), cAlphaArgs(3)); + ErrorsFound = true; } SetupOutputVariable(state, @@ -1151,23 +1159,30 @@ namespace Avail { nightVentMgr.Name = cAlphaArgs(1); nightVentMgr.type = ManagerType::NightVent; - nightVentMgr.SchedPtr = GetScheduleIndex(state, cAlphaArgs(2)); - if (nightVentMgr.SchedPtr == 0) { + if (lAlphaFieldBlanks(2)) { + ShowSevereEmptyField(state, eoh, cAlphaFieldNames(2)); + ErrorsFound = true; + } else if ((nightVentMgr.availSched = Sched::GetSchedule(state, cAlphaArgs(2))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2)); ErrorsFound = true; } - nightVentMgr.FanSched = cAlphaArgs(3); - nightVentMgr.FanSchedPtr = GetScheduleIndex(state, cAlphaArgs(3)); - if (nightVentMgr.FanSchedPtr == 0) { + + if (lAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, cAlphaFieldNames(3)); + ErrorsFound = true; + } else if ((nightVentMgr.fanSched = Sched::GetSchedule(state, cAlphaArgs(3))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(3), cAlphaArgs(3)); ErrorsFound = true; } - nightVentMgr.VentTempSched = cAlphaArgs(4); - nightVentMgr.VentTempSchedPtr = GetScheduleIndex(state, cAlphaArgs(4)); - if (nightVentMgr.VentTempSchedPtr == 0) { + + if (lAlphaFieldBlanks(4)) { + ShowSevereEmptyField(state, eoh, cAlphaFieldNames(4)); + ErrorsFound = true; + } else if ((nightVentMgr.ventTempSched = Sched::GetSchedule(state, cAlphaArgs(4))) == nullptr) { ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(4), cAlphaArgs(4)); ErrorsFound = true; } + nightVentMgr.VentDelT = rNumericArgs(1); nightVentMgr.VentTempLowLim = rNumericArgs(2); nightVentMgr.VentFlowFrac = rNumericArgs(3); @@ -1747,7 +1762,7 @@ namespace Avail { // AvailStatus indicator accordingly. Mostly a useless algorithm // since the fan schedules can do the same thing. auto &availMgr = state.dataAvail->SchedData(SysAvailNum); - availMgr.availStatus = (GetCurrentScheduleValue(state, availMgr.SchedPtr) > 0.0) ? Status::CycleOn : Status::ForceOff; + availMgr.availStatus = (availMgr.availSched->getCurrentVal() > 0.0) ? Status::CycleOn : Status::ForceOff; return availMgr.availStatus; } @@ -1770,7 +1785,7 @@ namespace Avail { // AvailStatus indicator accordingly. If the schedule value is > 0 // the availability status is Status::CycleOn, ELSE the status is Status::NoAction. auto &availMgr = state.dataAvail->SchedOnData(SysAvailNum); - availMgr.availStatus = (GetCurrentScheduleValue(state, availMgr.SchedPtr) > 0.0) ? Status::CycleOn : Status::NoAction; + availMgr.availStatus = (availMgr.availSched->getCurrentVal() > 0.0) ? Status::CycleOn : Status::NoAction; return availMgr.availStatus; } @@ -1793,7 +1808,7 @@ namespace Avail { // AvailStatus indicator accordingly. If the schedule value is = 0 // the availability status is Status::ForceOff, ELSE the status is Status::NoAction. auto &availMgr = state.dataAvail->SchedOffData(SysAvailNum); - availMgr.availStatus = (GetCurrentScheduleValue(state, availMgr.SchedPtr) == 0.0) ? Status::ForceOff : Status::NoAction; + availMgr.availStatus = (availMgr.availSched->getCurrentVal() == 0.0) ? Status::ForceOff : Status::NoAction; return availMgr.availStatus; } @@ -1856,7 +1871,7 @@ namespace Avail { // CR 7913 changed to allow during warmup auto &nightCycleMgr = state.dataAvail->NightCycleData(SysAvailNum); - if ((GetCurrentScheduleValue(state, nightCycleMgr.SchedPtr) <= 0.0) || (GetCurrentScheduleValue(state, nightCycleMgr.FanSchedPtr) > 0.0)) { + if ((nightCycleMgr.availSched->getCurrentVal() <= 0.0) || (nightCycleMgr.fanSched->getCurrentVal() > 0.0)) { return nightCycleMgr.availStatus = Status::NoAction; // CR 8358 } @@ -1883,38 +1898,38 @@ namespace Avail { int ZoneNum = nightCycleMgr.CtrlZonePtrs(1); + auto const &zoneTstatSetpt = state.dataHeatBalFanSys->zoneTstatSetpts(ZoneNum); + switch (state.dataHeatBalFanSys->TempControlType(ZoneNum)) { // select on thermostat control - case HVAC::ThermostatType::SingleHeating: { - if (state.dataHeatBalFanSys->TempTstatAir(ZoneNum) < state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ZoneNum) - TempTol) { + case HVAC::SetptType::SingleHeat: { + if (state.dataHeatBalFanSys->TempTstatAir(ZoneNum) < zoneTstatSetpt.setpt - TempTol) { availStatus = Status::CycleOn; } else { availStatus = Status::NoAction; } } break; - case HVAC::ThermostatType::SingleCooling: { - if (state.dataHeatBalFanSys->TempTstatAir(ZoneNum) > state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ZoneNum) + TempTol) { + case HVAC::SetptType::SingleCool: { + if (state.dataHeatBalFanSys->TempTstatAir(ZoneNum) > zoneTstatSetpt.setpt + TempTol) { availStatus = Status::CycleOn; } else { availStatus = Status::NoAction; } } break; - case HVAC::ThermostatType::SingleHeatCool: { - if ((state.dataHeatBalFanSys->TempTstatAir(ZoneNum) < - state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ZoneNum) - TempTol) || - (state.dataHeatBalFanSys->TempTstatAir(ZoneNum) > - state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ZoneNum) + TempTol)) { + case HVAC::SetptType::SingleHeatCool: { + if ((state.dataHeatBalFanSys->TempTstatAir(ZoneNum) < zoneTstatSetpt.setpt - TempTol) || + (state.dataHeatBalFanSys->TempTstatAir(ZoneNum) > zoneTstatSetpt.setpt + TempTol)) { availStatus = Status::CycleOn; } else { availStatus = Status::NoAction; } } break; - case HVAC::ThermostatType::DualSetPointWithDeadBand: { - if ((state.dataHeatBalFanSys->TempTstatAir(ZoneNum) < state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ZoneNum) - TempTol) || - (state.dataHeatBalFanSys->TempTstatAir(ZoneNum) > state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ZoneNum) + TempTol)) { + case HVAC::SetptType::DualHeatCool: { + if ((state.dataHeatBalFanSys->TempTstatAir(ZoneNum) < zoneTstatSetpt.setptLo - TempTol) || + (state.dataHeatBalFanSys->TempTstatAir(ZoneNum) > zoneTstatSetpt.setptHi + TempTol)) { availStatus = Status::CycleOn; } else { availStatus = Status::NoAction; @@ -1980,39 +1995,34 @@ namespace Avail { ++ZoneInSysNum) { // loop over zones in system int ZoneNum = state.dataAirLoop->AirToZoneNodeInfo(PriAirSysNum).CoolCtrlZoneNums(ZoneInSysNum); + auto const &zoneTstatSetpt = state.dataHeatBalFanSys->zoneTstatSetpts(ZoneNum); switch (state.dataHeatBalFanSys->TempControlType(ZoneNum)) { - case HVAC::ThermostatType::SingleHeating: { - if (state.dataHeatBalFanSys->TempTstatAir(ZoneNum) < - state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ZoneNum) - TempTol) { + case HVAC::SetptType::SingleHeat: { + if (state.dataHeatBalFanSys->TempTstatAir(ZoneNum) < zoneTstatSetpt.setpt - TempTol) { availStatus = Status::CycleOn; } else { availStatus = Status::NoAction; } } break; - case HVAC::ThermostatType::SingleCooling: { - if (state.dataHeatBalFanSys->TempTstatAir(ZoneNum) > - state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ZoneNum) + TempTol) { + case HVAC::SetptType::SingleCool: { + if (state.dataHeatBalFanSys->TempTstatAir(ZoneNum) > zoneTstatSetpt.setpt + TempTol) { availStatus = Status::CycleOn; } else { availStatus = Status::NoAction; } } break; - case HVAC::ThermostatType::SingleHeatCool: { - if ((state.dataHeatBalFanSys->TempTstatAir(ZoneNum) < - state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ZoneNum) - TempTol) || - (state.dataHeatBalFanSys->TempTstatAir(ZoneNum) > - state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ZoneNum) + TempTol)) { + case HVAC::SetptType::SingleHeatCool: { + if ((state.dataHeatBalFanSys->TempTstatAir(ZoneNum) < zoneTstatSetpt.setpt - TempTol) || + (state.dataHeatBalFanSys->TempTstatAir(ZoneNum) > zoneTstatSetpt.setpt + TempTol)) { availStatus = Status::CycleOn; } else { availStatus = Status::NoAction; } } break; - case HVAC::ThermostatType::DualSetPointWithDeadBand: { - if ((state.dataHeatBalFanSys->TempTstatAir(ZoneNum) < - state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ZoneNum) - TempTol) || - (state.dataHeatBalFanSys->TempTstatAir(ZoneNum) > - state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ZoneNum) + TempTol)) { + case HVAC::SetptType::DualHeatCool: { + if ((state.dataHeatBalFanSys->TempTstatAir(ZoneNum) < zoneTstatSetpt.setptLo - TempTol) || + (state.dataHeatBalFanSys->TempTstatAir(ZoneNum) > zoneTstatSetpt.setptHi + TempTol)) { availStatus = Status::CycleOn; } else { availStatus = Status::NoAction; @@ -2100,19 +2110,21 @@ namespace Avail { Real64 const TempTolerance // temperature tolerance ) { + // Check if any zone temperature is above the cooling setpoint plus tolerance for (int Index = 1; Index <= NumZones; ++Index) { // loop over zones in list int ZoneNum = ZonePtrList(Index); + auto const &zoneTstatSetpt = state.dataHeatBalFanSys->zoneTstatSetpts(ZoneNum); switch (state.dataHeatBalFanSys->TempControlType(ZoneNum)) { - case HVAC::ThermostatType::SingleCooling: - case HVAC::ThermostatType::SingleHeatCool: - if (state.dataHeatBalFanSys->TempTstatAir(ZoneNum) > state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ZoneNum) + TempTolerance) { + case HVAC::SetptType::SingleCool: + case HVAC::SetptType::SingleHeatCool: + if (state.dataHeatBalFanSys->TempTstatAir(ZoneNum) > zoneTstatSetpt.setpt + TempTolerance) { return true; // return on the first zone found } break; - case HVAC::ThermostatType::DualSetPointWithDeadBand: - if (state.dataHeatBalFanSys->TempTstatAir(ZoneNum) > state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ZoneNum) + TempTolerance) { + case HVAC::SetptType::DualHeatCool: + if (state.dataHeatBalFanSys->TempTstatAir(ZoneNum) > zoneTstatSetpt.setptHi + TempTolerance) { return true; // return on the first zone found } break; @@ -2132,16 +2144,17 @@ namespace Avail { // Check if any zone temperature is below the heating setpoint less tolerance for (int Index = 1; Index <= NumZones; ++Index) { // loop over zones in list int ZoneNum = ZonePtrList(Index); - { - HVAC::ThermostatType const tstatType(state.dataHeatBalFanSys->TempControlType(ZoneNum)); + { // Why is this a new scope? + auto const &zoneTstatSetpt = state.dataHeatBalFanSys->zoneTstatSetpts(ZoneNum); + + HVAC::SetptType const tstatType(state.dataHeatBalFanSys->TempControlType(ZoneNum)); - if ((tstatType == HVAC::ThermostatType::SingleHeating) || (tstatType == HVAC::ThermostatType::SingleHeatCool)) { - if (state.dataHeatBalFanSys->TempTstatAir(ZoneNum) < - state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ZoneNum) - TempTolerance) { + if ((tstatType == HVAC::SetptType::SingleHeat) || (tstatType == HVAC::SetptType::SingleHeatCool)) { + if (state.dataHeatBalFanSys->TempTstatAir(ZoneNum) < zoneTstatSetpt.setpt - TempTolerance) { return true; // return on the first zone found } - } else if (tstatType == HVAC::ThermostatType::DualSetPointWithDeadBand) { - if (state.dataHeatBalFanSys->TempTstatAir(ZoneNum) < state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ZoneNum) - TempTolerance) { + } else if (tstatType == HVAC::SetptType::DualHeatCool) { + if (state.dataHeatBalFanSys->TempTstatAir(ZoneNum) < zoneTstatSetpt.setptLo - TempTolerance) { return true; // return on the first zone found } } @@ -2176,7 +2189,6 @@ namespace Avail { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int ScheduleIndex; Array2D DayValues; Array2D DayValuesTmr; int JDay; @@ -2260,13 +2272,12 @@ namespace Avail { if (state.dataGlobal->KickOffSimulation) { availStatus = Status::NoAction; } else { - ScheduleIndex = GetScheduleIndex(state, OptStartMgr.FanSched); JDay = state.dataEnvrn->DayOfYear; TmrJDay = JDay + 1; TmrDayOfWeek = state.dataEnvrn->DayOfWeekTomorrow; - DayValues.allocate(state.dataGlobal->NumOfTimeStepInHour, 24); - DayValuesTmr.allocate(state.dataGlobal->NumOfTimeStepInHour, 24); + DayValues.allocate(state.dataGlobal->TimeStepsInHour, Constant::iHoursInDay); + DayValuesTmr.allocate(state.dataGlobal->TimeStepsInHour, Constant::iHoursInDay); if (!allocated(state.dataAvail->OptStart)) { state.dataAvail->OptStart.allocate(state.dataGlobal->NumOfZones); } @@ -2286,16 +2297,16 @@ namespace Avail { } if (!state.dataGlobal->BeginDayFlag) state.dataAvail->BeginOfDayResetFlag = true; - GetScheduleValuesForDay(state, ScheduleIndex, DayValues); - GetScheduleValuesForDay(state, ScheduleIndex, DayValuesTmr, TmrJDay, TmrDayOfWeek); + std::vector const &dayVals = OptStartMgr.fanSched->getDayVals(state); + std::vector const &tmwDayVals = OptStartMgr.fanSched->getDayVals(state, TmrJDay, TmrDayOfWeek); FanStartTime = 0.0; FanStartTimeTmr = 0.0; exitLoop = false; - for (int I = 1; I <= 24; ++I) { - for (int J = 1; J <= state.dataGlobal->NumOfTimeStepInHour; ++J) { - if (DayValues(J, I) <= 0.0) continue; - FanStartTime = I - 1 + 1.0 / state.dataGlobal->NumOfTimeStepInHour * J - 0.01; + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) { + for (int ts = 0; ts <= state.dataGlobal->TimeStepsInHour; ++ts) { + if (dayVals[hr * state.dataGlobal->TimeStepsInHour + ts] <= 0.0) continue; + FanStartTime = hr + (1.0 / state.dataGlobal->TimeStepsInHour) * (ts + 1) - 0.01; exitLoop = true; break; } @@ -2303,10 +2314,10 @@ namespace Avail { } exitLoop = false; - for (int I = 1; I <= 24; ++I) { - for (int J = 1; J <= state.dataGlobal->NumOfTimeStepInHour; ++J) { - if (DayValuesTmr(J, I) <= 0.0) continue; - FanStartTimeTmr = I - 1 + 1.0 / state.dataGlobal->NumOfTimeStepInHour * J - 0.01; + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) { + for (int ts = 0; ts < state.dataGlobal->TimeStepsInHour; ++ts) { + if (tmwDayVals[hr * state.dataGlobal->TimeStepsInHour + ts] <= 0.0) continue; + FanStartTimeTmr = hr + (1.0 / state.dataGlobal->TimeStepsInHour) * (ts + 1) - 0.01; exitLoop = true; break; } @@ -2389,8 +2400,7 @@ namespace Avail { case ControlAlgorithm::ConstantTemperatureGradient: { if (OptStartMgr.optimumStartControlType == OptimumStartControlType::ControlZone) { ZoneNum = OptStartMgr.ZoneNum; - if ((!allocated(state.dataHeatBalFanSys->TempTstatAir)) || (!allocated(state.dataHeatBalFanSys->ZoneThermostatSetPointLo)) || - (!allocated(state.dataHeatBalFanSys->ZoneThermostatSetPointHi))) { + if (!allocated(state.dataHeatBalFanSys->TempTstatAir) || !allocated(state.dataHeatBalFanSys->zoneTstatSetpts)) { TempDiff = 0.0; } else { if (!CycleOnFlag) { @@ -2537,8 +2547,7 @@ namespace Avail { } else if (OptStartMgr.optimumStartControlType == OptimumStartControlType::MaximumOfZoneList) { NumOfZonesInList = OptStartMgr.NumOfZones; - if ((!allocated(state.dataHeatBalFanSys->TempTstatAir)) || (!allocated(state.dataHeatBalFanSys->ZoneThermostatSetPointLo)) || - (!allocated(state.dataHeatBalFanSys->ZoneThermostatSetPointHi))) { + if (!allocated(state.dataHeatBalFanSys->TempTstatAir) || !allocated(state.dataHeatBalFanSys->zoneTstatSetpts)) { TempDiff = 0.0; } else { if (!CycleOnFlag) { @@ -2699,8 +2708,7 @@ namespace Avail { if (OptStartMgr.optimumStartControlType == OptimumStartControlType::ControlZone) { ZoneNum = OptStartMgr.ZoneNum; - if ((!allocated(state.dataHeatBalFanSys->TempTstatAir)) || (!allocated(state.dataHeatBalFanSys->ZoneThermostatSetPointLo)) || - (!allocated(state.dataHeatBalFanSys->ZoneThermostatSetPointHi))) { + if (!allocated(state.dataHeatBalFanSys->TempTstatAir) || !allocated(state.dataHeatBalFanSys->zoneTstatSetpts)) { TempDiff = 0.0; } else { if (!CycleOnFlag) { @@ -2787,7 +2795,7 @@ namespace Avail { (ATGUpdateTemp2 - ATGUpdateTemp1) / (ATGUpdateTime2 - ATGUpdateTime1); } else { state.dataAvail->OptStart_AdaTempGradTrdHeat(NumPreDays) = - (ATGUpdateTemp2 - ATGUpdateTemp1) * state.dataGlobal->NumOfTimeStepInHour; + (ATGUpdateTemp2 - ATGUpdateTemp1) * state.dataGlobal->TimeStepsInHour; } } } @@ -2835,7 +2843,7 @@ namespace Avail { (ATGUpdateTemp2 - ATGUpdateTemp1) / (ATGUpdateTime2 - ATGUpdateTime1 + 24.0); } else { state.dataAvail->OptStart_AdaTempGradTrdHeat(NumPreDays) = - (ATGUpdateTemp2 - ATGUpdateTemp1) * state.dataGlobal->NumOfTimeStepInHour; + (ATGUpdateTemp2 - ATGUpdateTemp1) * state.dataGlobal->TimeStepsInHour; } } } @@ -2903,7 +2911,7 @@ namespace Avail { (ATGUpdateTemp1 - ATGUpdateTemp2) / (ATGUpdateTime2 - ATGUpdateTime1); } else { state.dataAvail->OptStart_AdaTempGradTrdCool(NumPreDays) = - (ATGUpdateTemp1 - ATGUpdateTemp2) * state.dataGlobal->NumOfTimeStepInHour; + (ATGUpdateTemp1 - ATGUpdateTemp2) * state.dataGlobal->TimeStepsInHour; } } } @@ -2942,7 +2950,7 @@ namespace Avail { (ATGUpdateTemp1 - ATGUpdateTemp2) / (ATGUpdateTime2 - ATGUpdateTime1 + 24.0); } else { state.dataAvail->OptStart_AdaTempGradTrdCool(NumPreDays) = - (ATGUpdateTemp1 - ATGUpdateTemp2) * state.dataGlobal->NumOfTimeStepInHour; + (ATGUpdateTemp1 - ATGUpdateTemp2) * state.dataGlobal->TimeStepsInHour; } } } @@ -2972,8 +2980,7 @@ namespace Avail { NumOfZonesInList = OptStartMgr.NumOfZones; ATGWCZoneNumHi = OptStartMgr.ZonePtrs(1); ATGWCZoneNumLo = OptStartMgr.ZonePtrs(1); - if ((!allocated(state.dataHeatBalFanSys->TempTstatAir)) || (!allocated(state.dataHeatBalFanSys->ZoneThermostatSetPointLo)) || - (!allocated(state.dataHeatBalFanSys->ZoneThermostatSetPointHi))) { + if (!allocated(state.dataHeatBalFanSys->TempTstatAir) || !allocated(state.dataHeatBalFanSys->zoneTstatSetpts)) { TempDiff = 0.0; } else { if (!CycleOnFlag) { @@ -3077,7 +3084,7 @@ namespace Avail { (ATGUpdateTemp2 - ATGUpdateTemp1) / (ATGUpdateTime2 - ATGUpdateTime1); } else { state.dataAvail->OptStart_AdaTempGradTrdHeat(NumPreDays) = - (ATGUpdateTemp2 - ATGUpdateTemp1) * state.dataGlobal->NumOfTimeStepInHour; + (ATGUpdateTemp2 - ATGUpdateTemp1) * state.dataGlobal->TimeStepsInHour; } } } @@ -3123,7 +3130,7 @@ namespace Avail { (ATGUpdateTemp2 - ATGUpdateTemp1) / (ATGUpdateTime2 - ATGUpdateTime1 + 24.0); } else { state.dataAvail->OptStart_AdaTempGradTrdHeat(NumPreDays) = - (ATGUpdateTemp2 - ATGUpdateTemp1) * state.dataGlobal->NumOfTimeStepInHour; + (ATGUpdateTemp2 - ATGUpdateTemp1) * state.dataGlobal->TimeStepsInHour; } } } @@ -3192,7 +3199,7 @@ namespace Avail { (ATGUpdateTemp1 - ATGUpdateTemp2) / (ATGUpdateTime2 - ATGUpdateTime1); } else { state.dataAvail->OptStart_AdaTempGradTrdCool(NumPreDays) = - (ATGUpdateTemp1 - ATGUpdateTemp2) * state.dataGlobal->NumOfTimeStepInHour; + (ATGUpdateTemp1 - ATGUpdateTemp2) * state.dataGlobal->TimeStepsInHour; } } } @@ -3239,7 +3246,7 @@ namespace Avail { (ATGUpdateTemp1 - ATGUpdateTemp2) / (ATGUpdateTime2 - ATGUpdateTime1 + 24.0); } else { state.dataAvail->OptStart_AdaTempGradTrdCool(NumPreDays) = - (ATGUpdateTemp1 - ATGUpdateTemp2) * state.dataGlobal->NumOfTimeStepInHour; + (ATGUpdateTemp1 - ATGUpdateTemp2) * state.dataGlobal->TimeStepsInHour; } } } @@ -3355,11 +3362,11 @@ namespace Avail { // check if night venting allowed: not allowed if avail sched is off or fan sched is on // CR 7913 changed to allow during warmup auto &nightVentMgr = state.dataAvail->NightVentData(SysAvailNum); - if ((GetCurrentScheduleValue(state, nightVentMgr.SchedPtr) <= 0.0) || (GetCurrentScheduleValue(state, nightVentMgr.FanSchedPtr) > 0.0)) { + if ((nightVentMgr.availSched->getCurrentVal() <= 0.0) || (nightVentMgr.fanSched->getCurrentVal() > 0.0)) { availStatus = Status::NoAction; } else { - VentTemp = GetCurrentScheduleValue(state, nightVentMgr.VentTempSchedPtr); + VentTemp = nightVentMgr.ventTempSched->getCurrentVal(); int ControlZoneNum = nightVentMgr.ZoneNum; if (isZoneEquipType) { @@ -3513,8 +3520,8 @@ namespace Avail { Status availStatus; // If applicability schedule is off, then availability manager is inactive, return no action auto &loTurnOffMgr = state.dataAvail->LoTurnOffData(SysAvailNum); - if (loTurnOffMgr.SchedPtr > 0) { - if (GetCurrentScheduleValue(state, loTurnOffMgr.SchedPtr) <= 0.0) { + if (loTurnOffMgr.availSched != nullptr) { + if (loTurnOffMgr.availSched->getCurrentVal() <= 0.0) { availStatus = Status::NoAction; loTurnOffMgr.availStatus = availStatus; return availStatus; @@ -3680,44 +3687,53 @@ namespace Avail { ErrorsFound = true; } - hybridVentMgr.ControlModeSchedPtr = GetScheduleIndex(state, ipsc->cAlphaArgs(4)); - if (hybridVentMgr.ControlModeSchedPtr == 0) { + if (ipsc->lAlphaFieldBlanks(4)) { + ShowSevereEmptyField(state, eoh, ipsc->cAlphaFieldNames(4)); + ErrorsFound = true; + } else if ((hybridVentMgr.controlModeSched = Sched::GetSchedule(state, ipsc->cAlphaArgs(4))) == nullptr) { ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(4), ipsc->cAlphaArgs(4)); ErrorsFound = true; } // Check schedule values - SchedMin = GetScheduleMinValue(state, hybridVentMgr.ControlModeSchedPtr); - SchedMax = GetScheduleMaxValue(state, hybridVentMgr.ControlModeSchedPtr); + SchedMin = hybridVentMgr.controlModeSched->getMinVal(state); + SchedMax = hybridVentMgr.controlModeSched->getMaxVal(state); if (SchedMin == 0 && SchedMax == 0) { - ShowWarningError(state, format("{}{}=\"{}\"", RoutineName, cCurrentModuleObject, ipsc->cAlphaArgs(1))); - ShowContinueError(state, - format("{}=\"{}\" specifies control mode 0 for all entries.", ipsc->cAlphaFieldNames(4), ipsc->cAlphaArgs(4))); - ShowContinueError(state, format("All zones using this {} have no hybrid ventilation control.", ipsc->cAlphaFieldNames(4))); + ShowWarningCustomField(state, + eoh, + ipsc->cAlphaFieldNames(4), + ipsc->cAlphaArgs(4), + "Schedule specifies control mode 0 for all entries, " + "All zones using this schedule have no hybrid ventilation control."); } if (SchedMax > 7.0) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, cCurrentModuleObject, ipsc->cAlphaArgs(1))); - ShowContinueError( - state, format("{}=\"{}\", the maximum schedule value should be 7. However, ", ipsc->cAlphaFieldNames(4), ipsc->cAlphaArgs(4))); - ShowContinueError(state, format("the maximum entered value in the schedule is {:.1T}", SchedMax)); + ShowSevereCustomField(state, + eoh, + ipsc->cAlphaFieldNames(4), + ipsc->cAlphaArgs(4), + format("Maximum value should be 7. However, the maximum value in the schedule is {:.1T}", SchedMax)); ErrorsFound = true; } + if (SchedMin < 0.0) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, cCurrentModuleObject, ipsc->cAlphaArgs(1))); - ShowContinueError(state, - format("{}=\"{}the minimum schedule value should be 0. However, ", ipsc->cAlphaFieldNames(4), ipsc->cAlphaArgs(4))); - ShowContinueError(state, format("the minimum entered value in the schedule is {:.1T}", SchedMin)); + ShowSevereCustomField(state, + eoh, + ipsc->cAlphaFieldNames(4), + ipsc->cAlphaArgs(4), + format("Minimum value should be 0. However, the minimum value in the schedule is {:.1T}", SchedMin)); ErrorsFound = true; } + if (SchedMax == 7.0 && !state.dataContaminantBalance->Contaminant.CO2Simulation) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, cCurrentModuleObject, ipsc->cAlphaArgs(1))); - ShowContinueError(state, - format("{}=\"{}\", When the schedule value is 7, carbon dioxide (CO2) control is requested. ", - ipsc->cAlphaFieldNames(4), - ipsc->cAlphaArgs(4))); - ShowContinueError(state, "However, CO2 simulation is not enabled. Please use ZoneAirContaminantBalance object to simulate CO2."); + ShowSevereCustomField(state, + eoh, + ipsc->cAlphaFieldNames(4), + ipsc->cAlphaArgs(4), + "When the schedule value is 7, carbon dioxide (CO2) control is requested." + "However, CO2 simulation is not enabled. Please use ZoneAirContaminantBalance object to simulate CO2."); ErrorsFound = true; } + // Read use weather rain indicator BooleanSwitch b = static_cast(getYesNoValue(ipsc->cAlphaArgs(5))); if (b == BooleanSwitch::Invalid) { @@ -3856,22 +3872,14 @@ namespace Avail { ErrorsFound = true; } - hybridVentMgr.MinOASched = ipsc->cAlphaArgs(6); - hybridVentMgr.MinOASchedPtr = GetScheduleIndex(state, ipsc->cAlphaArgs(6)); - if (hybridVentMgr.MinOASchedPtr == 0) { + if (ipsc->lAlphaFieldBlanks(6)) { + ShowSevereEmptyField(state, eoh, ipsc->cAlphaFieldNames(6)); + ErrorsFound = true; + } else if ((hybridVentMgr.minOASched = Sched::GetSchedule(state, ipsc->cAlphaArgs(6))) == nullptr) { ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(6), ipsc->cAlphaArgs(6)); ErrorsFound = true; - } - SchedMin = GetScheduleMinValue(state, hybridVentMgr.MinOASchedPtr); - if (SchedMin < 0.0) { - ShowSevereError(state, - format(R"({}{}="{}", Schedule value must be >= 0 in {}="{}".)", - RoutineName, - cCurrentModuleObject, - ipsc->cAlphaArgs(1), - ipsc->cAlphaFieldNames(6), - ipsc->cAlphaArgs(6))); - ShowContinueError(state, format("The minimum schedule value is {:.1T}", SchedMin)); + } else if (!hybridVentMgr.minOASched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, ipsc->cAlphaFieldNames(6), ipsc->cAlphaArgs(6), Clusive::In, 0.0); ErrorsFound = true; } @@ -3922,109 +3930,89 @@ namespace Avail { } } - hybridVentMgr.ANControlTypeSchedPtr = GetScheduleIndex(state, ipsc->cAlphaArgs(8)); - if (hybridVentMgr.ANControlTypeSchedPtr > 0) { + if (ipsc->lAlphaFieldBlanks(8)) { + } else if ((hybridVentMgr.afnControlTypeSched = Sched::GetSchedule(state, ipsc->cAlphaArgs(8))) == nullptr) { + ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(8), ipsc->cAlphaArgs(8)); + ErrorsFound = true; + } else if (!hybridVentMgr.afnControlTypeSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, ipsc->cAlphaFieldNames(8), ipsc->cAlphaArgs(8), Clusive::In, 0.0, Clusive::In, 1.0); + ErrorsFound = true; + } else { hybridVentMgr.Master = hybridVentMgr.ControlledZoneNum; - // Check schedule values - SchedMin = GetScheduleMinValue(state, hybridVentMgr.ANControlTypeSchedPtr); - SchedMax = GetScheduleMaxValue(state, hybridVentMgr.ANControlTypeSchedPtr); - hybridVentMgr.ANCtrlStatus = hybridVentMgr.ANControlTypeSchedPtr; - if (SchedMax > 1.0) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, cCurrentModuleObject, ipsc->cAlphaArgs(1))); - ShowContinueError(state, format(" For {}=\"{}\",", ipsc->cAlphaFieldNames(8), ipsc->cAlphaArgs(8))); - ShowContinueError(state, "the maximum schedule value should be 1. However, "); - ShowContinueError(state, format("the maximum entered value in the schedule is {:.1T}", SchedMax)); - ErrorsFound = true; - } - if (SchedMin < 0.0) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, cCurrentModuleObject, ipsc->cAlphaArgs(1))); - ShowContinueError(state, format("For {}=\"{}\",", ipsc->cAlphaFieldNames(8), ipsc->cAlphaArgs(8))); - ShowContinueError(state, "the minimum schedule value should be 0. However, "); - ShowContinueError(state, format("the minimum entered value in the schedule is {:.1T}", SchedMin)); - ErrorsFound = true; - } + hybridVentMgr.afnControlStatus = hybridVentMgr.afnControlTypeSched->getCurrentVal(); // this was ANControlTypeSchedPtr!! } - hybridVentMgr.SimpleControlTypeSchedPtr = GetScheduleIndex(state, ipsc->cAlphaArgs(9)); - if (hybridVentMgr.SimpleControlTypeSchedPtr > 0 && hybridVentMgr.ANControlTypeSchedPtr > 0) { - ShowWarningError(state, format("{}{}=\"{}\"", RoutineName, cCurrentModuleObject, ipsc->cAlphaArgs(1))); - ShowContinueError(state, format("The inputs for{} and {} are valid.", ipsc->cAlphaFieldNames(8), ipsc->cAlphaFieldNames(9))); - ShowContinueError(state, "But both objects cannot work at the same time. The Simple Airflow Control is disabled"); - hybridVentMgr.SimpleControlTypeSchedPtr = 0; - } else if (hybridVentMgr.SimpleControlTypeSchedPtr > 0) { - // Check schedule values - SchedMin = GetScheduleMinValue(state, hybridVentMgr.SimpleControlTypeSchedPtr); - SchedMax = GetScheduleMaxValue(state, hybridVentMgr.SimpleControlTypeSchedPtr); - if (SchedMax > 1.0) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, cCurrentModuleObject, ipsc->cAlphaArgs(1))); - ShowContinueError(state, format("For {}=\"{}\",", ipsc->cAlphaFieldNames(9), ipsc->cAlphaArgs(9))); - ShowContinueError(state, "the maximum schedule value should be 1. However, "); - ShowContinueError(state, format("the maximum entered value in the schedule is {:.1T}", SchedMax)); - ErrorsFound = true; - } - if (SchedMin < 0.0) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, cCurrentModuleObject, ipsc->cAlphaArgs(1))); - ShowContinueError(state, format("For {}=\"{}\",", ipsc->cAlphaFieldNames(9), ipsc->cAlphaArgs(9))); - ShowContinueError(state, "the minimum schedule value should be 0. However, "); - ShowContinueError(state, format("the minimum entered value in the schedule is {:.1T}", SchedMin)); - ErrorsFound = true; - } + if (ipsc->lAlphaFieldBlanks(9)) { + } else if ((hybridVentMgr.simpleControlTypeSched = Sched::GetSchedule(state, ipsc->cAlphaArgs(9))) == nullptr) { + ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(9), ipsc->cAlphaArgs(9)); + ErrorsFound = true; + } else if (hybridVentMgr.afnControlTypeSched != nullptr) { + ShowWarningCustom(state, + eoh, + format("{} and {} cannot be used at the same time, {} is disabled.", + ipsc->cAlphaFieldNames(8), + ipsc->cAlphaFieldNames(9), + ipsc->cAlphaFieldNames(9))); + hybridVentMgr.simpleControlTypeSched = nullptr; + } else if (!hybridVentMgr.simpleControlTypeSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, ipsc->cAlphaFieldNames(9), ipsc->cAlphaArgs(9), Clusive::In, 0.0, Clusive::In, 1.0); + ErrorsFound = true; } - if (hybridVentMgr.SimpleControlTypeSchedPtr > 0) { + if (hybridVentMgr.simpleControlTypeSched != nullptr) { + hybridVentMgr.VentilationName = ipsc->cAlphaArgs(10); if (state.dataHeatBal->TotVentilation > 0) { hybridVentMgr.VentilationPtr = Util::FindItemInList(ipsc->cAlphaArgs(10), state.dataHeatBal->Ventilation); hybridVentMgr.Master = hybridVentMgr.VentilationPtr; - SchedMax = GetScheduleMaxValue(state, hybridVentMgr.SimpleControlTypeSchedPtr); - if (hybridVentMgr.VentilationPtr <= 0 && int(SchedMax) == 1) { - ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(10), ipsc->cAlphaArgs(10)); - ErrorsFound = true; - } // Otherwise check later - } - } - // Check simple airflow object - if (hybridVentMgr.SimpleControlTypeSchedPtr > 0 && hybridVentMgr.VentilationPtr > 0) { - if (hybridVentMgr.ControlledZoneNum != state.dataHeatBal->Ventilation(hybridVentMgr.VentilationPtr).ZonePtr) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, cCurrentModuleObject, ipsc->cAlphaArgs(1))); - ShowContinueError(state, - format("The Zone name specified in the Ventilation object {}", - state.dataHeatBal->Zone(state.dataHeatBal->Ventilation(hybridVentMgr.VentilationPtr).ZonePtr).Name)); - ShowContinueError(state, format("is not equal to the {}=\"{}\".", ipsc->cAlphaFieldNames(3), ipsc->cAlphaArgs(3))); - ErrorsFound = true; - } - } + if (hybridVentMgr.VentilationPtr <= 0) { + if (int(hybridVentMgr.simpleControlTypeSched->getMaxVal(state)) == 1) { + ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(10), ipsc->cAlphaArgs(10)); + ErrorsFound = true; + } - if (hybridVentMgr.SimpleControlTypeSchedPtr > 0 && - state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, cCurrentModuleObject, hybridVentMgr.Name)); - ShowContinueError(state, "The simple airflow objects are used for natural ventilation calculation."); - ShowContinueError(state, - "The Airflow Network model is not allowed to perform. Please set the control type = NoMultizoneOrDistribution"); - ErrorsFound = true; - } + if (state.afn->simulation_control.type == AirflowNetwork::ControlType::NoMultizoneOrDistribution) { + ShowWarningError(state, format("{}{}=\"{}\"", RoutineName, cCurrentModuleObject, hybridVentMgr.Name)); + ShowContinueError(state, "The Airflow Network model is not available for Hybrid Ventilation Control."); + } else if (state.afn->simulation_control.type == + AirflowNetwork::ControlType::MultizoneWithDistributionOnlyDuringFanOperation) { + ShowWarningError(state, format("{}{}=\"{}\"", RoutineName, cCurrentModuleObject, hybridVentMgr.Name)); + ShowContinueError(state, "Please check the AirflowNetwork Control field in the AirflowNetwork:SimulationControl object."); + ShowContinueError(state, "The suggested choices are MultizoneWithDistribution or MultizoneWithoutDistribution."); + } - if (hybridVentMgr.SimpleControlTypeSchedPtr == 0) { - if (state.afn->simulation_control.type == AirflowNetwork::ControlType::NoMultizoneOrDistribution) { - ShowWarningError(state, format("{}{}=\"{}\"", RoutineName, cCurrentModuleObject, hybridVentMgr.Name)); - ShowContinueError(state, "The Airflow Network model is not available for Hybrid Ventilation Control."); - } else if (state.afn->simulation_control.type == AirflowNetwork::ControlType::MultizoneWithDistributionOnlyDuringFanOperation) { - ShowWarningError(state, format("{}{}=\"{}\"", RoutineName, cCurrentModuleObject, hybridVentMgr.Name)); - ShowContinueError(state, "Please check the AirflowNetwork Control field in the AirflowNetwork:SimulationControl object."); - ShowContinueError(state, "The suggested choices are MultizoneWithDistribution or MultizoneWithoutDistribution."); + } else { // hybridVentMgr.VentilationPtr > 0 + if (hybridVentMgr.ControlledZoneNum != state.dataHeatBal->Ventilation(hybridVentMgr.VentilationPtr).ZonePtr) { + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, cCurrentModuleObject, ipsc->cAlphaArgs(1))); + ShowContinueError( + state, + format("The Zone name specified in the Ventilation object {}", + state.dataHeatBal->Zone(state.dataHeatBal->Ventilation(hybridVentMgr.VentilationPtr).ZonePtr).Name)); + ShowContinueError(state, format("is not equal to the {}=\"{}\".", ipsc->cAlphaFieldNames(3), ipsc->cAlphaArgs(3))); + ErrorsFound = true; + } + + if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { + ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, cCurrentModuleObject, hybridVentMgr.Name)); + ShowContinueError(state, "The simple airflow objects are used for natural ventilation calculation."); + ShowContinueError( + state, + "The Airflow Network model is not allowed to perform. Please set the control type = NoMultizoneOrDistribution"); + ErrorsFound = true; + } + } } } // Disallow combination of simple control and OA control mode - SchedMax = GetScheduleMaxValue(state, hybridVentMgr.ControlModeSchedPtr); - if (hybridVentMgr.SimpleControlTypeSchedPtr > 0 && SchedMax == 4.0) { - ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, cCurrentModuleObject, ipsc->cAlphaArgs(1))); - ShowContinueError(state, - format("The outdoor ventilation air control type defined in {} cannot work together with {}", - ipsc->cAlphaArgs(4), - ipsc->cAlphaFieldNames(9))); + if (hybridVentMgr.simpleControlTypeSched != nullptr && hybridVentMgr.controlModeSched->getMaxVal(state) == 4.0) { + ShowSevereCustom(state, + eoh, + format("The outdoor ventilation air control type defined in {} cannot work together with {}", + ipsc->cAlphaArgs(4), + ipsc->cAlphaFieldNames(9))); ErrorsFound = true; } @@ -4039,8 +4027,8 @@ namespace Avail { if (state.dataAvail->NumHybridVentSysAvailMgrs > 1) { for (int SysAvailNum = 2; SysAvailNum <= state.dataAvail->NumHybridVentSysAvailMgrs; ++SysAvailNum) { - if (state.dataAvail->HybridVentData(SysAvailNum - 1).ANControlTypeSchedPtr > 0) { - if (state.dataAvail->HybridVentData(SysAvailNum).SimpleControlTypeSchedPtr > 0) { + if (state.dataAvail->HybridVentData(SysAvailNum - 1).afnControlTypeSched != nullptr) { + if (state.dataAvail->HybridVentData(SysAvailNum).simpleControlTypeSched != nullptr) { ShowSevereError(state, format("The AirflowNetwork model is used for natural ventilation calculation in {}=\"{}\"", cCurrentModuleObject, @@ -4053,8 +4041,8 @@ namespace Avail { ErrorsFound = true; } } - if (state.dataAvail->HybridVentData(SysAvailNum - 1).SimpleControlTypeSchedPtr > 0) { - if (state.dataAvail->HybridVentData(SysAvailNum).ANControlTypeSchedPtr > 0) { + if (state.dataAvail->HybridVentData(SysAvailNum - 1).simpleControlTypeSched != nullptr) { + if (state.dataAvail->HybridVentData(SysAvailNum).afnControlTypeSched != nullptr) { ShowSevereError(state, format("The Airflow Network model is used for natural ventilation calculation in {}=\"{}\"", cCurrentModuleObject, @@ -4128,8 +4116,8 @@ namespace Avail { state.dataAvail->HybridVentData(SysAvailNum).Name); } - if (CheckScheduleValue(state, state.dataAvail->HybridVentData(SysAvailNum).ControlModeSchedPtr, (int)VentCtrlType::OperT80) || - CheckScheduleValue(state, state.dataAvail->HybridVentData(SysAvailNum).ControlModeSchedPtr, (int)VentCtrlType::OperT90)) { + if (state.dataAvail->HybridVentData(SysAvailNum).controlModeSched->hasVal(state, (int)VentCtrlType::OperT80) || + state.dataAvail->HybridVentData(SysAvailNum).controlModeSched->hasVal(state, (int)VentCtrlType::OperT90)) { SetupOutputVariable(state, "Hybrid Ventilation Operative Temperature", Constant::Units::C, @@ -4153,7 +4141,7 @@ namespace Avail { state.dataAvail->HybridVentData(SysAvailNum).Name); } - if (CheckScheduleValue(state, state.dataAvail->HybridVentData(SysAvailNum).ControlModeSchedPtr, (int)VentCtrlType::CO2)) { + if (state.dataAvail->HybridVentData(SysAvailNum).controlModeSched->hasVal(state, (int)VentCtrlType::CO2)) { SetupOutputVariable(state, "Hybrid Ventilation CO2 Concentration", Constant::Units::ppm, @@ -4189,7 +4177,6 @@ namespace Avail { bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine int AirLoopNum; // Air loop number int AirLoopCount; // Air loop name count - Real64 SchedMax; // Maximum value specified in a schedule int SysAvailIndex; // Hybrid Ventilation Sys Avail Manager index int ZoneEquipType; int HybridVentNum; @@ -4202,11 +4189,10 @@ namespace Avail { for (int SysAvailNum = 1; SysAvailNum <= state.dataAvail->NumHybridVentSysAvailMgrs; ++SysAvailNum) { auto &hybridVentMgr = state.dataAvail->HybridVentData(SysAvailNum); ErrorObjectHeader eoh{routineName, managerTypeNames[(int)ManagerType::HybridVent], hybridVentMgr.Name}; - if (hybridVentMgr.SimpleControlTypeSchedPtr > 0 && state.dataHeatBal->TotVentilation > 0 && hybridVentMgr.VentilationPtr == 0) { + if (hybridVentMgr.simpleControlTypeSched != nullptr && state.dataHeatBal->TotVentilation > 0 && hybridVentMgr.VentilationPtr == 0) { hybridVentMgr.VentilationPtr = Util::FindItemInList(hybridVentMgr.VentilationName, state.dataHeatBal->Ventilation); hybridVentMgr.Master = hybridVentMgr.VentilationPtr; - SchedMax = GetScheduleMaxValue(state, hybridVentMgr.SimpleControlTypeSchedPtr); - if (hybridVentMgr.VentilationPtr <= 0 && int(SchedMax) == 1) { + if (hybridVentMgr.VentilationPtr <= 0 && int(hybridVentMgr.simpleControlTypeSched->getMaxVal(state)) == 1) { ShowSevereItemNotFound(state, eoh, "ZoneVentilation Object Name", hybridVentMgr.VentilationName); ErrorsFound = true; } @@ -4281,15 +4267,14 @@ namespace Avail { ErrorsFound = true; } // check schedule value for adaptive temperature control - if (CheckScheduleValue(state, hybridVentMgr.ControlModeSchedPtr, 5.0) || - CheckScheduleValue(state, hybridVentMgr.ControlModeSchedPtr, 6.0)) { + if (hybridVentMgr.controlModeSched->hasVal(state, 5.0) || hybridVentMgr.controlModeSched->hasVal(state, 6.0)) { if (!state.dataHeatBal->AdaptiveComfortRequested_ASH55) { ShowSevereError(state, format("GetHybridVentilationInputs: AvailabilityManager:HybridVentilation =\"{}\"", hybridVentMgr.Name)); ShowContinueError(state, format("Ventilation Control Mode Schedule Name =\"{}\", When the schedule value is 5 or 6, operative " "temperature control is requested. ", - state.dataScheduleMgr->Schedule(hybridVentMgr.ControlModeSchedPtr).Name)); + hybridVentMgr.controlModeSched->Name)); ShowContinueError(state, "However, AdaptiveASH55 is not entered in the Thermal Comfort Model Type fields in the People object."); ErrorsFound = true; @@ -4327,7 +4312,7 @@ namespace Avail { for (int SysAvailNum = 1; SysAvailNum <= state.dataAvail->NumHybridVentSysAvailMgrs; ++SysAvailNum) { auto &hybridVentMgr = state.dataAvail->HybridVentData(SysAvailNum); - hybridVentMgr.ctrlType = static_cast(GetCurrentScheduleValue(state, hybridVentMgr.ControlModeSchedPtr)); + hybridVentMgr.ctrlType = static_cast(hybridVentMgr.controlModeSched->getCurrentVal()); // -1 means that the value will be determined inside CalcHybridVentSysAvailMgr. // IF the value is still -1, the program will stop. // hybridVentMgr.ctrlStatus = VentCtrlStatus::Invalid; // Not sure what this is for @@ -4496,7 +4481,7 @@ namespace Avail { } break; case VentCtrlType::OA: { - OASetPoint = GetCurrentScheduleValue(state, hybridVentMgr.MinOASchedPtr); + OASetPoint = hybridVentMgr.minOASched->getCurrentVal(); ACH = 0.0; HybridVentModeOA = true; if (!hybridVentMgr.HybridVentMgrConnectedToAirLoop) { @@ -4505,7 +4490,7 @@ namespace Avail { } } - if (hybridVentMgr.ANControlTypeSchedPtr > 0 && HybridVentModeOA) { + if (hybridVentMgr.afnControlTypeSched != nullptr && HybridVentModeOA) { state.afn->manage_balance(true); ACH = state.afn->zone_OA_change_rate(ZoneNum); } @@ -4594,24 +4579,25 @@ namespace Avail { if (hybridVentMgr.ctrlStatus == VentCtrlStatus::Open) { + auto const &zoneTstatSetpt = state.dataHeatBalFanSys->zoneTstatSetpts(ZoneNum); // Temperature and enthalpy control if (hybridVentMgr.ctrlType == VentCtrlType::Temp || hybridVentMgr.ctrlType == VentCtrlType::Enth) { switch (state.dataHeatBalFanSys->TempControlType(ZoneNum)) { - case HVAC::ThermostatType::SingleHeating: { - if (thisZoneHB.MAT < state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ZoneNum)) { + case HVAC::SetptType::SingleHeat: { + if (thisZoneHB.MAT < zoneTstatSetpt.setpt) { hybridVentMgr.ctrlStatus = VentCtrlStatus::Close; } } break; - case HVAC::ThermostatType::SingleCooling: { - if (thisZoneHB.MAT > state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ZoneNum)) { + case HVAC::SetptType::SingleCool: { + if (thisZoneHB.MAT > zoneTstatSetpt.setpt) { hybridVentMgr.ctrlStatus = VentCtrlStatus::Close; } } break; - case HVAC::ThermostatType::SingleHeatCool: { + case HVAC::SetptType::SingleHeatCool: { hybridVentMgr.ctrlStatus = VentCtrlStatus::Close; ++hybridVentMgr.SingleHCErrCount; if (hybridVentMgr.SingleHCErrCount < 2) { @@ -4631,9 +4617,9 @@ namespace Avail { } } break; - case HVAC::ThermostatType::DualSetPointWithDeadBand: { - if ((thisZoneHB.MAT < state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ZoneNum)) || - (thisZoneHB.MAT > state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ZoneNum))) { + + case HVAC::SetptType::DualHeatCool: { + if (thisZoneHB.MAT < zoneTstatSetpt.setptLo || thisZoneHB.MAT > zoneTstatSetpt.setptHi) { hybridVentMgr.ctrlStatus = VentCtrlStatus::Close; } @@ -4670,10 +4656,8 @@ namespace Avail { for (HStatZoneNum = 1; HStatZoneNum <= state.dataZoneCtrls->NumHumidityControlZones; ++HStatZoneNum) { if (state.dataZoneCtrls->HumidityControlZone(HStatZoneNum).ActualZoneNum == ZoneNum) { found = true; - ZoneRHHumidifyingSetPoint = - GetCurrentScheduleValue(state, state.dataZoneCtrls->HumidityControlZone(HStatZoneNum).HumidifyingSchedIndex); - ZoneRHDehumidifyingSetPoint = - GetCurrentScheduleValue(state, state.dataZoneCtrls->HumidityControlZone(HStatZoneNum).DehumidifyingSchedIndex); + ZoneRHHumidifyingSetPoint = state.dataZoneCtrls->HumidityControlZone(HStatZoneNum).humidifyingSched->getCurrentVal(); + ZoneRHDehumidifyingSetPoint = state.dataZoneCtrls->HumidityControlZone(HStatZoneNum).dehumidifyingSched->getCurrentVal(); if (ZoneAirRH > ZoneRHDehumidifyingSetPoint) { // Need dehumidification WSetPoint = PsyWFnTdbRhPb(state, thisZoneHB.MAT, (ZoneRHDehumidifyingSetPoint / 100.0), state.dataEnvrn->OutBaroPress); @@ -4736,13 +4720,13 @@ namespace Avail { } } - if (hybridVentMgr.ctrlStatus == VentCtrlStatus::Open && hybridVentMgr.ANControlTypeSchedPtr > 0 && hybridVentMgr.OpeningFactorFWS > 0) { + if (hybridVentMgr.ctrlStatus == VentCtrlStatus::Open && hybridVentMgr.afnControlTypeSched != nullptr && hybridVentMgr.OpeningFactorFWS > 0) { hybridVentMgr.WindModifier = CurveValue(state, hybridVentMgr.OpeningFactorFWS, WindExt); } // Set up flags to control simple airflow objects - if (hybridVentMgr.AirLoopNum > 0 && hybridVentMgr.SimpleControlTypeSchedPtr > 0) { - SimpleControlType = GetCurrentScheduleValue(state, hybridVentMgr.SimpleControlTypeSchedPtr); + if (hybridVentMgr.AirLoopNum > 0 && hybridVentMgr.simpleControlTypeSched != nullptr) { + SimpleControlType = hybridVentMgr.simpleControlTypeSched->getCurrentVal(); for (int ControlledZoneNum = 1; ControlledZoneNum <= state.dataGlobal->NumOfZones; ++ControlledZoneNum) { for (int zoneInNode = 1; zoneInNode <= state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).NumInletNodes; ++zoneInNode) { if (hybridVentMgr.AirLoopNum == state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).InletNodeAirLoopNum(zoneInNode)) { @@ -4777,8 +4761,8 @@ namespace Avail { } } } - } else if (hybridVentMgr.SimpleControlTypeSchedPtr > 0) { - SimpleControlType = GetCurrentScheduleValue(state, hybridVentMgr.SimpleControlTypeSchedPtr); + } else if (hybridVentMgr.simpleControlTypeSched != nullptr) { + SimpleControlType = hybridVentMgr.simpleControlTypeSched->getCurrentVal(); // Hybrid ventilation manager is applied to zone component // setup flag for ventilation objects for (i = 1; i <= state.dataHeatBal->TotVentilation; ++i) { @@ -4836,7 +4820,7 @@ namespace Avail { for (int SysAvailNum = 1; SysAvailNum <= state.dataAvail->NumHybridVentSysAvailMgrs; ++SysAvailNum) { if (state.dataAvail->HybridVentData(SysAvailNum).ControlledZoneNum == ZoneNum) { - if (state.dataAvail->HybridVentData(SysAvailNum).SimpleControlTypeSchedPtr > 0) { + if (state.dataAvail->HybridVentData(SysAvailNum).simpleControlTypeSched != nullptr) { VentControl = true; } } diff --git a/src/EnergyPlus/SystemAvailabilityManager.hh b/src/EnergyPlus/SystemAvailabilityManager.hh index 4361571aef9..74c6eb02583 100644 --- a/src/EnergyPlus/SystemAvailabilityManager.hh +++ b/src/EnergyPlus/SystemAvailabilityManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -56,6 +56,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -146,7 +147,7 @@ namespace Avail { // Members std::string Name; // Name of the manager object ManagerType type = ManagerType::Invalid; // Integer equivalent of availability manager type - int SchedPtr = 0; // Schedule pointer + Sched::Schedule *availSched = nullptr; // Schedule pointer Status availStatus = Status::NoAction; // reports status of availability manager }; @@ -165,8 +166,7 @@ namespace Avail { struct SysAvailManagerNightCycle : SysAvailManager // Derived type for Night Cycle Sys Avail Managers { // Members - std::string FanSched; // Fan schedule name - int FanSchedPtr; // Fan schedule pointer + Sched::Schedule *fanSched = nullptr; // Fan schedule // Cycle On Control Zone, or Cycle On Any - Zone Fans Only Real64 TempTolRange; // range in degrees C of thermostat tolerance int CyclingTimeSteps; // period (in Loads time steps) system will cycle on. @@ -188,8 +188,7 @@ namespace Avail { // Default Constructor SysAvailManagerNightCycle() - : FanSchedPtr(0), TempTolRange(1.0), CyclingTimeSteps(1), NumOfCtrlZones(0), NumOfCoolingZones(0), NumOfHeatingZones(0), - NumOfHeatZnFanZones(0) + : TempTolRange(1.0), CyclingTimeSteps(1), NumOfCtrlZones(0), NumOfCoolingZones(0), NumOfHeatingZones(0), NumOfHeatZnFanZones(0) { } }; @@ -197,16 +196,16 @@ namespace Avail { struct SysAvailManagerOptimumStart : SysAvailManager // Derived type for Optimal Start Sys Avail Managers { // Members - bool isSimulated; // true after availability manager is simulated - std::string FanSched; // Fan schedule name - int FanSchedPtr; // Fan schedule pointer - std::string CtrlZoneName; // Name of the control zone - int ZoneNum; // zone number of control zone - std::string ZoneListName; // Zone List name - int NumOfZones; // Number of zones in the list - Array1D_int ZonePtrs; // Pointers to zones in the list - Real64 MaxOptStartTime; // Maximum value of start time in hours - ControlAlgorithm controlAlgorithm; // Control algorithm: ConstantTemperatureGradient, + bool isSimulated; // true after availability manager is simulated + + Sched::Schedule *fanSched = nullptr; // Fan schedule + std::string CtrlZoneName; // Name of the control zone + int ZoneNum; // zone number of control zone + std::string ZoneListName; // Zone List name + int NumOfZones; // Number of zones in the list + Array1D_int ZonePtrs; // Pointers to zones in the list + Real64 MaxOptStartTime; // Maximum value of start time in hours + ControlAlgorithm controlAlgorithm; // Control algorithm: ConstantTemperatureGradient, // AdaptiveTemperatureGradient, AdaptiveASHRAE, ConstantStartTime Real64 ConstTGradCool; // Constant temperature gradient in cooling mode, unit: degC per hour Real64 ConstTGradHeat; // Constant temperature gradient in heating mode, unit: degC per hour @@ -240,12 +239,11 @@ namespace Avail { // Default Constructor SysAvailManagerOptimumStart() - : isSimulated(false), FanSchedPtr(0), ZoneNum(0), NumOfZones(0), MaxOptStartTime(6.0), controlAlgorithm(ControlAlgorithm::Invalid), - ConstTGradCool(1.0), ConstTGradHeat(1.0), InitTGradCool(1.0), InitTGradHeat(1.0), AdaptiveTGradCool(1.0), AdaptiveTGradHeat(1.0), - ConstStartTime(2.0), NumPreDays(1), NumHoursBeforeOccupancy(0.0), TempDiffHi(0.0), TempDiffLo(0.0), ATGWCZoneNumLo(0), - ATGWCZoneNumHi(0), CycleOnFlag(false), ATGUpdateFlag1(false), ATGUpdateFlag2(false), FirstTimeATGFlag(true), OverNightStartFlag(false), - OSReportVarFlag(false), AdaTempGradHeat(0.0), AdaTempGradCool(0.0), ATGUpdateTime1(0.0), ATGUpdateTime2(0.0), ATGUpdateTemp1(0.0), - ATGUpdateTemp2(0.0) + : isSimulated(false), ZoneNum(0), NumOfZones(0), MaxOptStartTime(6.0), controlAlgorithm(ControlAlgorithm::Invalid), ConstTGradCool(1.0), + ConstTGradHeat(1.0), InitTGradCool(1.0), InitTGradHeat(1.0), AdaptiveTGradCool(1.0), AdaptiveTGradHeat(1.0), ConstStartTime(2.0), + NumPreDays(1), NumHoursBeforeOccupancy(0.0), TempDiffHi(0.0), TempDiffLo(0.0), ATGWCZoneNumLo(0), ATGWCZoneNumHi(0), CycleOnFlag(false), + ATGUpdateFlag1(false), ATGUpdateFlag2(false), FirstTimeATGFlag(true), OverNightStartFlag(false), OSReportVarFlag(false), + AdaTempGradHeat(0.0), AdaTempGradCool(0.0), ATGUpdateTime1(0.0), ATGUpdateTime2(0.0), ATGUpdateTemp1(0.0), ATGUpdateTemp2(0.0) { } @@ -296,18 +294,16 @@ namespace Avail { struct SysAvailManagerNightVent : SysAvailManager { // Members - std::string FanSched; // Fan schedule name - int FanSchedPtr; // Fan schedule pointer - std::string VentTempSched; // Ventilation temperature schedule - int VentTempSchedPtr; // Ventilation temperature schedule pointer - Real64 VentDelT; // Ventilation delta T [deltaC] - Real64 VentTempLowLim; // ventilation temperature low limit - std::string CtrlZoneName; // Name of the control zone - int ZoneNum; // zome number of control zone - Real64 VentFlowFrac; // the night venting flow fraction + Sched::Schedule *fanSched = nullptr; // Fan schedule + Sched::Schedule *ventTempSched = nullptr; // Ventilation temperature schedule + Real64 VentDelT; // Ventilation delta T [deltaC] + Real64 VentTempLowLim; // ventilation temperature low limit + std::string CtrlZoneName; // Name of the control zone + int ZoneNum; // zome number of control zone + Real64 VentFlowFrac; // the night venting flow fraction // Default Constructor - SysAvailManagerNightVent() : FanSchedPtr(0), VentTempSchedPtr(0), VentDelT(0.0), VentTempLowLim(0.0), ZoneNum(0), VentFlowFrac(0.0) + SysAvailManagerNightVent() : VentDelT(0.0), VentTempLowLim(0.0), ZoneNum(0), VentFlowFrac(0.0) { } }; @@ -344,7 +340,7 @@ namespace Avail { std::string ControlZoneName; // Controlled zone name int NodeNumOfControlledZone; // Controlled zone node number int ControlledZoneNum; // Controlled zone number - int ControlModeSchedPtr; // Ventilation control mode schedule pointer + Sched::Schedule *controlModeSched = nullptr; // Ventilation control mode schedule VentCtrlType ctrlType = VentCtrlType::No; // hybrid ventilation control mode VentCtrlStatus ctrlStatus = VentCtrlStatus::NoAction; // Ventilation control type: Noaction, Close, Open Real64 MinOutdoorTemp; // Minimum Outdoor Temperature [C] @@ -355,8 +351,7 @@ namespace Avail { Real64 MaxOutdoorDewPoint; // Maximum Outdoor Dew Point Temperature [C] Real64 MaxWindSpeed; // Maximum Wind speed [m/s] bool UseRainIndicator; // Use WeatherFile Rain Indicators - std::string MinOASched; // Minimum Outdoor Ventilation Air Schedule Name - int MinOASchedPtr; // Minimum Outdoor Ventilation Air Schedule pointer + Sched::Schedule *minOASched = nullptr; // Minimum Outdoor Ventilation Air Schedule int DewPointNoRHErrCount; // Dewpoint control mode error count without a humidistat int DewPointNoRHErrIndex; // Dewpoint control mode error index without a humidistat int DewPointErrCount; // Dewpoint control mode error count without a valid humidistat @@ -365,12 +360,13 @@ namespace Avail { // with a singleHeatingCooling setpoint int SingleHCErrIndex; // Temperature and enthalpy control mode error index // with a singleHeatingCooling setpoint - int OpeningFactorFWS; // Opening factor modifier as a function of wind speed - int ANControlTypeSchedPtr; // AirflowNetwork control type schedule pointer - int SimpleControlTypeSchedPtr; // Simple airflow object control type schedule pointer - int VentilationPtr; // Ventilation object name pointer - std::string VentilationName; // Ventilation object name - bool HybridVentMgrConnectedToAirLoop; // Flag to check whether hybrid ventilation + int OpeningFactorFWS; // Opening factor modifier as a function of wind speed + + Sched::Schedule *afnControlTypeSched = nullptr; // AirflowNetwork control type schedule pointer + Sched::Schedule *simpleControlTypeSched = nullptr; // Simple airflow object control type schedule pointer + int VentilationPtr; // Ventilation object name pointer + std::string VentilationName; // Ventilation object name + bool HybridVentMgrConnectedToAirLoop; // Flag to check whether hybrid ventilation // manager is connected to air loop bool SimHybridVentSysAvailMgr; // Set to false when a zone has two hybrid ventilation // managers, one with air loop and one without @@ -383,18 +379,17 @@ namespace Avail { Real64 minAdaTem; // minimum adaptive temperature for adaptive temperature control [C] Real64 maxAdaTem; // maximum adaptive temperature for adaptive temperature control [C] - int ANCtrlStatus = 0; + int afnControlStatus = 0; int Master = 0; Real64 WindModifier = 0.0; // Default Constructor SysAvailManagerHybridVent() - : AirLoopNum(0), NodeNumOfControlledZone(0), ControlledZoneNum(0), ControlModeSchedPtr(0), MinOutdoorTemp(-100.0), MaxOutdoorTemp(100.0), - MinOutdoorEnth(0.1), MaxOutdoorEnth(300000.0), MinOutdoorDewPoint(-100.0), MaxOutdoorDewPoint(100.0), MaxWindSpeed(0.0), - UseRainIndicator(true), MinOASchedPtr(0), DewPointNoRHErrCount(0), DewPointNoRHErrIndex(0), DewPointErrCount(0), DewPointErrIndex(0), - SingleHCErrCount(0), SingleHCErrIndex(0), OpeningFactorFWS(0), ANControlTypeSchedPtr(0), SimpleControlTypeSchedPtr(0), - VentilationPtr(0), HybridVentMgrConnectedToAirLoop(true), SimHybridVentSysAvailMgr(false), OperativeTemp(0.0), CO2(0.0), - MinOperTime(0.0), MinVentTime(0.0), TimeOperDuration(0.0), TimeVentDuration(0.0), minAdaTem(0.0), maxAdaTem(0.0) + : AirLoopNum(0), NodeNumOfControlledZone(0), ControlledZoneNum(0), MinOutdoorTemp(-100.0), MaxOutdoorTemp(100.0), MinOutdoorEnth(0.1), + MaxOutdoorEnth(300000.0), MinOutdoorDewPoint(-100.0), MaxOutdoorDewPoint(100.0), MaxWindSpeed(0.0), UseRainIndicator(true), + DewPointNoRHErrCount(0), DewPointNoRHErrIndex(0), DewPointErrCount(0), DewPointErrIndex(0), SingleHCErrCount(0), SingleHCErrIndex(0), + OpeningFactorFWS(0), VentilationPtr(0), HybridVentMgrConnectedToAirLoop(true), SimHybridVentSysAvailMgr(false), OperativeTemp(0.0), + CO2(0.0), MinOperTime(0.0), MinVentTime(0.0), TimeOperDuration(0.0), TimeVentDuration(0.0), minAdaTem(0.0), maxAdaTem(0.0) { } }; @@ -626,6 +621,10 @@ struct SystemAvailabilityManagerData : BaseGlobalStruct Real64 TimeStepSysLast = 0.0; // last system time step // Hybrid ventilation control part + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/SystemReports.cc b/src/EnergyPlus/SystemReports.cc index ebf30aae9bb..d06ad63f46d 100644 --- a/src/EnergyPlus/SystemReports.cc +++ b/src/EnergyPlus/SystemReports.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -54,7 +54,6 @@ // ObjexxFCL Headers #include -#include // EnergyPlus Headers #include @@ -3829,7 +3828,7 @@ void ReportVentilationLoads(EnergyPlusData &state) if (!thisZoneEquipConfig.IsControlled) continue; Real64 ZAirSysZoneVentLoad = 0.0; // ventilation load attributed to a particular zone from all primary air systems serving the zone [J] - Real64 ZAirSysOutAirFlow = 0.0; // outside air flow rate for zone from all primary air systems serving thezone [kg/s] + Real64 ZAirSysOutAirFlow = 0.0; // outside air flow rate for zone from all primary air systems serving the zone [kg/s] Real64 ZFAUFlowRate = 0.0; // Zone forced Air unit air mass flow rate [kg/s] Real64 ZFAUZoneVentLoad = 0.0; // ventilation load attributed to a particular zone from zone forced air units [J] Real64 ZFAUOutAirFlow = 0.0; // outside air flow rate for zone from zone forced air units. [kg/s] @@ -4138,7 +4137,7 @@ void ReportVentilationLoads(EnergyPlusData &state) AirSysZoneVentLoad = 0.0; AirSysOutAirFlow = 0.0; } else { - // Calculate return and mixed air ethalpies + // Calculate return and mixed air enthalpies AirSysEnthReturnAir = Psychrometrics::PsyHFnTdbW(Node(ReturnAirNode).Temp, Node(ReturnAirNode).HumRat); AirSysEnthMixedAir = Psychrometrics::PsyHFnTdbW(Node(MixedAirNode).Temp, Node(MixedAirNode).HumRat); @@ -4473,7 +4472,7 @@ void FindDemandSideMatch(EnergyPlusData &state, // DATE WRITTEN September 2004 // PURPOSE OF THIS SUBROUTINE: - // This subroutine intializes the connections between various loops. + // This subroutine initializes the connections between various loops. // Due to the fact that this requires numerous string compares, it // is much more efficient to find this information once and then // store it in module level variables (LoopConnect derived type). @@ -4594,7 +4593,7 @@ void ReportAirLoopConnections(EnergyPlusData &state) "! ,,,,,"); - auto &NodeID = state.dataLoopNodes->NodeID; + auto const &NodeID = state.dataLoopNodes->NodeID; print(state.files.bnd, "{}\n", "! ==============================================================="); print(state.files.bnd, "{}\n", Format_706); @@ -5086,7 +5085,6 @@ void reportAirDistributionUnits(EnergyPlusData &state) auto &orp = state.dataOutRptPredefined; for (auto &adu : state.dataDefineEquipment->AirDistUnit) { - auto &airTerminal = adu.airTerminalPtr; constexpr int aduCompNum = 1; OutputReportPredefined::PreDefTableEntry(state, orp->pdchAirTermZoneName, adu.Name, state.dataHeatBal->Zone(adu.ZoneNum).Name); switch (adu.EquipTypeEnum(aduCompNum)) { diff --git a/src/EnergyPlus/SystemReports.hh b/src/EnergyPlus/SystemReports.hh index 7bfc1338eaa..190dc2742e9 100644 --- a/src/EnergyPlus/SystemReports.hh +++ b/src/EnergyPlus/SystemReports.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -415,6 +415,10 @@ struct SystemReportsData : BaseGlobalStruct Array1D CompTypeErrors = Array1D(100); Array1D LoopStack; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/TARCOGArgs.cc b/src/EnergyPlus/TARCOGArgs.cc index 33df57c9608..c5b54f4d905 100644 --- a/src/EnergyPlus/TARCOGArgs.cc +++ b/src/EnergyPlus/TARCOGArgs.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -421,7 +421,7 @@ int ArgCheck(EnergyPlusData &state, for (int i = 1; i <= nlayer; ++i) { if (scon(i) <= 0.0) { ArgCheck = 26; - ErrorMessage = format("Layer {:3} has conductivity whcih is less or equal to zero.", i); + ErrorMessage = format("Layer {:3} has conductivity which is less or equal to zero.", i); return ArgCheck; } @@ -491,7 +491,7 @@ int ArgCheck(EnergyPlusData &state, if (presure(i) < 0.0) { ArgCheck = 27; if ((i == 1) || (i == (nlayer + 1))) { - ErrorMessage = "One of enviroments (inside or outside) has pressure which is less than zero."; + ErrorMessage = "One of environments (inside or outside) has pressure which is less than zero."; } else { ErrorMessage = format("One of gaps has pressure which is less than zero. Gap #{:3}", i); } diff --git a/src/EnergyPlus/TARCOGArgs.hh b/src/EnergyPlus/TARCOGArgs.hh index 483968f00b3..84ebbb4ae13 100644 --- a/src/EnergyPlus/TARCOGArgs.hh +++ b/src/EnergyPlus/TARCOGArgs.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/TARCOGCommon.cc b/src/EnergyPlus/TARCOGCommon.cc index 42e97465ccf..d5b7cad79ab 100644 --- a/src/EnergyPlus/TARCOGCommon.cc +++ b/src/EnergyPlus/TARCOGCommon.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -47,7 +47,6 @@ // ObjexxFCL Headers #include -#include // EnergyPlus Headers #include diff --git a/src/EnergyPlus/TARCOGCommon.hh b/src/EnergyPlus/TARCOGCommon.hh index f5023ce4bf1..2983fcd8c3f 100644 --- a/src/EnergyPlus/TARCOGCommon.hh +++ b/src/EnergyPlus/TARCOGCommon.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -120,6 +120,10 @@ struct TARCOGCommonData : BaseGlobalStruct { Array1D vv = Array1D(TARCOGCommon::NMAX); + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/TARCOGDeflection.cc b/src/EnergyPlus/TARCOGDeflection.cc index aa2f18d005c..791ab821b42 100644 --- a/src/EnergyPlus/TARCOGDeflection.cc +++ b/src/EnergyPlus/TARCOGDeflection.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -47,7 +47,6 @@ // ObjexxFCL Headers #include -#include // EnergyPlus Headers #include diff --git a/src/EnergyPlus/TARCOGDeflection.hh b/src/EnergyPlus/TARCOGDeflection.hh index 7f969afbd12..54c480d2250 100644 --- a/src/EnergyPlus/TARCOGDeflection.hh +++ b/src/EnergyPlus/TARCOGDeflection.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/TARCOGGasses90.cc b/src/EnergyPlus/TARCOGGasses90.cc index 5232008a40b..a1f252b6e41 100644 --- a/src/EnergyPlus/TARCOGGasses90.cc +++ b/src/EnergyPlus/TARCOGGasses90.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -51,7 +51,6 @@ // ObjexxFCL Headers #include #include -#include // EnergyPlus Headers #include diff --git a/src/EnergyPlus/TARCOGGasses90.hh b/src/EnergyPlus/TARCOGGasses90.hh index ceca8e70e8e..9d5a2421a25 100644 --- a/src/EnergyPlus/TARCOGGasses90.hh +++ b/src/EnergyPlus/TARCOGGasses90.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -98,6 +98,10 @@ struct TARCOGGasses90Data : BaseGlobalStruct Array1D kpdown = Array1D(TARCOGGassesParams::maxgas); Array1D kdpdown = Array1D(TARCOGGassesParams::maxgas); + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/TARCOGGassesParams.hh b/src/EnergyPlus/TARCOGGassesParams.hh index b65e3867bfc..1f3e6056546 100644 --- a/src/EnergyPlus/TARCOGGassesParams.hh +++ b/src/EnergyPlus/TARCOGGassesParams.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/TARCOGMain.cc b/src/EnergyPlus/TARCOGMain.cc index 3b07d1d8c6b..edf4f344757 100644 --- a/src/EnergyPlus/TARCOGMain.cc +++ b/src/EnergyPlus/TARCOGMain.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -68,22 +68,22 @@ namespace EnergyPlus::TARCOGMain { // MODIFIED na // RE-ENGINEERED (see information bellow) // Revision: 7.0.13 (March/27/2012), Simon Vidanovic -// - feature: New set of equaitons is set instead of hhat coefficents and new approach to solution which improves +// - feature: New set of equations is set instead of hhat coefficients and new approach to solution which improves // speed and stability. Note that this solution does not include laminates // Revision: 7.0.12 (March/06/2012), Simon Vidanovic // - feature: Additional state for isky introduced. Tarcog now can accept IR radiance from external source. // Revision: 7.0.11 (January/04/2012), Simon Vidanovic -// - imrovements/bug fixes: Several items merged from Windows tarcog version into this one: -// - bug fix: Correct foramtting for VacuumMaxGapThickness when program writes input file +// - improvements/bug fixes: Several items merged from Windows tarcog version into this one: +// - bug fix: Correct formatting for VacuumMaxGapThickness when program writes input file // - improvement: Gamma coefficient is now written in scientific notation (needed for correct output file generation) -// - imporvement: Gap data are now saved with higer precision to wincog input file (test purposes, debug mode only) +// - improvement: Gap data are now saved with higher precision to wincog input file (test purposes, debug mode only) // - bug fix: Gap temperatures are recalculated within iterations (for thermally driven and forced ventilation) // Revision: 7.0.10 (December/15/2011), Simon Vidanovic -// - imrovement: Flag for performing SHGC calculations +// - improvement: Flag for performing SHGC calculations // Revision: 7.0.09 (November/15/2011), Simon Vidanovic -// - imrovement: Added error message tolerance (This is necessary to handle error messages in correct way) +// - improvement: Added error message tolerance (This is necessary to handle error messages in correct way) // Revision: 7.0.08 (November/15/2011), Simon Vidanovic -// - bug fix: Fixed program crashing when warrning message 1007 occurred (output could not fit in string) +// - bug fix: Fixed program crashing when warning message 1007 occurred (output could not fit in string) // - feature: relaxation parameter changed // Revision: 7.0.07 (November/08/2011), Simon Vidanovic // - feature: Error message (as string) is now return from tarcog @@ -92,7 +92,7 @@ namespace EnergyPlus::TARCOGMain { // Revision: 7.0.05 (November/07/2011), Simon Vidanovic // - bug fix: Troom and Tamb are not passed out of hhat routine after recalculation is performed. // This will cause differences in calculation of U-factor -// - feature: VacuumMaxGapThickness is added to list of input paramters +// - feature: VacuumMaxGapThickness is added to list of input parameters // Revision: 7.0.04 (November/03/2011), Simon Vidanovic // - bug fix: one of debug files did not update properly // Revision: 7.0.03 (November/01/2011), Simon Vidanovic @@ -133,7 +133,7 @@ namespace EnergyPlus::TARCOGMain { // - Added new input argument - SDScalar: // 0.0 - No SD (in terms of convection) // 1.0 - Closed SD (SD treated as a 'regular' specular layer) -// between 0 and 1 - cobination of No SD and Closed SD cases +// between 0 and 1 - combination of No SD and Closed SD cases // - A bug in unshaded run (remapping gas properties in removal of indoor SD layer) was fixed // - TARCOG error codes have been updated (error codes 30 and 37 added) // Revision: 6.0.26 (May/31/2006) @@ -169,7 +169,7 @@ namespace EnergyPlus::TARCOGMain { // - Added two new output arguments needed for connection with T6: // HcUnshadedOut, // HcUnshadeIn. -// - Changed the way ShadeHcRatioOut and ShadeHcRatioIn are caculated. +// - Changed the way ShadeHcRatioOut and ShadeHcRatioIn are calculated. // Revision: 6.0.21 (October/28/2005) // - Fixed another serious bug in new routine for calculation of U factor. // Revision: 6.0.20 (October/20/2005) @@ -185,7 +185,7 @@ namespace EnergyPlus::TARCOGMain { // - Description of arguments has been updated. // - Forced ventilation calc has been disabled. // Revision: 6.0.18 (September/16/2005) -// - Changed Tvent for outdoor and indoor SD layers to Tout and Tin, respectivelly. +// - Changed Tvent for outdoor and indoor SD layers to Tout and Tin, respectively. // - Keff is now calculated for each gap. // Revision: 6.0.17 (September/08/2005) // - Fixed a bug involving Al, Ar & Ah values (patch for a case of Al+Ar+Ah = 0). @@ -210,7 +210,7 @@ namespace EnergyPlus::TARCOGMain { // - Minor change in Picard coefficients for vented gaps - MaxIter cannot // be less than 800. This solves issue with theta buffer in Therm1d. // - Implemented creation of TARCOG debug file w/ i/o arguments/results (Tarcog.dbg) -// (fetaure #8); debug file will be created depending on Debug_mode switch: +// (feature #8); debug file will be created depending on Debug_mode switch: // Debug_mode = 0 : debug file will not be created // Debug_mode = 1 : debug file will be appended // Debug_mode = 2 : new debug file will be created @@ -256,14 +256,14 @@ namespace EnergyPlus::TARCOGMain { // - implemented arrays for ventilation temperature and speed // - repaired equation 121 in ISO (instead of cos(tilt) now is ABS(cos(tilt))) // - implemented input field for forced ventilation velocity (for all cases) -// - fixed bug in shading edge: coefficients B1, C1 and D1 repaired to calcluate value for gap temperature (not enviroment) -// - fixed bug in routine shading edge: characteristic Height is calculated for gap (not for enviroment) -// - fixed bug in proccesing error messages (this was produced slightly wrong in some cases results) +// - fixed bug in shading edge: coefficients B1, C1 and D1 repaired to calculate value for gap temperature (not environment) +// - fixed bug in routine shading edge: characteristic Height is calculated for gap (not for environment) +// - fixed bug in processing error messages (this was produced slightly wrong in some cases results) // Revision: 6.0.06 rv (04/22/03) // - write out heat flux calculation for shading device panes // - qv smoothing: make vented heat flux same in adjacent gaps (gaps are divided by shading pane) // - fixed bug in routine "shadingin": make that vented heat flow direction is calculated correct, according -// to temeratures in adjecent gaps +// to temperatures in adjacent gaps // Revision: 6.0.05 (04/14/03) // - implemented "Picard" method in iteration loop // - number of iterations is increased to 1000 @@ -360,8 +360,8 @@ void TARCOG90(EnergyPlusData &state, Real64 const VacuumPressure, // maximal pressure for gas to be considered as vacuum Real64 &VacuumMaxGapThickness, // maximum allowed thickness without producing warning message DeflectionCalculation const CalcDeflection, // Deflection calculation flag: - Real64 const Pa, // Atmospheric (outside/inside) pressure (used onlu if CalcDeflection = 1) - Real64 const Pini, // Initial presssure at time of fabrication (used only if CalcDeflection = 1) + Real64 const Pa, // Atmospheric (outside/inside) pressure (used only if CalcDeflection = 1) + Real64 const Pini, // Initial pressure at time of fabrication (used only if CalcDeflection = 1) Real64 const Tini, // Initial temperature at time of fabrication (used only if CalcDeflection = 1) Array1D &gap, // Vector of gap widths [m] Array1D &GapDefMax, // Vector of gap widths in deflected state. It will be used as input @@ -384,7 +384,7 @@ void TARCOG90(EnergyPlusData &state, Array2A const xgvis, // Matrix of constants for gas dynamic viscosity calc Array2A const xgcp, // Matrix of constants for gas specific heat calc at constant pressure const Array1D &xwght, // Vector of Molecular weights for gasses - const Array1D &gama, // Vector of spefic heat ration for low pressure calc + const Array1D &gama, // Vector of specific heat ration for low pressure calc const Array1D_int &nmix, // Vector of number of gasses in gas mixture of each gap const Array1D_int &SupportPillar, // Shows whether or not gap have support pillar const Array1D &PillarSpacing, // Pillar spacing for each gap (used in case there is support pillar) @@ -392,7 +392,7 @@ void TARCOG90(EnergyPlusData &state, Array1D &theta, // Vector of average temperatures of glazing surfaces [K] Array1D &LayerDef, // Vector of layers deflection. [m] Array1D &q, // Vector of various heat fluxes [W/m2] - Array1D &qv, // Vector of heat fluxes to each gap by ventillation [W/m2] + Array1D &qv, // Vector of heat fluxes to each gap by ventilation [W/m2] Real64 &ufactor, // Center of glass U-value [W/m2 K] Real64 &sc, // Shading Coefficient Real64 &hflux, // Net heat flux between room and window [W/m2] @@ -453,7 +453,7 @@ void TARCOG90(EnergyPlusData &state, Array1D &ShadeGapKeffConv, // Vector of convective keff values for areas above/below Real64 const SDScalar, // Factor of Venetian SD layer contribution to convection int const SHGCCalc, // SHGC calculation switch: - int &NumOfIterations, // Number of iterations for reacing solution + int &NumOfIterations, // Number of iterations for reaching solution Real64 const edgeGlCorrFac // Edge of glass correction factor ) { @@ -550,7 +550,7 @@ void TARCOG90(EnergyPlusData &state, // 4 - Xenon // 0 - h to be calculated // 1 - combined film coefficient h prescribed - // 2 - convective film coefficient (hc) prescibed + // 2 - convective film coefficient (hc) prescribed // Also used in old algorithms for calculating h, accessible through negative // values for flags: // -1 - old SPC142 correlation @@ -731,7 +731,7 @@ void TARCOG90(EnergyPlusData &state, SDScalar, ErrorMessage); - // in case of provided deflected gap widths just store deflected widhts before temperatures calculation + // in case of provided deflected gap widths just store deflected widths before temperatures calculation // deflections in this case do not depend of temperatures and it should be calculated before to avoid // one extra call of temperatures calculations if (CalcDeflection == DeflectionCalculation::GAP_WIDTHS) { diff --git a/src/EnergyPlus/TARCOGMain.hh b/src/EnergyPlus/TARCOGMain.hh index 5f3e6b70c43..10ce71261bb 100644 --- a/src/EnergyPlus/TARCOGMain.hh +++ b/src/EnergyPlus/TARCOGMain.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -186,6 +186,10 @@ struct TARCOGMainData : BaseGlobalStruct Array1D CurGap = Array1D(TARCOGParams::MaxGap); Array1D GapDefMean = Array1D(TARCOGParams::MaxGap); + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/TARCOGOutput.cc b/src/EnergyPlus/TARCOGOutput.cc index 7cb0680024e..242672a51a8 100644 --- a/src/EnergyPlus/TARCOGOutput.cc +++ b/src/EnergyPlus/TARCOGOutput.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/TARCOGOutput.hh b/src/EnergyPlus/TARCOGOutput.hh index 892fdfd9ef1..54aec833164 100644 --- a/src/EnergyPlus/TARCOGOutput.hh +++ b/src/EnergyPlus/TARCOGOutput.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -305,6 +305,10 @@ struct TARCOGOutputData : BaseGlobalStruct int winID = 0; int iguID = 0; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/TARCOGParams.cc b/src/EnergyPlus/TARCOGParams.cc index 6189b78e9cb..81caf5948e4 100644 --- a/src/EnergyPlus/TARCOGParams.cc +++ b/src/EnergyPlus/TARCOGParams.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/TARCOGParams.hh b/src/EnergyPlus/TARCOGParams.hh index f38a750a293..6b2bc37aba1 100644 --- a/src/EnergyPlus/TARCOGParams.hh +++ b/src/EnergyPlus/TARCOGParams.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/TarcogShading.cc b/src/EnergyPlus/TarcogShading.cc index b9350f56fbb..ffa06ae1d85 100644 --- a/src/EnergyPlus/TarcogShading.cc +++ b/src/EnergyPlus/TarcogShading.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -47,7 +47,6 @@ // ObjexxFCL Headers #include -#include // EnergyPlus Headers #include @@ -130,7 +129,7 @@ namespace TarcogShading { Array1D LayerType, Array1D &Tgaps, Array1D &qv, - Array1D &hcv, // Heat transfer coeefficient in gaps including airlow + Array1D &hcv, // Heat transfer coefficient in gaps including airflow int &nperr, std::string &ErrorMessage, Array1D &vfreevent) @@ -141,7 +140,7 @@ namespace TarcogShading { // gap Vector of gap widths (maxlay) [m] // hgas Convective part of gap effective conductivity // frct Fraction of gasses in a mixture (maxlay1,maxgas) - // iprop Vector of gas identifers (maxlay1,maxgas) + // iprop Vector of gas identifiers (maxlay1,maxgas) // pressure Vector of gas pressures [N/m^2] // nmix Vector of number of gasses for each mixture (maxgas=10) // nlayer Number of glazing layers @@ -160,9 +159,9 @@ namespace TarcogShading { // Input/Output: // Tgaps Vector of gap temperatures [K] // Output: - // qv Vector of heat transfer to the gap by vetilation [W/m^2] + // qv Vector of heat transfer to the gap by ventilation [W/m^2] // hhatv Vector of all film coefficients for vented cavities (maxlay3) - // hcv Vector of surface-to-air heat transfer coefficients by condction/convection for vented cavities [W/(m^2*K)] + // hcv Vector of surface-to-air heat transfer coefficients by conduction/convection for vented cavities [W/(m^2*K)] // Ebgap Vector of emissive power of the vented cavities (maxlay3) // nperr Error flag // vfreevent Vector of free ventilation velocities in gaps @@ -229,7 +228,7 @@ namespace TarcogShading { Ars = Ar(i); Ahs = Ah(i); - // dr.....setting gas properies for two adjacent gaps (or enviroment) + // dr.....setting gas properties for two adjacent gaps (or environment) nmix1 = nmix(i); nmix2 = nmix(i + 1); press1 = pressure(i); @@ -460,7 +459,7 @@ namespace TarcogShading { // exit on error if ((nperr > 0) && (nperr < 1000)) return; - // if (vvent(i).gt.0) then !not implemented for inside shadin yet + // if (vvent(i).gt.0) then !not implemented for inside shading yet // nperr = 1006 // ErrorMessage = 'Forced ventilation not implemented for internal SD layers.' // return @@ -519,7 +518,7 @@ namespace TarcogShading { // Tinlet Temperature of inlet air // Output: // hcv Convective/conductive coefficient for vented gap - // qv Heat transfer to the gap by vetilation [W/m^2] + // qv Heat transfer to the gap by ventilation [W/m^2] // nperr Error flag // ErrorMessage string containing error message //************************************************************************************************************** @@ -798,7 +797,7 @@ namespace TarcogShading { // A = dens0 * T0 * GravityConstant * ABS(cos(tilt)) * ABS(Tgap1 - Tgap2) / (Tgap1 * Tgap2) // bi...Bug fix #00005: - A = dens0 * T0 * Constant::GravityConstant * H * std::abs(cos_Tilt) * std::abs(Tgap1 - Tgap2) / (Tgap1 * Tgap2); + A = dens0 * T0 * Constant::Gravity * H * std::abs(cos_Tilt) * std::abs(Tgap1 - Tgap2) / (Tgap1 * Tgap2); if (A == 0.0) { qv1 = 0.0; @@ -972,12 +971,12 @@ namespace TarcogShading { // angle Window angle [degrees] // forcedspeed Speed of forced ventilation [m/s] // hc Convective/conductive coefficient for non-vented gap - // Tenv Enviromental temperature + // Tenv Environmental temperature // Tav Average temperature of gap surfaces // Output: // Tgap Temperature of vented gap // hcv Convective/conductive coefficient for vented gap - // qv Heat transfer to the gap by vetilation [W/m^2] + // qv Heat transfer to the gap by ventilation [W/m^2] // nperr Error flag // speed Air velocity //************************************************************************************************************** @@ -1102,7 +1101,7 @@ namespace TarcogShading { // A = dens0 * T0 * gravity * ABS(cos(tilt)) * ABS(Tgap - Tenv) / (Tgap * Tenv) // bi...Bug fix #00005: - A = dens0 * T0 * Constant::GravityConstant * H * abs_cos_tilt * std::abs(Tgap - Tenv) / (Tgap * Tenv); + A = dens0 * T0 * Constant::Gravity * H * abs_cos_tilt * std::abs(Tgap - Tenv) / (Tgap * Tenv); // A = dens0 * T0 * GravityConstant * H * ABS(cos(tilt)) * (Tgap - Tenv) / (Tgap * Tenv) B1 = dens2 / 2; @@ -1176,16 +1175,16 @@ namespace TarcogShading { void updateEffectiveMultipliers(int const nlayer, // Number of layers Real64 const width, // IGU width [m] Real64 const height, // IGU height [m] - const Array1D &Atop, // Top openning area [m2] - const Array1D &Abot, // Bottom openning area [m2] - const Array1D &Al, // Left side openning area [m2] - const Array1D &Ar, // Right side openning area [m2] - const Array1D &Ah, // Front side openning area [m2] - Array1D &Atop_eff, // Output - Effective top openning area [m2] - Array1D &Abot_eff, // Output - Effective bottom openning area [m2] - Array1D &Al_eff, // Output - Effective left side openning area [m2] - Array1D &Ar_eff, // Output - Effective right side openning area [m2] - Array1D &Ah_eff, // Output - Effective front side openning area [m2] + const Array1D &Atop, // Top opening area [m2] + const Array1D &Abot, // Bottom opening area [m2] + const Array1D &Al, // Left side opening area [m2] + const Array1D &Ar, // Right side opening area [m2] + const Array1D &Ah, // Front side opening area [m2] + Array1D &Atop_eff, // Output - Effective top opening area [m2] + Array1D &Abot_eff, // Output - Effective bottom opening area [m2] + Array1D &Al_eff, // Output - Effective left side opening area [m2] + Array1D &Ar_eff, // Output - Effective right side opening area [m2] + Array1D &Ah_eff, // Output - Effective front side opening area [m2] const Array1D &LayerType, // Layer type const Array1D &SlatAngle // Venetian layer slat angle [deg] ) diff --git a/src/EnergyPlus/TarcogShading.hh b/src/EnergyPlus/TarcogShading.hh index 13cd21eb0d5..628ce31b8d9 100644 --- a/src/EnergyPlus/TarcogShading.hh +++ b/src/EnergyPlus/TarcogShading.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -220,6 +220,10 @@ struct TarcogShadingData : BaseGlobalStruct Array1D_int iprop1 = Array1D_int(TARCOGGassesParams::maxgas); Array1D_int iprop2 = Array1D_int(TARCOGGassesParams::maxgas); + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ThermalChimney.cc b/src/EnergyPlus/ThermalChimney.cc index 58b236f75c5..32ac28e9c5c 100644 --- a/src/EnergyPlus/ThermalChimney.cc +++ b/src/EnergyPlus/ThermalChimney.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -48,9 +48,6 @@ // C++ Headers #include -// ObjexxFCL Headers -#include - // EnergyPlus Headers #include #include @@ -147,10 +144,7 @@ namespace ThermalChimney { // This subroutine obtains input data for ThermalChimney units and // stores it in the ThermalChimney data structure. - // Using/Aliasing - - using ScheduleManager::GetScheduleIndex; - + static constexpr std::string_view routineName = "GetThermalChimney"; // SUBROUTINE PARAMETER DEFINITIONS: Real64 constexpr FlowFractionTolerance(0.0001); // Smallest deviation from unity for the sum of all fractions @@ -188,6 +182,9 @@ namespace ThermalChimney { state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + if (Util::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), cCurrentModuleObject, ErrorsFound)) { continue; } @@ -214,18 +211,12 @@ namespace ThermalChimney { } state.dataThermalChimneys->ThermalChimneySys(Loop).RealZoneName = state.dataIPShortCut->cAlphaArgs(2); - state.dataThermalChimneys->ThermalChimneySys(Loop).SchedName = state.dataIPShortCut->cAlphaArgs(3); if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { - state.dataThermalChimneys->ThermalChimneySys(Loop).SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - state.dataThermalChimneys->ThermalChimneySys(Loop).SchedPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(3)); - if (state.dataThermalChimneys->ThermalChimneySys(Loop).SchedPtr == 0) { - ShowSevereError(state, format("{}=\"{} invalid data", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError( - state, - format("Invalid-not found {}=\"{}\".", state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3))); - ErrorsFound = true; - } + state.dataThermalChimneys->ThermalChimneySys(Loop).availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((state.dataThermalChimneys->ThermalChimneySys(Loop).availSched = + Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3)); + ErrorsFound = true; } state.dataThermalChimneys->ThermalChimneySys(Loop).AbsorberWallWidth = state.dataIPShortCut->rNumericArgs(1); @@ -674,8 +665,6 @@ namespace ThermalChimney { // PURPOSE OF THIS SUBROUTINE: // This subroutine simulates the components making up the ThermalChimney. - using ScheduleManager::GetCurrentScheduleValue; - int constexpr NTC(15); // Number of subregions in thermal chimney air channel for FINITE DIFFERENCE // To be obtained from other modules and subroutines @@ -734,7 +723,7 @@ namespace ThermalChimney { // determine major width and minor width for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); + auto const &thisSpace = state.dataHeatBal->space(spaceNum); for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { if (state.dataSurface->Surface(SurfNum).Class != SurfaceClass::Wall) continue; @@ -801,12 +790,12 @@ namespace ThermalChimney { Process2 = 0.0; for (int TCZoneNum = 1; TCZoneNum <= state.dataThermalChimneys->ThermalChimneySys(Loop).TotZoneToDistrib; ++TCZoneNum) { int tcZonePtr = state.dataThermalChimneys->ThermalChimneySys(Loop).ZonePtr(TCZoneNum); - auto &thisTCZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(tcZonePtr); + auto const &thisTCZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(tcZonePtr); Real64 tcZoneMAT = thisTCZoneHB.MAT; Real64 tcZoneHumRat = thisTCZoneHB.airHumRat; int tcSpacePtr = state.dataThermalChimneys->ThermalChimneySys(Loop).spacePtr(TCZoneNum); if ((state.dataHeatBal->doSpaceHeatBalance) && (tcSpacePtr > 0)) { - auto &thisTCspaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(tcSpacePtr); + auto const &thisTCspaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(tcSpacePtr); tcZoneMAT = thisTCspaceHB.MAT; tcZoneHumRat = thisTCspaceHB.airHumRat; } @@ -916,7 +905,7 @@ namespace ThermalChimney { Real64 tcZoneHumRat = thisTCZoneHB.airHumRat; int tcSpacePtr = state.dataThermalChimneys->ThermalChimneySys(Loop).spacePtr(TCZoneNum); if ((state.dataHeatBal->doSpaceHeatBalance) && (tcSpacePtr > 0)) { - auto &thisTCSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(tcSpacePtr); + auto const &thisTCSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(tcSpacePtr); tcZoneMAT = thisTCSpaceHB.MAT; tcZoneHumRat = thisTCSpaceHB.airHumRat; } @@ -958,7 +947,7 @@ namespace ThermalChimney { } state.dataThermalChimneys->ThermalChimneyReport(Loop).OutletAirTempThermalChim = ThermChimSubTemp(NTC) - Constant::Kelvin; - if (GetCurrentScheduleValue(state, state.dataThermalChimneys->ThermalChimneySys(Loop).SchedPtr) <= 0.0) { + if (state.dataThermalChimneys->ThermalChimneySys(Loop).availSched->getCurrentVal() <= 0.0) { for (int TCZoneNum = 1; TCZoneNum <= state.dataThermalChimneys->ThermalChimneySys(Loop).TotZoneToDistrib; ++TCZoneNum) { int tcZonePtr = state.dataThermalChimneys->ThermalChimneySys(Loop).ZonePtr(TCZoneNum); auto &thisTCZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(tcZonePtr); diff --git a/src/EnergyPlus/ThermalChimney.hh b/src/EnergyPlus/ThermalChimney.hh index 797594f6756..aec99b36f2f 100644 --- a/src/EnergyPlus/ThermalChimney.hh +++ b/src/EnergyPlus/ThermalChimney.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -70,8 +70,7 @@ namespace ThermalChimney { std::string Name; int RealZonePtr; std::string RealZoneName; - int SchedPtr; - std::string SchedName; + Sched::Schedule *availSched = nullptr; Real64 AbsorberWallWidth; Real64 AirOutletCrossArea; Real64 DischargeCoeff; @@ -87,8 +86,8 @@ namespace ThermalChimney { // Default Constructor ThermalChimneyData() - : RealZonePtr(0), SchedPtr(0), AbsorberWallWidth(0.0), AirOutletCrossArea(0.0), DischargeCoeff(0.0), TotZoneToDistrib(0), - EMSOverrideOn(false), EMSAirFlowRateValue(0) + : RealZonePtr(0), AbsorberWallWidth(0.0), AirOutletCrossArea(0.0), DischargeCoeff(0.0), TotZoneToDistrib(0), EMSOverrideOn(false), + EMSAirFlowRateValue(0) { } }; @@ -148,6 +147,10 @@ struct ThermalChimneysData : BaseGlobalStruct EPVector ZnRptThermChim; EPVector ThermalChimneyReport; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ThermalComfort.cc b/src/EnergyPlus/ThermalComfort.cc index c46a47475ec..29bc4a24fd5 100644 --- a/src/EnergyPlus/ThermalComfort.cc +++ b/src/EnergyPlus/ThermalComfort.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -52,7 +52,6 @@ #include // ObjexxFCL Headers -#include #include // EnergyPlus Headers @@ -102,7 +101,6 @@ namespace ThermalComfort { // Using/Aliasing using DataHeatBalance::PeopleData; using Psychrometrics::PsyRhFnTdbWPb; - using ScheduleManager::GetCurrentScheduleValue; void ManageThermalComfort(EnergyPlusData &state, bool const InitializeOnly) // when called from ZTPC and calculations aren't needed { @@ -169,7 +167,7 @@ namespace ThermalComfort { CurrentGroupName = state.dataHeatBal->People(Loop).Name; // CurrentModuleObject='People' - // MJW MRT ToDo: Rename most Zone Therml Comfort output varibles to People Thermal Comfort ('cause they're keyed by People name) + // MJW MRT ToDo: Rename most Zone Thermal Comfort output variables to People Thermal Comfort ('cause they're keyed by People name) if (state.dataHeatBal->People(Loop).Fanger) { SetupOutputVariable(state, "Zone Thermal Comfort Fanger Model PMV", @@ -519,7 +517,10 @@ namespace ThermalComfort { // that is included in ASHRAE Standard 55 Normative Appendix D. for (state.dataThermalComforts->PeopleNum = 1; state.dataThermalComforts->PeopleNum <= state.dataHeatBal->TotPeople; - ++state.dataThermalComforts->PeopleNum) { + ++state.dataThermalComforts->PeopleNum) { // Is there a reason why this is a state variable and not a local variable? + + auto &people = state.dataHeatBal->People(state.dataThermalComforts->PeopleNum); + auto &comfort = state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum); // Optional argument is used to access people object when thermal comfort control is used if (present(PNum)) { @@ -527,9 +528,9 @@ namespace ThermalComfort { } // If optional argument is used do not cycle regardless of thermal comfort reporting type - if ((!state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).Fanger) && (!present(PNum))) continue; + if ((!people.Fanger) && (!present(PNum))) continue; - state.dataThermalComforts->ZoneNum = state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).ZonePtr; + state.dataThermalComforts->ZoneNum = people.ZonePtr; auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataThermalComforts->ZoneNum); if (present(PNum)) { state.dataThermalComforts->AirTemp = Tset; @@ -537,7 +538,7 @@ namespace ThermalComfort { state.dataThermalComforts->AirTemp = thisZoneHB.ZTAVComf; } if (state.dataRoomAir->anyNonMixingRoomAirModel) { - state.dataThermalComforts->ZoneNum = state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).ZonePtr; + state.dataThermalComforts->ZoneNum = people.ZonePtr; if (state.dataRoomAir->IsZoneDispVent3Node(state.dataThermalComforts->ZoneNum) || state.dataRoomAir->IsZoneUFAD(state.dataThermalComforts->ZoneNum)) { state.dataThermalComforts->AirTemp = state.dataRoomAir->TCMF(state.dataThermalComforts->ZoneNum); // PH 3/7/04 @@ -562,59 +563,43 @@ namespace ThermalComfort { state.dataThermalComforts->RelHum = PsyRhFnTdbWPb(state, state.dataThermalComforts->AirTemp, thisZoneHB.airHumRatAvgComf, state.dataEnvrn->OutBaroPress); } - state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).TemperatureInZone = state.dataThermalComforts->AirTemp; - state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).RelativeHumidityInZone = state.dataThermalComforts->RelHum * 100.0; + people.TemperatureInZone = state.dataThermalComforts->AirTemp; + people.RelativeHumidityInZone = state.dataThermalComforts->RelHum * 100.0; // Metabolic rate of body (W/m2) - state.dataThermalComforts->ActLevel = - GetCurrentScheduleValue(state, state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).ActivityLevelPtr) / BodySurfArea; + state.dataThermalComforts->ActLevel = people.activityLevelSched->getCurrentVal() / BodySurfArea; // Energy consumption by external work (W/m2) - state.dataThermalComforts->WorkEff = - GetCurrentScheduleValue(state, state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).WorkEffPtr) * - state.dataThermalComforts->ActLevel; + state.dataThermalComforts->WorkEff = people.workEffSched->getCurrentVal() * state.dataThermalComforts->ActLevel; // Clothing unit Real64 IntermediateClothing; - switch (state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).clothingType) { + switch (people.clothingType) { case DataHeatBalance::ClothingType::InsulationSchedule: - state.dataThermalComforts->CloUnit = - GetCurrentScheduleValue(state, state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).ClothingPtr); + state.dataThermalComforts->CloUnit = people.clothingSched->getCurrentVal(); break; case DataHeatBalance::ClothingType::DynamicAshrae55: - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortOpTemp = - (state.dataThermalComforts->RadTemp + state.dataThermalComforts->AirTemp) / 2.0; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ClothingValue = - state.dataThermalComforts->CloUnit; + comfort.ThermalComfortOpTemp = (state.dataThermalComforts->RadTemp + state.dataThermalComforts->AirTemp) / 2.0; + comfort.ClothingValue = state.dataThermalComforts->CloUnit; DynamicClothingModel(state); - state.dataThermalComforts->CloUnit = - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ClothingValue; + state.dataThermalComforts->CloUnit = comfort.ClothingValue; break; case DataHeatBalance::ClothingType::CalculationSchedule: - IntermediateClothing = - GetCurrentScheduleValue(state, state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).ClothingMethodPtr); + IntermediateClothing = people.clothingMethodSched->getCurrentVal(); if (IntermediateClothing == 1.0) { - state.dataThermalComforts->CloUnit = - GetCurrentScheduleValue(state, state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).ClothingPtr); - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ClothingValue = - state.dataThermalComforts->CloUnit; + state.dataThermalComforts->CloUnit = people.clothingSched->getCurrentVal(); + comfort.ClothingValue = state.dataThermalComforts->CloUnit; } else if (IntermediateClothing == 2.0) { - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortOpTemp = - (state.dataThermalComforts->RadTemp + state.dataThermalComforts->AirTemp) / 2.0; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ClothingValue = - state.dataThermalComforts->CloUnit; + comfort.ThermalComfortOpTemp = (state.dataThermalComforts->RadTemp + state.dataThermalComforts->AirTemp) / 2.0; + comfort.ClothingValue = state.dataThermalComforts->CloUnit; DynamicClothingModel(state); - state.dataThermalComforts->CloUnit = - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ClothingValue; + state.dataThermalComforts->CloUnit = comfort.ClothingValue; } else { - state.dataThermalComforts->CloUnit = - GetCurrentScheduleValue(state, state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).ClothingPtr); - ShowWarningError(state, - format("PEOPLE=\"{}\", Scheduled clothing value will be used rather than clothing calculation method.", - state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).Name)); + state.dataThermalComforts->CloUnit = people.clothingSched->getCurrentVal(); + ShowWarningError( + state, format("PEOPLE=\"{}\", Scheduled clothing value will be used rather than clothing calculation method.", people.Name)); } break; default: - ShowSevereError( - state, format("PEOPLE=\"{}\", Incorrect Clothing Type", state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).Name)); + ShowSevereError(state, format("PEOPLE=\"{}\", Incorrect Clothing Type", people.Name)); } if (state.dataRoomAir->anyNonMixingRoomAirModel && state.dataRoomAir->IsZoneCrossVent(state.dataThermalComforts->ZoneNum)) { @@ -626,20 +611,18 @@ namespace ThermalComfort { state.dataThermalComforts->AirVel = 0.2; } } else { - state.dataThermalComforts->AirVel = - GetCurrentScheduleValue(state, state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).AirVelocityPtr); + state.dataThermalComforts->AirVel = people.airVelocitySched->getCurrentVal(); // Ensure air velocity within the reasonable range. Otherwise reccusive warnings is provided if (present(PNum) && (state.dataThermalComforts->AirVel < 0.1 || state.dataThermalComforts->AirVel > 0.5)) { - if (state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).AirVelErrIndex == 0) { - ShowWarningMessage(state, - format("PEOPLE=\"{}\", Air velocity is beyond the reasonable range (0.1,0.5) for thermal comfort control.", - state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).Name)); + if (people.AirVelErrIndex == 0) { + ShowWarningMessage( + state, + format("PEOPLE=\"{}\", Air velocity is beyond the reasonable range (0.1,0.5) for thermal comfort control.", people.Name)); ShowContinueErrorTimeStamp(state, ""); } ShowRecurringWarningErrorAtEnd(state, - "PEOPLE=\"" + state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).Name + - "\",Air velocity is still beyond the reasonable range (0.1,0.5)", - state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).AirVelErrIndex, + "PEOPLE=\"" + people.Name + "\",Air velocity is still beyond the reasonable range (0.1,0.5)", + people.AirVelErrIndex, state.dataThermalComforts->AirVel, state.dataThermalComforts->AirVel, _, @@ -657,21 +640,18 @@ namespace ThermalComfort { state.dataThermalComforts->CloUnit, state.dataThermalComforts->WorkEff); - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).FangerPMV = PMV; - + comfort.FangerPMV = PMV; // Pass resulting PMV based on temperature setpoint (Tset) when using thermal comfort control if (present(PNum)) { PMVResult = PMV; } - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortMRT = - state.dataThermalComforts->RadTemp; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortOpTemp = - (state.dataThermalComforts->RadTemp + state.dataThermalComforts->AirTemp) / 2.0; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).CloSurfTemp = state.dataThermalComforts->CloSurfTemp; + comfort.ThermalComfortMRT = state.dataThermalComforts->RadTemp; + comfort.ThermalComfortOpTemp = (state.dataThermalComforts->RadTemp + state.dataThermalComforts->AirTemp) / 2.0; + comfort.CloSurfTemp = state.dataThermalComforts->CloSurfTemp; // Calculate the Fanger PPD (Predicted Percentage of Dissatisfied), as a % Real64 PPD = CalcFangerPPD(PMV); - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).FangerPPD = PPD; + comfort.FangerPPD = PPD; } } @@ -719,7 +699,7 @@ namespace ThermalComfort { P1 = state.dataThermalComforts->CloInsul * state.dataThermalComforts->AbsAirTemp; // p4 P4 = 308.7 - 0.028 * state.dataThermalComforts->IntHeatProd + P2 * pow_4(state.dataThermalComforts->AbsRadTemp / 100.0); // p5 - // First guess for clothed surface tempeature + // First guess for clothed surface temperature state.dataThermalComforts->AbsCloSurfTemp = state.dataThermalComforts->AbsAirTemp + (35.5 - AirTemp) / (3.5 * (CloUnit + 0.1)); XN = state.dataThermalComforts->AbsCloSurfTemp / 100.0; state.dataThermalComforts->HcFor = 12.1 * std::sqrt(AirVel); // Heat transfer coefficient by forced convection @@ -822,7 +802,10 @@ namespace ThermalComfort { void GetThermalComfortInputsASHRAE(EnergyPlusData &state) { - state.dataThermalComforts->ZoneNum = state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).ZonePtr; + auto &people = state.dataHeatBal->People(state.dataThermalComforts->PeopleNum); + auto &comfort = state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum); + + state.dataThermalComforts->ZoneNum = people.ZonePtr; auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataThermalComforts->ZoneNum); // (var TA) state.dataThermalComforts->AirTemp = thisZoneHB.ZTAVComf; @@ -838,45 +821,34 @@ namespace ThermalComfort { state.dataThermalComforts->RelHum = PsyRhFnTdbWPb(state, state.dataThermalComforts->AirTemp, thisZoneHB.airHumRatAvgComf, state.dataEnvrn->OutBaroPress); // Metabolic rate of body (W/m2) (var RM, M) - state.dataThermalComforts->ActLevel = - GetCurrentScheduleValue(state, state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).ActivityLevelPtr) / BodySurfAreaPierce; + state.dataThermalComforts->ActLevel = people.activityLevelSched->getCurrentVal() / BodySurfAreaPierce; // Energy consumption by external work (W/m2) (var WME) - state.dataThermalComforts->WorkEff = - GetCurrentScheduleValue(state, state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).WorkEffPtr) * - state.dataThermalComforts->ActLevel; + state.dataThermalComforts->WorkEff = people.workEffSched->getCurrentVal() * state.dataThermalComforts->ActLevel; // Clothing unit (var CLO) Real64 IntermediateClothing; - switch (state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).clothingType) { + switch (people.clothingType) { case DataHeatBalance::ClothingType::InsulationSchedule: - state.dataThermalComforts->CloUnit = - GetCurrentScheduleValue(state, state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).ClothingPtr); + state.dataThermalComforts->CloUnit = people.clothingSched->getCurrentVal(); break; case DataHeatBalance::ClothingType::DynamicAshrae55: - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortOpTemp = - (state.dataThermalComforts->RadTemp + state.dataThermalComforts->AirTemp) / 2.0; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ClothingValue = state.dataThermalComforts->CloUnit; + comfort.ThermalComfortOpTemp = (state.dataThermalComforts->RadTemp + state.dataThermalComforts->AirTemp) / 2.0; + comfort.ClothingValue = state.dataThermalComforts->CloUnit; DynamicClothingModel(state); - state.dataThermalComforts->CloUnit = state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ClothingValue; + state.dataThermalComforts->CloUnit = comfort.ClothingValue; break; case DataHeatBalance::ClothingType::CalculationSchedule: - IntermediateClothing = GetCurrentScheduleValue(state, state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).ClothingMethodPtr); + IntermediateClothing = people.clothingMethodSched->getCurrentVal(); if (IntermediateClothing == 1.0) { - state.dataThermalComforts->CloUnit = - GetCurrentScheduleValue(state, state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).ClothingPtr); - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ClothingValue = - state.dataThermalComforts->CloUnit; + state.dataThermalComforts->CloUnit = people.clothingSched->getCurrentVal(); + comfort.ClothingValue = state.dataThermalComforts->CloUnit; } else if (IntermediateClothing == 2.0) { - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortOpTemp = - (state.dataThermalComforts->RadTemp + state.dataThermalComforts->AirTemp) / 2.0; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ClothingValue = - state.dataThermalComforts->CloUnit; + comfort.ThermalComfortOpTemp = (state.dataThermalComforts->RadTemp + state.dataThermalComforts->AirTemp) / 2.0; + comfort.ClothingValue = state.dataThermalComforts->CloUnit; DynamicClothingModel(state); - state.dataThermalComforts->CloUnit = - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ClothingValue; + state.dataThermalComforts->CloUnit = comfort.ClothingValue; } else { - state.dataThermalComforts->CloUnit = - GetCurrentScheduleValue(state, state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).ClothingPtr); + state.dataThermalComforts->CloUnit = people.clothingSched->getCurrentVal(); ShowWarningError(state, "Scheduled clothing value will be used rather than clothing calculation method."); } break; @@ -884,8 +856,7 @@ namespace ThermalComfort { ShowSevereError(state, "Incorrect Clothing Type"); } // (var VEL) - state.dataThermalComforts->AirVel = - GetCurrentScheduleValue(state, state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).AirVelocityPtr); + state.dataThermalComforts->AirVel = people.airVelocitySched->getCurrentVal(); // (var MET) state.dataThermalComforts->ActMet = state.dataThermalComforts->ActLevel / ActLevelConv; } @@ -1011,7 +982,7 @@ namespace ThermalComfort { state.dataThermalComforts->AvgBodyTemp = SkinMassRat * state.dataThermalComforts->SkinTemp + (1.0 - SkinMassRat) * state.dataThermalComforts->CoreTemp; - Real64 SkinThermSigWarm; // vasodialtion signal (WARMS) + Real64 SkinThermSigWarm; // vasodilation signal (WARMS) Real64 SkinThermSigCold; // vasoconstriction signal Real64 SkinSignal = state.dataThermalComforts->SkinTemp - SkinTempSet; // thermoregulatory control signal from the skin if (SkinSignal > 0) { @@ -1184,8 +1155,10 @@ namespace ThermalComfort { for (state.dataThermalComforts->PeopleNum = 1; state.dataThermalComforts->PeopleNum <= state.dataHeatBal->TotPeople; ++state.dataThermalComforts->PeopleNum) { + auto &people = state.dataHeatBal->People(state.dataThermalComforts->PeopleNum); + if (!people.Pierce) continue; - if (!state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).Pierce) continue; + auto &comfort = state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum); // STEP 1: Get input (TA, TR, RH, VEL, CLO, MET, WME) GetThermalComfortInputsASHRAE(state); @@ -1205,20 +1178,19 @@ namespace ThermalComfort { state.dataThermalComforts->ThermSensTransCoef = 0.303 * std::exp(-0.036 * state.dataThermalComforts->ActLevel) + 0.028; // Fanger's reg. sweating at comfort threshold (PMV=0) is: state.dataThermalComforts->EvapHeatLossRegComf = (state.dataThermalComforts->IntHeatProd - ActLevelConv) * 0.42; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).PiercePMVET = + comfort.PiercePMVET = state.dataThermalComforts->ThermSensTransCoef * (state.dataThermalComforts->IntHeatProd - state.dataThermalComforts->RespHeatLoss - state.dataThermalComforts->DryHeatLossET - state.dataThermalComforts->EvapHeatLossDiff - state.dataThermalComforts->EvapHeatLossRegComf); - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).PiercePMVSET = + comfort.PiercePMVSET = state.dataThermalComforts->ThermSensTransCoef * (state.dataThermalComforts->IntHeatProd - state.dataThermalComforts->RespHeatLoss - state.dataThermalComforts->DryHeatLossSET - state.dataThermalComforts->EvapHeatLossDiff - state.dataThermalComforts->EvapHeatLossRegComf); // PHeat stress and heat strain indices derived from EvapHeatLoss, DISC (discomfort) varies with relative thermoregulatory strain - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).PierceDISC = - 5.0 * (state.dataThermalComforts->EvapHeatLossRegSweat - state.dataThermalComforts->EvapHeatLossRegComf) / - (state.dataThermalComforts->EvapHeatLossMax - state.dataThermalComforts->EvapHeatLossRegComf - - state.dataThermalComforts->EvapHeatLossDiff); + comfort.PierceDISC = 5.0 * (state.dataThermalComforts->EvapHeatLossRegSweat - state.dataThermalComforts->EvapHeatLossRegComf) / + (state.dataThermalComforts->EvapHeatLossMax - state.dataThermalComforts->EvapHeatLossRegComf - + state.dataThermalComforts->EvapHeatLossDiff); // Thermal sensation TSENS as function of mean body temp.- // AvgBodyTempLow is AvgBodyTemp when DISC is 0. (lower limit of zone of evap. regul.) @@ -1229,21 +1201,16 @@ namespace ThermalComfort { // TSENS=DISC=4.7 when HSI =1 00 (HSI is Belding's classic heat stress index) // In cold, DISC &TSENS are the same and neg. fct of AvgBodyTemp if (state.dataThermalComforts->AvgBodyTemp > AvgBodyTempLow) { - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).PierceTSENS = - 4.7 * (state.dataThermalComforts->AvgBodyTemp - AvgBodyTempLow) / (AvgBodyTempHigh - AvgBodyTempLow); + comfort.PierceTSENS = 4.7 * (state.dataThermalComforts->AvgBodyTemp - AvgBodyTempLow) / (AvgBodyTempHigh - AvgBodyTempLow); } else { - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).PierceTSENS = - 0.68175 * (state.dataThermalComforts->AvgBodyTemp - AvgBodyTempLow); - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).PierceDISC = - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).PierceTSENS; + comfort.PierceTSENS = 0.68175 * (state.dataThermalComforts->AvgBodyTemp - AvgBodyTempLow); + comfort.PierceDISC = comfort.PierceTSENS; } - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortMRT = - state.dataThermalComforts->RadTemp; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortOpTemp = - (state.dataThermalComforts->RadTemp + state.dataThermalComforts->AirTemp) / 2.0; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).PierceSET = SET; + comfort.ThermalComfortMRT = state.dataThermalComforts->RadTemp; + comfort.ThermalComfortOpTemp = (state.dataThermalComforts->RadTemp + state.dataThermalComforts->AirTemp) / 2.0; + comfort.PierceSET = SET; } } @@ -1254,8 +1221,10 @@ namespace ThermalComfort { for (state.dataThermalComforts->PeopleNum = 1; state.dataThermalComforts->PeopleNum <= state.dataHeatBal->TotPeople; ++state.dataThermalComforts->PeopleNum) { + auto &people = state.dataHeatBal->People(state.dataThermalComforts->PeopleNum); + if (!people.CoolingEffectASH55) continue; - if (!state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).CoolingEffectASH55) continue; + auto &comfort = state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum); // Get input (TA, TR, RH, VEL, CLO, MET, WME) GetThermalComfortInputsASHRAE(state); @@ -1266,16 +1235,16 @@ namespace ThermalComfort { CalcCoolingEffectAdjustedPMV(state, CoolingEffect, CoolingEffectAdjustedPMV); // Report. - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).CoolingEffectASH55 = CoolingEffect; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).CoolingEffectAdjustedPMVASH55 = - CoolingEffectAdjustedPMV; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).CoolingEffectAdjustedPPDASH55 = - CalcFangerPPD(CoolingEffectAdjustedPMV); + comfort.CoolingEffectASH55 = CoolingEffect; + comfort.CoolingEffectAdjustedPMVASH55 = CoolingEffectAdjustedPMV; + comfort.CoolingEffectAdjustedPPDASH55 = CalcFangerPPD(CoolingEffectAdjustedPMV); } } void CalcCoolingEffectAdjustedPMV(EnergyPlusData &state, Real64 &CoolingEffect, Real64 &CoolingEffectAdjustedPMV) { + auto &people = state.dataHeatBal->People(state.dataThermalComforts->PeopleNum); + // Calculate SET without cooling effect. Real64 RelAirVel = CalcRelativeAirVelocity(state.dataThermalComforts->AirVel, state.dataThermalComforts->ActMet); Real64 SET = CalcStandardEffectiveTemp(state, @@ -1314,13 +1283,13 @@ namespace ThermalComfort { Real64 lowerBound = 0.0; Real64 upperBound = 50.0; + // We have yet another solver? try { std::pair solverResult = boost::math::tools::bisect(ce_root_function, lowerBound, upperBound, ce_root_termination); CoolingEffect = (solverResult.first + solverResult.second) / 2; } catch (const std::exception &e) { ShowRecurringWarningErrorAtEnd(state, - "The cooling effect could not be solved for People=\"" + - state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).Name + "\"" + + "The cooling effect could not be solved for People=\"" + people.Name + "\"" + "As a result, no cooling effect will be applied to adjust the PMV and PPD results.", state.dataThermalComforts->CoolingEffectWarningInd); CoolingEffect = 0; @@ -1348,14 +1317,16 @@ namespace ThermalComfort { for (state.dataThermalComforts->PeopleNum = 1; state.dataThermalComforts->PeopleNum <= state.dataHeatBal->TotPeople; ++state.dataThermalComforts->PeopleNum) { - if (!state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).AnkleDraftASH55) continue; + auto &people = state.dataHeatBal->People(state.dataThermalComforts->PeopleNum); + if (!people.AnkleDraftASH55) continue; + + auto &comfort = state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum); GetThermalComfortInputsASHRAE(state); Real64 RelAirVel = CalcRelativeAirVelocity(state.dataThermalComforts->AirVel, state.dataThermalComforts->ActMet); Real64 PPD_AD = -1.0; if (state.dataThermalComforts->ActMet < 1.3 && state.dataThermalComforts->CloUnit < 0.7 && RelAirVel < 0.2) { - Real64 AnkleAirVel = - GetCurrentScheduleValue(state, state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).AnkleAirVelocityPtr); + Real64 AnkleAirVel = people.ankleAirVelocitySched->getCurrentVal(); Real64 PMV = CalcFangerPMV(state, state.dataThermalComforts->AirTemp, state.dataThermalComforts->RadTemp, @@ -1403,7 +1374,7 @@ namespace ThermalComfort { } } } - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).AnkleDraftPPDASH55 = PPD_AD; + comfort.AnkleDraftPPDASH55 = PPD_AD; } } @@ -1468,9 +1439,12 @@ namespace ThermalComfort { for (state.dataThermalComforts->PeopleNum = 1; state.dataThermalComforts->PeopleNum <= state.dataHeatBal->TotPeople; ++state.dataThermalComforts->PeopleNum) { // THE NEXT SIX VARIABLES WILL BE READ IN FROM INPUT DECK - if (!state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).KSU) continue; + auto &people = state.dataHeatBal->People(state.dataThermalComforts->PeopleNum); + if (!people.KSU) continue; + + auto &comfort = state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum); - state.dataThermalComforts->ZoneNum = state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).ZonePtr; + state.dataThermalComforts->ZoneNum = people.ZonePtr; auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataThermalComforts->ZoneNum); state.dataThermalComforts->AirTemp = thisZoneHB.ZTAVComf; @@ -1483,57 +1457,40 @@ namespace ThermalComfort { state.dataThermalComforts->RadTemp = CalcRadTemp(state, state.dataThermalComforts->PeopleNum); state.dataThermalComforts->RelHum = PsyRhFnTdbWPb(state, state.dataThermalComforts->AirTemp, thisZoneHB.airHumRatAvgComf, state.dataEnvrn->OutBaroPress); - state.dataThermalComforts->ActLevel = - GetCurrentScheduleValue(state, state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).ActivityLevelPtr) / BodySurfArea; - state.dataThermalComforts->WorkEff = - GetCurrentScheduleValue(state, state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).WorkEffPtr) * - state.dataThermalComforts->ActLevel; + state.dataThermalComforts->ActLevel = people.activityLevelSched->getCurrentVal() / BodySurfArea; + state.dataThermalComforts->WorkEff = people.workEffSched->getCurrentVal() * state.dataThermalComforts->ActLevel; - switch (state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).clothingType) { - case DataHeatBalance::ClothingType::InsulationSchedule: - state.dataThermalComforts->CloUnit = - GetCurrentScheduleValue(state, state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).ClothingPtr); - break; - case DataHeatBalance::ClothingType::DynamicAshrae55: - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortOpTemp = - (state.dataThermalComforts->RadTemp + state.dataThermalComforts->AirTemp) / 2.0; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ClothingValue = - state.dataThermalComforts->CloUnit; + switch (people.clothingType) { + case DataHeatBalance::ClothingType::InsulationSchedule: { + state.dataThermalComforts->CloUnit = people.clothingSched->getCurrentVal(); + } break; + case DataHeatBalance::ClothingType::DynamicAshrae55: { + comfort.ThermalComfortOpTemp = (state.dataThermalComforts->RadTemp + state.dataThermalComforts->AirTemp) / 2.0; + comfort.ClothingValue = state.dataThermalComforts->CloUnit; DynamicClothingModel(state); - state.dataThermalComforts->CloUnit = - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ClothingValue; - break; - case DataHeatBalance::ClothingType::CalculationSchedule: - IntermediateClothing = - GetCurrentScheduleValue(state, state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).ClothingMethodPtr); + state.dataThermalComforts->CloUnit = comfort.ClothingValue; + } break; + case DataHeatBalance::ClothingType::CalculationSchedule: { + IntermediateClothing = people.clothingMethodSched->getCurrentVal(); if (IntermediateClothing == 1.0) { - state.dataThermalComforts->CloUnit = - GetCurrentScheduleValue(state, state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).ClothingPtr); - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ClothingValue = - state.dataThermalComforts->CloUnit; + state.dataThermalComforts->CloUnit = people.clothingSched->getCurrentVal(); + comfort.ClothingValue = state.dataThermalComforts->CloUnit; } else if (IntermediateClothing == 2.0) { - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortOpTemp = - (state.dataThermalComforts->RadTemp + state.dataThermalComforts->AirTemp) / 2.0; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ClothingValue = - state.dataThermalComforts->CloUnit; + comfort.ThermalComfortOpTemp = (state.dataThermalComforts->RadTemp + state.dataThermalComforts->AirTemp) / 2.0; + comfort.ClothingValue = state.dataThermalComforts->CloUnit; DynamicClothingModel(state); - state.dataThermalComforts->CloUnit = - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ClothingValue; + state.dataThermalComforts->CloUnit = comfort.ClothingValue; } else { - state.dataThermalComforts->CloUnit = - GetCurrentScheduleValue(state, state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).ClothingPtr); - ShowWarningError(state, - format("PEOPLE=\"{}\", Scheduled clothing value will be used rather than clothing calculation method.", - state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).Name)); + state.dataThermalComforts->CloUnit = people.clothingSched->getCurrentVal(); + ShowWarningError( + state, format("PEOPLE=\"{}\", Scheduled clothing value will be used rather than clothing calculation method.", people.Name)); } - break; + } break; default: - ShowSevereError( - state, format("PEOPLE=\"{}\", Incorrect Clothing Type", state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).Name)); + ShowSevereError(state, format("PEOPLE=\"{}\", Incorrect Clothing Type", people.Name)); } - state.dataThermalComforts->AirVel = - GetCurrentScheduleValue(state, state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).AirVelocityPtr); + state.dataThermalComforts->AirVel = people.airVelocitySched->getCurrentVal(); state.dataThermalComforts->IntHeatProd = state.dataThermalComforts->ActLevel - state.dataThermalComforts->WorkEff; // THE FOLLOWING ARE TYPICAL VALUES SET FOR BLAST RUNS // STANDARD MAN: 70. KG WEIGHT, 1.8 M2 SURFACE AREA @@ -1598,20 +1555,16 @@ namespace ThermalComfort { // OTHERWISE NORMAL BLOOD FLOW OR VASODILATION OCCURS AND RESULTS IN // THERMAL NEUTRALITY OR WARM SENSATION. if (state.dataThermalComforts->VasodilationFac < 0) { - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).KsuTSV = - -1.46153 * state.dataThermalComforts->VasoconstrictFac + 3.74721 * pow_2(state.dataThermalComforts->VasoconstrictFac) - - 6.168856 * pow_3(state.dataThermalComforts->VasoconstrictFac); + comfort.KsuTSV = -1.46153 * state.dataThermalComforts->VasoconstrictFac + + 3.74721 * pow_2(state.dataThermalComforts->VasoconstrictFac) - + 6.168856 * pow_3(state.dataThermalComforts->VasoconstrictFac); } else { - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).KsuTSV = - (5.0 - 6.56 * (state.dataThermalComforts->RelHum - 0.50)) * SkinWetFac; - if (state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).KsuTSV > TSVMax) - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).KsuTSV = TSVMax; + comfort.KsuTSV = (5.0 - 6.56 * (state.dataThermalComforts->RelHum - 0.50)) * SkinWetFac; + if (comfort.KsuTSV > TSVMax) comfort.KsuTSV = TSVMax; } - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortMRT = - state.dataThermalComforts->RadTemp; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortOpTemp = - (state.dataThermalComforts->RadTemp + state.dataThermalComforts->AirTemp) / 2.0; + comfort.ThermalComfortMRT = state.dataThermalComforts->RadTemp; + comfort.ThermalComfortOpTemp = (state.dataThermalComforts->RadTemp + state.dataThermalComforts->AirTemp) / 2.0; state.dataThermalComforts->CoreTemp = state.dataThermalComforts->Temp(1); state.dataThermalComforts->SkinTemp = state.dataThermalComforts->Temp(2); @@ -1693,7 +1646,7 @@ namespace ThermalComfort { Real64 SkinWetSignal; // Skin wettedness signal Real64 SweatCtrlFac; // Sweat control factor Real64 SweatSuppFac; // Sweat suppression factor due to skin wettedness - Real64 WeighFac; // Weighting factor of core siganl + Real64 WeighFac; // Weighting factor of core signal // THE CONTROLLING SYSTEM. // THE CONTROLLING SIGNALS : @@ -1842,7 +1795,7 @@ namespace ThermalComfort { state.dataThermalComforts->SkinThermCap; } - void RKG(EnergyPlusData &state, int &NEQ, Real64 &H, Real64 &X, Array1D &Y, Array1D &DY, Array1D &C) + void RKG(EnergyPlusData &state, int &NEQ, Real64 const H, Real64 &X, Array1D &Y, Array1D &DY, Array1D &C) { // SUBROUTINE INFORMATION: @@ -2292,10 +2245,9 @@ namespace ThermalComfort { for (auto &e : state.dataThermalComforts->ThermalComfortInASH55) e.ZoneIsOccupied = false; // loop through the people objects and determine if the zone is currently occupied - for (iPeople = 1; iPeople <= state.dataHeatBal->TotPeople; ++iPeople) { - state.dataThermalComforts->ZoneNum = state.dataHeatBal->People(iPeople).ZonePtr; - NumberOccupants = state.dataHeatBal->People(iPeople).NumberOfPeople * - GetCurrentScheduleValue(state, state.dataHeatBal->People(iPeople).NumberOfPeoplePtr); + for (auto const &people : state.dataHeatBal->People) { + state.dataThermalComforts->ZoneNum = people.ZonePtr; + NumberOccupants = people.NumberOfPeople * people.sched->getCurrentVal(); if (NumberOccupants > 0) { state.dataThermalComforts->ThermalComfortInASH55(state.dataThermalComforts->ZoneNum).ZoneIsOccupied = true; } @@ -2500,8 +2452,8 @@ namespace ThermalComfort { // Using/Aliasing using namespace OutputReportPredefined; - auto &deviationFromSetPtThresholdClg = state.dataHVACGlobal->deviationFromSetPtThresholdClg; - auto &deviationFromSetPtThresholdHtg = state.dataHVACGlobal->deviationFromSetPtThresholdHtg; + Real64 const deviationFromSetPtThresholdClg = state.dataHVACGlobal->deviationFromSetPtThresholdClg; + Real64 const deviationFromSetPtThresholdHtg = state.dataHVACGlobal->deviationFromSetPtThresholdHtg; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 SensibleLoadPredictedNoAdj; @@ -2518,25 +2470,25 @@ namespace ThermalComfort { state.dataThermalComforts->AnyZoneNotMetHeatingOccupied = 0.0; state.dataThermalComforts->AnyZoneNotMetCoolingOccupied = 0.0; for (iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { + auto const &zoneTstatSetpt = state.dataHeatBalFanSys->zoneTstatSetpts(iZone); + SensibleLoadPredictedNoAdj = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(iZone).TotalOutputRequired; state.dataThermalComforts->ThermalComfortSetPoint(iZone).notMetCooling = 0.0; state.dataThermalComforts->ThermalComfortSetPoint(iZone).notMetHeating = 0.0; state.dataThermalComforts->ThermalComfortSetPoint(iZone).notMetCoolingOccupied = 0.0; state.dataThermalComforts->ThermalComfortSetPoint(iZone).notMetHeatingOccupied = 0.0; - testHeating = (state.dataHeatBalFanSys->TempControlType(iZone) != HVAC::ThermostatType::SingleCooling); - testCooling = (state.dataHeatBalFanSys->TempControlType(iZone) != HVAC::ThermostatType::SingleHeating); + testHeating = (state.dataHeatBalFanSys->TempControlType(iZone) != HVAC::SetptType::SingleCool); + testCooling = (state.dataHeatBalFanSys->TempControlType(iZone) != HVAC::SetptType::SingleHeat); if (testHeating && (SensibleLoadPredictedNoAdj > 0)) { // heating if (state.dataRoomAir->AirModel(iZone).AirModel != RoomAir::RoomAirModel::Mixing) { - deltaT = state.dataHeatBalFanSys->TempTstatAir(iZone) - state.dataHeatBalFanSys->ZoneThermostatSetPointLo(iZone); + deltaT = state.dataHeatBalFanSys->TempTstatAir(iZone) - zoneTstatSetpt.setptLo; } else { if (state.dataZoneTempPredictorCorrector->NumOnOffCtrZone > 0) { - deltaT = state.dataZoneTempPredictorCorrector->zoneHeatBalance(iZone).ZTAV - - state.dataHeatBalFanSys->ZoneThermostatSetPointLoAver(iZone); + deltaT = state.dataZoneTempPredictorCorrector->zoneHeatBalance(iZone).ZTAV - zoneTstatSetpt.setptLoAver; } else { - deltaT = state.dataZoneTempPredictorCorrector->zoneHeatBalance(iZone).ZTAV - - state.dataHeatBalFanSys->ZoneThermostatSetPointLo(iZone); + deltaT = state.dataZoneTempPredictorCorrector->zoneHeatBalance(iZone).ZTAV - zoneTstatSetpt.setptLo; } } if (deltaT < deviationFromSetPtThresholdHtg) { @@ -2555,14 +2507,12 @@ namespace ThermalComfort { } } else if (testCooling && (SensibleLoadPredictedNoAdj < 0)) { // cooling if (state.dataRoomAir->AirModel(iZone).AirModel != RoomAir::RoomAirModel::Mixing) { - deltaT = state.dataHeatBalFanSys->TempTstatAir(iZone) - state.dataHeatBalFanSys->ZoneThermostatSetPointHi(iZone); + deltaT = state.dataHeatBalFanSys->TempTstatAir(iZone) - zoneTstatSetpt.setptHi; } else { if (state.dataZoneTempPredictorCorrector->NumOnOffCtrZone > 0) { - deltaT = state.dataZoneTempPredictorCorrector->zoneHeatBalance(iZone).ZTAV - - state.dataHeatBalFanSys->ZoneThermostatSetPointHiAver(iZone); + deltaT = state.dataZoneTempPredictorCorrector->zoneHeatBalance(iZone).ZTAV - zoneTstatSetpt.setptHiAver; } else { - deltaT = state.dataZoneTempPredictorCorrector->zoneHeatBalance(iZone).ZTAV - - state.dataHeatBalFanSys->ZoneThermostatSetPointHi(iZone); + deltaT = state.dataZoneTempPredictorCorrector->zoneHeatBalance(iZone).ZTAV - zoneTstatSetpt.setptHi; } } @@ -2863,8 +2813,13 @@ namespace ThermalComfort { for (state.dataThermalComforts->PeopleNum = 1; state.dataThermalComforts->PeopleNum <= state.dataHeatBal->TotPeople; ++state.dataThermalComforts->PeopleNum) { - if (!state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).AdaptiveASH55) continue; - state.dataThermalComforts->ZoneNum = state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).ZonePtr; + + auto &people = state.dataHeatBal->People(state.dataThermalComforts->PeopleNum); + if (!people.AdaptiveASH55) continue; + + auto &comfort = state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum); + + state.dataThermalComforts->ZoneNum = people.ZonePtr; state.dataThermalComforts->AirTemp = state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataThermalComforts->ZoneNum).ZTAVComf; if (state.dataRoomAir->anyNonMixingRoomAirModel) { if (state.dataRoomAir->IsZoneDispVent3Node(state.dataThermalComforts->ZoneNum) || @@ -2874,43 +2829,40 @@ namespace ThermalComfort { } state.dataThermalComforts->RadTemp = CalcRadTemp(state, state.dataThermalComforts->PeopleNum); state.dataThermalComforts->OpTemp = (state.dataThermalComforts->AirTemp + state.dataThermalComforts->RadTemp) / 2.0; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortOpTemp = - state.dataThermalComforts->OpTemp; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ASHRAE55RunningMeanOutdoorTemp = - state.dataThermalComforts->runningAverageASH; + comfort.ThermalComfortOpTemp = state.dataThermalComforts->OpTemp; + comfort.ASHRAE55RunningMeanOutdoorTemp = state.dataThermalComforts->runningAverageASH; if (state.dataThermalComforts->runningAverageASH >= 10.0 && state.dataThermalComforts->runningAverageASH <= 33.5) { // Calculate the comfort here (people/output handling loop) - numOccupants = state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).NumberOfPeople * - GetCurrentScheduleValue(state, state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).NumberOfPeoplePtr); + numOccupants = people.NumberOfPeople * people.sched->getCurrentVal(); tComf = 0.31 * state.dataThermalComforts->runningAverageASH + 17.8; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).TComfASH55 = tComf; + comfort.TComfASH55 = tComf; if (numOccupants > 0) { if (state.dataThermalComforts->OpTemp < tComf + 2.5 && state.dataThermalComforts->OpTemp > tComf - 2.5) { // 80% and 90% limits okay - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveASH5590 = 1; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveASH5580 = 1; + comfort.ThermalComfortAdaptiveASH5590 = 1; + comfort.ThermalComfortAdaptiveASH5580 = 1; } else if (state.dataThermalComforts->OpTemp < tComf + 3.5 && state.dataThermalComforts->OpTemp > tComf - 3.5) { // 80% only - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveASH5590 = 0; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveASH5580 = 1; - state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).TimeNotMetASH5590 += SysTimeElapsed; + comfort.ThermalComfortAdaptiveASH5590 = 0; + comfort.ThermalComfortAdaptiveASH5580 = 1; + people.TimeNotMetASH5590 += SysTimeElapsed; } else { // Neither - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveASH5590 = 0; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveASH5580 = 0; - state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).TimeNotMetASH5580 += SysTimeElapsed; - state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).TimeNotMetASH5590 += SysTimeElapsed; + comfort.ThermalComfortAdaptiveASH5590 = 0; + comfort.ThermalComfortAdaptiveASH5580 = 0; + people.TimeNotMetASH5580 += SysTimeElapsed; + people.TimeNotMetASH5590 += SysTimeElapsed; } } else { // Unoccupied - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveASH5590 = -1; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveASH5580 = -1; + comfort.ThermalComfortAdaptiveASH5590 = -1; + comfort.ThermalComfortAdaptiveASH5580 = -1; } } else { // Monthly temp out of range - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveASH5590 = -1; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveASH5580 = -1; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).TComfASH55 = -1.0; + comfort.ThermalComfortAdaptiveASH5590 = -1; + comfort.ThermalComfortAdaptiveASH5580 = -1; + comfort.TComfASH55 = -1.0; } } } @@ -3074,8 +3026,11 @@ namespace ThermalComfort { for (state.dataThermalComforts->PeopleNum = 1; state.dataThermalComforts->PeopleNum <= state.dataHeatBal->TotPeople; ++state.dataThermalComforts->PeopleNum) { - if (!state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).AdaptiveCEN15251) continue; - state.dataThermalComforts->ZoneNum = state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).ZonePtr; + auto &people = state.dataHeatBal->People(state.dataThermalComforts->PeopleNum); + if (!people.AdaptiveCEN15251) continue; + + auto &comfort = state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum); + state.dataThermalComforts->ZoneNum = people.ZonePtr; state.dataThermalComforts->AirTemp = state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataThermalComforts->ZoneNum).ZTAVComf; if (state.dataRoomAir->anyNonMixingRoomAirModel) { if (state.dataRoomAir->IsZoneDispVent3Node(state.dataThermalComforts->ZoneNum) || @@ -3085,16 +3040,13 @@ namespace ThermalComfort { } state.dataThermalComforts->RadTemp = CalcRadTemp(state, state.dataThermalComforts->PeopleNum); state.dataThermalComforts->OpTemp = (state.dataThermalComforts->AirTemp + state.dataThermalComforts->RadTemp) / 2.0; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortOpTemp = - state.dataThermalComforts->OpTemp; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).CEN15251RunningMeanOutdoorTemp = - state.dataThermalComforts->runningAverageCEN; + comfort.ThermalComfortOpTemp = state.dataThermalComforts->OpTemp; + comfort.CEN15251RunningMeanOutdoorTemp = state.dataThermalComforts->runningAverageCEN; if (state.dataThermalComforts->runningAverageCEN >= 10.0 && state.dataThermalComforts->runningAverageCEN <= 30.0) { // Calculate the comfort here (people/output handling loop) - numOccupants = state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).NumberOfPeople * - GetCurrentScheduleValue(state, state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).NumberOfPeoplePtr); + numOccupants = people.NumberOfPeople * people.sched->getCurrentVal(); tComf = 0.33 * state.dataThermalComforts->runningAverageCEN + 18.8; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).TComfCEN15251 = tComf; + comfort.TComfCEN15251 = tComf; if (numOccupants > 0) { if (state.dataThermalComforts->runningAverageCEN < 15) { tComfLow = 23.75; // Lower limit is constant in this region @@ -3103,43 +3055,43 @@ namespace ThermalComfort { } if (state.dataThermalComforts->OpTemp < tComf + 2.0 && state.dataThermalComforts->OpTemp > tComfLow - 2.0) { // Within Cat I, II, III Limits - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveCEN15251CatI = 1; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveCEN15251CatII = 1; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveCEN15251CatIII = 1; + comfort.ThermalComfortAdaptiveCEN15251CatI = 1; + comfort.ThermalComfortAdaptiveCEN15251CatII = 1; + comfort.ThermalComfortAdaptiveCEN15251CatIII = 1; } else if (state.dataThermalComforts->OpTemp < tComf + 3.0 && state.dataThermalComforts->OpTemp > tComfLow - 3.0) { // Within Cat II, III Limits - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveCEN15251CatI = 0; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveCEN15251CatII = 1; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveCEN15251CatIII = 1; - state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).TimeNotMetCEN15251CatI += SysTimeElapsed; + comfort.ThermalComfortAdaptiveCEN15251CatI = 0; + comfort.ThermalComfortAdaptiveCEN15251CatII = 1; + comfort.ThermalComfortAdaptiveCEN15251CatIII = 1; + people.TimeNotMetCEN15251CatI += SysTimeElapsed; } else if (state.dataThermalComforts->OpTemp < tComf + 4.0 && state.dataThermalComforts->OpTemp > tComfLow - 4.0) { // Within Cat III Limits - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveCEN15251CatI = 0; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveCEN15251CatII = 0; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveCEN15251CatIII = 1; - state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).TimeNotMetCEN15251CatI += SysTimeElapsed; - state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).TimeNotMetCEN15251CatII += SysTimeElapsed; + comfort.ThermalComfortAdaptiveCEN15251CatI = 0; + comfort.ThermalComfortAdaptiveCEN15251CatII = 0; + comfort.ThermalComfortAdaptiveCEN15251CatIII = 1; + people.TimeNotMetCEN15251CatI += SysTimeElapsed; + people.TimeNotMetCEN15251CatII += SysTimeElapsed; } else { // None - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveCEN15251CatI = 0; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveCEN15251CatII = 0; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveCEN15251CatIII = 0; - state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).TimeNotMetCEN15251CatI += SysTimeElapsed; - state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).TimeNotMetCEN15251CatII += SysTimeElapsed; - state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).TimeNotMetCEN15251CatIII += SysTimeElapsed; + comfort.ThermalComfortAdaptiveCEN15251CatI = 0; + comfort.ThermalComfortAdaptiveCEN15251CatII = 0; + comfort.ThermalComfortAdaptiveCEN15251CatIII = 0; + people.TimeNotMetCEN15251CatI += SysTimeElapsed; + people.TimeNotMetCEN15251CatII += SysTimeElapsed; + people.TimeNotMetCEN15251CatIII += SysTimeElapsed; } } else { // Unoccupied - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveCEN15251CatI = -1; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveCEN15251CatII = -1; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveCEN15251CatIII = -1; + comfort.ThermalComfortAdaptiveCEN15251CatI = -1; + comfort.ThermalComfortAdaptiveCEN15251CatII = -1; + comfort.ThermalComfortAdaptiveCEN15251CatIII = -1; } } else { // Monthly temp out of range - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveCEN15251CatI = -1; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveCEN15251CatII = -1; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ThermalComfortAdaptiveCEN15251CatIII = -1; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).TComfCEN15251 = -1.0; + comfort.ThermalComfortAdaptiveCEN15251CatI = -1; + comfort.ThermalComfortAdaptiveCEN15251CatII = -1; + comfort.ThermalComfortAdaptiveCEN15251CatIII = -1; + comfort.TComfCEN15251 = -1.0; } } } @@ -3151,18 +3103,19 @@ namespace ThermalComfort { // DATE WRITTEN June 2013 // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 TemporaryVariable; + Real64 TemporaryVariable; // LOL + + auto &comfort = state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum); - if (state.dataThermalComforts->TemporarySixAMTemperature < -5.0) { - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ClothingValue = 1.0; + if (state.dataThermalComforts->TemporarySixAMTemperature < -5.0) { // A Temporary state variable? + comfort.ClothingValue = 1.0; } else if ((state.dataThermalComforts->TemporarySixAMTemperature >= -5.0) && (state.dataThermalComforts->TemporarySixAMTemperature < 5.0)) { - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ClothingValue = - 0.818 - 0.0364 * state.dataThermalComforts->TemporarySixAMTemperature; + comfort.ClothingValue = 0.818 - 0.0364 * state.dataThermalComforts->TemporarySixAMTemperature; } else if ((state.dataThermalComforts->TemporarySixAMTemperature >= 5.0) && (state.dataThermalComforts->TemporarySixAMTemperature < 26.0)) { TemporaryVariable = -0.1635 - 0.0066 * state.dataThermalComforts->TemporarySixAMTemperature; - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ClothingValue = std::pow(10.0, TemporaryVariable); + comfort.ClothingValue = std::pow(10.0, TemporaryVariable); } else if (state.dataThermalComforts->TemporarySixAMTemperature >= 26.0) { - state.dataThermalComforts->ThermalComfortData(state.dataThermalComforts->PeopleNum).ClothingValue = 0.46; + comfort.ClothingValue = 0.46; } } diff --git a/src/EnergyPlus/ThermalComfort.hh b/src/EnergyPlus/ThermalComfort.hh index bf0ef945328..48e9b9945f7 100644 --- a/src/EnergyPlus/ThermalComfort.hh +++ b/src/EnergyPlus/ThermalComfort.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -207,7 +207,7 @@ namespace ThermalComfort { Array1D &TempChange // Change of temperature ); - void RKG(EnergyPlusData &state, int &NEQ, Real64 &H, Real64 &X, Array1D &Y, Array1D &DY, Array1D &C); + void RKG(EnergyPlusData &state, int &NEQ, Real64 const H, Real64 &X, Array1D &Y, Array1D &DY, Array1D &C); void GetAngleFactorList(EnergyPlusData &state); @@ -376,6 +376,10 @@ struct ThermalComfortsData : BaseGlobalStruct bool useEpwDataCEN = false; bool firstDaySet = false; // first day is set with initiate -- so do not update + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ThermalEN673Calc.cc b/src/EnergyPlus/ThermalEN673Calc.cc index c1a4ef1bdd1..d5717ffe236 100644 --- a/src/EnergyPlus/ThermalEN673Calc.cc +++ b/src/EnergyPlus/ThermalEN673Calc.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -47,7 +47,6 @@ // ObjexxFCL Headers #include -#include // EnergyPlus Headers #include @@ -412,7 +411,7 @@ namespace ThermalEN673Calc { standard, nperr, ErrorMessage); - Gr(i) = (Constant::GravityConstant * pow_3(gap(i)) * dT(i) * pow_2(dens)) / (Tm * pow_2(visc)); + Gr(i) = (Constant::Gravity * pow_3(gap(i)) * dT(i) * pow_2(dens)) / (Tm * pow_2(visc)); Ra(i) = Gr(i) * pr; Nu(i) = A * std::pow(Ra(i), n); if (Nu(i) < 1.0) { @@ -481,7 +480,7 @@ namespace ThermalEN673Calc { standard, nperr, ErrorMessage); - Gr(i) = (Constant::GravityConstant * pow_3(gap(i)) * dT(i) * pow_2(dens)) / (Tm * pow_2(visc)); + Gr(i) = (Constant::Gravity * pow_3(gap(i)) * dT(i) * pow_2(dens)) / (Tm * pow_2(visc)); Ra(i) = Gr(i) * pr; Nu(i) = A * std::pow(Ra(i), n); if (Nu(i) < 1.0) { diff --git a/src/EnergyPlus/ThermalEN673Calc.hh b/src/EnergyPlus/ThermalEN673Calc.hh index 243a4199d9d..30551ccd998 100644 --- a/src/EnergyPlus/ThermalEN673Calc.hh +++ b/src/EnergyPlus/ThermalEN673Calc.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/ThermalISO15099Calc.cc b/src/EnergyPlus/ThermalISO15099Calc.cc index 2318fc0eaee..4f2f50e9991 100644 --- a/src/EnergyPlus/ThermalISO15099Calc.cc +++ b/src/EnergyPlus/ThermalISO15099Calc.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -48,9 +48,6 @@ // C++ Headers #include -// ObjexxFCL Headers -#include - // EnergyPlus Headers #include #include @@ -79,7 +76,7 @@ namespace EnergyPlus::ThermalISO15099Calc { // RE-ENGINEERED March/27/2012, Simon Vidanovic // Revision: 7.0.13 (March/27/2012), Simon Vidanovic -// - feature: New set of equaitons is set instead of hhat coefficents and new approach to solution which improves +// - feature: New set of equations is set instead of hhat coefficients and new approach to solution which improves // speed and stability. Note that this solution does not include laminates // PURPOSE OF THIS MODULE: @@ -1212,8 +1209,8 @@ void therm1d(EnergyPlusData &state, Real64 &hrin, Real64 &hcout, Real64 &hrout, - Real64 &hin, - Real64 &hout, + Real64 const hin, + Real64 const hout, Array1D &hcgas, Array1D &hrgas, Real64 &ufactor, @@ -1309,7 +1306,7 @@ void therm1d(EnergyPlusData &state, // b Array // hhat Vector // err iteration tolerance - // dtmax max temp dfference after iteration + // dtmax max temp difference after iteration // index iteration step // Using @@ -1339,7 +1336,7 @@ void therm1d(EnergyPlusData &state, Array1D x({1, 4 * nlayer}); // temporary vector for storing results (theta and Radiation). used for easier handling Array1D dX({1, 4 * nlayer}, 0.0); // difference in results - Array2D Jacobian({1, 4 * nlayer}, {1, 4 * nlayer}); // diagonal vector for jacobian comuptation-free newton method + Array2D Jacobian({1, 4 * nlayer}, {1, 4 * nlayer}); // diagonal vector for jacobian computation-free newton method Array1D DRes({1, 4 * nlayer}); // used in jacobian forward-difference approximation // This is used to store matrix before equation solver. It is important because solver destroys @@ -1800,7 +1797,7 @@ void therm1d(EnergyPlusData &state, } // f (currentTry == NumOfTries) then } - // Chek if results were found: + // Check if results were found: if (curDifference < ConvergenceTolerance) { CalcOutcome = CalculationOutcome::OK; TotalIndex += index; @@ -2063,7 +2060,7 @@ void solarISO15099(Real64 const totsol, Real64 const rtot, const Array1D // This subroutine calculates the shading coefficient for a window. //*********************************************************************** // Inputs: - // absol array of absorped fraction of solar radiation in lites + // absol array of absorbed fraction of solar radiation in lites // totsol total solar transmittance // rtot total thermal resistance of window // rs array of thermal resistances of each gap and layer @@ -2109,7 +2106,7 @@ void resist(int const nlayer, Real64 const tind, const Array1D &hcgas, const Array1D &hrgas, - Array1D &Theta, + Array1D const &Theta, Array1D &qlayer, const Array1D &qv, const Array1D &LayerType, @@ -2177,18 +2174,18 @@ void hatter(EnergyPlusData &state, Real64 const wsi, Real64 const VacuumPressure, Real64 const VacuumMaxGapThickness, - Real64 &ebsky, + Real64 const ebsky, Real64 &tamb, - Real64 &ebroom, + Real64 const ebroom, Real64 &troom, const Array1D &gap, Real64 const height, Real64 const heightt, const Array1D &scon, Real64 const tilt, - Array1D &theta, + Array1D const &theta, const Array1D &Tgap, - Array1D &Radiation, + Array1D const &Radiation, Real64 const trmout, Real64 const trmin, Array2_int const &iprop, @@ -2409,8 +2406,8 @@ void effectiveLayerCond(EnergyPlusData &state, Array2A const gcon, // Gas specific conductivity Array2A const gvis, // Gas specific viscosity Array2A const gcp, // Gas specific heat - const Array1D &EffectiveOpenness, // Layer effective openneess [m2] - Array1D &theta, // Layer surface tempeartures [K] + const Array1D &EffectiveOpenness, // Layer effective openness [m2] + Array1D const &theta, // Layer surface temperatures [K] Array1D &sconScaled, // Layer conductivity divided by thickness int &nperr, // Error message flag std::string &ErrorMessage // Error message @@ -2492,9 +2489,9 @@ void filmi(EnergyPlusData &state, // presure // nmix vector of number of gasses in a mixture for each gap // Output - // hcin - indoor convecive heat transfer coeff + // hcin - indoor convective heat transfer coeff - // If there is forced air in the room than use SPC142 corelation 5.49 to calculate the room side film coefficient. + // If there is forced air in the room than use SPC142 correlation 5.49 to calculate the room side film coefficient. // Using // Argument array dimensioning @@ -2565,7 +2562,7 @@ void filmi(EnergyPlusData &state, // Calculate grashoff number: // The grashoff number is the Rayleigh Number (equation 5.29) in SPC142 divided by the Prandtl Number (prand): - gr = Constant::GravityConstant * pow_3(height) * delt * pow_2(dens) / (tmean * pow_2(visc)); + gr = Constant::Gravity * pow_3(height) * delt * pow_2(dens) / (tmean * pow_2(visc)); RaL = gr * pr; // write(*,*)' RaCrit,RaL,gr,pr ' @@ -2623,7 +2620,7 @@ void filmg(EnergyPlusData &state, std::string &ErrorMessage) { //*********************************************************************** - // sobroutine to calculate effective conductance of gaps + // subroutine to calculate effective conductance of gaps //*********************************************************************** // Inputs: // tilt window angle (deg) @@ -2720,7 +2717,7 @@ void filmg(EnergyPlusData &state, // Calculate grashoff number: // The grashoff number is the Rayleigh Number (equation 5.29) in SPC142 divided by the Prandtl Number (prand): - ra = Constant::GravityConstant * pow_3(gap(i)) * delt * cp * pow_2(dens) / (tmean * visc * con); + ra = Constant::Gravity * pow_3(gap(i)) * delt * cp * pow_2(dens) / (tmean * visc * con); Rayleigh(i) = ra; // write(*,*) 'height,gap(i),asp',height,gap(i),asp // asp = 1 @@ -2786,7 +2783,7 @@ void filmPillar(EnergyPlusData &state, (pow_2(PillarSpacing(state.dataThermalISO15099Calc->iFP)) * (1.0 + 2.0 * gap(state.dataThermalISO15099Calc->iFP) / (Constant::Pi * PillarRadius(state.dataThermalISO15099Calc->iFP)))); - // It is important to add on prevoius values caluculated for gas + // It is important to add on previous values calculated for gas hcgas(state.dataThermalISO15099Calc->iFP + 1) += state.dataThermalISO15099Calc->cpa; } // if (SupportPillar(i).eq.YES_SupportPillar) then } diff --git a/src/EnergyPlus/ThermalISO15099Calc.hh b/src/EnergyPlus/ThermalISO15099Calc.hh index 97acd49a3c0..e36075d17dc 100644 --- a/src/EnergyPlus/ThermalISO15099Calc.hh +++ b/src/EnergyPlus/ThermalISO15099Calc.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -215,8 +215,8 @@ namespace ThermalISO15099Calc { Real64 &hrin, Real64 &hcout, Real64 &hrout, - Real64 &hin, - Real64 &hout, + Real64 const hin, + Real64 const hout, Array1D &hcgas, Array1D &hrgas, Real64 &ufactor, @@ -274,7 +274,7 @@ namespace ThermalISO15099Calc { Real64 tind, const Array1D &hcgas, const Array1D &hrgas, - Array1D &Theta, + Array1D const &Theta, Array1D &qlayer, const Array1D &qv, const Array1D &LayerType, @@ -294,18 +294,18 @@ namespace ThermalISO15099Calc { Real64 wsi, Real64 VacuumPressure, Real64 VacuumMaxGapThickness, - Real64 &ebsky, + Real64 const ebsky, Real64 &tamb, - Real64 &ebroom, + Real64 const ebroom, Real64 &troom, const Array1D &gap, Real64 height, Real64 heightt, const Array1D &scon, Real64 tilt, - Array1D &theta, + Array1D const &theta, const Array1D &Tgap, - Array1D &Radiation, + Array1D const &Radiation, Real64 trmout, Real64 trmin, Array2_int const &iprop, @@ -350,7 +350,7 @@ namespace ThermalISO15099Calc { Array2A gvis, // Gas specific viscosity Array2A gcp, // Gas specific heat const Array1D &EffectiveOpenness, // Layer effective openneess [m2] - Array1D &theta, // Layer surface tempeartures [K] + Array1D const &theta, // Layer surface tempeartures [K] Array1D &sconScaled, // Layer conductivity divided by thickness int &nperr, // Error message flag std::string &ErrorMessage // Error message @@ -544,6 +544,10 @@ struct ThermalISO15099CalcData : BaseGlobalStruct int kFP = 0; std::string dynFormat; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/Timer.cc b/src/EnergyPlus/Timer.cc index e93a8465fdf..3e5d56a0297 100644 --- a/src/EnergyPlus/Timer.cc +++ b/src/EnergyPlus/Timer.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -49,7 +49,7 @@ #include #ifndef NDEBUG -#include +# include #endif namespace EnergyPlus { diff --git a/src/EnergyPlus/Timer.hh b/src/EnergyPlus/Timer.hh index 2fbd705ffd7..4de7c7ddb88 100644 --- a/src/EnergyPlus/Timer.hh +++ b/src/EnergyPlus/Timer.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/TranspiredCollector.cc b/src/EnergyPlus/TranspiredCollector.cc index aacbbd87e55..d4647522fcc 100644 --- a/src/EnergyPlus/TranspiredCollector.cc +++ b/src/EnergyPlus/TranspiredCollector.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -51,7 +51,6 @@ // ObjexxFCL Headers #include -#include #include // EnergyPlus Headers @@ -92,7 +91,7 @@ namespace TranspiredCollector { // RE-ENGINEERED na // PURPOSE OF THIS MODULE: - // Ecapsulates data and routines for simulating unglazed transpired solar collectors (UTSC) + // Encapsulates data and routines for simulating unglazed transpired solar collectors (UTSC) // as a component on the HVAC air system. // METHODOLOGY EMPLOYED: @@ -141,8 +140,6 @@ namespace TranspiredCollector { // Using/Aliasing using HVAC::TempControlTol; - using ScheduleManager::GetCurrentScheduleValue; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int UTSCNum(0); // local number index for UTSC @@ -188,8 +185,7 @@ namespace TranspiredCollector { auto &InletNode = UTSC_CI.InletNode; auto &ControlNode = UTSC_CI.ControlNode; UTSC_CI.IsOn = false; - if ((GetCurrentScheduleValue(state, UTSC_CI.SchedPtr) > 0.0) && - (UTSC_CI.InletMDot > 0.0)) { // availability Schedule | OA system is setting mass flow + if ((UTSC_CI.availSched->getCurrentVal() > 0.0) && (UTSC_CI.InletMDot > 0.0)) { // availability Schedule | OA system is setting mass flow bool ControlLTSet(false); bool ControlLTSchedule(false); bool ZoneLTSchedule(false); @@ -198,10 +194,9 @@ namespace TranspiredCollector { for (int i = InletNode.l(), e = InletNode.u(); i <= e; ++i) { if (state.dataLoopNodes->Node(InletNode(i)).Temp + TempControlTol < state.dataLoopNodes->Node(ControlNode(i)).TempSetPoint) ControlLTSet = true; - if (state.dataLoopNodes->Node(InletNode(i)).Temp + TempControlTol < GetCurrentScheduleValue(state, UTSC_CI.FreeHeatSetPointSchedPtr)) + if (state.dataLoopNodes->Node(InletNode(i)).Temp + TempControlTol < UTSC_CI.freeHeatSetPointSched->getCurrentVal()) ControlLTSchedule = true; - if (state.dataLoopNodes->Node(UTSC_CI.ZoneNode(i)).Temp + TempControlTol < - GetCurrentScheduleValue(state, UTSC_CI.FreeHeatSetPointSchedPtr)) + if (state.dataLoopNodes->Node(UTSC_CI.ZoneNode(i)).Temp + TempControlTol < UTSC_CI.freeHeatSetPointSched->getCurrentVal()) ZoneLTSchedule = true; } if (ControlLTSet || (ControlLTSchedule && ZoneLTSchedule)) @@ -233,13 +228,14 @@ namespace TranspiredCollector { // usual EnergyPlus input // Extensible UTSC object for underlying heat transfer surfaces and for multisystem + static constexpr std::string_view routineName = "GetTranspiredCollectorInput"; + // Using/Aliasing using BranchNodeConnections::TestCompSet; using DataLoopNode::ObjectIsNotParent; using DataSurfaces::OtherSideCondModeledExt; using DataSurfaces::SurfaceData; using NodeInputManager::GetOnlySingleNode; - using ScheduleManager::GetScheduleIndex; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: @@ -249,9 +245,9 @@ namespace TranspiredCollector { Array1D Numbers(11); // Numeric items for object int NumAlphas; // Number of Alphas for each GetObjectItem call int NumNumbers; // Number of Numbers for each GetObjectItem call - int MaxNumAlphas; // argumenet for call to GetObjectDefMaxArgs - int MaxNumNumbers; // argumenet for call to GetObjectDefMaxArgs - int Dummy; // argumenet for call to GetObjectDefMaxArgs + int MaxNumAlphas; // argument for call to GetObjectDefMaxArgs + int MaxNumNumbers; // argument for call to GetObjectDefMaxArgs + int Dummy; // argument for call to GetObjectDefMaxArgs int IOStatus; // Used in GetObjectItem bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine int Found; @@ -270,8 +266,8 @@ namespace TranspiredCollector { Array1D NumbersSplit(1); // Numeric items for object int NumAlphasSplit; // Number of Alphas for each GetObjectItem call int NumNumbersSplit; // Number of Numbers for each GetObjectItem call - int MaxNumAlphasSplit; // argumenet for call to GetObjectDefMaxArgs - int MaxNumNumbersSplit; // argumenet for call to GetObjectDefMaxArgs + int MaxNumAlphasSplit; // argument for call to GetObjectDefMaxArgs + int MaxNumNumbersSplit; // argument for call to GetObjectDefMaxArgs int IOStatusSplit; // Used in GetObjectItem int NumOASys; // do loop counter int ACountBase; // counter for alhpasSplit @@ -315,6 +311,8 @@ namespace TranspiredCollector { state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + // first handle alphas state.dataTranspiredCollector->UTSC(Item).Name = Alphas(1); @@ -423,19 +421,11 @@ namespace TranspiredCollector { } state.dataTranspiredCollector->UTSC(Item).OSCMPtr = Found; if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { - state.dataTranspiredCollector->UTSC(Item).SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - state.dataTranspiredCollector->UTSC(Item).SchedPtr = GetScheduleIndex(state, Alphas(3)); - if (state.dataTranspiredCollector->UTSC(Item).SchedPtr == 0) { - ShowSevereError(state, - format("{}not found={} in {} ={}", - state.dataIPShortCut->cAlphaFieldNames(3), - Alphas(3), - CurrentModuleObject, - state.dataTranspiredCollector->UTSC(Item).Name)); - ErrorsFound = true; - continue; - } + state.dataTranspiredCollector->UTSC(Item).availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((state.dataTranspiredCollector->UTSC(Item).availSched = Sched::GetSchedule(state, Alphas(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), Alphas(3)); + ErrorsFound = true; + continue; } // now if UTSC(Item)%NumOASysAttached still not set, assume no multisystem @@ -494,14 +484,11 @@ namespace TranspiredCollector { ObjectIsNotParent); } // no splitter - state.dataTranspiredCollector->UTSC(Item).FreeHeatSetPointSchedPtr = GetScheduleIndex(state, Alphas(8)); - if (state.dataTranspiredCollector->UTSC(Item).FreeHeatSetPointSchedPtr == 0) { - ShowSevereError(state, - format("{} not found={} in {} ={}", - state.dataIPShortCut->cAlphaFieldNames(8), - Alphas(8), - CurrentModuleObject, - state.dataTranspiredCollector->UTSC(Item).Name)); + if (state.dataIPShortCut->lAlphaFieldBlanks(8)) { + ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(8)); + ErrorsFound = true; + } else if ((state.dataTranspiredCollector->UTSC(Item).freeHeatSetPointSched = Sched::GetSchedule(state, Alphas(8))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(8), Alphas(8)); ErrorsFound = true; continue; } @@ -634,7 +621,7 @@ namespace TranspiredCollector { if (ErrorsFound) continue; // previous inner do loop may have detected problems that need to be cycle'd again to avoid crash - // now that we should have all the surfaces, do some preperations and checks. + // now that we should have all the surfaces, do some preparations and checks. // are they all similar tilt and azimuth? Issue warnings so people can do it if they really want Real64 const surfaceArea(sum_sub(state.dataSurface->Surface, &SurfaceData::Area, state.dataTranspiredCollector->UTSC(Item).SurfPtrs)); @@ -740,7 +727,7 @@ namespace TranspiredCollector { default: break; } - TiltRads = std::abs(AvgTilt) * Constant::DegToRadians; + TiltRads = std::abs(AvgTilt) * Constant::DegToRad; tempHdeltaNPL = std::sin(TiltRads) * state.dataTranspiredCollector->UTSC(Item).Height / 4.0; state.dataTranspiredCollector->UTSC(Item).HdeltaNPL = max(tempHdeltaNPL, state.dataTranspiredCollector->UTSC(Item).PlenGapThick); @@ -982,7 +969,7 @@ namespace TranspiredCollector { sum_sub(state.dataLoopNodes->Node, &DataLoopNode::NodeData::MassFlowRate, state.dataTranspiredCollector->UTSC(UTSCNum).InletNode); // Autodesk:F2C++ Functions handle array subscript usage - state.dataTranspiredCollector->UTSC(UTSCNum).IsOn = false; // intialize then turn on if appropriate + state.dataTranspiredCollector->UTSC(UTSCNum).IsOn = false; // initialize then turn on if appropriate state.dataTranspiredCollector->UTSC(UTSCNum).Tplen = state.dataTranspiredCollector->UTSC(UTSCNum).TplenLast; state.dataTranspiredCollector->UTSC(UTSCNum).Tcoll = state.dataTranspiredCollector->UTSC(UTSCNum).TcollLast; state.dataTranspiredCollector->UTSC(UTSCNum).TairHX = Tamb; @@ -1038,7 +1025,7 @@ namespace TranspiredCollector { Real64 HcPlen; // surface convection heat transfer coefficient for plenum surfaces Real64 D; // hole diameter Real64 ReD; // Reynolds number for holes - Real64 P; // pitch, distance betweeen holes + Real64 P; // pitch, distance between holes Real64 Por; // porosity, area fraction of collector that is open because of holes Real64 Mdot; // mass flow rate of suction air Real64 QdotSource; // energy flux for source/sink inside collector surface (for hybrid PV UTSC) @@ -1046,13 +1033,13 @@ namespace TranspiredCollector { int NumSurfs; // number of underlying HT surfaces associated with UTSC Material::SurfaceRoughness Roughness; // parameters for surface roughness, defined in DataHeatBalance Real64 SolAbs; // solar absorptivity of collector - Real64 AbsExt; // thermal emmittance of collector + Real64 AbsExt; // thermal emittance of collector Real64 TempExt; // collector temperature int SurfPtr; // index of surface in main surface structure Real64 HMovInsul; // dummy for call to InitExteriorConvectionCoeff Real64 HExt; // dummy for call to InitExteriorConvectionCoeff int ConstrNum; // index of construction in main construction structure - Real64 AbsThermSurf; // thermal emmittance of underlying wall. + Real64 AbsThermSurf; // thermal emittance of underlying wall. Real64 TsoK; // underlying surface temperature in Kelvin Real64 TscollK; // collector temperature in Kelvin (lagged) Real64 AreaSum; // sum of contributing surfaces for area-weighted averages. @@ -1439,7 +1426,7 @@ namespace TranspiredCollector { state.dataTranspiredCollector->UTSC(UTSCNum).PassiveACH = (MdotVent / RhoAir) * (1.0 / (state.dataTranspiredCollector->UTSC(UTSCNum).ProjArea * state.dataTranspiredCollector->UTSC(UTSCNum).PlenGapThick)) * - Constant::SecInHour; + Constant::rSecsInHour; state.dataTranspiredCollector->UTSC(UTSCNum).PassiveMdotVent = MdotVent; state.dataTranspiredCollector->UTSC(UTSCNum).PassiveMdotWind = VdotWind * RhoAir; state.dataTranspiredCollector->UTSC(UTSCNum).PassiveMdotTherm = VdotThermal * RhoAir; @@ -1945,7 +1932,7 @@ namespace TranspiredCollector { // SUBROUTINE LOCAL VARIABLE DECLARATIONS Real64 gnu901; // Nusselt number temporary variables for - Real64 tiltr = Tilt * Constant::DegToRadians; + Real64 tiltr = Tilt * Constant::DegToRad; Real64 Ra = Gr * Pr; // Rayleigh number if (Ra <= 1.0e4) { diff --git a/src/EnergyPlus/TranspiredCollector.hh b/src/EnergyPlus/TranspiredCollector.hh index 7bb83539fe8..c04832f4488 100644 --- a/src/EnergyPlus/TranspiredCollector.hh +++ b/src/EnergyPlus/TranspiredCollector.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -72,31 +72,31 @@ namespace TranspiredCollector { // Members // from input data std::string Name; - std::string OSCMName; // OtherSideConditionsModel - int OSCMPtr; // OtherSideConditionsModel index - int SchedPtr; // Availablity schedule - Array1D_int InletNode; // Air system node "pointer", should be set to outdoor air - Array1D_int OutletNode; // Air system node "pointer", outlet from UTSC - Array1D_int ControlNode; // Air system node "pointer", should have mixed air setpoint - Array1D_int ZoneNode; // Air system node "pointer", should have zone node - int Layout; // 'Square' or 'Triangle' - int Correlation; // which heat exchanger effectiveness model - Real64 HoleDia; // Diameter of Perforations in Collector [m] - Real64 Pitch; // Distance between Perforations in Collector [m] - Real64 LWEmitt; // Thermal Emissivity of Collector Surface [dimensionless] - Real64 SolAbsorp; // Solar Absorbtivity of Collector Surface [dimensionless] - Material::SurfaceRoughness CollRoughness; // surface roughness for exterior convection calcs. - Real64 PlenGapThick; // Depth of Plenum Behind Collector [m] - Real64 PlenCrossArea; // cross section area of plenum behind collector [m2] - int NumSurfs; // a single collector can have multiple surfaces underneath it - Array1D_int SurfPtrs; // = 0 ! array of pointers for participating underlying surfaces - Real64 Height; // Overall Height of Collector [m] - Real64 AreaRatio; // Ratio of actual surface are to projected surface area [dimensionless] - Real64 CollectThick; // Thickness of collector absorber plate material. [m] - Real64 Cv; // volume-based effectiveness of openings for wind-driven vent when Passive - Real64 Cd; // discharge coefficient of openings for buoyancy-driven vent when Passive - int NumOASysAttached; // =1 if no splitter, other wise set by Splitter object - int FreeHeatSetPointSchedPtr; // used for controlling seperately from usual setpoint managers. + std::string OSCMName; // OtherSideConditionsModel + int OSCMPtr; // OtherSideConditionsModel index + Sched::Schedule *availSched = nullptr; // Availablity schedule + Array1D_int InletNode; // Air system node "pointer", should be set to outdoor air + Array1D_int OutletNode; // Air system node "pointer", outlet from UTSC + Array1D_int ControlNode; // Air system node "pointer", should have mixed air setpoint + Array1D_int ZoneNode; // Air system node "pointer", should have zone node + int Layout; // 'Square' or 'Triangle' + int Correlation; // which heat exchanger effectiveness model + Real64 HoleDia; // Diameter of Perforations in Collector [m] + Real64 Pitch; // Distance between Perforations in Collector [m] + Real64 LWEmitt; // Thermal Emissivity of Collector Surface [dimensionless] + Real64 SolAbsorp; // Solar Absorbtivity of Collector Surface [dimensionless] + Material::SurfaceRoughness CollRoughness; // surface roughness for exterior convection calcs. + Real64 PlenGapThick; // Depth of Plenum Behind Collector [m] + Real64 PlenCrossArea; // cross section area of plenum behind collector [m2] + int NumSurfs; // a single collector can have multiple surfaces underneath it + Array1D_int SurfPtrs; // = 0 ! array of pointers for participating underlying surfaces + Real64 Height; // Overall Height of Collector [m] + Real64 AreaRatio; // Ratio of actual surface are to projected surface area [dimensionless] + Real64 CollectThick; // Thickness of collector absorber plate material. [m] + Real64 Cv; // volume-based effectiveness of openings for wind-driven vent when Passive + Real64 Cd; // discharge coefficient of openings for buoyancy-driven vent when Passive + int NumOASysAttached; // =1 if no splitter, other wise set by Splitter object + Sched::Schedule *freeHeatSetPointSched = nullptr; // used for controlling seperately from usual setpoint managers. int VsucErrIndex; // data from elswhere and calculated Real64 ActualArea; // Overall Area of Collect with surface corrugations. @@ -140,14 +140,14 @@ namespace TranspiredCollector { // Default Constructor UTSCDataStruct() - : OSCMPtr(0), SchedPtr(0), Layout(0), Correlation(0), HoleDia(0.0), Pitch(0.0), LWEmitt(0.0), SolAbsorp(0.0), + : OSCMPtr(0), Layout(0), Correlation(0), HoleDia(0.0), Pitch(0.0), LWEmitt(0.0), SolAbsorp(0.0), CollRoughness(Material::SurfaceRoughness::VeryRough), PlenGapThick(0.0), PlenCrossArea(0.0), NumSurfs(0), Height(0.0), AreaRatio(0.0), - CollectThick(0.0), Cv(0.0), Cd(0.0), NumOASysAttached(0), FreeHeatSetPointSchedPtr(0), VsucErrIndex(0), ActualArea(0.0), ProjArea(0.0), - Centroid(0.0, 0.0, 0.0), Porosity(0.0), IsOn(false), Tplen(0.0), Tcoll(0.0), TplenLast(22.5), TcollLast(22.0), HrPlen(0.0), HcPlen(0.0), - MdotVent(0.0), HdeltaNPL(0.0), TairHX(0.0), InletMDot(0.0), InletTempDB(0.0), Tilt(0.0), Azimuth(0.0), QdotSource(0.0), Isc(0.0), - HXeff(0.0), Vsuction(0.0), PassiveACH(0.0), PassiveMdotVent(0.0), PassiveMdotWind(0.0), PassiveMdotTherm(0.0), PlenumVelocity(0.0), - SupOutTemp(0.0), SupOutHumRat(0.0), SupOutEnth(0.0), SupOutMassFlow(0.0), SensHeatingRate(0.0), SensHeatingEnergy(0.0), - SensCoolingRate(0.0), SensCoolingEnergy(0.0), UTSCEfficiency(0.0), UTSCCollEff(0.0) + CollectThick(0.0), Cv(0.0), Cd(0.0), NumOASysAttached(0), VsucErrIndex(0), ActualArea(0.0), ProjArea(0.0), Centroid(0.0, 0.0, 0.0), + Porosity(0.0), IsOn(false), Tplen(0.0), Tcoll(0.0), TplenLast(22.5), TcollLast(22.0), HrPlen(0.0), HcPlen(0.0), MdotVent(0.0), + HdeltaNPL(0.0), TairHX(0.0), InletMDot(0.0), InletTempDB(0.0), Tilt(0.0), Azimuth(0.0), QdotSource(0.0), Isc(0.0), HXeff(0.0), + Vsuction(0.0), PassiveACH(0.0), PassiveMdotVent(0.0), PassiveMdotWind(0.0), PassiveMdotTherm(0.0), PlenumVelocity(0.0), SupOutTemp(0.0), + SupOutHumRat(0.0), SupOutEnth(0.0), SupOutMassFlow(0.0), SensHeatingRate(0.0), SensHeatingEnergy(0.0), SensCoolingRate(0.0), + SensCoolingEnergy(0.0), UTSCEfficiency(0.0), UTSCCollEff(0.0) { } }; @@ -225,6 +225,10 @@ struct TranspiredCollectorData : BaseGlobalStruct Array1D_bool MyEnvrnFlag; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/UFADManager.cc b/src/EnergyPlus/UFADManager.cc index 6c5109731a2..5dd0deabd9e 100644 --- a/src/EnergyPlus/UFADManager.cc +++ b/src/EnergyPlus/UFADManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -50,7 +50,6 @@ // ObjexxFCL Headers #include -#include #include // EnergyPlus Headers @@ -194,7 +193,7 @@ namespace RoomAir { for (int Ctd = state.dataRoomAir->PosZ_Window(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Window(ZoneNum).end; ++Ctd) { int SurfNum = state.dataRoomAir->APos_Window(Ctd); if (SurfNum == 0) continue; - auto &surf = state.dataSurface->Surface(SurfNum); + auto const &surf = state.dataSurface->Surface(SurfNum); if (surf.ExtBoundCond == ExternalEnvironment || surf.ExtBoundCond == OtherSideCoefNoCalcExt || surf.ExtBoundCond == OtherSideCoefCalcExt || surf.ExtBoundCond == OtherSideCondModeledExt) { if (ANY_INTERIOR_SHADE_BLIND(state.dataSurface->SurfWinShadingFlag(SurfNum))) { @@ -341,7 +340,7 @@ namespace RoomAir { } } - Real64 sumUFADConvGainPerPlume(EnergyPlusData &state, int const zoneNum, Real64 const numOccupants) + Real64 sumUFADConvGainPerPlume(EnergyPlusData const &state, int const zoneNum, Real64 const numOccupants) { Real64 zoneElecConv(0.0); // zone elec equip design convective gain [W] for (auto const &zoneElectric : state.dataHeatBal->ZoneElectric) { @@ -606,7 +605,7 @@ namespace RoomAir { int SurfNum = state.dataRoomAir->APos_Internal(Ctd); if (SurfNum == 0) continue; - auto &surf = state.dataSurface->Surface(SurfNum); + auto const &surf = state.dataSurface->Surface(SurfNum); state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)]; Real64 ZSupSurf = state.dataUFADManager->HeightIntMass; @@ -644,7 +643,7 @@ namespace RoomAir { for (int Ctd = state.dataRoomAir->PosZ_Ceiling(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Ceiling(ZoneNum).end; ++Ctd) { int SurfNum = state.dataRoomAir->APos_Ceiling(Ctd); if (SurfNum == 0) continue; - auto &surf = state.dataSurface->Surface(SurfNum); + auto const &surf = state.dataSurface->Surface(SurfNum); state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)]; @@ -660,7 +659,7 @@ namespace RoomAir { for (int Ctd = state.dataRoomAir->PosZ_Floor(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Floor(ZoneNum).end; ++Ctd) { int SurfNum = state.dataRoomAir->APos_Floor(Ctd); if (SurfNum == 0) continue; - auto &surf = state.dataSurface->Surface(SurfNum); + auto const &surf = state.dataSurface->Surface(SurfNum); state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp; state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)]; @@ -796,12 +795,12 @@ namespace RoomAir { Real64 CeilingHeight = state.dataRoomAir->ZoneCeilingHeight2(ZoneNum) - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum); auto &zoneU = state.dataRoomAir->ZoneUFAD(state.dataRoomAir->ZoneUFADPtr(ZoneNum)); - Real64 HeightThermostat = zoneU.ThermostatHeight; // height of the thermostat above the floor [m] - Real64 HeightComfort = zoneU.ComfortHeight; // height at which comfort temperature is calculated - Real64 TempDiffCritRep = zoneU.TempTrigger; // Minimum temperature difference between upper and occupied subzones for reporting - Real64 DiffArea = zoneU.DiffArea; // diffuser effective area [m2] - Real64 ThrowAngle = Constant::DegToRadians * zoneU.DiffAngle; // diffuser slot angle relative to vertical [radians] - Real64 SourceHeight = 0.0; // height of plume sources above the floor [m] + Real64 HeightThermostat = zoneU.ThermostatHeight; // height of the thermostat above the floor [m] + Real64 HeightComfort = zoneU.ComfortHeight; // height at which comfort temperature is calculated + Real64 TempDiffCritRep = zoneU.TempTrigger; // Minimum temperature difference between upper and occupied subzones for reporting + Real64 DiffArea = zoneU.DiffArea; // diffuser effective area [m2] + Real64 ThrowAngle = Constant::DegToRad * zoneU.DiffAngle; // diffuser slot angle relative to vertical [radians] + Real64 SourceHeight = 0.0; // height of plume sources above the floor [m] Real64 NumDiffusers = zoneU.DiffusersPerZone; Real64 PowerPerPlume = zoneU.PowerPerPlume; // gains from occupants, task lighting, elec equip, gas equip, other equip, hot water equip, steam equip, @@ -1222,12 +1221,12 @@ namespace RoomAir { Real64 CeilingHeight = state.dataRoomAir->ZoneCeilingHeight2(ZoneNum) - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum); auto &zoneU = state.dataRoomAir->ZoneUFAD(state.dataRoomAir->ZoneUFADPtr(ZoneNum)); - Real64 HeightThermostat = zoneU.ThermostatHeight; // height of the thermostat above the floor [m] - Real64 HeightComfort = zoneU.ComfortHeight; // height at which comfort temperature is calculated - Real64 TempDiffCritRep = zoneU.TempTrigger; // Minimum temperature difference between upper and occupied subzones for reporting - Real64 DiffArea = zoneU.DiffArea; // diffuser effective area [m2] - Real64 ThrowAngle = Constant::DegToRadians * zoneU.DiffAngle; // diffuser slot angle relative to vertical [radians] - Real64 SourceHeight = zoneU.HeatSrcHeight; // height of plume sources above the floor [m] + Real64 HeightThermostat = zoneU.ThermostatHeight; // height of the thermostat above the floor [m] + Real64 HeightComfort = zoneU.ComfortHeight; // height at which comfort temperature is calculated + Real64 TempDiffCritRep = zoneU.TempTrigger; // Minimum temperature difference between upper and occupied subzones for reporting + Real64 DiffArea = zoneU.DiffArea; // diffuser effective area [m2] + Real64 ThrowAngle = Constant::DegToRad * zoneU.DiffAngle; // diffuser slot angle relative to vertical [radians] + Real64 SourceHeight = zoneU.HeatSrcHeight; // height of plume sources above the floor [m] Real64 NumDiffusers = zoneU.DiffusersPerZone; Real64 PowerPerPlume = zoneU.PowerPerPlume; // gains from occupants, task lighting, elec equip, gas equip, other equip, hot water equip, steam equip, diff --git a/src/EnergyPlus/UFADManager.hh b/src/EnergyPlus/UFADManager.hh index 5e8c57b4a31..037178d52e5 100644 --- a/src/EnergyPlus/UFADManager.hh +++ b/src/EnergyPlus/UFADManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -88,7 +88,7 @@ namespace RoomAir { RoomAir::RoomAirModel const ZoneModelType // type of zone model; UCSDUFI = 6 ); - Real64 sumUFADConvGainPerPlume(EnergyPlusData &state, int const zoneNum, Real64 const numOccupants); + Real64 sumUFADConvGainPerPlume(EnergyPlusData const &state, int const zoneNum, Real64 const numOccupants); void HcUFAD(EnergyPlusData &state, int const ZoneNum, Real64 const FractionHeight, UFADConvCoef &ufadCC); @@ -109,6 +109,10 @@ struct UFADManagerData : BaseGlobalStruct bool MyOneTimeFlag = true; Array1D_bool MySizeFlag; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/UnitHeater.cc b/src/EnergyPlus/UnitHeater.cc index 8acacf9750e..12fe85ec57e 100644 --- a/src/EnergyPlus/UnitHeater.cc +++ b/src/EnergyPlus/UnitHeater.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -50,7 +50,6 @@ // ObjexxFCL Headers #include -#include // EnergyPlus Headers #include @@ -92,7 +91,6 @@ namespace UnitHeater { // DATE WRITTEN May 2000 // MODIFIED Brent Griffith, Sept 2010, plant upgrades, fluid properties // MODIFIED Bereket Nigusse, FSEC, October 2013, Added cycling fan operating mode - // RE-ENGINEERED na // PURPOSE OF THIS MODULE: // To simulate unit heaters. It is assumed that unit heaters are zone equipment @@ -111,18 +109,6 @@ namespace UnitHeater { // Rick Strand's unit heater module which was based upon Fred Buhl's fan coil // module (FanCoilUnits.cc) - // Using/Aliasing - using namespace DataLoopNode; - using HVAC::SmallAirVolFlow; - using HVAC::SmallLoad; - using HVAC::SmallMassFlow; - using namespace ScheduleManager; - using Psychrometrics::PsyCpAirFnW; - using Psychrometrics::PsyHFnTdbW; - using Psychrometrics::PsyRhoAirFnPbTdbW; - - static constexpr std::string_view fluidNameSteam("STEAM"); - void SimUnitHeater(EnergyPlusData &state, std::string_view CompName, // name of the fan coil unit int const ZoneNum, // number of zone being served @@ -136,7 +122,6 @@ namespace UnitHeater { // AUTHOR Rick Strand // DATE WRITTEN May 2000 // MODIFIED Don Shirey, Aug 2009 (LatOutputProvided) - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This is the main driver subroutine for the Unit Heater simulation. @@ -203,7 +188,6 @@ namespace UnitHeater { // MODIFIED Chandan Sharma, FSEC, March 2011: Added ZoneHVAC sys avail manager // Bereket Nigusse, FSEC, April 2011: eliminated input node names // & added fan object type - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Obtain the user input data for all of the unit heaters in the input file. @@ -214,15 +198,6 @@ namespace UnitHeater { // REFERENCES: // Fred Buhl's fan coil module (FanCoilUnits.cc) - // Using/Aliasing - using BranchNodeConnections::SetUpCompSets; - - using DataSizing::AutoSize; - using NodeInputManager::GetOnlySingleNode; - using SteamCoils::GetCoilSteamInletNode; - using SteamCoils::GetSteamCoilIndex; - using WaterCoils::GetCoilWaterInletNode; - static constexpr std::string_view RoutineName("GetUnitHeaterInput: "); // include trailing blank space static constexpr std::string_view routineName = "GetUnitHeaterInput"; // include trailing blank space @@ -234,10 +209,8 @@ namespace UnitHeater { int NumAlphas; // Number of Alphas for each GetObjectItem call int NumNumbers; // Number of Numbers for each GetObjectItem call int NumFields; // Total number of fields in object - int UnitHeatNum; // Item to be "gotten" - Real64 FanVolFlow; // Fan volumetric flow rate - std::string CurrentModuleObject; + Real64 FanVolFlow; // Fan volumetric flow rate Array1D_string Alphas; // Alpha items for object Array1D Numbers; // Numeric items for object Array1D_string cAlphaFields; // Alpha field names @@ -246,10 +219,9 @@ namespace UnitHeater { Array1D_bool lNumericBlanks; // Logical array, numeric field input BLANK = .TRUE. int CtrlZone; // index to loop counter int NodeNum; // index to loop counter - bool ZoneNodeNotFound; // used in error checking // Figure out how many unit heaters there are in the input file - CurrentModuleObject = state.dataUnitHeaters->cMO_UnitHeater; + std::string CurrentModuleObject = state.dataUnitHeaters->cMO_UnitHeater; state.dataUnitHeaters->NumOfUnitHeats = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, NumFields, NumAlphas, NumNumbers); @@ -268,7 +240,7 @@ namespace UnitHeater { } state.dataUnitHeaters->CheckEquipName = true; - for (UnitHeatNum = 1; UnitHeatNum <= state.dataUnitHeaters->NumOfUnitHeats; + for (int UnitHeatNum = 1; UnitHeatNum <= state.dataUnitHeaters->NumOfUnitHeats; ++UnitHeatNum) { // Begin looping over all of the unit heaters found in the input file... state.dataInputProcessing->inputProcessor->getObjectItem(state, @@ -292,44 +264,36 @@ namespace UnitHeater { Util::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound); state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name = Alphas(1); - state.dataUnitHeaters->UnitHeat(UnitHeatNum).SchedName = Alphas(2); + if (lAlphaBlanks(2)) { - state.dataUnitHeaters->UnitHeat(UnitHeatNum).SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - state.dataUnitHeaters->UnitHeat(UnitHeatNum).SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).SchedPtr == 0) { - ShowSevereError(state, - format("{}{}: invalid {} entered ={} for {}={}", - RoutineName, - CurrentModuleObject, - cAlphaFields(2), - Alphas(2), - cAlphaFields(1), - Alphas(1))); - ErrorsFound = true; - } + state.dataUnitHeaters->UnitHeat(UnitHeatNum).availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((state.dataUnitHeaters->UnitHeat(UnitHeatNum).availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } // Main air nodes (except outside air node): - state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode = GetOnlySingleNode(state, - Alphas(3), - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACUnitHeater, - Alphas(1), - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Inlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsParent); - - state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirOutNode = GetOnlySingleNode(state, - Alphas(4), - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACUnitHeater, - Alphas(1), - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Outlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsParent); + state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode = + NodeInputManager::GetOnlySingleNode(state, + Alphas(3), + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACUnitHeater, + Alphas(1), + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Inlet, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsParent); + + state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirOutNode = + NodeInputManager::GetOnlySingleNode(state, + Alphas(4), + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACUnitHeater, + Alphas(1), + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Outlet, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsParent); auto &unitHeat = state.dataUnitHeaters->UnitHeat(UnitHeatNum); // Fan information: @@ -354,162 +318,132 @@ namespace UnitHeater { FanVolFlow = fan->maxAirFlowRate; - if (FanVolFlow != AutoSize && unitHeat.MaxAirVolFlow != AutoSize && FanVolFlow < unitHeat.MaxAirVolFlow) { - ShowSevereError(state, format("Specified in {} = {}", CurrentModuleObject, state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name)); + if (FanVolFlow != DataSizing::AutoSize && unitHeat.MaxAirVolFlow != DataSizing::AutoSize && FanVolFlow < unitHeat.MaxAirVolFlow) { + ShowSevereError(state, format("Specified in {} = {}", CurrentModuleObject, unitHeat.Name)); ShowContinueError( state, format("...air flow rate ({:.7T}) in fan object {} is less than the unit heater maximum supply air flow rate ({:.7T}).", FanVolFlow, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanName, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxAirVolFlow)); + unitHeat.FanName, + unitHeat.MaxAirVolFlow)); ShowContinueError(state, "...the fan flow rate must be greater than or equal to the unit heater maximum supply air flow rate."); ErrorsFound = true; - } else if (FanVolFlow == AutoSize && state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxAirVolFlow != AutoSize) { - ShowWarningError(state, format("Specified in {} = {}", CurrentModuleObject, state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name)); + } else if (FanVolFlow == DataSizing::AutoSize && unitHeat.MaxAirVolFlow != DataSizing::AutoSize) { + ShowWarningError(state, format("Specified in {} = {}", CurrentModuleObject, unitHeat.Name)); ShowContinueError(state, "...the fan flow rate is autosized while the unit heater flow rate is not."); ShowContinueError(state, "...this can lead to unexpected results where the fan flow rate is less than required."); - } else if (FanVolFlow != AutoSize && state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxAirVolFlow == AutoSize) { - ShowWarningError(state, format("Specified in {} = {}", CurrentModuleObject, state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name)); + } else if (FanVolFlow != DataSizing::AutoSize && unitHeat.MaxAirVolFlow == DataSizing::AutoSize) { + ShowWarningError(state, format("Specified in {} = {}", CurrentModuleObject, unitHeat.Name)); ShowContinueError(state, "...the unit heater flow rate is autosized while the fan flow rate is not."); ShowContinueError(state, "...this can lead to unexpected results where the fan flow rate is less than required."); } - unitHeat.FanAvailSchedPtr = fan->availSchedNum; + unitHeat.fanAvailSched = fan->availSched; } // Heating coil information: { - state.dataUnitHeaters->UnitHeat(UnitHeatNum).Type = - static_cast(getEnumValue(HCoilTypeNamesUC, Util::makeUPPER(Alphas(7)))); - switch (state.dataUnitHeaters->UnitHeat(UnitHeatNum).Type) { + unitHeat.Type = static_cast(getEnumValue(HCoilTypeNamesUC, Util::makeUPPER(Alphas(7)))); + switch (unitHeat.Type) { case HCoilType::WaterHeatingCoil: - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HeatingCoilType = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; + unitHeat.HeatingCoilType = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; break; case HCoilType::SteamCoil: - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HeatingCoilType = DataPlant::PlantEquipmentType::CoilSteamAirHeating; + unitHeat.HeatingCoilType = DataPlant::PlantEquipmentType::CoilSteamAirHeating; break; case HCoilType::Electric: case HCoilType::Gas: break; default: { ShowSevereError(state, format("Illegal {} = {}", cAlphaFields(7), Alphas(7))); - ShowContinueError(state, format("Occurs in {}={}", CurrentModuleObject, state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name)); + ShowContinueError(state, format("Occurs in {}={}", CurrentModuleObject, unitHeat.Name)); ErrorsFound = true; errFlag = true; } } } + if (!errFlag) { - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilTypeCh = Alphas(7); - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName = Alphas(8); - ValidateComponent(state, Alphas(7), state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, IsNotOK, CurrentModuleObject); + unitHeat.HCoilTypeCh = Alphas(7); + unitHeat.HCoilName = Alphas(8); + ValidateComponent(state, Alphas(7), unitHeat.HCoilName, IsNotOK, CurrentModuleObject); if (IsNotOK) { - ShowContinueError(state, - format("specified in {} = \"{}\"", CurrentModuleObject, state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name)); + ShowContinueError(state, format("specified in {} = \"{}\"", CurrentModuleObject, unitHeat.Name)); ErrorsFound = true; } else { // The heating coil control node is necessary for hot water and steam coils, but not necessary for an // electric or gas coil. - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).Type == HCoilType::WaterHeatingCoil || - state.dataUnitHeaters->UnitHeat(UnitHeatNum).Type == HCoilType::SteamCoil) { + if (unitHeat.Type == HCoilType::WaterHeatingCoil || unitHeat.Type == HCoilType::SteamCoil) { // mine the hot water or steam node from the coil object errFlag = false; - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).Type == HCoilType::WaterHeatingCoil) { - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode = - GetCoilWaterInletNode(state, "Coil:Heating:Water", state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, errFlag); + if (unitHeat.Type == HCoilType::WaterHeatingCoil) { + unitHeat.HotControlNode = WaterCoils::GetCoilWaterInletNode(state, "Coil:Heating:Water", unitHeat.HCoilName, errFlag); } else { // its a steam coil - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoil_Index = - GetSteamCoilIndex(state, "COIL:HEATING:STEAM", state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, errFlag); - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode = - GetCoilSteamInletNode(state, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoil_Index, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, - errFlag); + unitHeat.HCoil_Index = SteamCoils::GetSteamCoilIndex(state, "COIL:HEATING:STEAM", unitHeat.HCoilName, errFlag); + unitHeat.HotControlNode = SteamCoils::GetCoilSteamInletNode(state, unitHeat.HCoil_Index, unitHeat.HCoilName, errFlag); + unitHeat.HCoil_fluid = Fluid::GetSteam(state); } // Other error checks should trap before it gets to this point in the code, but including just in case. if (errFlag) { - ShowContinueError( - state, - format("that was specified in {} = \"{}\"", CurrentModuleObject, state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name)); + ShowContinueError(state, format("that was specified in {} = \"{}\"", CurrentModuleObject, unitHeat.Name)); ErrorsFound = true; } } } } - state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanSchedPtr = GetScheduleIndex(state, Alphas(9)); - // Default to cycling fan when fan operating mode schedule is not present - if (!lAlphaBlanks(9) && state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanSchedPtr == 0) { - ShowSevereError(state, - format("{} \"{}\" {} not found: {}", - CurrentModuleObject, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name, - cAlphaFields(9), - Alphas(9))); + if (lAlphaBlanks(9)) { + unitHeat.fanOp = (unitHeat.fanType == HVAC::FanType::OnOff || unitHeat.fanType == HVAC::FanType::SystemModel) + ? HVAC::FanOp::Cycling + : HVAC::FanOp::Continuous; + } else if ((state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanOpModeSched = Sched::GetSchedule(state, Alphas(9))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(9), Alphas(9)); + ErrorsFound = true; + } else if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanType == HVAC::FanType::Constant && + !state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanOpModeSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFields(9), Alphas(9), Clusive::In, 0.0, Clusive::In, 1.0); ErrorsFound = true; - } else if (lAlphaBlanks(9)) { - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanType == HVAC::FanType::OnOff || - state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanType == HVAC::FanType::SystemModel) { - state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanOp = HVAC::FanOp::Cycling; - } else { - state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanOp = HVAC::FanOp::Continuous; - } - } - - // Check fan's schedule for cycling fan operation if constant volume fan is used - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanSchedPtr > 0 && - state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanType == HVAC::FanType::Constant) { - if (!CheckScheduleValueMinMax(state, state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanSchedPtr, ">", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("For {} = {}", cAlphaFields(5), Alphas(5))); - ShowContinueError(state, "Fan operating mode must be continuous (fan operating mode schedule values > 0)."); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFields(9), Alphas(9))); - ShowContinueError(state, "...schedule values must be (>0., <=1.)"); - ErrorsFound = true; - } } - state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanOperatesDuringNoHeating = Alphas(10); - if ((!Util::SameString(state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanOperatesDuringNoHeating, "Yes")) && - (!Util::SameString(state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanOperatesDuringNoHeating, "No"))) { + unitHeat.FanOperatesDuringNoHeating = Alphas(10); + if ((!Util::SameString(unitHeat.FanOperatesDuringNoHeating, "Yes")) && (!Util::SameString(unitHeat.FanOperatesDuringNoHeating, "No"))) { ErrorsFound = true; ShowSevereError(state, format("Illegal {} = {}", cAlphaFields(10), Alphas(10))); - ShowContinueError(state, format("Occurs in {}={}", CurrentModuleObject, state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name)); - } else if (Util::SameString(state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanOperatesDuringNoHeating, "No")) { - state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanOffNoHeating = true; + ShowContinueError(state, format("Occurs in {}={}", CurrentModuleObject, unitHeat.Name)); + } else if (Util::SameString(unitHeat.FanOperatesDuringNoHeating, "No")) { + unitHeat.FanOffNoHeating = true; } - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotWaterFlow = Numbers(2); - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MinVolHotWaterFlow = Numbers(3); - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotSteamFlow = Numbers(2); - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MinVolHotSteamFlow = Numbers(3); + unitHeat.MaxVolHotWaterFlow = Numbers(2); + unitHeat.MinVolHotWaterFlow = Numbers(3); + unitHeat.MaxVolHotSteamFlow = Numbers(2); + unitHeat.MinVolHotSteamFlow = Numbers(3); - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlOffset = Numbers(4); + unitHeat.HotControlOffset = Numbers(4); // Set default convergence tolerance - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlOffset <= 0.0) { - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlOffset = 0.001; + if (unitHeat.HotControlOffset <= 0.0) { + unitHeat.HotControlOffset = 0.001; } if (!lAlphaBlanks(11)) { - state.dataUnitHeaters->UnitHeat(UnitHeatNum).AvailManagerListName = Alphas(11); + unitHeat.AvailManagerListName = Alphas(11); } - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HVACSizingIndex = 0; + unitHeat.HVACSizingIndex = 0; if (!lAlphaBlanks(12)) { - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HVACSizingIndex = Util::FindItemInList(Alphas(12), state.dataSize->ZoneHVACSizing); - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).HVACSizingIndex == 0) { + unitHeat.HVACSizingIndex = Util::FindItemInList(Alphas(12), state.dataSize->ZoneHVACSizing); + if (unitHeat.HVACSizingIndex == 0) { ShowSevereError(state, format("{} = {} not found.", cAlphaFields(12), Alphas(12))); - ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name)); + ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, unitHeat.Name)); ErrorsFound = true; } } // check that unit heater air inlet node must be the same as a zone exhaust node - ZoneNodeNotFound = true; + bool ZoneNodeNotFound = true; for (CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue; for (NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumExhaustNodes; ++NodeNum) { - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode == - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ExhaustNode(NodeNum)) { + if (unitHeat.AirInNode == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).ExhaustNode(NodeNum)) { ZoneNodeNotFound = false; break; } @@ -519,11 +453,9 @@ namespace UnitHeater { ShowSevereError(state, format("{} = \"{}\". Unit heater air inlet node name must be the same as a zone exhaust node name.", CurrentModuleObject, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name)); + unitHeat.Name)); ShowContinueError(state, "..Zone exhaust node name is specified in ZoneHVAC:EquipmentConnections object."); - ShowContinueError(state, - format("..Unit heater air inlet node name = {}", - state.dataLoopNodes->NodeID(state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode))); + ShowContinueError(state, format("..Unit heater air inlet node name = {}", state.dataLoopNodes->NodeID(unitHeat.AirInNode))); ErrorsFound = true; } // check that unit heater air outlet node is a zone inlet node. @@ -531,9 +463,8 @@ namespace UnitHeater { for (CtrlZone = 1; CtrlZone <= state.dataGlobal->NumOfZones; ++CtrlZone) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZone).IsControlled) continue; for (NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(CtrlZone).NumInletNodes; ++NodeNum) { - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirOutNode == - state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(NodeNum)) { - state.dataUnitHeaters->UnitHeat(UnitHeatNum).ZonePtr = CtrlZone; + if (unitHeat.AirOutNode == state.dataZoneEquip->ZoneEquipConfig(CtrlZone).InletNode(NodeNum)) { + unitHeat.ZonePtr = CtrlZone; ZoneNodeNotFound = false; break; } @@ -543,31 +474,29 @@ namespace UnitHeater { ShowSevereError(state, format("{} = \"{}\". Unit heater air outlet node name must be the same as a zone inlet node name.", CurrentModuleObject, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name)); + unitHeat.Name)); ShowContinueError(state, "..Zone inlet node name is specified in ZoneHVAC:EquipmentConnections object."); - ShowContinueError(state, - format("..Unit heater air outlet node name = {}", - state.dataLoopNodes->NodeID(state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirOutNode))); + ShowContinueError(state, format("..Unit heater air outlet node name = {}", state.dataLoopNodes->NodeID(unitHeat.AirOutNode))); ErrorsFound = true; } // Add fan to component sets array - SetUpCompSets(state, - CurrentModuleObject, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name, - HVAC::fanTypeNamesUC[(int)state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanType], - state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanName, - state.dataLoopNodes->NodeID(state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode), - state.dataLoopNodes->NodeID(state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanOutletNode)); + BranchNodeConnections::SetUpCompSets(state, + CurrentModuleObject, + unitHeat.Name, + HVAC::fanTypeNamesUC[(int)unitHeat.fanType], + unitHeat.FanName, + state.dataLoopNodes->NodeID(unitHeat.AirInNode), + state.dataLoopNodes->NodeID(unitHeat.FanOutletNode)); // Add heating coil to component sets array - SetUpCompSets(state, - CurrentModuleObject, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilTypeCh, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, - state.dataLoopNodes->NodeID(state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanOutletNode), - state.dataLoopNodes->NodeID(state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirOutNode)); + BranchNodeConnections::SetUpCompSets(state, + CurrentModuleObject, + unitHeat.Name, + unitHeat.HCoilTypeCh, + unitHeat.HCoilName, + state.dataLoopNodes->NodeID(unitHeat.FanOutletNode), + state.dataLoopNodes->NodeID(unitHeat.AirOutNode)); } // ...loop over all of the unit heaters found in the input file @@ -581,56 +510,53 @@ namespace UnitHeater { if (ErrorsFound) ShowFatalError(state, format("{}Errors found in input", RoutineName)); // Setup Report variables for the Unit Heaters, CurrentModuleObject='ZoneHVAC:UnitHeater' - for (UnitHeatNum = 1; UnitHeatNum <= state.dataUnitHeaters->NumOfUnitHeats; ++UnitHeatNum) { + for (int UnitHeatNum = 1; UnitHeatNum <= state.dataUnitHeaters->NumOfUnitHeats; ++UnitHeatNum) { + auto &unitHeat = state.dataUnitHeaters->UnitHeat(UnitHeatNum); SetupOutputVariable(state, "Zone Unit Heater Heating Rate", Constant::Units::W, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HeatPower, + unitHeat.HeatPower, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name); + unitHeat.Name); SetupOutputVariable(state, "Zone Unit Heater Heating Energy", Constant::Units::J, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HeatEnergy, + unitHeat.HeatEnergy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name); + unitHeat.Name); SetupOutputVariable(state, "Zone Unit Heater Fan Electricity Rate", Constant::Units::W, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).ElecPower, + unitHeat.ElecPower, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name); + unitHeat.Name); // Note that the unit heater fan electric is NOT metered because this value is already metered through the fan component SetupOutputVariable(state, "Zone Unit Heater Fan Electricity Energy", Constant::Units::J, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).ElecEnergy, + unitHeat.ElecEnergy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name); + unitHeat.Name); SetupOutputVariable(state, "Zone Unit Heater Fan Availability Status", Constant::Units::None, - (int &)state.dataUnitHeaters->UnitHeat(UnitHeatNum).availStatus, + (int &)unitHeat.availStatus, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name); - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanType == HVAC::FanType::OnOff) { + unitHeat.Name); + if (unitHeat.fanType == HVAC::FanType::OnOff) { SetupOutputVariable(state, "Zone Unit Heater Fan Part Load Ratio", Constant::Units::None, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanPartLoadRatio, + unitHeat.FanPartLoadRatio, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name); + unitHeat.Name); } - } - - for (UnitHeatNum = 1; UnitHeatNum <= state.dataUnitHeaters->NumOfUnitHeats; ++UnitHeatNum) { - auto &unitHeat = state.dataUnitHeaters->UnitHeat(UnitHeatNum); state.dataRptCoilSelection->coilSelectionReportObj->setCoilSupplyFanInfo( state, unitHeat.HCoilName, unitHeat.HCoilTypeCh, unitHeat.FanName, unitHeat.fanType, unitHeat.Fan_Index); } @@ -647,7 +573,6 @@ namespace UnitHeater { // AUTHOR Rick Strand // DATE WRITTEN May 2000 // MODIFIED Chandan Sharma, FSEC, March 2011: Added ZoneHVAC sys avail manager - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine initializes all of the data elements which are necessary @@ -656,28 +581,16 @@ namespace UnitHeater { // METHODOLOGY EMPLOYED: // Uses the status flags to trigger initializations. - // Using/Aliasing - using DataZoneEquipment::CheckZoneEquipmentList; - using FluidProperties::GetDensityGlycol; - using PlantUtilities::InitComponentNodes; - using PlantUtilities::ScanPlantLoopsForObject; - using PlantUtilities::SetComponentFlowRate; - using namespace DataZoneEnergyDemands; - using WaterCoils::SimulateWaterCoilComponents; - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("InitUnitHeater"); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int Loop; - int HotConNode; // hot water control node number in unit heater loop - int InNode; // inlet node number in unit heater loop - int OutNode; // outlet node number in unit heater loop - Real64 RhoAir; // air density at InNode + int InNode; // inlet node number in unit heater loop + int OutNode; // outlet node number in unit heater loop + Real64 RhoAir; // air density at InNode Real64 TempSteamIn; Real64 SteamDensity; Real64 rho; // local fluid density - bool errFlag; // Do the one time initializations if (state.dataUnitHeaters->InitUnitHeaterOneTimeFlag) { @@ -706,17 +619,17 @@ namespace UnitHeater { if (state.dataUnitHeaters->MyPlantScanFlag(UnitHeatNum) && allocated(state.dataPlnt->PlantLoop)) { if ((state.dataUnitHeaters->UnitHeat(UnitHeatNum).HeatingCoilType == DataPlant::PlantEquipmentType::CoilWaterSimpleHeating) || (state.dataUnitHeaters->UnitHeat(UnitHeatNum).HeatingCoilType == DataPlant::PlantEquipmentType::CoilSteamAirHeating)) { - errFlag = false; - ScanPlantLoopsForObject(state, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HeatingCoilType, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc, - errFlag, - _, - _, - _, - _, - _); + bool errFlag = false; + PlantUtilities::ScanPlantLoopsForObject(state, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HeatingCoilType, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc, + errFlag, + _, + _, + _, + _, + _); if (errFlag) { ShowContinueError(state, format("Reference Unit=\"{}\", type=ZoneHVAC:UnitHeater", state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name)); @@ -733,8 +646,8 @@ namespace UnitHeater { // need to check all units to see if they are on Zone Equipment List or issue warning if (!state.dataUnitHeaters->ZoneEquipmentListChecked && state.dataZoneEquip->ZoneEquipInputsFilled) { state.dataUnitHeaters->ZoneEquipmentListChecked = true; - for (Loop = 1; Loop <= state.dataUnitHeaters->NumOfUnitHeats; ++Loop) { - if (CheckZoneEquipmentList(state, "ZoneHVAC:UnitHeater", state.dataUnitHeaters->UnitHeat(Loop).Name)) continue; + for (int Loop = 1; Loop <= state.dataUnitHeaters->NumOfUnitHeats; ++Loop) { + if (DataZoneEquipment::CheckZoneEquipmentList(state, "ZoneHVAC:UnitHeater", state.dataUnitHeaters->UnitHeat(Loop).Name)) continue; ShowSevereError(state, format("InitUnitHeater: Unit=[UNIT HEATER,{}] is not on any ZoneHVAC:EquipmentList. It will not be simulated.", state.dataUnitHeaters->UnitHeat(Loop).Name)); @@ -753,7 +666,6 @@ namespace UnitHeater { !state.dataUnitHeaters->MyPlantScanFlag(UnitHeatNum)) { InNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode; OutNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirOutNode; - HotConNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode; RhoAir = state.dataEnvrn->StdRhoAir; // set the mass flow rates from the input volume flow rates @@ -767,34 +679,30 @@ namespace UnitHeater { state.dataLoopNodes->Node(InNode).MassFlowRateMin = 0.0; if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).Type == HCoilType::WaterHeatingCoil) { - rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc.loopNum) + .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxHotWaterFlow = rho * state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotWaterFlow; state.dataUnitHeaters->UnitHeat(UnitHeatNum).MinHotWaterFlow = rho * state.dataUnitHeaters->UnitHeat(UnitHeatNum).MinVolHotWaterFlow; - InitComponentNodes(state, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MinHotWaterFlow, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxHotWaterFlow, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum); + PlantUtilities::InitComponentNodes(state, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).MinHotWaterFlow, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxHotWaterFlow, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum); } if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).Type == HCoilType::SteamCoil) { TempSteamIn = 100.00; - SteamDensity = FluidProperties::GetSatDensityRefrig( - state, fluidNameSteam, TempSteamIn, 1.0, state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoil_FluidIndex, RoutineName); + SteamDensity = state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoil_fluid->getSatDensity(state, TempSteamIn, 1.0, RoutineName); state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxHotSteamFlow = SteamDensity * state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotSteamFlow; state.dataUnitHeaters->UnitHeat(UnitHeatNum).MinHotSteamFlow = SteamDensity * state.dataUnitHeaters->UnitHeat(UnitHeatNum).MinVolHotSteamFlow; - InitComponentNodes(state, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MinHotSteamFlow, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxHotSteamFlow, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum); + PlantUtilities::InitComponentNodes(state, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).MinHotSteamFlow, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxHotSteamFlow, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum); } state.dataUnitHeaters->MyEnvrnFlag(UnitHeatNum) = false; @@ -807,29 +715,28 @@ namespace UnitHeater { OutNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirOutNode; state.dataUnitHeaters->QZnReq = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).RemainingOutputReqToHeatSP; // zone load needed - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanSchedPtr > 0) { - if (GetCurrentScheduleValue(state, state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanSchedPtr) == 0.0 && + if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanOpModeSched != nullptr) { + if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanOpModeSched->getCurrentVal() == 0.0 && state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanType == HVAC::FanType::OnOff) { state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanOp = HVAC::FanOp::Cycling; } else { state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanOp = HVAC::FanOp::Continuous; } - if ((state.dataUnitHeaters->QZnReq < SmallLoad) || state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum)) { + if ((state.dataUnitHeaters->QZnReq < HVAC::SmallLoad) || state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum)) { // Unit is available, but there is no load on it or we are in setback/deadband if (!state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanOffNoHeating && - GetCurrentScheduleValue(state, state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanSchedPtr) > 0.0) { + state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanOpModeSched->getCurrentVal() > 0.0) { state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanOp = HVAC::FanOp::Continuous; } } } state.dataUnitHeaters->SetMassFlowRateToZero = false; - if (GetCurrentScheduleValue(state, state.dataUnitHeaters->UnitHeat(UnitHeatNum).SchedPtr) > 0) { - if ((GetCurrentScheduleValue(state, state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanAvailSchedPtr) > 0 || - state.dataHVACGlobal->TurnFansOn) && + if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).availSched->getCurrentVal() > 0) { + if ((state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanAvailSched->getCurrentVal() > 0 || state.dataHVACGlobal->TurnFansOn) && !state.dataHVACGlobal->TurnFansOff) { if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanOffNoHeating && - ((state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).RemainingOutputReqToHeatSP < SmallLoad) || + ((state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).RemainingOutputReqToHeatSP < HVAC::SmallLoad) || (state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum)))) { state.dataUnitHeaters->SetMassFlowRateToZero = true; } @@ -882,75 +789,40 @@ namespace UnitHeater { // METHODOLOGY EMPLOYED: // Obtains flow rates from the zone sizing arrays and plant sizing data. - // Using/Aliasing - using namespace DataSizing; - using HVAC::HeatingAirflowSizing; - using HVAC::HeatingCapacitySizing; - using PlantUtilities::MyPlantSizingIndex; - using Psychrometrics::CPHW; - using SteamCoils::GetCoilSteamInletNode; - using SteamCoils::GetCoilSteamOutletNode; - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("SizeUnitHeater"); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int PltSizHeatNum; // index of plant sizing object for 1st heating loop - bool ErrorsFound; Real64 DesCoilLoad; Real64 TempSteamIn; Real64 EnthSteamInDry; Real64 EnthSteamOutWet; Real64 LatentHeatSteam; Real64 SteamDensity; - int CoilWaterInletNode(0); - int CoilWaterOutletNode(0); - int CoilSteamInletNode(0); - int CoilSteamOutletNode(0); - Real64 Cp; // local temporary for fluid specific heat - Real64 rho; // local temporary for fluid density - bool IsAutoSize; // Indicator to autosize - Real64 MaxAirVolFlowDes; // Autosized maximum air flow for reporting - Real64 MaxAirVolFlowUser; // Hardsized maximum air flow for reporting - Real64 MaxVolHotWaterFlowDes; // Autosized maximum hot water flow for reporting - Real64 MaxVolHotWaterFlowUser; // Hardsized maximum hot water flow for reporting - Real64 MaxVolHotSteamFlowDes; // Autosized maximum hot steam flow for reporting - Real64 MaxVolHotSteamFlowUser; // Hardsized maximum hot steam flow for reporting - std::string CompName; // component name - std::string CompType; // component type - std::string SizingString; // input field sizing description (e.g., Nominal Capacity) - Real64 TempSize; // autosized value of coil input field - int FieldNum = 1; // IDD numeric field number where input field description is found - int SizingMethod; // Integer representation of sizing method name (e.g., CoolingAirflowSizing, HeatingAirflowSizing, CoolingCapacitySizing, - // HeatingCapacitySizing, etc.) - bool PrintFlag; // TRUE when sizing information is reported in the eio file - int zoneHVACIndex; // index of zoneHVAC equipment sizing specification - int SAFMethod(0); // supply air flow rate sizing method (SupplyAirFlowRate, FlowPerFloorArea, FractionOfAutosizedCoolingAirflow, - // FractionOfAutosizedHeatingAirflow ...) - int CapSizingMethod(0); // capacity sizing methods (HeatingDesignCapacity, CapacityPerFloorArea, FractionOfAutosizedCoolingCapacity, and - // FractionOfAutosizedHeatingCapacity ) - bool DoWaterCoilSizing = false; // if TRUE do water coil sizing calculation - Real64 WaterCoilSizDeltaT; // water coil deltaT for design water flow rate autosizing - int CoilNum; // index of water coil object - - auto &ZoneEqSizing = state.dataSize->ZoneEqSizing; - auto &CurZoneEqNum = state.dataSize->CurZoneEqNum; - - PltSizHeatNum = 0; - ErrorsFound = false; - IsAutoSize = false; - MaxAirVolFlowDes = 0.0; - MaxAirVolFlowUser = 0.0; - MaxVolHotWaterFlowDes = 0.0; - MaxVolHotWaterFlowUser = 0.0; - MaxVolHotSteamFlowDes = 0.0; - MaxVolHotSteamFlowUser = 0.0; + Real64 Cp; // local temporary for fluid specific heat + Real64 rho; // local temporary for fluid density + std::string SizingString; // input field sizing description (e.g., Nominal Capacity) + Real64 TempSize; // autosized value of coil input field + bool PrintFlag; // TRUE when sizing information is reported in the eio file + int zoneHVACIndex; // index of zoneHVAC equipment sizing specification + Real64 WaterCoilSizDeltaT; // water coil deltaT for design water flow rate autosizing + + int &CurZoneEqNum = state.dataSize->CurZoneEqNum; + + bool ErrorsFound = false; + Real64 MaxAirVolFlowDes = 0.0; + Real64 MaxAirVolFlowUser = 0.0; + Real64 MaxVolHotWaterFlowDes = 0.0; + Real64 MaxVolHotWaterFlowUser = 0.0; + Real64 MaxVolHotSteamFlowDes = 0.0; + Real64 MaxVolHotSteamFlowUser = 0.0; state.dataSize->DataScalableSizingON = false; state.dataSize->DataScalableCapSizingON = false; state.dataSize->ZoneHeatingOnlyFan = true; - CompType = "ZoneHVAC:UnitHeater"; - CompName = state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name; + std::string CompType = "ZoneHVAC:UnitHeater"; + std::string CompName = state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name; state.dataSize->DataZoneNumber = state.dataUnitHeaters->UnitHeat(UnitHeatNum).ZonePtr; state.dataSize->DataFanType = state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanType; state.dataSize->DataFanIndex = state.dataUnitHeaters->UnitHeat(UnitHeatNum).Fan_Index; @@ -958,31 +830,32 @@ namespace UnitHeater { state.dataSize->DataFanPlacement = HVAC::FanPlace::BlowThru; if (CurZoneEqNum > 0) { + auto &ZoneEqSizing = state.dataSize->ZoneEqSizing(CurZoneEqNum); if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).HVACSizingIndex > 0) { zoneHVACIndex = state.dataUnitHeaters->UnitHeat(UnitHeatNum).HVACSizingIndex; - SizingMethod = HeatingAirflowSizing; - FieldNum = 1; // N1 , \field Maximum Supply Air Flow Rate + int SizingMethod = HVAC::HeatingAirflowSizing; + int FieldNum = 1; // N1 , \field Maximum Supply Air Flow Rate PrintFlag = true; SizingString = state.dataUnitHeaters->UnitHeatNumericFields(UnitHeatNum).FieldNames(FieldNum) + " [m3/s]"; - SAFMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).HeatingSAFMethod; - ZoneEqSizing(CurZoneEqNum).SizingMethod(SizingMethod) = SAFMethod; - if (SAFMethod == None || SAFMethod == SupplyAirFlowRate || SAFMethod == FlowPerFloorArea || - SAFMethod == FractionOfAutosizedHeatingAirflow) { - if (SAFMethod == SupplyAirFlowRate) { + int SAFMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).HeatingSAFMethod; + ZoneEqSizing.SizingMethod(SizingMethod) = SAFMethod; + if (SAFMethod == DataSizing::None || SAFMethod == DataSizing::SupplyAirFlowRate || SAFMethod == DataSizing::FlowPerFloorArea || + SAFMethod == DataSizing::FractionOfAutosizedHeatingAirflow) { + if (SAFMethod == DataSizing::SupplyAirFlowRate) { if (state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxHeatAirVolFlow > 0.0) { - ZoneEqSizing(CurZoneEqNum).AirVolFlow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxHeatAirVolFlow; - ZoneEqSizing(CurZoneEqNum).SystemAirFlow = true; + ZoneEqSizing.AirVolFlow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxHeatAirVolFlow; + ZoneEqSizing.SystemAirFlow = true; } TempSize = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxHeatAirVolFlow; - } else if (SAFMethod == FlowPerFloorArea) { - ZoneEqSizing(CurZoneEqNum).SystemAirFlow = true; - ZoneEqSizing(CurZoneEqNum).AirVolFlow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxHeatAirVolFlow * - state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea; - TempSize = ZoneEqSizing(CurZoneEqNum).AirVolFlow; + } else if (SAFMethod == DataSizing::FlowPerFloorArea) { + ZoneEqSizing.SystemAirFlow = true; + ZoneEqSizing.AirVolFlow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxHeatAirVolFlow * + state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea; + TempSize = ZoneEqSizing.AirVolFlow; state.dataSize->DataScalableSizingON = true; - } else if (SAFMethod == FractionOfAutosizedHeatingAirflow) { + } else if (SAFMethod == DataSizing::FractionOfAutosizedHeatingAirflow) { state.dataSize->DataFracOfAutosizedCoolingAirflow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxHeatAirVolFlow; - TempSize = AutoSize; + TempSize = DataSizing::AutoSize; state.dataSize->DataScalableSizingON = true; } else { TempSize = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxHeatAirVolFlow; @@ -994,9 +867,8 @@ namespace UnitHeater { sizingHeatingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxAirVolFlow = sizingHeatingAirFlow.size(state, TempSize, errorsFound); - } else if (SAFMethod == FlowPerHeatingCapacity) { - SizingMethod = HeatingCapacitySizing; - TempSize = AutoSize; + } else if (SAFMethod == DataSizing::FlowPerHeatingCapacity) { + TempSize = DataSizing::AutoSize; PrintFlag = false; state.dataSize->DataScalableSizingON = true; state.dataSize->DataFlowUsedForSizing = state.dataSize->FinalZoneSizing(CurZoneEqNum).DesHeatVolFlow; @@ -1005,14 +877,13 @@ namespace UnitHeater { sizerHeatingCapacity.overrideSizingString(SizingString); sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); TempSize = sizerHeatingCapacity.size(state, TempSize, errorsFound); - if (state.dataSize->ZoneHVACSizing(zoneHVACIndex).HeatingCapMethod == FractionOfAutosizedHeatingCapacity) { + if (state.dataSize->ZoneHVACSizing(zoneHVACIndex).HeatingCapMethod == DataSizing::FractionOfAutosizedHeatingCapacity) { state.dataSize->DataFracOfAutosizedHeatingCapacity = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity; } state.dataSize->DataAutosizedHeatingCapacity = TempSize; state.dataSize->DataFlowPerHeatingCapacity = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxHeatAirVolFlow; - SizingMethod = HeatingAirflowSizing; PrintFlag = true; - TempSize = AutoSize; + TempSize = DataSizing::AutoSize; errorsFound = false; HeatingAirFlowSizer sizingHeatingAirFlow; sizingHeatingAirFlow.overrideSizingString(SizingString); @@ -1024,8 +895,7 @@ namespace UnitHeater { } else { // no scalble sizing method has been specified. Sizing proceeds using the method // specified in the zoneHVAC object - SizingMethod = HeatingAirflowSizing; - FieldNum = 1; // N1 , \field Maximum Supply Air Flow Rate + int FieldNum = 1; // N1 , \field Maximum Supply Air Flow Rate PrintFlag = true; SizingString = state.dataUnitHeaters->UnitHeatNumericFields(UnitHeatNum).FieldNames(FieldNum) + " [m3/s]"; TempSize = state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxAirVolFlow; @@ -1038,8 +908,8 @@ namespace UnitHeater { } } - IsAutoSize = false; - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotWaterFlow == AutoSize) { + bool IsAutoSize = false; + if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotWaterFlow == DataSizing::AutoSize) { IsAutoSize = true; } @@ -1057,18 +927,19 @@ namespace UnitHeater { } else { CheckZoneSizing(state, "ZoneHVAC:UnitHeater", state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name); - CoilWaterInletNode = WaterCoils::GetCoilWaterInletNode( + int CoilWaterInletNode = WaterCoils::GetCoilWaterInletNode( state, "Coil:Heating:Water", state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, ErrorsFound); - CoilWaterOutletNode = WaterCoils::GetCoilWaterOutletNode( + int CoilWaterOutletNode = WaterCoils::GetCoilWaterOutletNode( state, "Coil:Heating:Water", state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, ErrorsFound); if (IsAutoSize) { - PltSizHeatNum = MyPlantSizingIndex(state, - "Coil:Heating:Water", - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, - CoilWaterInletNode, - CoilWaterOutletNode, - ErrorsFound); - CoilNum = WaterCoils::GetWaterCoilIndex( + bool DoWaterCoilSizing = false; // if TRUE do water coil sizing calculation + PltSizHeatNum = PlantUtilities::MyPlantSizingIndex(state, + "Coil:Heating:Water", + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, + CoilWaterInletNode, + CoilWaterOutletNode, + ErrorsFound); + int CoilNum = WaterCoils::GetWaterCoilIndex( state, "COIL:HEATING:WATER", state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, ErrorsFound); if (state.dataWaterCoils->WaterCoil(CoilNum).UseDesignWaterDeltaTemp) { WaterCoilSizDeltaT = state.dataWaterCoils->WaterCoil(CoilNum).DesignWaterDeltaTemp; @@ -1088,33 +959,32 @@ namespace UnitHeater { } if (DoWaterCoilSizing) { - SizingMethod = HeatingCapacitySizing; + auto &ZoneEqSizing = state.dataSize->ZoneEqSizing(CurZoneEqNum); + int SizingMethod = HVAC::HeatingCapacitySizing; if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).HVACSizingIndex > 0) { zoneHVACIndex = state.dataUnitHeaters->UnitHeat(UnitHeatNum).HVACSizingIndex; - CapSizingMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).HeatingCapMethod; - ZoneEqSizing(CurZoneEqNum).SizingMethod(SizingMethod) = CapSizingMethod; - if (CapSizingMethod == HeatingDesignCapacity || CapSizingMethod == CapacityPerFloorArea || - CapSizingMethod == FractionOfAutosizedHeatingCapacity) { - if (CapSizingMethod == HeatingDesignCapacity) { - if (state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity == AutoSize) { - ZoneEqSizing(CurZoneEqNum).DesHeatingLoad = state.dataSize->FinalZoneSizing(CurZoneEqNum).DesHeatLoad; + int CapSizingMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).HeatingCapMethod; + ZoneEqSizing.SizingMethod(SizingMethod) = CapSizingMethod; + if (CapSizingMethod == DataSizing::HeatingDesignCapacity || CapSizingMethod == DataSizing::CapacityPerFloorArea || + CapSizingMethod == DataSizing::FractionOfAutosizedHeatingCapacity) { + if (CapSizingMethod == DataSizing::HeatingDesignCapacity) { + if (state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity == DataSizing::AutoSize) { + ZoneEqSizing.DesHeatingLoad = state.dataSize->FinalZoneSizing(CurZoneEqNum).DesHeatLoad; } else { - ZoneEqSizing(CurZoneEqNum).DesHeatingLoad = - state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity; + ZoneEqSizing.DesHeatingLoad = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity; } - ZoneEqSizing(CurZoneEqNum).HeatingCapacity = true; - TempSize = AutoSize; - } else if (CapSizingMethod == CapacityPerFloorArea) { - ZoneEqSizing(CurZoneEqNum).HeatingCapacity = true; - ZoneEqSizing(CurZoneEqNum).DesHeatingLoad = - state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity * - state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea; + ZoneEqSizing.HeatingCapacity = true; + TempSize = DataSizing::AutoSize; + } else if (CapSizingMethod == DataSizing::CapacityPerFloorArea) { + ZoneEqSizing.HeatingCapacity = true; + ZoneEqSizing.DesHeatingLoad = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity * + state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea; state.dataSize->DataScalableCapSizingON = true; - } else if (CapSizingMethod == FractionOfAutosizedHeatingCapacity) { + } else if (CapSizingMethod == DataSizing::FractionOfAutosizedHeatingCapacity) { state.dataSize->DataFracOfAutosizedHeatingCapacity = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity; state.dataSize->DataScalableCapSizingON = true; - TempSize = AutoSize; + TempSize = DataSizing::AutoSize; } } PrintFlag = false; @@ -1127,9 +997,9 @@ namespace UnitHeater { } else { SizingString = ""; PrintFlag = false; - TempSize = AutoSize; - ZoneEqSizing(CurZoneEqNum).HeatingCapacity = true; - ZoneEqSizing(CurZoneEqNum).DesHeatingLoad = state.dataSize->FinalZoneSizing(CurZoneEqNum).DesHeatLoad; + TempSize = DataSizing::AutoSize; + ZoneEqSizing.HeatingCapacity = true; + ZoneEqSizing.DesHeatingLoad = state.dataSize->FinalZoneSizing(CurZoneEqNum).DesHeatLoad; bool errorsFound = false; HeatingCapacitySizer sizerHeatingCapacity; sizerHeatingCapacity.overrideSizingString(SizingString); @@ -1137,26 +1007,16 @@ namespace UnitHeater { DesCoilLoad = sizerHeatingCapacity.size(state, TempSize, errorsFound); } - if (DesCoilLoad >= SmallLoad) { - rho = FluidProperties::GetDensityGlycol( - state, - state.dataPlnt->PlantLoop(state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc.loopNum).FluidIndex, - RoutineName); - Cp = FluidProperties::GetSpecificHeatGlycol( - state, - state.dataPlnt->PlantLoop(state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc.loopNum).FluidIndex, - RoutineName); + if (DesCoilLoad >= HVAC::SmallLoad) { + rho = state.dataPlnt->PlantLoop(state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc.loopNum) + .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); + Cp = state.dataPlnt->PlantLoop(state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc.loopNum) + .glycol->getSpecificHeat(state, Constant::HWInitConvTemp, RoutineName); MaxVolHotWaterFlowDes = DesCoilLoad / (WaterCoilSizDeltaT * Cp * rho); } else { MaxVolHotWaterFlowDes = 0.0; } } - } - if (IsAutoSize) { state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotWaterFlow = MaxVolHotWaterFlowDes; BaseSizer::reportSizerOutput(state, "ZoneHVAC:UnitHeater", @@ -1196,7 +1056,7 @@ namespace UnitHeater { } IsAutoSize = false; - if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotSteamFlow == AutoSize) { + if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotSteamFlow == DataSizing::AutoSize) { IsAutoSize = true; } @@ -1212,50 +1072,48 @@ namespace UnitHeater { state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotSteamFlow); } } else { + auto &ZoneEqSizing = state.dataSize->ZoneEqSizing(CurZoneEqNum); CheckZoneSizing(state, "ZoneHVAC:UnitHeater", state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name); - CoilSteamInletNode = - GetCoilSteamInletNode(state, "Coil:Heating:Steam", state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, ErrorsFound); - CoilSteamOutletNode = - GetCoilSteamInletNode(state, "Coil:Heating:Steam", state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, ErrorsFound); + int CoilSteamInletNode = SteamCoils::GetCoilSteamInletNode( + state, "Coil:Heating:Steam", state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, ErrorsFound); + int CoilSteamOutletNode = SteamCoils::GetCoilSteamInletNode( + state, "Coil:Heating:Steam", state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, ErrorsFound); if (IsAutoSize) { - PltSizHeatNum = MyPlantSizingIndex(state, - "Coil:Heating:Steam", - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, - CoilSteamInletNode, - CoilSteamOutletNode, - ErrorsFound); + PltSizHeatNum = PlantUtilities::MyPlantSizingIndex(state, + "Coil:Heating:Steam", + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, + CoilSteamInletNode, + CoilSteamOutletNode, + ErrorsFound); if (PltSizHeatNum > 0) { if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).HVACSizingIndex > 0) { zoneHVACIndex = state.dataUnitHeaters->UnitHeat(UnitHeatNum).HVACSizingIndex; - SizingMethod = HeatingCapacitySizing; - CapSizingMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).HeatingCapMethod; - ZoneEqSizing(CurZoneEqNum).SizingMethod(SizingMethod) = CapSizingMethod; - if (CapSizingMethod == HeatingDesignCapacity || CapSizingMethod == CapacityPerFloorArea || - CapSizingMethod == FractionOfAutosizedHeatingCapacity) { - if (CapSizingMethod == HeatingDesignCapacity) { - if (state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity == AutoSize) { - ZoneEqSizing(CurZoneEqNum).DesHeatingLoad = state.dataSize->FinalZoneSizing(CurZoneEqNum).DesHeatLoad; + int SizingMethod = HVAC::HeatingCapacitySizing; + int CapSizingMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).HeatingCapMethod; + ZoneEqSizing.SizingMethod(SizingMethod) = CapSizingMethod; + if (CapSizingMethod == DataSizing::HeatingDesignCapacity || CapSizingMethod == DataSizing::CapacityPerFloorArea || + CapSizingMethod == DataSizing::FractionOfAutosizedHeatingCapacity) { + if (CapSizingMethod == DataSizing::HeatingDesignCapacity) { + if (state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity == DataSizing::AutoSize) { + ZoneEqSizing.DesHeatingLoad = state.dataSize->FinalZoneSizing(CurZoneEqNum).DesHeatLoad; } else { - ZoneEqSizing(CurZoneEqNum).DesHeatingLoad = - state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity; + ZoneEqSizing.DesHeatingLoad = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity; } - ZoneEqSizing(CurZoneEqNum).HeatingCapacity = true; - TempSize = AutoSize; - } else if (CapSizingMethod == CapacityPerFloorArea) { - ZoneEqSizing(CurZoneEqNum).HeatingCapacity = true; - ZoneEqSizing(CurZoneEqNum).DesHeatingLoad = - state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity * - state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea; + ZoneEqSizing.HeatingCapacity = true; + TempSize = DataSizing::AutoSize; + } else if (CapSizingMethod == DataSizing::CapacityPerFloorArea) { + ZoneEqSizing.HeatingCapacity = true; + ZoneEqSizing.DesHeatingLoad = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity * + state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea; state.dataSize->DataScalableCapSizingON = true; - } else if (CapSizingMethod == FractionOfAutosizedHeatingCapacity) { + } else if (CapSizingMethod == DataSizing::FractionOfAutosizedHeatingCapacity) { state.dataSize->DataFracOfAutosizedHeatingCapacity = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity; - TempSize = AutoSize; + TempSize = DataSizing::AutoSize; state.dataSize->DataScalableCapSizingON = true; } } - SizingMethod = HeatingCapacitySizing; PrintFlag = false; bool errorsFound = false; HeatingCapacitySizer sizerHeatingCapacity; @@ -1266,18 +1124,17 @@ namespace UnitHeater { } else { DesCoilLoad = state.dataSize->FinalZoneSizing(CurZoneEqNum).DesHeatLoad; } - if (DesCoilLoad >= SmallLoad) { + if (DesCoilLoad >= HVAC::SmallLoad) { TempSteamIn = 100.00; - EnthSteamInDry = FluidProperties::GetSatEnthalpyRefrig( - state, fluidNameSteam, TempSteamIn, 1.0, state.dataUnitHeaters->RefrigIndex, RoutineName); - EnthSteamOutWet = FluidProperties::GetSatEnthalpyRefrig( - state, fluidNameSteam, TempSteamIn, 0.0, state.dataUnitHeaters->RefrigIndex, RoutineName); + auto *steam = Fluid::GetSteam(state); + EnthSteamInDry = steam->getSatEnthalpy(state, TempSteamIn, 1.0, RoutineName); + EnthSteamOutWet = steam->getSatEnthalpy(state, TempSteamIn, 0.0, RoutineName); LatentHeatSteam = EnthSteamInDry - EnthSteamOutWet; - SteamDensity = FluidProperties::GetSatDensityRefrig( - state, fluidNameSteam, TempSteamIn, 1.0, state.dataUnitHeaters->RefrigIndex, RoutineName); + SteamDensity = steam->getSatDensity(state, TempSteamIn, 1.0, RoutineName); MaxVolHotSteamFlowDes = - DesCoilLoad / (SteamDensity * (LatentHeatSteam + state.dataSize->PlantSizData(PltSizHeatNum).DeltaT * - CPHW(state.dataSize->PlantSizData(PltSizHeatNum).ExitTemp))); + DesCoilLoad / (SteamDensity * (LatentHeatSteam + + state.dataSize->PlantSizData(PltSizHeatNum).DeltaT * + Psychrometrics::CPHW(state.dataSize->PlantSizData(PltSizHeatNum).ExitTemp))); } else { MaxVolHotSteamFlowDes = 0.0; } @@ -1287,8 +1144,6 @@ namespace UnitHeater { format("Occurs in ZoneHVAC:UnitHeater Object={}", state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name)); ErrorsFound = true; } - } - if (IsAutoSize) { state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotSteamFlow = MaxVolHotSteamFlowDes; BaseSizer::reportSizerOutput(state, "ZoneHVAC:UnitHeater", @@ -1334,7 +1189,8 @@ namespace UnitHeater { state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxAirVolFlow, ErrorsFound); if (CurZoneEqNum > 0) { - ZoneEqSizing(CurZoneEqNum).MaxHWVolFlow = state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotWaterFlow; + auto &ZoneEqSizing = state.dataSize->ZoneEqSizing(CurZoneEqNum); + ZoneEqSizing.MaxHWVolFlow = state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxVolHotWaterFlow; } if (ErrorsFound) { @@ -1356,7 +1212,6 @@ namespace UnitHeater { // DATE WRITTEN May 2000 // MODIFIED Don Shirey, Aug 2009 (LatOutputProvided) // July 2012, Chandan Sharma - FSEC: Added zone sys avail managers - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine mainly controls the action of the unit heater @@ -1383,54 +1238,32 @@ namespace UnitHeater { // REFERENCES: // ASHRAE Systems and Equipment Handbook (SI), 1996. page 31.7 - // Using/Aliasing - using namespace DataZoneEnergyDemands; - using General::SolveRoot; - using PlantUtilities::SetComponentFlowRate; - // SUBROUTINE PARAMETER DEFINITIONS: - int constexpr MaxIter(100); // maximum number of iterations + int constexpr MaxIter = 100; // maximum number of iterations // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int ControlNode; // the hot water inlet node - int InletNode; // unit air inlet node - int OutletNode; // unit air outlet node - Real64 ControlOffset; // tolerance for output control - Real64 MaxWaterFlow; // maximum water flow for heating or cooling [kg/sec] - Real64 MinWaterFlow; // minimum water flow for heating or cooling [kg/sec] - Real64 QUnitOut; // heating or sens. cooling provided by fan coil unit [watts] - Real64 LatentOutput; // Latent (moisture) add/removal rate, negative is dehumidification [kg/s] - Real64 SpecHumOut; // Specific humidity ratio of outlet air (kg moisture / kg moist air) - Real64 SpecHumIn; // Specific humidity ratio of inlet air (kg moisture / kg moist air) - Real64 mdot; // local temporary for fluid mass flow rate - HVAC::FanOp fanOp; - Real64 PartLoadFrac; - Real64 NoOutput; - Real64 FullOutput; - int SolFlag; // return flag from RegulaFalsi for sensible load - bool UnitOn; + Real64 SpecHumOut; // Specific humidity ratio of outlet air (kg moisture / kg moist air) + Real64 SpecHumIn; // Specific humidity ratio of inlet air (kg moisture / kg moist air) + Real64 mdot; // local temporary for fluid mass flow rate // initialize local variables - QUnitOut = 0.0; - NoOutput = 0.0; - FullOutput = 0.0; - LatentOutput = 0.0; - MaxWaterFlow = 0.0; - MinWaterFlow = 0.0; - PartLoadFrac = 0.0; - SolFlag = 0; // # of iterations IF positive, -1 means failed to converge, -2 means bounds are incorrect - InletNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode; - OutletNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirOutNode; - ControlNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode; - ControlOffset = state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlOffset; - UnitOn = false; - fanOp = state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanOp; + Real64 QUnitOut = 0.0; + Real64 NoOutput = 0.0; + Real64 FullOutput = 0.0; + Real64 LatentOutput = 0.0; // Latent (moisture) add/removal rate, negative is dehumidification [kg/s] + Real64 MaxWaterFlow = 0.0; + Real64 MinWaterFlow = 0.0; + Real64 PartLoadFrac = 0.0; + int InletNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode; + int OutletNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirOutNode; + int ControlNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode; + Real64 ControlOffset = state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlOffset; + HVAC::FanOp fanOp = state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanOp; if (fanOp != HVAC::FanOp::Cycling) { - if (GetCurrentScheduleValue(state, state.dataUnitHeaters->UnitHeat(UnitHeatNum).SchedPtr) <= 0 || - ((GetCurrentScheduleValue(state, state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanAvailSchedPtr) <= 0 && - !state.dataHVACGlobal->TurnFansOn) || + if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).availSched->getCurrentVal() <= 0 || + ((state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanAvailSched->getCurrentVal() <= 0 && !state.dataHVACGlobal->TurnFansOn) || state.dataHVACGlobal->TurnFansOff)) { // Case 1: OFF-->unit schedule says that it it not available // OR child fan in not available OR child fan not being cycled ON by sys avail manager @@ -1439,24 +1272,24 @@ namespace UnitHeater { if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).Type == HCoilType::WaterHeatingCoil) { mdot = 0.0; // try to turn off - SetComponentFlowRate(state, - mdot, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc); + PlantUtilities::SetComponentFlowRate(state, + mdot, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc); } if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).Type == HCoilType::SteamCoil) { mdot = 0.0; // try to turn off - SetComponentFlowRate(state, - mdot, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc); + PlantUtilities::SetComponentFlowRate(state, + mdot, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc); } CalcUnitHeaterComponents(state, UnitHeatNum, FirstHVACIteration, QUnitOut); - } else if ((state.dataUnitHeaters->QZnReq < SmallLoad) || state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum)) { + } else if ((state.dataUnitHeaters->QZnReq < HVAC::SmallLoad) || state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum)) { // Unit is available, but there is no load on it or we are in setback/deadband if (!state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanOffNoHeating) { @@ -1466,20 +1299,20 @@ namespace UnitHeater { if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).Type == HCoilType::WaterHeatingCoil) { mdot = 0.0; // try to turn off - SetComponentFlowRate(state, - mdot, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc); + PlantUtilities::SetComponentFlowRate(state, + mdot, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc); } if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).Type == HCoilType::SteamCoil) { mdot = 0.0; // try to turn off - SetComponentFlowRate(state, - mdot, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc); + PlantUtilities::SetComponentFlowRate(state, + mdot, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc); } CalcUnitHeaterComponents(state, UnitHeatNum, FirstHVACIteration, QUnitOut); @@ -1494,21 +1327,21 @@ namespace UnitHeater { mdot = 0.0; // try to turn off if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc.loopNum > 0) { - SetComponentFlowRate(state, - mdot, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc); + PlantUtilities::SetComponentFlowRate(state, + mdot, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc); } } if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).Type == HCoilType::SteamCoil) { mdot = 0.0; // try to turn off if (state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc.loopNum > 0) { - SetComponentFlowRate(state, - mdot, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc); + PlantUtilities::SetComponentFlowRate(state, + mdot, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc); } } @@ -1562,18 +1395,14 @@ namespace UnitHeater { break; } } - QUnitOut = state.dataLoopNodes->Node(OutletNode).MassFlowRate * - (PsyHFnTdbW(state.dataLoopNodes->Node(OutletNode).Temp, state.dataLoopNodes->Node(InletNode).HumRat) - - PsyHFnTdbW(state.dataLoopNodes->Node(InletNode).Temp, state.dataLoopNodes->Node(InletNode).HumRat)); if (state.dataLoopNodes->Node(InletNode).MassFlowRateMax > 0.0) { state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanPartLoadRatio = state.dataLoopNodes->Node(InletNode).MassFlowRate / state.dataLoopNodes->Node(InletNode).MassFlowRateMax; } } else { // OnOff fan and cycling - if ((state.dataUnitHeaters->QZnReq < SmallLoad) || (state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum)) || - GetCurrentScheduleValue(state, state.dataUnitHeaters->UnitHeat(UnitHeatNum).SchedPtr) <= 0 || - ((GetCurrentScheduleValue(state, state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanAvailSchedPtr) <= 0 && - !state.dataHVACGlobal->TurnFansOn) || + if ((state.dataUnitHeaters->QZnReq < HVAC::SmallLoad) || (state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum)) || + state.dataUnitHeaters->UnitHeat(UnitHeatNum).availSched->getCurrentVal() <= 0 || + ((state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanAvailSched->getCurrentVal() <= 0 && !state.dataHVACGlobal->TurnFansOn) || state.dataHVACGlobal->TurnFansOff)) { // Case 1: OFF-->unit schedule says that it it not available // OR child fan in not available OR child fan not being cycled ON by sys avail manager @@ -1590,18 +1419,16 @@ namespace UnitHeater { } else { // Case 4: HEATING-->unit is available and there is a heating load state.dataUnitHeaters->HCoilOn = true; - UnitOn = true; // Find part load ratio of unit heater coils PartLoadFrac = 0.0; CalcUnitHeaterComponents(state, UnitHeatNum, FirstHVACIteration, NoOutput, fanOp, PartLoadFrac); - if ((NoOutput - state.dataUnitHeaters->QZnReq) < SmallLoad) { + if ((NoOutput - state.dataUnitHeaters->QZnReq) < HVAC::SmallLoad) { // Unit heater is unable to meet the load with coil off, set PLR = 1 PartLoadFrac = 1.0; CalcUnitHeaterComponents(state, UnitHeatNum, FirstHVACIteration, FullOutput, fanOp, PartLoadFrac); - if ((FullOutput - state.dataUnitHeaters->QZnReq) > SmallLoad) { + if ((FullOutput - state.dataUnitHeaters->QZnReq) > HVAC::SmallLoad) { // Unit heater full load capacity is able to meet the load, Find PLR - HVAC::FanOp fanOp = state.dataUnitHeaters->UnitHeat(UnitHeatNum).fanOp; auto f = [&state, UnitHeatNum, FirstHVACIteration, fanOp](Real64 const PartLoadRatio) { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: @@ -1617,7 +1444,8 @@ namespace UnitHeater { }; // Tolerance is in fraction of load, MaxIter = 30, SolFalg = # of iterations or error as appropriate - SolveRoot(state, 0.001, MaxIter, SolFlag, PartLoadFrac, f, 0.0, 1.0); + int SolFlag = 0; // # of iterations IF positive, -1 means failed to converge, -2 means bounds are incorrect + General::SolveRoot(state, 0.001, MaxIter, SolFlag, PartLoadFrac, f, 0.0, 1.0); } } @@ -1635,8 +1463,8 @@ namespace UnitHeater { LatentOutput = state.dataLoopNodes->Node(OutletNode).MassFlowRate * (SpecHumOut - SpecHumIn); // Latent rate (kg/s), dehumid = negative QUnitOut = state.dataLoopNodes->Node(OutletNode).MassFlowRate * - (PsyHFnTdbW(state.dataLoopNodes->Node(OutletNode).Temp, state.dataLoopNodes->Node(InletNode).HumRat) - - PsyHFnTdbW(state.dataLoopNodes->Node(InletNode).Temp, state.dataLoopNodes->Node(InletNode).HumRat)); + (Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(OutletNode).Temp, state.dataLoopNodes->Node(InletNode).HumRat) - + Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(InletNode).Temp, state.dataLoopNodes->Node(InletNode).HumRat)); // Report variables... state.dataUnitHeaters->UnitHeat(UnitHeatNum).HeatPower = max(0.0, QUnitOut); @@ -1660,7 +1488,6 @@ namespace UnitHeater { // AUTHOR Rick Strand // DATE WRITTEN May 2000 // MODIFIED July 2012, Chandan Sharma - FSEC: Added zone sys avail managers - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine launches the individual component simulations. @@ -1671,24 +1498,15 @@ namespace UnitHeater { // METHODOLOGY EMPLOYED: // Simply calls the different components in order. - // Using/Aliasing - using HeatingCoils::SimulateHeatingCoilComponents; - using PlantUtilities::SetComponentFlowRate; - using SteamCoils::SimulateSteamCoilComponents; - using WaterCoils::SimulateWaterCoilComponents; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 AirMassFlow; // total mass flow through the unit Real64 CpAirZn; // specific heat of dry air at zone conditions (zone conditions same as unit inlet) int HCoilInAirNode; // inlet node number for fan exit/coil inlet - int InletNode; // unit air inlet node - int OutletNode; // unit air outlet node - Real64 QCoilReq; // Heat addition required from an electric/gas heating coil Real64 mdot; // local temporary for fluid mass flow rate - InletNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode; - OutletNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirOutNode; - QCoilReq = 0.0; + int InletNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode; + int OutletNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirOutNode; + Real64 QCoilReq = 0.0; if (fanOp != HVAC::FanOp::Cycling) { state.dataFans->fans(state.dataUnitHeaters->UnitHeat(UnitHeatNum).Fan_Index)->simulate(state, FirstHVACIteration, _, _); @@ -1697,10 +1515,10 @@ namespace UnitHeater { case HCoilType::WaterHeatingCoil: { - SimulateWaterCoilComponents(state, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, - FirstHVACIteration, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoil_Index); + WaterCoils::SimulateWaterCoilComponents(state, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, + FirstHVACIteration, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoil_Index); break; } case HCoilType::SteamCoil: { @@ -1709,18 +1527,18 @@ namespace UnitHeater { QCoilReq = 0.0; } else { HCoilInAirNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanOutletNode; - CpAirZn = PsyCpAirFnW(state.dataLoopNodes->Node(state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode).HumRat); + CpAirZn = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode).HumRat); QCoilReq = state.dataUnitHeaters->QZnReq - state.dataLoopNodes->Node(HCoilInAirNode).MassFlowRate * CpAirZn * (state.dataLoopNodes->Node(HCoilInAirNode).Temp - state.dataLoopNodes->Node(state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode).Temp); } if (QCoilReq < 0.0) QCoilReq = 0.0; // a heating coil can only heat, not cool - SimulateSteamCoilComponents(state, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, - FirstHVACIteration, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoil_Index, - QCoilReq); + SteamCoils::SimulateSteamCoilComponents(state, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, + FirstHVACIteration, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoil_Index, + QCoilReq); break; } case HCoilType::Electric: @@ -1730,18 +1548,18 @@ namespace UnitHeater { QCoilReq = 0.0; } else { HCoilInAirNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanOutletNode; - CpAirZn = PsyCpAirFnW(state.dataLoopNodes->Node(state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode).HumRat); + CpAirZn = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode).HumRat); QCoilReq = state.dataUnitHeaters->QZnReq - state.dataLoopNodes->Node(HCoilInAirNode).MassFlowRate * CpAirZn * (state.dataLoopNodes->Node(HCoilInAirNode).Temp - state.dataLoopNodes->Node(state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode).Temp); } if (QCoilReq < 0.0) QCoilReq = 0.0; // a heating coil can only heat, not cool - SimulateHeatingCoilComponents(state, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, - FirstHVACIteration, - QCoilReq, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoil_Index); + HeatingCoils::SimulateHeatingCoilComponents(state, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, + FirstHVACIteration, + QCoilReq, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoil_Index); break; } default: @@ -1772,7 +1590,7 @@ namespace UnitHeater { QCoilReq = 0.0; } else { HCoilInAirNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanOutletNode; - CpAirZn = PsyCpAirFnW(state.dataLoopNodes->Node(state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode).HumRat); + CpAirZn = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode).HumRat); QCoilReq = state.dataUnitHeaters->QZnReq - state.dataLoopNodes->Node(HCoilInAirNode).MassFlowRate * CpAirZn * (state.dataLoopNodes->Node(HCoilInAirNode).Temp - @@ -1780,18 +1598,18 @@ namespace UnitHeater { mdot = state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxHotWaterFlow * PartLoadRatio; } if (QCoilReq < 0.0) QCoilReq = 0.0; // a heating coil can only heat, not cool - SetComponentFlowRate(state, - mdot, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc); - SimulateWaterCoilComponents(state, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, - FirstHVACIteration, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoil_Index, - QCoilReq, - fanOp, - PartLoadRatio); + PlantUtilities::SetComponentFlowRate(state, + mdot, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc); + WaterCoils::SimulateWaterCoilComponents(state, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, + FirstHVACIteration, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoil_Index, + QCoilReq, + fanOp, + PartLoadRatio); break; } case HCoilType::SteamCoil: { @@ -1800,7 +1618,7 @@ namespace UnitHeater { QCoilReq = 0.0; } else { HCoilInAirNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanOutletNode; - CpAirZn = PsyCpAirFnW(state.dataLoopNodes->Node(state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode).HumRat); + CpAirZn = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode).HumRat); QCoilReq = state.dataUnitHeaters->QZnReq - state.dataLoopNodes->Node(HCoilInAirNode).MassFlowRate * CpAirZn * (state.dataLoopNodes->Node(HCoilInAirNode).Temp - @@ -1808,19 +1626,19 @@ namespace UnitHeater { mdot = state.dataUnitHeaters->UnitHeat(UnitHeatNum).MaxHotSteamFlow * PartLoadRatio; } if (QCoilReq < 0.0) QCoilReq = 0.0; // a heating coil can only heat, not cool - SetComponentFlowRate(state, - mdot, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc); - SimulateSteamCoilComponents(state, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, - FirstHVACIteration, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoil_Index, - QCoilReq, - _, - fanOp, - PartLoadRatio); + PlantUtilities::SetComponentFlowRate(state, + mdot, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotControlNode, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HotCoilOutNodeNum, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc); + SteamCoils::SimulateSteamCoilComponents(state, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, + FirstHVACIteration, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoil_Index, + QCoilReq, + _, + fanOp, + PartLoadRatio); break; } case HCoilType::Electric: @@ -1830,22 +1648,22 @@ namespace UnitHeater { QCoilReq = 0.0; } else { HCoilInAirNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).FanOutletNode; - CpAirZn = PsyCpAirFnW(state.dataLoopNodes->Node(state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode).HumRat); + CpAirZn = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode).HumRat); QCoilReq = state.dataUnitHeaters->QZnReq - state.dataLoopNodes->Node(HCoilInAirNode).MassFlowRate * CpAirZn * (state.dataLoopNodes->Node(HCoilInAirNode).Temp - state.dataLoopNodes->Node(state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode).Temp); } if (QCoilReq < 0.0) QCoilReq = 0.0; // a heating coil can only heat, not cool - SimulateHeatingCoilComponents(state, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, - FirstHVACIteration, - QCoilReq, - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoil_Index, - _, - _, - fanOp, - PartLoadRatio); + HeatingCoils::SimulateHeatingCoilComponents(state, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, + FirstHVACIteration, + QCoilReq, + state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoil_Index, + _, + _, + fanOp, + PartLoadRatio); break; } default: @@ -1854,8 +1672,8 @@ namespace UnitHeater { state.dataLoopNodes->Node(OutletNode).MassFlowRate = state.dataLoopNodes->Node(InletNode).MassFlowRate; // maintain continuity through unit heater } - LoadMet = AirMassFlow * (PsyHFnTdbW(state.dataLoopNodes->Node(OutletNode).Temp, state.dataLoopNodes->Node(InletNode).HumRat) - - PsyHFnTdbW(state.dataLoopNodes->Node(InletNode).Temp, state.dataLoopNodes->Node(InletNode).HumRat)); + LoadMet = AirMassFlow * (Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(OutletNode).Temp, state.dataLoopNodes->Node(InletNode).HumRat) - + Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(InletNode).Temp, state.dataLoopNodes->Node(InletNode).HumRat)); } // SUBROUTINE UpdateUnitHeater @@ -1871,8 +1689,6 @@ namespace UnitHeater { // SUBROUTINE INFORMATION: // AUTHOR Rick Strand // DATE WRITTEN May 2000 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine needs a description. diff --git a/src/EnergyPlus/UnitHeater.hh b/src/EnergyPlus/UnitHeater.hh index d0a95f1011e..e5b59080522 100644 --- a/src/EnergyPlus/UnitHeater.hh +++ b/src/EnergyPlus/UnitHeater.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -56,6 +56,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -85,16 +86,15 @@ namespace UnitHeater { { // Members // Input data - std::string Name; // name of unit - std::string SchedName; // availability schedule - int SchedPtr; // index to schedule - int AirInNode; // inlet air node number - int AirOutNode; // outlet air node number - HVAC::FanType fanType; // Fan type number (see DataHVACGlobals) - std::string FanName; // name of fan + std::string Name; // name of unit + Sched::Schedule *availSched = nullptr; // availability schedule + int AirInNode; // inlet air node number + int AirOutNode; // outlet air node number + HVAC::FanType fanType; // Fan type number (see DataHVACGlobals) + std::string FanName; // name of fan int Fan_Index; - int FanSchedPtr; // index to fan operating mode schedule - int FanAvailSchedPtr; // index to fan availability schedule + Sched::Schedule *fanOpModeSched = nullptr; // fan operating mode schedule + Sched::Schedule *fanAvailSched = nullptr; // fan availability schedule int ControlCompTypeNum; int CompErrIndex; Real64 MaxAirVolFlow; // m3/s @@ -108,7 +108,7 @@ namespace UnitHeater { std::string HCoilName; // name of heating coil int HCoil_Index; DataPlant::PlantEquipmentType HeatingCoilType; - int HCoil_FluidIndex; + Fluid::RefrigProps *HCoil_fluid = nullptr; Real64 MaxVolHotWaterFlow; // m3/s Real64 MaxVolHotSteamFlow; // m3/s Real64 MaxHotWaterFlow; // kg/s @@ -137,13 +137,12 @@ namespace UnitHeater { // Default Constructor UnitHeaterData() - : SchedPtr(0), AirInNode(0), AirOutNode(0), fanType(HVAC::FanType::Invalid), Fan_Index(0), FanSchedPtr(0), FanAvailSchedPtr(0), - ControlCompTypeNum(0), CompErrIndex(0), MaxAirVolFlow(0.0), MaxAirMassFlow(0.0), FanOutletNode(0), HCoil_Index(0), - HeatingCoilType(DataPlant::PlantEquipmentType::Invalid), HCoil_FluidIndex(0), MaxVolHotWaterFlow(0.0), MaxVolHotSteamFlow(0.0), - MaxHotWaterFlow(0.0), MaxHotSteamFlow(0.0), MinVolHotWaterFlow(0.0), MinVolHotSteamFlow(0.0), MinHotWaterFlow(0.0), - MinHotSteamFlow(0.0), HotControlNode(0), HotControlOffset(0.0), HotCoilOutNodeNum(0), HWplantLoc{}, PartLoadFrac(0.0), HeatPower(0.0), - HeatEnergy(0.0), ElecPower(0.0), ElecEnergy(0.0), FanOffNoHeating(false), FanPartLoadRatio(0.0), ZonePtr(0), HVACSizingIndex(0), - FirstPass(true) + : AirInNode(0), AirOutNode(0), fanType(HVAC::FanType::Invalid), Fan_Index(0), ControlCompTypeNum(0), CompErrIndex(0), MaxAirVolFlow(0.0), + MaxAirMassFlow(0.0), FanOutletNode(0), HCoil_Index(0), HeatingCoilType(DataPlant::PlantEquipmentType::Invalid), MaxVolHotWaterFlow(0.0), + MaxVolHotSteamFlow(0.0), MaxHotWaterFlow(0.0), MaxHotSteamFlow(0.0), MinVolHotWaterFlow(0.0), MinVolHotSteamFlow(0.0), + MinHotWaterFlow(0.0), MinHotSteamFlow(0.0), HotControlNode(0), HotControlOffset(0.0), HotCoilOutNodeNum(0), HWplantLoc{}, + PartLoadFrac(0.0), HeatPower(0.0), HeatEnergy(0.0), ElecPower(0.0), ElecEnergy(0.0), FanOffNoHeating(false), FanPartLoadRatio(0.0), + ZonePtr(0), HVACSizingIndex(0), FirstPass(true) { } }; @@ -232,7 +231,9 @@ struct UnitHeatersData : BaseGlobalStruct Array1D_bool MyPlantScanFlag; Array1D_bool MyZoneEqFlag; // used to set up zone equipment availability managers - int RefrigIndex = 0; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } void init_state([[maybe_unused]] EnergyPlusData &state) override { @@ -254,7 +255,6 @@ struct UnitHeatersData : BaseGlobalStruct this->MyEnvrnFlag.deallocate(); this->MyPlantScanFlag.deallocate(); this->MyZoneEqFlag.deallocate(); - this->RefrigIndex = 0; } // Default Constructor diff --git a/src/EnergyPlus/UnitVentilator.cc b/src/EnergyPlus/UnitVentilator.cc index 3d9352d8a1a..f27c5ae09c6 100644 --- a/src/EnergyPlus/UnitVentilator.cc +++ b/src/EnergyPlus/UnitVentilator.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -50,7 +50,6 @@ // ObjexxFCL Headers #include -#include // EnergyPlus Headers #include @@ -116,8 +115,6 @@ namespace UnitVentilator { // ASHRAE Systems and Equipment Handbook (SI), 1996. pp. 31.1-31.3 // Fred Buhl's fan coil module (FanCoilUnits.cc) - static constexpr std::string_view fluidNameSteam("STEAM"); - static constexpr std::string_view fluidNameWater("WATER"); static constexpr std::array(CoilsUsed::Num)> CoilsUsedNamesUC = { "NONE", "HEATINGANDCOOLING", "HEATING", "COOLING"}; static constexpr std::array(OAControl::Num)> OAControlNamesUC = { @@ -280,14 +277,10 @@ namespace UnitVentilator { unitVent.Name = Alphas(1); if (lAlphaBlanks(2)) { - unitVent.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - unitVent.SchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (unitVent.SchedPtr == 0) { - ShowSevereError(state, format("{}{}=\"{}\".", RoutineName, CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("not found: {}=\"{}\".", cAlphaFields(2), Alphas(2))); - ErrorsFound = true; - } + unitVent.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((unitVent.availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } unitVent.MaxAirVolFlow = Numbers(1); @@ -295,10 +288,11 @@ namespace UnitVentilator { // Outside air information: unitVent.MinOutAirVolFlow = Numbers(2); - unitVent.MinOASchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(4)); // convert schedule name to pointer - if (unitVent.MinOASchedPtr == 0) { - ShowSevereError(state, format("{}{}=\"{}\".", RoutineName, CurrentModuleObject, unitVent.Name)); - ShowContinueError(state, format("not found: {}=\"{}\".", cAlphaFields(4), Alphas(4))); + if (lAlphaBlanks(4)) { + ShowSevereEmptyField(state, eoh, cAlphaFields(4)); + ErrorsFound = true; + } else if ((unitVent.minOASched = Sched::GetSchedule(state, Alphas(4))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(4), Alphas(4)); ErrorsFound = true; } @@ -306,35 +300,36 @@ namespace UnitVentilator { cCoolingCoilType = ""; cHeatingCoilType = ""; - { - unitVent.OAControlType = (OAControl)getEnumValue(OAControlNamesUC, Alphas(3)); - switch (unitVent.OAControlType) { - case OAControl::VariablePercent: - case OAControl::FixedAmount: { - unitVent.MaxOASchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(5)); // convert schedule name to pointer - if (unitVent.MaxOASchedPtr == 0) { - ShowSevereError(state, format("{}{}=\"{}\".", RoutineName, CurrentModuleObject, unitVent.Name)); - ShowContinueError(state, format("not found: {}=\"{}\".", cAlphaFields(5), Alphas(5))); - ErrorsFound = true; - } else if (!ScheduleManager::CheckScheduleValueMinMax(state, unitVent.MaxOASchedPtr, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{}{}=\"{}\".", RoutineName, CurrentModuleObject, unitVent.Name)); - ShowContinueError(state, format("out of range [0,1]: {}=\"{}\".", cAlphaFields(5), Alphas(5))); - ErrorsFound = true; - } - } break; - case OAControl::FixedTemperature: { - unitVent.TempSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(5)); // convert schedule name to pointer - if (unitVent.TempSchedPtr == 0) { - ShowSevereError(state, format("{}{}=\"{}\".", RoutineName, CurrentModuleObject, unitVent.Name)); - ShowContinueError(state, format("not found: {}=\"{}\".", cAlphaFields(5), Alphas(5))); - ErrorsFound = true; - } - } break; - default: { - assert(false); - } break; + unitVent.OAControlType = static_cast(getEnumValue(OAControlNamesUC, Alphas(3))); + switch (unitVent.OAControlType) { + case OAControl::VariablePercent: + case OAControl::FixedAmount: { + if (lAlphaBlanks(5)) { + ShowSevereEmptyField(state, eoh, cAlphaFields(5)); + ErrorsFound = true; + } else if ((unitVent.maxOASched = Sched::GetSchedule(state, Alphas(5))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(5), Alphas(5)); + ErrorsFound = true; + } else if (!unitVent.maxOASched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFields(5), Alphas(5), Clusive::In, 0.0, Clusive::In, 1.0); + ErrorsFound = true; } - } + } break; + + case OAControl::FixedTemperature: { + if (lAlphaBlanks(5)) { + ShowSevereEmptyField(state, eoh, cAlphaFields(5)); + ErrorsFound = true; + } else if ((unitVent.tempSched = Sched::GetSchedule(state, Alphas(5))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(5), Alphas(5)); + ErrorsFound = true; + } + } break; + + default: { + assert(false); + } break; + } // end (switch) // Main air nodes (except outside air node): // For node connections, this object is both a parent and a non-parent, because the @@ -411,7 +406,7 @@ namespace UnitVentilator { } else { auto *fan = state.dataFans->fans(unitVent.Fan_Index); unitVent.FanOutletNode = fan->outletNodeNum; - unitVent.FanAvailSchedPtr = fan->availSchedNum; // Get the fan's availability schedule + unitVent.fanAvailSched = fan->availSched; // Get the fan's availability schedule FanVolFlow = fan->maxAirFlowRate; if (FanVolFlow != DataSizing::AutoSize && unitVent.MaxAirVolFlow != DataSizing::AutoSize && FanVolFlow < unitVent.MaxAirVolFlow) { ShowSevereError(state, format("{}{}=\"{}\".", RoutineName, CurrentModuleObject, unitVent.Name)); @@ -497,7 +492,7 @@ namespace UnitVentilator { if (unitVent.OAControlType == OAControl::FixedAmount) { unitVent.OutAirVolFlow = unitVent.MinOutAirVolFlow; - unitVent.MaxOASchedPtr = unitVent.MinOASchedPtr; + unitVent.maxOASched = unitVent.minOASched; } if (!unitVent.ATMixerExists) { @@ -548,29 +543,17 @@ namespace UnitVentilator { unitVent.CoilOption = (CoilsUsed)getEnumValue(CoilsUsedNamesUC, Alphas(13)); - unitVent.FanSchedPtr = ScheduleManager::GetScheduleIndex(state, Alphas(14)); - // Default to cycling fan when fan mode schedule is not present - if (!lAlphaBlanks(14) && unitVent.FanSchedPtr == 0) { - ShowSevereError(state, format("{} \"{}\" {} not found: {}", CurrentModuleObject, unitVent.Name, cAlphaFields(14), Alphas(14))); + if (lAlphaBlanks(14)) { + unitVent.fanOp = (unitVent.fanType == HVAC::FanType::OnOff || unitVent.fanType == HVAC::FanType::SystemModel) + ? HVAC::FanOp::Cycling + : HVAC::FanOp::Continuous; + } else if ((unitVent.fanOpModeSched = Sched::GetSchedule(state, Alphas(14))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(14), Alphas(14)); + ErrorsFound = true; + } else if ((unitVent.fanType == HVAC::FanType::Constant) && + !unitVent.fanOpModeSched->checkMinMaxVals(state, Clusive::Ex, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFields(14), Alphas(14), Clusive::Ex, 0.0, Clusive::In, 1.0); ErrorsFound = true; - } else if (lAlphaBlanks(14)) { - if (unitVent.fanType == HVAC::FanType::OnOff || unitVent.fanType == HVAC::FanType::SystemModel) { - unitVent.fanOp = HVAC::FanOp::Cycling; - } else { - unitVent.fanOp = HVAC::FanOp::Continuous; - } - } - - // Check fan's schedule for cycling fan operation if constant volume fan is used - if (unitVent.FanSchedPtr > 0 && unitVent.fanType == HVAC::FanType::Constant) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, unitVent.FanSchedPtr, ">", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{} = {}", CurrentModuleObject, Alphas(1))); - ShowContinueError(state, format("For {} = {}", cAlphaFields(11), Alphas(11))); - ShowContinueError(state, "Fan operating mode must be continuous (fan operating mode schedule values > 0)."); - ShowContinueError(state, format("Error found in {} = {}", cAlphaFields(14), Alphas(14))); - ShowContinueError(state, "...schedule values must be (>0., <=1.)"); - ErrorsFound = true; - } } // Get Coil information @@ -898,6 +881,7 @@ namespace UnitVentilator { for (int UnitVentNum = 1; UnitVentNum <= state.dataUnitVentilators->NumOfUnitVents; ++UnitVentNum) { auto &unitVent = state.dataUnitVentilators->UnitVent(UnitVentNum); + auto &coilReportObj = state.dataRptCoilSelection->coilSelectionReportObj; SetupOutputVariable(state, "Zone Unit Ventilator Heating Rate", @@ -972,12 +956,6 @@ namespace UnitVentilator { OutputProcessor::StoreType::Average, unitVent.Name); } - } - - for (int UnitVentNum = 1; UnitVentNum <= state.dataUnitVentilators->NumOfUnitVents; ++UnitVentNum) { - - auto &unitVent = state.dataUnitVentilators->UnitVent(UnitVentNum); - auto &coilReportObj = state.dataRptCoilSelection->coilSelectionReportObj; if (unitVent.HCoilPresent) { coilReportObj->setCoilSupplyFanInfo( @@ -1127,11 +1105,8 @@ namespace UnitVentilator { if (unitVent.HCoilType == HeatCoilType::Water) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(unitVent.HWplantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(unitVent.HWplantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = + state.dataPlnt->PlantLoop(unitVent.HWplantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); unitVent.MaxHotWaterFlow = rho * unitVent.MaxVolHotWaterFlow; unitVent.MinHotWaterFlow = rho * unitVent.MinVolHotWaterFlow; @@ -1141,8 +1116,7 @@ namespace UnitVentilator { } if (unitVent.HCoilType == HeatCoilType::Steam) { Real64 TempSteamIn = 100.00; - Real64 SteamDensity = - FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, unitVent.HCoil_FluidIndex, RoutineName); + Real64 SteamDensity = unitVent.HCoil_fluid->getSatDensity(state, TempSteamIn, 1.0, RoutineName); unitVent.MaxHotSteamFlow = SteamDensity * unitVent.MaxVolHotSteamFlow; unitVent.MinHotSteamFlow = SteamDensity * unitVent.MinVolHotSteamFlow; @@ -1152,11 +1126,7 @@ namespace UnitVentilator { } //(UnitVent(UnitVentNum)%HCoilPresent) if (unitVent.CCoilPresent) { // Only initialize these if a cooling coil is actually present - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(unitVent.CWPlantLoc.loopNum).FluidName, - 5.0, - state.dataPlnt->PlantLoop(unitVent.CWPlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = state.dataPlnt->PlantLoop(unitVent.CWPlantLoc.loopNum).glycol->getDensity(state, 5.0, RoutineName); unitVent.MaxColdWaterFlow = rho * unitVent.MaxVolColdWaterFlow; unitVent.MinColdWaterFlow = rho * unitVent.MinVolColdWaterFlow; @@ -1173,17 +1143,12 @@ namespace UnitVentilator { state.dataUnitVentilators->QZnReq = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).RemainingOutputRequired; // zone load needed unitVent.FanPartLoadRatio = 0.0; - if (unitVent.FanSchedPtr > 0) { - if (ScheduleManager::GetCurrentScheduleValue(state, unitVent.FanSchedPtr) == 0.0) { - unitVent.fanOp = HVAC::FanOp::Cycling; - } else { - unitVent.fanOp = HVAC::FanOp::Continuous; - } + if (unitVent.fanOpModeSched != nullptr) { + unitVent.fanOp = (unitVent.fanOpModeSched->getCurrentVal() == 0.0) ? HVAC::FanOp::Cycling : HVAC::FanOp::Continuous; } - if (ScheduleManager::GetCurrentScheduleValue(state, unitVent.SchedPtr) > 0) { - if ((ScheduleManager::GetCurrentScheduleValue(state, unitVent.FanAvailSchedPtr) > 0 || state.dataHVACGlobal->TurnFansOn) && - !state.dataHVACGlobal->TurnFansOff) { + if (unitVent.availSched->getCurrentVal() > 0) { + if ((unitVent.fanAvailSched->getCurrentVal() > 0 || state.dataHVACGlobal->TurnFansOn) && !state.dataHVACGlobal->TurnFansOff) { if ((std::abs(state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).RemainingOutputRequired) < HVAC::SmallLoad) || (state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum))) { SetMassFlowRateToZero = true; @@ -1279,7 +1244,6 @@ namespace UnitVentilator { static constexpr std::string_view RoutineName("SizeUnitVentilator"); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int PltSizCoolNum = 0; // index of plant sizing object for 1st cooling loop Real64 DesCoolingLoad = 0.0; Real64 DesHeatingLoad = 0.0; Real64 TempSteamIn = 0.0; @@ -1288,7 +1252,6 @@ namespace UnitVentilator { Real64 LatentHeatSteam = 0.0; Real64 SteamDensity = 0.0; int CoilWaterOutletNode = 0; - int CoilSteamOutletNode = 0; std::string CoolingCoilName; std::string CoolingCoilType; Real64 rho = 0.0; @@ -1298,8 +1261,6 @@ namespace UnitVentilator { int SizingMethod; // Integer representation of sizing method name (e.g., CoolingAirflowSizing, HeatingAirflowSizing, CoolingCapacitySizing, // HeatingCapacitySizing, etc.) bool PrintFlag; // TRUE when sizing information is reported in the eio file - int SAFMethod(0); // supply air flow rate sizing method (SupplyAirFlowRate, FlowPerFloorArea, FractionOfAutosizedCoolingAirflow, - // FractionOfAutosizedHeatingAirflow ...) int CapSizingMethod(0); // capacity sizing methods (HeatingDesignCapacity, CapacityPerFloorArea, FractionOfAutosizedCoolingCapacity, and // FractionOfAutosizedHeatingCapacity ) Real64 WaterCoilSizDeltaT; // water coil deltaT for design water flow rate autosizing @@ -1336,7 +1297,7 @@ namespace UnitVentilator { if (state.dataSize->CurZoneEqNum > 0) { if (unitVent.HVACSizingIndex > 0) { - auto &zoneHVACSizing = state.dataSize->ZoneHVACSizing(unitVent.HVACSizingIndex); + auto const &zoneHVACSizing = state.dataSize->ZoneHVACSizing(unitVent.HVACSizingIndex); // initialize OA flow for sizing other inputs (e.g., inlet temp, capacity, etc.) if (unitVent.OutAirVolFlow == DataSizing::AutoSize) { @@ -1354,7 +1315,7 @@ namespace UnitVentilator { if (zoneHVACSizing.CoolingSAFMethod > 0 && state.dataSize->ZoneCoolingOnlyFan && !state.dataSize->ZoneHeatingOnlyFan) { - SAFMethod = zoneHVACSizing.CoolingSAFMethod; + int SAFMethod = zoneHVACSizing.CoolingSAFMethod; SizingMethod = HVAC::CoolingAirflowSizing; ZoneEqSizing.SizingMethod(SizingMethod) = SAFMethod; switch (SAFMethod) { @@ -1421,7 +1382,7 @@ namespace UnitVentilator { } else if (zoneHVACSizing.HeatingSAFMethod > 0 && state.dataSize->ZoneHeatingOnlyFan && !state.dataSize->ZoneCoolingOnlyFan) { SizingMethod = HVAC::HeatingAirflowSizing; - SAFMethod = zoneHVACSizing.HeatingSAFMethod; + int SAFMethod = zoneHVACSizing.HeatingSAFMethod; ZoneEqSizing.SizingMethod(SizingMethod) = SAFMethod; switch (SAFMethod) { case DataSizing::None: @@ -1461,7 +1422,6 @@ namespace UnitVentilator { HeatingAirVolFlowScalable = sizingHeatingAirFlow.size(state, TempSize, errorsFound); } break; case DataSizing::FlowPerHeatingCapacity: { - SizingMethod = HVAC::HeatingCapacitySizing; TempSize = DataSizing::AutoSize; PrintFlag = false; state.dataSize->DataScalableSizingON = true; @@ -1471,7 +1431,6 @@ namespace UnitVentilator { sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); state.dataSize->DataAutosizedHeatingCapacity = sizerHeatingCapacity.size(state, TempSize, errorsFound); state.dataSize->DataFlowPerHeatingCapacity = zoneHVACSizing.MaxHeatAirVolFlow; - SizingMethod = HVAC::HeatingAirflowSizing; PrintFlag = true; TempSize = DataSizing::AutoSize; errorsFound = false; @@ -1490,7 +1449,7 @@ namespace UnitVentilator { if (unitVent.CoilOption != CoilsUsed::None) { if (zoneHVACSizing.CoolingSAFMethod > 0) { - SAFMethod = zoneHVACSizing.CoolingSAFMethod; + int SAFMethod = zoneHVACSizing.CoolingSAFMethod; SizingMethod = HVAC::CoolingAirflowSizing; ZoneEqSizing.SizingMethod(SizingMethod) = SAFMethod; switch (SAFMethod) { @@ -1555,7 +1514,7 @@ namespace UnitVentilator { } } else if (zoneHVACSizing.HeatingSAFMethod > 0) { SizingMethod = HVAC::HeatingAirflowSizing; - SAFMethod = zoneHVACSizing.HeatingSAFMethod; + int SAFMethod = zoneHVACSizing.HeatingSAFMethod; ZoneEqSizing.SizingMethod(SizingMethod) = SAFMethod; switch (SAFMethod) { case DataSizing::None: @@ -1595,7 +1554,6 @@ namespace UnitVentilator { HeatingAirVolFlowScalable = sizingHeatingAirFlow.size(state, TempSize, errorsFound); } break; case DataSizing::FlowPerHeatingCapacity: { - SizingMethod = HVAC::HeatingCapacitySizing; TempSize = DataSizing::AutoSize; PrintFlag = false; state.dataSize->DataScalableSizingON = true; @@ -1605,7 +1563,6 @@ namespace UnitVentilator { sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); state.dataSize->DataAutosizedHeatingCapacity = sizerHeatingCapacity.size(state, TempSize, errorsFound); state.dataSize->DataFlowPerHeatingCapacity = zoneHVACSizing.MaxHeatAirVolFlow; - SizingMethod = HVAC::HeatingAirflowSizing; PrintFlag = true; TempSize = DataSizing::AutoSize; errorsFound = false; @@ -1827,7 +1784,7 @@ namespace UnitVentilator { if (state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesHeatMassFlow >= HVAC::SmallAirVolFlow) { SizingMethod = HVAC::HeatingCapacitySizing; if (unitVent.HVACSizingIndex > 0) { - auto &zoneHVACSizing = state.dataSize->ZoneHVACSizing(unitVent.HVACSizingIndex); + auto const &zoneHVACSizing = state.dataSize->ZoneHVACSizing(unitVent.HVACSizingIndex); CapSizingMethod = zoneHVACSizing.HeatingCapMethod; ZoneEqSizing.SizingMethod(SizingMethod) = CapSizingMethod; switch (CapSizingMethod) { @@ -1881,24 +1838,16 @@ namespace UnitVentilator { sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); DesHeatingLoad = sizerHeatingCapacity.size(state, TempSize, errorsFound); } - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(unitVent.HWplantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(unitVent.HWplantLoc.loopNum).FluidIndex, - RoutineName); - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(unitVent.HWplantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(unitVent.HWplantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(unitVent.HWplantLoc.loopNum) + .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); + Cp = state.dataPlnt->PlantLoop(unitVent.HWplantLoc.loopNum) + .glycol->getSpecificHeat(state, Constant::HWInitConvTemp, RoutineName); MaxVolHotWaterFlowDes = DesHeatingLoad / (WaterCoilSizDeltaT * Cp * rho); } else { MaxVolHotWaterFlowDes = 0.0; } } - } - if (IsAutoSize) { unitVent.MaxVolHotWaterFlow = MaxVolHotWaterFlowDes; BaseSizer::reportSizerOutput(state, state.dataUnitVentilators->cMO_UnitVentilator, @@ -1955,7 +1904,7 @@ namespace UnitVentilator { } else { CheckZoneSizing(state, state.dataUnitVentilators->cMO_UnitVentilator, unitVent.Name); - CoilSteamOutletNode = SteamCoils::GetCoilSteamOutletNode(state, "Coil:Heating:Steam", unitVent.HCoilName, ErrorsFound); + int CoilSteamOutletNode = SteamCoils::GetCoilSteamOutletNode(state, "Coil:Heating:Steam", unitVent.HCoilName, ErrorsFound); if (IsAutoSize) { PltSizHeatNum = PlantUtilities::MyPlantSizingIndex( state, "Coil:Heating:Steam", unitVent.HCoilName, unitVent.HotControlNode, CoilSteamOutletNode, ErrorsFound); @@ -1963,7 +1912,7 @@ namespace UnitVentilator { if (state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesHeatMassFlow >= HVAC::SmallAirVolFlow) { SizingMethod = HVAC::HeatingCapacitySizing; if (unitVent.HVACSizingIndex > 0) { - auto &zoneHVACSizing = state.dataSize->ZoneHVACSizing(unitVent.HVACSizingIndex); + auto const &zoneHVACSizing = state.dataSize->ZoneHVACSizing(unitVent.HVACSizingIndex); CapSizingMethod = zoneHVACSizing.HeatingCapMethod; ZoneEqSizing.SizingMethod(SizingMethod) = CapSizingMethod; switch (CapSizingMethod) { @@ -1995,6 +1944,7 @@ namespace UnitVentilator { default: { } break; } + PrintFlag = false; bool errorsFound = false; HeatingCapacitySizer sizerHeatingCapacity; @@ -2012,18 +1962,13 @@ namespace UnitVentilator { DesHeatingLoad = sizerHeatingCapacity.size(state, TempSize, errorsFound); } TempSteamIn = 100.00; - EnthSteamInDry = FluidProperties::GetSatEnthalpyRefrig( - state, fluidNameSteam, TempSteamIn, 1.0, state.dataUnitVentilators->RefrigIndex, RoutineName); - EnthSteamOutWet = FluidProperties::GetSatEnthalpyRefrig( - state, fluidNameSteam, TempSteamIn, 0.0, state.dataUnitVentilators->RefrigIndex, RoutineName); + auto *steam = Fluid::GetSteam(state); + EnthSteamInDry = steam->getSatEnthalpy(state, TempSteamIn, 1.0, RoutineName); + EnthSteamOutWet = steam->getSatEnthalpy(state, TempSteamIn, 0.0, RoutineName); LatentHeatSteam = EnthSteamInDry - EnthSteamOutWet; - SteamDensity = FluidProperties::GetSatDensityRefrig( - state, fluidNameSteam, TempSteamIn, 1.0, state.dataUnitVentilators->RefrigIndex, RoutineName); - Cp = FluidProperties::GetSpecificHeatGlycol(state, - fluidNameWater, - state.dataSize->PlantSizData(PltSizHeatNum).ExitTemp, - state.dataUnitVentilators->DummyWaterIndex, - RoutineName); + SteamDensity = steam->getSatDensity(state, TempSteamIn, 1.0, RoutineName); + Cp = + Fluid::GetWater(state)->getSpecificHeat(state, state.dataSize->PlantSizData(PltSizHeatNum).ExitTemp, RoutineName); MaxVolHotSteamFlowDes = DesHeatingLoad / (SteamDensity * (LatentHeatSteam + state.dataSize->PlantSizData(PltSizHeatNum).DeltaT * Cp)); } else { @@ -2034,8 +1979,6 @@ namespace UnitVentilator { ShowContinueError(state, format("Occurs in {} = \"{}\"", state.dataUnitVentilators->cMO_UnitVentilator, unitVent.Name)); ErrorsFound = true; } - } - if (IsAutoSize) { unitVent.MaxVolHotSteamFlow = MaxVolHotSteamFlowDes; BaseSizer::reportSizerOutput(state, state.dataUnitVentilators->cMO_UnitVentilator, @@ -2102,7 +2045,7 @@ namespace UnitVentilator { } CoilWaterOutletNode = WaterCoils::GetCoilWaterOutletNode(state, CoolingCoilType, CoolingCoilName, ErrorsFound); if (IsAutoSize) { - PltSizCoolNum = PlantUtilities::MyPlantSizingIndex( + int PltSizCoolNum = PlantUtilities::MyPlantSizingIndex( state, CoolingCoilType, CoolingCoilName, unitVent.ColdControlNode, CoilWaterOutletNode, ErrorsFound); if (state.dataWaterCoils->WaterCoil(unitVent.CCoil_Index).UseDesignWaterDeltaTemp) { WaterCoilSizDeltaT = state.dataWaterCoils->WaterCoil(unitVent.CCoil_Index).DesignWaterDeltaTemp; @@ -2124,7 +2067,7 @@ namespace UnitVentilator { if (state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolMassFlow >= HVAC::SmallAirVolFlow) { SizingMethod = HVAC::CoolingCapacitySizing; if (unitVent.HVACSizingIndex > 0) { - auto &zoneHVACSizing = state.dataSize->ZoneHVACSizing(unitVent.HVACSizingIndex); + auto const &zoneHVACSizing = state.dataSize->ZoneHVACSizing(unitVent.HVACSizingIndex); CapSizingMethod = zoneHVACSizing.CoolingCapMethod; ZoneEqSizing.SizingMethod(SizingMethod) = CapSizingMethod; switch (CapSizingMethod) { @@ -2170,16 +2113,8 @@ namespace UnitVentilator { sizerCoolingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); DesCoolingLoad = sizerCoolingCapacity.size(state, TempSize, ErrorsFound); } - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(unitVent.CWPlantLoc.loopNum).FluidName, - 5., - state.dataPlnt->PlantLoop(unitVent.CWPlantLoc.loopNum).FluidIndex, - RoutineName); - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(unitVent.CWPlantLoc.loopNum).FluidName, - 5., - state.dataPlnt->PlantLoop(unitVent.CWPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(unitVent.CWPlantLoc.loopNum).glycol->getDensity(state, 5., RoutineName); + Cp = state.dataPlnt->PlantLoop(unitVent.CWPlantLoc.loopNum).glycol->getSpecificHeat(state, 5., RoutineName); MaxVolColdWaterFlowDes = DesCoolingLoad / (WaterCoilSizDeltaT * Cp * rho); if (MaxVolColdWaterFlowDes < 0.0) { @@ -2199,8 +2134,6 @@ namespace UnitVentilator { MaxVolColdWaterFlowDes = 0.0; } } - } - if (IsAutoSize) { unitVent.MaxVolColdWaterFlow = MaxVolColdWaterFlowDes; BaseSizer::reportSizerOutput(state, state.dataUnitVentilators->cMO_UnitVentilator, @@ -2379,25 +2312,22 @@ namespace UnitVentilator { } // initialize local variables - int ControlNode = 0; Real64 QUnitOut = 0.0; Real64 ControlOffset = 0.0; Real64 MaxWaterFlow = 0.0; Real64 MinWaterFlow = 0.0; Real64 NoOutput = 0.0; Real64 FullOutput = 0.0; - int SolFlag = 0; // # of iterations IF positive, -1 means failed to converge, -2 means bounds are incorrect HVAC::FanOp fanOp = unitVent.fanOp; Real64 PartLoadFrac = 0.0; - auto &inletNode(state.dataLoopNodes->Node(unitVent.AirInNode)); - auto &outletNode(state.dataLoopNodes->Node(unitVent.AirOutNode)); - auto &outsideAirNode(state.dataLoopNodes->Node(unitVent.OutsideAirNode)); + auto const &inletNode = state.dataLoopNodes->Node(unitVent.AirInNode); + auto const &outletNode = state.dataLoopNodes->Node(unitVent.AirOutNode); + auto const &outsideAirNode = state.dataLoopNodes->Node(unitVent.OutsideAirNode); if ((std::abs(state.dataUnitVentilators->QZnReq) < HVAC::SmallLoad) || (state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum)) || - (ScheduleManager::GetCurrentScheduleValue(state, unitVent.SchedPtr) <= 0) || - ((ScheduleManager::GetCurrentScheduleValue(state, unitVent.FanAvailSchedPtr) <= 0 && !state.dataHVACGlobal->TurnFansOn) || - state.dataHVACGlobal->TurnFansOff)) { + (unitVent.availSched->getCurrentVal() <= 0) || + ((unitVent.fanAvailSched->getCurrentVal() <= 0 && !state.dataHVACGlobal->TurnFansOn) || state.dataHVACGlobal->TurnFansOff)) { // Unit is off or has no load upon it; set the flow rates to zero and then // simulate the components with the no flow conditions @@ -2421,11 +2351,12 @@ namespace UnitVentilator { CalcUnitVentilatorComponents(state, UnitVentNum, FirstHVACIteration, QUnitOut); } } else { // Unit is on-->this section is intended to control the outside air and the main - // result is to set the outside air flow rate variable OAMassFlowRate + // result is to set the outside air flow rate variable OAMassFlowRate + int SolFlag = 0; // # of iterations IF positive, -1 means failed to converge, -2 means bounds are incorrect unitVent.FanPartLoadRatio = 1.0; if (state.dataUnitVentilators->QZnReq > HVAC::SmallLoad) { // HEATING MODE - ControlNode = unitVent.HotControlNode; + int ControlNode = unitVent.HotControlNode; ControlOffset = unitVent.HotControlOffset; MaxWaterFlow = unitVent.MaxHotWaterFlow; MinWaterFlow = unitVent.MinHotWaterFlow; @@ -2439,8 +2370,7 @@ namespace UnitVentilator { state.dataUnitVentilators->HCoilOn = true; if (outsideAirNode.MassFlowRate > 0.0) { - MinOAFrac = ScheduleManager::GetCurrentScheduleValue(state, unitVent.MinOASchedPtr) * - (unitVent.MinOutAirMassFlow / outsideAirNode.MassFlowRate); + MinOAFrac = unitVent.minOASched->getCurrentVal() * (unitVent.MinOutAirMassFlow / outsideAirNode.MassFlowRate); } else { MinOAFrac = 0.0; } @@ -2475,10 +2405,11 @@ namespace UnitVentilator { } else { // Tinlet < Toutdoor - MaxOAFrac = ScheduleManager::GetCurrentScheduleValue(state, unitVent.MaxOASchedPtr); + MaxOAFrac = unitVent.maxOASched->getCurrentVal(); state.dataUnitVentilators->OAMassFlowRate = MaxOAFrac * outsideAirNode.MassFlowRate; } } break; + case OAControl::FixedTemperature: { // In heating mode, the outside air for "fixed temperature" attempts // to control the outside air fraction so that a desired temperature @@ -2487,7 +2418,7 @@ namespace UnitVentilator { // temperature), then this is possible. If not, the control will try // to maximize the amount of air coming from the source that is closer // in temperature to the desired temperature. - Tdesired = ScheduleManager::GetCurrentScheduleValue(state, unitVent.TempSchedPtr); + Tdesired = unitVent.tempSched->getCurrentVal(); Tinlet = inletNode.Temp; Toutdoor = outsideAirNode.Temp; MaxOAFrac = 1.0; @@ -2561,6 +2492,7 @@ namespace UnitVentilator { // is set to the minimum value state.dataUnitVentilators->OAMassFlowRate = MinOAFrac * outsideAirNode.MassFlowRate; } break; + case OAControl::FixedTemperature: { // In heating mode, the outside air for "fixed temperature" attempts // to control the outside air fraction so that a desired temperature @@ -2569,7 +2501,7 @@ namespace UnitVentilator { // temperature), then this is possible. If not, the control will try // to maximize the amount of air coming from the source that is closer // in temperature to the desired temperature. - Tdesired = ScheduleManager::GetCurrentScheduleValue(state, unitVent.TempSchedPtr); + Tdesired = unitVent.tempSched->getCurrentVal(); Tinlet = inletNode.Temp; Toutdoor = outsideAirNode.Temp; MaxOAFrac = 1.0; @@ -2684,7 +2616,7 @@ namespace UnitVentilator { } else { // COOLING MODE - ControlNode = unitVent.ColdControlNode; + int ControlNode = unitVent.ColdControlNode; ControlOffset = unitVent.ColdControlOffset; MaxWaterFlow = unitVent.MaxColdWaterFlow; MinWaterFlow = unitVent.MinColdWaterFlow; @@ -2700,8 +2632,7 @@ namespace UnitVentilator { Toutdoor = outsideAirNode.Temp; if (outsideAirNode.MassFlowRate > 0.0) { - MinOAFrac = ScheduleManager::GetCurrentScheduleValue(state, unitVent.MinOASchedPtr) * - (unitVent.MinOutAirMassFlow / outsideAirNode.MassFlowRate); + MinOAFrac = unitVent.minOASched->getCurrentVal() * (unitVent.MinOutAirMassFlow / outsideAirNode.MassFlowRate); } else { MinOAFrac = 0.0; } @@ -2721,18 +2652,13 @@ namespace UnitVentilator { state.dataUnitVentilators->OAMassFlowRate = MinOAFrac * outsideAirNode.MassFlowRate; } break; case OAControl::VariablePercent: { - state.dataUnitVentilators->OAMassFlowRate = - SetOAMassFlowRateForCoolingVariablePercent(state, - UnitVentNum, - MinOAFrac, - outsideAirNode.MassFlowRate, - ScheduleManager::GetCurrentScheduleValue(state, unitVent.MaxOASchedPtr), - Tinlet, - Toutdoor); + state.dataUnitVentilators->OAMassFlowRate = SetOAMassFlowRateForCoolingVariablePercent( + state, UnitVentNum, MinOAFrac, outsideAirNode.MassFlowRate, unitVent.maxOASched->getCurrentVal(), Tinlet, Toutdoor); } break; + case OAControl::FixedTemperature: { // This is basically the same algorithm as for the heating case... - Tdesired = ScheduleManager::GetCurrentScheduleValue(state, unitVent.TempSchedPtr); + Tdesired = unitVent.tempSched->getCurrentVal(); MaxOAFrac = 1.0; if (std::abs(Tinlet - Toutdoor) <= LowTempDiff) { // no difference in indoor and outdoor conditions-->set OA to minimum @@ -2799,19 +2725,15 @@ namespace UnitVentilator { // which is equal to the minimum value, regardless of all the other conditions. state.dataUnitVentilators->OAMassFlowRate = MinOAFrac * outsideAirNode.MassFlowRate; } break; + case OAControl::VariablePercent: { - state.dataUnitVentilators->OAMassFlowRate = - SetOAMassFlowRateForCoolingVariablePercent(state, - UnitVentNum, - MinOAFrac, - outsideAirNode.MassFlowRate, - ScheduleManager::GetCurrentScheduleValue(state, unitVent.MaxOASchedPtr), - Tinlet, - Toutdoor); + state.dataUnitVentilators->OAMassFlowRate = SetOAMassFlowRateForCoolingVariablePercent( + state, UnitVentNum, MinOAFrac, outsideAirNode.MassFlowRate, unitVent.maxOASched->getCurrentVal(), Tinlet, Toutdoor); } break; + case OAControl::FixedTemperature: { // This is basically the same algorithm as for the heating case... - Tdesired = ScheduleManager::GetCurrentScheduleValue(state, unitVent.TempSchedPtr); + Tdesired = unitVent.tempSched->getCurrentVal(); MaxOAFrac = 1.0; @@ -3201,7 +3123,7 @@ namespace UnitVentilator { auto &unitVent = state.dataUnitVentilators->UnitVent(UnitVentNum); auto &airRelNode = state.dataLoopNodes->Node(unitVent.AirReliefNode); - auto &inletNode = state.dataLoopNodes->Node(unitVent.AirInNode); + auto const &inletNode = state.dataLoopNodes->Node(unitVent.AirInNode); auto &OAMixOutNode = state.dataLoopNodes->Node(unitVent.OAMixerOutNode); auto &outsideAirNode = state.dataLoopNodes->Node(unitVent.OutsideAirNode); Real64 OutAirMassFlowRate = state.dataUnitVentilators->OAMassFlowRate; @@ -3390,7 +3312,7 @@ namespace UnitVentilator { ) { - Real64 ActualOAMassFlowRate(0.0); // Result or return value + Real64 ActualOAMassFlowRate = 0.0; // Result or return value if (Tinlet <= Toutdoor) { diff --git a/src/EnergyPlus/UnitVentilator.hh b/src/EnergyPlus/UnitVentilator.hh index 2dada2c6b8f..78ed98d88ed 100644 --- a/src/EnergyPlus/UnitVentilator.hh +++ b/src/EnergyPlus/UnitVentilator.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -105,8 +106,8 @@ namespace UnitVentilator { struct UnitVentilatorData { - std::string Name; // name of unit - int SchedPtr = 0; // index to schedule + std::string Name; // name of unit + Sched::Schedule *availSched = nullptr; int AirInNode = 0; // inlet air node number int AirOutNode = 0; // outlet air node number int FanOutletNode = 0; // outlet node number for fan exit @@ -114,17 +115,17 @@ namespace UnitVentilator { HVAC::FanType fanType = HVAC::FanType::Invalid; // Fan type number (see DataHVACGlobals) std::string FanName; // name of fan int Fan_Index = 0; - int FanSchedPtr = 0; // index to fan operating mode schedule - int FanAvailSchedPtr = 0; // index to fan availability schedule + Sched::Schedule *fanOpModeSched = nullptr; // index to fan operating mode schedule + Sched::Schedule *fanAvailSched = nullptr; HVAC::FanOp fanOp = HVAC::FanOp::Invalid; // mode of operation; 1=cycling fan, cycling coil, 2=continuous fan, cycling coil int ControlCompTypeNum = 0; int CompErrIndex = 0; - Real64 MaxAirVolFlow = 0.0; // m3/s - Real64 MaxAirMassFlow = 0.0; // kg/s - OAControl OAControlType = OAControl::Invalid; // type of control; options are VARIABLE PERCENT and FIXED TEMPERATURE - int MinOASchedPtr = 0; // index to schedule - int MaxOASchedPtr = 0; // index to schedule - int TempSchedPtr = 0; // index to schedule + Real64 MaxAirVolFlow = 0.0; // m3/s + Real64 MaxAirMassFlow = 0.0; // kg/s + OAControl OAControlType = OAControl::Invalid; // type of control; options are VARIABLE PERCENT and FIXED TEMPERATURE + Sched::Schedule *minOASched = nullptr; + Sched::Schedule *maxOASched = nullptr; + Sched::Schedule *tempSched = nullptr; int OutsideAirNode = 0; // outside air node number int AirReliefNode = 0; // relief air node number int OAMixerOutNode = 0; // outlet node after the outside air mixer (inlet to coils if present) @@ -139,8 +140,10 @@ namespace UnitVentilator { std::string HCoilTypeCh; // type of heating coil character string (same as type on idf file). int HCoil_Index = 0; DataPlant::PlantEquipmentType HeatingCoilType = DataPlant::PlantEquipmentType::Invalid; - int HCoil_FluidIndex = 0; - int HCoilSchedPtr = 0; // index to schedule + + Fluid::RefrigProps *HCoil_fluid = nullptr; + Sched::Schedule *hCoilSched = nullptr; + Real64 HCoilSchedValue = 0.0; Real64 MaxVolHotWaterFlow = 0.0; // m3/s Real64 MaxVolHotSteamFlow = 0.0; // m3/s @@ -162,7 +165,7 @@ namespace UnitVentilator { std::string CCoilPlantType; // type of cooling coil for plant DataPlant::PlantEquipmentType CoolingCoilType = DataPlant::PlantEquipmentType::Invalid; CoolCoilType CCoilType = CoolCoilType::Invalid; - int CCoilSchedPtr = 0; // index to schedule + Sched::Schedule *cCoilSched = nullptr; Real64 CCoilSchedValue = 0.0; Real64 MaxVolColdWaterFlow = 0.0; // m3/s Real64 MaxColdWaterFlow = 0.0; // kg/s @@ -307,13 +310,14 @@ struct UnitVentilatorsData : BaseGlobalStruct Array1D_bool MyPlantScanFlag; Array1D_bool MyZoneEqFlag; - int RefrigIndex = 0; - int DummyWaterIndex = 1; - int ATMixOutNode = 0; // outlet node of ATM Mixer int ATMixerPriNode = 0; // primary air node of ATM Mixer int ZoneNode = 0; // zone node + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } @@ -334,8 +338,6 @@ struct UnitVentilatorsData : BaseGlobalStruct this->MyEnvrnFlag.deallocate(); this->MyPlantScanFlag.deallocate(); this->MyZoneEqFlag.deallocate(); - this->RefrigIndex = 0; - this->DummyWaterIndex = 1; this->ATMixOutNode = 0; this->ATMixerPriNode = 0; this->ZoneNode = 0; diff --git a/src/EnergyPlus/UnitarySystem.cc b/src/EnergyPlus/UnitarySystem.cc index 9da1b5a1573..e82d1f2c80f 100644 --- a/src/EnergyPlus/UnitarySystem.cc +++ b/src/EnergyPlus/UnitarySystem.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -111,7 +111,6 @@ namespace UnitarySystems { int constexpr HeatingCoil = 1; int constexpr SuppHeatCoil = 2; - static constexpr std::string_view fluidNameSteam("STEAM"); static constexpr std::string_view blankString(""); static const std::string blankStdString(""); @@ -451,7 +450,7 @@ namespace UnitarySystems { this->m_MySizingCheckFlag = false; if (AirLoopNum > 0) { state.dataAirLoop->AirLoopControlInfo(AirLoopNum).fanOp = this->m_FanOpMode; - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).CycFanSchedPtr = this->m_FanOpModeSchedPtr; + state.dataAirLoop->AirLoopControlInfo(AirLoopNum).cycFanSched = this->m_fanOpModeSched; } else if (AirLoopNum < 0) { if (this->m_ControlType == UnitarySysCtrlType::CCMASHRAE) { ShowSevereError(state, format("{}: {}", this->UnitType, this->Name)); @@ -590,11 +589,8 @@ namespace UnitarySystems { state, CoolingCoilType, CoolingCoilName, state.dataUnitarySystems->initUnitarySystemsErrorsFound); if (this->MaxCoolCoilFluidFlow > 0.0) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CoolCoilPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CoolCoilPlantLoc.loopNum).FluidIndex, - routineName); + Real64 rho = + state.dataPlnt->PlantLoop(this->CoolCoilPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, routineName); this->MaxCoolCoilFluidFlow *= rho; } // fill outlet node for coil @@ -637,11 +633,8 @@ namespace UnitarySystems { state, HeatingCoilType, this->m_HeatingCoilName, state.dataUnitarySystems->initUnitarySystemsErrorsFound); if (this->MaxHeatCoilFluidFlow > 0.0) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->HeatCoilPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->HeatCoilPlantLoc.loopNum).FluidIndex, - routineName); + Real64 rho = state.dataPlnt->PlantLoop(this->HeatCoilPlantLoc.loopNum) + .glycol->getDensity(state, Constant::HWInitConvTemp, routineName); this->MaxHeatCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate( state, HeatingCoilType, this->m_HeatingCoilName, state.dataUnitarySystems->initUnitarySystemsErrorsFound) * @@ -651,9 +644,8 @@ namespace UnitarySystems { this->MaxHeatCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, this->m_HeatingCoilIndex, state.dataUnitarySystems->initUnitarySystemsErrorsFound); if (this->MaxHeatCoilFluidFlow > 0.0) { - int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed Real64 TempSteamIn = 100.0; - Real64 SteamDensity = FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, routineName); + Real64 SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, routineName); this->MaxHeatCoilFluidFlow *= SteamDensity; } } @@ -693,11 +685,8 @@ namespace UnitarySystems { state, "Coil:Heating:Water", this->m_SuppHeatCoilName, state.dataUnitarySystems->initUnitarySystemsErrorsFound); if (this->m_MaxSuppCoilFluidFlow > 0.0) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->m_SuppCoilPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->m_SuppCoilPlantLoc.loopNum).FluidIndex, - routineName); + Real64 rho = + state.dataPlnt->PlantLoop(this->m_SuppCoilPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, routineName); this->m_MaxSuppCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate( state, "Coil:Heating:Water", this->m_SuppHeatCoilName, state.dataUnitarySystems->initUnitarySystemsErrorsFound) * @@ -724,9 +713,8 @@ namespace UnitarySystems { this->m_MaxSuppCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, this->m_SuppHeatCoilIndex, state.dataUnitarySystems->initUnitarySystemsErrorsFound); if (this->m_MaxSuppCoilFluidFlow > 0.0) { - int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed Real64 TempSteamIn = 100.0; - Real64 SteamDensity = FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, routineName); + Real64 SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, routineName); this->m_MaxSuppCoilFluidFlow *= SteamDensity; } @@ -765,11 +753,7 @@ namespace UnitarySystems { if ((this->m_HeatRecActive) && (!this->m_MyPlantScanFlag)) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->m_HRPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(this->m_HRPlantLoc.loopNum).FluidIndex, - routineName); + Real64 rho = state.dataPlnt->PlantLoop(this->m_HRPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, routineName); this->m_DesignHeatRecMassFlowRate = this->m_DesignHRWaterVolumeFlow * rho; @@ -791,11 +775,8 @@ namespace UnitarySystems { Real64 CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate( state, CoolingCoilType, this->m_CoolingCoilName, state.dataUnitarySystems->initUnitarySystemsErrorsFound); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->CoolCoilPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->CoolCoilPlantLoc.loopNum).FluidIndex, - routineName); + Real64 rho = state.dataPlnt->PlantLoop(this->CoolCoilPlantLoc.loopNum) + .glycol->getDensity(state, Constant::CWInitConvTemp, routineName); this->MaxCoolCoilFluidFlow = CoilMaxVolFlowRate * rho; } } @@ -812,11 +793,8 @@ namespace UnitarySystems { Real64 CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate( state, "Coil:Heating:Water", this->m_HeatingCoilName, state.dataUnitarySystems->initUnitarySystemsErrorsFound); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->HeatCoilPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->HeatCoilPlantLoc.loopNum).FluidIndex, - routineName); + Real64 rho = state.dataPlnt->PlantLoop(this->HeatCoilPlantLoc.loopNum) + .glycol->getDensity(state, Constant::CWInitConvTemp, routineName); this->MaxHeatCoilFluidFlow = CoilMaxVolFlowRate * rho; } } @@ -832,10 +810,8 @@ namespace UnitarySystems { Real64 CoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate( state, this->m_HeatingCoilIndex, state.dataUnitarySystems->initUnitarySystemsErrorsFound); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed Real64 TempSteamIn = 100.0; - Real64 SteamDensity = - FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, routineName); + Real64 SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, routineName); this->MaxHeatCoilFluidFlow = CoilMaxVolFlowRate * SteamDensity; } } @@ -852,11 +828,8 @@ namespace UnitarySystems { Real64 CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate( state, "Coil:Heating:Water", this->m_SuppHeatCoilName, state.dataUnitarySystems->initUnitarySystemsErrorsFound); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->m_SuppCoilPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->m_SuppCoilPlantLoc.loopNum).FluidIndex, - routineName); + Real64 rho = state.dataPlnt->PlantLoop(this->m_SuppCoilPlantLoc.loopNum) + .glycol->getDensity(state, Constant::CWInitConvTemp, routineName); this->m_MaxSuppCoilFluidFlow = CoilMaxVolFlowRate * rho; } } @@ -871,10 +844,8 @@ namespace UnitarySystems { Real64 CoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate( state, this->m_SuppHeatCoilIndex, state.dataUnitarySystems->initUnitarySystemsErrorsFound); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed Real64 TempSteamIn = 100.0; - Real64 SteamDensity = - FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, routineName); + Real64 SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, routineName); this->m_MaxSuppCoilFluidFlow = CoilMaxVolFlowRate * SteamDensity; } } @@ -892,7 +863,7 @@ namespace UnitarySystems { // Init maximum available Heat Recovery flow rate if ((this->m_HeatRecActive) && (!this->m_MyPlantScanFlag)) { Real64 mdotHR = 0.0; - if (ScheduleManager::GetCurrentScheduleValue(state, this->m_SysAvailSchedPtr) > 0.0) { + if (this->m_sysAvailSched->getCurrentVal() > 0.0) { if (FirstHVACIteration) { mdotHR = this->m_DesignHeatRecMassFlowRate; } else { @@ -916,9 +887,9 @@ namespace UnitarySystems { this->m_IterationCounter = 0; std::fill(this->m_IterationMode.begin(), this->m_IterationMode.end(), 0); - // for DX systems, just read the inlet node flow rate and let air loop decide flow - if (this->m_ControlType == UnitarySysCtrlType::Setpoint && this->m_sysType == SysType::Unitary) { - if (ScheduleManager::GetCurrentScheduleValue(state, this->m_SysAvailSchedPtr) > 0.0) { + // for systems without a fan, just read the inlet node flow rate and let air loop decide flow + if (this->m_ControlType == UnitarySysCtrlType::Setpoint && this->m_sysType == SysType::Unitary && this->m_FanExists) { + if (this->m_sysAvailSched->getCurrentVal() > 0.0) { if (this->m_LastMode == CoolingMode) { if (this->m_MultiOrVarSpeedCoolCoil) { state.dataLoopNodes->Node(this->AirInNode).MassFlowRate = this->m_CoolMassFlowRate[this->m_NumOfSpeedCooling]; @@ -1541,7 +1512,7 @@ namespace UnitarySystems { SizingMethod = HVAC::CoolingCapacitySizing; if (this->m_CoolingCoilType_Num == HVAC::CoilDX_Cooling) { state.dataSize->DataTotCapCurveIndex = - state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].getOpModeCapFTIndex(HVAC::CoilMode::Normal); + state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex].getOpModeCapFTIndex(HVAC::CoilMode::Normal); state.dataSize->DataIsDXCoil = true; } else if (this->m_CoolingCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed || this->m_CoolingCoilType_Num == HVAC::CoilDX_MultiSpeedCooling || @@ -1583,7 +1554,7 @@ namespace UnitarySystems { switch (this->m_CoolingCoilType_Num) { case HVAC::CoilDX_Cooling: { state.dataSize->DataTotCapCurveIndex = - state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].getOpModeCapFTIndex(HVAC::CoilMode::Normal); + state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex].getOpModeCapFTIndex(HVAC::CoilMode::Normal); state.dataSize->DataIsDXCoil = true; } break; case HVAC::CoilDX_CoolingSingleSpeed: @@ -2112,7 +2083,7 @@ namespace UnitarySystems { NoLoadCoolingAirFlowRateRatio = 1.0 / state.dataDXCoils->DXCoil(this->m_CoolingCoilIndex).NumOfSpeeds; } } else if (this->m_CoolingCoilType_Num == HVAC::CoilDX_Cooling) { - NoLoadCoolingAirFlowRateRatio = state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex] + NoLoadCoolingAirFlowRateRatio = state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex] .performance.normalMode.speeds[0] .original_input_specs.evaporator_air_flow_fraction; } @@ -2529,7 +2500,7 @@ namespace UnitarySystems { ShowFatalError(state, "No cooling coil = Coil:Cooling:DX found."); ErrFound = true; } - auto &newCoil = state.dataCoilCooingDX->coilCoolingDXs[childCCIndex]; + auto &newCoil = state.dataCoilCoolingDX->coilCoolingDXs[childCCIndex]; this->m_NumOfSpeedCooling = newCoil.performance.normalMode.speeds.size(); if (this->m_NumOfSpeedCooling > 0) { if (this->m_CoolVolumeFlowRate.empty()) this->m_CoolVolumeFlowRate.resize(this->m_NumOfSpeedCooling + 1); @@ -2620,8 +2591,8 @@ namespace UnitarySystems { } // mine capacity from Coil:Cooling:DX object - auto &newCoil = state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex]; - // TODO: Determine operating mode based on dehumdification stuff, using normalMode for now + auto &newCoil = state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex]; + // TODO: Determine operating mode based on dehumidification stuff, using normalMode for now if (this->m_NumOfSpeedCooling != (int)newCoil.performance.normalMode.speeds.size()) { ShowWarningError(state, format("{}: {} = {}", RoutineName, CompType, CompName)); ShowContinueError(state, "Number of cooling speeds does not match coil object."); @@ -2983,12 +2954,14 @@ namespace UnitarySystems { if (this->m_CoolCoilExists && this->m_MaxCoolAirVolFlow < 0.0) { if (!state.dataSize->SysSizingRunDone) { int BranchNum = BranchInputManager::GetAirBranchIndex(state, "AirloopHVAC:UnitarySystem", this->Name); - std::string FanType = ""; - std::string m_FanName = ""; // the notation m_ implies member variables, and this is a local BranchFanFlow = 0.0; - if (BranchNum > 0.0) BranchInputManager::GetBranchFanTypeName(state, BranchNum, FanType, m_FanName, ErrFound); - if (!ErrFound && BranchNum > 0) { - BranchFanFlow = state.dataFans->fans(this->m_FanIndex)->maxAirFlowRate; + if (BranchNum > 0.0) { + std::string FanType = ""; + std::string FanName = ""; + BranchInputManager::GetBranchFanTypeName(state, BranchNum, FanType, FanName, ErrFound); + if (!ErrFound) { + BranchFanFlow = state.dataFans->fans(this->m_FanIndex)->maxAirFlowRate; + } } if (BranchFanFlow > 0.0) { this->m_MaxCoolAirVolFlow = BranchFanFlow; @@ -3153,7 +3126,7 @@ namespace UnitarySystems { state.dataSize->DataFractionUsedForSizing = 1.0; SizingMethod = HVAC::AutoCalculateSizing; this->m_DesignHeatingCapacity = DataSizing::AutoSize; - if (this->m_CoolingCoilType_Num == HVAC::Coil_CoolingWaterToAirHPSimple) + if (this->m_CoolingCoilType_Num == HVAC::Coil_CoolingWaterToAirHPSimple) { // adjusted cooling coil capacity WaterToAirHeatPumpSimple::SimWatertoAirHPSimple(state, blankString, @@ -3164,9 +3137,10 @@ namespace UnitarySystems { HVAC::CompressorOp::Off, 0.0, FirstHVACIteration); - state.dataSize->DataConstantUsedForSizing = WaterToAirHeatPumpSimple::GetCoilCapacity( - state, HVAC::cAllCoilTypes(this->m_CoolingCoilType_Num), this->m_CoolingCoilName, ErrFound); - EqSizing.DesCoolingLoad = state.dataSize->DataConstantUsedForSizing; + state.dataSize->DataConstantUsedForSizing = WaterToAirHeatPumpSimple::GetCoilCapacity( + state, HVAC::cAllCoilTypes(this->m_CoolingCoilType_Num), this->m_CoolingCoilName, ErrFound); + EqSizing.DesCoolingLoad = state.dataSize->DataConstantUsedForSizing; + } state.dataSize->DataFractionUsedForSizing = 1.0; this->m_DesignCoolingCapacity = DataSizing::AutoSize; // airflow sizing with multispeed fan @@ -3616,7 +3590,7 @@ namespace UnitarySystems { ShowFatalError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName)); } else { // set variable speed coil flag as necessary - auto &newCoil = state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex]; + auto &newCoil = state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex]; this->m_NumOfSpeedCooling = (int)newCoil.performance.normalMode.speeds.size(); if (this->m_NumOfSpeedCooling > 1) { if (newCoil.performance.capControlMethod == CoilCoolingDXCurveFitPerformance::CapControlMethod::DISCRETE) { @@ -3739,19 +3713,15 @@ namespace UnitarySystems { bool isNotOK = false; - if (!input_data.availability_schedule_name.empty()) { - this->m_SysAvailSchedPtr = ScheduleManager::GetScheduleIndex(state, input_data.availability_schedule_name); - if (this->m_SysAvailSchedPtr == 0) { - ShowWarningError(state, - format("getUnitarySystemInputData {}=\"{}\", invalid Availability Schedule Name = {}", - cCurrentModuleObject, - this->Name, - input_data.availability_schedule_name)); - ShowContinueError(state, "Set the default as Always On. Simulation continues."); - this->m_SysAvailSchedPtr = ScheduleManager::ScheduleAlwaysOn; - } - } else { - this->m_SysAvailSchedPtr = ScheduleManager::ScheduleAlwaysOn; + if (input_data.availability_schedule_name.empty()) { + this->m_sysAvailSched = Sched::GetScheduleAlwaysOn(state); + } else if ((this->m_sysAvailSched = Sched::GetSchedule(state, input_data.availability_schedule_name)) == nullptr) { + ShowWarningItemNotFound(state, + eoh, + "Availability Schedule Name", + input_data.availability_schedule_name, + "Set the default as Always On. Simulation continues."); + this->m_sysAvailSched = Sched::GetScheduleAlwaysOn(state); } if (!input_data.controlling_zone_or_thermostat_location.empty()) { // not required field @@ -4090,7 +4060,7 @@ namespace UnitarySystems { this->m_DesignFanVolFlowRate = FanVolFlowRate; FanInletNode = fan->inletNodeNum; FanOutletNode = fan->outletNodeNum; - this->m_FanAvailSchedPtr = fan->availSchedNum; + this->m_fanAvailSched = fan->availSched; } this->m_FanExists = true; @@ -4120,13 +4090,7 @@ namespace UnitarySystems { errorsFound = true; } - this->m_FanOpModeSchedPtr = ScheduleManager::GetScheduleIndex(state, input_data.supply_air_fan_operating_mode_schedule_name); - if (!input_data.supply_air_fan_operating_mode_schedule_name.empty() && this->m_FanOpModeSchedPtr == 0) { - ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName)); - ShowContinueError(state, format("Illegal Fan Operating Mode Schedule Name = {}", input_data.supply_air_fan_operating_mode_schedule_name)); - // ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(iFanSchedAlphaNum), Alphas(iFanSchedAlphaNum))); - errorsFound = true; - } else if (this->m_FanOpModeSchedPtr == 0) { + if (input_data.supply_air_fan_operating_mode_schedule_name.empty()) { if (this->m_ControlType == UnitarySysCtrlType::Setpoint) { // Fan operating mode must be constant fan so that the coil outlet temp is proportional to PLR // Cycling fan always outputs the full load outlet air temp so should not be used with set point based control @@ -4134,39 +4098,28 @@ namespace UnitarySystems { } else { this->m_FanOpMode = HVAC::FanOp::Cycling; if (this->m_FanType != HVAC::FanType::OnOff && this->m_FanType != HVAC::FanType::SystemModel && this->m_FanExists) { - ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName)); - // ShowContinueError(state, format("{} = {}", cAlphaFields(iFanTypeAlphaNum), Alphas(iFanTypeAlphaNum))); - // ShowContinueError(state, format("Fan type must be Fan:OnOff of Fan:SystemModel when {} = - // Blank.", cAlphaFields(iFanSchedAlphaNum))); - ShowContinueError(state, - "Fan type must be Fan:OnOff or Fan:SystemModel when Supply Air Fan Operating Mode Schedule Name is blank."); + ShowSevereEmptyField(state, + eoh, + "Fan Operating Mode Schedule Name", + "Fan type must be Fan:OnOff or Fan:SystemModel when Supply Air Fan Operating Mode Schedule Name is blank."); errorsFound = true; } } - } else if (this->m_FanOpModeSchedPtr > 0 && this->m_ControlType == UnitarySysCtrlType::Setpoint) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, this->m_FanOpModeSchedPtr, ">", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName)); - ShowContinueError(state, format("For {} = {}", loc_fanType, loc_m_FanName)); - ShowContinueError(state, "Fan operating mode must be continuous (fan operating mode schedule values > 0)."); - ShowContinueError( - state, - format("Error found in Supply Air Fan Operating Mode Schedule Name {}", input_data.supply_air_fan_operating_mode_schedule_name)); - ShowContinueError(state, "...schedule values must be (>0., <=1.)"); - errorsFound = true; - } - } - - // Check fan's schedule for cycling fan operation IF constant volume fan is used - if (this->m_FanOpModeSchedPtr > 0 && this->m_FanType == HVAC::FanType::Constant) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, this->m_FanOpModeSchedPtr, ">", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName)); - ShowContinueError(state, "Fan operating mode must be continuous (fan operating mode schedule values > 0)."); - ShowContinueError( - state, - format("Error found in Supply Air Fan Operating Mode Schedule Name {}", input_data.supply_air_fan_operating_mode_schedule_name)); - ShowContinueError(state, "...schedule values must be (>0., <=1.)"); - errorsFound = true; - } + } else if ((this->m_fanOpModeSched = Sched::GetSchedule(state, input_data.supply_air_fan_operating_mode_schedule_name)) == nullptr) { + ShowSevereItemNotFound(state, eoh, "Fan Operating Mode Schedule Name", input_data.supply_air_fan_operating_mode_schedule_name); + // ShowContinueError(state, format("Illegal {} = {}", cAlphaFields(iFanSchedAlphaNum), Alphas(iFanSchedAlphaNum))); + errorsFound = true; + } else if ((this->m_ControlType == UnitarySysCtrlType::Setpoint || this->m_FanType == HVAC::FanType::Constant) && + !this->m_fanOpModeSched->checkMinMaxVals(state, Clusive::Ex, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, + eoh, + "Supply Air Fan Operating Mode Schedule Name", + input_data.supply_air_fan_operating_mode_schedule_name, + Clusive::Ex, + 0.0, + Clusive::In, + 1.0); + errorsFound = true; } PrintMessage = true; @@ -4198,7 +4151,7 @@ namespace UnitarySystems { errFlag = false; } else { auto &thisHeatCoil = state.dataDXCoils->DXCoil(this->m_HeatingCoilIndex); - this->m_HeatingCoilAvailSchPtr = thisHeatCoil.SchedPtr; + this->m_heatingCoilAvailSched = thisHeatCoil.availSched; this->m_DesignHeatingCapacity = thisHeatCoil.RatedTotCap(1); if (this->m_DesignHeatingCapacity == DataSizing::AutoSize) this->m_RequestAutoSize = true; this->m_MaxHeatAirVolFlow = thisHeatCoil.RatedAirVolFlowRate(1); @@ -4228,7 +4181,7 @@ namespace UnitarySystems { } else { auto const &thisHeatCoil = state.dataVariableSpeedCoils->VarSpeedCoil(this->m_HeatingCoilIndex); this->m_NumOfSpeedHeating = thisHeatCoil.NumOfSpeeds; - this->m_HeatingCoilAvailSchPtr = ScheduleManager::ScheduleAlwaysOn; + this->m_heatingCoilAvailSched = Sched::GetScheduleAlwaysOn(state); this->m_MaxHeatAirVolFlow = thisHeatCoil.RatedAirVolFlowRate; if (this->m_MaxHeatAirVolFlow == DataSizing::AutoSize) { this->m_RequestAutoSize = true; @@ -4256,7 +4209,7 @@ namespace UnitarySystems { errFlag = false; } else { auto const &thisHeatCoil = state.dataDXCoils->DXCoil(this->m_HeatingCoilIndex); - this->m_HeatingCoilAvailSchPtr = thisHeatCoil.SchedPtr; + this->m_heatingCoilAvailSched = thisHeatCoil.availSched; this->m_MaxHeatAirVolFlow = thisHeatCoil.MSRatedAirVolFlowRate(1); if (this->m_MaxHeatAirVolFlow == DataSizing::AutoSize) this->m_RequestAutoSize = true; HeatingCoilInletNode = thisHeatCoil.AirInNode; @@ -4280,7 +4233,7 @@ namespace UnitarySystems { auto const &thisHeatCoil = state.dataHeatingCoils->HeatingCoil(this->m_HeatingCoilIndex); HeatingCoilInletNode = thisHeatCoil.AirInletNodeNum; HeatingCoilOutletNode = thisHeatCoil.AirOutletNodeNum; - this->m_HeatingCoilAvailSchPtr = thisHeatCoil.SchedPtr; + this->m_heatingCoilAvailSched = thisHeatCoil.availSched; this->m_DesignHeatingCapacity = thisHeatCoil.MSNominalCapacity(thisHeatCoil.NumOfStages); if (this->m_DesignHeatingCapacity == DataSizing::AutoSize) this->m_RequestAutoSize = true; } @@ -4301,7 +4254,7 @@ namespace UnitarySystems { auto const &thisHeatCoil = state.dataHeatingCoils->HeatingCoil(this->m_HeatingCoilIndex); this->m_DesignHeatingCapacity = thisHeatCoil.NominalCapacity; if (this->m_DesignHeatingCapacity == DataSizing::AutoSize) this->m_RequestAutoSize = true; - this->m_HeatingCoilAvailSchPtr = thisHeatCoil.SchedPtr; + this->m_heatingCoilAvailSched = thisHeatCoil.availSched; HeatingCoilInletNode = thisHeatCoil.AirInletNodeNum; HeatingCoilOutletNode = thisHeatCoil.AirOutletNodeNum; HeatingCoilPLFCurveIndex = thisHeatCoil.PLFCurveIndex; @@ -4325,7 +4278,7 @@ namespace UnitarySystems { errFlag = false; } else { auto const &thisHeatCoil = state.dataWaterCoils->WaterCoil(this->m_HeatingCoilIndex); - this->m_HeatingCoilAvailSchPtr = thisHeatCoil.SchedPtr; + this->m_heatingCoilAvailSched = thisHeatCoil.availSched; this->HeatCoilFluidInletNode = thisHeatCoil.WaterInletNodeNum; this->MaxHeatCoilFluidFlow = thisHeatCoil.MaxWaterVolFlowRate; if (this->MaxHeatCoilFluidFlow == DataSizing::AutoSize) { @@ -4351,7 +4304,7 @@ namespace UnitarySystems { errFlag = false; } else { auto const &thisHeatCoil = state.dataSteamCoils->SteamCoil(this->m_HeatingCoilIndex); - this->m_HeatingCoilAvailSchPtr = thisHeatCoil.SchedPtr; + this->m_heatingCoilAvailSched = thisHeatCoil.availSched; this->HeatCoilFluidInletNode = thisHeatCoil.SteamInletNodeNum; this->MaxHeatCoilFluidFlow = thisHeatCoil.MaxSteamVolFlowRate; if (this->MaxHeatCoilFluidFlow == DataSizing::AutoSize) { @@ -4359,10 +4312,8 @@ namespace UnitarySystems { this->m_DesignHeatingCapacity = DataSizing::AutoSize; } if (this->MaxHeatCoilFluidFlow > 0.0) { - int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed Real64 TempSteamIn = 100.0; - Real64 SteamDensity = - FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, "getUnitarySystemInputData"); + Real64 SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, "getUnitarySystemInputData"); this->MaxHeatCoilFluidFlow *= SteamDensity; errFlag = false; } @@ -4390,7 +4341,7 @@ namespace UnitarySystems { errFlag = false; } else { auto const &thisHeatCoil = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(this->m_HeatingCoilIndex); - this->m_HeatingCoilAvailSchPtr = ScheduleManager::ScheduleAlwaysOn; + this->m_heatingCoilAvailSched = Sched::GetScheduleAlwaysOn(state); this->m_DesignHeatingCapacity = thisHeatCoil.RatedCapHeat; this->m_MaxHeatAirVolFlow = thisHeatCoil.RatedAirVolFlowRate; if (this->m_MaxHeatAirVolFlow == DataSizing::AutoSize) this->m_RequestAutoSize = true; @@ -4414,7 +4365,7 @@ namespace UnitarySystems { errFlag = false; } else { auto const &thisHeatCoil = state.dataWaterToAirHeatPump->WatertoAirHP(this->m_HeatingCoilIndex); - this->m_HeatingCoilAvailSchPtr = ScheduleManager::ScheduleAlwaysOn; + this->m_heatingCoilAvailSched = Sched::GetScheduleAlwaysOn(state); this->m_DesignHeatingCapacity = thisHeatCoil.HeatingCapacity; HeatingCoilInletNode = thisHeatCoil.AirInletNodeNum; HeatingCoilOutletNode = thisHeatCoil.AirOutletNodeNum; @@ -4436,7 +4387,7 @@ namespace UnitarySystems { errFlag = false; } else { auto const &thisHeatCoil = state.dataUserDefinedComponents->UserCoil(this->m_HeatingCoilIndex); - this->m_HeatingCoilAvailSchPtr = ScheduleManager::ScheduleAlwaysOn; + this->m_heatingCoilAvailSched = Sched::GetScheduleAlwaysOn(state); // **** How to get this info **** // UnitarySystem( UnitarySysNum ).DesignHeatingCapacity = // GetWtoAHPCoilCapacity(CoolingCoilType, this->m_CoolingCoilName, errFlag ); @@ -4504,7 +4455,7 @@ namespace UnitarySystems { DXCoils::DisableLatentDegradation(state, this->m_CoolingCoilIndex); } auto &thisCoolCoil = state.dataDXCoils->DXCoil(this->m_CoolingCoilIndex); - this->m_CoolingCoilAvailSchPtr = thisCoolCoil.SchedPtr; + this->m_coolingCoilAvailSched = thisCoolCoil.availSched; this->m_DesignCoolingCapacity = thisCoolCoil.RatedTotCap(1); if (this->m_DesignCoolingCapacity == DataSizing::AutoSize) this->m_RequestAutoSize = true; this->m_MaxCoolAirVolFlow = thisCoolCoil.RatedAirVolFlowRate(1); @@ -4561,12 +4512,12 @@ namespace UnitarySystems { // mine data from coil object // TODO: Need to check for autosize on these I guess - auto &newCoil = state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex]; + auto &newCoil = state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex]; this->m_DesignCoolingCapacity = newCoil.performance.normalMode.ratedGrossTotalCap; this->m_MaxCoolAirVolFlow = newCoil.performance.normalMode.ratedEvapAirFlowRate; if (this->m_DesignCoolingCapacity == DataSizing::AutoSize) this->m_RequestAutoSize = true; if (this->m_MaxCoolAirVolFlow == DataSizing::AutoSize) this->m_RequestAutoSize = true; - this->m_CoolingCoilAvailSchPtr = newCoil.availScheduleIndex; + this->m_coolingCoilAvailSched = newCoil.availSched; CoolingCoilInletNode = newCoil.evapInletNodeIndex; CoolingCoilOutletNode = newCoil.evapOutletNodeIndex; this->m_CondenserNodeNum = newCoil.condInletNodeIndex; @@ -4630,7 +4581,7 @@ namespace UnitarySystems { errorsFound = true; } else { auto &thisCoolCoil = state.dataDXCoils->DXCoil(this->m_CoolingCoilIndex); - this->m_CoolingCoilAvailSchPtr = thisCoolCoil.SchedPtr; + this->m_coolingCoilAvailSched = thisCoolCoil.availSched; this->m_DesignCoolingCapacity = thisCoolCoil.RatedTotCap(thisCoolCoil.NumCapacityStages); if (this->m_DesignCoolingCapacity == DataSizing::AutoSize) this->m_RequestAutoSize = true; this->m_MaxCoolAirVolFlow = thisCoolCoil.RatedAirVolFlowRate(1); @@ -4689,8 +4640,8 @@ namespace UnitarySystems { errorsFound = true; } - auto const &newCoil = state.dataCoilCooingDX->coilCoolingDXs[childCCIndex]; - this->m_CoolingCoilAvailSchPtr = newCoil.availScheduleIndex; + auto const &newCoil = state.dataCoilCoolingDX->coilCoolingDXs[childCCIndex]; + this->m_coolingCoilAvailSched = newCoil.availSched; // thisSys.m_DesignCoolingCapacity = newCoil.performance.normalMode.ratedGrossTotalCap; // Get Coil:Cooling:DX coil air flow rate. Later fields will overwrite this IF input field is present @@ -4703,7 +4654,7 @@ namespace UnitarySystems { } else if (Util::SameString(ChildCoolingCoilType, "COIL:COOLING:DX:SINGLESPEED")) { - this->m_CoolingCoilAvailSchPtr = DXCoils::GetDXCoilAvailSchPtr(state, ChildCoolingCoilType, ChildCoolingCoilName, errFlag); + this->m_coolingCoilAvailSched = DXCoils::GetDXCoilAvailSched(state, ChildCoolingCoilType, ChildCoolingCoilName, errFlag); if (isNotOK) { ShowContinueError(state, format("Occurs in {} = {}", cCurrentModuleObject, thisObjectName)); errorsFound = true; @@ -4732,7 +4683,7 @@ namespace UnitarySystems { } } else if (Util::SameString(ChildCoolingCoilType, "COIL:COOLING:DX:VARIABLESPEED")) { - this->m_CoolingCoilAvailSchPtr = ScheduleManager::ScheduleAlwaysOn; + this->m_coolingCoilAvailSched = Sched::GetScheduleAlwaysOn(state); this->m_MaxCoolAirVolFlow = VariableSpeedCoils::GetCoilAirFlowRateVariableSpeed(state, ChildCoolingCoilType, ChildCoolingCoilName, errFlag); if (errFlag) { @@ -4822,8 +4773,8 @@ namespace UnitarySystems { errorsFound = true; } - this->m_CoolingCoilAvailSchPtr = - WaterCoils::GetWaterCoilAvailScheduleIndex(state, HVAC::cAllCoilTypes(ActualCoolCoilType), HXCoilName, errFlag); + this->m_coolingCoilAvailSched = + WaterCoils::GetWaterCoilAvailSched(state, HVAC::cAllCoilTypes(ActualCoolCoilType), HXCoilName, errFlag); this->MaxCoolCoilFluidFlow = WaterCoils::GetCoilMaxWaterFlowRate(state, HVAC::cAllCoilTypes(ActualCoolCoilType), HXCoilName, errFlag); // Get the Cooling Coil water Inlet Node number @@ -4891,7 +4842,7 @@ namespace UnitarySystems { CoolingCoilInletNode = thisCoolCoil.AirInletNodeNum; CoolingCoilOutletNode = thisCoolCoil.AirOutletNodeNum; this->m_CondenserNodeNum = thisCoolCoil.CondenserInletNodeNum; - this->m_CoolingCoilAvailSchPtr = ScheduleManager::ScheduleAlwaysOn; + this->m_coolingCoilAvailSched = Sched::GetScheduleAlwaysOn(state); this->m_NumOfSpeedCooling = thisCoolCoil.NumOfSpeeds; if (this->m_NumOfSpeedCooling > 1) { this->m_MultiOrVarSpeedCoolCoil = true; @@ -4938,7 +4889,7 @@ namespace UnitarySystems { errFlag = false; } else { auto const &thisCoolCoil = state.dataDXCoils->DXCoil(this->m_CoolingCoilIndex); - this->m_CoolingCoilAvailSchPtr = thisCoolCoil.SchedPtr; + this->m_coolingCoilAvailSched = thisCoolCoil.availSched; CoolingCoilInletNode = thisCoolCoil.AirInNode; CoolingCoilOutletNode = thisCoolCoil.AirOutNode; this->m_DesignCoolingCapacity = thisCoolCoil.MSRatedTotCap(thisCoolCoil.NumOfSpeeds); @@ -4975,7 +4926,7 @@ namespace UnitarySystems { errFlag = false; } else { auto const &thisCoolCoil = state.dataWaterCoils->WaterCoil(this->m_CoolingCoilIndex); - this->m_CoolingCoilAvailSchPtr = thisCoolCoil.SchedPtr; + this->m_coolingCoilAvailSched = thisCoolCoil.availSched; if (this->m_CoolingCoilType_Num == HVAC::Coil_CoolingWater) { this->m_MaxCoolAirVolFlow = thisCoolCoil.DesAirVolFlowRate; } @@ -5004,7 +4955,7 @@ namespace UnitarySystems { errFlag = false; } else { auto const &thisCoolCoil = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(this->m_CoolingCoilIndex); - this->m_CoolingCoilAvailSchPtr = ScheduleManager::ScheduleAlwaysOn; + this->m_coolingCoilAvailSched = Sched::GetScheduleAlwaysOn(state); this->m_DesignCoolingCapacity = thisCoolCoil.RatedCapCoolTotal; // this isn't likely to work on getInput calls but is what happened before @@ -5054,7 +5005,7 @@ namespace UnitarySystems { errFlag = false; } else { auto const &thisCoolCoil = state.dataWaterToAirHeatPump->WatertoAirHP(this->m_CoolingCoilIndex); - this->m_CoolingCoilAvailSchPtr = ScheduleManager::ScheduleAlwaysOn; + this->m_coolingCoilAvailSched = Sched::GetScheduleAlwaysOn(state); this->m_DesignCoolingCapacity = thisCoolCoil.CoolingCapacity; CoolingCoilInletNode = thisCoolCoil.AirInletNodeNum; CoolingCoilOutletNode = thisCoolCoil.AirOutletNodeNum; @@ -5087,7 +5038,7 @@ namespace UnitarySystems { errFlag = false; } else { auto const &thisCoolCoil = state.dataUserDefinedComponents->UserCoil(this->m_CoolingCoilIndex); - this->m_CoolingCoilAvailSchPtr = ScheduleManager::ScheduleAlwaysOn; + this->m_coolingCoilAvailSched = Sched::GetScheduleAlwaysOn(state); // **** How to get this info **** // UnitarySystem( UnitarySysNum ).DesignCoolingCapacity = // GetWtoAHPCoilCapacity(CoolingCoilType, this->m_CoolingCoilName, errFlag ); @@ -5111,7 +5062,7 @@ namespace UnitarySystems { errFlag = false; } else { auto const &thisCoolCoil = state.dataPackagedThermalStorageCoil->TESCoil(this->m_CoolingCoilIndex); - this->m_CoolingCoilAvailSchPtr = ScheduleManager::ScheduleAlwaysOn; + this->m_coolingCoilAvailSched = Sched::GetScheduleAlwaysOn(state); this->m_MaxCoolAirVolFlow = thisCoolCoil.RatedEvapAirVolFlowRate; if (thisCoolCoil.CoolingOnlyModeIsAvailable) { this->m_DesignCoolingCapacity = thisCoolCoil.CoolingOnlyRatedTotCap; @@ -5220,7 +5171,7 @@ namespace UnitarySystems { this->m_CoolingCoilType_Num == HVAC::Coil_CoolingWaterToAirHPVSEquationFit)) { DXCoils::SetDXCoilTypeData(state, this->m_CoolingCoilName); } else if (this->m_CoolingCoilType_Num == HVAC::CoilDX_Cooling) { - state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].setToHundredPercentDOAS(); + state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex].setToHundredPercentDOAS(); } } // DOAS DX Cooling Coil Leaving Minimum Air Temperature @@ -5380,10 +5331,8 @@ namespace UnitarySystems { this->m_DesignSuppHeatingCapacity = DataSizing::AutoSize; // not sure if steam coil needs this } if (this->m_MaxSuppCoilFluidFlow > 0.0) { - int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed Real64 TempSteamIn = 100.0; - Real64 SteamDensity = FluidProperties::GetSatDensityRefrig( - state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, "getUnitarySystemInputData"); + Real64 SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, "getUnitarySystemInputData"); this->m_MaxSuppCoilFluidFlow = this->m_MaxSuppCoilFluidFlow * SteamDensity; } SupHeatCoilInletNode = thisSuppCoil.AirInletNodeNum; @@ -6067,8 +6016,8 @@ namespace UnitarySystems { } // Fan operating mode (cycling or constant) schedule. IF constant fan, then set AirFlowControl - if (this->m_FanOpModeSchedPtr > 0) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, this->m_FanOpModeSchedPtr, ">=", 0.0, "<=", 0.0)) { + if (this->m_fanOpModeSched != nullptr) { + if (!this->m_fanOpModeSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 0.0)) { // set fan operating mode to continuous so sizing can set VS coil data this->m_FanOpMode = HVAC::FanOp::Continuous; // set air flow control mode: @@ -6084,13 +6033,14 @@ namespace UnitarySystems { } if (this->m_CoolingCoilType_Num == HVAC::CoilDX_Cooling && this->m_DehumidControlType_Num == DehumCtrlType::Multimode) { - int numCoolingCoilModes = state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].getNumModes(); + int numCoolingCoilModes = state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex].getNumModes(); if (numCoolingCoilModes == 1) { ShowSevereError(state, format("{} = {}", cCurrentModuleObject, thisObjectName)); ShowContinueError(state, format("Illegal Dehumidification Control Type = {}", input_data.dehumidification_control_type)); ShowContinueError(state, "Multimode control must be used with a Heat Exchanger Assisted or Multimode Cooling Coil."); ShowContinueError( - state, format("Cooling coil named: {} has only one mode", state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].name)); + state, + format("Cooling coil named: {} has only one mode", state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex].name)); ShowFatalError(state, "Multimode cooling coil error causes program termination"); } } else if (this->m_CoolingCoilType_Num != HVAC::CoilDX_CoolingHXAssisted && @@ -6445,8 +6395,8 @@ namespace UnitarySystems { } } - if (this->m_FanOpModeSchedPtr > 0) { - if (!ScheduleManager::CheckScheduleValueMinMax(state, this->m_FanOpModeSchedPtr, ">=", 0.0, "<=", 0.0)) { + if (this->m_fanOpModeSched != nullptr) { + if (!this->m_fanOpModeSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 0.0)) { // set air flow control mode: // m_AirFlowControl = UseCompFlow::On means operate at last cooling or heating air flow requested when compressor is off // m_AirFlowControl = UseCompFlow::Off means operate at no load air flow value specified by user @@ -6617,10 +6567,7 @@ namespace UnitarySystems { this->m_MSHeatingSpeedRatio[i] = 1.0; } if (this->m_HeatingCoilType_Num == HVAC::Coil_HeatingWaterToAirHPVSEquationFit) { - std::string MultispeedType = "UnitarySystemPerformance:Multispeed"; - if (this->m_DesignSpecMSHPIndex == -1) { - std::string MultispeedType = "Fan:SystemModel"; - } + std::string MultispeedType = (this->m_DesignSpecMSHPIndex == -1) ? "Fan:SystemModel" : "UnitarySystemPerformance:Multispeed"; int NumOfSpeed = VariableSpeedCoils::GetVSCoilNumOfSpeeds(state, this->m_HeatingCoilName, errorsFound); if (errorsFound) { ShowSevereError(state, @@ -6663,10 +6610,7 @@ namespace UnitarySystems { this->m_MSCoolingSpeedRatio[i] = 1.0; } if (this->m_CoolingCoilType_Num == HVAC::Coil_CoolingWaterToAirHPVSEquationFit) { - std::string MultispeedType = "UnitarySystemPerformance:Multispeed"; - if (this->m_DesignSpecMSHPIndex == -1) { - std::string MultispeedType = "Fan:SystemModel"; - } + std::string MultispeedType = (this->m_DesignSpecMSHPIndex == -1) ? "Fan:SystemModel" : "UnitarySystemPerformance:Multispeed"; int NumOfSpeed = VariableSpeedCoils::GetVSCoilNumOfSpeeds(state, this->m_CoolingCoilName, errorsFound); if (errorsFound) { ShowSevereError(state, @@ -6946,7 +6890,7 @@ namespace UnitarySystems { std::string const &thisObjectName = Util::makeUPPER(instance.key()); // only get the current data once all data has been read in and vector unitarySys has been initialized - // when UnitarySystems::getInputOnceFlag is true read all unitary systems, otherwise read just the curren object + // when UnitarySystems::getInputOnceFlag is true read all unitary systems, otherwise read just the current object if (!Util::SameString(objectName, thisObjectName) && !state.dataUnitarySystems->getInputOnceFlag) continue; int sysNum = getUnitarySystemIndex(state, thisObjectName); @@ -7072,7 +7016,7 @@ namespace UnitarySystems { std::string const &thisObjectName = Util::makeUPPER(instance.key()); // only get the current data once all data has been read in and vector unitarySys has been initialized - // when UnitarySystems::getInputOnceFlag is true read all unitary systems, otherwise read just the curren object + // when UnitarySystems::getInputOnceFlag is true read all unitary systems, otherwise read just the current object if (!Util::SameString(objectName, thisObjectName) && !state.dataUnitarySystems->getInputOnceFlag) continue; int sysNum = getUnitarySystemIndex(state, thisObjectName); @@ -7387,7 +7331,7 @@ namespace UnitarySystems { std::string const &thisObjectName = Util::makeUPPER(instance.key()); // only get the current data once all data has been read in and vector unitarySys has been initialized - // when UnitarySystems::getInputOnceFlag is true read all unitary systems, otherwise read just the curren object + // when UnitarySystems::getInputOnceFlag is true read all unitary systems, otherwise read just the current object if (!Util::SameString(objectName, thisObjectName) && !state.dataUnitarySystems->getInputOnceFlag) continue; int sysNum = getUnitarySystemIndex(state, thisObjectName); @@ -7676,7 +7620,7 @@ namespace UnitarySystems { Real64 const OAUCoilOutTemp, // the coil inlet temperature of OutdoorAirUnit bool HXUnitOn, // Flag to control HX for HXAssisted Cooling Coil Real64 &sysOutputProvided, // system sensible output at supply air node - Real64 &latOutputProvided // sytsem latent output at supply air node + Real64 &latOutputProvided // system latent output at supply air node ) { @@ -8044,18 +7988,18 @@ namespace UnitarySystems { state.dataUnitarySystems->QToHeatSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(this->ControlZoneNum) .SequencedOutputRequiredToHeatingSP(this->m_ZoneSequenceHeatingNum); if (state.dataUnitarySystems->QToHeatSetPt > 0.0 && state.dataUnitarySystems->QToCoolSetPt > 0.0 && - state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum) != HVAC::ThermostatType::SingleCooling) { + state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum) != HVAC::SetptType::SingleCool) { ZoneLoad = state.dataUnitarySystems->QToHeatSetPt; state.dataUnitarySystems->HeatingLoad = true; } else if (state.dataUnitarySystems->QToHeatSetPt > 0.0 && state.dataUnitarySystems->QToCoolSetPt > 0.0 && - state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum) == HVAC::ThermostatType::SingleCooling) { + state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum) == HVAC::SetptType::SingleCool) { ZoneLoad = 0.0; } else if (state.dataUnitarySystems->QToHeatSetPt < 0.0 && state.dataUnitarySystems->QToCoolSetPt < 0.0 && - state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum) != HVAC::ThermostatType::SingleHeating) { + state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum) != HVAC::SetptType::SingleHeat) { ZoneLoad = state.dataUnitarySystems->QToCoolSetPt; state.dataUnitarySystems->CoolingLoad = true; } else if (state.dataUnitarySystems->QToHeatSetPt < 0.0 && state.dataUnitarySystems->QToCoolSetPt < 0.0 && - state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum) == HVAC::ThermostatType::SingleHeating) { + state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum) == HVAC::SetptType::SingleHeat) { ZoneLoad = 0.0; } else if (state.dataUnitarySystems->QToHeatSetPt <= 0.0 && state.dataUnitarySystems->QToCoolSetPt >= 0.0) { ZoneLoad = 0.0; @@ -8075,10 +8019,10 @@ namespace UnitarySystems { this->m_sysType == SysType::PackagedWSHP) { // ZoneSysAvailManager is turning on sooner than PTUnit in UnitarySystem. Mimic PTUnit logic. if (state.dataUnitarySystems->QToCoolSetPt < 0.0 && - state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum) != HVAC::ThermostatType::SingleHeating) { + state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum) != HVAC::SetptType::SingleHeat) { ZoneLoad = state.dataUnitarySystems->QToCoolSetPt; } else if (state.dataUnitarySystems->QToHeatSetPt > 0.0 && - state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum) != HVAC::ThermostatType::SingleCooling) { + state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum) != HVAC::SetptType::SingleCool) { ZoneLoad = state.dataUnitarySystems->QToHeatSetPt; } else { ZoneLoad = 0.0; @@ -8088,7 +8032,7 @@ namespace UnitarySystems { if (ZoneLoad < 0.0 && state.dataUnitarySystems->MoistureLoad <= 0.0 && (this->m_CoolingCoilType_Num == HVAC::CoilDX_Cooling && - state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag)) { + state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag)) { this->LoadSHR = ZoneLoad / (ZoneLoad + state.dataUnitarySystems->MoistureLoad * Psychrometrics::PsyHgAirFnWTdb( @@ -8118,7 +8062,7 @@ namespace UnitarySystems { if (this->m_EMSOverrideSensZoneLoadRequest) ZoneLoad = this->m_EMSSensibleZoneLoadValue; if (this->m_EMSOverrideMoistZoneLoadRequest) state.dataUnitarySystems->MoistureLoad = this->m_EMSMoistureZoneLoadValue; - this->m_SimASHRAEModel = false; // flag used to envoke ASHRAE 90.1 model calculations + this->m_SimASHRAEModel = false; // flag used to invoke ASHRAE 90.1 model calculations // allows non-ASHSRAE compliant coil types to be modeled using non-ASHAR90 method. Constant fan operating mode is required. if (this->m_FanOpMode == HVAC::FanOp::Continuous) { if (state.dataUnitarySystems->CoolingLoad) { @@ -8400,7 +8344,7 @@ namespace UnitarySystems { std::string CompName = this->Name; int OutletNode = this->AirOutNode; - if (ScheduleManager::GetCurrentScheduleValue(state, this->m_SysAvailSchedPtr) <= 0.0) { + if (this->m_sysAvailSched->getCurrentVal() <= 0.0) { return; } if (this->m_EMSOverrideCoilSpeedNumOn) { @@ -8450,7 +8394,7 @@ namespace UnitarySystems { // determine if PLR=0 meets the load switch (state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum)) { - case HVAC::ThermostatType::SingleHeating: { + case HVAC::SetptType::SingleHeat: { if (state.dataUnitarySystems->HeatingLoad && SensOutputOff > ZoneLoad && (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad > LatOutputOff)) return; @@ -8458,7 +8402,7 @@ namespace UnitarySystems { (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad > LatOutputOff)) return; } break; - case HVAC::ThermostatType::SingleCooling: { + case HVAC::SetptType::SingleCool: { if (state.dataUnitarySystems->CoolingLoad && SensOutputOff < ZoneLoad && (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad > LatOutputOff)) return; @@ -8466,8 +8410,8 @@ namespace UnitarySystems { (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad > LatOutputOff)) return; } break; - case HVAC::ThermostatType::SingleHeatCool: - case HVAC::ThermostatType::DualSetPointWithDeadBand: { + case HVAC::SetptType::SingleHeatCool: + case HVAC::SetptType::DualHeatCool: { if (state.dataUnitarySystems->HeatingLoad && SensOutputOff > ZoneLoad && (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad > LatOutputOff)) return; @@ -8522,7 +8466,7 @@ namespace UnitarySystems { FullSensibleOutput = SensOutputOff; switch (state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum)) { - case HVAC::ThermostatType::SingleHeating: { + case HVAC::SetptType::SingleHeat: { if (state.dataUnitarySystems->HeatingLoad && SensOutputOff > ZoneLoad && (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad > LatOutputOff)) return; @@ -8530,7 +8474,7 @@ namespace UnitarySystems { (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad > LatOutputOff)) return; } break; - case HVAC::ThermostatType::SingleCooling: { + case HVAC::SetptType::SingleCool: { if (state.dataUnitarySystems->CoolingLoad && SensOutputOff < ZoneLoad && this->m_DehumidControlType_Num != DehumCtrlType::CoolReheat) return; if (state.dataUnitarySystems->CoolingLoad && SensOutputOff < ZoneLoad && @@ -8540,8 +8484,8 @@ namespace UnitarySystems { (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad > LatOutputOff)) return; } break; - case HVAC::ThermostatType::SingleHeatCool: - case HVAC::ThermostatType::DualSetPointWithDeadBand: { + case HVAC::SetptType::SingleHeatCool: + case HVAC::SetptType::DualHeatCool: { if (state.dataUnitarySystems->HeatingLoad && SensOutputOff > ZoneLoad && (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad > LatOutputOff)) return; @@ -8675,7 +8619,7 @@ namespace UnitarySystems { if ((state.dataUnitarySystems->HeatingLoad && this->m_NumOfSpeedHeating <= 1) || (state.dataUnitarySystems->CoolingLoad && this->m_NumOfSpeedCooling <= 1)) { switch (state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum)) { - case HVAC::ThermostatType::SingleHeating: { + case HVAC::SetptType::SingleHeat: { if (state.dataUnitarySystems->HeatingLoad && SensOutputOn < ZoneLoad) { this->m_HeatingPartLoadFrac = 1.0; if (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad < LatOutputOn) return; @@ -8684,7 +8628,7 @@ namespace UnitarySystems { (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad < LatOutputOn)) return; } break; - case HVAC::ThermostatType::SingleCooling: { + case HVAC::SetptType::SingleCool: { if (state.dataUnitarySystems->CoolingLoad && SensOutputOn > ZoneLoad) { this->m_CoolingPartLoadFrac = 1.0; if (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad < LatOutputOn) return; @@ -8693,8 +8637,8 @@ namespace UnitarySystems { (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad < LatOutputOn)) return; } break; - case HVAC::ThermostatType::SingleHeatCool: - case HVAC::ThermostatType::DualSetPointWithDeadBand: { + case HVAC::SetptType::SingleHeatCool: + case HVAC::SetptType::DualHeatCool: { if (state.dataUnitarySystems->HeatingLoad && SensOutputOn < ZoneLoad) { this->m_HeatingPartLoadFrac = 1.0; if (state.dataUnitarySystems->MoistureLoad >= 0.0 || state.dataUnitarySystems->MoistureLoad > LatOutputOn) return; @@ -8990,9 +8934,9 @@ namespace UnitarySystems { Real64 SensOutput; Real64 LatOutput; if (this->m_CoolingCoilType_Num == HVAC::CoilDX_Cooling && - state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) { + state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) { if (state.dataUnitarySystems->CoolingLoad && this->LoadSHR > 0.0) { - int CoilInletNode = state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].evapInletNodeIndex; + int CoilInletNode = state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex].evapInletNodeIndex; this->CoilSHR = 0.0; Real64 LowSpeedCoilSen; Real64 LowSpeedCoilLat; @@ -9156,7 +9100,7 @@ namespace UnitarySystems { PartLoadRatio = CoolPLR; } else if (state.dataGlobal->DoCoilDirectSolutions && state.dataUnitarySystems->CoolingLoad && this->m_CoolingCoilType_Num == HVAC::CoilDX_Cooling && this->m_NumOfSpeedCooling == 1 && - state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) { + state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) { HeatPLR = 0.0; this->calcUnitarySystemToLoad(state, AirLoopNum, @@ -10005,11 +9949,8 @@ namespace UnitarySystems { Real64 CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", this->m_HeatingCoilName, errorsFound); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->HeatCoilPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->HeatCoilPlantLoc.loopNum).FluidIndex, - routineName); + Real64 rho = state.dataPlnt->PlantLoop(this->HeatCoilPlantLoc.loopNum) + .glycol->getDensity(state, Constant::CWInitConvTemp, routineName); this->MaxHeatCoilFluidFlow = CoilMaxVolFlowRate * rho; } } @@ -10023,10 +9964,8 @@ namespace UnitarySystems { QActual); // QCoilReq, simulate any load > 0 to get max capacity Real64 CoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate(state, this->m_HeatingCoilIndex, errorsFound); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed Real64 TempSteamIn = 100.0; - Real64 SteamDensity = - FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, routineName); + Real64 SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, routineName); this->MaxHeatCoilFluidFlow = CoilMaxVolFlowRate * SteamDensity; } } @@ -10043,11 +9982,8 @@ namespace UnitarySystems { Real64 CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", this->m_SuppHeatCoilName, errorsFound); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->m_SuppCoilPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(this->m_SuppCoilPlantLoc.loopNum).FluidIndex, - routineName); + Real64 rho = state.dataPlnt->PlantLoop(this->m_SuppCoilPlantLoc.loopNum) + .glycol->getDensity(state, Constant::CWInitConvTemp, routineName); this->m_MaxSuppCoilFluidFlow = CoilMaxVolFlowRate * rho; } } @@ -10060,10 +9996,8 @@ namespace UnitarySystems { QActual); // QCoilReq, simulate any load > 0 to get max capacity Real64 CoilMaxVolFlowRate = SteamCoils::GetCoilMaxSteamFlowRate(state, this->m_SuppHeatCoilIndex, errorsFound); if (CoilMaxVolFlowRate != DataSizing::AutoSize) { - int SteamIndex = 0; // Function GetSatDensityRefrig will look up steam index if 0 is passed Real64 TempSteamIn = 100.0; - Real64 SteamDensity = - FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, SteamIndex, routineName); + Real64 SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, routineName); this->m_MaxSuppCoilFluidFlow = CoilMaxVolFlowRate * SteamDensity; } } @@ -10140,7 +10074,7 @@ namespace UnitarySystems { this->m_LatLoadLoss = 0.0; } - // Calcuate air distribution losses + // Calculate air distribution losses if (!FirstHVACIteration && state.afn->AirflowNetworkFanActivated) { Real64 DeltaMassRate = 0.0; Real64 TotalOutput = 0.0; // total output rate, {W} @@ -10186,8 +10120,8 @@ namespace UnitarySystems { } } - if (this->m_FanOpModeSchedPtr > 0) { - if (ScheduleManager::GetCurrentScheduleValue(state, this->m_FanOpModeSchedPtr) == 0.0) { + if (this->m_fanOpModeSched != nullptr) { + if (this->m_fanOpModeSched->getCurrentVal() == 0.0) { this->m_FanOpMode = HVAC::FanOp::Cycling; } else { this->m_FanOpMode = HVAC::FanOp::Continuous; @@ -10214,11 +10148,11 @@ namespace UnitarySystems { smallLoadTolerance = HVAC::SmallLoad; } if (QZnReq > smallLoadTolerance) { // no need to check deadband flag, QZnReq is correct. - if (state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum) != HVAC::ThermostatType::SingleCooling) { + if (state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum) != HVAC::SetptType::SingleCool) { state.dataUnitarySystems->HeatingLoad = true; } } else if (QZnReq < -smallLoadTolerance) { - if (state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum) != HVAC::ThermostatType::SingleHeating) { + if (state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum) != HVAC::SetptType::SingleHeat) { state.dataUnitarySystems->CoolingLoad = true; } } @@ -10251,7 +10185,7 @@ namespace UnitarySystems { CompressorOn); switch (state.dataHeatBalFanSys->TempControlType(this->ControlZoneNum)) { - case HVAC::ThermostatType::SingleHeating: + case HVAC::SetptType::SingleHeat: { state.dataUnitarySystems->CoolingLoad = false; // No heating load and constant fan pushes zone below heating set point if (SensOutputOff < 0.0 && state.dataUnitarySystems->QToHeatSetPt <= 0.0 && @@ -10260,8 +10194,9 @@ namespace UnitarySystems { state.dataUnitarySystems->CoolingLoad = false; ZoneLoad = state.dataUnitarySystems->QToHeatSetPt; } - break; - case HVAC::ThermostatType::SingleCooling: + } break; + + case HVAC::SetptType::SingleCool: { state.dataUnitarySystems->HeatingLoad = false; // No heating load and constant fan pushes zone above cooling set point if (SensOutputOff > 0.0 && state.dataUnitarySystems->QToCoolSetPt > 0.0 && @@ -10270,8 +10205,9 @@ namespace UnitarySystems { state.dataUnitarySystems->CoolingLoad = true; ZoneLoad = state.dataUnitarySystems->QToCoolSetPt; } - break; - case HVAC::ThermostatType::SingleHeatCool: + } break; + + case HVAC::SetptType::SingleHeatCool: { // zone temp above cooling and heating set point temps if (state.dataUnitarySystems->QToHeatSetPt < 0.0 && state.dataUnitarySystems->QToCoolSetPt < 0.0) { // zone pushed below heating set point @@ -10289,8 +10225,9 @@ namespace UnitarySystems { ZoneLoad = state.dataUnitarySystems->QToCoolSetPt; } } - break; - case HVAC::ThermostatType::DualSetPointWithDeadBand: + } break; + + case HVAC::SetptType::DualHeatCool: { // zone temp above cooling and heating set point temps if (state.dataUnitarySystems->QToHeatSetPt < 0.0 && state.dataUnitarySystems->QToCoolSetPt < 0.0) { // zone pushed into deadband @@ -10333,10 +10270,11 @@ namespace UnitarySystems { ZoneLoad = state.dataUnitarySystems->QToCoolSetPt; } } - break; - default: - break; - } + } break; + + default: { + } break; + } // switch // push iteration mode stack and set current mode this->m_IterationMode[2] = this->m_IterationMode[1]; @@ -10426,10 +10364,10 @@ namespace UnitarySystems { } if (!this->m_RunOnLatentLoad) state.dataUnitarySystems->MoistureLoad = 0.0; - // Testing heat pump air to air with RH control with CoolReheat dehumidifaction control showed that when there was heating + // Testing heat pump air to air with RH control with CoolReheat dehumidification control showed that when there was heating // and moisture load, the cooling coil was turning on to meet the moisture load and reheat was then turning on to meet both // heating load and excess cooling load caused by cooling coil. Adding the logic below caused the zone temperature, - // relative humidity, cooling/heating rate to line up for both the orignal and new file with unitary system object. + // relative humidity, cooling/heating rate to line up for both the original and new file with unitary system object. if (this->m_SuppCoilExists) { if (this->m_DehumidControlType_Num == DehumCtrlType::CoolReheat) { @@ -10551,7 +10489,7 @@ namespace UnitarySystems { if (this->m_sysType == SysType::PackagedAC || this->m_sysType == SysType::PackagedHP || this->m_sysType == SysType::PackagedWSHP) { state.dataUnitarySystems->OACompOnMassFlow = this->m_HeatOutAirMassFlow; - // does this assume OA flow <= min speed flow? wihtout this there are SolveRoot failures. + // does this assume OA flow <= min speed flow? without this there are SolveRoot failures. if (HeatSpeedNum > 1) { state.dataUnitarySystems->OACompOffMassFlow = this->m_HeatOutAirMassFlow; } @@ -11050,11 +10988,10 @@ namespace UnitarySystems { // BEGIN - refactor/move this to Init during FirstHVACIteration, need struct or module level global for turnFansOn and turnFansOff // If the unitary system is scheduled on or nightime cycle overrides fan schedule. Uses same logic as fan. - FanOn = (this->m_FanExists) ? ScheduleManager::GetCurrentScheduleValue(state, this->m_FanAvailSchedPtr) > 0 : true; + FanOn = (this->m_FanExists) ? (this->m_fanAvailSched->getCurrentVal() > 0) : true; // END - move this to Init during FirstHVACIteration - if (ScheduleManager::GetCurrentScheduleValue(state, this->m_SysAvailSchedPtr) > 0.0 && - ((FanOn || state.dataHVACGlobal->TurnFansOn) && !state.dataHVACGlobal->TurnFansOff)) { + if (this->m_sysAvailSched->getCurrentVal() > 0.0 && ((FanOn || state.dataHVACGlobal->TurnFansOn) && !state.dataHVACGlobal->TurnFansOff)) { if (this->m_ControlType == UnitarySysCtrlType::Setpoint) { // set point based equipment should use VAV terminal units to set the flow. // zone equipment needs to set flow since no other device regulates flow (ZoneHVAC /= AirLoopEquipment) @@ -11565,13 +11502,13 @@ namespace UnitarySystems { } HVAC::CoilMode coilMode = HVAC::CoilMode::Normal; - if (state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) { + if (state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) { coilMode = HVAC::CoilMode::SubcoolReheat; } else if (this->m_DehumidificationMode == HVAC::CoilMode::Enhanced) { coilMode = HVAC::CoilMode::Enhanced; } - state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate( + state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate( state, coilMode, CoilPLR, this->m_CoolingSpeedNum, this->m_CoolingSpeedRatio, this->m_FanOpMode, singleMode, this->CoilSHR); if (this->m_CoolingSpeedNum > 1) { @@ -12192,8 +12129,7 @@ namespace UnitarySystems { } // IF UnitarySystem is scheduled on and there is flow - if ((ScheduleManager::GetCurrentScheduleValue(state, this->m_SysAvailSchedPtr) > 0.0) && - ScheduleManager::GetCurrentScheduleValue(state, this->m_CoolingCoilAvailSchPtr) > 0.0 && + if ((this->m_sysAvailSched->getCurrentVal() > 0.0) && this->m_coolingCoilAvailSched->getCurrentVal() > 0.0 && (state.dataLoopNodes->Node(InletNode).MassFlowRate > HVAC::SmallAirVolFlow)) { bool SensibleLoad = false; @@ -12264,7 +12200,7 @@ namespace UnitarySystems { // Multimode coil will switch to enhanced dehumidification IF available and needed, but it // still runs to meet the sensible load. Multimode applies to Multimode or HXAssistedCooling coils. if ((SensibleLoad && this->m_RunOnSensibleLoad) || (LatentLoad && this->m_RunOnLatentLoad)) { - // calculate sensible PLR, don't care IF latent is true here but need to gaurd for + // calculate sensible PLR, don't care IF latent is true here but need to guard for // when LatentLoad=TRUE and SensibleLoad=FALSE ReqOutput = state.dataLoopNodes->Node(InletNode).MassFlowRate * Psychrometrics::PsyDeltaHSenFnTdb2W2Tdb1W1(DesOutTemp, @@ -12355,13 +12291,13 @@ namespace UnitarySystems { } } else { HVAC::CoilMode coilMode = HVAC::CoilMode::Normal; - if (state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) { + if (state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) { coilMode = HVAC::CoilMode::SubcoolReheat; } else if (this->m_DehumidificationMode == HVAC::CoilMode::Enhanced) { coilMode = HVAC::CoilMode::Enhanced; } bool const singleMode = (this->m_SingleMode == 1); - state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate( + state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate( state, coilMode, PartLoadFrac, this->m_CoolingSpeedNum, this->m_CoolingSpeedRatio, this->m_FanOpMode, singleMode); } @@ -12416,13 +12352,13 @@ namespace UnitarySystems { state.dataHVACGlobal->MSHPMassFlowRateLow = this->m_DesignMassFlowRate; state.dataHVACGlobal->MSHPMassFlowRateHigh = this->m_DesignMassFlowRate; HVAC::CoilMode coilMode = HVAC::CoilMode::Normal; - if (state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) { + if (state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) { coilMode = HVAC::CoilMode::SubcoolReheat; } else if (this->m_DehumidificationMode == HVAC::CoilMode::Enhanced) { coilMode = HVAC::CoilMode::Enhanced; } bool const singleMode = (this->m_SingleMode == 1); - state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate( + state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate( state, coilMode, PartLoadFrac, this->m_CoolingSpeedNum, this->m_CoolingSpeedRatio, this->m_FanOpMode, singleMode); this->m_CoolCompPartLoadRatio = PartLoadFrac; } else if ((CoilType_Num == HVAC::Coil_CoolingWater) || (CoilType_Num == HVAC::Coil_CoolingWaterDetailed)) { // COIL:COOLING:WATER @@ -12618,7 +12554,7 @@ namespace UnitarySystems { } else if (CoilType_Num == HVAC::CoilDX_Cooling) { // CoilCoolingDX HVAC::CoilMode coilMode = HVAC::CoilMode::Normal; - if (state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) { + if (state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) { coilMode = HVAC::CoilMode::SubcoolReheat; } else if (this->m_DehumidificationMode == HVAC::CoilMode::Enhanced) { coilMode = HVAC::CoilMode::Enhanced; @@ -12627,7 +12563,7 @@ namespace UnitarySystems { bool const singleMode = (this->m_SingleMode == 1); for (int speedNum = 1; speedNum <= this->m_NumOfSpeedCooling; speedNum++) { this->m_CoolingSpeedNum = speedNum; - state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate( + state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate( state, coilMode, PartLoadFrac, this->m_CoolingSpeedNum, this->m_CoolingSpeedRatio, this->m_FanOpMode, singleMode); if (speedNum == this->m_NumOfSpeedCooling) { FullLoadHumRatOut = state.dataLoopNodes->Node(OutletNode).HumRat; @@ -13038,14 +12974,14 @@ namespace UnitarySystems { Real64 CoolingSpeedRatio = this->m_CoolingSpeedRatio; bool const singleMode = this->m_SingleMode; if (CoolingSpeedNum == 1) { - state.dataCoilCooingDX->coilCoolingDXs[CoilIndex].simulate( + state.dataCoilCoolingDX->coilCoolingDXs[CoilIndex].simulate( state, DehumidMode, PartLoadRatio, CoolingSpeedNum, CoolingSpeedRatio, fanOp, singleMode); } else { - state.dataCoilCooingDX->coilCoolingDXs[CoilIndex].simulate( + state.dataCoilCoolingDX->coilCoolingDXs[CoilIndex].simulate( state, DehumidMode, CoolingSpeedRatio, CoolingSpeedNum, PartLoadRatio, fanOp, singleMode); } Real64 outletCondition = - state.dataLoopNodes->Node(state.dataCoilCooingDX->coilCoolingDXs[CoilIndex].evapOutletNodeIndex).Temp; + state.dataLoopNodes->Node(state.dataCoilCoolingDX->coilCoolingDXs[CoilIndex].evapOutletNodeIndex).Temp; return DesOutTemp - outletCondition; }; @@ -13244,7 +13180,7 @@ namespace UnitarySystems { } else if (CoilType_Num == HVAC::CoilDX_Cooling) { // CoilCoolingDX HVAC::CoilMode coilMode = HVAC::CoilMode::Enhanced; - if (state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) { + if (state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) { coilMode = HVAC::CoilMode::SubcoolReheat; } if (this->m_CoolingSpeedNum == 0) this->m_CoolingSpeedNum = 1; @@ -13252,7 +13188,7 @@ namespace UnitarySystems { PartLoadFrac = 1.0; for (int speedNum = this->m_CoolingSpeedNum; speedNum <= this->m_NumOfSpeedCooling; speedNum++) { this->m_CoolingSpeedNum = speedNum; - state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate( + state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate( state, coilMode, PartLoadFrac, this->m_CoolingSpeedNum, this->m_CoolingSpeedRatio, this->m_FanOpMode, singleMode); // Cooling: break if outlet temp is lower than DesOutTemp or approaches DesOutTemp to within Acc from above if ((state.dataLoopNodes->Node(OutletNode).Temp - DesOutTemp) < Acc) break; @@ -13268,14 +13204,14 @@ namespace UnitarySystems { Real64 CoolingSpeedRatio = 1.0; bool const singleMode = false; if (CoolingSpeedNum == 1) { - state.dataCoilCooingDX->coilCoolingDXs[CoilIndex].simulate( + state.dataCoilCoolingDX->coilCoolingDXs[CoilIndex].simulate( state, HVAC::CoilMode::Enhanced, PartLoadFrac, CoolingSpeedNum, CoolingSpeedRatio, fanOp, singleMode); } else { - state.dataCoilCooingDX->coilCoolingDXs[CoilIndex].simulate( + state.dataCoilCoolingDX->coilCoolingDXs[CoilIndex].simulate( state, HVAC::CoilMode::Enhanced, CoolingSpeedRatio, CoolingSpeedNum, PartLoadFrac, fanOp, singleMode); } Real64 outletCondition = - state.dataLoopNodes->Node(state.dataCoilCooingDX->coilCoolingDXs[CoilIndex].evapOutletNodeIndex).Temp; + state.dataLoopNodes->Node(state.dataCoilCoolingDX->coilCoolingDXs[CoilIndex].evapOutletNodeIndex).Temp; return DesOutTemp - outletCondition; }; @@ -13690,7 +13626,7 @@ namespace UnitarySystems { PartLoadFrac = 1.0; for (int speedNum = this->m_CoolingSpeedNum; speedNum <= this->m_NumOfSpeedCooling; speedNum++) { this->m_CoolingSpeedNum = speedNum; - state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate( + state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate( state, coilMode, PartLoadFrac, this->m_CoolingSpeedNum, this->m_CoolingSpeedRatio, this->m_FanOpMode, singleMode); // Cooling: break if outlet humrat is lower than DesOutHumRat or approaches DesOutHumRat to within HumRatAcc from above if ((state.dataLoopNodes->Node(OutletNode).HumRat - DesOutHumRat) < HumRatAcc) break; @@ -13709,14 +13645,14 @@ namespace UnitarySystems { Real64 CoolingSpeedRatio = 1.0; bool const singleMode = false; if (CoolingSpeedNum == 1) { - state.dataCoilCooingDX->coilCoolingDXs[CoilIndex].simulate( + state.dataCoilCoolingDX->coilCoolingDXs[CoilIndex].simulate( state, HVAC::CoilMode::Normal, PartLoadFrac, CoolingSpeedNum, CoolingSpeedRatio, fanOp, singleMode); } else { - state.dataCoilCooingDX->coilCoolingDXs[CoilIndex].simulate( + state.dataCoilCoolingDX->coilCoolingDXs[CoilIndex].simulate( state, HVAC::CoilMode::Normal, CoolingSpeedRatio, CoolingSpeedNum, PartLoadFrac, fanOp, singleMode); } Real64 outletCondition = - state.dataLoopNodes->Node(state.dataCoilCooingDX->coilCoolingDXs[CoilIndex].evapOutletNodeIndex).HumRat; + state.dataLoopNodes->Node(state.dataCoilCoolingDX->coilCoolingDXs[CoilIndex].evapOutletNodeIndex).HumRat; return DesOutHumRat - outletCondition; }; @@ -14008,8 +13944,7 @@ namespace UnitarySystems { } // IF DXHeatingSystem is scheduled on and there is flow - if (ScheduleManager::GetCurrentScheduleValue(state, this->m_SysAvailSchedPtr) > 0.0 && - ScheduleManager::GetCurrentScheduleValue(state, this->m_HeatingCoilAvailSchPtr) > 0.0 && + if (this->m_sysAvailSched->getCurrentVal() > 0.0 && this->m_heatingCoilAvailSched->getCurrentVal() > 0.0 && state.dataLoopNodes->Node(InletNode).MassFlowRate > HVAC::SmallAirVolFlow) { bool SensibleLoad = false; @@ -14645,7 +14580,7 @@ namespace UnitarySystems { DesOutTemp -= this->m_FaultyCoilSATOffset; } - if ((ScheduleManager::GetCurrentScheduleValue(state, this->m_SysAvailSchedPtr) > 0.0) && (inletNode.MassFlowRate > HVAC::SmallAirVolFlow)) { + if ((this->m_sysAvailSched->getCurrentVal() > 0.0) && (inletNode.MassFlowRate > HVAC::SmallAirVolFlow)) { if (inletNode.Temp < (DesOutTemp - HVAC::TempControlTol)) { if (this->m_EMSOverrideSuppCoilSpeedNumOn) { @@ -15108,13 +15043,13 @@ namespace UnitarySystems { } bool const singleMode = (this->m_SingleMode == 1); HVAC::CoilMode coilMode = HVAC::CoilMode::Normal; - if (state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) { + if (state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) { coilMode = HVAC::CoilMode::SubcoolReheat; } else if (this->m_DehumidificationMode == HVAC::CoilMode::Enhanced) { coilMode = HVAC::CoilMode::Enhanced; } - state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate( + state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate( state, coilMode, CycRatio, this->m_CoolingSpeedNum, SpeedRatio, this->m_FanOpMode, singleMode, this->CoilSHR); } else if (CoilTypeNum == HVAC::Coil_CoolingAirToAirVariableSpeed) { @@ -15520,10 +15455,10 @@ namespace UnitarySystems { } elecCoolingPower = state.dataHVACGlobal->DXElecCoolingPower; } else { - if (state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) { + if (state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) { if (state.dataUnitarySystems->CoolingLoad && this->LoadSHR == 0.0) { this->LoadSHR = 1.0; - this->CoilSHR = state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].performance.NormalSHR; + this->CoilSHR = state.dataCoilCoolingDX->coilCoolingDXs[this->m_CoolingCoilIndex].performance.NormalSHR; } } Real64 CompPartLoadFrac = this->m_CompPartLoadRatio; @@ -15739,11 +15674,7 @@ namespace UnitarySystems { if (HeatRecMassFlowRate > 0.0) { - Real64 CpHeatRec = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->m_HRPlantLoc.loopNum).FluidName, - HeatRecInletTemp, - state.dataPlnt->PlantLoop(this->m_HRPlantLoc.loopNum).FluidIndex, - routineName); + Real64 CpHeatRec = state.dataPlnt->PlantLoop(this->m_HRPlantLoc.loopNum).glycol->getSpecificHeat(state, HeatRecInletTemp, routineName); HeatRecOutletTemp = QHeatRec / (HeatRecMassFlowRate * CpHeatRec) + HeatRecInletTemp; // coil model should be handling max outlet water temp (via limit to heat transfer) since heat rejection needs to be accounted for by the @@ -17001,7 +16932,7 @@ namespace UnitarySystems { if (state.dataUnitarySystems->unitarySys[sysNum].m_CoolingCoilIndex >= 0) { if (state.dataUnitarySystems->unitarySys[sysNum].m_CoolingCoilType_Num == HVAC::CoilDX_Cooling && - state.dataCoilCooingDX->coilCoolingDXs[state.dataUnitarySystems->unitarySys[sysNum].m_CoolingCoilIndex] + state.dataCoilCoolingDX->coilCoolingDXs[state.dataUnitarySystems->unitarySys[sysNum].m_CoolingCoilIndex] .SubcoolReheatFlag) { SetupOutputVariable(state, "Unitary System Zone Load Sensible Heat Ratio", diff --git a/src/EnergyPlus/UnitarySystem.hh b/src/EnergyPlus/UnitarySystem.hh index 1a4070299c7..7ed47a4a012 100644 --- a/src/EnergyPlus/UnitarySystem.hh +++ b/src/EnergyPlus/UnitarySystem.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -231,7 +231,7 @@ namespace UnitarySystems { int m_UnitarySysNum = -1; SysType m_sysType = SysType::Invalid; bool m_ThisSysInputShouldBeGotten = true; - int m_SysAvailSchedPtr = 0; // Pointer to the availability schedule + Sched::Schedule *m_sysAvailSched = nullptr; // availability schedule UnitarySysCtrlType m_ControlType = UnitarySysCtrlType::None; DehumCtrlType m_DehumidControlType_Num = DehumCtrlType::None; bool m_Humidistat = false; @@ -241,14 +241,14 @@ namespace UnitarySystems { bool m_setFaultModelInput = true; int m_FanIndex = 0; HVAC::FanPlace m_FanPlace = HVAC::FanPlace::Invalid; - int m_FanOpModeSchedPtr = 0; + Sched::Schedule *m_fanOpModeSched = nullptr; bool m_FanExists = false; HVAC::FanType m_FanType = HVAC::FanType::Invalid; bool m_RequestAutoSize = false; Real64 m_ActualFanVolFlowRate = 0.0; Real64 m_DesignFanVolFlowRate = 0.0; Real64 m_DesignMassFlowRate = 0.0; - int m_FanAvailSchedPtr = 0; + Sched::Schedule *m_fanAvailSched = nullptr; HVAC::FanOp m_FanOpMode = HVAC::FanOp::Invalid; int m_ATMixerIndex = 0; int m_ATMixerPriNode = 0; @@ -262,7 +262,7 @@ namespace UnitarySystems { int m_HeatingCoilType_Num = 0; bool m_DXHeatingCoil = false; int m_HeatingCoilIndex = 0; - int m_HeatingCoilAvailSchPtr = 0; + Sched::Schedule *m_heatingCoilAvailSched = nullptr; Real64 m_DesignHeatingCapacity = 0.0; Real64 m_MaxHeatAirVolFlow = 0.0; int m_NumOfSpeedHeating = 0; @@ -273,7 +273,7 @@ namespace UnitarySystems { bool m_CoolCoilExists = false; int m_CoolingCoilType_Num = 0; int m_NumOfSpeedCooling = 0; - int m_CoolingCoilAvailSchPtr = 0; + Sched::Schedule *m_coolingCoilAvailSched = nullptr; Real64 m_DesignCoolingCapacity = 0.0; Real64 m_MaxCoolAirVolFlow = 0.0; int m_CondenserNodeNum = 0; @@ -947,7 +947,7 @@ namespace UnitarySystems { int getEquipIndex() override; UnitarySys() = default; - ~UnitarySys() = default; + virtual ~UnitarySys() = default; }; int getDesignSpecMSHPIndex(EnergyPlusData &state, std::string_view objectName); @@ -1013,6 +1013,10 @@ struct UnitarySystemsData : BaseGlobalStruct bool getInputFlag = true; bool setupOutputOnce = true; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/UserDefinedComponents.cc b/src/EnergyPlus/UserDefinedComponents.cc index af8e1754914..72d5ec1ce9c 100644 --- a/src/EnergyPlus/UserDefinedComponents.cc +++ b/src/EnergyPlus/UserDefinedComponents.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -48,9 +48,6 @@ // C++ Headers #include -// ObjexxFCL Headers -#include - // EnergyPlus Headers #include #include @@ -114,7 +111,6 @@ namespace UserDefinedComponents { void UserPlantComponentStruct::onInitLoopEquip(EnergyPlusData &state, const PlantLocation &calledFromLocation) { - bool anyEMSRan; Real64 myLoad = 0.0; int thisLoop = 0; @@ -128,6 +124,7 @@ namespace UserDefinedComponents { if (thisLoop > 0) { if (this->Loop(thisLoop).ErlInitProgramMngr > 0) { + bool anyEMSRan; EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::UserDefinedComponentModel, anyEMSRan, this->Loop(thisLoop).ErlInitProgramMngr); } else if (this->Loop(thisLoop).initPluginLocation > -1) { state.dataPluginManager->pluginManager->runSingleUserDefinedPlugin(state, this->Loop(thisLoop).initPluginLocation); @@ -2433,17 +2430,11 @@ namespace UserDefinedComponents { // fill internal variable targets this->Loop(LoopNum).MyLoad = MyLoad; - this->Loop(LoopNum).InletRho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->Loop(LoopNum).plantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->Loop(LoopNum).InletNodeNum).Temp, - state.dataPlnt->PlantLoop(this->Loop(LoopNum).plantLoc.loopNum).FluidIndex, - RoutineName); + this->Loop(LoopNum).InletRho = state.dataPlnt->PlantLoop(this->Loop(LoopNum).plantLoc.loopNum) + .glycol->getDensity(state, state.dataLoopNodes->Node(this->Loop(LoopNum).InletNodeNum).Temp, RoutineName); this->Loop(LoopNum).InletCp = - FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->Loop(LoopNum).plantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->Loop(LoopNum).InletNodeNum).Temp, - state.dataPlnt->PlantLoop(this->Loop(LoopNum).plantLoc.loopNum).FluidIndex, - RoutineName); + state.dataPlnt->PlantLoop(this->Loop(LoopNum).plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->Loop(LoopNum).InletNodeNum).Temp, RoutineName); this->Loop(LoopNum).InletMassFlowRate = state.dataLoopNodes->Node(this->Loop(LoopNum).InletNodeNum).MassFlowRate; this->Loop(LoopNum).InletTemp = state.dataLoopNodes->Node(this->Loop(LoopNum).InletNodeNum).Temp; if (this->Air.InletNodeNum > 0) { @@ -2502,16 +2493,10 @@ namespace UserDefinedComponents { } if (this->PlantIsConnected) { - this->Loop.InletRho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->Loop.plantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->Loop.InletNodeNum).Temp, - state.dataPlnt->PlantLoop(this->Loop.plantLoc.loopNum).FluidIndex, - RoutineName); - this->Loop.InletCp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->Loop.plantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->Loop.InletNodeNum).Temp, - state.dataPlnt->PlantLoop(this->Loop.plantLoc.loopNum).FluidIndex, - RoutineName); + this->Loop.InletRho = state.dataPlnt->PlantLoop(this->Loop.plantLoc.loopNum) + .glycol->getDensity(state, state.dataLoopNodes->Node(this->Loop.InletNodeNum).Temp, RoutineName); + this->Loop.InletCp = state.dataPlnt->PlantLoop(this->Loop.plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->Loop.InletNodeNum).Temp, RoutineName); this->Loop.InletTemp = state.dataLoopNodes->Node(this->Loop.InletNodeNum).Temp; this->Loop.InletMassFlowRate = state.dataLoopNodes->Node(this->Loop.InletNodeNum).MassFlowRate; } @@ -2585,17 +2570,12 @@ namespace UserDefinedComponents { if (this->NumPlantConnections > 0) { for (int loop = 1; loop <= this->NumPlantConnections; ++loop) { - this->Loop(loop).InletRho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->Loop(loop).plantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->Loop(loop).InletNodeNum).Temp, - state.dataPlnt->PlantLoop(this->Loop(loop).plantLoc.loopNum).FluidIndex, - RoutineName); + this->Loop(loop).InletRho = + state.dataPlnt->PlantLoop(this->Loop(loop).plantLoc.loopNum) + .glycol->getDensity(state, state.dataLoopNodes->Node(this->Loop(loop).InletNodeNum).Temp, RoutineName); this->Loop(loop).InletCp = - FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->Loop(loop).plantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->Loop(loop).InletNodeNum).Temp, - state.dataPlnt->PlantLoop(this->Loop(loop).plantLoc.loopNum).FluidIndex, - RoutineName); + state.dataPlnt->PlantLoop(this->Loop(loop).plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->Loop(loop).InletNodeNum).Temp, RoutineName); this->Loop(loop).InletTemp = state.dataLoopNodes->Node(this->Loop(loop).InletNodeNum).Temp; this->Loop(loop).InletMassFlowRate = state.dataLoopNodes->Node(this->Loop(loop).InletNodeNum).MassFlowRate; } @@ -2667,17 +2647,12 @@ namespace UserDefinedComponents { if (this->NumPlantConnections > 0) { for (int loop = 1; loop <= this->NumPlantConnections; ++loop) { - this->Loop(loop).InletRho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->Loop(loop).plantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->Loop(loop).InletNodeNum).Temp, - state.dataPlnt->PlantLoop(this->Loop(loop).plantLoc.loopNum).FluidIndex, - RoutineName); + this->Loop(loop).InletRho = + state.dataPlnt->PlantLoop(this->Loop(loop).plantLoc.loopNum) + .glycol->getDensity(state, state.dataLoopNodes->Node(this->Loop(loop).InletNodeNum).Temp, RoutineName); this->Loop(loop).InletCp = - FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->Loop(loop).plantLoc.loopNum).FluidName, - state.dataLoopNodes->Node(this->Loop(loop).InletNodeNum).Temp, - state.dataPlnt->PlantLoop(this->Loop(loop).plantLoc.loopNum).FluidIndex, - RoutineName); + state.dataPlnt->PlantLoop(this->Loop(loop).plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->Loop(loop).InletNodeNum).Temp, RoutineName); this->Loop(loop).InletTemp = state.dataLoopNodes->Node(this->Loop(loop).InletNodeNum).Temp; this->Loop(loop).InletMassFlowRate = state.dataLoopNodes->Node(this->Loop(loop).InletNodeNum).MassFlowRate; } diff --git a/src/EnergyPlus/UserDefinedComponents.hh b/src/EnergyPlus/UserDefinedComponents.hh index db9721013ac..b265dad5668 100644 --- a/src/EnergyPlus/UserDefinedComponents.hh +++ b/src/EnergyPlus/UserDefinedComponents.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -365,6 +365,10 @@ struct UserDefinedComponentsData : BaseGlobalStruct bool lDummy_EMSActuatedPlantComp = false; bool lDummy_GetUserDefComp = false; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/UtilityRoutines.cc b/src/EnergyPlus/UtilityRoutines.cc index e68b2f8047a..8a0b7f8ff4c 100644 --- a/src/EnergyPlus/UtilityRoutines.cc +++ b/src/EnergyPlus/UtilityRoutines.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -57,7 +57,6 @@ extern "C" { // ObjexxFCL Headers #include #include -#include #include #include @@ -102,8 +101,6 @@ namespace Util { // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function processes a string that should be numeric and @@ -184,8 +181,6 @@ namespace Util { // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function looks up a string in a similar list of @@ -206,8 +201,6 @@ namespace Util { // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function looks up a string in a similar list of @@ -228,8 +221,6 @@ namespace Util { // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function looks up a string in a similar list of @@ -237,11 +228,10 @@ namespace Util { // found. This routine is case insensitive. // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - - int Probe(0); - int LBnd(0); - int UBnd(NumItems + 1); - bool Found(false); + int Probe = 0; + int LBnd = 0; + int UBnd = NumItems + 1; + bool Found = false; while ((!Found) || (Probe != 0)) { Probe = (UBnd - LBnd) / 2; if (Probe == 0) break; @@ -264,16 +254,12 @@ namespace Util { // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN April 1999 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function looks up a string in a similar list of // items and returns the index of the item in the list, if // found. This routine is case insensitive. - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int FindItem = Util::FindItemInList(String, ListOfItems, NumItems); if (FindItem != 0) return FindItem; @@ -289,8 +275,6 @@ namespace Util { // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN April 1999 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function looks up a string in a similar list of @@ -320,20 +304,15 @@ namespace Util { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN February 2000 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine verifys that a new name can be added to the // list of names for this item (i.e., that there isn't one of that // name already and that this name is not blank). - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int Found; - ErrorFound = false; if (NumOfNames > 0) { - Found = FindItem(NameToVerify, NamesList, NumOfNames); + int Found = FindItem(NameToVerify, NamesList, NumOfNames); if (Found != 0) { ShowSevereError(state, format("{}, duplicate name={}", StringToDisplay, NameToVerify)); ErrorFound = true; @@ -361,8 +340,6 @@ namespace Util { // SUBROUTINE INFORMATION: // AUTHOR Linda Lawrie // DATE WRITTEN February 2000 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine verifys that a new name can be added to the @@ -460,45 +437,20 @@ int AbortEnergyPlus(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN December 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine causes the program to halt due to a fatal error. // METHODOLOGY EMPLOYED: - // Puts a message on output files. - // Closes files. - // Stops the program. - - // Using/Aliasing - using namespace DataSystemVariables; - using namespace DataErrorTracking; - using BranchInputManager::TestBranchIntegrity; - using BranchNodeConnections::CheckNodeConnections; - using BranchNodeConnections::TestCompSetInletOutletNodes; - using ExternalInterface::CloseSocket; - - using NodeInputManager::CheckMarkedNodes; - using NodeInputManager::SetupNodeVarsForReporting; - using PlantManager::CheckPlantOnAbort; - using SimulationManager::ReportLoopConnections; - using SolarShading::ReportSurfaceErrors; - using SystemReports::ReportAirLoopConnections; - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: + // Puts a message on output files. Closes files. Stops the program. // SUBROUTINE PARAMETER DEFINITIONS: - std::string NumWarnings; std::string NumSevere; std::string NumWarningsDuringWarmup; std::string NumSevereDuringWarmup; std::string NumWarningsDuringSizing; std::string NumSevereDuringSizing; - bool ErrFound; - bool TerminalError; if (state.dataSQLiteProcedures->sqlite) { state.dataSQLiteProcedures->sqlite->updateSQLiteSimulationRecord(true, false); @@ -509,24 +461,24 @@ int AbortEnergyPlus(EnergyPlusData &state) state.dataErrTracking->AskForConnectionsReport = false; // Set false here in case any further fatal errors in below processing... ShowMessage(state, "Fatal error -- final processing. More error messages may appear."); - SetupNodeVarsForReporting(state); + NodeInputManager::SetupNodeVarsForReporting(state); - ErrFound = false; - TerminalError = false; - TestBranchIntegrity(state, ErrFound); + bool ErrFound = false; + bool TerminalError = false; + BranchInputManager::TestBranchIntegrity(state, ErrFound); if (ErrFound) TerminalError = true; TestAirPathIntegrity(state, ErrFound); if (ErrFound) TerminalError = true; - CheckMarkedNodes(state, ErrFound); + NodeInputManager::CheckMarkedNodes(state, ErrFound); if (ErrFound) TerminalError = true; - CheckNodeConnections(state, ErrFound); + BranchNodeConnections::CheckNodeConnections(state, ErrFound); if (ErrFound) TerminalError = true; - TestCompSetInletOutletNodes(state, ErrFound); + BranchNodeConnections::TestCompSetInletOutletNodes(state, ErrFound); if (ErrFound) TerminalError = true; if (!TerminalError) { - ReportAirLoopConnections(state); - ReportLoopConnections(state); + SystemReports::ReportAirLoopConnections(state); + SimulationManager::ReportLoopConnections(state); } } else if (!state.dataErrTracking->ExitDuringSimulations) { @@ -538,8 +490,8 @@ int AbortEnergyPlus(EnergyPlusData &state) ReportSurfaces(state); } - ReportSurfaceErrors(state); - CheckPlantOnAbort(state); + SolarShading::ReportSurfaceErrors(state); + PlantManager::CheckPlantOnAbort(state); ShowRecurringErrors(state); SummarizeErrors(state); CloseMiscOpenFiles(state); @@ -585,7 +537,7 @@ int AbortEnergyPlus(EnergyPlusData &state) << "EnergyPlus Terminated--Error(s) Detected." << std::endl; // Close the socket used by ExternalInterface. This call also sends the flag "-1" to the ExternalInterface, // indicating that E+ terminated with an error. - if (state.dataExternalInterface->NumExternalInterfaces > 0) CloseSocket(state, -1); + if (state.dataExternalInterface->NumExternalInterfaces > 0) ExternalInterface::CloseSocket(state, -1); if (state.dataGlobal->eplusRunningViaAPI) { state.files.flushAll(); @@ -604,8 +556,6 @@ void CloseMiscOpenFiles(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN December 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine scans potential unit numbers and closes @@ -614,12 +564,8 @@ void CloseMiscOpenFiles(EnergyPlusData &state) // METHODOLOGY EMPLOYED: // Use INQUIRE to determine if file is open. - // Using/Aliasing - using Dayltg::CloseDFSFile; - using Dayltg::CloseReportIllumMaps; - - CloseReportIllumMaps(state); - CloseDFSFile(state); + Dayltg::CloseReportIllumMaps(state); + Dayltg::CloseDFSFile(state); if (state.dataReportFlag->DebugOutput || (state.files.debug.good() && state.files.debug.position() > 0)) { state.files.debug.close(); @@ -634,22 +580,12 @@ int EndEnergyPlus(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN December 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine causes the program to terminate when complete (no errors). // METHODOLOGY EMPLOYED: - // Puts a message on output files. - // Closes files. - // Stops the program. - - using namespace DataSystemVariables; - using namespace DataErrorTracking; - using ExternalInterface::CloseSocket; - - using SolarShading::ReportSurfaceErrors; + // Puts a message on output files. Closes files. Stops the program. std::string NumWarnings; std::string NumSevere; @@ -662,7 +598,7 @@ int EndEnergyPlus(EnergyPlusData &state) state.dataSQLiteProcedures->sqlite->updateSQLiteSimulationRecord(true, true); } - ReportSurfaceErrors(state); + SolarShading::ReportSurfaceErrors(state); ShowRecurringErrors(state); SummarizeErrors(state); CloseMiscOpenFiles(state); @@ -716,7 +652,8 @@ int EndEnergyPlus(EnergyPlusData &state) if (state.dataGlobal->printConsoleOutput) std::cerr << "EnergyPlus Completed Successfully." << std::endl; // Close the ExternalInterface socket. This call also sends the flag "1" to the ExternalInterface, // indicating that E+ finished its simulation - if ((state.dataExternalInterface->NumExternalInterfaces > 0) && state.dataExternalInterface->haveExternalInterfaceBCVTB) CloseSocket(state, 1); + if ((state.dataExternalInterface->NumExternalInterfaces > 0) && state.dataExternalInterface->haveExternalInterfaceBCVTB) + ExternalInterface::CloseSocket(state, 1); if (state.dataGlobal->fProgressPtr) { state.dataGlobal->fProgressPtr(100); @@ -744,8 +681,6 @@ void ConvertCaseToUpper(std::string_view InputString, // Input string // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Convert a string to upper case @@ -778,8 +713,6 @@ void ConvertCaseToLower(std::string_view InputString, // Input string // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Convert a string to lower case @@ -810,8 +743,6 @@ std::string::size_type FindNonSpace(std::string const &String) // String to be s // FUNCTION INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function finds the first non-space character in the passed string @@ -820,28 +751,6 @@ std::string::size_type FindNonSpace(std::string const &String) // String to be s // METHODOLOGY EMPLOYED: // Scan string for character not equal to blank. - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Return value - - // Locals - // FUNCTION ARGUMENT DEFINITIONS: - - // FUNCTION PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // FUNCTION LOCAL VARIABLE DECLARATIONS: - return String.find_first_not_of(' '); } @@ -851,8 +760,6 @@ bool env_var_on(std::string const &env_var_str) // FUNCTION INFORMATION: // AUTHOR Stuart G. Mentzer // DATE WRITTEN April 2014 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // Test if a boolean environment variable value is "on" (has value starting with Y or T) @@ -920,10 +827,7 @@ void ShowFatalError(EnergyPlusData &state, std::string const &ErrorMessage, Opti // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 - // MODIFIED Kyle Benne - // August 2010 - // Added sqlite output - // RE-ENGINEERED na + // MODIFIED Kyle Benne August 2010 Added sqlite output // PURPOSE OF THIS SUBROUTINE: // This subroutine puts ErrorMessage with a Fatal designation on @@ -957,8 +861,6 @@ void ShowSevereError(EnergyPlusData &state, std::string const &ErrorMessage, Opt // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine puts ErrorMessage with a Severe designation on @@ -967,12 +869,8 @@ void ShowSevereError(EnergyPlusData &state, std::string const &ErrorMessage, Opt // METHODOLOGY EMPLOYED: // Calls ShowErrorMessage utility routine. - using namespace DataStringGlobals; - using namespace DataErrorTracking; - int Loop; - - for (Loop = 1; Loop <= SearchCounts; ++Loop) { - if (has(ErrorMessage, MessageSearch[Loop])) ++state.dataErrTracking->MatchCounts(Loop); + for (int Loop = 1; Loop <= DataErrorTracking::SearchCounts; ++Loop) { + if (has(ErrorMessage, DataErrorTracking::MessageSearch[Loop])) ++state.dataErrTracking->MatchCounts(Loop); } ++state.dataErrTracking->TotalSevereErrors; @@ -999,25 +897,16 @@ void ShowSevereMessage(EnergyPlusData &state, std::string const &ErrorMessage, O // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN September 2009 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // This subroutine puts ErrorMessage with a Severe designation on - // designated output files. - // But does not bump the error count so can be used in conjunction with recurring - // error calls. + // This subroutine puts ErrorMessage with a Severe designation on designated output files. + // But does not bump the error count so can be used in conjunction with recurring error calls. // METHODOLOGY EMPLOYED: // Calls ShowErrorMessage utility routine. - using namespace DataStringGlobals; - using namespace DataErrorTracking; - - int Loop; - - for (Loop = 1; Loop <= SearchCounts; ++Loop) { - if (has(ErrorMessage, MessageSearch[Loop])) ++state.dataErrTracking->MatchCounts(Loop); + for (int Loop = 1; Loop <= DataErrorTracking::SearchCounts; ++Loop) { + if (has(ErrorMessage, DataErrorTracking::MessageSearch[Loop])) ++state.dataErrTracking->MatchCounts(Loop); } ShowErrorMessage(state, format(" ** Severe ** {}", ErrorMessage), OutUnit1, OutUnit2); @@ -1039,8 +928,6 @@ void ShowContinueError(EnergyPlusData &state, std::string const &Message, Option // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN October 2001 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine displays a 'continued error' message on designated output files. @@ -1063,8 +950,6 @@ void ShowContinueErrorTimeStamp(EnergyPlusData &state, std::string const &Messag // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN February 2004 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine displays a 'continued error' timestamp message on designated output files. @@ -1072,9 +957,6 @@ void ShowContinueErrorTimeStamp(EnergyPlusData &state, std::string const &Messag // METHODOLOGY EMPLOYED: // Calls ShowErrorMessage utility routine. - // Using/Aliasing - using General::CreateSysTimeIntervalString; - std::string cEnvHeader; if (state.dataGlobal->WarmupFlag) { @@ -1097,7 +979,7 @@ void ShowContinueErrorTimeStamp(EnergyPlusData &state, std::string const &Messag cEnvHeader, state.dataEnvrn->EnvironmentName, state.dataEnvrn->CurMnDy, - CreateSysTimeIntervalString(state)); + General::CreateSysTimeIntervalString(state)); ShowErrorMessage(state, format(" ** ~~~ ** {}", m), OutUnit1, OutUnit2); if (state.dataSQLiteProcedures->sqlite) { @@ -1111,7 +993,7 @@ void ShowContinueErrorTimeStamp(EnergyPlusData &state, std::string const &Messag cEnvHeader, state.dataEnvrn->EnvironmentName, state.dataEnvrn->CurMnDy, - CreateSysTimeIntervalString(state)); + General::CreateSysTimeIntervalString(state)); ShowErrorMessage(state, format(" ** ~~~ ** {}", Message)); ShowErrorMessage(state, format(" ** ~~~ ** {}", postfix), OutUnit1, OutUnit2); if (state.dataSQLiteProcedures->sqlite) { @@ -1130,8 +1012,6 @@ void ShowMessage(EnergyPlusData &state, std::string const &Message, OptionalOutp // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine displays a simple message on designated output files. @@ -1158,8 +1038,6 @@ void ShowWarningError(EnergyPlusData &state, std::string const &ErrorMessage, Op // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN September 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine puts ErrorMessage with a Warning designation on @@ -1168,12 +1046,8 @@ void ShowWarningError(EnergyPlusData &state, std::string const &ErrorMessage, Op // METHODOLOGY EMPLOYED: // Calls ShowErrorMessage utility routine. - using namespace DataStringGlobals; - using namespace DataErrorTracking; - int Loop; - - for (Loop = 1; Loop <= SearchCounts; ++Loop) { - if (has(ErrorMessage, MessageSearch[Loop])) ++state.dataErrTracking->MatchCounts(Loop); + for (int Loop = 1; Loop <= DataErrorTracking::SearchCounts; ++Loop) { + if (has(ErrorMessage, DataErrorTracking::MessageSearch[Loop])) ++state.dataErrTracking->MatchCounts(Loop); } ++state.dataErrTracking->TotalWarningErrors; @@ -1207,12 +1081,8 @@ void ShowWarningMessage(EnergyPlusData &state, std::string const &ErrorMessage, // METHODOLOGY EMPLOYED: // Calls ShowErrorMessage utility routine. - // Using/Aliasing - using namespace DataStringGlobals; - using namespace DataErrorTracking; - - for (int Loop = 1; Loop <= SearchCounts; ++Loop) { - if (has(ErrorMessage, MessageSearch[Loop])) ++state.dataErrTracking->MatchCounts(Loop); + for (int Loop = 1; Loop <= DataErrorTracking::SearchCounts; ++Loop) { + if (has(ErrorMessage, DataErrorTracking::MessageSearch[Loop])) ++state.dataErrTracking->MatchCounts(Loop); } ShowErrorMessage(state, format(" ** Warning ** {}", ErrorMessage), OutUnit1, OutUnit2); @@ -1248,16 +1118,12 @@ void ShowRecurringSevereErrorAtEnd(EnergyPlusData &state, // METHODOLOGY EMPLOYED: // Calls StoreRecurringErrorMessage utility routine. - // Using/Aliasing - using namespace DataStringGlobals; - using namespace DataErrorTracking; - // INTERFACE BLOCK SPECIFICATIONS // Use for recurring "severe" error messages shown once at end of simulation // with count of occurrences and optional max, min, sum - for (int Loop = 1; Loop <= SearchCounts; ++Loop) { - if (has(Message, MessageSearch[Loop])) { + for (int Loop = 1; Loop <= DataErrorTracking::SearchCounts; ++Loop) { + if (has(Message, DataErrorTracking::MessageSearch[Loop])) { ++state.dataErrTracking->MatchCounts(Loop); break; } @@ -1299,16 +1165,12 @@ void ShowRecurringSevereErrorAtEnd(EnergyPlusData &state, // METHODOLOGY EMPLOYED: // Calls StoreRecurringErrorMessage utility routine. - // Using/Aliasing - using namespace DataStringGlobals; - using namespace DataErrorTracking; - // INTERFACE BLOCK SPECIFICATIONS // Use for recurring "severe" error messages shown once at end of simulation // with count of occurrences and optional max, min, sum - for (int Loop = 1; Loop <= SearchCounts; ++Loop) { - if (has(Message, MessageSearch[Loop])) { + for (int Loop = 1; Loop <= DataErrorTracking::SearchCounts; ++Loop) { + if (has(Message, DataErrorTracking::MessageSearch[Loop])) { ++state.dataErrTracking->MatchCounts(Loop); break; } @@ -1353,16 +1215,12 @@ void ShowRecurringWarningErrorAtEnd(EnergyPlusData &state, // METHODOLOGY EMPLOYED: // Calls StoreRecurringErrorMessage utility routine. - // Using/Aliasing - using namespace DataStringGlobals; - using namespace DataErrorTracking; - // INTERFACE BLOCK SPECIFICATIONS // Use for recurring "warning" error messages shown once at end of simulation // with count of occurrences and optional max, min, sum - for (int Loop = 1; Loop <= SearchCounts; ++Loop) { - if (has(Message, MessageSearch[Loop])) { + for (int Loop = 1; Loop <= DataErrorTracking::SearchCounts; ++Loop) { + if (has(Message, DataErrorTracking::MessageSearch[Loop])) { ++state.dataErrTracking->MatchCounts(Loop); break; } @@ -1404,16 +1262,12 @@ void ShowRecurringWarningErrorAtEnd(EnergyPlusData &state, // METHODOLOGY EMPLOYED: // Calls StoreRecurringErrorMessage utility routine. - // Using/Aliasing - using namespace DataStringGlobals; - using namespace DataErrorTracking; - // INTERFACE BLOCK SPECIFICATIONS // Use for recurring "warning" error messages shown once at end of simulation // with count of occurrences and optional max, min, sum - for (int Loop = 1; Loop <= SearchCounts; ++Loop) { - if (has(Message, MessageSearch[Loop])) { + for (int Loop = 1; Loop <= DataErrorTracking::SearchCounts; ++Loop) { + if (has(Message, DataErrorTracking::MessageSearch[Loop])) { ++state.dataErrTracking->MatchCounts(Loop); break; } @@ -1458,16 +1312,12 @@ void ShowRecurringContinueErrorAtEnd(EnergyPlusData &state, // METHODOLOGY EMPLOYED: // Calls StoreRecurringErrorMessage utility routine. - // Using/Aliasing - using namespace DataStringGlobals; - using namespace DataErrorTracking; - // INTERFACE BLOCK SPECIFICATIONS // Use for recurring "continue" error messages shown once at end of simulation // with count of occurrences and optional max, min, sum - for (int Loop = 1; Loop <= SearchCounts; ++Loop) { - if (has(Message, MessageSearch[Loop])) { + for (int Loop = 1; Loop <= DataErrorTracking::SearchCounts; ++Loop) { + if (has(Message, DataErrorTracking::MessageSearch[Loop])) { ++state.dataErrTracking->MatchCounts(Loop); break; } @@ -1510,9 +1360,6 @@ void StoreRecurringErrorMessage(EnergyPlusData &state, // for output at the end of the simulation with automatic tracking of number // of occurrences and optional tracking of associated min, max, and sum values - // Using/Aliasing - using namespace DataStringGlobals; - using namespace DataErrorTracking; // If Index is zero, then assign next available index and reallocate array if (ErrorMsgIndex == 0) { state.dataErrTracking->RecurringErrors.redimension(++state.dataErrTracking->NumRecurringErrors); @@ -1577,13 +1424,10 @@ void ShowErrorMessage(EnergyPlusData &state, std::string const &ErrorMessage, Op // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN December 1997 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine displays the error messages on the indicated - // file unit numbers, in addition to the "standard error output" - // unit. + // file unit numbers, in addition to the "standard error output" unit. // METHODOLOGY EMPLOYED: // If arguments OutUnit1 and/or OutUnit2 are present the @@ -1620,15 +1464,11 @@ void SummarizeErrors(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN March 2003 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine provides a summary of certain errors that might // otherwise get lost in the shuffle of many similar messages. - using namespace DataErrorTracking; - std::string::size_type StartC; std::string::size_type EndC; @@ -1636,10 +1476,10 @@ void SummarizeErrors(EnergyPlusData &state) ShowMessage(state, ""); ShowMessage(state, "===== Final Error Summary ====="); ShowMessage(state, "The following error categories occurred. Consider correcting or noting."); - for (int Loop = 1; Loop <= SearchCounts; ++Loop) { + for (int Loop = 1; Loop <= DataErrorTracking::SearchCounts; ++Loop) { if (state.dataErrTracking->MatchCounts(Loop) > 0) { - ShowMessage(state, Summaries[Loop]); - std::string thisMoreDetails = MoreDetails[Loop]; + ShowMessage(state, DataErrorTracking::Summaries[Loop]); + std::string thisMoreDetails = DataErrorTracking::MoreDetails[Loop]; if (!thisMoreDetails.empty()) { StartC = 0; EndC = len(thisMoreDetails) - 1; @@ -1663,29 +1503,18 @@ void ShowRecurringErrors(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN March 2003 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine provides a summary of certain errors that might // otherwise get lost in the shuffle of many similar messages. - // Using/Aliasing - using namespace DataErrorTracking; - static constexpr std::string_view StatMessageStart(" ** ~~~ ** "); - int Loop; - std::string StatMessage; - std::string MaxOut; - std::string MinOut; - std::string SumOut; - if (state.dataErrTracking->NumRecurringErrors > 0) { ShowMessage(state, ""); ShowMessage(state, "===== Recurring Error Summary ====="); ShowMessage(state, "The following recurring error messages occurred."); - for (Loop = 1; Loop <= state.dataErrTracking->NumRecurringErrors; ++Loop) { + for (int Loop = 1; Loop <= state.dataErrTracking->NumRecurringErrors; ++Loop) { auto const &error = state.dataErrTracking->RecurringErrors(Loop); // Suppress reporting the count if it is a continue error if (has_prefix(error.Message, " ** ~~~ ** ")) { @@ -1721,19 +1550,19 @@ void ShowRecurringErrors(EnergyPlusData &state) state.dataGlobal->errorCallback(Error::Continue, ""); } } - StatMessage = ""; + std::string StatMessage = ""; if (error.ReportMax) { - MaxOut = format("{:.6f}", error.MaxValue); + std::string MaxOut = format("{:.6f}", error.MaxValue); StatMessage += " Max=" + MaxOut; if (!error.MaxUnits.empty()) StatMessage += ' ' + error.MaxUnits; } if (error.ReportMin) { - MinOut = format("{:.6f}", error.MinValue); + std::string MinOut = format("{:.6f}", error.MinValue); StatMessage += " Min=" + MinOut; if (!error.MinUnits.empty()) StatMessage += ' ' + error.MinUnits; } if (error.ReportSum) { - SumOut = format("{:.6f}", error.SumValue); + std::string SumOut = format("{:.6f}", error.SumValue); StatMessage += " Sum=" + SumOut; if (!error.SumUnits.empty()) StatMessage += ' ' + error.SumUnits; } @@ -1764,6 +1593,19 @@ void ShowSevereItemNotFound(EnergyPlusData &state, ErrorObjectHeader const &eoh, ShowContinueError(state, format("{} = {}, item not found.", fieldName, fieldVal)); } +void ShowSevereItemNotFoundAudit(EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view fieldName, std::string_view fieldVal) +{ + ShowSevereError(state, format("{}: {} = {}", eoh.routineName, eoh.objectType, eoh.objectName), OptionalOutputFileRef{state.files.audit}); + ShowContinueError(state, format("{} = {}, item not found.", fieldName, fieldVal), OptionalOutputFileRef{state.files.audit}); +} + +void ShowSevereDuplicateAssignment( + EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view fieldName, std::string_view fieldVal, std::string_view prevVal) +{ + ShowSevereError(state, format("{}: {} = {}", eoh.routineName, eoh.objectType, eoh.objectName)); + ShowContinueError(state, format("{} = {}, field previously assigned to {}.", fieldName, fieldVal, prevVal)); +} + void ShowSevereInvalidKey( EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view fieldName, std::string_view fieldVal, std::string_view msg) { @@ -1778,24 +1620,92 @@ void ShowSevereInvalidBool(EnergyPlusData &state, ErrorObjectHeader const &eoh, ShowContinueError(state, format("{} = {}, invalid boolean (\"Yes\"/\"No\").", fieldName, fieldVal)); } -void ShowSevereCustomMessage(EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view msg) +void ShowSevereCustom(EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view msg) { ShowSevereError(state, format("{}: {} = {}", eoh.routineName, eoh.objectType, eoh.objectName)); ShowContinueError(state, format("{}", msg)); } +void ShowSevereCustomAudit(EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view msg) +{ + ShowSevereError(state, format("{}: {} = {}", eoh.routineName, eoh.objectType, eoh.objectName), OptionalOutputFileRef{state.files.audit}); + ShowContinueError(state, format("{}", msg), OptionalOutputFileRef{state.files.audit}); +} + +void ShowSevereCustomField( + EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view fieldName, std::string_view fieldValue, std::string_view msg) +{ + ShowSevereError(state, format("{}: {} = {}", eoh.routineName, eoh.objectType, eoh.objectName)); + ShowContinueError(state, format("{} = {}, {}", fieldName, fieldValue, msg)); +} + +void ShowSevereBadMin(EnergyPlusData &state, + ErrorObjectHeader const &eoh, + std::string_view fieldName, + Real64 fieldVal, + Clusive cluMin, + Real64 minVal, + std::string_view msg) +{ + ShowSevereError(state, format("{}: {} = {}", eoh.routineName, eoh.objectType, eoh.objectName)); + ShowContinueError(state, format("{} = {}, but must be {} {}", fieldName, fieldVal, cluMin == Clusive::In ? ">=" : ">", minVal)); + if (!msg.empty()) ShowContinueError(state, format("{}", msg)); +} + +void ShowSevereBadMax(EnergyPlusData &state, + ErrorObjectHeader const &eoh, + std::string_view fieldName, + Real64 fieldVal, + Clusive cluMax, + Real64 maxVal, + std::string_view msg) +{ + ShowSevereError(state, format("{}: {} = {}", eoh.routineName, eoh.objectType, eoh.objectName)); + ShowContinueError(state, format("{} = {}, but must be {} {}", fieldName, fieldVal, cluMax == Clusive::In ? "<=" : "<", maxVal)); + if (!msg.empty()) ShowContinueError(state, format("{}", msg)); +} + +void ShowSevereBadMinMax(EnergyPlusData &state, + ErrorObjectHeader const &eoh, + std::string_view fieldName, + Real64 fieldVal, + Clusive cluMin, + Real64 minVal, + Clusive cluMax, + Real64 maxVal, + std::string_view msg) +{ + ShowSevereError(state, format("{}: {} = {}", eoh.routineName, eoh.objectType, eoh.objectName)); + ShowContinueError(state, + format("{} = {}, but must be {} {} and {} {}", + fieldName, + fieldVal, + cluMin == Clusive::In ? ">=" : ">", + minVal, + cluMax == Clusive::In ? "<=" : "<", + maxVal)); + if (!msg.empty()) ShowContinueError(state, format("{}", msg)); +} + void ShowWarningItemNotFound(EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view fieldName, std::string_view fieldVal) { ShowWarningError(state, format("{}: {} = {}", eoh.routineName, eoh.objectType, eoh.objectName)); ShowContinueError(state, format("{} = {}, item not found", fieldName, fieldVal)); } -void ShowWarningCustomMessage(EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view msg) +void ShowWarningCustom(EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view msg) { ShowWarningError(state, format("{}: {} = {}", eoh.routineName, eoh.objectType, eoh.objectName)); ShowContinueError(state, format("{}", msg)); } +void ShowWarningCustomField( + EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view fieldName, std::string_view fieldValue, std::string_view msg) +{ + ShowWarningError(state, format("{}: {} = {}", eoh.routineName, eoh.objectType, eoh.objectName)); + ShowContinueError(state, format("{} = {}, {}", fieldName, fieldValue, msg)); +} + void ShowWarningInvalidKey(EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view fieldName, @@ -1822,19 +1732,79 @@ void ShowWarningEmptyField(EnergyPlusData &state, std::string_view depFieldName, std::string_view depFieldVal) { - ShowSevereError(state, format("{}: {} = {}", eoh.routineName, eoh.objectType, eoh.objectName)); - ShowContinueError(state, - format("{} cannot be empty{}, {} will be used.", - fieldName, - depFieldName.empty() ? "" : format(" when {} = {}", depFieldName, depFieldVal), - defaultVal)); + ShowWarningError(state, format("{}: {} = {}", eoh.routineName, eoh.objectType, eoh.objectName)); + ShowContinueError(state, format("{} is empty.", fieldName)); + + if (!depFieldName.empty()) ShowContinueError(state, format("Cannot be empty when {} = {}", depFieldName, depFieldVal)); + if (!defaultVal.empty()) ShowContinueError(state, format("{} will be used.", defaultVal)); +} + +void ShowWarningNonEmptyField( + EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view fieldName, std::string_view depFieldName, std::string_view depFieldValue) +{ + ShowWarningError(state, format("{}: {} = {}", eoh.routineName, eoh.objectType, eoh.objectName)); + ShowContinueError(state, format("{} is not empty.", fieldName)); + if (!depFieldName.empty()) ShowContinueError(state, format("{} is ignored when {} = {}.", fieldName, depFieldName, depFieldValue)); } void ShowWarningItemNotFound( EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view fieldName, std::string_view fieldVal, std::string_view defaultVal) { - ShowSevereError(state, format("{}: {} = {}", eoh.routineName, eoh.objectType, eoh.objectName)); - ShowContinueError(state, format("{} = {}, item not found, {} will be used.", fieldName, fieldVal, defaultVal)); + ShowWarningError(state, format("{}: {} = {}", eoh.routineName, eoh.objectType, eoh.objectName)); + if (defaultVal.empty()) { + ShowContinueError(state, format("{} = {}, item not found.", fieldName, fieldVal)); + } else { + ShowContinueError(state, format("{} = {}, item not found, {} will be used.", fieldName, fieldVal, defaultVal)); + } +} + +void ShowWarningBadMin(EnergyPlusData &state, + ErrorObjectHeader const &eoh, + std::string_view fieldName, + Real64 fieldVal, + Clusive cluMin, + Real64 minVal, + std::string_view msg) +{ + ShowWarningError(state, format("{}: {} = {}", eoh.routineName, eoh.objectType, eoh.objectName)); + ShowContinueError(state, format("{} = {}, but must be {} {}", fieldName, fieldVal, cluMin == Clusive::In ? ">=" : ">", minVal)); + if (!msg.empty()) ShowContinueError(state, format("{}", msg)); +} + +void ShowWarningBadMax(EnergyPlusData &state, + ErrorObjectHeader const &eoh, + std::string_view fieldName, + Real64 fieldVal, + Clusive cluMax, + Real64 maxVal, + std::string_view msg) +{ + ShowWarningError(state, format("{}: {} = {}", eoh.routineName, eoh.objectType, eoh.objectName)); + ShowContinueError(state, format("{} = {}, but must be {} {}", fieldName, fieldVal, cluMax == Clusive::In ? "<=" : "<", maxVal)); + ShowContinueError(state, format("{} = {}, but must be {} {}", fieldName, fieldVal, cluMax == Clusive::In ? "<=" : "<", maxVal)); + if (!msg.empty()) ShowContinueError(state, format("{}", msg)); +} + +void ShowWarningBadMinMax(EnergyPlusData &state, + ErrorObjectHeader const &eoh, + std::string_view fieldName, + Real64 fieldVal, + Clusive cluMin, + Real64 minVal, + Clusive cluMax, + Real64 maxVal, + std::string_view msg) +{ + ShowWarningError(state, format("{}: {} = {}", eoh.routineName, eoh.objectType, eoh.objectName)); + ShowContinueError(state, + format("{} = {}, but must be {} {} and {} {}", + fieldName, + fieldVal, + cluMin == Clusive::In ? ">=" : ">", + minVal, + cluMax == Clusive::In ? "<=" : "<", + maxVal)); + if (!msg.empty()) ShowContinueError(state, format("{}", msg)); } } // namespace EnergyPlus diff --git a/src/EnergyPlus/UtilityRoutines.hh b/src/EnergyPlus/UtilityRoutines.hh index 564417c5cfe..21b5fb9b28e 100644 --- a/src/EnergyPlus/UtilityRoutines.hh +++ b/src/EnergyPlus/UtilityRoutines.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -286,20 +286,69 @@ void ShowSevereEmptyField(EnergyPlusData &state, std::string_view depFieldName = {}, std::string_view depFieldValue = {}); void ShowSevereItemNotFound(EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view fieldName, std::string_view fieldValue); +void ShowSevereItemNotFoundAudit(EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view fieldName, std::string_view fieldValue); + +void ShowSevereDuplicateAssignment( + EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view fieldName, std::string_view fieldValue, std::string_view prevValue); + void ShowSevereInvalidKey( EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view fieldName, std::string_view fieldValue, std::string_view msg = {}); void ShowSevereInvalidBool(EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view fieldName, std::string_view fieldValue); -void ShowSevereCustomMessage(EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view msg); +void ShowSevereCustom(EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view msg); +void ShowSevereCustomField( + EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view fieldName, std::string_view fieldValue, std::string_view msg); + +void ShowSevereCustomAudit(EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view msg); + +enum class Clusive +{ + Invalid = -1, + In, + Ex, + Num +}; + +void ShowSevereBadMin(EnergyPlusData &state, + ErrorObjectHeader const &eoh, + std::string_view fieldName, + Real64 fieldVal, + Clusive cluMin, + Real64 minVal, + std::string_view msg = {}); +void ShowSevereBadMax(EnergyPlusData &state, + ErrorObjectHeader const &eoh, + std::string_view fieldName, + Real64 fieldVal, + Clusive cluMin, + Real64 maxVal, + std::string_view msg = {}); +void ShowSevereBadMinMax(EnergyPlusData &state, + ErrorObjectHeader const &eoh, + std::string_view fieldName, + Real64 fieldVal, + Clusive cluMin, + Real64 minVal, + Clusive cluMax, + Real64 maxVal, + std::string_view msg = {}); + void ShowWarningDuplicateName(EnergyPlusData &state, ErrorObjectHeader const &eoh); void ShowWarningEmptyField(EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view fieldName, - std::string_view defaultValue, + std::string_view defaultValue = {}, std::string_view depFieldName = {}, std::string_view depFieldValue = {}); + +void ShowWarningNonEmptyField(EnergyPlusData &state, + ErrorObjectHeader const &eoh, + std::string_view fieldName, + std::string_view depFieldName = {}, + std::string_view depFieldValue = {}); + void ShowWarningItemNotFound( - EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view fieldName, std::string_view fieldValue, std::string_view defaultValue); + EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view fieldName, std::string_view fieldValue, std::string_view defaultValue = {}); void ShowWarningInvalidKey(EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view fieldName, @@ -308,7 +357,9 @@ void ShowWarningInvalidKey(EnergyPlusData &state, std::string_view msg = {}); void ShowWarningInvalidBool( EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view fieldName, std::string_view fieldValue, std::string_view defaultValue); -void ShowWarningCustomMessage(EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view msg); +void ShowWarningCustom(EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view msg); +void ShowWarningCustomField( + EnergyPlusData &state, ErrorObjectHeader const &eoh, std::string_view fieldName, std::string_view fieldValue, std::string_view msg); namespace Util { @@ -334,6 +385,18 @@ namespace Util { return Util::FindItemInList(String, ListOfItems, ListOfItems.isize()); } + inline int FindIntInList(Array1_int &list, int item) + { + auto it = std::find(list.begin(), list.end(), item); + return (it == list.end()) ? -1 : (it - list.begin()); + } + + inline int FindIntInList(std::vector &list, int item) + { + auto it = std::find(list.begin(), list.end(), item); + return (it == list.end()) ? -1 : (it - list.begin()); + } + int FindItemInList(std::string_view const String, Array1S_string const ListOfItems, int NumItems); template int FindItemInList(std::string_view const str, InputIterator first, InputIterator last) @@ -728,6 +791,7 @@ constexpr int getEnumValue(const gsl::span sList, const return -1; } +constexpr std::array yesNoNames = {"No", "Yes"}; constexpr std::array yesNoNamesUC = {"NO", "YES"}; constexpr BooleanSwitch getYesNoValue(const std::string_view s) @@ -748,6 +812,10 @@ struct UtilityRoutinesData : BaseGlobalStruct std::string appendPerfLog_valuesRow; bool GetMatrixInputFlag = true; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/VariableSpeedCoils.cc b/src/EnergyPlus/VariableSpeedCoils.cc index 324a94c8872..b5871da627d 100644 --- a/src/EnergyPlus/VariableSpeedCoils.cc +++ b/src/EnergyPlus/VariableSpeedCoils.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -85,14 +85,6 @@ namespace EnergyPlus { namespace VariableSpeedCoils { - // Using/Aliasing - using namespace DataLoopNode; - using namespace Psychrometrics; - using namespace DataSizing; - - using DXCoils::AdjustCBF; - using DXCoils::CalcCBF; - Real64 constexpr RatedInletAirTemp = 26.6667; // 26.6667C or 80F Real64 constexpr RatedInletWetBulbTemp = 19.4444; // 19.44 or 67F, cooling mode Real64 constexpr RatedInletAirHumRat = 0.0111847; // Humidity ratio corresponding to 80F dry bulb/67F wet bulb @@ -133,14 +125,10 @@ namespace VariableSpeedCoils { // AUTHOR Bo Shen, ORNL // DATE WRITTEN March 2012 // MODIFIED Bo Shen, 12/2014, add variable-speed HPWH - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine manages variable-speed Water to Air Heat Pump component simulation. - // Using/Aliasing - using General::SolveRoot; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int DXCoilNum; // The WatertoAirHP that you are currently loading input into int SpeedCal; // variable for error proof speed input @@ -217,7 +205,6 @@ namespace VariableSpeedCoils { // AUTHOR Bo Shen // DATE WRITTEN March, 2012 // MODIFIED Bo Shen, 12/2014, add variable-speed HPWH - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Obtains input data for HPs and stores it in HP data structures @@ -225,36 +212,16 @@ namespace VariableSpeedCoils { // METHODOLOGY EMPLOYED: // Uses "Get" routines to read in data. - // Using/Aliasing - using namespace NodeInputManager; - using BranchNodeConnections::TestCompSet; - using GlobalNames::VerifyUniqueCoilName; - using namespace OutputReportPredefined; - using Curve::CurveValue; - using Curve::GetCurveIndex; - - using OutAirNodeManager::CheckOutAirNodeNumber; - using ScheduleManager::GetScheduleIndex; - using WaterManager::SetupTankDemandComponent; - using WaterManager::SetupTankSupplyComponent; - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetVarSpeedCoilInput: "); // include trailing blank space + static constexpr std::string_view routineName = "GetVarSpeedCoilInput"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int DXCoilNum; // The Water to Air HP that you are currently loading input into - int NumCool; // Counter for cooling coil, water source - int NumCoolAS; // Counter for cooling coil, air source - int NumHeat; // Counter for heating coil, water source - int NumHeatAS; // Counter for heating coil, air source - int NumHPWHAirToWater; // counter for air source HPWH - int CoilCounter; // Counter - int I; // Loop index increment - int NumAlphas; // Number of variables in String format - int NumNums; // Number of variables in Numeric format - int NumParams; // Total number of input fields - int MaxNums(0); // Maximum number of numeric input fields - int MaxAlphas(0); // Maximum number of alpha input fields + int NumAlphas; // Number of variables in String format + int NumNums; // Number of variables in Numeric format + int NumParams; // Total number of input fields + int MaxNums(0); // Maximum number of numeric input fields + int MaxAlphas(0); // Maximum number of alpha input fields int IOStat; int AlfaFieldIncre; // increment number of Alfa field bool ErrorsFound(false); // If errors detected in input @@ -269,14 +236,16 @@ namespace VariableSpeedCoils { Array1D_bool lAlphaBlanks; // Logical array, alpha field input BLANK = .TRUE. Array1D_bool lNumericBlanks; // Logical array, numeric field input BLANK = .TRUE. - NumCool = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "COIL:COOLING:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT"); - NumHeat = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "COIL:HEATING:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT"); - NumCoolAS = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "COIL:COOLING:DX:VARIABLESPEED"); - NumHeatAS = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "COIL:HEATING:DX:VARIABLESPEED"); - NumHPWHAirToWater = + int NumCool = + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "COIL:COOLING:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT"); + int NumHeat = + state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "COIL:HEATING:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT"); + int NumCoolAS = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "COIL:COOLING:DX:VARIABLESPEED"); + int NumHeatAS = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "COIL:HEATING:DX:VARIABLESPEED"); + int NumHPWHAirToWater = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "COIL:WATERHEATING:AIRTOWATERHEATPUMP:VARIABLESPEED"); state.dataVariableSpeedCoils->NumVarSpeedCoils = NumCool + NumHeat + NumCoolAS + NumHeatAS + NumHPWHAirToWater; - DXCoilNum = 0; + int DXCoilNum = 0; if (state.dataVariableSpeedCoils->NumVarSpeedCoils <= 0) { ShowSevereError(state, "No Equipment found in GetVarSpeedCoilInput"); @@ -321,7 +290,7 @@ namespace VariableSpeedCoils { // Get the data for cooling coil, WATER SOURCE CurrentModuleObject = "Coil:Cooling:WaterToAirHeatPump:VariableSpeedEquationFit"; // for reporting - for (CoilCounter = 1; CoilCounter <= NumCool; ++CoilCounter) { + for (int CoilCounter = 1; CoilCounter <= NumCool; ++CoilCounter) { ++DXCoilNum; AlfaFieldIncre = 1; @@ -340,7 +309,7 @@ namespace VariableSpeedCoils { cNumericFields); // ErrorsFound will be set to True if problem was found, left untouched otherwise - VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); + GlobalNames::VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).bIsDesuperheater = false; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name = AlphArray(1); @@ -370,7 +339,7 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Secondary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum = GetOnlySingleNode(state, AlphArray(3), @@ -380,7 +349,7 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Secondary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum = GetOnlySingleNode(state, AlphArray(4), @@ -390,7 +359,7 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirOutletNodeNum = GetOnlySingleNode(state, AlphArray(5), @@ -400,10 +369,10 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); - TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Water Nodes"); - TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(4), AlphArray(5), "Air Nodes"); + BranchNodeConnections::TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Water Nodes"); + BranchNodeConnections::TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(4), AlphArray(5), "Air Nodes"); // If (VarSpeedCoil(DXCoilNum)%NumOfSpeeds .LT. 2) Then if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds < 1) { @@ -431,7 +400,7 @@ namespace VariableSpeedCoils { } // part load curve - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = GetCurveIndex(state, AlphArray(6)); // convert curve name to number + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = Curve::GetCurveIndex(state, AlphArray(6)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR == 0) { if (lAlphaBlanks(6)) { ShowSevereError( @@ -446,7 +415,7 @@ namespace VariableSpeedCoils { } ErrorsFound = true; } else { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -458,7 +427,7 @@ namespace VariableSpeedCoils { } } - for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) = NumArray(12 + (I - 1) * 6); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedSHR(I) = NumArray(13 + (I - 1) * 6); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(I) = NumArray(14 + (I - 1) * 6); @@ -468,7 +437,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 7 + (I - 1) * 7; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -497,7 +466,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue( + CurveVal = Curve::CurveValue( state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), RatedInletWetBulbTemp, RatedInletWaterTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, @@ -514,7 +483,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 8 + (I - 1) * 7; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -543,7 +512,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -559,7 +528,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 9 + (I - 1) * 7; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -588,7 +557,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -604,7 +573,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 10 + (I - 1) * 7; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -633,7 +602,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue( + CurveVal = Curve::CurveValue( state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), RatedInletWetBulbTemp, RatedInletWaterTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, @@ -650,7 +619,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 11 + (I - 1) * 7; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -679,7 +648,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -695,7 +664,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 12 + (I - 1) * 7; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -724,7 +693,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -741,7 +710,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 13 + (I - 1) * 7; // Read waste heat modifier curve name state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -770,7 +739,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue( + CurveVal = Curve::CurveValue( state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I), RatedInletWaterTemp, RatedInletAirTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, @@ -786,7 +755,7 @@ namespace VariableSpeedCoils { } } - for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(I) = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap( @@ -845,35 +814,15 @@ namespace VariableSpeedCoils { OutputProcessor::Group::HVAC, OutputProcessor::EndUseCat::CoolingCoils); - // for table output, being consistent with outher water-to-air coils - // IF (VarSpeedCoil(DXCoilNum)%RatedCapCoolTotal /= AutoSize) THEN - // VarSpeedCoil(DXCoilNum)%RatedCapCoolSens = VarSpeedCoil(DXCoilNum)%RatedCapCoolTotal & - // *VarSpeedCoil(DXCoilNum)%MSRatedSHR(VarSpeedCoil(DXCoilNum)%NormSpedLevel) - // ELSE - // VarSpeedCoil(DXCoilNum)%RatedCapCoolSens = AUTOSIZE - // END IF - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolSens = - AutoSize; // always auto-sized, to be determined in the sizing calculation - - // BAN Sept 30 2103, CR9322, commented out, now it is redundant, it is reported from sizing routine - // create predefined report entries - // PreDefTableEntry(state, pdchCoolCoilType, VarSpeedCoil( DXCoilNum ).Name, CurrentModuleObject ); - // PreDefTableEntry(state, pdchCoolCoilTotCap, VarSpeedCoil( DXCoilNum ).Name, VarSpeedCoil( DXCoilNum ).RatedCapCoolTotal ); - // PreDefTableEntry(state, pdchCoolCoilSensCap, VarSpeedCoil( DXCoilNum ).Name, VarSpeedCoil( DXCoilNum ).RatedCapCoolSens ); - // PreDefTableEntry(state, pdchCoolCoilLatCap, VarSpeedCoil( DXCoilNum ).Name, VarSpeedCoil( DXCoilNum ).RatedCapCoolTotal - - // VarSpeedCoil( DXCoilNum ).RatedCapCoolSens ); PreDefTableEntry(state, pdchCoolCoilSHR, VarSpeedCoil( DXCoilNum ).Name, VarSpeedCoil( - // DXCoilNum - // ).RatedCapCoolSens / VarSpeedCoil( DXCoilNum ).RatedCapCoolTotal ); PreDefTableEntry(state, pdchCoolCoilNomEff, VarSpeedCoil( - // DXCoilNum - // ).Name, VarSpeedCoil( DXCoilNum ).MSRatedCOP( VarSpeedCoil( DXCoilNum ).NormSpedLevel ) ); + DataSizing::AutoSize; // always auto-sized, to be determined in the sizing calculation } //-------------------------AIR SOURCE, COOLING---BEGIN // Get the data for cooling coil, AIR SOURCE CurrentModuleObject = "Coil:Cooling:DX:VariableSpeed"; // for reporting - for (CoilCounter = 1; CoilCounter <= NumCoolAS; ++CoilCounter) { + for (int CoilCounter = 1; CoilCounter <= NumCoolAS; ++CoilCounter) { ++DXCoilNum; AlfaFieldIncre = 1; @@ -890,8 +839,11 @@ namespace VariableSpeedCoils { lAlphaBlanks, cAlphaFields, cNumericFields); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, AlphArray(1)}; + // ErrorsFound will be set to True if problem was found, left untouched otherwise - VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); + GlobalNames::VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).bIsDesuperheater = false; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name = AlphArray(1); @@ -920,7 +872,7 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirOutletNodeNum = GetOnlySingleNode(state, AlphArray(3), @@ -930,9 +882,9 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); - TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Air Nodes"); + BranchNodeConnections::TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Air Nodes"); if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds < 1) { ShowSevereError( @@ -959,7 +911,7 @@ namespace VariableSpeedCoils { } // part load curve - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = GetCurveIndex(state, AlphArray(4)); // convert curve name to number + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = Curve::GetCurveIndex(state, AlphArray(4)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR == 0) { if (lAlphaBlanks(4)) { ShowSevereError( @@ -974,7 +926,7 @@ namespace VariableSpeedCoils { } ErrorsFound = true; } else { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -999,9 +951,9 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::OutsideAirReference, NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); - if (!CheckOutAirNodeNumber(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum)) { + if (!OutAirNodeManager::CheckOutAirNodeNumber(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserInletNodeNum)) { ShowWarningError(state, format("{}{}=\"{}\", may be invalid", RoutineName, @@ -1080,13 +1032,13 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupplyMode = WaterSupplyFromMains; } else { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupplyMode = WaterSupplyFromTank; - SetupTankDemandComponent(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, - CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupplyName, - ErrorsFound, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupTankID, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterTankDemandARRID); + WaterManager::SetupTankDemandComponent(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + CurrentModuleObject, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupplyName, + ErrorsFound, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupTankID, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterTankDemandARRID); } // A9; \field Name of Water Storage Tank for Condensate Collection @@ -1095,13 +1047,13 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateCollectMode = CondensateDiscarded; } else { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateCollectMode = CondensateToTank; - SetupTankSupplyComponent(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, - CurrentModuleObject, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateCollectName, - ErrorsFound, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateTankID, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateTankSupplyARRID); + WaterManager::SetupTankSupplyComponent(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + CurrentModuleObject, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateCollectName, + ErrorsFound, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateTankID, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateTankSupplyARRID); } // Basin heater power as a function of temperature must be greater than or equal to 0 @@ -1128,18 +1080,15 @@ namespace VariableSpeedCoils { } } - if (!lAlphaBlanks(10)) { - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterSchedulePtr = GetScheduleIndex(state, AlphArray(10)); - if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterSchedulePtr == 0) { - ShowWarningError( - state, - format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name)); - ShowContinueError(state, format("...not found {}=\"{}\".", cAlphaFields(10), AlphArray(10))); - ShowContinueError(state, "Basin heater will be available to operate throughout the simulation."); - } + if (lAlphaBlanks(10)) { + // Should this be ScheduleAlwaysOff? + } else if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).basinHeaterSched = Sched::GetSchedule(state, AlphArray(10))) == + nullptr) { + ShowWarningItemNotFound( + state, eoh, cAlphaFields(10), AlphArray(10), "Basin heater will be available to operate throughout the simulation."); } - for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) = NumArray(16 + (I - 1) * 8); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedSHR(I) = NumArray(17 + (I - 1) * 8); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(I) = NumArray(18 + (I - 1) * 8); @@ -1160,7 +1109,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 11 + (I - 1) * 4; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -1189,7 +1138,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue( + CurveVal = Curve::CurveValue( state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), RatedInletWetBulbTemp, RatedAmbAirTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, @@ -1206,7 +1155,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 12 + (I - 1) * 4; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -1235,7 +1184,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -1251,7 +1200,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 13 + (I - 1) * 4; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -1280,7 +1229,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue( + CurveVal = Curve::CurveValue( state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), RatedInletWetBulbTemp, RatedAmbAirTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, @@ -1297,7 +1246,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 14 + (I - 1) * 4; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -1326,7 +1275,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -1341,7 +1290,7 @@ namespace VariableSpeedCoils { } } - for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(I) = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap( @@ -1398,19 +1347,7 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolSens = - AutoSize; // always auto-sized, to be determined in the sizing calculation - - // BAN Sept 30 2103, CR9322, commented out, now it is redundant, it is reported from sizing routine - // create predefined report entries - // PreDefTableEntry(state, pdchCoolCoilType, VarSpeedCoil( DXCoilNum ).Name, CurrentModuleObject ); - // PreDefTableEntry(state, pdchCoolCoilTotCap, VarSpeedCoil( DXCoilNum ).Name, VarSpeedCoil( DXCoilNum ).RatedCapCoolTotal ); - // PreDefTableEntry(state, pdchCoolCoilSensCap, VarSpeedCoil( DXCoilNum ).Name, VarSpeedCoil( DXCoilNum ).RatedCapCoolSens ); - // PreDefTableEntry(state, pdchCoolCoilLatCap, VarSpeedCoil( DXCoilNum ).Name, VarSpeedCoil( DXCoilNum ).RatedCapCoolTotal - - // VarSpeedCoil( DXCoilNum ).RatedCapCoolSens ); PreDefTableEntry(state, pdchCoolCoilSHR, VarSpeedCoil( DXCoilNum ).Name, VarSpeedCoil( - // DXCoilNum - // ).RatedCapCoolSens / VarSpeedCoil( DXCoilNum ).RatedCapCoolTotal ); PreDefTableEntry(state, pdchCoolCoilNomEff, VarSpeedCoil( - // DXCoilNum - // ).Name, VarSpeedCoil( DXCoilNum ).MSRatedCOP( VarSpeedCoil( DXCoilNum ).NormSpedLevel ) ); + DataSizing::AutoSize; // always auto-sized, to be determined in the sizing calculation } //-------------------------AIR SOURCE COOLING---END @@ -1418,7 +1355,7 @@ namespace VariableSpeedCoils { // Get the data for heating coil, WATER SOURCE CurrentModuleObject = "Coil:Heating:WaterToAirHeatPump:VariableSpeedEquationFit"; - for (CoilCounter = 1; CoilCounter <= NumHeat; ++CoilCounter) { + for (int CoilCounter = 1; CoilCounter <= NumHeat; ++CoilCounter) { ++DXCoilNum; @@ -1435,7 +1372,7 @@ namespace VariableSpeedCoils { cAlphaFields, cNumericFields); // ErrorsFound will be set to True if problem was found, left untouched otherwise - VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); + GlobalNames::VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).bIsDesuperheater = false; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name = AlphArray(1); @@ -1465,7 +1402,7 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Secondary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum = GetOnlySingleNode(state, AlphArray(3), @@ -1475,7 +1412,7 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Secondary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum = GetOnlySingleNode(state, AlphArray(4), @@ -1485,7 +1422,7 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirOutletNodeNum = GetOnlySingleNode(state, AlphArray(5), @@ -1495,10 +1432,10 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); - TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Water Nodes"); - TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(4), AlphArray(5), "Air Nodes"); + BranchNodeConnections::TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Water Nodes"); + BranchNodeConnections::TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(4), AlphArray(5), "Air Nodes"); // If (VarSpeedCoil(DXCoilNum)%NumOfSpeeds .LT. 2) Then if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds < 1) { @@ -1526,7 +1463,7 @@ namespace VariableSpeedCoils { } // part load curve - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = GetCurveIndex(state, AlphArray(6)); // convert curve name to number + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = Curve::GetCurveIndex(state, AlphArray(6)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR == 0) { if (lAlphaBlanks(6)) { ShowSevereError( @@ -1541,7 +1478,7 @@ namespace VariableSpeedCoils { } ErrorsFound = true; } else { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -1553,7 +1490,7 @@ namespace VariableSpeedCoils { } } - for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) = NumArray(6 + (I - 1) * 5); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(I) = NumArray(7 + (I - 1) * 5); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) = NumArray(8 + (I - 1) * 5); @@ -1562,7 +1499,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 7 + (I - 1) * 7; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -1591,10 +1528,10 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), - RatedInletAirTempHeat, - RatedInletWaterTempHeat); + CurveVal = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), + RatedInletAirTempHeat, + RatedInletWaterTempHeat); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -1610,7 +1547,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 8 + (I - 1) * 7; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -1639,7 +1576,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -1655,7 +1592,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 9 + (I - 1) * 7; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -1684,7 +1621,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -1700,7 +1637,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 10 + (I - 1) * 7; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -1729,10 +1666,10 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), - RatedInletAirTempHeat, - RatedInletWaterTempHeat); + CurveVal = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), + RatedInletAirTempHeat, + RatedInletWaterTempHeat); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -1748,7 +1685,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 11 + (I - 1) * 7; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -1777,7 +1714,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -1793,7 +1730,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 12 + (I - 1) * 7; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -1822,7 +1759,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -1839,7 +1776,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 13 + (I - 1) * 7; // Read waste heat modifier curve name state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -1868,10 +1805,10 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I), - RatedInletAirTempHeat, - RatedInletWaterTempHeat); + CurveVal = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(I), + RatedInletAirTempHeat, + RatedInletWaterTempHeat); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -1886,7 +1823,7 @@ namespace VariableSpeedCoils { } } - for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(I) = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap( @@ -1932,24 +1869,24 @@ namespace VariableSpeedCoils { OutputProcessor::EndUseCat::HeatingCoils); // create predefined report entries - PreDefTableEntry( + OutputReportPredefined::PreDefTableEntry( state, state.dataOutRptPredefined->pdchHeatCoilType, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, CurrentModuleObject); - PreDefTableEntry(state, - state.dataOutRptPredefined->pdchHeatCoilNomCap, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat); - PreDefTableEntry(state, - state.dataOutRptPredefined->pdchHeatCoilNomEff, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP( - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel)); + OutputReportPredefined::PreDefTableEntry(state, + state.dataOutRptPredefined->pdchHeatCoilNomCap, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat); + OutputReportPredefined::PreDefTableEntry(state, + state.dataOutRptPredefined->pdchHeatCoilNomEff, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP( + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel)); } //-------------------------AIR SOURCE, HEATING---BEGIN // Get the data for heating coil, AIR SOURCE CurrentModuleObject = "COIL:HEATING:DX:VARIABLESPEED"; - for (CoilCounter = 1; CoilCounter <= NumHeatAS; ++CoilCounter) { + for (int CoilCounter = 1; CoilCounter <= NumHeatAS; ++CoilCounter) { ++DXCoilNum; @@ -1966,7 +1903,7 @@ namespace VariableSpeedCoils { cAlphaFields, cNumericFields); // ErrorsFound will be set to True if problem was found, left untouched otherwise - VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); + GlobalNames::VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).bIsDesuperheater = false; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name = AlphArray(1); @@ -1992,7 +1929,7 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirOutletNodeNum = GetOnlySingleNode(state, AlphArray(3), @@ -2002,9 +1939,9 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); - TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Air Nodes"); + BranchNodeConnections::TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(2), AlphArray(3), "Air Nodes"); if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds < 1) { ShowSevereError( @@ -2031,7 +1968,7 @@ namespace VariableSpeedCoils { } // part load curve - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = GetCurveIndex(state, AlphArray(4)); // convert curve name to number + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = Curve::GetCurveIndex(state, AlphArray(4)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR == 0) { if (lAlphaBlanks(4)) { ShowSevereError( @@ -2046,7 +1983,7 @@ namespace VariableSpeedCoils { } ErrorsFound = true; } else { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -2058,7 +1995,8 @@ namespace VariableSpeedCoils { } } - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostEIRFT = GetCurveIndex(state, AlphArray(5)); // convert curve name to number + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostEIRFT = + Curve::GetCurveIndex(state, AlphArray(5)); // convert curve name to number if (!lAlphaBlanks(6)) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacityCurveIndex = Curve::GetCurveIndex(state, AlphArray(6)); @@ -2166,7 +2104,7 @@ namespace VariableSpeedCoils { ShowContinueError(state, format("...{} = 0.0 for defrost strategy = RESISTIVE.", cNumericFields(6))); } - for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) = NumArray(12 + (I - 1) * 5); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(I) = NumArray(13 + (I - 1) * 5); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(I) = NumArray(14 + (I - 1) * 5); @@ -2188,7 +2126,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 9 + (I - 1) * 4; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -2217,7 +2155,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue( + CurveVal = Curve::CurveValue( state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), RatedInletAirTempHeat, RatedAmbAirTempHeat); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, @@ -2234,7 +2172,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 10 + (I - 1) * 4; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -2263,7 +2201,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -2279,7 +2217,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 11 + (I - 1) * 4; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -2308,7 +2246,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue( + CurveVal = Curve::CurveValue( state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), RatedInletAirTempHeat, RatedAmbAirTempHeat); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, @@ -2325,7 +2263,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 12 + (I - 1) * 4; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -2354,7 +2292,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -2371,7 +2309,7 @@ namespace VariableSpeedCoils { if (ErrorsFound) continue; - for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(I) = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap( @@ -2411,17 +2349,17 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name); // create predefined report entries - PreDefTableEntry( + OutputReportPredefined::PreDefTableEntry( state, state.dataOutRptPredefined->pdchHeatCoilType, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, CurrentModuleObject); - PreDefTableEntry(state, - state.dataOutRptPredefined->pdchHeatCoilNomCap, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat); - PreDefTableEntry(state, - state.dataOutRptPredefined->pdchHeatCoilNomEff, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP( - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel)); + OutputReportPredefined::PreDefTableEntry(state, + state.dataOutRptPredefined->pdchHeatCoilNomCap, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapHeat); + OutputReportPredefined::PreDefTableEntry(state, + state.dataOutRptPredefined->pdchHeatCoilNomEff, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP( + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NormSpedLevel)); } //-------------------------AIR SOURCE HEATING---END @@ -2429,10 +2367,9 @@ namespace VariableSpeedCoils { //------------------------VARIABLE-SPEED AIR SOURCE HPWH---BEGIN CurrentModuleObject = "COIL:WATERHEATING:AIRTOWATERHEATPUMP:VARIABLESPEED"; // for reporting - for (CoilCounter = 1; CoilCounter <= NumHPWHAirToWater; ++CoilCounter) { + for (int CoilCounter = 1; CoilCounter <= NumHPWHAirToWater; ++CoilCounter) { ++DXCoilNum; - AlfaFieldIncre = 1; state.dataInputProcessing->inputProcessor->getObjectItem(state, CurrentModuleObject, @@ -2447,7 +2384,7 @@ namespace VariableSpeedCoils { cAlphaFields, cNumericFields); // ErrorsFound will be set to True if problem was found, left untouched otherwise - VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); + GlobalNames::VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).bIsDesuperheater = false; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondenserType = DataHeatBalance::RefrigCondenserType::WaterHeater; @@ -2589,7 +2526,7 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirOutletNodeNum = GetOnlySingleNode(state, @@ -2600,13 +2537,13 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Air, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); - TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(5), AlphArray(6), "Air Nodes"); + BranchNodeConnections::TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(5), AlphArray(6), "Air Nodes"); // Check if the air inlet node is OA node, to justify whether the coil is placed in zone or not state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).IsDXCoilInZone = - !CheckOutAirNodeNumber(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum); + !OutAirNodeManager::CheckOutAirNodeNumber(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum); // Water nodes state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum = @@ -2618,7 +2555,7 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Inlet, NodeInputManager::CompFluidStream::Secondary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum = GetOnlySingleNode(state, @@ -2629,9 +2566,9 @@ namespace VariableSpeedCoils { DataLoopNode::NodeFluidType::Water, DataLoopNode::ConnectionType::Outlet, NodeInputManager::CompFluidStream::Secondary, - ObjectIsNotParent); + DataLoopNode::ObjectIsNotParent); - TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(7), AlphArray(8), "Water Nodes"); + BranchNodeConnections::TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(7), AlphArray(8), "Water Nodes"); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity = NumArray(10); if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacity < 0.0) { @@ -2687,7 +2624,8 @@ namespace VariableSpeedCoils { WHInletWaterTemp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WHRatedInletWaterTemp; // part load curve - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = GetCurveIndex(state, AlphArray(11)); // convert curve name to number + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR = + Curve::GetCurveIndex(state, AlphArray(11)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR == 0) { if (lAlphaBlanks(11)) { ShowSevereError( @@ -2702,7 +2640,7 @@ namespace VariableSpeedCoils { } ErrorsFound = true; } else { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -2714,7 +2652,7 @@ namespace VariableSpeedCoils { } } - for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) = NumArray(12 + (I - 1) * 6); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(I) = NumArray(13 + (I - 1) * 6); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedSHR(I) = NumArray(14 + (I - 1) * 6); @@ -2724,7 +2662,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 12 + (I - 1) * 6; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -2753,8 +2691,8 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), WHInletAirTemp, WHInletWaterTemp); + CurveVal = Curve::CurveValue( + state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(I), WHInletAirTemp, WHInletWaterTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -2770,7 +2708,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 13 + (I - 1) * 6; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -2799,7 +2737,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -2815,7 +2753,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 14 + (I - 1) * 6; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -2844,7 +2782,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -2860,7 +2798,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 15 + (I - 1) * 6; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -2889,8 +2827,8 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), WHInletAirTemp, WHInletWaterTemp); + CurveVal = Curve::CurveValue( + state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(I), WHInletAirTemp, WHInletWaterTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -2906,7 +2844,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 16 + (I - 1) * 6; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -2935,7 +2873,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -2951,7 +2889,7 @@ namespace VariableSpeedCoils { AlfaFieldIncre = 17 + (I - 1) * 6; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) = - GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number + Curve::GetCurveIndex(state, AlphArray(AlfaFieldIncre)); // convert curve name to number if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I) == 0) { if (lAlphaBlanks(AlfaFieldIncre)) { ShowSevereError(state, @@ -2980,7 +2918,7 @@ namespace VariableSpeedCoils { cAlphaFields(AlfaFieldIncre)); // Field Name if (!ErrorsFound) { - CurveVal = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), 1.0); + CurveVal = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(I), 1.0); if (CurveVal > 1.10 || CurveVal < 0.90) { ShowWarningError(state, format("{}{}=\"{}\", curve values", @@ -2996,7 +2934,7 @@ namespace VariableSpeedCoils { } // get scale values - for (I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { + for (int I = 1; I <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++I) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedPercentTotCap(I) = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(I) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap( @@ -3070,7 +3008,7 @@ namespace VariableSpeedCoils { } state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolSens = - AutoSize; // always auto-sized, to be determined in the sizing calculation + DataSizing::AutoSize; // always auto-sized, to be determined in the sizing calculation } //---------------------------VARIABLE-SPEED AIR SOURCE HPWH END -------------- @@ -3872,7 +3810,6 @@ namespace VariableSpeedCoils { // AUTHOR Bo Shen, based on MODULE WaterToAirHeatPumpSimple:InitSimpleWatertoAirHP // DATE WRITTEN March, 2012 // MODIFIED Bo Shen, 12/2014, add variable-speed HPWH - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine is for initializations of the variable speed Water to Air HP Components. @@ -3880,44 +3817,23 @@ namespace VariableSpeedCoils { // METHODOLOGY EMPLOYED: // Uses the status flags to trigger initializations. - // Using/Aliasing - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSpecificHeatGlycol; - - using PlantUtilities::InitComponentNodes; - using PlantUtilities::ScanPlantLoopsForObject; - using PlantUtilities::SetComponentFlowRate; - using Psychrometrics::PsyRhoAirFnPbTdbW; - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // shut off after compressor cycle off [s] - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineNameSimpleWatertoAirHP("InitSimpleWatertoAirHP"); - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int AirInletNode; // Node Number of the air inlet int WaterInletNode; // Node Number of the Water inlet Real64 rho; // local fluid density Real64 Cp; // local fluid specific heat int SpeedCal; // calculated speed level - bool ErrorsFound(false); // TRUE when errors found, air loop initialization error + bool ErrorsFound; // TRUE when errors found, air loop initialization error Real64 RatedVolFlowPerRatedTotCap; // Rated Air Volume Flow Rate divided by Rated Total Capacity [m3/s-W) - int Mode; // Performance mode for MultiMode DX coil; Always 1 for other coil types Real64 RatedHeatPumpIndoorAirTemp; // Indoor dry-bulb temperature to heat pump evaporator at rated conditions [C] Real64 RatedHeatPumpIndoorHumRat; // Inlet humidity ratio to heat pump evaporator at rated conditions [kg/kg] Real64 WaterFlowScale; // water flow scaling factor match rated flow rate // SUBROUTINE PARAMETER DEFINITIONS: - static constexpr std::string_view RoutineName("InitVarSpeedCoil"); + static constexpr std::string_view RoutineName = "InitVarSpeedCoil"; + int AirInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum; if (state.dataVariableSpeedCoils->MyOneTimeFlag) { // initialize the environment and sizing flags @@ -3961,16 +3877,16 @@ namespace VariableSpeedCoils { CoilVSWAHPType = DataPlant::PlantEquipmentType::CoilVSWAHPHeatingEquationFit; } ErrorsFound = false; - ScanPlantLoopsForObject(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, - CoilVSWAHPType, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc, - ErrorsFound, - _, - _, - _, - _, - _); + PlantUtilities::ScanPlantLoopsForObject(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, + CoilVSWAHPType, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc, + ErrorsFound, + _, + _, + _, + _, + _); if (ErrorsFound) { ShowFatalError(state, "InitVarSpeedCoil: Program terminated for previous conditions."); } @@ -3994,7 +3910,7 @@ namespace VariableSpeedCoils { // Multispeed Cooling if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit) || (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed)) { - for (Mode = 1; Mode <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++Mode) { + for (int Mode = 1; Mode <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++Mode) { if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal <= 0.0) break; // Check for zero capacity or zero max flow rate if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) <= 0.0) { @@ -4019,29 +3935,8 @@ namespace VariableSpeedCoils { // Check for valid range of (Rated Air Volume Flow Rate / Rated Total Capacity) RatedVolFlowPerRatedTotCap = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode); - // note: variable-speed HP can exceed the flow rate restrictions at low speed levels - // IF (((MinRatedAirVolFlowPerRatedTotCap - RatedVolFlowPerRatedTotCap) > SmallDifferenceTest).OR. & - // ((RatedVolFlowPerRatedTotCap - MaxRatedAirVolFlowPerRatedTotCap) > SmallDifferenceTest)) THEN - // CALL ShowSevereError(state,'Sizing: '//TRIM(VarSpeedCoil(DXCoilNum)%VarSpeedCoilType) & - // // ' "'//TRIM(VarSpeedCoil(DXCoilNum)%Name)// & - // '": Rated air volume flow rate per watt of rated total '// & - // 'cooling capacity is out of range at speed '//TRIM(TrimSigDigits(Mode))) - // CALL ShowContinueError & - // ('Min Rated Vol Flow Per Watt=['//TRIM(TrimSigDigits(MinRatedAirVolFlowPerRatedTotCap,3))//'], '// & - // 'Rated Vol Flow Per Watt=['//TRIM(TrimSigDigits(RatedVolFlowPerRatedTotCap,3))//'], & - // Max Rated Vol Flow Per Watt=['// & - // TRIM(TrimSigDigits(MaxRatedAirVolFlowPerRatedTotCap,3))//']. See Input-Output Reference Manual for valid range.') - // END IF - // VarSpeedCoil(DXCoilNum)%MSRatedAirMassFlowRate(Mode) = VarSpeedCoil(DXCoilNum)%MSRatedAirVolFlowRate(Mode)* & - // PsyRhoAirFnPbTdbW(state, OutBaroPress,RatedInletAirTemp,RatedInletAirHumRat,RoutineName) - // ! get high speed rated coil bypass factor - // VarSpeedCoil(DXCoilNum)%MSRatedCBF(Mode) = CalcCBF(VarSpeedCoil(DXCoilNum)%VarSpeedCoilType, & - // VarSpeedCoil(DXCoilNum)%Name,& - // RatedInletAirTemp,RatedInletAirHumRat,VarSpeedCoil(DXCoilNum)%MSRatedTotCap(Mode),& - // VarSpeedCoil(DXCoilNum)%MSRatedAirMassFlowRate(Mode), & - // VarSpeedCoil(DXCoilNum)%MSRatedSHR(Mode)) } - // call coil model with everthing set at rating point + // call coil model with everything set at rating point state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp = RatedInletAirTemp; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat = Psychrometrics::PsyWFnTdbTwbPb(state, RatedInletAirTemp, RatedInletWetBulbTemp, DataEnvironment::StdPressureSeaLevel); @@ -4082,12 +3977,8 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate( state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp = RatedInletWaterTemp; // 85 F cooling mode - Real64 CpSource = GetSpecificHeatGlycol( - state, - state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum).FluidName, - state.dataVariableSpeedCoils->SourceSideInletTemp, - state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpSource = state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataVariableSpeedCoils->SourceSideInletTemp, RoutineName); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterEnthalpy = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp * CpSource; } @@ -4155,27 +4046,15 @@ namespace VariableSpeedCoils { (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed)) { RatedHeatPumpIndoorAirTemp = 21.11; // 21.11C or 70F RatedHeatPumpIndoorHumRat = 0.00881; // Humidity ratio corresponding to 70F dry bulb/60F wet bulb - for (Mode = 1; Mode <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++Mode) { + for (int Mode = 1; Mode <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++Mode) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(Mode) = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) * - PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, RatedHeatPumpIndoorAirTemp, RatedHeatPumpIndoorHumRat, RoutineName); + Psychrometrics::PsyRhoAirFnPbTdbW( + state, state.dataEnvrn->OutBaroPress, RatedHeatPumpIndoorAirTemp, RatedHeatPumpIndoorHumRat, RoutineName); // Check for valid range of (Rated Air Volume Flow Rate / Rated Total Capacity) RatedVolFlowPerRatedTotCap = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirVolFlowRate(Mode) / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode); - // note: variable-speed HP can exceed the flow rate restrictions at low speed levels - // IF (((MinRatedAirVolFlowPerRatedTotCap - RatedVolFlowPerRatedTotCap) > SmallDifferenceTest).OR. & - // ((RatedVolFlowperRatedTotCap - MaxRatedAirVolFlowPerRatedTotCap) > SmallDifferenceTest)) THEN - // CALL ShowSevereError(state,'Coil:Heating:DX:MultiSpeed '//TRIM(VarSpeedCoil(DXCoilNum)%Name)// & - // ': Rated air volume flow rate per watt of rated total '// & - // 'heating capacity is out of range at speed '//TRIM(TrimSigDigits(Mode))) - // CALL ShowContinueError(state, 'Min Rated Vol Flow Per Watt=['//TRIM(TrimSigDigits & - // (MinRatedAirVolFlowPerRatedTotCap,3))//'], '// & - // 'Rated Vol Flow Per Watt=['//TRIM(TrimSigDigits(RatedVolFlowPerRatedTotCap,3))//'], & - // Max Rated Vol Flow Per Watt=['// & - // TRIM(TrimSigDigits(MaxRatedAirVolFlowPerRatedTotCap,3))//']. See Input-Output Reference & - // Manual for valid range.') - // END IF } // call coil model with everthing set at rating point state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp = RatedInletAirTempHeat; @@ -4218,12 +4097,8 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedWaterMassFlowRate( state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp = RatedInletWaterTempHeat; // 21.11C or 70F, heating mode - Real64 CpSource = GetSpecificHeatGlycol( - state, - state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum).FluidName, - state.dataVariableSpeedCoils->SourceSideInletTemp, - state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum).FluidIndex, - RoutineName); + Real64 CpSource = state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataVariableSpeedCoils->SourceSideInletTemp, RoutineName); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterEnthalpy = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp * CpSource; } @@ -4333,8 +4208,6 @@ namespace VariableSpeedCoils { !state.dataVariableSpeedCoils->MyPlantScanFlag(DXCoilNum)) { // Do the initializations to start simulation - AirInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum; - // Initialize all report variables to a known state at beginning of simulation state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirVolFlowRate = 0.0; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp = 0.0; @@ -4365,26 +4238,19 @@ namespace VariableSpeedCoils { (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit)) { WaterInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum; - rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum).FluidIndex, - RoutineNameSimpleWatertoAirHP); - Cp = GetSpecificHeatGlycol( - state, - state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum).FluidIndex, - RoutineNameSimpleWatertoAirHP); + rho = state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum) + .glycol->getDensity(state, Constant::CWInitConvTemp, RoutineNameSimpleWatertoAirHP); + Cp = state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum) + .glycol->getSpecificHeat(state, Constant::CWInitConvTemp, RoutineNameSimpleWatertoAirHP); // VarSpeedCoil(DXCoilNum)%DesignWaterMassFlowRate= & // rho * VarSpeedCoil(DXCoilNum)%RatedWaterVolFlowRate - InitComponentNodes(state, - 0.0, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum); + PlantUtilities::InitComponentNodes(state, + 0.0, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum); state.dataLoopNodes->Node(WaterInletNode).Temp = 5.0; state.dataLoopNodes->Node(WaterInletNode).Enthalpy = Cp * state.dataLoopNodes->Node(WaterInletNode).Temp; @@ -4417,7 +4283,6 @@ namespace VariableSpeedCoils { // Set water and air inlet nodes - AirInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum; WaterInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum; if ((SensLoad != 0.0 || LatentLoad != 0.0) && (state.dataLoopNodes->Node(AirInletNode).MassFlowRate > 0.0)) { @@ -4441,16 +4306,16 @@ namespace VariableSpeedCoils { // If air flow is less than 25% rated flow. Then set air flow to the 25% of rated conditions if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate < 0.25 * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirVolFlowRate * - PsyRhoAirFnPbTdbW(state, - state.dataEnvrn->OutBaroPress, - state.dataLoopNodes->Node(AirInletNode).Temp, - state.dataLoopNodes->Node(AirInletNode).HumRat)) { + Psychrometrics::PsyRhoAirFnPbTdbW(state, + state.dataEnvrn->OutBaroPress, + state.dataLoopNodes->Node(AirInletNode).Temp, + state.dataLoopNodes->Node(AirInletNode).HumRat)) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = 0.25 * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignAirVolFlowRate * - PsyRhoAirFnPbTdbW(state, - state.dataEnvrn->OutBaroPress, - state.dataLoopNodes->Node(AirInletNode).Temp, - state.dataLoopNodes->Node(AirInletNode).HumRat); + Psychrometrics::PsyRhoAirFnPbTdbW(state, + state.dataEnvrn->OutBaroPress, + state.dataLoopNodes->Node(AirInletNode).Temp, + state.dataLoopNodes->Node(AirInletNode).HumRat); } } else { // CYCLIC FAN, NOT CORRECTION, WILL BE PROCESSED IN THE FOLLOWING SUBROUTINES state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = state.dataLoopNodes->Node(AirInletNode).MassFlowRate; @@ -4463,11 +4328,11 @@ namespace VariableSpeedCoils { if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingWaterToAirHPVSEquationFit) || (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit)) { - SetComponentFlowRate(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc); + PlantUtilities::SetComponentFlowRate(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp = state.dataLoopNodes->Node(WaterInletNode).Temp; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterEnthalpy = state.dataLoopNodes->Node(WaterInletNode).Enthalpy; @@ -4557,7 +4422,6 @@ namespace VariableSpeedCoils { static constexpr std::string_view RoutineName("SizeVarSpeedCoil"); static constexpr std::string_view RoutineNameAlt("SizeHVACWaterToAir"); - auto &ZoneEqSizing(state.dataSize->ZoneEqSizing); auto &varSpeedCoil = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: @@ -4671,7 +4535,7 @@ namespace VariableSpeedCoils { varSpeedCoil.plantLoc.loopNum); } - if (varSpeedCoil.RatedAirVolFlowRate == AutoSize) { + if (varSpeedCoil.RatedAirVolFlowRate == DataSizing::AutoSize) { RatedAirFlowAutoSized = true; } @@ -4688,7 +4552,7 @@ namespace VariableSpeedCoils { } else { CheckSysSizing(state, format("COIL:{}{}", varSpeedCoil.CoolHeatType, CurrentObjSubfix), varSpeedCoil.Name); if (state.dataSize->CurOASysNum > 0 && state.dataAirLoop->OutsideAirSys(state.dataSize->CurOASysNum).AirLoopDOASNum > -1) { - auto &thisAirloopDOAS = + auto const &thisAirloopDOAS = state.dataAirLoopHVACDOAS->airloopDOAS[state.dataAirLoop->OutsideAirSys(state.dataSize->CurOASysNum).AirLoopDOASNum]; RatedAirVolFlowRateDes = thisAirloopDOAS.SizingMassFlow / state.dataEnvrn->StdRhoAir; } else { @@ -4728,8 +4592,8 @@ namespace VariableSpeedCoils { // size rated total cooling capacity IsAutoSize = false; - if (varSpeedCoil.RatedCapCoolTotal == AutoSize && (varSpeedCoil.VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit || - varSpeedCoil.VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed)) { + if (varSpeedCoil.RatedCapCoolTotal == DataSizing::AutoSize && (varSpeedCoil.VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit || + varSpeedCoil.VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed)) { RatedCapCoolTotalAutoSized = true; } if (SizingDesRunThisZone || SizingDesRunThisAirSys) HardSizeNoDesRun = false; @@ -4746,7 +4610,7 @@ namespace VariableSpeedCoils { } else { CheckSysSizing(state, format("COIL:{}{}", varSpeedCoil.CoolHeatType, CurrentObjSubfix), varSpeedCoil.Name); if (state.dataSize->CurOASysNum > 0 && state.dataAirLoop->OutsideAirSys(state.dataSize->CurOASysNum).AirLoopDOASNum > -1) { - auto &thisAirloopDOAS = + auto const &thisAirloopDOAS = state.dataAirLoopHVACDOAS->airloopDOAS[state.dataAirLoop->OutsideAirSys(state.dataSize->CurOASysNum).AirLoopDOASNum]; VolFlowRate = varSpeedCoil.RatedAirVolFlowRate; MixTemp = thisAirloopDOAS.SizingCoolOATemp; @@ -4767,7 +4631,7 @@ namespace VariableSpeedCoils { RatedCapCoolTotalDes /= TotCapTempModFac; } } else { - auto &finalSysSizing = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum); + auto const &finalSysSizing = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum); VolFlowRate = varSpeedCoil.RatedAirVolFlowRate; if (VolFlowRate >= HVAC::SmallAirVolFlow) { if (state.dataSize->CurOASysNum > 0) { // coil is in the OA stream @@ -4846,11 +4710,11 @@ namespace VariableSpeedCoils { } } else { CheckZoneSizing(state, format("COIL:{}{}", varSpeedCoil.CoolHeatType, CurrentObjSubfix), varSpeedCoil.Name); - auto &finalZoneSizing = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum); + auto const &finalZoneSizing = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum); VolFlowRate = varSpeedCoil.RatedAirVolFlowRate; if (VolFlowRate >= HVAC::SmallAirVolFlow) { if (state.dataSize->ZoneEqDXCoil) { - if (ZoneEqSizing(state.dataSize->CurZoneEqNum).OAVolFlow > 0.0) { + if (state.dataSize->ZoneEqSizing(state.dataSize->CurZoneEqNum).OAVolFlow > 0.0) { MixTemp = finalZoneSizing.DesCoolCoilInTemp; MixHumRat = finalZoneSizing.DesCoolCoilInHumRat; } else { @@ -5001,8 +4865,8 @@ namespace VariableSpeedCoils { } // size rated heating capacity - if (varSpeedCoil.RatedCapHeat == AutoSize && (varSpeedCoil.VSCoilType == HVAC::Coil_HeatingWaterToAirHPVSEquationFit || - varSpeedCoil.VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed)) { + if (varSpeedCoil.RatedCapHeat == DataSizing::AutoSize && (varSpeedCoil.VSCoilType == HVAC::Coil_HeatingWaterToAirHPVSEquationFit || + varSpeedCoil.VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed)) { RatedCapHeatAutoSized = true; } // simply set heating capacity equal to the cooling capacity @@ -5017,7 +4881,7 @@ namespace VariableSpeedCoils { } // END IF if (RatedCapHeatAutoSized) { - if (RatedCapHeatDes == AutoSize) { + if (RatedCapHeatDes == DataSizing::AutoSize) { ShowWarningError( state, format("COIL:{}:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT \"{}\"", varSpeedCoil.CoolHeatType, varSpeedCoil.Name)); ShowContinueError(state, @@ -5266,8 +5130,9 @@ namespace VariableSpeedCoils { } // Size water volumetric flow rate - if ((varSpeedCoil.RatedWaterVolFlowRate == AutoSize) && (varSpeedCoil.VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit || - varSpeedCoil.VSCoilType == HVAC::Coil_HeatingWaterToAirHPVSEquationFit)) { + if ((varSpeedCoil.RatedWaterVolFlowRate == DataSizing::AutoSize) && + (varSpeedCoil.VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit || + varSpeedCoil.VSCoilType == HVAC::Coil_HeatingWaterToAirHPVSEquationFit)) { RatedWaterFlowAutoSized = true; } @@ -5284,16 +5149,10 @@ namespace VariableSpeedCoils { false); if (PltSizNum > 0) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(varSpeedCoil.plantLoc.loopNum).FluidName, - state.dataSize->PlantSizData(PltSizNum).ExitTemp, - state.dataPlnt->PlantLoop(varSpeedCoil.plantLoc.loopNum).FluidIndex, - RoutineNameAlt); - cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(varSpeedCoil.plantLoc.loopNum).FluidName, - state.dataSize->PlantSizData(PltSizNum).ExitTemp, - state.dataPlnt->PlantLoop(varSpeedCoil.plantLoc.loopNum).FluidIndex, - RoutineNameAlt); + rho = state.dataPlnt->PlantLoop(varSpeedCoil.plantLoc.loopNum) + .glycol->getDensity(state, state.dataSize->PlantSizData(PltSizNum).ExitTemp, RoutineNameAlt); + cp = state.dataPlnt->PlantLoop(varSpeedCoil.plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataSize->PlantSizData(PltSizNum).ExitTemp, RoutineNameAlt); if (varSpeedCoil.VSCoilType == HVAC::Coil_HeatingWaterToAirHPVSEquationFit || varSpeedCoil.VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { @@ -5344,10 +5203,8 @@ namespace VariableSpeedCoils { ShowContinueError(state, format("Occurs in COIL:{}{} Object = {}", varSpeedCoil.CoolHeatType, CurrentObjSubfix, varSpeedCoil.Name)); ErrorsFound = true; } - } - // WRITE THE WATER SIZING OUTPUT - if (RatedWaterFlowAutoSized) { + // WRITE THE WATER SIZING OUTPUT // FORCE BACK TO THE RATED WATER FLOW RATE WITH THE SAME RATIO DEFINED BY THE CATLOG DATA if (RatedCapCoolTotalAutoSized) { RatedWaterVolFlowRateDes = varSpeedCoil.RatedCapCoolTotal * varSpeedCoil.MSRatedWaterVolFlowPerRatedTotCap(NormSpeed); @@ -5427,11 +5284,7 @@ namespace VariableSpeedCoils { if (PltSizNum > 0) { rhoW = rho; } else { - rhoW = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(varSpeedCoil.plantLoc.loopNum).FluidName, - RatedSourceTempCool, - state.dataPlnt->PlantLoop(varSpeedCoil.plantLoc.loopNum).FluidIndex, - RoutineName); + rhoW = state.dataPlnt->PlantLoop(varSpeedCoil.plantLoc.loopNum).glycol->getDensity(state, RatedSourceTempCool, RoutineName); } varSpeedCoil.RatedWaterMassFlowRate = varSpeedCoil.RatedWaterVolFlowRate * rhoW; @@ -5440,7 +5293,7 @@ namespace VariableSpeedCoils { varSpeedCoil.MSRatedWaterMassFlowRate(Mode) = varSpeedCoil.MSRatedWaterVolFlowRate(Mode) * rhoW; } } else if (varSpeedCoil.VSCoilType == HVAC::CoilDX_HeatPumpWaterHeaterVariableSpeed) { - rhoW = RhoH2O(RatedSourceTempCool); + rhoW = Psychrometrics::RhoH2O(RatedSourceTempCool); varSpeedCoil.RatedWaterMassFlowRate = varSpeedCoil.RatedWaterVolFlowRate * rhoW; for (Mode = varSpeedCoil.NumOfSpeeds; Mode >= 1; --Mode) { varSpeedCoil.MSRatedWaterVolFlowRate(Mode) = varSpeedCoil.MSRatedTotCap(Mode) * varSpeedCoil.MSRatedWaterVolFlowPerRatedTotCap(Mode); @@ -5485,15 +5338,15 @@ namespace VariableSpeedCoils { if (varSpeedCoil.VSCoilType == HVAC::Coil_CoolingWaterToAirHPVSEquationFit || varSpeedCoil.VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { for (Mode = 1; Mode <= varSpeedCoil.NumOfSpeeds; ++Mode) { - varSpeedCoil.MSRatedCBF(Mode) = CalcCBF(state, - varSpeedCoil.VarSpeedCoilType, - varSpeedCoil.Name, - RatedInletAirTemp, - RatedInletAirHumRat, - varSpeedCoil.MSRatedTotCap(Mode), - varSpeedCoil.MSRatedAirVolFlowRate(Mode), - varSpeedCoil.MSRatedSHR(Mode), - true); + varSpeedCoil.MSRatedCBF(Mode) = DXCoils::CalcCBF(state, + varSpeedCoil.VarSpeedCoilType, + varSpeedCoil.Name, + RatedInletAirTemp, + RatedInletAirHumRat, + varSpeedCoil.MSRatedTotCap(Mode), + varSpeedCoil.MSRatedAirVolFlowRate(Mode), + varSpeedCoil.MSRatedSHR(Mode), + true); if (varSpeedCoil.MSRatedCBF(Mode) > 0.0) { varSpeedCoil.MSEffectiveAo(Mode) = -std::log(varSpeedCoil.MSRatedCBF(Mode)) * varSpeedCoil.MSRatedAirMassFlowRate(Mode); } else { @@ -5517,15 +5370,15 @@ namespace VariableSpeedCoils { HPWHCoolCapacity = varSpeedCoil.MSRatedTotCap(Mode) * (1.0 - 1.0 / varSpeedCoil.MSRatedCOP(Mode)) - varSpeedCoil.MSWHPumpPower(Mode) * varSpeedCoil.HPWHCondPumpFracToWater; - varSpeedCoil.MSRatedCBF(Mode) = CalcCBF(state, - varSpeedCoil.VarSpeedCoilType, - varSpeedCoil.Name, - state.dataHVACGlobal->HPWHInletDBTemp, - HPInletAirHumRat, - HPWHCoolCapacity, - varSpeedCoil.MSRatedAirVolFlowRate(Mode), - varSpeedCoil.MSRatedSHR(Mode), - true); + varSpeedCoil.MSRatedCBF(Mode) = DXCoils::CalcCBF(state, + varSpeedCoil.VarSpeedCoilType, + varSpeedCoil.Name, + state.dataHVACGlobal->HPWHInletDBTemp, + HPInletAirHumRat, + HPWHCoolCapacity, + varSpeedCoil.MSRatedAirVolFlowRate(Mode), + varSpeedCoil.MSRatedSHR(Mode), + true); if (varSpeedCoil.MSRatedCBF(Mode) > 0.0) { varSpeedCoil.MSEffectiveAo(Mode) = -std::log(varSpeedCoil.MSRatedCBF(Mode)) * varSpeedCoil.MSRatedAirMassFlowRate(Mode); } else { @@ -5554,7 +5407,7 @@ namespace VariableSpeedCoils { varSpeedCoil.RatedAirVolFlowRate * Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, RatedInletAirTemp, RatedInletAirHumRat, RoutineName); RatedInletEnth = Psychrometrics::PsyHFnTdbW(RatedInletAirTemp, RatedInletAirHumRat); - CBFRated = AdjustCBF(varSpeedCoil.MSRatedCBF(NormSpeed), varSpeedCoil.MSRatedAirMassFlowRate(NormSpeed), RatedAirMassFlowRate); + CBFRated = DXCoils::AdjustCBF(varSpeedCoil.MSRatedCBF(NormSpeed), varSpeedCoil.MSRatedAirMassFlowRate(NormSpeed), RatedAirMassFlowRate); if (CBFRated > 0.999) CBFRated = 0.999; if (varSpeedCoil.MSRatedAirMassFlowRate(NormSpeed) > 1.0e-10) { AirMassFlowRatio = RatedAirMassFlowRate / varSpeedCoil.MSRatedAirMassFlowRate(NormSpeed); @@ -5657,7 +5510,7 @@ namespace VariableSpeedCoils { // START SIZING EVAP PRECOOLING PUMP POWER IsAutoSize = false; if (varSpeedCoil.VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { - if (varSpeedCoil.EvapCondPumpElecNomPower == AutoSize) { + if (varSpeedCoil.EvapCondPumpElecNomPower == DataSizing::AutoSize) { IsAutoSize = true; } // Auto size high speed evap condenser pump power to Total Capacity * 0.004266 w/w (15 w/ton) @@ -5707,7 +5560,7 @@ namespace VariableSpeedCoils { // Resistive Defrost Heater Capacity = capacity at the first stage IsAutoSize = false; if (varSpeedCoil.VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { - if (varSpeedCoil.DefrostCapacity == AutoSize) { + if (varSpeedCoil.DefrostCapacity == DataSizing::AutoSize) { IsAutoSize = true; } if (varSpeedCoil.DefrostStrategy == Resistive) { @@ -5859,8 +5712,6 @@ namespace VariableSpeedCoils { // AUTHOR Bo Shen, based on WaterToAirHeatPumpSimple:CalcHPCoolingSimple // DATE WRITTEN March 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine is for simulating the cooling mode of the Variable-Speed Water to Air HP Simple @@ -5876,33 +5727,12 @@ namespace VariableSpeedCoils { // Finally, adjust the heat pump outlet conditions based on the PartLoadRatio // and RuntimeFrac. - // Using/Aliasing - using Curve::CurveValue; - Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - using FluidProperties::GetSpecificHeatGlycol; - using Psychrometrics::PsyCpAirFnW; - using Psychrometrics::PsyHFnTdbW; - using Psychrometrics::PsyRhoAirFnPbTdbW; - using Psychrometrics::PsyTdbFnHW; - using Psychrometrics::PsyTwbFnTdbWPb; - using Psychrometrics::PsyWFnTdbH; - using Psychrometrics::PsyWFnTdbTwbPb; - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("CalcVarSpeedCoilCooling"); static constexpr std::string_view RoutineNameSourceSideInletTemp("CalcVarSpeedCoilCooling:SourceSideInletTemp"); - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na + Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 Twet_Rated; // Twet at rated conditions (coil air flow rate and air temperatures), sec Real64 Gamma_Rated; // Gamma at rated conditions (coil air flow rate and air temperatures) @@ -5958,17 +5788,18 @@ namespace VariableSpeedCoils { // Set indoor air conditions to the rated condition state.dataVariableSpeedCoils->LoadSideInletDBTemp_Init = 26.7; state.dataVariableSpeedCoils->LoadSideInletHumRat_Init = 0.0111; - state.dataVariableSpeedCoils->LoadSideInletEnth_Init = - PsyHFnTdbW(state.dataVariableSpeedCoils->LoadSideInletDBTemp_Init, state.dataVariableSpeedCoils->LoadSideInletHumRat_Init); - state.dataVariableSpeedCoils->CpAir_Init = PsyCpAirFnW(state.dataVariableSpeedCoils->LoadSideInletHumRat_Init); + state.dataVariableSpeedCoils->LoadSideInletEnth_Init = Psychrometrics::PsyHFnTdbW(state.dataVariableSpeedCoils->LoadSideInletDBTemp_Init, + state.dataVariableSpeedCoils->LoadSideInletHumRat_Init); + state.dataVariableSpeedCoils->CpAir_Init = Psychrometrics::PsyCpAirFnW(state.dataVariableSpeedCoils->LoadSideInletHumRat_Init); state.dataVariableSpeedCoils->firstTime = false; } - state.dataVariableSpeedCoils->LoadSideInletWBTemp_Init = PsyTwbFnTdbWPb(state, - state.dataVariableSpeedCoils->LoadSideInletDBTemp_Init, - state.dataVariableSpeedCoils->LoadSideInletHumRat_Init, - state.dataEnvrn->OutBaroPress, - RoutineName); + state.dataVariableSpeedCoils->LoadSideInletWBTemp_Init = + Psychrometrics::PsyTwbFnTdbWPb(state, + state.dataVariableSpeedCoils->LoadSideInletDBTemp_Init, + state.dataVariableSpeedCoils->LoadSideInletHumRat_Init, + state.dataEnvrn->OutBaroPress, + RoutineName); MaxSpeed = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; @@ -6008,10 +5839,10 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->OutdoorWetBulb_CalcVarSpeedCoilCooling = state.dataEnvrn->OutWetBulbTemp; } - RhoSourceAir = PsyRhoAirFnPbTdbW(state, - state.dataVariableSpeedCoils->OutdoorPressure_CalcVarSpeedCoilCooling, - state.dataVariableSpeedCoils->OutdoorDryBulb_CalcVarSpeedCoilCooling, - state.dataVariableSpeedCoils->OutdoorHumRat_CalcVarSpeedCoilCooling); + RhoSourceAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, + state.dataVariableSpeedCoils->OutdoorPressure_CalcVarSpeedCoilCooling, + state.dataVariableSpeedCoils->OutdoorDryBulb_CalcVarSpeedCoilCooling, + state.dataVariableSpeedCoils->OutdoorHumRat_CalcVarSpeedCoilCooling); if ((SpeedNum == 1) || (SpeedNum > MaxSpeed) || (SpeedRatio == 1.0)) { CondAirMassFlow = RhoSourceAir * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapCondAirFlow(SpeedCal); @@ -6034,10 +5865,10 @@ namespace VariableSpeedCoils { (state.dataVariableSpeedCoils->OutdoorDryBulb_CalcVarSpeedCoilCooling - state.dataVariableSpeedCoils->OutdoorWetBulb_CalcVarSpeedCoilCooling) * (1.0 - EvapCondEffectSped); - CondInletHumRat = PsyWFnTdbTwbPb(state, - CondInletTemp, - state.dataVariableSpeedCoils->OutdoorWetBulb_CalcVarSpeedCoilCooling, - state.dataVariableSpeedCoils->OutdoorPressure_CalcVarSpeedCoilCooling); + CondInletHumRat = Psychrometrics::PsyWFnTdbTwbPb(state, + CondInletTemp, + state.dataVariableSpeedCoils->OutdoorWetBulb_CalcVarSpeedCoilCooling, + state.dataVariableSpeedCoils->OutdoorPressure_CalcVarSpeedCoilCooling); state.dataVariableSpeedCoils->CompAmbTemp_CalcVarSpeedCoilCooling = CondInletTemp; } else { // AIR COOLED CONDENSER CondInletTemp = state.dataVariableSpeedCoils->OutdoorDryBulb_CalcVarSpeedCoilCooling; // Outdoor dry-bulb temp @@ -6048,8 +5879,8 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->SourceSideMassFlowRate = CondAirMassFlow; state.dataVariableSpeedCoils->SourceSideInletTemp = CondInletTemp; - state.dataVariableSpeedCoils->SourceSideInletEnth = PsyHFnTdbW(CondInletTemp, CondInletHumRat); - CpSource = PsyCpAirFnW(CondInletHumRat); + state.dataVariableSpeedCoils->SourceSideInletEnth = Psychrometrics::PsyHFnTdbW(CondInletTemp, CondInletHumRat); + CpSource = Psychrometrics::PsyCpAirFnW(CondInletHumRat); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondInletTemp = CondInletTemp; // If used in a heat pump, the value of MaxOAT in the heating coil overrides that in the cooling coil (in GetInput) @@ -6071,12 +5902,8 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->SourceSideMassFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate; state.dataVariableSpeedCoils->SourceSideInletTemp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp; state.dataVariableSpeedCoils->SourceSideInletEnth = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterEnthalpy; - CpSource = - GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum).FluidName, - state.dataVariableSpeedCoils->SourceSideInletTemp, - state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum).FluidIndex, - RoutineNameSourceSideInletTemp); + CpSource = state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataVariableSpeedCoils->SourceSideInletTemp, RoutineNameSourceSideInletTemp); } // Check for flows, do not perform simulation if no flow in load side or source side. @@ -6123,14 +5950,14 @@ namespace VariableSpeedCoils { LoadSideInletDBTemp_Unit = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp; LoadSideInletHumRat_Unit = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat; LoadSideInletWBTemp_Unit = - PsyTwbFnTdbWPb(state, LoadSideInletDBTemp_Unit, LoadSideInletHumRat_Unit, state.dataEnvrn->OutBaroPress, RoutineName); + Psychrometrics::PsyTwbFnTdbWPb(state, LoadSideInletDBTemp_Unit, LoadSideInletHumRat_Unit, state.dataEnvrn->OutBaroPress, RoutineName); LoadSideInletEnth_Unit = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirEnthalpy; - CpAir_Unit = PsyCpAirFnW(LoadSideInletHumRat_Unit); + CpAir_Unit = Psychrometrics::PsyCpAirFnW(LoadSideInletHumRat_Unit); state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 1.0; if ((SpeedNum == 1) && (PartLoadRatio < 1.0)) { - PLF = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, PartLoadRatio); + PLF = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, PartLoadRatio); if (PLF < 0.7) { PLF = 0.7; } @@ -6184,9 +6011,9 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate; } - CBFSpeed = AdjustCBF(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF(SpeedCal), - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal), - state.dataVariableSpeedCoils->LoadSideMassFlowRate); + CBFSpeed = DXCoils::AdjustCBF(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF(SpeedCal), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal), + state.dataVariableSpeedCoils->LoadSideMassFlowRate); if (CBFSpeed > 0.999) CBFSpeed = 0.999; @@ -6217,25 +6044,26 @@ namespace VariableSpeedCoils { 1, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).capModFacTotal); - EIRTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletWBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); - EIRAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + EIRTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletWBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); + EIRAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { EIRWaterFFModFac = 1.0; } else { EIRWaterFFModFac = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); } EIR = (1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * EIRWaterFFModFac; - CBFSpeed = AdjustCBF(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF(SpeedCal), - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal), - state.dataVariableSpeedCoils->LoadSideMassFlowRate); + CBFSpeed = DXCoils::AdjustCBF(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF(SpeedCal), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal), + state.dataVariableSpeedCoils->LoadSideMassFlowRate); if (CBFSpeed > 0.999) CBFSpeed = 0.999; @@ -6273,10 +6101,10 @@ namespace VariableSpeedCoils { } else { QWasteHeat = state.dataVariableSpeedCoils->Winput * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); - QWasteHeat *= CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletWBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); + QWasteHeat *= Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletWBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); } } else { AirMassFlowRatio = @@ -6324,17 +6152,18 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).capModFacTotal); SpeedCal = SpeedNum - 1; - EIRTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletWBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); - EIRAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + EIRTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletWBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); + EIRAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { EIRWaterFFModFac = 1.0; } else { EIRWaterFFModFac = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); } EIR = (1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * @@ -6345,24 +6174,25 @@ namespace VariableSpeedCoils { QWasteHeat1 = 0.0; } else { QWasteHeat1 = Winput1 * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); - QWasteHeat1 *= CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletWBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); + QWasteHeat1 *= Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletWBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); } SpeedCal = SpeedNum; - EIRTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletWBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); - EIRAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + EIRTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletWBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); + EIRAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_CoolingAirToAirVariableSpeed) { EIRWaterFFModFac = 1.0; } else { EIRWaterFFModFac = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); } EIR = (1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * @@ -6373,10 +6203,10 @@ namespace VariableSpeedCoils { QWasteHeat2 = 0.0; } else { QWasteHeat2 = Winput2 * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); - QWasteHeat2 *= CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletWBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); + QWasteHeat2 *= Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletWBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); } state.dataVariableSpeedCoils->Winput = Winput2 * SpeedRatio + (1.0 - SpeedRatio) * Winput1; @@ -6442,7 +6272,7 @@ namespace VariableSpeedCoils { // H2O [m3/s] = Delta W[kgWater/kgDryAir]*Mass Flow Air[kgDryAir/s] // /RhoWater [kgWater/m3] //****************** - RhoEvapCondWater = RhoH2O(state.dataVariableSpeedCoils->OutdoorDryBulb_CalcVarSpeedCoilCooling); + RhoEvapCondWater = Psychrometrics::RhoH2O(state.dataVariableSpeedCoils->OutdoorDryBulb_CalcVarSpeedCoilCooling); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterConsumpRate = (CondInletHumRat - state.dataVariableSpeedCoils->OutdoorHumRat_CalcVarSpeedCoilCooling) * CondAirMassFlow / RhoEvapCondWater * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac; @@ -6452,7 +6282,7 @@ namespace VariableSpeedCoils { // Calculate basin heater power CalcBasinHeaterPower(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterPowerFTempDiff, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterSchedulePtr, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).basinHeaterSched, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterSetPointTemp, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterPower); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).BasinHeaterPower *= @@ -6480,18 +6310,18 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->LoadSideInletDBTemp - state.dataVariableSpeedCoils->QSensible / (state.dataVariableSpeedCoils->LoadSideMassFlowRate * CpAir); - MaxHumRat = PsyWFnTdbRhPb(state, - state.dataVariableSpeedCoils->LoadSideOutletDBTemp, - 0.9999, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirPressure, - RoutineName); - MaxOutletEnth = PsyHFnTdbW(state.dataVariableSpeedCoils->LoadSideOutletDBTemp, MaxHumRat); + MaxHumRat = Psychrometrics::PsyWFnTdbRhPb(state, + state.dataVariableSpeedCoils->LoadSideOutletDBTemp, + 0.9999, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirPressure, + RoutineName); + MaxOutletEnth = Psychrometrics::PsyHFnTdbW(state.dataVariableSpeedCoils->LoadSideOutletDBTemp, MaxHumRat); if (state.dataVariableSpeedCoils->LoadSideOutletEnth > MaxOutletEnth) { state.dataVariableSpeedCoils->LoadSideOutletEnth = MaxOutletEnth; // QLoadTotal = LoadSideMassFlowRate * (LoadSideInletEnth - LoadSideOutletEnth) } - state.dataVariableSpeedCoils->LoadSideOutletHumRat = - PsyWFnTdbH(state, state.dataVariableSpeedCoils->LoadSideOutletDBTemp, state.dataVariableSpeedCoils->LoadSideOutletEnth, RoutineName); + state.dataVariableSpeedCoils->LoadSideOutletHumRat = Psychrometrics::PsyWFnTdbH( + state, state.dataVariableSpeedCoils->LoadSideOutletDBTemp, state.dataVariableSpeedCoils->LoadSideOutletEnth, RoutineName); if (state.dataVariableSpeedCoils->LoadSideOutletHumRat > MaxHumRat) { state.dataVariableSpeedCoils->LoadSideOutletHumRat = MaxHumRat; } @@ -6507,8 +6337,8 @@ namespace VariableSpeedCoils { PartLoadRatio * state.dataVariableSpeedCoils->LoadSideOutletHumRat + (1.0 - PartLoadRatio) * state.dataVariableSpeedCoils->LoadSideInletHumRat; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp = - PsyTdbFnHW(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat); + Psychrometrics::PsyTdbFnHW(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat); state.dataVariableSpeedCoils->PLRCorrLoadSideMdot = state.dataVariableSpeedCoils->LoadSideMassFlowRate; } else { // default to cycling fan, cycling compressor @@ -6555,11 +6385,11 @@ namespace VariableSpeedCoils { } state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = state.dataVariableSpeedCoils->PLRCorrLoadSideMdot; - rhoair = PsyRhoAirFnPbTdbW(state, - state.dataEnvrn->OutBaroPress, - state.dataVariableSpeedCoils->LoadSideInletDBTemp, - state.dataVariableSpeedCoils->LoadSideInletHumRat, - RoutineName); + rhoair = Psychrometrics::PsyRhoAirFnPbTdbW(state, + state.dataEnvrn->OutBaroPress, + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->LoadSideInletHumRat, + RoutineName); // This seems wrong, initializing mass flow rate to StdRhoAir or actual air density, // then using that mass flow rate, then back calculating volume using inlet conditions. // Volume should be constant through a fan and air mass flow rate should vary based on inlet conditions. @@ -6586,9 +6416,9 @@ namespace VariableSpeedCoils { if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CondensateCollectMode == CondensateToTank) { // calculate and report condensation rates (how much water extracted from the air stream) // water flow of water in m3/s for water system interactions - RhoWater = RhoH2O((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp + - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp) / - 2.0); + RhoWater = Psychrometrics::RhoH2O((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp + + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp) / + 2.0); // CR9155 Remove specific humidity calculations SpecHumIn = state.dataVariableSpeedCoils->LoadSideInletHumRat; SpecHumOut = state.dataVariableSpeedCoils->LoadSideOutletHumRat; @@ -6625,18 +6455,9 @@ namespace VariableSpeedCoils { // water temperature. In addition, knowledge of the fan heat is required to back into // a compressor COP. - // Using/Aliasing - using Curve::CurveValue; - Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("CalcVarSpeedHPWH"); - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na + Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 OperatingHeatingCapacity; // Water heating operating capacity including the impact of capacity and COP curves (W) @@ -6671,7 +6492,6 @@ namespace VariableSpeedCoils { Real64 Winput1; // power consumption at low speed Real64 Winput2; // power consumption at high speed Real64 LoadPressure; // evaporator inlet pressure - Real64 CrankcaseHeatingPower; // power due to crankcase heater Real64 hDelta; // Change in air enthalpy across the cooling coil [J/kg] Real64 hADP; // Apparatus dew point enthalpy [J/kg] Real64 tADP; // Apparatus dew point temperature [C] @@ -6683,29 +6503,24 @@ namespace VariableSpeedCoils { Real64 MaxHumRat; // max possible humidity Real64 MaxOutletEnth; // max possible outlet enthalpy int EvapInletNode; // Evaporator air inlet node number - int EvapOutletNode; // Evaporator air outlet node number - int CondInletNode; // Condenser water inlet node number - int CondOutletNode; // Condenser water outlet node number - int MaxSpeed; // maximum speed level int SpeedCal; // calculated speed level - Real64 rhoair(0.0); // entering air density - Real64 RhoWater(0.0); // water density + Real64 rhoair = 0.0; // entering air density + Real64 RhoWater = 0.0; // water density // note: load side is the evaporator side, and source side is the condenser side - CondInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum; - CondOutletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum; + int CondInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterInletNodeNum; + int CondOutletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterOutletNodeNum; // If heat pump water heater is OFF, set outlet to inlet and RETURN if (PartLoadRatio == 0.0) { state.dataLoopNodes->Node(CondOutletNode) = state.dataLoopNodes->Node(CondInletNode); return; } else { EvapInletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirInletNodeNum; - EvapOutletNode = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirOutletNodeNum; InletWaterTemp = state.dataLoopNodes->Node(CondInletNode).Temp; CondInletMassFlowRate = state.dataLoopNodes->Node(CondInletNode).MassFlowRate; EvapInletMassFlowRate = state.dataLoopNodes->Node(EvapInletNode).MassFlowRate; - CpWater = CPHW(InletWaterTemp); + CpWater = Psychrometrics::CPHW(InletWaterTemp); CompressorPower = 0.0; OperatingHeatingPower = 0.0; TankHeatingCOP = 0.0; @@ -6728,7 +6543,7 @@ namespace VariableSpeedCoils { } // check if indoor evaporator or outdoor evaporator - CrankcaseHeatingPower = 0.0; + Real64 CrankcaseHeatingPower = 0.0; if (EvapInletNode != 0) { state.dataVariableSpeedCoils->LoadSideInletDBTemp = state.dataLoopNodes->Node(EvapInletNode).Temp; state.dataVariableSpeedCoils->LoadSideInletHumRat = state.dataLoopNodes->Node(EvapInletNode).HumRat; @@ -6771,20 +6586,11 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = true; } - MaxSpeed = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; - - // must be placed inside the loop, otherwise cause bug in release mode, need to be present at two places - if (SpeedNum > MaxSpeed) { - SpeedCal = MaxSpeed; - } else { - SpeedCal = SpeedNum; - } - // part-load calculation state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 1.0; if ((SpeedNum == 1) && (PartLoadRatio < 1.0)) { - PLF = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, PartLoadRatio); + PLF = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, PartLoadRatio); if (PLF < 0.7) { PLF = 0.7; } @@ -6802,6 +6608,8 @@ namespace VariableSpeedCoils { } } + int MaxSpeed = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; + // interpolate between speeds // must be placed inside the loop, otherwise cause bug in release mode if (SpeedNum > MaxSpeed) { @@ -6822,24 +6630,27 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPower(SpeedCal); - COPTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), - InletAirTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); - COPAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); - COPWaterFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + COPTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), + InletAirTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); + COPAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + COPWaterFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); COP = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal) * COPTempModFac * COPAirFFModFac * COPWaterFFModFac; - TOTCAPTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), - InletAirTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); + TOTCAPTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), + InletAirTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); // Get capacity modifying factor (function of mass flow) for off-rated conditions - TOTCAPAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); + TOTCAPAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); // Get capacity modifying factor (function of mass flow) for off-rated conditions TOTCAPWaterFFModFac = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); OperatingHeatingCapacity = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * TOTCAPTempModFac * TOTCAPAirFFModFac * TOTCAPWaterFFModFac; @@ -6895,9 +6706,9 @@ namespace VariableSpeedCoils { EvapCoolingCapacity = TotalTankHeatingCapacity - CompressorPower; } - CBFSpeed = AdjustCBF(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF(SpeedCal), - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal), - state.dataVariableSpeedCoils->LoadSideMassFlowRate); + CBFSpeed = DXCoils::AdjustCBF(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCBF(SpeedCal), + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedAirMassFlowRate(SpeedCal), + state.dataVariableSpeedCoils->LoadSideMassFlowRate); } else { AirMassFlowRatio = @@ -6913,30 +6724,32 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPower(SpeedCal); - COPTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), - InletAirTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); - COPAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); - COPWaterFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + COPTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), + InletAirTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); + COPAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + COPWaterFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); COP = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal) * COPTempModFac * COPAirFFModFac * COPWaterFFModFac; - TOTCAPTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), - InletAirTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); + TOTCAPTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), + InletAirTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); // Get capacity modifying factor (function of mass flow) for off-rated conditions - TOTCAPAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); + TOTCAPAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); // Get capacity modifying factor (function of mass flow) for off-rated conditions TOTCAPWaterFFModFac = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); OperatingHeatingCapacity = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * TOTCAPTempModFac * TOTCAPAirFFModFac * TOTCAPWaterFFModFac; state.dataVariableSpeedCoils->Winput = OperatingHeatingCapacity / COP; - OperatingHeatingPower = state.dataVariableSpeedCoils->Winput; Winput1 = state.dataVariableSpeedCoils->Winput; WHCAP1 = OperatingHeatingCapacity; @@ -6945,32 +6758,32 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).HPWHCondPumpElecNomPower = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWHPumpPower(SpeedCal); - COPTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), - InletAirTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); - COPAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); - COPWaterFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + COPTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), + InletAirTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); + COPAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + COPWaterFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); COP = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal) * COPTempModFac * COPAirFFModFac * COPWaterFFModFac; - TOTCAPTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), - InletAirTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); + TOTCAPTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), + InletAirTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); // Get capacity modifying factor (function of mass flow) for off-rated conditions - TOTCAPAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); + TOTCAPAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); // Get capacity modifying factor (function of mass flow) for off-rated conditions TOTCAPWaterFFModFac = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); OperatingHeatingCapacity = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * TOTCAPTempModFac * TOTCAPAirFFModFac * TOTCAPWaterFFModFac; - state.dataVariableSpeedCoils->Winput = OperatingHeatingCapacity / COP; - OperatingHeatingPower = state.dataVariableSpeedCoils->Winput; - - Winput2 = state.dataVariableSpeedCoils->Winput; + Winput2 = OperatingHeatingCapacity / COP; WHCAP2 = OperatingHeatingCapacity; // interpolation @@ -7043,9 +6856,9 @@ namespace VariableSpeedCoils { } else { hDelta = state.dataVariableSpeedCoils->QLoadTotal / state.dataVariableSpeedCoils->LoadSideMassFlowRate; hADP = state.dataVariableSpeedCoils->LoadSideInletEnth - hDelta / (1.0 - CBFSpeed); - tADP = PsyTsatFnHPb(state, hADP, LoadPressure, RoutineName); - wADP = PsyWFnTdbH(state, tADP, hADP, RoutineName); - hTinwADP = PsyHFnTdbW(state.dataVariableSpeedCoils->LoadSideInletDBTemp, wADP); + tADP = Psychrometrics::PsyTsatFnHPb(state, hADP, LoadPressure, RoutineName); + wADP = Psychrometrics::PsyWFnTdbH(state, tADP, hADP, RoutineName); + hTinwADP = Psychrometrics::PsyHFnTdbW(state.dataVariableSpeedCoils->LoadSideInletDBTemp, wADP); if ((state.dataVariableSpeedCoils->LoadSideInletEnth - hADP) > 1.e-10) { SHR = min((hTinwADP - hADP) / (state.dataVariableSpeedCoils->LoadSideInletEnth - hADP), 1.0); } else { @@ -7088,22 +6901,22 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->LoadSideOutletEnth = state.dataVariableSpeedCoils->LoadSideInletEnth - state.dataVariableSpeedCoils->QLoadTotal / state.dataVariableSpeedCoils->LoadSideMassFlowRate; - CpAir = PsyCpAirFnW(state.dataVariableSpeedCoils->LoadSideInletHumRat); + CpAir = Psychrometrics::PsyCpAirFnW(state.dataVariableSpeedCoils->LoadSideInletHumRat); state.dataVariableSpeedCoils->LoadSideOutletDBTemp = state.dataVariableSpeedCoils->LoadSideInletDBTemp - state.dataVariableSpeedCoils->QSensible / (state.dataVariableSpeedCoils->LoadSideMassFlowRate * CpAir); - MaxHumRat = PsyWFnTdbRhPb(state, - state.dataVariableSpeedCoils->LoadSideOutletDBTemp, - 0.9999, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirPressure, - RoutineName); - MaxOutletEnth = PsyHFnTdbW(state.dataVariableSpeedCoils->LoadSideOutletDBTemp, MaxHumRat); + MaxHumRat = Psychrometrics::PsyWFnTdbRhPb(state, + state.dataVariableSpeedCoils->LoadSideOutletDBTemp, + 0.9999, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirPressure, + RoutineName); + MaxOutletEnth = Psychrometrics::PsyHFnTdbW(state.dataVariableSpeedCoils->LoadSideOutletDBTemp, MaxHumRat); if (state.dataVariableSpeedCoils->LoadSideOutletEnth > MaxOutletEnth) { state.dataVariableSpeedCoils->LoadSideOutletEnth = MaxOutletEnth; } - state.dataVariableSpeedCoils->LoadSideOutletHumRat = - PsyWFnTdbH(state, state.dataVariableSpeedCoils->LoadSideOutletDBTemp, state.dataVariableSpeedCoils->LoadSideOutletEnth, RoutineName); + state.dataVariableSpeedCoils->LoadSideOutletHumRat = Psychrometrics::PsyWFnTdbH( + state, state.dataVariableSpeedCoils->LoadSideOutletDBTemp, state.dataVariableSpeedCoils->LoadSideOutletEnth, RoutineName); if (state.dataVariableSpeedCoils->LoadSideOutletHumRat > MaxHumRat) { state.dataVariableSpeedCoils->LoadSideOutletHumRat = MaxHumRat; } @@ -7118,8 +6931,8 @@ namespace VariableSpeedCoils { PartLoadRatio * state.dataVariableSpeedCoils->LoadSideOutletHumRat + (1.0 - PartLoadRatio) * state.dataVariableSpeedCoils->LoadSideInletHumRat; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp = - PsyTdbFnHW(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat); + Psychrometrics::PsyTdbFnHW(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat); state.dataVariableSpeedCoils->PLRCorrLoadSideMdot = state.dataVariableSpeedCoils->LoadSideMassFlowRate; } else { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy = state.dataVariableSpeedCoils->LoadSideOutletEnth; @@ -7168,15 +6981,15 @@ namespace VariableSpeedCoils { } state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = state.dataVariableSpeedCoils->PLRCorrLoadSideMdot; - rhoair = PsyRhoAirFnPbTdbW(state, - state.dataEnvrn->OutBaroPress, - state.dataVariableSpeedCoils->LoadSideInletDBTemp, - state.dataVariableSpeedCoils->LoadSideInletHumRat, - RoutineName); + rhoair = Psychrometrics::PsyRhoAirFnPbTdbW(state, + state.dataEnvrn->OutBaroPress, + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->LoadSideInletHumRat, + RoutineName); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate / rhoair; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate = state.dataVariableSpeedCoils->SourceSideMassFlowRate; - RhoWater = RhoH2O(InletWaterTemp); // initialize + RhoWater = Psychrometrics::RhoH2O(InletWaterTemp); // initialize state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate / RhoWater; @@ -7227,8 +7040,6 @@ namespace VariableSpeedCoils { // AUTHOR Bo Shen, based on WaterToAirHeatPumpSimple:CalcHPHeatingSimple // DATE WRITTEN March 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine is for simulating the heating mode of the Variable Speed Water to Air HP Simple @@ -7238,34 +7049,13 @@ namespace VariableSpeedCoils { // Finally, adjust the heat pump outlet conditions based on the PartLoadRatio // and RuntimeFrac. - // Using/Aliasing - using Curve::CurveValue; - Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - using FluidProperties::GetSpecificHeatGlycol; - using Psychrometrics::PsyCpAirFnW; - using Psychrometrics::PsyHFnTdbW; - using Psychrometrics::PsyRhoAirFnPbTdbW; - using Psychrometrics::PsyTdbFnHW; - using Psychrometrics::PsyTwbFnTdbWPb; - using Psychrometrics::PsyWFnTdbH; - using Psychrometrics::PsyWFnTdbTwbPb; - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("CalcVarSpeedCoilHeating"); static constexpr std::string_view RoutineNameSourceSideInletTemp("CalcVarSpeedCoilHeating:SourceSideInletTemp"); - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na + Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 CpSource; // Specific heat of water [J/kg_C] - Real64 CpAir; // Specific heat of air [J/kg_C] Real64 AirMassFlowRatio; // airflow ratio at low speed Real64 WaterMassFlowRatio; // airflow ratio at high speed Real64 TotCapAirFFModFac; // air flow fraction modification @@ -7275,7 +7065,6 @@ namespace VariableSpeedCoils { Real64 EIRWaterFFModFac; // water flow fraction modification Real64 EIRTempModFac; // total capacity temperature correction fraction Real64 EIR; // total capacity temperature correction fraction - int MaxSpeed; // maximum speed level int SpeedCal; // calculated speed level Real64 QLoadTotal1; // heating capacity at low speed Real64 QLoadTotal2; // heating capacity at high speed @@ -7288,7 +7077,7 @@ namespace VariableSpeedCoils { Real64 rhoair(0.0); // entering air density // ADDED VARIABLES FOR air source coil - MaxSpeed = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; + int MaxSpeed = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; // LOAD LOCAL VARIABLES FROM DATA STRUCTURE (for code readability) if (!(fanOp == HVAC::FanOp::Continuous) && PartLoadRatio > 0.0) { @@ -7300,13 +7089,13 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->LoadSideInletDBTemp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirDBTemp; state.dataVariableSpeedCoils->LoadSideInletHumRat = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirHumRat; - state.dataVariableSpeedCoils->LoadSideInletWBTemp = PsyTwbFnTdbWPb(state, - state.dataVariableSpeedCoils->LoadSideInletDBTemp, - state.dataVariableSpeedCoils->LoadSideInletHumRat, - state.dataEnvrn->OutBaroPress, - RoutineName); + state.dataVariableSpeedCoils->LoadSideInletWBTemp = Psychrometrics::PsyTwbFnTdbWPb(state, + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->LoadSideInletHumRat, + state.dataEnvrn->OutBaroPress, + RoutineName); state.dataVariableSpeedCoils->LoadSideInletEnth = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletAirEnthalpy; - CpAir = PsyCpAirFnW(state.dataVariableSpeedCoils->LoadSideInletHumRat); + Real64 CpAir = Psychrometrics::PsyCpAirFnW(state.dataVariableSpeedCoils->LoadSideInletHumRat); // Specific heat of air [J/kg_C] if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { // Get condenser outdoor node info from DX Heating Coil @@ -7328,8 +7117,8 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->SourceSideMassFlowRate = 1.0; // not used and avoid divided by zero state.dataVariableSpeedCoils->SourceSideInletTemp = state.dataVariableSpeedCoils->OutdoorDryBulb; state.dataVariableSpeedCoils->SourceSideInletEnth = - PsyHFnTdbW(state.dataVariableSpeedCoils->OutdoorDryBulb, state.dataVariableSpeedCoils->OutdoorHumRat); - CpSource = PsyCpAirFnW(state.dataEnvrn->OutHumRat); + Psychrometrics::PsyHFnTdbW(state.dataVariableSpeedCoils->OutdoorDryBulb, state.dataVariableSpeedCoils->OutdoorHumRat); + CpSource = Psychrometrics::PsyCpAirFnW(state.dataEnvrn->OutHumRat); // Initialize crankcase heater, operates below OAT defined in input deck for HP DX heating coil if (state.dataVariableSpeedCoils->OutdoorDryBulb < state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxOATCrankcaseHeater) { @@ -7347,12 +7136,8 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->SourceSideMassFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).WaterMassFlowRate; state.dataVariableSpeedCoils->SourceSideInletTemp = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterTemp; state.dataVariableSpeedCoils->SourceSideInletEnth = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).InletWaterEnthalpy; - CpSource = - GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum).FluidName, - state.dataVariableSpeedCoils->SourceSideInletTemp, - state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum).FluidIndex, - RoutineNameSourceSideInletTemp); + CpSource = state.dataPlnt->PlantLoop(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataVariableSpeedCoils->SourceSideInletTemp, RoutineNameSourceSideInletTemp); } // Check for flows, do not perform simulation if no flow in load side or source side. @@ -7383,7 +7168,7 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RunFrac = 1.0; state.dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; if ((SpeedNum == 1) && (PartLoadRatio < 1.0)) { - PLF = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, PartLoadRatio); + PLF = Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PLFFPLR, PartLoadRatio); if (PLF < 0.7) { PLF = 0.7; } @@ -7412,17 +7197,18 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DesignWaterMassFlowRate; } - TotCapTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletDBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); - TotCapAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); + TotCapTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); + TotCapAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { TotCapWaterFFModFac = 1.0; } else { TotCapWaterFFModFac = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); } state.dataVariableSpeedCoils->QLoadTotal = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * @@ -7431,17 +7217,18 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->TotRatedCapacity = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal); // for defrosting power cal - EIRTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletDBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); - EIRAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + EIRTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); + EIRAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { EIRWaterFFModFac = 1.0; } else { EIRWaterFFModFac = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); } EIR = (1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * @@ -7452,10 +7239,10 @@ namespace VariableSpeedCoils { QWasteHeat = 0.0; } else { QWasteHeat = state.dataVariableSpeedCoils->Winput * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); - QWasteHeat *= CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletDBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); + QWasteHeat *= Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); } } else { @@ -7470,33 +7257,35 @@ namespace VariableSpeedCoils { } SpeedCal = SpeedNum - 1; - TotCapTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletDBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); - TotCapAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); + TotCapTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); + TotCapAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { TotCapWaterFFModFac = 1.0; } else { TotCapWaterFFModFac = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); } QLoadTotal1 = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * TotCapTempModFac * TotCapAirFFModFac * TotCapWaterFFModFac; - EIRTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletDBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); - EIRAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + EIRTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); + EIRAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { EIRWaterFFModFac = 1.0; } else { EIRWaterFFModFac = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); } EIR = (1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * @@ -7507,40 +7296,42 @@ namespace VariableSpeedCoils { QWasteHeat1 = 0.0; } else { QWasteHeat1 = Winput1 * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); - QWasteHeat1 *= CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletDBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); + QWasteHeat1 *= Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); } SpeedCal = SpeedNum; - TotCapTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletDBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); - TotCapAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); + TotCapTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapFTemp(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); + TotCapAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapAirFFlow(SpeedCal), AirMassFlowRatio); if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { TotCapWaterFFModFac = 1.0; } else { TotCapWaterFFModFac = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSCCapWaterFFlow(SpeedCal), WaterMassFlowRatio); } QLoadTotal2 = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(SpeedCal) * TotCapTempModFac * TotCapAirFFModFac * TotCapWaterFFModFac; - EIRTempModFac = CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletDBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); - EIRAirFFModFac = CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); + EIRTempModFac = Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRFTemp(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); + EIRAirFFModFac = + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRAirFFlow(SpeedCal), AirMassFlowRatio); if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == HVAC::Coil_HeatingAirToAirVariableSpeed) { EIRWaterFFModFac = 1.0; } else { EIRWaterFFModFac = - CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); + Curve::CurveValue(state, state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSEIRWaterFFlow(SpeedCal), WaterMassFlowRatio); } EIR = (1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedCOP(SpeedCal)) * EIRTempModFac * EIRAirFFModFac * @@ -7551,10 +7342,10 @@ namespace VariableSpeedCoils { QWasteHeat2 = 0.0; } else { QWasteHeat2 = Winput2 * state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeatFrac(SpeedCal); - QWasteHeat2 *= CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), - state.dataVariableSpeedCoils->LoadSideInletDBTemp, - state.dataVariableSpeedCoils->SourceSideInletTemp); + QWasteHeat2 *= Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSWasteHeat(SpeedCal), + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->SourceSideInletTemp); } state.dataVariableSpeedCoils->QLoadTotal = QLoadTotal2 * SpeedRatio + (1.0 - SpeedRatio) * QLoadTotal1; @@ -7574,7 +7365,7 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->OutdoorCoildw = max(1.0e-6, (state.dataVariableSpeedCoils->OutdoorHumRat - - PsyWFnTdpPb(state, state.dataVariableSpeedCoils->OutdoorCoilT, state.dataVariableSpeedCoils->OutdoorPressure))); + Psychrometrics::PsyWFnTdpPb(state, state.dataVariableSpeedCoils->OutdoorCoilT, state.dataVariableSpeedCoils->OutdoorPressure))); // Initializing defrost adjustment factors state.dataVariableSpeedCoils->LoadDueToDefrost = 0.0; @@ -7605,10 +7396,10 @@ namespace VariableSpeedCoils { (7.222 - state.dataVariableSpeedCoils->OutdoorDryBulb) * (state.dataVariableSpeedCoils->TotRatedCapacity / 1.01667); state.dataVariableSpeedCoils->DefrostEIRTempModFac = - CurveValue(state, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostEIRFT, - max(15.555, state.dataVariableSpeedCoils->LoadSideInletWBTemp), - max(15.555, state.dataVariableSpeedCoils->OutdoorDryBulb)); + Curve::CurveValue(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostEIRFT, + max(15.555, state.dataVariableSpeedCoils->LoadSideInletWBTemp), + max(15.555, state.dataVariableSpeedCoils->OutdoorDryBulb)); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).DefrostPower = state.dataVariableSpeedCoils->DefrostEIRTempModFac * (state.dataVariableSpeedCoils->TotRatedCapacity / 1.01667) * state.dataVariableSpeedCoils->FractionalDefrostTime; @@ -7653,8 +7444,8 @@ namespace VariableSpeedCoils { state.dataVariableSpeedCoils->LoadSideOutletDBTemp = state.dataVariableSpeedCoils->LoadSideInletDBTemp + state.dataVariableSpeedCoils->QSensible / (state.dataVariableSpeedCoils->LoadSideMassFlowRate * CpAir); - state.dataVariableSpeedCoils->LoadSideOutletHumRat = - PsyWFnTdbH(state, state.dataVariableSpeedCoils->LoadSideOutletDBTemp, state.dataVariableSpeedCoils->LoadSideOutletEnth, RoutineName); + state.dataVariableSpeedCoils->LoadSideOutletHumRat = Psychrometrics::PsyWFnTdbH( + state, state.dataVariableSpeedCoils->LoadSideOutletDBTemp, state.dataVariableSpeedCoils->LoadSideOutletEnth, RoutineName); // Actual outlet conditions are "average" for time step if (fanOp == HVAC::FanOp::Continuous) { @@ -7666,8 +7457,8 @@ namespace VariableSpeedCoils { PartLoadRatio * state.dataVariableSpeedCoils->LoadSideOutletHumRat + (1.0 - PartLoadRatio) * state.dataVariableSpeedCoils->LoadSideInletHumRat; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirDBTemp = - PsyTdbFnHW(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy, - state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat); + Psychrometrics::PsyTdbFnHW(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirEnthalpy, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).OutletAirHumRat); state.dataVariableSpeedCoils->PLRCorrLoadSideMdot = state.dataVariableSpeedCoils->LoadSideMassFlowRate; } else { // default to cycling fan, cycling compressor @@ -7708,11 +7499,11 @@ namespace VariableSpeedCoils { } state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).PartLoadRatio = PartLoadRatio; state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate = state.dataVariableSpeedCoils->PLRCorrLoadSideMdot; - rhoair = PsyRhoAirFnPbTdbW(state, - state.dataEnvrn->OutBaroPress, - state.dataVariableSpeedCoils->LoadSideInletDBTemp, - state.dataVariableSpeedCoils->LoadSideInletHumRat, - RoutineName); + rhoair = Psychrometrics::PsyRhoAirFnPbTdbW(state, + state.dataEnvrn->OutBaroPress, + state.dataVariableSpeedCoils->LoadSideInletDBTemp, + state.dataVariableSpeedCoils->LoadSideInletHumRat, + RoutineName); state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).AirMassFlowRate / rhoair; @@ -7743,16 +7534,12 @@ namespace VariableSpeedCoils { // FUNCTION INFORMATION: // AUTHOR Bo Shen, based on WaterToAirHeatPumpSimple:GetCoilCapacity // DATE WRITTEN March 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function looks up the rated coil capacity at the nominal speed level for the given coil and returns it. If // incorrect coil type or name is given, ErrorsFound is returned as true and capacity is returned // as negative. - // Using/Aliasing - // Return value Real64 CoilCapacity; // returned capacity of matched coil @@ -7762,7 +7549,6 @@ namespace VariableSpeedCoils { // Obtains and Allocates WatertoAirHP related parameters from input file if (state.dataVariableSpeedCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetVarSpeedCoilInput(state); - // WaterIndex=FindGlycol('WATER') !Initialize the WaterIndex once state.dataVariableSpeedCoils->GetCoilsInputFlag = false; } @@ -7804,13 +7590,10 @@ namespace VariableSpeedCoils { // FUNCTION INFORMATION: // AUTHOR Bo Shen, based on WaterToAirHeatPumpSimple:GetCoilIndex // DATE WRITTEN March 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: - // This function looks up the coil index for the given coil and returns it. If - // incorrect coil type or name is given, ErrorsFound is returned as true and index is returned - // as zero. + // This function looks up the coil index for the given coil and returns it. If incorrect + // coil type or name is given, ErrorsFound is returned as true and index is returned as zero. // Return value int IndexNum; // returned index of matched coil @@ -7818,7 +7601,6 @@ namespace VariableSpeedCoils { // Obtains and Allocates WatertoAirHP related parameters from input file if (state.dataVariableSpeedCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetVarSpeedCoilInput(state); - // WaterIndex=FindGlycol('WATER') !Initialize the WaterIndex once state.dataVariableSpeedCoils->GetCoilsInputFlag = false; } @@ -7842,13 +7624,10 @@ namespace VariableSpeedCoils { // FUNCTION INFORMATION: // AUTHOR Bo Shen, based on WaterToAirHeatPumpSimple:GetCoilAirFlowRate // DATE WRITTEN March 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: - // This function looks up the max coil air flow rate for the given coil and returns it. If - // incorrect coil type or name is given, ErrorsFound is returned as true and capacity is returned - // as negative. + // This function looks up the max coil air flow rate for the given coil and returns it. If incorrect + // coil type or name is given, ErrorsFound is returned as true and capacity is returned as negative. // Return value Real64 CoilAirFlowRate; // returned air volume flow rate of matched coil @@ -7859,7 +7638,6 @@ namespace VariableSpeedCoils { // Obtains and Allocates WatertoAirHP related parameters from input file if (state.dataVariableSpeedCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetVarSpeedCoilInput(state); - // WaterIndex=FindGlycol('WATER') !Initialize the WaterIndex once state.dataVariableSpeedCoils->GetCoilsInputFlag = false; } @@ -7869,8 +7647,7 @@ namespace VariableSpeedCoils { Util::SameString(CoilType, "COIL:WATERHEATING:AIRTOWATERHEATPUMP:VARIABLESPEED")) { WhichCoil = Util::FindItemInList(CoilName, state.dataVariableSpeedCoils->VarSpeedCoil); if (WhichCoil != 0) { - // CoilAirFlowRate=VarSpeedCoil(WhichCoil)%RatedAirVolFlowRate - if (state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).RatedAirVolFlowRate == AutoSize) { // means autosize + if (state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).RatedAirVolFlowRate == DataSizing::AutoSize) { // means autosize CoilAirFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).RatedAirVolFlowRate; } else { CoilAirFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).MSRatedAirVolFlowRate( @@ -7903,13 +7680,10 @@ namespace VariableSpeedCoils { // FUNCTION INFORMATION: // AUTHOR Bo Shen // DATE WRITTEN 12/2014 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: - // This function looks up the given coil and returns PLR curve index. If - // incorrect coil type or name is given, ErrorsFound is returned as true and value is returned - // as zero. + // This function looks up the given coil and returns PLR curve index. If incorrect + // coil type or name is given, ErrorsFound is returned as true and value is returned as zero. // Return value int PLRNumber; // returned outlet node of matched coil @@ -7920,7 +7694,6 @@ namespace VariableSpeedCoils { // Obtains and Allocates WatertoAirHP related parameters from input file if (state.dataVariableSpeedCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetVarSpeedCoilInput(state); - // WaterIndex=FindGlycol('WATER') !Initialize the WaterIndex once state.dataVariableSpeedCoils->GetCoilsInputFlag = false; } @@ -7949,9 +7722,8 @@ namespace VariableSpeedCoils { // DATE WRITTEN 7/2017 // PURPOSE OF THIS FUNCTION: - // This function looks up the given coil and returns CapFT curve index. If - // incorrect coil index is given, ErrorsFound is returned as true and value is returned - // as zero. + // This function looks up the given coil and returns CapFT curve index. If incorrect + // coil index is given, ErrorsFound is returned as true and value is returned as zero. // Return value int CapFTIndex; // returned CapFT curve index of matched coil @@ -7984,13 +7756,10 @@ namespace VariableSpeedCoils { // FUNCTION INFORMATION: // AUTHOR Bo Shen, based on WaterToAirHeatPumpSimple:GetCoilInletNode // DATE WRITTEN March 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: - // This function looks up the given coil and returns the inlet node. If - // incorrect coil type or name is given, ErrorsFound is returned as true and value is returned - // as zero. + // This function looks up the given coil and returns the inlet node. If incorrect + // coil type or name is given, ErrorsFound is returned as true and value is returned as zero. // Return value int NodeNumber; // returned outlet node of matched coil @@ -8001,7 +7770,6 @@ namespace VariableSpeedCoils { // Obtains and Allocates WatertoAirHP related parameters from input file if (state.dataVariableSpeedCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetVarSpeedCoilInput(state); - // WaterIndex=FindGlycol('WATER') !Initialize the WaterIndex once state.dataVariableSpeedCoils->GetCoilsInputFlag = false; } @@ -8029,13 +7797,10 @@ namespace VariableSpeedCoils { // FUNCTION INFORMATION: // AUTHOR Bo Shen, based on WaterToAirHeatPumpSimple:GetCoilOutletNode // DATE WRITTEN March 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: - // This function looks up the given coil and returns the outlet node. If - // incorrect coil type or name is given, ErrorsFound is returned as true and value is returned - // as zero. + // This function looks up the given coil and returns the outlet node. If incorrect + // coil type or name is given, ErrorsFound is returned as true and value is returned as zero. // Return value int NodeNumber; // returned outlet node of matched coil @@ -8046,7 +7811,6 @@ namespace VariableSpeedCoils { // Obtains and Allocates WatertoAirHP related parameters from input file if (state.dataVariableSpeedCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetVarSpeedCoilInput(state); - // WaterIndex=FindGlycol('WATER') !Initialize the WaterIndex once state.dataVariableSpeedCoils->GetCoilsInputFlag = false; } @@ -8073,8 +7837,6 @@ namespace VariableSpeedCoils { // FUNCTION INFORMATION: // AUTHOR Bo Shen, based on DXCoil:GetCoilCondenserInletNode // DATE WRITTEN July 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function looks up the given coil and returns the condenser inlet node. If @@ -8089,7 +7851,6 @@ namespace VariableSpeedCoils { // Obtains and Allocates WatertoAirHP related parameters from input file if (state.dataVariableSpeedCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetVarSpeedCoilInput(state); - // WaterIndex=FindGlycol('WATER') !Initialize the WaterIndex once state.dataVariableSpeedCoils->GetCoilsInputFlag = false; } @@ -8135,8 +7896,6 @@ namespace VariableSpeedCoils { // FUNCTION INFORMATION: // AUTHOR Richard Raustad, FSEC // DATE WRITTEN March 2013 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // This function looks up the given coil and returns number of speeds. If @@ -8145,16 +7904,13 @@ namespace VariableSpeedCoils { // Return value int Speeds; // returned number of speeds - // FUNCTION LOCAL VARIABLE DECLARATIONS: - int WhichCoil; - // Obtains and Allocates WatertoAirHP related parameters from input file if (state.dataVariableSpeedCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetVarSpeedCoilInput(state); state.dataVariableSpeedCoils->GetCoilsInputFlag = false; } - WhichCoil = Util::FindItemInList(CoilName, state.dataVariableSpeedCoils->VarSpeedCoil); + int WhichCoil = Util::FindItemInList(CoilName, state.dataVariableSpeedCoils->VarSpeedCoil); if (WhichCoil != 0) { Speeds = state.dataVariableSpeedCoils->VarSpeedCoil(WhichCoil).NumOfSpeeds; } else { @@ -8204,17 +7960,13 @@ namespace VariableSpeedCoils { // SUBROUTINE INFORMATION: // AUTHOR Bo Shen, based on WaterToAirHeatPumpSimple:SetWSHPData // DATE WRITTEN March 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // This routine was designed to "push" information from a parent object to - // this WSHP coil object. + // This routine was designed to "push" information from a parent object to this WSHP coil object. // Obtains and Allocates WatertoAirHP related parameters from input file if (state.dataVariableSpeedCoils->GetCoilsInputFlag) { // First time subroutine has been entered GetVarSpeedCoilInput(state); - // WaterIndex=FindGlycol('WATER') !Initialize the WaterIndex once state.dataVariableSpeedCoils->GetCoilsInputFlag = false; } @@ -8248,8 +8000,6 @@ namespace VariableSpeedCoils { // SUBROUTINE INFORMATION: // AUTHOR Bo Shen, based on WaterToAirHeatPumpSimple:UpdateSimpleWSHP // DATE WRITTEN March 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine updates the Water to Air Heat Pump outlet nodes. @@ -8259,13 +8009,6 @@ namespace VariableSpeedCoils { // Using/Aliasing Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - using PlantUtilities::SafeCopyPlantNode; - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int AirInletNode; - int WaterInletNode; - int AirOutletNode; - int WaterOutletNode; auto &varSpeedCoil = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum); @@ -8293,10 +8036,10 @@ namespace VariableSpeedCoils { varSpeedCoil.OutletWaterEnthalpy = varSpeedCoil.InletWaterEnthalpy; } - AirInletNode = varSpeedCoil.AirInletNodeNum; - WaterInletNode = varSpeedCoil.WaterInletNodeNum; - AirOutletNode = varSpeedCoil.AirOutletNodeNum; - WaterOutletNode = varSpeedCoil.WaterOutletNodeNum; + int AirInletNode = varSpeedCoil.AirInletNodeNum; + int WaterInletNode = varSpeedCoil.WaterInletNodeNum; + int AirOutletNode = varSpeedCoil.AirOutletNodeNum; + int WaterOutletNode = varSpeedCoil.WaterOutletNodeNum; // Set the air outlet nodes of the WatertoAirHPSimple state.dataLoopNodes->Node(AirOutletNode).MassFlowRate = state.dataLoopNodes->Node(AirInletNode).MassFlowRate; // LoadSideMassFlowRate @@ -8316,7 +8059,7 @@ namespace VariableSpeedCoils { // Set the water outlet node of the WatertoAirHPSimple // Set the water outlet nodes for properties that just pass through & not used if (WaterInletNode != 0 && WaterOutletNode != 0) { - SafeCopyPlantNode(state, WaterInletNode, WaterOutletNode); + PlantUtilities::SafeCopyPlantNode(state, WaterInletNode, WaterOutletNode); state.dataLoopNodes->Node(WaterOutletNode).Temp = varSpeedCoil.OutletWaterTemp; state.dataLoopNodes->Node(WaterOutletNode).Enthalpy = varSpeedCoil.OutletWaterEnthalpy; } @@ -8406,9 +8149,6 @@ namespace VariableSpeedCoils { // model is used by ultilizing the fan delay time as the time-off (or time duration // for the re-evaporation of moisture from time coil). Refer to Tang, C.C. (2005) - // REFERENCES: - // na - // Return value Real64 SHReff; // Effective sensible heat ratio, includes degradation due to cycling effects @@ -8417,27 +8157,21 @@ namespace VariableSpeedCoils { // at the current operating conditions (sec) Real64 Gamma; // Initial moisture evaporation rate divided by steady-state AC latent capacity // at the current operating conditions - Real64 Twet_Rated; // Twet at rated conditions (coil air flow rate and air temperatures), sec - Real64 Gamma_Rated; // Gamma at rated conditions (coil air flow rate and air temperatures) - Real64 Twet_max; // Maximum allowed value for Twet - Real64 MaxONOFFCyclesperHour; // Maximum cycling rate of heat pump [cycles/hr] - Real64 LatentCapacityTimeConstant; // Latent capacity time constant [s] - Real64 FanDelayTime; // Fan delay time, time delay for the HP's fan to - // shut off after compressor cycle off [s] - Real64 Ton; // Coil on time (sec) - Real64 Toff; // Coil off time (sec) - Real64 Toffa; // Actual coil off time (sec). Equations valid for Toff <= (2.0 * Twet/Gamma) - Real64 aa; // Intermediate variable - Real64 To1; // Intermediate variable (first guess at To). To = time to the start of moisture removal - Real64 To2; // Intermediate variable (second guess at To). To = time to the start of moisture removal - Real64 Error; // Error for iteration (DO) loop - Real64 LHRmult; // Latent Heat Ratio (LHR) multiplier. The effective latent heat ratio LHR = (1-SHRss)*LHRmult - - Twet_Rated = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Twet_Rated; - Gamma_Rated = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Gamma_Rated; - MaxONOFFCyclesperHour = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxONOFFCyclesperHour; - LatentCapacityTimeConstant = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LatentCapacityTimeConstant; - FanDelayTime = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).FanDelayTime; + Real64 Twet_max; // Maximum allowed value for Twet + Real64 Ton; // Coil on time (sec) + Real64 Toff; // Coil off time (sec) + Real64 Toffa; // Actual coil off time (sec). Equations valid for Toff <= (2.0 * Twet/Gamma) + Real64 aa; // Intermediate variable + Real64 To1; // Intermediate variable (first guess at To). To = time to the start of moisture removal + Real64 To2; // Intermediate variable (second guess at To). To = time to the start of moisture removal + Real64 Error; // Error for iteration (DO) loop + Real64 LHRmult; // Latent Heat Ratio (LHR) multiplier. The effective latent heat ratio LHR = (1-SHRss)*LHRmult + + Real64 Twet_Rated = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Twet_Rated; // [s] + Real64 Gamma_Rated = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Gamma_Rated; + Real64 MaxONOFFCyclesperHour = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MaxONOFFCyclesperHour; // [cycles/hr] + Real64 LatentCapacityTimeConstant = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).LatentCapacityTimeConstant; // [s] + Real64 FanDelayTime = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).FanDelayTime; // [s] // No moisture evaporation (latent degradation) occurs for runtime fraction of 1.0 // All latent degradation model parameters cause divide by 0.0 if not greater than 0.0 @@ -8544,8 +8278,7 @@ namespace VariableSpeedCoils { // does NOT employ the exact same methodology to calculate performance as DOE-2, although // some of the DOE-2 curve fits are employed by this model. - // The model checks for coil dryout conditions, and adjusts the calculated performance - // appropriately. + // The model checks for coil dryout conditions, and adjusts the calculated performance appropriately. // REFERENCES: // ASHRAE HVAC 2 Toolkit page 4-81. @@ -8556,13 +8289,10 @@ namespace VariableSpeedCoils { // User Defined Functions to Provide More Accurate Part Load Energy Use and Humidity // Predictions. Proceedings of ACEEE Conference. - // Using/Aliasing - using Curve::CurveValue; - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("CalcTotCapSHR_VSWSHP"); - constexpr int MaxIter(30); // Maximum number of iterations for dry evaporator calculations - constexpr Real64 Tolerance(0.01); // Error tolerance for dry evaporator iterations + constexpr int MaxIter = 30; // Maximum number of iterations for dry evaporator calculations + constexpr Real64 Tolerance = 0.01; // Error tolerance for dry evaporator iterations // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 TotCapWaterFlowModFac1; // Total capacity modifier (function of actual supply water flow vs nominal flow) at low speed @@ -8584,14 +8314,14 @@ namespace VariableSpeedCoils { // LOOP WHILE (ABS(werror) .gt. Tolerance .OR. Counter == 0) while (LoopOn) { // Get capacity modifying factor (function of inlet wetbulb & condenser inlet temp) for off-rated conditions - Real64 TotCapTempModFac1 = CurveValue(state, CCapFTemp1, InletWetBulbCalc, CondInletTemp); + Real64 TotCapTempModFac1 = Curve::CurveValue(state, CCapFTemp1, InletWetBulbCalc, CondInletTemp); // Get capacity modifying factor (function of mass flow) for off-rated conditions - Real64 TotCapAirFlowModFac1 = CurveValue(state, CCapAirFFlow1, AirMassFlowRatio); + Real64 TotCapAirFlowModFac1 = Curve::CurveValue(state, CCapAirFFlow1, AirMassFlowRatio); // Get capacity modifying factor (function of mass flow) for off-rated conditions if (CCapWaterFFlow1 == 0) { TotCapWaterFlowModFac1 = 1.0; } else { - TotCapWaterFlowModFac1 = CurveValue(state, CCapWaterFFlow1, WaterMassFlowRatio); + TotCapWaterFlowModFac1 = Curve::CurveValue(state, CCapWaterFFlow1, WaterMassFlowRatio); } // Get total capacity @@ -8601,13 +8331,13 @@ namespace VariableSpeedCoils { TotCapCalc2 = 0.0; TotCapModFac = TotCapAirFlowModFac1 * TotCapWaterFlowModFac1 * TotCapTempModFac1; } else { - TotCapTempModFac2 = CurveValue(state, CCapFTemp2, InletWetBulbCalc, CondInletTemp); - TotCapAirFlowModFac2 = CurveValue(state, CCapAirFFlow2, AirMassFlowRatio); + TotCapTempModFac2 = Curve::CurveValue(state, CCapFTemp2, InletWetBulbCalc, CondInletTemp); + TotCapAirFlowModFac2 = Curve::CurveValue(state, CCapAirFFlow2, AirMassFlowRatio); if (CCapWaterFFlow2 == 0) { TotCapWaterFlowModFac2 = 1.0; } else { - TotCapWaterFlowModFac2 = CurveValue(state, CCapWaterFFlow2, WaterMassFlowRatio); + TotCapWaterFlowModFac2 = Curve::CurveValue(state, CCapWaterFFlow2, WaterMassFlowRatio); } TotCapCalc1 = TotCapNom1 * TotCapAirFlowModFac1 * TotCapWaterFlowModFac1 * TotCapTempModFac1; @@ -8621,11 +8351,11 @@ namespace VariableSpeedCoils { Real64 localCBF = max(0.0, CBF); // negative coil bypass factor is physically impossible // Calculate apparatus dew point conditions using TotCap and CBF - Real64 hDelta = TotCapCalc / AirMassFlow; // Change in air enthalpy across the cooling coil [J/kg] - Real64 hADP = InletEnthalpy - hDelta / (1.0 - localCBF); // Apparatus dew point enthalpy [J/kg] - Real64 tADP = PsyTsatFnHPb(state, hADP, Pressure, RoutineName); // Apparatus dew point temperature [C] - Real64 wADP = PsyWFnTdbH(state, tADP, hADP, RoutineName); // Apparatus dew point humidity ratio [kg/kg] - Real64 hTinwADP = PsyHFnTdbW(InletDryBulb, wADP); // Enthalpy at inlet dry-bulb and wADP [J/kg] + Real64 hDelta = TotCapCalc / AirMassFlow; // Change in air enthalpy across the cooling coil [J/kg] + Real64 hADP = InletEnthalpy - hDelta / (1.0 - localCBF); // Apparatus dew point enthalpy [J/kg] + Real64 tADP = Psychrometrics::PsyTsatFnHPb(state, hADP, Pressure, RoutineName); // Apparatus dew point temperature [C] + Real64 wADP = Psychrometrics::PsyWFnTdbH(state, tADP, hADP, RoutineName); // Apparatus dew point humidity ratio [kg/kg] + Real64 hTinwADP = Psychrometrics::PsyHFnTdbW(InletDryBulb, wADP); // Enthalpy at inlet dry-bulb and wADP [J/kg] if (TotCapCalc > 1.0e-10) { SHRCalc = min((hTinwADP - hADP) / (InletEnthalpy - hADP), 1.0); // temporary calculated value of SHR } else { @@ -8640,7 +8370,7 @@ namespace VariableSpeedCoils { // capacity at the dry-out point to determine exiting conditions from coil. This is required // since the TotCapTempModFac doesn't work properly with dry-coil conditions. InletHumRatCalc = RF * wADP + (1.0 - RF) * InletHumRatCalc; - InletWetBulbCalc = PsyTwbFnTdbWPb(state, InletDryBulb, InletHumRatCalc, Pressure); + InletWetBulbCalc = Psychrometrics::PsyTwbFnTdbWPb(state, InletDryBulb, InletHumRatCalc, Pressure); ++Counter; if (std::abs(werror) > Tolerance) { LoopOn = true; // Recalculate with modified inlet conditions diff --git a/src/EnergyPlus/VariableSpeedCoils.hh b/src/EnergyPlus/VariableSpeedCoils.hh index 75b4f39f728..76bffe86d4b 100644 --- a/src/EnergyPlus/VariableSpeedCoils.hh +++ b/src/EnergyPlus/VariableSpeedCoils.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -223,15 +223,15 @@ namespace VariableSpeedCoils { Real64 EvapCondPumpElecNomPower; // Nominal power input to the evap condenser water circulation pump [W] Real64 EvapCondPumpElecPower; // Average power consumed by the evap condenser water circulation pump over // the time step [W] - Real64 EvapWaterConsumpRate; // Evap condenser water consumption rate [m3/s] - Real64 EvapCondPumpElecConsumption; // Electric energy consumed by the evap condenser water circulation pump [J] - Real64 EvapWaterConsump; // Evap condenser water consumption [m3] - Real64 BasinHeaterConsumption; // Basin heater energy consumption (J) - Real64 BasinHeaterPowerFTempDiff; // Basin heater capacity per degree C below setpoint (W/C) - Real64 BasinHeaterSetPointTemp; // setpoint temperature for basin heater operation (C) - Real64 BasinHeaterPower; // Basin heater power (W) - int BasinHeaterSchedulePtr; // Pointer to basin heater schedule - Array1D EvapCondAirFlow; // Air flow rate through the evap condenser at high speed, volumetric flow rate + Real64 EvapWaterConsumpRate; // Evap condenser water consumption rate [m3/s] + Real64 EvapCondPumpElecConsumption; // Electric energy consumed by the evap condenser water circulation pump [J] + Real64 EvapWaterConsump; // Evap condenser water consumption [m3] + Real64 BasinHeaterConsumption; // Basin heater energy consumption (J) + Real64 BasinHeaterPowerFTempDiff; // Basin heater capacity per degree C below setpoint (W/C) + Real64 BasinHeaterSetPointTemp; // setpoint temperature for basin heater operation (C) + Real64 BasinHeaterPower; // Basin heater power (W) + Sched::Schedule *basinHeaterSched = nullptr; // basin heater schedule + Array1D EvapCondAirFlow; // Air flow rate through the evap condenser at high speed, volumetric flow rate // for water use calcs [m3/s] Array1D EvapCondEffect; // effectiveness of the evaporatively cooled condenser // [high speed for multi-speed unit] (-) @@ -312,7 +312,7 @@ namespace VariableSpeedCoils { CondenserType(DataHeatBalance::RefrigCondenserType::Air), ReportEvapCondVars(false), EvapCondPumpElecNomPower(0.0), EvapCondPumpElecPower(0.0), EvapWaterConsumpRate(0.0), EvapCondPumpElecConsumption(0.0), EvapWaterConsump(0.0), BasinHeaterConsumption(0.0), BasinHeaterPowerFTempDiff(0.0), BasinHeaterSetPointTemp(0.0), BasinHeaterPower(0.0), - BasinHeaterSchedulePtr(0), EvapCondAirFlow(HVAC::MaxSpeedLevels, 0.0), EvapCondEffect(HVAC::MaxSpeedLevels, 0.0), + EvapCondAirFlow(HVAC::MaxSpeedLevels, 0.0), EvapCondEffect(HVAC::MaxSpeedLevels, 0.0), MSRatedEvapCondVolFlowPerRatedTotCap(HVAC::MaxSpeedLevels, 0.0), EvapWaterSupplyMode(101), EvapWaterSupTankID(0), EvapWaterTankDemandARRID(0), CondensateCollectMode(1001), CondensateTankID(0), CondensateTankSupplyARRID(0), CondensateVdot(0.0), CondensateVol(0.0), CondInletTemp(0.0), SupplyFanIndex(0), supplyFanType(HVAC::FanType::Invalid), SourceAirMassFlowRate(0.0), @@ -581,6 +581,10 @@ struct VariableSpeedCoilsData : BaseGlobalStruct Real64 CrankcaseHeatingPower_CalcVarSpeedCoilCooling = 0.0; // power due to crankcase heater Real64 CompAmbTemp_CalcVarSpeedCoilCooling = 0.0; // Ambient temperature at compressor + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/Vectors.cc b/src/EnergyPlus/Vectors.cc index 7317f6ffd62..97fa4e5003b 100644 --- a/src/EnergyPlus/Vectors.cc +++ b/src/EnergyPlus/Vectors.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -48,9 +48,6 @@ // C++ Headers #include -// ObjexxFCL Headers -#include - // EnergyPlus Headers #include #include @@ -110,8 +107,7 @@ Real64 AreaPolygon(int const n, Array1D &p) { // PURPOSE OF THIS SUBROUTINE: - // This subroutine calculates the area of a polygon defined by the - // input vectors. + // This subroutine calculates the area of a polygon defined by the input vectors. // REFERENCE: // Graphic Gems. @@ -189,8 +185,7 @@ Vector VecNormalize(Vector const &vec) { // PURPOSE OF THIS SUBROUTINE: - // This subroutine normalizes the input vector and returns the normalized - // vector + // This subroutine normalizes the input vector and returns the normalized vector // REFERENCE: // Graphic Gems. @@ -262,11 +257,11 @@ void DetermineAzimuthAndTilt(Array1D const &Surf, // Surface Definition } Real64 tlt = std::acos(NewellSurfaceNormalVector.z); - tlt /= Constant::DegToRadians; + tlt /= Constant::DegToRad; Real64 az = rotang_0; - az /= Constant::DegToRadians; + az /= Constant::DegToRad; az = mod(450.0 - az, 360.0); az += 90.0; if (az < 0.0) az += 360.0; @@ -295,8 +290,7 @@ void PlaneEquation(Array1D &verts, // Structure of the surface { // PURPOSE OF THIS SUBROUTINE: - // This subroutine calculates the plane equation for a given - // surface (which should be planar). + // This subroutine calculates the plane equation for a given surface (which should be planar). // REFERENCE: // Graphic Gems @@ -336,9 +330,7 @@ Real64 Pt2Plane(Vector const &pt, // Point for determining the distance { // PURPOSE OF THIS SUBROUTINE: - // This subroutine calculates the distance from a point - // to the plane (of a surface). Used to determine the reveal - // of a heat transfer subsurface. + // This subroutine calculates the distance from a point to the plane (of a surface). Used to determine the reveal of a heat transfer subsurface. // REFERENCE: // Graphic Gems @@ -358,8 +350,7 @@ void CreateNewellAreaVector(Array1D const &VList, int const NSides, Vect // DATE WRITTEN May 2004 // PURPOSE OF THIS SUBROUTINE: - // This subroutine creates a "Newell" vector from the vector list for a surface - // face. Also the Newell Area vector. + // This subroutine creates a "Newell" vector from the vector list for a surface face. Also the Newell Area vector. // REFERENCES: // Collaboration with Bill Carroll, LBNL. @@ -384,8 +375,7 @@ void CreateNewellSurfaceNormalVector(Array1D const &VList, int const NSi // DATE WRITTEN Jan 2011 // PURPOSE OF THIS SUBROUTINE: - // This subroutine creates a "Newell" surface normal vector from the vector list - // for a surface face. + // This subroutine creates a "Newell" surface normal vector from the vector list for a surface face. // REFERENCES: // September 2010: from OpenGL.org @@ -401,14 +391,10 @@ void CreateNewellSurfaceNormalVector(Array1D const &VList, int const NSi // Returning Normalize(Normal) // End Function - Real64 xvalue; - Real64 yvalue; - Real64 zvalue; - OutNewellSurfaceNormalVector = 0.0; - xvalue = 0.0; - yvalue = 0.0; - zvalue = 0.0; + Real64 xvalue = 0.0; + Real64 yvalue = 0.0; + Real64 zvalue = 0.0; // IF (NSides > 3) THEN for (int Side = 1; Side <= NSides; ++Side) { @@ -438,8 +424,7 @@ void CompareTwoVectors(Vector const &vector1, // standard vector // DATE WRITTEN February 2012 // PURPOSE OF THIS SUBROUTINE: - // This routine will provide the ability to compare two vectors (e.g. surface normals) - // to be the same within a specified tolerance. + // This routine will provide the ability to compare two vectors (e.g. surface normals) to be the same within a specified tolerance. // METHODOLOGY EMPLOYED: // compare each element (x,y,z) @@ -458,8 +443,7 @@ void CalcCoPlanarNess(Array1D &Surf, int const NSides, bool &IsCoPlanar, // DATE WRITTEN June 2004 // PURPOSE OF THIS SUBROUTINE: - // This subroutine provides the calculation to determine if the - // surface is planar or not. + // This subroutine provides the calculation to determine if the surface is planar or not. // REFERENCES: // Eric W. Weisstein. "Coplanar." From MathWorld--A Wolfram Web Resource. @@ -489,7 +473,8 @@ void CalcCoPlanarNess(Array1D &Surf, int const NSides, bool &IsCoPlanar, if (std::abs(MaxDist) > Constant::SmallDistance) IsCoPlanar = false; } -std::vector PointsInPlane(Array1D &BaseSurf, int const BaseSides, Array1D &QuerySurf, int const QuerySides, bool &ErrorFound) +std::vector +PointsInPlane(Array1D &BaseSurf, int const BaseSides, Array1D const &QuerySurf, int const QuerySides, bool &ErrorFound) { std::vector pointIndices; @@ -505,7 +490,7 @@ std::vector PointsInPlane(Array1D &BaseSurf, int const BaseSides, A return pointIndices; } -Real64 CalcPolyhedronVolume(EnergyPlusData &state, Polyhedron const &Poly) +Real64 CalcPolyhedronVolume(EnergyPlusData const &state, Polyhedron const &Poly) { // SUBROUTINE INFORMATION: @@ -513,15 +498,11 @@ Real64 CalcPolyhedronVolume(EnergyPlusData &state, Polyhedron const &Poly) // DATE WRITTEN June 2004 // PURPOSE OF THIS SUBROUTINE: - // This subroutine provides the volume calculation for a polyhedron - // (i.e. Zone). + // This subroutine provides the volume calculation for a polyhedron (i.e. Zone). // REFERENCES: // Conversations with Bill Carroll, LBNL. - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 PyramidVolume; - // Object Data Vector p3FaceOrigin; @@ -529,7 +510,7 @@ Real64 CalcPolyhedronVolume(EnergyPlusData &state, Polyhedron const &Poly) for (int NFace = 1; NFace <= Poly.NumSurfaceFaces; ++NFace) { p3FaceOrigin = Poly.SurfaceFace(NFace).FacePoints(2); - PyramidVolume = dot(Poly.SurfaceFace(NFace).NewellAreaVector, (p3FaceOrigin - state.dataVectors->p0)); + Real64 PyramidVolume = dot(Poly.SurfaceFace(NFace).NewellAreaVector, (p3FaceOrigin - state.dataVectors->p0)); Volume += PyramidVolume / 3.0; } return Volume; diff --git a/src/EnergyPlus/Vectors.hh b/src/EnergyPlus/Vectors.hh index 7361482fd93..054989863b0 100644 --- a/src/EnergyPlus/Vectors.hh +++ b/src/EnergyPlus/Vectors.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -121,9 +121,9 @@ namespace Vectors { void CalcCoPlanarNess(Array1D &Surf, int const NSides, bool &IsCoPlanar, Real64 &MaxDist, int &ErrorVertex); std::vector - PointsInPlane(Array1D &BaseSurf, int const BaseSides, Array1D &QuerySurf, int const QuerySides, bool &ErrorFound); + PointsInPlane(Array1D &BaseSurf, int const BaseSides, Array1D const &QuerySurf, int const QuerySides, bool &ErrorFound); - Real64 CalcPolyhedronVolume(EnergyPlusData &state, Polyhedron const &Poly); + Real64 CalcPolyhedronVolume(EnergyPlusData const &state, Polyhedron const &Poly); } // namespace Vectors @@ -131,6 +131,10 @@ struct VectorsData : BaseGlobalStruct { Vectors::Vector p0 = Vectors::Vector(0.0, 0.0, 0.0); + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/VentilatedSlab.cc b/src/EnergyPlus/VentilatedSlab.cc index 5977ddd2751..1ec0fe27778 100644 --- a/src/EnergyPlus/VentilatedSlab.cc +++ b/src/EnergyPlus/VentilatedSlab.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -50,7 +50,6 @@ // ObjexxFCL Headers #include -#include // EnergyPlus Headers #include @@ -102,8 +101,6 @@ namespace VentilatedSlab { // MODULE INFORMATION: // AUTHOR Young Tae Chae, Rick Strand // DATE WRITTEN June 2008 - // MODIFIED - // RE-ENGINEERED na // PURPOSE OF THIS MODULE: // Simulate Ventilated Slab Systems. @@ -119,14 +116,6 @@ namespace VentilatedSlab { // ASHRAE Systems and Equipment Handbook (SI), 1996. pp. 31.1-31.3 // Fred Buhl's fan coil module (FanCoilUnits.cc) - // Using/Aliasing - using namespace DataLoopNode; - using HVAC::SmallAirVolFlow; - using namespace ScheduleManager; - using namespace Psychrometrics; - - static std::string const fluidNameSteam("STEAM"); - static std::string const fluidNameWater("WATER"); std::string const cMO_VentilatedSlab = "ZoneHVAC:VentilatedSlab"; // int constexpr NotOperating = 0; // Parameter for use with OperatingMode variable, set for no heating/cooling @@ -146,8 +135,7 @@ namespace VentilatedSlab { // AUTHOR Rick Strand // DATE WRITTEN May 2000 // MODIFIED Don Shirey, Aug 2009 (LatOutputProvided) - // RE-ENGINEERED - // This is re-engineered by Rick Strand and Young T. Chae for Ventilated Slab (June, 2008) + // RE-ENGINEERED Rick Strand and Young T. Chae for Ventilated Slab (June, 2008) // PURPOSE OF THIS SUBROUTINE: // This is the main driver subroutine for the Ventilated Slab simulation. @@ -208,7 +196,6 @@ namespace VentilatedSlab { // AUTHOR Young Tae Chae, Rick Strand // DATE WRITTEN June 2008 // MODIFIED July 2012, Chandan Sharma - FSEC: Added zone sys avail managers - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine obtains the input for ventilated slab and sets @@ -224,20 +211,11 @@ namespace VentilatedSlab { static constexpr std::string_view routineName = "GetVentilatedSlabInput"; // Using/Aliasing - using BranchNodeConnections::SetUpCompSets; - using NodeInputManager::GetOnlySingleNode; auto &GetWaterCoilMaxFlowRate(WaterCoils::GetCoilMaxWaterFlowRate); auto &GetSteamCoilMaxFlowRate(SteamCoils::GetCoilMaxWaterFlowRate); auto &GetHXAssistedCoilFlowRate(HVACHXAssistedCoolingCoil::GetCoilMaxWaterFlowRate); - using HVACHXAssistedCoolingCoil::GetHXCoilTypeAndName; - using ScheduleManager::GetScheduleIndex; - using namespace DataLoopNode; - using namespace DataSurfaceLists; - - using OutAirNodeManager::CheckAndAddAirNodeNumber; // SUBROUTINE PARAMETER DEFINITIONS: - constexpr std::array(VentilatedSlabConfig::Num)> VentilatedSlabConfigNamesUC{ "SLABONLY", "SLABANDZONE", "SERIESSLABS"}; @@ -263,7 +241,6 @@ namespace VentilatedSlab { int Item; // Item to be "gotten" int BaseNum; // Temporary number for creating RadiantSystemTypes structure bool errFlag; // interim error flag - int SurfListNum; // Index within the SurfList derived type for a surface list name int SurfNum; // DO loop counter for surfaces bool IsValid; // Set for outside air node check Array1D_string cAlphaArgs; // Alpha input items for object @@ -295,7 +272,7 @@ namespace VentilatedSlab { lNumericBlanks.dimension(NumNumbers, true); // make sure data is gotten for surface lists - BaseNum = GetNumberOfSurfListVentSlab(state); + BaseNum = DataSurfaceLists::GetNumberOfSurfListVentSlab(state); state.dataVentilatedSlab->NumOfVentSlabs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); // Allocate the local derived type and do one-time initializations for all parts of it @@ -329,14 +306,9 @@ namespace VentilatedSlab { ventSlab.Name = state.dataIPShortCut->cAlphaArgs(1); if (lAlphaBlanks(2)) { - ventSlab.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else if ((ventSlab.SchedPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2))) == 0) { // convert schedule name to pointer - ShowSevereError(state, - format(R"({}="{}" invalid {}="{}" not found.)", - CurrentModuleObject, - ventSlab.Name, - cAlphaFields(2), - state.dataIPShortCut->cAlphaArgs(2))); + ventSlab.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((ventSlab.availSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), state.dataIPShortCut->cAlphaArgs(2)); ErrorsFound = true; } @@ -357,7 +329,7 @@ namespace VentilatedSlab { } ventSlab.SurfListName = state.dataIPShortCut->cAlphaArgs(4); - SurfListNum = 0; + int SurfListNum = 0; // IF (NumOfSlabLists > 0) SurfListNum = Util::FindItemInList(VentSlab(Item)%SurfListName, SlabList%Name, NumOfSlabLists) if (state.dataSurfLists->NumOfSurfListVentSlab > 0) SurfListNum = Util::FindItemInList(ventSlab.SurfListName, state.dataSurfLists->SlabList); @@ -488,88 +460,60 @@ namespace VentilatedSlab { static_cast(getEnumValue(OutsideAirControlTypeNamesUC, Util::makeUPPER(state.dataIPShortCut->cAlphaArgs(5)))); switch (ventSlab.outsideAirControlType) { + case OutsideAirControlType::VariablePercent: { - ventSlab.MaxOASchedPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(7)); // convert schedule name to pointer - if (ventSlab.MaxOASchedPtr == 0) { - ShowSevereError(state, - format(R"({}="{}" invalid {}="{}" not found.)", - CurrentModuleObject, - ventSlab.Name, - cAlphaFields(7), - state.dataIPShortCut->cAlphaArgs(7))); + if (lAlphaBlanks(7)) { + ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(7)); ErrorsFound = true; - } else if (!CheckScheduleValueMinMax(state, ventSlab.MaxOASchedPtr, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, - format("{}=\"{}\" invalid {}=\"{}\" values out of range [0,1].", - CurrentModuleObject, - ventSlab.Name, - cAlphaFields(7), - state.dataIPShortCut->cAlphaArgs(7))); + } else if ((ventSlab.maxOASched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(7))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(7), state.dataIPShortCut->cAlphaArgs(7)); + ErrorsFound = true; + } else if (!ventSlab.maxOASched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFields(7), state.dataIPShortCut->cAlphaArgs(7), Clusive::In, 0.0, Clusive::In, 1.0); ErrorsFound = true; } - break; - } + } break; + case OutsideAirControlType::FixedOAControl: { - ventSlab.MaxOASchedPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(7)); // convert schedule name to pointer - if (ventSlab.MaxOASchedPtr == 0) { - ShowSevereError(state, - format(R"({}="{}" invalid {}="{}" not found.)", - CurrentModuleObject, - ventSlab.Name, - cAlphaFields(7), - state.dataIPShortCut->cAlphaArgs(7))); + if (lAlphaBlanks(7)) { + ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(7)); ErrorsFound = true; - } else if (!CheckScheduleValueMinMax(state, ventSlab.MaxOASchedPtr, true, 0.0)) { - ShowSevereError(state, - format("{}=\"{}\" invalid {}=\"{}\" values out of range (must be >=0).", - CurrentModuleObject, - ventSlab.Name, - cAlphaFields(7), - state.dataIPShortCut->cAlphaArgs(7))); + } else if ((ventSlab.maxOASched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(7))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(7), state.dataIPShortCut->cAlphaArgs(7)); + ErrorsFound = true; + } else if (!ventSlab.maxOASched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, cAlphaFields(7), state.dataIPShortCut->cAlphaArgs(7), Clusive::In, 0.0); ErrorsFound = true; } - break; - } + } break; + case OutsideAirControlType::FixedTemperature: { - ventSlab.TempSchedPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(7)); // convert schedule name to pointer - if (ventSlab.TempSchedPtr == 0) { - ShowSevereError(state, - format(R"({}="{}" invalid {}="{}" not found.)", - CurrentModuleObject, - ventSlab.Name, - cAlphaFields(7), - state.dataIPShortCut->cAlphaArgs(7))); + if (lAlphaBlanks(7)) { + ShowSevereEmptyField(state, eoh, cAlphaFields(7)); + ErrorsFound = true; + } else if ((ventSlab.tempSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(7))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(7), state.dataIPShortCut->cAlphaArgs(7)); ErrorsFound = true; } - break; - } + } break; + default: { ShowSevereError( state, format(R"({}="{}" invalid {}="{}".)", CurrentModuleObject, ventSlab.Name, cAlphaFields(5), state.dataIPShortCut->cAlphaArgs(5))); - } - } + } break; + } // switch (outsideAirControlType) - ventSlab.MinOASchedPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(6)); // convert schedule name to pointer - if (ventSlab.MinOASchedPtr == 0) { - ShowSevereError(state, - format(R"({}="{}" invalid {}="{}" not found.)", - CurrentModuleObject, - ventSlab.Name, - cAlphaFields(6), - state.dataIPShortCut->cAlphaArgs(6))); + if (lAlphaBlanks(6)) { + } else if ((ventSlab.minOASched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(6))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(6), state.dataIPShortCut->cAlphaArgs(6)); ErrorsFound = true; } // System Configuration: - ventSlab.SysConfg = - static_cast(getEnumValue(VentilatedSlabConfigNamesUC, Util::makeUPPER(state.dataIPShortCut->cAlphaArgs(8)))); - + ventSlab.SysConfg = static_cast(getEnumValue(VentilatedSlabConfigNamesUC, state.dataIPShortCut->cAlphaArgs(8))); if (ventSlab.SysConfg == VentilatedSlabConfig::Invalid) { - ShowSevereError( - state, - format(R"({}="{}" invalid {}="{}".)", CurrentModuleObject, ventSlab.Name, cAlphaFields(8), state.dataIPShortCut->cAlphaArgs(8))); - ShowContinueError(state, "Control reset to SLAB ONLY Configuration."); + ShowWarningInvalidKey(state, eoh, cAlphaFields(8), state.dataIPShortCut->cAlphaArgs(8), "Control reset to SLAB ONLY Configuration."); ventSlab.SysConfg = VentilatedSlabConfig::SlabOnly; } @@ -622,101 +566,57 @@ namespace VentilatedSlab { // Heating User Input Data For Ventilated Slab Control : // High Air Temp : - ventSlab.HotAirHiTempSchedPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(10)); - if ((ventSlab.HotAirHiTempSchedPtr == 0) && (!lAlphaBlanks(10))) { - ShowSevereError(state, - format(R"({}="{}" invalid {}="{}" not found.)", - CurrentModuleObject, - ventSlab.Name, - cAlphaFields(10), - state.dataIPShortCut->cAlphaArgs(10))); + if (lAlphaBlanks(10)) { + } else if ((ventSlab.hotAirHiTempSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(10))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(10), state.dataIPShortCut->cAlphaArgs(10)); ErrorsFound = true; } // Low Air Temp : - - ventSlab.HotAirLoTempSchedPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(11)); - if ((ventSlab.HotAirLoTempSchedPtr == 0) && (!lAlphaBlanks(11))) { - ShowSevereError(state, - format(R"({}="{}" invalid {}="{}" not found.)", - CurrentModuleObject, - ventSlab.Name, - cAlphaFields(11), - state.dataIPShortCut->cAlphaArgs(11))); + if (lAlphaBlanks(11)) { + } else if ((ventSlab.hotAirLoTempSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(11))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(11), state.dataIPShortCut->cAlphaArgs(11)); ErrorsFound = true; } - ventSlab.HotCtrlHiTempSchedPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(12)); - if ((ventSlab.HotCtrlHiTempSchedPtr == 0) && (!lAlphaBlanks(12))) { - ShowSevereError(state, - format(R"({}="{}" invalid {}="{}" not found.)", - CurrentModuleObject, - ventSlab.Name, - cAlphaFields(12), - state.dataIPShortCut->cAlphaArgs(12))); + if (lAlphaBlanks(12)) { + } else if ((ventSlab.hotCtrlHiTempSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(12))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(12), state.dataIPShortCut->cAlphaArgs(12)); ErrorsFound = true; } - ventSlab.HotCtrlLoTempSchedPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(13)); - if ((ventSlab.HotCtrlLoTempSchedPtr == 0) && (!lAlphaBlanks(13))) { - ShowSevereError(state, - format(R"({}="{}" invalid {}="{}" not found.)", - CurrentModuleObject, - ventSlab.Name, - cAlphaFields(13), - state.dataIPShortCut->cAlphaArgs(13))); + if (lAlphaBlanks(13)) { + } else if ((ventSlab.hotCtrlLoTempSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(13))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(13), state.dataIPShortCut->cAlphaArgs(13)); ErrorsFound = true; } // Cooling User Input Data For Ventilated Slab Control : // Cooling High Temp Sch. - ventSlab.ColdAirHiTempSchedPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(14)); - if ((ventSlab.ColdAirHiTempSchedPtr == 0) && (!lAlphaBlanks(14))) { - ShowSevereError(state, - format(R"({}="{}" invalid {}="{}" not found.)", - CurrentModuleObject, - ventSlab.Name, - cAlphaFields(14), - state.dataIPShortCut->cAlphaArgs(14))); + if (lAlphaBlanks(14)) { + } else if ((ventSlab.coldAirHiTempSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(14))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(14), state.dataIPShortCut->cAlphaArgs(14)); ErrorsFound = true; } // Cooling Low Temp Sch. - - ventSlab.ColdAirLoTempSchedPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(15)); - if ((ventSlab.ColdAirLoTempSchedPtr == 0) && (!lAlphaBlanks(15))) { - ShowSevereError(state, - format(R"({}="{}" invalid {}="{}" not found.)", - CurrentModuleObject, - ventSlab.Name, - cAlphaFields(15), - state.dataIPShortCut->cAlphaArgs(15))); + if (lAlphaBlanks(15)) { + } else if ((ventSlab.coldAirLoTempSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(15))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(15), state.dataIPShortCut->cAlphaArgs(15)); ErrorsFound = true; } // Cooling Control High Sch. - - ventSlab.ColdCtrlHiTempSchedPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(16)); - if ((ventSlab.ColdCtrlHiTempSchedPtr == 0) && (!lAlphaBlanks(16))) { - ShowSevereError(state, - format(R"({}="{}" invalid {}="{}" not found.)", - CurrentModuleObject, - ventSlab.Name, - cAlphaFields(16), - state.dataIPShortCut->cAlphaArgs(16))); + if (lAlphaBlanks(16)) { + } else if ((ventSlab.coldCtrlHiTempSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(16))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(16), state.dataIPShortCut->cAlphaArgs(16)); ErrorsFound = true; } // Cooling Control Low Sch. - - ventSlab.ColdCtrlLoTempSchedPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(17)); - if ((ventSlab.ColdCtrlLoTempSchedPtr == 0) && (!lAlphaBlanks(17))) { - ShowSevereError(state, - format(R"({}="{}" invalid {}="{}" not found.)", - CurrentModuleObject, - ventSlab.Name, - cAlphaFields(17), - state.dataIPShortCut->cAlphaArgs(17))); + if (lAlphaBlanks(17)) { + } else if ((ventSlab.coldCtrlLoTempSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(17))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(17), state.dataIPShortCut->cAlphaArgs(17)); ErrorsFound = true; } @@ -755,158 +655,158 @@ namespace VentilatedSlab { if (ventSlab.SysConfg == VentilatedSlabConfig::SlabOnly) { - ventSlab.ReturnAirNode = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(18), - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, - ventSlab.Name + "-OA MIXER", - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Outlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); - ventSlab.ReturnAirNode = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(18), - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, - ventSlab.Name, - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Inlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsParent); - ventSlab.RadInNode = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(19), - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, - ventSlab.Name, - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Inlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); - - ventSlab.OAMixerOutNode = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(23), - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, - ventSlab.Name + "-OA MIXER", - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Outlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); - ventSlab.FanOutletNode = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(24), - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, - ventSlab.Name, - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Internal, - NodeInputManager::CompFluidStream::Primary, - ObjectIsParent); + ventSlab.ReturnAirNode = NodeInputManager::GetOnlySingleNode(state, + state.dataIPShortCut->cAlphaArgs(18), + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, + ventSlab.Name + "-OA MIXER", + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Outlet, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsNotParent); + ventSlab.ReturnAirNode = NodeInputManager::GetOnlySingleNode(state, + state.dataIPShortCut->cAlphaArgs(18), + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, + ventSlab.Name, + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Inlet, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsParent); + ventSlab.RadInNode = NodeInputManager::GetOnlySingleNode(state, + state.dataIPShortCut->cAlphaArgs(19), + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, + ventSlab.Name, + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Inlet, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsNotParent); + + ventSlab.OAMixerOutNode = NodeInputManager::GetOnlySingleNode(state, + state.dataIPShortCut->cAlphaArgs(23), + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, + ventSlab.Name + "-OA MIXER", + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Outlet, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsNotParent); + ventSlab.FanOutletNode = NodeInputManager::GetOnlySingleNode(state, + state.dataIPShortCut->cAlphaArgs(24), + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, + ventSlab.Name, + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Internal, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsParent); } else if (ventSlab.SysConfg == VentilatedSlabConfig::SeriesSlabs) { - ventSlab.ReturnAirNode = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(18), - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, - ventSlab.Name + "-OA MIXER", - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Outlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); - ventSlab.ReturnAirNode = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(18), - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, - ventSlab.Name, - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Inlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsParent); - ventSlab.RadInNode = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(19), - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, - ventSlab.Name, - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Inlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); - - ventSlab.OAMixerOutNode = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(23), - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, - ventSlab.Name + "-OA MIXER", - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Outlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); - ventSlab.FanOutletNode = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(24), - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, - ventSlab.Name, - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Internal, - NodeInputManager::CompFluidStream::Primary, - ObjectIsParent); + ventSlab.ReturnAirNode = NodeInputManager::GetOnlySingleNode(state, + state.dataIPShortCut->cAlphaArgs(18), + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, + ventSlab.Name + "-OA MIXER", + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Outlet, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsNotParent); + ventSlab.ReturnAirNode = NodeInputManager::GetOnlySingleNode(state, + state.dataIPShortCut->cAlphaArgs(18), + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, + ventSlab.Name, + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Inlet, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsParent); + ventSlab.RadInNode = NodeInputManager::GetOnlySingleNode(state, + state.dataIPShortCut->cAlphaArgs(19), + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, + ventSlab.Name, + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Inlet, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsNotParent); + + ventSlab.OAMixerOutNode = NodeInputManager::GetOnlySingleNode(state, + state.dataIPShortCut->cAlphaArgs(23), + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, + ventSlab.Name + "-OA MIXER", + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Outlet, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsNotParent); + ventSlab.FanOutletNode = NodeInputManager::GetOnlySingleNode(state, + state.dataIPShortCut->cAlphaArgs(24), + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, + ventSlab.Name, + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Internal, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsParent); } else if (ventSlab.SysConfg == VentilatedSlabConfig::SlabAndZone) { - ventSlab.ReturnAirNode = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(18), - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, - ventSlab.Name + "-SYSTEM", - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Inlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsParent); - ventSlab.ReturnAirNode = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(18), - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, - ventSlab.Name, - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Inlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsParent); - ventSlab.ReturnAirNode = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(18), - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, - ventSlab.Name + "-OA MIXER", - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Inlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); - ventSlab.RadInNode = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(19), - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, - ventSlab.Name, - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Inlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); - ventSlab.OAMixerOutNode = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(23), - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, - ventSlab.Name + "-OA MIXER", - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Outlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); - ventSlab.FanOutletNode = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(24), - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, - ventSlab.Name, - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Internal, - NodeInputManager::CompFluidStream::Primary, - ObjectIsParent); + ventSlab.ReturnAirNode = NodeInputManager::GetOnlySingleNode(state, + state.dataIPShortCut->cAlphaArgs(18), + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, + ventSlab.Name + "-SYSTEM", + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Inlet, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsParent); + ventSlab.ReturnAirNode = NodeInputManager::GetOnlySingleNode(state, + state.dataIPShortCut->cAlphaArgs(18), + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, + ventSlab.Name, + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Inlet, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsParent); + ventSlab.ReturnAirNode = NodeInputManager::GetOnlySingleNode(state, + state.dataIPShortCut->cAlphaArgs(18), + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, + ventSlab.Name + "-OA MIXER", + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Inlet, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsNotParent); + ventSlab.RadInNode = NodeInputManager::GetOnlySingleNode(state, + state.dataIPShortCut->cAlphaArgs(19), + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, + ventSlab.Name, + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Inlet, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsNotParent); + ventSlab.OAMixerOutNode = NodeInputManager::GetOnlySingleNode(state, + state.dataIPShortCut->cAlphaArgs(23), + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, + ventSlab.Name + "-OA MIXER", + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Outlet, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsNotParent); + ventSlab.FanOutletNode = NodeInputManager::GetOnlySingleNode(state, + state.dataIPShortCut->cAlphaArgs(24), + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, + ventSlab.Name, + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Internal, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsParent); } if (ventSlab.SysConfg == VentilatedSlabConfig::SlabOnly) { @@ -927,40 +827,40 @@ namespace VentilatedSlab { ErrorsFound = true; } - ventSlab.ZoneAirInNode = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(20), - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, - ventSlab.Name + "-SYSTEM", - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Outlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsParent); - - ventSlab.ZoneAirInNode = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(20), - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, - ventSlab.Name, - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Outlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + ventSlab.ZoneAirInNode = NodeInputManager::GetOnlySingleNode(state, + state.dataIPShortCut->cAlphaArgs(20), + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, + ventSlab.Name + "-SYSTEM", + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Outlet, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsParent); + + ventSlab.ZoneAirInNode = NodeInputManager::GetOnlySingleNode(state, + state.dataIPShortCut->cAlphaArgs(20), + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, + ventSlab.Name, + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Outlet, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsNotParent); } // Set connection type to 'Inlet', because it now uses an OA node - ventSlab.OutsideAirNode = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(21), - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, - ventSlab.Name + "-OA MIXER", - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Inlet, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + ventSlab.OutsideAirNode = NodeInputManager::GetOnlySingleNode(state, + state.dataIPShortCut->cAlphaArgs(21), + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, + ventSlab.Name + "-OA MIXER", + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Inlet, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsNotParent); if (!lAlphaBlanks(21)) { - CheckAndAddAirNodeNumber(state, ventSlab.OutsideAirNode, IsValid); + OutAirNodeManager::CheckAndAddAirNodeNumber(state, ventSlab.OutsideAirNode, IsValid); if (!IsValid) { ShowWarningError( state, @@ -968,15 +868,15 @@ namespace VentilatedSlab { } } - ventSlab.AirReliefNode = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(22), - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, - ventSlab.Name + "-OA MIXER", - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::ReliefAir, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); + ventSlab.AirReliefNode = NodeInputManager::GetOnlySingleNode(state, + state.dataIPShortCut->cAlphaArgs(22), + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, + ventSlab.Name + "-OA MIXER", + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::ReliefAir, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsNotParent); // Fan information: ventSlab.FanName = state.dataIPShortCut->cAlphaArgs(25); @@ -987,27 +887,27 @@ namespace VentilatedSlab { } else { ventSlab.fanType = state.dataFans->fans(ventSlab.Fan_Index)->type; if (ventSlab.fanType != HVAC::FanType::Constant && ventSlab.fanType != HVAC::FanType::SystemModel) { - ShowSevereCustomMessage(state, - eoh, - format("Only fans of type Fan:ConstantVolume and Fan:SystemModel are supported. {} is of type {}", - ventSlab.FanName, - HVAC::fanTypeNames[(int)ventSlab.fanType])); + ShowSevereCustom(state, + eoh, + format("Only fans of type Fan:ConstantVolume and Fan:SystemModel are supported. {} is of type {}", + ventSlab.FanName, + HVAC::fanTypeNames[(int)ventSlab.fanType])); ErrorsFound = true; } } if (ventSlab.outsideAirControlType == OutsideAirControlType::FixedOAControl) { ventSlab.OutAirVolFlow = ventSlab.MinOutAirVolFlow; - ventSlab.MaxOASchedPtr = ventSlab.MinOASchedPtr; + ventSlab.maxOASched = ventSlab.minOASched; } // Add fan to component sets array - SetUpCompSets(state, - CurrentModuleObject, - ventSlab.Name, - "UNDEFINED", - state.dataIPShortCut->cAlphaArgs(25), - state.dataIPShortCut->cAlphaArgs(23), - state.dataIPShortCut->cAlphaArgs(24)); + BranchNodeConnections::SetUpCompSets(state, + CurrentModuleObject, + ventSlab.Name, + "UNDEFINED", + state.dataIPShortCut->cAlphaArgs(25), + state.dataIPShortCut->cAlphaArgs(23), + state.dataIPShortCut->cAlphaArgs(24)); // Coil options assign @@ -1050,8 +950,8 @@ namespace VentilatedSlab { } case HeatingCoilType::Steam: { ventSlab.heatingCoilType = DataPlant::PlantEquipmentType::CoilSteamAirHeating; - ventSlab.heatingCoil_FluidIndex = FluidProperties::GetRefrigNum(state, "STEAM"); - if (ventSlab.heatingCoil_FluidIndex == 0) { + ventSlab.heatingCoil_fluid = Fluid::GetSteam(state); + if (ventSlab.heatingCoil_fluid == nullptr) { ShowSevereError(state, format("{}=\"{}Steam Properties not found.", CurrentModuleObject, ventSlab.Name)); if (SteamMessageNeeded) ShowContinueError(state, "Steam Fluid Properties should have been included in the input file."); ErrorsFound = true; @@ -1111,15 +1011,15 @@ namespace VentilatedSlab { format("{}=\"{}\" invalid {} is blank and must be entered.", CurrentModuleObject, ventSlab.Name, cAlphaFields(29))); ErrorsFound = true; } - ventSlab.HotControlNode = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(29), - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, - ventSlab.Name, - DataLoopNode::NodeFluidType::Water, - DataLoopNode::ConnectionType::Actuator, - NodeInputManager::CompFluidStream::Primary, - ObjectIsParent); + ventSlab.HotControlNode = NodeInputManager::GetOnlySingleNode(state, + state.dataIPShortCut->cAlphaArgs(29), + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, + ventSlab.Name, + DataLoopNode::NodeFluidType::Water, + DataLoopNode::ConnectionType::Actuator, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsParent); } ventSlab.HotControlOffset = 0.001; @@ -1169,12 +1069,12 @@ namespace VentilatedSlab { break; } case CoolingCoilType::HXAssisted: { - GetHXCoilTypeAndName(state, - state.dataIPShortCut->cAlphaArgs(30), - state.dataIPShortCut->cAlphaArgs(31), - ErrorsFound, - ventSlab.coolingCoilPlantType, - ventSlab.coolingCoilPlantName); + HVACHXAssistedCoolingCoil::GetHXCoilTypeAndName(state, + state.dataIPShortCut->cAlphaArgs(30), + state.dataIPShortCut->cAlphaArgs(31), + ErrorsFound, + ventSlab.coolingCoilPlantType, + ventSlab.coolingCoilPlantName); if (Util::SameString(ventSlab.coolingCoilPlantType, "Coil:Cooling:Water")) { ventSlab.coolingCoilType = DataPlant::PlantEquipmentType::CoilWaterCooling; } else if (Util::SameString(ventSlab.coolingCoilPlantType, "Coil:Cooling:Water:DetailedGeometry")) { @@ -1219,15 +1119,15 @@ namespace VentilatedSlab { ventSlab.MinVolColdWaterFlow = 0.0; - ventSlab.ColdControlNode = GetOnlySingleNode(state, - state.dataIPShortCut->cAlphaArgs(32), - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, - ventSlab.Name, - DataLoopNode::NodeFluidType::Water, - DataLoopNode::ConnectionType::Actuator, - NodeInputManager::CompFluidStream::Primary, - ObjectIsParent); + ventSlab.ColdControlNode = NodeInputManager::GetOnlySingleNode(state, + state.dataIPShortCut->cAlphaArgs(32), + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, + ventSlab.Name, + DataLoopNode::NodeFluidType::Water, + DataLoopNode::ConnectionType::Actuator, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsParent); if (lAlphaBlanks(32)) { ShowSevereError( @@ -1269,44 +1169,44 @@ namespace VentilatedSlab { switch (ventSlab.coilOption) { case CoilType::Both: { // 'HeatingAndCooling' // Add cooling coil to component sets array when present - SetUpCompSets(state, - CurrentModuleObject, - ventSlab.Name, - state.dataIPShortCut->cAlphaArgs(30), - state.dataIPShortCut->cAlphaArgs(31), - state.dataIPShortCut->cAlphaArgs(24), - "UNDEFINED"); + BranchNodeConnections::SetUpCompSets(state, + CurrentModuleObject, + ventSlab.Name, + state.dataIPShortCut->cAlphaArgs(30), + state.dataIPShortCut->cAlphaArgs(31), + state.dataIPShortCut->cAlphaArgs(24), + "UNDEFINED"); // Add heating coil to component sets array when cooling coil present - SetUpCompSets(state, - CurrentModuleObject, - ventSlab.Name, - state.dataIPShortCut->cAlphaArgs(27), - state.dataIPShortCut->cAlphaArgs(28), - "UNDEFINED", - state.dataIPShortCut->cAlphaArgs(19)); + BranchNodeConnections::SetUpCompSets(state, + CurrentModuleObject, + ventSlab.Name, + state.dataIPShortCut->cAlphaArgs(27), + state.dataIPShortCut->cAlphaArgs(28), + "UNDEFINED", + state.dataIPShortCut->cAlphaArgs(19)); break; } case CoilType::Heating: { // 'Heating' // Add heating coil to component sets array when no cooling coil present - SetUpCompSets(state, - CurrentModuleObject, - ventSlab.Name, - state.dataIPShortCut->cAlphaArgs(27), - state.dataIPShortCut->cAlphaArgs(28), - state.dataIPShortCut->cAlphaArgs(24), - state.dataIPShortCut->cAlphaArgs(19)); + BranchNodeConnections::SetUpCompSets(state, + CurrentModuleObject, + ventSlab.Name, + state.dataIPShortCut->cAlphaArgs(27), + state.dataIPShortCut->cAlphaArgs(28), + state.dataIPShortCut->cAlphaArgs(24), + state.dataIPShortCut->cAlphaArgs(19)); break; } case CoilType::Cooling: { // 'Cooling' // Add cooling coil to component sets array when no heating coil present - SetUpCompSets(state, - CurrentModuleObject, - ventSlab.Name, - state.dataIPShortCut->cAlphaArgs(30), - state.dataIPShortCut->cAlphaArgs(31), - state.dataIPShortCut->cAlphaArgs(24), - state.dataIPShortCut->cAlphaArgs(19)); + BranchNodeConnections::SetUpCompSets(state, + CurrentModuleObject, + ventSlab.Name, + state.dataIPShortCut->cAlphaArgs(30), + state.dataIPShortCut->cAlphaArgs(31), + state.dataIPShortCut->cAlphaArgs(24), + state.dataIPShortCut->cAlphaArgs(19)); break; } case CoilType::None: @@ -1327,18 +1227,6 @@ namespace VentilatedSlab { // Setup Report variables for the VENTILATED SLAB for (Item = 1; Item <= state.dataVentilatedSlab->NumOfVentSlabs; ++Item) { - // CALL SetupOutputVariable(state, 'Ventilated Slab Direct Heat Loss Rate [W]', & - // VentSlab(Item)%DirectHeatLossRate,'System', & - // 'Average', VentSlab(Item)%Name) - // CALL SetupOutputVariable(state, 'Ventilated Slab Direct Heat Loss [W]', & - // VentSlab(Item)%DirectHeatLoss,'System', & - // 'Sum', VentSlab(Item)%Name) - // CALL SetupOutputVariable(state, 'Ventilated Slab Direct Heat Gain Rate [W]', & - // VentSlab(Item)%DirectHeatGainRate,'System', & - // 'Average', VentSlab(Item)%Name) - // CALL SetupOutputVariable(state, 'Ventilated Slab Direct Heat Gain [J]', & - // VentSlab(Item)%DirectHeatGain,'System', & - // 'Sum', VentSlab(Item)%Name) auto &ventSlab = state.dataVentilatedSlab->VentSlab(Item); SetupOutputVariable(state, "Zone Ventilated Slab Radiant Heating Rate", @@ -1502,7 +1390,6 @@ namespace VentilatedSlab { // AUTHOR Young Tae Chae, Rick Strand // DATE WRITTEN June 2008 // MODIFIED July 2012, Chandan Sharma - FSEC: Added zone sys avail managers - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine initializes all of the data elements which are necessary @@ -1511,47 +1398,18 @@ namespace VentilatedSlab { // METHODOLOGY EMPLOYED: // Uses the status flags to trigger initializations. - // REFERENCES: - // na - // Using/Aliasing auto &ventSlab = state.dataVentilatedSlab->VentSlab(Item); - using DataZoneEquipment::CheckZoneEquipmentList; - using FluidProperties::GetDensityGlycol; - using PlantUtilities::InitComponentNodes; - using PlantUtilities::ScanPlantLoopsForObject; - using ScheduleManager::GetCurrentScheduleValue; - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("InitVentilatedSlab"); - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int RadNum; // Number of the radiant system (DO loop counter) - int SurfNum; // Intermediate variable for keeping track of the surface number - int ZoneNum; // Intermediate variable for keeping track of the zone number - int AirRelNode; // relief air node number in Ventilated Slab loop - int ColdConNode; // cold water control node number in Ventilated Slab loop - int HotConNode; // hot water control node number in Ventilated Slab loop - int InNode; // inlet node number in Ventilated Slab loop - int OutNode; // outlet node number in Ventilated Slab loop - int OutsideAirNode; // outside air node number in Ventilated Slab loop - Real64 RhoAir; // air density at InNode + int AirRelNode; // relief air node number in Ventilated Slab loop + Real64 RhoAir; // air density at InNode Real64 TempSteamIn; Real64 SteamDensity; - int ZoneAirInNode; - int MixOut; Real64 rho; - bool errFlag; // Do the one time initializations @@ -1565,7 +1423,7 @@ namespace VentilatedSlab { for (auto &thisVentSlab : state.dataVentilatedSlab->VentSlab) { thisVentSlab.TotalSurfaceArea = 0.0; int numRadSurfs = thisVentSlab.NumOfSurfaces; - for (SurfNum = 1; SurfNum <= numRadSurfs; ++SurfNum) { + for (int SurfNum = 1; SurfNum <= numRadSurfs; ++SurfNum) { thisVentSlab.TotalSurfaceArea += state.dataSurface->Surface(thisVentSlab.SurfacePtr(SurfNum)).Area; } thisVentSlab.QRadSysSrcAvg.dimension(numRadSurfs, 0.0); @@ -1593,8 +1451,9 @@ namespace VentilatedSlab { if (state.dataVentilatedSlab->MyPlantScanFlag(Item) && allocated(state.dataPlnt->PlantLoop)) { if ((ventSlab.heatingCoilType == DataPlant::PlantEquipmentType::CoilWaterSimpleHeating) || (ventSlab.heatingCoilType == DataPlant::PlantEquipmentType::CoilSteamAirHeating)) { - errFlag = false; - ScanPlantLoopsForObject(state, ventSlab.heatingCoilName, ventSlab.heatingCoilType, ventSlab.HWPlantLoc, errFlag, _, _, _, _, _); + bool errFlag = false; + PlantUtilities::ScanPlantLoopsForObject( + state, ventSlab.heatingCoilName, ventSlab.heatingCoilType, ventSlab.HWPlantLoc, errFlag, _, _, _, _, _); if (errFlag) { ShowContinueError(state, format("Reference Unit=\"{}\", type=ZoneHVAC:VentilatedSlab", ventSlab.Name)); ShowFatalError(state, "InitVentilatedSlab: Program terminated due to previous condition(s)."); @@ -1604,8 +1463,8 @@ namespace VentilatedSlab { } if ((ventSlab.coolingCoilType == DataPlant::PlantEquipmentType::CoilWaterCooling) || (ventSlab.coolingCoilType == DataPlant::PlantEquipmentType::CoilWaterDetailedFlatCooling)) { - errFlag = false; - ScanPlantLoopsForObject(state, ventSlab.coolingCoilPlantName, ventSlab.coolingCoilType, ventSlab.CWPlantLoc, errFlag); + bool errFlag = false; + PlantUtilities::ScanPlantLoopsForObject(state, ventSlab.coolingCoilPlantName, ventSlab.coolingCoilType, ventSlab.CWPlantLoc, errFlag); if (errFlag) { ShowContinueError(state, format("Reference Unit=\"{}\", type=ZoneHVAC:VentilatedSlab", ventSlab.Name)); ShowFatalError(state, "InitVentilatedSlab: Program terminated due to previous condition(s)."); @@ -1623,8 +1482,8 @@ namespace VentilatedSlab { // need to check all Ventilated Slab units to see if they are on Zone Equipment List or issue warning if (!state.dataVentilatedSlab->ZoneEquipmentListChecked && state.dataZoneEquip->ZoneEquipInputsFilled) { state.dataVentilatedSlab->ZoneEquipmentListChecked = true; - for (RadNum = 1; RadNum <= state.dataVentilatedSlab->NumOfVentSlabs; ++RadNum) { - if (CheckZoneEquipmentList(state, cMO_VentilatedSlab, state.dataVentilatedSlab->VentSlab(RadNum).Name)) continue; + for (int RadNum = 1; RadNum <= state.dataVentilatedSlab->NumOfVentSlabs; ++RadNum) { + if (DataZoneEquipment::CheckZoneEquipmentList(state, cMO_VentilatedSlab, state.dataVentilatedSlab->VentSlab(RadNum).Name)) continue; ShowSevereError( state, format("InitVentilatedSlab: Ventilated Slab Unit=[{},{}] is not on any ZoneHVAC:EquipmentList. It will not be simulated.", @@ -1640,15 +1499,14 @@ namespace VentilatedSlab { state.dataVentilatedSlab->MySizeFlag(Item) = false; } + int InNode = ventSlab.ReturnAirNode; + int OutNode = ventSlab.RadInNode; + int OutsideAirNode = ventSlab.OutsideAirNode; + // Do the one time initializations if (state.dataGlobal->BeginEnvrnFlag && state.dataVentilatedSlab->MyEnvrnFlag(Item) && !state.dataVentilatedSlab->MyPlantScanFlag(Item)) { // Coil Part - InNode = ventSlab.ReturnAirNode; - OutNode = ventSlab.RadInNode; - HotConNode = ventSlab.HotControlNode; - ColdConNode = ventSlab.ColdControlNode; - OutsideAirNode = ventSlab.OutsideAirNode; RhoAir = state.dataEnvrn->StdRhoAir; if (state.dataVentilatedSlab->NumOfVentSlabs > 0) { @@ -1692,27 +1550,22 @@ namespace VentilatedSlab { if (ventSlab.heatingCoilType == DataPlant::PlantEquipmentType::CoilWaterSimpleHeating && !state.dataVentilatedSlab->MyPlantScanFlag(Item)) { - rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(ventSlab.HWPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(ventSlab.HWPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(ventSlab.HWPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); ventSlab.MaxHotWaterFlow = rho * ventSlab.MaxVolHotWaterFlow; ventSlab.MinHotWaterFlow = rho * ventSlab.MinVolHotWaterFlow; - InitComponentNodes( + PlantUtilities::InitComponentNodes( state, ventSlab.MinHotWaterFlow, ventSlab.MaxHotWaterFlow, ventSlab.HotControlNode, ventSlab.HotCoilOutNodeNum); } if (ventSlab.heatingCoilType == DataPlant::PlantEquipmentType::CoilSteamAirHeating && !state.dataVentilatedSlab->MyPlantScanFlag(Item)) { TempSteamIn = 100.00; - SteamDensity = - FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, TempSteamIn, 1.0, ventSlab.heatingCoil_FluidIndex, RoutineName); + SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, RoutineName); ventSlab.MaxHotSteamFlow = SteamDensity * ventSlab.MaxVolHotSteamFlow; ventSlab.MinHotSteamFlow = SteamDensity * ventSlab.MinVolHotSteamFlow; - InitComponentNodes( + PlantUtilities::InitComponentNodes( state, ventSlab.MinHotSteamFlow, ventSlab.MaxHotSteamFlow, ventSlab.HotControlNode, ventSlab.HotCoilOutNodeNum); } } //(VentSlab(Item)%HCoilPresent) @@ -1721,14 +1574,10 @@ namespace VentilatedSlab { // Only initialize these if a cooling coil is actually present if ((ventSlab.coolingCoilType == DataPlant::PlantEquipmentType::CoilWaterCooling) || (ventSlab.coolingCoilType == DataPlant::PlantEquipmentType::CoilWaterDetailedFlatCooling)) { - rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(ventSlab.CWPlantLoc.loopNum).FluidName, - Constant::CWInitConvTemp, - state.dataPlnt->PlantLoop(ventSlab.CWPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(ventSlab.CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName); ventSlab.MaxColdWaterFlow = rho * ventSlab.MaxVolColdWaterFlow; ventSlab.MinColdWaterFlow = rho * ventSlab.MinVolColdWaterFlow; - InitComponentNodes( + PlantUtilities::InitComponentNodes( state, ventSlab.MinColdWaterFlow, ventSlab.MaxColdWaterFlow, ventSlab.ColdControlNode, ventSlab.ColdCoilOutNodeNum); } } @@ -1743,12 +1592,7 @@ namespace VentilatedSlab { } // These initializations are done every iteration... - InNode = ventSlab.ReturnAirNode; - OutNode = ventSlab.RadInNode; - OutsideAirNode = ventSlab.OutsideAirNode; AirRelNode = ventSlab.AirReliefNode; - ZoneAirInNode = ventSlab.ZoneAirInNode; - MixOut = ventSlab.OAMixerOutNode; // First, set the flow conditions up so that there is flow through the ventilated // slab system(this will be shut down if the system is not available or there @@ -1787,7 +1631,7 @@ namespace VentilatedSlab { state.dataLoopNodes->Node(OutsideAirNode).Press = state.dataEnvrn->OutBaroPress; // The first pass through in a particular time step - ZoneNum = ventSlab.ZonePtr; + int ZoneNum = ventSlab.ZonePtr; ventSlab.ZeroVentSlabSourceSumHATsurf = state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state); // Set this to figure what part of the load the radiant system meets ventSlab.QRadSysSrcAvg = 0.0; // Initialize this variable to zero (radiant system defaults to off) @@ -1805,7 +1649,6 @@ namespace VentilatedSlab { // DATE WRITTEN June 2008 // MODIFIED July 2013 Daeho Kang, add component sizing table entries // July 2014, B. Nigusse, added scalable sizing - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine is for sizing Ventilated Slab components for which flow rates have not been @@ -1814,29 +1657,13 @@ namespace VentilatedSlab { // METHODOLOGY EMPLOYED: // Obtains flow rates from the zone sizing arrays and plant sizing data. - // Using/Aliasing - using namespace DataSizing; - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSpecificHeatGlycol; - using HVAC::CoolingCapacitySizing; - using HVAC::HeatingAirflowSizing; - using HVAC::HeatingCapacitySizing; - using HVACHXAssistedCoolingCoil::GetHXCoilType; - using HVACHXAssistedCoolingCoil::GetHXDXCoilName; - using PlantUtilities::MyPlantSizingIndex; - using SteamCoils::GetCoilSteamInletNode; - using SteamCoils::GetCoilSteamOutletNode; - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("SizeVentilatedSlab"); - auto &ZoneEqSizing(state.dataSize->ZoneEqSizing); - auto &CurZoneEqNum(state.dataSize->CurZoneEqNum); + int CurZoneEqNum = state.dataSize->CurZoneEqNum; auto &ventSlab = state.dataVentilatedSlab->VentSlab(Item); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int PltSizHeatNum; // index of plant sizing object for 1st heating loop - int PltSizCoolNum; // index of plant sizing object for 1st cooling loop bool ErrorsFound; Real64 DesCoilLoad; Real64 TempSteamIn; @@ -1844,16 +1671,10 @@ namespace VentilatedSlab { Real64 EnthSteamOutWet; Real64 LatentHeatSteam; Real64 SteamDensity; - int CoilWaterInletNode(0); - int CoilWaterOutletNode(0); - int CoilSteamInletNode(0); - int CoilSteamOutletNode(0); std::string CoolingCoilName; std::string CoolingCoilType; Real64 rho; Real64 Cp; - int DummyWaterIndex(1); - bool IsAutoSize; // Indicator to autosize Real64 MaxAirVolFlowDes; // Autosized maximum air flow for reporting Real64 MaxAirVolFlowUser; // Hardsized maximum air flow for reporting Real64 OutAirVolFlowDes; // Autosized outdoor air flow for reporting @@ -1875,23 +1696,13 @@ namespace VentilatedSlab { // HeatingCapacitySizing, etc.) bool PrintFlag; // TRUE when sizing information is reported in the eio file int zoneHVACIndex; // index of zoneHVAC equipment sizing specification - int SAFMethod(0); // supply air flow rate sizing method (SupplyAirFlowRate, FlowPerFloorArea, FractionOfAutosizedCoolingAirflow, - // FractionOfAutosizedHeatingAirflow ...) - int CapSizingMethod(0); // capacity sizing methods (HeatingDesignCapacity, CapacityPerFloorArea, FractionOfAutosizedCoolingCapacity, and - // FractionOfAutosizedHeatingCapacity ) Real64 CoolingAirVolFlowScalable; // cooling airvolume for rate determined using scalable sizing method Real64 HeatingAirVolFlowScalable; // heating airvolume for rate determined using scalable sizing method - bool DoWaterCoilSizing = false; // if TRUE do water coil sizing calculation + bool DoWaterCoilSizing; // if TRUE do water coil sizing calculation Real64 WaterCoilSizDeltaT; // water coil deltaT for design water flow rate autosizing - int CoilNum; // index of water coil object - DoWaterCoilSizing = false; WaterCoilSizDeltaT = 0.0; - CoilNum = 0; - PltSizCoolNum = 0; - PltSizHeatNum = 0; ErrorsFound = false; - IsAutoSize = false; MaxAirVolFlowDes = 0.0; MaxAirVolFlowUser = 0.0; OutAirVolFlowDes = 0.0; @@ -1922,27 +1733,28 @@ namespace VentilatedSlab { FieldNum = 1; PrintFlag = true; SizingString = state.dataVentilatedSlab->VentSlabNumericFields(Item).FieldNames(FieldNum) + " [m3/s]"; + auto &zoneEqSizing = state.dataSize->ZoneEqSizing(CurZoneEqNum); if (state.dataSize->ZoneHVACSizing(zoneHVACIndex).CoolingSAFMethod > 0) { SizingMethod = HVAC::CoolingAirflowSizing; - SAFMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).CoolingSAFMethod; - ZoneEqSizing(CurZoneEqNum).SizingMethod(SizingMethod) = SAFMethod; - if (SAFMethod == None || SAFMethod == SupplyAirFlowRate || SAFMethod == FlowPerFloorArea || - SAFMethod == FractionOfAutosizedCoolingAirflow) { - if (SAFMethod == SupplyAirFlowRate) { + int SAFMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).CoolingSAFMethod; + zoneEqSizing.SizingMethod(SizingMethod) = SAFMethod; + if (SAFMethod == DataSizing::None || SAFMethod == DataSizing::SupplyAirFlowRate || SAFMethod == DataSizing::FlowPerFloorArea || + SAFMethod == DataSizing::FractionOfAutosizedCoolingAirflow) { + if (SAFMethod == DataSizing::SupplyAirFlowRate) { if (state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxCoolAirVolFlow > 0.0) { - ZoneEqSizing(CurZoneEqNum).AirVolFlow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxCoolAirVolFlow; - ZoneEqSizing(CurZoneEqNum).SystemAirFlow = true; + zoneEqSizing.AirVolFlow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxCoolAirVolFlow; + zoneEqSizing.SystemAirFlow = true; } TempSize = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxCoolAirVolFlow; - } else if (SAFMethod == FlowPerFloorArea) { - ZoneEqSizing(CurZoneEqNum).SystemAirFlow = true; - ZoneEqSizing(CurZoneEqNum).AirVolFlow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxCoolAirVolFlow * - state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea; - TempSize = ZoneEqSizing(CurZoneEqNum).AirVolFlow; + } else if (SAFMethod == DataSizing::FlowPerFloorArea) { + zoneEqSizing.SystemAirFlow = true; + zoneEqSizing.AirVolFlow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxCoolAirVolFlow * + state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea; + TempSize = zoneEqSizing.AirVolFlow; state.dataSize->DataScalableSizingON = true; - } else if (SAFMethod == FractionOfAutosizedCoolingAirflow) { + } else if (SAFMethod == DataSizing::FractionOfAutosizedCoolingAirflow) { state.dataSize->DataFracOfAutosizedCoolingAirflow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxCoolAirVolFlow; - TempSize = AutoSize; + TempSize = DataSizing::AutoSize; state.dataSize->DataScalableSizingON = true; } else { TempSize = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxCoolAirVolFlow; @@ -1955,9 +1767,8 @@ namespace VentilatedSlab { sizingCoolingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); CoolingAirVolFlowScalable = sizingCoolingAirFlow.size(state, TempSize, ErrorsFound); - } else if (SAFMethod == FlowPerCoolingCapacity) { - SizingMethod = CoolingCapacitySizing; - TempSize = AutoSize; + } else if (SAFMethod == DataSizing::FlowPerCoolingCapacity) { + TempSize = DataSizing::AutoSize; PrintFlag = false; state.dataSize->DataScalableSizingON = true; state.dataSize->DataFlowUsedForSizing = state.dataSize->FinalZoneSizing(CurZoneEqNum).DesCoolVolFlow; @@ -1967,7 +1778,7 @@ namespace VentilatedSlab { state.dataSize->DataAutosizedCoolingCapacity = sizerCoolingCapacity.size(state, TempSize, ErrorsFound); state.dataSize->DataFlowPerCoolingCapacity = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxCoolAirVolFlow; PrintFlag = true; - TempSize = AutoSize; + TempSize = DataSizing::AutoSize; CoolingAirFlowSizer sizingCoolingAirFlow; std::string stringOverride = "Maximum Air Flow Rate [m3/s]"; if (state.dataGlobal->isEpJSON) stringOverride = "maximum_air_flow_rate [m3/s]"; @@ -1978,26 +1789,26 @@ namespace VentilatedSlab { } } if (state.dataSize->ZoneHVACSizing(zoneHVACIndex).HeatingSAFMethod > 0) { - SizingMethod = HeatingAirflowSizing; - SAFMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).HeatingSAFMethod; - ZoneEqSizing(CurZoneEqNum).SizingMethod(SizingMethod) = SAFMethod; - if (SAFMethod == None || SAFMethod == SupplyAirFlowRate || SAFMethod == FlowPerFloorArea || - SAFMethod == FractionOfAutosizedHeatingAirflow) { - if (SAFMethod == SupplyAirFlowRate) { + SizingMethod = HVAC::HeatingAirflowSizing; + int SAFMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).HeatingSAFMethod; + zoneEqSizing.SizingMethod(SizingMethod) = SAFMethod; + if (SAFMethod == DataSizing::None || SAFMethod == DataSizing::SupplyAirFlowRate || SAFMethod == DataSizing::FlowPerFloorArea || + SAFMethod == DataSizing::FractionOfAutosizedHeatingAirflow) { + if (SAFMethod == DataSizing::SupplyAirFlowRate) { if (state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxHeatAirVolFlow > 0.0) { - ZoneEqSizing(CurZoneEqNum).AirVolFlow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxHeatAirVolFlow; - ZoneEqSizing(CurZoneEqNum).SystemAirFlow = true; + zoneEqSizing.AirVolFlow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxHeatAirVolFlow; + zoneEqSizing.SystemAirFlow = true; } TempSize = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxHeatAirVolFlow; - } else if (SAFMethod == FlowPerFloorArea) { - ZoneEqSizing(CurZoneEqNum).SystemAirFlow = true; - ZoneEqSizing(CurZoneEqNum).AirVolFlow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxHeatAirVolFlow * - state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea; - TempSize = ZoneEqSizing(CurZoneEqNum).AirVolFlow; + } else if (SAFMethod == DataSizing::FlowPerFloorArea) { + zoneEqSizing.SystemAirFlow = true; + zoneEqSizing.AirVolFlow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxHeatAirVolFlow * + state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea; + TempSize = zoneEqSizing.AirVolFlow; state.dataSize->DataScalableSizingON = true; - } else if (SAFMethod == FractionOfAutosizedHeatingAirflow) { + } else if (SAFMethod == DataSizing::FractionOfAutosizedHeatingAirflow) { state.dataSize->DataFracOfAutosizedHeatingAirflow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxHeatAirVolFlow; - TempSize = AutoSize; + TempSize = DataSizing::AutoSize; state.dataSize->DataScalableSizingON = true; } else { TempSize = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxHeatAirVolFlow; @@ -2007,9 +1818,8 @@ namespace VentilatedSlab { // sizingHeatingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); sizingHeatingAirFlow.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); HeatingAirVolFlowScalable = sizingHeatingAirFlow.size(state, TempSize, ErrorsFound); - } else if (SAFMethod == FlowPerHeatingCapacity) { - SizingMethod = HeatingCapacitySizing; - TempSize = AutoSize; + } else if (SAFMethod == DataSizing::FlowPerHeatingCapacity) { + TempSize = DataSizing::AutoSize; PrintFlag = false; state.dataSize->DataScalableSizingON = true; state.dataSize->DataFlowUsedForSizing = state.dataSize->FinalZoneSizing(CurZoneEqNum).DesHeatVolFlow; @@ -2018,9 +1828,8 @@ namespace VentilatedSlab { sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); state.dataSize->DataAutosizedHeatingCapacity = sizerHeatingCapacity.size(state, TempSize, ErrorsFound); state.dataSize->DataFlowPerHeatingCapacity = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxHeatAirVolFlow; - SizingMethod = HeatingAirflowSizing; PrintFlag = true; - TempSize = AutoSize; + TempSize = DataSizing::AutoSize; HeatingAirFlowSizer sizingHeatingAirFlow; sizingHeatingAirFlow.overrideSizingString(SizingString); // sizingHeatingAirFlow.setHVACSizingIndexData(FanCoil(FanCoilNum).HVACSizingIndex); @@ -2045,8 +1854,8 @@ namespace VentilatedSlab { ventSlab.MaxAirVolFlow = sizerSystemAirFlow.size(state, TempSize, ErrorsFound); } - IsAutoSize = false; - if (ventSlab.OutAirVolFlow == AutoSize) { + bool IsAutoSize = false; + if (ventSlab.OutAirVolFlow == DataSizing::AutoSize) { IsAutoSize = true; } if (CurZoneEqNum > 0) { @@ -2090,7 +1899,7 @@ namespace VentilatedSlab { } IsAutoSize = false; - if (ventSlab.MinOutAirVolFlow == AutoSize) { + if (ventSlab.MinOutAirVolFlow == DataSizing::AutoSize) { IsAutoSize = true; } if (CurZoneEqNum > 0) { @@ -2102,7 +1911,7 @@ namespace VentilatedSlab { } else { CheckZoneSizing(state, cMO_VentilatedSlab, ventSlab.Name); MinOutAirVolFlowDes = min(state.dataSize->FinalZoneSizing(CurZoneEqNum).MinOA, ventSlab.MaxAirVolFlow); - if (MinOutAirVolFlowDes < SmallAirVolFlow) { + if (MinOutAirVolFlowDes < HVAC::SmallAirVolFlow) { MinOutAirVolFlowDes = 0.0; } if (IsAutoSize) { @@ -2139,7 +1948,7 @@ namespace VentilatedSlab { } IsAutoSize = false; - if (ventSlab.MaxVolHotWaterFlow == AutoSize) { + if (ventSlab.MaxVolHotWaterFlow == DataSizing::AutoSize) { IsAutoSize = true; } if (ventSlab.hCoilType == HeatingCoilType::Water) { @@ -2153,12 +1962,12 @@ namespace VentilatedSlab { } else { // Autosize or hard-size with sizing run CheckZoneSizing(state, cMO_VentilatedSlab, ventSlab.Name); - CoilWaterInletNode = WaterCoils::GetCoilWaterInletNode(state, "Coil:Heating:Water", ventSlab.heatingCoilName, ErrorsFound); - CoilWaterOutletNode = WaterCoils::GetCoilWaterOutletNode(state, "Coil:Heating:Water", ventSlab.heatingCoilName, ErrorsFound); + int CoilWaterInletNode = WaterCoils::GetCoilWaterInletNode(state, "Coil:Heating:Water", ventSlab.heatingCoilName, ErrorsFound); + int CoilWaterOutletNode = WaterCoils::GetCoilWaterOutletNode(state, "Coil:Heating:Water", ventSlab.heatingCoilName, ErrorsFound); if (IsAutoSize) { - PltSizHeatNum = MyPlantSizingIndex( + int PltSizHeatNum = PlantUtilities::MyPlantSizingIndex( state, "Coil:Heating:Water", ventSlab.heatingCoilName, CoilWaterInletNode, CoilWaterOutletNode, ErrorsFound); - CoilNum = WaterCoils::GetWaterCoilIndex(state, "COIL:HEATING:WATER", ventSlab.heatingCoilName, ErrorsFound); + int CoilNum = WaterCoils::GetWaterCoilIndex(state, "COIL:HEATING:WATER", ventSlab.heatingCoilName, ErrorsFound); if (state.dataWaterCoils->WaterCoil(CoilNum).UseDesignWaterDeltaTemp) { WaterCoilSizDeltaT = state.dataWaterCoils->WaterCoil(CoilNum).DesignWaterDeltaTemp; DoWaterCoilSizing = true; @@ -2175,34 +1984,33 @@ namespace VentilatedSlab { } } if (DoWaterCoilSizing) { - if (state.dataSize->FinalZoneSizing(CurZoneEqNum).DesHeatMassFlow >= SmallAirVolFlow) { - SizingMethod = HeatingCapacitySizing; + if (state.dataSize->FinalZoneSizing(CurZoneEqNum).DesHeatMassFlow >= HVAC::SmallAirVolFlow) { + auto &zoneEqSizing = state.dataSize->ZoneEqSizing(CurZoneEqNum); + SizingMethod = HVAC::HeatingCapacitySizing; if (ventSlab.HVACSizingIndex > 0) { zoneHVACIndex = ventSlab.HVACSizingIndex; - CapSizingMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).HeatingCapMethod; - ZoneEqSizing(CurZoneEqNum).SizingMethod(SizingMethod) = CapSizingMethod; - if (CapSizingMethod == HeatingDesignCapacity || CapSizingMethod == CapacityPerFloorArea || - CapSizingMethod == FractionOfAutosizedHeatingCapacity) { - if (CapSizingMethod == HeatingDesignCapacity) { + int CapSizingMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).HeatingCapMethod; + zoneEqSizing.SizingMethod(SizingMethod) = CapSizingMethod; + if (CapSizingMethod == DataSizing::HeatingDesignCapacity || CapSizingMethod == DataSizing::CapacityPerFloorArea || + CapSizingMethod == DataSizing::FractionOfAutosizedHeatingCapacity) { + if (CapSizingMethod == DataSizing::HeatingDesignCapacity) { if (state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity > 0.0) { - ZoneEqSizing(CurZoneEqNum).HeatingCapacity = true; - ZoneEqSizing(CurZoneEqNum).DesHeatingLoad = - state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity; + zoneEqSizing.HeatingCapacity = true; + zoneEqSizing.DesHeatingLoad = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity; } else { state.dataSize->DataFlowUsedForSizing = state.dataSize->FinalZoneSizing(CurZoneEqNum).DesHeatVolFlow; } TempSize = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity; - } else if (CapSizingMethod == CapacityPerFloorArea) { - ZoneEqSizing(CurZoneEqNum).HeatingCapacity = true; - ZoneEqSizing(CurZoneEqNum).DesHeatingLoad = - state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity * - state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea; + } else if (CapSizingMethod == DataSizing::CapacityPerFloorArea) { + zoneEqSizing.HeatingCapacity = true; + zoneEqSizing.DesHeatingLoad = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity * + state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea; state.dataSize->DataScalableCapSizingON = true; - } else if (CapSizingMethod == FractionOfAutosizedHeatingCapacity) { + } else if (CapSizingMethod == DataSizing::FractionOfAutosizedHeatingCapacity) { state.dataSize->DataFracOfAutosizedHeatingCapacity = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity; state.dataSize->DataFlowUsedForSizing = state.dataSize->FinalZoneSizing(CurZoneEqNum).DesHeatVolFlow; - TempSize = AutoSize; + TempSize = DataSizing::AutoSize; state.dataSize->DataScalableCapSizingON = true; } } @@ -2216,30 +2024,21 @@ namespace VentilatedSlab { } else { SizingString = ""; PrintFlag = false; - TempSize = AutoSize; + TempSize = DataSizing::AutoSize; HeatingCapacitySizer sizerHeatingCapacity; sizerHeatingCapacity.overrideSizingString(SizingString); sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); DesCoilLoad = sizerHeatingCapacity.size(state, TempSize, ErrorsFound); } - rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(ventSlab.HWPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(ventSlab.HWPlantLoc.loopNum).FluidIndex, - RoutineName); - Cp = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(ventSlab.HWPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(ventSlab.HWPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(ventSlab.HWPlantLoc.loopNum) + .glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); + Cp = state.dataPlnt->PlantLoop(ventSlab.HWPlantLoc.loopNum) + .glycol->getSpecificHeat(state, Constant::HWInitConvTemp, RoutineName); MaxVolHotWaterFlowDes = DesCoilLoad / (WaterCoilSizDeltaT * Cp * rho); } else { MaxVolHotWaterFlowDes = 0.0; } } - } - - if (IsAutoSize) { ventSlab.MaxVolHotWaterFlow = MaxVolHotWaterFlowDes; BaseSizer::reportSizerOutput( state, cMO_VentilatedSlab, ventSlab.Name, "Design Size Maximum Hot Water Flow [m3/s]", MaxVolHotWaterFlowDes); @@ -2277,7 +2076,7 @@ namespace VentilatedSlab { } IsAutoSize = false; - if (ventSlab.MaxVolHotSteamFlow == AutoSize) { + if (ventSlab.MaxVolHotSteamFlow == DataSizing::AutoSize) { IsAutoSize = true; } if (ventSlab.hCoilType == HeatingCoilType::Steam) { @@ -2291,40 +2090,39 @@ namespace VentilatedSlab { } else { // Autosize or hard-size with sizing run CheckZoneSizing(state, "ZoneHVAC:VentilatedSlab", ventSlab.Name); - CoilSteamInletNode = GetCoilSteamInletNode(state, "Coil:Heating:Steam", ventSlab.heatingCoilName, ErrorsFound); - CoilSteamOutletNode = GetCoilSteamOutletNode(state, "Coil:Heating:Steam", ventSlab.heatingCoilName, ErrorsFound); + int CoilSteamInletNode = SteamCoils::GetCoilSteamInletNode(state, "Coil:Heating:Steam", ventSlab.heatingCoilName, ErrorsFound); + int CoilSteamOutletNode = SteamCoils::GetCoilSteamOutletNode(state, "Coil:Heating:Steam", ventSlab.heatingCoilName, ErrorsFound); if (IsAutoSize) { - PltSizHeatNum = MyPlantSizingIndex( + int PltSizHeatNum = PlantUtilities::MyPlantSizingIndex( state, "Coil:Heating:Steam", ventSlab.heatingCoilName, CoilSteamInletNode, CoilSteamOutletNode, ErrorsFound); if (PltSizHeatNum > 0) { - if (state.dataSize->FinalZoneSizing(CurZoneEqNum).DesHeatMassFlow >= SmallAirVolFlow) { - SizingMethod = HeatingCapacitySizing; + if (state.dataSize->FinalZoneSizing(CurZoneEqNum).DesHeatMassFlow >= HVAC::SmallAirVolFlow) { + SizingMethod = HVAC::HeatingCapacitySizing; if (ventSlab.HVACSizingIndex > 0) { + auto &zoneEqSizing = state.dataSize->ZoneEqSizing(CurZoneEqNum); zoneHVACIndex = ventSlab.HVACSizingIndex; - CapSizingMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).HeatingCapMethod; - ZoneEqSizing(CurZoneEqNum).SizingMethod(SizingMethod) = CapSizingMethod; - if (CapSizingMethod == HeatingDesignCapacity || CapSizingMethod == CapacityPerFloorArea || - CapSizingMethod == FractionOfAutosizedHeatingCapacity) { - if (CapSizingMethod == HeatingDesignCapacity) { + int CapSizingMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).HeatingCapMethod; + zoneEqSizing.SizingMethod(SizingMethod) = CapSizingMethod; + if (CapSizingMethod == DataSizing::HeatingDesignCapacity || CapSizingMethod == DataSizing::CapacityPerFloorArea || + CapSizingMethod == DataSizing::FractionOfAutosizedHeatingCapacity) { + if (CapSizingMethod == DataSizing::HeatingDesignCapacity) { if (state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity > 0.0) { - ZoneEqSizing(CurZoneEqNum).HeatingCapacity = true; - ZoneEqSizing(CurZoneEqNum).DesHeatingLoad = - state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity; + zoneEqSizing.HeatingCapacity = true; + zoneEqSizing.DesHeatingLoad = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity; } else { state.dataSize->DataFlowUsedForSizing = state.dataSize->FinalZoneSizing(CurZoneEqNum).DesHeatVolFlow; } TempSize = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity; - } else if (CapSizingMethod == CapacityPerFloorArea) { - ZoneEqSizing(CurZoneEqNum).HeatingCapacity = true; - ZoneEqSizing(CurZoneEqNum).DesHeatingLoad = - state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity * - state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea; + } else if (CapSizingMethod == DataSizing::CapacityPerFloorArea) { + zoneEqSizing.HeatingCapacity = true; + zoneEqSizing.DesHeatingLoad = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity * + state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea; state.dataSize->DataScalableCapSizingON = true; - } else if (CapSizingMethod == FractionOfAutosizedHeatingCapacity) { + } else if (CapSizingMethod == DataSizing::FractionOfAutosizedHeatingCapacity) { state.dataSize->DataFracOfAutosizedHeatingCapacity = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledHeatingCapacity; state.dataSize->DataFlowUsedForSizing = state.dataSize->FinalZoneSizing(CurZoneEqNum).DesHeatVolFlow; - TempSize = AutoSize; + TempSize = DataSizing::AutoSize; state.dataSize->DataScalableCapSizingON = true; } } @@ -2338,22 +2136,23 @@ namespace VentilatedSlab { } else { SizingString = ""; PrintFlag = false; - TempSize = AutoSize; + TempSize = DataSizing::AutoSize; HeatingCapacitySizer sizerHeatingCapacity; sizerHeatingCapacity.overrideSizingString(SizingString); sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); DesCoilLoad = sizerHeatingCapacity.size(state, TempSize, ErrorsFound); } TempSteamIn = 100.00; - EnthSteamInDry = FluidProperties::GetSatEnthalpyRefrig( - state, fluidNameSteam, TempSteamIn, 1.0, ventSlab.heatingCoil_FluidIndex, RoutineName); - EnthSteamOutWet = FluidProperties::GetSatEnthalpyRefrig( - state, fluidNameSteam, TempSteamIn, 0.0, ventSlab.heatingCoil_FluidIndex, RoutineName); + auto *steam = Fluid::GetSteam(state); + EnthSteamInDry = steam->getSatEnthalpy(state, TempSteamIn, 1.0, RoutineName); + EnthSteamOutWet = steam->getSatEnthalpy(state, TempSteamIn, 0.0, RoutineName); LatentHeatSteam = EnthSteamInDry - EnthSteamOutWet; - SteamDensity = FluidProperties::GetSatDensityRefrig( - state, fluidNameSteam, TempSteamIn, 1.0, ventSlab.heatingCoil_FluidIndex, RoutineName); - Cp = GetSpecificHeatGlycol(state, fluidNameWater, Constant::HWInitConvTemp, DummyWaterIndex, RoutineName); - rho = GetDensityGlycol(state, fluidNameWater, Constant::HWInitConvTemp, DummyWaterIndex, RoutineName); + SteamDensity = steam->getSatDensity(state, TempSteamIn, 1.0, RoutineName); + int DummyWaterIndex = 1; + + auto *water = Fluid::GetWater(state); + Cp = water->getSpecificHeat(state, Constant::HWInitConvTemp, RoutineName); + rho = water->getDensity(state, Constant::HWInitConvTemp, RoutineName); MaxVolHotSteamFlowDes = DesCoilLoad / ((state.dataSize->PlantSizData(PltSizHeatNum).DeltaT * Cp * rho) + SteamDensity * LatentHeatSteam); } else { @@ -2364,8 +2163,6 @@ namespace VentilatedSlab { ShowContinueError(state, format("Occurs in ZoneHVAC:VentilatedSlab Object={}", ventSlab.Name)); ErrorsFound = true; } - } - if (IsAutoSize) { ventSlab.MaxVolHotSteamFlow = MaxVolHotSteamFlowDes; BaseSizer::reportSizerOutput( state, cMO_VentilatedSlab, ventSlab.Name, "Design Size Maximum Steam Flow [m3/s]", MaxVolHotSteamFlowDes); @@ -2402,7 +2199,7 @@ namespace VentilatedSlab { } IsAutoSize = false; - if (ventSlab.MaxVolColdWaterFlow == AutoSize) { + if (ventSlab.MaxVolColdWaterFlow == DataSizing::AutoSize) { IsAutoSize = true; } if (CurZoneEqNum > 0) { @@ -2414,17 +2211,20 @@ namespace VentilatedSlab { } else { CheckZoneSizing(state, cMO_VentilatedSlab, ventSlab.Name); if (ventSlab.cCoilType == CoolingCoilType::HXAssisted) { - CoolingCoilName = GetHXDXCoilName(state, ventSlab.coolingCoilTypeCh, ventSlab.coolingCoilName, ErrorsFound); - CoolingCoilType = GetHXCoilType(state, ventSlab.coolingCoilTypeCh, ventSlab.coolingCoilName, ErrorsFound); + CoolingCoilName = + HVACHXAssistedCoolingCoil::GetHXDXCoilName(state, ventSlab.coolingCoilTypeCh, ventSlab.coolingCoilName, ErrorsFound); + CoolingCoilType = + HVACHXAssistedCoolingCoil::GetHXCoilType(state, ventSlab.coolingCoilTypeCh, ventSlab.coolingCoilName, ErrorsFound); } else { CoolingCoilName = ventSlab.coolingCoilName; CoolingCoilType = ventSlab.coolingCoilTypeCh; } - CoilWaterInletNode = WaterCoils::GetCoilWaterInletNode(state, CoolingCoilType, CoolingCoilName, ErrorsFound); - CoilWaterOutletNode = WaterCoils::GetCoilWaterOutletNode(state, CoolingCoilType, CoolingCoilName, ErrorsFound); + int CoilWaterInletNode = WaterCoils::GetCoilWaterInletNode(state, CoolingCoilType, CoolingCoilName, ErrorsFound); + int CoilWaterOutletNode = WaterCoils::GetCoilWaterOutletNode(state, CoolingCoilType, CoolingCoilName, ErrorsFound); if (IsAutoSize) { - PltSizCoolNum = MyPlantSizingIndex(state, CoolingCoilType, CoolingCoilName, CoilWaterInletNode, CoilWaterOutletNode, ErrorsFound); - CoilNum = WaterCoils::GetWaterCoilIndex(state, CoolingCoilType, CoolingCoilName, ErrorsFound); + int PltSizCoolNum = PlantUtilities::MyPlantSizingIndex( + state, CoolingCoilType, CoolingCoilName, CoilWaterInletNode, CoilWaterOutletNode, ErrorsFound); + int CoilNum = WaterCoils::GetWaterCoilIndex(state, CoolingCoilType, CoolingCoilName, ErrorsFound); if (state.dataWaterCoils->WaterCoil(CoilNum).UseDesignWaterDeltaTemp) { WaterCoilSizDeltaT = state.dataWaterCoils->WaterCoil(CoilNum).DesignWaterDeltaTemp; DoWaterCoilSizing = true; @@ -2441,34 +2241,33 @@ namespace VentilatedSlab { } } if (DoWaterCoilSizing) { - if (state.dataSize->FinalZoneSizing(CurZoneEqNum).DesCoolMassFlow >= SmallAirVolFlow) { - SizingMethod = CoolingCapacitySizing; + if (state.dataSize->FinalZoneSizing(CurZoneEqNum).DesCoolMassFlow >= HVAC::SmallAirVolFlow) { + SizingMethod = HVAC::CoolingCapacitySizing; if (ventSlab.HVACSizingIndex > 0) { + auto &zoneEqSizing = state.dataSize->ZoneEqSizing(CurZoneEqNum); zoneHVACIndex = ventSlab.HVACSizingIndex; - CapSizingMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).CoolingCapMethod; - ZoneEqSizing(CurZoneEqNum).SizingMethod(SizingMethod) = CapSizingMethod; - if (CapSizingMethod == CoolingDesignCapacity || CapSizingMethod == CapacityPerFloorArea || - CapSizingMethod == FractionOfAutosizedCoolingCapacity) { - if (CapSizingMethod == CoolingDesignCapacity) { + int CapSizingMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).CoolingCapMethod; + zoneEqSizing.SizingMethod(SizingMethod) = CapSizingMethod; + if (CapSizingMethod == DataSizing::CoolingDesignCapacity || CapSizingMethod == DataSizing::CapacityPerFloorArea || + CapSizingMethod == DataSizing::FractionOfAutosizedCoolingCapacity) { + if (CapSizingMethod == DataSizing::CoolingDesignCapacity) { if (state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledCoolingCapacity > 0.0) { - ZoneEqSizing(CurZoneEqNum).CoolingCapacity = true; - ZoneEqSizing(CurZoneEqNum).DesCoolingLoad = - state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledCoolingCapacity; + zoneEqSizing.CoolingCapacity = true; + zoneEqSizing.DesCoolingLoad = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledCoolingCapacity; } else { state.dataSize->DataFlowUsedForSizing = state.dataSize->FinalZoneSizing(CurZoneEqNum).DesCoolVolFlow; } TempSize = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledCoolingCapacity; - } else if (CapSizingMethod == CapacityPerFloorArea) { - ZoneEqSizing(CurZoneEqNum).CoolingCapacity = true; - ZoneEqSizing(CurZoneEqNum).DesCoolingLoad = - state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledCoolingCapacity * - state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea; + } else if (CapSizingMethod == DataSizing::CapacityPerFloorArea) { + zoneEqSizing.CoolingCapacity = true; + zoneEqSizing.DesCoolingLoad = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledCoolingCapacity * + state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea; state.dataSize->DataScalableCapSizingON = true; - } else if (CapSizingMethod == FractionOfAutosizedCoolingCapacity) { + } else if (CapSizingMethod == DataSizing::FractionOfAutosizedCoolingCapacity) { state.dataSize->DataFracOfAutosizedHeatingCapacity = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledCoolingCapacity; state.dataSize->DataFlowUsedForSizing = state.dataSize->FinalZoneSizing(CurZoneEqNum).DesCoolVolFlow; - TempSize = AutoSize; + TempSize = DataSizing::AutoSize; state.dataSize->DataScalableCapSizingON = true; } } @@ -2482,30 +2281,20 @@ namespace VentilatedSlab { } else { SizingString = ""; PrintFlag = false; - TempSize = AutoSize; + TempSize = DataSizing::AutoSize; state.dataSize->DataFlowUsedForSizing = state.dataSize->FinalZoneSizing(CurZoneEqNum).DesCoolVolFlow; CoolingCapacitySizer sizerCoolingCapacity; sizerCoolingCapacity.overrideSizingString(SizingString); sizerCoolingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); DesCoilLoad = sizerCoolingCapacity.size(state, TempSize, ErrorsFound); } - rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(ventSlab.CWPlantLoc.loopNum).FluidName, - 5., - state.dataPlnt->PlantLoop(ventSlab.CWPlantLoc.loopNum).FluidIndex, - RoutineName); - Cp = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(ventSlab.CWPlantLoc.loopNum).FluidName, - 5., - state.dataPlnt->PlantLoop(ventSlab.CWPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(ventSlab.CWPlantLoc.loopNum).glycol->getDensity(state, 5., RoutineName); + Cp = state.dataPlnt->PlantLoop(ventSlab.CWPlantLoc.loopNum).glycol->getSpecificHeat(state, 5., RoutineName); MaxVolColdWaterFlowDes = DesCoilLoad / (WaterCoilSizDeltaT * Cp * rho); } else { MaxVolColdWaterFlowDes = 0.0; } } - } - if (IsAutoSize) { ventSlab.MaxVolColdWaterFlow = MaxVolColdWaterFlowDes; BaseSizer::reportSizerOutput( state, cMO_VentilatedSlab, ventSlab.Name, "Design Size Maximum Cold Water Flow [m3/s]", MaxVolColdWaterFlowDes); @@ -2538,8 +2327,8 @@ namespace VentilatedSlab { } if (ventSlab.cCoilType == CoolingCoilType::HXAssisted) { - CoolingCoilName = GetHXDXCoilName(state, ventSlab.coolingCoilTypeCh, ventSlab.coolingCoilName, ErrorsFound); - CoolingCoilType = GetHXCoilType(state, ventSlab.coolingCoilTypeCh, ventSlab.coolingCoilName, ErrorsFound); + CoolingCoilName = HVACHXAssistedCoolingCoil::GetHXDXCoilName(state, ventSlab.coolingCoilTypeCh, ventSlab.coolingCoilName, ErrorsFound); + CoolingCoilType = HVACHXAssistedCoolingCoil::GetHXCoilType(state, ventSlab.coolingCoilTypeCh, ventSlab.coolingCoilName, ErrorsFound); } else { CoolingCoilName = ventSlab.coolingCoilName; CoolingCoilType = ventSlab.coolingCoilTypeCh; @@ -2548,8 +2337,9 @@ namespace VentilatedSlab { WaterCoils::SetCoilDesFlow(state, ventSlab.heatingCoilTypeCh, ventSlab.heatingCoilName, ventSlab.MaxAirVolFlow, ErrorsFound); if (CurZoneEqNum > 0) { - ZoneEqSizing(CurZoneEqNum).MaxHWVolFlow = ventSlab.MaxVolHotWaterFlow; - ZoneEqSizing(CurZoneEqNum).MaxCWVolFlow = ventSlab.MaxVolColdWaterFlow; + auto &zoneEqSizing = state.dataSize->ZoneEqSizing(CurZoneEqNum); + zoneEqSizing.MaxHWVolFlow = ventSlab.MaxVolHotWaterFlow; + zoneEqSizing.MaxCWVolFlow = ventSlab.MaxVolColdWaterFlow; } if (ErrorsFound) { @@ -2571,7 +2361,6 @@ namespace VentilatedSlab { // DATE WRITTEN June 2008 // MODIFIED Don Shirey, Aug 2009 (LatOutputProvided) // July 2012, Chandan Sharma - FSEC: Added zone sys avail managers - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine mainly controls the action of the Ventilated Slab @@ -2609,36 +2398,17 @@ namespace VentilatedSlab { // REFERENCES: // ASHRAE Systems and Equipment Handbook (SI), 1996. page 31.3 - // USE STATEMENTS: - // Using/Aliasing auto &ventSlab = state.dataVentilatedSlab->VentSlab(Item); - using HeatingCoils::CheckHeatingCoilSchedule; - using HVACHXAssistedCoolingCoil::CheckHXAssistedCoolingCoilSchedule; - using NodeInputManager::GetOnlySingleNode; - using ScheduleManager::GetCurrentScheduleValue; - using SteamCoils::CheckSteamCoilSchedule; - using WaterCoils::CheckWaterCoilSchedule; - - // Locals - Real64 QZnReq; - - // SUBROUTINE ARGUMENT DEFINITIONS: - // SUBROUTINE PARAMETER DEFINITIONS: - Real64 constexpr LowTempDiff(0.1); // Smallest allowed temperature difference for comparisons // (below this value the temperatures are assumed equal) Real64 constexpr LowOAFracDiff(0.01); // Smallest allowed outside air fraction difference for comparison // (below this value the fractions are assumed equal) - // INTERFACE BLOCK SPECIFICATIONS - - // DERIVED TYPE DEFINITIONS - // na - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + Real64 QZnReq; Real64 AirMassFlow; // air mass flow rate [kg/sec] int AirRelNode; // outside air relief node int ControlNode; // the hot water or cold water inlet node @@ -2671,12 +2441,6 @@ namespace VentilatedSlab { Real64 CpFan; // Intermediate calculational variable for specific heat of air <Node(InletNode).Temp; Toutdoor = state.dataLoopNodes->Node(OutsideAirNode).Temp; - auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); + auto const &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); // Control Type Check switch (ventSlab.controlType) { @@ -2825,23 +2589,23 @@ namespace VentilatedSlab { break; } case ControlType::DewPointTemp: { - SetPointTemp = - PsyTdpFnWPb(state, state.dataZoneTempPredictorCorrector->zoneHeatBalance(ventSlab.ZonePtr).airHumRat, state.dataEnvrn->OutBaroPress); + SetPointTemp = Psychrometrics::PsyTdpFnWPb( + state, state.dataZoneTempPredictorCorrector->zoneHeatBalance(ventSlab.ZonePtr).airHumRat, state.dataEnvrn->OutBaroPress); break; } default: { // Should never get here SetPointTemp = 0.0; // Suppress uninitialized warning ShowSevereError(state, format("Illegal control type in low temperature radiant system: {}", ventSlab.Name)); ShowFatalError(state, "Preceding condition causes termination."); - } - } + } break; + } // switch (ctrlType) // Load Check - AirTempHeatHi = GetCurrentScheduleValue(state, ventSlab.HotCtrlHiTempSchedPtr); - AirTempCoolLo = GetCurrentScheduleValue(state, ventSlab.ColdCtrlLoTempSchedPtr); + AirTempHeatHi = ventSlab.hotCtrlHiTempSched->getCurrentVal(); + AirTempCoolLo = ventSlab.coldCtrlLoTempSched->getCurrentVal(); - if (((SetPointTemp >= AirTempHeatHi) && (SetPointTemp <= AirTempCoolLo)) || (GetCurrentScheduleValue(state, ventSlab.SchedPtr) <= 0)) { + if (((SetPointTemp >= AirTempHeatHi) && (SetPointTemp <= AirTempCoolLo)) || (ventSlab.availSched->getCurrentVal() <= 0)) { // System is off or has no load upon it; set the flow rates to zero and then // simulate the components with the no flow conditions @@ -2876,30 +2640,31 @@ namespace VentilatedSlab { // Node condition if (ventSlab.SysConfg == VentilatedSlabConfig::SeriesSlabs) { + bool ErrorsFound = false; // Set to true if errors in input, fatal at end of routine for (RadSurfNum = 1; RadSurfNum <= ventSlab.NumOfSurfaces; ++RadSurfNum) { - SlabName = ventSlab.SurfaceName(RadSurfNum); - MSlabIn = ventSlab.SlabIn(RadSurfNum); - MSlabOut = ventSlab.SlabOut(RadSurfNum); - ventSlab.MSlabInNode = GetOnlySingleNode(state, - MSlabIn, - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, - SlabName, - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Internal, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); - ventSlab.MSlabOutNode = GetOnlySingleNode(state, - MSlabOut, - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, - SlabName, - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Internal, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); - MSlabInletNode = ventSlab.MSlabInNode; - MSlabOutletNode = ventSlab.MSlabOutNode; + std::string SlabName = ventSlab.SurfaceName(RadSurfNum); + std::string MSlabIn = ventSlab.SlabIn(RadSurfNum); + std::string MSlabOut = ventSlab.SlabOut(RadSurfNum); + ventSlab.MSlabInNode = NodeInputManager::GetOnlySingleNode(state, + MSlabIn, + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, + SlabName, + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Internal, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsNotParent); + ventSlab.MSlabOutNode = NodeInputManager::GetOnlySingleNode(state, + MSlabOut, + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, + SlabName, + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Internal, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsNotParent); + int MSlabInletNode = ventSlab.MSlabInNode; + int MSlabOutletNode = ventSlab.MSlabOutNode; state.dataLoopNodes->Node(MSlabInletNode).Temp = state.dataLoopNodes->Node(InletNode).Temp; state.dataLoopNodes->Node(MSlabOutletNode).Temp = state.dataLoopNodes->Node(MSlabInletNode).Temp; @@ -2914,15 +2679,16 @@ namespace VentilatedSlab { state.dataVentilatedSlab->OperatingMode = HeatingMode; // Check the setpoint and temperature span - SetPointTempHi = GetCurrentScheduleValue(state, ventSlab.HotCtrlHiTempSchedPtr); - SetPointTempLo = GetCurrentScheduleValue(state, ventSlab.HotCtrlLoTempSchedPtr); + SetPointTempHi = ventSlab.hotCtrlHiTempSched->getCurrentVal(); + SetPointTempLo = ventSlab.hotCtrlLoTempSched->getCurrentVal(); if (SetPointTempHi < SetPointTempLo) { ShowSevereError(state, format("Heating setpoint temperature mismatch in{}", ventSlab.Name)); ShowContinueError(state, "High setpoint temperature is less than low setpoint temperature--check your schedule input"); ShowFatalError(state, "Preceding condition causes termination."); } - AirTempHi = GetCurrentScheduleValue(state, ventSlab.HotAirHiTempSchedPtr); - AirTempLo = GetCurrentScheduleValue(state, ventSlab.HotAirLoTempSchedPtr); + + AirTempHi = ventSlab.hotAirHiTempSched->getCurrentVal(); + AirTempLo = ventSlab.hotAirLoTempSched->getCurrentVal(); if (AirTempHi < AirTempLo) { ShowSevereError(state, format("Heating Air temperature mismatch in{}", ventSlab.Name)); @@ -2966,8 +2732,8 @@ namespace VentilatedSlab { state.dataVentilatedSlab->HCoilOn = true; if (state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate > 0.0) { - MinOAFrac = GetCurrentScheduleValue(state, ventSlab.MinOASchedPtr) * - (ventSlab.MinOutAirMassFlow / state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate); + MinOAFrac = + ventSlab.minOASched->getCurrentVal() * (ventSlab.MinOutAirMassFlow / state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate); } else { MinOAFrac = 0.0; } @@ -3007,15 +2773,14 @@ namespace VentilatedSlab { state.dataVentilatedSlab->OAMassFlowRate = MinOAFrac * state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate; } else { // Tinlet < Toutdoor - - MaxOAFrac = GetCurrentScheduleValue(state, ventSlab.MaxOASchedPtr); + MaxOAFrac = ventSlab.maxOASched->getCurrentVal(); state.dataVentilatedSlab->OAMassFlowRate = MaxOAFrac * state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate; } break; } case OutsideAirControlType::FixedTemperature: { // This is basically the same algorithm as for the heating case... - Tdesired = GetCurrentScheduleValue(state, ventSlab.TempSchedPtr); + Tdesired = ventSlab.tempSched->getCurrentVal(); MaxOAFrac = 1.0; if (std::abs(Tinlet - Toutdoor) <= LowTempDiff) { // no difference in indoor and outdoor conditions-->set OA to minimum @@ -3068,11 +2833,10 @@ namespace VentilatedSlab { // In this control type, the outdoor air flow rate is fixed to the maximum value // which is equal to the minimum value, regardless of all the other conditions. if (state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate > 0.0) { - MaxOAFrac = GetCurrentScheduleValue(state, ventSlab.MaxOASchedPtr); + MaxOAFrac = min(1.0, max(0.0, ventSlab.maxOASched->getCurrentVal())); } else { MaxOAFrac = 0.0; } - MaxOAFrac = min(1.0, max(0.0, MinOAFrac)); state.dataVentilatedSlab->OAMassFlowRate = MaxOAFrac * state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate; break; } @@ -3085,7 +2849,7 @@ namespace VentilatedSlab { } case OutsideAirControlType::FixedTemperature: { // This is basically the same algorithm as for the heating case... - Tdesired = GetCurrentScheduleValue(state, ventSlab.TempSchedPtr); + Tdesired = ventSlab.tempSched->getCurrentVal(); MaxOAFrac = 1.0; if (std::abs(Tinlet - Toutdoor) <= LowTempDiff) { // no difference in indoor and outdoor conditions-->set OA to minimum @@ -3133,7 +2897,7 @@ namespace VentilatedSlab { state.dataFans->fans(ventSlab.Fan_Index)->simulate(state, FirstHVACIteration, _, _); - CpFan = PsyCpAirFnW(state.dataLoopNodes->Node(FanOutletNode).HumRat); + CpFan = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(FanOutletNode).HumRat); QZnReq = (state.dataLoopNodes->Node(OutletNode).MassFlowRate) * CpFan * (RadInTemp - state.dataLoopNodes->Node(FanOutletNode).Temp); @@ -3179,17 +2943,16 @@ namespace VentilatedSlab { } else if (SetPointTemp > AirTempCoolLo) { // Cooling Mode state.dataVentilatedSlab->OperatingMode = CoolingMode; - - SetPointTempHi = GetCurrentScheduleValue(state, ventSlab.ColdCtrlHiTempSchedPtr); - SetPointTempLo = GetCurrentScheduleValue(state, ventSlab.ColdCtrlLoTempSchedPtr); + SetPointTempHi = ventSlab.coldCtrlHiTempSched->getCurrentVal(); + SetPointTempLo = ventSlab.coldCtrlLoTempSched->getCurrentVal(); if (SetPointTempHi < SetPointTempLo) { ShowSevereError(state, format("Cooling setpoint temperature mismatch in{}", ventSlab.Name)); ShowContinueError(state, "High setpoint temperature is less than low setpoint temperature--check your schedule input"); ShowFatalError(state, "Preceding condition causes termination."); } - AirTempHi = GetCurrentScheduleValue(state, ventSlab.ColdAirHiTempSchedPtr); - AirTempLo = GetCurrentScheduleValue(state, ventSlab.ColdAirLoTempSchedPtr); + AirTempHi = ventSlab.coldAirHiTempSched->getCurrentVal(); + AirTempLo = ventSlab.coldAirLoTempSched->getCurrentVal(); if (AirTempHi < AirTempLo) { ShowSevereError(state, format("Cooling Air temperature mismatch in{}", ventSlab.Name)); ShowContinueError(state, "High Air temperature is less than low Air temperature--check your schedule input"); @@ -3220,8 +2983,8 @@ namespace VentilatedSlab { state.dataVentilatedSlab->HCoilOn = false; if (state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate > 0.0) { - MinOAFrac = GetCurrentScheduleValue(state, ventSlab.MinOASchedPtr) * - (ventSlab.MinOutAirMassFlow / state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate); + MinOAFrac = + ventSlab.minOASched->getCurrentVal() * (ventSlab.MinOutAirMassFlow / state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate); } else { MinOAFrac = 0.0; } @@ -3243,11 +3006,10 @@ namespace VentilatedSlab { // In this control type, the outdoor air flow rate is fixed to the maximum value // which is equal to the minimum value, regardless of all the other conditions. if (state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate > 0.0) { - MaxOAFrac = GetCurrentScheduleValue(state, ventSlab.MaxOASchedPtr); + MaxOAFrac = min(1.0, max(0.0, ventSlab.maxOASched->getCurrentVal())); } else { MaxOAFrac = 0.0; } - MaxOAFrac = min(1.0, max(0.0, MinOAFrac)); state.dataVentilatedSlab->OAMassFlowRate = MaxOAFrac * state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate; break; } @@ -3267,15 +3029,14 @@ namespace VentilatedSlab { state.dataVentilatedSlab->OAMassFlowRate = MinOAFrac * state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate; } else { // Tinlet > Toutdoor - - MaxOAFrac = GetCurrentScheduleValue(state, ventSlab.MaxOASchedPtr); + MaxOAFrac = ventSlab.maxOASched->getCurrentVal(); state.dataVentilatedSlab->OAMassFlowRate = MaxOAFrac * state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate; } break; } case OutsideAirControlType::FixedTemperature: { // This is basically the same algorithm as for the heating case... - Tdesired = GetCurrentScheduleValue(state, ventSlab.TempSchedPtr); + Tdesired = ventSlab.tempSched->getCurrentVal(); MaxOAFrac = 1.0; if (std::abs(Tinlet - Toutdoor) <= LowTempDiff) { // no difference in indoor and outdoor conditions-->set OA to minimum @@ -3333,11 +3094,10 @@ namespace VentilatedSlab { // In this control type, the outdoor air flow rate is fixed to the maximum value // which is equal to the minimum value, regardless of all the other conditions. if (state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate > 0.0) { - MaxOAFrac = GetCurrentScheduleValue(state, ventSlab.MaxOASchedPtr); + MaxOAFrac = min(1.0, max(0.0, ventSlab.maxOASched->getCurrentVal())); } else { MaxOAFrac = 0.0; } - MaxOAFrac = min(1.0, max(0.0, MinOAFrac)); state.dataVentilatedSlab->OAMassFlowRate = MaxOAFrac * state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate; break; } @@ -3348,7 +3108,7 @@ namespace VentilatedSlab { } case OutsideAirControlType::FixedTemperature: { // This is basically the same algorithm as for the heating case... - Tdesired = GetCurrentScheduleValue(state, ventSlab.TempSchedPtr); + Tdesired = ventSlab.tempSched->getCurrentVal(); MaxOAFrac = 1.0; @@ -3399,7 +3159,7 @@ namespace VentilatedSlab { SimVentSlabOAMixer(state, Item); state.dataFans->fans(ventSlab.Fan_Index)->simulate(state, FirstHVACIteration, _, _); - CpFan = PsyCpAirFnW(state.dataLoopNodes->Node(FanOutletNode).HumRat); + CpFan = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(FanOutletNode).HumRat); QZnReq = (state.dataLoopNodes->Node(OutletNode).MassFlowRate) * CpFan * (RadInTemp - state.dataLoopNodes->Node(FanOutletNode).Temp); @@ -3458,7 +3218,6 @@ namespace VentilatedSlab { // AUTHOR Young Tae Chae, Rick Strand // DATE WRITTEN June 2008 // MODIFIED July 2012, Chandan Sharma - FSEC: Added zone sys avail managers - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine launches the individual component simulations. @@ -3474,15 +3233,10 @@ namespace VentilatedSlab { // Using/Aliasing auto &ventSlab = state.dataVentilatedSlab->VentSlab(Item); - using HeatingCoils::SimulateHeatingCoilComponents; - using HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil; - using SteamCoils::SimulateSteamCoilComponents; - using WaterCoils::SimulateWaterCoilComponents; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 AirMassFlow; // total mass flow through the system Real64 CpAirZn; // specific heat of dry air at zone conditions (zone conditions same as system inlet) - int HCoilInAirNode; // inlet node number for fan exit/coil inlet int InletNode; // system air inlet node int OutletNode; // system air outlet node // unused0309 INTEGER :: HCoilOutAirNode @@ -3496,15 +3250,15 @@ namespace VentilatedSlab { if ((ventSlab.coolingCoilPresent) && (ventSlab.coolingCoilSchedValue >= 0.0)) { if (ventSlab.cCoilType == CoolingCoilType::HXAssisted) { - SimHXAssistedCoolingCoil(state, - ventSlab.coolingCoilName, - FirstHVACIteration, - HVAC::CompressorOp::On, - 0.0, - ventSlab.coolingCoil_Index, - HVAC::FanOp::Continuous); + HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil(state, + ventSlab.coolingCoilName, + FirstHVACIteration, + HVAC::CompressorOp::On, + 0.0, + ventSlab.coolingCoil_Index, + HVAC::FanOp::Continuous); } else { - SimulateWaterCoilComponents(state, ventSlab.coolingCoilName, FirstHVACIteration, ventSlab.coolingCoil_Index); + WaterCoils::SimulateWaterCoilComponents(state, ventSlab.coolingCoilName, FirstHVACIteration, ventSlab.coolingCoil_Index); } } @@ -3514,7 +3268,7 @@ namespace VentilatedSlab { case HeatingCoilType::Water: { - SimulateWaterCoilComponents(state, ventSlab.heatingCoilName, FirstHVACIteration, ventSlab.heatingCoil_Index); + WaterCoils::SimulateWaterCoilComponents(state, ventSlab.heatingCoilName, FirstHVACIteration, ventSlab.heatingCoil_Index); break; } case HeatingCoilType::Steam: { @@ -3522,8 +3276,8 @@ namespace VentilatedSlab { if (!state.dataVentilatedSlab->HCoilOn) { QCoilReq = 0.0; } else { - HCoilInAirNode = ventSlab.FanOutletNode; - CpAirZn = PsyCpAirFnW(state.dataLoopNodes->Node(HCoilInAirNode).HumRat); + int HCoilInAirNode = ventSlab.FanOutletNode; + CpAirZn = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(HCoilInAirNode).HumRat); QCoilReq = state.dataLoopNodes->Node(HCoilInAirNode).MassFlowRate * CpAirZn * (state.dataLoopNodes->Node(ventSlab.RadInNode).Temp) - (state.dataLoopNodes->Node(HCoilInAirNode).Temp); @@ -3531,7 +3285,7 @@ namespace VentilatedSlab { if (QCoilReq < 0.0) QCoilReq = 0.0; // a heating coil can only heat, not cool - SimulateSteamCoilComponents(state, ventSlab.heatingCoilName, FirstHVACIteration, ventSlab.heatingCoil_Index, QCoilReq); + SteamCoils::SimulateSteamCoilComponents(state, ventSlab.heatingCoilName, FirstHVACIteration, ventSlab.heatingCoil_Index, QCoilReq); break; } case HeatingCoilType::Electric: @@ -3542,13 +3296,14 @@ namespace VentilatedSlab { } else { HCoilInAirTemp = state.dataLoopNodes->Node(ventSlab.FanOutletNode).Temp; HCoilOutAirTemp = state.dataLoopNodes->Node(ventSlab.RadInNode).Temp; - CpAirZn = PsyCpAirFnW(state.dataLoopNodes->Node(ventSlab.RadInNode).HumRat); + CpAirZn = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(ventSlab.RadInNode).HumRat); QCoilReq = state.dataLoopNodes->Node(ventSlab.FanOutletNode).MassFlowRate * CpAirZn * (HCoilOutAirTemp - HCoilInAirTemp); } if (QCoilReq < 0.0) QCoilReq = 0.0; // a heating coil can only heat, not cool - SimulateHeatingCoilComponents(state, ventSlab.heatingCoilName, FirstHVACIteration, QCoilReq, ventSlab.heatingCoil_Index); + HeatingCoils::SimulateHeatingCoilComponents( + state, ventSlab.heatingCoilName, FirstHVACIteration, QCoilReq, ventSlab.heatingCoil_Index); break; } default: @@ -3560,8 +3315,8 @@ namespace VentilatedSlab { OutletNode = ventSlab.RadInNode; AirMassFlow = state.dataLoopNodes->Node(OutletNode).MassFlowRate; - LoadMet = AirMassFlow * (PsyHFnTdbW(state.dataLoopNodes->Node(OutletNode).Temp, state.dataLoopNodes->Node(InletNode).HumRat) - - PsyHFnTdbW(state.dataLoopNodes->Node(InletNode).Temp, state.dataLoopNodes->Node(InletNode).HumRat)); + LoadMet = AirMassFlow * (Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(OutletNode).Temp, state.dataLoopNodes->Node(InletNode).HumRat) - + Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(InletNode).Temp, state.dataLoopNodes->Node(InletNode).HumRat)); } void CalcVentilatedSlabCoilOutput(EnergyPlusData &state, @@ -3600,10 +3355,12 @@ namespace VentilatedSlab { AirMassFlow = state.dataLoopNodes->Node(OutletNode).MassFlowRate; // QTotUnitOut = AirMassFlow * ( Node( OutletNode ).Enthalpy - Node( FanOutletNode ).Enthalpy ); - QTotUnitOut = AirMassFlow * (PsyHFnTdbW(state.dataLoopNodes->Node(OutletNode).Temp, state.dataLoopNodes->Node(OutletNode).HumRat) - - PsyHFnTdbW(state.dataLoopNodes->Node(FanOutletNode).Temp, state.dataLoopNodes->Node(FanOutletNode).HumRat)); - QUnitOut = AirMassFlow * (PsyHFnTdbW(state.dataLoopNodes->Node(OutletNode).Temp, state.dataLoopNodes->Node(FanOutletNode).HumRat) - - PsyHFnTdbW(state.dataLoopNodes->Node(FanOutletNode).Temp, state.dataLoopNodes->Node(FanOutletNode).HumRat)); + QTotUnitOut = AirMassFlow * + (Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(OutletNode).Temp, state.dataLoopNodes->Node(OutletNode).HumRat) - + Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(FanOutletNode).Temp, state.dataLoopNodes->Node(FanOutletNode).HumRat)); + QUnitOut = AirMassFlow * + (Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(OutletNode).Temp, state.dataLoopNodes->Node(FanOutletNode).HumRat) - + Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(FanOutletNode).Temp, state.dataLoopNodes->Node(FanOutletNode).HumRat)); // Limit sensible <= total when cooling (which is negative, so use max) QUnitOut = max(QUnitOut, QTotUnitOut); @@ -3632,7 +3389,6 @@ namespace VentilatedSlab { // AUTHOR Young Tae Chae, Rick Strand // DATE WRITTEN June 2008 // MODIFIED Sep 2011 LKL/BG - resimulate only zones needing it for Radiant systems - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine launches the individual component simulations. @@ -3647,10 +3403,6 @@ namespace VentilatedSlab { // simulation. Other than that, the subroutine is very straightforward. // Using/Aliasing - using HeatingCoils::SimulateHeatingCoilComponents; - using NodeInputManager::GetOnlySingleNode; - using SteamCoils::SimulateSteamCoilComponents; - using WaterCoils::SimulateWaterCoilComponents; auto &ventSlab = state.dataVentilatedSlab->VentSlab(Item); // SUBROUTINE PARAMETER DEFINITIONS: @@ -3661,26 +3413,18 @@ namespace VentilatedSlab { static std::string const CurrentModuleObject("ZoneHVAC:VentilatedSlab"); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int ConstrNum; // Index for construction number in Construct derived type Real64 CpAirZn; // Intermediate calculational variable for specific heat of air Real64 DewPointTemp; // Dew-point temperature based on the zone air conditions Real64 EpsMdotCpAirZn; // Epsilon (heat exchanger terminology) times water mass flow rate times water specific heat Real64 Mdot; // Intermediate calculation variable for mass flow rate in a surface within the radiant system int RadSurfNum; // DO loop counter for the surfaces that comprise a particular radiant system - int RadSurfNum2; // DO loop counter for the surfaces that comprise a particular radiant system - int RadSurfNum3; // DO loop counter for the surfaces that comprise a particular radiant system // unused0309 INTEGER :: RadSurfNum4 ! DO loop counter for the surfaces that comprise a particular radiant system - int SurfNum; // Index for radiant surface in Surface derived type - int SurfNum2; // Index for radiant surface in Surface derived type + int SurfNum; // Index for radiant surface in Surface derived type // unused0309 INTEGER :: RadSurfNumNum Real64 TotalVentSlabRadPower; // Total heat source/sink to radiant system - Real64 AirMassFlow; // air mass flow rate in the radiant system, kg/s - int SlabInNode; // Node number of the air entering the radiant system Real64 AirOutletTempCheck; // Radiant system air outlet temperature (calculated from mixing all outlet streams together) Real64 AirTempIn; // Temperature of the air entering the radiant system, in C - int ZoneNum; // number of zone being served - Real64 ZoneMult; // Zone multiplier for this system Real64 Ca; // Coefficients to relate the inlet air temperature to the heat source Real64 Cb; Real64 Cc; @@ -3694,40 +3438,29 @@ namespace VentilatedSlab { Real64 Ck; Real64 Cl; // For more info on Ca through Cl, refer Constant Flow Radiant System - int FanOutletNode; // unit air outlet node - int OAInletNode; // unit air outlet node - int MixoutNode; // unit air outlet node - int ReturnAirNode; // description - int ZoneAirInNode; // supply air node // For Phase 3 Real64 CNumDS; Real64 CLengDS; Real64 CDiaDS; Real64 FlowFrac; Real64 MSlabAirInTemp; - bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine - std::string MSlabIn; - std::string MSlabOut; - std::string SlabName; - int MSlabInletNode; - int MSlabOutletNode; if (state.dataVentilatedSlab->FirstTimeFlag) { state.dataVentilatedSlab->AirTempOut.allocate(state.dataVentilatedSlab->MaxCloNumOfSurfaces); state.dataVentilatedSlab->FirstTimeFlag = false; } - SlabInNode = ventSlab.RadInNode; - FanOutletNode = ventSlab.FanOutletNode; - OAInletNode = ventSlab.OutsideAirNode; - MixoutNode = ventSlab.OAMixerOutNode; - ReturnAirNode = ventSlab.ReturnAirNode; - ZoneAirInNode = ventSlab.ZoneAirInNode; + int SlabInNode = ventSlab.RadInNode; + int FanOutletNode = ventSlab.FanOutletNode; + int OAInletNode = ventSlab.OutsideAirNode; + int MixoutNode = ventSlab.OAMixerOutNode; + int ReturnAirNode = ventSlab.ReturnAirNode; + int ZoneAirInNode = ventSlab.ZoneAirInNode; // Set the conditions on the air side inlet - ZoneNum = ventSlab.ZonePtr; - ZoneMult = double(state.dataHeatBal->Zone(ZoneNum).Multiplier * state.dataHeatBal->Zone(ZoneNum).ListMultiplier); - AirMassFlow = state.dataLoopNodes->Node(ventSlab.RadInNode).MassFlowRate / ZoneMult; + int ZoneNum = ventSlab.ZonePtr; + Real64 ZoneMult = double(state.dataHeatBal->Zone(ZoneNum).Multiplier * state.dataHeatBal->Zone(ZoneNum).ListMultiplier); + Real64 AirMassFlow = state.dataLoopNodes->Node(ventSlab.RadInNode).MassFlowRate / ZoneMult; auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); if (state.dataVentilatedSlab->OperatingMode == HeatingMode) { @@ -3804,7 +3537,7 @@ namespace VentilatedSlab { // linking the inlet air temperature to the heat source/sink to the radiant system. // The coefficients are based on the Constant Flow Radiation System. - ConstrNum = state.dataSurface->Surface(SurfNum).Construction; + int ConstrNum = state.dataSurface->Surface(SurfNum).Construction; auto const &thisConstruct = state.dataConstruction->Construct(ConstrNum); Ca = state.dataHeatBalFanSys->RadSysTiHBConstCoef(SurfNum); @@ -3824,7 +3557,7 @@ namespace VentilatedSlab { Cl = Ch + ((Ci * (Cc + Cb * Cf) + Cj * (Cf + Ce * Cc)) / (1.0 - Ce * Cb)); Mdot = AirMassFlow * ventSlab.SurfaceFlowFrac(RadSurfNum); - CpAirZn = PsyCpAirFnW(state.dataLoopNodes->Node(ventSlab.RadInNode).HumRat); + CpAirZn = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(ventSlab.RadInNode).HumRat); state.dataHeatBalFanSys->QRadSysSource(SurfNum) = ventSlab.CoreNumbers * EpsMdotCpAirZn * (AirTempIn - Ck) / (1.0 + (EpsMdotCpAirZn * Cl / state.dataSurface->Surface(SurfNum).Area)); @@ -3872,8 +3605,8 @@ namespace VentilatedSlab { state.dataLoopNodes->Node(ReturnAirNode).MassFlowRate = 0.0; AirMassFlow = 0.0; - for (RadSurfNum2 = 1; RadSurfNum2 <= ventSlab.NumOfSurfaces; ++RadSurfNum2) { - SurfNum2 = ventSlab.SurfacePtr(RadSurfNum2); + for (int RadSurfNum2 = 1; RadSurfNum2 <= ventSlab.NumOfSurfaces; ++RadSurfNum2) { + int SurfNum2 = ventSlab.SurfacePtr(RadSurfNum2); state.dataHeatBalFanSys->QRadSysSource(SurfNum2) = 0.0; if (state.dataSurface->Surface(SurfNum2).ExtBoundCond > 0 && state.dataSurface->Surface(SurfNum2).ExtBoundCond != SurfNum2) @@ -3903,8 +3636,8 @@ namespace VentilatedSlab { // conditions. if (state.dataVentilatedSlab->OperatingMode == CoolingMode) { - DewPointTemp = PsyTdpFnWPb(state, thisZoneHB.airHumRat, state.dataEnvrn->OutBaroPress); - for (RadSurfNum2 = 1; RadSurfNum2 <= ventSlab.NumOfSurfaces; ++RadSurfNum2) { + DewPointTemp = Psychrometrics::PsyTdpFnWPb(state, thisZoneHB.airHumRat, state.dataEnvrn->OutBaroPress); + for (int RadSurfNum2 = 1; RadSurfNum2 <= ventSlab.NumOfSurfaces; ++RadSurfNum2) { if (state.dataHeatBalSurf->SurfInsideTempHist(1)(ventSlab.SurfacePtr(RadSurfNum2)) < (DewPointTemp + CondDeltaTemp)) { // Condensation warning--must shut off radiant system state.dataLoopNodes->Node(SlabInNode).MassFlowRate = 0.0; @@ -3914,8 +3647,8 @@ namespace VentilatedSlab { state.dataLoopNodes->Node(ReturnAirNode).MassFlowRate = 0.0; state.dataLoopNodes->Node(FanOutletNode).Temp = state.dataLoopNodes->Node(SlabInNode).Temp; AirMassFlow = 0.0; - for (RadSurfNum3 = 1; RadSurfNum3 <= ventSlab.NumOfSurfaces; ++RadSurfNum3) { - SurfNum2 = ventSlab.SurfacePtr(RadSurfNum3); + for (int RadSurfNum3 = 1; RadSurfNum3 <= ventSlab.NumOfSurfaces; ++RadSurfNum3) { + int SurfNum2 = ventSlab.SurfacePtr(RadSurfNum3); state.dataHeatBalFanSys->QRadSysSource(SurfNum2) = 0.0; if (state.dataSurface->Surface(SurfNum2).ExtBoundCond > 0 && state.dataSurface->Surface(SurfNum2).ExtBoundCond != SurfNum2) @@ -3974,7 +3707,7 @@ namespace VentilatedSlab { // Return Air temp Check if (ventSlab.SysConfg == VentilatedSlabConfig::SlabOnly) { if (AirMassFlow > 0.0) { - CpAirZn = PsyCpAirFnW(state.dataLoopNodes->Node(ventSlab.RadInNode).HumRat); + CpAirZn = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(ventSlab.RadInNode).HumRat); state.dataLoopNodes->Node(ReturnAirNode).Temp = state.dataLoopNodes->Node(SlabInNode).Temp - (TotalVentSlabRadPower / (AirMassFlow * CpAirZn)); if ((std::abs(state.dataLoopNodes->Node(ReturnAirNode).Temp - AirOutletTempCheck) > TempCheckLimit) && @@ -4082,7 +3815,7 @@ namespace VentilatedSlab { // linking the inlet air temperature to the heat source/sink to the radiant system. // The coefficients are based on the Constant Flow Radiation System. - ConstrNum = state.dataSurface->Surface(SurfNum).Construction; + int ConstrNum = state.dataSurface->Surface(SurfNum).Construction; Ca = state.dataHeatBalFanSys->RadSysTiHBConstCoef(SurfNum); Cb = state.dataHeatBalFanSys->RadSysTiHBToutCoef(SurfNum); @@ -4101,7 +3834,7 @@ namespace VentilatedSlab { Cl = Ch + ((Ci * (Cc + Cb * Cf) + Cj * (Cf + Ce * Cc)) / (1.0 - Ce * Cb)); Mdot = AirMassFlow * FlowFrac; - CpAirZn = PsyCpAirFnW(state.dataLoopNodes->Node(ventSlab.RadInNode).HumRat); + CpAirZn = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(ventSlab.RadInNode).HumRat); state.dataHeatBalFanSys->QRadSysSource(SurfNum) = CNumDS * EpsMdotCpAirZn * (AirTempIn - Ck) / (1.0 + (EpsMdotCpAirZn * Cl / state.dataSurface->Surface(SurfNum).Area)); @@ -4132,8 +3865,8 @@ namespace VentilatedSlab { state.dataLoopNodes->Node(ReturnAirNode).MassFlowRate = 0.0; AirMassFlow = 0.0; - for (RadSurfNum2 = 1; RadSurfNum2 <= ventSlab.NumOfSurfaces; ++RadSurfNum2) { - SurfNum2 = ventSlab.SurfacePtr(RadSurfNum2); + for (int RadSurfNum2 = 1; RadSurfNum2 <= ventSlab.NumOfSurfaces; ++RadSurfNum2) { + int SurfNum2 = ventSlab.SurfacePtr(RadSurfNum2); state.dataHeatBalFanSys->QRadSysSource(SurfNum2) = 0.0; if (state.dataSurface->Surface(SurfNum2).ExtBoundCond > 0 && state.dataSurface->Surface(SurfNum2).ExtBoundCond != SurfNum2) @@ -4155,10 +3888,11 @@ namespace VentilatedSlab { // conditions. if (state.dataVentilatedSlab->OperatingMode == CoolingMode) { - DewPointTemp = PsyTdpFnWPb(state, - state.dataZoneTempPredictorCorrector->zoneHeatBalance(ventSlab.ZPtr(RadSurfNum)).airHumRat, - state.dataEnvrn->OutBaroPress); - for (RadSurfNum2 = 1; RadSurfNum2 <= ventSlab.NumOfSurfaces; ++RadSurfNum2) { + DewPointTemp = + Psychrometrics::PsyTdpFnWPb(state, + state.dataZoneTempPredictorCorrector->zoneHeatBalance(ventSlab.ZPtr(RadSurfNum)).airHumRat, + state.dataEnvrn->OutBaroPress); + for (int RadSurfNum2 = 1; RadSurfNum2 <= ventSlab.NumOfSurfaces; ++RadSurfNum2) { if (state.dataHeatBalSurf->SurfInsideTempHist(1)(ventSlab.SurfacePtr(RadSurfNum2)) < (DewPointTemp + CondDeltaTemp)) { // Condensation warning--must shut off radiant system state.dataLoopNodes->Node(SlabInNode).MassFlowRate = 0.0; @@ -4168,8 +3902,8 @@ namespace VentilatedSlab { state.dataLoopNodes->Node(ReturnAirNode).MassFlowRate = 0.0; state.dataLoopNodes->Node(FanOutletNode).Temp = state.dataLoopNodes->Node(SlabInNode).Temp; AirMassFlow = 0.0; - for (RadSurfNum3 = 1; RadSurfNum3 <= ventSlab.NumOfSurfaces; ++RadSurfNum3) { - SurfNum2 = ventSlab.SurfacePtr(RadSurfNum3); + for (int RadSurfNum3 = 1; RadSurfNum3 <= ventSlab.NumOfSurfaces; ++RadSurfNum3) { + int SurfNum2 = ventSlab.SurfacePtr(RadSurfNum3); state.dataHeatBalFanSys->QRadSysSource(SurfNum2) = 0.0; if (state.dataSurface->Surface(SurfNum2).ExtBoundCond > 0 && state.dataSurface->Surface(SurfNum2).ExtBoundCond != SurfNum2) @@ -4227,36 +3961,37 @@ namespace VentilatedSlab { // Internal Node Temperature Check MSlabAirInTemp = state.dataLoopNodes->Node(SlabInNode).Temp; + bool ErrorsFound = false; // Set to true if errors in input, fatal at end of routine for (RadSurfNum = 1; RadSurfNum <= ventSlab.NumOfSurfaces; ++RadSurfNum) { - SlabName = ventSlab.SurfaceName(RadSurfNum); - MSlabIn = ventSlab.SlabIn(RadSurfNum); - MSlabOut = ventSlab.SlabOut(RadSurfNum); - ventSlab.MSlabInNode = GetOnlySingleNode(state, - MSlabIn, - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, - SlabName, - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Internal, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); - ventSlab.MSlabOutNode = GetOnlySingleNode(state, - MSlabOut, - ErrorsFound, - DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, - SlabName, - DataLoopNode::NodeFluidType::Air, - DataLoopNode::ConnectionType::Internal, - NodeInputManager::CompFluidStream::Primary, - ObjectIsNotParent); - MSlabInletNode = ventSlab.MSlabInNode; - MSlabOutletNode = ventSlab.MSlabOutNode; + std::string SlabName = ventSlab.SurfaceName(RadSurfNum); + std::string MSlabIn = ventSlab.SlabIn(RadSurfNum); + std::string MSlabOut = ventSlab.SlabOut(RadSurfNum); + ventSlab.MSlabInNode = NodeInputManager::GetOnlySingleNode(state, + MSlabIn, + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, + SlabName, + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Internal, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsNotParent); + ventSlab.MSlabOutNode = NodeInputManager::GetOnlySingleNode(state, + MSlabOut, + ErrorsFound, + DataLoopNode::ConnectionObjectType::ZoneHVACVentilatedSlab, + SlabName, + DataLoopNode::NodeFluidType::Air, + DataLoopNode::ConnectionType::Internal, + NodeInputManager::CompFluidStream::Primary, + DataLoopNode::ObjectIsNotParent); + int MSlabInletNode = ventSlab.MSlabInNode; + int MSlabOutletNode = ventSlab.MSlabOutNode; SurfNum = ventSlab.SurfacePtr(RadSurfNum); if (AirMassFlow > 0.0) { - CpAirZn = PsyCpAirFnW(state.dataLoopNodes->Node(ventSlab.RadInNode).HumRat); + CpAirZn = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(ventSlab.RadInNode).HumRat); state.dataLoopNodes->Node(MSlabInletNode).Temp = MSlabAirInTemp; state.dataLoopNodes->Node(MSlabOutletNode).Temp = state.dataLoopNodes->Node(MSlabInletNode).Temp - @@ -4271,7 +4006,7 @@ namespace VentilatedSlab { // Return Air temp Check if (AirMassFlow > 0.0) { - CpAirZn = PsyCpAirFnW(state.dataLoopNodes->Node(ventSlab.RadInNode).HumRat); + CpAirZn = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(ventSlab.RadInNode).HumRat); state.dataLoopNodes->Node(ReturnAirNode).Temp = state.dataLoopNodes->Node(SlabInNode).Temp - (TotalVentSlabRadPower / (AirMassFlow * CpAirZn)); @@ -4326,8 +4061,6 @@ namespace VentilatedSlab { // SUBROUTINE INFORMATION: // AUTHOR Rick Strand // DATE WRITTEN May 2000 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This responsibility of this subroutine is to set the air flow rates @@ -4347,19 +4080,15 @@ namespace VentilatedSlab { // outdoor air streams. // Using/Aliasing - auto &ventSlab = state.dataVentilatedSlab->VentSlab(Item); + auto const &ventSlab = state.dataVentilatedSlab->VentSlab(Item); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int AirRelNode; // relief air node number in ventilated slab loop - int InletNode; // inlet node number for ventilated slab loop - Real64 OAFraction; // Outside air fraction of inlet air - int OAMixOutNode; // outside air mixer outlet node for ventilated slab loop - int OutsideAirNode; // outside air node number in ventilated slab loop + Real64 OAFraction; // Outside air fraction of inlet air - AirRelNode = ventSlab.AirReliefNode; - InletNode = ventSlab.ReturnAirNode; - OAMixOutNode = ventSlab.OAMixerOutNode; - OutsideAirNode = ventSlab.OutsideAirNode; + int AirRelNode = ventSlab.AirReliefNode; // relief air node number in ventilated slab loop + int InletNode = ventSlab.ReturnAirNode; // inlet node number for ventilated slab loop + int OAMixOutNode = ventSlab.OAMixerOutNode; // outside air mixer outlet node for ventilated slab loop + int OutsideAirNode = ventSlab.OutsideAirNode; // outside air node number in ventilated slab loop // "Resolve" the air flow rates... @@ -4391,7 +4120,7 @@ namespace VentilatedSlab { } state.dataLoopNodes->Node(InletNode).Enthalpy = - PsyHFnTdbW(state.dataLoopNodes->Node(InletNode).Temp, state.dataLoopNodes->Node(InletNode).HumRat); + Psychrometrics::PsyHFnTdbW(state.dataLoopNodes->Node(InletNode).Temp, state.dataLoopNodes->Node(InletNode).HumRat); // Perform an energy and moisture mass balance on the mixing portion of the OA Mixer of the ventilated slab state.dataLoopNodes->Node(OAMixOutNode).Enthalpy = @@ -4401,7 +4130,7 @@ namespace VentilatedSlab { // Find the other key state points based on calculated conditions state.dataLoopNodes->Node(OAMixOutNode).Temp = - PsyTdbFnHW(state.dataLoopNodes->Node(OAMixOutNode).Enthalpy, state.dataLoopNodes->Node(OAMixOutNode).HumRat); + Psychrometrics::PsyTdbFnHW(state.dataLoopNodes->Node(OAMixOutNode).Enthalpy, state.dataLoopNodes->Node(OAMixOutNode).HumRat); state.dataLoopNodes->Node(OAMixOutNode).Press = state.dataLoopNodes->Node(InletNode).Press; } @@ -4414,8 +4143,6 @@ namespace VentilatedSlab { // SUBROUTINE INFORMATION: // AUTHOR Young Tae Chae, Rick Strand // DATE WRITTEN November 2000 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine does any updating that needs to be done for low @@ -4439,36 +4166,21 @@ namespace VentilatedSlab { auto &ventSlab = state.dataVentilatedSlab->VentSlab(Item); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 CpAppAir; // Specific heat of air - int RadSurfNum; // DO loop counter for radiant surfaces in the ventilated slab - int SurfNum; // Surface index number for the current ventilated slab - int AirInletNode; // Node number for the air side inlet of the ventilated slab - Real64 TotalHeatSource; // Total heat source or sink for a particular system (sum of all surface source/sinks) - int TotRadSurfaces; // Total number of radiant surfaces in this system - Real64 AirMassFlow; // Flow rate of water in the radiant system - int AirOutletNode; // Node number for the water side outlet of the radiant system - int FanOutNode; // Node number for the water side outlet of the radiant system - Real64 ZoneMult; // Zone multiplier - int ZoneNum; // Zone for this ventilated slab - int MixOutNode; // Node number for the water side outlet of the radiant system - int OANode; // Node number for the water side outlet of the radiant system - Real64 OAFraction; // Outside air fraction of inlet air - int ZoneInletNode; // Node number for the air side inlet of the ventilated slab - - ZoneNum = ventSlab.ZonePtr; - TotRadSurfaces = ventSlab.NumOfSurfaces; - MixOutNode = ventSlab.OAMixerOutNode; - OANode = ventSlab.OutsideAirNode; - AirOutletNode = ventSlab.RadInNode; - FanOutNode = ventSlab.FanOutletNode; - AirMassFlow = state.dataLoopNodes->Node(AirOutletNode).MassFlowRate; - ZoneInletNode = ventSlab.ZoneAirInNode; - CpAppAir = PsyCpAirFnW(state.dataLoopNodes->Node(AirOutletNode).HumRat); - AirInletNode = ventSlab.ReturnAirNode; - - for (RadSurfNum = 1; RadSurfNum <= TotRadSurfaces; ++RadSurfNum) { - - SurfNum = ventSlab.SurfacePtr(RadSurfNum); + Real64 OAFraction; // Outside air fraction of inlet air + + int TotRadSurfaces = ventSlab.NumOfSurfaces; + int MixOutNode = ventSlab.OAMixerOutNode; // Node number for the water side outlet of the radiant system + int OANode = ventSlab.OutsideAirNode; + int AirOutletNode = ventSlab.RadInNode; + int FanOutNode = ventSlab.FanOutletNode; + Real64 AirMassFlow = state.dataLoopNodes->Node(AirOutletNode).MassFlowRate; + int ZoneInletNode = ventSlab.ZoneAirInNode; // Node number for the air side inlet of the ventilated slab + Real64 CpAppAir = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(AirOutletNode).HumRat); + int AirInletNode = ventSlab.ReturnAirNode; // Node number for the air side inlet of the ventilated slab + + for (int RadSurfNum = 1; RadSurfNum <= TotRadSurfaces; ++RadSurfNum) { + + int SurfNum = ventSlab.SurfacePtr(RadSurfNum); if (ventSlab.LastSysTimeElapsed == SysTimeElapsed) { // Still iterating or reducing system time step, so subtract old values which were not valid @@ -4483,13 +4195,13 @@ namespace VentilatedSlab { ventSlab.LastTimeStepSys = TimeStepSys; // First sum up all of the heat sources/sinks associated with this system - TotalHeatSource = 0.0; - for (RadSurfNum = 1; RadSurfNum <= ventSlab.NumOfSurfaces; ++RadSurfNum) { - SurfNum = ventSlab.SurfacePtr(RadSurfNum); + Real64 TotalHeatSource = 0.0; + for (int RadSurfNum = 1; RadSurfNum <= ventSlab.NumOfSurfaces; ++RadSurfNum) { + int SurfNum = ventSlab.SurfacePtr(RadSurfNum); TotalHeatSource += state.dataHeatBalFanSys->QRadSysSource(SurfNum); } - ZoneNum = ventSlab.ZonePtr; - ZoneMult = double(state.dataHeatBal->Zone(ZoneNum).Multiplier * state.dataHeatBal->Zone(ZoneNum).ListMultiplier); + int ZoneNum = ventSlab.ZonePtr; + int ZoneMult = double(state.dataHeatBal->Zone(ZoneNum).Multiplier * state.dataHeatBal->Zone(ZoneNum).ListMultiplier); TotalHeatSource *= ZoneMult; // Update the heating side of things @@ -4513,14 +4225,12 @@ namespace VentilatedSlab { } } else { - if ((ventSlab.SysConfg == VentilatedSlabConfig::SlabOnly) || (ventSlab.SysConfg == VentilatedSlabConfig::SeriesSlabs)) { - state.dataLoopNodes->Node(FanOutNode) = state.dataLoopNodes->Node(AirOutletNode); - state.dataHeatBalFanSys->QRadSysSource(SurfNum) = 0.0; - - } else if (ventSlab.SysConfg == VentilatedSlabConfig::SlabAndZone) { + state.dataLoopNodes->Node(FanOutNode) = state.dataLoopNodes->Node(AirOutletNode); + if (ventSlab.SysConfg == VentilatedSlabConfig::SlabAndZone) { state.dataLoopNodes->Node(ZoneInletNode) = state.dataLoopNodes->Node(AirInletNode); - state.dataLoopNodes->Node(FanOutNode) = state.dataLoopNodes->Node(AirOutletNode); // Fan Resolve - state.dataHeatBalFanSys->QRadSysSource(SurfNum) = 0.0; + } + for (int const surfNum : ventSlab.SurfacePtr) { + state.dataHeatBalFanSys->QRadSysSource(surfNum) = 0.0; } } @@ -4547,7 +4257,7 @@ namespace VentilatedSlab { OAFraction * state.dataLoopNodes->Node(OANode).HumRat + (1.0 - OAFraction) * state.dataLoopNodes->Node(AirInletNode).HumRat; state.dataLoopNodes->Node(MixOutNode).Temp = - PsyTdbFnHW(state.dataLoopNodes->Node(MixOutNode).Enthalpy, state.dataLoopNodes->Node(MixOutNode).HumRat); + Psychrometrics::PsyTdbFnHW(state.dataLoopNodes->Node(MixOutNode).Enthalpy, state.dataLoopNodes->Node(MixOutNode).HumRat); } } @@ -4565,7 +4275,6 @@ namespace VentilatedSlab { // AUTHOR Rick Strand // DATE WRITTEN December 2000 // MODIFIED June 2008 (air properties) - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine calculates the radiant system "heat exchanger" @@ -4654,7 +4363,7 @@ namespace VentilatedSlab { PRactual = Pr[Index - 1] + InterpFrac * (Pr[Index] - Pr[Index - 1]); } // arguments are glycol name, temperature, and concentration - CpAppAir = PsyCpAirFnW(state.dataLoopNodes->Node(ventSlab.RadInNode).HumRat); + CpAppAir = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(ventSlab.RadInNode).HumRat); SysAirMassFlow = AirMassFlow / CoreNumbers; // Calculate the Reynold's number from RE=(4*Mdot)/(Pi*Mu*Diameter) @@ -4692,33 +4401,22 @@ namespace VentilatedSlab { // SUBROUTINE INFORMATION: // AUTHOR Rick Strand // DATE WRITTEN November 2000 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine simply produces output for the low temperature radiant system. - // METHODOLOGY EMPLOYED: - // Standard EnergyPlus methodology. - // Using/Aliasing Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; auto &ventSlab = state.dataVentilatedSlab->VentSlab(Item); - int RadSurfNum; // DO loop counter for radiant surfaces in the system - int SurfNum; // Surface number (index) in Surface derived type - Real64 TotalVentSlabRadPower; // Total source/sink power for the radiant system (sum of all surfaces of the system) - Real64 ZoneMult; // Total zone multiplier to apply to the system level variables - // Slab Part - TotalVentSlabRadPower = 0.0; - ZoneMult = 1.0; + Real64 TotalVentSlabRadPower = 0.0; // Total source/sink power for the radiant system (sum of all surfaces of the system) - for (RadSurfNum = 1; RadSurfNum <= ventSlab.NumOfSurfaces; ++RadSurfNum) { - SurfNum = ventSlab.SurfacePtr(RadSurfNum); + for (int RadSurfNum = 1; RadSurfNum <= ventSlab.NumOfSurfaces; ++RadSurfNum) { + int SurfNum = ventSlab.SurfacePtr(RadSurfNum); TotalVentSlabRadPower += state.dataHeatBalFanSys->QRadSysSource(SurfNum); } - ZoneMult = double(state.dataHeatBal->Zone(ventSlab.ZonePtr).Multiplier * state.dataHeatBal->Zone(ventSlab.ZonePtr).ListMultiplier); + Real64 ZoneMult = double(state.dataHeatBal->Zone(ventSlab.ZonePtr).Multiplier * state.dataHeatBal->Zone(ventSlab.ZonePtr).ListMultiplier); TotalVentSlabRadPower *= ZoneMult; ventSlab.RadHeatingPower = 0.0; ventSlab.RadCoolingPower = 0.0; diff --git a/src/EnergyPlus/VentilatedSlab.hh b/src/EnergyPlus/VentilatedSlab.hh index 7d2437567aa..4831093db94 100644 --- a/src/EnergyPlus/VentilatedSlab.hh +++ b/src/EnergyPlus/VentilatedSlab.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -55,6 +55,7 @@ #include #include #include +#include #include #include @@ -132,9 +133,9 @@ namespace VentilatedSlab { { // Members // Input data - std::string Name; // name of system - int SchedPtr; // index to schedule - int ZonePtr; // Point to this zone in the Zone derived type + std::string Name; // name of system + Sched::Schedule *availSched = nullptr; // schedule + int ZonePtr; // Point to this zone in the Zone derived type // Variables for Delivery Config. Array1D_string ZName; // Name of zone the system is serving Array1D_int ZPtr; // Point to this zone in the Zone derived type @@ -169,10 +170,10 @@ namespace VentilatedSlab { Real64 MaxAirVolFlow; // m3/s Real64 MaxAirMassFlow; // kg/s OutsideAirControlType outsideAirControlType; // type of control; options are VARIABLE PERCENT and FIXED TEMPERATURE - int MinOASchedPtr; // index to schedule - int MaxOASchedPtr; // index to schedule + Sched::Schedule *minOASched = nullptr; + Sched::Schedule *maxOASched = nullptr; // temperature (fixed temp.) - int TempSchedPtr; // index to schedule + Sched::Schedule *tempSched = nullptr; int OutsideAirNode; // outside air node number int AirReliefNode; // relief air node number int OAMixerOutNode; // outlet node after the outside air mixer (inlet to coils if present) @@ -188,28 +189,30 @@ namespace VentilatedSlab { std::string heatingCoilTypeCh; // type of heating coil (character string) int heatingCoil_Index; DataPlant::PlantEquipmentType heatingCoilType; - int heatingCoil_FluidIndex; - int heatingCoilSchedPtr; // index to schedule + + Fluid::RefrigProps *heatingCoil_fluid = nullptr; + Sched::Schedule *heatingCoilSched = nullptr; // index to schedule + Real64 heatingCoilSchedValue; Real64 MaxVolHotWaterFlow; // m3/s Real64 MaxVolHotSteamFlow; // m3/s Real64 MaxHotWaterFlow; // kg/s Real64 MaxHotSteamFlow; Real64 MinHotSteamFlow; - Real64 MinVolHotWaterFlow; // m3/s - Real64 MinVolHotSteamFlow; // m3/s - Real64 MinHotWaterFlow; // kg/s - int HotControlNode; // hot water control node - int HotCoilOutNodeNum; // outlet of coil - Real64 HotControlOffset; // control tolerance - PlantLocation HWPlantLoc; // index for plant component for hot water coil - int HotAirHiTempSchedPtr; // Schedule index for the highest Air temperature - int HotAirLoTempSchedPtr; // Schedule index for the lowest Air temperature + Real64 MinVolHotWaterFlow; // m3/s + Real64 MinVolHotSteamFlow; // m3/s + Real64 MinHotWaterFlow; // kg/s + int HotControlNode; // hot water control node + int HotCoilOutNodeNum; // outlet of coil + Real64 HotControlOffset; // control tolerance + PlantLocation HWPlantLoc; // index for plant component for hot water coil + Sched::Schedule *hotAirHiTempSched = nullptr; // Schedule for the highest Air temperature + Sched::Schedule *hotAirLoTempSched = nullptr; // Schedule for the lowest Air temperature // (where the lowest Air temperature is requested) - int HotCtrlHiTempSchedPtr; // Schedule index for the highest control temperature + Sched::Schedule *hotCtrlHiTempSched = nullptr; // Schedule for the highest control temperature // (where the lowest Air temperature is requested) // (where the highest Air temperature is requested) - int HotCtrlLoTempSchedPtr; // Schedule index for the lowest control temperature + Sched::Schedule *hotCtrlLoTempSched = nullptr; // Schedule for the lowest control temperature // (where the highest Air temperature is requested) bool coolingCoilPresent; // .TRUE. if ventilated slab has a cooling coil std::string coolingCoilName; // name of cooling coil @@ -221,23 +224,23 @@ namespace VentilatedSlab { CoolingCoilType cCoilType; // type of cooling coil: // 'Coil:Cooling:Water:DetailedGeometry' or // 'CoilSystem:Cooling:Water:HeatExchangerAssisted' - int coolingCoilSchedPtr; // index to schedule + Sched::Schedule *coolingCoilSched = nullptr; Real64 coolingCoilSchedValue; - Real64 MaxVolColdWaterFlow; // m3/s - Real64 MaxColdWaterFlow; // kg/s - Real64 MinVolColdWaterFlow; // m3/s - Real64 MinColdWaterFlow; // kg/s - int ColdControlNode; // chilled water control node - int ColdCoilOutNodeNum; // chilled water coil out nod - Real64 ColdControlOffset; // control tolerance - PlantLocation CWPlantLoc; // index for plant component for chilled water coil - int ColdAirHiTempSchedPtr; // Schedule index for the highest Air temperature - int ColdAirLoTempSchedPtr; // Schedule index for the lowest Air temperature + Real64 MaxVolColdWaterFlow; // m3/s + Real64 MaxColdWaterFlow; // kg/s + Real64 MinVolColdWaterFlow; // m3/s + Real64 MinColdWaterFlow; // kg/s + int ColdControlNode; // chilled water control node + int ColdCoilOutNodeNum; // chilled water coil out nod + Real64 ColdControlOffset; // control tolerance + PlantLocation CWPlantLoc; // index for plant component for chilled water coil + Sched::Schedule *coldAirHiTempSched = nullptr; // Schedule for the highest Air temperature + Sched::Schedule *coldAirLoTempSched = nullptr; // Schedule for the lowest Air temperature // (where the lowest Air temperature is requested) - int ColdCtrlHiTempSchedPtr; // Schedule index for the highest control temperature + Sched::Schedule *coldCtrlHiTempSched = nullptr; // Schedule for the highest control temperature // (where the lowest Air temperature is requested) // (where the highest Air temperature is requested) - int ColdCtrlLoTempSchedPtr; // Schedule index for the lowest control temperature + Sched::Schedule *coldCtrlLoTempSched = nullptr; // Schedule for the lowest control temperature // (where the highest Air temperature is requested) int CondErrIndex; // Error index for recurring warning messages int EnrgyImbalErrIndex; // Error index for recurring warning messages @@ -284,27 +287,26 @@ namespace VentilatedSlab { // Default Constructor VentilatedSlabData() - : SchedPtr(0), ZonePtr(0), NumOfSurfaces(0), TotalSurfaceArea(0.0), CoreDiameter(0.0), CoreLength(0.0), CoreNumbers(0.0), + : ZonePtr(0), NumOfSurfaces(0), TotalSurfaceArea(0.0), CoreDiameter(0.0), CoreLength(0.0), CoreNumbers(0.0), controlType(ControlType::Invalid), ReturnAirNode(0), RadInNode(0), ZoneAirInNode(0), FanOutletNode(0), MSlabInNode(0), MSlabOutNode(0), Fan_Index(0), fanType(HVAC::FanType::Invalid), ControlCompTypeNum(0), CompErrIndex(0), MaxAirVolFlow(0.0), MaxAirMassFlow(0.0), - outsideAirControlType(OutsideAirControlType::Invalid), MinOASchedPtr(0), MaxOASchedPtr(0), TempSchedPtr(0), OutsideAirNode(0), - AirReliefNode(0), OAMixerOutNode(0), OutAirVolFlow(0.0), OutAirMassFlow(0.0), MinOutAirVolFlow(0.0), MinOutAirMassFlow(0.0), - SysConfg(VentilatedSlabConfig::Invalid), coilOption(CoilType::Invalid), heatingCoilPresent(false), hCoilType(HeatingCoilType::Invalid), - heatingCoil_Index(0), heatingCoilType(DataPlant::PlantEquipmentType::Invalid), heatingCoil_FluidIndex(0), heatingCoilSchedPtr(0), - heatingCoilSchedValue(0.0), MaxVolHotWaterFlow(0.0), MaxVolHotSteamFlow(0.0), MaxHotWaterFlow(0.0), MaxHotSteamFlow(0.0), - MinHotSteamFlow(0.0), MinVolHotWaterFlow(0.0), MinVolHotSteamFlow(0.0), MinHotWaterFlow(0.0), HotControlNode(0), HotCoilOutNodeNum(0), - HotControlOffset(0.0), HWPlantLoc{}, HotAirHiTempSchedPtr(0), HotAirLoTempSchedPtr(0), HotCtrlHiTempSchedPtr(0), - HotCtrlLoTempSchedPtr(0), coolingCoilPresent(false), coolingCoil_Index(0), coolingCoilType(DataPlant::PlantEquipmentType::Invalid), - cCoilType(CoolingCoilType::Invalid), coolingCoilSchedPtr(0), coolingCoilSchedValue(0.0), MaxVolColdWaterFlow(0.0), - MaxColdWaterFlow(0.0), MinVolColdWaterFlow(0.0), MinColdWaterFlow(0.0), ColdControlNode(0), ColdCoilOutNodeNum(0), - ColdControlOffset(0.0), CWPlantLoc{}, ColdAirHiTempSchedPtr(0), ColdAirLoTempSchedPtr(0), ColdCtrlHiTempSchedPtr(0), - ColdCtrlLoTempSchedPtr(0), CondErrIndex(0), EnrgyImbalErrIndex(0), RadSurfNum(0), MSlabIn(0), MSlabOut(0), DirectHeatLossPower(0.0), - DirectHeatLossEnergy(0.0), DirectHeatGainPower(0.0), DirectHeatGainEnergy(0.0), TotalVentSlabRadPower(0.0), RadHeatingPower(0.0), - RadHeatingEnergy(0.0), RadCoolingPower(0.0), RadCoolingEnergy(0.0), HeatCoilPower(0.0), HeatCoilEnergy(0.0), TotCoolCoilPower(0.0), - TotCoolCoilEnergy(0.0), SensCoolCoilPower(0.0), SensCoolCoilEnergy(0.0), LateCoolCoilPower(0.0), LateCoolCoilEnergy(0.0), - ElecFanPower(0.0), ElecFanEnergy(0.0), AirMassFlowRate(0.0), AirVolFlow(0.0), SlabInTemp(0.0), SlabOutTemp(0.0), ReturnAirTemp(0.0), - FanOutletTemp(0.0), ZoneInletTemp(0.0), HVACSizingIndex(0), FirstPass(true), ZeroVentSlabSourceSumHATsurf(0.0), QRadSysSrcAvg(0.0), - LastQRadSysSrc(0.0), LastSysTimeElapsed(0.0), LastTimeStepSys(0.0) + outsideAirControlType(OutsideAirControlType::Invalid), OutsideAirNode(0), AirReliefNode(0), OAMixerOutNode(0), OutAirVolFlow(0.0), + OutAirMassFlow(0.0), MinOutAirVolFlow(0.0), MinOutAirMassFlow(0.0), SysConfg(VentilatedSlabConfig::Invalid), + coilOption(CoilType::Invalid), heatingCoilPresent(false), hCoilType(HeatingCoilType::Invalid), + + heatingCoil_Index(0), heatingCoilType(DataPlant::PlantEquipmentType::Invalid), heatingCoilSchedValue(0.0), MaxVolHotWaterFlow(0.0), + MaxVolHotSteamFlow(0.0), MaxHotWaterFlow(0.0), MaxHotSteamFlow(0.0), MinHotSteamFlow(0.0), MinVolHotWaterFlow(0.0), + MinVolHotSteamFlow(0.0), MinHotWaterFlow(0.0), HotControlNode(0), HotCoilOutNodeNum(0), HotControlOffset(0.0), HWPlantLoc{}, + coolingCoilPresent(false), coolingCoil_Index(0), coolingCoilType(DataPlant::PlantEquipmentType::Invalid), + cCoilType(CoolingCoilType::Invalid), coolingCoilSchedValue(0.0), MaxVolColdWaterFlow(0.0), MaxColdWaterFlow(0.0), + MinVolColdWaterFlow(0.0), MinColdWaterFlow(0.0), ColdControlNode(0), ColdCoilOutNodeNum(0), ColdControlOffset(0.0), CWPlantLoc{}, + CondErrIndex(0), EnrgyImbalErrIndex(0), RadSurfNum(0), MSlabIn(0), MSlabOut(0), DirectHeatLossPower(0.0), DirectHeatLossEnergy(0.0), + DirectHeatGainPower(0.0), DirectHeatGainEnergy(0.0), TotalVentSlabRadPower(0.0), RadHeatingPower(0.0), RadHeatingEnergy(0.0), + RadCoolingPower(0.0), RadCoolingEnergy(0.0), HeatCoilPower(0.0), HeatCoilEnergy(0.0), TotCoolCoilPower(0.0), TotCoolCoilEnergy(0.0), + SensCoolCoilPower(0.0), SensCoolCoilEnergy(0.0), LateCoolCoilPower(0.0), LateCoolCoilEnergy(0.0), ElecFanPower(0.0), ElecFanEnergy(0.0), + AirMassFlowRate(0.0), AirVolFlow(0.0), SlabInTemp(0.0), SlabOutTemp(0.0), ReturnAirTemp(0.0), FanOutletTemp(0.0), ZoneInletTemp(0.0), + HVACSizingIndex(0), FirstPass(true), ZeroVentSlabSourceSumHATsurf(0.0), QRadSysSrcAvg(0.0), LastQRadSysSrc(0.0), + LastSysTimeElapsed(0.0), LastTimeStepSys(0.0) { } }; @@ -422,6 +424,10 @@ struct VentilatedSlabData : BaseGlobalStruct int EnergyImbalanceErrorCount = 0; // Counts for # times a temperature mismatch is found in the energy balance check bool FirstTimeFlag = true; // for setting size of AirTempOut array + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/WaterCoils.cc b/src/EnergyPlus/WaterCoils.cc index 959fb06816f..ff3cd4e8a9d 100644 --- a/src/EnergyPlus/WaterCoils.cc +++ b/src/EnergyPlus/WaterCoils.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -50,7 +50,6 @@ // ObjexxFCL Headers #include -#include // EnergyPlus Headers #include @@ -121,8 +120,6 @@ namespace EnergyPlus::WaterCoils { using namespace DataLoopNode; -using FluidProperties::GetDensityGlycol; -using FluidProperties::GetSpecificHeatGlycol; using Psychrometrics::PsyCpAirFnW; using Psychrometrics::PsyHFnTdbRhPb; using Psychrometrics::PsyHFnTdbW; @@ -134,7 +131,6 @@ using Psychrometrics::PsyWFnTdbH; using Psychrometrics::PsyWFnTdbRhPb; using Psychrometrics::PsyWFnTdbTwbPb; using Psychrometrics::PsyWFnTdpPb; -using namespace ScheduleManager; void SimulateWaterCoilComponents(EnergyPlusData &state, std::string_view CompName, @@ -250,6 +246,7 @@ void GetWaterCoilInput(EnergyPlusData &state) // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetWaterCoilInput: "); // include trailing blank space + static constexpr std::string_view routineName = "GetWaterCoilInput"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int CoilNum; // The WaterCoil that you are currently loading input into @@ -323,6 +320,8 @@ void GetWaterCoilInput(EnergyPlusData &state) cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, AlphArray(1)}; + state.dataWaterCoils->WaterCoilNumericFields(CoilNum).FieldNames.allocate(MaxNums); state.dataWaterCoils->WaterCoilNumericFields(CoilNum).FieldNames = ""; state.dataWaterCoils->WaterCoilNumericFields(CoilNum).FieldNames = cNumericFields; @@ -331,19 +330,13 @@ void GetWaterCoilInput(EnergyPlusData &state) // ErrorsFound will be set to True if problem was found, left untouched otherwise GlobalNames::VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); auto &waterCoil = state.dataWaterCoils->WaterCoil(CoilNum); + waterCoil.Name = AlphArray(1); - waterCoil.Schedule = AlphArray(2); if (lAlphaBlanks(2)) { - waterCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - waterCoil.SchedPtr = GetScheduleIndex(state, AlphArray(2)); - if (waterCoil.SchedPtr == 0) { - ShowSevereError( - state, - format( - "{}: invalid {} entered ={} for {}={}", CurrentModuleObject, cAlphaFields(2), AlphArray(2), cAlphaFields(1), AlphArray(1))); - ErrorsFound = true; - } + waterCoil.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((waterCoil.availSched = Sched::GetSchedule(state, AlphArray(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), AlphArray(2)); + ErrorsFound = true; } waterCoil.WaterCoilModelA = "SIMPLE"; @@ -493,6 +486,8 @@ void GetWaterCoilInput(EnergyPlusData &state) cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, AlphArray(1)}; + state.dataWaterCoils->WaterCoilNumericFields(CoilNum).FieldNames.allocate(MaxNums); state.dataWaterCoils->WaterCoilNumericFields(CoilNum).FieldNames = ""; state.dataWaterCoils->WaterCoilNumericFields(CoilNum).FieldNames = cNumericFields; @@ -503,18 +498,12 @@ void GetWaterCoilInput(EnergyPlusData &state) auto &waterCoil = state.dataWaterCoils->WaterCoil(CoilNum); waterCoil.Name = AlphArray(1); - waterCoil.Schedule = AlphArray(2); + if (lAlphaBlanks(2)) { - waterCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - waterCoil.SchedPtr = GetScheduleIndex(state, AlphArray(2)); - if (waterCoil.SchedPtr == 0) { - ShowSevereError( - state, - format( - "{}: invalid {} entered ={} for {}={}", CurrentModuleObject, cAlphaFields(2), AlphArray(2), cAlphaFields(1), AlphArray(1))); - ErrorsFound = true; - } + waterCoil.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((waterCoil.availSched = Sched::GetSchedule(state, AlphArray(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), AlphArray(2)); + ErrorsFound = true; } waterCoil.WaterCoilModelA = "DETAILED FLAT FIN"; @@ -706,6 +695,7 @@ void GetWaterCoilInput(EnergyPlusData &state) cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, AlphArray(1)}; state.dataWaterCoils->WaterCoilNumericFields(CoilNum).FieldNames.allocate(MaxNums); state.dataWaterCoils->WaterCoilNumericFields(CoilNum).FieldNames = ""; state.dataWaterCoils->WaterCoilNumericFields(CoilNum).FieldNames = cNumericFields; @@ -716,18 +706,12 @@ void GetWaterCoilInput(EnergyPlusData &state) auto &waterCoil = state.dataWaterCoils->WaterCoil(CoilNum); waterCoil.Name = AlphArray(1); - waterCoil.Schedule = AlphArray(2); + if (lAlphaBlanks(2)) { - waterCoil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - waterCoil.SchedPtr = GetScheduleIndex(state, AlphArray(2)); - if (waterCoil.SchedPtr == 0) { - ShowSevereError( - state, - format( - "{}: invalid {} entered ={} for {}={}", CurrentModuleObject, cAlphaFields(2), AlphArray(2), cAlphaFields(1), AlphArray(1))); - ErrorsFound = true; - } + waterCoil.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((waterCoil.availSched = Sched::GetSchedule(state, AlphArray(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), AlphArray(2)); + ErrorsFound = true; } waterCoil.WaterCoilModelA = "Cooling"; @@ -1062,11 +1046,7 @@ void InitWaterCoil(EnergyPlusData &state, int const CoilNum, bool const FirstHVA // Do the Begin Environment initializations if (state.dataGlobal->BeginEnvrnFlag && state.dataWaterCoils->MyEnvrnFlag(CoilNum)) { - rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); // Initialize all report variables to a known state at beginning of simulation waterCoil.TotWaterHeatingCoilEnergy = 0.0; waterCoil.TotWaterCoolingCoilEnergy = 0.0; @@ -1088,11 +1068,7 @@ void InitWaterCoil(EnergyPlusData &state, int const CoilNum, bool const FirstHVA auto &waterInletNode = state.dataLoopNodes->Node(WaterInletNode); waterInletNode.Temp = 5.0; - Cp = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).FluidName, - waterInletNode.Temp, - state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).glycol->getSpecificHeat(state, waterInletNode.Temp, RoutineName); waterInletNode.Enthalpy = Cp * waterInletNode.Temp; waterInletNode.Quality = 0.0; @@ -1104,11 +1080,7 @@ void InitWaterCoil(EnergyPlusData &state, int const CoilNum, bool const FirstHVA auto &waterInletNode = state.dataLoopNodes->Node(WaterInletNode); waterInletNode.Temp = 60.0; - Cp = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).FluidName, - waterInletNode.Temp, - state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).glycol->getSpecificHeat(state, waterInletNode.Temp, RoutineName); waterInletNode.Enthalpy = Cp * waterInletNode.Temp; waterInletNode.Quality = 0.0; @@ -1186,7 +1158,7 @@ void InitWaterCoil(EnergyPlusData &state, int const CoilNum, bool const FirstHVA // the cooling coil. // Basic Idea for UA: Heat Transfer= UAenthalpybased*(Delta enthalpy), this is a necessity since the // coil may be Wet or Dry or Partially Wet-Dry, so latent effects are accounted for in this model while - // calculating the UA. A fictitious specific heat is also defined to caculate the conventional UA. + // calculating the UA. A fictitious specific heat is also defined to calculate the conventional UA. // On the air side, enthalpy capacity rate is the air mass flow rate,while on water side it is // enthalpy of saturated air at water temperature. //@@@ DESIGN CONDITION BEGIN HERE @@@ @@ -1295,12 +1267,9 @@ void InitWaterCoil(EnergyPlusData &state, int const CoilNum, bool const FirstHVA // Total Coil Load from Inlet and Outlet Air States (which include fan heat as appropriate). waterCoil.DesTotWaterCoilLoad = waterCoil.DesAirMassFlowRate * (DesInletAirEnth - DesOutletAirEnth); - // Enthalpy of Water at Intlet design conditions - Cp = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).FluidName, - waterCoil.DesInletWaterTemp, - state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).FluidIndex, - RoutineName); + // Enthalpy of Water at Inlet design conditions + Cp = state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum) + .glycol->getSpecificHeat(state, waterCoil.DesInletWaterTemp, RoutineName); DesOutletWaterTemp = waterCoil.DesInletWaterTemp + waterCoil.DesTotWaterCoilLoad / (waterCoil.MaxWaterMassFlowRate * Cp); @@ -1453,7 +1422,7 @@ void InitWaterCoil(EnergyPlusData &state, int const CoilNum, bool const FirstHVA // Now use SolveRoot to "invert" the cooling coil model to obtain the UA given the specified design inlet and outlet conditions // Note that the UAs we have obtained so far are rough estimates that are the starting points for the the following iterative - // calulation of the actual UAs. + // calculation of the actual UAs. waterCoil.InletAirTemp = waterCoil.DesInletAirTemp; waterCoil.InletAirHumRat = waterCoil.DesInletAirHumRat; waterCoil.InletWaterTemp = waterCoil.DesInletWaterTemp; @@ -1533,11 +1502,7 @@ void InitWaterCoil(EnergyPlusData &state, int const CoilNum, bool const FirstHVA waterCoil.InletAirMassFlowRate = state.dataEnvrn->StdRhoAir * waterCoil.DesAirVolFlowRate; CapacitanceAir = waterCoil.InletAirMassFlowRate * PsyCpAirFnW(waterCoil.InletAirHumRat); - Cp = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).FluidName, - waterCoil.InletWaterTemp, - state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).glycol->getSpecificHeat(state, waterCoil.InletWaterTemp, RoutineName); state.dataWaterCoils->CapacitanceWater = waterCoil.InletWaterMassFlowRate * Cp; state.dataWaterCoils->CMin = min(CapacitanceAir, state.dataWaterCoils->CapacitanceWater); @@ -1729,7 +1694,7 @@ void InitWaterCoil(EnergyPlusData &state, int const CoilNum, bool const FirstHVA if (waterCoil.DesWaterCoolingCoilRate <= 0.0) waterCoil.DesWaterCoolingCoilRate = waterCoil.TotWaterCoolingCoilRate; if (waterCoil.DesWaterHeatingCoilRate <= 0.0) waterCoil.DesWaterHeatingCoilRate = waterCoil.TotWaterHeatingCoilRate; - // call coil model with everthing set at rating point + // call coil model with everything set at rating point waterCoil.InletAirMassFlowRate = waterCoil.DesAirMassFlowRate; waterCoil.InletAirTemp = waterCoil.DesInletAirTemp; waterCoil.InletAirHumRat = waterCoil.DesInletAirHumRat; // fixed in sizing routine @@ -1738,11 +1703,8 @@ void InitWaterCoil(EnergyPlusData &state, int const CoilNum, bool const FirstHVA state, waterCoil.DesInletAirTemp, waterCoil.DesInletAirHumRat, DataEnvironment::StdPressureSeaLevel, "InitWaterCoils"); waterCoil.InletWaterMassFlowRate = waterCoil.MaxWaterMassFlowRate; waterCoil.InletWaterTemp = waterCoil.DesInletWaterTemp; - Real64 cp = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).FluidName, - waterCoil.DesInletWaterTemp, - state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).FluidIndex, - "InitWaterCoil"); + Real64 cp = state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum) + .glycol->getSpecificHeat(state, waterCoil.DesInletWaterTemp, "InitWaterCoil"); waterCoil.InletWaterEnthalpy = cp * waterCoil.InletWaterTemp; waterCoil.UACoilVariable = waterCoil.UACoil; @@ -2445,16 +2407,8 @@ void SizeWaterCoil(EnergyPlusData &state, int const CoilNum) state.dataSize->DataPltSizHeatNum = PltSizHeatNum; state.dataSize->DataWaterLoopNum = waterCoil.WaterPlantLoc.loopNum; - rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).FluidIndex, - RoutineName); - Cp = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(state.dataSize->DataWaterLoopNum).FluidName, - Constant::HWInitConvTemp, - state.dataPlnt->PlantLoop(state.dataSize->DataWaterLoopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName); + Cp = state.dataPlnt->PlantLoop(state.dataSize->DataWaterLoopNum).glycol->getSpecificHeat(state, Constant::HWInitConvTemp, RoutineName); if (waterCoil.DesTotWaterCoilLoad > 0.0) { NomCapUserInp = true; } else if (state.dataSize->CurSysNum > 0 && state.dataSize->CurSysNum <= state.dataHVACGlobal->NumPrimaryAirSys) { @@ -2825,11 +2779,7 @@ void CalcSimpleHeatingCoil(EnergyPlusData &state, if (WaterMassFlowRate > DataBranchAirLoopPlant::MassFlowTolerance) { // If the coil is operating CapacitanceAir = PsyCpAirFnW(Win) * AirMassFlow; - Cp = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).FluidName, - TempWaterIn, - state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).glycol->getSpecificHeat(state, TempWaterIn, RoutineName); CapacitanceWater = Cp * WaterMassFlowRate; CapacitanceMin = min(CapacitanceAir, CapacitanceWater); CapacitanceMax = max(CapacitanceAir, CapacitanceWater); @@ -2843,7 +2793,7 @@ void CalcSimpleHeatingCoil(EnergyPlusData &state, // Also the coil has to be scheduled to be available if (((CapacitanceAir > 0.0) && (CapacitanceWater > 0.0)) && (CalcMode == state.dataWaterCoils->DesignCalc || state.dataWaterCoils->MySizeFlag(CoilNum) || - state.dataWaterCoils->MyUAAndFlowCalcFlag(CoilNum) || GetCurrentScheduleValue(state, waterCoil.SchedPtr) > 0.0)) { + state.dataWaterCoils->MyUAAndFlowCalcFlag(CoilNum) || waterCoil.availSched->getCurrentVal() > 0.0)) { if (UA <= 0.0) { ShowFatalError(state, format("UA is zero for COIL:Heating:Water {}", waterCoil.Name)); @@ -3093,7 +3043,7 @@ void CalcDetailFlatFinCoolingCoil(EnergyPlusData &state, } // If Coil is Scheduled ON then do the simulation - if (((GetCurrentScheduleValue(state, waterCoil.SchedPtr) > 0.0) && (WaterMassFlowRate > 0.0) && (AirMassFlow >= WaterCoils::MinAirMassFlow)) || + if (((waterCoil.availSched->getCurrentVal() > 0.0) && (WaterMassFlowRate > 0.0) && (AirMassFlow >= WaterCoils::MinAirMassFlow)) || (CalcMode == state.dataWaterCoils->DesignCalc)) { // transfer inputs to simulation variables and calculate // known thermodynamic functions @@ -3107,11 +3057,7 @@ void CalcDetailFlatFinCoolingCoil(EnergyPlusData &state, // Ratio of secondary (fin) to total (secondary plus primary) surface areas FinToTotSurfAreaRatio = waterCoil.FinSurfArea / waterCoil.TotCoilOutsideSurfArea; // known water and air flow parameters: - rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).FluidName, - TempWaterIn, - state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).glycol->getDensity(state, TempWaterIn, RoutineName); // water flow velocity - assuming number of water circuits = NumOfTubesPerRow TubeWaterVel = WaterMassFlowRate * 4.0 / (waterCoil.NumOfTubesPerRow * rho * Constant::Pi * waterCoil.TubeInsideDiam * waterCoil.TubeInsideDiam); @@ -3219,11 +3165,7 @@ void CalcDetailFlatFinCoolingCoil(EnergyPlusData &state, // dry coil outside thermal resistance = [1/UA] (dry coil) CoilToAirThermResistDrySurf = 1.0 / (waterCoil.TotCoilOutsideSurfArea * AirSideDrySurfFilmCoef * DryCoilEfficiency); // definitions made to simplify some of the expressions used below - Cp = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).FluidName, - TempWaterIn, - state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).glycol->getSpecificHeat(state, TempWaterIn, RoutineName); ScaledWaterSpecHeat = WaterMassFlowRate * Cp * ConvK / AirMassFlow; DryCoilCoeff1 = 1.0 / (AirMassFlow * MoistAirSpecificHeat) - 1.0 / (WaterMassFlowRate * Cp * ConvK); // perform initialisations for all wet solution @@ -3604,7 +3546,7 @@ void CoolingCoil(EnergyPlusData &state, } // If Coil is Scheduled ON then do the simulation - if (((GetCurrentScheduleValue(state, waterCoil.SchedPtr) > 0.0) && (waterCoil.InletWaterMassFlowRate > 0.0) && + if (((waterCoil.availSched->getCurrentVal() > 0.0) && (waterCoil.InletWaterMassFlowRate > 0.0) && (AirMassFlowRate >= WaterCoils::MinAirMassFlow) && (waterCoil.DesAirVolFlowRate > 0.0) && (waterCoil.MaxWaterMassFlowRate > 0.0)) || (CalcMode == state.dataWaterCoils->DesignCalc)) { @@ -3816,11 +3758,7 @@ void CoilCompletelyDry(EnergyPlusData &state, // Calculate air and water capacity rates CapacitanceAir = AirMassFlow * PsyCpAirFnW(waterCoil.InletAirHumRat); // Water Capacity Rate - Cp = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).FluidName, - WaterTempIn, - state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).glycol->getSpecificHeat(state, WaterTempIn, RoutineName); CapacitanceWater = WaterMassFlowRate * Cp; @@ -3954,11 +3892,7 @@ void CoilCompletelyWet(EnergyPlusData &state, // coil as counterflow enthalpy heat exchanger UACoilTotalEnth = 1.0 / (IntermediateCpSat * WaterSideResist + AirSideResist * PsyCpAirFnW(0.0)); CapacityRateAirWet = AirMassFlow; - Cp = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).FluidName, - WaterTempIn, - state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).glycol->getSpecificHeat(state, WaterTempIn, RoutineName); CapacityRateWaterWet = WaterMassFlowRate * (Cp / IntermediateCpSat); CoilOutletStreamCondition(state, CoilNum, @@ -5345,7 +5279,7 @@ void CheckWaterCoilSchedule(EnergyPlusData &state, std::string_view CompName, Re ShowFatalError(state, format("CheckWaterCoilSchedule: Coil not found={}", CompName)); } CompIndex = CoilNum; - Value = GetCurrentScheduleValue(state, state.dataWaterCoils->WaterCoil(CoilNum).SchedPtr); // not scheduled? + Value = state.dataWaterCoils->WaterCoil(CoilNum).availSched->getCurrentVal(); // not scheduled? } else { CoilNum = CompIndex; if (CoilNum > state.dataWaterCoils->NumWaterCoils || CoilNum < 1) { @@ -5363,7 +5297,7 @@ void CheckWaterCoilSchedule(EnergyPlusData &state, std::string_view CompName, Re CompName, waterCoil.Name)); } - Value = GetCurrentScheduleValue(state, waterCoil.SchedPtr); // not scheduled? + Value = waterCoil.availSched->getCurrentVal(); // not scheduled? } } @@ -6130,10 +6064,10 @@ void UpdateWaterToAirCoilPlantConnection(EnergyPlusData &state, } } -int GetWaterCoilAvailScheduleIndex(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem +Sched::Schedule *GetWaterCoilAvailSched(EnergyPlusData &state, + std::string const &CoilType, // must match coil types in this module + std::string const &CoilName, // must match coil names for the coil type + bool &ErrorsFound // set to true if problem ) { @@ -6154,13 +6088,12 @@ int GetWaterCoilAvailScheduleIndex(EnergyPlusData &state, } int WhichCoil = 0; - int AvailSchIndex = 0; if (Util::SameString(CoilType, "Coil:Heating:Water") || Util::SameString(CoilType, "Coil:Cooling:Water") || Util::SameString(CoilType, "Coil:Cooling:Water:DetailedGeometry")) { WhichCoil = Util::FindItem(CoilName, state.dataWaterCoils->WaterCoil); if (WhichCoil != 0) { - AvailSchIndex = state.dataWaterCoils->WaterCoil(WhichCoil).SchedPtr; + return state.dataWaterCoils->WaterCoil(WhichCoil).availSched; } } else { WhichCoil = 0; @@ -6169,10 +6102,10 @@ int GetWaterCoilAvailScheduleIndex(EnergyPlusData &state, if (WhichCoil == 0) { ShowSevereError(state, format("GetCoilAvailScheduleIndex: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName)); ErrorsFound = true; - AvailSchIndex = 0; + return nullptr; } - return AvailSchIndex; + return nullptr; } void SetWaterCoilData(EnergyPlusData &state, @@ -6283,11 +6216,7 @@ void EstimateCoilInletWaterTemp(EnergyPlusData &state, } if (WaterMassFlowRate > DataBranchAirLoopPlant::MassFlowTolerance) { // if the coil is operating CapacitanceAir = PsyCpAirFnW(Win) * AirMassFlow; - Cp = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).FluidName, - TempWaterIn, - state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(waterCoil.WaterPlantLoc.loopNum).glycol->getSpecificHeat(state, TempWaterIn, RoutineName); CapacitanceWater = Cp * WaterMassFlowRate; CapacitanceMin = min(CapacitanceAir, CapacitanceWater); CapacitanceMax = max(CapacitanceAir, CapacitanceWater); diff --git a/src/EnergyPlus/WaterCoils.hh b/src/EnergyPlus/WaterCoils.hh index a3b61963fb5..3c631fc1241 100644 --- a/src/EnergyPlus/WaterCoils.hh +++ b/src/EnergyPlus/WaterCoils.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -89,8 +89,7 @@ namespace WaterCoils { std::string WaterCoilModelA; // Type of WaterCoil ie. Simple, Detailed, etc. DataPlant::PlantEquipmentType WaterCoilType; // Type of WaterCoil ie. Heating or Cooling CoilModel WaterCoilModel; // Type of WaterCoil ie. Simple, Detailed, etc. - std::string Schedule; // WaterCoil Operation Schedule - int SchedPtr; // Pointer to the correct schedule + Sched::Schedule *availSched = nullptr; // availability schedule bool RequestingAutoSize; // True if this coil has appropriate autosize fields Real64 InletAirMassFlowRate; // MassFlow through the WaterCoil being Simulated [kg/s] Real64 OutletAirMassFlowRate; // MassFlow through the WaterCoil being Simulated[kg/s] @@ -222,7 +221,7 @@ namespace WaterCoils { // Default Constructor WaterCoilEquipConditions() - : WaterCoilType(DataPlant::PlantEquipmentType::Invalid), WaterCoilModel(CoilModel::Invalid), SchedPtr(0), RequestingAutoSize(false), + : WaterCoilType(DataPlant::PlantEquipmentType::Invalid), WaterCoilModel(CoilModel::Invalid), RequestingAutoSize(false), InletAirMassFlowRate(0.0), OutletAirMassFlowRate(0.0), InletAirTemp(0.0), OutletAirTemp(0.0), InletAirHumRat(0.0), OutletAirHumRat(0.0), InletAirEnthalpy(0.0), OutletAirEnthalpy(0.0), TotWaterCoilLoad(0.0), SenWaterCoilLoad(0.0), TotWaterHeatingCoilEnergy(0.0), TotWaterCoolingCoilEnergy(0.0), SenWaterCoolingCoilEnergy(0.0), DesWaterHeatingCoilRate(0.0), TotWaterHeatingCoilRate(0.0), @@ -504,10 +503,10 @@ namespace WaterCoils { bool &InitLoopEquip // If not zero, calculate the max load for operating conditions ); - int GetWaterCoilAvailScheduleIndex(EnergyPlusData &state, - std::string const &CoilType, // must match coil types in this module - std::string const &CoilName, // must match coil names for the coil type - bool &ErrorsFound // set to true if problem + Sched::Schedule *GetWaterCoilAvailSched(EnergyPlusData &state, + std::string const &CoilType, // must match coil types in this module + std::string const &CoilName, // must match coil names for the coil type + bool &ErrorsFound // set to true if problem ); // sets data to a coil that is used as a regeneration air heating coil in @@ -595,6 +594,10 @@ struct WaterCoilsData : BaseGlobalStruct Array2D OrdPairSum = Array2D(10, 2); Array2D OrdPairSumMatrix = Array2D(10, 10); + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/WaterManager.cc b/src/EnergyPlus/WaterManager.cc index 5e5eed382f7..c72cfc075e8 100644 --- a/src/EnergyPlus/WaterManager.cc +++ b/src/EnergyPlus/WaterManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -51,7 +51,6 @@ // ObjexxFCL Headers #include #include -#include // EnergyPlus Headers #include @@ -162,11 +161,7 @@ namespace WaterManager { // MODIFIED na // RE-ENGINEERED na - using ScheduleManager::CheckScheduleValue; - using ScheduleManager::CheckScheduleValueMinMax; - using ScheduleManager::GetScheduleIndex; - using ScheduleManager::GetScheduleMaxValue; - using ScheduleManager::GetScheduleMinValue; + static constexpr std::string_view routineName = "GetWaterManagerInput"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int Item; // Item to be "gotten" @@ -242,6 +237,9 @@ namespace WaterManager { _, cAlphaFieldNames, cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, cAlphaArgs(1)}; + state.dataWaterData->AnyWaterSystemsInModel = true; state.dataWaterData->WaterStorage(Item).Name = cAlphaArgs(1); Util::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); @@ -321,24 +319,15 @@ namespace WaterManager { } if (state.dataWaterData->WaterStorage(Item).ThermalMode == DataWater::TankThermalMode::Scheduled) { - state.dataWaterData->WaterStorage(Item).TempSchedID = GetScheduleIndex(state, cAlphaArgs(7)); - if (state.dataWaterData->WaterStorage(Item).TempSchedID == 0) { - ShowSevereError(state, format("Invalid {}={}", cAlphaFieldNames(7), cAlphaArgs(7))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, cAlphaArgs(1))); + + if (lAlphaFieldBlanks(7)) { + ShowSevereEmptyField(state, eoh, cAlphaFieldNames(7)); ErrorsFound = true; - } - Real64 tmpMin = GetScheduleMinValue(state, state.dataWaterData->WaterStorage(Item).TempSchedID); - if (tmpMin < 0.0) { - ShowSevereError(state, format("Invalid {}={}", cAlphaFieldNames(7), cAlphaArgs(7))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, cAlphaArgs(1))); - ShowContinueError(state, format("Found storage tank temperature schedule value less than 0.0 in {}", objNameMsg)); + } else if ((state.dataWaterData->WaterStorage(Item).tempSched = Sched::GetSchedule(state, cAlphaArgs(7))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(7), cAlphaArgs(7)); ErrorsFound = true; - } - Real64 tmpMax = GetScheduleMaxValue(state, state.dataWaterData->WaterStorage(Item).TempSchedID); - if (tmpMax > 100.0) { - ShowSevereError(state, format("Invalid {}={}", cAlphaFieldNames(7), cAlphaArgs(7))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, cAlphaArgs(1))); - ShowContinueError(state, format("found storage tank temperature schedule value greater than 100.0 in {}", objNameMsg)); + } else if (!state.dataWaterData->WaterStorage(Item).tempSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 100.0)) { + Sched::ShowSevereBadMinMax(state, eoh, cAlphaFieldNames(7), cAlphaArgs(7), Clusive::In, 0.0, Clusive::In, 100.0); ErrorsFound = true; } } @@ -355,13 +344,18 @@ namespace WaterManager { ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, cAlphaArgs(1))); ErrorsFound = true; } - state.dataWaterData->WaterStorage(Item).AmbientTempSchedule = GetScheduleIndex(state, cAlphaArgs(9)); - if ((state.dataWaterData->WaterStorage(Item).AmbientTempSchedule == 0) && - (state.dataWaterData->WaterStorage(Item).AmbientTempIndicator == DataWater::AmbientTempType::Schedule)) { - ShowSevereError(state, format("Invalid {}={}", cAlphaFieldNames(9), cAlphaArgs(9))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, cAlphaArgs(1))); - ErrorsFound = true; + + if (state.dataWaterData->WaterStorage(Item).AmbientTempIndicator == DataWater::AmbientTempType::Schedule) { + if (lAlphaFieldBlanks(9)) { + ShowSevereEmptyField(state, eoh, cAlphaFieldNames(9)); + ErrorsFound = true; + } else if ((state.dataWaterData->WaterStorage(Item).ambientTempSched = Sched::GetSchedule(state, cAlphaArgs(9))) == + nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(9), cAlphaArgs(9)); + ErrorsFound = true; + } } + state.dataWaterData->WaterStorage(Item).ZoneID = Util::FindItemInList(cAlphaArgs(10), state.dataHeatBal->Zone); if ((state.dataWaterData->WaterStorage(Item).ZoneID == 0) && (state.dataWaterData->WaterStorage(Item).AmbientTempIndicator == DataWater::AmbientTempType::Zone)) { @@ -402,6 +396,9 @@ namespace WaterManager { _, cAlphaFieldNames, cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, cAlphaArgs(1)}; + state.dataWaterData->RainCollector(Item).Name = cAlphaArgs(1); Util::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); objNameMsg = cCurrentModuleObject + " Named " + cAlphaArgs(1); @@ -437,24 +434,17 @@ namespace WaterManager { } if (state.dataWaterData->RainCollector(Item).LossFactorMode == DataWater::RainLossFactor::Scheduled) { - state.dataWaterData->RainCollector(Item).LossFactorSchedID = GetScheduleIndex(state, cAlphaArgs(4)); - if (state.dataWaterData->RainCollector(Item).LossFactorSchedID == 0) { - ShowSevereError(state, format("Invalid {}={}", cAlphaFieldNames(4), cAlphaArgs(4))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, cAlphaArgs(1))); + if (lAlphaFieldBlanks(4)) { + ShowSevereEmptyField(state, eoh, cAlphaFieldNames(4)); ErrorsFound = true; - } - if (GetScheduleMinValue(state, state.dataWaterData->RainCollector(Item).LossFactorSchedID) < 0.0) { - ShowSevereError(state, format("Invalid {}={}", cAlphaFieldNames(4), cAlphaArgs(4))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, cAlphaArgs(1))); - ShowContinueError(state, - format("found rain water collection loss factor schedule value less than 0.0 in {}", objNameMsg)); + } else if ((state.dataWaterData->RainCollector(Item).lossFactorSched = Sched::GetSchedule(state, cAlphaArgs(4))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(4), cAlphaArgs(4)); ErrorsFound = true; - } - if (GetScheduleMaxValue(state, state.dataWaterData->RainCollector(Item).LossFactorSchedID) > 1.0) { - ShowWarningError(state, format("Potentially invalid {}={}", cAlphaFieldNames(4), cAlphaArgs(4))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, cAlphaArgs(1))); - ShowContinueError(state, "found rain water collection loss factor schedule value greater than 1.0, simulation continues"); - // allowing it to continue + } else if (!state.dataWaterData->RainCollector(Item).lossFactorSched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, cAlphaFieldNames(4), cAlphaArgs(4), Clusive::In, 0.0); + ErrorsFound = true; + } else if (!state.dataWaterData->RainCollector(Item).lossFactorSched->checkMaxVal(state, Clusive::In, 1.0)) { + Sched::ShowWarningBadMax(state, eoh, cAlphaFieldNames(4), cAlphaArgs(4), Clusive::In, 1.0, ""); } } state.dataWaterData->RainCollector(Item).MaxCollectRate = rNumericArgs(1); @@ -521,6 +511,9 @@ namespace WaterManager { lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, cAlphaArgs(1)}; + state.dataWaterData->GroundwaterWell(Item).Name = cAlphaArgs(1); Util::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); objNameMsg = cCurrentModuleObject + " Named " + cAlphaArgs(1); @@ -559,12 +552,15 @@ namespace WaterManager { // N8, \field water table depth state.dataWaterData->GroundwaterWell(Item).WaterTableDepth = rNumericArgs(8); // A4; \field water table depth schedule - state.dataWaterData->GroundwaterWell(Item).WaterTableDepthSchedID = GetScheduleIndex(state, cAlphaArgs(4)); - if ((state.dataWaterData->GroundwaterWell(Item).GroundwaterTableMode == DataWater::GroundWaterTable::Scheduled) && - (state.dataWaterData->GroundwaterWell(Item).WaterTableDepthSchedID == 0)) { - ShowSevereError(state, format("Invalid {}={}", cAlphaFieldNames(4), cAlphaArgs(4))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, cAlphaArgs(1))); - ErrorsFound = true; + if (state.dataWaterData->GroundwaterWell(Item).GroundwaterTableMode == DataWater::GroundWaterTable::Scheduled) { + if (lAlphaFieldBlanks(4)) { + ShowSevereEmptyField(state, eoh, cAlphaFieldNames(4)); + ErrorsFound = true; + } else if ((state.dataWaterData->GroundwaterWell(Item).waterTableDepthSched = Sched::GetSchedule(state, cAlphaArgs(4))) == + nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(4), cAlphaArgs(4)); + ErrorsFound = true; + } } } } //(NumGroundWaterWells > 0) @@ -656,6 +652,8 @@ namespace WaterManager { state.dataInputProcessing->inputProcessor->getObjectItem( state, cCurrentModuleObject, 1, cAlphaArgs, NumAlphas, rNumericArgs, NumNumbers, IOStatus); + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, cAlphaArgs(1)}; + if (Util::SameString(cAlphaArgs(1), "ScheduleAndDesignLevel")) { state.dataWaterData->RainFall.ModeID = DataWater::RainfallMode::RainSchedDesign; } else { @@ -663,15 +661,16 @@ namespace WaterManager { ShowContinueError(state, "Only available option is ScheduleAndDesignLevel."); ErrorsFound = true; } - state.dataWaterData->RainFall.RainSchedID = GetScheduleIndex(state, cAlphaArgs(2)); - if ((state.dataWaterData->RainFall.RainSchedID == 0) && - (state.dataWaterData->RainFall.ModeID == DataWater::RainfallMode::RainSchedDesign)) { - ShowSevereError(state, format("Schedule not found for {} object", cCurrentModuleObject)); - ErrorsFound = true; - } else if ((state.dataWaterData->RainFall.RainSchedID != 0) && - (state.dataWaterData->RainFall.ModeID == DataWater::RainfallMode::RainSchedDesign)) { - if (!CheckScheduleValueMinMax(state, state.dataWaterData->RainFall.RainSchedID, true, 0.0)) { - ShowSevereError(state, format("Schedule={} for {} object has values < 0.", cAlphaArgs(2), cCurrentModuleObject)); + + if (state.dataWaterData->RainFall.ModeID == DataWater::RainfallMode::RainSchedDesign) { + if (lAlphaFieldBlanks(2)) { + ShowSevereEmptyField(state, eoh, cAlphaFieldNames(2)); + ErrorsFound = true; + } else if ((state.dataWaterData->RainFall.rainSched = Sched::GetSchedule(state, cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2)); + ErrorsFound = true; + } else if (!state.dataWaterData->RainFall.rainSched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2), Clusive::In, 0.0); ErrorsFound = true; } } @@ -691,6 +690,9 @@ namespace WaterManager { state.dataWaterData->AnyIrrigationInModel = true; state.dataInputProcessing->inputProcessor->getObjectItem( state, cCurrentModuleObject, 1, cAlphaArgs, NumAlphas, rNumericArgs, NumNumbers, IOStatus); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, cAlphaArgs(1)}; + if (Util::SameString(cAlphaArgs(1), "Schedule")) { state.dataWaterData->Irrigation.ModeID = DataWater::IrrigationMode::IrrSchedDesign; } else if (Util::SameString(cAlphaArgs(1), "SmartSchedule")) { @@ -702,16 +704,17 @@ namespace WaterManager { if (state.dataWaterData->RainFall.ModeID == DataWater::RainfallMode::None) { state.dataWaterData->RainFall.ModeID = DataWater::RainfallMode::EPWPrecipitation; } - state.dataWaterData->Irrigation.IrrSchedID = GetScheduleIndex(state, cAlphaArgs(2)); - if ((state.dataWaterData->Irrigation.IrrSchedID == 0) && - ((state.dataWaterData->Irrigation.ModeID == DataWater::IrrigationMode::IrrSchedDesign) || - state.dataWaterData->Irrigation.ModeID == DataWater::IrrigationMode::IrrSmartSched)) { - ShowSevereError(state, format("Schedule not found for {} object", cCurrentModuleObject)); - ErrorsFound = true; - } else if ((state.dataWaterData->Irrigation.IrrSchedID == 0) && - (state.dataWaterData->Irrigation.ModeID == DataWater::IrrigationMode::IrrSchedDesign)) { - if (!CheckScheduleValueMinMax(state, state.dataWaterData->Irrigation.IrrSchedID, true, 0.0)) { - ShowSevereError(state, format("Schedule={} for {} object has values < 0.", cAlphaArgs(2), cCurrentModuleObject)); + + if (state.dataWaterData->Irrigation.ModeID == DataWater::IrrigationMode::IrrSchedDesign || + state.dataWaterData->Irrigation.ModeID == DataWater::IrrigationMode::IrrSmartSched) { + if (lAlphaFieldBlanks(2)) { + ShowSevereEmptyField(state, eoh, cAlphaFieldNames(2)); + ErrorsFound = true; + } else if ((state.dataWaterData->Irrigation.irrSched = Sched::GetSchedule(state, cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2)); + ErrorsFound = true; + } else if (!state.dataWaterData->Irrigation.irrSched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2), Clusive::In, 0.0); ErrorsFound = true; } } @@ -934,20 +937,18 @@ namespace WaterManager { // PURPOSE OF THIS SUBROUTINE: // update the current rate of precipitation - using ScheduleManager::GetCurrentScheduleValue; - Real64 schedRate; Real64 ScaleFactor; // when the site:precipitation exists, use the precipitation schedule if (state.dataWaterData->RainFall.ModeID == DataWater::RainfallMode::RainSchedDesign) { - schedRate = GetCurrentScheduleValue(state, state.dataWaterData->RainFall.RainSchedID); // m/hr + schedRate = state.dataWaterData->RainFall.rainSched->getCurrentVal(); // m/hr if (state.dataWaterData->RainFall.NomAnnualRain > 0.0) { ScaleFactor = state.dataWaterData->RainFall.DesignAnnualRain / state.dataWaterData->RainFall.NomAnnualRain; } else { ScaleFactor = 0.0; } - state.dataWaterData->RainFall.CurrentRate = schedRate * ScaleFactor / Constant::SecInHour; // convert to m/s + state.dataWaterData->RainFall.CurrentRate = schedRate * ScaleFactor / Constant::rSecsInHour; // convert to m/s } else { // placeholder: add EP checks for out of range precipitation value later -- yujie // when there's no site:precipitation but non-zero epw precipitation, uset the epw precipitation as the CurrentRate @@ -981,20 +982,19 @@ namespace WaterManager { // PURPOSE OF THIS SUBROUTINE: // update the current rate of irrigation - Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - using ScheduleManager::GetCurrentScheduleValue; + Real64 TimeStepSys = state.dataHVACGlobal->TimeStepSys; Real64 schedRate; state.dataWaterData->Irrigation.ScheduledAmount = 0.0; if (state.dataWaterData->Irrigation.ModeID == DataWater::IrrigationMode::IrrSchedDesign) { - schedRate = GetCurrentScheduleValue(state, state.dataWaterData->Irrigation.IrrSchedID); // m/hr - state.dataWaterData->Irrigation.ScheduledAmount = schedRate * TimeStepSysSec / Constant::SecInHour; // convert to m/timestep // LOL + schedRate = state.dataWaterData->Irrigation.irrSched->getCurrentVal(); // m/hr + state.dataWaterData->Irrigation.ScheduledAmount = schedRate * TimeStepSys; // convert to m/timestep } else if (state.dataWaterData->Irrigation.ModeID == DataWater::IrrigationMode::IrrSmartSched) { - schedRate = GetCurrentScheduleValue(state, state.dataWaterData->Irrigation.IrrSchedID); // m/hr - state.dataWaterData->Irrigation.ScheduledAmount = schedRate * TimeStepSysSec / Constant::SecInHour; // convert to m/timestep // LOL + schedRate = state.dataWaterData->Irrigation.irrSched->getCurrentVal(); // m/hr + state.dataWaterData->Irrigation.ScheduledAmount = schedRate * TimeStepSys; // convert to m/timestep } } @@ -1013,7 +1013,6 @@ namespace WaterManager { // Using/Aliasing Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - using ScheduleManager::GetCurrentScheduleValue; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 OrigVdotDemandRequest(0.0); @@ -1169,8 +1168,7 @@ namespace WaterManager { switch (state.dataWaterData->WaterStorage(TankNum).ThermalMode) { case DataWater::TankThermalMode::Scheduled: { - state.dataWaterData->WaterStorage(TankNum).Twater = - GetCurrentScheduleValue(state, state.dataWaterData->WaterStorage(TankNum).TempSchedID); + state.dataWaterData->WaterStorage(TankNum).Twater = state.dataWaterData->WaterStorage(TankNum).tempSched->getCurrentVal(); state.dataWaterData->WaterStorage(TankNum).TouterSkin = state.dataWaterData->WaterStorage(TankNum).Twater; } break; case DataWater::TankThermalMode::ZoneCoupled: { @@ -1427,7 +1425,6 @@ namespace WaterManager { using DataEnvironment::OutWetBulbTempAt; Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - using ScheduleManager::GetCurrentScheduleValue; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 LossFactor(0.0); @@ -1451,7 +1448,7 @@ namespace WaterManager { LossFactor = state.dataWaterData->RainCollector(RainColNum).LossFactor; } break; case DataWater::RainLossFactor::Scheduled: { - LossFactor = GetCurrentScheduleValue(state, state.dataWaterData->RainCollector(RainColNum).LossFactorSchedID); + LossFactor = state.dataWaterData->RainCollector(RainColNum).lossFactorSched->getCurrentVal(); } break; default: { assert(false); diff --git a/src/EnergyPlus/WaterManager.hh b/src/EnergyPlus/WaterManager.hh index 1443128d069..1f502f10732 100644 --- a/src/EnergyPlus/WaterManager.hh +++ b/src/EnergyPlus/WaterManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -126,6 +126,10 @@ struct WaterManagerData : BaseGlobalStruct bool MyTankDemandCheckFlag; Real64 overflowTwater = 0.0; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/WaterThermalTanks.cc b/src/EnergyPlus/WaterThermalTanks.cc index 04c63046873..69818ef0fb8 100644 --- a/src/EnergyPlus/WaterThermalTanks.cc +++ b/src/EnergyPlus/WaterThermalTanks.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -131,7 +131,6 @@ std::string const cStratifiedCWTankModuleObj = "ThermalStorage:ChilledWater:Stra std::string const cHPWHPumpedCondenser = "WaterHeater:HeatPump:PumpedCondenser"; std::string const cHPWHWrappedCondenser = "WaterHeater:HeatPump:WrappedCondenser"; std::string const cCoilDesuperheater = "Coil:WaterHeating:Desuperheater"; -std::string const fluidNameWater = "WATER"; PlantComponent *WaterThermalTankData::factory(EnergyPlusData &state, std::string const &objectName) { @@ -624,26 +623,22 @@ void CalcWaterThermalTankZoneGains(EnergyPlusData &state) for (int WaterThermalTankNum = 1; WaterThermalTankNum <= state.dataWaterThermalTanks->numWaterThermalTank; ++WaterThermalTankNum) { auto &Tank = state.dataWaterThermalTanks->WaterThermalTank(WaterThermalTankNum); if (Tank.AmbientTempZone == 0) continue; - auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(Tank.AmbientTempZone); + auto const &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(Tank.AmbientTempZone); if (state.dataGlobal->DoingSizing) { // Initialize tank temperature to setpoint // (use HPWH or Desuperheater heating coil set point if applicable) - int SchIndex; + Sched::Schedule *sched = nullptr; if (Tank.HeatPumpNum > 0) { - SchIndex = state.dataWaterThermalTanks->HPWaterHeater(Tank.HeatPumpNum).SetPointTempSchedule; + sched = state.dataWaterThermalTanks->HPWaterHeater(Tank.HeatPumpNum).setptTempSched; } else if (Tank.DesuperheaterNum > 0) { - SchIndex = state.dataWaterThermalTanks->WaterHeaterDesuperheater(Tank.DesuperheaterNum).SetPointTempSchedule; + sched = state.dataWaterThermalTanks->WaterHeaterDesuperheater(Tank.DesuperheaterNum).setptTempSched; } else { - SchIndex = Tank.SetPointTempSchedule; + sched = Tank.setptTempSched; } - Real64 TankTemp; + Real64 TankTemp = (sched != nullptr) ? sched->getCurrentVal() : 20.0; + Real64 QLossToZone = 0.0; - if (SchIndex > 0) { - TankTemp = ScheduleManager::GetCurrentScheduleValue(state, SchIndex); - } else { - TankTemp = 20.0; - } switch (Tank.WaterThermalTankType) { case DataPlant::PlantEquipmentType::WtrHeaterMixed: { QLossToZone = max(Tank.OnCycLossCoeff * Tank.OnCycLossFracToZone, Tank.OffCycLossCoeff * Tank.OffCycLossFracToZone) * @@ -674,7 +669,7 @@ void CalcWaterThermalTankZoneGains(EnergyPlusData &state) bool getDesuperHtrInput(EnergyPlusData &state) { bool ErrorsFound = false; - static constexpr std::string_view RoutineName = "getDesuperHtrInput"; + static constexpr std::string_view routineName = "getDesuperHtrInput"; // Make local copies of IPShortCut because other getinputs might overwrite the ones in state <-- need to fix this idiom std::string cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; Array1D cAlphaArgs = state.dataIPShortCut->cAlphaArgs; @@ -701,6 +696,9 @@ bool getDesuperHtrInput(EnergyPlusData &state) lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, cAlphaArgs(1)}; + Util::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); // ErrorsFound will be set to True if problem was found, left untouched otherwise @@ -712,22 +710,17 @@ bool getDesuperHtrInput(EnergyPlusData &state) DesupHtr.Type = cCurrentModuleObject; // convert availability schedule name to pointer - if (!lAlphaFieldBlanks(2)) { - DesupHtr.AvailSchedPtr = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(2)); - if (DesupHtr.AvailSchedPtr == 0) { - ShowSevereError(state, format("Invalid, {} = {}", cAlphaFieldNames(2), cAlphaArgs(2))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, cAlphaArgs(1))); - ErrorsFound = true; - } - } else { - DesupHtr.AvailSchedPtr = ScheduleManager::ScheduleAlwaysOn; + if (lAlphaFieldBlanks(2)) { + DesupHtr.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((DesupHtr.availSched = Sched::GetSchedule(state, cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(2), cAlphaArgs(2)); + ErrorsFound = true; } // convert schedule name to pointer - DesupHtr.SetPointTempSchedule = ScheduleManager::GetScheduleIndex(state, cAlphaArgs(3)); - if (DesupHtr.SetPointTempSchedule == 0) { - ShowSevereError(state, format("Invalid, {} = {}", cAlphaFieldNames(3), cAlphaArgs(3))); - ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, cAlphaArgs(1))); + if (lAlphaFieldBlanks(3)) { + } else if ((DesupHtr.setptTempSched = Sched::GetSchedule(state, cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFieldNames(3), cAlphaArgs(3)); ErrorsFound = true; } @@ -759,7 +752,7 @@ bool getDesuperHtrInput(EnergyPlusData &state) ErrorsFound |= Curve::CheckCurveDims(state, DesupHtr.HEffFTemp, // Curve index {2}, // Valid dimensions - RoutineName, // Routine name + routineName, // Routine name cCurrentModuleObject, // Object Type DesupHtr.Name, // Object Name cAlphaFieldNames(4)); // Field Name @@ -996,7 +989,7 @@ bool getDesuperHtrInput(EnergyPlusData &state) ErrorsFound = true; } else { DataHeatBalance::HeatReclaimDataBase &HeatReclaim = - state.dataCoilCooingDX->coilCoolingDXs[DesupHtr.ReclaimHeatingSourceIndexNum].reclaimHeat; + state.dataCoilCoolingDX->coilCoolingDXs[DesupHtr.ReclaimHeatingSourceIndexNum].reclaimHeat; if (!allocated(HeatReclaim.WaterHeatingDesuperheaterReclaimedHeat)) { HeatReclaim.WaterHeatingDesuperheaterReclaimedHeat.allocate(state.dataWaterThermalTanks->numWaterHeaterDesuperheater); for (auto &num : HeatReclaim.WaterHeatingDesuperheaterReclaimedHeat) @@ -1220,29 +1213,20 @@ bool getHPWaterHeaterInput(EnergyPlusData &state) // Availability Schedule // convert schedule name to pointer - if (!hpwhAlphaBlank[2]) { - HPWH.AvailSchedPtr = ScheduleManager::GetScheduleIndex(state, hpwhAlpha[2]); - if (HPWH.AvailSchedPtr == 0) { - ShowSevereError(state, format("{}=\"{}\", not found", state.dataIPShortCut->cCurrentModuleObject, HPWH.Name)); - ShowContinueError(state, format("{}=\"{}\".", hpwhAlphaFieldNames[2], hpwhAlpha[2])); - ErrorsFound = true; - } - } else { - HPWH.AvailSchedPtr = ScheduleManager::ScheduleAlwaysOn; + if (hpwhAlphaBlank[2]) { + HPWH.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((HPWH.availSched = Sched::GetSchedule(state, hpwhAlpha[2])) == nullptr) { + ShowSevereItemNotFound(state, eoh, hpwhAlphaFieldNames[2], hpwhAlpha[2]); + ErrorsFound = true; } // Compressor Setpoint Temperature Schedule // convert schedule name to pointer - if (!hpwhAlphaBlank[3]) { - HPWH.SetPointTempSchedule = ScheduleManager::GetScheduleIndex(state, hpwhAlpha[3]); - if (HPWH.SetPointTempSchedule == 0) { - ShowSevereError(state, format("{}=\"{}\", not found", state.dataIPShortCut->cCurrentModuleObject, HPWH.Name)); - ShowContinueError(state, format("{}=\"{}\".", hpwhAlphaFieldNames[3], hpwhAlpha[3])); - ErrorsFound = true; - } - } else { - ShowSevereError(state, format("{}=\"{}\", ", state.dataIPShortCut->cCurrentModuleObject, HPWH.Name)); - ShowContinueError(state, format("required {} is blank.", hpwhAlphaFieldNames[3])); + if (hpwhAlphaBlank[3]) { + ShowSevereEmptyField(state, eoh, hpwhAlphaFieldNames[3]); + ErrorsFound = true; + } else if ((HPWH.setptTempSched = Sched::GetSchedule(state, hpwhAlpha[3])) == nullptr) { + ShowSevereItemNotFound(state, eoh, hpwhAlphaFieldNames[3], hpwhAlpha[3]); ErrorsFound = true; } @@ -1341,44 +1325,28 @@ bool getHPWaterHeaterInput(EnergyPlusData &state) case WTTAmbientTemp::Schedule: { // Inlet Air Temperature Schedule - if (!hpwhAlphaBlank[11 + nAlphaOffset]) { - HPWH.AmbientTempSchedule = ScheduleManager::GetScheduleIndex(state, hpwhAlpha[11 + nAlphaOffset]); - if (HPWH.AmbientTempSchedule == 0) { - ShowSevereError(state, format("{}=\"{}\", not found", state.dataIPShortCut->cCurrentModuleObject, HPWH.Name)); - ShowContinueError(state, format("{}=\"{}\".", hpwhAlphaFieldNames[11 + nAlphaOffset], hpwhAlpha[11 + nAlphaOffset])); - ErrorsFound = true; - } - } else { - ShowSevereError(state, format("{}=\"{}\", ", state.dataIPShortCut->cCurrentModuleObject, HPWH.Name)); - ShowContinueError(state, format("required {} is blank.", hpwhAlphaFieldNames[11 + nAlphaOffset])); + if (hpwhAlphaBlank[11 + nAlphaOffset]) { + ShowSevereEmptyField(state, eoh, hpwhAlphaFieldNames[11 + nAlphaOffset]); + ErrorsFound = true; + } else if ((HPWH.ambientTempSched = Sched::GetSchedule(state, hpwhAlpha[11 + nAlphaOffset])) == nullptr) { + ShowSevereItemNotFound(state, eoh, hpwhAlphaFieldNames[11 + nAlphaOffset], hpwhAlpha[11 + nAlphaOffset]); ErrorsFound = true; } // Inlet Air Humidity Schedule - if (!hpwhAlphaBlank[12 + nAlphaOffset]) { - HPWH.AmbientRHSchedule = ScheduleManager::GetScheduleIndex(state, hpwhAlpha[12 + nAlphaOffset]); - if (HPWH.AmbientRHSchedule == 0) { - ShowSevereError(state, format("{}=\"{}\", not found", state.dataIPShortCut->cCurrentModuleObject, HPWH.Name)); - ShowContinueError(state, format("{}=\"{}\".", hpwhAlphaFieldNames[12 + nAlphaOffset], hpwhAlpha[12 + nAlphaOffset])); - ErrorsFound = true; - } else { - if (!ScheduleManager::CheckScheduleValueMinMax(state, HPWH.AmbientRHSchedule, ">=", 0.0, "<=", 1.0)) { - ShowSevereError(state, format("{}=\"{}\", invalid values", state.dataIPShortCut->cCurrentModuleObject, HPWH.Name)); - ShowContinueError(state, - format("{}=\"{}\", schedule values must be (>=0., <=1.)", - hpwhAlphaFieldNames[12 + nAlphaOffset], - hpwhAlpha[12 + nAlphaOffset])); - ErrorsFound = true; - } - } - } else { - ShowSevereError(state, format("{}=\"{}\", ", state.dataIPShortCut->cCurrentModuleObject, HPWH.Name)); - ShowContinueError(state, format("required {} is blank.", hpwhAlphaFieldNames[12 + nAlphaOffset])); + if (hpwhAlphaBlank[12 + nAlphaOffset]) { + ShowSevereEmptyField(state, eoh, hpwhAlphaFieldNames[12 + nAlphaOffset]); + ErrorsFound = true; + } else if ((HPWH.ambientRHSched = Sched::GetSchedule(state, hpwhAlpha[12 + nAlphaOffset])) == nullptr) { + ShowSevereItemNotFound(state, eoh, hpwhAlphaFieldNames[12 + nAlphaOffset], hpwhAlpha[12 + nAlphaOffset]); + ErrorsFound = true; + } else if (!HPWH.ambientRHSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax( + state, eoh, hpwhAlphaFieldNames[12 + nAlphaOffset], hpwhAlpha[12 + nAlphaOffset], Clusive::In, 0.0, Clusive::In, 1.0); ErrorsFound = true; } + } break; - break; - } case WTTAmbientTemp::ZoneAndOA: case WTTAmbientTemp::TempZone: { @@ -1563,24 +1531,18 @@ bool getHPWaterHeaterInput(EnergyPlusData &state) // Compressor Location HPWH.CrankcaseTempIndicator = static_cast(getEnumValue(CrankcaseHeaterControlTempNamesUC, Util::makeUPPER(hpwhAlpha[20 + nAlphaOffset]))); + switch (HPWH.CrankcaseTempIndicator) { case CrankcaseHeaterControlTemp::Schedule: { - if (!hpwhAlphaBlank[21 + nAlphaOffset]) { - // Compressor Ambient Temperature Schedule - HPWH.CrankcaseTempSchedule = ScheduleManager::GetScheduleIndex(state, hpwhAlpha[21 + nAlphaOffset]); - if (HPWH.CrankcaseTempSchedule == 0) { - ShowSevereError(state, format("{}=\"{}\", not found", state.dataIPShortCut->cCurrentModuleObject, HPWH.Name)); - ShowContinueError(state, format("{}=\"{}\".", hpwhAlphaFieldNames[21 + nAlphaOffset], hpwhAlpha[21 + nAlphaOffset])); - ErrorsFound = true; - } - } else { - ShowSevereError(state, format("{}=\"{}\", ", state.dataIPShortCut->cCurrentModuleObject, HPWH.Name)); - ShowContinueError(state, format("required {} is blank.", hpwhAlphaFieldNames[21 + nAlphaOffset])); + if (hpwhAlphaBlank[21 + nAlphaOffset]) { + ShowSevereEmptyField(state, eoh, hpwhAlphaFieldNames[21 + nAlphaOffset]); + ErrorsFound = true; + } else if ((HPWH.crankcaseTempSched = Sched::GetSchedule(state, hpwhAlpha[21 + nAlphaOffset])) == nullptr) { + ShowSevereItemNotFound(state, eoh, hpwhAlphaFieldNames[21 + nAlphaOffset], hpwhAlpha[21 + nAlphaOffset]); ErrorsFound = true; } + } break; - break; - } case CrankcaseHeaterControlTemp::Zone: { if (HPWH.InletAirConfiguration == WTTAmbientTemp::OutsideAir || HPWH.InletAirConfiguration == WTTAmbientTemp::Schedule) { ShowSevereError(state, @@ -2030,25 +1992,19 @@ bool getHPWaterHeaterInput(EnergyPlusData &state) } // only get the inlet air mixer schedule if the inlet air configuration is zone and outdoor air - if (!hpwhAlphaBlank[28 + nAlphaOffset] && HPWH.InletAirConfiguration == WTTAmbientTemp::ZoneAndOA) { - HPWH.InletAirMixerSchPtr = ScheduleManager::GetScheduleIndex(state, hpwhAlpha[28 + nAlphaOffset]); - if (HPWH.InletAirMixerSchPtr == 0) { - ShowSevereError(state, format("{}=\"{}\", not found", state.dataIPShortCut->cCurrentModuleObject, HPWH.Name)); - ShowContinueError(state, format("{}=\"{}\",", hpwhAlphaFieldNames[28 + nAlphaOffset], hpwhAlpha[28 + nAlphaOffset])); + if (HPWH.InletAirConfiguration == WTTAmbientTemp::ZoneAndOA) { + if (hpwhAlphaBlank[28 + nAlphaOffset]) { + ShowSevereEmptyField(state, eoh, hpwhAlphaFieldNames[28 + nAlphaOffset]); ErrorsFound = true; - } else { - bool ValidScheduleValue = ScheduleManager::CheckScheduleValueMinMax(state, HPWH.InletAirMixerSchPtr, ">=", 0.0, "<=", 1.0); - if (!ValidScheduleValue) { - ShowSevereError(state, format("{}=\"{}\", not found", state.dataIPShortCut->cCurrentModuleObject, HPWH.Name)); - ShowContinueError(state, - format("{} values out of range of 0 to 1, Schedule=\"{}\".", - hpwhAlphaFieldNames[28 + nAlphaOffset], - hpwhAlpha[28 + nAlphaOffset])); - ErrorsFound = true; - } // set outlet air splitter schedule index equal to inlet air mixer schedule index // (place holder for when zone pressurization/depressurization is allowed and different schedules can be used) - HPWH.OutletAirSplitterSchPtr = ScheduleManager::GetScheduleIndex(state, hpwhAlpha[28 + nAlphaOffset]); + } else if ((HPWH.inletAirMixerSched = HPWH.outletAirSplitterSched = Sched::GetSchedule(state, hpwhAlpha[28 + nAlphaOffset])) == nullptr) { + ShowSevereItemNotFound(state, eoh, hpwhAlphaFieldNames[28 + nAlphaOffset], hpwhAlpha[28 + nAlphaOffset]); + ErrorsFound = true; + } else if (!HPWH.inletAirMixerSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax( + state, eoh, hpwhAlphaFieldNames[28 + nAlphaOffset], hpwhAlpha[28 + nAlphaOffset], Clusive::In, 0.0, Clusive::In, 1.0); + ErrorsFound = true; } } @@ -2056,12 +2012,10 @@ bool getHPWaterHeaterInput(EnergyPlusData &state) if (HPWH.fanPlace == HVAC::FanPlace::DrawThru) { if (HPWH.OutletAirSplitterNode != 0) { HPWH.FanOutletNode = HPWH.OutletAirSplitterNode; + } else if (HPWH.InletAirConfiguration == WTTAmbientTemp::OutsideAir) { + HPWH.FanOutletNode = HPWH.ExhaustAirNode; } else { - if (HPWH.InletAirConfiguration == WTTAmbientTemp::OutsideAir) { - HPWH.FanOutletNode = HPWH.ExhaustAirNode; - } else { - HPWH.FanOutletNode = HPWH.HeatPumpAirOutletNode; - } + HPWH.FanOutletNode = HPWH.HeatPumpAirOutletNode; } } else if (HPWH.fanPlace == HVAC::FanPlace::BlowThru) { // set fan outlet node variable for use in setting Node(FanOutletNode)%MassFlowRateMax for fan object @@ -2273,7 +2227,7 @@ bool getWaterHeaterMixedInputs(EnergyPlusData &state) { bool ErrorsFound = false; state.dataIPShortCut->cCurrentModuleObject = cMixedWHModuleObj; - static constexpr std::string_view RoutineName = "getWaterHeaterMixedInputs"; + static constexpr std::string_view routineName = "getWaterHeaterMixedInputs"; for (int WaterThermalTankNum = 1; WaterThermalTankNum <= state.dataWaterThermalTanks->numWaterHeaterMixed; ++WaterThermalTankNum) { int NumAlphas; @@ -2291,6 +2245,8 @@ bool getWaterHeaterMixedInputs(EnergyPlusData &state) state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; GlobalNames::VerifyUniqueInterObjectName(state, state.dataWaterThermalTanks->UniqueWaterThermalTankNames, state.dataIPShortCut->cAlphaArgs(1), @@ -2303,11 +2259,15 @@ bool getWaterHeaterMixedInputs(EnergyPlusData &state) Tank.Name = state.dataIPShortCut->cAlphaArgs(1); Tank.Type = state.dataIPShortCut->cCurrentModuleObject; Tank.WaterThermalTankType = DataPlant::PlantEquipmentType::WtrHeaterMixed; - Tank.FluidIndex = Tank.waterIndex; + + if ((Tank.water = Fluid::GetWater(state)) == nullptr) { + ShowSevereError(state, "Fluid properties for WATER not found"); + ErrorsFound = true; + } // default to always on - Tank.SourceSideAvailSchedNum = ScheduleManager::ScheduleAlwaysOn; - Tank.UseSideAvailSchedNum = ScheduleManager::ScheduleAlwaysOn; + Tank.sourceSideAvailSched = Sched::GetScheduleAlwaysOn(state); + Tank.useSideAvailSched = Sched::GetScheduleAlwaysOn(state); // A user field will be added in a later release Tank.EndUseSubcategoryName = "Water Heater"; @@ -2321,20 +2281,11 @@ bool getWaterHeaterMixedInputs(EnergyPlusData &state) Tank.Volume = 0.000001; // = 1 cm3 } - Tank.SetPointTempSchedule = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { - ShowSevereError( - state, - format("{}{}=\"{}\", missing data.", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("blank field, missing {} is required", state.dataIPShortCut->cAlphaFieldNames(2))); + ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(2)); ErrorsFound = true; - } else if (Tank.SetPointTempSchedule == 0) { - ShowSevereError(state, - format("{} = {}: {} not found = {}", - state.dataIPShortCut->cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(2), - state.dataIPShortCut->cAlphaArgs(2))); + } else if ((Tank.setptTempSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2)); ErrorsFound = true; } @@ -2460,7 +2411,7 @@ bool getWaterHeaterMixedInputs(EnergyPlusData &state) ErrorsFound |= Curve::CheckCurveDims(state, Tank.PLFCurve, // Curve index {1}, // Valid dimensions - RoutineName, // Routine name + routineName, // Routine name state.dataIPShortCut->cCurrentModuleObject, // Object Type Tank.Name, // Object Name state.dataIPShortCut->cAlphaFieldNames(5)); // Field Name @@ -2520,19 +2471,17 @@ bool getWaterHeaterMixedInputs(EnergyPlusData &state) Tank.AmbientTempIndicator = static_cast(getEnumValue(TankAmbientTempNamesUC, Util::makeUPPER(state.dataIPShortCut->cAlphaArgs(8)))); switch (Tank.AmbientTempIndicator) { + case WTTAmbientTemp::Schedule: { - Tank.AmbientTempSchedule = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(9)); - if (Tank.AmbientTempSchedule == 0) { - ShowSevereError(state, - format("{} = {}: Ambient Temperature Schedule not found = {}", - state.dataIPShortCut->cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaArgs(9))); + if (state.dataIPShortCut->lAlphaFieldBlanks(9)) { + ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(9)); + ErrorsFound = true; + } else if ((Tank.ambientTempSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(9))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(9), state.dataIPShortCut->cAlphaArgs(9)); ErrorsFound = true; } + } break; - break; - } case WTTAmbientTemp::TempZone: { Tank.AmbientTempZone = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(10), state.dataHeatBal->Zone); if (Tank.AmbientTempZone == 0) { @@ -2543,9 +2492,8 @@ bool getWaterHeaterMixedInputs(EnergyPlusData &state) state.dataIPShortCut->cAlphaArgs(10))); ErrorsFound = true; } + } break; - break; - } case WTTAmbientTemp::OutsideAir: { Tank.AmbientTempOutsideAirNode = NodeInputManager::GetOnlySingleNode(state, state.dataIPShortCut->cAlphaArgs(11), @@ -2590,33 +2538,22 @@ bool getWaterHeaterMixedInputs(EnergyPlusData &state) Tank.OnCycLossCoeff = state.dataIPShortCut->rNumericArgs(15); Tank.OnCycLossFracToZone = state.dataIPShortCut->rNumericArgs(16); - Real64 rho = FluidProperties::GetDensityGlycol(state, fluidNameWater, Constant::InitConvTemp, Tank.FluidIndex, RoutineName); + Real64 rho = Tank.water->getDensity(state, Constant::InitConvTemp, routineName); + Tank.MassFlowRateMax = state.dataIPShortCut->rNumericArgs(17) * rho; if ((state.dataIPShortCut->cAlphaArgs(14).empty()) && (state.dataIPShortCut->cAlphaArgs(15).empty())) { - if (!state.dataIPShortCut->cAlphaArgs(12).empty()) { - Tank.FlowRateSchedule = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(12)); - if (Tank.FlowRateSchedule == 0) { - ShowSevereError(state, - format("{} = {}: Flow Rate Schedule not found = {}", - state.dataIPShortCut->cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaArgs(12))); - ErrorsFound = true; - } + if (state.dataIPShortCut->lAlphaFieldBlanks(12)) { + } else if ((Tank.flowRateSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(12))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(12), state.dataIPShortCut->cAlphaArgs(12)); + ErrorsFound = true; } } - if (!state.dataIPShortCut->cAlphaArgs(13).empty()) { - Tank.UseInletTempSchedule = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(13)); - if (Tank.UseInletTempSchedule == 0) { - ShowSevereError(state, - format("{} = {}: Cold Water Supply Temperature Schedule not found = {}", - state.dataIPShortCut->cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaArgs(13))); - ErrorsFound = true; - } + if (state.dataIPShortCut->lAlphaFieldBlanks(13)) { + } else if ((Tank.useInletTempSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(13))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(13), state.dataIPShortCut->cAlphaArgs(13)); + ErrorsFound = true; } if (NumNums > 17) { @@ -2706,14 +2643,14 @@ bool getWaterHeaterMixedInputs(EnergyPlusData &state) state.dataIPShortCut->cAlphaArgs(1))); } - if (Tank.FlowRateSchedule > 0) { + if (Tank.flowRateSched != nullptr) { ShowWarningError(state, format("{} = {}: Use side nodes are specified; Use Flow Rate Fraction Schedule will not be used", state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); } - if (Tank.UseInletTempSchedule > 0) { + if (Tank.useInletTempSched != nullptr) { ShowWarningError(state, format("{} = {}: Use side nodes are specified; Cold Water Supply Temperature Schedule will not be used", state.dataIPShortCut->cCurrentModuleObject, @@ -2759,18 +2696,12 @@ bool getWaterHeaterMixedInputs(EnergyPlusData &state) Tank.SourceSideControlMode = SourceSideControl::IndirectHeatPrimarySetpoint; } - if (!state.dataIPShortCut->lAlphaFieldBlanks(19)) { - Tank.SourceSideAltSetpointSchedNum = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(19)); - if (Tank.SourceSideAltSetpointSchedNum == 0) { - ShowSevereError(state, - format("{} = {}: {} not found = {}", - state.dataIPShortCut->cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(19), - state.dataIPShortCut->cAlphaArgs(19))); - ErrorsFound = true; - } + if (state.dataIPShortCut->lAlphaFieldBlanks(19)) { + } else if ((Tank.sourceSideAltSetpointSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(19))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(19), state.dataIPShortCut->cAlphaArgs(19)); + ErrorsFound = true; } + if (NumAlphas > 19) { Tank.EndUseSubcategoryName = state.dataIPShortCut->cAlphaArgs(20); } @@ -2783,7 +2714,7 @@ bool getWaterHeaterMixedInputs(EnergyPlusData &state) bool getWaterHeaterStratifiedInput(EnergyPlusData &state) { bool ErrorsFound = false; - static constexpr std::string_view RoutineName = "getWaterHeaterStratifiedInput"; + static constexpr std::string_view routineName = "getWaterHeaterStratifiedInput"; state.dataIPShortCut->cCurrentModuleObject = cStratifiedWHModuleObj; //'WaterHeater:Stratified' @@ -2805,6 +2736,9 @@ bool getWaterHeaterStratifiedInput(EnergyPlusData &state) state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + GlobalNames::VerifyUniqueInterObjectName(state, state.dataWaterThermalTanks->UniqueWaterThermalTankNames, state.dataIPShortCut->cAlphaArgs(1), @@ -2817,11 +2751,15 @@ bool getWaterHeaterStratifiedInput(EnergyPlusData &state) Tank.Name = state.dataIPShortCut->cAlphaArgs(1); Tank.Type = state.dataIPShortCut->cCurrentModuleObject; Tank.WaterThermalTankType = DataPlant::PlantEquipmentType::WtrHeaterStratified; - Tank.FluidIndex = Tank.waterIndex; + + if ((Tank.water = Fluid::GetWater(state)) == nullptr) { + ShowSevereError(state, "Fluid Properties for WATER not found."); + ErrorsFound = true; + } // default to always on - Tank.SourceSideAvailSchedNum = ScheduleManager::ScheduleAlwaysOn; - Tank.UseSideAvailSchedNum = ScheduleManager::ScheduleAlwaysOn; + Tank.sourceSideAvailSched = Sched::GetScheduleAlwaysOn(state); + Tank.useSideAvailSched = Sched::GetScheduleAlwaysOn(state); Tank.EndUseSubcategoryName = state.dataIPShortCut->cAlphaArgs(2); @@ -2829,7 +2767,7 @@ bool getWaterHeaterStratifiedInput(EnergyPlusData &state) if (Tank.Volume == DataSizing::AutoSize) { Tank.VolumeWasAutoSized = true; } - Real64 rho = FluidProperties::GetDensityGlycol(state, fluidNameWater, Constant::InitConvTemp, Tank.FluidIndex, RoutineName); + Real64 rho = Tank.water->getDensity(state, Constant::InitConvTemp, routineName); Tank.Mass = Tank.Volume * rho; Tank.Height = state.dataIPShortCut->rNumericArgs(2); if (Tank.Height == DataSizing::AutoSize) { @@ -2886,20 +2824,11 @@ bool getWaterHeaterStratifiedInput(EnergyPlusData &state) ErrorsFound = true; } - Tank.SetPointTempSchedule = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(5)); if (state.dataIPShortCut->lAlphaFieldBlanks(5)) { - ShowSevereError( - state, - format("{}{}=\"{}\", missing data.", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("blank field, missing {} is required", state.dataIPShortCut->cAlphaFieldNames(5))); + ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(5)); ErrorsFound = true; - } else if (Tank.SetPointTempSchedule == 0) { - ShowSevereError(state, - format("{} = {}: {} not found = {}", - state.dataIPShortCut->cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(5), - state.dataIPShortCut->cAlphaArgs(5))); + } else if ((Tank.setptTempSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(5))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5)); ErrorsFound = true; } @@ -2936,20 +2865,11 @@ bool getWaterHeaterStratifiedInput(EnergyPlusData &state) ErrorsFound = true; } - Tank.SetPointTempSchedule2 = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(6)); if (state.dataIPShortCut->lAlphaFieldBlanks(6)) { - ShowSevereError( - state, - format("{}{}=\"{}\", missing data.", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, format("blank field, missing {} is required", state.dataIPShortCut->cAlphaFieldNames(6))); + ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(6)); ErrorsFound = true; - } else if (Tank.SetPointTempSchedule2 == 0) { - ShowSevereError(state, - format("{} = {}: {} not found = {}", - state.dataIPShortCut->cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(6), - state.dataIPShortCut->cAlphaArgs(6))); + } else if ((Tank.setptTemp2Sched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(6))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(6), state.dataIPShortCut->cAlphaArgs(6)); ErrorsFound = true; } @@ -3063,18 +2983,15 @@ bool getWaterHeaterStratifiedInput(EnergyPlusData &state) switch (Tank.AmbientTempIndicator) { case WTTAmbientTemp::Schedule: { - Tank.AmbientTempSchedule = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(11)); - if (Tank.AmbientTempSchedule == 0) { - ShowSevereError(state, - format("{} = {}: Ambient Temperature Schedule not found = {}", - state.dataIPShortCut->cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaArgs(11))); + if (state.dataIPShortCut->lAlphaFieldBlanks(11)) { + ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(11)); + ErrorsFound = true; + } else if ((Tank.ambientTempSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(11))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(11), state.dataIPShortCut->cAlphaArgs(11)); ErrorsFound = true; } + } break; - break; - } case WTTAmbientTemp::TempZone: { Tank.AmbientTempZone = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(12), state.dataHeatBal->Zone); if (Tank.AmbientTempZone == 0) { @@ -3133,33 +3050,22 @@ bool getWaterHeaterStratifiedInput(EnergyPlusData &state) Tank.OffCycFlueLossFracToZone = state.dataIPShortCut->rNumericArgs(21); // this is temporary until we know fluid type - rho = FluidProperties::GetDensityGlycol(state, fluidNameWater, Constant::InitConvTemp, Tank.FluidIndex, RoutineName); + rho = Tank.water->getDensity(state, Constant::InitConvTemp, routineName); + Tank.MassFlowRateMax = state.dataIPShortCut->rNumericArgs(22) * rho; if ((state.dataIPShortCut->cAlphaArgs(16).empty()) && (state.dataIPShortCut->cAlphaArgs(17).empty())) { - if (!state.dataIPShortCut->cAlphaArgs(14).empty()) { - Tank.FlowRateSchedule = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(14)); - if (Tank.FlowRateSchedule == 0) { - ShowSevereError(state, - format("{} = {}: Flow Rate Schedule not found = {}", - state.dataIPShortCut->cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaArgs(14))); - ErrorsFound = true; - } + if (state.dataIPShortCut->lAlphaFieldBlanks(14)) { + } else if ((Tank.flowRateSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(14))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(14), state.dataIPShortCut->cAlphaArgs(14)); + ErrorsFound = true; } } - if (!state.dataIPShortCut->cAlphaArgs(15).empty()) { - Tank.UseInletTempSchedule = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(15)); - if (Tank.UseInletTempSchedule == 0) { - ShowSevereError(state, - format("{} = {}: Cold Water Supply Temperature Schedule not found = {}", - state.dataIPShortCut->cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaArgs(15))); - ErrorsFound = true; - } + if (state.dataIPShortCut->lAlphaFieldBlanks(15)) { + } else if ((Tank.useInletTempSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(15))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(15), state.dataIPShortCut->cAlphaArgs(15)); + ErrorsFound = true; } if (NumNums > 22) { @@ -3313,14 +3219,14 @@ bool getWaterHeaterStratifiedInput(EnergyPlusData &state) state.dataIPShortCut->cAlphaArgs(1))); } - if (Tank.FlowRateSchedule > 0) { + if (Tank.flowRateSched != nullptr) { ShowWarningError(state, format("{} = {}: Use side nodes are specified; Use Flow Rate Fraction Schedule will not be used", state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); } - if (Tank.UseInletTempSchedule > 0) { + if (Tank.useInletTempSched != nullptr) { ShowWarningError(state, format("{} = {}: Use side nodes are specified; Cold Water Supply Temperature Schedule will not be used", state.dataIPShortCut->cCurrentModuleObject, @@ -3401,17 +3307,10 @@ bool getWaterHeaterStratifiedInput(EnergyPlusData &state) Tank.SourceSideControlMode = SourceSideControl::IndirectHeatPrimarySetpoint; } - if (!state.dataIPShortCut->lAlphaFieldBlanks(22)) { - Tank.SourceSideAltSetpointSchedNum = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(22)); - if (Tank.SourceSideAltSetpointSchedNum == 0) { - ShowSevereError(state, - format("{} = {}: {} not found = {}", - state.dataIPShortCut->cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(22), - state.dataIPShortCut->cAlphaArgs(22))); - ErrorsFound = true; - } + if (state.dataIPShortCut->lAlphaFieldBlanks(22)) { + } else if ((Tank.sourceSideAltSetpointSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(22))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(22), state.dataIPShortCut->cAlphaArgs(22)); + ErrorsFound = true; } } @@ -3420,6 +3319,7 @@ bool getWaterHeaterStratifiedInput(EnergyPlusData &state) bool getWaterTankMixedInput(EnergyPlusData &state) { + static constexpr std::string_view routineName = "getWaterTankMixedInput"; bool ErrorsFound = false; state.dataIPShortCut->cCurrentModuleObject = cMixedCWTankModuleObj; // 'ThermalStorage:ChilledWater:Mixed' @@ -3443,6 +3343,9 @@ bool getWaterTankMixedInput(EnergyPlusData &state) state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + GlobalNames::VerifyUniqueInterObjectName(state, state.dataWaterThermalTanks->UniqueWaterThermalTankNames, state.dataIPShortCut->cAlphaArgs(1), @@ -3455,7 +3358,12 @@ bool getWaterTankMixedInput(EnergyPlusData &state) Tank.Name = state.dataIPShortCut->cAlphaArgs(1); Tank.Type = state.dataIPShortCut->cCurrentModuleObject; Tank.WaterThermalTankType = DataPlant::PlantEquipmentType::ChilledWaterTankMixed; - Tank.FluidIndex = Tank.waterIndex; + + if ((Tank.water = Fluid::GetWater(state)) == nullptr) { + ShowSevereError(state, "Fluid Properties for WATER not found"); + ErrorsFound = true; + } + Tank.IsChilledWaterTank = true; Tank.EndUseSubcategoryName = "Chilled Water Storage"; @@ -3469,11 +3377,10 @@ bool getWaterTankMixedInput(EnergyPlusData &state) Tank.Volume = 0.000001; // = 1 cm3 } - Tank.SetPointTempSchedule = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); - if (Tank.SetPointTempSchedule == 0) { - ShowSevereError(state, format("Invalid, {} = {}", state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); - ShowContinueError(state, format("Entered in {}={}", state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - + if (state.dataIPShortCut->lAlphaFieldBlanks(2)) { + ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(2)); + } else if ((Tank.setptTempSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2)); ErrorsFound = true; } @@ -3516,17 +3423,14 @@ bool getWaterTankMixedInput(EnergyPlusData &state) switch (Tank.AmbientTempIndicator) { case WTTAmbientTemp::Schedule: { - Tank.AmbientTempSchedule = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(4)); - if (Tank.AmbientTempSchedule == 0) { - ShowSevereError(state, format("Invalid, {} = {}", state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4))); - ShowContinueError(state, - format("Entered in {} = {}", state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "Schedule was not found."); + if (state.dataIPShortCut->lAlphaFieldBlanks(4)) { + ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(4)); + } else if ((Tank.ambientTempSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(4))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4)); ErrorsFound = true; } + } break; - break; - } case WTTAmbientTemp::TempZone: { Tank.AmbientTempZone = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(5), state.dataHeatBal->Zone); if (Tank.AmbientTempZone == 0) { @@ -3585,12 +3489,12 @@ bool getWaterTankMixedInput(EnergyPlusData &state) Tank.OnCycLossFracToZone = 1.0; Tank.MassFlowRateMax = 0.0; - Tank.FlowRateSchedule = 0; - Tank.UseInletTempSchedule = 0; + Tank.flowRateSched = nullptr; + Tank.useInletTempSched = nullptr; // default to always on - Tank.SourceSideAvailSchedNum = ScheduleManager::ScheduleAlwaysOn; - Tank.UseSideAvailSchedNum = ScheduleManager::ScheduleAlwaysOn; + Tank.sourceSideAvailSched = Sched::GetScheduleAlwaysOn(state); + Tank.useSideAvailSched = Sched::GetScheduleAlwaysOn(state); if ((state.dataIPShortCut->rNumericArgs(6) > 1) || (state.dataIPShortCut->rNumericArgs(6) < 0)) { ShowSevereError(state, @@ -3622,16 +3526,10 @@ bool getWaterTankMixedInput(EnergyPlusData &state) Tank.UseSidePlantLoc.loopSideNum = DataPlant::LoopSideLocation::Invalid; if (state.dataIPShortCut->lAlphaFieldBlanks(9)) { - Tank.UseSideAvailSchedNum = ScheduleManager::ScheduleAlwaysOn; - } else { - Tank.UseSideAvailSchedNum = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(9)); - if (Tank.UseSideAvailSchedNum == 0) { - ShowSevereError(state, format("Invalid, {} = {}", state.dataIPShortCut->cAlphaFieldNames(9), state.dataIPShortCut->cAlphaArgs(9))); - ShowContinueError(state, - format("Entered in {} = {}", state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "Schedule was not found."); - ErrorsFound = true; - } + Tank.useSideAvailSched = Sched::GetScheduleAlwaysOn(state); + } else if ((Tank.useSideAvailSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(9))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(9), state.dataIPShortCut->cAlphaArgs(9)); + ErrorsFound = true; } Tank.SrcSidePlantLoc.loopSideNum = DataPlant::LoopSideLocation::Invalid; @@ -3646,17 +3544,12 @@ bool getWaterTankMixedInput(EnergyPlusData &state) } if (state.dataIPShortCut->lAlphaFieldBlanks(12)) { - Tank.SourceSideAvailSchedNum = ScheduleManager::ScheduleAlwaysOn; - } else { - Tank.SourceSideAvailSchedNum = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(12)); - if (Tank.SourceSideAvailSchedNum == 0) { - ShowSevereError(state, format("Invalid, {} = {}", state.dataIPShortCut->cAlphaFieldNames(12), state.dataIPShortCut->cAlphaArgs(12))); - ShowContinueError(state, - format("Entered in {} = {}", state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "Schedule was not found."); - ErrorsFound = true; - } + Tank.sourceSideAvailSched = Sched::GetScheduleAlwaysOn(state); + } else if ((Tank.sourceSideAvailSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(12))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(12), state.dataIPShortCut->cAlphaArgs(12)); + ErrorsFound = true; } + if (state.dataIPShortCut->lNumericFieldBlanks(10)) { Tank.SizingRecoveryTime = 4.0; } else { @@ -3721,7 +3614,7 @@ bool getWaterTankMixedInput(EnergyPlusData &state) bool getWaterTankStratifiedInput(EnergyPlusData &state) { bool ErrorsFound = false; - static constexpr std::string_view RoutineName = "getWaterTankStratifiedInput"; + static constexpr std::string_view routineName = "getWaterTankStratifiedInput"; state.dataIPShortCut->cCurrentModuleObject = cStratifiedCWTankModuleObj; // 'ThermalStorage:ChilledWater:Stratified' @@ -3747,6 +3640,9 @@ bool getWaterTankStratifiedInput(EnergyPlusData &state) state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + GlobalNames::VerifyUniqueInterObjectName(state, state.dataWaterThermalTanks->UniqueWaterThermalTankNames, state.dataIPShortCut->cAlphaArgs(1), @@ -3759,7 +3655,12 @@ bool getWaterTankStratifiedInput(EnergyPlusData &state) Tank.Name = state.dataIPShortCut->cAlphaArgs(1); Tank.Type = state.dataIPShortCut->cCurrentModuleObject; Tank.WaterThermalTankType = DataPlant::PlantEquipmentType::ChilledWaterTankStratified; - Tank.FluidIndex = Tank.waterIndex; + + if ((Tank.water = Fluid::GetWater(state)) == nullptr) { + ShowSevereError(state, "Fluid properties for WATER not found"); + ErrorsFound = true; + } + Tank.IsChilledWaterTank = true; Tank.EndUseSubcategoryName = "Chilled Water Storage"; @@ -3767,7 +3668,9 @@ bool getWaterTankStratifiedInput(EnergyPlusData &state) if (Tank.Volume == DataSizing::AutoSize) { Tank.VolumeWasAutoSized = true; } - Real64 rho = FluidProperties::GetDensityGlycol(state, fluidNameWater, Constant::InitConvTemp, Tank.FluidIndex, RoutineName); + + Real64 rho = Tank.water->getDensity(state, Constant::InitConvTemp, routineName); + Tank.Mass = Tank.Volume * rho; Tank.Height = state.dataIPShortCut->rNumericArgs(2); if (Tank.Height == DataSizing::AutoSize) { @@ -3811,11 +3714,11 @@ bool getWaterTankStratifiedInput(EnergyPlusData &state) Tank.TankTempLimit = 1.0; } - Tank.SetPointTempSchedule = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(3)); - if (Tank.SetPointTempSchedule == 0) { - ShowSevereError(state, format("Invalid, {} = {}", state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3))); - ShowContinueError(state, format("Entered in {} = {}", state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "Schedule was not found."); + if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3)); + ErrorsFound = true; + } else if ((Tank.setptTempSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3)); ErrorsFound = true; } @@ -3833,7 +3736,7 @@ bool getWaterTankStratifiedInput(EnergyPlusData &state) } Tank.Efficiency = 1.0; - Tank.SetPointTempSchedule2 = 0; + Tank.setptTemp2Sched = nullptr; Tank.MaxCapacity2 = 0.0; Tank.HeaterHeight2 = 0.0; Tank.FuelType = Constant::eFuel::Electricity; @@ -3852,17 +3755,15 @@ bool getWaterTankStratifiedInput(EnergyPlusData &state) switch (Tank.AmbientTempIndicator) { case WTTAmbientTemp::Schedule: { - Tank.AmbientTempSchedule = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(5)); - if (Tank.AmbientTempSchedule == 0) { - ShowSevereError(state, format("Invalid, {} = {}", state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5))); - ShowContinueError(state, - format("Entered in {} = {}", state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "Schedule was not found."); + if (state.dataIPShortCut->lAlphaFieldBlanks(5)) { + ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(5)); + ErrorsFound = true; + } else if ((Tank.ambientTempSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(5))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5)); ErrorsFound = true; } + } break; - break; - } case WTTAmbientTemp::TempZone: { Tank.AmbientTempZone = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(6), state.dataHeatBal->Zone); if (Tank.AmbientTempZone == 0) { @@ -3922,14 +3823,14 @@ bool getWaterTankStratifiedInput(EnergyPlusData &state) Tank.OffCycFlueLossFracToZone = 0.0; Tank.MassFlowRateMax = 0.0; - Tank.FlowRateSchedule = 0; - Tank.UseInletTempSchedule = 0; + Tank.flowRateSched = nullptr; + Tank.useInletTempSched = nullptr; Tank.UseEffectiveness = state.dataIPShortCut->rNumericArgs(9); Tank.UseInletHeight = state.dataIPShortCut->rNumericArgs(10); // default to always on - Tank.SourceSideAvailSchedNum = ScheduleManager::ScheduleAlwaysOn; - Tank.UseSideAvailSchedNum = ScheduleManager::ScheduleAlwaysOn; + Tank.sourceSideAvailSched = Sched::GetScheduleAlwaysOn(state); + Tank.useSideAvailSched = Sched::GetScheduleAlwaysOn(state); if (state.dataIPShortCut->rNumericArgs(10) == Constant::AutoCalculate) { Tank.UseInletHeight = Tank.Height; // top of tank @@ -4062,16 +3963,10 @@ bool getWaterTankStratifiedInput(EnergyPlusData &state) } if (state.dataIPShortCut->lAlphaFieldBlanks(10)) { - Tank.UseSideAvailSchedNum = ScheduleManager::ScheduleAlwaysOn; - } else { - Tank.UseSideAvailSchedNum = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(10)); - if (Tank.UseSideAvailSchedNum == 0) { - ShowSevereError(state, format("Invalid, {} = {}", state.dataIPShortCut->cAlphaFieldNames(10), state.dataIPShortCut->cAlphaArgs(10))); - ShowContinueError(state, - format("Entered in {} = {}", state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "Schedule was not found."); - ErrorsFound = true; - } + Tank.useSideAvailSched = Sched::GetScheduleAlwaysOn(state); + } else if ((Tank.useSideAvailSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(10))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(10), state.dataIPShortCut->cAlphaArgs(10)); + ErrorsFound = true; } if (Tank.UseSidePlantLoc.loopSideNum == DataPlant::LoopSideLocation::Demand && Tank.SourceInletNode != 0) { @@ -4079,16 +3974,10 @@ bool getWaterTankStratifiedInput(EnergyPlusData &state) } if (state.dataIPShortCut->lAlphaFieldBlanks(13)) { - Tank.SourceSideAvailSchedNum = ScheduleManager::ScheduleAlwaysOn; - } else { - Tank.SourceSideAvailSchedNum = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(13)); - if (Tank.SourceSideAvailSchedNum == 0) { - ShowSevereError(state, format("Invalid, {} = {}", state.dataIPShortCut->cAlphaFieldNames(13), state.dataIPShortCut->cAlphaArgs(13))); - ShowContinueError(state, - format("Entered in {} = {}", state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1))); - ShowContinueError(state, "Schedule was not found."); - ErrorsFound = true; - } + Tank.sourceSideAvailSched = Sched::GetScheduleAlwaysOn(state); + } else if ((Tank.sourceSideAvailSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(13))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(13), state.dataIPShortCut->cAlphaArgs(13)); + ErrorsFound = true; } // Validate inlet mode @@ -5801,13 +5690,9 @@ void WaterThermalTankData::SetupStratifiedNodes(EnergyPlusData &state) this->Node.allocate(NumNodes); Real64 rho; if ((this->UseSidePlantLoc.loopNum > 0) && allocated(state.dataPlnt->PlantLoop)) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); } else { - rho = FluidProperties::GetDensityGlycol(state, fluidNameWater, Constant::InitConvTemp, this->FluidIndex, RoutineName); + rho = this->water->getDensity(state, Constant::InitConvTemp, RoutineName); } Real64 NodeMass = this->Volume * rho / NumNodes; @@ -6059,11 +5944,8 @@ void WaterThermalTankData::initialize(EnergyPlusData &state, bool const FirstHVA if (this->SetLoopIndexFlag && allocated(state.dataPlnt->PlantLoop)) { if ((this->UseInletNode > 0) && (this->HeatPumpNum == 0)) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidIndex, - GetWaterThermalTankInput); + Real64 rho = + state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, GetWaterThermalTankInput); this->PlantUseMassFlowRateMax = this->UseDesignVolFlowRate * rho; this->Mass = this->Volume * rho; this->UseSidePlantSizNum = state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).PlantSizNum; @@ -6074,11 +5956,8 @@ void WaterThermalTankData::initialize(EnergyPlusData &state, bool const FirstHVA } } if ((this->UseInletNode > 0) && (this->HeatPumpNum > 0)) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidIndex, - GetWaterThermalTankInput); + Real64 rho = + state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, GetWaterThermalTankInput); this->PlantUseMassFlowRateMax = this->UseDesignVolFlowRate * rho; this->Mass = this->Volume * rho; this->UseSidePlantSizNum = state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).PlantSizNum; @@ -6089,11 +5968,8 @@ void WaterThermalTankData::initialize(EnergyPlusData &state, bool const FirstHVA } } if ((this->SourceInletNode > 0) && (this->DesuperheaterNum == 0) && (this->HeatPumpNum == 0)) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->SrcSidePlantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->SrcSidePlantLoc.loopNum).FluidIndex, - GetWaterThermalTankInput); + Real64 rho = + state.dataPlnt->PlantLoop(this->SrcSidePlantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, GetWaterThermalTankInput); this->PlantSourceMassFlowRateMax = this->SourceDesignVolFlowRate * rho; this->SourceSidePlantSizNum = state.dataPlnt->PlantLoop(this->SrcSidePlantLoc.loopNum).PlantSizNum; if ((this->SourceDesignVolFlowRateWasAutoSized) && (this->SourceSidePlantSizNum == 0)) { @@ -6154,11 +6030,8 @@ void WaterThermalTankData::initialize(EnergyPlusData &state, bool const FirstHVA // Clear node initial conditions if (this->UseInletNode > 0 && this->UseOutletNode > 0) { state.dataLoopNodes->Node(this->UseInletNode).Temp = 0.0; - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidIndex, - GetWaterThermalTankInput); + Real64 rho = + state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, GetWaterThermalTankInput); this->MassFlowRateMin = this->VolFlowRateMin * rho; this->PlantUseMassFlowRateMax = this->UseDesignVolFlowRate * rho; PlantUtilities::InitComponentNodes(state, this->MassFlowRateMin, this->PlantUseMassFlowRateMax, this->UseInletNode, this->UseOutletNode); @@ -6171,11 +6044,8 @@ void WaterThermalTankData::initialize(EnergyPlusData &state, bool const FirstHVA } if ((this->SourceInletNode > 0) && (this->DesuperheaterNum == 0) && (this->HeatPumpNum == 0)) { - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->SrcSidePlantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->SrcSidePlantLoc.loopNum).FluidIndex, - GetWaterThermalTankInput); + Real64 rho = + state.dataPlnt->PlantLoop(this->SrcSidePlantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, GetWaterThermalTankInput); this->PlantSourceMassFlowRateMax = this->SourceDesignVolFlowRate * rho; PlantUtilities::InitComponentNodes(state, 0.0, this->PlantSourceMassFlowRateMax, this->SourceInletNode, this->SourceOutletNode); @@ -6191,27 +6061,27 @@ void WaterThermalTankData::initialize(EnergyPlusData &state, bool const FirstHVA this->SourceOutletTemp = 0.0; this->SourceMassFlowRate = 0.0; this->SavedSourceOutletTemp = 0.0; - Real64 rho = FluidProperties::GetDensityGlycol(state, fluidNameWater, Constant::InitConvTemp, this->FluidIndex, SizeTankForDemand); + Real64 rho = this->water->getDensity(state, Constant::InitConvTemp, SizeTankForDemand); this->PlantSourceMassFlowRateMax = this->SourceDesignVolFlowRate * rho; } // Initialize tank temperature to setpoint of first hour of warm up period // (use HPWH or Desuperheater heating coil set point if applicable) - int SchIndex; + Sched::Schedule *sched = nullptr; if (this->HeatPumpNum > 0) { state.dataWaterThermalTanks->HPWaterHeater(this->HeatPumpNum).Mode = TankOperatingMode::Floating; state.dataWaterThermalTanks->HPWaterHeater(this->HeatPumpNum).SaveMode = TankOperatingMode::Floating; state.dataWaterThermalTanks->HPWaterHeater(this->HeatPumpNum).SaveWHMode = TankOperatingMode::Floating; - SchIndex = state.dataWaterThermalTanks->HPWaterHeater(this->HeatPumpNum).SetPointTempSchedule; + sched = state.dataWaterThermalTanks->HPWaterHeater(this->HeatPumpNum).setptTempSched; } else if (this->DesuperheaterNum > 0) { state.dataWaterThermalTanks->WaterHeaterDesuperheater(this->DesuperheaterNum).Mode = TankOperatingMode::Floating; - SchIndex = state.dataWaterThermalTanks->WaterHeaterDesuperheater(this->DesuperheaterNum).SetPointTempSchedule; + sched = state.dataWaterThermalTanks->WaterHeaterDesuperheater(this->DesuperheaterNum).setptTempSched; } else { - SchIndex = this->SetPointTempSchedule; + sched = this->setptTempSched; } - if (SchIndex > 0) { - this->TankTemp = ScheduleManager::GetCurrentScheduleValue(state, SchIndex); + if (sched != nullptr) { + this->TankTemp = sched->getCurrentVal(); this->SavedTankTemp = this->TankTemp; if (this->Nodes > 0) { @@ -6267,19 +6137,19 @@ void WaterThermalTankData::initialize(EnergyPlusData &state, bool const FirstHVA // reInitialize tank temperature to setpoint of first hour (use HPWH or Desuperheater heating coil set point if applicable) // BG's interpretation here is that its better to reset initial condition to setpoint once warm up is over. // (otherwise with a dynamic storage model it is difficult for the user to see the initial performance if it isn't periodic.) - int SchIndex; + Sched::Schedule *sched = nullptr; if (this->HeatPumpNum > 0) { state.dataWaterThermalTanks->HPWaterHeater(this->HeatPumpNum).Mode = TankOperatingMode::Floating; - SchIndex = state.dataWaterThermalTanks->HPWaterHeater(this->HeatPumpNum).SetPointTempSchedule; + sched = state.dataWaterThermalTanks->HPWaterHeater(this->HeatPumpNum).setptTempSched; } else if (this->DesuperheaterNum > 0) { state.dataWaterThermalTanks->WaterHeaterDesuperheater(this->DesuperheaterNum).Mode = TankOperatingMode::Floating; - SchIndex = state.dataWaterThermalTanks->WaterHeaterDesuperheater(this->DesuperheaterNum).SetPointTempSchedule; + sched = state.dataWaterThermalTanks->WaterHeaterDesuperheater(this->DesuperheaterNum).setptTempSched; } else { - SchIndex = this->SetPointTempSchedule; + sched = this->setptTempSched; } - if (SchIndex > 0) { - this->TankTemp = ScheduleManager::GetCurrentScheduleValue(state, SchIndex); + if (sched != nullptr) { + this->TankTemp = sched->getCurrentVal(); this->SavedTankTemp = this->TankTemp; if (this->Nodes > 0) { @@ -6311,8 +6181,7 @@ void WaterThermalTankData::initialize(EnergyPlusData &state, bool const FirstHVA if (FirstHVACIteration) { // Get all scheduled values - int SchIndex = this->SetPointTempSchedule; - this->SetPointTemp = ScheduleManager::GetCurrentScheduleValue(state, SchIndex); + this->SetPointTemp = this->setptTempSched->getCurrentVal(); if (!this->IsChilledWaterTank) { if (this->SetPointTemp > this->TankTempLimit) { @@ -6350,18 +6219,15 @@ void WaterThermalTankData::initialize(EnergyPlusData &state, bool const FirstHVA } } - SchIndex = this->SetPointTempSchedule2; - if (SchIndex > 0) { - this->SetPointTemp2 = ScheduleManager::GetCurrentScheduleValue(state, SchIndex); + if (this->setptTemp2Sched != nullptr) { + this->SetPointTemp2 = this->setptTemp2Sched->getCurrentVal(); } switch (this->AmbientTempIndicator) { case WTTAmbientTemp::Schedule: { - SchIndex = this->AmbientTempSchedule; - this->AmbientTemp = ScheduleManager::GetCurrentScheduleValue(state, SchIndex); + this->AmbientTemp = this->ambientTempSched->getCurrentVal(); + } break; - break; - } case WTTAmbientTemp::TempZone: { this->AmbientTemp = state.dataZoneTempPredictorCorrector->zoneHeatBalance(this->AmbientTempZone).MAT; @@ -6377,27 +6243,16 @@ void WaterThermalTankData::initialize(EnergyPlusData &state, bool const FirstHVA if (this->UseInletNode == 0) { // Stand-alone operation - SchIndex = this->UseInletTempSchedule; - if (SchIndex > 0) { - this->UseInletTemp = ScheduleManager::GetCurrentScheduleValue(state, SchIndex); - } else { - this->UseInletTemp = state.dataEnvrn->WaterMainsTemp; - } - - SchIndex = this->FlowRateSchedule; - if (SchIndex > 0) { - this->UseMassFlowRate = ScheduleManager::GetCurrentScheduleValue(state, SchIndex) * this->MassFlowRateMax; + this->UseInletTemp = (this->useInletTempSched != nullptr) ? this->useInletTempSched->getCurrentVal() : state.dataEnvrn->WaterMainsTemp; - this->VolFlowRate = this->UseMassFlowRate / Psychrometrics::RhoH2O(Constant::InitConvTemp); - } else { - this->UseMassFlowRate = this->MassFlowRateMax; - this->VolFlowRate = this->UseMassFlowRate / Psychrometrics::RhoH2O(Constant::InitConvTemp); - } + this->UseMassFlowRate = this->MassFlowRateMax; + if (this->flowRateSched != nullptr) this->UseMassFlowRate *= this->flowRateSched->getCurrentVal(); + this->VolFlowRate = this->UseMassFlowRate / Psychrometrics::RhoH2O(Constant::InitConvTemp); } if (this->HeatPumpNum > 0) { state.dataWaterThermalTanks->HPWaterHeater(this->HeatPumpNum).SetPointTemp = - ScheduleManager::GetCurrentScheduleValue(state, state.dataWaterThermalTanks->HPWaterHeater(this->HeatPumpNum).SetPointTempSchedule); + state.dataWaterThermalTanks->HPWaterHeater(this->HeatPumpNum).setptTempSched->getCurrentVal(); if (state.dataWaterThermalTanks->HPWaterHeater(this->HeatPumpNum).SetPointTemp >= this->TankTempLimit) { // HP setpoint temperature scheduled equal to or higher than tank temperature limit state.dataWaterThermalTanks->HPWaterHeater(this->HeatPumpNum).SetPointTemp = this->TankTempLimit - 1.0; @@ -6417,8 +6272,8 @@ void WaterThermalTankData::initialize(EnergyPlusData &state, bool const FirstHVA } if (this->DesuperheaterNum > 0) { - state.dataWaterThermalTanks->WaterHeaterDesuperheater(this->DesuperheaterNum).SetPointTemp = ScheduleManager::GetCurrentScheduleValue( - state, state.dataWaterThermalTanks->WaterHeaterDesuperheater(this->DesuperheaterNum).SetPointTempSchedule); + state.dataWaterThermalTanks->WaterHeaterDesuperheater(this->DesuperheaterNum).SetPointTemp = + state.dataWaterThermalTanks->WaterHeaterDesuperheater(this->DesuperheaterNum).setptTempSched->getCurrentVal(); } } // first HVAC Iteration @@ -6539,8 +6394,7 @@ void WaterThermalTankData::initialize(EnergyPlusData &state, bool const FirstHVA break; } case CrankcaseHeaterControlTemp::Schedule: { - state.dataHVACGlobal->HPWHCrankcaseDBTemp = - ScheduleManager::GetCurrentScheduleValue(state, state.dataWaterThermalTanks->HPWaterHeater(HPNum).CrankcaseTempSchedule); + state.dataHVACGlobal->HPWHCrankcaseDBTemp = state.dataWaterThermalTanks->HPWaterHeater(HPNum).crankcaseTempSched->getCurrentVal(); break; } default: @@ -6566,10 +6420,10 @@ void WaterThermalTankData::initialize(EnergyPlusData &state, bool const FirstHVA break; } case WTTAmbientTemp::ZoneAndOA: { - if (state.dataWaterThermalTanks->HPWaterHeater(HPNum).InletAirMixerSchPtr > 0) { + if (state.dataWaterThermalTanks->HPWaterHeater(HPNum).inletAirMixerSched != nullptr) { // schedule values are checked for boundary of 0 and 1 in GetWaterThermalTankInputFlag state.dataWaterThermalTanks->mixerInletAirSchedule = - ScheduleManager::GetCurrentScheduleValue(state, state.dataWaterThermalTanks->HPWaterHeater(HPNum).InletAirMixerSchPtr); + state.dataWaterThermalTanks->HPWaterHeater(HPNum).inletAirMixerSched->getCurrentVal(); } else { state.dataWaterThermalTanks->mixerInletAirSchedule = 0.0; } @@ -6587,9 +6441,8 @@ void WaterThermalTankData::initialize(EnergyPlusData &state, bool const FirstHVA break; } case WTTAmbientTemp::Schedule: { - HPInletDryBulbTemp = - ScheduleManager::GetCurrentScheduleValue(state, state.dataWaterThermalTanks->HPWaterHeater(HPNum).AmbientTempSchedule); - HPInletRelHum = ScheduleManager::GetCurrentScheduleValue(state, state.dataWaterThermalTanks->HPWaterHeater(HPNum).AmbientRHSchedule); + HPInletDryBulbTemp = state.dataWaterThermalTanks->HPWaterHeater(HPNum).ambientTempSched->getCurrentVal(); + HPInletRelHum = state.dataWaterThermalTanks->HPWaterHeater(HPNum).ambientRHSched->getCurrentVal(); HPInletHumRat = Psychrometrics::PsyWFnTdbRhPb(state, HPInletDryBulbTemp, HPInletRelHum, state.dataEnvrn->OutBaroPress, RoutineName); state.dataLoopNodes->Node(HPAirInletNode).Temp = HPInletDryBulbTemp; state.dataLoopNodes->Node(HPAirInletNode).HumRat = HPInletHumRat; @@ -6836,26 +6689,18 @@ void WaterThermalTankData::CalcWaterThermalTankMixed(EnergyPlusData &state) // W Real64 rho; if (this->UseSidePlantLoc.loopNum > 0) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidName, - TankTemp_loc, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).glycol->getDensity(state, TankTemp_loc, RoutineName); } else { - rho = FluidProperties::GetDensityGlycol(state, fluidNameWater, TankTemp_loc, this->waterIndex, RoutineName); + rho = this->water->getDensity(state, TankTemp_loc, RoutineName); } Real64 TankMass = rho * this->Volume; Real64 Cp; if (this->UseSidePlantLoc.loopNum > 0) { - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidName, - TankTemp_loc, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidIndex, - RoutineName); + Cp = state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).glycol->getSpecificHeat(state, TankTemp_loc, RoutineName); } else { - Cp = FluidProperties::GetSpecificHeatGlycol(state, fluidNameWater, TankTemp_loc, this->waterIndex, RoutineName); + Cp = this->water->getSpecificHeat(state, TankTemp_loc, RoutineName); } Real64 SecInTimeStep = state.dataHVACGlobal->TimeStepSysSec; @@ -7737,13 +7582,9 @@ void WaterThermalTankData::CalcWaterThermalTankStratified(EnergyPlusData &state) // Specific Heat of water (J/kg K) const Real64 Cp = [&] { if (this->UseSidePlantLoc.loopNum > 0) { - return FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidName, - this->TankTemp, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidIndex, - RoutineName); + return state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).glycol->getSpecificHeat(state, this->TankTemp, RoutineName); } else { - return FluidProperties::GetSpecificHeatGlycol(state, fluidNameWater, this->TankTemp, this->waterIndex, RoutineName); + return this->water->getSpecificHeat(state, this->TankTemp, RoutineName); } }(); @@ -7919,7 +7760,7 @@ void WaterThermalTankData::CalcWaterThermalTankStratified(EnergyPlusData &state) // Remove off cycle loads // Apply on cycle loads for (int i = 0; i < nTankNodes; i++) { - auto &node = this->Node[i]; + auto const &node = this->Node[i]; Real64 NodeCapacitance = node.Mass * Cp; A[i] += (node.OffCycLossCoeff - node.OnCycLossCoeff) / NodeCapacitance; B[i] += (-node.OffCycParaLoad + node.OnCycParaLoad + (node.OnCycLossCoeff - node.OffCycLossCoeff) * this->AmbientTemp) / @@ -7929,7 +7770,7 @@ void WaterThermalTankData::CalcWaterThermalTankStratified(EnergyPlusData &state) // Remove on cycle loads // Apply off cycle loads for (int i = 0; i < nTankNodes; i++) { - auto &node = this->Node[i]; + auto const &node = this->Node[i]; Real64 NodeCapacitance = node.Mass * Cp; A[i] -= (node.OffCycLossCoeff - node.OnCycLossCoeff) / NodeCapacitance; B[i] -= (-node.OffCycParaLoad + node.OnCycParaLoad + (node.OnCycLossCoeff - node.OffCycLossCoeff) * this->AmbientTemp) / @@ -8501,7 +8342,7 @@ void WaterThermalTankData::CalcDesuperheaterWaterHeater(EnergyPlusData &state, b DesupHtr.PumpEnergy = 0.0; // simulate only the water heater tank if the desuperheater coil is scheduled off - Real64 AvailSchedule = ScheduleManager::GetCurrentScheduleValue(state, DesupHtr.AvailSchedPtr); + Real64 AvailSchedule = DesupHtr.availSched->getCurrentVal(); if (AvailSchedule == 0.0) { DesupHtr.Mode = TankOperatingMode::Floating; this->CalcWaterThermalTank(state); @@ -8607,9 +8448,9 @@ void WaterThermalTankData::CalcDesuperheaterWaterHeater(EnergyPlusData &state, b DesupHtr.DXSysPLR = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(SourceID).PartLoadRatio; } else if (DesupHtr.ReclaimHeatingSource == ReclaimHeatObjectType::CoilCoolingDX) { AverageWasteHeat = - state.dataCoilCooingDX->coilCoolingDXs[DesupHtr.ReclaimHeatingSourceIndexNum].reclaimHeat.AvailCapacity - - state.dataCoilCooingDX->coilCoolingDXs[DesupHtr.ReclaimHeatingSourceIndexNum].reclaimHeat.HVACDesuperheaterReclaimedHeatTotal; - DesupHtr.DXSysPLR = state.dataCoilCooingDX->coilCoolingDXs[DesupHtr.ReclaimHeatingSourceIndexNum].partLoadRatioReport; + state.dataCoilCoolingDX->coilCoolingDXs[DesupHtr.ReclaimHeatingSourceIndexNum].reclaimHeat.AvailCapacity - + state.dataCoilCoolingDX->coilCoolingDXs[DesupHtr.ReclaimHeatingSourceIndexNum].reclaimHeat.HVACDesuperheaterReclaimedHeatTotal; + DesupHtr.DXSysPLR = state.dataCoilCoolingDX->coilCoolingDXs[DesupHtr.ReclaimHeatingSourceIndexNum].partLoadRatioReport; } } else { AverageWasteHeat = 0.0; @@ -8924,38 +8765,38 @@ void WaterThermalTankData::CalcDesuperheaterWaterHeater(EnergyPlusData &state, b if (DesupHtr.ReclaimHeatingSource == ReclaimHeatObjectType::CompressorRackRefrigeratedCase) { state.dataHeatBal->HeatReclaimRefrigeratedRack(SourceID).WaterHeatingDesuperheaterReclaimedHeat(DesuperheaterNum) = DesupHtr.HeaterRate; state.dataHeatBal->HeatReclaimRefrigeratedRack(SourceID).WaterHeatingDesuperheaterReclaimedHeatTotal = 0.0; - for (auto &num : state.dataHeatBal->HeatReclaimRefrigeratedRack(SourceID).WaterHeatingDesuperheaterReclaimedHeat) + for (auto const &num : state.dataHeatBal->HeatReclaimRefrigeratedRack(SourceID).WaterHeatingDesuperheaterReclaimedHeat) state.dataHeatBal->HeatReclaimRefrigeratedRack(SourceID).WaterHeatingDesuperheaterReclaimedHeatTotal += num; } else if (DesupHtr.ReclaimHeatingSource == ReclaimHeatObjectType::CondenserRefrigeration) { state.dataHeatBal->HeatReclaimRefrigCondenser(SourceID).WaterHeatingDesuperheaterReclaimedHeat(DesuperheaterNum) = DesupHtr.HeaterRate; state.dataHeatBal->HeatReclaimRefrigCondenser(SourceID).WaterHeatingDesuperheaterReclaimedHeatTotal = 0.0; - for (auto &num : state.dataHeatBal->HeatReclaimRefrigCondenser(SourceID).WaterHeatingDesuperheaterReclaimedHeat) + for (auto const &num : state.dataHeatBal->HeatReclaimRefrigCondenser(SourceID).WaterHeatingDesuperheaterReclaimedHeat) state.dataHeatBal->HeatReclaimRefrigCondenser(SourceID).WaterHeatingDesuperheaterReclaimedHeatTotal += num; } else if (DesupHtr.ReclaimHeatingSource == ReclaimHeatObjectType::DXCooling || DesupHtr.ReclaimHeatingSource == ReclaimHeatObjectType::DXMultiSpeed || DesupHtr.ReclaimHeatingSource == ReclaimHeatObjectType::DXMultiMode) { state.dataHeatBal->HeatReclaimDXCoil(SourceID).WaterHeatingDesuperheaterReclaimedHeat(DesuperheaterNum) = DesupHtr.HeaterRate; state.dataHeatBal->HeatReclaimDXCoil(SourceID).WaterHeatingDesuperheaterReclaimedHeatTotal = 0.0; - for (auto &num : state.dataHeatBal->HeatReclaimDXCoil(SourceID).WaterHeatingDesuperheaterReclaimedHeat) + for (auto const &num : state.dataHeatBal->HeatReclaimDXCoil(SourceID).WaterHeatingDesuperheaterReclaimedHeat) state.dataHeatBal->HeatReclaimDXCoil(SourceID).WaterHeatingDesuperheaterReclaimedHeatTotal += num; } else if (DesupHtr.ReclaimHeatingSource == ReclaimHeatObjectType::DXVariableCooling) { state.dataHeatBal->HeatReclaimVS_DXCoil(SourceID).WaterHeatingDesuperheaterReclaimedHeat(DesuperheaterNum) = DesupHtr.HeaterRate; state.dataHeatBal->HeatReclaimVS_DXCoil(SourceID).WaterHeatingDesuperheaterReclaimedHeatTotal = 0.0; - for (auto &num : state.dataHeatBal->HeatReclaimVS_DXCoil(SourceID).WaterHeatingDesuperheaterReclaimedHeat) + for (auto const &num : state.dataHeatBal->HeatReclaimVS_DXCoil(SourceID).WaterHeatingDesuperheaterReclaimedHeat) state.dataHeatBal->HeatReclaimVS_DXCoil(SourceID).WaterHeatingDesuperheaterReclaimedHeatTotal += num; } else if (DesupHtr.ReclaimHeatingSource == ReclaimHeatObjectType::AirWaterHeatPumpEQ) { state.dataHeatBal->HeatReclaimSimple_WAHPCoil(SourceID).WaterHeatingDesuperheaterReclaimedHeat(DesuperheaterNum) = DesupHtr.HeaterRate; state.dataHeatBal->HeatReclaimSimple_WAHPCoil(SourceID).WaterHeatingDesuperheaterReclaimedHeatTotal = 0.0; - for (auto &num : state.dataHeatBal->HeatReclaimSimple_WAHPCoil(SourceID).WaterHeatingDesuperheaterReclaimedHeat) + for (auto const &num : state.dataHeatBal->HeatReclaimSimple_WAHPCoil(SourceID).WaterHeatingDesuperheaterReclaimedHeat) state.dataHeatBal->HeatReclaimSimple_WAHPCoil(SourceID).WaterHeatingDesuperheaterReclaimedHeatTotal += num; } else if (DesupHtr.ReclaimHeatingSource == ReclaimHeatObjectType::CoilCoolingDX) { - state.dataCoilCooingDX->coilCoolingDXs[DesupHtr.ReclaimHeatingSourceIndexNum].reclaimHeat.WaterHeatingDesuperheaterReclaimedHeat( + state.dataCoilCoolingDX->coilCoolingDXs[DesupHtr.ReclaimHeatingSourceIndexNum].reclaimHeat.WaterHeatingDesuperheaterReclaimedHeat( DesuperheaterNum) = DesupHtr.HeaterRate; - state.dataCoilCooingDX->coilCoolingDXs[DesupHtr.ReclaimHeatingSourceIndexNum].reclaimHeat.WaterHeatingDesuperheaterReclaimedHeatTotal = + state.dataCoilCoolingDX->coilCoolingDXs[DesupHtr.ReclaimHeatingSourceIndexNum].reclaimHeat.WaterHeatingDesuperheaterReclaimedHeatTotal = 0.0; - for (auto &num : - state.dataCoilCooingDX->coilCoolingDXs[DesupHtr.ReclaimHeatingSourceIndexNum].reclaimHeat.WaterHeatingDesuperheaterReclaimedHeat) - state.dataCoilCooingDX->coilCoolingDXs[DesupHtr.ReclaimHeatingSourceIndexNum] + for (auto const &num : + state.dataCoilCoolingDX->coilCoolingDXs[DesupHtr.ReclaimHeatingSourceIndexNum].reclaimHeat.WaterHeatingDesuperheaterReclaimedHeat) + state.dataCoilCoolingDX->coilCoolingDXs[DesupHtr.ReclaimHeatingSourceIndexNum] .reclaimHeat.WaterHeatingDesuperheaterReclaimedHeatTotal += num; } } @@ -8988,7 +8829,7 @@ void WaterThermalTankData::CalcHeatPumpWaterHeater(EnergyPlusData &state, bool c HeatPumpWaterHeaterData &HeatPump = state.dataWaterThermalTanks->HPWaterHeater(this->HeatPumpNum); // initialize local variables - int AvailSchedule = ScheduleManager::GetCurrentScheduleValue(state, HeatPump.AvailSchedPtr); + int AvailSchedule = HeatPump.availSched->getCurrentVal(); int HPAirInletNode = HeatPump.HeatPumpAirInletNode; int HPAirOutletNode = HeatPump.HeatPumpAirOutletNode; int OutdoorAirNode = HeatPump.OutsideAirNode; @@ -10029,8 +9870,8 @@ void WaterThermalTankData::CalcHeatPumpWaterHeater(EnergyPlusData &state, bool c } // Check schedule to divert air-side cooling to outdoors. - if (HeatPump.OutletAirSplitterSchPtr > 0) { - Real64 OutletAirSplitterSch = ScheduleManager::GetCurrentScheduleValue(state, HeatPump.OutletAirSplitterSchPtr); + if (HeatPump.outletAirSplitterSched != nullptr) { + Real64 OutletAirSplitterSch = HeatPump.outletAirSplitterSched->getCurrentVal(); state.dataLoopNodes->Node(HPAirOutletNode).MassFlowRate = state.dataWaterThermalTanks->mdotAir * state.dataWaterThermalTanks->hpPartLoadRatio * (1.0 - OutletAirSplitterSch); state.dataLoopNodes->Node(ExhaustAirNode).MassFlowRate = @@ -10340,7 +10181,10 @@ Real64 WaterThermalTankData::PLRResidualHPWH( return desTankTemp - NewTankTemp; } -bool WaterThermalTankData::SourceHeatNeed(EnergyPlusData &state, Real64 const OutletTemp, Real64 const DeadBandTemp, Real64 const SetPointTemp_loc) +bool WaterThermalTankData::SourceHeatNeed([[maybe_unused]] EnergyPlusData &state, + Real64 const OutletTemp, + Real64 const DeadBandTemp, + Real64 const SetPointTemp_loc) { // FUNCTION INFORMATION: // AUTHOR Yueyue Zhou @@ -10371,7 +10215,7 @@ bool WaterThermalTankData::SourceHeatNeed(EnergyPlusData &state, Real64 const Ou } } else if (this->SourceSideControlMode == SourceSideControl::IndirectHeatAltSetpoint) { // get alternate setpoint - Real64 const AltSetpointTemp = ScheduleManager::GetCurrentScheduleValue(state, this->SourceSideAltSetpointSchedNum); + Real64 const AltSetpointTemp = this->sourceSideAltSetpointSched->getCurrentVal(); Real64 const AltDeadBandTemp = AltSetpointTemp - this->DeadBandDeltaTemp; if (OutletTemp < AltDeadBandTemp) { NeedsHeatOrCool = true; @@ -10481,11 +10325,11 @@ Real64 WaterThermalTankData::PlantMassFlowRatesFunc(EnergyPlusData &state, // evaluate Availability schedule, bool ScheduledAvail = true; if (WaterThermalTankSide == WaterHeaterSide::Use) { - if (ScheduleManager::GetCurrentScheduleValue(state, this->UseSideAvailSchedNum) == 0.0) { + if (this->useSideAvailSched->getCurrentVal() == 0.0) { ScheduledAvail = false; } } else if (WaterThermalTankSide == WaterHeaterSide::Source) { - if (ScheduleManager::GetCurrentScheduleValue(state, this->SourceSideAvailSchedNum) == 0.0) { + if (this->sourceSideAvailSched->getCurrentVal() == 0.0) { ScheduledAvail = false; } } @@ -10721,11 +10565,8 @@ void WaterThermalTankData::SizeSupplySidePlantConnections(EnergyPlusData &state, PlantUtilities::RegisterPlantCompDesignFlow(state, this->UseInletNode, tmpUseDesignVolFlowRate); } - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = + state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); if (state.dataPlnt->PlantFirstSizesOkayToFinalize) { this->PlantUseMassFlowRateMax = this->UseDesignVolFlowRate * rho; } else { @@ -10739,13 +10580,9 @@ void WaterThermalTankData::SizeSupplySidePlantConnections(EnergyPlusData &state, PlantUtilities::RegisterPlantCompDesignFlow(state, this->UseInletNode, this->UseDesignVolFlowRate); Real64 rho; if (this->UseSidePlantLoc.loopNum > 0) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); } else { - rho = FluidProperties::GetDensityGlycol(state, fluidNameWater, Constant::InitConvTemp, this->waterIndex, RoutineName); + rho = this->water->getDensity(state, Constant::InitConvTemp, RoutineName); } this->PlantUseMassFlowRateMax = this->UseDesignVolFlowRate * rho; @@ -10784,11 +10621,8 @@ void WaterThermalTankData::SizeSupplySidePlantConnections(EnergyPlusData &state, } else { PlantUtilities::RegisterPlantCompDesignFlow(state, this->SourceInletNode, tmpSourceDesignVolFlowRate); } - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->SrcSidePlantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->SrcSidePlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = + state.dataPlnt->PlantLoop(this->SrcSidePlantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); if (state.dataPlnt->PlantFirstSizesOkayToFinalize) { this->PlantSourceMassFlowRateMax = this->SourceDesignVolFlowRate * rho; } else { @@ -10803,13 +10637,9 @@ void WaterThermalTankData::SizeSupplySidePlantConnections(EnergyPlusData &state, PlantUtilities::RegisterPlantCompDesignFlow(state, this->SourceInletNode, this->SourceDesignVolFlowRate); Real64 rho; if (this->SrcSidePlantLoc.loopNum > 0) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->SrcSidePlantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->SrcSidePlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->SrcSidePlantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); } else { - rho = FluidProperties::GetDensityGlycol(state, fluidNameWater, Constant::InitConvTemp, this->waterIndex, RoutineName); + rho = this->water->getDensity(state, Constant::InitConvTemp, RoutineName); } this->PlantSourceMassFlowRateMax = this->SourceDesignVolFlowRate * rho; } @@ -11007,7 +10837,7 @@ void WaterThermalTankData::SizeTankForDemandSide(EnergyPlusData &state) // MJW TODO: this won't compile now: Real64 SumPeopleAllZones = sum(state.dataHeatBal->Zone, &DataHeatBalance::ZoneData::TotOccupants); Real64 SumPeopleAllZones = 0.0; - for (auto &thisZone : state.dataHeatBal->Zone) { + for (auto const &thisZone : state.dataHeatBal->Zone) { SumPeopleAllZones += thisZone.TotOccupants; } if (this->VolumeWasAutoSized) tmpTankVolume = this->Sizing.TankCapacityPerPerson * SumPeopleAllZones; @@ -11016,22 +10846,14 @@ void WaterThermalTankData::SizeTankForDemandSide(EnergyPlusData &state) Real64 rho; Real64 Cp; if (this->UseSidePlantLoc.loopNum > 0) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidName, - ((Tfinish + Tstart) / 2.0), - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidIndex, - RoutineName); - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidName, - ((Tfinish + Tstart) / 2.0), - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).glycol->getDensity(state, ((Tfinish + Tstart) / 2.0), RoutineName); + Cp = state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).glycol->getSpecificHeat(state, ((Tfinish + Tstart) / 2.0), RoutineName); } else { - rho = FluidProperties::GetDensityGlycol(state, fluidNameWater, ((Tfinish + Tstart) / 2.0), this->waterIndex, RoutineName); - Cp = FluidProperties::GetSpecificHeatGlycol(state, fluidNameWater, ((Tfinish + Tstart) / 2.0), this->waterIndex, RoutineName); + rho = this->water->getDensity(state, ((Tfinish + Tstart) / 2.0), RoutineName); + Cp = this->water->getSpecificHeat(state, ((Tfinish + Tstart) / 2.0), RoutineName); } - tmpMaxCapacity = SumPeopleAllZones * this->Sizing.RecoveryCapacityPerPerson * (Tfinish - Tstart) * (1.0 / Constant::SecInHour) * rho * + tmpMaxCapacity = SumPeopleAllZones * this->Sizing.RecoveryCapacityPerPerson * (Tfinish - Tstart) * (1.0 / Constant::rSecsInHour) * rho * Cp; // m3/hr/person | delta T in K | 1 hr/ 3600 s | kg/m3 | J/Kg/k } @@ -11059,7 +10881,7 @@ void WaterThermalTankData::SizeTankForDemandSide(EnergyPlusData &state) // MJW TODO: this won't compile now: Real64 SumFloorAreaAllZones = sum(state.dataHeatBal->Zone, &DataHeatBalance::ZoneData::FloorArea); Real64 SumFloorAreaAllZones = 0.0; - for (auto &thisZone : state.dataHeatBal->Zone) { + for (auto const &thisZone : state.dataHeatBal->Zone) { SumFloorAreaAllZones += thisZone.FloorArea; } if (this->VolumeWasAutoSized) tmpTankVolume = this->Sizing.TankCapacityPerArea * SumFloorAreaAllZones; @@ -11067,21 +10889,13 @@ void WaterThermalTankData::SizeTankForDemandSide(EnergyPlusData &state) Real64 rho; Real64 Cp; if (this->UseSidePlantLoc.loopNum > 0) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidName, - ((Tfinish + Tstart) / 2.0), - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidIndex, - RoutineName); - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidName, - ((Tfinish + Tstart) / 2.0), - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).glycol->getDensity(state, ((Tfinish + Tstart) / 2.0), RoutineName); + Cp = state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).glycol->getSpecificHeat(state, ((Tfinish + Tstart) / 2.0), RoutineName); } else { - rho = FluidProperties::GetDensityGlycol(state, fluidNameWater, ((Tfinish + Tstart) / 2.0), this->waterIndex, RoutineName); - Cp = FluidProperties::GetSpecificHeatGlycol(state, fluidNameWater, ((Tfinish + Tstart) / 2.0), this->waterIndex, RoutineName); + rho = this->water->getDensity(state, ((Tfinish + Tstart) / 2.0), RoutineName); + Cp = this->water->getSpecificHeat(state, ((Tfinish + Tstart) / 2.0), RoutineName); } - tmpMaxCapacity = SumFloorAreaAllZones * this->Sizing.RecoveryCapacityPerArea * (Tfinish - Tstart) * (1.0 / Constant::SecInHour) * rho * + tmpMaxCapacity = SumFloorAreaAllZones * this->Sizing.RecoveryCapacityPerArea * (Tfinish - Tstart) * (1.0 / Constant::rSecsInHour) * rho * Cp; // m2 | m3/hr/m2 | delta T in K | 1 hr/ 3600 s | kg/m3 | J/Kg/k } if (this->VolumeWasAutoSized && state.dataPlnt->PlantFirstSizesOkayToFinalize) { @@ -11112,21 +10926,13 @@ void WaterThermalTankData::SizeTankForDemandSide(EnergyPlusData &state) Real64 rho; Real64 Cp; if (this->UseSidePlantLoc.loopNum > 0) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidName, - ((Tfinish + Tstart) / 2.0), - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidIndex, - RoutineName); - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidName, - ((Tfinish + Tstart) / 2.0), - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).glycol->getDensity(state, ((Tfinish + Tstart) / 2.0), RoutineName); + Cp = state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).glycol->getSpecificHeat(state, ((Tfinish + Tstart) / 2.0), RoutineName); } else { - rho = FluidProperties::GetDensityGlycol(state, fluidNameWater, ((Tfinish + Tstart) / 2.0), this->waterIndex, RoutineName); - Cp = FluidProperties::GetSpecificHeatGlycol(state, fluidNameWater, ((Tfinish + Tstart) / 2.0), this->waterIndex, RoutineName); + rho = this->water->getDensity(state, ((Tfinish + Tstart) / 2.0), RoutineName); + Cp = this->water->getSpecificHeat(state, ((Tfinish + Tstart) / 2.0), RoutineName); } - tmpMaxCapacity = this->Sizing.NumberOfUnits * this->Sizing.RecoveryCapacityPerUnit * (Tfinish - Tstart) * (1.0 / Constant::SecInHour) * + tmpMaxCapacity = this->Sizing.NumberOfUnits * this->Sizing.RecoveryCapacityPerUnit * (Tfinish - Tstart) * (1.0 / Constant::rSecsInHour) * rho * Cp; // m3/hr/ea | delta T in K | 1 hr/ 3600 s | kg/m3 | J/Kg/k } @@ -11207,7 +11013,7 @@ void WaterThermalTankData::SizeTankForSupplySide(EnergyPlusData &state) if (this->Sizing.DesignMode == SizingMode::PeakDraw) { if (this->VolumeWasAutoSized) - tmpTankVolume = this->Sizing.TankDrawTime * this->UseDesignVolFlowRate * Constant::SecInHour; // hours | m3/s | (3600 s/1 hour) + tmpTankVolume = this->Sizing.TankDrawTime * this->UseDesignVolFlowRate * Constant::rSecsInHour; // hours | m3/s | (3600 s/1 hour) if (this->VolumeWasAutoSized && state.dataPlnt->PlantFirstSizesOkayToFinalize) { this->Volume = tmpTankVolume; if (state.dataPlnt->PlantFinalSizesOkayToReport) { @@ -11225,22 +11031,15 @@ void WaterThermalTankData::SizeTankForSupplySide(EnergyPlusData &state) constexpr Real64 Tfinish = 57.22; if (this->SrcSidePlantLoc.loopNum > 0) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->SrcSidePlantLoc.loopNum).FluidName, - ((Tfinish + Tstart) / 2.0), - state.dataPlnt->PlantLoop(this->SrcSidePlantLoc.loopNum).FluidIndex, - RoutineName); - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(this->SrcSidePlantLoc.loopNum).FluidName, - ((Tfinish + Tstart) / 2.0), - state.dataPlnt->PlantLoop(this->SrcSidePlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->SrcSidePlantLoc.loopNum).glycol->getDensity(state, ((Tfinish + Tstart) / 2.0), RoutineName); + Cp = state.dataPlnt->PlantLoop(this->SrcSidePlantLoc.loopNum) + .glycol->getSpecificHeat(state, ((Tfinish + Tstart) / 2.0), RoutineName); } else { - rho = FluidProperties::GetDensityGlycol(state, fluidNameWater, ((Tfinish + Tstart) / 2.0), this->waterIndex, RoutineName); - Cp = FluidProperties::GetSpecificHeatGlycol(state, fluidNameWater, ((Tfinish + Tstart) / 2.0), this->waterIndex, RoutineName); + rho = this->water->getDensity(state, ((Tfinish + Tstart) / 2.0), RoutineName); + Cp = this->water->getSpecificHeat(state, ((Tfinish + Tstart) / 2.0), RoutineName); } tmpMaxCapacity = (this->Volume * rho * Cp * (Tfinish - Tstart)) / - (this->Sizing.RecoveryTime * Constant::SecInHour); // m3 | kg/m3 | J/Kg/K | K | seconds + (this->Sizing.RecoveryTime * Constant::rSecsInHour); // m3 | kg/m3 | J/Kg/K | K | seconds } else { ShowFatalError( state, format("{}: Tank=\"{}\", requested sizing for max capacity but entered Recovery Time is zero.", RoutineName, this->Name)); @@ -11381,18 +11180,18 @@ void WaterThermalTankData::SizeDemandSidePlantConnections(EnergyPlusData &state) Real64 eff = this->UseEffectiveness; if ((Tpdesign >= 58.0) && (!this->IsChilledWaterTank)) { if (state.dataPlnt->PlantFirstSizesOkayToFinalize) { - this->UseDesignVolFlowRate = -1.0 * (TankVolume / (tankRecoverhours * Constant::SecInHour * eff)) * + this->UseDesignVolFlowRate = -1.0 * (TankVolume / (tankRecoverhours * Constant::rSecsInHour * eff)) * std::log((Tpdesign - Tfinish) / (Tpdesign - Tstart)); } else { - tmpUseDesignVolFlowRate = -1.0 * (TankVolume / (tankRecoverhours * Constant::SecInHour * eff)) * + tmpUseDesignVolFlowRate = -1.0 * (TankVolume / (tankRecoverhours * Constant::rSecsInHour * eff)) * std::log((Tpdesign - Tfinish) / (Tpdesign - Tstart)); } } else if ((Tpdesign <= 8.0) && (this->IsChilledWaterTank)) { if (state.dataPlnt->PlantFirstSizesOkayToFinalize) { - this->UseDesignVolFlowRate = -1.0 * (TankVolume / (tankRecoverhours * Constant::SecInHour * eff)) * + this->UseDesignVolFlowRate = -1.0 * (TankVolume / (tankRecoverhours * Constant::rSecsInHour * eff)) * std::log((Tpdesign - Tfinish) / (Tpdesign - Tstart)); } else { - tmpUseDesignVolFlowRate = -1.0 * (TankVolume / (tankRecoverhours * Constant::SecInHour * eff)) * + tmpUseDesignVolFlowRate = -1.0 * (TankVolume / (tankRecoverhours * Constant::rSecsInHour * eff)) * std::log((Tpdesign - Tfinish) / (Tpdesign - Tstart)); } } else { @@ -11423,11 +11222,8 @@ void WaterThermalTankData::SizeDemandSidePlantConnections(EnergyPlusData &state) } else { PlantUtilities::RegisterPlantCompDesignFlow(state, this->UseInletNode, tmpUseDesignVolFlowRate); } - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = + state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); if (state.dataPlnt->PlantFirstSizesOkayToFinalize) { this->PlantUseMassFlowRateMax = this->UseDesignVolFlowRate * rho; } else { @@ -11443,13 +11239,9 @@ void WaterThermalTankData::SizeDemandSidePlantConnections(EnergyPlusData &state) PlantUtilities::RegisterPlantCompDesignFlow(state, this->UseInletNode, this->UseDesignVolFlowRate); Real64 rho; if (this->UseSidePlantLoc.loopNum > 0) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->UseSidePlantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); } else { - rho = FluidProperties::GetDensityGlycol(state, fluidNameWater, Constant::InitConvTemp, this->waterIndex, RoutineName); + rho = this->water->getDensity(state, Constant::InitConvTemp, RoutineName); } this->PlantUseMassFlowRateMax = this->UseDesignVolFlowRate * rho; } // autosizing needed. @@ -11468,18 +11260,18 @@ void WaterThermalTankData::SizeDemandSidePlantConnections(EnergyPlusData &state) if ((Tpdesign >= 58.0) && (!this->IsChilledWaterTank)) { if (state.dataPlnt->PlantFirstSizesOkayToFinalize) { - this->SourceDesignVolFlowRate = -1.0 * (TankVolume / (tankRecoverhours * Constant::SecInHour * eff)) * + this->SourceDesignVolFlowRate = -1.0 * (TankVolume / (tankRecoverhours * Constant::rSecsInHour * eff)) * std::log((Tpdesign - Tfinish) / (Tpdesign - Tstart)); } else { - tmpSourceDesignVolFlowRate = -1.0 * (TankVolume / (tankRecoverhours * Constant::SecInHour * eff)) * + tmpSourceDesignVolFlowRate = -1.0 * (TankVolume / (tankRecoverhours * Constant::rSecsInHour * eff)) * std::log((Tpdesign - Tfinish) / (Tpdesign - Tstart)); } } else if ((Tpdesign <= 8.0) && (this->IsChilledWaterTank)) { if (state.dataPlnt->PlantFirstSizesOkayToFinalize) { - this->SourceDesignVolFlowRate = -1.0 * (TankVolume / (tankRecoverhours * Constant::SecInHour * eff)) * + this->SourceDesignVolFlowRate = -1.0 * (TankVolume / (tankRecoverhours * Constant::rSecsInHour * eff)) * std::log((Tpdesign - Tfinish) / (Tpdesign - Tstart)); } else { - tmpSourceDesignVolFlowRate = -1.0 * (TankVolume / (tankRecoverhours * Constant::SecInHour * eff)) * + tmpSourceDesignVolFlowRate = -1.0 * (TankVolume / (tankRecoverhours * Constant::rSecsInHour * eff)) * std::log((Tpdesign - Tfinish) / (Tpdesign - Tstart)); } } else { @@ -11511,11 +11303,8 @@ void WaterThermalTankData::SizeDemandSidePlantConnections(EnergyPlusData &state) } else { PlantUtilities::RegisterPlantCompDesignFlow(state, this->SourceInletNode, tmpSourceDesignVolFlowRate); } - Real64 rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->SrcSidePlantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->SrcSidePlantLoc.loopNum).FluidIndex, - RoutineName); + Real64 rho = + state.dataPlnt->PlantLoop(this->SrcSidePlantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); if (state.dataPlnt->PlantFirstSizesOkayToFinalize) { this->PlantSourceMassFlowRateMax = this->SourceDesignVolFlowRate * rho; } else { @@ -11531,13 +11320,9 @@ void WaterThermalTankData::SizeDemandSidePlantConnections(EnergyPlusData &state) PlantUtilities::RegisterPlantCompDesignFlow(state, this->SourceInletNode, this->SourceDesignVolFlowRate); Real64 rho; if (this->SrcSidePlantLoc.loopNum > 0) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(this->SrcSidePlantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(this->SrcSidePlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(this->SrcSidePlantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); } else { - rho = FluidProperties::GetDensityGlycol(state, fluidNameWater, Constant::InitConvTemp, this->waterIndex, RoutineName); + rho = this->water->getDensity(state, Constant::InitConvTemp, RoutineName); } this->PlantSourceMassFlowRateMax = this->SourceDesignVolFlowRate * rho; } // autosizing needed. @@ -11566,7 +11351,7 @@ void WaterThermalTankData::SizeStandAloneWaterHeater(EnergyPlusData &state) // SUBROUTINE PARAMETER DEFINITIONS: Real64 constexpr GalTocubicMeters(0.0037854); Real64 constexpr kBtuPerHrToWatts(293.1); - static constexpr std::string_view RoutineName("SizeStandAloneWaterHeater"); + static constexpr std::string_view routineName = "SizeStandAloneWaterHeater"; Real64 Tstart = 14.44; Real64 Tfinish = 57.22; @@ -11579,26 +11364,26 @@ void WaterThermalTankData::SizeStandAloneWaterHeater(EnergyPlusData &state) case SizingMode::PeakDraw: { // get draw rate from maximum in schedule - Real64 rho = FluidProperties::GetDensityGlycol(state, fluidNameWater, Constant::InitConvTemp, this->waterIndex, RoutineName); - Real64 DrawDesignVolFlowRate = ScheduleManager::GetScheduleMaxValue(state, this->FlowRateSchedule) * this->MassFlowRateMax / rho; + + Real64 rho = this->water->getDensity(state, Constant::InitConvTemp, routineName); + Real64 DrawDesignVolFlowRate = this->flowRateSched->getCurrentVal() * this->MassFlowRateMax / rho; if (this->VolumeWasAutoSized) { - tmpTankVolume = this->Sizing.TankDrawTime * DrawDesignVolFlowRate * Constant::SecInHour; // hours | m3/s | (3600 s/1 hour) + tmpTankVolume = this->Sizing.TankDrawTime * DrawDesignVolFlowRate * Constant::rSecsInHour; // hours | m3/s | (3600 s/1 hour) this->Volume = tmpTankVolume; BaseSizer::reportSizerOutput(state, this->Type, this->Name, "Tank Volume [m3]", this->Volume); } if (this->MaxCapacityWasAutoSized) { if (this->Sizing.RecoveryTime > 0.0) { - rho = FluidProperties::GetDensityGlycol(state, fluidNameWater, ((Tfinish + Tstart) / 2.0), this->waterIndex, RoutineName); - Real64 Cp = - FluidProperties::GetSpecificHeatGlycol(state, fluidNameWater, ((Tfinish + Tstart) / 2.0), this->waterIndex, RoutineName); + rho = this->water->getDensity(state, ((Tfinish + Tstart) / 2.0), routineName); + Real64 Cp = this->water->getSpecificHeat(state, ((Tfinish + Tstart) / 2.0), routineName); tmpMaxCapacity = (this->Volume * rho * Cp * (Tfinish - Tstart)) / - (this->Sizing.RecoveryTime * Constant::SecInHour); // m3 | kg/m3 | J/Kg/K | K | seconds + (this->Sizing.RecoveryTime * Constant::rSecsInHour); // m3 | kg/m3 | J/Kg/K | K | seconds } else { ShowFatalError( state, - format("{}: Tank=\"{}\", requested sizing for max capacity but entered Recovery Time is zero.", RoutineName, this->Name)); + format("{}: Tank=\"{}\", requested sizing for max capacity but entered Recovery Time is zero.", routineName, this->Name)); } this->MaxCapacity = tmpMaxCapacity; BaseSizer::reportSizerOutput(state, this->Type, this->Name, "Maximum Heater Capacity [W]", this->MaxCapacity); @@ -11747,17 +11532,17 @@ void WaterThermalTankData::SizeStandAloneWaterHeater(EnergyPlusData &state) // MJW TODO: this won't compile now: Real64 SumPeopleAllZones = sum(state.dataHeatBal->Zone, &DataHeatBalance::ZoneData::TotOccupants); Real64 SumPeopleAllZones = 0.0; - for (auto &thisZone : state.dataHeatBal->Zone) { + for (auto const &thisZone : state.dataHeatBal->Zone) { SumPeopleAllZones += thisZone.TotOccupants; } if (this->VolumeWasAutoSized) { tmpTankVolume = this->Sizing.TankCapacityPerPerson * SumPeopleAllZones; } if (this->MaxCapacityWasAutoSized) { - Real64 rho = FluidProperties::GetDensityGlycol(state, fluidNameWater, ((Tfinish + Tstart) / 2.0), this->waterIndex, RoutineName); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, fluidNameWater, ((Tfinish + Tstart) / 2.0), this->waterIndex, RoutineName); - tmpMaxCapacity = SumPeopleAllZones * this->Sizing.RecoveryCapacityPerPerson * (Tfinish - Tstart) * (1.0 / Constant::SecInHour) * rho * - Cp; // m3/hr/person | delta T in K | 1 hr/ 3600 s | kg/m3 | J/Kg/k + Real64 rho = this->water->getDensity(state, ((Tfinish + Tstart) / 2.0), routineName); + Real64 Cp = this->water->getSpecificHeat(state, ((Tfinish + Tstart) / 2.0), routineName); + tmpMaxCapacity = SumPeopleAllZones * this->Sizing.RecoveryCapacityPerPerson * (Tfinish - Tstart) * (1.0 / Constant::rSecsInHour) * + rho * Cp; // m3/hr/person | delta T in K | 1 hr/ 3600 s | kg/m3 | J/Kg/k } if (this->VolumeWasAutoSized) { @@ -11775,7 +11560,7 @@ void WaterThermalTankData::SizeStandAloneWaterHeater(EnergyPlusData &state) // MJW TODO: this won't compile now: Real64 SumFloorAreaAllZones = sum(state.dataHeatBal->Zone, &DataHeatBalance::ZoneData::FloorArea); Real64 SumFloorAreaAllZones = 0.0; - for (auto &thisZone : state.dataHeatBal->Zone) { + for (auto const &thisZone : state.dataHeatBal->Zone) { SumFloorAreaAllZones += thisZone.FloorArea; } if (this->VolumeWasAutoSized) { @@ -11783,9 +11568,9 @@ void WaterThermalTankData::SizeStandAloneWaterHeater(EnergyPlusData &state) } if (this->MaxCapacityWasAutoSized) { - Real64 rho = FluidProperties::GetDensityGlycol(state, fluidNameWater, ((Tfinish + Tstart) / 2.0), this->waterIndex, RoutineName); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, fluidNameWater, ((Tfinish + Tstart) / 2.0), this->waterIndex, RoutineName); - tmpMaxCapacity = SumFloorAreaAllZones * this->Sizing.RecoveryCapacityPerArea * (Tfinish - Tstart) * (1.0 / Constant::SecInHour) * + Real64 rho = this->water->getDensity(state, ((Tfinish + Tstart) / 2.0), routineName); + Real64 Cp = this->water->getSpecificHeat(state, ((Tfinish + Tstart) / 2.0), routineName); + tmpMaxCapacity = SumFloorAreaAllZones * this->Sizing.RecoveryCapacityPerArea * (Tfinish - Tstart) * (1.0 / Constant::rSecsInHour) * rho * Cp; // m2 | m3/hr/m2 | delta T in K | 1 hr/ 3600 s | kg/m3 | J/Kg/k } if (this->VolumeWasAutoSized) { @@ -11803,10 +11588,10 @@ void WaterThermalTankData::SizeStandAloneWaterHeater(EnergyPlusData &state) if (this->VolumeWasAutoSized) tmpTankVolume = this->Sizing.TankCapacityPerUnit * this->Sizing.NumberOfUnits; if (this->MaxCapacityWasAutoSized) { - Real64 rho = FluidProperties::GetDensityGlycol(state, fluidNameWater, ((Tfinish + Tstart) / 2.0), this->waterIndex, RoutineName); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, fluidNameWater, ((Tfinish + Tstart) / 2.0), this->waterIndex, RoutineName); + Real64 rho = this->water->getDensity(state, ((Tfinish + Tstart) / 2.0), routineName); + Real64 Cp = this->water->getSpecificHeat(state, ((Tfinish + Tstart) / 2.0), routineName); tmpMaxCapacity = this->Sizing.NumberOfUnits * this->Sizing.RecoveryCapacityPerUnit * (Tfinish - Tstart) * - (1.0 / Constant::SecInHour) * rho * Cp; // m3/hr/ea | delta T in K | 1 hr/ 3600 s | kg/m3 | J/Kg/k + (1.0 / Constant::rSecsInHour) * rho * Cp; // m3/hr/ea | delta T in K | 1 hr/ 3600 s | kg/m3 | J/Kg/k } if (this->VolumeWasAutoSized) { @@ -11840,7 +11625,7 @@ void WaterThermalTankData::SizeStandAloneWaterHeater(EnergyPlusData &state) ShowFatalError(state, format("{}: Tank=\"{}\", requested sizing for volume with PerSolarCollectorArea but total found " "area of Collectors is zero.", - RoutineName, + routineName, this->Name)); } } diff --git a/src/EnergyPlus/WaterThermalTanks.hh b/src/EnergyPlus/WaterThermalTanks.hh index db9657f0809..4824b5b5eb7 100644 --- a/src/EnergyPlus/WaterThermalTanks.hh +++ b/src/EnergyPlus/WaterThermalTanks.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -56,6 +56,7 @@ #include #include #include +#include #include #include #include @@ -298,8 +299,8 @@ namespace WaterThermalTanks { std::string TankType; // Type of water heater (MIXED or STRATIFIED) used with heat pump DataPlant::PlantEquipmentType HPWHTankType; // Parameter for tank type (MIXED or STRATIFIED) bool StandAlone; // Flag for operation with no plant connections (no use nodes) - int AvailSchedPtr; // Index to Availability Schedule curve index - int SetPointTempSchedule; // Index to Setpoint Temperature Schedule curve + Sched::Schedule *availSched = nullptr; // Availability Schedule + Sched::Schedule *setptTempSched = nullptr; // Setpoint Temperature Schedule Real64 DeadBandTempDiff; // Dead band temperature difference (cut-in temperature) Real64 Capacity; // Heat Pump rated capacity (W) Real64 BackupElementCapacity; // Tank backup element capacity (W) @@ -341,8 +342,8 @@ namespace WaterThermalTanks { HVAC::FanPlace fanPlace; // Location of Fan int FanOutletNode; // Outlet node of heat pump water heater fan int WaterHeaterTankNum; // Index of Water Heater Tank - int OutletAirSplitterSchPtr; // Index to air-side outlet air splitter schedule - int InletAirMixerSchPtr; // Index to air-side inlet air mixer schedule + Sched::Schedule *outletAirSplitterSched = nullptr; // air-side outlet air splitter schedule + Sched::Schedule *inletAirMixerSched = nullptr; // air-side inlet air mixer schedule TankOperatingMode Mode = TankOperatingMode::Floating; // HP mode (0 = float, 1 = heating [-1 = venting na for HP]) TankOperatingMode SaveMode = TankOperatingMode::Floating; // HP mode on first iteration TankOperatingMode SaveWHMode = TankOperatingMode::Floating; // mode of water heater tank element (backup element) @@ -356,11 +357,11 @@ namespace WaterThermalTanks { int OutletAirSplitterNode; // Outlet air splitter node number of HP water heater Real64 SourceMassFlowRate; // Maximum mass flow rate on the source side (kg/s) WTTAmbientTemp InletAirConfiguration; // Identifies source of HPWH inlet air - int AmbientTempSchedule; // Schedule index pointer for ambient air temp at HPWH inlet - int AmbientRHSchedule; // Schedule index pointer for ambient air RH at HPWH inlet + Sched::Schedule *ambientTempSched = nullptr; // Schedule for ambient air temp at HPWH inlet + Sched::Schedule *ambientRHSched = nullptr; // Schedule for ambient air RH at HPWH inlet int AmbientTempZone; // Index of ambient zone for ambient air at HPWH inlet CrankcaseHeaterControlTemp CrankcaseTempIndicator; // Indicator for HPWH compressor/crankcase heater location - int CrankcaseTempSchedule; // Schedule index pointer where crankcase heater is located + Sched::Schedule *crankcaseTempSched = nullptr; // Schedule for crankcase heater int CrankcaseTempZone; // Index of zone where compressor/crankcase heater is located Real64 OffCycParaLoad; // Rate for off-cycle parasitic load (W) Real64 OnCycParaLoad; // Rate for on-cycle parasitic load (W) @@ -425,29 +426,28 @@ namespace WaterThermalTanks { // Default Constructor HeatPumpWaterHeaterData() : HPWHType(DataPlant::PlantEquipmentType::Invalid), HPWHTankType(DataPlant::PlantEquipmentType::Invalid), StandAlone(false), - AvailSchedPtr(0), SetPointTempSchedule(0), DeadBandTempDiff(0.0), Capacity(0.0), BackupElementCapacity(0.0), - BackupElementEfficiency(0.0), WHOnCycParaLoad(0.0), WHOffCycParaLoad(0.0), WHOnCycParaFracToTank(0.0), WHOffCycParaFracToTank(0.0), - WHPLFCurve(0), OperatingAirFlowRate(0.0), OperatingAirMassFlowRate(0.0), OperatingWaterFlowRate(0.0), COP(0.0), SHR(0.0), - RatedInletDBTemp(0.0), RatedInletWBTemp(0.0), RatedInletWaterTemp(0.0), FoundTank(false), HeatPumpAirInletNode(0), - HeatPumpAirOutletNode(0), OutsideAirNode(0), ExhaustAirNode(0), CondWaterInletNode(0), CondWaterOutletNode(0), WHUseInletNode(0), - WHUseOutletNode(0), WHUseSidePlantLoopNum(0), DXCoilNum(0), DXCoilTypeNum(0), DXCoilAirInletNode(0), DXCoilPLFFPLR(0), - fanType(HVAC::FanType::Invalid), FanNum(0), fanPlace(HVAC::FanPlace::Invalid), FanOutletNode(0), WaterHeaterTankNum(0), - OutletAirSplitterSchPtr(0), InletAirMixerSchPtr(0), Power(0.0), Energy(0.0), HeatingPLR(0.0), SetPointTemp(0.0), + DeadBandTempDiff(0.0), Capacity(0.0), BackupElementCapacity(0.0), BackupElementEfficiency(0.0), WHOnCycParaLoad(0.0), + WHOffCycParaLoad(0.0), WHOnCycParaFracToTank(0.0), WHOffCycParaFracToTank(0.0), WHPLFCurve(0), OperatingAirFlowRate(0.0), + OperatingAirMassFlowRate(0.0), OperatingWaterFlowRate(0.0), COP(0.0), SHR(0.0), RatedInletDBTemp(0.0), RatedInletWBTemp(0.0), + RatedInletWaterTemp(0.0), FoundTank(false), HeatPumpAirInletNode(0), HeatPumpAirOutletNode(0), OutsideAirNode(0), ExhaustAirNode(0), + CondWaterInletNode(0), CondWaterOutletNode(0), WHUseInletNode(0), WHUseOutletNode(0), WHUseSidePlantLoopNum(0), DXCoilNum(0), + DXCoilTypeNum(0), DXCoilAirInletNode(0), DXCoilPLFFPLR(0), fanType(HVAC::FanType::Invalid), FanNum(0), + fanPlace(HVAC::FanPlace::Invalid), FanOutletNode(0), WaterHeaterTankNum(0), Power(0.0), Energy(0.0), HeatingPLR(0.0), SetPointTemp(0.0), MinAirTempForHPOperation(5.0), MaxAirTempForHPOperation(48.8888888889), InletAirMixerNode(0), OutletAirSplitterNode(0), - SourceMassFlowRate(0.0), InletAirConfiguration(WTTAmbientTemp::OutsideAir), AmbientTempSchedule(0), AmbientRHSchedule(0), - AmbientTempZone(0), CrankcaseTempIndicator(CrankcaseHeaterControlTemp::Schedule), CrankcaseTempSchedule(0), CrankcaseTempZone(0), - OffCycParaLoad(0.0), OnCycParaLoad(0.0), ParasiticTempIndicator(WTTAmbientTemp::OutsideAir), OffCycParaFuelRate(0.0), - OnCycParaFuelRate(0.0), OffCycParaFuelEnergy(0.0), OnCycParaFuelEnergy(0.0), AirFlowRateAutoSized(false), WaterFlowRateAutoSized(false), - HPSetPointError(0), HPSetPointErrIndex1(0), IterLimitErrIndex1(0), IterLimitExceededNum1(0), RegulaFalsiFailedIndex1(0), - RegulaFalsiFailedNum1(0), IterLimitErrIndex2(0), IterLimitExceededNum2(0), RegulaFalsiFailedIndex2(0), RegulaFalsiFailedNum2(0), - FirstTimeThroughFlag(true), ShowSetPointWarning(true), HPWaterHeaterSensibleCapacity(0.0), HPWaterHeaterLatentCapacity(0.0), - WrappedCondenserBottomLocation(0.0), WrappedCondenserTopLocation(0.0), ControlSensor1Height(-1.0), ControlSensor1Node(1), - ControlSensor1Weight(1.0), ControlSensor2Height(-1.0), ControlSensor2Node(2), ControlSensor2Weight(0.0), ControlTempAvg(0.0), - ControlTempFinal(0.0), AllowHeatingElementAndHeatPumpToRunAtSameTime(true), NumofSpeed(0), - HPWHAirVolFlowRate(HVAC::MaxSpeedLevels, 0.0), HPWHAirMassFlowRate(HVAC::MaxSpeedLevels, 0.0), - HPWHWaterVolFlowRate(HVAC::MaxSpeedLevels, 0.0), HPWHWaterMassFlowRate(HVAC::MaxSpeedLevels, 0.0), - MSAirSpeedRatio(HVAC::MaxSpeedLevels, 0.0), MSWaterSpeedRatio(HVAC::MaxSpeedLevels, 0.0), bIsIHP(false), MyOneTimeFlagHP(true), - MyTwoTimeFlagHP(true), CheckHPWHEquipName(true), myOneTimeInitFlag(true) + SourceMassFlowRate(0.0), InletAirConfiguration(WTTAmbientTemp::OutsideAir), AmbientTempZone(0), + CrankcaseTempIndicator(CrankcaseHeaterControlTemp::Schedule), CrankcaseTempZone(0), OffCycParaLoad(0.0), OnCycParaLoad(0.0), + ParasiticTempIndicator(WTTAmbientTemp::OutsideAir), OffCycParaFuelRate(0.0), OnCycParaFuelRate(0.0), OffCycParaFuelEnergy(0.0), + OnCycParaFuelEnergy(0.0), AirFlowRateAutoSized(false), WaterFlowRateAutoSized(false), HPSetPointError(0), HPSetPointErrIndex1(0), + IterLimitErrIndex1(0), IterLimitExceededNum1(0), RegulaFalsiFailedIndex1(0), RegulaFalsiFailedNum1(0), IterLimitErrIndex2(0), + IterLimitExceededNum2(0), RegulaFalsiFailedIndex2(0), RegulaFalsiFailedNum2(0), FirstTimeThroughFlag(true), ShowSetPointWarning(true), + HPWaterHeaterSensibleCapacity(0.0), HPWaterHeaterLatentCapacity(0.0), WrappedCondenserBottomLocation(0.0), + WrappedCondenserTopLocation(0.0), ControlSensor1Height(-1.0), ControlSensor1Node(1), ControlSensor1Weight(1.0), + ControlSensor2Height(-1.0), ControlSensor2Node(2), ControlSensor2Weight(0.0), ControlTempAvg(0.0), ControlTempFinal(0.0), + AllowHeatingElementAndHeatPumpToRunAtSameTime(true), NumofSpeed(0), HPWHAirVolFlowRate(HVAC::MaxSpeedLevels, 0.0), + HPWHAirMassFlowRate(HVAC::MaxSpeedLevels, 0.0), HPWHWaterVolFlowRate(HVAC::MaxSpeedLevels, 0.0), + HPWHWaterMassFlowRate(HVAC::MaxSpeedLevels, 0.0), MSAirSpeedRatio(HVAC::MaxSpeedLevels, 0.0), + MSWaterSpeedRatio(HVAC::MaxSpeedLevels, 0.0), bIsIHP(false), MyOneTimeFlagHP(true), MyTwoTimeFlagHP(true), CheckHPWHEquipName(true), + myOneTimeInitFlag(true) { } @@ -483,7 +483,7 @@ namespace WaterThermalTanks { Real64 TimeElapsed; // Fraction of the current hour that has elapsed (h) // Saved in order to identify the beginning of a new system time WTTAmbientTemp AmbientTempIndicator; // Indicator for ambient tank losses (SCHEDULE, ZONE, EXTERIOR) - int AmbientTempSchedule; // Schedule index pointer + Sched::Schedule *ambientTempSched = nullptr; // Schedule int AmbientTempZone; // Number of ambient zone around tank int AmbientTempOutsideAirNode; // Number of outside air node Real64 AmbientTemp; // Ambient temperature around tank (C) @@ -503,7 +503,7 @@ namespace WaterThermalTanks { Real64 MinCapacity; // Minimum capacity of auxiliary heater 1 (W) Real64 Efficiency; // Thermal efficiency of auxiliary heater 1 () int PLFCurve; // Part load factor curve as a function of part load ratio - int SetPointTempSchedule; // Schedule index pointer + Sched::Schedule *setptTempSched = nullptr; // Schedule Real64 SetPointTemp; // Setpoint temperature of auxiliary heater 1 (C) Real64 DeadBandDeltaTemp; // Deadband temperature difference of auxiliary heater 1 (deltaC) Real64 TankTempLimit; // Maximum tank temperature limit before venting (C) @@ -528,8 +528,8 @@ namespace WaterThermalTanks { DataBranchAirLoopPlant::ControlType UseBranchControlType; // Use side plant branch control type e.g active, passive, bypass int UseSidePlantSizNum; // index in plant sizing that the use side is on bool UseSideSeries; - int UseSideAvailSchedNum; // use side availability schedule - Real64 UseSideLoadRequested; // hold MyLoad request from plant management. + Sched::Schedule *useSideAvailSched = nullptr; // use side availability schedule + Real64 UseSideLoadRequested; // hold MyLoad request from plant management. PlantLocation UseSidePlantLoc; int SourceInletNode; // Inlet node for the source side; hot water from supply Real64 SourceInletTemp; // Source side inlet temperature (C) @@ -544,19 +544,19 @@ namespace WaterThermalTanks { DataBranchAirLoopPlant::ControlType SourceBranchControlType; // source side plant branch control type e.g active, passive, bypass int SourceSidePlantSizNum; // index in plant sizing that the source side is on bool SourceSideSeries; - int SourceSideAvailSchedNum; // source side availability schedule. + Sched::Schedule *sourceSideAvailSched = nullptr; // source side availability schedule. PlantLocation SrcSidePlantLoc; - SourceSideControl SourceSideControlMode; // flag for how source side flow is controlled - int SourceSideAltSetpointSchedNum; // schedule of alternate temperature setpoint values - Real64 SizingRecoveryTime; // sizing parameter for autosizing indirect water heaters (hr) - Real64 MassFlowRateMax; // Maximum flow rate for scheduled DHW (kg/s) - Real64 VolFlowRateMin; // Minimum flow rate for heater ignition (kg/s) - Real64 MassFlowRateMin; // Minimum mass flow rate for heater ignition (kg/s) - int FlowRateSchedule; // Schedule index pointer - int UseInletTempSchedule; // Cold water supply temperature schedule index pointer - Real64 TankTemp; // Temperature of tank fluid (average, if stratified) (C) - Real64 SavedTankTemp; // Tank temp that is carried from time step to time step (C) - Real64 TankTempAvg; // Average tank temperature over the time step (C) + SourceSideControl SourceSideControlMode; // flag for how source side flow is controlled + Sched::Schedule *sourceSideAltSetpointSched = nullptr; // schedule of alternate temperature setpoint values + Real64 SizingRecoveryTime; // sizing parameter for autosizing indirect water heaters (hr) + Real64 MassFlowRateMax; // Maximum flow rate for scheduled DHW (kg/s) + Real64 VolFlowRateMin; // Minimum flow rate for heater ignition (kg/s) + Real64 MassFlowRateMin; // Minimum mass flow rate for heater ignition (kg/s) + Sched::Schedule *flowRateSched = nullptr; // Schedule + Sched::Schedule *useInletTempSched = nullptr; // Cold water supply temperature schedule + Real64 TankTemp; // Temperature of tank fluid (average, if stratified) (C) + Real64 SavedTankTemp; // Tank temp that is carried from time step to time step (C) + Real64 TankTempAvg; // Average tank temperature over the time step (C) // Stratified variables (in addition to the above) Real64 Height; // Height of tank (m) bool HeightWasAutoSized; // true if the height of tank was autosize on input @@ -572,7 +572,7 @@ namespace WaterThermalTanks { bool SavedHeaterOn2; Real64 AdditionalCond; // Additional destratification conductivity (W/m K) Real64 SetPointTemp2; // Setpoint temperature of auxiliary heater 2 (C) - int SetPointTempSchedule2; + Sched::Schedule *setptTemp2Sched = nullptr; Real64 DeadBandDeltaTemp2; Real64 MaxCapacity2; Real64 OffCycParaHeight; @@ -650,9 +650,11 @@ namespace WaterThermalTanks { int MaxCycleErrorIndex; // recurring error index int FreezingErrorIndex; // recurring error index for freeze conditions WaterHeaterSizingData Sizing; // ancillary data for autosizing - int FluidIndex; // fluid properties index - bool MyOneTimeFlagWH; // first pass log - bool MyTwoTimeFlagWH; // second pass do input check + + Fluid::GlycolProps *water = nullptr; // Water properties + + bool MyOneTimeFlagWH; // first pass log + bool MyTwoTimeFlagWH; // second pass do input check bool MyEnvrnFlag; bool WarmupFlag; bool SetLoopIndexFlag; @@ -677,40 +679,38 @@ namespace WaterThermalTanks { // Default Constructor WaterThermalTankData() : WaterThermalTankType(DataPlant::PlantEquipmentType::Invalid), IsChilledWaterTank(false), Init(true), StandAlone(false), Volume(0.0), - VolumeWasAutoSized(false), Mass(0.0), TimeElapsed(0.0), AmbientTempIndicator(WTTAmbientTemp::OutsideAir), AmbientTempSchedule(0), - AmbientTempZone(0), AmbientTempOutsideAirNode(0), AmbientTemp(0.0), AmbientZoneGain(0.0), LossCoeff(0.0), OffCycLossCoeff(0.0), - OffCycLossFracToZone(0.0), OnCycLossCoeff(0.0), OnCycLossFracToZone(0.0), ControlType(HeaterControlMode::Cycle), + VolumeWasAutoSized(false), Mass(0.0), TimeElapsed(0.0), AmbientTempIndicator(WTTAmbientTemp::OutsideAir), AmbientTempZone(0), + AmbientTempOutsideAirNode(0), AmbientTemp(0.0), AmbientZoneGain(0.0), LossCoeff(0.0), OffCycLossCoeff(0.0), OffCycLossFracToZone(0.0), + OnCycLossCoeff(0.0), OnCycLossFracToZone(0.0), ControlType(HeaterControlMode::Cycle), StratifiedControlMode(PriorityControlMode::Invalid), MaxCapacity(0.0), MaxCapacityWasAutoSized(false), MinCapacity(0.0), - Efficiency(0.0), PLFCurve(0), SetPointTempSchedule(0), SetPointTemp(0.0), DeadBandDeltaTemp(0.0), TankTempLimit(0.0), - IgnitionDelay(0.0), OffCycParaLoad(0.0), OffCycParaFracToTank(0.0), OnCycParaLoad(0.0), OnCycParaFracToTank(0.0), - UseCurrentFlowLock(DataPlant::FlowLock::Unlocked), UseInletNode(0), UseInletTemp(0.0), UseOutletNode(0), UseOutletTemp(0.0), - UseMassFlowRate(0.0), UseEffectiveness(0.0), PlantUseMassFlowRateMax(0.0), SavedUseOutletTemp(0.0), UseDesignVolFlowRate(0.0), - UseDesignVolFlowRateWasAutoSized(false), UseBranchControlType(DataBranchAirLoopPlant::ControlType::Passive), UseSidePlantSizNum(0), - UseSideSeries(true), UseSideAvailSchedNum(0), UseSideLoadRequested(0.0), UseSidePlantLoc{}, SourceInletNode(0), SourceInletTemp(0.0), - SourceOutletNode(0), SourceOutletTemp(0.0), SourceMassFlowRate(0.0), SourceEffectiveness(0.0), PlantSourceMassFlowRateMax(0.0), - SavedSourceOutletTemp(0.0), SourceDesignVolFlowRate(0.0), SourceDesignVolFlowRateWasAutoSized(false), - SourceBranchControlType(DataBranchAirLoopPlant::ControlType::Passive), SourceSidePlantSizNum(0), SourceSideSeries(true), - SourceSideAvailSchedNum(0), SrcSidePlantLoc{}, SourceSideControlMode(SourceSideControl::IndirectHeatAltSetpoint), - SourceSideAltSetpointSchedNum(0), SizingRecoveryTime(0.0), MassFlowRateMax(0.0), VolFlowRateMin(0.0), MassFlowRateMin(0.0), - FlowRateSchedule(0), UseInletTempSchedule(0), TankTemp(0.0), SavedTankTemp(0.0), TankTempAvg(0.0), Height(0.0), + Efficiency(0.0), PLFCurve(0), SetPointTemp(0.0), DeadBandDeltaTemp(0.0), TankTempLimit(0.0), IgnitionDelay(0.0), OffCycParaLoad(0.0), + OffCycParaFracToTank(0.0), OnCycParaLoad(0.0), OnCycParaFracToTank(0.0), UseCurrentFlowLock(DataPlant::FlowLock::Unlocked), + UseInletNode(0), UseInletTemp(0.0), UseOutletNode(0), UseOutletTemp(0.0), UseMassFlowRate(0.0), UseEffectiveness(0.0), + PlantUseMassFlowRateMax(0.0), SavedUseOutletTemp(0.0), UseDesignVolFlowRate(0.0), UseDesignVolFlowRateWasAutoSized(false), + UseBranchControlType(DataBranchAirLoopPlant::ControlType::Passive), UseSidePlantSizNum(0), UseSideSeries(true), + UseSideLoadRequested(0.0), UseSidePlantLoc{}, SourceInletNode(0), SourceInletTemp(0.0), SourceOutletNode(0), SourceOutletTemp(0.0), + SourceMassFlowRate(0.0), SourceEffectiveness(0.0), PlantSourceMassFlowRateMax(0.0), SavedSourceOutletTemp(0.0), + SourceDesignVolFlowRate(0.0), SourceDesignVolFlowRateWasAutoSized(false), + SourceBranchControlType(DataBranchAirLoopPlant::ControlType::Passive), SourceSidePlantSizNum(0), + SourceSideSeries(true), SrcSidePlantLoc{}, SourceSideControlMode(SourceSideControl::IndirectHeatAltSetpoint), SizingRecoveryTime(0.0), + MassFlowRateMax(0.0), VolFlowRateMin(0.0), MassFlowRateMin(0.0), TankTemp(0.0), SavedTankTemp(0.0), TankTempAvg(0.0), Height(0.0), HeightWasAutoSized(false), Perimeter(0.0), Shape(TankShape::VertCylinder), HeaterHeight1(0.0), HeaterNode1(0), HeaterOn1(false), SavedHeaterOn1(false), HeaterHeight2(0.0), HeaterNode2(0), HeaterOn2(false), SavedHeaterOn2(false), AdditionalCond(0.0), - SetPointTemp2(0.0), SetPointTempSchedule2(0), DeadBandDeltaTemp2(0.0), MaxCapacity2(0.0), OffCycParaHeight(0.0), OnCycParaHeight(0.0), - SkinLossCoeff(0.0), SkinLossFracToZone(0.0), OffCycFlueLossCoeff(0.0), OffCycFlueLossFracToZone(0.0), UseInletHeight(0.0), - UseOutletHeight(0.0), UseOutletHeightWasAutoSized(false), SourceInletHeight(0.0), SourceInletHeightWasAutoSized(false), - SourceOutletHeight(0.0), UseInletStratNode(0), UseOutletStratNode(0), SourceInletStratNode(0), SourceOutletStratNode(0), - InletMode(InletPositionMode::Fixed), InversionMixingRate(0.0), Nodes(0), VolFlowRate(0.0), VolumeConsumed(0.0), UnmetRate(0.0), - LossRate(0.0), FlueLossRate(0.0), UseRate(0.0), TotalDemandRate(0.0), SourceRate(0.0), HeaterRate(0.0), HeaterRate1(0.0), - HeaterRate2(0.0), FuelRate(0.0), FuelRate1(0.0), FuelRate2(0.0), VentRate(0.0), OffCycParaFuelRate(0.0), OffCycParaRateToTank(0.0), - OnCycParaFuelRate(0.0), OnCycParaRateToTank(0.0), NetHeatTransferRate(0.0), CycleOnCount(0), CycleOnCount1(0), CycleOnCount2(0), - RuntimeFraction(0.0), RuntimeFraction1(0.0), RuntimeFraction2(0.0), PartLoadRatio(0.0), UnmetEnergy(0.0), LossEnergy(0.0), - FlueLossEnergy(0.0), UseEnergy(0.0), TotalDemandEnergy(0.0), SourceEnergy(0.0), HeaterEnergy(0.0), HeaterEnergy1(0.0), - HeaterEnergy2(0.0), FuelEnergy(0.0), FuelEnergy1(0.0), FuelEnergy2(0.0), VentEnergy(0.0), OffCycParaFuelEnergy(0.0), - OffCycParaEnergyToTank(0.0), OnCycParaFuelEnergy(0.0), OnCycParaEnergyToTank(0.0), NetHeatTransferEnergy(0.0), FirstRecoveryDone(false), - FirstRecoveryFuel(0.0), HeatPumpNum(0), DesuperheaterNum(0), ShowSetPointWarning(true), MaxCycleErrorIndex(0), FreezingErrorIndex(0), - FluidIndex(0), MyOneTimeFlagWH(true), MyTwoTimeFlagWH(true), MyEnvrnFlag(true), WarmupFlag(false), SetLoopIndexFlag(true), - AlreadyReported(false), AlreadyRated(false), MyHPSizeFlag(true), CheckWTTEquipName(true), myOneTimeInitFlag(true), - scanPlantLoopsFlag(true), callerLoopNum(0), waterIndex(1) + SetPointTemp2(0.0), DeadBandDeltaTemp2(0.0), MaxCapacity2(0.0), OffCycParaHeight(0.0), OnCycParaHeight(0.0), SkinLossCoeff(0.0), + SkinLossFracToZone(0.0), OffCycFlueLossCoeff(0.0), OffCycFlueLossFracToZone(0.0), UseInletHeight(0.0), UseOutletHeight(0.0), + UseOutletHeightWasAutoSized(false), SourceInletHeight(0.0), SourceInletHeightWasAutoSized(false), SourceOutletHeight(0.0), + UseInletStratNode(0), UseOutletStratNode(0), SourceInletStratNode(0), SourceOutletStratNode(0), InletMode(InletPositionMode::Fixed), + InversionMixingRate(0.0), Nodes(0), VolFlowRate(0.0), VolumeConsumed(0.0), UnmetRate(0.0), LossRate(0.0), FlueLossRate(0.0), + UseRate(0.0), TotalDemandRate(0.0), SourceRate(0.0), HeaterRate(0.0), HeaterRate1(0.0), HeaterRate2(0.0), FuelRate(0.0), FuelRate1(0.0), + FuelRate2(0.0), VentRate(0.0), OffCycParaFuelRate(0.0), OffCycParaRateToTank(0.0), OnCycParaFuelRate(0.0), OnCycParaRateToTank(0.0), + NetHeatTransferRate(0.0), CycleOnCount(0), CycleOnCount1(0), CycleOnCount2(0), RuntimeFraction(0.0), RuntimeFraction1(0.0), + RuntimeFraction2(0.0), PartLoadRatio(0.0), UnmetEnergy(0.0), LossEnergy(0.0), FlueLossEnergy(0.0), UseEnergy(0.0), + TotalDemandEnergy(0.0), SourceEnergy(0.0), HeaterEnergy(0.0), HeaterEnergy1(0.0), HeaterEnergy2(0.0), FuelEnergy(0.0), FuelEnergy1(0.0), + FuelEnergy2(0.0), VentEnergy(0.0), OffCycParaFuelEnergy(0.0), OffCycParaEnergyToTank(0.0), OnCycParaFuelEnergy(0.0), + OnCycParaEnergyToTank(0.0), NetHeatTransferEnergy(0.0), FirstRecoveryDone(false), FirstRecoveryFuel(0.0), HeatPumpNum(0), + DesuperheaterNum(0), ShowSetPointWarning(true), MaxCycleErrorIndex(0), FreezingErrorIndex(0), MyOneTimeFlagWH(true), + MyTwoTimeFlagWH(true), MyEnvrnFlag(true), WarmupFlag(false), SetLoopIndexFlag(true), AlreadyReported(false), AlreadyRated(false), + MyHPSizeFlag(true), CheckWTTEquipName(true), myOneTimeInitFlag(true), scanPlantLoopsFlag(true), callerLoopNum(0), waterIndex(1) { } @@ -884,8 +884,8 @@ namespace WaterThermalTanks { std::string Name; // Name of heat pump water heater desuperheater std::string Type; // Type of water heater desuperheating coil int InsuffTemperatureWarn; // Used for recurring error count on low source temperature - int AvailSchedPtr; // Index to Availability Schedule curve index - int SetPointTempSchedule; // Index to Setpoint Temperature Schedule curve + Sched::Schedule *availSched = nullptr; // Availability Schedule + Sched::Schedule *setptTempSched = nullptr; // Setpoint Temperature Schedule Real64 DeadBandTempDiff; // Dead band temperature difference (cut-in temperature) Real64 HeatReclaimRecoveryEff; // recovery efficiency of desuperheater (0.3 max) int WaterInletNode; // Desuperheater water inlet node @@ -945,15 +945,15 @@ namespace WaterThermalTanks { // Default Constructor WaterHeaterDesuperheaterData() - : InsuffTemperatureWarn(0), AvailSchedPtr(0), SetPointTempSchedule(0), DeadBandTempDiff(0.0), HeatReclaimRecoveryEff(0.0), - WaterInletNode(0), WaterOutletNode(0), RatedInletWaterTemp(0.0), RatedOutdoorAirTemp(0.0), MaxInletWaterTemp(0.0), - TankTypeNum(DataPlant::PlantEquipmentType::Invalid), TankNum(0), StandAlone(false), HeaterRate(0.0), HeaterEnergy(0.0), PumpPower(0.0), - PumpEnergy(0.0), PumpElecPower(0.0), PumpFracToWater(0.0), OperatingWaterFlowRate(0.0), HEffFTemp(0), HEffFTempOutput(0.0), - SetPointTemp(0.0), WaterHeaterTankNum(0), DesuperheaterPLR(0.0), OnCycParaLoad(0.0), OffCycParaLoad(0.0), OnCycParaFuelEnergy(0.0), - OnCycParaFuelRate(0.0), OffCycParaFuelEnergy(0.0), OffCycParaFuelRate(0.0), BackupElementCapacity(0.0), DXSysPLR(0.0), - ReclaimHeatingSourceIndexNum(0), ReclaimHeatingSource(ReclaimHeatObjectType::DXCooling), SetPointError(0), SetPointErrIndex1(0), - IterLimitErrIndex1(0), IterLimitExceededNum1(0), RegulaFalsiFailedIndex1(0), RegulaFalsiFailedNum1(0), IterLimitErrIndex2(0), - IterLimitExceededNum2(0), RegulaFalsiFailedIndex2(0), RegulaFalsiFailedNum2(0), FirstTimeThroughFlag(true), ValidSourceType(false) + : InsuffTemperatureWarn(0), DeadBandTempDiff(0.0), HeatReclaimRecoveryEff(0.0), WaterInletNode(0), WaterOutletNode(0), + RatedInletWaterTemp(0.0), RatedOutdoorAirTemp(0.0), MaxInletWaterTemp(0.0), TankTypeNum(DataPlant::PlantEquipmentType::Invalid), + TankNum(0), StandAlone(false), HeaterRate(0.0), HeaterEnergy(0.0), PumpPower(0.0), PumpEnergy(0.0), PumpElecPower(0.0), + PumpFracToWater(0.0), OperatingWaterFlowRate(0.0), HEffFTemp(0), HEffFTempOutput(0.0), SetPointTemp(0.0), WaterHeaterTankNum(0), + DesuperheaterPLR(0.0), OnCycParaLoad(0.0), OffCycParaLoad(0.0), OnCycParaFuelEnergy(0.0), OnCycParaFuelRate(0.0), + OffCycParaFuelEnergy(0.0), OffCycParaFuelRate(0.0), BackupElementCapacity(0.0), DXSysPLR(0.0), ReclaimHeatingSourceIndexNum(0), + ReclaimHeatingSource(ReclaimHeatObjectType::DXCooling), SetPointError(0), SetPointErrIndex1(0), IterLimitErrIndex1(0), + IterLimitExceededNum1(0), RegulaFalsiFailedIndex1(0), RegulaFalsiFailedNum1(0), IterLimitErrIndex2(0), IterLimitExceededNum2(0), + RegulaFalsiFailedIndex2(0), RegulaFalsiFailedNum2(0), FirstTimeThroughFlag(true), ValidSourceType(false) { } }; @@ -1018,6 +1018,10 @@ struct WaterThermalTanksData : BaseGlobalStruct bool getWaterThermalTankInputFlag = true; // Calls to Water Heater from multiple places in code bool calcWaterThermalTankZoneGainsMyEnvrnFlag = true; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/WaterToAirHeatPump.cc b/src/EnergyPlus/WaterToAirHeatPump.cc index ed06f4cd8ef..8938460b55f 100644 --- a/src/EnergyPlus/WaterToAirHeatPump.cc +++ b/src/EnergyPlus/WaterToAirHeatPump.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -50,7 +50,6 @@ // ObjexxFCL Headers #include -#include // EnergyPlus Headers #include @@ -96,8 +95,6 @@ namespace WaterToAirHeatPump { using namespace DataLoopNode; - static constexpr std::string_view fluidNameWater("WATER"); - void SimWatertoAirHP(EnergyPlusData &state, std::string_view CompName, // component name int &CompIndex, // Index for Component name @@ -127,8 +124,7 @@ namespace WaterToAirHeatPump { int HPNum; // The WatertoAirHP that you are currently loading input into // Obtains and Allocates WatertoAirHP related parameters from input file - if (state.dataWaterToAirHeatPump->GetCoilsInputFlag) { // First time subroutine has been entered - state.dataWaterToAirHeatPump->WaterIndex = FluidProperties::GetGlycolNum(state, fluidNameWater); // Initialize the WaterIndex once + if (state.dataWaterToAirHeatPump->GetCoilsInputFlag) { // First time subroutine has been entered GetWatertoAirHPInput(state); state.dataWaterToAirHeatPump->GetCoilsInputFlag = false; } @@ -200,13 +196,13 @@ namespace WaterToAirHeatPump { // Using/Aliasing using namespace NodeInputManager; using BranchNodeConnections::TestCompSet; - using FluidProperties::CheckFluidPropertyName; using GlobalNames::VerifyUniqueCoilName; using PlantUtilities::RegisterPlantCompDesignFlow; using namespace OutputReportPredefined; // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetWatertoAirHPInput: "); // include trailing blank space + static constexpr std::string_view routineName = "GetWatertoAirHPInput"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int HPNum; // The Water to Air HP that you are currently loading input into @@ -281,6 +277,7 @@ namespace WaterToAirHeatPump { cAlphaFields, cNumericFields); + ErrorObjectHeader eoh{routineName, CurrentModuleObject, AlphArray(1)}; // ErrorsFound will be set to True if problem was found, left untouched otherwise VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); @@ -290,6 +287,13 @@ namespace WaterToAirHeatPump { heatPump.WatertoAirHPType = "COOLING"; heatPump.WAHPType = DataPlant::PlantEquipmentType::CoilWAHPCoolingParamEst; heatPump.Refrigerant = AlphArray(3); + if (heatPump.Refrigerant.empty()) { + ShowSevereEmptyField(state, eoh, cAlphaFields(3)); + ErrorsFound = true; + } else if ((heatPump.refrig = Fluid::GetRefrig(state, heatPump.Refrigerant)) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(3), AlphArray(3)); + ErrorsFound = true; + } heatPump.DesignWaterVolFlowRate = NumArray(1); heatPump.CoolingCapacity = NumArray(2); heatPump.Twet_Rated = NumArray(3); @@ -528,6 +532,9 @@ namespace WaterToAirHeatPump { lAlphaBlanks, cAlphaFields, cNumericFields); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, AlphArray(1)}; + // ErrorsFound will be set to True if problem was found, left untouched otherwise VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name"); auto &heatPump = state.dataWaterToAirHeatPump->WatertoAirHP(HPNum); @@ -536,6 +543,13 @@ namespace WaterToAirHeatPump { heatPump.WatertoAirHPType = "HEATING"; heatPump.WAHPType = DataPlant::PlantEquipmentType::CoilWAHPHeatingParamEst; heatPump.Refrigerant = AlphArray(3); + if (heatPump.Refrigerant.empty()) { + ShowSevereEmptyField(state, eoh, cAlphaFields(3)); + ErrorsFound = true; + } else if ((heatPump.refrig = Fluid::GetRefrig(state, heatPump.Refrigerant)) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(3), AlphArray(3)); + ErrorsFound = true; + } heatPump.DesignWaterVolFlowRate = NumArray(1); heatPump.HeatingCapacity = NumArray(2); @@ -992,8 +1006,6 @@ namespace WaterToAirHeatPump { // Uses the status flags to trigger initializations. // Using/Aliasing - using FluidProperties::GetDensityGlycol; - using FluidProperties::GetSpecificHeatGlycol; using PlantUtilities::InitComponentNodes; using PlantUtilities::ScanPlantLoopsForObject; using PlantUtilities::SetComponentFlowRate; @@ -1091,16 +1103,8 @@ namespace WaterToAirHeatPump { heatPump.OutletWaterEnthalpy = 0.0; // The rest of the one time initializations - rho = GetDensityGlycol(state, - state.dataPlnt->PlantLoop(heatPump.plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(heatPump.plantLoc.loopNum).FluidIndex, - RoutineName); - Cp = GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(heatPump.plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(heatPump.plantLoc.loopNum).FluidIndex, - RoutineName); + rho = state.dataPlnt->PlantLoop(heatPump.plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); + Cp = state.dataPlnt->PlantLoop(heatPump.plantLoc.loopNum).glycol->getSpecificHeat(state, Constant::InitConvTemp, RoutineName); heatPump.DesignWaterMassFlowRate = rho * heatPump.DesignWaterVolFlowRate; @@ -1255,8 +1259,6 @@ namespace WaterToAirHeatPump { int NumIteration2; // Number of Iteration2 int NumIteration3; // Number of Iteration3 int NumIteration4; // Number of Iteration4 (use of latent degradation model ONLY) - int SourceSideFluidIndex; // Source Side Fluid Index - std::string SourceSideFluidName; // Name of source side fluid Real64 Quality; // Quality of Refrigerant Real64 SourceSideOutletTemp; // Source Side Outlet Temperature [C] Real64 SourceSideVolFlowRate; // Source Side Volumetric Flow Rate [m3/s] @@ -1323,11 +1325,9 @@ namespace WaterToAirHeatPump { // Set indoor air conditions to the actual condition CpAir = PsyCpAirFnW(heatPump.InletAirHumRat); LoadSideAirInletEnth_Unit = PsyHFnTdbW(heatPump.InletAirDBTemp, heatPump.InletAirHumRat); - SourceSideFluidName = state.dataPlnt->PlantLoop(heatPump.plantLoc.loopNum).FluidName; - SourceSideFluidIndex = state.dataPlnt->PlantLoop(heatPump.plantLoc.loopNum).FluidIndex; - SourceSideVolFlowRate = heatPump.InletWaterMassFlowRate / - FluidProperties::GetDensityGlycol( - state, SourceSideFluidName, heatPump.InletWaterTemp, SourceSideFluidIndex, RoutineNameSourceSideInletTemp); + SourceSideVolFlowRate = + heatPump.InletWaterMassFlowRate / + state.dataPlnt->PlantLoop(heatPump.plantLoc.loopNum).glycol->getDensity(state, heatPump.InletWaterTemp, RoutineNameSourceSideInletTemp); StillSimulatingFlag = true; @@ -1433,14 +1433,13 @@ namespace WaterToAirHeatPump { } // Determine Effectiveness of Source Side - CpFluid = FluidProperties::GetSpecificHeatGlycol( - state, SourceSideFluidName, heatPump.InletWaterTemp, SourceSideFluidIndex, RoutineNameSourceSideInletTemp); + CpFluid = state.dataPlnt->PlantLoop(heatPump.plantLoc.loopNum) + .glycol->getSpecificHeat(state, heatPump.InletWaterTemp, RoutineNameSourceSideInletTemp); - // IF (SourceSideFluidName=='WATER') THEN - if (SourceSideFluidIndex == state.dataWaterToAirHeatPump->WaterIndex) { // SourceSideFluidName=='Water' + if (state.dataPlnt->PlantLoop(heatPump.plantLoc.loopNum).glycol->Num == Fluid::GlycolNum_Water) { SourceSideEffect = 1.0 - std::exp(-heatPump.SourceSideUACoeff / (CpFluid * heatPump.InletWaterMassFlowRate)); } else { - DegradFactor = DegradF(state, SourceSideFluidName, heatPump.InletWaterTemp, SourceSideFluidIndex); + DegradFactor = DegradF(state, state.dataPlnt->PlantLoop(heatPump.plantLoc.loopNum).glycol, heatPump.InletWaterTemp); SourceSideEffect = 1.0 / ((heatPump.SourceSideHTR1 * std::pow(SourceSideVolFlowRate, -0.8)) / DegradFactor + heatPump.SourceSideHTR2); } @@ -1490,10 +1489,8 @@ namespace WaterToAirHeatPump { LoadSideTemp = EvapTemp; // Determine the Load Side and Source Side Saturated Temp (evaporating and condensing pressures) - SourceSidePressure = FluidProperties::GetSatPressureRefrig( - state, heatPump.Refrigerant, SourceSideTemp, state.dataWaterToAirHeatPump->RefrigIndex, RoutineNameSourceSideTemp); - LoadSidePressure = FluidProperties::GetSatPressureRefrig( - state, heatPump.Refrigerant, LoadSideTemp, state.dataWaterToAirHeatPump->RefrigIndex, RoutineNameLoadSideTemp); + SourceSidePressure = heatPump.refrig->getSatPressure(state, SourceSideTemp, RoutineNameSourceSideTemp); + LoadSidePressure = heatPump.refrig->getSatPressure(state, LoadSideTemp, RoutineNameLoadSideTemp); if (LoadSidePressure < heatPump.LowPressCutoff && !FirstHVACIteration) { if (!state.dataGlobal->WarmupFlag) { @@ -1542,43 +1539,32 @@ namespace WaterToAirHeatPump { // Determine the Load Side Outlet Enthalpy (Saturated Gas) Quality = 1.0; - LoadSideOutletEnth = FluidProperties::GetSatEnthalpyRefrig( - state, heatPump.Refrigerant, LoadSideTemp, Quality, state.dataWaterToAirHeatPump->RefrigIndex, RoutineNameLoadSideTemp); + LoadSideOutletEnth = heatPump.refrig->getSatEnthalpy(state, LoadSideTemp, Quality, RoutineNameLoadSideTemp); // Determine Source Side Outlet Enthalpy (Saturated Liquid) Quality = 0.0; - SourceSideOutletEnth = FluidProperties::GetSatEnthalpyRefrig( - state, heatPump.Refrigerant, SourceSideTemp, Quality, state.dataWaterToAirHeatPump->RefrigIndex, RoutineNameSourceSideTemp); + SourceSideOutletEnth = heatPump.refrig->getSatEnthalpy(state, SourceSideTemp, Quality, RoutineNameSourceSideTemp); // Determine Superheated Temperature of the Load Side outlet/compressor Inlet CompressInletTemp = LoadSideTemp + heatPump.SuperheatTemp; // Determine the Enthalpy of the Superheated Fluid at Load Side Outlet/Compressor Inlet - SuperHeatEnth = FluidProperties::GetSupHeatEnthalpyRefrig(state, - heatPump.Refrigerant, - CompressInletTemp, - LoadSidePressure, - state.dataWaterToAirHeatPump->RefrigIndex, - RoutineNameCompressInletTemp); + SuperHeatEnth = heatPump.refrig->getSupHeatEnthalpy(state, CompressInletTemp, LoadSidePressure, RoutineNameCompressInletTemp); // Determining the suction state of the fluid from inlet state involves interation // Method employed... // Determine the saturated temp at suction pressure, shoot out into the superheated region find the enthalpy // check that with the inlet enthalpy ( as suction loss is isenthalpic). Iterate till desired accuracy is reached if (!Converged) { - CompSuctionSatTemp = FluidProperties::GetSatTemperatureRefrig( - state, heatPump.Refrigerant, SuctionPr, state.dataWaterToAirHeatPump->RefrigIndex, RoutineNameSuctionPr); + CompSuctionSatTemp = heatPump.refrig->getSatTemperature(state, SuctionPr, RoutineNameSuctionPr); CompSuctionTemp1 = CompSuctionSatTemp; // Shoot into the Superheated Region CompSuctionTemp2 = CompSuctionSatTemp + DegreeofSuperheat; } - auto f = [&state, SuctionPr, SuperHeatEnth](Real64 const CompSuctionTemp) { + auto f = [&state, &heatPump, SuctionPr, SuperHeatEnth](Real64 const CompSuctionTemp) { static constexpr std::string_view RoutineName("CalcWaterToAirHPHeating:CalcCompSuctionTemp"); - std::string Refrigerant; // Name of refrigerant - int refrigIndex = state.dataWaterToAirHeatPump->RefrigIndex; - Real64 compSuctionEnth = - FluidProperties::GetSupHeatEnthalpyRefrig(state, Refrigerant, CompSuctionTemp, SuctionPr, refrigIndex, RoutineName); + Real64 compSuctionEnth = heatPump.refrig->getSupHeatEnthalpy(state, CompSuctionTemp, SuctionPr, RoutineName); return (compSuctionEnth - SuperHeatEnth) / SuperHeatEnth; }; @@ -1588,18 +1574,10 @@ namespace WaterToAirHeatPump { heatPump.SimFlag = false; return; } - CompSuctionEnth = FluidProperties::GetSupHeatEnthalpyRefrig(state, - heatPump.Refrigerant, - state.dataWaterToAirHeatPump->CompSuctionTemp, - SuctionPr, - state.dataWaterToAirHeatPump->RefrigIndex, - RoutineNameCompSuctionTemp); - CompSuctionDensity = FluidProperties::GetSupHeatDensityRefrig(state, - heatPump.Refrigerant, - state.dataWaterToAirHeatPump->CompSuctionTemp, - SuctionPr, - state.dataWaterToAirHeatPump->RefrigIndex, - RoutineNameCompSuctionTemp); + CompSuctionEnth = heatPump.refrig->getSupHeatEnthalpy( + state, state.dataWaterToAirHeatPump->CompSuctionTemp, SuctionPr, RoutineNameCompSuctionTemp); + CompSuctionDensity = heatPump.refrig->getSupHeatDensity( + state, state.dataWaterToAirHeatPump->CompSuctionTemp, SuctionPr, RoutineNameCompSuctionTemp); // Find Refrigerant Flow Rate switch (heatPump.compressorType) { @@ -1790,11 +1768,9 @@ namespace WaterToAirHeatPump { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: // INTEGER :: NumIteration1 ! Number of Iteration1 - int NumIteration2; // Number of Iteration2 - int NumIteration3; // Number of Iteration3 - int SourceSideFluidIndex; // Source Side Fluid Index + int NumIteration2; // Number of Iteration2 + int NumIteration3; // Number of Iteration3 - std::string SourceSideFluidName; // Name of source side fluid // CHARACTER(len=25) :: CErrCount // Pressure Ratio and Leakage Rate [~] Real64 Quality; @@ -1839,11 +1815,9 @@ namespace WaterToAirHeatPump { // LOAD LOCAL VARIABLES FROM DATA STRUCTURE (for code readability) CpAir = PsyCpAirFnW(heatPump.InletAirHumRat); - SourceSideFluidName = state.dataPlnt->PlantLoop(heatPump.plantLoc.loopNum).FluidName; - SourceSideFluidIndex = state.dataPlnt->PlantLoop(heatPump.plantLoc.loopNum).FluidIndex; - SourceSideVolFlowRate = heatPump.InletWaterMassFlowRate / - FluidProperties::GetDensityGlycol( - state, SourceSideFluidName, heatPump.InletWaterTemp, SourceSideFluidIndex, RoutineNameSourceSideInletTemp); + SourceSideVolFlowRate = + heatPump.InletWaterMassFlowRate / + state.dataPlnt->PlantLoop(heatPump.plantLoc.loopNum).glycol->getDensity(state, heatPump.InletWaterTemp, RoutineNameSourceSideInletTemp); // If heat pump is not operating, return if (SensDemand == 0.0 || heatPump.InletAirMassFlowRate <= 0.0 || heatPump.InletWaterMassFlowRate <= 0.0) { @@ -1902,15 +1876,13 @@ namespace WaterToAirHeatPump { } // Determine Effectiveness of Source Side - CpFluid = FluidProperties::GetSpecificHeatGlycol( - state, SourceSideFluidName, heatPump.InletWaterTemp, SourceSideFluidIndex, RoutineNameSourceSideInletTemp); + CpFluid = state.dataPlnt->PlantLoop(heatPump.plantLoc.loopNum) + .glycol->getSpecificHeat(state, heatPump.InletWaterTemp, RoutineNameSourceSideInletTemp); - // IF (SourceSideFluidName=='WATER') THEN - if (SourceSideFluidIndex == state.dataWaterToAirHeatPump->WaterIndex) { - SourceSideEffect = - 1.0 - std::exp(-heatPump.SourceSideUACoeff / (CpFluid * heatPump.InletWaterMassFlowRate)); // SourceSideFluidName=='Water' + if (state.dataPlnt->PlantLoop(heatPump.plantLoc.loopNum).glycol->Num == Fluid::GlycolNum_Water) { + SourceSideEffect = 1.0 - std::exp(-heatPump.SourceSideUACoeff / (CpFluid * heatPump.InletWaterMassFlowRate)); } else { - DegradFactor = DegradF(state, SourceSideFluidName, heatPump.InletWaterTemp, SourceSideFluidIndex); + DegradFactor = DegradF(state, state.dataPlnt->PlantLoop(heatPump.plantLoc.loopNum).glycol, heatPump.InletWaterTemp); SourceSideEffect = 1.0 / ((heatPump.SourceSideHTR1 * std::pow(SourceSideVolFlowRate, -0.8)) / DegradFactor + heatPump.SourceSideHTR2); } @@ -1923,10 +1895,8 @@ namespace WaterToAirHeatPump { LoadSideTemp = heatPump.InletAirDBTemp + state.dataWaterToAirHeatPump->initialQLoad * LoadSideEffect_CpAir_MassFlowRate_inv; // Determine the Load Side and Source Side Saturated Temp (evaporating and condensing pressures) - SourceSidePressure = FluidProperties::GetSatPressureRefrig( - state, heatPump.Refrigerant, SourceSideTemp, state.dataWaterToAirHeatPump->RefrigIndex, RoutineNameSourceSideTemp); - LoadSidePressure = FluidProperties::GetSatPressureRefrig( - state, heatPump.Refrigerant, LoadSideTemp, state.dataWaterToAirHeatPump->RefrigIndex, RoutineNameLoadSideTemp); + SourceSidePressure = heatPump.refrig->getSatPressure(state, SourceSideTemp, RoutineNameSourceSideTemp); + LoadSidePressure = heatPump.refrig->getSatPressure(state, LoadSideTemp, RoutineNameLoadSideTemp); if (SourceSidePressure < heatPump.LowPressCutoff && !FirstHVACIteration) { if (!state.dataGlobal->WarmupFlag) { ShowRecurringWarningErrorAtEnd( @@ -1988,25 +1958,18 @@ namespace WaterToAirHeatPump { // Determine the Source Side Outlet Enthalpy // Quality of the refrigerant leaving the evaporator is saturated gas Quality = 1.0; - SourceSideOutletEnth = FluidProperties::GetSatEnthalpyRefrig( - state, heatPump.Refrigerant, SourceSideTemp, Quality, state.dataWaterToAirHeatPump->RefrigIndex, RoutineNameSourceSideTemp); + SourceSideOutletEnth = heatPump.refrig->getSatEnthalpy(state, SourceSideTemp, Quality, RoutineNameSourceSideTemp); // Determine Load Side Outlet Enthalpy // Quality of the refrigerant leaving the condenser is saturated liguid Quality = 0.0; - LoadSideOutletEnth = FluidProperties::GetSatEnthalpyRefrig( - state, heatPump.Refrigerant, LoadSideTemp, Quality, state.dataWaterToAirHeatPump->RefrigIndex, RoutineNameLoadSideTemp); + LoadSideOutletEnth = heatPump.refrig->getSatEnthalpy(state, LoadSideTemp, Quality, RoutineNameLoadSideTemp); // Determine Superheated Temperature of the Source Side outlet/compressor Inlet CompressInletTemp = SourceSideTemp + heatPump.SuperheatTemp; // Determine the Enathalpy of the Superheated Fluid at Source Side Outlet/Compressor Inlet - SuperHeatEnth = FluidProperties::GetSupHeatEnthalpyRefrig(state, - heatPump.Refrigerant, - CompressInletTemp, - SourceSidePressure, - state.dataWaterToAirHeatPump->RefrigIndex, - RoutineNameCompressInletTemp); + SuperHeatEnth = heatPump.refrig->getSupHeatEnthalpy(state, CompressInletTemp, SourceSidePressure, RoutineNameCompressInletTemp); // Determining the suction state of the fluid from inlet state involves interation // Method employed... @@ -2014,8 +1977,7 @@ namespace WaterToAirHeatPump { // check that with the inlet enthalpy ( as suction loss is isenthalpic). Iterate till desired accuracy is reached if (!Converged) { - CompSuctionSatTemp = FluidProperties::GetSatTemperatureRefrig( - state, heatPump.Refrigerant, SuctionPr, state.dataWaterToAirHeatPump->RefrigIndex, RoutineNameSuctionPr); + CompSuctionSatTemp = heatPump.refrig->getSatTemperature(state, SuctionPr, RoutineNameSuctionPr); CompSuctionTemp1 = CompSuctionSatTemp; // Shoot into the Superheated Region @@ -2045,12 +2007,9 @@ namespace WaterToAirHeatPump { // Do not need the name of the refrigerant if we already have the index (from above CALLs) - auto f = [&state, SuctionPr, SuperHeatEnth](Real64 const CompSuctionTemp) { + auto f = [&state, &heatPump, SuctionPr, SuperHeatEnth](Real64 const CompSuctionTemp) { static constexpr std::string_view RoutineName("CalcWaterToAirHPHeating:CalcCompSuctionTemp"); - std::string Refrigerant; // Name of refrigerant - int refrigIndex = state.dataWaterToAirHeatPump->RefrigIndex; - Real64 compSuctionEnth = - FluidProperties::GetSupHeatEnthalpyRefrig(state, Refrigerant, CompSuctionTemp, SuctionPr, refrigIndex, RoutineName); + Real64 compSuctionEnth = heatPump.refrig->getSupHeatEnthalpy(state, CompSuctionTemp, SuctionPr, RoutineName); return (compSuctionEnth - SuperHeatEnth) / SuperHeatEnth; }; @@ -2059,10 +2018,8 @@ namespace WaterToAirHeatPump { heatPump.SimFlag = false; return; } - CompSuctionEnth = FluidProperties::GetSupHeatEnthalpyRefrig( - state, heatPump.Refrigerant, CompSuctionTemp, SuctionPr, state.dataWaterToAirHeatPump->RefrigIndex, RoutineNameCompSuctionTemp); - CompSuctionDensity = FluidProperties::GetSupHeatDensityRefrig( - state, heatPump.Refrigerant, CompSuctionTemp, SuctionPr, state.dataWaterToAirHeatPump->RefrigIndex, RoutineNameCompSuctionTemp); + CompSuctionEnth = heatPump.refrig->getSupHeatEnthalpy(state, CompSuctionTemp, SuctionPr, RoutineNameCompSuctionTemp); + CompSuctionDensity = heatPump.refrig->getSupHeatDensity(state, CompSuctionTemp, SuctionPr, RoutineNameCompSuctionTemp); // Find Refrigerant Flow Rate switch (heatPump.compressorType) { @@ -2317,7 +2274,7 @@ namespace WaterToAirHeatPump { // Hugh I. Henderson, Jr., P.E., Kannan Rengarajan, P.E. // Using/Aliasing - auto &heatPump = state.dataWaterToAirHeatPump->WatertoAirHP(HPNum); + auto const &heatPump = state.dataWaterToAirHeatPump->WatertoAirHP(HPNum); // Return value Real64 SHReff; // Effective sensible heat ratio, includes degradation due to cycling effects @@ -2402,9 +2359,8 @@ namespace WaterToAirHeatPump { } Real64 DegradF(EnergyPlusData &state, - std::string &FluidName, // Name of glycol used in source side - Real64 &Temp, // Temperature of the fluid - int &FluidIndex // Index number for the fluid + Fluid::GlycolProps *glycol, + Real64 &Temp // Temperature of the fluid ) { // FUNCTION INFORMATION: @@ -2440,14 +2396,16 @@ namespace WaterToAirHeatPump { Real64 CpCoolant; // Specific heat of water [J/kg-K] Real64 CondCoolant; // Conductivity of water [W/m-K] - VisWater = FluidProperties::GetViscosityGlycol(state, fluidNameWater, Temp, state.dataWaterToAirHeatPump->WaterIndex, CalledFrom); - DensityWater = FluidProperties::GetDensityGlycol(state, fluidNameWater, Temp, state.dataWaterToAirHeatPump->WaterIndex, CalledFrom); - CpWater = FluidProperties::GetSpecificHeatGlycol(state, fluidNameWater, Temp, state.dataWaterToAirHeatPump->WaterIndex, CalledFrom); - CondWater = FluidProperties::GetConductivityGlycol(state, fluidNameWater, Temp, state.dataWaterToAirHeatPump->WaterIndex, CalledFrom); - VisCoolant = FluidProperties::GetViscosityGlycol(state, FluidName, Temp, FluidIndex, CalledFrom); - DensityCoolant = FluidProperties::GetDensityGlycol(state, FluidName, Temp, FluidIndex, CalledFrom); - CpCoolant = FluidProperties::GetSpecificHeatGlycol(state, FluidName, Temp, FluidIndex, CalledFrom); - CondCoolant = FluidProperties::GetConductivityGlycol(state, FluidName, Temp, FluidIndex, CalledFrom); + auto *water = Fluid::GetWater(state); + + VisWater = water->getViscosity(state, Temp, CalledFrom); + DensityWater = water->getDensity(state, Temp, CalledFrom); + CpWater = water->getSpecificHeat(state, Temp, CalledFrom); + CondWater = water->getConductivity(state, Temp, CalledFrom); + VisCoolant = glycol->getViscosity(state, Temp, CalledFrom); + DensityCoolant = glycol->getDensity(state, Temp, CalledFrom); + CpCoolant = glycol->getSpecificHeat(state, Temp, CalledFrom); + CondCoolant = glycol->getConductivity(state, Temp, CalledFrom); DegradF = std::pow(VisCoolant / VisWater, -0.47) * std::pow(DensityCoolant / DensityWater, 0.8) * std::pow(CpCoolant / CpWater, 0.33) * std::pow(CondCoolant / CondWater, 0.67); @@ -2479,7 +2437,6 @@ namespace WaterToAirHeatPump { // Obtains and Allocates WatertoAirHP related parameters from input file if (state.dataWaterToAirHeatPump->GetCoilsInputFlag) { // First time subroutine has been entered GetWatertoAirHPInput(state); - state.dataWaterToAirHeatPump->WaterIndex = FluidProperties::GetGlycolNum(state, fluidNameWater); // Initialize the WaterIndex once state.dataWaterToAirHeatPump->GetCoilsInputFlag = false; } @@ -2518,8 +2475,7 @@ namespace WaterToAirHeatPump { int WhichCoil; // Obtains and Allocates WatertoAirHP related parameters from input file - if (state.dataWaterToAirHeatPump->GetCoilsInputFlag) { // First time subroutine has been entered - state.dataWaterToAirHeatPump->WaterIndex = FluidProperties::GetGlycolNum(state, fluidNameWater); // Initialize the WaterIndex once + if (state.dataWaterToAirHeatPump->GetCoilsInputFlag) { // First time subroutine has been entered GetWatertoAirHPInput(state); state.dataWaterToAirHeatPump->GetCoilsInputFlag = false; } @@ -2574,7 +2530,6 @@ namespace WaterToAirHeatPump { // Obtains and Allocates WatertoAirHP related parameters from input file if (state.dataWaterToAirHeatPump->GetCoilsInputFlag) { // First time subroutine has been entered GetWatertoAirHPInput(state); - state.dataWaterToAirHeatPump->WaterIndex = FluidProperties::GetGlycolNum(state, fluidNameWater); // Initialize the WaterIndex once state.dataWaterToAirHeatPump->GetCoilsInputFlag = false; } @@ -2619,7 +2574,6 @@ namespace WaterToAirHeatPump { // Obtains and Allocates WatertoAirHP related parameters from input file if (state.dataWaterToAirHeatPump->GetCoilsInputFlag) { // First time subroutine has been entered GetWatertoAirHPInput(state); - state.dataWaterToAirHeatPump->WaterIndex = FluidProperties::GetGlycolNum(state, fluidNameWater); // Initialize the WaterIndex once state.dataWaterToAirHeatPump->GetCoilsInputFlag = false; } diff --git a/src/EnergyPlus/WaterToAirHeatPump.hh b/src/EnergyPlus/WaterToAirHeatPump.hh index fa20d1e4711..67303486901 100644 --- a/src/EnergyPlus/WaterToAirHeatPump.hh +++ b/src/EnergyPlus/WaterToAirHeatPump.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -55,6 +55,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -79,6 +80,7 @@ namespace WaterToAirHeatPump { std::string WatertoAirHPType; // Type of WatertoAirHP ie. Heating or Cooling DataPlant::PlantEquipmentType WAHPType; // type of component in plant std::string Refrigerant; // Refrigerant name + Fluid::RefrigProps *refrig = nullptr; bool SimFlag; Real64 InletAirMassFlowRate; // Inlet Air Mass Flow through the Water to Air Heat Pump being Simulated [kg/s] Real64 OutletAirMassFlowRate; // Outlet Air Mass Flow through the Water to Air Heat Pump being Simulated [kg/s] @@ -219,9 +221,8 @@ namespace WaterToAirHeatPump { ); Real64 DegradF(EnergyPlusData &state, - std::string &FluidName, // Name of glycol used in source side - Real64 &Temp, // Temperature of the fluid - int &FluidIndex // Index number for the fluid + Fluid::GlycolProps *glycol, + Real64 &Temp // Temperature of the fluid ); int GetCoilIndex(EnergyPlusData &state, @@ -256,8 +257,6 @@ struct WaterToAirHeatPumpData : BaseGlobalStruct int NumWatertoAirHPs; // The Number of Water to Air Heat Pumps found in the Input Array1D_bool CheckEquipName; - int RefrigIndex; // Refrigerant index - int WaterIndex; // Water index bool GetCoilsInputFlag; // Flag set to make sure you get input once bool MyOneTimeFlag; bool firstTime; @@ -279,6 +278,10 @@ struct WaterToAirHeatPumpData : BaseGlobalStruct Real64 LoadSideInletHumRat_Init = 0.0; // rated conditions Real64 LoadSideAirInletEnth_Init = 0.0; // rated conditions + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } @@ -287,8 +290,6 @@ struct WaterToAirHeatPumpData : BaseGlobalStruct { this->NumWatertoAirHPs = 0; this->CheckEquipName.clear(); - this->RefrigIndex = 0; - this->WaterIndex = 0; this->GetCoilsInputFlag = true; this->MyOneTimeFlag = true; this->firstTime = true; @@ -306,7 +307,7 @@ struct WaterToAirHeatPumpData : BaseGlobalStruct } // Default Constructor - WaterToAirHeatPumpData() : NumWatertoAirHPs(0), RefrigIndex(0), WaterIndex(0), GetCoilsInputFlag(true), MyOneTimeFlag(true), firstTime(true) + WaterToAirHeatPumpData() : NumWatertoAirHPs(0), GetCoilsInputFlag(true), MyOneTimeFlag(true), firstTime(true) { } }; diff --git a/src/EnergyPlus/WaterToAirHeatPumpSimple.cc b/src/EnergyPlus/WaterToAirHeatPumpSimple.cc index 4da0dc01b80..d05be21a4c8 100644 --- a/src/EnergyPlus/WaterToAirHeatPumpSimple.cc +++ b/src/EnergyPlus/WaterToAirHeatPumpSimple.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -50,7 +50,6 @@ // ObjexxFCL Headers #include -#include // EnergyPlus Headers #include @@ -176,7 +175,7 @@ namespace WaterToAirHeatPumpSimple { } } - auto &simpleWAHP(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum)); + auto const &simpleWAHP = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum); if (simpleWAHP.WAHPPlantType == DataPlant::PlantEquipmentType::CoilWAHPCoolingEquationFit) { // Cooling mode @@ -1126,11 +1125,8 @@ namespace WaterToAirHeatPumpSimple { simpleWatertoAirHP.PartLoadRatio = 0.0; if (simpleWatertoAirHP.RatedWaterVolFlowRate != DataSizing::AutoSize) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(simpleWatertoAirHP.plantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state.dataPlnt->PlantLoop(simpleWatertoAirHP.plantLoc.loopNum).FluidIndex, - RoutineName); + rho = + state.dataPlnt->PlantLoop(simpleWatertoAirHP.plantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName); simpleWatertoAirHP.DesignWaterMassFlowRate = rho * simpleWatertoAirHP.RatedWaterVolFlowRate; PlantUtilities::InitComponentNodes(state, @@ -1275,8 +1271,7 @@ namespace WaterToAirHeatPumpSimple { // METHODOLOGY EMPLOYED: // Obtains heating capacities and flow rates from the zone or system sizing arrays. - auto &ZoneEqSizing(state.dataSize->ZoneEqSizing); - auto &simpleWatertoAirHP(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum)); + auto &simpleWatertoAirHP = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum); // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("SizeWaterToAirCoil"); @@ -1523,7 +1518,7 @@ namespace WaterToAirHeatPumpSimple { } // cooling design day calculations if (VolFlowRate >= HVAC::SmallAirVolFlow) { - auto &finalSysSizing(state.dataSize->FinalSysSizing(state.dataSize->CurSysNum)); + auto const &finalSysSizing = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum); if (state.dataSize->CurOASysNum > 0) { // coil is in the OA stream MixTemp = finalSysSizing.OutTempAtCoolPeak; MixHumRat = finalSysSizing.OutHumRatAtCoolPeak; @@ -1658,7 +1653,7 @@ namespace WaterToAirHeatPumpSimple { if (VolFlowRate >= HVAC::SmallAirVolFlow) { // cooling design calculations if (state.dataSize->ZoneEqDXCoil) { - if (ZoneEqSizing(state.dataSize->CurZoneEqNum).OAVolFlow > 0.0) { + if (state.dataSize->ZoneEqSizing(state.dataSize->CurZoneEqNum).OAVolFlow > 0.0) { MixTemp = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolCoilInTemp; MixHumRat = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolCoilInHumRat; // calculate mixed air temperature and humidity with system airflow @@ -1797,7 +1792,7 @@ namespace WaterToAirHeatPumpSimple { VolFlowRate = HeatingAirVolFlowRateDes; // system air flow } if (VolFlowRate >= HVAC::SmallAirVolFlow) { - auto &finalSysSizing(state.dataSize->FinalSysSizing(state.dataSize->CurSysNum)); + auto const &finalSysSizing = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum); if (state.dataSize->CurOASysNum > 0) { // coil is in the OA stream MixTemp = finalSysSizing.OutTempAtCoolPeak; MixHumRat = finalSysSizing.OutHumRatAtCoolPeak; @@ -1913,7 +1908,7 @@ namespace WaterToAirHeatPumpSimple { } if (VolFlowRate >= HVAC::SmallAirVolFlow) { if (state.dataSize->ZoneEqDXCoil) { - if (ZoneEqSizing(state.dataSize->CurZoneEqNum).OAVolFlow > 0.0) { + if (state.dataSize->ZoneEqSizing(state.dataSize->CurZoneEqNum).OAVolFlow > 0.0) { MixTemp = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolCoilInTemp; MixHumRat = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolCoilInHumRat; } else { @@ -2012,8 +2007,8 @@ namespace WaterToAirHeatPumpSimple { if (!HardSizeNoDesRun) { if (RatedCapCoolTotalAutoSized) { if (simpleWatertoAirHP.CompanionHeatingCoilNum > 0) { - auto &companionHeatingCoil( - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionHeatingCoilNum)); + auto const &companionHeatingCoil = + state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionHeatingCoilNum); if (companionHeatingCoil.WAHPPlantType == DataPlant::PlantEquipmentType::CoilWAHPHeatingEquationFit && companionHeatingCoil.RatedCapHeat > 0) { // case 1: companion heating coil has a user-specified capacity @@ -2353,7 +2348,7 @@ namespace WaterToAirHeatPumpSimple { } // heating design day calculations if (VolFlowRate >= HVAC::SmallAirVolFlow) { - auto &finalSysSizing(state.dataSize->FinalSysSizing(state.dataSize->CurSysNum)); + auto const &finalSysSizing = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum); if (state.dataSize->CurOASysNum > 0) { // coil is in the OA stream HeatMixTemp = finalSysSizing.HeatOutTemp; HeatMixHumRat = finalSysSizing.HeatOutHumRat; @@ -2471,7 +2466,7 @@ namespace WaterToAirHeatPumpSimple { } if (VolFlowRate >= HVAC::SmallAirVolFlow) { if (state.dataSize->ZoneEqDXCoil) { - if (ZoneEqSizing(state.dataSize->CurZoneEqNum).OAVolFlow > 0.0) { + if (state.dataSize->ZoneEqSizing(state.dataSize->CurZoneEqNum).OAVolFlow > 0.0) { HeatMixTemp = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesHeatCoilInTemp; HeatMixHumRat = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesHeatCoilInHumRat; // calculate mixed air temperature with system airflow @@ -2580,86 +2575,92 @@ namespace WaterToAirHeatPumpSimple { // determine adjusted cooling and heating coil capacity simpleWatertoAirHP.RatedCapHeatAtRatedCdts = RatedCapHeatDes * RatedHeatCapTempModFac; - auto &companionCoolingCoil(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionCoolingCoilNum)); - if (companionCoolingCoil.WAHPPlantType == DataPlant::PlantEquipmentType::CoilWAHPCoolingEquationFit && - companionCoolingCoil.RatedCapCoolTotal == DataSizing::AutoSize) { - // case 1: companion coil is also of EquationFit type and is being autosized - RatedCapCoolTotalDes = state.dataSize->DXCoolCap; - RatedTotCapTempModFac = companionCoolingCoil.RatedCapCoolAtRatedCdts / RatedCapCoolTotalDes; - RatedCapCoolHeatDD = - simpleWatertoAirHP.RatedCapHeatAtRatedCdts / simpleWatertoAirHP.RatioRatedHeatRatedTotCoolCap / RatedTotCapTempModFac; - RatedCoolPowerTempModFac = companionCoolingCoil.RatedPowerCoolAtRatedCdts / companionCoolingCoil.RatedPowerCool; - if (RatedCapCoolHeatDD > RatedCapCoolTotalDes) { - // total cooling capacity - RatedCapCoolTotalDes = RatedCapCoolHeatDD; - // adjust for system air flow -- capacity is based on heating design day calcs - // adjust by ratio of system to heating air flow rate and temperature delta across the coil at these different airflow - if (HeatingAirVolFlowRateDes > 0) { - RatedCapCoolTotalDes *= (RatedAirVolFlowRateDes / HeatingAirVolFlowRateDes) * HeatdTratio; + if (simpleWatertoAirHP.CompanionCoolingCoilNum > 0) { + auto &companionCoolingCoil(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionCoolingCoilNum)); + if (companionCoolingCoil.WAHPPlantType == DataPlant::PlantEquipmentType::CoilWAHPCoolingEquationFit && + companionCoolingCoil.RatedCapCoolTotal == DataSizing::AutoSize) { + // case 1: companion coil is also of EquationFit type and is being autosized + RatedCapCoolTotalDes = state.dataSize->DXCoolCap; + RatedTotCapTempModFac = companionCoolingCoil.RatedCapCoolAtRatedCdts / RatedCapCoolTotalDes; + RatedCapCoolHeatDD = + simpleWatertoAirHP.RatedCapHeatAtRatedCdts / simpleWatertoAirHP.RatioRatedHeatRatedTotCoolCap / RatedTotCapTempModFac; + RatedCoolPowerTempModFac = companionCoolingCoil.RatedPowerCoolAtRatedCdts / companionCoolingCoil.RatedPowerCool; + if (RatedCapCoolHeatDD > RatedCapCoolTotalDes) { + // total cooling capacity + RatedCapCoolTotalDes = RatedCapCoolHeatDD; + // adjust for system air flow -- capacity is based on heating design day calcs + // adjust by ratio of system to heating air flow rate and temperature delta across the coil at these different airflow + if (HeatingAirVolFlowRateDes > 0) { + RatedCapCoolTotalDes *= (RatedAirVolFlowRateDes / HeatingAirVolFlowRateDes) * HeatdTratio; + } + // calculate ajustment factor over previous capacity for sensible capacity adjustment + Real64 CapCoolAdjFac = RatedCapCoolTotalDes / state.dataSize->DXCoolCap; + // update cooling coil rated capacity after adjustments based on heating coil size + state.dataSize->DXCoolCap = RatedCapCoolTotalDes; + // sensible cooling capacity + RatedCapCoolSensDes = companionCoolingCoil.RatedCapCoolSens * CapCoolAdjFac; // Assume that SHR stays the same + companionCoolingCoil.RatedCapCoolSensDesAtRatedCdts *= CapCoolAdjFac; + companionCoolingCoil.RatedCapCoolSens = RatedCapCoolSensDes; + // update Water-to-Air Heat Pumps output reports + OutputReportPredefined::PreDefTableEntry(state, + state.dataOutRptPredefined->pdchWAHPRatedSensCapAtRatedCdts, + companionCoolingCoil.Name, + companionCoolingCoil.RatedCapCoolSensDesAtRatedCdts); + OutputReportPredefined::PreDefTableEntry( + state, state.dataOutRptPredefined->pdchWAHPDD, companionCoolingCoil.Name, "Heating"); + OutputReportPredefined::PreDefTableEntry( + state, state.dataOutRptPredefined->pdchWAHPDD, simpleWatertoAirHP.Name, "Heating"); + // update Cooling Coils output reports + OutputReportPredefined::PreDefTableEntry(state, + state.dataOutRptPredefined->pdchCoolCoilLatCap, + companionCoolingCoil.Name, + RatedCapCoolTotalDes - RatedCapCoolSensDes); + OutputReportPredefined::PreDefTableEntry(state, + state.dataOutRptPredefined->pdchCoolCoilSHR, + companionCoolingCoil.Name, + RatedCapCoolSensDes / RatedCapCoolTotalDes); + OutputReportPredefined::PreDefTableEntry( + state, state.dataOutRptPredefined->pdchCoolCoilSensCap, companionCoolingCoil.Name, RatedCapCoolSensDes); + } else { + OutputReportPredefined::PreDefTableEntry( + state, state.dataOutRptPredefined->pdchWAHPDD, companionCoolingCoil.Name, "Cooling"); + OutputReportPredefined::PreDefTableEntry( + state, state.dataOutRptPredefined->pdchWAHPDD, simpleWatertoAirHP.Name, "Cooling"); } - // calculate ajustment factor over previous capacity for sensible capacity adjustment - Real64 CapCoolAdjFac = RatedCapCoolTotalDes / state.dataSize->DXCoolCap; - // update cooling coil rated capacity after adjustments based on heating coil size - state.dataSize->DXCoolCap = RatedCapCoolTotalDes; - // sensible cooling capacity - RatedCapCoolSensDes = companionCoolingCoil.RatedCapCoolSens * CapCoolAdjFac; // Assume that SHR stays the same - companionCoolingCoil.RatedCapCoolSensDesAtRatedCdts *= CapCoolAdjFac; - companionCoolingCoil.RatedCapCoolSens = RatedCapCoolSensDes; + RatedCapHeatDes = + RatedCapCoolTotalDes * RatedTotCapTempModFac * simpleWatertoAirHP.RatioRatedHeatRatedTotCoolCap / RatedHeatCapTempModFac; + companionCoolingCoil.RatedCapCoolTotal = RatedCapCoolTotalDes; + companionCoolingCoil.RatedCapCoolAtRatedCdts = RatedCapCoolTotalDes * RatedTotCapTempModFac; + companionCoolingCoil.RatedPowerCoolAtRatedCdts = + companionCoolingCoil.RatedCapCoolAtRatedCdts / companionCoolingCoil.RatedCOPCoolAtRatedCdts; + companionCoolingCoil.RatedPowerCool = companionCoolingCoil.RatedPowerCoolAtRatedCdts / RatedCoolPowerTempModFac; // update Water-to-Air Heat Pumps output reports OutputReportPredefined::PreDefTableEntry(state, - state.dataOutRptPredefined->pdchWAHPRatedSensCapAtRatedCdts, + state.dataOutRptPredefined->pdchWAHPRatedCapAtRatedCdts, companionCoolingCoil.Name, - companionCoolingCoil.RatedCapCoolSensDesAtRatedCdts); - OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchWAHPDD, companionCoolingCoil.Name, "Heating"); - OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchWAHPDD, simpleWatertoAirHP.Name, "Heating"); + companionCoolingCoil.RatedCapCoolAtRatedCdts); // update Cooling Coils output reports - OutputReportPredefined::PreDefTableEntry(state, - state.dataOutRptPredefined->pdchCoolCoilLatCap, - companionCoolingCoil.Name, - RatedCapCoolTotalDes - RatedCapCoolSensDes); - OutputReportPredefined::PreDefTableEntry(state, - state.dataOutRptPredefined->pdchCoolCoilSHR, - companionCoolingCoil.Name, - RatedCapCoolSensDes / RatedCapCoolTotalDes); OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchCoolCoilSensCap, companionCoolingCoil.Name, RatedCapCoolSensDes); - } else { - OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchWAHPDD, companionCoolingCoil.Name, "Cooling"); - OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchWAHPDD, simpleWatertoAirHP.Name, "Cooling"); + state, state.dataOutRptPredefined->pdchCoolCoilTotCap, companionCoolingCoil.Name, RatedCapCoolTotalDes); + BaseSizer::reportSizerOutput( + state, + format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast(companionCoolingCoil.WAHPType)]), + companionCoolingCoil.Name, + "Design Size Rated Total Cooling Capacity [W]", + companionCoolingCoil.RatedCapCoolTotal); + BaseSizer::reportSizerOutput( + state, + format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast(companionCoolingCoil.WAHPType)]), + companionCoolingCoil.Name, + "Design Size Rated Sensible Cooling Capacity [W]", + companionCoolingCoil.RatedCapCoolSens); + } else if (companionCoolingCoil.WAHPPlantType == + DataPlant::PlantEquipmentType::CoilWAHPCoolingEquationFit) { // case 2: companion coil is of EquationFit type but is + // not autosized + RatedCapHeatDes = companionCoolingCoil.RatedCapCoolTotal * simpleWatertoAirHP.RatioRatedHeatRatedTotCoolCap; + } else { // case 3: companion type is different than EquationFit + RatedCapHeatDes = state.dataSize->DXCoolCap; } - RatedCapHeatDes = - RatedCapCoolTotalDes * RatedTotCapTempModFac * simpleWatertoAirHP.RatioRatedHeatRatedTotCoolCap / RatedHeatCapTempModFac; - companionCoolingCoil.RatedCapCoolTotal = RatedCapCoolTotalDes; - companionCoolingCoil.RatedCapCoolAtRatedCdts = RatedCapCoolTotalDes * RatedTotCapTempModFac; - companionCoolingCoil.RatedPowerCoolAtRatedCdts = - companionCoolingCoil.RatedCapCoolAtRatedCdts / companionCoolingCoil.RatedCOPCoolAtRatedCdts; - companionCoolingCoil.RatedPowerCool = companionCoolingCoil.RatedPowerCoolAtRatedCdts / RatedCoolPowerTempModFac; - // update Water-to-Air Heat Pumps output reports - OutputReportPredefined::PreDefTableEntry(state, - state.dataOutRptPredefined->pdchWAHPRatedCapAtRatedCdts, - companionCoolingCoil.Name, - companionCoolingCoil.RatedCapCoolAtRatedCdts); - // update Cooling Coils output reports - OutputReportPredefined::PreDefTableEntry( - state, state.dataOutRptPredefined->pdchCoolCoilTotCap, companionCoolingCoil.Name, RatedCapCoolTotalDes); - BaseSizer::reportSizerOutput( - state, - format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast(companionCoolingCoil.WAHPType)]), - companionCoolingCoil.Name, - "Design Size Rated Total Cooling Capacity [W]", - companionCoolingCoil.RatedCapCoolTotal); - BaseSizer::reportSizerOutput( - state, - format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast(companionCoolingCoil.WAHPType)]), - companionCoolingCoil.Name, - "Design Size Rated Sensible Cooling Capacity [W]", - companionCoolingCoil.RatedCapCoolSens); - } else if (companionCoolingCoil.WAHPPlantType == - DataPlant::PlantEquipmentType::CoilWAHPCoolingEquationFit) { // case 2: companion coil is of EquationFit type but is - // not autosized - RatedCapHeatDes = companionCoolingCoil.RatedCapCoolTotal * simpleWatertoAirHP.RatioRatedHeatRatedTotCoolCap; - } else { // case 3: companion type is different than EquationFit - RatedCapHeatDes = state.dataSize->DXCoolCap; } // heating capacity final determination simpleWatertoAirHP.RatedCapHeat = RatedCapHeatDes; @@ -2734,8 +2735,8 @@ namespace WaterToAirHeatPumpSimple { // user provided inputs are assumed to be at rated conditions simpleWatertoAirHP.RatedPowerHeat = simpleWatertoAirHP.RatedCapHeat / simpleWatertoAirHP.RatedCOPHeatAtRatedCdts; - simpleWatertoAirHP.RatedCapHeatAtRatedCdts = 0; - simpleWatertoAirHP.RatedPowerHeatAtRatedCdts = 0; + simpleWatertoAirHP.RatedCapHeatAtRatedCdts = 0; // not sure why these are set = 0, should be RatedCapHeat? + simpleWatertoAirHP.RatedPowerHeatAtRatedCdts = 0; // should be RatedPowerHeat? } // Check that heat pump heating capacity is within 20% of cooling capacity. Check only for heating coil and report both. if (simpleWatertoAirHP.WAHPType == WatertoAirHP::Heating && simpleWatertoAirHP.CompanionCoolingCoilNum > 0) { @@ -2865,32 +2866,25 @@ namespace WaterToAirHeatPumpSimple { false); if (PltSizNum > 0) { - rho = FluidProperties::GetDensityGlycol(state, - state.dataPlnt->PlantLoop(simpleWatertoAirHP.plantLoc.loopNum).FluidName, - state.dataSize->PlantSizData(PltSizNum).ExitTemp, - state.dataPlnt->PlantLoop(simpleWatertoAirHP.plantLoc.loopNum).FluidIndex, - RoutineNameAlt); - Cp = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(simpleWatertoAirHP.plantLoc.loopNum).FluidName, - state.dataSize->PlantSizData(PltSizNum).ExitTemp, - state.dataPlnt->PlantLoop(simpleWatertoAirHP.plantLoc.loopNum).FluidIndex, - RoutineNameAlt); + rho = state.dataPlnt->PlantLoop(simpleWatertoAirHP.plantLoc.loopNum) + .glycol->getDensity(state, state.dataSize->PlantSizData(PltSizNum).ExitTemp, RoutineNameAlt); + Cp = state.dataPlnt->PlantLoop(simpleWatertoAirHP.plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataSize->PlantSizData(PltSizNum).ExitTemp, RoutineNameAlt); if (simpleWatertoAirHP.WAHPType == WatertoAirHP::Heating) { - RatedWaterVolFlowRateDes = - simpleWatertoAirHP.RatedCapHeatAtRatedCdts / (state.dataSize->PlantSizData(PltSizNum).DeltaT * Cp * rho); + RatedWaterVolFlowRateDes = simpleWatertoAirHP.RatedCapHeat / (state.dataSize->PlantSizData(PltSizNum).DeltaT * Cp * rho); } else if (simpleWatertoAirHP.WAHPType == WatertoAirHP::Cooling) { // use companion heating coil capacity to calculate volumetric flow rate if (simpleWatertoAirHP.CompanionHeatingCoilNum > 0) { - auto &companionHeatingCoil( - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionHeatingCoilNum)); + auto const &companionHeatingCoil = + state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionHeatingCoilNum); if (companionHeatingCoil.RatedCapHeat == DataSizing::AutoSize) { - SystemCapacity = simpleWatertoAirHP.RatedCapCoolTotal; + SystemCapacity = simpleWatertoAirHP.RatedCapCoolTotal; // but you should use condenser capacity? } else { SystemCapacity = companionHeatingCoil.RatedCapHeat; } } else { - SystemCapacity = simpleWatertoAirHP.RatedCapCoolAtRatedCdts; + SystemCapacity = simpleWatertoAirHP.RatedCapCoolAtRatedCdts; // RatedCapCoolTotal ? * (1 + 1/COP) ? } RatedWaterVolFlowRateDes = SystemCapacity / (state.dataSize->PlantSizData(PltSizNum).DeltaT * Cp * rho); @@ -3097,11 +3091,8 @@ namespace WaterToAirHeatPumpSimple { state.dataWaterToAirHeatPumpSimple->SourceSideMassFlowRate = simpleWatertoAirHP.WaterMassFlowRate; state.dataWaterToAirHeatPumpSimple->SourceSideInletTemp = simpleWatertoAirHP.InletWaterTemp; state.dataWaterToAirHeatPumpSimple->SourceSideInletEnth = simpleWatertoAirHP.InletWaterEnthalpy; - CpWater = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(simpleWatertoAirHP.plantLoc.loopNum).FluidName, - state.dataWaterToAirHeatPumpSimple->SourceSideInletTemp, - state.dataPlnt->PlantLoop(simpleWatertoAirHP.plantLoc.loopNum).FluidIndex, - RoutineNameSourceSideInletTemp); + CpWater = state.dataPlnt->PlantLoop(simpleWatertoAirHP.plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataWaterToAirHeatPumpSimple->SourceSideInletTemp, RoutineNameSourceSideInletTemp); // Check for flows, do not perform simulation if no flow in load side or source side. if (state.dataWaterToAirHeatPumpSimple->SourceSideMassFlowRate <= 0.0 || LoadSideFullMassFlowRate <= 0.0) { @@ -3399,11 +3390,8 @@ namespace WaterToAirHeatPumpSimple { state.dataWaterToAirHeatPumpSimple->SourceSideMassFlowRate = simpleWatertoAirHP.WaterMassFlowRate; state.dataWaterToAirHeatPumpSimple->SourceSideInletTemp = simpleWatertoAirHP.InletWaterTemp; state.dataWaterToAirHeatPumpSimple->SourceSideInletEnth = simpleWatertoAirHP.InletWaterEnthalpy; - CpWater = FluidProperties::GetSpecificHeatGlycol(state, - state.dataPlnt->PlantLoop(simpleWatertoAirHP.plantLoc.loopNum).FluidName, - state.dataWaterToAirHeatPumpSimple->SourceSideInletTemp, - state.dataPlnt->PlantLoop(simpleWatertoAirHP.plantLoc.loopNum).FluidIndex, - RoutineNameSourceSideInletTemp); + CpWater = state.dataPlnt->PlantLoop(simpleWatertoAirHP.plantLoc.loopNum) + .glycol->getSpecificHeat(state, state.dataWaterToAirHeatPumpSimple->SourceSideInletTemp, RoutineNameSourceSideInletTemp); // Check for flows, do not perform simulation if no flow in load side or source side. if (state.dataWaterToAirHeatPumpSimple->SourceSideMassFlowRate <= 0.0 || LoadSideFullMassFlowRate <= 0.0) { @@ -3714,7 +3702,7 @@ namespace WaterToAirHeatPumpSimple { Real64 Error; // Error for iteration (DO) loop Real64 LHRmult; // Latent Heat Ratio (LHR) multiplier. The effective latent heat ratio LHR = (1-SHRss)*LHRmult - auto &simpleWatertoAirHP(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum)); + auto const &simpleWatertoAirHP = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum); Twet_Rated = simpleWatertoAirHP.Twet_Rated; Gamma_Rated = simpleWatertoAirHP.Gamma_Rated; diff --git a/src/EnergyPlus/WaterToAirHeatPumpSimple.hh b/src/EnergyPlus/WaterToAirHeatPumpSimple.hh index a05490dd5f1..3a540eacf2b 100644 --- a/src/EnergyPlus/WaterToAirHeatPumpSimple.hh +++ b/src/EnergyPlus/WaterToAirHeatPumpSimple.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -308,6 +308,10 @@ struct WaterToAirHeatPumpSimpleData : BaseGlobalStruct Real64 LoadSideInletEnth_Init = 0; // rated conditions Real64 CpAir_Init = 0; // rated conditions + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/WaterUse.cc b/src/EnergyPlus/WaterUse.cc index 9d3a86681f6..4856e5343ab 100644 --- a/src/EnergyPlus/WaterUse.cc +++ b/src/EnergyPlus/WaterUse.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -50,7 +50,6 @@ // ObjexxFCL Headers #include -#include // EnergyPlus Headers #include @@ -274,11 +273,12 @@ namespace WaterUse { // AUTHOR Peter Graham Ellis // DATE WRITTEN August 2006 + static constexpr std::string_view routineName = "GetWaterUseInput"; + bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine int IOStatus; // Used in GetObjectItem int NumAlphas; // Number of Alphas for each GetObjectItem call int NumNumbers; // Number of Numbers for each GetObjectItem call - int AlphaNum; constexpr std::array(HeatRecovHX::Num)> HeatRecoverHXNamesUC{"IDEAL", "COUNTERFLOW", "CROSSFLOW"}; @@ -306,6 +306,8 @@ namespace WaterUse { state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; Util::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), state.dataIPShortCut->cCurrentModuleObject, ErrorsFound); thisWEq.Name = state.dataIPShortCut->cAlphaArgs(1); @@ -313,85 +315,46 @@ namespace WaterUse { thisWEq.PeakVolFlowRate = state.dataIPShortCut->rNumericArgs(1); - if ((NumAlphas > 2) && (!state.dataIPShortCut->lAlphaFieldBlanks(3))) { - thisWEq.FlowRateFracSchedule = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(3)); - // If no FlowRateFracSchedule, fraction defaults to 1.0 - - if (thisWEq.FlowRateFracSchedule == 0) { - ShowSevereError(state, - format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3))); - ShowContinueError(state, format("Entered in {} = {}", state.dataIPShortCut->cCurrentModuleObject, thisWEq.Name)); - ErrorsFound = true; - } + if ((NumAlphas <= 2) || (state.dataIPShortCut->lAlphaFieldBlanks(3))) { + } else if ((thisWEq.flowRateFracSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3)); + ErrorsFound = true; } - if ((NumAlphas > 3) && (!state.dataIPShortCut->lAlphaFieldBlanks(4))) { - thisWEq.TargetTempSchedule = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(4)); - - if (thisWEq.TargetTempSchedule == 0) { - ShowSevereError(state, - format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4))); - ShowContinueError(state, format("Entered in {} = {}", state.dataIPShortCut->cCurrentModuleObject, thisWEq.Name)); - ErrorsFound = true; - } + if ((NumAlphas <= 3) || (state.dataIPShortCut->lAlphaFieldBlanks(4))) { + } else if ((thisWEq.targetTempSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(4))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4)); + ErrorsFound = true; } - if ((NumAlphas > 4) && (!state.dataIPShortCut->lAlphaFieldBlanks(5))) { - thisWEq.HotTempSchedule = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(5)); - // If no HotTempSchedule, there is no hot water. - // HotTempSchedule is ignored if connected to a plant loop via WATER USE CONNECTIONS - - if (thisWEq.HotTempSchedule == 0) { - ShowSevereError(state, - format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5))); - ShowContinueError(state, format("Entered in {} = {}", state.dataIPShortCut->cCurrentModuleObject, thisWEq.Name)); - ErrorsFound = true; - } + if ((NumAlphas <= 4) || (state.dataIPShortCut->lAlphaFieldBlanks(5))) { + } else if ((thisWEq.hotTempSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(5))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5)); + ErrorsFound = true; } - if ((NumAlphas > 5) && (!state.dataIPShortCut->lAlphaFieldBlanks(6))) { - thisWEq.ColdTempSchedule = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(6)); - // If no ColdTempSchedule, temperatures will be calculated by WATER MAINS TEMPERATURES object - - if (thisWEq.ColdTempSchedule == 0) { - ShowSevereError(state, - format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(6), state.dataIPShortCut->cAlphaArgs(6))); - ShowContinueError(state, format("Entered in {} = {}", state.dataIPShortCut->cCurrentModuleObject, thisWEq.Name)); - ErrorsFound = true; - } + if ((NumAlphas <= 5) || (state.dataIPShortCut->lAlphaFieldBlanks(6))) { + } else if ((thisWEq.coldTempSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(6))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(6), state.dataIPShortCut->cAlphaArgs(6)); + ErrorsFound = true; } - if ((NumAlphas > 6) && (!state.dataIPShortCut->lAlphaFieldBlanks(7))) { - thisWEq.Zone = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(7), state.dataHeatBal->Zone); - - if (thisWEq.Zone == 0) { - ShowSevereError(state, - format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(7), state.dataIPShortCut->cAlphaArgs(7))); - ShowContinueError(state, format("Entered in {} = {}", state.dataIPShortCut->cCurrentModuleObject, thisWEq.Name)); - ErrorsFound = true; - } + if ((NumAlphas <= 6) || (state.dataIPShortCut->lAlphaFieldBlanks(7))) { + } else if ((thisWEq.Zone = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(7), state.dataHeatBal->Zone)) == 0) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(7), state.dataIPShortCut->cAlphaArgs(7)); + ErrorsFound = true; } - if ((NumAlphas > 7) && (!state.dataIPShortCut->lAlphaFieldBlanks(8))) { - thisWEq.SensibleFracSchedule = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(8)); - - if (thisWEq.SensibleFracSchedule == 0) { - ShowSevereError(state, - format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(8), state.dataIPShortCut->cAlphaArgs(8))); - ShowContinueError(state, format("Entered in {} = {}", state.dataIPShortCut->cCurrentModuleObject, thisWEq.Name)); - ErrorsFound = true; - } + if ((NumAlphas <= 7) || (state.dataIPShortCut->lAlphaFieldBlanks(8))) { + } else if ((thisWEq.sensibleFracSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(8))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(8), state.dataIPShortCut->cAlphaArgs(8)); + ErrorsFound = true; } - if ((NumAlphas > 8) && (!state.dataIPShortCut->lAlphaFieldBlanks(9))) { - thisWEq.LatentFracSchedule = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(9)); - - if (thisWEq.LatentFracSchedule == 0) { - ShowSevereError(state, - format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(9), state.dataIPShortCut->cAlphaArgs(9))); - ShowContinueError(state, format("Entered in {} = {}", state.dataIPShortCut->cCurrentModuleObject, thisWEq.Name)); - ErrorsFound = true; - } + if ((NumAlphas <= 8) || (state.dataIPShortCut->lAlphaFieldBlanks(9))) { + } else if ((thisWEq.latentFracSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(9))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(9), state.dataIPShortCut->cAlphaArgs(9)); + ErrorsFound = true; } } // WaterEquipNum @@ -419,6 +382,9 @@ namespace WaterUse { state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + Util::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), state.dataIPShortCut->cCurrentModuleObject, ErrorsFound); auto &waterConnection = state.dataWaterUse->WaterConnections(WaterConnNum); waterConnection.Name = state.dataIPShortCut->cAlphaArgs(1); @@ -475,29 +441,16 @@ namespace WaterUse { waterConnection.TankSupplyID); } - if (!state.dataIPShortCut->lAlphaFieldBlanks(6)) { - waterConnection.HotTempSchedule = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(6)); - // If no HotTempSchedule, there is no hot water. - // HotTempSchedule is ignored if connected to a plant loop via WATER USE CONNECTIONS - - if (waterConnection.HotTempSchedule == 0) { - ShowSevereError(state, - format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(6), state.dataIPShortCut->cAlphaArgs(6))); - ShowContinueError(state, format("Entered in {} = {}", state.dataIPShortCut->cCurrentModuleObject, waterConnection.Name)); - ErrorsFound = true; - } + if (state.dataIPShortCut->lAlphaFieldBlanks(6)) { + } else if ((waterConnection.hotTempSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(6))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(6), state.dataIPShortCut->cAlphaArgs(6)); + ErrorsFound = true; } - if (!state.dataIPShortCut->lAlphaFieldBlanks(7)) { - waterConnection.ColdTempSchedule = ScheduleManager::GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(7)); - // If no ColdTempSchedule, temperatures will be calculated by WATER MAINS TEMPERATURES object - - if (waterConnection.ColdTempSchedule == 0) { - ShowSevereError(state, - format("Invalid {} = {}", state.dataIPShortCut->cAlphaFieldNames(7), state.dataIPShortCut->cAlphaArgs(7))); - ShowContinueError(state, format("Entered in {} = {}", state.dataIPShortCut->cCurrentModuleObject, waterConnection.Name)); - ErrorsFound = true; - } + if (state.dataIPShortCut->lAlphaFieldBlanks(7)) { + } else if ((waterConnection.coldTempSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(7))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(7), state.dataIPShortCut->cAlphaArgs(7)); + ErrorsFound = true; } if ((!state.dataIPShortCut->lAlphaFieldBlanks(8)) && (state.dataIPShortCut->cAlphaArgs(8) != "NONE")) { @@ -525,7 +478,7 @@ namespace WaterUse { waterConnection.myWaterEquipArr.allocate(NumAlphas - 9); - for (AlphaNum = 10; AlphaNum <= NumAlphas; ++AlphaNum) { + for (int AlphaNum = 10; AlphaNum <= NumAlphas; ++AlphaNum) { int WaterEquipNum = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(AlphaNum), state.dataWaterUse->WaterEquipment); if (WaterEquipNum == 0) { @@ -588,7 +541,8 @@ namespace WaterUse { for (auto &waterEquipment : state.dataWaterUse->WaterEquipment) { // set logical if either hot water temp or target temp schedule are missing (will use cold water otherwise) // if a connections object is used then don't need to hot temp schedule - waterEquipment.allowHotControl = (waterEquipment.TargetTempSchedule && waterEquipment.HotTempSchedule) || waterEquipment.Connections; + waterEquipment.allowHotControl = + (waterEquipment.targetTempSched != nullptr && waterEquipment.hotTempSched != nullptr) || waterEquipment.Connections; } } @@ -1031,21 +985,12 @@ namespace WaterUse { } else { // Get water temperature conditions from the WATER USE EQUIPMENT schedules - if (this->ColdTempSchedule > 0) { - this->ColdTemp = ScheduleManager::GetCurrentScheduleValue(state, this->ColdTempSchedule); - } else { // If no ColdTempSchedule, use the mains temperature - this->ColdTemp = state.dataEnvrn->WaterMainsTemp; - } - - if (this->HotTempSchedule > 0) { - this->HotTemp = ScheduleManager::GetCurrentScheduleValue(state, this->HotTempSchedule); - } else { // If no HotTempSchedule, use all cold water - this->HotTemp = this->ColdTemp; - } + this->ColdTemp = (this->coldTempSched != nullptr) ? this->coldTempSched->getCurrentVal() : state.dataEnvrn->WaterMainsTemp; + this->HotTemp = (this->hotTempSched != nullptr) ? this->hotTempSched->getCurrentVal() : this->ColdTemp; } - if (this->TargetTempSchedule > 0) { - this->TargetTemp = ScheduleManager::GetCurrentScheduleValue(state, this->TargetTempSchedule); + if (this->targetTempSched != nullptr) { + this->TargetTemp = this->targetTempSched->getCurrentVal(); } else if (this->allowHotControl) { // If no TargetTempSchedule, but allowHotControl is set, use all hot water if applicable this->TargetTemp = this->HotTemp; } else { // If no TargetTempSchedule, use all cold water @@ -1053,21 +998,10 @@ namespace WaterUse { } // Get the requested total flow rate - if (this->Zone > 0) { - if (this->FlowRateFracSchedule > 0) { - this->TotalVolFlowRate = this->PeakVolFlowRate * ScheduleManager::GetCurrentScheduleValue(state, this->FlowRateFracSchedule) * - state.dataHeatBal->Zone(this->Zone).Multiplier * state.dataHeatBal->Zone(this->Zone).ListMultiplier; - } else { - this->TotalVolFlowRate = - this->PeakVolFlowRate * state.dataHeatBal->Zone(this->Zone).Multiplier * state.dataHeatBal->Zone(this->Zone).ListMultiplier; - } - } else { - if (this->FlowRateFracSchedule > 0) { - this->TotalVolFlowRate = this->PeakVolFlowRate * ScheduleManager::GetCurrentScheduleValue(state, this->FlowRateFracSchedule); - } else { - this->TotalVolFlowRate = this->PeakVolFlowRate; - } - } + this->TotalVolFlowRate = this->PeakVolFlowRate; + if (this->Zone > 0) + this->TotalVolFlowRate *= state.dataHeatBal->Zone(this->Zone).Multiplier * state.dataHeatBal->Zone(this->Zone).ListMultiplier; + if (this->flowRateFracSched != nullptr) this->TotalVolFlowRate *= this->flowRateFracSched->getCurrentVal(); this->TotalMassFlowRate = this->TotalVolFlowRate * calcH2ODensity(state); @@ -1235,16 +1169,16 @@ namespace WaterUse { } else { auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(this->Zone); - if (this->SensibleFracSchedule == 0) { + if (this->sensibleFracSched == nullptr) { this->SensibleRate = 0.0; this->SensibleEnergy = 0.0; } else { - this->SensibleRate = ScheduleManager::GetCurrentScheduleValue(state, this->SensibleFracSchedule) * this->TotalMassFlowRate * + this->SensibleRate = this->sensibleFracSched->getCurrentVal() * this->TotalMassFlowRate * Psychrometrics::CPHW(Constant::InitConvTemp) * (this->MixedTemp - thisZoneHB.MAT); this->SensibleEnergy = this->SensibleRate * state.dataHVACGlobal->TimeStepSysSec; } - if (this->LatentFracSchedule == 0) { + if (this->latentFracSched == nullptr) { this->LatentRate = 0.0; this->LatentEnergy = 0.0; } else { @@ -1260,7 +1194,7 @@ namespace WaterUse { Real64 FlowMassMax = this->TotalMassFlowRate * state.dataHVACGlobal->TimeStepSysSec; // Max water in flow Real64 MoistureMassMax = min(ZoneMassMax, FlowMassMax); - this->MoistureMass = ScheduleManager::GetCurrentScheduleValue(state, this->LatentFracSchedule) * MoistureMassMax; + this->MoistureMass = this->latentFracSched->getCurrentVal() * MoistureMassMax; this->MoistureRate = this->MoistureMass / (state.dataHVACGlobal->TimeStepSysSec); this->LatentRate = this->MoistureRate * Psychrometrics::PsyHfgAirFnWTdb(ZoneHumRat, thisZoneHB.MAT); @@ -1291,8 +1225,8 @@ namespace WaterUse { if (this->SupplyTankNum > 0) { this->ColdSupplyTemp = state.dataWaterData->WaterStorage(this->SupplyTankNum).Twater; - } else if (this->ColdTempSchedule > 0) { - this->ColdSupplyTemp = ScheduleManager::GetCurrentScheduleValue(state, this->ColdTempSchedule); + } else if (this->coldTempSched != nullptr) { + this->ColdSupplyTemp = this->coldTempSched->getCurrentVal(); } else { this->ColdSupplyTemp = state.dataEnvrn->WaterMainsTemp; @@ -1303,13 +1237,7 @@ namespace WaterUse { // Set the hot water temperature if (this->StandAlone) { - if (this->HotTempSchedule > 0) { - this->HotTemp = ScheduleManager::GetCurrentScheduleValue(state, this->HotTempSchedule); - } else { - // If no HotTempSchedule, use all cold water - this->HotTemp = this->ColdTemp; - } - + this->HotTemp = (this->hotTempSched != nullptr) ? this->hotTempSched->getCurrentVal() : this->ColdTemp; } else { if (state.dataGlobal->BeginEnvrnFlag && this->Init) { @@ -1658,7 +1586,7 @@ namespace WaterUse { // PURPOSE OF THIS SUBROUTINE: // Calculates the zone internal gains due to water use sensible and latent loads. - bool MyEnvrnFlagLocal(true); + static bool MyEnvrnFlagLocal = true; if (state.dataWaterUse->numWaterEquipment == 0) return; @@ -1701,8 +1629,7 @@ namespace WaterUse { static constexpr std::string_view RoutineName{"calcH2ODensity"}; if (state.dataWaterUse->calcRhoH2O) { - int DummyValue = 1; - state.dataWaterUse->rhoH2OStd = FluidProperties::GetDensityGlycol(state, "WATER", Constant::InitConvTemp, DummyValue, RoutineName); + state.dataWaterUse->rhoH2OStd = Fluid::GetWater(state)->getDensity(state, Constant::InitConvTemp, RoutineName); state.dataWaterUse->calcRhoH2O = false; } return state.dataWaterUse->rhoH2OStd; diff --git a/src/EnergyPlus/WaterUse.hh b/src/EnergyPlus/WaterUse.hh index 6856c345130..99d8ea97d8d 100644 --- a/src/EnergyPlus/WaterUse.hh +++ b/src/EnergyPlus/WaterUse.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -87,9 +87,9 @@ namespace WaterUse { { std::string Name; // Name of DHW std::string EndUseSubcatName; - int Connections = 0; // Index for WATER USE CONNECTIONS object - Real64 PeakVolFlowRate = 0.0; // Peak volumetric flow rate, also water consumption rate (m3/s) - int FlowRateFracSchedule = 0; // Pointer to schedule object + int Connections = 0; // Index for WATER USE CONNECTIONS object + Real64 PeakVolFlowRate = 0.0; // Peak volumetric flow rate, also water consumption rate (m3/s) + Sched::Schedule *flowRateFracSched = nullptr; // pointer to schedule object // Now it is Real64 ColdVolFlowRate = 0.0; Real64 HotVolFlowRate = 0.0; Real64 TotalVolFlowRate = 0.0; // Volumetric flow rate, also water consumption rate (m3/s) @@ -97,26 +97,26 @@ namespace WaterUse { Real64 HotMassFlowRate = 0.0; Real64 TotalMassFlowRate = 0.0; // Mass flow rate (kg/s) Real64 DrainMassFlowRate = 0.0; - int ColdTempSchedule = 0; // Index for schedule object - int HotTempSchedule = 0; // Index for schedule object - int TargetTempSchedule = 0; // Index for schedule object - Real64 ColdTemp = 0.0; // Cold supply water temperature (C) - Real64 HotTemp = 0.0; // Hot supply water temperature (C) - Real64 TargetTemp = 0.0; // Target (mixed) water temperature (C) - Real64 MixedTemp = 0.0; // Actual outlet (mixed) water temperature (C) + Sched::Schedule *coldTempSched = nullptr; // schedule object + Sched::Schedule *hotTempSched = nullptr; // schedule object + Sched::Schedule *targetTempSched = nullptr; // schedule object + Real64 ColdTemp = 0.0; // Cold supply water temperature (C) + Real64 HotTemp = 0.0; // Hot supply water temperature (C) + Real64 TargetTemp = 0.0; // Target (mixed) water temperature (C) + Real64 MixedTemp = 0.0; // Actual outlet (mixed) water temperature (C) Real64 DrainTemp = 0.0; - int CWHWTempErrorCount = 0; // - counter if hot water temp is less than cold water temp - int CWHWTempErrIndex = 0; // - index to recurring error structure for hot water temp - int TargetHWTempErrorCount = 0; // - counter for target water temp error - int TargetHWTempErrIndex = 0; // - index to recurring error structure for target water temp - int TargetCWTempErrorCount = 0; // - counter for target water temp error - int TargetCWTempErrIndex = 0; // - index to recurring error structure for target water temp - int Zone = 0; // Index for zone object - int SensibleFracSchedule = 0; // Pointer to schedule object + int CWHWTempErrorCount = 0; // - counter if hot water temp is less than cold water temp + int CWHWTempErrIndex = 0; // - index to recurring error structure for hot water temp + int TargetHWTempErrorCount = 0; // - counter for target water temp error + int TargetHWTempErrIndex = 0; // - index to recurring error structure for target water temp + int TargetCWTempErrorCount = 0; // - counter for target water temp error + int TargetCWTempErrIndex = 0; // - index to recurring error structure for target water temp + int Zone = 0; // Index for zone object + Sched::Schedule *sensibleFracSched = nullptr; // schedule object Real64 SensibleRate = 0.0; Real64 SensibleEnergy = 0.0; Real64 SensibleRateNoMultiplier = 0.0; - int LatentFracSchedule = 0; // Pointer to schedule object + Sched::Schedule *latentFracSched = nullptr; // schedule object Real64 LatentRate = 0.0; Real64 LatentEnergy = 0.0; Real64 LatentRateNoMultiplier = 0.0; @@ -179,13 +179,13 @@ namespace WaterUse { Real64 HotVolFlowRate = 0.0; // Volumetric flow rate, also water consumption rate (m3/s) Real64 TotalVolFlowRate = 0.0; // Volumetric flow rate, also water consumption rate (m3/s) Real64 DrainVolFlowRate = 0.0; - Real64 PeakMassFlowRate = 0.0; // Peak Mass flow rate for MassFlowRateMax - int ColdTempSchedule = 0; // Index for schedule object - int HotTempSchedule = 0; // Index for schedule object - Real64 TankTemp = 0.0; // Cold supply water temperature (C) - Real64 ColdSupplyTemp = 0.0; // cold from mains, schedule, or tank, depending - Real64 ColdTemp = 0.0; // Cold supply water temperature (C) actual cold (could be reheated) - Real64 HotTemp = 0.0; // Hot supply water temperature (C) + Real64 PeakMassFlowRate = 0.0; // Peak Mass flow rate for MassFlowRateMax + Sched::Schedule *coldTempSched = nullptr; // schedule object + Sched::Schedule *hotTempSched = nullptr; // schedule object + Real64 TankTemp = 0.0; // Cold supply water temperature (C) + Real64 ColdSupplyTemp = 0.0; // cold from mains, schedule, or tank, depending + Real64 ColdTemp = 0.0; // Cold supply water temperature (C) actual cold (could be reheated) + Real64 HotTemp = 0.0; // Hot supply water temperature (C) Real64 DrainTemp = 0.0; Real64 RecoveryTemp = 0.0; Real64 ReturnTemp = 0.0; @@ -255,6 +255,10 @@ struct WaterUseData : BaseGlobalStruct EPVector WaterEquipment; EPVector WaterConnections; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/WeatherManager.cc b/src/EnergyPlus/WeatherManager.cc index 3738697f0c8..81a6570e9d8 100644 --- a/src/EnergyPlus/WeatherManager.cc +++ b/src/EnergyPlus/WeatherManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -54,7 +54,6 @@ // ObjexxFCL Headers #include #include -#include #include #include @@ -73,7 +72,7 @@ #include #include #include -#include +#include #include #include #include @@ -144,9 +143,9 @@ namespace Weather { InitializeWeather(state, state.dataWeather->PrintEnvrnStamp); - bool anyEMSRan = false; // Cannot call this during sizing, because EMS will not initialize properly until after simulation kickoff if (!state.dataGlobal->DoingSizing && !state.dataGlobal->KickOffSimulation) { + bool anyEMSRan = false; EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::BeginZoneTimestepBeforeSetCurrentWeather, anyEMSRan, @@ -197,16 +196,18 @@ namespace Weather { ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(1), ipsc->cAlphaArgs(1)); errorsFound = true; } - underwaterBoundary.WaterTempScheduleIndex = ScheduleManager::GetScheduleIndex(state, ipsc->cAlphaArgs(2)); - if (underwaterBoundary.WaterTempScheduleIndex == 0) { + + if (ipsc->lAlphaFieldBlanks(2)) { + ShowSevereEmptyField(state, eoh, ipsc->cAlphaFieldNames(2)); + errorsFound = true; + } else if ((underwaterBoundary.waterTempSched = Sched::GetSchedule(state, ipsc->cAlphaArgs(2))) == nullptr) { ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(2), ipsc->cAlphaArgs(2)); errorsFound = true; } if (ipsc->lAlphaFieldBlanks(3)) { // that's OK, we can have a blank schedule, the water will just have no free stream velocity - underwaterBoundary.VelocityScheduleIndex = 0; - } else if ((underwaterBoundary.VelocityScheduleIndex = ScheduleManager::GetScheduleIndex(state, ipsc->cAlphaArgs(3))) == 0) { + } else if ((underwaterBoundary.velocitySched = Sched::GetSchedule(state, ipsc->cAlphaArgs(3))) == nullptr) { ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(3), ipsc->cAlphaArgs(3)); errorsFound = true; } @@ -248,10 +249,10 @@ namespace Weather { void UpdateUnderwaterBoundaries(EnergyPlusData &state) { for (auto &thisBoundary : state.dataWeather->underwaterBoundaries) { - Real64 const curWaterTemp = ScheduleManager::GetCurrentScheduleValue(state, thisBoundary.WaterTempScheduleIndex); // C + Real64 const curWaterTemp = thisBoundary.waterTempSched->getCurrentVal(); // C Real64 freeStreamVelocity = 0; - if (thisBoundary.VelocityScheduleIndex > 0) { - freeStreamVelocity = ScheduleManager::GetCurrentScheduleValue(state, thisBoundary.VelocityScheduleIndex); // m/s + if (thisBoundary.velocitySched != nullptr) { + freeStreamVelocity = thisBoundary.velocitySched->getCurrentVal(); // m/s } state.dataSurface->OSCM(thisBoundary.OSCMIndex).TConv = curWaterTemp; state.dataSurface->OSCM(thisBoundary.OSCMIndex).HConv = @@ -263,6 +264,8 @@ namespace Weather { void ReadVariableLocationOrientation(EnergyPlusData &state) { + static constexpr std::string_view routineName = "ReadVariableLocationOrientation"; + int NumAlpha = 0, NumNumber = 0, IOStat = 0; auto const &ipsc = state.dataIPShortCut; @@ -280,27 +283,41 @@ namespace Weather { ipsc->lAlphaFieldBlanks, ipsc->cAlphaFieldNames, ipsc->cNumericFieldNames); - state.dataEnvrn->varyingLocationSchedIndexLat = ScheduleManager::GetScheduleIndex(state, ipsc->cAlphaArgs(1)); - state.dataEnvrn->varyingLocationSchedIndexLong = ScheduleManager::GetScheduleIndex(state, ipsc->cAlphaArgs(2)); - state.dataEnvrn->varyingOrientationSchedIndex = ScheduleManager::GetScheduleIndex(state, ipsc->cAlphaArgs(3)); + + ErrorObjectHeader eoh{routineName, ipsc->cCurrentModuleObject, ""}; + + if (ipsc->lAlphaFieldBlanks(1)) { + } else if ((state.dataEnvrn->varyingLocationLatSched = Sched::GetSchedule(state, ipsc->cAlphaArgs(1))) == nullptr) { + ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(1), ipsc->cAlphaArgs(1)); + } + + if (ipsc->lAlphaFieldBlanks(2)) { + } else if ((state.dataEnvrn->varyingLocationLongSched = Sched::GetSchedule(state, ipsc->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(2), ipsc->cAlphaArgs(2)); + } + + if (ipsc->lAlphaFieldBlanks(3)) { + } else if ((state.dataEnvrn->varyingOrientationSched = Sched::GetSchedule(state, ipsc->cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(3), ipsc->cAlphaArgs(3)); + } } void UpdateLocationAndOrientation(EnergyPlusData &state) { - if (state.dataEnvrn->varyingLocationSchedIndexLat > 0) { - state.dataEnvrn->Latitude = ScheduleManager::GetCurrentScheduleValue(state, state.dataEnvrn->varyingLocationSchedIndexLat); + if (state.dataEnvrn->varyingLocationLatSched != nullptr) { + state.dataEnvrn->Latitude = state.dataEnvrn->varyingLocationLatSched->getCurrentVal(); } - if (state.dataEnvrn->varyingLocationSchedIndexLong > 0) { - state.dataEnvrn->Longitude = ScheduleManager::GetCurrentScheduleValue(state, state.dataEnvrn->varyingLocationSchedIndexLong); + if (state.dataEnvrn->varyingLocationLongSched != nullptr) { + state.dataEnvrn->Longitude = state.dataEnvrn->varyingLocationLongSched->getCurrentVal(); } + CheckLocationValidity(state); - if (state.dataEnvrn->varyingOrientationSchedIndex > 0) { - state.dataHeatBal->BuildingAzimuth = - mod(ScheduleManager::GetCurrentScheduleValue(state, state.dataEnvrn->varyingOrientationSchedIndex), 360.0); + if (state.dataEnvrn->varyingOrientationSched != nullptr) { + state.dataHeatBal->BuildingAzimuth = mod(state.dataEnvrn->varyingOrientationSched->getCurrentVal(), 360.0); state.dataSurfaceGeometry->CosBldgRelNorth = - std::cos(-(state.dataHeatBal->BuildingAzimuth + state.dataHeatBal->BuildingRotationAppendixG) * Constant::DegToRadians); + std::cos(-(state.dataHeatBal->BuildingAzimuth + state.dataHeatBal->BuildingRotationAppendixG) * Constant::DegToRad); state.dataSurfaceGeometry->SinBldgRelNorth = - std::sin(-(state.dataHeatBal->BuildingAzimuth + state.dataHeatBal->BuildingRotationAppendixG) * Constant::DegToRadians); + std::sin(-(state.dataHeatBal->BuildingAzimuth + state.dataHeatBal->BuildingRotationAppendixG) * Constant::DegToRad); for (size_t SurfNum = 1; SurfNum < state.dataSurface->Surface.size(); ++SurfNum) { auto &surf = state.dataSurface->Surface(SurfNum); for (int n = 1; n <= surf.Sides; ++n) { @@ -316,8 +333,8 @@ namespace Weather { Vectors::DetermineAzimuthAndTilt( surf.NewVertex, SurfWorldAz, SurfTilt, surf.lcsx, surf.lcsy, surf.lcsz, surf.NewellSurfaceNormalVector); surf.Azimuth = SurfWorldAz; - surf.SinAzim = std::sin(SurfWorldAz * Constant::DegToRadians); - surf.CosAzim = std::cos(SurfWorldAz * Constant::DegToRadians); + surf.SinAzim = std::sin(SurfWorldAz * Constant::DegToRad); + surf.CosAzim = std::cos(SurfWorldAz * Constant::DegToRad); surf.OutNormVec = surf.NewellSurfaceNormalVector; } } @@ -341,12 +358,6 @@ namespace Weather { static constexpr std::string_view EnvDSTYFormat("Environment:Daylight Saving,Yes,{},{},{}\n"); static constexpr std::string_view DateFormat("{:02}/{:02}"); static constexpr std::string_view DateFormatWithYear("{:02}/{:02}/{:04}"); - std::string StDate; - std::string EnDate; - int DSTActStMon; - int DSTActStDay; - int DSTActEnMon; - int DSTActEnDay; if (state.dataGlobal->BeginSimFlag && state.dataWeather->GetEnvironmentFirstCall) { @@ -688,7 +699,7 @@ namespace Weather { if (state.dataWeather->GetBranchInputOneTimeFlag) { SetupInterpolationValues(state); - state.dataWeather->TimeStepFraction = 1.0 / double(state.dataGlobal->NumOfTimeStepInHour); + state.dataWeather->TimeStepFraction = 1.0 / double(state.dataGlobal->TimeStepsInHour); state.dataEnvrn->rhoAirSTP = Psychrometrics::PsyRhoAirFnPbTdbW( state, DataEnvironment::StdPressureSeaLevel, DataPrecisionGlobals::constant_twenty, DataPrecisionGlobals::constant_zero); OpenWeatherFile(state, ErrorsFound); // moved here because of possibility of special days on EPW file @@ -696,7 +707,7 @@ namespace Weather { ReadUserWeatherInput(state); AllocateWeatherData(state); if (state.dataWeather->NumIntervalsPerHour != 1) { - if (state.dataWeather->NumIntervalsPerHour != state.dataGlobal->NumOfTimeStepInHour) { + if (state.dataWeather->NumIntervalsPerHour != state.dataGlobal->TimeStepsInHour) { ShowSevereError( state, format("{}Number of intervals per hour on Weather file does not match specified number of Time Steps Per Hour", RoutineName)); @@ -833,8 +844,14 @@ namespace Weather { state.dataWeather->PrntEnvHeaders = false; } + std::string StDate; + std::string EnDate; if ((state.dataGlobal->KindOfSim == Constant::KindOfSim::RunPeriodWeather) || (state.dataGlobal->KindOfSim == Constant::KindOfSim::RunPeriodDesign)) { + int DSTActStMon = 0; + int DSTActStDay = 0; + int DSTActEnMon = 0; + int DSTActEnDay = 0; std::string kindOfRunPeriod = envCurr.cKindOfEnvrn; state.dataEnvrn->RunPeriodEnvironment = state.dataGlobal->KindOfSim == Constant::KindOfSim::RunPeriodWeather; state.dataEnvrn->CurrentYearIsLeapYear = state.dataWeather->Environment(state.dataWeather->Envrn).IsLeapYear; @@ -868,7 +885,7 @@ namespace Weather { if (envCurr.ActualWeather) { // Actual weather - for (auto &dataperiod : state.dataWeather->DataPeriods) { + for (auto const &dataperiod : state.dataWeather->DataPeriods) { int runStartJulian = dataperiod.DataStJDay; int runEndJulian = dataperiod.DataEnJDay; if (!dataperiod.HasYearData) { @@ -977,7 +994,7 @@ namespace Weather { kindOfRunPeriod, StDate, EnDate, - ScheduleManager::dayTypeNames[TWeekDay], + Sched::dayTypeNames[TWeekDay], fmt::to_string(envCurr.TotalDays), "Use RunPeriod Specified Day", AlpUseDST, @@ -1094,15 +1111,15 @@ namespace Weather { } else if (state.dataGlobal->DoOutputReporting) { print(state.files.eio, EnvDSTNFormat, Source); } - for (int i = 1; i <= state.dataWeather->NumSpecialDays; ++i) { - auto &specialDay = state.dataWeather->SpecialDays(i); + for (int k = 1; k <= state.dataWeather->NumSpecialDays; ++k) { + auto &specialDay = state.dataWeather->SpecialDays(k); static constexpr std::string_view EnvSpDyFormat("Environment:Special Days,{},{},{},{},{:3}\n"); if (specialDay.WthrFile && state.dataWeather->UseSpecialDays && state.dataReportFlag->DoWeatherInitReporting) { StDate = format(DateFormat, specialDay.ActStMon, specialDay.ActStDay); print(state.files.eio, EnvSpDyFormat, specialDay.Name, - ScheduleManager::dayTypeNames[specialDay.DayType], + Sched::dayTypeNames[specialDay.DayType], "WeatherFile", StDate, specialDay.Duration); @@ -1112,7 +1129,7 @@ namespace Weather { print(state.files.eio, EnvSpDyFormat, specialDay.Name, - ScheduleManager::dayTypeNames[specialDay.DayType], + Sched::dayTypeNames[specialDay.DayType], "InputFile", StDate, specialDay.Duration); @@ -1133,7 +1150,7 @@ namespace Weather { "SizingPeriod:DesignDay", StDate, EnDate, - ScheduleManager::dayTypeNames[desDayInput.DayType], + Sched::dayTypeNames[desDayInput.DayType], "1", "N/A", "N/A", @@ -1226,7 +1243,7 @@ namespace Weather { CurWeekDay -= 7; } WeekDays(i) = CurWeekDay; - } else if ((i >= 4) && (i <= 12)) { + } else { CurWeekDay += state.dataWeather->EndDayOfMonth(i - 1); while (CurWeekDay > 7) { CurWeekDay -= 7; @@ -1324,7 +1341,7 @@ namespace Weather { CurWeekDay -= 7; } WeekDays(i) = CurWeekDay; - } else if ((i >= 4) && (i <= 12)) { + } else { CurWeekDay += state.dataWeather->EndDayOfMonth(i - 1); while (CurWeekDay > 7) { CurWeekDay -= 7; @@ -1419,7 +1436,7 @@ namespace Weather { CurWeekDay -= 7; } WeekDays(i) = CurWeekDay; - } else if ((i >= 4) && (i <= 12)) { + } else { CurWeekDay += state.dataWeather->EndDayOfMonth(i - 1); while (CurWeekDay > 7) { CurWeekDay -= 7; @@ -1588,11 +1605,11 @@ namespace Weather { if (specialDay.dateType <= DateType::MonthDay) { JDay = General::OrdinalDay(specialDay.Month, specialDay.Day, state.dataWeather->LeapYearAdd); if (specialDay.Duration == 1 && state.dataWeather->Environment(state.dataWeather->Envrn).ApplyWeekendRule) { - if (state.dataWeather->WeekDayTypes(JDay) == static_cast(ScheduleManager::DayType::Sunday)) { + if (state.dataWeather->WeekDayTypes(JDay) == static_cast(Sched::DayType::Sunday)) { // Sunday, must go to Monday ++JDay; if (JDay == 366 && state.dataWeather->LeapYearAdd == 0) JDay = 1; - } else if (state.dataWeather->WeekDayTypes(JDay) == (int)ScheduleManager::DayType::Saturday) { + } else if (state.dataWeather->WeekDayTypes(JDay) == (int)Sched::DayType::Saturday) { ++JDay; if (JDay == 366 && state.dataWeather->LeapYearAdd == 0) JDay = 1; ++JDay; @@ -1700,7 +1717,7 @@ namespace Weather { // Counts set to 0 for each environment state.dataWeather->wvarsOutOfRangeCounts = Weather::WeatherVarCounts(); - state.dataWeather->IsRainThreshold = 0.8 / double(state.dataGlobal->NumOfTimeStepInHour); // [mm] + state.dataWeather->IsRainThreshold = 0.8 / double(state.dataGlobal->TimeStepsInHour); // [mm] if (!state.dataWeather->RPReadAllWeatherData) { printEnvrnStamp = true; // Set this to true so that on first non-warmup day (only) the environment header will print out @@ -1850,8 +1867,8 @@ namespace Weather { // at the end of each day find the min/max weather used for DOAS sizing if (state.dataGlobal->AirLoopHVACDOASUsedInSim) { if (envCurr.KindOfEnvrn == Constant::KindOfSim::RunPeriodDesign || envCurr.KindOfEnvrn == Constant::KindOfSim::DesignDay) { - for (int iHr = 1; iHr <= Constant::HoursInDay; ++iHr) { - for (int iTS = 1; iTS <= state.dataGlobal->NumOfTimeStepInHour; ++iTS) { + for (int iHr = 1; iHr <= Constant::iHoursInDay; ++iHr) { + for (int iTS = 1; iTS <= state.dataGlobal->TimeStepsInHour; ++iTS) { Real64 Tdb = state.dataWeather->wvarsHrTsToday(iTS, iHr).OutDryBulbTemp; Real64 Tdp = state.dataWeather->wvarsHrTsToday(iTS, iHr).OutDewPointTemp; if (Tdb > envCurr.maxCoolingOATSizing) { @@ -1994,7 +2011,7 @@ namespace Weather { state.dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state.dataEnvrn->Month, state.dataEnvrn->DayOfMonth, 1); } - ScheduleManager::UpdateScheduleValues(state); + Sched::UpdateScheduleVals(state); state.dataEnvrn->CurMnDyHr = format("{:02d}/{:02d} {:02d}", state.dataEnvrn->Month, state.dataEnvrn->DayOfMonth, (unsigned short)(state.dataGlobal->HourOfDay - 1)); @@ -2006,8 +2023,8 @@ namespace Weather { state.dataGlobal->WeightPreviousHour = 1.0 - state.dataGlobal->WeightNow; state.dataGlobal->CurrentTime = (state.dataGlobal->HourOfDay - 1) + state.dataGlobal->TimeStep * (state.dataWeather->TimeStepFraction); - state.dataGlobal->SimTimeSteps = (state.dataGlobal->DayOfSim - 1) * 24 * state.dataGlobal->NumOfTimeStepInHour + - (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; + state.dataGlobal->SimTimeSteps = (state.dataGlobal->DayOfSim - 1) * 24 * state.dataGlobal->TimeStepsInHour + + (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->TimeStepsInHour + state.dataGlobal->TimeStep; state.dataEnvrn->GroundTemp[(int)DataEnvironment::GroundTempType::BuildingSurface] = state.dataWeather->siteBuildingSurfaceGroundTempsPtr->getGroundTempAtTimeInMonths(state, 0, state.dataEnvrn->Month); @@ -2067,9 +2084,9 @@ namespace Weather { auto const &envCurr = state.dataWeather->Environment(state.dataWeather->Envrn); int const envrnDayNum = envCurr.DesignDayNum; - auto &desDayInput = state.dataWeather->DesDayInput(envrnDayNum); + auto const &desDayInput = state.dataWeather->DesDayInput(envrnDayNum); auto &spSiteSchedule = state.dataWeather->spSiteSchedules(envrnDayNum); - auto &desDayMod = state.dataWeather->desDayMods(envrnDayNum)(state.dataGlobal->TimeStep, state.dataGlobal->HourOfDay); + auto const &desDayMod = state.dataWeather->desDayMods(envrnDayNum)(state.dataGlobal->TimeStep, state.dataGlobal->HourOfDay); if (desDayInput.dryBulbRangeType != DesDayDryBulbRangeType::Default) { spSiteSchedule.OutDryBulbTemp = desDayMod.OutDryBulbTemp; @@ -2243,7 +2260,7 @@ namespace Weather { constexpr std::string_view routineName = "ReadEPlusWeatherForDay"; - Array1D wvarsHr = Array1D(Constant::HoursInDay); + Array1D wvarsHr = Array1D(Constant::iHoursInDay); auto &thisEnviron = state.dataWeather->Environment(Environ); @@ -2406,13 +2423,13 @@ namespace Weather { ErrorsFound = true; } - if (DirectRad < 9999.0 && DirectRad < 0.0) { + if (DirectRad < 0.0) { ShowSevereError(state, format("{}: {}", routineName, state.dataEnvrn->WeatherFileLocationTitle)); ShowContinueError(state, format("Direct Radiation ({:.2R}) is out of range [0.0, -]", DirectRad)); ErrorsFound = true; } - if (DiffuseRad < 9999.0 && DiffuseRad < 0.0) { + if (DiffuseRad < 0.0) { ShowSevereError(state, format("{}: {}", routineName, state.dataEnvrn->WeatherFileLocationTitle)); ShowContinueError(state, format("Diffuse Radiation ({:.2R}) is out of range [0.0, -]", DiffuseRad)); ErrorsFound = true; @@ -2878,10 +2895,10 @@ namespace Weather { state.files.inputWeatherFile.backspace(); } - if (state.dataWeather->NumIntervalsPerHour == 1 && state.dataGlobal->NumOfTimeStepInHour > 1) { + if (state.dataWeather->NumIntervalsPerHour == 1 && state.dataGlobal->TimeStepsInHour > 1) { // Create interpolated weather for timestep orientation // First copy ts=1 (hourly) from data arrays to Wthr structure - for (int hour = 1; hour <= Constant::HoursInDay; ++hour) { + for (int hour = 1; hour <= Constant::iHoursInDay; ++hour) { wvarsHr(hour) = state.dataWeather->wvarsHrTsTomorrow(1, hour); } @@ -2894,15 +2911,15 @@ namespace Weather { state.dataWeather->LastHourSet = true; } - for (int hour = 1; hour <= Constant::HoursInDay; ++hour) { + for (int hour = 1; hour <= Constant::iHoursInDay; ++hour) { - int NextHr = (hour == Constant::HoursInDay) ? 1 : hour + 1; + int NextHr = (hour == Constant::iHoursInDay) ? 1 : hour + 1; state.dataWeather->wvarsNextHr.BeamSolarRad = wvarsHr(NextHr).BeamSolarRad; state.dataWeather->wvarsNextHr.DifSolarRad = wvarsHr(NextHr).DifSolarRad; state.dataWeather->wvarsNextHr.LiquidPrecip = wvarsHr(NextHr).LiquidPrecip; - for (int ts = 1; ts <= state.dataGlobal->NumOfTimeStepInHour; ++ts) { + for (int ts = 1; ts <= state.dataGlobal->TimeStepsInHour; ++ts) { Real64 wgtCurrHr = state.dataWeather->Interpolation(ts); Real64 wgtPrevHr = 1.0 - wgtCurrHr; @@ -2913,7 +2930,7 @@ namespace Weather { Real64 wgtPrevHrSolar; Real64 wgtNextHrSolar; - if (state.dataGlobal->NumOfTimeStepInHour == 1) { + if (state.dataGlobal->TimeStepsInHour == 1) { wgtNextHrSolar = 1.0 - wgtCurrHr; wgtPrevHrSolar = 0.0; } else if (wgtCurrHrSolar == 1.0) { @@ -2954,7 +2971,7 @@ namespace Weather { state.dataWeather->wvarsNextHr.BeamSolarRad * wgtNextHrSolar; tomorrowTs.LiquidPrecip = state.dataWeather->wvarsLastHr.LiquidPrecip * wgtPrevHr + wvarsH.LiquidPrecip * wgtCurrHr; - tomorrowTs.LiquidPrecip /= double(state.dataGlobal->NumOfTimeStepInHour); + tomorrowTs.LiquidPrecip /= double(state.dataGlobal->TimeStepsInHour); tomorrowTs.IsRain = tomorrowTs.LiquidPrecip >= state.dataWeather->IsRainThreshold; // Wthr%IsRain tomorrowTs.IsSnow = wvarsH.IsSnow; } // End of TS Loop @@ -2966,47 +2983,43 @@ namespace Weather { if (thisEnviron.WP_Type1 != 0) { switch (state.dataWeather->WPSkyTemperature(thisEnviron.WP_Type1).skyTempModel) { case SkyTempModel::ScheduleValue: { - Array2D tmp = Array2D(state.dataGlobal->NumOfTimeStepInHour, Constant::HoursInDay); - - ScheduleManager::GetScheduleValuesForDay(state, - state.dataWeather->WPSkyTemperature(thisEnviron.WP_Type1).SchedulePtr, - tmp, - state.dataWeather->TomorrowVariables.DayOfYear_Schedule, - state.dataWeather->CurDayOfWeek); + std::vector const &dayVals = + state.dataWeather->WPSkyTemperature(thisEnviron.WP_Type1) + .sched->getDayVals(state, state.dataWeather->TomorrowVariables.DayOfYear_Schedule, state.dataWeather->CurDayOfWeek); - for (int iHr = 1; iHr <= Constant::HoursInDay; ++iHr) { - for (int iTS = 1; iTS <= state.dataGlobal->NumOfTimeStepInHour; ++iTS) { - state.dataWeather->wvarsHrTsTomorrow(iTS, iHr).SkyTemp = tmp(iTS, iHr); + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) { + for (int ts = 0; ts < state.dataGlobal->TimeStepsInHour; ++ts) { + state.dataWeather->wvarsHrTsTomorrow(ts + 1, hr + 1).SkyTemp = dayVals[hr * state.dataGlobal->TimeStepsInHour + ts]; } } } break; + case SkyTempModel::DryBulbDelta: { - Array2D tmp = Array2D(state.dataGlobal->NumOfTimeStepInHour, Constant::HoursInDay); - ScheduleManager::GetScheduleValuesForDay(state, - state.dataWeather->WPSkyTemperature(thisEnviron.WP_Type1).SchedulePtr, - tmp, - state.dataWeather->TomorrowVariables.DayOfYear_Schedule, - state.dataWeather->CurDayOfWeek); - - for (int hour = 1; hour <= Constant::HoursInDay; ++hour) { - for (int ts = 1; ts <= state.dataGlobal->NumOfTimeStepInHour; ++ts) { - auto &tomorrowTs = state.dataWeather->wvarsHrTsTomorrow(ts, hour); - tomorrowTs.SkyTemp = tomorrowTs.OutDryBulbTemp - tmp(ts, hour); + std::vector const &dayVals = + state.dataWeather->WPSkyTemperature(thisEnviron.WP_Type1) + .sched->getDayVals(state, state.dataWeather->TomorrowVariables.DayOfYear_Schedule, state.dataWeather->CurDayOfWeek); + + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) { + for (int ts = 0; ts < state.dataGlobal->TimeStepsInHour; ++ts) { + auto &tomorrowTs = state.dataWeather->wvarsHrTsTomorrow(ts + 1, hr + 1); + tomorrowTs.SkyTemp = tomorrowTs.OutDryBulbTemp - dayVals[hr * state.dataGlobal->TimeStepsInHour + ts]; } } } break; + case SkyTempModel::DewPointDelta: { - Array2D tmp = Array2D(state.dataGlobal->NumOfTimeStepInHour, Constant::HoursInDay); - ScheduleManager::GetScheduleValuesForDay(state, - state.dataWeather->WPSkyTemperature(thisEnviron.WP_Type1).SchedulePtr, - tmp, - state.dataWeather->TomorrowVariables.DayOfYear_Schedule, - state.dataWeather->CurDayOfWeek); - ForAllHrTs(state, [&state, &tmp](int iHr, int iTS) { - auto &tomorrowTs = state.dataWeather->wvarsHrTsTomorrow(iTS, iHr); - tomorrowTs.SkyTemp = tomorrowTs.OutDewPointTemp - tmp(iTS, iHr); - }); + std::vector const &dayVals = + state.dataWeather->WPSkyTemperature(thisEnviron.WP_Type1) + .sched->getDayVals(state, state.dataWeather->TomorrowVariables.DayOfYear_Schedule, state.dataWeather->CurDayOfWeek); + + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) { + for (int ts = 0; ts < state.dataGlobal->TimeStepsInHour; ++ts) { + auto &tomorrowTs = state.dataWeather->wvarsHrTsTomorrow(ts + 1, hr + 1); + tomorrowTs.SkyTemp = tomorrowTs.OutDewPointTemp - dayVals[hr * state.dataGlobal->TimeStepsInHour + ts]; + } + } } break; + default: break; } @@ -3358,8 +3371,8 @@ namespace Weather { struct HourlyWeatherData { // Members - Array1D BeamSolarRad = Array1D(Constant::HoursInDay, 0.0); // Hourly direct normal solar irradiance - Array1D DifSolarRad = Array1D(Constant::HoursInDay, 0.0); // Hourly sky diffuse horizontal solar irradiance + Array1D BeamSolarRad = Array1D(Constant::iHoursInDay, 0.0); // Hourly direct normal solar irradiance + Array1D DifSolarRad = Array1D(Constant::iHoursInDay, 0.0); // Hourly sky diffuse horizontal solar irradiance }; // Object Data @@ -3492,7 +3505,7 @@ namespace Weather { print(state.files.eio, "{:.4R},", C); print(state.files.eio, "{:.1R},", AVSC); print(state.files.eio, "{:.2R},", designDay.EquationOfTime * 60.0); - print(state.files.eio, "{:.1R},", std::asin(designDay.SinSolarDeclinAngle) / Constant::DegToRadians); + print(state.files.eio, "{:.1R},", std::asin(designDay.SinSolarDeclinAngle) / Constant::DegToRad); // Why have a different string for "Schedule" here than the one used for input? Really, why? static constexpr std::array DesDaySolarModelStrings = { @@ -3532,9 +3545,10 @@ namespace Weather { case DesDayHumIndType::RelHumSch: { // nothing to do -- DDHumIndModifier already contains the scheduled Relative Humidity ConstantHumidityRatio = false; - ForAllHrTs(state, [&state, EnvrnNum](int iHr, int iTS) { - state.dataWeather->wvarsHrTsTomorrow(iTS, iHr).OutRelHum = state.dataWeather->desDayMods(EnvrnNum)(iTS, iHr).OutRelHum; - }); + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) + for (int ts = 0; ts < state.dataGlobal->TimeStepsInHour; ++ts) + state.dataWeather->wvarsHrTsTomorrow(ts + 1, hr + 1).OutRelHum = + state.dataWeather->desDayMods(EnvrnNum)(ts + 1, hr + 1).OutRelHum; } break; case DesDayHumIndType::WBProfDef: case DesDayHumIndType::WBProfDif: @@ -3550,44 +3564,54 @@ namespace Weather { int OSky; // Opaque Sky Cover (tenths) if (desDayInput.RainInd != 0) { OSky = 10; - ForAllHrTs(state, [&state](int iHr, int iTS) { - auto &ts = state.dataWeather->wvarsHrTsTomorrow(iTS, iHr); - ts.IsRain = true; - ts.LiquidPrecip = 3.0; - }); + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) { + for (int ts = 0; ts < state.dataGlobal->TimeStepsInHour; ++ts) { + auto &wvars = state.dataWeather->wvarsHrTsTomorrow(ts + 1, hr + 1); + wvars.IsRain = true; + wvars.LiquidPrecip = 3.0; + } + } } else { OSky = 0; - ForAllHrTs(state, [&state](int iHr, int iTS) { - auto &ts = state.dataWeather->wvarsHrTsTomorrow(iTS, iHr); - ts.IsRain = false; - ts.LiquidPrecip = 0.0; - }); + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) { + for (int ts = 0; ts < state.dataGlobal->TimeStepsInHour; ++ts) { + auto &wvars = state.dataWeather->wvarsHrTsTomorrow(ts + 1, hr + 1); + wvars.IsRain = false; + wvars.LiquidPrecip = 0.0; + } + } } Real64 GndReflet; // Ground Reflectivity if (desDayInput.SnowInd == 0) { GndReflet = 0.2; - ForAllHrTs(state, [&state](int iHr, int iTS) { - auto &ts = state.dataWeather->wvarsHrTsTomorrow(iTS, iHr); - ts.IsSnow = false; - }); + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) { + for (int ts = 0; ts < state.dataGlobal->TimeStepsInHour; ++ts) { + auto &wvars = state.dataWeather->wvarsHrTsTomorrow(ts + 1, hr + 1); + wvars.IsSnow = false; + } + } } else { // Snow GndReflet = 0.7; - ForAllHrTs(state, [&state](int iHr, int iTS) { - auto &ts = state.dataWeather->wvarsHrTsTomorrow(iTS, iHr); - ts.IsSnow = true; - }); + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) { + for (int ts = 0; ts < state.dataGlobal->TimeStepsInHour; ++ts) { + auto &wvars = state.dataWeather->wvarsHrTsTomorrow(ts + 1, hr + 1); + wvars.IsSnow = true; + } + } } // Some values are constant - ForAllHrTs(state, [&state, &desDayInput](int iHr, int iTS) { - auto &ts = state.dataWeather->wvarsHrTsTomorrow(iTS, iHr); - ts.OutBaroPress = desDayInput.PressBarom; - ts.WindSpeed = desDayInput.WindSpeed; - ts.WindDir = desDayInput.WindDir; - ts.Albedo = 0.0; - }); + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) { + for (int ts = 0; ts < state.dataGlobal->TimeStepsInHour; ++ts) { + auto &wvars = state.dataWeather->wvarsHrTsTomorrow(ts + 1, hr + 1); + wvars.OutBaroPress = desDayInput.PressBarom; + wvars.WindSpeed = desDayInput.WindSpeed; + wvars.WindDir = desDayInput.WindDir; + wvars.Albedo = 0.0; + } + } // resolve daily ranges Real64 DBRange; // working copy of dry-bulb daily range, C (or 1 if input is difference) @@ -3606,8 +3630,8 @@ namespace Weather { } auto const &desDayModsEnvrn = state.dataWeather->desDayMods(EnvrnNum); - for (int hour = 1; hour <= Constant::HoursInDay; ++hour) { - for (int ts = 1; ts <= state.dataGlobal->NumOfTimeStepInHour; ++ts) { + for (int hour = 1; hour <= Constant::iHoursInDay; ++hour) { + for (int ts = 1; ts <= state.dataGlobal->TimeStepsInHour; ++ts) { auto const &desDayModsTS = desDayModsEnvrn(ts, hour); auto &tomorrowTs = state.dataWeather->wvarsHrTsTomorrow(ts, hour); if (desDayInput.dryBulbRangeType != DesDayDryBulbRangeType::Profile) { @@ -3675,7 +3699,7 @@ namespace Weather { // calc time = fractional hour of day Real64 CurTime; - if (state.dataGlobal->NumOfTimeStepInHour != 1) { + if (state.dataGlobal->TimeStepsInHour != 1) { CurTime = double(hour - 1) + double(ts) * state.dataWeather->TimeStepFraction; } else { CurTime = double(hour) + state.dataEnvrn->TS1TimeOffset; @@ -3766,54 +3790,61 @@ namespace Weather { // back-fill hour values from timesteps // hour values = integrated over hour ending at time of hour // insurance: hourly values not known to be needed - for (int hour = 1; hour <= Constant::HoursInDay; ++hour) { - int Hour1Ago = mod(hour + 22, Constant::HoursInDay) + 1; - auto const &tomorrowHr = state.dataWeather->wvarsHrTsTomorrow(state.dataGlobal->NumOfTimeStepInHour, hour); - auto const &tomorrowHr1Ago = state.dataWeather->wvarsHrTsTomorrow(state.dataGlobal->NumOfTimeStepInHour, Hour1Ago); + for (int hour = 1; hour <= Constant::iHoursInDay; ++hour) { + int Hour1Ago = mod(hour + 22, Constant::iHoursInDay) + 1; + auto const &tomorrowHr = state.dataWeather->wvarsHrTsTomorrow(state.dataGlobal->TimeStepsInHour, hour); + auto const &tomorrowHr1Ago = state.dataWeather->wvarsHrTsTomorrow(state.dataGlobal->TimeStepsInHour, Hour1Ago); Real64 BeamRad = (tomorrowHr1Ago.BeamSolarRad + tomorrowHr.BeamSolarRad) / 2.0; Real64 DiffRad = (tomorrowHr1Ago.DifSolarRad + tomorrowHr.DifSolarRad) / 2.0; - if (state.dataGlobal->NumOfTimeStepInHour > 1) { - for (int iTS = 1; iTS <= state.dataGlobal->NumOfTimeStepInHour - 1; ++iTS) { + if (state.dataGlobal->TimeStepsInHour > 1) { + for (int iTS = 1; iTS <= state.dataGlobal->TimeStepsInHour - 1; ++iTS) { BeamRad += state.dataWeather->wvarsHrTsTomorrow(iTS, hour).BeamSolarRad; DiffRad += state.dataWeather->wvarsHrTsTomorrow(iTS, hour).DifSolarRad; } } - Wthr.BeamSolarRad(hour) = BeamRad / state.dataGlobal->NumOfTimeStepInHour; - Wthr.DifSolarRad(hour) = DiffRad / state.dataGlobal->NumOfTimeStepInHour; + Wthr.BeamSolarRad(hour) = BeamRad / state.dataGlobal->TimeStepsInHour; + Wthr.DifSolarRad(hour) = DiffRad / state.dataGlobal->TimeStepsInHour; } if (envCurr.WP_Type1 != 0) { switch (state.dataWeather->WPSkyTemperature(envCurr.WP_Type1).skyTempModel) { case SkyTempModel::ScheduleValue: { - Array2D tmp = Array2D(state.dataGlobal->NumOfTimeStepInHour, Constant::HoursInDay); - ScheduleManager::GetSingleDayScheduleValues(state, state.dataWeather->WPSkyTemperature(envCurr.WP_Type1).SchedulePtr, tmp); + std::vector const &dayVals = state.dataWeather->WPSkyTemperature(envCurr.WP_Type1).sched->getDayVals(state); auto &desDayModsEnvrn = state.dataWeather->desDayMods(EnvrnNum); - ForAllHrTs(state, [&state, &tmp, &desDayModsEnvrn](int iHr, int iTS) { - state.dataWeather->wvarsHrTsTomorrow(iTS, iHr).SkyTemp = desDayModsEnvrn(iTS, iHr).SkyTemp = tmp(iTS, iHr); - }); + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) { + for (int ts = 0; ts < state.dataGlobal->TimeStepsInHour; ++ts) { + state.dataWeather->wvarsHrTsTomorrow(ts + 1, hr + 1).SkyTemp = desDayModsEnvrn(ts + 1, hr + 1).SkyTemp = + dayVals[hr * state.dataGlobal->TimeStepsInHour]; + } + } } break; + case SkyTempModel::DryBulbDelta: { - Array2D tmp = Array2D(state.dataGlobal->NumOfTimeStepInHour, Constant::HoursInDay); - ScheduleManager::GetSingleDayScheduleValues(state, state.dataWeather->WPSkyTemperature(envCurr.WP_Type1).SchedulePtr, tmp); + std::vector const &dayVals = state.dataWeather->WPSkyTemperature(envCurr.WP_Type1).sched->getDayVals(state); auto &desDayModsEnvrn = state.dataWeather->desDayMods(EnvrnNum); - ForAllHrTs(state, [&state, &tmp, &desDayModsEnvrn](int iHr, int iTS) { - auto &tomorrowTS = state.dataWeather->wvarsHrTsTomorrow(iTS, iHr); - desDayModsEnvrn(iTS, iHr).SkyTemp = tmp(iTS, iHr); - tomorrowTS.SkyTemp = tomorrowTS.OutDryBulbTemp - tmp(iTS, iHr); - }); + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) { + for (int ts = 0; ts < state.dataGlobal->TimeStepsInHour; ++ts) { + auto &tomorrowTS = state.dataWeather->wvarsHrTsTomorrow(ts + 1, hr + 1); + desDayModsEnvrn(ts + 1, hr + 1).SkyTemp = dayVals[hr * state.dataGlobal->TimeStepsInHour + ts]; + tomorrowTS.SkyTemp = tomorrowTS.OutDryBulbTemp - dayVals[hr * state.dataGlobal->TimeStepsInHour + ts]; + } + } } break; + case SkyTempModel::DewPointDelta: { - Array2D tmp = Array2D(state.dataGlobal->NumOfTimeStepInHour, Constant::HoursInDay); - ScheduleManager::GetSingleDayScheduleValues(state, state.dataWeather->WPSkyTemperature(envCurr.WP_Type1).SchedulePtr, tmp); + std::vector const &dayVals = state.dataWeather->WPSkyTemperature(envCurr.WP_Type1).sched->getDayVals(state); auto &desDayModsEnvrn = state.dataWeather->desDayMods(EnvrnNum); - ForAllHrTs(state, [&state, &tmp, &desDayModsEnvrn](int iHr, int iTS) { - auto &tomorrowTS = state.dataWeather->wvarsHrTsTomorrow(iTS, iHr); - desDayModsEnvrn(iTS, iHr).SkyTemp = tmp(iTS, iHr); - tomorrowTS.SkyTemp = tomorrowTS.OutDewPointTemp - tmp(iTS, iHr); - }); + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) { + for (int ts = 0; ts < state.dataGlobal->TimeStepsInHour; ++ts) { + auto &tomorrowTS = state.dataWeather->wvarsHrTsTomorrow(ts + 1, hr + 1); + desDayModsEnvrn(ts + 1, hr + 1).SkyTemp = dayVals[hr * state.dataGlobal->TimeStepsInHour + ts]; + tomorrowTS.SkyTemp = tomorrowTS.OutDewPointTemp - dayVals[hr * state.dataGlobal->TimeStepsInHour + ts]; + } + } } break; + default: { } break; } // switch (skyTempModel) @@ -3850,7 +3881,7 @@ namespace Weather { AirMass = 1.0; } else { // note: COS( Zen) = SIN( Alt) - SunAltD = std::asin(CosZen) / Constant::DegToRadians; // altitude, degrees + SunAltD = std::asin(CosZen) / Constant::DegToRad; // altitude, degrees AirMass = 1.0 / (CosZen + 0.50572 * std::pow(6.07995 + SunAltD, -1.6364)); } return AirMass; @@ -3921,11 +3952,11 @@ namespace Weather { // Interpolation of data is done later after either setting up the design day (hourly // data) or reading in hourly weather data. - state.dataWeather->wvarsHrTsToday.allocate(state.dataGlobal->NumOfTimeStepInHour, Constant::HoursInDay); - state.dataWeather->wvarsHrTsTomorrow.allocate(state.dataGlobal->NumOfTimeStepInHour, Constant::HoursInDay); + state.dataWeather->wvarsHrTsToday.allocate(state.dataGlobal->TimeStepsInHour, Constant::iHoursInDay); + state.dataWeather->wvarsHrTsTomorrow.allocate(state.dataGlobal->TimeStepsInHour, Constant::iHoursInDay); } - void CalculateDailySolarCoeffs(EnergyPlusData &state, + void CalculateDailySolarCoeffs(EnergyPlusData const &state, int const DayOfYear, // Day of year (1 - 366) Real64 &A, // ASHRAE "A" - Apparent solar irradiation at air mass = 0 [W/M**2] Real64 &B, // ASHRAE "B" - Atmospheric extinction coefficient @@ -4033,7 +4064,7 @@ namespace Weather { ASHRAE_C_Coef[8] * (pow_2(pow_2(CosX) - pow_2(SinX)) - pow_2(SinX * CosX * 2.0)); } - void CalculateSunDirectionCosines(EnergyPlusData &state, + void CalculateSunDirectionCosines(EnergyPlusData const &state, Real64 const TimeValue, // Current Time of Day Real64 const EqOfTime, // Equation of Time Real64 const SinSolDeclin, // Sine of Solar Declination @@ -4056,8 +4087,7 @@ namespace Weather { EP_SIZE_CHECK(SUNCOS, 3); // NOLINT(misc-static-assert) // COMPUTE THE HOUR ANGLE - Real64 H = - (15.0 * (12.0 - (TimeValue + EqOfTime)) + (state.dataEnvrn->TimeZoneMeridian - state.dataEnvrn->Longitude)) * Constant::DegToRadians; + Real64 H = (15.0 * (12.0 - (TimeValue + EqOfTime)) + (state.dataEnvrn->TimeZoneMeridian - state.dataEnvrn->Longitude)) * Constant::DegToRad; Real64 COSH = std::cos(H); // COMPUTE THE COSINE OF THE SOLAR ZENITH ANGLE. // This is also the Sine of the Solar Altitude Angle @@ -4088,7 +4118,7 @@ namespace Weather { // Sun routines from IBLAST, authored by Walton. // COMPUTE THE HOUR ANGLE - if (state.dataGlobal->NumOfTimeStepInHour != 1) { + if (state.dataGlobal->TimeStepsInHour != 1) { state.dataWeather->HrAngle = (15.0 * (12.0 - (state.dataGlobal->CurrentTime + state.dataWeather->TodayVariables.EquationOfTime)) + (state.dataEnvrn->TimeZoneMeridian - state.dataEnvrn->Longitude)); } else { @@ -4097,7 +4127,7 @@ namespace Weather { (12.0 - ((state.dataGlobal->CurrentTime + state.dataEnvrn->TS1TimeOffset) + state.dataWeather->TodayVariables.EquationOfTime)) + (state.dataEnvrn->TimeZoneMeridian - state.dataEnvrn->Longitude)); } - Real64 H = state.dataWeather->HrAngle * Constant::DegToRadians; + Real64 H = state.dataWeather->HrAngle * Constant::DegToRad; // Compute the Cosine of the Solar Zenith (Altitude) Angle. Real64 CosZenith = state.dataEnvrn->SinLatitude * state.dataWeather->TodayVariables.SinSolarDeclinAngle + @@ -4114,8 +4144,8 @@ namespace Weather { CosAzimuth = min(1.0, CosAzimuth); Real64 SolarAzimuth = std::acos(CosAzimuth); - state.dataWeather->SolarAltitudeAngle = SolarAltitude / Constant::DegToRadians; - state.dataWeather->SolarAzimuthAngle = SolarAzimuth / Constant::DegToRadians; + state.dataWeather->SolarAltitudeAngle = SolarAltitude / Constant::DegToRad; + state.dataWeather->SolarAzimuthAngle = SolarAzimuth / Constant::DegToRad; if (state.dataWeather->HrAngle < 0.0) { state.dataWeather->SolarAzimuthAngle = 360.0 - state.dataWeather->SolarAzimuthAngle; } @@ -4332,7 +4362,7 @@ namespace Weather { // different, notify the user. If StdTimeMerid couldn't be calculated, // produce an error message. - if (state.dataEnvrn->varyingLocationSchedIndexLat > 0 || state.dataEnvrn->varyingLocationSchedIndexLong > 0) { + if (state.dataEnvrn->varyingLocationLatSched != nullptr || state.dataEnvrn->varyingLocationLongSched != nullptr) { // don't do any warnings, the building is moving } else if (StdTimeMerid >= -12.0 && StdTimeMerid <= 12.0) { if (state.dataEnvrn->TimeZoneNumber != StdTimeMerid) { @@ -4367,8 +4397,8 @@ namespace Weather { } else { state.dataEnvrn->TimeZoneMeridian = state.dataEnvrn->TimeZoneNumber * 15.0 - 360.0; } - state.dataEnvrn->SinLatitude = std::sin(Constant::DegToRadians * state.dataEnvrn->Latitude); - state.dataEnvrn->CosLatitude = std::cos(Constant::DegToRadians * state.dataEnvrn->Latitude); + state.dataEnvrn->SinLatitude = std::sin(Constant::DegToRad * state.dataEnvrn->Latitude); + state.dataEnvrn->CosLatitude = std::cos(Constant::DegToRad * state.dataEnvrn->Latitude); if (state.dataEnvrn->Latitude == 0.0 && state.dataEnvrn->Longitude == 0.0 && state.dataEnvrn->TimeZoneNumber == 0.0) { ShowWarningError(state, @@ -4635,7 +4665,7 @@ namespace Weather { } } - static int findYearForWeekday(int const month, int const day, ScheduleManager::DayType const weekday) + static int findYearForWeekday(int const month, int const day, Sched::DayType const weekday) { // Find a year that goes with a month/day and a weekday. A lookup table is used with the most recent year that includes // the date with the weekday specified. @@ -4647,7 +4677,7 @@ namespace Weather { return defaultYear[static_cast(weekday) - rem + 5]; // static_cast(weekday) - rem + 1 + 4 } - static int findLeapYearForWeekday(int const month, int const day, ScheduleManager::DayType const weekday) + static int findLeapYearForWeekday(int const month, int const day, Sched::DayType const weekday) { // Find a leap year that goes with a month/day and a weekday. A lookup table is used with the most recent year that includes // the date with the weekday specified. @@ -4914,7 +4944,7 @@ namespace Weather { // A2 , \field Day of Week for Start Day bool inputWeekday = false; if (!state.dataIPShortCut->lAlphaFieldBlanks(2)) { // Have input - int dayType = getEnumValue(ScheduleManager::dayTypeNamesUC, state.dataIPShortCut->cAlphaArgs(2)); + int dayType = getEnumValue(Sched::dayTypeNamesUC, state.dataIPShortCut->cAlphaArgs(2)); if (dayType < 1) { ShowWarningError(state, format("{}: object={}{} invalid (Day of Week) [{}] for Start is not valid, Sunday will be used.", @@ -4922,13 +4952,13 @@ namespace Weather { state.dataWeather->RunPeriodInput(i).title, state.dataIPShortCut->cAlphaFieldNames(2), state.dataIPShortCut->cAlphaArgs(2))); - runPeriodInput.startWeekDay = ScheduleManager::DayType::Sunday; + runPeriodInput.startWeekDay = Sched::DayType::Sunday; } else { - runPeriodInput.startWeekDay = static_cast(dayType); + runPeriodInput.startWeekDay = static_cast(dayType); inputWeekday = true; } } else { // No input, set the default as Sunday. This may get overriden below - runPeriodInput.startWeekDay = ScheduleManager::DayType::Sunday; + runPeriodInput.startWeekDay = Sched::DayType::Sunday; } // Validate the dates now that the weekday field has been looked at @@ -4953,7 +4983,7 @@ namespace Weather { runPeriodInput.startYear)); ErrorsFound = true; } else { // Start year is a leap year - ScheduleManager::DayType weekday = + Sched::DayType weekday = calculateDayOfWeek(state, runPeriodInput.startYear, runPeriodInput.startMonth, runPeriodInput.startDay); if (inputWeekday) { // Check for correctness of input if (weekday != runPeriodInput.startWeekDay) { @@ -4963,7 +4993,7 @@ namespace Weather { runPeriodInput.title, ipsc->cAlphaArgs(2), runPeriodInput.startYear, - ScheduleManager::dayTypeNamesUC[static_cast(weekday)])); + Sched::dayTypeNamesUC[static_cast(weekday)])); runPeriodInput.startWeekDay = weekday; } } else { // Set the weekday if it was not input @@ -4993,7 +5023,7 @@ namespace Weather { calculateDayOfWeek(state, runPeriodInput.startYear, runPeriodInput.startMonth, runPeriodInput.startDay); } } else { // Have an input starting year - ScheduleManager::DayType weekday = + Sched::DayType weekday = calculateDayOfWeek(state, runPeriodInput.startYear, runPeriodInput.startMonth, runPeriodInput.startDay); if (inputWeekday) { // Check for correctness of input if (weekday != runPeriodInput.startWeekDay) { @@ -5003,7 +5033,7 @@ namespace Weather { runPeriodInput.title, ipsc->cAlphaArgs(2), runPeriodInput.startYear, - ScheduleManager::dayTypeNamesUC[static_cast(weekday)])); + Sched::dayTypeNamesUC[static_cast(weekday)])); runPeriodInput.startWeekDay = weekday; } } else { // Set the weekday if it was not input @@ -5309,9 +5339,9 @@ namespace Weather { } // switch if (ipsc->lAlphaFieldBlanks(2)) { - runPerDesInput.dayOfWeek = (int)ScheduleManager::DayType::Monday; // Defaults to Monday + runPerDesInput.dayOfWeek = (int)Sched::DayType::Monday; // Defaults to Monday } else { - runPerDesInput.dayOfWeek = getEnumValue(ScheduleManager::dayTypeNamesUC, ipsc->cAlphaArgs(2)); + runPerDesInput.dayOfWeek = getEnumValue(Sched::dayTypeNamesUC, ipsc->cAlphaArgs(2)); if (runPerDesInput.dayOfWeek < 1 || runPerDesInput.dayOfWeek == 8) { ShowWarningError(state, format("{}: object={} {} invalid (Day of Week) [{} for Start is not Valid, Monday will be Used.", @@ -5319,7 +5349,7 @@ namespace Weather { runPerDesInput.title, ipsc->cAlphaFieldNames(1), ipsc->cAlphaArgs(1))); - runPerDesInput.dayOfWeek = (int)ScheduleManager::DayType::Monday; // Defaults to Monday + runPerDesInput.dayOfWeek = (int)Sched::DayType::Monday; // Defaults to Monday } } @@ -5440,11 +5470,10 @@ namespace Weather { } if (ipsc->lAlphaFieldBlanks(3)) { - runPerDesInput.dayOfWeek = (int)ScheduleManager::DayType::Monday; // Defaults to Monday + runPerDesInput.dayOfWeek = (int)Sched::DayType::Monday; // Defaults to Monday } else { - runPerDesInput.dayOfWeek = getEnumValue(ScheduleManager::dayTypeNamesUC, ipsc->cAlphaArgs(3)); - if (runPerDesInput.dayOfWeek < (int)ScheduleManager::DayType::Sunday || - runPerDesInput.dayOfWeek == (int)ScheduleManager::DayType::Holiday) { + runPerDesInput.dayOfWeek = getEnumValue(Sched::dayTypeNamesUC, ipsc->cAlphaArgs(3)); + if (runPerDesInput.dayOfWeek < (int)Sched::DayType::Sunday || runPerDesInput.dayOfWeek == (int)Sched::DayType::Holiday) { // Sunday-Saturday, SummerDesignDay, WinterDesignDay, CustomDay1, and CustomDay2 are all valid. Holiday is not valid. // The input processor should trap invalid key choices, so this should never trip. assert(false); @@ -5570,7 +5599,7 @@ namespace Weather { specialDay.WeekDay = PWeekDay; specialDay.CompDate = 0; specialDay.WthrFile = false; - } else if (dateType == DateType::Invalid) { + } else { ShowSevereInvalidKey(state, eoh, ipsc->cAlphaFieldNames(2), AlphArray(2)); ErrorsFound = true; } @@ -5583,7 +5612,7 @@ namespace Weather { ErrorsFound = true; } - int DayType = getEnumValue(ScheduleManager::dayTypeNamesUC, AlphArray(3)); + int DayType = getEnumValue(Sched::dayTypeNamesUC, AlphArray(3)); if (DayType == 0) { ShowSevereInvalidKey(state, eoh, ipsc->cAlphaFieldNames(3), AlphArray(3)); ErrorsFound = true; @@ -5782,13 +5811,12 @@ namespace Weather { static constexpr std::string_view routineName = "GetDesignDayData"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - std::string units; Constant::Units unitType; state.dataWeather->DesDayInput.allocate(TotDesDays); // Allocate the array to the # of DD's state.dataWeather->desDayMods.allocate(TotDesDays); for (int iDD = 1; iDD <= TotDesDays; ++iDD) - state.dataWeather->desDayMods(iDD).allocate(state.dataGlobal->NumOfTimeStepInHour, Constant::HoursInDay); + state.dataWeather->desDayMods(iDD).allocate(state.dataGlobal->TimeStepsInHour, Constant::iHoursInDay); state.dataWeather->spSiteSchedules.dimension(TotDesDays, Weather::SPSiteSchedules()); @@ -5920,14 +5948,15 @@ namespace Weather { desDayInput.dryBulbRangeType = DesDayDryBulbRangeType::Default; } + // std::string units; // not used if (desDayInput.dryBulbRangeType == DesDayDryBulbRangeType::Multiplier) { - units = "[]"; + // units = "[]"; unitType = Constant::Units::None; } else if (desDayInput.dryBulbRangeType == DesDayDryBulbRangeType::Difference) { - units = "[deltaC]"; + // units = "[deltaC]"; unitType = Constant::Units::deltaC; } else if (desDayInput.dryBulbRangeType == DesDayDryBulbRangeType::Profile) { - units = "[C]"; + // units = "[C]"; unitType = Constant::Units::C; } @@ -5942,7 +5971,7 @@ namespace Weather { Real64 testval = desDayInput.MaxDryBulb - desDayInput.DailyDBRange; if (testval < -90.0 || testval > 70.0) { ShowSevereError(state, format("{}: {} = {}", routineName, ipsc->cCurrentModuleObject, desDayInput.Title)); - ShowContinueError(state, format("{} ({.2R}) is out of range [-90.0, 70.0]", ipsc->cAlphaFieldNames(3), testval)); + ShowContinueError(state, format("{} ({:.2R}) is out of range [-90.0, 70.0]", ipsc->cAlphaFieldNames(3), testval)); ErrorsFound = true; } } @@ -5951,8 +5980,8 @@ namespace Weather { if (desDayInput.dryBulbRangeType == DesDayDryBulbRangeType::Default) { // Default dry-bulb temperature Range Real64 LastHrValue = DefaultTempRangeMult[23]; - for (int hour = 1; hour <= Constant::HoursInDay; ++hour) { - for (int ts = 1; ts <= state.dataGlobal->NumOfTimeStepInHour; ++ts) { + for (int hour = 1; hour <= Constant::iHoursInDay; ++hour) { + for (int ts = 1; ts <= state.dataGlobal->TimeStepsInHour; ++ts) { Real64 WNow = state.dataWeather->Interpolation(ts); Real64 WPrev = 1.0 - WNow; state.dataWeather->desDayMods(EnvrnNum)(ts, hour).OutDryBulbTemp = @@ -5964,24 +5993,23 @@ namespace Weather { } else if (ipsc->lAlphaFieldBlanks(4)) { ShowSevereEmptyField(state, eoh, ipsc->cAlphaFieldNames(4), ipsc->cAlphaFieldNames(3), "SCHEDULE"); ErrorsFound = true; - - } else if ((desDayInput.TempRangeSchPtr = ScheduleManager::GetDayScheduleIndex(state, ipsc->cAlphaArgs(4))) == 0) { + } else if ((desDayInput.tempRangeSched = Sched::GetDaySchedule(state, ipsc->cAlphaArgs(4))) == nullptr) { ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(4), ipsc->cAlphaArgs(4)); ErrorsFound = true; } else { - Array2D tmp = Array2D(state.dataGlobal->NumOfTimeStepInHour, Constant::HoursInDay); - ScheduleManager::GetSingleDayScheduleValues(state, desDayInput.TempRangeSchPtr, tmp); + std::vector const &dayVals = desDayInput.tempRangeSched->getDayVals(state); auto &desDayModEnvrn = state.dataWeather->desDayMods(EnvrnNum); - for (int iHr = 1; iHr <= Constant::HoursInDay; ++iHr) { - for (int iTS = 1; iTS <= state.dataGlobal->NumOfTimeStepInHour; ++iTS) { - desDayModEnvrn(iTS, iHr).OutDryBulbTemp = tmp(iTS, iHr); + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) { + for (int ts = 0; ts < state.dataGlobal->TimeStepsInHour; ++ts) { + desDayModEnvrn(ts + 1, hr + 1).OutDryBulbTemp = dayVals[hr * state.dataGlobal->TimeStepsInHour + ts]; } } - if (std::find(state.dataWeather->spSiteSchedNums.begin(), state.dataWeather->spSiteSchedNums.end(), desDayInput.TempRangeSchPtr) == - state.dataWeather->spSiteSchedNums.end()) { - state.dataWeather->spSiteSchedNums.emplace_back(desDayInput.TempRangeSchPtr); + if (std::find(state.dataWeather->spSiteSchedNums.begin(), + state.dataWeather->spSiteSchedNums.end(), + desDayInput.tempRangeSched->Num) == state.dataWeather->spSiteSchedNums.end()) { + state.dataWeather->spSiteSchedNums.emplace_back(desDayInput.tempRangeSched->Num); SetupOutputVariable(state, "Sizing Period Site Drybulb Temperature Range Modifier Schedule Value", unitType, @@ -5992,25 +6020,21 @@ namespace Weather { } if (desDayInput.dryBulbRangeType == DesDayDryBulbRangeType::Multiplier) { - if (!ScheduleManager::CheckDayScheduleValueMinMax(state, desDayInput.TempRangeSchPtr, 0.0, false, 1.0, false)) { - ShowSevereError(state, format("{}=\"{}\", invalid data.", ipsc->cCurrentModuleObject, desDayInput.Title)); - ShowContinueError(state, format("..invalid field: {}=\"{}\".", ipsc->cAlphaFieldNames(4), ipsc->cAlphaArgs(4))); - ShowContinueError(state, "..Specified [Schedule] Dry-bulb Range Multiplier Values are not within [0.0, 1.0]"); + if (!desDayInput.tempRangeSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax(state, eoh, ipsc->cAlphaFieldNames(4), ipsc->cAlphaArgs(4), Clusive::In, 0.0, Clusive::In, 1.0); ErrorsFound = true; } } else if (desDayInput.dryBulbRangeType == DesDayDryBulbRangeType::Difference) { // delta, must be > 0.0 - if (!ScheduleManager::CheckDayScheduleValueMinMax(state, desDayInput.TempRangeSchPtr, 0.0, false)) { - ShowSevereError(state, format("{}=\"{}\", invalid data.", ipsc->cCurrentModuleObject, desDayInput.Title)); - ShowContinueError(state, format("..invalid field: {}=\"{}\".", ipsc->cAlphaFieldNames(4), ipsc->cAlphaArgs(4))); - ShowContinueError(state, "Some [Schedule] Dry-bulb Range Difference Values are < 0.0 [would make max larger]."); + if (!desDayInput.tempRangeSched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, ipsc->cAlphaFieldNames(4), ipsc->cAlphaArgs(4), Clusive::In, 0.0); ErrorsFound = true; } } auto const &desDayModsEnvrn = state.dataWeather->desDayMods(EnvrnNum); Real64 testval = std::numeric_limits::min(); - for (int iHr = 1; iHr <= Constant::HoursInDay; ++iHr) { - for (int iTS = 1; iTS <= state.dataGlobal->NumOfTimeStepInHour; ++iTS) { + for (int iHr = 1; iHr <= Constant::iHoursInDay; ++iHr) { + for (int iTS = 1; iTS <= state.dataGlobal->TimeStepsInHour; ++iTS) { if (desDayModsEnvrn(iTS, iHr).OutDryBulbTemp > testval) testval = desDayModsEnvrn(iTS, iHr).OutDryBulbTemp; } } @@ -6029,7 +6053,7 @@ namespace Weather { if (testval < -90.0 || testval > 70.0) { ShowSevereError(state, format("{}: {} = {}", routineName, ipsc->cCurrentModuleObject, desDayInput.Title)); // should this be cNumericFieldNames? - ShowContinueError(state, format("{} = ({.2R}) is out of range [-90.0, 70.0]", ipsc->cAlphaFieldNames(4), testval)); + ShowContinueError(state, format("{} = ({:.2R}) is out of range [-90.0, 70.0]", ipsc->cAlphaFieldNames(4), testval)); ErrorsFound = true; } } @@ -6050,7 +6074,8 @@ namespace Weather { if (desDayInput.HumIndValue < -90.0 || desDayInput.HumIndValue > 70.0) { ShowSevereError(state, format("{}: {} = {}", routineName, ipsc->cCurrentModuleObject, desDayInput.Title)); ShowContinueError( - state, format("{} = {.2R} is out of range [-90.0, 70.0]", ipsc->cAlphaFieldNames(5) + " - WetBulb", desDayInput.HumIndValue)); + state, + format("{} = {:.2R} is out of range [-90.0, 70.0]", ipsc->cAlphaFieldNames(5) + " - WetBulb", desDayInput.HumIndValue)); ErrorsFound = true; } } break; @@ -6067,7 +6092,7 @@ namespace Weather { ShowSevereError(state, format("{}: {} = {}", routineName, ipsc->cCurrentModuleObject, desDayInput.Title)); ShowContinueError( state, - format("{} = {.2R} is out of range [-90.0, 70.0]", ipsc->cAlphaFieldNames(5) + " - DewPoint", desDayInput.HumIndValue)); + format("{} = {:.2R} is out of range [-90.0, 70.0]", ipsc->cAlphaFieldNames(5) + " - DewPoint", desDayInput.HumIndValue)); ErrorsFound = true; } } break; @@ -6085,7 +6110,7 @@ namespace Weather { ShowSevereError(state, format("{}: {} = {}", routineName, ipsc->cCurrentModuleObject, desDayInput.Title)); ShowContinueError( state, - format("{} = {.2R} is out of range [0.0, 0.03]", ipsc->cAlphaFieldNames(5) + " - Humidity-Ratio", desDayInput.HumIndValue)); + format("{} = {:.2R} is out of range [0.0, 0.03]", ipsc->cAlphaFieldNames(5) + " - Humidity-Ratio", desDayInput.HumIndValue)); ErrorsFound = true; } } break; @@ -6110,12 +6135,12 @@ namespace Weather { } break; case DesDayHumIndType::RelHumSch: { - units = "[%]"; + // units = "[%]"; unitType = Constant::Units::Perc; } break; case DesDayHumIndType::WBProfMul: { - units = "[]"; + // units = "[]"; unitType = Constant::Units::None; if (ipsc->lNumericFieldBlanks(5)) { ShowSevereEmptyField(state, eoh, ipsc->cNumericFieldNames(5), ipsc->cAlphaFieldNames(5), ipsc->cAlphaArgs(5)); @@ -6126,7 +6151,7 @@ namespace Weather { } break; case DesDayHumIndType::WBProfDif: { - units = "[]"; + // units = "[]"; unitType = Constant::Units::None; if (ipsc->lNumericFieldBlanks(5)) { ShowSevereEmptyField(state, eoh, ipsc->cNumericFieldNames(5), ipsc->cAlphaFieldNames(5), ipsc->cAlphaArgs(5)); @@ -6161,7 +6186,7 @@ namespace Weather { if (ipsc->lAlphaFieldBlanks(6)) { ShowSevereEmptyField(state, eoh, ipsc->cAlphaFieldNames(6), ipsc->cAlphaFieldNames(3), ipsc->cAlphaArgs(3)); ErrorsFound = true; - } else if ((desDayInput.HumIndSchPtr = ScheduleManager::GetDayScheduleIndex(state, ipsc->cAlphaArgs(6))) == 0) { + } else if ((desDayInput.humIndSched = Sched::GetDaySchedule(state, ipsc->cAlphaArgs(6))) == nullptr) { ShowWarningItemNotFound(state, eoh, ipsc->cAlphaFieldNames(6), @@ -6169,17 +6194,16 @@ namespace Weather { "Default Humidity (constant for day using Humidity Indicator Temp)."); // reset HumIndType ? } else { - Array2D tmp = Array2D(state.dataGlobal->NumOfTimeStepInHour, Constant::HoursInDay); - ScheduleManager::GetSingleDayScheduleValues(state, desDayInput.HumIndSchPtr, tmp); - + std::vector const &dayVals = desDayInput.humIndSched->getDayVals(state); auto &desDayModsEnvrn = state.dataWeather->desDayMods(EnvrnNum); - for (int iHr = 1; iHr <= Constant::HoursInDay; ++iHr) - for (int iTS = 1; iTS <= state.dataGlobal->NumOfTimeStepInHour; ++iTS) - desDayModsEnvrn(iTS, iHr).OutRelHum = tmp(iTS, iHr); + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) + for (int ts = 0; ts < state.dataGlobal->TimeStepsInHour; ++ts) + desDayModsEnvrn(ts + 1, hr + 1).OutRelHum = dayVals[hr * state.dataGlobal->TimeStepsInHour + ts]; - if (std::find(state.dataWeather->spSiteSchedNums.begin(), state.dataWeather->spSiteSchedNums.end(), desDayInput.HumIndSchPtr) == - state.dataWeather->spSiteSchedNums.end()) { - state.dataWeather->spSiteSchedNums.emplace_back(desDayInput.HumIndSchPtr); + if (std::find(state.dataWeather->spSiteSchedNums.begin(), + state.dataWeather->spSiteSchedNums.end(), + desDayInput.humIndSched->Num) == state.dataWeather->spSiteSchedNums.end()) { + state.dataWeather->spSiteSchedNums.emplace_back(desDayInput.humIndSched->Num); SetupOutputVariable(state, "Sizing Period Site Humidity Condition Schedule Value", unitType, @@ -6191,27 +6215,23 @@ namespace Weather { switch (desDayInput.HumIndType) { case DesDayHumIndType::RelHumSch: { - if (!ScheduleManager::CheckDayScheduleValueMinMax(state, desDayInput.HumIndSchPtr, 0.0, false, 100.0, false)) { - ShowSevereError(state, format("{}=\"{}\", invalid data.", ipsc->cCurrentModuleObject, desDayInput.Title)); - ShowContinueError(state, format("..invalid field: {}=\"{}\".", ipsc->cAlphaFieldNames(6), ipsc->cAlphaArgs(6))); - ShowContinueError(state, "Specified [Scheduled] Relative Humidity Values are not within [0.0, 100.0]"); + if (!desDayInput.humIndSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 100.0)) { + Sched::ShowSevereBadMinMax( + state, eoh, ipsc->cAlphaFieldNames(6), ipsc->cAlphaArgs(6), Clusive::In, 0.0, Clusive::In, 100.0); ErrorsFound = true; } } break; case DesDayHumIndType::WBProfMul: { // multiplier: use schedule value, check 0 <= v <= 1 - if (!ScheduleManager::CheckDayScheduleValueMinMax(state, desDayInput.HumIndSchPtr, 0.0, false, 1.0, false)) { - ShowSevereError(state, format("{}=\"{}\", invalid data.", ipsc->cCurrentModuleObject, desDayInput.Title)); - ShowContinueError(state, format("..invalid field: {}=\"{}\".", ipsc->cAlphaFieldNames(6), ipsc->cAlphaArgs(6))); - ShowContinueError(state, "..Specified [Schedule] Wet-bulb Profile Range Multiplier Values are not within [0.0, 1.0]"); + if (!desDayInput.humIndSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax( + state, eoh, ipsc->cAlphaFieldNames(6), ipsc->cAlphaArgs(6), Clusive::In, 0.0, Clusive::In, 1.0); ErrorsFound = true; } } break; case DesDayHumIndType::WBProfDif: { - if (!ScheduleManager::CheckDayScheduleValueMinMax(state, desDayInput.HumIndSchPtr, 0.0, false)) { - ShowSevereError(state, format("{}=\"{}\", invalid data.", ipsc->cCurrentModuleObject, desDayInput.Title)); - ShowContinueError(state, format("..invalid field: {}=\"{}\".", ipsc->cAlphaFieldNames(6), ipsc->cAlphaArgs(6))); - ShowContinueError(state, "Some [Schedule] Wet-bulb Profile Difference Values are < 0.0 [would make max larger]."); + if (!desDayInput.humIndSched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, ipsc->cAlphaFieldNames(6), ipsc->cAlphaArgs(6), Clusive::In, 0.0); ErrorsFound = true; } } break; @@ -6223,8 +6243,8 @@ namespace Weather { } else if (desDayInput.HumIndType == DesDayHumIndType::WBProfDef) { // re WetBulbProfileDefaultMultipliers Real64 LastHrValue = DefaultTempRangeMult[23]; - for (int hour = 1; hour <= Constant::HoursInDay; ++hour) { - for (int ts = 1; ts <= state.dataGlobal->NumOfTimeStepInHour; ++ts) { + for (int hour = 1; hour <= Constant::iHoursInDay; ++hour) { + for (int ts = 1; ts <= state.dataGlobal->TimeStepsInHour; ++ts) { Real64 WNow = state.dataWeather->Interpolation(ts); Real64 WPrev = 1.0 - WNow; state.dataWeather->desDayMods(EnvrnNum)(ts, hour).OutRelHum = LastHrValue * WPrev + DefaultTempRangeMult[hour - 1] * WNow; @@ -6268,25 +6288,24 @@ namespace Weather { // A11, \field Beam Solar Day Schedule Name if (ipsc->lAlphaFieldBlanks(11)) { // should have entered beam schedule - ShowSevereEmptyField(state, eoh, ipsc->cAlphaFieldNames(11), "", ""); + ShowSevereEmptyField(state, eoh, ipsc->cAlphaFieldNames(11)); ErrorsFound = true; - } else if ((desDayInput.BeamSolarSchPtr = ScheduleManager::GetDayScheduleIndex(state, ipsc->cAlphaArgs(11))) == 0) { + } else if ((desDayInput.beamSolarSched = Sched::GetDaySchedule(state, ipsc->cAlphaArgs(11))) == nullptr) { ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(11), ipsc->cAlphaArgs(11)); ErrorsFound = true; } else { - Array2D tmp = Array2D(state.dataGlobal->NumOfTimeStepInHour, Constant::HoursInDay); - ScheduleManager::GetSingleDayScheduleValues(state, desDayInput.BeamSolarSchPtr, tmp); + std::vector const &dayVals = desDayInput.beamSolarSched->getDayVals(state); auto &desDayModsEnvrn = state.dataWeather->desDayMods(EnvrnNum); - for (int iHr = 1; iHr <= Constant::HoursInDay; ++iHr) - for (int iTS = 1; iTS <= state.dataGlobal->NumOfTimeStepInHour; ++iTS) - desDayModsEnvrn(iTS, iHr).BeamSolarRad = tmp(iTS, iHr); + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) + for (int ts = 0; ts < state.dataGlobal->TimeStepsInHour; ++ts) + desDayModsEnvrn(ts + 1, hr + 1).BeamSolarRad = dayVals[hr * state.dataGlobal->TimeStepsInHour + ts]; unitType = Constant::Units::W_m2; - units = "[W/m2]"; + // units = "[W/m2]"; if (std::find(state.dataWeather->spSiteSchedNums.begin(), state.dataWeather->spSiteSchedNums.end(), - desDayInput.BeamSolarSchPtr) == state.dataWeather->spSiteSchedNums.end()) { - state.dataWeather->spSiteSchedNums.emplace_back(desDayInput.BeamSolarSchPtr); + desDayInput.beamSolarSched->Num) == state.dataWeather->spSiteSchedNums.end()) { + state.dataWeather->spSiteSchedNums.emplace_back(desDayInput.beamSolarSched->Num); SetupOutputVariable(state, "Sizing Period Site Beam Solar Schedule Value", unitType, @@ -6296,10 +6315,8 @@ namespace Weather { ipsc->cAlphaArgs(11)); } - if (!ScheduleManager::CheckDayScheduleValueMinMax(state, desDayInput.BeamSolarSchPtr, 0.0, false)) { - ShowSevereError(state, format("{}=\"{}\", invalid data.", ipsc->cCurrentModuleObject, desDayInput.Title)); - ShowContinueError(state, format("..invalid field: {}=\"{}\".", ipsc->cAlphaFieldNames(11), ipsc->cAlphaArgs(11))); - ShowContinueError(state, "..Specified [Schedule] Values are not >= 0.0"); + if (!desDayInput.beamSolarSched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, ipsc->cAlphaFieldNames(11), ipsc->cAlphaArgs(11), Clusive::In, 0.0); ErrorsFound = true; } } @@ -6307,25 +6324,24 @@ namespace Weather { // A12, \field Diffuse Solar Day Schedule Name if (ipsc->lAlphaFieldBlanks(12)) { // should have entered diffuse schedule - ShowSevereEmptyField(state, eoh, ipsc->cAlphaFieldNames(12), "", ""); + ShowSevereEmptyField(state, eoh, ipsc->cAlphaFieldNames(12)); ErrorsFound = true; - } else if ((desDayInput.DiffuseSolarSchPtr = ScheduleManager::GetDayScheduleIndex(state, ipsc->cAlphaArgs(12))) == 0) { + } else if ((desDayInput.diffuseSolarSched = Sched::GetDaySchedule(state, ipsc->cAlphaArgs(12))) == nullptr) { ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(12), ipsc->cAlphaArgs(12)); ErrorsFound = true; } else { - Array2D tmp = Array2D(state.dataGlobal->NumOfTimeStepInHour, Constant::HoursInDay); - ScheduleManager::GetSingleDayScheduleValues(state, desDayInput.DiffuseSolarSchPtr, tmp); + std::vector const &dayVals = desDayInput.diffuseSolarSched->getDayVals(state); auto &desDayModsEnvrn = state.dataWeather->desDayMods(EnvrnNum); - for (int iHr = 1; iHr <= Constant::HoursInDay; ++iHr) - for (int iTS = 1; iTS <= state.dataGlobal->NumOfTimeStepInHour; ++iTS) - desDayModsEnvrn(iTS, iHr).DifSolarRad = tmp(iTS, iHr); + for (int hr = 0; hr < Constant::iHoursInDay; ++hr) + for (int ts = 0; ts < state.dataGlobal->TimeStepsInHour; ++ts) + desDayModsEnvrn(ts + 1, hr + 1).DifSolarRad = dayVals[hr * state.dataGlobal->TimeStepsInHour + ts]; - units = "[W/m2]"; + // units = "[W/m2]"; unitType = Constant::Units::W_m2; if (std::find(state.dataWeather->spSiteSchedNums.begin(), state.dataWeather->spSiteSchedNums.end(), - desDayInput.DiffuseSolarSchPtr) == state.dataWeather->spSiteSchedNums.end()) { - state.dataWeather->spSiteSchedNums.emplace_back(desDayInput.DiffuseSolarSchPtr); + desDayInput.diffuseSolarSched->Num) == state.dataWeather->spSiteSchedNums.end()) { + state.dataWeather->spSiteSchedNums.emplace_back(desDayInput.diffuseSolarSched->Num); SetupOutputVariable(state, "Sizing Period Site Diffuse Solar Schedule Value", unitType, @@ -6334,10 +6350,8 @@ namespace Weather { OutputProcessor::StoreType::Average, ipsc->cAlphaArgs(12)); } - if (!ScheduleManager::CheckDayScheduleValueMinMax(state, desDayInput.DiffuseSolarSchPtr, 0.0, false)) { - ShowSevereError(state, format("{}=\"{}\", invalid data.", ipsc->cCurrentModuleObject, desDayInput.Title)); - ShowContinueError(state, format("..invalid field: {}=\"{}\".", ipsc->cAlphaFieldNames(12), ipsc->cAlphaArgs(12))); - ShowContinueError(state, "..Specified [Schedule] Values are not >= 0.0"); + if (!desDayInput.diffuseSolarSched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, ipsc->cAlphaFieldNames(12), ipsc->cAlphaArgs(12), Clusive::In, 0.0); ErrorsFound = true; } } @@ -6404,7 +6418,7 @@ namespace Weather { } // A2, \field Day Type - desDayInput.DayType = getEnumValue(ScheduleManager::dayTypeNamesUC, ipsc->cAlphaArgs(2)); + desDayInput.DayType = getEnumValue(Sched::dayTypeNamesUC, ipsc->cAlphaArgs(2)); if (desDayInput.DayType <= 0) { ShowSevereInvalidKey(state, eoh, ipsc->cAlphaFieldNames(2), ipsc->cAlphaArgs(2)); ErrorsFound = true; @@ -6607,20 +6621,20 @@ namespace Weather { wpSkyTemp.Name = !ipsc->lAlphaFieldBlanks(1) ? ipsc->cAlphaArgs(1) : "All RunPeriods"; // Validate Calculation Type. - std::string units; + // std::string units; Constant::Units unitType; wpSkyTemp.skyTempModel = static_cast(getEnumValue(Weather::SkyTempModelNamesUC, ipsc->cAlphaArgs(2))); switch (wpSkyTemp.skyTempModel) { case SkyTempModel::ScheduleValue: { wpSkyTemp.IsSchedule = true; - units = "[C]"; + // units = "[C]"; unitType = Constant::Units::C; } break; case SkyTempModel::DryBulbDelta: case SkyTempModel::DewPointDelta: { wpSkyTemp.IsSchedule = true; - units = "[deltaC]"; + // units = "[deltaC]"; unitType = Constant::Units::deltaC; } break; case SkyTempModel::Brunt: @@ -6632,33 +6646,30 @@ namespace Weather { default: { // Bad inputs are trapped by input processor assert(false); - } - } + } break; + } // switch (skyTempModel) if (wpSkyTemp.IsSchedule) { - wpSkyTemp.ScheduleName = ipsc->cAlphaArgs(3); if (state.dataWeather->Environment(Found).KindOfEnvrn == Constant::KindOfSim::RunPeriodWeather || state.dataWeather->Environment(Found).KindOfEnvrn == Constant::KindOfSim::RunPeriodDesign) { - wpSkyTemp.ScheduleName = ipsc->cAlphaArgs(3); // See if it's a schedule. - Found = ScheduleManager::GetScheduleIndex(state, ipsc->cAlphaArgs(3)); - if (Found == 0) { + if ((wpSkyTemp.sched = Sched::GetSchedule(state, ipsc->cAlphaArgs(3))) == nullptr) { ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(3), ipsc->cAlphaArgs(3)); ErrorsFound = true; } else { wpSkyTemp.IsSchedule = true; - wpSkyTemp.SchedulePtr = Found; } } else { // See if it's a valid schedule. - Found = ScheduleManager::GetDayScheduleIndex(state, ipsc->cAlphaArgs(3)); - if (Found == 0) { + // How can a schedule be either a yearly schedule or a day schedule? + if ((wpSkyTemp.sched = Sched::GetDaySchedule(state, ipsc->cAlphaArgs(3))) == nullptr) { ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(3), ipsc->cAlphaArgs(3)); ErrorsFound = true; } else { if (envFound != 0) { - if (std::find(state.dataWeather->spSiteSchedNums.begin(), state.dataWeather->spSiteSchedNums.end(), Found) == - state.dataWeather->spSiteSchedNums.end()) { - state.dataWeather->spSiteSchedNums.emplace_back(Found); + if (std::find(state.dataWeather->spSiteSchedNums.begin(), + state.dataWeather->spSiteSchedNums.end(), + wpSkyTemp.sched->Num) == state.dataWeather->spSiteSchedNums.end()) { + state.dataWeather->spSiteSchedNums.emplace_back(wpSkyTemp.sched->Num); SetupOutputVariable(state, "Sizing Period Site Sky Temperature Schedule Value", unitType, @@ -6668,15 +6679,13 @@ namespace Weather { ipsc->cAlphaArgs(3)); } wpSkyTemp.IsSchedule = true; - wpSkyTemp.SchedulePtr = Found; } } } } - BooleanSwitch b; if (!wpSkyTemp.IsSchedule && !ipsc->lAlphaFieldBlanks(4)) { - if ((b = getYesNoValue(Util::makeUPPER(ipsc->cAlphaArgs(4)))) != BooleanSwitch::Invalid) { + if (BooleanSwitch b = getYesNoValue(ipsc->cAlphaArgs(4)); b != BooleanSwitch::Invalid) { wpSkyTemp.UseWeatherFileHorizontalIR = static_cast(b); } else { ShowSevereInvalidBool(state, eoh, ipsc->cAlphaFieldNames(4), ipsc->cAlphaArgs(4)); @@ -6706,20 +6715,18 @@ namespace Weather { // in a new variable. // Initialize Site:GroundTemperature:BuildingSurface object - state.dataWeather->siteBuildingSurfaceGroundTempsPtr = GroundTemperatureManager::GetGroundTempModelAndInit( - state, GroundTemperatureManager::groundTempModelNamesUC[(int)GroundTempObjType::SiteBuildingSurfaceGroundTemp], ""); + state.dataWeather->siteBuildingSurfaceGroundTempsPtr = + GroundTemp::GetGroundTempModelAndInit(state, GroundTemp::ModelType::SiteBuildingSurface, ""); // Initialize Site:GroundTemperature:FCFactorMethod object - state.dataWeather->siteFCFactorMethodGroundTempsPtr = GroundTemperatureManager::GetGroundTempModelAndInit( - state, GroundTemperatureManager::groundTempModelNamesUC[static_cast(GroundTempObjType::SiteFCFactorMethodGroundTemp)], ""); + state.dataWeather->siteFCFactorMethodGroundTempsPtr = + GroundTemp::GetGroundTempModelAndInit(state, GroundTemp::ModelType::SiteFCFactorMethod, ""); // Initialize Site:GroundTemperature:Shallow object - state.dataWeather->siteShallowGroundTempsPtr = GroundTemperatureManager::GetGroundTempModelAndInit( - state, GroundTemperatureManager::groundTempModelNamesUC[static_cast(GroundTempObjType::SiteShallowGroundTemp)], ""); + state.dataWeather->siteShallowGroundTempsPtr = GroundTemp::GetGroundTempModelAndInit(state, GroundTemp::ModelType::SiteShallow, ""); // Initialize Site:GroundTemperature:Deep object - state.dataWeather->siteDeepGroundTempsPtr = GroundTemperatureManager::GetGroundTempModelAndInit( - state, GroundTemperatureManager::groundTempModelNamesUC[static_cast(GroundTempObjType::SiteDeepGroundTemp)], ""); + state.dataWeather->siteDeepGroundTempsPtr = GroundTemp::GetGroundTempModelAndInit(state, GroundTemp::ModelType::SiteDeep, ""); } void GetGroundReflectances(EnergyPlusData &state, bool &ErrorsFound) @@ -6884,13 +6891,15 @@ namespace Weather { switch (state.dataWeather->WaterMainsTempsMethod) { case WaterMainsTempCalcMethod::Schedule: { - state.dataWeather->WaterMainsTempsScheduleName = AlphArray(2); - state.dataWeather->WaterMainsTempsSchedule = ScheduleManager::GetScheduleIndex(state, AlphArray(2)); - if (state.dataWeather->WaterMainsTempsSchedule == 0) { + if (ipsc->lAlphaFieldBlanks(2)) { + ShowSevereEmptyField(state, eoh, ipsc->cAlphaFieldNames(2)); + ErrorsFound = true; + } else if ((state.dataWeather->waterMainsTempSched = Sched::GetSchedule(state, AlphArray(2))) == nullptr) { ShowSevereItemNotFound(state, eoh, ipsc->cAlphaFieldNames(2), AlphArray(2)); ErrorsFound = true; } } break; + case WaterMainsTempCalcMethod::Correlation: { if (NumNums == 0) { ShowSevereError(state, format("{}: Missing Annual Average and Maximum Difference fields.", ipsc->cCurrentModuleObject)); @@ -6936,7 +6945,7 @@ namespace Weather { switch (state.dataWeather->WaterMainsTempsMethod) { case WaterMainsTempCalcMethod::Schedule: - state.dataEnvrn->WaterMainsTemp = ScheduleManager::GetCurrentScheduleValue(state, state.dataWeather->WaterMainsTempsSchedule); + state.dataEnvrn->WaterMainsTemp = state.dataWeather->waterMainsTempSched->getCurrentVal(); break; case WaterMainsTempCalcMethod::Correlation: state.dataEnvrn->WaterMainsTemp = WaterMainsTempFromCorrelation( @@ -6957,7 +6966,8 @@ namespace Weather { } } - Real64 WaterMainsTempFromCorrelation(EnergyPlusData &state, Real64 const AnnualOAAvgDryBulbTemp, Real64 const MonthlyOAAvgDryBulbTempMaxDiff) + Real64 + WaterMainsTempFromCorrelation(EnergyPlusData const &state, Real64 const AnnualOAAvgDryBulbTemp, Real64 const MonthlyOAAvgDryBulbTempMaxDiff) { // SUBROUTINE INFORMATION: @@ -6992,7 +7002,7 @@ namespace Weather { // calculated water main temp (F) Real64 CurrentWaterMainsTemp = Tavg + Offset + - Ratio * (Tdiff / 2.0) * latitude_sign * std::sin((0.986 * (state.dataEnvrn->DayOfYear - 15.0 - Lag) - 90) * Constant::DegToRadians); + Ratio * (Tdiff / 2.0) * latitude_sign * std::sin((0.986 * (state.dataEnvrn->DayOfYear - 15.0 - Lag) - 90) * Constant::DegToRad); if (CurrentWaterMainsTemp < 32.0) CurrentWaterMainsTemp = 32.0; @@ -7155,10 +7165,10 @@ namespace Weather { state.dataEnvrn->SkyClearness = ((state.dataEnvrn->DifSolarRad + state.dataEnvrn->BeamSolarRad) / (state.dataEnvrn->DifSolarRad + 0.0001) + Zeta) / (1.0 + Zeta); // Relative optical air mass - Real64 const AirMass = (1.0 - 0.1 * state.dataEnvrn->Elevation / 1000.0) / - (SinSunAltitude + 0.15 / std::pow(SunAltitude / Constant::DegToRadians + 3.885, 1.253)); + Real64 const relAirMass = + (1.0 - 0.1 * state.dataEnvrn->Elevation / 1000.0) / (SinSunAltitude + 0.15 / std::pow(SunAltitude / Constant::DegToRad + 3.885, 1.253)); // In the following, 93.73 is the extraterrestrial luminous efficacy - state.dataEnvrn->SkyBrightness = (state.dataEnvrn->DifSolarRad * 93.73) * AirMass / ExtraDirNormIll[state.dataEnvrn->Month - 1]; + state.dataEnvrn->SkyBrightness = (state.dataEnvrn->DifSolarRad * 93.73) * relAirMass / ExtraDirNormIll[state.dataEnvrn->Month - 1]; int ISkyClearness; // Sky clearness bin if (state.dataEnvrn->SkyClearness <= 1.065) { ISkyClearness = 0; @@ -7233,7 +7243,6 @@ namespace Weather { Real64 tz; // resultant tz meridian for (int i = -12; i <= 12; ++i) { if (temp > longl(i) && temp <= longh(i)) { - tz = i; tz = mod(i, 24.0); GetSTM = tz; break; @@ -7739,7 +7748,7 @@ namespace Weather { specialDay.Duration = 1; specialDay.DayType = 1; specialDay.WthrFile = true; - } else if (dateType == DateType::Invalid) { + } else { ShowSevereError(state, format("Invalid SpecialDay Date Field(WeatherFile)={}", Line.substr(0, Pos))); ErrorsFound = true; } @@ -7833,7 +7842,7 @@ namespace Weather { if (CurCount <= state.dataWeather->NumDataPeriods) { auto &dataPeriod = state.dataWeather->DataPeriods(CurCount); dataPeriod.DayOfWeek = Line.substr(0, Pos); - dataPeriod.WeekDay = getEnumValue(ScheduleManager::dayTypeNamesUC, dataPeriod.DayOfWeek); + dataPeriod.WeekDay = getEnumValue(Sched::dayTypeNamesUC, dataPeriod.DayOfWeek); if (dataPeriod.WeekDay < 1 || dataPeriod.WeekDay > 7) { ShowSevereError(state, fmt::format("Weather File -- Invalid Start Day of Week for Data Period #{}, Invalid day={}", @@ -8077,43 +8086,42 @@ namespace Weather { // Create arrays (InterpolationValues, SolarInterpolationValues) dependent on // Number of Time Steps in Hour. This will be used in the "SetCurrentWeather" procedure. - int halfpoint = 0; - - state.dataWeather->Interpolation.allocate(state.dataGlobal->NumOfTimeStepInHour); - state.dataWeather->SolarInterpolation.allocate(state.dataGlobal->NumOfTimeStepInHour); + state.dataWeather->Interpolation.allocate(state.dataGlobal->TimeStepsInHour); + state.dataWeather->SolarInterpolation.allocate(state.dataGlobal->TimeStepsInHour); state.dataWeather->Interpolation = 0.0; state.dataWeather->SolarInterpolation = 0.0; - for (int tloop = 1; tloop <= state.dataGlobal->NumOfTimeStepInHour; ++tloop) { + for (int tloop = 1; tloop <= state.dataGlobal->TimeStepsInHour; ++tloop) { state.dataWeather->Interpolation(tloop) = - (state.dataGlobal->NumOfTimeStepInHour == 1) ? 1.0 : min(1.0, (double(tloop) / double(state.dataGlobal->NumOfTimeStepInHour))); + (state.dataGlobal->TimeStepsInHour == 1) ? 1.0 : min(1.0, (double(tloop) / double(state.dataGlobal->TimeStepsInHour))); } - if (mod(state.dataGlobal->NumOfTimeStepInHour, 2) == 0) { + if (mod(state.dataGlobal->TimeStepsInHour, 2) == 0) { // even number of time steps. - halfpoint = state.dataGlobal->NumOfTimeStepInHour / 2; + int halfpoint = state.dataGlobal->TimeStepsInHour / 2; + state.dataWeather->SolarInterpolation(halfpoint) = 1.0; - Real64 tweight = 1.0 / double(state.dataGlobal->NumOfTimeStepInHour); - for (int tloop = halfpoint + 1, hpoint = 1; tloop <= state.dataGlobal->NumOfTimeStepInHour; ++tloop, ++hpoint) { + Real64 tweight = 1.0 / double(state.dataGlobal->TimeStepsInHour); + for (int tloop = halfpoint + 1, hpoint = 1; tloop <= state.dataGlobal->TimeStepsInHour; ++tloop, ++hpoint) { state.dataWeather->SolarInterpolation(tloop) = 1.0 - hpoint * tweight; } for (int tloop = halfpoint - 1, hpoint = 1; tloop >= 1; --tloop, ++hpoint) { state.dataWeather->SolarInterpolation(tloop) = 1.0 - hpoint * tweight; } } else { // odd number of time steps - if (state.dataGlobal->NumOfTimeStepInHour == 1) { + if (state.dataGlobal->TimeStepsInHour == 1) { state.dataWeather->SolarInterpolation(1) = 0.5; - } else if (state.dataGlobal->NumOfTimeStepInHour == 3) { + } else if (state.dataGlobal->TimeStepsInHour == 3) { state.dataWeather->SolarInterpolation(1) = 5.0 / 6.0; state.dataWeather->SolarInterpolation(2) = 5.0 / 6.0; state.dataWeather->SolarInterpolation(3) = 0.5; } else { - Real64 tweight = 1.0 / double(state.dataGlobal->NumOfTimeStepInHour); - halfpoint = state.dataGlobal->NumOfTimeStepInHour / 2; + Real64 tweight = 1.0 / double(state.dataGlobal->TimeStepsInHour); + int halfpoint = state.dataGlobal->TimeStepsInHour / 2; Real64 tweight1 = 1.0 - tweight / 2.0; state.dataWeather->SolarInterpolation(halfpoint) = tweight1; state.dataWeather->SolarInterpolation(halfpoint + 1) = tweight1; - for (int tloop = halfpoint + 2, hpoint = 1; tloop <= state.dataGlobal->NumOfTimeStepInHour; ++tloop, ++hpoint) { + for (int tloop = halfpoint + 2, hpoint = 1; tloop <= state.dataGlobal->TimeStepsInHour; ++tloop, ++hpoint) { state.dataWeather->SolarInterpolation(tloop) = tweight1 - hpoint * tweight; } for (int tloop = halfpoint - 1, hpoint = 1; tloop >= 1; --tloop, ++hpoint) { @@ -8316,7 +8324,7 @@ namespace Weather { return {tyyyy, tmm, tdd}; } - ScheduleManager::DayType calculateDayOfWeek(EnergyPlusData &state, int const year, int const month, int const day) + Sched::DayType calculateDayOfWeek(EnergyPlusData &state, int const year, int const month, int const day) { // FUNCTION INFORMATION: @@ -8346,7 +8354,7 @@ namespace Weather { state.dataEnvrn->DayOfWeek = mod(day + (13 * (Gmm + 1) / 5) + Gyyyy + (Gyyyy / 4) + 6 * (Gyyyy / 100) + (Gyyyy / 400), 7); if (state.dataEnvrn->DayOfWeek == 0) state.dataEnvrn->DayOfWeek = 7; - return static_cast(state.dataEnvrn->DayOfWeek); + return static_cast(state.dataEnvrn->DayOfWeek); } int calculateDayOfYear(int const Month, int const Day, bool const leapYear) @@ -8504,12 +8512,10 @@ namespace Weather { // increase number of days for february by one day if weather data has leap year EndDayOfMonthLocal(2) = EndDayOfMonthLocal(2) + 1; } - int DayNum; - int DaysCountOfMonth; for (int i = 1; i <= 12; ++i) { Real64 MonthlyDailyDryBulbAvg = 0.0; - DaysCountOfMonth = EndDayOfMonthLocal(i); - for (DayNum = 1; DayNum <= DaysCountOfMonth; ++DayNum) { + int DaysCountOfMonth = EndDayOfMonthLocal(i); + for (int DayNum = 1; DayNum <= DaysCountOfMonth; ++DayNum) { Real64 DailyAverageDryBulbTemp = 0.0; std::string::size_type pos; for (int j = 1; j <= 24; ++j) { @@ -8572,7 +8578,7 @@ namespace Weather { case WaterMainsTempCalcMethod::Schedule: *eiostream << "Site Water Mains Temperature Information,"; *eiostream << waterMainsCalcMethodNames[static_cast(state.dataWeather->WaterMainsTempsMethod)] << "," - << state.dataWeather->WaterMainsTempsScheduleName << ","; + << state.dataWeather->waterMainsTempSched->Name << ","; *eiostream << format("{:.2R}", state.dataWeather->WaterMainsTempsAnnualAvgAirTemp) << "," << format("{:.2R}", state.dataWeather->WaterMainsTempsMaxDiffAirTemp) << ","; *eiostream << "NA\n"; @@ -8657,13 +8663,6 @@ namespace Weather { } } - void ForAllHrTs(EnergyPlusData &state, std::function f) - { - for (int iHr = 1; iHr <= Constant::HoursInDay; ++iHr) - for (int iTS = 1; iTS <= state.dataGlobal->NumOfTimeStepInHour; ++iTS) - f(iHr, iTS); - } - } // namespace Weather } // namespace EnergyPlus diff --git a/src/EnergyPlus/WeatherManager.hh b/src/EnergyPlus/WeatherManager.hh index 78dc5e60ae8..37762d9ec7a 100644 --- a/src/EnergyPlus/WeatherManager.hh +++ b/src/EnergyPlus/WeatherManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -53,7 +53,6 @@ // ObjexxFCL Headers #include -#include #include // EnergyPlus Headers @@ -61,12 +60,12 @@ #include #include #include +#include #include namespace EnergyPlus { // Forward declarations -class BaseGroundTempsModel; struct EnergyPlusData; namespace Weather { @@ -243,17 +242,16 @@ namespace Weather { int DSTIndicator = 0; // Daylight Saving Time Period Indicator (1=yes, 0=no) for this DesignDay DesDaySolarModel solarModel = DesDaySolarModel::ASHRAE_ClearSky; // Solar Model for creating solar values for design day. DesDayDryBulbRangeType dryBulbRangeType = DesDayDryBulbRangeType::Default; // Drybulb Range Type (see Parameters) - int TempRangeSchPtr = 0; // Schedule pointer to a day schedule for dry-bulb temperature range multipliers - int HumIndSchPtr = 0; // Schedule pointer to a day schedule that specifies - // relative humidity (%) or wet-bulb range multipliers per HumIndType - int BeamSolarSchPtr = 0; // Schedule pointer to a day schedule for beam solar - int DiffuseSolarSchPtr = 0; // Schedule pointer to a day schedule for diffuse solar - Real64 TauB = 0.0; // beam pseudo optical depth for ASHRAE tau model - Real64 TauD = 0.0; // diffuse pseudo optical depth for ASHRAE tau model - Real64 DailyWBRange = 0.0; // daily range of wetbulb (deltaC) - bool PressureEntered = false; // true if a pressure was entered in design day data - bool DewPointNeedsSet = false; // true if the Dewpoint humidicating value needs to be set (after location determined) - int maxWarmupDays = -1; // Maximum warmup days between sizing periods + Sched::DaySchedule *tempRangeSched = nullptr; // day schedule for dry-bulb temperature range multipliers + Sched::DaySchedule *humIndSched = nullptr; // day schedule that specifies relative humidity (%) or wet-bulb range multipliers per HumIndType + Sched::DaySchedule *beamSolarSched = nullptr; // day schedule for beam solar + Sched::DaySchedule *diffuseSolarSched = nullptr; // day schedule for diffuse solar + Real64 TauB = 0.0; // beam pseudo optical depth for ASHRAE tau model + Real64 TauD = 0.0; // diffuse pseudo optical depth for ASHRAE tau model + Real64 DailyWBRange = 0.0; // daily range of wetbulb (deltaC) + bool PressureEntered = false; // true if a pressure was entered in design day data + bool DewPointNeedsSet = false; // true if the Dewpoint humidicating value needs to be set (after location determined) + int maxWarmupDays = -1; // Maximum warmup days between sizing periods bool suppressBegEnvReset = false; // true if this design day should be run without thermal history being reset at begin environment }; @@ -286,22 +284,22 @@ namespace Weather { int startYear = 2017; // entered in "consecutive"/real runperiod object int endMonth = 12; int endDay = 31; - int endJulianDate = 2458119; // Calculated end date (Julian or ordinal) for a weather file run period - int endYear = 2017; // entered in "consecutive"/real runperiod object - int dayOfWeek = 1; // Day of Week that the RunPeriod will start on (User Input) - ScheduleManager::DayType startWeekDay = ScheduleManager::DayType::Sunday; // Day of the week that the RunPeriod will start on (User Input) - bool useDST = false; // True if DaylightSavingTime is used for this RunPeriod - bool useHolidays = false; // True if Holidays are used for this RunPeriod (from WeatherFile) - bool applyWeekendRule = false; // True if "Weekend Rule" is to be applied to RunPeriod - bool useRain = true; // True if Rain from weather file should be used (set rain to true) - bool useSnow = true; // True if Snow from weather file should be used (set Snow to true) - Array1D_int monWeekDay = {1, 4, 4, 7, 2, 5, 7, 3, 6, 1, 4, 6}; // Weekday for first day of each month - int numSimYears = 1; // Total Number of years of simulation to be performed - bool isLeapYear = false; // True if Begin Year is leap year. - bool RollDayTypeOnRepeat = true; // If repeating run period, increment day type on repeat. - bool TreatYearsAsConsecutive = true; // When year rolls over, increment year and recalculate Leap Year - bool actualWeather = false; // true when using actual weather data - bool firstHrInterpUsingHr1 = false; // true for using Hour 1 for first hour interpolate; false for using Hour 24 + int endJulianDate = 2458119; // Calculated end date (Julian or ordinal) for a weather file run period + int endYear = 2017; // entered in "consecutive"/real runperiod object + int dayOfWeek = 1; // Day of Week that the RunPeriod will start on (User Input) + Sched::DayType startWeekDay = Sched::DayType::Sunday; // Day of the week that the RunPeriod will start on (User Input) + bool useDST = false; // True if DaylightSavingTime is used for this RunPeriod + bool useHolidays = false; // True if Holidays are used for this RunPeriod (from WeatherFile) + bool applyWeekendRule = false; // True if "Weekend Rule" is to be applied to RunPeriod + bool useRain = true; // True if Rain from weather file should be used (set rain to true) + bool useSnow = true; // True if Snow from weather file should be used (set Snow to true) + Array1D_int monWeekDay = {1, 4, 4, 7, 2, 5, 7, 3, 6, 1, 4, 6}; // Weekday for first day of each month + int numSimYears = 1; // Total Number of years of simulation to be performed + bool isLeapYear = false; // True if Begin Year is leap year. + bool RollDayTypeOnRepeat = true; // If repeating run period, increment day type on repeat. + bool TreatYearsAsConsecutive = true; // When year rolls over, increment year and recalculate Leap Year + bool actualWeather = false; // true when using actual weather data + bool firstHrInterpUsingHr1 = false; // true for using Hour 1 for first hour interpolate; false for using Hour 24 }; struct DayWeatherVariables // Derived Type for Storing Weather "Header" Data @@ -418,11 +416,10 @@ namespace Weather { struct WeatherProperties { // Members - std::string Name = ""; // Reference Name - std::string ScheduleName = ""; // Schedule Name or Algorithm Name - bool IsSchedule = true; // Default is using Schedule + std::string Name = ""; // Reference Name + bool IsSchedule = true; // Default is using Schedule SkyTempModel skyTempModel = SkyTempModel::ClarkAllen; - int SchedulePtr = 0; // pointer to schedule when used + Sched::DayOrYearSchedule *sched = nullptr; // schedule when used bool UsedForEnvrn = false; bool UseWeatherFileHorizontalIR = true; // If false, horizontal IR and sky temperature are calculated with WP models }; @@ -432,8 +429,8 @@ namespace Weather { std::string Name = ""; Real64 distanceFromLeadingEdge = 0.0; int OSCMIndex = 0; - int WaterTempScheduleIndex = 0; - int VelocityScheduleIndex = 0; + Sched::Schedule *waterTempSched = nullptr; + Sched::Schedule *velocitySched = nullptr; }; // Functions @@ -564,7 +561,7 @@ namespace Weather { void AllocateWeatherData(EnergyPlusData &state); - void CalculateDailySolarCoeffs(EnergyPlusData &state, + void CalculateDailySolarCoeffs(EnergyPlusData const &state, int DayOfYear, // Day of year (1 - 366) Real64 &A, // ASHRAE "A" - Apparent solar irradiation at air mass = 0 [W/M**2] Real64 &B, // ASHRAE "B" - Atmospheric extinction coefficient @@ -575,7 +572,7 @@ namespace Weather { Real64 &CosineSolarDeclination // Cosine of Solar Declination ); - void CalculateSunDirectionCosines(EnergyPlusData &state, + void CalculateSunDirectionCosines(EnergyPlusData const &state, Real64 TimeValue, // Current Time of Day Real64 EqOfTime, // Equation of Time Real64 SinSolDeclin, // Sine of Solar Declination @@ -642,7 +639,7 @@ namespace Weather { void CalcWaterMainsTemp(EnergyPlusData &state); - Real64 WaterMainsTempFromCorrelation(EnergyPlusData &state, + Real64 WaterMainsTempFromCorrelation(EnergyPlusData const &state, Real64 AnnualOAAvgDryBulbTemp, // annual average OA drybulb temperature Real64 MonthlyOAAvgDryBulbTempMaxDiff // monthly daily average OA drybulb temperature maximum difference ); @@ -683,7 +680,7 @@ namespace Weather { GregorianDate computeGregorianDate(int jdate); - ScheduleManager::DayType calculateDayOfWeek(EnergyPlusData &state, int year, int month, int day); + Sched::DayType calculateDayOfWeek(EnergyPlusData &state, int year, int month, int day); int calculateDayOfYear(int Month, int Day, bool leapYear = false); @@ -762,8 +759,6 @@ namespace Weather { Real64 SkyTemp = 0.0; }; - // Here's a fun little function - void ForAllHrTs(EnergyPlusData &state, std::function f); } // namespace Weather struct WeatherManagerData : BaseGlobalStruct @@ -803,10 +798,9 @@ struct WeatherManagerData : BaseGlobalStruct Real64 SnowGndRefModifierForDayltg = 1.0; // Modifier to ground reflectance during snow for daylighting Weather::WaterMainsTempCalcMethod WaterMainsTempsMethod = Weather::WaterMainsTempCalcMethod::FixedDefault; // Water mains temperature calculation method - int WaterMainsTempsSchedule = 0; // Water mains temperature schedule + Sched::Schedule *waterMainsTempSched = nullptr; // Water mains temperature schedule Real64 WaterMainsTempsAnnualAvgAirTemp = 0.0; // Annual average outdoor air temperature (C) Real64 WaterMainsTempsMaxDiffAirTemp = 0.0; // Maximum difference in monthly average outdoor air temperatures (deltaC) - std::string WaterMainsTempsScheduleName = ""; // water mains tempeature schedule name bool wthFCGroundTemps = false; int TotRunPers = 0; // Total number of Run Periods (Weather data) to Setup @@ -907,10 +901,10 @@ struct WeatherManagerData : BaseGlobalStruct EPVector SpecialDays; // NOLINT(cert-err58-cpp) EPVector DataPeriods; // NOLINT(cert-err58-cpp) - std::shared_ptr siteShallowGroundTempsPtr; - std::shared_ptr siteBuildingSurfaceGroundTempsPtr; - std::shared_ptr siteFCFactorMethodGroundTempsPtr; - std::shared_ptr siteDeepGroundTempsPtr; + GroundTemp::BaseGroundTempsModel *siteShallowGroundTempsPtr; // non-owning pointer + GroundTemp::BaseGroundTempsModel *siteBuildingSurfaceGroundTempsPtr; // non-owning pointer + GroundTemp::BaseGroundTempsModel *siteFCFactorMethodGroundTempsPtr; // non-owning pointer + GroundTemp::BaseGroundTempsModel *siteDeepGroundTempsPtr; // non-owning pointer std::vector underwaterBoundaries; Weather::AnnualMonthlyDryBulbWeatherData OADryBulbAverage; // processes outside air drybulb temperature @@ -931,17 +925,16 @@ struct WeatherManagerData : BaseGlobalStruct // ProcessEPWHeader static vars std::string EPWHeaderTitle = ""; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } void clear_state() override { - this->siteShallowGroundTempsPtr.reset(); - this->siteBuildingSurfaceGroundTempsPtr.reset(); - this->siteFCFactorMethodGroundTempsPtr.reset(); - this->siteDeepGroundTempsPtr.reset(); - new (this) WeatherManagerData(); } }; diff --git a/src/EnergyPlus/WindTurbine.cc b/src/EnergyPlus/WindTurbine.cc index ab1ee89df7d..9164fd6c475 100644 --- a/src/EnergyPlus/WindTurbine.cc +++ b/src/EnergyPlus/WindTurbine.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -51,7 +51,6 @@ // ObjexxFCL Headers #include -#include #include // EnergyPlus Headers @@ -80,8 +79,6 @@ namespace WindTurbine { // MODULE INFORMATION: // AUTHOR Daeho Kang // DATE WRITTEN October 2009 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS MODULE: // This module is to calculate the electrical power output that wind turbine systems produce. @@ -117,8 +114,6 @@ namespace WindTurbine { // SUBROUTINE INFORMATION: // AUTHOR Daeho Kang // DATE WRITTEN October 2009 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine manages the simulation of wind turbine component. @@ -180,10 +175,9 @@ namespace WindTurbine { // AUTHOR B. Griffith // DATE WRITTEN Aug. 2008 // MODIFIED D Kang, October 2009 for Wind Turbine - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // This subroutine provides a "get" method to collect results for individual electic load centers. + // This subroutine provides a "get" method to collect results for individual electric load centers. GeneratorPower = state.dataWindTurbine->WindTurbineSys(GeneratorIndex).Power; GeneratorEnergy = state.dataWindTurbine->WindTurbineSys(GeneratorIndex).Energy; @@ -199,16 +193,12 @@ namespace WindTurbine { // SUBROUTINE INFORMATION: // AUTHOR Daeho Kang // DATE WRITTEN October 2009 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine gets input data for wind turbine components // and stores it in the wind turbine data structure. - // Using/Aliasing - - using ScheduleManager::GetScheduleIndex; + static constexpr std::string_view routineName = "GetWindTurbineInput"; // SUBROUTINE PARAMETER DEFINITIONS: static std::string const CurrentModuleObject("Generator:WindTurbine"); @@ -259,26 +249,20 @@ namespace WindTurbine { lAlphaBlanks, cAlphaFields, cNumericFields); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + Util::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), CurrentModuleObject, ErrorsFound); auto &windTurbine = state.dataWindTurbine->WindTurbineSys(WindTurbineNum); windTurbine.Name = state.dataIPShortCut->cAlphaArgs(1); // Name of wind turbine - windTurbine.Schedule = state.dataIPShortCut->cAlphaArgs(2); // Get schedule if (lAlphaBlanks(2)) { - windTurbine.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - windTurbine.SchedPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2)); - if (windTurbine.SchedPtr == 0) { - ShowSevereError(state, - format("{}=\"{}\" invalid {}=\"{}\" not found.", - CurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - cAlphaFields(2), - state.dataIPShortCut->cAlphaArgs(2))); - ErrorsFound = true; - } + windTurbine.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((windTurbine.availSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), state.dataIPShortCut->cAlphaArgs(2)); + ErrorsFound = true; } // Select rotor type windTurbine.rotorType = @@ -766,7 +750,6 @@ namespace WindTurbine { // AUTHOR Daeho Kang // DATE WRITTEN Oct 2009 // MODIFIED Linda K. Lawrie, December 2009 for reading stat file - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine reads monthly average wind speed from stat file and then @@ -779,18 +762,14 @@ namespace WindTurbine { static char const TabChr('\t'); // Tab character - int mon; // loop counter - bool wsStatFound; // logical noting that wind stats were found - bool warningShown; // true if the <365 warning has already been shown Array1D MonthWS(12); - Real64 LocalTMYWS; // Annual average wind speed at the rotor height // Estimate average annual wind speed once if (state.dataWindTurbine->MyOneTimeFlag) { - wsStatFound = false; Real64 AnnualTMYWS = 0.0; if (FileSystem::fileExists(state.files.inStatFilePath.filePath)) { auto statFile = state.files.inStatFilePath.open(state, "InitWindTurbine"); + bool wsStatFound = false; // logical noting that wind stats were found while (statFile.good()) { // end of file auto lineIn = statFile.readLine(); // reconcile line with different versions of stat file @@ -805,8 +784,8 @@ namespace WindTurbine { lineIn.data.erase(0, lnPtr + 10); MonthWS = 0.0; wsStatFound = true; - warningShown = false; - for (mon = 1; mon <= 12; ++mon) { + bool warningShown = false; // true if the <365 warning has already been shown + for (int mon = 1; mon <= 12; ++mon) { lnPtr = index(lineIn.data, TabChr); if (lnPtr != 1) { if ((lnPtr == std::string::npos) || (!stripped(lineIn.data.substr(0, lnPtr)).empty())) { @@ -868,8 +847,8 @@ namespace WindTurbine { // Factor differences between TMY wind data and local wind data once if (windTurbine.AnnualTMYWS > 0.0 && windTurbine.WSFactor == 0.0 && windTurbine.LocalAnnualAvgWS > 0) { // Convert the annual wind speed to the local wind speed at the height of the local station, then factor - LocalTMYWS = windTurbine.AnnualTMYWS * state.dataEnvrn->WeatherFileWindModCoeff * - std::pow(windTurbine.HeightForLocalWS / state.dataEnvrn->SiteWindBLHeight, state.dataEnvrn->SiteWindExp); + Real64 LocalTMYWS = windTurbine.AnnualTMYWS * state.dataEnvrn->WeatherFileWindModCoeff * + std::pow(windTurbine.HeightForLocalWS / state.dataEnvrn->SiteWindBLHeight, state.dataEnvrn->SiteWindExp); windTurbine.WSFactor = LocalTMYWS / windTurbine.LocalAnnualAvgWS; } // Assign factor of 1.0 if no stat file or no input of local average wind speed @@ -897,9 +876,7 @@ namespace WindTurbine { // SUBROUTINE INFORMATION: // AUTHOR Daeho Kang - // DATE WRITTEN Octorber 2009 - // MODIFIED na - // RE-ENGINEERED na + // DATE WRITTEN October 2009 // REFERENCES: // Sathyajith Mathew. 2006. Wind Energy: Fundamental, Resource Analysis and Economics. Springer, @@ -912,7 +889,6 @@ namespace WindTurbine { using DataEnvironment::OutWetBulbTempAt; using Psychrometrics::PsyRhoAirFnPbTdbW; using Psychrometrics::PsyWFnTdbTwbPb; - using ScheduleManager::GetCurrentScheduleValue; Real64 constexpr MaxTheta(90.0); // Maximum of theta Real64 constexpr MaxDegree(360.0); // Maximum limit of outdoor air wind speed in m/s @@ -942,7 +918,7 @@ namespace WindTurbine { Real64 IntRelFlowVel; // Integration of relative flow velocity Real64 TotTorque; // Total torque for the number of blades Real64 Omega; // Angular velocity of rotor in rad/s - Real64 TanForceCoeff; // Tnagential force coefficient + Real64 TanForceCoeff; // Tangential force coefficient Real64 NorForceCoeff; // Normal force coefficient Real64 Period; // Period of sine and cosine functions Real64 C1; // Empirical power coefficient C1 @@ -971,8 +947,7 @@ namespace WindTurbine { LocalWindSpeed /= windTurbine.WSFactor; // Check wind conditions for system operation - if (GetCurrentScheduleValue(state, windTurbine.SchedPtr) > 0 && LocalWindSpeed > windTurbine.CutInSpeed && - LocalWindSpeed < windTurbine.CutOutSpeed) { + if (windTurbine.availSched->getCurrentVal() > 0 && LocalWindSpeed > windTurbine.CutInSpeed && LocalWindSpeed < windTurbine.CutOutSpeed) { // System is on Period = 2.0 * Constant::Pi; @@ -1043,8 +1018,8 @@ namespace WindTurbine { InducedVel = LocalWindSpeed * 2.0 / 3.0; // Velocity components - Real64 const sin_AzimuthAng(std::sin(AzimuthAng * Constant::DegToRadians)); - Real64 const cos_AzimuthAng(std::cos(AzimuthAng * Constant::DegToRadians)); + Real64 const sin_AzimuthAng = std::sin(AzimuthAng * Constant::DegToRad); + Real64 const cos_AzimuthAng = std::cos(AzimuthAng * Constant::DegToRad); ChordalVel = RotorVel + InducedVel * cos_AzimuthAng; NormalVel = InducedVel * sin_AzimuthAng; RelFlowVel = std::sqrt(pow_2(ChordalVel) + pow_2(NormalVel)); @@ -1053,8 +1028,8 @@ namespace WindTurbine { AngOfAttack = std::atan((sin_AzimuthAng / ((RotorVel / LocalWindSpeed) / (InducedVel / LocalWindSpeed) + cos_AzimuthAng))); // Force coefficients - Real64 const sin_AngOfAttack(std::sin(AngOfAttack * Constant::DegToRadians)); - Real64 const cos_AngOfAttack(std::cos(AngOfAttack * Constant::DegToRadians)); + Real64 const sin_AngOfAttack = std::sin(AngOfAttack * Constant::DegToRad); + Real64 const cos_AngOfAttack = std::cos(AngOfAttack * Constant::DegToRad); TanForceCoeff = std::abs(windTurbine.LiftCoeff * sin_AngOfAttack - windTurbine.DragCoeff * cos_AngOfAttack); NorForceCoeff = windTurbine.LiftCoeff * cos_AngOfAttack + windTurbine.DragCoeff * sin_AngOfAttack; @@ -1127,8 +1102,6 @@ namespace WindTurbine { // SUBROUTINE INFORMATION: // AUTHOR Daeho Kang // DATE WRITTEN October 2009 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine fills remaining report variables. diff --git a/src/EnergyPlus/WindTurbine.hh b/src/EnergyPlus/WindTurbine.hh index cb8e5c1910d..85f0bd2aa9d 100644 --- a/src/EnergyPlus/WindTurbine.hh +++ b/src/EnergyPlus/WindTurbine.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -86,46 +86,45 @@ namespace WindTurbine { { // Members std::string Name; // The component name - std::string Schedule; // Available schedule RotorType rotorType = RotorType::Invalid; // Rotor type (HAWT or VAWT) ControlType controlType = ControlType::Invalid; // Control type - int SchedPtr = 0; // Schedule - int NumOfBlade = 0; // Blade number - Real64 RatedRotorSpeed = 0.0; // Rated rotor speed in m/s - Real64 RotorDiameter = 0.0; // Diameter of rotor in m - Real64 RotorHeight = 0.0; // Overall height of the rotor in m - Real64 RatedPower = 0.0; // Nominal average power output at the rated wind speed in Watts - Real64 RatedWindSpeed = 0.0; // Rated wind speed showing maximum power output in Watts - Real64 CutInSpeed = 0.0; // Minimum wind speed for system operation in m/s - Real64 CutOutSpeed = 0.0; // Maximum wind speed for system operation in m/s - Real64 SysEfficiency = 0.0; // Overall system efficiency including subsystems and losses - Real64 MaxTipSpeedRatio = 0.0; // Maximum tip speed ratio - Real64 MaxPowerCoeff = 0.0; // Maximum power coefficient - Real64 LocalAnnualAvgWS = 0.0; // Annual average wind speed locally measured in m/s - Real64 AnnualTMYWS = 0.0; // Annual average wind speed from stat file in m/s - Real64 HeightForLocalWS = 0.0; // Height of the local station in m - Real64 ChordArea = 0.0; // Chord area of a single blade for VAWTs in m2 - Real64 DragCoeff = 0.0; // Empirical blade drag coefficient for VAWTs - Real64 LiftCoeff = 0.0; // Empirical blade lift coefficient for VAWTs - std::array PowerCoeffs = {0.0}; // Empirical power coefficients for analytical calculation - Real64 TotPower = 0.0; // Maximum power produced from the wind in Watts - Real64 Power = 0.0; // Actual power wind turbine supplies to the building in Watts - Real64 TotEnergy = 0.0; // Maximum energy produced from the wind in Joules - Real64 Energy = 0.0; // Actual energy wind turbine supplies to the building in Joules - Real64 LocalWindSpeed = 0.0; // Local wind speed estimated at the particular height in m/s - Real64 LocalAirDensity = 0.0; // Local air density estimated at the particular height kg/m3 - Real64 PowerCoeff = 0.0; // Power coefficient determined - Real64 ChordalVel = 0.0; // Chordal velocity for VAWTs in m/s - Real64 NormalVel = 0.0; // Normal velocity for VAWTs in m/s - Real64 RelFlowVel = 0.0; // Relative flow velocity for VAWTs in m/s - Real64 TipSpeedRatio = 0.0; // Relative flow velocity for VAWTs in m/s - Real64 WSFactor = 0.0; // Relative flow velocity for VAWTs in m/s - Real64 AngOfAttack = 0.0; // Angle of attack in degree - Real64 IntRelFlowVel = 0.0; // Integral of relative flow velocity - Real64 TanForce = 0.0; // Tangential force - Real64 NorForce = 0.0; // Normal force in N.m - Real64 TotTorque = 0.0; // Total torque in N.m - Real64 AzimuthAng = 0.0; // Azimuth angle between blades + Sched::Schedule *availSched = nullptr; + int NumOfBlade = 0; // Blade number + Real64 RatedRotorSpeed = 0.0; // Rated rotor speed in m/s + Real64 RotorDiameter = 0.0; // Diameter of rotor in m + Real64 RotorHeight = 0.0; // Overall height of the rotor in m + Real64 RatedPower = 0.0; // Nominal average power output at the rated wind speed in Watts + Real64 RatedWindSpeed = 0.0; // Rated wind speed showing maximum power output in Watts + Real64 CutInSpeed = 0.0; // Minimum wind speed for system operation in m/s + Real64 CutOutSpeed = 0.0; // Maximum wind speed for system operation in m/s + Real64 SysEfficiency = 0.0; // Overall system efficiency including subsystems and losses + Real64 MaxTipSpeedRatio = 0.0; // Maximum tip speed ratio + Real64 MaxPowerCoeff = 0.0; // Maximum power coefficient + Real64 LocalAnnualAvgWS = 0.0; // Annual average wind speed locally measured in m/s + Real64 AnnualTMYWS = 0.0; // Annual average wind speed from stat file in m/s + Real64 HeightForLocalWS = 0.0; // Height of the local station in m + Real64 ChordArea = 0.0; // Chord area of a single blade for VAWTs in m2 + Real64 DragCoeff = 0.0; // Empirical blade drag coefficient for VAWTs + Real64 LiftCoeff = 0.0; // Empirical blade lift coefficient for VAWTs + std::array PowerCoeffs = {0.0}; // Empirical power coefficients for analytical calculation + Real64 TotPower = 0.0; // Maximum power produced from the wind in Watts + Real64 Power = 0.0; // Actual power wind turbine supplies to the building in Watts + Real64 TotEnergy = 0.0; // Maximum energy produced from the wind in Joules + Real64 Energy = 0.0; // Actual energy wind turbine supplies to the building in Joules + Real64 LocalWindSpeed = 0.0; // Local wind speed estimated at the particular height in m/s + Real64 LocalAirDensity = 0.0; // Local air density estimated at the particular height kg/m3 + Real64 PowerCoeff = 0.0; // Power coefficient determined + Real64 ChordalVel = 0.0; // Chordal velocity for VAWTs in m/s + Real64 NormalVel = 0.0; // Normal velocity for VAWTs in m/s + Real64 RelFlowVel = 0.0; // Relative flow velocity for VAWTs in m/s + Real64 TipSpeedRatio = 0.0; // Relative flow velocity for VAWTs in m/s + Real64 WSFactor = 0.0; // Relative flow velocity for VAWTs in m/s + Real64 AngOfAttack = 0.0; // Angle of attack in degree + Real64 IntRelFlowVel = 0.0; // Integral of relative flow velocity + Real64 TanForce = 0.0; // Tangential force + Real64 NorForce = 0.0; // Normal force in N.m + Real64 TotTorque = 0.0; // Total torque in N.m + Real64 AzimuthAng = 0.0; // Azimuth angle between blades }; void SimWindTurbine(EnergyPlusData &state, @@ -166,6 +165,10 @@ struct WindTurbineData : BaseGlobalStruct bool MyOneTimeFlag = true; EPVector WindTurbineSys; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/WindowAC.cc b/src/EnergyPlus/WindowAC.cc index 21fc96df840..2feebb33ea0 100644 --- a/src/EnergyPlus/WindowAC.cc +++ b/src/EnergyPlus/WindowAC.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -50,7 +50,6 @@ // ObjexxFCL Headers #include -#include // EnergyPlus Headers #include @@ -114,7 +113,6 @@ namespace WindowAC { using HVAC::SmallAirVolFlow; using HVAC::SmallLoad; using HVAC::SmallMassFlow; - using namespace ScheduleManager; using Psychrometrics::PsyCpAirFnW; using Psychrometrics::PsyHFnTdbW; using Psychrometrics::PsyRhoAirFnPbTdbW; @@ -178,7 +176,7 @@ namespace WindowAC { RemainingOutputToCoolingSP = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).RemainingOutputReqToCoolSP; - if (RemainingOutputToCoolingSP < 0.0 && state.dataHeatBalFanSys->TempControlType(ZoneNum) != HVAC::ThermostatType::SingleHeating) { + if (RemainingOutputToCoolingSP < 0.0 && state.dataHeatBalFanSys->TempControlType(ZoneNum) != HVAC::SetptType::SingleHeat) { QZnReq = RemainingOutputToCoolingSP; } else { QZnReq = 0.0; @@ -240,8 +238,6 @@ namespace WindowAC { Array1D_int OANodeNums(4); // Node numbers of Outdoor air mixer (OA, EA, RA, MA) int IOStatus; // Used in GetObjectItem bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine - bool errFlag(false); // Local error flag for GetOAMixerNodeNums - bool FanErrFlag(false); // Error flag used in GetFanIndex call Real64 FanVolFlow; // Fan volumetric flow rate bool CoilNodeErrFlag; // Used in error messages for mining coil outlet node number std::string CurrentModuleObject; // Object type for getting and error messages @@ -302,17 +298,14 @@ namespace WindowAC { state.dataWindowAC->WindAC(WindACNum).Name = Alphas(1); state.dataWindowAC->WindAC(WindACNum).UnitType = state.dataWindowAC->WindowAC_UnitType; // 'ZoneHVAC:WindowAirConditioner' - state.dataWindowAC->WindAC(WindACNum).Sched = Alphas(2); + if (lAlphaBlanks(2)) { - state.dataWindowAC->WindAC(WindACNum).SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - state.dataWindowAC->WindAC(WindACNum).SchedPtr = GetScheduleIndex(state, Alphas(2)); // convert schedule name to pointer - if (state.dataWindowAC->WindAC(WindACNum).SchedPtr == 0) { - ShowSevereError(state, format("{}=\"{}\" invalid data.", CurrentModuleObject, state.dataWindowAC->WindAC(WindACNum).Name)); - ShowContinueError(state, format("invalid-not found {}=\"{}\".", cAlphaFields(2), Alphas(2))); - ErrorsFound = true; - } + state.dataWindowAC->WindAC(WindACNum).availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((state.dataWindowAC->WindAC(WindACNum).availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } + state.dataWindowAC->WindAC(WindACNum).MaxAirVolFlow = Numbers(1); state.dataWindowAC->WindAC(WindACNum).OutAirVolFlow = Numbers(2); @@ -339,7 +332,7 @@ namespace WindowAC { state.dataWindowAC->WindAC(WindACNum).OAMixType = Alphas(5); state.dataWindowAC->WindAC(WindACNum).OAMixName = Alphas(6); // Get outdoor air mixer node numbers - errFlag = false; + bool errFlag = false; ValidateComponent(state, state.dataWindowAC->WindAC(WindACNum).OAMixType, state.dataWindowAC->WindAC(WindACNum).OAMixName, @@ -372,11 +365,9 @@ namespace WindowAC { if (windAC.fanType != HVAC::FanType::OnOff && windAC.fanType != HVAC::FanType::Constant && windAC.fanType != HVAC::FanType::SystemModel) { ShowSevereInvalidKey(state, eoh, cAlphaFields(8), Alphas(8), "Fan Type must be Fan:OnOff, Fan:ConstantVolume, or Fan:SystemModel."); - FanErrFlag = true; } else if ((windAC.FanIndex = Fans::GetFanIndex(state, windAC.FanName)) == 0) { ShowSevereItemNotFound(state, eoh, cAlphaFields(8), windAC.FanName); - FanErrFlag = true; } else { auto *fan = state.dataFans->fans(windAC.FanIndex); @@ -398,7 +389,7 @@ namespace WindowAC { ErrorsFound = true; } } - windAC.FanAvailSchedPtr = fan->availSchedNum; + windAC.fanAvailSched = fan->availSched; } state.dataWindowAC->WindAC(WindACNum).DXCoilName = Alphas(10); @@ -434,17 +425,11 @@ namespace WindowAC { ErrorsFound = true; } - state.dataWindowAC->WindAC(WindACNum).FanSchedPtr = GetScheduleIndex(state, Alphas(11)); - - // Default to cycling fan when fan mode schedule is not present - if (!lAlphaBlanks(11) && state.dataWindowAC->WindAC(WindACNum).FanSchedPtr == 0) { - ShowSevereError( - state, - format( - "{} \"{}\" {} not found: {}", CurrentModuleObject, state.dataWindowAC->WindAC(WindACNum).Name, cAlphaFields(11), Alphas(11))); - ErrorsFound = true; - } else if (lAlphaBlanks(11)) { + if (lAlphaBlanks(11)) { state.dataWindowAC->WindAC(WindACNum).fanOp = HVAC::FanOp::Cycling; + } else if ((state.dataWindowAC->WindAC(WindACNum).fanOpModeSched = Sched::GetSchedule(state, Alphas(11))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(11), Alphas(11)); + ErrorsFound = true; } state.dataWindowAC->WindAC(WindACNum).fanPlace = static_cast(getEnumValue(HVAC::fanPlaceNamesUC, Alphas(12))); @@ -721,7 +706,6 @@ namespace WindowAC { // AUTHOR Fred Buhl // DATE WRITTEN May 2000 // MODIFIED Chandan Sharma, FSEC, March 2011: Added zone sys avail manager - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine is for initializations of the Window AC Components. @@ -729,19 +713,6 @@ namespace WindowAC { // METHODOLOGY EMPLOYED: // Uses the status flags to trigger initializations. - using DataZoneEquipment::CheckZoneEquipmentList; - using HVAC::SmallLoad; - - int InNode; // inlet node number in window AC loop - int OutNode; // outlet node number in window AC loop - int InletNode; // inlet node number for window AC WindACNum - int OutsideAirNode; // outside air node number in window AC loop - int AirRelNode; // relief air node number in window AC loop - Real64 RhoAir; // air density at InNode - int Loop; // loop counter - Real64 QToCoolSetPt; // sensible load to cooling setpoint (W) - Real64 NoCompOutput; // sensible load delivered with compressor off (W) - // Do the one time initializations if (state.dataWindowAC->MyOneTimeFlag) { @@ -767,10 +738,10 @@ namespace WindowAC { // need to check all Window AC units to see if they are on Zone Equipment List or issue warning if (!state.dataWindowAC->ZoneEquipmentListChecked && state.dataZoneEquip->ZoneEquipInputsFilled) { state.dataWindowAC->ZoneEquipmentListChecked = true; - for (Loop = 1; Loop <= state.dataWindowAC->NumWindAC; ++Loop) { - if (CheckZoneEquipmentList(state, - state.dataWindowAC->cWindowAC_UnitTypes(state.dataWindowAC->WindAC(Loop).UnitType), - state.dataWindowAC->WindAC(Loop).Name)) + for (int Loop = 1; Loop <= state.dataWindowAC->NumWindAC; ++Loop) { + if (DataZoneEquipment::CheckZoneEquipmentList(state, + state.dataWindowAC->cWindowAC_UnitTypes(state.dataWindowAC->WindAC(Loop).UnitType), + state.dataWindowAC->WindAC(Loop).Name)) continue; ShowSevereError(state, format("InitWindowAC: Window AC Unit=[{},{}] is not on any ZoneHVAC:EquipmentList. It will not be simulated.", @@ -788,10 +759,10 @@ namespace WindowAC { // Do the Begin Environment initializations if (state.dataGlobal->BeginEnvrnFlag && state.dataWindowAC->MyEnvrnFlag(WindACNum)) { - InNode = state.dataWindowAC->WindAC(WindACNum).AirInNode; - OutNode = state.dataWindowAC->WindAC(WindACNum).AirOutNode; - OutsideAirNode = state.dataWindowAC->WindAC(WindACNum).OutsideAirNode; - RhoAir = state.dataEnvrn->StdRhoAir; + int InNode = state.dataWindowAC->WindAC(WindACNum).AirInNode; + int OutNode = state.dataWindowAC->WindAC(WindACNum).AirOutNode; + int OutsideAirNode = state.dataWindowAC->WindAC(WindACNum).OutsideAirNode; + Real64 RhoAir = state.dataEnvrn->StdRhoAir; // set the mass flow rates from the input volume flow rates state.dataWindowAC->WindAC(WindACNum).MaxAirMassFlow = RhoAir * state.dataWindowAC->WindAC(WindACNum).MaxAirVolFlow; state.dataWindowAC->WindAC(WindACNum).OutAirMassFlow = RhoAir * state.dataWindowAC->WindAC(WindACNum).OutAirVolFlow; @@ -809,8 +780,8 @@ namespace WindowAC { state.dataWindowAC->MyEnvrnFlag(WindACNum) = true; } - if (state.dataWindowAC->WindAC(WindACNum).FanSchedPtr > 0) { - if (GetCurrentScheduleValue(state, state.dataWindowAC->WindAC(WindACNum).FanSchedPtr) == 0.0) { + if (state.dataWindowAC->WindAC(WindACNum).fanOpModeSched != nullptr) { + if (state.dataWindowAC->WindAC(WindACNum).fanOpModeSched->getCurrentVal() == 0.0) { state.dataWindowAC->WindAC(WindACNum).fanOp = HVAC::FanOp::Cycling; } else { state.dataWindowAC->WindAC(WindACNum).fanOp = HVAC::FanOp::Continuous; @@ -818,12 +789,12 @@ namespace WindowAC { } // These initializations are done every iteration - InletNode = state.dataWindowAC->WindAC(WindACNum).AirInNode; - OutsideAirNode = state.dataWindowAC->WindAC(WindACNum).OutsideAirNode; - AirRelNode = state.dataWindowAC->WindAC(WindACNum).AirReliefNode; + int InletNode = state.dataWindowAC->WindAC(WindACNum).AirInNode; + int OutsideAirNode = state.dataWindowAC->WindAC(WindACNum).OutsideAirNode; + int AirRelNode = state.dataWindowAC->WindAC(WindACNum).AirReliefNode; // Set the inlet node mass flow rate - if (GetCurrentScheduleValue(state, state.dataWindowAC->WindAC(WindACNum).SchedPtr) <= 0.0 || - (GetCurrentScheduleValue(state, state.dataWindowAC->WindAC(WindACNum).FanAvailSchedPtr) <= 0.0 && !state.dataHVACGlobal->TurnFansOn) || + if (state.dataWindowAC->WindAC(WindACNum).availSched->getCurrentVal() <= 0.0 || + (state.dataWindowAC->WindAC(WindACNum).fanAvailSched->getCurrentVal() <= 0.0 && !state.dataHVACGlobal->TurnFansOn) || state.dataHVACGlobal->TurnFansOff) { state.dataWindowAC->WindAC(WindACNum).PartLoadFrac = 0.0; state.dataLoopNodes->Node(InletNode).MassFlowRate = 0.0; @@ -849,7 +820,7 @@ namespace WindowAC { } // Original thermostat control logic (works only for cycling fan systems) - if (QZnReq < (-1.0 * SmallLoad) && !state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) && + if (QZnReq < (-1.0 * HVAC::SmallLoad) && !state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) && state.dataWindowAC->WindAC(WindACNum).PartLoadFrac > 0.0) { state.dataWindowAC->CoolingLoad = true; } else { @@ -858,15 +829,17 @@ namespace WindowAC { // Constant fan systems are tested for ventilation load to determine if load to be met changes. if (state.dataWindowAC->WindAC(WindACNum).fanOp == HVAC::FanOp::Continuous && state.dataWindowAC->WindAC(WindACNum).PartLoadFrac > 0.0 && - (GetCurrentScheduleValue(state, state.dataWindowAC->WindAC(WindACNum).FanAvailSchedPtr) > 0.0 || state.dataHVACGlobal->TurnFansOn) && + (state.dataWindowAC->WindAC(WindACNum).fanAvailSched->getCurrentVal() > 0.0 || state.dataHVACGlobal->TurnFansOn) && !state.dataHVACGlobal->TurnFansOff) { + Real64 NoCompOutput; // sensible load delivered with compressor off (W) CalcWindowACOutput(state, WindACNum, FirstHVACIteration, state.dataWindowAC->WindAC(WindACNum).fanOp, 0.0, false, NoCompOutput); - QToCoolSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).RemainingOutputReqToCoolSP; + Real64 QToCoolSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).RemainingOutputReqToCoolSP; // If the unit has a net heating capacity and the zone temp is below the Tstat cooling setpoint - if (NoCompOutput > (-1.0 * SmallLoad) && QToCoolSetPt > (-1.0 * SmallLoad) && state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum)) { + if (NoCompOutput > (-1.0 * HVAC::SmallLoad) && QToCoolSetPt > (-1.0 * HVAC::SmallLoad) && + state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum)) { if (NoCompOutput > QToCoolSetPt) { QZnReq = QToCoolSetPt; state.dataWindowAC->CoolingLoad = true; @@ -883,7 +856,6 @@ namespace WindowAC { // DATE WRITTEN January 2002 // MODIFIED August 2013 Daeho Kang, add component sizing table entries // July 2014, B. Nigusse, added scalable sizing - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This subroutine is for sizing Window AC Unit components for which flow rates have not been @@ -892,40 +864,16 @@ namespace WindowAC { // METHODOLOGY EMPLOYED: // Obtains flow rates from the zone or system sizing arrays - auto &ZoneEqSizing(state.dataSize->ZoneEqSizing); - // Using/Aliasing using namespace DataSizing; - using HVAC::CoolingCapacitySizing; // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("SizeWindowAC: "); // include trailing blank space - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 MaxAirVolFlowDes; // Autosized maximum air flow for reporting - Real64 MaxAirVolFlowUser; // Hardsized maximum air flow for reporting - Real64 OutAirVolFlowDes; // Autosized outdoor air flow for reporting - Real64 OutAirVolFlowUser; // Hardsized outdoor ari flow for reporting - bool IsAutoSize; // Indicator to autosize - std::string CompName; // component name - std::string CompType; // component type - std::string SizingString; // input field sizing description (e.g., Nominal Capacity) - Real64 TempSize; // autosized value of coil input field - int FieldNum = 2; // IDD numeric field number where input field description is found - int SizingMethod; // Integer representation of sizing method name (e.g., CoolingAirflowSizing, HeatingAirflowSizing, CoolingCapacitySizing, - // HeatingCapacitySizing, etc.) - bool PrintFlag; // TRUE when sizing information is reported in the eio file - int zoneHVACIndex; // index of zoneHVAC equipment sizing specification - int SAFMethod(0); // supply air flow rate sizing method (SupplyAirFlowRate, FlowPerFloorArea, FractionOfAutosizedCoolingAirflow, - // FractionOfAutosizedHeatingAirflow ...) - int CapSizingMethod(0); // capacity sizing methods (HeatingDesignCapacity, CapacityPerFloorArea, FractionOfAutosizedCoolingCapacity, and - // FractionOfAutosizedHeatingCapacity ) - - IsAutoSize = false; - MaxAirVolFlowDes = 0.0; - MaxAirVolFlowUser = 0.0; - OutAirVolFlowDes = 0.0; - OutAirVolFlowUser = 0.0; + Real64 MaxAirVolFlowDes = 0.0; + Real64 MaxAirVolFlowUser = 0.0; + Real64 OutAirVolFlowDes = 0.0; + Real64 OutAirVolFlowUser = 0.0; state.dataSize->DataFracOfAutosizedCoolingAirflow = 1.0; state.dataSize->DataFracOfAutosizedHeatingAirflow = 1.0; state.dataSize->DataFracOfAutosizedCoolingCapacity = 1.0; @@ -934,34 +882,39 @@ namespace WindowAC { state.dataSize->ZoneHeatingOnlyFan = false; state.dataSize->ZoneCoolingOnlyFan = true; state.dataSize->DataScalableCapSizingON = false; - CompType = "ZoneHVAC:WindowAirConditioner"; - CompName = state.dataWindowAC->WindAC(WindACNum).Name; + std::string const CompType = "ZoneHVAC:WindowAirConditioner"; + std::string const CompName = state.dataWindowAC->WindAC(WindACNum).Name; state.dataSize->DataZoneNumber = state.dataWindowAC->WindAC(WindACNum).ZonePtr; state.dataSize->DataFanType = state.dataWindowAC->WindAC(WindACNum).fanType; state.dataSize->DataFanIndex = state.dataWindowAC->WindAC(WindACNum).FanIndex; state.dataSize->DataFanPlacement = state.dataWindowAC->WindAC(WindACNum).fanPlace; if (state.dataSize->CurZoneEqNum > 0) { + bool PrintFlag; // TRUE when sizing information is reported in the eio file + std::string SizingString; // input field sizing description (e.g., Nominal Capacity) + auto &ZoneEqSizing = state.dataSize->ZoneEqSizing(state.dataSize->CurZoneEqNum); + Real64 TempSize; // autosized value of coil input field + if (state.dataWindowAC->WindAC(WindACNum).HVACSizingIndex > 0) { - zoneHVACIndex = state.dataWindowAC->WindAC(WindACNum).HVACSizingIndex; + int zoneHVACIndex = state.dataWindowAC->WindAC(WindACNum).HVACSizingIndex; // N1 , \field Maximum Supply Air Flow Rate - SizingMethod = HVAC::CoolingAirflowSizing; + int SizingMethod = HVAC::CoolingAirflowSizing; PrintFlag = true; - SAFMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).CoolingSAFMethod; - ZoneEqSizing(state.dataSize->CurZoneEqNum).SizingMethod(SizingMethod) = SAFMethod; + int SAFMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).CoolingSAFMethod; + ZoneEqSizing.SizingMethod(SizingMethod) = SAFMethod; if (SAFMethod == None || SAFMethod == SupplyAirFlowRate || SAFMethod == FlowPerFloorArea || SAFMethod == FractionOfAutosizedCoolingAirflow) { if (SAFMethod == SupplyAirFlowRate) { if (state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxCoolAirVolFlow > 0.0) { - ZoneEqSizing(state.dataSize->CurZoneEqNum).AirVolFlow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxCoolAirVolFlow; - ZoneEqSizing(state.dataSize->CurZoneEqNum).SystemAirFlow = true; + ZoneEqSizing.AirVolFlow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxCoolAirVolFlow; + ZoneEqSizing.SystemAirFlow = true; } TempSize = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxCoolAirVolFlow; } else if (SAFMethod == FlowPerFloorArea) { - ZoneEqSizing(state.dataSize->CurZoneEqNum).SystemAirFlow = true; - ZoneEqSizing(state.dataSize->CurZoneEqNum).AirVolFlow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxCoolAirVolFlow * - state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea; - TempSize = ZoneEqSizing(state.dataSize->CurZoneEqNum).AirVolFlow; + ZoneEqSizing.SystemAirFlow = true; + ZoneEqSizing.AirVolFlow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxCoolAirVolFlow * + state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea; + TempSize = ZoneEqSizing.AirVolFlow; state.dataSize->DataScalableSizingON = true; } else if (SAFMethod == FractionOfAutosizedCoolingAirflow) { state.dataSize->DataFracOfAutosizedCoolingAirflow = state.dataSize->ZoneHVACSizing(zoneHVACIndex).MaxCoolAirVolFlow; @@ -980,7 +933,7 @@ namespace WindowAC { state.dataWindowAC->WindAC(WindACNum).MaxAirVolFlow = sizingCoolingAirFlow.size(state, TempSize, errorsFound); } else if (SAFMethod == FlowPerCoolingCapacity) { - SizingMethod = CoolingCapacitySizing; + SizingMethod = HVAC::CoolingCapacitySizing; TempSize = AutoSize; PrintFlag = false; state.dataSize->DataScalableSizingON = true; @@ -1008,21 +961,19 @@ namespace WindowAC { // DataScalableSizingON = false; // initialize capacity sizing variables: cooling - CapSizingMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).CoolingCapMethod; - ZoneEqSizing(state.dataSize->CurZoneEqNum).SizingMethod(SizingMethod) = CapSizingMethod; + int CapSizingMethod = state.dataSize->ZoneHVACSizing(zoneHVACIndex).CoolingCapMethod; + ZoneEqSizing.SizingMethod(SizingMethod) = CapSizingMethod; if (CapSizingMethod == CoolingDesignCapacity || CapSizingMethod == CapacityPerFloorArea || CapSizingMethod == FractionOfAutosizedCoolingCapacity) { if (CapSizingMethod == HeatingDesignCapacity) { if (state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledCoolingCapacity > 0.0) { - ZoneEqSizing(state.dataSize->CurZoneEqNum).CoolingCapacity = true; - ZoneEqSizing(state.dataSize->CurZoneEqNum).DesCoolingLoad = - state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledCoolingCapacity; + ZoneEqSizing.CoolingCapacity = true; + ZoneEqSizing.DesCoolingLoad = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledCoolingCapacity; } } else if (CapSizingMethod == CapacityPerFloorArea) { - ZoneEqSizing(state.dataSize->CurZoneEqNum).CoolingCapacity = true; - ZoneEqSizing(state.dataSize->CurZoneEqNum).DesCoolingLoad = - state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledCoolingCapacity * - state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea; + ZoneEqSizing.CoolingCapacity = true; + ZoneEqSizing.DesCoolingLoad = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledCoolingCapacity * + state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea; state.dataSize->DataScalableCapSizingON = true; } else if (CapSizingMethod == FractionOfAutosizedCoolingCapacity) { state.dataSize->DataFracOfAutosizedCoolingCapacity = state.dataSize->ZoneHVACSizing(zoneHVACIndex).ScaledCoolingCapacity; @@ -1033,7 +984,7 @@ namespace WindowAC { // no scalble sizing method has been specified. Sizing proceeds using the method // specified in the zoneHVAC object // N1 , \field Maximum Supply Air Flow Rate - FieldNum = 1; + int FieldNum = 1; PrintFlag = true; SizingString = state.dataWindowAC->WindACNumericFields(WindACNum).FieldNames(FieldNum) + " [m3/s]"; TempSize = state.dataWindowAC->WindAC(WindACNum).MaxAirVolFlow; @@ -1067,8 +1018,9 @@ namespace WindowAC { } if (state.dataSize->CurZoneEqNum > 0) { - ZoneEqSizing(state.dataSize->CurZoneEqNum).OAVolFlow = state.dataWindowAC->WindAC(WindACNum).OutAirVolFlow; - ZoneEqSizing(state.dataSize->CurZoneEqNum).AirVolFlow = state.dataWindowAC->WindAC(WindACNum).MaxAirVolFlow; + auto &ZoneEqSizing = state.dataSize->ZoneEqSizing(state.dataSize->CurZoneEqNum); + ZoneEqSizing.OAVolFlow = state.dataWindowAC->WindAC(WindACNum).OutAirVolFlow; + ZoneEqSizing.AirVolFlow = state.dataWindowAC->WindAC(WindACNum).MaxAirVolFlow; } state.dataSize->DataScalableCapSizingON = false; @@ -1088,7 +1040,6 @@ namespace WindowAC { // AUTHOR Fred Buhl // DATE WRITTEN May 2000 // MODIFIED Buhl/Shirey Mar 2001, Shirey Aug 2009 (LatOutputProvided) - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Simulate a cycling window air conditioner unit; adjust its output to match the @@ -1098,37 +1049,22 @@ namespace WindowAC { // If unit is on, calls ControlWindACOutput to obtain the desired unit output Real64 PartLoadFrac; // unit part load fraction - Real64 QUnitOut; // Dry air sens. cooling provided by AC unit [watts] - Real64 SensCoolOut; // Moist air sensible cooling rate [W] - Real64 LatentOutput; // Latent (moisture) add/removal rate, negative is dehumidification [kg/s] - bool UnitOn; // TRUE if unit is on - bool CoilOn; // TRUE if coil is on - int OutletNode; // unit air outlet node - int InletNode; // unit air inlet node - Real64 QTotUnitOut; // total unit output [watts] - Real64 AirMassFlow; // air mass flow rate [kg/sec] - Real64 CpAir; // inlet air specific heat [J/kg-C] - Real64 Test; - HVAC::FanOp fanOp; // operating mode (fan cycling or continious; DX coil always cycles) - Real64 MinHumRat; // minimum of inlet & outlet humidity ratio - bool HXUnitOn; // Used to control HX heat recovery as needed - Real64 SpecHumOut; // Specific humidity ratio of outlet air (kg moisture / kg moist air) - Real64 SpecHumIn; // Specific humidity ratio of inlet air (kg moisture / kg moist air) + bool HXUnitOn; // Used to control HX heat recovery as needed // zero the DX coil electricity consumption state.dataHVACGlobal->DXElecCoolingPower = 0.0; // initialize local variables - UnitOn = true; - CoilOn = true; - QUnitOut = 0.0; - LatentOutput = 0.0; - OutletNode = state.dataWindowAC->WindAC(WindACNum).AirOutNode; - InletNode = state.dataWindowAC->WindAC(WindACNum).AirInNode; - AirMassFlow = state.dataLoopNodes->Node(InletNode).MassFlowRate; - Test = AirMassFlow; - CpAir = PsyCpAirFnW(state.dataLoopNodes->Node(InletNode).HumRat); - fanOp = state.dataWindowAC->WindAC(WindACNum).fanOp; + bool UnitOn = true; + bool CoilOn = true; + Real64 QUnitOut = 0.0; // Dry air sens. cooling provided by AC unit [watts] + Real64 LatentOutput = 0.0; // Latent (moisture) add/removal rate, negative is dehumidification [kg/s] + int OutletNode = state.dataWindowAC->WindAC(WindACNum).AirOutNode; + int InletNode = state.dataWindowAC->WindAC(WindACNum).AirInNode; + Real64 AirMassFlow = state.dataLoopNodes->Node(InletNode).MassFlowRate; + Real64 Test = AirMassFlow; + Real64 CpAir = PsyCpAirFnW(state.dataLoopNodes->Node(InletNode).HumRat); // inlet air specific heat [J/kg-C] + HVAC::FanOp fanOp = state.dataWindowAC->WindAC(WindACNum).fanOp; // set the on/off flags if (state.dataWindowAC->WindAC(WindACNum).fanOp == HVAC::FanOp::Cycling) { @@ -1165,19 +1101,19 @@ namespace WindowAC { // manipulated in subroutine CalcWindowACOutput AirMassFlow = state.dataLoopNodes->Node(InletNode).MassFlowRate; - MinHumRat = min(state.dataLoopNodes->Node(InletNode).HumRat, state.dataLoopNodes->Node(OutletNode).HumRat); + Real64 MinHumRat = min(state.dataLoopNodes->Node(InletNode).HumRat, state.dataLoopNodes->Node(OutletNode).HumRat); QUnitOut = AirMassFlow * (PsyHFnTdbW(state.dataLoopNodes->Node(OutletNode).Temp, MinHumRat) - PsyHFnTdbW(state.dataLoopNodes->Node(InletNode).Temp, MinHumRat)); - SensCoolOut = AirMassFlow * (PsyHFnTdbW(state.dataLoopNodes->Node(OutletNode).Temp, MinHumRat) - - PsyHFnTdbW(state.dataLoopNodes->Node(InletNode).Temp, MinHumRat)); + Real64 SensCoolOut = AirMassFlow * (PsyHFnTdbW(state.dataLoopNodes->Node(OutletNode).Temp, MinHumRat) - + PsyHFnTdbW(state.dataLoopNodes->Node(InletNode).Temp, MinHumRat)); // CR9155 Remove specific humidity calculations - SpecHumOut = state.dataLoopNodes->Node(OutletNode).HumRat; - SpecHumIn = state.dataLoopNodes->Node(InletNode).HumRat; + Real64 SpecHumOut = state.dataLoopNodes->Node(OutletNode).HumRat; + Real64 SpecHumIn = state.dataLoopNodes->Node(InletNode).HumRat; LatentOutput = AirMassFlow * (SpecHumOut - SpecHumIn); // Latent rate, kg/s - QTotUnitOut = AirMassFlow * (state.dataLoopNodes->Node(OutletNode).Enthalpy - state.dataLoopNodes->Node(InletNode).Enthalpy); + Real64 QTotUnitOut = AirMassFlow * (state.dataLoopNodes->Node(OutletNode).Enthalpy - state.dataLoopNodes->Node(InletNode).Enthalpy); // report variables state.dataWindowAC->WindAC(WindACNum).CompPartLoadRatio = state.dataWindowAC->WindAC(WindACNum).PartLoadFrac; @@ -1209,8 +1145,6 @@ namespace WindowAC { // SUBROUTINE INFORMATION: // AUTHOR Fred Buhl // DATE WRITTEN May 2000 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Fills some of the report variables for the window AC units @@ -1243,7 +1177,6 @@ namespace WindowAC { // AUTHOR Fred Buhl // DATE WRITTEN May 2000 // MODIFIED July 2012, Chandan Sharma - FSEC: Added zone sys avail managers - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Simulate the components making up the cycling window AC unit. @@ -1251,20 +1184,10 @@ namespace WindowAC { // METHODOLOGY EMPLOYED: // Simulates the unit components sequentially in the air flow direction. - using DXCoils::SimDXCoil; - using HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil; - - int OutletNode; // unit air outlet node - int InletNode; // unit air inlet node - int OutsideAirNode; // outside air node number in window AC loop - int AirRelNode; // relief air node number in window AC loop - Real64 AirMassFlow; // total mass flow through the unit - Real64 MinHumRat; // minimum of inlet & outlet humidity ratio - - OutletNode = state.dataWindowAC->WindAC(WindACNum).AirOutNode; - InletNode = state.dataWindowAC->WindAC(WindACNum).AirInNode; - OutsideAirNode = state.dataWindowAC->WindAC(WindACNum).OutsideAirNode; - AirRelNode = state.dataWindowAC->WindAC(WindACNum).AirReliefNode; + int OutletNode = state.dataWindowAC->WindAC(WindACNum).AirOutNode; + int InletNode = state.dataWindowAC->WindAC(WindACNum).AirInNode; + int OutsideAirNode = state.dataWindowAC->WindAC(WindACNum).OutsideAirNode; + int AirRelNode = state.dataWindowAC->WindAC(WindACNum).AirReliefNode; // for cycling fans, pretend we have VAV if (fanOp == HVAC::FanOp::Cycling) { state.dataLoopNodes->Node(InletNode).MassFlowRate = state.dataLoopNodes->Node(InletNode).MassFlowRateMax * PartLoadFrac; @@ -1273,7 +1196,7 @@ namespace WindowAC { min(state.dataLoopNodes->Node(OutsideAirNode).MassFlowRateMax, state.dataLoopNodes->Node(InletNode).MassFlowRate); state.dataLoopNodes->Node(AirRelNode).MassFlowRate = state.dataLoopNodes->Node(OutsideAirNode).MassFlowRate; } - AirMassFlow = state.dataLoopNodes->Node(InletNode).MassFlowRate; + Real64 AirMassFlow = state.dataLoopNodes->Node(InletNode).MassFlowRate; MixedAir::SimOAMixer(state, state.dataWindowAC->WindAC(WindACNum).OAMixName, state.dataWindowAC->WindAC(WindACNum).OAMixIndex); // if blow through, simulate fan then coil. For draw through, simulate coil then fan. @@ -1282,14 +1205,14 @@ namespace WindowAC { } if (state.dataWindowAC->WindAC(WindACNum).DXCoilType_Num == CoilDX_CoolingHXAssisted) { - SimHXAssistedCoolingCoil(state, - state.dataWindowAC->WindAC(WindACNum).DXCoilName, - FirstHVACIteration, - HVAC::CompressorOp::On, - PartLoadFrac, - state.dataWindowAC->WindAC(WindACNum).DXCoilIndex, - state.dataWindowAC->WindAC(WindACNum).fanOp, - HXUnitOn); + HVACHXAssistedCoolingCoil::SimHXAssistedCoolingCoil(state, + state.dataWindowAC->WindAC(WindACNum).DXCoilName, + FirstHVACIteration, + HVAC::CompressorOp::On, + PartLoadFrac, + state.dataWindowAC->WindAC(WindACNum).DXCoilIndex, + state.dataWindowAC->WindAC(WindACNum).fanOp, + HXUnitOn); } else if (state.dataWindowAC->WindAC(WindACNum).DXCoilType_Num == HVAC::Coil_CoolingAirToAirVariableSpeed) { Real64 QZnReq(-1.0); // Zone load (W), input to variable-speed DX coil Real64 QLatReq(0.0); // Zone latent load, input to variable-speed DX coil @@ -1308,20 +1231,20 @@ namespace WindowAC { OnOffAirFlowRatio); } else { - SimDXCoil(state, - state.dataWindowAC->WindAC(WindACNum).DXCoilName, - HVAC::CompressorOp::On, - FirstHVACIteration, - state.dataWindowAC->WindAC(WindACNum).DXCoilIndex, - state.dataWindowAC->WindAC(WindACNum).fanOp, - PartLoadFrac); + DXCoils::SimDXCoil(state, + state.dataWindowAC->WindAC(WindACNum).DXCoilName, + HVAC::CompressorOp::On, + FirstHVACIteration, + state.dataWindowAC->WindAC(WindACNum).DXCoilIndex, + state.dataWindowAC->WindAC(WindACNum).fanOp, + PartLoadFrac); } if (state.dataWindowAC->WindAC(WindACNum).fanPlace == HVAC::FanPlace::DrawThru) { state.dataFans->fans(state.dataWindowAC->WindAC(WindACNum).FanIndex)->simulate(state, FirstHVACIteration, PartLoadFrac); } - MinHumRat = min(state.dataLoopNodes->Node(InletNode).HumRat, state.dataLoopNodes->Node(OutletNode).HumRat); + Real64 MinHumRat = min(state.dataLoopNodes->Node(InletNode).HumRat, state.dataLoopNodes->Node(OutletNode).HumRat); LoadMet = AirMassFlow * (PsyHFnTdbW(state.dataLoopNodes->Node(OutletNode).Temp, MinHumRat) - PsyHFnTdbW(state.dataLoopNodes->Node(InletNode).Temp, MinHumRat)); } @@ -1340,7 +1263,6 @@ namespace WindowAC { // AUTHOR Fred Buhl // DATE WRITTEN May 2000 // MODIFIED Shirey, May 2001 - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Determine the part load fraction of the air conditioner for this time step @@ -1354,13 +1276,6 @@ namespace WindowAC { Real64 FullOutput; // unit full output [W] Real64 NoCoolOutput; // output when no active cooling [W] Real64 ActualOutput; // output at current partloadfrac [W] - Real64 Error; // error between QznReq and ActualOutput [W] - Real64 ErrorToler; // error tolerance - int Iter; // iteration counter - // CHARACTER(len=20) :: ErrNum - // INTEGER,SAVE :: ErrCount=0 - Real64 DelPLF; - Real64 Relax; // DX Cooling HX assisted coils can cycle the heat exchanger, see if coil ON, HX OFF can meet humidity setpoint if one exists if (state.dataWindowAC->WindAC(WindACNum).DXCoilType_Num == CoilDX_CoolingHXAssisted) { @@ -1417,16 +1332,16 @@ namespace WindowAC { PartLoadFrac = max(MinPLF, std::abs(QZnReq - NoCoolOutput) / std::abs(FullOutput - NoCoolOutput)); - ErrorToler = state.dataWindowAC->WindAC(WindACNum).ConvergenceTol; // Error tolerance for convergence from input deck - Error = 1.0; // initialize error value for comparison against tolerance - Iter = 0; // initialize iteration counter - Relax = 1.0; + Real64 ErrorToler = state.dataWindowAC->WindAC(WindACNum).ConvergenceTol; // Error tolerance for convergence from input deck + Real64 Error = 1.0; // initialize error value for comparison against tolerance + int Iter = 0; // initialize iteration counter + Real64 Relax = 1.0; while ((std::abs(Error) > ErrorToler) && (Iter <= MaxIter) && PartLoadFrac > MinPLF) { // Get result when DX coil is operating at partloadfrac CalcWindowACOutput(state, WindACNum, FirstHVACIteration, fanOp, PartLoadFrac, HXUnitOn, ActualOutput); Error = (QZnReq - ActualOutput) / QZnReq; - DelPLF = (QZnReq - ActualOutput) / FullOutput; + Real64 DelPLF = (QZnReq - ActualOutput) / FullOutput; PartLoadFrac += Relax * DelPLF; PartLoadFrac = max(MinPLF, min(1.0, PartLoadFrac)); ++Iter; @@ -1475,7 +1390,7 @@ namespace WindowAC { // Get result when DX coil is operating at partloadfrac CalcWindowACOutput(state, WindACNum, FirstHVACIteration, fanOp, PartLoadFrac, HXUnitOn, ActualOutput); Error = (QZnReq - ActualOutput) / QZnReq; - DelPLF = (QZnReq - ActualOutput) / FullOutput; + Real64 DelPLF = (QZnReq - ActualOutput) / FullOutput; PartLoadFrac += Relax * DelPLF; PartLoadFrac = max(MinPLF, min(1.0, PartLoadFrac)); ++Iter; @@ -1528,8 +1443,6 @@ namespace WindowAC { // FUNCTION INFORMATION: // AUTHOR B Griffith // DATE WRITTEN Dec 2006 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // lookup function for zone inlet node @@ -1553,23 +1466,16 @@ namespace WindowAC { // FUNCTION INFORMATION: // AUTHOR B Griffith // DATE WRITTEN Dec 2006 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // lookup function for OA inlet node - // Return value - int GetWindowACOutAirNode; - if (state.dataWindowAC->GetWindowACInputFlag) { GetWindowAC(state); state.dataWindowAC->GetWindowACInputFlag = false; } - GetWindowACOutAirNode = state.dataWindowAC->WindAC(WindACNum).OutsideAirNode; - - return GetWindowACOutAirNode; + return state.dataWindowAC->WindAC(WindACNum).OutsideAirNode; } int GetWindowACReturnAirNode(EnergyPlusData &state, int const WindACNum) @@ -1578,14 +1484,10 @@ namespace WindowAC { // FUNCTION INFORMATION: // AUTHOR B Griffith // DATE WRITTEN Dec 2006 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // lookup function for mixer return air node for ventilation load reporting - using MixedAir::GetOAMixerReturnNodeNumber; - // Return value int GetWindowACReturnAirNode; @@ -1596,7 +1498,7 @@ namespace WindowAC { if (WindACNum > 0 && WindACNum <= state.dataWindowAC->NumWindAC) { if (state.dataWindowAC->WindAC(WindACNum).OAMixIndex > 0) { - GetWindowACReturnAirNode = GetOAMixerReturnNodeNumber(state, state.dataWindowAC->WindAC(WindACNum).OAMixIndex); + GetWindowACReturnAirNode = MixedAir::GetOAMixerReturnNodeNumber(state, state.dataWindowAC->WindAC(WindACNum).OAMixIndex); } else { GetWindowACReturnAirNode = 0; } @@ -1613,14 +1515,10 @@ namespace WindowAC { // FUNCTION INFORMATION: // AUTHOR B Griffith // DATE WRITTEN Dec 2006 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: // lookup function for mixed air node for ventilation rate reporting - using MixedAir::GetOAMixerMixedNodeNumber; - // Return value int GetWindowACMixedAirNode; @@ -1631,7 +1529,7 @@ namespace WindowAC { if (WindACNum > 0 && WindACNum <= state.dataWindowAC->NumWindAC) { if (state.dataWindowAC->WindAC(WindACNum).OAMixIndex > 0) { - GetWindowACMixedAirNode = GetOAMixerMixedNodeNumber(state, state.dataWindowAC->WindAC(WindACNum).OAMixIndex); + GetWindowACMixedAirNode = MixedAir::GetOAMixerMixedNodeNumber(state, state.dataWindowAC->WindAC(WindACNum).OAMixIndex); } else { GetWindowACMixedAirNode = 0; } diff --git a/src/EnergyPlus/WindowAC.hh b/src/EnergyPlus/WindowAC.hh index 311b122d99b..87ae4b7cdad 100644 --- a/src/EnergyPlus/WindowAC.hh +++ b/src/EnergyPlus/WindowAC.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -67,24 +67,24 @@ namespace WindowAC { { // Members // input data - std::string Name; // name of unit - int UnitType; // type of unit - std::string Sched; // availability schedule - int SchedPtr; // index to schedule - int FanSchedPtr; // index to fan operating mode schedule - int FanAvailSchedPtr; // index to fan availability schedule - Real64 MaxAirVolFlow; // m3/s - Real64 MaxAirMassFlow; // kg/s - Real64 OutAirVolFlow; // m3/s - Real64 OutAirMassFlow; // kg/s - int AirInNode; // inlet air node number - int AirOutNode; // outlet air node number - int OutsideAirNode; // outside air node number - int AirReliefNode; // relief air node number - int ReturnAirNode; // return air node number - int MixedAirNode; // Mixed Air Node number - std::string OAMixName; // name of outdoor air mixer - std::string OAMixType; // type of outdoor air mixer + std::string Name; // name of unit + int UnitType; // type of unit + + Sched::Schedule *availSched = nullptr; // availability schedule + Sched::Schedule *fanOpModeSched = nullptr; // fan operating mode schedule + Sched::Schedule *fanAvailSched = nullptr; // fan availability schedule + Real64 MaxAirVolFlow; // m3/s + Real64 MaxAirMassFlow; // kg/s + Real64 OutAirVolFlow; // m3/s + Real64 OutAirMassFlow; // kg/s + int AirInNode; // inlet air node number + int AirOutNode; // outlet air node number + int OutsideAirNode; // outside air node number + int AirReliefNode; // relief air node number + int ReturnAirNode; // return air node number + int MixedAirNode; // Mixed Air Node number + std::string OAMixName; // name of outdoor air mixer + std::string OAMixType; // type of outdoor air mixer int OAMixIndex; std::string FanName; // name of fan HVAC::FanType fanType; // index to fan type @@ -125,13 +125,12 @@ namespace WindowAC { // Default Constructor WindACData() - : UnitType(0), SchedPtr(0), FanSchedPtr(0), FanAvailSchedPtr(0), MaxAirVolFlow(0.0), MaxAirMassFlow(0.0), OutAirVolFlow(0.0), - OutAirMassFlow(0.0), AirInNode(0), AirOutNode(0), OutsideAirNode(0), AirReliefNode(0), MixedAirNode(0), OAMixIndex(0), - fanType(HVAC::FanType::Invalid), FanIndex(0), DXCoilType_Num(0), DXCoilIndex(0), DXCoilNumOfSpeeds(0), CoilOutletNodeNum(0), - fanPlace(HVAC::FanPlace::Invalid), MaxIterIndex1(0), MaxIterIndex2(0), ConvergenceTol(0.0), PartLoadFrac(0.0), - EMSOverridePartLoadFrac(false), EMSValueForPartLoadFrac(0.0), TotCoolEnergyRate(0.0), TotCoolEnergy(0.0), SensCoolEnergyRate(0.0), - SensCoolEnergy(0.0), LatCoolEnergyRate(0.0), LatCoolEnergy(0.0), ElecPower(0.0), ElecConsumption(0.0), FanPartLoadRatio(0.0), - CompPartLoadRatio(0.0), ZonePtr(0), HVACSizingIndex(0), FirstPass(true) + : UnitType(0), MaxAirVolFlow(0.0), MaxAirMassFlow(0.0), OutAirVolFlow(0.0), OutAirMassFlow(0.0), AirInNode(0), AirOutNode(0), + OutsideAirNode(0), AirReliefNode(0), MixedAirNode(0), OAMixIndex(0), fanType(HVAC::FanType::Invalid), FanIndex(0), DXCoilType_Num(0), + DXCoilIndex(0), DXCoilNumOfSpeeds(0), CoilOutletNodeNum(0), fanPlace(HVAC::FanPlace::Invalid), MaxIterIndex1(0), MaxIterIndex2(0), + ConvergenceTol(0.0), PartLoadFrac(0.0), EMSOverridePartLoadFrac(false), EMSValueForPartLoadFrac(0.0), TotCoolEnergyRate(0.0), + TotCoolEnergy(0.0), SensCoolEnergyRate(0.0), SensCoolEnergy(0.0), LatCoolEnergyRate(0.0), LatCoolEnergy(0.0), ElecPower(0.0), + ElecConsumption(0.0), FanPartLoadRatio(0.0), CompPartLoadRatio(0.0), ZonePtr(0), HVACSizingIndex(0), FirstPass(true) { } }; @@ -236,6 +235,10 @@ struct WindowACData : BaseGlobalStruct Array1D_bool MyEnvrnFlag; // one time initialization flag Array1D_bool MyZoneEqFlag; // used to set up zone equipment availability managers + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/WindowComplexManager.cc b/src/EnergyPlus/WindowComplexManager.cc index 743972b9beb..e6eac7e3874 100644 --- a/src/EnergyPlus/WindowComplexManager.cc +++ b/src/EnergyPlus/WindowComplexManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -53,7 +53,6 @@ // ObjexxFCL Headers #include #include -#include // EnergyPlus Headers #include @@ -374,23 +373,22 @@ namespace WindowComplexManager { NBkSurf = state.dataBSDFWindow->ComplexWind(iSurf).NBkSurf; state.dataBSDFWindow->ComplexWind(iSurf).Geom(iState).SolBmGndWt.allocate( - 24, state.dataGlobal->NumOfTimeStepInHour, state.dataBSDFWindow->ComplexWind(iSurf).Geom(iState).NGnd); - state.dataBSDFWindow->ComplexWind(iSurf).Geom(iState).SolBmIndex.allocate(24, state.dataGlobal->NumOfTimeStepInHour); - state.dataBSDFWindow->ComplexWind(iSurf).Geom(iState).ThetaBm.allocate(24, state.dataGlobal->NumOfTimeStepInHour); - state.dataBSDFWindow->ComplexWind(iSurf).Geom(iState).PhiBm.allocate(24, state.dataGlobal->NumOfTimeStepInHour); - state.dataSurface->SurfaceWindow(iSurf).ComplexFen.State(iState).WinDirHemiTrans.allocate(24, state.dataGlobal->NumOfTimeStepInHour); - state.dataSurface->SurfaceWindow(iSurf).ComplexFen.State(iState).WinDirSpecTrans.allocate(24, state.dataGlobal->NumOfTimeStepInHour); - state.dataSurface->SurfaceWindow(iSurf).ComplexFen.State(iState).WinBmGndTrans.allocate(24, state.dataGlobal->NumOfTimeStepInHour); - state.dataSurface->SurfaceWindow(iSurf).ComplexFen.State(iState).WinBmFtAbs.allocate(24, state.dataGlobal->NumOfTimeStepInHour, NLayers); - state.dataSurface->SurfaceWindow(iSurf).ComplexFen.State(iState).WinBmGndAbs.allocate(24, state.dataGlobal->NumOfTimeStepInHour, NLayers); - state.dataSurface->SurfaceWindow(iSurf).ComplexFen.State(iState).WinToSurfBmTrans.allocate( - 24, state.dataGlobal->NumOfTimeStepInHour, NBkSurf); + 24, state.dataGlobal->TimeStepsInHour, state.dataBSDFWindow->ComplexWind(iSurf).Geom(iState).NGnd); + state.dataBSDFWindow->ComplexWind(iSurf).Geom(iState).SolBmIndex.allocate(24, state.dataGlobal->TimeStepsInHour); + state.dataBSDFWindow->ComplexWind(iSurf).Geom(iState).ThetaBm.allocate(24, state.dataGlobal->TimeStepsInHour); + state.dataBSDFWindow->ComplexWind(iSurf).Geom(iState).PhiBm.allocate(24, state.dataGlobal->TimeStepsInHour); + state.dataSurface->SurfaceWindow(iSurf).ComplexFen.State(iState).WinDirHemiTrans.allocate(24, state.dataGlobal->TimeStepsInHour); + state.dataSurface->SurfaceWindow(iSurf).ComplexFen.State(iState).WinDirSpecTrans.allocate(24, state.dataGlobal->TimeStepsInHour); + state.dataSurface->SurfaceWindow(iSurf).ComplexFen.State(iState).WinBmGndTrans.allocate(24, state.dataGlobal->TimeStepsInHour); + state.dataSurface->SurfaceWindow(iSurf).ComplexFen.State(iState).WinBmFtAbs.allocate(24, state.dataGlobal->TimeStepsInHour, NLayers); + state.dataSurface->SurfaceWindow(iSurf).ComplexFen.State(iState).WinBmGndAbs.allocate(24, state.dataGlobal->TimeStepsInHour, NLayers); + state.dataSurface->SurfaceWindow(iSurf).ComplexFen.State(iState).WinToSurfBmTrans.allocate(24, state.dataGlobal->TimeStepsInHour, NBkSurf); state.dataSurface->SurfaceWindow(iSurf).ComplexFen.State(iState).BkSurf.allocate(NBkSurf); for (KBkSurf = 1; KBkSurf <= NBkSurf; ++KBkSurf) { - state.dataSurface->SurfaceWindow(iSurf).ComplexFen.State(iState).BkSurf(KBkSurf).WinDHBkRefl.allocate( - 24, state.dataGlobal->NumOfTimeStepInHour); + state.dataSurface->SurfaceWindow(iSurf).ComplexFen.State(iState).BkSurf(KBkSurf).WinDHBkRefl.allocate(24, + state.dataGlobal->TimeStepsInHour); state.dataSurface->SurfaceWindow(iSurf).ComplexFen.State(iState).BkSurf(KBkSurf).WinDirBkAbs.allocate( - 24, state.dataGlobal->NumOfTimeStepInHour, NLayers); + 24, state.dataGlobal->TimeStepsInHour, NLayers); } } @@ -596,7 +594,7 @@ namespace WindowComplexManager { std::size_t lHT(0); // Linear index for ( Hour, TS ) std::size_t lHTI(0); // Linear index for ( Hour, TS, I ) for (int Hour = 1; Hour <= 24; ++Hour) { - for (int TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS, ++lHT) { // [ lHT ] == ( Hour, TS ) + for (int TS = 1; TS <= state.dataGlobal->TimeStepsInHour; ++TS, ++lHT) { // [ lHT ] == ( Hour, TS ) SunDir = state.dataBSDFWindow->SUNCOSTS(TS, Hour); Theta = 0.0; Phi = 0.0; @@ -1012,7 +1010,7 @@ namespace WindowComplexManager { NPhis(1) = 1; NumElem = 1; for (I = 2; I <= NThetas; ++I) { - Thetas(I) = state.dataConstruction->Construct(IConst).BSDFInput.BasisMat(1, I) * Constant::DegToRadians; + Thetas(I) = state.dataConstruction->Construct(IConst).BSDFInput.BasisMat(1, I) * Constant::DegToRad; NPhis(I) = std::floor(state.dataConstruction->Construct(IConst).BSDFInput.BasisMat(2, I) + 0.001); if (NPhis(I) <= 0) ShowFatalError(state, "WindowComplexManager: incorrect input, no. phis must be positive."); NumElem += NPhis(I); @@ -1087,7 +1085,7 @@ namespace WindowComplexManager { NPhis = 1; // As insurance, define one phi for each theta NumElem = 1; for (I = 2; I <= NThetas; ++I) { - Thetas(I) = state.dataConstruction->Construct(IConst).BSDFInput.BasisMat(1, I) * Constant::DegToRadians; + Thetas(I) = state.dataConstruction->Construct(IConst).BSDFInput.BasisMat(1, I) * Constant::DegToRad; ++NumElem; } Basis.Phis.allocate(1, NThetas); @@ -1296,8 +1294,8 @@ namespace WindowComplexManager { // Define the central ray directions (in world coordinate system) state.dataSurface->SurfaceWindow(ISurf).ComplexFen.State(IState).NLayers = state.dataConstruction->Construct(IConst).BSDFInput.NumLayers; - Azimuth = Constant::DegToRadians * state.dataSurface->Surface(ISurf).Azimuth; - Tilt = Constant::DegToRadians * state.dataSurface->Surface(ISurf).Tilt; + Azimuth = Constant::DegToRad * state.dataSurface->Surface(ISurf).Azimuth; + Tilt = Constant::DegToRad * state.dataSurface->Surface(ISurf).Tilt; // For incoming grid @@ -1386,7 +1384,7 @@ namespace WindowComplexManager { V = HitPt - state.dataSurface->Surface(ISurf).Centroid; // vector array from window ctr to hit pt LeastHitDsq = magnitude_squared(V); // dist^2 window ctr to hit pt TmpHSurfDSq(1, NReflSurf) = LeastHitDsq; - if (!state.dataSurface->Surface(JSurf).HeatTransSurf && state.dataSurface->Surface(JSurf).SchedShadowSurfIndex != 0) { + if (!state.dataSurface->Surface(JSurf).HeatTransSurf && state.dataSurface->Surface(JSurf).shadowSurfSched != nullptr) { TransRSurf = 1.0; // If a shadowing surface may have a scheduled transmittance, // treat it here as completely transparent } else { @@ -1405,7 +1403,8 @@ namespace WindowComplexManager { break; } } - if (!state.dataSurface->Surface(JSurf).HeatTransSurf && state.dataSurface->Surface(JSurf).SchedShadowSurfIndex == 0) { + if (!state.dataSurface->Surface(JSurf).HeatTransSurf && + state.dataSurface->Surface(JSurf).shadowSurfSched == nullptr) { // The new hit is opaque, so we can drop all the hits further away TmpHSurfNo(J, NReflSurf) = JSurf; TmpHitPt(J, NReflSurf) = HitPt; @@ -1433,7 +1432,7 @@ namespace WindowComplexManager { // A new closest hit. If it is opaque, drop the current hit list, // otherwise add it at the front LeastHitDsq = HitDsq; - if (!state.dataSurface->Surface(JSurf).HeatTransSurf && state.dataSurface->Surface(JSurf).SchedShadowSurfIndex != 0) { + if (!state.dataSurface->Surface(JSurf).HeatTransSurf && state.dataSurface->Surface(JSurf).shadowSurfSched != nullptr) { TransRSurf = 1.0; // New closest hit is transparent, keep the existing hit list for (I = TotHits; I >= 1; --I) { TmpHSurfNo(I + 1, NReflSurf) = TmpHSurfNo(I, NReflSurf); @@ -1898,13 +1897,13 @@ namespace WindowComplexManager { if (Sum2 > 0.0) { Hold = Sum1 / Sum2; for (I = 1; I <= 24; ++I) { - for (J = 1; J <= state.dataGlobal->NumOfTimeStepInHour; ++J) { + for (J = 1; J <= state.dataGlobal->TimeStepsInHour; ++J) { State.BkSurf(KBkSurf).WinDHBkRefl(I, J) = Hold; } } } else { for (I = 1; I <= 24; ++I) { - for (J = 1; J <= state.dataGlobal->NumOfTimeStepInHour; ++J) { + for (J = 1; J <= state.dataGlobal->TimeStepsInHour; ++J) { State.BkSurf(KBkSurf).WinDHBkRefl(I, J) = 0.0; } } @@ -1922,13 +1921,13 @@ namespace WindowComplexManager { if (Sum2 > 0.0) { Hold = Sum1 / Sum2; for (I = 1; I <= 24; ++I) { - for (J = 1; J <= state.dataGlobal->NumOfTimeStepInHour; ++J) { + for (J = 1; J <= state.dataGlobal->TimeStepsInHour; ++J) { State.BkSurf(KBkSurf).WinDirBkAbs(I, J, L) = Hold; } } } else { for (I = 1; I <= 24; ++I) { - for (J = 1; J <= state.dataGlobal->NumOfTimeStepInHour; ++J) { + for (J = 1; J <= state.dataGlobal->TimeStepsInHour; ++J) { State.BkSurf(KBkSurf).WinDirBkAbs(I, J, L) = 0.0; } } @@ -2241,8 +2240,8 @@ namespace WindowComplexManager { } // get window tilt and azimuth - Gamma = Constant::DegToRadians * state.dataSurface->Surface(ISurf).Tilt; - Alpha = Constant::DegToRadians * state.dataSurface->Surface(ISurf).Azimuth; + Gamma = Constant::DegToRad * state.dataSurface->Surface(ISurf).Tilt; + Alpha = Constant::DegToRad * state.dataSurface->Surface(ISurf).Azimuth; // get the corresponding local Theta, Phi for ray W6CoordsFromWorldVect(state, RayToFind, RadType, Gamma, Alpha, Theta, Phi); @@ -2488,7 +2487,6 @@ namespace WindowComplexManager { using namespace DataBSDFWindow; using Psychrometrics::PsyCpAirFnW; using Psychrometrics::PsyTdpFnWPb; - using ScheduleManager::GetCurrentScheduleValue; using TARCOGGassesParams::maxgas; using TARCOGMain::TARCOG90; using TARCOGParams::maxlay; diff --git a/src/EnergyPlus/WindowComplexManager.hh b/src/EnergyPlus/WindowComplexManager.hh index 6206b11f336..9cbb6e259d5 100644 --- a/src/EnergyPlus/WindowComplexManager.hh +++ b/src/EnergyPlus/WindowComplexManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -375,6 +375,10 @@ struct WindowComplexManagerData : BaseGlobalStruct Array1D_int iMinDT = Array1D_int(1, 0); Array1D_int IDConst = Array1D_int(100, 0); + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/WindowEquivalentLayer.cc b/src/EnergyPlus/WindowEquivalentLayer.cc index 91d406d50e7..09043462243 100644 --- a/src/EnergyPlus/WindowEquivalentLayer.cc +++ b/src/EnergyPlus/WindowEquivalentLayer.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -50,7 +50,6 @@ // ObjexxFCL Headers #include -#include // EnergyPlus Headers #include @@ -121,7 +120,7 @@ namespace EnergyPlus::WindowEquivalentLayer { using namespace DataHeatBalance; using namespace DataSurfaces; -constexpr std::array orientationNamesUC = {"HORIZONTAL", "VERTICAL"}; +// constexpr std::array orientationNamesUC = {"HORIZONTAL", "VERTICAL"}; void InitEquivalentLayerWindowCalculations(EnergyPlusData &state) { @@ -171,7 +170,7 @@ void SetEquivalentLayerWindowProperties(EnergyPlusData &state, int const ConstrN // PURPOSE OF THIS SUBROUTINE: // Populates the the equivalent layer window model optical and thermal - // properties, fills default values and shades geomterical calculations + // properties, fills default values and shades geometrical calculations // METHODOLOGY EMPLOYED: // uses some routine developed for ASHRAE RP-1311 (ASHWAT Model) @@ -420,7 +419,7 @@ void CalcEQLWindowUvalue(EnergyPlusData &state, static constexpr std::string_view RoutineName("CalcEQLWindowUvalue: "); Real64 U; // U-factor, W/m2-K - Real64 UOld; // U-factor during pevious iteration step, W/m2-K + Real64 UOld; // U-factor during previous iteration step, W/m2-K Real64 HXO; // outdoor combined conv+rad surf coeff, W/m2-K Real64 HXI; // indoor combined conf+rad surf coeff, W/m2-K Real64 HRO; // outdoor side radiation surf coeff, W/m2-K @@ -438,7 +437,7 @@ void CalcEQLWindowUvalue(EnergyPlusData &state, bool CFSURated = false; // false if U-Value calculation failed - // Intial guess value for combined conductance + // Initial guess value for combined conductance HXO = 29.0; // 1/FenROut HXI = 7.0; // 1/FenRIn HCO = 26.0; @@ -457,7 +456,7 @@ void CalcEQLWindowUvalue(EnergyPlusData &state, ((TGO + Constant::Kelvin) + (TOUT + Constant::Kelvin)); HRI = Constant::StefanBoltzmann * EI * (pow_2(TGI + Constant::Kelvin) + pow_2(TIN + Constant::Kelvin)) * ((TGI + Constant::Kelvin) + (TIN + Constant::Kelvin)); - // HCI = HIC_ASHRAE( Height, TGI, TI) ! BAN June 2103 Raplaced with ISO Std 15099 + // HCI = HIC_ASHRAE( Height, TGI, TI) ! BAN June 2103 Replaced with ISO Std 15099 TGIK = TGI + Constant::Kelvin; TIK = TIN + Constant::Kelvin; HCI = HCInWindowStandardRatings(state, Height, TGIK, TIK); @@ -495,7 +494,7 @@ void CalcEQLWindowSHGCAndTransNormal(EnergyPlusData &state, // METHODOLOGY EMPLOYED: // Uses routine developed for ASHRAE RP-1311 (ASHWAT Model) - // Summer Window Rating Conditoions + // Summer Window Rating Conditions // tin = 297.15d0 ! indoor air condition (75.2F, 24.0C) // tout = 305.15d0 ! Outside air temperature (89.6F, 32C) // hcout = 15.d0 ! Outside convective film conductance at 2.8 m/s (6.2 mph) wind speed @@ -655,11 +654,11 @@ void CalcEQLWindowOpticalProperty(EnergyPlusData &state, void EQLWindowSurfaceHeatBalance(EnergyPlusData &state, int const SurfNum, // Surface number - Real64 const HcOut, // outside convection coeficient at this timestep, W/m2K + Real64 const HcOut, // outside convection coefficient at this timestep, W/m2K Real64 &SurfInsideTemp, // Inside window surface temperature (innermost face) [C] Real64 &SurfOutsideTemp, // Outside surface temperature (C) Real64 &SurfOutsideEmiss, - DataBSDFWindow::Condition const CalcCondition // Calucation condition (summer, winter or no condition) + DataBSDFWindow::Condition const CalcCondition // Calculation condition (summer, winter or no condition) ) { // SUBROUTINE INFORMATION: @@ -674,7 +673,6 @@ void EQLWindowSurfaceHeatBalance(EnergyPlusData &state, using Psychrometrics::PsyCpAirFnW; using Psychrometrics::PsyTdpFnWPb; - using ScheduleManager::GetCurrentScheduleValue; Real64 constexpr TOL(0.0001); // convergence tolerance @@ -704,7 +702,7 @@ void EQLWindowSurfaceHeatBalance(EnergyPlusData &state, Real64 QXConv; // extra convective gain from this surface Real64 TaIn(0); // zone air temperature Real64 tsky; // sky temperature - Real64 HcIn; // inside convection coeficient at this timestep, W/m2K + Real64 HcIn; // inside convection coefficient at this timestep, W/m2K Real64 ConvHeatFlowNatural; // Convective heat flow from gap between glass and interior shade or blind (W) Real64 NetIRHeatGainWindow; // net radiation gain from the window surface to the zone (W) Real64 ConvHeatGainWindow; // net convection heat gain from inside surface of window to zone air (W) @@ -836,7 +834,7 @@ void EQLWindowSurfaceHeatBalance(EnergyPlusData &state, state.dataSurface->SurfWinGainIRGlazToZoneRep(SurfNum) = NetIRHeatGainWindow; state.dataSurface->SurfWinGainIRShadeToZoneRep(SurfNum) = NetIRHeatGainWindow; if (InSideLayerType == LayerType::GLAZE) { - // no interior sade + // no interior shade state.dataSurface->SurfWinGainIRShadeToZoneRep(SurfNum) = 0.0; } else { // Interior shade exists @@ -862,12 +860,12 @@ void OPENNESS_LW(Real64 const OPENNESS, // shade openness (=tausbb at normal inc // (= wire or thread emittance) // typical (default) values // dark insect screen = .93 - // metalic insect screen = .32 + // metallic insect screen = .32 // roller blinds = .91 // drape fabric = .87 // typical (default) values // dark insect screen = .02 - // metalic insect screen = .19 + // metallic insect screen = .19 // roller blinds = .05 // drape fabric = .05 @@ -911,7 +909,7 @@ HEMINT(EnergyPlusData &state, // AUTHOR ASHRAE 1311-RP // PURPOSE OF THIS FUNCTION: - // Romberg Integration of Property function over hemispeherical dome + // Romberg Integration of Property function over hemispherical dome // METHODOLOGY EMPLOYED: // Romberg Integration. @@ -1003,8 +1001,8 @@ void RB_DIFF(EnergyPlusData &state, SumRefAndTran = RHO_DD + TAU_DD; ShowWarningMessage(state, format("{}Roller blind diffuse-diffuse properties are inconsistent", RoutineName)); ShowContinueError(state, format("...The diffuse-diffuse reflectance = {:.4T}", RHO_DD)); - ShowContinueError(state, format("...The diffuse-diffuse tansmittance = {:.4T}", TAU_DD)); - ShowContinueError(state, format("...Sum of diffuse reflectance and tansmittance = {:.4T}", SumRefAndTran)); + ShowContinueError(state, format("...The diffuse-diffuse transmittance = {:.4T}", TAU_DD)); + ShowContinueError(state, format("...Sum of diffuse reflectance and transmittance = {:.4T}", SumRefAndTran)); ShowContinueError(state, "...This sum cannot be > 1.0. Transmittance will be reset to 1 minus reflectance"); TAU_DD = 1.0 - RHO_DD; } @@ -1070,7 +1068,7 @@ void RB_BEAM(EnergyPlusData &state, Real64 TAUBB_EXPO; // exponent in the beam-beam transmittance model Real64 TAU_BT; // beam-total transmittance - THETA = min(89.99 * Constant::DegToRadians, xTHETA); + THETA = min(89.99 * Constant::DegToRad, xTHETA); if (TAU_BB0 > 0.9999) { TAU_BB = 1.0; @@ -1086,7 +1084,7 @@ void RB_BEAM(EnergyPlusData &state, TAU_BT = TAU_BT0 * std::pow(std::cos(THETA), TAUBT_EXPO); // always 0 - 1 Real64 const cos_TAU_BB0(std::cos(TAU_BB0 * Constant::PiOvr2)); - THETA_CUTOFF = Constant::DegToRadians * (90.0 - 25.0 * cos_TAU_BB0); + THETA_CUTOFF = Constant::DegToRad * (90.0 - 25.0 * cos_TAU_BB0); if (THETA >= THETA_CUTOFF) { TAU_BB = 0.0; } else { @@ -1137,8 +1135,8 @@ void IS_DIFF(EnergyPlusData &state, SumRefAndTran = RHO_DD + TAU_DD; ShowWarningMessage(state, format("{}Calculated insect screen diffuse-diffuse properties are inconsistent", RoutineName)); ShowContinueError(state, format("...The diffuse-diffuse reflectance = {:.4T}", RHO_DD)); - ShowContinueError(state, format("...The diffuse-diffuse tansmittance = {:.4T}", TAU_DD)); - ShowContinueError(state, format("...Sum of diffuse reflectance and tansmittance = {:.4T}", SumRefAndTran)); + ShowContinueError(state, format("...The diffuse-diffuse transmittance = {:.4T}", TAU_DD)); + ShowContinueError(state, format("...Sum of diffuse reflectance and transmittance = {:.4T}", SumRefAndTran)); ShowContinueError(state, "...This sum cannot be > 1.0. Transmittance will be reset to 1 minus reflectance"); TAU_DD = 1.0 - RHO_DD; } @@ -1212,7 +1210,7 @@ void IS_BEAM(EnergyPlusData &state, Real64 RHO_BT90; // beam-total reflectance at 90 deg incidence Real64 TAU_BT; // beam-total transmittance - Real64 const THETA(min(89.99 * Constant::DegToRadians, xTHETA)); // working incident angle, radians + Real64 const THETA(min(89.99 * Constant::DegToRad, xTHETA)); // working incident angle, radians Real64 const COSTHETA(std::cos(THETA)); RHO_W = RHO_BT0 / max(0.00001, 1.0 - TAU_BB0); @@ -1310,8 +1308,8 @@ void FM_DIFF(EnergyPlusData &state, SumRefAndTran = RHO_DD + TAU_DD; ShowWarningMessage(state, format("{}Calculated drape fabric diffuse-diffuse properties are inconsistent", RoutineName)); ShowContinueError(state, format("...The diffuse-diffuse reflectance = {:.4T}", RHO_DD)); - ShowContinueError(state, format("...The diffuse-diffuse tansmittance = {:.4T}", TAU_DD)); - ShowContinueError(state, format("...Sum of diffuse reflectance and tansmittance = {:.4T}", SumRefAndTran)); + ShowContinueError(state, format("...The diffuse-diffuse transmittance = {:.4T}", TAU_DD)); + ShowContinueError(state, format("...Sum of diffuse reflectance and transmittance = {:.4T}", SumRefAndTran)); ShowContinueError(state, "...This sum cannot be > 1.0. Transmittance will be reset to 1 minus reflectance"); TAU_DD = 1.0 - RHO_DD; } @@ -1370,7 +1368,7 @@ void FM_BEAM(EnergyPlusData &state, // PURPOSE OF THIS SUBROUTINE: // Calculates the solar optical properties of a fabric for beam radiation incident - // on the forward facingsurface using optical properties at normal incidence and + // on the forward facing surface using optical properties at normal incidence and // semi-empirical relations. // SUBROUTINE ARGUMENT DEFINITIONS: @@ -1384,7 +1382,7 @@ void FM_BEAM(EnergyPlusData &state, Real64 RHO_BT90; // beam-total reflectance at 90 deg incidence Real64 TAU_BT; // beam-total transmittance - THETA = std::abs(max(-89.99 * Constant::DegToRadians, min(89.99 * Constant::DegToRadians, xTHETA))); + THETA = std::abs(max(-89.99 * Constant::DegToRad, min(89.99 * Constant::DegToRad, xTHETA))); // limit -89.99 - +89.99 // by symmetry, optical properties same at +/- theta Real64 const COSTHETA(std::cos(THETA)); @@ -1667,8 +1665,8 @@ void PD_BEAM(EnergyPlusData &state, Real64 TAUBF_BB_PERP; Real64 TAUBF_BD_PERP; - OMEGA_V = std::abs(max(-89.5 * Constant::DegToRadians, min(89.5 * Constant::DegToRadians, OHM_V_RAD))); - OMEGA_H = std::abs(max(-89.5 * Constant::DegToRadians, min(89.5 * Constant::DegToRadians, OHM_H_RAD))); + OMEGA_V = std::abs(max(-89.5 * Constant::DegToRad, min(89.5 * Constant::DegToRad, OHM_V_RAD))); + OMEGA_H = std::abs(max(-89.5 * Constant::DegToRad, min(89.5 * Constant::DegToRad, OHM_H_RAD))); // limit profile angles -89.5 - +89.5 // by symmetry, properties same for +/- profile angle @@ -3386,7 +3384,7 @@ void PD_BEAM_CASE_VI(Real64 const S, // pleat spacing (> Real64 AK; // length of diagonal strings Real64 CG; - Real64 Z1_BD; // diffuse source termps + Real64 Z1_BD; // diffuse source terms Real64 Z7_BD; // shape factors Real64 F12; @@ -3518,7 +3516,7 @@ void VB_DIFF(EnergyPlusData &state, Real64 const PHI, // slat angle, radians (-PI/2 <= PHI <= PI/2) Real64 const RHODFS_SLAT, // reflectance of downward-facing slat surfaces (concave?) Real64 const RHOUFS_SLAT, // reflectance of upward-facing slat surfaces (convex?) - Real64 const TAU_SLAT, // diffuse transmitance of slats + Real64 const TAU_SLAT, // diffuse transmittance of slats Real64 &RHOFVB, // returned: front side effective diffuse reflectance of venetian blind Real64 &TAUVB // returned: effective diffuse transmittance of venetian blind ) @@ -3666,9 +3664,9 @@ void VB_SOL46_CURVE(EnergyPlusData const &state, CORR = 1; // limit slat angle to +/- 90 deg - PHI = max(-Constant::DegToRadians * 90.0, min(Constant::DegToRadians * 90.0, PHIx)); + PHI = max(-Constant::DegToRad * 90.0, min(Constant::DegToRad * 90.0, PHIx)); // limit profile angle to +/- 89.5 deg - OMEGA = max(-Constant::DegToRadians * 89.5, min(Constant::DegToRadians * 89.5, OMEGAx)); + OMEGA = max(-Constant::DegToRad * 89.5, min(Constant::DegToRad * 89.5, OMEGAx)); SL_RAD = W / max(SL_WR, 0.0000001); SL_THETA = 2.0 * std::asin(0.5 * SL_WR); @@ -4283,8 +4281,8 @@ void ASHWAT_ThermalCalc(EnergyPlusData &state, Array1D HJC(FS.NL); Array1D RHOF({0, FS.NL + 1}); // longwave reflectance, front ! these variables help simplify Array1D RHOB({0, FS.NL + 1}); // longwave reflectance, back ! the code because it is useful to - Array1D EPSF({0, FS.NL + 1}); // longwave emisivity, front ! increase the scope of the arrays - Array1D EPSB({0, FS.NL + 1}); // longwave emisivity, back ! to include indoor and outdoor + Array1D EPSF({0, FS.NL + 1}); // longwave emissivity, front ! increase the scope of the arrays + Array1D EPSB({0, FS.NL + 1}); // longwave emissivity, back ! to include indoor and outdoor Array1D TAU({0, FS.NL + 1}); // longwave transmittance ! nodes - more general Array2D HC2D(6, 6); // convective heat transfer coefficients between layers i and j Array2D HR2D(6, 6); // radiant heat transfer coefficients between layers i and j @@ -4745,8 +4743,8 @@ bool ASHWAT_ThermalRatings(EnergyPlusData &state, Real64 Q_IN; // net gain to the room [W/m2], including transmitted solar Array1D RHOF({0, FS.NL + 1}); // longwave reflectance, front ! these variables help simplify Array1D RHOB({0, FS.NL + 1}); // longwave reflectance, back ! the code because it is useful to - Array1D EPSF({0, FS.NL + 1}); // longwave emisivity, front ! increase the scope of the arrays - Array1D EPSB({0, FS.NL + 1}); // longwave emisivity, back ! to include indoor and outdoor + Array1D EPSF({0, FS.NL + 1}); // longwave emissivity, front ! increase the scope of the arrays + Array1D EPSB({0, FS.NL + 1}); // longwave emissivity, back ! to include indoor and outdoor Array1D TAU({0, FS.NL + 1}); // longwave transmittance ! nodes - more general Real64 RTOT; // total resistance from TAE_OUT to TAE_IN [m2K/W] Array2D HC2D(6, 6); // convective heat transfer coefficients between layers i and j @@ -5162,7 +5160,7 @@ bool ASHWAT_ThermalRatings(EnergyPlusData &state, // CHANGE TO (NDLIAR .GT. 2) ONCE // SUBROUTINE DL2_RES IS AVAILABLE - // calculate radiant heat transfer coefficents between adjacent opaque + // calculate radiant heat transfer coefficients between adjacent opaque // layers for (I = 0; I <= NL; ++I) { // scan through all gaps - including indoor/outdoor if ((ISDL(I) == 0) && (ISDL(I + 1) == 0)) { @@ -5176,7 +5174,7 @@ bool ASHWAT_ThermalRatings(EnergyPlusData &state, } } // end loop through gaps - // calculate radiant heat transfer coefficents at single diathermanous + // calculate radiant heat transfer coefficients at single diathermanous // layers,three coefficients in each case for (I = 0; I <= NL - 1; ++I) { // scan through all layers - look for single DL @@ -5198,7 +5196,7 @@ bool ASHWAT_ThermalRatings(EnergyPlusData &state, } // end of IF(ISDL(I) .EQ. 0) .AND. ..... } // end of scan through all layers - // calculate radiant heat transfer coefficents at double diathermanous + // calculate radiant heat transfer coefficients at double diathermanous // layers,six coefficients in each case // THIS SECTION NOT ACTIVE YET @@ -5545,7 +5543,7 @@ bool ASHWAT_ThermalRatings(EnergyPlusData &state, Q_IN = UCG * (TAE_OUT - TAE_IN) + SHGC * ISOL; // End of new code - for calculating Ucg and SHGC - // restore convective heat transfer coefficients if alterred earlier + // restore convective heat transfer coefficients if altered earlier // for more general resistor network - otherwise mainline will // receive faulty data if (NL >= 2) { // no OCF unless at least two layers exist @@ -5579,9 +5577,9 @@ void DL_RES_r2(Real64 const Tg, // mean glass layer temperature, {K} // Returns the radiant heat transfer coefficients between parallel surfaces: // METHODOLOGY EMPLOYED: // Solves radiant heat transfer coefficients between three parallel surfaces. - // The left and right surfcaes are opaque with reflectance rhog and rhom, respectively. + // The left and right surfaces are opaque with reflectance rhog and rhom, respectively. // And the middle layer is diathermanous with transmittance taud AND reflectance rhodf - // and rhodb on the left and rightsides, respectively. + // and rhodb on the left and right sides, respectively. // The subscripts g, d and m apply to Glass, Diathermanous layer, and mean-radiant room // temperature in a configuration of a window with an indoor-side shading attachment // but the analysis can be applied to any three layers in the configuration described @@ -5732,7 +5730,7 @@ Real64 FRA(Real64 const TM, // mean gas temp, K Real64 CP = ACP + BCP * TM + BCP * TM * TM; Real64 VISC = AVISC + BVISC * TM + BVISC * TM * TM; - return (Constant::GravityConstant * RHOGAS * RHOGAS * DT * T * T * T * CP) / (VISC * K * TM * Z * Z); + return (Constant::Gravity * RHOGAS * RHOGAS * DT * T * T * T * CP) / (VISC * K * TM * Z * Z); } Real64 FNU(Real64 const RA) // Rayleigh number @@ -5885,7 +5883,7 @@ void SLtoGL(EnergyPlusData const &state, // properties of AIR rho = state.dataWindowEquivalentLayer->PAtmSeaLevel / (287.097 * Tavg); // density (kg/m3) <- temperature in (K) - beta = 1.0 / Tavg; // thermal expansion coef(/K) + beta = 1.0 / Tavg; // thermal expansion coeff (/K) dvisc = (18.05 + ((Tavg - 290.0) / 10.0) * (18.53 - 18.05)) * 1.0e-6; // dynamic viscosity (kg/m.sec) or (N.sec/m2) Cp = 1044.66 - 0.31597 * Tavg + 0.000707908 * pow_2(Tavg) - 0.00000027034 * pow_3(Tavg); @@ -5943,7 +5941,7 @@ Real64 SLtoAMB(EnergyPlusData const &state, // properties of AIR Tavg = (Ts + Tamb) / 2.0; rho = state.dataWindowEquivalentLayer->PAtmSeaLevel / (287.097 * Tavg); // density (kg/m3) <- temperature in (K) - beta = 1.0 / Tavg; // thermal expansion coef(/K) + beta = 1.0 / Tavg; // thermal expansion coeff (/K) dvisc = (18.05 + ((Tavg - 290.0) / 10.0) * (18.53 - 18.05)) * 1.0e-6; // dynamic viscosity (kg/m.sec) or (N.sec/m2) Cp = 1044.66 - 0.31597 * Tavg + 0.000707908 * pow_2(Tavg) - 0.00000027034 * pow_3(Tavg); @@ -5972,7 +5970,7 @@ Real64 SLtoAMB(EnergyPlusData const &state, // properties of AIR Tavg = (Ts + Tamb) / 2.0; rho = state.dataWindowEquivalentLayer->PAtmSeaLevel / (287.097 * Tavg); // density (kg/m3) <- temperature in (K) - beta = 1.0 / Tavg; // thermal expansion coef(/K) + beta = 1.0 / Tavg; // thermal expansion coeff (/K) dvisc = (18.05 + ((Tavg - 290.0) / 10.0) * (18.53 - 18.05)) * 1.0e-6; // dynamic viscosity (kg/m.sec) or (N.sec/m2) Cp = 1044.66 - 0.31597 * Tavg + 0.000707908 * pow_2(Tavg) - 0.00000027034 * pow_3(Tavg); @@ -6047,7 +6045,7 @@ void GLtoAMB(EnergyPlusData const &state, // properties of AIR rho = state.dataWindowEquivalentLayer->PAtmSeaLevel / (287.097 * Tavg); // density (kg/m3) <- temperature in (K) - beta = 1.0 / Tavg; // thermal expansion coef(/K) + beta = 1.0 / Tavg; // thermal expansion coeff (/K) dvisc = (18.05 + ((Tavg - 290.0) / 10.0) * (18.53 - 18.05)) * 1.0e-6; // dynamic viscosity (kg/m.sec) or (N.sec/m2) Cp = 1044.66 - 0.31597 * Tavg + 0.000707908 * pow_2(Tavg) - 0.00000027034 * pow_3(Tavg); @@ -6072,7 +6070,7 @@ void GLtoAMB(EnergyPlusData const &state, // properties of AIR rho = state.dataWindowEquivalentLayer->PAtmSeaLevel / (287.097 * Tavg); // density (kg/m3) <- temperature in (K) - beta = 1.0 / Tavg; // thermal expansion coef(/K) + beta = 1.0 / Tavg; // thermal expansion coeff (/K) dvisc = (18.05 + ((Tavg - 290.0) / 10.0) * (18.53 - 18.05)) * 1.0e-6; // dynamic viscosity (kg/m.sec) or (N.sec/m2) Cp = 1044.66 - 0.31597 * Tavg + 0.000707908 * pow_2(Tavg) - 0.00000027034 * pow_3(Tavg); @@ -6215,7 +6213,7 @@ void ASHWAT_Solar(int const NL, // # of layers // Returns the optical properties of multi-layer fenestration system model given optical // properties of the layers // METHODOLOGY EMPLOYED: - // Ues combination net radiation method and TDMA solver + // Use combination net radiation method and TDMA solver // REFERENCES: // JOHN L. WRIGHT and NATHAN KOTEY (2006). Solar Absorption By each Element in a Glazing/Shading // Layer Array, ASHRAE Transactions, Vol. 112, Pt. 2. pp. 3-12. @@ -6564,7 +6562,7 @@ bool Specular_OffNormal(Real64 const THETA, // solar beam angle of incidence, fr // RE-ENGINEERED na // PURPOSE OF THIS FUNCTION: - // Returns ratio of off-normal to normal of opetical properties. + // Returns ratio of off-normal to normal of optical properties. // METHODOLOGY EMPLOYED: // Uses a reference glass property. // returns TRUE if RAT_TAU < 1 or RAT_1MR < 1 (and thus Specular_Adjust s/b called) @@ -6597,11 +6595,11 @@ bool Specular_OffNormal(Real64 const THETA, // solar beam angle of incidence, fr Specular_OffNormal = true; THETA1 = std::abs(THETA); - if (THETA1 > Constant::PiOvr2 - Constant::DegToRadians) { + if (THETA1 > Constant::PiOvr2 - Constant::DegToRad) { // theta > 89 deg RAT_TAU = 0.0; RAT_1MR = 0.0; - } else if (THETA1 >= Constant::DegToRadians) { + } else if (THETA1 >= Constant::DegToRad) { // theta >= 1 deg N2 = 1.526; KL = 55.0 * 0.006; @@ -6934,7 +6932,7 @@ bool IS_SWP(EnergyPlusData &state, // front IS_BEAM(state, THETA, RHOFF_BT0, TAUFF_BT0, L.SWP_MAT.TAUSFBB, LSWP.RHOSFBD, LSWP.TAUSFBB, LSWP.TAUSFBD); - // back -- call with reverse material properies + // back -- call with reverse material properties IS_BEAM(state, THETA, RHOBF_BT0, TAUBF_BT0, L.SWP_MAT.TAUSBBB, LSWP.RHOSBBD, LSWP.TAUSBBB, LSWP.TAUSBBD); return true; @@ -7042,7 +7040,7 @@ bool PD_SWP(EnergyPlusData &state, CFSLAYER const &L, // PD layer CFSSWP &LSWP, // returned: equivalent layer properties set const Real64 OHM_V_RAD, // vertical VB profile angles, radians - const Real64 OHM_H_RAD // horizonatl VB profile angles, radians + const Real64 OHM_H_RAD // horizontal VB profile angles, radians ) { // FUNCTION INFORMATION: @@ -7081,7 +7079,7 @@ bool PD_SWP(EnergyPlusData &state, LSWP.TAUSFBB, LSWP.TAUSFBD); - // drape back properties: call with reversed fabric properies + // drape back properties: call with reversed fabric properties PD_BEAM(state, L.S, L.W, @@ -7162,10 +7160,10 @@ bool VB_LWP(EnergyPlusData &state, RHOUFS_SLAT = 1.0 - L.LWP_MAT.EPSLF - L.LWP_MAT.TAUL; // upward surface // TODO: are there cases where 2 calls not needed (RHODFS_SLAT == RHOUFS_SLAT??) - VB_DIFF(state, L.S, L.W, Constant::DegToRadians * L.PHI_DEG, RHODFS_SLAT, RHOUFS_SLAT, L.LWP_MAT.TAUL, RHOLF, LLWP.TAUL); + VB_DIFF(state, L.S, L.W, Constant::DegToRad * L.PHI_DEG, RHODFS_SLAT, RHOUFS_SLAT, L.LWP_MAT.TAUL, RHOLF, LLWP.TAUL); LLWP.EPSLF = 1.0 - RHOLF - LLWP.TAUL; - VB_DIFF(state, L.S, L.W, -Constant::DegToRadians * L.PHI_DEG, RHODFS_SLAT, RHOUFS_SLAT, L.LWP_MAT.TAUL, RHOLB, TAULX); + VB_DIFF(state, L.S, L.W, -Constant::DegToRad * L.PHI_DEG, RHODFS_SLAT, RHOUFS_SLAT, L.LWP_MAT.TAUL, RHOLB, TAULX); LLWP.EPSLB = 1.0 - RHOLB - LLWP.TAUL; VB_LWP = true; @@ -7200,7 +7198,7 @@ bool VB_SWP(EnergyPlusData const &state, L.S, L.W, SL_WR, - Constant::DegToRadians * L.PHI_DEG, + Constant::DegToRad * L.PHI_DEG, OMEGA, L.SWP_MAT.RHOSBDD, L.SWP_MAT.RHOSFDD, @@ -7213,7 +7211,7 @@ bool VB_SWP(EnergyPlusData const &state, L.S, L.W, SL_WR, - -Constant::DegToRadians * L.PHI_DEG, + -Constant::DegToRad * L.PHI_DEG, OMEGA, L.SWP_MAT.RHOSBDD, L.SWP_MAT.RHOSFDD, @@ -7250,9 +7248,9 @@ bool VB_SWP(EnergyPlusData &state, SL_WR = VB_SLAT_RADIUS_RATIO(L.W, L.C); - VB_DIFF(state, L.S, L.W, Constant::DegToRadians * L.PHI_DEG, L.SWP_MAT.RHOSBDD, L.SWP_MAT.RHOSFDD, L.SWP_MAT.TAUS_DD, LSWP.RHOSFDD, LSWP.TAUS_DD); + VB_DIFF(state, L.S, L.W, Constant::DegToRad * L.PHI_DEG, L.SWP_MAT.RHOSBDD, L.SWP_MAT.RHOSFDD, L.SWP_MAT.TAUS_DD, LSWP.RHOSFDD, LSWP.TAUS_DD); - VB_DIFF(state, L.S, L.W, -Constant::DegToRadians * L.PHI_DEG, L.SWP_MAT.RHOSBDD, L.SWP_MAT.RHOSFDD, L.SWP_MAT.TAUS_DD, LSWP.RHOSBDD, TAUX); + VB_DIFF(state, L.S, L.W, -Constant::DegToRad * L.PHI_DEG, L.SWP_MAT.RHOSBDD, L.SWP_MAT.RHOSFDD, L.SWP_MAT.TAUS_DD, LSWP.RHOSBDD, TAUX); return true; } @@ -7509,7 +7507,7 @@ void BuildGap(EnergyPlusData &state, // PURPOSE OF THIS SUBROUTINE: // fills in the effective gap thickness and calculates the gas density - // The gas density is calculated at a standard manufactuered condition + // The gas density is calculated at a standard manufactured condition // if a different condition is not specified. // SUBROUTINE ARGUMENT DEFINITIONS: @@ -7541,7 +7539,7 @@ void AdjustVBGap(CFSGAP &G, // gap, returned updated // AUTHOR ASHRAE 1311-RP // PURPOSE OF THIS SUBROUTINE: - // Adjusts thickness of adjacent gaps seperated by in between slatted blind. + // Adjusts thickness of adjacent gaps separated by in between slatted blind. // METHODOLOGY EMPLOYED: // Treat VB layer as if it has 70% of actual thickness @@ -7595,7 +7593,7 @@ int CFSHasControlledShade(EnergyPlusData const &state, CFSTY const &FS) // FUNCTION INFORMATION: // AUTHOR ASHRAE 1311-RP // PURPOSE OF THIS FUNCTION: - // Returns index of the controlled layer in a fenestratio. If no + // Returns index of the controlled layer in a fenestration. If no // controlled layer, then returns zero. int CFSHasControlledShade = 0; @@ -7921,8 +7919,8 @@ Real64 EQLWindowInsideEffectiveEmiss(EnergyPlusData &state, int const ConstrNum) // DATE WRITTEN May 2013 // PURPOSE OF THIS FUNCTION: - // Given the consruction number, returns the equivalent layer inside - // face effective longwave emmisivity. + // Given the construction number, returns the equivalent layer inside + // face effective longwave emissivity. return EffectiveEPSLB(state.dataWindowEquivLayer->CFS(state.dataConstruction->Construct(ConstrNum).EQLConsPtr)); } @@ -7934,8 +7932,8 @@ Real64 EQLWindowOutsideEffectiveEmiss(EnergyPlusData &state, int const ConstrNum // DATE WRITTEN May 2013 // PURPOSE OF THIS FUNCTION: - // Given the consruction number, returns the equivalent layer outside - // face effective longwave emmisivity. + // Given the construction number, returns the equivalent layer outside + // face effective longwave emissivity. int EQLNum = state.dataConstruction->Construct(ConstrNum).EQLConsPtr; return EffectiveEPSLF(state.dataWindowEquivLayer->CFS(EQLNum)); @@ -7974,7 +7972,7 @@ Real64 HCInWindowStandardRatings(EnergyPlusData &state, Real64 Nuint; // Nusselt number for interior surface convection TiltDeg = 90.0; - sineTilt = std::sin(TiltDeg * Constant::DegToRadians); // degrees as arg + sineTilt = std::sin(TiltDeg * Constant::DegToRad); // degrees as arg // Begin calculating for ISO 15099 method. // mean film temperature @@ -7987,8 +7985,7 @@ Real64 HCInWindowStandardRatings(EnergyPlusData &state, mu = 3.723E-6 + 4.94E-8 * TmeanFilmKelvin; // Table B.2 in ISO 15099 Cp = 1002.737 + 1.2324E-2 * TmeanFilmKelvin; // Table B.3 in ISO 15099 - RaH = (pow_2(rho) * pow_3(Height) * Constant::GravityConstant * Cp * std::abs(TSurfIn - TAirIn)) / - (TmeanFilmKelvin * mu * lambda); // eq 132 in ISO 15099 + RaH = (pow_2(rho) * pow_3(Height) * Constant::Gravity * Cp * std::abs(TSurfIn - TAirIn)) / (TmeanFilmKelvin * mu * lambda); // eq 132 in ISO 15099 // eq. 135 in ISO 15099 (only need this one because tilt is 90 deg) Nuint = 0.56 * root_4(RaH * sineTilt); diff --git a/src/EnergyPlus/WindowEquivalentLayer.hh b/src/EnergyPlus/WindowEquivalentLayer.hh index affd940c6fc..ffbc7efe36e 100644 --- a/src/EnergyPlus/WindowEquivalentLayer.hh +++ b/src/EnergyPlus/WindowEquivalentLayer.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -60,6 +60,7 @@ // EnergyPlus Headers #include +#include #include #include @@ -818,6 +819,10 @@ struct WindowEquivalentLayerData : BaseGlobalStruct Real64 X1MRDiff = -1.0; Real64 XTAUDiff = -1.0; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/WindowManager.cc b/src/EnergyPlus/WindowManager.cc index 793ca54ed47..4dc106f58ff 100644 --- a/src/EnergyPlus/WindowManager.cc +++ b/src/EnergyPlus/WindowManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -54,7 +54,6 @@ // ObjexxFCL Headers #include -#include // EnergyPlus Headers #include @@ -66,16 +65,10 @@ #include #include #include -#include -#include #include -#include -#include -#include #include #include #include -#include #include #include #include @@ -178,8 +171,6 @@ namespace Window { // Using/Aliasing using namespace Vectors; - using WindowEquivalentLayer::InitEquivalentLayerWindowCalculations; - int TotLay; // Total solid and gas layers in a window construction int ConstrNumSh; // Shaded construction number int ShadeLayNum; // Layer number for shade or blind, if present @@ -205,49 +196,48 @@ namespace Window { // Glazing system layer solar absorptance for each glass layer Array1D solabsDiff(maxGlassLayers); // Glazing system solar absorptance for a layer at each incidence angle - Array1D solabsPhiLay(maxIncidentAngles); + std::array solabsPhiLay; // Glazing system solar transmittance from fit at each incidence angle - Array1D tsolPhiFit(maxIncidentAngles); + std::array tsolPhiFit; // Glazing system visible transmittance from fit at each incidence angle - Array1D tvisPhiFit(maxIncidentAngles); + std::array tvisPhiFit; // Isolated glass solar transmittance for each incidence angle - Array2D tBareSolPhi(maxGlassLayers, maxIncidentAngles); + Array1D> tBareSolPhi(maxGlassLayers); Real64 t1; // = tBareSolPhi(,1)(,2) Real64 t2; // Isolated glass visible transmittance for each incidence angle - Array2D tBareVisPhi(maxGlassLayers, maxIncidentAngles); + Array1D> tBareVisPhi(maxGlassLayers); Real64 t1v; // = tBareVisPhi(,1)(,2) Real64 t2v; // Isolated glass front solar reflectance for each incidence angle - Array2D rfBareSolPhi(maxGlassLayers, maxIncidentAngles); + Array1D> rfBareSolPhi(maxGlassLayers); // Isolated glass front visible reflectance for each incidence angle - Array2D rfBareVisPhi(maxGlassLayers, maxIncidentAngles); + Array1D> rfBareVisPhi(maxGlassLayers); // Isolated glass back solar reflectance for each incidence angle - Array2D rbBareSolPhi(maxGlassLayers, maxIncidentAngles); + Array1D> rbBareSolPhi(maxGlassLayers); // Isolated glass back visible reflectance for each incidence angle - Array2D rbBareVisPhi(maxGlassLayers, maxIncidentAngles); + Array1D> rbBareVisPhi(maxGlassLayers); // Isolated glass front solar absorptance for each incidence angle - Array2D afBareSolPhi(maxGlassLayers, maxIncidentAngles); + Array1D> afBareSolPhi(maxGlassLayers); Real64 af1; // = afBareSolPhi(,1)(,2) Real64 af2; Real64 rbmf2; // Isolated glass #2 front beam reflectance // Isolated glass back solar absorptance for each incidence angle - Array2D abBareSolPhi(maxGlassLayers, maxIncidentAngles); + Array1D> abBareSolPhi(maxGlassLayers); // Glazing system solar absorptance for each angle of incidence - Array2D solabsPhi(maxGlassLayers, maxIncidentAngles); + Array1D> solabsPhi(maxGlassLayers); // Glazing system back solar absorptance for each angle of incidence - Array2D solabsBackPhi(maxGlassLayers, maxIncidentAngles); + Array1D> solabsBackPhi(maxGlassLayers); // Glazing system interior shade solar absorptance for each angle of incidence - Array1D solabsShadePhi(maxIncidentAngles); + std::array solabsShadePhi; // These need to stay as Array1D for a little longer because changing them spreads into many source files - Array1D tsolPhi(maxIncidentAngles); // Glazing system solar transmittance for each angle of incidence - Array1D rfsolPhi(maxIncidentAngles); // Glazing system solar front reflectance for each angle of incidence - Array1D rbsolPhi(maxIncidentAngles); // Glazing system solar back reflectance for each angle of incidence - Array1D tvisPhi(maxIncidentAngles); // Glazing system visible transmittance for each angle of incidence - Array1D rfvisPhi(maxIncidentAngles); // Glazing system visible front reflectance for each angle of incidence - Array1D rbvisPhi(maxIncidentAngles); // Glazing system visible back reflectance for each angle of incidence - Array1D CosPhiIndepVar(maxIncidentAngles); // Cos of incidence angles at 10-deg increments for curve fits + std::array tsolPhi; // Glazing system solar transmittance for each angle of incidence + std::array rfsolPhi; // Glazing system solar front reflectance for each angle of incidence + std::array rbsolPhi; // Glazing system solar back reflectance for each angle of incidence + std::array tvisPhi; // Glazing system visible transmittance for each angle of incidence + std::array rfvisPhi; // Glazing system visible front reflectance for each angle of incidence + std::array rbvisPhi; // Glazing system visible back reflectance for each angle of incidence Real64 ab1; // = abBareSolPhi(,1)(,2) Real64 ab2; @@ -282,8 +272,6 @@ namespace Window { Real64 RhoGlIR; // IR reflectance of inside face of inside glass int NGlass; // Number of glass layers in a construction int LayPtr; // Material number corresponding to LayNum - Real64 Phi; // Incidence angle (deg) - Real64 CosPhi; // Cosine of incidence angle Real64 tsolDiff; // Glazing system diffuse solar transmittance Real64 tvisDiff; // Glazing system diffuse visible transmittance int IGlassBack; // Glass layer number counted from back of window @@ -365,9 +353,12 @@ namespace Window { if (thisConstruct.WindowTypeEQL) continue; // skip Equivalent Layer Fenestration // handling of optical properties - for (int IPhi = 1; IPhi <= 10; ++IPhi) { - CosPhiIndepVar(IPhi) = std::cos((IPhi - 1) * 10.0 * Constant::DegToRadians); - } + // When pulling in develop, the following block appears to have been modified in develop, + // but removed entirely in this branch. I'm going to leave it commented. + // Pre-calculate constants + // for (int IPhi = 1; IPhi <= 10; ++IPhi) { + // CosPhiIndepVar(IPhi) = std::cos((IPhi - 1) * 10.0 * Constant::DegToRad); + //} TotLay = thisConstruct.TotLayers; @@ -498,7 +489,6 @@ namespace Window { lquasi = false; AllGlassIsSpectralAverage = true; - int constexpr TotalIPhi = 10; wm->LayerNum = {0}; // Loop over glass layers in the construction @@ -644,27 +634,25 @@ namespace Window { } } // End of loop over glass layers in the construction for front calculation - if (TotalIPhi > maxIncidentAngles) { - ShowSevereError(state, - format("WindowManage::InitGlassOpticalCalculations = {}, Invalid maximum value of common incidet angles = {}.", - thisConstruct.Name, - TotalIPhi)); - ShowContinueError( - state, - format("The maximum number of incident angles for each construct is {}. Please rearrange the dataset.", maxIncidentAngles)); - ShowFatalError(state, "Errors found getting inputs. Previous error(s) cause program termination."); - } - // Loop over incidence angle from 0 to 90 deg in 10 deg increments. // Get glass layer properties, then glazing system properties (which include the // effect of inter-reflection among glass layers) at each incidence angle. - for (int IPhi = 1; IPhi <= TotalIPhi; ++IPhi) { - // 10 degree increment for incident angle is only value for a construction without a layer = SpectralAndAngle - Phi = double(IPhi - 1) * 10.0; - CosPhi = std::cos(Phi * Constant::DegToRadians); - if (std::abs(CosPhi) < 0.0001) CosPhi = 0.0; - + // <<<<<<< HEAD + // This was not a clear merge conflict, so I'm just taking the branch code and we'll see. + std::array cosPhisLocal; + // ======= + // for (int IPhi = 1; IPhi <= TotalIPhi; ++IPhi) { + // // 10 degree increment for incident angle is only value for a construction without a layer = SpectralAndAngle + // Phi = double(IPhi - 1) * 10.0; + // CosPhi = std::cos(Phi * Constant::DegToRad); + // if (std::abs(CosPhi) < 0.0001) CosPhi = 0.0; + // >>>>>>> origin/develop + + for (int iPhi = 0; iPhi < numPhis; ++iPhi) + cosPhisLocal[iPhi] = std::cos((double)iPhi * dPhiDeg * Constant::DegToRad); + + for (int iPhi = 0; iPhi < numPhis; ++iPhi) { // For each wavelength, get glass layer properties at this angle of incidence // from properties at normal incidence for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { @@ -673,7 +661,7 @@ namespace Window { assert(matGlass != nullptr); if (matGlass->windowOpticalData != Window::OpticalDataModel::SpectralAndAngle) { for (int ILam = 1; ILam <= numpt[IGlass - 1]; ++ILam) { - TransAndReflAtPhi(CosPhi, + TransAndReflAtPhi(cosPhisLocal[iPhi], t[IGlass - 1][ILam - 1], rff[IGlass - 1][ILam - 1], rbb[IGlass - 1][ILam - 1], @@ -688,23 +676,23 @@ namespace Window { for (int ILam = 1; ILam <= (int)wm->wle.size(); ++ILam) { Real64 lam = wm->wle[ILam - 1]; wlt[IGlass - 1][ILam - 1] = lam; - tPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngTransDataPtr, Phi, lam); - rfPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngFRefleDataPtr, Phi, lam); - rbPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngBRefleDataPtr, Phi, lam); + tPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngTransDataPtr, iPhi * dPhiDeg, lam); + rfPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngFRefleDataPtr, iPhi * dPhiDeg, lam); + rbPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngBRefleDataPtr, iPhi * dPhiDeg, lam); } } // For use with between-glass shade/blind, save angular properties of isolated glass // for case that all glass layers were input with spectral-average properties // only used by between-glass shades or blinds if (AllGlassIsSpectralAverage) { - tBareSolPhi(IGlass, IPhi) = tPhi[IGlass - 1][0]; - tBareVisPhi(IGlass, IPhi) = tPhi[IGlass - 1][1]; - rfBareSolPhi(IGlass, IPhi) = rfPhi[IGlass - 1][0]; - rfBareVisPhi(IGlass, IPhi) = rfPhi[IGlass - 1][1]; - rbBareSolPhi(IGlass, IPhi) = rbPhi[IGlass - 1][0]; - rbBareVisPhi(IGlass, IPhi) = rbPhi[IGlass - 1][1]; - afBareSolPhi(IGlass, IPhi) = max(0.0, 1.0 - (tBareSolPhi(IGlass, IPhi) + rfBareSolPhi(IGlass, IPhi))); - abBareSolPhi(IGlass, IPhi) = max(0.0, 1.0 - (tBareSolPhi(IGlass, IPhi) + rbBareSolPhi(IGlass, IPhi))); + tBareSolPhi(IGlass)[iPhi] = tPhi[IGlass - 1][0]; + tBareVisPhi(IGlass)[iPhi] = tPhi[IGlass - 1][1]; + rfBareSolPhi(IGlass)[iPhi] = rfPhi[IGlass - 1][0]; + rfBareVisPhi(IGlass)[iPhi] = rfPhi[IGlass - 1][1]; + rbBareSolPhi(IGlass)[iPhi] = rbPhi[IGlass - 1][0]; + rbBareVisPhi(IGlass)[iPhi] = rbPhi[IGlass - 1][1]; + afBareSolPhi(IGlass)[iPhi] = max(0.0, 1.0 - (tBareSolPhi(IGlass)[iPhi] + rfBareSolPhi(IGlass)[iPhi])); + abBareSolPhi(IGlass)[iPhi] = max(0.0, 1.0 - (tBareSolPhi(IGlass)[iPhi] + rbBareSolPhi(IGlass)[iPhi])); } } @@ -715,7 +703,7 @@ namespace Window { std::array stPhi = {0.0}; // Glazing system transmittance at angle of incidence for each wavelength in wle std::array srfPhi = {0.0}; // Glazing system front reflectance at angle of incidence for each wavelength in wle - std::array srbPhi = {0.0}; // Glazing system back reflectance at angle of incidence for each wavelenth in wle + std::array srbPhi = {0.0}; // Glazing system back reflectance at angle of incidence for each wavelength in wle // For each layer, glazing system absorptance at angle of incidence Array2D saPhi(maxGlassLayers, nume, 0.0); @@ -723,15 +711,15 @@ namespace Window { // Get solar properties of system by integrating over solar irradiance spectrum. // For now it is assumed that the exterior and interior irradiance spectra are the same. - tsolPhi(IPhi) = solarSpectrumAverage(state, stPhi); - rfsolPhi(IPhi) = solarSpectrumAverage(state, srfPhi); - rbsolPhi(IPhi) = solarSpectrumAverage(state, srbPhi); + tsolPhi[iPhi] = solarSpectrumAverage(state, stPhi); + rfsolPhi[iPhi] = solarSpectrumAverage(state, srfPhi); + rbsolPhi[iPhi] = solarSpectrumAverage(state, srbPhi); for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { for (int ILam = 1; ILam <= nume; ++ILam) { sabsPhi(ILam) = saPhi(IGlass, ILam); } - solabsPhi(IGlass, IPhi) = solarSpectrumAverage(state, sabsPhi); + solabsPhi(IGlass)[iPhi] = solarSpectrumAverage(state, sabsPhi); } // Get visible properties of system by integrating over solar irradiance @@ -742,23 +730,23 @@ namespace Window { // without spectral data, as indicated by the argument "2". if (lquasi) SystemSpectralPropertiesAtPhi(state, 2, NGlass, 0.37, 0.78, numpt, wlt, tPhi, rfPhi, rbPhi, stPhi, srfPhi, srbPhi, saPhi); - tvisPhi(IPhi) = visibleSpectrumAverage(state, stPhi); - rfvisPhi(IPhi) = visibleSpectrumAverage(state, srfPhi); - rbvisPhi(IPhi) = visibleSpectrumAverage(state, srbPhi); + tvisPhi[iPhi] = visibleSpectrumAverage(state, stPhi); + rfvisPhi[iPhi] = visibleSpectrumAverage(state, srfPhi); + rbvisPhi[iPhi] = visibleSpectrumAverage(state, srbPhi); } // End of loop over incidence angles for front calculation // only used by between-glass shades or blinds if (AllGlassIsSpectralAverage) { for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { - W5LsqFit(CosPhiIndepVar, tBareSolPhi(IGlass, _), 6, 1, TotalIPhi, thisConstruct.tBareSolCoef(IGlass)); - W5LsqFit(CosPhiIndepVar, tBareVisPhi(IGlass, _), 6, 1, TotalIPhi, thisConstruct.tBareVisCoef(IGlass)); - W5LsqFit(CosPhiIndepVar, rfBareSolPhi(IGlass, _), 6, 1, TotalIPhi, thisConstruct.rfBareSolCoef(IGlass)); - W5LsqFit(CosPhiIndepVar, rfBareVisPhi(IGlass, _), 6, 1, TotalIPhi, thisConstruct.rfBareVisCoef(IGlass)); - W5LsqFit(CosPhiIndepVar, rbBareSolPhi(IGlass, _), 6, 1, TotalIPhi, thisConstruct.rbBareSolCoef(IGlass)); - W5LsqFit(CosPhiIndepVar, rbBareVisPhi(IGlass, _), 6, 1, TotalIPhi, thisConstruct.rbBareVisCoef(IGlass)); - W5LsqFit(CosPhiIndepVar, afBareSolPhi(IGlass, _), 6, 1, TotalIPhi, thisConstruct.afBareSolCoef(IGlass)); - W5LsqFit(CosPhiIndepVar, abBareSolPhi(IGlass, _), 6, 1, TotalIPhi, thisConstruct.abBareSolCoef(IGlass)); + W5LsqFit(cosPhisLocal, tBareSolPhi(IGlass), thisConstruct.tBareSolCoef(IGlass)); + W5LsqFit(cosPhisLocal, tBareVisPhi(IGlass), thisConstruct.tBareVisCoef(IGlass)); + W5LsqFit(cosPhisLocal, rfBareSolPhi(IGlass), thisConstruct.rfBareSolCoef(IGlass)); + W5LsqFit(cosPhisLocal, rfBareVisPhi(IGlass), thisConstruct.rfBareVisCoef(IGlass)); + W5LsqFit(cosPhisLocal, rbBareSolPhi(IGlass), thisConstruct.rbBareSolCoef(IGlass)); + W5LsqFit(cosPhisLocal, rbBareVisPhi(IGlass), thisConstruct.rbBareVisCoef(IGlass)); + W5LsqFit(cosPhisLocal, afBareSolPhi(IGlass), thisConstruct.afBareSolCoef(IGlass)); + W5LsqFit(cosPhisLocal, abBareSolPhi(IGlass), thisConstruct.abBareSolCoef(IGlass)); } } @@ -772,7 +760,7 @@ namespace Window { thisConstruct.TransDiff = tsolDiff; thisConstruct.TransDiffVis = tvisDiff; for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { - solabsPhiLay({1, TotalIPhi}) = solabsPhi(IGlass, {1, TotalIPhi}); + solabsPhiLay = solabsPhi(IGlass); // Is this a deep copy? solabsDiff(IGlass) = DiffuseAverage(solabsPhiLay); thisConstruct.AbsDiff(IGlass) = solabsDiff(IGlass); @@ -780,12 +768,12 @@ namespace Window { // all glass layers were input with spectral-average properties // only used by between-glass shades or blinds if (AllGlassIsSpectralAverage) { - thisConstruct.tBareSolDiff(IGlass) = DiffuseAverage(tBareSolPhi(IGlass, {1, TotalIPhi})); - thisConstruct.tBareVisDiff(IGlass) = DiffuseAverage(tBareVisPhi(IGlass, {1, TotalIPhi})); - thisConstruct.rfBareSolDiff(IGlass) = DiffuseAverage(rfBareSolPhi(IGlass, {1, TotalIPhi})); - thisConstruct.rfBareVisDiff(IGlass) = DiffuseAverage(rfBareVisPhi(IGlass, {1, TotalIPhi})); - thisConstruct.rbBareSolDiff(IGlass) = DiffuseAverage(rbBareSolPhi(IGlass, {1, TotalIPhi})); - thisConstruct.rbBareVisDiff(IGlass) = DiffuseAverage(rbBareVisPhi(IGlass, {1, TotalIPhi})); + thisConstruct.tBareSolDiff(IGlass) = DiffuseAverage(tBareSolPhi(IGlass)); + thisConstruct.tBareVisDiff(IGlass) = DiffuseAverage(tBareVisPhi(IGlass)); + thisConstruct.rfBareSolDiff(IGlass) = DiffuseAverage(rfBareSolPhi(IGlass)); + thisConstruct.rfBareVisDiff(IGlass) = DiffuseAverage(rfBareVisPhi(IGlass)); + thisConstruct.rbBareSolDiff(IGlass) = DiffuseAverage(rbBareSolPhi(IGlass)); + thisConstruct.rbBareVisDiff(IGlass) = DiffuseAverage(rbBareVisPhi(IGlass)); thisConstruct.afBareSolDiff(IGlass) = max(0.0, 1.0 - (thisConstruct.tBareSolDiff(IGlass) + thisConstruct.rfBareSolDiff(IGlass))); thisConstruct.abBareSolDiff(IGlass) = max(0.0, 1.0 - (thisConstruct.tBareSolDiff(IGlass) + thisConstruct.rbBareSolDiff(IGlass))); } @@ -860,11 +848,17 @@ namespace Window { // The glazing system properties include the effect of inter-reflection among glass layers, // but exclude the effect of a shade or blind if present in the construction. // When a construction has a layer = SpectralAndAngle, the 10 degree increment will be overridden. - for (int IPhi = 1; IPhi <= TotalIPhi; ++IPhi) { - Phi = double(IPhi - 1) * 10.0; - CosPhi = std::cos(Phi * Constant::DegToRadians); - if (std::abs(CosPhi) < 0.0001) CosPhi = 0.0; + // another odd merge conflict, I'm just taking the branch code + //<<<<<<< HEAD + for (int iPhi = 0; iPhi < numPhis; ++iPhi) { + //======= + // for (int IPhi = 1; IPhi <= TotalIPhi; ++IPhi) { + // Phi = double(IPhi - 1) * 10.0; + // CosPhi = std::cos(Phi * Constant::DegToRad); + // if (std::abs(CosPhi) < 0.0001) CosPhi = 0.0; + + // >>>>>>> origin/develop // For each wavelength, get glass layer properties at this angle of incidence // from properties at normal incidence for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { @@ -874,7 +868,7 @@ namespace Window { if (matGlass->windowOpticalData != Window::OpticalDataModel::SpectralAndAngle) { for (int ILam = 1; ILam <= numpt[IGlass - 1]; ++ILam) { - TransAndReflAtPhi(CosPhi, + TransAndReflAtPhi(cosPhisLocal[iPhi], t[IGlass - 1][ILam - 1], rff[IGlass - 1][ILam - 1], rbb[IGlass - 1][ILam - 1], @@ -890,9 +884,9 @@ namespace Window { for (int ILam = 1; ILam <= (int)wm->wle.size(); ++ILam) { Real64 lam = wm->wle[ILam - 1]; wlt[IGlass - 1][ILam - 1] = lam; - tPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngTransDataPtr, Phi, lam); - rfPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngFRefleDataPtr, Phi, lam); - rbPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngBRefleDataPtr, Phi, lam); + tPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngTransDataPtr, iPhi * dPhiDeg, lam); + rfPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngFRefleDataPtr, iPhi * dPhiDeg, lam); + rbPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngBRefleDataPtr, iPhi * dPhiDeg, lam); } } } @@ -901,7 +895,7 @@ namespace Window { // stPhi, srfPhi, srbPhi and saPhi at this angle of incidence std::array stPhi = {0.0}; // Glazing system transmittance at angle of incidence for each wavelength in wle std::array srfPhi = {0.0}; // Glazing system front reflectance at angle of incidence for each wavelength in wle - std::array srbPhi = {0.0}; // Glazing system back reflectance at angle of incidence for each wavelenth in wle + std::array srbPhi = {0.0}; // Glazing system back reflectance at angle of incidence for each wavelength in wle // For each layer, glazing system absorptance at angle of incidence Array2D saPhi(maxGlassLayers, nume, 0.0); @@ -914,14 +908,14 @@ namespace Window { for (int j = 1; j <= nume; ++j) { sabsPhi(j) = saPhi(IGlass, j); } - solabsBackPhi(IGlass, IPhi) = solarSpectrumAverage(state, sabsPhi); + solabsBackPhi(IGlass)[iPhi] = solarSpectrumAverage(state, sabsPhi); } } // End of loop over incidence angles for back calculation for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { IGlassBack = NGlass - IGlass + 1; - thisConstruct.AbsDiffBack(IGlass) = DiffuseAverage(solabsBackPhi(IGlassBack, {1, 10})); + thisConstruct.AbsDiffBack(IGlass) = DiffuseAverage(solabsBackPhi(IGlassBack)); } //----------------------------------------------------------------------- @@ -959,13 +953,13 @@ namespace Window { ShadeReflFacVis = 1.0 / (1.0 - ShadeReflVis * constr.ReflectVisDiffBack); // Front incident solar, beam, interior shade - for (int IPhi = 1; IPhi <= 10; ++IPhi) { + for (int iPhi = 0; iPhi < numPhis; ++iPhi) { for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { - solabsPhi(IGlass, IPhi) += tsolPhi(IPhi) * ShadeRefl * ShadeReflFac * constr.AbsDiffBack(IGlass); + solabsPhi(IGlass)[iPhi] += tsolPhi[iPhi] * ShadeRefl * ShadeReflFac * constr.AbsDiffBack(IGlass); } - solabsShadePhi(IPhi) = tsolPhi(IPhi) * ShadeReflFac * ShadeAbs; - tsolPhi(IPhi) *= ShadeReflFac * ShadeTrans; - tvisPhi(IPhi) *= ShadeReflFacVis * ShadeTransVis; + solabsShadePhi[iPhi] = tsolPhi[iPhi] * ShadeReflFac * ShadeAbs; + tsolPhi[iPhi] *= ShadeReflFac * ShadeTrans; + tvisPhi[iPhi] *= ShadeReflFacVis * ShadeTransVis; } // Front incident solar, diffuse, interior shade @@ -1008,13 +1002,13 @@ namespace Window { ShadeReflFac = 1.0 / (1.0 - ShadeRefl * constr.ReflectSolDiffFront); ShadeReflFacVis = 1.0 / (1.0 - ShadeReflVis * constr.ReflectVisDiffFront); - for (int IPhi = 1; IPhi <= 10; ++IPhi) { + for (int iPhi = 0; iPhi < numPhis; ++iPhi) { for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { - solabsPhi(IGlass, IPhi) = ShadeTrans * solabsDiff(IGlass) * ShadeReflFac; + solabsPhi(IGlass)[iPhi] = ShadeTrans * solabsDiff(IGlass) * ShadeReflFac; } - tsolPhi(IPhi) = ShadeTrans * ShadeReflFac * tsolDiff; - tvisPhi(IPhi) = ShadeTransVis * ShadeReflFacVis * tvisDiff; - solabsShadePhi(IPhi) = ShadeAbs * (1.0 + ShadeTrans * ShadeReflFac * constr.ReflectSolDiffFront); + tsolPhi[iPhi] = ShadeTrans * ShadeReflFac * tsolDiff; + tvisPhi[iPhi] = ShadeTransVis * ShadeReflFacVis * tvisDiff; + solabsShadePhi[iPhi] = ShadeAbs * (1.0 + ShadeTrans * ShadeReflFac * constr.ReflectSolDiffFront); } // Front incident solar, diffuse, exterior shade/screen/blind @@ -1076,16 +1070,16 @@ namespace Window { // Front incident solar, beam, between-glass shade, NGlass = 2 - for (int IPhi = 1; IPhi <= 10; ++IPhi) { - t1 = tBareSolPhi(1, IPhi); - t1v = tBareVisPhi(1, IPhi); - af1 = afBareSolPhi(1, IPhi); - ab1 = abBareSolPhi(1, IPhi); - tsolPhi(IPhi) = t1 * (tsh + rsh * rb1 * tsh + tsh * rf2 * rsh) * td2; - tvisPhi(IPhi) = t1v * (tshv + rshv * rb1v * tshv + tshv * rf2v * rshv) * td2v; - solabsShadePhi(IPhi) = t1 * (ash + rsh * rb1 + tsh * rf2) * ash; - solabsPhi(1, IPhi) = af1 + t1 * (rsh + rsh * rb1 * rsh + tsh * rf2 * tsh) * abd1; - solabsPhi(2, IPhi) = t1 * (tsh + rsh * rb1 * tsh + tsh * rf2 * rsh) * afd2; + for (int iPhi = 0; iPhi < numPhis; ++iPhi) { + t1 = tBareSolPhi(1)[iPhi]; + t1v = tBareVisPhi(1)[iPhi]; + af1 = afBareSolPhi(1)[iPhi]; + ab1 = abBareSolPhi(1)[iPhi]; + tsolPhi[iPhi] = t1 * (tsh + rsh * rb1 * tsh + tsh * rf2 * rsh) * td2; + tvisPhi[iPhi] = t1v * (tshv + rshv * rb1v * tshv + tshv * rf2v * rshv) * td2v; + solabsShadePhi[iPhi] = t1 * (ash + rsh * rb1 + tsh * rf2) * ash; + solabsPhi(1)[iPhi] = af1 + t1 * (rsh + rsh * rb1 * rsh + tsh * rf2 * tsh) * abd1; + solabsPhi(2)[iPhi] = t1 * (tsh + rsh * rb1 * tsh + tsh * rf2 * rsh) * afd2; } // End of loop over incidence angles // Front incident solar, diffuse, between-glass shade, NGlass = 2 @@ -1119,23 +1113,23 @@ namespace Window { // Front incident solar, beam, between-glass shade, NGlass = 3 - for (int IPhi = 1; IPhi <= 10; ++IPhi) { - t1 = tBareSolPhi(1, IPhi); - t1v = tBareVisPhi(1, IPhi); - t2 = tBareSolPhi(2, IPhi); - t2v = tBareVisPhi(2, IPhi); - af1 = afBareSolPhi(1, IPhi); - af2 = afBareSolPhi(2, IPhi); - ab1 = abBareSolPhi(1, IPhi); - ab2 = abBareSolPhi(2, IPhi); + for (int iPhi = 0; iPhi < numPhis; ++iPhi) { + t1 = tBareSolPhi(1)[iPhi]; + t1v = tBareVisPhi(1)[iPhi]; + t2 = tBareSolPhi(2)[iPhi]; + t2v = tBareVisPhi(2)[iPhi]; + af1 = afBareSolPhi(1)[iPhi]; + af2 = afBareSolPhi(2)[iPhi]; + ab1 = abBareSolPhi(1)[iPhi]; + ab2 = abBareSolPhi(2)[iPhi]; rbmf2 = max(0.0, 1.0 - (t2 + af2)); - tsolPhi(IPhi) = t1 * t2 * (tsh + tsh * rf3 * rsh + rsh * td2 * rb1 * td2 * tsh + rsh * rb2 * tsh) * td3; - tvisPhi(IPhi) = t1v * t2v * (tshv + tshv * rf3v * rshv + rshv * td2v * rb1v * td2v * tshv + rshv * rb2v * tshv) * td3v; - solabsShadePhi(IPhi) = t1 * t2 * (1 + rsh * td2 * rb1 * td2 + rsh * rb2) * ash; - solabsPhi(1, IPhi) = af1 + rbmf2 * ab1 + t1 * t2 * rsh * (1 + rf3 * tsh + rb2 * rsh + td2 * rb1 * td2 * rsh) * td2 * abd1; - solabsPhi(2, IPhi) = t1 * af2 + t1 * t2 * ((rsh + tsh * rf3 * tsh + rsh * rb2 * rsh) * abd2 + rsh * td2 * rb1 * afd2); - solabsPhi(3, IPhi) = t1 * t2 * (tsh + rsh * (rb2 * tsh + td2 * rb2 * td2 * tsh + rf3 * rsh)) * afd3; + tsolPhi[iPhi] = t1 * t2 * (tsh + tsh * rf3 * rsh + rsh * td2 * rb1 * td2 * tsh + rsh * rb2 * tsh) * td3; + tvisPhi[iPhi] = t1v * t2v * (tshv + tshv * rf3v * rshv + rshv * td2v * rb1v * td2v * tshv + rshv * rb2v * tshv) * td3v; + solabsShadePhi[iPhi] = t1 * t2 * (1 + rsh * td2 * rb1 * td2 + rsh * rb2) * ash; + solabsPhi(1)[iPhi] = af1 + rbmf2 * ab1 + t1 * t2 * rsh * (1 + rf3 * tsh + rb2 * rsh + td2 * rb1 * td2 * rsh) * td2 * abd1; + solabsPhi(2)[iPhi] = t1 * af2 + t1 * t2 * ((rsh + tsh * rf3 * tsh + rsh * rb2 * rsh) * abd2 + rsh * td2 * rb1 * afd2); + solabsPhi(3)[iPhi] = t1 * t2 * (tsh + rsh * (rb2 * tsh + td2 * rb2 * td2 * tsh + rf3 * rsh)) * afd3; } // End of loop over incidence angle // Front incident solar, diffuse, between-glass shade, NGlass = 3 @@ -1440,44 +1434,45 @@ namespace Window { // visible transmittance as polynomials in cosine of incidence angle if (!BlindOn && !ScreenOn) { // Bare glass or shade on - W5LsqFit(CosPhiIndepVar, tsolPhi, 6, 1, TotalIPhi, thisConstruct.TransSolBeamCoef); - W5LsqFit(CosPhiIndepVar, rfsolPhi, 6, 1, TotalIPhi, thisConstruct.ReflSolBeamFrontCoef); - W5LsqFit(CosPhiIndepVar, rbsolPhi, 6, 1, TotalIPhi, thisConstruct.ReflSolBeamBackCoef); - W5LsqFit(CosPhiIndepVar, tvisPhi, 6, 1, TotalIPhi, thisConstruct.TransVisBeamCoef); - Array1D DepVarCurveFit(TotalIPhi); - Array1D CoeffsCurveFit(6); + W5LsqFit(cosPhisLocal, tsolPhi, thisConstruct.TransSolBeamCoef); + W5LsqFit(cosPhisLocal, rfsolPhi, thisConstruct.ReflSolBeamFrontCoef); + W5LsqFit(cosPhisLocal, rbsolPhi, thisConstruct.ReflSolBeamBackCoef); + W5LsqFit(cosPhisLocal, tvisPhi, thisConstruct.TransVisBeamCoef); for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { // Front absorptance coefficients for glass layers - DepVarCurveFit = solabsPhi(IGlass, {1, TotalIPhi}); - W5LsqFit(CosPhiIndepVar, DepVarCurveFit, 6, 1, TotalIPhi, CoeffsCurveFit); - thisConstruct.AbsBeamCoef(IGlass) = CoeffsCurveFit; + W5LsqFit(cosPhisLocal, solabsPhi(IGlass), thisConstruct.AbsBeamCoef(IGlass)); + // Back absorptance coefficients for glass layers IGlassBack = NGlass - IGlass + 1; - DepVarCurveFit = solabsBackPhi(IGlassBack, {1, TotalIPhi}); - W5LsqFit(CosPhiIndepVar, DepVarCurveFit, 6, 1, TotalIPhi, CoeffsCurveFit); - thisConstruct.AbsBeamBackCoef(IGlass) = CoeffsCurveFit; + W5LsqFit(cosPhisLocal, solabsBackPhi(IGlassBack), thisConstruct.AbsBeamBackCoef(IGlass)); } // To check goodness of fit //Tuned - for (int IPhi = 1; IPhi <= TotalIPhi; ++IPhi) { - tsolPhiFit(IPhi) = 0.0; - tvisPhiFit(IPhi) = 0.0; - - Phi = double(IPhi - 1) * 10.0; - CosPhi = std::cos(Phi * Constant::DegToRadians); - if (std::abs(CosPhi) < 0.0001) CosPhi = 0.0; - Real64 cos_pow(1.0); - for (int CoefNum = 1; CoefNum <= 6; ++CoefNum) { - cos_pow *= CosPhi; - tsolPhiFit(IPhi) += thisConstruct.TransSolBeamCoef(CoefNum) * cos_pow; - tvisPhiFit(IPhi) += thisConstruct.TransVisBeamCoef(CoefNum) * cos_pow; + for (int iPhi = 0; iPhi < numPhis; ++iPhi) { + tsolPhiFit[iPhi] = 0.0; + tvisPhiFit[iPhi] = 0.0; + + //<<<<<<< HEAD + for (int CoefNum = 0; CoefNum < maxPolyCoef; ++CoefNum) { + tsolPhiFit[iPhi] += thisConstruct.TransSolBeamCoef[CoefNum] * cosPhisLocal[iPhi]; + tvisPhiFit[iPhi] += thisConstruct.TransVisBeamCoef[CoefNum] * cosPhisLocal[iPhi]; + //======= + // Phi = double(IPhi - 1) * 10.0; + // CosPhi = std::cos(Phi * Constant::DegToRad); + // if (std::abs(CosPhi) < 0.0001) CosPhi = 0.0; + // Real64 cos_pow(1.0); + // for (int CoefNum = 1; CoefNum <= 6; ++CoefNum) { + // cos_pow *= CosPhi; + // tsolPhiFit(IPhi) += thisConstruct.TransSolBeamCoef(CoefNum) * cos_pow; + // tvisPhiFit(IPhi) += thisConstruct.TransVisBeamCoef(CoefNum) * cos_pow; + // >>>>>>> origin/develop } } } - if (ShadeOn) W5LsqFit(CosPhiIndepVar, solabsShadePhi, 6, 1, TotalIPhi, thisConstruct.AbsBeamShadeCoef); + if (ShadeOn) W5LsqFit(cosPhisLocal, solabsShadePhi, thisConstruct.AbsBeamShadeCoef); } // End of loop over constructions @@ -1606,28 +1601,28 @@ namespace Window { auto &s_mat = state.dataMaterial; auto &s_surf = state.dataSurface; - for (int ConstrNum = 1; ConstrNum <= state.dataHeatBal->TotConstructs; ++ConstrNum) { - auto &thisConstruct = state.dataConstruction->Construct(ConstrNum); - if (thisConstruct.FromWindow5DataFile) continue; - if (thisConstruct.WindowTypeBSDF) continue; - thisConstruct.TransDiff = 0.0; - thisConstruct.TransDiffVis = 0.0; - thisConstruct.AbsDiffBackShade = 0.0; - thisConstruct.ShadeAbsorpThermal = 0.0; - thisConstruct.ReflectSolDiffBack = 0.0; - thisConstruct.ReflectSolDiffFront = 0.0; - thisConstruct.ReflectVisDiffFront = 0.0; - thisConstruct.AbsBeamShadeCoef = 0.0; - thisConstruct.TransSolBeamCoef = 0.0; - thisConstruct.ReflSolBeamFrontCoef = 0.0; - thisConstruct.ReflSolBeamBackCoef = 0.0; - thisConstruct.TransVisBeamCoef = 0.0; - thisConstruct.AbsDiff = 0.0; - thisConstruct.AbsDiffBack = 0.0; + for (auto &constr : state.dataConstruction->Construct) { + if (constr.FromWindow5DataFile) continue; + if (constr.WindowTypeBSDF) continue; + constr.TransDiff = 0.0; + constr.TransDiffVis = 0.0; + constr.AbsDiffBackShade = 0.0; + constr.ShadeAbsorpThermal = 0.0; + constr.ReflectSolDiffBack = 0.0; + constr.ReflectSolDiffFront = 0.0; + constr.ReflectVisDiffFront = 0.0; + + std::fill(constr.AbsBeamShadeCoef.begin(), constr.AbsBeamShadeCoef.end(), 0.0); + std::fill(constr.TransSolBeamCoef.begin(), constr.TransSolBeamCoef.end(), 0.0); + std::fill(constr.ReflSolBeamFrontCoef.begin(), constr.ReflSolBeamFrontCoef.end(), 0.0); + std::fill(constr.ReflSolBeamBackCoef.begin(), constr.ReflSolBeamBackCoef.begin(), 0.0); + std::fill(constr.TransVisBeamCoef.begin(), constr.TransVisBeamCoef.end(), 0.0); + constr.AbsDiff = 0.0; + constr.AbsDiffBack = 0.0; for (int Layer = 1; Layer <= state.dataHeatBal->MaxSolidWinLayers; ++Layer) { - for (int index = 1; index <= DataSurfaces::MaxPolyCoeff; ++index) { - state.dataConstruction->Construct(state.dataHeatBal->TotConstructs).AbsBeamCoef(Layer)(index) = 0.0; - state.dataConstruction->Construct(state.dataHeatBal->TotConstructs).AbsBeamBackCoef(Layer)(index) = 0.0; + for (int index = 0; index < maxPolyCoef; ++index) { + state.dataConstruction->Construct(state.dataHeatBal->TotConstructs).AbsBeamCoef(Layer)[index] = 0.0; + state.dataConstruction->Construct(state.dataHeatBal->TotConstructs).AbsBeamBackCoef(Layer)[index] = 0.0; } } } @@ -1911,7 +1906,7 @@ namespace Window { } } // SystemPropertiesAtLambdaAndPhi() - Real64 solarSpectrumAverage(EnergyPlusData &state, gsl::span p) + Real64 solarSpectrumAverage(EnergyPlusData const &state, gsl::span p) { Real64 num = 0.0; Real64 denom = 0.0; @@ -1925,7 +1920,7 @@ namespace Window { return num / denom; // dangerous, doesn't check for zero denominator } - Real64 visibleSpectrumAverage(EnergyPlusData &state, gsl::span p) + Real64 visibleSpectrumAverage(EnergyPlusData const &state, gsl::span p) { // AUTHOR Adapted by F.Winkelmann from WINDOW 5 // subroutine w4vis @@ -2061,12 +2056,6 @@ namespace Window { // Using/Aliasing using namespace DataBSDFWindow; - using Psychrometrics::PsyCpAirFnW; - using Psychrometrics::PsyTdpFnWPb; - // unused0909 USE DataEnvironment, ONLY: CurMnDyHr - using ScheduleManager::GetCurrentScheduleValue; - using WindowComplexManager::CalcComplexWindowThermal; - using WindowEquivalentLayer::EQLWindowSurfaceHeatBalance; // SUBROUTINE ARGUMENT DEFINITIONS: // (temperature of innermost face) [C] @@ -2091,7 +2080,7 @@ namespace Window { Real64 Tright; Real64 SrdSurfTempAbs; // Absolute temperature of a surrounding surface - Real64 OutSrdIR; // LWR from surrouding srfs + Real64 OutSrdIR; // LWR from surrounding srfs // New variables for thermochromic windows calc Real64 locTCSpecTemp; // The temperature corresponding to the specified optical properties of the TC layer @@ -2115,7 +2104,7 @@ namespace Window { int temp = 0; // Simon: Complex fenestration state works only with tarcog - CalcComplexWindowThermal( + WindowComplexManager::CalcComplexWindowThermal( state, SurfNum, temp, HextConvCoeff, SurfInsideTemp, SurfOutsideTemp, SurfOutsideEmiss, DataBSDFWindow::Condition::Invalid); auto const &constr = state.dataConstruction->Construct(ConstrNum); @@ -2149,7 +2138,7 @@ namespace Window { } else if (s_surf->SurfWinWindowModelType(SurfNum) == WindowModel::EQL) { - EQLWindowSurfaceHeatBalance( + WindowEquivalentLayer::EQLWindowSurfaceHeatBalance( state, SurfNum, HextConvCoeff, SurfInsideTemp, SurfOutsideTemp, SurfOutsideEmiss, DataBSDFWindow::Condition::Invalid); wm->hcout = HextConvCoeff; // Required for report variables calculations. @@ -2197,7 +2186,7 @@ namespace Window { wm->nglface = 2 * wm->ngllayer; ShadeFlag = s_surf->SurfWinShadingFlag(SurfNum); wm->tilt = surf.Tilt; - wm->tiltr = wm->tilt * Constant::DegToRadians; + wm->tiltr = wm->tilt * Constant::DegToRad; SurfNumAdj = surf.ExtBoundCond; wm->hcin = state.dataHeatBalSurf->SurfHConvInt(SurfNum); // Room-side surface convective film conductance Real64 RefAirTemp = s_surf->Surface(SurfNum).getInsideAirTemperature(state, SurfNum); @@ -2207,7 +2196,7 @@ namespace Window { // Reset hcin if necessary since too small a value sometimes causes non-convergence // of window layer heat balance solution. if (s_surf->surfIntConv(SurfNum).model == Convect::HcInt::SetByZone) { - // may be redundent now, check is also in HeatBalanceConvectionCoeffs.cc + // may be redundant now, check is also in HeatBalanceConvectionCoeffs.cc if (wm->hcin <= state.dataHeatBal->LowHConvLimit) { // hcin = 3.076d0 !BG this is rather high value and abrupt change. changed to set to lower limit wm->hcin = state.dataHeatBal->LowHConvLimit; @@ -2440,9 +2429,6 @@ namespace Window { wm->thetas = {0.0}; wm->thetasPrev = {0.0}; -#ifdef GET_OUT - wm->fvec = {0.0}; -#endif // GET_OUT // Calculate window face temperatures @@ -2494,7 +2480,7 @@ namespace Window { if (!state.dataConstruction->Construct(surf.Construction).WindowTypeEQL) { InsideGlassTemp = wm->thetas[2 * wm->ngllayer - 1] - Constant::Kelvin; RoomHumRat = thisZoneHB.airHumRat; - RoomDewPoint = PsyTdpFnWPb(state, RoomHumRat, state.dataEnvrn->OutBaroPress); + RoomDewPoint = Psychrometrics::PsyTdpFnWPb(state, RoomHumRat, state.dataEnvrn->OutBaroPress); s_surf->SurfWinInsideGlassCondensationFlag(SurfNum) = 0; if (InsideGlassTemp < RoomDewPoint) s_surf->SurfWinInsideGlassCondensationFlag(SurfNum) = 1; // If airflow window, is there condensation on either glass face of the airflow gap? @@ -2553,124 +2539,6 @@ namespace Window { //**************************************************************************** -#ifdef GET_OUT - void WindowHeatBalanceEquations(EnergyPlusData &state, int const SurfNum) // Surface number - { - - // SUBROUTINE INFORMATION: - // AUTHOR F. Winkelmann - // DATE WRITTEN February 2000 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS SUBROUTINE: - // Evaluates heat balance functions at each glass face. - // Also evaluates Jacobian. - // Currently limited to three glass layers. - - Array1D hgap(maxGlassLayers); // Gap gas conductance - Real64 gr; // Gap gas Grashof number - Real64 con; // Gap gas conductivity - Real64 pr; // Gap gas Prandtl number - Real64 nu; // Gap gas Nusselt number - Real64 thetas_2_3_4; - Real64 thetas_4_5_4; - Real64 thetas_6_7_4; - - auto &wm = state.dataWindowManager; - auto &s_surf = state.dataSurface; - - auto const &surfWin = s_surf->SurfaceWindow(SurfNum); - - // Have to zero fvec each time since LUdecompostion and LUsolution may - // add values to this array in unexpected places - - wm->fvec = {0.0}; - - switch (wm->ngllayer) { - - case 1: { // single pane - wm->fvec[0] = wm->Outir * wm->emis[0] - wm->emis[0] * Constant::StefanBoltzmann * pow_4(wm->thetas[0]) + - wm->scon[0] * (wm->thetas[1] - wm->thetas[0]) + wm->hcout * (wm->tout - wm->thetas[0]) + wm->AbsRadGlassFace[0]; - wm->fvec[1] = wm->Rmir * wm->emis[1] - wm->emis[1] * Constant::StefanBoltzmann * pow_4(wm->thetas[1]) + - wm->scon[0] * (wm->thetas[0] - wm->thetas[1]) + wm->hcin * (wm->tin - wm->thetas[1]) + wm->AbsRadGlassFace[1]; - } break; - case 2: { // double pane - WindowGasConductance(state, wm->thetas[1], wm->thetas[2], 1, con, pr, gr); - NusseltNumber(state, SurfNum, wm->thetas[1], wm->thetas[2], 1, gr, pr, nu); - hgap(1) = (con / wm->gaps[0].width * nu) * surfWin.edgeGlassCorrFac; - - wm->fvec[0] = wm->Outir * wm->emis[0] - wm->emis[0] * Constant::StefanBoltzmann * pow_4(wm->thetas[0]) + - wm->scon[0] * (wm->thetas[1] - wm->thetas[0]) + wm->hcout * (wm->tout - wm->thetas[0]) + wm->AbsRadGlassFace[0]; - thetas_2_3_4 = pow_4(wm->thetas[1]) - pow_4(wm->thetas[2]); - wm->fvec[1] = wm->scon[0] * (wm->thetas[0] - wm->thetas[1]) + hgap(1) * (wm->thetas[2] - wm->thetas[1]) + wm->A23 * thetas_2_3_4 + - wm->AbsRadGlassFace[1]; - wm->fvec[2] = hgap(1) * (wm->thetas[1] - wm->thetas[2]) + wm->scon[1] * (wm->thetas[3] - wm->thetas[2]) - wm->A23 * thetas_2_3_4 + - wm->AbsRadGlassFace[2]; - wm->fvec[3] = wm->Rmir * wm->emis[3] - wm->emis[3] * Constant::StefanBoltzmann * pow_4(wm->thetas[3]) + - wm->scon[1] * (wm->thetas[2] - wm->thetas[3]) + wm->hcin * (wm->tin - wm->thetas[3]) + wm->AbsRadGlassFace[3]; - } break; - case 3: { // Triple Pane - WindowGasConductance(state, wm->thetas[1], wm->thetas[2], 1, con, pr, gr); - NusseltNumber(state, SurfNum, wm->thetas[1], wm->thetas[2], 1, gr, pr, nu); - hgap(1) = con / wm->gaps[0].width * nu * surfWin.edgeGlassCorrFac; - - WindowGasConductance(state, wm->thetas[3], wm->thetas[4], 2, con, pr, gr); - NusseltNumber(state, SurfNum, wm->thetas[3], wm->thetas[4], 2, gr, pr, nu); - hgap(2) = con / wm->gaps[1].width * nu * surfWin.edgeGlassCorrFac; - - thetas_2_3_4 = pow_4(wm->thetas[1]) - pow_4(wm->thetas[2]); - thetas_4_5_4 = pow_4(wm->thetas[3]) - pow_4(wm->thetas[4]); - wm->fvec[0] = wm->Outir * wm->emis[0] - wm->emis[0] * Constant::StefanBoltzmann * pow_4(wm->thetas[0]) + - wm->scon[0] * (wm->thetas[1] - wm->thetas[0]) + wm->hcout * (wm->tout - wm->thetas[0]) + wm->AbsRadGlassFace[0]; - wm->fvec[1] = wm->scon[0] * (wm->thetas[0] - wm->thetas[1]) + hgap(1) * (wm->thetas[2] - wm->thetas[1]) + wm->A23 * thetas_2_3_4 + - wm->AbsRadGlassFace[1]; - wm->fvec[2] = hgap(1) * (wm->thetas[1] - wm->thetas[2]) + wm->scon[1] * (wm->thetas[3] - wm->thetas[2]) - wm->A23 * thetas_2_3_4 + - wm->AbsRadGlassFace[2]; - wm->fvec[3] = wm->scon[1] * (wm->thetas[2] - wm->thetas[3]) + hgap(2) * (wm->thetas[4] - wm->thetas[3]) + wm->A45 * thetas_4_5_4 + - wm->AbsRadGlassFace[3]; - wm->fvec[4] = hgap(2) * (wm->thetas[3] - wm->thetas[4]) + wm->scon[2] * (wm->thetas[5] - wm->thetas[4]) - wm->A45 * thetas_4_5_4 + - wm->AbsRadGlassFace[4]; - wm->fvec[5] = wm->Rmir * wm->emis[5] - wm->emis[5] * Constant::StefanBoltzmann * pow_4(wm->thetas[5]) + - wm->scon[2] * (wm->thetas[4] - wm->thetas[5]) + wm->hcin * (wm->tin - wm->thetas[5]) + wm->AbsRadGlassFace[5]; - } break; - case 4: { // Quad Pane - WindowGasConductance(state, wm->thetas[1], wm->thetas[2], 1, con, pr, gr); - NusseltNumber(state, SurfNum, wm->thetas[1], wm->thetas[2], 1, gr, pr, nu); - hgap(1) = con / wm->gaps[0].width * nu * surfWin.edgeGlassCorrFac; - - WindowGasConductance(state, wm->thetas[3], wm->thetas[4], 2, con, pr, gr); - NusseltNumber(state, SurfNum, wm->thetas[3], wm->thetas[4], 2, gr, pr, nu); - hgap(2) = con / wm->gaps[1].width * nu * surfWin.edgeGlassCorrFac; - - WindowGasConductance(state, wm->thetas[5], wm->thetas[6], 3, con, pr, gr); - NusseltNumber(state, SurfNum, wm->thetas[5], wm->thetas[6], 3, gr, pr, nu); - hgap(3) = con / wm->gaps[2].width * nu * surfWin.edgeGlassCorrFac; - - thetas_2_3_4 = pow_4(wm->thetas[1]) - pow_4(wm->thetas[2]); - thetas_4_5_4 = pow_4(wm->thetas[3]) - pow_4(wm->thetas[4]); - thetas_6_7_4 = pow_4(wm->thetas[5]) - pow_4(wm->thetas[6]); - wm->fvec[0] = wm->Outir * wm->emis[0] - wm->emis[0] * Constant::StefanBoltzmann * pow_4(wm->thetas[0]) + - wm->scon[0] * (wm->thetas[1] - wm->thetas[0]) + wm->hcout * (wm->tout - wm->thetas[0]) + wm->AbsRadGlassFace[0]; - wm->fvec[1] = wm->scon[0] * (wm->thetas[0] - wm->thetas[1]) + hgap(1) * (wm->thetas[2] - wm->thetas[1]) + wm->A23 * thetas_2_3_4 + - wm->AbsRadGlassFace[1]; - wm->fvec[2] = hgap(1) * (wm->thetas[1] - wm->thetas[2]) + wm->scon[1] * (wm->thetas[3] - wm->thetas[2]) - wm->A23 * thetas_2_3_4 + - wm->AbsRadGlassFace[2]; - wm->fvec[3] = wm->scon[1] * (wm->thetas[2] - wm->thetas[3]) + hgap(2) * (wm->thetas[4] - wm->thetas[3]) + wm->A45 * thetas_4_5_4 + - wm->AbsRadGlassFace[3]; - wm->fvec[4] = hgap(2) * (wm->thetas[3] - wm->thetas[4]) + wm->scon[2] * (wm->thetas[5] - wm->thetas[4]) - wm->A45 * thetas_4_5_4 + - wm->AbsRadGlassFace[4]; - wm->fvec[5] = wm->scon[2] * (wm->thetas[4] - wm->thetas[5]) + hgap(3) * (wm->thetas[6] - wm->thetas[5]) + wm->A67 * thetas_6_7_4 + - wm->AbsRadGlassFace[5]; - wm->fvec[6] = hgap(3) * (wm->thetas[5] - wm->thetas[6]) + wm->scon[3] * (wm->thetas[7] - wm->thetas[6]) - wm->A67 * thetas_6_7_4 + - wm->AbsRadGlassFace[6]; - wm->fvec[7] = wm->Rmir * wm->emis[7] - wm->emis[7] * Constant::StefanBoltzmann * pow_4(wm->thetas[7]) + - wm->scon[3] * (wm->thetas[6] - wm->thetas[7]) + wm->hcin * (wm->tin - wm->thetas[7]) + wm->AbsRadGlassFace[7]; - } break; - } // switch - } // WindowHeatBalanceEquations() -#endif // GET_OUT - //**************************************************************************** void GetHeatBalanceEqCoefMatrixSimple(EnergyPlusData &state, @@ -3288,13 +3156,6 @@ namespace Window { // heat balance at the glass and shade/blind faces. The system of linear equations is solved // by LU decomposition. - // Using/Aliasing - using Convect::CalcISO15099WindowIntConvCoeff; - using Psychrometrics::PsyCpAirFnW; - using Psychrometrics::PsyHFnTdbW; - using Psychrometrics::PsyRhoAirFnPbTdbW; - using Psychrometrics::PsyTdbFnHW; - constexpr int MaxIterations(100); // Maximum allowed number of iterations (increased 9/01 from 15 to 50, // increased 11/02 from 50 to 100) constexpr Real64 errtemptol(0.02); // Tolerance on errtemp for convergence (increased from 0.01, 3/4/03) @@ -3413,7 +3274,8 @@ namespace Window { } else { InsideFaceIndex = wm->nglface; } - CalcISO15099WindowIntConvCoeff(state, SurfNum, wm->thetas[InsideFaceIndex - 1] - Constant::Kelvin, wm->tin - Constant::Kelvin); + Convect::CalcISO15099WindowIntConvCoeff( + state, SurfNum, wm->thetas[InsideFaceIndex - 1] - Constant::Kelvin, wm->tin - Constant::Kelvin); wm->hcin = state.dataHeatBalSurf->SurfHConvInt(SurfNum); } @@ -3572,8 +3434,8 @@ namespace Window { InletAirHumRat = state.dataEnvrn->OutHumRat; } Real64 ZoneTemp = thisZoneHB.MAT; // this should be Tin (account for different reference temps) - CpAirOutlet = PsyCpAirFnW(InletAirHumRat); - CpAirZone = PsyCpAirFnW(thisZoneHB.airHumRat); + CpAirOutlet = Psychrometrics::PsyCpAirFnW(InletAirHumRat); + CpAirZone = Psychrometrics::PsyCpAirFnW(thisZoneHB.airHumRat); s_surf->SurfWinRetHeatGainToZoneAir(SurfNum) = TotAirflowGap * (CpAirOutlet * (TAirflowGapOutletC)-CpAirZone * ZoneTemp); if (s_surf->SurfWinAirflowDestination(SurfNum) == WindowAirFlowDestination::Indoor) { s_surf->SurfWinHeatGain(SurfNum) += s_surf->SurfWinRetHeatGainToZoneAir(SurfNum); @@ -3695,7 +3557,7 @@ namespace Window { int ConstrNumSh; // Shaded construction number int MatNumSh; // Material number of shade/blind layer - int nglassfaces; // Number of glass faces in contruction + int nglassfaces; // Number of glass faces in construction Real64 TGapInlet; // Temperature of air entering glass-shade/blind gap at bottom for upward // air flow or top for downward air flow (K) Real64 TGlassFace; // Temperature of glass surface facing glass-shade/blind gap (K) @@ -4081,9 +3943,6 @@ namespace Window { // Based on ISO/DIS 15099, "Thermal Performance of Windows, Doors and Shading Devices -- // Detailed Calculations" - // Using/Aliasing - using ScheduleManager::GetCurrentScheduleValue; - // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // air flow or bottom for downward air flow (K) @@ -4534,14 +4393,13 @@ namespace Window { fcon[i - 1] = wmgas.con.c0 + wmgas.con.c1 * tmean + wmgas.con.c2 * tmean_2; fvis[i - 1] = wmgas.vis.c0 + wmgas.vis.c1 * tmean + wmgas.vis.c2 * tmean_2; fcp[i - 1] = wmgas.cp.c0 + wmgas.cp.c1 * tmean + wmgas.cp.c2 * tmean_2; - fdens[i - 1] = pres * wmgas.wght / (gaslaw * tmean); molmix += frct[i - 1] * wmgas.wght; // eq. 56 cpmixm += frct[i - 1] * fcp[i - 1] * wmgas.wght; // eq. 58-59 kprime[i - 1] = 3.75 * gaslaw / wmgas.wght * fvis[i - 1]; // eq. 67 kdblprm[i - 1] = fcon[i - 1] - kprime[i - 1]; // eq. 68 - mukpdwn[i - 1] = 1.0; // initialize denomonator of eq. 60 - kpdown[i - 1] = 1.0; // initialize denomonator of eq. 63 - kdpdown[i - 1] = 1.0; // initialize denomonator of eq. 65 + mukpdwn[i - 1] = 1.0; // initialize denominator of eq. 60 + kpdown[i - 1] = 1.0; // initialize denominator of eq. 63 + kdpdown[i - 1] = 1.0; // initialize denominator of eq. 65 } for (int i = 1; i <= NMix; ++i) { @@ -4552,18 +4410,18 @@ namespace Window { // numerator of equation 61 phimup = pow_2(1.0 + std::sqrt(fvis[i - 1] / fvis[j - 1]) * root_4(wmgasJ.wght / wmgasI.wght)); - // denomonator of eq. 61, 64 and 66 + // denominator of eq. 61, 64 and 66 downer = two_sqrt_2 * std::sqrt(1 + (wmgasI.wght / wmgasJ.wght)); // calculate the denominator of eq. 60 if (i != j) mukpdwn[i - 1] += phimup / downer * frct[j - 1] / frct[i - 1]; - // numerator of eq. 64; psiterm is the multiplied term in backets + // numerator of eq. 64; psiterm is the multiplied term in brackets psiup = pow_2(1.0 + std::sqrt(kprime[i - 1] / kprime[j - 1]) * root_4(wmgasI.wght / wmgasJ.wght)); psiterm = 1.0 + 2.41 * (wmgasI.wght - wmgasJ.wght) * (wmgasI.wght - 0.142 * wmgasJ.wght) / pow_2(wmgasI.wght + wmgasJ.wght); // using the common denominator, downer, calculate the denominator for eq. 63 if (i != j) kpdown[i - 1] += psiup * (psiterm / downer) * (frct[j - 1] / frct[i - 1]); // calculate the numerator of eq. 66 phikup = pow_2(1.0 + std::sqrt(kprime[i - 1] / kprime[j - 1]) * root_4(wmgasI.wght / wmgasJ.wght)); - // using the common denominator, downer, calculate the denomonator for eq. 65 + // using the common denominator, downer, calculate the denominator for eq. 65 if (i != j) kdpdown[i - 1] += (phikup / downer) * (frct[j - 1] / frct[i - 1]); } mumix += fvis[i - 1] / mukpdwn[i - 1]; // eq. 60 @@ -4591,7 +4449,7 @@ namespace Window { //****************************************************************************** - void WindowGasPropertiesAtTemp(EnergyPlusData &state, + void WindowGasPropertiesAtTemp(EnergyPlusData const &state, Real64 const tmean, // Temperature of gas in gap (K) int const IGap, // Gap number Real64 &dens, // Gap gas density at tmean (kg/m3) @@ -4660,7 +4518,7 @@ namespace Window { fvis(i) = wmgas.vis.c0 + wmgas.vis.c1 * tmean + wmgas.vis.c2 * tmean_2; fdens(i) = pres * wmgas.wght / (gaslaw * tmean); molmix += frct(i) * wmgas.wght; // eq. 56 - mukpdwn(i) = 1.0; // initialize denomonator of eq. 60 + mukpdwn(i) = 1.0; // initialize denominator of eq. 60 } for (int i = 1; i <= NMix; ++i) { @@ -4669,7 +4527,7 @@ namespace Window { auto const &wmgasJ = wm->gaps[IGap - 1].gases[j - 1]; // numerator of equation 61 phimup = pow_2(1.0 + std::sqrt(fvis(i) / fvis(j)) * root_4(wmgasJ.wght / wmgasI.wght)); - // denomonator of eq. 61, 64 and 66 + // denominator of eq. 61, 64 and 66 downer = two_sqrt_2 * std::sqrt(1 + (wmgasI.wght / wmgasJ.wght)); // calculate the denominator of eq. 60 if (i != j) mukpdwn(i) += phimup / downer * frct(j) / frct(i); @@ -4876,7 +4734,7 @@ namespace Window { asp = 1.524 / wm->gaps[IGap - 1].width; } - wm->tiltr = wm->tilt * Constant::DegToRadians; + wm->tiltr = wm->tilt * Constant::DegToRad; ra = gr * pr; //! fw if (ra > 2.0e6): error that outside range of Rayleigh number? @@ -5472,13 +5330,9 @@ namespace Window { } // InterpolateBetweenFourValues() //************************************************************************** - - void W5LsqFit(Array1S const IndepVar, // Independent variables - Array1S const DepVar, // Dependent variables - int const N, // Order of polynomial - int const N1, // First and last data points used - int const N2, - Array1S CoeffsCurve // Polynomial coeffients from fit + void W5LsqFit(std::array const &ivars, // Independent variables + std::array const &dvars, // Dependent variables + std::array &coeffs // Polynomial coefficients from fit ) { @@ -5495,65 +5349,61 @@ namespace Window { // form C1*X + C2*X**2 + C3*X**3 + ... +CN*X**N, where N <= 6. // Adapted from BLAST subroutine LSQFIT. - Array2D A(6, 6); // Least squares derivative matrix - Array1D B(6); // Least squares derivative vector - Array2D D(6, 16); // Powers of independent variable - Real64 ACON; // Intermediate variables - Real64 SUM; - int LP1; - int NM1; + std::array, maxPolyCoef> A; // Least squares derivative matrix + std::array B; // Least squares derivative vector + std::array, maxPolyCoef> D; // Powers of independent variable // Set up least squares matrix - for (int M = N1; M <= N2; ++M) { - D(1, M) = IndepVar(M); + for (int M = 0; M < numPhis; ++M) { + D[0][M] = ivars[M]; } - for (int i = 2; i <= N; ++i) { - for (int M = N1; M <= N2; ++M) { - D(i, M) = D(i - 1, M) * IndepVar(M); + for (int i = 1; i < maxPolyCoef; ++i) { + for (int M = 0; M < numPhis; ++M) { + D[i][M] = D[i - 1][M] * ivars[M]; } } - for (int i = 1; i <= N; ++i) { - SUM = 0.0; - for (int M = N1; M <= N2; ++M) { - SUM += DepVar(M) * D(i, M); + for (int i = 0; i < maxPolyCoef; ++i) { + Real64 SUM = 0.0; + for (int M = 0; M < numPhis; ++M) { + SUM += dvars[M] * D[i][M]; } - B(i) = SUM; - for (int j = 1; j <= N; ++j) { - SUM = 0.0; - for (int M = N1; M <= N2; ++M) { - SUM += D(i, M) * D(j, M); + B[i] = SUM; + for (int j = 0; j < maxPolyCoef; ++j) { + Real64 SUM2 = 0.0; + for (int M = 0; M < numPhis; ++M) { + SUM2 += D[i][M] * D[j][M]; } - A(j, i) = SUM; - A(i, j) = SUM; + A[j][i] = SUM2; + A[i][j] = SUM2; } } // Solve the simultaneous equations using Gauss elimination - NM1 = N - 1; - for (int K = 1; K <= NM1; ++K) { + int order1 = maxPolyCoef - 1; + for (int K = 0; K < order1; ++K) { int KP1 = K + 1; - for (int i = KP1; i <= N; ++i) { - ACON = A(K, i) / A(K, K); - B(i) -= B(K) * ACON; - for (int j = K; j <= N; ++j) { - A(j, i) -= A(j, K) * ACON; + for (int i = KP1; i < maxPolyCoef; ++i) { + Real64 ACON = A[K][i] / A[K][K]; + B[i] -= B[K] * ACON; + for (int j = K; j < maxPolyCoef; ++j) { + A[j][i] -= A[j][K] * ACON; } } } - // Perform back substituion - CoeffsCurve(N) = B(N) / A(N, N); - LP1 = N; - int L = N - 1; + // Perform back substitution + coeffs[maxPolyCoef - 1] = B[maxPolyCoef - 1] / A[maxPolyCoef - 1][maxPolyCoef - 1]; + int LP1 = maxPolyCoef - 1; + int L = maxPolyCoef - 2; - while (L > 0) { - SUM = 0.0; - for (int j = LP1; j <= N; ++j) { - SUM += A(j, L) * CoeffsCurve(j); + while (L >= 0) { + Real64 SUM = 0.0; + for (int j = LP1; j < maxPolyCoef; ++j) { + SUM += A[j][L] * coeffs[j]; } - CoeffsCurve(L) = (B(L) - SUM) / A(L, L); + coeffs[L] = (B[L] - SUM) / A[L][L]; LP1 = L; --L; } @@ -5637,7 +5487,7 @@ namespace Window { } } - // Perform back substituion + // Perform back substitution CoeffsCurve(N) = B(N) / A(N, N); LP1 = N; int L = N - 1; @@ -5655,7 +5505,7 @@ namespace Window { //*********************************************************************** - Real64 DiffuseAverage(Array1S const PropertyValue) // Property value at angles of incidence + Real64 DiffuseAverage(std::array const &props) // Property value at angles of incidence { // FUNCTION INFORMATION: @@ -5674,23 +5524,18 @@ namespace Window { // 2*PropertyValue(phi)*cos(phi)*sin(phi)*dphi (which is same as // PropertyValue(phi)*sin(2*phi)*dphi) - // Return value - Real64 DiffuseAverage; - // Locals // SUBROUTINE ARGUMENT DEFINITIONS: - // 0,10,20,...,80,90 degress + // 0,10,20,...,80,90 degrees - Real64 const DPhiR(10.0 * Constant::DegToRadians); // Half of 10-deg incidence angle increment (radians) + constexpr Real64 dPhiR = dPhiDeg * Constant::DegToRad; // Half of 10-deg incidence angle increment (radians) - DiffuseAverage = 0.0; - for (int IPhi = 1; IPhi <= 9; ++IPhi) { - DiffuseAverage += - 0.5 * DPhiR * (PropertyValue(IPhi) * std::sin(2.0 * (IPhi - 1) * DPhiR) + PropertyValue(IPhi + 1) * std::sin(2.0 * IPhi * DPhiR)); + Real64 avg = 0.0; + for (int iPhi = 0; iPhi < numPhis - 1; ++iPhi) { + avg += 0.5 * dPhiR * (props[iPhi] * std::sin(2.0 * iPhi * dPhiR) + props[iPhi + 1] * std::sin(2.0 * (iPhi + 1) * dPhiR)); } - if (DiffuseAverage < 0.0) DiffuseAverage = 0.0; - return DiffuseAverage; + return (avg < 0.0) ? 0.0 : avg; } // DiffuseAverage() //************************************************************************************* @@ -5759,7 +5604,7 @@ namespace Window { int TotLayers; // Total number of layers in unshaded construction // Real64 DivTempOut; // Outside surface divider temperature (K) Real64 FrameHeatGain; // Heat gain to zone from frame (W) - // Real64 FrameHeatTransfer; // Heat tansfer through frame (W) + // Real64 FrameHeatTransfer; // Heat transfer through frame (W) // Real64 ProjCorrWinHeatGain; // Inside projection correction to IR from divider to zone // for window heat gain calculation Real64 DividerHeatGain; // Heat gain to zone from divider (W) @@ -5984,9 +5829,6 @@ namespace Window { // rather than at the outer face of the layer. The resistances changed by one half the glazing layer, or 0.5/scon(n). // (CR 7682 also changed WindowTempsForNominalCond to include absorbed solar, a bigger change) - // Using/Aliasing - using General::POLYF; - // Locals // SUBROUTINE ARGUMENT DEFINITIONS: // normal incidence beam solar radiation @@ -6427,7 +6269,7 @@ namespace Window { } } - // Need to add variables writing here since this routine will override previously calcualted values from WinCalc-Engine + // Need to add variables writing here since this routine will override previously calculated values from WinCalc-Engine if (wm->inExtWindowModel->isExternalLibraryModel()) { TSolNorm = GetSolarTransDirectHemispherical(state, ConstrNum); TVisNorm = GetVisibleTransDirectHemispherical(state, ConstrNum); @@ -6514,7 +6356,7 @@ namespace Window { void WindowTempsForNominalCond(EnergyPlusData &state, int const ConstrNum, // Construction number Array1A hgap, // Gap gas conductive conductance (W/m2-K) - Real64 const adjRatio // adjusment Ratio to hcin + Real64 const adjRatio // adjustment Ratio to hcin ) { @@ -6538,7 +6380,7 @@ namespace Window { // This is a shortened form of SolveForWindowTemperatures tailored // for calculation of the nominal center-of-glass U-value for a window // construction at ASHRAE winter conditions and for determining conditions at - // summer conditions for calculationg SHGC. + // summer conditions for calculating SHGC. // Evaluates the coefficients Aface and Bface in the system of linear // algebraic equations // Sum [Aface(i,j)*thetas(j)] = Bface(i), i = 1,nglface @@ -6552,8 +6394,6 @@ namespace Window { // heat balance at the glass faces. The system of linear equations is solved // by LU decomposition. - using Psychrometrics::PsyRhoAirFnPbTdbW; - // Argument array dimensioning hgap.dim(5); @@ -6596,7 +6436,7 @@ namespace Window { TiltDeg = 90.0; - sineTilt = std::sin(TiltDeg * Constant::DegToRadians); // degrees as arg + sineTilt = std::sin(TiltDeg * Constant::DegToRad); // degrees as arg while (iter < MaxIterations && errtemp > errtemptol) { for (int i = 1; i <= wm->nglface; ++i) { @@ -6618,7 +6458,7 @@ namespace Window { TmeanFilmKelvin = wm->tin + 0.25 * (wm->thetas[wm->nglface - 1] - wm->tin); // eq. 133 in ISO 15099 TmeanFilm = TmeanFilmKelvin - 273.15; // the following properties are constants or linear relations for "standard" type reporting - rho = PsyRhoAirFnPbTdbW(state, 101325.0, TmeanFilm, 0.0, RoutineName); // dry air assumption + rho = Psychrometrics::PsyRhoAirFnPbTdbW(state, 101325.0, TmeanFilm, 0.0, RoutineName); // dry air assumption g = 9.81; Height = 1.0; // standard window rating practice is to use 1 meter (rather than actual) @@ -6673,20 +6513,18 @@ namespace Window { // SUBROUTINE INFORMATION: // AUTHOR F. Winkelmann // DATE WRITTEN September 2000 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Initializes face temperature distribution prior to iteration. // This is a shortened form of StartingWindowTemps for use in calculating // the nominal center-of-glass U-value. - Real64 constexpr hrad(5.3); // Typical radiative conductance (W/m2-K) - Real64 constexpr hcinStartValue(3.2); // Starting value for inside air film convective + Real64 constexpr hrad = 5.3; // Typical radiative conductance (W/m2-K) + Real64 constexpr hcinStartValue = 3.2; // Starting value for inside air film convective // conductance (estimated for typical double glazing // using 1.31(dT**0.333), where dT = // room air temp - inside surface temp = 14.2K) - Real64 constexpr resgap(0.21); // Typical gap resistance (m2-K/W) + Real64 constexpr resgap = 0.21; // Typical gap resistance (m2-K/W) Array1D rguess(11); // Combined radiative/convective resistance (m2-K/W) of // inside or outside air film, or gap @@ -6728,21 +6566,13 @@ namespace Window { // SUBROUTINE INFORMATION: // AUTHOR Linda K. Lawrie // DATE WRITTEN March 2000 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // This routine gives a detailed report to the user about // the calculation parameters for windows and their associated // materials. - using General::POLYF; - - using General::ScanForReports; - using WindowComplexManager::CalcComplexWindowThermal; - using WindowComplexManager::UpdateComplexWindows; - - Real64 TempVar(0.0); // just temporary usage for complex fenestration + Real64 TempVar = 0.0; // just temporary usage for complex fenestration Real64 NominalConductanceWinter; // Nominal center-of-glass conductance of a window construction // for ASHRAE winter conditions (W/m2-K): @@ -6765,7 +6595,7 @@ namespace Window { auto &wm = state.dataWindowManager; - ScanForReports(state, "Constructions", wm->DoReport, "Constructions"); + General::ScanForReports(state, "Constructions", wm->DoReport, "Constructions"); if (std::any_of(state.dataConstruction->Construct.begin(), state.dataConstruction->Construct.end(), @@ -6881,8 +6711,10 @@ namespace Window { if (construct.WindowTypeBSDF) { int i = ThisNum; - CalcComplexWindowThermal(state, 0, i, TempVar, TempVar, TempVar, TempVar, DataBSDFWindow::Condition::Winter); - CalcComplexWindowThermal(state, 0, i, TempVar, TempVar, TempVar, TempVar, DataBSDFWindow::Condition::Summer); + WindowComplexManager::CalcComplexWindowThermal( + state, 0, i, TempVar, TempVar, TempVar, TempVar, DataBSDFWindow::Condition::Winter); + WindowComplexManager::CalcComplexWindowThermal( + state, 0, i, TempVar, TempVar, TempVar, TempVar, DataBSDFWindow::Condition::Summer); static constexpr std::string_view Format_800(" WindowConstruction:Complex,{},{},{},{:.3R},{:.3R}\n"); print(state.files.eio, @@ -6980,7 +6812,7 @@ namespace Window { auto const *matShade = dynamic_cast(mat); assert(matShade != nullptr); - static constexpr std::string_view Format_703(" WindowMaterial:Shade,,{},{:.3R},{:.3R},{:.3R},{:.3R},{:.3R},{:.3R}\n"); + static constexpr std::string_view Format_703(" WindowMaterial:Shade,{},{:.3R},{:.3R},{:.3R},{:.3R},{:.3R},{:.3R}\n"); print(state.files.eio, Format_703, matShade->Name, @@ -7241,7 +7073,6 @@ namespace Window { // DATE WRITTEN July-Aug 1995 // MODIFIED Aug 2001 (FCW): adapt to EnergyPlus // Dec 2001 (FCW): add variable slat angle - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculates solar-optical properties of a window blind @@ -7256,7 +7087,7 @@ namespace Window { // In the time-step calculation,the blind properties vs. profile angle and slat angle // that are calculated here will be applicable to windows and slats - // of arbitrary orientation, and to arbitrary sun positions, as long as the appropiate + // of arbitrary orientation, and to arbitrary sun positions, as long as the appropriate // profile angle is used. The slat angle for a particular window with blinds is determined // each time step in subroutine WindowShadingManager on the basis of user-specified // slat control options. @@ -7439,8 +7270,6 @@ namespace Window { // SUBROUTINE INFORMATION: // AUTHOR Richard Raustad // DATE WRITTEN April 2006 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Initialize static properties of window screens. @@ -7451,10 +7280,9 @@ namespace Window { // Locals // SUBROUTINE PARAMETER DEFINITIONS: - int constexpr M(18); - int constexpr N(18); + int constexpr M = 18; + int constexpr N = 18; - int ScreenNum; // Index to each screen used on exterior of window int ConstrNumSh; // Index to shaded construction int MatNum; // Index to material number Real64 SumTrans; // Integration variable for transmittance @@ -7463,9 +7291,6 @@ namespace Window { Real64 SumReflectVis; // Integration variable for visible reflectance Real64 SumArea; // Integration variable for area of quarter hemisphere // is used on multiple surfaces - bool PrintTransMap; // Flag used to print transmittance map - - ScreenNum = 0; // Pre-calculate these constants std::vector sunAzimuth; @@ -7485,14 +7310,14 @@ namespace Window { relativeAltitude.allocate(N, M); for (int j = 0; j <= N - 1; ++j) { - Real64 currAzimuth = (90.0 / N) * j * Constant::DegToRadians; + Real64 currAzimuth = (90.0 / N) * j * Constant::DegToRad; sunAzimuth.push_back(currAzimuth); // Azimuth angle of sun during integration sin_sunAzimuth.push_back(std::sin(currAzimuth)); cos_sunAzimuth.push_back(std::cos(currAzimuth)); } for (int i = 0; i <= M - 1; ++i) { - Real64 currAltitude = (90.0 / M) * i * Constant::DegToRadians; + Real64 currAltitude = (90.0 / M) * i * Constant::DegToRad; sunAltitude.push_back(currAltitude); // Altitude angle of sun during integration sin_sunAltitude.push_back(std::sin(currAltitude)); cos_sunAltitude.push_back(std::cos(currAltitude)); @@ -7507,7 +7332,7 @@ namespace Window { } } - PrintTransMap = false; + bool PrintTransMap = false; // Flag used to print transmittance map for (int SurfNum = 1; SurfNum <= s_surf->TotSurfaces; ++SurfNum) { auto const &surf = s_surf->Surface(SurfNum); @@ -7522,7 +7347,7 @@ namespace Window { assert(matScreen != nullptr); s_surf->SurfaceWindow(SurfNum).screenNum = MatNum; - if (matScreen->isUsed) continue; // Has already been initalized + if (matScreen->isUsed) continue; // Has already been initialized matScreen->isUsed = true; if (matScreen->mapDegResolution > 0) PrintTransMap = true; @@ -7700,15 +7525,11 @@ namespace Window { // This change was made to resolve discrepancies between EnergyPlus results // and blind transmittance measurements made at Oklahoma State Univ. // Feb 2004 (FCW): modify slat edge correction calc to avoid possible divide by zero - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // From the slat properties, calculates the diffuse solar, diffuse visible and IR // transmission and reflection properties of a window blind. - // METHODOLOGY EMPLOYED: - // na - // REFERENCES: // "Solar-Thermal Window Blind Model for DOE-2," H. Simmler, U. Fischer and // F. Winkelmann, Lawrence Berkeley National Laboratory, Jan. 1996. @@ -7717,17 +7538,8 @@ namespace Window { c.dim(15); p.dim(16); - Real64 ri; // Front and back IR slat reflectance - Real64 rib; - Real64 phib; // Elevation of slat normal vector (radians) - Real64 phis; // Source elevation (radians) - Real64 delphis; // Angle increment for integration over source distribution (radians) - Array1D fEdgeSource(10); // Slat edge correction factor vs source elevation - Array1D fEdgeA(2); // Average slat edge correction factor for upper and lower quadrants + Array1D fEdgeA(2); // Average slat edge correction factor for upper and lower quadrants // seen by window blind - Real64 gamma; // phib - phis - Real64 fEdge; // Slat edge correction factor - Real64 fEdge1; Array1D j(6); // Slat section radiosity vector Array1D G(6); // Slat section irradiance vector Array1D Q(6); // Slat section radiance vector @@ -7735,8 +7547,6 @@ namespace Window { Array2D X(4, 4); // Exchange matrix Array2D Xinv(4, 4); // Inverse of exchange matrix Array1D_int indx(4); // LU decomposition indices - Real64 BlindIRreflFront; // Blind front IR reflectance - Real64 BlindIRreflBack; // Blind back IR reflectance // The slat input properties are: // c(1) 0. (unused) @@ -7820,7 +7630,6 @@ namespace Window { } // Irradiances - for (int k = 1; k <= 6; ++k) { G(k) = 0.0; for (int m = 1; m <= 6; ++m) { @@ -7830,27 +7639,32 @@ namespace Window { } // Slat edge correction factor - phib = b_el; - delphis = Constant::PiOvr2 / 10.0; + std::array fEdgeSource; // Slat edge correction factor vs source elevation + + Real64 const phib = b_el; // Elevation of slat normal vector (radians) + Real64 constexpr delphis = + Constant::PiOvr2 / + 10.0; // Angle increment for integration over source distribution (radians) // This is a bug, the delta is 10.0, PiOvr2/10.0 is 9.0. + for (int IUpDown = 1; IUpDown <= 2; ++IUpDown) { - for (int Iphis = 1; Iphis <= 10; ++Iphis) { - phis = -(Iphis - 0.5) * delphis; - if (IUpDown == 2) phis = (Iphis - 0.5) * delphis; - fEdgeSource(Iphis) = 0.0; - fEdge1 = 0.0; - gamma = phib - phis; + for (int iPhi = 0; iPhi < numPhis; ++iPhi) { + Real64 phis = -((double)iPhi + 0.5) * delphis; // Source elevation (radians) + if (IUpDown == 2) phis = ((double)iPhi + 0.5) * delphis; + fEdgeSource[iPhi] = 0.0; + Real64 fEdge1 = 0.0; + Real64 gamma = phib - phis; if (std::abs(std::sin(gamma)) > 0.01) { if ((phib > 0.0 && phib <= Constant::PiOvr2 && phis <= phib) || (phib > Constant::PiOvr2 && phib <= Constant::Pi && phis > -(Constant::Pi - phib))) { fEdge1 = matBlind->SlatThickness * std::abs(std::sin(gamma)) / ((matBlind->SlatSeparation + matBlind->SlatThickness / std::abs(std::sin(phib))) * std::cos(phis)); } - fEdgeSource(Iphis) = min(1.0, std::abs(fEdge1)); + fEdgeSource[iPhi] = min(1.0, std::abs(fEdge1)); } } fEdgeA(IUpDown) = DiffuseAverage(fEdgeSource); } - fEdge = 0.5 * (fEdgeA(1) + fEdgeA(2)); + Real64 fEdge = 0.5 * (fEdgeA(1) + fEdgeA(2)); // Slat edge correction factor // Front diffuse-diffuse transmittance (transmittance of slat edge assumed zero) p(9) = G(2) * (1.0 - fEdge); @@ -7901,8 +7715,8 @@ namespace Window { // (use same set of view factors as for diffuse short-wave properties) // Front and back slat IR reflectances - ri = 1 - c(13) - c(14); - rib = 1 - c(13) - c(15); + Real64 ri = 1 - c(13) - c(14); // Front and back IR slat reflectance + Real64 rib = 1 - c(13) - c(15); // Set up exchange matrix X for diffuse properties @@ -7954,7 +7768,7 @@ namespace Window { // Front diffuse-diffuse IR reflectance (edge of slat is assumed to have same IR // reflectance as front side of slat, ri) - BlindIRreflFront = G(1) * (1.0 - fEdge) + fEdge * ri; + Real64 BlindIRreflFront = G(1) * (1.0 - fEdge) + fEdge * ri; // Blind front IR reflectance // Front IR emissivity p(14) = max(0.0001, 1.0 - p(13) - BlindIRreflFront); @@ -7990,7 +7804,7 @@ namespace Window { } // Back diffuse-diffuse IR reflectance - BlindIRreflBack = G(2) * (1.0 - fEdge) + fEdge * ri; + Real64 BlindIRreflBack = G(2) * (1.0 - fEdge) + fEdge * ri; // Blind back IR reflectance // Back IR emissivity p(15) = max(0.0001, 1.0 - p(13) - BlindIRreflBack); @@ -8019,7 +7833,6 @@ namespace Window { // G(i) = Sum over j of J(j)*F(i,j), which is wrong. // This change was made to resolve discrepancies between EnergyPlus results // and blind transmittance measurements made at Oklahoma State Univ. - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculates the beam radiation properties of a @@ -8249,7 +8062,6 @@ namespace Window { // DATE WRITTEN July-Aug 1995 // MODIFIED Aug 2001 (FCW): adapt to EnergyPlus // Apr 2002 (FCW): prevent sqrt of small negative argument - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Calculates the view factors between sections of adjacent slats, @@ -8270,39 +8082,24 @@ namespace Window { F.dim(6, 6); Array1D L(6); // Length of slat sections: L1 = L2 = h; L3, L5 = length - Real64 L3; - Real64 L5; - // of upper slat sections; L4, L6 = length of lower slat - // slat sections (m) - Real64 d1; // Slat geometry variables (m) - Real64 d2; - Real64 d3; - Real64 d4; - Real64 d5; - Real64 d6; - Real64 h2; // h**2 - Real64 ht; // 2*h - Real64 w; // Slat geometry variable (m) - Real64 a; // Intermediate variable (m) - Real64 co; // Cosine of source profile angle - - h2 = pow_2(h); - ht = 2.0 * h; - co = std::cos(phis); + + Real64 h2 = pow_2(h); + Real64 ht = 2.0 * h; + Real64 co = std::cos(phis); // Cosine of source profile angle if (std::abs(co) < 0.001) co = 0.0; - w = ht; + Real64 w = ht; // Slat geometry variable (m) if (co != 0.0) w = s * std::cos(phib - phis) / co; - L3 = s * h / std::abs(w); + Real64 L3 = s * h / std::abs(w); if (L3 > s) L3 = s; - L5 = s - L3; - a = ht * std::cos(phib); + Real64 L5 = s - L3; + Real64 a = ht * std::cos(phib); // Intermediate variable (m) // MAX(0.,...) in the following prevents small negative argument for sqrt - d1 = std::sqrt(max(0.0, s * s + h2 + a * s)); - d2 = std::sqrt(max(0.0, s * s + h2 - a * s)); - d3 = std::sqrt(max(0.0, L3 * L3 + h2 + a * L3)); - d4 = std::sqrt(max(0.0, L3 * L3 + h2 - a * L3)); - d5 = std::sqrt(max(0.0, L5 * L5 + h2 - a * L5)); - d6 = std::sqrt(max(0.0, L5 * L5 + h2 + a * L5)); + Real64 d1 = std::sqrt(max(0.0, s * s + h2 + a * s)); // Slat geometry variables (m) + Real64 d2 = std::sqrt(max(0.0, s * s + h2 - a * s)); + Real64 d3 = std::sqrt(max(0.0, L3 * L3 + h2 + a * L3)); + Real64 d4 = std::sqrt(max(0.0, L3 * L3 + h2 - a * L3)); + Real64 d5 = std::sqrt(max(0.0, L5 * L5 + h2 - a * L5)); + Real64 d6 = std::sqrt(max(0.0, L5 * L5 + h2 + a * L5)); for (int i = 1; i <= 6; ++i) { F(i, i) = 0.0; } @@ -8326,7 +8123,7 @@ namespace Window { L(1) = h; L(2) = h; L(3) = L3; - L(4) = L3; + L(4) = L3; // L4, L6 = length of lower slat L(5) = L5; L(6) = L5; for (int i = 2; i <= 6; ++i) { @@ -8350,7 +8147,6 @@ namespace Window { // AUTHOR Hans Simmler // DATE WRITTEN July-Aug 1995 // MODIFIED Aug 2001 (FCW): adapt to EnergyPlus - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Inverts a matrix. @@ -8387,8 +8183,6 @@ namespace Window { // SUBROUTINE INFORMATION: // AUTHOR T. Hong // DATE WRITTEN August 2013 - // MODIFIED - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Check, read, and assign the custom solar or visible spectrum to: @@ -8409,16 +8203,13 @@ namespace Window { Array1D_string cAlphaArgs; // Alpha input items for object Array1D rNumericArgs; // Numeric input items for object - std::string cCurrentModuleObject; - int NumSiteSpectrum(0); - auto const &wm = state.dataWindowManager; if (wm->RunMeOnceFlag) return; // Step 1 - check whether there is custom solar or visible spectrum - cCurrentModuleObject = "Site:SolarAndVisibleSpectrum"; - NumSiteSpectrum = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + std::string cCurrentModuleObject = "Site:SolarAndVisibleSpectrum"; + int NumSiteSpectrum = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); // no custom spectrum data, done! if (NumSiteSpectrum == 0) { diff --git a/src/EnergyPlus/WindowManager.hh b/src/EnergyPlus/WindowManager.hh index e1560589a29..1dd0dd478ff 100644 --- a/src/EnergyPlus/WindowManager.hh +++ b/src/EnergyPlus/WindowManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -52,12 +52,11 @@ #include #include #include -#include // EnergyPlus Headers #include #include -#include +#include #include #include #include @@ -75,9 +74,25 @@ namespace Window { int constexpr maxGlassLayers = 5; int constexpr maxGapLayers = 5; - int constexpr maxIncidentAngles = 20; int constexpr maxSpectralDataElements = 800; // Maximum number in Spectral Data arrays. + int constexpr numPhis = 10; + Real64 constexpr dPhiDeg = 10.0; + Real64 constexpr dPhiRad = dPhiDeg * Constant::DegToRad; + + constexpr std::array cosPhis = {1.0, + 0.98480775301220802, + 0.93969262078590842, + 0.86602540378443871, + 0.76604444311897812, + 0.64278760968653936, + 0.50000000000000011, + 0.34202014332566882, + 0.17364817766693041, + 0.0}; // 6.123233995736766E-17 + + constexpr int maxPolyCoef = 6; + class CWindowModel; class CWindowOpticalModel; class CWindowConstructionsSimplified; @@ -115,9 +130,9 @@ namespace Window { Array1A aft // System absorptance of each glass layer ); - Real64 solarSpectrumAverage(EnergyPlusData &state, gsl::span p); + Real64 solarSpectrumAverage(EnergyPlusData const &state, gsl::span p); - Real64 visibleSpectrumAverage(EnergyPlusData &state, gsl::span p); + Real64 visibleSpectrumAverage(EnergyPlusData const &state, gsl::span p); Real64 Interpolate(gsl::span x, // Array of data points for independent variable gsl::span y, // Array of data points for dependent variable @@ -139,10 +154,6 @@ namespace Window { Real64 &SurfOutsideTemp // Outside surface temperature (C) ); -#ifdef GET_OUT - void WindowHeatBalanceEquations(EnergyPlusData &state, int SurfNum); // Surface number -#endif // GET_OUT - void GetHeatBalanceEqCoefMatrixSimple(EnergyPlusData &state, int nglasslayer, // Number of glass layers Array1D const &hr, // Radiative conductance (W/m2-K) @@ -229,6 +240,26 @@ namespace Window { Array1D &b // Matrix and vector in a.x = b; ); + constexpr Real64 POLYF(Real64 const X, // Cosine of angle of incidence + std::array const &A // Polynomial coefficients + ) + { + return (X < 0.0 || X > 1.0) ? 0.0 : (X * (A[0] + X * (A[1] + X * (A[2] + X * (A[3] + X * (A[4] + X * A[5])))))); + } + +#ifdef GET_OUT + constexpr Real64 POLYF(Real64 const X, // Cosine of angle of incidence + Array1D const &A // Polynomial coefficients + ) + { + if (X < 0.0 || X > 1.0) { + return 0.0; + } else { + return X * (A(1) + X * (A(2) + X * (A(3) + X * (A(4) + X * (A(5) + X * A(6)))))); + } + } +#endif // GET_OUT + void WindowGasConductance(EnergyPlusData &state, Real64 tleft, // Temperature of gap surface closest to outside (K) Real64 tright, // Temperature of gap surface closest to zone (K) @@ -238,7 +269,7 @@ namespace Window { Real64 &gr // Gap gas Grashof number ); - void WindowGasPropertiesAtTemp(EnergyPlusData &state, + void WindowGasPropertiesAtTemp(EnergyPlusData const &state, Real64 tmean, // Temperature of gas in gap (K) int IGap, // Gap number Real64 &dens, // Gap gas density at tmean (kg/m3) @@ -277,27 +308,12 @@ namespace Window { Real64 InterpolateBetweenFourValues( Real64 X, Real64 Y, Real64 X1, Real64 X2, Real64 Y1, Real64 Y2, Real64 Fx1y1, Real64 Fx1y2, Real64 Fx2y1, Real64 Fx2y2); - void W5LsqFit(Array1S IndepVar, // Independent variables - Array1S DepVar, // Dependent variables - int N, // Order of polynomial - int N1, // First and last data points used - int N2, - Array1S CoeffsCurve // Polynomial coeffients from fit - ); - - void W5LsqFit2(Array1A IndepVar, // Independent variables - Array1A DepVar, // Dependent variables - int N, // Order of polynomial - int N1, // First and last data points used - int N2, - Array1A CoeffsCurve // Polynomial coeffients from fit + void W5LsqFit(std::array const &ivars, // Independent variables + std::array const &dvars, // Dependent variables + std::array &coeffs // Polynomial coeffients from fit ); - Real64 DiffuseAverage(Array1S PropertyValue); // Property value at angles of incidence - - Real64 DiffuseAverageProfAngGnd(Array1S Property); // Property value vs. profile angle - - Real64 DiffuseAverageProfAngSky(Array1S Property); // Property value vs. profile angle + Real64 DiffuseAverage(std::array const &props); // Property value at angles of incidence void CalcWinFrameAndDividerTemps(EnergyPlusData &state, int SurfNum, // Surface number @@ -480,9 +496,6 @@ struct WindowManagerData : BaseGlobalStruct 0.0}; // Solar radiation and IR radiation from internal gains absorbed by glass face std::array thetas = {0.0}; // Glass surface temperatures (K) std::array thetasPrev = {0.0}; // Previous-iteration glass surface temperatures (K) -#ifdef GET_OUT - std::array fvec = {0.0}; // Glass face heat balance function -#endif // GET_OUT std::array hrgap = {0.0}; // Radiative gap conductance @@ -525,6 +538,10 @@ struct WindowManagerData : BaseGlobalStruct std::array LayerNum = {0}; // Glass layer number + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } @@ -553,9 +570,6 @@ struct WindowManagerData : BaseGlobalStruct this->AbsRadGlassFace = {0.0}; this->thetas = {0.0}; this->thetasPrev = {0.0}; -#ifdef GET_OUT - this->fvec = {0.0}; -#endif // GET_OUT this->hrgap = {0.0}; this->A23P = 0.0; this->A32P = 0.0; diff --git a/src/EnergyPlus/WindowManagerExteriorData.cc b/src/EnergyPlus/WindowManagerExteriorData.cc index b40bd35e9e8..c33f4fe48ce 100644 --- a/src/EnergyPlus/WindowManagerExteriorData.cc +++ b/src/EnergyPlus/WindowManagerExteriorData.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -82,8 +82,8 @@ namespace Window { Real64 Phi = 0; // get window tilt and azimuth - Real64 Gamma = Constant::DegToRadians * state.dataSurface->Surface(t_SurfNum).Tilt; - Real64 Alpha = Constant::DegToRadians * state.dataSurface->Surface(t_SurfNum).Azimuth; + Real64 Gamma = Constant::DegToRad * state.dataSurface->Surface(t_SurfNum).Tilt; + Real64 Alpha = Constant::DegToRad * state.dataSurface->Surface(t_SurfNum).Azimuth; RayIdentificationType RadType = RayIdentificationType::Front_Incident; diff --git a/src/EnergyPlus/WindowManagerExteriorData.hh b/src/EnergyPlus/WindowManagerExteriorData.hh index 33bef56946f..7cbd15ec633 100644 --- a/src/EnergyPlus/WindowManagerExteriorData.hh +++ b/src/EnergyPlus/WindowManagerExteriorData.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -166,6 +166,10 @@ struct WindowManagerExteriorData : BaseGlobalStruct { std::unique_ptr p_inst; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/WindowManagerExteriorOptical.cc b/src/EnergyPlus/WindowManagerExteriorOptical.cc index 08aad20aa49..accda076cf9 100644 --- a/src/EnergyPlus/WindowManagerExteriorOptical.cc +++ b/src/EnergyPlus/WindowManagerExteriorOptical.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/WindowManagerExteriorOptical.hh b/src/EnergyPlus/WindowManagerExteriorOptical.hh index bbb3e0c0de2..2660089e9a3 100644 --- a/src/EnergyPlus/WindowManagerExteriorOptical.hh +++ b/src/EnergyPlus/WindowManagerExteriorOptical.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/WindowManagerExteriorThermal.cc b/src/EnergyPlus/WindowManagerExteriorThermal.cc index d4b1883ff26..035f5fd129c 100644 --- a/src/EnergyPlus/WindowManagerExteriorThermal.cc +++ b/src/EnergyPlus/WindowManagerExteriorThermal.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -551,7 +551,7 @@ namespace Window { conductivity = matGlass->Conductivity; } else if (mat->group == Material::Group::Blind) { - auto const &surfShade = state.dataSurface->surfShades(m_SurfNum); + // auto const &surfShade = state.dataSurface->surfShades(m_SurfNum); auto const *matBlind = dynamic_cast(mat); assert(matBlind != nullptr); thickness = matBlind->SlatThickness; @@ -606,7 +606,7 @@ namespace Window { assert(matScreen != nullptr); // Simon: Existing code already takes into account geometry of Woven and scales down - // emissivity for openning area. + // emissivity for opening area. emissFront = matScreen->AbsorpThermal; emissBack = matScreen->AbsorpThermal; transThermalFront = matScreen->TransThermal; diff --git a/src/EnergyPlus/WindowManagerExteriorThermal.hh b/src/EnergyPlus/WindowManagerExteriorThermal.hh index 00f19bdefe4..96195c7249b 100644 --- a/src/EnergyPlus/WindowManagerExteriorThermal.hh +++ b/src/EnergyPlus/WindowManagerExteriorThermal.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/WindowModel.cc b/src/EnergyPlus/WindowModel.cc index 48b277f535e..4247841afd6 100644 --- a/src/EnergyPlus/WindowModel.cc +++ b/src/EnergyPlus/WindowModel.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/WindowModel.hh b/src/EnergyPlus/WindowModel.hh index d5a8bd8a3a3..9f9beb8e76d 100644 --- a/src/EnergyPlus/WindowModel.hh +++ b/src/EnergyPlus/WindowModel.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/ZoneAirLoopEquipmentManager.cc b/src/EnergyPlus/ZoneAirLoopEquipmentManager.cc index 92af6665c4b..42be43d8e4c 100644 --- a/src/EnergyPlus/ZoneAirLoopEquipmentManager.cc +++ b/src/EnergyPlus/ZoneAirLoopEquipmentManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -47,7 +47,6 @@ // ObjexxFCL Headers #include -#include // EnergyPlus Headers #include diff --git a/src/EnergyPlus/ZoneAirLoopEquipmentManager.hh b/src/EnergyPlus/ZoneAirLoopEquipmentManager.hh index fdedd91da9d..89d27939d22 100644 --- a/src/EnergyPlus/ZoneAirLoopEquipmentManager.hh +++ b/src/EnergyPlus/ZoneAirLoopEquipmentManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -93,6 +93,10 @@ struct ZoneAirLoopEquipmentManagerData : BaseGlobalStruct bool InitAirDistUnitsFlag = true; // If TRUE, not all Air Distribution Units have been initialized int numADUInitialized = 0; // Count of ADUs that have been initialized + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ZoneContaminantPredictorCorrector.cc b/src/EnergyPlus/ZoneContaminantPredictorCorrector.cc index ad19296411e..a69a91faaf8 100644 --- a/src/EnergyPlus/ZoneContaminantPredictorCorrector.cc +++ b/src/EnergyPlus/ZoneContaminantPredictorCorrector.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -51,7 +51,6 @@ // ObjexxFCL Headers #include #include -#include // EnergyPlus Headers #include @@ -163,12 +162,11 @@ void GetZoneContaminanInputs(EnergyPlusData &state) // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetSourcesAndSinks: "); + static constexpr std::string_view routineName = "GetSourcesAndSinks"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Array1D_string AlphaName; Array1D IHGNumbers; - Real64 SchMin; - Real64 SchMax; int IOStat; int Loop; int ZonePtr; @@ -234,12 +232,16 @@ void GetZoneContaminanInputs(EnergyPlusData &state) state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, AlphaName(1)}; + Util::IsNameEmpty(state, AlphaName(1), CurrentModuleObject, ErrorsFound); - state.dataContaminantBalance->ZoneContamGenericConstant(Loop).Name = AlphaName(1); - state.dataContaminantBalance->ZoneContamGenericConstant(Loop).ZoneName = AlphaName(2); - state.dataContaminantBalance->ZoneContamGenericConstant(Loop).ActualZoneNum = Util::FindItemInList(AlphaName(2), state.dataHeatBal->Zone); - if (state.dataContaminantBalance->ZoneContamGenericConstant(Loop).ActualZoneNum == 0) { + auto &contam = state.dataContaminantBalance->ZoneContamGenericConstant(Loop); + contam.Name = AlphaName(1); + contam.ZoneName = AlphaName(2); + contam.ActualZoneNum = Util::FindItemInList(AlphaName(2), state.dataHeatBal->Zone); + if (contam.ActualZoneNum == 0) { ShowSevereError(state, format("{}{}=\"{}\", invalid {} entered={}", RoutineName, @@ -250,112 +252,44 @@ void GetZoneContaminanInputs(EnergyPlusData &state) ErrorsFound = true; } - state.dataContaminantBalance->ZoneContamGenericConstant(Loop).GCGenerateRateSchedPtr = ScheduleManager::GetScheduleIndex(state, AlphaName(3)); - if (state.dataContaminantBalance->ZoneContamGenericConstant(Loop).GCGenerateRateSchedPtr == 0) { - if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", {} is required.", RoutineName, CurrentModuleObject, AlphaName(1), state.dataIPShortCut->cAlphaFieldNames(3))); - } else { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered={}", - RoutineName, - CurrentModuleObject, - AlphaName(1), - state.dataIPShortCut->cAlphaFieldNames(3), - AlphaName(3))); - } + if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3)); + ErrorsFound = true; + } else if ((contam.generateRateSched = Sched::GetSchedule(state, AlphaName(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), AlphaName(3)); + ErrorsFound = true; + } else if (!contam.generateRateSched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), AlphaName(3), Clusive::In, 0.0); ErrorsFound = true; - } else { // check min/max on schedule - SchMin = - ScheduleManager::GetScheduleMinValue(state, state.dataContaminantBalance->ZoneContamGenericConstant(Loop).GCGenerateRateSchedPtr); - SchMax = - ScheduleManager::GetScheduleMaxValue(state, state.dataContaminantBalance->ZoneContamGenericConstant(Loop).GCGenerateRateSchedPtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (SchMin < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, minimum is < 0.0", - RoutineName, - CurrentModuleObject, - AlphaName(1), - state.dataIPShortCut->cAlphaFieldNames(3))); - ShowContinueError(state, format("Schedule=\"{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", AlphaName(3), SchMin)); - ErrorsFound = true; - } - if (SchMax < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, maximum is < 0.0", - RoutineName, - CurrentModuleObject, - AlphaName(1), - state.dataIPShortCut->cAlphaFieldNames(3))); - ShowContinueError(state, format("Schedule=\"{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", AlphaName(3), SchMax)); - ErrorsFound = true; - } - } } - state.dataContaminantBalance->ZoneContamGenericConstant(Loop).GCGenerateRate = IHGNumbers(1); - state.dataContaminantBalance->ZoneContamGenericConstant(Loop).GCRemovalCoef = IHGNumbers(2); + contam.GenerateRate = IHGNumbers(1); + contam.RemovalCoef = IHGNumbers(2); - state.dataContaminantBalance->ZoneContamGenericConstant(Loop).GCRemovalCoefSchedPtr = ScheduleManager::GetScheduleIndex(state, AlphaName(4)); - if (state.dataContaminantBalance->ZoneContamGenericConstant(Loop).GCRemovalCoefSchedPtr == 0) { - if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", {} is required.", RoutineName, CurrentModuleObject, AlphaName(1), state.dataIPShortCut->cAlphaFieldNames(4))); - } else { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered={}", - RoutineName, - CurrentModuleObject, - AlphaName(1), - state.dataIPShortCut->cAlphaFieldNames(4), - AlphaName(4))); - } + if (state.dataIPShortCut->lAlphaFieldBlanks(4)) { + ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(4)); + ErrorsFound = true; + } else if ((contam.removalCoefSched = Sched::GetSchedule(state, AlphaName(4))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(4), AlphaName(4)); + ErrorsFound = true; + } else if (!contam.removalCoefSched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), AlphaName(3), Clusive::In, 0.0); ErrorsFound = true; - } else { // check min/max on schedule - SchMin = ScheduleManager::GetScheduleMinValue(state, state.dataContaminantBalance->ZoneContamGenericConstant(Loop).GCRemovalCoefSchedPtr); - SchMax = ScheduleManager::GetScheduleMaxValue(state, state.dataContaminantBalance->ZoneContamGenericConstant(Loop).GCRemovalCoefSchedPtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (SchMin < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, minimum is < 0.0", - RoutineName, - CurrentModuleObject, - AlphaName(1), - state.dataIPShortCut->cAlphaFieldNames(4))); - ShowContinueError(state, format("Schedule=\"{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", AlphaName(4), SchMin)); - ErrorsFound = true; - } - if (SchMax < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, maximum is < 0.0", - RoutineName, - CurrentModuleObject, - AlphaName(1), - state.dataIPShortCut->cAlphaFieldNames(4))); - ShowContinueError(state, format("Schedule=\"{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", AlphaName(4), SchMax)); - ErrorsFound = true; - } - } } - if (state.dataContaminantBalance->ZoneContamGenericConstant(Loop).ActualZoneNum <= 0) continue; // Error, will be caught and terminated later + if (contam.ActualZoneNum <= 0) continue; // Error, will be caught and terminated later // Object report variables SetupOutputVariable(state, "Generic Air Contaminant Constant Source Generation Volume Flow Rate", Constant::Units::m3_s, - state.dataContaminantBalance->ZoneContamGenericConstant(Loop).GCGenRate, + contam.GenRate, OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, - state.dataContaminantBalance->ZoneContamGenericConstant(Loop).Name); + contam.Name); // Zone total report variables - ZonePtr = state.dataContaminantBalance->ZoneContamGenericConstant(Loop).ActualZoneNum; + ZonePtr = contam.ActualZoneNum; if (RepVarSet(ZonePtr)) { RepVarSet(ZonePtr) = false; SetupOutputVariable(state, @@ -368,7 +302,7 @@ void GetZoneContaminanInputs(EnergyPlusData &state) } SetupZoneInternalGain(state, ZonePtr, - state.dataContaminantBalance->ZoneContamGenericConstant(Loop).Name, + contam.Name, DataHeatBalance::IntGainType::ZoneContaminantSourceAndSinkGenericContam, nullptr, nullptr, @@ -376,7 +310,7 @@ void GetZoneContaminanInputs(EnergyPlusData &state) nullptr, nullptr, nullptr, - &state.dataContaminantBalance->ZoneContamGenericConstant(Loop).GCGenRate); + &contam.GenRate); } CurrentModuleObject = "SurfaceContaminantSourceAndSink:Generic:PressureDriven"; @@ -398,13 +332,17 @@ void GetZoneContaminanInputs(EnergyPlusData &state) state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, AlphaName(1)}; + Util::IsNameEmpty(state, AlphaName(1), CurrentModuleObject, ErrorsFound); - state.dataContaminantBalance->ZoneContamGenericPDriven(Loop).Name = AlphaName(1); - state.dataContaminantBalance->ZoneContamGenericPDriven(Loop).SurfName = AlphaName(2); - state.dataContaminantBalance->ZoneContamGenericPDriven(Loop).SurfNum = - Util::FindItemInList(AlphaName(2), state.afn->MultizoneSurfaceData, &AirflowNetwork::MultizoneSurfaceProp::SurfName); - if (state.dataContaminantBalance->ZoneContamGenericPDriven(Loop).SurfNum == 0) { + auto &contam = state.dataContaminantBalance->ZoneContamGenericPDriven(Loop); + contam.Name = AlphaName(1); + + contam.SurfName = AlphaName(2); + contam.SurfNum = Util::FindItemInList(AlphaName(2), state.afn->MultizoneSurfaceData, &AirflowNetwork::MultizoneSurfaceProp::SurfName); + if (contam.SurfNum == 0) { ShowSevereError(state, format("{}{}=\"{}\", invalid {} entered={}", RoutineName, @@ -416,9 +354,8 @@ void GetZoneContaminanInputs(EnergyPlusData &state) ErrorsFound = true; } // Ensure external surface - if (state.dataContaminantBalance->ZoneContamGenericPDriven(Loop).SurfNum > 0 && - state.dataSurface->Surface(state.afn->MultizoneSurfaceData(state.dataContaminantBalance->ZoneContamGenericPDriven(Loop).SurfNum).SurfNum) - .ExtBoundCond != DataSurfaces::ExternalEnvironment) { + if (contam.SurfNum > 0 && + state.dataSurface->Surface(state.afn->MultizoneSurfaceData(contam.SurfNum).SurfNum).ExtBoundCond != DataSurfaces::ExternalEnvironment) { ShowSevereError( state, format( @@ -426,51 +363,18 @@ void GetZoneContaminanInputs(EnergyPlusData &state) ErrorsFound = true; } - state.dataContaminantBalance->ZoneContamGenericPDriven(Loop).GCGenRateCoefSchedPtr = ScheduleManager::GetScheduleIndex(state, AlphaName(3)); - if (state.dataContaminantBalance->ZoneContamGenericPDriven(Loop).GCGenRateCoefSchedPtr == 0) { - if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", {} is required.", RoutineName, CurrentModuleObject, AlphaName(1), state.dataIPShortCut->cAlphaFieldNames(3))); - } else { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered={}", - RoutineName, - CurrentModuleObject, - AlphaName(1), - state.dataIPShortCut->cAlphaFieldNames(3), - AlphaName(3))); - } + if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3)); + ErrorsFound = true; + } else if ((contam.generateRateCoefSched = Sched::GetSchedule(state, AlphaName(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), AlphaName(3)); + ErrorsFound = true; + } else if (!contam.generateRateCoefSched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), AlphaName(3), Clusive::In, 0.0); ErrorsFound = true; - } else { // check min/max on schedule - SchMin = ScheduleManager::GetScheduleMinValue(state, state.dataContaminantBalance->ZoneContamGenericPDriven(Loop).GCGenRateCoefSchedPtr); - SchMax = ScheduleManager::GetScheduleMaxValue(state, state.dataContaminantBalance->ZoneContamGenericPDriven(Loop).GCGenRateCoefSchedPtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (SchMin < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, minimum is < 0.0", - RoutineName, - CurrentModuleObject, - AlphaName(1), - state.dataIPShortCut->cAlphaFieldNames(3))); - ShowContinueError(state, format("Schedule=\"{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", AlphaName(3), SchMin)); - ErrorsFound = true; - } - if (SchMax < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, maximum is < 0.0", - RoutineName, - CurrentModuleObject, - AlphaName(1), - state.dataIPShortCut->cAlphaFieldNames(3))); - ShowContinueError(state, format("Schedule=\"{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", AlphaName(3), SchMax)); - ErrorsFound = true; - } - } } - state.dataContaminantBalance->ZoneContamGenericPDriven(Loop).GCGenRateCoef = IHGNumbers(1); + contam.GenRateCoef = IHGNumbers(1); if (IHGNumbers(1) < 0.0) { ShowSevereError(state, format("{}Negative values are not allowed for {} in {} = {}", @@ -482,7 +386,7 @@ void GetZoneContaminanInputs(EnergyPlusData &state) ErrorsFound = true; } - state.dataContaminantBalance->ZoneContamGenericPDriven(Loop).GCExpo = IHGNumbers(2); + contam.Expo = IHGNumbers(2); if (IHGNumbers(2) <= 0.0) { ShowSevereError(state, format("{}Negative or zero value is not allowed for {} in {} = {}", @@ -508,15 +412,13 @@ void GetZoneContaminanInputs(EnergyPlusData &state) SetupOutputVariable(state, "Generic Air Contaminant Pressure Driven Generation Volume Flow Rate", Constant::Units::m3_s, - state.dataContaminantBalance->ZoneContamGenericPDriven(Loop).GCGenRate, + contam.GenRate, OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, - state.dataContaminantBalance->ZoneContamGenericPDriven(Loop).Name); + contam.Name); - if (state.dataContaminantBalance->ZoneContamGenericPDriven(Loop).SurfNum > 0) { - ZonePtr = state.dataSurface - ->Surface(state.afn->MultizoneSurfaceData(state.dataContaminantBalance->ZoneContamGenericPDriven(Loop).SurfNum).SurfNum) - .Zone; + if (contam.SurfNum > 0) { + ZonePtr = state.dataSurface->Surface(state.afn->MultizoneSurfaceData(contam.SurfNum).SurfNum).Zone; } else { ZonePtr = 0; } @@ -534,7 +436,7 @@ void GetZoneContaminanInputs(EnergyPlusData &state) if (ZonePtr > 0) SetupZoneInternalGain(state, ZonePtr, - state.dataContaminantBalance->ZoneContamGenericPDriven(Loop).Name, + contam.Name, DataHeatBalance::IntGainType::ZoneContaminantSourceAndSinkGenericContam, nullptr, nullptr, @@ -542,7 +444,7 @@ void GetZoneContaminanInputs(EnergyPlusData &state) nullptr, nullptr, nullptr, - &state.dataContaminantBalance->ZoneContamGenericPDriven(Loop).GCGenRate); + &contam.GenRate); } CurrentModuleObject = "ZoneContaminantSourceAndSink:Generic:CutoffModel"; @@ -564,12 +466,17 @@ void GetZoneContaminanInputs(EnergyPlusData &state) state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, AlphaName(1)}; + Util::IsNameEmpty(state, AlphaName(1), CurrentModuleObject, ErrorsFound); - state.dataContaminantBalance->ZoneContamGenericCutoff(Loop).Name = AlphaName(1); - state.dataContaminantBalance->ZoneContamGenericCutoff(Loop).ZoneName = AlphaName(2); - state.dataContaminantBalance->ZoneContamGenericCutoff(Loop).ActualZoneNum = Util::FindItemInList(AlphaName(2), state.dataHeatBal->Zone); - if (state.dataContaminantBalance->ZoneContamGenericCutoff(Loop).ActualZoneNum == 0) { + auto &contam = state.dataContaminantBalance->ZoneContamGenericCutoff(Loop); + contam.Name = AlphaName(1); + + contam.ZoneName = AlphaName(2); + contam.ActualZoneNum = Util::FindItemInList(AlphaName(2), state.dataHeatBal->Zone); + if (contam.ActualZoneNum == 0) { ShowSevereError(state, format("{}{}=\"{}\", invalid {} entered={}", RoutineName, @@ -580,52 +487,19 @@ void GetZoneContaminanInputs(EnergyPlusData &state) ErrorsFound = true; } - state.dataContaminantBalance->ZoneContamGenericCutoff(Loop).GCGenerateRateSchedPtr = ScheduleManager::GetScheduleIndex(state, AlphaName(3)); - if (state.dataContaminantBalance->ZoneContamGenericCutoff(Loop).GCGenerateRateSchedPtr == 0) { - if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", {} is required.", RoutineName, CurrentModuleObject, AlphaName(1), state.dataIPShortCut->cAlphaFieldNames(3))); - } else { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered={}", - RoutineName, - CurrentModuleObject, - AlphaName(1), - state.dataIPShortCut->cAlphaFieldNames(3), - AlphaName(3))); - } + if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3)); + ErrorsFound = true; + } else if ((contam.generateRateSched = Sched::GetSchedule(state, AlphaName(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), AlphaName(3)); + ErrorsFound = true; + } else if (!contam.generateRateSched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), AlphaName(3), Clusive::In, 0.0); ErrorsFound = true; - } else { // check min/max on schedule - SchMin = ScheduleManager::GetScheduleMinValue(state, state.dataContaminantBalance->ZoneContamGenericCutoff(Loop).GCGenerateRateSchedPtr); - SchMax = ScheduleManager::GetScheduleMaxValue(state, state.dataContaminantBalance->ZoneContamGenericCutoff(Loop).GCGenerateRateSchedPtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (SchMin < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, minimum is < 0.0", - RoutineName, - CurrentModuleObject, - AlphaName(1), - state.dataIPShortCut->cAlphaFieldNames(3))); - ShowContinueError(state, format("Schedule=\"{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", AlphaName(3), SchMin)); - ErrorsFound = true; - } - if (SchMax < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, maximum is < 0.0", - RoutineName, - CurrentModuleObject, - AlphaName(1), - state.dataIPShortCut->cAlphaFieldNames(3))); - ShowContinueError(state, format("Schedule=\"{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", AlphaName(3), SchMax)); - ErrorsFound = true; - } - } } - state.dataContaminantBalance->ZoneContamGenericCutoff(Loop).GCGenerateRate = IHGNumbers(1); - state.dataContaminantBalance->ZoneContamGenericCutoff(Loop).GCCutoffValue = IHGNumbers(2); + contam.GenerateRate = IHGNumbers(1); + contam.CutoffValue = IHGNumbers(2); if (IHGNumbers(1) < 0.0) { ShowSevereError(state, @@ -652,13 +526,13 @@ void GetZoneContaminanInputs(EnergyPlusData &state) SetupOutputVariable(state, "Generic Air Contaminant Cutoff Model Generation Volume Flow Rate", Constant::Units::m3_s, - state.dataContaminantBalance->ZoneContamGenericCutoff(Loop).GCGenRate, + contam.GenRate, OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, - state.dataContaminantBalance->ZoneContamGenericCutoff(Loop).Name); + contam.Name); // Zone total report variables - ZonePtr = state.dataContaminantBalance->ZoneContamGenericCutoff(Loop).ActualZoneNum; + ZonePtr = contam.ActualZoneNum; if (RepVarSet(ZonePtr)) { RepVarSet(ZonePtr) = false; SetupOutputVariable(state, @@ -671,7 +545,7 @@ void GetZoneContaminanInputs(EnergyPlusData &state) } SetupZoneInternalGain(state, ZonePtr, - state.dataContaminantBalance->ZoneContamGenericCutoff(Loop).Name, + contam.Name, DataHeatBalance::IntGainType::ZoneContaminantSourceAndSinkGenericContam, nullptr, nullptr, @@ -679,7 +553,7 @@ void GetZoneContaminanInputs(EnergyPlusData &state) nullptr, nullptr, nullptr, - &state.dataContaminantBalance->ZoneContamGenericCutoff(Loop).GCGenRate); + &contam.GenRate); } CurrentModuleObject = "ZoneContaminantSourceAndSink:Generic:DecaySource"; @@ -701,12 +575,17 @@ void GetZoneContaminanInputs(EnergyPlusData &state) state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, AlphaName(1)}; + + auto &contam = state.dataContaminantBalance->ZoneContamGenericDecay(Loop); + Util::IsNameEmpty(state, AlphaName(1), CurrentModuleObject, ErrorsFound); - state.dataContaminantBalance->ZoneContamGenericDecay(Loop).Name = AlphaName(1); + contam.Name = AlphaName(1); - state.dataContaminantBalance->ZoneContamGenericDecay(Loop).ZoneName = AlphaName(2); - state.dataContaminantBalance->ZoneContamGenericDecay(Loop).ActualZoneNum = Util::FindItemInList(AlphaName(2), state.dataHeatBal->Zone); - if (state.dataContaminantBalance->ZoneContamGenericDecay(Loop).ActualZoneNum == 0) { + contam.ZoneName = AlphaName(2); + contam.ActualZoneNum = Util::FindItemInList(AlphaName(2), state.dataHeatBal->Zone); + if (contam.ActualZoneNum == 0) { ShowSevereError(state, format("{}{}=\"{}\", invalid {} entered={}", RoutineName, @@ -717,52 +596,19 @@ void GetZoneContaminanInputs(EnergyPlusData &state) ErrorsFound = true; } - state.dataContaminantBalance->ZoneContamGenericDecay(Loop).GCEmiRateSchedPtr = ScheduleManager::GetScheduleIndex(state, AlphaName(3)); - if (state.dataContaminantBalance->ZoneContamGenericDecay(Loop).GCEmiRateSchedPtr == 0) { - if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", {} is required.", RoutineName, CurrentModuleObject, AlphaName(1), state.dataIPShortCut->cAlphaFieldNames(3))); - } else { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered={}", - RoutineName, - CurrentModuleObject, - AlphaName(1), - state.dataIPShortCut->cAlphaFieldNames(3), - AlphaName(3))); - } + if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3)); + ErrorsFound = true; + } else if ((contam.emitRateSched = Sched::GetSchedule(state, AlphaName(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), AlphaName(3)); + ErrorsFound = true; + } else if (!contam.emitRateSched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), AlphaName(3), Clusive::In, 0.0); ErrorsFound = true; - } else { // check min/max on schedule - SchMin = ScheduleManager::GetScheduleMinValue(state, state.dataContaminantBalance->ZoneContamGenericDecay(Loop).GCEmiRateSchedPtr); - SchMax = ScheduleManager::GetScheduleMaxValue(state, state.dataContaminantBalance->ZoneContamGenericDecay(Loop).GCEmiRateSchedPtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (SchMin < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, minimum is < 0.0", - RoutineName, - CurrentModuleObject, - AlphaName(1), - state.dataIPShortCut->cAlphaFieldNames(3))); - ShowContinueError(state, format("Schedule=\"{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", AlphaName(3), SchMin)); - ErrorsFound = true; - } - if (SchMax < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, maximum is < 0.0", - RoutineName, - CurrentModuleObject, - AlphaName(1), - state.dataIPShortCut->cAlphaFieldNames(3))); - ShowContinueError(state, format("Schedule=\"{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", AlphaName(3), SchMax)); - ErrorsFound = true; - } - } } - state.dataContaminantBalance->ZoneContamGenericDecay(Loop).GCInitEmiRate = IHGNumbers(1); - state.dataContaminantBalance->ZoneContamGenericDecay(Loop).GCDelayTime = IHGNumbers(2); + contam.InitEmitRate = IHGNumbers(1); + contam.DelayTime = IHGNumbers(2); if (IHGNumbers(1) < 0.0) { ShowSevereError(state, @@ -789,20 +635,20 @@ void GetZoneContaminanInputs(EnergyPlusData &state) SetupOutputVariable(state, "Generic Air Contaminant Decay Model Generation Volume Flow Rate", Constant::Units::m3_s, - state.dataContaminantBalance->ZoneContamGenericDecay(Loop).GCGenRate, + contam.GenRate, OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, - state.dataContaminantBalance->ZoneContamGenericDecay(Loop).Name); + contam.Name); SetupOutputVariable(state, "Generic Air Contaminant Decay Model Generation Emission Start Elapsed Time", Constant::Units::s, - state.dataContaminantBalance->ZoneContamGenericDecay(Loop).GCTime, + contam.Time, OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, - state.dataContaminantBalance->ZoneContamGenericDecay(Loop).Name); + contam.Name); // Zone total report variables - ZonePtr = state.dataContaminantBalance->ZoneContamGenericDecay(Loop).ActualZoneNum; + ZonePtr = contam.ActualZoneNum; if (RepVarSet(ZonePtr)) { RepVarSet(ZonePtr) = false; SetupOutputVariable(state, @@ -815,7 +661,7 @@ void GetZoneContaminanInputs(EnergyPlusData &state) } SetupZoneInternalGain(state, ZonePtr, - state.dataContaminantBalance->ZoneContamGenericDecay(Loop).Name, + contam.Name, DataHeatBalance::IntGainType::ZoneContaminantSourceAndSinkGenericContam, nullptr, nullptr, @@ -823,7 +669,7 @@ void GetZoneContaminanInputs(EnergyPlusData &state) nullptr, nullptr, nullptr, - &state.dataContaminantBalance->ZoneContamGenericDecay(Loop).GCGenRate); + &contam.GenRate); } CurrentModuleObject = "SurfaceContaminantSourceAndSink:Generic:BoundaryLayerDiffusion"; @@ -845,12 +691,16 @@ void GetZoneContaminanInputs(EnergyPlusData &state) state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, AlphaName(1)}; + Util::IsNameEmpty(state, AlphaName(1), CurrentModuleObject, ErrorsFound); - state.dataContaminantBalance->ZoneContamGenericBLDiff(Loop).Name = AlphaName(1); - state.dataContaminantBalance->ZoneContamGenericBLDiff(Loop).SurfName = AlphaName(2); - state.dataContaminantBalance->ZoneContamGenericBLDiff(Loop).SurfNum = Util::FindItemInList(AlphaName(2), state.dataSurface->Surface); - if (state.dataContaminantBalance->ZoneContamGenericBLDiff(Loop).SurfNum == 0) { + auto &contam = state.dataContaminantBalance->ZoneContamGenericBLDiff(Loop); + contam.Name = AlphaName(1); + contam.SurfName = AlphaName(2); + contam.SurfNum = Util::FindItemInList(AlphaName(2), state.dataSurface->Surface); + if (contam.SurfNum == 0) { ShowSevereError(state, format("{}{}=\"{}\", invalid {} entered={}", RoutineName, @@ -861,52 +711,19 @@ void GetZoneContaminanInputs(EnergyPlusData &state) ErrorsFound = true; } - state.dataContaminantBalance->ZoneContamGenericBLDiff(Loop).GCTranCoefSchedPtr = ScheduleManager::GetScheduleIndex(state, AlphaName(3)); - if (state.dataContaminantBalance->ZoneContamGenericBLDiff(Loop).GCTranCoefSchedPtr == 0) { - if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", {} is required.", RoutineName, CurrentModuleObject, AlphaName(1), state.dataIPShortCut->cAlphaFieldNames(3))); - } else { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered={}", - RoutineName, - CurrentModuleObject, - AlphaName(1), - state.dataIPShortCut->cAlphaFieldNames(3), - AlphaName(3))); - } + if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3)); + ErrorsFound = true; + } else if ((contam.transCoefSched = Sched::GetSchedule(state, AlphaName(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), AlphaName(3)); + ErrorsFound = true; + } else if (!contam.transCoefSched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), AlphaName(3), Clusive::In, 0.0); ErrorsFound = true; - } else { // check min/max on schedule - SchMin = ScheduleManager::GetScheduleMinValue(state, state.dataContaminantBalance->ZoneContamGenericBLDiff(Loop).GCTranCoefSchedPtr); - SchMax = ScheduleManager::GetScheduleMaxValue(state, state.dataContaminantBalance->ZoneContamGenericBLDiff(Loop).GCTranCoefSchedPtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (SchMin < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, minimum is < 0.0", - RoutineName, - CurrentModuleObject, - AlphaName(1), - state.dataIPShortCut->cAlphaFieldNames(3))); - ShowContinueError(state, format("Schedule=\"{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", AlphaName(3), SchMin)); - ErrorsFound = true; - } - if (SchMax < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, maximum is < 0.0", - RoutineName, - CurrentModuleObject, - AlphaName(1), - state.dataIPShortCut->cAlphaFieldNames(3))); - ShowContinueError(state, format("Schedule=\"{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", AlphaName(3), SchMax)); - ErrorsFound = true; - } - } } - state.dataContaminantBalance->ZoneContamGenericBLDiff(Loop).GCTranCoef = IHGNumbers(1); - state.dataContaminantBalance->ZoneContamGenericBLDiff(Loop).GCHenryCoef = IHGNumbers(2); + contam.TransCoef = IHGNumbers(1); + contam.HenryCoef = IHGNumbers(2); if (IHGNumbers(1) < 0.0) { ShowSevereError(state, format("{}Negative values are not allowed for {} in {} = {}", @@ -932,21 +749,21 @@ void GetZoneContaminanInputs(EnergyPlusData &state) SetupOutputVariable(state, "Generic Air Contaminant Boundary Layer Diffusion Generation Volume Flow Rate", Constant::Units::m3_s, - state.dataContaminantBalance->ZoneContamGenericBLDiff(Loop).GCGenRate, + contam.GenRate, OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, - state.dataContaminantBalance->ZoneContamGenericBLDiff(Loop).Name); - if (state.dataContaminantBalance->ZoneContamGenericBLDiff(Loop).SurfNum > 0) { + contam.Name); + if (contam.SurfNum > 0) { SetupOutputVariable(state, "Generic Air Contaminant Boundary Layer Diffusion Inside Face Concentration", Constant::Units::ppm, - state.dataSurface->SurfGenericContam(state.dataContaminantBalance->ZoneContamGenericBLDiff(Loop).SurfNum), + state.dataSurface->SurfGenericContam(contam.SurfNum), OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, - state.dataContaminantBalance->ZoneContamGenericBLDiff(Loop).SurfName); + contam.SurfName); } - ZonePtr = state.dataSurface->Surface(state.dataContaminantBalance->ZoneContamGenericBLDiff(Loop).SurfNum).Zone; + ZonePtr = state.dataSurface->Surface(contam.SurfNum).Zone; // Zone total report variables if (RepVarSet(ZonePtr)) { RepVarSet(ZonePtr) = false; @@ -960,7 +777,7 @@ void GetZoneContaminanInputs(EnergyPlusData &state) } SetupZoneInternalGain(state, ZonePtr, - state.dataContaminantBalance->ZoneContamGenericBLDiff(Loop).Name, + contam.Name, DataHeatBalance::IntGainType::ZoneContaminantSourceAndSinkGenericContam, nullptr, nullptr, @@ -968,7 +785,7 @@ void GetZoneContaminanInputs(EnergyPlusData &state) nullptr, nullptr, nullptr, - &state.dataContaminantBalance->ZoneContamGenericBLDiff(Loop).GCGenRate); + &contam.GenRate); } CurrentModuleObject = "SurfaceContaminantSourceAndSink:Generic:DepositionVelocitySink"; @@ -990,12 +807,16 @@ void GetZoneContaminanInputs(EnergyPlusData &state) state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, AlphaName(1)}; + Util::IsNameEmpty(state, AlphaName(1), CurrentModuleObject, ErrorsFound); - state.dataContaminantBalance->ZoneContamGenericDVS(Loop).Name = AlphaName(1); + auto &contam = state.dataContaminantBalance->ZoneContamGenericDVS(Loop); + contam.Name = AlphaName(1); - state.dataContaminantBalance->ZoneContamGenericDVS(Loop).SurfName = AlphaName(2); - state.dataContaminantBalance->ZoneContamGenericDVS(Loop).SurfNum = Util::FindItemInList(AlphaName(2), state.dataSurface->Surface); - if (state.dataContaminantBalance->ZoneContamGenericDVS(Loop).SurfNum == 0) { + contam.SurfName = AlphaName(2); + contam.SurfNum = Util::FindItemInList(AlphaName(2), state.dataSurface->Surface); + if (contam.SurfNum == 0) { ShowSevereError(state, format("{}{}=\"{}\", invalid {} entered={}", RoutineName, @@ -1006,51 +827,18 @@ void GetZoneContaminanInputs(EnergyPlusData &state) ErrorsFound = true; } - state.dataContaminantBalance->ZoneContamGenericDVS(Loop).GCDepoVeloPtr = ScheduleManager::GetScheduleIndex(state, AlphaName(3)); - if (state.dataContaminantBalance->ZoneContamGenericDVS(Loop).GCDepoVeloPtr == 0) { - if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", {} is required.", RoutineName, CurrentModuleObject, AlphaName(1), state.dataIPShortCut->cAlphaFieldNames(3))); - } else { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered={}", - RoutineName, - CurrentModuleObject, - AlphaName(1), - state.dataIPShortCut->cAlphaFieldNames(3), - AlphaName(3))); - } + if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3)); + ErrorsFound = true; + } else if ((contam.depoVeloSched = Sched::GetSchedule(state, AlphaName(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), AlphaName(3)); + ErrorsFound = true; + } else if (!contam.depoVeloSched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), AlphaName(3), Clusive::In, 0.0); ErrorsFound = true; - } else { // check min/max on schedule - SchMin = ScheduleManager::GetScheduleMinValue(state, state.dataContaminantBalance->ZoneContamGenericDVS(Loop).GCDepoVeloPtr); - SchMax = ScheduleManager::GetScheduleMaxValue(state, state.dataContaminantBalance->ZoneContamGenericDVS(Loop).GCDepoVeloPtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (SchMin < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, minimum is < 0.0", - RoutineName, - CurrentModuleObject, - AlphaName(1), - state.dataIPShortCut->cAlphaFieldNames(3))); - ShowContinueError(state, format("Schedule=\"{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", AlphaName(3), SchMin)); - ErrorsFound = true; - } - if (SchMax < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, maximum is < 0.0", - RoutineName, - CurrentModuleObject, - AlphaName(1), - state.dataIPShortCut->cAlphaFieldNames(3))); - ShowContinueError(state, format("Schedule=\"{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", AlphaName(3), SchMax)); - ErrorsFound = true; - } - } } - state.dataContaminantBalance->ZoneContamGenericDVS(Loop).GCDepoVelo = IHGNumbers(1); + contam.DepoVelo = IHGNumbers(1); if (IHGNumbers(1) < 0.0) { ShowSevereError(state, format("{}Negative values are not allowed for {} in {} = {}", @@ -1066,12 +854,12 @@ void GetZoneContaminanInputs(EnergyPlusData &state) SetupOutputVariable(state, "Generic Air Contaminant Deposition Velocity Removal Volume Flow Rate", Constant::Units::m3_s, - state.dataContaminantBalance->ZoneContamGenericDVS(Loop).GCGenRate, + contam.GenRate, OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, - state.dataContaminantBalance->ZoneContamGenericDVS(Loop).Name); + contam.Name); - ZonePtr = state.dataSurface->Surface(state.dataContaminantBalance->ZoneContamGenericDVS(Loop).SurfNum).Zone; + ZonePtr = state.dataSurface->Surface(contam.SurfNum).Zone; // Zone total report variables if (RepVarSet(ZonePtr)) { RepVarSet(ZonePtr) = false; @@ -1085,7 +873,7 @@ void GetZoneContaminanInputs(EnergyPlusData &state) } SetupZoneInternalGain(state, ZonePtr, - state.dataContaminantBalance->ZoneContamGenericDVS(Loop).Name, + contam.Name, DataHeatBalance::IntGainType::ZoneContaminantSourceAndSinkGenericContam, nullptr, nullptr, @@ -1093,7 +881,7 @@ void GetZoneContaminanInputs(EnergyPlusData &state) nullptr, nullptr, nullptr, - &state.dataContaminantBalance->ZoneContamGenericDVS(Loop).GCGenRate); + &contam.GenRate); } CurrentModuleObject = "ZoneContaminantSourceAndSink:Generic:DepositionRateSink"; @@ -1115,12 +903,17 @@ void GetZoneContaminanInputs(EnergyPlusData &state) state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, AlphaName(1)}; + Util::IsNameEmpty(state, AlphaName(1), CurrentModuleObject, ErrorsFound); - state.dataContaminantBalance->ZoneContamGenericDRS(Loop).Name = AlphaName(1); - state.dataContaminantBalance->ZoneContamGenericDRS(Loop).ZoneName = AlphaName(2); - state.dataContaminantBalance->ZoneContamGenericDRS(Loop).ActualZoneNum = Util::FindItemInList(AlphaName(2), state.dataHeatBal->Zone); - if (state.dataContaminantBalance->ZoneContamGenericDRS(Loop).ActualZoneNum == 0) { + auto &contam = state.dataContaminantBalance->ZoneContamGenericDRS(Loop); + contam.Name = AlphaName(1); + + contam.ZoneName = AlphaName(2); + contam.ActualZoneNum = Util::FindItemInList(AlphaName(2), state.dataHeatBal->Zone); + if (contam.ActualZoneNum == 0) { ShowSevereError(state, format("{}{}=\"{}\", invalid {} entered={}", RoutineName, @@ -1131,51 +924,18 @@ void GetZoneContaminanInputs(EnergyPlusData &state) ErrorsFound = true; } - state.dataContaminantBalance->ZoneContamGenericDRS(Loop).GCDepoRatePtr = ScheduleManager::GetScheduleIndex(state, AlphaName(3)); - if (state.dataContaminantBalance->ZoneContamGenericDRS(Loop).GCDepoRatePtr == 0) { - if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { - ShowSevereError( - state, - format( - "{}{}=\"{}\", {} is required.", RoutineName, CurrentModuleObject, AlphaName(1), state.dataIPShortCut->cAlphaFieldNames(3))); - } else { - ShowSevereError(state, - format("{}{}=\"{}\", invalid {} entered={}", - RoutineName, - CurrentModuleObject, - AlphaName(1), - state.dataIPShortCut->cAlphaFieldNames(3), - AlphaName(3))); - } + if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3)); + ErrorsFound = true; + } else if ((contam.depoRateSched = Sched::GetSchedule(state, AlphaName(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), AlphaName(3)); + ErrorsFound = true; + } else if (!contam.depoRateSched->checkMinVal(state, Clusive::In, 0.0)) { + Sched::ShowSevereBadMin(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), AlphaName(3), Clusive::In, 0.0); ErrorsFound = true; - } else { // check min/max on schedule - SchMin = ScheduleManager::GetScheduleMinValue(state, state.dataContaminantBalance->ZoneContamGenericDRS(Loop).GCDepoRatePtr); - SchMax = ScheduleManager::GetScheduleMaxValue(state, state.dataContaminantBalance->ZoneContamGenericDRS(Loop).GCDepoRatePtr); - if (SchMin < 0.0 || SchMax < 0.0) { - if (SchMin < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, minimum is < 0.0", - RoutineName, - CurrentModuleObject, - AlphaName(1), - state.dataIPShortCut->cAlphaFieldNames(3))); - ShowContinueError(state, format("Schedule=\"{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", AlphaName(3), SchMin)); - ErrorsFound = true; - } - if (SchMax < 0.0) { - ShowSevereError(state, - format("{}{}=\"{}\", {}, maximum is < 0.0", - RoutineName, - CurrentModuleObject, - AlphaName(1), - state.dataIPShortCut->cAlphaFieldNames(3))); - ShowContinueError(state, format("Schedule=\"{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", AlphaName(3), SchMax)); - ErrorsFound = true; - } - } } - state.dataContaminantBalance->ZoneContamGenericDRS(Loop).GCDepoRate = IHGNumbers(1); + contam.DepoRate = IHGNumbers(1); if (IHGNumbers(1) < 0.0) { ShowSevereError(state, @@ -1192,12 +952,12 @@ void GetZoneContaminanInputs(EnergyPlusData &state) SetupOutputVariable(state, "Generic Air Contaminant Deposition Rate Removal Volume Flow Rate", Constant::Units::m3_s, - state.dataContaminantBalance->ZoneContamGenericDRS(Loop).GCGenRate, + contam.GenRate, OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, - state.dataContaminantBalance->ZoneContamGenericDRS(Loop).Name); + contam.Name); - ZonePtr = state.dataContaminantBalance->ZoneContamGenericDRS(Loop).ActualZoneNum; + ZonePtr = contam.ActualZoneNum; // Zone total report variables if (RepVarSet(ZonePtr)) { RepVarSet(ZonePtr) = false; @@ -1211,7 +971,7 @@ void GetZoneContaminanInputs(EnergyPlusData &state) } SetupZoneInternalGain(state, ZonePtr, - state.dataContaminantBalance->ZoneContamGenericDRS(Loop).Name, + contam.Name, DataHeatBalance::IntGainType::ZoneContaminantSourceAndSinkGenericContam, nullptr, nullptr, @@ -1219,7 +979,7 @@ void GetZoneContaminanInputs(EnergyPlusData &state) nullptr, nullptr, nullptr, - &state.dataContaminantBalance->ZoneContamGenericDRS(Loop).GCGenRate); + &contam.GenRate); } RepVarSet.deallocate(); @@ -1244,13 +1004,7 @@ void GetZoneContaminanSetPoints(EnergyPlusData &state) // METHODOLOGY EMPLOYED: // Uses the status flags to trigger events. - // Using/Aliasing - - using ScheduleManager::CheckScheduleValue; - using ScheduleManager::CheckScheduleValueMinMax; - using ScheduleManager::GetScheduleIndex; - using ScheduleManager::GetScheduleMaxValue; - using ScheduleManager::GetScheduleMinValue; + static constexpr std::string_view routineName = "GetZoneContaminantSetPoints"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int ContControlledZoneNum; // The Splitter that you are currently loading input into @@ -1258,7 +1012,6 @@ void GetZoneContaminanSetPoints(EnergyPlusData &state) int NumNums; int IOStat; bool ErrorsFound(false); - bool ValidScheduleType; struct NeededControlTypes { @@ -1304,13 +1057,16 @@ void GetZoneContaminanSetPoints(EnergyPlusData &state) state.dataIPShortCut->lAlphaFieldBlanks, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)}; + Util::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); - state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).Name = state.dataIPShortCut->cAlphaArgs(1); - state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).ZoneName = state.dataIPShortCut->cAlphaArgs(2); - state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).ActualZoneNum = - Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(2), state.dataHeatBal->Zone); - if (state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).ActualZoneNum == 0) { + auto &controlledZone = state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum); + controlledZone.Name = state.dataIPShortCut->cAlphaArgs(1); + controlledZone.ZoneName = state.dataIPShortCut->cAlphaArgs(2); + controlledZone.ActualZoneNum = Util::FindItemInList(state.dataIPShortCut->cAlphaArgs(2), state.dataHeatBal->Zone); + if (controlledZone.ActualZoneNum == 0) { ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\" not found.", cCurrentModuleObject, @@ -1322,161 +1078,79 @@ void GetZoneContaminanSetPoints(EnergyPlusData &state) // Zone(ContaminantControlledZone(ContControlledZoneNum)%ActualZoneNum)%TempControlledZoneIndex = ContControlledZoneNum } - state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).AvaiSchedule = state.dataIPShortCut->cAlphaArgs(3); if (state.dataIPShortCut->lAlphaFieldBlanks(3)) { - state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).AvaiSchedPtr = - ScheduleManager::ScheduleAlwaysOn; // (Returns 1.0) + controlledZone.availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((controlledZone.availSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3)); + ErrorsFound = true; + } else if (!controlledZone.availSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax( + state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), state.dataIPShortCut->cAlphaArgs(3), Clusive::In, 0.0, Clusive::In, 1.0); + ErrorsFound = true; } else { - state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).AvaiSchedPtr = - GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(3)); - if (state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).AvaiSchedPtr == 0) { - ShowSevereError(state, - format("{}=\"{}\" invalid {}=\"{}\" not found.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); - ErrorsFound = true; - } else { - // Check validity of control types. - ValidScheduleType = ScheduleManager::CheckScheduleValueMinMax( - state, state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).AvaiSchedPtr, ">=", 0.0, "<=", 1.0); - if (!ValidScheduleType) { - ShowSevereError(state, - format("{}=\"{}\" invalid range {}=\"{}\"", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(3))); - ShowContinueError(state, "..contains values outside of range [0,1]."); - ErrorsFound = true; - } else { - state.dataHeatBal->Zone(state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).ActualZoneNum) - .ZoneContamControllerSchedIndex = state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).AvaiSchedPtr; - } - } + state.dataHeatBal->Zone(controlledZone.ActualZoneNum).zoneContamControllerSched = controlledZone.availSched; } - state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).SetPointSchedName = state.dataIPShortCut->cAlphaArgs(4); - state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).SPSchedIndex = - GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(4)); - if (state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).SPSchedIndex == 0) { - ShowSevereError(state, - format("{}=\"{}\" invalid {}=\"{}\" not found.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4))); + if (state.dataIPShortCut->lAlphaFieldBlanks(4)) { + ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaFieldNames(4)); + ErrorsFound = true; + } else if ((controlledZone.setptSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(4))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4)); + ErrorsFound = true; + } else if (!controlledZone.setptSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 2000.0)) { + Sched::ShowSevereBadMinMax( + state, eoh, state.dataIPShortCut->cAlphaFieldNames(4), state.dataIPShortCut->cAlphaArgs(4), Clusive::In, 0.0, Clusive::In, 2000.0); + ErrorsFound = true; + } + + if (state.dataIPShortCut->lAlphaFieldBlanks(5)) { + controlledZone.zoneMinCO2Sched = nullptr; // This needs to be nullptr because an empty schedule means outdoorCO2 not zero CO2 + } else if ((controlledZone.zoneMinCO2Sched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(5))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5)); + ErrorsFound = true; + } else if (!controlledZone.zoneMinCO2Sched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 2000.0)) { + Sched::ShowSevereBadMinMax( + state, eoh, state.dataIPShortCut->cAlphaFieldNames(5), state.dataIPShortCut->cAlphaArgs(5), Clusive::In, 0.0, Clusive::In, 2000.0); ErrorsFound = true; } else { - // Check validity of control types. - ValidScheduleType = ScheduleManager::CheckScheduleValueMinMax( - state, state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).SPSchedIndex, ">=", 0.0, "<=", 2000.0); - if (!ValidScheduleType) { - ShowSevereError(state, - format("{}=\"{}\" invalid range {}=\"{}\"", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(4), - state.dataIPShortCut->cAlphaArgs(4))); - ShowContinueError(state, "..contains values outside of range [0,2000 ppm]."); - ErrorsFound = true; - } + state.dataHeatBal->Zone(controlledZone.ActualZoneNum).zoneMinCO2Sched = controlledZone.zoneMinCO2Sched; } - state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).ZoneMinCO2SchedName = state.dataIPShortCut->cAlphaArgs(5); - state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).ZoneMinCO2SchedIndex = - GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(5)); - if (state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).ZoneMinCO2SchedIndex > 0) { - // Check validity of control types. - ValidScheduleType = ScheduleManager::CheckScheduleValueMinMax( - state, state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).ZoneMinCO2SchedIndex, ">=", 0.0, "<=", 2000.0); - if (!ValidScheduleType) { - ShowSevereError(state, - format("{}=\"{}\" invalid range {}=\"{}\"", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(5), - state.dataIPShortCut->cAlphaArgs(5))); - ShowContinueError(state, "..contains values outside of range [0,2000 ppm]."); - ErrorsFound = true; - } else { - state.dataHeatBal->Zone(state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).ActualZoneNum) - .ZoneMinCO2SchedIndex = state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).ZoneMinCO2SchedIndex; - } + if (state.dataIPShortCut->lAlphaFieldBlanks(6)) { + controlledZone.zoneMaxCO2Sched = nullptr; // This needs to be nullptr because an empty schedule means outdoorCO2, not zero CO2 + } else if ((controlledZone.zoneMaxCO2Sched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(6))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(6), state.dataIPShortCut->cAlphaArgs(6)); + ErrorsFound = true; + } else if (!controlledZone.zoneMaxCO2Sched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 2000.0)) { + Sched::ShowSevereBadMinMax( + state, eoh, state.dataIPShortCut->cAlphaFieldNames(6), state.dataIPShortCut->cAlphaArgs(6), Clusive::In, 0.0, Clusive::In, 2000.0); + ErrorsFound = true; + } else { + state.dataHeatBal->Zone(controlledZone.ActualZoneNum).zoneMaxCO2Sched = controlledZone.zoneMaxCO2Sched; } - state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).ZoneMaxCO2SchedName = state.dataIPShortCut->cAlphaArgs(6); - state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).ZoneMaxCO2SchedIndex = - GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(6)); - if (state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).ZoneMaxCO2SchedIndex > 0) { - // Check validity of control types. - ValidScheduleType = ScheduleManager::CheckScheduleValueMinMax( - state, state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).ZoneMaxCO2SchedIndex, ">=", 0.0, "<=", 2000.0); - if (!ValidScheduleType) { - ShowSevereError(state, - format("{}=\"{}\" invalid range {}=\"{}\"", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(6), - state.dataIPShortCut->cAlphaArgs(6))); - ShowContinueError(state, "..contains values outside of range [0,2000 ppm]."); - ErrorsFound = true; - } else { - state.dataHeatBal->Zone(state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).ActualZoneNum) - .ZoneMaxCO2SchedIndex = state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).ZoneMaxCO2SchedIndex; - } + if (NumAlphas <= 6) { + controlledZone.genericContamAvailSched = Sched::GetScheduleAlwaysOn(state); + continue; } - if (NumAlphas > 6) { - state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).GCAvaiSchedule = state.dataIPShortCut->cAlphaArgs(7); - if (state.dataIPShortCut->lAlphaFieldBlanks(7)) { - state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).GCAvaiSchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).GCAvaiSchedPtr = - GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(7)); - if (state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).AvaiSchedPtr == 0) { - ShowSevereError(state, - format("{}=\"{}\" invalid {}=\"{}\" not found.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(7))); - ErrorsFound = true; - } else { - // Check validity of control types. - ValidScheduleType = ScheduleManager::CheckScheduleValueMinMax( - state, state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).GCAvaiSchedPtr, ">=", 0.0, "<=", 1.0); - if (!ValidScheduleType) { - ShowSevereError(state, - format("{}=\"{}\" invalid range {}=\"{}\"", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(3), - state.dataIPShortCut->cAlphaArgs(7))); - ShowContinueError(state, "..contains values outside of range [0,1]."); - ErrorsFound = true; - } - } - } - if (state.dataIPShortCut->lAlphaFieldBlanks(8)) { - ShowSevereError(state, format("{} \"{}\" is required, but blank.", cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(8))); - ErrorsFound = true; - } else { - state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).GCSetPointSchedName = - state.dataIPShortCut->cAlphaArgs(8); - state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).GCSPSchedIndex = - GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(8)); - if (state.dataContaminantBalance->ContaminantControlledZone(ContControlledZoneNum).GCSPSchedIndex == 0) { - ShowSevereError(state, - format("{}=\"{}\" invalid {}=\"{}\" not found.", - cCurrentModuleObject, - state.dataIPShortCut->cAlphaArgs(1), - state.dataIPShortCut->cAlphaFieldNames(8), - state.dataIPShortCut->cAlphaArgs(8))); - ErrorsFound = true; - } - } + if (state.dataIPShortCut->lAlphaFieldBlanks(7)) { + controlledZone.genericContamAvailSched = Sched::GetScheduleAlwaysOn(state); + } else if ((controlledZone.genericContamAvailSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(7))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(7), state.dataIPShortCut->cAlphaArgs(7)); + ErrorsFound = true; + } else if (!controlledZone.genericContamAvailSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + Sched::ShowSevereBadMinMax( + state, eoh, state.dataIPShortCut->cAlphaFieldNames(7), state.dataIPShortCut->cAlphaArgs(7), Clusive::In, 0.0, Clusive::In, 1.0); + ErrorsFound = true; + } + + if (state.dataIPShortCut->lAlphaFieldBlanks(8)) { + ShowSevereEmptyField(state, eoh, state.dataIPShortCut->cAlphaArgs(8)); + ErrorsFound = true; + } else if ((controlledZone.genericContamSetptSched = Sched::GetSchedule(state, state.dataIPShortCut->cAlphaArgs(8))) == nullptr) { + ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(8), state.dataIPShortCut->cAlphaArgs(8)); + ErrorsFound = true; } } // ContControlledZoneNum @@ -1506,13 +1180,11 @@ void InitZoneContSetPoints(EnergyPlusData &state) Real64 Sch; // Schedule value if (state.dataContaminantBalance->Contaminant.CO2Simulation) { - state.dataContaminantBalance->OutdoorCO2 = - ScheduleManager::GetCurrentScheduleValue(state, state.dataContaminantBalance->Contaminant.CO2OutdoorSchedPtr); + state.dataContaminantBalance->OutdoorCO2 = state.dataContaminantBalance->Contaminant.CO2OutdoorSched->getCurrentVal(); } if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) { - state.dataContaminantBalance->OutdoorGC = - ScheduleManager::GetCurrentScheduleValue(state, state.dataContaminantBalance->Contaminant.GenericContamOutdoorSchedPtr); + state.dataContaminantBalance->OutdoorGC = state.dataContaminantBalance->Contaminant.genericOutdoorSched->getCurrentVal(); } if (state.dataZoneContaminantPredictorCorrector->MyOneTimeFlag) { @@ -1696,7 +1368,7 @@ void InitZoneContSetPoints(EnergyPlusData &state) } if (!state.dataContaminantBalance->ZoneContamGenericDecay.empty()) for (auto &e : state.dataContaminantBalance->ZoneContamGenericDecay) - e.GCTime = 0.0; + e.Time = 0.0; } state.dataZoneContaminantPredictorCorrector->MyEnvrnFlag = false; } @@ -1753,12 +1425,12 @@ void InitZoneContSetPoints(EnergyPlusData &state) if (state.dataContaminantBalance->Contaminant.CO2Simulation) { int ZoneNum = state.dataContaminantBalance->ContaminantControlledZone(Loop).ActualZoneNum; state.dataContaminantBalance->ZoneCO2SetPoint(ZoneNum) = - ScheduleManager::GetCurrentScheduleValue(state, state.dataContaminantBalance->ContaminantControlledZone(Loop).SPSchedIndex); + state.dataContaminantBalance->ContaminantControlledZone(Loop).setptSched->getCurrentVal(); } if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) { int ZoneNum = state.dataContaminantBalance->ContaminantControlledZone(Loop).ActualZoneNum; state.dataContaminantBalance->ZoneGCSetPoint(ZoneNum) = - ScheduleManager::GetCurrentScheduleValue(state, state.dataContaminantBalance->ContaminantControlledZone(Loop).GCSPSchedIndex); + state.dataContaminantBalance->ContaminantControlledZone(Loop).genericContamSetptSched->getCurrentVal(); } } @@ -1781,10 +1453,9 @@ void InitZoneContSetPoints(EnergyPlusData &state) // from constant model for (auto &con : state.dataContaminantBalance->ZoneContamGenericConstant) { int ZoneNum = con.ActualZoneNum; - GCGain = con.GCGenerateRate * ScheduleManager::GetCurrentScheduleValue(state, con.GCGenerateRateSchedPtr) - - con.GCRemovalCoef * ScheduleManager::GetCurrentScheduleValue(state, con.GCRemovalCoefSchedPtr) * - state.dataContaminantBalance->ZoneAirGC(ZoneNum) * 1.0e-6; - con.GCGenRate = GCGain; + GCGain = con.GenerateRate * con.generateRateSched->getCurrentVal() - + con.RemovalCoef * con.removalCoefSched->getCurrentVal() * state.dataContaminantBalance->ZoneAirGC(ZoneNum) * 1.0e-6; + con.GenRate = GCGain; } // from pressure driven model @@ -1794,37 +1465,37 @@ void InitZoneContSetPoints(EnergyPlusData &state) Pi = state.afn->AirflowNetworkNodeSimu(state.afn->MultizoneSurfaceData(SurfNum).NodeNums[0]).PZ; Pj = state.afn->AirflowNetworkNodeSimu(state.afn->MultizoneSurfaceData(SurfNum).NodeNums[1]).PZ; if (Pj >= Pi) { - GCGain = con.GCGenRateCoef * ScheduleManager::GetCurrentScheduleValue(state, con.GCGenRateCoefSchedPtr) * - std::pow(Pj - Pi, con.GCExpo); + GCGain = con.GenRateCoef * con.generateRateCoefSched->getCurrentVal() * std::pow(Pj - Pi, con.Expo); } else { GCGain = 0.0; } - con.GCGenRate = GCGain; + con.GenRate = GCGain; } } // from cutoff model for (auto &con : state.dataContaminantBalance->ZoneContamGenericCutoff) { int ZoneNum = con.ActualZoneNum; - if (state.dataContaminantBalance->ZoneAirGC(ZoneNum) < con.GCCutoffValue) { - GCGain = con.GCGenerateRate * ScheduleManager::GetCurrentScheduleValue(state, con.GCGenerateRateSchedPtr) * - (1.0 - state.dataContaminantBalance->ZoneAirGC(ZoneNum) / con.GCCutoffValue); + if (state.dataContaminantBalance->ZoneAirGC(ZoneNum) < con.CutoffValue) { + GCGain = con.GenerateRate * con.generateRateSched->getCurrentVal() * + (1.0 - state.dataContaminantBalance->ZoneAirGC(ZoneNum) / con.CutoffValue); } else { GCGain = 0.0; } - con.GCGenRate = GCGain; + con.GenRate = GCGain; } // From decay model for (auto &con : state.dataContaminantBalance->ZoneContamGenericDecay) { - int intSch = ScheduleManager::GetCurrentScheduleValue(state, con.GCEmiRateSchedPtr); - if (intSch == 0.0 || state.dataGlobal->BeginEnvrnFlag || state.dataGlobal->WarmupFlag) { - con.GCTime = 0.0; + int schVal = con.emitRateSched->getCurrentVal(); + if (schVal == 0 || state.dataGlobal->BeginEnvrnFlag || state.dataGlobal->WarmupFlag) { + con.Time = 0.0; } else { - con.GCTime += state.dataGlobal->TimeStepZoneSec; + con.Time += state.dataGlobal->TimeStepZoneSec; } - GCGain = con.GCInitEmiRate * intSch * std::exp(-con.GCTime / con.GCDelayTime); - con.GCGenRate = GCGain; + + GCGain = con.InitEmitRate * schVal * std::exp(-con.Time / con.DelayTime); + con.GenRate = GCGain; } // From boudary layer diffusion @@ -1833,10 +1504,10 @@ void InitZoneContSetPoints(EnergyPlusData &state) int ZoneNum = state.dataSurface->Surface(SurfNum).Zone; // Surface concentration level for the Boundary Layer Diffusion Controlled Model Real64 Cs = state.dataSurface->SurfGenericContam(SurfNum); - Sch = ScheduleManager::GetCurrentScheduleValue(state, con.GCTranCoefSchedPtr); - GCGain = con.GCTranCoef * Sch * state.dataSurface->Surface(SurfNum).Area * state.dataSurface->Surface(SurfNum).Multiplier * - (Cs / con.GCHenryCoef - state.dataContaminantBalance->ZoneAirGC(ZoneNum)) * 1.0e-6; - con.GCGenRate = GCGain; + Sch = con.transCoefSched->getCurrentVal(); + GCGain = con.TransCoef * Sch * state.dataSurface->Surface(SurfNum).Area * state.dataSurface->Surface(SurfNum).Multiplier * + (Cs / con.HenryCoef - state.dataContaminantBalance->ZoneAirGC(ZoneNum)) * 1.0e-6; + con.GenRate = GCGain; // Surface concentration level based on steady-state assumption state.dataSurface->SurfGenericContam(SurfNum) = Cs - GCGain * 1.0e6 / state.dataSurface->Surface(SurfNum).Multiplier / state.dataSurface->Surface(SurfNum).Area; @@ -1846,18 +1517,18 @@ void InitZoneContSetPoints(EnergyPlusData &state) for (auto &con : state.dataContaminantBalance->ZoneContamGenericDVS) { int SurfNum = con.SurfNum; int ZoneNum = state.dataSurface->Surface(SurfNum).Zone; - Sch = ScheduleManager::GetCurrentScheduleValue(state, con.GCDepoVeloPtr); - GCGain = -con.GCDepoVelo * state.dataSurface->Surface(SurfNum).Area * Sch * state.dataContaminantBalance->ZoneAirGC(ZoneNum) * + Sch = con.depoVeloSched->getCurrentVal(); + GCGain = -con.DepoVelo * state.dataSurface->Surface(SurfNum).Area * Sch * state.dataContaminantBalance->ZoneAirGC(ZoneNum) * state.dataSurface->Surface(SurfNum).Multiplier * 1.0e-6; - con.GCGenRate = GCGain; + con.GenRate = GCGain; } // From deposition rate sink model for (auto &con : state.dataContaminantBalance->ZoneContamGenericDRS) { int ZoneNum = con.ActualZoneNum; - Sch = ScheduleManager::GetCurrentScheduleValue(state, con.GCDepoRatePtr); - GCGain = -con.GCDepoRate * state.dataHeatBal->Zone(ZoneNum).Volume * Sch * state.dataContaminantBalance->ZoneAirGC(ZoneNum) * 1.0e-6; - con.GCGenRate = GCGain; + Sch = con.depoRateSched->getCurrentVal(); + GCGain = -con.DepoRate * state.dataHeatBal->Zone(ZoneNum).Volume * Sch * state.dataContaminantBalance->ZoneAirGC(ZoneNum) * 1.0e-6; + con.GenRate = GCGain; } } } @@ -1890,6 +1561,7 @@ void PredictZoneContaminants(EnergyPlusData &state, Real64 ZoneAirGCSetPoint; // Zone generic contaminant setpoint Real64 GCGain; // Zone generic contaminant internal load + Real64 timeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; // Update zone CO2 for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); @@ -2001,7 +1673,7 @@ void PredictZoneContaminants(EnergyPlusData &state, // Check all the controlled zones to see if it matches the zone simulated for (auto const &contaminantControlledZone : state.dataContaminantBalance->ContaminantControlledZone) { if (contaminantControlledZone.ActualZoneNum == ZoneNum) { - if (ScheduleManager::GetCurrentScheduleValue(state, contaminantControlledZone.AvaiSchedPtr) > 0.0) { + if (contaminantControlledZone.availSched->getCurrentVal() > 0.0) { ZoneAirCO2SetPoint = state.dataContaminantBalance->ZoneCO2SetPoint(contaminantControlledZone.ActualZoneNum); if (contaminantControlledZone.EMSOverrideCO2SetPointOn) { ZoneAirCO2SetPoint = contaminantControlledZone.EMSOverrideCO2SetPointValue; @@ -2013,7 +1685,7 @@ void PredictZoneContaminants(EnergyPlusData &state, } if (!ControlledCO2ZoneFlag) { for (auto const &contaminantControlledZone : state.dataContaminantBalance->ContaminantControlledZone) { - if (ScheduleManager::GetCurrentScheduleValue(state, contaminantControlledZone.AvaiSchedPtr) > 0.0) { + if (contaminantControlledZone.availSched->getCurrentVal() > 0.0) { ZoneAirCO2SetPoint = state.dataContaminantBalance->ZoneCO2SetPoint(contaminantControlledZone.ActualZoneNum); if (contaminantControlledZone.EMSOverrideCO2SetPointOn) { ZoneAirCO2SetPoint = contaminantControlledZone.EMSOverrideCO2SetPointValue; @@ -2046,8 +1718,6 @@ void PredictZoneContaminants(EnergyPlusData &state, // Calculate Co2 from infiltration + humidity added from latent load to determine system added/subtracted moisture. Real64 CO2Gain = state.dataContaminantBalance->ZoneCO2Gain(ZoneNum) * RhoAir * 1.0e6; - Real64 SysTimeStepInSeconds = Constant::SecInHour * state.dataHVACGlobal->TimeStepSys; - // Calculate the coefficients for the 3rd Order derivative for final // zone CO2. The A, B, C coefficients are analogous to the CO2 balance. // Assume that the system will have flow @@ -2063,7 +1733,7 @@ void PredictZoneContaminants(EnergyPlusData &state, state.dataContaminantBalance->MixingMassFlowCO2(ZoneNum) + thisZoneHB.MDotOA * state.dataContaminantBalance->OutdoorCO2; A = thisZoneHB.OAMFL + thisZoneHB.VAMFL + thisZoneHB.EAMFL + thisZoneHB.CTMFL + thisZoneHB.MixingMassFlowZone + thisZoneHB.MDotOA; } - C = RhoAir * state.dataHeatBal->Zone(ZoneNum).Volume * state.dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpCO2 / SysTimeStepInSeconds; + C = RhoAir * state.dataHeatBal->Zone(ZoneNum).Volume * state.dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpCO2 / timeStepSysSec; // Use a 3rd Order derivative to predict zone moisture addition or removal and // smooth the changes using the zone air capacitance. Positive values of CO2 Load means that @@ -2116,7 +1786,7 @@ void PredictZoneContaminants(EnergyPlusData &state, // Check all the controlled zones to see if it matches the zone simulated for (auto const &contaminantControlledZone : state.dataContaminantBalance->ContaminantControlledZone) { if (contaminantControlledZone.ActualZoneNum == ZoneNum) { - if (ScheduleManager::GetCurrentScheduleValue(state, contaminantControlledZone.AvaiSchedPtr) > 0.0) { + if (contaminantControlledZone.genericContamAvailSched->getCurrentVal() > 0.0) { ZoneAirGCSetPoint = state.dataContaminantBalance->ZoneGCSetPoint(contaminantControlledZone.ActualZoneNum); if (contaminantControlledZone.EMSOverrideCO2SetPointOn) { ZoneAirGCSetPoint = contaminantControlledZone.EMSOverrideGCSetPointValue; @@ -2128,7 +1798,7 @@ void PredictZoneContaminants(EnergyPlusData &state, } if (!ControlledGCZoneFlag) { for (auto const &contaminantControlledZone : state.dataContaminantBalance->ContaminantControlledZone) { - if (ScheduleManager::GetCurrentScheduleValue(state, contaminantControlledZone.AvaiSchedPtr) > 0.0) { + if (contaminantControlledZone.genericContamAvailSched->getCurrentVal() > 0.0) { ZoneAirGCSetPoint = state.dataContaminantBalance->ZoneGCSetPoint(contaminantControlledZone.ActualZoneNum); if (contaminantControlledZone.EMSOverrideCO2SetPointOn) { ZoneAirGCSetPoint = contaminantControlledZone.EMSOverrideGCSetPointValue; @@ -2159,8 +1829,6 @@ void PredictZoneContaminants(EnergyPlusData &state, // to determine system added/subtracted moisture. GCGain = state.dataContaminantBalance->ZoneGCGain(ZoneNum) * RhoAir * 1.0e6; - Real64 SysTimeStepInSeconds = Constant::SecInHour * state.dataHVACGlobal->TimeStepSys; - // Calculate the coefficients for the 3rd Order derivative for final // zone GC. The A, B, C coefficients are analogous to the GC balance. // Assume that the system will have flow @@ -2176,8 +1844,7 @@ void PredictZoneContaminants(EnergyPlusData &state, state.dataContaminantBalance->MixingMassFlowGC(ZoneNum) + thisZoneHB.MDotOA * state.dataContaminantBalance->OutdoorGC; A = thisZoneHB.OAMFL + thisZoneHB.VAMFL + thisZoneHB.EAMFL + thisZoneHB.CTMFL + thisZoneHB.MixingMassFlowZone + thisZoneHB.MDotOA; } - C = RhoAir * state.dataHeatBal->Zone(ZoneNum).Volume * state.dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpGenContam / - SysTimeStepInSeconds; + C = RhoAir * state.dataHeatBal->Zone(ZoneNum).Volume * state.dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpGenContam / timeStepSysSec; // Use a 3rd Order derivative to predict zone moisture addition or removal and // smooth the changes using the zone air capacitance. Positive values of GC Load means that @@ -2351,25 +2018,22 @@ void InverseModelCO2(EnergyPlusData &state, Real64 BB(0.0); Real64 M_inf(0.0); // Reversely solved infiltration mass flow rate - Real64 SysTimeStepInSeconds(0.0); - SysTimeStepInSeconds = Constant::SecInHour * state.dataHVACGlobal->TimeStepSys; + Real64 timeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; + + auto &hmZone = state.dataHybridModel->hybridModelZones(ZoneNum); - state.dataHeatBal->Zone(ZoneNum).ZoneMeasuredCO2Concentration = - ScheduleManager::GetCurrentScheduleValue(state, state.dataHybridModel->HybridModelZone(ZoneNum).ZoneMeasuredCO2ConcentrationSchedulePtr); + state.dataHeatBal->Zone(ZoneNum).ZoneMeasuredCO2Concentration = hmZone.measuredCO2ConcSched->getCurrentVal(); - if (state.dataEnvrn->DayOfYear >= state.dataHybridModel->HybridModelZone(ZoneNum).HybridStartDayOfYear && - state.dataEnvrn->DayOfYear <= state.dataHybridModel->HybridModelZone(ZoneNum).HybridEndDayOfYear) { + if (state.dataEnvrn->DayOfYear >= hmZone.HybridStartDayOfYear && state.dataEnvrn->DayOfYear <= hmZone.HybridEndDayOfYear) { state.dataContaminantBalance->ZoneAirCO2(ZoneNum) = state.dataHeatBal->Zone(ZoneNum).ZoneMeasuredCO2Concentration; auto const &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); - if (state.dataHybridModel->HybridModelZone(ZoneNum).InfiltrationCalc_C && state.dataHVACGlobal->UseZoneTimeStepHistory) { + if (hmZone.InfiltrationCalc_C && state.dataHVACGlobal->UseZoneTimeStepHistory) { static constexpr std::string_view RoutineNameInfiltration("CalcAirFlowSimple:Infiltration"); // Conditionally calculate the CO2-dependent and CO2-independent terms. - if (state.dataHybridModel->HybridModelZone(ZoneNum).IncludeSystemSupplyParameters) { - state.dataHeatBal->Zone(ZoneNum).ZoneMeasuredSupplyAirFlowRate = ScheduleManager::GetCurrentScheduleValue( - state, state.dataHybridModel->HybridModelZone(ZoneNum).ZoneSupplyAirMassFlowRateSchedulePtr); - state.dataHeatBal->Zone(ZoneNum).ZoneMeasuredSupplyAirCO2Concentration = ScheduleManager::GetCurrentScheduleValue( - state, state.dataHybridModel->HybridModelZone(ZoneNum).ZoneSupplyAirCO2ConcentrationSchedulePtr); + if (hmZone.IncludeSystemSupplyParameters) { + state.dataHeatBal->Zone(ZoneNum).ZoneMeasuredSupplyAirFlowRate = hmZone.supplyAirMassFlowRateSched->getCurrentVal(); + state.dataHeatBal->Zone(ZoneNum).ZoneMeasuredSupplyAirCO2Concentration = hmZone.supplyAirCO2ConcSched->getCurrentVal(); Real64 SumSysM_HM = state.dataHeatBal->Zone(ZoneNum).ZoneMeasuredSupplyAirFlowRate; Real64 SumSysMxCO2_HM = state.dataHeatBal->Zone(ZoneNum).ZoneMeasuredSupplyAirFlowRate * @@ -2386,7 +2050,7 @@ void InverseModelCO2(EnergyPlusData &state, state.dataContaminantBalance->MixingMassFlowCO2(ZoneNum) + thisZoneHB.MDotOA * state.dataContaminantBalance->OutdoorCO2; } - Real64 CC = RhoAir * state.dataHeatBal->Zone(ZoneNum).Volume * state.dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpCO2 / SysTimeStepInSeconds; + Real64 CC = RhoAir * state.dataHeatBal->Zone(ZoneNum).Volume * state.dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpCO2 / timeStepSysSec; Real64 DD = (3.0 * state.dataContaminantBalance->CO2ZoneTimeMinus1Temp(ZoneNum) - (3.0 / 2.0) * state.dataContaminantBalance->CO2ZoneTimeMinus2Temp(ZoneNum) + (1.0 / 3.0) * state.dataContaminantBalance->CO2ZoneTimeMinus3Temp(ZoneNum)); @@ -2406,20 +2070,18 @@ void InverseModelCO2(EnergyPlusData &state, } // Add threshold for air change rate - Real64 ACH_inf = max(0.0, min(10.0, M_inf / (CpAir * AirDensity / Constant::SecInHour * state.dataHeatBal->Zone(ZoneNum).Volume))); - M_inf = ACH_inf * state.dataHeatBal->Zone(ZoneNum).Volume * AirDensity / Constant::SecInHour; + Real64 ACH_inf = max(0.0, min(10.0, M_inf / (CpAir * AirDensity / Constant::rSecsInHour * state.dataHeatBal->Zone(ZoneNum).Volume))); + M_inf = ACH_inf * state.dataHeatBal->Zone(ZoneNum).Volume * AirDensity / Constant::rSecsInHour; state.dataHeatBal->Zone(ZoneNum).MCPIHM = M_inf; state.dataHeatBal->Zone(ZoneNum).InfilOAAirChangeRateHM = ACH_inf; } // Hybrid Model calculate people count - if (state.dataHybridModel->HybridModelZone(ZoneNum).PeopleCountCalc_C && state.dataHVACGlobal->UseZoneTimeStepHistory) { + if (hmZone.PeopleCountCalc_C && state.dataHVACGlobal->UseZoneTimeStepHistory) { state.dataHeatBal->Zone(ZoneNum).ZonePeopleActivityLevel = - ScheduleManager::GetCurrentScheduleValue(state, state.dataHybridModel->HybridModelZone(ZoneNum).ZonePeopleActivityLevelSchedulePtr); - Real64 ActivityLevel = - ScheduleManager::GetCurrentScheduleValue(state, state.dataHybridModel->HybridModelZone(ZoneNum).ZonePeopleActivityLevelSchedulePtr); - Real64 CO2GenRate = - ScheduleManager::GetCurrentScheduleValue(state, state.dataHybridModel->HybridModelZone(ZoneNum).ZonePeopleCO2GenRateSchedulePtr); + hmZone.peopleActivityLevelSched ? hmZone.peopleActivityLevelSched->getCurrentVal() : 0.0; + Real64 ActivityLevel = hmZone.peopleActivityLevelSched ? hmZone.peopleActivityLevelSched->getCurrentVal() : 0.0; + Real64 CO2GenRate = hmZone.peopleCO2GenRateSched ? hmZone.peopleCO2GenRateSched->getCurrentVal() : 0.0; if (ActivityLevel <= 0.0) { ActivityLevel = 130.0; // 130.0 is the default people activity level [W] } @@ -2428,11 +2090,9 @@ void InverseModelCO2(EnergyPlusData &state, } // Conditionally calculate the CO2-dependent and CO2-independent terms. - if (state.dataHybridModel->HybridModelZone(ZoneNum).IncludeSystemSupplyParameters) { - state.dataHeatBal->Zone(ZoneNum).ZoneMeasuredSupplyAirFlowRate = ScheduleManager::GetCurrentScheduleValue( - state, state.dataHybridModel->HybridModelZone(ZoneNum).ZoneSupplyAirMassFlowRateSchedulePtr); - state.dataHeatBal->Zone(ZoneNum).ZoneMeasuredSupplyAirCO2Concentration = ScheduleManager::GetCurrentScheduleValue( - state, state.dataHybridModel->HybridModelZone(ZoneNum).ZoneSupplyAirCO2ConcentrationSchedulePtr); + if (hmZone.IncludeSystemSupplyParameters) { + state.dataHeatBal->Zone(ZoneNum).ZoneMeasuredSupplyAirFlowRate = hmZone.supplyAirMassFlowRateSched->getCurrentVal(); + state.dataHeatBal->Zone(ZoneNum).ZoneMeasuredSupplyAirCO2Concentration = hmZone.supplyAirCO2ConcSched->getCurrentVal(); Real64 SumSysM_HM = state.dataHeatBal->Zone(ZoneNum).ZoneMeasuredSupplyAirFlowRate; Real64 SumSysMxCO2_HM = state.dataHeatBal->Zone(ZoneNum).ZoneMeasuredSupplyAirFlowRate * @@ -2454,7 +2114,7 @@ void InverseModelCO2(EnergyPlusData &state, thisZoneHB.MDotOA * state.dataContaminantBalance->OutdoorCO2; } - Real64 CC = RhoAir * state.dataHeatBal->Zone(ZoneNum).Volume * state.dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpCO2 / SysTimeStepInSeconds; + Real64 CC = RhoAir * state.dataHeatBal->Zone(ZoneNum).Volume * state.dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpCO2 / timeStepSysSec; Real64 DD = (3.0 * state.dataContaminantBalance->CO2ZoneTimeMinus1Temp(ZoneNum) - (3.0 / 2.0) * state.dataContaminantBalance->CO2ZoneTimeMinus2Temp(ZoneNum) + (1.0 / 3.0) * state.dataContaminantBalance->CO2ZoneTimeMinus3Temp(ZoneNum)); @@ -2633,7 +2293,7 @@ void CorrectZoneContaminants(EnergyPlusData &state, ZoneMassFlowRate += node.MassFlowRate / ZoneMult; } - Real64 SysTimeStepInSeconds = Constant::SecInHour * state.dataHVACGlobal->TimeStepSys; + Real64 timeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); // Calculate the coefficients for the 3rd order derivative for final @@ -2663,7 +2323,7 @@ void CorrectZoneContaminants(EnergyPlusData &state, B = CO2Gain + (state.afn->exchangeData(ZoneNum).SumMHrCO + state.afn->exchangeData(ZoneNum).SumMMHrCO) + CO2MassFlowRate; A = ZoneMassFlowRate + state.afn->exchangeData(ZoneNum).SumMHr + state.afn->exchangeData(ZoneNum).SumMMHr; } - C = RhoAir * state.dataHeatBal->Zone(ZoneNum).Volume * state.dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpCO2 / SysTimeStepInSeconds; + C = RhoAir * state.dataHeatBal->Zone(ZoneNum).Volume * state.dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpCO2 / timeStepSysSec; } if (state.dataContaminantBalance->Contaminant.CO2Simulation) { @@ -2704,9 +2364,8 @@ void CorrectZoneContaminants(EnergyPlusData &state, state.dataContaminantBalance->ZoneAirCO2(ZoneNum) = zoneAirCO2Temp; if (state.dataHybridModel->FlagHybridModel) { - if ((state.dataHybridModel->HybridModelZone(ZoneNum).InfiltrationCalc_C || - state.dataHybridModel->HybridModelZone(ZoneNum).PeopleCountCalc_C) && - (!state.dataGlobal->WarmupFlag) && (!state.dataGlobal->DoingSizing)) { + auto &hmZone = state.dataHybridModel->hybridModelZones(ZoneNum); + if ((hmZone.InfiltrationCalc_C || hmZone.PeopleCountCalc_C) && (!state.dataGlobal->WarmupFlag) && (!state.dataGlobal->DoingSizing)) { InverseModelCO2(state, ZoneNum, CO2Gain, CO2GainExceptPeople, ZoneMassFlowRate, CO2MassFlowRate, RhoAir); } } @@ -2730,7 +2389,7 @@ void CorrectZoneContaminants(EnergyPlusData &state, B = GCGain + (state.afn->exchangeData(ZoneNum).SumMHrGC + state.afn->exchangeData(ZoneNum).SumMMHrGC) + GCMassFlowRate; A = ZoneMassFlowRate + state.afn->exchangeData(ZoneNum).SumMHr + state.afn->exchangeData(ZoneNum).SumMMHr; } - C = RhoAir * state.dataHeatBal->Zone(ZoneNum).Volume * state.dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpGenContam / SysTimeStepInSeconds; + C = RhoAir * state.dataHeatBal->Zone(ZoneNum).Volume * state.dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpGenContam / timeStepSysSec; } if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) { diff --git a/src/EnergyPlus/ZoneContaminantPredictorCorrector.hh b/src/EnergyPlus/ZoneContaminantPredictorCorrector.hh index 230fd43e58f..ecfc41e162e 100644 --- a/src/EnergyPlus/ZoneContaminantPredictorCorrector.hh +++ b/src/EnergyPlus/ZoneContaminantPredictorCorrector.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -108,6 +108,10 @@ struct ZoneContaminantPredictorCorrectorData : BaseGlobalStruct bool MyEnvrnFlag = true; bool MyConfigOneTimeFlag = true; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ZoneDehumidifier.cc b/src/EnergyPlus/ZoneDehumidifier.cc index 7328ea976e2..95ae37990bb 100644 --- a/src/EnergyPlus/ZoneDehumidifier.cc +++ b/src/EnergyPlus/ZoneDehumidifier.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -48,9 +48,6 @@ // C++ Headers #include -// ObjexxFCL Headers -#include - // EnergyPlus Headers #include #include @@ -108,7 +105,6 @@ namespace ZoneDehumidifier { // Using/Aliasing using namespace DataLoopNode; - using namespace ScheduleManager; void SimZoneDehumidifier(EnergyPlusData &state, std::string const &CompName, // Name of the zone dehumidifier @@ -204,7 +200,7 @@ namespace ZoneDehumidifier { using WaterManager::SetupTankSupplyComponent; // SUBROUTINE PARAMETER DEFINITIONS: - static constexpr std::string_view RoutineName("GetZoneDehumidifierInput"); + static constexpr std::string_view routineName = "GetZoneDehumidifierInput"; static std::string const CurrentModuleObject("ZoneHVAC:Dehumidifier:DX"); Real64 constexpr RatedInletAirTemp(26.7); Real64 constexpr RatedInletAirRH(60.0); @@ -251,6 +247,9 @@ namespace ZoneDehumidifier { lAlphaBlanks, cAlphaFields, cNumericFields); + + ErrorObjectHeader eoh{routineName, CurrentModuleObject, Alphas(1)}; + Util::IsNameEmpty(state, Alphas(1), CurrentModuleObject, ErrorsFound); // A1, \field Name @@ -259,16 +258,10 @@ namespace ZoneDehumidifier { // A2, \field Availability Schedule Name if (lAlphaBlanks(2)) { - state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumidIndex).SchedPtr = ScheduleManager::ScheduleAlwaysOn; - } else { - state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumidIndex).SchedPtr = - GetScheduleIndex(state, Alphas(2)); // Convert schedule name to pointer - if (state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumidIndex).SchedPtr == 0) { - ShowSevereError(state, format("{} not found = {}", cAlphaFields(2), Alphas(2))); - ShowContinueError( - state, format("Occurs in {} = {}", CurrentModuleObject, state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumidIndex).Name)); - ErrorsFound = true; - } + state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumidIndex).availSched = Sched::GetScheduleAlwaysOn(state); + } else if ((state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumidIndex).availSched = Sched::GetSchedule(state, Alphas(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, cAlphaFields(2), Alphas(2)); + ErrorsFound = true; } // A3 , \field Air Inlet Node Name @@ -330,17 +323,9 @@ namespace ZoneDehumidifier { GetCurveIndex(state, Alphas(5)); // Convert curve name to index number if (state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumidIndex).WaterRemovalCurveIndex == 0) { if (lAlphaBlanks(5)) { - ShowSevereError(state, - format("{}:{}=\"{}\" is required, missing for {} = {}", - RoutineName, - CurrentModuleObject, - cAlphaFields(5), - cAlphaFields(1), - state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumidIndex).Name)); + ShowSevereEmptyField(state, eoh, cAlphaFields(5)); } else { - ShowSevereError(state, format("{} not found = {}", cAlphaFields(5), Alphas(5))); - ShowContinueError( - state, format("Occurs in {} = {}", CurrentModuleObject, state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumidIndex).Name)); + ShowSevereItemNotFound(state, eoh, cAlphaFields(5), Alphas(5)); } ErrorsFound = true; } else { @@ -348,7 +333,7 @@ namespace ZoneDehumidifier { ErrorsFound |= Curve::CheckCurveDims(state, state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumidIndex).WaterRemovalCurveIndex, // Curve index {2}, // Valid dimensions - RoutineName, // Routine name + routineName, // Routine name CurrentModuleObject, // Object Type state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumidIndex).Name, // Object Name cAlphaFields(5)); // Field Name @@ -369,17 +354,9 @@ namespace ZoneDehumidifier { GetCurveIndex(state, Alphas(6)); // convert curve name to number if (state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumidIndex).EnergyFactorCurveIndex == 0) { if (lAlphaBlanks(6)) { - ShowSevereError(state, - format("{}:{}=\"{}\" is required, missing for {} = {}", - RoutineName, - CurrentModuleObject, - cAlphaFields(6), - cAlphaFields(1), - state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumidIndex).Name)); + ShowSevereEmptyField(state, eoh, cAlphaFields(6)); } else { - ShowSevereError(state, format("{} not found = {}", cAlphaFields(6), Alphas(6))); - ShowContinueError( - state, format("Occurs in {} = {}", CurrentModuleObject, state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumidIndex).Name)); + ShowSevereItemNotFound(state, eoh, cAlphaFields(6), Alphas(6)); } ErrorsFound = true; } else { @@ -387,7 +364,7 @@ namespace ZoneDehumidifier { ErrorsFound |= Curve::CheckCurveDims(state, state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumidIndex).EnergyFactorCurveIndex, // Curve index {2}, // Valid dimensions - RoutineName, // Routine name + routineName, // Routine name CurrentModuleObject, // Object Type state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumidIndex).Name, // Object Name cAlphaFields(6)); // Field Name @@ -408,17 +385,9 @@ namespace ZoneDehumidifier { GetCurveIndex(state, Alphas(7)); // convert curve name to number if (state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumidIndex).PartLoadCurveIndex == 0) { if (lAlphaBlanks(7)) { - ShowSevereError(state, - format("{}:{}=\"{}\" is required, missing for {} = {}", - RoutineName, - CurrentModuleObject, - cAlphaFields(7), - cAlphaFields(1), - state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumidIndex).Name)); + ShowSevereEmptyField(state, eoh, cAlphaFields(7)); } else { - ShowSevereError(state, format("{} not found = {}", cAlphaFields(7), Alphas(7))); - ShowContinueError( - state, format("Occurs in {} = {}", CurrentModuleObject, state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumidIndex).Name)); + ShowSevereItemNotFound(state, eoh, cAlphaFields(7), Alphas(7)); } ErrorsFound = true; } else { @@ -426,7 +395,7 @@ namespace ZoneDehumidifier { ErrorsFound |= Curve::CheckCurveDims(state, state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumidIndex).PartLoadCurveIndex, // Curve index {1}, // Valid dimensions - RoutineName, // Routine name + routineName, // Routine name CurrentModuleObject, // Object Type state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumidIndex).Name, // Object Name cAlphaFields(7)); // Field Name @@ -483,7 +452,7 @@ namespace ZoneDehumidifier { lNumericBlanks.deallocate(); if (ErrorsFound) { - ShowFatalError(state, format("{}:{}: Errors found in input.", RoutineName, CurrentModuleObject)); + ShowFatalError(state, format("{}:{}: Errors found in input.", routineName, CurrentModuleObject)); } for (ZoneDehumidIndex = 1; ZoneDehumidIndex <= NumDehumidifiers; ++ZoneDehumidIndex) { @@ -767,7 +736,7 @@ namespace ZoneDehumidifier { InletAirHumRat = state.dataLoopNodes->Node(AirInletNodeNum).HumRat; InletAirRH = 100.0 * PsyRhFnTdbWPb(state, InletAirTemp, InletAirHumRat, state.dataEnvrn->OutBaroPress, RoutineName); // RH in percent (%) - if (QZnDehumidReq < 0.0 && GetCurrentScheduleValue(state, state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumNum).SchedPtr) > 0.0 && + if (QZnDehumidReq < 0.0 && state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumNum).availSched->getCurrentVal() > 0.0 && InletAirTemp >= state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumNum).MinInletAirTemp && InletAirTemp <= state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumNum).MaxInletAirTemp) { // A dehumidification load is being requested and dehumidifier is available (schedule value > 0) @@ -806,7 +775,7 @@ namespace ZoneDehumidifier { WaterRemovalVolRate = WaterRemovalRateFactor * state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumNum).RatedWaterRemoval; WaterRemovalMassRate = - WaterRemovalVolRate / (24.0 * Constant::SecInHour * 1000.0) * + WaterRemovalVolRate / (Constant::rSecsInDay * 1000.0) * RhoH2O(max((InletAirTemp - 11.0), 1.0)); //(L/d)/(24 hr/day *3600 sec/hr * 1000 L/m3) | Density of water, minimum temp = 1.0C if (WaterRemovalMassRate > 0.0) { @@ -988,7 +957,7 @@ namespace ZoneDehumidifier { state.dataLoopNodes->Node(AirInletNodeNum).MassFlowRate = 0.0; // If available but didn't operate, then set electric power = off cycle parasitic load. // Else, electric power = 0.0 - if (GetCurrentScheduleValue(state, state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumNum).SchedPtr) > 0.0) { + if (state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumNum).availSched->getCurrentVal() > 0.0) { ElectricPowerAvg = state.dataZoneDehumidifier->ZoneDehumid(ZoneDehumNum).OffCycleParasiticLoad; // off cycle parasitic is on entire timestep } else { diff --git a/src/EnergyPlus/ZoneDehumidifier.hh b/src/EnergyPlus/ZoneDehumidifier.hh index 1e62add786d..11e90932a84 100644 --- a/src/EnergyPlus/ZoneDehumidifier.hh +++ b/src/EnergyPlus/ZoneDehumidifier.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -76,7 +76,7 @@ namespace ZoneDehumidifier { // input data and others required during calculations std::string Name; // Name of unit std::string UnitType; // Type of unit - int SchedPtr = 0; // Index number to availability schedule + Sched::Schedule *availSched = nullptr; // availability schedule Real64 RatedWaterRemoval = 0.0; // Rated water removal [liters/day] Real64 RatedEnergyFactor = 0.0; // Rated energy factor [liters/kWh] Real64 RatedAirVolFlow = 0.0; // Rated air flow rate through the dehumidifier [m3/s] @@ -162,6 +162,10 @@ struct ZoneDehumidifierData : BaseGlobalStruct bool GetInputFlag = true; // Set to FALSE after first time input is "gotten" EPVector ZoneDehumid; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ZoneEquipmentManager.cc b/src/EnergyPlus/ZoneEquipmentManager.cc index 27f89d9398a..6d0a79c73c5 100644 --- a/src/EnergyPlus/ZoneEquipmentManager.cc +++ b/src/EnergyPlus/ZoneEquipmentManager.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -52,7 +52,6 @@ // ObjexxFCL Headers #include -#include // EnergyPlus Headers #include @@ -182,7 +181,7 @@ void GetZoneEquipment(EnergyPlusData &state) state.dataZoneEquipmentManager->GetZoneEquipmentInputFlag = false; state.dataZoneEquip->ZoneEquipInputsFilled = true; - state.dataZoneEquipmentManager->NumOfTimeStepInDay = state.dataGlobal->NumOfTimeStepInHour * 24; + state.dataZoneEquipmentManager->NumOfTimeStepInDay = state.dataGlobal->TimeStepsInHour * Constant::iHoursInDay; int MaxNumOfEquipTypes = 0; for (int Counter = 1; Counter <= state.dataGlobal->NumOfZones; ++Counter) { @@ -425,7 +424,7 @@ void sizeZoneSpaceEquipmentPart1(EnergyPlusData &state, // Sign convention: SysOutputProvided <0 Supply air is heated on entering zone (zone is cooled) // SysOutputProvided >0 Supply air is cooled on entering zone (zone is heated) if (!state.dataZoneEnergyDemand->DeadBandOrSetback(zoneNum) && std::abs(zsEnergyDemand.RemainingOutputRequired) > HVAC::SmallLoad) { - // Determine design supply air temperture and design supply air temperature difference + // Determine design supply air temperature and design supply air temperature difference if (zsEnergyDemand.RemainingOutputRequired < 0.0) { // Cooling case // If the user specify the design cooling supply air temperature, then if (zsCalcSizing.ZnCoolDgnSAMethod == SupplyAirTemperature) { @@ -588,19 +587,20 @@ void sizeZoneSpaceEquipmentPart2(EnergyPlusData &state, int zoneNodeNum = (spaceNum > 0) ? state.dataHeatBal->space(spaceNum).SystemZoneNodeNumber : state.dataHeatBal->Zone(zoneNum).SystemZoneNodeNumber; Real64 RetTemp = (returnNodeNum > 0) ? state.dataLoopNodes->Node(returnNodeNum).Temp : state.dataLoopNodes->Node(zoneNodeNum).Temp; - auto const &zoneTstatSP = state.dataHeatBalFanSys->TempZoneThermostatSetPoint(zoneNum); + + auto &zoneTstatSetpt = state.dataHeatBalFanSys->zoneTstatSetpts(zoneNum); if (zsCalcSizing.HeatLoad > 0.0) { zsCalcSizing.HeatZoneRetTemp = RetTemp; - zsCalcSizing.HeatTstatTemp = (zoneTstatSP > 0.0) ? zoneTstatSP : state.dataHeatBalFanSys->ZoneThermostatSetPointLo(zoneNum); - zsCalcSizing.CoolTstatTemp = state.dataHeatBalFanSys->ZoneThermostatSetPointHi(zoneNum); + zsCalcSizing.HeatTstatTemp = (zoneTstatSetpt.setpt > 0.0) ? zoneTstatSetpt.setpt : zoneTstatSetpt.setptLo; + zsCalcSizing.CoolTstatTemp = zoneTstatSetpt.setptHi; } else if (zsCalcSizing.CoolLoad > 0.0) { zsCalcSizing.CoolZoneRetTemp = RetTemp; - zsCalcSizing.CoolTstatTemp = (zoneTstatSP > 0.0) ? zoneTstatSP : state.dataHeatBalFanSys->ZoneThermostatSetPointHi(zoneNum); - zsCalcSizing.HeatTstatTemp = state.dataHeatBalFanSys->ZoneThermostatSetPointLo(zoneNum); + zsCalcSizing.CoolTstatTemp = (zoneTstatSetpt.setpt > 0.0) ? zoneTstatSetpt.setpt : zoneTstatSetpt.setptHi; + zsCalcSizing.HeatTstatTemp = zoneTstatSetpt.setptLo; } else { zsCalcSizing.CoolZoneRetTemp = RetTemp; - zsCalcSizing.HeatTstatTemp = state.dataHeatBalFanSys->ZoneThermostatSetPointLo(zoneNum); - zsCalcSizing.CoolTstatTemp = state.dataHeatBalFanSys->ZoneThermostatSetPointHi(zoneNum); + zsCalcSizing.HeatTstatTemp = zoneTstatSetpt.setptLo; + zsCalcSizing.CoolTstatTemp = zoneTstatSetpt.setptHi; } } @@ -820,9 +820,9 @@ void SetUpZoneSizingArrays(EnergyPlusData &state) state.dataZoneEquipmentManager->AvgData.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); for (int DesDayNum = 1; DesDayNum <= state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays; ++DesDayNum) { auto &thisDesDayWeather = state.dataSize->DesDayWeath(DesDayNum); - thisDesDayWeather.Temp.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); - thisDesDayWeather.HumRat.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); - thisDesDayWeather.Press.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); + thisDesDayWeather.Temp.allocate(state.dataGlobal->TimeStepsInHour * Constant::iHoursInDay); + thisDesDayWeather.HumRat.allocate(state.dataGlobal->TimeStepsInHour * Constant::iHoursInDay); + thisDesDayWeather.Press.allocate(state.dataGlobal->TimeStepsInHour * Constant::iHoursInDay); thisDesDayWeather.Temp = 0.0; thisDesDayWeather.HumRat = 0.0; thisDesDayWeather.Press = 0.0; @@ -1085,13 +1085,13 @@ void calcSizingOA(EnergyPlusData &state, if (((spaceNum == 0) && (people.ZonePtr == zoneNum)) || ((spaceNum > 0) && (people.spaceIndex == spaceNum))) { Real64 numPeople = people.NumberOfPeople * zoneMult; TotPeopleInZone += numPeople; - Real64 SchMax = ScheduleManager::GetScheduleMaxValue(state, people.NumberOfPeoplePtr); + Real64 SchMax = people.sched->getMaxVal(state); if (SchMax > 0) { zsFinalSizing.ZonePeakOccupancy += numPeople * SchMax; } else { zsFinalSizing.ZonePeakOccupancy += numPeople; } - ZoneMinOccupancy += numPeople * ScheduleManager::GetScheduleMinValue(state, people.NumberOfPeoplePtr); + ZoneMinOccupancy += numPeople * people.sched->getMinVal(state); } } zsFinalSizing.TotalZoneFloorArea = (floorArea * zoneMult); @@ -1213,8 +1213,8 @@ void fillZoneSizingFromInput(EnergyPlusData &state, zoneSizing.zoneLatentSizing = zoneSizingInput.zoneLatentSizing; zoneSizing.zoneRHDehumidifySetPoint = zoneSizingInput.zoneRHDehumidifySetPoint; zoneSizing.zoneRHHumidifySetPoint = zoneSizingInput.zoneRHHumidifySetPoint; - zoneSizing.zoneRHDehumidifySchIndex = zoneSizingInput.zoneRHDehumidifySchIndex; - zoneSizing.zoneRHHumidifySchIndex = zoneSizingInput.zoneRHHumidifySchIndex; + zoneSizing.zoneRHDehumidifySched = zoneSizingInput.zoneRHDehumidifySched; + zoneSizing.zoneRHHumidifySched = zoneSizingInput.zoneRHHumidifySched; zoneSizing.ZnLatCoolDgnSAMethod = zoneSizingInput.ZnLatCoolDgnSAMethod; zoneSizing.ZnLatHeatDgnSAMethod = zoneSizingInput.ZnLatHeatDgnSAMethod; calcZoneSizing.ZnCoolDgnSAMethod = zoneSizingInput.ZnCoolDgnSAMethod; @@ -1246,8 +1246,8 @@ void fillZoneSizingFromInput(EnergyPlusData &state, calcZoneSizing.zoneLatentSizing = zoneSizingInput.zoneLatentSizing; calcZoneSizing.zoneRHDehumidifySetPoint = zoneSizingInput.zoneRHDehumidifySetPoint; calcZoneSizing.zoneRHHumidifySetPoint = zoneSizingInput.zoneRHHumidifySetPoint; - calcZoneSizing.zoneRHDehumidifySchIndex = zoneSizingInput.zoneRHDehumidifySchIndex; - calcZoneSizing.zoneRHHumidifySchIndex = zoneSizingInput.zoneRHHumidifySchIndex; + calcZoneSizing.zoneRHDehumidifySched = zoneSizingInput.zoneRHDehumidifySched; + calcZoneSizing.zoneRHHumidifySched = zoneSizingInput.zoneRHHumidifySched; calcZoneSizing.ZnLatCoolDgnSAMethod = zoneSizingInput.ZnLatCoolDgnSAMethod; calcZoneSizing.LatentCoolDesHumRat = zoneSizingInput.LatentCoolDesHumRat; calcZoneSizing.CoolDesHumRatDiff = zoneSizingInput.CoolDesHumRatDiff; @@ -1299,8 +1299,8 @@ void fillZoneSizingFromInput(EnergyPlusData &state, zsFinalSizing.zoneLatentSizing = zoneSizingInput.zoneLatentSizing; zsFinalSizing.zoneRHDehumidifySetPoint = zoneSizingInput.zoneRHDehumidifySetPoint; zsFinalSizing.zoneRHHumidifySetPoint = zoneSizingInput.zoneRHHumidifySetPoint; - zsFinalSizing.zoneRHDehumidifySchIndex = zoneSizingInput.zoneRHDehumidifySchIndex; - zsFinalSizing.zoneRHHumidifySchIndex = zoneSizingInput.zoneRHHumidifySchIndex; + zsFinalSizing.zoneRHDehumidifySched = zoneSizingInput.zoneRHDehumidifySched; + zsFinalSizing.zoneRHHumidifySched = zoneSizingInput.zoneRHHumidifySched; zsFinalSizing.ZnLatCoolDgnSAMethod = zoneSizingInput.ZnLatCoolDgnSAMethod; zsFinalSizing.LatentCoolDesHumRat = zoneSizingInput.LatentCoolDesHumRat; zsFinalSizing.CoolDesHumRatDiff = zoneSizingInput.CoolDesHumRatDiff; @@ -1340,8 +1340,8 @@ void fillZoneSizingFromInput(EnergyPlusData &state, zsCalcFinalSizing.zoneLatentSizing = zoneSizingInput.zoneLatentSizing; zsCalcFinalSizing.zoneRHDehumidifySetPoint = zoneSizingInput.zoneRHDehumidifySetPoint; zsCalcFinalSizing.zoneRHHumidifySetPoint = zoneSizingInput.zoneRHHumidifySetPoint; - zsCalcFinalSizing.zoneRHDehumidifySchIndex = zoneSizingInput.zoneRHDehumidifySchIndex; - zsCalcFinalSizing.zoneRHHumidifySchIndex = zoneSizingInput.zoneRHHumidifySchIndex; + zsCalcFinalSizing.zoneRHDehumidifySched = zoneSizingInput.zoneRHDehumidifySched; + zsCalcFinalSizing.zoneRHHumidifySched = zoneSizingInput.zoneRHHumidifySched; zsCalcFinalSizing.ZnLatCoolDgnSAMethod = zoneSizingInput.ZnLatCoolDgnSAMethod; zsCalcFinalSizing.LatentCoolDesHumRat = zoneSizingInput.LatentCoolDesHumRat; zsCalcFinalSizing.CoolDesHumRatDiff = zoneSizingInput.CoolDesHumRatDiff; @@ -2338,7 +2338,7 @@ std::string sizingPeakTimeStamp(EnergyPlusData const &state, int timeStepIndex) int minute = 0; Real64 second = 0; - Real64 timeInSeconds = timeStepIndex * state.dataGlobal->MinutesPerTimeStep * minToSec; + Real64 timeInSeconds = timeStepIndex * state.dataGlobal->MinutesInTimeStep * minToSec; General::ParseTime(timeInSeconds, hour, minute, second); return format(PeakHrMinFmt, hour, minute); } @@ -2430,9 +2430,9 @@ void writeZszSpsz(EnergyPlusData &state, int Minutes = 0; int TimeStepIndex = 0; for (int HourCounter = 1; HourCounter <= 24; ++HourCounter) { - for (int TimeStepCounter = 1; TimeStepCounter <= state.dataGlobal->NumOfTimeStepInHour; ++TimeStepCounter) { + for (int TimeStepCounter = 1; TimeStepCounter <= state.dataGlobal->TimeStepsInHour; ++TimeStepCounter) { ++TimeStepIndex; - Minutes += state.dataGlobal->MinutesPerTimeStep; + Minutes += state.dataGlobal->MinutesInTimeStep; int HourPrint = HourCounter - 1; if (Minutes == 60) { Minutes = 0; @@ -3181,21 +3181,22 @@ void UpdateZoneSizing(EnergyPlusData &state, Constant::CallIndicator const CallI } } break; case Constant::CallIndicator::DuringDay: { - int timeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; + int timeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->TimeStepsInHour + state.dataGlobal->TimeStep; Real64 fracTimeStepZone = state.dataHVACGlobal->FracTimeStepZone; // save the results of the ideal zone component calculation in the CalcZoneSizing sequence variables for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) { if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).IsControlled) continue; + auto const &zoneTstatSetpt = state.dataHeatBalFanSys->zoneTstatSetpts(CtrlZoneNum); // auto &zoneSizing = state.dataSize->ZoneSizing(state.dataSize->CurOverallSimDay, CtrlZoneNum); // auto &calcZoneSizing = state.dataSize->CalcZoneSizing(state.dataSize->CurOverallSimDay, CtrlZoneNum); // auto const &zoneThermostatHi = state.dataHeatBalFanSys->ZoneThermostatSetPointHi(CtrlZoneNum); // auto const &zoneThermostatLo = state.dataHeatBalFanSys->ZoneThermostatSetPointLo(CtrlZoneNum); updateZoneSizingDuringDay(state.dataSize->ZoneSizing(state.dataSize->CurOverallSimDay, CtrlZoneNum), state.dataSize->CalcZoneSizing(state.dataSize->CurOverallSimDay, CtrlZoneNum), - state.dataHeatBalFanSys->ZoneThermostatSetPointHi(CtrlZoneNum), - state.dataHeatBalFanSys->ZoneThermostatSetPointLo(CtrlZoneNum), + zoneTstatSetpt.setptHi, + zoneTstatSetpt.setptLo, state.dataSize->FinalZoneSizing(CtrlZoneNum).ZoneSizThermSetPtHi, state.dataSize->FinalZoneSizing(CtrlZoneNum).ZoneSizThermSetPtLo, timeStepInDay, @@ -3204,8 +3205,8 @@ void UpdateZoneSizing(EnergyPlusData &state, Constant::CallIndicator const CallI for (int spaceNum : state.dataHeatBal->Zone(CtrlZoneNum).spaceIndexes) { updateZoneSizingDuringDay(state.dataSize->SpaceSizing(state.dataSize->CurOverallSimDay, spaceNum), state.dataSize->CalcSpaceSizing(state.dataSize->CurOverallSimDay, spaceNum), - state.dataHeatBalFanSys->ZoneThermostatSetPointHi(CtrlZoneNum), - state.dataHeatBalFanSys->ZoneThermostatSetPointLo(CtrlZoneNum), + zoneTstatSetpt.setptHi, + zoneTstatSetpt.setptLo, state.dataSize->FinalZoneSizing(CtrlZoneNum).ZoneSizThermSetPtHi, state.dataSize->FinalZoneSizing(CtrlZoneNum).ZoneSizThermSetPtLo, timeStepInDay, @@ -4571,41 +4572,32 @@ void updateSystemOutputRequired(EnergyPlusData &state, // re-evaluate if loads are now such that in dead band or set back switch (state.dataHeatBalFanSys->TempControlType(ZoneNum)) { - case HVAC::ThermostatType::Uncontrolled: + case HVAC::SetptType::Uncontrolled: { // uncontrolled zone; shouldn't ever get here, but who knows state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = false; - break; - case HVAC::ThermostatType::SingleHeating: - if ((energy.RemainingOutputRequired - 1.0) < 0.0) { - state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = true; - } else { - state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = false; - } - break; - case HVAC::ThermostatType::SingleCooling: - if ((energy.RemainingOutputRequired + 1.0) > 0.0) { - state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = true; - } else { - state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = false; - } - break; - case HVAC::ThermostatType::SingleHeatCool: - if (energy.RemainingOutputReqToHeatSP < 0.0 && energy.RemainingOutputReqToCoolSP > 0.0) { - state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = true; - } else { - state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = false; - } - break; - case HVAC::ThermostatType::DualSetPointWithDeadBand: - if (energy.RemainingOutputReqToHeatSP < 0.0 && energy.RemainingOutputReqToCoolSP > 0.0) { - state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = true; - } else { - state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = false; - } - break; - default: - break; - } + } break; + + case HVAC::SetptType::SingleHeat: { + state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = ((energy.RemainingOutputRequired - 1.0) < 0.0); + } break; + + case HVAC::SetptType::SingleCool: { + state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = ((energy.RemainingOutputRequired + 1.0) > 0.0); + } break; + + case HVAC::SetptType::SingleHeatCool: { + state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = + (energy.RemainingOutputReqToHeatSP < 0.0 && energy.RemainingOutputReqToCoolSP > 0.0); + } break; + + case HVAC::SetptType::DualHeatCool: { + state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = + (energy.RemainingOutputReqToHeatSP < 0.0 && energy.RemainingOutputReqToCoolSP > 0.0); + } break; + + default: { + } break; + } // swtich if (EquipPriorityNum > -1) { // now store remaining load at the by sequence level @@ -4680,41 +4672,33 @@ void updateSystemOutputRequired(EnergyPlusData &state, // re-evaluate if loads are now such that in dead band or set back switch (state.dataHeatBalFanSys->TempControlType(ZoneNum)) { - case HVAC::ThermostatType::Uncontrolled: + case HVAC::SetptType::Uncontrolled: { // uncontrolled zone; shouldn't ever get here, but who knows state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = false; - break; - case HVAC::ThermostatType::SingleHeating: - if ((energy.RemainingOutputRequired - 1.0) < 0.0) { - state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = true; - } else { - state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = false; - } - break; - case HVAC::ThermostatType::SingleCooling: - if ((energy.RemainingOutputRequired + 1.0) > 0.0) { - state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = true; - } else { - state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = false; - } - break; - case HVAC::ThermostatType::SingleHeatCool: - if (energy.RemainingOutputReqToHeatSP < 0.0 && energy.RemainingOutputReqToCoolSP > 0.0) { - state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = true; - } else { - state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = false; - } - break; - case HVAC::ThermostatType::DualSetPointWithDeadBand: - if (energy.RemainingOutputReqToHeatSP < 0.0 && energy.RemainingOutputReqToCoolSP > 0.0) { - state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = true; - } else { - state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = false; - } - break; - default: - break; - } + } break; + + case HVAC::SetptType::SingleHeat: { + state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = ((energy.RemainingOutputRequired - 1.0) < 0.0); + } break; + + case HVAC::SetptType::SingleCool: { + state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = ((energy.RemainingOutputRequired + 1.0) > 0.0); + } break; + + case HVAC::SetptType::SingleHeatCool: { + state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = + (energy.RemainingOutputReqToHeatSP < 0.0 && energy.RemainingOutputReqToCoolSP > 0.0); + } break; + + case HVAC::SetptType::DualHeatCool: { + state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = + (energy.RemainingOutputReqToHeatSP < 0.0 && energy.RemainingOutputReqToCoolSP > 0.0); + } break; + + default: { + } break; + + } // switch } break; case DataZoneEquipment::LoadDist::Uniform: @@ -5558,16 +5542,14 @@ void CalcAirFlowSimple(EnergyPlusData &state, Real64 hybridControlZoneMAT = state.dataZoneTempPredictorCorrector->zoneHeatBalance(hybridControlVentilation.ZonePtr).MixingMAT; // Check scheduled temperatures - if (hybridControlVentilation.MinIndoorTempSchedPtr > 0) { - hybridControlVentilation.MinIndoorTemperature = - ScheduleManager::GetCurrentScheduleValue(state, hybridControlVentilation.MinIndoorTempSchedPtr); + if (hybridControlVentilation.minIndoorTempSched != nullptr) { + hybridControlVentilation.MinIndoorTemperature = hybridControlVentilation.minIndoorTempSched->getCurrentVal(); } - if (hybridControlVentilation.MaxIndoorTempSchedPtr > 0) { - hybridControlVentilation.MaxIndoorTemperature = - ScheduleManager::GetCurrentScheduleValue(state, hybridControlVentilation.MaxIndoorTempSchedPtr); + if (hybridControlVentilation.maxIndoorTempSched != nullptr) { + hybridControlVentilation.MaxIndoorTemperature = hybridControlVentilation.maxIndoorTempSched->getCurrentVal(); } // Ensure the minimum indoor temperature <= the maximum indoor temperature - if (hybridControlVentilation.MinIndoorTempSchedPtr > 0 || hybridControlVentilation.MaxIndoorTempSchedPtr > 0) { + if (hybridControlVentilation.minIndoorTempSched != nullptr || hybridControlVentilation.maxIndoorTempSched != nullptr) { if (hybridControlVentilation.MinIndoorTemperature > hybridControlVentilation.MaxIndoorTemperature) { ++hybridControlVentilation.IndoorTempErrCount; if (hybridControlVentilation.IndoorTempErrCount < 2) { @@ -5587,16 +5569,14 @@ void CalcAirFlowSimple(EnergyPlusData &state, hybridControlVentilation.MinIndoorTemperature = hybridControlVentilation.MaxIndoorTemperature; } } - if (hybridControlVentilation.MinOutdoorTempSchedPtr > 0) { - hybridControlVentilation.MinOutdoorTemperature = - ScheduleManager::GetCurrentScheduleValue(state, hybridControlVentilation.MinOutdoorTempSchedPtr); + if (hybridControlVentilation.minOutdoorTempSched != nullptr) { + hybridControlVentilation.MinOutdoorTemperature = hybridControlVentilation.minOutdoorTempSched->getCurrentVal(); } - if (hybridControlVentilation.MaxOutdoorTempSchedPtr > 0) { - hybridControlVentilation.MaxOutdoorTemperature = - ScheduleManager::GetCurrentScheduleValue(state, hybridControlVentilation.MaxOutdoorTempSchedPtr); + if (hybridControlVentilation.maxOutdoorTempSched != nullptr) { + hybridControlVentilation.MaxOutdoorTemperature = hybridControlVentilation.maxOutdoorTempSched->getCurrentVal(); } // Ensure the minimum outdoor temperature <= the maximum outdoor temperature - if (hybridControlVentilation.MinOutdoorTempSchedPtr > 0 || hybridControlVentilation.MaxOutdoorTempSchedPtr > 0) { + if (hybridControlVentilation.minOutdoorTempSched != nullptr || hybridControlVentilation.maxOutdoorTempSched != nullptr) { if (hybridControlVentilation.MinOutdoorTemperature > hybridControlVentilation.MaxOutdoorTemperature) { ++hybridControlVentilation.OutdoorTempErrCount; if (hybridControlVentilation.OutdoorTempErrCount < 2) { @@ -5616,8 +5596,8 @@ void CalcAirFlowSimple(EnergyPlusData &state, hybridControlVentilation.MinIndoorTemperature = hybridControlVentilation.MaxIndoorTemperature; } } - if (hybridControlVentilation.DeltaTempSchedPtr > 0) { - hybridControlVentilation.DelTemperature = ScheduleManager::GetCurrentScheduleValue(state, hybridControlVentilation.DeltaTempSchedPtr); + if (hybridControlVentilation.deltaTempSched != nullptr) { + hybridControlVentilation.DelTemperature = hybridControlVentilation.deltaTempSched->getCurrentVal(); } // Skip this if the zone is below the minimum indoor temperature limit if ((hybridControlZoneMAT < hybridControlVentilation.MinIndoorTemperature) && (!thisVentilation.EMSSimpleVentOn)) continue; @@ -5640,7 +5620,7 @@ void CalcAirFlowSimple(EnergyPlusData &state, if (thisVentilation.ModelType == DataHeatBalance::VentilationModelType::DesignFlowRate) { // CR6845 if calculated < 0, don't propagate. - VVF = thisVentilation.DesignLevel * ScheduleManager::GetCurrentScheduleValue(state, thisVentilation.SchedPtr); + VVF = thisVentilation.DesignLevel * thisVentilation.availSched->getCurrentVal(); if (thisVentilation.EMSSimpleVentOn) VVF = thisVentilation.EMSimpleVentFlowRate; @@ -5783,8 +5763,8 @@ void CalcAirFlowSimple(EnergyPlusData &state, } else { Cd = 0.40 + 0.0045 * std::abs(TempExt - thisMixingMAT); } - Qw = Cw * thisVentilation.OpenArea * ScheduleManager::GetCurrentScheduleValue(state, thisVentilation.OpenAreaSchedPtr) * WindSpeedExt; - Qst = Cd * thisVentilation.OpenArea * ScheduleManager::GetCurrentScheduleValue(state, thisVentilation.OpenAreaSchedPtr) * + Qw = Cw * thisVentilation.OpenArea * thisVentilation.openAreaFracSched->getCurrentVal() * WindSpeedExt; + Qst = Cd * thisVentilation.OpenArea * thisVentilation.openAreaFracSched->getCurrentVal() * std::sqrt(2.0 * 9.81 * thisVentilation.DH * std::abs(TempExt - thisMixingMAT) / (thisMixingMAT + 273.15)); VVF = std::sqrt(Qw * Qw + Qst * Qst); if (thisVentilation.EMSSimpleVentOn) VVF = thisVentilation.EMSimpleVentFlowRate; @@ -5822,8 +5802,8 @@ void CalcAirFlowSimple(EnergyPlusData &state, thisMixing.ReportFlag = false; // Get scheduled delta temperature - if (thisMixing.DeltaTempSchedPtr > 0) { - TD = ScheduleManager::GetCurrentScheduleValue(state, thisMixing.DeltaTempSchedPtr); + if (thisMixing.deltaTempSched != nullptr) { + TD = thisMixing.deltaTempSched->getCurrentVal(); } Real64 TZN = 0.0; // Temperature of this Zone/Space Real64 TZM = 0.0; // Temperature of From Zone/Space @@ -5867,9 +5847,9 @@ void CalcAirFlowSimple(EnergyPlusData &state, // Ensure the minimum indoor temperature <= the maximum indoor temperature Real64 MixingTmin = 0.0; Real64 MixingTmax = 0.0; - if (thisMixing.MinIndoorTempSchedPtr > 0) MixingTmin = ScheduleManager::GetCurrentScheduleValue(state, thisMixing.MinIndoorTempSchedPtr); - if (thisMixing.MaxIndoorTempSchedPtr > 0) MixingTmax = ScheduleManager::GetCurrentScheduleValue(state, thisMixing.MaxIndoorTempSchedPtr); - if (thisMixing.MinIndoorTempSchedPtr > 0 && thisMixing.MaxIndoorTempSchedPtr > 0) { + if (thisMixing.minIndoorTempSched != nullptr) MixingTmin = thisMixing.minIndoorTempSched->getCurrentVal(); + if (thisMixing.maxIndoorTempSched != nullptr) MixingTmax = thisMixing.maxIndoorTempSched->getCurrentVal(); + if (thisMixing.minIndoorTempSched != nullptr && thisMixing.maxIndoorTempSched != nullptr) { if (MixingTmin > MixingTmax) { ++thisMixing.IndoorTempErrCount; if (thisMixing.IndoorTempErrCount < 2) { @@ -5889,16 +5869,16 @@ void CalcAirFlowSimple(EnergyPlusData &state, MixingTmin = MixingTmax; } } - if (thisMixing.MinIndoorTempSchedPtr > 0) { + if (thisMixing.minIndoorTempSched != nullptr) { if (TZN < MixingTmin) MixingLimitFlag = true; } - if (thisMixing.MaxIndoorTempSchedPtr > 0) { + if (thisMixing.maxIndoorTempSched != nullptr) { if (TZN > MixingTmax) MixingLimitFlag = true; } // Ensure the minimum source temperature <= the maximum source temperature - if (thisMixing.MinSourceTempSchedPtr > 0) MixingTmin = ScheduleManager::GetCurrentScheduleValue(state, thisMixing.MinSourceTempSchedPtr); - if (thisMixing.MaxSourceTempSchedPtr > 0) MixingTmax = ScheduleManager::GetCurrentScheduleValue(state, thisMixing.MaxSourceTempSchedPtr); - if (thisMixing.MinSourceTempSchedPtr > 0 && thisMixing.MaxSourceTempSchedPtr > 0) { + if (thisMixing.minSourceTempSched != nullptr) MixingTmin = thisMixing.minSourceTempSched->getCurrentVal(); + if (thisMixing.maxSourceTempSched != nullptr) MixingTmax = thisMixing.maxSourceTempSched->getCurrentVal(); + if (thisMixing.minSourceTempSched != nullptr && thisMixing.maxSourceTempSched != nullptr) { if (MixingTmin > MixingTmax) { ++thisMixing.SourceTempErrCount; if (thisMixing.SourceTempErrCount < 2) { @@ -5918,19 +5898,17 @@ void CalcAirFlowSimple(EnergyPlusData &state, MixingTmin = MixingTmax; } } - if (thisMixing.MinSourceTempSchedPtr > 0) { + if (thisMixing.minSourceTempSched != nullptr) { if (TZM < MixingTmin) MixingLimitFlag = true; } - if (thisMixing.MaxSourceTempSchedPtr > 0) { + if (thisMixing.maxSourceTempSched != nullptr) { if (TZM > MixingTmax) MixingLimitFlag = true; } // Ensure the minimum outdoor temperature <= the maximum outdoor temperature Real64 TempExt = state.dataHeatBal->Zone(thisZoneNum).OutDryBulbTemp; - if (thisMixing.MinOutdoorTempSchedPtr > 0) - MixingTmin = ScheduleManager::GetCurrentScheduleValue(state, thisMixing.MinOutdoorTempSchedPtr); - if (thisMixing.MaxOutdoorTempSchedPtr > 0) - MixingTmax = ScheduleManager::GetCurrentScheduleValue(state, thisMixing.MaxOutdoorTempSchedPtr); - if (thisMixing.MinOutdoorTempSchedPtr > 0 && thisMixing.MaxOutdoorTempSchedPtr > 0) { + if (thisMixing.minOutdoorTempSched != nullptr) MixingTmin = thisMixing.minOutdoorTempSched->getCurrentVal(); + if (thisMixing.maxOutdoorTempSched != nullptr) MixingTmax = thisMixing.maxOutdoorTempSched->getCurrentVal(); + if (thisMixing.minOutdoorTempSched != nullptr && thisMixing.maxOutdoorTempSched != nullptr) { if (MixingTmin > MixingTmax) { ++thisMixing.OutdoorTempErrCount; if (thisMixing.OutdoorTempErrCount < 2) { @@ -5950,10 +5928,10 @@ void CalcAirFlowSimple(EnergyPlusData &state, MixingTmin = MixingTmax; } } - if (thisMixing.MinOutdoorTempSchedPtr > 0) { + if (thisMixing.minOutdoorTempSched != nullptr) { if (TempExt < MixingTmin) MixingLimitFlag = true; } - if (thisMixing.MaxOutdoorTempSchedPtr > 0) { + if (thisMixing.maxOutdoorTempSched != nullptr) { if (TempExt > MixingTmax) MixingLimitFlag = true; } } @@ -6071,8 +6049,8 @@ void CalcAirFlowSimple(EnergyPlusData &state, auto &fromZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(fromZoneNum); Real64 TD = thisCrossMixing.DeltaTemperature; // Delta Temp limit // Get scheduled delta temperature - if (thisCrossMixing.DeltaTempSchedPtr > 0) { - TD = ScheduleManager::GetCurrentScheduleValue(state, thisCrossMixing.DeltaTempSchedPtr); + if (thisCrossMixing.deltaTempSched != nullptr) { + TD = thisCrossMixing.deltaTempSched->getCurrentVal(); } Real64 thisMCPxM = 0.0; Real64 thisMCPTxM = 0.0; @@ -6110,11 +6088,9 @@ void CalcAirFlowSimple(EnergyPlusData &state, // Ensure the minimum indoor temperature <= the maximum indoor temperature Real64 MixingTmin = 0.0; Real64 MixingTmax = 0.0; - if (thisCrossMixing.MinIndoorTempSchedPtr > 0) - MixingTmin = ScheduleManager::GetCurrentScheduleValue(state, thisCrossMixing.MinIndoorTempSchedPtr); - if (thisCrossMixing.MaxIndoorTempSchedPtr > 0) - MixingTmax = ScheduleManager::GetCurrentScheduleValue(state, thisCrossMixing.MaxIndoorTempSchedPtr); - if (thisCrossMixing.MinIndoorTempSchedPtr > 0 && thisCrossMixing.MaxIndoorTempSchedPtr > 0) { + if (thisCrossMixing.minIndoorTempSched != nullptr) MixingTmin = thisCrossMixing.minIndoorTempSched->getCurrentVal(); + if (thisCrossMixing.maxIndoorTempSched != nullptr) MixingTmax = thisCrossMixing.maxIndoorTempSched->getCurrentVal(); + if (thisCrossMixing.minIndoorTempSched != nullptr && thisCrossMixing.maxIndoorTempSched != nullptr) { if (MixingTmin > MixingTmax) { ++thisCrossMixing.IndoorTempErrCount; if (thisCrossMixing.IndoorTempErrCount < 2) { @@ -6134,18 +6110,16 @@ void CalcAirFlowSimple(EnergyPlusData &state, MixingTmin = MixingTmax; } } - if (thisCrossMixing.MinIndoorTempSchedPtr > 0) { + if (thisCrossMixing.minIndoorTempSched != nullptr) { if (TZN < MixingTmin) MixingLimitFlag = true; } - if (thisCrossMixing.MaxIndoorTempSchedPtr > 0) { + if (thisCrossMixing.maxIndoorTempSched != nullptr) { if (TZN > MixingTmax) MixingLimitFlag = true; } // Ensure the minimum source temperature <= the maximum source temperature - if (thisCrossMixing.MinSourceTempSchedPtr > 0) - MixingTmin = ScheduleManager::GetCurrentScheduleValue(state, thisCrossMixing.MinSourceTempSchedPtr); - if (thisCrossMixing.MaxSourceTempSchedPtr > 0) - MixingTmax = ScheduleManager::GetCurrentScheduleValue(state, thisCrossMixing.MaxSourceTempSchedPtr); - if (thisCrossMixing.MinSourceTempSchedPtr > 0 && thisCrossMixing.MaxSourceTempSchedPtr > 0) { + if (thisCrossMixing.minSourceTempSched != nullptr) MixingTmin = thisCrossMixing.minSourceTempSched->getCurrentVal(); + if (thisCrossMixing.maxSourceTempSched != nullptr) MixingTmax = thisCrossMixing.maxSourceTempSched->getCurrentVal(); + if (thisCrossMixing.minSourceTempSched != nullptr && thisCrossMixing.maxSourceTempSched != nullptr) { if (MixingTmin > MixingTmax) { ++thisCrossMixing.SourceTempErrCount; if (thisCrossMixing.SourceTempErrCount < 2) { @@ -6165,19 +6139,17 @@ void CalcAirFlowSimple(EnergyPlusData &state, MixingTmin = MixingTmax; } } - if (thisCrossMixing.MinSourceTempSchedPtr > 0) { + if (thisCrossMixing.minSourceTempSched != nullptr) { if (TZM < MixingTmin) MixingLimitFlag = true; } - if (thisCrossMixing.MaxSourceTempSchedPtr > 0) { + if (thisCrossMixing.maxSourceTempSched != nullptr) { if (TZM > MixingTmax) MixingLimitFlag = true; } // Ensure the minimum outdoor temperature <= the maximum outdoor temperature Real64 TempExt = state.dataHeatBal->Zone(thisZoneNum).OutDryBulbTemp; - if (thisCrossMixing.MinOutdoorTempSchedPtr > 0) - MixingTmin = ScheduleManager::GetCurrentScheduleValue(state, thisCrossMixing.MinOutdoorTempSchedPtr); - if (thisCrossMixing.MaxOutdoorTempSchedPtr > 0) - MixingTmax = ScheduleManager::GetCurrentScheduleValue(state, thisCrossMixing.MaxOutdoorTempSchedPtr); - if (thisCrossMixing.MinOutdoorTempSchedPtr > 0 && thisCrossMixing.MaxOutdoorTempSchedPtr > 0) { + if (thisCrossMixing.minOutdoorTempSched != nullptr) MixingTmin = thisCrossMixing.minOutdoorTempSched->getCurrentVal(); + if (thisCrossMixing.maxOutdoorTempSched != nullptr) MixingTmax = thisCrossMixing.maxOutdoorTempSched->getCurrentVal(); + if (thisCrossMixing.minOutdoorTempSched != nullptr && thisCrossMixing.maxOutdoorTempSched != nullptr) { if (MixingTmin > MixingTmax) { ++thisCrossMixing.OutdoorTempErrCount; if (thisCrossMixing.OutdoorTempErrCount < 2) { @@ -6197,10 +6169,10 @@ void CalcAirFlowSimple(EnergyPlusData &state, MixingTmin = MixingTmax; } } - if (thisCrossMixing.MinOutdoorTempSchedPtr > 0) { + if (thisCrossMixing.minOutdoorTempSched != nullptr) { if (TempExt < MixingTmin) MixingLimitFlag = true; } - if (thisCrossMixing.MaxOutdoorTempSchedPtr > 0) { + if (thisCrossMixing.maxOutdoorTempSched != nullptr) { if (TempExt > MixingTmax) MixingLimitFlag = true; } if (MixingLimitFlag) continue; @@ -6316,7 +6288,7 @@ void CalcAirFlowSimple(EnergyPlusData &state, } else { Real64 AirDensityZoneB = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, TZoneB, HumRatZoneB, RoutineNameRefrigerationDoorMixing); - Real64 SchedDoorOpen = ScheduleManager::GetCurrentScheduleValue(state, state.dataHeatBal->RefDoorMixing(ZoneA).OpenSchedPtr(j)); + Real64 SchedDoorOpen = state.dataHeatBal->RefDoorMixing(ZoneA).openScheds(j)->getCurrentVal(); if (SchedDoorOpen == 0.0) continue; Real64 DoorHeight = state.dataHeatBal->RefDoorMixing(ZoneA).DoorHeight(j); Real64 DoorArea = state.dataHeatBal->RefDoorMixing(ZoneA).DoorArea(j); @@ -6437,7 +6409,7 @@ void CalcAirFlowSimple(EnergyPlusData &state, Real64 AirDensity = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, TempExt, HumRatExt, RoutineNameInfiltration); Real64 CpAir = PsyCpAirFnW(HumRatExt); Real64 MCpI_temp = 0.0; - Real64 scheduleFrac = ScheduleManager::GetCurrentScheduleValue(state, thisInfiltration.SchedPtr); + Real64 scheduleFrac = thisInfiltration.sched->getCurrentVal(); if (scheduleFrac > 0.0) { // CR7751 should maybe use code below, indoor conditions instead of outdoor conditions // AirDensity = PsyRhoAirFnPbTdbW(state, OutBaroPress, MixingMAT(NZ), MixingHumRat(NZ)) @@ -6564,12 +6536,12 @@ void CalcAirFlowSimple(EnergyPlusData &state, state, state.dataEnvrn->OutBaroPress, state.dataHeatBal->Zone(NZ).OutDryBulbTemp, HumRatExt, RoutineNameZoneAirBalance); Real64 CpAir = Psychrometrics::PsyCpAirFnW(HumRatExt); thisZoneAirBalance.ERVMassFlowRate *= AirDensity; - thisZoneHB.MDotOA = std::sqrt(pow_2(thisZoneAirBalance.NatMassFlowRate) + pow_2(thisZoneAirBalance.IntMassFlowRate) + - pow_2(thisZoneAirBalance.ExhMassFlowRate) + pow_2(thisZoneAirBalance.ERVMassFlowRate) + - pow_2(thisZoneAirBalance.InfMassFlowRate) + - pow_2(AirDensity * thisZoneAirBalance.InducedAirRate * - ScheduleManager::GetCurrentScheduleValue(state, thisZoneAirBalance.InducedAirSchedPtr))) + - thisZoneAirBalance.BalMassFlowRate; + thisZoneHB.MDotOA = + std::sqrt(pow_2(thisZoneAirBalance.NatMassFlowRate) + pow_2(thisZoneAirBalance.IntMassFlowRate) + + pow_2(thisZoneAirBalance.ExhMassFlowRate) + pow_2(thisZoneAirBalance.ERVMassFlowRate) + + pow_2(thisZoneAirBalance.InfMassFlowRate) + + pow_2(AirDensity * thisZoneAirBalance.InducedAirRate * thisZoneAirBalance.inducedAirSched->getCurrentVal())) + + thisZoneAirBalance.BalMassFlowRate; thisZoneHB.MDotCPOA = thisZoneHB.MDotOA * CpAir; } } diff --git a/src/EnergyPlus/ZoneEquipmentManager.hh b/src/EnergyPlus/ZoneEquipmentManager.hh index a67e398dd36..98b51b6b4e4 100644 --- a/src/EnergyPlus/ZoneEquipmentManager.hh +++ b/src/EnergyPlus/ZoneEquipmentManager.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -280,6 +280,10 @@ struct ZoneEquipmentManagerData : BaseGlobalStruct bool InitZoneEquipmentEnvrnFlag = true; bool FirstPassZoneEquipFlag = true; // indicates first pass through zone equipment, used to reset selected ZoneEqSizing variables + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ZonePlenum.cc b/src/EnergyPlus/ZonePlenum.cc index fc7983c044c..4debbeee80b 100644 --- a/src/EnergyPlus/ZonePlenum.cc +++ b/src/EnergyPlus/ZonePlenum.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -49,9 +49,6 @@ #include #include -// ObjexxFCL Headers -#include - // EnergyPlus Headers #include #include diff --git a/src/EnergyPlus/ZonePlenum.hh b/src/EnergyPlus/ZonePlenum.hh index 168c8446774..f0f01b4b2f6 100644 --- a/src/EnergyPlus/ZonePlenum.hh +++ b/src/EnergyPlus/ZonePlenum.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -192,6 +192,10 @@ struct ZonePlenumData : BaseGlobalStruct EPVector ZoneRetPlenCond; EPVector ZoneSupPlenCond; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/ZoneTempPredictorCorrector.cc b/src/EnergyPlus/ZoneTempPredictorCorrector.cc index bfd6a4138c3..ad20f8b4766 100644 --- a/src/EnergyPlus/ZoneTempPredictorCorrector.cc +++ b/src/EnergyPlus/ZoneTempPredictorCorrector.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -47,11 +47,11 @@ // C++ Headers #include +#include #include // ObjexxFCL Headers #include -#include // EnergyPlus Headers #include @@ -145,28 +145,26 @@ enum class AdaptiveComfortModel Num }; -static constexpr std::array(HVAC::ThermostatType::Num)> ValidControlTypes = { - "Uncontrolled", - "ThermostatSetpoint:SingleHeating", - "ThermostatSetpoint:SingleCooling", - "ThermostatSetpoint:SingleHeatingOrCooling", - "ThermostatSetpoint:DualSetpoint"}; +static constexpr std::array setptTypeNames = {"Uncontrolled", + "ThermostatSetpoint:SingleHeating", + "ThermostatSetpoint:SingleCooling", + "ThermostatSetpoint:SingleHeatingOrCooling", + "ThermostatSetpoint:DualSetpoint"}; -static constexpr std::array(HVAC::ThermostatType::Num)> ValidControlTypesUC = { - "UNCONTROLLED", - "THERMOSTATSETPOINT:SINGLEHEATING", - "THERMOSTATSETPOINT:SINGLECOOLING", - "THERMOSTATSETPOINT:SINGLEHEATINGORCOOLING", - "THERMOSTATSETPOINT:DUALSETPOINT"}; +static constexpr std::array setptTypeNamesUC = {"UNCONTROLLED", + "THERMOSTATSETPOINT:SINGLEHEATING", + "THERMOSTATSETPOINT:SINGLECOOLING", + "THERMOSTATSETPOINT:SINGLEHEATINGORCOOLING", + "THERMOSTATSETPOINT:DUALSETPOINT"}; -static constexpr std::array(HVAC::ThermostatType::Num)> ValidComfortControlTypes = { +static constexpr std::array comfortSetptTypeNames = { "Uncontrolled", "ThermostatSetpoint:ThermalComfort:Fanger:SingleHeating", "ThermostatSetpoint:ThermalComfort:Fanger:SingleCooling", "ThermostatSetpoint:ThermalComfort:Fanger:SingleHeatingOrCooling", "ThermostatSetpoint:ThermalComfort:Fanger:DualSetpoint"}; -static constexpr std::array(HVAC::ThermostatType::Num)> ValidComfortControlTypesUC = { +static constexpr std::array comfortSetptTypeNamesUC = { "UNCONTROLLED", "THERMOSTATSETPOINT:THERMALCOMFORT:FANGER:SINGLEHEATING", "THERMOSTATSETPOINT:THERMALCOMFORT:FANGER:SINGLECOOLING", @@ -262,30 +260,19 @@ void GetZoneAirSetPoints(EnergyPlusData &state) using General::CheckCreatedZoneItemName; using General::FindNumberInList; - using ScheduleManager::CheckScheduleValue; - using ScheduleManager::CheckScheduleValueMinMax; - using ScheduleManager::GetScheduleIndex; - using ScheduleManager::GetScheduleMaxValue; - using ScheduleManager::GetScheduleMinValue; - // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetZoneAirSetpoints: "); + static constexpr std::string_view routineName = "GetZoneAirSetpoints"; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int TempControlledZoneNum; // The Splitter that you are currently loading input into int NumAlphas; int NumNums; - int ControlTypeNum; int IOStat; bool ErrorsFound(false); bool errFlag; - int CTIndex; int HumidControlledZoneNum; // The Humidity Controller that information is being loaded into - bool ValidScheduleControlType; - int SchedMin; - int SchedMax; int ActualZoneNum; - int SchedTypeIndex; int ComfortControlledZoneNum; // The Splitter that you are currently loading input into int i; @@ -301,15 +288,15 @@ void GetZoneAirSetPoints(EnergyPlusData &state) struct NeededControlTypes { // Members 4= the four control types + uncontrolled - std::array(HVAC::ThermostatType::Num)> MustHave = {false, false, false, false, false}; - std::array(HVAC::ThermostatType::Num)> DidHave = {false, false, false, false, false}; + std::array(HVAC::SetptType::Num)> MustHave = {false, false, false, false, false}; + std::array(HVAC::SetptType::Num)> DidHave = {false, false, false, false, false}; }; struct NeededComfortControlTypes { // Members 4= the four control types + uncontrolled - std::array(HVAC::ThermostatType::Num)> MustHave = {false, false, false, false, false}; - std::array(HVAC::ThermostatType::Num)> DidHave = {false, false, false, false, false}; + std::array(HVAC::SetptType::Num)> MustHave = {false, false, false, false, false}; + std::array(HVAC::SetptType::Num)> DidHave = {false, false, false, false, false}; }; // Object Data @@ -322,65 +309,65 @@ void GetZoneAirSetPoints(EnergyPlusData &state) "Dioxide Capacity Multiplier, Generic Contaminant Capacity Multiplier\n"); static constexpr std::string_view Format_701("Zone Volume Capacitance Multiplier,{:8.3F} ,{:8.3F},{:8.3F},{:8.3F}\n"); - auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; + auto &s_ipsc = state.dataIPShortCut; + auto &s_ztpc = state.dataZoneTempPredictorCorrector; + + auto &TStatObjects = state.dataZoneCtrls->TStatObjects; + auto &Zone = state.dataHeatBal->Zone; + auto &ZoneList = state.dataHeatBal->ZoneList; + auto &ComfortTStatObjects = state.dataZoneCtrls->ComfortTStatObjects; int NumOfZones = state.dataGlobal->NumOfZones; - auto &cAlphaArgs = state.dataIPShortCut->cAlphaArgs; - auto &rNumericArgs = state.dataIPShortCut->rNumericArgs; - auto &lNumericFieldBlanks = state.dataIPShortCut->lNumericFieldBlanks; - auto &lAlphaFieldBlanks = state.dataIPShortCut->lAlphaFieldBlanks; - auto &cAlphaFieldNames = state.dataIPShortCut->cAlphaFieldNames; - auto &cNumericFieldNames = state.dataIPShortCut->cNumericFieldNames; - auto &inputProcessor = state.dataInputProcessing->inputProcessor; - - cCurrentModuleObject = cZControlTypes(static_cast(ZoneControlTypes::TStat)); + auto &s_ip = state.dataInputProcessing->inputProcessor; + + s_ipsc->cCurrentModuleObject = cZControlTypes(static_cast(ZoneControlTypes::TStat)); // Update Num in state and make local convenience copy - int NumTStatStatements = state.dataZoneCtrls->NumTStatStatements = inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - state.dataZoneCtrls->TStatObjects.allocate(NumTStatStatements); + int NumTStatStatements = state.dataZoneCtrls->NumTStatStatements = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + TStatObjects.allocate(NumTStatStatements); // Pre-scan for use of Zone lists in TStat statements (i.e. Global application of TStat) state.dataZoneCtrls->NumTempControlledZones = 0; for (Item = 1; Item <= NumTStatStatements; ++Item) { - auto &TStatObjects = state.dataZoneCtrls->TStatObjects(Item); - inputProcessor->getObjectItem(state, - cCurrentModuleObject, - Item, - cAlphaArgs, - NumAlphas, - rNumericArgs, - NumNums, - IOStat, - lNumericFieldBlanks, - lAlphaFieldBlanks, - cAlphaFieldNames, - cNumericFieldNames); - Util::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); - - TStatObjects.Name = cAlphaArgs(1); - Item1 = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Item, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + Util::IsNameEmpty(state, s_ipsc->cAlphaArgs(1), s_ipsc->cCurrentModuleObject, ErrorsFound); + + TStatObjects(Item).Name = s_ipsc->cAlphaArgs(1); + Item1 = Util::FindItemInList(s_ipsc->cAlphaArgs(2), Zone); ZLItem = 0; - if (Item1 == 0 && state.dataHeatBal->NumOfZoneLists > 0) ZLItem = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->ZoneList); + if (Item1 == 0 && state.dataHeatBal->NumOfZoneLists > 0) ZLItem = Util::FindItemInList(s_ipsc->cAlphaArgs(2), ZoneList); if (Item1 > 0) { - TStatObjects.TempControlledZoneStartPtr = state.dataZoneCtrls->NumTempControlledZones + 1; + TStatObjects(Item).TempControlledZoneStartPtr = state.dataZoneCtrls->NumTempControlledZones + 1; ++state.dataZoneCtrls->NumTempControlledZones; - TStatObjects.NumOfZones = 1; - TStatObjects.ZoneListActive = false; - TStatObjects.ZoneOrZoneListPtr = Item1; + TStatObjects(Item).NumOfZones = 1; + TStatObjects(Item).ZoneListActive = false; + TStatObjects(Item).ZoneOrZoneListPtr = Item1; } else if (ZLItem > 0) { auto const &ZoneList = state.dataHeatBal->ZoneList(ZLItem); - TStatObjects.TempControlledZoneStartPtr = state.dataZoneCtrls->NumTempControlledZones + 1; + TStatObjects(Item).TempControlledZoneStartPtr = state.dataZoneCtrls->NumTempControlledZones + 1; state.dataZoneCtrls->NumTempControlledZones += ZoneList.NumOfZones; - TStatObjects.NumOfZones = ZoneList.NumOfZones; - TStatObjects.ZoneListActive = true; - TStatObjects.ZoneOrZoneListPtr = ZLItem; + TStatObjects(Item).NumOfZones = ZoneList.NumOfZones; + TStatObjects(Item).ZoneListActive = true; + TStatObjects(Item).ZoneOrZoneListPtr = ZLItem; } else { - ShowSevereError( - state, format("{}=\"{}\" invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); ErrorsFound = true; } } if (ErrorsFound) { - ShowSevereError(state, format("GetZoneAirSetpoints: Errors with invalid names in {} objects.", cCurrentModuleObject)); + ShowSevereError(state, format("GetZoneAirSetpoints: Errors with invalid names in {} objects.", s_ipsc->cCurrentModuleObject)); ShowContinueError(state, "...These will not be read in. Other errors may occur."); state.dataZoneCtrls->NumTempControlledZones = 0; } @@ -391,609 +378,500 @@ void GetZoneAirSetPoints(EnergyPlusData &state) CTSchedMapToControlledZone.dimension(state.dataZoneCtrls->NumTempControlledZones, 0); TempControlledZoneNum = 0; - state.dataZoneTempPredictorCorrector->NumOnOffCtrZone = 0; + s_ztpc->NumOnOffCtrZone = 0; for (Item = 1; Item <= NumTStatStatements; ++Item) { - auto &TStatObjects = state.dataZoneCtrls->TStatObjects(Item); - inputProcessor->getObjectItem(state, - cCurrentModuleObject, - Item, - cAlphaArgs, - NumAlphas, - rNumericArgs, - NumNums, - IOStat, - lNumericFieldBlanks, - lAlphaFieldBlanks, - cAlphaFieldNames, - cNumericFieldNames); - for (Item1 = 1; Item1 <= TStatObjects.NumOfZones; ++Item1) { + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Item, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + for (Item1 = 1; Item1 <= TStatObjects(Item).NumOfZones; ++Item1) { ++TempControlledZoneNum; - auto &TempControlledZone = state.dataZoneCtrls->TempControlledZone(TempControlledZoneNum); - if (TStatObjects.ZoneListActive) { - auto &ZoneList = state.dataHeatBal->ZoneList(TStatObjects.ZoneOrZoneListPtr); - cAlphaArgs(2) = state.dataHeatBal->Zone(ZoneList.Zone(Item1)).Name; + auto &tempZone = state.dataZoneCtrls->TempControlledZone(TempControlledZoneNum); + + if (TStatObjects(Item).ZoneListActive) { + s_ipsc->cAlphaArgs(2) = Zone(ZoneList(TStatObjects(Item).ZoneOrZoneListPtr).Zone(Item1)).Name; } - int ZoneAssigned = Util::FindItemInList( - cAlphaArgs(2), state.dataZoneCtrls->TempControlledZone, &DataZoneControls::ZoneTempControls::ZoneName, TempControlledZoneNum - 1); + int ZoneAssigned = Util::FindItemInList(s_ipsc->cAlphaArgs(2), + state.dataZoneCtrls->TempControlledZone, + &DataZoneControls::ZoneTempControls::ZoneName, + TempControlledZoneNum - 1); if (ZoneAssigned == 0) { - TempControlledZone.ZoneName = cAlphaArgs(2); - TempControlledZone.ActualZoneNum = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone); - if (TempControlledZone.ActualZoneNum == 0) { - ShowSevereError( - state, - format( - "{}=\"{}\" invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); + tempZone.ZoneName = s_ipsc->cAlphaArgs(2); + tempZone.ActualZoneNum = Util::FindItemInList(s_ipsc->cAlphaArgs(2), Zone); + if (tempZone.ActualZoneNum == 0) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); ErrorsFound = true; } else { - state.dataHeatBal->Zone(TempControlledZone.ActualZoneNum).TempControlledZoneIndex = TempControlledZoneNum; + Zone(tempZone.ActualZoneNum).TempControlledZoneIndex = TempControlledZoneNum; } } else { - TempControlledZone.ZoneName = cAlphaArgs(2); // for continuity - ShowSevereError(state, - format("{}=\"{}\" invalid {}=\"{}\" zone previously assigned.", - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(2), - cAlphaArgs(2))); - ShowContinueError( - state, - format("...Zone was previously assigned to Thermostat=\"{}\".", state.dataZoneCtrls->TempControlledZone(ZoneAssigned).Name)); + tempZone.ZoneName = s_ipsc->cAlphaArgs(2); // for continuity + ShowSevereDuplicateAssignment( + state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2), state.dataZoneCtrls->TempControlledZone(ZoneAssigned).Name); ErrorsFound = true; continue; } - if (!TStatObjects.ZoneListActive) { - TempControlledZone.Name = cAlphaArgs(1); + if (!TStatObjects(Item).ZoneListActive) { + tempZone.Name = s_ipsc->cAlphaArgs(1); } else { - auto &ZoneList = state.dataHeatBal->ZoneList(TStatObjects.ZoneOrZoneListPtr); + auto &ZoneList = state.dataHeatBal->ZoneList(TStatObjects(Item).ZoneOrZoneListPtr); CheckCreatedZoneItemName(state, RoutineName, - cCurrentModuleObject, - state.dataHeatBal->Zone(ZoneList.Zone(Item1)).Name, + s_ipsc->cCurrentModuleObject, + Zone(ZoneList.Zone(Item1)).Name, ZoneList.MaxZoneNameLength, - TStatObjects.Name, + TStatObjects(Item).Name, state.dataZoneCtrls->TempControlledZone, TempControlledZoneNum - 1, - TempControlledZone.Name, + tempZone.Name, errFlag); if (errFlag) ErrorsFound = true; } - TempControlledZone.ControlTypeSchedName = cAlphaArgs(3); - TempControlledZone.CTSchedIndex = GetScheduleIndex(state, cAlphaArgs(3)); + tempZone.setptTypeSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(3)); if (Item1 == 1) { // only show error on first of several if zone list - if (TempControlledZone.CTSchedIndex == 0) { - ShowSevereError( - state, - format( - "{}=\"{}\" invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(3), cAlphaArgs(3))); + if (tempZone.setptTypeSched == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3)); + ErrorsFound = true; + } else if (!tempZone.setptTypeSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 4.0)) { + Sched::ShowSevereBadMinMax( + state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3), Clusive::In, 0.0, Clusive::In, 4.0); ErrorsFound = true; - } else { - // Check validity of control types. - ValidScheduleControlType = CheckScheduleValueMinMax(state, TempControlledZone.CTSchedIndex, ">=", 0.0, "<=", 4.0); - if (!ValidScheduleControlType) { - ShowSevereError( - state, - format("{}=\"{}\" invalid range {}=\"{}\"", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); - ShowContinueError(state, "..contains values outside of range [0,4]."); - ErrorsFound = true; - } } } - if (lAlphaFieldBlanks(7)) { + if (s_ipsc->lAlphaFieldBlanks(7)) { NumAlphas = 5; - } else if (lAlphaFieldBlanks(9)) { + } else if (s_ipsc->lAlphaFieldBlanks(9)) { NumAlphas = 7; - } else if (lAlphaFieldBlanks(11)) { + } else if (s_ipsc->lAlphaFieldBlanks(11)) { NumAlphas = 9; } - TempControlledZone.NumControlTypes = nint((NumAlphas - 3.0) / 2.0); - TempControlledZone.ControlType.allocate(TempControlledZone.NumControlTypes); - TempControlledZone.ControlTypeName.allocate(TempControlledZone.NumControlTypes); - TempControlledZone.ControlTypeEnum.allocate(TempControlledZone.NumControlTypes); - - for (ControlTypeNum = 1; ControlTypeNum <= TempControlledZone.NumControlTypes; ++ControlTypeNum) { - - TempControlledZone.ControlType(ControlTypeNum) = cAlphaArgs(nint(2.0 * ControlTypeNum - 1 + 3)); - TempControlledZone.ControlTypeName(ControlTypeNum) = cAlphaArgs(nint(2.0 * ControlTypeNum + 3)); - - if (!TempControlledZone.ControlType(ControlTypeNum).empty()) { - HVAC::ThermostatType ctrlType = - static_cast(getEnumValue(ValidControlTypesUC, TempControlledZone.ControlType(ControlTypeNum))); - TempControlledZone.ControlTypeEnum(ControlTypeNum) = ctrlType; - if (ctrlType == HVAC::ThermostatType::Invalid) { - ShowSevereError(state, - format("{}=\"{}\" invalid {}=\"{}\"", - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(nint(2.0 * ControlTypeNum - 1 + 3)), - cAlphaArgs(nint(2.0 * ControlTypeNum - 1 + 3)))); - ErrorsFound = true; - } - } else { - ShowSevereError(state, - format("{}=\"{}\" invalid {}=\"\"", - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(nint(2.0 * ControlTypeNum - 1 + 3)))); + int NumSetptTypes = nint((NumAlphas - 3.0) / 2.0); + + for (int iSetpt = 1; iSetpt <= NumSetptTypes; ++iSetpt) { + + HVAC::SetptType setptType = HVAC::SetptType::Invalid; + int spIdx = 2 * iSetpt - 1 + 3; + + if (s_ipsc->lAlphaFieldBlanks(spIdx)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(spIdx)); + ErrorsFound = true; + continue; + } else if ((setptType = static_cast(getEnumValue(setptTypeNamesUC, s_ipsc->cAlphaArgs(spIdx)))) == + HVAC::SetptType::Invalid) { + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(spIdx), s_ipsc->cAlphaArgs(spIdx)); ErrorsFound = true; + continue; } + + tempZone.setpts[(int)setptType].Name = s_ipsc->cAlphaArgs(2 * iSetpt + 3); + tempZone.setpts[(int)setptType].isUsed = true; } + if (NumNums > 0) { - if (rNumericArgs(1) >= 0.0) { - TempControlledZone.DeltaTCutSet = rNumericArgs(1); - if (rNumericArgs(1) > 0.0) state.dataZoneTempPredictorCorrector->NumOnOffCtrZone++; + if (s_ipsc->rNumericArgs(1) >= 0.0) { + tempZone.DeltaTCutSet = s_ipsc->rNumericArgs(1); + if (s_ipsc->rNumericArgs(1) > 0.0) s_ztpc->NumOnOffCtrZone++; } else { - ShowSevereError( - state, - format("{}=\"{} invalid {}=[{:.0T}].", cCurrentModuleObject, cAlphaArgs(1), cNumericFieldNames(1), rNumericArgs(1))); + ShowSevereError(state, + format("{}=\"{} invalid {}=[{:.0T}].", + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(1), + s_ipsc->rNumericArgs(1))); ShowContinueError(state, "..Allowable values must be greater or equal to 0"); ErrorsFound = true; } } - if (TempControlledZone.DeltaTCutSet > 0.0) { - for (ControlTypeNum = 1; ControlTypeNum <= TempControlledZone.NumControlTypes; ++ControlTypeNum) { - if (Util::SameString(TempControlledZone.ControlType(ControlTypeNum), "ThermostatSetpoint:SingleHeatingOrCooling")) { - ShowWarningError(state, - format("{}=\"{}: The choice of Temperature Difference Between Cutout And Setpoint will not be applied " - "to ThermostatSetpoint:SingleHeatingOrCooling.", - cCurrentModuleObject, - cAlphaArgs(1))); - } - } + + if (tempZone.DeltaTCutSet > 0.0 && tempZone.setpts[(int)HVAC::SetptType::SingleHeatCool].Name != "") { + ShowWarningError(state, + format("{}=\"{}: The choice of Temperature Difference Between Cutout And Setpoint will not be applied " + "to ThermostatSetpoint:SingleHeatingOrCooling.", + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1))); } } } // NumTStatStatements } // Check on number of TempControlledZones - cCurrentModuleObject = ValidControlTypesUC[static_cast(HVAC::ThermostatType::SingleHeating)]; - state.dataZoneTempPredictorCorrector->NumSingleTempHeatingControls = inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - - if (state.dataZoneTempPredictorCorrector->NumSingleTempHeatingControls > 0) - state.dataZoneTempPredictorCorrector->SetPointSingleHeating.allocate(state.dataZoneTempPredictorCorrector->NumSingleTempHeatingControls); - - for (int idx = 1; idx <= state.dataZoneTempPredictorCorrector->NumSingleTempHeatingControls; ++idx) { - inputProcessor->getObjectItem(state, - cCurrentModuleObject, - idx, - cAlphaArgs, - NumAlphas, - rNumericArgs, - NumNums, - IOStat, - lNumericFieldBlanks, - lAlphaFieldBlanks, - cAlphaFieldNames, - cNumericFieldNames); - Util::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); - auto &singleHtgSetpoint = state.dataZoneTempPredictorCorrector->SetPointSingleHeating(idx); - singleHtgSetpoint.Name = cAlphaArgs(1); - singleHtgSetpoint.TempSchedName = cAlphaArgs(2); - singleHtgSetpoint.TempSchedIndex = GetScheduleIndex(state, cAlphaArgs(2)); - if (singleHtgSetpoint.TempSchedIndex == 0) { - ShowSevereError( - state, format("{}=\"{}\" invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); + s_ipsc->cCurrentModuleObject = setptTypeNamesUC[(int)HVAC::SetptType::SingleHeat]; + s_ztpc->NumTempControls[(int)HVAC::SetptType::SingleHeat] = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + + if (s_ztpc->NumTempControls[(int)HVAC::SetptType::SingleHeat] > 0) + s_ztpc->tempSetptScheds[(int)HVAC::SetptType::SingleHeat].allocate(s_ztpc->NumTempControls[(int)HVAC::SetptType::SingleHeat]); + + for (int idx = 1; idx <= s_ztpc->NumTempControls[(int)HVAC::SetptType::SingleHeat]; ++idx) { + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + idx, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + Util::IsNameEmpty(state, s_ipsc->cAlphaArgs(1), s_ipsc->cCurrentModuleObject, ErrorsFound); + auto &setpt = s_ztpc->tempSetptScheds[(int)HVAC::SetptType::SingleHeat](idx); + setpt.Name = s_ipsc->cAlphaArgs(1); + + if (s_ipsc->lAlphaFieldBlanks(2)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(2)); + ErrorsFound = true; + } else if ((setpt.heatSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); ErrorsFound = true; } } // SingleTempHeatingControlNum - cCurrentModuleObject = ValidControlTypesUC[static_cast(HVAC::ThermostatType::SingleCooling)]; - state.dataZoneTempPredictorCorrector->NumSingleTempCoolingControls = inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - - if (state.dataZoneTempPredictorCorrector->NumSingleTempCoolingControls > 0) - state.dataZoneTempPredictorCorrector->SetPointSingleCooling.allocate(state.dataZoneTempPredictorCorrector->NumSingleTempCoolingControls); - - for (int idx = 1; idx <= state.dataZoneTempPredictorCorrector->NumSingleTempCoolingControls; ++idx) { - inputProcessor->getObjectItem(state, - cCurrentModuleObject, - idx, - cAlphaArgs, - NumAlphas, - rNumericArgs, - NumNums, - IOStat, - lNumericFieldBlanks, - lAlphaFieldBlanks, - cAlphaFieldNames, - cNumericFieldNames); - Util::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); - auto &singleClgSetpoint = state.dataZoneTempPredictorCorrector->SetPointSingleCooling(idx); - singleClgSetpoint.Name = cAlphaArgs(1); - singleClgSetpoint.TempSchedName = cAlphaArgs(2); - singleClgSetpoint.TempSchedIndex = GetScheduleIndex(state, cAlphaArgs(2)); - if (singleClgSetpoint.TempSchedIndex == 0) { - ShowSevereError( - state, format("{}=\"{}\" invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); + s_ipsc->cCurrentModuleObject = setptTypeNamesUC[(int)HVAC::SetptType::SingleCool]; + s_ztpc->NumTempControls[(int)HVAC::SetptType::SingleCool] = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + + if (s_ztpc->NumTempControls[(int)HVAC::SetptType::SingleCool] > 0) + s_ztpc->tempSetptScheds[(int)HVAC::SetptType::SingleCool].allocate(s_ztpc->NumTempControls[(int)HVAC::SetptType::SingleCool]); + + for (int idx = 1; idx <= s_ztpc->NumTempControls[(int)HVAC::SetptType::SingleCool]; ++idx) { + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + idx, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + Util::IsNameEmpty(state, s_ipsc->cAlphaArgs(1), s_ipsc->cCurrentModuleObject, ErrorsFound); + auto &setpt = s_ztpc->tempSetptScheds[(int)HVAC::SetptType::SingleCool](idx); + setpt.Name = s_ipsc->cAlphaArgs(1); + + if (s_ipsc->lAlphaFieldBlanks(2)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(2)); + ErrorsFound = true; + } else if ((setpt.coolSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); ErrorsFound = true; } } // SingleTempCoolingControlNum - cCurrentModuleObject = ValidControlTypes[static_cast(HVAC::ThermostatType::SingleHeatCool)]; - state.dataZoneTempPredictorCorrector->NumSingleTempHeatCoolControls = inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - - if (state.dataZoneTempPredictorCorrector->NumSingleTempHeatCoolControls > 0) - state.dataZoneTempPredictorCorrector->SetPointSingleHeatCool.allocate(state.dataZoneTempPredictorCorrector->NumSingleTempHeatCoolControls); - - for (int idx = 1; idx <= state.dataZoneTempPredictorCorrector->NumSingleTempHeatCoolControls; ++idx) { - inputProcessor->getObjectItem(state, - cCurrentModuleObject, - idx, - cAlphaArgs, - NumAlphas, - rNumericArgs, - NumNums, - IOStat, - lNumericFieldBlanks, - lAlphaFieldBlanks, - cAlphaFieldNames, - cNumericFieldNames); - auto &singleHeatCoolSetpoint = state.dataZoneTempPredictorCorrector->SetPointSingleHeatCool(idx); - singleHeatCoolSetpoint.Name = cAlphaArgs(1); - singleHeatCoolSetpoint.TempSchedName = cAlphaArgs(2); - singleHeatCoolSetpoint.TempSchedIndex = GetScheduleIndex(state, cAlphaArgs(2)); - if (singleHeatCoolSetpoint.TempSchedIndex == 0) { - ShowSevereError( - state, format("{}=\"{}\" invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); + s_ipsc->cCurrentModuleObject = setptTypeNames[(int)HVAC::SetptType::SingleHeatCool]; + s_ztpc->NumTempControls[(int)HVAC::SetptType::SingleHeatCool] = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + + if (s_ztpc->NumTempControls[(int)HVAC::SetptType::SingleHeatCool] > 0) + s_ztpc->tempSetptScheds[(int)HVAC::SetptType::SingleHeatCool].allocate(s_ztpc->NumTempControls[(int)HVAC::SetptType::SingleHeatCool]); + + for (int idx = 1; idx <= s_ztpc->NumTempControls[(int)HVAC::SetptType::SingleHeatCool]; ++idx) { + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + idx, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + auto &setpt = s_ztpc->tempSetptScheds[(int)HVAC::SetptType::SingleHeatCool](idx); + setpt.Name = s_ipsc->cAlphaArgs(1); + + if (s_ipsc->lAlphaFieldBlanks(2)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(2)); + ErrorsFound = true; + } else if ((setpt.heatSched = setpt.coolSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); ErrorsFound = true; } } // SingleTempHeatCoolControlNum - cCurrentModuleObject = ValidControlTypes[static_cast(HVAC::ThermostatType::DualSetPointWithDeadBand)]; - state.dataZoneTempPredictorCorrector->NumDualTempHeatCoolControls = inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - - if (state.dataZoneTempPredictorCorrector->NumDualTempHeatCoolControls > 0) - state.dataZoneTempPredictorCorrector->SetPointDualHeatCool.allocate(state.dataZoneTempPredictorCorrector->NumDualTempHeatCoolControls); - - for (int idx = 1; idx <= state.dataZoneTempPredictorCorrector->NumDualTempHeatCoolControls; ++idx) { - inputProcessor->getObjectItem(state, - cCurrentModuleObject, - idx, - cAlphaArgs, - NumAlphas, - rNumericArgs, - NumNums, - IOStat, - lNumericFieldBlanks, - lAlphaFieldBlanks, - cAlphaFieldNames, - cNumericFieldNames); - Util::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); - auto &dualHeatCoolSetpoint = state.dataZoneTempPredictorCorrector->SetPointDualHeatCool(idx); - dualHeatCoolSetpoint.Name = cAlphaArgs(1); - dualHeatCoolSetpoint.HeatTempSetptSchedName = cAlphaArgs(2); - dualHeatCoolSetpoint.HeatTempSchedIndex = GetScheduleIndex(state, cAlphaArgs(2)); - if (dualHeatCoolSetpoint.HeatTempSchedIndex == 0) { - ShowSevereError( - state, format("{}=\"{}\" invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); + s_ipsc->cCurrentModuleObject = setptTypeNames[(int)HVAC::SetptType::DualHeatCool]; + s_ztpc->NumTempControls[(int)HVAC::SetptType::DualHeatCool] = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + + if (s_ztpc->NumTempControls[(int)HVAC::SetptType::DualHeatCool] > 0) + s_ztpc->tempSetptScheds[(int)HVAC::SetptType::DualHeatCool].allocate(s_ztpc->NumTempControls[(int)HVAC::SetptType::DualHeatCool]); + + for (int idx = 1; idx <= s_ztpc->NumTempControls[(int)HVAC::SetptType::DualHeatCool]; ++idx) { + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + idx, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + Util::IsNameEmpty(state, s_ipsc->cAlphaArgs(1), s_ipsc->cCurrentModuleObject, ErrorsFound); + auto &setpt = s_ztpc->tempSetptScheds[(int)HVAC::SetptType::DualHeatCool](idx); + setpt.Name = s_ipsc->cAlphaArgs(1); + + if (s_ipsc->lAlphaFieldBlanks(2)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(2)); + ErrorsFound = true; + } else if ((setpt.heatSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); ErrorsFound = true; } - dualHeatCoolSetpoint.CoolTempSetptSchedName = cAlphaArgs(3); - dualHeatCoolSetpoint.CoolTempSchedIndex = GetScheduleIndex(state, cAlphaArgs(3)); - if (dualHeatCoolSetpoint.CoolTempSchedIndex == 0) { - ShowSevereError( - state, format("{}=\"{}\" invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(3), cAlphaArgs(3))); + + if (s_ipsc->lAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(3)); + ErrorsFound = true; + } else if ((setpt.coolSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3)); ErrorsFound = true; } } // DualTempHeatCoolControlNum // Finish filling in Schedule pointing indexes - int setPointObjectArrayIndex; for (TempControlledZoneNum = 1; TempControlledZoneNum <= state.dataZoneCtrls->NumTempControlledZones; ++TempControlledZoneNum) { - for (int ct = 1; ct <= state.dataZoneCtrls->TempControlledZone(TempControlledZoneNum).NumControlTypes; ct++) { - auto &TempControlledZone = state.dataZoneCtrls->TempControlledZone(TempControlledZoneNum); - switch (state.dataZoneCtrls->TempControlledZone(TempControlledZoneNum).ControlTypeEnum(ct)) { - case HVAC::ThermostatType::SingleHeating: - setPointObjectArrayIndex = - Util::FindItem(TempControlledZone.ControlTypeName(ct), state.dataZoneTempPredictorCorrector->SetPointSingleHeating); - TempControlledZone.SchIndx_SingleHeatSetPoint = - state.dataZoneTempPredictorCorrector->SetPointSingleHeating(setPointObjectArrayIndex).TempSchedIndex; - break; - case HVAC::ThermostatType::SingleCooling: - setPointObjectArrayIndex = - Util::FindItem(TempControlledZone.ControlTypeName(ct), state.dataZoneTempPredictorCorrector->SetPointSingleCooling); - TempControlledZone.SchIndx_SingleCoolSetPoint = - state.dataZoneTempPredictorCorrector->SetPointSingleCooling(setPointObjectArrayIndex).TempSchedIndex; - break; - case HVAC::ThermostatType::SingleHeatCool: - setPointObjectArrayIndex = - Util::FindItem(TempControlledZone.ControlTypeName(ct), state.dataZoneTempPredictorCorrector->SetPointSingleHeatCool); - TempControlledZone.SchIndx_SingleHeatCoolSetPoint = - state.dataZoneTempPredictorCorrector->SetPointSingleHeatCool(setPointObjectArrayIndex).TempSchedIndex; - break; - case HVAC::ThermostatType::DualSetPointWithDeadBand: - setPointObjectArrayIndex = - Util::FindItem(TempControlledZone.ControlTypeName(ct), state.dataZoneTempPredictorCorrector->SetPointDualHeatCool); - TempControlledZone.SchIndx_DualSetPointWDeadBandHeat = - state.dataZoneTempPredictorCorrector->SetPointDualHeatCool(setPointObjectArrayIndex).HeatTempSchedIndex; - TempControlledZone.SchIndx_DualSetPointWDeadBandCool = - state.dataZoneTempPredictorCorrector->SetPointDualHeatCool(setPointObjectArrayIndex).CoolTempSchedIndex; - break; - default: - assert(false); + auto &tempZone = state.dataZoneCtrls->TempControlledZone(TempControlledZoneNum); + + for (HVAC::SetptType setptType : HVAC::setptTypes) { + auto &setpt = tempZone.setpts[(int)setptType]; + if (!setpt.isUsed) continue; + + int setptIdx = Util::FindItem(setpt.Name, s_ztpc->tempSetptScheds[(int)setptType]); + + if (setptType == HVAC::SetptType::SingleHeat || setptType == HVAC::SetptType::SingleHeatCool || + setptType == HVAC::SetptType::DualHeatCool) { + setpt.heatSetptSched = s_ztpc->tempSetptScheds[(int)setptType](setptIdx).heatSched; + } + + if (setptType == HVAC::SetptType::SingleCool || setptType == HVAC::SetptType::SingleHeatCool || + setptType == HVAC::SetptType::DualHeatCool) { + setpt.coolSetptSched = s_ztpc->tempSetptScheds[(int)setptType](setptIdx).coolSched; } } } // Now, Check the schedule values/indices for validity - for (TempControlledZoneNum = 1; TempControlledZoneNum <= state.dataZoneCtrls->NumTempControlledZones; ++TempControlledZoneNum) { + for (int TempControlledZoneNum = 1; TempControlledZoneNum <= state.dataZoneCtrls->NumTempControlledZones; ++TempControlledZoneNum) { + auto &tempZone = state.dataZoneCtrls->TempControlledZone(TempControlledZoneNum); - auto &TempControlledZone = state.dataZoneCtrls->TempControlledZone(TempControlledZoneNum); - ActualZoneNum = TempControlledZone.ActualZoneNum; - CTIndex = TempControlledZone.CTSchedIndex; - if (CTIndex == 0) continue; // error will be caught elsewhere - SchedMin = GetScheduleMinValue(state, CTIndex); - SchedMax = GetScheduleMaxValue(state, CTIndex); + if (tempZone.setptTypeSched == nullptr) continue; // error will be caught elsewhere - if (SchedMin == 0 && SchedMax == 0) { - if (FindNumberInList(CTIndex, CTSchedMapToControlledZone, state.dataZoneCtrls->NumTempControlledZones) == 0) { - ShowSevereError(state, format("Control Type Schedule={}", TempControlledZone.ControlTypeSchedName)); + int SchedMin = tempZone.setptTypeSched->getMinVal(state); + int SchedMax = tempZone.setptTypeSched->getMaxVal(state); + + if (SchedMin == (int)HVAC::SetptType::Uncontrolled && SchedMax == (int)HVAC::SetptType::Uncontrolled) { + if (FindNumberInList(tempZone.setptTypeSched->Num, CTSchedMapToControlledZone, state.dataZoneCtrls->NumTempControlledZones) == 0) { + ShowSevereError(state, format("Control Type Schedule={}", tempZone.setptTypeSched->Name)); ShowContinueError(state, "..specifies control type 0 for all entries."); ShowContinueError(state, "All zones using this Control Type Schedule have no heating or cooling available."); } - CTSchedMapToControlledZone(TempControlledZoneNum) = CTIndex; + CTSchedMapToControlledZone(TempControlledZoneNum) = tempZone.setptTypeSched->Num; } - for (ControlTypeNum = SchedMin; ControlTypeNum <= SchedMax; ++ControlTypeNum) { + for (HVAC::SetptType setptType : HVAC::setptTypes) { + auto const &setpt = tempZone.setpts[(int)setptType]; + if (!setpt.isUsed) continue; - int TempIndex = 0; - switch (static_cast(ControlTypeNum)) { - case HVAC::ThermostatType::Uncontrolled: - break; - case HVAC::ThermostatType::SingleHeating: - TempIndex = TempControlledZone.SchIndx_SingleHeatSetPoint; - if (TempIndex == 0) { - if (CheckScheduleValue(state, CTIndex, static_cast(HVAC::ThermostatType::SingleHeating))) { - ShowSevereError(state, format("Control Type Schedule={}", TempControlledZone.ControlTypeSchedName)); - ShowContinueError(state, - format("..specifies control type 1 ({}) as the control type. Not valid for this zone.", - ValidControlTypes[static_cast(HVAC::ThermostatType::SingleHeating)])); - ShowContinueError( - state, format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TStat)), TempControlledZone.Name)); - ShowContinueError(state, format("..reference ZONE={}", TempControlledZone.ZoneName)); - ErrorsFound = true; - } - } - break; - case HVAC::ThermostatType::SingleCooling: - TempIndex = TempControlledZone.SchIndx_SingleCoolSetPoint; - if (TempIndex == 0) { - if (CheckScheduleValue(state, CTIndex, static_cast(HVAC::ThermostatType::SingleCooling))) { - ShowSevereError(state, format("Control Type Schedule={}", TempControlledZone.ControlTypeSchedName)); - ShowContinueError(state, - format("..specifies control type 2 ({}) as the control type. Not valid for this zone.", - ValidControlTypes[static_cast(HVAC::ThermostatType::SingleCooling)])); - ShowContinueError( - state, format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TStat)), TempControlledZone.Name)); - ShowContinueError(state, format("..reference ZONE={}", TempControlledZone.ZoneName)); - ErrorsFound = true; - } - } - break; - case HVAC::ThermostatType::SingleHeatCool: - TempIndex = TempControlledZone.SchIndx_SingleHeatCoolSetPoint; - if (TempIndex == 0) { - if (CheckScheduleValue(state, CTIndex, static_cast(HVAC::ThermostatType::SingleHeatCool))) { - ShowSevereError(state, format("Schedule={}", TempControlledZone.ControlTypeSchedName)); - ShowContinueError(state, - format("..specifies control type 3 ({}) as the control type. Not valid for this zone.", - ValidControlTypes[static_cast(HVAC::ThermostatType::SingleHeatCool)])); - ShowContinueError( - state, format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TStat)), TempControlledZone.Name)); - ShowContinueError(state, format("..reference ZONE={}", TempControlledZone.ZoneName)); - ErrorsFound = true; - } - } - break; - case HVAC::ThermostatType::DualSetPointWithDeadBand: - TempIndex = TempControlledZone - .SchIndx_DualSetPointWDeadBandHeat; // using "Heat" as a sentinel that dualsetpoint is on this zone control object - if (TempIndex == 0) { - if (CheckScheduleValue(state, CTIndex, static_cast(HVAC::ThermostatType::DualSetPointWithDeadBand))) { - ShowSevereError(state, format("Schedule={}", TempControlledZone.ControlTypeSchedName)); - ShowContinueError(state, - format("..specifies control type 4 ({}) as the control type. Not valid for this zone.", - ValidControlTypes[static_cast(HVAC::ThermostatType::DualSetPointWithDeadBand)])); - ShowContinueError( - state, format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TStat)), TempControlledZone.Name)); - ShowContinueError(state, format("..reference ZONE={}", TempControlledZone.ZoneName)); - ErrorsFound = true; - } - } - break; - default: - ShowSevereError(state, - format("GetZoneAirSetpoints: Illegal control type for Zone={}, Found value={}, in Schedule={}", - state.dataHeatBal->Zone(ActualZoneNum).Name, - ControlTypeNum, - TempControlledZone.ControlTypeSchedName)); - ShowContinueError(state, "..valid range values are [0,4]."); + if (setpt.heatSetptSched == nullptr && + (setptType == HVAC::SetptType::SingleHeat || setptType == HVAC::SetptType::SingleHeatCool || + setptType == HVAC::SetptType::DualHeatCool) && + tempZone.setptTypeSched->hasVal(state, (int)setptType)) { + ShowSevereError(state, format("Control Type Schedule={}", tempZone.setptTypeSched->Name)); + ShowContinueError( + state, + format("..specifies {} ({}) as the control type. Not valid for this zone.", (int)setptType, setptTypeNames[(int)setptType])); + ShowContinueError(state, format("..reference {}={}", cZControlTypes((int)ZoneControlTypes::TStat), tempZone.Name)); + ShowContinueError(state, format("..reference ZONE={}", tempZone.ZoneName)); ErrorsFound = true; } - } + + if (setpt.coolSetptSched == nullptr && + (setptType == HVAC::SetptType::SingleCool || setptType == HVAC::SetptType::SingleHeatCool || + setptType == HVAC::SetptType::DualHeatCool) && + tempZone.setptTypeSched->hasVal(state, (int)setptType)) { + ShowSevereError(state, format("Control Type Schedule={}", tempZone.setptTypeSched->Name)); + ShowContinueError( + state, + format("..specifies {} ({}) as the control type. Not valid for this zone.", (int)setptType, setptTypeNames[(int)setptType])); + ShowContinueError(state, format("..reference {}={}", cZControlTypes((int)ZoneControlTypes::TStat), tempZone.Name)); + ShowContinueError(state, format("..reference ZONE={}", tempZone.ZoneName)); + ErrorsFound = true; + } + } // for (setptType) } for (TempControlledZoneNum = 1; TempControlledZoneNum <= state.dataZoneCtrls->NumTempControlledZones; ++TempControlledZoneNum) { + auto &tempZone = state.dataZoneCtrls->TempControlledZone(TempControlledZoneNum); + ActualZoneNum = tempZone.ActualZoneNum; - auto &TempControlledZone = state.dataZoneCtrls->TempControlledZone(TempControlledZoneNum); - ActualZoneNum = TempControlledZone.ActualZoneNum; - CTIndex = TempControlledZone.CTSchedIndex; - if (CTIndex == 0) continue; // error caught elsewhere -- would just be confusing here + if (tempZone.setptTypeSched == nullptr) continue; // error caught elsewhere -- would just be confusing here - for (ControlTypeNum = 1; ControlTypeNum <= 4; ++ControlTypeNum) { - if (TStatControlTypes(TempControlledZoneNum).MustHave[ControlTypeNum] && TStatControlTypes(TempControlledZoneNum).DidHave[ControlTypeNum]) + for (HVAC::SetptType setptType : HVAC::setptTypes) { + if (TStatControlTypes(TempControlledZoneNum).MustHave[(int)setptType] && TStatControlTypes(TempControlledZoneNum).DidHave[(int)setptType]) continue; - switch (static_cast(ControlTypeNum)) { - case HVAC::ThermostatType::SingleHeating: - if (!TStatControlTypes(TempControlledZoneNum).MustHave[ControlTypeNum]) continue; - ShowWarningError(state, format("Schedule={}", TempControlledZone.ControlTypeSchedName)); - ShowContinueError(state, - format("...should include control type 1 ({}) but does not.", - ValidControlTypes[static_cast(HVAC::ThermostatType::SingleHeating)])); - ShowContinueError(state, - format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TStat)), TempControlledZone.Name)); - ShowContinueError(state, format("..reference ZONE={}", TempControlledZone.ZoneName)); - break; - case HVAC::ThermostatType::SingleCooling: - if (!TStatControlTypes(TempControlledZoneNum).MustHave[ControlTypeNum]) continue; - ShowWarningError(state, format("Schedule={}", TempControlledZone.ControlTypeSchedName)); - ShowContinueError(state, - format("...should include control type 2 ({}) but does not.", - ValidControlTypes[static_cast(HVAC::ThermostatType::SingleCooling)])); - ShowContinueError(state, - format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TStat)), TempControlledZone.Name)); - ShowContinueError(state, format("..reference ZONE={}", TempControlledZone.ZoneName)); - break; - case HVAC::ThermostatType::SingleHeatCool: - if (!TStatControlTypes(TempControlledZoneNum).MustHave[ControlTypeNum]) continue; - ShowWarningError(state, format("Schedule={}", TempControlledZone.ControlTypeSchedName)); - ShowContinueError(state, - format("...should include control type 3 ({}) but does not.", - ValidControlTypes[static_cast(HVAC::ThermostatType::SingleHeating)])); - ShowContinueError(state, - format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TStat)), TempControlledZone.Name)); - ShowContinueError(state, format("..reference ZONE={}", TempControlledZone.ZoneName)); - break; - case HVAC::ThermostatType::DualSetPointWithDeadBand: - if (!TStatControlTypes(TempControlledZoneNum).MustHave[ControlTypeNum]) continue; - ShowWarningError(state, format("Schedule={}", TempControlledZone.ControlTypeSchedName)); - ShowContinueError(state, - format("...should include control type 4 ({}) but does not.", - ValidControlTypes[static_cast(HVAC::ThermostatType::DualSetPointWithDeadBand)])); - ShowContinueError(state, - format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TStat)), TempControlledZone.Name)); - ShowContinueError(state, format("..reference ZONE={}", TempControlledZone.ZoneName)); - break; - default: - break; - } + if (!TStatControlTypes(TempControlledZoneNum).MustHave[(int)setptType]) continue; + ShowWarningError(state, format("Schedule={}", tempZone.setptTypeSched->Name)); + ShowContinueError(state, format("...should include control type {} ({}) but does not.", (int)setptType, setptTypeNames[(int)setptType])); + ShowContinueError(state, format("..reference {}={}", cZControlTypes((int)ZoneControlTypes::TStat), tempZone.Name)); + ShowContinueError(state, format("..reference ZONE={}", tempZone.ZoneName)); } } if (allocated(TStatControlTypes)) TStatControlTypes.deallocate(); // This starts the Humidity Control Get Input section - cCurrentModuleObject = cZControlTypes(static_cast(ZoneControlTypes::HStat)); - state.dataZoneCtrls->NumHumidityControlZones = inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + s_ipsc->cCurrentModuleObject = cZControlTypes(static_cast(ZoneControlTypes::HStat)); + state.dataZoneCtrls->NumHumidityControlZones = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); if (state.dataZoneCtrls->NumHumidityControlZones > 0) { state.dataZoneCtrls->HumidityControlZone.allocate(state.dataZoneCtrls->NumHumidityControlZones); - state.dataZoneTempPredictorCorrector->HumidityControlZoneUniqueNames.reserve( - static_cast(state.dataZoneCtrls->NumHumidityControlZones)); + s_ztpc->HumidityControlZoneUniqueNames.reserve(static_cast(state.dataZoneCtrls->NumHumidityControlZones)); } for (HumidControlledZoneNum = 1; HumidControlledZoneNum <= state.dataZoneCtrls->NumHumidityControlZones; ++HumidControlledZoneNum) { - auto &HumidityControlZone = state.dataZoneCtrls->HumidityControlZone(HumidControlledZoneNum); - inputProcessor->getObjectItem(state, - cCurrentModuleObject, - HumidControlledZoneNum, - cAlphaArgs, - NumAlphas, - rNumericArgs, - NumNums, - IOStat, - lNumericFieldBlanks, - lAlphaFieldBlanks, - cAlphaFieldNames, - cNumericFieldNames); - Util::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); - - HumidityControlZone.ControlName = cAlphaArgs(1); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + HumidControlledZoneNum, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + Util::IsNameEmpty(state, s_ipsc->cAlphaArgs(1), s_ipsc->cCurrentModuleObject, ErrorsFound); + + auto &humidControlledZone = state.dataZoneCtrls->HumidityControlZone(HumidControlledZoneNum); + humidControlledZone.ControlName = s_ipsc->cAlphaArgs(1); GlobalNames::IntraObjUniquenessCheck(state, - cAlphaArgs(2), - cCurrentModuleObject, - cAlphaFieldNames(2), - state.dataZoneTempPredictorCorrector->HumidityControlZoneUniqueNames, + s_ipsc->cAlphaArgs(2), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaFieldNames(2), + s_ztpc->HumidityControlZoneUniqueNames, ErrorsFound); - HumidityControlZone.ZoneName = cAlphaArgs(2); - HumidityControlZone.ActualZoneNum = Util::FindItem(cAlphaArgs(2), state.dataHeatBal->Zone); - if (HumidityControlZone.ActualZoneNum == 0) { + humidControlledZone.ZoneName = s_ipsc->cAlphaArgs(2); + humidControlledZone.ActualZoneNum = Util::FindItem(s_ipsc->cAlphaArgs(2), Zone); + if (humidControlledZone.ActualZoneNum == 0) { ShowSevereError(state, - format("{}=\"{} invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); + format("{}=\"{} invalid {}=\"{}\" not found.", + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } else { - state.dataHeatBal->Zone(HumidityControlZone.ActualZoneNum).humidityControlZoneIndex = HumidControlledZoneNum; + state.dataHeatBal->Zone(humidControlledZone.ActualZoneNum).humidityControlZoneIndex = HumidControlledZoneNum; } - HumidityControlZone.HumidifyingSched = cAlphaArgs(3); - HumidityControlZone.HumidifyingSchedIndex = GetScheduleIndex(state, cAlphaArgs(3)); - if (HumidityControlZone.HumidifyingSchedIndex == 0) { - ShowSevereError(state, - format("{}=\"{} invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(3), cAlphaArgs(3))); + + if (s_ipsc->lAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(3)); + ErrorsFound = true; + } else if ((humidControlledZone.humidifyingSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3)); ErrorsFound = true; } - if (NumAlphas == 4) { - HumidityControlZone.DehumidifyingSched = cAlphaArgs(4); - HumidityControlZone.DehumidifyingSchedIndex = GetScheduleIndex(state, cAlphaArgs(4)); - if (HumidityControlZone.DehumidifyingSchedIndex == 0) { - ShowSevereError( - state, format("{}=\"{} invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(4), cAlphaArgs(4))); - ErrorsFound = true; - } - } else { - HumidityControlZone.DehumidifyingSched = cAlphaArgs(3); - HumidityControlZone.DehumidifyingSchedIndex = GetScheduleIndex(state, cAlphaArgs(3)); + + if (NumAlphas < 4 || s_ipsc->lAlphaFieldBlanks(4)) { + humidControlledZone.dehumidifyingSched = humidControlledZone.humidifyingSched; + } else if ((humidControlledZone.dehumidifyingSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(4))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4)); + ErrorsFound = true; } } // HumidControlledZoneNum // Start to read Thermal comfort control objects - cCurrentModuleObject = cZControlTypes(static_cast(ZoneControlTypes::TCTStat)); - state.dataZoneCtrls->NumComfortTStatStatements = inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - state.dataZoneCtrls->ComfortTStatObjects.allocate(state.dataZoneCtrls->NumComfortTStatStatements); + s_ipsc->cCurrentModuleObject = cZControlTypes(static_cast(ZoneControlTypes::TCTStat)); + state.dataZoneCtrls->NumComfortTStatStatements = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + ComfortTStatObjects.allocate(state.dataZoneCtrls->NumComfortTStatStatements); // Pre-scan for use of Zone lists in TStat statements (i.e. Global application of TStat) state.dataZoneCtrls->NumComfortControlledZones = 0; errFlag = false; for (Item = 1; Item <= state.dataZoneCtrls->NumComfortTStatStatements; ++Item) { - inputProcessor->getObjectItem(state, - cCurrentModuleObject, - Item, - cAlphaArgs, - NumAlphas, - rNumericArgs, - NumNums, - IOStat, - lNumericFieldBlanks, - lAlphaFieldBlanks, - cAlphaFieldNames, - cNumericFieldNames); - Util::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); - - Item1 = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Item, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + Util::IsNameEmpty(state, s_ipsc->cAlphaArgs(1), s_ipsc->cCurrentModuleObject, ErrorsFound); + + Item1 = Util::FindItemInList(s_ipsc->cAlphaArgs(2), Zone); ZLItem = 0; - if (Item1 == 0 && state.dataHeatBal->NumOfZoneLists > 0) ZLItem = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->ZoneList); - auto &ComfortTStatObjects = state.dataZoneCtrls->ComfortTStatObjects(Item); - ComfortTStatObjects.Name = cAlphaArgs(1); + if (Item1 == 0 && state.dataHeatBal->NumOfZoneLists > 0) ZLItem = Util::FindItemInList(s_ipsc->cAlphaArgs(2), ZoneList); + ComfortTStatObjects(Item).Name = s_ipsc->cAlphaArgs(1); if (Item1 > 0) { - ComfortTStatObjects.ComfortControlledZoneStartPtr = state.dataZoneCtrls->NumComfortControlledZones + 1; + ComfortTStatObjects(Item).ComfortControlledZoneStartPtr = state.dataZoneCtrls->NumComfortControlledZones + 1; ++state.dataZoneCtrls->NumComfortControlledZones; - ComfortTStatObjects.NumOfZones = 1; - ComfortTStatObjects.ZoneListActive = false; - ComfortTStatObjects.ZoneOrZoneListPtr = Item1; + ComfortTStatObjects(Item).NumOfZones = 1; + ComfortTStatObjects(Item).ZoneListActive = false; + ComfortTStatObjects(Item).ZoneOrZoneListPtr = Item1; } else if (ZLItem > 0) { auto const &ZoneList = state.dataHeatBal->ZoneList(ZLItem); - ComfortTStatObjects.ComfortControlledZoneStartPtr = state.dataZoneCtrls->NumComfortControlledZones + 1; + ComfortTStatObjects(Item).ComfortControlledZoneStartPtr = state.dataZoneCtrls->NumComfortControlledZones + 1; state.dataZoneCtrls->NumComfortControlledZones += ZoneList.NumOfZones; - ComfortTStatObjects.NumOfZones = ZoneList.NumOfZones; - ComfortTStatObjects.ZoneListActive = true; - ComfortTStatObjects.ZoneOrZoneListPtr = ZLItem; + ComfortTStatObjects(Item).NumOfZones = ZoneList.NumOfZones; + ComfortTStatObjects(Item).ZoneListActive = true; + ComfortTStatObjects(Item).ZoneOrZoneListPtr = ZLItem; } else { - ShowSevereError( - state, format("{}=\"{}\" invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); + ShowSevereError(state, + format("{}=\"{}\" invalid {}=\"{}\" not found.", + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); errFlag = true; ErrorsFound = true; } } if (errFlag) { - ShowSevereError(state, format("GetZoneAirSetpoints: Errors with invalid names in {} objects.", cCurrentModuleObject)); + ShowSevereError(state, format("GetZoneAirSetpoints: Errors with invalid names in {} objects.", s_ipsc->cCurrentModuleObject)); ShowContinueError(state, "...These will not be read in. Other errors may occur."); state.dataZoneCtrls->NumComfortControlledZones = 0; } @@ -1005,708 +883,496 @@ void GetZoneAirSetPoints(EnergyPlusData &state) ComfortControlledZoneNum = 0; for (Item = 1; Item <= state.dataZoneCtrls->NumComfortTStatStatements; ++Item) { - auto &ComfortTStatObjects = state.dataZoneCtrls->ComfortTStatObjects(Item); - inputProcessor->getObjectItem(state, - cCurrentModuleObject, - Item, - cAlphaArgs, - NumAlphas, - rNumericArgs, - NumNums, - IOStat, - lNumericFieldBlanks, - lAlphaFieldBlanks, - cAlphaFieldNames, - cNumericFieldNames); - for (Item1 = 1; Item1 <= ComfortTStatObjects.NumOfZones; ++Item1) { + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Item, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + for (Item1 = 1; Item1 <= ComfortTStatObjects(Item).NumOfZones; ++Item1) { ++ComfortControlledZoneNum; - auto &ComfortControlledZone = state.dataZoneCtrls->ComfortControlledZone(ComfortControlledZoneNum); - if (ComfortTStatObjects.ZoneListActive) { - auto &ZoneList = state.dataHeatBal->ZoneList(ComfortTStatObjects.ZoneOrZoneListPtr); - cAlphaArgs(2) = state.dataHeatBal->Zone(ZoneList.Zone(Item1)).Name; + + auto &comfortZone = state.dataZoneCtrls->ComfortControlledZone(ComfortControlledZoneNum); + + if (ComfortTStatObjects(Item).ZoneListActive) { + s_ipsc->cAlphaArgs(2) = state.dataHeatBal->Zone(ZoneList(ComfortTStatObjects(Item).ZoneOrZoneListPtr).Zone(Item1)).Name; } - int ZoneAssigned = Util::FindItemInList(cAlphaArgs(2), + int ZoneAssigned = Util::FindItemInList(s_ipsc->cAlphaArgs(2), state.dataZoneCtrls->ComfortControlledZone, &DataZoneControls::ZoneComfortControls::ZoneName, ComfortControlledZoneNum - 1); if (ZoneAssigned == 0) { - ComfortControlledZone.ZoneName = cAlphaArgs(2); - ComfortControlledZone.ActualZoneNum = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone); - if (ComfortControlledZone.ActualZoneNum == 0) { - ShowSevereError( - state, - format( - "{}=\"{}\" invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); + comfortZone.ZoneName = s_ipsc->cAlphaArgs(2); + comfortZone.ActualZoneNum = Util::FindItemInList(s_ipsc->cAlphaArgs(2), Zone); + if (comfortZone.ActualZoneNum == 0) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); ErrorsFound = true; } } else { - ComfortControlledZone.ZoneName = cAlphaArgs(2); // for continuity - ShowSevereError(state, - format("{}=\"{}\" invalid {}=\"{}\" zone previously assigned.", - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(2), - cAlphaArgs(2))); - ShowContinueError(state, - format("...Zone was previously assigned to Thermostat=\"{}\".", - state.dataZoneCtrls->ComfortControlledZone(ZoneAssigned).Name)); + comfortZone.ZoneName = s_ipsc->cAlphaArgs(2); // for continuity + ShowSevereDuplicateAssignment(state, + eoh, + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2), + state.dataZoneCtrls->ComfortControlledZone(ZoneAssigned).Name); ErrorsFound = true; continue; } - if (!ComfortTStatObjects.ZoneListActive) { - ComfortControlledZone.Name = cAlphaArgs(1); + if (!ComfortTStatObjects(Item).ZoneListActive) { + comfortZone.Name = s_ipsc->cAlphaArgs(1); } else { - auto &ZoneList = state.dataHeatBal->ZoneList(ComfortTStatObjects.ZoneOrZoneListPtr); - ComfortControlledZone.Name = state.dataHeatBal->Zone(ZoneList.Zone(Item1)).Name + ' ' + ComfortTStatObjects.Name; + comfortZone.Name = state.dataHeatBal->Zone(ZoneList(ComfortTStatObjects(Item).ZoneOrZoneListPtr).Zone(Item1)).Name + ' ' + + ComfortTStatObjects(Item).Name; } // Read Fields A3 and A4 for averaging method int IZoneCount = 0; for (i = 1; i <= state.dataHeatBal->TotPeople; ++i) { - if (ComfortControlledZone.ActualZoneNum == state.dataHeatBal->People(i).ZonePtr) { + if (comfortZone.ActualZoneNum == state.dataHeatBal->People(i).ZonePtr) { ++IZoneCount; } } // Could not find a people object for this particular zone - if (IZoneCount == 0 && ComfortControlledZone.ActualZoneNum > 0) { + if (IZoneCount == 0 && comfortZone.ActualZoneNum > 0) { ShowSevereError(state, format("{}=\"{} no PEOPLE in {}=\"{}\" - cannot use Comfort Control.", - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(2), - cAlphaArgs(2))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } - ComfortControlledZone.AverageMethod = DataZoneControls::AverageMethod::NO; + comfortZone.AverageMethod = DataZoneControls::AverageMethod::NO; if (IZoneCount > 1) { - ComfortControlledZone.AverageMethodName = cAlphaArgs(3); - if (Util::SameString(cAlphaArgs(3), "SpecificObject")) { - ComfortControlledZone.AverageMethod = DataZoneControls::AverageMethod::SPE; + comfortZone.AverageMethodName = s_ipsc->cAlphaArgs(3); + if (Util::SameString(s_ipsc->cAlphaArgs(3), "SpecificObject")) { + comfortZone.AverageMethod = DataZoneControls::AverageMethod::SPE; } - if (Util::SameString(cAlphaArgs(3), "ObjectAverage")) { - ComfortControlledZone.AverageMethod = DataZoneControls::AverageMethod::OBJ; + if (Util::SameString(s_ipsc->cAlphaArgs(3), "ObjectAverage")) { + comfortZone.AverageMethod = DataZoneControls::AverageMethod::OBJ; } - if (Util::SameString(cAlphaArgs(3), "PeopleAverage")) { - ComfortControlledZone.AverageMethod = DataZoneControls::AverageMethod::PEO; + if (Util::SameString(s_ipsc->cAlphaArgs(3), "PeopleAverage")) { + comfortZone.AverageMethod = DataZoneControls::AverageMethod::PEO; } - if (ComfortControlledZone.AverageMethod == DataZoneControls::AverageMethod::NO) { - ShowSevereError( - state, format("{}=\"{} invalid {}=\"{}\".", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(3), cAlphaArgs(3))); - ShowContinueError(state, "Allowed keys are SpecificObject, ObjectAverage, or PeopleAverage"); + if (comfortZone.AverageMethod == DataZoneControls::AverageMethod::NO) { + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3)); ErrorsFound = true; } - if (ComfortControlledZone.AverageMethod == DataZoneControls::AverageMethod::SPE) { - ComfortControlledZone.AverageObjectName = cAlphaArgs(4); - if (Util::FindItem(cAlphaArgs(4), state.dataHeatBal->People) == 0) { - ShowSevereError( - state, format("{}=\"{} invalid {}=\"{}\".", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(4), cAlphaArgs(4))); + if (comfortZone.AverageMethod == DataZoneControls::AverageMethod::SPE) { + comfortZone.AverageObjectName = s_ipsc->cAlphaArgs(4); + if (Util::FindItem(s_ipsc->cAlphaArgs(4), state.dataHeatBal->People) == 0) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4)); ErrorsFound = true; } else { - ComfortControlledZone.SpecificObjectNum = Util::FindItem(cAlphaArgs(4), state.dataHeatBal->People); + comfortZone.SpecificObjectNum = Util::FindItem(s_ipsc->cAlphaArgs(4), state.dataHeatBal->People); } } } else { for (i = 1; i <= state.dataHeatBal->TotPeople; ++i) { - if (ComfortControlledZone.ActualZoneNum == state.dataHeatBal->People(i).ZonePtr) break; + if (comfortZone.ActualZoneNum == state.dataHeatBal->People(i).ZonePtr) break; } - ComfortControlledZone.SpecificObjectNum = i; + comfortZone.SpecificObjectNum = i; } // Check values used for thermal comfort calculation for (i = 1; i <= state.dataHeatBal->TotPeople; ++i) { - if (ComfortControlledZone.ActualZoneNum == state.dataHeatBal->People(i).ZonePtr) { - // Check activity level - if (state.dataHeatBal->People(i).ActivityLevelPtr > 0) { - ValidScheduleControlType = - CheckScheduleValueMinMax(state, state.dataHeatBal->People(i).ActivityLevelPtr, ">=", 72.0, "<=", 909.0); - if (!ValidScheduleControlType) { - ShowSevereError(state, - "GetPeople Activity Level: Invalid activity level values entered for thermal comfort calculation"); - ShowContinueError(state, - format("Outside of range values [72,909], Reference object={}", state.dataHeatBal->People(i).Name)); - ErrorsFound = true; - } - } else { - ShowSevereError( - state, - format("GetPeople Activity Level: Activity level schedule is not found={}", state.dataHeatBal->People(i).Name)); - ShowContinueError(state, "Required when the zone has Thermal Comfort Controls."); - ErrorsFound = true; - } - // Check Work Efficiency - if (state.dataHeatBal->People(i).WorkEffPtr > 0) { - ValidScheduleControlType = CheckScheduleValueMinMax(state, state.dataHeatBal->People(i).WorkEffPtr, ">=", 0.0, "<=", 1.0); - if (!ValidScheduleControlType) { - ShowSevereError(state, - "GetPeople work efficiency: Invalid work efficiency values entered for thermal comfort calculation"); - ShowContinueError(state, - format("Outside of range values [0,1], Reference object={}", state.dataHeatBal->People(i).Name)); - ErrorsFound = true; - } - } else { - ShowSevereError( - state, - format("GetPeople work efficiency: Work efficiency schedule is not found={}", state.dataHeatBal->People(i).Name)); - ShowContinueError(state, "Required when the zone has Thermal Comfort Controls."); - ErrorsFound = true; - } - // Check Clothing Insulation - if (state.dataHeatBal->People(i).ClothingPtr > 0) { - ValidScheduleControlType = CheckScheduleValueMinMax(state, state.dataHeatBal->People(i).ClothingPtr, ">", 0.0, "<=", 2.0); - if (!ValidScheduleControlType) { - ShowSevereError( - state, - "GetPeople Clothing Insulation: Invalid Clothing Insulation values entered for thermal comfort calculation"); - ShowContinueError( - state, format("Outside of range values [0.0,2.0], Reference object={}", state.dataHeatBal->People(i).Name)); - ErrorsFound = true; - } - } else { - ShowSevereError(state, - format("GetPeople Clothing Insulation: Clothing Insulation schedule is not found={}", - state.dataHeatBal->People(i).Name)); - ShowContinueError(state, "Required when the zone has Thermal Comfort Controls."); - ErrorsFound = true; - } - // Check Air velocity - if (state.dataHeatBal->People(i).AirVelocityPtr <= 0) { - ShowSevereError( - state, format("GetPeople Air Velocity: Air velocity schedule is not found={}", state.dataHeatBal->People(i).Name)); - ShowContinueError(state, "Required when the zone has Thermal Comfort Controls."); - ErrorsFound = true; - } + auto &people = state.dataHeatBal->People(i); + + if (comfortZone.ActualZoneNum != people.ZonePtr) continue; + + // Check activity level + if (people.activityLevelSched == nullptr) { + ShowSevereError(state, format("GetPeople Activity Level: Activity level schedule is not found={}", people.Name)); + ShowContinueError(state, "Required when the zone has Thermal Comfort Controls."); + ErrorsFound = true; + } else if (!people.activityLevelSched->checkMinMaxVals(state, Clusive::In, 72.0, Clusive::In, 909.0)) { + ShowSevereError(state, "GetPeople Activity Level: Invalid activity level values entered for thermal comfort calculation"); + ShowContinueError(state, format("Outside of range values [72,909], Reference object={}", people.Name)); + } + + // Check Work Efficiency + if (people.workEffSched == nullptr) { + ShowSevereError(state, format("GetPeople work efficiency: Work efficiency schedule is not found={}", people.Name)); + ShowContinueError(state, "Required when the zone has Thermal Comfort Controls."); + ErrorsFound = true; + } else if (!people.workEffSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) { + ShowSevereError(state, "GetPeople work efficiency: Invalid work efficiency values entered for thermal comfort calculation"); + ShowContinueError(state, format("Outside of range values [0,1], Reference object={}", people.Name)); + ErrorsFound = true; + } + + // Check Clothing Insulation + if (people.clothingSched == nullptr) { + ShowSevereError(state, format("GetPeople Clothing Insulation: Clothing Insulation schedule is not found={}", people.Name)); + ShowContinueError(state, "Required when the zone has Thermal Comfort Controls."); + ErrorsFound = true; + } else if (!people.clothingSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 2.0)) { + ShowSevereError(state, + "GetPeople Clothing Insulation: Invalid Clothing Insulation values entered for thermal comfort calculation"); + ShowContinueError(state, format("Outside of range values [0.0,2.0], Reference object={}", people.Name)); + ErrorsFound = true; + } + + // Check Air velocity + if (people.airVelocitySched == nullptr) { + ShowSevereError(state, format("GetPeople Air Velocity: Air velocity schedule is not found={}", people.Name)); + ShowContinueError(state, "Required when the zone has Thermal Comfort Controls."); + ErrorsFound = true; } } // Read Max and Min temperature setpoint if (NumNums > 0) { - ComfortControlledZone.TdbMinSetPoint = rNumericArgs(1); - if (rNumericArgs(1) > 50 || rNumericArgs(1) < 0) { - ShowSevereError( - state, - format("{}=\"{} invalid {}=[{:.0T}].", cCurrentModuleObject, cAlphaArgs(1), cNumericFieldNames(1), rNumericArgs(1))); + comfortZone.TdbMinSetPoint = s_ipsc->rNumericArgs(1); + if (s_ipsc->rNumericArgs(1) > 50 || s_ipsc->rNumericArgs(1) < 0) { + ShowSevereError(state, + format("{}=\"{} invalid {}=[{:.0T}].", + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(1), + s_ipsc->rNumericArgs(1))); ShowContinueError(state, "..Allowable values must be between 0 C and 50 C"); ErrorsFound = true; } } if (NumNums > 1) { - ComfortControlledZone.TdbMaxSetPoint = rNumericArgs(2); - if (rNumericArgs(2) > 50 || rNumericArgs(2) < 0) { - ShowSevereError( - state, - format("{}=\"{} invalid {}=[{:.0T}].", cCurrentModuleObject, cAlphaArgs(1), cNumericFieldNames(2), rNumericArgs(2))); + comfortZone.TdbMaxSetPoint = s_ipsc->rNumericArgs(2); + if (s_ipsc->rNumericArgs(2) > 50 || s_ipsc->rNumericArgs(2) < 0) { + ShowSevereError(state, + format("{}=\"{} invalid {}=[{:.0T}].", + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cNumericFieldNames(2), + s_ipsc->rNumericArgs(2))); ShowContinueError(state, "..Allowable values must be between 0 C and 50 C"); ErrorsFound = true; } } // Ensure MaxTemp >= MinTemp - if (ComfortControlledZone.TdbMinSetPoint > ComfortControlledZone.TdbMaxSetPoint) { - ShowSevereError(state, format("{}=\"{}", cCurrentModuleObject, cAlphaArgs(1))); - ShowContinueError(state, format("..{} > {}", cNumericFieldNames(1), cNumericFieldNames(2))); - ShowContinueError(state, format("..[{:.0T}] > [{:.0T}].", rNumericArgs(1), rNumericArgs(2))); + if (comfortZone.TdbMinSetPoint > comfortZone.TdbMaxSetPoint) { + ShowSevereError(state, format("{}=\"{}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("..{} > {}", s_ipsc->cNumericFieldNames(1), s_ipsc->cNumericFieldNames(2))); + ShowContinueError(state, format("..[{:.0T}] > [{:.0T}].", s_ipsc->rNumericArgs(1), s_ipsc->rNumericArgs(2))); ErrorsFound = true; } // If MaxTemp = MinTemp, no thermal comfort control - if (ComfortControlledZone.TdbMinSetPoint == ComfortControlledZone.TdbMaxSetPoint) { - ShowSevereError(state, format("{}=\"{}", cCurrentModuleObject, cAlphaArgs(1))); - ShowContinueError(state, format("..{} = {}", cNumericFieldNames(1), cNumericFieldNames(2))); + if (comfortZone.TdbMinSetPoint == comfortZone.TdbMaxSetPoint) { + ShowSevereError(state, format("{}=\"{}", s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1))); + ShowContinueError(state, format("..{} = {}", s_ipsc->cNumericFieldNames(1), s_ipsc->cNumericFieldNames(2))); ShowContinueError(state, "The zone will be controlled using this dry-bulb temperature setpoint."); } + // read Thermal comfort type schedule name - ComfortControlledZone.ControlTypeSchedName = cAlphaArgs(5); - ComfortControlledZone.ComfortSchedIndex = GetScheduleIndex(state, cAlphaArgs(5)); - if (ComfortControlledZone.ComfortSchedIndex == 0) { - ShowSevereError( - state, - format("{}=\"{} invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(5), cAlphaArgs(5))); + if (s_ipsc->lAlphaFieldBlanks(5)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(5)); + ErrorsFound = true; + } else if ((comfortZone.setptTypeSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(5))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaArgs(5)); + ErrorsFound = true; + } else if (!comfortZone.setptTypeSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 4.0)) { + Sched::ShowSevereBadMinMax(state, eoh, s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaArgs(5), Clusive::In, 0.0, Clusive::In, 4.0); ErrorsFound = true; - } else { - // Check validity of control types. - ValidScheduleControlType = CheckScheduleValueMinMax(state, ComfortControlledZone.ComfortSchedIndex, ">=", 0.0, "<=", 4.0); - if (!ValidScheduleControlType) { - ShowSevereError( - state, - format("{}=\"{}\" invalid range {}=\"{}\"", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(5), cAlphaArgs(5))); - ShowContinueError(state, "..contains values outside of range [0,4]."); - ErrorsFound = true; - } } - ComfortControlledZone.NumControlTypes = nint((NumAlphas - 5.0) / 2.0); - ComfortControlledZone.ControlType.allocate(ComfortControlledZone.NumControlTypes); - ComfortControlledZone.ControlTypeName.allocate(ComfortControlledZone.NumControlTypes); - ComfortControlledZone.ControlTypeSchIndx.allocate(ComfortControlledZone.NumControlTypes); - - for (ControlTypeNum = 1; ControlTypeNum <= ComfortControlledZone.NumControlTypes; ++ControlTypeNum) { - ComfortControlledZone.ControlType(ControlTypeNum) = cAlphaArgs(nint(2.0 * ControlTypeNum - 1 + 5)); - ComfortControlledZone.ControlTypeName(ControlTypeNum) = cAlphaArgs(nint(2.0 * ControlTypeNum + 5)); - if (ComfortControlledZone.ControlType(ControlTypeNum) != "") { - CTIndex = getEnumValue(ValidComfortControlTypesUC, Util::makeUPPER(ComfortControlledZone.ControlType(ControlTypeNum))); - if (CTIndex == 0) { - ShowSevereError(state, - format("{}=\"{}\" invalid {}=\"{}\"", - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(nint(2.0 * ControlTypeNum - 1 + 5)), - cAlphaArgs(nint(2.0 * ControlTypeNum - 1 + 5)))); - ErrorsFound = true; - } - if (CTIndex > 4) { // For Fanger control only for the time being - ShowSevereError(state, - format("{}=\"{}\" invalid {}=\"{}\"", - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(nint(2.0 * ControlTypeNum - 1 + 5)), - cAlphaArgs(nint(2.0 * ControlTypeNum - 1 + 5)))); - ShowContinueError(state, "..Fanger is the only valid model."); - ErrorsFound = true; - } - } else { - ShowSevereError(state, - format("{}=\"{}\" invalid {}=\"\"", - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(nint(2.0 * ControlTypeNum - 1 + 5)))); + + int NumSetptTypes = nint((NumAlphas - 5.0) / 2.0); + + for (int iSetptType = 1; iSetptType <= NumSetptTypes; ++iSetptType) { + + int ctIdx = 2 * iSetptType - 1 + 5; + + HVAC::SetptType setptType = HVAC::SetptType::Invalid; + if (s_ipsc->lAlphaFieldBlanks(ctIdx)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(ctIdx)); ErrorsFound = true; + continue; + } else if ((setptType = static_cast(getEnumValue(comfortSetptTypeNamesUC, s_ipsc->cAlphaArgs(ctIdx)))) == + HVAC::SetptType::Invalid) { + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(ctIdx), s_ipsc->cAlphaFieldNames(ctIdx)); + ErrorsFound = true; + continue; } - ComfortControlledZone.ControlTypeSchIndx(ControlTypeNum) = 0; + + auto &setpt = comfortZone.setpts[(int)setptType]; + setpt.Name = s_ipsc->cAlphaArgs(nint(2.0 * iSetptType + 5)); + setpt.isUsed = true; } } } // NumComfortTStatStatements } // End of Thermal comfort control reading and checking - cCurrentModuleObject = ValidComfortControlTypes[static_cast(HVAC::ThermostatType::SingleHeating)]; - state.dataZoneTempPredictorCorrector->NumSingleFangerHeatingControls = inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - - if (state.dataZoneTempPredictorCorrector->NumSingleFangerHeatingControls > 0) - state.dataZoneTempPredictorCorrector->SetPointSingleHeatingFanger.allocate( - state.dataZoneTempPredictorCorrector->NumSingleFangerHeatingControls); - - for (int idx = 1; idx <= state.dataZoneTempPredictorCorrector->NumSingleFangerHeatingControls; ++idx) { - inputProcessor->getObjectItem(state, - cCurrentModuleObject, - idx, - cAlphaArgs, - NumAlphas, - rNumericArgs, - NumNums, - IOStat, - lNumericFieldBlanks, - lAlphaFieldBlanks, - cAlphaFieldNames, - cNumericFieldNames); - Util::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); - auto &singleSetpointHtgFanger = state.dataZoneTempPredictorCorrector->SetPointSingleHeatingFanger(idx); - singleSetpointHtgFanger.Name = cAlphaArgs(1); - singleSetpointHtgFanger.PMVSchedName = cAlphaArgs(2); - singleSetpointHtgFanger.PMVSchedIndex = GetScheduleIndex(state, cAlphaArgs(2)); - if (singleSetpointHtgFanger.PMVSchedIndex == 0) { - ShowSevereError( - state, format("{}=\"{}\" invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); + s_ipsc->cCurrentModuleObject = comfortSetptTypeNames[(int)HVAC::SetptType::SingleHeat]; + s_ztpc->NumComfortControls[(int)HVAC::SetptType::SingleHeat] = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + + if (s_ztpc->NumComfortControls[(int)HVAC::SetptType::SingleHeat] > 0) + s_ztpc->comfortSetptScheds[(int)HVAC::SetptType::SingleHeat].allocate(s_ztpc->NumComfortControls[(int)HVAC::SetptType::SingleHeat]); + + for (int idx = 1; idx <= s_ztpc->NumComfortControls[(int)HVAC::SetptType::SingleHeat]; ++idx) { + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + idx, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + Util::IsNameEmpty(state, s_ipsc->cAlphaArgs(1), s_ipsc->cCurrentModuleObject, ErrorsFound); + auto &setpt = s_ztpc->comfortSetptScheds[(int)HVAC::SetptType::SingleHeat](idx); + setpt.Name = s_ipsc->cAlphaArgs(1); + + if (s_ipsc->lAlphaFieldBlanks(2)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(2)); + ErrorsFound = true; + } else if ((setpt.heatSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); + ErrorsFound = true; + } else if (!setpt.heatSched->checkMinMaxVals(state, Clusive::In, -3.0, Clusive::In, 3.0)) { + Sched::ShowSevereBadMinMax(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2), Clusive::In, -3.0, Clusive::In, 3.0); ErrorsFound = true; - } else { - ValidScheduleControlType = CheckScheduleValueMinMax(state, singleSetpointHtgFanger.PMVSchedIndex, ">=", -3.0, "<=", 3.0); - if (!ValidScheduleControlType) { - ShowSevereError( - state, - format( - "{}=\"{}\" invalid PMV values {}=\"{}\" entered.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); - ShowContinueError(state, "..Values outside of range [-3,+3]."); - ErrorsFound = true; - } } } // SingleFangerHeatingControlNum - cCurrentModuleObject = ValidComfortControlTypes[static_cast(HVAC::ThermostatType::SingleCooling)]; - state.dataZoneTempPredictorCorrector->NumSingleFangerCoolingControls = inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + s_ipsc->cCurrentModuleObject = comfortSetptTypeNames[(int)HVAC::SetptType::SingleCool]; + s_ztpc->NumComfortControls[(int)HVAC::SetptType::SingleCool] = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); - if (state.dataZoneTempPredictorCorrector->NumSingleFangerCoolingControls > 0) { - state.dataZoneTempPredictorCorrector->SetPointSingleCoolingFanger.allocate( - state.dataZoneTempPredictorCorrector->NumSingleFangerCoolingControls); + if (s_ztpc->NumComfortControls[(int)HVAC::SetptType::SingleCool] > 0) { + s_ztpc->comfortSetptScheds[(int)HVAC::SetptType::SingleCool].allocate(s_ztpc->NumComfortControls[(int)HVAC::SetptType::SingleCool]); } - for (int idx = 1; idx <= state.dataZoneTempPredictorCorrector->NumSingleFangerCoolingControls; ++idx) { - inputProcessor->getObjectItem(state, - cCurrentModuleObject, - idx, - cAlphaArgs, - NumAlphas, - rNumericArgs, - NumNums, - IOStat, - lNumericFieldBlanks, - lAlphaFieldBlanks, - cAlphaFieldNames, - cNumericFieldNames); - Util::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); - auto &singleSetpointClgFanger = state.dataZoneTempPredictorCorrector->SetPointSingleCoolingFanger(idx); - singleSetpointClgFanger.Name = cAlphaArgs(1); - singleSetpointClgFanger.PMVSchedName = cAlphaArgs(2); - singleSetpointClgFanger.PMVSchedIndex = GetScheduleIndex(state, cAlphaArgs(2)); - if (singleSetpointClgFanger.PMVSchedIndex == 0) { - ShowSevereError( - state, format("{}=\"{}\" invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); + for (int idx = 1; idx <= s_ztpc->NumComfortControls[(int)HVAC::SetptType::SingleCool]; ++idx) { + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + idx, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + Util::IsNameEmpty(state, s_ipsc->cAlphaArgs(1), s_ipsc->cCurrentModuleObject, ErrorsFound); + auto &setpt = s_ztpc->comfortSetptScheds[(int)HVAC::SetptType::SingleCool](idx); + setpt.Name = s_ipsc->cAlphaArgs(1); + + if (s_ipsc->lAlphaFieldBlanks(2)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(2)); + ErrorsFound = true; + } else if ((setpt.coolSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); + ErrorsFound = true; + } else if (!setpt.coolSched->checkMinMaxVals(state, Clusive::In, -3.0, Clusive::In, 3.0)) { + Sched::ShowSevereBadMinMax(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2), Clusive::In, -3.0, Clusive::In, 3.0); ErrorsFound = true; - } else { - ValidScheduleControlType = CheckScheduleValueMinMax(state, singleSetpointClgFanger.PMVSchedIndex, ">=", -3.0, "<=", 3.0); - if (!ValidScheduleControlType) { - ShowSevereError( - state, - format( - "{}=\"{}\" invalid PMV values {}=\"{}\" entered.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); - ShowContinueError(state, "..Values outside of range [-3,+3]."); - ErrorsFound = true; - } } } // SingleFangerCoolingControlNum - cCurrentModuleObject = ValidComfortControlTypes[static_cast(HVAC::ThermostatType::SingleHeatCool)]; - state.dataZoneTempPredictorCorrector->NumSingleFangerHeatCoolControls = inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - - if (state.dataZoneTempPredictorCorrector->NumSingleFangerHeatCoolControls > 0) - state.dataZoneTempPredictorCorrector->SetPointSingleHeatCoolFanger.allocate( - state.dataZoneTempPredictorCorrector->NumSingleFangerHeatCoolControls); - - for (int idx = 1; idx <= state.dataZoneTempPredictorCorrector->NumSingleFangerHeatCoolControls; ++idx) { - inputProcessor->getObjectItem(state, - cCurrentModuleObject, - idx, - cAlphaArgs, - NumAlphas, - rNumericArgs, - NumNums, - IOStat, - lNumericFieldBlanks, - lAlphaFieldBlanks, - cAlphaFieldNames, - cNumericFieldNames); - Util::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); - auto &singleSetpointHeatCoolFanger = state.dataZoneTempPredictorCorrector->SetPointSingleHeatCoolFanger(idx); - singleSetpointHeatCoolFanger.Name = cAlphaArgs(1); - singleSetpointHeatCoolFanger.PMVSchedName = cAlphaArgs(2); - singleSetpointHeatCoolFanger.PMVSchedIndex = GetScheduleIndex(state, cAlphaArgs(2)); - if (singleSetpointHeatCoolFanger.PMVSchedIndex == 0) { - ShowSevereError( - state, format("{}=\"{}\" invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); + s_ipsc->cCurrentModuleObject = comfortSetptTypeNames[(int)HVAC::SetptType::SingleHeatCool]; + s_ztpc->NumComfortControls[(int)HVAC::SetptType::SingleHeatCool] = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + + if (s_ztpc->NumComfortControls[(int)HVAC::SetptType::SingleHeatCool] > 0) + s_ztpc->comfortSetptScheds[(int)HVAC::SetptType::SingleHeatCool].allocate(s_ztpc->NumComfortControls[(int)HVAC::SetptType::SingleHeatCool]); + + for (int idx = 1; idx <= s_ztpc->NumComfortControls[(int)HVAC::SetptType::SingleHeatCool]; ++idx) { + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + idx, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + Util::IsNameEmpty(state, s_ipsc->cAlphaArgs(1), s_ipsc->cCurrentModuleObject, ErrorsFound); + auto &setpt = s_ztpc->comfortSetptScheds[(int)HVAC::SetptType::SingleHeatCool](idx); + setpt.Name = s_ipsc->cAlphaArgs(1); + + if (s_ipsc->lAlphaFieldBlanks(2)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(2)); + ErrorsFound = true; + } else if ((setpt.heatSched = setpt.coolSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); + ErrorsFound = true; + } else if (!setpt.heatSched->checkMinMaxVals(state, Clusive::In, -3.0, Clusive::In, 3.0)) { + Sched::ShowSevereBadMinMax(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2), Clusive::In, -3.0, Clusive::In, 3.0); ErrorsFound = true; - } else { - ValidScheduleControlType = CheckScheduleValueMinMax(state, singleSetpointHeatCoolFanger.PMVSchedIndex, ">=", -3.0, "<=", 3.0); - if (!ValidScheduleControlType) { - ShowSevereError( - state, - format( - "{}=\"{}\" invalid PMV values {}=\"{}\" entered.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); - ShowContinueError(state, "..Values outside of range [-3,+3]."); - ErrorsFound = true; - } } } // SingleFangerHeatCoolControlNum - cCurrentModuleObject = ValidComfortControlTypes[static_cast(HVAC::ThermostatType::DualSetPointWithDeadBand)]; - state.dataZoneTempPredictorCorrector->NumDualFangerHeatCoolControls = inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - - if (state.dataZoneTempPredictorCorrector->NumDualFangerHeatCoolControls > 0) - state.dataZoneTempPredictorCorrector->SetPointDualHeatCoolFanger.allocate( - state.dataZoneTempPredictorCorrector->NumDualFangerHeatCoolControls); - - for (int idx = 1; idx <= state.dataZoneTempPredictorCorrector->NumDualFangerHeatCoolControls; ++idx) { - inputProcessor->getObjectItem(state, - cCurrentModuleObject, - idx, - cAlphaArgs, - NumAlphas, - rNumericArgs, - NumNums, - IOStat, - lNumericFieldBlanks, - lAlphaFieldBlanks, - cAlphaFieldNames, - cNumericFieldNames); - Util::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); - auto &dualSetpointHeatCoolFanger = state.dataZoneTempPredictorCorrector->SetPointDualHeatCoolFanger(idx); - dualSetpointHeatCoolFanger.Name = cAlphaArgs(1); - dualSetpointHeatCoolFanger.HeatPMVSetptSchedName = cAlphaArgs(2); - dualSetpointHeatCoolFanger.HeatPMVSchedIndex = GetScheduleIndex(state, cAlphaArgs(2)); - if (dualSetpointHeatCoolFanger.HeatPMVSchedIndex == 0) { - ShowSevereError( - state, format("{}=\"{}\" invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); + s_ipsc->cCurrentModuleObject = comfortSetptTypeNames[(int)HVAC::SetptType::DualHeatCool]; + s_ztpc->NumComfortControls[(int)HVAC::SetptType::DualHeatCool] = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); + + if (s_ztpc->NumComfortControls[(int)HVAC::SetptType::DualHeatCool] > 0) + s_ztpc->comfortSetptScheds[(int)HVAC::SetptType::DualHeatCool].allocate(s_ztpc->NumComfortControls[(int)HVAC::SetptType::DualHeatCool]); + + for (int idx = 1; idx <= s_ztpc->NumComfortControls[(int)HVAC::SetptType::DualHeatCool]; ++idx) { + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + idx, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + + Util::IsNameEmpty(state, s_ipsc->cAlphaArgs(1), s_ipsc->cCurrentModuleObject, ErrorsFound); + auto &setpt = s_ztpc->comfortSetptScheds[(int)HVAC::SetptType::DualHeatCool](idx); + setpt.Name = s_ipsc->cAlphaArgs(1); + + if (s_ipsc->lAlphaFieldBlanks(2)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(2)); + ErrorsFound = true; + } else if ((setpt.heatSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); + ErrorsFound = true; + } else if (!setpt.heatSched->checkMinMaxVals(state, Clusive::In, -3.0, Clusive::In, 3.0)) { + Sched::ShowSevereBadMinMax(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2), Clusive::In, -3.0, Clusive::In, 3.0); ErrorsFound = true; } - dualSetpointHeatCoolFanger.CoolPMVSetptSchedName = cAlphaArgs(3); - dualSetpointHeatCoolFanger.CoolPMVSchedIndex = GetScheduleIndex(state, cAlphaArgs(3)); - if (dualSetpointHeatCoolFanger.CoolPMVSchedIndex == 0) { - ShowSevereError( - state, format("{}=\"{}\" invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(3), cAlphaArgs(3))); + + if (s_ipsc->lAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(3)); + ErrorsFound = true; + } else if ((setpt.coolSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3)); + ErrorsFound = true; + } else if (!setpt.coolSched->checkMinMaxVals(state, Clusive::In, -3.0, Clusive::In, 3.0)) { + Sched::ShowSevereBadMinMax(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3), Clusive::In, -3.0, Clusive::In, 3.0); ErrorsFound = true; - } else { - ValidScheduleControlType = CheckScheduleValueMinMax(state, dualSetpointHeatCoolFanger.HeatPMVSchedIndex, ">=", -3.0, "<=", 3.0); - if (!ValidScheduleControlType) { - ShowSevereError( - state, - format( - "{}=\"{}\" invalid PMV values {}=\"{}\" entered.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); - ShowContinueError(state, "..Values outside of range [-3,+3]."); - ErrorsFound = true; - } - ValidScheduleControlType = CheckScheduleValueMinMax(state, dualSetpointHeatCoolFanger.CoolPMVSchedIndex, ">=", -3.0, "<=", 3.0); - if (!ValidScheduleControlType) { - ShowSevereError( - state, - format( - "{}=\"{}\" invalid PMV values {}=\"{}\" entered.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(3), cAlphaArgs(3))); - ShowContinueError(state, "..Values outside of range [-3,+3]."); - ErrorsFound = true; - } } } // DualFangerHeatCoolControlNum // Finish filling in Schedule pointing indexes for Thermal Comfort Control for (ComfortControlledZoneNum = 1; ComfortControlledZoneNum <= state.dataZoneCtrls->NumComfortControlledZones; ++ComfortControlledZoneNum) { - auto &ComfortControlledZone = state.dataZoneCtrls->ComfortControlledZone(ComfortControlledZoneNum); - - int ComfortIndex = Util::FindItem(ValidComfortControlTypes[static_cast(HVAC::ThermostatType::SingleHeating)], - ComfortControlledZone.ControlType, - ComfortControlledZone.NumControlTypes); - ComfortControlledZone.SchIndx_SingleHeating = ComfortIndex; - if (ComfortIndex > 0) { - ComfortControlledZone.ControlTypeSchIndx(ComfortIndex) = Util::FindItem( - ComfortControlledZone.ControlTypeName(ComfortIndex), state.dataZoneTempPredictorCorrector->SetPointSingleHeatingFanger); - TComfortControlTypes(ComfortControlledZoneNum).MustHave[static_cast(HVAC::ThermostatType::SingleHeating)] = true; - } - - ComfortIndex = Util::FindItem(ValidComfortControlTypes[static_cast(HVAC::ThermostatType::SingleCooling)], - ComfortControlledZone.ControlType, - ComfortControlledZone.NumControlTypes); - ComfortControlledZone.SchIndx_SingleCooling = ComfortIndex; - if (ComfortIndex > 0) { - ComfortControlledZone.ControlTypeSchIndx(ComfortIndex) = Util::FindItem( - ComfortControlledZone.ControlTypeName(ComfortIndex), state.dataZoneTempPredictorCorrector->SetPointSingleCoolingFanger); - TComfortControlTypes(ComfortControlledZoneNum).MustHave[static_cast(HVAC::ThermostatType::SingleCooling)] = true; - } - - ComfortIndex = Util::FindItem(ValidComfortControlTypes[static_cast(HVAC::ThermostatType::SingleHeatCool)], - ComfortControlledZone.ControlType, - ComfortControlledZone.NumControlTypes); - ComfortControlledZone.SchIndx_SingleHeatCool = ComfortIndex; - if (ComfortIndex > 0) { - ComfortControlledZone.ControlTypeSchIndx(ComfortIndex) = Util::FindItem( - ComfortControlledZone.ControlTypeName(ComfortIndex), state.dataZoneTempPredictorCorrector->SetPointSingleHeatCoolFanger); - TComfortControlTypes(ComfortControlledZoneNum).MustHave[static_cast(HVAC::ThermostatType::SingleHeatCool)] = true; - } - - ComfortIndex = Util::FindItem(ValidComfortControlTypes[static_cast(HVAC::ThermostatType::DualSetPointWithDeadBand)], - ComfortControlledZone.ControlType, - ComfortControlledZone.NumControlTypes); - ComfortControlledZone.SchIndx_DualSetPointWithDeadBand = ComfortIndex; - if (ComfortIndex > 0) { - ComfortControlledZone.ControlTypeSchIndx(ComfortIndex) = - Util::FindItem(ComfortControlledZone.ControlTypeName(ComfortIndex), state.dataZoneTempPredictorCorrector->SetPointDualHeatCoolFanger); - TComfortControlTypes(ComfortControlledZoneNum).MustHave[static_cast(HVAC::ThermostatType::DualSetPointWithDeadBand)] = true; + + auto &comfortZone = state.dataZoneCtrls->ComfortControlledZone(ComfortControlledZoneNum); + + for (HVAC::SetptType setptType : HVAC::setptTypes) { + auto &setpt = comfortZone.setpts[(int)setptType]; + if (!setpt.isUsed) continue; + + int setptIdx = Util::FindItem(setpt.Name, s_ztpc->comfortSetptScheds[(int)setptType]); + + if (setptType == HVAC::SetptType::SingleHeat || setptType == HVAC::SetptType::SingleHeatCool || + setptType == HVAC::SetptType::DualHeatCool) { + setpt.heatSetptSched = s_ztpc->comfortSetptScheds[(int)setptType](setptIdx).heatSched; + } + + if (setptType == HVAC::SetptType::SingleCool || setptType == HVAC::SetptType::SingleHeatCool || + setptType == HVAC::SetptType::DualHeatCool) { + setpt.coolSetptSched = s_ztpc->comfortSetptScheds[(int)setptType](setptIdx).coolSched; + } + + TComfortControlTypes(ComfortControlledZoneNum).MustHave[(int)setptType] = true; } } // Now, Check the schedule values/indices for validity for Thermal Comfort Control for (ComfortControlledZoneNum = 1; ComfortControlledZoneNum <= state.dataZoneCtrls->NumComfortControlledZones; ++ComfortControlledZoneNum) { - auto &ComfortControlledZone = state.dataZoneCtrls->ComfortControlledZone(ComfortControlledZoneNum); + auto &comfortZone = state.dataZoneCtrls->ComfortControlledZone(ComfortControlledZoneNum); + ActualZoneNum = comfortZone.ActualZoneNum; + if (comfortZone.setptTypeSched == nullptr) continue; - ActualZoneNum = ComfortControlledZone.ActualZoneNum; - CTIndex = ComfortControlledZone.ComfortSchedIndex; - if (CTIndex == 0) continue; // error will be caught elsewhere - SchedMin = GetScheduleMinValue(state, CTIndex); - SchedMax = GetScheduleMaxValue(state, CTIndex); + int SchedMin = comfortZone.setptTypeSched->getMinVal(state); + int SchedMax = comfortZone.setptTypeSched->getMaxVal(state); - if (SchedMin == 0 && SchedMax == 0) { - if (FindNumberInList(CTIndex, CCmSchedMapToControlledZone, state.dataZoneCtrls->NumComfortControlledZones) == 0) { - ShowWarningError(state, format("Control Type Schedule={}", ComfortControlledZone.ControlTypeSchedName)); + if (SchedMin == (int)HVAC::SetptType::Uncontrolled && SchedMax == (int)HVAC::SetptType::Uncontrolled) { + if (FindNumberInList(comfortZone.setptTypeSched->Num, CCmSchedMapToControlledZone, state.dataZoneCtrls->NumComfortControlledZones) == 0) { + ShowWarningError(state, format("Control Type Schedule={}", comfortZone.setptTypeSched->Name)); ShowContinueError(state, "..specifies control type 0 for all entries."); ShowContinueError(state, "All zones using this Control Type Schedule have no thermal comfort control."); } - CCmSchedMapToControlledZone(ComfortControlledZoneNum) = CTIndex; + CCmSchedMapToControlledZone(ComfortControlledZoneNum) = comfortZone.setptTypeSched->Num; } - for (ControlTypeNum = SchedMin; ControlTypeNum <= SchedMax; ++ControlTypeNum) { + for (HVAC::SetptType setptType : HVAC::setptTypes) { + auto const &setpt = comfortZone.setpts[(int)setptType]; + if (!setpt.isUsed) continue; - int ComfortIndex; - switch (static_cast(ControlTypeNum)) { - case HVAC::ThermostatType::Uncontrolled: - break; - case HVAC::ThermostatType::SingleHeating: - ComfortIndex = ComfortControlledZone.SchIndx_SingleHeating; - TComfortControlTypes(ComfortControlledZoneNum).DidHave[static_cast(HVAC::ThermostatType::SingleHeating)] = true; - if (ComfortIndex != 0) { - SchedTypeIndex = ComfortControlledZone.ControlTypeSchIndx(ComfortIndex); - if (SchedTypeIndex == 0) { - ShowSevereError(state, - format("GetZoneAirSetpoints: Could not find {} Schedule={}", - ValidComfortControlTypes[static_cast(HVAC::ThermostatType::SingleHeating)], - ComfortControlledZone.ControlTypeName(ComfortIndex))); - ErrorsFound = true; - } - } else { // ComfortIndex = 0 - if (CheckScheduleValue(state, CTIndex, static_cast(HVAC::ThermostatType::SingleHeating))) { - ShowSevereError(state, format("Control Type Schedule={}", ComfortControlledZone.ControlTypeSchedName)); - ShowContinueError(state, - format("..specifies thermal control type 1 ({}) as the control type. Not valid for this zone.", - ValidComfortControlTypes[static_cast(HVAC::ThermostatType::SingleHeating)])); - ShowContinueError( - state, - format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TCTStat)), ComfortControlledZone.Name)); - ShowContinueError(state, format("..reference ZONE={}", ComfortControlledZone.ZoneName)); - ErrorsFound = true; - } - } - break; - case HVAC::ThermostatType::SingleCooling: - ComfortIndex = ComfortControlledZone.SchIndx_SingleCooling; - TComfortControlTypes(ComfortControlledZoneNum).DidHave[static_cast(HVAC::ThermostatType::SingleCooling)] = true; - if (ComfortIndex != 0) { - SchedTypeIndex = ComfortControlledZone.ControlTypeSchIndx(ComfortIndex); - if (SchedTypeIndex == 0) { - ShowSevereError(state, - format("GetZoneAirSetpoints: Could not find {} Schedule={}", - ValidComfortControlTypes[static_cast(HVAC::ThermostatType::SingleCooling)], - ComfortControlledZone.ControlTypeName(ComfortIndex))); - ErrorsFound = true; - } - } else { // ComfortIndex = 0 - if (CheckScheduleValue(state, CTIndex, static_cast(HVAC::ThermostatType::SingleCooling))) { - ShowSevereError(state, format("Control Type Schedule={}", ComfortControlledZone.ControlTypeSchedName)); - ShowContinueError(state, - format("..specifies thermal control type 2 ({}) as the control type. Not valid for this zone.", - ValidComfortControlTypes[static_cast(HVAC::ThermostatType::SingleCooling)])); - ShowContinueError( - state, - format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TCTStat)), ComfortControlledZone.Name)); - ShowContinueError(state, format("..reference ZONE={}", ComfortControlledZone.ZoneName)); - ErrorsFound = true; - } - } - break; - case HVAC::ThermostatType::SingleHeatCool: - ComfortIndex = ComfortControlledZone.SchIndx_SingleHeatCool; - TComfortControlTypes(ComfortControlledZoneNum).DidHave[static_cast(HVAC::ThermostatType::SingleHeatCool)] = true; - if (ComfortIndex != 0) { - SchedTypeIndex = ComfortControlledZone.ControlTypeSchIndx(ComfortIndex); - if (SchedTypeIndex == 0) { - ShowSevereError(state, - format("GetZoneAirSetpoints: Could not find {} Schedule={}", - ValidComfortControlTypes[static_cast(HVAC::ThermostatType::SingleHeatCool)], - ComfortControlledZone.ControlTypeName(ComfortIndex))); - ErrorsFound = true; - } - } else { // ComfortIndex = 0 - if (CheckScheduleValue(state, CTIndex, static_cast(HVAC::ThermostatType::SingleHeatCool))) { - ShowSevereError(state, format("Schedule={}", ComfortControlledZone.ControlTypeSchedName)); - ShowContinueError(state, - format("..specifies thermal control type 3 ({}) as the control type. Not valid for this zone.", - ValidComfortControlTypes[static_cast(HVAC::ThermostatType::SingleHeatCool)])); - ShowContinueError( - state, - format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TCTStat)), ComfortControlledZone.Name)); - ShowContinueError(state, format("..reference ZONE={}", ComfortControlledZone.ZoneName)); - ErrorsFound = true; - } - } - break; - case HVAC::ThermostatType::DualSetPointWithDeadBand: - ComfortIndex = ComfortControlledZone.SchIndx_DualSetPointWithDeadBand; - TComfortControlTypes(ComfortControlledZoneNum).DidHave[static_cast(HVAC::ThermostatType::DualSetPointWithDeadBand)] = true; - if (ComfortIndex != 0) { - SchedTypeIndex = ComfortControlledZone.ControlTypeSchIndx(ComfortIndex); - if (SchedTypeIndex == 0) { - ShowSevereError(state, - format("GetZoneAirSetpoints: Could not find {} Schedule={}", - ValidComfortControlTypes[static_cast(HVAC::ThermostatType::DualSetPointWithDeadBand)], - ComfortControlledZone.ControlTypeName(ComfortIndex))); - ErrorsFound = true; - } - } else { // ComfortIndex = 0 - if (CheckScheduleValue(state, CTIndex, static_cast(HVAC::ThermostatType::DualSetPointWithDeadBand))) { - ShowSevereError(state, format("Schedule={}", ComfortControlledZone.ControlTypeSchedName)); - ShowContinueError(state, - format("..specifies thermal control type 4 ({}) as the control type. Not valid for this zone.", - ValidComfortControlTypes[static_cast(HVAC::ThermostatType::DualSetPointWithDeadBand)])); - ShowContinueError( - state, - format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TCTStat)), ComfortControlledZone.Name)); - ShowContinueError(state, format("..reference ZONE={}", ComfortControlledZone.ZoneName)); - ErrorsFound = true; - } - } - break; - default: - ShowSevereError(state, - format("GetZoneAirSetpoints: Illegal control type for Zone={}, Found value={}, in Schedule={}", - state.dataHeatBal->Zone(ActualZoneNum).Name, - ControlTypeNum, - ComfortControlledZone.ControlTypeSchedName)); - ShowContinueError(state, "..valid range values are [0,4]."); + TComfortControlTypes(ComfortControlledZoneNum).DidHave[(int)setptType] = true; + + if (setpt.heatSetptSched == nullptr && + (setptType == HVAC::SetptType::SingleHeat || setptType == HVAC::SetptType::SingleHeatCool || + setptType == HVAC::SetptType::DualHeatCool) && + comfortZone.setptTypeSched->hasVal(state, (int)setptType)) { + ShowSevereError(state, format("Control Type Schedule={}", comfortZone.setptTypeSched->Name)); + ShowContinueError( + state, + format("..specifies {} ({}) as the control type. Not valid for this zone.", (int)setptType, setptTypeNames[(int)setptType])); + ShowContinueError(state, format("..reference {}={}", cZControlTypes((int)ZoneControlTypes::TStat), comfortZone.Name)); + ShowContinueError(state, format("..reference ZONE={}", comfortZone.ZoneName)); ErrorsFound = true; - break; } - } - } - - for (ComfortControlledZoneNum = 1; ComfortControlledZoneNum <= state.dataZoneCtrls->NumComfortControlledZones; ++ComfortControlledZoneNum) { - auto &ComfortControlledZone = state.dataZoneCtrls->ComfortControlledZone(ComfortControlledZoneNum); - - ActualZoneNum = ComfortControlledZone.ActualZoneNum; - CTIndex = ComfortControlledZone.ComfortSchedIndex; - if (CTIndex == 0) continue; // error caught elsewhere -- would just be confusing here - for (ControlTypeNum = 1; ControlTypeNum <= 4; ++ControlTypeNum) { - if (TComfortControlTypes(ComfortControlledZoneNum).MustHave[ControlTypeNum] && - TComfortControlTypes(ComfortControlledZoneNum).DidHave[ControlTypeNum]) - continue; - - switch (static_cast(ControlTypeNum)) { - case HVAC::ThermostatType::SingleHeating: - if (!TComfortControlTypes(ComfortControlledZoneNum).MustHave[ControlTypeNum]) continue; - ShowWarningError(state, format("Schedule={}", ComfortControlledZone.ControlTypeSchedName)); - ShowContinueError(state, - format("...should include control type 1 ({}) but does not.", - ValidComfortControlTypes[static_cast(HVAC::ThermostatType::SingleHeating)])); - ShowContinueError( - state, format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TCTStat)), ComfortControlledZone.Name)); - ShowContinueError(state, format("..reference ZONE={}", ComfortControlledZone.ZoneName)); - break; - case HVAC::ThermostatType::SingleCooling: - if (!TComfortControlTypes(ComfortControlledZoneNum).MustHave[ControlTypeNum]) continue; - ShowWarningError(state, format("Schedule={}", ComfortControlledZone.ControlTypeSchedName)); - ShowContinueError(state, - format("...should include control type 2 ({}) but does not.", - ValidComfortControlTypes[static_cast(HVAC::ThermostatType::SingleCooling)])); + if (setpt.coolSetptSched == nullptr && + (setptType == HVAC::SetptType::SingleCool || setptType == HVAC::SetptType::SingleHeatCool || + setptType == HVAC::SetptType::DualHeatCool) && + comfortZone.setptTypeSched->hasVal(state, (int)setptType)) { + ShowSevereError(state, format("Control Type Schedule={}", comfortZone.setptTypeSched->Name)); ShowContinueError( - state, format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TCTStat)), ComfortControlledZone.Name)); - ShowContinueError(state, format("..reference ZONE={}", ComfortControlledZone.ZoneName)); - break; - case HVAC::ThermostatType::SingleHeatCool: - if (!TComfortControlTypes(ComfortControlledZoneNum).MustHave[ControlTypeNum]) continue; - ShowWarningError(state, format("Schedule={}", ComfortControlledZone.ControlTypeSchedName)); - ShowContinueError(state, - format("...should include control type 3 ({}) but does not.", - ValidComfortControlTypes[static_cast(HVAC::ThermostatType::SingleHeatCool)])); - ShowContinueError( - state, format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TCTStat)), ComfortControlledZone.Name)); - ShowContinueError(state, format("..reference ZONE={}", ComfortControlledZone.ZoneName)); - break; - case HVAC::ThermostatType::DualSetPointWithDeadBand: - if (!TComfortControlTypes(ComfortControlledZoneNum).MustHave[ControlTypeNum]) continue; - ShowWarningError(state, format("Schedule={}", ComfortControlledZone.ControlTypeSchedName)); - ShowContinueError(state, - format("...should include control type 4 ({}) but does not.", - ValidComfortControlTypes[static_cast(HVAC::ThermostatType::DualSetPointWithDeadBand)])); - ShowContinueError( - state, format("..reference {}={}", cZControlTypes(static_cast(ZoneControlTypes::TCTStat)), ComfortControlledZone.Name)); - ShowContinueError(state, format("..reference ZONE={}", ComfortControlledZone.ZoneName)); - break; - default: - break; + state, + format("..specifies {} ({}) as the control type. Not valid for this zone.", (int)setptType, setptTypeNames[(int)setptType])); + ShowContinueError(state, format("..reference {}={}", cZControlTypes((int)ZoneControlTypes::TStat), comfortZone.Name)); + ShowContinueError(state, format("..reference ZONE={}", comfortZone.ZoneName)); + ErrorsFound = true; } + } // for (setptType) + } // for (ComfortControlledZoneNum) + + for (int ComfortControlledZoneNum = 1; ComfortControlledZoneNum <= state.dataZoneCtrls->NumComfortControlledZones; ++ComfortControlledZoneNum) { + + auto &comfortZone = state.dataZoneCtrls->ComfortControlledZone(ComfortControlledZoneNum); + ActualZoneNum = comfortZone.ActualZoneNum; + if (comfortZone.setptTypeSched == nullptr) continue; + + for (HVAC::SetptType setptType : HVAC::setptTypes) { + if (TComfortControlTypes(ComfortControlledZoneNum).MustHave[(int)setptType] && + TComfortControlTypes(ComfortControlledZoneNum).DidHave[(int)setptType]) + continue; + + if (!TComfortControlTypes(ComfortControlledZoneNum).MustHave[(int)setptType]) continue; + + ShowWarningError(state, format("Schedule={}", comfortZone.setptTypeSched->Name)); + ShowContinueError(state, + format("...should include control type {} ({}) but does not.", (int)setptType, comfortSetptTypeNames[(int)setptType])); + ShowContinueError(state, format("..reference {}={}", cZControlTypes((int)ZoneControlTypes::TCTStat), comfortZone.Name)); + ShowContinueError(state, format("...reference ZONE={}", comfortZone.ZoneName)); } } @@ -1722,8 +1388,8 @@ void GetZoneAirSetPoints(EnergyPlusData &state) Real64 ZoneVolCapMultpGenContam = 1.0; // Get the Zone Air Capacitance Multiplier for use in the Predictor-Corrector Procedure - cCurrentModuleObject = "ZoneCapacitanceMultiplier:ResearchSpecial"; - int NumZoneCapaMultiplier = inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); // Number of ZonesCapacityMultiplier object + s_ipsc->cCurrentModuleObject = "ZoneCapacitanceMultiplier:ResearchSpecial"; + int NumZoneCapaMultiplier = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); // Number of ZonesCapacityMultiplier object if (NumZoneCapaMultiplier == 0) { // Assign default multiplier values to all zones for (int ZoneNum = 1; ZoneNum <= NumOfZones; ZoneNum++) { @@ -1740,52 +1406,55 @@ void GetZoneAirSetPoints(EnergyPlusData &state) // Added by S. Lee and R. Zhang in Oct. 2016. // Assign the user inputted multipliers to specified zones for (int ZoneCapNum = 1; ZoneCapNum <= NumZoneCapaMultiplier; ZoneCapNum++) { - inputProcessor->getObjectItem(state, - cCurrentModuleObject, - ZoneCapNum, - cAlphaArgs, - NumAlphas, - rNumericArgs, - NumNums, - IOStat, - lNumericFieldBlanks, - lAlphaFieldBlanks, - cAlphaFieldNames, - cNumericFieldNames); - - if (lAlphaFieldBlanks(2)) { + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + ZoneCapNum, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + if (s_ipsc->lAlphaFieldBlanks(2)) { // default multiplier values for all the zones not specified (zone or zonelist name field is empty) - ZoneVolCapMultpSens = rNumericArgs(1); - ZoneVolCapMultpMoist = rNumericArgs(2); - ZoneVolCapMultpCO2 = rNumericArgs(3); - ZoneVolCapMultpGenContam = rNumericArgs(4); + ZoneVolCapMultpSens = s_ipsc->rNumericArgs(1); + ZoneVolCapMultpMoist = s_ipsc->rNumericArgs(2); + ZoneVolCapMultpCO2 = s_ipsc->rNumericArgs(3); + ZoneVolCapMultpGenContam = s_ipsc->rNumericArgs(4); } else { // multiplier values for the specified zone(s) ZLItem = 0; - Item1 = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone); - if (Item1 == 0 && state.dataHeatBal->NumOfZoneLists > 0) ZLItem = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->ZoneList); + + Item1 = Util::FindItemInList(s_ipsc->cAlphaArgs(2), Zone); + if (Item1 == 0 && state.dataHeatBal->NumOfZoneLists > 0) ZLItem = Util::FindItemInList(s_ipsc->cAlphaArgs(2), ZoneList); if (Item1 > 0) { - auto &Zone = state.dataHeatBal->Zone(Item1); - Zone.FlagCustomizedZoneCap = true; - Zone.ZoneVolCapMultpSens = rNumericArgs(1); - Zone.ZoneVolCapMultpMoist = rNumericArgs(2); - Zone.ZoneVolCapMultpCO2 = rNumericArgs(3); - Zone.ZoneVolCapMultpGenContam = rNumericArgs(4); + int ZoneNum = Item1; + Zone(ZoneNum).FlagCustomizedZoneCap = true; + Zone(ZoneNum).ZoneVolCapMultpSens = s_ipsc->rNumericArgs(1); + Zone(ZoneNum).ZoneVolCapMultpMoist = s_ipsc->rNumericArgs(2); + Zone(ZoneNum).ZoneVolCapMultpCO2 = s_ipsc->rNumericArgs(3); + Zone(ZoneNum).ZoneVolCapMultpGenContam = s_ipsc->rNumericArgs(4); } else if (ZLItem > 0) { - auto &ZoneList = state.dataHeatBal->ZoneList(ZLItem); - for (int ZonePtrNum = 1; ZonePtrNum < ZoneList.NumOfZones; ZonePtrNum++) { - auto &Zone = state.dataHeatBal->Zone(ZoneList.Zone(ZonePtrNum)); - Zone.FlagCustomizedZoneCap = true; - Zone.ZoneVolCapMultpSens = rNumericArgs(1); - Zone.ZoneVolCapMultpMoist = rNumericArgs(2); - Zone.ZoneVolCapMultpCO2 = rNumericArgs(3); - Zone.ZoneVolCapMultpGenContam = rNumericArgs(4); + for (int ZonePtrNum = 1; ZonePtrNum < ZoneList(ZLItem).NumOfZones; ZonePtrNum++) { + int ZoneNum = ZoneList(ZLItem).Zone(ZonePtrNum); + Zone(ZoneNum).FlagCustomizedZoneCap = true; + Zone(ZoneNum).ZoneVolCapMultpSens = s_ipsc->rNumericArgs(1); + Zone(ZoneNum).ZoneVolCapMultpMoist = s_ipsc->rNumericArgs(2); + Zone(ZoneNum).ZoneVolCapMultpCO2 = s_ipsc->rNumericArgs(3); + Zone(ZoneNum).ZoneVolCapMultpGenContam = s_ipsc->rNumericArgs(4); } } else { - ShowSevereError( - state, - format("{}=\"{}\" invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); + ShowSevereError(state, + format("{}=\"{}\" invalid {}=\"{}\" not found.", + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } } @@ -1829,110 +1498,97 @@ void GetZoneAirSetPoints(EnergyPlusData &state) print(state.files.eio, Header); print(state.files.eio, Format_701, ZoneVolCapMultpSens, ZoneVolCapMultpMoist, ZoneVolCapMultpCO2, ZoneVolCapMultpGenContam); - cCurrentModuleObject = cZControlTypes(static_cast(ZoneControlTypes::OTTStat)); - state.dataZoneCtrls->NumOpTempControlledZones = inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + s_ipsc->cCurrentModuleObject = cZControlTypes((int)ZoneControlTypes::OTTStat); + state.dataZoneCtrls->NumOpTempControlledZones = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); if (state.dataZoneCtrls->NumOpTempControlledZones > 0) { state.dataZoneCtrls->AnyOpTempControl = true; for (int idx = 1; idx <= state.dataZoneCtrls->NumOpTempControlledZones; ++idx) { - inputProcessor->getObjectItem(state, - cCurrentModuleObject, - idx, - cAlphaArgs, - NumAlphas, - rNumericArgs, - NumNums, - IOStat, - lNumericFieldBlanks, - lAlphaFieldBlanks, - cAlphaFieldNames, - cNumericFieldNames); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + idx, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + // find matching name of ZONECONTROL:THERMOSTAT object - found = Util::FindItem(cAlphaArgs(1), state.dataZoneCtrls->TStatObjects); + found = Util::FindItem(s_ipsc->cAlphaArgs(1), TStatObjects); if (found == 0) { // It might be in the TempControlledZones - found = Util::FindItem(cAlphaArgs(1), state.dataZoneCtrls->TempControlledZone); + found = Util::FindItem(s_ipsc->cAlphaArgs(1), state.dataZoneCtrls->TempControlledZone); if (found == 0) { // throw error ShowSevereError(state, format("{}={} invalid {} reference not found.", - cCurrentModuleObject, - cAlphaArgs(1), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), cZControlTypes(static_cast(ZoneControlTypes::TStat)))); ErrorsFound = true; } else { - auto &TempControlledZone = state.dataZoneCtrls->TempControlledZone(found); - TempControlledZone.OperativeTempControl = true; - if (Util::SameString(cAlphaArgs(2), "Scheduled")) { - TempControlledZone.OpTempCntrlModeScheduled = true; + TempControlledZoneNum = found; + auto &tempZone = state.dataZoneCtrls->TempControlledZone(TempControlledZoneNum); + tempZone.OperativeTempControl = true; + if (Util::SameString(s_ipsc->cAlphaArgs(2), "Scheduled")) { + tempZone.OpTempCntrlModeScheduled = true; } - if ((!(Util::SameString(cAlphaArgs(2), "Scheduled"))) && (!(Util::SameString(cAlphaArgs(2), "Constant")))) { - ShowSevereError(state, - format("{}={} invalid {}=\"{}\".", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); + if ((!(Util::SameString(s_ipsc->cAlphaArgs(2), "Scheduled"))) && (!(Util::SameString(s_ipsc->cAlphaArgs(2), "Constant")))) { + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); ErrorsFound = true; } - TempControlledZone.FixedRadiativeFraction = rNumericArgs(1); - TempControlledZone.OpTempRadiativeFractionSched = GetScheduleIndex(state, cAlphaArgs(3)); - if ((TempControlledZone.OpTempRadiativeFractionSched == 0) && (TempControlledZone.OpTempCntrlModeScheduled)) { // throw error - ShowSevereError( - state, - format("{}={} invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(3), cAlphaArgs(3))); - ErrorsFound = true; - } + tempZone.FixedRadiativeFraction = s_ipsc->rNumericArgs(1); - // check validity of fixed radiative fraction - if ((TempControlledZone.FixedRadiativeFraction < 0.0) && (!(TempControlledZone.OpTempCntrlModeScheduled))) { - ShowSevereError(state, - format("{}={} invalid {}=[{:.2T}\" cannot be negative.", - cCurrentModuleObject, - cAlphaArgs(1), - cNumericFieldNames(1), - rNumericArgs(1))); - ErrorsFound = true; - } - if ((TempControlledZone.FixedRadiativeFraction >= 0.9) && (!(TempControlledZone.OpTempCntrlModeScheduled))) { - ShowSevereError(state, - format("{}={} invalid {}=[{:.2T}\" cannot >= .9.", - cCurrentModuleObject, - cAlphaArgs(1), - cNumericFieldNames(1), - rNumericArgs(1))); - ErrorsFound = true; - } + if (tempZone.OpTempCntrlModeScheduled) { + if (s_ipsc->lAlphaFieldBlanks(3)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(3)); + ErrorsFound = true; + } else if ((tempZone.opTempRadiativeFractionSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(3))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3)); + ErrorsFound = true; + } else if (!tempZone.opTempRadiativeFractionSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::Ex, 0.9)) { + Sched::ShowSevereBadMinMax( + state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3), Clusive::In, 0.0, Clusive::Ex, 0.9); + ErrorsFound = true; + } - // check schedule min max. - if (TempControlledZone.OpTempCntrlModeScheduled) { - bool ValidRadFractSched = - CheckScheduleValueMinMax(state, TempControlledZone.OpTempRadiativeFractionSched, ">=", 0.0, "<", 0.9); - if (!ValidRadFractSched) { - ShowSevereError( - state, - format("{}={} invalid values {}=[{}\".", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(3), cAlphaArgs(3))); - ShowContinueError(state, "..Values outside of range [0.0,0.9)."); + } else { // !tempZone.OpTempCntrlModeScheduled + + if (tempZone.FixedRadiativeFraction < 0.0) { + ShowSevereBadMin(state, eoh, s_ipsc->cNumericFieldNames(1), s_ipsc->rNumericArgs(1), Clusive::In, 0.0); + ErrorsFound = true; + } else if (tempZone.FixedRadiativeFraction >= 0.9) { + ShowSevereBadMax(state, eoh, s_ipsc->cNumericFieldNames(1), s_ipsc->rNumericArgs(1), Clusive::Ex, 0.9); ErrorsFound = true; } } // added Jan, 2017 - Xuan Luo // read adaptive comfort model and calculate adaptive thermal comfort setpoint - if (TempControlledZone.OperativeTempControl) { - if (NumAlphas >= 4 && !lAlphaFieldBlanks(4)) { + if (tempZone.OperativeTempControl) { + if (NumAlphas >= 4 && !s_ipsc->lAlphaFieldBlanks(4)) { int adaptiveComfortModelTypeIndex = - Util::FindItem(cAlphaArgs(4), AdaptiveComfortModelTypes, AdaptiveComfortModelTypes.isize()); + Util::FindItem(s_ipsc->cAlphaArgs(4), AdaptiveComfortModelTypes, AdaptiveComfortModelTypes.isize()); if (!adaptiveComfortModelTypeIndex) { ShowSevereError(state, format("{}={} invalid {}=\"{}\" not found.", - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(4), - cAlphaArgs(4))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(4), + s_ipsc->cAlphaArgs(4))); ErrorsFound = true; } else if (adaptiveComfortModelTypeIndex != static_cast(AdaptiveComfortModel::ADAP_NONE)) { - TempControlledZone.AdaptiveComfortTempControl = true; - TempControlledZone.AdaptiveComfortModelTypeIndex = - Util::FindItem(cAlphaArgs(4), AdaptiveComfortModelTypes, AdaptiveComfortModelTypes.isize()); - if (!state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.initialized) { + tempZone.AdaptiveComfortTempControl = true; + tempZone.AdaptiveComfortModelTypeIndex = + Util::FindItem(s_ipsc->cAlphaArgs(4), AdaptiveComfortModelTypes, AdaptiveComfortModelTypes.isize()); + if (!s_ztpc->AdapComfortDailySetPointSchedule.initialized) { Array1D runningAverageASH(state.dataWeather->NumDaysInYear, 0.0); Array1D runningAverageCEN(state.dataWeather->NumDaysInYear, 0.0); CalculateMonthlyRunningAverageDryBulb(state, runningAverageASH, runningAverageCEN); @@ -1946,10 +1602,10 @@ void GetZoneAirSetPoints(EnergyPlusData &state) SetupOutputVariable(state, "Zone Thermostat Operative Temperature", Constant::Units::C, - state.dataHeatBal->ZnAirRpt(TempControlledZone.ActualZoneNum).ThermOperativeTemp, + state.dataHeatBal->ZnAirRpt(tempZone.ActualZoneNum).ThermOperativeTemp, OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, - state.dataHeatBal->Zone(TempControlledZone.ActualZoneNum).Name); + Zone(tempZone.ActualZoneNum).Name); } } else { auto const &TStatObjects = state.dataZoneCtrls->TStatObjects(found); @@ -1957,57 +1613,48 @@ void GetZoneAirSetPoints(EnergyPlusData &state) TempControlledZoneNum = TStatObjects.TempControlledZoneStartPtr + Item - 1; auto &TempControlledZone = state.dataZoneCtrls->TempControlledZone(TempControlledZoneNum); if (state.dataZoneCtrls->NumTempControlledZones == 0) continue; - TempControlledZone.OperativeTempControl = true; - if (Util::SameString(cAlphaArgs(2), "Scheduled")) { - TempControlledZone.OpTempCntrlModeScheduled = true; + auto &tempZone = state.dataZoneCtrls->TempControlledZone(TempControlledZoneNum); + tempZone.OperativeTempControl = true; + if (Util::SameString(s_ipsc->cAlphaArgs(2), "Scheduled")) { + tempZone.OpTempCntrlModeScheduled = true; } if (Item == 1) { - if ((!(Util::SameString(cAlphaArgs(2), "Scheduled"))) && (!(Util::SameString(cAlphaArgs(2), "Constant")))) { - ShowSevereError( - state, format("{}={} invalid {}=\"{}\".", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); + if ((!(Util::SameString(s_ipsc->cAlphaArgs(2), "Scheduled"))) && (!(Util::SameString(s_ipsc->cAlphaArgs(2), "Constant")))) { + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); ErrorsFound = true; } } - TempControlledZone.FixedRadiativeFraction = rNumericArgs(1); - TempControlledZone.OpTempRadiativeFractionSched = GetScheduleIndex(state, cAlphaArgs(3)); - if (Item == 1) { - if ((TempControlledZone.OpTempRadiativeFractionSched == 0) && (TempControlledZone.OpTempCntrlModeScheduled)) { // throw error - ShowSevereError( - state, - format( - "{}={} invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(3), cAlphaArgs(3))); - ErrorsFound = true; + tempZone.FixedRadiativeFraction = s_ipsc->rNumericArgs(1); + + if (tempZone.OpTempCntrlModeScheduled) { + if (s_ipsc->lAlphaFieldBlanks(3)) { + if (Item == 1) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(3)); + ErrorsFound = true; + } + } else if ((tempZone.opTempRadiativeFractionSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(3))) == nullptr) { + if (Item == 1) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3)); + ErrorsFound = true; + } + } else if (!tempZone.opTempRadiativeFractionSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::Ex, 0.9)) { + if (Item == 1) { + Sched::ShowSevereBadMinMax( + state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3), Clusive::In, 0.0, Clusive::Ex, 0.9); + ErrorsFound = true; + } } + + } else { // !tempZone.OpTempCntrlModeScheduled + // check validity of fixed radiative fraction - if ((TempControlledZone.FixedRadiativeFraction < 0.0) && (!(TempControlledZone.OpTempCntrlModeScheduled))) { - ShowSevereError(state, - format("{}={} invalid {}=[{:.2T}\" cannot be negative.", - cCurrentModuleObject, - cAlphaArgs(1), - cNumericFieldNames(1), - rNumericArgs(1))); - ErrorsFound = true; - } - if ((TempControlledZone.FixedRadiativeFraction >= 0.9) && (!(TempControlledZone.OpTempCntrlModeScheduled))) { - ShowSevereError(state, - format("{}={} invalid {}=[{:.2T}\" cannot >= .9.", - cCurrentModuleObject, - cAlphaArgs(1), - cNumericFieldNames(1), - rNumericArgs(1))); - ErrorsFound = true; - } - // check schedule min max. - if (TempControlledZone.OpTempCntrlModeScheduled) { - bool ValidRadFractSched = - CheckScheduleValueMinMax(state, TempControlledZone.OpTempRadiativeFractionSched, ">=", 0.0, "<", 0.9); - if (!ValidRadFractSched) { - ShowSevereError( - state, - format( - "{}={} invalid values {}=[{}\".", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(3), cAlphaArgs(3))); - ShowContinueError(state, "..Values outside of range [0.0,0.9)."); + if (Item == 1) { + if (tempZone.FixedRadiativeFraction < 0.0) { + ShowSevereBadMin(state, eoh, s_ipsc->cNumericFieldNames(1), s_ipsc->rNumericArgs(1), Clusive::In, 0.0); + ErrorsFound = true; + } else if (tempZone.FixedRadiativeFraction >= 0.9) { + ShowSevereBadMax(state, eoh, s_ipsc->cNumericFieldNames(1), s_ipsc->rNumericArgs(1), Clusive::Ex, 0.9); ErrorsFound = true; } } @@ -2015,23 +1662,18 @@ void GetZoneAirSetPoints(EnergyPlusData &state) // added Jan, 2017 - Xuan Luo // read adaptive comfort model and calculate adaptive thermal comfort setpoint - if (TempControlledZone.OperativeTempControl) { - if (NumAlphas >= 4 && !lAlphaFieldBlanks(4)) { + if (tempZone.OperativeTempControl) { + if (NumAlphas >= 4 && !s_ipsc->lAlphaFieldBlanks(4)) { int adaptiveComfortModelTypeIndex = - Util::FindItem(cAlphaArgs(4), AdaptiveComfortModelTypes, AdaptiveComfortModelTypes.isize()); + Util::FindItem(s_ipsc->cAlphaArgs(4), AdaptiveComfortModelTypes, AdaptiveComfortModelTypes.isize()); if (!adaptiveComfortModelTypeIndex) { - ShowSevereError(state, - format("{}={} invalid {}=\"{}\" not found.", - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(4), - cAlphaArgs(4))); + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4)); ErrorsFound = true; } else if (adaptiveComfortModelTypeIndex != static_cast(AdaptiveComfortModel::ADAP_NONE)) { - TempControlledZone.AdaptiveComfortTempControl = true; - TempControlledZone.AdaptiveComfortModelTypeIndex = - Util::FindItem(cAlphaArgs(4), AdaptiveComfortModelTypes, AdaptiveComfortModelTypes.isize()); - if (!state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.initialized) { + tempZone.AdaptiveComfortTempControl = true; + tempZone.AdaptiveComfortModelTypeIndex = + Util::FindItem(s_ipsc->cAlphaArgs(4), AdaptiveComfortModelTypes, AdaptiveComfortModelTypes.isize()); + if (!s_ztpc->AdapComfortDailySetPointSchedule.initialized) { Array1D runningAverageASH(state.dataWeather->NumDaysInYear, 0.0); Array1D runningAverageCEN(state.dataWeather->NumDaysInYear, 0.0); CalculateMonthlyRunningAverageDryBulb(state, runningAverageASH, runningAverageCEN); @@ -2045,485 +1687,417 @@ void GetZoneAirSetPoints(EnergyPlusData &state) SetupOutputVariable(state, "Zone Thermostat Operative Temperature", Constant::Units::C, - state.dataHeatBal->ZnAirRpt(TempControlledZone.ActualZoneNum).ThermOperativeTemp, + state.dataHeatBal->ZnAirRpt(tempZone.ActualZoneNum).ThermOperativeTemp, OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, - state.dataHeatBal->Zone(TempControlledZone.ActualZoneNum).Name); + Zone(tempZone.ActualZoneNum).Name); } // TStat Objects Loop - } // found thermostat referene + } // found thermostat reference } // loop over NumOpTempControlledZones } // NumOpTempControlledZones > 0 // Overcool dehumidificaton GetInput starts here - cCurrentModuleObject = cZControlTypes(static_cast(ZoneControlTypes::TandHStat)); - state.dataZoneCtrls->NumTempAndHumidityControlledZones = inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); - + s_ipsc->cCurrentModuleObject = cZControlTypes((int)ZoneControlTypes::TandHStat); + state.dataZoneCtrls->NumTempAndHumidityControlledZones = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); if (state.dataZoneCtrls->NumTempAndHumidityControlledZones > 0) { state.dataZoneCtrls->AnyZoneTempAndHumidityControl = true; for (int idx = 1; idx <= state.dataZoneCtrls->NumTempAndHumidityControlledZones; ++idx) { - inputProcessor->getObjectItem(state, - cCurrentModuleObject, - idx, - cAlphaArgs, - NumAlphas, - rNumericArgs, - NumNums, - IOStat, - lNumericFieldBlanks, - lAlphaFieldBlanks, - cAlphaFieldNames, - cNumericFieldNames); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + idx, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + // find matching name of ZONECONTROL:THERMOSTAT object - found = Util::FindItem(cAlphaArgs(1), state.dataZoneCtrls->TStatObjects); + found = Util::FindItem(s_ipsc->cAlphaArgs(1), TStatObjects); if (found == 0) { // It might be in the TempControlledZones - found = Util::FindItem(cAlphaArgs(1), state.dataZoneCtrls->TempControlledZone); + found = Util::FindItem(s_ipsc->cAlphaArgs(1), state.dataZoneCtrls->TempControlledZone); if (found == 0) { // throw error ShowSevereError(state, format("{}={} invalid {} reference not found.", - cCurrentModuleObject, - cAlphaArgs(1), + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), cZControlTypes(static_cast(ZoneControlTypes::TStat)))); ErrorsFound = true; } else { TempControlledZoneNum = found; - auto &TempControlledZone = state.dataZoneCtrls->TempControlledZone(TempControlledZoneNum); - TempControlledZone.DehumidifyingSched = cAlphaArgs(2); - TempControlledZone.DehumidifyingSchedIndex = GetScheduleIndex(state, cAlphaArgs(2)); - if (TempControlledZone.DehumidifyingSchedIndex == 0) { - ShowSevereError( - state, - format("{}=\"{} invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); - ErrorsFound = true; - } - TempControlledZone.ZoneOvercoolControl = true; - if ((Util::SameString(cAlphaArgs(3), "None"))) { - TempControlledZone.ZoneOvercoolControl = false; - } - if (Util::SameString(cAlphaArgs(4), "Scheduled")) { - TempControlledZone.OvercoolCntrlModeScheduled = true; - } - if ((!(Util::SameString(cAlphaArgs(4), "Scheduled"))) && (!(Util::SameString(cAlphaArgs(4), "Constant")))) { - ShowSevereError(state, - format("{}={} invalid {}=\"{}\".", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(4), cAlphaArgs(4))); - ErrorsFound = true; - } + auto &tempZone = state.dataZoneCtrls->TempControlledZone(TempControlledZoneNum); - TempControlledZone.ZoneOvercoolConstRange = rNumericArgs(1); - TempControlledZone.ZoneOvercoolRangeSchedIndex = GetScheduleIndex(state, cAlphaArgs(4)); - if ((TempControlledZone.ZoneOvercoolRangeSchedIndex == 0) && (TempControlledZone.OvercoolCntrlModeScheduled)) { // throw error - ShowSevereError( - state, - format("{}={} invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(5), cAlphaArgs(5))); + if (s_ipsc->lAlphaFieldBlanks(2)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(2)); + ErrorsFound = true; + } else if ((tempZone.dehumidifyingSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); ErrorsFound = true; } - // check validity of zone Overcool constant range - if ((TempControlledZone.ZoneOvercoolConstRange < 0.0) && (!(TempControlledZone.OvercoolCntrlModeScheduled))) { - ShowSevereError(state, - format("{}={} invalid {}=[{:.2T}\" cannot be negative.", - cCurrentModuleObject, - cAlphaArgs(1), - cNumericFieldNames(1), - rNumericArgs(1))); - ErrorsFound = true; + tempZone.ZoneOvercoolControl = true; + if ((Util::SameString(s_ipsc->cAlphaArgs(3), "None"))) { + tempZone.ZoneOvercoolControl = false; } - if ((TempControlledZone.ZoneOvercoolConstRange > 3.0) && (!(TempControlledZone.OvercoolCntrlModeScheduled))) { - ShowSevereError(state, - format("{}={} invalid {}=[{:.2T}\" cannot be > 3.0", - cCurrentModuleObject, - cAlphaArgs(1), - cNumericFieldNames(1), - rNumericArgs(1))); + if (Util::SameString(s_ipsc->cAlphaArgs(4), "Scheduled")) { + tempZone.OvercoolCntrlModeScheduled = true; + } else if (!Util::SameString(s_ipsc->cAlphaArgs(4), "Constant")) { + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4)); ErrorsFound = true; } - // check zone Overcool range schedule min/max values. - if (TempControlledZone.OvercoolCntrlModeScheduled) { - bool ValidZoneOvercoolRangeSched = - CheckScheduleValueMinMax(state, TempControlledZone.ZoneOvercoolRangeSchedIndex, ">=", 0.0, "<=", 3.0); - if (!ValidZoneOvercoolRangeSched) { - ShowSevereError( - state, - format("{}={} invalid values {}=[{}\".", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(5), cAlphaArgs(5))); - ShowContinueError(state, "..Values outside of range [0.0,3.0]."); + tempZone.ZoneOvercoolConstRange = s_ipsc->rNumericArgs(1); + + if (tempZone.OvercoolCntrlModeScheduled) { + if (s_ipsc->lAlphaFieldBlanks(5)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(5)); + ErrorsFound = true; + } else if ((tempZone.zoneOvercoolRangeSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(5))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaArgs(5)); + ErrorsFound = true; + } else if (!tempZone.zoneOvercoolRangeSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 3.0)) { + Sched::ShowSevereBadMinMax( + state, eoh, s_ipsc->cAlphaFieldNames(5), s_ipsc->cAlphaArgs(5), Clusive::In, 0.0, Clusive::In, 3.0); + ErrorsFound = true; + } + } else { // !tempZone.OvercoolCntrlModeScheduled + + if (tempZone.ZoneOvercoolConstRange < 0.0) { + ShowSevereBadMin(state, eoh, s_ipsc->cNumericFieldNames(1), s_ipsc->rNumericArgs(1), Clusive::In, 0.0); + ErrorsFound = true; + } else if (tempZone.ZoneOvercoolConstRange > 3.0) { + ShowSevereBadMax(state, eoh, s_ipsc->cNumericFieldNames(1), s_ipsc->rNumericArgs(1), Clusive::In, 3.0); + ErrorsFound = true; + } + + // check Overcool Control Ratio limits + tempZone.ZoneOvercoolControlRatio = s_ipsc->rNumericArgs(2); + if (tempZone.ZoneOvercoolControlRatio < 0.0) { + ShowSevereBadMin(state, eoh, s_ipsc->cNumericFieldNames(2), s_ipsc->rNumericArgs(2), Clusive::In, 0.0); ErrorsFound = true; } - } - // check Overcool Control Ratio limits - TempControlledZone.ZoneOvercoolControlRatio = rNumericArgs(2); - if (TempControlledZone.ZoneOvercoolControlRatio < 0.0) { - ShowSevereError(state, - format("{}={} invalid {}=[{:.2T}\" cannot be negative.", - cCurrentModuleObject, - cAlphaArgs(2), - cNumericFieldNames(2), - rNumericArgs(2))); - ErrorsFound = true; } } + } else { - auto const &TStatObjects = state.dataZoneCtrls->TStatObjects(found); - for (Item = 1; Item <= TStatObjects.NumOfZones; ++Item) { - TempControlledZoneNum = TStatObjects.TempControlledZoneStartPtr + Item - 1; - auto &TempControlledZone = state.dataZoneCtrls->TempControlledZone(TempControlledZoneNum); - TempControlledZone.DehumidifyingSched = cAlphaArgs(2); - TempControlledZone.DehumidifyingSchedIndex = GetScheduleIndex(state, cAlphaArgs(2)); - if (TempControlledZone.DehumidifyingSchedIndex == 0) { - ShowSevereError( - state, - format("{}=\"{} invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); + for (int Item = 1; Item <= TStatObjects(found).NumOfZones; ++Item) { + TempControlledZoneNum = TStatObjects(found).TempControlledZoneStartPtr + Item - 1; + + auto &tempZone = state.dataZoneCtrls->TempControlledZone(TempControlledZoneNum); + + if (s_ipsc->lAlphaFieldBlanks(2)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(2)); + ErrorsFound = true; + } else if ((tempZone.dehumidifyingSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); ErrorsFound = true; } - TempControlledZone.ZoneOvercoolControl = true; - if ((Util::SameString(cAlphaArgs(3), "None"))) { - TempControlledZone.ZoneOvercoolControl = false; - } - if (Util::SameString(cAlphaArgs(4), "Scheduled")) { - TempControlledZone.OvercoolCntrlModeScheduled = false; + + tempZone.ZoneOvercoolControl = true; + if (Util::SameString(s_ipsc->cAlphaArgs(3), "None")) { + tempZone.ZoneOvercoolControl = false; } - if (Item == 1) { - if ((!(Util::SameString(cAlphaArgs(4), "Scheduled"))) && (!(Util::SameString(cAlphaArgs(4), "Constant")))) { - ShowSevereError( - state, format("{}={} invalid {}=\"{}\".", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(4), cAlphaArgs(4))); + + if (Util::SameString(s_ipsc->cAlphaArgs(4), "Scheduled")) { + tempZone.OvercoolCntrlModeScheduled = false; + } else if (!Util::SameString(s_ipsc->cAlphaArgs(4), "Constant")) { + if (Item == 1) { + ShowSevereInvalidKey(state, eoh, s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4)); ErrorsFound = true; } } - TempControlledZone.ZoneOvercoolConstRange = rNumericArgs(1); - TempControlledZone.ZoneOvercoolRangeSchedIndex = GetScheduleIndex(state, cAlphaArgs(6)); - if (Item == 1) { - if ((TempControlledZone.ZoneOvercoolRangeSchedIndex == 0) && (TempControlledZone.OvercoolCntrlModeScheduled)) { // throw error - ShowSevereError( - state, - format( - "{}={} invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(5), cAlphaArgs(5))); - ErrorsFound = true; - } - // check validity of zone Overcool constant range - if ((TempControlledZone.ZoneOvercoolConstRange < 0.0) && (!(TempControlledZone.OvercoolCntrlModeScheduled))) { - ShowSevereError(state, - format("{}={} invalid {}=[{:.2T}\" cannot be negative.", - cCurrentModuleObject, - cAlphaArgs(1), - cNumericFieldNames(1), - rNumericArgs(1))); - ErrorsFound = true; - } - if ((TempControlledZone.ZoneOvercoolConstRange > 3.0) && (!(TempControlledZone.OvercoolCntrlModeScheduled))) { - ShowSevereError(state, - format("{}={} invalid {}=[{:.2T}\" cannot > 3.0", - cCurrentModuleObject, - cAlphaArgs(1), - cNumericFieldNames(1), - rNumericArgs(1))); - ErrorsFound = true; + + tempZone.ZoneOvercoolConstRange = s_ipsc->rNumericArgs(1); + + if (tempZone.OvercoolCntrlModeScheduled) { + if (s_ipsc->lAlphaFieldBlanks(6)) { + if (Item == 1) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(6)); + ErrorsFound = true; + } + } else if ((tempZone.zoneOvercoolRangeSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(6))) == nullptr) { + if (Item == 1) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(6), s_ipsc->cAlphaArgs(6)); + ErrorsFound = true; + } + } else if (!tempZone.zoneOvercoolRangeSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 3.0)) { + if (Item == 1) { + Sched::ShowSevereBadMinMax( + state, eoh, s_ipsc->cAlphaFieldNames(6), s_ipsc->cAlphaArgs(6), Clusive::In, 0.0, Clusive::In, 3.0); + ErrorsFound = true; + } } - // check zone Overcool range schedule min/max values. - if (TempControlledZone.OvercoolCntrlModeScheduled) { - bool ValidZoneOvercoolRangeSched = - CheckScheduleValueMinMax(state, TempControlledZone.ZoneOvercoolRangeSchedIndex, ">=", 0.0, "<=", 3.0); - if (!ValidZoneOvercoolRangeSched) { - ShowSevereError( - state, - format( - "{}={} invalid values {}=[{}\".", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(5), cAlphaArgs(5))); - ShowContinueError(state, "..Values outside of range [0.0,3.0]."); + } else { // tempZone.OvercoolCntrlModeScheduled + if (Item == 1) { + if (tempZone.ZoneOvercoolConstRange < 0.0) { + ShowSevereBadMin(state, eoh, s_ipsc->cNumericFieldNames(1), s_ipsc->rNumericArgs(1), Clusive::In, 0.0); + ErrorsFound = true; + } else if (tempZone.ZoneOvercoolConstRange > 3.0) { + ShowSevereBadMax(state, eoh, s_ipsc->cNumericFieldNames(1), s_ipsc->rNumericArgs(1), Clusive::In, 3.0); ErrorsFound = true; } } } - TempControlledZone.ZoneOvercoolControlRatio = rNumericArgs(2); + + tempZone.ZoneOvercoolControlRatio = s_ipsc->rNumericArgs(2); // check Overcool Control Ratio limits - if (Item == 1) { - if (TempControlledZone.ZoneOvercoolControlRatio < 0.0) { - ShowSevereError(state, - format("{}={} invalid {}=[{:.2T}\" cannot be negative.", - cCurrentModuleObject, - cAlphaArgs(2), - cNumericFieldNames(2), - rNumericArgs(2))); + if (tempZone.ZoneOvercoolControlRatio < 0.0) { + if (Item == 1) { + ShowSevereBadMin(state, eoh, s_ipsc->cNumericFieldNames(2), s_ipsc->rNumericArgs(2), Clusive::In, 0.0); ErrorsFound = true; } } - } // TStat Objects Loop } // found thermostat reference } // loop over NumTempAndHumidityControlledZones } // NumTempAndHumidityControlledZones > 0 // Staged thermostat control inputs start - cCurrentModuleObject = cZControlTypes(static_cast(ZoneControlTypes::StagedDual)); - NumStageControlledZones = inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); + s_ipsc->cCurrentModuleObject = cZControlTypes((int)ZoneControlTypes::StagedDual); + NumStageControlledZones = s_ip->getNumObjectsFound(state, s_ipsc->cCurrentModuleObject); if (NumStageControlledZones > 0) state.dataZoneCtrls->StagedTStatObjects.allocate(NumStageControlledZones); // Pre-scan for use of Zone lists in TStat statements (i.e. Global application of TStat) - state.dataZoneTempPredictorCorrector->NumStageCtrZone = 0; + s_ztpc->NumStageCtrZone = 0; for (Item = 1; Item <= NumStageControlledZones; ++Item) { - inputProcessor->getObjectItem(state, - cCurrentModuleObject, - Item, - cAlphaArgs, - NumAlphas, - rNumericArgs, - NumNums, - IOStat, - lNumericFieldBlanks, - lAlphaFieldBlanks, - cAlphaFieldNames, - cNumericFieldNames); - Util::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); - - state.dataZoneCtrls->StagedTStatObjects(Item).Name = cAlphaArgs(1); - Item1 = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Item, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + Util::IsNameEmpty(state, s_ipsc->cAlphaArgs(1), s_ipsc->cCurrentModuleObject, ErrorsFound); + + state.dataZoneCtrls->StagedTStatObjects(Item).Name = s_ipsc->cAlphaArgs(1); + Item1 = Util::FindItemInList(s_ipsc->cAlphaArgs(2), Zone); ZLItem = 0; - if (Item1 == 0 && state.dataHeatBal->NumOfZoneLists > 0) ZLItem = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->ZoneList); + if (Item1 == 0 && state.dataHeatBal->NumOfZoneLists > 0) ZLItem = Util::FindItemInList(s_ipsc->cAlphaArgs(2), ZoneList); if (Item1 > 0) { - state.dataZoneCtrls->StagedTStatObjects(Item).StageControlledZoneStartPtr = state.dataZoneTempPredictorCorrector->NumStageCtrZone + 1; - ++state.dataZoneTempPredictorCorrector->NumStageCtrZone; + state.dataZoneCtrls->StagedTStatObjects(Item).StageControlledZoneStartPtr = s_ztpc->NumStageCtrZone + 1; + ++s_ztpc->NumStageCtrZone; state.dataZoneCtrls->StagedTStatObjects(Item).NumOfZones = 1; state.dataZoneCtrls->StagedTStatObjects(Item).ZoneListActive = false; state.dataZoneCtrls->StagedTStatObjects(Item).ZoneOrZoneListPtr = Item1; } else if (ZLItem > 0) { - auto const &ZoneList = state.dataHeatBal->ZoneList(ZLItem); - state.dataZoneCtrls->StagedTStatObjects(Item).TempControlledZoneStartPtr = state.dataZoneTempPredictorCorrector->NumStageCtrZone + 1; - state.dataZoneTempPredictorCorrector->NumStageCtrZone += ZoneList.NumOfZones; - state.dataZoneCtrls->StagedTStatObjects(Item).NumOfZones = ZoneList.NumOfZones; + state.dataZoneCtrls->StagedTStatObjects(Item).TempControlledZoneStartPtr = s_ztpc->NumStageCtrZone + 1; + s_ztpc->NumStageCtrZone += ZoneList(ZLItem).NumOfZones; + state.dataZoneCtrls->StagedTStatObjects(Item).NumOfZones = ZoneList(ZLItem).NumOfZones; state.dataZoneCtrls->StagedTStatObjects(Item).ZoneListActive = true; state.dataZoneCtrls->StagedTStatObjects(Item).ZoneOrZoneListPtr = ZLItem; } else { - ShowSevereError( - state, format("{}=\"{}\" invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); + ShowSevereError(state, + format("{}=\"{}\" invalid {}=\"{}\" not found.", + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ErrorsFound = true; } } if (ErrorsFound) { - ShowSevereError(state, format("GetStagedDualSetpoint: Errors with invalid names in {} objects.", cCurrentModuleObject)); + ShowSevereError(state, format("GetStagedDualSetpoint: Errors with invalid names in {} objects.", s_ipsc->cCurrentModuleObject)); ShowContinueError(state, "...These will not be read in. Other errors may occur."); - state.dataZoneTempPredictorCorrector->NumStageCtrZone = 0; + s_ztpc->NumStageCtrZone = 0; } - if (state.dataZoneTempPredictorCorrector->NumStageCtrZone > 0) { - state.dataZoneCtrls->StageControlledZone.allocate(state.dataZoneTempPredictorCorrector->NumStageCtrZone); + if (s_ztpc->NumStageCtrZone > 0) { + state.dataZoneCtrls->StageControlledZone.allocate(s_ztpc->NumStageCtrZone); state.dataZoneCtrls->StageZoneLogic.dimension(NumOfZones, false); int StageControlledZoneNum = 0; for (Item = 1; Item <= NumStageControlledZones; ++Item) { - inputProcessor->getObjectItem(state, - cCurrentModuleObject, - Item, - cAlphaArgs, - NumAlphas, - rNumericArgs, - NumNums, - IOStat, - lNumericFieldBlanks, - lAlphaFieldBlanks, - cAlphaFieldNames, - cNumericFieldNames); + s_ip->getObjectItem(state, + s_ipsc->cCurrentModuleObject, + Item, + s_ipsc->cAlphaArgs, + NumAlphas, + s_ipsc->rNumericArgs, + NumNums, + IOStat, + s_ipsc->lNumericFieldBlanks, + s_ipsc->lAlphaFieldBlanks, + s_ipsc->cAlphaFieldNames, + s_ipsc->cNumericFieldNames); + + ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, s_ipsc->cAlphaArgs(1)}; + for (Item1 = 1; Item1 <= state.dataZoneCtrls->StagedTStatObjects(Item).NumOfZones; ++Item1) { ++StageControlledZoneNum; + + auto &stageZone = state.dataZoneCtrls->StageControlledZone(StageControlledZoneNum); + if (state.dataZoneCtrls->StagedTStatObjects(Item).ZoneListActive) { - auto &ZoneList = state.dataHeatBal->ZoneList(state.dataZoneCtrls->StagedTStatObjects(Item).ZoneOrZoneListPtr); - cAlphaArgs(2) = state.dataHeatBal->Zone(ZoneList.Zone(Item1)).Name; + s_ipsc->cAlphaArgs(2) = + state.dataHeatBal->Zone(ZoneList(state.dataZoneCtrls->StagedTStatObjects(Item).ZoneOrZoneListPtr).Zone(Item1)).Name; } - int ZoneAssigned = Util::FindItemInList(cAlphaArgs(2), + int ZoneAssigned = Util::FindItemInList(s_ipsc->cAlphaArgs(2), state.dataZoneCtrls->StageControlledZone, &DataZoneControls::ZoneStagedControls::ZoneName, StageControlledZoneNum - 1); - auto &stageControlledZone = state.dataZoneCtrls->StageControlledZone(StageControlledZoneNum); if (ZoneAssigned == 0) { - stageControlledZone.ZoneName = cAlphaArgs(2); - stageControlledZone.ActualZoneNum = Util::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone); - if (stageControlledZone.ActualZoneNum == 0) { - ShowSevereError( - state, - format( - "{}=\"{}\" invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(2), cAlphaArgs(2))); + stageZone.ZoneName = s_ipsc->cAlphaArgs(2); + if ((stageZone.ActualZoneNum = Util::FindItemInList(s_ipsc->cAlphaArgs(2), Zone)) == 0) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2)); ErrorsFound = true; } else { // Zone(stageControlledZone%ActualZoneNum)%StageControlledZoneIndex = // StageControlledZoneNum } - state.dataZoneCtrls->StageZoneLogic(stageControlledZone.ActualZoneNum) = true; + state.dataZoneCtrls->StageZoneLogic(stageZone.ActualZoneNum) = true; } else { - stageControlledZone.ZoneName = cAlphaArgs(2); // for continuity + stageZone.ZoneName = s_ipsc->cAlphaArgs(2); // for continuity ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\" zone previously assigned.", - cCurrentModuleObject, - cAlphaArgs(1), - cAlphaFieldNames(2), - cAlphaArgs(2))); + s_ipsc->cCurrentModuleObject, + s_ipsc->cAlphaArgs(1), + s_ipsc->cAlphaFieldNames(2), + s_ipsc->cAlphaArgs(2))); ShowContinueError( state, - format("...Zone was previously assigned to Thermostat=\"{}\".", state.dataZoneCtrls->StageControlledZone(ZoneAssigned).Name)); + format("...Zone was previously assigned to Setpt=\"{}\".", state.dataZoneCtrls->StageControlledZone(ZoneAssigned).Name)); ErrorsFound = true; continue; } if (!state.dataZoneCtrls->StagedTStatObjects(Item).ZoneListActive) { - stageControlledZone.Name = cAlphaArgs(1); + stageZone.Name = s_ipsc->cAlphaArgs(1); } else { - auto &ZoneList = state.dataHeatBal->ZoneList(state.dataZoneCtrls->StagedTStatObjects(Item).ZoneOrZoneListPtr); - CheckCreatedZoneItemName(state, - RoutineName, - cCurrentModuleObject, - state.dataHeatBal->Zone(ZoneList.Zone(Item1)).Name, - ZoneList.MaxZoneNameLength, - state.dataZoneCtrls->StagedTStatObjects(Item).Name, - state.dataZoneCtrls->StageControlledZone, - StageControlledZoneNum - 1, - stageControlledZone.Name, - errFlag); + CheckCreatedZoneItemName( + state, + RoutineName, + s_ipsc->cCurrentModuleObject, + state.dataHeatBal->Zone(ZoneList(state.dataZoneCtrls->StagedTStatObjects(Item).ZoneOrZoneListPtr).Zone(Item1)).Name, + ZoneList(state.dataZoneCtrls->StagedTStatObjects(Item).ZoneOrZoneListPtr).MaxZoneNameLength, + state.dataZoneCtrls->StagedTStatObjects(Item).Name, + state.dataZoneCtrls->StageControlledZone, + StageControlledZoneNum - 1, + stageZone.Name, + errFlag); if (errFlag) ErrorsFound = true; } - stageControlledZone.NumOfHeatStages = rNumericArgs(1); - if (rNumericArgs(1) < 1 || rNumericArgs(1) > 4) { - ShowSevereError( - state, - format("{}=\"{}\" invalid range {}=\"{:.0R}\"", cCurrentModuleObject, cAlphaArgs(1), cNumericFieldNames(1), rNumericArgs(1))); - ShowContinueError(state, "..contains values outside of range [1,4]."); + stageZone.NumOfHeatStages = s_ipsc->rNumericArgs(1); + if (s_ipsc->rNumericArgs(1) < 1 || s_ipsc->rNumericArgs(1) > 4) { + ShowSevereBadMinMax(state, eoh, s_ipsc->cNumericFieldNames(1), s_ipsc->rNumericArgs(1), Clusive::In, 1, Clusive::In, 4); ErrorsFound = true; } - stageControlledZone.HeatSetBaseSchedName = cAlphaArgs(3); - stageControlledZone.HSBchedIndex = GetScheduleIndex(state, cAlphaArgs(3)); - if (Item1 == 1) { // only show error on first of several if zone list - if (stageControlledZone.HSBchedIndex == 0) { - ShowSevereError( - state, - format( - "{}=\"{}\" invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(3), cAlphaArgs(3))); + if (s_ipsc->lAlphaFieldBlanks(3)) { + if (Item1 == 1) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(3)); + ErrorsFound = true; + } + } else if ((stageZone.heatSetptBaseSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(3))) == nullptr) { + if (Item1 == 1) { + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(3), s_ipsc->cAlphaArgs(3)); ErrorsFound = true; } } - stageControlledZone.HeatThroRange = rNumericArgs(2); - if (rNumericArgs(1) < 0.0) { - ShowSevereError(state, - format("{}=\"{}\" negative value is found at {}=\"{:.1R}\"", - cAlphaArgs(1), - cCurrentModuleObject, - cNumericFieldNames(2), - rNumericArgs(2))); - ShowContinueError(state, ".. The minimum value is 0."); + stageZone.HeatThroRange = s_ipsc->rNumericArgs(2); + if (s_ipsc->rNumericArgs(1) < 0.0) { + ShowSevereBadMin(state, eoh, s_ipsc->cNumericFieldNames(2), s_ipsc->rNumericArgs(2), Clusive::In, 0.0); ErrorsFound = true; } - if (stageControlledZone.NumOfHeatStages > 0) { - stageControlledZone.HeatTOffset.allocate(stageControlledZone.NumOfHeatStages); - for (i = 1; i <= stageControlledZone.NumOfHeatStages; ++i) { - stageControlledZone.HeatTOffset(i) = rNumericArgs(2 + i); - if (rNumericArgs(2 + i) > 0.0) { - ShowSevereError(state, - format("{}=\"{}\" positive value is found at {}", - cCurrentModuleObject, - cAlphaArgs(1), - format("{}=\"{:.1R}\"", cNumericFieldNames(2 + i), rNumericArgs(2 + i)))); - ShowContinueError(state, ".. The maximum value is 0."); + if (stageZone.NumOfHeatStages > 0) { + stageZone.HeatTOffset.allocate(stageZone.NumOfHeatStages); + for (i = 1; i <= stageZone.NumOfHeatStages; ++i) { + stageZone.HeatTOffset(i) = s_ipsc->rNumericArgs(2 + i); + if (s_ipsc->lNumericFieldBlanks(2 + i)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cNumericFieldNames(2 + i)); ErrorsFound = true; - } - if (lNumericFieldBlanks(2 + i)) { - ShowSevereError(state, - format("{} object ={}. The input of {} is required, but a blank is found.", - cCurrentModuleObject, - cAlphaArgs(1), - cNumericFieldNames(2 + i))); + } else if (s_ipsc->rNumericArgs(2 + i) > 0.0) { + ShowSevereBadMax(state, eoh, s_ipsc->cNumericFieldNames(2 + i), s_ipsc->rNumericArgs(2 + i), Clusive::In, 0.0); ErrorsFound = true; } + if (i > 1) { - if (rNumericArgs(2 + i) >= rNumericArgs(1 + i)) { - ShowSevereError(state, - format(R"({}="{}" The value at {}="{:.1R}" has to be less than )", - cCurrentModuleObject, - cAlphaArgs(1), - cNumericFieldNames(2 + i), - rNumericArgs(2 + i))); - ShowContinueError(state, format("{}=\"{:.1R}", cNumericFieldNames(1 + i), rNumericArgs(1 + i))); + if (s_ipsc->rNumericArgs(2 + i) >= s_ipsc->rNumericArgs(1 + i)) { + ShowSevereCustom(state, + eoh, + format("{} = {:.1R} must be less than than {}={:.1R}", + s_ipsc->cNumericFieldNames(2 + i), + s_ipsc->rNumericArgs(2 + i), + s_ipsc->cNumericFieldNames(1 + i), + s_ipsc->rNumericArgs(1 + i))); ErrorsFound = true; } } } } - stageControlledZone.NumOfCoolStages = rNumericArgs(7); - if (rNumericArgs(7) < 1 || rNumericArgs(7) > 4) { - ShowSevereError( - state, - format("{}=\"{}\" invalid range {}=\"{:.0R}\"", cCurrentModuleObject, cAlphaArgs(1), cNumericFieldNames(7), rNumericArgs(7))); - ShowContinueError(state, "..contains values outside of range [1,4]."); + stageZone.NumOfCoolStages = s_ipsc->rNumericArgs(7); + if (s_ipsc->rNumericArgs(7) < 1 || s_ipsc->rNumericArgs(7) > 4) { + ShowSevereBadMinMax(state, eoh, s_ipsc->cNumericFieldNames(7), s_ipsc->rNumericArgs(7), Clusive::In, 1, Clusive::In, 4); ErrorsFound = true; } - stageControlledZone.CoolSetBaseSchedName = cAlphaArgs(4); - stageControlledZone.CSBchedIndex = GetScheduleIndex(state, cAlphaArgs(4)); - if (Item1 == 1) { // only show error on first of several if zone list - if (stageControlledZone.CSBchedIndex == 0) { - ShowSevereError( - state, - format( - "{}=\"{}\" invalid {}=\"{}\" not found.", cCurrentModuleObject, cAlphaArgs(1), cAlphaFieldNames(4), cAlphaArgs(4))); + if (s_ipsc->lAlphaFieldBlanks(4)) { + if (Item1 == 1) { + ShowSevereEmptyField(state, eoh, s_ipsc->cAlphaFieldNames(4)); + ErrorsFound = true; + } + } else if ((stageZone.coolSetptBaseSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(4))) == nullptr) { + if (Item1 == 1) { // only show error on first of several if zone list + ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(4), s_ipsc->cAlphaArgs(4)); ErrorsFound = true; } } - stageControlledZone.CoolThroRange = rNumericArgs(8); - if (rNumericArgs(8) < 0.0) { - ShowSevereError(state, - format("{}=\"{}\" negative value is found at {}=\"{:.1R}\"", - cCurrentModuleObject, - cAlphaArgs(1), - cNumericFieldNames(8), - rNumericArgs(8))); - ShowContinueError(state, ".. The minumum value is 0."); + stageZone.CoolThroRange = s_ipsc->rNumericArgs(8); + if (s_ipsc->rNumericArgs(8) < 0.0) { + ShowSevereBadMin(state, eoh, s_ipsc->cNumericFieldNames(8), s_ipsc->rNumericArgs(8), Clusive::In, 0.0); ErrorsFound = true; } - if (stageControlledZone.NumOfCoolStages > 0) { - stageControlledZone.CoolTOffset.allocate(stageControlledZone.NumOfCoolStages); - for (i = 1; i <= stageControlledZone.NumOfCoolStages; ++i) { - stageControlledZone.CoolTOffset(i) = rNumericArgs(8 + i); - if (rNumericArgs(8 + i) < 0.0) { - ShowSevereError(state, - format("{}=\"{}\" negative value is found at {}=\"{:.1R}\"", - cCurrentModuleObject, - cAlphaArgs(1), - cNumericFieldNames(8 + i), - rNumericArgs(8 + i))); - ShowContinueError(state, ".. The minimum value is 0."); + if (stageZone.NumOfCoolStages > 0) { + stageZone.CoolTOffset.allocate(stageZone.NumOfCoolStages); + for (i = 1; i <= stageZone.NumOfCoolStages; ++i) { + stageZone.CoolTOffset(i) = s_ipsc->rNumericArgs(8 + i); + if (s_ipsc->lNumericFieldBlanks(8 + i)) { + ShowSevereEmptyField(state, eoh, s_ipsc->cNumericFieldNames(8 + i)); ErrorsFound = true; - } - if (lNumericFieldBlanks(8 + i)) { - ShowSevereError(state, - format("{} object ={}. The input of {} is required, but a blank is found.", - cCurrentModuleObject, - cAlphaArgs(1), - cNumericFieldNames(8 + i))); + } else if (s_ipsc->rNumericArgs(8 + i) < 0.0) { + ShowSevereBadMin(state, eoh, s_ipsc->cNumericFieldNames(8 + i), s_ipsc->rNumericArgs(8 + i), Clusive::In, 0.0); ErrorsFound = true; } - if (i > 1) { - if (rNumericArgs(8 + i) <= rNumericArgs(7 + i)) { - ShowSevereError(state, - format("{}=\"{}\" The value at {}=\"{:.1R}\" has to be greater than ", - cCurrentModuleObject, - cAlphaArgs(1), - cNumericFieldNames(8 + i), - rNumericArgs(8 + i))); - ShowContinueError(state, format("{}=\"{:.1R}", cNumericFieldNames(7 + i), rNumericArgs(7 + i))); - ErrorsFound = true; - } + + if (i > 1 && s_ipsc->rNumericArgs(8 + i) <= s_ipsc->rNumericArgs(7 + i)) { + ShowSevereCustom(state, + eoh, + format("{} = {:.1R} must be greater than {} = {:.1R}", + s_ipsc->cNumericFieldNames(8 + i), + s_ipsc->rNumericArgs(8 + i), + s_ipsc->cNumericFieldNames(7 + i), + s_ipsc->rNumericArgs(7 + i))); + ErrorsFound = true; } } } } } // loop over NumStageControlledZones - if ((inputProcessor->getNumObjectsFound(state, "AirLoopHVAC:UnitaryHeatPump:AirToAir:MultiSpeed") == 0) && - (inputProcessor->getNumObjectsFound(state, "AirLoopHVAC:UnitarySystem") == 0) && - (inputProcessor->getNumObjectsFound(state, "SetpointManager:SingleZone:OneStageCooling") == 0) && - (inputProcessor->getNumObjectsFound(state, "SetpointManager:SingleZone:OneStageHeating") == 0)) { - ShowWarningError(state, format("{} is applicable to only selected HVAC objects which are missing from input.", cCurrentModuleObject)); + + if ((s_ip->getNumObjectsFound(state, "AirLoopHVAC:UnitaryHeatPump:AirToAir:MultiSpeed") == 0) && + (s_ip->getNumObjectsFound(state, "AirLoopHVAC:UnitarySystem") == 0) && + (s_ip->getNumObjectsFound(state, "SetpointManager:SingleZone:OneStageCooling") == 0) && + (s_ip->getNumObjectsFound(state, "SetpointManager:SingleZone:OneStageHeating") == 0)) { + ShowWarningError(state, + format("{} is applicable to only selected HVAC objects which are missing from input.", s_ipsc->cCurrentModuleObject)); ShowContinueError(state, "Model should include one or more of the following objects: "); ShowContinueError(state, "AirLoopHVAC:UnitaryHeatPump:AirToAir:MultiSpeed, AirLoopHVAC:UnitarySystem, "); ShowContinueError( @@ -2651,8 +2225,7 @@ void CalculateAdaptiveComfortSetPointSchl(EnergyPlusData &state, Array1D int constexpr summerDesignDayTypeIndex(9); Real64 GrossApproxAvgDryBulbDesignDay(0.0); - auto &AdapComfortDailySetPointSchedule = state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule; - auto &AdapComfortSetPointSummerDesDay = state.dataZoneTempPredictorCorrector->AdapComfortSetPointSummerDesDay; + auto &s_ztpc = state.dataZoneTempPredictorCorrector; for (size_t i = 1; i <= state.dataWeather->DesDayInput.size(); i++) { // Summer design day @@ -2661,54 +2234,54 @@ void CalculateAdaptiveComfortSetPointSchl(EnergyPlusData &state, Array1D (state.dataWeather->DesDayInput(i).MaxDryBulb - state.dataWeather->DesDayInput(i).DailyDBRange)) / 2.0; if (GrossApproxAvgDryBulbDesignDay > 10 && GrossApproxAvgDryBulbDesignDay < 33.5) { - AdapComfortSetPointSummerDesDay[0] = 0.31 * GrossApproxAvgDryBulbDesignDay + 17.8; - AdapComfortSetPointSummerDesDay[1] = 0.31 * GrossApproxAvgDryBulbDesignDay + 20.3; - AdapComfortSetPointSummerDesDay[2] = 0.31 * GrossApproxAvgDryBulbDesignDay + 21.3; + s_ztpc->AdapComfortSetPointSummerDesDay[0] = 0.31 * GrossApproxAvgDryBulbDesignDay + 17.8; + s_ztpc->AdapComfortSetPointSummerDesDay[1] = 0.31 * GrossApproxAvgDryBulbDesignDay + 20.3; + s_ztpc->AdapComfortSetPointSummerDesDay[2] = 0.31 * GrossApproxAvgDryBulbDesignDay + 21.3; } if (GrossApproxAvgDryBulbDesignDay > 10 && GrossApproxAvgDryBulbDesignDay < 30) { - AdapComfortSetPointSummerDesDay[3] = 0.33 * GrossApproxAvgDryBulbDesignDay + 18.8; - AdapComfortSetPointSummerDesDay[4] = 0.33 * GrossApproxAvgDryBulbDesignDay + 20.8; - ; - AdapComfortSetPointSummerDesDay[5] = 0.33 * GrossApproxAvgDryBulbDesignDay + 21.8; + s_ztpc->AdapComfortSetPointSummerDesDay[3] = 0.33 * GrossApproxAvgDryBulbDesignDay + 18.8; + s_ztpc->AdapComfortSetPointSummerDesDay[4] = 0.33 * GrossApproxAvgDryBulbDesignDay + 20.8; + ; // What is this? + s_ztpc->AdapComfortSetPointSummerDesDay[5] = 0.33 * GrossApproxAvgDryBulbDesignDay + 21.8; ; - AdapComfortSetPointSummerDesDay[6] = 0.33 * GrossApproxAvgDryBulbDesignDay + 22.8; + s_ztpc->AdapComfortSetPointSummerDesDay[6] = 0.33 * GrossApproxAvgDryBulbDesignDay + 22.8; ; } } } - AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Central.allocate(state.dataWeather->NumDaysInYear); - AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Upper_90.allocate(state.dataWeather->NumDaysInYear); - AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Upper_80.allocate(state.dataWeather->NumDaysInYear); - AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Central.allocate(state.dataWeather->NumDaysInYear); - AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_I.allocate(state.dataWeather->NumDaysInYear); - AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_II.allocate(state.dataWeather->NumDaysInYear); - AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_III.allocate(state.dataWeather->NumDaysInYear); + s_ztpc->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Central.allocate(state.dataWeather->NumDaysInYear); + s_ztpc->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Upper_90.allocate(state.dataWeather->NumDaysInYear); + s_ztpc->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Upper_80.allocate(state.dataWeather->NumDaysInYear); + s_ztpc->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Central.allocate(state.dataWeather->NumDaysInYear); + s_ztpc->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_I.allocate(state.dataWeather->NumDaysInYear); + s_ztpc->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_II.allocate(state.dataWeather->NumDaysInYear); + s_ztpc->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_III.allocate(state.dataWeather->NumDaysInYear); // Calculate the set points based on different models, set flag as -1 when running average temperature is not in the range. for (int day = 1; day <= state.dataWeather->NumDaysInYear; day++) { if (runningAverageASH(day) > 10 && runningAverageASH(day) < 33.5) { - AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Central(day) = 0.31 * runningAverageASH(day) + 17.8; - AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Upper_90(day) = 0.31 * runningAverageASH(day) + 20.3; - AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Upper_80(day) = 0.31 * runningAverageASH(day) + 21.3; + s_ztpc->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Central(day) = 0.31 * runningAverageASH(day) + 17.8; + s_ztpc->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Upper_90(day) = 0.31 * runningAverageASH(day) + 20.3; + s_ztpc->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Upper_80(day) = 0.31 * runningAverageASH(day) + 21.3; } else { - AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Central(day) = -1; - AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Upper_90(day) = -1; - AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Upper_80(day) = -1; + s_ztpc->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Central(day) = -1; + s_ztpc->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Upper_90(day) = -1; + s_ztpc->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Upper_80(day) = -1; } if (runningAverageCEN(day) > 10 && runningAverageCEN(day) < 30) { - AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Central(day) = 0.33 * runningAverageCEN(day) + 18.8; - AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_I(day) = 0.33 * runningAverageCEN(day) + 20.8; - AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_II(day) = 0.33 * runningAverageCEN(day) + 21.8; - AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_III(day) = 0.33 * runningAverageCEN(day) + 22.8; + s_ztpc->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Central(day) = 0.33 * runningAverageCEN(day) + 18.8; + s_ztpc->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_I(day) = 0.33 * runningAverageCEN(day) + 20.8; + s_ztpc->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_II(day) = 0.33 * runningAverageCEN(day) + 21.8; + s_ztpc->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_III(day) = 0.33 * runningAverageCEN(day) + 22.8; } else { - AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Central(day) = -1; - AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_I(day) = -1; - AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_II(day) = -1; - AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_III(day) = -1; + s_ztpc->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Central(day) = -1; + s_ztpc->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_I(day) = -1; + s_ztpc->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_II(day) = -1; + s_ztpc->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_III(day) = -1; } } - AdapComfortDailySetPointSchedule.initialized = true; + s_ztpc->AdapComfortDailySetPointSchedule.initialized = true; } void InitZoneAirSetPoints(EnergyPlusData &state) @@ -2731,22 +2304,25 @@ void InitZoneAirSetPoints(EnergyPlusData &state) static constexpr std::string_view RoutineName("InitZoneAirSetpoints: "); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + bool FirstSurfFlag; + int TRefFlag; // Flag for Reference Temperature process in Zones + + auto &s_ztpc = state.dataZoneTempPredictorCorrector; + auto &s_hbfs = state.dataHeatBalFanSys; + + auto &ZoneList = state.dataHeatBal->ZoneList; + auto &TempControlType = state.dataHeatBalFanSys->TempControlType; + auto &TempControlTypeRpt = state.dataHeatBalFanSys->TempControlTypeRpt; int NumOfZones = state.dataGlobal->NumOfZones; - if (state.dataZoneTempPredictorCorrector->InitZoneAirSetPointsOneTimeFlag) { - int TRefFlag; // Flag for Reference Temperature process in Zones - state.dataHeatBalFanSys->TempZoneThermostatSetPoint.dimension(NumOfZones, 0.0); - state.dataHeatBalFanSys->AdapComfortCoolingSetPoint.dimension(NumOfZones, 0.0); - state.dataHeatBalFanSys->ZoneThermostatSetPointHi.dimension(NumOfZones, 0.0); - state.dataHeatBalFanSys->ZoneThermostatSetPointLo.dimension(NumOfZones, 0.0); - state.dataHeatBalFanSys->ZoneThermostatSetPointHiAver.dimension(NumOfZones, 0.0); - state.dataHeatBalFanSys->ZoneThermostatSetPointLoAver.dimension(NumOfZones, 0.0); + if (s_ztpc->InitZoneAirSetPointsOneTimeFlag) { + s_hbfs->zoneTstatSetpts.allocate(NumOfZones); state.dataHeatBalFanSys->LoadCorrectionFactor.dimension(NumOfZones, 0.0); - state.dataHeatBalFanSys->TempControlType.dimension(NumOfZones, HVAC::ThermostatType::Uncontrolled); - state.dataHeatBalFanSys->TempControlTypeRpt.dimension(NumOfZones, 0); + TempControlType.dimension(NumOfZones, HVAC::SetptType::Uncontrolled); + TempControlTypeRpt.dimension(NumOfZones, 0); if (state.dataZoneCtrls->NumComfortControlledZones > 0) { - state.dataHeatBalFanSys->ComfortControlType.dimension(NumOfZones, HVAC::ThermostatType::Uncontrolled); + state.dataHeatBalFanSys->ComfortControlType.dimension(NumOfZones, HVAC::SetptType::Uncontrolled); state.dataHeatBalFanSys->ComfortControlTypeRpt.dimension(NumOfZones, 0); state.dataHeatBalFanSys->ZoneComfortControlsFanger.allocate(NumOfZones); } @@ -2803,10 +2379,10 @@ void InitZoneAirSetPoints(EnergyPlusData &state) // CurrentModuleObject='Zone' for (int zoneNum = 1; zoneNum <= NumOfZones; ++zoneNum) { auto &thisZone = state.dataHeatBal->Zone(zoneNum); - state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).setUpOutputVars(state, DataStringGlobals::zonePrefix, thisZone.Name); + s_ztpc->zoneHeatBalance(zoneNum).setUpOutputVars(state, DataStringGlobals::zonePrefix, thisZone.Name); if (state.dataHeatBal->doSpaceHeatBalanceSimulation) { for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { - state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).setUpOutputVars( + s_ztpc->spaceHeatBalance(spaceNum).setUpOutputVars( state, DataStringGlobals::spacePrefix, state.dataHeatBal->space(spaceNum).Name); } } @@ -2855,21 +2431,21 @@ void InitZoneAirSetPoints(EnergyPlusData &state) SetupOutputVariable(state, "Zone Thermostat Heating Setpoint Temperature", Constant::Units::C, - state.dataHeatBalFanSys->ZoneThermostatSetPointLo(zoneNum), + s_hbfs->zoneTstatSetpts(zoneNum).setptLo, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, thisZone.Name); SetupOutputVariable(state, "Zone Thermostat Cooling Setpoint Temperature", Constant::Units::C, - state.dataHeatBalFanSys->ZoneThermostatSetPointHi(zoneNum), + s_hbfs->zoneTstatSetpts(zoneNum).setptHi, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, thisZone.Name); SetupOutputVariable(state, "Zone Adaptive Comfort Operative Temperature Set Point", Constant::Units::C, - state.dataHeatBalFanSys->AdapComfortCoolingSetPoint(zoneNum), + s_hbfs->zoneTstatSetpts(zoneNum).setptAdapComfortCool, OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, thisZone.Name); @@ -2978,26 +2554,25 @@ void InitZoneAirSetPoints(EnergyPlusData &state) zoneGroup.Name); } // Loop - state.dataZoneTempPredictorCorrector->InitZoneAirSetPointsOneTimeFlag = false; + s_ztpc->InitZoneAirSetPointsOneTimeFlag = false; } // Do the Begin Environment initializations - if (state.dataZoneTempPredictorCorrector->MyEnvrnFlag && state.dataGlobal->BeginEnvrnFlag) { - for (auto &thisZoneHB : state.dataZoneTempPredictorCorrector->zoneHeatBalance) { + if (s_ztpc->MyEnvrnFlag && state.dataGlobal->BeginEnvrnFlag) { + for (auto &thisZoneHB : s_ztpc->zoneHeatBalance) { thisZoneHB.beginEnvironmentInit(state); } if (state.dataHeatBal->doSpaceHeatBalance) { - for (auto &thisSpaceHB : state.dataZoneTempPredictorCorrector->spaceHeatBalance) { + for (auto &thisSpaceHB : s_ztpc->spaceHeatBalance) { thisSpaceHB.beginEnvironmentInit(state); } } - state.dataHeatBalFanSys->TempZoneThermostatSetPoint = 0.0; - state.dataHeatBalFanSys->AdapComfortCoolingSetPoint = 0.0; - state.dataHeatBalFanSys->ZoneThermostatSetPointHi = 0.0; - state.dataHeatBalFanSys->ZoneThermostatSetPointLo = 0.0; + + for (auto &zoneTstatSetpt : s_hbfs->zoneTstatSetpts) + zoneTstatSetpt.setpt = zoneTstatSetpt.setptAdapComfortCool = zoneTstatSetpt.setptLo = zoneTstatSetpt.setptHi = 0.0; state.dataHeatBalFanSys->LoadCorrectionFactor = 1.0; - state.dataHeatBalFanSys->TempControlType = HVAC::ThermostatType::Uncontrolled; + TempControlType = HVAC::SetptType::Uncontrolled; for (auto &e : state.dataZoneEnergyDemand->ZoneSysEnergyDemand) { e.beginEnvironmentInit(); } @@ -3024,152 +2599,137 @@ void InitZoneAirSetPoints(EnergyPlusData &state) state.dataHeatBalFanSys->PreviousMeasuredHumRat2 = 0.0; // Hybrid modeling state.dataHeatBalFanSys->PreviousMeasuredHumRat3 = 0.0; // Hybrid modeling - state.dataZoneTempPredictorCorrector->MyEnvrnFlag = false; + s_ztpc->MyEnvrnFlag = false; } if (!state.dataGlobal->BeginEnvrnFlag) { - state.dataZoneTempPredictorCorrector->MyEnvrnFlag = true; + s_ztpc->MyEnvrnFlag = true; } // Do the Begin Day initializations - if (state.dataZoneTempPredictorCorrector->MyDayFlag && state.dataGlobal->BeginDayFlag) { - state.dataZoneTempPredictorCorrector->MyDayFlag = false; + if (s_ztpc->MyDayFlag && state.dataGlobal->BeginDayFlag) { + s_ztpc->MyDayFlag = false; } if (!state.dataGlobal->BeginDayFlag) { - state.dataZoneTempPredictorCorrector->MyDayFlag = true; + s_ztpc->MyDayFlag = true; } for (int Loop = 1; Loop <= state.dataZoneCtrls->NumTempControlledZones; ++Loop) { - auto &tempControlledZone = state.dataZoneCtrls->TempControlledZone(Loop); - if (state.dataZoneEquip->ZoneEquipInputsFilled && !state.dataZoneTempPredictorCorrector->ControlledZonesChecked) { - if (!VerifyControlledZoneForThermostat(state, tempControlledZone.ZoneName)) { - ShowSevereError(state, - format("{}Zone=\"{}\" has specified a Thermostatic control but is not a controlled zone.", - RoutineName, - tempControlledZone.ZoneName)); + auto &tempZone = state.dataZoneCtrls->TempControlledZone(Loop); + if (state.dataZoneEquip->ZoneEquipInputsFilled && !s_ztpc->ControlledZonesChecked) { + if (!VerifyControlledZoneForThermostat(state, tempZone.ZoneName)) { + ShowSevereError( + state, + format("{}Zone=\"{}\" has specified a Thermostatic control but is not a controlled zone.", RoutineName, tempZone.ZoneName)); ShowContinueError(state, "...must have a ZoneHVAC:EquipmentConnections specification for this zone."); - state.dataZoneTempPredictorCorrector->ErrorsFound = true; + s_ztpc->ErrorsFound = true; } } - if (tempControlledZone.ManageDemand) { - int ZoneNum = tempControlledZone.ActualZoneNum; - auto &zoneThermostatSetPointLo = state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ZoneNum); - auto &zoneThermostatSetPointHi = state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ZoneNum); - auto &tempZoneThermostatSetPoint = state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ZoneNum); - auto &tempControlType = state.dataHeatBalFanSys->TempControlType(ZoneNum); + if (tempZone.ManageDemand) { + int ZoneNum = tempZone.ActualZoneNum; + + auto &zoneTstatSetpt = s_hbfs->zoneTstatSetpts(ZoneNum); - switch (tempControlType) { - case HVAC::ThermostatType::SingleHeating: - if (tempZoneThermostatSetPoint > tempControlledZone.HeatingResetLimit) { - tempZoneThermostatSetPoint = tempControlledZone.HeatingResetLimit; - zoneThermostatSetPointLo = tempZoneThermostatSetPoint; + switch (TempControlType(ZoneNum)) { + case HVAC::SetptType::SingleHeat: { + if (zoneTstatSetpt.setpt > tempZone.HeatingResetLimit) { + zoneTstatSetpt.setptLo = zoneTstatSetpt.setpt = tempZone.HeatingResetLimit; } - break; - case HVAC::ThermostatType::SingleCooling: - if (tempZoneThermostatSetPoint < tempControlledZone.CoolingResetLimit) { - tempZoneThermostatSetPoint = tempControlledZone.CoolingResetLimit; - zoneThermostatSetPointHi = tempZoneThermostatSetPoint; + } break; + + case HVAC::SetptType::SingleCool: { + if (zoneTstatSetpt.setpt < tempZone.CoolingResetLimit) { + zoneTstatSetpt.setptHi = zoneTstatSetpt.setpt = tempZone.CoolingResetLimit; } - break; - case HVAC::ThermostatType::SingleHeatCool: - if ((tempZoneThermostatSetPoint > tempControlledZone.HeatingResetLimit) || - (tempZoneThermostatSetPoint < tempControlledZone.CoolingResetLimit)) { - - tempControlType = HVAC::ThermostatType::DualSetPointWithDeadBand; - state.dataHeatBalFanSys->TempControlTypeRpt(ZoneNum) = static_cast(tempControlType); - zoneThermostatSetPointLo = tempZoneThermostatSetPoint; - zoneThermostatSetPointHi = tempZoneThermostatSetPoint; - - if (zoneThermostatSetPointLo > tempControlledZone.HeatingResetLimit) - zoneThermostatSetPointLo = tempControlledZone.HeatingResetLimit; - if (zoneThermostatSetPointHi < tempControlledZone.CoolingResetLimit) - zoneThermostatSetPointHi = tempControlledZone.CoolingResetLimit; + } break; + + case HVAC::SetptType::SingleHeatCool: { + if ((zoneTstatSetpt.setpt > tempZone.HeatingResetLimit) || (zoneTstatSetpt.setpt < tempZone.CoolingResetLimit)) { + + TempControlType(ZoneNum) = HVAC::SetptType::DualHeatCool; + TempControlTypeRpt(ZoneNum) = static_cast(TempControlType(ZoneNum)); + zoneTstatSetpt.setptHi = zoneTstatSetpt.setptLo = zoneTstatSetpt.setpt; + + if (zoneTstatSetpt.setptLo > tempZone.HeatingResetLimit) zoneTstatSetpt.setptLo = tempZone.HeatingResetLimit; + if (zoneTstatSetpt.setptHi < tempZone.CoolingResetLimit) zoneTstatSetpt.setptHi = tempZone.CoolingResetLimit; } - break; - case HVAC::ThermostatType::DualSetPointWithDeadBand: - if (zoneThermostatSetPointLo > tempControlledZone.HeatingResetLimit) zoneThermostatSetPointLo = tempControlledZone.HeatingResetLimit; - if (zoneThermostatSetPointHi < tempControlledZone.CoolingResetLimit) zoneThermostatSetPointHi = tempControlledZone.CoolingResetLimit; - break; - default: - break; - } + } break; + + case HVAC::SetptType::DualHeatCool: { + if (zoneTstatSetpt.setptLo > tempZone.HeatingResetLimit) zoneTstatSetpt.setptLo = tempZone.HeatingResetLimit; + if (zoneTstatSetpt.setptHi < tempZone.CoolingResetLimit) zoneTstatSetpt.setptHi = tempZone.CoolingResetLimit; + } break; + + default: { + } break; + } // switch (setptType) } } for (int Loop = 1; Loop <= state.dataZoneCtrls->NumComfortControlledZones; ++Loop) { - auto &comfortControlledZone = state.dataZoneCtrls->ComfortControlledZone(Loop); - if (state.dataZoneEquip->ZoneEquipInputsFilled && !state.dataZoneTempPredictorCorrector->ControlledZonesChecked) { - if (!VerifyControlledZoneForThermostat(state, comfortControlledZone.ZoneName)) { - ShowSevereError(state, - format("{}Zone=\"{}\" has specified a Comfort control but is not a controlled zone.", - RoutineName, - comfortControlledZone.ZoneName)); + auto const &comfortZone = state.dataZoneCtrls->ComfortControlledZone(Loop); + if (state.dataZoneEquip->ZoneEquipInputsFilled && !s_ztpc->ControlledZonesChecked) { + if (!VerifyControlledZoneForThermostat(state, comfortZone.ZoneName)) { + ShowSevereError( + state, format("{}Zone=\"{}\" has specified a Comfort control but is not a controlled zone.", RoutineName, comfortZone.ZoneName)); ShowContinueError(state, "...must have a ZoneHVAC:EquipmentConnections specification for this zone."); - state.dataZoneTempPredictorCorrector->ErrorsFound = true; - } - } - if (comfortControlledZone.ManageDemand) { - int ZoneNum = comfortControlledZone.ActualZoneNum; - auto &zoneThermostatSetPointLo = state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ZoneNum); - auto &zoneThermostatSetPointHi = state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ZoneNum); - auto &tempZoneThermostatSetPoint = state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ZoneNum); - auto &tempControlTypeRpt = state.dataHeatBalFanSys->TempControlTypeRpt(ZoneNum); - auto &tempControlType = state.dataHeatBalFanSys->TempControlType(ZoneNum); - - switch (state.dataHeatBalFanSys->ComfortControlType(ZoneNum)) { - case HVAC::ThermostatType::SingleHeating: - if (tempZoneThermostatSetPoint >= comfortControlledZone.HeatingResetLimit) { - tempZoneThermostatSetPoint = comfortControlledZone.HeatingResetLimit; - zoneThermostatSetPointLo = tempZoneThermostatSetPoint; - tempControlType = HVAC::ThermostatType::SingleHeating; - tempControlTypeRpt = static_cast(tempControlType); + s_ztpc->ErrorsFound = true; + } + } + + if (comfortZone.ManageDemand) { + int ZoneNum = comfortZone.ActualZoneNum; + auto &zoneTstatSetpt = s_hbfs->zoneTstatSetpts(ZoneNum); + switch (s_hbfs->ComfortControlType(ZoneNum)) { + case HVAC::SetptType::SingleHeat: { + if (zoneTstatSetpt.setpt >= comfortZone.HeatingResetLimit) { + zoneTstatSetpt.setptLo = zoneTstatSetpt.setpt = comfortZone.HeatingResetLimit; + TempControlType(ZoneNum) = HVAC::SetptType::SingleHeat; + TempControlTypeRpt(ZoneNum) = static_cast(TempControlType(ZoneNum)); } - break; - case HVAC::ThermostatType::SingleCooling: - if (tempZoneThermostatSetPoint <= comfortControlledZone.CoolingResetLimit) { - tempZoneThermostatSetPoint = comfortControlledZone.CoolingResetLimit; - zoneThermostatSetPointHi = tempZoneThermostatSetPoint; - tempControlType = HVAC::ThermostatType::SingleCooling; - tempControlTypeRpt = static_cast(tempControlType); + } break; + + case HVAC::SetptType::SingleCool: { + if (zoneTstatSetpt.setpt <= comfortZone.CoolingResetLimit) { + zoneTstatSetpt.setptHi = zoneTstatSetpt.setpt = comfortZone.CoolingResetLimit; + TempControlType(ZoneNum) = HVAC::SetptType::SingleCool; + TempControlTypeRpt(ZoneNum) = static_cast(TempControlType(ZoneNum)); } - break; - case HVAC::ThermostatType::SingleHeatCool: - if ((tempZoneThermostatSetPoint >= comfortControlledZone.HeatingResetLimit) || - (tempZoneThermostatSetPoint <= comfortControlledZone.CoolingResetLimit)) { - - tempControlType = HVAC::ThermostatType::DualSetPointWithDeadBand; - tempControlTypeRpt = static_cast(tempControlType); - zoneThermostatSetPointLo = tempZoneThermostatSetPoint; - zoneThermostatSetPointHi = tempZoneThermostatSetPoint; - - if (zoneThermostatSetPointLo >= comfortControlledZone.HeatingResetLimit) - zoneThermostatSetPointLo = comfortControlledZone.HeatingResetLimit; - if (zoneThermostatSetPointHi <= comfortControlledZone.CoolingResetLimit) - zoneThermostatSetPointHi = comfortControlledZone.CoolingResetLimit; + } break; + + case HVAC::SetptType::SingleHeatCool: { + if ((zoneTstatSetpt.setpt >= comfortZone.HeatingResetLimit) || (zoneTstatSetpt.setpt <= comfortZone.CoolingResetLimit)) { + + TempControlType(ZoneNum) = HVAC::SetptType::DualHeatCool; + TempControlTypeRpt(ZoneNum) = static_cast(TempControlType(ZoneNum)); + zoneTstatSetpt.setptLo = zoneTstatSetpt.setptHi = zoneTstatSetpt.setpt; + + if (zoneTstatSetpt.setptLo >= comfortZone.HeatingResetLimit) zoneTstatSetpt.setptLo = comfortZone.HeatingResetLimit; + if (zoneTstatSetpt.setptHi <= comfortZone.CoolingResetLimit) zoneTstatSetpt.setptHi = comfortZone.CoolingResetLimit; } - break; - case HVAC::ThermostatType::DualSetPointWithDeadBand: - tempControlType = HVAC::ThermostatType::DualSetPointWithDeadBand; - tempControlTypeRpt = static_cast(tempControlType); - if (zoneThermostatSetPointLo >= comfortControlledZone.HeatingResetLimit) - zoneThermostatSetPointLo = comfortControlledZone.HeatingResetLimit; - if (zoneThermostatSetPointHi <= comfortControlledZone.CoolingResetLimit) - zoneThermostatSetPointHi = comfortControlledZone.CoolingResetLimit; - break; - default: - break; - } - } // Demand manager + } break; + + case HVAC::SetptType::DualHeatCool: { + TempControlType(ZoneNum) = HVAC::SetptType::DualHeatCool; + TempControlTypeRpt(ZoneNum) = static_cast(TempControlType(ZoneNum)); + if (zoneTstatSetpt.setptLo >= comfortZone.HeatingResetLimit) zoneTstatSetpt.setptLo = comfortZone.HeatingResetLimit; + if (zoneTstatSetpt.setptHi <= comfortZone.CoolingResetLimit) zoneTstatSetpt.setptHi = comfortZone.CoolingResetLimit; + } break; + + default: { + } break; + } // switch + } // Demand manager } - if (state.dataZoneTempPredictorCorrector->ErrorsFound) { + if (s_ztpc->ErrorsFound) { ShowFatalError(state, "InitZoneAirSetpoints - program terminates due to previous condition."); } if (state.dataZoneEquip->ZoneEquipInputsFilled) { - state.dataZoneTempPredictorCorrector->ControlledZonesChecked = true; + s_ztpc->ControlledZonesChecked = true; } } @@ -3265,18 +2825,22 @@ void PredictSystemLoads(EnergyPlusData &state, // the type of system being simulated. // 3. Calculate zone energy requirements + auto &s_ztpc = state.dataZoneTempPredictorCorrector; + auto const &s_hbfs = state.dataHeatBalFanSys; + // Staged thermostat setpoint - if (state.dataZoneTempPredictorCorrector->NumStageCtrZone > 0) { - for (int RelativeZoneNum = 1; RelativeZoneNum <= state.dataZoneTempPredictorCorrector->NumStageCtrZone; ++RelativeZoneNum) { + if (s_ztpc->NumStageCtrZone > 0) { + for (int RelativeZoneNum = 1; RelativeZoneNum <= s_ztpc->NumStageCtrZone; ++RelativeZoneNum) { auto &thisStageControlZone = state.dataZoneCtrls->StageControlledZone(RelativeZoneNum); int ActualZoneNum = thisStageControlZone.ActualZoneNum; - auto const &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ActualZoneNum); - auto &thisZoneThermostatSetPointLo = state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ActualZoneNum); - auto &thisZoneThermostatSetPointHi = state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ActualZoneNum); + + auto &thisZoneHB = s_ztpc->zoneHeatBalance(ActualZoneNum); + auto &zoneTstatSetpt = s_hbfs->zoneTstatSetpts(ActualZoneNum); Real64 ZoneT = thisZoneHB.MAT; // Zone temperature at previous time step if (ShortenTimeStepSys) ZoneT = thisZoneHB.XMPT; - thisStageControlZone.HeatSetPoint = ScheduleManager::GetCurrentScheduleValue(state, thisStageControlZone.HSBchedIndex); - thisStageControlZone.CoolSetPoint = ScheduleManager::GetCurrentScheduleValue(state, thisStageControlZone.CSBchedIndex); + thisStageControlZone.HeatSetPoint = thisStageControlZone.heatSetptBaseSched->getCurrentVal(); + thisStageControlZone.CoolSetPoint = thisStageControlZone.coolSetptBaseSched->getCurrentVal(); + if (thisStageControlZone.HeatSetPoint >= thisStageControlZone.CoolSetPoint) { ++thisStageControlZone.StageErrCount; if (thisStageControlZone.StageErrCount < 2) { @@ -3306,11 +2870,12 @@ void PredictSystemLoads(EnergyPlusData &state, } state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ActualZoneNum).StageNum = Itemp; if (SetpointOffset >= 0.5 * thisStageControlZone.CoolThroRange) { - thisZoneThermostatSetPointHi = thisStageControlZone.CoolSetPoint - 0.5 * thisStageControlZone.CoolThroRange; + zoneTstatSetpt.setptHi = thisStageControlZone.CoolSetPoint - 0.5 * thisStageControlZone.CoolThroRange; } else { - thisZoneThermostatSetPointHi = thisStageControlZone.CoolSetPoint + 0.5 * thisStageControlZone.CoolThroRange; + zoneTstatSetpt.setptHi = thisStageControlZone.CoolSetPoint + 0.5 * thisStageControlZone.CoolThroRange; } - thisZoneThermostatSetPointLo = thisZoneThermostatSetPointHi; + zoneTstatSetpt.setptLo = zoneTstatSetpt.setptHi; + } else if (thisStageControlZone.HeatSetPoint > ZoneT) { // heating Real64 SetpointOffset = ZoneT - thisStageControlZone.HeatSetPoint; int Itemp = 0; @@ -3321,14 +2886,15 @@ void PredictSystemLoads(EnergyPlusData &state, } state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ActualZoneNum).StageNum = Itemp; if (std::abs(SetpointOffset) >= 0.5 * thisStageControlZone.CoolThroRange) { - thisZoneThermostatSetPointLo = thisStageControlZone.HeatSetPoint + 0.5 * thisStageControlZone.HeatThroRange; + zoneTstatSetpt.setptLo = thisStageControlZone.HeatSetPoint + 0.5 * thisStageControlZone.HeatThroRange; } else { - thisZoneThermostatSetPointLo = thisStageControlZone.HeatSetPoint - 0.5 * thisStageControlZone.HeatThroRange; + zoneTstatSetpt.setptLo = thisStageControlZone.HeatSetPoint - 0.5 * thisStageControlZone.HeatThroRange; } - thisZoneThermostatSetPointHi = thisZoneThermostatSetPointLo; + zoneTstatSetpt.setptHi = zoneTstatSetpt.setptLo; + } else { - thisZoneThermostatSetPointHi = thisStageControlZone.CoolSetPoint + 0.5 * thisStageControlZone.CoolThroRange; - thisZoneThermostatSetPointLo = thisStageControlZone.HeatSetPoint - 0.5 * thisStageControlZone.HeatThroRange; + zoneTstatSetpt.setptHi = thisStageControlZone.CoolSetPoint + 0.5 * thisStageControlZone.CoolThroRange; + zoneTstatSetpt.setptLo = thisStageControlZone.HeatSetPoint - 0.5 * thisStageControlZone.HeatThroRange; state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ActualZoneNum).StageNum = 0; } // SpaceHB TODO: For now, set space stagenum to zone stagenum - later need to see what space the thermostat is in @@ -3342,7 +2908,7 @@ void PredictSystemLoads(EnergyPlusData &state, } // Setpoint revision for onoff thermostat - if (state.dataZoneTempPredictorCorrector->NumOnOffCtrZone > 0) { + if (s_ztpc->NumOnOffCtrZone > 0) { Real64 TempTole = 0.02; Real64 Tprev; for (int RelativeZoneNum = 1; RelativeZoneNum <= state.dataZoneCtrls->NumTempControlledZones; ++RelativeZoneNum) { @@ -3355,11 +2921,9 @@ void PredictSystemLoads(EnergyPlusData &state, thisTempControlledZone.HeatModeLastSave = thisTempControlledZone.HeatModeLast; thisTempControlledZone.CoolModeLastSave = thisTempControlledZone.CoolModeLast; } - auto &thisTempZoneThermostatSetPoint = state.dataHeatBalFanSys->TempZoneThermostatSetPoint(thisTempControlledZone.ActualZoneNum); - auto const &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(thisTempControlledZone.ActualZoneNum); - auto &thisZoneThermostatSetPointLo = state.dataHeatBalFanSys->ZoneThermostatSetPointLo(thisTempControlledZone.ActualZoneNum); - auto &thisZoneThermostatSetPointHi = state.dataHeatBalFanSys->ZoneThermostatSetPointHi(thisTempControlledZone.ActualZoneNum); + auto &zoneTstatSetpt = s_hbfs->zoneTstatSetpts(thisTempControlledZone.ActualZoneNum); + auto &thisZoneHB = s_ztpc->zoneHeatBalance(thisTempControlledZone.ActualZoneNum); thisTempControlledZone.CoolOffFlag = false; thisTempControlledZone.HeatOffFlag = false; if (state.dataHeatBal->ZoneAirSolutionAlgo == DataHeatBalance::SolutionAlgo::ThirdOrder) { @@ -3370,105 +2934,110 @@ void PredictSystemLoads(EnergyPlusData &state, } switch (state.dataHeatBalFanSys->TempControlType(thisTempControlledZone.ActualZoneNum)) { - case HVAC::ThermostatType::SingleHeating: - thisTempZoneThermostatSetPoint = thisTempControlledZone.ZoneThermostatSetPointLo; - thisZoneThermostatSetPointLo = thisTempControlledZone.ZoneThermostatSetPointLo; + + case HVAC::SetptType::SingleHeat: { + zoneTstatSetpt.setpt = thisTempControlledZone.ZoneThermostatSetPointLo; + zoneTstatSetpt.setptLo = thisTempControlledZone.ZoneThermostatSetPointLo; if (Tprev < thisTempControlledZone.ZoneThermostatSetPointLo + TempTole) { - thisTempZoneThermostatSetPoint = thisTempControlledZone.ZoneThermostatSetPointLo + thisTempControlledZone.DeltaTCutSet; - thisZoneThermostatSetPointLo = thisTempZoneThermostatSetPoint; + zoneTstatSetpt.setpt = thisTempControlledZone.ZoneThermostatSetPointLo + thisTempControlledZone.DeltaTCutSet; + zoneTstatSetpt.setptLo = zoneTstatSetpt.setpt; } else if (Tprev > thisTempControlledZone.ZoneThermostatSetPointLo && (Tprev < thisTempControlledZone.ZoneThermostatSetPointLo + thisTempControlledZone.DeltaTCutSet - TempTole)) { - thisTempZoneThermostatSetPoint = thisTempControlledZone.ZoneThermostatSetPointLo + thisTempControlledZone.DeltaTCutSet; - thisZoneThermostatSetPointLo = thisTempZoneThermostatSetPoint; + zoneTstatSetpt.setpt = thisTempControlledZone.ZoneThermostatSetPointLo + thisTempControlledZone.DeltaTCutSet; + zoneTstatSetpt.setptLo = zoneTstatSetpt.setpt; } else { thisTempControlledZone.HeatOffFlag = true; } if (thisTempControlledZone.HeatModeLast && Tprev > thisTempControlledZone.ZoneThermostatSetPointLo) { - thisTempZoneThermostatSetPoint = thisTempControlledZone.ZoneThermostatSetPointLo; - thisZoneThermostatSetPointLo = thisTempControlledZone.ZoneThermostatSetPointLo; + zoneTstatSetpt.setpt = thisTempControlledZone.ZoneThermostatSetPointLo; + zoneTstatSetpt.setptLo = thisTempControlledZone.ZoneThermostatSetPointLo; thisTempControlledZone.HeatOffFlag = true; } - break; - case HVAC::ThermostatType::SingleCooling: - thisTempZoneThermostatSetPoint = thisTempControlledZone.ZoneThermostatSetPointHi; - thisZoneThermostatSetPointHi = thisTempControlledZone.ZoneThermostatSetPointHi; + } break; + + case HVAC::SetptType::SingleCool: { + zoneTstatSetpt.setpt = thisTempControlledZone.ZoneThermostatSetPointHi; + zoneTstatSetpt.setptHi = thisTempControlledZone.ZoneThermostatSetPointHi; if (Tprev > thisTempControlledZone.ZoneThermostatSetPointHi - TempTole) { - thisTempZoneThermostatSetPoint = thisTempControlledZone.ZoneThermostatSetPointHi - thisTempControlledZone.DeltaTCutSet; - thisZoneThermostatSetPointHi = thisTempZoneThermostatSetPoint; + zoneTstatSetpt.setpt = thisTempControlledZone.ZoneThermostatSetPointHi - thisTempControlledZone.DeltaTCutSet; + zoneTstatSetpt.setptHi = zoneTstatSetpt.setpt; } else if (Tprev < thisTempControlledZone.ZoneThermostatSetPointHi && Tprev > thisTempControlledZone.ZoneThermostatSetPointHi - thisTempControlledZone.DeltaTCutSet + TempTole) { - thisTempZoneThermostatSetPoint = thisTempControlledZone.ZoneThermostatSetPointHi - thisTempControlledZone.DeltaTCutSet; - thisZoneThermostatSetPointHi = thisTempZoneThermostatSetPoint; + zoneTstatSetpt.setpt = thisTempControlledZone.ZoneThermostatSetPointHi - thisTempControlledZone.DeltaTCutSet; + zoneTstatSetpt.setptHi = zoneTstatSetpt.setpt; } else { thisTempControlledZone.CoolOffFlag = true; } if (thisTempControlledZone.CoolModeLast && Tprev < thisTempControlledZone.ZoneThermostatSetPointHi) { - thisTempZoneThermostatSetPoint = thisTempControlledZone.ZoneThermostatSetPointHi; - thisZoneThermostatSetPointHi = thisTempControlledZone.ZoneThermostatSetPointHi; + zoneTstatSetpt.setpt = thisTempControlledZone.ZoneThermostatSetPointHi; + zoneTstatSetpt.setptHi = thisTempControlledZone.ZoneThermostatSetPointHi; thisTempControlledZone.CoolOffFlag = true; } - break; - case HVAC::ThermostatType::DualSetPointWithDeadBand: - thisZoneThermostatSetPointHi = thisTempControlledZone.ZoneThermostatSetPointHi; - thisZoneThermostatSetPointLo = thisTempControlledZone.ZoneThermostatSetPointLo; + } break; + + case HVAC::SetptType::DualHeatCool: { + zoneTstatSetpt.setptHi = thisTempControlledZone.ZoneThermostatSetPointHi; + zoneTstatSetpt.setptLo = thisTempControlledZone.ZoneThermostatSetPointLo; if (Tprev > thisTempControlledZone.ZoneThermostatSetPointHi - TempTole) { - thisZoneThermostatSetPointHi = thisTempControlledZone.ZoneThermostatSetPointHi - thisTempControlledZone.DeltaTCutSet; + zoneTstatSetpt.setptHi = thisTempControlledZone.ZoneThermostatSetPointHi - thisTempControlledZone.DeltaTCutSet; } else if (Tprev < thisTempControlledZone.ZoneThermostatSetPointHi && Tprev > thisTempControlledZone.ZoneThermostatSetPointHi - thisTempControlledZone.DeltaTCutSet + TempTole) { - thisZoneThermostatSetPointHi = thisTempControlledZone.ZoneThermostatSetPointHi - thisTempControlledZone.DeltaTCutSet; + zoneTstatSetpt.setptHi = thisTempControlledZone.ZoneThermostatSetPointHi - thisTempControlledZone.DeltaTCutSet; } else { thisTempControlledZone.CoolOffFlag = true; } if (thisTempControlledZone.CoolModeLast && Tprev < thisTempControlledZone.ZoneThermostatSetPointHi) { - thisZoneThermostatSetPointHi = thisTempControlledZone.ZoneThermostatSetPointHi; + zoneTstatSetpt.setptHi = thisTempControlledZone.ZoneThermostatSetPointHi; thisTempControlledZone.CoolOffFlag = true; } if (Tprev < thisTempControlledZone.ZoneThermostatSetPointLo + TempTole) { - thisZoneThermostatSetPointLo = thisTempControlledZone.ZoneThermostatSetPointLo + thisTempControlledZone.DeltaTCutSet; + zoneTstatSetpt.setptLo = thisTempControlledZone.ZoneThermostatSetPointLo + thisTempControlledZone.DeltaTCutSet; } else if (Tprev > thisTempControlledZone.ZoneThermostatSetPointLo && (Tprev < thisTempControlledZone.ZoneThermostatSetPointLo + thisTempControlledZone.DeltaTCutSet - TempTole)) { - thisZoneThermostatSetPointLo = thisTempControlledZone.ZoneThermostatSetPointLo + thisTempControlledZone.DeltaTCutSet; + zoneTstatSetpt.setptLo = thisTempControlledZone.ZoneThermostatSetPointLo + thisTempControlledZone.DeltaTCutSet; } else { thisTempControlledZone.HeatOffFlag = true; } if (thisTempControlledZone.HeatModeLast && Tprev > thisTempControlledZone.ZoneThermostatSetPointLo) { - thisZoneThermostatSetPointLo = thisTempControlledZone.ZoneThermostatSetPointLo; + zoneTstatSetpt.setptLo = thisTempControlledZone.ZoneThermostatSetPointLo; thisTempControlledZone.HeatOffFlag = true; } + // check setpoint for both and provde an error message - if (thisZoneThermostatSetPointLo >= thisZoneThermostatSetPointHi) { + if (zoneTstatSetpt.setptLo >= zoneTstatSetpt.setptHi) { ShowSevereError(state, "DualSetPointWithDeadBand: When Temperature Difference Between Cutout And Setpoint is applied, the heating " "setpoint is greater than the cooling setpoint. "); ShowContinueErrorTimeStamp(state, format("occurs in Zone={}", state.dataHeatBal->Zone(thisTempControlledZone.ActualZoneNum).Name)); - ShowContinueError(state, format("Zone Heating ThermostatSetPoint={:.2R}", thisZoneThermostatSetPointLo)); - ShowContinueError(state, format("Zone Cooling ThermostatSetPoint={:.2R}", thisZoneThermostatSetPointHi)); + ShowContinueError(state, format("Zone Heating ThermostatSetPoint={:.2R}", zoneTstatSetpt.setptLo)); + ShowContinueError(state, format("Zone Cooling ThermostatSetPoint={:.2R}", zoneTstatSetpt.setptHi)); ShowFatalError(state, "Program terminates due to above conditions."); } - break; - default: - break; - } + } break; + + default: { + } break; + } // switch (setptType) } } } for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { - auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum); + auto &thisZoneHB = s_ztpc->zoneHeatBalance(zoneNum); thisZoneHB.predictSystemLoad(state, ShortenTimeStepSys, UseZoneTimeStepHistory, PriorTimeStep, zoneNum); for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { if (state.dataHeatBal->doSpaceHeatBalance) { - state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).predictSystemLoad( + s_ztpc->spaceHeatBalance(spaceNum).predictSystemLoad( state, ShortenTimeStepSys, UseZoneTimeStepHistory, PriorTimeStep, zoneNum, spaceNum); } else if (ShortenTimeStepSys) { - state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).MAT = thisZoneHB.MAT; - state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).airHumRat = thisZoneHB.airHumRat; + s_ztpc->spaceHeatBalance(spaceNum).MAT = thisZoneHB.MAT; + s_ztpc->spaceHeatBalance(spaceNum).airHumRat = thisZoneHB.airHumRat; } } } - if (state.dataZoneTempPredictorCorrector->NumOnOffCtrZone > 0) { + if (s_ztpc->NumOnOffCtrZone > 0) { for (int RelativeZoneNum = 1; RelativeZoneNum <= state.dataZoneCtrls->NumTempControlledZones; ++RelativeZoneNum) { auto &thisTempControlledZone = state.dataZoneCtrls->TempControlledZone(RelativeZoneNum); if (thisTempControlledZone.DeltaTCutSet > 0.0) { @@ -3614,23 +3183,19 @@ void CalcZoneAirTempSetPoints(EnergyPlusData &state) // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int RelativeZoneNum; - int SetPointTempSchedIndexHot; - int SetPointTempSchedIndexCold; - int SchedNameIndex; - Array2D DaySPValues; // Day room temp setpoint values - for optimum start - int OccStartTime; // Occupancy start time - for optimum start - Real64 DeltaT; // Temperature difference between cutout and setpoint + int ActualZoneNum; + int OccStartTime; // Occupancy start time - for optimum start + Real64 DeltaT; // Temperature difference between cutout and setpoint + + auto &s_hbfs = state.dataHeatBalFanSys; auto &Zone = state.dataHeatBal->Zone; auto &TempControlledZone = state.dataZoneCtrls->TempControlledZone; - auto &TempZoneThermostatSetPoint = state.dataHeatBalFanSys->TempZoneThermostatSetPoint; auto &TempControlType = state.dataHeatBalFanSys->TempControlType; auto &TempControlTypeRpt = state.dataHeatBalFanSys->TempControlTypeRpt; - auto &ZoneThermostatSetPointLo = state.dataHeatBalFanSys->ZoneThermostatSetPointLo; - auto &ZoneThermostatSetPointHi = state.dataHeatBalFanSys->ZoneThermostatSetPointHi; int NumOfZones = state.dataGlobal->NumOfZones; - TempControlType = HVAC::ThermostatType::Uncontrolled; // Default + TempControlType = HVAC::SetptType::Uncontrolled; // Default // Place holder for occupied heating and cooling set points - for optimum start if (!allocated(state.dataZoneCtrls->OccRoomTSetPointHeat)) { @@ -3644,157 +3209,151 @@ void CalcZoneAirTempSetPoints(EnergyPlusData &state) DeltaT = 0.0; for (RelativeZoneNum = 1; RelativeZoneNum <= state.dataZoneCtrls->NumTempControlledZones; ++RelativeZoneNum) { - + auto &tempZone = state.dataZoneCtrls->TempControlledZone(RelativeZoneNum); // What if this zone not controlled??? - int ActualZoneNum = TempControlledZone(RelativeZoneNum).ActualZoneNum; - int TempControlSchedIndex = TempControlledZone(RelativeZoneNum).CTSchedIndex; - TempControlType(ActualZoneNum) = static_cast(ScheduleManager::GetCurrentScheduleValue(state, TempControlSchedIndex)); + + int ActualZoneNum = tempZone.ActualZoneNum; + TempControlType(ActualZoneNum) = static_cast(tempZone.setptTypeSched->getCurrentVal()); TempControlTypeRpt(ActualZoneNum) = static_cast(TempControlType(ActualZoneNum)); // Error detection for these values is done in the Get routine + auto &zoneTstatSetpt = s_hbfs->zoneTstatSetpts(tempZone.ActualZoneNum); + switch (TempControlType(ActualZoneNum)) { - case HVAC::ThermostatType::Uncontrolled: - break; - case HVAC::ThermostatType::SingleHeating: - SchedNameIndex = TempControlledZone(RelativeZoneNum).SchIndx_SingleHeatSetPoint; - TempZoneThermostatSetPoint(ActualZoneNum) = ScheduleManager::GetCurrentScheduleValue(state, SchedNameIndex); - TempControlledZone(RelativeZoneNum).ZoneThermostatSetPointLo = TempZoneThermostatSetPoint(ActualZoneNum); + case HVAC::SetptType::Uncontrolled: { + } break; - AdjustAirSetPointsforOpTempCntrl(state, RelativeZoneNum, ActualZoneNum, TempZoneThermostatSetPoint(ActualZoneNum)); - ZoneThermostatSetPointLo(ActualZoneNum) = TempZoneThermostatSetPoint(ActualZoneNum); - break; - case HVAC::ThermostatType::SingleCooling: - SchedNameIndex = TempControlledZone(RelativeZoneNum).SchIndx_SingleCoolSetPoint; - TempZoneThermostatSetPoint(ActualZoneNum) = ScheduleManager::GetCurrentScheduleValue(state, SchedNameIndex); - TempControlledZone(RelativeZoneNum).ZoneThermostatSetPointHi = TempZoneThermostatSetPoint(ActualZoneNum); + case HVAC::SetptType::SingleHeat: { + zoneTstatSetpt.setpt = tempZone.setpts[(int)HVAC::SetptType::SingleHeat].heatSetptSched->getCurrentVal(); + tempZone.ZoneThermostatSetPointLo = zoneTstatSetpt.setpt; + + AdjustAirSetPointsforOpTempCntrl(state, RelativeZoneNum, ActualZoneNum, zoneTstatSetpt.setpt); + zoneTstatSetpt.setptLo = zoneTstatSetpt.setpt; + } break; + + case HVAC::SetptType::SingleCool: { + zoneTstatSetpt.setpt = tempZone.setpts[(int)HVAC::SetptType::SingleCool].coolSetptSched->getCurrentVal(); + tempZone.ZoneThermostatSetPointHi = zoneTstatSetpt.setpt; // Added Jan 17 (X. Luo) // Adjust operative temperature based on adaptive comfort model - if ((TempControlledZone(RelativeZoneNum).AdaptiveComfortTempControl)) { - AdjustOperativeSetPointsforAdapComfort(state, RelativeZoneNum, TempZoneThermostatSetPoint(ActualZoneNum)); - state.dataHeatBalFanSys->AdapComfortCoolingSetPoint(ActualZoneNum) = TempZoneThermostatSetPoint(ActualZoneNum); + if (tempZone.AdaptiveComfortTempControl) { + AdjustOperativeSetPointsforAdapComfort(state, RelativeZoneNum, zoneTstatSetpt.setpt); + zoneTstatSetpt.setptAdapComfortCool = zoneTstatSetpt.setpt; } - AdjustAirSetPointsforOpTempCntrl(state, RelativeZoneNum, ActualZoneNum, TempZoneThermostatSetPoint(ActualZoneNum)); - ZoneThermostatSetPointHi(ActualZoneNum) = TempZoneThermostatSetPoint(ActualZoneNum); + AdjustAirSetPointsforOpTempCntrl(state, RelativeZoneNum, ActualZoneNum, zoneTstatSetpt.setpt); + zoneTstatSetpt.setptHi = zoneTstatSetpt.setpt; AdjustCoolingSetPointforTempAndHumidityControl(state, RelativeZoneNum, ActualZoneNum); - break; - case HVAC::ThermostatType::SingleHeatCool: - - SchedNameIndex = TempControlledZone(RelativeZoneNum).SchIndx_SingleHeatCoolSetPoint; + } break; - TempZoneThermostatSetPoint(ActualZoneNum) = ScheduleManager::GetCurrentScheduleValue(state, SchedNameIndex); + case HVAC::SetptType::SingleHeatCool: { + zoneTstatSetpt.setpt = tempZone.setpts[(int)HVAC::SetptType::SingleHeatCool].heatSetptSched->getCurrentVal(); // Added Jan 17 (X. Luo) // Adjust operative temperature based on adaptive comfort model - if ((TempControlledZone(RelativeZoneNum).AdaptiveComfortTempControl)) { - AdjustOperativeSetPointsforAdapComfort(state, RelativeZoneNum, TempZoneThermostatSetPoint(ActualZoneNum)); - state.dataHeatBalFanSys->AdapComfortCoolingSetPoint(ActualZoneNum) = TempZoneThermostatSetPoint(ActualZoneNum); + if (tempZone.AdaptiveComfortTempControl) { + AdjustOperativeSetPointsforAdapComfort(state, RelativeZoneNum, zoneTstatSetpt.setpt); + zoneTstatSetpt.setptAdapComfortCool = zoneTstatSetpt.setpt; } - AdjustAirSetPointsforOpTempCntrl(state, RelativeZoneNum, ActualZoneNum, TempZoneThermostatSetPoint(ActualZoneNum)); + AdjustAirSetPointsforOpTempCntrl(state, RelativeZoneNum, ActualZoneNum, zoneTstatSetpt.setpt); - ZoneThermostatSetPointHi(ActualZoneNum) = TempZoneThermostatSetPoint(ActualZoneNum); - ZoneThermostatSetPointLo(ActualZoneNum) = TempZoneThermostatSetPoint(ActualZoneNum); + zoneTstatSetpt.setptLo = zoneTstatSetpt.setptHi = zoneTstatSetpt.setpt; // Change the room set point to occupied set point during optimum start period-------------- if (allocated(state.dataAvail->OptStart)) { - if (!allocated(DaySPValues)) { - DaySPValues.allocate(state.dataGlobal->NumOfTimeStepInHour, 24); - } if (state.dataAvail->OptStart(ActualZoneNum).ActualZoneNum == ActualZoneNum) { - ScheduleManager::GetScheduleValuesForDay(state, SetPointTempSchedIndexCold, DaySPValues); + OccStartTime = CEILING(state.dataAvail->OptStart(ActualZoneNum).OccStartTime) + 1; - TempZoneThermostatSetPoint(ActualZoneNum) = DaySPValues(1, OccStartTime); + zoneTstatSetpt.setpt = tempZone.setpts[(int)HVAC::SetptType::SingleHeat].heatSetptSched->getDayVals( + state)[OccStartTime * state.dataGlobal->TimeStepsInHour]; } if (state.dataAvail->OptStart(ActualZoneNum).OptStartFlag) { - ZoneThermostatSetPointHi(ActualZoneNum) = TempZoneThermostatSetPoint(ActualZoneNum); - ZoneThermostatSetPointLo(ActualZoneNum) = TempZoneThermostatSetPoint(ActualZoneNum); + zoneTstatSetpt.setptLo = zoneTstatSetpt.setptHi = zoneTstatSetpt.setpt; } } //-------------------------------------------------------------------------------------------- - break; - case HVAC::ThermostatType::DualSetPointWithDeadBand: - SetPointTempSchedIndexHot = TempControlledZone(RelativeZoneNum).SchIndx_DualSetPointWDeadBandHeat; - SetPointTempSchedIndexCold = TempControlledZone(RelativeZoneNum).SchIndx_DualSetPointWDeadBandCool; + } break; - ZoneThermostatSetPointHi(ActualZoneNum) = ScheduleManager::GetCurrentScheduleValue(state, SetPointTempSchedIndexCold); - TempControlledZone(RelativeZoneNum).ZoneThermostatSetPointHi = ZoneThermostatSetPointHi(ActualZoneNum); + case HVAC::SetptType::DualHeatCool: { + zoneTstatSetpt.setptHi = tempZone.setpts[(int)HVAC::SetptType::DualHeatCool].coolSetptSched->getCurrentVal(); + TempControlledZone(RelativeZoneNum).ZoneThermostatSetPointHi = zoneTstatSetpt.setptHi; // Added Jan 17 (X. Luo) // Adjust operative temperature based on adaptive comfort model if ((TempControlledZone(RelativeZoneNum).AdaptiveComfortTempControl)) { - AdjustOperativeSetPointsforAdapComfort(state, RelativeZoneNum, ZoneThermostatSetPointHi(ActualZoneNum)); - state.dataHeatBalFanSys->AdapComfortCoolingSetPoint(ActualZoneNum) = ZoneThermostatSetPointHi(ActualZoneNum); + AdjustOperativeSetPointsforAdapComfort(state, RelativeZoneNum, zoneTstatSetpt.setptHi); + zoneTstatSetpt.setptAdapComfortCool = zoneTstatSetpt.setptHi; } - AdjustAirSetPointsforOpTempCntrl(state, RelativeZoneNum, ActualZoneNum, ZoneThermostatSetPointHi(ActualZoneNum)); + AdjustAirSetPointsforOpTempCntrl(state, RelativeZoneNum, ActualZoneNum, zoneTstatSetpt.setptHi); - ZoneThermostatSetPointLo(ActualZoneNum) = ScheduleManager::GetCurrentScheduleValue(state, SetPointTempSchedIndexHot); - TempControlledZone(RelativeZoneNum).ZoneThermostatSetPointLo = ZoneThermostatSetPointLo(ActualZoneNum); - AdjustAirSetPointsforOpTempCntrl(state, RelativeZoneNum, ActualZoneNum, ZoneThermostatSetPointLo(ActualZoneNum)); + zoneTstatSetpt.setptLo = tempZone.setpts[(int)HVAC::SetptType::DualHeatCool].heatSetptSched->getCurrentVal(); + TempControlledZone(RelativeZoneNum).ZoneThermostatSetPointLo = zoneTstatSetpt.setptLo; + AdjustAirSetPointsforOpTempCntrl(state, RelativeZoneNum, ActualZoneNum, zoneTstatSetpt.setptLo); // Change the room set point to occupied set point during optimum start period-------------- if (allocated(state.dataAvail->OptStart)) { - if (!allocated(DaySPValues)) { - DaySPValues.allocate(state.dataGlobal->NumOfTimeStepInHour, 24); - } if (state.dataAvail->OptStart(ActualZoneNum).ActualZoneNum == ActualZoneNum) { - ScheduleManager::GetScheduleValuesForDay(state, SetPointTempSchedIndexCold, DaySPValues); + // TODO: Why are we getting all day values if all we want is the value at (1, OccStartTime); OccStartTime = CEILING(state.dataAvail->OptStart(ActualZoneNum).OccStartTime) + 1; - state.dataZoneCtrls->OccRoomTSetPointCool(ActualZoneNum) = DaySPValues(1, OccStartTime); - ScheduleManager::GetScheduleValuesForDay(state, SetPointTempSchedIndexHot, DaySPValues); - state.dataZoneCtrls->OccRoomTSetPointHeat(ActualZoneNum) = DaySPValues(1, OccStartTime); + state.dataZoneCtrls->OccRoomTSetPointCool(ActualZoneNum) = + tempZone.setpts[(int)HVAC::SetptType::DualHeatCool].coolSetptSched->getDayVals( + state)[OccStartTime * state.dataGlobal->TimeStepsInHour]; + state.dataZoneCtrls->OccRoomTSetPointHeat(ActualZoneNum) = + tempZone.setpts[(int)HVAC::SetptType::DualHeatCool].heatSetptSched->getDayVals( + state)[OccStartTime * state.dataGlobal->TimeStepsInHour]; } if (state.dataAvail->OptStart(ActualZoneNum).OptStartFlag) { - ZoneThermostatSetPointHi(ActualZoneNum) = state.dataZoneCtrls->OccRoomTSetPointCool(ActualZoneNum); - ZoneThermostatSetPointLo(ActualZoneNum) = state.dataZoneCtrls->OccRoomTSetPointHeat(ActualZoneNum); + zoneTstatSetpt.setptHi = state.dataZoneCtrls->OccRoomTSetPointCool(ActualZoneNum); + zoneTstatSetpt.setptLo = state.dataZoneCtrls->OccRoomTSetPointHeat(ActualZoneNum); } } //-------------------------------------------------------------------------------------------- AdjustCoolingSetPointforTempAndHumidityControl(state, RelativeZoneNum, ActualZoneNum); - break; - default: + } break; + + default: { ShowSevereError(state, format("CalcZoneAirTempSetpoints: Illegal control type for Zone={}, Found value={}, in Schedule={}", Zone(ActualZoneNum).Name, TempControlType(ActualZoneNum), - TempControlledZone(RelativeZoneNum).ControlTypeSchedName)); + tempZone.setptTypeSched->Name)); - break; - } + } break; + } // switch - // Apply offset for faulty therostats + // Apply offset for faulty thermostats if ((state.dataFaultsMgr->NumFaultyThermostat > 0) && (!state.dataGlobal->WarmupFlag) && (!state.dataGlobal->DoingSizing) && (!state.dataGlobal->KickOffSimulation)) { // loop through the FaultsThermostatOffset objects to find the one for the zone for (int iFault = 1; iFault <= state.dataFaultsMgr->NumFaultyThermostat; ++iFault) { - + // Why are we doing this here? if (Util::SameString(TempControlledZone(RelativeZoneNum).Name, state.dataFaultsMgr->FaultsThermostatOffset(iFault).FaultyThermostatName)) { // Check fault availability schedules - if (ScheduleManager::GetCurrentScheduleValue(state, state.dataFaultsMgr->FaultsThermostatOffset(iFault).availSchedNum) > 0.0) { + if (state.dataFaultsMgr->FaultsThermostatOffset(iFault).availSched->getCurrentVal() > 0.0) { // Check fault severity schedules to update the reference thermostat offset Real64 rSchVal = 1.0; Real64 offsetUpdated; - if (state.dataFaultsMgr->FaultsThermostatOffset(iFault).severitySchedNum >= 0) { - rSchVal = - ScheduleManager::GetCurrentScheduleValue(state, state.dataFaultsMgr->FaultsThermostatOffset(iFault).severitySchedNum); + if (state.dataFaultsMgr->FaultsThermostatOffset(iFault).severitySched != nullptr) { + rSchVal = state.dataFaultsMgr->FaultsThermostatOffset(iFault).severitySched->getCurrentVal(); } offsetUpdated = rSchVal * state.dataFaultsMgr->FaultsThermostatOffset(iFault).Offset; // Positive offset means the sensor reading is higher than the actual value - TempZoneThermostatSetPoint(ActualZoneNum) -= offsetUpdated; - ZoneThermostatSetPointLo(ActualZoneNum) -= offsetUpdated; - ZoneThermostatSetPointHi(ActualZoneNum) -= offsetUpdated; + zoneTstatSetpt.setpt -= offsetUpdated; + zoneTstatSetpt.setptLo -= offsetUpdated; + zoneTstatSetpt.setptHi -= offsetUpdated; } // Stop searching the FaultsThermostatOffset object for the zone @@ -3840,8 +3399,8 @@ void ZoneSpaceHeatBalanceData::calcPredictedHumidityRatio(EnergyPlusData &state, if (thisZone.humidityControlZoneIndex > 0) { auto &humidityControlZone = state.dataZoneCtrls->HumidityControlZone(thisZone.humidityControlZoneIndex); assert(humidityControlZone.ActualZoneNum == zoneNum); - ZoneRHHumidifyingSetPoint = ScheduleManager::GetCurrentScheduleValue(state, humidityControlZone.HumidifyingSchedIndex); - ZoneRHDehumidifyingSetPoint = ScheduleManager::GetCurrentScheduleValue(state, humidityControlZone.DehumidifyingSchedIndex); + ZoneRHHumidifyingSetPoint = humidityControlZone.humidifyingSched->getCurrentVal(); + ZoneRHDehumidifyingSetPoint = humidityControlZone.dehumidifyingSched->getCurrentVal(); // Apply EMS values to overwrite the humidistat values if (humidityControlZone.EMSOverrideHumidifySetPointOn) { @@ -3877,14 +3436,12 @@ void ZoneSpaceHeatBalanceData::calcPredictedHumidityRatio(EnergyPlusData &state, IsThermostatFound = true; // Check fault availability schedules - if (ScheduleManager::GetCurrentScheduleValue( - state, state.dataFaultsMgr->FaultsThermostatOffset(iFaultThermo).availSchedNum) > 0.0) { + if (state.dataFaultsMgr->FaultsThermostatOffset(iFaultThermo).availSched->getCurrentVal() > 0.0) { // Check fault severity schedules to update the reference thermostat offset Real64 rSchVal = 1.0; - if (state.dataFaultsMgr->FaultsThermostatOffset(iFaultThermo).severitySchedNum >= 0) { - rSchVal = ScheduleManager::GetCurrentScheduleValue( - state, state.dataFaultsMgr->FaultsThermostatOffset(iFaultThermo).severitySchedNum); + if (state.dataFaultsMgr->FaultsThermostatOffset(iFaultThermo).severitySched != nullptr) { + rSchVal = state.dataFaultsMgr->FaultsThermostatOffset(iFaultThermo).severitySched->getCurrentVal(); } offsetThermostat = rSchVal * state.dataFaultsMgr->FaultsThermostatOffset(iFaultThermo).Offset; } @@ -3933,15 +3490,13 @@ void ZoneSpaceHeatBalanceData::calcPredictedHumidityRatio(EnergyPlusData &state, // For Humidistat Offset Type II: ThermostatOffsetIndependent // Check fault availability schedules - if (ScheduleManager::GetCurrentScheduleValue(state, state.dataFaultsMgr->FaultsHumidistatOffset(iFault).availSchedNum) > - 0.0) { + if (state.dataFaultsMgr->FaultsHumidistatOffset(iFault).availSched->getCurrentVal() > 0.0) { // Check fault severity schedules to update the reference humidistat offset Real64 rSchVal = 1.0; Real64 offsetUpdated; - if (state.dataFaultsMgr->FaultsHumidistatOffset(iFault).severitySchedNum >= 0) { - rSchVal = ScheduleManager::GetCurrentScheduleValue( - state, state.dataFaultsMgr->FaultsHumidistatOffset(iFault).severitySchedNum); + if (state.dataFaultsMgr->FaultsHumidistatOffset(iFault).severitySched != nullptr) { + rSchVal = state.dataFaultsMgr->FaultsHumidistatOffset(iFault).severitySched->getCurrentVal(); } offsetUpdated = rSchVal * state.dataFaultsMgr->FaultsHumidistatOffset(iFault).Offset; @@ -3990,11 +3545,11 @@ void ZoneSpaceHeatBalanceData::calcPredictedHumidityRatio(EnergyPlusData &state, if (ZoneSizNum > 0) { auto &zoneSizingInput = state.dataSize->ZoneSizingInput(ZoneSizNum); if (zoneSizingInput.zoneLatentSizing) { - ZoneRHDehumidifyingSetPoint = (zoneSizingInput.zoneRHDehumidifySchIndex) - ? ScheduleManager::GetCurrentScheduleValue(state, zoneSizingInput.zoneRHDehumidifySchIndex) + ZoneRHDehumidifyingSetPoint = (zoneSizingInput.zoneRHDehumidifySched != nullptr) + ? zoneSizingInput.zoneRHDehumidifySched->getCurrentVal() : zoneSizingInput.zoneRHDehumidifySetPoint; - ZoneRHHumidifyingSetPoint = (zoneSizingInput.zoneRHHumidifySchIndex) - ? ScheduleManager::GetCurrentScheduleValue(state, zoneSizingInput.zoneRHHumidifySchIndex) + ZoneRHHumidifyingSetPoint = (zoneSizingInput.zoneRHHumidifySched != nullptr) + ? zoneSizingInput.zoneRHHumidifySched->getCurrentVal() : zoneSizingInput.zoneRHHumidifySetPoint; if (ZoneRHHumidifyingSetPoint > ZoneRHDehumidifyingSetPoint) ZoneRHHumidifyingSetPoint = ZoneRHDehumidifyingSetPoint; if (ZoneRHHumidifyingSetPoint == ZoneRHDehumidifyingSetPoint) SingleSetPoint = true; @@ -4155,19 +3710,20 @@ Real64 correctZoneAirTemps(EnergyPlusData &state, bool useZoneTimeStepHistory // if true then use zone timestep history, if false use system time step history ) { + auto &s_ztpc = state.dataZoneTempPredictorCorrector; Real64 maxTempChange = DataPrecisionGlobals::constant_zero; // Max absolute air temperature change between previous and current timestep for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { - auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum); + auto &thisZoneHB = s_ztpc->zoneHeatBalance(zoneNum); Real64 zoneTempChange = thisZoneHB.correctAirTemp(state, useZoneTimeStepHistory, zoneNum); auto &thisZone = state.dataHeatBal->Zone(zoneNum); for (int spaceNum : thisZone.spaceIndexes) { - auto &thisSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum); + auto &thisSpaceHB = s_ztpc->spaceHeatBalance(spaceNum); if (state.dataHeatBal->doSpaceHeatBalanceSimulation && !state.dataGlobal->DoingSizing) { // Need space air temps to match zone temps for sizing Real64 spaceTempChange = thisSpaceHB.correctAirTemp(state, useZoneTimeStepHistory, zoneNum, spaceNum); maxTempChange = max(maxTempChange, spaceTempChange); } else { - // If doing sizing and zone is controled, then set space node to match zone node + // If doing sizing and zone is controlled, then set space node to match zone node if (state.dataHeatBal->doSpaceHeatBalanceSizing && thisZone.IsControlled) { auto const &thisZoneNode = state.dataLoopNodes->Node(thisZone.SystemZoneNodeNumber); auto &thisSpaceNode = state.dataLoopNodes->Node(state.dataHeatBal->space(spaceNum).SystemZoneNodeNumber); @@ -4186,12 +3742,10 @@ Real64 correctZoneAirTemps(EnergyPlusData &state, } maxTempChange = max(maxTempChange, zoneTempChange); - CalcZoneComponentLoadSums( - state, zoneNum, &state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum), state.dataHeatBal->ZnAirRpt(zoneNum)); + CalcZoneComponentLoadSums(state, zoneNum, &s_ztpc->zoneHeatBalance(zoneNum), state.dataHeatBal->ZnAirRpt(zoneNum)); if (state.dataHeatBal->doSpaceHeatBalanceSimulation) { for (int spaceNum : thisZone.spaceIndexes) { - CalcZoneComponentLoadSums( - state, zoneNum, &state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum), state.dataHeatBal->spaceAirRpt(spaceNum)); + CalcZoneComponentLoadSums(state, zoneNum, &s_ztpc->spaceHeatBalance(spaceNum), state.dataHeatBal->spaceAirRpt(spaceNum)); } } } @@ -4429,10 +3983,9 @@ Real64 ZoneSpaceHeatBalanceData::correctAirTemp( // Hybrid modeling start // SpaceHB TODO: For now, hybrid model is only for zones if (spaceNum == 0 && state.dataHybridModel->FlagHybridModel) { - if ((state.dataHybridModel->HybridModelZone(zoneNum).InfiltrationCalc_T || - state.dataHybridModel->HybridModelZone(zoneNum).InternalThermalMassCalc_T || - state.dataHybridModel->HybridModelZone(zoneNum).PeopleCountCalc_T) && - (!state.dataGlobal->WarmupFlag) && (!state.dataGlobal->DoingSizing)) { + auto &hmZone = state.dataHybridModel->hybridModelZones(zoneNum); + if ((hmZone.InfiltrationCalc_T || hmZone.InternalThermalMassCalc_T || hmZone.PeopleCountCalc_T) && (!state.dataGlobal->WarmupFlag) && + (!state.dataGlobal->DoingSizing)) { InverseModelTemperature(state, zoneNum, this->SumIntGain, @@ -4506,12 +4059,12 @@ void PushZoneTimestepHistories(EnergyPlusData &state) // PURPOSE OF THIS SUBROUTINE: // push histories for timestep advancing - + auto &s_ztpc = state.dataZoneTempPredictorCorrector; for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { - state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).pushZoneTimestepHistory(state, zoneNum); + s_ztpc->zoneHeatBalance(zoneNum).pushZoneTimestepHistory(state, zoneNum); if (state.dataHeatBal->doSpaceHeatBalance) { for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { - state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).pushZoneTimestepHistory(state, zoneNum, spaceNum); + s_ztpc->spaceHeatBalance(spaceNum).pushZoneTimestepHistory(state, zoneNum, spaceNum); } } } @@ -4616,12 +4169,12 @@ void PushSystemTimestepHistories(EnergyPlusData &state) // PURPOSE OF THIS SUBROUTINE: // Push the temperature and humidity ratio histories back in time - + auto &s_ztpc = state.dataZoneTempPredictorCorrector; for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { - state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).pushSystemTimestepHistory(state, zoneNum); + s_ztpc->zoneHeatBalance(zoneNum).pushSystemTimestepHistory(state, zoneNum); if (state.dataHeatBal->doSpaceHeatBalance) { for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { - state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).pushSystemTimestepHistory(state, zoneNum, spaceNum); + s_ztpc->spaceHeatBalance(spaceNum).pushSystemTimestepHistory(state, zoneNum, spaceNum); } } } @@ -4710,12 +4263,12 @@ void RevertZoneTimestepHistories(EnergyPlusData &state) // PURPOSE OF THIS SUBROUTINE: // Revert the temperature and humidity ratio histories - + auto &s_ztpc = state.dataZoneTempPredictorCorrector; for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { - state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).revertZoneTimestepHistory(state, zoneNum); + s_ztpc->zoneHeatBalance(zoneNum).revertZoneTimestepHistory(state, zoneNum); if (state.dataHeatBal->doSpaceHeatBalance) { for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { - state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).revertZoneTimestepHistory(state, zoneNum, spaceNum); + s_ztpc->spaceHeatBalance(spaceNum).revertZoneTimestepHistory(state, zoneNum, spaceNum); } } } @@ -4857,7 +4410,7 @@ void ZoneSpaceHeatBalanceData::correctHumRat(EnergyPlusData &state, int const zo // Use a 3rd order derivative to predict final zone humidity ratio and // smooth the changes using the zone air capacitance. // auto &zoneAirHumRatTemp = this->ZoneAirHumRatTemp; - // auto &zoneW1 = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).ZoneW1; + // auto &zoneW1 = s_ztpc->zoneHeatBalance(ZoneNum).ZoneW1; switch (state.dataHeatBal->ZoneAirSolutionAlgo) { case DataHeatBalance::SolutionAlgo::ThirdOrder: { this->airHumRatTemp = @@ -4895,11 +4448,10 @@ void ZoneSpaceHeatBalanceData::correctHumRat(EnergyPlusData &state, int const zo // HybridModel with measured humidity ratio begins // SpaceHB TODO: For now, hybrid model is only for zones if (spaceNum == 0 && state.dataHybridModel->FlagHybridModel) { - if ((state.dataHybridModel->HybridModelZone(zoneNum).InfiltrationCalc_H || - state.dataHybridModel->HybridModelZone(zoneNum).PeopleCountCalc_H) && - (!state.dataGlobal->WarmupFlag) && (!state.dataGlobal->DoingSizing)) { + auto &hmZone = state.dataHybridModel->hybridModelZones(zoneNum); + if ((hmZone.InfiltrationCalc_H || hmZone.PeopleCountCalc_H) && (!state.dataGlobal->WarmupFlag) && (!state.dataGlobal->DoingSizing)) { Real64 LatentGainExceptPeople = 0.0; - if (state.dataHybridModel->HybridModelZone(zoneNum).PeopleCountCalc_H) { + if (hmZone.PeopleCountCalc_H) { LatentGainExceptPeople = this->latentGainExceptPeople + state.dataHeatBalFanSys->SumLatentHTRadSys(zoneNum) + state.dataHeatBalFanSys->SumLatentPool(zoneNum); } @@ -5079,31 +4631,29 @@ void InverseModelTemperature(EnergyPlusData &state, Real64 BB(0.0); Real64 FractionConvection(0.0); // Default convection portion of the sensible heat from people + auto &s_ztpc = state.dataZoneTempPredictorCorrector; auto &zone = state.dataHeatBal->Zone(ZoneNum); - auto &hybridModelZone = state.dataHybridModel->HybridModelZone(ZoneNum); - auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); + auto &hmZone = state.dataHybridModel->hybridModelZones(ZoneNum); + auto &thisZoneHB = s_ztpc->zoneHeatBalance(ZoneNum); int ZoneMult = zone.Multiplier * zone.ListMultiplier; - zone.ZoneMeasuredTemperature = ScheduleManager::GetCurrentScheduleValue(state, hybridModelZone.ZoneMeasuredTemperatureSchedulePtr); + zone.ZoneMeasuredTemperature = (hmZone.measuredTempSched != nullptr) ? hmZone.measuredTempSched->getCurrentVal() : 0.0; zone.ZoneVolCapMultpSensHM = 1.0; // Initialize to 1.0 in case hybrid not active // HM calculation only HM calculation period start - if (state.dataEnvrn->DayOfYear >= hybridModelZone.HybridStartDayOfYear && state.dataEnvrn->DayOfYear <= hybridModelZone.HybridEndDayOfYear) { + if (state.dataEnvrn->DayOfYear >= hmZone.HybridStartDayOfYear && state.dataEnvrn->DayOfYear <= hmZone.HybridEndDayOfYear) { Real64 MultpHM(1.0); thisZoneHB.ZT = zone.ZoneMeasuredTemperature; // Array1D ZT -- Zone // Air Temperature Averaged over // the System Time Increment - if (hybridModelZone.InfiltrationCalc_T && state.dataHVACGlobal->UseZoneTimeStepHistory) { + if (hmZone.InfiltrationCalc_T && state.dataHVACGlobal->UseZoneTimeStepHistory) { static constexpr std::string_view RoutineNameInfiltration("CalcAirFlowSimple:Infiltration"); - if (hybridModelZone.IncludeSystemSupplyParameters) { - zone.ZoneMeasuredSupplyAirTemperature = - ScheduleManager::GetCurrentScheduleValue(state, hybridModelZone.ZoneSupplyAirTemperatureSchedulePtr); - zone.ZoneMeasuredSupplyAirFlowRate = - ScheduleManager::GetCurrentScheduleValue(state, hybridModelZone.ZoneSupplyAirMassFlowRateSchedulePtr); - zone.ZoneMeasuredSupplyAirHumidityRatio = - ScheduleManager::GetCurrentScheduleValue(state, hybridModelZone.ZoneSupplyAirHumidityRatioSchedulePtr); + if (hmZone.IncludeSystemSupplyParameters) { + zone.ZoneMeasuredSupplyAirTemperature = hmZone.supplyAirTempSched->getCurrentVal(); + zone.ZoneMeasuredSupplyAirFlowRate = hmZone.supplyAirMassFlowRateSched ? hmZone.supplyAirMassFlowRateSched->getCurrentVal() : 0.0; + zone.ZoneMeasuredSupplyAirHumidityRatio = hmZone.supplyAirHumRatSched ? hmZone.supplyAirHumRatSched->getCurrentVal() : 0.0; // Calculate the air humidity ratio at supply air inlet. Real64 CpAirInlet(0.0); CpAirInlet = Psychrometrics::PsyCpAirFnW(zone.ZoneMeasuredSupplyAirHumidityRatio); @@ -5135,8 +4685,8 @@ void InverseModelTemperature(EnergyPlusData &state, if (std::abs(delta_T) > 0.5) { M_inf = (BB + CC * DD - ((11.0 / 6.0) * CC + AA) * zone.ZoneMeasuredTemperature) / (CpAir * delta_T); } - Real64 ACH_inf = max(0.0, min(10.0, (M_inf / AirDensity) / zone.Volume * Constant::SecInHour)); - M_inf = (ACH_inf / Constant::SecInHour) * zone.Volume * AirDensity; + Real64 ACH_inf = max(0.0, min(10.0, (M_inf / AirDensity) / zone.Volume * Constant::rSecsInHour)); + M_inf = (ACH_inf / Constant::rSecsInHour) * zone.Volume * AirDensity; // Overwrite variable with inverse solution zone.MCPIHM = M_inf; @@ -5145,7 +4695,7 @@ void InverseModelTemperature(EnergyPlusData &state, } // Hybrid model infiltration calculation end // Hybrid modeling internal thermal mass calculation start - if (hybridModelZone.InternalThermalMassCalc_T && SumSysMCpT == 0 && thisZoneHB.ZT != state.dataHeatBalFanSys->PreviousMeasuredZT1(ZoneNum) && + if (hmZone.InternalThermalMassCalc_T && SumSysMCpT == 0 && thisZoneHB.ZT != state.dataHeatBalFanSys->PreviousMeasuredZT1(ZoneNum) && state.dataHVACGlobal->UseZoneTimeStepHistory) { // HM calculation only when SumSysMCpT =0, // TimeStepZone (not @ TimeStepSys) Real64 TempDepCoef = SumHA + SumMCp + SumSysMCp; @@ -5170,7 +4720,7 @@ void InverseModelTemperature(EnergyPlusData &state, (TempIndCoef - TempDepCoef * thisZoneHB.ZT); } - if ((AirCapHM_temp > 0) && (AirCapHM_temp != 1)) { // Avoide IND + if ((AirCapHM_temp > 0) && (AirCapHM_temp != 1)) { // Avoid IND AirCapHM = TempDepCoef / std::log(AirCapHM_temp); // Inverse equation } else { AirCapHM = TempIndCoef / (thisZoneHB.ZT - state.dataHeatBalFanSys->PreviousMeasuredZT1(ZoneNum)); @@ -5186,7 +4736,7 @@ void InverseModelTemperature(EnergyPlusData &state, thisZoneHB.ZT, thisZoneHB.airHumRat) * Psychrometrics::PsyCpAirFnW(thisZoneHB.airHumRat)) * - (state.dataGlobal->TimeStepZone * Constant::SecInHour); // Inverse equation + (state.dataGlobal->TimeStepZone * Constant::rSecsInHour); // Inverse equation } else { MultpHM = 1.0; // Default value 1.0 } @@ -5195,20 +4745,18 @@ void InverseModelTemperature(EnergyPlusData &state, state, MultpHM, zone.ZoneVolCapMultpSensHMSum, zone.ZoneVolCapMultpSensHMCountSum, zone.ZoneVolCapMultpSensHMAverage, ZoneNum); zone.ZoneVolCapMultpSensHM = MultpHM; - } // Hybrid model internal thermal mass calcualtion end + } // Hybrid model internal thermal mass calculation end // Hybrid model people count calculation - if (hybridModelZone.PeopleCountCalc_T && state.dataHVACGlobal->UseZoneTimeStepHistory) { - zone.ZoneMeasuredTemperature = ScheduleManager::GetCurrentScheduleValue(state, hybridModelZone.ZoneMeasuredTemperatureSchedulePtr); - zone.ZonePeopleActivityLevel = ScheduleManager::GetCurrentScheduleValue(state, hybridModelZone.ZonePeopleActivityLevelSchedulePtr); - zone.ZonePeopleSensibleHeatFraction = - ScheduleManager::GetCurrentScheduleValue(state, hybridModelZone.ZonePeopleSensibleFractionSchedulePtr); - zone.ZonePeopleRadiantHeatFraction = - ScheduleManager::GetCurrentScheduleValue(state, hybridModelZone.ZonePeopleRadiationFractionSchedulePtr); + if (hmZone.PeopleCountCalc_T && state.dataHVACGlobal->UseZoneTimeStepHistory) { + zone.ZoneMeasuredTemperature = hmZone.measuredTempSched->getCurrentVal(); + zone.ZonePeopleActivityLevel = hmZone.peopleActivityLevelSched ? hmZone.peopleActivityLevelSched->getCurrentVal() : 0.0; + zone.ZonePeopleSensibleHeatFraction = hmZone.peopleSensibleFracSched ? hmZone.peopleSensibleFracSched->getCurrentVal() : 0.0; + zone.ZonePeopleRadiantHeatFraction = hmZone.peopleRadiantFracSched ? hmZone.peopleRadiantFracSched->getCurrentVal() : 0.0; Real64 FractionSensible = zone.ZonePeopleSensibleHeatFraction; Real64 FractionRadiation = zone.ZonePeopleRadiantHeatFraction; - Real64 ActivityLevel = ScheduleManager::GetCurrentScheduleValue(state, hybridModelZone.ZonePeopleActivityLevelSchedulePtr); + Real64 ActivityLevel = hmZone.peopleActivityLevelSched ? hmZone.peopleActivityLevelSched->getCurrentVal() : 0.0; if (FractionSensible <= 0.0) { FractionSensible = 0.6; @@ -5224,13 +4772,10 @@ void InverseModelTemperature(EnergyPlusData &state, ActivityLevel = 130.0; } - if (hybridModelZone.IncludeSystemSupplyParameters) { - zone.ZoneMeasuredSupplyAirTemperature = - ScheduleManager::GetCurrentScheduleValue(state, hybridModelZone.ZoneSupplyAirTemperatureSchedulePtr); - zone.ZoneMeasuredSupplyAirFlowRate = - ScheduleManager::GetCurrentScheduleValue(state, hybridModelZone.ZoneSupplyAirMassFlowRateSchedulePtr); - zone.ZoneMeasuredSupplyAirHumidityRatio = - ScheduleManager::GetCurrentScheduleValue(state, hybridModelZone.ZoneSupplyAirHumidityRatioSchedulePtr); + if (hmZone.IncludeSystemSupplyParameters) { + zone.ZoneMeasuredSupplyAirTemperature = hmZone.supplyAirTempSched->getCurrentVal(); + zone.ZoneMeasuredSupplyAirFlowRate = hmZone.supplyAirMassFlowRateSched ? hmZone.supplyAirMassFlowRateSched->getCurrentVal() : 0.0; + zone.ZoneMeasuredSupplyAirHumidityRatio = hmZone.supplyAirHumRatSched ? hmZone.supplyAirHumRatSched->getCurrentVal() : 0.0; // Calculate the air humidity ratio at supply air inlet. Real64 CpAirInlet = Psychrometrics::PsyCpAirFnW(zone.ZoneMeasuredSupplyAirHumidityRatio); @@ -5272,15 +4817,16 @@ void processInverseModelMultpHM(EnergyPlusData &state, Real64 &multiplierHM, // Hybrid model thermal mass multiplier Real64 &multSumHM, // Sum of Hybrid model thermal mass multipliers Real64 &countSumHM, // Count of number of points in sum - Real64 &multAvgHM, // Average of hybrid model mass multipier + Real64 &multAvgHM, // Average of hybrid model mass multiplier int zoneNum // Zone number for the hybrid model ) { Real64 constexpr minHMMultValue = 1.0; Real64 constexpr maxHMMultValue = 30.0; + auto &s_ztpc = state.dataZoneTempPredictorCorrector; auto &zone = state.dataHeatBal->Zone(zoneNum); - auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum); + auto &thisZoneHB = s_ztpc->zoneHeatBalance(zoneNum); // Apply limits and generate warnings as needed if (multiplierHM < minHMMultValue) { // don't allow this to be less than minimum (potential for instability) @@ -5331,24 +4877,23 @@ void InverseModelHumidity(EnergyPlusData &state, Real64 ActivityLevel(0.0); Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; + auto &s_ztpc = state.dataZoneTempPredictorCorrector; auto &zone = state.dataHeatBal->Zone(ZoneNum); - auto &hybridModelZone = state.dataHybridModel->HybridModelZone(ZoneNum); - auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); + auto &hmZone = state.dataHybridModel->hybridModelZones(ZoneNum); + auto &thisZoneHB = s_ztpc->zoneHeatBalance(ZoneNum); // Get measured zone humidity ratio - zone.ZoneMeasuredHumidityRatio = ScheduleManager::GetCurrentScheduleValue(state, hybridModelZone.ZoneMeasuredHumidityRatioSchedulePtr); + zone.ZoneMeasuredHumidityRatio = hmZone.measuredHumRatSched->getCurrentVal(); - if (state.dataEnvrn->DayOfYear >= hybridModelZone.HybridStartDayOfYear && state.dataEnvrn->DayOfYear <= hybridModelZone.HybridEndDayOfYear) { + if (state.dataEnvrn->DayOfYear >= hmZone.HybridStartDayOfYear && state.dataEnvrn->DayOfYear <= hmZone.HybridEndDayOfYear) { thisZoneHB.airHumRat = zone.ZoneMeasuredHumidityRatio; // Hybrid Model calculate air infiltration rate - if (hybridModelZone.InfiltrationCalc_H && state.dataHVACGlobal->UseZoneTimeStepHistory) { + if (hmZone.InfiltrationCalc_H && state.dataHVACGlobal->UseZoneTimeStepHistory) { // Conditionally calculate the time dependent and time independent terms - if (hybridModelZone.IncludeSystemSupplyParameters) { - zone.ZoneMeasuredSupplyAirFlowRate = - ScheduleManager::GetCurrentScheduleValue(state, hybridModelZone.ZoneSupplyAirMassFlowRateSchedulePtr); - zone.ZoneMeasuredSupplyAirHumidityRatio = - ScheduleManager::GetCurrentScheduleValue(state, hybridModelZone.ZoneSupplyAirHumidityRatioSchedulePtr); + if (hmZone.IncludeSystemSupplyParameters) { + zone.ZoneMeasuredSupplyAirFlowRate = hmZone.supplyAirMassFlowRateSched->getCurrentVal(); + zone.ZoneMeasuredSupplyAirHumidityRatio = hmZone.supplyAirHumRatSched->getCurrentVal(); Real64 SumSysM_HM = zone.ZoneMeasuredSupplyAirFlowRate; Real64 SumSysMHumRat_HM = zone.ZoneMeasuredSupplyAirFlowRate * zone.ZoneMeasuredSupplyAirHumidityRatio; @@ -5380,19 +4925,17 @@ void InverseModelHumidity(EnergyPlusData &state, } // Add threshold for air change rate - Real64 ACH_inf = max(0.0, min(10.0, (M_inf / AirDensity) / zone.Volume * Constant::SecInHour)); - M_inf = (ACH_inf / Constant::SecInHour) * zone.Volume * AirDensity; + Real64 ACH_inf = max(0.0, min(10.0, (M_inf / AirDensity) / zone.Volume * Constant::rSecsInHour)); + M_inf = (ACH_inf / Constant::rSecsInHour) * zone.Volume * AirDensity; zone.MCPIHM = M_inf; zone.InfilOAAirChangeRateHM = ACH_inf; } // Hybrid Model calculate people count - if (hybridModelZone.PeopleCountCalc_H && state.dataHVACGlobal->UseZoneTimeStepHistory) { - zone.ZonePeopleActivityLevel = ScheduleManager::GetCurrentScheduleValue(state, hybridModelZone.ZonePeopleActivityLevelSchedulePtr); - zone.ZonePeopleSensibleHeatFraction = - ScheduleManager::GetCurrentScheduleValue(state, hybridModelZone.ZonePeopleSensibleFractionSchedulePtr); - zone.ZonePeopleRadiantHeatFraction = - ScheduleManager::GetCurrentScheduleValue(state, hybridModelZone.ZonePeopleRadiationFractionSchedulePtr); + if (hmZone.PeopleCountCalc_H && state.dataHVACGlobal->UseZoneTimeStepHistory) { + zone.ZonePeopleActivityLevel = hmZone.peopleActivityLevelSched ? hmZone.peopleActivityLevelSched->getCurrentVal() : 0.0; + zone.ZonePeopleSensibleHeatFraction = hmZone.peopleSensibleFracSched ? hmZone.peopleSensibleFracSched->getCurrentVal() : 0.0; + zone.ZonePeopleRadiantHeatFraction = hmZone.peopleRadiantFracSched ? hmZone.peopleRadiantFracSched->getCurrentVal() : 0.0; Real64 FractionSensible = zone.ZonePeopleSensibleHeatFraction; @@ -5406,11 +4949,9 @@ void InverseModelHumidity(EnergyPlusData &state, // Conditionally calculate the humidity-dependent and humidity-independent // terms. - if (hybridModelZone.IncludeSystemSupplyParameters) { - zone.ZoneMeasuredSupplyAirFlowRate = - ScheduleManager::GetCurrentScheduleValue(state, hybridModelZone.ZoneSupplyAirMassFlowRateSchedulePtr); - zone.ZoneMeasuredSupplyAirHumidityRatio = - ScheduleManager::GetCurrentScheduleValue(state, hybridModelZone.ZoneSupplyAirHumidityRatioSchedulePtr); + if (hmZone.IncludeSystemSupplyParameters) { + zone.ZoneMeasuredSupplyAirFlowRate = hmZone.supplyAirMassFlowRateSched->getCurrentVal(); + zone.ZoneMeasuredSupplyAirHumidityRatio = hmZone.supplyAirHumRatSched->getCurrentVal(); Real64 SumSysM_HM = zone.ZoneMeasuredSupplyAirFlowRate; Real64 SumSysMHumRat_HM = zone.ZoneMeasuredSupplyAirFlowRate * zone.ZoneMeasuredSupplyAirHumidityRatio; @@ -5587,12 +5128,13 @@ void ZoneSpaceHeatBalanceData::calcZoneOrSpaceSums(EnergyPlusData &state, SumHATOutput ZoneHeatBalanceData::calcSumHAT(EnergyPlusData &state, int const zoneNum, [[maybe_unused]] int const spaceNum) { + auto &s_ztpc = state.dataZoneTempPredictorCorrector; assert(zoneNum > 0); assert(spaceNum == 0); SumHATOutput zoneResults; // zone-level return values for (int zoneSpaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { SumHATOutput spaceResults; // temporary return value from space-level calcSumHAT - spaceResults = state.dataZoneTempPredictorCorrector->spaceHeatBalance(zoneSpaceNum).calcSumHAT(state, zoneNum, zoneSpaceNum); + spaceResults = s_ztpc->spaceHeatBalance(zoneSpaceNum).calcSumHAT(state, zoneNum, zoneSpaceNum); zoneResults.sumIntGain += spaceResults.sumIntGain; zoneResults.sumHA += spaceResults.sumHA; zoneResults.sumHATsurf += spaceResults.sumHATsurf; @@ -5605,6 +5147,7 @@ SumHATOutput SpaceHeatBalanceData::calcSumHAT(EnergyPlusData &state, int const z { assert(zoneNum > 0); assert(spaceNum > 0); + auto &s_ztpc = state.dataZoneTempPredictorCorrector; auto &thisZone = state.dataHeatBal->Zone(zoneNum); auto &thisSpace = state.dataHeatBal->space(spaceNum); SumHATOutput results; // space-level return values @@ -5694,9 +5237,8 @@ SumHATOutput SpaceHeatBalanceData::calcSumHAT(EnergyPlusData &state, int const z } // determine supply air temperature as a weighted average of the inlet temperatures. // TODO: For now, use zone-level values for system flow - if (state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).SumSysMCp > 0.0) { - results.sumHATref += HA * state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).SumSysMCpT / - state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).SumSysMCp; + if (s_ztpc->zoneHeatBalance(zoneNum).SumSysMCp > 0.0) { + results.sumHATref += HA * s_ztpc->zoneHeatBalance(zoneNum).SumSysMCpT / s_ztpc->zoneHeatBalance(zoneNum).SumSysMCp; } else { // no system flow (yet) so just use zone air temperature #5906 results.sumHA += HA; @@ -6012,35 +5554,36 @@ void DetectOscillatingZoneTemp(EnergyPlusData &state) // MaxZoneTempDiff since ManageHVAC keeps shortening the timestep // until that is reached unless it goes to less than the // MinTimeStepSys. + auto &s_ztpc = state.dataZoneTempPredictorCorrector; // first time run allocate arrays and setup output variable - if (state.dataZoneTempPredictorCorrector->SetupOscillationOutputFlag) { - state.dataZoneTempPredictorCorrector->ZoneTempHist.allocate(4, state.dataGlobal->NumOfZones); - state.dataZoneTempPredictorCorrector->ZoneTempHist = 0.0; - state.dataZoneTempPredictorCorrector->ZoneTempOscillate.dimension(state.dataGlobal->NumOfZones, 0.0); - state.dataZoneTempPredictorCorrector->ZoneTempOscillateDuringOccupancy.dimension(state.dataGlobal->NumOfZones, 0.0); - state.dataZoneTempPredictorCorrector->ZoneTempOscillateInDeadband.dimension(state.dataGlobal->NumOfZones, 0.0); + if (s_ztpc->SetupOscillationOutputFlag) { + s_ztpc->ZoneTempHist.allocate(4, state.dataGlobal->NumOfZones); + s_ztpc->ZoneTempHist = 0.0; + s_ztpc->ZoneTempOscillate.dimension(state.dataGlobal->NumOfZones, 0.0); + s_ztpc->ZoneTempOscillateDuringOccupancy.dimension(state.dataGlobal->NumOfZones, 0.0); + s_ztpc->ZoneTempOscillateInDeadband.dimension(state.dataGlobal->NumOfZones, 0.0); // set up zone by zone variables, CurrentModuleObject='Zone' for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { auto &zone = state.dataHeatBal->Zone(iZone); SetupOutputVariable(state, "Zone Oscillating Temperatures Time", Constant::Units::hr, - state.dataZoneTempPredictorCorrector->ZoneTempOscillate(iZone), + s_ztpc->ZoneTempOscillate(iZone), OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, zone.Name); SetupOutputVariable(state, "Zone Oscillating Temperatures During Occupancy Time", Constant::Units::hr, - state.dataZoneTempPredictorCorrector->ZoneTempOscillateDuringOccupancy(iZone), + s_ztpc->ZoneTempOscillateDuringOccupancy(iZone), OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, zone.Name); SetupOutputVariable(state, "Zone Oscillating Temperatures in Deadband Time", Constant::Units::hr, - state.dataZoneTempPredictorCorrector->ZoneTempOscillateInDeadband(iZone), + s_ztpc->ZoneTempOscillateInDeadband(iZone), OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, zone.Name); @@ -6049,21 +5592,21 @@ void DetectOscillatingZoneTemp(EnergyPlusData &state) SetupOutputVariable(state, "Facility Any Zone Oscillating Temperatures Time", Constant::Units::hr, - state.dataZoneTempPredictorCorrector->AnyZoneTempOscillate, + s_ztpc->AnyZoneTempOscillate, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, "Facility"); SetupOutputVariable(state, "Facility Any Zone Oscillating Temperatures During Occupancy Time", Constant::Units::hr, - state.dataZoneTempPredictorCorrector->AnyZoneTempOscillateDuringOccupancy, + s_ztpc->AnyZoneTempOscillateDuringOccupancy, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, "Facility"); SetupOutputVariable(state, "Facility Any Zone Oscillating Temperatures in Deadband Time", Constant::Units::hr, - state.dataZoneTempPredictorCorrector->AnyZoneTempOscillateInDeadband, + s_ztpc->AnyZoneTempOscillateInDeadband, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Sum, "Facility"); @@ -6074,13 +5617,13 @@ void DetectOscillatingZoneTemp(EnergyPlusData &state) ReportingThisVariable(state, "Facility Any Zone Oscillating Temperatures Time") || ReportingThisVariable(state, "Facility Any Zone Oscillating Temperatures During Occupancy Time") || ReportingThisVariable(state, "Facility Any Zone Oscillating Temperatures in Deadband Time")) { - state.dataZoneTempPredictorCorrector->OscillationVariablesNeeded = true; + s_ztpc->OscillationVariablesNeeded = true; } - state.dataZoneTempPredictorCorrector->SetupOscillationOutputFlag = false; + s_ztpc->SetupOscillationOutputFlag = false; } Real64 TimeStepSys = state.dataHVACGlobal->TimeStepSys; - if (state.dataZoneTempPredictorCorrector->OscillationVariablesNeeded) { + if (s_ztpc->OscillationVariablesNeeded) { // precalc the negative value for performance Real64 NegOscillateMagnitude = -HVAC::OscillateMagnitude; // assume no zone is oscillating @@ -6090,16 +5633,13 @@ void DetectOscillatingZoneTemp(EnergyPlusData &state) for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { bool isOscillate = false; - state.dataZoneTempPredictorCorrector->ZoneTempHist(4, iZone) = state.dataZoneTempPredictorCorrector->ZoneTempHist(3, iZone); - state.dataZoneTempPredictorCorrector->ZoneTempHist(3, iZone) = state.dataZoneTempPredictorCorrector->ZoneTempHist(2, iZone); - state.dataZoneTempPredictorCorrector->ZoneTempHist(2, iZone) = state.dataZoneTempPredictorCorrector->ZoneTempHist(1, iZone); - state.dataZoneTempPredictorCorrector->ZoneTempHist(1, iZone) = state.dataZoneTempPredictorCorrector->zoneHeatBalance(iZone).ZT; - Real64 Diff34 = - state.dataZoneTempPredictorCorrector->ZoneTempHist(3, iZone) - state.dataZoneTempPredictorCorrector->ZoneTempHist(4, iZone); - Real64 Diff23 = - state.dataZoneTempPredictorCorrector->ZoneTempHist(2, iZone) - state.dataZoneTempPredictorCorrector->ZoneTempHist(3, iZone); - Real64 Diff12 = - state.dataZoneTempPredictorCorrector->ZoneTempHist(1, iZone) - state.dataZoneTempPredictorCorrector->ZoneTempHist(2, iZone); + s_ztpc->ZoneTempHist(4, iZone) = s_ztpc->ZoneTempHist(3, iZone); + s_ztpc->ZoneTempHist(3, iZone) = s_ztpc->ZoneTempHist(2, iZone); + s_ztpc->ZoneTempHist(2, iZone) = s_ztpc->ZoneTempHist(1, iZone); + s_ztpc->ZoneTempHist(1, iZone) = s_ztpc->zoneHeatBalance(iZone).ZT; + Real64 Diff34 = s_ztpc->ZoneTempHist(3, iZone) - s_ztpc->ZoneTempHist(4, iZone); + Real64 Diff23 = s_ztpc->ZoneTempHist(2, iZone) - s_ztpc->ZoneTempHist(3, iZone); + Real64 Diff12 = s_ztpc->ZoneTempHist(1, iZone) - s_ztpc->ZoneTempHist(2, iZone); // roll out the conditionals for increased performance if (Diff12 > HVAC::OscillateMagnitude) { if (Diff23 < NegOscillateMagnitude) { @@ -6116,36 +5656,34 @@ void DetectOscillatingZoneTemp(EnergyPlusData &state) } } } - state.dataZoneTempPredictorCorrector->ZoneTempOscillateDuringOccupancy(iZone) = 0.0; - state.dataZoneTempPredictorCorrector->ZoneTempOscillateInDeadband(iZone) = 0.0; + s_ztpc->ZoneTempOscillateDuringOccupancy(iZone) = 0.0; + s_ztpc->ZoneTempOscillateInDeadband(iZone) = 0.0; if (isOscillate) { - state.dataZoneTempPredictorCorrector->ZoneTempOscillate(iZone) = TimeStepSys; + s_ztpc->ZoneTempOscillate(iZone) = TimeStepSys; isAnyZoneOscillating = true; if (allocated(state.dataThermalComforts->ThermalComfortInASH55)) { if (state.dataThermalComforts->ThermalComfortInASH55(iZone).ZoneIsOccupied) { - state.dataZoneTempPredictorCorrector->ZoneTempOscillateDuringOccupancy(iZone) = TimeStepSys; + s_ztpc->ZoneTempOscillateDuringOccupancy(iZone) = TimeStepSys; isAnyZoneOscillatingDuringOccupancy = true; } } if (state.dataZoneEnergyDemand->CurDeadBandOrSetback(iZone)) { - state.dataZoneTempPredictorCorrector->ZoneTempOscillateInDeadband(iZone) = TimeStepSys; + s_ztpc->ZoneTempOscillateInDeadband(iZone) = TimeStepSys; isAnyZoneOscillatingInDeadband = true; } } else { - state.dataZoneTempPredictorCorrector->ZoneTempOscillate(iZone) = 0.0; + s_ztpc->ZoneTempOscillate(iZone) = 0.0; } } // any zone variable - state.dataZoneTempPredictorCorrector->AnyZoneTempOscillate = (isAnyZoneOscillating) ? TimeStepSys : 0.0; - state.dataZoneTempPredictorCorrector->AnyZoneTempOscillateDuringOccupancy = (isAnyZoneOscillatingDuringOccupancy) ? TimeStepSys : 0.0; - state.dataZoneTempPredictorCorrector->AnyZoneTempOscillateInDeadband = (isAnyZoneOscillatingInDeadband) ? TimeStepSys : 0.0; + s_ztpc->AnyZoneTempOscillate = (isAnyZoneOscillating) ? TimeStepSys : 0.0; + s_ztpc->AnyZoneTempOscillateDuringOccupancy = (isAnyZoneOscillatingDuringOccupancy) ? TimeStepSys : 0.0; + s_ztpc->AnyZoneTempOscillateInDeadband = (isAnyZoneOscillatingInDeadband) ? TimeStepSys : 0.0; // annual/runperiod sum for _perflog.csv file - state.dataZoneTempPredictorCorrector->AnnualAnyZoneTempOscillate += state.dataZoneTempPredictorCorrector->AnyZoneTempOscillate; - state.dataZoneTempPredictorCorrector->AnnualAnyZoneTempOscillateDuringOccupancy += - state.dataZoneTempPredictorCorrector->AnyZoneTempOscillateDuringOccupancy; - state.dataZoneTempPredictorCorrector->AnnualAnyZoneTempOscillateInDeadband += - state.dataZoneTempPredictorCorrector->AnyZoneTempOscillateInDeadband; + s_ztpc->AnnualAnyZoneTempOscillate += s_ztpc->AnyZoneTempOscillate; + s_ztpc->AnnualAnyZoneTempOscillateDuringOccupancy += s_ztpc->AnyZoneTempOscillateDuringOccupancy; + s_ztpc->AnnualAnyZoneTempOscillateInDeadband += s_ztpc->AnyZoneTempOscillateInDeadband; } } @@ -6160,6 +5698,7 @@ void AdjustAirSetPointsforOpTempCntrl(EnergyPlusData &state, int const TempContr // This subroutine modifies the air temperature setpoint to effect operative temperature control // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + auto &s_ztpc = state.dataZoneTempPredictorCorrector; Real64 thisMRTFraction; // local variable for fraction that MRT is in Op Temp definition if (!(state.dataZoneCtrls->AnyOpTempControl)) return; // do nothing to setpoint @@ -6168,12 +5707,11 @@ void AdjustAirSetPointsforOpTempCntrl(EnergyPlusData &state, int const TempContr if (!(tempControlledZone.OperativeTempControl)) return; // do nothing to setpoint // is operative temp radiative fraction scheduled or fixed? - thisMRTFraction = (tempControlledZone.OpTempCntrlModeScheduled) - ? ScheduleManager::GetCurrentScheduleValue(state, tempControlledZone.OpTempRadiativeFractionSched) - : tempControlledZone.FixedRadiativeFraction; + thisMRTFraction = (tempControlledZone.OpTempCntrlModeScheduled) ? tempControlledZone.opTempRadiativeFractionSched->getCurrentVal() + : tempControlledZone.FixedRadiativeFraction; // get mean radiant temperature for zone - Real64 thisMRT = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ActualZoneNum).MRT; + Real64 thisMRT = s_ztpc->zoneHeatBalance(ActualZoneNum).MRT; // modify setpoint for operative temperature control // trapping for MRT fractions between 0.0 and 0.9 during get input, so shouldn't be able to divide by zero here. @@ -6189,8 +5727,9 @@ void AdjustOperativeSetPointsforAdapComfort(EnergyPlusData &state, int const Tem // PURPOSE OF THIS SUBROUTINE: // This routine adjust the operative setpoints for each controlled adaptive thermal comfort models. - auto &tempControlledZone = state.dataZoneCtrls->TempControlledZone(TempControlledZoneID); - auto const &AdapComfortDailySetPointSchedule = state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule; + auto &s_ztpc = state.dataZoneTempPredictorCorrector; + auto const &tempControlledZone = state.dataZoneCtrls->TempControlledZone(TempControlledZoneID); + auto const &AdapComfortDailySetPointSchedule = s_ztpc->AdapComfortDailySetPointSchedule; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int originZoneAirSetPoint = ZoneAirSetPoint; @@ -6231,7 +5770,7 @@ void AdjustOperativeSetPointsforAdapComfort(EnergyPlusData &state, int const Tem int constexpr summerDesignDayTypeIndex(9); // Adjust summer design day set point if (state.dataWeather->DesDayInput(envrnDayNum).DayType == summerDesignDayTypeIndex) { - ZoneAirSetPoint = state.dataZoneTempPredictorCorrector->AdapComfortSetPointSummerDesDay[AdaptiveComfortModelTypeIndex - 2]; + ZoneAirSetPoint = s_ztpc->AdapComfortSetPointSummerDesDay[AdaptiveComfortModelTypeIndex - 2]; } } // If adaptive operative temperature not applicable, set back @@ -6252,7 +5791,7 @@ void CalcZoneAirComfortSetPoints(EnergyPlusData &state) // DATE WRITTEN May 2006 // PURPOSE OF THIS SUBROUTINE: - // This routine sets the thermal comfort setpoints for each controlled zone based on air tempeature obtained from thermal comfort models. + // This routine sets the thermal comfort setpoints for each controlled zone based on air temperature obtained from thermal comfort models. // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 SetPointLo = 0.0; @@ -6260,78 +5799,63 @@ void CalcZoneAirComfortSetPoints(EnergyPlusData &state) Real64 Tset = 0.0; int ObjectCount = 0; Real64 PeopleCount = 0.0; - int SetPointComfortSchedIndex = 0; - int SchedTypeIndex = 0; - int PeopleNum; + auto &s_ztpc = state.dataZoneTempPredictorCorrector; + auto &s_hbfs = state.dataHeatBalFanSys; // Call thermal comfort module to read zone control comfort object - if (state.dataZoneTempPredictorCorrector->CalcZoneAirComfortSetPointsFirstTimeFlag) { + if (s_ztpc->CalcZoneAirComfortSetPointsFirstTimeFlag) { ThermalComfort::ManageThermalComfort(state, true); - state.dataZoneTempPredictorCorrector->CalcZoneAirComfortSetPointsFirstTimeFlag = false; + s_ztpc->CalcZoneAirComfortSetPointsFirstTimeFlag = false; } - state.dataHeatBalFanSys->ComfortControlType = HVAC::ThermostatType::Uncontrolled; // Default + s_hbfs->ComfortControlType = HVAC::SetptType::Uncontrolled; // Default for (int RelativeZoneNum = 1; RelativeZoneNum <= state.dataZoneCtrls->NumComfortControlledZones; ++RelativeZoneNum) { - auto &comfortControlledZone = state.dataZoneCtrls->ComfortControlledZone(RelativeZoneNum); - int ActualZoneNum = comfortControlledZone.ActualZoneNum; + auto &comfortZone = state.dataZoneCtrls->ComfortControlledZone(RelativeZoneNum); + int ActualZoneNum = comfortZone.ActualZoneNum; auto &zone = state.dataHeatBal->Zone(ActualZoneNum); - auto &comfortControlType = state.dataHeatBalFanSys->ComfortControlType(ActualZoneNum); - auto &comfortControlTypeRpt = state.dataHeatBalFanSys->ComfortControlTypeRpt(ActualZoneNum); - auto &tempZoneThermostatSetPoint = state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ActualZoneNum); + auto &zoneTstatSetpt = state.dataHeatBalFanSys->zoneTstatSetpts(ActualZoneNum); auto &zoneComfortControlsFanger = state.dataHeatBalFanSys->ZoneComfortControlsFanger(ActualZoneNum); - comfortControlType = - static_cast(ScheduleManager::GetCurrentScheduleValue(state, comfortControlledZone.ComfortSchedIndex)); - comfortControlTypeRpt = static_cast(comfortControlType); + s_hbfs->ComfortControlType(ActualZoneNum) = static_cast(comfortZone.setptTypeSched->getCurrentVal()); + s_hbfs->ComfortControlTypeRpt(ActualZoneNum) = (int)s_hbfs->ComfortControlType(ActualZoneNum); // Get PMV values - switch (comfortControlType) { - case HVAC::ThermostatType::Uncontrolled: + switch (s_hbfs->ComfortControlType(ActualZoneNum)) { + case HVAC::SetptType::Uncontrolled: { zoneComfortControlsFanger.LowPMV = -999.0; zoneComfortControlsFanger.HighPMV = -999.0; - break; - case HVAC::ThermostatType::SingleHeating: - zoneComfortControlsFanger.FangerType = static_cast(HVAC::ThermostatType::SingleHeating); - zoneComfortControlsFanger.LowPMV = ScheduleManager::GetCurrentScheduleValue( - state, - state.dataZoneTempPredictorCorrector - ->SetPointSingleHeatingFanger(comfortControlledZone.ControlTypeSchIndx(comfortControlledZone.SchIndx_SingleHeating)) - .PMVSchedIndex); + } break; + + case HVAC::SetptType::SingleHeat: { + zoneComfortControlsFanger.FangerType = (int)HVAC::SetptType::SingleHeat; + zoneComfortControlsFanger.LowPMV = comfortZone.setpts[(int)HVAC::SetptType::SingleHeat].heatSetptSched->getCurrentVal(); zoneComfortControlsFanger.HighPMV = -999.0; - break; - case HVAC::ThermostatType::SingleCooling: - zoneComfortControlsFanger.FangerType = static_cast(HVAC::ThermostatType::SingleCooling); + } break; + + case HVAC::SetptType::SingleCool: { + zoneComfortControlsFanger.FangerType = (int)HVAC::SetptType::SingleCool; zoneComfortControlsFanger.LowPMV = -999.0; - zoneComfortControlsFanger.HighPMV = ScheduleManager::GetCurrentScheduleValue( - state, - state.dataZoneTempPredictorCorrector - ->SetPointSingleCoolingFanger(comfortControlledZone.ControlTypeSchIndx(comfortControlledZone.SchIndx_SingleCooling)) - .PMVSchedIndex); - break; - case HVAC::ThermostatType::SingleHeatCool: - SetPointComfortSchedIndex = - state.dataZoneTempPredictorCorrector - ->SetPointSingleHeatCoolFanger(comfortControlledZone.ControlTypeSchIndx(comfortControlledZone.SchIndx_SingleHeatCool)) - .PMVSchedIndex; - zoneComfortControlsFanger.FangerType = static_cast(HVAC::ThermostatType::SingleHeatCool); - zoneComfortControlsFanger.LowPMV = ScheduleManager::GetCurrentScheduleValue(state, SetPointComfortSchedIndex); - zoneComfortControlsFanger.HighPMV = ScheduleManager::GetCurrentScheduleValue(state, SetPointComfortSchedIndex); - break; - case HVAC::ThermostatType::DualSetPointWithDeadBand: - SchedTypeIndex = comfortControlledZone.ControlTypeSchIndx(comfortControlledZone.SchIndx_DualSetPointWithDeadBand); - zoneComfortControlsFanger.FangerType = static_cast(HVAC::ThermostatType::DualSetPointWithDeadBand); - zoneComfortControlsFanger.LowPMV = ScheduleManager::GetCurrentScheduleValue( - state, state.dataZoneTempPredictorCorrector->SetPointDualHeatCoolFanger(SchedTypeIndex).HeatPMVSchedIndex); - zoneComfortControlsFanger.HighPMV = ScheduleManager::GetCurrentScheduleValue( - state, state.dataZoneTempPredictorCorrector->SetPointDualHeatCoolFanger(SchedTypeIndex).CoolPMVSchedIndex); + zoneComfortControlsFanger.HighPMV = comfortZone.setpts[(int)HVAC::SetptType::SingleCool].coolSetptSched->getCurrentVal(); + } break; + + case HVAC::SetptType::SingleHeatCool: { + zoneComfortControlsFanger.FangerType = (int)HVAC::SetptType::SingleHeatCool; + zoneComfortControlsFanger.LowPMV = zoneComfortControlsFanger.HighPMV = + comfortZone.setpts[(int)HVAC::SetptType::SingleHeatCool].coolSetptSched->getCurrentVal(); + } break; + + case HVAC::SetptType::DualHeatCool: { + zoneComfortControlsFanger.FangerType = (int)HVAC::SetptType::DualHeatCool; + zoneComfortControlsFanger.LowPMV = comfortZone.setpts[(int)HVAC::SetptType::DualHeatCool].heatSetptSched->getCurrentVal(); + zoneComfortControlsFanger.HighPMV = comfortZone.setpts[(int)HVAC::SetptType::DualHeatCool].coolSetptSched->getCurrentVal(); if (zoneComfortControlsFanger.LowPMV > zoneComfortControlsFanger.HighPMV) { ++zoneComfortControlsFanger.DualPMVErrCount; if (zoneComfortControlsFanger.DualPMVErrCount < 2) { ShowWarningError(state, format("ThermostatSetpoint:ThermalComfort:Fanger:DualSetpoint: The heating PMV setpoint is above the " "cooling PMV setpoint in {}", - state.dataZoneTempPredictorCorrector->SetPointDualHeatCoolFanger(SchedTypeIndex).Name)); + comfortZone.setpts[(int)HVAC::SetptType::DualHeatCool].Name)); ShowContinueError(state, "The zone dual heating PMV setpoint is set to the dual cooling PMV setpoint."); ShowContinueErrorTimeStamp(state, "Occurrence info:"); } else { @@ -6343,39 +5867,42 @@ void CalcZoneAirComfortSetPoints(EnergyPlusData &state) } zoneComfortControlsFanger.LowPMV = zoneComfortControlsFanger.HighPMV; } - break; - default: + } break; + + default: { ShowSevereError(state, format("CalcZoneAirTempSetpoints: Illegal thermal control control type for Zone={}, Found value={}, in Schedule={}", zone.Name, - comfortControlTypeRpt, - comfortControlledZone.ControlTypeSchedName)); - break; - } + s_hbfs->ComfortControlTypeRpt(ActualZoneNum), + comfortZone.setptTypeSched->Name)); + } break; + } // switch // Check Average method - switch (comfortControlledZone.AverageMethod) { - case DataZoneControls::AverageMethod::NO: - PeopleNum = comfortControlledZone.SpecificObjectNum; - if (comfortControlType == HVAC::ThermostatType::SingleCooling) { + switch (comfortZone.AverageMethod) { + case DataZoneControls::AverageMethod::NO: { + int PeopleNum = comfortZone.SpecificObjectNum; + if (s_hbfs->ComfortControlType(ActualZoneNum) == HVAC::SetptType::SingleCool) { GetComfortSetPoints(state, PeopleNum, RelativeZoneNum, zoneComfortControlsFanger.HighPMV, SetPointLo); } else { GetComfortSetPoints(state, PeopleNum, RelativeZoneNum, zoneComfortControlsFanger.LowPMV, SetPointLo); } - if (comfortControlType == HVAC::ThermostatType::DualSetPointWithDeadBand) + if (s_hbfs->ComfortControlType(ActualZoneNum) == HVAC::SetptType::DualHeatCool) GetComfortSetPoints(state, PeopleNum, RelativeZoneNum, zoneComfortControlsFanger.HighPMV, SetPointHi); - break; - case DataZoneControls::AverageMethod::SPE: - PeopleNum = comfortControlledZone.SpecificObjectNum; - if (comfortControlType == HVAC::ThermostatType::SingleCooling) { + } break; + + case DataZoneControls::AverageMethod::SPE: { + int PeopleNum = comfortZone.SpecificObjectNum; + if (s_hbfs->ComfortControlType(ActualZoneNum) == HVAC::SetptType::SingleCool) { GetComfortSetPoints(state, PeopleNum, RelativeZoneNum, zoneComfortControlsFanger.HighPMV, SetPointLo); } else { GetComfortSetPoints(state, PeopleNum, RelativeZoneNum, zoneComfortControlsFanger.LowPMV, SetPointLo); } - if (comfortControlType == HVAC::ThermostatType::DualSetPointWithDeadBand) + if (s_hbfs->ComfortControlType(ActualZoneNum) == HVAC::SetptType::DualHeatCool) GetComfortSetPoints(state, PeopleNum, RelativeZoneNum, zoneComfortControlsFanger.HighPMV, SetPointHi); - break; - case DataZoneControls::AverageMethod::OBJ: + } break; + + case DataZoneControls::AverageMethod::OBJ: { SetPointLo = 0.0; SetPointHi = 0.0; for (int peopleNum = 1; peopleNum <= state.dataHeatBal->TotPeople; ++peopleNum) { @@ -6383,36 +5910,39 @@ void CalcZoneAirComfortSetPoints(EnergyPlusData &state) ++ObjectCount; GetComfortSetPoints(state, peopleNum, RelativeZoneNum, zoneComfortControlsFanger.LowPMV, Tset); SetPointLo += Tset; - if (comfortControlType == HVAC::ThermostatType::DualSetPointWithDeadBand) { + + if (s_hbfs->ComfortControlType(ActualZoneNum) == HVAC::SetptType::DualHeatCool) { GetComfortSetPoints(state, peopleNum, RelativeZoneNum, zoneComfortControlsFanger.HighPMV, Tset); SetPointHi += Tset; } } } SetPointLo /= ObjectCount; - if (comfortControlType == HVAC::ThermostatType::DualSetPointWithDeadBand) SetPointHi /= ObjectCount; - break; - case DataZoneControls::AverageMethod::PEO: + if (s_hbfs->ComfortControlType(ActualZoneNum) == HVAC::SetptType::DualHeatCool) SetPointHi /= ObjectCount; + } break; + + case DataZoneControls::AverageMethod::PEO: { SetPointLo = 0.0; SetPointHi = 0.0; - for (int peopleNum = 1; peopleNum <= state.dataHeatBal->TotPeople; ++peopleNum) { - if (ActualZoneNum == state.dataHeatBal->People(peopleNum).ZonePtr) { - int NumberOccupants = state.dataHeatBal->People(peopleNum).NumberOfPeople * - ScheduleManager::GetCurrentScheduleValue(state, state.dataHeatBal->People(peopleNum).NumberOfPeoplePtr); + + for (int PeopleNum = 1; PeopleNum <= state.dataHeatBal->TotPeople; ++PeopleNum) { + auto &people = state.dataHeatBal->People(PeopleNum); + if (ActualZoneNum == people.ZonePtr) { + int NumberOccupants = people.NumberOfPeople * people.sched->getCurrentVal(); PeopleCount += NumberOccupants; - GetComfortSetPoints(state, peopleNum, RelativeZoneNum, zoneComfortControlsFanger.LowPMV, Tset); + GetComfortSetPoints(state, PeopleNum, RelativeZoneNum, zoneComfortControlsFanger.LowPMV, Tset); SetPointLo += Tset * NumberOccupants; - if (comfortControlType == HVAC::ThermostatType::DualSetPointWithDeadBand) { - GetComfortSetPoints(state, peopleNum, RelativeZoneNum, zoneComfortControlsFanger.HighPMV, Tset); + if (s_hbfs->ComfortControlType(ActualZoneNum) == HVAC::SetptType::DualHeatCool) { + GetComfortSetPoints(state, PeopleNum, RelativeZoneNum, zoneComfortControlsFanger.HighPMV, Tset); SetPointHi += Tset * NumberOccupants; } } } if (PeopleCount > 0) { SetPointLo /= PeopleCount; - if (comfortControlType == HVAC::ThermostatType::DualSetPointWithDeadBand) SetPointHi /= PeopleCount; + if (s_hbfs->ComfortControlType(ActualZoneNum) == HVAC::SetptType::DualHeatCool) SetPointHi /= PeopleCount; } else { - if (comfortControlledZone.PeopleAverageErrIndex == 0) { + if (comfortZone.PeopleAverageErrIndex == 0) { ShowWarningMessage(state, format("ZoneControl:Thermostat:ThermalComfort: The total number of people in Zone = {} is zero. The People " "Average option is not used.", @@ -6423,7 +5953,7 @@ void CalcZoneAirComfortSetPoints(EnergyPlusData &state) ShowRecurringWarningErrorAtEnd(state, "ZoneControl:Thermostat:ThermalComfort: The total number of people in Zone = " + zone.Name + " is still zero. The People Average option is not used", - comfortControlledZone.PeopleAverageErrIndex, + comfortZone.PeopleAverageErrIndex, PeopleCount, PeopleCount); SetPointLo = 0.0; @@ -6433,92 +5963,97 @@ void CalcZoneAirComfortSetPoints(EnergyPlusData &state) ++ObjectCount; GetComfortSetPoints(state, peopleNum, RelativeZoneNum, zoneComfortControlsFanger.LowPMV, Tset); SetPointLo += Tset; - if (comfortControlType == HVAC::ThermostatType::DualSetPointWithDeadBand) { + if (s_hbfs->ComfortControlType(ActualZoneNum) == HVAC::SetptType::DualHeatCool) { GetComfortSetPoints(state, peopleNum, RelativeZoneNum, zoneComfortControlsFanger.HighPMV, Tset); SetPointHi += Tset; } } } SetPointLo /= ObjectCount; - if (comfortControlType == HVAC::ThermostatType::DualSetPointWithDeadBand) SetPointHi /= ObjectCount; + if (s_hbfs->ComfortControlType(ActualZoneNum) == HVAC::SetptType::DualHeatCool) SetPointHi /= ObjectCount; } - break; - default: - break; - } + } break; + + default: { + } break; + } // switch // Assign setpoint - switch (comfortControlType) { - case HVAC::ThermostatType::Uncontrolled: + switch (s_hbfs->ComfortControlType(ActualZoneNum)) { + + case HVAC::SetptType::Uncontrolled: { switch (state.dataHeatBalFanSys->TempControlType(ActualZoneNum)) { - case HVAC::ThermostatType::SingleHeating: - state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ActualZoneNum) = 0.0; + case HVAC::SetptType::SingleHeat: + zoneTstatSetpt.setptHi = 0.0; break; - case HVAC::ThermostatType::SingleCooling: - state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ActualZoneNum) = 0.0; + case HVAC::SetptType::SingleCool: + zoneTstatSetpt.setptLo = 0.0; break; default: break; } - break; - case HVAC::ThermostatType::SingleHeating: - if (SetPointLo < comfortControlledZone.TdbMinSetPoint) { - SetPointLo = comfortControlledZone.TdbMinSetPoint; - if (comfortControlledZone.TdbMinErrIndex < 2) { + } break; + + case HVAC::SetptType::SingleHeat: { + if (SetPointLo < comfortZone.TdbMinSetPoint) { + SetPointLo = comfortZone.TdbMinSetPoint; + if (comfortZone.TdbMinErrIndex < 2) { ShowWarningMessage(state, format("ThermostatSetpoint:ThermalComfort:Fanger:SingleHeating temperature is below the Minimum dry-bulb " "temperature setpoint {}", - comfortControlledZone.Name)); + comfortZone.Name)); ShowContinueError(state, "The zone heating setpoint is set to the Minimum dry-bulb temperature setpoint"); ShowContinueErrorTimeStamp(state, "Occurrence info:"); } ShowRecurringWarningErrorAtEnd(state, "ThermostatSetpoint:ThermalComfort:Fanger:SingleHeating temperature is still below the " "Minimum dry-bulb temperature setpoint ...", - comfortControlledZone.TdbMinErrIndex, + comfortZone.TdbMinErrIndex, SetPointLo, SetPointLo); } - tempZoneThermostatSetPoint = SetPointLo; - state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ActualZoneNum) = tempZoneThermostatSetPoint; - state.dataHeatBalFanSys->TempControlType(ActualZoneNum) = HVAC::ThermostatType::SingleHeating; + zoneTstatSetpt.setpt = SetPointLo; + zoneTstatSetpt.setptLo = zoneTstatSetpt.setpt; + state.dataHeatBalFanSys->TempControlType(ActualZoneNum) = HVAC::SetptType::SingleHeat; state.dataHeatBalFanSys->TempControlTypeRpt(ActualZoneNum) = static_cast(state.dataHeatBalFanSys->TempControlType(ActualZoneNum)); - break; - case HVAC::ThermostatType::SingleCooling: - if (SetPointLo > comfortControlledZone.TdbMaxSetPoint) { - SetPointLo = comfortControlledZone.TdbMaxSetPoint; - if (comfortControlledZone.TdbMaxErrIndex == 0) { + } break; + + case HVAC::SetptType::SingleCool: { + if (SetPointLo > comfortZone.TdbMaxSetPoint) { + SetPointLo = comfortZone.TdbMaxSetPoint; + if (comfortZone.TdbMaxErrIndex == 0) { ShowWarningMessage(state, format("ThermostatSetpoint:ThermalComfort:Fanger:SingleCooling temperature is above the Maximum dry-bulb " "temperature setpoint {}", - comfortControlledZone.Name)); + comfortZone.Name)); ShowContinueError(state, "The zone cooling setpoint is set to the Maximum dry-bulb temperature setpoint"); ShowContinueErrorTimeStamp(state, "Occurrence info:"); } ShowRecurringWarningErrorAtEnd(state, "ThermostatSetpoint:ThermalComfort:Fanger:SingleCooling temperature is still above the " "Maximum dry-bulb temperature setpoint ...", - comfortControlledZone.TdbMaxErrIndex, + comfortZone.TdbMaxErrIndex, SetPointLo, SetPointLo); } - tempZoneThermostatSetPoint = SetPointLo; - state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ActualZoneNum) = tempZoneThermostatSetPoint; - state.dataHeatBalFanSys->TempControlType(ActualZoneNum) = HVAC::ThermostatType::SingleCooling; + zoneTstatSetpt.setpt = SetPointLo; + zoneTstatSetpt.setptHi = zoneTstatSetpt.setpt; + state.dataHeatBalFanSys->TempControlType(ActualZoneNum) = HVAC::SetptType::SingleCool; state.dataHeatBalFanSys->TempControlTypeRpt(ActualZoneNum) = static_cast(state.dataHeatBalFanSys->TempControlType(ActualZoneNum)); - break; - case HVAC::ThermostatType::SingleHeatCool: - if (comfortControlledZone.TdbMaxSetPoint == comfortControlledZone.TdbMinSetPoint) { - SetPointLo = comfortControlledZone.TdbMaxSetPoint; - } - if (SetPointLo > comfortControlledZone.TdbMaxSetPoint) SetPointLo = comfortControlledZone.TdbMaxSetPoint; - if (SetPointLo < comfortControlledZone.TdbMinSetPoint) SetPointLo = comfortControlledZone.TdbMinSetPoint; - if (SetPointLo < comfortControlledZone.TdbMinSetPoint || SetPointLo > comfortControlledZone.TdbMaxSetPoint) { - if (comfortControlledZone.TdbHCErrIndex == 0) { + } break; + + case HVAC::SetptType::SingleHeatCool: { + if (comfortZone.TdbMaxSetPoint == comfortZone.TdbMinSetPoint) { + SetPointLo = comfortZone.TdbMaxSetPoint; + } + if (SetPointLo > comfortZone.TdbMaxSetPoint) SetPointLo = comfortZone.TdbMaxSetPoint; + if (SetPointLo < comfortZone.TdbMinSetPoint) SetPointLo = comfortZone.TdbMinSetPoint; + if (SetPointLo < comfortZone.TdbMinSetPoint || SetPointLo > comfortZone.TdbMaxSetPoint) { + if (comfortZone.TdbHCErrIndex == 0) { ShowWarningMessage(state, format("ThermostatSetpoint:ThermalComfort:Fanger:SingleHeatingOrCooling temperature is above the Maximum or " "below the Minimum dry-bulb temperature setpoint {}", - comfortControlledZone.Name)); + comfortZone.Name)); ShowContinueError(state, "The zone setpoint is set to the Maximum dry-bulb temperature setpoint if above or the Minimum " "dry-bulb temperature setpoint if below"); @@ -6527,67 +6062,70 @@ void CalcZoneAirComfortSetPoints(EnergyPlusData &state) ShowRecurringWarningErrorAtEnd(state, "ThermostatSetpoint:ThermalComfort:Fanger:SingleHeatingOrCooling temperature is still beyond " "the range between Maximum and Minimum dry-bulb temperature setpoint ...", - comfortControlledZone.TdbHCErrIndex, + comfortZone.TdbHCErrIndex, SetPointLo, SetPointLo); } - tempZoneThermostatSetPoint = SetPointLo; - state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ActualZoneNum) = tempZoneThermostatSetPoint; - state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ActualZoneNum) = tempZoneThermostatSetPoint; - state.dataHeatBalFanSys->TempControlType(ActualZoneNum) = HVAC::ThermostatType::SingleHeatCool; + + zoneTstatSetpt.setpt = SetPointLo; + zoneTstatSetpt.setptHi = zoneTstatSetpt.setptLo = zoneTstatSetpt.setpt; + state.dataHeatBalFanSys->TempControlType(ActualZoneNum) = HVAC::SetptType::SingleHeatCool; state.dataHeatBalFanSys->TempControlTypeRpt(ActualZoneNum) = static_cast(state.dataHeatBalFanSys->TempControlType(ActualZoneNum)); - break; - case HVAC::ThermostatType::DualSetPointWithDeadBand: - if (SetPointLo < comfortControlledZone.TdbMinSetPoint) { - SetPointLo = comfortControlledZone.TdbMinSetPoint; + } break; + + case HVAC::SetptType::DualHeatCool: { + if (SetPointLo < comfortZone.TdbMinSetPoint) { + SetPointLo = comfortZone.TdbMinSetPoint; - if (comfortControlledZone.TdbDualMinErrIndex == 0) { + if (comfortZone.TdbDualMinErrIndex == 0) { ShowWarningMessage(state, format("ThermostatSetpoint:ThermalComfort:Fanger:DualSetpoint temperature is below the Minimum dry-bulb " "temperature setpoint {}", - comfortControlledZone.Name)); + comfortZone.Name)); ShowContinueError(state, "The zone dual heating setpoint is set to the Minimum dry-bulb temperature setpoint"); ShowContinueErrorTimeStamp(state, "Occurrence info:"); } ShowRecurringWarningErrorAtEnd(state, "ThermostatSetpoint:ThermalComfort:Fanger:DualSetpoint temperature is still below the Minimum " "dry-bulb temperature setpoint ...", - comfortControlledZone.TdbDualMinErrIndex, + comfortZone.TdbDualMinErrIndex, SetPointLo, SetPointLo); } - if (SetPointHi > comfortControlledZone.TdbMaxSetPoint) { - SetPointHi = comfortControlledZone.TdbMaxSetPoint; - if (comfortControlledZone.TdbDualMaxErrIndex == 0) { + if (SetPointHi > comfortZone.TdbMaxSetPoint) { + SetPointHi = comfortZone.TdbMaxSetPoint; + if (comfortZone.TdbDualMaxErrIndex == 0) { ShowWarningMessage(state, format("ThermostatSetpoint:ThermalComfort:Fanger:DualSetpoint temperature is above the Maximum dry-bulb " "temperature setpoint in zone = {}", - comfortControlledZone.Name)); + comfortZone.Name)); ShowContinueError(state, "The zone dual cooling setpoint is set to the Maximum dry-bulb temperature setpoint"); ShowContinueErrorTimeStamp(state, "Occurrence info:"); } ShowRecurringWarningErrorAtEnd(state, "ThermostatSetpoint:ThermalComfort:Fanger:DualSetpoint temperature is still above the Maximum " "dry-bulb temperature setpoint ...", - comfortControlledZone.TdbDualMaxErrIndex, + comfortZone.TdbDualMaxErrIndex, SetPointLo, SetPointLo); } - state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ActualZoneNum) = SetPointLo; - state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ActualZoneNum) = SetPointHi; - state.dataHeatBalFanSys->TempControlType(ActualZoneNum) = HVAC::ThermostatType::DualSetPointWithDeadBand; + zoneTstatSetpt.setptLo = SetPointLo; + zoneTstatSetpt.setptHi = SetPointHi; + state.dataHeatBalFanSys->TempControlType(ActualZoneNum) = HVAC::SetptType::DualHeatCool; state.dataHeatBalFanSys->TempControlTypeRpt(ActualZoneNum) = static_cast(state.dataHeatBalFanSys->TempControlType(ActualZoneNum)); - break; - default: + } break; + + default: { ShowSevereError(state, format("CalcZoneAirComfortSetpoints: Illegal thermal control control type for Zone={}, Found value={}, in Schedule={}", zone.Name, - comfortControlTypeRpt, - comfortControlledZone.ControlTypeSchedName)); - } + s_hbfs->ComfortControlTypeRpt(ActualZoneNum), + comfortZone.setptTypeSched->Name)); + } break; + } // switch () } -} +} // CalcZoneAirComfortSetpoints() void GetComfortSetPoints(EnergyPlusData &state, int const PeopleNum, @@ -6614,6 +6152,8 @@ void GetComfortSetPoints(EnergyPlusData &state, // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 PMVResult = 0.0; // Calculated PMV value + auto &s_ztpc = state.dataZoneTempPredictorCorrector; + auto &comfortControlledZone = state.dataZoneCtrls->ComfortControlledZone(ComfortControlNum); Real64 Tmin = comfortControlledZone.TdbMinSetPoint; Real64 Tmax = comfortControlledZone.TdbMaxSetPoint; @@ -6634,8 +6174,8 @@ void GetComfortSetPoints(EnergyPlusData &state, General::SolveRoot(state, Acc, MaxIter, SolFla, Tset, f, Tmin, Tmax); if (SolFla == -1) { if (!state.dataGlobal->WarmupFlag) { - ++state.dataZoneTempPredictorCorrector->IterLimitExceededNum1; - if (state.dataZoneTempPredictorCorrector->IterLimitExceededNum1 == 1) { + ++s_ztpc->IterLimitExceededNum1; + if (s_ztpc->IterLimitExceededNum1 == 1) { ShowWarningError( state, format("{}: Iteration limit exceeded calculating thermal comfort Fanger setpoint and non-converged setpoint is used", @@ -6643,15 +6183,15 @@ void GetComfortSetPoints(EnergyPlusData &state, } else { ShowRecurringWarningErrorAtEnd(state, comfortControlledZone.Name + ": Iteration limit exceeded calculating thermal comfort setpoint.", - state.dataZoneTempPredictorCorrector->IterLimitErrIndex1, + s_ztpc->IterLimitErrIndex1, Tset, Tset); } } } else if (SolFla == -2) { if (!state.dataGlobal->WarmupFlag) { - ++state.dataZoneTempPredictorCorrector->IterLimitExceededNum2; - if (state.dataZoneTempPredictorCorrector->IterLimitExceededNum2 == 1) { + ++s_ztpc->IterLimitExceededNum2; + if (s_ztpc->IterLimitExceededNum2 == 1) { ShowWarningError( state, format("{}: Solution is not found in calculating thermal comfort Fanger setpoint and the minimum setpoint is used", @@ -6660,7 +6200,7 @@ void GetComfortSetPoints(EnergyPlusData &state, ShowRecurringWarningErrorAtEnd( state, format("{}: Solution is not found in calculating thermal comfort Fanger setpoint.", comfortControlledZone.Name), - state.dataZoneTempPredictorCorrector->IterLimitErrIndex2, + s_ztpc->IterLimitErrIndex2, Tset, Tset); } @@ -6687,31 +6227,32 @@ void AdjustCoolingSetPointforTempAndHumidityControl(EnergyPlusData &state, // Alter the zone air cooling setpoint if the zone air relative humidity value exceeds the the zone dehumidifying relative humidity setpoint. Real64 ZoneOvercoolRange = 0.0; - auto &tempControlledZone = state.dataZoneCtrls->TempControlledZone(TempControlledZoneID); - if (!(state.dataZoneCtrls->AnyZoneTempAndHumidityControl)) return; // do nothing to setpoint - if (!(tempControlledZone.ZoneOvercoolControl)) return; // do nothing to setpoint + auto const &s_ztpc = state.dataZoneTempPredictorCorrector; + auto &tempZone = state.dataZoneCtrls->TempControlledZone(TempControlledZoneID); + auto &zoneTstatSetpt = state.dataHeatBalFanSys->zoneTstatSetpts(ActualZoneNum); - if (tempControlledZone.OvercoolCntrlModeScheduled) { - ZoneOvercoolRange = ScheduleManager::GetCurrentScheduleValue(state, tempControlledZone.ZoneOvercoolRangeSchedIndex); + if (!state.dataZoneCtrls->AnyZoneTempAndHumidityControl) return; // do nothing to setpoint + if (!tempZone.ZoneOvercoolControl) return; // do nothing to setpoint + + if (tempZone.OvercoolCntrlModeScheduled) { + ZoneOvercoolRange = tempZone.zoneOvercoolRangeSched->getCurrentVal(); } else { - ZoneOvercoolRange = tempControlledZone.ZoneOvercoolConstRange; + ZoneOvercoolRange = tempZone.ZoneOvercoolConstRange; } - Real64 ZoneOvercoolControlRatio = tempControlledZone.ZoneOvercoolControlRatio; + Real64 ZoneOvercoolControlRatio = tempZone.ZoneOvercoolControlRatio; // For Dual Setpoint thermostat the overcool range is limited by the temperature difference between cooling and heating setpoints - Real64 MaxAllowedOvercoolRange = - state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ActualZoneNum) - state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ActualZoneNum); + Real64 MaxAllowedOvercoolRange = zoneTstatSetpt.setptHi - zoneTstatSetpt.setptLo; if (MaxAllowedOvercoolRange > 0.0) { ZoneOvercoolRange = min(ZoneOvercoolRange, MaxAllowedOvercoolRange); } // Calculate difference between zone air relative humidity and the dehumidifying setpoint - Real64 RelativeHumidityDiff = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ActualZoneNum).airRelHum - - ScheduleManager::GetCurrentScheduleValue(state, tempControlledZone.DehumidifyingSchedIndex); + Real64 RelativeHumidityDiff = s_ztpc->zoneHeatBalance(ActualZoneNum).airRelHum - tempZone.dehumidifyingSched->getCurrentVal(); if (RelativeHumidityDiff > 0.0 && ZoneOvercoolControlRatio > 0.0) { // proportionally reset the cooling setpoint temperature downward (zone Overcool) ZoneOvercoolRange = min(ZoneOvercoolRange, RelativeHumidityDiff / ZoneOvercoolControlRatio); - state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ActualZoneNum) -= ZoneOvercoolRange; + zoneTstatSetpt.setptHi -= ZoneOvercoolRange; } } @@ -6724,90 +6265,90 @@ void OverrideAirSetPointsforEMSCntrl(EnergyPlusData &state) // PURPOSE OF THIS SUBROUTINE: // This subroutine overrides the air temperature setpoint based on EMS - - auto &ZoneThermostatSetPointLo = state.dataHeatBalFanSys->ZoneThermostatSetPointLo; - auto &ZoneThermostatSetPointHi = state.dataHeatBalFanSys->ZoneThermostatSetPointHi; + auto const &s_hbfs = state.dataHeatBalFanSys; for (int Loop = 1; Loop <= state.dataZoneCtrls->NumTempControlledZones; ++Loop) { - auto const &tempControlledZone = state.dataZoneCtrls->TempControlledZone(Loop); - if (tempControlledZone.EMSOverrideHeatingSetPointOn) { - int ZoneNum = tempControlledZone.ActualZoneNum; + auto const &tempZone = state.dataZoneCtrls->TempControlledZone(Loop); + if (tempZone.EMSOverrideHeatingSetPointOn) { + int ZoneNum = tempZone.ActualZoneNum; + auto &zoneTstatSetpt = s_hbfs->zoneTstatSetpts(ZoneNum); switch (state.dataHeatBalFanSys->TempControlType(ZoneNum)) { - case HVAC::ThermostatType::SingleHeating: - state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ZoneNum) = tempControlledZone.EMSOverrideHeatingSetPointValue; - ZoneThermostatSetPointLo(ZoneNum) = tempControlledZone.EMSOverrideHeatingSetPointValue; - break; - case HVAC::ThermostatType::SingleHeatCool: - state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ZoneNum) = tempControlledZone.EMSOverrideHeatingSetPointValue; - ZoneThermostatSetPointLo(ZoneNum) = tempControlledZone.EMSOverrideHeatingSetPointValue; - break; - case HVAC::ThermostatType::DualSetPointWithDeadBand: - ZoneThermostatSetPointLo(ZoneNum) = tempControlledZone.EMSOverrideHeatingSetPointValue; - break; - default: - break; - } + case HVAC::SetptType::SingleHeat: + case HVAC::SetptType::SingleHeatCool: { + zoneTstatSetpt.setptLo = zoneTstatSetpt.setpt = tempZone.EMSOverrideHeatingSetPointValue; + } break; + + case HVAC::SetptType::DualHeatCool: { + zoneTstatSetpt.setptLo = tempZone.EMSOverrideHeatingSetPointValue; + } break; + + default: { + } break; + } // switch () } - if (tempControlledZone.EMSOverrideCoolingSetPointOn) { - int ZoneNum = tempControlledZone.ActualZoneNum; - switch (state.dataHeatBalFanSys->TempControlType(ZoneNum)) { - case HVAC::ThermostatType::SingleCooling: - state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ZoneNum) = tempControlledZone.EMSOverrideCoolingSetPointValue; - ZoneThermostatSetPointHi(ZoneNum) = tempControlledZone.EMSOverrideCoolingSetPointValue; - break; - case HVAC::ThermostatType::SingleHeatCool: - state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ZoneNum) = tempControlledZone.EMSOverrideCoolingSetPointValue; - ZoneThermostatSetPointHi(ZoneNum) = tempControlledZone.EMSOverrideCoolingSetPointValue; - break; - case HVAC::ThermostatType::DualSetPointWithDeadBand: - ZoneThermostatSetPointHi(ZoneNum) = tempControlledZone.EMSOverrideCoolingSetPointValue; - break; - default: - break; - } + if (tempZone.EMSOverrideCoolingSetPointOn) { + int ZoneNum = tempZone.ActualZoneNum; + auto &zoneTstatSetpt = s_hbfs->zoneTstatSetpts(ZoneNum); + + switch (s_hbfs->TempControlType(ZoneNum)) { + case HVAC::SetptType::SingleCool: + case HVAC::SetptType::SingleHeatCool: { + zoneTstatSetpt.setptHi = zoneTstatSetpt.setpt = tempZone.EMSOverrideCoolingSetPointValue; + } break; + + case HVAC::SetptType::DualHeatCool: { + zoneTstatSetpt.setptHi = tempZone.EMSOverrideCoolingSetPointValue; + } break; + + default: { + } break; + } // switch () } } for (int Loop = 1; Loop <= state.dataZoneCtrls->NumComfortControlledZones; ++Loop) { - auto &comfortControlledZone = state.dataZoneCtrls->ComfortControlledZone(Loop); - if (comfortControlledZone.EMSOverrideHeatingSetPointOn) { - int ZoneNum = comfortControlledZone.ActualZoneNum; - switch (state.dataHeatBalFanSys->ComfortControlType(ZoneNum)) { - case HVAC::ThermostatType::SingleHeating: - state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ZoneNum) = comfortControlledZone.EMSOverrideHeatingSetPointValue; - ZoneThermostatSetPointLo(ZoneNum) = comfortControlledZone.EMSOverrideHeatingSetPointValue; - break; - case HVAC::ThermostatType::SingleHeatCool: - state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ZoneNum) = comfortControlledZone.EMSOverrideHeatingSetPointValue; - ZoneThermostatSetPointLo(ZoneNum) = comfortControlledZone.EMSOverrideHeatingSetPointValue; - break; - case HVAC::ThermostatType::DualSetPointWithDeadBand: - ZoneThermostatSetPointLo(ZoneNum) = comfortControlledZone.EMSOverrideHeatingSetPointValue; - break; - default: - break; - } + auto &comfortZone = state.dataZoneCtrls->ComfortControlledZone(Loop); + if (comfortZone.EMSOverrideHeatingSetPointOn) { + int ZoneNum = comfortZone.ActualZoneNum; + auto &zoneTstatSetpt = s_hbfs->zoneTstatSetpts(ZoneNum); + + switch (s_hbfs->ComfortControlType(ZoneNum)) { + case HVAC::SetptType::SingleHeat: + case HVAC::SetptType::SingleHeatCool: { + zoneTstatSetpt.setptLo = zoneTstatSetpt.setpt = comfortZone.EMSOverrideHeatingSetPointValue; + } break; + + case HVAC::SetptType::DualHeatCool: { + zoneTstatSetpt.setptLo = comfortZone.EMSOverrideHeatingSetPointValue; + } break; + + default: { + } break; + + } // switch () } - if (comfortControlledZone.EMSOverrideCoolingSetPointOn) { - int ZoneNum = comfortControlledZone.ActualZoneNum; - switch (static_cast(state.dataHeatBalFanSys->ComfortControlType(ZoneNum))) { - case HVAC::ThermostatType::SingleCooling: - state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ZoneNum) = comfortControlledZone.EMSOverrideCoolingSetPointValue; - ZoneThermostatSetPointHi(ZoneNum) = comfortControlledZone.EMSOverrideCoolingSetPointValue; - break; - case HVAC::ThermostatType::SingleHeatCool: - state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ZoneNum) = comfortControlledZone.EMSOverrideCoolingSetPointValue; - ZoneThermostatSetPointHi(ZoneNum) = comfortControlledZone.EMSOverrideCoolingSetPointValue; - break; - case HVAC::ThermostatType::DualSetPointWithDeadBand: - ZoneThermostatSetPointHi(ZoneNum) = comfortControlledZone.EMSOverrideCoolingSetPointValue; - break; - default: - break; - } + if (comfortZone.EMSOverrideCoolingSetPointOn) { + + int ZoneNum = comfortZone.ActualZoneNum; + auto &zoneTstatSetpt = s_hbfs->zoneTstatSetpts(ZoneNum); + + switch (static_cast(s_hbfs->ComfortControlType(ZoneNum))) { + case HVAC::SetptType::SingleCool: + case HVAC::SetptType::SingleHeatCool: { + zoneTstatSetpt.setptHi = zoneTstatSetpt.setpt = comfortZone.EMSOverrideCoolingSetPointValue; + } break; + + case HVAC::SetptType::DualHeatCool: { + zoneTstatSetpt.setptHi = comfortZone.EMSOverrideCoolingSetPointValue; + } break; + + default: { + } break; + + } // switch () } } } @@ -6817,202 +6358,110 @@ void FillPredefinedTableOnThermostatSetpoints(EnergyPlusData &state) { // J.Glazer - Aug 2017 using namespace OutputReportPredefined; + auto &s_ztpc = state.dataZoneTempPredictorCorrector; + std::vector uniqSch; - uniqSch.reserve( - state.dataZoneTempPredictorCorrector->NumSingleTempHeatingControls + state.dataZoneTempPredictorCorrector->NumSingleTempCoolingControls + - state.dataZoneTempPredictorCorrector->NumSingleTempHeatCoolControls + state.dataZoneTempPredictorCorrector->NumDualTempHeatCoolControls * 2); + uniqSch.reserve(s_ztpc->NumTempControls[(int)HVAC::SetptType::SingleHeat] + s_ztpc->NumTempControls[(int)HVAC::SetptType::SingleCool] + + s_ztpc->NumTempControls[(int)HVAC::SetptType::SingleHeatCool] + s_ztpc->NumTempControls[(int)HVAC::SetptType::DualHeatCool] * 2); + Real64 setPointAt11; Real64 setPointAt23; int numDays; std::string monthAssumed; std::string monthAssumed2; - constexpr int wednesday = 4; - for (int idx = 1; idx <= state.dataZoneTempPredictorCorrector->NumSingleTempHeatingControls; ++idx) { - auto &singleHtgSetpoint = state.dataZoneTempPredictorCorrector->SetPointSingleHeating(idx); - if (std::find(uniqSch.begin(), uniqSch.end(), singleHtgSetpoint.TempSchedIndex) == uniqSch.end()) { - uniqSch.emplace_back(singleHtgSetpoint.TempSchedIndex); - PreDefTableEntry(state, state.dataOutRptPredefined->pdChLeedSchStPtFirstObjUsed, singleHtgSetpoint.TempSchedName, singleHtgSetpoint.Name); + for (auto &setpt : s_ztpc->tempSetptScheds[(int)HVAC::SetptType::SingleHeat]) { + if (std::find(uniqSch.begin(), uniqSch.end(), setpt.heatSched->Num) != uniqSch.end()) continue; - std::tie(setPointAt11, numDays, monthAssumed) = temperatureAndCountInSch(state, singleHtgSetpoint.TempSchedIndex, false, wednesday, 11); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11amWednesday, singleHtgSetpoint.TempSchedName, setPointAt11); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11amWedCnt, singleHtgSetpoint.TempSchedName, numDays); + uniqSch.emplace_back(setpt.heatSched->Num); + PreDefTableEntry(state, state.dataOutRptPredefined->pdChLeedSchStPtFirstObjUsed, setpt.heatSched->Name, setpt.Name); - std::tie(setPointAt23, numDays, monthAssumed) = temperatureAndCountInSch(state, singleHtgSetpoint.TempSchedIndex, false, wednesday, 23); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11pmWednesday, singleHtgSetpoint.TempSchedName, setPointAt23); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11pmWedCnt, singleHtgSetpoint.TempSchedName, numDays); + std::tie(setPointAt11, numDays, monthAssumed) = setpt.heatSched->getValAndCountOnDay(state, false, Sched::DayType::Wednesday, 11); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11amWednesday, setpt.heatSched->Name, setPointAt11); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11amWedCnt, setpt.heatSched->Name, numDays); - PreDefTableEntry(state, state.dataOutRptPredefined->pdChLeedSchStPtMonthUsed, singleHtgSetpoint.TempSchedName, monthAssumed); - } + std::tie(setPointAt23, numDays, monthAssumed) = setpt.heatSched->getValAndCountOnDay(state, false, Sched::DayType::Wednesday, 23); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11pmWednesday, setpt.heatSched->Name, setPointAt23); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11pmWedCnt, setpt.heatSched->Name, numDays); + + PreDefTableEntry(state, state.dataOutRptPredefined->pdChLeedSchStPtMonthUsed, setpt.heatSched->Name, monthAssumed); } - for (int idx = 1; idx <= state.dataZoneTempPredictorCorrector->NumSingleTempCoolingControls; ++idx) { - auto &singleClgSetpoint = state.dataZoneTempPredictorCorrector->SetPointSingleCooling(idx); - if (std::find(uniqSch.begin(), uniqSch.end(), singleClgSetpoint.TempSchedIndex) == uniqSch.end()) { - uniqSch.emplace_back(singleClgSetpoint.TempSchedIndex); - PreDefTableEntry(state, state.dataOutRptPredefined->pdChLeedSchStPtFirstObjUsed, singleClgSetpoint.TempSchedName, singleClgSetpoint.Name); - std::tie(setPointAt11, numDays, monthAssumed) = temperatureAndCountInSch(state, singleClgSetpoint.TempSchedIndex, true, wednesday, 11); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11amWednesday, singleClgSetpoint.TempSchedName, setPointAt11); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11amWedCnt, singleClgSetpoint.TempSchedName, numDays); + for (auto &setpt : s_ztpc->tempSetptScheds[(int)HVAC::SetptType::SingleCool]) { + if (std::find(uniqSch.begin(), uniqSch.end(), setpt.coolSched->Num) != uniqSch.end()) continue; - std::tie(setPointAt23, numDays, monthAssumed) = temperatureAndCountInSch(state, singleClgSetpoint.TempSchedIndex, true, wednesday, 23); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11pmWednesday, singleClgSetpoint.TempSchedName, setPointAt23); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11pmWedCnt, singleClgSetpoint.TempSchedName, numDays); + uniqSch.emplace_back(setpt.coolSched->Num); + PreDefTableEntry(state, state.dataOutRptPredefined->pdChLeedSchStPtFirstObjUsed, setpt.coolSched->Name, setpt.Name); - PreDefTableEntry(state, state.dataOutRptPredefined->pdChLeedSchStPtMonthUsed, singleClgSetpoint.TempSchedName, monthAssumed); - } - } - for (int idx = 1; idx <= state.dataZoneTempPredictorCorrector->NumSingleTempHeatCoolControls; ++idx) { - auto &singleHeatCoolSetpoint = state.dataZoneTempPredictorCorrector->SetPointSingleHeatCool(idx); - if (std::find(uniqSch.begin(), uniqSch.end(), singleHeatCoolSetpoint.TempSchedIndex) == uniqSch.end()) { - uniqSch.emplace_back(singleHeatCoolSetpoint.TempSchedIndex); - PreDefTableEntry( - state, state.dataOutRptPredefined->pdChLeedSchStPtFirstObjUsed, singleHeatCoolSetpoint.TempSchedName, singleHeatCoolSetpoint.Name); - - std::string schNm = singleHeatCoolSetpoint.TempSchedName + " (summer)"; - std::tie(setPointAt11, numDays, monthAssumed) = - temperatureAndCountInSch(state, singleHeatCoolSetpoint.TempSchedIndex, true, wednesday, 11); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11amWednesday, schNm, setPointAt11); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11amWedCnt, schNm, numDays); - - std::tie(setPointAt23, numDays, monthAssumed) = - temperatureAndCountInSch(state, singleHeatCoolSetpoint.TempSchedIndex, true, wednesday, 23); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11pmWednesday, schNm, setPointAt23); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11pmWedCnt, schNm, numDays); - - schNm = singleHeatCoolSetpoint.TempSchedName + " (winter)"; - std::tie(setPointAt11, numDays, monthAssumed2) = - temperatureAndCountInSch(state, singleHeatCoolSetpoint.TempSchedIndex, false, wednesday, 11); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11amWednesday, schNm, setPointAt11); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11amWedCnt, schNm, numDays); - - std::tie(setPointAt23, numDays, monthAssumed2) = - temperatureAndCountInSch(state, singleHeatCoolSetpoint.TempSchedIndex, false, wednesday, 23); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11pmWednesday, schNm, setPointAt23); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11pmWedCnt, schNm, numDays); - - PreDefTableEntry(state, - state.dataOutRptPredefined->pdChLeedSchStPtMonthUsed, - singleHeatCoolSetpoint.TempSchedName, - monthAssumed + " and " + monthAssumed2); - } - } - for (int idx = 1; idx <= state.dataZoneTempPredictorCorrector->NumDualTempHeatCoolControls; ++idx) { - auto &dualHeatCoolSetpoint = state.dataZoneTempPredictorCorrector->SetPointDualHeatCool(idx); - if (std::find(uniqSch.begin(), uniqSch.end(), dualHeatCoolSetpoint.HeatTempSchedIndex) == uniqSch.end()) { - uniqSch.emplace_back(dualHeatCoolSetpoint.HeatTempSchedIndex); - PreDefTableEntry(state, - state.dataOutRptPredefined->pdChLeedSchStPtFirstObjUsed, - dualHeatCoolSetpoint.HeatTempSetptSchedName, - dualHeatCoolSetpoint.Name); - - std::tie(setPointAt11, numDays, monthAssumed) = - temperatureAndCountInSch(state, dualHeatCoolSetpoint.HeatTempSchedIndex, false, wednesday, 11); - PreDefTableEntry( - state, state.dataOutRptPredefined->pdchLeedSchStPt11amWednesday, dualHeatCoolSetpoint.HeatTempSetptSchedName, setPointAt11); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11amWedCnt, dualHeatCoolSetpoint.HeatTempSetptSchedName, numDays); - - std::tie(setPointAt23, numDays, monthAssumed) = - temperatureAndCountInSch(state, dualHeatCoolSetpoint.HeatTempSchedIndex, false, wednesday, 23); - PreDefTableEntry( - state, state.dataOutRptPredefined->pdchLeedSchStPt11pmWednesday, dualHeatCoolSetpoint.HeatTempSetptSchedName, setPointAt23); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11pmWedCnt, dualHeatCoolSetpoint.HeatTempSetptSchedName, numDays); - - PreDefTableEntry(state, state.dataOutRptPredefined->pdChLeedSchStPtMonthUsed, dualHeatCoolSetpoint.HeatTempSetptSchedName, monthAssumed); - } - if (std::find(uniqSch.begin(), uniqSch.end(), dualHeatCoolSetpoint.CoolTempSchedIndex) == uniqSch.end()) { - uniqSch.emplace_back(dualHeatCoolSetpoint.CoolTempSchedIndex); - PreDefTableEntry(state, - state.dataOutRptPredefined->pdChLeedSchStPtFirstObjUsed, - dualHeatCoolSetpoint.CoolTempSetptSchedName, - dualHeatCoolSetpoint.Name); - - std::tie(setPointAt11, numDays, monthAssumed) = - temperatureAndCountInSch(state, dualHeatCoolSetpoint.CoolTempSchedIndex, true, wednesday, 11); - PreDefTableEntry( - state, state.dataOutRptPredefined->pdchLeedSchStPt11amWednesday, dualHeatCoolSetpoint.CoolTempSetptSchedName, setPointAt11); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11amWedCnt, dualHeatCoolSetpoint.CoolTempSetptSchedName, numDays); - - std::tie(setPointAt23, numDays, monthAssumed) = - temperatureAndCountInSch(state, dualHeatCoolSetpoint.CoolTempSchedIndex, true, wednesday, 23); - PreDefTableEntry( - state, state.dataOutRptPredefined->pdchLeedSchStPt11pmWednesday, dualHeatCoolSetpoint.CoolTempSetptSchedName, setPointAt23); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11pmWedCnt, dualHeatCoolSetpoint.CoolTempSetptSchedName, numDays); - - PreDefTableEntry(state, state.dataOutRptPredefined->pdChLeedSchStPtMonthUsed, dualHeatCoolSetpoint.CoolTempSetptSchedName, monthAssumed); - } - } -} + std::tie(setPointAt11, numDays, monthAssumed) = setpt.coolSched->getValAndCountOnDay(state, true, Sched::DayType::Wednesday, 11); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11amWednesday, setpt.coolSched->Name, setPointAt11); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11amWedCnt, setpt.coolSched->Name, numDays); -// returns the temperature value from a schedule at a certain time for the first day of the week in either January or July -std::tuple -temperatureAndCountInSch(EnergyPlusData &state, int const scheduleIndex, bool const isSummer, int const dayOfWeek, int const hourOfDay) -{ - // J.Glazer - Aug 2017 + std::tie(setPointAt23, numDays, monthAssumed) = setpt.coolSched->getValAndCountOnDay(state, true, Sched::DayType::Wednesday, 23); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11pmWednesday, setpt.coolSched->Name, setPointAt23); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11pmWedCnt, setpt.coolSched->Name, numDays); - // determine month to use based on hemiphere and season - int monthToUse; - if (isSummer) { - if (state.dataEnvrn->Latitude > 0.) { - monthToUse = 7; // July - summer in northern hemisphere - } else { - monthToUse = 1; // January - summer in southern hemisphere - } - } else { - if (state.dataEnvrn->Latitude > 0.) { - monthToUse = 1; // January - winter in northern hemisphere - } else { - monthToUse = 7; // July - winter in southern hemisphere - } - } - std::string monthName; - if (monthToUse == 1) { - monthName = "January"; - } else { - monthName = "July"; + PreDefTableEntry(state, state.dataOutRptPredefined->pdChLeedSchStPtMonthUsed, setpt.coolSched->Name, monthAssumed); } - int jdateSelect = General::nthDayOfWeekOfMonth(state, dayOfWeek, 1, monthToUse); + for (auto &setpt : s_ztpc->tempSetptScheds[(int)HVAC::SetptType::SingleHeatCool]) { + if (std::find(uniqSch.begin(), uniqSch.end(), setpt.heatSched->Num) != uniqSch.end()) continue; - // determine number of days in year - int DaysInYear; - if (state.dataEnvrn->CurrentYearIsLeapYear) { - DaysInYear = 366; - } else { - DaysInYear = 365; + uniqSch.emplace_back(setpt.heatSched->Num); + PreDefTableEntry(state, state.dataOutRptPredefined->pdChLeedSchStPtFirstObjUsed, setpt.heatSched->Name, setpt.Name); + + std::string schNm = setpt.heatSched->Name + " (summer)"; + std::tie(setPointAt11, numDays, monthAssumed) = setpt.heatSched->getValAndCountOnDay(state, true, Sched::DayType::Wednesday, 11); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11amWednesday, schNm, setPointAt11); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11amWedCnt, schNm, numDays); + + std::tie(setPointAt23, numDays, monthAssumed) = setpt.heatSched->getValAndCountOnDay(state, true, Sched::DayType::Wednesday, 23); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11pmWednesday, schNm, setPointAt23); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11pmWedCnt, schNm, numDays); + + schNm = setpt.heatSched->Name + " (winter)"; + std::tie(setPointAt11, numDays, monthAssumed2) = setpt.heatSched->getValAndCountOnDay(state, false, Sched::DayType::Wednesday, 11); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11amWednesday, schNm, setPointAt11); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11amWedCnt, schNm, numDays); + + std::tie(setPointAt23, numDays, monthAssumed2) = setpt.heatSched->getValAndCountOnDay(state, false, Sched::DayType::Wednesday, 23); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11pmWednesday, schNm, setPointAt23); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11pmWedCnt, schNm, numDays); + + PreDefTableEntry(state, state.dataOutRptPredefined->pdChLeedSchStPtMonthUsed, setpt.heatSched->Name, monthAssumed + " and " + monthAssumed2); } - // should adjust date if lands on a holiday but for now assume that it does not + for (auto &setpt : s_ztpc->tempSetptScheds[(int)HVAC::SetptType::DualHeatCool]) { + if (std::find(uniqSch.begin(), uniqSch.end(), setpt.heatSched->Num) == uniqSch.end()) { + uniqSch.emplace_back(setpt.heatSched->Num); + PreDefTableEntry(state, state.dataOutRptPredefined->pdChLeedSchStPtFirstObjUsed, setpt.heatSched->Name, setpt.Name); - // adjust time of day for daylight savings time - int hourSelect = hourOfDay + state.dataWeather->DSTIndex(jdateSelect); + std::tie(setPointAt11, numDays, monthAssumed) = setpt.heatSched->getValAndCountOnDay(state, false, Sched::DayType::Wednesday, 11); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11amWednesday, setpt.heatSched->Name, setPointAt11); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11amWedCnt, setpt.heatSched->Name, numDays); - // get the value at the selected time - int constexpr firstTimeStep = 1; - int weekSchIndexSelect = state.dataScheduleMgr->Schedule(scheduleIndex).WeekSchedulePointer(jdateSelect); - int daySchIndexSelect = state.dataScheduleMgr->WeekSchedule(weekSchIndexSelect).DaySchedulePointer(dayOfWeek); - Real64 valueAtSelectTime = state.dataScheduleMgr->DaySchedule(daySchIndexSelect).TSValue(firstTimeStep, hourSelect); - int countOfSame = 0; + std::tie(setPointAt23, numDays, monthAssumed) = setpt.heatSched->getValAndCountOnDay(state, false, Sched::DayType::Wednesday, 23); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11pmWednesday, setpt.heatSched->Name, setPointAt23); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11pmWedCnt, setpt.heatSched->Name, numDays); - // count the number of times with that same value - for (int jdateOfYear = 1; jdateOfYear <= DaysInYear; ++jdateOfYear) { - int wkSch = state.dataScheduleMgr->Schedule(scheduleIndex).WeekSchedulePointer(jdateOfYear); - if (wkSch == weekSchIndexSelect) { // if same week schedule can short circuit rest of testing and increment counter - ++countOfSame; - } else { - int daySch = state.dataScheduleMgr->WeekSchedule(wkSch).DaySchedulePointer(dayOfWeek); - if (daySch == daySchIndexSelect) { // if same day schedule can short circuit rest of testing and increment counter - ++countOfSame; - } else { - Real64 valueAt = state.dataScheduleMgr->DaySchedule(daySch).TSValue(firstTimeStep, hourSelect); - if (valueAt == valueAtSelectTime) { - ++countOfSame; - } - } + PreDefTableEntry(state, state.dataOutRptPredefined->pdChLeedSchStPtMonthUsed, setpt.heatSched->Name, monthAssumed); } - } - return std::make_tuple(valueAtSelectTime, countOfSame, monthName); + if (std::find(uniqSch.begin(), uniqSch.end(), setpt.coolSched->Num) == uniqSch.end()) { + uniqSch.emplace_back(setpt.coolSched->Num); + PreDefTableEntry(state, state.dataOutRptPredefined->pdChLeedSchStPtFirstObjUsed, setpt.coolSched->Name, setpt.Name); + + std::tie(setPointAt11, numDays, monthAssumed) = setpt.coolSched->getValAndCountOnDay(state, true, Sched::DayType::Wednesday, 11); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11amWednesday, setpt.coolSched->Name, setPointAt11); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11amWedCnt, setpt.coolSched->Name, numDays); + + std::tie(setPointAt23, numDays, monthAssumed) = setpt.coolSched->getValAndCountOnDay(state, true, Sched::DayType::Wednesday, 23); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11pmWednesday, setpt.coolSched->Name, setPointAt23); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchLeedSchStPt11pmWedCnt, setpt.coolSched->Name, numDays); + + PreDefTableEntry(state, state.dataOutRptPredefined->pdChLeedSchStPtMonthUsed, setpt.coolSched->Name, monthAssumed); + } + } } void FillPredefinedTableOnThermostatSchedules(EnergyPlusData &state) @@ -7021,35 +6470,83 @@ void FillPredefinedTableOnThermostatSchedules(EnergyPlusData &state) // J.Glazer - March 2024 using OutputReportPredefined::PreDefTableEntry; auto &orp = state.dataOutRptPredefined; + + // Helper struct so we can sort to ensure a consistent order. + // No matter the order in which the multiple Field Sets (Control Object Type, Control Name), the same thing is reported to the tabular outputs + // You don't actually need this anymore + struct ControlTypeInfo + { + // HVAC::ThermostatType tType = HVAC::ThermostatType::Invalid; + std::string thermostatType; + std::string controlTypeName; + std::string heatSchName; + std::string coolSchName; + + // Only need the operator<, and we use C++17 so I can't use a defaulted 3-way operator<=> + bool operator<(const ControlTypeInfo &other) const + { + return std::tie(this->thermostatType, this->controlTypeName, this->heatSchName, this->coolSchName) < + std::tie(other.thermostatType, other.controlTypeName, other.heatSchName, other.coolSchName); + } + }; + using ControlTypeInfoMemPtr = std::string ControlTypeInfo::*; + + // How many people on the EnergyPlus team understand this code? + auto joinStrings = [](const std::vector &infos, ControlTypeInfoMemPtr memPtr) -> std::string { + std::vector result; + result.reserve(infos.size()); + for (const auto &info : infos) { + std::string val = info.*memPtr; + if (val.empty()) { + continue; + } + result.emplace_back(std::move(val)); + } + return fmt::format("{}", fmt::join(result, ", ")); + }; + for (int idx = 1; idx <= state.dataZoneCtrls->NumTempControlledZones; ++idx) { auto &tcz = state.dataZoneCtrls->TempControlledZone(idx); PreDefTableEntry(state, orp->pdchStatName, tcz.ZoneName, tcz.Name); - PreDefTableEntry(state, orp->pdchStatCtrlTypeSchd, tcz.ZoneName, tcz.ControlTypeSchedName); - for (int ctInx = 1; ctInx <= tcz.NumControlTypes; ++ctInx) { - PreDefTableEntry(state, orp->pdchStatSchdType1, tcz.ZoneName, HVAC::thermostatTypeNames[(int)tcz.ControlTypeEnum(ctInx)]); - PreDefTableEntry(state, orp->pdchStatSchdTypeName1, tcz.ZoneName, tcz.ControlTypeName(1)); - switch (tcz.ControlTypeEnum(ctInx)) { - case HVAC::ThermostatType::DualSetPointWithDeadBand: - PreDefTableEntry( - state, orp->pdchStatSchdHeatName, tcz.ZoneName, ScheduleManager::GetScheduleName(state, tcz.SchIndx_DualSetPointWDeadBandHeat)); - PreDefTableEntry( - state, orp->pdchStatSchdCoolName, tcz.ZoneName, ScheduleManager::GetScheduleName(state, tcz.SchIndx_DualSetPointWDeadBandCool)); - break; - case HVAC::ThermostatType::SingleHeatCool: - PreDefTableEntry( - state, orp->pdchStatSchdHeatName, tcz.ZoneName, ScheduleManager::GetScheduleName(state, tcz.SchIndx_SingleHeatCoolSetPoint)); - PreDefTableEntry( - state, orp->pdchStatSchdCoolName, tcz.ZoneName, ScheduleManager::GetScheduleName(state, tcz.SchIndx_SingleHeatCoolSetPoint)); - break; - case HVAC::ThermostatType::SingleCooling: - PreDefTableEntry( - state, orp->pdchStatSchdHeatName, tcz.ZoneName, ScheduleManager::GetScheduleName(state, tcz.SchIndx_SingleCoolSetPoint)); - break; - case HVAC::ThermostatType::SingleHeating: - PreDefTableEntry( - state, orp->pdchStatSchdCoolName, tcz.ZoneName, ScheduleManager::GetScheduleName(state, tcz.SchIndx_SingleHeatSetPoint)); - break; + PreDefTableEntry(state, orp->pdchStatCtrlTypeSchd, tcz.ZoneName, tcz.setptTypeSched->Name); + + std::vector infos; + infos.resize((int)HVAC::SetptType::Num); + for (HVAC::SetptType setptType : HVAC::setptTypes) { + auto &setpt = tcz.setpts[(int)setptType]; + + auto &info = infos[(int)setptType]; + + if (setpt.Name.empty()) continue; + + info.thermostatType = HVAC::setptTypeNames[(int)setptType]; + info.controlTypeName = setpt.Name; + switch (setptType) { + case HVAC::SetptType::DualHeatCool: + case HVAC::SetptType::SingleHeatCool: { + info.coolSchName = setpt.coolSetptSched->Name; + info.heatSchName = setpt.heatSetptSched->Name; + } break; + + case HVAC::SetptType::SingleCool: { + info.coolSchName = setpt.coolSetptSched->Name; + } break; + + case HVAC::SetptType::SingleHeat: { + info.heatSchName = setpt.heatSetptSched->Name; + } break; } + infos.emplace_back(std::move(info)); + } + std::sort(infos.begin(), infos.end()); + + PreDefTableEntry(state, orp->pdchStatSchdType1, tcz.ZoneName, joinStrings(infos, &ControlTypeInfo::thermostatType)); + PreDefTableEntry(state, orp->pdchStatSchdTypeName1, tcz.ZoneName, joinStrings(infos, &ControlTypeInfo::controlTypeName)); + if (auto heatSchNames = joinStrings(infos, &ControlTypeInfo::heatSchName); !heatSchNames.empty()) { + PreDefTableEntry(state, orp->pdchStatSchdHeatName, tcz.ZoneName, heatSchNames); + } + if (auto coolSchNames = joinStrings(infos, &ControlTypeInfo::coolSchName); !coolSchNames.empty()) { + PreDefTableEntry(state, orp->pdchStatSchdCoolName, tcz.ZoneName, coolSchNames); } } } @@ -7127,9 +6624,7 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re assert(zoneNum > 0); auto const &thisZone = state.dataHeatBal->Zone(zoneNum); - Real64 const thisTempZoneThermostatSetPoint = state.dataHeatBalFanSys->TempZoneThermostatSetPoint(zoneNum); - Real64 const thisZoneThermostatSetPointLo = state.dataHeatBalFanSys->ZoneThermostatSetPointLo(zoneNum); - Real64 const thisZoneThermostatSetPointHi = state.dataHeatBalFanSys->ZoneThermostatSetPointHi(zoneNum); + auto const &zoneTstatSetpt = state.dataHeatBalFanSys->zoneTstatSetpts(zoneNum); bool thisDeadBandOrSetBack = false; Real64 ZoneSetPoint = 0.0; @@ -7137,124 +6632,123 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re Real64 LoadToHeatingSetPoint = 0.0; Real64 LoadToCoolingSetPoint = 0.0; + auto &s_ztpc = state.dataZoneTempPredictorCorrector; + int zoneNodeNum = thisZone.SystemZoneNodeNumber; if (spaceNum > 0) { zoneNodeNum = state.dataHeatBal->space(spaceNum).SystemZoneNodeNumber; } switch (state.dataHeatBalFanSys->TempControlType(zoneNum)) { - case HVAC::ThermostatType::Uncontrolled: + case HVAC::SetptType::Uncontrolled: { // Uncontrolled Zone LoadToHeatingSetPoint = 0.0; LoadToCoolingSetPoint = 0.0; totalLoad = 0.0; - break; - case HVAC::ThermostatType::SingleHeating: + } break; + + case HVAC::SetptType::SingleHeat: { switch (state.dataHeatBal->ZoneAirSolutionAlgo) { case DataHeatBalance::SolutionAlgo::ThirdOrder: { - LoadToHeatingSetPoint = (this->tempDepLoad * thisTempZoneThermostatSetPoint - this->tempIndLoad); + LoadToHeatingSetPoint = (this->tempDepLoad * zoneTstatSetpt.setpt - this->tempIndLoad); break; } case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { if (this->tempDepLoad == 0.0) { // B=0 - LoadToHeatingSetPoint = this->AirPowerCap * (thisTempZoneThermostatSetPoint - this->T1) - this->tempIndLoad; + LoadToHeatingSetPoint = this->AirPowerCap * (zoneTstatSetpt.setpt - this->T1) - this->tempIndLoad; } else { Real64 const exp_700_TA(std::exp(min(700.0, -this->tempDepLoad / this->AirPowerCap))); - LoadToHeatingSetPoint = - this->tempDepLoad * (thisTempZoneThermostatSetPoint - this->T1 * exp_700_TA) / (1.0 - exp_700_TA) - this->tempIndLoad; + LoadToHeatingSetPoint = this->tempDepLoad * (zoneTstatSetpt.setpt - this->T1 * exp_700_TA) / (1.0 - exp_700_TA) - this->tempIndLoad; } - break; - } + } break; + case DataHeatBalance::SolutionAlgo::EulerMethod: { - LoadToHeatingSetPoint = this->AirPowerCap * (thisTempZoneThermostatSetPoint - this->T1) + - this->tempDepLoad * (thisTempZoneThermostatSetPoint) - this->tempIndLoad; - break; - } + LoadToHeatingSetPoint = + this->AirPowerCap * (zoneTstatSetpt.setpt - this->T1) + this->tempDepLoad * (zoneTstatSetpt.setpt) - this->tempIndLoad; + } break; + default: { assert(false); - } - } + } break; + } // switch (Algo) + if (RAFNFrac > 0.0) LoadToHeatingSetPoint = LoadToHeatingSetPoint / RAFNFrac; totalLoad = LoadToHeatingSetPoint; - ZoneSetPoint = thisTempZoneThermostatSetPoint; + ZoneSetPoint = zoneTstatSetpt.setpt; LoadToCoolingSetPoint = LoadToHeatingSetPoint; // for consistency with the other cases, use LE instead of LT and don't subtract 1.0 Watt as a way of pushing the zero load // case over the threshold if ((totalLoad) <= 0.0) thisDeadBandOrSetBack = true; + } break; - break; - case HVAC::ThermostatType::SingleCooling: + case HVAC::SetptType::SingleCool: { switch (state.dataHeatBal->ZoneAirSolutionAlgo) { case DataHeatBalance::SolutionAlgo::ThirdOrder: { - LoadToCoolingSetPoint = this->tempDepLoad * thisTempZoneThermostatSetPoint - this->tempIndLoad; - break; - } + LoadToCoolingSetPoint = this->tempDepLoad * zoneTstatSetpt.setpt - this->tempIndLoad; + } break; + case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { if (this->tempDepLoad == 0.0) { // B=0 - LoadToCoolingSetPoint = this->AirPowerCap * (thisTempZoneThermostatSetPoint - this->T1) - this->tempIndLoad; + LoadToCoolingSetPoint = this->AirPowerCap * (zoneTstatSetpt.setpt - this->T1) - this->tempIndLoad; } else { Real64 const exp_700_TA(std::exp(min(700.0, -this->tempDepLoad / this->AirPowerCap))); - LoadToCoolingSetPoint = - this->tempDepLoad * (thisTempZoneThermostatSetPoint - this->T1 * exp_700_TA) / (1.0 - exp_700_TA) - this->tempIndLoad; + LoadToCoolingSetPoint = this->tempDepLoad * (zoneTstatSetpt.setpt - this->T1 * exp_700_TA) / (1.0 - exp_700_TA) - this->tempIndLoad; } - break; - } + } break; + case DataHeatBalance::SolutionAlgo::EulerMethod: { - LoadToCoolingSetPoint = this->AirPowerCap * (thisTempZoneThermostatSetPoint - this->T1) + - this->tempDepLoad * thisTempZoneThermostatSetPoint - this->tempIndLoad; - break; - } + LoadToCoolingSetPoint = + this->AirPowerCap * (zoneTstatSetpt.setpt - this->T1) + this->tempDepLoad * zoneTstatSetpt.setpt - this->tempIndLoad; + } break; default: { assert(false); - } - } + } break; + } // swtich (Algo) + if (RAFNFrac > 0.0) LoadToHeatingSetPoint = LoadToHeatingSetPoint / RAFNFrac; if (thisZone.HasAdjustedReturnTempByITE && !(state.dataGlobal->BeginSimFlag)) { LoadToCoolingSetPoint = this->tempDepLoad * thisZone.AdjustedReturnTempByITE - this->tempIndLoad; } totalLoad = LoadToCoolingSetPoint; - ZoneSetPoint = thisTempZoneThermostatSetPoint; + ZoneSetPoint = zoneTstatSetpt.setpt; LoadToHeatingSetPoint = LoadToCoolingSetPoint; // for consistency with the other cases, use GE instead of GT and don't add 1.0 Watt as a way of pushing the zero load // case over the threshold if ((totalLoad) >= 0.0) thisDeadBandOrSetBack = true; - break; - case HVAC::ThermostatType::SingleHeatCool: + } break; + + case HVAC::SetptType::SingleHeatCool: { switch (state.dataHeatBal->ZoneAirSolutionAlgo) { case DataHeatBalance::SolutionAlgo::ThirdOrder: { - LoadToHeatingSetPoint = (this->tempDepLoad * (thisTempZoneThermostatSetPoint) - this->tempIndLoad); - LoadToCoolingSetPoint = (this->tempDepLoad * (thisTempZoneThermostatSetPoint) - this->tempIndLoad); - break; - } + LoadToHeatingSetPoint = (this->tempDepLoad * (zoneTstatSetpt.setpt) - this->tempIndLoad); + LoadToCoolingSetPoint = (this->tempDepLoad * (zoneTstatSetpt.setpt) - this->tempIndLoad); + } break; + case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { if (this->tempDepLoad == 0.0) { // B=0 - LoadToHeatingSetPoint = this->AirPowerCap * (thisTempZoneThermostatSetPoint - this->T1) - this->tempIndLoad; - LoadToCoolingSetPoint = this->AirPowerCap * (thisTempZoneThermostatSetPoint - this->T1) - this->tempIndLoad; + LoadToHeatingSetPoint = this->AirPowerCap * (zoneTstatSetpt.setpt - this->T1) - this->tempIndLoad; + LoadToCoolingSetPoint = this->AirPowerCap * (zoneTstatSetpt.setpt - this->T1) - this->tempIndLoad; } else { Real64 const exp_700_TA(std::exp(min(700.0, -this->tempDepLoad / this->AirPowerCap))); - LoadToHeatingSetPoint = - this->tempDepLoad * (thisTempZoneThermostatSetPoint - this->T1 * exp_700_TA) / (1.0 - exp_700_TA) - this->tempIndLoad; - LoadToCoolingSetPoint = - this->tempDepLoad * (thisTempZoneThermostatSetPoint - this->T1 * exp_700_TA) / (1.0 - exp_700_TA) - this->tempIndLoad; + LoadToHeatingSetPoint = this->tempDepLoad * (zoneTstatSetpt.setpt - this->T1 * exp_700_TA) / (1.0 - exp_700_TA) - this->tempIndLoad; + LoadToCoolingSetPoint = this->tempDepLoad * (zoneTstatSetpt.setpt - this->T1 * exp_700_TA) / (1.0 - exp_700_TA) - this->tempIndLoad; } - break; - } + } break; + case DataHeatBalance::SolutionAlgo::EulerMethod: { - LoadToHeatingSetPoint = this->AirPowerCap * (thisTempZoneThermostatSetPoint - this->T1) + - this->tempDepLoad * thisTempZoneThermostatSetPoint - this->tempIndLoad; - LoadToCoolingSetPoint = this->AirPowerCap * (thisTempZoneThermostatSetPoint - this->T1) + - this->tempDepLoad * thisTempZoneThermostatSetPoint - this->tempIndLoad; - break; - } + LoadToHeatingSetPoint = + this->AirPowerCap * (zoneTstatSetpt.setpt - this->T1) + this->tempDepLoad * zoneTstatSetpt.setpt - this->tempIndLoad; + LoadToCoolingSetPoint = + this->AirPowerCap * (zoneTstatSetpt.setpt - this->T1) + this->tempDepLoad * zoneTstatSetpt.setpt - this->tempIndLoad; + } break; default: { assert(false); - } - } - ZoneSetPoint = thisTempZoneThermostatSetPoint; - if (RAFNFrac > 0.0) { - LoadToHeatingSetPoint = LoadToHeatingSetPoint / RAFNFrac; - LoadToCoolingSetPoint = LoadToCoolingSetPoint / RAFNFrac; - } + } break; + } // swtich (Algo) + + ZoneSetPoint = zoneTstatSetpt.setpt; + if (RAFNFrac > 0.0) LoadToHeatingSetPoint = LoadToHeatingSetPoint / RAFNFrac; + if (RAFNFrac > 0.0) LoadToCoolingSetPoint = LoadToCoolingSetPoint / RAFNFrac; if (thisZone.HasAdjustedReturnTempByITE && !(state.dataGlobal->BeginSimFlag)) { LoadToCoolingSetPoint = this->tempDepLoad * thisZone.AdjustedReturnTempByITE - this->tempIndLoad; @@ -7273,14 +6767,14 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re // First trap bad set-points if (LoadToHeatingSetPoint > LoadToCoolingSetPoint) { ShowSevereError(state, - "HVAC::ThermostatType::SingleHeatCool: Effective heating set-point higher than effective cooling set-point - use " + "HVAC::SetptType::SingleHeatCool: Effective heating set-point higher than effective cooling set-point - use " "DualSetPointWithDeadBand if using unmixed air model"); ShowContinueErrorTimeStamp(state, format("occurs in Zone={}", thisZone.Name)); ShowContinueError(state, format("LoadToHeatingSetPoint={:.3R}, LoadToCoolingSetPoint={:.3R}", LoadToHeatingSetPoint, LoadToCoolingSetPoint)); ShowContinueError(state, format("Zone TempDepZnLd={:.2R}", this->tempDepLoad)); ShowContinueError(state, format("Zone TempIndZnLd={:.2R}", this->tempIndLoad)); - ShowContinueError(state, format("Zone ThermostatSetPoint={:.2R}", thisTempZoneThermostatSetPoint)); + ShowContinueError(state, format("Zone ThermostatSetPoint={:.2R}", zoneTstatSetpt.setpt)); ShowFatalError(state, "Program terminates due to above conditions."); } @@ -7292,8 +6786,8 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re totalLoad = 0.0; if (zoneNodeNum > 0) { ZoneSetPoint = state.dataLoopNodes->Node(zoneNodeNum).Temp; - ZoneSetPoint = max(ZoneSetPoint, thisZoneThermostatSetPointLo); // trap out of deadband - ZoneSetPoint = min(ZoneSetPoint, thisZoneThermostatSetPointHi); // trap out of deadband + ZoneSetPoint = max(ZoneSetPoint, zoneTstatSetpt.setptLo); // trap out of deadband + ZoneSetPoint = min(ZoneSetPoint, zoneTstatSetpt.setptHi); // trap out of deadband } thisDeadBandOrSetBack = true; } else { // this should never occur! @@ -7304,45 +6798,43 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re format("LoadToHeatingSetPoint={:.3R}, LoadToCoolingSetPoint={:.3R}", LoadToHeatingSetPoint, LoadToCoolingSetPoint)); ShowContinueError(state, format("Zone TempDepZnLd={:.2R}", this->tempDepLoad)); ShowContinueError(state, format("Zone TempIndZnLd={:.2R}", this->tempIndLoad)); - ShowContinueError(state, format("Zone ThermostatSetPoint={:.2R}", thisTempZoneThermostatSetPoint)); + ShowContinueError(state, format("Zone ThermostatSetPoint={:.2R}", zoneTstatSetpt.setpt)); ShowFatalError(state, "Program terminates due to above conditions."); } - break; - case HVAC::ThermostatType::DualSetPointWithDeadBand: + } break; + + case HVAC::SetptType::DualHeatCool: { switch (state.dataHeatBal->ZoneAirSolutionAlgo) { case DataHeatBalance::SolutionAlgo::ThirdOrder: { - LoadToHeatingSetPoint = (this->tempDepLoad * (thisZoneThermostatSetPointLo) - this->tempIndLoad); - LoadToCoolingSetPoint = (this->tempDepLoad * (thisZoneThermostatSetPointHi) - this->tempIndLoad); - break; - } + LoadToHeatingSetPoint = (this->tempDepLoad * (zoneTstatSetpt.setptLo) - this->tempIndLoad); + LoadToCoolingSetPoint = (this->tempDepLoad * (zoneTstatSetpt.setptHi) - this->tempIndLoad); + } break; + case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { if (this->tempDepLoad == 0.0) { // B=0 - LoadToHeatingSetPoint = this->AirPowerCap * (thisZoneThermostatSetPointLo - this->T1) - this->tempIndLoad; - LoadToCoolingSetPoint = this->AirPowerCap * (thisZoneThermostatSetPointHi - this->T1) - this->tempIndLoad; + LoadToHeatingSetPoint = this->AirPowerCap * (zoneTstatSetpt.setptLo - this->T1) - this->tempIndLoad; + LoadToCoolingSetPoint = this->AirPowerCap * (zoneTstatSetpt.setptHi - this->T1) - this->tempIndLoad; } else { Real64 const exp_700_TA(std::exp(min(700.0, -this->tempDepLoad / this->AirPowerCap))); - LoadToHeatingSetPoint = - this->tempDepLoad * (thisZoneThermostatSetPointLo - this->T1 * exp_700_TA) / (1.0 - exp_700_TA) - this->tempIndLoad; - LoadToCoolingSetPoint = - this->tempDepLoad * (thisZoneThermostatSetPointHi - this->T1 * exp_700_TA) / (1.0 - exp_700_TA) - this->tempIndLoad; + LoadToHeatingSetPoint = this->tempDepLoad * (zoneTstatSetpt.setptLo - this->T1 * exp_700_TA) / (1.0 - exp_700_TA) - this->tempIndLoad; + LoadToCoolingSetPoint = this->tempDepLoad * (zoneTstatSetpt.setptHi - this->T1 * exp_700_TA) / (1.0 - exp_700_TA) - this->tempIndLoad; } - break; - } + } break; + case DataHeatBalance::SolutionAlgo::EulerMethod: { LoadToHeatingSetPoint = - this->AirPowerCap * (thisZoneThermostatSetPointLo - this->T1) + this->tempDepLoad * thisZoneThermostatSetPointLo - this->tempIndLoad; + this->AirPowerCap * (zoneTstatSetpt.setptLo - this->T1) + this->tempDepLoad * zoneTstatSetpt.setptLo - this->tempIndLoad; LoadToCoolingSetPoint = - this->AirPowerCap * (thisZoneThermostatSetPointHi - this->T1) + this->tempDepLoad * thisZoneThermostatSetPointHi - this->tempIndLoad; - break; - } + this->AirPowerCap * (zoneTstatSetpt.setptHi - this->T1) + this->tempDepLoad * zoneTstatSetpt.setptHi - this->tempIndLoad; + } break; default: { assert(false); - } - } - if (RAFNFrac > 0.0) { // several of these inside the switch/case ?? - LoadToHeatingSetPoint = LoadToHeatingSetPoint / RAFNFrac; - LoadToCoolingSetPoint = LoadToCoolingSetPoint / RAFNFrac; - } + + } break; + } // switch (Algo) + + if (RAFNFrac > 0.0) LoadToHeatingSetPoint = LoadToHeatingSetPoint / RAFNFrac; + if (RAFNFrac > 0.0) LoadToCoolingSetPoint = LoadToCoolingSetPoint / RAFNFrac; if (thisZone.HasAdjustedReturnTempByITE && !(state.dataGlobal->BeginSimFlag)) { LoadToCoolingSetPoint = this->tempDepLoad * thisZone.AdjustedReturnTempByITE - this->tempIndLoad; @@ -7364,24 +6856,24 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re format("LoadToHeatingSetPoint={:.3R}, LoadToCoolingSetPoint={:.3R}", LoadToHeatingSetPoint, LoadToCoolingSetPoint)); ShowContinueError(state, format("Zone TempDepZnLd={:.2R}", this->tempDepLoad)); ShowContinueError(state, format("Zone TempIndZnLd={:.2R}", this->tempIndLoad)); - ShowContinueError(state, format("Zone Heating ThermostatSetPoint={:.2R}", thisZoneThermostatSetPointLo)); - ShowContinueError(state, format("Zone Cooling ThermostatSetPoint={:.2R}", thisZoneThermostatSetPointHi)); + ShowContinueError(state, format("Zone Heating ThermostatSetPoint={:.2R}", zoneTstatSetpt.setptLo)); + ShowContinueError(state, format("Zone Cooling ThermostatSetPoint={:.2R}", zoneTstatSetpt.setptHi)); ShowFatalError(state, "Program terminates due to above conditions."); } if (LoadToHeatingSetPoint > 0.0 && LoadToCoolingSetPoint > 0.0) { totalLoad = LoadToHeatingSetPoint; - ZoneSetPoint = thisZoneThermostatSetPointLo; + ZoneSetPoint = zoneTstatSetpt.setptLo; } else if (LoadToHeatingSetPoint < 0.0 && LoadToCoolingSetPoint < 0.0) { totalLoad = LoadToCoolingSetPoint; - ZoneSetPoint = thisZoneThermostatSetPointHi; + ZoneSetPoint = zoneTstatSetpt.setptHi; } else if (LoadToHeatingSetPoint <= 0.0 && LoadToCoolingSetPoint >= 0.0) { // deadband includes zero loads // this turns out to cause instabilities sometimes? that lead to setpoint errors if predictor is off. totalLoad = 0.0; if (zoneNodeNum > 0) { ZoneSetPoint = state.dataLoopNodes->Node(zoneNodeNum).Temp; - ZoneSetPoint = max(ZoneSetPoint, thisZoneThermostatSetPointLo); // trap out of deadband - ZoneSetPoint = min(ZoneSetPoint, thisZoneThermostatSetPointHi); // trap out of deadband + ZoneSetPoint = max(ZoneSetPoint, zoneTstatSetpt.setptLo); // trap out of deadband + ZoneSetPoint = min(ZoneSetPoint, zoneTstatSetpt.setptHi); // trap out of deadband } thisDeadBandOrSetBack = true; } else { // this should never occur! @@ -7390,18 +6882,19 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re ShowContinueErrorTimeStamp(state, format("occurs in Zone={}", thisZone.Name)); ShowContinueError(state, format("LoadToHeatingSetPoint={:.3R}, LoadToCoolingSetPoint={:.3R}", LoadToHeatingSetPoint, LoadToCoolingSetPoint)); - ShowContinueError(state, format("Zone Heating Set-point={:.2R}", thisZoneThermostatSetPointLo)); - ShowContinueError(state, format("Zone Cooling Set-point={:.2R}", thisZoneThermostatSetPointHi)); + ShowContinueError(state, format("Zone Heating Set-point={:.2R}", zoneTstatSetpt.setptLo)); + ShowContinueError(state, format("Zone Cooling Set-point={:.2R}", zoneTstatSetpt.setptHi)); ShowContinueError(state, format("Zone TempDepZnLd={:.2R}", this->tempDepLoad)); ShowContinueError(state, format("Zone TempIndZnLd={:.2R}", this->tempIndLoad)); - ShowContinueError(state, format("Zone ThermostatSetPoint={:.2R}", thisTempZoneThermostatSetPoint)); + ShowContinueError(state, format("Zone ThermostatSetPoint={:.2R}", zoneTstatSetpt.setpt)); ShowFatalError(state, "Program terminates due to above conditions."); } - break; - default: - break; - } + } break; + + default: { + } break; + } // swtich (setptType) int systemNodeNumber = 0; int stageNum = 0; @@ -7414,7 +6907,7 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re stageNum = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(zoneNum).StageNum; } // Staged control zone - if (state.dataZoneTempPredictorCorrector->NumStageCtrZone > 0) { + if (s_ztpc->NumStageCtrZone > 0) { if (state.dataZoneCtrls->StageZoneLogic(zoneNum)) { if (stageNum == 0) { // No load LoadToHeatingSetPoint = 0.0; @@ -7422,66 +6915,67 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re totalLoad = 0.0; if (systemNodeNumber > 0) { ZoneSetPoint = state.dataLoopNodes->Node(systemNodeNumber).Temp; - ZoneSetPoint = max(ZoneSetPoint, thisZoneThermostatSetPointLo); // trap out of deadband - ZoneSetPoint = min(ZoneSetPoint, thisZoneThermostatSetPointHi); // trap out of deadband + ZoneSetPoint = max(ZoneSetPoint, zoneTstatSetpt.setptLo); // trap out of deadband + ZoneSetPoint = min(ZoneSetPoint, zoneTstatSetpt.setptHi); // trap out of deadband } thisDeadBandOrSetBack = true; + } else if (stageNum < 0) { // Cooling load switch (state.dataHeatBal->ZoneAirSolutionAlgo) { case DataHeatBalance::SolutionAlgo::ThirdOrder: { - LoadToCoolingSetPoint = (this->tempDepLoad * (thisZoneThermostatSetPointHi) - this->tempIndLoad); - break; - } + LoadToCoolingSetPoint = (this->tempDepLoad * (zoneTstatSetpt.setptHi) - this->tempIndLoad); + } break; + case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { if (this->tempDepLoad == 0.0) { // B=0 - LoadToCoolingSetPoint = this->AirPowerCap * (thisZoneThermostatSetPointHi - this->T1) - this->tempIndLoad; + LoadToCoolingSetPoint = this->AirPowerCap * (zoneTstatSetpt.setptHi - this->T1) - this->tempIndLoad; } else { Real64 const exp_700_TA(std::exp(min(700.0, -this->tempDepLoad / this->AirPowerCap))); LoadToCoolingSetPoint = - this->tempDepLoad * (thisZoneThermostatSetPointHi - this->T1 * exp_700_TA) / (1.0 - exp_700_TA) - this->tempIndLoad; + this->tempDepLoad * (zoneTstatSetpt.setptHi - this->T1 * exp_700_TA) / (1.0 - exp_700_TA) - this->tempIndLoad; } - break; - } + } break; + case DataHeatBalance::SolutionAlgo::EulerMethod: { - LoadToCoolingSetPoint = this->AirPowerCap * (thisZoneThermostatSetPointHi - this->T1) + - this->tempDepLoad * thisZoneThermostatSetPointHi - this->tempIndLoad; - break; - } + LoadToCoolingSetPoint = + this->AirPowerCap * (zoneTstatSetpt.setptHi - this->T1) + this->tempDepLoad * zoneTstatSetpt.setptHi - this->tempIndLoad; + } break; default: { assert(false); - } - } + } break; + } // switch (Algo) + totalLoad = LoadToCoolingSetPoint; - ZoneSetPoint = thisZoneThermostatSetPointHi; + ZoneSetPoint = zoneTstatSetpt.setptHi; LoadToHeatingSetPoint = LoadToCoolingSetPoint; if ((totalLoad) >= 0.0) thisDeadBandOrSetBack = true; } else { // Heating load switch (state.dataHeatBal->ZoneAirSolutionAlgo) { case DataHeatBalance::SolutionAlgo::ThirdOrder: { - LoadToHeatingSetPoint = (this->tempDepLoad * thisZoneThermostatSetPointLo - this->tempIndLoad); - break; - } + LoadToHeatingSetPoint = (this->tempDepLoad * zoneTstatSetpt.setptLo - this->tempIndLoad); + } break; + case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { if (this->tempDepLoad == 0.0) { // B=0 - LoadToHeatingSetPoint = this->AirPowerCap * (thisZoneThermostatSetPointLo - this->T1) - this->tempIndLoad; + LoadToHeatingSetPoint = this->AirPowerCap * (zoneTstatSetpt.setptLo - this->T1) - this->tempIndLoad; } else { Real64 const exp_700_TA(std::exp(min(700.0, -this->tempDepLoad / this->AirPowerCap))); LoadToHeatingSetPoint = - this->tempDepLoad * (thisZoneThermostatSetPointLo - this->T1 * exp_700_TA) / (1.0 - exp_700_TA) - this->tempIndLoad; + this->tempDepLoad * (zoneTstatSetpt.setptLo - this->T1 * exp_700_TA) / (1.0 - exp_700_TA) - this->tempIndLoad; } - break; - } + } break; + case DataHeatBalance::SolutionAlgo::EulerMethod: { - LoadToHeatingSetPoint = this->AirPowerCap * (thisZoneThermostatSetPointLo - this->T1) + - this->tempDepLoad * (thisZoneThermostatSetPointLo) - this->tempIndLoad; - break; - } + LoadToHeatingSetPoint = + this->AirPowerCap * (zoneTstatSetpt.setptLo - this->T1) + this->tempDepLoad * (zoneTstatSetpt.setptLo) - this->tempIndLoad; + } break; default: { assert(false); - } - } + } break; + } // switch (Algo) + totalLoad = LoadToHeatingSetPoint; - ZoneSetPoint = thisZoneThermostatSetPointLo; + ZoneSetPoint = zoneTstatSetpt.setptLo; LoadToCoolingSetPoint = LoadToHeatingSetPoint; if ((totalLoad) <= 0.0) thisDeadBandOrSetBack = true; } @@ -7496,7 +6990,7 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re state.dataZoneEnergyDemand->Setback(zoneNum) = (ZoneSetPoint > this->setPointLast); this->setPointLast = ZoneSetPoint; - state.dataHeatBalFanSys->TempZoneThermostatSetPoint(zoneNum) = ZoneSetPoint; // needed to fix Issue # 5048 + state.dataHeatBalFanSys->zoneTstatSetpts(zoneNum).setpt = ZoneSetPoint; // needed to fix Issue # 5048 state.dataZoneEnergyDemand->DeadBandOrSetback(zoneNum) = thisDeadBandOrSetBack; state.dataZoneEnergyDemand->CurDeadBandOrSetback(zoneNum) = thisDeadBandOrSetBack; diff --git a/src/EnergyPlus/ZoneTempPredictorCorrector.hh b/src/EnergyPlus/ZoneTempPredictorCorrector.hh index 1e177c97455..2542da2c1f1 100644 --- a/src/EnergyPlus/ZoneTempPredictorCorrector.hh +++ b/src/EnergyPlus/ZoneTempPredictorCorrector.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -71,26 +71,11 @@ struct EnergyPlusData; namespace ZoneTempPredictorCorrector { - struct ZoneTempControl + struct ZoneSetptScheds { - std::string Name; // Name of the zone - std::string TempSchedName; // Name of the schedule which determines the zone temp setpoint - int TempSchedIndex = 0; - std::string HeatTempSetptSchedName; - int HeatTempSchedIndex = 0; - std::string CoolTempSetptSchedName; - int CoolTempSchedIndex = 0; - }; - - struct ZoneComfortFangerControl - { - std::string Name; // Name of the zone - std::string PMVSchedName; // Name of the schedule which determines the zone temp setpoint - int PMVSchedIndex = 0; // Index to PMV dual set point schedule - std::string HeatPMVSetptSchedName; // Name of PMV heating set point schedule - int HeatPMVSchedIndex = 0; // Index to PMV heating set point schedule - std::string CoolPMVSetptSchedName; // Name of PMV cooling set point schedule - int CoolPMVSchedIndex = 0; // INdex to PMV cooling set point schedule + std::string Name; // Name of the zone + Sched::Schedule *heatSched = nullptr; + Sched::Schedule *coolSched = nullptr; }; struct AdaptiveComfortDailySetPointSchedule @@ -399,16 +384,8 @@ namespace ZoneTempPredictorCorrector { struct ZoneTempPredictorCorrectorData : BaseGlobalStruct { - int NumSingleTempHeatingControls = 0; - int NumSingleTempCoolingControls = 0; - int NumSingleTempHeatCoolControls = 0; - int NumDualTempHeatCoolControls = 0; - - // Number of Thermal comfort control types - int NumSingleFangerHeatingControls = 0; - int NumSingleFangerCoolingControls = 0; - int NumSingleFangerHeatCoolControls = 0; - int NumDualFangerHeatCoolControls = 0; + std::array NumTempControls = {0}; + std::array NumComfortControls = {0}; // Number of zone with staged controlled objects int NumStageCtrZone = 0; @@ -433,14 +410,8 @@ struct ZoneTempPredictorCorrectorData : BaseGlobalStruct // Object Data std::unordered_set HumidityControlZoneUniqueNames; - EPVector SetPointSingleHeating; - EPVector SetPointSingleCooling; - EPVector SetPointSingleHeatCool; - EPVector SetPointDualHeatCool; - EPVector SetPointSingleHeatingFanger; - EPVector SetPointSingleCoolingFanger; - EPVector SetPointSingleHeatCoolFanger; - EPVector SetPointDualHeatCoolFanger; + std::array, (int)HVAC::SetptType::Num> tempSetptScheds; + std::array, (int)HVAC::SetptType::Num> comfortSetptScheds; ZoneTempPredictorCorrector::AdaptiveComfortDailySetPointSchedule AdapComfortDailySetPointSchedule; std::array AdapComfortSetPointSummerDesDay = {-1}; @@ -459,6 +430,10 @@ struct ZoneTempPredictorCorrectorData : BaseGlobalStruct EPVector zoneHeatBalance; EPVector spaceHeatBalance; + void init_constant_state([[maybe_unused]] EnergyPlusData &state) override + { + } + void init_state([[maybe_unused]] EnergyPlusData &state) override { } diff --git a/src/EnergyPlus/api/EnergyPlusAPI.h b/src/EnergyPlus/api/EnergyPlusAPI.h index 96c7e938aa3..2a0bc4c6292 100644 --- a/src/EnergyPlus/api/EnergyPlusAPI.h +++ b/src/EnergyPlus/api/EnergyPlusAPI.h @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -52,13 +52,20 @@ /// \brief This file provides a define that enables exposing methods on the API. No client needs to directly import this file. #if (_WIN32 || _MSC_VER) && !ENERGYPLUS_STATIC_API -#if defined(energypluslib_EXPORTS) || defined(energyplusapi_EXPORTS) || defined(energypluslib2_EXPORTS) -#define ENERGYPLUSLIB_API __declspec(dllexport) +# if defined(energypluslib_EXPORTS) || defined(energyplusapi_EXPORTS) || defined(energypluslib2_EXPORTS) +# define ENERGYPLUSLIB_API __declspec(dllexport) +# else +# define ENERGYPLUSLIB_API __declspec(dllimport) +# endif #else -#define ENERGYPLUSLIB_API __declspec(dllimport) +# if defined(energypluslib_EXPORTS) || defined(energyplusapi_EXPORTS) || defined(energypluslib2_EXPORTS) +# if defined(__GNUC__) || defined(__clang__) +# define ENERGYPLUSLIB_API __attribute__((visibility("default"))) +# endif +# endif #endif -#else -#define ENERGYPLUSLIB_API +#ifndef ENERGYPLUSLIB_API +# define ENERGYPLUSLIB_API #endif #endif diff --git a/src/EnergyPlus/api/EnergyPlusPgm.cc b/src/EnergyPlus/api/EnergyPlusPgm.cc index 800734bc67e..05c562439db 100644 --- a/src/EnergyPlus/api/EnergyPlusPgm.cc +++ b/src/EnergyPlus/api/EnergyPlusPgm.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -173,7 +173,7 @@ // from the SQLite project (http://www.sqlite.org/). #ifdef _WIN32 -#include +# include #endif // C++ Headers @@ -183,11 +183,11 @@ #include #ifdef DEBUG_ARITHM_GCC_OR_CLANG -#include +# include #endif #ifdef DEBUG_ARITHM_MSVC -#include +# include #endif // ObjexxFCL Headers @@ -218,10 +218,10 @@ #include #ifdef _WIN32 -#include -#include +# include +# include #else // Mac or Linux -#include +# include #endif int EnergyPlusPgm(const std::vector &args, std::string const &filepath) @@ -269,12 +269,12 @@ void commonInitialize(EnergyPlus::EnergyPlusData &state) #endif #ifdef _MSC_VER -#ifndef _DEBUG +# ifndef _DEBUG // If _MSC_VER and not debug then prevent dialogs on error SetErrorMode(SEM_NOGPFAULTERRORBOX); _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG); _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG); -#endif +# endif #endif state.dataSysVars->runtimeTimer.tick(); @@ -367,8 +367,10 @@ int wrapUpEnergyPlus(EnergyPlus::EnergyPlusData &state) Psychrometrics::ShowPsychrometricSummary(state, state.files.audit); state.dataInputProcessing->inputProcessor->reportOrphanRecordObjects(state); - FluidProperties::ReportOrphanFluids(state); - ScheduleManager::ReportOrphanSchedules(state); + + Fluid::ReportOrphanFluids(state); + Sched::ReportOrphanSchedules(state); + if (state.dataSQLiteProcedures->sqlite) { state.dataSQLiteProcedures->sqlite.reset(); } diff --git a/src/EnergyPlus/api/EnergyPlusPgm.hh b/src/EnergyPlus/api/EnergyPlusPgm.hh index 7cb75a91235..0640c9843ca 100644 --- a/src/EnergyPlus/api/EnergyPlusPgm.hh +++ b/src/EnergyPlus/api/EnergyPlusPgm.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/api/TypeDefs.h b/src/EnergyPlus/api/TypeDefs.h index 8d561d0e259..06474c58c74 100644 --- a/src/EnergyPlus/api/TypeDefs.h +++ b/src/EnergyPlus/api/TypeDefs.h @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/api/api.py b/src/EnergyPlus/api/api.py index 57733daf076..8583d522797 100644 --- a/src/EnergyPlus/api/api.py +++ b/src/EnergyPlus/api/api.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/src/EnergyPlus/api/autosizing.cc b/src/EnergyPlus/api/autosizing.cc index d3bbef98fd6..216110a4222 100644 --- a/src/EnergyPlus/api/autosizing.cc +++ b/src/EnergyPlus/api/autosizing.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/api/autosizing.h b/src/EnergyPlus/api/autosizing.h index ecabe77c84d..c0f71ce7380 100644 --- a/src/EnergyPlus/api/autosizing.h +++ b/src/EnergyPlus/api/autosizing.h @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/api/autosizing.py b/src/EnergyPlus/api/autosizing.py index 56193632ee4..b6b25e717b3 100644 --- a/src/EnergyPlus/api/autosizing.py +++ b/src/EnergyPlus/api/autosizing.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/src/EnergyPlus/api/common.py b/src/EnergyPlus/api/common.py index ebec6c0ba05..55359aa1661 100644 --- a/src/EnergyPlus/api/common.py +++ b/src/EnergyPlus/api/common.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/src/EnergyPlus/api/datatransfer.cc b/src/EnergyPlus/api/datatransfer.cc index 05dc9f8eac9..5ada9f04940 100644 --- a/src/EnergyPlus/api/datatransfer.cc +++ b/src/EnergyPlus/api/datatransfer.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -108,7 +108,7 @@ APIDataEntry *getAPIData(EnergyPlusState state, unsigned int *resultingSize) if (meter->Name.empty()) { break; } - localDataEntries.emplace_back("OutputMeter", "", "", meter->Name, EnergyPlus::Constant::unitToString(meter->units)); + localDataEntries.emplace_back("OutputMeter", "", "", meter->Name, format("{}", EnergyPlus::Constant::unitNames[(int)meter->units])); } for (auto const *variable : thisState->dataOutputProcessor->outVars) { if (variable->varType != EnergyPlus::OutputProcessor::VariableType::Real) continue; @@ -121,7 +121,7 @@ APIDataEntry *getAPIData(EnergyPlusState state, unsigned int *resultingSize) variable->keyUC, variable->units == EnergyPlus::Constant::Units::customEMS ? variable->unitNameCustomEMS - : EnergyPlus::Constant::unitToString(variable->units)); + : format("{}", EnergyPlus::Constant::unitNames[(int)variable->units])); } *resultingSize = localDataEntries.size(); auto *data = new APIDataEntry[*resultingSize]; @@ -191,9 +191,9 @@ char *listAllAPIDataCSV(EnergyPlusState state) if (meter->Name.empty()) { break; } - output.append("OutputMeter").append(","); + output.append("OutputMeter").append(","); // This multiple append thing is not good output.append(meter->Name).append(","); - output.append(EnergyPlus::Constant::unitToString(meter->units)).append("\n"); + output.append(format("{}\n", EnergyPlus::Constant::unitNames[(int)meter->units])); } output.append("**VARIABLES**\n"); for (auto const *variable : thisState->dataOutputProcessor->outVars) { @@ -204,10 +204,9 @@ char *listAllAPIDataCSV(EnergyPlusState state) output.append("OutputVariable,"); output.append(variable->name).append(","); output.append(variable->keyUC).append(","); - output - .append(variable->units == EnergyPlus::Constant::Units::customEMS ? variable->unitNameCustomEMS - : EnergyPlus::Constant::unitToString(variable->units)) - .append("\n"); + output.append(format("{}\n", + variable->units == EnergyPlus::Constant::Units::customEMS ? variable->unitNameCustomEMS + : EnergyPlus::Constant::unitNames[(int)variable->units])); } // note that we cannot just return a c_str to the local string, as the string will be destructed upon leaving // this function, and undefined behavior will occur. @@ -928,7 +927,7 @@ int minutes(EnergyPlusState state) int numTimeStepsInHour([[maybe_unused]] EnergyPlusState state) { const auto *thisState = static_cast(state); - return thisState->dataGlobal->NumOfTimeStepInHour; + return thisState->dataGlobal->TimeStepsInHour; } int zoneTimeStepNum([[maybe_unused]] EnergyPlusState state) @@ -1021,8 +1020,7 @@ int todayWeatherIsRainAtTime(EnergyPlusState state, int hour, int timeStepNum) auto *thisState = static_cast(state); const int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return (int)thisState->dataWeather->wvarsHrTsToday(timeStepNum, iHour).IsRain; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1035,8 +1033,7 @@ int todayWeatherIsSnowAtTime(EnergyPlusState state, int hour, int timeStepNum) auto *thisState = static_cast(state); const int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return (int)thisState->dataWeather->wvarsHrTsToday(timeStepNum, iHour).IsSnow; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1049,8 +1046,7 @@ Real64 todayWeatherOutDryBulbAtTime(EnergyPlusState state, int hour, int timeSte auto *thisState = static_cast(state); const int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return thisState->dataWeather->wvarsHrTsToday(timeStepNum, iHour).OutDryBulbTemp; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1062,8 +1058,7 @@ Real64 todayWeatherOutDewPointAtTime(EnergyPlusState state, int hour, int timeSt { auto *thisState = static_cast(state); int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return thisState->dataWeather->wvarsHrTsToday(timeStepNum, iHour).OutDewPointTemp; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1075,8 +1070,7 @@ Real64 todayWeatherOutBarometricPressureAtTime(EnergyPlusState state, int hour, { auto *thisState = static_cast(state); int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return thisState->dataWeather->wvarsHrTsToday(timeStepNum, iHour).OutBaroPress; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1088,8 +1082,7 @@ Real64 todayWeatherOutRelativeHumidityAtTime(EnergyPlusState state, int hour, in { auto *thisState = static_cast(state); const int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return thisState->dataWeather->wvarsHrTsToday(timeStepNum, iHour).OutRelHum; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1101,8 +1094,7 @@ Real64 todayWeatherWindSpeedAtTime(EnergyPlusState state, int hour, int timeStep { auto *thisState = static_cast(state); const int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return thisState->dataWeather->wvarsHrTsToday(timeStepNum, iHour).WindSpeed; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1114,8 +1106,7 @@ Real64 todayWeatherWindDirectionAtTime(EnergyPlusState state, int hour, int time { auto *thisState = static_cast(state); const int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return thisState->dataWeather->wvarsHrTsToday(timeStepNum, iHour).WindDir; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1127,8 +1118,7 @@ Real64 todayWeatherSkyTemperatureAtTime(EnergyPlusState state, int hour, int tim { auto *thisState = static_cast(state); const int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return thisState->dataWeather->wvarsHrTsToday(timeStepNum, iHour).SkyTemp; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1140,8 +1130,7 @@ Real64 todayWeatherHorizontalIRSkyAtTime(EnergyPlusState state, int hour, int ti { auto *thisState = static_cast(state); const int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return thisState->dataWeather->wvarsHrTsToday(timeStepNum, iHour).HorizIRSky; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1153,8 +1142,7 @@ Real64 todayWeatherBeamSolarRadiationAtTime(EnergyPlusState state, int hour, int { auto *thisState = static_cast(state); const int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return thisState->dataWeather->wvarsHrTsToday(timeStepNum, iHour).BeamSolarRad; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1166,8 +1154,7 @@ Real64 todayWeatherDiffuseSolarRadiationAtTime(EnergyPlusState state, int hour, { auto *thisState = static_cast(state); const int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return thisState->dataWeather->wvarsHrTsToday(timeStepNum, iHour).DifSolarRad; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1179,8 +1166,7 @@ Real64 todayWeatherAlbedoAtTime(EnergyPlusState state, int hour, int timeStepNum { auto *thisState = static_cast(state); const int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return thisState->dataWeather->wvarsHrTsToday(timeStepNum, iHour).Albedo; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1192,8 +1178,7 @@ Real64 todayWeatherLiquidPrecipitationAtTime(EnergyPlusState state, int hour, in { auto *thisState = static_cast(state); const int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return thisState->dataWeather->wvarsHrTsToday(timeStepNum, iHour).LiquidPrecip; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1205,8 +1190,7 @@ int tomorrowWeatherIsRainAtTime(EnergyPlusState state, int hour, int timeStepNum { auto *thisState = static_cast(state); const int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return (int)thisState->dataWeather->wvarsHrTsTomorrow(timeStepNum, iHour).IsRain; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1218,8 +1202,7 @@ int tomorrowWeatherIsSnowAtTime(EnergyPlusState state, int hour, int timeStepNum { auto *thisState = static_cast(state); const int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return (int)thisState->dataWeather->wvarsHrTsTomorrow(timeStepNum, iHour).IsSnow; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1231,8 +1214,7 @@ Real64 tomorrowWeatherOutDryBulbAtTime(EnergyPlusState state, int hour, int time { auto *thisState = static_cast(state); const int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return thisState->dataWeather->wvarsHrTsTomorrow(timeStepNum, iHour).OutDryBulbTemp; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1244,8 +1226,7 @@ Real64 tomorrowWeatherOutDewPointAtTime(EnergyPlusState state, int hour, int tim { auto *thisState = static_cast(state); const int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return thisState->dataWeather->wvarsHrTsTomorrow(timeStepNum, iHour).OutDewPointTemp; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1257,8 +1238,7 @@ Real64 tomorrowWeatherOutBarometricPressureAtTime(EnergyPlusState state, int hou { auto *thisState = static_cast(state); const int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return thisState->dataWeather->wvarsHrTsTomorrow(timeStepNum, iHour).OutBaroPress; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1270,8 +1250,7 @@ Real64 tomorrowWeatherOutRelativeHumidityAtTime(EnergyPlusState state, int hour, { auto *thisState = static_cast(state); const int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return thisState->dataWeather->wvarsHrTsTomorrow(timeStepNum, iHour).OutRelHum; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1283,8 +1262,7 @@ Real64 tomorrowWeatherWindSpeedAtTime(EnergyPlusState state, int hour, int timeS { auto *thisState = static_cast(state); const int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return thisState->dataWeather->wvarsHrTsTomorrow(timeStepNum, iHour).WindSpeed; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1296,8 +1274,7 @@ Real64 tomorrowWeatherWindDirectionAtTime(EnergyPlusState state, int hour, int t { auto *thisState = static_cast(state); const int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return thisState->dataWeather->wvarsHrTsTomorrow(timeStepNum, iHour).WindDir; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1309,8 +1286,7 @@ Real64 tomorrowWeatherSkyTemperatureAtTime(EnergyPlusState state, int hour, int { auto *thisState = static_cast(state); const int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return thisState->dataWeather->wvarsHrTsTomorrow(timeStepNum, iHour).SkyTemp; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1322,8 +1298,7 @@ Real64 tomorrowWeatherHorizontalIRSkyAtTime(EnergyPlusState state, int hour, int { auto *thisState = static_cast(state); const int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return thisState->dataWeather->wvarsHrTsTomorrow(timeStepNum, iHour).HorizIRSky; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1335,8 +1310,7 @@ Real64 tomorrowWeatherBeamSolarRadiationAtTime(EnergyPlusState state, int hour, { auto *thisState = static_cast(state); const int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return thisState->dataWeather->wvarsHrTsTomorrow(timeStepNum, iHour).BeamSolarRad; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1348,8 +1322,7 @@ Real64 tomorrowWeatherDiffuseSolarRadiationAtTime(EnergyPlusState state, int hou { auto *thisState = static_cast(state); const int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return thisState->dataWeather->wvarsHrTsTomorrow(timeStepNum, iHour).DifSolarRad; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1361,8 +1334,7 @@ Real64 tomorrowWeatherAlbedoAtTime(EnergyPlusState state, int hour, int timeStep { auto *thisState = static_cast(state); const int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return thisState->dataWeather->wvarsHrTsTomorrow(timeStepNum, iHour).Albedo; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1374,8 +1346,7 @@ Real64 tomorrowWeatherLiquidPrecipitationAtTime(EnergyPlusState state, const int { auto *thisState = static_cast(state); const int iHour = hour + 1; - if ((iHour > 0) && (iHour <= EnergyPlus::Constant::HoursInDay) && (timeStepNum > 0) && - (timeStepNum <= thisState->dataGlobal->NumOfTimeStepInHour)) { + if ((iHour > 0) && (iHour <= EnergyPlus::Constant::iHoursInDay) && (timeStepNum > 0) && (timeStepNum <= thisState->dataGlobal->TimeStepsInHour)) { return thisState->dataWeather->wvarsHrTsTomorrow(timeStepNum, iHour).LiquidPrecip; } ShowSevereError(*thisState, "Invalid return from weather lookup, check hour and time step argument values are in range."); @@ -1386,5 +1357,5 @@ Real64 tomorrowWeatherLiquidPrecipitationAtTime(EnergyPlusState state, const int Real64 currentSimTime(EnergyPlusState state) { const auto *thisState = static_cast(state); - return (thisState->dataGlobal->DayOfSim - 1) * EnergyPlus::Constant::HoursInDay + currentTime(state); + return (thisState->dataGlobal->DayOfSim - 1) * EnergyPlus::Constant::iHoursInDay + currentTime(state); } diff --git a/src/EnergyPlus/api/datatransfer.h b/src/EnergyPlus/api/datatransfer.h index 7b31ba56970..e974271ba09 100644 --- a/src/EnergyPlus/api/datatransfer.h +++ b/src/EnergyPlus/api/datatransfer.h @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/api/datatransfer.py b/src/EnergyPlus/api/datatransfer.py index 0a1c9112d28..65dd430ae8b 100644 --- a/src/EnergyPlus/api/datatransfer.py +++ b/src/EnergyPlus/api/datatransfer.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/src/EnergyPlus/api/func.cc b/src/EnergyPlus/api/func.cc index e8e4b5263b4..22b7ae0120c 100644 --- a/src/EnergyPlus/api/func.cc +++ b/src/EnergyPlus/api/func.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -61,6 +61,7 @@ void initializeFunctionalAPI(EnergyPlusState state) if (!thisState->dataInputProcessing->inputProcessor) { thisState->dataInputProcessing->inputProcessor = EnergyPlus::InputProcessor::factory(); } + thisState->init_constant_state(*thisState); thisState->init_state(*thisState); } @@ -88,68 +89,68 @@ void registerErrorCallback(EnergyPlusState state, void (*f)(int, const char *)) Glycol glycolNew(EnergyPlusState state, const char *glycolName) { auto *thisState = reinterpret_cast(state); - auto *glycol = new EnergyPlus::FluidProperties::GlycolAPI(*thisState, glycolName); + auto *glycol = EnergyPlus::Fluid::GetGlycol(*thisState, EnergyPlus::Util::makeUPPER(glycolName)); return reinterpret_cast(glycol); } void glycolDelete(EnergyPlusState, Glycol glycol) { - delete reinterpret_cast(glycol); } + Real64 glycolSpecificHeat(EnergyPlusState state, Glycol glycol, Real64 temperature) { auto *thisState = reinterpret_cast(state); - return reinterpret_cast(glycol)->specificHeat(*thisState, temperature); + return reinterpret_cast(glycol)->getSpecificHeat(*thisState, temperature, "C-API"); } Real64 glycolDensity(EnergyPlusState state, Glycol glycol, Real64 temperature) { auto *thisState = reinterpret_cast(state); - return reinterpret_cast(glycol)->density(*thisState, temperature); + return reinterpret_cast(glycol)->getDensity(*thisState, temperature, "C-API"); } Real64 glycolConductivity(EnergyPlusState state, Glycol glycol, Real64 temperature) { auto *thisState = reinterpret_cast(state); - return reinterpret_cast(glycol)->conductivity(*thisState, temperature); + return reinterpret_cast(glycol)->getConductivity(*thisState, temperature, "C-API"); } Real64 glycolViscosity(EnergyPlusState state, Glycol glycol, Real64 temperature) { auto *thisState = reinterpret_cast(state); - return reinterpret_cast(glycol)->viscosity(*thisState, temperature); + return reinterpret_cast(glycol)->getViscosity(*thisState, temperature, "C-API"); } Refrigerant refrigerantNew(EnergyPlusState state, const char *refrigerantName) { auto *thisState = reinterpret_cast(state); - auto *refrigerant = new EnergyPlus::FluidProperties::RefrigerantAPI(*thisState, refrigerantName); + auto *refrigerant = EnergyPlus::Fluid::GetRefrig(*thisState, EnergyPlus::Util::makeUPPER(refrigerantName)); return reinterpret_cast(refrigerant); } void refrigerantDelete(EnergyPlusState, Refrigerant refrigerant) { - delete reinterpret_cast(refrigerant); } + Real64 refrigerantSaturationPressure(EnergyPlusState state, Refrigerant refrigerant, Real64 temperature) { auto *thisState = reinterpret_cast(state); - return reinterpret_cast(refrigerant)->saturationPressure(*thisState, temperature); + return reinterpret_cast(refrigerant)->getSatPressure(*thisState, temperature, "C-API"); } Real64 refrigerantSaturationTemperature(EnergyPlusState state, Refrigerant refrigerant, Real64 pressure) { auto *thisState = reinterpret_cast(state); - return reinterpret_cast(refrigerant)->saturationTemperature(*thisState, pressure); + return reinterpret_cast(refrigerant)->getSatTemperature(*thisState, pressure, "C-API"); } Real64 refrigerantSaturatedEnthalpy(EnergyPlusState state, Refrigerant refrigerant, Real64 temperature, Real64 quality) { auto *thisState = reinterpret_cast(state); - return reinterpret_cast(refrigerant)->saturatedEnthalpy(*thisState, temperature, quality); + return reinterpret_cast(refrigerant)->getSatEnthalpy(*thisState, temperature, quality, "C-API"); } Real64 refrigerantSaturatedDensity(EnergyPlusState state, Refrigerant refrigerant, Real64 temperature, Real64 quality) { auto *thisState = reinterpret_cast(state); - return reinterpret_cast(refrigerant)->saturatedDensity(*thisState, temperature, quality); + return reinterpret_cast(refrigerant)->getSatDensity(*thisState, temperature, quality, "C-API"); } Real64 refrigerantSaturatedSpecificHeat(EnergyPlusState state, Refrigerant refrigerant, Real64 temperature, Real64 quality) { auto *thisState = reinterpret_cast(state); - return reinterpret_cast(refrigerant)->saturatedSpecificHeat(*thisState, temperature, quality); + return reinterpret_cast(refrigerant)->getSatSpecificHeat(*thisState, temperature, quality, "C-API"); } // Real64 refrigerantSuperHeatedEnthalpy(EnergyPlusState, Refrigerant refrigerant, Real64 temperature, Real64 pressure) { // return reinterpret_cast(refrigerant)->superHeatedEnthalpy(temperature, pressure); diff --git a/src/EnergyPlus/api/func.h b/src/EnergyPlus/api/func.h index 55c2280e7d3..32a7924d111 100644 --- a/src/EnergyPlus/api/func.h +++ b/src/EnergyPlus/api/func.h @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -54,8 +54,8 @@ #ifdef __cplusplus -#include -#include +# include +# include ENERGYPLUSLIB_API void registerErrorCallback(EnergyPlusState state, std::function f); diff --git a/src/EnergyPlus/api/func.py b/src/EnergyPlus/api/func.py index 91be55d9fb1..c0d16b786af 100644 --- a/src/EnergyPlus/api/func.py +++ b/src/EnergyPlus/api/func.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/src/EnergyPlus/api/plugin.py b/src/EnergyPlus/api/plugin.py index 1cbb3f98aed..1b6e31387a8 100644 --- a/src/EnergyPlus/api/plugin.py +++ b/src/EnergyPlus/api/plugin.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/src/EnergyPlus/api/plugin_tester.py b/src/EnergyPlus/api/plugin_tester.py index d60e9fdcaf0..ead9ff908ae 100644 --- a/src/EnergyPlus/api/plugin_tester.py +++ b/src/EnergyPlus/api/plugin_tester.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/src/EnergyPlus/api/runtime.cc b/src/EnergyPlus/api/runtime.cc index 44009acb7c1..b9e9807d8c7 100644 --- a/src/EnergyPlus/api/runtime.cc +++ b/src/EnergyPlus/api/runtime.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/api/runtime.h b/src/EnergyPlus/api/runtime.h index 7b09a287d74..0258bf0ebf8 100644 --- a/src/EnergyPlus/api/runtime.h +++ b/src/EnergyPlus/api/runtime.h @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -55,8 +55,8 @@ #ifdef __cplusplus // if we are building this with C++ in mind, we can make use of these std::function based callback registration functions -#include -#include +# include +# include ENERGYPLUSLIB_API void callbackBeginNewEnvironment(EnergyPlusState state, std::function f); ENERGYPLUSLIB_API void callbackAfterNewEnvironmentWarmupComplete(EnergyPlusState state, std::function f); ENERGYPLUSLIB_API void callbackBeginZoneTimeStepBeforeInitHeatBalance(EnergyPlusState state, std::function f); diff --git a/src/EnergyPlus/api/runtime.py b/src/EnergyPlus/api/runtime.py index b9bfefc3226..f1aaf4a7012 100644 --- a/src/EnergyPlus/api/runtime.py +++ b/src/EnergyPlus/api/runtime.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/src/EnergyPlus/api/state.cc b/src/EnergyPlus/api/state.cc index ee428c64e79..af6188e6700 100644 --- a/src/EnergyPlus/api/state.cc +++ b/src/EnergyPlus/api/state.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/api/state.h b/src/EnergyPlus/api/state.h index ef832198fab..01335e8abc1 100644 --- a/src/EnergyPlus/api/state.h +++ b/src/EnergyPlus/api/state.h @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/api/state.py b/src/EnergyPlus/api/state.py index e47f2202b93..25caca90c0b 100644 --- a/src/EnergyPlus/api/state.py +++ b/src/EnergyPlus/api/state.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/src/EnergyPlus/fenv_missing.h b/src/EnergyPlus/fenv_missing.h index 3f492b65880..0d2118ef697 100644 --- a/src/EnergyPlus/fenv_missing.h +++ b/src/EnergyPlus/fenv_missing.h @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/main.cc b/src/EnergyPlus/main.cc index cffbc573080..4fd943b6c66 100644 --- a/src/EnergyPlus/main.cc +++ b/src/EnergyPlus/main.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/EnergyPlus/test_ep_as_library.cc b/src/EnergyPlus/test_ep_as_library.cc index 13a23c6d452..a8055be97e5 100644 --- a/src/EnergyPlus/test_ep_as_library.cc +++ b/src/EnergyPlus/test_ep_as_library.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/src/ExpandObjects/epfilter.f90 b/src/ExpandObjects/epfilter.f90 index 01f127b2e42..ccaf03ec7ea 100644 --- a/src/ExpandObjects/epfilter.f90 +++ b/src/ExpandObjects/epfilter.f90 @@ -2116,7 +2116,7 @@ END FUNCTION DoesGroundHeatTransferExist !---------------------------------------------------------------------------------- -SUBROUTINE AddEffectCurveHelper(fieldIdx, Eff75, Eff100, prefix) +SUBROUTINE AddEffectCurveHelper(fieldIdx, Eff75, Eff100, prefix, isSensible) ! SUBROUTINE INFORMATION: ! AUTHOR Yujie Xu ! DATE WRITTEN December 2023 @@ -2140,7 +2140,8 @@ SUBROUTINE AddEffectCurveHelper(fieldIdx, Eff75, Eff100, prefix) INTEGER,INTENT(IN) :: fieldIdx REAL,INTENT(IN) :: Eff75 REAL,INTENT(IN) :: Eff100 - CHARACTER(len=*),INTENT(IN) :: prefix ! "Sen" (Sensible) or "Lat" (Latent) + CHARACTER(len=*),INTENT(IN) :: prefix + LOGICAL,INTENT(IN) :: isSensible ! SUBROUTINE PARAMETER DEFINITIONS: ! na @@ -2154,8 +2155,12 @@ SUBROUTINE AddEffectCurveHelper(fieldIdx, Eff75, Eff100, prefix) ! SUBROUTINE LOCAL VARIABLE DECLARATIONS: ! na CALL CreateNewObj('Table:Lookup') - CALL AddToObjFld('Name', fieldIdx,' '//prefix//'EffectivenessTable') - CALL AddToObjFld('Independent Variable List Name', fieldIdx,' effIndVarList') + IF (isSensible) THEN + CALL AddToObjFld('Name', fieldIdx,''//prefix//' SenEffectivenessTable') + ELSE + CALL AddToObjFld('Name', fieldIdx,''//prefix//' LatEffectivenessTable') + END IF + CALL AddToObjFld('Independent Variable List Name', fieldIdx, ''//prefix//' effIndVarList') CALL AddToObjStr('Normalization Method', 'DivisorOnly') CALL AddToObjStr('Normalization Divisor', RealToStr(Eff100)) CALL AddToObjStr('Minimum Output', '0.0') @@ -2168,7 +2173,7 @@ SUBROUTINE AddEffectCurveHelper(fieldIdx, Eff75, Eff100, prefix) CALL AddToObjStr('Value 2', RealToStr(Eff100),.TRUE.) END SUBROUTINE -SUBROUTINE AddEffectCurveIndVar(fieldIdx) +SUBROUTINE AddEffectCurveIndVar(fieldIdx, prefix) ! SUBROUTINE INFORMATION: ! AUTHOR Yujie Xu ! DATE WRITTEN December 2023 @@ -2190,6 +2195,7 @@ SUBROUTINE AddEffectCurveIndVar(fieldIdx) ! SUBROUTINE ARGUMENT DEFINITIONS: ! the index of the name of the object, so that the generated table etc. can have unique names INTEGER,INTENT(IN) :: fieldIdx + CHARACTER(len=*),INTENT(IN) :: prefix ! SUBROUTINE PARAMETER DEFINITIONS: ! na @@ -2204,7 +2210,7 @@ SUBROUTINE AddEffectCurveIndVar(fieldIdx) ! na CALL CreateNewObj('Table:IndependentVariable') - CALL AddToObjFld('Name', fieldIdx,' airFlowRatio') + CALL AddToObjFld('Name', fieldIdx,''//prefix//' airFlowRatio') CALL AddToObjStr('Interpolation Method', 'Linear') CALL AddToObjStr('Extrapolation Method', 'Linear') CALL AddToObjStr('Minimum Value', '0.0') @@ -2217,11 +2223,11 @@ SUBROUTINE AddEffectCurveIndVar(fieldIdx) CALL AddToObjStr('Value 1', '0.75') CALL AddToObjStr('Value 2', '1.0',.TRUE.) CALL CreateNewObj('Table:IndependentVariableList') - CALL AddToObjFld('Name', fieldIdx,' effIndVarList') - CALL AddToObjFld('Independent Variable 1 Name', fieldIdx,' airFlowRatio',.TRUE.) + CALL AddToObjFld('Name', fieldIdx,''//prefix//' effIndVarList') + CALL AddToObjFld('Independent Variable 1 Name', fieldIdx,''//prefix//' airFlowRatio',.TRUE.) END SUBROUTINE -SUBROUTINE AddSenEffectCurve(fieldIdx, htRecSens75, htRecSens100) +SUBROUTINE AddSenEffectCurve(fieldIdx, htRecSens75, htRecSens100, suffix) ! SUBROUTINE INFORMATION: ! AUTHOR Yujie Xu ! DATE WRITTEN December 2023 @@ -2245,6 +2251,7 @@ SUBROUTINE AddSenEffectCurve(fieldIdx, htRecSens75, htRecSens100) INTEGER,INTENT(IN) :: fieldIdx REAL,INTENT(IN) :: htRecSens75 REAL,INTENT(IN) :: htRecSens100 + CHARACTER(len=*), INTENT(IN) :: suffix ! SUBROUTINE PARAMETER DEFINITIONS: ! na @@ -2258,17 +2265,17 @@ SUBROUTINE AddSenEffectCurve(fieldIdx, htRecSens75, htRecSens100) ! SUBROUTINE LOCAL VARIABLE DECLARATIONS: ! na - CALL AddToObjFld('Sensible Effectiveness of Heating Air Flow Curve Name', fieldIdx,' SenEffectivenessTable') + CALL AddToObjFld('Sensible Effectiveness of Heating Air Flow Curve Name', fieldIdx,''//suffix//' SenEffectivenessTable') CALL AddToObjStr('Latent Effectiveness of Heating Air Flow Curve Name', '') - CALL AddToObjFld('Sensible Effectiveness of Cooling Air Flow Curve Name', fieldIdx,' SenEffectivenessTable') + CALL AddToObjFld('Sensible Effectiveness of Cooling Air Flow Curve Name', fieldIdx,''//suffix//' SenEffectivenessTable') CALL AddToObjStr('Latent Effectiveness of Cooling Air Flow Curve Name', '',.TRUE.) ! create curve objects for the heat exchanger start - CALL AddEffectCurveIndVar(fieldIdx) - CALL AddEffectCurveHelper(fieldIdx, htRecSens75, htRecSens100, 'Sen') + CALL AddEffectCurveIndVar(fieldIdx, suffix) + CALL AddEffectCurveHelper(fieldIdx, htRecSens75, htRecSens100, suffix, .TRUE.) ! create curve objects for the heat exchanger end END SUBROUTINE -SUBROUTINE AddSenLatEffectCurve(fieldIdx, htRecSens75, htRecSens100, htRecLat75, htRecLat100) +SUBROUTINE AddSenLatEffectCurve(fieldIdx, htRecSens75, htRecSens100, htRecLat75, htRecLat100, suffix) ! SUBROUTINE INFORMATION: ! AUTHOR Yujie Xu ! DATE WRITTEN December 2023 @@ -2294,6 +2301,7 @@ SUBROUTINE AddSenLatEffectCurve(fieldIdx, htRecSens75, htRecSens100, htRecLat75, REAL,INTENT(IN) :: htRecSens100 REAL,INTENT(IN) :: htRecLat75 REAL,INTENT(IN) :: htRecLat100 + CHARACTER(len=*), INTENT(IN) :: suffix ! SUBROUTINE PARAMETER DEFINITIONS: ! na @@ -2307,15 +2315,14 @@ SUBROUTINE AddSenLatEffectCurve(fieldIdx, htRecSens75, htRecSens100, htRecLat75, ! SUBROUTINE LOCAL VARIABLE DECLARATIONS: ! na - CALL AddToObjFld('Sensible Effectiveness of Heating Air Flow Curve Name', fieldIdx,' SenEffectivenessTable') - CALL AddToObjFld('Latent Effectiveness of Heating Air Flow Curve Name', fieldIdx,' LatEffectivenessTable') - CALL AddToObjFld('Sensible Effectiveness of Cooling Air Flow Curve Name', fieldIdx,' SenEffectivenessTable') - CALL AddToObjFld('Latent Effectiveness of Cooling Air Flow Curve Name', fieldIdx,' LatEffectivenessTable',.TRUE.) + CALL AddToObjFld('Sensible Effectiveness of Heating Air Flow Curve Name', fieldIdx,''//suffix//' SenEffectivenessTable') + CALL AddToObjFld('Latent Effectiveness of Heating Air Flow Curve Name', fieldIdx,''//suffix//' LatEffectivenessTable') + CALL AddToObjFld('Sensible Effectiveness of Cooling Air Flow Curve Name', fieldIdx,''//suffix//' SenEffectivenessTable') + CALL AddToObjFld('Latent Effectiveness of Cooling Air Flow Curve Name', fieldIdx,''//suffix//' LatEffectivenessTable',.TRUE.) ! create curve objects for the heat exchanger start - CALL AddEffectCurveIndVar(fieldIdx) - CALL AddEffectCurveHelper(fieldIdx, htRecSens75, htRecSens100, 'Sen') - CALL AddEffectCurveHelper(fieldIdx, htRecLat75, htRecLat100, 'Lat') - ! create curve objects for the heat exchanger end + CALL AddEffectCurveIndVar(fieldIdx, suffix) + CALL AddEffectCurveHelper(fieldIdx, htRecSens75, htRecSens100, suffix, .TRUE.) + CALL AddEffectCurveHelper(fieldIdx, htRecLat75, htRecLat100, suffix, .FALSE.) ! create curve objects for the heat exchanger end END SUBROUTINE !---------------------------------------------------------------------------------- @@ -11599,7 +11606,7 @@ SUBROUTINE CreateNewVAV CALL AddToObjStr('Initial Defrost Time Fraction','0.167') CALL AddToObjStr('Rate of Defrost Time Fraction Increase','0.024') CALL AddToObjStr('Economizer Lockout','') - CALL AddSenEffectCurve(base + vsAirHandlerNameOff, htRecSens75, htRecSens100) + CALL AddSenEffectCurve(base + vsAirHandlerNameOff, htRecSens75, htRecSens100, ' Heat Recovery') ELSEIF (heatRecovery .EQ. htrecEnth) THEN !HEAT EXCHANGER:AIR TO AIR:GENERIC ~ line 708 htRecSens75 = StringToReal(FldVal(base + vsHeatRecSenEffOff)) + 0.05 @@ -11631,7 +11638,7 @@ SUBROUTINE CreateNewVAV CALL AddToObjStr('Initial Defrost Time Fraction','') CALL AddToObjStr('Rate of Defrost Time Fraction Increase','') CALL AddToObjStr('Economizer Lockout','') - CALL AddSenLatEffectCurve(base + vsAirHandlerNameOff, htRecSens75, htRecSens100, htRecLat75, htRecLat100) + CALL AddSenLatEffectCurve(base + vsAirHandlerNameOff, htRecSens75, htRecSens100, htRecLat75, htRecLat100, ' Heat Recovery') END IF !SET POINT MANAGER:SCHEDULED ~ line 734 IF (heatRecovery .NE. htrecNone) THEN @@ -13142,7 +13149,7 @@ SUBROUTINE CreateNewVAV CALL AddToObjStr('Initial Defrost Time Fraction','0.167') CALL AddToObjStr('Rate of Defrost Time Fraction Increase','0.024') CALL AddToObjStr('Economizer Lockout','') - CALL AddSenEffectCurve(base + pvavsAirHandlerNameOff, htRecSens75, htRecSens100) + CALL AddSenEffectCurve(base + pvavsAirHandlerNameOff, htRecSens75, htRecSens100, ' Heat Recovery') ELSEIF (heatRecovery .EQ. htrecEnth) THEN htRecSens75 = StringToReal(FldVal(base + pvavsHeatRecSenEffOff)) + 0.05 htRecSens100 = StringToReal(FldVal(base + pvavsHeatRecSenEffOff)) @@ -13173,7 +13180,7 @@ SUBROUTINE CreateNewVAV CALL AddToObjStr('Initial Defrost Time Fraction','') CALL AddToObjStr('Rate of Defrost Time Fraction Increase','') CALL AddToObjStr('Economizer Lockout','') - CALL AddSenLatEffectCurve(base + pvavsAirHandlerNameOff, htRecSens75, htRecSens100, htRecLat75, htRecLat100) + CALL AddSenLatEffectCurve(base + pvavsAirHandlerNameOff, htRecSens75, htRecSens100, htRecLat75, htRecLat100, ' Heat Recovery') END IF IF (heatRecovery .NE. htrecNone) THEN IF (isEconoLowLimitBlank) THEN @@ -14696,7 +14703,7 @@ SUBROUTINE CreateNewUnitary CALL AddToObjStr('Initial Defrost Time Fraction','0.167') CALL AddToObjStr('Rate of Defrost Time Fraction Increase','0.024') CALL AddToObjStr('Economizer Lockout','') - CALL AddSenEffectCurve(base + usAirHandlerNameOff, htRecSens75, htRecSens100) + CALL AddSenEffectCurve(base + usAirHandlerNameOff, htRecSens75, htRecSens100, ' Heat Recovery') END IF IF (isHeatRecEnthalpy) THEN htRecSens75 = StringToReal(FldVal(base + usHeatRecSenEffOff)) + 0.05 @@ -14727,7 +14734,7 @@ SUBROUTINE CreateNewUnitary CALL AddToObjStr('Initial Defrost Time Fraction','') CALL AddToObjStr('Rate of Defrost Time Fraction Increase','') CALL AddToObjStr('Economizer Lockout','') - CALL AddSenLatEffectCurve(base + usAirHandlerNameOff, htRecSens75, htRecSens100, htRecLat75, htRecLat100) + CALL AddSenLatEffectCurve(base + usAirHandlerNameOff, htRecSens75, htRecSens100, htRecLat75, htRecLat100, ' Heat Recovery') END IF IF (.NOT. isHeatRecNone) THEN IF (isEconoLowLimitBlank) THEN @@ -15631,7 +15638,7 @@ SUBROUTINE CreateNewUnitary CALL AddToObjStr('Initial Defrost Time Fraction','0.167') CALL AddToObjStr('Rate of Defrost Time Fraction Increase','0.024') CALL AddToObjStr('Economizer Lockout','') - CALL AddSenEffectCurve(base + uhpsAirHandlerNameOff, htRecSens75, htRecSens100) + CALL AddSenEffectCurve(base + uhpsAirHandlerNameOff, htRecSens75, htRecSens100, ' Heat Recovery') END IF IF (isHeatRecEnthalpy) THEN htRecSens75 = StringToReal(FldVal(base + uhpsHeatRecSenEffOff)) + 0.05 @@ -15663,7 +15670,7 @@ SUBROUTINE CreateNewUnitary CALL AddToObjStr('Initial Defrost Time Fraction','') CALL AddToObjStr('Rate of Defrost Time Fraction Increase','') CALL AddToObjStr('Economizer Lockout','') - CALL AddSenLatEffectCurve(base + uhpsAirHandlerNameOff, htRecSens75, htRecSens100, htRecLat75, htRecLat100) + CALL AddSenLatEffectCurve(base + uhpsAirHandlerNameOff, htRecSens75, htRecSens100, htRecLat75, htRecLat100, ' Heat Recovery') END IF IF (.NOT. isHeatRecNone) THEN IF (isEconoLowLimitBlank) THEN @@ -16937,7 +16944,7 @@ SUBROUTINE CreateNewUnitary CALL AddToObjStr('Rate of Defrost Time Fraction Increase {1/K}','') ! MJW ???? - Not sure CALL AddToObjStr('Economizer Lockout','No') - CALL AddSenEffectCurve(base + ussAirHandlerNameOff, 0.75, 0.7) + CALL AddSenEffectCurve(base + ussAirHandlerNameOff, 0.75, 0.7, ' Cooling Coil Heat Exchanger') !***Coil:Cooling:Water CALL CreateNewObj('Coil:Cooling:Water') CALL AddToObjFld('Name', base + ussAirHandlerNameOff,' Cooling Coil') @@ -16985,7 +16992,7 @@ SUBROUTINE CreateNewUnitary CALL AddToObjStr('Rate of Defrost Time Fraction Increase {1/K}','') ! MJW ???? - Not sure CALL AddToObjStr('Economizer Lockout','No') - CALL AddSenEffectCurve(base + ussAirHandlerNameOff, 0.75, 0.7) + CALL AddSenEffectCurve(base + ussAirHandlerNameOff, 0.75, 0.7, ' Cooling Coil Heat Exchanger') !***Coil:Cooling:DX:SingleSpeed CALL CreateNewObj('Coil:Cooling:DX:SingleSpeed') CALL AddToObjFld('Name', base + ussAirHandlerNameOff,' Cooling Coil') @@ -18201,7 +18208,7 @@ SUBROUTINE CreateNewUnitary CALL AddToObjStr('Initial Defrost Time Fraction','0.167') CALL AddToObjStr('Rate of Defrost Time Fraction Increase','0.024') CALL AddToObjStr('Economizer Lockout','') - CALL AddSenEffectCurve(base + ussAirHandlerNameOff, htRecSens75, htRecSens100) + CALL AddSenEffectCurve(base + ussAirHandlerNameOff, htRecSens75, htRecSens100,' Heat Recovery') END IF IF (isHeatRecEnthalpy) THEN htRecSens75 = StringToReal(FldVal(base + ussHeatRecSenEffOff)) + 0.05 @@ -18233,7 +18240,7 @@ SUBROUTINE CreateNewUnitary CALL AddToObjStr('Initial Defrost Time Fraction','') CALL AddToObjStr('Rate of Defrost Time Fraction Increase','') CALL AddToObjStr('Economizer Lockout','') - CALL AddSenLatEffectCurve(base + ussAirHandlerNameOff, htRecSens75, htRecSens100, htRecLat75, htRecLat100) + CALL AddSenLatEffectCurve(base + ussAirHandlerNameOff, htRecSens75, htRecSens100, htRecLat75, htRecLat100, ' Heat Recovery') END IF IF (.NOT. isHeatRecNone) THEN IF (isEconoLowLimitBlank) THEN @@ -19906,7 +19913,7 @@ SUBROUTINE CreateNewConstVol CALL AddToObjStr('Rate of Defrost Time Fraction Increase {1/K}','') ! MJW ???? - Not sure CALL AddToObjStr('Economizer Lockout','No') - CALL AddSenEffectCurve(base + cvsAirHandlerNameOff, 0.75, 0.7) + CALL AddSenEffectCurve(base + cvsAirHandlerNameOff, 0.75, 0.7,' Cooling Coil Heat Exchanger') !***Coil:Cooling:Water CALL CreateNewObj('Coil:Cooling:Water') CALL AddToObjFld('Name', base + cvsAirHandlerNameOff,' Cooling Coil') @@ -20471,7 +20478,7 @@ SUBROUTINE CreateNewConstVol CALL AddToObjStr('Initial Defrost Time Fraction','0.083') CALL AddToObjStr('Rate of Defrost Time Fraction Increase','0.012') CALL AddToObjStr('Economizer Lockout','Yes') - CALL AddSenEffectCurve(base + cvsAirHandlerNameOff, htRecSens75, htRecSens100) + CALL AddSenEffectCurve(base + cvsAirHandlerNameOff, htRecSens75, htRecSens100,' Heat Recovery') ELSEIF (heatRecovery .EQ. htrecEnth) THEN htRecSens75 = StringToReal(FldVal(base + cvsHeatRecSenEffOff)) + 0.05 htRecSens100 = StringToReal(FldVal(base + cvsHeatRecSenEffOff)) @@ -20502,7 +20509,7 @@ SUBROUTINE CreateNewConstVol CALL AddToObjStr('Initial Defrost Time Fraction','0.083') CALL AddToObjStr('Rate of Defrost Time Fraction Increase','0.012') CALL AddToObjStr('Economizer Lockout','Yes') - CALL AddSenLatEffectCurve(base + cvsAirHandlerNameOff, htRecSens75, htRecSens100, htRecLat75, htRecLat100) + CALL AddSenLatEffectCurve(base + cvsAirHandlerNameOff, htRecSens75, htRecSens100, htRecLat75, htRecLat100, ' Heat Recovery') END IF IF (heatRecovery .NE. htrecNone) THEN IF (isEconoLowLimitBlank) THEN @@ -22677,7 +22684,7 @@ SUBROUTINE CreateNewDualDuct CALL AddToObjStr('Initial Defrost Time Fraction','0.167') CALL AddToObjStr('Rate of Defrost Time Fraction Increase','0.024') CALL AddToObjStr('Economizer Lockout','') - CALL AddSenEffectCurve(base + ddsAirHandlerNameOff, htRecSens75, htRecSens100) + CALL AddSenEffectCurve(base + ddsAirHandlerNameOff, htRecSens75, htRecSens100,' Heat Recovery') ELSEIF (heatRecovery .EQ. htrecEnth) THEN !HEAT EXCHANGER:AIR TO AIR:GENERIC ~ line 708 htRecSens75 = StringToReal(FldVal(base + ddsHeatRecSenEffOff)) + 0.05 @@ -22708,7 +22715,7 @@ SUBROUTINE CreateNewDualDuct CALL AddToObjStr('Initial Defrost Time Fraction','') CALL AddToObjStr('Rate of Defrost Time Fraction Increase','') CALL AddToObjStr('Economizer Lockout','') - CALL AddSenLatEffectCurve(base + ddsAirHandlerNameOff, htRecSens75, htRecSens100, htRecLat75, htRecLat100) + CALL AddSenLatEffectCurve(base + ddsAirHandlerNameOff, htRecSens75, htRecSens100, htRecLat75, htRecLat100, ' Heat Recovery') END IF !SET POINT MANAGER:SCHEDULED ~ line 734 IF (heatRecovery .NE. htrecNone) THEN @@ -24254,7 +24261,7 @@ SUBROUTINE CreateFanCoil CALL AddToObjStr('Rate of Defrost Time Fraction Increase {1/K}','') ! MJW ???? - Not sure CALL AddToObjStr('Economizer Lockout','No') - CALL AddSenEffectCurve(base + fczNameOff, 0.75, 0.7) + CALL AddSenEffectCurve(base + fczNameOff, 0.75, 0.7,' Cooling Coil Heat Exchanger') CALL CreateNewObj('Coil:Cooling:Water') CALL AddToObjFld('Name', base + fczNameOff,' Cooling Coil') CALL AddToObjFld('Availability Schedule Name', base + fczCoolAvailSchedNameOff,'') @@ -26459,7 +26466,7 @@ SUBROUTINE CreateBoiler END IF ELSE !PURCHASED:HOT WATER ~ line 33 - CALL CreateNewObj('DistrictHeating') + CALL CreateNewObj('DistrictHeating:Water') CALL AddToObjFld('Name', base + blrNameOff,'') CALL AddToObjFld('Plant_Loop_Inlet_Node', base + blrNameOff,' HW Inlet') CALL AddToObjFld('Plant_Loop_Outlet_Node', base + blrNameOff,' HW Outlet') @@ -26479,7 +26486,7 @@ SUBROUTINE CreateBoiler ENDIF CALL AddToObjStr('Pressure Drop Curve Name','') IF (.NOT. isPumpBranch) THEN - CALL AddToObjStr('Component Object Type','DistrictHeating') + CALL AddToObjStr('Component Object Type','DistrictHeating:Water') CALL AddToObjFld('Component Name', base + blrNameOff,'') CALL AddToObjFld('Component Inlet Node Name', base + blrNameOff,' HW Inlet') CALL AddToObjFld('Component Outlet Node Name', base + blrNameOff,' HW Outlet',.TRUE.) @@ -26492,7 +26499,7 @@ SUBROUTINE CreateBoiler CALL AddToObjFld('Component Name', base + blrNameOff,' Branch Pump') CALL AddToObjFld('Component Inlet Node Name', base + blrNameOff,' HW Pump Inlet') CALL AddToObjFld('Component Outlet Node Name', base + blrNameOff,' HW Inlet') - CALL AddToObjStr('Component Object Type','DistrictHeating') + CALL AddToObjStr('Component Object Type','DistrictHeating:Water') CALL AddToObjFld('Component Name', base + blrNameOff,'') CALL AddToObjFld('Component Inlet Node Name', base + blrNameOff,' HW Inlet') CALL AddToObjFld('Component Outlet Node Name', base + blrNameOff,' HW Outlet',.TRUE.) @@ -26906,7 +26913,7 @@ SUBROUTINE CreateHotLoop !If blrTypeOff="Hot Water Boiler" then this field is "BOILER:SIMPLE" !If blrTypeOff="Purchased Hot Water" then this field is "PURCHASED:HOT WATER" IF (SameString(FldVal(boilerBase + blrTypeOff),'DistrictHotWater')) THEN - CALL AddToObjStr('Equipment Object Type', 'DistrictHeating') + CALL AddToObjStr('Equipment Object Type', 'DistrictHeating:Water') ELSE CALL AddToObjStr('Equipment Object Type', 'Boiler:HotWater') END IF @@ -30896,7 +30903,7 @@ SUBROUTINE CreateMixedLoop !If blrTypeOff="Hot Water Boiler" then this field is "BOILER:SIMPLE" !If blrTypeOff="Purchased Hot Water" then this field is "PURCHASED:HOT WATER" IF (SameString(FldVal(boilerBase + blrTypeOff),'DistrictHotWater')) THEN - CALL AddToObjStr('Equipment Object Type', 'DistrictHeating') + CALL AddToObjStr('Equipment Object Type', 'DistrictHeating:Water') ELSE CALL AddToObjStr('Equipment Object Type', 'Boiler:HotWater') END IF @@ -32448,7 +32455,7 @@ SUBROUTINE CreateDOAS CALL AddToObjStr('Rate of Defrost Time Fraction Increase {1/K}','') ! MJW ???? - Not sure CALL AddToObjStr('Economizer Lockout','No') - CALL AddSenEffectCurve(base + doasNameOff, 0.75, 0.7) + CALL AddSenEffectCurve(base + doasNameOff, 0.75, 0.7,' Cooling Coil Heat Exchanger') !***Coil:Cooling:Water CALL CreateNewObj('Coil:Cooling:Water') CALL AddToObjFld('Name', base + doasNameOff,' Cooling Coil') @@ -32535,7 +32542,7 @@ SUBROUTINE CreateDOAS CALL AddToObjStr('Rate of Defrost Time Fraction Increase {1/K}','') ! MJW ???? - Not sure CALL AddToObjStr('Economizer Lockout','No') - CALL AddSenEffectCurve(base + doasNameOff, 0.75, 0.7) + CALL AddSenEffectCurve(base + doasNameOff, 0.75, 0.7,' Cooling Coil Heat Exchanger') !***Coil:Cooling:DX:SingleSpeed CALL CreateNewObj('Coil:Cooling:DX:SingleSpeed') CALL AddToObjFld('Name', base + doasNameOff,' Cooling Coil') @@ -32969,7 +32976,7 @@ SUBROUTINE CreateDOAS CALL AddToObjStr('Initial Defrost Time Fraction','0.083') CALL AddToObjStr('Rate of Defrost Time Fraction Increase','0.012') CALL AddToObjStr('Economizer Lockout','Yes') - CALL AddSenEffectCurve(base + doasNameOff, htRecSens75, htRecSens100) + CALL AddSenEffectCurve(base + doasNameOff, htRecSens75, htRecSens100, ' Heat Recovery') ELSEIF (heatRecovery .EQ. htrecEnth) THEN htRecSens75 = StringToReal(FldVal(base + doasHeatRecSenEffOff)) + 0.05 htRecSens100 = StringToReal(FldVal(base + doasHeatRecSenEffOff)) @@ -33000,7 +33007,7 @@ SUBROUTINE CreateDOAS CALL AddToObjStr('Initial Defrost Time Fraction','0.083') CALL AddToObjStr('Rate of Defrost Time Fraction Increase','0.012') CALL AddToObjStr('Economizer Lockout','Yes') - CALL AddSenLatEffectCurve(base + doasNameOff, htRecSens75, htRecSens100, htRecLat75, htRecLat100) + CALL AddSenLatEffectCurve(base + doasNameOff, htRecSens75, htRecSens100, htRecLat75, htRecLat100, ' Heat Recovery') END IF IF (heatRecovery .NE. htrecNone) THEN !***SetpointManager:MixedAir for Heat Recovery Outlet - Reference heating coil setpoint diff --git a/src/Transition/OutputRulesFiles/OutputChanges24-2-0-to-25-1-0.md b/src/Transition/OutputRulesFiles/OutputChanges24-2-0-to-25-1-0.md index 2fe8ffb55ce..6ff81b47f69 100644 --- a/src/Transition/OutputRulesFiles/OutputChanges24-2-0-to-25-1-0.md +++ b/src/Transition/OutputRulesFiles/OutputChanges24-2-0-to-25-1-0.md @@ -6,3 +6,32 @@ This file documents the structural changes on the output of EnergyPlus that coul ### Description This will eventually become a more structured file, but currently it isn't clear what format is best. As an intermediate solution, and to allow the form to be formed organically, this plain text file is being used. Entries should be clearly delimited. It isn't expected that there will be but maybe a couple each release at most. Entries should also include some reference back to the repo. At least a PR number or whatever. + +### Output:Constructions for WindowMaterial:Shade +Data for Output:Constructions for WindowMaterial:Shade were misaligned with the column headings in the eio output and the table Initialization Summary report. Data has shifted one column to the left. + +See PR [#10750](https://github.com/NREL/EnergyPlus/pull/10750) + +### Table Output, Sizing Output, and Output:Variable Spelling Corrections +* "Equipment Summary" table report, sub-table "VAV DX Cooling Standard Rating Details", column heading, "Assocated Fan" --> "Associated Fan". + +* "Equipment Summary" table report, sub-table "Air Heat Recovery", column "Input object type", "Dessicant Balanced" --> "Desiccant Balanced" (for object type HeatExchanger:Desiccant:BalancedFlow). + +* Output:Variable "Zone Hybrid Unitary HVAC DehumidificationLoad to Humidistat Setpoint Heat Tansfer Energy" --> "Zone Hybrid Unitary HVAC Dehumidification Load to Humidistat Setpoint Heat Transfer Energy". + +* Output:Variable "Zone Hybrid Unitary HVAC Humidification Load to Humidistat Setpoint Heat Tansfer Energy" --> "Zone Hybrid Unitary HVAC Humidification Load to Humidistat Setpoint Heat Transfer Energy". + +* Sizing output for ZoneHVAC:Baseboard:RadiantConvective:Steam, "User-Speicified Maximum Steam Flow Rate [m3/s]" --> "User-Specified Maximum Steam Flow Rate [m3/s]". + +* Sizing output for Chiller:Absorption, "Iniital Design Size Design Generator Fluid Flow Rate [m3/s]" --> "Initial Design Size Design Generator Fluid Flow Rate [m3/s]" + +* eio output header for "\", "Contruction" --> "Construction". Also appears in the "Initialization Summary" table output, "ShadingProperty Reflectance" sub-table, column heading. + +See Pull Request [#10760](https://github.com/NREL/EnergyPlus/pull/10760). + +### Table Output, Envelope Summary Report, Add Space and Zone Columns +* Added a column for *Space* to sub-tables "Opaque Exterior" and "Opaque Interior". + +* Added columns for *Zone* and *Space* to sub-tables "Exterior Fenestration", "Interior Fenestration", "Exterior Door", and "Interior Door". + +See Pull Request [#10914](https://github.com/NREL/EnergyPlus/pull/10914). diff --git a/src/Transition/SupportFiles/Report Variables 24-2-0 to 25-1-0.csv b/src/Transition/SupportFiles/Report Variables 24-2-0 to 25-1-0.csv index e5711517e60..07515537716 100644 --- a/src/Transition/SupportFiles/Report Variables 24-2-0 to 25-1-0.csv +++ b/src/Transition/SupportFiles/Report Variables 24-2-0 to 25-1-0.csv @@ -1,2 +1,4 @@ 24.2.0,25.1.0,Transition notes - some of these are EMS variable names -0,0,These numbers should be the number of report variables in the following list (including deletes). Two columns/numbers. +2,2,These numbers should be the number of report variables in the following list (including deletes). Two columns/numbers. +Zone Hybrid Unitary HVAC DehumidificationLoad to Humidistat Setpoint Heat Tansfer Energy,Zone Hybrid Unitary HVAC Dehumidification Load to Humidistat Setpoint Heat Transfer Energy, +Zone Hybrid Unitary HVAC Humidification Load to Humidistat Setpoint Heat Tansfer Energy,Zone Hybrid Unitary HVAC Humidification Load to Humidistat Setpoint Heat Transfer Energy, diff --git a/src/Transition/table_convert.py b/src/Transition/table_convert.py index a6ce6993384..d63be6b6f90 100644 --- a/src/Transition/table_convert.py +++ b/src/Transition/table_convert.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/src/Transition/transition_coil_heating_gas.py b/src/Transition/transition_coil_heating_gas.py index f90113eb72a..0e6db96409d 100644 --- a/src/Transition/transition_coil_heating_gas.py +++ b/src/Transition/transition_coil_heating_gas.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/testfiles/API/tk_gui_demonstration.py b/testfiles/API/tk_gui_demonstration.py index 29d9c31138d..bc21ada7137 100644 --- a/testfiles/API/tk_gui_demonstration.py +++ b/testfiles/API/tk_gui_demonstration.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/testfiles/API/user_defined_equipment.py b/testfiles/API/user_defined_equipment.py index 6fbf723a185..a00007321ae 100644 --- a/testfiles/API/user_defined_equipment.py +++ b/testfiles/API/user_defined_equipment.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/testfiles/ASHRAE901_RetailStripmall_STD2019_Denver.idf b/testfiles/ASHRAE901_RetailStripmall_STD2019_Denver.idf index 21ca4ead73d..724fc52a0e8 100644 --- a/testfiles/ASHRAE901_RetailStripmall_STD2019_Denver.idf +++ b/testfiles/ASHRAE901_RetailStripmall_STD2019_Denver.idf @@ -852,7 +852,7 @@ Until: 24:00,23.89, !- Field 23 For: Sunday Holidays AllOtherDays, !- Field 25 Until: 8:00,29.44, !- Field 26 - Until: 8:00,26.67, !- Field 28 + Until: 8:00,26.67, !- Field 28 Is this supposed to be 9:00? Until: 23:00,23.89, !- Field 30 Until: 24:00,23.89; !- Field 32 diff --git a/testfiles/CMakeLists.txt b/testfiles/CMakeLists.txt index 2b5a88dc5e9..16419d0c563 100644 --- a/testfiles/CMakeLists.txt +++ b/testfiles/CMakeLists.txt @@ -889,6 +889,15 @@ if (BUILD_FORTRAN) -x COST 2) + add_simulation_test( + IDF_FILE + HVACTemplate-5ZonePTAC-DOAS-TwoHX.idf + EPW_FILE + USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw + ENERGYPLUS_FLAGS + -x + COST + 2) add_simulation_test( IDF_FILE HVACTemplate-5ZonePTAC.idf diff --git a/testfiles/DOAToPTHP.idf b/testfiles/DOAToPTHP.idf index fd1b9db07b8..13c9afbe689 100644 --- a/testfiles/DOAToPTHP.idf +++ b/testfiles/DOAToPTHP.idf @@ -2185,36 +2185,31 @@ SPACE1-1 Contaminant Controller, !- Name SPACE1-1, !- Zone Name HVACTemplate-Always 1, !- Carbon Dioxide Control Availability Schedule Name - Zone Setpoint CO2 Concentration, !- Carbon Dioxide Setpoint Schedule Name - Zone Minimum CO2 Concentration; !- Minimum Carbon Dioxide Concentration Schedule Name + Zone Setpoint CO2 Concentration; !- Carbon Dioxide Setpoint Schedule Name ZoneControl:ContaminantController, SPACE2-1 Contaminant Controller, !- Name SPACE2-1, !- Zone Name HVACTemplate-Always 1, !- Carbon Dioxide Control Availability Schedule Name - Zone Setpoint CO2 Concentration, !- Carbon Dioxide Setpoint Schedule Name - Zone Minimum CO2 Concentration; !- Minimum Carbon Dioxide Concentration Schedule Name + Zone Setpoint CO2 Concentration; !- Carbon Dioxide Setpoint Schedule Name ZoneControl:ContaminantController, SPACE3-1 Contaminant Controller, !- Name SPACE3-1, !- Zone Name HVACTemplate-Always 1, !- Carbon Dioxide Control Availability Schedule Name - Zone Setpoint CO2 Concentration, !- Carbon Dioxide Setpoint Schedule Name - Zone Minimum CO2 Concentration; !- Minimum Carbon Dioxide Concentration Schedule Name + Zone Setpoint CO2 Concentration; !- Carbon Dioxide Setpoint Schedule Name ZoneControl:ContaminantController, SPACE4-1 Contaminant Controller, !- Name SPACE4-1, !- Zone Name HVACTemplate-Always 1, !- Carbon Dioxide Control Availability Schedule Name - Zone Setpoint CO2 Concentration, !- Carbon Dioxide Setpoint Schedule Name - Zone Minimum CO2 Concentration; !- Minimum Carbon Dioxide Concentration Schedule Name + Zone Setpoint CO2 Concentration; !- Carbon Dioxide Setpoint Schedule Name ZoneControl:ContaminantController, SPACE5-1 Contaminant Controller, !- Name SPACE5-1, !- Zone Name HVACTemplate-Always 1, !- Carbon Dioxide Control Availability Schedule Name - Zone Setpoint CO2 Concentration, !- Carbon Dioxide Setpoint Schedule Name - Zone Minimum CO2 Concentration; !- Minimum Carbon Dioxide Concentration Schedule Name + Zone Setpoint CO2 Concentration; !- Carbon Dioxide Setpoint Schedule Name !- =========== ALL OBJECTS IN CLASS: THERMOSTATSETPOINT:DUALSETPOINT =========== diff --git a/testfiles/DOAToUnitarySystem.idf b/testfiles/DOAToUnitarySystem.idf index 0320ca95ba3..1fb88b51627 100644 --- a/testfiles/DOAToUnitarySystem.idf +++ b/testfiles/DOAToUnitarySystem.idf @@ -2257,36 +2257,31 @@ SPACE1-1 Contaminant Controller, !- Name SPACE1-1, !- Zone Name HVACTemplate-Always 1, !- Carbon Dioxide Control Availability Schedule Name - Zone Setpoint CO2 Concentration, !- Carbon Dioxide Setpoint Schedule Name - Zone Minimum CO2 Concentration; !- Minimum Carbon Dioxide Concentration Schedule Name + Zone Setpoint CO2 Concentration; !- Carbon Dioxide Setpoint Schedule Name ZoneControl:ContaminantController, SPACE2-1 Contaminant Controller, !- Name SPACE2-1, !- Zone Name HVACTemplate-Always 1, !- Carbon Dioxide Control Availability Schedule Name - Zone Setpoint CO2 Concentration, !- Carbon Dioxide Setpoint Schedule Name - Zone Minimum CO2 Concentration; !- Minimum Carbon Dioxide Concentration Schedule Name + Zone Setpoint CO2 Concentration; !- Carbon Dioxide Setpoint Schedule Name ZoneControl:ContaminantController, SPACE3-1 Contaminant Controller, !- Name SPACE3-1, !- Zone Name HVACTemplate-Always 1, !- Carbon Dioxide Control Availability Schedule Name - Zone Setpoint CO2 Concentration, !- Carbon Dioxide Setpoint Schedule Name - Zone Minimum CO2 Concentration; !- Minimum Carbon Dioxide Concentration Schedule Name + Zone Setpoint CO2 Concentration; !- Carbon Dioxide Setpoint Schedule Name ZoneControl:ContaminantController, SPACE4-1 Contaminant Controller, !- Name SPACE4-1, !- Zone Name HVACTemplate-Always 1, !- Carbon Dioxide Control Availability Schedule Name - Zone Setpoint CO2 Concentration, !- Carbon Dioxide Setpoint Schedule Name - Zone Minimum CO2 Concentration; !- Minimum Carbon Dioxide Concentration Schedule Name + Zone Setpoint CO2 Concentration; !- Carbon Dioxide Setpoint Schedule Name ZoneControl:ContaminantController, SPACE5-1 Contaminant Controller, !- Name SPACE5-1, !- Zone Name HVACTemplate-Always 1, !- Carbon Dioxide Control Availability Schedule Name - Zone Setpoint CO2 Concentration, !- Carbon Dioxide Setpoint Schedule Name - Zone Minimum CO2 Concentration; !- Minimum Carbon Dioxide Concentration Schedule Name + Zone Setpoint CO2 Concentration; !- Carbon Dioxide Setpoint Schedule Name !- =========== ALL OBJECTS IN CLASS: THERMOSTATSETPOINT:DUALSETPOINT =========== diff --git a/testfiles/HVACTemplate-5ZonePTAC-DOAS-TwoHX.idf b/testfiles/HVACTemplate-5ZonePTAC-DOAS-TwoHX.idf new file mode 100644 index 00000000000..b3951ec8323 --- /dev/null +++ b/testfiles/HVACTemplate-5ZonePTAC-DOAS-TwoHX.idf @@ -0,0 +1,2109 @@ +!-Generator IDFEditor 1.40 +!-Option OriginalOrderTop +!-NOTE: All comments with '!-' are ignored by the IDFEditor and are generated automatically. +!- Use '!' comments if they need to be retained when using the IDFEditor. +! HVACTemplate-5ZonePTAC-DOAS.idf +! Basic file description: 1 story building divided into 4 exterior and one interior conditioned zones and return plenum +! illustrates the use of HVACTemplate objects to define zone thermostats and +! PTAC (packaged terminal air conditioner) units with electric heat and a dedicated +! outdoor air system (DOAS) with gas heat and dehumidification controls. +! Highlights: HVACTemplate PTACs with DOAS. Uses a HeatExchangerAssistedDX AND Heat Recovery Type = Enthalpy +! Which highlights issue #10895 +! +! Simulation Location/Run: CHICAGO_IL_USA TMY2-94846, 2 design days, 2 run periods, +! Run Control executes the run periods using the weather file +! +! Location: Chicago, IL +! +! Design Days: CHICAGO_IL_USA Annual Heating 99% Design Conditions DB, MaxDB= -17.3°C +! CHICAGO_IL_USA Annual Cooling 1% Design Conditions, MaxDB= 31.5°C MCWB= 23.0°C +! +! Run Period (Weather File): Winter 1/14, Summer 7/7, CHICAGO_IL_USA TMY2-94846 +! +! Run Control: Zone and System sizing with weather file run control (no design days run) +! +! Building: Single floor rectangular building 100 ft x 50 ft. 5 zones - 4 exterior, 1 interior, zone height 8 feet. +! Exterior zone depth is 12 feet. There is a 2 foot high return plenum: the overall building height is +! 10 feet. There are windows on all 4 facades; the south and north facades have glass doors. +! The south facing glass is shaded by overhangs. The walls are woodshingle over plywood, R11 insulation, +! and gypboard. The roof is a gravel built up roof with R-3 mineral board insulation and plywood sheathing. +! The windows are of various single and double pane construction with 3mm and 6mm glass and either 6mm or +! 13mm argon or air gap. The window to wall ratio is approximately 0.29. +! The south wall and door have overhangs. +! +! The building is oriented 30 degrees east of north. +! +! Floor Area: 463.6 m2 (5000 ft2) +! Number of Stories: 1 +! +! Zone Description Details: +! +! (0,15.2,0) (30.5,15.2,0) +! _____ ________ ____ +! |\ *** **************** /| +! | \ / | +! | \ (26.8,11.6,0) / | +! * \_____________________________/ * +! * |(3.7,11.6,0) | * +! * | | * +! * | | * +! * | (26.8,3.7,0)| * +! * |___________________________| * +! * / (3.7,3.7,0) \ * +! | / \ | +! | / \ | +! |/___******************___***________\| +! | Overhang | | +! |_______________________| | window/door = * +! |___| +! +! (0,0,0) (30.5,0,0) +! +! Internal gains description: lighting is 1.5 watts/ft2, office equip is 1.0 watts/ft2. There is 1 occupant +! per 100 ft2 of floor area. The infiltration is 0.25 air changes per hour. +! +! Interzone Surfaces: 6 interzone surfaces (see diagram) +! Internal Mass: None +! People: 50 +! Lights: 7500 W +! Windows: 4 ea.: 1) Double pane clear, 3mm glass, 13mm air gap +! 2) Double pane clear, 3mm glass, 13mm argon gap +! 3) Double pane clear, 6mm glass, 6mm air gap +! 4) Double pane lowE, 6mm lowE glass outside, 6mm air gap, 6mm clear glass +! +! Doors: 2 ea.: Single pane grey, 3mm glass +! +! Detached Shading: None +! Daylight: None +! Natural Ventilation: None +! Compact Schedules: Yes +! +! HVAC: PTAC (packaged terminal air conditioner) systems with electric heating coils +! and dedicated outdoor air system with gas heat and multimode DX cooling coil +! with dehumidification controls. All equipment is autosized. +! +! Zonal Equipment: Yes +! Central Air Handling Equipment: Yes +! System Equipment Autosize: Yes +! Purchased Cooling: None +! Purchased Heating: None +! Coils: Yes +! Pumps: Yes +! Boilers: None +! Chillers: None +! +! Results: +! Standard Reports: All +! Timestep or Hourly Variables: Hourly +! Time bins Report: None +! HTML Report: Yes +! Environmental Emissions: None +! Utility Tariffs: None + + Version,25.1; + + Building, + PTAC with DOAS RH Control, !- Name + 30., !- North Axis {deg} + City, !- Terrain + 0.04, !- Loads Convergence Tolerance Value {W} + 0.4, !- Temperature Convergence Tolerance Value {deltaC} + FullExterior, !- Solar Distribution + 25, !- Maximum Number of Warmup Days + 6; !- Minimum Number of Warmup Days + + Timestep,4; + + SurfaceConvectionAlgorithm:Inside,TARP; + + SurfaceConvectionAlgorithm:Outside,DOE-2; + + HeatBalanceAlgorithm,ConductionTransferFunction; + + GlobalGeometryRules, + UpperLeftCorner, !- Starting Vertex Position + CounterClockWise, !- Vertex Entry Direction + Relative; !- Coordinate System + + ScheduleTypeLimits, + Any Number; !- Name + + ScheduleTypeLimits, + Fraction, !- Name + 0.0, !- Lower Limit Value + 1.0, !- Upper Limit Value + CONTINUOUS; !- Numeric Type + + ScheduleTypeLimits, + Temperature, !- Name + -60, !- Lower Limit Value + 200, !- Upper Limit Value + CONTINUOUS, !- Numeric Type + Temperature; !- Unit Type + + ScheduleTypeLimits, + Control Type, !- Name + 0, !- Lower Limit Value + 4, !- Upper Limit Value + DISCRETE; !- Numeric Type + + ScheduleTypeLimits, + On/Off, !- Name + 0, !- Lower Limit Value + 1, !- Upper Limit Value + DISCRETE; !- Numeric Type + + ScheduleTypeLimits, + FlowRate, !- Name + 0.0, !- Lower Limit Value + 10, !- Upper Limit Value + CONTINUOUS; !- Numeric Type + + RunPeriod, + Run Period 1, !- Name + 1, !- Begin Month + 14, !- Begin Day of Month + , !- Begin Year + 1, !- End Month + 14, !- End Day of Month + , !- End Year + Tuesday, !- Day of Week for Start Day + Yes, !- Use Weather File Holidays and Special Days + Yes, !- Use Weather File Daylight Saving Period + No, !- Apply Weekend Holiday Rule + Yes, !- Use Weather File Rain Indicators + Yes; !- Use Weather File Snow Indicators + + RunPeriod, + Run Period 2, !- Name + 7, !- Begin Month + 7, !- Begin Day of Month + , !- Begin Year + 7, !- End Month + 7, !- End Day of Month + , !- End Year + Tuesday, !- Day of Week for Start Day + Yes, !- Use Weather File Holidays and Special Days + Yes, !- Use Weather File Daylight Saving Period + No, !- Apply Weekend Holiday Rule + Yes, !- Use Weather File Rain Indicators + Yes; !- Use Weather File Snow Indicators + +! + + Site:Location, + CHICAGO_IL_USA TMY2-94846, !- Name + 41.78, !- Latitude {deg} + -87.75, !- Longitude {deg} + -6.00, !- Time Zone {hr} + 190.00; !- Elevation {m} + + SimulationControl, + Yes, !- Do Zone Sizing Calculation + Yes, !- Do System Sizing Calculation + Yes, !- Do Plant Sizing Calculation + No, !- Run Simulation for Sizing Periods + Yes, !- Run Simulation for Weather File Run Periods + No, !- Do HVAC Sizing Simulation for Sizing Periods + 1; !- Maximum Number of HVAC Sizing Simulation Passes + +! CHICAGO_IL_USA Annual Heating 99% Design Conditions DB, MaxDB= -17.3°C + + SizingPeriod:DesignDay, + CHICAGO_IL_USA Annual Heating 99% Design Conditions DB, !- Name + 1, !- Month + 21, !- Day of Month + WinterDesignDay, !- Day Type + -17.3, !- Maximum Dry-Bulb Temperature {C} + 0.0, !- Daily Dry-Bulb Temperature Range {deltaC} + , !- Dry-Bulb Temperature Range Modifier Type + , !- Dry-Bulb Temperature Range Modifier Day Schedule Name + Wetbulb, !- Humidity Condition Type + -17.3, !- Wetbulb or DewPoint at Maximum Dry-Bulb {C} + , !- Humidity Condition Day Schedule Name + , !- Humidity Ratio at Maximum Dry-Bulb {kgWater/kgDryAir} + , !- Enthalpy at Maximum Dry-Bulb {J/kg} + , !- Daily Wet-Bulb Temperature Range {deltaC} + 99063., !- Barometric Pressure {Pa} + 4.9, !- Wind Speed {m/s} + 270, !- Wind Direction {deg} + No, !- Rain Indicator + No, !- Snow Indicator + No, !- Daylight Saving Time Indicator + ASHRAEClearSky, !- Solar Model Indicator + , !- Beam Solar Day Schedule Name + , !- Diffuse Solar Day Schedule Name + , !- ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub) {dimensionless} + , !- ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud) {dimensionless} + 0.0; !- Sky Clearness + +! CHICAGO_IL_USA Annual Cooling 1% Design Conditions, MaxDB= 31.5°C MCWB= 23.0°C + + SizingPeriod:DesignDay, + CHICAGO_IL_USA Annual Cooling 1% Design Conditions DB/MCWB, !- Name + 7, !- Month + 21, !- Day of Month + SummerDesignDay, !- Day Type + 31.5, !- Maximum Dry-Bulb Temperature {C} + 10.7, !- Daily Dry-Bulb Temperature Range {deltaC} + , !- Dry-Bulb Temperature Range Modifier Type + , !- Dry-Bulb Temperature Range Modifier Day Schedule Name + Wetbulb, !- Humidity Condition Type + 23.0, !- Wetbulb or DewPoint at Maximum Dry-Bulb {C} + , !- Humidity Condition Day Schedule Name + , !- Humidity Ratio at Maximum Dry-Bulb {kgWater/kgDryAir} + , !- Enthalpy at Maximum Dry-Bulb {J/kg} + , !- Daily Wet-Bulb Temperature Range {deltaC} + 99063., !- Barometric Pressure {Pa} + 5.3, !- Wind Speed {m/s} + 230, !- Wind Direction {deg} + No, !- Rain Indicator + No, !- Snow Indicator + No, !- Daylight Saving Time Indicator + ASHRAEClearSky, !- Solar Model Indicator + , !- Beam Solar Day Schedule Name + , !- Diffuse Solar Day Schedule Name + , !- ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub) {dimensionless} + , !- ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud) {dimensionless} + 1.0; !- Sky Clearness + + Site:GroundTemperature:BuildingSurface,21.5,21.4,21.5,21.5,22.0,22.9,23.0,23.1,23.1,22.2,21.7,21.6; + + Material, + WD10, !- Name + MediumSmooth, !- Roughness + 0.667, !- Thickness {m} + 0.115, !- Conductivity {W/m-K} + 513, !- Density {kg/m3} + 1381, !- Specific Heat {J/kg-K} + 0.9, !- Thermal Absorptance + 0.78, !- Solar Absorptance + 0.78; !- Visible Absorptance + + Material, + RG01, !- Name + Rough, !- Roughness + 1.2700000E-02, !- Thickness {m} + 1.442000, !- Conductivity {W/m-K} + 881.0000, !- Density {kg/m3} + 1674.000, !- Specific Heat {J/kg-K} + 0.9000000, !- Thermal Absorptance + 0.6500000, !- Solar Absorptance + 0.6500000; !- Visible Absorptance + + Material, + BR01, !- Name + VeryRough, !- Roughness + 9.4999997E-03, !- Thickness {m} + 0.1620000, !- Conductivity {W/m-K} + 1121.000, !- Density {kg/m3} + 1464.000, !- Specific Heat {J/kg-K} + 0.9000000, !- Thermal Absorptance + 0.7000000, !- Solar Absorptance + 0.7000000; !- Visible Absorptance + + Material, + IN46, !- Name + VeryRough, !- Roughness + 7.6200001E-02, !- Thickness {m} + 2.3000000E-02, !- Conductivity {W/m-K} + 24.00000, !- Density {kg/m3} + 1590.000, !- Specific Heat {J/kg-K} + 0.9000000, !- Thermal Absorptance + 0.5000000, !- Solar Absorptance + 0.5000000; !- Visible Absorptance + + Material, + WD01, !- Name + MediumSmooth, !- Roughness + 1.9099999E-02, !- Thickness {m} + 0.1150000, !- Conductivity {W/m-K} + 513.0000, !- Density {kg/m3} + 1381.000, !- Specific Heat {J/kg-K} + 0.9000000, !- Thermal Absorptance + 0.7800000, !- Solar Absorptance + 0.7800000; !- Visible Absorptance + + Material, + PW03, !- Name + MediumSmooth, !- Roughness + 1.2700000E-02, !- Thickness {m} + 0.1150000, !- Conductivity {W/m-K} + 545.0000, !- Density {kg/m3} + 1213.000, !- Specific Heat {J/kg-K} + 0.9000000, !- Thermal Absorptance + 0.7800000, !- Solar Absorptance + 0.7800000; !- Visible Absorptance + + Material, + IN02, !- Name + Rough, !- Roughness + 9.0099998E-02, !- Thickness {m} + 4.3000001E-02, !- Conductivity {W/m-K} + 10.00000, !- Density {kg/m3} + 837.0000, !- Specific Heat {J/kg-K} + 0.9000000, !- Thermal Absorptance + 0.7500000, !- Solar Absorptance + 0.7500000; !- Visible Absorptance + + Material, + GP01, !- Name + MediumSmooth, !- Roughness + 1.2700000E-02, !- Thickness {m} + 0.1600000, !- Conductivity {W/m-K} + 801.0000, !- Density {kg/m3} + 837.0000, !- Specific Heat {J/kg-K} + 0.9000000, !- Thermal Absorptance + 0.7500000, !- Solar Absorptance + 0.7500000; !- Visible Absorptance + + Material, + GP02, !- Name + MediumSmooth, !- Roughness + 1.5900001E-02, !- Thickness {m} + 0.1600000, !- Conductivity {W/m-K} + 801.0000, !- Density {kg/m3} + 837.0000, !- Specific Heat {J/kg-K} + 0.9000000, !- Thermal Absorptance + 0.7500000, !- Solar Absorptance + 0.7500000; !- Visible Absorptance + + Material, + CC03, !- Name + MediumRough, !- Roughness + 0.1016000, !- Thickness {m} + 1.310000, !- Conductivity {W/m-K} + 2243.000, !- Density {kg/m3} + 837.0000, !- Specific Heat {J/kg-K} + 0.9000000, !- Thermal Absorptance + 0.6500000, !- Solar Absorptance + 0.6500000; !- Visible Absorptance + + Material:NoMass, + CP01, !- Name + Rough, !- Roughness + 0.3670000, !- Thermal Resistance {m2-K/W} + 0.9000000, !- Thermal Absorptance + 0.7500000, !- Solar Absorptance + 0.7500000; !- Visible Absorptance + + Material:NoMass, + MAT-CLNG-1, !- Name + Rough, !- Roughness + 0.652259290, !- Thermal Resistance {m2-K/W} + 0.65, !- Thermal Absorptance + 0.65, !- Solar Absorptance + 0.65; !- Visible Absorptance + + Material:AirGap, + AL21, !- Name + 0.1570000; !- Thermal Resistance {m2-K/W} + + Material:AirGap, + AL23, !- Name + 0.1530000; !- Thermal Resistance {m2-K/W} + + Construction, + ROOF-1, !- Name + RG01, !- Outside Layer + BR01, !- Layer 2 + IN46, !- Layer 3 + WD01; !- Layer 4 + + Construction, + WALL-1, !- Name + WD01, !- Outside Layer + PW03, !- Layer 2 + IN02, !- Layer 3 + GP01; !- Layer 4 + + Construction, + CLNG-1, !- Name + MAT-CLNG-1; !- Outside Layer + + Construction, + FLOOR-SLAB-1, !- Name + CC03; !- Outside Layer + + Construction, + INT-WALL-1, !- Name + GP02, !- Outside Layer + AL21, !- Layer 2 + GP02; !- Layer 3 + + WindowMaterial:Gas, + AIR 6MM, !- Name + Air, !- Gas Type + 0.0063; !- Thickness {m} + + WindowMaterial:Gas, + AIR 13MM, !- Name + Air, !- Gas Type + 0.0127; !- Thickness {m} + + WindowMaterial:Gas, + ARGON 13MM, !- Name + Argon, !- Gas Type + 0.0127; !- Thickness {m} + + WindowMaterial:Glazing, + CLEAR 3MM, !- Name + SpectralAverage, !- Optical Data Type + , !- Window Glass Spectral Data Set Name + 0.003, !- Thickness {m} + 0.837, !- Solar Transmittance at Normal Incidence + 0.075, !- Front Side Solar Reflectance at Normal Incidence + 0.075, !- Back Side Solar Reflectance at Normal Incidence + 0.898, !- Visible Transmittance at Normal Incidence + 0.081, !- Front Side Visible Reflectance at Normal Incidence + 0.081, !- Back Side Visible Reflectance at Normal Incidence + 0.0, !- Infrared Transmittance at Normal Incidence + 0.84, !- Front Side Infrared Hemispherical Emissivity + 0.84, !- Back Side Infrared Hemispherical Emissivity + 0.9; !- Conductivity {W/m-K} + + WindowMaterial:Glazing, + GREY 3MM, !- Name + SpectralAverage, !- Optical Data Type + , !- Window Glass Spectral Data Set Name + 0.003, !- Thickness {m} + 0.626, !- Solar Transmittance at Normal Incidence + 0.061, !- Front Side Solar Reflectance at Normal Incidence + 0.061, !- Back Side Solar Reflectance at Normal Incidence + 0.611, !- Visible Transmittance at Normal Incidence + 0.061, !- Front Side Visible Reflectance at Normal Incidence + 0.061, !- Back Side Visible Reflectance at Normal Incidence + 0.0, !- Infrared Transmittance at Normal Incidence + 0.84, !- Front Side Infrared Hemispherical Emissivity + 0.84, !- Back Side Infrared Hemispherical Emissivity + 0.9; !- Conductivity {W/m-K} + + WindowMaterial:Glazing, + CLEAR 6MM, !- Name + SpectralAverage, !- Optical Data Type + , !- Window Glass Spectral Data Set Name + 0.006, !- Thickness {m} + 0.775, !- Solar Transmittance at Normal Incidence + 0.071, !- Front Side Solar Reflectance at Normal Incidence + 0.071, !- Back Side Solar Reflectance at Normal Incidence + 0.881, !- Visible Transmittance at Normal Incidence + 0.080, !- Front Side Visible Reflectance at Normal Incidence + 0.080, !- Back Side Visible Reflectance at Normal Incidence + 0.0, !- Infrared Transmittance at Normal Incidence + 0.84, !- Front Side Infrared Hemispherical Emissivity + 0.84, !- Back Side Infrared Hemispherical Emissivity + 0.9; !- Conductivity {W/m-K} + + WindowMaterial:Glazing, + LoE CLEAR 6MM, !- Name + SpectralAverage, !- Optical Data Type + , !- Window Glass Spectral Data Set Name + 0.006, !- Thickness {m} + 0.600, !- Solar Transmittance at Normal Incidence + 0.170, !- Front Side Solar Reflectance at Normal Incidence + 0.220, !- Back Side Solar Reflectance at Normal Incidence + 0.840, !- Visible Transmittance at Normal Incidence + 0.055, !- Front Side Visible Reflectance at Normal Incidence + 0.078, !- Back Side Visible Reflectance at Normal Incidence + 0.0, !- Infrared Transmittance at Normal Incidence + 0.84, !- Front Side Infrared Hemispherical Emissivity + 0.10, !- Back Side Infrared Hemispherical Emissivity + 0.9; !- Conductivity {W/m-K} + + Construction, + Dbl Clr 3mm/13mm Air, !- Name + CLEAR 3MM, !- Outside Layer + AIR 13MM, !- Layer 2 + CLEAR 3MM; !- Layer 3 + + Construction, + Sgl Grey 3mm, !- Name + GREY 3MM; !- Outside Layer + + Schedule:Compact, + OCCUPY-1, !- Name + Fraction, !- Schedule Type Limits Name + Through: 12/31, !- Field 1 + For: WeekDays SummerDesignDay CustomDay1 CustomDay2, !- Field 2 + Until: 8:00,0.0, !- Field 3 + Until: 11:00,1.00, !- Field 5 + Until: 12:00,0.80, !- Field 7 + Until: 13:00,0.40, !- Field 9 + Until: 14:00,0.80, !- Field 11 + Until: 18:00,1.00, !- Field 13 + Until: 19:00,0.50, !- Field 15 + Until: 21:00,0.10, !- Field 17 + Until: 24:00,0.0, !- Field 19 + For: Weekends WinterDesignDay Holiday, !- Field 21 + Until: 24:00,0.0; !- Field 22 + + Schedule:Compact, + LIGHTS-1, !- Name + Fraction, !- Schedule Type Limits Name + Through: 12/31, !- Field 1 + For: WeekDays SummerDesignDay CustomDay1 CustomDay2, !- Field 2 + Until: 8:00,0.05, !- Field 3 + Until: 9:00,0.9, !- Field 5 + Until: 10:00,0.95, !- Field 7 + Until: 11:00,1.00, !- Field 9 + Until: 12:00,0.95, !- Field 11 + Until: 13:00,0.8, !- Field 13 + Until: 14:00,0.9, !- Field 15 + Until: 18:00,1.00, !- Field 17 + Until: 19:00,0.60, !- Field 19 + Until: 21:00,0.40, !- Field 21 + Until: 24:00,0.05, !- Field 23 + For: Weekends WinterDesignDay Holiday, !- Field 25 + Until: 24:00,0.05; !- Field 26 + + Schedule:Compact, + EQUIP-1, !- Name + Fraction, !- Schedule Type Limits Name + Through: 12/31, !- Field 1 + For: WeekDays SummerDesignDay CustomDay1 CustomDay2, !- Field 2 + Until: 8:00,0.02, !- Field 3 + Until: 9:00,0.4, !- Field 5 + Until: 14:00,0.9, !- Field 7 + Until: 15:00,0.8, !- Field 9 + Until: 16:00,0.7, !- Field 11 + Until: 18:00,0.5, !- Field 13 + Until: 21:00,0.3, !- Field 15 + Until: 24:00,0.02, !- Field 17 + For: Weekends WinterDesignDay Holiday, !- Field 19 + Until: 24:00,0.02; !- Field 20 + + Schedule:Compact, + INFIL-SCH, !- Name + Fraction, !- Schedule Type Limits Name + Through: 12/31, !- Field 1 + For: WeekDays CustomDay1 CustomDay2, !- Field 2 + Until: 7:00,1.0, !- Field 3 + Until: 21:00,0.0, !- Field 5 + Until: 24:00,1.0, !- Field 7 + For: Weekends Holiday, !- Field 9 + Until: 24:00,1.0, !- Field 10 + For: SummerDesignDay, !- Field 12 + Until: 24:00,1.0, !- Field 13 + For: WinterDesignDay, !- Field 15 + Until: 24:00,1.0; !- Field 16 + + Schedule:Compact, + ActSchd, !- Name + Any Number, !- Schedule Type Limits Name + Through: 12/31, !- Field 1 + For: AllDays, !- Field 2 + Until: 24:00,117.239997864; !- Field 3 + + Schedule:Compact, + ShadeTransSch, !- Name + Fraction, !- Schedule Type Limits Name + Through: 12/31, !- Field 1 + For: AllDays, !- Field 2 + Until: 24:00,0.0; !- Field 3 + + Zone, + PLENUM-1, !- Name + 0, !- Direction of Relative North {deg} + 0, !- X Origin {m} + 0, !- Y Origin {m} + 0, !- Z Origin {m} + 1, !- Type + 1, !- Multiplier + 0.609600067, !- Ceiling Height {m} + 283.2; !- Volume {m3} + + BuildingSurface:Detailed, + WALL-1PF, !- Name + WALL, !- Surface Type + WALL-1, !- Construction Name + PLENUM-1, !- Zone Name + , !- Space Name + Outdoors, !- Outside Boundary Condition + , !- Outside Boundary Condition Object + SunExposed, !- Sun Exposure + WindExposed, !- Wind Exposure + 0.50000, !- View Factor to Ground + 4, !- Number of Vertices + 0.0,0.0,3.0, !- X,Y,Z ==> Vertex 1 {m} + 0.0,0.0,2.4, !- X,Y,Z ==> Vertex 2 {m} + 30.5,0.0,2.4, !- X,Y,Z ==> Vertex 3 {m} + 30.5,0.0,3.0; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + WALL-1PR, !- Name + WALL, !- Surface Type + WALL-1, !- Construction Name + PLENUM-1, !- Zone Name + , !- Space Name + Outdoors, !- Outside Boundary Condition + , !- Outside Boundary Condition Object + SunExposed, !- Sun Exposure + WindExposed, !- Wind Exposure + 0.50000, !- View Factor to Ground + 4, !- Number of Vertices + 30.5,0.0,3.0, !- X,Y,Z ==> Vertex 1 {m} + 30.5,0.0,2.4, !- X,Y,Z ==> Vertex 2 {m} + 30.5,15.2,2.4, !- X,Y,Z ==> Vertex 3 {m} + 30.5,15.2,3.0; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + WALL-1PB, !- Name + WALL, !- Surface Type + WALL-1, !- Construction Name + PLENUM-1, !- Zone Name + , !- Space Name + Outdoors, !- Outside Boundary Condition + , !- Outside Boundary Condition Object + SunExposed, !- Sun Exposure + WindExposed, !- Wind Exposure + 0.50000, !- View Factor to Ground + 4, !- Number of Vertices + 30.5,15.2,3.0, !- X,Y,Z ==> Vertex 1 {m} + 30.5,15.2,2.4, !- X,Y,Z ==> Vertex 2 {m} + 0.0,15.2,2.4, !- X,Y,Z ==> Vertex 3 {m} + 0.0,15.2,3.0; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + WALL-1PL, !- Name + WALL, !- Surface Type + WALL-1, !- Construction Name + PLENUM-1, !- Zone Name + , !- Space Name + Outdoors, !- Outside Boundary Condition + , !- Outside Boundary Condition Object + SunExposed, !- Sun Exposure + WindExposed, !- Wind Exposure + 0.50000, !- View Factor to Ground + 4, !- Number of Vertices + 0.0,15.2,3.0, !- X,Y,Z ==> Vertex 1 {m} + 0.0,15.2,2.4, !- X,Y,Z ==> Vertex 2 {m} + 0.0,0.0,2.4, !- X,Y,Z ==> Vertex 3 {m} + 0.0,0.0,3.0; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + TOP-1, !- Name + ROOF, !- Surface Type + ROOF-1, !- Construction Name + PLENUM-1, !- Zone Name + , !- Space Name + Outdoors, !- Outside Boundary Condition + , !- Outside Boundary Condition Object + SunExposed, !- Sun Exposure + WindExposed, !- Wind Exposure + 0.00000, !- View Factor to Ground + 4, !- Number of Vertices + 0.0,15.2,3.0, !- X,Y,Z ==> Vertex 1 {m} + 0.0,0.0,3.0, !- X,Y,Z ==> Vertex 2 {m} + 30.5,0.0,3.0, !- X,Y,Z ==> Vertex 3 {m} + 30.5,15.2,3.0; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + C1-1P, !- Name + FLOOR, !- Surface Type + CLNG-1, !- Construction Name + PLENUM-1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + C1-1, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 26.8,3.7,2.4, !- X,Y,Z ==> Vertex 1 {m} + 30.5,0.0,2.4, !- X,Y,Z ==> Vertex 2 {m} + 0.0,0.0,2.4, !- X,Y,Z ==> Vertex 3 {m} + 3.7,3.7,2.4; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + C2-1P, !- Name + FLOOR, !- Surface Type + CLNG-1, !- Construction Name + PLENUM-1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + C2-1, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 26.8,11.6,2.4, !- X,Y,Z ==> Vertex 1 {m} + 30.5,15.2,2.4, !- X,Y,Z ==> Vertex 2 {m} + 30.5,0.0,2.4, !- X,Y,Z ==> Vertex 3 {m} + 26.8,3.7,2.4; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + C3-1P, !- Name + FLOOR, !- Surface Type + CLNG-1, !- Construction Name + PLENUM-1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + C3-1, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 26.8,11.6,2.4, !- X,Y,Z ==> Vertex 1 {m} + 3.7,11.6,2.4, !- X,Y,Z ==> Vertex 2 {m} + 0.0,15.2,2.4, !- X,Y,Z ==> Vertex 3 {m} + 30.5,15.2,2.4; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + C4-1P, !- Name + FLOOR, !- Surface Type + CLNG-1, !- Construction Name + PLENUM-1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + C4-1, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 3.7,3.7,2.4, !- X,Y,Z ==> Vertex 1 {m} + 0.0,0.0,2.4, !- X,Y,Z ==> Vertex 2 {m} + 0.0,15.2,2.4, !- X,Y,Z ==> Vertex 3 {m} + 3.7,11.6,2.4; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + C5-1P, !- Name + FLOOR, !- Surface Type + CLNG-1, !- Construction Name + PLENUM-1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + C5-1, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 26.8,11.6,2.4, !- X,Y,Z ==> Vertex 1 {m} + 26.8,3.7,2.4, !- X,Y,Z ==> Vertex 2 {m} + 3.7,3.7,2.4, !- X,Y,Z ==> Vertex 3 {m} + 3.7,11.6,2.4; !- X,Y,Z ==> Vertex 4 {m} + + Zone, + SPACE1-1, !- Name + 0, !- Direction of Relative North {deg} + 0, !- X Origin {m} + 0, !- Y Origin {m} + 0, !- Z Origin {m} + 1, !- Type + 1, !- Multiplier + 2.438400269, !- Ceiling Height {m} + 239.247360229; !- Volume {m3} + + ZoneInfiltration:DesignFlowRate, + SPACE1-1 Infil 1, !- Name + SPACE1-1, !- Zone or ZoneList or Space or SpaceList Name + INFIL-SCH, !- Schedule Name + flow/zone, !- Design Flow Rate Calculation Method + 0.0167, !- Design Flow Rate {m3/s} + , !- Flow per Zone Floor Area {m3/s-m2} + , !- Flow per Exterior Surface Area {m3/s-m2} + , !- Air Changes per Hour {1/hr} + 0, !- Constant Term Coefficient + 0, !- Temperature Term Coefficient + 0.2237, !- Velocity Term Coefficient + 0; !- Velocity Squared Term Coefficient + + People, + SPACE1-1 People 1, !- Name + SPACE1-1, !- Zone or ZoneList or Space or SpaceList Name + OCCUPY-1, !- Number of People Schedule Name + people, !- Number of People Calculation Method + 11, !- Number of People + , !- People per Floor Area {person/m2} + , !- Floor Area per Person {m2/person} + 0.3, !- Fraction Radiant + , !- Sensible Heat Fraction + ActSchd; !- Activity Level Schedule Name + + Lights, + SPACE1-1 Lights 1, !- Name + SPACE1-1, !- Zone or ZoneList or Space or SpaceList Name + LIGHTS-1, !- Schedule Name + LightingLevel, !- Design Level Calculation Method + 1584, !- Lighting Level {W} + , !- Watts per Zone Floor Area {W/m2} + , !- Watts per Person {W/person} + 0, !- Return Air Fraction + 0.59, !- Fraction Radiant + 0.2, !- Fraction Visible + 0, !- Fraction Replaceable + GeneralLights; !- End-Use Subcategory + + ElectricEquipment, + SPACE1-1 ElecEq 1, !- Name + SPACE1-1, !- Zone or ZoneList or Space or SpaceList Name + EQUIP-1, !- Schedule Name + EquipmentLevel, !- Design Level Calculation Method + 1056, !- Design Level {W} + , !- Watts per Zone Floor Area {W/m2} + , !- Watts per Person {W/person} + 0, !- Fraction Latent + 0.3, !- Fraction Radiant + 0; !- Fraction Lost + + BuildingSurface:Detailed, + FRONT-1, !- Name + WALL, !- Surface Type + WALL-1, !- Construction Name + SPACE1-1, !- Zone Name + , !- Space Name + Outdoors, !- Outside Boundary Condition + , !- Outside Boundary Condition Object + SunExposed, !- Sun Exposure + WindExposed, !- Wind Exposure + 0.50000, !- View Factor to Ground + 4, !- Number of Vertices + 0.0,0.0,2.4, !- X,Y,Z ==> Vertex 1 {m} + 0.0,0.0,0.0, !- X,Y,Z ==> Vertex 2 {m} + 30.5,0.0,0.0, !- X,Y,Z ==> Vertex 3 {m} + 30.5,0.0,2.4; !- X,Y,Z ==> Vertex 4 {m} + + FenestrationSurface:Detailed, + WF-1, !- Name + WINDOW, !- Surface Type + Dbl Clr 3mm/13mm Air, !- Construction Name + FRONT-1, !- Building Surface Name + , !- Outside Boundary Condition Object + 0.50000, !- View Factor to Ground + , !- Frame and Divider Name + 1, !- Multiplier + 4, !- Number of Vertices + 3.0,0.0,2.1, !- X,Y,Z ==> Vertex 1 {m} + 3.0,0.0,0.9, !- X,Y,Z ==> Vertex 2 {m} + 16.8,0.0,0.9, !- X,Y,Z ==> Vertex 3 {m} + 16.8,0.0,2.1; !- X,Y,Z ==> Vertex 4 {m} + + FenestrationSurface:Detailed, + DF-1, !- Name + GLASSDOOR, !- Surface Type + Sgl Grey 3mm, !- Construction Name + FRONT-1, !- Building Surface Name + , !- Outside Boundary Condition Object + 0.50000, !- View Factor to Ground + , !- Frame and Divider Name + 1, !- Multiplier + 4, !- Number of Vertices + 21.3,0.0,2.1, !- X,Y,Z ==> Vertex 1 {m} + 21.3,0.0,0.0, !- X,Y,Z ==> Vertex 2 {m} + 23.8,0.0,0.0, !- X,Y,Z ==> Vertex 3 {m} + 23.8,0.0,2.1; !- X,Y,Z ==> Vertex 4 {m} + + Shading:Zone:Detailed, + Main South Overhang, !- Name + FRONT-1, !- Base Surface Name + ShadeTransSch, !- Transmittance Schedule Name + 4, !- Number of Vertices + 0.0,-1.3,2.2, !- X,Y,Z ==> Vertex 1 {m} + 0.0,0.0,2.2, !- X,Y,Z ==> Vertex 2 {m} + 19.8,0.0,2.2, !- X,Y,Z ==> Vertex 3 {m} + 19.8,-1.3,2.2; !- X,Y,Z ==> Vertex 4 {m} + + Shading:Zone:Detailed, + South Door Overhang, !- Name + FRONT-1, !- Base Surface Name + ShadeTransSch, !- Transmittance Schedule Name + 4, !- Number of Vertices + 21.0,-2.0,2.6, !- X,Y,Z ==> Vertex 1 {m} + 21.0,0.0,2.6, !- X,Y,Z ==> Vertex 2 {m} + 24.1,0.0,2.6, !- X,Y,Z ==> Vertex 3 {m} + 24.1,-2.0,2.6; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + C1-1, !- Name + CEILING, !- Surface Type + CLNG-1, !- Construction Name + SPACE1-1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + C1-1P, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 3.7,3.7,2.4, !- X,Y,Z ==> Vertex 1 {m} + 0.0,0.0,2.4, !- X,Y,Z ==> Vertex 2 {m} + 30.5,0.0,2.4, !- X,Y,Z ==> Vertex 3 {m} + 26.8,3.7,2.4; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + F1-1, !- Name + FLOOR, !- Surface Type + FLOOR-SLAB-1, !- Construction Name + SPACE1-1, !- Zone Name + , !- Space Name + Ground, !- Outside Boundary Condition + , !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 26.8,3.7,0.0, !- X,Y,Z ==> Vertex 1 {m} + 30.5,0.0,0.0, !- X,Y,Z ==> Vertex 2 {m} + 0.0,0.0,0.0, !- X,Y,Z ==> Vertex 3 {m} + 3.7,3.7,0.0; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + SB12, !- Name + WALL, !- Surface Type + INT-WALL-1, !- Construction Name + SPACE1-1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + SB21, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 30.5,0.0,2.4, !- X,Y,Z ==> Vertex 1 {m} + 30.5,0.0,0.0, !- X,Y,Z ==> Vertex 2 {m} + 26.8,3.7,0.0, !- X,Y,Z ==> Vertex 3 {m} + 26.8,3.7,2.4; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + SB14, !- Name + WALL, !- Surface Type + INT-WALL-1, !- Construction Name + SPACE1-1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + SB41, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 3.7,3.7,2.4, !- X,Y,Z ==> Vertex 1 {m} + 3.7,3.7,0.0, !- X,Y,Z ==> Vertex 2 {m} + 0.0,0.0,0.0, !- X,Y,Z ==> Vertex 3 {m} + 0.0,0.0,2.4; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + SB15, !- Name + WALL, !- Surface Type + INT-WALL-1, !- Construction Name + SPACE1-1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + SB51, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 26.8,3.7,2.4, !- X,Y,Z ==> Vertex 1 {m} + 26.8,3.7,0.0, !- X,Y,Z ==> Vertex 2 {m} + 3.7,3.7,0.0, !- X,Y,Z ==> Vertex 3 {m} + 3.7,3.7,2.4; !- X,Y,Z ==> Vertex 4 {m} + + Zone, + SPACE2-1, !- Name + 0, !- Direction of Relative North {deg} + 0, !- X Origin {m} + 0, !- Y Origin {m} + 0, !- Z Origin {m} + 1, !- Type + 1, !- Multiplier + 2.438400269, !- Ceiling Height {m} + 103.311355591; !- Volume {m3} + + ZoneInfiltration:DesignFlowRate, + SPACE2-1 Infil 1, !- Name + SPACE2-1, !- Zone or ZoneList or Space or SpaceList Name + INFIL-SCH, !- Schedule Name + flow/zone, !- Design Flow Rate Calculation Method + 0.00717, !- Design Flow Rate {m3/s} + , !- Flow per Zone Floor Area {m3/s-m2} + , !- Flow per Exterior Surface Area {m3/s-m2} + , !- Air Changes per Hour {1/hr} + 0, !- Constant Term Coefficient + 0, !- Temperature Term Coefficient + 0.2237, !- Velocity Term Coefficient + 0; !- Velocity Squared Term Coefficient + + People, + SPACE2-1 People 1, !- Name + SPACE2-1, !- Zone or ZoneList or Space or SpaceList Name + OCCUPY-1, !- Number of People Schedule Name + people, !- Number of People Calculation Method + 5, !- Number of People + , !- People per Floor Area {person/m2} + , !- Floor Area per Person {m2/person} + 0.3, !- Fraction Radiant + , !- Sensible Heat Fraction + ActSchd; !- Activity Level Schedule Name + + Lights, + SPACE2-1 Lights 1, !- Name + SPACE2-1, !- Zone or ZoneList or Space or SpaceList Name + LIGHTS-1, !- Schedule Name + LightingLevel, !- Design Level Calculation Method + 684, !- Lighting Level {W} + , !- Watts per Zone Floor Area {W/m2} + , !- Watts per Person {W/person} + 0, !- Return Air Fraction + 0.59, !- Fraction Radiant + 0.2, !- Fraction Visible + 0, !- Fraction Replaceable + GeneralLights; !- End-Use Subcategory + + ElectricEquipment, + SPACE2-1 ElecEq 1, !- Name + SPACE2-1, !- Zone or ZoneList or Space or SpaceList Name + EQUIP-1, !- Schedule Name + EquipmentLevel, !- Design Level Calculation Method + 456, !- Design Level {W} + , !- Watts per Zone Floor Area {W/m2} + , !- Watts per Person {W/person} + 0, !- Fraction Latent + 0.3, !- Fraction Radiant + 0; !- Fraction Lost + + BuildingSurface:Detailed, + RIGHT-1, !- Name + WALL, !- Surface Type + WALL-1, !- Construction Name + SPACE2-1, !- Zone Name + , !- Space Name + Outdoors, !- Outside Boundary Condition + , !- Outside Boundary Condition Object + SunExposed, !- Sun Exposure + WindExposed, !- Wind Exposure + 0.50000, !- View Factor to Ground + 4, !- Number of Vertices + 30.5,0.0,2.4, !- X,Y,Z ==> Vertex 1 {m} + 30.5,0.0,0.0, !- X,Y,Z ==> Vertex 2 {m} + 30.5,15.2,0.0, !- X,Y,Z ==> Vertex 3 {m} + 30.5,15.2,2.4; !- X,Y,Z ==> Vertex 4 {m} + + FenestrationSurface:Detailed, + WR-1, !- Name + WINDOW, !- Surface Type + Dbl Clr 3mm/13mm Air, !- Construction Name + RIGHT-1, !- Building Surface Name + , !- Outside Boundary Condition Object + 0.50000, !- View Factor to Ground + , !- Frame and Divider Name + 1, !- Multiplier + 4, !- Number of Vertices + 30.5,3.8,2.1, !- X,Y,Z ==> Vertex 1 {m} + 30.5,3.8,0.9, !- X,Y,Z ==> Vertex 2 {m} + 30.5,11.4,0.9, !- X,Y,Z ==> Vertex 3 {m} + 30.5,11.4,2.1; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + C2-1, !- Name + CEILING, !- Surface Type + CLNG-1, !- Construction Name + SPACE2-1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + C2-1P, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 26.8,3.7,2.4, !- X,Y,Z ==> Vertex 1 {m} + 30.5,0.0,2.4, !- X,Y,Z ==> Vertex 2 {m} + 30.5,15.2,2.4, !- X,Y,Z ==> Vertex 3 {m} + 26.8,11.6,2.4; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + F2-1, !- Name + FLOOR, !- Surface Type + FLOOR-SLAB-1, !- Construction Name + SPACE2-1, !- Zone Name + , !- Space Name + Ground, !- Outside Boundary Condition + , !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 26.8,11.6,0.0, !- X,Y,Z ==> Vertex 1 {m} + 30.5,15.2,0.0, !- X,Y,Z ==> Vertex 2 {m} + 30.5,0.0,0.0, !- X,Y,Z ==> Vertex 3 {m} + 26.8,3.7,0.0; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + SB21, !- Name + WALL, !- Surface Type + INT-WALL-1, !- Construction Name + SPACE2-1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + SB12, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 26.8,3.7,2.4, !- X,Y,Z ==> Vertex 1 {m} + 26.8,3.7,0.0, !- X,Y,Z ==> Vertex 2 {m} + 30.5,0.0,0.0, !- X,Y,Z ==> Vertex 3 {m} + 30.5,0.0,2.4; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + SB23, !- Name + WALL, !- Surface Type + INT-WALL-1, !- Construction Name + SPACE2-1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + SB32, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 30.5,15.2,2.4, !- X,Y,Z ==> Vertex 1 {m} + 30.5,15.2,0.0, !- X,Y,Z ==> Vertex 2 {m} + 26.8,11.6,0.0, !- X,Y,Z ==> Vertex 3 {m} + 26.8,11.6,2.4; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + SB25, !- Name + WALL, !- Surface Type + INT-WALL-1, !- Construction Name + SPACE2-1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + SB52, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 26.8,11.6,2.4, !- X,Y,Z ==> Vertex 1 {m} + 26.8,11.6,0.0, !- X,Y,Z ==> Vertex 2 {m} + 26.8,3.7,0.0, !- X,Y,Z ==> Vertex 3 {m} + 26.8,3.7,2.4; !- X,Y,Z ==> Vertex 4 {m} + + Zone, + SPACE3-1, !- Name + 0, !- Direction of Relative North {deg} + 0, !- X Origin {m} + 0, !- Y Origin {m} + 0, !- Z Origin {m} + 1, !- Type + 1, !- Multiplier + 2.438400269, !- Ceiling Height {m} + 239.247360229; !- Volume {m3} + + ZoneInfiltration:DesignFlowRate, + SPACE3-1 Infil 1, !- Name + SPACE3-1, !- Zone or ZoneList or Space or SpaceList Name + INFIL-SCH, !- Schedule Name + flow/zone, !- Design Flow Rate Calculation Method + 0.0167, !- Design Flow Rate {m3/s} + , !- Flow per Zone Floor Area {m3/s-m2} + , !- Flow per Exterior Surface Area {m3/s-m2} + , !- Air Changes per Hour {1/hr} + 0, !- Constant Term Coefficient + 0, !- Temperature Term Coefficient + 0.2237, !- Velocity Term Coefficient + 0; !- Velocity Squared Term Coefficient + + People, + SPACE3-1 People 1, !- Name + SPACE3-1, !- Zone or ZoneList or Space or SpaceList Name + OCCUPY-1, !- Number of People Schedule Name + people, !- Number of People Calculation Method + 11, !- Number of People + , !- People per Floor Area {person/m2} + , !- Floor Area per Person {m2/person} + 0.3, !- Fraction Radiant + , !- Sensible Heat Fraction + ActSchd; !- Activity Level Schedule Name + + Lights, + SPACE3-1 Lights 1, !- Name + SPACE3-1, !- Zone or ZoneList or Space or SpaceList Name + LIGHTS-1, !- Schedule Name + LightingLevel, !- Design Level Calculation Method + 1584, !- Lighting Level {W} + , !- Watts per Zone Floor Area {W/m2} + , !- Watts per Person {W/person} + 0, !- Return Air Fraction + 0.59, !- Fraction Radiant + 0.2, !- Fraction Visible + 0, !- Fraction Replaceable + GeneralLights; !- End-Use Subcategory + + ElectricEquipment, + SPACE3-1 ElecEq 1, !- Name + SPACE3-1, !- Zone or ZoneList or Space or SpaceList Name + EQUIP-1, !- Schedule Name + EquipmentLevel, !- Design Level Calculation Method + 1056, !- Design Level {W} + , !- Watts per Zone Floor Area {W/m2} + , !- Watts per Person {W/person} + 0, !- Fraction Latent + 0.3, !- Fraction Radiant + 0; !- Fraction Lost + + BuildingSurface:Detailed, + BACK-1, !- Name + WALL, !- Surface Type + WALL-1, !- Construction Name + SPACE3-1, !- Zone Name + , !- Space Name + Outdoors, !- Outside Boundary Condition + , !- Outside Boundary Condition Object + SunExposed, !- Sun Exposure + WindExposed, !- Wind Exposure + 0.50000, !- View Factor to Ground + 4, !- Number of Vertices + 30.5,15.2,2.4, !- X,Y,Z ==> Vertex 1 {m} + 30.5,15.2,0.0, !- X,Y,Z ==> Vertex 2 {m} + 0.0,15.2,0.0, !- X,Y,Z ==> Vertex 3 {m} + 0.0,15.2,2.4; !- X,Y,Z ==> Vertex 4 {m} + + FenestrationSurface:Detailed, + WB-1, !- Name + WINDOW, !- Surface Type + Dbl Clr 3mm/13mm Air, !- Construction Name + BACK-1, !- Building Surface Name + , !- Outside Boundary Condition Object + 0.50000, !- View Factor to Ground + , !- Frame and Divider Name + 1, !- Multiplier + 4, !- Number of Vertices + 27.4,15.2,2.1, !- X,Y,Z ==> Vertex 1 {m} + 27.4,15.2,0.9, !- X,Y,Z ==> Vertex 2 {m} + 13.7,15.2,0.9, !- X,Y,Z ==> Vertex 3 {m} + 13.7,15.2,2.1; !- X,Y,Z ==> Vertex 4 {m} + + FenestrationSurface:Detailed, + DB-1, !- Name + GLASSDOOR, !- Surface Type + Sgl Grey 3mm, !- Construction Name + BACK-1, !- Building Surface Name + , !- Outside Boundary Condition Object + 0.50000, !- View Factor to Ground + , !- Frame and Divider Name + 1, !- Multiplier + 4, !- Number of Vertices + 9.1,15.2,2.1, !- X,Y,Z ==> Vertex 1 {m} + 9.1,15.2,0.0, !- X,Y,Z ==> Vertex 2 {m} + 7.0,15.2,0.0, !- X,Y,Z ==> Vertex 3 {m} + 7.0,15.2,2.1; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + C3-1, !- Name + CEILING, !- Surface Type + CLNG-1, !- Construction Name + SPACE3-1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + C3-1P, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 30.5,15.2,2.4, !- X,Y,Z ==> Vertex 1 {m} + 0.0,15.2,2.4, !- X,Y,Z ==> Vertex 2 {m} + 3.7,11.6,2.4, !- X,Y,Z ==> Vertex 3 {m} + 26.8,11.6,2.4; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + F3-1, !- Name + FLOOR, !- Surface Type + FLOOR-SLAB-1, !- Construction Name + SPACE3-1, !- Zone Name + , !- Space Name + Ground, !- Outside Boundary Condition + , !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 26.8,11.6,0.0, !- X,Y,Z ==> Vertex 1 {m} + 3.7,11.6,0.0, !- X,Y,Z ==> Vertex 2 {m} + 0.0,15.2,0.0, !- X,Y,Z ==> Vertex 3 {m} + 30.5,15.2,0.0; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + SB32, !- Name + WALL, !- Surface Type + INT-WALL-1, !- Construction Name + SPACE3-1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + SB23, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 26.8,11.6,2.4, !- X,Y,Z ==> Vertex 1 {m} + 26.8,11.6,0.0, !- X,Y,Z ==> Vertex 2 {m} + 30.5,15.2,0.0, !- X,Y,Z ==> Vertex 3 {m} + 30.5,15.2,2.4; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + SB34, !- Name + WALL, !- Surface Type + INT-WALL-1, !- Construction Name + SPACE3-1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + SB43, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 0.0,15.2,2.4, !- X,Y,Z ==> Vertex 1 {m} + 0.0,15.2,0.0, !- X,Y,Z ==> Vertex 2 {m} + 3.7,11.6,0.0, !- X,Y,Z ==> Vertex 3 {m} + 3.7,11.6,2.4; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + SB35, !- Name + WALL, !- Surface Type + INT-WALL-1, !- Construction Name + SPACE3-1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + SB53, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 3.7,11.6,2.4, !- X,Y,Z ==> Vertex 1 {m} + 3.7,11.6,0.0, !- X,Y,Z ==> Vertex 2 {m} + 26.8,11.6,0.0, !- X,Y,Z ==> Vertex 3 {m} + 26.8,11.6,2.4; !- X,Y,Z ==> Vertex 4 {m} + + Zone, + SPACE4-1, !- Name + 0, !- Direction of Relative North {deg} + 0, !- X Origin {m} + 0, !- Y Origin {m} + 0, !- Z Origin {m} + 1, !- Type + 1, !- Multiplier + 2.438400269, !- Ceiling Height {m} + 103.311355591; !- Volume {m3} + + ZoneInfiltration:DesignFlowRate, + SPACE4-1 Infil 1, !- Name + SPACE4-1, !- Zone or ZoneList or Space or SpaceList Name + INFIL-SCH, !- Schedule Name + flow/zone, !- Design Flow Rate Calculation Method + 0.00717, !- Design Flow Rate {m3/s} + , !- Flow per Zone Floor Area {m3/s-m2} + , !- Flow per Exterior Surface Area {m3/s-m2} + , !- Air Changes per Hour {1/hr} + 0, !- Constant Term Coefficient + 0, !- Temperature Term Coefficient + 0.2237, !- Velocity Term Coefficient + 0; !- Velocity Squared Term Coefficient + + People, + SPACE4-1 People 1, !- Name + SPACE4-1, !- Zone or ZoneList or Space or SpaceList Name + OCCUPY-1, !- Number of People Schedule Name + people, !- Number of People Calculation Method + 5, !- Number of People + , !- People per Floor Area {person/m2} + , !- Floor Area per Person {m2/person} + 0.3, !- Fraction Radiant + , !- Sensible Heat Fraction + ActSchd; !- Activity Level Schedule Name + + Lights, + SPACE4-1 Lights 1, !- Name + SPACE4-1, !- Zone or ZoneList or Space or SpaceList Name + LIGHTS-1, !- Schedule Name + LightingLevel, !- Design Level Calculation Method + 684, !- Lighting Level {W} + , !- Watts per Zone Floor Area {W/m2} + , !- Watts per Person {W/person} + 0, !- Return Air Fraction + 0.59, !- Fraction Radiant + 0.2, !- Fraction Visible + 0, !- Fraction Replaceable + GeneralLights; !- End-Use Subcategory + + ElectricEquipment, + SPACE4-1 ElecEq 1, !- Name + SPACE4-1, !- Zone or ZoneList or Space or SpaceList Name + EQUIP-1, !- Schedule Name + EquipmentLevel, !- Design Level Calculation Method + 456, !- Design Level {W} + , !- Watts per Zone Floor Area {W/m2} + , !- Watts per Person {W/person} + 0, !- Fraction Latent + 0.3, !- Fraction Radiant + 0; !- Fraction Lost + + BuildingSurface:Detailed, + LEFT-1, !- Name + WALL, !- Surface Type + WALL-1, !- Construction Name + SPACE4-1, !- Zone Name + , !- Space Name + Outdoors, !- Outside Boundary Condition + , !- Outside Boundary Condition Object + SunExposed, !- Sun Exposure + WindExposed, !- Wind Exposure + 0.50000, !- View Factor to Ground + 4, !- Number of Vertices + 0.0,15.2,2.4, !- X,Y,Z ==> Vertex 1 {m} + 0.0,15.2,0.0, !- X,Y,Z ==> Vertex 2 {m} + 0.0,0.0,0.0, !- X,Y,Z ==> Vertex 3 {m} + 0.0,0.0,2.4; !- X,Y,Z ==> Vertex 4 {m} + + FenestrationSurface:Detailed, + WL-1, !- Name + WINDOW, !- Surface Type + Dbl Clr 3mm/13mm Air, !- Construction Name + LEFT-1, !- Building Surface Name + , !- Outside Boundary Condition Object + 0.50000, !- View Factor to Ground + , !- Frame and Divider Name + 1, !- Multiplier + 4, !- Number of Vertices + 0.0,11.4,2.1, !- X,Y,Z ==> Vertex 1 {m} + 0.0,11.4,0.9, !- X,Y,Z ==> Vertex 2 {m} + 0.0,3.8,0.9, !- X,Y,Z ==> Vertex 3 {m} + 0.0,3.8,2.1; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + C4-1, !- Name + CEILING, !- Surface Type + CLNG-1, !- Construction Name + SPACE4-1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + C4-1P, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 3.7,11.6,2.4, !- X,Y,Z ==> Vertex 1 {m} + 0.0,15.2,2.4, !- X,Y,Z ==> Vertex 2 {m} + 0.0,0.0,2.4, !- X,Y,Z ==> Vertex 3 {m} + 3.7,3.7,2.4; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + F4-1, !- Name + FLOOR, !- Surface Type + FLOOR-SLAB-1, !- Construction Name + SPACE4-1, !- Zone Name + , !- Space Name + Ground, !- Outside Boundary Condition + , !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 3.7,3.7,0.0, !- X,Y,Z ==> Vertex 1 {m} + 0.0,0.0,0.0, !- X,Y,Z ==> Vertex 2 {m} + 0.0,15.2,0.0, !- X,Y,Z ==> Vertex 3 {m} + 3.7,11.6,0.0; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + SB41, !- Name + WALL, !- Surface Type + INT-WALL-1, !- Construction Name + SPACE4-1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + SB14, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 0.0,0.0,2.4, !- X,Y,Z ==> Vertex 1 {m} + 0.0,0.0,0.0, !- X,Y,Z ==> Vertex 2 {m} + 3.7,3.7,0.0, !- X,Y,Z ==> Vertex 3 {m} + 3.7,3.7,2.4; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + SB43, !- Name + WALL, !- Surface Type + INT-WALL-1, !- Construction Name + SPACE4-1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + SB34, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 3.7,11.6,2.4, !- X,Y,Z ==> Vertex 1 {m} + 3.7,11.6,0.0, !- X,Y,Z ==> Vertex 2 {m} + 0.0,15.2,0.0, !- X,Y,Z ==> Vertex 3 {m} + 0.0,15.2,2.4; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + SB45, !- Name + WALL, !- Surface Type + INT-WALL-1, !- Construction Name + SPACE4-1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + SB54, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 3.7,3.7,2.4, !- X,Y,Z ==> Vertex 1 {m} + 3.7,3.7,0.0, !- X,Y,Z ==> Vertex 2 {m} + 3.7,11.6,0.0, !- X,Y,Z ==> Vertex 3 {m} + 3.7,11.6,2.4; !- X,Y,Z ==> Vertex 4 {m} + + Zone, + SPACE5-1, !- Name + 0, !- Direction of Relative North {deg} + 0, !- X Origin {m} + 0, !- Y Origin {m} + 0, !- Z Origin {m} + 1, !- Type + 1, !- Multiplier + 2.438400269, !- Ceiling Height {m} + 447.682556152; !- Volume {m3} + + ZoneInfiltration:DesignFlowRate, + SPACE5-1 Infil 1, !- Name + SPACE5-1, !- Zone or ZoneList or Space or SpaceList Name + INFIL-SCH, !- Schedule Name + flow/zone, !- Design Flow Rate Calculation Method + 0.031089, !- Design Flow Rate {m3/s} + , !- Flow per Zone Floor Area {m3/s-m2} + , !- Flow per Exterior Surface Area {m3/s-m2} + , !- Air Changes per Hour {1/hr} + 0, !- Constant Term Coefficient + 0, !- Temperature Term Coefficient + 0.2237, !- Velocity Term Coefficient + 0; !- Velocity Squared Term Coefficient + + People, + SPACE5-1 People 1, !- Name + SPACE5-1, !- Zone or ZoneList or Space or SpaceList Name + OCCUPY-1, !- Number of People Schedule Name + people, !- Number of People Calculation Method + 20, !- Number of People + , !- People per Floor Area {person/m2} + , !- Floor Area per Person {m2/person} + 0.3, !- Fraction Radiant + , !- Sensible Heat Fraction + ActSchd; !- Activity Level Schedule Name + + Lights, + SPACE5-1 Lights 1, !- Name + SPACE5-1, !- Zone or ZoneList or Space or SpaceList Name + LIGHTS-1, !- Schedule Name + LightingLevel, !- Design Level Calculation Method + 2964, !- Lighting Level {W} + , !- Watts per Zone Floor Area {W/m2} + , !- Watts per Person {W/person} + 0, !- Return Air Fraction + 0.59, !- Fraction Radiant + 0.2, !- Fraction Visible + 0, !- Fraction Replaceable + GeneralLights; !- End-Use Subcategory + + ElectricEquipment, + SPACE5-1 ElecEq 1, !- Name + SPACE5-1, !- Zone or ZoneList or Space or SpaceList Name + EQUIP-1, !- Schedule Name + EquipmentLevel, !- Design Level Calculation Method + 1976, !- Design Level {W} + , !- Watts per Zone Floor Area {W/m2} + , !- Watts per Person {W/person} + 0, !- Fraction Latent + 0.3, !- Fraction Radiant + 0; !- Fraction Lost + + BuildingSurface:Detailed, + C5-1, !- Name + CEILING, !- Surface Type + CLNG-1, !- Construction Name + SPACE5-1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + C5-1P, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 3.7,11.6,2.4, !- X,Y,Z ==> Vertex 1 {m} + 3.7,3.7,2.4, !- X,Y,Z ==> Vertex 2 {m} + 26.8,3.7,2.4, !- X,Y,Z ==> Vertex 3 {m} + 26.8,11.6,2.4; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + F5-1, !- Name + FLOOR, !- Surface Type + FLOOR-SLAB-1, !- Construction Name + SPACE5-1, !- Zone Name + , !- Space Name + Ground, !- Outside Boundary Condition + , !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 26.8,11.6,0.0, !- X,Y,Z ==> Vertex 1 {m} + 26.8,3.7,0.0, !- X,Y,Z ==> Vertex 2 {m} + 3.7,3.7,0.0, !- X,Y,Z ==> Vertex 3 {m} + 3.7,11.6,0.0; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + SB51, !- Name + WALL, !- Surface Type + INT-WALL-1, !- Construction Name + SPACE5-1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + SB15, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 3.7,3.7,2.4, !- X,Y,Z ==> Vertex 1 {m} + 3.7,3.7,0.0, !- X,Y,Z ==> Vertex 2 {m} + 26.8,3.7,0.0, !- X,Y,Z ==> Vertex 3 {m} + 26.8,3.7,2.4; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + SB52, !- Name + WALL, !- Surface Type + INT-WALL-1, !- Construction Name + SPACE5-1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + SB25, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 26.8,3.7,2.4, !- X,Y,Z ==> Vertex 1 {m} + 26.8,3.7,0.0, !- X,Y,Z ==> Vertex 2 {m} + 26.8,11.6,0.0, !- X,Y,Z ==> Vertex 3 {m} + 26.8,11.6,2.4; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + SB53, !- Name + WALL, !- Surface Type + INT-WALL-1, !- Construction Name + SPACE5-1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + SB35, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 26.8,11.6,2.4, !- X,Y,Z ==> Vertex 1 {m} + 26.8,11.6,0.0, !- X,Y,Z ==> Vertex 2 {m} + 3.7,11.6,0.0, !- X,Y,Z ==> Vertex 3 {m} + 3.7,11.6,2.4; !- X,Y,Z ==> Vertex 4 {m} + + BuildingSurface:Detailed, + SB54, !- Name + WALL, !- Surface Type + INT-WALL-1, !- Construction Name + SPACE5-1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + SB45, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + 0.0, !- View Factor to Ground + 4, !- Number of Vertices + 3.7,11.6,2.4, !- X,Y,Z ==> Vertex 1 {m} + 3.7,11.6,0.0, !- X,Y,Z ==> Vertex 2 {m} + 3.7,3.7,0.0, !- X,Y,Z ==> Vertex 3 {m} + 3.7,3.7,2.4; !- X,Y,Z ==> Vertex 4 {m} + +! For heating, recover 2 hrs early + + Schedule:Compact, + Htg-SetP-Sch, !- Name + Temperature, !- Schedule Type Limits Name + Through: 12/31, !- Field 1 + For: WeekDays CustomDay1 CustomDay2, !- Field 2 + Until: 6:00,13.0, !- Field 3 + Until: 7:00,18.0, !- Field 5 + Until: 21:00,23.0, !- Field 7 + Until: 24:00,13.0, !- Field 9 + For: WeekEnds Holiday, !- Field 11 + Until: 24:00,13.0, !- Field 12 + For: SummerDesignDay, !- Field 14 + Until: 24:00,13.0, !- Field 15 + For: WinterDesignDay, !- Field 17 + Until: 24:00,23.0; !- Field 18 + +! For cooling, recover 1 hr early + + Schedule:Compact, + Clg-SetP-Sch, !- Name + Temperature, !- Schedule Type Limits Name + Through: 12/31, !- Field 1 + For: WeekDays CustomDay1 CustomDay2, !- Field 2 + Until: 7:00,32.0, !- Field 3 + Until: 21:00,24.0, !- Field 5 + Until: 24:00,32.0, !- Field 7 + For: WeekEnds Holiday, !- Field 9 + Until: 24:00,32.0, !- Field 10 + For: SummerDesignDay, !- Field 12 + Until: 24:00,24.0, !- Field 13 + For: WinterDesignDay, !- Field 15 + Until: 24:00,32.0; !- Field 16 + + Sizing:Parameters, + 1.2, !- Heating Sizing Factor + 1.2; !- Cooling Sizing Factor + + HVACTemplate:Thermostat, + All Zones, !- Name + Htg-SetP-Sch, !- Heating Setpoint Schedule Name + , !- Constant Heating Setpoint {C} + Clg-SetP-Sch, !- Cooling Setpoint Schedule Name + ; !- Constant Cooling Setpoint {C} + + HVACTemplate:Zone:PTAC, + SPACE1-1, !- Zone Name + All Zones, !- Template Thermostat Name + autosize, !- Cooling Supply Air Flow Rate {m3/s} + autosize, !- Heating Supply Air Flow Rate {m3/s} + , !- No Load Supply Air Flow Rate {m3/s} + , !- Zone Heating Sizing Factor + , !- Zone Cooling Sizing Factor + flow/person, !- Outdoor Air Method + 0.00944, !- Outdoor Air Flow Rate per Person {m3/s} + , !- Outdoor Air Flow Rate per Zone Floor Area {m3/s-m2} + , !- Outdoor Air Flow Rate per Zone {m3/s} + , !- System Availability Schedule Name + , !- Supply Fan Operating Mode Schedule Name + DrawThrough, !- Supply Fan Placement + 0.7, !- Supply Fan Total Efficiency + 75, !- Supply Fan Delta Pressure {Pa} + 0.9, !- Supply Fan Motor Efficiency + SingleSpeedDX, !- Cooling Coil Type + , !- Cooling Coil Availability Schedule Name + autosize, !- Cooling Coil Gross Rated Total Capacity {W} + autosize, !- Cooling Coil Gross Rated Sensible Heat Ratio + 3, !- Cooling Coil Gross Rated Cooling COP {W/W} + Electric, !- Heating Coil Type + , !- Heating Coil Availability Schedule Name + autosize, !- Heating Coil Capacity {W} + 0.8, !- Gas Heating Coil Efficiency + , !- Gas Heating Coil Parasitic Electric Load {W} + DOAS, !- Dedicated Outdoor Air System Name + SupplyAirTemperature, !- Zone Cooling Design Supply Air Temperature Input Method + 14.0, !- Zone Cooling Design Supply Air Temperature {C} + , !- Zone Cooling Design Supply Air Temperature Difference {deltaC} + SupplyAirTemperature, !- Zone Heating Design Supply Air Temperature Input Method + 50.0, !- Zone Heating Design Supply Air Temperature {C} + , !- Zone Heating Design Supply Air Temperature Difference {deltaC} + , !- Design Specification Outdoor Air Object Name + , !- Design Specification Zone Air Distribution Object Name + , !- Baseboard Heating Type + , !- Baseboard Heating Availability Schedule Name + , !- Baseboard Heating Capacity {W} + None; !- Capacity Control Method + + HVACTemplate:Zone:PTAC, + SPACE2-1, !- Zone Name + All Zones, !- Template Thermostat Name + autosize, !- Cooling Supply Air Flow Rate {m3/s} + autosize, !- Heating Supply Air Flow Rate {m3/s} + , !- No Load Supply Air Flow Rate {m3/s} + , !- Zone Heating Sizing Factor + , !- Zone Cooling Sizing Factor + flow/person, !- Outdoor Air Method + 0.00944, !- Outdoor Air Flow Rate per Person {m3/s} + , !- Outdoor Air Flow Rate per Zone Floor Area {m3/s-m2} + , !- Outdoor Air Flow Rate per Zone {m3/s} + , !- System Availability Schedule Name + , !- Supply Fan Operating Mode Schedule Name + DrawThrough, !- Supply Fan Placement + 0.7, !- Supply Fan Total Efficiency + 75, !- Supply Fan Delta Pressure {Pa} + 0.9, !- Supply Fan Motor Efficiency + SingleSpeedDX, !- Cooling Coil Type + , !- Cooling Coil Availability Schedule Name + autosize, !- Cooling Coil Gross Rated Total Capacity {W} + autosize, !- Cooling Coil Gross Rated Sensible Heat Ratio + 3, !- Cooling Coil Gross Rated Cooling COP {W/W} + Electric, !- Heating Coil Type + , !- Heating Coil Availability Schedule Name + autosize, !- Heating Coil Capacity {W} + 0.8, !- Gas Heating Coil Efficiency + , !- Gas Heating Coil Parasitic Electric Load {W} + DOAS, !- Dedicated Outdoor Air System Name + SupplyAirTemperature, !- Zone Cooling Design Supply Air Temperature Input Method + 14.0, !- Zone Cooling Design Supply Air Temperature {C} + , !- Zone Cooling Design Supply Air Temperature Difference {deltaC} + SupplyAirTemperature, !- Zone Heating Design Supply Air Temperature Input Method + 50.0, !- Zone Heating Design Supply Air Temperature {C} + , !- Zone Heating Design Supply Air Temperature Difference {deltaC} + , !- Design Specification Outdoor Air Object Name + , !- Design Specification Zone Air Distribution Object Name + , !- Baseboard Heating Type + , !- Baseboard Heating Availability Schedule Name + , !- Baseboard Heating Capacity {W} + None; !- Capacity Control Method + + HVACTemplate:Zone:PTAC, + SPACE3-1, !- Zone Name + All Zones, !- Template Thermostat Name + autosize, !- Cooling Supply Air Flow Rate {m3/s} + autosize, !- Heating Supply Air Flow Rate {m3/s} + , !- No Load Supply Air Flow Rate {m3/s} + , !- Zone Heating Sizing Factor + , !- Zone Cooling Sizing Factor + flow/person, !- Outdoor Air Method + 0.00944, !- Outdoor Air Flow Rate per Person {m3/s} + , !- Outdoor Air Flow Rate per Zone Floor Area {m3/s-m2} + , !- Outdoor Air Flow Rate per Zone {m3/s} + , !- System Availability Schedule Name + , !- Supply Fan Operating Mode Schedule Name + BlowThrough, !- Supply Fan Placement + 0.7, !- Supply Fan Total Efficiency + 75, !- Supply Fan Delta Pressure {Pa} + 0.9, !- Supply Fan Motor Efficiency + SingleSpeedDX, !- Cooling Coil Type + , !- Cooling Coil Availability Schedule Name + autosize, !- Cooling Coil Gross Rated Total Capacity {W} + autosize, !- Cooling Coil Gross Rated Sensible Heat Ratio + 3, !- Cooling Coil Gross Rated Cooling COP {W/W} + Electric, !- Heating Coil Type + , !- Heating Coil Availability Schedule Name + autosize, !- Heating Coil Capacity {W} + 0.8, !- Gas Heating Coil Efficiency + , !- Gas Heating Coil Parasitic Electric Load {W} + DOAS, !- Dedicated Outdoor Air System Name + SupplyAirTemperature, !- Zone Cooling Design Supply Air Temperature Input Method + 14.0, !- Zone Cooling Design Supply Air Temperature {C} + , !- Zone Cooling Design Supply Air Temperature Difference {deltaC} + SupplyAirTemperature, !- Zone Heating Design Supply Air Temperature Input Method + 50.0, !- Zone Heating Design Supply Air Temperature {C} + , !- Zone Heating Design Supply Air Temperature Difference {deltaC} + , !- Design Specification Outdoor Air Object Name + , !- Design Specification Zone Air Distribution Object Name + , !- Baseboard Heating Type + , !- Baseboard Heating Availability Schedule Name + , !- Baseboard Heating Capacity {W} + None; !- Capacity Control Method + + HVACTemplate:Zone:PTAC, + SPACE4-1, !- Zone Name + All Zones, !- Template Thermostat Name + autosize, !- Cooling Supply Air Flow Rate {m3/s} + autosize, !- Heating Supply Air Flow Rate {m3/s} + , !- No Load Supply Air Flow Rate {m3/s} + , !- Zone Heating Sizing Factor + , !- Zone Cooling Sizing Factor + flow/person, !- Outdoor Air Method + 0.00944, !- Outdoor Air Flow Rate per Person {m3/s} + , !- Outdoor Air Flow Rate per Zone Floor Area {m3/s-m2} + , !- Outdoor Air Flow Rate per Zone {m3/s} + , !- System Availability Schedule Name + , !- Supply Fan Operating Mode Schedule Name + BlowThrough, !- Supply Fan Placement + 0.7, !- Supply Fan Total Efficiency + 75, !- Supply Fan Delta Pressure {Pa} + 0.9, !- Supply Fan Motor Efficiency + SingleSpeedDX, !- Cooling Coil Type + , !- Cooling Coil Availability Schedule Name + autosize, !- Cooling Coil Gross Rated Total Capacity {W} + autosize, !- Cooling Coil Gross Rated Sensible Heat Ratio + 3, !- Cooling Coil Gross Rated Cooling COP {W/W} + Electric, !- Heating Coil Type + , !- Heating Coil Availability Schedule Name + autosize, !- Heating Coil Capacity {W} + 0.8, !- Gas Heating Coil Efficiency + , !- Gas Heating Coil Parasitic Electric Load {W} + DOAS, !- Dedicated Outdoor Air System Name + SupplyAirTemperature, !- Zone Cooling Design Supply Air Temperature Input Method + 14.0, !- Zone Cooling Design Supply Air Temperature {C} + , !- Zone Cooling Design Supply Air Temperature Difference {deltaC} + SupplyAirTemperature, !- Zone Heating Design Supply Air Temperature Input Method + 50.0, !- Zone Heating Design Supply Air Temperature {C} + , !- Zone Heating Design Supply Air Temperature Difference {deltaC} + , !- Design Specification Outdoor Air Object Name + , !- Design Specification Zone Air Distribution Object Name + , !- Baseboard Heating Type + , !- Baseboard Heating Availability Schedule Name + , !- Baseboard Heating Capacity {W} + None; !- Capacity Control Method + + HVACTemplate:Zone:PTAC, + SPACE5-1, !- Zone Name + All Zones, !- Template Thermostat Name + autosize, !- Cooling Supply Air Flow Rate {m3/s} + autosize, !- Heating Supply Air Flow Rate {m3/s} + , !- No Load Supply Air Flow Rate {m3/s} + , !- Zone Heating Sizing Factor + , !- Zone Cooling Sizing Factor + flow/person, !- Outdoor Air Method + 0.00944, !- Outdoor Air Flow Rate per Person {m3/s} + , !- Outdoor Air Flow Rate per Zone Floor Area {m3/s-m2} + , !- Outdoor Air Flow Rate per Zone {m3/s} + , !- System Availability Schedule Name + , !- Supply Fan Operating Mode Schedule Name + DrawThrough, !- Supply Fan Placement + 0.7, !- Supply Fan Total Efficiency + 75, !- Supply Fan Delta Pressure {Pa} + 0.9, !- Supply Fan Motor Efficiency + SingleSpeedDX, !- Cooling Coil Type + , !- Cooling Coil Availability Schedule Name + autosize, !- Cooling Coil Gross Rated Total Capacity {W} + autosize, !- Cooling Coil Gross Rated Sensible Heat Ratio + 3, !- Cooling Coil Gross Rated Cooling COP {W/W} + Electric, !- Heating Coil Type + , !- Heating Coil Availability Schedule Name + autosize, !- Heating Coil Capacity {W} + 0.8, !- Gas Heating Coil Efficiency + , !- Gas Heating Coil Parasitic Electric Load {W} + DOAS, !- Dedicated Outdoor Air System Name + SupplyAirTemperature, !- Zone Cooling Design Supply Air Temperature Input Method + 14.0, !- Zone Cooling Design Supply Air Temperature {C} + , !- Zone Cooling Design Supply Air Temperature Difference {deltaC} + SupplyAirTemperature, !- Zone Heating Design Supply Air Temperature Input Method + 50.0, !- Zone Heating Design Supply Air Temperature {C} + , !- Zone Heating Design Supply Air Temperature Difference {deltaC} + , !- Design Specification Outdoor Air Object Name + , !- Design Specification Zone Air Distribution Object Name + , !- Baseboard Heating Type + , !- Baseboard Heating Availability Schedule Name + , !- Baseboard Heating Capacity {W} + None; !- Capacity Control Method + + HVACTemplate:System:DedicatedOutdoorAir, + DOAS, !- Name + OCCUPY-1, !- System Availability Schedule Name + DirectIntoZone, !- Air Outlet Type + autosize, !- Supply Fan Flow Rate {m3/s} + 0.7, !- Supply Fan Total Efficiency + 1000, !- Supply Fan Delta Pressure {Pa} + 0.9, !- Supply Fan Motor Efficiency + 1, !- Supply Fan Motor in Air Stream Fraction + BlowThrough, !- Supply Fan Placement + HeatExchangerAssistedDX, !- Cooling Coil Type + , !- Cooling Coil Availability Schedule Name + FixedSetpoint, !- Cooling Coil Setpoint Control Type + 12.8, !- Cooling Coil Design Setpoint {C} + , !- Cooling Coil Setpoint Schedule Name + 15.6, !- Cooling Coil Setpoint at Outdoor Dry-Bulb Low {C} + 15.6, !- Cooling Coil Reset Outdoor Dry-Bulb Low {C} + 12.8, !- Cooling Coil Setpoint at Outdoor Dry-Bulb High {C} + 23.3, !- Cooling Coil Reset Outdoor Dry-Bulb High {C} + autosize, !- DX Cooling Coil Gross Rated Total Capacity {W} + autosize, !- DX Cooling Coil Gross Rated Sensible Heat Ratio + 3, !- DX Cooling Coil Gross Rated COP {W/W} + Gas, !- Heating Coil Type + , !- Heating Coil Availability Schedule Name + FixedSetpoint, !- Heating Coil Setpoint Control Type + 12.2, !- Heating Coil Design Setpoint {C} + , !- Heating Coil Setpoint Schedule Name + 15, !- Heating Coil Setpoint at Outdoor Dry-Bulb Low {C} + 7.8, !- Heating Coil Reset Outdoor Dry-Bulb Low {C} + 12.2, !- Heating Coil Setpoint at Outdoor Dry-Bulb High {C} + 12.2, !- Heating Coil Reset Outdoor Dry-Bulb High {C} + 0.8, !- Gas Heating Coil Efficiency + , !- Gas Heating Coil Parasitic Electric Load {W} + Enthalpy, !- Heat Recovery Type + 0.7, !- Heat Recovery Sensible Effectiveness + 0.65, !- Heat Recovery Latent Effectiveness + Plate, !- Heat Recovery Heat Exchanger Type + None, !- Heat Recovery Frost Control Type + Multimode, !- Dehumidification Control Type + 0.00924, !- Dehumidification Setpoint {kgWater/kgDryAir} + None, !- Humidifier Type + , !- Humidifier Availability Schedule Name + 0.000001, !- Humidifier Rated Capacity {m3/s} + 2690, !- Humidifier Rated Electric Power {W} + 0.003, !- Humidifier Constant Setpoint {kgWater/kgDryAir} + , !- Dehumidification Setpoint Schedule Name + ; !- Humidifier Setpoint Schedule Name + + Output:Variable,*,Site Outdoor Air Drybulb Temperature,hourly; + + Output:Variable,*,Zone Air Temperature,hourly; + + Output:Variable,*,Zone Air System Sensible Cooling Rate,hourly; + + Output:Variable,*,Zone Air System Sensible Heating Rate,hourly; + + Output:Variable,*,Zone Mean Air Temperature,hourly; + + Output:Variable,*,Zone Mean Radiant Temperature,hourly; + + Output:Variable,*,Zone Operative Temperature,hourly; + + Output:Variable,*,Zone Thermal Comfort ASHRAE 55 Simple Model Summer or Winter Clothes Not Comfortable Time,hourly; + + Output:Variable,*,Zone Air Humidity Ratio,hourly; + + Output:Variable,*,Zone Air Relative Humidity,hourly; + + Output:Variable,*,Zone Heating Setpoint Not Met While Occupied Time,hourly; + + Output:Variable,*,Zone Cooling Setpoint Not Met While Occupied Time,hourly; + + Output:Variable,*,Zone Packaged Terminal Air Conditioner Total Heating Rate,hourly; + + Output:Variable,*,Zone Packaged Terminal Air Conditioner Total Cooling Rate,hourly; + + Output:Variable,*,Zone Packaged Terminal Air Conditioner Sensible Heating Rate,hourly; + + Output:Variable,*,Zone Packaged Terminal Air Conditioner Sensible Cooling Rate,hourly; + + Output:Variable,*,Zone Packaged Terminal Air Conditioner Latent Heating Rate,hourly; + + Output:Variable,*,Zone Packaged Terminal Air Conditioner Latent Cooling Rate,hourly; + + Output:Variable,*,Zone Packaged Terminal Air Conditioner Electricity Rate,hourly; + + Output:Variable,*,Zone Packaged Terminal Air Conditioner Fan Part Load Ratio,hourly; + + Output:Variable,*,Zone Packaged Terminal Air Conditioner Compressor Part Load Ratio,hourly; + + Output:Variable,*,Heating Coil Heating Rate,hourly; + + Output:Variable,*,Heating Coil Electricity Rate,hourly; + + Output:Variable,*,Heating Coil NaturalGas Rate,hourly; + + Output:Variable,*,Heating Coil Runtime Fraction,hourly; + + Output:Variable,*,Cooling Coil Total Cooling Rate,hourly; + + Output:Variable,*,Cooling Coil Electricity Rate,hourly; + + Output:VariableDictionary,IDF; + + Output:Surfaces:Drawing,dxf; + + Output:Surfaces:List,lines; + + Output:Meter:MeterFileOnly,Electricity:Facility,monthly; + + Output:Meter:MeterFileOnly,Electricity:Building,monthly; + + Output:Meter:MeterFileOnly,InteriorLights:Electricity,monthly; + + Output:Meter:MeterFileOnly,Electricity:HVAC,monthly; + + Output:Meter:MeterFileOnly,NaturalGas:Facility,monthly; + + Output:Meter:MeterFileOnly,Electricity:Facility,runperiod; + + Output:Meter:MeterFileOnly,Electricity:Building,runperiod; + + Output:Meter:MeterFileOnly,InteriorLights:Electricity,runperiod; + + Output:Meter:MeterFileOnly,Electricity:HVAC,runperiod; + + Output:Meter:MeterFileOnly,NaturalGas:Facility,runperiod; + + OutputControl:Table:Style, + HTML; !- Column Separator + + Output:Table:SummaryReports, + AllSummary; !- Report 1 Name + diff --git a/testfiles/PythonPlugin1ZoneUncontrolledCondFD.py b/testfiles/PythonPlugin1ZoneUncontrolledCondFD.py index e42eb5a2d0f..8019db29099 100644 --- a/testfiles/PythonPlugin1ZoneUncontrolledCondFD.py +++ b/testfiles/PythonPlugin1ZoneUncontrolledCondFD.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/testfiles/PythonPlugin1ZoneUncontrolledTrackHistory.py b/testfiles/PythonPlugin1ZoneUncontrolledTrackHistory.py index d79af97f9b3..67ad95c4fe2 100644 --- a/testfiles/PythonPlugin1ZoneUncontrolledTrackHistory.py +++ b/testfiles/PythonPlugin1ZoneUncontrolledTrackHistory.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/testfiles/PythonPluginAirflowNetworkOpeningControlByHumidity.py b/testfiles/PythonPluginAirflowNetworkOpeningControlByHumidity.py index 7f192ffb9e3..3f40949f6e9 100644 --- a/testfiles/PythonPluginAirflowNetworkOpeningControlByHumidity.py +++ b/testfiles/PythonPluginAirflowNetworkOpeningControlByHumidity.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/testfiles/PythonPluginConstantVolumePurchasedAir.py b/testfiles/PythonPluginConstantVolumePurchasedAir.py index 41c14f3f685..7a94fca9dc3 100644 --- a/testfiles/PythonPluginConstantVolumePurchasedAir.py +++ b/testfiles/PythonPluginConstantVolumePurchasedAir.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/testfiles/PythonPluginCurveOverride_PackagedTerminalHeatPump.py b/testfiles/PythonPluginCurveOverride_PackagedTerminalHeatPump.py index 7e922222856..14aa8afa3c3 100644 --- a/testfiles/PythonPluginCurveOverride_PackagedTerminalHeatPump.py +++ b/testfiles/PythonPluginCurveOverride_PackagedTerminalHeatPump.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/testfiles/PythonPluginCustomOutputVariable.py b/testfiles/PythonPluginCustomOutputVariable.py index 9548d319f8d..89a3813d561 100644 --- a/testfiles/PythonPluginCustomOutputVariable.py +++ b/testfiles/PythonPluginCustomOutputVariable.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/testfiles/PythonPluginCustomSchedule.py b/testfiles/PythonPluginCustomSchedule.py index a777c349c85..166f3974bd2 100644 --- a/testfiles/PythonPluginCustomSchedule.py +++ b/testfiles/PythonPluginCustomSchedule.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/testfiles/PythonPluginCustomTrendVariable.py b/testfiles/PythonPluginCustomTrendVariable.py index dd193e9fe80..9a7dff86532 100644 --- a/testfiles/PythonPluginCustomTrendVariable.py +++ b/testfiles/PythonPluginCustomTrendVariable.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/testfiles/PythonPluginDemandManager_LargeOffice.py b/testfiles/PythonPluginDemandManager_LargeOffice.py index de79134302b..5c803d89511 100644 --- a/testfiles/PythonPluginDemandManager_LargeOffice.py +++ b/testfiles/PythonPluginDemandManager_LargeOffice.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/testfiles/PythonPluginDiscreteAirSystemSizes.py b/testfiles/PythonPluginDiscreteAirSystemSizes.py index 8559d91dbf2..30f63ded571 100644 --- a/testfiles/PythonPluginDiscreteAirSystemSizes.py +++ b/testfiles/PythonPluginDiscreteAirSystemSizes.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/testfiles/PythonPluginLoadBasedMultiSpeedDXCoilOverrideControl.py b/testfiles/PythonPluginLoadBasedMultiSpeedDXCoilOverrideControl.py index d548b4a22e4..e44be99e1bd 100644 --- a/testfiles/PythonPluginLoadBasedMultiSpeedDXCoilOverrideControl.py +++ b/testfiles/PythonPluginLoadBasedMultiSpeedDXCoilOverrideControl.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/testfiles/PythonPluginLrgOff_GridStorageSmoothing.py b/testfiles/PythonPluginLrgOff_GridStorageSmoothing.py index 0bdc7b6d857..5bda576fbc1 100644 --- a/testfiles/PythonPluginLrgOff_GridStorageSmoothing.py +++ b/testfiles/PythonPluginLrgOff_GridStorageSmoothing.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/testfiles/PythonPluginMultiSpeedHeatPumpOverrideControl.py b/testfiles/PythonPluginMultiSpeedHeatPumpOverrideControl.py index 8b88a352043..a780e4b6c88 100644 --- a/testfiles/PythonPluginMultiSpeedHeatPumpOverrideControl.py +++ b/testfiles/PythonPluginMultiSpeedHeatPumpOverrideControl.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/testfiles/PythonPluginPlantLoopOverrideControl.py b/testfiles/PythonPluginPlantLoopOverrideControl.py index 17920e50dea..2c343a913b1 100644 --- a/testfiles/PythonPluginPlantLoopOverrideControl.py +++ b/testfiles/PythonPluginPlantLoopOverrideControl.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/testfiles/PythonPluginPlantOperation_largeOff.py b/testfiles/PythonPluginPlantOperation_largeOff.py index c99c4fe3a8a..a144be7ed6f 100644 --- a/testfiles/PythonPluginPlantOperation_largeOff.py +++ b/testfiles/PythonPluginPlantOperation_largeOff.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/testfiles/PythonPluginReplaceTraditionalManagers_LargeOffice.py b/testfiles/PythonPluginReplaceTraditionalManagers_LargeOffice.py index 743176b02bc..aa380ee5712 100644 --- a/testfiles/PythonPluginReplaceTraditionalManagers_LargeOffice.py +++ b/testfiles/PythonPluginReplaceTraditionalManagers_LargeOffice.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/testfiles/PythonPluginTestMathAndKill.py b/testfiles/PythonPluginTestMathAndKill.py index 3d2bfd7fec4..33919b331ba 100644 --- a/testfiles/PythonPluginTestMathAndKill.py +++ b/testfiles/PythonPluginTestMathAndKill.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/testfiles/PythonPluginThermochromicWindow.py b/testfiles/PythonPluginThermochromicWindow.py index e7227e7da07..71cf9648efc 100644 --- a/testfiles/PythonPluginThermochromicWindow.py +++ b/testfiles/PythonPluginThermochromicWindow.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/testfiles/PythonPluginUserDefined5ZoneAirCooled.py b/testfiles/PythonPluginUserDefined5ZoneAirCooled.py index bf2f562d92f..bef3b2a3cf7 100644 --- a/testfiles/PythonPluginUserDefined5ZoneAirCooled.py +++ b/testfiles/PythonPluginUserDefined5ZoneAirCooled.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/testfiles/PythonPluginUserDefinedWindACAuto.py b/testfiles/PythonPluginUserDefinedWindACAuto.py index ee973fdd186..caf72fe3feb 100644 --- a/testfiles/PythonPluginUserDefinedWindACAuto.py +++ b/testfiles/PythonPluginUserDefinedWindACAuto.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/testfiles/PythonPluginWindowShadeControl.py b/testfiles/PythonPluginWindowShadeControl.py index b477edacb30..e2c1902f76a 100644 --- a/testfiles/PythonPluginWindowShadeControl.py +++ b/testfiles/PythonPluginWindowShadeControl.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/testfiles/PythonPlugin_SingleFamilyHouse_TwoSpeed_MultiStageElectricSuppCoil.py b/testfiles/PythonPlugin_SingleFamilyHouse_TwoSpeed_MultiStageElectricSuppCoil.py index db2c49d6b6d..58b27d39394 100644 --- a/testfiles/PythonPlugin_SingleFamilyHouse_TwoSpeed_MultiStageElectricSuppCoil.py +++ b/testfiles/PythonPlugin_SingleFamilyHouse_TwoSpeed_MultiStageElectricSuppCoil.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/testfiles/SingleFamilyHouse_HP_Slab.idf b/testfiles/SingleFamilyHouse_HP_Slab.idf index 0ee9bbd780d..0a940bdf146 100644 --- a/testfiles/SingleFamilyHouse_HP_Slab.idf +++ b/testfiles/SingleFamilyHouse_HP_Slab.idf @@ -2694,102 +2694,6 @@ 15, !- CLEARANCE: Distance from edge of slab to domain edge {m} 15; !- ZCLEARANCE: Distance from bottom of slab to domain bottom {m} -!- =========== ALL OBJECTS IN CLASS: GROUNDHEATTRANSFER:BASEMENT:SIMPARAMETERS =========== - - GroundHeatTransfer:Basement:SimParameters, - 0.1, !- F: Multiplier for the ADI solution - 15; !- IYRS: Maximum number of yearly iterations: - -!- =========== ALL OBJECTS IN CLASS: GROUNDHEATTRANSFER:BASEMENT:MATLPROPS =========== - - GroundHeatTransfer:Basement:MatlProps, - 6, !- NMAT: Number of materials in this domain - 2243, !- Density for Foundation Wall {kg/m3} - 2243, !- density for Floor Slab {kg/m3} - 311, !- density for Ceiling {kg/m3} - 1500, !- density for Soil {kg/m3} - 2000, !- density for Gravel {kg/m3} - 449, !- density for Wood {kg/m3} - 880, !- Specific heat for foundation wall {J/kg-K} - 880, !- Specific heat for floor slab {J/kg-K} - 1530, !- Specific heat for ceiling {J/kg-K} - 840, !- Specific heat for soil {J/kg-K} - 720, !- Specific heat for gravel {J/kg-K} - 1530, !- Specific heat for wood {J/kg-K} - 1.4, !- Thermal conductivity for foundation wall {W/m-K} - 1.4, !- Thermal conductivity for floor slab {W/m-K} - 0.09, !- Thermal conductivity for ceiling {W/m-K} - 1.1, !- thermal conductivity for soil {W/m-K} - 1.9, !- thermal conductivity for gravel {W/m-K} - 0.12; !- thermal conductivity for wood {W/m-K} - -!- =========== ALL OBJECTS IN CLASS: GROUNDHEATTRANSFER:BASEMENT:INSULATION =========== - - GroundHeatTransfer:Basement:Insulation, - 1.76099742894375e-05, !- REXT: R Value of any exterior insulation {m2-K/W} - True; !- INSFULL: Flag: Is the wall fully insulated? - -!- =========== ALL OBJECTS IN CLASS: GROUNDHEATTRANSFER:BASEMENT:SURFACEPROPS =========== - - GroundHeatTransfer:Basement:SurfaceProps, - 0.16, !- ALBEDO: Surface albedo for No snow conditions - 0.4, !- ALBEDO: Surface albedo for snow conditions - 0.94, !- EPSLN: Surface emissivity No Snow - 0.86, !- EPSLN: Surface emissivity with Snow - 6, !- VEGHT: Surface roughness No snow conditions {cm} - 0.25, !- VEGHT: Surface roughness Snow conditions {cm} - False; !- PET: Flag, Potential evapotranspiration on? - -!- =========== ALL OBJECTS IN CLASS: GROUNDHEATTRANSFER:BASEMENT:BLDGDATA =========== - - GroundHeatTransfer:Basement:BldgData, - 0.200000006162114, !- DWALL: Wall thickness {m} - 0.243828108701145, !- DSLAB: Floor slab thickness {m} - 0.3, !- DGRAVXY: Width of gravel pit beside basement wall {m} - 0.2, !- DGRAVZN: Gravel depth extending above the floor slab {m} - 0.1; !- DGRAVZP: Gravel depth below the floor slab {m} - -!- =========== ALL OBJECTS IN CLASS: GROUNDHEATTRANSFER:BASEMENT:INTERIOR =========== - - GroundHeatTransfer:Basement:Interior, - True, !- COND: Flag: Is the basement conditioned? - 0.92, !- HIN: Downward convection only heat transfer coefficient {W/m2-K} - 4.04, !- HIN: Upward convection only heat transfer coefficient {W/m2-K} - 3.08, !- HIN: Horizontal convection only heat transfer coefficient {W/m2-K} - 6.13, !- HIN: Downward combined (convection and radiation) heat transfer coefficient {W/m2-K} - 9.26, !- HIN: Upward combined (convection and radiation) heat transfer coefficient {W/m2-K} - 8.29; !- HIN: Horizontal combined (convection and radiation) heat transfer coefficient {W/m2-K} - -!- =========== ALL OBJECTS IN CLASS: GROUNDHEATTRANSFER:BASEMENT:COMBLDG =========== - - GroundHeatTransfer:Basement:ComBldg, - 21, !- January average temperature {C} - 21, !- February average temperature {C} - 21, !- March average temperature {C} - 21, !- April average temperature {C} - 24, !- May average temperature {C} - 24, !- June average temperature {C} - 24, !- July average temperature {C} - 24, !- August average temperature {C} - 24, !- September average temperature {C} - 24, !- October average temperature {C} - 21, !- November average temperature {C} - 21, !- December average temperature {C} - 21; !- Daily variation sine wave amplitude {deltaC} - -!- =========== ALL OBJECTS IN CLASS: GROUNDHEATTRANSFER:BASEMENT:EQUIVSLAB =========== - - GroundHeatTransfer:Basement:EquivSlab, - 2.59994805991784, !- APRatio: The area to perimeter ratio for this slab {m} - True; !- EquivSizing: Flag - -!- =========== ALL OBJECTS IN CLASS: GROUNDHEATTRANSFER:BASEMENT:EQUIVAUTOGRID =========== - - GroundHeatTransfer:Basement:EquivAutoGrid, - 15, !- CLEARANCE: Distance from outside of wall to edge of 3-D ground domain {m} - 0.1, !- SlabDepth: Thickness of the floor slab {m} - 1.21914054350572; !- BaseDepth: Depth of the basement wall below grade {m} - !- =========== ALL OBJECTS IN CLASS: PEOPLE =========== People, diff --git a/testfiles/SingleFamilyHouse_HP_Slab_Dehumidification.idf b/testfiles/SingleFamilyHouse_HP_Slab_Dehumidification.idf index 4e82ed6cd03..b4bcbf83ca4 100644 --- a/testfiles/SingleFamilyHouse_HP_Slab_Dehumidification.idf +++ b/testfiles/SingleFamilyHouse_HP_Slab_Dehumidification.idf @@ -2694,102 +2694,6 @@ 15, !- CLEARANCE: Distance from edge of slab to domain edge {m} 15; !- ZCLEARANCE: Distance from bottom of slab to domain bottom {m} -!- =========== ALL OBJECTS IN CLASS: GROUNDHEATTRANSFER:BASEMENT:SIMPARAMETERS =========== - - GroundHeatTransfer:Basement:SimParameters, - 0.1, !- F: Multiplier for the ADI solution - 15; !- IYRS: Maximum number of yearly iterations: - -!- =========== ALL OBJECTS IN CLASS: GROUNDHEATTRANSFER:BASEMENT:MATLPROPS =========== - - GroundHeatTransfer:Basement:MatlProps, - 6, !- NMAT: Number of materials in this domain - 2243, !- Density for Foundation Wall {kg/m3} - 2243, !- density for Floor Slab {kg/m3} - 311, !- density for Ceiling {kg/m3} - 1500, !- density for Soil {kg/m3} - 2000, !- density for Gravel {kg/m3} - 449, !- density for Wood {kg/m3} - 880, !- Specific heat for foundation wall {J/kg-K} - 880, !- Specific heat for floor slab {J/kg-K} - 1530, !- Specific heat for ceiling {J/kg-K} - 840, !- Specific heat for soil {J/kg-K} - 720, !- Specific heat for gravel {J/kg-K} - 1530, !- Specific heat for wood {J/kg-K} - 1.4, !- Thermal conductivity for foundation wall {W/m-K} - 1.4, !- Thermal conductivity for floor slab {W/m-K} - 0.09, !- Thermal conductivity for ceiling {W/m-K} - 1.1, !- thermal conductivity for soil {W/m-K} - 1.9, !- thermal conductivity for gravel {W/m-K} - 0.12; !- thermal conductivity for wood {W/m-K} - -!- =========== ALL OBJECTS IN CLASS: GROUNDHEATTRANSFER:BASEMENT:INSULATION =========== - - GroundHeatTransfer:Basement:Insulation, - 1.76099742894375e-05, !- REXT: R Value of any exterior insulation {m2-K/W} - True; !- INSFULL: Flag: Is the wall fully insulated? - -!- =========== ALL OBJECTS IN CLASS: GROUNDHEATTRANSFER:BASEMENT:SURFACEPROPS =========== - - GroundHeatTransfer:Basement:SurfaceProps, - 0.16, !- ALBEDO: Surface albedo for No snow conditions - 0.4, !- ALBEDO: Surface albedo for snow conditions - 0.94, !- EPSLN: Surface emissivity No Snow - 0.86, !- EPSLN: Surface emissivity with Snow - 6, !- VEGHT: Surface roughness No snow conditions {cm} - 0.25, !- VEGHT: Surface roughness Snow conditions {cm} - False; !- PET: Flag, Potential evapotranspiration on? - -!- =========== ALL OBJECTS IN CLASS: GROUNDHEATTRANSFER:BASEMENT:BLDGDATA =========== - - GroundHeatTransfer:Basement:BldgData, - 0.200000006162114, !- DWALL: Wall thickness {m} - 0.243828108701145, !- DSLAB: Floor slab thickness {m} - 0.3, !- DGRAVXY: Width of gravel pit beside basement wall {m} - 0.2, !- DGRAVZN: Gravel depth extending above the floor slab {m} - 0.1; !- DGRAVZP: Gravel depth below the floor slab {m} - -!- =========== ALL OBJECTS IN CLASS: GROUNDHEATTRANSFER:BASEMENT:INTERIOR =========== - - GroundHeatTransfer:Basement:Interior, - True, !- COND: Flag: Is the basement conditioned? - 0.92, !- HIN: Downward convection only heat transfer coefficient {W/m2-K} - 4.04, !- HIN: Upward convection only heat transfer coefficient {W/m2-K} - 3.08, !- HIN: Horizontal convection only heat transfer coefficient {W/m2-K} - 6.13, !- HIN: Downward combined (convection and radiation) heat transfer coefficient {W/m2-K} - 9.26, !- HIN: Upward combined (convection and radiation) heat transfer coefficient {W/m2-K} - 8.29; !- HIN: Horizontal combined (convection and radiation) heat transfer coefficient {W/m2-K} - -!- =========== ALL OBJECTS IN CLASS: GROUNDHEATTRANSFER:BASEMENT:COMBLDG =========== - - GroundHeatTransfer:Basement:ComBldg, - 21, !- January average temperature {C} - 21, !- February average temperature {C} - 21, !- March average temperature {C} - 21, !- April average temperature {C} - 24, !- May average temperature {C} - 24, !- June average temperature {C} - 24, !- July average temperature {C} - 24, !- August average temperature {C} - 24, !- September average temperature {C} - 24, !- October average temperature {C} - 21, !- November average temperature {C} - 21, !- December average temperature {C} - 21; !- Daily variation sine wave amplitude {deltaC} - -!- =========== ALL OBJECTS IN CLASS: GROUNDHEATTRANSFER:BASEMENT:EQUIVSLAB =========== - - GroundHeatTransfer:Basement:EquivSlab, - 2.59994805991784, !- APRatio: The area to perimeter ratio for this slab {m} - True; !- EquivSizing: Flag - -!- =========== ALL OBJECTS IN CLASS: GROUNDHEATTRANSFER:BASEMENT:EQUIVAUTOGRID =========== - - GroundHeatTransfer:Basement:EquivAutoGrid, - 15, !- CLEARANCE: Distance from outside of wall to edge of 3-D ground domain {m} - 0.1, !- SlabDepth: Thickness of the floor slab {m} - 1.21914054350572; !- BaseDepth: Depth of the basement wall below grade {m} - !- =========== ALL OBJECTS IN CLASS: PEOPLE =========== People, diff --git a/testfiles/US+SF+CZ4A+hp+crawlspace+IECC_2006_VRF.idf b/testfiles/US+SF+CZ4A+hp+crawlspace+IECC_2006_VRF.idf index 5dc92cae8bf..0cfc1a863de 100644 --- a/testfiles/US+SF+CZ4A+hp+crawlspace+IECC_2006_VRF.idf +++ b/testfiles/US+SF+CZ4A+hp+crawlspace+IECC_2006_VRF.idf @@ -4607,104 +4607,6 @@ 15, !- CLEARANCE: Distance from edge of slab to domain edge {m} 15; !- ZCLEARANCE: Distance from bottom of slab to domain bottom {m} -!- =========== ALL OBJECTS IN CLASS: GROUNDHEATTRANSFER:BASEMENT:SIMPARAMETERS =========== - - GroundHeatTransfer:Basement:SimParameters, - 0.1, !- F: Multiplier for the ADI solution - 15; !- IYRS: Maximum number of yearly iterations: - -!- =========== ALL OBJECTS IN CLASS: GROUNDHEATTRANSFER:BASEMENT:MATLPROPS =========== - - GroundHeatTransfer:Basement:MatlProps, - 6, !- NMAT: Number of materials in this domain - 2243, !- Density for Foundation Wall {kg/m3} - 2243, !- density for Floor Slab {kg/m3} - 311, !- density for Ceiling {kg/m3} - 1500, !- density for Soil {kg/m3} - 2000, !- density for Gravel {kg/m3} - 449, !- density for Wood {kg/m3} - 880, !- Specific heat for foundation wall {J/kg-K} - 880, !- Specific heat for floor slab {J/kg-K} - 1530, !- Specific heat for ceiling {J/kg-K} - 840, !- Specific heat for soil {J/kg-K} - 720, !- Specific heat for gravel {J/kg-K} - 1530, !- Specific heat for wood {J/kg-K} - 1.4, !- Thermal conductivity for foundation wall {W/m-K} - 1.4, !- Thermal conductivity for floor slab {W/m-K} - 0.09, !- Thermal conductivity for ceiling {W/m-K} - 1.1, !- thermal conductivity for soil {W/m-K} - 1.9, !- thermal conductivity for gravel {W/m-K} - 0.12; !- thermal conductivity for wood {W/m-K} - -!- =========== ALL OBJECTS IN CLASS: GROUNDHEATTRANSFER:BASEMENT:INSULATION =========== -!- $r_bsmtwall_SI = $r_bsmtwall/5.6786; -!- 0.0001; - - GroundHeatTransfer:Basement:Insulation, - 1.76099742894375e-05, !- REXT: R Value of any exterior insulation {m2-K/W} - True; !- INSFULL: Flag: Is the wall fully insulated? - -!- =========== ALL OBJECTS IN CLASS: GROUNDHEATTRANSFER:BASEMENT:SURFACEPROPS =========== - - GroundHeatTransfer:Basement:SurfaceProps, - 0.16, !- ALBEDO: Surface albedo for No snow conditions - 0.4, !- ALBEDO: Surface albedo for snow conditions - 0.94, !- EPSLN: Surface emissivity No Snow - 0.86, !- EPSLN: Surface emissivity with Snow - 6, !- VEGHT: Surface roughness No snow conditions {cm} - 0.25, !- VEGHT: Surface roughness Snow conditions {cm} - False; !- PET: Flag, Potential evapotranspiration on? - -!- =========== ALL OBJECTS IN CLASS: GROUNDHEATTRANSFER:BASEMENT:BLDGDATA =========== - - GroundHeatTransfer:Basement:BldgData, - 0.200000006162114, !- DWALL: Wall thickness {m} - 0.243828108701145, !- DSLAB: Floor slab thickness {m} - 0.3, !- DGRAVXY: Width of gravel pit beside basement wall {m} - 0.2, !- DGRAVZN: Gravel depth extending above the floor slab {m} - 0.1; !- DGRAVZP: Gravel depth below the floor slab {m} - -!- =========== ALL OBJECTS IN CLASS: GROUNDHEATTRANSFER:BASEMENT:INTERIOR =========== - - GroundHeatTransfer:Basement:Interior, - True, !- COND: Flag: Is the basement conditioned? - 0.92, !- HIN: Downward convection only heat transfer coefficient {W/m2-K} - 4.04, !- HIN: Upward convection only heat transfer coefficient {W/m2-K} - 3.08, !- HIN: Horizontal convection only heat transfer coefficient {W/m2-K} - 6.13, !- HIN: Downward combined (convection and radiation) heat transfer coefficient {W/m2-K} - 9.26, !- HIN: Upward combined (convection and radiation) heat transfer coefficient {W/m2-K} - 8.29; !- HIN: Horizontal combined (convection and radiation) heat transfer coefficient {W/m2-K} - -!- =========== ALL OBJECTS IN CLASS: GROUNDHEATTRANSFER:BASEMENT:COMBLDG =========== - - GroundHeatTransfer:Basement:ComBldg, - 21, !- January average temperature {C} - 21, !- February average temperature {C} - 21, !- March average temperature {C} - 21, !- April average temperature {C} - 24, !- May average temperature {C} - 24, !- June average temperature {C} - 24, !- July average temperature {C} - 24, !- August average temperature {C} - 24, !- September average temperature {C} - 24, !- October average temperature {C} - 21, !- November average temperature {C} - 21, !- December average temperature {C} - 21; !- Daily variation sine wave amplitude {deltaC} - -!- =========== ALL OBJECTS IN CLASS: GROUNDHEATTRANSFER:BASEMENT:EQUIVSLAB =========== - - GroundHeatTransfer:Basement:EquivSlab, - 2.59994805991784, !- APRatio: The area to perimeter ratio for this slab {m} - True; !- EquivSizing: Flag - -!- =========== ALL OBJECTS IN CLASS: GROUNDHEATTRANSFER:BASEMENT:EQUIVAUTOGRID =========== - - GroundHeatTransfer:Basement:EquivAutoGrid, - 15, !- CLEARANCE: Distance from outside of wall to edge of 3-D ground domain {m} - 0.1, !- SlabDepth: Thickness of the floor slab {m} - 1.21914054350572; !- BaseDepth: Depth of the basement wall below grade {m} - !- Process internal gains from the appliances.template.. ElectricEquipment, diff --git a/testfiles/_ResidentialBase.idf b/testfiles/_ResidentialBase.idf index 7f49d635fe0..d97a9470d22 100644 --- a/testfiles/_ResidentialBase.idf +++ b/testfiles/_ResidentialBase.idf @@ -112,6 +112,64 @@ Yes, !- Use Weather File Rain Indicators Yes; !- Use Weather File Snow Indicators +!- =========== ALL OBJECTS IN CLASS: SIZINGPERIOD:DESIGNDAY =========== + + SizingPeriod:DesignDay, + Denver Centennial Golden N Ann Htg 99% Condns DB, !- Name + 12, !- Month + 21, !- Day of Month + WinterDesignDay, !- Day Type + -15.5, !- Maximum Dry-Bulb Temperature {C} + 0.0, !- Daily Dry-Bulb Temperature Range {deltaC} + , !- Dry-Bulb Temperature Range Modifier Type + , !- Dry-Bulb Temperature Range Modifier Day Schedule Name + Wetbulb, !- Humidity Condition Type + -15.5, !- Wetbulb or DewPoint at Maximum Dry-Bulb {C} + , !- Humidity Condition Day Schedule Name + , !- Humidity Ratio at Maximum Dry-Bulb {kgWater/kgDryAir} + , !- Enthalpy at Maximum Dry-Bulb {J/kg} + , !- Daily Wet-Bulb Temperature Range {deltaC} + 81198., !- Barometric Pressure {Pa} + 3, !- Wind Speed {m/s} + 340, !- Wind Direction {deg} + No, !- Rain Indicator + No, !- Snow Indicator + No, !- Daylight Saving Time Indicator + ASHRAEClearSky, !- Solar Model Indicator + , !- Beam Solar Day Schedule Name + , !- Diffuse Solar Day Schedule Name + , !- ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub) {dimensionless} + , !- ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud) {dimensionless} + 0.00; !- Sky Clearness + + SizingPeriod:DesignDay, + Denver Centennial Golden N Ann Clg 1% Condns DB=>MWB, !- Name + 7, !- Month + 21, !- Day of Month + SummerDesignDay, !- Day Type + 32, !- Maximum Dry-Bulb Temperature {C} + 15.2, !- Daily Dry-Bulb Temperature Range {deltaC} + , !- Dry-Bulb Temperature Range Modifier Type + , !- Dry-Bulb Temperature Range Modifier Day Schedule Name + Wetbulb, !- Humidity Condition Type + 15.5, !- Wetbulb or DewPoint at Maximum Dry-Bulb {C} + , !- Humidity Condition Day Schedule Name + , !- Humidity Ratio at Maximum Dry-Bulb {kgWater/kgDryAir} + , !- Enthalpy at Maximum Dry-Bulb {J/kg} + , !- Daily Wet-Bulb Temperature Range {deltaC} + 81198., !- Barometric Pressure {Pa} + 4.9, !- Wind Speed {m/s} + 0, !- Wind Direction {deg} + No, !- Rain Indicator + No, !- Snow Indicator + No, !- Daylight Saving Time Indicator + ASHRAEClearSky, !- Solar Model Indicator + , !- Beam Solar Day Schedule Name + , !- Diffuse Solar Day Schedule Name + , !- ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub) {dimensionless} + , !- ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud) {dimensionless} + 1.00; !- Sky Clearness + !- =========== ALL OBJECTS IN CLASS: RUNPERIODCONTROL:DAYLIGHTSAVINGTIME =========== RunPeriodControl:DaylightSavingTime, diff --git a/testfiles/emall.list b/testfiles/emall.list deleted file mode 100644 index 4c3845f21ab..00000000000 --- a/testfiles/emall.list +++ /dev/null @@ -1,505 +0,0 @@ -_1a-Long0.0 -_1Zone_Heavy_AdiabaticX2 USA_CO_Golden-NREL.724666_TMY3 -_1Zone_Heavy_MassX2 USA_CO_Golden-NREL.724666_TMY3 -_1Zone_Heavy_SelfRef USA_CO_Golden-NREL.724666_TMY3 -_1ZoneUncontrolled_customrange 94810-1956-1957 -_1ZoneUncontrolled_Feb29 94810-1956 -_1ZoneUncontrolled_SineOSC USA_CO_Golden-NREL.724666_TMY3 -_5ZoneEvapCooled USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -_AllOffOpScheme USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -_BranchPumpsWithCommonPipe USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -_ConvCoefftest USA_FL_Tampa.Intl.AP.722110_TMY3 -_CoolingTowerDewPointRangeOp USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -_CoolingTowerWithDPDeltaTempOp USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -_CrashLights_9680 USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -_CTFTestsPart1 -_CTFTestsPart2 -_DOASDXCOIL_wUserSHRMethod USA_FL_Miami.Intl.AP.722020_TMY3 -_DualDuctConstVolDamperMultizoneAverageSetPointManager USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -_ElectricREformulatedEIRChiller USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -_ExternalInterface-variable USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -_ExternalInterface-schedule USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -_ExternalInterface-actuator USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -_ExternalInterface-functionalmockupunit-to-schedule USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -_ExternalInterface-functionalmockupunit-to-variable USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -_ExternalInterface-functionalmockupunit-to-actuator USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -_FanCoilHybridVentAFN USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -_FollowSysNodeTemp USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -_FuelCellTest200 USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -_HybridVentilationControlGlobalAN USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -_MaterialTest -_MicroCHPTest301 USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -_MultiSpeedACElecFurnace USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -_PurchAirWindowBlind2 USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -_PurchAirWindowBlind3 USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -_PurchAirWindowBlind4 USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -_SingleZoneTestCTFTwoDD -_SingleZoneTestCondFDTwoDD -_SmallOffice_Dulles USA_VA_Sterling-Washington.Dulles.Intl.AP.724030_TMY3 -_VAVSingleDuctConstFlowBoiler_otherfuel USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -LgOffVAVusingBasement USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneAirCooledWithSlab USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -1ZoneEvapCooler USA_CO_Golden-NREL.724666_TMY3 -1ZoneUncontrolled USA_CO_Golden-NREL.724666_TMY3 -1ZoneUncontrolled_DDChanges USA_CO_Golden-NREL.724666_TMY3 -1ZoneUncontrolled_DD2009 -1ZoneUncontrolled_FCfactor_Slab_UGWall USA_CO_Golden-NREL.724666_TMY3 -1ZoneUncontrolled_win_1 -1ZoneUncontrolled_win_2 -1ZoneUncontrolledCondFDWithVariableKat24C USA_CO_Golden-NREL.724666_TMY3 -1ZoneUncontrolledFourAlgorithms USA_CO_Golden-NREL.724666_TMY3 -1ZoneUncontrolledResLayers USA_CO_Golden-NREL.724666_TMY3 -1ZoneWith14ControlledHeat-CoolPanels USA_CO_Golden-NREL.724666_TMY3 -1ZoneDataCenterCRAC_wPumpedDXCoolingCoil USA_CO_Golden-NREL.724666_TMY3 -2ZoneDataCenterHVAC_wEconomizer USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -4ZoneWithShading_Simple_1 -4ZoneWithShading_Simple_2 -5Zone_Transformer USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneAirCooled_VRPSizing_MaxZd USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneAirCooled USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneAirCooled_UniformLoading USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneAirCooled_VRPSizing USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneAirCooledConvCoef USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneAirCooledConvCoefPIU USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneAirCooledDemandLimiting USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneAutoDXVAV USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneBoilerOutsideAirReset USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneBranchSupplyPumps USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneCAVtoVAVWarmestTempFlow USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneCAV_MaxTemp USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneCoolBeam USA_CA_San.Francisco.Intl.AP.724940_TMY3 -5ZoneCostEst USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneDDCycOnAny USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneDDCycOnOne USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneDesignInputCoolingCoil USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneDetailedIceStorage USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneDetailedIceStorage2 USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneEconomicsTariffAndLifeCycleCosts USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneElectricBaseboard USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneEndUses USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneEngChill USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneFPIU USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneGeometryTransform USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneIceStorage USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneNightVent1 USA_CA_Fresno.Air.Terminal.723890_TMY3 -5ZoneNightVent2 USA_CA_Fresno.Air.Terminal.723890_TMY3 -5ZoneNightVent3 USA_CA_Fresno.Air.Terminal.723890_TMY3 -5ZoneReturnFan USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneSteamBaseboard USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneSupRetPlenRAB USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneSupRetPlenVSATU USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneTDV CZ06RV2 -5ZoneVAV-ChilledWaterStorage-Mixed USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneVAV-ChilledWaterStorage-Mixed_DCV_MaxZd USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneVAV-ChilledWaterStorage-Mixed_DCV_MultiPath USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneVAV-ChilledWaterStorage-Stratified USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneVAV-Pri-SecLoop USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneWarmest USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneWarmestVFD USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneWarmestVFD_FCMAuto USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneWaterCooled_Baseboard USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneWaterCooled_HighRHControl USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneWaterCooled_MultizoneAverageRHControl USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneWaterCooled_MultizoneMinMaxRHControl USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneWaterLoopHeatPump USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5zoneWaterSystems USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -5ZoneWLHPPlantLoopTower USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -AbsorptionChiller USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -AbsorptionChiller_Macro USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -ActiveTrombeWall -AirCooledElectricChiller -AirEconomizerFaults_RefBldgLargeOfficeNew2004_Chicago USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -AirEconomizerWithMaxMinOAFractions USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -AirflowNetwork3zVent USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -AirflowNetwork3zVentAutoWPC USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -AirflowNetwork_Multizone_HorizontalOpening USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -AirflowNetwork_MultiZone_House USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -AirflowNetwork_MultiZone_House_OvercoolDehumid USA_FL_Miami.Intl.AP.722020_TMY3 -AirflowNetwork_MultiZone_House_TwoSpeed USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -AirflowNetwork_MultiZone_SmallOffice USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -AirflowNetwork_MultiZone_SmallOffice_CoilHXAssistedDX USA_FL_Miami.Intl.AP.722020_TMY3 -AirflowNetwork_MultiZone_SmallOffice_GenericContam USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -AirflowNetwork_MultiZone_SmallOffice_HeatRecoveryHXSL USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -AirflowNetwork_MultiZone_SmallOffice_VAV USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -AirflowNetwork_Simple_House USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -AirflowNetwork_Simple_SmallOffice USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -AirflowWindowsAndBetweenGlassBlinds -AirflowWindowsAndBetweenGlassShades -BaseBoardElectric -CentralChillerHeaterSystem_Cooling_Heating USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -CentralChillerHeaterSystem_Simultaneous_Cooling_Heating USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -ChangeoverBypassVAV USA_FL_Miami.Intl.AP.722020_TMY3 -ChangeoverBypassVAV_MaxTemp USA_FL_Miami.Intl.AP.722020_TMY3 -CmplxGlz_Daylighting_SouthVB45deg -CmplxGlz_MeasuredDeflectionAndShading USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -CmplxGlz_SchedSurfGains USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -CmplxGlz_SingleZone_Deflection USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -CmplxGlz_SingleZone_DoubleClearAir USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -CmplxGlz_SingleZone_Vacuum USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -CmplxGlz_SmOff_IntExtShading USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -CoilWaterDesuperheating USA_FL_Miami.Intl.AP.722020_TMY3 -CommonPipe_Pri-Sec USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -CompSetPtControl -CondFD1ZonePurchAirAutoSizeWithPCM USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -Convection -ConvectionAdaptiveSmallOffice USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -CoolingTower -CoolingTower_FluidBypass USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -CoolingTower_SingleSpeed_MultiCell USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -CoolingTower_TwoSpeed USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -CoolingTower_TwoSpeed_CondEntTempReset USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -CoolingTower_TwoSpeed_MultiCell USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -CoolingTower_VariableSpeed USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -CoolingTower_VariableSpeed_CondEntTempReset USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -CoolingTower_VariableSpeed_IdealCondEntTempSetpoint USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -CoolingTower_VariableSpeed_MultiCell USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -CoolingTowerDryBulbRangeOp USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -CoolingTowerNomCap -CoolingTowerRHRangeOp USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -CoolingTowerWetBulbRangeOp USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -CoolingTowerWithDBDeltaTempOp USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -CoolingTowerWithWBDeltaTempOp -CoolTowerSimpleTest -CoolTowerSimpleTestwithVentilation -CrossVent_1Zone_AirflowNetwork USA_CA_San.Francisco.Intl.AP.724940_TMY3 -CrossVent_1Zone_AirflowNetwork_with2CrossflowJets USA_CA_San.Francisco.Intl.AP.724940_TMY3 -CustomSolarVisibleSpectrum_refBldgSmallOfficeNew2004_Chicago USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -CVRhMinHum -DaylightingDeviceShelf -DaylightingDeviceTubular -DDAutoSize USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -DElight-Detailed-Comparison USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -DElightCFSLightShelf USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -DElightCFSWindow USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -DesiccantCVRh -DesiccantCVRhZoneRHCtrl -DesiccantDehumidifierWithCompanionCoil USA_FL_Miami.Intl.AP.722020_TMY3 -DirectIndirectEvapCoolers USA_AZ_Phoenix-Sky.Harbor.Intl.AP.722780_TMY3 -DirectIndirectEvapCoolersVSAS USA_AZ_Phoenix-Sky.Harbor.Intl.AP.722780_TMY3 -DisplacementVent_1ZoneOffice USA_CA_San.Francisco.Intl.AP.724940_TMY3 -DisplacementVent_Nat_AirflowNetwork USA_CA_San.Francisco.Intl.AP.724940_TMY3 -DisplacementVent_Nat_AirflowNetwork_AdaptiveComfort USA_CA_San.Francisco.Intl.AP.724940_TMY3 -DisplacementVent_VAV USA_CA_San.Francisco.Intl.AP.724940_TMY3 -DOASDualDuctSchool USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -DOASDXCOIL_wADPBFMethod USA_FL_Miami.Intl.AP.722020_TMY3 -DOAToFanCoilInlet USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -DOAToFanCoilSupply USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -DualDuctConstVolDamper -DualDuctConstVolGasHC -DualDuctVarVolDamper -DualDuctWaterCoils -DXCoilSystemAuto USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -DynamicClothing USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -EarthTubeSimpleTest -EcoroofOrlando USA_FL_Orlando.Intl.AP.722050_TMY3 -ElectricChiller USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -ElectricEIRChiller -EMPD5ZoneWaterCooled_HighRHControl USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -EMSAirflowNetworkOpeningControlByHumidity -EMSConstantVolumePurchasedAir -EMSCurveOverride_PackagedTerminalHeatPump USA_FL_Miami.Intl.AP.722020_TMY3 -EMSCustomOutputVariable -EMSCustomSchedule -EMSDemandManager_LargeOffice -EMSDiscreteAirSystemSizes -EMSPlantLoopOverrideControl USA_FL_Orlando.Intl.AP.722050_TMY3 -EMSPlantOperation_LargeOff USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -EMSReplaceTraditionalManagers_LargeOffice -EMSTestMathAndKill USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -EMSThermochromicWindow USA_NV_Las.Vegas-McCarran.Intl.AP.723860_TMY3 -EMSUserDefined5ZoneAirCooled USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -EMSUserDefinedWindACAuto USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -EMSWindowShadeControl -EngineChiller -EquivalentLayerWindow -EvaporativeFluidCooler USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -EvaporativeFluidCooler_TwoSpeed USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -ExhFiredAbsorptionChiller USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -ExteriorLightsAndEq USA_CO_Golden-NREL.724666_TMY3 -FanCoil_HybridVent_VentSch USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -FanCoilAutoSize USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -Flr_Rf_8Sides USA_CO_Golden-NREL.724666_TMY3 -FluidCooler USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -FluidCoolerTwoSpeed USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -FreeCoolingChiller USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -Furnace -FurnacePLRHeatingCoil -FurnaceWithDXSystem -FurnaceWithDXSystem_CoolingHXAssisted USA_FL_Miami.Intl.AP.722020_TMY3 -FurnaceWithDXSystemComfortControl USA_FL_Miami.Intl.AP.722020_TMY3 -FurnaceWithDXSystemRHcontrol USA_FL_Miami.Intl.AP.722020_TMY3 -FurnaceWithDXSystemRHcontrol_cyclingfan USA_FL_Miami.Intl.AP.722020_TMY3 -gasAbsorptionChillerHeater -GasTurbChiller -Generators -Generators_Transformer USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -GeneratorswithPV USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -GeneratorwithWindTurbine USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -GeometryTest USA_CO_Colorado.Springs-Peterson.Field.724660_TMY3 -GroundTempOSCCompactSched USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -GSHP-GLHE USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -GSHPSimple-GLHE USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HAMT_DailyProfileReport USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HAMT_HourlyProfileReport USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HeaderedPumpsConSpeed USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HeaderedPumpsVarSpeed USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HeatPump -HeatPumpAirToAirWithRHcontrol USA_FL_Miami.Intl.AP.722020_TMY3 -HeatPumpAuto USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HeatPumpCycFanWithEcono -HeatPumpIAQP_DCV USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HeatPumpIAQP_GenericContamControl USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HeatPumpProportionalControl_DCV USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HeatPumpSimpleDCV -HeatPumpVSAS -HeatPumpVRP_DCV USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HeatPumpWaterHeater USA_FL_Miami.Intl.AP.722020_TMY3 -HeatPumpWaterToAir USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HeatPumpWaterToAirEquationFit USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HeatPumpWaterToAirWithAntifreezeAndLatentModel -HeatPumpWaterToAirWithAntifreezeAndLatentModel2 -HeatPumpWaterToAirWithRHControl USA_FL_Miami.Intl.AP.722020_TMY3 -HeatPumpwithBiquadraticCurves USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HeatRecoveryElectricChiller USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HeatRecoveryPlantLoop USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HeatRecoverywithStorageTank -HP_wICSSolarCollector USA_FL_Miami.Intl.AP.722020_TMY3 -HPAirToAir_wSolarCollectorHWCoil USA_FL_Miami.Intl.AP.722020_TMY3 -HVACStandAloneERV_Economizer USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HVACTemplate-5ZoneBaseboardHeat USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HVACTemplate-5ZoneConstantVolumeChillerBoiler USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HVACTemplate-5ZoneDualDuct USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HVACTemplate-5ZoneFanCoil USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HVACTemplate-5ZoneFanCoil-DOAS USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HVACTemplate-5ZoneFurnaceDX USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HVACTemplate-5ZonePackagedVAV USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HVACTemplate-5ZonePTAC USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HVACTemplate-5ZonePTAC-DOAS USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HVACTemplate-5ZonePTHP USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HVACTemplate-5ZonePurchAir USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HVACTemplate-5ZoneUnitaryHeatPump USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HVACTemplate-5ZoneUnitarySystem USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HVACTemplate-5ZoneVAVFanPowered USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HVACTemplate-5ZoneVAVWaterCooled USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HVACTemplate-5ZoneVAVWaterCooled-ObjectReference USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HVACTemplate-5ZoneVRF USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HVACTemplate-5ZoneWaterToAirHeatPumpTowerBoiler USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HybridVentilationControl USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HybridVentilationControlGlobalSimple USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -IceStorage-Parallel USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -IceStorage-Series-ChillerDownstream USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -IceStorage-Series-ChillerUpstream USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -IndEvapCoolerRTUoffice USA_AZ_Phoenix-Sky.Harbor.Intl.AP.722780_TMY3 -IndirectAbsorptionChiller USA_FL_Miami.Intl.AP.722020_TMY3 -LBuilding-G000 USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -LBuilding-G090 USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -LBuilding-G180 USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -LBuilding-G270 USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -LgOffVAV USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -LookupTables USA_FL_Miami.Intl.AP.722020_TMY3 -MicroCoGeneration USA_NJ_Newark.Intl.AP.725020_TMY3 -Minimal -MovableExtInsulationSimple -MovableIntInsulationSimple -MultiSpeedACFurnace USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -MultiSpeedHeatPump USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -MulitSpeedHP_StagedThemostat USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -MultiStory USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -Mundt_System_Always_On USA_FL_Tampa.Intl.AP.722110_TMY3 -Mundt_System_On_During_the_Day USA_FL_Tampa.Intl.AP.722110_TMY3 -OptimalStart_RefBldgLargeOfficeNew2004_Chicago USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -OutdoorAirUnit USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -OutdoorAirUnitwithAirloopHVAC USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -PackagedTerminalAirConditioner USA_FL_Miami.Intl.AP.722020_TMY3 -PackagedTerminalAirConditionerVSAS USA_FL_Miami.Intl.AP.722020_TMY3 -PackagedTerminalHeatPump USA_FL_Miami.Intl.AP.722020_TMY3 -PackagedTerminalHeatPumpVSAS USA_FL_Miami.Intl.AP.722020_TMY3 -PassiveTrombeWall -PipeHeatTransfer_OutAir USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -PipeHeatTransfer_Schedule USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -PipeHeatTransfer_Underground USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -PipeHeatTransfer_Zone USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -PipingSystem_Underground_FHX USA_CO_Golden-NREL.724666_TMY3 -PipingSystem_Underground_TwoPipe USA_CO_Golden-NREL.724666_TMY3 -PIUAuto USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -PlantApplicationsGuide_Example1 USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -PlantApplicationsGuide_Example2 USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -PlantApplicationsGuide_Example3 USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -PlantComponentTemperatureSource USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -PlantHorizontalGroundHX USA_CO_Golden-NREL.724666_TMY3 -PlantLoadProfile -PlantLoopChainCooling USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -PlantLoopChainDeadband USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -PlantLoopChainDualDeadband USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -PlantLoopChainHeating USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -PlantPressure_PumpCurve USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -PlantPressure_VFD_Scheduled USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -PlantPressureDrop -PlateHeatExchanger USA_FL_Tampa.Intl.AP.722110_TMY3 -Plenum -PlenumwithRetAirHeatGain -PondGroundHeatExchanger USA_AZ_Phoenix-Sky.Harbor.Intl.AP.722780_TMY3 -PurchAirTables USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -PurchAirTables_SQL USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -PurchAirWindowBlind USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -PurchAirWindowBlind_BlockBeamSolar USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -PurchAirWithDaylighting -PurchAirWithDaylightingAngleFac -PurchAirWithDoubleFacadeDaylighting -QTFtest -RadHiTempElecTermReheat -RadHiTempGasCtrlOpt -RadHiTempGasTermReheat -RadLoHydrHeatCoolAuto USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -RadLoHydrHeatCoolAutoCondFD USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -RadLoTempCFloHeatCool -RadLoTempCFloHeatCoolCondFD -RadLoTempCFloTermReheat -RadLoTempElecTermReheat -RadLoTempElecTermReheatCondFD -RadLoTempHydrCoolTower -RadLoTempHydrCoolTowerCondFD -RadLoTempHydrCtrlOpt -RadLoTempHydrCtrlOpt2 -RadLoTempHydrHeatCool -RadLoTempHydrHeatCool2D -RadLoTempHydrHeatCoolDry -RadLoTempHydrHeatCoolDryCondFD -RadLoTempHydrInterMulti -RadLoTempHydrMulti10 -RadLoTempHydrTermReheat -RefBldgFullServiceRestaurantNew2004_Chicago USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -RefBldgHospitalNew2004_Chicago USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -RefBldgLargeHotelNew2004_Chicago USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -RefBldgLargeOfficeNew2004_Chicago USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -RefBldgMediumOfficeNew2004_Chicago USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -RefBldgMidriseApartmentNew2004_Chicago USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -RefBldgOutPatientNew2004_Chicago USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -RefBldgPrimarySchoolNew2004_Chicago USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -RefBldgQuickServiceRestaurantNew2004_Chicago USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -RefBldgSecondarySchoolNew2004_Chicago USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -RefBldgSmallHotelNew2004_Chicago USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -RefBldgSmallOfficeNew2004_Chicago USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -RefBldgStand-aloneRetailNew2004_Chicago USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -RefBldgStripMallNew2004_Chicago USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -RefBldgSuperMarketNew2004_Chicago USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -RefBldgWarehouseNew2004_Chicago USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -ReflectiveAdjacentBuilding -RefrigeratedWarehouse USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -ReliefIndEvapCoolerRTUoffice USA_AZ_Phoenix-Sky.Harbor.Intl.AP.722780_TMY3 -ReportDaylightFactors USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -RetailPackagedTESCoil USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -SeriesActiveBranch USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -ShopWithPVandBattery USA_OK_Oklahoma.City-Will.Rogers.World.AP.723530_TMY3 -ShopWithPVandStorage USA_OK_Oklahoma.City-Will.Rogers.World.AP.723530_TMY3 -ShopWithSimplePVT USA_OK_Oklahoma.City-Will.Rogers.World.AP.723530_TMY3 -SingleFamilyHouse_TwoSpeed_ZoneAirBalance USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -SmOffPSZ USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -SmOffPSZ-MultiModeDX USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -SmOffPSZ_OnOffStagedControl USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -SolarCollectorFlatPlateWater USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -SolarShadingTest USA_AZ_Phoenix-Sky.Harbor.Intl.AP.722780_TMY3 -SolarShadingTest_SQL USA_AZ_Phoenix-Sky.Harbor.Intl.AP.722780_TMY3 -StackedZonesWithInterzoneIRTLayers USA_IL_University.of.Illinois-Willard.AP.725315_TMY3 -SteamSystemAutoSize USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -StormWindow -StripMallZoneEvapCooler USA_CO_Boulder-Broomfield-Jefferson.County.AP.724699_TMY3 -Supermarket USA_FL_Miami.Intl.AP.722020_TMY3 -Supermarket_CascadeCond USA_FL_Miami.Intl.AP.722020_TMY3 -SuperMarket_DesuperHeatingCoil USA_FL_Miami.Intl.AP.722020_TMY3 -Supermarket_Detailed USA_FL_Miami.Intl.AP.722020_TMY3 -Supermarket_DetailedEvapCondenser USA_AZ_Phoenix-Sky.Harbor.Intl.AP.722780_TMY3 -Supermarket_DetailedWaterCondenser USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -SuperMarket_EvapCondenser USA_AZ_Phoenix-Sky.Harbor.Intl.AP.722780_TMY3 -Supermarket_SharedAirCondenser USA_FL_Miami.Intl.AP.722020_TMY3 -SuperMarket_SharedEvapCondenser USA_AZ_Phoenix-Sky.Harbor.Intl.AP.722780_TMY3 -SuperMarket_WaterCondenser USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -SuperMarketDetailed_DesuperHeatingCoil USA_FL_Miami.Intl.AP.722020_TMY3 -SupermarketSecondary USA_FL_Miami.Intl.AP.722020_TMY3 -SupermarketSubCoolersVariableSuction USA_FL_Miami.Intl.AP.722020_TMY3 -SupermarketTranscriticalCO2 USA_FL_Miami.Intl.AP.722020_TMY3 -SupermarketTwoStageFlashIntercooler USA_FL_Miami.Intl.AP.722020_TMY3 -SupermarketTwoStageShellCoilIntercooler USA_FL_Miami.Intl.AP.722020_TMY3 -SupplyPlenumVAV -SurfaceGroundHeatExchanger USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -SurfaceTest -TermReheat -TermReheatPri-SecLoop USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -TermReheatScheduledPump -TermReheatSurfTC -TermReheatZoneExh -TermRhDualSetpointWithDB -TermRHDXSystem -TermRHGasElecCoils -TermRhGenericOAHeatRecMinExh USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -TermRhGenericOAHeatRecPreheat -TermRhSingleHeatCoolNoDB -ThermalChimneyTest -ThermochromicWindow USA_NV_Las.Vegas-McCarran.Intl.AP.723860_TMY3 -TransparentInsulationSimple -TranspiredCollectors USA_CO_Boulder-Broomfield-Jefferson.County.AP.724699_TMY3 -TRHConstFlowChillerOneBranch -TRHEvapCoolerOAStaged USA_AZ_Phoenix-Sky.Harbor.Intl.AP.722780_TMY3 -TRHEvapCoolerOAStagedWetCoil USA_AZ_Phoenix-Sky.Harbor.Intl.AP.722780_TMY3 -TwoWayCommonPipe_Pri-Sec USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -UnitarySystem_5ZoneWaterLoopHeatPump USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -UnitarySystem_DXCoilSystemAuto USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -UnitarySystem_FuranceWithDXSystemRHcontrol USA_FL_Miami.Intl.AP.722020_TMY3 -UnitarySystem_HeatPumpAuto USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -UnitarySystem_VSHeatPumpWaterToAirEquationFit USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -UnitHeater -UnitHeaterAuto USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -UnitHeaterGasElec -UnitVent5Zone USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -UnitVent5ZoneAuto USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -UnitVent5ZoneFixedOANoCoilOpt USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -UserDefinedRoomAirPatterns USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -UserInputViewFactorFile-LshapedZone -VariableRefrigerantFlow_5Zone USA_FL_Miami.Intl.AP.722020_TMY3 -VAVSingleDuctConstFlowBoiler -VAVSingleDuctReheat_DualMax USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -VAVSingleDuctReheat_MaxSAT_ReverseActing USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -VAVSingleDuctReheat -VAVSingleDuctReheatBaseboard -VAVSingleDuctReheatNoReheat -VAVSingleDuctVarFlowBoiler -VentilatedSlab USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -VentilatedSlab_SeriesSlabs USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -VentilationSimpleTest -VSDXCoilSystemAuto USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -VSHeatPumpWaterToAirEquationFit USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -VSHeatPumpWaterToAirWithRHControl USA_FL_Miami.Intl.AP.722020_TMY3 -WaterHeaterDHWPlantLoop USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -WaterHeaterStandAlone -WaterHeaterHeatPumpStratifiedTank USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -WaterSideEconomizer_Integrated USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -WaterSideEconomizer_NonIntegrated USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -WeatherTimeBins USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -WindACAuto USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -WindACRHControl USA_FL_Miami.Intl.AP.722020_TMY3 -WindowTests USA_CO_Golden-NREL.724666_TMY3 -WindowTestsSimple USA_CO_Golden-NREL.724666_TMY3 -ZoneSysAvailManager USA_CO_Golden-NREL.724666_TMY3 -ZoneVSWSHP_wDOAS USA_CO_Golden-NREL.724666_TMY3 -ZoneWSHP_wDOAS USA_CO_Golden-NREL.724666_TMY3 -!1ZoneParameterAspect USA_CO_Golden-NREL.724666_TMY3 -1ZoneParameterAspect-000001 USA_CO_Golden-NREL.724666_TMY3 -1ZoneParameterAspect-000002 USA_CO_Golden-NREL.724666_TMY3 -1ZoneParameterAspect-000003 USA_CO_Golden-NREL.724666_TMY3 -1ZoneParameterAspect-000004 USA_CO_Golden-NREL.724666_TMY3 -1ZoneParameterAspect-000005 USA_CO_Golden-NREL.724666_TMY3 -!LBuildingAppGRotPar USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -LBuildingAppGRotPar-G000 USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -LBuildingAppGRotPar-G090 USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -LBuildingAppGRotPar-G180 USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -LBuildingAppGRotPar-G270 USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -!ParametricInsulation-5ZoneAirCooled USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -ParametricInsulation-5ZoneAirCooled-000001 USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -ParametricInsulation-5ZoneAirCooled-000002 USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -ParametricInsulation-5ZoneAirCooled-000003 USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -ParametricInsulation-5ZoneAirCooled-000004 USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HospitalBaseline USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HospitalLowEnergy USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -HospitalBaselineReheatReportEMS USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -!LgOffVAVusingBasement USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 -!5ZoneAirCooledWithSlab USA_IL_Chicago-OHare.Intl.AP.725300_TMY3 diff --git a/third_party/fmt-8.0.1/include/fmt/format.h b/third_party/fmt-8.0.1/include/fmt/format.h index 82ddb407d09..2b886a1be63 100644 --- a/third_party/fmt-8.0.1/include/fmt/format.h +++ b/third_party/fmt-8.0.1/include/fmt/format.h @@ -316,8 +316,10 @@ template <> constexpr auto num_bits() -> int { FMT_INLINE void assume(bool condition) { (void)condition; -#if FMT_HAS_BUILTIN(__builtin_assume) +#if FMT_HAS_BUILTIN(__builtin_assume) && !FMT_ICC_VERSION __builtin_assume(condition); +#elif FMT_GCC_VERSION + if (!condition) __builtin_unreachable(); #endif } @@ -751,8 +753,18 @@ void basic_memory_buffer::grow(size_t size) { T* new_data = std::allocator_traits::allocate(alloc_, new_capacity); // The following code doesn't throw, so the raw pointer above doesn't leak. - std::uninitialized_copy(old_data, old_data + this->size(), - detail::make_checked(new_data, new_capacity)); + // std::uninitialized_copy(old_data, old_data + this->size(), + // detail::make_checked(new_data, new_capacity)); + // ****** MYOLDMOPAR MANUAL EDIT + // I manually applied some of the changes from this commit + // https://github.com/fmtlib/fmt/commit/fb97cb2318dd14b5c791699232e1e73782be7e57 + // Because of a GCC 13 false positive issuing a string overflow warning + // fmt issue: https://github.com/fmtlib/fmt/issues/3533 + // upstream report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109717 + // An updated FMT version could mute this with the FMT_SYSTEM_HEADERS CMake flag turned on, but it seems fmt-8.0.1 doesn't respond to that + detail::assume(this->size() <= new_capacity); + std::uninitialized_copy_n(old_data, this->size(), new_data); + // ****** this->set(new_data, new_capacity); // deallocate must not throw according to the standard, but even if it does, // the buffer already uses the new storage and will deallocate it in diff --git a/tst/EnergyPlus/api/TestAutosizing.c b/tst/EnergyPlus/api/TestAutosizing.c index 95394ae476f..069aa4af1c2 100644 --- a/tst/EnergyPlus/api/TestAutosizing.c +++ b/tst/EnergyPlus/api/TestAutosizing.c @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/api/TestAutosizing.py b/tst/EnergyPlus/api/TestAutosizing.py index 6b744af4288..6d3a5b28aa9 100644 --- a/tst/EnergyPlus/api/TestAutosizing.py +++ b/tst/EnergyPlus/api/TestAutosizing.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/tst/EnergyPlus/api/TestDataTransfer.c b/tst/EnergyPlus/api/TestDataTransfer.c index 978d1bbde5f..05cb927d5ac 100644 --- a/tst/EnergyPlus/api/TestDataTransfer.c +++ b/tst/EnergyPlus/api/TestDataTransfer.c @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/api/TestDataTransfer.py b/tst/EnergyPlus/api/TestDataTransfer.py index 422670190d7..85a4420a2b6 100644 --- a/tst/EnergyPlus/api/TestDataTransfer.py +++ b/tst/EnergyPlus/api/TestDataTransfer.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/tst/EnergyPlus/api/TestFunctional.c b/tst/EnergyPlus/api/TestFunctional.c index 4e9dbe8c814..474bd2ae67c 100644 --- a/tst/EnergyPlus/api/TestFunctional.c +++ b/tst/EnergyPlus/api/TestFunctional.c @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/api/TestFunctional.py b/tst/EnergyPlus/api/TestFunctional.py index a1124010ce2..9588eb316b5 100644 --- a/tst/EnergyPlus/api/TestFunctional.py +++ b/tst/EnergyPlus/api/TestFunctional.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/tst/EnergyPlus/api/TestRuntime.c b/tst/EnergyPlus/api/TestRuntime.c index bfe672dfdeb..03d8f599bee 100644 --- a/tst/EnergyPlus/api/TestRuntime.c +++ b/tst/EnergyPlus/api/TestRuntime.c @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/api/TestRuntime.py b/tst/EnergyPlus/api/TestRuntime.py index a3275056deb..11901e54f1b 100644 --- a/tst/EnergyPlus/api/TestRuntime.py +++ b/tst/EnergyPlus/api/TestRuntime.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/tst/EnergyPlus/api/TestRuntimeDeleteState.c b/tst/EnergyPlus/api/TestRuntimeDeleteState.c index 4dbf9b7e6ab..e2474d5bd0f 100644 --- a/tst/EnergyPlus/api/TestRuntimeDeleteState.c +++ b/tst/EnergyPlus/api/TestRuntimeDeleteState.c @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/api/TestRuntimeDeleteState.py b/tst/EnergyPlus/api/TestRuntimeDeleteState.py index d3923d2bcc0..464bce7a68e 100644 --- a/tst/EnergyPlus/api/TestRuntimeDeleteState.py +++ b/tst/EnergyPlus/api/TestRuntimeDeleteState.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/tst/EnergyPlus/api/TestRuntimeReleasesTheGIL.py b/tst/EnergyPlus/api/TestRuntimeReleasesTheGIL.py new file mode 100644 index 00000000000..daf46e64078 --- /dev/null +++ b/tst/EnergyPlus/api/TestRuntimeReleasesTheGIL.py @@ -0,0 +1,66 @@ +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University +# of Illinois, The Regents of the University of California, through Lawrence +# Berkeley National Laboratory (subject to receipt of any required approvals +# from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- +# Battelle, Alliance for Sustainable Energy, LLC, and other contributors. All +# rights reserved. +# +# NOTICE: This Software was developed under funding from the U.S. Department of +# Energy and the U.S. Government consequently retains certain rights. As such, +# the U.S. Government has been granted for itself and others acting on its +# behalf a paid-up, nonexclusive, irrevocable, worldwide license in the +# Software to reproduce, distribute copies to the public, prepare derivative +# works, and perform publicly and display publicly, and to permit others to do +# so. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# (1) Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# (2) Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# (3) Neither the name of the University of California, Lawrence Berkeley +# National Laboratory, the University of Illinois, U.S. Dept. of Energy nor +# the names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in +# stand-alone form without changes from the version obtained under this +# License, or (ii) Licensee makes a reference solely to the software +# portion of its product, Licensee must refer to the software as +# "EnergyPlus version X" software, where "X" is the version number Licensee +# obtained under this License and may not use a different name for the +# software. Except as specifically required in this Section (4), Licensee +# shall not use in a company name, a product name, in advertising, +# publicity, or other promotional activities any name, trade name, +# trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or +# confusingly similar designation, without the U.S. Department of Energy's +# prior written consent. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +import sys + +from pyenergyplus.api import EnergyPlusAPI + +api = EnergyPlusAPI() +state = api.state_manager.new_state() +exit_code = api.runtime.run_energyplus(state, sys.argv[1:]) + +if exit_code == 0: + print("Expected EnergyPlus to return an error to the broken python plugin. Task Succeeded Unsuccessfully!") + sys.exit(1) diff --git a/tst/EnergyPlus/api/TestRuntimeReleasesTheGIL/mcve_gil.idf b/tst/EnergyPlus/api/TestRuntimeReleasesTheGIL/mcve_gil.idf new file mode 100644 index 00000000000..e9fcffaefcd --- /dev/null +++ b/tst/EnergyPlus/api/TestRuntimeReleasesTheGIL/mcve_gil.idf @@ -0,0 +1,102 @@ +! The PythonPlugin referenced here has a broken import +! This is a test for #10842 + + Timestep,6; + + SimulationControl, + No, !- Do Zone Sizing Calculation + No, !- Do System Sizing Calculation + No, !- Do Plant Sizing Calculation + Yes, !- Run Simulation for Sizing Periods + No, !- Run Simulation for Weather File Run Periods + No, !- Do HVAC Sizing Simulation for Sizing Periods + 1; !- Maximum Number of HVAC Sizing Simulation Passes + + GlobalGeometryRules, + UpperLeftCorner, !- Starting Vertex Position + Counterclockwise, !- Vertex Entry Direction + Relative, !- Coordinate System + Relative; !- Daylighting Reference Point Coordinate System + + Building, + Building, !- Name + 0.0000, !- North Axis {deg} + City, !- Terrain + 0.0400, !- Loads Convergence Tolerance Value {W} + 0.2000, !- Temperature Convergence Tolerance Value {deltaC} + FullInteriorAndExterior, !- Solar Distribution + 25, !- Maximum Number of Warmup Days + 6; !- Minimum Number of Warmup Days + + Site:Location, + CHICAGO_IL_USA TMY2-94846, !- Name + 41.78000, !- Latitude {deg} + -87.75000, !- Longitude {deg} + -6.000000, !- Time Zone {hr} + 190.0000; !- Elevation {m} + +! CHICAGO_IL_USA Annual Heating 99.6%, MaxDB=-20.6°C + + SizingPeriod:DesignDay, + CHICAGO Ann Htg 99.6% Condns DB, !- Name + 1, !- Month + 21, !- Day of Month + WinterDesignDay, !- Day Type + -20.6, !- Maximum Dry-Bulb Temperature {C} + 0.0, !- Daily Dry-Bulb Temperature Range {deltaC} + , !- Dry-Bulb Temperature Range Modifier Type + , !- Dry-Bulb Temperature Range Modifier Day Schedule Name + Wetbulb, !- Humidity Condition Type + -20.6, !- Wetbulb or DewPoint at Maximum Dry-Bulb {C} + , !- Humidity Condition Day Schedule Name + , !- Humidity Ratio at Maximum Dry-Bulb {kgWater/kgDryAir} + , !- Enthalpy at Maximum Dry-Bulb {J/kg} + , !- Daily Wet-Bulb Temperature Range {deltaC} + 99063., !- Barometric Pressure {Pa} + 4.9, !- Wind Speed {m/s} + 270, !- Wind Direction {deg} + No, !- Rain Indicator + No, !- Snow Indicator + No, !- Daylight Saving Time Indicator + ASHRAEClearSky, !- Solar Model Indicator + , !- Beam Solar Day Schedule Name + , !- Diffuse Solar Day Schedule Name + , !- ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub) {dimensionless} + , !- ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud) {dimensionless} + 0.00; !- Sky Clearness + +! CHICAGO_IL_USA Annual Cooling (DB=>MWB) .4%, MaxDB=33.2°C MWB=23.8°C + + SizingPeriod:DesignDay, + CHICAGO Ann Clg .4% Condns DB=>MWB, !- Name + 7, !- Month + 21, !- Day of Month + SummerDesignDay, !- Day Type + 33.2, !- Maximum Dry-Bulb Temperature {C} + 10.7, !- Daily Dry-Bulb Temperature Range {deltaC} + , !- Dry-Bulb Temperature Range Modifier Type + , !- Dry-Bulb Temperature Range Modifier Day Schedule Name + Wetbulb, !- Humidity Condition Type + 23.8, !- Wetbulb or DewPoint at Maximum Dry-Bulb {C} + , !- Humidity Condition Day Schedule Name + , !- Humidity Ratio at Maximum Dry-Bulb {kgWater/kgDryAir} + , !- Enthalpy at Maximum Dry-Bulb {J/kg} + , !- Daily Wet-Bulb Temperature Range {deltaC} + 99063., !- Barometric Pressure {Pa} + 5.3, !- Wind Speed {m/s} + 230, !- Wind Direction {deg} + No, !- Rain Indicator + No, !- Snow Indicator + No, !- Daylight Saving Time Indicator + ASHRAEClearSky, !- Solar Model Indicator + , !- Beam Solar Day Schedule Name + , !- Diffuse Solar Day Schedule Name + , !- ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub) {dimensionless} + , !- ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud) {dimensionless} + 1.00; !- Sky Clearness + + PythonPlugin:Instance, + Heating Setpoint Override, !- Name + Yes, !- Run During Warmup Days + mcve_gil, !- Python Module Name + HeatingSetPoint; !- Plugin Class Name diff --git a/tst/EnergyPlus/api/TestRuntimeReleasesTheGIL/mcve_gil.py b/tst/EnergyPlus/api/TestRuntimeReleasesTheGIL/mcve_gil.py new file mode 100644 index 00000000000..a30ec6b9463 --- /dev/null +++ b/tst/EnergyPlus/api/TestRuntimeReleasesTheGIL/mcve_gil.py @@ -0,0 +1,56 @@ +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University +# of Illinois, The Regents of the University of California, through Lawrence +# Berkeley National Laboratory (subject to receipt of any required approvals +# from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- +# Battelle, Alliance for Sustainable Energy, LLC, and other contributors. All +# rights reserved. +# +# NOTICE: This Software was developed under funding from the U.S. Department of +# Energy and the U.S. Government consequently retains certain rights. As such, +# the U.S. Government has been granted for itself and others acting on its +# behalf a paid-up, nonexclusive, irrevocable, worldwide license in the +# Software to reproduce, distribute copies to the public, prepare derivative +# works, and perform publicly and display publicly, and to permit others to do +# so. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# (1) Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# (2) Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# (3) Neither the name of the University of California, Lawrence Berkeley +# National Laboratory, the University of Illinois, U.S. Dept. of Energy nor +# the names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in +# stand-alone form without changes from the version obtained under this +# License, or (ii) Licensee makes a reference solely to the software +# portion of its product, Licensee must refer to the software as +# "EnergyPlus version X" software, where "X" is the version number Licensee +# obtained under this License and may not use a different name for the +# software. Except as specifically required in this Section (4), Licensee +# shall not use in a company name, a product name, in advertising, +# publicity, or other promotional activities any name, trade name, +# trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or +# confusingly similar designation, without the U.S. Department of Energy's +# prior written consent. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +from this_does_not_exist.hello_world import garbage diff --git a/tst/EnergyPlus/api/TestRuntimeResetState.c b/tst/EnergyPlus/api/TestRuntimeResetState.c index 300084f6393..e290501febb 100644 --- a/tst/EnergyPlus/api/TestRuntimeResetState.c +++ b/tst/EnergyPlus/api/TestRuntimeResetState.c @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/api/TestRuntimeResetState.py b/tst/EnergyPlus/api/TestRuntimeResetState.py index dc3290c9f2f..cc1f7ffe067 100644 --- a/tst/EnergyPlus/api/TestRuntimeResetState.py +++ b/tst/EnergyPlus/api/TestRuntimeResetState.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/tst/EnergyPlus/api/test_DataTransferTypes.py b/tst/EnergyPlus/api/test_DataTransferTypes.py index 9f79e324d0d..f924dcd652a 100644 --- a/tst/EnergyPlus/api/test_DataTransferTypes.py +++ b/tst/EnergyPlus/api/test_DataTransferTypes.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/tst/EnergyPlus/api/test_OutputFiles.py b/tst/EnergyPlus/api/test_OutputFiles.py index a35e504487f..a872b600848 100644 --- a/tst/EnergyPlus/api/test_OutputFiles.py +++ b/tst/EnergyPlus/api/test_OutputFiles.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/tst/EnergyPlus/api/test_SysExit.py b/tst/EnergyPlus/api/test_SysExit.py index 5ec47b4a62e..7c1f0b02ccf 100644 --- a/tst/EnergyPlus/api/test_SysExit.py +++ b/tst/EnergyPlus/api/test_SysExit.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/tst/EnergyPlus/unit/AdvancedAFN.unit.cc b/tst/EnergyPlus/unit/AdvancedAFN.unit.cc index b5afa4a8a64..53f83d673bc 100644 --- a/tst/EnergyPlus/unit/AdvancedAFN.unit.cc +++ b/tst/EnergyPlus/unit/AdvancedAFN.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -106,6 +106,10 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_AdvancedTest_Test1) state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 22.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MRT = 22.0; + state->dataHeatBalFanSys->TempControlType.allocate(1); + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::Uncontrolled; + state->dataHeatBalFanSys->zoneTstatSetpts.allocate(1); + TimeOpenElapsed = 5.0; TimeCloseElapsed = 0.0; state->afn->OccupantVentilationControl(1).MinTimeControlOnly = false; @@ -157,18 +161,14 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_AdvancedTest_Test1) TimeCloseElapsed = 5.0; state->dataHeatBal->ZoneIntGain.allocate(1); state->dataHeatBal->ZoneIntGain(1).NOFOCC = 0.5; - state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::Uncontrolled; - state->dataHeatBalFanSys->ZoneThermostatSetPointLo.allocate(1); - state->dataHeatBalFanSys->ZoneThermostatSetPointHi.allocate(1); state->afn->OccupantVentilationControl(1).calc(*state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus); EXPECT_EQ(1, OpenProbStatus); EXPECT_EQ(0, CloseProbStatus); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; - state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1) = 22.0; - state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1) = 28.0; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo = 22.0; + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi = 28.0; state->afn->OccupantVentilationControl(1).calc(*state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus); EXPECT_EQ(1, OpenProbStatus); EXPECT_EQ(0, CloseProbStatus); diff --git a/tst/EnergyPlus/unit/AirLoopHVACDOAS.unit.cc b/tst/EnergyPlus/unit/AirLoopHVACDOAS.unit.cc index da2f158da1e..3a13b10c0d0 100644 --- a/tst/EnergyPlus/unit/AirLoopHVACDOAS.unit.cc +++ b/tst/EnergyPlus/unit/AirLoopHVACDOAS.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -90,7 +90,6 @@ using namespace EnergyPlus; using namespace DataSurfaces; using namespace DataHeatBalance; using namespace EnergyPlus::DataLoopNode; -using namespace EnergyPlus::ScheduleManager; using namespace OutAirNodeManager; using namespace HeatingCoils; @@ -4035,6 +4034,8 @@ TEST_F(EnergyPlusFixture, AirLoopHVACDOASTest) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + state->dataIPShortCut->lNumericFieldBlanks.allocate(1000); state->dataIPShortCut->lAlphaFieldBlanks.allocate(1000); state->dataIPShortCut->cAlphaFieldNames.allocate(1000); @@ -4048,10 +4049,8 @@ TEST_F(EnergyPlusFixture, AirLoopHVACDOASTest) state->dataIPShortCut->cAlphaArgs = " "; state->dataIPShortCut->rNumericArgs = 0.0; - bool ErrorsFound = false; // Read objects - HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); - EXPECT_FALSE(ErrorsFound); + bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); Material::GetWindowGlassSpectralData(*state, ErrorsFound); @@ -4132,7 +4131,8 @@ TEST_F(EnergyPlusFixture, AirLoopHVACDOASTest) state->dataEnvrn->OutBaroPress = 101325.0; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // set availability and fan schedule to 1 + auto *sched = Sched::GetSchedule(*state, "ALWAYS_ON"); + sched->currentVal = 1.0; // set availability and fan schedule to 1 thisAirLoopDOASObjec.SimAirLoopHVACDOAS(*state, true, index); @@ -4375,6 +4375,8 @@ TEST_F(EnergyPlusFixture, AirLoopHVACDOAS_TestOACompOutletNodeIndex) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + MixedAir::GetOutsideAirSysInputs(*state); state->dataMixedAir->GetOASysInputFlag = false; MixedAir::GetOAMixerInputs(*state); @@ -8434,9 +8436,10 @@ TEST_F(EnergyPlusFixture, AirLoopHVACDOAS_ReportVariableResetTest) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + bool ErrorsFound = false; // Read objects - HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -8519,7 +8522,9 @@ TEST_F(EnergyPlusFixture, AirLoopHVACDOAS_ReportVariableResetTest) state->dataEnvrn->OutBaroPress = 101325.0; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; + auto *sched = Sched::GetSchedule(*state, "ALWAYS_ON"); + sched->currentVal = 1.0; + // simulte the DOAS thisAirLoopDOASObjec.SimAirLoopHVACDOAS(*state, true, index); // verify doas air flow rate and heating rate @@ -8842,6 +8847,8 @@ TEST_F(EnergyPlusFixture, AirLoopHVACDOAS_TestOACompFanNoDrawAndBlow) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + MixedAir::GetOutsideAirSysInputs(*state); state->dataMixedAir->GetOASysInputFlag = false; MixedAir::GetOAMixerInputs(*state); @@ -10063,15 +10070,16 @@ TEST_F(EnergyPlusFixture, AirLoopHVACDOAS_TestFanHeatAddeToCoolingCoilSize) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataGlobal->DDOnlySimulation = true; SimulationManager::ManageSimulation(*state); // run the design day over the warmup period (24 hrs, 25 days) // OA flow rate - EXPECT_NEAR(state->dataUnitarySystems->unitarySys[0].m_MaxCoolAirVolFlow, 0.55713, 0.001); + EXPECT_NEAR(state->dataUnitarySystems->unitarySys[0].m_MaxCoolAirVolFlow, 0.65598, 0.001); // Cooling capacity - EXPECT_NEAR(state->dataUnitarySystems->unitarySys[0].m_DesignCoolingCapacity, 21135.6226, 0.01); + EXPECT_NEAR(state->dataUnitarySystems->unitarySys[0].m_DesignCoolingCapacity, 24885.6323, 0.01); } TEST_F(EnergyPlusFixture, AirLoopHVACDOAS_TestOACompConnectionError) @@ -10394,6 +10402,8 @@ TEST_F(EnergyPlusFixture, AirLoopHVACDOAS_TestOACompConnectionError) ASSERT_TRUE(process_idf(idf_objects)); compare_err_stream_substring("", true); + state->init_state(*state); + MixedAir::GetOutsideAirSysInputs(*state); state->dataMixedAir->GetOASysInputFlag = false; MixedAir::GetOAMixerInputs(*state); @@ -11625,6 +11635,8 @@ TEST_F(EnergyPlusFixture, AirLoopHVACDOAS_TestFanDrawThroughPlacement) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + state->dataGlobal->DDOnlySimulation = true; SimulationManager::ManageSimulation(*state); // run the design day over the warmup period (24 hrs, 25 days) @@ -11663,7 +11675,8 @@ TEST_F(EnergyPlusFixture, AirLoopHVACDOAS_TestFanDrawThroughPlacement) state->dataEnvrn->OutBaroPress = 101325.0; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // set availability and fan schedule to 1 + auto *sched = Sched::GetSchedule(*state, "ALWAYS_ON"); + sched->currentVal = 1.0; // set availability and fan schedule to 1 thisAirLoopDOASObjec.SimAirLoopHVACDOAS(*state, true, index); diff --git a/tst/EnergyPlus/unit/AirTerminalSingleDuct.unit.cc b/tst/EnergyPlus/unit/AirTerminalSingleDuct.unit.cc index a3a0ea6871f..7e5f555ce88 100644 --- a/tst/EnergyPlus/unit/AirTerminalSingleDuct.unit.cc +++ b/tst/EnergyPlus/unit/AirTerminalSingleDuct.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -87,7 +87,6 @@ using namespace EnergyPlus::HVACSingleDuctInduc; using namespace EnergyPlus::DataLoopNode; using namespace EnergyPlus::MixedAir; using namespace EnergyPlus::Psychrometrics; -using namespace EnergyPlus::ScheduleManager; using namespace EnergyPlus::SingleDuct; using namespace EnergyPlus::ZoneAirLoopEquipmentManager; using namespace EnergyPlus::DataDefineEquip; @@ -175,9 +174,10 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVReheat_GetInputTest) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(*state); // read schedules + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + + state->init_state(*state); GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -305,9 +305,9 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuct4PipeInduction_GetInputTest) process_idf(idf_objects); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(*state); // read schedules + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -395,9 +395,9 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctVAVHeatCool_GetInputTest) process_idf(idf_objects); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(*state); // read schedules + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -518,9 +518,9 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctVAVReheatVarSpeedFan_GetInputTest ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(*state); // read schedules + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -616,9 +616,10 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctVAVReheat_NormalActionTest) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(*state); + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + bool ErrorsFound(false); GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -640,7 +641,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctVAVReheat_NormalActionTest) int const OutletNode = state->dataSingleDuct->sd_airterminal(SysNum).OutletNodeNum; int const ZonePtr = state->dataSingleDuct->sd_airterminal(SysNum).CtrlZoneNum; int const ZoneAirNodeNum = thisZoneEquip.ZoneNode; - state->dataScheduleMgr->Schedule(state->dataSingleDuct->sd_airterminal(SysNum).SchedPtr).CurrentValue = 1.0; // unit is always available + state->dataSingleDuct->sd_airterminal(SysNum).availSched->currentVal = 1.0; // unit is always available // design maximum air mass flow rate Real64 MassFlowRateMaxAvail = state->dataSingleDuct->sd_airterminal(SysNum).MaxAirVolFlowRate * state->dataEnvrn->StdRhoAir; @@ -668,7 +669,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctVAVReheat_NormalActionTest) state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputRequired = 1000.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 1000.0; state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; // calc min air mass flow rate for Normal Damper Heating Action Real64 expectedMassFlowAirReheatMin = 0.2 * MassFlowRateMaxAvail; @@ -887,41 +888,43 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVAirTerminals_GetInputs) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetZoneAirLoopEquipment(*state); SingleDuct::GetSysInput(*state); // VAV Reheat get input test EXPECT_EQ("AirTerminal:SingleDuct:VAV:Reheat", state->dataSingleDuct->sd_airterminal(1).sysType); // VAV Reheat Type EXPECT_EQ("VAV REHEAT AT", state->dataSingleDuct->sd_airterminal(1).SysName); // VAV Reheat Name - EXPECT_TRUE(state->dataSingleDuct->sd_airterminal(1).ZoneTurndownMinAirFracSchExist); // turndown schdule exists + EXPECT_TRUE(state->dataSingleDuct->sd_airterminal(1).zoneTurndownMinAirFracSched != nullptr); // turndown schdule exists EXPECT_EQ(state->dataSingleDuct->sd_airterminal(1).ZoneTurndownMinAirFrac, 1.0); // initialized to 1.0 EXPECT_EQ(state->dataSingleDuct->sd_airterminal(1).ZoneMinAirFracDes, 0.3); // design minimum flow fraction // VAV change over bypass reheat get input test EXPECT_EQ("AirTerminal:SingleDuct:VAV:HeatAndCool:Reheat", state->dataSingleDuct->sd_airterminal(2).sysType); // VAV HeatCool Reheat Type EXPECT_EQ("VAV CBP GAS REHEAT AT", state->dataSingleDuct->sd_airterminal(2).SysName); // VAV HeatCool Reheat Name - EXPECT_TRUE(state->dataSingleDuct->sd_airterminal(2).ZoneTurndownMinAirFracSchExist); // turndown schdule exists + EXPECT_TRUE(state->dataSingleDuct->sd_airterminal(2).zoneTurndownMinAirFracSched != nullptr); // turndown schdule exists EXPECT_EQ(state->dataSingleDuct->sd_airterminal(2).ZoneTurndownMinAirFrac, 1.0); // initialized to 1.0 EXPECT_EQ(state->dataSingleDuct->sd_airterminal(2).ZoneMinAirFracDes, 0.20); // design minimum flow fraction // VAV No reheat get input test EXPECT_EQ("AirTerminal:SingleDuct:VAV:NoReheat", state->dataSingleDuct->sd_airterminal(3).sysType); // VAV No Reheat Type EXPECT_EQ("VAV NO REHEAT AT", state->dataSingleDuct->sd_airterminal(3).SysName); // VAV No Reheat Name - EXPECT_TRUE(state->dataSingleDuct->sd_airterminal(3).ZoneTurndownMinAirFracSchExist); // turndown schdule exists + EXPECT_TRUE(state->dataSingleDuct->sd_airterminal(3).zoneTurndownMinAirFracSched != nullptr); // turndown schdule exists EXPECT_EQ(state->dataSingleDuct->sd_airterminal(3).ZoneTurndownMinAirFrac, 1.0); // initialized to 1.0 EXPECT_EQ(state->dataSingleDuct->sd_airterminal(3).ZoneMinAirFracDes, 0.25); // design minimum flow fraction // VAV change over bypass no reheat get input test EXPECT_EQ("AirTerminal:SingleDuct:VAV:HeatAndCool:NoReheat", state->dataSingleDuct->sd_airterminal(4).sysType); // VAV HeatCool NoReheat Type EXPECT_EQ("VAV CBP NOREHEAT AT", state->dataSingleDuct->sd_airterminal(4).SysName); // VAV HeatCool NoReheat Name - EXPECT_TRUE(state->dataSingleDuct->sd_airterminal(4).ZoneTurndownMinAirFracSchExist); // turndown schdule exists + EXPECT_TRUE(state->dataSingleDuct->sd_airterminal(4).zoneTurndownMinAirFracSched != nullptr); // turndown schdule exists EXPECT_EQ(state->dataSingleDuct->sd_airterminal(4).ZoneTurndownMinAirFrac, 1.0); // initialized to 1.0 EXPECT_EQ(state->dataSingleDuct->sd_airterminal(4).ZoneMinAirFracDes, 0.15); // design minimum flow fraction // VAV reheat variable speed fan get input test EXPECT_EQ("AirTerminal:SingleDuct:VAV:Reheat:VariableSpeedFan", state->dataSingleDuct->sd_airterminal(5).sysType); // VAV Reheat VSFan Type EXPECT_EQ("VAV REHEAT VS FAN", state->dataSingleDuct->sd_airterminal(5).SysName); // VAV Reheat VSFan Name - EXPECT_TRUE(state->dataSingleDuct->sd_airterminal(5).ZoneTurndownMinAirFracSchExist); // turndown schdule exists + EXPECT_TRUE(state->dataSingleDuct->sd_airterminal(5).zoneTurndownMinAirFracSched != nullptr); // turndown schdule exists EXPECT_EQ(state->dataSingleDuct->sd_airterminal(5).ZoneTurndownMinAirFrac, 1.0); // initialized to 1.0 EXPECT_EQ(state->dataSingleDuct->sd_airterminal(5).ZoneMinAirFracDes, 0.10); // design minimum flow fraction } @@ -1016,10 +1019,10 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVReheatAirTerminal_MinFlowTurnDownTest) bool ErrorsFound = false; bool FirstHVACIteration = true; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataGlobal->HourOfDay = 1; @@ -1029,10 +1032,10 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVReheatAirTerminal_MinFlowTurnDownTest) state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); DataZoneEquipment::GetZoneEquipmentData(*state); @@ -1042,7 +1045,7 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVReheatAirTerminal_MinFlowTurnDownTest) // check VAV reheat air terminal inputs EXPECT_EQ("AirTerminal:SingleDuct:VAV:Reheat", state->dataSingleDuct->sd_airterminal(SysNum).sysType); // VAV Reheat Type EXPECT_EQ("VAV REHEAT AT", state->dataSingleDuct->sd_airterminal(SysNum).SysName); // VAV Reheat Name - EXPECT_TRUE(state->dataSingleDuct->sd_airterminal(SysNum).ZoneTurndownMinAirFracSchExist); // turndown schdule exists + EXPECT_TRUE(state->dataSingleDuct->sd_airterminal(SysNum).zoneTurndownMinAirFracSched != nullptr); // turndown schdule exists EXPECT_EQ(state->dataSingleDuct->sd_airterminal(SysNum).ZoneTurndownMinAirFrac, 1.0); // initialized to 1.0 EXPECT_EQ(state->dataSingleDuct->sd_airterminal(SysNum).ZoneMinAirFracDes, 0.3); // input from VAV reheat air terminal EXPECT_EQ(state->dataSingleDuct->sd_airterminal(SysNum).MaxAirVolFlowRate, 1.0); // input from VAV reheat air terminal @@ -1055,7 +1058,7 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVReheatAirTerminal_MinFlowTurnDownTest) int ZoneNodeNum = Util::FindItemInList("ZONE 1 AIR NODE", state->dataLoopNodes->NodeID); int InletNodeNum = Util::FindItemInList("NODE 24", state->dataLoopNodes->NodeID); state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputRequired = 2000.0; - state->dataSingleDuct->sd_airterminal(SysNum).ZoneTurndownMinAirFracSchPtr = 1; // + state->dataSingleDuct->sd_airterminal(SysNum).zoneTurndownMinAirFracSched = Sched::GetSchedule(*state, "TURNDOWNMINAIRFLOWSCH1"); state->dataLoopNodes->Node(InletNodeNum).MassFlowRate = SysMaxMassFlowRes; state->dataLoopNodes->Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlowRes; state->dataGlobal->BeginEnvrnFlag = true; @@ -1080,7 +1083,7 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVReheatAirTerminal_MinFlowTurnDownTest) state->dataSingleDuct->sd_airterminal(SysNum).ZoneTurndownMinAirFrac); // test with heating load and turndown fraction schedule value set 0.5 - state->dataSingleDuct->sd_airterminal(SysNum).ZoneTurndownMinAirFracSchPtr = 2; + state->dataSingleDuct->sd_airterminal(SysNum).zoneTurndownMinAirFracSched = Sched::GetSchedule(*state, "TURNDOWNMINAIRFLOWSCH2"); SysMinMassFlowRes = 1.0 * state->dataEnvrn->StdRhoAir * 0.30 * 0.5; // min flow rate at 0.5 turndown fraction state->dataLoopNodes->Node(InletNodeNum).MassFlowRate = SysMaxMassFlowRes; state->dataLoopNodes->Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlowRes; @@ -1226,10 +1229,11 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVReheatVSFanAirTerminal_MinFlowTurnDownTes bool ErrorsFound = false; bool FirstHVACIteration = true; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + + state->init_state(*state); + state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataGlobal->HourOfDay = 1; @@ -1239,10 +1243,10 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVReheatVSFanAirTerminal_MinFlowTurnDownTes state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); DataZoneEquipment::GetZoneEquipmentData(*state); @@ -1254,7 +1258,7 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVReheatVSFanAirTerminal_MinFlowTurnDownTes int InletNodeNum = Util::FindItemInList("SPACE1-1 ATU IN NODE", state->dataLoopNodes->NodeID); EXPECT_EQ("AirTerminal:SingleDuct:VAV:Reheat:VariableSpeedFan", state->dataSingleDuct->sd_airterminal(SysNum).sysType); // VAV Reheat Type EXPECT_EQ("VAV REHEAT VS FAN AT", state->dataSingleDuct->sd_airterminal(SysNum).SysName); // VAV Reheat Name - EXPECT_TRUE(state->dataSingleDuct->sd_airterminal(SysNum).ZoneTurndownMinAirFracSchExist); // turndown schdule exists + EXPECT_TRUE(state->dataSingleDuct->sd_airterminal(SysNum).zoneTurndownMinAirFracSched != nullptr); // turndown schdule exists EXPECT_EQ(state->dataSingleDuct->sd_airterminal(SysNum).ZoneTurndownMinAirFrac, 1.0); // initialized to 1.0 EXPECT_EQ(state->dataSingleDuct->sd_airterminal(SysNum).ZoneMinAirFracDes, 0.1); // input from VAV reheat air terminal EXPECT_EQ(state->dataSingleDuct->sd_airterminal(SysNum).MaxAirVolFlowRate, 1.0); // input from VAV reheat air terminal @@ -1265,7 +1269,7 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVReheatVSFanAirTerminal_MinFlowTurnDownTes // test with heating load and turndown fraction schedule value set 1.0 state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputRequired = 2000.0; - state->dataSingleDuct->sd_airterminal(SysNum).ZoneTurndownMinAirFracSchPtr = 1; // + state->dataSingleDuct->sd_airterminal(SysNum).zoneTurndownMinAirFracSched = Sched::GetSchedule(*state, "TURNDOWNMINAIRFLOWSCH1"); // state->dataLoopNodes->Node(InletNodeNum).MassFlowRate = SysMaxMassFlowRes; state->dataLoopNodes->Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlowRes; state->dataGlobal->BeginEnvrnFlag = true; @@ -1290,7 +1294,7 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVReheatVSFanAirTerminal_MinFlowTurnDownTes state->dataSingleDuct->sd_airterminal(SysNum).ZoneTurndownMinAirFrac); // test with heating load and turndown fraction schedule value set 0.5 - state->dataSingleDuct->sd_airterminal(SysNum).ZoneTurndownMinAirFracSchPtr = 2; + state->dataSingleDuct->sd_airterminal(SysNum).zoneTurndownMinAirFracSched = Sched::GetSchedule(*state, "TURNDOWNMINAIRFLOWSCH2"); SysMinMassFlowRes = 1.0 * state->dataEnvrn->StdRhoAir * 0.10 * 0.5; // min flow rate at 0.5 turndown fraction state->dataLoopNodes->Node(InletNodeNum).MassFlowRate = SysMaxMassFlowRes; state->dataLoopNodes->Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlowRes; @@ -1403,10 +1407,11 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVHeatCoolReheatAirTerminal_MinFlowTurnDown bool ErrorsFound = false; bool FirstHVACIteration = true; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + + state->init_state(*state); + state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataGlobal->HourOfDay = 1; @@ -1416,10 +1421,10 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVHeatCoolReheatAirTerminal_MinFlowTurnDown state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); DataZoneEquipment::GetZoneEquipmentData(*state); @@ -1429,7 +1434,7 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVHeatCoolReheatAirTerminal_MinFlowTurnDown // check VAV heatcool reheat air terminal inputs EXPECT_EQ("AirTerminal:SingleDuct:VAV:HeatAndCool:Reheat", state->dataSingleDuct->sd_airterminal(SysNum).sysType); // VAV HeatCool Reheat Type EXPECT_EQ("VAV CBP GAS REHEAT AT", state->dataSingleDuct->sd_airterminal(SysNum).SysName); // VAV HeatCool Reheat Name - EXPECT_TRUE(state->dataSingleDuct->sd_airterminal(SysNum).ZoneTurndownMinAirFracSchExist); // turndown schdule exists + EXPECT_TRUE(state->dataSingleDuct->sd_airterminal(SysNum).zoneTurndownMinAirFracSched != nullptr); // turndown schdule exists EXPECT_EQ(state->dataSingleDuct->sd_airterminal(SysNum).ZoneTurndownMinAirFrac, 1.0); // initialized to 1.0 EXPECT_EQ(state->dataSingleDuct->sd_airterminal(SysNum).ZoneMinAirFracDes, 0.2); // input from VAV HeatCool reheat air terminal EXPECT_EQ(state->dataSingleDuct->sd_airterminal(SysNum).MaxAirVolFlowRate, 1.0); // input from VAV HeatCool reheat air terminal @@ -1442,7 +1447,7 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVHeatCoolReheatAirTerminal_MinFlowTurnDown int ZoneNodeNum = Util::FindItemInList("ZONE 1 AIR NODE", state->dataLoopNodes->NodeID); int InletNodeNum = Util::FindItemInList("NODE 7", state->dataLoopNodes->NodeID); state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputRequired = 2000.0; - state->dataSingleDuct->sd_airterminal(SysNum).ZoneTurndownMinAirFracSchPtr = 1; // + state->dataSingleDuct->sd_airterminal(SysNum).zoneTurndownMinAirFracSched = Sched::GetSchedule(*state, "TURNDOWNMINAIRFLOWSCH1"); // state->dataLoopNodes->Node(InletNodeNum).MassFlowRate = SysMaxMassFlowRes; state->dataLoopNodes->Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlowRes; state->dataGlobal->BeginEnvrnFlag = true; @@ -1467,7 +1472,7 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVHeatCoolReheatAirTerminal_MinFlowTurnDown state->dataSingleDuct->sd_airterminal(SysNum).ZoneTurndownMinAirFrac); // test with heating load and turndown fraction schedule value set 0.5 - state->dataSingleDuct->sd_airterminal(SysNum).ZoneTurndownMinAirFracSchPtr = 2; + state->dataSingleDuct->sd_airterminal(SysNum).zoneTurndownMinAirFracSched = Sched::GetSchedule(*state, "TURNDOWNMINAIRFLOWSCH2"); SysMinMassFlowRes = 1.0 * state->dataEnvrn->StdRhoAir * 0.20 * 0.5; // min flow rate at 0.5 turndown fraction state->dataLoopNodes->Node(InletNodeNum).MassFlowRate = SysMaxMassFlowRes; state->dataLoopNodes->Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlowRes; @@ -1591,10 +1596,10 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVReheatVSFan_DamperPositionTest) bool ErrorsFound = false; bool FirstHVACIteration = true; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataGlobal->HourOfDay = 1; @@ -1604,10 +1609,10 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVReheatVSFan_DamperPositionTest) state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); DataZoneEquipment::GetZoneEquipmentData(*state); @@ -1738,10 +1743,10 @@ TEST_F(EnergyPlusFixture, VAVHeatCoolReheatAirTerminal_ZoneOAVolumeFlowRateTest) bool ErrorsFound = false; bool FirstHVACIteration = true; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataGlobal->HourOfDay = 1; @@ -1751,10 +1756,10 @@ TEST_F(EnergyPlusFixture, VAVHeatCoolReheatAirTerminal_ZoneOAVolumeFlowRateTest) state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); DataZoneEquipment::GetZoneEquipmentData(*state); diff --git a/tst/EnergyPlus/unit/AirTerminalSingleDuctConstantVolumeNoReheat.unit.cc b/tst/EnergyPlus/unit/AirTerminalSingleDuctConstantVolumeNoReheat.unit.cc index c481ca3c9c6..498b286a4fa 100644 --- a/tst/EnergyPlus/unit/AirTerminalSingleDuctConstantVolumeNoReheat.unit.cc +++ b/tst/EnergyPlus/unit/AirTerminalSingleDuctConstantVolumeNoReheat.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -79,7 +79,6 @@ using namespace EnergyPlus::DataLoopNode; using namespace EnergyPlus::DataZoneEquipment; using namespace EnergyPlus::HeatBalanceManager; using namespace EnergyPlus::Psychrometrics; -using namespace EnergyPlus::ScheduleManager; using namespace EnergyPlus::SingleDuct; using namespace EnergyPlus::ZoneAirLoopEquipmentManager; @@ -149,9 +148,9 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_GetInput) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(*state); // read schedules + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -163,9 +162,10 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_GetInput) EXPECT_EQ("AirTerminal:SingleDuct:ConstantVolume:NoReheat", state->dataSingleDuct->sd_airterminal(1).sysType); // AT SD constant volume no reheat object type EXPECT_EQ("SDCVNOREHEATAT1", state->dataSingleDuct->sd_airterminal(1).SysName); // AT SD constant volume no reheat name - EXPECT_EQ("AVAILSCHEDULE", state->dataSingleDuct->sd_airterminal(1).Schedule); // AT SD constant volume no reheat availability schedule name - EXPECT_EQ(0.50, state->dataSingleDuct->sd_airterminal(1).MaxAirVolFlowRate); // maximum volume flow Rate - ASSERT_TRUE(state->dataSingleDuct->sd_airterminal(1).NoOAFlowInputFromUser); // no OA flow input from user + EXPECT_EQ("AVAILSCHEDULE", + state->dataSingleDuct->sd_airterminal(1).availSched->Name); // AT SD constant volume no reheat availability schedule name + EXPECT_EQ(0.50, state->dataSingleDuct->sd_airterminal(1).MaxAirVolFlowRate); // maximum volume flow Rate + ASSERT_TRUE(state->dataSingleDuct->sd_airterminal(1).NoOAFlowInputFromUser); // no OA flow input from user EXPECT_EQ(DataZoneEquipment::PerPersonVentRateMode::DCVByCurrentLevel, state->dataSingleDuct->sd_airterminal(1).OAPerPersonMode); // default value when A6 input field is blank } @@ -231,9 +231,9 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_SimConstVolNoReheat) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(*state); // read schedules + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -245,7 +245,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_SimConstVolNoReheat) int constexpr SysNum(1); Real64 MassFlowRateMaxAvail = state->dataSingleDuct->sd_airterminal(SysNum).MaxAirVolFlowRate * state->dataEnvrn->StdRhoAir; state->dataSingleDuct->sd_airterminal(SysNum).sd_airterminalInlet.AirMassFlowRate = MassFlowRateMaxAvail; - state->dataScheduleMgr->Schedule(state->dataSingleDuct->sd_airterminal(SysNum).SchedPtr).CurrentValue = 1.0; // unit is always available + state->dataSingleDuct->sd_airterminal(SysNum).availSched->currentVal = 1.0; // unit is always available // run SimConstVolNoReheat() function state->dataSingleDuct->sd_airterminal(SysNum).SimConstVolNoReheat(*state); // check the TA outlet air mass flow rate @@ -314,9 +314,9 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_Sim) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(*state); // read schedules + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -334,7 +334,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_Sim) int const InletNode = state->dataSingleDuct->sd_airterminal(SysNum).InletNodeNum; int const ZonePtr = state->dataSingleDuct->sd_airterminal(SysNum).CtrlZoneNum; int const ZoneAirNodeNum = state->dataZoneEquip->ZoneEquipConfig(ZonePtr).ZoneNode; - state->dataScheduleMgr->Schedule(state->dataSingleDuct->sd_airterminal(SysNum).SchedPtr).CurrentValue = 1.0; // unit is always available + state->dataSingleDuct->sd_airterminal(SysNum).availSched->currentVal = 1.0; // unit is always available // design maximum air mass flow rate Real64 MassFlowRateMaxAvail = state->dataSingleDuct->sd_airterminal(SysNum).MaxAirVolFlowRate * state->dataEnvrn->StdRhoAir; @@ -504,9 +504,9 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_OASpecification) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(*state); // read schedules + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -578,7 +578,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_OASpecification) // Full occupancy 3 people, OA/person = 0.1, OA/zone = 0.5, OA Sched = 1.0 state->dataGlobal->HourOfDay = 12; - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // Just set number of people directly, too many other things that have to be in place to call ManagerInternalHeatGains() state->dataHeatBal->ZoneIntGain(1).NOFOCC = 3.0; Real64 expectedMassFlow = 1.0 * ((3.0 * 0.1) + 0.5); @@ -596,7 +596,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_OASpecification) // 50% occupancy 1.5 people, OA/person = 0.1, OA/zone = 0.5, OA Sched = 1.0 state->dataGlobal->HourOfDay = 12; - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // Just set number of people directly, too many other things that have to be in place to call ManagerInternalHeatGains() state->dataHeatBal->ZoneIntGain(1).NOFOCC = 1.5; expectedMassFlow = 1.0 * ((1.5 * 0.1) + 0.5); @@ -612,7 +612,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_OASpecification) // Nighttime OA Sched = 0.0 state->dataGlobal->HourOfDay = 24; - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // Just set number of people directly, too many other things that have to be in place to call ManagerInternalHeatGains() state->dataHeatBal->ZoneIntGain(1).NOFOCC = 1.5; expectedMassFlow = 0.0 * ((1.5 * 0.1) + 0.5); @@ -689,9 +689,9 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_EMSOverrideAirFlow) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(*state); // read schedules + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -709,7 +709,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_EMSOverrideAirFlow) int const InletNode = state->dataSingleDuct->sd_airterminal(SysNum).InletNodeNum; int const ZonePtr = state->dataSingleDuct->sd_airterminal(SysNum).CtrlZoneNum; int const ZoneAirNodeNum = state->dataZoneEquip->ZoneEquipConfig(ZonePtr).ZoneNode; - state->dataScheduleMgr->Schedule(state->dataSingleDuct->sd_airterminal(SysNum).SchedPtr).CurrentValue = 1.0; // unit is always available + state->dataSingleDuct->sd_airterminal(SysNum).availSched->currentVal = 1.0; // unit is always available // design maximum air mass flow rate Real64 MassFlowRateMaxAvail = state->dataSingleDuct->sd_airterminal(SysNum).MaxAirVolFlowRate * state->dataEnvrn->StdRhoAir; EXPECT_EQ(1.0, state->dataSingleDuct->sd_airterminal(SysNum).MaxAirVolFlowRate); @@ -878,9 +878,9 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_OAVolumeFlowRateReport ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(*state); // read schedules + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -955,7 +955,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_OAVolumeFlowRateReport // Full occupancy 3 people, OA/person = 0.1, OA/zone = 0.5, OA Sched = 1.0 state->dataGlobal->HourOfDay = 12; - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // Just set number of people directly, too many other things that have to be in place to call ManagerInternalHeatGains() state->dataHeatBal->ZoneIntGain(1).NOFOCC = 3.0; Real64 expectedMassFlow = 1.0 * ((3.0 * 0.1) + 0.5); @@ -970,7 +970,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_OAVolumeFlowRateReport // 50% occupancy 1.5 people, OA/person = 0.1, OA/zone = 0.5, OA Sched = 1.0 state->dataGlobal->HourOfDay = 12; - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // Just set number of people directly, too many other things that have to be in place to call ManagerInternalHeatGains() state->dataHeatBal->ZoneIntGain(1).NOFOCC = 1.5; expectedMassFlow = 1.0 * ((1.5 * 0.1) + 0.5); @@ -983,7 +983,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_OAVolumeFlowRateReport // Nighttime OA Sched = 0.0 state->dataGlobal->HourOfDay = 24; - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // Just set number of people directly, too many other things that have to be in place to call ManagerInternalHeatGains() state->dataHeatBal->ZoneIntGain(1).NOFOCC = 1.5; expectedMassFlow = 0.0 * ((1.5 * 0.1) + 0.5); @@ -1057,9 +1057,9 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_SimSensibleOutPutTest) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(*state); // read schedules + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -1083,7 +1083,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_SimSensibleOutPutTest) int const ZonePtr = thisAirTerminal.CtrlZoneNum; int const ZoneAirNodeNum = state->dataZoneEquip->ZoneEquipConfig(ZonePtr).ZoneNode; - state->dataScheduleMgr->Schedule(thisAirTerminal.SchedPtr).CurrentValue = 1.0; // unit is always available + thisAirTerminal.availSched->currentVal = 1.0; // unit is always available ; // design maximum air mass flow rate Real64 MassFlowRateMaxAvail = thisAirTerminal.MaxAirVolFlowRate * state->dataEnvrn->StdRhoAir; diff --git a/tst/EnergyPlus/unit/AirTerminalSingleDuctMixer.unit.cc b/tst/EnergyPlus/unit/AirTerminalSingleDuctMixer.unit.cc index 752ccc73f3b..0d39e33183d 100644 --- a/tst/EnergyPlus/unit/AirTerminalSingleDuctMixer.unit.cc +++ b/tst/EnergyPlus/unit/AirTerminalSingleDuctMixer.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -102,7 +102,6 @@ using namespace EnergyPlus::HeatBalanceManager; using namespace EnergyPlus::HVACVariableRefrigerantFlow; using namespace EnergyPlus::OutputReportPredefined; using namespace EnergyPlus::Psychrometrics; -using namespace EnergyPlus::ScheduleManager; using namespace EnergyPlus::SingleDuct; using namespace EnergyPlus::UnitVentilator; using namespace EnergyPlus::WaterCoils; @@ -346,9 +345,9 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_GetInputPTAC_InletSide) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(*state); // read schedules + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -596,11 +595,11 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_ATMInletSide) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(*state); // read schedules - InitializePsychRoutines(*state); + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + OutputReportPredefined::SetPredefinedTables(*state); GetZoneData(*state, ErrorsFound); @@ -681,7 +680,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_ATMInletSide) state->dataGlobal->SysSizingCalc = true; state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataZoneEnergyDemand->ZoneSysMoistureDemand.allocate(1); state->dataZoneEnergyDemand->ZoneSysMoistureDemand(1).RemainingOutputReqToDehumidSP = 0.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); @@ -690,8 +689,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_ATMInletSide) state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputRequired = -5000.0; QZnReq = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP; - state->dataScheduleMgr->Schedule(state->dataUnitarySystems->unitarySys[0].m_SysAvailSchedPtr).CurrentValue = 1.0; // unit is always available - state->dataScheduleMgr->Schedule(state->dataUnitarySystems->unitarySys[0].m_FanAvailSchedPtr).CurrentValue = 1.0; // fan is always available + state->dataUnitarySystems->unitarySys[0].m_sysAvailSched->currentVal = 1.0; // unit is always available + state->dataUnitarySystems->unitarySys[0].m_fanAvailSched->currentVal = 1.0; // fan is always available // set secondary air mass flow rate to zero state->dataLoopNodes->Node(state->dataSingleDuct->SysATMixer(1).SecInNode).MassFlowRate = 0.0; @@ -949,11 +948,11 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_ATMSupplySide) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(*state); // read schedules - InitializePsychRoutines(*state); + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + OutputReportPredefined::SetPredefinedTables(*state); GetZoneData(*state, ErrorsFound); @@ -1035,7 +1034,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_ATMSupplySide) state->dataGlobal->SysSizingCalc = true; state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataZoneEnergyDemand->ZoneSysMoistureDemand.allocate(1); state->dataZoneEnergyDemand->ZoneSysMoistureDemand(1).RemainingOutputReqToDehumidSP = 0.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); @@ -1044,8 +1043,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_ATMSupplySide) state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputRequired = -5000.0; QZnReq = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP; - state->dataScheduleMgr->Schedule(state->dataUnitarySystems->unitarySys[0].m_SysAvailSchedPtr).CurrentValue = 1.0; // unit is always available - state->dataScheduleMgr->Schedule(state->dataUnitarySystems->unitarySys[0].m_FanAvailSchedPtr).CurrentValue = 1.0; // fan is always available + state->dataUnitarySystems->unitarySys[0].m_sysAvailSched->currentVal = 1.0; // unit is always available + state->dataUnitarySystems->unitarySys[0].m_fanAvailSched->currentVal = 1.0; // fan is always available // set secondary air mass flow rate to zero state->dataLoopNodes->Node(state->dataSingleDuct->SysATMixer(1).SecInNode).MassFlowRate = 0.0; @@ -1388,11 +1387,11 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTHP_ATMInletSide) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(*state); // read schedules - InitializePsychRoutines(*state); + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + OutputReportPredefined::SetPredefinedTables(*state); GetZoneData(*state, ErrorsFound); @@ -1474,7 +1473,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTHP_ATMInletSide) state->dataGlobal->SysSizingCalc = true; state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataZoneEnergyDemand->ZoneSysMoistureDemand.allocate(1); state->dataZoneEnergyDemand->ZoneSysMoistureDemand(1).RemainingOutputReqToDehumidSP = 0.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); @@ -1483,8 +1482,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTHP_ATMInletSide) state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputRequired = -5000.0; QZnReq = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP; - state->dataScheduleMgr->Schedule(state->dataUnitarySystems->unitarySys[0].m_SysAvailSchedPtr).CurrentValue = 1.0; // unit is always available - state->dataScheduleMgr->Schedule(state->dataUnitarySystems->unitarySys[0].m_FanAvailSchedPtr).CurrentValue = 1.0; // fan is always available + state->dataUnitarySystems->unitarySys[0].m_sysAvailSched->currentVal = 1.0; // unit is always available + state->dataUnitarySystems->unitarySys[0].m_fanAvailSched->currentVal = 1.0; // fan is always available // set secondary air mass flow rate to zero state->dataLoopNodes->Node(state->dataSingleDuct->SysATMixer(1).SecInNode).MassFlowRate = 0.0; @@ -1826,11 +1825,11 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTHP_ATMSupplySide) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(*state); // read schedules - InitializePsychRoutines(*state); + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + OutputReportPredefined::SetPredefinedTables(*state); GetZoneData(*state, ErrorsFound); @@ -1912,7 +1911,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTHP_ATMSupplySide) state->dataGlobal->SysSizingCalc = true; state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataZoneEnergyDemand->ZoneSysMoistureDemand.allocate(1); state->dataZoneEnergyDemand->ZoneSysMoistureDemand(1).RemainingOutputReqToDehumidSP = 0.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); @@ -1921,8 +1920,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTHP_ATMSupplySide) state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputRequired = -5000.0; QZnReq = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP; - state->dataScheduleMgr->Schedule(state->dataUnitarySystems->unitarySys[0].m_SysAvailSchedPtr).CurrentValue = 1.0; // unit is always available - state->dataScheduleMgr->Schedule(state->dataUnitarySystems->unitarySys[0].m_FanAvailSchedPtr).CurrentValue = 1.0; // fan is always available + state->dataUnitarySystems->unitarySys[0].m_sysAvailSched->currentVal = 1.0; // unit is always available + state->dataUnitarySystems->unitarySys[0].m_fanAvailSched->currentVal = 1.0; // fan is always available // set secondary air mass flow rate to zero state->dataLoopNodes->Node(state->dataSingleDuct->SysATMixer(1).SecInNode).MassFlowRate = 0.0; @@ -2521,6 +2520,9 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRF_ATMInletSide) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); // set input variables state->dataEnvrn->OutBaroPress = 101325.0; @@ -2529,11 +2531,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRF_ATMInletSide) state->dataEnvrn->OutEnthalpy = Psychrometrics::PsyHFnTdbW(state->dataEnvrn->OutDryBulbTemp, state->dataEnvrn->OutHumRat); state->dataEnvrn->StdRhoAir = 1.20; - state->dataGlobal->NumOfTimeStepInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(*state); // read schedules - InitializePsychRoutines(*state); + OutputReportPredefined::SetPredefinedTables(*state); GetZoneData(*state, ErrorsFound); @@ -2621,8 +2620,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRF_ATMInletSide) state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -5000.0; QZnReq = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; // unit is always available - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; // fan is always available + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).availSched->currentVal = 1.0; // unit is always available + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanAvailSched->currentVal = 1.0; // fan is always available // set secondary air mass flow rate to zero state->dataLoopNodes->Node(state->dataSingleDuct->SysATMixer(1).SecInNode).MassFlowRate = 0.0; @@ -3206,6 +3205,11 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRF_ATMSupplySide) ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + // set input variables before input processing state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->OutDryBulbTemp = 35.0; @@ -3213,11 +3217,6 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRF_ATMSupplySide) state->dataEnvrn->OutEnthalpy = Psychrometrics::PsyHFnTdbW(state->dataEnvrn->OutDryBulbTemp, state->dataEnvrn->OutHumRat); state->dataEnvrn->StdRhoAir = 1.20; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(*state); // read schedules - InitializePsychRoutines(*state); OutputReportPredefined::SetPredefinedTables(*state); GetZoneData(*state, ErrorsFound); @@ -3302,8 +3301,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRF_ATMSupplySide) state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -4000.0; QZnReq = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; // unit is always available - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; // fan is always available + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).availSched->currentVal = 1.0; // unit is always available + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanAvailSched->currentVal = 1.0; // fan is always available // set secondary air mass flow rate to zero state->dataLoopNodes->Node(state->dataSingleDuct->SysATMixer(1).SecInNode).MassFlowRate = 0.0; @@ -4978,10 +4977,11 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRFfluidCntrl_ATMInletSi ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(*state); // read schedules + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + OutputReportPredefined::SetPredefinedTables(*state); GetZoneData(*state, ErrorsFound); @@ -5075,8 +5075,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRFfluidCntrl_ATMInletSi state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -5000.0; QZnReq = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; // unit is always available - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; // fan is always available + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).availSched->currentVal = 1.0; // unit is always available + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanAvailSched->currentVal = 1.0; // fan is always available // set secondary air mass flow rate to zero state->dataLoopNodes->Node(state->dataSingleDuct->SysATMixer(1).SecInNode).MassFlowRate = 0.0; @@ -6756,11 +6756,11 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRFfluidCntrl_ATMSupplyS ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(*state); // read schedules - InitializePsychRoutines(*state); + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + OutputReportPredefined::SetPredefinedTables(*state); GetZoneData(*state, ErrorsFound); @@ -6851,8 +6851,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRFfluidCntrl_ATMSupplyS state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -4000.0; QZnReq = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; // unit is always available - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; // fan is always available + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).availSched->currentVal = 1.0; // unit is always available + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanAvailSched->currentVal = 1.0; // fan is always available state->dataHVACVarRefFlow->VRF(1).VRFCondCyclingRatio = 1.0; state->dataFans->fans(1)->set_size(*state); // add fan sizing @@ -7009,11 +7009,11 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimUnitVent_ATMInletSide) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(*state); // read schedules - InitializePsychRoutines(*state); + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + OutputReportPredefined::SetPredefinedTables(*state); GetZoneData(*state, ErrorsFound); @@ -7098,11 +7098,9 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimUnitVent_ATMInletSide) state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputRequired = 5000.0; state->dataUnitVentilators->QZnReq = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputRequired; - state->dataScheduleMgr->Schedule(state->dataUnitVentilators->UnitVent(UnitVentNum).SchedPtr).CurrentValue = 1.0; // unit is always available - state->dataScheduleMgr->Schedule(state->dataUnitVentilators->UnitVent(UnitVentNum).FanAvailSchedPtr).CurrentValue = - 1.0; // fan is always available - state->dataScheduleMgr->Schedule(state->dataUnitVentilators->UnitVent(UnitVentNum).MinOASchedPtr).CurrentValue = - 0.5; // min OA fraction is always available + state->dataUnitVentilators->UnitVent(UnitVentNum).availSched->currentVal = 1.0; // unit is always available + state->dataUnitVentilators->UnitVent(UnitVentNum).fanAvailSched->currentVal = 1.0; // fan is always available + state->dataUnitVentilators->UnitVent(UnitVentNum).minOASched->currentVal = 0.5; // min OA fraction is always available // set secondary air mass flow rate to zero state->dataLoopNodes->Node(state->dataSingleDuct->SysATMixer(1).SecInNode).MassFlowRate = 0.0; @@ -7257,11 +7255,11 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimUnitVent_ATMSupplySide) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(*state); // read schedules - InitializePsychRoutines(*state); + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + OutputReportPredefined::SetPredefinedTables(*state); GetZoneData(*state, ErrorsFound); @@ -7346,11 +7344,9 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimUnitVent_ATMSupplySide) state->dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).RemainingOutputRequired = 5000.0; QZnReq = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputRequired; - state->dataScheduleMgr->Schedule(state->dataUnitVentilators->UnitVent(UnitVentNum).SchedPtr).CurrentValue = 1.0; // unit is always available - state->dataScheduleMgr->Schedule(state->dataUnitVentilators->UnitVent(UnitVentNum).FanAvailSchedPtr).CurrentValue = - 1.0; // fan is always available - state->dataScheduleMgr->Schedule(state->dataUnitVentilators->UnitVent(UnitVentNum).MinOASchedPtr).CurrentValue = - 0.5; // min OA fraction is always available + state->dataUnitVentilators->UnitVent(UnitVentNum).availSched->currentVal = 1.0; // unit is always available + state->dataUnitVentilators->UnitVent(UnitVentNum).fanAvailSched->currentVal = 1.0; // fan is always available + state->dataUnitVentilators->UnitVent(UnitVentNum).minOASched->currentVal = 0.5; // min OA fraction is always available // set secondary air mass flow rate to zero state->dataLoopNodes->Node(state->dataSingleDuct->SysATMixer(1).SecInNode).MassFlowRate = 0.0; @@ -7513,6 +7509,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_GetInputDOASpecs) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -7703,22 +7701,21 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimFCU_ATMInletSideTest) int ZoneNum(1); int FanCoilNum(1); + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + state->dataSize->CurZoneEqNum = 1; + state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); state->dataWaterCoils->GetWaterCoilsInputFlag = true; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(*state); // read schedules - InitializePsychRoutines(*state); OutputReportPredefined::SetPredefinedTables(*state); GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; GetFanCoilUnits(*state); auto &thisFanCoil(state->dataFanCoilUnits->FanCoil(1)); @@ -7768,9 +7765,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimFCU_ATMInletSideTest) // chilled water plant loop auto &CWLoop(state->dataPlnt->PlantLoop(2)); CWLoop.Name = "ChilledWaterLoop"; - CWLoop.FluidName = "Water"; - CWLoop.FluidIndex = 1; CWLoop.FluidName = "WATER"; + CWLoop.glycol = Fluid::GetWater(*state); CWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = CWCoil.Name; CWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterCooling; CWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).NodeNumIn = CWCoil.WaterInletNodeNum; @@ -7785,9 +7781,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimFCU_ATMInletSideTest) // hot water plant loop auto &HWLoop(state->dataPlnt->PlantLoop(1)); HWLoop.Name = "HotWaterLoop"; - HWLoop.FluidName = "Water"; - HWLoop.FluidIndex = 1; HWLoop.FluidName = "WATER"; + HWLoop.glycol = Fluid::GetWater(*state); HWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = HWCoil.Name; HWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; HWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).NodeNumIn = HWCoil.WaterInletNodeNum; @@ -7810,7 +7805,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimFCU_ATMInletSideTest) state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); state->dataSize->ZoneEqSizing.allocate(1); auto &zoneEqSizing(state->dataSize->ZoneEqSizing(1)); @@ -7818,7 +7813,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimFCU_ATMInletSideTest) state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback(1) = false; state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataSize->ZoneSizingRunDone = true; state->dataSize->FinalZoneSizing.allocate(1); @@ -7949,14 +7944,6 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_FCU_NightCycleTest) std::string const idf_objects = delimited_string({ - " Schedule:Compact,", - " AlwaysOn, !- Name", - " Fraction, !- Schedule Type Limits Name", - " Through: 12/31, !- Field 1", - " For: AllDays, !- Field 2", - " Until: 24:00, !- Field 16", - " 1.0; !- Field 17", - " Schedule:Compact,", " FanAvailSched, !- Name", " Fraction, !- Schedule Type Limits Name", @@ -8050,7 +8037,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_FCU_NightCycleTest) " Fan:VariableVolume,", " FCU VarFan, !- Name", - " AlwaysOn, !- Availability Schedule Name", + " Constant-1.0, !- Availability Schedule Name", " 0.6045, !- Fan Total Efficiency", " 600.0, !- Pressure Rise {Pa}", " Autosize, !- Maximum Flow Rate {m3/s}", @@ -8070,7 +8057,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_FCU_NightCycleTest) " Coil:Cooling:Water,", " FCU Cooling Coil, !- Name", - " AlwaysOn, !- Availability Schedule Name", + " Constant-1.0, !- Availability Schedule Name", " Autosize, !- Design Water Flow Rate {m3/s}", " Autosize, !- Design Air Flow Rate {m3/s}", " Autosize, !- Design Inlet Water Temperature {C}", @@ -8087,7 +8074,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_FCU_NightCycleTest) " Coil:Heating:Water,", " FCU Heating Coil, !- Name", - " AlwaysOn, !- Availability Schedule Name", + " Constant-1.0, !- Availability Schedule Name", " Autosize, !- U-Factor Times Area Value {W/K}", " Autosize, !- Maximum Water Flow Rate {m3/s}", " Node 67, !- Water Inlet Node Name", @@ -8109,7 +8096,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_FCU_NightCycleTest) " AvailabilityManager:NightCycle,", " NightCycle AvailMgr, !- Name", - " AlwaysOn, !- Applicability Schedule Name", + " Constant-1.0, !- Applicability Schedule Name", " FanAvailSched, !- Fan Schedule Name", " CycleOnControlZone, !- Control Type", " 0.2, !- Thermostat Tolerance {deltaC}", @@ -8136,18 +8123,16 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_FCU_NightCycleTest) state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); state->dataWaterCoils->GetWaterCoilsInputFlag = true; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(*state); // read schedules - InitializePsychRoutines(*state); + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + OutputReportPredefined::SetPredefinedTables(*state); GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; GetFanCoilUnits(*state); Avail::GetSysAvailManagerInputs(*state); @@ -8200,9 +8185,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_FCU_NightCycleTest) // chilled water plant loop auto &CWLoop(state->dataPlnt->PlantLoop(2)); CWLoop.Name = "ChilledWaterLoop"; - CWLoop.FluidName = "Water"; - CWLoop.FluidIndex = 1; CWLoop.FluidName = "WATER"; + CWLoop.glycol = Fluid::GetWater(*state); CWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = CWCoil.Name; CWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterCooling; CWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).NodeNumIn = CWCoil.WaterInletNodeNum; @@ -8217,9 +8201,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_FCU_NightCycleTest) // hot water plant loop auto &HWLoop(state->dataPlnt->PlantLoop(1)); HWLoop.Name = "HotWaterLoop"; - HWLoop.FluidName = "Water"; - HWLoop.FluidIndex = 1; HWLoop.FluidName = "WATER"; + HWLoop.glycol = Fluid::GetWater(*state); HWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = HWCoil.Name; HWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; HWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).NodeNumIn = HWCoil.WaterInletNodeNum; @@ -8242,7 +8225,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_FCU_NightCycleTest) state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); state->dataSize->ZoneEqSizing.allocate(1); auto &zoneEqSizing(state->dataSize->ZoneEqSizing(1)); @@ -8250,7 +8233,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_FCU_NightCycleTest) state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback(1) = false; state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataSize->ZoneSizingRunDone = true; state->dataSize->FinalZoneSizing.allocate(1); diff --git a/tst/EnergyPlus/unit/AirTerminalSingleDuctPIUReheat.unit.cc b/tst/EnergyPlus/unit/AirTerminalSingleDuctPIUReheat.unit.cc index 615b8a1176a..86898202662 100644 --- a/tst/EnergyPlus/unit/AirTerminalSingleDuctPIUReheat.unit.cc +++ b/tst/EnergyPlus/unit/AirTerminalSingleDuctPIUReheat.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -67,7 +67,6 @@ using namespace EnergyPlus::DataEnvironment; using namespace EnergyPlus::DataZoneEquipment; using namespace EnergyPlus::HeatBalanceManager; using namespace EnergyPlus::PoweredInductionUnits; -using namespace EnergyPlus::ScheduleManager; using namespace EnergyPlus::SimulationManager; using namespace EnergyPlus::ZoneAirLoopEquipmentManager; @@ -176,9 +175,9 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctSeriesPIUReheat_GetInputtest) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(*state); // read schedules + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -286,9 +285,9 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctSeriesPIU_SetADUInletNodeTest) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(*state); // read schedules + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); diff --git a/tst/EnergyPlus/unit/AirflowNetworkComponents.unit.cc b/tst/EnergyPlus/unit/AirflowNetworkComponents.unit.cc index 07854f82f6a..e2672b04e87 100644 --- a/tst/EnergyPlus/unit/AirflowNetworkComponents.unit.cc +++ b/tst/EnergyPlus/unit/AirflowNetworkComponents.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -478,8 +478,18 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestTriangularWindowWarning) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->afn->get_input(); std::string const error_string = delimited_string({ + " ** Warning ** ProcessScheduleInput: Schedule:Constant = ONSCH", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = AULA PEOPLE SCHED", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = SEMPRE 21", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", " ** Warning ** AirflowNetwork::Solver::get_input: AirflowNetwork:MultiZone:Surface=\"WINDOW1\".", " ** ~~~ ** The opening is a Triangular subsurface. A rectangular subsurface will be used with equivalent width and height.", }); @@ -1859,13 +1869,14 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_UserDefinedDuctViewFactors) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // Read objects HeatBalanceManager::GetHeatBalanceInput(*state); HeatBalanceManager::AllocateHeatBalArrays(*state); state->dataEnvrn->OutBaroPress = 101000; state->dataHVACGlobal->TimeStepSys = state->dataGlobal->TimeStepZone; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; // Read AirflowNetwork inputs state->afn->get_input(); @@ -2441,6 +2452,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestPolygonalWindows) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->afn->get_input(); @@ -4373,6 +4385,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestFanModel) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataIPShortCut->lNumericFieldBlanks.allocate(1000); state->dataIPShortCut->lAlphaFieldBlanks.allocate(1000); @@ -4410,20 +4423,20 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestFanModel) // Read AirflowNetwork inputs state->afn->get_input(); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(2).CurrentValue = 100.0; - state->dataScheduleMgr->Schedule(3).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(4).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(5).CurrentValue = 0.1; - state->dataScheduleMgr->Schedule(6).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(7).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(8).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(9).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(10).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(11).CurrentValue = 21.0; - state->dataScheduleMgr->Schedule(12).CurrentValue = 25.0; - state->dataScheduleMgr->Schedule(13).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(14).CurrentValue = 1.0; + Sched::GetSchedule(*state, "WINDOWVENTSCHED")->currentVal = 1.0; + Sched::GetSchedule(*state, "ACTIVITY SCH")->currentVal = 100.0; + Sched::GetSchedule(*state, "WORK EFF SCH")->currentVal = 1.0; + Sched::GetSchedule(*state, "CLOTHING SCH")->currentVal = 1.0; + Sched::GetSchedule(*state, "AIR VELO SCH")->currentVal = 0.1; + Sched::GetSchedule(*state, "HOUSE OCCUPANCY")->currentVal = 1.0; + Sched::GetSchedule(*state, "INTERMITTENT")->currentVal = 1.0; + Sched::GetSchedule(*state, "HOUSE LIGHTING")->currentVal = 1.0; + Sched::GetSchedule(*state, "REPORTSCH")->currentVal = 1.0; + Sched::GetSchedule(*state, "HVACAVAILSCHED")->currentVal = 1.0; + Sched::GetSchedule(*state, "DUAL HEATING SETPOINTS")->currentVal = 21.0; + Sched::GetSchedule(*state, "DUAL COOLING SETPOINTS")->currentVal = 25.0; + Sched::GetSchedule(*state, "DUAL ZONE CONTROL TYPE SCHED")->currentVal = 1.0; + Sched::GetSchedule(*state, "CYCLINGFANSCHEDULE")->currentVal = 1.0; state->afn->AirflowNetworkFanActivated = true; state->dataEnvrn->OutDryBulbTemp = -17.29025; diff --git a/tst/EnergyPlus/unit/AirflowNetworkConditions.unit.cc b/tst/EnergyPlus/unit/AirflowNetworkConditions.unit.cc index 1d142e5d7b6..fb020f3bc32 100644 --- a/tst/EnergyPlus/unit/AirflowNetworkConditions.unit.cc +++ b/tst/EnergyPlus/unit/AirflowNetworkConditions.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -76,7 +76,6 @@ using namespace AirflowNetwork; using namespace DataSurfaces; using namespace DataHeatBalance; using namespace EnergyPlus::DataLoopNode; -using namespace EnergyPlus::ScheduleManager; namespace EnergyPlus { @@ -161,6 +160,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestDefaultBehaviourOfSimulationControl }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->afn->get_input(); // MultizoneZoneData has only 1 element so may be hardcoded @@ -216,7 +216,7 @@ TEST_F(EnergyPlusFixture, AirflowNetworkSimulationControl_DefaultSolver) state->dataHeatBal->People.allocate(state->dataHeatBal->TotPeople); state->dataHeatBal->People(1).ZonePtr = 1; state->dataHeatBal->People(1).NumberOfPeople = 100.0; - state->dataHeatBal->People(1).NumberOfPeoplePtr = 1; // From dataglobals, always returns a 1 for schedule value + state->dataHeatBal->People(1).sched = Sched::GetScheduleAlwaysOn(*state); // From dataglobals, always returns a 1 for schedule value state->dataHeatBal->People(1).AdaptiveCEN15251 = true; std::string const idf_objects = delimited_string({ @@ -267,7 +267,7 @@ TEST_F(EnergyPlusFixture, AirflowNetworkSimulationControl_DefaultSolver) }); ASSERT_TRUE(process_idf(idf_objects)); - + state->init_state(*state); state->afn->get_input(); EXPECT_ENUM_EQ(AirflowNetwork::SimulationControl::Solver::SkylineLU, state->afn->simulation_control.solver); @@ -312,7 +312,7 @@ TEST_F(EnergyPlusFixture, AirflowNetworkSimulationControl_SetSolver) state->dataHeatBal->People.allocate(state->dataHeatBal->TotPeople); state->dataHeatBal->People(1).ZonePtr = 1; state->dataHeatBal->People(1).NumberOfPeople = 100.0; - state->dataHeatBal->People(1).NumberOfPeoplePtr = 1; // From dataglobals, always returns a 1 for schedule value + state->dataHeatBal->People(1).sched = Sched::GetScheduleAlwaysOn(*state); // From dataglobals, always returns a 1 for schedule value state->dataHeatBal->People(1).AdaptiveCEN15251 = true; std::string const idf_objects = delimited_string({ @@ -365,6 +365,7 @@ TEST_F(EnergyPlusFixture, AirflowNetworkSimulationControl_SetSolver) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->afn->get_input(); @@ -509,6 +510,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestWindPressureTable) // Load and verify the table ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); EXPECT_EQ(0, state->dataCurveManager->NumCurves); Curve::GetCurveInput(*state); state->dataCurveManager->GetCurvesInputFlag = false; @@ -592,6 +594,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestWPCValue) // Load and verify the table ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); EXPECT_EQ(0, state->dataCurveManager->NumCurves); Curve::GetCurveInput(*state); state->dataCurveManager->GetCurvesInputFlag = false; @@ -1598,6 +1601,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestExternalNodes) "ZoneAirHeatBalanceAlgorithm,", " AnalyticalSolution; !- Algorithm"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool errors = false; @@ -2322,6 +2326,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestExternalNodesWithTables) "ZoneAirHeatBalanceAlgorithm,", " AnalyticalSolution; !- Algorithm"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool errors = false; @@ -2965,6 +2970,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestExternalNodesWithNoInput) "ZoneAirHeatBalanceAlgorithm,", " AnalyticalSolution; !- Algorithm"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool errors = false; @@ -3674,6 +3680,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestExternalNodesWithSymmetricTable) "ZoneAirHeatBalanceAlgorithm,", " AnalyticalSolution; !- Algorithm"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool errors = false; @@ -4328,6 +4335,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestExternalNodesWithSymmetricCurve) "ZoneAirHeatBalanceAlgorithm,", " AnalyticalSolution; !- Algorithm"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool errors = false; @@ -5063,6 +5071,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestExternalNodesWithLocalAirNode) "ZoneAirHeatBalanceAlgorithm,", " AnalyticalSolution; !- Algorithm"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // Set up some environmental parameters state->dataEnvrn->OutBaroPress = 101325.0; @@ -5076,7 +5085,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestExternalNodesWithLocalAirNode) HeatBalanceManager::GetHeatBalanceInput(*state); HeatBalanceManager::AllocateHeatBalArrays(*state); state->dataHVACGlobal->TimeStepSys = state->dataGlobal->TimeStepZone; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; Curve::GetCurveInput(*state); EXPECT_EQ(state->dataCurveManager->NumCurves, 2); @@ -5541,6 +5550,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_BasicAdvancedSingleSided) -0.56146269488642231}; ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool errors = false; @@ -5996,6 +6006,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_BasicAdvancedSingleSidedAvoidCrashTest) -0.56146269488642231}; ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool errors = false; diff --git a/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc b/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc index 54e70f64c19..c1126bc9850 100644 --- a/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc +++ b/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -97,7 +97,6 @@ using namespace AirflowNetwork; using namespace DataSurfaces; using namespace DataHeatBalance; using namespace EnergyPlus::DataLoopNode; -using namespace EnergyPlus::ScheduleManager; using namespace OutAirNodeManager; using namespace EnergyPlus::Fans; using namespace EnergyPlus::HVACStandAloneERV; @@ -198,12 +197,13 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestZoneVentingSch) }); ASSERT_TRUE(process_idf(idf_objects)); + + state->init_state(*state); state->afn->get_input(); // MultizoneZoneData has only 1 element so may be hardcoded - auto GetIndex = Util::FindItemInList(state->afn->MultizoneZoneData(1).VentingSchName, - state->dataScheduleMgr->Schedule({1, state->dataScheduleMgr->NumSchedules})); - EXPECT_EQ(GetIndex, state->afn->MultizoneZoneData(1).VentingSchNum); + auto *ventingSched = Sched::GetSchedule(*state, state->afn->MultizoneZoneData(1).VentAvailSchName); + EXPECT_EQ(ventingSched, state->afn->MultizoneZoneData(1).ventAvailSched); state->dataHeatBal->Zone.deallocate(); state->dataSurface->Surface.deallocate(); @@ -2116,10 +2116,9 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestPressureStat) state->dataIPShortCut->cAlphaArgs = " "; state->dataIPShortCut->rNumericArgs = 0.0; + state->init_state(*state); bool ErrorsFound = false; // Read objects - HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); - EXPECT_FALSE(ErrorsFound); HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); Material::GetWindowGlassSpectralData(*state, ErrorsFound); @@ -2141,20 +2140,11 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestPressureStat) Real64 PressureSet = 0.5; - state->dataScheduleMgr - ->Schedule(Util::FindItemInList("PRESSURE SETPOINT SCHEDULE", state->dataScheduleMgr->Schedule({1, state->dataScheduleMgr->NumSchedules}))) - .CurrentValue = PressureSet; // Pressure setpoint - state->dataScheduleMgr - ->Schedule(Util::FindItemInList("FANANDCOILAVAILSCHED", state->dataScheduleMgr->Schedule({1, state->dataScheduleMgr->NumSchedules}))) - .CurrentValue = 1.0; // set availability and fan schedule to 1 - state->dataScheduleMgr->Schedule(Util::FindItemInList("ON", state->dataScheduleMgr->Schedule({1, state->dataScheduleMgr->NumSchedules}))) - .CurrentValue = 1.0; // On - state->dataScheduleMgr - ->Schedule(Util::FindItemInList("VENTINGSCHED", state->dataScheduleMgr->Schedule({1, state->dataScheduleMgr->NumSchedules}))) - .CurrentValue = 25.55; // VentingSched - state->dataScheduleMgr - ->Schedule(Util::FindItemInList("WINDOWVENTSCHED", state->dataScheduleMgr->Schedule({1, state->dataScheduleMgr->NumSchedules}))) - .CurrentValue = 1.0; // WindowVentSched + Sched::GetSchedule(*state, "PRESSURE SETPOINT SCHEDULE")->currentVal = PressureSet; // Pressure setpoint + Sched::GetSchedule(*state, "FANANDCOILAVAILSCHED")->currentVal = 1.0; // set availability and fan schedule to 1 + Sched::GetSchedule(*state, "ON")->currentVal = 1.0; // On + Sched::GetSchedule(*state, "VENTINGSCHED")->currentVal = 25.55; // VentingSched + Sched::GetSchedule(*state, "WINDOWVENTSCHED")->currentVal = 1.0; // WindowVentSched state->afn->AirflowNetworkFanActivated = true; state->dataEnvrn->OutDryBulbTemp = -17.29025; @@ -2260,7 +2250,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestPressureStat) state->dataZoneEquip->ZoneEquipConfig(3).IsControlled = false; state->dataZoneEquip->ZoneEquipConfig(4).IsControlled = false; state->dataHVACGlobal->TimeStepSys = 0.1; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->afn->AirflowNetworkLinkSimu(1).FLOW2 = 0.1; state->afn->AirflowNetworkLinkSimu(10).FLOW2 = 0.15; @@ -2293,42 +2283,8 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestPressureStat) TEST_F(EnergyPlusFixture, AirflowNetwork_TestZoneVentingSchWithAdaptiveCtrl) { - // Unit test for #5490 - state->dataHeatBal->Zone.allocate(1); - state->dataHeatBal->Zone(1).Name = "SOFF"; - - state->dataSurface->Surface.allocate(2); - state->dataSurface->Surface(1).Name = "WINDOW 1"; - state->dataSurface->Surface(1).Zone = 1; - state->dataSurface->Surface(1).ZoneName = "SOFF"; - state->dataSurface->Surface(1).Azimuth = 0.0; - state->dataSurface->Surface(1).ExtBoundCond = 0; - state->dataSurface->Surface(1).HeatTransSurf = true; - state->dataSurface->Surface(1).Tilt = 90.0; - state->dataSurface->Surface(1).Sides = 4; - state->dataSurface->Surface(2).Name = "WINDOW 2"; - state->dataSurface->Surface(2).Zone = 1; - state->dataSurface->Surface(2).ZoneName = "SOFF"; - state->dataSurface->Surface(2).Azimuth = 180.0; - state->dataSurface->Surface(2).ExtBoundCond = 0; - state->dataSurface->Surface(2).HeatTransSurf = true; - state->dataSurface->Surface(2).Tilt = 90.0; - state->dataSurface->Surface(2).Sides = 4; - - SurfaceGeometry::AllocateSurfaceWindows(*state, 2); - state->dataSurface->Surface(1).OriginalClass = DataSurfaces::SurfaceClass::Window; - state->dataSurface->Surface(2).OriginalClass = DataSurfaces::SurfaceClass::Window; - state->dataGlobal->NumOfZones = 1; - - state->dataHeatBal->TotPeople = 1; // Total number of people statements - state->dataHeatBal->People.allocate(state->dataHeatBal->TotPeople); - state->dataHeatBal->People(1).ZonePtr = 1; - state->dataHeatBal->People(1).NumberOfPeople = 100.0; - state->dataHeatBal->People(1).NumberOfPeoplePtr = 1; // From dataglobals, always returns a 1 for schedule value - state->dataHeatBal->People(1).AdaptiveCEN15251 = true; - std::string const idf_objects = delimited_string({ "Schedule:Constant,OnSch,,1.0;", "Schedule:Constant,FreeRunningSeason,,0.0;", @@ -2377,6 +2333,41 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestZoneVentingSchWithAdaptiveCtrl) }); ASSERT_TRUE(process_idf(idf_objects)); + // Have to do this up-front + state->init_state(*state); + + state->dataHeatBal->Zone.allocate(1); + state->dataHeatBal->Zone(1).Name = "SOFF"; + + state->dataSurface->Surface.allocate(2); + state->dataSurface->Surface(1).Name = "WINDOW 1"; + state->dataSurface->Surface(1).Zone = 1; + state->dataSurface->Surface(1).ZoneName = "SOFF"; + state->dataSurface->Surface(1).Azimuth = 0.0; + state->dataSurface->Surface(1).ExtBoundCond = 0; + state->dataSurface->Surface(1).HeatTransSurf = true; + state->dataSurface->Surface(1).Tilt = 90.0; + state->dataSurface->Surface(1).Sides = 4; + state->dataSurface->Surface(2).Name = "WINDOW 2"; + state->dataSurface->Surface(2).Zone = 1; + state->dataSurface->Surface(2).ZoneName = "SOFF"; + state->dataSurface->Surface(2).Azimuth = 180.0; + state->dataSurface->Surface(2).ExtBoundCond = 0; + state->dataSurface->Surface(2).HeatTransSurf = true; + state->dataSurface->Surface(2).Tilt = 90.0; + state->dataSurface->Surface(2).Sides = 4; + + SurfaceGeometry::AllocateSurfaceWindows(*state, 2); + state->dataSurface->Surface(1).OriginalClass = DataSurfaces::SurfaceClass::Window; + state->dataSurface->Surface(2).OriginalClass = DataSurfaces::SurfaceClass::Window; + state->dataGlobal->NumOfZones = 1; + + state->dataHeatBal->TotPeople = 1; // Total number of people statements + state->dataHeatBal->People.allocate(state->dataHeatBal->TotPeople); + state->dataHeatBal->People(1).ZonePtr = 1; + state->dataHeatBal->People(1).NumberOfPeople = 100.0; + state->dataHeatBal->People(1).sched = Sched::GetScheduleAlwaysOn(*state); // From dataglobals, always returns a 1 for schedule value + state->dataHeatBal->People(1).AdaptiveCEN15251 = true; state->afn->get_input(); @@ -2384,9 +2375,8 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestZoneVentingSchWithAdaptiveCtrl) // changed index 2 to 1 because in new sorted scheedule MultizoneZone(1).VentingSchName ("FREERUNNINGSEASON") // has index 1 which is the .VentSchNum - auto GetIndex = Util::FindItemInList(state->afn->MultizoneZoneData(1).VentingSchName, - state->dataScheduleMgr->Schedule({1, state->dataScheduleMgr->NumSchedules})); - EXPECT_EQ(GetIndex, state->afn->MultizoneZoneData(1).VentingSchNum); + auto *ventingSched = Sched::GetSchedule(*state, state->afn->MultizoneZoneData(1).VentAvailSchName); + EXPECT_EQ(ventingSched, state->afn->MultizoneZoneData(1).ventAvailSched); state->dataHeatBal->Zone.deallocate(); state->dataSurface->Surface.deallocate(); @@ -5925,10 +5915,10 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_MultiAirLoopTest) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + bool ErrorsFound = false; // Read objects - HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); - EXPECT_FALSE(ErrorsFound); HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); Material::GetWindowGlassSpectralData(*state, ErrorsFound); @@ -5950,12 +5940,12 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_MultiAirLoopTest) Real64 PresssureSet = 0.5; // Assign values - state->dataScheduleMgr->Schedule(1).CurrentValue = 25.55; // WindowVentSched - state->dataScheduleMgr->Schedule(9).CurrentValue = 1.0; // FanAndCoilAvailSched - state->dataScheduleMgr->Schedule(14).CurrentValue = 1.0; // VentingSched - state->dataScheduleMgr->Schedule(16).CurrentValue = PresssureSet; // Pressure setpoint - state->dataScheduleMgr->Schedule(17).CurrentValue = 1.0; // HVACTemplate-Always 1 - state->dataScheduleMgr->Schedule(18).CurrentValue = 0.0; // HVACTemplate-Always 0 + Sched::GetSchedule(*state, "WINDOWVENTSCHED")->currentVal = 25.55; // WindowVentSched + Sched::GetSchedule(*state, "FANANDCOILAVAILSCHED")->currentVal = 1.0; // FanAndCoilAvailSched + Sched::GetSchedule(*state, "VENTINGSCHED")->currentVal = 1.0; // VentingSched + Sched::GetSchedule(*state, "PRESSURE SETPOINT SCHEDULE")->currentVal = PresssureSet; // Pressure setpoint + Sched::GetSchedule(*state, "HVACTEMPLATE-ALWAYS 1")->currentVal = 1.0; // HVACTemplate-Always 1 + Sched::GetSchedule(*state, "HVACTEMPLATE-ALWAYS 0")->currentVal = 0.0; // HVACTemplate-Always 0 state->afn->AirflowNetworkFanActivated = true; state->dataEnvrn->OutDryBulbTemp = -17.29025; @@ -6052,7 +6042,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_MultiAirLoopTest) EXPECT_NEAR(state->afn->AirflowNetworkReportData(1).MultiZoneVentLatLossW, 0.969147, 0.001); // #8475 state->dataHVACGlobal->TimeStepSys = 0.1; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->dataHeatBal->Zone(1).Volume = 30.0; // Ventilation state->afn->update(); @@ -6100,6 +6090,102 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_CheckNumOfFansInAirLoopTest) EXPECT_TRUE(compare_err_stream(error_string, true)); } +TEST_F(EnergyPlusFixture, AirflowNetwork_ValidateDistCoils) +{ + std::string const idf_objects = delimited_string({ + + " Coil:Cooling:DX:VariableSpeed,", + " Super Coil, !- Name", + " Node_1, !- Indoor Air Inlet Node Name", + " Node_2, !- Indoor Air Outlet Node Name", + " 1, !- Number of Speeds {dimensionless}", + " 1, !- Nominal Speed Level {dimensionless}", + " autosize, !- Gross Rated Total Cooling Capacity At Selected Nominal Speed Level {W}", + " autosize, !- Rated Air Flow Rate At Selected Nominal Speed Level {m3/s}", + " , !- Nominal Time for Condensate to Begin Leaving the Coil {s}", + " , !- Initial Moisture Evaporation Rate Divided by Steady-State AC Latent Capacity {dimensionless}", + " , !- Maximum Cycling Rate {cycles/hr}", + " , !- Latent Capacity Time Constant {s}", + " , !- Fan Delay Time {s}", + " HPCOOLPLFFPLR, !- Energy Part Load Fraction Curve Name", + " , !- Condenser Air Inlet Node Name", + " AirCooled, !- Condenser Type", + " , !- Evaporative Condenser Pump Rated Power Consumption {W}", + " , !- Crankcase Heater Capacity {W}", + " , !- Crankcase Heater Capacity Function of Temperature Curve Name", + " 10, !- Maximum Outdoor Dry-Bulb Temperature for Crankcase Heater Operation {C}", + " -25, !- Minimum Outdoor Dry-Bulb Temperature for Compressor Operation {C}", + " , !- Supply Water Storage Tank Name", + " , !- Condensate Collection Water Storage Tank Name", + " , !- Basin Heater Capacity {W/K}", + " 2, !- Basin Heater Setpoint Temperature {C}", + " , !- Basin Heater Operating Schedule Name", + " 15000, !- Speed 1 Reference Unit Gross Rated Total Cooling Capacity {W}", + " 0.55, !- Speed 1 Reference Unit Gross Rated Sensible Heat Ratio {dimensionless}", + " 4.3, !- Speed 1 Reference Unit Gross Rated Cooling COP {W/W}", + " 0.05, !- Speed 1 Reference Unit Rated Air Flow Rate {m3/s}", + " , !- 2017 Speed 1 Rated Evaporator Fan Power Per Volume Flow Rate {W/(m3/s)}", + " , !- 2023 Speed 1 Rated Evaporator Fan Power Per Volume Flow Rate {W/(m3/s)}", + " , !- Speed 1 Reference Unit Rated Condenser Air Flow Rate {m3/s}", + " , !- Speed 1 Reference Unit Rated Pad Effectiveness of Evap Precooling {dimensionless}", + " HPCoolingCAPFTemp, !- Speed 1 Total Cooling Capacity Function of Temperature Curve Name", + " HPCoolingCAPFFF, !- Speed 1 Total Cooling Capacity Function of Air Flow Fraction Curve Name", + " HPCoolingEIRFTemp, !- Speed 1 Energy Input Ratio Function of Temperature Curve Name", + " HPCoolingEIRFFF; !- Speed 1 Energy Input Ratio Function of Air Flow Fraction Curve Name", + "", + " Coil:Heating:DX:VariableSpeed,", + " Super Heating Coil, !- Name", + " Node_1, !- Indoor Air Inlet Node Name", + " Node_2, !- Indoor Air Outlet Node Name", + " 1, !- Number of Speeds {dimensionless}", + " 1, !- Nominal Speed Level {dimensionless}", + " autosize, !- Rated Heating Capacity At Selected Nominal Speed Level {W}", + " autosize, !- Rated Air Flow Rate At Selected Nominal Speed Level {m3/s}", + " HPHEATPLFFPLR, !- Energy Part Load Fraction Curve Name", + " , !- Defrost Energy Input Ratio Function of Temperature Curve Name", + " -8, !- Minimum Outdoor Dry-Bulb Temperature for Compressor Operation {C}", + " , !- Outdoor Dry-Bulb Temperature to Turn On Compressor {C}", + " 5, !- Maximum Outdoor Dry-Bulb Temperature for Defrost Operation {C}", + " , !- Crankcase Heater Capacity {W}", + " , !- Crankcase Heater Capacity Function of Temperature Curve Name", + " 10, !- Maximum Outdoor Dry-Bulb Temperature for Crankcase Heater Operation {C}", + " ReverseCycle, !- Defrost Strategy", + " Timed, !- Defrost Control", + " 0.058333, !- Defrost Time Period Fraction", + " , !- Resistive Defrost Heater Capacity {W}", + " 17500, !- Speed 1 Reference Unit Gross Rated Heating Capacity {W}", + " 4.5, !- Speed 1 Reference Unit Gross Rated Heating COP {W/W}", + " 0.05, !- Speed 1 Reference Unit Rated Air Flow Rate {m3/s}", + " 773.3, !- 2017 Speed 1 Rated Supply Air Fan Power Per Volume Flow Rate {W/(m3/s)}", + " 934.4, !- 2023 Speed 1 Rated Supply Air Fan Power Per Volume Flow Rate {W/(m3/s)}", + " HPHeatingCAPFTemp, !- Speed 1 Heating Capacity Function of Temperature Curve Name", + " HPHeatingCAPFFF, !- Speed 1 Total Heating Capacity Function of Air Flow Fraction Curve Name", + " HPHeatingEIRFTemp, !- Speed 1 Energy Input Ratio Function of Temperature Curve Name", + " HPHeatingEIRFFF; !- Speed 1 Energy Input Ratio Function of Air Flow Fraction Curve Name ", + }); + + ASSERT_TRUE(process_idf(idf_objects)); + + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 2; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(2); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf = "Coil:Cooling:DX:VariableSpeed"; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "VariableSpeedCoolingCoil"; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).TypeOf = "Coil:Heating:DX:VariableSpeed"; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).Name = "VariableSpeedHeatingCoil"; + + state->afn->DisSysNumOfCoils = 2; + state->afn->DisSysCompCoilData.allocate(2); + state->afn->DisSysCompCoilData(1).EPlusType = "COIL:COOLING:DX:VARIABLESPEED"; + state->afn->DisSysCompCoilData(1).name = "Super Coil"; + state->afn->DisSysCompCoilData(2).EPlusType = "COIL:HEATING:DX:VARIABLESPEED"; + state->afn->DisSysCompCoilData(2).name = "Super Heating Coil"; + + state->afn->validate_distribution(); +} + // Missing an AirflowNetwork:Distribution:Node for the Zone Air Node TEST_F(EnergyPlusFixture, AirflowNetwork_CheckMultiZoneNodes_NoZoneNode) { @@ -7624,12 +7710,14 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_DuplicatedNodeNameTest) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + // Read objects HeatBalanceManager::GetHeatBalanceInput(*state); HeatBalanceManager::AllocateHeatBalArrays(*state); state->dataEnvrn->OutBaroPress = 101000; state->dataHVACGlobal->TimeStepSys = state->dataGlobal->TimeStepZone; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; // Read AirflowNetwork inputs ASSERT_THROW(state->afn->get_input(), std::runtime_error); @@ -10423,10 +10511,10 @@ TEST_F(EnergyPlusFixture, DISABLED_AirLoopNumTest) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + bool ErrorsFound = false; // Read objects - HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); - EXPECT_FALSE(ErrorsFound); HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); Material::GetWindowGlassSpectralData(*state, ErrorsFound); @@ -10615,27 +10703,38 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestZoneVentingAirBoundary) }); ASSERT_TRUE(process_idf(idf_objects)); + + state->init_state(*state); + state->afn->get_input(); // Expect warnings about the air boundary surface EXPECT_TRUE(has_err_output(false)); std::string const expectedErrString = delimited_string( - {" ** Warning ** AirflowNetwork::Solver::get_input: AirflowNetwork:MultiZone:Surface=\"AIR WALL AULA 2\" is an air boundary surface.", - " ** ~~~ ** Ventilation Control Mode = TEMPERATURE is not valid. Resetting to Constant.", + {" ** Warning ** ProcessScheduleInput: Schedule:Constant = ONSCH", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = AULA PEOPLE SCHED", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = SEMPRE 21", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", " ** Warning ** AirflowNetwork::Solver::get_input: AirflowNetwork:MultiZone:Surface=\"AIR WALL AULA 2\" is an air boundary surface.", - " ** ~~~ ** Venting Availability Schedule will be ignored, venting is always available."}); + " ** ~~~ ** Ventilation Control Mode = TEMPERATURE is not valid. Resetting to Constant.", + " ** Warning ** AirflowNetwork::Solver::get_input: : AirflowNetwork:MultiZone:Surface = AIR WALL AULA 2", + " ** ~~~ ** Venting Availbility Schedule is not empty.", + " ** ~~~ ** Venting is always available for air-boundary surfaces."}); EXPECT_TRUE(compare_err_stream(expectedErrString, true)); // MultizoneSurfaceData(1) is connected to a normal heat transfer surface - // venting schedule should be non-zero and venting method should be ZoneLevel - auto GetIndex = Util::FindItemInList(state->afn->MultizoneSurfaceData(1).VentingSchName, - state->dataScheduleMgr->Schedule({1, state->dataScheduleMgr->NumSchedules})); - EXPECT_GT(GetIndex, 0); - EXPECT_EQ(GetIndex, state->afn->MultizoneSurfaceData(1).VentingSchNum); + auto *ventingSched = Sched::GetSchedule(*state, state->afn->MultizoneSurfaceData(1).VentAvailSchName); + EXPECT_EQ(ventingSched, state->afn->MultizoneSurfaceData(1).ventAvailSched); EXPECT_ENUM_EQ(state->afn->MultizoneSurfaceData(1).VentSurfCtrNum, AirflowNetwork::VentControlType::Temp); // MultizoneSurfaceData(2) is connected to an air boundary surface // venting schedule should be zero and venting method should be Constant - EXPECT_EQ(0, state->afn->MultizoneSurfaceData(2).VentingSchNum); + EXPECT_EQ(state->afn->MultizoneSurfaceData(2).ventAvailSched, Sched::GetScheduleAlwaysOn(*state)); EXPECT_ENUM_EQ(state->afn->MultizoneSurfaceData(2).VentSurfCtrNum, AirflowNetwork::VentControlType::Const); } @@ -14083,12 +14182,11 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestIntraZoneLinkageZoneIndex) }); ASSERT_TRUE(process_idf(idf_objects)); - bool ErrorsFound = false; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); // Read objects - HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); - EXPECT_FALSE(ErrorsFound); + bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); ZoneEquipmentManager::GetZoneEquipment(*state); @@ -14105,18 +14203,29 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestIntraZoneLinkageZoneIndex) state->dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; SurfaceGeometry::GetSurfaceData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->Schedule(6).MinValue = 0.0; - state->dataScheduleMgr->Schedule(6).MaxValue = 2.0; - state->dataScheduleMgr->DaySchedule(1).TSValue = 150; - state->dataScheduleMgr->DaySchedule(1).TSValMax = 200; - state->dataScheduleMgr->DaySchedule(1).TSValMin = 0; - state->dataScheduleMgr->DaySchedule(2).TSValue = 1.0; - state->dataScheduleMgr->DaySchedule(3).TSValue = 1.0; - state->dataScheduleMgr->Schedule(2).MinValue = 0.0; - state->dataScheduleMgr->Schedule(2).MaxValue = 1.0; - state->dataScheduleMgr->Schedule(3).MinValue = 0.0; - state->dataScheduleMgr->Schedule(3).MaxValue = 1.0; + + auto *officeOccSched = Sched::GetSchedule(*state, "OFFICE OCCUPANCY"); + officeOccSched->minVal = 0.0; + officeOccSched->maxVal = 2.0; + + auto *activityDay1Sched = Sched::GetDaySchedule(*state, "ACTIVITY SCH_DY_1"); + std::fill(activityDay1Sched->tsVals.begin(), activityDay1Sched->tsVals.end(), 150); + activityDay1Sched->maxVal = 200; + activityDay1Sched->minVal = 0; + + auto *workEffDay1Sched = Sched::GetDaySchedule(*state, "WORK EFF SCH_DY_1"); + std::fill(workEffDay1Sched->tsVals.begin(), workEffDay1Sched->tsVals.end(), 1.0); + + auto *workEffSched = Sched::GetSchedule(*state, "WORK EFF SCH"); + workEffSched->minVal = 0.0; + workEffSched->maxVal = 1.0; + + auto *clothingDay1Sched = Sched::GetDaySchedule(*state, "CLOTHING SCH_DY_1"); + std::fill(clothingDay1Sched->tsVals.begin(), clothingDay1Sched->tsVals.end(), 1.0); + + auto *clothingSched = Sched::GetSchedule(*state, "CLOTHING SCH"); + clothingSched->minVal = 0.0; + clothingSched->maxVal = 1.0; InternalHeatGains::GetInternalHeatGainsInput(*state); HeatBalanceAirManager::GetRoomAirModelParameters(*state, ErrorsFound); @@ -14256,9 +14365,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestReferenceConditionsLeftBlank) ASSERT_TRUE(process_idf(idf_objects)); - ErrorsFound = false; - HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); - EXPECT_FALSE(ErrorsFound); + state->init_state(*state); ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); @@ -14275,8 +14382,8 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestReferenceConditionsLeftBlank) ErrorsFound = false; state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; SurfaceGeometry::GetSurfaceData(*state, ErrorsFound); @@ -16210,10 +16317,9 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_DuctSizingTest) state->dataIPShortCut->cAlphaArgs = " "; state->dataIPShortCut->rNumericArgs = 0.0; + state->init_state(*state); bool ErrorsFound = false; // Read objects - HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); - EXPECT_FALSE(ErrorsFound); HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); Material::GetWindowGlassSpectralData(*state, ErrorsFound); @@ -16233,20 +16339,20 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_DuctSizingTest) // Read AirflowNetwork inputs state->afn->get_input(); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(2).CurrentValue = 100.0; - state->dataScheduleMgr->Schedule(3).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(4).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(5).CurrentValue = 0.1; - state->dataScheduleMgr->Schedule(6).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(7).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(8).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(9).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(10).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(11).CurrentValue = 21.0; - state->dataScheduleMgr->Schedule(12).CurrentValue = 25.0; - state->dataScheduleMgr->Schedule(13).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(14).CurrentValue = 1.0; + Sched::GetSchedule(*state, "WINDOWVENTSCHED")->currentVal = 1.0; + Sched::GetSchedule(*state, "ACTIVITY SCH")->currentVal = 100.0; + Sched::GetSchedule(*state, "WORK EFF SCH")->currentVal = 1.0; + Sched::GetSchedule(*state, "CLOTHING SCH")->currentVal = 1.0; + Sched::GetSchedule(*state, "AIR VELO SCH")->currentVal = 0.1; + Sched::GetSchedule(*state, "HOUSE OCCUPANCY")->currentVal = 1.0; + Sched::GetSchedule(*state, "INTERMITTENT")->currentVal = 1.0; + Sched::GetSchedule(*state, "HOUSE LIGHTING")->currentVal = 1.0; + Sched::GetSchedule(*state, "REPORTSCH")->currentVal = 1.0; + Sched::GetSchedule(*state, "HVACAVAILSCHED")->currentVal = 1.0; + Sched::GetSchedule(*state, "DUAL HEATING SETPOINTS")->currentVal = 21.0; + Sched::GetSchedule(*state, "DUAL COOLING SETPOINTS")->currentVal = 25.0; + Sched::GetSchedule(*state, "DUAL ZONE CONTROL TYPE SCHED")->currentVal = 1.0; + Sched::GetSchedule(*state, "CYCLINGFANSCHEDULE")->currentVal = 1.0; state->afn->AirflowNetworkFanActivated = true; state->dataEnvrn->OutDryBulbTemp = -17.29025; @@ -16392,6 +16498,8 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_CheckMultistageHeatingCoil) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + state->dataGlobal->NumOfZones = 1; state->dataHeatBal->Zone.allocate(1); state->dataHeatBal->Zone(1).Name = "ATTIC ZONE"; @@ -19821,6 +19929,8 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_ZoneOrderTest) state->dataGlobal->DDOnlySimulation = true; + state->init_state(*state); + SimulationManager::ManageSimulation(*state); // run the design day over the warmup period (24 hrs, 25 days) // Crawlspace_Unit1 diff --git a/tst/EnergyPlus/unit/Autosizing/All_Simple_Sizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/All_Simple_Sizing.unit.cc index b5a72264232..11907447a7e 100644 --- a/tst/EnergyPlus/unit/Autosizing/All_Simple_Sizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/All_Simple_Sizing.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/Autosizing/AutosizingFixture.hh b/tst/EnergyPlus/unit/Autosizing/AutosizingFixture.hh index 35a419cea7e..6603d721d45 100644 --- a/tst/EnergyPlus/unit/Autosizing/AutosizingFixture.hh +++ b/tst/EnergyPlus/unit/Autosizing/AutosizingFixture.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/Autosizing/BaseClassSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/BaseClassSizing.unit.cc index e15bf616142..91be4c4d767 100644 --- a/tst/EnergyPlus/unit/Autosizing/BaseClassSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/BaseClassSizing.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -288,8 +288,10 @@ TEST_F(EnergyPlusFixture, BaseSizer_GetCoilDesFlowT_NoPeak) EXPECT_DOUBLE_EQ(state->dataSize->FinalSysSizing(1).CoolSupTemp, designExitTemp); EXPECT_DOUBLE_EQ(0.002, designFlowValue); } + TEST_F(EnergyPlusFixture, BaseSizer_RequestSizingSystem) { + state->init_state(*state); std::string CompName; // component name std::string CompType; // component type @@ -325,7 +327,6 @@ TEST_F(EnergyPlusFixture, BaseSizer_RequestSizingSystem) state->dataEnvrn->StdBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.1583684; - InitializePsychRoutines(*state); state->dataSize->DataFlowUsedForSizing = state->dataSize->FinalSysSizing(state->dataSize->CurSysNum).DesCoolVolFlow; // Need this to prevent crash in Sizers @@ -437,6 +438,7 @@ TEST_F(EnergyPlusFixture, BaseSizer_RequestSizingSystemWithFans) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Fans::GetFanInput(*state); state->dataSize->CurZoneEqNum = 0; @@ -502,7 +504,6 @@ TEST_F(EnergyPlusFixture, BaseSizer_RequestSizingSystemWithFans) state->dataEnvrn->StdBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.1583684; - InitializePsychRoutines(*state); state->dataSize->DataFlowUsedForSizing = state->dataSize->FinalSysSizing(state->dataSize->CurSysNum).DesCoolVolFlow; // Need this to prevent crash in Sizers @@ -571,6 +572,7 @@ TEST_F(EnergyPlusFixture, BaseSizer_RequestSizingSystemWithFans) TEST_F(EnergyPlusFixture, BaseSizer_RequestSizingZone) { + state->init_state(*state); int constexpr ZoneNum = 1; std::string CompName; // component name std::string CompType; // component type @@ -597,7 +599,6 @@ TEST_F(EnergyPlusFixture, BaseSizer_RequestSizingZone) state->dataSize->ZoneSizingRunDone = true; state->dataEnvrn->StdBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.1583684; - InitializePsychRoutines(*state); // Need this to prevent crash in Sizers state->dataSize->ZoneEqSizing.allocate(1); @@ -911,8 +912,8 @@ TEST_F(EnergyPlusFixture, BaseSizer_FanPeak) { // This is needed to compute time of Peak as a string - state->dataGlobal->NumOfTimeStepInHour = 4; - state->dataGlobal->MinutesPerTimeStep = 15; + state->dataGlobal->TimeStepsInHour = 4; + state->dataGlobal->MinutesInTimeStep = 15; // Setup the predefined tables, because that's where the info is written. EnergyPlus::OutputReportPredefined::SetPredefinedTables(*state); @@ -1472,6 +1473,7 @@ TEST_F(EnergyPlusFixture, BaseSizer_SupplyAirTempLessThanZoneTStatTest) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); SimulationManager::ManageSimulation(*state); int CtrlZoneNum(1); diff --git a/tst/EnergyPlus/unit/Autosizing/CoolingAirFlowSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/CoolingAirFlowSizing.unit.cc index 1956e7e6459..bc48e5a5878 100644 --- a/tst/EnergyPlus/unit/Autosizing/CoolingAirFlowSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/CoolingAirFlowSizing.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -123,8 +123,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) state->dataSize->FinalZoneSizing(1).HeatDDNum = 2; state->dataSize->FinalZoneSizing(1).TimeStepNumAtCoolMax = 12; state->dataSize->FinalZoneSizing(1).TimeStepNumAtHeatMax = 6; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; state->dataEnvrn->TotDesDays = 2; state->dataWeather->DesDayInput.allocate(2); state->dataWeather->DesDayInput(1).Month = 7; diff --git a/tst/EnergyPlus/unit/Autosizing/CoolingCapacitySizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/CoolingCapacitySizing.unit.cc index 90037ebe079..412ee1544c3 100644 --- a/tst/EnergyPlus/unit/Autosizing/CoolingCapacitySizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/CoolingCapacitySizing.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -80,6 +80,8 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + state->dataEnvrn->StdRhoAir = 1.2; // call simulate to trigger sizing call Fans::GetFanInput(*state); diff --git a/tst/EnergyPlus/unit/Autosizing/CoolingSHRSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/CoolingSHRSizing.unit.cc index 604fe454445..6a4e42bbd3d 100644 --- a/tst/EnergyPlus/unit/Autosizing/CoolingSHRSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/CoolingSHRSizing.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirInletHumRatSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirInletHumRatSizing.unit.cc index 08e9164d6c3..c876948f0ad 100644 --- a/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirInletHumRatSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirInletHumRatSizing.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirInletTempSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirInletTempSizing.unit.cc index a536476b8f4..1f2b8b0b17b 100644 --- a/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirInletTempSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirInletTempSizing.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirOutletHumRatSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirOutletHumRatSizing.unit.cc index 94688132b27..f71ac717b46 100644 --- a/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirOutletHumRatSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirOutletHumRatSizing.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirOutletTempSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirOutletTempSizing.unit.cc index 993b0e623c1..425e1aeb2e8 100644 --- a/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirOutletTempSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirOutletTempSizing.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -60,7 +60,7 @@ namespace EnergyPlus { TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletTempSizingGauntlet) { - state->dataFluidProps->init_state(*state); + state->dataFluid->init_state(*state); // this global state is what would be set up by E+ currently state->dataSize->ZoneEqSizing.allocate(1); state->dataEnvrn->StdRhoAir = 1.2; @@ -119,6 +119,7 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletTempSizingGauntlet) state->dataSize->FinalZoneSizing.allocate(1); state->dataSize->ZoneEqSizing.allocate(1); state->dataPlnt->PlantLoop.allocate(1); + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataSize->PlantSizData.allocate(1); state->dataSize->PlantSizData(1).ExitTemp = 7.0; state->dataSize->DataPltSizCoolNum = 1; diff --git a/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesWaterInletTempSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesWaterInletTempSizing.unit.cc index 01ee581653c..83c23aa9313 100644 --- a/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesWaterInletTempSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesWaterInletTempSizing.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/Autosizing/CoolingWaterNumofTubesPerRowSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/CoolingWaterNumofTubesPerRowSizing.unit.cc index 6467b1fb685..db2a1f00288 100644 --- a/tst/EnergyPlus/unit/Autosizing/CoolingWaterNumofTubesPerRowSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/CoolingWaterNumofTubesPerRowSizing.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/Autosizing/CoolingWaterflowSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/CoolingWaterflowSizing.unit.cc index 08fe992af31..2cbbbd50769 100644 --- a/tst/EnergyPlus/unit/Autosizing/CoolingWaterflowSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/CoolingWaterflowSizing.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -59,7 +59,7 @@ namespace EnergyPlus { TEST_F(AutoSizingFixture, CoolingWaterflowSizingGauntlet) { - state->dataFluidProps->init_state(*state); + state->dataFluid->init_state(*state); // this global state is what would be set up by E+ currently state->dataEnvrn->StdRhoAir = 1.2; state->dataSize->ZoneEqSizing.allocate(1); @@ -97,6 +97,7 @@ TEST_F(AutoSizingFixture, CoolingWaterflowSizingGauntlet) // Test #2 - Zone Equipment, no autosizing, has input data state->dataSize->DataWaterLoopNum = 1; state->dataPlnt->PlantLoop.allocate(1); + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataSize->DataWaterCoilSizCoolDeltaT = 10.0; sizer.initializeWithinEP(*this->state, HVAC::cAllCoilTypes(HVAC::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); sizedValue = sizer.size(*this->state, inputValue, errorsFound); diff --git a/tst/EnergyPlus/unit/Autosizing/HeatingAirFlowSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/HeatingAirFlowSizing.unit.cc index 86278412559..aed65f9df45 100644 --- a/tst/EnergyPlus/unit/Autosizing/HeatingAirFlowSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/HeatingAirFlowSizing.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -123,8 +123,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) state->dataSize->FinalZoneSizing(1).HeatDDNum = 2; state->dataSize->FinalZoneSizing(1).TimeStepNumAtCoolMax = 12; state->dataSize->FinalZoneSizing(1).TimeStepNumAtHeatMax = 6; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; state->dataEnvrn->TotDesDays = 2; state->dataWeather->DesDayInput.allocate(2); state->dataWeather->DesDayInput(1).Month = 7; diff --git a/tst/EnergyPlus/unit/Autosizing/HeatingAirflowUASizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/HeatingAirflowUASizing.unit.cc index 51103a3a5e7..60c4b3d2710 100644 --- a/tst/EnergyPlus/unit/Autosizing/HeatingAirflowUASizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/HeatingAirflowUASizing.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/Autosizing/HeatingCapacitySizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/HeatingCapacitySizing.unit.cc index 742889609a2..64169bf8f3c 100644 --- a/tst/EnergyPlus/unit/Autosizing/HeatingCapacitySizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/HeatingCapacitySizing.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -80,6 +80,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + state->dataEnvrn->StdRhoAir = 1.2; // call simulate to trigger sizing call Fans::GetFanInput(*state); diff --git a/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesAirInletHumRatSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesAirInletHumRatSizing.unit.cc index bd1979eb4e3..a70c284cec0 100644 --- a/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesAirInletHumRatSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesAirInletHumRatSizing.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesAirInletTempSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesAirInletTempSizing.unit.cc index 5c605115fda..8b3776838ca 100644 --- a/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesAirInletTempSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesAirInletTempSizing.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesCoilLoadUsedForUASizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesCoilLoadUsedForUASizing.unit.cc index ca2acf8aebc..3e35974ef8e 100644 --- a/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesCoilLoadUsedForUASizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesCoilLoadUsedForUASizing.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -58,7 +58,7 @@ namespace EnergyPlus { TEST_F(AutoSizingFixture, HeatingWaterDesCoilLoadUsedForUASizingGauntlet) { - state->dataFluidProps->init_state(*state); + state->dataFluid->init_state(*state); // this global state is what would be set up by E+ currently state->dataEnvrn->StdRhoAir = 1.2; static constexpr std::string_view routineName("HeatingWaterDesCoilLoadUsedForUASizingGauntlet"); @@ -134,6 +134,7 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilLoadUsedForUASizingGauntlet) state->dataSize->ZoneEqSizing(1).ATMixerHeatPriDryBulb = 28.0; state->dataSize->ZoneEqSizing(1).ATMixerHeatPriHumRat = 0.0045; state->dataPlnt->PlantLoop.allocate(1); + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataSize->DataWaterLoopNum = 1; state->dataSize->DataWaterCoilSizHeatDeltaT = 5.0; state->dataSize->DataWaterFlowUsedForSizing = 0.0002; diff --git a/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesCoilWaterVolFlowUsedForUASizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesCoilWaterVolFlowUsedForUASizing.unit.cc index 268dc15707d..5077750d34a 100644 --- a/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesCoilWaterVolFlowUsedForUASizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesCoilWaterVolFlowUsedForUASizing.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/Autosizing/HeatingWaterflowSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/HeatingWaterflowSizing.unit.cc index a7369eee5c8..40f00eb6671 100644 --- a/tst/EnergyPlus/unit/Autosizing/HeatingWaterflowSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/HeatingWaterflowSizing.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -58,7 +58,7 @@ namespace EnergyPlus { TEST_F(AutoSizingFixture, HeatingWaterflowSizingGauntlet) { - state->dataFluidProps->init_state(*state); + state->dataFluid->init_state(*state); // this global state is what would be set up by E+ currently state->dataEnvrn->StdRhoAir = 1.2; state->dataSize->ZoneEqSizing.allocate(1); @@ -266,6 +266,7 @@ TEST_F(AutoSizingFixture, HeatingWaterflowSizingGauntlet) state->dataSize->DataWaterCoilSizHeatDeltaT = 10.0; state->dataPlnt->PlantLoop.allocate(1); state->dataPlnt->PlantLoop(1).FluidName = "Water"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); // start with an auto-sized value as the user input inputValue = DataSizing::AutoSize; // do sizing diff --git a/tst/EnergyPlus/unit/Autosizing/SystemAirFlowSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/SystemAirFlowSizing.unit.cc index 2c2441eedca..44fe9e1e4ec 100644 --- a/tst/EnergyPlus/unit/Autosizing/SystemAirFlowSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/SystemAirFlowSizing.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -120,8 +120,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) state->dataSize->FinalZoneSizing(1).HeatDDNum = 2; state->dataSize->FinalZoneSizing(1).TimeStepNumAtCoolMax = 12; state->dataSize->FinalZoneSizing(1).TimeStepNumAtHeatMax = 6; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; state->dataEnvrn->TotDesDays = 2; state->dataWeather->DesDayInput.allocate(2); state->dataWeather->DesDayInput(1).Month = 7; @@ -960,6 +960,25 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) eiooutput = std::string(" Component Sizing Information, Coil:Heating:Water, MyWaterCoil, Design Size Maximum Flow Rate [m3/s], 3.50000\n" " Component Sizing Information, Coil:Heating:Water, MyWaterCoil, User-Specified Maximum Flow Rate [m3/s], 2.20000\n"); EXPECT_TRUE(compare_eio_stream(eiooutput, true)); + + // Test 58 - DOAS fan air flow rate autosizing + state->dataSize->HRFlowSizingFlag = false; + state->dataSize->CurOASysNum = 1; + state->dataAirLoop->OutsideAirSys(1).AirLoopDOASNum = 0; + AirLoopHVACDOAS::AirLoopDOAS thisDOAS; + state->dataAirLoopHVACDOAS->airloopDOAS.push_back(thisDOAS); + // use 0.53 m3/s multiplied by StdRhoAir = 1.2 + state->dataAirLoopHVACDOAS->airloopDOAS[state->dataAirLoop->OutsideAirSys(1).AirLoopDOASNum].SizingMassFlow = 0.53 * 1.2; + inputValue = DataSizing::AutoSize; + + // do sizing + sizer.wasAutoSized = false; + printFlag = true; + sizer.initializeWithinEP(*this->state, "Fan:SystemModel", "MyDOASFan", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); + EXPECT_ENUM_EQ(AutoSizingResultType::NoError, sizer.errorType); // cumulative of previous calls + EXPECT_TRUE(sizer.wasAutoSized); + EXPECT_NEAR(0.53, sizedValue, 0.01); // auto-sized value } } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/Autosizing/WaterHeatingCapacitySizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/WaterHeatingCapacitySizing.unit.cc index e7901625036..6ff4af9703b 100644 --- a/tst/EnergyPlus/unit/Autosizing/WaterHeatingCapacitySizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/WaterHeatingCapacitySizing.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -58,7 +58,7 @@ namespace EnergyPlus { TEST_F(AutoSizingFixture, WaterHeatingCapacitySizingGauntlet) { - state->dataFluidProps->init_state(*state); + state->dataFluid->init_state(*state); // this global state is what would be set up by E+ currently state->dataEnvrn->StdRhoAir = 1.2; static constexpr std::string_view routineName("WaterHeatingCapacitySizingGauntlet"); @@ -133,6 +133,7 @@ TEST_F(AutoSizingFixture, WaterHeatingCapacitySizingGauntlet) state->dataSize->ZoneEqSizing(1).ATMixerHeatPriDryBulb = 28.0; state->dataSize->ZoneEqSizing(1).ATMixerHeatPriHumRat = 0.0045; state->dataPlnt->PlantLoop.allocate(1); + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataSize->DataWaterLoopNum = 1; state->dataSize->DataWaterCoilSizHeatDeltaT = 5.0; diff --git a/tst/EnergyPlus/unit/Autosizing/WaterHeatingCoilUASizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/WaterHeatingCoilUASizing.unit.cc index 355a4cec876..84b84b013b0 100644 --- a/tst/EnergyPlus/unit/Autosizing/WaterHeatingCoilUASizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/WaterHeatingCoilUASizing.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -60,7 +60,7 @@ namespace EnergyPlus { TEST_F(AutoSizingFixture, WaterHeatingCoilUASizingGauntlet) { - state->dataFluidProps->init_state(*state); + state->dataFluid->init_state(*state); // this global state is what would be set up by E+ currently state->dataEnvrn->StdRhoAir = 1.2; state->dataSize->ZoneEqSizing.allocate(1); @@ -121,10 +121,9 @@ TEST_F(AutoSizingFixture, WaterHeatingCoilUASizingGauntlet) state->dataWaterCoils->WaterCoil(1).InletAirMassFlowRate = 0.2; state->dataWaterCoils->WaterCoil(1).InletWaterMassFlowRate = 0.8; state->dataWaterCoils->WaterCoil(1).WaterPlantLoc.loopNum = 1; - state->dataWaterCoils->WaterCoil(1).SchedPtr = -1; state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); state->dataWaterCoils->MySizeFlag.allocate(1); - state->dataScheduleMgr->Schedule.allocate(1); + state->dataWaterCoils->WaterCoil(1).availSched = Sched::GetScheduleAlwaysOn(*state); // now allocate sizing arrays for testing autosized field state->dataSize->TermUnitSizing.allocate(1); @@ -138,6 +137,7 @@ TEST_F(AutoSizingFixture, WaterHeatingCoilUASizingGauntlet) state->dataSize->PlantSizData(1).ExitTemp = 60.0; state->dataPlnt->PlantLoop.allocate(1); state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataSize->ZoneSizingRunDone = true; diff --git a/tst/EnergyPlus/unit/BaseboardElectric.unit.cc b/tst/EnergyPlus/unit/BaseboardElectric.unit.cc index 2872b47864f..c1860c1df86 100644 --- a/tst/EnergyPlus/unit/BaseboardElectric.unit.cc +++ b/tst/EnergyPlus/unit/BaseboardElectric.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -85,6 +85,8 @@ TEST_F(EnergyPlusFixture, ExerciseBaseboardElectric) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + state->dataZoneEquip->ZoneEquipConfig.allocate(1); state->dataZoneEquip->ZoneEquipConfig(1).ZoneNode = 1; state->dataLoopNodes->Node.allocate(1); diff --git a/tst/EnergyPlus/unit/BaseboardRadiator.unit.cc b/tst/EnergyPlus/unit/BaseboardRadiator.unit.cc index 1416366a8b5..6222e9d1bf2 100644 --- a/tst/EnergyPlus/unit/BaseboardRadiator.unit.cc +++ b/tst/EnergyPlus/unit/BaseboardRadiator.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -164,7 +164,7 @@ TEST_F(EnergyPlusFixture, BaseboardConvWater_SizingTest) " ZoneHVAC:Baseboard:Convective:Water,", " SPACE2-1 Baseboard, !- Name", - " always_on, !- Availability Schedule Name", + " CONSTANT-1.0, !- Availability Schedule Name", " SPACE2-1 Baseboard Inlet Node, !- Inlet Node Name", " SPACE2-1 Baseboard Outlet Node, !- Outlet Node Name", " HeatingDesignCapacity, !- Heating Design Capacity Method", @@ -194,7 +194,7 @@ TEST_F(EnergyPlusFixture, BaseboardConvWater_SizingTest) " ZoneHVAC:Baseboard:Convective:Water,", " SPACE3-1 Baseboard, !- Name", - " always_on, !- Availability Schedule Name", + " CONSTANT-1.0, !- Availability Schedule Name", " SPACE3-1 Baseboard Inlet Node, !- Inlet Node Name", " SPACE3-1 Baseboard Outlet Node, !- Outlet Node Name", " CapacityPerFloorArea, !- Heating Design Capacity Method", @@ -224,7 +224,7 @@ TEST_F(EnergyPlusFixture, BaseboardConvWater_SizingTest) " ZoneHVAC:Baseboard:Convective:Water,", " SPACE4-1 Baseboard, !- Name", - " always_on, !- Availability Schedule Name", + " CONSTANT-1.0, !- Availability Schedule Name", " SPACE4-1 Baseboard Inlet Node, !- Inlet Node Name", " SPACE4-1 Baseboard Outlet Node, !- Outlet Node Name", " FractionOfAutosizedHeatingCapacity, !- Heating Design Capacity Method", @@ -252,19 +252,6 @@ TEST_F(EnergyPlusFixture, BaseboardConvWater_SizingTest) " 0.0,0.0,0.0, !- X,Y,Z ==> Vertex 3 {m}", " 0.0,0.0,2.4; !- X,Y,Z ==> Vertex 4 {m}", - " ScheduleTypeLimits,", - " Fraction, !- Name", - " 0.0, !- Lower Limit Value", - " 1.0, !- Upper Limit Value", - " CONTINUOUS; !- Numeric Type", - - " Schedule:Compact,", - " always_on, !- Name", - " Fraction, !- Schedule Type Limits Name", - " Through: 12/31, !- Field 1", - " For: AllDays, !- Field 2", - " Until: 24:00,1.0; !- Field 3" - "SurfaceConvectionAlgorithm:Inside,TARP;", "SurfaceConvectionAlgorithm:Outside,DOE-2;", @@ -329,9 +316,10 @@ TEST_F(EnergyPlusFixture, BaseboardConvWater_SizingTest) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + + state->init_state(*state); bool errorsFound(false); HeatBalanceManager::GetProjectControlData(*state, errorsFound); // read project control data @@ -350,12 +338,12 @@ TEST_F(EnergyPlusFixture, BaseboardConvWater_SizingTest) state->dataSurfaceGeometry->CosZoneRelNorth.allocate(3); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(3); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->CosZoneRelNorth(3) = std::cos(-state->dataHeatBal->Zone(3).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(3) = std::sin(-state->dataHeatBal->Zone(3).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->CosZoneRelNorth(3) = std::cos(-state->dataHeatBal->Zone(3).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(3) = std::sin(-state->dataHeatBal->Zone(3).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; @@ -380,6 +368,7 @@ TEST_F(EnergyPlusFixture, BaseboardConvWater_SizingTest) auto &loop(state->dataPlnt->PlantLoop(l)); loop.PlantSizNum = 1; loop.FluidName = "WATER"; + loop.glycol = Fluid::GetWater(*state); auto &loopside(state->dataPlnt->PlantLoop(l).LoopSide(DataPlant::LoopSideLocation::Demand)); loopside.TotalBranches = 1; loopside.Branch.allocate(1); diff --git a/tst/EnergyPlus/unit/BoilerHotWater.unit.cc b/tst/EnergyPlus/unit/BoilerHotWater.unit.cc index 0073f22d5b1..be07b96dbf0 100644 --- a/tst/EnergyPlus/unit/BoilerHotWater.unit.cc +++ b/tst/EnergyPlus/unit/BoilerHotWater.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -71,7 +71,8 @@ using namespace EnergyPlus::Psychrometrics; TEST_F(EnergyPlusFixture, Boiler_HotWaterSizingTest) { - state->dataFluidProps->init_state(*state); + state->dataFluid->init_state(*state); // Still necessary? + // unit test for autosizing boiler nominal capacity in Boiler:HotWater state->dataBoilers->Boiler.allocate(1); // Hardsized Hot Water Boiler @@ -86,8 +87,9 @@ TEST_F(EnergyPlusFixture, Boiler_HotWaterSizingTest) state->dataSize->PlantSizData.allocate(1); // Hot Water Loop state->dataPlnt->PlantLoop(1).PlantSizNum = 1; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); + state->dataSize->PlantSizData(1).DesVolFlowRate = 1.0; state->dataSize->PlantSizData(1).DeltaT = 10.0; state->dataPlnt->PlantFirstSizesOkayToFinalize = true; @@ -116,7 +118,7 @@ TEST_F(EnergyPlusFixture, Boiler_HotWaterSizingTest) } TEST_F(EnergyPlusFixture, Boiler_HotWaterAutoSizeTempTest) { - state->dataFluidProps->init_state(*state); + state->dataFluid->init_state(*state); // Still necessary? // unit test for checking hot water temperature for autosizing // boiler nominal capacity in Boiler:HotWater state->dataBoilers->Boiler.allocate(1); @@ -132,23 +134,17 @@ TEST_F(EnergyPlusFixture, Boiler_HotWaterAutoSizeTempTest) state->dataSize->PlantSizData.allocate(1); // Hot Water Loop state->dataPlnt->PlantLoop(1).PlantSizNum = 1; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataSize->PlantSizData(1).DesVolFlowRate = 1.0; state->dataSize->PlantSizData(1).DeltaT = 10.0; state->dataPlnt->PlantFirstSizesOkayToFinalize = true; // calculate nominal capacity at 60.0 C hot water temperature - Real64 rho = FluidProperties::GetDensityGlycol(*state, - state->dataPlnt->PlantLoop(state->dataBoilers->Boiler(1).plantLoc.loopNum).FluidName, - 60.0, - state->dataPlnt->PlantLoop(state->dataBoilers->Boiler(1).plantLoc.loopNum).FluidIndex, - "Boiler_HotWaterAutoSizeTempTest"); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(*state, - state->dataPlnt->PlantLoop(state->dataBoilers->Boiler(1).plantLoc.loopNum).FluidName, - 60.0, - state->dataPlnt->PlantLoop(state->dataBoilers->Boiler(1).plantLoc.loopNum).FluidIndex, - "Boiler_HotWaterAutoSizeTempTest"); + Real64 rho = state->dataPlnt->PlantLoop(state->dataBoilers->Boiler(1).plantLoc.loopNum) + .glycol->getDensity(*state, 60.0, "Boiler_HotWaterAutoSizeTempTest"); + Real64 Cp = state->dataPlnt->PlantLoop(state->dataBoilers->Boiler(1).plantLoc.loopNum) + .glycol->getSpecificHeat(*state, 60.0, "Boiler_HotWaterAutoSizeTempTest"); Real64 NomCapBoilerExpected = rho * state->dataSize->PlantSizData(1).DesVolFlowRate * Cp * state->dataSize->PlantSizData(1).DeltaT * state->dataBoilers->Boiler(1).SizFac; @@ -186,6 +182,7 @@ TEST_F(EnergyPlusFixture, Boiler_HotWater_BlankDesignWaterFlowRate) }); ASSERT_TRUE(process_idf(idf_objects)); + GetBoilerInput(*state); EXPECT_EQ(1, (int)state->dataBoilers->Boiler.size()); @@ -204,11 +201,9 @@ TEST_F(EnergyPlusFixture, Boiler_HotWater_BoilerEfficiency) state->dataPlnt->TotNumLoops = 2; state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.20; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - - Psychrometrics::InitializePsychRoutines(*state); + state->dataGlobal->MinutesInTimeStep = 60; std::string const idf_objects = delimited_string({ "Boiler:HotWater,", @@ -254,10 +249,9 @@ TEST_F(EnergyPlusFixture, Boiler_HotWater_BoilerEfficiency) auto &thisBoiler = state->dataBoilers->Boiler(1); state->dataPlnt->PlantLoop(1).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "HotWater"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).PlantSizNum = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = thisBoiler.Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::Boiler_Simple; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).NodeNumIn = thisBoiler.BoilerInletNodeNum; diff --git a/tst/EnergyPlus/unit/BoilerSteam.unit.cc b/tst/EnergyPlus/unit/BoilerSteam.unit.cc index b012d0a56f1..e13127cb9e7 100644 --- a/tst/EnergyPlus/unit/BoilerSteam.unit.cc +++ b/tst/EnergyPlus/unit/BoilerSteam.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -91,6 +91,9 @@ TEST_F(EnergyPlusFixture, BoilerSteam_GetInput) }); ASSERT_TRUE(process_idf(idf_objects, false)); + + state->init_state(*state); + GetBoilerInput(*state); auto &thisBoiler = state->dataBoilerSteam->Boiler((int)state->dataBoilerSteam->Boiler.size()); EXPECT_EQ(thisBoiler.Name, "STEAM BOILER PLANT BOILER"); @@ -131,6 +134,8 @@ TEST_F(EnergyPlusFixture, BoilerSteam_Simulate) ASSERT_TRUE(process_idf(idf_objects, false)); + state->init_state(*state); + BoilerSpecs *ptr = BoilerSteam::BoilerSpecs::factory(*state, "BOILER"); EXPECT_EQ(ptr->Name, "BOILER"); @@ -173,19 +178,6 @@ TEST_F(EnergyPlusFixture, BoilerSteam_Simulate) TEST_F(EnergyPlusFixture, BoilerSteam_BoilerEfficiency) { - - bool RunFlag(true); - Real64 MyLoad(1000000.0); - - state->dataPlnt->TotNumLoops = 2; - state->dataEnvrn->OutBaroPress = 101325.0; - state->dataEnvrn->StdRhoAir = 1.20; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - - Psychrometrics::InitializePsychRoutines(*state); - std::string const idf_objects = delimited_string({ " Boiler:Steam, ", " Steam Boiler Plant Boiler, !- Name ", @@ -206,6 +198,18 @@ TEST_F(EnergyPlusFixture, BoilerSteam_BoilerEfficiency) EXPECT_TRUE(process_idf(idf_objects, false)); + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + + bool RunFlag(true); + Real64 MyLoad(1000000.0); + + state->dataPlnt->TotNumLoops = 2; + state->dataEnvrn->OutBaroPress = 101325.0; + state->dataEnvrn->StdRhoAir = 1.20; + state->dataGlobal->TimeStep = 1; + state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); for (int l = 1; l <= state->dataPlnt->TotNumLoops; ++l) { auto &loopside(state->dataPlnt->PlantLoop(l).LoopSide(DataPlant::LoopSideLocation::Demand)); @@ -220,10 +224,9 @@ TEST_F(EnergyPlusFixture, BoilerSteam_BoilerEfficiency) auto &thisBoiler = state->dataBoilerSteam->Boiler((int)state->dataBoilerSteam->Boiler.size()); state->dataPlnt->PlantLoop(1).Name = "SteamLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "Steam"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).PlantSizNum = 1; state->dataPlnt->PlantLoop(1).FluidName = "STEAM"; + state->dataPlnt->PlantLoop(1).steam = Fluid::GetSteam(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = thisBoiler.Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::Boiler_Steam; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).NodeNumIn = thisBoiler.BoilerInletNodeNum; diff --git a/tst/EnergyPlus/unit/BranchInputManager.unit.cc b/tst/EnergyPlus/unit/BranchInputManager.unit.cc index da12f7d7f71..94484636117 100644 --- a/tst/EnergyPlus/unit/BranchInputManager.unit.cc +++ b/tst/EnergyPlus/unit/BranchInputManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/BranchNodeConnections.unit.cc b/tst/EnergyPlus/unit/BranchNodeConnections.unit.cc index f80e8e05e0b..bea59d4c49e 100644 --- a/tst/EnergyPlus/unit/BranchNodeConnections.unit.cc +++ b/tst/EnergyPlus/unit/BranchNodeConnections.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -1168,7 +1168,8 @@ TEST_F(EnergyPlusFixture, BranchNodeConnections_ReturnPlenumNodeCheckFailure) // OutputProcessor::TimeValue.allocate(2); state->dataGlobal->DDOnlySimulation = true; - GetProjectData(*state); + state->init_state(*state); + OutputReportPredefined::SetPredefinedTables(*state); SetPreConstructionInputParameters(*state); // establish array bounds for constructions early createFacilityElectricPowerServiceObject(*state); @@ -2189,7 +2190,8 @@ TEST_F(EnergyPlusFixture, BranchNodeConnections_ReturnPlenumNodeCheck) // OutputProcessor::TimeValue.allocate(2); state->dataGlobal->DDOnlySimulation = true; - GetProjectData(*state); + state->init_state(*state); + OutputReportPredefined::SetPredefinedTables(*state); SetPreConstructionInputParameters(*state); // establish array bounds for constructions early createFacilityElectricPowerServiceObject(*state); diff --git a/tst/EnergyPlus/unit/CTElectricGenerator.unit.cc b/tst/EnergyPlus/unit/CTElectricGenerator.unit.cc index f23733ac921..4c7c5358571 100644 --- a/tst/EnergyPlus/unit/CTElectricGenerator.unit.cc +++ b/tst/EnergyPlus/unit/CTElectricGenerator.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/ChilledCeilingPanelSimple.unit.cc b/tst/EnergyPlus/unit/ChilledCeilingPanelSimple.unit.cc index 6f1382498a4..1ae2ea2365f 100644 --- a/tst/EnergyPlus/unit/ChilledCeilingPanelSimple.unit.cc +++ b/tst/EnergyPlus/unit/ChilledCeilingPanelSimple.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/ChillerAbsorption.unit.cc b/tst/EnergyPlus/unit/ChillerAbsorption.unit.cc index 7bd0003246a..b8b5935bd4a 100644 --- a/tst/EnergyPlus/unit/ChillerAbsorption.unit.cc +++ b/tst/EnergyPlus/unit/ChillerAbsorption.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -1784,6 +1784,8 @@ TEST_F(EnergyPlusFixture, ChillerAbsorption_Calc) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + SimulationManager::ManageSimulation(*state); // run the design day // set conditions for test @@ -1840,11 +1842,11 @@ TEST_F(EnergyPlusFixture, ChillerAbsorption_Autosize) state->dataPlnt->TotNumLoops = 3; state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.20; - state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->TimeStepsInHour = 4; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 15; + state->dataGlobal->MinutesInTimeStep = 15; state->dataHVACGlobal->TimeStepSys = 0.25; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->dataGlobal->SysSizingCalc = true; std::string const idf_objects = delimited_string({ @@ -1879,6 +1881,8 @@ TEST_F(EnergyPlusFixture, ChillerAbsorption_Autosize) }); EXPECT_TRUE(process_idf(idf_objects, false)); + state->init_state(*state); + state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); state->dataSize->NumPltSizInput = state->dataPlnt->TotNumLoops; state->dataSize->PlantSizData.allocate(state->dataPlnt->TotNumLoops); @@ -1944,8 +1948,8 @@ TEST_F(EnergyPlusFixture, ChillerAbsorption_Autosize) auto &thisLoop = chwLoop; auto &thisLoopSizing = chwLoopSizing; thisLoop.Name = "ChilledWaterLoop"; - thisLoop.FluidIndex = 1; thisLoop.FluidName = "WATER"; + thisLoop.glycol = Fluid::GetWater(*state); thisLoop.PlantSizNum = chwLoopNum; auto &loopside = thisLoop.LoopSide(DataPlant::LoopSideLocation::Supply); loopside.TotalBranches = 1; @@ -1970,8 +1974,8 @@ TEST_F(EnergyPlusFixture, ChillerAbsorption_Autosize) auto &thisLoop = cndLoop; auto &thisLoopSizing = cndLoopSizing; thisLoop.Name = "CondenserWaterLoop"; - thisLoop.FluidIndex = 1; thisLoop.FluidName = "WATER"; + thisLoop.glycol = Fluid::GetWater(*state); thisLoop.PlantSizNum = cndLoopNum; auto &loopside = thisLoop.LoopSide(DataPlant::LoopSideLocation::Demand); loopside.TotalBranches = 1; @@ -1996,8 +2000,8 @@ TEST_F(EnergyPlusFixture, ChillerAbsorption_Autosize) auto &thisLoop = genLoop; auto &thisLoopSizing = genLoopSizing; thisLoop.Name = "Generator HW Loop"; - thisLoop.FluidIndex = 1; thisLoop.FluidName = "WATER"; + thisLoop.glycol = Fluid::GetWater(*state); thisLoop.PlantSizNum = genLoopNum; auto &loopside = thisLoop.LoopSide(DataPlant::LoopSideLocation::Demand); loopside.TotalBranches = 1; @@ -2022,17 +2026,10 @@ TEST_F(EnergyPlusFixture, ChillerAbsorption_Autosize) state->dataPlnt->PlantFinalSizesOkayToReport = true; // Calculate expected values - Real64 rho_cw = FluidProperties::GetDensityGlycol(*state, - state->dataPlnt->PlantLoop(chwLoopNum).FluidName, - Constant::CWInitConvTemp, - state->dataPlnt->PlantLoop(chwLoopNum).FluidIndex, - "ChillerAbsorption_Autosize_TEST"); - - Real64 Cp_evap = FluidProperties::GetSpecificHeatGlycol(*state, - state->dataPlnt->PlantLoop(chwLoopNum).FluidName, - Constant::CWInitConvTemp, - state->dataPlnt->PlantLoop(chwLoopNum).FluidIndex, - "ChillerAbsorption_Autosize_TEST"); + Real64 rho_cw = state->dataPlnt->PlantLoop(chwLoopNum).glycol->getDensity(*state, Constant::CWInitConvTemp, "ChillerAbsorption_Autosize_TEST"); + + Real64 Cp_evap = + state->dataPlnt->PlantLoop(chwLoopNum).glycol->getSpecificHeat(*state, Constant::CWInitConvTemp, "ChillerAbsorption_Autosize_TEST"); Real64 const expectedEvapVolFlowRate = state->dataSize->PlantSizData(chwLoopNum).DesVolFlowRate * thisChiller.SizFac; Real64 const expectedNomCap = Cp_evap * rho_cw * state->dataSize->PlantSizData(chwLoopNum).DeltaT * expectedEvapVolFlowRate; @@ -2042,39 +2039,26 @@ TEST_F(EnergyPlusFixture, ChillerAbsorption_Autosize) Real64 const SteamInputRatNom = thisChiller.SteamLoadCoef[0] + thisChiller.SteamLoadCoef[1] + thisChiller.SteamLoadCoef[2]; EXPECT_DOUBLE_EQ(1.0, SteamInputRatNom); - Real64 rho_cond = FluidProperties::GetDensityGlycol(*state, - state->dataPlnt->PlantLoop(cndLoopNum).FluidName, - Constant::CWInitConvTemp, - state->dataPlnt->PlantLoop(cndLoopNum).FluidIndex, - "ChillerAbsorption_Autosize_TEST"); + Real64 rho_cond = state->dataPlnt->PlantLoop(cndLoopNum).glycol->getDensity(*state, Constant::CWInitConvTemp, "ChillerAbsorption_Autosize_TEST"); - Real64 Cp_cond = FluidProperties::GetSpecificHeatGlycol(*state, - state->dataPlnt->PlantLoop(cndLoopNum).FluidName, - thisChiller.TempDesCondIn, - state->dataPlnt->PlantLoop(cndLoopNum).FluidIndex, - "ChillerAbsorption_Autosize_TEST"); + Real64 Cp_cond = + state->dataPlnt->PlantLoop(cndLoopNum).glycol->getSpecificHeat(*state, thisChiller.TempDesCondIn, "ChillerAbsorption_Autosize_TEST"); Real64 const expectedCondVolFlowRate = expectedNomCap * (1.0 + SteamInputRatNom + nomCapToPumpRatio) / (rho_cond * Cp_cond * state->dataSize->PlantSizData(cndLoopNum).DeltaT); Real64 const SteamDeltaT = state->dataSize->PlantSizData(genLoopNum).DeltaT; - Real64 const Cp_gen = FluidProperties::GetSpecificHeatGlycol(*state, - state->dataPlnt->PlantLoop(genLoopNum).FluidName, - state->dataSize->PlantSizData(genLoopNum).ExitTemp, - state->dataPlnt->PlantLoop(genLoopNum).FluidIndex, - "ChillerAbsorption_Autosize_TEST"); - - Real64 const rho_gen = FluidProperties::GetDensityGlycol(*state, - state->dataPlnt->PlantLoop(genLoopNum).FluidName, - (state->dataSize->PlantSizData(genLoopNum).ExitTemp - SteamDeltaT), - state->dataPlnt->PlantLoop(genLoopNum).FluidIndex, - "ChillerAbsorption_Autosize_TEST"); + Real64 const Cp_gen = state->dataPlnt->PlantLoop(genLoopNum) + .glycol->getSpecificHeat(*state, state->dataSize->PlantSizData(genLoopNum).ExitTemp, "ChillerAbsorption_Autosize_TEST"); + + Real64 const rho_gen = + state->dataPlnt->PlantLoop(genLoopNum) + .glycol->getDensity(*state, (state->dataSize->PlantSizData(genLoopNum).ExitTemp - SteamDeltaT), "ChillerAbsorption_Autos"); Real64 const expectedGeneratorVolFlowRate = (expectedNomCap * SteamInputRatNom) / (Cp_gen * rho_gen * SteamDeltaT); bool RunFlag(true); Real64 MyLoad(-20000.0); - Psychrometrics::InitializePsychRoutines(*state); thisChiller.initialize(*state, RunFlag, MyLoad); thisChiller.sizeChiller(*state); diff --git a/tst/EnergyPlus/unit/ChillerConstantCOP.unit.cc b/tst/EnergyPlus/unit/ChillerConstantCOP.unit.cc index f860da107b3..46bfa4ca31d 100644 --- a/tst/EnergyPlus/unit/ChillerConstantCOP.unit.cc +++ b/tst/EnergyPlus/unit/ChillerConstantCOP.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -72,9 +72,9 @@ TEST_F(EnergyPlusFixture, ChillerConstantCOP_WaterCooled_Autosize) state->dataPlnt->TotNumLoops = 4; state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.20; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->MinutesInTimeStep = 60; std::string const idf_objects = delimited_string({ " Chiller:ConstantCOP,", @@ -100,6 +100,8 @@ TEST_F(EnergyPlusFixture, ChillerConstantCOP_WaterCooled_Autosize) EXPECT_TRUE(process_idf(idf_objects, false)); + state->init_state(*state); + state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); for (int l = 1; l <= state->dataPlnt->TotNumLoops; ++l) { @@ -116,10 +118,9 @@ TEST_F(EnergyPlusFixture, ChillerConstantCOP_WaterCooled_Autosize) auto &thisChiller = state->dataPlantChillers->ConstCOPChiller(1); state->dataPlnt->PlantLoop(1).Name = "ChilledWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "ChilledWater"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).PlantSizNum = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = thisChiller.Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::Chiller_ConstCOP; @@ -127,10 +128,10 @@ TEST_F(EnergyPlusFixture, ChillerConstantCOP_WaterCooled_Autosize) state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).NodeNumOut = thisChiller.EvapOutletNodeNum; state->dataPlnt->PlantLoop(2).Name = "CondenserWaterLoop"; - state->dataPlnt->PlantLoop(2).FluidName = "CondenserWater"; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).PlantSizNum = 2; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); + state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = thisChiller.Name; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::Chiller_ConstCOP; @@ -151,7 +152,6 @@ TEST_F(EnergyPlusFixture, ChillerConstantCOP_WaterCooled_Autosize) bool RunFlag(true); Real64 MyLoad(-20000.0); - Psychrometrics::InitializePsychRoutines(*state); thisChiller.initialize(*state, RunFlag, MyLoad); thisChiller.size(*state); @@ -206,9 +206,9 @@ TEST_F(EnergyPlusFixture, ChillerConstantCOP_Default_Des_Cond_Evap_Temps) state->dataPlnt->TotNumLoops = 12; state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.20; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->MinutesInTimeStep = 60; std::string const idf_objects = delimited_string({ " Chiller:ConstantCOP,", @@ -262,6 +262,8 @@ TEST_F(EnergyPlusFixture, ChillerConstantCOP_Default_Des_Cond_Evap_Temps) EXPECT_TRUE(process_idf(idf_objects, false)); + state->init_state(*state); + state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); for (int l = 1; l <= state->dataPlnt->TotNumLoops; ++l) { diff --git a/tst/EnergyPlus/unit/ChillerElectric.unit.cc b/tst/EnergyPlus/unit/ChillerElectric.unit.cc index 1eb1c9bfcc2..98e840a754a 100644 --- a/tst/EnergyPlus/unit/ChillerElectric.unit.cc +++ b/tst/EnergyPlus/unit/ChillerElectric.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -71,9 +71,9 @@ TEST_F(EnergyPlusFixture, ChillerElectric_WaterCooled_Autosize) state->dataPlnt->TotNumLoops = 4; state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.20; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->MinutesInTimeStep = 60; std::string const idf_objects = delimited_string({ " Chiller:Electric,", @@ -108,6 +108,8 @@ TEST_F(EnergyPlusFixture, ChillerElectric_WaterCooled_Autosize) EXPECT_TRUE(process_idf(idf_objects, false)); + state->init_state(*state); + state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); for (int l = 1; l <= state->dataPlnt->TotNumLoops; ++l) { @@ -122,10 +124,9 @@ TEST_F(EnergyPlusFixture, ChillerElectric_WaterCooled_Autosize) ElectricChillerSpecs::getInput(*state); state->dataPlnt->PlantLoop(1).Name = "ChilledWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "ChilledWater"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).PlantSizNum = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataPlantChillers->ElectricChiller(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = @@ -136,10 +137,9 @@ TEST_F(EnergyPlusFixture, ChillerElectric_WaterCooled_Autosize) state->dataPlantChillers->ElectricChiller(1).EvapOutletNodeNum; state->dataPlnt->PlantLoop(2).Name = "CondenserWaterLoop"; - state->dataPlnt->PlantLoop(2).FluidName = "CondenserWater"; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).PlantSizNum = 2; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataPlantChillers->ElectricChiller(1).Name; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = @@ -163,7 +163,6 @@ TEST_F(EnergyPlusFixture, ChillerElectric_WaterCooled_Autosize) bool RunFlag(true); Real64 MyLoad(-20000.0); - Psychrometrics::InitializePsychRoutines(*state); auto &thisChiller = state->dataPlantChillers->ElectricChiller(1); thisChiller.initialize(*state, RunFlag, MyLoad); thisChiller.size(*state); @@ -203,11 +202,11 @@ TEST_F(EnergyPlusFixture, ChillerElectric_WaterCooled_Simulate) state->dataPlnt->TotNumLoops = 4; state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.20; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->MinutesInTimeStep = 60; state->dataHVACGlobal->TimeStepSys = 60; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; std::string const idf_objects = delimited_string({ " Chiller:Electric,", @@ -265,6 +264,8 @@ TEST_F(EnergyPlusFixture, ChillerElectric_WaterCooled_Simulate) EXPECT_TRUE(process_idf(idf_objects, false)); + state->init_state(*state); + state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); for (int l = 1; l <= state->dataPlnt->TotNumLoops; ++l) { @@ -280,10 +281,9 @@ TEST_F(EnergyPlusFixture, ChillerElectric_WaterCooled_Simulate) ElectricChillerSpecs::getInput(*state); state->dataPlnt->PlantLoop(1).Name = "ChilledWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "ChilledWater"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).PlantSizNum = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataPlantChillers->ElectricChiller(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = @@ -296,10 +296,9 @@ TEST_F(EnergyPlusFixture, ChillerElectric_WaterCooled_Simulate) state->dataPlnt->PlantLoop(1).TempSetPointNodeNum = state->dataPlantChillers->ElectricChiller(1).EvapOutletNodeNum; state->dataPlnt->PlantLoop(2).Name = "CondenserWaterLoop"; - state->dataPlnt->PlantLoop(2).FluidName = "CondenserWater"; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).PlantSizNum = 2; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataPlantChillers->ElectricChiller(1).Name; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = @@ -323,7 +322,6 @@ TEST_F(EnergyPlusFixture, ChillerElectric_WaterCooled_Simulate) bool RunFlag(true); Real64 MyLoad(-20000.0); - Psychrometrics::InitializePsychRoutines(*state); auto &thisChiller = state->dataPlantChillers->ElectricChiller(1); thisChiller.initialize(*state, RunFlag, MyLoad); thisChiller.size(*state); diff --git a/tst/EnergyPlus/unit/ChillerElectricEIR.unit.cc b/tst/EnergyPlus/unit/ChillerElectricEIR.unit.cc index e7da610059a..9dcec7eb2c0 100644 --- a/tst/EnergyPlus/unit/ChillerElectricEIR.unit.cc +++ b/tst/EnergyPlus/unit/ChillerElectricEIR.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -116,14 +116,14 @@ TEST_F(EnergyPlusFixture, ElectricEIRChiller_HeatRecoveryAutosizeTest) state->dataSize->PlantSizData.allocate(2); // chilled water loop state->dataPlnt->PlantLoop(1).PlantSizNum = 1; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataSize->PlantSizData(1).DesVolFlowRate = 1.0; state->dataSize->PlantSizData(1).DeltaT = 5.0; // condenser water loop state->dataPlnt->PlantLoop(2).PlantSizNum = 2; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataSize->PlantSizData(2).DesVolFlowRate = 1.0; state->dataSize->PlantSizData(2).DeltaT = 5.0; @@ -199,9 +199,12 @@ TEST_F(EnergyPlusFixture, ChillerElectricEIR_AirCooledChiller) EXPECT_TRUE(process_idf(idf_objects, false)); - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->MinutesInTimeStep = 60; + + state->init_state(*state); + state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); for (int l = 1; l <= state->dataPlnt->TotNumLoops; ++l) { @@ -217,9 +220,9 @@ TEST_F(EnergyPlusFixture, ChillerElectricEIR_AirCooledChiller) auto &thisEIR = state->dataChillerElectricEIR->ElectricEIRChiller(1); state->dataPlnt->PlantLoop(1).Name = "ChilledWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).PlantSizNum = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = thisEIR.Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::Chiller_ElectricEIR; @@ -333,11 +336,11 @@ TEST_F(EnergyPlusFixture, ChillerElectricEIR_EvaporativelyCooled_Calculate) state->dataPlnt->TotNumLoops = 2; state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.20; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->MinutesInTimeStep = 60; - Psychrometrics::InitializePsychRoutines(*state); + state->init_state(*state); state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); @@ -354,9 +357,9 @@ TEST_F(EnergyPlusFixture, ChillerElectricEIR_EvaporativelyCooled_Calculate) auto &thisEIRChiller = state->dataChillerElectricEIR->ElectricEIRChiller(1); state->dataPlnt->PlantLoop(1).Name = "ChilledWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).PlantSizNum = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = thisEIRChiller.Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::Chiller_ElectricEIR; @@ -418,15 +421,14 @@ TEST_F(EnergyPlusFixture, ChillerElectricEIR_WaterCooledChillerVariableSpeedCond state->dataPlnt->TotNumLoops = 2; state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.20; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->MinutesInTimeStep = 60; state->dataGlobal->HourOfDay = 1; state->dataEnvrn->DayOfWeek = 1; state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 1; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - Psychrometrics::InitializePsychRoutines(*state); std::string const idf_objects = delimited_string({ "Chiller:Electric:EIR,", @@ -478,6 +480,8 @@ TEST_F(EnergyPlusFixture, ChillerElectricEIR_WaterCooledChillerVariableSpeedCond EXPECT_TRUE(process_idf(idf_objects, false)); + state->init_state(*state); + state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); for (int l = 1; l <= state->dataPlnt->TotNumLoops; ++l) { @@ -494,9 +498,9 @@ TEST_F(EnergyPlusFixture, ChillerElectricEIR_WaterCooledChillerVariableSpeedCond state->dataLoopNodes->Node.allocate(10); state->dataPlnt->PlantLoop(1).Name = "ChilledWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).PlantSizNum = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).TempSetPointNodeNum = 10; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = thisChiller.Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = @@ -511,9 +515,9 @@ TEST_F(EnergyPlusFixture, ChillerElectricEIR_WaterCooledChillerVariableSpeedCond state->dataSize->PlantSizData(1).DeltaT = 5.0; state->dataPlnt->PlantLoop(2).Name = "CondenserWaterLoop"; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).PlantSizNum = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = thisChiller.Name; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::Chiller_ElectricEIR; @@ -532,7 +536,7 @@ TEST_F(EnergyPlusFixture, ChillerElectricEIR_WaterCooledChillerVariableSpeedCond thisChiller.size(*state); MyLoad = -thisChiller.RefCap; state->dataSize->PlantSizData(1).DesCapacity = std::abs(MyLoad) * 2; - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // run through init again after sizing is complete to set mass flow rate state->dataGlobal->BeginEnvrnFlag = true; @@ -555,21 +559,51 @@ TEST_F(EnergyPlusFixture, ChillerElectricEIR_WaterCooledChillerVariableSpeedCond thisChiller.CondenserFlowControl = DataPlant::CondenserFlowControl::ModulatedDeltaTemperature; thisChiller.calculate(*state, MyLoad, RunFlag); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(*state, - state->dataPlnt->PlantLoop(thisChiller.CWPlantLoc.loopNum).FluidName, - thisChiller.CondInletTemp, - state->dataPlnt->PlantLoop(thisChiller.CWPlantLoc.loopNum).FluidIndex, - "ChillerElectricEIR_WaterCooledChillerVariableSpeedCondenser"); + Real64 Cp = state->dataPlnt->PlantLoop(thisChiller.CWPlantLoc.loopNum) + .glycol->getSpecificHeat(*state, thisChiller.CondInletTemp, "ChillerElectricEIR_WaterCooledChillerVariableSpeedCondenser"); Real64 ActualCondFlow = 3.0 * std::abs(MyLoad) / (Cp * 10.0); EXPECT_NEAR(thisChiller.CondMassFlowRate, ActualCondFlow, 0.00001); - thisChiller.CondenserFlowControl = DataPlant::CondenserFlowControl::ConstantFlow; - thisChiller.calculate(*state, MyLoad, RunFlag); - EXPECT_NEAR(thisChiller.CondMassFlowRate, thisChiller.CondMassFlowRateMax, 0.00001); - // Test the minimum condenser flow rate MyLoad = -500; thisChiller.CondenserFlowControl = DataPlant::CondenserFlowControl::ModulatedChillerPLR; thisChiller.calculate(*state, MyLoad, RunFlag); EXPECT_NEAR(thisChiller.CondMassFlowRate, thisChiller.CondMassFlowRateMax * 0.35, 0.00001); + + // Test constant flow condenser + thisChiller.CondenserFlowControl = DataPlant::CondenserFlowControl::ConstantFlow; + MyLoad = -10000; + Real64 savedMyLoad = MyLoad; + + // test with condenser flow available + thisChiller.initialize(*state, RunFlag, MyLoad); + thisChiller.calculate(*state, MyLoad, RunFlag); + thisChiller.update(*state, MyLoad, RunFlag); + Real64 chWOutletTemp = thisChiller.EvapInletTemp + savedMyLoad / (Cp * thisChiller.EvapMassFlowRate); + Real64 condOutletTemp = thisChiller.CondInletTemp + thisChiller.QCondenser / (Cp * thisChiller.CondMassFlowRate); + EXPECT_EQ(MyLoad, savedMyLoad); + EXPECT_NEAR(thisChiller.CondMassFlowRate, thisChiller.CondMassFlowRateMax, 0.00001); + EXPECT_NEAR(thisChiller.EvapMassFlowRate, thisChiller.EvapMassFlowRateMax, 0.00001); + EXPECT_NEAR(thisChiller.EvapOutletTemp, chWOutletTemp, 0.1); + EXPECT_NEAR(thisChiller.CondOutletTemp, condOutletTemp, 0.1); + EXPECT_NEAR(thisChiller.QEvaporator, -savedMyLoad, 1.0); + EXPECT_NEAR(thisChiller.QCondenser, (-savedMyLoad + thisChiller.Power), 1.0); + EXPECT_NEAR(thisChiller.Power, 20987, 1.0); + + // test with no condenser flow available - chiller should be off + state->dataLoopNodes->Node(thisChiller.CondInletNodeNum).MassFlowRate = 0.0; + state->dataLoopNodes->Node(thisChiller.CondInletNodeNum).MassFlowRateMaxAvail = 0.0; + thisChiller.initialize(*state, RunFlag, MyLoad); + thisChiller.calculate(*state, MyLoad, RunFlag); + thisChiller.update(*state, MyLoad, RunFlag); + EXPECT_EQ(MyLoad, 0.0); + EXPECT_EQ(thisChiller.CondMassFlowRate, 0.0); + EXPECT_EQ(thisChiller.EvapMassFlowRate, 0.0); + EXPECT_EQ(thisChiller.EvapOutletTemp, thisChiller.EvapInletTemp); + EXPECT_EQ(thisChiller.CondOutletTemp, thisChiller.CondInletTemp); + EXPECT_EQ(thisChiller.QEvaporator, 0.0); + EXPECT_EQ(thisChiller.QCondenser, 0.0); + EXPECT_EQ(thisChiller.Power, 0.0); + + // Test } diff --git a/tst/EnergyPlus/unit/ChillerExhaustAbsorption.unit.cc b/tst/EnergyPlus/unit/ChillerExhaustAbsorption.unit.cc index 1aaeb633ec5..5bba8c65411 100644 --- a/tst/EnergyPlus/unit/ChillerExhaustAbsorption.unit.cc +++ b/tst/EnergyPlus/unit/ChillerExhaustAbsorption.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -301,6 +301,8 @@ TEST_F(EnergyPlusFixture, ExhAbsorption_GetInput_Test) ASSERT_TRUE(process_idf(idf_objects)); compare_err_stream(""); + state->init_state(*state); + GetExhaustAbsorberInput(*state); compare_err_stream(""); @@ -331,6 +333,7 @@ TEST_F(EnergyPlusFixture, ExhAbsorption_GetInput_Test) TEST_F(EnergyPlusFixture, ExhAbsorption_getDesignCapacities_Test) { + state->init_state(*state); state->dataPlnt->TotNumLoops = 3; state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); @@ -634,6 +637,8 @@ TEST_F(EnergyPlusFixture, ExhAbsorption_calcHeater_Fix_Test) ASSERT_TRUE(process_idf(idf_objects)); compare_err_stream(""); + state->init_state(*state); + GetExhaustAbsorberInput(*state); auto &thisChillerHeater = state->dataChillerExhaustAbsorption->ExhaustAbsorber(1); @@ -647,7 +652,7 @@ TEST_F(EnergyPlusFixture, ExhAbsorption_calcHeater_Fix_Test) thisChillerHeater.HWPlantLoc.loopSideNum = DataPlant::LoopSideLocation::Demand; auto &hwPlantLoop = state->dataPlnt->PlantLoop(1); hwPlantLoop.FluidName = "WATER"; - hwPlantLoop.FluidIndex = 1; + hwPlantLoop.glycol = Fluid::GetWater(*state); hwPlantLoop.LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint; hwPlantLoop.LoopSide(DataPlant::LoopSideLocation::Demand).FlowLock = DataPlant::FlowLock::Locked; @@ -685,7 +690,7 @@ TEST_F(EnergyPlusFixture, ExhAbsorption_calcHeater_Fix_Test) bool const runflaginput = true; thisChillerHeater.calcHeater(*state, loadinput, runflaginput); - const Real64 CpHW = FluidProperties::GetSpecificHeatGlycol(*state, hwPlantLoop.FluidName, hwReturnTemp, hwPlantLoop.FluidIndex, "UnitTest"); + const Real64 CpHW = hwPlantLoop.glycol->getSpecificHeat(*state, hwReturnTemp, "UnitTest"); EXPECT_EQ(4185.0, CpHW); const Real64 expectedHeatingLoad = (hwSupplySetpoint - hwReturnTemp) * hwMassFlow * CpHW; @@ -1121,6 +1126,8 @@ TEST_F(EnergyPlusFixture, ExhAbsorption_GetInput_Multiple_Objects_Test) ASSERT_TRUE(process_idf(idf_objects)); compare_err_stream(""); + state->init_state(*state); + GetExhaustAbsorberInput(*state); compare_err_stream(""); @@ -1430,6 +1437,8 @@ TEST_F(EnergyPlusFixture, ExhAbsorption_calcChiller_Err_Msg_Test) ASSERT_TRUE(process_idf(idf_objects)); compare_err_stream(""); + state->init_state(*state); + GetExhaustAbsorberInput(*state); auto &thisChillerHeater = state->dataChillerExhaustAbsorption->ExhaustAbsorber(1); @@ -1445,7 +1454,7 @@ TEST_F(EnergyPlusFixture, ExhAbsorption_calcChiller_Err_Msg_Test) thisChillerHeater.CWPlantLoc.loopSideNum = DataPlant::LoopSideLocation::Demand; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).FlowLock = DataPlant::FlowLock::Locked; state->dataLoopNodes->Node(3).Temp = 60.0; diff --git a/tst/EnergyPlus/unit/ChillerGasAbsorption.unit.cc b/tst/EnergyPlus/unit/ChillerGasAbsorption.unit.cc index f2cf123a9e9..c131762976a 100644 --- a/tst/EnergyPlus/unit/ChillerGasAbsorption.unit.cc +++ b/tst/EnergyPlus/unit/ChillerGasAbsorption.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -140,6 +140,7 @@ TEST_F(EnergyPlusFixture, GasAbsorption_GetInput_Test) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetGasAbsorberInput(*state); @@ -171,6 +172,7 @@ TEST_F(EnergyPlusFixture, GasAbsorption_GetInput_Test) TEST_F(EnergyPlusFixture, GasAbsorption_getDesignCapacities_Test) { + state->init_state(*state); state->dataPlnt->TotNumLoops = 3; state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); @@ -317,6 +319,7 @@ TEST_F(EnergyPlusFixture, GasAbsorption_calculateHeater_Fix_Test) ASSERT_TRUE(process_idf(idf_objects)); compare_err_stream(""); + state->init_state(*state); GetGasAbsorberInput(*state); @@ -333,7 +336,7 @@ TEST_F(EnergyPlusFixture, GasAbsorption_calculateHeater_Fix_Test) thisChillerHeater.HWplantLoc.loopNum = 1; thisChillerHeater.HWplantLoc.loopSideNum = DataPlant::LoopSideLocation::Demand; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).FlowLock = DataPlant::FlowLock::Locked; state->dataLoopNodes->Node(3).Temp = 60.0; diff --git a/tst/EnergyPlus/unit/ChillerIndirectAbsorption.unit.cc b/tst/EnergyPlus/unit/ChillerIndirectAbsorption.unit.cc index 440aaf0adb7..28345cbe5e7 100644 --- a/tst/EnergyPlus/unit/ChillerIndirectAbsorption.unit.cc +++ b/tst/EnergyPlus/unit/ChillerIndirectAbsorption.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/ChillerReformulatedEIR.unit.cc b/tst/EnergyPlus/unit/ChillerReformulatedEIR.unit.cc index f3c9696983f..80b1ebe318b 100644 --- a/tst/EnergyPlus/unit/ChillerReformulatedEIR.unit.cc +++ b/tst/EnergyPlus/unit/ChillerReformulatedEIR.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -76,15 +76,14 @@ TEST_F(EnergyPlusFixture, ChillerElectricReformulatedEIR_WaterCooledChillerVaria state->dataPlnt->TotNumLoops = 2; state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.20; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->MinutesInTimeStep = 60; state->dataGlobal->HourOfDay = 1; state->dataEnvrn->DayOfWeek = 1; state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 1; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - Psychrometrics::InitializePsychRoutines(*state); std::string const idf_objects = delimited_string({ "Chiller:Electric:ReformulatedEIR,", @@ -134,6 +133,8 @@ TEST_F(EnergyPlusFixture, ChillerElectricReformulatedEIR_WaterCooledChillerVaria EXPECT_TRUE(process_idf(idf_objects, false)); + state->init_state(*state); + state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); for (int l = 1; l <= state->dataPlnt->TotNumLoops; ++l) { @@ -150,9 +151,9 @@ TEST_F(EnergyPlusFixture, ChillerElectricReformulatedEIR_WaterCooledChillerVaria state->dataLoopNodes->Node.allocate(4); state->dataPlnt->PlantLoop(1).Name = "ChilledWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).PlantSizNum = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).TempSetPointNodeNum = 10; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = thisChiller.Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = @@ -168,9 +169,9 @@ TEST_F(EnergyPlusFixture, ChillerElectricReformulatedEIR_WaterCooledChillerVaria state->dataSize->PlantSizData(1).DeltaT = 5.0; state->dataPlnt->PlantLoop(2).Name = "CondenserWaterLoop"; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).PlantSizNum = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = thisChiller.Name; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::Chiller_ElectricReformEIR; @@ -189,7 +190,7 @@ TEST_F(EnergyPlusFixture, ChillerElectricReformulatedEIR_WaterCooledChillerVaria thisChiller.size(*state); MyLoad = -thisChiller.RefCap; state->dataSize->PlantSizData(1).DesCapacity = std::abs(MyLoad) * 2; - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // run through init again after sizing is complete to set mass flow rate state->dataGlobal->BeginEnvrnFlag = true; @@ -209,11 +210,8 @@ TEST_F(EnergyPlusFixture, ChillerElectricReformulatedEIR_WaterCooledChillerVaria EXPECT_NEAR(thisChiller.CondMassFlowRate, thisChiller.CondMassFlowRateMax / 2, 0.00001); thisChiller.CondenserFlowControl = DataPlant::CondenserFlowControl::ModulatedDeltaTemperature; - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(*state, - state->dataPlnt->PlantLoop(thisChiller.CWPlantLoc.loopNum).FluidName, - thisChiller.CondInletTemp, - state->dataPlnt->PlantLoop(thisChiller.CWPlantLoc.loopNum).FluidIndex, - "ChillerElectricEIR_WaterCooledChillerVariableSpeedCondenser"); + Real64 Cp = state->dataPlnt->PlantLoop(thisChiller.CWPlantLoc.loopNum) + .glycol->getSpecificHeat(*state, thisChiller.CondInletTemp, "ChillerElectricEIR_WaterCooledChillerVariableSpeedCondenser"); thisChiller.control(*state, MyLoad, RunFlag, false); Real64 ActualCondFlow = 3.0 * std::abs(MyLoad) / (Cp * 10.0); EXPECT_NEAR(thisChiller.CondMassFlowRate, ActualCondFlow, 0.00001); diff --git a/tst/EnergyPlus/unit/Coils/CoilCoolingDX.unit.cc b/tst/EnergyPlus/unit/Coils/CoilCoolingDX.unit.cc index 7dafe1b8074..4d8ab0d723a 100644 --- a/tst/EnergyPlus/unit/Coils/CoilCoolingDX.unit.cc +++ b/tst/EnergyPlus/unit/Coils/CoilCoolingDX.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -71,8 +71,9 @@ TEST_F(CoilCoolingDXTest, CoilCoolingDXInput) { std::string idf_objects = this->getCoilObjectString("coolingCoil", false, 2); EXPECT_TRUE(process_idf(idf_objects, false)); + state->init_state(*state); int coilIndex = CoilCoolingDX::factory(*state, "coolingCoil"); - auto const &thisCoil(state->dataCoilCooingDX->coilCoolingDXs[coilIndex]); + auto const &thisCoil(state->dataCoilCoolingDX->coilCoolingDXs[coilIndex]); EXPECT_EQ("COOLINGCOIL", thisCoil.name); EXPECT_EQ("PERFORMANCEOBJECTNAME", thisCoil.performance.name); } @@ -144,8 +145,9 @@ TEST_F(CoilCoolingDXTest, CoilCoolingDXAlternateModePerformance) " 1.0, !- Active Fraction of Coil Face Area", " ,,,,,,,,,,,;"}); EXPECT_TRUE(process_idf(idf_objects, false)); + state->init_state(*state); int coilIndex = CoilCoolingDX::factory(*state, "Coil"); - auto &thisCoil(state->dataCoilCooingDX->coilCoolingDXs[coilIndex]); + auto &thisCoil(state->dataCoilCoolingDX->coilCoolingDXs[coilIndex]); // fix the inlet conditions auto &evapInletNode = state->dataLoopNodes->Node(thisCoil.evapInletNodeIndex); @@ -280,8 +282,9 @@ TEST_F(CoilCoolingDXTest, CoilCoolingDXAlternateModePerformanceHitsSaturation) " 1.0, !- Active Fraction of Coil Face Area", " ,,,,,,,,,,,;"}); EXPECT_TRUE(process_idf(idf_objects, false)); + state->init_state(*state); int coilIndex = CoilCoolingDX::factory(*state, "Coil"); - auto &thisCoil(state->dataCoilCooingDX->coilCoolingDXs[coilIndex]); + auto &thisCoil(state->dataCoilCoolingDX->coilCoolingDXs[coilIndex]); // fix the inlet conditions auto &evapInletNode = state->dataLoopNodes->Node(thisCoil.evapInletNodeIndex); @@ -395,7 +398,7 @@ TEST_F(EnergyPlusFixture, DISABLED_CoilDXCoolingVsMultiSpeed_CycFanCycCoil) Coil.DXCoilType_Num = HVAC::CoilDX_MultiSpeedCooling; Coil.DXCoilType = "Coil:Cooling:DX:MultiSpeed"; Coil.FuelType = Constant::eFuel::Electricity; - Coil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; + Coil.availSched = Sched::GetScheduleAlwaysOn(*state); Coil.NumOfSpeeds = 2; Coil.MSRatedTotCap.allocate(Coil.NumOfSpeeds); Coil.MSRatedSHR.allocate(Coil.NumOfSpeeds); @@ -668,8 +671,9 @@ TEST_F(EnergyPlusFixture, DISABLED_CoilDXCoolingVsMultiSpeed_CycFanCycCoil) }); EXPECT_TRUE(process_idf(idf_objects, false)); + state->init_state(*state); int coilIndex = CoilCoolingDX::factory(*state, "Coil"); - auto &thisCoil(state->dataCoilCooingDX->coilCoolingDXs[coilIndex]); + auto &thisCoil(state->dataCoilCoolingDX->coilCoolingDXs[coilIndex]); // fix the inlet conditions auto &evapInletNode = state->dataLoopNodes->Node(thisCoil.evapInletNodeIndex); @@ -811,7 +815,7 @@ TEST_F(EnergyPlusFixture, DISABLED_CoilDXCoolingVsMultiSpeed_ContFanCycCoil) Coil.DXCoilType_Num = HVAC::CoilDX_MultiSpeedCooling; Coil.DXCoilType = "Coil:Cooling:DX:MultiSpeed"; Coil.FuelType = Constant::eFuel::Electricity; - Coil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; + Coil.availSched = Sched::GetScheduleAlwaysOn(*state); Coil.NumOfSpeeds = 2; Coil.MSRatedTotCap.allocate(Coil.NumOfSpeeds); Coil.MSRatedSHR.allocate(Coil.NumOfSpeeds); @@ -1085,8 +1089,9 @@ TEST_F(EnergyPlusFixture, DISABLED_CoilDXCoolingVsMultiSpeed_ContFanCycCoil) }); EXPECT_TRUE(process_idf(idf_objects, false)); + state->init_state(*state); int coilIndex = CoilCoolingDX::factory(*state, "Coil"); - auto &thisCoil(state->dataCoilCooingDX->coilCoolingDXs[coilIndex]); + auto &thisCoil(state->dataCoilCoolingDX->coilCoolingDXs[coilIndex]); // fix the inlet conditions auto &evapInletNode = state->dataLoopNodes->Node(thisCoil.evapInletNodeIndex); @@ -1227,7 +1232,7 @@ TEST_F(EnergyPlusFixture, DISABLED_CoilDXMultiSpeed_SpeedCheck_CycFanCycCoil) Coil.DXCoilType_Num = HVAC::CoilDX_MultiSpeedCooling; Coil.DXCoilType = "Coil:Cooling:DX:MultiSpeed"; Coil.FuelType = Constant::eFuel::Electricity; - Coil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; + Coil.availSched = Sched::GetScheduleAlwaysOn(*state); Coil.NumOfSpeeds = 2; Coil.MSRatedTotCap.allocate(Coil.NumOfSpeeds); Coil.MSRatedSHR.allocate(Coil.NumOfSpeeds); @@ -1458,7 +1463,7 @@ TEST_F(EnergyPlusFixture, DISABLED_CoilDXMultiSpeed_SpeedCheck_ContFanCycCoil) Coil.DXCoilType_Num = HVAC::CoilDX_MultiSpeedCooling; Coil.DXCoilType = "Coil:Cooling:DX:MultiSpeed"; Coil.FuelType = Constant::eFuel::Electricity; - Coil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; + Coil.availSched = Sched::GetScheduleAlwaysOn(*state); Coil.NumOfSpeeds = 2; Coil.MSRatedTotCap.allocate(Coil.NumOfSpeeds); Coil.MSRatedSHR.allocate(Coil.NumOfSpeeds); @@ -1805,9 +1810,10 @@ TEST_F(CoilCoolingDXTest, CoilCoolingDX_LowerSpeedFlowSizingTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); int coilIndex = CoilCoolingDX::factory(*state, "DX Cooling Coil"); - auto &this_dx_clg_coil = state->dataCoilCooingDX->coilCoolingDXs[coilIndex]; + auto &this_dx_clg_coil = state->dataCoilCoolingDX->coilCoolingDXs[coilIndex]; // check dx cooling coil inputs EXPECT_EQ(this_dx_clg_coil.name, "DX COOLING COIL"); diff --git a/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitOperatingMode.unit.cc b/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitOperatingMode.unit.cc index 6266eab7d75..0c89be24114 100644 --- a/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitOperatingMode.unit.cc +++ b/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitOperatingMode.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -117,6 +117,8 @@ TEST_F(CoilCoolingDXTest, CoilCoolingDXCurveFitOperatingMode_Sizing) }); idf_objects += this->getSpeedObjectString("Coil Cooling DX Curve Fit Speed 1"); EXPECT_TRUE(process_idf(idf_objects, false)); + state->init_state(*state); + CoilCoolingDXCurveFitOperatingMode thisMode(*state, "Coil Cooling DX Curve Fit Operating Mode 1"); EXPECT_ENUM_EQ(CoilCoolingDXCurveFitOperatingMode::CondenserType::EVAPCOOLED, thisMode.condenserType); EXPECT_EQ(DataSizing::AutoSize, thisMode.ratedEvapAirFlowRate); @@ -260,8 +262,10 @@ TEST_F(CoilCoolingDXTest, CoilCoolingDXCurveFitCrankcaseHeaterCurve) idf_objects += this->getSpeedObjectString("Coil Cooling DX Curve Fit Speed 1"); EXPECT_TRUE(process_idf(idf_objects, false)); + state->init_state(*state); + int coilIndex = CoilCoolingDX::factory(*state, "Coil Cooling DX 1"); - auto &thisCoil(state->dataCoilCooingDX->coilCoolingDXs[coilIndex]); + auto &thisCoil(state->dataCoilCoolingDX->coilCoolingDXs[coilIndex]); EXPECT_EQ("COIL COOLING DX 1", thisCoil.name); EXPECT_EQ("COIL COOLING DX CURVE FIT PERFORMANCE 1", thisCoil.performance.name); EXPECT_EQ("HEATERCAPCURVE", Curve::GetCurveName(*state, thisCoil.performance.crankcaseHeaterCapacityCurveIndex)); diff --git a/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitPerformance.unit.cc b/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitPerformance.unit.cc index d11d0cf4c68..4f673cfe132 100644 --- a/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitPerformance.unit.cc +++ b/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitPerformance.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -59,6 +59,7 @@ TEST_F(CoilCoolingDXTest, CoilCoolingDXCurveFitPerformanceInput) { std::string idf_objects = this->getPerformanceObjectString("coilPerformance", false, 2); EXPECT_TRUE(process_idf(idf_objects, false)); + state->init_state(*state); CoilCoolingDXCurveFitPerformance thisPerf(*state, "coilPerformance"); EXPECT_EQ("COILPERFORMANCE", thisPerf.name); EXPECT_EQ("BASEOPERATINGMODE", thisPerf.normalMode.name); @@ -69,6 +70,7 @@ TEST_F(CoilCoolingDXTest, CoilCoolingDXCurveFitPerformanceInputAlternateMode) { std::string idf_objects = this->getPerformanceObjectString("coilPerformance", true, 2); EXPECT_TRUE(process_idf(idf_objects, false)); + state->init_state(*state); CoilCoolingDXCurveFitPerformance thisPerf(*state, "coilPerformance"); EXPECT_EQ("COILPERFORMANCE", thisPerf.name); EXPECT_EQ("BASEOPERATINGMODE", thisPerf.normalMode.name); diff --git a/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitSpeed.unit.cc b/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitSpeed.unit.cc index 43a27bd5dad..a5a7e551e1f 100644 --- a/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitSpeed.unit.cc +++ b/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitSpeed.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/Coils/CoilCoolingDXFixture.hh b/tst/EnergyPlus/unit/Coils/CoilCoolingDXFixture.hh index 2ceb5197ebb..9659a8aea40 100644 --- a/tst/EnergyPlus/unit/Coils/CoilCoolingDXFixture.hh +++ b/tst/EnergyPlus/unit/Coils/CoilCoolingDXFixture.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/CommandLineInterface.unit.cc b/tst/EnergyPlus/unit/CommandLineInterface.unit.cc index 7fb32b7e246..75bd5eae692 100644 --- a/tst/EnergyPlus/unit/CommandLineInterface.unit.cc +++ b/tst/EnergyPlus/unit/CommandLineInterface.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/CondenserLoopTowers.unit.cc b/tst/EnergyPlus/unit/CondenserLoopTowers.unit.cc index 41e89f21271..a92b7159cfc 100644 --- a/tst/EnergyPlus/unit/CondenserLoopTowers.unit.cc +++ b/tst/EnergyPlus/unit/CondenserLoopTowers.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -148,19 +148,6 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_MerkelNoCooling) " ScheduleTypeLimits,", " Any Number; !- Name", - " Schedule:Compact,", - " ALWAYS_ON, !- Name", - " On/Off, !- Schedule Type Limits Name", - " Through: 12/31, !- Field 1", - " For: AllDays, !- Field 2", - " Until: 24:00,1; !- Field 3", - - " ScheduleTypeLimits,", - " On/Off, !- Name", - " 0, !- Lower Limit Value", - " 1, !- Upper Limit Value", - " DISCRETE; !- Numeric Type", - " CoolingTower:VariableSpeed:Merkel,", " TowerWaterSys CoolTower1,!- Name", " TowerWaterSys Pump-TowerWaterSys CoolTowerNode, !- Water Inlet Node Name", @@ -298,7 +285,7 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_MerkelNoCooling) " TowerWaterSys Loop Operation Scheme List, !- Name", " PlantEquipmentOperation:CoolingLoad, !- Control Scheme 1 Object Type", " TowerWaterSys Operation Scheme, !- Control Scheme 1 Name", - " ALWAYS_ON; !- Control Scheme 1 Schedule Name", + " CONSTANT-1.0; !- Control Scheme 1 Schedule Name", " PlantEquipmentOperation:CoolingLoad,", " TowerWaterSys Operation Scheme, !- Name", @@ -487,12 +474,13 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_MerkelNoCooling) }); ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::PostIPProcessing(*state); bool ErrorsFound = false; state->dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(*state); + + state->init_state(*state); + OutputReportPredefined::SetPredefinedTables(*state); // OutputProcessor::TimeValue.allocate(2); @@ -602,19 +590,6 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_SingleSpeedSizing) " ScheduleTypeLimits,", " Any Number; !- Name", - " Schedule:Compact,", - " ALWAYS_ON, !- Name", - " On/Off, !- Schedule Type Limits Name", - " Through: 12/31, !- Field 1", - " For: AllDays, !- Field 2", - " Until: 24:00,1; !- Field 3", - - " ScheduleTypeLimits,", - " On/Off, !- Name", - " 0, !- Lower Limit Value", - " 1, !- Upper Limit Value", - " DISCRETE; !- Numeric Type", - " CoolingTower:SingleSpeed,", " TowerWaterSys CoolTower1,!- Name", " TowerWaterSys Pump-TowerWaterSys CoolTowerNode, !- Water Inlet Node Name", @@ -692,7 +667,7 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_SingleSpeedSizing) " TowerWaterSys Loop Operation Scheme List, !- Name", " PlantEquipmentOperation:CoolingLoad, !- Control Scheme 1 Object Type", " TowerWaterSys Operation Scheme, !- Control Scheme 1 Name", - " ALWAYS_ON; !- Control Scheme 1 Schedule Name", + " CONSTANT-1.0; !- Control Scheme 1 Schedule Name", " PlantEquipmentOperation:CoolingLoad,", " TowerWaterSys Operation Scheme, !- Name", @@ -881,12 +856,13 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_SingleSpeedSizing) }); ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::PostIPProcessing(*state); bool ErrorsFound = false; state->dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(*state); + + state->init_state(*state); + OutputReportPredefined::SetPredefinedTables(*state); // OutputProcessor::TimeValue.allocate(2); @@ -1041,19 +1017,6 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_SingleSpeedUserInputTowerSizing) " ScheduleTypeLimits,", " Any Number; !- Name", - " Schedule:Compact,", - " ALWAYS_ON, !- Name", - " On/Off, !- Schedule Type Limits Name", - " Through: 12/31, !- Field 1", - " For: AllDays, !- Field 2", - " Until: 24:00,1; !- Field 3", - - " ScheduleTypeLimits,", - " On/Off, !- Name", - " 0, !- Lower Limit Value", - " 1, !- Upper Limit Value", - " DISCRETE; !- Numeric Type", - " CoolingTower:SingleSpeed,", " TowerWaterSys CoolTower1,!- Name", " TowerWaterSys Pump-TowerWaterSys CoolTowerNode, !- Water Inlet Node Name", @@ -1130,7 +1093,7 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_SingleSpeedUserInputTowerSizing) " TowerWaterSys Loop Operation Scheme List, !- Name", " PlantEquipmentOperation:CoolingLoad, !- Control Scheme 1 Object Type", " TowerWaterSys Operation Scheme, !- Control Scheme 1 Name", - " ALWAYS_ON; !- Control Scheme 1 Schedule Name", + " CONSTANT-1.0; !- Control Scheme 1 Schedule Name", " PlantEquipmentOperation:CoolingLoad,", " TowerWaterSys Operation Scheme, !- Name", @@ -1319,12 +1282,13 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_SingleSpeedUserInputTowerSizing) }); ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::PostIPProcessing(*state); + + state->init_state(*state); bool ErrorsFound = false; state->dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(*state); + OutputReportPredefined::SetPredefinedTables(*state); // OutputProcessor::TimeValue.allocate(2); @@ -1455,19 +1419,6 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_TwoSpeedUserInputTowerSizing) " ScheduleTypeLimits,", " Any Number; !- Name", - " Schedule:Compact,", - " ALWAYS_ON, !- Name", - " On/Off, !- Schedule Type Limits Name", - " Through: 12/31, !- Field 1", - " For: AllDays, !- Field 2", - " Until: 24:00,1; !- Field 3", - - " ScheduleTypeLimits,", - " On/Off, !- Name", - " 0, !- Lower Limit Value", - " 1, !- Upper Limit Value", - " DISCRETE; !- Numeric Type", - " CoolingTower:TwoSpeed,", " TowerWaterSys CoolTower1,!- Name", " TowerWaterSys Pump-TowerWaterSys CoolTowerNode, !- Water Inlet Node Name", @@ -1550,7 +1501,7 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_TwoSpeedUserInputTowerSizing) " TowerWaterSys Loop Operation Scheme List, !- Name", " PlantEquipmentOperation:CoolingLoad, !- Control Scheme 1 Object Type", " TowerWaterSys Operation Scheme, !- Control Scheme 1 Name", - " ALWAYS_ON; !- Control Scheme 1 Schedule Name", + " CONSTANT-1.0; !- Control Scheme 1 Schedule Name", " PlantEquipmentOperation:CoolingLoad,", " TowerWaterSys Operation Scheme, !- Name", @@ -1739,12 +1690,12 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_TwoSpeedUserInputTowerSizing) }); ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::PostIPProcessing(*state); + + state->init_state(*state); bool ErrorsFound = false; state->dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(*state); OutputReportPredefined::SetPredefinedTables(*state); // OutputProcessor::TimeValue.allocate(2); @@ -1890,19 +1841,6 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_MerkelUserInputTowerSizing) " ScheduleTypeLimits,", " Any Number; !- Name", - " Schedule:Compact,", - " ALWAYS_ON, !- Name", - " On/Off, !- Schedule Type Limits Name", - " Through: 12/31, !- Field 1", - " For: AllDays, !- Field 2", - " Until: 24:00,1; !- Field 3", - - " ScheduleTypeLimits,", - " On/Off, !- Name", - " 0, !- Lower Limit Value", - " 1, !- Upper Limit Value", - " DISCRETE; !- Numeric Type", - " CoolingTower:VariableSpeed:Merkel,", " TowerWaterSys CoolTower1,!- Name", " TowerWaterSys Pump-TowerWaterSys CoolTowerNode, !- Water Inlet Node Name", @@ -2040,7 +1978,7 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_MerkelUserInputTowerSizing) " TowerWaterSys Loop Operation Scheme List, !- Name", " PlantEquipmentOperation:CoolingLoad, !- Control Scheme 1 Object Type", " TowerWaterSys Operation Scheme, !- Control Scheme 1 Name", - " ALWAYS_ON; !- Control Scheme 1 Schedule Name", + " CONSTANT-1.0; !- Control Scheme 1 Schedule Name", " PlantEquipmentOperation:CoolingLoad,", " TowerWaterSys Operation Scheme, !- Name", @@ -2229,12 +2167,12 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_MerkelUserInputTowerSizing) }); ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::PostIPProcessing(*state); + + state->init_state(*state); bool ErrorsFound = false; state->dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(*state); OutputReportPredefined::SetPredefinedTables(*state); // OutputProcessor::TimeValue.allocate(2); @@ -2373,19 +2311,6 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_TwoSpeedTowerLowSpeedNomCapSizing) " ScheduleTypeLimits,", " Any Number; !- Name", - " Schedule:Compact,", - " ALWAYS_ON, !- Name", - " On/Off, !- Schedule Type Limits Name", - " Through: 12/31, !- Field 1", - " For: AllDays, !- Field 2", - " Until: 24:00,1; !- Field 3", - - " ScheduleTypeLimits,", - " On/Off, !- Name", - " 0, !- Lower Limit Value", - " 1, !- Upper Limit Value", - " DISCRETE; !- Numeric Type", - " CoolingTower:TwoSpeed,", " TowerWaterSys CoolTower1,!- Name", " TowerWaterSys Pump-TowerWaterSys CoolTowerNode, !- Water Inlet Node Name", @@ -2473,7 +2398,7 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_TwoSpeedTowerLowSpeedNomCapSizing) " TowerWaterSys Loop Operation Scheme List, !- Name", " PlantEquipmentOperation:CoolingLoad, !- Control Scheme 1 Object Type", " TowerWaterSys Operation Scheme, !- Control Scheme 1 Name", - " ALWAYS_ON; !- Control Scheme 1 Schedule Name", + " CONSTANT-1.0; !- Control Scheme 1 Schedule Name", " PlantEquipmentOperation:CoolingLoad,", " TowerWaterSys Operation Scheme, !- Name", @@ -2662,12 +2587,12 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_TwoSpeedTowerLowSpeedNomCapSizing) }); ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::PostIPProcessing(*state); + + state->init_state(*state); bool ErrorsFound = false; state->dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(*state); OutputReportPredefined::SetPredefinedTables(*state); // OutputProcessor::TimeValue.allocate(2); @@ -3053,10 +2978,11 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_SingleSpeedUser_SizingError_Sizing }); ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::PostIPProcessing(*state); + + state->init_state(*state); state->dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(*state); + OutputReportPredefined::SetPredefinedTables(*state); // OutputProcessor::TimeValue.allocate(2); @@ -3445,10 +3371,10 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_SingleSpeedUser_SizingError_UserSp }); ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::PostIPProcessing(*state); + + state->init_state(*state); state->dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(*state); OutputReportPredefined::SetPredefinedTables(*state); // OutputProcessor::TimeValue.allocate(2); @@ -3584,19 +3510,6 @@ TEST_F(EnergyPlusFixture, VSCoolingTowers_WaterOutletTempTest) " ScheduleTypeLimits,", " Any Number; !- Name", - " Schedule:Compact,", - " ALWAYS_ON, !- Name", - " On/Off, !- Schedule Type Limits Name", - " Through: 12/31, !- Field 1", - " For: AllDays, !- Field 2", - " Until: 24:00,1; !- Field 3", - - " ScheduleTypeLimits,", - " On/Off, !- Name", - " 0, !- Lower Limit Value", - " 1, !- Upper Limit Value", - " DISCRETE; !- Numeric Type", - " CoolingTower:VariableSpeed,", " CoolingTower Variable Speed, !- Name", " Tower Inlet Node, !- Water Inlet Node Name", @@ -3712,10 +3625,10 @@ TEST_F(EnergyPlusFixture, VSCoolingTowers_WaterOutletTempTest) " CoolingTower Loop Operation Scheme List, !- Name", " PlantEquipmentOperation:CoolingLoad, !- Control Scheme 1 Object Type", " CoolingTower Operation Scheme, !- Control Scheme 1 Name", - " ALWAYS_ON, !- Control Scheme 1 Schedule Name", + " CONSTANT-1.0, !- Control Scheme 1 Schedule Name", " PlantEquipmentOperation:ComponentSetpoint, !- Control Scheme 3 Object Type", " CoolingTower Loop Setpoint Operation Scheme, !- Control Scheme 3 Name", - " ALWAYS_ON; !- Control Scheme 3 Schedule Name", + " CONSTANT-1.0; !- Control Scheme 3 Schedule Name", " PlantEquipmentOperation:ComponentSetpoint,", " CoolingTower Loop Setpoint Operation Scheme, !- Name", @@ -3919,10 +3832,10 @@ TEST_F(EnergyPlusFixture, VSCoolingTowers_WaterOutletTempTest) }); ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::PostIPProcessing(*state); + + state->init_state(*state); state->dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(*state); OutputReportPredefined::SetPredefinedTables(*state); OutputProcessor::SetupTimePointers(*state, OutputProcessor::TimeStepType::Zone, state->dataGlobal->TimeStepZone); @@ -4176,6 +4089,9 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_CoolingTowersDefaultValuesTest) }); ASSERT_TRUE(process_idf(idf_objects)); + + state->init_state(*state); + // cooling towers get input CondenserLoopTowers::GetTowerInput(*state); @@ -4294,6 +4210,9 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_CalculateVariableTowerOutletTemp) }); ASSERT_TRUE(process_idf(idf_objects)); + + state->init_state(*state); + // cooling tower get input CondenserLoopTowers::GetTowerInput(*state); int index; @@ -4338,7 +4257,7 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_checkMassFlowAndLoadTest) state->dataEnvrn->OutDryBulbTemp = 27.0; tower.WaterMassFlowRate = 0.0; tower.BasinHeaterPowerFTempDiff = 1.0; - tower.BasinHeaterSchedulePtr = 0; + tower.basinHeaterSched = nullptr; tower.BasinHeaterSetPointTemp = 26.0; tower.BasinHeaterPower = 1.0; expectedPower = 0.0; @@ -4353,7 +4272,7 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_checkMassFlowAndLoadTest) state->dataEnvrn->OutDryBulbTemp = 27.0; tower.WaterMassFlowRate = 0.5; tower.BasinHeaterPowerFTempDiff = 1.0; - tower.BasinHeaterSchedulePtr = 0; + tower.basinHeaterSched = nullptr; tower.BasinHeaterSetPointTemp = 25.0; tower.BasinHeaterPower = 2.0; tower.FanPower = 1.0; @@ -4377,7 +4296,7 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_checkMassFlowAndLoadTest) state->dataEnvrn->OutDryBulbTemp = 27.0; tower.WaterMassFlowRate = 0.5; tower.BasinHeaterPowerFTempDiff = 1.0; - tower.BasinHeaterSchedulePtr = 0; + tower.basinHeaterSched = nullptr; tower.BasinHeaterSetPointTemp = 25.0; tower.BasinHeaterPower = 3.0; expectedPower = 3.0; @@ -4386,4 +4305,92 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_checkMassFlowAndLoadTest) EXPECT_NEAR(expectedPower, tower.BasinHeaterPower, allowedTolerance); } +TEST_F(EnergyPlusFixture, CondenserLoopTowers_checkTowerIndices) +{ + std::string const idf_objects = delimited_string({ + " CoolingTower:VariableSpeed,", + " CoolingTower-plant_loops-170, !- Name", + " Node 40, !- Water Inlet Node Name", + " Node 41, !- Water Outlet Node Name", + " YorkCalc, !- Model Type", + " , !- Model Coefficient Name", + " 25, !- Design Inlet Air Wet-Bulb Temperature {C}", + " 4.44, !- Design Approach Temperature {deltaC}", + " 5.56, !- Design Range Temperature {deltaC}", + " autosize, !- Design Water Flow Rate {m3/s}", + " Autosize, !- Design Air Flow Rate {m3/s}", + " 3544.15691546004, !- Design Fan Power {W}", + " Variable Speed Cooling Tower Fan Power Ratio Function of Air Flow Rate, !- Fan Power Ratio Function of Air Flow Rate Ratio Curve Name", + " 0.25, !- Minimum Air Flow Rate Ratio", + " 0.125, !- Fraction of Tower Capacity in Free Convection Regime", + " 0, !- Basin Heater Capacity {W/K}", + " 2, !- Basin Heater Setpoint Temperature {C}", + " , !- Basin Heater Operating Schedule Name", + " LossFactor, !- Evaporation Loss Mode", + " 0.2, !- Evaporation Loss Factor {percent/K}", + " 0.008, !- Drift Loss Percent {percent}", + " ConcentrationRatio, !- Blowdown Calculation Mode", + " 3, !- Blowdown Concentration Ratio", + " , !- Blowdown Makeup Water Usage Schedule Name", + " , !- Supply Water Storage Tank Name", + " , !- Outdoor Air Inlet Node Name", + " 2, !- Number of Cells", + " MaximalCell, !- Cell Control", + " 0.25, !- Cell Minimum Water Flow Rate Fraction", + " 2.5, !- Cell Maximum Water Flow Rate Fraction", + " 1, !- Sizing Factor", + " General; !- End-Use Subcategory", + " CoolingTower:TwoSpeed,", + " TowerWaterSys CoolTower1,!- Name", + " TowerWaterSys Pump-TowerWaterSys CoolTowerNode, !- Water Inlet Node Name", + " TowerWaterSys Supply Equipment Outlet Node, !- Water Outlet Node Name", + " , !- Design Water Flow Rate {m3/s}", + " AUTOSIZE, !- High Fan Speed Air Flow Rate {m3/s}", + " AUTOSIZE, !- High Fan Speed Fan Power {W}", + " , !- High Fan Speed U-Factor Times Area Value {W/K}", + " autocalculate, !- Low Fan Speed Air Flow Rate {m3/s}", + " , !- Low Fan Speed Air Flow Rate Sizing Factor", + " AUTOSIZE, !- Low Fan Speed Fan Power {W}", + " , !- Low Fan Speed Fan Power Sizing Factor", + " AUTOSIZE, !- Low Fan Speed U-Factor Times Area Value {W/K}", + " , !- Low Fan Speed U-Factor Times Area Sizing Factor", + " 0.9, !- Free Convection Regime Air Flow Rate {m3/s}", + " , !- Free Convection Regime Air Flow Rate Sizing Factor", + " autocalculate, !- Free Convection Regime U-Factor Times Area Value {W/K}", + " , !- Free Convection U-Factor Times Area Value Sizing Factor", + " NominalCapacity, !- Performance Input Method", + " , !- Heat Rejection Capacity and Nominal Capacity Sizing Ratio", + " 1E+5, !- High Speed Nominal Capacity {W}", + " 1E+4, !- Low Speed Nominal Capacity {W}", + " , !- Low Speed Nominal Capacity Sizing Factor", + " 5E+3, !- Free Convection Nominal Capacity {W}", + " , !- Free Convection Nominal Capacity Sizing Factor", + " 35.0, !- Design Inlet Air Dry-Bulb Temperature", + " 25.6, !- Design Inlet Air Wet-Bulb Temperature", + " 3.9, !- Design Approach Temperature", + " 5.5, !- Design Range Temperature", + " , !- Basin Heater Capacity {W/K}", + " , !- Basin Heater Setpoint Temperature {C}", + " , !- Basin Heater Operating Schedule Name", + " , !- Evaporation Loss Mode", + " , !- Evaporation Loss Factor {percent/K}", + " , !- Drift Loss Percent {percent}", + " , !- Blowdown Calculation Mode", + " , !- Blowdown Concentration Ratio", + " , !- Blowdown Makeup Water Usage Schedule Name", + " , !- Supply Water Storage Tank Name", + " ; !- Outdoor Air Inlet Node Name", + }); + + ASSERT_TRUE(process_idf(idf_objects)); + // cooling tower get input + CondenserLoopTowers::GetTowerInput(*state); + int index; + index = Util::FindItemInList("COOLINGTOWER-PLANT_LOOPS-170", state->dataCondenserLoopTowers->towers); + EXPECT_TRUE(index == 2); + + index = Util::FindItemInList("TOWERWATERSYS COOLTOWER1", state->dataCondenserLoopTowers->towers); + EXPECT_TRUE(index == 1); +} + } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/Construction.unit.cc b/tst/EnergyPlus/unit/Construction.unit.cc index 4a542cdf872..f28056a1caa 100644 --- a/tst/EnergyPlus/unit/Construction.unit.cc +++ b/tst/EnergyPlus/unit/Construction.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/ConstructionInternalSource.unit.cc b/tst/EnergyPlus/unit/ConstructionInternalSource.unit.cc index 5d2f0df1049..dfc21bcff98 100644 --- a/tst/EnergyPlus/unit/ConstructionInternalSource.unit.cc +++ b/tst/EnergyPlus/unit/ConstructionInternalSource.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/ConvectionCoefficients.unit.cc b/tst/EnergyPlus/unit/ConvectionCoefficients.unit.cc index 69790886002..0f0d6fdd5aa 100644 --- a/tst/EnergyPlus/unit/ConvectionCoefficients.unit.cc +++ b/tst/EnergyPlus/unit/ConvectionCoefficients.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -584,6 +584,7 @@ TEST_F(ConvectionCoefficientsFixture, initExtConvCoeffAdjRatio) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound(false); HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); // read project control data @@ -804,6 +805,7 @@ TEST_F(ConvectionCoefficientsFixture, initIntConvCoeffAdjRatio) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound(false); HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); // read project control data @@ -890,6 +892,7 @@ TEST_F(ConvectionCoefficientsFixture, DynamicIntConvSurfaceClassification) std::string const idf_objects = this->getIDFString(); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool errorsFound(false); HeatBalanceManager::GetProjectControlData(*state, errorsFound); // read project control data @@ -1385,7 +1388,7 @@ TEST_F(ConvectionCoefficientsFixture, TestCalcFisherPedersenCeilDiffuserCorrelat CalculatedHconv = Convect::CalcFisherPedersenCeilDiffuserWalls(*state, ACH, Tsurf, Tair, cosTilt, humRat, height, isWindow); EXPECT_NEAR(ExpectedHconv, CalculatedHconv, 0.0001); - // Test 3: Mixed Covection All Correlations (Floor, Ceiling, Wall) + // Test 3: Mixed Convection All Correlations (Floor, Ceiling, Wall) ACH = 1.75; Tsurf = 23.0; Tair = 18.0; @@ -1440,6 +1443,7 @@ TEST_F(ConvectionCoefficientsFixture, CalcBeausoleilMorrisonMixedAssistedWall) std::string const idf_objects = this->getIDFString(); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataEnvrn->OutBaroPress = 101325.0; @@ -1495,6 +1499,7 @@ TEST_F(ConvectionCoefficientsFixture, CalcBeausoleilMorrisonMixedOpposingWall) std::string const idf_objects = this->getIDFString(); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataEnvrn->OutBaroPress = 101325.0; @@ -1550,6 +1555,7 @@ TEST_F(ConvectionCoefficientsFixture, CalcBeausoleilMorrisonMixedStableFloor) std::string const idf_objects = this->getIDFString(); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataEnvrn->OutBaroPress = 101325.0; @@ -1605,6 +1611,7 @@ TEST_F(ConvectionCoefficientsFixture, CalcBeausoleilMorrisonMixedUnstableFloor) std::string const idf_objects = this->getIDFString(); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataEnvrn->OutBaroPress = 101325.0; @@ -1660,6 +1667,7 @@ TEST_F(ConvectionCoefficientsFixture, CalcBeausoleilMorrisonMixedStableCeiling) std::string const idf_objects = this->getIDFString(); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataEnvrn->OutBaroPress = 101325.0; @@ -1715,6 +1723,7 @@ TEST_F(ConvectionCoefficientsFixture, CalcBeausoleilMorrisonMixedUnstableCeiling std::string const idf_objects = this->getIDFString(); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataEnvrn->OutBaroPress = 101325.0; @@ -1913,6 +1922,7 @@ TEST_F(EnergyPlusFixture, AdaptiveModelSelections_ProperConstruction) "Default algorithms; !- Name"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Convect::HcInt algo; @@ -2041,6 +2051,7 @@ TEST_F(EnergyPlusFixture, AdaptiveModelSelections_Implicit) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataHeatBalSurf->SurfTempInTmp.allocate(6); state->dataHeatBalSurf->SurfTempInTmp(1) = 15.0; @@ -2281,6 +2292,7 @@ TEST_F(EnergyPlusFixture, AdaptiveModelSelections_ExplicitSelection) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataHeatBalSurf->SurfTempInTmp.allocate(6); state->dataHeatBalSurf->SurfTempInTmp(1) = 15.0; @@ -2620,6 +2632,7 @@ TEST_F(ConvectionCoefficientsFixture, TestSetAdaptiveConvectionAlgoCoefficient) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataHeatBalSurf->SurfTempInTmp.allocate(6); state->dataHeatBalSurf->SurfTempInTmp(1) = 15.0; @@ -2783,6 +2796,7 @@ TEST_F(ConvectionCoefficientsFixture, TestBlockenWindward) std::string const idf_objects = this->getIDFString(); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound(false); HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); // read project control data @@ -2871,6 +2885,7 @@ TEST_F(ConvectionCoefficientsFixture, TestMultipleSurfaceConvectionArrayAllocati }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataSurface->surfIntConv.allocate(2); state->dataSurface->surfExtConv.allocate(2); @@ -2898,6 +2913,7 @@ TEST_F(ConvectionCoefficientsFixture, TestMultipleSurfaceConvectionArrayAllocati }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataSurface->surfIntConv.allocate(2); state->dataSurface->surfExtConv.allocate(2); @@ -2921,6 +2937,7 @@ TEST_F(ConvectionCoefficientsFixture, TestSurfaceConvectionArrayAllocation1) " 10; !- Convection Coefficient 2"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataSurface->Surface.allocate(2); state->dataSurface->Surface(1).Name = "FAKESURFACE"; @@ -2950,6 +2967,7 @@ TEST_F(ConvectionCoefficientsFixture, TestSurfaceConvectionArrayAllocation2) " 10; !- Convection Coefficient 2"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataSurface->Surface.allocate(2); state->dataSurface->Surface(1).Name = "FAKESURFACE"; @@ -3138,6 +3156,7 @@ TEST_F(ConvectionCoefficientsFixture, RoofPerimeter_PerfectSquare_Rotated) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; @@ -3360,6 +3379,7 @@ TEST_F(ConvectionCoefficientsFixture, RoofPerimeter_WeirderShape) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; @@ -3981,15 +4001,18 @@ TEST_F(ConvectionCoefficientsFixture, SurroundingSurfacesHRadCoefTest) bool ErrorsFound = false; ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + + state->dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStepZone = 1; + state->dataGlobal->TimeStepZoneSec = 3600.0; + // set global and environmental variables state->dataGlobal->BeginSimFlag = true; state->dataGlobal->BeginEnvrnFlag = true; state->dataGlobal->HourOfDay = 15; - state->dataGlobal->TimeStep = 1; - state->dataGlobal->TimeStepZone = 1; - state->dataGlobal->TimeStepZoneSec = 3600.0; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; state->dataEnvrn->Month = 7; state->dataEnvrn->DayOfMonth = 21; state->dataEnvrn->DSTIndicator = 0; @@ -3997,9 +4020,6 @@ TEST_F(ConvectionCoefficientsFixture, SurroundingSurfacesHRadCoefTest) state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); state->dataEnvrn->OutBaroPress = 101325; - // process schedules - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; state->dataHeatBal->ZoneIntGain.allocate(1); // createFacilityElectricPowerServiceObject(*state); @@ -4017,7 +4037,7 @@ TEST_F(ConvectionCoefficientsFixture, SurroundingSurfacesHRadCoefTest) // reset sky and ground view factors HeatBalanceSurfaceManager::InitSurfacePropertyViewFactors(*state); // update schedule values for surrounding surfaces temperature - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); HeatBalanceSurfaceManager::GetSurroundingSurfacesTemperatureAverage(*state); // set outside face temperature of the exterior surfaces state->dataHeatBalSurf->SurfOutsideTempHist(1).dimension(state->dataSurface->TotSurfaces, 0.0); @@ -4047,11 +4067,11 @@ TEST_F(ConvectionCoefficientsFixture, SurroundingSurfacesHRadCoefTest) Real64 srdSurfacesViewFactorSum_result1 = srdSurfsProperty_north.SurroundingSurfs(1).ViewFactor + srdSurfsProperty_north.SurroundingSurfs(2).ViewFactor; EXPECT_DOUBLE_EQ(0.5, srdSurfacesViewFactorSum_result1); - // calculate surrounding surface radiation coeffient + // calculate surrounding surface radiation coefficient Real64 surf_tempExtK = state->dataHeatBalSurf->SurfOutsideTempHist(1)(surfNum) + Constant::Kelvin; auto &north_wall_const = state->dataConstruction->Construct(surface_north_wall.Construction); auto const *north_wall_mat = state->dataMaterial->materials(north_wall_const.LayerPoint(1)); - Real64 surf_absExt_north_wall = north_wall_mat->AbsorpThermal; // LW emitance of the exterior surface + Real64 surf_absExt_north_wall = north_wall_mat->AbsorpThermal; // LW emittance of the exterior surface // calculate surrounding surfaces radiation exchange coefficient Real64 north_wall_srdSurfsTK = surface_north_wall.SrdSurfTemp + Constant::Kelvin; EXPECT_NEAR(10.80, surface_north_wall.SrdSurfTemp, 1.0e-02); @@ -4086,11 +4106,11 @@ TEST_F(ConvectionCoefficientsFixture, SurroundingSurfacesHRadCoefTest) Real64 srdSurfacesViewFactorSum_result2 = srdSurfsProperty_east.SurroundingSurfs(1).ViewFactor + srdSurfsProperty_east.SurroundingSurfs(2).ViewFactor; EXPECT_DOUBLE_EQ(0.3, srdSurfacesViewFactorSum_result2); - // calculate surrounding surface radiation coeffient + // calculate surrounding surface radiation coefficient surf_tempExtK = state->dataHeatBalSurf->SurfOutsideTempHist(1)(surfNum) + Constant::Kelvin; auto &east_wall_const = state->dataConstruction->Construct(surface_east_wall.Construction); auto const *east_wall_mat = state->dataMaterial->materials(east_wall_const.LayerPoint(1)); - Real64 surf_absExt_east_wall = east_wall_mat->AbsorpThermal; // LW emitance of the exterior surface + Real64 surf_absExt_east_wall = east_wall_mat->AbsorpThermal; // LW emittance of the exterior surface // calculate surrounding surfaces radiation exchange coefficient Real64 east_wall_srdSurfsTK = surface_east_wall.SrdSurfTemp + Constant::Kelvin; EXPECT_NEAR(15.34, surface_east_wall.SrdSurfTemp, 1.0e-02); diff --git a/tst/EnergyPlus/unit/CoolTower.unit.cc b/tst/EnergyPlus/unit/CoolTower.unit.cc index a3c648d5900..66acf037b93 100644 --- a/tst/EnergyPlus/unit/CoolTower.unit.cc +++ b/tst/EnergyPlus/unit/CoolTower.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -84,6 +84,9 @@ TEST_F(EnergyPlusFixture, ExerciseCoolTower) " 200.0; !- Rated Power Consumption {W}"}); ASSERT_TRUE(process_idf(idf_objects, false)); + + state->init_state(*state); + state->dataHeatBal->Zone.allocate(1); state->dataHeatBal->Zone(1).Name = "ZONE 1"; state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); diff --git a/tst/EnergyPlus/unit/CrossVentMgr.unit.cc b/tst/EnergyPlus/unit/CrossVentMgr.unit.cc index 0e8267e91e2..4a05a8f2b49 100644 --- a/tst/EnergyPlus/unit/CrossVentMgr.unit.cc +++ b/tst/EnergyPlus/unit/CrossVentMgr.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/CurveManager.unit.cc b/tst/EnergyPlus/unit/CurveManager.unit.cc index 7c132b1065d..8d033da65d9 100644 --- a/tst/EnergyPlus/unit/CurveManager.unit.cc +++ b/tst/EnergyPlus/unit/CurveManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -55,6 +55,10 @@ #include #include #include +#include +#include + +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -742,3 +746,1244 @@ TEST_F(EnergyPlusFixture, CSV_CarriageReturns_Handling) EXPECT_FALSE(std::isnan(TestArray[i])); } } + +nlohmann::json const &getPatternProperties(nlohmann::json const &schema_obj) +{ + auto const &pattern_properties = schema_obj["patternProperties"]; + int dot_star_present = pattern_properties.count(".*"); + std::string pattern_property; + if (dot_star_present > 0) { + pattern_property = ".*"; + } else { + int no_whitespace_present = pattern_properties.count(R"(^.*\S.*$)"); + if (no_whitespace_present > 0) { + pattern_property = R"(^.*\S.*$)"; + } else { + throw std::runtime_error(R"(The patternProperties value is not a valid choice (".*", "^.*\S.*$"))"); + } + } + auto const &schema_obj_props = pattern_properties[pattern_property]["properties"]; + return schema_obj_props; +} + +std::vector getPossibleChoicesFromSchema(const std::string &objectType, const std::string &fieldName) +{ + // Should consider making this public, at least to the EnergyPlusFixture, but maybe in the InputProcessor directly + // At which point, should handle the "anyOf" case, here I don't need it, so not bothering + static const auto json_schema = nlohmann::json::from_cbor(EmbeddedEpJSONSchema::embeddedEpJSONSchema()); + auto const &schema_properties = json_schema.at("properties"); + const auto &object_schema = schema_properties.at(objectType); + auto const &schema_obj_props = getPatternProperties(object_schema); + auto const &schema_field_obj = schema_obj_props.at(fieldName); + std::vector choices; + for (const auto &e : schema_field_obj.at("enum")) { + choices.push_back(e); + } + + return choices; +} + +TEST_F(EnergyPlusFixture, TableIndependentVariableUnitType_IsValid) +{ + std::vector unit_type_choices = getPossibleChoicesFromSchema("Table:IndependentVariable", "unit_type"); + for (const auto &input_unit_type : unit_type_choices) { + EXPECT_TRUE(Curve::IsCurveInputTypeValid(input_unit_type)) << input_unit_type << " is rejected by IsCurveInputTypeValid"; + } + EXPECT_EQ(8, unit_type_choices.size()); +} + +TEST_F(EnergyPlusFixture, TableLookupUnitType_IsValid) +{ + std::vector unit_type_choices = getPossibleChoicesFromSchema("Table:Lookup", "output_unit_type"); + for (const auto &output_unit_type : unit_type_choices) { + if (output_unit_type.empty()) { + continue; + } + EXPECT_TRUE(Curve::IsCurveOutputTypeValid(output_unit_type)) << output_unit_type << " is rejected by IsCurveOutputTypeValid"; + } + EXPECT_EQ(6, unit_type_choices.size()); +} + +class InputUnitTypeIsValid : public EnergyPlusFixture, public ::testing::WithParamInterface +{ +}; +TEST_P(InputUnitTypeIsValid, IndepentVariable) +{ + const auto &unit_type = GetParam(); + + std::string const idf_objects = delimited_string({ + "Table:IndependentVariable,", + " SAFlow, !- Name", + " Cubic, !- Interpolation Method", + " Constant, !- Extrapolation Method", + " 0.714, !- Minimum Value", + " 1.2857, !- Maximum Value", + " , !- Normalization Reference Value", + fmt::format(" {}, !- Unit Type", unit_type), + " , !- External File Name", + " , !- External File Column Number", + " , !- External File Starting Row Number", + " 0.714286, !- Value 1", + " 1.0,", + " 1.2857;", + + "Table:IndependentVariableList,", + " SAFlow_Variables, !- Name", + " SAFlow; !- Independent Variable 1 Name", + + "Table:Lookup,", + " CoolCapModFuncOfSAFlow, !- Name", + " SAFlow_Variables, !- Independent Variable List Name", + " , !- Normalization Method", + " , !- Normalization Divisor", + " 0.8234, !- Minimum Output", + " 1.1256, !- Maximum Output", + " Dimensionless, !- Output Unit Type", + " , !- External File Name", + " , !- External File Column Number", + " , !- External File Starting Row Number", + " 0.823403, !- Output Value 1", + " 1.0,", + " 1.1256;", + }); + + ASSERT_TRUE(process_idf(idf_objects)); + EXPECT_EQ(0, state->dataCurveManager->NumCurves); + + Curve::GetCurveInput(*state); + state->dataCurveManager->GetCurvesInputFlag = false; + EXPECT_TRUE(compare_err_stream("", true)); +} + +INSTANTIATE_TEST_SUITE_P(CurveManager, + InputUnitTypeIsValid, + testing::Values("", "Angle", "Dimensionless", "Distance", "MassFlow", "Power", "Temperature", "VolumetricFlow"), + [](const testing::TestParamInfo &info) -> std::string { + if (info.param.empty()) { + return "Blank"; + } + return std::string{info.param}; + }); + +class OutputUnitTypeIsValid : public EnergyPlusFixture, public ::testing::WithParamInterface +{ +}; +TEST_P(OutputUnitTypeIsValid, TableLookup) +{ + const auto &unit_type = GetParam(); + + std::string const idf_objects = delimited_string({ + "Table:IndependentVariable,", + " SAFlow, !- Name", + " Cubic, !- Interpolation Method", + " Constant, !- Extrapolation Method", + " 0.714, !- Minimum Value", + " 1.2857, !- Maximum Value", + " , !- Normalization Reference Value", + " Dimensionless, !- Unit Type", + " , !- External File Name", + " , !- External File Column Number", + " , !- External File Starting Row Number", + " 0.714286, !- Value 1", + " 1.0,", + " 1.2857;", + + "Table:IndependentVariableList,", + " SAFlow_Variables, !- Name", + " SAFlow; !- Independent Variable 1 Name", + + "Table:Lookup,", + " CoolCapModFuncOfSAFlow, !- Name", + " SAFlow_Variables, !- Independent Variable List Name", + " , !- Normalization Method", + " , !- Normalization Divisor", + " 0.8234, !- Minimum Output", + " 1.1256, !- Maximum Output", + fmt::format(" {}, !- Output Unit Type", unit_type), + " , !- External File Name", + " , !- External File Column Number", + " , !- External File Starting Row Number", + " 0.823403, !- Output Value 1", + " 1.0,", + " 1.1256;", + }); + + ASSERT_TRUE(process_idf(idf_objects)); + EXPECT_EQ(0, state->dataCurveManager->NumCurves); + + Curve::GetCurveInput(*state); + state->dataCurveManager->GetCurvesInputFlag = false; + EXPECT_TRUE(compare_err_stream("", true)); +} + +INSTANTIATE_TEST_SUITE_P(CurveManager, + OutputUnitTypeIsValid, + testing::Values("", "Capacity", "Dimensionless", "Power", "Pressure", "Temperature"), + [](const testing::TestParamInfo &info) -> std::string { + if (info.param.empty()) { + return "Blank"; + } + return std::string{info.param}; + }); + +std::pair, std::set> getAllPossibleInputOutputTypesForCurves() +{ + const auto json_schema = nlohmann::json::from_cbor(EmbeddedEpJSONSchema::embeddedEpJSONSchema()); + auto const &schema_properties = json_schema.at("properties"); + std::set all_input_choices; + std::set all_output_choices; + + for (const auto &[objectType, object_schema] : schema_properties.items()) { + const bool is_curve = (objectType.rfind("Curve:", 0) == 0) || (objectType == "Table:Lookup") || (objectType == "Table:IndependentVariable"); + if (!is_curve) { + continue; + } + auto const &schema_obj_props = getPatternProperties(object_schema); + for (const auto &[fieldName, schema_field_obj] : schema_obj_props.items()) { + if (std::string(fieldName) == "output_unit_type") { + for (const auto &e : schema_field_obj.at("enum")) { + all_output_choices.insert(std::string{e}); + } + } else if (fieldName.find("unit_type") != std::string::npos) { + for (const auto &e : schema_field_obj.at("enum")) { + all_input_choices.insert(std::string{e}); + } + } + } + } + + return {all_input_choices, all_output_choices}; +} + +TEST_F(EnergyPlusFixture, AllPossibleUnitTypeValid) +{ + auto const [all_input_choices, all_output_choices] = getAllPossibleInputOutputTypesForCurves(); + + // As of 2024-12-18 + // in = ["", "Angle", "Dimensionless", "Distance", "MassFlow", "Power", "Pressure", "Temperature", "VolumetricFlow","VolumetricFlowPerPower"] + // out = ["", "Capacity", "Dimensionless", "Power", "Pressure", "Temperature"] + EXPECT_FALSE(all_input_choices.empty()) << fmt::format("{}", all_input_choices); + EXPECT_FALSE(all_output_choices.empty()) << fmt::format("{}", all_output_choices); + + for (const auto &input_unit_type : all_input_choices) { + EXPECT_TRUE(Curve::IsCurveInputTypeValid(input_unit_type)) << input_unit_type << " is rejected by IsCurveOutputTypeValid"; + } + + for (const auto &output_unit_type : all_output_choices) { + if (output_unit_type.empty()) { + continue; + } + EXPECT_TRUE(Curve::IsCurveOutputTypeValid(output_unit_type)) << output_unit_type << " is rejected by IsCurveOutputTypeValid"; + } +} + +TEST_F(EnergyPlusFixture, QuadraticCurve_CheckCurveMinMaxValues) +{ + std::string const idf_objects = delimited_string({ + "Curve:Quadratic,", + " DummyEIRfPLR, !- Name", + " 1, !- Coefficient1 Constant", + " 1, !- Coefficient2 x", + " 0, !- Coefficient3 x**2", + " 0.8, !- Minimum Value of x {BasedOnField A2}", + " 0.5, !- Maximum Value of x {BasedOnField A2}", + " , !- Minimum Curve Output {BasedOnField A3}", + " , !- Maximum Curve Output {BasedOnField A3}", + " , !- Input Unit Type for X", + " ; !- Output Unit Type", + }); + + EXPECT_TRUE(process_idf(idf_objects)); + EXPECT_EQ(0, state->dataCurveManager->NumCurves); + ASSERT_THROW(Curve::GetCurveInput(*state), std::runtime_error); + state->dataCurveManager->GetCurvesInputFlag = false; + ASSERT_EQ(1, state->dataCurveManager->NumCurves); + + auto const expected_error = delimited_string({ + " ** Severe ** GetCurveInput: For Curve:Quadratic: ", + " ** ~~~ ** Minimum Value of x [0.80] > Maximum Value of x [0.50]", + " ** Fatal ** GetCurveInput: Errors found in getting Curve Objects. Preceding condition(s) cause termination.", + }); + EXPECT_TRUE(compare_err_stream_substring(expected_error)); +} + +struct CurveTestParam +{ + std::string object_name; + std::string tested_dim; + std::string idf_objects; + std::string expected_error; + + // This is what I want to override, so why I'm using a struct and not a std::tuple + friend std::ostream &operator<<(std::ostream &os, const CurveTestParam &p) + { + return os << p.object_name << "_" << p.tested_dim; + } +}; + +class CurveManagerValidationFixture : public EnergyPlusFixture, public ::testing::WithParamInterface +{ +public: + static std::string delimited_string(std::vector const &strings, std::string const &delimiter = "\n") + { + return EnergyPlusFixture::delimited_string(strings, delimiter); + } +}; + +TEST_P(CurveManagerValidationFixture, CurveMinMaxValues) +{ + const auto &[object_name, tested_dim, idf_objects, expected_error] = GetParam(); + EXPECT_TRUE(process_idf(idf_objects)); + EXPECT_EQ(0, state->dataCurveManager->NumCurves); + try { + Curve::GetCurveInput(*state); + } catch (const EnergyPlus::FatalError &err) { + std::string w = err.what(); + EXPECT_TRUE(w.find("Error with format") == std::string::npos) << w; + // Otherwise, this is expected + } catch (std::runtime_error const &err) { + FAIL() << err.what(); + } catch (...) { + FAIL() << "Got another exception!"; + } + state->dataCurveManager->GetCurvesInputFlag = false; + ASSERT_EQ(1, state->dataCurveManager->NumCurves); + EXPECT_TRUE(compare_err_stream_substring(expected_error)); +} + +INSTANTIATE_TEST_SUITE_P(CurveManager, + CurveManagerValidationFixture, + ::testing::Values( + // Curve:Functional:PressureDrop: 0 dimensions + + // Curve:Linear: 1 dimensions + CurveTestParam{"Curve:Linear", + "x", + CurveManagerValidationFixture::delimited_string({ + "Curve:Linear,", + " Linear, !- Name", + " 1, !- Coefficient1 Constant", + " 1, !- Coefficient2 x", + " 0.8, !- Minimum Value of x {BasedOnField A2}", + " 0.5, !- Maximum Value of x {BasedOnField A2}", + " , !- Minimum Curve Output {BasedOnField A3}", + " , !- Maximum Curve Output {BasedOnField A3}", + " Dimensionless, !- Input Unit Type for X", + " Dimensionless; !- Output Unit Type", + }), + "Minimum Value of x [0.80] > Maximum Value of x [0.50]"}, + + // Curve:Quadratic: 1 dimensions + CurveTestParam{"Curve:Quadratic", + "x", + CurveManagerValidationFixture::delimited_string({ + "Curve:Quadratic,", + " Quadratic, !- Name", + " 1, !- Coefficient1 Constant", + " 1, !- Coefficient2 x", + " 1, !- Coefficient3 x**2", + " 0.8, !- Minimum Value of x {BasedOnField A2}", + " 0.5, !- Maximum Value of x {BasedOnField A2}", + " , !- Minimum Curve Output {BasedOnField A3}", + " , !- Maximum Curve Output {BasedOnField A3}", + " Dimensionless, !- Input Unit Type for X", + " Dimensionless; !- Output Unit Type", + }), + "Minimum Value of x [0.80] > Maximum Value of x [0.50]"}, + + // Curve:Cubic: 1 dimensions + CurveTestParam{"Curve:Cubic", + "x", + CurveManagerValidationFixture::delimited_string({ + "Curve:Cubic,", + " Cubic, !- Name", + " 1, !- Coefficient1 Constant", + " 1, !- Coefficient2 x", + " 1, !- Coefficient3 x**2", + " 1, !- Coefficient4 x**3", + " 0.8, !- Minimum Value of x {BasedOnField A2}", + " 0.5, !- Maximum Value of x {BasedOnField A2}", + " , !- Minimum Curve Output {BasedOnField A3}", + " , !- Maximum Curve Output {BasedOnField A3}", + " Dimensionless, !- Input Unit Type for X", + " Dimensionless; !- Output Unit Type", + }), + "Minimum Value of x [0.80] > Maximum Value of x [0.50]"}, + + // Curve:Quartic: 1 dimensions + CurveTestParam{"Curve:Quartic", + "x", + CurveManagerValidationFixture::delimited_string({ + "Curve:Quartic,", + " Quartic, !- Name", + " 1, !- Coefficient1 Constant", + " 1, !- Coefficient2 x", + " 1, !- Coefficient3 x**2", + " 1, !- Coefficient4 x**3", + " 1, !- Coefficient5 x**4", + " 0.8, !- Minimum Value of x {BasedOnField A2}", + " 0.5, !- Maximum Value of x {BasedOnField A2}", + " , !- Minimum Curve Output {BasedOnField A3}", + " , !- Maximum Curve Output {BasedOnField A3}", + " Dimensionless, !- Input Unit Type for X", + " Dimensionless; !- Output Unit Type", + }), + "Minimum Value of x [0.80] > Maximum Value of x [0.50]"}, + + // Curve:Exponent: 1 dimensions + CurveTestParam{"Curve:Exponent", + "x", + CurveManagerValidationFixture::delimited_string({ + "Curve:Exponent,", + " Exponent, !- Name", + " 1, !- Coefficient1 Constant", + " 1, !- Coefficient2 Constant", + " 1, !- Coefficient3 Constant", + " 0.8, !- Minimum Value of x {BasedOnField A2}", + " 0.5, !- Maximum Value of x {BasedOnField A2}", + " , !- Minimum Curve Output {BasedOnField A3}", + " , !- Maximum Curve Output {BasedOnField A3}", + " Dimensionless, !- Input Unit Type for X", + " Dimensionless; !- Output Unit Type", + }), + "Minimum Value of x [0.80] > Maximum Value of x [0.50]"}, + + // Curve:ExponentialSkewNormal: 1 dimensions + CurveTestParam{"Curve:ExponentialSkewNormal", + "x", + CurveManagerValidationFixture::delimited_string({ + "Curve:ExponentialSkewNormal,", + " ExponentialSkewNormal, !- Name", + " 1, !- Coefficient1 C1", + " 1, !- Coefficient2 C2", + " 1, !- Coefficient3 C3", + " 1, !- Coefficient4 C4", + " 0.8, !- Minimum Value of x {BasedOnField A2}", + " 0.5, !- Maximum Value of x {BasedOnField A2}", + " , !- Minimum Curve Output {BasedOnField A3}", + " , !- Maximum Curve Output {BasedOnField A3}", + " Dimensionless, !- Input Unit Type for x", + " Dimensionless; !- Output Unit Type", + }), + "Minimum Value of x [0.80] > Maximum Value of x [0.50]"}, + + // Curve:Sigmoid: 1 dimensions + CurveTestParam{"Curve:Sigmoid", + "x", + CurveManagerValidationFixture::delimited_string({ + "Curve:Sigmoid,", + " Sigmoid, !- Name", + " 1, !- Coefficient1 C1", + " 1, !- Coefficient2 C2", + " 1, !- Coefficient3 C3", + " 1, !- Coefficient4 C4", + " 1, !- Coefficient5 C5", + " 0.8, !- Minimum Value of x {BasedOnField A2}", + " 0.5, !- Maximum Value of x {BasedOnField A2}", + " , !- Minimum Curve Output {BasedOnField A3}", + " , !- Maximum Curve Output {BasedOnField A3}", + " Dimensionless, !- Input Unit Type for x", + " Dimensionless; !- Output Unit Type", + }), + "Minimum Value of x [0.80] > Maximum Value of x [0.50]"}, + + // Curve:RectangularHyperbola1: 1 dimensions + CurveTestParam{"Curve:RectangularHyperbola1", + "x", + CurveManagerValidationFixture::delimited_string({ + "Curve:RectangularHyperbola1,", + " RectangularHyperbola1, !- Name", + " 1, !- Coefficient1 C1", + " 1, !- Coefficient2 C2", + " 1, !- Coefficient3 C3", + " 0.8, !- Minimum Value of x {BasedOnField A2}", + " 0.5, !- Maximum Value of x {BasedOnField A2}", + " , !- Minimum Curve Output {BasedOnField A3}", + " , !- Maximum Curve Output {BasedOnField A3}", + " Dimensionless, !- Input Unit Type for x", + " Dimensionless; !- Output Unit Type", + }), + "Minimum Value of x [0.80] > Maximum Value of x [0.50]"}, + + // Curve:RectangularHyperbola2: 1 dimensions + CurveTestParam{"Curve:RectangularHyperbola2", + "x", + CurveManagerValidationFixture::delimited_string({ + "Curve:RectangularHyperbola2,", + " RectangularHyperbola2, !- Name", + " 1, !- Coefficient1 C1", + " 1, !- Coefficient2 C2", + " 1, !- Coefficient3 C3", + " 0.8, !- Minimum Value of x {BasedOnField A2}", + " 0.5, !- Maximum Value of x {BasedOnField A2}", + " , !- Minimum Curve Output {BasedOnField A3}", + " , !- Maximum Curve Output {BasedOnField A3}", + " Dimensionless, !- Input Unit Type for x", + " Dimensionless; !- Output Unit Type", + }), + "Minimum Value of x [0.80] > Maximum Value of x [0.50]"}, + + // Curve:ExponentialDecay: 1 dimensions + CurveTestParam{"Curve:ExponentialDecay", + "x", + CurveManagerValidationFixture::delimited_string({ + "Curve:ExponentialDecay,", + " ExponentialDecay, !- Name", + " 1, !- Coefficient1 C1", + " 1, !- Coefficient2 C2", + " 1, !- Coefficient3 C3", + " 0.8, !- Minimum Value of x {BasedOnField A2}", + " 0.5, !- Maximum Value of x {BasedOnField A2}", + " , !- Minimum Curve Output {BasedOnField A3}", + " , !- Maximum Curve Output {BasedOnField A3}", + " Dimensionless, !- Input Unit Type for x", + " Dimensionless; !- Output Unit Type", + }), + "Minimum Value of x [0.80] > Maximum Value of x [0.50]"}, + + // Curve:DoubleExponentialDecay: 1 dimensions + CurveTestParam{"Curve:DoubleExponentialDecay", + "x", + CurveManagerValidationFixture::delimited_string({ + "Curve:DoubleExponentialDecay,", + " DoubleExponentialDecay, !- Name", + " 1, !- Coefficient1 C1", + " 1, !- Coefficient2 C2", + " 1, !- Coefficient3 C3", + " 1, !- Coefficient4 C4", + " 1, !- Coefficient5 C5", + " 0.8, !- Minimum Value of x {BasedOnField A2}", + " 0.5, !- Maximum Value of x {BasedOnField A2}", + " , !- Minimum Curve Output {BasedOnField A3}", + " , !- Maximum Curve Output {BasedOnField A3}", + " Dimensionless, !- Input Unit Type for x", + " Dimensionless; !- Output Unit Type", + }), + "Minimum Value of x [0.80] > Maximum Value of x [0.50]"}, + + // Curve:Bicubic: 2 dimensions + CurveTestParam{"Curve:Bicubic", + "x", + CurveManagerValidationFixture::delimited_string({ + "Curve:Bicubic,", + " Bicubic, !- Name", + " 1, !- Coefficient1 Constant", + " 1, !- Coefficient2 x", + " 1, !- Coefficient3 x**2", + " 1, !- Coefficient4 y", + " 1, !- Coefficient5 y**2", + " 1, !- Coefficient6 x*y", + " 1, !- Coefficient7 x**3", + " 1, !- Coefficient8 y**3", + " 1, !- Coefficient9 x**2*y", + " 1, !- Coefficient10 x*y**2", + " 0.8, !- Minimum Value of x {BasedOnField A2}", + " 0.5, !- Maximum Value of x {BasedOnField A2}", + " 0, !- Minimum Value of y {BasedOnField A3}", + " 1, !- Maximum Value of y {BasedOnField A3}", + " , !- Minimum Curve Output {BasedOnField A4}", + " , !- Maximum Curve Output {BasedOnField A4}", + " Dimensionless, !- Input Unit Type for X", + " Dimensionless, !- Input Unit Type for Y", + " Dimensionless; !- Output Unit Type", + }), + "Minimum Value of x [0.80] > Maximum Value of x [0.50]"}, + CurveTestParam{"Curve:Bicubic", + "y", + CurveManagerValidationFixture::delimited_string({ + "Curve:Bicubic,", + " Bicubic, !- Name", + " 1, !- Coefficient1 Constant", + " 1, !- Coefficient2 x", + " 1, !- Coefficient3 x**2", + " 1, !- Coefficient4 y", + " 1, !- Coefficient5 y**2", + " 1, !- Coefficient6 x*y", + " 1, !- Coefficient7 x**3", + " 1, !- Coefficient8 y**3", + " 1, !- Coefficient9 x**2*y", + " 1, !- Coefficient10 x*y**2", + " 0, !- Minimum Value of x {BasedOnField A2}", + " 1, !- Maximum Value of x {BasedOnField A2}", + " 0.8, !- Minimum Value of y {BasedOnField A3}", + " 0.5, !- Maximum Value of y {BasedOnField A3}", + " , !- Minimum Curve Output {BasedOnField A4}", + " , !- Maximum Curve Output {BasedOnField A4}", + " Dimensionless, !- Input Unit Type for X", + " Dimensionless, !- Input Unit Type for Y", + " Dimensionless; !- Output Unit Type", + }), + "Minimum Value of y [0.80] > Maximum Value of y [0.50]"}, + + // Curve:Biquadratic: 2 dimensions + CurveTestParam{"Curve:Biquadratic", + "x", + CurveManagerValidationFixture::delimited_string({ + "Curve:Biquadratic,", + " Biquadratic, !- Name", + " 1, !- Coefficient1 Constant", + " 1, !- Coefficient2 x", + " 1, !- Coefficient3 x**2", + " 1, !- Coefficient4 y", + " 1, !- Coefficient5 y**2", + " 1, !- Coefficient6 x*y", + " 0.8, !- Minimum Value of x {BasedOnField A2}", + " 0.5, !- Maximum Value of x {BasedOnField A2}", + " 0, !- Minimum Value of y {BasedOnField A3}", + " 1, !- Maximum Value of y {BasedOnField A3}", + " , !- Minimum Curve Output {BasedOnField A4}", + " , !- Maximum Curve Output {BasedOnField A4}", + " Dimensionless, !- Input Unit Type for X", + " Dimensionless, !- Input Unit Type for Y", + " Dimensionless; !- Output Unit Type", + }), + "Minimum Value of x [0.80] > Maximum Value of x [0.50]"}, + CurveTestParam{"Curve:Biquadratic", + "y", + CurveManagerValidationFixture::delimited_string({ + "Curve:Biquadratic,", + " Biquadratic, !- Name", + " 1, !- Coefficient1 Constant", + " 1, !- Coefficient2 x", + " 1, !- Coefficient3 x**2", + " 1, !- Coefficient4 y", + " 1, !- Coefficient5 y**2", + " 1, !- Coefficient6 x*y", + " 0, !- Minimum Value of x {BasedOnField A2}", + " 1, !- Maximum Value of x {BasedOnField A2}", + " 0.8, !- Minimum Value of y {BasedOnField A3}", + " 0.5, !- Maximum Value of y {BasedOnField A3}", + " , !- Minimum Curve Output {BasedOnField A4}", + " , !- Maximum Curve Output {BasedOnField A4}", + " Dimensionless, !- Input Unit Type for X", + " Dimensionless, !- Input Unit Type for Y", + " Dimensionless; !- Output Unit Type", + }), + "Minimum Value of y [0.80] > Maximum Value of y [0.50]"}, + + // Curve:QuadraticLinear: 2 dimensions + CurveTestParam{"Curve:QuadraticLinear", + "x", + CurveManagerValidationFixture::delimited_string({ + "Curve:QuadraticLinear,", + " QuadraticLinear, !- Name", + " 1, !- Coefficient1 Constant", + " 1, !- Coefficient2 x", + " 1, !- Coefficient3 x**2", + " 1, !- Coefficient4 y", + " 1, !- Coefficient5 x*y", + " 1, !- Coefficient6 x**2*y", + " 0.8, !- Minimum Value of x {BasedOnField A2}", + " 0.5, !- Maximum Value of x {BasedOnField A2}", + " 0, !- Minimum Value of y {BasedOnField A3}", + " 1, !- Maximum Value of y {BasedOnField A3}", + " , !- Minimum Curve Output {BasedOnField A4}", + " , !- Maximum Curve Output {BasedOnField A4}", + " Dimensionless, !- Input Unit Type for X", + " Dimensionless, !- Input Unit Type for Y", + " Dimensionless; !- Output Unit Type", + }), + "Minimum Value of x [0.80] > Maximum Value of x [0.50]"}, + CurveTestParam{"Curve:QuadraticLinear", + "y", + CurveManagerValidationFixture::delimited_string({ + "Curve:QuadraticLinear,", + " QuadraticLinear, !- Name", + " 1, !- Coefficient1 Constant", + " 1, !- Coefficient2 x", + " 1, !- Coefficient3 x**2", + " 1, !- Coefficient4 y", + " 1, !- Coefficient5 x*y", + " 1, !- Coefficient6 x**2*y", + " 0, !- Minimum Value of x {BasedOnField A2}", + " 1, !- Maximum Value of x {BasedOnField A2}", + " 0.8, !- Minimum Value of y {BasedOnField A3}", + " 0.5, !- Maximum Value of y {BasedOnField A3}", + " , !- Minimum Curve Output {BasedOnField A4}", + " , !- Maximum Curve Output {BasedOnField A4}", + " Dimensionless, !- Input Unit Type for X", + " Dimensionless, !- Input Unit Type for Y", + " Dimensionless; !- Output Unit Type", + }), + "Minimum Value of y [0.80] > Maximum Value of y [0.50]"}, + + // Curve:CubicLinear: 2 dimensions + CurveTestParam{"Curve:CubicLinear", + "x", + CurveManagerValidationFixture::delimited_string({ + "Curve:CubicLinear,", + " CubicLinear, !- Name", + " 1, !- Coefficient1 Constant", + " 1, !- Coefficient2 x", + " 1, !- Coefficient3 x**2", + " 1, !- Coefficient4 x**3", + " 1, !- Coefficient5 y", + " 1, !- Coefficient6 x*y", + " 0.8, !- Minimum Value of x {BasedOnField A2}", + " 0.5, !- Maximum Value of x {BasedOnField A2}", + " 0, !- Minimum Value of y {BasedOnField A3}", + " 1, !- Maximum Value of y {BasedOnField A3}", + " , !- Minimum Curve Output {BasedOnField A4}", + " , !- Maximum Curve Output {BasedOnField A4}", + " Dimensionless, !- Input Unit Type for X", + " Dimensionless, !- Input Unit Type for Y", + " Dimensionless; !- Output Unit Type", + }), + "Minimum Value of x [0.80] > Maximum Value of x [0.50]"}, + CurveTestParam{"Curve:CubicLinear", + "y", + CurveManagerValidationFixture::delimited_string({ + "Curve:CubicLinear,", + " CubicLinear, !- Name", + " 1, !- Coefficient1 Constant", + " 1, !- Coefficient2 x", + " 1, !- Coefficient3 x**2", + " 1, !- Coefficient4 x**3", + " 1, !- Coefficient5 y", + " 1, !- Coefficient6 x*y", + " 0, !- Minimum Value of x {BasedOnField A2}", + " 1, !- Maximum Value of x {BasedOnField A2}", + " 0.8, !- Minimum Value of y {BasedOnField A3}", + " 0.5, !- Maximum Value of y {BasedOnField A3}", + " , !- Minimum Curve Output {BasedOnField A4}", + " , !- Maximum Curve Output {BasedOnField A4}", + " Dimensionless, !- Input Unit Type for X", + " Dimensionless, !- Input Unit Type for Y", + " Dimensionless; !- Output Unit Type", + }), + "Minimum Value of y [0.80] > Maximum Value of y [0.50]"}, + + // Curve:FanPressureRise: 2 dimensions + CurveTestParam{"Curve:FanPressureRise", + "Qfan", + CurveManagerValidationFixture::delimited_string({ + "Curve:FanPressureRise,", + " FanPressureRise, !- Name", + " 1, !- Coefficient1 C1", + " 1, !- Coefficient2 C2", + " 1, !- Coefficient3 C3", + " 1, !- Coefficient4 C4", + " 0.8, !- Minimum Value of Qfan {m3/s}", + " 0.5, !- Maximum Value of Qfan {m3/s}", + " 0, !- Minimum Value of Psm {Pa}", + " 1, !- Maximum Value of Psm {Pa}", + " , !- Minimum Curve Output {Pa}", + " ; !- Maximum Curve Output {Pa}", + }), + "Minimum Value of Qfan [0.80] > Maximum Value of Qfan [0.50]"}, + CurveTestParam{"Curve:FanPressureRise", + "Psm", + CurveManagerValidationFixture::delimited_string({ + "Curve:FanPressureRise,", + " FanPressureRise, !- Name", + " 1, !- Coefficient1 C1", + " 1, !- Coefficient2 C2", + " 1, !- Coefficient3 C3", + " 1, !- Coefficient4 C4", + " 0, !- Minimum Value of Qfan {m3/s}", + " 1, !- Maximum Value of Qfan {m3/s}", + " 0.8, !- Minimum Value of Psm {Pa}", + " 0.5, !- Maximum Value of Psm {Pa}", + " , !- Minimum Curve Output {Pa}", + " ; !- Maximum Curve Output {Pa}", + }), + "Minimum Value of Psm [0.80] > Maximum Value of Psm [0.50]"}, + + // Curve:Triquadratic: 3 dimensions + CurveTestParam{"Curve:Triquadratic", + "x", + CurveManagerValidationFixture::delimited_string({ + "Curve:Triquadratic,", + " Triquadratic, !- Name", + " 1, !- Coefficient1 Constant", + " 1, !- Coefficient2 x**2", + " 1, !- Coefficient3 x", + " 1, !- Coefficient4 y**2", + " 1, !- Coefficient5 y", + " 1, !- Coefficient6 z**2", + " 1, !- Coefficient7 z", + " 1, !- Coefficient8 x**2*y**2", + " 1, !- Coefficient9 x*y", + " 1, !- Coefficient10 x*y**2", + " 1, !- Coefficient11 x**2*y", + " 1, !- Coefficient12 x**2*z**2", + " 1, !- Coefficient13 x*z", + " 1, !- Coefficient14 x*z**2", + " 1, !- Coefficient15 x**2*z", + " 1, !- Coefficient16 y**2*z**2", + " 1, !- Coefficient17 y*z", + " 1, !- Coefficient18 y*z**2", + " 1, !- Coefficient19 y**2*z", + " 1, !- Coefficient20 x**2*y**2*z**2", + " 1, !- Coefficient21 x**2*y**2*z", + " 1, !- Coefficient22 x**2*y*z**2", + " 1, !- Coefficient23 x*y**2*z**2", + " 1, !- Coefficient24 x**2*y*z", + " 1, !- Coefficient25 x*y**2*z", + " 1, !- Coefficient26 x*y*z**2", + " 1, !- Coefficient27 x*y*z", + " 0.8, !- Minimum Value of x {BasedOnField A2}", + " 0.5, !- Maximum Value of x {BasedOnField A2}", + " 0, !- Minimum Value of y {BasedOnField A3}", + " 1, !- Maximum Value of y {BasedOnField A3}", + " 0, !- Minimum Value of z {BasedOnField A4}", + " 1, !- Maximum Value of z {BasedOnField A4}", + " , !- Minimum Curve Output {BasedOnField A5}", + " , !- Maximum Curve Output {BasedOnField A5}", + " Dimensionless, !- Input Unit Type for X", + " Dimensionless, !- Input Unit Type for Y", + " Dimensionless, !- Input Unit Type for Z", + " Dimensionless; !- Output Unit Type", + }), + "Minimum Value of x [0.80] > Maximum Value of x [0.50]"}, + CurveTestParam{"Curve:Triquadratic", + "y", + CurveManagerValidationFixture::delimited_string({ + "Curve:Triquadratic,", + " Triquadratic, !- Name", + " 1, !- Coefficient1 Constant", + " 1, !- Coefficient2 x**2", + " 1, !- Coefficient3 x", + " 1, !- Coefficient4 y**2", + " 1, !- Coefficient5 y", + " 1, !- Coefficient6 z**2", + " 1, !- Coefficient7 z", + " 1, !- Coefficient8 x**2*y**2", + " 1, !- Coefficient9 x*y", + " 1, !- Coefficient10 x*y**2", + " 1, !- Coefficient11 x**2*y", + " 1, !- Coefficient12 x**2*z**2", + " 1, !- Coefficient13 x*z", + " 1, !- Coefficient14 x*z**2", + " 1, !- Coefficient15 x**2*z", + " 1, !- Coefficient16 y**2*z**2", + " 1, !- Coefficient17 y*z", + " 1, !- Coefficient18 y*z**2", + " 1, !- Coefficient19 y**2*z", + " 1, !- Coefficient20 x**2*y**2*z**2", + " 1, !- Coefficient21 x**2*y**2*z", + " 1, !- Coefficient22 x**2*y*z**2", + " 1, !- Coefficient23 x*y**2*z**2", + " 1, !- Coefficient24 x**2*y*z", + " 1, !- Coefficient25 x*y**2*z", + " 1, !- Coefficient26 x*y*z**2", + " 1, !- Coefficient27 x*y*z", + " 0, !- Minimum Value of x {BasedOnField A2}", + " 1, !- Maximum Value of x {BasedOnField A2}", + " 0.8, !- Minimum Value of y {BasedOnField A3}", + " 0.5, !- Maximum Value of y {BasedOnField A3}", + " 0, !- Minimum Value of z {BasedOnField A4}", + " 1, !- Maximum Value of z {BasedOnField A4}", + " , !- Minimum Curve Output {BasedOnField A5}", + " , !- Maximum Curve Output {BasedOnField A5}", + " Dimensionless, !- Input Unit Type for X", + " Dimensionless, !- Input Unit Type for Y", + " Dimensionless, !- Input Unit Type for Z", + " Dimensionless; !- Output Unit Type", + }), + "Minimum Value of y [0.80] > Maximum Value of y [0.50]"}, + CurveTestParam{"Curve:Triquadratic", + "z", + CurveManagerValidationFixture::delimited_string({ + "Curve:Triquadratic,", + " Triquadratic, !- Name", + " 1, !- Coefficient1 Constant", + " 1, !- Coefficient2 x**2", + " 1, !- Coefficient3 x", + " 1, !- Coefficient4 y**2", + " 1, !- Coefficient5 y", + " 1, !- Coefficient6 z**2", + " 1, !- Coefficient7 z", + " 1, !- Coefficient8 x**2*y**2", + " 1, !- Coefficient9 x*y", + " 1, !- Coefficient10 x*y**2", + " 1, !- Coefficient11 x**2*y", + " 1, !- Coefficient12 x**2*z**2", + " 1, !- Coefficient13 x*z", + " 1, !- Coefficient14 x*z**2", + " 1, !- Coefficient15 x**2*z", + " 1, !- Coefficient16 y**2*z**2", + " 1, !- Coefficient17 y*z", + " 1, !- Coefficient18 y*z**2", + " 1, !- Coefficient19 y**2*z", + " 1, !- Coefficient20 x**2*y**2*z**2", + " 1, !- Coefficient21 x**2*y**2*z", + " 1, !- Coefficient22 x**2*y*z**2", + " 1, !- Coefficient23 x*y**2*z**2", + " 1, !- Coefficient24 x**2*y*z", + " 1, !- Coefficient25 x*y**2*z", + " 1, !- Coefficient26 x*y*z**2", + " 1, !- Coefficient27 x*y*z", + " 0, !- Minimum Value of x {BasedOnField A2}", + " 1, !- Maximum Value of x {BasedOnField A2}", + " 0, !- Minimum Value of y {BasedOnField A3}", + " 1, !- Maximum Value of y {BasedOnField A3}", + " 0.8, !- Minimum Value of z {BasedOnField A4}", + " 0.5, !- Maximum Value of z {BasedOnField A4}", + " , !- Minimum Curve Output {BasedOnField A5}", + " , !- Maximum Curve Output {BasedOnField A5}", + " Dimensionless, !- Input Unit Type for X", + " Dimensionless, !- Input Unit Type for Y", + " Dimensionless, !- Input Unit Type for Z", + " Dimensionless; !- Output Unit Type", + }), + "Minimum Value of z [0.80] > Maximum Value of z [0.50]"}, + + // Curve:ChillerPartLoadWithLift: 3 dimensions + CurveTestParam{"Curve:ChillerPartLoadWithLift", + "x", + CurveManagerValidationFixture::delimited_string({ + "Curve:ChillerPartLoadWithLift,", + " ChillerPartLoadWithLift, !- Name", + " 1, !- Coefficient1 C1", + " 1, !- Coefficient2 C2", + " 1, !- Coefficient3 C3", + " 1, !- Coefficient4 C4", + " 1, !- Coefficient5 C5", + " 1, !- Coefficient6 C6", + " 1, !- Coefficient7 C7", + " 1, !- Coefficient8 C8", + " 1, !- Coefficient9 C9", + " 1, !- Coefficient10 C10", + " 1, !- Coefficient11 C11", + " 1, !- Coefficient12 C12", + " 0.8, !- Minimum Value of x {BasedOnField A2}", + " 0.5, !- Maximum Value of x {BasedOnField A2}", + " 0, !- Minimum Value of y {BasedOnField A3}", + " 1, !- Maximum Value of y {BasedOnField A3}", + " 0, !- Minimum Value of z {BasedOnField A4}", + " 1, !- Maximum Value of z {BasedOnField A4}", + " , !- Minimum Curve Output {BasedOnField A5}", + " , !- Maximum Curve Output {BasedOnField A5}", + " Dimensionless, !- Input Unit Type for x", + " Dimensionless, !- Input Unit Type for y", + " Dimensionless, !- Input Unit Type for z", + " Dimensionless; !- Output Unit Type", + }), + "Minimum Value of x [0.80] > Maximum Value of x [0.50]"}, + CurveTestParam{"Curve:ChillerPartLoadWithLift", + "y", + CurveManagerValidationFixture::delimited_string({ + "Curve:ChillerPartLoadWithLift,", + " ChillerPartLoadWithLift, !- Name", + " 1, !- Coefficient1 C1", + " 1, !- Coefficient2 C2", + " 1, !- Coefficient3 C3", + " 1, !- Coefficient4 C4", + " 1, !- Coefficient5 C5", + " 1, !- Coefficient6 C6", + " 1, !- Coefficient7 C7", + " 1, !- Coefficient8 C8", + " 1, !- Coefficient9 C9", + " 1, !- Coefficient10 C10", + " 1, !- Coefficient11 C11", + " 1, !- Coefficient12 C12", + " 0, !- Minimum Value of x {BasedOnField A2}", + " 1, !- Maximum Value of x {BasedOnField A2}", + " 0.8, !- Minimum Value of y {BasedOnField A3}", + " 0.5, !- Maximum Value of y {BasedOnField A3}", + " 0, !- Minimum Value of z {BasedOnField A4}", + " 1, !- Maximum Value of z {BasedOnField A4}", + " , !- Minimum Curve Output {BasedOnField A5}", + " , !- Maximum Curve Output {BasedOnField A5}", + " Dimensionless, !- Input Unit Type for x", + " Dimensionless, !- Input Unit Type for y", + " Dimensionless, !- Input Unit Type for z", + " Dimensionless; !- Output Unit Type", + }), + "Minimum Value of y [0.80] > Maximum Value of y [0.50]"}, + CurveTestParam{"Curve:ChillerPartLoadWithLift", + "z", + CurveManagerValidationFixture::delimited_string({ + "Curve:ChillerPartLoadWithLift,", + " ChillerPartLoadWithLift, !- Name", + " 1, !- Coefficient1 C1", + " 1, !- Coefficient2 C2", + " 1, !- Coefficient3 C3", + " 1, !- Coefficient4 C4", + " 1, !- Coefficient5 C5", + " 1, !- Coefficient6 C6", + " 1, !- Coefficient7 C7", + " 1, !- Coefficient8 C8", + " 1, !- Coefficient9 C9", + " 1, !- Coefficient10 C10", + " 1, !- Coefficient11 C11", + " 1, !- Coefficient12 C12", + " 0, !- Minimum Value of x {BasedOnField A2}", + " 1, !- Maximum Value of x {BasedOnField A2}", + " 0, !- Minimum Value of y {BasedOnField A3}", + " 1, !- Maximum Value of y {BasedOnField A3}", + " 0.8, !- Minimum Value of z {BasedOnField A4}", + " 0.5, !- Maximum Value of z {BasedOnField A4}", + " , !- Minimum Curve Output {BasedOnField A5}", + " , !- Maximum Curve Output {BasedOnField A5}", + " Dimensionless, !- Input Unit Type for x", + " Dimensionless, !- Input Unit Type for y", + " Dimensionless, !- Input Unit Type for z", + " Dimensionless; !- Output Unit Type", + }), + "Minimum Value of z [0.80] > Maximum Value of z [0.50]"}, + + // Curve:QuadLinear: 4 dimensions + CurveTestParam{"Curve:QuadLinear", + "w", + CurveManagerValidationFixture::delimited_string({ + "Curve:QuadLinear,", + " QuadLinear, !- Name", + " 1, !- Coefficient1 Constant", + " 1, !- Coefficient2 w", + " 1, !- Coefficient3 x", + " 1, !- Coefficient4 y", + " 1, !- Coefficient5 z", + " 0.8, !- Minimum Value of w {BasedOnField A2}", + " 0.5, !- Maximum Value of w {BasedOnField A2}", + " 0, !- Minimum Value of x {BasedOnField A3}", + " 1, !- Maximum Value of x {BasedOnField A3}", + " 0, !- Minimum Value of y {BasedOnField A4}", + " 1, !- Maximum Value of y {BasedOnField A4}", + " 0, !- Minimum Value of z {BasedOnField A5}", + " 1, !- Maximum Value of z {BasedOnField A5}", + " , !- Minimum Curve Output {BasedOnField A4}", + " , !- Maximum Curve Output {BasedOnField A4}", + " Dimensionless, !- Input Unit Type for w", + " Dimensionless, !- Input Unit Type for x", + " Dimensionless, !- Input Unit Type for y", + " Dimensionless; !- Input Unit Type for z", + }), + "Minimum Value of w [0.80] > Maximum Value of w [0.50]"}, + CurveTestParam{"Curve:QuadLinear", + "x", + CurveManagerValidationFixture::delimited_string({ + "Curve:QuadLinear,", + " QuadLinear, !- Name", + " 1, !- Coefficient1 Constant", + " 1, !- Coefficient2 w", + " 1, !- Coefficient3 x", + " 1, !- Coefficient4 y", + " 1, !- Coefficient5 z", + " 0, !- Minimum Value of w {BasedOnField A2}", + " 1, !- Maximum Value of w {BasedOnField A2}", + " 0.8, !- Minimum Value of x {BasedOnField A3}", + " 0.5, !- Maximum Value of x {BasedOnField A3}", + " 0, !- Minimum Value of y {BasedOnField A4}", + " 1, !- Maximum Value of y {BasedOnField A4}", + " 0, !- Minimum Value of z {BasedOnField A5}", + " 1, !- Maximum Value of z {BasedOnField A5}", + " , !- Minimum Curve Output {BasedOnField A4}", + " , !- Maximum Curve Output {BasedOnField A4}", + " Dimensionless, !- Input Unit Type for w", + " Dimensionless, !- Input Unit Type for x", + " Dimensionless, !- Input Unit Type for y", + " Dimensionless; !- Input Unit Type for z", + }), + "Minimum Value of x [0.80] > Maximum Value of x [0.50]"}, + CurveTestParam{"Curve:QuadLinear", + "y", + CurveManagerValidationFixture::delimited_string({ + "Curve:QuadLinear,", + " QuadLinear, !- Name", + " 1, !- Coefficient1 Constant", + " 1, !- Coefficient2 w", + " 1, !- Coefficient3 x", + " 1, !- Coefficient4 y", + " 1, !- Coefficient5 z", + " 0, !- Minimum Value of w {BasedOnField A2}", + " 1, !- Maximum Value of w {BasedOnField A2}", + " 0, !- Minimum Value of x {BasedOnField A3}", + " 1, !- Maximum Value of x {BasedOnField A3}", + " 0.8, !- Minimum Value of y {BasedOnField A4}", + " 0.5, !- Maximum Value of y {BasedOnField A4}", + " 0, !- Minimum Value of z {BasedOnField A5}", + " 1, !- Maximum Value of z {BasedOnField A5}", + " , !- Minimum Curve Output {BasedOnField A4}", + " , !- Maximum Curve Output {BasedOnField A4}", + " Dimensionless, !- Input Unit Type for w", + " Dimensionless, !- Input Unit Type for x", + " Dimensionless, !- Input Unit Type for y", + " Dimensionless; !- Input Unit Type for z", + }), + "Minimum Value of y [0.80] > Maximum Value of y [0.50]"}, + CurveTestParam{"Curve:QuadLinear", + "z", + CurveManagerValidationFixture::delimited_string({ + "Curve:QuadLinear,", + " QuadLinear, !- Name", + " 1, !- Coefficient1 Constant", + " 1, !- Coefficient2 w", + " 1, !- Coefficient3 x", + " 1, !- Coefficient4 y", + " 1, !- Coefficient5 z", + " 0, !- Minimum Value of w {BasedOnField A2}", + " 1, !- Maximum Value of w {BasedOnField A2}", + " 0, !- Minimum Value of x {BasedOnField A3}", + " 1, !- Maximum Value of x {BasedOnField A3}", + " 0, !- Minimum Value of y {BasedOnField A4}", + " 1, !- Maximum Value of y {BasedOnField A4}", + " 0.8, !- Minimum Value of z {BasedOnField A5}", + " 0.5, !- Maximum Value of z {BasedOnField A5}", + " , !- Minimum Curve Output {BasedOnField A4}", + " , !- Maximum Curve Output {BasedOnField A4}", + " Dimensionless, !- Input Unit Type for w", + " Dimensionless, !- Input Unit Type for x", + " Dimensionless, !- Input Unit Type for y", + " Dimensionless; !- Input Unit Type for z", + }), + "Minimum Value of z [0.80] > Maximum Value of z [0.50]"}, + + // Curve:QuintLinear: 5 dimensions + CurveTestParam{"Curve:QuintLinear", + "v", + CurveManagerValidationFixture::delimited_string({ + "Curve:QuintLinear,", + " QuintLinear, !- Name", + " 1, !- Coefficient1 Constant", + " 1, !- Coefficient2 v", + " 1, !- Coefficient3 w", + " 1, !- Coefficient4 x", + " 1, !- Coefficient5 y", + " 1, !- Coefficient6 z", + " 0.8, !- Minimum Value of v {BasedOnField A2}", + " 0.5, !- Maximum Value of v {BasedOnField A2}", + " 0, !- Minimum Value of w {BasedOnField A2}", + " 1, !- Maximum Value of w {BasedOnField A2}", + " 0, !- Minimum Value of x {BasedOnField A3}", + " 1, !- Maximum Value of x {BasedOnField A3}", + " 0, !- Minimum Value of y {BasedOnField A4}", + " 1, !- Maximum Value of y {BasedOnField A4}", + " 0, !- Minimum Value of z {BasedOnField A5}", + " 1, !- Maximum Value of z {BasedOnField A5}", + " , !- Minimum Curve Output {BasedOnField A4}", + " , !- Maximum Curve Output {BasedOnField A4}", + " Dimensionless, !- Input Unit Type for v", + " Dimensionless, !- Input Unit Type for w", + " Dimensionless, !- Input Unit Type for x", + " Dimensionless, !- Input Unit Type for y", + " Dimensionless; !- Input Unit Type for z", + }), + "Minimum Value of v [0.80] > Maximum Value of v [0.50]"}, + CurveTestParam{"Curve:QuintLinear", + "w", + CurveManagerValidationFixture::delimited_string({ + "Curve:QuintLinear,", + " QuintLinear, !- Name", + " 1, !- Coefficient1 Constant", + " 1, !- Coefficient2 v", + " 1, !- Coefficient3 w", + " 1, !- Coefficient4 x", + " 1, !- Coefficient5 y", + " 1, !- Coefficient6 z", + " 0, !- Minimum Value of v {BasedOnField A2}", + " 1, !- Maximum Value of v {BasedOnField A2}", + " 0.8, !- Minimum Value of w {BasedOnField A2}", + " 0.5, !- Maximum Value of w {BasedOnField A2}", + " 0, !- Minimum Value of x {BasedOnField A3}", + " 1, !- Maximum Value of x {BasedOnField A3}", + " 0, !- Minimum Value of y {BasedOnField A4}", + " 1, !- Maximum Value of y {BasedOnField A4}", + " 0, !- Minimum Value of z {BasedOnField A5}", + " 1, !- Maximum Value of z {BasedOnField A5}", + " , !- Minimum Curve Output {BasedOnField A4}", + " , !- Maximum Curve Output {BasedOnField A4}", + " Dimensionless, !- Input Unit Type for v", + " Dimensionless, !- Input Unit Type for w", + " Dimensionless, !- Input Unit Type for x", + " Dimensionless, !- Input Unit Type for y", + " Dimensionless; !- Input Unit Type for z", + }), + "Minimum Value of w [0.80] > Maximum Value of w [0.50]"}, + CurveTestParam{"Curve:QuintLinear", + "x", + CurveManagerValidationFixture::delimited_string({ + "Curve:QuintLinear,", + " QuintLinear, !- Name", + " 1, !- Coefficient1 Constant", + " 1, !- Coefficient2 v", + " 1, !- Coefficient3 w", + " 1, !- Coefficient4 x", + " 1, !- Coefficient5 y", + " 1, !- Coefficient6 z", + " 0, !- Minimum Value of v {BasedOnField A2}", + " 1, !- Maximum Value of v {BasedOnField A2}", + " 0, !- Minimum Value of w {BasedOnField A2}", + " 1, !- Maximum Value of w {BasedOnField A2}", + " 0.8, !- Minimum Value of x {BasedOnField A3}", + " 0.5, !- Maximum Value of x {BasedOnField A3}", + " 0, !- Minimum Value of y {BasedOnField A4}", + " 1, !- Maximum Value of y {BasedOnField A4}", + " 0, !- Minimum Value of z {BasedOnField A5}", + " 1, !- Maximum Value of z {BasedOnField A5}", + " , !- Minimum Curve Output {BasedOnField A4}", + " , !- Maximum Curve Output {BasedOnField A4}", + " Dimensionless, !- Input Unit Type for v", + " Dimensionless, !- Input Unit Type for w", + " Dimensionless, !- Input Unit Type for x", + " Dimensionless, !- Input Unit Type for y", + " Dimensionless; !- Input Unit Type for z", + }), + "Minimum Value of x [0.80] > Maximum Value of x [0.50]"}, + CurveTestParam{"Curve:QuintLinear", + "y", + CurveManagerValidationFixture::delimited_string({ + "Curve:QuintLinear,", + " QuintLinear, !- Name", + " 1, !- Coefficient1 Constant", + " 1, !- Coefficient2 v", + " 1, !- Coefficient3 w", + " 1, !- Coefficient4 x", + " 1, !- Coefficient5 y", + " 1, !- Coefficient6 z", + " 0, !- Minimum Value of v {BasedOnField A2}", + " 1, !- Maximum Value of v {BasedOnField A2}", + " 0, !- Minimum Value of w {BasedOnField A2}", + " 1, !- Maximum Value of w {BasedOnField A2}", + " 0, !- Minimum Value of x {BasedOnField A3}", + " 1, !- Maximum Value of x {BasedOnField A3}", + " 0.8, !- Minimum Value of y {BasedOnField A4}", + " 0.5, !- Maximum Value of y {BasedOnField A4}", + " 0, !- Minimum Value of z {BasedOnField A5}", + " 1, !- Maximum Value of z {BasedOnField A5}", + " , !- Minimum Curve Output {BasedOnField A4}", + " , !- Maximum Curve Output {BasedOnField A4}", + " Dimensionless, !- Input Unit Type for v", + " Dimensionless, !- Input Unit Type for w", + " Dimensionless, !- Input Unit Type for x", + " Dimensionless, !- Input Unit Type for y", + " Dimensionless; !- Input Unit Type for z", + }), + "Minimum Value of y [0.80] > Maximum Value of y [0.50]"}, + CurveTestParam{"Curve:QuintLinear", + "z", + CurveManagerValidationFixture::delimited_string({ + "Curve:QuintLinear,", + " QuintLinear, !- Name", + " 1, !- Coefficient1 Constant", + " 1, !- Coefficient2 v", + " 1, !- Coefficient3 w", + " 1, !- Coefficient4 x", + " 1, !- Coefficient5 y", + " 1, !- Coefficient6 z", + " 0, !- Minimum Value of v {BasedOnField A2}", + " 1, !- Maximum Value of v {BasedOnField A2}", + " 0, !- Minimum Value of w {BasedOnField A2}", + " 1, !- Maximum Value of w {BasedOnField A2}", + " 0, !- Minimum Value of x {BasedOnField A3}", + " 1, !- Maximum Value of x {BasedOnField A3}", + " 0, !- Minimum Value of y {BasedOnField A4}", + " 1, !- Maximum Value of y {BasedOnField A4}", + " 0.8, !- Minimum Value of z {BasedOnField A5}", + " 0.5, !- Maximum Value of z {BasedOnField A5}", + " , !- Minimum Curve Output {BasedOnField A4}", + " , !- Maximum Curve Output {BasedOnField A4}", + " Dimensionless, !- Input Unit Type for v", + " Dimensionless, !- Input Unit Type for w", + " Dimensionless, !- Input Unit Type for x", + " Dimensionless, !- Input Unit Type for y", + " Dimensionless; !- Input Unit Type for z", + }), + "Minimum Value of z [0.80] > Maximum Value of z [0.50]"}), + [](const testing::TestParamInfo &info) -> std::string { + auto object_name = info.param.object_name; + std::replace_if( + object_name.begin(), object_name.end(), [](char c) { return !std::isalnum(c); }, '_'); + return object_name + "_" + info.param.tested_dim; + }); diff --git a/tst/EnergyPlus/unit/CustomMatchers.unit.cc b/tst/EnergyPlus/unit/CustomMatchers.unit.cc index 27923217933..f090deb1deb 100644 --- a/tst/EnergyPlus/unit/CustomMatchers.unit.cc +++ b/tst/EnergyPlus/unit/CustomMatchers.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/DElightManager.unit.cc b/tst/EnergyPlus/unit/DElightManager.unit.cc index a728fb5beec..dec8347a541 100644 --- a/tst/EnergyPlus/unit/DElightManager.unit.cc +++ b/tst/EnergyPlus/unit/DElightManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -303,12 +303,12 @@ TEST_F(EnergyPlusFixture, DElightManagerF_GetInputDElightComplexFenestration_Tes }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); bool foundErrors = false; - HeatBalanceManager::GetProjectControlData(*state, foundErrors); // read project control data - EXPECT_FALSE(foundErrors); // expect no errors - Material::GetMaterialData(*state, foundErrors); // read material data EXPECT_FALSE(foundErrors); // expect no errors @@ -323,8 +323,8 @@ TEST_F(EnergyPlusFixture, DElightManagerF_GetInputDElightComplexFenestration_Tes state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; @@ -334,10 +334,6 @@ TEST_F(EnergyPlusFixture, DElightManagerF_GetInputDElightComplexFenestration_Tes SurfaceGeometry::SetupZoneGeometry(*state, foundErrors); // this calls GetSurfaceData() EXPECT_FALSE(foundErrors); // expect no errors - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; state->dataGlobal->TimeStep = 1; state->dataGlobal->HourOfDay = 1; state->dataEnvrn->Month = 1; @@ -347,7 +343,7 @@ TEST_F(EnergyPlusFixture, DElightManagerF_GetInputDElightComplexFenestration_Tes state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); InternalHeatGains::GetInternalHeatGainsInput(*state); state->dataInternalHeatGains->GetInternalHeatGainsInputFlag = false; diff --git a/tst/EnergyPlus/unit/DOASEffectOnZoneSizing.unit.cc b/tst/EnergyPlus/unit/DOASEffectOnZoneSizing.unit.cc index 1bbf38ea6b6..2a42ac660e7 100644 --- a/tst/EnergyPlus/unit/DOASEffectOnZoneSizing.unit.cc +++ b/tst/EnergyPlus/unit/DOASEffectOnZoneSizing.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -81,6 +81,7 @@ using namespace DataHeatBalance; TEST_F(EnergyPlusFixture, DOASEffectOnZoneSizing_CalcDOASSupCondsForSizing) { + state->init_state(*state); // locals Real64 OutDB; // outside air temperature [C] Real64 OutHR; // outside humidity ratio [kg Water / kg Dry Air] @@ -148,9 +149,7 @@ TEST_F(EnergyPlusFixture, DOASEffectOnZoneSizing_SizeZoneEquipment) state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(2); state->dataZoneEquip->ZoneEquipConfig.allocate(2); state->dataHeatBalFanSys->TempControlType.allocate(2); - state->dataHeatBalFanSys->TempZoneThermostatSetPoint.allocate(2); - state->dataHeatBalFanSys->ZoneThermostatSetPointLo.allocate(2); - state->dataHeatBalFanSys->ZoneThermostatSetPointHi.allocate(2); + state->dataHeatBalFanSys->zoneTstatSetpts.allocate(2); state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(2); state->dataZoneEnergyDemand->ZoneSysMoistureDemand.allocate(2); state->dataZoneEnergyDemand->DeadBandOrSetback.allocate(2); @@ -159,19 +158,21 @@ TEST_F(EnergyPlusFixture, DOASEffectOnZoneSizing_SizeZoneEquipment) state->dataZoneEquip->ZoneEquipConfig(2).InletNode.allocate(2); state->dataZoneEquip->ZoneEquipConfig(1).ExhaustNode.allocate(1); state->dataZoneEquip->ZoneEquipConfig(2).ExhaustNode.allocate(1); + state->dataZoneEquip->ZoneEquipConfig(1).returnFlowFracSched = Sched::GetScheduleAlwaysOff(*state); + state->dataZoneEquip->ZoneEquipConfig(2).returnFlowFracSched = Sched::GetScheduleAlwaysOff(*state); state->dataHeatBalFanSys->ZoneMassBalanceFlag.allocate(2); state->dataGlobal->NumOfZones = 2; state->dataHeatBal->MassConservation.allocate(state->dataGlobal->NumOfZones); HeatBalanceManager::AllocateHeatBalArrays(*state); state->afn->AirflowNetworkNumOfExhFan = 0; - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; - state->dataHeatBalFanSys->TempControlType(2) = HVAC::ThermostatType::DualSetPointWithDeadBand; - state->dataHeatBalFanSys->TempZoneThermostatSetPoint(1) = 0.0; - state->dataHeatBalFanSys->TempZoneThermostatSetPoint(2) = 0.0; - state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1) = 22.; - state->dataHeatBalFanSys->ZoneThermostatSetPointLo(2) = 22.; - state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1) = 24.; - state->dataHeatBalFanSys->ZoneThermostatSetPointHi(2) = 24.; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; + state->dataHeatBalFanSys->TempControlType(2) = HVAC::SetptType::DualHeatCool; + state->dataHeatBalFanSys->zoneTstatSetpts(1).setpt = 0.0; + state->dataHeatBalFanSys->zoneTstatSetpts(2).setpt = 0.0; + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo = 22.; + state->dataHeatBalFanSys->zoneTstatSetpts(2).setptLo = 22.; + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi = 24.; + state->dataHeatBalFanSys->zoneTstatSetpts(2).setptHi = 24.; state->dataSize->CurOverallSimDay = 1; state->dataZoneEquip->ZoneEquipConfig(1).IsControlled = true; state->dataZoneEquip->ZoneEquipConfig(2).IsControlled = true; @@ -316,7 +317,7 @@ TEST_F(EnergyPlusFixture, DOASEffectOnZoneSizing_SizeZoneEquipment) TEST_F(EnergyPlusFixture, TestAutoCalcDOASControlStrategy) { - + state->init_state(*state); state->dataSize->NumZoneSizingInput = 2; state->dataSize->ZoneSizingInput.allocate(state->dataSize->NumZoneSizingInput); state->dataSize->ZoneSizingInput(1).AccountForDOAS = false; diff --git a/tst/EnergyPlus/unit/DXCoils.unit.cc b/tst/EnergyPlus/unit/DXCoils.unit.cc index 63715acc638..4416b544206 100644 --- a/tst/EnergyPlus/unit/DXCoils.unit.cc +++ b/tst/EnergyPlus/unit/DXCoils.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -82,7 +82,6 @@ using namespace DataAirSystems; using namespace DataSizing; using namespace Curve; using namespace OutputReportPredefined; -using namespace ScheduleManager; using namespace DataEnvironment; namespace EnergyPlus { @@ -306,9 +305,10 @@ TEST_F(EnergyPlusFixture, DXCoils_Test1) state->dataDXCoils->DXCoil(CoilIndex).MSWasteHeat(2) = 0; state->dataDXCoils->DXCoil(CoilIndex).MSWasteHeatFrac(1) = 0; state->dataDXCoils->DXCoil(CoilIndex).MSWasteHeatFrac(2) = 0; - state->dataDXCoils->DXCoil(CoilIndex).SchedPtr = 1; - state->dataScheduleMgr->Schedule.allocate(1); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; + + state->dataDXCoils->DXCoil(CoilIndex).availSched = Sched::AddScheduleConstant(*state, "AVAIL SCHED"); + state->dataDXCoils->DXCoil(CoilIndex).availSched->currentVal = 1.0; + state->dataDXCoils->DXCoilOutletTemp.allocate(1); state->dataDXCoils->DXCoilOutletHumRat.allocate(1); state->dataDXCoils->DXCoilPartLoadRatio.allocate(1); @@ -451,14 +451,13 @@ TEST_F(EnergyPlusFixture, DXCoils_Test2) TEST_F(EnergyPlusFixture, TestMultiSpeedDefrostCOP) { // Test that the COP calculation is correct when the defrost is on. #4973 - using DXCoils::CalcMultiSpeedDXCoilHeating; using Psychrometrics::PsyHFnTdbW; using Psychrometrics::PsyRhoAirFnPbTdbW; int DXCoilNum; + state->init_state(*state); // Set up heating coil and curves. - state->dataDXCoils->NumDXCoils = 1; DXCoilNum = 1; state->dataDXCoils->DXCoil.allocate(state->dataDXCoils->NumDXCoils); @@ -466,7 +465,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedDefrostCOP) Coil.DXCoilType = "Coil:Heating:DX:MultiSpeed"; Coil.DXCoilType_Num = HVAC::CoilDX_MultiSpeedHeating; - Coil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; + Coil.availSched = Sched::GetScheduleAlwaysOn(*state); state->dataDXCoils->DXCoilNumericFields.allocate(state->dataDXCoils->NumDXCoils); state->dataHeatBal->HeatReclaimDXCoil.allocate(state->dataDXCoils->NumDXCoils); @@ -836,8 +835,9 @@ TEST_F(EnergyPlusFixture, TestSingleSpeedDefrostCOP) using Psychrometrics::PsyRhoAirFnPbTdbW; int DXCoilNum; - // Set up heating coil and curves. + state->init_state(*state); + // Set up heating coil and curves. state->dataDXCoils->NumDXCoils = 1; DXCoilNum = 1; state->dataDXCoils->DXCoil.allocate(state->dataDXCoils->NumDXCoils); @@ -854,7 +854,7 @@ TEST_F(EnergyPlusFixture, TestSingleSpeedDefrostCOP) Coil.Name = "DX Single Speed Heating Coil"; Coil.DXCoilType = "Coil:Heating:DX:SingleSpeed"; Coil.DXCoilType_Num = HVAC::CoilDX_HeatingEmpirical; - Coil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; + Coil.availSched = Sched::GetScheduleAlwaysOn(*state); state->dataLoopNodes->Node.allocate(1); Coil.AirOutNode = 1; @@ -1128,8 +1128,7 @@ TEST_F(EnergyPlusFixture, DXCoilEvapCondPumpSizingTest) }); ASSERT_TRUE(process_idf(idf_objects)); - - ProcessScheduleInput(*state); + state->init_state(*state); GetCurveInput(*state); GetDXCoils(*state); @@ -1998,8 +1997,8 @@ TEST_F(EnergyPlusFixture, TestReadingCoilCoolingHeatingDX) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); - ProcessScheduleInput(*state); GetCurveInput(*state); GetDXCoils(*state); VariableSpeedCoils::GetVarSpeedCoilInput(*state); @@ -2009,7 +2008,6 @@ TEST_F(EnergyPlusFixture, TestReadingCoilCoolingHeatingDX) state->dataEnvrn->OutDryBulbTemp = 20.0; state->dataEnvrn->OutHumRat = 0.008; state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); - Psychrometrics::InitializePsychRoutines(*state); // Coil:Cooling:DX:SingleSpeed EXPECT_EQ(state->dataDXCoils->DXCoil(1).DXCoilType_Num, HVAC::CoilDX_CoolingSingleSpeed); @@ -2199,6 +2197,7 @@ TEST_F(EnergyPlusFixture, TestDXCoilIndoorOrOutdoor) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // Run DXCoilNum = 1; @@ -2395,6 +2394,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedWasteHeat) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // Case 1 test state->dataEnvrn->OutDryBulbTemp = 35; @@ -2424,8 +2424,8 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedWasteHeat) state->dataDXCoils->DXCoil(1).InletAirHumRat = 0.005; state->dataDXCoils->DXCoil(1).InletAirEnthalpy = PsyHFnTdbW(25.0, 0.005); - state->dataDXCoils->DXCoil(1).SchedPtr = 1; - state->dataScheduleMgr->Schedule(state->dataDXCoils->DXCoil(1).SchedPtr).CurrentValue = 1.0; // enable the VRF condenser + state->dataDXCoils->DXCoil(1).availSched = Sched::GetSchedule(*state, "FANANDCOILAVAILSCHED"); + state->dataDXCoils->DXCoil(1).availSched->currentVal = 1.0; // enable the VRF condenser state->dataDXCoils->DXCoil(1).MSRatedCBF(1) = 0.1262; state->dataDXCoils->DXCoil(1).MSRatedCBF(2) = 0.0408; @@ -2543,8 +2543,8 @@ TEST_F(EnergyPlusFixture, DXCoil_ValidateADPFunction) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); - ProcessScheduleInput(*state); GetCurveInput(*state); GetDXCoils(*state); SetPredefinedTables(*state); @@ -2795,6 +2795,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoolingCrankcaseOutput) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // Case 1 test GetDXCoils(*state); @@ -2883,8 +2884,8 @@ TEST_F(EnergyPlusFixture, BlankDefrostEIRCurveInput) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); - ProcessScheduleInput(*state); GetCurveInput(*state); GetDXCoils(*state); @@ -2950,8 +2951,8 @@ TEST_F(EnergyPlusFixture, CurveOutputLimitWarning) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); - ProcessScheduleInput(*state); GetCurveInput(*state); GetDXCoils(*state); @@ -3057,8 +3058,8 @@ TEST_F(EnergyPlusFixture, CoilHeatingDXSingleSpeed_MinOADBTempCompOperLimit) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); - ProcessScheduleInput(*state); GetDXCoils(*state); ASSERT_EQ("HEATING COIL SINGLESPEED", state->dataDXCoils->DXCoil(1).Name); // Heating Coil Single Speed @@ -3170,8 +3171,8 @@ TEST_F(EnergyPlusFixture, CoilCoolingDXTwoSpeed_MinOADBTempCompOperLimit) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); - ProcessScheduleInput(*state); GetDXCoils(*state); ASSERT_EQ("MAIN COOLING COIL 1", state->dataDXCoils->DXCoil(1).Name); // Cooling Coil Two Speed @@ -3294,8 +3295,8 @@ TEST_F(SQLiteFixture, DXCoils_TestComponentSizingOutput_TwoSpeed) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); - ScheduleManager::ProcessScheduleInput(*state); DXCoils::GetDXCoils(*state); EXPECT_EQ(1, state->dataDXCoils->NumDXCoils); @@ -3325,7 +3326,6 @@ TEST_F(SQLiteFixture, DXCoils_TestComponentSizingOutput_TwoSpeed) state->dataEnvrn->OutDryBulbTemp = 20.0; state->dataEnvrn->OutHumRat = 0.008; state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->StdBaroPress, 20.0, 0.0); - Psychrometrics::InitializePsychRoutines(*state); // Need this to prevent crash in Sizers state->dataSize->UnitarySysEqSizing.allocate(1); @@ -3522,8 +3522,8 @@ TEST_F(SQLiteFixture, DXCoils_TestComponentSizingOutput_SingleSpeed) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); - ScheduleManager::ProcessScheduleInput(*state); DXCoils::GetDXCoils(*state); EXPECT_EQ(1, state->dataDXCoils->NumDXCoils); @@ -3554,7 +3554,6 @@ TEST_F(SQLiteFixture, DXCoils_TestComponentSizingOutput_SingleSpeed) state->dataEnvrn->OutDryBulbTemp = 20.0; state->dataEnvrn->OutHumRat = 0.008; state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->StdBaroPress, 20.0, 0.0); - Psychrometrics::InitializePsychRoutines(*state); // Need this to prevent crash in Sizers state->dataSize->UnitarySysEqSizing.allocate(1); @@ -4014,6 +4013,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedHeatingCoilSizingOutput) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // get input GetDXCoils(*state); @@ -4232,6 +4232,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoolingCoilTabularReporting) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // get input GetDXCoils(*state); @@ -4652,6 +4653,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoilsAutoSizingOutput) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // get input GetDXCoils(*state); @@ -4662,7 +4664,6 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoilsAutoSizingOutput) state->dataEnvrn->StdBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.2; - Psychrometrics::InitializePsychRoutines(*state); // set system sizing parameters state->dataSize->CurZoneEqNum = 0; @@ -4939,6 +4940,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoolingCoilPartialAutoSizeOutput) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // get input GetDXCoils(*state); @@ -4949,7 +4951,6 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoolingCoilPartialAutoSizeOutput) state->dataEnvrn->StdBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.2; - Psychrometrics::InitializePsychRoutines(*state); // set system sizing parameters state->dataSize->CurZoneEqNum = 0; @@ -5142,6 +5143,8 @@ TEST_F(EnergyPlusFixture, DXCoils_RatedInletAirWTest) TEST_F(EnergyPlusFixture, SingleSpeedDXCoolingCoilOutputTest) { + state->init_state(*state); + int DXCoilNum(1); state->dataDXCoils->NumDXCoils = 1; state->dataDXCoils->DXCoil.allocate(state->dataDXCoils->NumDXCoils); @@ -5164,7 +5167,7 @@ TEST_F(EnergyPlusFixture, SingleSpeedDXCoolingCoilOutputTest) auto &AirOutletNode = state->dataLoopNodes->Node(2); // set coil parameters Coil.DXCoilType_Num = HVAC::CoilDX_CoolingSingleSpeed; - Coil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; + Coil.availSched = Sched::GetScheduleAlwaysOn(*state); Coil.RatedTotCap(1) = 17580.0; Coil.RatedCOP(1) = 3.0; Coil.RatedEIR(1) = 1.0 / Coil.RatedCOP(1); @@ -5226,7 +5229,6 @@ TEST_F(EnergyPlusFixture, SingleSpeedDXCoolingCoilOutputTest) state->dataEnvrn->WindDir = 0.0; state->dataEnvrn->StdBaroPress = DataEnvironment::StdPressureSeaLevel; state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->StdBaroPress, 20.0, 0.0); - Psychrometrics::InitializePsychRoutines(*state); // run coil at full capacity Real64 PartLoadRatio(1.0); @@ -5296,6 +5298,7 @@ TEST_F(EnergyPlusFixture, SingleSpeedDXCoolingCoilOutputTest) TEST_F(EnergyPlusFixture, MultiSpeedDXCoolingCoilOutputTest) { + state->init_state(*state); int DXCoilNum(1); state->dataDXCoils->NumDXCoils = 1; @@ -5318,7 +5321,7 @@ TEST_F(EnergyPlusFixture, MultiSpeedDXCoolingCoilOutputTest) Coil.DXCoilType_Num = HVAC::CoilDX_MultiSpeedCooling; Coil.DXCoilType = "Coil:Cooling:DX:MultiSpeed"; - Coil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; + Coil.availSched = Sched::GetScheduleAlwaysOn(*state); Coil.NumOfSpeeds = 2; createSpeedsWithDefaults(Coil); @@ -5397,7 +5400,7 @@ TEST_F(EnergyPlusFixture, MultiSpeedDXCoolingCoilOutputTest) state->dataEnvrn->WindDir = 0.0; state->dataEnvrn->StdBaroPress = DataEnvironment::StdPressureSeaLevel; state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->StdBaroPress, 20.0, 0.0); - Psychrometrics::InitializePsychRoutines(*state); + int SpeedNum = 2; HVAC::FanOp fanOp = HVAC::FanOp::Cycling; HVAC::CompressorOp compressorOp = HVAC::CompressorOp::On; @@ -5590,9 +5593,10 @@ TEST_F(EnergyPlusFixture, TwoSpeedDXCoilStandardRatingsTest) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ScheduleManager::ProcessScheduleInput(*state); + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + state->dataEnvrn->StdRhoAir = 1.0; state->dataEnvrn->OutBaroPress = 101325.0; GetCurveInput(*state); @@ -5834,9 +5838,10 @@ TEST_F(EnergyPlusFixture, TwoSpeedDXCoilStandardRatings_Curve_Fix_Test) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ScheduleManager::ProcessScheduleInput(*state); + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + state->dataEnvrn->StdRhoAir = 1.0; state->dataEnvrn->OutBaroPress = 101325.0; GetCurveInput(*state); @@ -6066,11 +6071,13 @@ TEST_F(EnergyPlusFixture, MSCoolingCoil_TestErrorMessageWithoutPLRobjects) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); ASSERT_THROW(GetDXCoils(*state), std::runtime_error); std::string const error_string = delimited_string({ - " ** Warning ** ProcessScheduleInput: Schedule:Compact=\"FANANDCOILAVAILSCHED\", Schedule Type Limits Name=\"FRACTION\" not found -- will " - "not be validated", + " ** Warning ** ProcessScheduleInput: Schedule:Compact = FANANDCOILAVAILSCHED", + " ** ~~~ ** Schedule Type Limits Name = FRACTION, item not found.", + " ** ~~~ ** Schedule will not be validated.", " ** Severe ** GetDXCoils: Coil:Cooling:DX:MultiSpeed=\"HEAT PUMP ACDXCOIL 1\", invalid", " ** ~~~ ** ...not found Speed 1 Part Load Fraction Correlation Curve Name=\"HPACCOOLPLFFPLR SPEED\".", " ** Severe ** GetDXCoils: Coil:Cooling:DX:MultiSpeed=\"HEAT PUMP ACDXCOIL 1\", invalid", @@ -6940,8 +6947,8 @@ TEST_F(EnergyPlusFixture, Test_DHW_End_Use_Cat_Removal) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); - ProcessScheduleInput(*state); GetCurveInput(*state); GetDXCoils(*state); VariableSpeedCoils::GetVarSpeedCoilInput(*state); diff --git a/tst/EnergyPlus/unit/DataEnvironment.unit.cc b/tst/EnergyPlus/unit/DataEnvironment.unit.cc index fb7e8bccc06..334a0494fbd 100644 --- a/tst/EnergyPlus/unit/DataEnvironment.unit.cc +++ b/tst/EnergyPlus/unit/DataEnvironment.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/DataHeatBalance.unit.cc b/tst/EnergyPlus/unit/DataHeatBalance.unit.cc index b8b0ecaf334..97d15a51b1e 100644 --- a/tst/EnergyPlus/unit/DataHeatBalance.unit.cc +++ b/tst/EnergyPlus/unit/DataHeatBalance.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -77,7 +77,6 @@ using namespace EnergyPlus::DataSurfaces; using namespace EnergyPlus::EMSManager; using namespace EnergyPlus::HeatBalanceManager; using namespace EnergyPlus::OutputProcessor; -using namespace EnergyPlus::ScheduleManager; using namespace EnergyPlus::SimulationManager; using namespace EnergyPlus::SurfaceGeometry; @@ -85,7 +84,6 @@ using namespace EnergyPlus::SurfaceGeometry; TEST_F(EnergyPlusFixture, DataHeatBalance_CheckConstructLayers) { - bool ErrorsFound(false); std::string const idf_objects = delimited_string({ @@ -805,12 +803,7 @@ TEST_F(EnergyPlusFixture, DataHeatBalance_CheckConstructLayers) ASSERT_TRUE(process_idf(idf_objects)); // OutputProcessor::TimeValue.allocate(2); - - ScheduleManager::ProcessScheduleInput(*state); // read schedules - - ErrorsFound = false; - GetProjectControlData(*state, ErrorsFound); // read project control data - EXPECT_FALSE(ErrorsFound); // expect no errors + state->init_state(*state); ErrorsFound = false; Material::GetMaterialData(*state, ErrorsFound); // read material data @@ -862,7 +855,9 @@ TEST_F(EnergyPlusFixture, DataHeatBalance_CheckConstructLayers) GetEMSInput(*state); // check if EMS actuator is not setup because there is no blind/shade layer SetupWindowShadingControlActuators(*state); - EXPECT_EQ(state->dataRuntimeLang->numEMSActuatorsAvailable, 0); // no EMS actuator because there is shade/blind layer + + // init_state() checks for EMS so there will be actuators for schedules and materials already + EXPECT_EQ(state->dataRuntimeLang->numEMSActuatorsAvailable, 19); // add a blind layer in between glass state->dataConstruction->Construct(4).TotLayers = 5; @@ -873,7 +868,7 @@ TEST_F(EnergyPlusFixture, DataHeatBalance_CheckConstructLayers) state->dataConstruction->Construct(4).LayerPoint(3) = 6; // window blind state->dataConstruction->Construct(4).LayerPoint(4) = 5; // air gap state->dataConstruction->Construct(4).LayerPoint(5) = 4; // glass - // updated contruction and material layers data + // updated construction and material layers data EXPECT_EQ(state->dataConstruction->Construct(4).TotLayers, 5); // outer glass, air gap, blind, air gap, inner glass EXPECT_EQ(state->dataConstruction->Construct(4).TotGlassLayers, 2); // outer glass, inner glass EXPECT_EQ(state->dataConstruction->Construct(4).TotSolidLayers, 3); // glass, blind, glass @@ -891,17 +886,18 @@ TEST_F(EnergyPlusFixture, DataHeatBalance_CheckConstructLayers) state->dataSurface->surfShades(windowSurfNum).blind.movableSlats = true; // check if EMS actuator is available when blind layer is added SetupWindowShadingControlActuators(*state); - EXPECT_EQ(state->dataRuntimeLang->numEMSActuatorsAvailable, 2); - EXPECT_EQ(state->dataRuntimeLang->EMSActuatorAvailable(1).ComponentTypeName, "Window Shading Control"); - EXPECT_EQ(state->dataRuntimeLang->EMSActuatorAvailable(1).ControlTypeName, "Control Status"); - EXPECT_EQ(state->dataRuntimeLang->EMSActuatorAvailable(1).Units, "[ShadeStatus]"); - EXPECT_EQ(state->dataRuntimeLang->EMSActuatorAvailable(2).ComponentTypeName, "Window Shading Control"); - EXPECT_EQ(state->dataRuntimeLang->EMSActuatorAvailable(2).ControlTypeName, "Slat Angle"); - EXPECT_EQ(state->dataRuntimeLang->EMSActuatorAvailable(2).Units, "[degrees]"); + EXPECT_EQ(state->dataRuntimeLang->numEMSActuatorsAvailable, 21); + EXPECT_EQ(state->dataRuntimeLang->EMSActuatorAvailable(20).ComponentTypeName, "Window Shading Control"); + EXPECT_EQ(state->dataRuntimeLang->EMSActuatorAvailable(20).ControlTypeName, "Control Status"); + EXPECT_EQ(state->dataRuntimeLang->EMSActuatorAvailable(20).Units, "[ShadeStatus]"); + EXPECT_EQ(state->dataRuntimeLang->EMSActuatorAvailable(21).ComponentTypeName, "Window Shading Control"); + EXPECT_EQ(state->dataRuntimeLang->EMSActuatorAvailable(21).ControlTypeName, "Slat Angle"); + EXPECT_EQ(state->dataRuntimeLang->EMSActuatorAvailable(21).Units, "[degrees]"); } TEST_F(EnergyPlusFixture, DataHeatBalance_setUserTemperatureLocationPerpendicular) { + state->init_state(*state); Real64 userInputValue; Real64 expectedReturnValue; @@ -932,6 +928,7 @@ TEST_F(EnergyPlusFixture, DataHeatBalance_setUserTemperatureLocationPerpendicula TEST_F(EnergyPlusFixture, DataHeatBalance_setNodeSourceAndUserTemp) { + state->init_state(*state); int expectedNodeNumberAtSource; int expectedNodeNumberAtUserSpecifiedLocation; state->dataConstruction->Construct.allocate(1); @@ -992,6 +989,7 @@ TEST_F(EnergyPlusFixture, DataHeatBalance_setNodeSourceAndUserTemp) TEST_F(EnergyPlusFixture, DataHeatBalance_AssignReverseConstructionNumberTest) { + state->init_state(*state); int ConstrNum; int expectedResultRevConstrNum; int functionResultRevConstrNum; @@ -1039,7 +1037,7 @@ TEST_F(EnergyPlusFixture, DataHeatBalance_AssignReverseConstructionNumberTest) TEST_F(EnergyPlusFixture, DataHeatBalance_setThicknessPerpendicularTest) { - + state->init_state(*state); Real64 userInputValue; Real64 expectedReturnValue; Real64 actualReturnValue; @@ -1048,6 +1046,12 @@ TEST_F(EnergyPlusFixture, DataHeatBalance_setThicknessPerpendicularTest) auto &thisConstruct(state->dataConstruction->Construct(1)); thisConstruct.Name = "TestThisConstruction"; + std::string const error_string0 = delimited_string( + {format(" ** Warning ** Version: missing in IDF, processing for EnergyPlus version=\"{}\"", DataStringGlobals::MatchVersion), + " ** Warning ** ConstructionProperty:InternalHeatSource has a tube spacing that is less than 2 mm. This is not allowed.", + " ** ~~~ ** Construction=TestThisConstruction has this problem. The tube spacing has been reset to 0.15m (~6 " + "inches) for this construction.", + " ** ~~~ ** As per the Input Output Reference, tube spacing is only used for 2-D solutions and autosizing."}); std::string const error_string1 = delimited_string({" ** Warning ** ConstructionProperty:InternalHeatSource has a tube spacing that is less than 2 mm. This is not allowed.", " ** ~~~ ** Construction=TestThisConstruction has this problem. The tube spacing has been reset to 0.15m (~6 " @@ -1067,7 +1071,7 @@ TEST_F(EnergyPlusFixture, DataHeatBalance_setThicknessPerpendicularTest) expectedReturnValue = 0.075; actualReturnValue = thisConstruct.setThicknessPerpendicular(*state, userInputValue); EXPECT_NEAR(expectedReturnValue, actualReturnValue, 0.0001); - EXPECT_TRUE(compare_err_stream(error_string1, true)); + EXPECT_TRUE(compare_err_stream(error_string0, true)); // Test 2: User value is greater than zero but still too small--should be reset to the "default" value (warning messages produced) userInputValue = 0.0001; @@ -1098,6 +1102,7 @@ TEST_F(EnergyPlusFixture, DataHeatBalance_setThicknessPerpendicularTest) TEST_F(EnergyPlusFixture, DataHeatBalance_ComputeNominalUwithConvCoeffsTest) { + state->init_state(*state); Real64 expectedAnswer; Real64 actualAnswer; Real64 allowableTolerance = 0.00001; diff --git a/tst/EnergyPlus/unit/DataPlant.unit.cc b/tst/EnergyPlus/unit/DataPlant.unit.cc index 11219f6a031..0494cdd11a7 100644 --- a/tst/EnergyPlus/unit/DataPlant.unit.cc +++ b/tst/EnergyPlus/unit/DataPlant.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/DataRuntimeLanguage.unit.cc b/tst/EnergyPlus/unit/DataRuntimeLanguage.unit.cc index 20e1bd043a5..b60bfcf3886 100644 --- a/tst/EnergyPlus/unit/DataRuntimeLanguage.unit.cc +++ b/tst/EnergyPlus/unit/DataRuntimeLanguage.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/DataSizing.unit.cc b/tst/EnergyPlus/unit/DataSizing.unit.cc index 027e9b4e004..4f2e57842a1 100644 --- a/tst/EnergyPlus/unit/DataSizing.unit.cc +++ b/tst/EnergyPlus/unit/DataSizing.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -345,9 +345,16 @@ TEST_F(EnergyPlusFixture, OARequirements_calcDesignSpecificationOutdoorAir) state->dataGlobal->isEpJSON = true; state->dataInputProcessing->inputProcessor->initializeMaps(); + state->init_state(*state); + bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); - compare_err_stream(""); + + std::string const error_string = delimited_string( + {format(" ** Warning ** Version: missing in IDF, processing for EnergyPlus version=\"{}\"", DataStringGlobals::MatchVersion), + " ** Warning ** No Timestep object found. Number of TimeSteps in Hour defaulted to 4."}); + + EXPECT_TRUE(compare_err_stream(error_string, true)); EXPECT_FALSE(ErrorsFound); int zoneNum = 1; @@ -426,6 +433,7 @@ TEST_F(EnergyPlusFixture, OARequirements_calcDesignSpecificationOutdoorAir) TEST_F(EnergyPlusFixture, GetCoilDesFlowT_Test) { + state->init_state(*state); state->dataEnvrn->StdRhoAir = 1.1; state->dataSize->SysSizInput.allocate(1); state->dataSize->FinalSysSizing.allocate(1); diff --git a/tst/EnergyPlus/unit/DataSurfaceColors.unit.cc b/tst/EnergyPlus/unit/DataSurfaceColors.unit.cc index a20c9a116f4..441002b7ffc 100644 --- a/tst/EnergyPlus/unit/DataSurfaceColors.unit.cc +++ b/tst/EnergyPlus/unit/DataSurfaceColors.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/DataSurfaces.unit.cc b/tst/EnergyPlus/unit/DataSurfaces.unit.cc index 47f73136b74..cd44409ec75 100644 --- a/tst/EnergyPlus/unit/DataSurfaces.unit.cc +++ b/tst/EnergyPlus/unit/DataSurfaces.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -178,8 +178,8 @@ TEST_F(EnergyPlusFixture, DataSurfaces_SetSurfaceOutBulbTempAtTest) state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; @@ -402,45 +402,45 @@ TEST_F(EnergyPlusFixture, SurfaceTest_AverageHeightRectangle) s.Vertex = {Vector(0, 0, 0), Vector(1, 0, 0), Vector(1, 1, 0), Vector(0, 1, 0)}; Vectors::CreateNewellSurfaceNormalVector(s.Vertex, s.Vertex.size(), s.NewellSurfaceNormalVector); Vectors::DetermineAzimuthAndTilt(s.Vertex, s.Azimuth, s.Tilt, s.lcsx, s.lcsy, s.lcsz, s.NewellSurfaceNormalVector); - s.SinAzim = std::sin(s.Azimuth * Constant::DegToRadians); - s.CosAzim = std::cos(s.Azimuth * Constant::DegToRadians); - s.SinTilt = std::sin(s.Tilt * Constant::DegToRadians); + s.SinAzim = std::sin(s.Azimuth * Constant::DegToRad); + s.CosAzim = std::cos(s.Azimuth * Constant::DegToRad); + s.SinTilt = std::sin(s.Tilt * Constant::DegToRad); EXPECT_DOUBLE_EQ(s.get_average_height(*state), 0.0); s.Vertex = {Vector(0, 0, 0), Vector(1, 1, 0), Vector(1, 1, 1), Vector(0, 0, 1)}; Vectors::CreateNewellSurfaceNormalVector(s.Vertex, s.Vertex.size(), s.NewellSurfaceNormalVector); Vectors::DetermineAzimuthAndTilt(s.Vertex, s.Azimuth, s.Tilt, s.lcsx, s.lcsy, s.lcsz, s.NewellSurfaceNormalVector); - s.SinAzim = std::sin(s.Azimuth * Constant::DegToRadians); - s.CosAzim = std::cos(s.Azimuth * Constant::DegToRadians); - s.SinTilt = std::sin(s.Tilt * Constant::DegToRadians); + s.SinAzim = std::sin(s.Azimuth * Constant::DegToRad); + s.CosAzim = std::cos(s.Azimuth * Constant::DegToRad); + s.SinTilt = std::sin(s.Tilt * Constant::DegToRad); EXPECT_DOUBLE_EQ(s.get_average_height(*state), 1.0); s.Vertex = {Vector(0, 0, 0), Vector(1, 0, 0), Vector(1, 1, 1), Vector(0, 1, 1)}; Vectors::CreateNewellSurfaceNormalVector(s.Vertex, s.Vertex.size(), s.NewellSurfaceNormalVector); Vectors::DetermineAzimuthAndTilt(s.Vertex, s.Azimuth, s.Tilt, s.lcsx, s.lcsy, s.lcsz, s.NewellSurfaceNormalVector); - s.SinAzim = std::sin(s.Azimuth * Constant::DegToRadians); - s.CosAzim = std::cos(s.Azimuth * Constant::DegToRadians); - s.SinTilt = std::sin(s.Tilt * Constant::DegToRadians); + s.SinAzim = std::sin(s.Azimuth * Constant::DegToRad); + s.CosAzim = std::cos(s.Azimuth * Constant::DegToRad); + s.SinTilt = std::sin(s.Tilt * Constant::DegToRad); EXPECT_DOUBLE_EQ(s.get_average_height(*state), 1.0 / s.SinTilt); s.Vertex = {Vector(0, 0, 0), Vector(0, 1, 0), Vector(0, 1, 1), Vector(0, 0, 1)}; Vectors::CreateNewellSurfaceNormalVector(s.Vertex, s.Vertex.size(), s.NewellSurfaceNormalVector); Vectors::DetermineAzimuthAndTilt(s.Vertex, s.Azimuth, s.Tilt, s.lcsx, s.lcsy, s.lcsz, s.NewellSurfaceNormalVector); - s.SinAzim = std::sin(s.Azimuth * Constant::DegToRadians); - s.CosAzim = std::cos(s.Azimuth * Constant::DegToRadians); - s.SinTilt = std::sin(s.Tilt * Constant::DegToRadians); + s.SinAzim = std::sin(s.Azimuth * Constant::DegToRad); + s.CosAzim = std::cos(s.Azimuth * Constant::DegToRad); + s.SinTilt = std::sin(s.Tilt * Constant::DegToRad); EXPECT_DOUBLE_EQ(s.get_average_height(*state), 1.0); s.Vertex = {Vector(1, -1, 0), Vector(1, -1, -1), Vector(0, 0, -1), Vector(0, 0, 0)}; Vectors::CreateNewellSurfaceNormalVector(s.Vertex, s.Vertex.size(), s.NewellSurfaceNormalVector); Vectors::DetermineAzimuthAndTilt(s.Vertex, s.Azimuth, s.Tilt, s.lcsx, s.lcsy, s.lcsz, s.NewellSurfaceNormalVector); - s.SinAzim = std::sin(s.Azimuth * Constant::DegToRadians); - s.CosAzim = std::cos(s.Azimuth * Constant::DegToRadians); - s.SinTilt = std::sin(s.Tilt * Constant::DegToRadians); + s.SinAzim = std::sin(s.Azimuth * Constant::DegToRad); + s.CosAzim = std::cos(s.Azimuth * Constant::DegToRad); + s.SinTilt = std::sin(s.Tilt * Constant::DegToRad); EXPECT_DOUBLE_EQ(s.get_average_height(*state), 1.0); } @@ -456,18 +456,18 @@ TEST_F(EnergyPlusFixture, SurfaceTest_AverageHeightTriangle) s.Vertex = {Vector(0, 0, 0), Vector(1, 0, 0), Vector(1, 0, 1)}; Vectors::CreateNewellSurfaceNormalVector(s.Vertex, s.Vertex.size(), s.NewellSurfaceNormalVector); Vectors::DetermineAzimuthAndTilt(s.Vertex, s.Azimuth, s.Tilt, s.lcsx, s.lcsy, s.lcsz, s.NewellSurfaceNormalVector); - s.SinAzim = std::sin(s.Azimuth * Constant::DegToRadians); - s.CosAzim = std::cos(s.Azimuth * Constant::DegToRadians); - s.SinTilt = std::sin(s.Tilt * Constant::DegToRadians); + s.SinAzim = std::sin(s.Azimuth * Constant::DegToRad); + s.CosAzim = std::cos(s.Azimuth * Constant::DegToRad); + s.SinTilt = std::sin(s.Tilt * Constant::DegToRad); EXPECT_DOUBLE_EQ(s.get_average_height(*state), 0.5); s.Vertex = {Vector(0, 0, 0), Vector(0, 0, 1), Vector(1, 0, 0)}; Vectors::CreateNewellSurfaceNormalVector(s.Vertex, s.Vertex.size(), s.NewellSurfaceNormalVector); Vectors::DetermineAzimuthAndTilt(s.Vertex, s.Azimuth, s.Tilt, s.lcsx, s.lcsy, s.lcsz, s.NewellSurfaceNormalVector); - s.SinAzim = std::sin(s.Azimuth * Constant::DegToRadians); - s.CosAzim = std::cos(s.Azimuth * Constant::DegToRadians); - s.SinTilt = std::sin(s.Tilt * Constant::DegToRadians); + s.SinAzim = std::sin(s.Azimuth * Constant::DegToRad); + s.CosAzim = std::cos(s.Azimuth * Constant::DegToRad); + s.SinTilt = std::sin(s.Tilt * Constant::DegToRad); EXPECT_DOUBLE_EQ(s.get_average_height(*state), 0.5); } @@ -483,18 +483,18 @@ TEST_F(EnergyPlusFixture, SurfaceTest_AverageHeightL) s.Vertex = {Vector(0, 0, 0), Vector(0, 0, 1), Vector(0.5, 0, 1), Vector(0.5, 0, 0.5), Vector(1, 0, 0.5), Vector(1, 0, 0)}; Vectors::CreateNewellSurfaceNormalVector(s.Vertex, s.Vertex.size(), s.NewellSurfaceNormalVector); Vectors::DetermineAzimuthAndTilt(s.Vertex, s.Azimuth, s.Tilt, s.lcsx, s.lcsy, s.lcsz, s.NewellSurfaceNormalVector); - s.SinAzim = std::sin(s.Azimuth * Constant::DegToRadians); - s.CosAzim = std::cos(s.Azimuth * Constant::DegToRadians); - s.SinTilt = std::sin(s.Tilt * Constant::DegToRadians); + s.SinAzim = std::sin(s.Azimuth * Constant::DegToRad); + s.CosAzim = std::cos(s.Azimuth * Constant::DegToRad); + s.SinTilt = std::sin(s.Tilt * Constant::DegToRad); EXPECT_DOUBLE_EQ(s.get_average_height(*state), 0.75); s.Vertex = {Vector(0, 0, 0), Vector(0, 0, 1), Vector(1, 0, 1), Vector(1, 0, 0.5), Vector(0.5, 0, 0.5), Vector(0.5, 0, 0)}; Vectors::CreateNewellSurfaceNormalVector(s.Vertex, s.Vertex.size(), s.NewellSurfaceNormalVector); Vectors::DetermineAzimuthAndTilt(s.Vertex, s.Azimuth, s.Tilt, s.lcsx, s.lcsy, s.lcsz, s.NewellSurfaceNormalVector); - s.SinAzim = std::sin(s.Azimuth * Constant::DegToRadians); - s.CosAzim = std::cos(s.Azimuth * Constant::DegToRadians); - s.SinTilt = std::sin(s.Tilt * Constant::DegToRadians); + s.SinAzim = std::sin(s.Azimuth * Constant::DegToRad); + s.CosAzim = std::cos(s.Azimuth * Constant::DegToRad); + s.SinTilt = std::sin(s.Tilt * Constant::DegToRad); EXPECT_DOUBLE_EQ(s.get_average_height(*state), 0.75); } @@ -510,10 +510,8 @@ TEST_F(EnergyPlusFixture, SurfaceTest_HashMap) state->dataSurface->surfExtConv.allocate(numSurfs); std::fill(state->dataSurface->surfExtConv.begin(), state->dataSurface->surfExtConv.end(), SurfExtConv()); state->dataSurface->SurfWinStormWinConstr.dimension(numSurfs, 0); - state->dataSurface->SurfMaterialMovInsulExt.dimension(numSurfs, 0); - state->dataSurface->SurfMaterialMovInsulInt.dimension(numSurfs, 0); - state->dataSurface->SurfSchedMovInsulExt.dimension(numSurfs, 0); - state->dataSurface->SurfSchedMovInsulInt.dimension(numSurfs, 0); + state->dataSurface->intMovInsuls.allocate(numSurfs); + state->dataSurface->extMovInsuls.allocate(numSurfs); for (int SurfNum = 1; SurfNum <= numSurfs; SurfNum++) { state->dataSurface->Surface(SurfNum).set_representative_surface(*state, SurfNum); @@ -571,9 +569,9 @@ TEST_F(EnergyPlusFixture, SurfaceTest_Azimuth_non_conv) EXPECT_DOUBLE_EQ(s.Azimuth, 180.0); // Orignal code without PR 9907 fix would fail this one by getting an s.Azimuth of 0.0 EXPECT_DOUBLE_EQ(s.Tilt, 90.0); - s.SinAzim = std::sin(s.Azimuth * Constant::DegToRadians); - s.CosAzim = std::cos(s.Azimuth * Constant::DegToRadians); - s.SinTilt = std::sin(s.Tilt * Constant::DegToRadians); + s.SinAzim = std::sin(s.Azimuth * Constant::DegToRad); + s.CosAzim = std::cos(s.Azimuth * Constant::DegToRad); + s.SinTilt = std::sin(s.Tilt * Constant::DegToRad); EXPECT_NEAR(s.SinAzim, 0.0, 1e-15); EXPECT_DOUBLE_EQ(s.CosAzim, -1.0); @@ -594,9 +592,9 @@ TEST_F(EnergyPlusFixture, SurfaceTest_Azimuth_non_conv) EXPECT_DOUBLE_EQ(s.Azimuth, 180.0); EXPECT_DOUBLE_EQ(s.Tilt, 90.0); - s.SinAzim = std::sin(s.Azimuth * Constant::DegToRadians); - s.CosAzim = std::cos(s.Azimuth * Constant::DegToRadians); - s.SinTilt = std::sin(s.Tilt * Constant::DegToRadians); + s.SinAzim = std::sin(s.Azimuth * Constant::DegToRad); + s.CosAzim = std::cos(s.Azimuth * Constant::DegToRad); + s.SinTilt = std::sin(s.Tilt * Constant::DegToRad); EXPECT_NEAR(s.SinAzim, 0.0, 1e-15); EXPECT_DOUBLE_EQ(s.CosAzim, -1.0); diff --git a/tst/EnergyPlus/unit/DataSystemVariables.unit.cc b/tst/EnergyPlus/unit/DataSystemVariables.unit.cc index 58fbfd0cc6c..c95d7af2a4a 100644 --- a/tst/EnergyPlus/unit/DataSystemVariables.unit.cc +++ b/tst/EnergyPlus/unit/DataSystemVariables.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/DataZoneEquipment.unit.cc b/tst/EnergyPlus/unit/DataZoneEquipment.unit.cc index 2672e3fe368..24143e63625 100644 --- a/tst/EnergyPlus/unit/DataZoneEquipment.unit.cc +++ b/tst/EnergyPlus/unit/DataZoneEquipment.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -71,7 +71,7 @@ using namespace EnergyPlus::DataZoneEquipment; TEST_F(EnergyPlusFixture, DataZoneEquipment_TestGetSystemNodeNumberForZone) { - + state->init_state(*state); state->dataGlobal->NumOfZones = 2; state->dataZoneEquip->ZoneEquipConfig.allocate(state->dataGlobal->NumOfZones); @@ -94,12 +94,11 @@ TEST_F(EnergyPlusFixture, DataZoneEquipment_TestGetSystemNodeNumberForZone) TEST_F(EnergyPlusFixture, DataZoneEquipment_TestCalcDesignSpecificationOutdoorAir) { // #6225 - + state->init_state(*state); state->dataHeatBal->Zone.allocate(1); state->dataSize->OARequirements.allocate(1); state->dataHeatBal->ZoneIntGain.allocate(1); state->dataHeatBal->People.allocate(1); - state->dataScheduleMgr->Schedule.allocate(2); state->dataContaminantBalance->ZoneCO2GainFromPeople.allocate(1); state->dataContaminantBalance->ZoneAirCO2.allocate(1); state->dataContaminantBalance->ZoneSysContDemand.allocate(1); @@ -108,10 +107,10 @@ TEST_F(EnergyPlusFixture, DataZoneEquipment_TestCalcDesignSpecificationOutdoorAi state->dataHeatBal->Zone(1).FloorArea = 10.0; state->dataHeatBal->Zone(1).TotOccupants = 5.0; - state->dataHeatBal->Zone(1).ZoneContamControllerSchedIndex = 1; + state->dataHeatBal->Zone(1).zoneContamControllerSched = Sched::AddScheduleConstant(*state, "ZONE CONTAM CONTROLLER"); state->dataHeatBal->People(1).ZonePtr = 1; state->dataHeatBal->TotPeople = 1; - state->dataHeatBal->People(1).ActivityLevelPtr = 2; + state->dataHeatBal->People(1).activityLevelSched = Sched::AddScheduleConstant(*state, "ACTIVITY LEVEL SCHED"); state->dataHeatBal->People(1).CO2RateFactor = 3.82e-8; state->dataHeatBal->People(1).NumberOfPeople = state->dataHeatBal->Zone(1).TotOccupants; @@ -125,8 +124,8 @@ TEST_F(EnergyPlusFixture, DataZoneEquipment_TestCalcDesignSpecificationOutdoorAi state->dataSize->OARequirements(1).OAFlowPerPerson = 0.002; state->dataSize->OARequirements(1).OAFlowPerArea = 0.003; state->dataHeatBal->ZoneIntGain(1).NOFOCC = 0.5; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(2).CurrentValue = 131.881995; + state->dataHeatBal->Zone(1).zoneContamControllerSched->currentVal = 1.0; + state->dataHeatBal->People(1).activityLevelSched->currentVal = 131.881995; Real64 OAVolumeFlowRate; // Test ZOAM_ProportionalControlSchOcc @@ -154,7 +153,6 @@ TEST_F(EnergyPlusFixture, DataZoneEquipment_TestCalcDesignSpecificationOutdoorAi state->dataHeatBal->Zone.deallocate(); state->dataSize->OARequirements.deallocate(); state->dataHeatBal->ZoneIntGain.deallocate(); - state->dataScheduleMgr->Schedule.deallocate(); state->dataHeatBal->People.deallocate(); state->dataContaminantBalance->ZoneCO2GainFromPeople.deallocate(); state->dataContaminantBalance->ZoneAirCO2.deallocate(); @@ -386,9 +384,9 @@ TEST_F(EnergyPlusFixture, GetZoneEquipmentData_epJSON) state->dataIPShortCut->rNumericArgs.dimension(MaxNumeric, 0.0); state->dataIPShortCut->lNumericFieldBlanks.dimension(MaxNumeric, false); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); @@ -407,22 +405,22 @@ TEST_F(EnergyPlusFixture, GetZoneEquipmentData_epJSON) EXPECT_ENUM_EQ(DataZoneEquipment::ZoneEquipType::ExhaustFan, thisZoneEquipList.EquipType(1)); EXPECT_EQ(1, thisZoneEquipList.CoolingPriority(1)); EXPECT_EQ(1, thisZoneEquipList.HeatingPriority(1)); - EXPECT_EQ(-1, thisZoneEquipList.SequentialCoolingFractionSchedPtr(1)); - EXPECT_EQ(-1, thisZoneEquipList.SequentialHeatingFractionSchedPtr(1)); + EXPECT_EQ(Sched::GetScheduleAlwaysOn(*state), thisZoneEquipList.sequentialCoolingFractionScheds(1)); + EXPECT_EQ(Sched::GetScheduleAlwaysOn(*state), thisZoneEquipList.sequentialHeatingFractionScheds(1)); EXPECT_EQ("ADU AIR TERMINAL SINGLE DUCT CONSTANT VOLUME NO REHEAT 1", thisZoneEquipList.EquipName(2)); EXPECT_EQ("ZONEHVAC:AIRDISTRIBUTIONUNIT", thisZoneEquipList.EquipTypeName(2)); EXPECT_ENUM_EQ(DataZoneEquipment::ZoneEquipType::AirDistributionUnit, thisZoneEquipList.EquipType(2)); EXPECT_EQ(3, thisZoneEquipList.CoolingPriority(2)); EXPECT_EQ(2, thisZoneEquipList.HeatingPriority(2)); - EXPECT_EQ(-1, thisZoneEquipList.SequentialCoolingFractionSchedPtr(2)); - EXPECT_EQ(-1, thisZoneEquipList.SequentialHeatingFractionSchedPtr(2)); + EXPECT_EQ(Sched::GetScheduleAlwaysOn(*state), thisZoneEquipList.sequentialCoolingFractionScheds(2)); + EXPECT_EQ(Sched::GetScheduleAlwaysOn(*state), thisZoneEquipList.sequentialHeatingFractionScheds(2)); EXPECT_EQ("ADU AIR TERMINAL SINGLE DUCT VAV REHEAT 1", thisZoneEquipList.EquipName(3)); EXPECT_EQ("ZONEHVAC:AIRDISTRIBUTIONUNIT", thisZoneEquipList.EquipTypeName(3)); EXPECT_ENUM_EQ(DataZoneEquipment::ZoneEquipType::AirDistributionUnit, thisZoneEquipList.EquipType(3)); EXPECT_EQ(2, thisZoneEquipList.CoolingPriority(3)); EXPECT_EQ(3, thisZoneEquipList.HeatingPriority(3)); - EXPECT_EQ(-1, thisZoneEquipList.SequentialCoolingFractionSchedPtr(3)); - EXPECT_EQ(-1, thisZoneEquipList.SequentialHeatingFractionSchedPtr(3)); + EXPECT_EQ(Sched::GetScheduleAlwaysOn(*state), thisZoneEquipList.sequentialCoolingFractionScheds(3)); + EXPECT_EQ(Sched::GetScheduleAlwaysOn(*state), thisZoneEquipList.sequentialHeatingFractionScheds(3)); } diff --git a/tst/EnergyPlus/unit/Datasets.unit.cc b/tst/EnergyPlus/unit/Datasets.unit.cc index 53d21bcb8a5..900453d3112 100644 --- a/tst/EnergyPlus/unit/Datasets.unit.cc +++ b/tst/EnergyPlus/unit/Datasets.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/DaylightingDevices.unit.cc b/tst/EnergyPlus/unit/DaylightingDevices.unit.cc index e8d92b35e14..42afb774658 100644 --- a/tst/EnergyPlus/unit/DaylightingDevices.unit.cc +++ b/tst/EnergyPlus/unit/DaylightingDevices.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/DaylightingManager.unit.cc b/tst/EnergyPlus/unit/DaylightingManager.unit.cc index 913ede27f08..683c7d54277 100644 --- a/tst/EnergyPlus/unit/DaylightingManager.unit.cc +++ b/tst/EnergyPlus/unit/DaylightingManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -130,6 +130,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_GetInputDaylightingControls_Test) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); auto &dl = state->dataDayltg; @@ -243,6 +244,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_GetInputDaylightingControls_3RefPt_ }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); auto &dl = state->dataDayltg; @@ -340,6 +342,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_GetInputDayliteRefPt_Test) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); auto &dl = state->dataDayltg; @@ -404,6 +407,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_GetInputOutputIlluminanceMap_Test) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); auto &dl = state->dataDayltg; @@ -437,6 +441,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_GetInputOutputIlluminanceMap_Test) TEST_F(EnergyPlusFixture, DaylightingManager_doesDayLightingUseDElight_Test) { + state->init_state(*state); EXPECT_FALSE(doesDayLightingUseDElight(*state)); auto &dl = state->dataDayltg; @@ -854,14 +859,14 @@ TEST_F(EnergyPlusFixture, DaylightingManager_GetDaylParamInGeoTrans_Test) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); auto &dl = state->dataDayltg; bool foundErrors = false; - HeatBalanceManager::GetProjectControlData(*state, foundErrors); // read project control data - EXPECT_FALSE(foundErrors); // expect no errors - Material::GetMaterialData(*state, foundErrors); // read material data EXPECT_FALSE(foundErrors); // expect no errors @@ -876,10 +881,10 @@ TEST_F(EnergyPlusFixture, DaylightingManager_GetDaylParamInGeoTrans_Test) state->dataSurfaceGeometry->CosZoneRelNorth.allocate(2); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(2); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; @@ -890,11 +895,6 @@ TEST_F(EnergyPlusFixture, DaylightingManager_GetDaylParamInGeoTrans_Test) EXPECT_FALSE(foundErrors); // expect no errors HeatBalanceIntRadExchange::InitSolarViewFactors(*state); - int constexpr HoursInDay(24); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; state->dataGlobal->TimeStep = 1; state->dataGlobal->HourOfDay = 1; state->dataGlobal->PreviousHour = 1; @@ -905,7 +905,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_GetDaylParamInGeoTrans_Test) state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); InternalHeatGains::GetInternalHeatGainsInput(*state); state->dataInternalHeatGains->GetInternalHeatGainsInputFlag = false; @@ -941,8 +941,8 @@ TEST_F(EnergyPlusFixture, DaylightingManager_GetDaylParamInGeoTrans_Test) state->dataGlobal->WeightNow = 1.0; state->dataGlobal->WeightPreviousHour = 0.0; - state->dataSurface->SurfSunCosHourly.allocate(HoursInDay); - for (int hour = 1; hour <= HoursInDay; hour++) { + state->dataSurface->SurfSunCosHourly.allocate(Constant::iHoursInDay); + for (int hour = 1; hour <= Constant::iHoursInDay; hour++) { state->dataSurface->SurfSunCosHourly(hour) = 0.0; } CalcDayltgCoefficients(*state); @@ -957,6 +957,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_GetDaylParamInGeoTrans_Test) TEST_F(EnergyPlusFixture, DaylightingManager_ProfileAngle_Test) { + state->init_state(*state); state->dataSurface->Surface.allocate(1); state->dataSurface->Surface(1).Tilt = 90.0; @@ -989,6 +990,8 @@ TEST_F(EnergyPlusFixture, DaylightingManager_ProfileAngle_Test) TEST_F(EnergyPlusFixture, AssociateWindowShadingControlWithDaylighting_Test) { + state->init_state(*state); + auto &dl = state->dataDayltg; state->dataGlobal->NumOfZones = 4; @@ -1019,6 +1022,8 @@ TEST_F(EnergyPlusFixture, AssociateWindowShadingControlWithDaylighting_Test) TEST_F(EnergyPlusFixture, CreateShadeDeploymentOrder_test) { + state->init_state(*state); + auto &dl = state->dataDayltg; state->dataSurface->TotWinShadingControl = 3; state->dataSurface->WindowShadingControl.allocate(state->dataSurface->TotWinShadingControl); @@ -1098,6 +1103,7 @@ TEST_F(EnergyPlusFixture, CreateShadeDeploymentOrder_test) TEST_F(EnergyPlusFixture, MapShadeDeploymentOrderToLoopNumber_Test) { + state->init_state(*state); auto &dl = state->dataDayltg; state->dataSurface->TotWinShadingControl = 3; state->dataSurface->WindowShadingControl.allocate(state->dataSurface->TotWinShadingControl); @@ -1416,9 +1422,9 @@ TEST_F(EnergyPlusFixture, DaylightingManager_DayltgInteriorIllum_LuminanceShadin auto &dl = state->dataDayltg; - state->dataGlobal->NumOfTimeStepInHour = 1; - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->dataGlobal->TimeStepsInHour = 1; + state->init_state(*state); + state->dataGlobal->TimeStep = 1; state->dataGlobal->HourOfDay = 10; state->dataGlobal->PreviousHour = 9; @@ -1429,8 +1435,6 @@ TEST_F(EnergyPlusFixture, DaylightingManager_DayltgInteriorIllum_LuminanceShadin state->dataEnvrn->HolidayIndex = 0; bool foundErrors = false; - HeatBalanceManager::GetProjectControlData(*state, foundErrors); // read project control data - EXPECT_FALSE(foundErrors); // expect no errors Material::GetMaterialData(*state, foundErrors); // read material data EXPECT_FALSE(foundErrors); // expect no errors @@ -1456,7 +1460,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_DayltgInteriorIllum_LuminanceShadin // Set the following values to make thisDaylightControl.SourceLumFromWinAtRefPt much larger than // luminance threshold of 2000 (WindowShadingControl SetPoint2) - for (int iHr = 1; iHr <= Constant::HoursInDay; ++iHr) { + for (int iHr = 1; iHr <= Constant::iHoursInDay; ++iHr) { dl->horIllum[iHr].sky = {8.0, 8.0, 8.0, 8.0}; } state->dataGlobal->WeightNow = 0.54; @@ -1468,7 +1472,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_DayltgInteriorIllum_LuminanceShadin int numExtWins = dl->enclDaylight(1).TotalExtWindows; int numRefPts = thisDaylgtCtrl.TotalDaylRefPoints; - for (int iHr = 1; iHr <= Constant::HoursInDay; ++iHr) { + for (int iHr = 1; iHr <= Constant::iHoursInDay; ++iHr) { for (int iWin = 1; iWin <= numExtWins; ++iWin) { for (int iRefPt = 1; iRefPt <= numRefPts; ++iRefPt) { for (int iWinCover = 0; iWinCover < (int)WinCover::Num; ++iWinCover) { @@ -1495,7 +1499,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_DayltgInteriorIllum_LuminanceShadin EXPECT_TRUE(state->dataSurface->SurfWinShadingFlag(ISurf) == WinShadingType::IntShade); // Set the following values to make thisDaylightControl.SourceLumFromWinAtRefPt 0 - for (int iHr = 1; iHr <= Constant::HoursInDay; ++iHr) { + for (int iHr = 1; iHr <= Constant::iHoursInDay; ++iHr) { dl->horIllum[iHr].sky = {100.0, 100.0, 100.0, 100.0}; } state->dataGlobal->WeightNow = 1.0; @@ -1503,7 +1507,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_DayltgInteriorIllum_LuminanceShadin state->dataEnvrn->HISKF = 100.0; state->dataEnvrn->SkyClearness = 6.0; - for (int iHr = 1; iHr <= Constant::HoursInDay; ++iHr) { + for (int iHr = 1; iHr <= Constant::iHoursInDay; ++iHr) { for (int iWin = 1; iWin <= numExtWins; ++iWin) { for (int iRefPt = 1; iRefPt <= numRefPts; ++iRefPt) { for (int iWinCover = 0; iWinCover < (int)WinCover::Num; ++iWinCover) { @@ -1743,11 +1747,11 @@ TEST_F(EnergyPlusFixture, DaylightingManager_DayltgInteriorIllum_Test) ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; + state->init_state(*state); + auto &dl = state->dataDayltg; - state->dataGlobal->NumOfTimeStepInHour = 1; - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; state->dataGlobal->TimeStep = 1; state->dataGlobal->HourOfDay = 10; state->dataGlobal->PreviousHour = 10; @@ -1758,8 +1762,6 @@ TEST_F(EnergyPlusFixture, DaylightingManager_DayltgInteriorIllum_Test) state->dataEnvrn->HolidayIndex = 0; bool foundErrors = false; - HeatBalanceManager::GetProjectControlData(*state, foundErrors); // read project control data - EXPECT_FALSE(foundErrors); // expect no errors Material::GetMaterialData(*state, foundErrors); // read material data EXPECT_FALSE(foundErrors); // expect no errors @@ -1782,7 +1784,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_DayltgInteriorIllum_Test) Dayltg::GetInputDayliteRefPt(*state, foundErrors); Dayltg::GetDaylightingParametersInput(*state); - for (int iHr = 1; iHr <= Constant::HoursInDay; ++iHr) { + for (int iHr = 1; iHr <= Constant::iHoursInDay; ++iHr) { dl->horIllum[iHr].sky = {100.0, 100.0, 100.0, 100.0}; } @@ -1795,7 +1797,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_DayltgInteriorIllum_Test) int numExtWins = dl->enclDaylight(1).TotalExtWindows; int numRefPts = thisDaylgtCtrl.TotalDaylRefPoints; - for (int iHr = 1; iHr <= Constant::HoursInDay; ++iHr) { + for (int iHr = 1; iHr <= Constant::iHoursInDay; ++iHr) { for (int iWin = 1; iWin <= numExtWins; ++iWin) { for (int iRefPt = 1; iRefPt <= numRefPts; ++iRefPt) { for (int iWinCover = 0; iWinCover < (int)WinCover::Num; ++iWinCover) { @@ -1855,7 +1857,6 @@ TEST_F(EnergyPlusFixture, DaylightingManager_DayltgInteriorIllum_Test) // yet with double rounding errors it throws a severe about sum of fraction > 1.0 TEST_F(EnergyPlusFixture, DaylightingManager_GetInputDaylightingControls_RoundingError) { - std::string const idf_objects = delimited_string({ "Zone,", " West Zone, !- Name", @@ -1986,6 +1987,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_GetInputDaylightingControls_Roundin }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); auto &dl = state->dataDayltg; @@ -2054,7 +2056,6 @@ TEST_F(EnergyPlusFixture, DaylightingManager_GetInputDaylightingControls_Roundin TEST_F(EnergyPlusFixture, DaylightingManager_GetInputDaylightingControls_NotAroundOne) { - std::string const idf_objects = delimited_string({ "Zone,", " West Zone, !- Name", @@ -2105,6 +2106,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_GetInputDaylightingControls_NotArou }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); auto &dl = state->dataDayltg; @@ -2551,14 +2553,14 @@ TEST_F(EnergyPlusFixture, DaylightingManager_OutputFormats) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); auto &dl = state->dataDayltg; bool foundErrors = false; - HeatBalanceManager::GetProjectControlData(*state, foundErrors); // read project control data - EXPECT_FALSE(foundErrors); // expect no errors - Material::GetMaterialData(*state, foundErrors); // read material data EXPECT_FALSE(foundErrors); // expect no errors @@ -2577,10 +2579,10 @@ TEST_F(EnergyPlusFixture, DaylightingManager_OutputFormats) state->dataSurfaceGeometry->CosZoneRelNorth.allocate(2); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(2); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; @@ -2591,11 +2593,6 @@ TEST_F(EnergyPlusFixture, DaylightingManager_OutputFormats) EXPECT_FALSE(foundErrors); // expect no errors HeatBalanceIntRadExchange::InitSolarViewFactors(*state); - int constexpr HoursInDay(24); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; state->dataGlobal->TimeStep = 1; state->dataGlobal->HourOfDay = 1; state->dataGlobal->PreviousHour = 1; @@ -2607,7 +2604,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_OutputFormats) state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->CurMnDy = "01/21"; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); InternalHeatGains::GetInternalHeatGainsInput(*state); state->dataInternalHeatGains->GetInternalHeatGainsInputFlag = false; @@ -2661,8 +2658,8 @@ TEST_F(EnergyPlusFixture, DaylightingManager_OutputFormats) state->dataGlobal->BeginSimFlag = true; state->dataGlobal->WeightNow = 1.0; state->dataGlobal->WeightPreviousHour = 0.0; - state->dataSurface->SurfSunCosHourly.allocate(HoursInDay); - for (int hour = 1; hour <= HoursInDay; hour++) { + state->dataSurface->SurfSunCosHourly.allocate(Constant::iHoursInDay); + for (int hour = 1; hour <= Constant::iHoursInDay; hour++) { state->dataSurface->SurfSunCosHourly(hour) = 0.0; } CalcDayltgCoefficients(*state); @@ -3337,10 +3334,9 @@ TEST_F(EnergyPlusFixture, DaylightingManager_TDD_NoDaylightingControls) }); ASSERT_TRUE(process_idf(idf_objects)); - bool foundErrors = false; + state->init_state(*state); - HeatBalanceManager::GetProjectControlData(*state, foundErrors); // read project control data - EXPECT_FALSE(foundErrors); // expect no errors + bool foundErrors = false; Material::GetMaterialData(*state, foundErrors); // read material data EXPECT_FALSE(foundErrors); // expect no errors @@ -3355,10 +3351,10 @@ TEST_F(EnergyPlusFixture, DaylightingManager_TDD_NoDaylightingControls) state->dataSurfaceGeometry->CosZoneRelNorth.allocate(2); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(2); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; int constexpr HoursInDay(24); @@ -3388,6 +3384,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_TDD_NoDaylightingControls) TEST_F(EnergyPlusFixture, DaylightingManager_ReportillumMaps) { + state->init_state(*state); auto &dl = state->dataDayltg; int MapNum = 1; @@ -3423,6 +3420,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_ReportillumMaps) EXPECT_EQ(expectedResultName, dl->illumMaps(1).Name); EXPECT_EQ(expectedResultPtsHeader, dl->illumMaps(MapNum).pointsHeader); } + TEST_F(EnergyPlusFixture, DaylightingManager_DayltgIlluminanceMap) { std::string const idf_objects = delimited_string({ @@ -3697,6 +3695,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_DayltgIlluminanceMap) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); auto &dl = state->dataDayltg; @@ -3725,6 +3724,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_DayltgIlluminanceMap) TEST_F(EnergyPlusFixture, DaylightingManager_SteppedControl_LowDaylightConditions) { + state->init_state(*state); // Test for #9060 auto &dl = state->dataDayltg; @@ -3747,7 +3747,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_SteppedControl_LowDaylightCondition thisDaylightControl.DaylightMethod = DaylightingMethod::SplitFlux; thisDaylightControl.LightControlType = LtgCtrlType::Stepped; thisDaylightControl.LightControlProbability = 1.0; - thisDaylightControl.AvailSchedNum = -1; // Always Available + thisDaylightControl.availSched = Sched::GetScheduleAlwaysOn(*state); // Always Available thisDaylightControl.LightControlSteps = 4; dl->DaylIllum.allocate(nRefPts); diff --git a/tst/EnergyPlus/unit/DemandResponse.unit.cc b/tst/EnergyPlus/unit/DemandResponse.unit.cc index 01142a12478..7880aaf3fbd 100644 --- a/tst/EnergyPlus/unit/DemandResponse.unit.cc +++ b/tst/EnergyPlus/unit/DemandResponse.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -67,7 +67,6 @@ namespace EnergyPlus { TEST_F(EnergyPlusFixture, DemandManagerGetInput) { // Test input processing for DemandManager:Ventilation - std::string const idf_objects = delimited_string({"DemandManager:Ventilation,", " Ventilation Manager,", " ,", @@ -81,6 +80,7 @@ TEST_F(EnergyPlusFixture, DemandManagerGetInput) " OA CONTROLLER 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataMixedAir->NumOAControllers = 1; state->dataMixedAir->OAController.allocate(state->dataMixedAir->NumOAControllers); @@ -88,7 +88,7 @@ TEST_F(EnergyPlusFixture, DemandManagerGetInput) GetDemandManagerInput(*state); auto &DemandMgr(state->dataDemandManager->DemandMgr); - EXPECT_EQ(ScheduleManager::ScheduleAlwaysOn, DemandMgr(1).AvailSchedule); + EXPECT_EQ(Sched::SchedNum_AlwaysOn, DemandMgr(1).availSched->Num); EXPECT_ENUM_EQ(ManagerLimit::Fixed, DemandMgr(1).LimitControl); EXPECT_DOUBLE_EQ(60.0, DemandMgr(1).LimitDuration); EXPECT_DOUBLE_EQ(0.2, DemandMgr(1).FixedRate); @@ -98,7 +98,6 @@ TEST_F(EnergyPlusFixture, DemandManagerGetInput) TEST_F(EnergyPlusFixture, DemandManagerAssignmentListGetInputTest) { - std::string const idf_objects = delimited_string({ " DemandManagerAssignmentList,", " Demand Manager, !- Name", @@ -156,10 +155,10 @@ TEST_F(EnergyPlusFixture, DemandManagerAssignmentListGetInputTest) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + ExteriorEnergyUse::GetExteriorEnergyUseInput(*state); GetDemandManagerInput(*state); diff --git a/tst/EnergyPlus/unit/DesiccantDehumidifiers.unit.cc b/tst/EnergyPlus/unit/DesiccantDehumidifiers.unit.cc index ab90e93809e..385b7e2bfba 100644 --- a/tst/EnergyPlus/unit/DesiccantDehumidifiers.unit.cc +++ b/tst/EnergyPlus/unit/DesiccantDehumidifiers.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -2851,6 +2851,7 @@ TEST_F(EnergyPlusFixture, DesiccantDehum_OnOASystemTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // OutputProcessor::TimeValue.allocate(2); state->dataGlobal->DDOnlySimulation = true; @@ -4054,6 +4055,7 @@ TEST_F(EnergyPlusFixture, DesiccantDehum_OnPrimaryAirSystemTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // OutputProcessor::TimeValue.allocate(2); state->dataGlobal->DDOnlySimulation = true; @@ -5478,6 +5480,7 @@ TEST_F(EnergyPlusFixture, DesiccantDehum_RegenAirHeaterHWCoilSizingTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // OutputProcessor::TimeValue.allocate(2); state->dataGlobal->DDOnlySimulation = true; @@ -6732,6 +6735,7 @@ TEST_F(EnergyPlusFixture, DesiccantDehum_VSCoolingCoilOnPrimaryAirSystemTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // OutputProcessor::TimeValue.allocate(2); state->dataGlobal->DDOnlySimulation = true; diff --git a/tst/EnergyPlus/unit/DisplacementVentMgr.unit.cc b/tst/EnergyPlus/unit/DisplacementVentMgr.unit.cc index cf4fdf0a76d..7fa966d53ba 100644 --- a/tst/EnergyPlus/unit/DisplacementVentMgr.unit.cc +++ b/tst/EnergyPlus/unit/DisplacementVentMgr.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/DualDuct.unit.cc b/tst/EnergyPlus/unit/DualDuct.unit.cc index 92ec5afb979..7ba2392ad5c 100644 --- a/tst/EnergyPlus/unit/DualDuct.unit.cc +++ b/tst/EnergyPlus/unit/DualDuct.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -89,6 +89,8 @@ TEST_F(EnergyPlusFixture, TestDualDuctOAMassFlowRateUsingStdRhoAir) int numOfdd_airterminals = 2; + state->init_state(*state); + state->dataHeatBal->Zone.allocate(1); state->dataSize->OARequirements.allocate(1); state->dataAirLoop->AirLoopControlInfo.allocate(1); @@ -288,9 +290,9 @@ TEST_F(EnergyPlusFixture, TestDualDuctOAMassFlowRateUsingStdRhoAir) // // ASSERT_FALSE( process_idf( idf_objects ) ); // -// DataGlobals::NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized -// DataGlobals::MinutesPerTimeStep = 60; // must initialize this to get schedules initialized -// ScheduleManager::ProcessScheduleInput(); // read schedules +// DataGlobals::TimeStepsInHour = 1; // must initialize this to get schedules initialized +// DataGlobals::MinutesInTimeStep = 60; // must initialize this to get schedules initialized +// state->init_state(*state); // // HeatBalanceManager::GetZoneData(*state, ErrorsFound ); // ASSERT_FALSE( ErrorsFound ); @@ -347,6 +349,7 @@ TEST_F(EnergyPlusFixture, DualDuctVAVAirTerminals_GetInputs) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); DualDuct::GetDualDuctInput(*state); @@ -354,7 +357,7 @@ TEST_F(EnergyPlusFixture, DualDuctVAVAirTerminals_GetInputs) // dual duct VAV air terminal get input test EXPECT_ENUM_EQ(state->dataDualDuct->dd_airterminal(1).DamperType, DualDuctDamper::VariableVolume); // dual duct VAV Type EXPECT_EQ(state->dataDualDuct->dd_airterminal(1).Name, "VAV DUAL DUCT AT"); // dual duct VAV Name - EXPECT_TRUE(state->dataDualDuct->dd_airterminal(1).ZoneTurndownMinAirFracSchExist); // turndown schdule exists + EXPECT_TRUE(state->dataDualDuct->dd_airterminal(1).zoneTurndownMinAirFracSched != nullptr); // turndown schdule exists EXPECT_EQ(state->dataDualDuct->dd_airterminal(1).ZoneTurndownMinAirFrac, 1.0); // turndown fraction initialized to 1.0 EXPECT_EQ(state->dataDualDuct->dd_airterminal(1).ZoneMinAirFracDes, 0.3); // design minimum flow fraction } @@ -428,10 +431,10 @@ TEST_F(EnergyPlusFixture, DualDuctVAVAirTerminals_MinFlowTurnDownTest) bool ErrorsFound = false; bool FirstHVACIteration = true; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataGlobal->HourOfDay = 1; @@ -441,10 +444,10 @@ TEST_F(EnergyPlusFixture, DualDuctVAVAirTerminals_MinFlowTurnDownTest) state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); DataZoneEquipment::GetZoneEquipmentData(*state); @@ -456,7 +459,7 @@ TEST_F(EnergyPlusFixture, DualDuctVAVAirTerminals_MinFlowTurnDownTest) // dual duct VAV air terminal get input test EXPECT_ENUM_EQ(thisDDAirTerminal.DamperType, DualDuctDamper::VariableVolume); // dual duct VAV Type EXPECT_EQ(thisDDAirTerminal.Name, "VAV DUAL DUCT AT"); // dual duct VAV Name - EXPECT_TRUE(thisDDAirTerminal.ZoneTurndownMinAirFracSchExist); // turndown schdule exists + EXPECT_TRUE(thisDDAirTerminal.zoneTurndownMinAirFracSched != nullptr); // turndown schdule exists EXPECT_EQ(thisDDAirTerminal.ZoneTurndownMinAirFrac, 1.0); // turndown fraction initialized to 1.0 EXPECT_EQ(thisDDAirTerminal.ZoneMinAirFracDes, 0.3); // design minimum flow fraction @@ -476,7 +479,7 @@ TEST_F(EnergyPlusFixture, DualDuctVAVAirTerminals_MinFlowTurnDownTest) Psychrometrics::PsyHFnTdbW(state->dataLoopNodes->Node(HotInNode).Temp, state->dataLoopNodes->Node(HotInNode).HumRat); // test with heating load and turndown fraction schedule value set 1.0 - state->dataDualDuct->dd_airterminal(DDNum).ZoneTurndownMinAirFracSchPtr = 1; // + state->dataDualDuct->dd_airterminal(DDNum).zoneTurndownMinAirFracSched = Sched::GetSchedule(*state, "TURNDOWNMINAIRFLOWSCH1"); // state->dataLoopNodes->Node(OutNode).MassFlowRate = SysMaxMassFlowRes; state->dataLoopNodes->Node(HotInNode).MassFlowRate = SysMaxMassFlowRes; state->dataLoopNodes->Node(HotInNode).MassFlowRateMaxAvail = SysMaxMassFlowRes; @@ -501,7 +504,7 @@ TEST_F(EnergyPlusFixture, DualDuctVAVAirTerminals_MinFlowTurnDownTest) EXPECT_EQ(0.0, state->dataLoopNodes->Node(ColdInNode).MassFlowRate); // test with heating load and turndown fraction schedule value set 0.5 - state->dataDualDuct->dd_airterminal(DDNum).ZoneTurndownMinAirFracSchPtr = 2; + state->dataDualDuct->dd_airterminal(DDNum).zoneTurndownMinAirFracSched = Sched::GetSchedule(*state, "TURNDOWNMINAIRFLOWSCH2"); SysMinMassFlowRes = 1.0 * state->dataEnvrn->StdRhoAir * 0.30 * 0.5; // min flow rate at 0.5 turndown fraction state->dataLoopNodes->Node(OutNode).MassFlowRate = SysMaxMassFlowRes; state->dataLoopNodes->Node(HotInNode).MassFlowRate = SysMaxMassFlowRes; @@ -530,15 +533,14 @@ TEST_F(EnergyPlusFixture, DualDuctVAVAirTerminals_MinFlowTurnDownTest) TEST_F(EnergyPlusFixture, DualDuctAirTerminal_reportTerminalUnit) { using namespace EnergyPlus::OutputReportPredefined; + state->init_state(*state); + auto &orp = *state->dataOutRptPredefined; SetPredefinedTables(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; - auto &sch = state->dataScheduleMgr->Schedule; - sch.allocate(5); - sch(1).Name = "schA"; - sch(2).Name = "schB"; + auto *schedA = Sched::AddScheduleConstant(*state, "schA"); + auto *schedB = Sched::AddScheduleConstant(*state, "schB"); auto &adu = state->dataDefineEquipment->AirDistUnit; adu.allocate(2); @@ -559,7 +561,7 @@ TEST_F(EnergyPlusFixture, DualDuctAirTerminal_reportTerminalUnit) ddat(1).ADUNum = 1; ddat(1).DamperType = DualDuctDamper::ConstantVolume; ddat(1).MaxAirVolFlowRate = 0.30; - ddat(1).ZoneTurndownMinAirFracSchPtr = 1; + ddat(1).zoneTurndownMinAirFracSched = schedA; ddat(1).OARequirementsPtr = 0; ddat(1).reportTerminalUnit(*state); @@ -594,12 +596,12 @@ TEST_F(EnergyPlusFixture, DualDuctAirTerminal_reportTerminalUnit) ddat(2).ADUNum = 2; ddat(2).DamperType = DualDuctDamper::VariableVolume; ddat(2).MaxAirVolFlowRate = 0.31; - ddat(2).ZoneTurndownMinAirFracSchPtr = 0; + ddat(2).zoneTurndownMinAirFracSched = nullptr; ddat(2).OARequirementsPtr = 1; auto &oa = state->dataSize->OARequirements; oa.allocate(1); - oa(1).OAFlowFracSchPtr = 2; + oa(1).oaFlowFracSched = schedB; ddat(2).reportTerminalUnit(*state); diff --git a/tst/EnergyPlus/unit/EMSManager.unit.cc b/tst/EnergyPlus/unit/EMSManager.unit.cc index 0fd6ebb8929..24c4ea3d222 100644 --- a/tst/EnergyPlus/unit/EMSManager.unit.cc +++ b/tst/EnergyPlus/unit/EMSManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -91,6 +91,7 @@ using namespace EnergyPlus::PlantUtilities; TEST_F(EnergyPlusFixture, EMSManager_TestForUniqueEMSActuators) { + state->init_state(*state); state->dataRuntimeLang->EMSActuatorAvailable.allocate(100); std::string componentTypeName1("Chiller1"); @@ -134,7 +135,6 @@ TEST_F(EnergyPlusFixture, EMSManager_TestForUniqueEMSActuators) TEST_F(EnergyPlusFixture, Dual_NodeTempSetpoints) { - std::string const idf_objects = delimited_string({ "OutdoorAir:Node, Test node;", @@ -164,6 +164,7 @@ TEST_F(EnergyPlusFixture, Dual_NodeTempSetpoints) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); OutAirNodeManager::SetOutAirNodes(*state); @@ -206,6 +207,7 @@ TEST_F(EnergyPlusFixture, CheckActuatorInit) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); OutAirNodeManager::SetOutAirNodes(*state); EMSManager::GetEMSInput(*state); @@ -215,7 +217,6 @@ TEST_F(EnergyPlusFixture, CheckActuatorInit) TEST_F(EnergyPlusFixture, SupervisoryControl_PlantComponent_SetActuatedBranchFlowRate) { - // test EMS actuator for Plant Component // test SetActuatedBranchFlowRate for expected response @@ -238,6 +239,7 @@ TEST_F(EnergyPlusFixture, SupervisoryControl_PlantComponent_SetActuatedBranchFlo }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // sets number of EMS objects EMSManager::CheckIfAnyEMS(*state); @@ -402,6 +404,7 @@ TEST_F(EnergyPlusFixture, SupervisoryControl_PlantComponent_SetComponentFlowRate }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // sets number of EMS objects EMSManager::CheckIfAnyEMS(*state); @@ -708,6 +711,7 @@ TEST_F(EnergyPlusFixture, Test_EMSLogic) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); OutAirNodeManager::SetOutAirNodes(*state); @@ -776,6 +780,7 @@ TEST_F(EnergyPlusFixture, Debug_EMSLogic) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); OutAirNodeManager::SetOutAirNodes(*state); @@ -814,6 +819,7 @@ TEST_F(EnergyPlusFixture, TestAnyRanArgument) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); OutAirNodeManager::SetOutAirNodes(*state); NodeInputManager::SetupNodeVarsForReporting(*state); @@ -853,6 +859,7 @@ TEST_F(EnergyPlusFixture, TestUnInitializedEMSVariable1) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); EMSManager::CheckIfAnyEMS(*state); state->dataEMSMgr->FinishProcessingUserInput = true; @@ -909,6 +916,7 @@ TEST_F(EnergyPlusFixture, TestUnInitializedEMSVariable2) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); OutAirNodeManager::SetOutAirNodes(*state); @@ -940,7 +948,6 @@ TEST_F(EnergyPlusFixture, TestUnInitializedEMSVariable2) TEST_F(EnergyPlusFixture, EMSManager_CheckIfAnyEMS_OutEMS) { - std::string const idf_objects = delimited_string({ " Output:EnergyManagementSystem, ", " Verbose, !- Actuator Availability Dictionary Reporting ", @@ -949,6 +956,7 @@ TEST_F(EnergyPlusFixture, EMSManager_CheckIfAnyEMS_OutEMS) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); CheckIfAnyEMS(*state); EXPECT_TRUE(state->dataGlobal->AnyEnergyManagementSystemInModel); @@ -1091,6 +1099,7 @@ TEST_F(EnergyPlusFixture, EMSManager_TestFuntionCall) ASSERT_TRUE(process_idf(idf_objects)); state->dataGlobal->TimeStepZone = 0.25; + state->init_state(*state); EMSManager::CheckIfAnyEMS(*state); // get EMS input state->dataEMSMgr->FinishProcessingUserInput = true; @@ -1557,6 +1566,8 @@ TEST_F(EnergyPlusFixture, EMSManager_TestFuntionCall) TEST_F(EnergyPlusFixture, EMSManager_TestOANodeAsActuators) { + state->init_state(*state); + // EMSActuatorAvailable.allocate(100); state->dataLoopNodes->NumOfNodes = 3; state->dataRuntimeLang->numActuatorsUsed = 3; @@ -1596,6 +1607,8 @@ TEST_F(EnergyPlusFixture, EMSManager_TestOANodeAsActuators) } TEST_F(EnergyPlusFixture, EMSManager_TestWindowShadingControlExteriorScreenOption) { + state->init_state(*state); + // #7586 state->dataSurface->Surface.allocate(2); state->dataSurface->SurfaceWindow.allocate(2); @@ -1653,7 +1666,6 @@ TEST_F(EnergyPlusFixture, EMSManager_TestWindowShadingControlExteriorScreenOptio } TEST_F(EnergyPlusFixture, EMS_WeatherDataActuators) { - // GetNextEnvironment Will call ReadUserWeatherInput which calls inputProcessor, so let's use process_idf to create one Environment (Design Day) std::string const idf_objects = delimited_string({ @@ -1753,9 +1765,11 @@ TEST_F(EnergyPlusFixture, EMS_WeatherDataActuators) ASSERT_TRUE(process_idf(idf_objects)); state->dataGlobal->BeginSimFlag = true; - state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->TimeStepsInHour = 4; state->dataWeather->LocationGathered = false; + state->init_state(*state); + EMSManager::CheckIfAnyEMS(*state); bool available = false; bool errorsFound = false; @@ -1797,7 +1811,6 @@ TEST_F(EnergyPlusFixture, EMS_WeatherDataActuators) } TEST_F(EnergyPlusFixture, EMS_TodayTomorrowFunctions) { - // GetNextEnvironment Will call ReadUserWeatherInput which calls inputProcessor, so let's use process_idf to create one Environment (Design Day) std::string const idf_objects = delimited_string({ @@ -1881,8 +1894,9 @@ TEST_F(EnergyPlusFixture, EMS_TodayTomorrowFunctions) ASSERT_TRUE(process_idf(idf_objects)); state->dataGlobal->BeginSimFlag = true; - state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->TimeStepsInHour = 4; state->dataWeather->LocationGathered = false; + state->init_state(*state); EMSManager::CheckIfAnyEMS(*state); bool available = false; @@ -2209,6 +2223,7 @@ TEST_F(EnergyPlusFixture, EMS_ViewFactorToGround) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataEnvrn->Year = 2000; state->dataEnvrn->EndYear = 2000; @@ -2254,7 +2269,6 @@ TEST_F(EnergyPlusFixture, EMS_ViewFactorToGround) TEST_F(EnergyPlusFixture, EMSManager_TrendValue_to_Actuator) { - // Test for #10279 - Make sure that assigning the result of a TendVariable @TrendValue results in proper actuator behavior std::string const idf_objects = delimited_string({ "Schedule:Constant,", @@ -2303,25 +2317,27 @@ TEST_F(EnergyPlusFixture, EMSManager_TrendValue_to_Actuator) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->TimeStepZone = 0.25; - + // Apparently this needs to be called before GetScheduleData, i.e., init_state() EMSManager::CheckIfAnyEMS(*state); // get EMS input EXPECT_TRUE(state->dataGlobal->AnyEnergyManagementSystemInModel); - state->dataEMSMgr->FinishProcessingUserInput = true; + state->dataGlobal->TimeStepZone = 0.25; - state->dataGlobal->NumOfTimeStepInHour = 4; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized + state->dataGlobal->TimeStepsInHour = 4; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 15; // must initialize this to get schedules initialized state->dataGlobal->TimeStepZone = 0.25; state->dataHVACGlobal->TimeStepSys = 0.25; - state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * Constant::SecInHour; - ScheduleManager::ProcessScheduleInput(*state); // read schedules + state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * Constant::rSecsInHour; + state->init_state(*state); - EXPECT_EQ(2, state->dataScheduleMgr->NumSchedules); - auto &schDirect = state->dataScheduleMgr->Schedule(1); - EXPECT_EQ("ACTUATED SCHEDULE DIRECT", schDirect.Name); - auto &schIndirect = state->dataScheduleMgr->Schedule(2); - EXPECT_EQ("ACTUATED SCHEDULE INDIRECT", schIndirect.Name); + state->dataEMSMgr->FinishProcessingUserInput = true; + + EXPECT_EQ(4, state->dataSched->schedules.size()); + + auto *schedDirect = Sched::GetSchedule(*state, "ACTUATED SCHEDULE DIRECT"); + auto *schedIndirect = Sched::GetSchedule(*state, "ACTUATED SCHEDULE INDIRECT"); + EXPECT_NE(schedDirect, nullptr); + EXPECT_NE(schedIndirect, nullptr); state->dataEnvrn->Month = 12; state->dataEnvrn->DayOfMonth = 31; @@ -2335,13 +2351,14 @@ TEST_F(EnergyPlusFixture, EMSManager_TrendValue_to_Actuator) state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); state->dataEnvrn->DSTIndicator = 0; // DST IS OFF - ScheduleManager::UpdateScheduleValues(*state); - EXPECT_EQ(18.0, schDirect.CurrentValue); - EXPECT_FALSE(schDirect.EMSActuatedOn); - EXPECT_EQ(0.0, schDirect.EMSValue); - EXPECT_EQ(18.0, schIndirect.CurrentValue); - EXPECT_FALSE(schIndirect.EMSActuatedOn); - EXPECT_EQ(0.0, schIndirect.EMSValue); + Sched::UpdateScheduleVals(*state); + + EXPECT_EQ(18.0, schedDirect->currentVal); + EXPECT_FALSE(schedDirect->EMSActuatedOn); + EXPECT_EQ(0.0, schedDirect->EMSVal); + EXPECT_EQ(18.0, schedIndirect->currentVal); + EXPECT_FALSE(schedIndirect->EMSActuatedOn); + EXPECT_EQ(0.0, schedIndirect->EMSVal); EMSManager::InitEMS(*state, EMSManager::EMSCallFrom::BeginTimestepBeforePredictor); @@ -2502,13 +2519,13 @@ TEST_F(EnergyPlusFixture, EMSManager_TrendValue_to_Actuator) EXPECT_TRUE(resultValueErlVar.Value.Error.empty()); EXPECT_TRUE(resultValueErlVar.Value.initialized); - ScheduleManager::UpdateScheduleValues(*state); - EXPECT_EQ(45.0, schDirect.CurrentValue); - EXPECT_TRUE(schDirect.EMSActuatedOn); - EXPECT_EQ(45.0, schDirect.EMSValue); - EXPECT_EQ(45.0, schIndirect.CurrentValue); - EXPECT_TRUE(schIndirect.EMSActuatedOn); - EXPECT_EQ(45.0, schIndirect.EMSValue); + Sched::UpdateScheduleVals(*state); + EXPECT_EQ(45.0, schedDirect->currentVal); + EXPECT_TRUE(schedDirect->EMSActuatedOn); + EXPECT_EQ(45.0, schedDirect->EMSVal); + EXPECT_EQ(45.0, schedIndirect->currentVal); + EXPECT_TRUE(schedIndirect->EMSActuatedOn); + EXPECT_EQ(45.0, schedIndirect->EMSVal); EMSManager::UpdateEMSTrendVariables(*state); for (int i = 0; i < 12; ++i) { @@ -2579,11 +2596,11 @@ TEST_F(EnergyPlusFixture, EMSManager_TrendValue_to_Actuator) EXPECT_TRUE(resultValueErlVar.Value.Error.empty()); EXPECT_TRUE(resultValueErlVar.Value.initialized); - ScheduleManager::UpdateScheduleValues(*state); - EXPECT_EQ(45.0, schDirect.CurrentValue); - EXPECT_TRUE(schDirect.EMSActuatedOn); - EXPECT_EQ(45.0, schDirect.EMSValue); - EXPECT_EQ(45.0, schIndirect.CurrentValue); - EXPECT_TRUE(schIndirect.EMSActuatedOn); - EXPECT_EQ(45.0, schIndirect.EMSValue); + Sched::UpdateScheduleVals(*state); + EXPECT_EQ(45.0, schedDirect->currentVal); + EXPECT_TRUE(schedDirect->EMSActuatedOn); + EXPECT_EQ(45.0, schedDirect->EMSVal); + EXPECT_EQ(45.0, schedIndirect->currentVal); + EXPECT_TRUE(schedIndirect->EMSActuatedOn); + EXPECT_EQ(45.0, schedIndirect->EMSVal); } diff --git a/tst/EnergyPlus/unit/EPVector.unit.cc b/tst/EnergyPlus/unit/EPVector.unit.cc index 7518d9c3548..c3b80b66b27 100644 --- a/tst/EnergyPlus/unit/EPVector.unit.cc +++ b/tst/EnergyPlus/unit/EPVector.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/EarthTube.unit.cc b/tst/EnergyPlus/unit/EarthTube.unit.cc index 61909cc68d2..f243badcf6d 100644 --- a/tst/EnergyPlus/unit/EarthTube.unit.cc +++ b/tst/EnergyPlus/unit/EarthTube.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/EcoRoofManager.unit.cc b/tst/EnergyPlus/unit/EcoRoofManager.unit.cc index 83e7935abf0..239b1448b19 100644 --- a/tst/EnergyPlus/unit/EcoRoofManager.unit.cc +++ b/tst/EnergyPlus/unit/EcoRoofManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -76,6 +76,7 @@ namespace EnergyPlus { TEST_F(EnergyPlusFixture, EcoRoof_CalculateEcoRoofSolarTest) { + state->init_state(*state); Real64 resultRS; Real64 resultf1; Real64 expectedRS; @@ -186,6 +187,7 @@ TEST_F(EnergyPlusFixture, EcoRoofManager_UpdateSoilProps) "Until: 24:00,0.003; !- Field 5", }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; // Read objects @@ -229,6 +231,7 @@ TEST_F(EnergyPlusFixture, EcoRoofManager_UpdateSoilProps) TEST_F(EnergyPlusFixture, EcoRoofManager_initEcoRoofFirstTimeTest) { + state->init_state(*state); int surfNum = 1; int constrNum = 1; Real64 expectedAnswer; @@ -265,6 +268,7 @@ TEST_F(EnergyPlusFixture, EcoRoofManager_initEcoRoofFirstTimeTest) TEST_F(EnergyPlusFixture, EcoRoofManager_initEcoRoofTest) { + state->init_state(*state); int surfNum = 1; int constrNum = 1; Real64 expectedAnswer; diff --git a/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc b/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc index 77b15cd0cdc..00edd071c6d 100644 --- a/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc +++ b/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/EconomicTariff.unit.cc b/tst/EnergyPlus/unit/EconomicTariff.unit.cc index 3f070d90e93..8ee7dd98fde 100644 --- a/tst/EnergyPlus/unit/EconomicTariff.unit.cc +++ b/tst/EnergyPlus/unit/EconomicTariff.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -189,7 +189,7 @@ TEST_F(EnergyPlusFixture, EconomicTariff_GetInput_Test) }); ASSERT_TRUE(process_idf(idf_objects)); - + state->init_state(*state); UpdateUtilityBills(*state); // tariff @@ -255,6 +255,7 @@ TEST_F(EnergyPlusFixture, EconomicTariff_Water_DefaultConv_Test) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // Create a water meter, can't use AddMeter because we would need to create a variable for that OutputProcessor::Meter *meter = new OutputProcessor::Meter("WATER:FACILITY"); @@ -298,6 +299,7 @@ TEST_F(EnergyPlusFixture, EconomicTariff_Water_CCF_Test) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // Create a water meter OutputProcessor::Meter *meter = new Meter("WATER:FACILITY"); @@ -338,6 +340,7 @@ TEST_F(EnergyPlusFixture, EconomicTariff_Gas_CCF_Test) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // Create a water meter OutputProcessor::Meter *meter = new Meter("NATURALGAS:FACILITY"); @@ -380,6 +383,7 @@ TEST_F(EnergyPlusFixture, EconomicTariff_Electric_CCF_Test) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // Create a water meter OutputProcessor::Meter *meter = new Meter("ELECTRICITY:FACILITY"); @@ -407,6 +411,7 @@ TEST_F(EnergyPlusFixture, EconomicTariff_Electric_CCF_Test) TEST_F(EnergyPlusFixture, EconomicTariff_LEEDtariffReporting_Test) { + state->init_state(*state); state->dataOutputProcessor->meters.push_back(new Meter("ELECTRICITY:FACILITY")); state->dataOutputProcessor->meterMap.insert_or_assign("ELECTRICITY:FACILITY", state->dataOutputProcessor->meters.size() - 1); state->dataOutputProcessor->meters.push_back(new Meter("NATURALGAS:FACILITY")); @@ -587,12 +592,12 @@ TEST_F(EnergyPlusFixture, EconomicTariff_GatherForEconomics) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 4; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized + state->dataGlobal->TimeStepsInHour = 4; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 15; // must initialize this to get schedules initialized state->dataGlobal->TimeStepZone = 0.25; - state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * Constant::SecInHour; + state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * Constant::rSecsInHour; - ScheduleManager::ProcessScheduleInput(*state); // read schedules + state->init_state(*state); ExteriorEnergyUse::ManageExteriorEnergyUse(*state); EXPECT_EQ(1, state->dataExteriorEnergyUse->NumExteriorLights); EXPECT_EQ(1000, state->dataExteriorEnergyUse->ExteriorLights(1).DesignLevel); @@ -606,11 +611,7 @@ TEST_F(EnergyPlusFixture, EconomicTariff_GatherForEconomics) EXPECT_EQ("SEASONAL_TARIFF", state->dataEconTariff->tariff(1).tariffName); EXPECT_ENUM_EQ(EconConv::KWH, state->dataEconTariff->tariff(1).convChoice); EXPECT_EQ(0, state->dataEconTariff->tariff(1).monthChgVal); - EXPECT_EQ("ELECTRICITY SEASON SCHEDULE", state->dataEconTariff->tariff(1).seasonSchedule); - - int seasonSchPtr = state->dataEconTariff->tariff(1).seasonSchIndex; - EXPECT_GT(seasonSchPtr, 0); - EXPECT_EQ("ELECTRICITY SEASON SCHEDULE", state->dataScheduleMgr->Schedule(seasonSchPtr).Name); + EXPECT_EQ("ELECTRICITY SEASON SCHEDULE", state->dataEconTariff->tariff(1).seasonSched->Name); // Two Simple Charges EXPECT_EQ(2, state->dataEconTariff->numChargeSimple); @@ -638,10 +639,9 @@ TEST_F(EnergyPlusFixture, EconomicTariff_GatherForEconomics) state->dataGlobal->TimeStep = 4; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(*state); - EXPECT_EQ(1.0, ScheduleManager::LookUpScheduleValue(*state, 1, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep)); - EXPECT_EQ(1.0, ScheduleManager::GetCurrentScheduleValue(*state, state->dataEconTariff->tariff(1).seasonSchIndex)); - EXPECT_EQ(1.0, state->dataScheduleMgr->Schedule(seasonSchPtr).CurrentValue); + Sched::UpdateScheduleVals(*state); + EXPECT_EQ(1.0, Sched::GetSchedule(*state, "ALWAYS ON DISCRETE")->getHrTsVal(*state, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep)); + EXPECT_EQ(1.0, state->dataEconTariff->tariff(1).seasonSched->getCurrentVal()); ExteriorEnergyUse::ManageExteriorEnergyUse(*state); @@ -670,8 +670,8 @@ TEST_F(EnergyPlusFixture, EconomicTariff_GatherForEconomics) state->dataGlobal->TimeStep = 1; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(*state); - EXPECT_EQ(3.0, ScheduleManager::GetCurrentScheduleValue(*state, state->dataEconTariff->tariff(1).seasonSchIndex)); + Sched::UpdateScheduleVals(*state); + EXPECT_EQ(3.0, state->dataEconTariff->tariff(1).seasonSched->getCurrentVal()); ExteriorEnergyUse::ManageExteriorEnergyUse(*state); @@ -688,6 +688,7 @@ TEST_F(EnergyPlusFixture, EconomicTariff_GatherForEconomics) TEST_F(EnergyPlusFixture, EconomicTariff_GatherForEconomics_ZeroMeterIndex) { + state->init_state(*state); // Test for PR #10521 and Issue #10519 state->dataEconTariff->numTariff = 1; state->dataEconTariff->tariff.allocate(state->dataEconTariff->numTariff); @@ -709,6 +710,7 @@ TEST_F(EnergyPlusFixture, EconomicTariff_GatherForEconomics_ZeroMeterIndex) TEST_F(EnergyPlusFixture, EconomicTariff_PushPopStack) { + state->init_state(*state); state->dataEconTariff->numTariff = 1; state->dataEconTariff->tariff.allocate(state->dataEconTariff->numTariff); @@ -810,6 +812,7 @@ TEST_F(EnergyPlusFixture, EconomicTariff_PushPopStack) TEST_F(EnergyPlusFixture, EconomicTariff_evaluateChargeSimple) { + state->init_state(*state); int curTariff = 6; state->dataEconTariff->tariff.allocate(curTariff); @@ -899,6 +902,7 @@ TEST_F(EnergyPlusFixture, EconomicTariff_evaluateChargeSimple) TEST_F(EnergyPlusFixture, EconomicTariff_evaluateChargeBlock) { + state->init_state(*state); int curTariff = 8; state->dataEconTariff->tariff.allocate(curTariff); @@ -1022,6 +1026,7 @@ TEST_F(EnergyPlusFixture, InputEconomics_UtilityCost_Variable_Test0) bool ErrorsFound = false; ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetInputEconomicsVariable(*state, ErrorsFound); @@ -1103,6 +1108,7 @@ TEST_F(EnergyPlusFixture, InputEconomics_UtilityCost_Variable_Test1) bool ErrorsFound = false; ASSERT_TRUE(process_idf(idf_objects1)); + state->init_state(*state); GetInputEconomicsVariable(*state, ErrorsFound); // Make sure variable input type "Energy" is processed as expected @@ -1181,6 +1187,7 @@ TEST_F(EnergyPlusFixture, InputEconomics_UtilityCost_Variable_Test2) bool ErrorsFound = false; ASSERT_TRUE(process_idf(idf_objects2)); + state->init_state(*state); GetInputEconomicsVariable(*state, ErrorsFound); // Make sure variable input type "Dimensionless" is processed as expected @@ -1259,6 +1266,7 @@ TEST_F(EnergyPlusFixture, InputEconomics_UtilityCost_Variable_Test3) bool ErrorsFound = false; ASSERT_TRUE(process_idf(idf_objects3)); + state->init_state(*state); GetInputEconomicsVariable(*state, ErrorsFound); // Make sure variable input type "Currency" is processed as expected @@ -1405,12 +1413,12 @@ TEST_F(SQLiteFixture, WriteEconomicTariffTable_DualUnits) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 4; - state->dataGlobal->MinutesPerTimeStep = 15; + state->dataGlobal->TimeStepsInHour = 4; + state->dataGlobal->MinutesInTimeStep = 15; state->dataGlobal->TimeStepZone = 0.25; - state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * Constant::SecInHour; + state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * Constant::rSecsInHour; - ScheduleManager::ProcessScheduleInput(*state); + state->init_state(*state); ExteriorEnergyUse::ManageExteriorEnergyUse(*state); state->dataSQLiteProcedures->sqlite->createSQLiteSimulationsRecord(1, "EnergyPlus Version", "Current Time"); @@ -1442,7 +1450,7 @@ TEST_F(SQLiteFixture, WriteEconomicTariffTable_DualUnits) state->dataGlobal->TimeStep = 4; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); ExteriorEnergyUse::ManageExteriorEnergyUse(*state); state->dataGlobal->DoOutputReporting = true; @@ -1666,6 +1674,7 @@ TEST_F(EnergyPlusFixture, EconomicTariff_LEEDtariff_with_Custom_Meter) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool errors_found = false; diff --git a/tst/EnergyPlus/unit/ElectricBaseboardRadiator.unit.cc b/tst/EnergyPlus/unit/ElectricBaseboardRadiator.unit.cc index 2427377a5a5..5fd34f96556 100644 --- a/tst/EnergyPlus/unit/ElectricBaseboardRadiator.unit.cc +++ b/tst/EnergyPlus/unit/ElectricBaseboardRadiator.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -130,7 +130,7 @@ TEST_F(EnergyPlusFixture, RadConvElecBaseboard_Test1) " ZoneHVAC:Baseboard:RadiantConvective:Electric,", " SPACE2-1 Baseboard, !- Name", - " always_on, !- Availability Schedule Name", + " CONSTANT-1.0, !- Availability Schedule Name", " HeatingDesignCapacity, !- Heating Design Capacity Method", " 1000.0, !- Heating Design Capacity {W}", " , !- Heating Design Capacity Per Floor Area {W/m2}", @@ -160,7 +160,7 @@ TEST_F(EnergyPlusFixture, RadConvElecBaseboard_Test1) " ZoneHVAC:Baseboard:RadiantConvective:Electric,", " SPACE4-1 Baseboard, !- Name", - " always_on, !- Availability Schedule Name", + " CONSTANT-1.0, !- Availability Schedule Name", " HeatingDesignCapacity, !- Heating Design Capacity Method", " 1000.0, !- Heating Design Capacity {W}", " , !- Heating Design Capacity Per Floor Area {W/m2}", @@ -188,19 +188,6 @@ TEST_F(EnergyPlusFixture, RadConvElecBaseboard_Test1) " 0.0,0.0,0.0, !- X,Y,Z ==> Vertex 3 {m}", " 0.0,0.0,2.4; !- X,Y,Z ==> Vertex 4 {m}", - " ScheduleTypeLimits,", - " Fraction, !- Name", - " 0.0, !- Lower Limit Value", - " 1.0, !- Upper Limit Value", - " CONTINUOUS; !- Numeric Type", - - " Schedule:Compact,", - " always_on, !- Name", - " Fraction, !- Schedule Type Limits Name", - " Through: 12/31, !- Field 1", - " For: AllDays, !- Field 2", - " Until: 24:00,1.0; !- Field 3" - "SurfaceConvectionAlgorithm:Inside,TARP;", "SurfaceConvectionAlgorithm:Outside,DOE-2;", @@ -265,9 +252,9 @@ TEST_F(EnergyPlusFixture, RadConvElecBaseboard_Test1) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); bool errorsFound(false); HeatBalanceManager::GetProjectControlData(*state, errorsFound); // read project control data @@ -286,10 +273,10 @@ TEST_F(EnergyPlusFixture, RadConvElecBaseboard_Test1) state->dataSurfaceGeometry->CosZoneRelNorth.allocate(2); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(2); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; @@ -402,7 +389,7 @@ TEST_F(EnergyPlusFixture, ElectricBaseboardRadConv_SizingTest) " ZoneHVAC:Baseboard:RadiantConvective:Electric,", " SPACE2-1 Baseboard, !- Name", - " always_on, !- Availability Schedule Name", + " CONSTANT-1.0, !- Availability Schedule Name", " HeatingDesignCapacity, !- Heating Design Capacity Method", " 1000.0, !- Heating Design Capacity {W}", " , !- Heating Design Capacity Per Floor Area {W/m2}", @@ -432,7 +419,7 @@ TEST_F(EnergyPlusFixture, ElectricBaseboardRadConv_SizingTest) " ZoneHVAC:Baseboard:RadiantConvective:Electric,", " SPACE3-1 Baseboard, !- Name", - " always_on, !- Availability Schedule Name", + " CONSTANT-1.0, !- Availability Schedule Name", " CapacityPerFloorArea, !- Heating Design Capacity Method", " , !- Heating Design Capacity {W}", " 30.0, !- Heating Design Capacity Per Floor Area {W/m2}", @@ -462,7 +449,7 @@ TEST_F(EnergyPlusFixture, ElectricBaseboardRadConv_SizingTest) " ZoneHVAC:Baseboard:RadiantConvective:Electric,", " SPACE4-1 Baseboard, !- Name", - " always_on, !- Availability Schedule Name", + " CONSTANT-1.0, !- Availability Schedule Name", " FractionOfAutosizedHeatingCapacity, !- Heating Design Capacity Method", " , !- Heating Design Capacity {W}", " , !- Heating Design Capacity Per Floor Area {W/m2}", @@ -490,19 +477,6 @@ TEST_F(EnergyPlusFixture, ElectricBaseboardRadConv_SizingTest) " 0.0,0.0,0.0, !- X,Y,Z ==> Vertex 3 {m}", " 0.0,0.0,2.4; !- X,Y,Z ==> Vertex 4 {m}", - " ScheduleTypeLimits,", - " Fraction, !- Name", - " 0.0, !- Lower Limit Value", - " 1.0, !- Upper Limit Value", - " CONTINUOUS; !- Numeric Type", - - " Schedule:Compact,", - " always_on, !- Name", - " Fraction, !- Schedule Type Limits Name", - " Through: 12/31, !- Field 1", - " For: AllDays, !- Field 2", - " Until: 24:00,1.0; !- Field 3" - "SurfaceConvectionAlgorithm:Inside,TARP;", "SurfaceConvectionAlgorithm:Outside,DOE-2;", @@ -567,9 +541,9 @@ TEST_F(EnergyPlusFixture, ElectricBaseboardRadConv_SizingTest) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); bool errorsFound(false); HeatBalanceManager::GetProjectControlData(*state, errorsFound); // read project control data @@ -588,12 +562,12 @@ TEST_F(EnergyPlusFixture, ElectricBaseboardRadConv_SizingTest) state->dataSurfaceGeometry->CosZoneRelNorth.allocate(3); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(3); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->CosZoneRelNorth(3) = std::cos(-state->dataHeatBal->Zone(3).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(3) = std::sin(-state->dataHeatBal->Zone(3).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->CosZoneRelNorth(3) = std::cos(-state->dataHeatBal->Zone(3).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(3) = std::sin(-state->dataHeatBal->Zone(3).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; diff --git a/tst/EnergyPlus/unit/ElectricPowerServiceManager.unit.cc b/tst/EnergyPlus/unit/ElectricPowerServiceManager.unit.cc index ec4c23113c4..7bffaac6e75 100644 --- a/tst/EnergyPlus/unit/ElectricPowerServiceManager.unit.cc +++ b/tst/EnergyPlus/unit/ElectricPowerServiceManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -69,7 +69,6 @@ using namespace EnergyPlus; TEST_F(EnergyPlusFixture, ManageElectricPowerTest_BatteryDischargeTest) { - std::string const idf_objects = delimited_string({ "ElectricLoadCenter:Distribution,", " PV Array Load Center, !- Name", @@ -98,7 +97,7 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_BatteryDischargeTest) " ElectricLoadCenter:Storage:Battery,", " Kibam, !- Name", - " ALWAYS_ON, !- Availability Schedule Name", + " CONSTANT-1.0, !- Availability Schedule Name", " , !- Zone Name", " 0, !- Radiative Fraction", " 10, !- Number of Battery Modules in Parallel", @@ -145,7 +144,7 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_BatteryDischargeTest) " ElectricLoadCenter:Inverter:LookUpTable,", " PV Inverter, !- Name", - " ALWAYS_ON, !- Availability Schedule Name", + " CONSTANT-1.0, !- Availability Schedule Name", " , !- Zone Name", " 0.25, !- Radiative Fraction", " 14000, !- Rated Maximum Continuous Output Power {W}", @@ -163,7 +162,7 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_BatteryDischargeTest) " PV:ZN_1_FLR_1_SEC_1_Ceiling, !- Generator 1 Name", " Generator:Photovoltaic, !- Generator 1 Object Type", " 9000.0, !- Generator 1 Rated Electric Power Output {W}", - " ALWAYS_ON, !- Generator 1 Availability Schedule Name", + " CONSTANT-1.0, !- Generator 1 Availability Schedule Name", " ; !- Generator 1 Rated Thermal to Electrical Power Ratio", " Generator:Photovoltaic,", @@ -181,16 +180,10 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_BatteryDischargeTest) " Fixed, !- Conversion Efficiency Input Mode", " 0.20, !- Value for Cell Efficiency if Fixed", " ; !- Efficiency Schedule Name", - - " Schedule:Compact,", - " ALWAYS_ON, !- Name", - " On/Off, !- Schedule Type Limits Name", - " Through: 12/31, !- Field 1", - " For: AllDays, !- Field 2", - " Until: 24:00,1; !- Field 3", }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); createFacilityElectricPowerServiceObject(*state); state->dataElectPwrSvcMgr->facilityElectricServiceObj->elecLoadCenterObjs.emplace_back(new ElectPowerLoadCenter(*state, 1)); @@ -223,7 +216,6 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_BatteryDischargeTest) TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case1) { - std::string const idf_objects = delimited_string({ " ElectricLoadCenter:Distribution,", @@ -242,23 +234,17 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case1) " Test Gen 1, !- Generator 1 Name", " Generator:InternalCombustionEngine, !- Generator 1 Object Type", " 1000.0, !- Generator 1 Rated Electric Power Output {W}", - " ALWAYS_ON, !- Generator 1 Availability Schedule Name", + " CONSTANT-1.0, !- Generator 1 Availability Schedule Name", " , !- Generator 1 Rated Thermal to Electrical Power Ratio", " Test Gen 2, !- Generator 2 Name", " Generator:WindTurbine, !- Generator 2 Object Type", " 2000.0, !- Generator 2 Rated Electric Power Output {W}", - " ALWAYS_ON, !- Generator 2 Availability Schedule Name", + " CONSTANT-1.0, !- Generator 2 Availability Schedule Name", " ; !- Generator 2 Rated Thermal to Electrical Power Ratio", - - " Schedule:Compact,", - " ALWAYS_ON, !- Name", - " On/Off, !- Schedule Type Limits Name", - " Through: 12/31, !- Field 1", - " For: AllDays, !- Field 2", - " Until: 24:00,1; !- Field 3", }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); createFacilityElectricPowerServiceObject(*state); state->dataElectPwrSvcMgr->facilityElectricServiceObj->elecLoadCenterObjs.emplace_back(new ElectPowerLoadCenter(*state, 1)); @@ -286,7 +272,6 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case1) TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case2) { - std::string const idf_objects = delimited_string({ " ElectricLoadCenter:Distribution,", @@ -302,7 +287,7 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case2) " ElectricLoadCenter:Storage:Simple,", " Test Storage Bank,", - " ALWAYS_ON, !- availability schedule", + " CONSTANT-1.0, !- availability schedule", " , !- zone name", " , !- radiative fraction", " 1.0 , !- Nominal Energetic Efficiency for Charging", @@ -317,23 +302,17 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case2) " Test Gen 1, !- Generator 1 Name", " Generator:InternalCombustionEngine, !- Generator 1 Object Type", " 1000.0, !- Generator 1 Rated Electric Power Output {W}", - " ALWAYS_ON, !- Generator 1 Availability Schedule Name", + " CONSTANT-1.0, !- Generator 1 Availability Schedule Name", " , !- Generator 1 Rated Thermal to Electrical Power Ratio", " Test Gen 2, !- Generator 2 Name", " Generator:WindTurbine, !- Generator 2 Object Type", " 2000.0, !- Generator 2 Rated Electric Power Output {W}", - " ALWAYS_ON, !- Generator 2 Availability Schedule Name", + " CONSTANT-1.0, !- Generator 2 Availability Schedule Name", " ; !- Generator 2 Rated Thermal to Electrical Power Ratio", - - " Schedule:Compact,", - " ALWAYS_ON, !- Name", - " On/Off, !- Schedule Type Limits Name", - " Through: 12/31, !- Field 1", - " For: AllDays, !- Field 2", - " Until: 24:00,1; !- Field 3", }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); createFacilityElectricPowerServiceObject(*state); state->dataElectPwrSvcMgr->facilityElectricServiceObj->elecLoadCenterObjs.emplace_back(new ElectPowerLoadCenter(*state, 1)); @@ -368,7 +347,6 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case2) TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case3) { - std::string const idf_objects = delimited_string({ " ElectricLoadCenter:Distribution,", @@ -396,7 +374,7 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case3) " ElectricLoadCenter:Inverter:Simple,", " Test Inverter,", - " ALWAYS_ON, !- availability schedule", + " CONSTANT-1.0, !- availability schedule", " , !- zone name", " , !- radiative fraction", " 1.0 ; !- Inverter efficiency", @@ -406,27 +384,22 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case3) " Test Gen 1, !- Generator 1 Name", " Generator:InternalCombustionEngine, !- Generator 1 Object Type", " 1000.0, !- Generator 1 Rated Electric Power Output {W}", - " ALWAYS_ON, !- Generator 1 Availability Schedule Name", + " CONSTANT-1.0, !- Generator 1 Availability Schedule Name", " , !- Generator 1 Rated Thermal to Electrical Power Ratio", " Test Gen 2, !- Generator 2 Name", " Generator:WindTurbine, !- Generator 2 Object Type", " 2000.0, !- Generator 2 Rated Electric Power Output {W}", - " ALWAYS_ON, !- Generator 2 Availability Schedule Name", + " CONSTANT-1.0, !- Generator 2 Availability Schedule Name", " ; !- Generator 2 Rated Thermal to Electrical Power Ratio", - - " Schedule:Constant,", - " ALWAYS_ON, !- Name", - " On/Off, !- Schedule Type Limits Name", - " 1; !- Field 3", }); ASSERT_TRUE(process_idf(idf_objects)); // get availability schedule to work - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); + state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataGlobal->HourOfDay = 1; @@ -435,7 +408,7 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case3) state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); createFacilityElectricPowerServiceObject(*state); state->dataElectPwrSvcMgr->facilityElectricServiceObj->elecLoadCenterObjs.emplace_back(new ElectPowerLoadCenter(*state, 1)); @@ -462,7 +435,6 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case3) TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case4) { - std::string const idf_objects = delimited_string({ " ElectricLoadCenter:Distribution,", @@ -490,14 +462,14 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case4) " ElectricLoadCenter:Inverter:Simple,", " Test Inverter,", - " ALWAYS_ON, !- availability schedule", + " CONSTANT-1.0, !- availability schedule", " , !- zone name", " , !- radiative fraction", " 1.0 ; !- Inverter efficiency", " ElectricLoadCenter:Storage:Simple,", " Test Storage Bank,", - " ALWAYS_ON, !- availability schedule", + " CONSTANT-1.0, !- availability schedule", " , !- zone name", " , !- radiative fraction", " 1.0 , !- Nominal Energetic Efficiency for Charging", @@ -512,34 +484,23 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case4) " Test Gen 1, !- Generator 1 Name", " Generator:InternalCombustionEngine, !- Generator 1 Object Type", " 1000.0, !- Generator 1 Rated Electric Power Output {W}", - " ALWAYS_ON, !- Generator 1 Availability Schedule Name", + " CONSTANT-1.0, !- Generator 1 Availability Schedule Name", " , !- Generator 1 Rated Thermal to Electrical Power Ratio", " Test Gen 2, !- Generator 2 Name", " Generator:WindTurbine, !- Generator 2 Object Type", " 2000.0, !- Generator 2 Rated Electric Power Output {W}", - " ALWAYS_ON, !- Generator 2 Availability Schedule Name", + " CONSTANT-1.0, !- Generator 2 Availability Schedule Name", " ; !- Generator 2 Rated Thermal to Electrical Power Ratio", - - " Schedule:Compact,", - " ALWAYS_ON, !- Name", - " On/Off, !- Schedule Type Limits Name", - " Through: 12/31, !- Field 1", - " For: AllDays, !- Field 2", - " Until: 24:00,1; !- Field 3", }); ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); createFacilityElectricPowerServiceObject(*state); state->dataElectPwrSvcMgr->facilityElectricServiceObj->elecLoadCenterObjs.emplace_back(new ElectPowerLoadCenter(*state, 1)); - // get availability schedule to work - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules - state->dataScheduleMgr->ScheduleInputProcessed = true; state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataGlobal->HourOfDay = 1; @@ -548,7 +509,7 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case4) state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // Case 4 DCBussInverterDCStorage Inverter = 5000, state->dataElectPwrSvcMgr->facilityElectricServiceObj->elecLoadCenterObjs[0]->bussType = @@ -574,7 +535,6 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case4) TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case5) { - std::string const idf_objects = delimited_string({ " ElectricLoadCenter:Distribution,", @@ -590,14 +550,14 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case5) " ElectricLoadCenter:Inverter:Simple,", " Test Inverter,", - " ALWAYS_ON, !- availability schedule", + " CONSTANT-1.0, !- availability schedule", " , !- zone name", " , !- radiative fraction", " 1.0 ; !- Inverter efficiency", " ElectricLoadCenter:Storage:Simple,", " Test Storage Bank,", - " ALWAYS_ON, !- availability schedule", + " CONSTANT-1.0, !- availability schedule", " , !- zone name", " , !- radiative fraction", " 1.0 , !- Nominal Energetic Efficiency for Charging", @@ -612,29 +572,22 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case5) " Test Gen 1, !- Generator 1 Name", " Generator:InternalCombustionEngine, !- Generator 1 Object Type", " 1000.0, !- Generator 1 Rated Electric Power Output {W}", - " ALWAYS_ON, !- Generator 1 Availability Schedule Name", + " CONSTANT-1.0, !- Generator 1 Availability Schedule Name", " , !- Generator 1 Rated Thermal to Electrical Power Ratio", " Test Gen 2, !- Generator 2 Name", " Generator:WindTurbine, !- Generator 2 Object Type", " 2000.0, !- Generator 2 Rated Electric Power Output {W}", - " ALWAYS_ON, !- Generator 2 Availability Schedule Name", + " CONSTANT-1.0, !- Generator 2 Availability Schedule Name", " ; !- Generator 2 Rated Thermal to Electrical Power Ratio", - - " Schedule:Compact,", - " ALWAYS_ON, !- Name", - " On/Off, !- Schedule Type Limits Name", - " Through: 12/31, !- Field 1", - " For: AllDays, !- Field 2", - " Until: 24:00,1; !- Field 3", }); ASSERT_TRUE(process_idf(idf_objects)); // get availability schedule to work - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); + state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataGlobal->HourOfDay = 1; @@ -643,7 +596,7 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case5) state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); createFacilityElectricPowerServiceObject(*state); state->dataElectPwrSvcMgr->facilityElectricServiceObj->elecLoadCenterObjs.emplace_back(new ElectPowerLoadCenter(*state, 1)); @@ -678,7 +631,6 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case5) } TEST_F(EnergyPlusFixture, ManageElectricPowerTest_CheckOutputReporting) { - std::string const idf_objects = delimited_string({ " LoadProfile:Plant,", @@ -695,6 +647,7 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_CheckOutputReporting) state->dataHVACGlobal->TimeStepSys = 1.0; state->dataHVACGlobal->TimeStepSysSec = 3600.0; state->dataGlobal->TimeStepZoneSec = 3600.0; + state->init_state(*state); createFacilityElectricPowerServiceObject(*state); bool SimElecCircuitsFlag = false; @@ -706,7 +659,6 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_CheckOutputReporting) } TEST_F(EnergyPlusFixture, ManageElectricPowerTest_TransformerLossTest) { - std::string const idf_objects = delimited_string({ " ElectricLoadCenter:Distribution,", @@ -723,14 +675,14 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_TransformerLossTest) " ElectricLoadCenter:Inverter:Simple,", " Test Inverter,", - " Always_ON, !- availability schedule", + " CONSTANT-1.0, !- availability schedule", " , !- zone name", " , !- radiative fraction", " 1.0; !- Inverter efficiency", " ElectricLoadCenter:Storage:Simple,", " Test Storage Bank,", - " Always_ON, !- availability schedule", + " CONSTANT-1.0, !- availability schedule", " , !- zone name", " , !- radiative fraction", " 1.0, !- Nominal Energetic Efficiency for Charging", @@ -745,17 +697,17 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_TransformerLossTest) " Test Gen 1, !- Generator 1 Name", " Generator:InternalCombustionEngine, !- Generator 1 Object Type", " 1000.0, !- Generator 1 Rated Electric Power Output {W}", - " Always_ON, !- Generator 1 Availability Schedule Name", + " CONSTANT-1.0, !- Generator 1 Availability Schedule Name", " , !- Generator 1 Rated Thermal to Electrical Power Ratio", " Test Gen 2, !- Generator 2 Name", " Generator:WindTurbine, !- Generator 2 Object Type", " 2000.0, !- Generator 2 Rated Electric Power Output {W}", - " Always_ON, !- Generator 2 Availability Schedule Name", + " CONSTANT-1.0, !- Generator 2 Availability Schedule Name", " ; !- Generator 2 Rated Thermal to Electrical Power Ratio", " ElectricLoadCenter:Transformer,", " Transformer, !- Name", - " Always_ON, !- Availability Schedule Name", + " CONSTANT-1.0, !- Availability Schedule Name", " PowerOutToGrid, !- Transformer Usage", " , !- Zone Name", " , !- Radiative Fraction", @@ -772,33 +724,26 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_TransformerLossTest) " , !- Reference Temperature for Nameplate Efficiency {C}", " , !- Per Unit Load for Maximum Efficiency", " ; !- Consider Transformer Loss for Utility Cost", - - " Schedule:Compact,", - " Always_ON, !- Name", - " On/Off, !- Schedule Type Limits Name", - " Through: 12/31, !- Field 1", - " For: AllDays, !- Field 2", - " Until: 24:00,1; !- Field 3", }); ASSERT_TRUE(process_idf(idf_objects)); // get availability schedule to work - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + state->dataGlobal->HourOfDay = 1; state->dataGlobal->TimeStep = 1; state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataHVACGlobal->TimeStepSys = 1.0; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->dataEnvrn->DSTIndicator = 0; state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); createFacilityElectricPowerServiceObject(*state); state->dataElectPwrSvcMgr->facilityElectricServiceObj->elecLoadCenterObjs.emplace_back(new ElectPowerLoadCenter(*state, 1)); @@ -814,7 +759,6 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_TransformerLossTest) // unused. Any other performance type shouldn't warn TEST_F(EnergyPlusFixture, ElectricLoadCenter_WarnAvailabilitySchedule_Photovoltaic_Simple) { - std::string const idf_objects = delimited_string({ "ElectricLoadCenter:Distribution,", " PV Electric Load Center, !- Name", @@ -936,14 +880,15 @@ TEST_F(EnergyPlusFixture, ElectricLoadCenter_WarnAvailabilitySchedule_Photovolta }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); createFacilityElectricPowerServiceObject(*state); state->dataElectPwrSvcMgr->facilityElectricServiceObj->elecLoadCenterObjs.emplace_back(new ElectPowerLoadCenter(*state, 1)); // Should warn only for SimplePV because SimplePV2 doesn't have a schedule, and the other one is a Perf One-Diode and not "Simple" std::string const error_string = delimited_string({ - " ** Warning ** GeneratorController constructor ElectricLoadCenter:Generators, Availability Schedule for Generator:Photovoltaics " - "'SIMPLEPV' of Type PhotovoltaicPerformance:Simple will be be ignored (runs all the time).", + " ** Warning ** GeneratorController constructor : GENERATOR:PHOTOVOLTAIC = SIMPLEPV", + " ** ~~~ ** Availability Schedule will be ignored (runs all the time).", " ** ~~~ ** To limit this Generator:Photovoltaic's output, please use the Inverter's availability schedule instead.", }); EXPECT_TRUE(compare_err_stream(error_string, true)); @@ -952,7 +897,6 @@ TEST_F(EnergyPlusFixture, ElectricLoadCenter_WarnAvailabilitySchedule_Photovolta // #7151: If an ElectricLoadCenter:Generators lists a Generator:PVWatts with an availability schedule, warn that it will be unused TEST_F(EnergyPlusFixture, ElectricLoadCenter_WarnAvailabilitySchedule_PVWatts) { - std::string const idf_objects = delimited_string({ "ElectricLoadCenter:Distribution,", " PVWatts Electric Load Center, !- Name", @@ -1024,15 +968,14 @@ TEST_F(EnergyPlusFixture, ElectricLoadCenter_WarnAvailabilitySchedule_PVWatts) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); createFacilityElectricPowerServiceObject(*state); state->dataElectPwrSvcMgr->facilityElectricServiceObj->elecLoadCenterObjs.emplace_back(new ElectPowerLoadCenter(*state, 1)); // Should warn only for PVWatts1 because PVWatts2 doesn't have a schedule - std::string const error_string = delimited_string({ - " ** Warning ** GeneratorController constructor ElectricLoadCenter:Generators, Availability Schedule for Generator:PVWatts 'PVWATTS1' will " - "be be ignored (runs all the time).", - }); + std::string const error_string = delimited_string({" ** Warning ** GeneratorController constructor : GENERATOR:PVWATTS = PVWATTS1", + " ** ~~~ ** Availability Schedule will be ignored (runs all the time)."}); EXPECT_TRUE(compare_err_stream(error_string, true)); } @@ -1078,6 +1021,7 @@ TEST_F(EnergyPlusFixture, Battery_LiIonNmc_Constructor) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); ElectricStorage battery1{*state, "Battery1"}; ASSERT_TRUE(Util::SameString(battery1.name(), "Battery1")); @@ -1121,10 +1065,12 @@ TEST_F(EnergyPlusFixture, Battery_LiIonNmc_Simulate) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataHVACGlobal->TimeStepSys = 0.25; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; + state->init_state(*state); + ElectricStorage battery{*state, "Battery1"}; - state->dataHVACGlobal->TimeStepSys = 0.25; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; state->dataEnvrn->OutDryBulbTemp = 23.0; Real64 socMin = 0.1; Real64 socMax = 0.95; @@ -1191,15 +1137,17 @@ TEST_F(EnergyPlusFixture, Battery_checkUserEfficiencyInputTest) // Fix for Defect #8867: EnergyPlus was allowing zero efficiency which led to a divide by zero in ElectricPowerServiceManager.cc. // Input is now tested to make sure that a zero value is not allowed. + state->init_state(*state); // Test 1: charging, charging efficiency zero-->gets reset to minimum (0.001) userInputEfficiencyCharge = 0.0; expectedResult = 0.001; errorsFound = false; functionResult = checkUserEfficiencyInput(*state, userInputEfficiencyCharge, "CHARGING", "Tatooine", errorsFound); EXPECT_NEAR(functionResult, expectedResult, 0.00001); - std::string const error_string1 = - delimited_string({" ** Severe ** ElectricStorage charge efficiency was too low. This occurred for electric storage unit named Tatooine", - " ** ~~~ ** Please check your input value for this electric storage unit and fix the charge efficiency."}); + std::string const error_string1 = delimited_string( + {format(" ** Warning ** Version: missing in IDF, processing for EnergyPlus version=\"{}\"", DataStringGlobals::MatchVersion), + " ** Severe ** ElectricStorage charge efficiency was too low. This occurred for electric storage unit named Tatooine", + " ** ~~~ ** Please check your input value for this electric storage unit and fix the charge efficiency."}); EXPECT_TRUE(compare_err_stream(error_string1, true)); EXPECT_TRUE(errorsFound); @@ -1290,6 +1238,7 @@ TEST_F(EnergyPlusFixture, Battery_checkChargeDischargeVoltageCurves) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Curve::GetCurveInput(*state); state->dataCurveManager->GetCurvesInputFlag = false; diff --git a/tst/EnergyPlus/unit/EquipAndOperations.unit.cc b/tst/EnergyPlus/unit/EquipAndOperations.unit.cc index 65a5879e066..c7559234935 100644 --- a/tst/EnergyPlus/unit/EquipAndOperations.unit.cc +++ b/tst/EnergyPlus/unit/EquipAndOperations.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -125,6 +125,9 @@ class DistributeEquipOpTest : public EnergyPlusFixture thisPlantLoop.OperationScheme = "Heating Loop Operation Scheme List"; } + thisPlantLoop.FluidName = "WATER"; + thisPlantLoop.glycol = Fluid::GetWater(*state); + thisPlantLoop.NumOpSchemes = 1; thisPlantLoop.OpScheme.allocate(thisPlantLoop.NumOpSchemes); auto &opSch1 = thisPlantLoop.OpScheme(1); @@ -274,6 +277,8 @@ TEST_F(DistributeEquipOpTest, EvaluateChillerHeaterChangeoverOpSchemeTest) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + auto &heatBranch1 = state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1); auto &heatComp1 = state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).Comp(1); heatComp1.Type = DataPlant::PlantEquipmentType::HeatPumpEIRHeating; @@ -503,6 +508,8 @@ TEST_F(DistributeEquipOpTest, SupervisoryControlLogicForAirSourcePlantsTest) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + auto &heatBranch1 = state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1); auto &heatComp1 = state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).Comp(1); heatComp1.Type = DataPlant::PlantEquipmentType::HeatPumpEIRHeating; diff --git a/tst/EnergyPlus/unit/EvaporativeCoolers.unit.cc b/tst/EnergyPlus/unit/EvaporativeCoolers.unit.cc index 3361323ac7e..4c783706705 100644 --- a/tst/EnergyPlus/unit/EvaporativeCoolers.unit.cc +++ b/tst/EnergyPlus/unit/EvaporativeCoolers.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -77,6 +77,7 @@ namespace EnergyPlus { TEST_F(EnergyPlusFixture, EvapCoolers_SecondaryAirOutletCondition) { + state->init_state(*state); auto &EvapCond(state->dataEvapCoolers->EvapCond); EvapCond.allocate(1); @@ -104,8 +105,6 @@ TEST_F(EnergyPlusFixture, EvapCoolers_SecondaryAirOutletCondition) AirMassFlowSec = 2.0; QHXTotal = 10206.410750000941; - InitializePsychRoutines(*state); - // make the call for dry operating mode CalcSecondaryAirOutletCondition(*state, EvapCoolNum, OperatingMode, AirMassFlowSec, EDBTSec, EWBTSec, EHumRatSec, QHXTotal, QHXLatent); @@ -131,6 +130,7 @@ TEST_F(EnergyPlusFixture, EvapCoolers_SecondaryAirOutletCondition) TEST_F(EnergyPlusFixture, EvapCoolers_IndEvapCoolerOutletTemp) { + state->init_state(*state); auto &EvapCond(state->dataEvapCoolers->EvapCond); int constexpr EvapCoolNum(1); @@ -167,6 +167,7 @@ TEST_F(EnergyPlusFixture, EvapCoolers_IndEvapCoolerOutletTemp) TEST_F(EnergyPlusFixture, EvapCoolers_SizeIndEvapCoolerTest) { + state->init_state(*state); auto &EvapCond(state->dataEvapCoolers->EvapCond); int constexpr EvapCoolNum(1); @@ -260,6 +261,7 @@ TEST_F(EnergyPlusFixture, EvapCoolers_SizeIndEvapCoolerTest) TEST_F(EnergyPlusFixture, EvapCoolers_SizeDirEvapCoolerTest) { + state->init_state(*state); auto &EvapCond(state->dataEvapCoolers->EvapCond); int constexpr EvapCoolNum(1); @@ -327,6 +329,7 @@ TEST_F(EnergyPlusFixture, EvapCoolers_SizeDirEvapCoolerTest) TEST_F(EnergyPlusFixture, EvaporativeCoolers_CalcSecondaryAirOutletCondition) { + state->init_state(*state); auto &EvapCond(state->dataEvapCoolers->EvapCond); EvapCond.allocate(1); @@ -355,8 +358,6 @@ TEST_F(EnergyPlusFixture, EvaporativeCoolers_CalcSecondaryAirOutletCondition) AirMassFlowSec = 2.0; QHXTotal = 10206.410750000941; - InitializePsychRoutines(*state); - // make the call for dry operating mode EvaporativeCoolers::CalcSecondaryAirOutletCondition( *state, EvapCoolNum, OperatingMode, AirMassFlowSec, EDBTSec, EWBTSec, EHumRatSec, QHXTotal, QHXLatent); @@ -384,6 +385,7 @@ TEST_F(EnergyPlusFixture, EvaporativeCoolers_CalcSecondaryAirOutletCondition) TEST_F(EnergyPlusFixture, EvaporativeCoolers_CalcIndirectRDDEvapCoolerOutletTemp) { + state->init_state(*state); auto &EvapCond(state->dataEvapCoolers->EvapCond); state->dataEnvrn->OutBaroPress = 101325.0; @@ -419,6 +421,7 @@ TEST_F(EnergyPlusFixture, EvaporativeCoolers_CalcIndirectRDDEvapCoolerOutletTemp TEST_F(EnergyPlusFixture, EvaporativeCoolers_IndEvapCoolerPower) { + state->init_state(*state); auto &EvapCond(state->dataEvapCoolers->EvapCond); EvapCond.allocate(1); @@ -470,6 +473,7 @@ TEST_F(EnergyPlusFixture, EvaporativeCoolers_IndEvapCoolerPower) TEST_F(EnergyPlusFixture, EvaporativeCoolers_SizeEvapCooler) { + state->init_state(*state); auto &EvapCond(state->dataEvapCoolers->EvapCond); // one-time setup of evap cooler instance @@ -551,6 +555,7 @@ TEST_F(EnergyPlusFixture, EvaporativeCoolers_SizeEvapCooler) TEST_F(EnergyPlusFixture, DefaultAutosizeIndEvapCoolerTest) { + state->init_state(*state); int constexpr EvapCoolNum(1); Real64 PrimaryAirDesignFlow(0.0); @@ -649,6 +654,7 @@ TEST_F(EnergyPlusFixture, DefaultAutosizeIndEvapCoolerTest) TEST_F(EnergyPlusFixture, DefaultAutosizeDirEvapCoolerTest) { + state->init_state(*state); int constexpr EvapCoolNum(1); Real64 PrimaryAirDesignFlow(0.0); @@ -718,6 +724,7 @@ TEST_F(EnergyPlusFixture, DefaultAutosizeDirEvapCoolerTest) TEST_F(EnergyPlusFixture, DirectEvapCoolerResearchSpecialCalcTest) { + state->init_state(*state); auto &EvapCond(state->dataEvapCoolers->EvapCond); // one-time setup of evap cooler instance @@ -739,7 +746,7 @@ TEST_F(EnergyPlusFixture, DirectEvapCoolerResearchSpecialCalcTest) // set up the flow rates for a direct RDDSpecial thisEvapCooler.evapCoolerType = EvapCoolerType::DirectResearchSpecial; thisEvapCooler.Name = "MyDirectEvapCoolerRS"; - thisEvapCooler.SchedPtr = ScheduleManager::ScheduleAlwaysOn; + thisEvapCooler.availSched = Sched::GetScheduleAlwaysOn(*state); thisEvapCooler.PumpPowerModifierCurveIndex = 1; thisEvapCooler.DirectEffectiveness = 0.75; thisEvapCooler.DesVolFlowRate = 1.0; @@ -769,6 +776,7 @@ TEST_F(EnergyPlusFixture, DirectEvapCoolerResearchSpecialCalcTest) TEST_F(EnergyPlusFixture, EvaporativeCoolers_IndirectRDDEvapCoolerOperatingMode) { + state->init_state(*state); auto &EvapCond(state->dataEvapCoolers->EvapCond); state->dataEnvrn->OutBaroPress = 101325.0; @@ -815,6 +823,7 @@ TEST_F(EnergyPlusFixture, EvaporativeCoolers_IndirectRDDEvapCoolerOperatingMode) TEST_F(EnergyPlusFixture, DirectEvapCoolerAutosizeWithoutSysSizingRunDone) { + state->init_state(*state); int constexpr EvapCoolNum(1); state->dataSize->NumSysSizInput = 1; @@ -866,6 +875,7 @@ TEST_F(EnergyPlusFixture, DirectEvapCoolerAutosizeWithoutSysSizingRunDone) ASSERT_THROW(EvaporativeCoolers::SizeEvapCooler(*state, 1), std::runtime_error); std::string const error_string = delimited_string({ + format(" ** Warning ** Version: missing in IDF, processing for EnergyPlus version=\"{}\"", DataStringGlobals::MatchVersion), " ** Severe ** For autosizing of EvaporativeCooler:Direct:ResearchSpecial DIRECTEVAPCOOLER, a system sizing run must be done.", " ** ~~~ ** The \"SimulationControl\" object did not have the field \"Do System Sizing Calculation\" set to Yes.", " ** Fatal ** Program terminates due to previously shown condition(s).", @@ -897,6 +907,7 @@ TEST_F(EnergyPlusFixture, EvapCoolerAirLoopPumpCycling) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); EvaporativeCoolers::GetEvapInput(*state); ASSERT_FALSE(ErrorsFound); diff --git a/tst/EnergyPlus/unit/EvaporativeFluidCoolers.unit.cc b/tst/EnergyPlus/unit/EvaporativeFluidCoolers.unit.cc index 1238b47808c..219300e9982 100644 --- a/tst/EnergyPlus/unit/EvaporativeFluidCoolers.unit.cc +++ b/tst/EnergyPlus/unit/EvaporativeFluidCoolers.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -109,7 +109,10 @@ TEST_F(EnergyPlusFixture, EvapFluidCoolerSpecs_getDesignCapacitiesTest) state->dataLoopNodes->Node(1).MassFlowRateMin = 0.0; state->dataLoopNodes->Node(1).MassFlowRateMax = 0.05; state->dataLoopNodes->Node(1).MassFlowRateMaxAvail = 0.05; + state->dataPlnt->PlantLoop.allocate(1); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).FlowLock = DataPlant::FlowLock::Locked; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp.allocate(1); @@ -127,6 +130,7 @@ TEST_F(EnergyPlusFixture, EvapFluidCoolerSpecs_getDesignCapacitiesTest) state->dataSize->PlantSizData.allocate(1); state->dataSize->PlantSizData(1).DeltaT = 5.0; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataSize->PlantSizData(1).ExitTemp = 20.0; // Now set the specific data for the actual test @@ -169,12 +173,15 @@ TEST_F(EnergyPlusFixture, ExerciseSingleSpeedEvapFluidCooler) "25.6; !- Design Entering Air Wet-bulb Temperature {C}"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); EvapFluidCoolerSpecs *ptr = EvapFluidCoolerSpecs::factory(*state, DataPlant::PlantEquipmentType::EvapFluidCooler_SingleSpd, "BIG EVAPORATIVEFLUIDCOOLER"); PlantLocation pl{1, EnergyPlus::DataPlant::LoopSideLocation::Demand, 1, 1}; state->dataPlnt->PlantLoop.allocate(1); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp.allocate(1); @@ -254,11 +261,14 @@ TEST_F(EnergyPlusFixture, ExerciseTwoSpeedEvapFluidCooler) "3; !- Blowdown Concentration Ratio"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); EvapFluidCoolerSpecs *ptr = EvapFluidCoolerSpecs::factory(*state, DataPlant::PlantEquipmentType::EvapFluidCooler_TwoSpd, "CENTRAL TOWER"); PlantLocation pl{1, EnergyPlus::DataPlant::LoopSideLocation::Demand, 1, 1}; state->dataPlnt->PlantLoop.allocate(1); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp.allocate(1); diff --git a/tst/EnergyPlus/unit/ExhaustSystem.unit.cc b/tst/EnergyPlus/unit/ExhaustSystem.unit.cc index c40636369dc..4219160069f 100644 --- a/tst/EnergyPlus/unit/ExhaustSystem.unit.cc +++ b/tst/EnergyPlus/unit/ExhaustSystem.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -362,6 +362,9 @@ TEST_F(EnergyPlusFixture, ExhaustSystemInputTest) " CONTINUOUS; !- Numeric Type", }); + ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + // Preset some elements state->dataHeatBal->Zone.allocate(4); state->dataHeatBal->Zone(1).Name = "ZONE1"; @@ -378,9 +381,6 @@ TEST_F(EnergyPlusFixture, ExhaustSystemInputTest) // state->dataFans->fanObjs.emplace_back(new HVACFan::FanSystem(*state, "CentralExhaustFan1")); // state->dataFans->fanObjs.emplace_back(new HVACFan::FanSystem(*state, "CentralExhaustFan2")); - ASSERT_TRUE(process_idf(idf_objects)); - ScheduleManager::ProcessScheduleInput(*state); - // Call the processing codes ExhaustAirSystemManager::GetZoneExhaustControlInput(*state); @@ -432,6 +432,7 @@ TEST_F(EnergyPlusFixture, ExhaustSystemInputTest) TEST_F(EnergyPlusFixture, ZoneExhaustCtrl_CheckSupplyNode_Test) { + state->init_state(*state); // Preset some elements state->dataGlobal->NumOfZones = 4; state->dataHeatBal->Zone.allocate(state->dataGlobal->NumOfZones); @@ -578,7 +579,7 @@ TEST_F(EnergyPlusFixture, ZoneExhaustCtrl_CheckSupplyNode_Test) EXPECT_TRUE(NodeNotFound); - EXPECT_EQ(state->dataErrTracking->TotalWarningErrors, 0); + EXPECT_EQ(state->dataErrTracking->TotalWarningErrors, 1); EXPECT_EQ(state->dataErrTracking->TotalSevereErrors, 1); EXPECT_EQ(state->dataErrTracking->LastSevereError, "GetExhaustControlInput: ZoneHVAC:ExhaustControl="); } @@ -859,6 +860,9 @@ TEST_F(EnergyPlusFixture, ZoneExhaustCtrl_Test_CalcZoneHVACExhaustControl_Call) " CONTINUOUS; !- Numeric Type", }); + ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + // Preset some elements state->dataHeatBal->Zone.allocate(4); state->dataHeatBal->Zone(1).Name = "ZONE1"; @@ -869,9 +873,6 @@ TEST_F(EnergyPlusFixture, ZoneExhaustCtrl_Test_CalcZoneHVACExhaustControl_Call) state->dataSize->FinalZoneSizing.allocate(4); state->dataSize->FinalZoneSizing(2).MinOA = 0.25; - ASSERT_TRUE(process_idf(idf_objects)); - ScheduleManager::ProcessScheduleInput(*state); - // Call the processing codes ExhaustAirSystemManager::GetZoneExhaustControlInput(*state); ExhaustAirSystemManager::GetExhaustAirSystemInput(*state); diff --git a/tst/EnergyPlus/unit/ExteriorEnergyUse.unit.cc b/tst/EnergyPlus/unit/ExteriorEnergyUse.unit.cc index 1eb8e0cb3a4..fff836000ad 100644 --- a/tst/EnergyPlus/unit/ExteriorEnergyUse.unit.cc +++ b/tst/EnergyPlus/unit/ExteriorEnergyUse.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -60,22 +60,20 @@ using namespace EnergyPlus; using namespace EnergyPlus::ExteriorEnergyUse; -using namespace EnergyPlus::ScheduleManager; TEST_F(EnergyPlusFixture, ExteriorEquipmentTest_Test1) { + state->dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * Constant::rSecsInHour; + state->init_state(*state); state->dataExteriorEnergyUse->NumExteriorLights = 0; state->dataExteriorEnergyUse->NumExteriorEqs = 2; - state->dataGlobal->TimeStepZone = 0.25; - state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * Constant::SecInHour; state->dataExteriorEnergyUse->ExteriorEquipment.allocate(state->dataExteriorEnergyUse->NumExteriorEqs); state->dataExteriorEnergyUse->ExteriorEquipment(1).DesignLevel = 1000.0; state->dataExteriorEnergyUse->ExteriorEquipment(2).DesignLevel = 0.0; - state->dataExteriorEnergyUse->ExteriorEquipment(1).SchedPtr = - ScheduleManager::ScheduleAlwaysOn; // From dataglobals, always returns a 1 for schedule value - state->dataExteriorEnergyUse->ExteriorEquipment(2).SchedPtr = - ScheduleManager::ScheduleAlwaysOn; // From dataglobals, always returns a 1 for schedule value + state->dataExteriorEnergyUse->ExteriorEquipment(1).sched = Sched::GetScheduleAlwaysOn(*state); + state->dataExteriorEnergyUse->ExteriorEquipment(2).sched = Sched::GetScheduleAlwaysOn(*state); ReportExteriorEnergyUse(*state); EXPECT_EQ(1000.0, state->dataExteriorEnergyUse->ExteriorEquipment(1).Power); diff --git a/tst/EnergyPlus/unit/FanCoilUnits.unit.cc b/tst/EnergyPlus/unit/FanCoilUnits.unit.cc index cde523187e2..0f19bb54921 100644 --- a/tst/EnergyPlus/unit/FanCoilUnits.unit.cc +++ b/tst/EnergyPlus/unit/FanCoilUnits.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -95,7 +95,6 @@ using namespace EnergyPlus::HeatBalanceManager; using namespace EnergyPlus::OutputProcessor; using namespace EnergyPlus::OutputReportPredefined; using namespace EnergyPlus::Psychrometrics; -using namespace EnergyPlus::ScheduleManager; using namespace EnergyPlus::WaterCoils; namespace EnergyPlus { @@ -119,11 +118,9 @@ TEST_F(EnergyPlusFixture, MultiStage4PipeFanCoilHeatingTest) state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; state->dataGlobalNames->NumCoils = 0; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - - InitializePsychRoutines(*state); + state->dataGlobal->MinutesInTimeStep = 60; std::string const idf_objects = delimited_string({ " Zone,", @@ -247,12 +244,13 @@ TEST_F(EnergyPlusFixture, MultiStage4PipeFanCoilHeatingTest) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetZoneData(*state, ErrorsFound); + EXPECT_EQ("EAST ZONE", state->dataHeatBal->Zone(1).Name); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; GetFanInput(*state); EXPECT_EQ((int)HVAC::FanType::OnOff, (int)state->dataFans->fans(1)->type); @@ -358,9 +356,8 @@ TEST_F(EnergyPlusFixture, MultiStage4PipeFanCoilHeatingTest) state->dataWaterCoils->WaterCoil(1).WaterPlantLoc.compNum = 1; state->dataPlnt->PlantLoop(2).Name = "ChilledWaterLoop"; - state->dataPlnt->PlantLoop(2).FluidName = "ChilledWater"; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterCooling; @@ -368,9 +365,8 @@ TEST_F(EnergyPlusFixture, MultiStage4PipeFanCoilHeatingTest) state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum; state->dataPlnt->PlantLoop(1).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "HotWater"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; @@ -401,7 +397,7 @@ TEST_F(EnergyPlusFixture, MultiStage4PipeFanCoilHeatingTest) state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); CalcMultiStage4PipeFanCoil(*state, FanCoilNum, ZoneNum, FirstHVACIteration, QZnReq, SpeedRatio, PartLoadRatio, QUnitOut); @@ -440,11 +436,9 @@ TEST_F(EnergyPlusFixture, MultiStage4PipeFanCoilCoolingTest) state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; state->dataGlobalNames->NumCoils = 0; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - - InitializePsychRoutines(*state); + state->dataGlobal->MinutesInTimeStep = 60; std::string const idf_objects = delimited_string({ " Zone,", @@ -570,12 +564,11 @@ TEST_F(EnergyPlusFixture, MultiStage4PipeFanCoilCoolingTest) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetZoneData(*state, ErrorsFound); EXPECT_EQ("EAST ZONE", state->dataHeatBal->Zone(1).Name); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; GetFanInput(*state); EXPECT_EQ((int)HVAC::FanType::OnOff, (int)state->dataFans->fans(1)->type); @@ -681,9 +674,8 @@ TEST_F(EnergyPlusFixture, MultiStage4PipeFanCoilCoolingTest) state->dataWaterCoils->WaterCoil(1).WaterPlantLoc.compNum = 1; state->dataPlnt->PlantLoop(2).Name = "ChilledWaterLoop"; - state->dataPlnt->PlantLoop(2).FluidName = "ChilledWater"; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterCooling; @@ -691,9 +683,8 @@ TEST_F(EnergyPlusFixture, MultiStage4PipeFanCoilCoolingTest) state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum; state->dataPlnt->PlantLoop(1).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "HotWater"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; @@ -724,7 +715,7 @@ TEST_F(EnergyPlusFixture, MultiStage4PipeFanCoilCoolingTest) state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); CalcMultiStage4PipeFanCoil(*state, FanCoilNum, ZoneNum, FirstHVACIteration, QZnReq, SpeedRatio, PartLoadRatio, QUnitOut); @@ -761,11 +752,9 @@ TEST_F(EnergyPlusFixture, ConstantFanVariableFlowFanCoilHeatingTest) state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; state->dataGlobalNames->NumCoils = 0; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - - InitializePsychRoutines(*state); + state->dataGlobal->MinutesInTimeStep = 60; std::string const idf_objects = delimited_string({ " Zone,", @@ -889,12 +878,12 @@ TEST_F(EnergyPlusFixture, ConstantFanVariableFlowFanCoilHeatingTest) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("EAST ZONE", state->dataHeatBal->Zone(1).Name); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; GetFanInput(*state); EXPECT_EQ((int)HVAC::FanType::OnOff, (int)state->dataFans->fans(1)->type); @@ -996,7 +985,7 @@ TEST_F(EnergyPlusFixture, ConstantFanVariableFlowFanCoilHeatingTest) } state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataWaterCoils->WaterCoil(2).WaterPlantLoc.loopNum = 1; state->dataWaterCoils->WaterCoil(2).WaterPlantLoc.loopSideNum = DataPlant::LoopSideLocation::Demand; @@ -1009,9 +998,7 @@ TEST_F(EnergyPlusFixture, ConstantFanVariableFlowFanCoilHeatingTest) state->dataWaterCoils->WaterCoil(1).WaterPlantLoc.compNum = 1; state->dataPlnt->PlantLoop(2).Name = "ChilledWaterLoop"; - state->dataPlnt->PlantLoop(2).FluidName = "ChilledWater"; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; - state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterCooling; @@ -1022,9 +1009,8 @@ TEST_F(EnergyPlusFixture, ConstantFanVariableFlowFanCoilHeatingTest) state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).FlowLock = DataPlant::FlowLock::Unlocked; state->dataPlnt->PlantLoop(1).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "HotWater"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; @@ -1069,7 +1055,7 @@ TEST_F(EnergyPlusFixture, ConstantFanVariableFlowFanCoilHeatingTest) state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // Normal heating simulation for fan coil with constant fan, variable water flow Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); @@ -1169,11 +1155,9 @@ TEST_F(EnergyPlusFixture, ElectricCoilFanCoilHeatingTest) state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; state->dataGlobalNames->NumCoils = 0; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - - InitializePsychRoutines(*state); + state->dataGlobal->MinutesInTimeStep = 60; std::string const idf_objects = delimited_string({ " Zone,", @@ -1288,12 +1272,12 @@ TEST_F(EnergyPlusFixture, ElectricCoilFanCoilHeatingTest) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("EAST ZONE", state->dataHeatBal->Zone(1).Name); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; GetFanInput(*state); EXPECT_EQ((int)HVAC::FanType::OnOff, (int)state->dataFans->fans(1)->type); @@ -1385,7 +1369,7 @@ TEST_F(EnergyPlusFixture, ElectricCoilFanCoilHeatingTest) } state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataWaterCoils->WaterCoil(1).WaterPlantLoc.loopNum = 1; state->dataWaterCoils->WaterCoil(1).WaterPlantLoc.loopSideNum = DataPlant::LoopSideLocation::Demand; @@ -1393,9 +1377,8 @@ TEST_F(EnergyPlusFixture, ElectricCoilFanCoilHeatingTest) state->dataWaterCoils->WaterCoil(1).WaterPlantLoc.compNum = 1; state->dataPlnt->PlantLoop(1).Name = "ChilledWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "ChilledWater"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterCooling; @@ -1440,7 +1423,7 @@ TEST_F(EnergyPlusFixture, ElectricCoilFanCoilHeatingTest) state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // Normal heating simulation for fan coil with constant fan, electric heating Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); @@ -1486,11 +1469,9 @@ TEST_F(EnergyPlusFixture, ConstantFanVariableFlowFanCoilCoolingTest) state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; state->dataGlobalNames->NumCoils = 0; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - - InitializePsychRoutines(*state); + state->dataGlobal->MinutesInTimeStep = 60; std::string const idf_objects = delimited_string({ " Zone,", @@ -1616,12 +1597,12 @@ TEST_F(EnergyPlusFixture, ConstantFanVariableFlowFanCoilCoolingTest) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("EAST ZONE", state->dataHeatBal->Zone(1).Name); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; GetFanInput(*state); EXPECT_EQ((int)HVAC::FanType::OnOff, (int)state->dataFans->fans(1)->type); @@ -1724,7 +1705,7 @@ TEST_F(EnergyPlusFixture, ConstantFanVariableFlowFanCoilCoolingTest) } state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataWaterCoils->WaterCoil(2).WaterPlantLoc.loopNum = 1; state->dataWaterCoils->WaterCoil(2).WaterPlantLoc.loopSideNum = DataPlant::LoopSideLocation::Demand; @@ -1737,9 +1718,8 @@ TEST_F(EnergyPlusFixture, ConstantFanVariableFlowFanCoilCoolingTest) state->dataWaterCoils->WaterCoil(1).WaterPlantLoc.compNum = 1; state->dataPlnt->PlantLoop(2).Name = "ChilledWaterLoop"; - state->dataPlnt->PlantLoop(2).FluidName = "ChilledWater"; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterCooling; @@ -1750,9 +1730,8 @@ TEST_F(EnergyPlusFixture, ConstantFanVariableFlowFanCoilCoolingTest) state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).FlowLock = DataPlant::FlowLock::Unlocked; state->dataPlnt->PlantLoop(1).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "HotWater"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; @@ -1797,7 +1776,7 @@ TEST_F(EnergyPlusFixture, ConstantFanVariableFlowFanCoilCoolingTest) state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // normal cooling simulation for constant fan variable flow fan coil Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); EXPECT_NEAR(QZnReq, QUnitOut, 5.0); @@ -1854,13 +1833,11 @@ TEST_F(EnergyPlusFixture, FanCoil_ASHRAE90VariableFan) state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; state->dataGlobalNames->NumCoils = 0; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->MinutesInTimeStep = 60; state->dataSize->CurZoneEqNum = 1; - InitializePsychRoutines(*state); - std::string const idf_objects = delimited_string({ " Zone,", " EAST ZONE, !- Name", @@ -1988,12 +1965,12 @@ TEST_F(EnergyPlusFixture, FanCoil_ASHRAE90VariableFan) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("EAST ZONE", state->dataHeatBal->Zone(1).Name); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; GetFanInput(*state); EXPECT_EQ((int)HVAC::FanType::OnOff, (int)state->dataFans->fans(1)->type); @@ -2099,9 +2076,8 @@ TEST_F(EnergyPlusFixture, FanCoil_ASHRAE90VariableFan) state->dataWaterCoils->WaterCoil(1).WaterPlantLoc.compNum = 1; state->dataPlnt->PlantLoop(2).Name = "ChilledWaterLoop"; - state->dataPlnt->PlantLoop(2).FluidName = "ChilledWater"; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterCooling; @@ -2111,9 +2087,8 @@ TEST_F(EnergyPlusFixture, FanCoil_ASHRAE90VariableFan) state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; state->dataPlnt->PlantLoop(1).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "HotWater"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; @@ -2147,7 +2122,7 @@ TEST_F(EnergyPlusFixture, FanCoil_ASHRAE90VariableFan) state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); state->dataSize->ZoneEqSizing.allocate(1); state->dataSize->ZoneEqSizing(state->dataSize->CurZoneEqNum).SizingMethod.allocate(HVAC::NumOfSizingTypes); @@ -2155,7 +2130,7 @@ TEST_F(EnergyPlusFixture, FanCoil_ASHRAE90VariableFan) state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback(1) = false; state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataSize->ZoneSizingRunDone = true; state->dataSize->FinalZoneSizing.allocate(1); state->dataSize->FinalZoneSizing(state->dataSize->CurZoneEqNum).DesCoolVolFlow = 0.5; @@ -2262,7 +2237,6 @@ TEST_F(EnergyPlusFixture, FanCoil_ASHRAE90VariableFan) TEST_F(EnergyPlusFixture, Test_TightenWaterFlowLimits) { - using General::SolveRoot; int FanCoilNum(1); @@ -2274,11 +2248,9 @@ TEST_F(EnergyPlusFixture, Test_TightenWaterFlowLimits) state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; state->dataGlobalNames->NumCoils = 0; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - - InitializePsychRoutines(*state); + state->dataGlobal->MinutesInTimeStep = 60; std::string const idf_objects = delimited_string({ " Zone, EAST ZONE, 0, 0, 0, 0, 1, 1, autocalculate, autocalculate;", @@ -2325,13 +2297,11 @@ TEST_F(EnergyPlusFixture, Test_TightenWaterFlowLimits) }); ASSERT_TRUE(process_idf(idf_objects)); - + state->init_state(*state); // OutputProcessor::TimeValue.allocate(2); GetZoneData(*state, ErrorsFound); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; SetPredefinedTables(*state); GetFanInput(*state); GetFanCoilUnits(*state); @@ -2357,9 +2327,8 @@ TEST_F(EnergyPlusFixture, Test_TightenWaterFlowLimits) state->dataWaterCoils->WaterCoil(1).WaterPlantLoc.compNum = 1; state->dataPlnt->PlantLoop(2).Name = "ChilledWaterLoop"; - state->dataPlnt->PlantLoop(2).FluidName = "ChilledWater"; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterCooling; @@ -2369,9 +2338,8 @@ TEST_F(EnergyPlusFixture, Test_TightenWaterFlowLimits) state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; state->dataPlnt->PlantLoop(1).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "HotWater"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; @@ -2397,8 +2365,7 @@ TEST_F(EnergyPlusFixture, Test_TightenWaterFlowLimits) state->dataEnvrn->DayOfYear_Schedule = 1; state->dataEnvrn->DayOfWeek = 2; state->dataGlobal->HourOfDay = 1; - ProcessScheduleInput(*state); - UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // fan coil can hit maximum iterations while trying to find the water mass flow rate to meet the load. In this case RegulaFalsi will return -1. // When this happens, this routine will find tighter limits on min/max water flow rate passed to RegulaFalsi @@ -2578,13 +2545,11 @@ TEST_F(EnergyPlusFixture, FanCoil_CyclingFanMode) state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; state->dataGlobalNames->NumCoils = 0; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->MinutesInTimeStep = 60; state->dataSize->CurZoneEqNum = 1; - InitializePsychRoutines(*state); - std::string const idf_objects = delimited_string({ " Zone,", " EAST ZONE, !- Name", @@ -2719,12 +2684,12 @@ TEST_F(EnergyPlusFixture, FanCoil_CyclingFanMode) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("EAST ZONE", state->dataHeatBal->Zone(1).Name); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; GetFanInput(*state); EXPECT_EQ((int)HVAC::FanType::OnOff, (int)state->dataFans->fans(1)->type); @@ -2829,9 +2794,8 @@ TEST_F(EnergyPlusFixture, FanCoil_CyclingFanMode) state->dataWaterCoils->WaterCoil(1).WaterPlantLoc.compNum = 1; state->dataPlnt->PlantLoop(2).Name = "ChilledWaterLoop"; - state->dataPlnt->PlantLoop(2).FluidName = "ChilledWater"; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterCooling; @@ -2841,9 +2805,8 @@ TEST_F(EnergyPlusFixture, FanCoil_CyclingFanMode) state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; state->dataPlnt->PlantLoop(1).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "HotWater"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; @@ -2878,7 +2841,7 @@ TEST_F(EnergyPlusFixture, FanCoil_CyclingFanMode) state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); state->dataSize->ZoneEqSizing.allocate(1); state->dataSize->ZoneEqSizing(state->dataSize->CurZoneEqNum).SizingMethod.allocate(HVAC::NumOfSizingTypes); @@ -2886,7 +2849,7 @@ TEST_F(EnergyPlusFixture, FanCoil_CyclingFanMode) state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback(1) = false; state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataSize->ZoneSizingRunDone = true; state->dataSize->FinalZoneSizing.allocate(1); state->dataSize->FinalZoneSizing(state->dataSize->CurZoneEqNum).DesCoolVolFlow = 0.5; @@ -2993,7 +2956,6 @@ TEST_F(EnergyPlusFixture, FanCoil_CyclingFanMode) TEST_F(EnergyPlusFixture, FanCoil_FanSystemModelCyclingFanMode) { - int FanCoilNum(1); int ZoneNum(1); bool FirstHVACIteration(false); @@ -3010,13 +2972,11 @@ TEST_F(EnergyPlusFixture, FanCoil_FanSystemModelCyclingFanMode) state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; state->dataGlobalNames->NumCoils = 0; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->MinutesInTimeStep = 60; state->dataSize->CurZoneEqNum = 1; - InitializePsychRoutines(*state); - std::string const idf_objects = delimited_string({ " Zone,", " EAST ZONE, !- Name", @@ -3164,13 +3124,12 @@ TEST_F(EnergyPlusFixture, FanCoil_FanSystemModelCyclingFanMode) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("EAST ZONE", state->dataHeatBal->Zone(1).Name); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; - GetFanCoilUnits(*state); auto &thisFanCoil(state->dataFanCoilUnits->FanCoil(1)); @@ -3261,9 +3220,8 @@ TEST_F(EnergyPlusFixture, FanCoil_FanSystemModelCyclingFanMode) // chilled water plant loop auto &CWLoop(state->dataPlnt->PlantLoop(2)); CWLoop.Name = "ChilledWaterLoop"; - CWLoop.FluidName = "ChilledWater"; - CWLoop.FluidIndex = 1; CWLoop.FluidName = "WATER"; + CWLoop.glycol = Fluid::GetWater(*state); CWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = CWCoil.Name; CWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterCooling; CWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).NodeNumIn = CWCoil.WaterInletNodeNum; @@ -3271,9 +3229,8 @@ TEST_F(EnergyPlusFixture, FanCoil_FanSystemModelCyclingFanMode) // hot water plant loop auto &HWLoop(state->dataPlnt->PlantLoop(1)); HWLoop.Name = "HotWaterLoop"; - HWLoop.FluidName = "HotWater"; - HWLoop.FluidIndex = 1; HWLoop.FluidName = "WATER"; + HWLoop.glycol = Fluid::GetWater(*state); HWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = HWCoil.Name; HWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; HWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).NodeNumIn = HWCoil.WaterInletNodeNum; @@ -3306,7 +3263,7 @@ TEST_F(EnergyPlusFixture, FanCoil_FanSystemModelCyclingFanMode) state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); state->dataSize->ZoneEqSizing.allocate(1); state->dataSize->ZoneEqSizing(state->dataSize->CurZoneEqNum).SizingMethod.allocate(HVAC::NumOfSizingTypes); @@ -3314,7 +3271,7 @@ TEST_F(EnergyPlusFixture, FanCoil_FanSystemModelCyclingFanMode) state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback(1) = false; state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataSize->ZoneSizingRunDone = true; state->dataSize->FinalZoneSizing.allocate(1); state->dataSize->FinalZoneSizing(state->dataSize->CurZoneEqNum).DesCoolVolFlow = 0.5; @@ -3397,7 +3354,6 @@ TEST_F(EnergyPlusFixture, FanCoil_FanSystemModelCyclingFanMode) TEST_F(EnergyPlusFixture, FanCoil_ElecHeatCoilMultiSpeedFanCyclingFanMode) { - int FanCoilNum(1); int ZoneNum(1); bool FirstHVACIteration(false); @@ -3413,13 +3369,11 @@ TEST_F(EnergyPlusFixture, FanCoil_ElecHeatCoilMultiSpeedFanCyclingFanMode) state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; state->dataGlobalNames->NumCoils = 0; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->MinutesInTimeStep = 60; state->dataSize->CurZoneEqNum = 1; - InitializePsychRoutines(*state); - std::string const idf_objects = delimited_string({ " Zone,", " EAST ZONE, !- Name", @@ -3566,11 +3520,11 @@ TEST_F(EnergyPlusFixture, FanCoil_ElecHeatCoilMultiSpeedFanCyclingFanMode) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("EAST ZONE", state->dataHeatBal->Zone(1).Name); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; GetFanCoilUnits(*state); auto &thisFanCoil(state->dataFanCoilUnits->FanCoil(1)); EXPECT_ENUM_EQ(CCM::MultiSpeedFan, thisFanCoil.CapCtrlMeth_Num); @@ -3641,9 +3595,8 @@ TEST_F(EnergyPlusFixture, FanCoil_ElecHeatCoilMultiSpeedFanCyclingFanMode) // chilled water plant loop auto &CWLoop(state->dataPlnt->PlantLoop(1)); CWLoop.Name = "ChilledWaterLoop"; - CWLoop.FluidName = "ChilledWater"; - CWLoop.FluidIndex = 1; CWLoop.FluidName = "WATER"; + CWLoop.glycol = Fluid::GetWater(*state); CWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = CWCoil.Name; CWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterCooling; CWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).NodeNumIn = CWCoil.WaterInletNodeNum; @@ -3668,14 +3621,14 @@ TEST_F(EnergyPlusFixture, FanCoil_ElecHeatCoilMultiSpeedFanCyclingFanMode) state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); state->dataSize->ZoneEqSizing.allocate(1); state->dataSize->ZoneEqSizing(state->dataSize->CurZoneEqNum).SizingMethod.allocate(HVAC::NumOfSizingTypes); state->dataSize->ZoneEqSizing(state->dataSize->CurZoneEqNum).SizingMethod = 0; state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback(1) = false; state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataSize->ZoneSizingRunDone = true; state->dataSize->FinalZoneSizing.allocate(1); auto &fZoneSizing(state->dataSize->FinalZoneSizing(1)); @@ -3763,7 +3716,6 @@ TEST_F(EnergyPlusFixture, FanCoil_ElecHeatCoilMultiSpeedFanCyclingFanMode) TEST_F(EnergyPlusFixture, FanCoil_ElecHeatCoilMultiSpeedFanContFanMode) { - int FanCoilNum(1); int ZoneNum(1); bool FirstHVACIteration(false); @@ -3779,13 +3731,11 @@ TEST_F(EnergyPlusFixture, FanCoil_ElecHeatCoilMultiSpeedFanContFanMode) state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; state->dataGlobalNames->NumCoils = 0; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->MinutesInTimeStep = 60; state->dataSize->CurZoneEqNum = 1; - InitializePsychRoutines(*state); - std::string const idf_objects = delimited_string({ " Zone,", " EAST ZONE, !- Name", @@ -3932,11 +3882,11 @@ TEST_F(EnergyPlusFixture, FanCoil_ElecHeatCoilMultiSpeedFanContFanMode) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("EAST ZONE", state->dataHeatBal->Zone(1).Name); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; GetFanCoilUnits(*state); auto &thisFanCoil(state->dataFanCoilUnits->FanCoil(1)); EXPECT_ENUM_EQ(CCM::MultiSpeedFan, thisFanCoil.CapCtrlMeth_Num); @@ -4007,9 +3957,8 @@ TEST_F(EnergyPlusFixture, FanCoil_ElecHeatCoilMultiSpeedFanContFanMode) // chilled water plant loop auto &CWLoop(state->dataPlnt->PlantLoop(1)); CWLoop.Name = "ChilledWaterLoop"; - CWLoop.FluidName = "ChilledWater"; - CWLoop.FluidIndex = 1; CWLoop.FluidName = "WATER"; + CWLoop.glycol = Fluid::GetWater(*state); CWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = CWCoil.Name; CWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterCooling; CWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).NodeNumIn = CWCoil.WaterInletNodeNum; @@ -4034,14 +3983,14 @@ TEST_F(EnergyPlusFixture, FanCoil_ElecHeatCoilMultiSpeedFanContFanMode) state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); state->dataSize->ZoneEqSizing.allocate(1); state->dataSize->ZoneEqSizing(state->dataSize->CurZoneEqNum).SizingMethod.allocate(HVAC::NumOfSizingTypes); state->dataSize->ZoneEqSizing(state->dataSize->CurZoneEqNum).SizingMethod = 0; state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback(1) = false; state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataSize->ZoneSizingRunDone = true; state->dataSize->FinalZoneSizing.allocate(1); auto &fZoneSizing(state->dataSize->FinalZoneSizing(1)); @@ -4129,7 +4078,6 @@ TEST_F(EnergyPlusFixture, FanCoil_ElecHeatCoilMultiSpeedFanContFanMode) TEST_F(EnergyPlusFixture, FanCoil_CalcFanCoilElecHeatCoilPLRResidual) { - int FanCoilNum(1); int ZoneNum(1); bool FirstHVACIteration(false); @@ -4145,13 +4093,11 @@ TEST_F(EnergyPlusFixture, FanCoil_CalcFanCoilElecHeatCoilPLRResidual) state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; state->dataGlobalNames->NumCoils = 0; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->MinutesInTimeStep = 60; state->dataSize->CurZoneEqNum = 1; - InitializePsychRoutines(*state); - std::string const idf_objects = delimited_string({ " Zone,", " EAST ZONE, !- Name", @@ -4298,11 +4244,11 @@ TEST_F(EnergyPlusFixture, FanCoil_CalcFanCoilElecHeatCoilPLRResidual) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("EAST ZONE", state->dataHeatBal->Zone(1).Name); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; GetFanCoilUnits(*state); auto &thisFanCoil(state->dataFanCoilUnits->FanCoil(1)); EXPECT_ENUM_EQ(CCM::MultiSpeedFan, thisFanCoil.CapCtrlMeth_Num); @@ -4373,9 +4319,8 @@ TEST_F(EnergyPlusFixture, FanCoil_CalcFanCoilElecHeatCoilPLRResidual) // chilled water plant loop auto &CWLoop(state->dataPlnt->PlantLoop(1)); CWLoop.Name = "ChilledWaterLoop"; - CWLoop.FluidName = "ChilledWater"; - CWLoop.FluidIndex = 1; CWLoop.FluidName = "WATER"; + CWLoop.glycol = Fluid::GetWater(*state); CWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = CWCoil.Name; CWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterCooling; CWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).NodeNumIn = CWCoil.WaterInletNodeNum; @@ -4400,14 +4345,14 @@ TEST_F(EnergyPlusFixture, FanCoil_CalcFanCoilElecHeatCoilPLRResidual) state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); state->dataSize->ZoneEqSizing.allocate(1); state->dataSize->ZoneEqSizing(state->dataSize->CurZoneEqNum).SizingMethod.allocate(HVAC::NumOfSizingTypes); state->dataSize->ZoneEqSizing(state->dataSize->CurZoneEqNum).SizingMethod = 0; state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback(1) = false; state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataSize->ZoneSizingRunDone = true; state->dataSize->FinalZoneSizing.allocate(1); auto &fZoneSizing(state->dataSize->FinalZoneSizing(1)); @@ -4474,7 +4419,6 @@ TEST_F(EnergyPlusFixture, FanCoil_CalcFanCoilElecHeatCoilPLRResidual) TEST_F(EnergyPlusFixture, FanCoil_ElectricHeatingCoilASHRAE90VariableFan) { - int FanCoilNum(1); int ZoneNum(1); bool FirstHVACIteration(false); @@ -4606,17 +4550,16 @@ TEST_F(EnergyPlusFixture, FanCoil_ElectricHeatingCoilASHRAE90VariableFan) state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; // NumCoils = 0; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->MinutesInTimeStep = 60; state->dataSize->CurZoneEqNum = 1; - InitializePsychRoutines(*state); + + state->init_state(*state); GetZoneData(*state, ErrorsFound); EXPECT_EQ("WEST ZONE", state->dataHeatBal->Zone(1).Name); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; GetFanCoilUnits(*state); auto &thisFanCoil(state->dataFanCoilUnits->FanCoil(1)); EXPECT_ENUM_EQ(CCM::ASHRAE, thisFanCoil.CapCtrlMeth_Num); @@ -4678,9 +4621,8 @@ TEST_F(EnergyPlusFixture, FanCoil_ElectricHeatingCoilASHRAE90VariableFan) // chilled water plant loop auto &CWLoop(state->dataPlnt->PlantLoop(1)); CWLoop.Name = "ChilledWaterLoop"; - CWLoop.FluidName = "ChilledWater"; - CWLoop.FluidIndex = 1; CWLoop.FluidName = "WATER"; + CWLoop.glycol = Fluid::GetWater(*state); CWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = CWCoil.Name; CWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterCooling; CWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).NodeNumIn = CWCoil.WaterInletNodeNum; @@ -4704,12 +4646,12 @@ TEST_F(EnergyPlusFixture, FanCoil_ElectricHeatingCoilASHRAE90VariableFan) state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); state->dataSize->ZoneEqSizing.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback(1) = false; state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataSize->ZoneSizingRunDone = true; state->dataGlobal->SysSizingCalc = true; thisFanCoil.DesignHeatingCapacity = 6000.0; diff --git a/tst/EnergyPlus/unit/Fans.unit.cc b/tst/EnergyPlus/unit/Fans.unit.cc index 8d4b76333a6..99f4b656a5b 100644 --- a/tst/EnergyPlus/unit/Fans.unit.cc +++ b/tst/EnergyPlus/unit/Fans.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -64,6 +64,7 @@ using namespace EnergyPlus::Fans; TEST_F(EnergyPlusFixture, Fans_FanSizing) { + // state->init_state(*state); state->dataSize->CurZoneEqNum = 0; state->dataSize->CurSysNum = 0; state->dataSize->CurOASysNum = 0; @@ -100,6 +101,7 @@ TEST_F(EnergyPlusFixture, Fans_FanSizing) TEST_F(EnergyPlusFixture, Fans_ConstantVolume_EMSPressureRiseResetTest) { + state->init_state(*state); // set standard air density state->dataEnvrn->StdRhoAir = 1.0; @@ -114,7 +116,7 @@ TEST_F(EnergyPlusFixture, Fans_ConstantVolume_EMSPressureRiseResetTest) fan1->totalEff = 1.0; fan1->motorEff = 0.8; fan1->motorInAirFrac = 1.0; - fan1->availSchedNum = 0; + fan1->availSched = Sched::GetScheduleAlwaysOff(*state); fan1->maxAirFlowRate = 1.0; fan1->minAirMassFlowRate = 0.0; fan1->maxAirMassFlowRate = fan1->maxAirFlowRate; @@ -141,8 +143,10 @@ TEST_F(EnergyPlusFixture, Fans_ConstantVolume_EMSPressureRiseResetTest) Real64 Result2_FanPower = max(0.0, fan1->maxAirMassFlowRate * fan1->EMSPressureValue / (fan1->totalEff * fan1->rhoAirStdInit)); EXPECT_DOUBLE_EQ(Result2_FanPower, fan1->totalPower); // expects zero } + TEST_F(EnergyPlusFixture, Fans_OnOff_EMSPressureRiseResetTest) { + state->init_state(*state); // set standard air density state->dataEnvrn->StdRhoAir = 1.0; // set fan model inputs @@ -157,7 +161,7 @@ TEST_F(EnergyPlusFixture, Fans_OnOff_EMSPressureRiseResetTest) fan1->totalEff = 1.0; fan1->motorEff = 0.8; fan1->motorInAirFrac = 1.0; - fan1->availSchedNum = 0; + fan1->availSched = Sched::GetScheduleAlwaysOff(*state); fan1->maxAirFlowRate = 1.0; fan1->minAirMassFlowRate = 0.0; fan1->maxAirMassFlowRate = fan1->maxAirFlowRate; @@ -186,8 +190,10 @@ TEST_F(EnergyPlusFixture, Fans_OnOff_EMSPressureRiseResetTest) Real64 Result2_FanPower = max(0.0, fan1->maxAirMassFlowRate * fan1->EMSPressureValue / (fan1->totalEff * fan1->rhoAirStdInit)); EXPECT_DOUBLE_EQ(Result2_FanPower, fan1->totalPower); // expects zero } + TEST_F(EnergyPlusFixture, Fans_VariableVolume_EMSPressureRiseResetTest) { + state->init_state(*state); // set standard air density state->dataEnvrn->StdRhoAir = 1.0; // set fan model inputs @@ -200,7 +206,7 @@ TEST_F(EnergyPlusFixture, Fans_VariableVolume_EMSPressureRiseResetTest) fan1->totalEff = 1.0; fan1->motorEff = 0.8; fan1->motorInAirFrac = 1.0; - fan1->availSchedNum = 0; + fan1->availSched = Sched::GetScheduleAlwaysOff(*state); fan1->maxAirFlowRate = 1.0; fan1->minAirMassFlowRate = 0.0; fan1->maxAirMassFlowRate = fan1->maxAirFlowRate; diff --git a/tst/EnergyPlus/unit/FaultsManager.unit.cc b/tst/EnergyPlus/unit/FaultsManager.unit.cc index ad199ffcd75..66b71072222 100644 --- a/tst/EnergyPlus/unit/FaultsManager.unit.cc +++ b/tst/EnergyPlus/unit/FaultsManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -75,7 +75,6 @@ using namespace Curve; using namespace DataLoopNode; using namespace Fans; using namespace FaultsManager; -using namespace EnergyPlus::ScheduleManager; namespace EnergyPlus { @@ -85,6 +84,7 @@ TEST_F(EnergyPlusFixture, FaultsManager_FaultFoulingAirFilters_CheckFaultyAirFil // To check whether the fan curve specified in the FaultModel:Fouling:AirFilter object // covers the rated operational point of the corresponding fan // Return true if the curve covers the fan rated operational point + state->init_state(*state); int numFans = 2; bool TestResult; @@ -218,6 +218,7 @@ TEST_F(EnergyPlusFixture, FaultsManager_FaultFoulingAirFilters_CheckFaultyAirFil // Process inputs ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataEnvrn->StdRhoAir = 1.2; @@ -305,6 +306,7 @@ TEST_F(EnergyPlusFixture, FaultsManager_FaultFoulingAirFilters_CheckFaultyAirFil // Process inputs ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataEnvrn->StdRhoAir = 1.2; @@ -343,6 +345,8 @@ TEST_F(EnergyPlusFixture, FaultsManager_FaultFoulingAirFilters_CalFaultyFanAirFl double FanDesignFlowRateDec; double FanFaultyDeltaPressInc = 0.10; // Increase by 10% + state->init_state(*state); + // Allocate state->dataCurveManager->allocateCurveVector(1); @@ -421,6 +425,7 @@ TEST_F(EnergyPlusFixture, FaultsManager_TemperatureSensorOffset_CoilSAT) // Process inputs ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // Readin inputs SetPointManager::GetSetPointManagerInputs(*state); @@ -442,6 +447,8 @@ TEST_F(EnergyPlusFixture, FaultsManager_FaultChillerSWTSensor_CalFaultChillerSWT // PURPOSE OF THIS SUBROUTINE: // To check CalFaultChillerSWT which calculates the mass flow rate and supply water temperature of a chiller with faulty SWT sensor. + state->init_state(*state); + bool FlagVariableFlow; // True if chiller is variable flow and false if it is constant flow Real64 FaultyChillerSWTOffset; // Faulty chiller SWT sensor offset Real64 Cp = 4500; // Local fluid specific heat @@ -484,12 +491,13 @@ TEST_F(EnergyPlusFixture, FaultsManager_CalFaultOffsetAct) { // PURPOSE OF THIS SUBROUTINE: // To check CalFaultOffsetAct which calculates the dynamic fault offset based on the fault availability schedule and severity schedule. + state->init_state(*state); Real64 OffsetAct; FaultProperties Fault; - Fault.availSchedNum = -1; - Fault.severitySchedNum = -1; + Fault.availSched = Sched::GetScheduleAlwaysOn(*state); + Fault.severitySched = Sched::GetScheduleAlwaysOn(*state); Fault.Offset = 10; // Run and Check @@ -611,8 +619,7 @@ TEST_F(EnergyPlusFixture, FaultsManager_EconomizerFaultGetInput) // Process inputs ASSERT_TRUE(process_idf(idf_objects)); - - ScheduleManager::ProcessScheduleInput(*state); // read schedules + state->init_state(*state); MixedAir::GetOAControllerInputs(*state); @@ -657,10 +664,14 @@ TEST_F(EnergyPlusFixture, FaultsManager_FoulingCoil_CoilNotFound) // Process inputs ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); ASSERT_THROW(FaultsManager::CheckAndReadFaults(*state), std::runtime_error); std::string const error_string = delimited_string({ + " ** Warning ** ProcessScheduleInput: Schedule:Compact = AVAILSCHED", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", " ** Severe ** FaultModel:Fouling:Coil = \"FOULEDHEATINGCOIL\". Referenced Coil named \"NON EXISTENT COOLING COIL\" was not found.", " ** Fatal ** CheckAndReadFaults: Errors found in getting FaultModel input data. Preceding condition(s) cause termination.", " ...Summary of Errors that led to program termination:", @@ -722,10 +733,14 @@ TEST_F(EnergyPlusFixture, FaultsManager_FoulingCoil_BadCoilType) // Process inputs ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); ASSERT_THROW(FaultsManager::CheckAndReadFaults(*state), std::runtime_error); std::string const error_string = delimited_string({ + " ** Warning ** ProcessScheduleInput: Schedule:Compact = AVAILSCHED", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", " ** Severe ** FaultModel:Fouling:Coil = \"FOULEDHEATINGCOIL\" invalid Coil Name = \"DETAILED PRE COOLING COIL\".", " ** ~~~ ** Coil was found but it is not one of the supported types (\"Coil:Cooling:Water\" or \"Coil:Heating:Water\").", " ** Fatal ** CheckAndReadFaults: Errors found in getting FaultModel input data. Preceding condition(s) cause termination.", @@ -839,15 +854,16 @@ TEST_F(EnergyPlusFixture, FaultsManager_FoulingCoil_AssignmentAndCalc) ASSERT_TRUE(process_idf(idf_objects)); state->dataHVACGlobal->TimeStepSys = 1; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; - state->dataGlobal->NumOfTimeStepInHour = 4; - state->dataGlobal->MinutesPerTimeStep = 60 / state->dataGlobal->NumOfTimeStepInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; + state->dataGlobal->TimeStepsInHour = 4; + state->dataGlobal->MinutesInTimeStep = 60 / state->dataGlobal->TimeStepsInHour; + + state->init_state(*state); - ScheduleManager::ProcessScheduleInput(*state); // read schedule data - int avaiSchedIndex = ScheduleManager::GetScheduleIndex(*state, "AVAILSCHED"); - EXPECT_EQ(1, avaiSchedIndex); - int severitySchedIndex = ScheduleManager::GetScheduleIndex(*state, "SEVERITYSCHED"); - EXPECT_EQ(2, severitySchedIndex); + auto *avaiSched = Sched::GetSchedule(*state, "AVAILSCHED"); + EXPECT_NE(nullptr, avaiSched); + auto *severitySched = Sched::GetSchedule(*state, "SEVERITYSCHED"); + EXPECT_NE(nullptr, severitySched); // Readin inputs // SetPointManager::GetSetPointManagerInputs(); @@ -861,7 +877,7 @@ TEST_F(EnergyPlusFixture, FaultsManager_FoulingCoil_AssignmentAndCalc) state->dataGlobal->HourOfDay = 1; state->dataEnvrn->DayOfWeek = 1; state->dataEnvrn->DayOfYear_Schedule = 1; - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); EXPECT_EQ(2, state->dataFaultsMgr->NumFouledCoil); // This should also have called WaterCoil::GetWaterCoilInput @@ -882,9 +898,9 @@ TEST_F(EnergyPlusFixture, FaultsManager_FoulingCoil_AssignmentAndCalc) EXPECT_EQ(FaultIndex, state->dataWaterCoils->WaterCoil(CoilNum).FaultyCoilFoulingIndex); // Doesn't have an Availability Schedule - EXPECT_EQ(-1, state->dataFaultsMgr->FouledCoils(FaultIndex).availSchedNum); + EXPECT_EQ(state->dataFaultsMgr->FouledCoils(FaultIndex).availSched->Num, Sched::SchedNum_AlwaysOn); // Has a Severity Schedule - EXPECT_EQ(severitySchedIndex, state->dataFaultsMgr->FouledCoils(FaultIndex).severitySchedNum); + EXPECT_NE(nullptr, state->dataFaultsMgr->FouledCoils(FaultIndex).severitySched); EXPECT_ENUM_EQ(FaultsManager::FouledCoil::UARated, state->dataFaultsMgr->FouledCoils(FaultIndex).FoulingInputMethod); EXPECT_NEAR(3.32, state->dataFaultsMgr->FouledCoils(FaultIndex).UAFouled, 0.0001); @@ -909,9 +925,9 @@ TEST_F(EnergyPlusFixture, FaultsManager_FoulingCoil_AssignmentAndCalc) EXPECT_EQ(FaultIndex, state->dataWaterCoils->WaterCoil(CoilNum).FaultyCoilFoulingIndex); // Has an Availabity Schedule - EXPECT_EQ(avaiSchedIndex, state->dataFaultsMgr->FouledCoils(FaultIndex).availSchedNum); + EXPECT_NE(nullptr, state->dataFaultsMgr->FouledCoils(FaultIndex).availSched); // Has a Severity Schedule - EXPECT_EQ(severitySchedIndex, state->dataFaultsMgr->FouledCoils(FaultIndex).severitySchedNum); + EXPECT_NE(nullptr, state->dataFaultsMgr->FouledCoils(FaultIndex).severitySched); EXPECT_ENUM_EQ(FaultsManager::FouledCoil::FoulingFactor, state->dataFaultsMgr->FouledCoils(FaultIndex).FoulingInputMethod); EXPECT_NEAR(0.0005, state->dataFaultsMgr->FouledCoils(FaultIndex).Rfw, 0.0001); diff --git a/tst/EnergyPlus/unit/FileSystem.unit.cc b/tst/EnergyPlus/unit/FileSystem.unit.cc index e3f7e732ec1..92d1b1f1bff 100644 --- a/tst/EnergyPlus/unit/FileSystem.unit.cc +++ b/tst/EnergyPlus/unit/FileSystem.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/FiniteDifferenceGroundTemperatureModel.unit.cc b/tst/EnergyPlus/unit/FiniteDifferenceGroundTemperatureModel.unit.cc index 93ae904eea1..865160c4186 100644 --- a/tst/EnergyPlus/unit/FiniteDifferenceGroundTemperatureModel.unit.cc +++ b/tst/EnergyPlus/unit/FiniteDifferenceGroundTemperatureModel.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -57,8 +57,8 @@ #include #include #include +#include #include -#include #include #include @@ -69,23 +69,23 @@ using namespace EnergyPlus; TEST_F(EnergyPlusFixture, FiniteDiffGroundTempModelTest) { - std::shared_ptr thisModel(new FiniteDiffGroundTempsModel()); + GroundTemp::FiniteDiffGroundTempsModel thisModel; - thisModel->objectType = GroundTempObjType::FiniteDiffGroundTemp; - thisModel->objectName = "Test"; - thisModel->baseConductivity = 1.08; - thisModel->baseDensity = 962.0; - thisModel->baseSpecificHeat = 2576.0; - thisModel->waterContent = 30.0 / 100.0; - thisModel->saturatedWaterContent = 50.0 / 100.0; - thisModel->evapotransCoeff = 0.408; + thisModel.modelType = GroundTemp::ModelType::FiniteDiff; + thisModel.Name = "Test"; + thisModel.baseConductivity = 1.08; + thisModel.baseDensity = 962.0; + thisModel.baseSpecificHeat = 2576.0; + thisModel.waterContent = 30.0 / 100.0; + thisModel.saturatedWaterContent = 50.0 / 100.0; + thisModel.evapotransCoeff = 0.408; - EXPECT_NEAR(2.0, thisModel->interpolate(2.0, 3.0, 1.0, 3.0, 1.0), 0.0000001); + EXPECT_NEAR(2.0, thisModel.interpolate(2.0, 3.0, 1.0, 3.0, 1.0), 0.0000001); - thisModel->developMesh(); + thisModel.developMesh(); // Setting weather data manually here - thisModel->weatherDataArray.dimension(state->dataWeather->NumDaysInYear); + thisModel.weatherDataArray.dimension(state->dataWeather->NumDaysInYear); Real64 drybulb_minTemp = 5; Real64 drybulb_amp = 10; @@ -95,7 +95,7 @@ TEST_F(EnergyPlusFixture, FiniteDiffGroundTempModelTest) Real64 solar_amp = 100; for (int day = 1; day <= state->dataWeather->NumDaysInYear; ++day) { - auto &tdwd = thisModel->weatherDataArray(day); // "This day weather data" + auto &tdwd = thisModel.weatherDataArray(day); // "This day weather data" Real64 theta = 2 * Constant::Pi * day / state->dataWeather->NumDaysInYear; Real64 omega = 2 * Constant::Pi * 130 / state->dataWeather->NumDaysInYear; // Shifts min to around the end of Jan @@ -108,56 +108,56 @@ TEST_F(EnergyPlusFixture, FiniteDiffGroundTempModelTest) tdwd.airDensity = 1.2; } - thisModel->annualAveAirTemp = 15.0; - thisModel->maxDailyAirTemp = 25.0; - thisModel->minDailyAirTemp = 5.0; - thisModel->dayOfMinDailyAirTemp = 30; + thisModel.annualAveAirTemp = 15.0; + thisModel.maxDailyAirTemp = 25.0; + thisModel.minDailyAirTemp = 5.0; + thisModel.dayOfMinDailyAirTemp = 30; - thisModel->performSimulation(*state); + thisModel.performSimulation(*state); - EXPECT_NEAR(4.51, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 1), 0.01); - EXPECT_NEAR(19.14, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 6), 0.01); - EXPECT_NEAR(7.96, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 12), 0.01); - EXPECT_NEAR(3.46, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 14), 0.01); + EXPECT_NEAR(4.51, thisModel.getGroundTempAtTimeInMonths(*state, 0.0, 1), 0.01); + EXPECT_NEAR(19.14, thisModel.getGroundTempAtTimeInMonths(*state, 0.0, 6), 0.01); + EXPECT_NEAR(7.96, thisModel.getGroundTempAtTimeInMonths(*state, 0.0, 12), 0.01); + EXPECT_NEAR(3.46, thisModel.getGroundTempAtTimeInMonths(*state, 0.0, 14), 0.01); - EXPECT_NEAR(14.36, thisModel->getGroundTempAtTimeInMonths(*state, 3.0, 1), 0.01); - EXPECT_NEAR(11.78, thisModel->getGroundTempAtTimeInMonths(*state, 3.0, 6), 0.01); - EXPECT_NEAR(15.57, thisModel->getGroundTempAtTimeInMonths(*state, 3.0, 12), 0.01); + EXPECT_NEAR(14.36, thisModel.getGroundTempAtTimeInMonths(*state, 3.0, 1), 0.01); + EXPECT_NEAR(11.78, thisModel.getGroundTempAtTimeInMonths(*state, 3.0, 6), 0.01); + EXPECT_NEAR(15.57, thisModel.getGroundTempAtTimeInMonths(*state, 3.0, 12), 0.01); - EXPECT_NEAR(14.58, thisModel->getGroundTempAtTimeInMonths(*state, 25.0, 1), 0.01); - EXPECT_NEAR(14.55, thisModel->getGroundTempAtTimeInMonths(*state, 25.0, 6), 0.01); - EXPECT_NEAR(14.53, thisModel->getGroundTempAtTimeInMonths(*state, 25.0, 12), 0.01); + EXPECT_NEAR(14.58, thisModel.getGroundTempAtTimeInMonths(*state, 25.0, 1), 0.01); + EXPECT_NEAR(14.55, thisModel.getGroundTempAtTimeInMonths(*state, 25.0, 6), 0.01); + EXPECT_NEAR(14.53, thisModel.getGroundTempAtTimeInMonths(*state, 25.0, 12), 0.01); - EXPECT_NEAR(5.04, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 0.0), 0.01); - EXPECT_NEAR(19.28, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 14342400), 0.01); - EXPECT_NEAR(7.32, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 30153600), 0.01); - EXPECT_NEAR(3.53, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 35510400), 0.01); + EXPECT_NEAR(5.04, thisModel.getGroundTempAtTimeInSeconds(*state, 0.0, 0.0), 0.01); + EXPECT_NEAR(19.28, thisModel.getGroundTempAtTimeInSeconds(*state, 0.0, 14342400), 0.01); + EXPECT_NEAR(7.32, thisModel.getGroundTempAtTimeInSeconds(*state, 0.0, 30153600), 0.01); + EXPECT_NEAR(3.53, thisModel.getGroundTempAtTimeInSeconds(*state, 0.0, 35510400), 0.01); - EXPECT_NEAR(14.36, thisModel->getGroundTempAtTimeInSeconds(*state, 3.0, 1296000), 0.01); - EXPECT_NEAR(11.80, thisModel->getGroundTempAtTimeInSeconds(*state, 3.0, 14342400), 0.01); - EXPECT_NEAR(15.46, thisModel->getGroundTempAtTimeInSeconds(*state, 3.0, 30153600), 0.01); + EXPECT_NEAR(14.36, thisModel.getGroundTempAtTimeInSeconds(*state, 3.0, 1296000), 0.01); + EXPECT_NEAR(11.80, thisModel.getGroundTempAtTimeInSeconds(*state, 3.0, 14342400), 0.01); + EXPECT_NEAR(15.46, thisModel.getGroundTempAtTimeInSeconds(*state, 3.0, 30153600), 0.01); - EXPECT_NEAR(14.52, thisModel->getGroundTempAtTimeInSeconds(*state, 25.0, 0.0), 0.01); - EXPECT_NEAR(14.55, thisModel->getGroundTempAtTimeInSeconds(*state, 25.0, 14342400), 0.01); - EXPECT_NEAR(14.52, thisModel->getGroundTempAtTimeInSeconds(*state, 25.0, 30153600), 0.01); + EXPECT_NEAR(14.52, thisModel.getGroundTempAtTimeInSeconds(*state, 25.0, 0.0), 0.01); + EXPECT_NEAR(14.55, thisModel.getGroundTempAtTimeInSeconds(*state, 25.0, 14342400), 0.01); + EXPECT_NEAR(14.52, thisModel.getGroundTempAtTimeInSeconds(*state, 25.0, 30153600), 0.01); } TEST_F(EnergyPlusFixture, FiniteDiffGroundTempModel_GetWeather_NoWeather) { - std::shared_ptr thisModel(new EnergyPlus::FiniteDiffGroundTempsModel()); + GroundTemp::FiniteDiffGroundTempsModel thisModel; - thisModel->objectType = EnergyPlus::GroundTempObjType::FiniteDiffGroundTemp; - thisModel->objectName = "Test"; - thisModel->baseConductivity = 1.08; - thisModel->baseDensity = 962.0; - thisModel->baseSpecificHeat = 2576.0; - thisModel->waterContent = 30.0 / 100.0; - thisModel->saturatedWaterContent = 50.0 / 100.0; - thisModel->evapotransCoeff = 0.408; + thisModel.modelType = GroundTemp::ModelType::FiniteDiff; + thisModel.Name = "Test"; + thisModel.baseConductivity = 1.08; + thisModel.baseDensity = 962.0; + thisModel.baseSpecificHeat = 2576.0; + thisModel.waterContent = 30.0 / 100.0; + thisModel.saturatedWaterContent = 50.0 / 100.0; + thisModel.evapotransCoeff = 0.408; // No Weather file specified, so we expect it to fail - ASSERT_THROW(thisModel->getWeatherData(*state), std::runtime_error); + ASSERT_THROW(thisModel.getWeatherData(*state), std::runtime_error); std::string const error_string = delimited_string( {" ** Severe ** Site:GroundTemperature:Undisturbed:FiniteDifference -- using this model requires specification of a weather file.", @@ -277,7 +277,7 @@ TEST_F(EnergyPlusFixture, FiniteDiffGroundTempModel_GetWeather_Weather) // Read the project data, such as Timestep state->dataGlobal->BeginSimFlag = true; SimulationManager::GetProjectData(*state); - EXPECT_EQ(state->dataGlobal->NumOfTimeStepInHour, 4); + EXPECT_EQ(state->dataGlobal->TimeStepsInHour, 4); // Needed to avoid crash in SetupSimulation (from ElectricPowerServiceManager.hh) createFacilityElectricPowerServiceObject(*state); @@ -290,19 +290,19 @@ TEST_F(EnergyPlusFixture, FiniteDiffGroundTempModel_GetWeather_Weather) EXPECT_EQ(state->dataEnvrn->TotDesDays, 2); EXPECT_EQ(state->dataWeather->TotRunPers, 1); - std::shared_ptr thisModel(new EnergyPlus::FiniteDiffGroundTempsModel()); + GroundTemp::FiniteDiffGroundTempsModel thisModel; - thisModel->objectType = EnergyPlus::GroundTempObjType::FiniteDiffGroundTemp; - thisModel->objectName = "Test"; - thisModel->baseConductivity = 1.08; - thisModel->baseDensity = 962.0; - thisModel->baseSpecificHeat = 2576.0; - thisModel->waterContent = 30.0 / 100.0; - thisModel->saturatedWaterContent = 50.0 / 100.0; - thisModel->evapotransCoeff = 0.408; + thisModel.modelType = GroundTemp::ModelType::FiniteDiff; + thisModel.Name = "Test"; + thisModel.baseConductivity = 1.08; + thisModel.baseDensity = 962.0; + thisModel.baseSpecificHeat = 2576.0; + thisModel.waterContent = 30.0 / 100.0; + thisModel.saturatedWaterContent = 50.0 / 100.0; + thisModel.evapotransCoeff = 0.408; // Shouldn't throw - thisModel->getWeatherData(*state); + thisModel.getWeatherData(*state); // It should have reverted the added period EXPECT_EQ(state->dataWeather->NumOfEnvrn, 3); @@ -310,10 +310,10 @@ TEST_F(EnergyPlusFixture, FiniteDiffGroundTempModel_GetWeather_Weather) EXPECT_EQ(state->dataWeather->TotRunPers, 1); // And should have populated a 365-day array of averages - EXPECT_EQ(365u, thisModel->weatherDataArray.size()); + EXPECT_EQ(365u, thisModel.weatherDataArray.size()); // Checking the first day against manually calculated value from EPW (24-hour averages for Jan 1) - auto &firstDay = thisModel->weatherDataArray(1); + auto &firstDay = thisModel.weatherDataArray(1); EXPECT_DOUBLE_EQ(firstDay.dryBulbTemp, -5.4); EXPECT_NEAR(firstDay.relativeHumidity, 0.7083, 0.005); EXPECT_NEAR(firstDay.windSpeed, 2.8083, 0.001); diff --git a/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc b/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc index 97f3bc54e4a..fce3bdc4901 100644 --- a/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc +++ b/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -118,8 +118,8 @@ void EnergyPlusFixture::SetUp() state->dataUtilityRoutines->outputErrorHeader = false; - Psychrometrics::InitializePsychRoutines(*state); - createCoilSelectionReportObj(*state); + state->init_constant_state(*state); + createCoilSelectionReportObj(*state); // So random state->dataEnvrn->StdRhoAir = 1.2; } @@ -136,7 +136,8 @@ void EnergyPlusFixture::TearDown() state->files.mtr.del(); state->files.bnd.del(); state->files.shade.del(); - // state->clear_state(); + + state->clear_state(); delete this->state; } @@ -217,7 +218,9 @@ bool EnergyPlusFixture::compare_err_stream_substring(std::string const &search_s { auto const stream_str = this->err_stream->str(); bool const found = stream_str.find(search_string) != std::string::npos; - EXPECT_TRUE(found); + EXPECT_TRUE(found) << "Not found in:" + << "\n" + << stream_str; if (reset_stream) this->err_stream->str(std::string()); return found; } @@ -363,7 +366,11 @@ bool EnergyPlusFixture::process_idf(std::string_view const idf_snippet, bool use inputProcessor->initializeMaps(); SimulationManager::PostIPProcessing(*state); - state->init_state(*state); + // Can't do this here because many tests set TimeStepsInHour and + // other global settings manually, and init_state() has to be + // called after those. + + // state->init_state(*state); if (state->dataSQLiteProcedures->sqlite) { bool writeOutputToSQLite = false; diff --git a/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.hh b/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.hh index 350878d18c7..e513f778303 100644 --- a/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.hh +++ b/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -152,7 +152,7 @@ protected: // This function creates a string based on a vector of string inputs that is delimited by DataStringGlobals::NL by default, but any // delimiter can be passed in to this function. This allows for cross platform output string comparisons. - std::string delimited_string(std::vector const &strings, std::string const &delimiter = "\n"); + static std::string delimited_string(std::vector const &strings, std::string const &delimiter = "\n"); // This function reads all the lines in the supplied filePath. It puts each line into the vector. std::vector read_lines_in_file(fs::path const &filePath); diff --git a/tst/EnergyPlus/unit/Fixtures/IdfParserFixture.hh b/tst/EnergyPlus/unit/Fixtures/IdfParserFixture.hh index dd341cffb8a..d479e7b7a5d 100644 --- a/tst/EnergyPlus/unit/Fixtures/IdfParserFixture.hh +++ b/tst/EnergyPlus/unit/Fixtures/IdfParserFixture.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/Fixtures/InputProcessorFixture.hh b/tst/EnergyPlus/unit/Fixtures/InputProcessorFixture.hh index 0978709e332..45a02c032cb 100644 --- a/tst/EnergyPlus/unit/Fixtures/InputProcessorFixture.hh +++ b/tst/EnergyPlus/unit/Fixtures/InputProcessorFixture.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/Fixtures/ResultsFrameworkFixture.hh b/tst/EnergyPlus/unit/Fixtures/ResultsFrameworkFixture.hh index 4fac61d9e00..1d65859938a 100644 --- a/tst/EnergyPlus/unit/Fixtures/ResultsFrameworkFixture.hh +++ b/tst/EnergyPlus/unit/Fixtures/ResultsFrameworkFixture.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/Fixtures/SQLiteFixture.hh b/tst/EnergyPlus/unit/Fixtures/SQLiteFixture.hh index ee3eb1e6c3a..851756cec11 100644 --- a/tst/EnergyPlus/unit/Fixtures/SQLiteFixture.hh +++ b/tst/EnergyPlus/unit/Fixtures/SQLiteFixture.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/FluidCoolers.unit.cc b/tst/EnergyPlus/unit/FluidCoolers.unit.cc index 63fcf45c3e8..a5afd983d70 100644 --- a/tst/EnergyPlus/unit/FluidCoolers.unit.cc +++ b/tst/EnergyPlus/unit/FluidCoolers.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -66,6 +66,7 @@ using namespace EnergyPlus::DataSizing; TEST_F(EnergyPlusFixture, TwoSpeedFluidCoolerInput_Test1) { + state->init_state(*state); using DataSizing::AutoSize; int StringArraySize = 20; @@ -136,6 +137,7 @@ TEST_F(EnergyPlusFixture, TwoSpeedFluidCoolerInput_Test1) TEST_F(EnergyPlusFixture, TwoSpeedFluidCoolerInput_Test2) { + state->init_state(*state); using DataSizing::AutoSize; int StringArraySize = 20; @@ -195,6 +197,8 @@ TEST_F(EnergyPlusFixture, TwoSpeedFluidCoolerInput_Test2) TEST_F(EnergyPlusFixture, SingleSpeedFluidCoolerInput_Test3) { + state->init_state(*state); + using DataSizing::AutoSize; int StringArraySize = 20; Array1D_string cNumericFieldNames; @@ -275,6 +279,7 @@ TEST_F(EnergyPlusFixture, SingleSpeedFluidCoolerInput_Test4) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetFluidCoolerInput(*state); auto &thisFluidCooler = state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum); @@ -285,6 +290,7 @@ TEST_F(EnergyPlusFixture, SingleSpeedFluidCoolerInput_Test4) TEST_F(EnergyPlusFixture, SingleSpeedFluidCoolerInput_Test5) { + state->init_state(*state); using DataSizing::AutoSize; int StringArraySize = 20; Array1D_string cNumericFieldNames; @@ -350,15 +356,19 @@ TEST_F(EnergyPlusFixture, SizeFunctionTestWhenPlantSizingIndexIsZero) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetFluidCoolerInput(*state); auto &thisFluidCooler = state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum); - state->dataPlnt->PlantLoop.allocate(FluidCoolerNum); + state->dataPlnt->PlantLoop.allocate(1); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); + state->dataFluidCoolers->SimpleFluidCooler.allocate(FluidCoolerNum); state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).plantLoc.loopNum = 1; - state->dataPlnt->PlantLoop(FluidCoolerNum).PlantSizNum = 0; + state->dataPlnt->PlantLoop(1).PlantSizNum = 0; EXPECT_FALSE(thisFluidCooler.HighSpeedFanPowerWasAutoSized); EXPECT_FALSE(thisFluidCooler.HighSpeedAirFlowRateWasAutoSized); @@ -386,11 +396,14 @@ TEST_F(EnergyPlusFixture, ExerciseSingleSpeedFluidCooler) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); FluidCoolerspecs *ptr = FluidCoolerspecs::factory(*state, DataPlant::PlantEquipmentType::FluidCooler_SingleSpd, "DRY COOLER"); PlantLocation pl{1, EnergyPlus::DataPlant::LoopSideLocation::Demand, 1, 1}; state->dataPlnt->PlantLoop.allocate(1); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp.allocate(1); @@ -457,11 +470,14 @@ TEST_F(EnergyPlusFixture, ExerciseTwoSpeedFluidCooler) "; !- Low Fan Speed Fan Power Sizing Factor"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); FluidCoolerspecs *ptr = FluidCoolerspecs::factory(*state, DataPlant::PlantEquipmentType::FluidCooler_TwoSpd, "BIG FLUIDCOOLER"); PlantLocation pl{1, EnergyPlus::DataPlant::LoopSideLocation::Demand, 1, 1}; state->dataPlnt->PlantLoop.allocate(1); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp.allocate(1); diff --git a/tst/EnergyPlus/unit/FluidProperties.unit.cc b/tst/EnergyPlus/unit/FluidProperties.unit.cc index 0c883e902da..629c45e697d 100644 --- a/tst/EnergyPlus/unit/FluidProperties.unit.cc +++ b/tst/EnergyPlus/unit/FluidProperties.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -62,7 +62,6 @@ using namespace EnergyPlus; TEST_F(EnergyPlusFixture, FluidProperties_GetDensityGlycol) { - std::string const idf_objects = delimited_string({"FluidProperties:GlycolConcentration,", " GLHXFluid, !- Name", " PropyleneGlycol, !- Glycol Type", @@ -72,25 +71,25 @@ TEST_F(EnergyPlusFixture, FluidProperties_GetDensityGlycol) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); - - int FluidIndex = 0; - - EXPECT_NEAR(1037.89, FluidProperties::GetDensityGlycol(*state, "GLHXFLUID", -35.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(1037.89, FluidProperties::GetDensityGlycol(*state, "GLHXFLUID", -15.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(1034.46, FluidProperties::GetDensityGlycol(*state, "GLHXFLUID", 5.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(1030.51, FluidProperties::GetDensityGlycol(*state, "GLHXFLUID", 15.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(1026.06, FluidProperties::GetDensityGlycol(*state, "GLHXFLUID", 25.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(1021.09, FluidProperties::GetDensityGlycol(*state, "GLHXFLUID", 35.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(1015.62, FluidProperties::GetDensityGlycol(*state, "GLHXFLUID", 45.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(1003.13, FluidProperties::GetDensityGlycol(*state, "GLHXFLUID", 65.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(988.60, FluidProperties::GetDensityGlycol(*state, "GLHXFLUID", 85.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(972.03, FluidProperties::GetDensityGlycol(*state, "GLHXFLUID", 105.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(953.41, FluidProperties::GetDensityGlycol(*state, "GLHXFLUID", 125.0, FluidIndex, "UnitTest"), 0.01); + state->init_state(*state); + + auto *fluid = Fluid::GetGlycol(*state, "GLHXFLUID"); + + EXPECT_NEAR(1037.89, fluid->getDensity(*state, -35.0, "UnitTest"), 0.01); + EXPECT_NEAR(1037.89, fluid->getDensity(*state, -15.0, "UnitTest"), 0.01); + EXPECT_NEAR(1034.46, fluid->getDensity(*state, 5.0, "UnitTest"), 0.01); + EXPECT_NEAR(1030.51, fluid->getDensity(*state, 15.0, "UnitTest"), 0.01); + EXPECT_NEAR(1026.06, fluid->getDensity(*state, 25.0, "UnitTest"), 0.01); + EXPECT_NEAR(1021.09, fluid->getDensity(*state, 35.0, "UnitTest"), 0.01); + EXPECT_NEAR(1015.62, fluid->getDensity(*state, 45.0, "UnitTest"), 0.01); + EXPECT_NEAR(1003.13, fluid->getDensity(*state, 65.0, "UnitTest"), 0.01); + EXPECT_NEAR(988.60, fluid->getDensity(*state, 85.0, "UnitTest"), 0.01); + EXPECT_NEAR(972.03, fluid->getDensity(*state, 105.0, "UnitTest"), 0.01); + EXPECT_NEAR(953.41, fluid->getDensity(*state, 125.0, "UnitTest"), 0.01); } TEST_F(EnergyPlusFixture, FluidProperties_GetSpecificHeatGlycol) { - std::string const idf_objects = delimited_string({"FluidProperties:GlycolConcentration,", " GLHXFluid, !- Name", " PropyleneGlycol, !- Glycol Type", @@ -101,19 +100,20 @@ TEST_F(EnergyPlusFixture, FluidProperties_GetSpecificHeatGlycol) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); - int FluidIndex = 0; - - EXPECT_NEAR(3779, FluidProperties::GetSpecificHeatGlycol(*state, "GLHXFLUID", -35.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(3779, FluidProperties::GetSpecificHeatGlycol(*state, "GLHXFLUID", -15.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(3807, FluidProperties::GetSpecificHeatGlycol(*state, "GLHXFLUID", 5.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(3834, FluidProperties::GetSpecificHeatGlycol(*state, "GLHXFLUID", 15.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(3862, FluidProperties::GetSpecificHeatGlycol(*state, "GLHXFLUID", 25.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(3889, FluidProperties::GetSpecificHeatGlycol(*state, "GLHXFLUID", 35.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(3917, FluidProperties::GetSpecificHeatGlycol(*state, "GLHXFLUID", 45.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(3972, FluidProperties::GetSpecificHeatGlycol(*state, "GLHXFLUID", 65.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(4027, FluidProperties::GetSpecificHeatGlycol(*state, "GLHXFLUID", 85.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(4082, FluidProperties::GetSpecificHeatGlycol(*state, "GLHXFLUID", 105.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(4137, FluidProperties::GetSpecificHeatGlycol(*state, "GLHXFLUID", 125.0, FluidIndex, "UnitTest"), 0.01); + state->init_state(*state); + auto *fluid = Fluid::GetGlycol(*state, "GLHXFLUID"); + + EXPECT_NEAR(3779, fluid->getSpecificHeat(*state, -35.0, "UnitTest"), 0.01); + EXPECT_NEAR(3779, fluid->getSpecificHeat(*state, -15.0, "UnitTest"), 0.01); + EXPECT_NEAR(3807, fluid->getSpecificHeat(*state, 5.0, "UnitTest"), 0.01); + EXPECT_NEAR(3834, fluid->getSpecificHeat(*state, 15.0, "UnitTest"), 0.01); + EXPECT_NEAR(3862, fluid->getSpecificHeat(*state, 25.0, "UnitTest"), 0.01); + EXPECT_NEAR(3889, fluid->getSpecificHeat(*state, 35.0, "UnitTest"), 0.01); + EXPECT_NEAR(3917, fluid->getSpecificHeat(*state, 45.0, "UnitTest"), 0.01); + EXPECT_NEAR(3972, fluid->getSpecificHeat(*state, 65.0, "UnitTest"), 0.01); + EXPECT_NEAR(4027, fluid->getSpecificHeat(*state, 85.0, "UnitTest"), 0.01); + EXPECT_NEAR(4082, fluid->getSpecificHeat(*state, 105.0, "UnitTest"), 0.01); + EXPECT_NEAR(4137, fluid->getSpecificHeat(*state, 125.0, "UnitTest"), 0.01); } TEST_F(EnergyPlusFixture, FluidProperties_InterpValuesForGlycolConc) @@ -141,13 +141,13 @@ TEST_F(EnergyPlusFixture, FluidProperties_InterpValuesForGlycolConc) Result.allocate(NumTemp); // Test interpolation for the single-concentration scenario - FluidProperties::InterpValuesForGlycolConc(*state, - NumCon, // number of concentrations (dimension of raw data) - NumTemp, // number of temperatures (dimension of raw data) - ConData, // concentrations for raw data - PropData, // raw property data (temperature,concentration) - ActCon, // concentration of actual fluid mix - Result); // interpolated output data at proper concentration + Fluid::InterpValuesForGlycolConc(*state, + NumCon, // number of concentrations (dimension of raw data) + NumTemp, // number of temperatures (dimension of raw data) + ConData, // concentrations for raw data + PropData, // raw property data (temperature,concentration) + ActCon, // concentration of actual fluid mix + Result); // interpolated output data at proper concentration EXPECT_NEAR(1020.0, Result(1), 1e-6); EXPECT_NEAR(1010.0, Result(2), 1e-6); diff --git a/tst/EnergyPlus/unit/FuelCellElectricGenerator.unit.cc b/tst/EnergyPlus/unit/FuelCellElectricGenerator.unit.cc index 340abc252a9..99ef24ea3ab 100644 --- a/tst/EnergyPlus/unit/FuelCellElectricGenerator.unit.cc +++ b/tst/EnergyPlus/unit/FuelCellElectricGenerator.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -77,7 +77,6 @@ using namespace EnergyPlus; TEST_F(EnergyPlusFixture, FuelCellTest) { - std::string const idf_objects = delimited_string({ "Material,", @@ -794,6 +793,7 @@ TEST_F(EnergyPlusFixture, FuelCellTest) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); + state->init_state(*state); SimulationManager::ManageSimulation(*state); EXPECT_TRUE(has_err_output(true)); @@ -813,8 +813,7 @@ TEST_F(EnergyPlusFixture, FuelCellTest) EXPECT_EQ("GENERATOR FUEL CELL EXHAUST GAS TO WATER HEAT EXCHANGER 1", generatorController->compPlantName); EXPECT_EQ(0, generatorController->generatorIndex); - EXPECT_EQ("ALWAYS ON DISCRETE", generatorController->availSched); - EXPECT_GT(generatorController->availSchedPtr, 0); + EXPECT_EQ("ALWAYS ON DISCRETE", generatorController->availSched->Name); EXPECT_EQ(0, generatorController->nominalThermElectRatio); @@ -923,7 +922,7 @@ TEST_F(EnergyPlusFixture, FuelCellTest) EXPECT_ENUM_EQ(DataGenerators::WaterTemperatureMode::WaterInReformSchedule, waterSup.WaterTempMode); - ASSERT_GT(waterSup.SchedNum, 0); + ASSERT_NE(waterSup.sched, nullptr); // Auxiliary Heater EXPECT_EQ("GENERATOR FUEL CELL AUXILIARY HEATER 1", thisFC->NameFCAuxilHeat); @@ -1020,7 +1019,6 @@ TEST_F(EnergyPlusFixture, FuelCellTest) TEST_F(EnergyPlusFixture, DISABLED_FuelCellTest_Zero_Cp_Fix) { // state->clear_state(); - std::string const idf_objects = delimited_string({ "Material,", @@ -1740,6 +1738,8 @@ TEST_F(EnergyPlusFixture, DISABLED_FuelCellTest_Zero_Cp_Fix) process_err = has_err_output(true); EXPECT_FALSE(process_err); + state->init_state(*state); + SimulationManager::ManageSimulation(*state); bool simulation_err(false); simulation_err = has_err_output(false); @@ -1760,8 +1760,7 @@ TEST_F(EnergyPlusFixture, DISABLED_FuelCellTest_Zero_Cp_Fix) EXPECT_EQ("GENERATOR FUEL CELL EXHAUST GAS TO WATER HEAT EXCHANGER 1", generatorController->compPlantName); EXPECT_EQ(0, generatorController->generatorIndex); - EXPECT_EQ("ALWAYS ON DISCRETE", generatorController->availSched); - EXPECT_GT(generatorController->availSchedPtr, 0); + EXPECT_EQ("ALWAYS ON DISCRETE", generatorController->availSched->Name); EXPECT_EQ(0, generatorController->nominalThermElectRatio); @@ -1870,7 +1869,7 @@ TEST_F(EnergyPlusFixture, DISABLED_FuelCellTest_Zero_Cp_Fix) EXPECT_ENUM_EQ(DataGenerators::WaterTemperatureMode::WaterInReformSchedule, waterSup.WaterTempMode); - ASSERT_GT(waterSup.SchedNum, 0); + ASSERT_NE(waterSup.sched, nullptr); // Auxiliary Heater EXPECT_EQ("GENERATOR FUEL CELL AUXILIARY HEATER 1", thisFC->NameFCAuxilHeat); diff --git a/tst/EnergyPlus/unit/Furnaces.unit.cc b/tst/EnergyPlus/unit/Furnaces.unit.cc index c98b7c9e906..df77516cd12 100644 --- a/tst/EnergyPlus/unit/Furnaces.unit.cc +++ b/tst/EnergyPlus/unit/Furnaces.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -77,7 +77,6 @@ using namespace EnergyPlus; using namespace EnergyPlus::Furnaces; using namespace EnergyPlus::DataLoopNode; using namespace DataZoneEnergyDemands; -using namespace ScheduleManager; using namespace EnergyPlus::DataAirLoop; using namespace EnergyPlus::OutputProcessor; using namespace EnergyPlus::SimulationManager; @@ -93,7 +92,6 @@ TEST_F(EnergyPlusFixture, SetVSHPAirFlowTest_VSFurnaceFlowTest) Real64 PartLoadRatio(1.0); state->dataLoopNodes->Node.allocate(10); state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); - state->dataScheduleMgr->Schedule.allocate(1); state->dataHVACGlobal->MSHPMassFlowRateLow = 0.0; state->dataHVACGlobal->MSHPMassFlowRateHigh = 0.0; @@ -117,7 +115,7 @@ TEST_F(EnergyPlusFixture, SetVSHPAirFlowTest_VSFurnaceFlowTest) state->dataFurnaces->Furnace(FurnaceNum).LastMode = Furnaces::ModeOfOperation::HeatingMode; state->dataFurnaces->Furnace(FurnaceNum).IdleMassFlowRate = 0.2; state->dataFurnaces->Furnace(FurnaceNum).IdleSpeedRatio = 0.2; - state->dataFurnaces->Furnace(FurnaceNum).FanAvailSchedPtr = ScheduleManager::ScheduleAlwaysOn; + state->dataFurnaces->Furnace(FurnaceNum).fanAvailSched = Sched::GetScheduleAlwaysOn(*state); state->dataFurnaces->Furnace(FurnaceNum).FurnaceInletNodeNum = 1; state->dataFurnaces->Furnace(FurnaceNum).HeatMassFlowRate(1) = 0.25; @@ -142,7 +140,8 @@ TEST_F(EnergyPlusFixture, SetVSHPAirFlowTest_VSFurnaceFlowTest) state->dataFurnaces->Furnace(FurnaceNum).NumOfSpeedHeating = 0; state->dataFurnaces->Furnace(FurnaceNum).NumOfSpeedCooling = 0; // Furnace( FurnaceNum ).SchedPtr = 0; // denotes incorrect schedule name in Furnace input ( returns 0.0 ) - state->dataFurnaces->Furnace(FurnaceNum).SchedPtr = -1; // denotes missing schedule name in Furnace input ( returns 1.0 ) + state->dataFurnaces->Furnace(FurnaceNum).availSched = + Sched::GetScheduleAlwaysOn(*state); // denotes missing schedule name in Furnace input ( returns 1.0 ) state->dataFurnaces->HeatingLoad = true; state->dataFurnaces->CoolingLoad = false; SetVSHPAirFlow(*state, FurnaceNum, PartLoadRatio, OnOffAirFlowRatio); @@ -327,11 +326,11 @@ TEST_F(EnergyPlusFixture, SetVSHPAirFlowTest_VSFurnaceFlowTest) } state->dataPlnt->PlantLoop(1).Name = "Hot Water Loop"; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).Name = "Chilled Water Loop"; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWAHPCoolingEquationFit; @@ -1186,6 +1185,7 @@ TEST_F(EnergyPlusFixture, UnitaryHeatPumpAirToAir_MaxSuppAirTempTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); int CompIndex(0); int AirLoopNum(1); @@ -1234,10 +1234,10 @@ TEST_F(EnergyPlusFixture, Furnaces_SetMinOATCompressor) state->dataHVACAssistedCC->HXAssistedCoil(1).CoolingCoilType = "COIL:COOLING:DX"; state->dataHVACAssistedCC->HXAssistedCoil(1).CoolingCoilName = "Dummy_Name"; - state->dataCoilCooingDX->coilCoolingDXGetInputFlag = false; + state->dataCoilCoolingDX->coilCoolingDXGetInputFlag = false; CoilCoolingDX thisCoil; thisCoil.name = "Dummy_Name"; - state->dataCoilCooingDX->coilCoolingDXs.push_back(thisCoil); + state->dataCoilCoolingDX->coilCoolingDXs.push_back(thisCoil); int FurnaceNum = 1; std::string cCurModObj = "Furnace_Test"; diff --git a/tst/EnergyPlus/unit/General.unit.cc b/tst/EnergyPlus/unit/General.unit.cc index d95e697f7a0..fe0226081ff 100644 --- a/tst/EnergyPlus/unit/General.unit.cc +++ b/tst/EnergyPlus/unit/General.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/GeneralRoutines.unit.cc b/tst/EnergyPlus/unit/GeneralRoutines.unit.cc index 78c826df9d1..5556cc928f9 100644 --- a/tst/EnergyPlus/unit/GeneralRoutines.unit.cc +++ b/tst/EnergyPlus/unit/GeneralRoutines.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/GroundHeatExchangers.unit.cc b/tst/EnergyPlus/unit/GroundHeatExchangers.unit.cc index cbb8b7c7eb3..647b4af1713 100644 --- a/tst/EnergyPlus/unit/GroundHeatExchangers.unit.cc +++ b/tst/EnergyPlus/unit/GroundHeatExchangers.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -71,12 +71,10 @@ using namespace EnergyPlus::DataSurfaces; using namespace EnergyPlus::GroundHeatExchangers; using namespace EnergyPlus::HeatBalanceManager; using namespace EnergyPlus::SizingManager; -using namespace EnergyPlus::ScheduleManager; using namespace EnergyPlus::PlantManager; TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_Interpolate) { - // Initialization GLHESlinky thisGLHE; Real64 thisLNTTS; @@ -87,13 +85,12 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_Interpolate) std::shared_ptr thisRF(new GLHEResponseFactors); thisGLHE.myRespFactors = thisRF; - thisGLHE.myRespFactors->LNTTS.allocate(NPairs); - thisGLHE.myRespFactors->GFNC.allocate(NPairs); + thisGLHE.myRespFactors->GFNC = std::vector(NPairs); - thisGLHE.myRespFactors->LNTTS(1) = 0.0; - thisGLHE.myRespFactors->LNTTS(2) = 5.0; - thisGLHE.myRespFactors->GFNC(1) = 0.0; - thisGLHE.myRespFactors->GFNC(2) = 5.0; + thisGLHE.myRespFactors->LNTTS.push_back(0.0); + thisGLHE.myRespFactors->LNTTS.push_back(5.0); + thisGLHE.myRespFactors->GFNC[0] = 0.0; + thisGLHE.myRespFactors->GFNC[1] = 5.0; // Case when extrapolating beyond lower bound thisLNTTS = -1.0; @@ -124,13 +121,12 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_Slinky_GetGFunc) std::shared_ptr thisRF(new GLHEResponseFactors); thisGLHE.myRespFactors = thisRF; - thisGLHE.myRespFactors->LNTTS.allocate(NPairs); - thisGLHE.myRespFactors->GFNC.allocate(NPairs); + thisGLHE.myRespFactors->GFNC = std::vector(NPairs); - thisGLHE.myRespFactors->LNTTS(1) = 0.0; - thisGLHE.myRespFactors->LNTTS(2) = 5.0; - thisGLHE.myRespFactors->GFNC(1) = 0.0; - thisGLHE.myRespFactors->GFNC(2) = 5.0; + thisGLHE.myRespFactors->LNTTS.push_back(0.0); + thisGLHE.myRespFactors->LNTTS.push_back(5.0); + thisGLHE.myRespFactors->GFNC[0] = 0.0; + thisGLHE.myRespFactors->GFNC[1] = 5.0; time = std::pow(10.0, 2.5); @@ -152,13 +148,12 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_GetGFunc) std::shared_ptr thisRF(new GLHEResponseFactors); thisGLHE.myRespFactors = thisRF; - thisGLHE.myRespFactors->LNTTS.allocate(NPairs); - thisGLHE.myRespFactors->GFNC.allocate(NPairs); + thisGLHE.myRespFactors->GFNC = std::vector(NPairs); - thisGLHE.myRespFactors->LNTTS(1) = 0.0; - thisGLHE.myRespFactors->LNTTS(2) = 5.0; - thisGLHE.myRespFactors->GFNC(1) = 0.0; - thisGLHE.myRespFactors->GFNC(2) = 5.0; + thisGLHE.myRespFactors->LNTTS.push_back(0.0); + thisGLHE.myRespFactors->LNTTS.push_back(5.0); + thisGLHE.myRespFactors->GFNC[0] = 0.0; + thisGLHE.myRespFactors->GFNC[1] = 5.0; time = std::pow(2.7182818284590452353602874, 2.5); @@ -186,7 +181,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_Slinky_CalcHXResistance) thisGLHE.plantLoc.loopNum = 1; state->dataPlnt->PlantLoop(thisGLHE.plantLoc.loopNum).FluidName = "WATER"; - state->dataPlnt->PlantLoop(thisGLHE.plantLoc.loopNum).FluidIndex = 1; + state->dataPlnt->PlantLoop(thisGLHE.plantLoc.loopNum).glycol = Fluid::GetWater(*state); thisGLHE.inletTemp = 5.0; thisGLHE.massFlowRate = 0.01; @@ -236,12 +231,12 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_Slinky_CalcGroundHeatExchanger // Horizontal G-Functions thisGLHE.calcGFunctions(*state); - EXPECT_NEAR(19.08237, thisGLHE.myRespFactors->GFNC(28), 0.0001); + EXPECT_NEAR(19.08237, thisGLHE.myRespFactors->GFNC[27], 0.0001); // Vertical G-Functions thisGLHE.verticalConfig = true; thisGLHE.calcGFunctions(*state); - EXPECT_NEAR(18.91819, thisGLHE.myRespFactors->GFNC(28), 0.0001); + EXPECT_NEAR(18.91819, thisGLHE.myRespFactors->GFNC[27], 0.0001); } TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_Properties_IDF_Check) @@ -528,10 +523,10 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_Resp_Factors_IDF_Check) EXPECT_EQ(4, thisRF->numBoreholes); EXPECT_EQ(0.00043, thisRF->gRefRatio); EXPECT_EQ(76, thisRF->numGFuncPairs); - EXPECT_EQ(-15.585075, thisRF->LNTTS(1)); - EXPECT_EQ(-2.672011, thisRF->GFNC(1)); - EXPECT_EQ(3.003000, thisRF->LNTTS(76)); - EXPECT_EQ(12.778359, thisRF->GFNC(76)); + EXPECT_EQ(-15.585075, thisRF->LNTTS[0]); + EXPECT_EQ(-2.672011, thisRF->GFNC[0]); + EXPECT_EQ(3.003000, thisRF->LNTTS[75]); + EXPECT_EQ(12.778359, thisRF->GFNC[75]); } TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_Resp_Factors_Mismatched_Pairs) @@ -942,6 +937,12 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_Given_Single_BHs_IDF_Ch " 5.5, !- X Location {m}", " 5.5; !- Y Location {m}", + "GroundHeatExchanger:Vertical:Single,", + " UNUSED, !- Name", + " GHE-1 Props, !- GHE Properties", + " 8.0, !- X Location {m}", + " 8.0; !- Y Location {m}", + "GroundHeatExchanger:System,", " Vertical GHE 1x4 Std, !- Name", " GHLE Inlet, !- Inlet Node Name", @@ -964,7 +965,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_Given_Single_BHs_IDF_Ch GetGroundHeatExchangerInput(*state); EXPECT_EQ(2u, state->dataGroundHeatExchanger->vertPropsVector.size()); - EXPECT_EQ(4u, state->dataGroundHeatExchanger->singleBoreholesVector.size()); + EXPECT_EQ(5u, state->dataGroundHeatExchanger->singleBoreholesVector.size()); EXPECT_EQ(1u, state->dataGroundHeatExchanger->verticalGLHE.size()); auto &thisGLHE(state->dataGroundHeatExchanger->verticalGLHE[0]); @@ -979,6 +980,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_Given_Single_BHs_IDF_Ch EXPECT_EQ(100, thisGLHE.bhLength); EXPECT_EQ(0.04556, thisGLHE.bhUTubeDist); EXPECT_EQ(0, thisGLHE.myRespFactors->maxSimYears); + EXPECT_EQ(4, thisGLHE.myRespFactors->numBoreholes); EXPECT_EQ(400, thisGLHE.totalTubeLength); EXPECT_EQ(thisGLHE.soil.k / thisGLHE.soil.rhoCp, thisGLHE.soil.diffusivity); } @@ -1280,8 +1282,8 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcGFunction_UHF) // Setup ASSERT_TRUE(process_idf(idf_objects)); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->init_state(*state); + GetPlantLoopData(*state); GetPlantInput(*state); SetupInitialPlantCallingOrder(*state); @@ -1340,9 +1342,8 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcGFunction_UHF) TEST_F(EnergyPlusFixture, GHE_InterpTest1) { std::shared_ptr thisRF(new GroundHeatExchangers::GLHEResponseFactors()); - thisRF->LNTTS.allocate(11); - thisRF->GFNC.allocate(11); - thisRF->LNTTS = {-5.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0}; + thisRF->GFNC = std::vector(11); + thisRF->LNTTS = std::vector{-5.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0}; thisRF->GFNC = {0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0}; GroundHeatExchangers::GLHEVert thisGHE = GroundHeatExchangers::GLHEVert(); @@ -1395,9 +1396,8 @@ TEST_F(EnergyPlusFixture, GHE_InterpTest1) TEST_F(EnergyPlusFixture, GHE_InterpTest2) { std::shared_ptr thisRF(new GroundHeatExchangers::GLHEResponseFactors()); - thisRF->LNTTS.allocate(8); - thisRF->GFNC.allocate(8); - thisRF->LNTTS = {-15.2202, -15.083, -14.9459, -14.8087, -14.6716, -14.5344, -14.3973, -14.2601}; + thisRF->GFNC = std::vector(8); + thisRF->LNTTS = std::vector{-15.2202, -15.083, -14.9459, -14.8087, -14.6716, -14.5344, -14.3973, -14.2601}; thisRF->GFNC = {-2.55692, -2.48389, -2.40819, -2.32936, -2.24715, -2.16138, -2.07195, -1.97882}; GroundHeatExchangers::GLHEVert thisGHE = GroundHeatExchangers::GLHEVert(); @@ -1734,8 +1734,8 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcGFunction_UBHWT) // Setup ASSERT_TRUE(process_idf(idf_objects)); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->init_state(*state); + GetPlantLoopData(*state); GetPlantInput(*state); SetupInitialPlantCallingOrder(*state); @@ -1841,6 +1841,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calc_pipe_conduction_re state->dataSysVars->DisableGLHECaching = true; ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetGroundHeatExchangerInput(*state); @@ -1903,6 +1904,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_friction_factor) // Setup ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetGroundHeatExchangerInput(*state); @@ -2219,8 +2221,8 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calc_pipe_convection_re // Setup ASSERT_TRUE(process_idf(idf_objects)); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->init_state(*state); + GetPlantLoopData(*state); GetPlantInput(*state); SetupInitialPlantCallingOrder(*state); @@ -2524,8 +2526,8 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calc_pipe_resistance) // Setup ASSERT_TRUE(process_idf(idf_objects)); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->init_state(*state); + GetPlantLoopData(*state); GetPlantInput(*state); SetupInitialPlantCallingOrder(*state); @@ -2821,8 +2823,8 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcBHGroutResistance_1 // Setup ASSERT_TRUE(process_idf(idf_objects)); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->init_state(*state); + GetPlantLoopData(*state); GetPlantInput(*state); SetupInitialPlantCallingOrder(*state); @@ -3120,8 +3122,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcBHGroutResistance_2 // Setup ASSERT_TRUE(process_idf(idf_objects)); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->init_state(*state); GetPlantLoopData(*state); GetPlantInput(*state); SetupInitialPlantCallingOrder(*state); @@ -3419,8 +3420,8 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcBHGroutResistance_3 // Setup ASSERT_TRUE(process_idf(idf_objects)); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->init_state(*state); + GetPlantLoopData(*state); GetPlantInput(*state); SetupInitialPlantCallingOrder(*state); @@ -3718,8 +3719,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcBHTotalInternalResi // Setup ASSERT_TRUE(process_idf(idf_objects)); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->init_state(*state); GetPlantLoopData(*state); GetPlantInput(*state); SetupInitialPlantCallingOrder(*state); @@ -4017,8 +4017,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcBHTotalInternalResi // Setup ASSERT_TRUE(process_idf(idf_objects)); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->init_state(*state); GetPlantLoopData(*state); GetPlantInput(*state); SetupInitialPlantCallingOrder(*state); @@ -4316,8 +4315,8 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcBHTotalInternalResi // Setup ASSERT_TRUE(process_idf(idf_objects)); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->init_state(*state); + GetPlantLoopData(*state); GetPlantInput(*state); SetupInitialPlantCallingOrder(*state); @@ -4389,6 +4388,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_GetVertProps) // Setup ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetGroundHeatExchangerInput(*state); @@ -4468,6 +4468,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_GetSingleBH) // Setup ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetGroundHeatExchangerInput(*state); @@ -4541,6 +4542,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_GetVertArray) // Setup ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetGroundHeatExchangerInput(*state); @@ -4626,6 +4628,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_GetResponseFactor) // Setup ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetGroundHeatExchangerInput(*state); diff --git a/tst/EnergyPlus/unit/HVACControllers.unit.cc b/tst/EnergyPlus/unit/HVACControllers.unit.cc index d5888fb831b..8194208298a 100644 --- a/tst/EnergyPlus/unit/HVACControllers.unit.cc +++ b/tst/EnergyPlus/unit/HVACControllers.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -71,7 +71,6 @@ using namespace EnergyPlus::MixedAir; using namespace EnergyPlus::HVACControllers; -using namespace EnergyPlus::ScheduleManager; using namespace EnergyPlus::SetPointManager; using namespace EnergyPlus::WaterCoils; @@ -130,6 +129,7 @@ TEST_F(EnergyPlusFixture, HVACControllers_ResetHumidityRatioCtrlVarType) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetSetPointManagerInputs(*state); // check specified control variable type is "HumidityRatio" @@ -206,6 +206,7 @@ TEST_F(EnergyPlusFixture, HVACControllers_TestTempAndHumidityRatioCtrlVarType) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetSetPointManagerInputs(*state); // check specified control variable type is "HumidityRatio" @@ -257,6 +258,8 @@ TEST_F(EnergyPlusFixture, HVACControllers_TestTempAndHumidityRatioCtrlVarType) state->dataPlnt->PlantLoop.allocate(1); state->dataPlnt->TotNumLoops = 1; + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -346,6 +349,7 @@ TEST_F(EnergyPlusFixture, HVACControllers_SchSetPointMgrsOrderTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetSetPointManagerInputs(*state); // There are two setpoint managers and are schedule type @@ -410,6 +414,7 @@ TEST_F(EnergyPlusFixture, HVACControllers_WaterCoilOnPrimaryLoopCheckTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetControllerInput(*state); @@ -503,6 +508,7 @@ TEST_F(EnergyPlusFixture, HVACControllers_WaterCoilOnOutsideAirSystemCheckTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetControllerInput(*state); @@ -635,6 +641,7 @@ TEST_F(EnergyPlusFixture, HVACControllers_CoilSystemCoolingWaterOnOutsideAirSyst }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetControllerInput(*state); @@ -842,7 +849,7 @@ TEST_F(EnergyPlusFixture, HVACControllers_BlankAutosized) }); ASSERT_TRUE(process_idf(idf_objects)); - + state->init_state(*state); GetSetPointManagerInputs(*state); GetControllerInput(*state); @@ -917,6 +924,7 @@ TEST_F(EnergyPlusFixture, HVACControllers_MaxFlowZero) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetSetPointManagerInputs(*state); @@ -965,8 +973,8 @@ TEST_F(EnergyPlusFixture, HVACControllers_MaxFlowZero) state->dataPlnt->TotNumLoops = 1; state->dataPlnt->PlantLoop(1).Name = "CHW LOOP"; state->dataPlnt->PlantLoop(1).PlantSizNum = 1; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); diff --git a/tst/EnergyPlus/unit/HVACCooledBeam.unit.cc b/tst/EnergyPlus/unit/HVACCooledBeam.unit.cc index 82dabd45c5b..4d2c81f6a45 100644 --- a/tst/EnergyPlus/unit/HVACCooledBeam.unit.cc +++ b/tst/EnergyPlus/unit/HVACCooledBeam.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -72,11 +72,8 @@ TEST_F(EnergyPlusFixture, HVACCooledBeam_reportTerminalUnit) SetPredefinedTables(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; - auto &sch = state->dataScheduleMgr->Schedule; - sch.allocate(5); - sch(1).Name = "schA"; - sch(2).Name = "schB"; + auto *schedA = Sched::AddScheduleConstant(*state, "schA"); + auto *schedB = Sched::AddScheduleConstant(*state, "schB"); auto &adu = state->dataDefineEquipment->AirDistUnit; adu.allocate(2); diff --git a/tst/EnergyPlus/unit/HVACDXHeatPumpSystem.unit.cc b/tst/EnergyPlus/unit/HVACDXHeatPumpSystem.unit.cc index 5a7e04344cd..ddbb9503590 100644 --- a/tst/EnergyPlus/unit/HVACDXHeatPumpSystem.unit.cc +++ b/tst/EnergyPlus/unit/HVACDXHeatPumpSystem.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -100,6 +100,7 @@ TEST_F(EnergyPlusFixture, ExerciseHVACDXHeatPumpSystem) " Heat Pump 1 Evaporator Node; !- Evaporator Air Inlet Node Name"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataLoopNodes->NodeID.allocate(2); state->dataLoopNodes->Node.allocate(2); @@ -109,6 +110,7 @@ TEST_F(EnergyPlusFixture, ExerciseHVACDXHeatPumpSystem) state->dataDXCoils->GetCoilsInputFlag = false; state->dataDXCoils->DXCoil.allocate(1); state->dataDXCoils->DXCoil(1).Name = "HEAT PUMP DX HEATING COIL 1"; + state->dataDXCoils->DXCoil(1).availSched = Sched::GetScheduleAlwaysOn(*state); state->dataDXCoils->DXCoil(1).AirInNode = 1; state->dataDXCoils->DXCoil(1).AirOutNode = 2; state->dataDXCoils->DXCoil(1).DXCoilType = "COIL:HEATING:DX:SINGLESPEED"; diff --git a/tst/EnergyPlus/unit/HVACDXSystem.unit.cc b/tst/EnergyPlus/unit/HVACDXSystem.unit.cc index 9aa801a79fe..15a67a1d6ae 100644 --- a/tst/EnergyPlus/unit/HVACDXSystem.unit.cc +++ b/tst/EnergyPlus/unit/HVACDXSystem.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -422,10 +422,11 @@ TEST_F(EnergyPlusFixture, VariableSpeedCoils_DOASDXCoilTest) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + state->dataZoneEquip->ZoneEquipInputsFilled = true; - ScheduleManager::ProcessScheduleInput(*state); std::string compName = "DX COOLING COIL SYSTEM"; bool zoneEquipment = false; @@ -556,10 +557,11 @@ TEST_F(EnergyPlusFixture, VariableSpeedCoils_RHControl) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); std::string compName = "DX COOLING COIL SYSTEM"; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; state->dataZoneEquip->ZoneEquipInputsFilled = true; state->dataGlobal->NumOfZones = 1; state->dataZoneEquip->ZoneEquipConfig.allocate(1); @@ -577,8 +579,7 @@ TEST_F(EnergyPlusFixture, VariableSpeedCoils_RHControl) state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = compName; state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).CompType_Num = SimAirServingZones::CompType::DXSystem; OutputReportPredefined::SetPredefinedTables(*state); - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager + Sched::GetSchedule(*state, "AVAILSCHED")->currentVal = 1.0; // Enable schedule without calling schedule manager bool FirstHVACIteration = true; bool HXUnitOn = false; @@ -755,10 +756,11 @@ TEST_F(EnergyPlusFixture, VariableSpeedCoils_LatentDegradation_Test) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); std::string compName = "DX COOLING COIL SYSTEM"; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; state->dataZoneEquip->ZoneEquipInputsFilled = true; state->dataGlobal->NumOfZones = 1; state->dataZoneEquip->ZoneEquipConfig.allocate(1); @@ -776,8 +778,7 @@ TEST_F(EnergyPlusFixture, VariableSpeedCoils_LatentDegradation_Test) state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = compName; state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).CompType_Num = SimAirServingZones::CompType::DXSystem; OutputReportPredefined::SetPredefinedTables(*state); - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager + Sched::GetSchedule(*state, "AVAILSCHED")->currentVal = 1.0; // Enable schedule without calling schedule manager bool FirstHVACIteration = true; bool HXUnitOn = false; @@ -1029,10 +1030,11 @@ TEST_F(EnergyPlusFixture, NewDXCoilModel_RHControl) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); std::string compName = "DX COOLING COIL SYSTEM"; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; state->dataZoneEquip->ZoneEquipInputsFilled = true; state->dataGlobal->NumOfZones = 1; state->dataZoneEquip->ZoneEquipConfig.allocate(1); @@ -1051,8 +1053,7 @@ TEST_F(EnergyPlusFixture, NewDXCoilModel_RHControl) state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = compName; state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).CompType_Num = SimAirServingZones::CompType::DXSystem; OutputReportPredefined::SetPredefinedTables(*state); - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager + Sched::GetSchedule(*state, "AVAILSCHED")->currentVal = 1.0; // Enable schedule without calling schedule manager bool FirstHVACIteration = true; bool HXUnitOn = false; diff --git a/tst/EnergyPlus/unit/HVACFan.unit.cc b/tst/EnergyPlus/unit/HVACFan.unit.cc index 5303e1b3be6..191027f9a64 100644 --- a/tst/EnergyPlus/unit/HVACFan.unit.cc +++ b/tst/EnergyPlus/unit/HVACFan.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -91,6 +91,8 @@ TEST_F(EnergyPlusFixture, SystemFanObj_TestGetFunctions1) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + Fans::GetFanInput(*state); state->dataSize->CurZoneEqNum = 0; state->dataSize->CurSysNum = 0; @@ -136,6 +138,9 @@ TEST_F(EnergyPlusFixture, SystemFanObj_FanSizing1) }); ASSERT_TRUE(process_idf(idf_objects)); + + state->init_state(*state); + state->dataEnvrn->StdRhoAir = 1.0; Fans::GetFanInput(*state); state->dataSize->CurZoneEqNum = 0; @@ -189,6 +194,8 @@ TEST_F(EnergyPlusFixture, SystemFanObj_TwoSpeedFanPowerCalc1) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + Fans::GetFanInput(*state); state->dataSize->CurZoneEqNum = 0; state->dataSize->CurSysNum = 0; @@ -263,6 +270,9 @@ TEST_F(EnergyPlusFixture, SystemFanObj_TwoSpeedFanPowerCalc2) }); ASSERT_TRUE(process_idf(idf_objects)); + + state->init_state(*state); + Curve::GetCurveInput(*state); Fans::GetFanInput(*state); state->dataSize->CurZoneEqNum = 0; @@ -326,6 +336,8 @@ TEST_F(EnergyPlusFixture, SystemFanObj_TwoSpeedFanPowerCalc3) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + Fans::GetFanInput(*state); state->dataSize->CurZoneEqNum = 0; state->dataSize->CurSysNum = 0; @@ -427,6 +439,9 @@ TEST_F(EnergyPlusFixture, SystemFanObj_TwoSpeedFanPowerCalc4) }); ASSERT_TRUE(process_idf(idf_objects)); + + state->init_state(*state); + Curve::GetCurveInput(*state); Fans::GetFanInput(*state); state->dataSize->CurZoneEqNum = 0; @@ -588,6 +603,8 @@ TEST_F(EnergyPlusFixture, SystemFanObj_DiscreteMode_noPowerFFlowCurve) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + Fans::GetFanInput(*state); state->dataSize->CurZoneEqNum = 0; state->dataSize->CurSysNum = 0; @@ -688,6 +705,7 @@ TEST_F(EnergyPlusFixture, SystemFanObj_DiscreteMode_EMSPressureRiseResetTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); EMSManager::CheckIfAnyEMS(*state); state->dataEMSMgr->FinishProcessingUserInput = true; diff --git a/tst/EnergyPlus/unit/HVACFourPipeBeam.unit.cc b/tst/EnergyPlus/unit/HVACFourPipeBeam.unit.cc index d966115504b..ca2d4226d9a 100644 --- a/tst/EnergyPlus/unit/HVACFourPipeBeam.unit.cc +++ b/tst/EnergyPlus/unit/HVACFourPipeBeam.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -211,6 +211,8 @@ TEST_F(EnergyPlusFixture, Beam_FactoryAllAutosize) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + state->dataGlobal->NumOfZones = 1; state->dataHeatBal->Zone.allocate(state->dataGlobal->NumOfZones); @@ -308,13 +310,6 @@ TEST_F(EnergyPlusFixture, Beam_sizeandSimulateOneZone) " 4, !- Upper Limit Value", " DISCRETE; !- Numeric Type", - " Schedule:Compact,", - " ALWAYS_ON, !- Name", - " On/Off, !- Schedule Type Limits Name", - " Through: 12/31, !- Field 1", - " For: AllDays, !- Field 2", - " Until: 24:00,1; !- Field 3", - " Schedule:Compact,", " ACTIVITY_SCH, !- Name", " Any Number, !- Schedule Type Limits Name", @@ -902,7 +897,7 @@ TEST_F(EnergyPlusFixture, Beam_sizeandSimulateOneZone) " Fan:VariableVolume,", " CV_1_Fan, !- Name", - " always_on, !- Availability Schedule Name", + " CONSTANT-1.0, !- Availability Schedule Name", " 0.6045, !- Fan Total Efficiency", " 1017.592, !- Pressure Rise {Pa}", " AUTOSIZE, !- Maximum Flow Rate {m3/s}", @@ -922,7 +917,7 @@ TEST_F(EnergyPlusFixture, Beam_sizeandSimulateOneZone) " Coil:Heating:Water,", " CV_1_HeatC, !- Name", - " ALWAYS_ON, !- Availability Schedule Name", + " CONSTANT-1.0, !- Availability Schedule Name", " AUTOSIZE, !- U-Factor Times Area Value {W/K}", " AUTOSIZE, !- Maximum Water Flow Rate {m3/s}", " CV_1_HeatCDemand Inlet Node, !- Water Inlet Node Name", @@ -939,7 +934,7 @@ TEST_F(EnergyPlusFixture, Beam_sizeandSimulateOneZone) " Coil:Cooling:Water,", " CV_1_CoolC, !- Name", - " ALWAYS_ON, !- Availability Schedule Name", + " CONSTANT-1.0, !- Availability Schedule Name", " AUTOSIZE, !- Design Water Flow Rate {m3/s}", " AUTOSIZE, !- Design Air Flow Rate {m3/s}", " AUTOSIZE, !- Design Inlet Water Temperature {C}", @@ -1020,7 +1015,7 @@ TEST_F(EnergyPlusFixture, Beam_sizeandSimulateOneZone) " AvailabilityManager:Scheduled,", " CV_1 Avail, !- Name", - " always_on; !- Schedule Name", + " CONSTANT-1.0; !- Schedule Name", " NodeList,", " CV_1_OANode List, !- Name", @@ -1266,7 +1261,7 @@ TEST_F(EnergyPlusFixture, Beam_sizeandSimulateOneZone) " SOURCE Loop Operation, !- Name", " PlantEquipmentOperation:CoolingLoad, !- Control Scheme 1 Object Type", " SOURCE Purchased Only, !- Control Scheme 1 Name", - " Always_On; !- Control Scheme 1 Schedule Name", + " CONSTANT-1.0; !- Control Scheme 1 Schedule Name", " PlantEquipmentOperation:CoolingLoad,", " SOURCE Purchased Only, !- Name", @@ -1417,7 +1412,7 @@ TEST_F(EnergyPlusFixture, Beam_sizeandSimulateOneZone) " HeatSys1 Loop Operation, !- Name", " PlantEquipmentOperation:HeatingLoad, !- Control Scheme 1 Object Type", " HeatSys1 Purchased Only, !- Control Scheme 1 Name", - " Always_On; !- Control Scheme 1 Schedule Name", + " CONSTANT-1.0; !- Control Scheme 1 Schedule Name", " PlantEquipmentOperation:HeatingLoad,", " HeatSys1 Purchased Only, !- Name", @@ -1590,9 +1585,9 @@ TEST_F(EnergyPlusFixture, Beam_sizeandSimulateOneZone) " AirTerminal:SingleDuct:ConstantVolume:FourPipeBeam,", " Zone One 4pipe Beam, !- Name", - " ALWAYS_ON , !- Primary Air Availability Schedule Name", - " ALWAYS_ON , !- Cooling Availability Schedule Name", - " ALWAYS_ON , !- Heating Availability Schedule Name", + " CONSTANT-1.0 , !- Primary Air Availability Schedule Name", + " CONSTANT-1.0 , !- Cooling Availability Schedule Name", + " CONSTANT-1.0 , !- Heating Availability Schedule Name", " Zone One 4pipe Beam Inlet Node Name , !- Primary Air Inlet Node Name", " Zone One 4pipe Beam Outlet Node Name , !- Primary Air Outlet Node Name", " Zone One 4pipe Beam CW Inlet Node , !- Chilled Water Inlet Node Name", @@ -1721,11 +1716,11 @@ TEST_F(EnergyPlusFixture, Beam_sizeandSimulateOneZone) ASSERT_TRUE(process_idf(idf_objects)); SimulationManager::PostIPProcessing(*state); + state->init_state(*state); bool ErrorsFound = false; state->dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(*state); OutputReportPredefined::SetPredefinedTables(*state); HeatBalanceManager::SetPreConstructionInputParameters(*state); // establish array bounds for constructions early @@ -1887,13 +1882,6 @@ TEST_F(EnergyPlusFixture, Beam_fatalWhenSysSizingOff) " 4, !- Upper Limit Value", " DISCRETE; !- Numeric Type", - " Schedule:Compact,", - " ALWAYS_ON, !- Name", - " On/Off, !- Schedule Type Limits Name", - " Through: 12/31, !- Field 1", - " For: AllDays, !- Field 2", - " Until: 24:00,1; !- Field 3", - " Schedule:Compact,", " ACTIVITY_SCH, !- Name", " Any Number, !- Schedule Type Limits Name", @@ -2481,7 +2469,7 @@ TEST_F(EnergyPlusFixture, Beam_fatalWhenSysSizingOff) " Fan:VariableVolume,", " CV_1_Fan, !- Name", - " always_on, !- Availability Schedule Name", + " CONSTANT-1.0, !- Availability Schedule Name", " 0.6045, !- Fan Total Efficiency", " 1017.592, !- Pressure Rise {Pa}", " AUTOSIZE, !- Maximum Flow Rate {m3/s}", @@ -2501,7 +2489,7 @@ TEST_F(EnergyPlusFixture, Beam_fatalWhenSysSizingOff) " Coil:Heating:Water,", " CV_1_HeatC, !- Name", - " ALWAYS_ON, !- Availability Schedule Name", + " CONSTANT-1.0, !- Availability Schedule Name", " AUTOSIZE, !- U-Factor Times Area Value {W/K}", " AUTOSIZE, !- Maximum Water Flow Rate {m3/s}", " CV_1_HeatCDemand Inlet Node, !- Water Inlet Node Name", @@ -2518,7 +2506,7 @@ TEST_F(EnergyPlusFixture, Beam_fatalWhenSysSizingOff) " Coil:Cooling:Water,", " CV_1_CoolC, !- Name", - " ALWAYS_ON, !- Availability Schedule Name", + " CONSTANT-1.0, !- Availability Schedule Name", " AUTOSIZE, !- Design Water Flow Rate {m3/s}", " AUTOSIZE, !- Design Air Flow Rate {m3/s}", " AUTOSIZE, !- Design Inlet Water Temperature {C}", @@ -2599,7 +2587,7 @@ TEST_F(EnergyPlusFixture, Beam_fatalWhenSysSizingOff) " AvailabilityManager:Scheduled,", " CV_1 Avail, !- Name", - " always_on; !- Schedule Name", + " CONSTANT-1.0; !- Schedule Name", " NodeList,", " CV_1_OANode List, !- Name", @@ -2845,7 +2833,7 @@ TEST_F(EnergyPlusFixture, Beam_fatalWhenSysSizingOff) " SOURCE Loop Operation, !- Name", " PlantEquipmentOperation:CoolingLoad, !- Control Scheme 1 Object Type", " SOURCE Purchased Only, !- Control Scheme 1 Name", - " Always_On; !- Control Scheme 1 Schedule Name", + " CONSTANT-1.0; !- Control Scheme 1 Schedule Name", " PlantEquipmentOperation:CoolingLoad,", " SOURCE Purchased Only, !- Name", @@ -2996,7 +2984,7 @@ TEST_F(EnergyPlusFixture, Beam_fatalWhenSysSizingOff) " HeatSys1 Loop Operation, !- Name", " PlantEquipmentOperation:HeatingLoad, !- Control Scheme 1 Object Type", " HeatSys1 Purchased Only, !- Control Scheme 1 Name", - " Always_On; !- Control Scheme 1 Schedule Name", + " CONSTANT-1.0; !- Control Scheme 1 Schedule Name", " PlantEquipmentOperation:HeatingLoad,", " HeatSys1 Purchased Only, !- Name", @@ -3169,9 +3157,9 @@ TEST_F(EnergyPlusFixture, Beam_fatalWhenSysSizingOff) " AirTerminal:SingleDuct:ConstantVolume:FourPipeBeam,", " Zone One 4pipe Beam, !- Name", - " ALWAYS_ON , !- Primary Air Availability Schedule Name", - " ALWAYS_ON , !- Cooling Availability Schedule Name", - " ALWAYS_ON , !- Heating Availability Schedule Name", + " CONSTANT-1.0 , !- Primary Air Availability Schedule Name", + " CONSTANT-1.0 , !- Cooling Availability Schedule Name", + " CONSTANT-1.0 , !- Heating Availability Schedule Name", " Zone One 4pipe Beam Inlet Node Name , !- Primary Air Inlet Node Name", " Zone One 4pipe Beam Outlet Node Name , !- Primary Air Outlet Node Name", " Zone One 4pipe Beam CW Inlet Node , !- Chilled Water Inlet Node Name", @@ -3300,11 +3288,11 @@ TEST_F(EnergyPlusFixture, Beam_fatalWhenSysSizingOff) ASSERT_TRUE(process_idf(idf_objects)); SimulationManager::PostIPProcessing(*state); + state->init_state(*state); bool ErrorsFound = false; state->dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(*state); OutputReportPredefined::SetPredefinedTables(*state); HeatBalanceManager::SetPreConstructionInputParameters(*state); // establish array bounds for constructions early @@ -3381,13 +3369,6 @@ TEST_F(EnergyPlusFixture, Beam_sizeandSimulateHighOA) " 4, !- Upper Limit Value", " DISCRETE; !- Numeric Type", - " Schedule:Compact,", - " ALWAYS_ON, !- Name", - " On/Off, !- Schedule Type Limits Name", - " Through: 12/31, !- Field 1", - " For: AllDays, !- Field 2", - " Until: 24:00,1; !- Field 3", - " Schedule:Compact,", " ACTIVITY_SCH, !- Name", " Any Number, !- Schedule Type Limits Name", @@ -3978,7 +3959,7 @@ TEST_F(EnergyPlusFixture, Beam_sizeandSimulateHighOA) " Fan:VariableVolume,", " CV_1_Fan, !- Name", - " always_on, !- Availability Schedule Name", + " CONSTANT-1.0, !- Availability Schedule Name", " 0.6045, !- Fan Total Efficiency", " 1017.592, !- Pressure Rise {Pa}", " AUTOSIZE, !- Maximum Flow Rate {m3/s}", @@ -3998,7 +3979,7 @@ TEST_F(EnergyPlusFixture, Beam_sizeandSimulateHighOA) " Coil:Heating:Water,", " CV_1_HeatC, !- Name", - " ALWAYS_ON, !- Availability Schedule Name", + " CONSTANT-1.0, !- Availability Schedule Name", " AUTOSIZE, !- U-Factor Times Area Value {W/K}", " AUTOSIZE, !- Maximum Water Flow Rate {m3/s}", " CV_1_HeatCDemand Inlet Node, !- Water Inlet Node Name", @@ -4015,7 +3996,7 @@ TEST_F(EnergyPlusFixture, Beam_sizeandSimulateHighOA) " Coil:Cooling:Water,", " CV_1_CoolC, !- Name", - " ALWAYS_ON, !- Availability Schedule Name", + " CONSTANT-1.0, !- Availability Schedule Name", " AUTOSIZE, !- Design Water Flow Rate {m3/s}", " AUTOSIZE, !- Design Air Flow Rate {m3/s}", " AUTOSIZE, !- Design Inlet Water Temperature {C}", @@ -4096,7 +4077,7 @@ TEST_F(EnergyPlusFixture, Beam_sizeandSimulateHighOA) " AvailabilityManager:Scheduled,", " CV_1 Avail, !- Name", - " always_on; !- Schedule Name", + " CONSTANT-1.0; !- Schedule Name", " NodeList,", " CV_1_OANode List, !- Name", @@ -4342,7 +4323,7 @@ TEST_F(EnergyPlusFixture, Beam_sizeandSimulateHighOA) " SOURCE Loop Operation, !- Name", " PlantEquipmentOperation:CoolingLoad, !- Control Scheme 1 Object Type", " SOURCE Purchased Only, !- Control Scheme 1 Name", - " Always_On; !- Control Scheme 1 Schedule Name", + " CONSTANT-1.0; !- Control Scheme 1 Schedule Name", " PlantEquipmentOperation:CoolingLoad,", " SOURCE Purchased Only, !- Name", @@ -4493,7 +4474,7 @@ TEST_F(EnergyPlusFixture, Beam_sizeandSimulateHighOA) " HeatSys1 Loop Operation, !- Name", " PlantEquipmentOperation:HeatingLoad, !- Control Scheme 1 Object Type", " HeatSys1 Purchased Only, !- Control Scheme 1 Name", - " Always_On; !- Control Scheme 1 Schedule Name", + " CONSTANT-1.0; !- Control Scheme 1 Schedule Name", " PlantEquipmentOperation:HeatingLoad,", " HeatSys1 Purchased Only, !- Name", @@ -4666,9 +4647,9 @@ TEST_F(EnergyPlusFixture, Beam_sizeandSimulateHighOA) " AirTerminal:SingleDuct:ConstantVolume:FourPipeBeam,", " Zone One 4pipe Beam, !- Name", - " ALWAYS_ON , !- Primary Air Availability Schedule Name", - " ALWAYS_ON , !- Cooling Availability Schedule Name", - " ALWAYS_ON , !- Heating Availability Schedule Name", + " CONSTANT-1.0 , !- Primary Air Availability Schedule Name", + " CONSTANT-1.0 , !- Cooling Availability Schedule Name", + " CONSTANT-1.0 , !- Heating Availability Schedule Name", " Zone One 4pipe Beam Inlet Node Name , !- Primary Air Inlet Node Name", " Zone One 4pipe Beam Outlet Node Name , !- Primary Air Outlet Node Name", " Zone One 4pipe Beam CW Inlet Node , !- Chilled Water Inlet Node Name", @@ -4797,11 +4778,10 @@ TEST_F(EnergyPlusFixture, Beam_sizeandSimulateHighOA) ASSERT_TRUE(process_idf(idf_objects)); SimulationManager::PostIPProcessing(*state); - + state->init_state(*state); bool ErrorsFound = false; state->dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(*state); OutputReportPredefined::SetPredefinedTables(*state); HeatBalanceManager::SetPreConstructionInputParameters(*state); // establish array bounds for constructions early diff --git a/tst/EnergyPlus/unit/HVACHXAssistedCoolingCoil.unit.cc b/tst/EnergyPlus/unit/HVACHXAssistedCoolingCoil.unit.cc index 6537074d194..e0a4ad193df 100644 --- a/tst/EnergyPlus/unit/HVACHXAssistedCoolingCoil.unit.cc +++ b/tst/EnergyPlus/unit/HVACHXAssistedCoolingCoil.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -433,6 +433,7 @@ TEST_F(EnergyPlusFixture, HXAssistCCUnitarySystem_VStest1) }); ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors @@ -503,10 +504,10 @@ TEST_F(EnergyPlusFixture, HXAssistCCUnitarySystem_VStest1) state->dataZoneEnergyDemand->ZoneSysMoistureDemand(ControlZoneNum).OutputRequiredToDehumidifyingSP; state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback(1) = false; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; + Sched::GetSchedule(*state, "FANANDCOILAVAILSCHED")->currentVal = 1.0; state->dataGlobal->BeginEnvrnFlag = true; state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); // initialize RhoAir state->dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail = thisSys->m_MaxCoolAirVolFlow * state->dataEnvrn->StdRhoAir; @@ -1108,6 +1109,7 @@ TEST_F(EnergyPlusFixture, HXAssistCCUnitarySystem_NewDXCoil_Processing_Test) }); ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors diff --git a/tst/EnergyPlus/unit/HVACInterfaceManager.unit.cc b/tst/EnergyPlus/unit/HVACInterfaceManager.unit.cc index 2bd9dbce437..de92cab95bd 100644 --- a/tst/EnergyPlus/unit/HVACInterfaceManager.unit.cc +++ b/tst/EnergyPlus/unit/HVACInterfaceManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -72,13 +72,13 @@ TEST_F(EnergyPlusFixture, ExcessiveHeatStorage_Test) using namespace HVACInterfaceManager; Real64 TankOutletTemp; state->dataHVACGlobal->TimeStepSys = 1; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->dataPlnt->TotNumLoops = 1; state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); // Set Up PlantLoop Variables state->dataPlnt->PlantLoop(1).Mass = 50; state->dataPlnt->PlantLoop(1).FluidName = "Water"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).NodeNumOut = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).NodeNumIn = 1; // Note LastTempInterfaceTankOutlet ends up getting reset to zero on the first pass diff --git a/tst/EnergyPlus/unit/HVACManager.unit.cc b/tst/EnergyPlus/unit/HVACManager.unit.cc index 14f6ee13dac..c0eb6eefda6 100644 --- a/tst/EnergyPlus/unit/HVACManager.unit.cc +++ b/tst/EnergyPlus/unit/HVACManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -95,7 +95,7 @@ TEST_F(EnergyPlusFixture, CrossMixingReportTest) state->dataGlobal->NumOfZones = state->dataGlobal->NumOfZones; state->dataHeatBal->TotCrossMixing = NumOfCrossMixing; state->dataHVACGlobal->TimeStepSys = 1.0; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MCPI = 0.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).MCPI = 0.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MCPV = 0.0; @@ -141,13 +141,46 @@ TEST_F(EnergyPlusFixture, InfiltrationObjectLevelReport) { std::string const idf_objects = delimited_string({ - "Zone,Zone1;", - - "Zone,Zone2;", - - "Zone,Zone3;", - - "Zone,Zone4;", + " Zone,", + " Zone1, !- Name", + " 0, !- Direction of Relative North {deg}", + " 0, !- X Origin {m}", + " 0, !- Y Origin {m}", + " 0, !- Z Origin {m}", + " 1, !- Type", + " 1, !- Multiplier", + " autocalculate, !- Ceiling Height {m}", + " 100.0; !- Volume {m3}", + " Zone,", + " Zone2, !- Name", + " 0, !- Direction of Relative North {deg}", + " 0, !- X Origin {m}", + " 0, !- Y Origin {m}", + " 0, !- Z Origin {m}", + " 1, !- Type", + " 1, !- Multiplier", + " autocalculate, !- Ceiling Height {m}", + " 200.0; !- Volume {m3}", + " Zone,", + " Zone3, !- Name", + " 0, !- Direction of Relative North {deg}", + " 0, !- X Origin {m}", + " 0, !- Y Origin {m}", + " 0, !- Z Origin {m}", + " 1, !- Type", + " 1, !- Multiplier", + " autocalculate, !- Ceiling Height {m}", + " 300.0; !- Volume {m3}", + " Zone,", + " Zone4, !- Name", + " 0, !- Direction of Relative North {deg}", + " 0, !- X Origin {m}", + " 0, !- Y Origin {m}", + " 0, !- Z Origin {m}", + " 1, !- Type", + " 1, !- Multiplier", + " autocalculate, !- Ceiling Height {m}", + " 400.0; !- Volume {m3}", "ZoneList,", " ZoneList,", @@ -194,10 +227,14 @@ TEST_F(EnergyPlusFixture, InfiltrationObjectLevelReport) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); + state->init_state(*state); bool ErrorsFound(false); - ScheduleManager::ProcessScheduleInput(*state); GetZoneData(*state, ErrorsFound); + state->dataHeatBal->space(1).Volume = state->dataHeatBal->Zone(1).Volume; + state->dataHeatBal->space(2).Volume = state->dataHeatBal->Zone(2).Volume; + state->dataHeatBal->space(3).Volume = state->dataHeatBal->Zone(3).Volume; + state->dataHeatBal->space(4).Volume = state->dataHeatBal->Zone(4).Volume; AllocateHeatBalArrays(*state); GetSimpleAirModelInputs(*state, ErrorsFound); @@ -238,9 +275,9 @@ TEST_F(EnergyPlusFixture, InfiltrationObjectLevelReport) state->dataHeatBal->Zone(2).OutDryBulbTemp = 15.0; state->dataHeatBal->Zone(3).OutDryBulbTemp = 15.0; state->dataHeatBal->Zone(4).OutDryBulbTemp = 15.0; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; + Sched::GetSchedule(*state, "ALWAYSON")->currentVal = 1.0; state->dataHVACGlobal->TimeStepSys = 1.0; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->dataGlobal->TimeStepZone = 1.0; state->dataGlobal->TimeStepZoneSec = 3600; @@ -389,7 +426,7 @@ TEST_F(EnergyPlusFixture, InfiltrationReportTest) state->dataGlobal->NumOfZones = state->dataGlobal->NumOfZones; state->dataHVACGlobal->TimeStepSys = 1.0; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MCPI = 1.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).MCPI = 1.5; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MCPV = 2.0; @@ -453,7 +490,7 @@ TEST_F(EnergyPlusFixture, ExfilAndExhaustReportTest) state->dataGlobal->NumOfZones = state->dataGlobal->NumOfZones; state->dataHVACGlobal->TimeStepSys = 1.0; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MCPI = 1.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).MCPI = 1.5; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MCPV = 2.0; diff --git a/tst/EnergyPlus/unit/HVACMultiSpeedHeatPump.unit.cc b/tst/EnergyPlus/unit/HVACMultiSpeedHeatPump.unit.cc index ecab9c6fdcd..e098d1f4f3e 100644 --- a/tst/EnergyPlus/unit/HVACMultiSpeedHeatPump.unit.cc +++ b/tst/EnergyPlus/unit/HVACMultiSpeedHeatPump.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -84,7 +84,6 @@ using namespace EnergyPlus::DataZoneEnergyDemands; using namespace EnergyPlus::HeatBalanceManager; using namespace EnergyPlus::HVACMultiSpeedHeatPump; using namespace EnergyPlus::MixedAir; -using namespace EnergyPlus::ScheduleManager; using namespace EnergyPlus::SimAirServingZones; using namespace EnergyPlus::SingleDuct; using namespace EnergyPlus::SplitterComponent; @@ -1259,9 +1258,9 @@ TEST_F(EnergyPlusFixture, HVACMultiSpeedHeatPump_ReportVariableInitTest) }); ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(*state); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // zones are specified in the idf snippet @@ -1325,14 +1324,15 @@ TEST_F(EnergyPlusFixture, HVACMultiSpeedHeatPump_ReportVariableInitTest) state->dataHVACMultiSpdHP->MSHeatPump(2).TotCoolEnergyRate = 1000.0; state->dataHVACMultiSpdHP->MSHeatPump(1).FlowFraction = 1.0; state->dataHVACMultiSpdHP->MSHeatPump(2).FlowFraction = 1.0; - // because sizing isn't occuring, we must set these + // because sizing isn't occurring, we must set these for (auto &dxCoil : state->dataDXCoils->DXCoil) { for (int i = 1; i <= dxCoil.NumOfSpeeds; ++i) { dxCoil.MSRatedAirMassFlowRate(i) = dxCoil.MSRatedAirVolFlowRate(i) * 1.2; } } - state->dataScheduleMgr->Schedule(17).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(9).CurrentValue = 1.0; + + Sched::GetSchedule(*state, "AC-24SCHED")->currentVal = 1.0; + Sched::GetSchedule(*state, "AC-25 SCHED")->currentVal = 1.0; state->dataEnvrn->StdRhoAir = 1.2; state->dataEnvrn->OutDryBulbTemp = 35.0; state->dataEnvrn->OutHumRat = 0.012; @@ -1472,7 +1472,7 @@ TEST_F(EnergyPlusFixture, HVACMultiSpeedHeatPump_HeatRecoveryTest) state->dataPlnt->PlantLoop.allocate(1); state->dataPlnt->PlantLoop(1).FluidName = "WATER"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataLoopNodes->Node(HeatRecInNode).MassFlowRate = 0.0; // test heat recovery result with 0 water flow rate HVACMultiSpeedHeatPump::MSHPHeatRecovery(*state, 1); @@ -2138,9 +2138,9 @@ TEST_F(EnergyPlusFixture, HVACMSHP_UnitarySystemElectricityRateTest) }); ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(*state); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // zones are specified in the idf snippet @@ -2193,7 +2193,7 @@ TEST_F(EnergyPlusFixture, HVACMSHP_UnitarySystemElectricityRateTest) auto &dxClgCoilMain = state->dataDXCoils->DXCoil(1); auto &dxHtgCoilMain = state->dataDXCoils->DXCoil(2); auto &elecHtgCoilSupp = state->dataHeatingCoils->HeatingCoil(msHeatPump.SuppHeatCoilNum); - state->dataScheduleMgr->Schedule(11).CurrentValue = 1.0; + Sched::GetSchedule(*state, "AC-24SCHED")->currentVal = 1.0; state->dataEnvrn->StdRhoAir = 1.2; supplyFan->rhoAirStdInit = state->dataEnvrn->StdRhoAir; state->dataGlobal->DoCoilDirectSolutions = false; @@ -2218,7 +2218,7 @@ TEST_F(EnergyPlusFixture, HVACMSHP_UnitarySystemElectricityRateTest) zoneAirNode.Temp = 21.1; zoneAirNode.HumRat = 0.0035; zoneAirNode.Enthalpy = Psychrometrics::PsyHFnTdbW(zoneAirNode.Temp, zoneAirNode.HumRat); - // set maixed air node conditions + // set mixed air node conditions auto &mixedAirNode = state->dataLoopNodes->Node(Util::FindItemInList("AC-24 SF INLET AIR NODE", state->dataLoopNodes->NodeID, state->dataLoopNodes->NumOfNodes)); mixedAirNode.Temp = 10.0; diff --git a/tst/EnergyPlus/unit/HVACSizingSimulationManager.unit.cc b/tst/EnergyPlus/unit/HVACSizingSimulationManager.unit.cc index 7fa8712c0ae..66ed1a36ede 100644 --- a/tst/EnergyPlus/unit/HVACSizingSimulationManager.unit.cc +++ b/tst/EnergyPlus/unit/HVACSizingSimulationManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -78,6 +78,8 @@ class HVACSizingSimulationManagerTest : public EnergyPlusFixture { EnergyPlusFixture::SetUp(); // Sets up the base fixture first. + state->dataFluid->init_state(*state); + // setup weather manager state needed state->dataWeather->NumOfEnvrn = 2; state->dataWeather->Environment.allocate(state->dataWeather->NumOfEnvrn); @@ -107,7 +109,8 @@ class HVACSizingSimulationManagerTest : public EnergyPlusFixture state->dataPlnt->PlantLoop(1).MaxMassFlowRate = 2.0; state->dataPlnt->PlantLoop(1).VolumeWasAutoSized = true; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); + state->dataPlnt->PlantLoop(1).LoopSide(LoopSideLocation::Supply).NodeNumIn = 1; SetPredefinedTables(*state); @@ -119,8 +122,8 @@ class HVACSizingSimulationManagerTest : public EnergyPlusFixture SetupTimePointers(*state, OutputProcessor::TimeStepType::Zone, state->dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation SetupTimePointers(*state, OutputProcessor::TimeStepType::System, state->dataHVACGlobal->TimeStepSys); - state->dataGlobal->NumOfTimeStepInHour = 4; - state->dataWeather->TimeStepFraction = 1.0 / double(state->dataGlobal->NumOfTimeStepInHour); + state->dataGlobal->TimeStepsInHour = 4; + state->dataWeather->TimeStepFraction = 1.0 / double(state->dataGlobal->TimeStepsInHour); state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::Zone].TimeStep = &state->dataGlobal->TimeStepZone; state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::Zone].CurMinute = 0; // init @@ -136,9 +139,6 @@ class HVACSizingSimulationManagerTest : public EnergyPlusFixture TEST_F(HVACSizingSimulationManagerTest, WeatherFileDaysTest3) { - - FluidProperties::GetFluidPropertiesData(*state); - // this test emulates two design days and two sizing weather file days periods // calls code related to coincident plant sizing with HVAC sizing simulation // this test runs 3 system timesteps for each zone timestep @@ -177,7 +177,7 @@ TEST_F(HVACSizingSimulationManagerTest, WeatherFileDaysTest3) state->dataGlobal->TimeStepZone = 15.0 / 60.0; state->dataHVACGlobal->NumOfSysTimeSteps = 3; state->dataHVACGlobal->TimeStepSys = state->dataGlobal->TimeStepZone / state->dataHVACGlobal->NumOfSysTimeSteps; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; // first HVAC Sizing Simulation DD emulation state->dataGlobal->KindOfSim = Constant::KindOfSim::HVACSizeDesignDay; @@ -189,7 +189,7 @@ TEST_F(HVACSizingSimulationManagerTest, WeatherFileDaysTest3) for (state->dataGlobal->HourOfDay = 1; state->dataGlobal->HourOfDay <= 24; ++state->dataGlobal->HourOfDay) { // Begin hour loop ... state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::Zone].CurMinute = 0.0; state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::System].CurMinute = 0.0; - for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->NumOfTimeStepInHour; ++state->dataGlobal->TimeStep) { + for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->TimeStepsInHour; ++state->dataGlobal->TimeStep) { for (int SysTimestepLoop = 1; SysTimestepLoop <= state->dataHVACGlobal->NumOfSysTimeSteps; ++SysTimestepLoop) { state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::System].CurMinute += (*state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::System].TimeStep) * 60.0; @@ -215,7 +215,7 @@ TEST_F(HVACSizingSimulationManagerTest, WeatherFileDaysTest3) for (state->dataGlobal->HourOfDay = 1; state->dataGlobal->HourOfDay <= 24; ++state->dataGlobal->HourOfDay) { // Begin hour loop ... state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::Zone].CurMinute = 0.0; state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::System].CurMinute = 0.0; - for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->NumOfTimeStepInHour; ++state->dataGlobal->TimeStep) { + for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->TimeStepsInHour; ++state->dataGlobal->TimeStep) { for (int SysTimestepLoop = 1; SysTimestepLoop <= state->dataHVACGlobal->NumOfSysTimeSteps; ++SysTimestepLoop) { state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::System].CurMinute += (*state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::System].TimeStep) * 60.0; @@ -243,8 +243,7 @@ TEST_F(HVACSizingSimulationManagerTest, WeatherFileDaysTest3) for (state->dataGlobal->HourOfDay = 1; state->dataGlobal->HourOfDay <= 24; ++state->dataGlobal->HourOfDay) { // Begin hour loop ... state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::Zone].CurMinute = 0.0; state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::System].CurMinute = 0.0; - for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->NumOfTimeStepInHour; - ++state->dataGlobal->TimeStep) { + for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->TimeStepsInHour; ++state->dataGlobal->TimeStep) { for (int SysTimestepLoop = 1; SysTimestepLoop <= state->dataHVACGlobal->NumOfSysTimeSteps; ++SysTimestepLoop) { state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::System].CurMinute += (*state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::System].TimeStep) * 60.0; @@ -272,8 +271,7 @@ TEST_F(HVACSizingSimulationManagerTest, WeatherFileDaysTest3) for (state->dataGlobal->HourOfDay = 1; state->dataGlobal->HourOfDay <= 24; ++state->dataGlobal->HourOfDay) { // Begin hour loop ... state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::Zone].CurMinute = 0.0; state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::System].CurMinute = 0.0; - for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->NumOfTimeStepInHour; - ++state->dataGlobal->TimeStep) { + for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->TimeStepsInHour; ++state->dataGlobal->TimeStep) { for (int SysTimestepLoop = 1; SysTimestepLoop <= state->dataHVACGlobal->NumOfSysTimeSteps; ++SysTimestepLoop) { state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::System].CurMinute += (*state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::System].TimeStep) * 60.0; @@ -373,8 +371,6 @@ TEST_F(HVACSizingSimulationManagerTest, WeatherFileDaysTest3) TEST_F(HVACSizingSimulationManagerTest, TopDownTestSysTimestep3) { - FluidProperties::GetFluidPropertiesData(*state); - // this test emulates two design days and calls nearly all the OO code related // to coincident plant sizing with HVAC sizing simulation // this test runs 3 system timesteps for each zone timestep @@ -396,7 +392,7 @@ TEST_F(HVACSizingSimulationManagerTest, TopDownTestSysTimestep3) state->dataGlobal->TimeStepZone = 15.0 / 60.0; state->dataHVACGlobal->NumOfSysTimeSteps = 3; state->dataHVACGlobal->TimeStepSys = state->dataGlobal->TimeStepZone / state->dataHVACGlobal->NumOfSysTimeSteps; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; // first HVAC Sizing Simulation DD emulation state->dataGlobal->KindOfSim = Constant::KindOfSim::HVACSizeDesignDay; @@ -407,7 +403,7 @@ TEST_F(HVACSizingSimulationManagerTest, TopDownTestSysTimestep3) for (state->dataGlobal->HourOfDay = 1; state->dataGlobal->HourOfDay <= 24; ++state->dataGlobal->HourOfDay) { // Begin hour loop ... state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::Zone].CurMinute = 0.0; state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::System].CurMinute = 0.0; - for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->NumOfTimeStepInHour; ++state->dataGlobal->TimeStep) { + for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->TimeStepsInHour; ++state->dataGlobal->TimeStep) { for (int SysTimestepLoop = 1; SysTimestepLoop <= state->dataHVACGlobal->NumOfSysTimeSteps; ++SysTimestepLoop) { state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::System].CurMinute += (*state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::System].TimeStep) * 60.0; @@ -432,7 +428,7 @@ TEST_F(HVACSizingSimulationManagerTest, TopDownTestSysTimestep3) for (state->dataGlobal->HourOfDay = 1; state->dataGlobal->HourOfDay <= 24; ++state->dataGlobal->HourOfDay) { // Begin hour loop ... state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::Zone].CurMinute = 0.0; state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::System].CurMinute = 0.0; - for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->NumOfTimeStepInHour; ++state->dataGlobal->TimeStep) { + for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->TimeStepsInHour; ++state->dataGlobal->TimeStep) { for (int SysTimestepLoop = 1; SysTimestepLoop <= state->dataHVACGlobal->NumOfSysTimeSteps; ++SysTimestepLoop) { state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::System].CurMinute += (*state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::System].TimeStep) * 60.0; @@ -520,9 +516,6 @@ TEST_F(HVACSizingSimulationManagerTest, TopDownTestSysTimestep3) TEST_F(HVACSizingSimulationManagerTest, TopDownTestSysTimestep1) { - - FluidProperties::GetFluidPropertiesData(*state); - // this test emulates two design days and calls nearly all the OO code related // to coincident plant sizing with HVAC sizing simulation // this test runs 1 system timestep for each zone timestep @@ -546,7 +539,7 @@ TEST_F(HVACSizingSimulationManagerTest, TopDownTestSysTimestep1) state->dataGlobal->TimeStepZone = 15.0 / 60.0; state->dataHVACGlobal->NumOfSysTimeSteps = 1; state->dataHVACGlobal->TimeStepSys = state->dataGlobal->TimeStepZone / state->dataHVACGlobal->NumOfSysTimeSteps; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; // first HVAC Sizing Simulation DD emulation state->dataGlobal->KindOfSim = Constant::KindOfSim::HVACSizeDesignDay; @@ -557,7 +550,7 @@ TEST_F(HVACSizingSimulationManagerTest, TopDownTestSysTimestep1) for (state->dataGlobal->HourOfDay = 1; state->dataGlobal->HourOfDay <= 24; ++state->dataGlobal->HourOfDay) { // Begin hour loop ... state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::Zone].CurMinute = 0.0; state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::System].CurMinute = 0.0; - for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->NumOfTimeStepInHour; ++state->dataGlobal->TimeStep) { + for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->TimeStepsInHour; ++state->dataGlobal->TimeStep) { for (int SysTimestepLoop = 1; SysTimestepLoop <= state->dataHVACGlobal->NumOfSysTimeSteps; ++SysTimestepLoop) { state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::System].CurMinute += @@ -584,7 +577,7 @@ TEST_F(HVACSizingSimulationManagerTest, TopDownTestSysTimestep1) for (state->dataGlobal->HourOfDay = 1; state->dataGlobal->HourOfDay <= 24; ++state->dataGlobal->HourOfDay) { // Begin hour loop ... state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::Zone].CurMinute = 0.0; state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::System].CurMinute = 0.0; - for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->NumOfTimeStepInHour; ++state->dataGlobal->TimeStep) { + for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->TimeStepsInHour; ++state->dataGlobal->TimeStep) { for (int SysTimestepLoop = 1; SysTimestepLoop <= state->dataHVACGlobal->NumOfSysTimeSteps; ++SysTimestepLoop) { state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::System].CurMinute += @@ -611,9 +604,6 @@ TEST_F(HVACSizingSimulationManagerTest, TopDownTestSysTimestep1) TEST_F(HVACSizingSimulationManagerTest, VarySysTimesteps) { - - FluidProperties::GetFluidPropertiesData(*state); - // this test emulates two design days and calls nearly all the OO code related // to coincident plant sizing with HVAC sizing simulation // this test run varies the system timestep some to test irregular @@ -638,7 +628,7 @@ TEST_F(HVACSizingSimulationManagerTest, VarySysTimesteps) state->dataGlobal->TimeStepZone = 15.0 / 60.0; state->dataHVACGlobal->NumOfSysTimeSteps = 1; state->dataHVACGlobal->TimeStepSys = state->dataGlobal->TimeStepZone / state->dataHVACGlobal->NumOfSysTimeSteps; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; // first HVAC Sizing Simulation DD emulation state->dataGlobal->KindOfSim = Constant::KindOfSim::HVACSizeDesignDay; @@ -649,11 +639,11 @@ TEST_F(HVACSizingSimulationManagerTest, VarySysTimesteps) for (state->dataGlobal->HourOfDay = 1; state->dataGlobal->HourOfDay <= 24; ++state->dataGlobal->HourOfDay) { // Begin hour loop ... state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::Zone].CurMinute = 0.0; state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::System].CurMinute = 0.0; - for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->NumOfTimeStepInHour; ++state->dataGlobal->TimeStep) { + for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->TimeStepsInHour; ++state->dataGlobal->TimeStep) { state->dataHVACGlobal->NumOfSysTimeSteps = state->dataGlobal->TimeStep; state->dataHVACGlobal->TimeStepSys = state->dataGlobal->TimeStepZone / state->dataHVACGlobal->NumOfSysTimeSteps; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; for (int SysTimestepLoop = 1; SysTimestepLoop <= state->dataHVACGlobal->NumOfSysTimeSteps; ++SysTimestepLoop) { state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::System].CurMinute += @@ -680,10 +670,10 @@ TEST_F(HVACSizingSimulationManagerTest, VarySysTimesteps) for (state->dataGlobal->HourOfDay = 1; state->dataGlobal->HourOfDay <= 24; ++state->dataGlobal->HourOfDay) { // Begin hour loop ... state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::Zone].CurMinute = 0.0; state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::System].CurMinute = 0.0; - for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->NumOfTimeStepInHour; ++state->dataGlobal->TimeStep) { + for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->TimeStepsInHour; ++state->dataGlobal->TimeStep) { state->dataHVACGlobal->NumOfSysTimeSteps = state->dataGlobal->TimeStep; state->dataHVACGlobal->TimeStepSys = state->dataGlobal->TimeStepZone / state->dataHVACGlobal->NumOfSysTimeSteps; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; for (int SysTimestepLoop = 1; SysTimestepLoop <= state->dataHVACGlobal->NumOfSysTimeSteps; ++SysTimestepLoop) { state->dataOutputProcessor->TimeValue[(int)OutputProcessor::TimeStepType::System].CurMinute += diff --git a/tst/EnergyPlus/unit/HVACStandaloneERV.unit.cc b/tst/EnergyPlus/unit/HVACStandaloneERV.unit.cc index 0c788ddb390..17783ed0999 100644 --- a/tst/EnergyPlus/unit/HVACStandaloneERV.unit.cc +++ b/tst/EnergyPlus/unit/HVACStandaloneERV.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -70,7 +70,6 @@ using namespace DataHeatBalance; using namespace DataZoneEquipment; using namespace DataSizing; using namespace Fans; -using namespace ScheduleManager; TEST_F(EnergyPlusFixture, HVACStandAloneERV_Test1) { @@ -106,6 +105,8 @@ TEST_F(EnergyPlusFixture, HVACStandAloneERV_Test1) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + state->dataEnvrn->StdRhoAir = 1.0; state->dataZoneEquip->ZoneEquipConfig.allocate(1); state->dataZoneEquip->ZoneEquipConfig(1).ZoneName = "Zone 1"; @@ -120,10 +121,10 @@ TEST_F(EnergyPlusFixture, HVACStandAloneERV_Test1) state->dataHeatBal->People.allocate(state->dataHeatBal->TotPeople); state->dataHeatBal->People(1).ZonePtr = 1; state->dataHeatBal->People(1).NumberOfPeople = 100.0; - state->dataHeatBal->People(1).NumberOfPeoplePtr = ScheduleManager::ScheduleAlwaysOn; // From dataglobals, always returns a 1 for schedule value + state->dataHeatBal->People(1).sched = Sched::GetScheduleAlwaysOn(*state); state->dataHeatBal->People(2).ZonePtr = 1; state->dataHeatBal->People(2).NumberOfPeople = 200.0; - state->dataHeatBal->People(2).NumberOfPeoplePtr = ScheduleManager::ScheduleAlwaysOn; // From dataglobals, always returns a 1 for schedule value + state->dataHeatBal->People(2).sched = Sched::GetScheduleAlwaysOn(*state); state->dataHVACStandAloneERV->StandAloneERV.allocate(1); @@ -209,9 +210,9 @@ TEST_F(EnergyPlusFixture, HVACStandAloneERV_Test2) ASSERT_TRUE(process_idf(idf_objects)); state->dataEnvrn->StdRhoAir = 1.0; - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(*state); // read schedules + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); GetFanInput(*state); @@ -237,10 +238,10 @@ TEST_F(EnergyPlusFixture, HVACStandAloneERV_Test2) state->dataHeatBal->People.allocate(state->dataHeatBal->TotPeople); state->dataHeatBal->People(1).ZonePtr = 1; state->dataHeatBal->People(1).NumberOfPeople = 10.0; - state->dataHeatBal->People(1).NumberOfPeoplePtr = ScheduleManager::ScheduleAlwaysOn; // always returns a 1 for schedule value + state->dataHeatBal->People(1).sched = Sched::GetScheduleAlwaysOn(*state); state->dataHeatBal->People(2).ZonePtr = 1; state->dataHeatBal->People(2).NumberOfPeople = 20.0; - state->dataHeatBal->People(2).NumberOfPeoplePtr = ScheduleManager::ScheduleAlwaysOn; // always returns a 1 for schedule value + state->dataHeatBal->People(2).sched = Sched::GetScheduleAlwaysOn(*state); state->dataHVACStandAloneERV->StandAloneERV.allocate(1); auto &erv = state->dataHVACStandAloneERV->StandAloneERV(1); diff --git a/tst/EnergyPlus/unit/HVACUnitaryBypassVAV.unit.cc b/tst/EnergyPlus/unit/HVACUnitaryBypassVAV.unit.cc index e53ed583850..82d61bc5003 100644 --- a/tst/EnergyPlus/unit/HVACUnitaryBypassVAV.unit.cc +++ b/tst/EnergyPlus/unit/HVACUnitaryBypassVAV.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -94,10 +94,14 @@ class CBVAVSys : public EnergyPlusFixture bool ErrorsFound = false; protected: - virtual void SetUp() + virtual void SetUp() // Please don't do this { EnergyPlusFixture::SetUp(); // Sets up the base fixture first. + state->init_state(*state); + + state->dataGlobal->TimeStepZone = 0; // Why do we need to override this? Why is it not okay to just set this? + state->dataGlobal->DayOfSim = 1; state->dataGlobal->HourOfDay = 1; @@ -120,7 +124,7 @@ class CBVAVSys : public EnergyPlusFixture state->dataZoneEquip->ZoneEquipConfig(1).ReturnNode(1) = 21; state->dataZoneEquip->ZoneEquipConfig(1).FixedReturnFlow.allocate(1); state->dataHeatBal->Zone(1).SystemZoneNodeNumber = state->dataZoneEquip->ZoneEquipConfig(1).ZoneNode; - state->dataZoneEquip->ZoneEquipConfig(1).ReturnFlowSchedPtrNum = ScheduleManager::ScheduleAlwaysOn; + state->dataZoneEquip->ZoneEquipConfig(1).returnFlowFracSched = Sched::GetScheduleAlwaysOn(*state); state->dataZoneEquip->ZoneEquipList(1).Name = "ZONEEQUIPMENT"; int maxEquipCount = 1; state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes = maxEquipCount; @@ -190,7 +194,7 @@ class CBVAVSys : public EnergyPlusFixture auto &cbvav(state->dataHVACUnitaryBypassVAV->CBVAV(1)); cbvav.Name = "CBVAVAirLoop"; cbvav.UnitType = "AirLoopHVAC:UnitaryHeatCool:VAVChangeoverBypass"; - cbvav.SchedPtr = -1; + cbvav.availSched = Sched::GetScheduleAlwaysOn(*state); cbvav.ControlledZoneNodeNum.allocate(1); cbvav.ControlledZoneNodeNum(1) = 1; cbvav.DXCoolCoilIndexNum = 1; @@ -224,7 +228,7 @@ class CBVAVSys : public EnergyPlusFixture state->dataDXCoils->DXCoil(1).RatedEIR(1) = 0.3; state->dataDXCoils->DXCoil(1).RatedSHR.allocate(1); state->dataDXCoils->DXCoil(1).RatedSHR(1) = 0.7; - state->dataDXCoils->DXCoil(1).SchedPtr = -1; + state->dataDXCoils->DXCoil(1).availSched = Sched::GetScheduleAlwaysOn(*state); state->dataDXCoils->DXCoilOutletTemp.allocate(1); state->dataDXCoils->DXCoilOutletHumRat.allocate(1); state->dataDXCoils->DXCoilPartLoadRatio.allocate(1); @@ -281,7 +285,7 @@ class CBVAVSys : public EnergyPlusFixture cbvav.HeatingCoilOutletNode = state->dataHeatingCoils->HeatingCoil(1).AirOutletNodeNum; state->dataHeatingCoils->HeatingCoil(1).NominalCapacity = 10000.0; state->dataHeatingCoils->HeatingCoil(1).Efficiency = 1.0; - state->dataHeatingCoils->HeatingCoil(1).SchedPtr = -1; + state->dataHeatingCoils->HeatingCoil(1).availSched = Sched::GetScheduleAlwaysOn(*state); cbvav.CBVAVBoxOutletNode.allocate(1); cbvav.CBVAVBoxOutletNode(1) = 11; @@ -644,10 +648,11 @@ TEST_F(EnergyPlusFixture, UnitaryBypassVAV_GetInputZoneEquipment) ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); + bool ErrorsFound = false; bool firstHVACIteration = true; // Read objects - SimulationManager::GetProjectData(*state); HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); HeatBalanceManager::GetHeatBalanceInput(*state); @@ -753,7 +758,6 @@ TEST_F(CBVAVSys, UnitaryBypassVAV_AutoSize) TEST_F(CBVAVSys, UnitaryBypassVAV_NoOASys) { - // reference CBVAV data auto &cbvav(state->dataHVACUnitaryBypassVAV->CBVAV(1)); cbvav.FanVolFlow = 0.5; @@ -1649,12 +1653,13 @@ TEST_F(EnergyPlusFixture, UnitaryBypassVAV_ParentElectricityRateTest) ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); + int CBVAVNum = 1; bool HXUnitOn = false; bool ErrorsFound = false; bool firstHVACIteration = true; // get various objects - SimulationManager::GetProjectData(*state); HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); HeatBalanceManager::GetHeatBalanceInput(*state); @@ -1736,7 +1741,7 @@ TEST_F(EnergyPlusFixture, UnitaryBypassVAV_ParentElectricityRateTest) BypassVAV.changeOverTimer = -1.0; state->dataGlobal->DayOfSim = 15; state->dataGlobal->HourOfDay = 6; - state->dataScheduleMgr->Schedule(BypassVAV.SchedPtr).CurrentValue = 1.0; + BypassVAV.availSched->currentVal = 1.0; Real64 QUnitOut = 0.0; Real64 OnOffAirFlowRatio = 1; diff --git a/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc b/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc index 0e31fa2747c..eeb555096ee 100644 --- a/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc +++ b/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -111,7 +111,6 @@ using namespace EnergyPlus::HeatingCoils; using namespace EnergyPlus::GlobalNames; using namespace EnergyPlus::PlantManager; using namespace EnergyPlus::Psychrometrics; -using namespace EnergyPlus::ScheduleManager; using namespace EnergyPlus::SimulationManager; using namespace EnergyPlus::SizingManager; @@ -150,7 +149,7 @@ class AirLoopFixture : public EnergyPlusFixture state->dataLoopNodes->NodeID.allocate(50); state->dataHeatBalFanSys->TempControlType.allocate(numZones); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataHeatBal->Zone.allocate(numZones); state->dataZoneEquip->ZoneEquipConfig.allocate(numZones); state->dataZoneEquip->ZoneEquipList.allocate(numZones); @@ -244,7 +243,7 @@ class AirLoopFixture : public EnergyPlusFixture thisZoneEqConfig.ExhaustNode.allocate(NumZoneExhaustNodes); thisZoneEqConfig.ExhaustNode(1) = zoneExhNode1; thisZoneEqConfig.EquipListIndex = zoneNum; - thisZoneEqConfig.ReturnFlowSchedPtrNum = ScheduleManager::ScheduleAlwaysOn; + thisZoneEqConfig.returnFlowFracSched = Sched::GetScheduleAlwaysOn(*state); auto &thisZone(state->dataHeatBal->Zone(zoneNum)); thisZone.Name = "ZONE1"; @@ -330,11 +329,11 @@ class AirLoopFixture : public EnergyPlusFixture } state->dataPlnt->PlantLoop(1).Name = "Hot Water Loop"; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).Name = "Chilled Water Loop"; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataSize->PlantSizData(1).PlantLoopName = "Hot Water Loop"; state->dataSize->PlantSizData(1).ExitTemp = 80.0; @@ -355,9 +354,12 @@ class AirLoopFixture : public EnergyPlusFixture int condNodeNum = 1; + auto *sched1 = Sched::AddScheduleConstant(*state, "sch1"); + auto *sched2 = Sched::AddScheduleConstant(*state, "sch2"); + VRFCond.VRFSystemTypeNum = 1; VRFCond.VRFAlgorithmType = AlgorithmType::SysCurve; - VRFCond.SchedPtr = 1; + VRFCond.availSched = sched1; VRFCond.CoolingCapacity = 10000.0; VRFCond.CoolingCOP = 3.0; VRFCond.CoolingCombinationRatio = 1.0; @@ -400,10 +402,10 @@ class AirLoopFixture : public EnergyPlusFixture terminalUnitList.CoolingCoilPresent = true; terminalUnitList.HeatingCoilPresent.allocate(1); terminalUnitList.HeatingCoilPresent = true; - terminalUnitList.CoolingCoilAvailSchPtr.allocate(1); - terminalUnitList.CoolingCoilAvailSchPtr = Sch1; - terminalUnitList.HeatingCoilAvailSchPtr.allocate(1); - terminalUnitList.HeatingCoilAvailSchPtr = Sch1; + terminalUnitList.coolingCoilAvailScheds.allocate(1); + terminalUnitList.coolingCoilAvailScheds(1) = sched1; + terminalUnitList.heatingCoilAvailScheds.allocate(1); + terminalUnitList.heatingCoilAvailScheds(1) = sched1; terminalUnitList.CoolingCoilAvailable.allocate(1); terminalUnitList.HeatingCoilAvailable.allocate(1); @@ -431,7 +433,7 @@ class AirLoopFixture : public EnergyPlusFixture VRFTU.Name = "VRFTU1"; VRFTU.type = TUType::ConstantVolume; - VRFTU.SchedPtr = Sch1; + VRFTU.availSched = sched1; VRFTU.VRFSysNum = numVRFCond; VRFTU.TUListIndex = TUNum; VRFTU.IndexToTUInTUList = TUNum; @@ -454,8 +456,8 @@ class AirLoopFixture : public EnergyPlusFixture VRFTU.NoCoolHeatOutAirVolFlow = DataSizing::AutoSize; VRFTU.MinOperatingPLR = 0.1; VRFTU.fanType = HVAC::FanType::Invalid; - VRFTU.FanOpModeSchedPtr = Sch2; - VRFTU.FanAvailSchedPtr = Sch1; + VRFTU.fanOpModeSched = sched2; + VRFTU.fanAvailSched = sched1; VRFTU.FanIndex = 0; VRFTU.fanPlace = HVAC::FanPlace::Invalid; VRFTU.OAMixerName = "OAMixer1"; @@ -484,7 +486,7 @@ class AirLoopFixture : public EnergyPlusFixture state->dataDXCoils->DXCoil(1).RatedAirVolFlowRate = DataSizing::AutoSize; state->dataDXCoils->DXCoil(1).RatedTotCap = DataSizing::AutoSize; state->dataDXCoils->DXCoil(1).RatedSHR = DataSizing::AutoSize; - state->dataDXCoils->DXCoil(1).SchedPtr = Sch1; + state->dataDXCoils->DXCoil(1).availSched = sched1; state->dataDXCoils->DXCoil(1).CCapFTemp.allocate(1); state->dataDXCoils->DXCoil(1).CCapFTemp(1) = Sch1; state->dataDXCoils->DXCoil(1).CCapFFlow.allocate(1); @@ -502,16 +504,13 @@ class AirLoopFixture : public EnergyPlusFixture state->dataDXCoils->DXCoil(2).RatedAirVolFlowRate = DataSizing::AutoSize; state->dataDXCoils->DXCoil(2).RatedTotCap = DataSizing::AutoSize; state->dataDXCoils->DXCoil(2).RatedSHR = DataSizing::AutoSize; - state->dataDXCoils->DXCoil(2).SchedPtr = Sch1; + state->dataDXCoils->DXCoil(2).availSched = sched1; state->dataDXCoils->DXCoil(2).CCapFTemp.allocate(1); state->dataDXCoils->DXCoil(2).CCapFTemp(1) = Sch1; state->dataDXCoils->DXCoil(2).CCapFFlow.allocate(1); state->dataDXCoils->DXCoil(2).CCapFFlow(1) = Sch1; state->dataDXCoils->DXCoil(2).PLFFPLR.allocate(1); state->dataDXCoils->DXCoil(2).PLFFPLR(1) = Sch1; - - // set up schedules - state->dataScheduleMgr->Schedule.allocate(10); } virtual void TearDown() @@ -536,10 +535,10 @@ TEST_F(AirLoopFixture, VRF_SysModel_inAirloop) // node number set up in fixture EXPECT_EQ(ZoneInletAirNode, thisTU.VRFTUOutletNodeNum); - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRF(curSysNum).SchedPtr).CurrentValue = 1.0; // enable the VRF condenser - state->dataScheduleMgr->Schedule(thisTU.SchedPtr).CurrentValue = 1.0; // enable the terminal unit - state->dataScheduleMgr->Schedule(thisTU.FanAvailSchedPtr).CurrentValue = 1.0; // turn on fan - state->dataScheduleMgr->Schedule(thisTU.FanOpModeSchedPtr).CurrentValue = 1.0; // set constant fan operating mode + state->dataHVACVarRefFlow->VRF(curSysNum).availSched->currentVal = 1.0; // enable the VRF condenser + thisTU.availSched->currentVal = 1.0; // enable the terminal unit + thisTU.fanAvailSched->currentVal = 1.0; // turn on fan + thisTU.fanOpModeSched->currentVal = 1.0; // set constant fan operating mode state->dataZoneEnergyDemand->ZoneSysEnergyDemand(curZoneNum).RemainingOutputRequired = 0.0; // set load = 0 state->dataZoneEnergyDemand->ZoneSysEnergyDemand(curZoneNum).RemainingOutputReqToCoolSP = 0.0; @@ -2344,6 +2343,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataGlobal->BeginEnvrnFlag = true; state->dataSize->CurZoneEqNum = 1; @@ -2352,16 +2352,20 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) state->dataEnvrn->StdRhoAir = PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); // Read in IDF - ProcessScheduleInput(*state); // read schedules Curve::GetCurveInput(*state); // read curves + // test consecutive call to fluid properties getInput - FluidProperties::GetFluidPropertiesData(*state); // read refrigerant properties - EXPECT_EQ(2, state->dataFluidProps->refrigs.isize()); - EXPECT_EQ(1, state->dataFluidProps->glycols.isize()); + Fluid::GetFluidPropertiesData(*state); // read refrigerant properties + EXPECT_EQ(2, state->dataFluid->refrigs.isize()); + EXPECT_EQ(1, state->dataFluid->glycols.isize()); + + // If this should never happen, then the right thing to do is to + // assert that it doesn't happen, not to test that it is safe if + // it does happen - FluidProperties::GetFluidPropertiesData(*state); // should never happen but if it does it's safe - EXPECT_EQ(2, state->dataFluidProps->refrigs.isize()); - EXPECT_EQ(1, state->dataFluidProps->glycols.isize()); + Fluid::GetFluidPropertiesData(*state); // should never happen but if it does it's safe + EXPECT_EQ(2, state->dataFluid->refrigs.isize()); + EXPECT_EQ(1, state->dataFluid->glycols.isize()); // set up ZoneEquipConfig data state->dataGlobal->NumOfZones = 1; @@ -2401,8 +2405,9 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) state->dataEnvrn->OutDryBulbTemp = 10.35; + auto *refrig = Fluid::GetRefrig(*state, Refrigerant); // Run - Temperature = FluidProperties::GetSupHeatTempRefrig(*state, Refrigerant, Pressure, Enthalpy, TempLow, TempUp, RefrigIndex, CalledFrom); + Temperature = refrig->getSupHeatTemp(*state, Pressure, Enthalpy, TempLow, TempUp, CalledFrom); // Test EXPECT_NEAR(Temperature, 44.5, 0.5); @@ -2457,12 +2462,12 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) Ncomp); // Test - EXPECT_NEAR(756, CompSpdActual, 1); - EXPECT_NEAR(899, Ncomp, 1); - EXPECT_NEAR(3186, Q_c_OU, 1); + EXPECT_NEAR(831, CompSpdActual, 1); + EXPECT_NEAR(989, Ncomp, 1); + EXPECT_NEAR(3993, Q_c_OU, 1); EXPECT_NEAR(0, Q_h_OU, 1); - EXPECT_NEAR(242, N_fan_OU, 1); - EXPECT_NEAR(0.0158, m_ref_OU_evap, 0.0005); + EXPECT_NEAR(304, N_fan_OU, 1); + EXPECT_NEAR(0.0198, m_ref_OU_evap, 0.0005); EXPECT_NEAR(0, m_ref_OU_cond, 0.0005); } @@ -2527,7 +2532,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) *state, Q_req, HXOpMode::CondMode, T_suction, T_discharge, h_IU_evap_in, h_comp_in, CompSpdActual); // Test - EXPECT_NEAR(950, CompSpdActual, 5); + EXPECT_NEAR(1050, CompSpdActual, 5); } } // namespace EnergyPlus @@ -2687,6 +2692,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Coil) { // PURPOSE OF THIS TEST: // Test a group of methods related with the outdoor unit coil calculations in the VRF_FluidTCtrl model. + state->init_state(*state); using namespace HVACVariableRefrigerantFlow; @@ -2720,7 +2726,6 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Coil) // Pre-process state->dataEnvrn->OutBaroPress = OutBaroPress; - InitializePsychRoutines(*state); // Run and Check: VRFOU_Cap { // Test the method VRFOU_Cap, which determines the VRF OU heat transfer rate, given refrigerant side temperature, @@ -2911,6 +2916,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_GetCoilInput) " Dimensionless; !- Output Unit Type "}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // Run the method GetDXCoils(*state); @@ -2997,6 +3003,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_CalcVRFIUAirFlow) // PURPOSE OF THIS TEST: // Test the method CalcVRFIUAirFlow, which analyzes the VRF Indoor Unit operations given zonal loads. // Calculated parameters includie: (1) Fan Speed Ratio, (2) SH/SC Degrees, and (3) Coil Inlet/Outlet conditions + state->init_state(*state); using namespace DXCoils; using namespace DataZoneEnergyDemands; @@ -3026,7 +3033,6 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_CalcVRFIUAirFlow) FanSpdRatio = 0; Wout = 1; state->dataEnvrn->OutBaroPress = 101570; - InitializePsychRoutines(*state); state->dataDXCoils->DXCoil(CoolCoilIndex).C1Te = 0; state->dataDXCoils->DXCoil(CoolCoilIndex).C2Te = 0.804; @@ -3845,6 +3851,7 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataGlobal->BeginEnvrnFlag = true; state->dataSize->CurZoneEqNum = 1; @@ -3864,7 +3871,6 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); - ProcessScheduleInput(*state); // read schedules GetCurveInput(*state); // read curves GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); @@ -3872,11 +3878,10 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) GetZoneEquipmentData(*state); // read equipment list and connections ZoneInletAirNode = GetVRFTUZoneInletAirNode(*state, VRFTUNum); // trigger GetVRFInput by calling a mining function - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRF(VRFCond).SchedPtr).CurrentValue = 1.0; // enable the VRF condenser - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; // enable the terminal unit - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; // turn on fan - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = - 0.0; // set cycling fan operating mode + state->dataHVACVarRefFlow->VRF(VRFCond).availSched->currentVal = 1.0; // enable the VRF condenser + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).availSched->currentVal = 1.0; // enable the terminal unit + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanAvailSched->currentVal = 1.0; // turn on fan + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOpModeSched->currentVal = 0.0; // set cycling fan operating mode // Test coil sizing @@ -4143,12 +4148,11 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) } // test other ThermostatPriority control types - state->dataHeatBalFanSys->ZoneThermostatSetPointHi.allocate(1); - state->dataHeatBalFanSys->ZoneThermostatSetPointHi = 24.0; - state->dataHeatBalFanSys->ZoneThermostatSetPointLo.allocate(1); - state->dataHeatBalFanSys->ZoneThermostatSetPointLo = 21.0; + state->dataHeatBalFanSys->zoneTstatSetpts.allocate(1); + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi = 24.0; + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo = 21.0; state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType = HVAC::SetptType::DualHeatCool; state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZT = 25.0; state->dataLoopNodes->Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneAirNode).Temp = 27.0; @@ -4267,8 +4271,7 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) 400.0; // set load equal to small value less than expected fan heat state->dataZoneEnergyDemand->ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToCoolSP = 500.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToHeatSP = 400.0; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = - 1.0; // set constant fan operating mode + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOpModeSched->currentVal = 1.0; // set constant fan operating mode SimulateVRF(*state, state->dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, FirstHVACIteration, @@ -4294,8 +4297,7 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) 800.0; // set load equal to small value less than expected fan heat state->dataZoneEnergyDemand->ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToCoolSP = 900.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToHeatSP = 800.0; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = - 1.0; // set constant fan operating mode + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOpModeSched->currentVal = 1.0; // set constant fan operating mode SimulateVRF(*state, state->dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, FirstHVACIteration, @@ -4334,8 +4336,7 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) EXPECT_EQ(state->dataLoopNodes->Node(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum).MassFlowRate, 0.0); // flow should be = 0 at no load flow rate for constant fan mode in this example - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = - 0.0; // set cycling fan operating mode + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOpModeSched->currentVal = 0.0; // set cycling fan operating mode SimulateVRF(*state, state->dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, FirstHVACIteration, @@ -4977,6 +4978,7 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_GetInputFailers) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataGlobal->BeginEnvrnFlag = true; state->dataSize->CurZoneEqNum = 1; @@ -4996,7 +4998,6 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_GetInputFailers) state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); - ProcessScheduleInput(*state); // read schedules GetCurveInput(*state); // read curves GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); @@ -5827,6 +5828,9 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_WaterCooled) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 4; + state->dataGlobal->MinutesInTimeStep = 60 / state->dataGlobal->TimeStepsInHour; + state->init_state(*state); state->dataGlobal->BeginEnvrnFlag = true; state->dataSize->CurZoneEqNum = 1; @@ -5846,12 +5850,7 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_WaterCooled) state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); - Array2D DummyArray; // Sky temperature - state->dataGlobal->NumOfTimeStepInHour = 4; - state->dataGlobal->MinutesPerTimeStep = 60 / state->dataGlobal->NumOfTimeStepInHour; - DummyArray.allocate(state->dataGlobal->NumOfTimeStepInHour, 24); - DummyArray = 0.0; - ScheduleManager::GetScheduleValuesForDay(*state, 1, DummyArray, 58, 3); + Sched::GetSchedule(*state, "MAIN LOOP TEMP SCH")->getDayVals(*state, 58, 3); Curve::GetCurveInput(*state); // read curves HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data @@ -5868,11 +5867,10 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_WaterCooled) ZoneInletAirNode = GetVRFTUZoneInletAirNode(*state, VRFTUNum); // trigger GetVRFInput by calling a mining function state->dataAirLoop->AirLoopInputsFilled = true; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRF(VRFCond).SchedPtr).CurrentValue = 1.0; // enable the VRF condenser - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; // enable the terminal unit - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; // turn on fan - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = - 0.0; // set cycling fan operating mode + state->dataHVACVarRefFlow->VRF(VRFCond).availSched->currentVal = 1.0; // enable the VRF condenser + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).availSched->currentVal = 1.0; // enable the terminal unit + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanAvailSched->currentVal = 1.0; // turn on fan + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOpModeSched->currentVal = 0.0; // set cycling fan operating mode // Test coil sizing @@ -5954,26 +5952,17 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_WaterCooled) EXPECT_TRUE(state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondPLR > 0.0); EXPECT_NEAR(SysOutputProvided, state->dataZoneEnergyDemand->ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToCoolSP, 1.0); - rho = FluidProperties::GetDensityGlycol(*state, - state->dataPlnt->PlantLoop(state->dataHVACVarRefFlow->VRF(VRFCond).SourcePlantLoc.loopNum).FluidName, - state->dataSize->PlantSizData(1).ExitTemp, - state->dataPlnt->PlantLoop(state->dataHVACVarRefFlow->VRF(VRFCond).SourcePlantLoc.loopNum).FluidIndex, - RoutineName); - Cp = FluidProperties::GetSpecificHeatGlycol(*state, - state->dataPlnt->PlantLoop(state->dataHVACVarRefFlow->VRF(VRFCond).SourcePlantLoc.loopNum).FluidName, - state->dataSize->PlantSizData(1).ExitTemp, - state->dataPlnt->PlantLoop(state->dataHVACVarRefFlow->VRF(VRFCond).SourcePlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state->dataPlnt->PlantLoop(state->dataHVACVarRefFlow->VRF(VRFCond).SourcePlantLoc.loopNum) + .glycol->getDensity(*state, state->dataSize->PlantSizData(1).ExitTemp, RoutineName); + Cp = state->dataPlnt->PlantLoop(state->dataHVACVarRefFlow->VRF(VRFCond).SourcePlantLoc.loopNum) + .glycol->getSpecificHeat(*state, state->dataSize->PlantSizData(1).ExitTemp, RoutineName); CondVolFlowRate = max(state->dataHVACVarRefFlow->VRF(VRFCond).CoolingCapacity, state->dataHVACVarRefFlow->VRF(VRFCond).HeatingCapacity) / (state->dataSize->PlantSizData(1).DeltaT * Cp * rho); EXPECT_DOUBLE_EQ(CondVolFlowRate, state->dataHVACVarRefFlow->VRF(VRFCond).WaterCondVolFlowRate); - rho = FluidProperties::GetDensityGlycol(*state, - state->dataPlnt->PlantLoop(state->dataHVACVarRefFlow->VRF(VRFCond).SourcePlantLoc.loopNum).FluidName, - Constant::InitConvTemp, - state->dataPlnt->PlantLoop(state->dataHVACVarRefFlow->VRF(VRFCond).SourcePlantLoc.loopNum).FluidIndex, - RoutineName); + rho = state->dataPlnt->PlantLoop(state->dataHVACVarRefFlow->VRF(VRFCond).SourcePlantLoc.loopNum) + .glycol->getDensity(*state, Constant::InitConvTemp, RoutineName); EXPECT_DOUBLE_EQ(state->dataHVACVarRefFlow->VRF(VRFCond).WaterCondenserDesignMassFlow, (state->dataHVACVarRefFlow->VRF(VRFCond).WaterCondVolFlowRate * rho)); @@ -6040,10 +6029,9 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_WaterCooled) 0.0); // flow should be = 0 for cycling fan mode state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = - 1.0; // set constant fan operating mode + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOpModeSched->currentVal = 1.0; // set constant fan operating mode SimulateVRF(*state, state->dataHVACVarRefFlow->VRFTU(VRFTUNum).Name, FirstHVACIteration, @@ -6740,6 +6728,9 @@ TEST_F(EnergyPlusFixture, VRFTest_TU_NoLoad_OAMassFlowRateTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); state->dataGlobal->BeginEnvrnFlag = true; state->dataSize->CurZoneEqNum = 1; @@ -6747,8 +6738,6 @@ TEST_F(EnergyPlusFixture, VRFTest_TU_NoLoad_OAMassFlowRateTest) state->dataZoneEquip->ZoneEquipInputsFilled = true; // denotes zone equipment has been read in state->dataEnvrn->StdRhoAir = PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); state->dataGlobal->SysSizingCalc = true; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; state->dataSize->ZoneEqSizing.allocate(1); Curve::GetCurveInput(*state); // read curves @@ -6767,10 +6756,9 @@ TEST_F(EnergyPlusFixture, VRFTest_TU_NoLoad_OAMassFlowRateTest) QZnReq = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(CurZoneNum).RemainingOutputRequired; // No load state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); // Initialize terminal unit - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; // turn on TU - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; // turn on fan - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = - 1.0; // set continuous fan operating mode + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).availSched->currentVal = 1.0; // turn on TU + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanAvailSched->currentVal = 1.0; // turn on fan + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOpModeSched->currentVal = 1.0; // set continuous fan operating mode InitVRF(*state, VRFTUNum, ZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); // Initialize all VRFTU related parameters ASSERT_EQ((int)state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOp, (int)HVAC::FanOp::Continuous); // continuous fan cycling coil operating mode // Set average OA flow rate when there in no load for cont. fan cyc. coil operating mode @@ -6779,12 +6767,12 @@ TEST_F(EnergyPlusFixture, VRFTest_TU_NoLoad_OAMassFlowRateTest) EXPECT_EQ(AverageOAMassFlow, state->dataLoopNodes->Node(OutsideAirNode).MassFlowRate); // test availability manager operation - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 0.0; // turn off fan + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanAvailSched->currentVal = 0.0; // turn off fan SetAverageAirFlow(*state, VRFTUNum, PartLoadRatio, OnOffAirFlowRatio); EXPECT_EQ(0.0, state->dataLoopNodes->Node(OutsideAirNode).MassFlowRate); EXPECT_FALSE(state->dataHVACGlobal->TurnFansOn); EXPECT_FALSE(state->dataHVACGlobal->TurnFansOff); - EXPECT_EQ(0.0, state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue); + EXPECT_EQ(0.0, state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanAvailSched->currentVal); // turn on "Turn Fan On" flag for availability manager, result should be the same as previous non-zero result state->dataHVACGlobal->TurnFansOn = true; @@ -6840,6 +6828,7 @@ TEST_F(EnergyPlusFixture, VRFTest_CondenserCalcTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Curve::GetCurveInput(*state); int VRFCond = 1; @@ -8200,6 +8189,7 @@ TEST_F(EnergyPlusFixture, VRFTU_SupplementalHeatingCoilGetInput) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // get zone data bool ErrorsFound(false); @@ -8246,6 +8236,7 @@ TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilElectric) { // PURPOSE OF THE TEST: // checks VRF terminal units supplemental electric heating coil calculation + state->init_state(*state); VRFTerminalUnitEquipment thisVRFTU; @@ -8275,7 +8266,7 @@ TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilElectric) state->dataHeatingCoils->HeatingCoil(CoilNum).HCoilType_Num = thisVRFTU.SuppHeatCoilType_Num; state->dataHeatingCoils->HeatingCoil(CoilNum).AirInletNodeNum = thisVRFTU.SuppHeatCoilAirInletNode; state->dataHeatingCoils->HeatingCoil(CoilNum).AirOutletNodeNum = thisVRFTU.SuppHeatCoilAirOutletNode; - state->dataHeatingCoils->HeatingCoil(CoilNum).SchedPtr = ScheduleManager::ScheduleAlwaysOn; // fan is always on + state->dataHeatingCoils->HeatingCoil(CoilNum).availSched = Sched::GetScheduleAlwaysOn(*state); // fan is always on state->dataHeatingCoils->HeatingCoil(CoilNum).NominalCapacity = 10000.0; state->dataHeatingCoils->HeatingCoil(CoilNum).Efficiency = 1.0; state->dataHeatingCoils->CheckEquipName.dimension(state->dataHeatingCoils->NumHeatingCoils, true); @@ -8311,7 +8302,7 @@ TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilFuel) { // PURPOSE OF THE TEST: // checks VRF terminal units supplemental natural gas heating coil calculation - + state->init_state(*state); VRFTerminalUnitEquipment thisVRFTU; int VRFTUNum(1); @@ -8340,7 +8331,7 @@ TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilFuel) state->dataHeatingCoils->HeatingCoil(CoilNum).HCoilType_Num = thisVRFTU.SuppHeatCoilType_Num; state->dataHeatingCoils->HeatingCoil(CoilNum).AirInletNodeNum = thisVRFTU.SuppHeatCoilAirInletNode; state->dataHeatingCoils->HeatingCoil(CoilNum).AirOutletNodeNum = thisVRFTU.SuppHeatCoilAirOutletNode; - state->dataHeatingCoils->HeatingCoil(CoilNum).SchedPtr = ScheduleManager::ScheduleAlwaysOn; // fan is always on + state->dataHeatingCoils->HeatingCoil(CoilNum).availSched = Sched::GetScheduleAlwaysOn(*state); // fan is always on state->dataHeatingCoils->HeatingCoil(CoilNum).NominalCapacity = 10000.0; state->dataHeatingCoils->HeatingCoil(CoilNum).Efficiency = 1.0; state->dataHeatingCoils->CheckEquipName.dimension(state->dataHeatingCoils->NumHeatingCoils, true); @@ -8404,7 +8395,7 @@ TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilWater) state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = WaterCoils::CoilModel::HeatingSimple; state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilTypeA = "Heating"; - state->dataWaterCoils->WaterCoil(CoilNum).SchedPtr = ScheduleManager::ScheduleAlwaysOn; + state->dataWaterCoils->WaterCoil(CoilNum).availSched = Sched::GetScheduleAlwaysOn(*state); state->dataWaterCoils->WaterCoil(CoilNum).WaterPlantLoc.loopNum = 1; // state->dataWaterCoils->WaterCoil(CoilNum).FuelType_Num = Constant::ResourceType::Natural_Gas; @@ -8443,7 +8434,8 @@ TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilWater) state->dataPlnt->PlantLoop(1).Name = "HotWaterLoop"; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); + state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(CoilNum).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = @@ -8522,7 +8514,7 @@ TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilSteam) state->dataSteamCoils->SteamCoil(CoilNum).Name = thisVRFTU.SuppHeatCoilName; state->dataSteamCoils->SteamCoil(CoilNum).plantLoc.loopNum = 1; state->dataSteamCoils->SteamCoil(CoilNum).SteamCoilTypeA = "Heating"; - state->dataSteamCoils->SteamCoil(CoilNum).SchedPtr = ScheduleManager::ScheduleAlwaysOn; + state->dataSteamCoils->SteamCoil(CoilNum).availSched = Sched::GetScheduleAlwaysOn(*state); state->dataSteamCoils->SteamCoil(CoilNum).InletSteamTemp = 100.0; state->dataSteamCoils->SteamCoil(CoilNum).InletSteamPress = 101325.0; state->dataSteamCoils->SteamCoil(CoilNum).DegOfSubcooling = 0.0; @@ -8538,6 +8530,9 @@ TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilSteam) state->dataSteamCoils->SteamCoil(CoilNum).plantLoc.compNum = 1; state->dataSteamCoils->SteamCoil(CoilNum).CoilType = DataPlant::PlantEquipmentType::CoilSteamAirHeating; state->dataSteamCoils->SteamCoil(CoilNum).TypeOfCoil = SteamCoils::CoilControlType::ZoneLoadControl; + + state->dataSteamCoils->SteamCoil(CoilNum).steam = Fluid::GetSteam(*state); + state->dataSteamCoils->GetSteamCoilsInputFlag = false; state->dataSteamCoils->CheckEquipName.dimension(state->dataSteamCoils->NumSteamCoils, true); state->dataSteamCoils->MySizeFlag.allocate(CoilNum); @@ -8560,7 +8555,9 @@ TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilSteam) state->dataPlnt->PlantLoop(1).Name = "SteamLoop"; state->dataPlnt->PlantLoop(1).FluidName = "STEAM"; - state->dataPlnt->PlantLoop(1).FluidIndex = state->dataSteamCoils->SteamIndex; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); + state->dataPlnt->PlantLoop(1).steam = Fluid::GetSteam(*state); + state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataSteamCoils->SteamCoil(CoilNum).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = @@ -8603,7 +8600,7 @@ TEST_F(EnergyPlusFixture, VRFTU_SupplementalHeatingCoilCapacityLimitTest) { // PURPOSE OF THE TEST: // heating capacity limit calculation based on maximum supply air temperature - + state->init_state(*state); VRFTerminalUnitEquipment thisVRFTU; thisVRFTU.Name = "TU1"; @@ -10898,6 +10895,7 @@ TEST_F(EnergyPlusFixture, VRFFluidControl_FanSysModel_OnOffModeTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); SimulationManager::ManageSimulation(*state); @@ -11499,6 +11497,7 @@ TEST_F(EnergyPlusFixture, VRFTU_SysCurve_ReportOutputVerificationTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataGlobal->BeginEnvrnFlag = true; state->dataSize->CurZoneEqNum = 1; @@ -11517,17 +11516,16 @@ TEST_F(EnergyPlusFixture, VRFTU_SysCurve_ReportOutputVerificationTest) state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); - ProcessScheduleInput(*state); GetCurveInput(*state); GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); // get zone input and connections GetZoneEquipmentData(*state); ZoneInletAirNode = GetVRFTUZoneInletAirNode(*state, VRFTUNum); - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRF(VRFCond).SchedPtr).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 0.0; + state->dataHVACVarRefFlow->VRF(VRFCond).availSched->currentVal = 1.0; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).availSched->currentVal = 1.0; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanAvailSched->currentVal = 1.0; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOpModeSched->currentVal = 0.0; // set the zone cooling and heat requirements state->dataZoneEnergyDemand->ZoneSysEnergyDemand(CurZoneNum).RemainingOutputRequired = -5000.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToCoolSP = -5000.0; @@ -13252,6 +13250,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_ReportOutputVerificationTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataGlobal->BeginEnvrnFlag = true; state->dataSize->CurZoneEqNum = 1; @@ -13270,7 +13269,6 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_ReportOutputVerificationTest) state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); - ProcessScheduleInput(*state); GetCurveInput(*state); GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -13278,10 +13276,10 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_ReportOutputVerificationTest) GetZoneEquipmentData(*state); GetVRFInput(*state); state->dataHVACVarRefFlow->GetVRFInputFlag = false; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRF(VRFCond).SchedPtr).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 0.0; + state->dataHVACVarRefFlow->VRF(VRFCond).availSched->currentVal = 1.0; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).availSched->currentVal = 1.0; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanAvailSched->currentVal = 1.0; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOpModeSched->currentVal = 0.0; // set the zone cooling and heat requirements state->dataZoneEnergyDemand->ZoneSysEnergyDemand(CurZoneNum).RemainingOutputRequired = -5000.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToCoolSP = -5000.0; @@ -13436,6 +13434,7 @@ TEST_F(EnergyPlusFixture, VRFTest_CondenserCalcTest_HREIRFTHeat) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Curve::GetCurveInput(*state); int VRFCond = 1; @@ -13507,7 +13506,7 @@ TEST_F(EnergyPlusFixture, VRFTest_CondenserCalcTest_HREIRFTHeat) state->dataGlobal->CurrentTime = 0.25; state->dataGlobal->TimeStepZone = 0.25; state->dataHVACGlobal->TimeStepSys = 0.25; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->dataHVACGlobal->SysTimeElapsed = 0.0; state->dataEnvrn->OutDryBulbTemp = 35.0; state->dataEnvrn->OutHumRat = 0.01; @@ -14024,9 +14023,9 @@ TEST_F(EnergyPlusFixture, VRF_BlowthroughFanPlacement_InputTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound(false); - ProcessScheduleInput(*state); GetCurveInput(*state); GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -14610,11 +14609,11 @@ TEST_F(EnergyPlusFixture, VRF_MinPLR_and_EIRfPLRCruveMinPLRInputsTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Real64 minEIRfLowPLRXInput(0.0); Real64 maxEIRfLowPLRXInput(0.0); bool ErrorsFound(false); - ProcessScheduleInput(*state); GetCurveInput(*state); GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -15317,6 +15316,9 @@ TEST_F(EnergyPlusFixture, VRFTest_TU_NotOnZoneHVACEquipmentList) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); state->dataGlobal->BeginEnvrnFlag = true; state->dataSize->CurZoneEqNum = 1; @@ -15324,8 +15326,6 @@ TEST_F(EnergyPlusFixture, VRFTest_TU_NotOnZoneHVACEquipmentList) state->dataZoneEquip->ZoneEquipInputsFilled = true; // denotes zone equipment has been read in state->dataEnvrn->StdRhoAir = PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); state->dataGlobal->SysSizingCalc = true; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; state->dataSize->ZoneEqSizing.allocate(1); Curve::GetCurveInput(*state); // read curves @@ -15344,8 +15344,7 @@ TEST_F(EnergyPlusFixture, VRFTest_TU_NotOnZoneHVACEquipmentList) QZnReq = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(CurZoneNum).RemainingOutputRequired; // No load state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); // Initialize terminal unit - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = - 1.0; // set continuous fan operating mode + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOpModeSched->currentVal = 1.0; // set continuous fan operating mode // Reset the err stream, which has warnings about curves values not equal to 1.0 (+ or - 10%) at rated conditions EXPECT_TRUE(has_err_output(true)); @@ -15940,6 +15939,7 @@ TEST_F(EnergyPlusFixture, VRFTU_FanOnOff_Power) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataGlobal->BeginEnvrnFlag = true; state->dataSize->CurZoneEqNum = 1; @@ -15958,17 +15958,16 @@ TEST_F(EnergyPlusFixture, VRFTU_FanOnOff_Power) state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); - ProcessScheduleInput(*state); GetCurveInput(*state); GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); // get zone input and connections GetZoneEquipmentData(*state); ZoneInletAirNode = GetVRFTUZoneInletAirNode(*state, VRFTUNum); - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRF(VRFCond).SchedPtr).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 0.0; + state->dataHVACVarRefFlow->VRF(VRFCond).availSched->currentVal = 1.0; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).availSched->currentVal = 1.0; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanAvailSched->currentVal = 1.0; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOpModeSched->currentVal = 0.0; // set the zone cooling and heat requirements state->dataZoneEnergyDemand->ZoneSysEnergyDemand(CurZoneNum).RemainingOutputRequired = -5000.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToCoolSP = -5000.0; @@ -16090,6 +16089,7 @@ TEST_F(EnergyPlusFixture, VRF_Condenser_Calc_EIRFPLR_Bound_Test) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Curve::GetCurveInput(*state); int VRFCond = 1; @@ -18233,6 +18233,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_SupplementalHtgCoilTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataGlobal->BeginEnvrnFlag = true; @@ -18278,7 +18279,6 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_SupplementalHtgCoilTest) state->dataZoneEnergyDemand->ZoneSysEnergyDemand(zone_num_TU2).RemainingOutputReqToHeatSP = 2500.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(zone_num_TU2).RemainingOutputReqToCoolSP = 0.0; - ProcessScheduleInput(*state); GetCurveInput(*state); GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -18287,15 +18287,15 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_SupplementalHtgCoilTest) GetVRFInput(*state); state->dataHVACVarRefFlow->GetVRFInputFlag = false; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRF(VRFCond).SchedPtr).CurrentValue = 1.0; + state->dataHVACVarRefFlow->VRF(VRFCond).availSched->currentVal = 1.0; VRFTUNum = zone_num_TU1; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 0.0; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).availSched->currentVal = 1.0; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanAvailSched->currentVal = 1.0; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOpModeSched->currentVal = 0.0; VRFTUNum = zone_num_TU2; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 0.0; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).availSched->currentVal = 1.0; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanAvailSched->currentVal = 1.0; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOpModeSched->currentVal = 0.0; auto &TU1ZoneEquip(state->dataZoneEquip->ZoneEquipConfig(zone_num_TU1)); // set zone air node properties, for zone 1 @@ -20368,6 +20368,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_offSupplementalHtgCoilTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataGlobal->BeginEnvrnFlag = true; @@ -20413,7 +20414,6 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_offSupplementalHtgCoilTest) state->dataZoneEnergyDemand->ZoneSysEnergyDemand(zone_num_TU2).RemainingOutputReqToHeatSP = 2500.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(zone_num_TU2).RemainingOutputReqToCoolSP = 0.0; - ProcessScheduleInput(*state); GetCurveInput(*state); GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -20425,15 +20425,15 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_offSupplementalHtgCoilTest) state->dataHVACGlobal->OnOffFanPartLoadFraction = 1.0; state->dataHVACVarRefFlow->VRF(VRFCond).VRFCondCyclingRatio = 1.0; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRF(VRFCond).SchedPtr).CurrentValue = 1.0; + state->dataHVACVarRefFlow->VRF(VRFCond).availSched->currentVal = 1.0; VRFTUNum = zone_num_TU1; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 0.0; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).availSched->currentVal = 1.0; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanAvailSched->currentVal = 1.0; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOpModeSched->currentVal = 0.0; VRFTUNum = zone_num_TU2; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(state->dataHVACVarRefFlow->VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 0.0; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).availSched->currentVal = 1.0; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanAvailSched->currentVal = 1.0; + state->dataHVACVarRefFlow->VRFTU(VRFTUNum).fanOpModeSched->currentVal = 0.0; auto &TU1ZoneEquip(state->dataZoneEquip->ZoneEquipConfig(zone_num_TU1)); // set zone air node properties, for zone 1 @@ -22889,6 +22889,7 @@ TEST_F(EnergyPlusFixture, VRF_MixedTypes) const std::string idf_objects = vrfFluidCtrl + vrfFluidCtrl_HR + commonCurvesAndFansForFluidCtrlAndHR + vrfSys + r410a_objects; ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataGlobal->BeginEnvrnFlag = true; state->dataSize->CurZoneEqNum = 1; @@ -22897,9 +22898,7 @@ TEST_F(EnergyPlusFixture, VRF_MixedTypes) state->dataEnvrn->StdRhoAir = PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); // Read in IDF - ProcessScheduleInput(*state); // read schedules - Curve::GetCurveInput(*state); // read curves - FluidProperties::GetFluidPropertiesData(*state); // read refrigerant properties + Curve::GetCurveInput(*state); // read curves // set up ZoneEquipConfig data state->dataGlobal->NumOfZones = 1; @@ -22979,6 +22978,7 @@ TEST_F(EnergyPlusFixture, VRFHP_CondenserCalc_PLR_Issue_Test) )IDF"; ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Curve::GetCurveInput(*state); int VRFCond = 1; @@ -24332,6 +24332,7 @@ TEST_F(EnergyPlusFixture, VRF_MultispeedFan_Test) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); SimulationManager::ManageSimulation(*state); @@ -25582,6 +25583,9 @@ TEST_F(EnergyPlusFixture, VRFTest_TU_HeatRecoveryCheck) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); state->dataGlobal->BeginEnvrnFlag = true; state->dataSize->CurZoneEqNum = 1; @@ -25589,8 +25593,6 @@ TEST_F(EnergyPlusFixture, VRFTest_TU_HeatRecoveryCheck) state->dataZoneEquip->ZoneEquipInputsFilled = true; // denotes zone equipment has been read in state->dataEnvrn->StdRhoAir = PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); state->dataGlobal->SysSizingCalc = true; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; state->dataSize->ZoneEqSizing.allocate(1); bool ErrorsFound = false; // function returns true on error diff --git a/tst/EnergyPlus/unit/HWBaseboardRadiator.unit.cc b/tst/EnergyPlus/unit/HWBaseboardRadiator.unit.cc index 978b4fb19f2..c0e0df4bb4d 100644 --- a/tst/EnergyPlus/unit/HWBaseboardRadiator.unit.cc +++ b/tst/EnergyPlus/unit/HWBaseboardRadiator.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -68,7 +68,6 @@ using namespace EnergyPlus; using namespace DataZoneEnergyDemands; -using namespace ScheduleManager; using namespace Psychrometrics; using namespace HWBaseboardRadiator; using namespace DataLoopNode; @@ -102,13 +101,13 @@ TEST_F(EnergyPlusFixture, HWBaseboardRadiator_CalcHWBaseboard) HWBaseboard(1).WaterInletNode = 1; HWBaseboard(1).WaterMassFlowRateMax = 0.40; HWBaseboard(1).AirMassFlowRateStd = 0.5; - HWBaseboard(1).SchedPtr = -1; + HWBaseboard(1).availSched = Sched::GetScheduleAlwaysOn(*state); HWBaseboard(1).plantLoc.loopNum = 1; HWBaseboard(1).UA = 370; HWBaseboard(1).QBBRadSource = 0.0; state->dataPlnt->PlantLoop(1).FluidName = "Water"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidType = DataLoopNode::NodeFluidType::Water; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); CalcHWBaseboard(*state, BBNum, LoadMet); @@ -126,9 +125,12 @@ TEST_F(EnergyPlusFixture, HWBaseboardRadiator_CalcHWBaseboard) TEST_F(EnergyPlusFixture, HWBaseboardRadiator_HWBaseboardWaterFlowResetTest) { + state->init_state(*state); Real64 LoadMet; int BBNum; + state->dataFluid->init_state(*state); + BBNum = 1; LoadMet = 0.0; auto &HWBaseboard = state->dataHWBaseboardRad->HWBaseboard; @@ -154,15 +156,15 @@ TEST_F(EnergyPlusFixture, HWBaseboardRadiator_HWBaseboardWaterFlowResetTest) HWBaseboard(1).WaterOutletNode = 2; HWBaseboard(1).WaterMassFlowRateMax = 0.40; HWBaseboard(1).AirMassFlowRateStd = 0.5; - HWBaseboard(1).SchedPtr = -1; + HWBaseboard(1).availSched = Sched::GetScheduleAlwaysOn(*state); HWBaseboard(1).plantLoc.loopNum = 1; HWBaseboard(1).plantLoc.loopSideNum = DataPlant::LoopSideLocation::Demand; HWBaseboard(1).plantLoc.branchNum = 1; HWBaseboard(1).UA = 400.0; HWBaseboard(1).QBBRadSource = 0.0; state->dataPlnt->PlantLoop(1).FluidName = "Water"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidType = DataLoopNode::NodeFluidType::Water; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataLoopNodes->Node(HWBaseboard(1).WaterInletNode).MassFlowRate = 0.2; state->dataLoopNodes->Node(HWBaseboard(1).WaterInletNode).MassFlowRateMax = 0.4; @@ -180,9 +182,8 @@ TEST_F(EnergyPlusFixture, HWBaseboardRadiator_HWBaseboardWaterFlowResetTest) loopsidebranch.Comp.allocate(1); } state->dataPlnt->PlantLoop(1).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "HotWater"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = HWBaseboard(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = HWBaseboard(1).EquipType; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).NodeNumIn = HWBaseboard(1).WaterInletNode; @@ -291,6 +292,7 @@ TEST_F(EnergyPlusFixture, HWBaseboardRadiator_HWBaseboardWaterInputTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); errorFound = false; HeatBalanceManager::GetZoneData(*state, errorFound); @@ -309,8 +311,8 @@ TEST_F(EnergyPlusFixture, HWBaseboardRadiator_HWBaseboardWaterInputTest) errorFound = false; state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; SurfaceGeometry::GetSurfaceData(*state, errorFound); diff --git a/tst/EnergyPlus/unit/HeatBalFiniteDiffManager.unit.cc b/tst/EnergyPlus/unit/HeatBalFiniteDiffManager.unit.cc index 4a4cfabbb58..41444cad825 100644 --- a/tst/EnergyPlus/unit/HeatBalFiniteDiffManager.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalFiniteDiffManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -469,7 +469,7 @@ TEST_F(EnergyPlusFixture, HeatBalFiniteDiffManager_findAnySurfacesUsingConstruct state->dataHeatBalSurf->SurfOpaqInsFaceCondFlux.allocate(thisData->TotSurfaces); state->dataHeatBalSurf->SurfOpaqOutFaceCondFlux.allocate(thisData->TotSurfaces); state->dataGlobal->TimeStepZoneSec = 600.0; - state->dataGlobal->NumOfTimeStepInHour = 6; + state->dataGlobal->TimeStepsInHour = 6; // call the function for initialization of finite difference calculation std::string const error_string = delimited_string({" ** Severe ** InitialInitHeatBalFiniteDiff: Found Material that is too thin and/or too " diff --git a/tst/EnergyPlus/unit/HeatBalanceAirManager.unit.cc b/tst/EnergyPlus/unit/HeatBalanceAirManager.unit.cc index f3ee37f8754..8f631e30150 100644 --- a/tst/EnergyPlus/unit/HeatBalanceAirManager.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceAirManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -87,6 +87,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceAirManager_RoomAirModelType_Test) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataGlobal->NumOfZones = 2; @@ -370,9 +371,14 @@ TEST_F(EnergyPlusFixture, HeatBalanceAirManager_GetInfiltrationAndVentilation) state->dataIPShortCut->lNumericFieldBlanks.dimension(MaxNumeric, false); bool ErrorsFound = false; + + state->init_state(*state); + HeatBalanceManager::GetHeatBalanceInput(*state); std::string const error_string = delimited_string( - {" ** Warning ** GetSurfaceData: Entered Space Floor Area(s) differ more than 5% from calculated Space Floor Area(s).", + {format(" ** Warning ** Version: missing in IDF, processing for EnergyPlus version=\"{}\"", DataStringGlobals::MatchVersion), + " ** Warning ** No Timestep object found. Number of TimeSteps in Hour defaulted to 4.", + " ** Warning ** GetSurfaceData: Entered Space Floor Area(s) differ more than 5% from calculated Space Floor Area(s).", " ** ~~~ ** ...use Output:Diagnostics,DisplayExtraWarnings; to show more details on individual Spaces.", " ** Warning ** CalculateZoneVolume: 1 zone is not fully enclosed. For more details use: Output:Diagnostics,DisplayExtrawarnings; ", " ** Warning ** CalcApproximateViewFactors: Zero area for all other zone surfaces.", @@ -798,13 +804,58 @@ TEST_F(EnergyPlusFixture, HeatBalanceAirManager_GetMixingAndCrossMixing) state->dataIPShortCut->rNumericArgs.dimension(MaxNumeric, 0.0); state->dataIPShortCut->lNumericFieldBlanks.dimension(MaxNumeric, false); - // Need to do this before ManageSimulation to get the space heat balance input + state->init_state(*state); + bool ErrorsFound = false; - HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); - EXPECT_FALSE(ErrorsFound); + // HeatBalanceManager::GetHeatBalanceInput(*state); + std::string const error_string = delimited_string( + {format(" ** Warning ** Version: missing in IDF, processing for EnergyPlus version=\"{}\"", DataStringGlobals::MatchVersion), + " ** Warning ** No Timestep object found. Number of TimeSteps in Hour defaulted to 4.", + " ** Warning ** No reporting elements have been requested. No simulation results produced.", + " ** ~~~ ** ...Review requirements such as \"Output:Table:SummaryReports\", \"Output:Table:Monthly\", \"Output:Variable\", " + "\"Output:Meter\" and others.", + " ** Warning ** GetSurfaceData: Entered Space Floor Area(s) differ more than 5% from calculated Space Floor Area(s).", + " ** ~~~ ** ...use Output:Diagnostics,DisplayExtraWarnings; to show more details on individual Spaces.", + " ** Warning ** CalculateZoneVolume: 1 zone is not fully enclosed. For more details use: Output:Diagnostics,DisplayExtrawarnings; ", + " ** Warning ** CalcApproximateViewFactors: Zero area for all other zone surfaces.", + " ** ~~~ ** Happens for Surface=\"DUMMY SPACE 1A FLOOR\" in Zone=ZONE 1", + " ** Warning ** CalcApproximateViewFactors: Zero area for all other zone surfaces.", + " ** ~~~ ** Happens for Surface=\"DUMMY SPACE 1B FLOOR\" in Zone=ZONE 1", + " ** Warning ** Surfaces in Zone/Enclosure=\"ZONE 1\" do not define an enclosure.", + " ** ~~~ ** Number of surfaces <= 3, view factors are set to force reciprocity but may not fulfill completeness.", + " ** ~~~ ** Reciprocity means that radiant exchange between two surfaces will match and not lead to an energy loss.", + " ** ~~~ ** Completeness means that all of the view factors between a surface and the other surfaces in a zone add up to unity.", + " ** ~~~ ** So, when there are three or less surfaces in a zone, EnergyPlus will make sure there are no losses of energy but", + " ** ~~~ ** it will not exchange the full amount of radiation with the rest of the zone as it would if there was a completed " + "enclosure.", + " ** Warning ** CalcApproximateViewFactors: Zero area for all other zone surfaces.", // Why are these errors being reported twice, because + // something is being calculated twice? + " ** ~~~ ** Happens for Surface=\"DUMMY SPACE 1A FLOOR\" in Zone=ZONE 1", + " ** Warning ** CalcApproximateViewFactors: Zero area for all other zone surfaces.", + " ** ~~~ ** Happens for Surface=\"DUMMY SPACE 1B FLOOR\" in Zone=ZONE 1", + " ** Warning ** Surfaces in Zone/Enclosure=\"ZONE 1\" do not define an enclosure.", + " ** ~~~ ** Number of surfaces <= 3, view factors are set to force reciprocity but may not fulfill completeness.", + " ** ~~~ ** Reciprocity means that radiant exchange between two surfaces will match and not lead to an energy loss.", + " ** ~~~ ** Completeness means that all of the view factors between a surface and the other surfaces in a zone add up to unity.", + " ** ~~~ ** So, when there are three or less surfaces in a zone, EnergyPlus will make sure there are no losses of energy but", + " ** ~~~ ** it will not exchange the full amount of radiation with the rest of the zone as it would if there was a completed " + "enclosure.", + " ************* Testing Individual Branch Integrity", + " ************* All Branches passed integrity testing", + " ************* Testing Individual Supply Air Path Integrity", + " ************* All Supply Air Paths passed integrity testing", + " ************* Testing Individual Return Air Path Integrity", + " ************* All Return Air Paths passed integrity testing", + " ************* No node connection errors were found.", + " ************* Beginning Simulation"}); + + // HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); + // EXPECT_FALSE(ErrorsFound); SimulationManager::ManageSimulation(*state); + compare_err_stream(error_string, true); + // Expected floor areas Real64 constexpr Space1aFloorArea = 10.0; Real64 constexpr Space1bFloorArea = 100.0; @@ -907,6 +958,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceAirManager_GetMixingAndCrossMixing) TEST_F(EnergyPlusFixture, HeatBalanceAirManager_InitSimpleMixingConvectiveHeatGains_Test) { + state->init_state(*state); Real64 expectedResult1; Real64 expectedResult2; Real64 constexpr allowedTolerance = 0.00001; @@ -916,9 +968,9 @@ TEST_F(EnergyPlusFixture, HeatBalanceAirManager_InitSimpleMixingConvectiveHeatGa state->dataHeatBal->TotCrossMixing = 0; state->dataHeatBal->TotMixing = 3; state->dataHeatBal->Mixing.allocate(state->dataHeatBal->TotMixing); - state->dataHeatBal->Mixing(1).SchedPtr = -1; // this returns a value of one - state->dataHeatBal->Mixing(2).SchedPtr = -1; // this returns a value of one - state->dataHeatBal->Mixing(3).SchedPtr = -1; // this returns a value of one + state->dataHeatBal->Mixing(1).sched = Sched::GetScheduleAlwaysOn(*state); + state->dataHeatBal->Mixing(2).sched = Sched::GetScheduleAlwaysOn(*state); + state->dataHeatBal->Mixing(3).sched = Sched::GetScheduleAlwaysOn(*state); state->dataHeatBal->Mixing(1).EMSSimpleMixingOn = false; state->dataHeatBal->Mixing(2).EMSSimpleMixingOn = false; state->dataHeatBal->Mixing(3).EMSSimpleMixingOn = false; diff --git a/tst/EnergyPlus/unit/HeatBalanceIntRadExchange.unit.cc b/tst/EnergyPlus/unit/HeatBalanceIntRadExchange.unit.cc index 91dafeeebfa..f3fdf74ed0e 100644 --- a/tst/EnergyPlus/unit/HeatBalanceIntRadExchange.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceIntRadExchange.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -396,16 +396,13 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_UpdateMovableInsulationFlagT auto *mat = new Material::MaterialBase; state->dataMaterial->materials.push_back(mat); state->dataSurface->Surface.allocate(1); - state->dataSurface->SurfMaterialMovInsulInt.allocate(1); - state->dataHeatBalSurf->SurfMovInsulIntPresent.allocate(1); - state->dataHeatBalSurf->SurfMovInsulIntPresentPrevTS.allocate(1); - state->dataHeatBalSurf->SurfMovInsulIndexList.push_back(1); + state->dataSurface->intMovInsuls.allocate(1); SurfNum = 1; - state->dataHeatBalSurf->SurfMovInsulIntPresent(1) = false; - state->dataHeatBalSurf->SurfMovInsulIntPresentPrevTS(1) = false; + state->dataSurface->intMovInsuls(1).present = false; + state->dataSurface->intMovInsuls(1).presentPrevTS = false; state->dataSurface->Surface(1).Construction = 1; - state->dataSurface->SurfMaterialMovInsulInt(1) = 1; + state->dataSurface->intMovInsuls(1).matNum = 1; state->dataConstruction->Construct(1).InsideAbsorpThermal = 0.9; mat->AbsorpThermal = 0.5; @@ -415,19 +412,19 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_UpdateMovableInsulationFlagT // Test 1: Movable insulation present but wasn't in previous time step, also movable insulation emissivity different than base construction // This should result in a true value from the algorithm which will cause interior radiant exchange matrices to be recalculated HeatBalanceIntRadExchange::UpdateMovableInsulationFlag(*state, DidMIChange, SurfNum); - EXPECT_TRUE(!DidMIChange); + EXPECT_FALSE(DidMIChange); // Test 2: Movable insulation present and was also present in previous time step. This should result in a false value since nothing has changed. - state->dataHeatBalSurf->SurfMovInsulIntPresentPrevTS(1) = true; + state->dataSurface->intMovInsuls(1).presentPrevTS = true; HeatBalanceIntRadExchange::UpdateMovableInsulationFlag(*state, DidMIChange, SurfNum); EXPECT_TRUE(DidMIChange); // Test 2: Movable insulation present but wasn't in previous time step. However, the emissivity of the movable insulation and that of the // construction are the same so nothing has actually changed. This should result in a false value. - state->dataHeatBalSurf->SurfMovInsulIntPresentPrevTS(1) = true; + state->dataSurface->intMovInsuls(1).presentPrevTS = true; mat->AbsorpThermal = state->dataConstruction->Construct(1).InsideAbsorpThermal; HeatBalanceIntRadExchange::UpdateMovableInsulationFlag(*state, DidMIChange, SurfNum); - EXPECT_TRUE(!DidMIChange); + EXPECT_FALSE(DidMIChange); } TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_AlignInputViewFactorsTest) diff --git a/tst/EnergyPlus/unit/HeatBalanceKivaManager.unit.cc b/tst/EnergyPlus/unit/HeatBalanceKivaManager.unit.cc index 375927fd1f3..4a4a8763dc9 100644 --- a/tst/EnergyPlus/unit/HeatBalanceKivaManager.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceKivaManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -176,6 +176,9 @@ TEST_F(EnergyPlusFixture, HeatBalanceKiva_SetInitialBCs) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); bool ErrorsFound(false); // If errors detected in input HeatBalanceManager::GetZoneData(*state, ErrorsFound); @@ -183,18 +186,14 @@ TEST_F(EnergyPlusFixture, HeatBalanceKiva_SetInitialBCs) int DualZoneNum(1); - state->dataEnvrn->DayOfYear_Schedule = 1; // must initialize this to get schedules initialized - state->dataEnvrn->DayOfWeek = 1; // must initialize this to get schedules initialized - state->dataGlobal->HourOfDay = 1; // must initialize this to get schedules initialized - state->dataGlobal->TimeStep = 1; // must initialize this to get schedules initialized - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules + state->dataEnvrn->DayOfYear_Schedule = 1; // must initialize this to get schedules initialized + state->dataEnvrn->DayOfWeek = 1; // must initialize this to get schedules initialized + state->dataGlobal->HourOfDay = 1; // must initialize this to get schedules initialized + state->dataGlobal->TimeStep = 1; // must initialize this to get schedules initialized ZoneTempPredictorCorrector::GetZoneAirSetPoints(*state); - state->dataScheduleMgr->Schedule(state->dataZoneCtrls->TempControlledZone(DualZoneNum).CTSchedIndex).CurrentValue = - static_cast(HVAC::ThermostatType::DualSetPointWithDeadBand); + state->dataZoneCtrls->TempControlledZone(DualZoneNum).setptTypeSched->currentVal = (int)HVAC::SetptType::DualHeatCool; // Test Initial Indoor Temperature input of 15C with Cooling/Heating Setpoints of 24C/20C @@ -227,8 +226,10 @@ TEST_F(EnergyPlusFixture, HeatBalanceKiva_SetInitialBCs) // Test using default Initial Indoor Temperature with Cooling/Heating Setpoints of 100C/-100C - state->dataZoneCtrls->TempControlledZone(1).SchIndx_DualSetPointWDeadBandCool = 4; - state->dataZoneCtrls->TempControlledZone(1).SchIndx_DualSetPointWDeadBandHeat = 5; + state->dataZoneCtrls->TempControlledZone(1).setpts[(int)HVAC::SetptType::DualHeatCool].coolSetptSched = + Sched::GetSchedule(*state, "CLGSETP_SCH_EXTREME"); + state->dataZoneCtrls->TempControlledZone(1).setpts[(int)HVAC::SetptType::DualHeatCool].heatSetptSched = + Sched::GetSchedule(*state, "HTGSETP_SCH_EXTREME"); Real64 heatingSetpoint3 = -100.0; Real64 zoneAssumedTemperature3 = -9999; @@ -245,9 +246,10 @@ TEST_F(EnergyPlusFixture, HeatBalanceKiva_SetInitialBCs) // Test Initial Indoor Temperature input of 15C with Cooling/Heating Setpoints of 100C/-100C - state->dataZoneCtrls->TempControlledZone(1).SchIndx_DualSetPointWDeadBandCool = 4; - state->dataZoneCtrls->TempControlledZone(1).SchIndx_DualSetPointWDeadBandHeat = 5; - + state->dataZoneCtrls->TempControlledZone(1).setpts[(int)HVAC::SetptType::DualHeatCool].coolSetptSched = + Sched::GetSchedule(*state, "CLGSETP_SCH_EXTREME"); + state->dataZoneCtrls->TempControlledZone(1).setpts[(int)HVAC::SetptType::DualHeatCool].heatSetptSched = + Sched::GetSchedule(*state, "HTGSETP_SCH_EXTREME"); Real64 zoneAssumedTemperature4 = 15.0; HeatBalanceKivaManager::KivaInstanceMap kv4(*state, fnd, 0, {}, 0, zoneAssumedTemperature4, 1.0, 0, &km); @@ -694,17 +696,17 @@ TEST_F(EnergyPlusFixture, HeatBalanceKiva_setupKivaInstances_ThermalComfort) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); bool ErrorsFound(false); // If errors detected in input ASSERT_FALSE(ErrorsFound); - state->dataEnvrn->DayOfYear_Schedule = 1; // must initialize this to get schedules initialized - state->dataEnvrn->DayOfWeek = 1; // must initialize this to get schedules initialized - state->dataGlobal->HourOfDay = 1; // must initialize this to get schedules initialized - state->dataGlobal->TimeStep = 1; // must initialize this to get schedules initialized - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules + state->dataEnvrn->DayOfYear_Schedule = 1; // must initialize this to get schedules initialized + state->dataEnvrn->DayOfWeek = 1; // must initialize this to get schedules initialized + state->dataGlobal->HourOfDay = 1; // must initialize this to get schedules initialized + state->dataGlobal->TimeStep = 1; // must initialize this to get schedules initialized state->files.inputWeatherFilePath.filePath = configured_source_directory() / "tst/EnergyPlus/unit/Resources/HeatBalanceKivaManagerOSkyTest.epw"; HeatBalanceManager::GetHeatBalanceInput(*state); diff --git a/tst/EnergyPlus/unit/HeatBalanceManager.unit.cc b/tst/EnergyPlus/unit/HeatBalanceManager.unit.cc index 3af392c8063..fd98047df09 100644 --- a/tst/EnergyPlus/unit/HeatBalanceManager.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -90,7 +90,6 @@ using namespace EnergyPlus::HeatBalanceManager; using namespace EnergyPlus::DataHeatBalance; using namespace EnergyPlus::ZoneEquipmentManager; using namespace EnergyPlus::HeatBalanceAirManager; -using namespace EnergyPlus::ScheduleManager; using namespace EnergyPlus::DataHeatBalFanSys; using namespace EnergyPlus::DataZoneEquipment; using namespace EnergyPlus::DataLoopNode; @@ -127,6 +126,8 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_ZoneAirBalance_OutdoorAir) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + bool ErrorsFound = false; auto numZones = state->dataInputProcessing->inputProcessor->getNumObjectsFound(*state, "Zone"); state->dataHeatBalFanSys->ZoneReOrder.allocate(numZones); @@ -460,14 +461,11 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_ZoneAirMassFlowConservationData2) }); ASSERT_TRUE(process_idf(idf_objects)); - + state->init_state(*state); bool ErrorsFound(false); // If errors detected in input - // call to process input - ProcessScheduleInput(*state); - ErrorsFound = false; - GetProjectControlData(*state, ErrorsFound); // returns ErrorsFound false, ZoneAirMassFlowConservation never sets it - EXPECT_FALSE(ErrorsFound); + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); + EXPECT_TRUE(state->dataHeatBal->ZoneAirMassFlow.EnforceZoneMassBalance); EXPECT_ENUM_EQ(state->dataHeatBal->ZoneAirMassFlow.ZoneFlowAdjustment, DataHeatBalance::AdjustmentType::NoAdjustReturnAndMixing); EXPECT_ENUM_EQ(state->dataHeatBal->ZoneAirMassFlow.InfiltrationTreatment, DataHeatBalance::InfiltrationFlow::Adjust); @@ -500,7 +498,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_ZoneAirMassFlowConservationData2) state->dataZoneEquip->ZoneEquipConfig(1).ReturnNode(1) = 4; state->dataZoneEquip->ZoneEquipConfig(1).FixedReturnFlow.allocate(1); state->dataZoneEquip->ZoneEquipConfig(1).IsControlled = true; - state->dataZoneEquip->ZoneEquipConfig(1).ReturnFlowSchedPtrNum = ScheduleManager::ScheduleAlwaysOn; + state->dataZoneEquip->ZoneEquipConfig(1).returnFlowFracSched = Sched::GetScheduleAlwaysOn(*state); state->dataZoneEquip->ZoneEquipConfig(1).InletNodeAirLoopNum.allocate(1); state->dataZoneEquip->ZoneEquipConfig(1).InletNodeADUNum.allocate(1); state->dataZoneEquip->ZoneEquipConfig(1).AirDistUnitCool.allocate(1); @@ -526,7 +524,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_ZoneAirMassFlowConservationData2) state->dataZoneEquip->ZoneEquipConfig(2).ReturnNode(1) = 8; state->dataZoneEquip->ZoneEquipConfig(2).FixedReturnFlow.allocate(1); state->dataZoneEquip->ZoneEquipConfig(2).IsControlled = true; - state->dataZoneEquip->ZoneEquipConfig(2).ReturnFlowSchedPtrNum = ScheduleManager::ScheduleAlwaysOn; + state->dataZoneEquip->ZoneEquipConfig(2).returnFlowFracSched = Sched::GetScheduleAlwaysOn(*state); state->dataZoneEquip->ZoneEquipConfig(2).InletNodeAirLoopNum.allocate(1); state->dataZoneEquip->ZoneEquipConfig(2).InletNodeADUNum.allocate(1); state->dataZoneEquip->ZoneEquipConfig(2).AirDistUnitCool.allocate(1); @@ -1216,12 +1214,9 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_TestZonePropertyLocalEnv) " Until: 24:00, 90; !- Field 3"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; - ScheduleManager::ProcessScheduleInput(*state); - - HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); - EXPECT_FALSE(ErrorsFound); HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); Material::GetMaterialData(*state, ErrorsFound); @@ -1269,10 +1264,11 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_TestZonePropertyLocalEnv) // Set up OutAirNodeManager::GetOutAirNodesInput(*state); state->dataEnvrn->OutBaroPress = 101325; - state->dataScheduleMgr->Schedule(1).CurrentValue = 25.0; - state->dataScheduleMgr->Schedule(2).CurrentValue = 20.0; - state->dataScheduleMgr->Schedule(3).CurrentValue = 1.5; - state->dataScheduleMgr->Schedule(4).CurrentValue = 90.0; + + Sched::GetSchedule(*state, "OUTDOORAIRNODEDRYBULB:0001")->currentVal = 25.0; + Sched::GetSchedule(*state, "OUTDOORAIRNODEWETBULB:0001")->currentVal = 20.0; + Sched::GetSchedule(*state, "OUTDOORAIRNODEWINDSPEED:0001")->currentVal = 1.5; + Sched::GetSchedule(*state, "OUTDOORAIRNODEWINDDIR:0001")->currentVal = 90.0; OutAirNodeManager::InitOutAirNodes(*state); @@ -1293,10 +1289,10 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_TestZonePropertyLocalEnv) EXPECT_EQ(90.0, state->dataHeatBal->Zone(1).WindDir); // Add a test for #7308 without inputs of schedule names - state->dataLoopNodes->Node(1).OutAirDryBulbSchedNum = 0; - state->dataLoopNodes->Node(1).OutAirWetBulbSchedNum = 0; - state->dataLoopNodes->Node(1).OutAirWindSpeedSchedNum = 0; - state->dataLoopNodes->Node(1).OutAirWindDirSchedNum = 0; + state->dataLoopNodes->Node(1).outAirDryBulbSched = nullptr; + state->dataLoopNodes->Node(1).outAirWetBulbSched = nullptr; + state->dataLoopNodes->Node(1).outAirWindSpeedSched = nullptr; + state->dataLoopNodes->Node(1).outAirWindDirSched = nullptr; state->dataEnvrn->OutDryBulbTemp = 25.0; state->dataEnvrn->OutWetBulbTemp = 20.0; state->dataEnvrn->WindSpeed = 1.5; @@ -1803,9 +1799,9 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GetAirBoundaryConstructData) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound(false); - ProcessScheduleInput(*state); // get constructions ErrorsFound = false; @@ -1821,7 +1817,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GetAirBoundaryConstructData) EXPECT_FALSE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundaryMixing); EXPECT_EQ(state->dataConstruction->Construct(constrNum).TotLayers, 0); EXPECT_EQ(state->dataConstruction->Construct(constrNum).AirBoundaryACH, 0.0); // Not processed for GroupedZone mixing option - EXPECT_EQ(state->dataConstruction->Construct(constrNum).AirBoundaryMixingSched, 0); + EXPECT_EQ(state->dataConstruction->Construct(constrNum).airBoundaryMixingSched, nullptr); EXPECT_EQ(state->dataHeatBal->NominalRforNominalUCalculation(constrNum), 0.0); constrNum = Util::FindItemInList(Util::makeUPPER("Air Boundary with Good Mixing Schedule"), state->dataConstruction->Construct); @@ -1831,7 +1827,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GetAirBoundaryConstructData) EXPECT_TRUE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundaryMixing); EXPECT_EQ(state->dataConstruction->Construct(constrNum).TotLayers, 0); EXPECT_EQ(state->dataConstruction->Construct(constrNum).AirBoundaryACH, 0.4); - EXPECT_EQ(state->dataConstruction->Construct(constrNum).AirBoundaryMixingSched, 1); + EXPECT_NE(state->dataConstruction->Construct(constrNum).airBoundaryMixingSched, nullptr); EXPECT_EQ(state->dataHeatBal->NominalRforNominalUCalculation(constrNum), 0.0); } @@ -1851,9 +1847,9 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GetAirBoundaryConstructData2) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound(false); - ProcessScheduleInput(*state); // skip call to get material data since this doesn't use IRT ErrorsFound = false; @@ -1865,8 +1861,11 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GetAirBoundaryConstructData2) EXPECT_TRUE(ErrorsFound); std::string const error_string = - delimited_string({" ** Severe ** CreateAirBoundaryConstructionsConstruction:AirBoundary=\"AIR BOUNDARY WITH BAD MIXING SCHEDULE\", " - "invalid (not found) Simple Mixing Schedule Name=\"xyz\".", + delimited_string({" ** Warning ** ProcessScheduleInput: Schedule:Constant = ALWAYS2", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Severe ** CreateAirBoundaryConstructions: Construction:AirBoundary = Air Boundary with Bad Mixing Schedule", + " ** ~~~ ** Simple Mixing Schedule Name = xyz, item not found.", " ** Severe ** Errors found in creating the constructions defined with Construction:AirBoundary.", " ** Warning ** This building has no thermal mass which can cause an unstable solution.", " ** ~~~ ** Use Material object for all opaque material definitions except very light insulation layers."}); @@ -1881,7 +1880,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GetAirBoundaryConstructData2) EXPECT_TRUE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundaryMixing); EXPECT_EQ(state->dataConstruction->Construct(constrNum).TotLayers, 0); EXPECT_EQ(state->dataConstruction->Construct(constrNum).AirBoundaryACH, 0.1); - EXPECT_EQ(state->dataConstruction->Construct(constrNum).AirBoundaryMixingSched, 0); + EXPECT_EQ(state->dataConstruction->Construct(constrNum).airBoundaryMixingSched, nullptr); EXPECT_EQ(state->dataHeatBal->NominalRforNominalUCalculation(constrNum), 0.0); } @@ -2461,7 +2460,8 @@ TEST_F(EnergyPlusFixture, ReadIncidentSolarMultiplierInput_invalidSched) state->dataSurface->Surface(2).Construction = 2; GetIncidentSolarMultiplier(*state, ErrorsFound); std::string error_string = - delimited_string({" ** Severe ** Invalid Incident Solar Multiplier Schedule Name in SurfaceProperty:IncidentSolarMultiplier"}); + delimited_string({" ** Severe ** GetIncidentSolarMultiplier: SurfaceProperty:IncidentSolarMultiplier = ZN001:WALL001:WIN001", + " ** ~~~ ** Incident Solar Multiplier Schedule Name = WRONGSCHEDULE, item not found."}); EXPECT_TRUE(compare_err_stream(error_string, true)); } @@ -2576,14 +2576,14 @@ TEST_F(EnergyPlusFixture, ReadIncidentSolarMultiplierInput) ASSERT_TRUE(process_idf(idf_objects)); - bool ErrorsFound = false; - - state->dataGlobal->NumOfTimeStepInHour = 4; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized + state->dataGlobal->TimeStepsInHour = 4; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 15; // must initialize this to get schedules initialized state->dataGlobal->TimeStepZone = 0.25; - state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * Constant::SecInHour; + state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * Constant::rSecsInHour; - ScheduleManager::ProcessScheduleInput(*state); // read schedules + state->init_state(*state); + + bool ErrorsFound = false; state->dataEnvrn->Month = 5; state->dataEnvrn->DayOfMonth = 31; @@ -2593,7 +2593,7 @@ TEST_F(EnergyPlusFixture, ReadIncidentSolarMultiplierInput) state->dataEnvrn->HolidayIndex = 0; state->dataGlobal->TimeStep = 1; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 0); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); Material::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -2611,9 +2611,9 @@ TEST_F(EnergyPlusFixture, ReadIncidentSolarMultiplierInput) GetIncidentSolarMultiplier(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); EXPECT_EQ(state->dataSurface->SurfIncSolMultiplier(2).Scaler, 0.6); - EXPECT_EQ(GetScheduleName(*state, state->dataSurface->SurfIncSolMultiplier(2).SchedPtr), "SOLARMULTCOMPACT"); + EXPECT_EQ(state->dataSurface->SurfIncSolMultiplier(2).sched->Name, "SOLARMULTCOMPACT"); - EXPECT_EQ(ScheduleManager::GetCurrentScheduleValue(*state, state->dataSurface->SurfIncSolMultiplier(2).SchedPtr), 0.1); + EXPECT_EQ(state->dataSurface->SurfIncSolMultiplier(2).sched->getCurrentVal(), 0.1); state->dataSurface->Surface(2).Class = DataSurfaces::SurfaceClass::Door; GetIncidentSolarMultiplier(*state, ErrorsFound); diff --git a/tst/EnergyPlus/unit/HeatBalanceMovableInsulation.unit.cc b/tst/EnergyPlus/unit/HeatBalanceMovableInsulation.unit.cc index 4ca640a2fb0..1125146a768 100644 --- a/tst/EnergyPlus/unit/HeatBalanceMovableInsulation.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceMovableInsulation.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -69,23 +69,19 @@ namespace EnergyPlus { TEST_F(EnergyPlusFixture, HeatBalanceMovableInsulation_EvalOutsideMovableInsulation) { + state->init_state(*state); auto &s_mat = state->dataMaterial; int SurfNum = 1; state->dataSurface->Surface.allocate(SurfNum); - state->dataSurface->SurfSchedMovInsulExt.allocate(SurfNum); - state->dataSurface->SurfMaterialMovInsulExt.allocate(SurfNum); - state->dataSurface->SurfSchedMovInsulExt(SurfNum) = 1; - state->dataSurface->SurfMaterialMovInsulExt(SurfNum) = 1; - state->dataHeatBalSurf->SurfMovInsulExtPresent.allocate(SurfNum); - state->dataHeatBalSurf->SurfMovInsulHExt.allocate(SurfNum); + state->dataSurface->extMovInsuls.allocate(SurfNum); + state->dataSurface->extMovInsuls(SurfNum).sched = Sched::GetScheduleAlwaysOn(*state); + state->dataSurface->extMovInsuls(SurfNum).matNum = 1; state->dataHeatBalSurf->SurfAbsSolarExt.allocate(SurfNum); state->dataHeatBalSurf->SurfAbsThermalExt.allocate(SurfNum); state->dataHeatBalSurf->SurfRoughnessExt.allocate(SurfNum); - state->dataScheduleMgr->Schedule.allocate(1); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; - state->dataHeatBalSurf->SurfMovInsulExtPresent(1) = true; - state->dataHeatBalSurf->SurfMovInsulIndexList.push_back(1); + state->dataSurface->extMovInsuls(SurfNum).present = true; + state->dataSurface->extMovInsulSurfNums.push_back(SurfNum); auto *mat1 = new Material::MaterialShade; s_mat->materials.push_back(mat1); @@ -106,7 +102,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceMovableInsulation_EvalOutsideMovableInsulat state->dataHeatBalSurf->SurfAbsSolarExt(1) = 0.0; HeatBalanceSurfaceManager::EvalOutsideMovableInsulation(*state); EXPECT_EQ(0.75, state->dataHeatBalSurf->SurfAbsSolarExt(1)); - EXPECT_EQ(0.8, state->dataHeatBalSurf->SurfMovInsulHExt(1)); + EXPECT_EQ(0.8, state->dataSurface->extMovInsuls(1).H); EXPECT_ENUM_EQ(Material::SurfaceRoughness::VeryRough, state->dataHeatBalSurf->SurfRoughnessExt(1)); EXPECT_EQ(0.75, state->dataHeatBalSurf->SurfAbsThermalExt(1)); @@ -150,21 +146,17 @@ TEST_F(EnergyPlusFixture, HeatBalanceMovableInsulation_EvalOutsideMovableInsulat TEST_F(EnergyPlusFixture, HeatBalanceMovableInsulation_EvalInsideMovableInsulation) { + state->init_state(*state); int SurfNum = 1; state->dataSurface->Surface.allocate(SurfNum); - state->dataSurface->SurfSchedMovInsulInt.allocate(SurfNum); - state->dataSurface->SurfMaterialMovInsulInt.allocate(SurfNum); - state->dataSurface->SurfSchedMovInsulInt(SurfNum) = 1; - state->dataSurface->SurfMaterialMovInsulInt(SurfNum) = 1; - state->dataHeatBalSurf->SurfMovInsulIntPresent.allocate(SurfNum); - state->dataHeatBalSurf->SurfMovInsulHInt.allocate(SurfNum); + state->dataSurface->intMovInsuls.allocate(SurfNum); + state->dataSurface->intMovInsuls(SurfNum).sched = Sched::GetScheduleAlwaysOn(*state); + state->dataSurface->intMovInsuls(SurfNum).matNum = 1; state->dataHeatBalSurf->SurfAbsSolarInt.allocate(SurfNum); state->dataHeatBalSurf->SurfAbsThermalInt.allocate(SurfNum); - state->dataScheduleMgr->Schedule.allocate(1); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; - state->dataHeatBalSurf->SurfMovInsulIndexList.push_back(1); + state->dataSurface->intMovInsulSurfNums.push_back(SurfNum); auto *mat = new Material::MaterialShade; state->dataMaterial->materials.push_back(mat); @@ -185,8 +177,8 @@ TEST_F(EnergyPlusFixture, HeatBalanceMovableInsulation_EvalInsideMovableInsulati state->dataHeatBalSurf->SurfAbsSolarInt(1) = 0.0; HeatBalanceSurfaceManager::EvalInsideMovableInsulation(*state); EXPECT_EQ(0.75, state->dataHeatBalSurf->SurfAbsSolarInt(1)); - EXPECT_EQ(0.8, state->dataHeatBalSurf->SurfMovInsulHInt(1)); - EXPECT_EQ(true, state->dataHeatBalSurf->SurfMovInsulIntPresent(1)); + EXPECT_EQ(0.8, state->dataSurface->intMovInsuls(1).H); + EXPECT_EQ(true, state->dataSurface->intMovInsuls(1).present); EXPECT_EQ(0.75, state->dataHeatBalSurf->SurfAbsThermalInt(1)); state->dataHeatBalSurf->SurfAbsSolarInt(1) = 0.0; @@ -287,15 +279,14 @@ TEST_F(EnergyPlusFixture, SurfaceControlMovableInsulation_InvalidWindowSimpleGla }); ASSERT_TRUE(process_idf(idf_objects)); - + state->init_state(*state); // set error to false bool ErrorsFound(false); // set zone data state->dataGlobal->NumOfZones = 1; state->dataHeatBal->Zone.allocate(1); state->dataHeatBal->Zone(1).Name = "ZONE ONE"; - // get schedule data - ScheduleManager::ProcessScheduleInput(*state); + // get materials data Material::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -316,14 +307,12 @@ TEST_F(EnergyPlusFixture, SurfaceControlMovableInsulation_InvalidWindowSimpleGla // set surface data state->dataSurface->TotSurfaces = 1; state->dataSurface->Surface.allocate(1); - state->dataSurface->SurfMaterialMovInsulExt.allocate(1); - state->dataSurface->SurfSchedMovInsulExt.allocate(1); - state->dataSurface->SurfMaterialMovInsulInt.allocate(1); - state->dataSurface->SurfSchedMovInsulInt.allocate(1); - state->dataSurface->SurfMaterialMovInsulExt = 0; - state->dataSurface->SurfSchedMovInsulExt = 0; - state->dataSurface->SurfMaterialMovInsulInt = 0; - state->dataSurface->SurfSchedMovInsulInt = 0; + state->dataSurface->extMovInsuls.allocate(1); + state->dataSurface->intMovInsuls.allocate(1); + state->dataSurface->extMovInsuls(1).matNum = 0; + state->dataSurface->extMovInsuls(1).sched = nullptr; + state->dataSurface->intMovInsuls(1).matNum = 0; + state->dataSurface->intMovInsuls(1).sched = nullptr; state->dataSurfaceGeometry->SurfaceTmp.allocate(1); int SurfNum = 0; int TotHTSurfs = state->dataSurface->TotSurfaces = 1; @@ -337,7 +326,7 @@ TEST_F(EnergyPlusFixture, SurfaceControlMovableInsulation_InvalidWindowSimpleGla SurfaceGeometry::GetMovableInsulationData(*state, ErrorsFound); // check movable insulation material EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(1).BaseSurfName, "ZN001:WALL001"); // base surface name - EXPECT_EQ(state->dataSurface->SurfMaterialMovInsulExt(1), 4); // index to movable insulation material + EXPECT_EQ(state->dataSurface->extMovInsuls(1).matNum, 4); // index to movable insulation material EXPECT_EQ(state->dataMaterial->materials(4)->Name, "SIMPLEGLAZINGSYSTEM"); // name of movable insulation material EXPECT_ENUM_EQ(state->dataMaterial->materials(4)->group, Material::Group::GlassSimple); // invalid material group type EXPECT_TRUE(ErrorsFound); // error found due to invalid material diff --git a/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc b/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc index dbb84bbd90a..1ad017251b7 100644 --- a/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -89,7 +89,6 @@ #include "Fixtures/EnergyPlusFixture.hh" using namespace EnergyPlus::HeatBalanceSurfaceManager; -using namespace EnergyPlus::ScheduleManager; namespace EnergyPlus { @@ -110,7 +109,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_CalcOutsideSurfTemp) TempExt = 23.0; ErrorFlag = false; - state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->TimeStepsInHour = 4; state->dataGlobal->TimeStepZoneSec = 900.0; state->dataConstruction->Construct.allocate(ConstrNum); @@ -148,7 +147,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_CalcOutsideSurfTemp) state->dataHeatBalSurf->SurfQRadSWOutMvIns(SurfNum) = 1.0; state->dataHeatBalSurf->SurfQRadLWOutSrdSurfs(SurfNum) = 1.0; state->dataHeatBalSurf->SurfQAdditionalHeatSourceOutside(SurfNum) = 0.0; - state->dataSurface->SurfMaterialMovInsulExt(SurfNum) = 1; + state->dataSurface->extMovInsuls(SurfNum).matNum = 1; state->dataSurface->Surface(SurfNum).SurfHasSurroundingSurfProperty = false; state->dataSurface->SurfOutDryBulbTemp = 0; @@ -728,6 +727,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfTempCalcHeatBalanceI }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); @@ -1265,17 +1265,16 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfTempCalcHeatBalanceI }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); bool ErrorsFound(false); // If errors detected in input - ASSERT_FALSE(ErrorsFound); - state->dataEnvrn->DayOfYear_Schedule = 1; // must initialize this to get schedules initialized - state->dataEnvrn->DayOfWeek = 1; // must initialize this to get schedules initialized - state->dataGlobal->HourOfDay = 1; // must initialize this to get schedules initialized - state->dataGlobal->TimeStep = 1; // must initialize this to get schedules initialized - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules + state->dataEnvrn->DayOfYear_Schedule = 1; // must initialize this to get schedules initialized + state->dataEnvrn->DayOfWeek = 1; // must initialize this to get schedules initialized + state->dataGlobal->HourOfDay = 1; // must initialize this to get schedules initialized + state->dataGlobal->TimeStep = 1; // must initialize this to get schedules initialized state->files.inputWeatherFilePath.filePath = configured_source_directory() / "tst/EnergyPlus/unit/Resources/HeatBalanceKivaManagerOSkyTest.epw"; state->dataWeather->WeatherFileExists = true; @@ -1347,8 +1346,8 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfTempCalcHeatBalanceI state->dataHeatBal->ZoneWinHeatGainRep.allocate(1); state->dataHeatBal->ZoneWinHeatGainRepEnergy.allocate(1); - state->dataScheduleMgr->Schedule(1).CurrentValue = -0.1; - state->dataScheduleMgr->Schedule(2).CurrentValue = 0.1; + Sched::GetSchedule(*state, "CORE_BOTTOM OCCUPANCY")->currentVal = -0.1; + Sched::GetSchedule(*state, "CORE_BOTTOM ACTIVITY")->currentVal = 0.1; state->dataGlobal->BeginSimFlag = true; state->dataGlobal->KickOffSimulation = true; @@ -1790,10 +1789,9 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfPropertyLocalEnv) " Until: 24:00, 90; !- Field 3"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; - ScheduleManager::ProcessScheduleInput(*state); - HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); HeatBalanceManager::GetZoneData(*state, ErrorsFound); @@ -1889,10 +1887,11 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfPropertyLocalEnv) SolarShading::AllocateModuleArrays(*state); SolarShading::DetermineShadowingCombinations(*state); OutAirNodeManager::GetOutAirNodesInput(*state); - state->dataScheduleMgr->Schedule(1).CurrentValue = 25.0; - state->dataScheduleMgr->Schedule(2).CurrentValue = 20.0; - state->dataScheduleMgr->Schedule(3).CurrentValue = 1.5; - state->dataScheduleMgr->Schedule(4).CurrentValue = 90.0; + + Sched::GetSchedule(*state, "OUTDOORAIRNODEDRYBULB:0001")->currentVal = 25.0; + Sched::GetSchedule(*state, "OUTDOORAIRNODEWETBULB:0001")->currentVal = 20.0; + Sched::GetSchedule(*state, "OUTDOORAIRNODEWINDSPEED:0001")->currentVal = 1.5; + Sched::GetSchedule(*state, "OUTDOORAIRNODEWINDDIR:0001")->currentVal = 90.0; for (int loop = 1; loop <= state->dataSurface->TotSurfaces; ++loop) { state->dataHeatBalSurf->SurfOutsideTempHist(1)(loop) = 20.0; } @@ -2370,12 +2369,11 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfPropertySrdSurfLWR) }); ASSERT_TRUE(process_idf(idf_objects)); - bool ErrorsFound = false; - - ScheduleManager::ProcessScheduleInput(*state); + state->init_state(*state); - HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); - EXPECT_FALSE(ErrorsFound); + bool ErrorsFound = false; + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); // read project control data + EXPECT_FALSE(ErrorsFound); // expect no errors HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); Material::GetMaterialData(*state, ErrorsFound); @@ -2478,9 +2476,9 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfPropertySrdSurfLWR) InitSurfaceHeatBalance(*state); state->dataSurface->SurfAirSkyRadSplit.allocate(6); - state->dataScheduleMgr->Schedule(1).CurrentValue = 25.0; // Srd Srfs Temp - state->dataScheduleMgr->Schedule(2).CurrentValue = 15.0; // Sky temp - state->dataScheduleMgr->Schedule(3).CurrentValue = 22.0; // Grd temp + Sched::GetSchedule(*state, "SURROUNDING TEMP SCH 1")->currentVal = 25.0; // Srd Srfs Temp + Sched::GetSchedule(*state, "SKY TEMP SCH")->currentVal = 15.0; // Sky temp + Sched::GetSchedule(*state, "GROUND TEMP SCH")->currentVal = 22.0; // Grd temp for (int SurfNum = 1; SurfNum <= 6; SurfNum++) { state->dataHeatBalSurf->SurfOutsideTempHist(1)(SurfNum) = 20; // Surf temp @@ -2942,10 +2940,11 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfTempCalcHeatBalanceA " ; !- Outside Face Heat Source Term Schedule Name"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; - HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); - EXPECT_FALSE(ErrorsFound); + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); // read project control data + EXPECT_FALSE(ErrorsFound); // expect no errors HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); Material::GetMaterialData(*state, ErrorsFound); @@ -3034,8 +3033,8 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfTempCalcHeatBalanceA state->dataHeatBal->ZoneWinHeatGainRep.allocate(1); state->dataHeatBal->ZoneWinHeatGainRepEnergy.allocate(1); - state->dataScheduleMgr->Schedule(1).CurrentValue = -0.1; - state->dataScheduleMgr->Schedule(2).CurrentValue = 0.1; + Sched::GetSchedule(*state, "SCHE_Q_EVAP_COOL")->currentVal = -0.1; + Sched::GetSchedule(*state, "SCHE_Q_ADD_HEAT")->currentVal = 0.1; state->dataHeatBalSurf->SurfWinCoeffAdjRatio.dimension(6, 1.0); AllocateSurfaceHeatBalArrays(*state); @@ -3073,19 +3072,19 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestReportIntMovInsInsideSur state->dataHeatBalSurf->SurfTempIn.allocate(state->dataSurface->TotSurfaces); state->dataHeatBalSurf->SurfTempInTmp.allocate(state->dataSurface->TotSurfaces); state->dataHeatBalSurf->SurfTempInMovInsRep.allocate(state->dataSurface->TotSurfaces); - state->dataHeatBalSurf->SurfMovInsulIntPresent.allocate(state->dataSurface->TotSurfaces); + state->dataSurface->intMovInsuls.allocate(state->dataSurface->TotSurfaces); state->dataSurface->AnyMovableInsulation = true; - state->dataHeatBalSurf->SurfMovInsulIndexList.push_back(1); - state->dataHeatBalSurf->SurfMovInsulIndexList.push_back(2); + state->dataSurface->intMovInsulSurfNums.push_back(1); + state->dataSurface->intMovInsulSurfNums.push_back(2); // Test 1 Data: Surface does NOT have movable insulation - state->dataHeatBalSurf->SurfMovInsulIntPresent(1) = false; // No movable insulation + state->dataSurface->intMovInsuls(1).present = false; // No movable insulation state->dataHeatBalSurf->SurfTempIn(1) = 23.0; state->dataHeatBalSurf->SurfTempInTmp(1) = 12.3; state->dataHeatBalSurf->SurfTempInMovInsRep(1) = 1.23; ExpectedResult1 = 23.0; // SurfTempInMovInsRep should be set to SurfTempIn // Test 2 Data: Surface has movable insulation - state->dataHeatBalSurf->SurfMovInsulIntPresent(2) = true; + state->dataSurface->intMovInsuls(2).present = true; state->dataHeatBalSurf->SurfTempIn(2) = 123.0; state->dataHeatBalSurf->SurfTempInTmp(2) = 12.3; state->dataHeatBalSurf->SurfTempInMovInsRep(2) = 1.23; @@ -3199,8 +3198,8 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestResilienceMetricReport) state->dataOutRptTab->displayThermalResilienceSummary = true; state->dataEnvrn->Month = 7; state->dataEnvrn->DayOfMonth = 1; - state->dataGlobal->NumOfTimeStepInHour = 4; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized + state->dataGlobal->TimeStepsInHour = 4; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 15; // must initialize this to get schedules initialized state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStepZone = 1; @@ -3212,26 +3211,27 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestResilienceMetricReport) state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 0.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvg = 0.0; - state->dataHeatBalFanSys->ZoneThermostatSetPointLo.dimension(state->dataGlobal->NumOfZones, 22.0); - state->dataHeatBalFanSys->ZoneThermostatSetPointHi.dimension(state->dataGlobal->NumOfZones, 28.0); + state->dataHeatBalFanSys->zoneTstatSetpts.allocate(state->dataGlobal->NumOfZones); + for (auto &zoneTstatSetpt : state->dataHeatBalFanSys->zoneTstatSetpts) { + zoneTstatSetpt.setptLo = 22.0; + zoneTstatSetpt.setptHi = 28.0; + } state->dataHeatBal->TotPeople = 1; state->dataHeatBal->People.allocate(state->dataHeatBal->TotPeople); state->dataHeatBal->People(1).ZonePtr = 1; state->dataHeatBal->People(1).Pierce = true; state->dataHeatBal->People(1).NumberOfPeople = 2; - state->dataHeatBal->People(1).NumberOfPeoplePtr = 1; + state->dataHeatBal->People(1).sched = Sched::AddScheduleConstant(*state, "Occupancy"); state->dataHeatBal->People(1).ColdStressTempThresh = 15.0; state->dataHeatBal->People(1).HeatStressTempThresh = 29.5; - state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1) = 27.5; - state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1) = 15.0; - - state->dataScheduleMgr->Schedule.allocate(1); + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi = 27.5; + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo = 15.0; state->dataThermalComforts->ThermalComfortData.allocate(state->dataHeatBal->TotPeople); state->dataThermalComforts->ThermalComfortData(1).PierceSET = 31; - state->dataScheduleMgr->Schedule(1).CurrentValue = 0; + state->dataHeatBal->People(1).sched->currentVal = 0; // Heat Index Case 1: Zone T < 80 F; state->dataGlobal->HourOfDay = 1; @@ -3427,7 +3427,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestResilienceMetricReport) EXPECT_NEAR(0.0, state->dataHeatBal->Resilience(1).ZoneDiscomfortWtExceedOccupiedHourBins[3], 1e-8); // Very-hot Exceedance OccupiedHours state->dataThermalComforts->ThermalComfortData(1).PierceSET = 11.2; - state->dataScheduleMgr->Schedule(1).CurrentValue = 0.4; + state->dataHeatBal->People(1).sched->currentVal = 0.4; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 31; state->dataThermalComforts->ThermalComfortData(1).FangerPMV = -3.5; for (int hour = 5; hour <= 7; hour++) { @@ -3478,7 +3478,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestResilienceMetricReport) state->dataThermalComforts->ThermalComfortData(1).PierceSET = 32; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 28; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; + state->dataHeatBal->People(1).sched->currentVal = 1.0; state->dataThermalComforts->ThermalComfortData(1).FangerPMV = -1.2; for (int hour = 8; hour <= 10; hour++) { state->dataGlobal->HourOfDay = hour; @@ -3574,7 +3574,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestResilienceMetricReport) state->dataThermalComforts->ThermalComfortData(1).PierceSET = 11.2; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 30; - state->dataScheduleMgr->Schedule(1).CurrentValue = 0.4; + state->dataHeatBal->People(1).sched->currentVal = 0.4; state->dataThermalComforts->ThermalComfortData(1).FangerPMV = 1.2; for (int hour = 13; hour <= 18; hour++) { state->dataGlobal->HourOfDay = hour; @@ -3621,7 +3621,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestResilienceMetricReport) EXPECT_NEAR(3.0, state->dataHeatBal->Resilience(1).ZoneDiscomfortWtExceedOccupiedHourBins[2], 1e-8); // Warm Exceedance OccupiedHours EXPECT_NEAR(0.0, state->dataHeatBal->Resilience(1).ZoneDiscomfortWtExceedOccupiedHourBins[3], 1e-8); // Very-hot Exceedance OccupiedHours - state->dataScheduleMgr->Schedule(1).CurrentValue = 0; + state->dataHeatBal->People(1).sched->currentVal = 0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 12; state->dataThermalComforts->ThermalComfortData(1).FangerPMV = 1.2; for (int hour = 19; hour <= 20; hour++) { @@ -3674,7 +3674,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestResilienceMetricReport) state->dataContaminantBalance->ZoneAirCO2Avg.allocate(state->dataGlobal->NumOfZones); state->dataContaminantBalance->Contaminant.CO2Simulation = true; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1; + state->dataHeatBal->People(1).sched->currentVal = 1; state->dataOutRptTab->displayCO2ResilienceSummary = true; state->dataContaminantBalance->ZoneAirCO2Avg(1) = 1100; ReportCO2Resilience(*state); @@ -3744,8 +3744,8 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestThermalResilienceReportR state->dataOutRptTab->displayThermalResilienceSummary = true; state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 1; - state->dataGlobal->NumOfTimeStepInHour = 4; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized + state->dataGlobal->TimeStepsInHour = 4; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 15; // must initialize this to get schedules initialized state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStepZone = 1; @@ -3758,8 +3758,12 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestThermalResilienceReportR state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvg = 0.0; state->dataHeatBal->Zone.allocate(state->dataGlobal->NumOfZones); - state->dataHeatBalFanSys->ZoneThermostatSetPointLo.dimension(state->dataGlobal->NumOfZones, 22.0); - state->dataHeatBalFanSys->ZoneThermostatSetPointHi.dimension(state->dataGlobal->NumOfZones, 28.0); + + state->dataHeatBalFanSys->zoneTstatSetpts.allocate(state->dataGlobal->NumOfZones); + for (auto &zoneTstatSetpt : state->dataHeatBalFanSys->zoneTstatSetpts) { + zoneTstatSetpt.setptLo = 22.0; + zoneTstatSetpt.setptHi = 28.0; + } state->dataHeatBalFanSys->ZoneHeatIndexHourBinsRepPeriod.allocate(state->dataGlobal->NumOfZones, state->dataWeather->TotThermalReportPers); state->dataHeatBalFanSys->ZoneHumidexHourBinsRepPeriod.allocate(state->dataGlobal->NumOfZones, state->dataWeather->TotThermalReportPers); @@ -3779,21 +3783,23 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestThermalResilienceReportR state->dataHeatBalFanSys->CrossedHeatThreshRepPeriod.allocate(state->dataGlobal->NumOfZones, state->dataWeather->TotThermalReportPers); state->dataHeatBalFanSys->CrossedColdThreshRepPeriod = false; state->dataHeatBalFanSys->CrossedHeatThreshRepPeriod = false; - state->dataHeatBalFanSys->ZoneThermostatSetPointLo.dimension(state->dataGlobal->NumOfZones, 22.0); - state->dataHeatBalFanSys->ZoneThermostatSetPointHi.dimension(state->dataGlobal->NumOfZones, 28.0); + + state->dataHeatBalFanSys->zoneTstatSetpts.allocate(state->dataGlobal->NumOfZones); + for (auto &zoneTstatSetpt : state->dataHeatBalFanSys->zoneTstatSetpts) { + zoneTstatSetpt.setptLo = 22.0; + zoneTstatSetpt.setptHi = 28.0; + } state->dataHeatBal->TotPeople = 1; state->dataHeatBal->People.allocate(state->dataHeatBal->TotPeople); state->dataHeatBal->People(1).ZonePtr = 1; state->dataHeatBal->People(1).Pierce = true; state->dataHeatBal->People(1).NumberOfPeople = 2; - state->dataHeatBal->People(1).NumberOfPeoplePtr = 1; + state->dataHeatBal->People(1).sched = Sched::AddScheduleConstant(*state, "Occupancy"); state->dataHeatBal->People(1).ColdStressTempThresh = 15.0; state->dataHeatBal->People(1).HeatStressTempThresh = 29.5; - state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1) = 27.5; - state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1) = 15.0; - - state->dataScheduleMgr->Schedule.allocate(1); + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi = 27.5; + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo = 15.0; state->dataThermalComforts->ThermalComfortData.allocate(state->dataHeatBal->TotPeople); state->dataHeatBalFanSys->ZoneLowSETHoursRepPeriod.allocate(state->dataGlobal->NumOfZones, state->dataWeather->TotThermalReportPers); @@ -3803,7 +3809,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestThermalResilienceReportR state->dataHeatBalFanSys->lowSETLongestStartRepPeriod.allocate(state->dataGlobal->NumOfZones, state->dataWeather->TotThermalReportPers); state->dataHeatBalFanSys->highSETLongestStartRepPeriod.allocate(state->dataGlobal->NumOfZones, state->dataWeather->TotThermalReportPers); state->dataThermalComforts->ThermalComfortData(1).PierceSET = 31; - state->dataScheduleMgr->Schedule(1).CurrentValue = 0; + state->dataHeatBal->People(1).sched->currentVal = 0; // --------------------------------------------------------------------- // Report Period I start @@ -3965,7 +3971,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestThermalResilienceReportR EXPECT_NEAR(0.0, state->dataHeatBalFanSys->ZoneDiscomfortWtExceedOccupiedHourBinsRepPeriod(1, 1)[3], 1e-8); // Very-hot Exceedance OccupiedHours state->dataThermalComforts->ThermalComfortData(1).PierceSET = 11.2; - state->dataScheduleMgr->Schedule(1).CurrentValue = 0.4; + state->dataHeatBal->People(1).sched->currentVal = 0.4; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 31; state->dataThermalComforts->ThermalComfortData(1).FangerPMV = -3.5; for (int hour = 5; hour <= 7; hour++) { @@ -4018,7 +4024,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestThermalResilienceReportR state->dataThermalComforts->ThermalComfortData(1).PierceSET = 32; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 28; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; + state->dataHeatBal->People(1).sched->currentVal = 1.0; state->dataThermalComforts->ThermalComfortData(1).FangerPMV = -1.2; for (int hour = 8; hour <= 10; hour++) { state->dataGlobal->HourOfDay = hour; @@ -4085,7 +4091,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestThermalResilienceReportR state->dataThermalComforts->ThermalComfortData(1).PierceSET = 11.2; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 30; - state->dataScheduleMgr->Schedule(1).CurrentValue = 0.4; + state->dataHeatBal->People(1).sched->currentVal = 0.4; state->dataThermalComforts->ThermalComfortData(1).FangerPMV = 1.2; for (int hour = 13; hour <= 18; hour++) { state->dataGlobal->HourOfDay = hour; @@ -4134,7 +4140,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestThermalResilienceReportR EXPECT_NEAR(3.0, state->dataHeatBalFanSys->ZoneDiscomfortWtExceedOccupiedHourBinsRepPeriod(1, 2)[2], 1e-8); // Warm Exceedance OccupiedHours EXPECT_NEAR(0.0, state->dataHeatBalFanSys->ZoneDiscomfortWtExceedOccupiedHourBinsRepPeriod(1, 2)[3], 1e-8); // Very-hot Exceedance OccupiedHours - state->dataScheduleMgr->Schedule(1).CurrentValue = 0; + state->dataHeatBal->People(1).sched->currentVal = 0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 12; state->dataThermalComforts->ThermalComfortData(1).FangerPMV = 1.2; for (int hour = 19; hour <= 20; hour++) { @@ -4235,8 +4241,8 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestCO2ResilienceReportRepPe state->dataGlobal->KindOfSim = Constant::KindOfSim::RunPeriodWeather; state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 1; - state->dataGlobal->NumOfTimeStepInHour = 4; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized + state->dataGlobal->TimeStepsInHour = 4; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 15; // must initialize this to get schedules initialized state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStepZone = 1; @@ -4248,7 +4254,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestCO2ResilienceReportRepPe state->dataHeatBal->People.allocate(state->dataHeatBal->TotPeople); state->dataHeatBal->People(1).ZonePtr = 1; state->dataHeatBal->People(1).NumberOfPeople = 2; - state->dataHeatBal->People(1).NumberOfPeoplePtr = 1; + state->dataHeatBal->People(1).sched = Sched::AddScheduleConstant(*state, "Occupancy"); int NoBins = 3; @@ -4261,9 +4267,8 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestCO2ResilienceReportRepPe state->dataContaminantBalance->ZoneAirCO2Avg.allocate(state->dataGlobal->NumOfZones); state->dataContaminantBalance->Contaminant.CO2Simulation = true; state->dataOutRptTab->displayCO2ResilienceSummary = true; - state->dataScheduleMgr->Schedule.allocate(1); - state->dataScheduleMgr->Schedule(1).CurrentValue = 0; + state->dataHeatBal->People(1).sched->currentVal = 0; state->dataContaminantBalance->ZoneAirCO2Avg(1) = 900; for (int hour = 1; hour <= 4; hour++) { state->dataGlobal->HourOfDay = hour; @@ -4279,7 +4284,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestCO2ResilienceReportRepPe EXPECT_NEAR(0.0, state->dataHeatBalFanSys->ZoneCO2LevelOccupiedHourBinsRepPeriod(1, 1)[1], 1e-8); EXPECT_NEAR(0.0, state->dataHeatBalFanSys->ZoneCO2LevelOccupiedHourBinsRepPeriod(1, 1)[2], 1e-8); - state->dataScheduleMgr->Schedule(1).CurrentValue = 0.4; + state->dataHeatBal->People(1).sched->currentVal = 0.4; state->dataContaminantBalance->ZoneAirCO2Avg(1) = 1100; for (int hour = 5; hour <= 7; hour++) { state->dataGlobal->HourOfDay = hour; @@ -4295,7 +4300,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestCO2ResilienceReportRepPe EXPECT_NEAR(3.0, state->dataHeatBalFanSys->ZoneCO2LevelOccupiedHourBinsRepPeriod(1, 1)[1], 1e-8); EXPECT_NEAR(0.0, state->dataHeatBalFanSys->ZoneCO2LevelOccupiedHourBinsRepPeriod(1, 1)[2], 1e-8); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; + state->dataHeatBal->People(1).sched->currentVal = 1.0; state->dataContaminantBalance->ZoneAirCO2Avg(1) = 5500; state->dataGlobal->HourOfDay = 8; ReportCO2Resilience(*state); @@ -4310,7 +4315,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestCO2ResilienceReportRepPe EXPECT_NEAR(3.0, state->dataHeatBalFanSys->ZoneCO2LevelOccupiedHourBinsRepPeriod(1, 1)[1], 1e-8); EXPECT_NEAR(1.0, state->dataHeatBalFanSys->ZoneCO2LevelOccupiedHourBinsRepPeriod(1, 1)[2], 1e-8); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; + state->dataHeatBal->People(1).sched->currentVal = 1.0; state->dataContaminantBalance->ZoneAirCO2Avg(1) = 2000; for (int hour = 9; hour <= 10; hour++) { state->dataGlobal->HourOfDay = hour; @@ -4326,7 +4331,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestCO2ResilienceReportRepPe EXPECT_NEAR(5.0, state->dataHeatBalFanSys->ZoneCO2LevelOccupiedHourBinsRepPeriod(1, 1)[1], 1e-8); EXPECT_NEAR(1.0, state->dataHeatBalFanSys->ZoneCO2LevelOccupiedHourBinsRepPeriod(1, 1)[2], 1e-8); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; + state->dataHeatBal->People(1).sched->currentVal = 1.0; state->dataContaminantBalance->ZoneAirCO2Avg(1) = 1500; for (int hour = 13; hour <= 18; hour++) { state->dataGlobal->HourOfDay = hour; @@ -4389,8 +4394,8 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestVisualResilienceReportRe state->dataGlobal->KindOfSim = Constant::KindOfSim::RunPeriodWeather; state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 1; - state->dataGlobal->NumOfTimeStepInHour = 4; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized + state->dataGlobal->TimeStepsInHour = 4; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 15; // must initialize this to get schedules initialized state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStepZone = 1; @@ -4402,7 +4407,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestVisualResilienceReportRe state->dataHeatBal->People.allocate(state->dataHeatBal->TotPeople); state->dataHeatBal->People(1).ZonePtr = 1; state->dataHeatBal->People(1).NumberOfPeople = 2; - state->dataHeatBal->People(1).NumberOfPeoplePtr = 1; + state->dataHeatBal->People(1).sched = Sched::AddScheduleConstant(*state, "Occupancy"); state->dataDayltg->ZoneDaylight.allocate(state->dataGlobal->NumOfZones); int totDaylightingControls = state->dataGlobal->NumOfZones; @@ -4426,9 +4431,8 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestVisualResilienceReportRe } state->dataOutRptTab->displayVisualResilienceSummary = true; - state->dataScheduleMgr->Schedule.allocate(1); - state->dataScheduleMgr->Schedule(1).CurrentValue = 0; + state->dataHeatBal->People(1).sched->currentVal = 0; state->dataDayltg->daylightControl(1).refPts(1).illumSetPoint = 250; for (int hour = 1; hour <= 4; hour++) { state->dataGlobal->HourOfDay = hour; @@ -4448,7 +4452,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestVisualResilienceReportRe EXPECT_NEAR(0.0, state->dataHeatBalFanSys->ZoneLightingLevelOccupiedHourBinsRepPeriod(1, 1)[2], 1e-8); EXPECT_NEAR(0.0, state->dataHeatBalFanSys->ZoneLightingLevelOccupiedHourBinsRepPeriod(1, 1)[3], 1e-8); - state->dataScheduleMgr->Schedule(1).CurrentValue = 0.4; + state->dataHeatBal->People(1).sched->currentVal = 0.4; state->dataDayltg->daylightControl(1).refPts(1).illumSetPoint = 600; for (int hour = 5; hour <= 7; hour++) { state->dataGlobal->HourOfDay = hour; @@ -4468,7 +4472,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestVisualResilienceReportRe EXPECT_NEAR(0.0, state->dataHeatBalFanSys->ZoneLightingLevelOccupiedHourBinsRepPeriod(1, 1)[2], 1e-8); EXPECT_NEAR(3.0, state->dataHeatBalFanSys->ZoneLightingLevelOccupiedHourBinsRepPeriod(1, 1)[3], 1e-8); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; + state->dataHeatBal->People(1).sched->currentVal = 1.0; state->dataDayltg->daylightControl(1).refPts(1).illumSetPoint = 70; for (int hour = 8; hour <= 10; hour++) { state->dataGlobal->HourOfDay = hour; @@ -4488,7 +4492,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestVisualResilienceReportRe EXPECT_NEAR(0.0, state->dataHeatBalFanSys->ZoneLightingLevelOccupiedHourBinsRepPeriod(1, 1)[2], 1e-8); EXPECT_NEAR(3.0, state->dataHeatBalFanSys->ZoneLightingLevelOccupiedHourBinsRepPeriod(1, 1)[3], 1e-8); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; + state->dataHeatBal->People(1).sched->currentVal = 1.0; state->dataDayltg->daylightControl(1).refPts(1).illumSetPoint = 600; for (int hour = 13; hour <= 15; hour++) { state->dataGlobal->HourOfDay = hour; @@ -4508,7 +4512,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestVisualResilienceReportRe EXPECT_NEAR(0.0, state->dataHeatBalFanSys->ZoneLightingLevelOccupiedHourBinsRepPeriod(1, 2)[2], 1e-8); EXPECT_NEAR(3.0, state->dataHeatBalFanSys->ZoneLightingLevelOccupiedHourBinsRepPeriod(1, 2)[3], 1e-8); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; + state->dataHeatBal->People(1).sched->currentVal = 1.0; state->dataDayltg->daylightControl(1).refPts(1).illumSetPoint = 70; for (int hour = 16; hour <= 18; hour++) { state->dataGlobal->HourOfDay = hour; @@ -4804,10 +4808,11 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestInitHBInterzoneWindow) " 1,1,1; !- X,Y,Z ==> Vertex 4 {m}"}); ASSERT_TRUE(process_idf(idf_objects)); - bool ErrorsFound = false; + state->init_state(*state); - HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); - EXPECT_FALSE(ErrorsFound); + bool ErrorsFound = false; + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); // read project control data + EXPECT_FALSE(ErrorsFound); // expect no errors HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); Material::GetMaterialData(*state, ErrorsFound); @@ -4882,7 +4887,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_IncSolarMultiplier) state->dataSurface->surfShades.allocate(totSurf); state->dataConstruction->Construct.allocate(totConstructs); state->dataGlobal->TimeStepZoneSec = 900; - state->dataGlobal->NumOfTimeStepInHour = 6; + state->dataGlobal->TimeStepsInHour = 6; state->dataGlobal->HourOfDay = 1; state->dataGlobal->TimeStep = 1; @@ -4894,7 +4899,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_IncSolarMultiplier) state->dataSurface->SurfIncSolMultiplier.allocate(totSurf); state->dataSurface->SurfIncSolMultiplier(SurfNum).Name = "testing window surface"; state->dataSurface->SurfIncSolMultiplier(SurfNum).SurfaceIdx = SurfNum; - state->dataSurface->SurfIncSolMultiplier(SurfNum).SchedPtr = 0; + state->dataSurface->SurfIncSolMultiplier(SurfNum).sched = nullptr; state->dataSurface->Surface(SurfNum).Area = 100.0; @@ -4909,10 +4914,13 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_IncSolarMultiplier) int ConstrNum = 1; state->dataSurface->Surface(SurfNum).Construction = ConstrNum; + auto &constr = state->dataConstruction->Construct(ConstrNum); + state->dataSurface->SurfActiveConstruction(SurfNum) = state->dataSurface->Surface(SurfNum).Construction; state->dataConstruction->Construct(ConstrNum).TransDiff = 0.1; - state->dataConstruction->Construct(ConstrNum).TransSolBeamCoef = 0.1; - state->dataConstruction->Construct(ConstrNum).TransSolBeamCoef = 0.2; + // Why is this being written and immediately overwritten? + std::fill(constr.TransSolBeamCoef.begin(), constr.TransSolBeamCoef.end(), 0.1); + std::fill(constr.TransSolBeamCoef.begin(), constr.TransSolBeamCoef.end(), 0.2); state->dataSurface->SurfaceWindow.allocate(totSurf); state->dataSurface->SurfaceWindow(SurfNum).OutProjSLFracMult[state->dataGlobal->HourOfDay] = 999.0; @@ -5284,10 +5292,11 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestInitHBDaylightingNoExtWi std::string const idf_objects = idf_objects1 + idf_objects2; ASSERT_TRUE(process_idf(idf_objects)); - bool ErrorsFound = false; + state->init_state(*state); - HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); - EXPECT_FALSE(ErrorsFound); + bool ErrorsFound = false; + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); // read project control data + EXPECT_FALSE(ErrorsFound); // expect no errors HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); Material::GetMaterialData(*state, ErrorsFound); @@ -5312,7 +5321,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestInitHBDaylightingNoExtWi state->dataGlobal->BeginSimFlag = true; state->dataGlobal->KickOffSimulation = true; state->dataGlobal->TimeStepZoneSec = 900; - state->dataGlobal->NumOfTimeStepInHour = 6; + state->dataGlobal->TimeStepsInHour = 6; state->dataGlobal->HourOfDay = 1; state->dataGlobal->TimeStep = 1; @@ -5868,10 +5877,12 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestTDDSurfWinHeatGain) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + bool ErrorsFound = false; - HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); - EXPECT_FALSE(ErrorsFound); + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); // read project control data + EXPECT_FALSE(ErrorsFound); // expect no errors HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); Material::GetMaterialData(*state, ErrorsFound); @@ -5884,10 +5895,10 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestTDDSurfWinHeatGain) state->dataSurfaceGeometry->CosZoneRelNorth.allocate(2); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(2); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; int const HoursInDay(24); @@ -6449,12 +6460,9 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfPropertyViewFactorsI }); ASSERT_TRUE(process_idf(idf_objects)); - bool ErrorsFound = false; - - ScheduleManager::ProcessScheduleInput(*state); + state->init_state(*state); - HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); - EXPECT_FALSE(ErrorsFound); + bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); Material::GetMaterialData(*state, ErrorsFound); @@ -7008,12 +7016,11 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfPropertySurfToGndLWR }); ASSERT_TRUE(process_idf(idf_objects)); - bool ErrorsFound = false; + state->init_state(*state); - ScheduleManager::ProcessScheduleInput(*state); - - HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); - EXPECT_FALSE(ErrorsFound); + bool ErrorsFound = false; + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); // read project control data + EXPECT_FALSE(ErrorsFound); // expect no errors HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); Material::GetMaterialData(*state, ErrorsFound); @@ -7137,9 +7144,9 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfPropertySurfToGndLWR // call to reset surface view factors InitSurfaceHeatBalance(*state); state->dataSurface->SurfAirSkyRadSplit.allocate(6); - state->dataScheduleMgr->Schedule(1).CurrentValue = 25.0; // Srd Srfs Temp - state->dataScheduleMgr->Schedule(2).CurrentValue = 15.0; // Sky temp - state->dataScheduleMgr->Schedule(3).CurrentValue = 22.0; // Grd temp + Sched::GetSchedule(*state, "SURROUNDING TEMP SCH 1")->currentVal = 25.0; // Srd Srfs Temp + Sched::GetSchedule(*state, "SKY TEMP SCH")->currentVal = 15.0; // Sky temp + Sched::GetSchedule(*state, "GROUND TEMP SCH")->currentVal = 22.0; // Grd temp for (int SurfNum = 1; SurfNum <= 6; SurfNum++) { state->dataHeatBalSurf->SurfOutsideTempHist(1)(SurfNum) = 20; // Surf temp @@ -7360,16 +7367,17 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestGroundSurfsAverageTemp) " autocalculate; !- Volume {m3}"}); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepZone = 1; + state->dataGlobal->TimeStepZoneSec = 3600.0; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); // set global and environmental variables state->dataGlobal->BeginSimFlag = true; state->dataGlobal->BeginEnvrnFlag = true; state->dataGlobal->HourOfDay = 15; state->dataGlobal->TimeStep = 1; - state->dataGlobal->TimeStepZone = 1; - state->dataGlobal->TimeStepZoneSec = 3600.0; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; state->dataEnvrn->Month = 7; state->dataEnvrn->DayOfMonth = 21; state->dataEnvrn->DSTIndicator = 0; @@ -7378,10 +7386,6 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestGroundSurfsAverageTemp) state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); state->dataEnvrn->OutBaroPress = 100000; - // update schedule values - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; - state->dataHeatBal->ZoneIntGain.allocate(1); createFacilityElectricPowerServiceObject(*state); HeatBalanceManager::SetPreConstructionInputParameters(*state); @@ -7420,12 +7424,12 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestGroundSurfsAverageTemp) EXPECT_DOUBLE_EQ(0.1, GndSurfsProperty.GndSurfs(3).ViewFactor); EXPECT_DOUBLE_EQ(0.4, GndSurfsProperty.SurfsViewFactorSum); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // check ground temperature values - Real64 const Tgndsurf_grass = ScheduleManager::GetCurrentScheduleValue(*state, GndSurfsProperty.GndSurfs(1).TempSchPtr); - Real64 const Tgndsurf_parking = ScheduleManager::GetCurrentScheduleValue(*state, GndSurfsProperty.GndSurfs(2).TempSchPtr); - Real64 const Tgndsurf_lake = ScheduleManager::GetCurrentScheduleValue(*state, GndSurfsProperty.GndSurfs(3).TempSchPtr); + Real64 const Tgndsurf_grass = GndSurfsProperty.GndSurfs(1).tempSched->getCurrentVal(); + Real64 const Tgndsurf_parking = GndSurfsProperty.GndSurfs(2).tempSched->getCurrentVal(); + Real64 const Tgndsurf_lake = GndSurfsProperty.GndSurfs(3).tempSched->getCurrentVal(); EXPECT_DOUBLE_EQ(25.0, Tgndsurf_grass); EXPECT_DOUBLE_EQ(28.0, Tgndsurf_parking); EXPECT_DOUBLE_EQ(22.0, Tgndsurf_lake); @@ -7681,16 +7685,17 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestGroundSurfsAverageRefl) " autocalculate; !- Volume {m3}"}); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStepZone = 1; + state->dataGlobal->TimeStepZoneSec = 3600.0; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); // set global and environmental variables state->dataGlobal->BeginSimFlag = true; state->dataGlobal->BeginEnvrnFlag = true; state->dataGlobal->HourOfDay = 15; - state->dataGlobal->TimeStep = 1; - state->dataGlobal->TimeStepZone = 1; - state->dataGlobal->TimeStepZoneSec = 3600.0; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; state->dataEnvrn->Month = 7; state->dataEnvrn->DayOfMonth = 21; state->dataEnvrn->DSTIndicator = 0; @@ -7699,10 +7704,6 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestGroundSurfsAverageRefl) state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); state->dataEnvrn->OutBaroPress = 100000; - // update schedule values - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; - state->dataHeatBal->ZoneIntGain.allocate(1); createFacilityElectricPowerServiceObject(*state); HeatBalanceManager::SetPreConstructionInputParameters(*state); @@ -7741,12 +7742,12 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestGroundSurfsAverageRefl) EXPECT_DOUBLE_EQ(0.1, GndSurfsProperty.GndSurfs(3).ViewFactor); EXPECT_DOUBLE_EQ(0.4, GndSurfsProperty.SurfsViewFactorSum); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // check ground temperature values - Real64 const Rgndsurf_grass = ScheduleManager::GetCurrentScheduleValue(*state, GndSurfsProperty.GndSurfs(1).ReflSchPtr); - Real64 const Rgndsurf_parking = ScheduleManager::GetCurrentScheduleValue(*state, GndSurfsProperty.GndSurfs(2).ReflSchPtr); - Real64 const Rgndsurf_lake = ScheduleManager::GetCurrentScheduleValue(*state, GndSurfsProperty.GndSurfs(3).ReflSchPtr); + Real64 const Rgndsurf_grass = GndSurfsProperty.GndSurfs(1).reflSched->getCurrentVal(); + Real64 const Rgndsurf_parking = GndSurfsProperty.GndSurfs(2).reflSched->getCurrentVal(); + Real64 const Rgndsurf_lake = GndSurfsProperty.GndSurfs(3).reflSched->getCurrentVal(); EXPECT_DOUBLE_EQ(0.25, Rgndsurf_grass); EXPECT_DOUBLE_EQ(0.5, Rgndsurf_parking); EXPECT_DOUBLE_EQ(0.1, Rgndsurf_lake); @@ -8254,10 +8255,9 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfPropertyViewFactorsR }); ASSERT_TRUE(process_idf(idf_objects)); - bool ErrorsFound = false; - - ScheduleManager::ProcessScheduleInput(*state); + state->init_state(*state); + bool ErrorsFound = false; HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); HeatBalanceManager::GetZoneData(*state, ErrorsFound); @@ -8500,13 +8500,13 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestUpdateVariableAbsorptanc }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); + Curve::GetCurveInput(*state); EXPECT_EQ(state->dataCurveManager->PerfCurve(1)->Name, "SOLAR_ABSORPTANCE_CURVE"); EXPECT_EQ(state->dataCurveManager->PerfCurve(2)->Name, "THERMAL_ABSORPTANCE_TABLE"); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules - state->dataScheduleMgr->ScheduleInputProcessed = true; state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataGlobal->HourOfDay = 1; @@ -8515,7 +8515,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestUpdateVariableAbsorptanc state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); state->dataSurface->Surface.allocate(3); state->dataSurface->Surface(1).Name = "SURF_1_WALL_1"; state->dataSurface->Surface(1).Construction = 1; @@ -8544,7 +8544,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestUpdateVariableAbsorptanc mat2->Name = "WALL_2"; mat2->group = Material::Group::Regular; mat2->absorpVarCtrlSignal = Material::VariableAbsCtrlSignal::Scheduled; - mat2->absorpThermalVarSchedIdx = 1; + mat2->absorpThermalVarSched = Sched::GetSchedule(*state, "THERMAL_ABS_SCH"); s_mat->materials.push_back(mat2); state->dataCurveManager->allocateCurveVector(2); @@ -8869,15 +8869,17 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_SurroundingSurfacesTempTest) bool ErrorsFound = false; ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepZone = 1; + state->dataGlobal->TimeStepZoneSec = 3600.0; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + // set global and environmental variables state->dataGlobal->BeginSimFlag = true; state->dataGlobal->BeginEnvrnFlag = true; state->dataGlobal->HourOfDay = 15; state->dataGlobal->TimeStep = 1; - state->dataGlobal->TimeStepZone = 1; - state->dataGlobal->TimeStepZoneSec = 3600.0; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; state->dataEnvrn->Month = 7; state->dataEnvrn->DayOfMonth = 21; state->dataEnvrn->DSTIndicator = 0; @@ -8885,9 +8887,6 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_SurroundingSurfacesTempTest) state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); state->dataEnvrn->OutBaroPress = 101325; - // process schedules - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; state->dataHeatBal->ZoneIntGain.allocate(1); createFacilityElectricPowerServiceObject(*state); @@ -8911,13 +8910,13 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_SurroundingSurfacesTempTest) int srdSurfsNum = state->dataSurface->Surface(surfNum).SurfSurroundingSurfacesNum; auto &srdSurfsProperty = state->dataSurface->SurroundingSurfsProperty(srdSurfsNum); // update schedule values for surrounding surfaces temperature - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); GetSurroundingSurfacesTemperatureAverage(*state); // calculate surrounding surfaces average temperature Real64 SrdSurfaceTemp = 0.0; Real64 SrdSurfaceTempSum = 0.0; for (auto &surdSurfs : srdSurfsProperty.SurroundingSurfs) { - SrdSurfaceTemp = ScheduleManager::GetCurrentScheduleValue(*state, surdSurfs.TempSchNum) + Constant::Kelvin; + SrdSurfaceTemp = surdSurfs.tempSched->getCurrentVal() + Constant::Kelvin; SrdSurfaceTempSum += surdSurfs.ViewFactor * pow_4(SrdSurfaceTemp); } Real64 srdSurfacesTemp_result = root_4(SrdSurfaceTempSum / surface.ViewFactorSrdSurfs) - Constant::Kelvin; diff --git a/tst/EnergyPlus/unit/HeatPumpWaterToWaterSimple.unit.cc b/tst/EnergyPlus/unit/HeatPumpWaterToWaterSimple.unit.cc index 1f37e659874..58933676dc9 100644 --- a/tst/EnergyPlus/unit/HeatPumpWaterToWaterSimple.unit.cc +++ b/tst/EnergyPlus/unit/HeatPumpWaterToWaterSimple.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -735,10 +735,10 @@ TEST_F(EnergyPlusFixture, PlantLoopSourceSideTest) ASSERT_TRUE(process_idf(idf_objects)); SimulationManager::PostIPProcessing(*state); + state->init_state(*state); bool ErrorsFound = false; state->dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(*state); OutputReportPredefined::SetPredefinedTables(*state); HeatBalanceManager::SetPreConstructionInputParameters(*state); // establish array bounds for constructions early @@ -794,7 +794,7 @@ TEST_F(EnergyPlusFixture, PlantLoopSourceSideTest) state->dataGlobal->BeginHourFlag = true; state->dataGlobal->EndHourFlag = false; - for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->NumOfTimeStepInHour; + for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->TimeStepsInHour; ++state->dataGlobal->TimeStep) { state->dataGlobal->BeginTimeStepFlag = true; @@ -806,7 +806,7 @@ TEST_F(EnergyPlusFixture, PlantLoopSourceSideTest) // Note also that BeginTimeStepFlag, EndTimeStepFlag, and the // SubTimeStepFlags can/will be set/reset in the HVAC Manager. - if (state->dataGlobal->TimeStep == state->dataGlobal->NumOfTimeStepInHour) { + if (state->dataGlobal->TimeStep == state->dataGlobal->TimeStepsInHour) { state->dataGlobal->EndHourFlag = true; if (state->dataGlobal->HourOfDay == 24) { state->dataGlobal->EndDayFlag = true; @@ -1514,10 +1514,11 @@ TEST_F(EnergyPlusFixture, WWHP_AutosizeTest1) ASSERT_TRUE(process_idf(idf_objects)); SimulationManager::PostIPProcessing(*state); + state->init_state(*state); + bool ErrorsFound = false; state->dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(*state); OutputReportPredefined::SetPredefinedTables(*state); HeatBalanceManager::SetPreConstructionInputParameters(*state); // establish array bounds for constructions early diff --git a/tst/EnergyPlus/unit/HeatRecovery.unit.cc b/tst/EnergyPlus/unit/HeatRecovery.unit.cc index d1155a8d8d3..70d88ff9750 100644 --- a/tst/EnergyPlus/unit/HeatRecovery.unit.cc +++ b/tst/EnergyPlus/unit/HeatRecovery.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -85,6 +85,7 @@ using namespace EnergyPlus::SimulationManager; TEST_F(EnergyPlusFixture, HeatRecovery_HRTest) { + state->init_state(*state); state->dataSize->CurZoneEqNum = 0; state->dataSize->CurSysNum = 0; state->dataSize->CurOASysNum = 0; @@ -117,7 +118,7 @@ TEST_F(EnergyPlusFixture, HeatRecovery_HRTest) state->dataHeatRecovery->ExchCond(ExchNum).SupOutletNode = 2; state->dataHeatRecovery->ExchCond(ExchNum).SecInletNode = 3; state->dataHeatRecovery->ExchCond(ExchNum).SecOutletNode = 4; - state->dataHeatRecovery->ExchCond(ExchNum).SchedPtr = -1; + state->dataHeatRecovery->ExchCond(ExchNum).availSched = Sched::GetScheduleAlwaysOn(*state); state->dataHeatRecovery->ExchCond(ExchNum).HeatEffectSensible100 = 0.75; state->dataHeatRecovery->ExchCond(ExchNum).HeatEffectLatent100 = 0.0; state->dataHeatRecovery->ExchCond(ExchNum).CoolEffectSensible100 = 0.75; @@ -504,6 +505,7 @@ TEST_F(EnergyPlusFixture, HeatRecoveryHXOnManinBranch_GetInputTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetReturnAirPathInput(*state); GetAirPathData(*state); @@ -3920,6 +3922,7 @@ TEST_F(EnergyPlusFixture, HeatRecoveryHXOnMainBranch_SimHeatRecoveryTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // OutputProcessor::TimeValue.allocate(2); // ManageSimulation(*state); // run the design day @@ -4026,6 +4029,7 @@ TEST_F(EnergyPlusFixture, HeatRecovery_AirFlowSizing) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // get heat recovery heat exchanger generic GetHeatRecoveryInput(*state); @@ -4145,8 +4149,8 @@ TEST_F(EnergyPlusFixture, HeatRecovery_HeatExchangerGenericCalcTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); - ScheduleManager::ProcessScheduleInput(*state); // get OA Controller MixedAir::GetOAControllerInputs(*state); int OAContrllerNum = 1; @@ -4259,6 +4263,7 @@ TEST_F(EnergyPlusFixture, HeatRecovery_NominalAirFlowAutosizeTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // get HR HX generic GetHeatRecoveryInput(*state); diff --git a/tst/EnergyPlus/unit/HeatingCoils.unit.cc b/tst/EnergyPlus/unit/HeatingCoils.unit.cc index c5c76e78a85..290f6bd7535 100644 --- a/tst/EnergyPlus/unit/HeatingCoils.unit.cc +++ b/tst/EnergyPlus/unit/HeatingCoils.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -76,6 +76,7 @@ TEST_F(EnergyPlusFixture, HeatingCoils_FuelTypeInput) " Air Loop Outlet Node; !- Air Outlet Node Name"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); ASSERT_NO_THROW(HeatingCoils::GetHeatingCoilInput(*state)); @@ -94,6 +95,7 @@ TEST_F(EnergyPlusFixture, HeatingCoils_FuelTypeInputError) " Air Loop Outlet Node; !- Air Outlet Node Name"}); EXPECT_FALSE(process_idf(idf_objects, false)); + state->init_state(*state); ASSERT_THROW(HeatingCoils::GetHeatingCoilInput(*state), std::runtime_error); std::string const error_string = delimited_string({ @@ -120,7 +122,7 @@ TEST_F(EnergyPlusFixture, HeatingCoils_FuelTypeCoal) " Air Loop Outlet Node; !- Air Outlet Node Name"}); ASSERT_TRUE(process_idf(idf_objects)); - + state->init_state(*state); ASSERT_NO_THROW(HeatingCoils::GetHeatingCoilInput(*state)); EXPECT_ENUM_EQ(state->dataHeatingCoils->HeatingCoil(1).FuelType, Constant::eFuel::Coal); @@ -138,6 +140,7 @@ TEST_F(EnergyPlusFixture, HeatingCoils_FuelTypePropaneGas) " Air Loop Outlet Node; !- Air Outlet Node Name"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); ASSERT_NO_THROW(HeatingCoils::GetHeatingCoilInput(*state)); @@ -147,6 +150,8 @@ TEST_F(EnergyPlusFixture, HeatingCoils_FuelTypePropaneGas) TEST_F(EnergyPlusFixture, HeatingCoils_OutletAirPropertiesTest) { // 7391 Test outlet air properties for MultiStageGasHeatingCoil + state->init_state(*state); + int CoilNum = 1; Real64 OffMassFlowrate = 0.2; Real64 OnMassFlowrate = 0.6; @@ -157,9 +162,7 @@ TEST_F(EnergyPlusFixture, HeatingCoils_OutletAirPropertiesTest) state->dataHeatingCoils->HeatingCoil(CoilNum).InletAirEnthalpy = Psychrometrics::PsyHFnTdbW( state->dataHeatingCoils->HeatingCoil(CoilNum).InletAirTemp, state->dataHeatingCoils->HeatingCoil(CoilNum).InletAirHumRat); state->dataEnvrn->OutBaroPress = 101325.0; - state->dataHeatingCoils->HeatingCoil(CoilNum).SchedPtr = 1; - state->dataScheduleMgr->Schedule.allocate(1); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; + state->dataHeatingCoils->HeatingCoil(CoilNum).availSched = Sched::GetScheduleAlwaysOn(*state); state->dataHVACGlobal->MSHPMassFlowRateLow = OnMassFlowrate; state->dataHeatingCoils->HeatingCoil(CoilNum).MSNominalCapacity.allocate(1); state->dataHeatingCoils->HeatingCoil(CoilNum).MSNominalCapacity(1) = 10000; diff --git a/tst/EnergyPlus/unit/HighTempRadiantSystem.unit.cc b/tst/EnergyPlus/unit/HighTempRadiantSystem.unit.cc index 6f175d21ba8..0093c321c11 100644 --- a/tst/EnergyPlus/unit/HighTempRadiantSystem.unit.cc +++ b/tst/EnergyPlus/unit/HighTempRadiantSystem.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -95,6 +95,7 @@ TEST_F(EnergyPlusFixture, HighTempRadiantSystemTest_GetHighTempRadiantSystem) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataHeatBal->Zone.allocate(1); state->dataHeatBal->Zone(1).Name = "ZONE1"; @@ -109,8 +110,8 @@ TEST_F(EnergyPlusFixture, HighTempRadiantSystemTest_GetHighTempRadiantSystem) GetHighTempRadiantSystem(*state, ErrorsFound); std::string const error_string01 = - delimited_string({" ** Severe ** Heating Setpoint Temperature Schedule Name not found: RADIANT HEATING SETPOINTS", - " ** ~~~ ** Occurs for ZoneHVAC:HighTemperatureRadiant = ZONERADHEATER", + delimited_string({" ** Severe ** GetHighTempRadiantSystem: ZoneHVAC:HighTemperatureRadiant = ZONERADHEATER", + " ** ~~~ ** Heating Setpoint Temperature Schedule Name = RADIANT HEATING SETPOINTS, item not found.", " ** Severe ** Fraction of radiation distributed to surfaces and people sums up to less than 1 for ZONERADHEATER", " ** ~~~ ** This would result in some of the radiant energy delivered by the high temp radiant heater being lost.", " ** ~~~ ** The sum of all radiation fractions to surfaces = 0.80000", @@ -129,6 +130,7 @@ TEST_F(EnergyPlusFixture, HighTempRadiantSystemTest_GetHighTempRadiantSystem) TEST_F(EnergyPlusFixture, HighTempRadiantSystemTest_SizeHighTempRadiantSystemScalableFlagSetTest) { + state->init_state(*state); int RadSysNum; int SizingTypesNum; diff --git a/tst/EnergyPlus/unit/Humidifiers.unit.cc b/tst/EnergyPlus/unit/Humidifiers.unit.cc index c37958c73c6..3674f6022ae 100644 --- a/tst/EnergyPlus/unit/Humidifiers.unit.cc +++ b/tst/EnergyPlus/unit/Humidifiers.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -86,8 +86,7 @@ TEST_F(EnergyPlusFixture, Humidifiers_Sizing) thisHum.ThermalEffRated = 1.0; thisHum.FanPower = 0.0; thisHum.StandbyPower = 0.0; - thisHum.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - thisHum.SchedPtr = ScheduleManager::ScheduleAlwaysOn; + thisHum.availSched = Sched::GetScheduleAlwaysOn(*state); state->dataSize->FinalSysSizing.allocate(state->dataSize->CurSysNum); state->dataSize->FinalSysSizing(state->dataSize->CurSysNum).MixTempAtCoolPeak = 30.0; @@ -122,8 +121,7 @@ TEST_F(EnergyPlusFixture, Humidifiers_AutoSizing) thisHum.ThermalEffRated = 0.80; thisHum.FanPower = 0.0; thisHum.StandbyPower = 0.0; - thisHum.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - thisHum.SchedPtr = ScheduleManager::ScheduleAlwaysOn; + thisHum.availSched = Sched::GetScheduleAlwaysOn(*state); state->dataSize->FinalSysSizing.allocate(state->dataSize->CurSysNum); state->dataSize->FinalSysSizing(state->dataSize->CurSysNum).MixTempAtCoolPeak = 30.0; @@ -152,7 +150,7 @@ TEST_F(EnergyPlusFixture, Humidifiers_EnergyUse) HumidifierData thisHum; state->dataHVACGlobal->TimeStepSys = 0.25; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->dataSize->SysSizingRunDone = true; state->dataSize->CurSysNum = 1; @@ -167,8 +165,7 @@ TEST_F(EnergyPlusFixture, Humidifiers_EnergyUse) thisHum.ThermalEffRated = 1.0; thisHum.FanPower = 0.0; thisHum.StandbyPower = 0.0; - thisHum.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - thisHum.SchedPtr = ScheduleManager::ScheduleAlwaysOn; + thisHum.availSched = Sched::GetScheduleAlwaysOn(*state); state->dataSize->FinalSysSizing.allocate(state->dataSize->CurSysNum); state->dataSize->FinalSysSizing(state->dataSize->CurSysNum).MixTempAtCoolPeak = 20.0; @@ -231,6 +228,7 @@ TEST_F(EnergyPlusFixture, Humidifiers_GetHumidifierInput) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetHumidifierInput(*state); ASSERT_EQ(1, state->dataHumidifiers->NumHumidifiers); @@ -240,11 +238,11 @@ TEST_F(EnergyPlusFixture, Humidifiers_GetHumidifierInput) TEST_F(EnergyPlusFixture, Humidifiers_ThermalEfficiency) { // tests thermal efficiency modifier curve use - + state->init_state(*state); HumidifierData thisHum; state->dataHVACGlobal->TimeStepSys = 0.25; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->dataSize->SysSizingRunDone = true; state->dataSize->CurSysNum = 1; @@ -259,8 +257,7 @@ TEST_F(EnergyPlusFixture, Humidifiers_ThermalEfficiency) thisHum.ThermalEffRated = 0.80; thisHum.FanPower = 0.0; thisHum.StandbyPower = 0.0; - thisHum.SchedPtr = ScheduleManager::ScheduleAlwaysOn; - thisHum.SchedPtr = ScheduleManager::ScheduleAlwaysOn; + thisHum.availSched = Sched::GetScheduleAlwaysOn(*state); state->dataSize->FinalSysSizing.allocate(state->dataSize->CurSysNum); state->dataSize->FinalSysSizing(state->dataSize->CurSysNum).MixTempAtCoolPeak = 20.0; @@ -289,6 +286,7 @@ TEST_F(EnergyPlusFixture, Humidifiers_ThermalEfficiency) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); thisHum.EfficiencyCurvePtr = Curve::GetCurveIndex(*state, "THERMALEFFICIENCYFPLR"); diff --git a/tst/EnergyPlus/unit/HybridModel.unit.cc b/tst/EnergyPlus/unit/HybridModel.unit.cc index 79351f7bf85..48eabeeb135 100644 --- a/tst/EnergyPlus/unit/HybridModel.unit.cc +++ b/tst/EnergyPlus/unit/HybridModel.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -91,17 +91,16 @@ using namespace EnergyPlus::DataLoopNode; using namespace EnergyPlus::DataSurfaces; using namespace EnergyPlus::DataEnvironment; using namespace EnergyPlus::Psychrometrics; -using namespace EnergyPlus::ScheduleManager; using namespace EnergyPlus::RoomAir; using namespace EnergyPlus::HybridModel; using namespace EnergyPlus::DataPrecisionGlobals; TEST_F(EnergyPlusFixture, HybridModel_correctZoneAirTempsTest) { - + state->init_state(*state); // ZoneTempPredictorCorrector variable initialization state->dataHeatBal->Zone.allocate(1); - state->dataHybridModel->HybridModelZone.allocate(1); + state->dataHybridModel->hybridModelZones.allocate(1); state->dataHybridModel->FlagHybridModel = true; state->dataRoomAir->AirModel.allocate(1); state->dataRoomAir->ZTOC.allocate(1); @@ -117,7 +116,6 @@ TEST_F(EnergyPlusFixture, HybridModel_correctZoneAirTempsTest) state->dataHeatBalFanSys->PreviousMeasuredHumRat1.allocate(1); state->dataHeatBalFanSys->PreviousMeasuredHumRat2.allocate(1); state->dataHeatBalFanSys->PreviousMeasuredHumRat3.allocate(1); - state->dataScheduleMgr->Schedule.allocate(6); // CalcZoneComponentLoadSums variable initialization state->dataSurface->SurfaceWindow.allocate(1); @@ -183,7 +181,7 @@ TEST_F(EnergyPlusFixture, HybridModel_correctZoneAirTempsTest) state->dataHeatBal->Zone(1).Volume = 1061.88; state->dataGlobal->TimeStepZone = 10.0 / 60.0; // Zone timestep in hours state->dataHVACGlobal->TimeStepSys = 10.0 / 60.0; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; Real64 ZoneTempChange; @@ -194,16 +192,16 @@ TEST_F(EnergyPlusFixture, HybridModel_correctZoneAirTempsTest) state->dataEnvrn->DayOfYear = 1; // Case 1: Hybrid model internal thermal mass (free-floating) - - state->dataHybridModel->HybridModelZone(1).InternalThermalMassCalc_T = true; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_T = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_H = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_C = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_T = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_H = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_C = false; - state->dataHybridModel->HybridModelZone(1).HybridStartDayOfYear = 1; - state->dataHybridModel->HybridModelZone(1).HybridEndDayOfYear = 2; + auto &hmZone = state->dataHybridModel->hybridModelZones(1); + hmZone.InternalThermalMassCalc_T = true; + hmZone.InfiltrationCalc_T = false; + hmZone.InfiltrationCalc_H = false; + hmZone.InfiltrationCalc_C = false; + hmZone.PeopleCountCalc_T = false; + hmZone.PeopleCountCalc_H = false; + hmZone.PeopleCountCalc_C = false; + hmZone.HybridStartDayOfYear = 1; + hmZone.HybridEndDayOfYear = 2; thisZoneHB.MAT = 0.0; state->dataHeatBalFanSys->PreviousMeasuredZT1(1) = 0.1; state->dataHeatBalFanSys->PreviousMeasuredZT2(1) = 0.2; @@ -219,15 +217,15 @@ TEST_F(EnergyPlusFixture, HybridModel_correctZoneAirTempsTest) // Case 2: Hybrid model infiltration with measured temperature (free-floating) - state->dataHybridModel->HybridModelZone(1).InternalThermalMassCalc_T = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_T = true; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_H = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_C = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_T = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_H = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_C = false; - state->dataHybridModel->HybridModelZone(1).HybridStartDayOfYear = 1; - state->dataHybridModel->HybridModelZone(1).HybridEndDayOfYear = 2; + hmZone.InternalThermalMassCalc_T = false; + hmZone.InfiltrationCalc_T = true; + hmZone.InfiltrationCalc_H = false; + hmZone.InfiltrationCalc_C = false; + hmZone.PeopleCountCalc_T = false; + hmZone.PeopleCountCalc_H = false; + hmZone.PeopleCountCalc_C = false; + hmZone.HybridStartDayOfYear = 1; + hmZone.HybridEndDayOfYear = 2; thisZoneHB.MAT = 0.0; state->dataHeatBalFanSys->PreviousMeasuredZT1(1) = 0.02; state->dataHeatBalFanSys->PreviousMeasuredZT2(1) = 0.04; @@ -244,15 +242,15 @@ TEST_F(EnergyPlusFixture, HybridModel_correctZoneAirTempsTest) // Case 3: Hybrid model infiltration with measured humidity ratio (free-floating) - state->dataHybridModel->HybridModelZone(1).InternalThermalMassCalc_T = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_T = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_H = true; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_C = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_T = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_H = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_C = false; - state->dataHybridModel->HybridModelZone(1).HybridStartDayOfYear = 1; - state->dataHybridModel->HybridModelZone(1).HybridEndDayOfYear = 2; + hmZone.InternalThermalMassCalc_T = false; + hmZone.InfiltrationCalc_T = false; + hmZone.InfiltrationCalc_H = true; + hmZone.InfiltrationCalc_C = false; + hmZone.PeopleCountCalc_T = false; + hmZone.PeopleCountCalc_H = false; + hmZone.PeopleCountCalc_C = false; + hmZone.HybridStartDayOfYear = 1; + hmZone.HybridEndDayOfYear = 2; state->dataHeatBal->Zone(1).Volume = 4000; state->dataHeatBal->Zone(1).OutDryBulbTemp = -10.62; state->dataHeatBal->Zone(1).ZoneVolCapMultpMoist = 1.0; @@ -262,8 +260,8 @@ TEST_F(EnergyPlusFixture, HybridModel_correctZoneAirTempsTest) state->dataHeatBalFanSys->PreviousMeasuredHumRat1(1) = 0.0011186324286; state->dataHeatBalFanSys->PreviousMeasuredHumRat2(1) = 0.0011172070768; state->dataHeatBalFanSys->PreviousMeasuredHumRat3(1) = 0.0011155109625; - state->dataHybridModel->HybridModelZone(1).ZoneMeasuredHumidityRatioSchedulePtr = 1; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZoneMeasuredHumidityRatioSchedulePtr).CurrentValue = 0.001120003; + hmZone.measuredHumRatSched = Sched::AddScheduleConstant(*state, "Measured HumRat 1"); + hmZone.measuredHumRatSched->currentVal = 0.001120003; thisZoneHB.MCPV = 539.49; thisZoneHB.MCPTV = 270.10; state->dataEnvrn->OutBaroPress = 99500; @@ -273,15 +271,15 @@ TEST_F(EnergyPlusFixture, HybridModel_correctZoneAirTempsTest) // Case 4: Hybrid model people count with measured temperature (free-floating) - state->dataHybridModel->HybridModelZone(1).InternalThermalMassCalc_T = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_T = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_H = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_C = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_T = true; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_H = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_C = false; - state->dataHybridModel->HybridModelZone(1).HybridStartDayOfYear = 1; - state->dataHybridModel->HybridModelZone(1).HybridEndDayOfYear = 2; + hmZone.InternalThermalMassCalc_T = false; + hmZone.InfiltrationCalc_T = false; + hmZone.InfiltrationCalc_H = false; + hmZone.InfiltrationCalc_C = false; + hmZone.PeopleCountCalc_T = true; + hmZone.PeopleCountCalc_H = false; + hmZone.PeopleCountCalc_C = false; + hmZone.HybridStartDayOfYear = 1; + hmZone.HybridEndDayOfYear = 2; thisZoneHB.MAT = -2.89; state->dataHeatBalFanSys->PreviousMeasuredZT1(1) = -2.887415174; @@ -293,23 +291,23 @@ TEST_F(EnergyPlusFixture, HybridModel_correctZoneAirTempsTest) state->dataEnvrn->OutBaroPress = 98916.7; thisZoneHB.MCPV = 5163.5; // Assign TempDepCoef thisZoneHB.MCPTV = -15956.8; // Assign TempIndCoef - state->dataHybridModel->HybridModelZone(1).ZoneMeasuredTemperatureSchedulePtr = 1; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZoneMeasuredTemperatureSchedulePtr).CurrentValue = -2.923892218; + hmZone.measuredTempSched = Sched::AddScheduleConstant(*state, "Measured Temp 1"); + hmZone.measuredTempSched->currentVal = -2.923892218; ZoneTempChange = correctZoneAirTemps(*state, true); EXPECT_NEAR(0, state->dataHeatBal->Zone(1).NumOccHM, 0.1); // Need to initialize SumIntGain // Case 5: Hybrid model people count with measured humidity ratio (free-floating) - state->dataHybridModel->HybridModelZone(1).InternalThermalMassCalc_T = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_T = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_H = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_C = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_T = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_H = true; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_C = false; - state->dataHybridModel->HybridModelZone(1).HybridStartDayOfYear = 1; - state->dataHybridModel->HybridModelZone(1).HybridEndDayOfYear = 2; + hmZone.InternalThermalMassCalc_T = false; + hmZone.InfiltrationCalc_T = false; + hmZone.InfiltrationCalc_H = false; + hmZone.InfiltrationCalc_C = false; + hmZone.PeopleCountCalc_T = false; + hmZone.PeopleCountCalc_H = true; + hmZone.PeopleCountCalc_C = false; + hmZone.HybridStartDayOfYear = 1; + hmZone.HybridEndDayOfYear = 2; state->dataHeatBal->Zone(1).Volume = 4000; state->dataHeatBal->Zone(1).OutDryBulbTemp = -10.62; state->dataHeatBal->Zone(1).ZoneVolCapMultpMoist = 1.0; @@ -323,25 +321,24 @@ TEST_F(EnergyPlusFixture, HybridModel_correctZoneAirTempsTest) state->dataHeatBalFanSys->PreviousMeasuredHumRat1(1) = 0.002496356; state->dataHeatBalFanSys->PreviousMeasuredHumRat2(1) = 0.002489048; state->dataHeatBalFanSys->PreviousMeasuredHumRat3(1) = 0.002480404; - state->dataHybridModel->HybridModelZone(1).ZoneMeasuredHumidityRatioSchedulePtr = 1; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZoneMeasuredHumidityRatioSchedulePtr).CurrentValue = - 0.002506251487737; + hmZone.measuredHumRatSched = Sched::GetSchedule(*state, "MEASURED HUMRAT 1"); + hmZone.measuredHumRatSched->currentVal = 0.002506251487737; thisZoneHB.correctHumRat(*state, 1); EXPECT_NEAR(4, state->dataHeatBal->Zone(1).NumOccHM, 0.1); // Case 6: Hybrid model infiltration with measured temperature (with HVAC) - state->dataHybridModel->HybridModelZone(1).InternalThermalMassCalc_T = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_T = true; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_H = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_C = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_T = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_H = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_C = false; - state->dataHybridModel->HybridModelZone(1).IncludeSystemSupplyParameters = true; - state->dataHybridModel->HybridModelZone(1).HybridStartDayOfYear = 1; - state->dataHybridModel->HybridModelZone(1).HybridEndDayOfYear = 2; + hmZone.InternalThermalMassCalc_T = false; + hmZone.InfiltrationCalc_T = true; + hmZone.InfiltrationCalc_H = false; + hmZone.InfiltrationCalc_C = false; + hmZone.PeopleCountCalc_T = false; + hmZone.PeopleCountCalc_H = false; + hmZone.PeopleCountCalc_C = false; + hmZone.IncludeSystemSupplyParameters = true; + hmZone.HybridStartDayOfYear = 1; + hmZone.HybridEndDayOfYear = 2; thisZoneHB.MAT = 15.56; state->dataHeatBalFanSys->PreviousMeasuredZT1(1) = 15.56; state->dataHeatBalFanSys->PreviousMeasuredZT2(1) = 15.56; @@ -353,28 +350,28 @@ TEST_F(EnergyPlusFixture, HybridModel_correctZoneAirTempsTest) thisZoneHB.MCPTV = 60650; // Assign TempIndCoef state->dataEnvrn->OutBaroPress = 99500; state->dataEnvrn->OutHumRat = 0.00113669; - state->dataHybridModel->HybridModelZone(1).ZoneMeasuredTemperatureSchedulePtr = 1; - state->dataHybridModel->HybridModelZone(1).ZoneSupplyAirTemperatureSchedulePtr = 2; - state->dataHybridModel->HybridModelZone(1).ZoneSupplyAirMassFlowRateSchedulePtr = 3; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZoneMeasuredTemperatureSchedulePtr).CurrentValue = 15.56; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZoneSupplyAirTemperatureSchedulePtr).CurrentValue = 50; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZoneSupplyAirMassFlowRateSchedulePtr).CurrentValue = 0.7974274; + hmZone.measuredTempSched = Sched::GetSchedule(*state, "MEASURED TEMP 1"); + hmZone.supplyAirTempSched = Sched::AddScheduleConstant(*state, "Supply Temp 1"); + hmZone.supplyAirMassFlowRateSched = Sched::AddScheduleConstant(*state, "Mass Flow Rate 1"); + hmZone.measuredTempSched->currentVal = 15.56; + hmZone.supplyAirTempSched->currentVal = 50; + hmZone.supplyAirMassFlowRateSched->currentVal = 0.7974274; ZoneTempChange = correctZoneAirTemps(*state, true); EXPECT_NEAR(0.49, state->dataHeatBal->Zone(1).InfilOAAirChangeRateHM, 0.01); // Case 7: Hybrid model infiltration with measured humidity ratio (with HVAC) - state->dataHybridModel->HybridModelZone(1).InternalThermalMassCalc_T = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_T = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_H = true; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_C = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_T = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_H = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_C = false; - state->dataHybridModel->HybridModelZone(1).IncludeSystemSupplyParameters = true; - state->dataHybridModel->HybridModelZone(1).HybridStartDayOfYear = 1; - state->dataHybridModel->HybridModelZone(1).HybridEndDayOfYear = 2; + hmZone.InternalThermalMassCalc_T = false; + hmZone.InfiltrationCalc_T = false; + hmZone.InfiltrationCalc_H = true; + hmZone.InfiltrationCalc_C = false; + hmZone.PeopleCountCalc_T = false; + hmZone.PeopleCountCalc_H = false; + hmZone.PeopleCountCalc_C = false; + hmZone.IncludeSystemSupplyParameters = true; + hmZone.HybridStartDayOfYear = 1; + hmZone.HybridEndDayOfYear = 2; state->dataHeatBal->Zone(1).Volume = 4000; state->dataHeatBal->Zone(1).OutDryBulbTemp = -10.62; state->dataHeatBal->Zone(1).ZoneVolCapMultpMoist = 1.0; @@ -384,12 +381,12 @@ TEST_F(EnergyPlusFixture, HybridModel_correctZoneAirTempsTest) state->dataHeatBalFanSys->PreviousMeasuredHumRat1(1) = 0.007855718; state->dataHeatBalFanSys->PreviousMeasuredHumRat2(1) = 0.007852847; state->dataHeatBalFanSys->PreviousMeasuredHumRat3(1) = 0.007850236; - state->dataHybridModel->HybridModelZone(1).ZoneMeasuredHumidityRatioSchedulePtr = 1; - state->dataHybridModel->HybridModelZone(1).ZoneSupplyAirHumidityRatioSchedulePtr = 2; - state->dataHybridModel->HybridModelZone(1).ZoneSupplyAirMassFlowRateSchedulePtr = 3; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZoneMeasuredHumidityRatioSchedulePtr).CurrentValue = 0.00792; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZoneSupplyAirHumidityRatioSchedulePtr).CurrentValue = 0.015; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZoneSupplyAirMassFlowRateSchedulePtr).CurrentValue = 0.8345; + hmZone.measuredHumRatSched = Sched::GetSchedule(*state, "MEASURED HUMRAT 1"); + hmZone.supplyAirHumRatSched = Sched::AddScheduleConstant(*state, "Supply HumRat 1"); + hmZone.supplyAirMassFlowRateSched = Sched::AddScheduleConstant(*state, "Supply Mass Flow Rate 1"); + hmZone.measuredHumRatSched->currentVal = 0.00792; + hmZone.supplyAirHumRatSched->currentVal = 0.015; + hmZone.supplyAirMassFlowRateSched->currentVal = 0.8345; state->dataEnvrn->OutBaroPress = 99500; thisZoneHB.correctHumRat(*state, 1); @@ -397,16 +394,16 @@ TEST_F(EnergyPlusFixture, HybridModel_correctZoneAirTempsTest) // Case 8: Hybrid model people count with measured temperature (with HVAC) - state->dataHybridModel->HybridModelZone(1).InternalThermalMassCalc_T = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_T = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_H = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_C = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_T = true; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_H = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_C = false; - state->dataHybridModel->HybridModelZone(1).IncludeSystemSupplyParameters = true; - state->dataHybridModel->HybridModelZone(1).HybridStartDayOfYear = 1; - state->dataHybridModel->HybridModelZone(1).HybridEndDayOfYear = 2; + hmZone.InternalThermalMassCalc_T = false; + hmZone.InfiltrationCalc_T = false; + hmZone.InfiltrationCalc_H = false; + hmZone.InfiltrationCalc_C = false; + hmZone.PeopleCountCalc_T = true; + hmZone.PeopleCountCalc_H = false; + hmZone.PeopleCountCalc_C = false; + hmZone.IncludeSystemSupplyParameters = true; + hmZone.HybridStartDayOfYear = 1; + hmZone.HybridEndDayOfYear = 2; thisZoneHB.MAT = -2.89; state->dataHeatBalFanSys->PreviousMeasuredZT1(1) = 21.11; state->dataHeatBalFanSys->PreviousMeasuredZT2(1) = 21.11; @@ -417,33 +414,33 @@ TEST_F(EnergyPlusFixture, HybridModel_correctZoneAirTempsTest) state->dataEnvrn->OutBaroPress = 98916.7; thisZoneHB.MCPV = 6616; // Assign TempDepCoef thisZoneHB.MCPTV = 138483.2; // Assign TempIndCoef - state->dataHybridModel->HybridModelZone(1).ZoneMeasuredTemperatureSchedulePtr = 1; - state->dataHybridModel->HybridModelZone(1).ZoneSupplyAirTemperatureSchedulePtr = 2; - state->dataHybridModel->HybridModelZone(1).ZoneSupplyAirMassFlowRateSchedulePtr = 3; - state->dataHybridModel->HybridModelZone(1).ZonePeopleActivityLevelSchedulePtr = 4; - state->dataHybridModel->HybridModelZone(1).ZonePeopleSensibleFractionSchedulePtr = 5; - state->dataHybridModel->HybridModelZone(1).ZonePeopleRadiationFractionSchedulePtr = 6; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZoneMeasuredTemperatureSchedulePtr).CurrentValue = 21.11; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZoneSupplyAirTemperatureSchedulePtr).CurrentValue = 50; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZoneSupplyAirMassFlowRateSchedulePtr).CurrentValue = 1.446145794; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZonePeopleActivityLevelSchedulePtr).CurrentValue = 120; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZonePeopleSensibleFractionSchedulePtr).CurrentValue = 0.6; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZonePeopleRadiationFractionSchedulePtr).CurrentValue = 0.3; + hmZone.measuredTempSched = Sched::GetSchedule(*state, "MEASURED TEMP 1"); + hmZone.supplyAirTempSched = Sched::GetSchedule(*state, "SUPPLY TEMP 1"); + hmZone.supplyAirMassFlowRateSched = Sched::GetSchedule(*state, "SUPPLY MASS FLOW RATE 1"); + hmZone.peopleActivityLevelSched = Sched::AddScheduleConstant(*state, "People Activity Level 1"); + hmZone.peopleSensibleFracSched = Sched::AddScheduleConstant(*state, "People Sensible Fraction 1"); + hmZone.peopleRadiantFracSched = Sched::AddScheduleConstant(*state, "People Radiation Fraction 1"); + hmZone.measuredTempSched->currentVal = 21.11; + hmZone.supplyAirTempSched->currentVal = 50; + hmZone.supplyAirMassFlowRateSched->currentVal = 1.446145794; + hmZone.peopleActivityLevelSched->currentVal = 120; + hmZone.peopleSensibleFracSched->currentVal = 0.6; + hmZone.peopleRadiantFracSched->currentVal = 0.3; ZoneTempChange = correctZoneAirTemps(*state, true); EXPECT_NEAR(0, state->dataHeatBal->Zone(1).NumOccHM, 0.1); // Need to initialize SumIntGain // Case 9: Hybrid model people count with measured humidity ratio (with HVAC) - state->dataHybridModel->HybridModelZone(1).InternalThermalMassCalc_T = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_T = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_H = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_C = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_T = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_H = true; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_C = false; - state->dataHybridModel->HybridModelZone(1).IncludeSystemSupplyParameters = true; - state->dataHybridModel->HybridModelZone(1).HybridStartDayOfYear = 1; - state->dataHybridModel->HybridModelZone(1).HybridEndDayOfYear = 2; + hmZone.InternalThermalMassCalc_T = false; + hmZone.InfiltrationCalc_T = false; + hmZone.InfiltrationCalc_H = false; + hmZone.InfiltrationCalc_C = false; + hmZone.PeopleCountCalc_T = false; + hmZone.PeopleCountCalc_H = true; + hmZone.PeopleCountCalc_C = false; + hmZone.IncludeSystemSupplyParameters = true; + hmZone.HybridStartDayOfYear = 1; + hmZone.HybridEndDayOfYear = 2; state->dataHeatBal->Zone(1).Volume = 4000; state->dataHeatBal->Zone(1).OutDryBulbTemp = -10.62; state->dataHeatBal->Zone(1).ZoneVolCapMultpMoist = 1.0; @@ -453,18 +450,18 @@ TEST_F(EnergyPlusFixture, HybridModel_correctZoneAirTempsTest) state->dataHeatBalFanSys->PreviousMeasuredHumRat1(1) = 0.011085257; state->dataHeatBalFanSys->PreviousMeasuredHumRat2(1) = 0.011084959; state->dataHeatBalFanSys->PreviousMeasuredHumRat3(1) = 0.011072322; - state->dataHybridModel->HybridModelZone(1).ZoneMeasuredHumidityRatioSchedulePtr = 1; - state->dataHybridModel->HybridModelZone(1).ZoneSupplyAirHumidityRatioSchedulePtr = 2; - state->dataHybridModel->HybridModelZone(1).ZoneSupplyAirMassFlowRateSchedulePtr = 3; - state->dataHybridModel->HybridModelZone(1).ZonePeopleActivityLevelSchedulePtr = 4; - state->dataHybridModel->HybridModelZone(1).ZonePeopleSensibleFractionSchedulePtr = 5; - state->dataHybridModel->HybridModelZone(1).ZonePeopleRadiationFractionSchedulePtr = 6; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZoneMeasuredHumidityRatioSchedulePtr).CurrentValue = 0.01107774; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZoneSupplyAirHumidityRatioSchedulePtr).CurrentValue = 0.015; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZoneSupplyAirMassFlowRateSchedulePtr).CurrentValue = 1.485334886; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZonePeopleActivityLevelSchedulePtr).CurrentValue = 120; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZonePeopleSensibleFractionSchedulePtr).CurrentValue = 0.6; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZonePeopleRadiationFractionSchedulePtr).CurrentValue = 0.3; + hmZone.measuredHumRatSched = Sched::GetSchedule(*state, "MEASURED HUMRAT 1"); + hmZone.supplyAirHumRatSched = Sched::GetSchedule(*state, "SUPPLY HUMRAT 1"); + hmZone.supplyAirMassFlowRateSched = Sched::GetSchedule(*state, "SUPPLY MASS FLOW RATE 1"); + hmZone.peopleActivityLevelSched = Sched::GetSchedule(*state, "PEOPLE ACTIVITY LEVEL 1"); + hmZone.peopleSensibleFracSched = Sched::GetSchedule(*state, "PEOPLE SENSIBLE FRACTION 1"); + hmZone.peopleRadiantFracSched = Sched::GetSchedule(*state, "PEOPLE RADIATION FRACTION 1"); + hmZone.measuredHumRatSched->currentVal = 0.01107774; + hmZone.supplyAirHumRatSched->currentVal = 0.015; + hmZone.supplyAirMassFlowRateSched->currentVal = 1.485334886; + hmZone.peopleActivityLevelSched->currentVal = 120; + hmZone.peopleSensibleFracSched->currentVal = 0.6; + hmZone.peopleRadiantFracSched->currentVal = 0.3; state->dataEnvrn->OutBaroPress = 99500; thisZoneHB.correctHumRat(*state, 1); @@ -473,10 +470,11 @@ TEST_F(EnergyPlusFixture, HybridModel_correctZoneAirTempsTest) TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneContaminantsTest) { - + state->init_state(*state); // ZoneContaminantPredictorCorrector variable initialization state->dataHeatBal->Zone.allocate(1); - state->dataHybridModel->HybridModelZone.allocate(1); + state->dataHybridModel->hybridModelZones.allocate(1); + state->dataHybridModel->FlagHybridModel = true; state->dataRoomAir->AirModel.allocate(1); state->dataRoomAir->ZTOC.allocate(1); @@ -493,7 +491,6 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneContaminantsTest) state->dataContaminantBalance->CO2ZoneTimeMinus1.allocate(1); state->dataContaminantBalance->CO2ZoneTimeMinus2.allocate(1); state->dataContaminantBalance->CO2ZoneTimeMinus3.allocate(1); - state->dataScheduleMgr->Schedule.allocate(7); // CalcZoneComponentLoadSums variable initialization state->dataSurface->SurfaceWindow.allocate(1); @@ -511,6 +508,8 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneContaminantsTest) state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); state->dataZoneTempPredictorCorrector->spaceHeatBalance.allocate(1); auto &thisZoneHB = state->dataZoneTempPredictorCorrector->zoneHeatBalance(1); + auto &hmZone = state->dataHybridModel->hybridModelZones(1); + thisZoneHB.MixingMassFlowZone = 0.0; thisZoneHB.ZT = 0.0; state->dataContaminantBalance->AZ.allocate(1); @@ -556,7 +555,7 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneContaminantsTest) state->dataHeatBal->Zone(1).Volume = 4000; state->dataGlobal->TimeStepZone = 10.0 / 60.0; // Zone timestep in hours state->dataHVACGlobal->TimeStepSys = 10.0 / 60.0; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; // Hybrid modeling trigger state->dataHybridModel->FlagHybridModel_TM = false; @@ -567,15 +566,15 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneContaminantsTest) // Case 1: Hybrid model infiltration with measured CO2 concentration (free-floating) state->dataContaminantBalance->Contaminant.CO2Simulation = true; - state->dataHybridModel->HybridModelZone(1).InternalThermalMassCalc_T = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_T = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_H = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_C = true; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_T = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_H = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_C = false; - state->dataHybridModel->HybridModelZone(1).HybridStartDayOfYear = 1; - state->dataHybridModel->HybridModelZone(1).HybridEndDayOfYear = 2; + hmZone.InternalThermalMassCalc_T = false; + hmZone.InfiltrationCalc_T = false; + hmZone.InfiltrationCalc_H = false; + hmZone.InfiltrationCalc_C = true; + hmZone.PeopleCountCalc_T = false; + hmZone.PeopleCountCalc_H = false; + hmZone.PeopleCountCalc_C = false; + hmZone.HybridStartDayOfYear = 1; + hmZone.HybridEndDayOfYear = 2; state->dataHeatBal->Zone(1).ZoneVolCapMultpCO2 = 1.0; thisZoneHB.airHumRat = 0.001120003; state->dataContaminantBalance->OutdoorCO2 = 387.6064554; @@ -584,8 +583,8 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneContaminantsTest) state->dataContaminantBalance->CO2ZoneTimeMinus1(1) = 388.595225; state->dataContaminantBalance->CO2ZoneTimeMinus2(1) = 389.084601; state->dataContaminantBalance->CO2ZoneTimeMinus3(1) = 388.997009; - state->dataHybridModel->HybridModelZone(1).ZoneMeasuredCO2ConcentrationSchedulePtr = 1; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZoneMeasuredCO2ConcentrationSchedulePtr).CurrentValue = 388.238646; + hmZone.measuredCO2ConcSched = Sched::AddScheduleConstant(*state, "Measured CO2"); + hmZone.measuredCO2ConcSched->currentVal = 388.238646; CorrectZoneContaminants(*state, true); EXPECT_NEAR(0.5, state->dataHeatBal->Zone(1).InfilOAAirChangeRateHM, 0.01); @@ -593,15 +592,15 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneContaminantsTest) // Case 2: Hybrid model people count with measured CO2 concentration (free-floating) state->dataContaminantBalance->Contaminant.CO2Simulation = true; - state->dataHybridModel->HybridModelZone(1).InternalThermalMassCalc_T = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_T = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_H = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_C = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_T = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_H = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_C = true; - state->dataHybridModel->HybridModelZone(1).HybridStartDayOfYear = 1; - state->dataHybridModel->HybridModelZone(1).HybridEndDayOfYear = 2; + hmZone.InternalThermalMassCalc_T = false; + hmZone.InfiltrationCalc_T = false; + hmZone.InfiltrationCalc_H = false; + hmZone.InfiltrationCalc_C = false; + hmZone.PeopleCountCalc_T = false; + hmZone.PeopleCountCalc_H = false; + hmZone.PeopleCountCalc_C = true; + hmZone.HybridStartDayOfYear = 1; + hmZone.HybridEndDayOfYear = 2; state->dataHeatBal->Zone(1).Volume = 4000; state->dataHeatBal->Zone(1).ZoneVolCapMultpCO2 = 1.0; state->dataHeatBal->Zone(1).OutDryBulbTemp = -1.0394166434012677; @@ -614,23 +613,23 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneContaminantsTest) state->dataContaminantBalance->CO2ZoneTimeMinus1(1) = 387.9962885; state->dataContaminantBalance->CO2ZoneTimeMinus2(1) = 387.676037; state->dataContaminantBalance->CO2ZoneTimeMinus3(1) = 387.2385685; - state->dataHybridModel->HybridModelZone(1).ZoneMeasuredCO2ConcentrationSchedulePtr = 1; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZoneMeasuredCO2ConcentrationSchedulePtr).CurrentValue = 389.8511796; + hmZone.measuredCO2ConcSched = Sched::AddScheduleConstant(*state, "Measured CO2"); + hmZone.measuredCO2ConcSched->currentVal = 389.8511796; CorrectZoneContaminants(*state, true); EXPECT_NEAR(4, state->dataHeatBal->Zone(1).NumOccHM, 0.1); // Case 3: Hybrid model infiltration with measured CO2 concentration (with HVAC) state->dataContaminantBalance->Contaminant.CO2Simulation = true; - state->dataHybridModel->HybridModelZone(1).InternalThermalMassCalc_T = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_T = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_H = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_C = true; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_T = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_H = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_C = false; - state->dataHybridModel->HybridModelZone(1).IncludeSystemSupplyParameters = true; - state->dataHybridModel->HybridModelZone(1).HybridStartDayOfYear = 1; - state->dataHybridModel->HybridModelZone(1).HybridEndDayOfYear = 2; + hmZone.InternalThermalMassCalc_T = false; + hmZone.InfiltrationCalc_T = false; + hmZone.InfiltrationCalc_H = false; + hmZone.InfiltrationCalc_C = true; + hmZone.PeopleCountCalc_T = false; + hmZone.PeopleCountCalc_H = false; + hmZone.PeopleCountCalc_C = false; + hmZone.IncludeSystemSupplyParameters = true; + hmZone.HybridStartDayOfYear = 1; + hmZone.HybridEndDayOfYear = 2; state->dataHeatBal->Zone(1).ZoneVolCapMultpCO2 = 1.0; thisZoneHB.ZT = 15.56; thisZoneHB.airHumRat = 0.00809; @@ -640,12 +639,12 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneContaminantsTest) state->dataContaminantBalance->CO2ZoneTimeMinus1(1) = 388.54049; state->dataContaminantBalance->CO2ZoneTimeMinus2(1) = 389.0198771; state->dataContaminantBalance->CO2ZoneTimeMinus3(1) = 388.9201464; - state->dataHybridModel->HybridModelZone(1).ZoneMeasuredCO2ConcentrationSchedulePtr = 1; - state->dataHybridModel->HybridModelZone(1).ZoneSupplyAirCO2ConcentrationSchedulePtr = 2; - state->dataHybridModel->HybridModelZone(1).ZoneSupplyAirMassFlowRateSchedulePtr = 3; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZoneMeasuredCO2ConcentrationSchedulePtr).CurrentValue = 388.2075472; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZoneSupplyAirCO2ConcentrationSchedulePtr).CurrentValue = 388.54049; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZoneSupplyAirMassFlowRateSchedulePtr).CurrentValue = 0.898375186; + hmZone.measuredCO2ConcSched = Sched::GetSchedule(*state, "MEASURED CO2"); + hmZone.supplyAirCO2ConcSched = Sched::AddScheduleConstant(*state, "Supply CO2"); + hmZone.supplyAirMassFlowRateSched = Sched::AddScheduleConstant(*state, "Supply Mass Flow Rate"); + hmZone.measuredCO2ConcSched->currentVal = 388.2075472; + hmZone.supplyAirCO2ConcSched->currentVal = 388.54049; + hmZone.supplyAirMassFlowRateSched->currentVal = 0.898375186; CorrectZoneContaminants(*state, true); EXPECT_NEAR(0.5, state->dataHeatBal->Zone(1).InfilOAAirChangeRateHM, 0.01); @@ -653,16 +652,16 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneContaminantsTest) // Case 4: Hybrid model people count with measured CO2 concentration (with HVAC) state->dataContaminantBalance->Contaminant.CO2Simulation = true; - state->dataHybridModel->HybridModelZone(1).InternalThermalMassCalc_T = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_T = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_H = false; - state->dataHybridModel->HybridModelZone(1).InfiltrationCalc_C = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_T = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_H = false; - state->dataHybridModel->HybridModelZone(1).PeopleCountCalc_C = true; - state->dataHybridModel->HybridModelZone(1).IncludeSystemSupplyParameters = true; - state->dataHybridModel->HybridModelZone(1).HybridStartDayOfYear = 1; - state->dataHybridModel->HybridModelZone(1).HybridEndDayOfYear = 2; + hmZone.InternalThermalMassCalc_T = false; + hmZone.InfiltrationCalc_T = false; + hmZone.InfiltrationCalc_H = false; + hmZone.InfiltrationCalc_C = false; + hmZone.PeopleCountCalc_T = false; + hmZone.PeopleCountCalc_H = false; + hmZone.PeopleCountCalc_C = true; + hmZone.IncludeSystemSupplyParameters = true; + hmZone.HybridStartDayOfYear = 1; + hmZone.HybridEndDayOfYear = 2; state->dataHeatBal->Zone(1).ZoneVolCapMultpCO2 = 1.0; thisZoneHB.ZT = 21.1; thisZoneHB.airHumRat = 0.01102; @@ -672,20 +671,20 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneContaminantsTest) state->dataContaminantBalance->CO2ZoneTimeMinus1(1) = 387.2253194; state->dataContaminantBalance->CO2ZoneTimeMinus2(1) = 387.1898423; state->dataContaminantBalance->CO2ZoneTimeMinus3(1) = 387.4064128; - state->dataHybridModel->HybridModelZone(1).ZoneMeasuredCO2ConcentrationSchedulePtr = 1; - state->dataHybridModel->HybridModelZone(1).ZoneSupplyAirCO2ConcentrationSchedulePtr = 2; - state->dataHybridModel->HybridModelZone(1).ZoneSupplyAirMassFlowRateSchedulePtr = 3; - state->dataHybridModel->HybridModelZone(1).ZonePeopleActivityLevelSchedulePtr = 4; - state->dataHybridModel->HybridModelZone(1).ZonePeopleSensibleFractionSchedulePtr = 5; - state->dataHybridModel->HybridModelZone(1).ZonePeopleRadiationFractionSchedulePtr = 6; - state->dataHybridModel->HybridModelZone(1).ZonePeopleCO2GenRateSchedulePtr = 7; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZoneMeasuredCO2ConcentrationSchedulePtr).CurrentValue = 389.795807; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZoneSupplyAirCO2ConcentrationSchedulePtr).CurrentValue = 387.2253194; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZoneSupplyAirMassFlowRateSchedulePtr).CurrentValue = 1.427583795; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZonePeopleActivityLevelSchedulePtr).CurrentValue = 120; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZonePeopleSensibleFractionSchedulePtr).CurrentValue = 0.6; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZonePeopleRadiationFractionSchedulePtr).CurrentValue = 0.3; - state->dataScheduleMgr->Schedule(state->dataHybridModel->HybridModelZone(1).ZonePeopleCO2GenRateSchedulePtr).CurrentValue = 0.0000000382; + hmZone.measuredCO2ConcSched = Sched::GetSchedule(*state, "MEASURED CO2"); + hmZone.supplyAirCO2ConcSched = Sched::GetSchedule(*state, "SUPPLY CO2"); + hmZone.supplyAirMassFlowRateSched = Sched::GetSchedule(*state, "SUPPLY MASS FLOW RATE"); + hmZone.peopleActivityLevelSched = Sched::AddScheduleConstant(*state, "People Activity Level"); + hmZone.peopleSensibleFracSched = Sched::AddScheduleConstant(*state, "People Sensible Fraction"); + hmZone.peopleRadiantFracSched = Sched::AddScheduleConstant(*state, "People Radiation Fraction"); + hmZone.peopleCO2GenRateSched = Sched::AddScheduleConstant(*state, "People CO2 Gen Rate"); + hmZone.measuredCO2ConcSched->currentVal = 389.795807; + hmZone.supplyAirCO2ConcSched->currentVal = 387.2253194; + hmZone.supplyAirMassFlowRateSched->currentVal = 1.427583795; + hmZone.peopleActivityLevelSched->currentVal = 120; + hmZone.peopleSensibleFracSched->currentVal = 0.6; + hmZone.peopleRadiantFracSched->currentVal = 0.3; + hmZone.peopleCO2GenRateSched->currentVal = 0.0000000382; CorrectZoneContaminants(*state, true); EXPECT_NEAR(7.27, state->dataHeatBal->Zone(1).NumOccHM, 0.1); diff --git a/tst/EnergyPlus/unit/ICEngineElectricGenerator.unit.cc b/tst/EnergyPlus/unit/ICEngineElectricGenerator.unit.cc index a8f60b7aff9..ecec5fc9bd4 100644 --- a/tst/EnergyPlus/unit/ICEngineElectricGenerator.unit.cc +++ b/tst/EnergyPlus/unit/ICEngineElectricGenerator.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/ICSCollector.unit.cc b/tst/EnergyPlus/unit/ICSCollector.unit.cc index 4087613f8a1..5923102047a 100644 --- a/tst/EnergyPlus/unit/ICSCollector.unit.cc +++ b/tst/EnergyPlus/unit/ICSCollector.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -84,7 +84,7 @@ TEST_F(EnergyPlusFixture, ICSSolarCollectorTest_CalcPassiveExteriorBaffleGapTest int ConstrNum; int MatNum; - InitializePsychRoutines(*state); + state->init_state(*state); state->dataGlobal->BeginEnvrnFlag = true; state->dataEnvrn->OutBaroPress = 101325.0; diff --git a/tst/EnergyPlus/unit/IceThermalStorage.unit.cc b/tst/EnergyPlus/unit/IceThermalStorage.unit.cc index 7557db23957..48ef580455d 100644 --- a/tst/EnergyPlus/unit/IceThermalStorage.unit.cc +++ b/tst/EnergyPlus/unit/IceThermalStorage.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/IdfParser.unit.cc b/tst/EnergyPlus/unit/IdfParser.unit.cc index 33e35887c6a..77ec436f751 100644 --- a/tst/EnergyPlus/unit/IdfParser.unit.cc +++ b/tst/EnergyPlus/unit/IdfParser.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/IndoorGreen.unit.cc b/tst/EnergyPlus/unit/IndoorGreen.unit.cc index d978512846c..3441fe78925 100644 --- a/tst/EnergyPlus/unit/IndoorGreen.unit.cc +++ b/tst/EnergyPlus/unit/IndoorGreen.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -165,6 +165,7 @@ TEST_F(EnergyPlusFixture, IndoorGreen_CheckGetInputDataFunction) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Material::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -177,8 +178,8 @@ TEST_F(EnergyPlusFixture, IndoorGreen_CheckGetInputDataFunction) state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; @@ -186,15 +187,15 @@ TEST_F(EnergyPlusFixture, IndoorGreen_CheckGetInputDataFunction) EXPECT_FALSE(ErrorsFound); state->dataHVACGlobal->TimeStepSys = 1; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60 / state->dataGlobal->NumOfTimeStepInHour; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60 / state->dataGlobal->TimeStepsInHour; state->dataGlobal->TimeStep = 1; state->dataGlobal->HourOfDay = 1; state->dataEnvrn->DayOfWeek = 1; state->dataEnvrn->DayOfYear_Schedule = 1; - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); IndoorGreen::GetIndoorGreenInput(*state, ErrorsFound); // setup indoor living wall data EXPECT_FALSE(ErrorsFound); // expect no errors diff --git a/tst/EnergyPlus/unit/InputProcessor.unit.cc b/tst/EnergyPlus/unit/InputProcessor.unit.cc index 8e46bd4100a..cb75a562afa 100644 --- a/tst/EnergyPlus/unit/InputProcessor.unit.cc +++ b/tst/EnergyPlus/unit/InputProcessor.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/IntegratedHeatPump.unit.cc b/tst/EnergyPlus/unit/IntegratedHeatPump.unit.cc index cb8a552fb4e..eff8a657f86 100644 --- a/tst/EnergyPlus/unit/IntegratedHeatPump.unit.cc +++ b/tst/EnergyPlus/unit/IntegratedHeatPump.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/InternalHeatGains.unit.cc b/tst/EnergyPlus/unit/InternalHeatGains.unit.cc index d44e21eaff8..7e6b6e9bcfe 100644 --- a/tst/EnergyPlus/unit/InternalHeatGains.unit.cc +++ b/tst/EnergyPlus/unit/InternalHeatGains.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -114,11 +114,11 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_OtherEquipment_CheckFuelType) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); - bool ErrorsFound(false); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules + bool ErrorsFound(false); HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -163,11 +163,11 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_OtherEquipment_NegativeDesignLevel) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); - bool ErrorsFound(false); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules + bool ErrorsFound(false); HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -175,7 +175,9 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_OtherEquipment_NegativeDesignLevel) ASSERT_THROW(InternalHeatGains::GetInternalHeatGainsInput(*state), std::runtime_error); std::string const error_string = delimited_string( - {" ** Warning ** ProcessScheduleInput: Schedule:Constant=\"SCHEDULE1\", Blank Schedule Type Limits Name input -- will not be validated.", + {" ** Warning ** ProcessScheduleInput: Schedule:Constant = SCHEDULE1", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", " ** Severe ** GetInternalHeatGains: OtherEquipment=\"OTHEREQ1\", Design Level is not allowed to be negative", " ** ~~~ ** ... when a fuel type of FuelOilNo1 is specified.", " ** Fatal ** GetInternalHeatGains: Errors found in Getting Internal Gains Input, Program Stopped", @@ -212,28 +214,30 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_OtherEquipment_BadFuelType) ASSERT_FALSE(process_idf(idf_objects, false)); // add false to supress error assertions EXPECT_TRUE(has_err_output(false)); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); + std::string error_string = - delimited_string({" ** Severe ** [OtherEquipment][OtherEq1][fuel_type] - \"Water\" - Failed to match against any enum values."}); + delimited_string({" ** Severe ** [OtherEquipment][OtherEq1][fuel_type] - \"Water\" - Failed to match against any enum values.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = SCHEDULE1", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated."}); EXPECT_TRUE(compare_err_stream(error_string, true)); bool ErrorsFound(false); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules - HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); ASSERT_THROW(InternalHeatGains::GetInternalHeatGainsInput(*state), std::runtime_error); - error_string = delimited_string( - {" ** Warning ** ProcessScheduleInput: Schedule:Constant=\"SCHEDULE1\", Blank Schedule Type Limits Name input -- will not be validated.", - " ** Severe ** GetInternalHeatGains: OtherEquipment: invalid Fuel Type entered=WATER for Name=OTHEREQ1", - " ** Fatal ** GetInternalHeatGains: Errors found in Getting Internal Gains Input, Program Stopped", - " ...Summary of Errors that led to program termination:", - " ..... Reference severe error count=2", - " ..... Last severe error=GetInternalHeatGains: OtherEquipment: invalid Fuel Type entered=WATER for Name=OTHEREQ1"}); + error_string = + delimited_string({" ** Severe ** GetInternalHeatGains: OtherEquipment: invalid Fuel Type entered=WATER for Name=OTHEREQ1", + " ** Fatal ** GetInternalHeatGains: Errors found in Getting Internal Gains Input, Program Stopped", + " ...Summary of Errors that led to program termination:", + " ..... Reference severe error count=2", + " ..... Last severe error=GetInternalHeatGains: OtherEquipment: invalid Fuel Type entered=WATER for Name=OTHEREQ1"}); EXPECT_TRUE(compare_err_stream(error_string, true)); } @@ -287,25 +291,27 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_AllowBlankFieldsForAdaptiveComfortMo ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + bool ErrorsFound1(false); - ScheduleManager::ProcessScheduleInput(*state); // read schedules HeatBalanceManager::GetZoneData(*state, ErrorsFound1); ASSERT_FALSE(ErrorsFound1); - state->dataScheduleMgr->ScheduleInputProcessed = true; - state->dataScheduleMgr->Schedule(1).Used = true; + auto *occSched = Sched::GetSchedule(*state, "HOUSE OCCUPANCY"); + occSched->isUsed = true; + occSched->currentVal = 1.0; + occSched->minVal = 1.0; + occSched->maxVal = 1.0; + occSched->isMinMaxSet = true; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(1).MinValue = 1.0; - state->dataScheduleMgr->Schedule(1).MaxValue = 1.0; - state->dataScheduleMgr->Schedule(1).MaxMinSet = true; - state->dataScheduleMgr->Schedule(2).Used = true; + auto *actSched = Sched::GetSchedule(*state, "ACTIVITY SCH"); + actSched->isUsed = true; + actSched->currentVal = 131.8; + actSched->minVal = 131.8; + actSched->maxVal = 131.8; + actSched->isMinMaxSet = true; - state->dataScheduleMgr->Schedule(2).CurrentValue = 131.8; - state->dataScheduleMgr->Schedule(2).MinValue = 131.8; - state->dataScheduleMgr->Schedule(2).MaxValue = 131.8; - state->dataScheduleMgr->Schedule(2).MaxMinSet = true; InternalHeatGains::GetInternalHeatGainsInput(*state); EXPECT_FALSE(state->dataInternalHeatGains->ErrorsFound); @@ -471,8 +477,9 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_ElectricEquipITE_BeginEnvironmentRes EXPECT_FALSE(has_err_output()); bool ErrorsFound(false); - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -656,6 +663,7 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_CheckZoneComponentLoadSubtotals) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); + state->init_state(*state); bool ErrorsFound(false); HeatBalanceManager::GetZoneData(*state, ErrorsFound); @@ -687,21 +695,18 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_CheckZoneComponentLoadSubtotals) state->dataEnvrn->TotRunDesPersDays = 0; state->dataSize->CurOverallSimDay = 1; state->dataGlobal->HourOfDay = 1; - state->dataGlobal->NumOfTimeStepInHour = 10; + state->dataGlobal->TimeStepsInHour = 10; state->dataGlobal->TimeStep = 1; OutputReportTabular::AllocateLoadComponentArrays(*state); - int timeStepInDay = (state->dataGlobal->HourOfDay - 1) * state->dataGlobal->NumOfTimeStepInHour + state->dataGlobal->TimeStep; + int timeStepInDay = (state->dataGlobal->HourOfDay - 1) * state->dataGlobal->TimeStepsInHour + state->dataGlobal->TimeStep; state->dataGlobal->CompLoadReportIsReq = true; state->dataGlobal->isPulseZoneSizing = false; InternalHeatGains::GatherComponentLoadsIntGain(*state); - totConvGains = state->dataOutRptTab->peopleInstantSeq(state->dataSize->CurOverallSimDay, timeStepInDay, zoneNum) + - state->dataOutRptTab->lightInstantSeq(state->dataSize->CurOverallSimDay, timeStepInDay, zoneNum) + - state->dataOutRptTab->equipInstantSeq(state->dataSize->CurOverallSimDay, timeStepInDay, zoneNum) + - state->dataOutRptTab->refrigInstantSeq(state->dataSize->CurOverallSimDay, timeStepInDay, zoneNum) + - state->dataOutRptTab->waterUseInstantSeq(state->dataSize->CurOverallSimDay, timeStepInDay, zoneNum) + - state->dataOutRptTab->hvacLossInstantSeq(state->dataSize->CurOverallSimDay, timeStepInDay, zoneNum) + - state->dataOutRptTab->powerGenInstantSeq(state->dataSize->CurOverallSimDay, timeStepInDay, zoneNum); + auto &znCompLoadDayTS = state->dataOutRptTab->znCompLoads[state->dataSize->CurOverallSimDay - 1].ts[timeStepInDay - 1].spacezone[zoneNum - 1]; + totConvGains = znCompLoadDayTS.peopleInstantSeq + znCompLoadDayTS.lightInstantSeq + znCompLoadDayTS.equipInstantSeq + + znCompLoadDayTS.refrigInstantSeq + znCompLoadDayTS.waterUseInstantSeq + znCompLoadDayTS.hvacLossInstantSeq + + znCompLoadDayTS.powerGenInstantSeq; // Legitimate gain types excluded from this total expectedTotConvGains -= @@ -885,8 +890,9 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_ElectricEquipITE_ApproachTemperature EXPECT_FALSE(has_err_output()); bool ErrorsFound(false); - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -1040,6 +1046,7 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_ElectricEquipITE_DefaultCurves) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); + state->init_state(*state); bool ErrorsFound(false); HeatBalanceManager::GetZoneData(*state, ErrorsFound); @@ -1326,17 +1333,18 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_ZnRpt_Outputs) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); + bool ErrorsFound(false); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules state->dataEnvrn->DayOfYear_Schedule = 1; state->dataEnvrn->DayOfMonth = 1; state->dataEnvrn->DayOfWeek = 1; state->dataGlobal->HourOfDay = 1; state->dataGlobal->TimeStep = 1; - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -1648,8 +1656,9 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_AdjustedSupplyGoodInletNode) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound(false); - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -1870,8 +1879,9 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_AdjustedSupplyBadInletNode) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound(false); - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -2096,8 +2106,9 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_FlowControlWithApproachTemperaturesG ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound(false); - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -2322,8 +2333,9 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_FlowControlWithApproachTemperaturesB ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound(false); - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -2548,8 +2560,9 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_WarnMissingInletNode) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound(false); - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -2614,11 +2627,11 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_GetHeatColdStressTemp) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); bool ErrorsFound(false); - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ScheduleManager::ProcessScheduleInput(*state); // read schedules HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -2726,8 +2739,9 @@ TEST_F(EnergyPlusFixture, ITEwithUncontrolledZoneTest) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound(false); - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -2864,8 +2878,9 @@ TEST_F(EnergyPlusFixture, ITE_Env_Class_Fix_41C) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound(false); - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); state->dataGlobal->TimeStepZone = 1.0; @@ -3065,8 +3080,9 @@ TEST_F(EnergyPlusFixture, ITE_Env_Class_Fix_39C) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound(false); - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); state->dataGlobal->TimeStepZone = 1.0; @@ -3273,8 +3289,9 @@ TEST_F(EnergyPlusFixture, ITE_Env_Class_Update_Class_H1) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound(false); - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); state->dataGlobal->TimeStepZone = 1.0; diff --git a/tst/EnergyPlus/unit/KusudaAchenbachGroundTemperatureModel.unit.cc b/tst/EnergyPlus/unit/KusudaAchenbachGroundTemperatureModel.unit.cc index 95eda652181..a73fa13784b 100644 --- a/tst/EnergyPlus/unit/KusudaAchenbachGroundTemperatureModel.unit.cc +++ b/tst/EnergyPlus/unit/KusudaAchenbachGroundTemperatureModel.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -52,12 +52,11 @@ // EnergyPlus Headers #include "EnergyPlus/DataIPShortCuts.hh" -#include "EnergyPlus/GroundTemperatureModeling/GroundTemperatureModelManager.hh" +#include "EnergyPlus/GroundTemperatureModeling/BaseGroundTemperatureModel.hh" #include "Fixtures/EnergyPlusFixture.hh" #include using namespace EnergyPlus; -using namespace EnergyPlus::GroundTemperatureManager; TEST_F(EnergyPlusFixture, KusudaAchenbachGroundTempModelTest1) { @@ -74,9 +73,7 @@ TEST_F(EnergyPlusFixture, KusudaAchenbachGroundTempModelTest1) ASSERT_TRUE(process_idf(idf_objects)); - std::string const CurrentModuleObject = static_cast(groundTempModelNamesUC[static_cast(GroundTempObjType::KusudaGroundTemp)]); - - auto thisModel = GetGroundTempModelAndInit(*state, CurrentModuleObject, "TEST"); + auto *thisModel = GroundTemp::GetGroundTempModelAndInit(*state, GroundTemp::ModelType::Kusuda, "TEST"); EXPECT_NEAR(10.0, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 0.0), 0.01); // Jan 1 EXPECT_NEAR(20.0, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 15768000), 0.01); // June 1 @@ -116,9 +113,7 @@ TEST_F(EnergyPlusFixture, KusudaAchenbachGroundTempModelTest2) // lNumericFieldB ASSERT_TRUE(process_idf(idf_objects)); - std::string const CurrentModuleObject = static_cast(groundTempModelNamesUC[static_cast(GroundTempObjType::KusudaGroundTemp)]); - - auto thisModel = GetGroundTempModelAndInit(*state, CurrentModuleObject, "TEST"); + auto *thisModel = GroundTemp::GetGroundTempModelAndInit(*state, GroundTemp::ModelType::Kusuda, "TEST"); EXPECT_NEAR(16.46, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 0.0), 0.01); // Jan 1 EXPECT_NEAR(17.17, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 11664000), 0.01); // May 15 diff --git a/tst/EnergyPlus/unit/LowTempRadiantSystem.unit.cc b/tst/EnergyPlus/unit/LowTempRadiantSystem.unit.cc index 6bf1a8c30dd..9d2fab03d5a 100644 --- a/tst/EnergyPlus/unit/LowTempRadiantSystem.unit.cc +++ b/tst/EnergyPlus/unit/LowTempRadiantSystem.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -88,7 +88,6 @@ using namespace EnergyPlus::DataSurfaces; using namespace EnergyPlus::DataSurfaceLists; using namespace EnergyPlus::HeatBalanceManager; using namespace EnergyPlus::PlantManager; -using namespace EnergyPlus::ScheduleManager; using namespace EnergyPlus::SizingManager; using namespace EnergyPlus::SurfaceGeometry; using namespace EnergyPlus::General; @@ -111,6 +110,8 @@ class LowTempRadiantSystemTest : public EnergyPlusFixture { EnergyPlusFixture::SetUp(); // Sets up the base fixture first. + state->dataFluid->init_state(*state); + state->dataLowTempRadSys->ElecRadSys.allocate(1); state->dataLowTempRadSys->HydrRadSys.allocate(1); state->dataLowTempRadSys->CFloRadSys.allocate(1); @@ -146,11 +147,11 @@ class LowTempRadiantSystemTest : public EnergyPlusFixture } state->dataPlnt->PlantLoop(1).Name = "Hot Water Loop"; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).Name = "Chilled Water Loop"; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataSize->PlantSizData(1).PlantLoopName = "Hot Water Loop"; state->dataSize->PlantSizData(1).ExitTemp = 80.0; @@ -205,7 +206,6 @@ TEST_F(LowTempRadiantSystemTest, SizeLowTempRadiantElectric) TEST_F(LowTempRadiantSystemTest, SizeLowTempRadiantVariableFlow) { - FluidProperties::GetFluidPropertiesData(*state); SystemType = LowTempRadiantSystem::SystemType::HydronicSystem; state->dataLowTempRadSys->HydrRadSys(RadSysNum).Name = "LowTempVarFlow 1"; state->dataLowTempRadSys->HydrRadSys(RadSysNum).ZonePtr = 1; @@ -299,7 +299,6 @@ TEST_F(LowTempRadiantSystemTest, SizeLowTempRadiantVariableFlow) TEST_F(LowTempRadiantSystemTest, SizeCapacityLowTempRadiantVariableFlow) { - FluidProperties::GetFluidPropertiesData(*state); SystemType = LowTempRadiantSystem::SystemType::HydronicSystem; state->dataLowTempRadSys->HydrRadSys(RadSysNum).Name = "LowTempVarFlow 1"; state->dataLowTempRadSys->HydrRadSys(RadSysNum).ZonePtr = 1; @@ -376,7 +375,6 @@ TEST_F(LowTempRadiantSystemTest, SizeCapacityLowTempRadiantVariableFlow) TEST_F(LowTempRadiantSystemTest, SizeLowTempRadiantConstantFlow) { - FluidProperties::GetFluidPropertiesData(*state); SystemType = LowTempRadiantSystem::SystemType::ConstantFlowSystem; state->dataLowTempRadSys->CFloRadSys(RadSysNum).Name = "LowTempConstantFlow 1"; state->dataLowTempRadSys->CFloRadSys(RadSysNum).ZonePtr = 1; @@ -1123,6 +1121,7 @@ TEST_F(LowTempRadiantSystemTest, AutosizeLowTempRadiantVariableFlowTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -1131,9 +1130,6 @@ TEST_F(LowTempRadiantSystemTest, AutosizeLowTempRadiantVariableFlowTest) EXPECT_FALSE(ErrorsFound); EXPECT_EQ("WEST ZONE", state->dataHeatBal->Zone(1).Name); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; - HeatBalanceManager::SetPreConstructionInputParameters(*state); Material::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -1203,32 +1199,16 @@ TEST_F(LowTempRadiantSystemTest, AutosizeLowTempRadiantVariableFlowTest) CoolingCapacity = state->dataSize->FinalZoneSizing(state->dataSize->CurZoneEqNum).NonAirSysDesCoolLoad * state->dataLowTempRadSys->HydrRadSys(RadSysNum).ScaledCoolingCapacity; // hot water flow rate sizing calculation - Density = - FluidProperties::GetDensityGlycol(*state, - state->dataPlnt->PlantLoop(state->dataLowTempRadSys->HydrRadSys(RadSysNum).HWPlantLoc.loopNum).FluidName, - 60.0, - state->dataPlnt->PlantLoop(state->dataLowTempRadSys->HydrRadSys(RadSysNum).HWPlantLoc.loopNum).FluidIndex, - "AutosizeLowTempRadiantVariableFlowTest"); - Cp = FluidProperties::GetSpecificHeatGlycol( - *state, - state->dataPlnt->PlantLoop(state->dataLowTempRadSys->HydrRadSys(RadSysNum).HWPlantLoc.loopNum).FluidName, - 60.0, - state->dataPlnt->PlantLoop(state->dataLowTempRadSys->HydrRadSys(RadSysNum).HWPlantLoc.loopNum).FluidIndex, - "AutosizeLowTempRadiantVariableFlowTest"); + Density = state->dataPlnt->PlantLoop(state->dataLowTempRadSys->HydrRadSys(RadSysNum).HWPlantLoc.loopNum) + .glycol->getDensity(*state, 60.0, "AutosizeLowTempRadiantVariableFlowTest"); + Cp = state->dataPlnt->PlantLoop(state->dataLowTempRadSys->HydrRadSys(RadSysNum).HWPlantLoc.loopNum) + .glycol->getSpecificHeat(*state, 60.0, "AutosizeLowTempRadiantVariableFlowTest"); HotWaterFlowRate = HeatingCapacity / (state->dataSize->PlantSizData(1).DeltaT * Cp * Density); // chilled water flow rate sizing calculation - Density = - FluidProperties::GetDensityGlycol(*state, - state->dataPlnt->PlantLoop(state->dataLowTempRadSys->HydrRadSys(RadSysNum).CWPlantLoc.loopNum).FluidName, - 5.05, - state->dataPlnt->PlantLoop(state->dataLowTempRadSys->HydrRadSys(RadSysNum).CWPlantLoc.loopNum).FluidIndex, - "AutosizeLowTempRadiantVariableFlowTest"); - Cp = FluidProperties::GetSpecificHeatGlycol( - *state, - state->dataPlnt->PlantLoop(state->dataLowTempRadSys->HydrRadSys(RadSysNum).CWPlantLoc.loopNum).FluidName, - 5.05, - state->dataPlnt->PlantLoop(state->dataLowTempRadSys->HydrRadSys(RadSysNum).CWPlantLoc.loopNum).FluidIndex, - "AutosizeLowTempRadiantVariableFlowTest"); + Density = state->dataPlnt->PlantLoop(state->dataLowTempRadSys->HydrRadSys(RadSysNum).CWPlantLoc.loopNum) + .glycol->getDensity(*state, 5.05, "AutosizeLowTempRadiantVariableFlowTest"); + Cp = state->dataPlnt->PlantLoop(state->dataLowTempRadSys->HydrRadSys(RadSysNum).CWPlantLoc.loopNum) + .glycol->getSpecificHeat(*state, 5.05, "AutosizeLowTempRadiantVariableFlowTest"); ChilledWaterFlowRate = CoolingCapacity / (state->dataSize->PlantSizData(2).DeltaT * Cp * Density); // tuble length sizing calculation state->dataLowTempRadSys->HydrRadSys(RadSysNum).TotalSurfaceArea = @@ -2010,6 +1990,7 @@ TEST_F(LowTempRadiantSystemTest, SimulateCapacityPerFloorAreaError) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -2018,7 +1999,6 @@ TEST_F(LowTempRadiantSystemTest, SimulateCapacityPerFloorAreaError) EXPECT_FALSE(ErrorsFound); EXPECT_EQ("WEST ZONE", state->dataHeatBal->Zone(1).Name); - ProcessScheduleInput(*state); HeatBalanceManager::SetPreConstructionInputParameters(*state); Material::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -2064,7 +2044,7 @@ TEST_F(LowTempRadiantSystemTest, InitLowTempRadiantSystem) state->dataLowTempRadSys->CFloRadSys(RadSysNum).HotWaterInNode = 0; state->dataLowTempRadSys->CFloRadSys(RadSysNum).ColdWaterInNode = 0; state->dataGlobal->BeginTimeStepFlag = false; - state->dataLowTempRadSys->CFloRadSys(RadSysNum).VolFlowSchedPtr = 0; + state->dataLowTempRadSys->CFloRadSys(RadSysNum).volFlowSched = nullptr; state->dataLowTempRadSys->CFloRadSys(RadSysNum).EMSOverrideOnWaterMdot = false; state->dataLowTempRadSys->CFloRadSys(RadSysNum).WaterMassFlowRate = 1.0; state->dataLowTempRadSys->CFloRadSys(RadSysNum).HotDesignWaterMassFlowRate = 2.0; @@ -2114,7 +2094,7 @@ TEST_F(LowTempRadiantSystemTest, InitLowTempRadiantSystemCFloPump) state->dataLowTempRadSys->CFloRadSys(RadSysNum).HotWaterInNode = 0; state->dataLowTempRadSys->CFloRadSys(RadSysNum).ColdWaterInNode = 0; state->dataGlobal->BeginTimeStepFlag = false; - state->dataLowTempRadSys->CFloRadSys(RadSysNum).VolFlowSchedPtr = 0; + state->dataLowTempRadSys->CFloRadSys(RadSysNum).volFlowSched = nullptr; state->dataLowTempRadSys->CFloRadSys(RadSysNum).EMSOverrideOnWaterMdot = false; state->dataLowTempRadSys->CFloRadSys(RadSysNum).WaterMassFlowRate = 1.0; state->dataLowTempRadSys->CFloRadSys(RadSysNum).HotDesignWaterMassFlowRate = 2.0; @@ -2152,7 +2132,7 @@ TEST_F(LowTempRadiantSystemTest, InitLowTempRadiantSystemCFloPump) state->dataLowTempRadSys->CFloRadSys(RadSysNum).HotWaterInNode = 0; state->dataLowTempRadSys->CFloRadSys(RadSysNum).ColdWaterInNode = 0; state->dataGlobal->BeginTimeStepFlag = false; - state->dataLowTempRadSys->CFloRadSys(RadSysNum).VolFlowSchedPtr = 0; + state->dataLowTempRadSys->CFloRadSys(RadSysNum).volFlowSched = nullptr; state->dataLowTempRadSys->CFloRadSys(RadSysNum).EMSOverrideOnWaterMdot = false; state->dataLowTempRadSys->CFloRadSys(RadSysNum).WaterMassFlowRate = 1.0; state->dataLowTempRadSys->CFloRadSys(RadSysNum).HotDesignWaterMassFlowRate = 2.0; @@ -2197,7 +2177,7 @@ TEST_F(LowTempRadiantSystemTest, InitLowTempRadiantSystemCFloPump) state->dataLowTempRadSys->CFloRadSys(RadSysNum).HotWaterInNode = 0; state->dataLowTempRadSys->CFloRadSys(RadSysNum).ColdWaterInNode = 0; state->dataGlobal->BeginTimeStepFlag = false; - state->dataLowTempRadSys->CFloRadSys(RadSysNum).VolFlowSchedPtr = 0; + state->dataLowTempRadSys->CFloRadSys(RadSysNum).volFlowSched = nullptr; state->dataLowTempRadSys->CFloRadSys(RadSysNum).EMSOverrideOnWaterMdot = false; state->dataLowTempRadSys->CFloRadSys(RadSysNum).WaterMassFlowRate = 1.0; state->dataLowTempRadSys->CFloRadSys(RadSysNum).HotDesignWaterMassFlowRate = 2.0; @@ -2242,7 +2222,7 @@ TEST_F(LowTempRadiantSystemTest, InitLowTempRadiantSystemCFloPump) state->dataLowTempRadSys->CFloRadSys(RadSysNum).HotWaterInNode = 0; state->dataLowTempRadSys->CFloRadSys(RadSysNum).ColdWaterInNode = 0; state->dataGlobal->BeginTimeStepFlag = false; - state->dataLowTempRadSys->CFloRadSys(RadSysNum).VolFlowSchedPtr = 0; + state->dataLowTempRadSys->CFloRadSys(RadSysNum).volFlowSched = nullptr; state->dataLowTempRadSys->CFloRadSys(RadSysNum).EMSOverrideOnWaterMdot = false; state->dataLowTempRadSys->CFloRadSys(RadSysNum).WaterMassFlowRate = 1.0; state->dataLowTempRadSys->CFloRadSys(RadSysNum).HotDesignWaterMassFlowRate = 2.0; @@ -2339,6 +2319,7 @@ TEST_F(LowTempRadiantSystemTest, LowTempElecRadSurfaceGroupTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataHeatBal->Zone.allocate(2); state->dataHeatBal->Zone(1).Name = "WEST ZONE"; @@ -2397,24 +2378,25 @@ TEST_F(LowTempRadiantSystemTest, CalcLowTempCFloRadiantSystem_OperationMode) state->dataLowTempRadSys->CFloRadSys(RadSysNum).SurfacePtr.allocate(1); state->dataLowTempRadSys->NumOfCFloLowTempRadSysDes = 1; state->dataLowTempRadSys->CflowRadiantSysDesign.allocate(state->dataLowTempRadSys->NumOfCFloLowTempRadSysDes); - state->dataScheduleMgr->Schedule.allocate(3); + state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1; - state->dataScheduleMgr->Schedule(2).CurrentValue = 22.0; - state->dataScheduleMgr->Schedule(3).CurrentValue = 25.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 21.0; state->dataLowTempRadSys->CFloRadSys(RadSysNum).NumOfSurfaces = 0; state->dataLowTempRadSys->TotalNumOfRadSystems = 0; state->dataLowTempRadSys->CFloRadSys(RadSysNum).ZonePtr = 1; - state->dataLowTempRadSys->CFloRadSys(RadSysNum).SchedPtr = 1; + state->dataLowTempRadSys->CFloRadSys(RadSysNum).availSched = Sched::AddScheduleConstant(*state, "Avail"); state->dataLowTempRadSys->CFloRadSys(RadSysNum).controlType = LowTempRadiantControlTypes::MATControl; - state->dataLowTempRadSys->CFloRadSys(RadSysNum).HotCtrlHiTempSchedPtr = 2; - state->dataLowTempRadSys->CFloRadSys(RadSysNum).ColdCtrlLoTempSchedPtr = 3; + state->dataLowTempRadSys->CFloRadSys(RadSysNum).hotCtrlHiTempSched = Sched::AddScheduleConstant(*state, "Hi Temp"); + state->dataLowTempRadSys->CFloRadSys(RadSysNum).coldCtrlLoTempSched = Sched::AddScheduleConstant(*state, "Lo Temp"); state->dataLowTempRadSys->CFloRadSys(RadSysNum).SurfacePtr(1) = 1; + state->dataLowTempRadSys->CFloRadSys(RadSysNum).availSched->currentVal = 1; + state->dataLowTempRadSys->CFloRadSys(RadSysNum).hotCtrlHiTempSched->currentVal = 22.0; + state->dataLowTempRadSys->CFloRadSys(RadSysNum).coldCtrlLoTempSched->currentVal = 25.0; + state->dataLowTempRadSys->CFloRadSys(RadSysNum).HotWaterInNode = 0; state->dataLowTempRadSys->CFloRadSys(RadSysNum).ColdWaterInNode = 0; - state->dataLowTempRadSys->CFloRadSys(RadSysNum).VolFlowSchedPtr = 0; + state->dataLowTempRadSys->CFloRadSys(RadSysNum).volFlowSched = nullptr; state->dataLowTempRadSys->CFloRadSys(RadSysNum).EMSOverrideOnWaterMdot = false; state->dataLowTempRadSys->CFloRadSys(RadSysNum).WaterMassFlowRate = 1.0; state->dataLowTempRadSys->CFloRadSys(RadSysNum).HotDesignWaterMassFlowRate = 2.0; @@ -2459,22 +2441,22 @@ TEST_F(LowTempRadiantSystemTest, CalcLowTempHydrRadiantSystem_OperationMode) state->dataLowTempRadSys->HydronicRadiantSysDesign.allocate(state->dataLowTempRadSys->NumOfHydrLowTempRadSys); state->dataLowTempRadSys->HydrRadSys(RadSysNum).SurfacePtr.allocate(1); state->dataLowTempRadSys->HydrRadSys(RadSysNum).SurfacePtr(1) = 1; - state->dataScheduleMgr->Schedule.allocate(3); + state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1; - state->dataScheduleMgr->Schedule(2).CurrentValue = 22.0; - state->dataScheduleMgr->Schedule(3).CurrentValue = 25.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 21.0; state->dataLowTempRadSys->HydrRadSys(RadSysNum).NumOfSurfaces = 0; state->dataLowTempRadSys->TotalNumOfRadSystems = 0; state->dataLowTempRadSys->HydrRadSys(RadSysNum).ZonePtr = 1; - state->dataLowTempRadSys->HydrRadSys(RadSysNum).SchedPtr = 1; + state->dataLowTempRadSys->HydrRadSys(RadSysNum).availSched = Sched::AddScheduleConstant(*state, "Avail"); + state->dataLowTempRadSys->HydrRadSys(RadSysNum).availSched->currentVal = 1; state->dataLowTempRadSys->HydrRadSys(RadSysNum).controlType = LowTempRadiantControlTypes::MATControl; DesignObjectNum = 1; state->dataLowTempRadSys->HydrRadSys(RadSysNum).DesignObjectPtr = 1; - state->dataLowTempRadSys->HydronicRadiantSysDesign(DesignObjectNum).HotSetptSchedPtr = 2; - state->dataLowTempRadSys->HydronicRadiantSysDesign(DesignObjectNum).ColdSetptSchedPtr = 3; + state->dataLowTempRadSys->HydronicRadiantSysDesign(DesignObjectNum).heatSetptSched = Sched::AddScheduleConstant(*state, "Hot Setpt"); + state->dataLowTempRadSys->HydronicRadiantSysDesign(DesignObjectNum).heatSetptSched->currentVal = 22.0; + state->dataLowTempRadSys->HydronicRadiantSysDesign(DesignObjectNum).coolSetptSched = Sched::AddScheduleConstant(*state, "Cold Setpt"); + state->dataLowTempRadSys->HydronicRadiantSysDesign(DesignObjectNum).coolSetptSched->currentVal = 25.0; state->dataLowTempRadSys->HydrRadSys(RadSysNum).HotWaterInNode = 0; state->dataLowTempRadSys->HydrRadSys(RadSysNum).ColdWaterInNode = 0; @@ -2597,12 +2579,12 @@ TEST_F(LowTempRadiantSystemTest, SizeRadSysTubeLengthTest) FuncCalc = state->dataLowTempRadSys->CFloRadSys(RadSysNum).sizeRadiantSystemTubeLength(*state); EXPECT_NEAR(FuncCalc, 2000.0, 0.1); } + TEST_F(LowTempRadiantSystemTest, LowTempRadConFlowSystemAutoSizeTempTest) { - + state->init_state(*state); Real64 Density; Real64 Cp; - FluidProperties::GetFluidPropertiesData(*state); SystemType = LowTempRadiantSystem::SystemType::ConstantFlowSystem; state->dataLowTempRadSys->CFloRadSys(RadSysNum).Name = "LowTempConstantFlow"; @@ -2638,18 +2620,10 @@ TEST_F(LowTempRadiantSystemTest, LowTempRadConFlowSystemAutoSizeTempTest) state->dataSize->FinalZoneSizing(state->dataSize->CurZoneEqNum).NonAirSysDesCoolLoad = 1000.0; // hot water volume flow rate sizing calculation - Density = - FluidProperties::GetDensityGlycol(*state, - state->dataPlnt->PlantLoop(state->dataLowTempRadSys->CFloRadSys(RadSysNum).HWPlantLoc.loopNum).FluidName, - 60.0, - state->dataPlnt->PlantLoop(state->dataLowTempRadSys->CFloRadSys(RadSysNum).HWPlantLoc.loopNum).FluidIndex, - "LowTempRadConFlowSystemAutoSizeTempTest"); - Cp = FluidProperties::GetSpecificHeatGlycol( - *state, - state->dataPlnt->PlantLoop(state->dataLowTempRadSys->CFloRadSys(RadSysNum).HWPlantLoc.loopNum).FluidName, - 60.0, - state->dataPlnt->PlantLoop(state->dataLowTempRadSys->CFloRadSys(RadSysNum).HWPlantLoc.loopNum).FluidIndex, - "LowTempRadConFlowSystemAutoSizeTempTest"); + Density = state->dataPlnt->PlantLoop(state->dataLowTempRadSys->CFloRadSys(RadSysNum).HWPlantLoc.loopNum) + .glycol->getDensity(*state, 60.0, "LowTempRadConFlowSystemAutoSizeTempTest"); + Cp = state->dataPlnt->PlantLoop(state->dataLowTempRadSys->CFloRadSys(RadSysNum).HWPlantLoc.loopNum) + .glycol->getSpecificHeat(*state, 60.0, "LowTempRadConFlowSystemAutoSizeTempTest"); Real64 HeatingLoad = state->dataSize->FinalZoneSizing(1).NonAirSysDesHeatLoad; Real64 DesHotWaterVolFlowRate = HeatingLoad / (state->dataSize->PlantSizData(1).DeltaT * Density * Cp); @@ -2665,18 +2639,10 @@ TEST_F(LowTempRadiantSystemTest, LowTempRadConFlowSystemAutoSizeTempTest) state->dataLowTempRadSys->CFloRadSys(RadSysNum).WaterVolFlowMax = AutoSize; // chilled water volume flow rate sizing calculation - Density = - FluidProperties::GetDensityGlycol(*state, - state->dataPlnt->PlantLoop(state->dataLowTempRadSys->CFloRadSys(RadSysNum).CWPlantLoc.loopNum).FluidName, - 5.05, - state->dataPlnt->PlantLoop(state->dataLowTempRadSys->CFloRadSys(RadSysNum).CWPlantLoc.loopNum).FluidIndex, - "LowTempRadConFlowSystemAutoSizeTempTest"); - Cp = FluidProperties::GetSpecificHeatGlycol( - *state, - state->dataPlnt->PlantLoop(state->dataLowTempRadSys->CFloRadSys(RadSysNum).CWPlantLoc.loopNum).FluidName, - 5.05, - state->dataPlnt->PlantLoop(state->dataLowTempRadSys->CFloRadSys(RadSysNum).CWPlantLoc.loopNum).FluidIndex, - "LowTempRadConFlowSystemAutoSizeTempTest"); + Density = state->dataPlnt->PlantLoop(state->dataLowTempRadSys->CFloRadSys(RadSysNum).CWPlantLoc.loopNum) + .glycol->getDensity(*state, 5.05, "LowTempRadConFlowSystemAutoSizeTempTest"); + Cp = state->dataPlnt->PlantLoop(state->dataLowTempRadSys->CFloRadSys(RadSysNum).CWPlantLoc.loopNum) + .glycol->getSpecificHeat(*state, 5.05, "LowTempRadConFlowSystemAutoSizeTempTest"); Real64 CoolingLoad = state->dataSize->FinalZoneSizing(state->dataSize->CurZoneEqNum).NonAirSysDesCoolLoad; Real64 DesChilledWaterVolFlowRate = CoolingLoad / (state->dataSize->PlantSizData(2).DeltaT * Density * Cp); @@ -2687,6 +2653,7 @@ TEST_F(LowTempRadiantSystemTest, LowTempRadConFlowSystemAutoSizeTempTest) TEST_F(LowTempRadiantSystemTest, LowTempRadCalcRadSysHXEffectTermTest) { + state->init_state(*state); int RadSysNum; LowTempRadiantSystem::SystemType RadSysType; Real64 Temperature; @@ -2697,7 +2664,6 @@ TEST_F(LowTempRadiantSystemTest, LowTempRadCalcRadSysHXEffectTermTest) Real64 TubeDiameter; Real64 HXEffectFuncResult; int SurfNum; - FluidProperties::GetFluidPropertiesData(*state); // Set values of items that will stay constant for all calls to HX Effectiveness function RadSysNum = 1; @@ -3205,6 +3171,7 @@ TEST_F(LowTempRadiantSystemTest, calculateOperationalFractionMaxLimitTest) TEST_F(LowTempRadiantSystemTest, setOffTemperatureLowTemperatureRadiantSystemTest) { + state->init_state(*state); Real64 expectedResult; Real64 actualResult; @@ -3215,62 +3182,58 @@ TEST_F(LowTempRadiantSystemTest, setOffTemperatureLowTemperatureRadiantSystemTes state->dataLowTempRadSys->HydrRadSys.allocate(1); // Test 1: zeroFlow and no throttling range - scheduleIndex = -1; // this assigns a value of 1.0 throttlingRange = 0.0; state->dataLowTempRadSys->HydrRadSys(1).SetpointType = LowTempRadiantSetpointTypes::ZeroFlowPower; expectedResult = 1.0; actualResult = state->dataLowTempRadSys->HydrRadSys(1).setOffTemperatureLowTemperatureRadiantSystem( - *state, scheduleIndex, throttlingRange, state->dataLowTempRadSys->HydrRadSys(1).SetpointType); + *state, Sched::GetScheduleAlwaysOn(*state), throttlingRange, state->dataLowTempRadSys->HydrRadSys(1).SetpointType); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); // Test 2: zeroFlow and positive throttling range - scheduleIndex = -1; // this assigns a value of 1.0 throttlingRange = 0.5; state->dataLowTempRadSys->HydrRadSys(1).SetpointType = LowTempRadiantSetpointTypes::ZeroFlowPower; expectedResult = 1.0; actualResult = state->dataLowTempRadSys->HydrRadSys(1).setOffTemperatureLowTemperatureRadiantSystem( - *state, scheduleIndex, throttlingRange, state->dataLowTempRadSys->HydrRadSys(1).SetpointType); + *state, Sched::GetScheduleAlwaysOn(*state), throttlingRange, state->dataLowTempRadSys->HydrRadSys(1).SetpointType); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); // Test 3: zeroFlow and negative throttling range (cooling situation) - scheduleIndex = -1; // this assigns a value of 1.0 throttlingRange = -0.5; state->dataLowTempRadSys->HydrRadSys(1).SetpointType = LowTempRadiantSetpointTypes::ZeroFlowPower; expectedResult = 1.0; actualResult = state->dataLowTempRadSys->HydrRadSys(1).setOffTemperatureLowTemperatureRadiantSystem( - *state, scheduleIndex, throttlingRange, state->dataLowTempRadSys->HydrRadSys(1).SetpointType); + *state, Sched::GetScheduleAlwaysOn(*state), throttlingRange, state->dataLowTempRadSys->HydrRadSys(1).SetpointType); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); // Test 4: halfFlow and no throttling range - scheduleIndex = -1; // this assigns a value of 1.0 throttlingRange = 0.0; state->dataLowTempRadSys->HydrRadSys(1).SetpointType = LowTempRadiantSetpointTypes::HalfFlowPower; expectedResult = 1.0; actualResult = state->dataLowTempRadSys->HydrRadSys(1).setOffTemperatureLowTemperatureRadiantSystem( - *state, scheduleIndex, throttlingRange, state->dataLowTempRadSys->HydrRadSys(1).SetpointType); + *state, Sched::GetScheduleAlwaysOn(*state), throttlingRange, state->dataLowTempRadSys->HydrRadSys(1).SetpointType); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); // Test 5: halfFlow and positive throttling range - scheduleIndex = -1; // this assigns a value of 1.0 throttlingRange = 0.5; state->dataLowTempRadSys->HydrRadSys(1).SetpointType = LowTempRadiantSetpointTypes::HalfFlowPower; expectedResult = 1.25; actualResult = state->dataLowTempRadSys->HydrRadSys(1).setOffTemperatureLowTemperatureRadiantSystem( - *state, scheduleIndex, throttlingRange, state->dataLowTempRadSys->HydrRadSys(1).SetpointType); + *state, Sched::GetScheduleAlwaysOn(*state), throttlingRange, state->dataLowTempRadSys->HydrRadSys(1).SetpointType); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); // Test 5: halfFlow and negative throttling range (cooling situation) - scheduleIndex = -1; // this assigns a value of 1.0 throttlingRange = -0.5; state->dataLowTempRadSys->HydrRadSys(1).SetpointType = LowTempRadiantSetpointTypes::HalfFlowPower; expectedResult = 0.75; actualResult = state->dataLowTempRadSys->HydrRadSys(1).setOffTemperatureLowTemperatureRadiantSystem( - *state, scheduleIndex, throttlingRange, state->dataLowTempRadSys->HydrRadSys(1).SetpointType); + *state, Sched::GetScheduleAlwaysOn(*state), throttlingRange, state->dataLowTempRadSys->HydrRadSys(1).SetpointType); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); } TEST_F(LowTempRadiantSystemTest, errorCheckZonesAndConstructionsTest) { + state->init_state(*state); + bool actualErrorsFound; std::string const Alpha1("Zone Name"); std::string const Alpha2("An Amazing Zone"); @@ -3366,6 +3329,7 @@ TEST_F(LowTempRadiantSystemTest, errorCheckZonesAndConstructionsTest) TEST_F(LowTempRadiantSystemTest, calculateRunningMeanAverageTemperatureTest) { + state->init_state(*state); // This tests both calculateRunningMeanAverageTemperature and calculateCurrentDailyAverageODB // because calculateCurrentDailyAverageODB is called by calculateRunningMeanAverageTemperature Real64 expectedResult; @@ -3375,10 +3339,10 @@ TEST_F(LowTempRadiantSystemTest, calculateRunningMeanAverageTemperatureTest) auto &thisCFloSys(state->dataLowTempRadSys->CFloRadSys(1)); state->dataLowTempRadSys->CflowRadiantSysDesign.allocate(1); auto &thisRadSysDesign(state->dataLowTempRadSys->CflowRadiantSysDesign(1)); - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataWeather->wvarsHrTsToday.allocate(state->dataGlobal->NumOfTimeStepInHour, Constant::HoursInDay); - for (int hourNumber = 1; hourNumber <= Constant::HoursInDay; ++hourNumber) { - state->dataWeather->wvarsHrTsToday(state->dataGlobal->NumOfTimeStepInHour, hourNumber).OutDryBulbTemp = double(hourNumber); + state->dataGlobal->TimeStepsInHour = 1; + state->dataWeather->wvarsHrTsToday.allocate(state->dataGlobal->TimeStepsInHour, Constant::iHoursInDay); + for (int hourNumber = 1; hourNumber <= Constant::iHoursInDay; ++hourNumber) { + state->dataWeather->wvarsHrTsToday(state->dataGlobal->TimeStepsInHour, hourNumber).OutDryBulbTemp = double(hourNumber); } // Test 1: First day of the simulation and it's in warmup-->everything set to the same temperature @@ -3452,10 +3416,11 @@ TEST_F(LowTempRadiantSystemTest, calculateRunningMeanAverageTemperatureTest) TEST_F(LowTempRadiantSystemTest, updateOperatingModeHistoryTest) { + state->init_state(*state); int expectedResult; int resetResult = -9999; state->dataLowTempRadSys->HydrRadSys.allocate(1); - state->dataGlobal->NumOfTimeStepInHour = 6; + state->dataGlobal->TimeStepsInHour = 6; state->dataGlobal->DayOfSim = 2; state->dataGlobal->HourOfDay = 4; state->dataGlobal->TimeStep = 5; @@ -3473,9 +3438,9 @@ TEST_F(LowTempRadiantSystemTest, updateOperatingModeHistoryTest) thisRadSys.updateOperatingModeHistory(*state); expectedResult = 1; EXPECT_EQ(thisRadSys.lastDayOfSim, expectedResult); - expectedResult = Constant::HoursInDay; + expectedResult = Constant::iHoursInDay; EXPECT_EQ(thisRadSys.lastHourOfDay, expectedResult); - expectedResult = state->dataGlobal->NumOfTimeStepInHour; + expectedResult = state->dataGlobal->TimeStepsInHour; EXPECT_EQ(thisRadSys.lastTimeStep, expectedResult); EXPECT_EQ(thisRadSys.lastOperatingMode, LowTempRadiantSystem::CoolingMode); EXPECT_EQ(thisRadSys.OperatingMode, LowTempRadiantSystem::NotOperating); @@ -3494,7 +3459,7 @@ TEST_F(LowTempRadiantSystemTest, updateOperatingModeHistoryTest) EXPECT_EQ(thisRadSys.lastDayOfSim, expectedResult); expectedResult = 3; EXPECT_EQ(thisRadSys.lastHourOfDay, expectedResult); - expectedResult = state->dataGlobal->NumOfTimeStepInHour; + expectedResult = state->dataGlobal->TimeStepsInHour; EXPECT_EQ(thisRadSys.lastTimeStep, expectedResult); EXPECT_EQ(thisRadSys.lastOperatingMode, LowTempRadiantSystem::CoolingMode); EXPECT_EQ(thisRadSys.OperatingMode, LowTempRadiantSystem::NotOperating); @@ -3541,11 +3506,12 @@ TEST_F(LowTempRadiantSystemTest, updateOperatingModeHistoryTest) TEST_F(LowTempRadiantSystemTest, setOperatingModeBasedOnChangeoverDelayTest) { + state->init_state(*state); int expectedResult; state->dataLowTempRadSys->HydrRadSys.allocate(1); auto &thisRadSys(state->dataLowTempRadSys->HydrRadSys(1)); - state->dataGlobal->NumOfTimeStepInHour = 6; - state->dataGlobal->MinutesPerTimeStep = 10.0; + state->dataGlobal->TimeStepsInHour = 6; + state->dataGlobal->MinutesInTimeStep = 10.0; // Test 1: lastOperatingMode is NotOperating-->don't do anything to OperatingMode thisRadSys.lastOperatingMode = LowTempRadiantSystem::NotOperating; @@ -3572,7 +3538,7 @@ TEST_F(LowTempRadiantSystemTest, setOperatingModeBasedOnChangeoverDelayTest) // anything to OperatingMode thisRadSys.lastOperatingMode = LowTempRadiantSystem::HeatingMode; thisRadSys.OperatingMode = LowTempRadiantSystem::CoolingMode; - thisRadSys.schedPtrChangeoverDelay = 0; + thisRadSys.changeoverDelaySched = nullptr; thisRadSys.setOperatingModeBasedOnChangeoverDelay(*state); expectedResult = LowTempRadiantSystem::CoolingMode; EXPECT_EQ(thisRadSys.OperatingMode, expectedResult); @@ -3582,7 +3548,7 @@ TEST_F(LowTempRadiantSystemTest, setOperatingModeBasedOnChangeoverDelayTest) // to switch over yet-->change OperatingMode to NotOperating thisRadSys.lastOperatingMode = LowTempRadiantSystem::HeatingMode; thisRadSys.OperatingMode = LowTempRadiantSystem::CoolingMode; - thisRadSys.schedPtrChangeoverDelay = -1; + thisRadSys.changeoverDelaySched = Sched::GetScheduleAlwaysOn(*state); state->dataGlobal->DayOfSim = 2; state->dataGlobal->HourOfDay = 1; state->dataGlobal->TimeStep = 1; @@ -3611,6 +3577,7 @@ TEST_F(LowTempRadiantSystemTest, setOperatingModeBasedOnChangeoverDelayTest) TEST_F(LowTempRadiantSystemTest, getFluidToSlabHeatTransferInputTest) { + state->init_state(*state); state->dataLowTempRadSys->CFloRadSys.allocate(1); auto &thisCFloSys(state->dataLowTempRadSys->CFloRadSys(1)); state->dataLowTempRadSys->CflowRadiantSysDesign.allocate(1); @@ -3646,7 +3613,7 @@ TEST_F(LowTempRadiantSystemTest, getFluidToSlabHeatTransferInputTest) TEST_F(LowTempRadiantSystemTest, calculateUFromISOStandardTest) { - + state->init_state(*state); // Test of the ISO Standard 11855-2 Method for calculating the U-value for heat transfer // between the fluid being circulated through a radiant system and the radiant system // material that the pipe/tube is embedded within @@ -3814,6 +3781,7 @@ TEST_F(LowTempRadiantSystemTest, GetLowTempRadiantSystem_MultipleTypes) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataHeatBal->Zone.allocate(3); state->dataHeatBal->Zone(1).Name = "WEST ZONE"; @@ -4637,6 +4605,7 @@ TEST_F(LowTempRadiantSystemTest, VariableFlowCoolingOnlyInputTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -4645,7 +4614,6 @@ TEST_F(LowTempRadiantSystemTest, VariableFlowCoolingOnlyInputTest) EXPECT_FALSE(ErrorsFound); EXPECT_EQ("WEST ZONE", state->dataHeatBal->Zone(1).Name); - ProcessScheduleInput(*state); HeatBalanceManager::SetPreConstructionInputParameters(*state); Material::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); diff --git a/tst/EnergyPlus/unit/Material.unit.cc b/tst/EnergyPlus/unit/Material.unit.cc index 9c0b1786380..9fc9b2c95ff 100644 --- a/tst/EnergyPlus/unit/Material.unit.cc +++ b/tst/EnergyPlus/unit/Material.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -104,10 +104,9 @@ TEST_F(EnergyPlusFixture, GetMaterialDataReadVarAbsorptance) }); ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); auto &s_mat = state->dataMaterial; @@ -144,8 +143,8 @@ TEST_F(EnergyPlusFixture, GetMaterialDataReadVarAbsorptance) EXPECT_ENUM_EQ(mat2->absorpVarCtrlSignal, Material::VariableAbsCtrlSignal::SurfaceReceivedSolarRadiation); EXPECT_EQ(mat2->absorpSolarVarFuncIdx, 2); EXPECT_ENUM_EQ(mat3->absorpVarCtrlSignal, Material::VariableAbsCtrlSignal::Scheduled); - EXPECT_EQ(mat3->absorpThermalVarSchedIdx, 1); - EXPECT_EQ(mat3->absorpSolarVarSchedIdx, 1); + EXPECT_NE(mat3->absorpThermalVarSched, nullptr); + EXPECT_NE(mat3->absorpSolarVarSched, nullptr); std::string idf_objects_bad_inputs = delimited_string({ "MaterialProperty:VariableAbsorptance,", diff --git a/tst/EnergyPlus/unit/MicroCHPElectricGenerator.unit.cc b/tst/EnergyPlus/unit/MicroCHPElectricGenerator.unit.cc index c0dd0e25c32..0c00ecc8640 100644 --- a/tst/EnergyPlus/unit/MicroCHPElectricGenerator.unit.cc +++ b/tst/EnergyPlus/unit/MicroCHPElectricGenerator.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -275,9 +275,13 @@ TEST_F(EnergyPlusFixture, MicroCHPTest_InitGeneratorDynamics) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + state->dataPlnt->TotNumLoops = 1; state->dataPlnt->PlantLoop.allocate(1); + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); + state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(2); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 2; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; diff --git a/tst/EnergyPlus/unit/MicroturbineElectricGenerator.unit.cc b/tst/EnergyPlus/unit/MicroturbineElectricGenerator.unit.cc index d61b5a48f3b..eb1c073d89e 100644 --- a/tst/EnergyPlus/unit/MicroturbineElectricGenerator.unit.cc +++ b/tst/EnergyPlus/unit/MicroturbineElectricGenerator.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/MixedAir.unit.cc b/tst/EnergyPlus/unit/MixedAir.unit.cc index 01bdbee4868..49ebcc399de 100644 --- a/tst/EnergyPlus/unit/MixedAir.unit.cc +++ b/tst/EnergyPlus/unit/MixedAir.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -85,7 +85,6 @@ using namespace EnergyPlus::DataAirLoop; using namespace EnergyPlus::DataAirSystems; using namespace EnergyPlus::DataSizing; using namespace EnergyPlus::DataHeatBalance; -using namespace EnergyPlus::ScheduleManager; using namespace EnergyPlus::DataEnvironment; using namespace EnergyPlus::DataZoneEquipment; using namespace EnergyPlus::DataLoopNode; @@ -140,6 +139,7 @@ TEST_F(EnergyPlusFixture, MixedAir_ProcessOAControllerTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound(false); // If errors detected in input int ControllerNum(0); // Controller number @@ -497,6 +497,8 @@ TEST_F(EnergyPlusFixture, MixedAir_HXBypassOptionTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetOAControllerInputs(*state); EXPECT_EQ(2, state->dataMixedAir->OAController(1).OANode); EXPECT_TRUE(OutAirNodeManager::CheckOutAirNodeNumber(*state, state->dataMixedAir->OAController(1).OANode)); @@ -718,9 +720,6 @@ TEST_F(EnergyPlusFixture, MixedAir_HXBypassOptionTest) TEST_F(EnergyPlusFixture, CO2ControlDesignOccupancyTest) { - state->dataContaminantBalance->Contaminant.CO2Simulation = true; - state->dataContaminantBalance->Contaminant.CO2OutdoorSchedPtr = 1; - std::string const idf_objects = delimited_string({ " OutdoorAir:Node,", " Outside Air Inlet Node; !- Name", @@ -808,6 +807,13 @@ TEST_F(EnergyPlusFixture, CO2ControlDesignOccupancyTest) ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 4; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 15; // must initialize this to get schedules initialized + state->init_state(*state); + + state->dataContaminantBalance->Contaminant.CO2Simulation = true; + state->dataContaminantBalance->Contaminant.CO2OutdoorSched = Sched::GetSchedule(*state, "OCCUPY-1"); + state->dataAirLoop->AirLoopControlInfo.allocate(1); state->dataAirLoop->AirLoopControlInfo(1).LoopFlowRateSet = true; state->dataSize->OARequirements.allocate(1); @@ -816,15 +822,16 @@ TEST_F(EnergyPlusFixture, CO2ControlDesignOccupancyTest) oaRequirements.OAFlowMethod = OAFlowCalcMethod::Sum; oaRequirements.OAFlowPerPerson = 0.003149; oaRequirements.OAFlowPerArea = 0.000407; + oaRequirements.oaFlowFracSched = Sched::GetScheduleAlwaysOn(*state); state->dataSize->ZoneAirDistribution.allocate(1); state->dataSize->ZoneAirDistribution(1).Name = "CM DSZAD WEST ZONE"; - state->dataSize->ZoneAirDistribution(1).ZoneADEffSchPtr = 4; + state->dataSize->ZoneAirDistribution(1).zoneADEffSched = Sched::GetSchedule(*state, "ZONEADEFFSCH"); state->dataHeatBal->Zone.allocate(1); state->dataHeatBal->Zone(1).Name = "WEST ZONE"; state->dataHeatBal->Zone(1).FloorArea = 10.0; - state->dataHeatBal->Zone(1).ZoneContamControllerSchedIndex = 4; + state->dataHeatBal->Zone(1).zoneContamControllerSched = Sched::GetSchedule(*state, "ZONEADEFFSCH"); state->dataHeatBal->Zone(1).numSpaces = 1; state->dataHeatBal->Zone(1).spaceIndexes.emplace_back(1); state->dataGlobal->NumOfZones = 1; @@ -838,8 +845,6 @@ TEST_F(EnergyPlusFixture, CO2ControlDesignOccupancyTest) state->dataAirLoop->AirLoopFlow(1).OAFrac = 0.01; // DataAirLoop variable (AirloopHVAC) state->dataAirLoop->AirLoopFlow(1).OAMinFrac = 0.01; // DataAirLoop variable (AirloopHVAC) - state->dataGlobal->NumOfTimeStepInHour = 4; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized state->dataEnvrn->StdBaroPress = StdPressureSeaLevel; state->dataEnvrn->OutDryBulbTemp = 13.0; state->dataEnvrn->OutBaroPress = StdPressureSeaLevel; @@ -847,7 +852,6 @@ TEST_F(EnergyPlusFixture, CO2ControlDesignOccupancyTest) state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, state->dataEnvrn->OutDryBulbTemp, state->dataEnvrn->OutHumRat); - ScheduleManager::ProcessScheduleInput(*state); InternalHeatGains::GetInternalHeatGainsInput(*state); GetOAControllerInputs(*state); @@ -858,13 +862,15 @@ TEST_F(EnergyPlusFixture, CO2ControlDesignOccupancyTest) EXPECT_NEAR(0.00314899, ventMechanical.VentMechZone(1).ZoneOAPeopleRate, 0.00001); EXPECT_NEAR(0.000407, ventMechanical.VentMechZone(1).ZoneOAAreaRate, 0.00001); - ventMechanical.SchPtr = 1; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; + ventMechanical.availSched = Sched::GetSchedule(*state, "OCCUPY-1"); + ventMechanical.availSched->currentVal = 1.0; + + ventMechanical.VentMechZone(1).zoneADEffSched = Sched::GetSchedule(*state, "ACTSCHD"); + ventMechanical.VentMechZone(1).zoneADEffSched->currentVal = 1.0; - ventMechanical.VentMechZone(1).ZoneADEffSchPtr = 2; - state->dataScheduleMgr->Schedule(2).CurrentValue = 1.0; state->dataHeatBal->Zone(1).TotOccupants = 3; - state->dataScheduleMgr->Schedule(4).CurrentValue = 1.0; + Sched::GetSchedule(*state, "ZONEADEFFSCH")->currentVal = 1.0; + state->dataContaminantBalance->ZoneCO2GainFromPeople.allocate(1); state->dataContaminantBalance->ZoneCO2GainFromPeople(1) = 3.82E-8; state->dataContaminantBalance->OutdoorCO2 = 400; @@ -963,9 +969,6 @@ TEST_F(EnergyPlusFixture, CO2ControlDesignOccupancyTest) TEST_F(EnergyPlusFixture, CO2ControlDesignOccupancyTest3Zone) { - state->dataContaminantBalance->Contaminant.CO2Simulation = true; - state->dataContaminantBalance->Contaminant.CO2OutdoorSchedPtr = 1; - std::string const idf_objects = delimited_string({ " OutdoorAir:Node,", " Outside Air Inlet Node; !- Name", @@ -1080,6 +1083,10 @@ TEST_F(EnergyPlusFixture, CO2ControlDesignOccupancyTest3Zone) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + + state->dataContaminantBalance->Contaminant.CO2Simulation = true; + state->dataContaminantBalance->Contaminant.CO2OutdoorSched = Sched::GetSchedule(*state, "OCCUPY-1"); state->dataAirLoop->AirLoopControlInfo.allocate(1); state->dataAirLoop->AirLoopControlInfo(1).LoopFlowRateSet = true; @@ -1089,25 +1096,26 @@ TEST_F(EnergyPlusFixture, CO2ControlDesignOccupancyTest3Zone) oaRequirements.OAFlowMethod = OAFlowCalcMethod::Sum; oaRequirements.OAFlowPerPerson = 0.003149; oaRequirements.OAFlowPerArea = 0.000407; + oaRequirements.oaFlowFracSched = Sched::GetScheduleAlwaysOn(*state); state->dataSize->ZoneAirDistribution.allocate(1); state->dataSize->ZoneAirDistribution(1).Name = "CM DSZAD WEST ZONE"; - state->dataSize->ZoneAirDistribution(1).ZoneADEffSchPtr = 4; + state->dataSize->ZoneAirDistribution(1).zoneADEffSched = Sched::GetSchedule(*state, "ZONEADEFFSCH"); state->dataHeatBal->Zone.allocate(3); state->dataHeatBal->Zone(1).Name = "WEST ZONE"; state->dataHeatBal->Zone(1).FloorArea = 10.0; - state->dataHeatBal->Zone(1).ZoneContamControllerSchedIndex = 4; + state->dataHeatBal->Zone(1).zoneContamControllerSched = Sched::GetSchedule(*state, "ZONEADEFFSCH"); state->dataHeatBal->Zone(1).numSpaces = 1; state->dataHeatBal->Zone(1).spaceIndexes.emplace_back(1); state->dataHeatBal->Zone(2).Name = "NORTH ZONE"; state->dataHeatBal->Zone(2).FloorArea = 10.0; - state->dataHeatBal->Zone(2).ZoneContamControllerSchedIndex = 4; + state->dataHeatBal->Zone(2).zoneContamControllerSched = Sched::GetSchedule(*state, "ZONEADEFFSCH"); state->dataHeatBal->Zone(2).numSpaces = 1; state->dataHeatBal->Zone(2).spaceIndexes.emplace_back(2); state->dataHeatBal->Zone(3).Name = "EAST ZONE"; state->dataHeatBal->Zone(3).FloorArea = 10.0; - state->dataHeatBal->Zone(3).ZoneContamControllerSchedIndex = 4; + state->dataHeatBal->Zone(3).zoneContamControllerSched = Sched::GetSchedule(*state, "ZONEADEFFSCH"); state->dataHeatBal->Zone(3).numSpaces = 1; state->dataHeatBal->Zone(3).spaceIndexes.emplace_back(3); state->dataGlobal->NumOfZones = 3; @@ -1127,8 +1135,8 @@ TEST_F(EnergyPlusFixture, CO2ControlDesignOccupancyTest3Zone) state->dataAirLoop->AirLoopFlow(1).OAFrac = 0.01; // DataAirLoop variable (AirloopHVAC) state->dataAirLoop->AirLoopFlow(1).OAMinFrac = 0.01; // DataAirLoop variable (AirloopHVAC) - state->dataGlobal->NumOfTimeStepInHour = 4; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized + state->dataGlobal->TimeStepsInHour = 4; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 15; // must initialize this to get schedules initialized state->dataEnvrn->StdBaroPress = StdPressureSeaLevel; state->dataEnvrn->OutDryBulbTemp = 13.0; state->dataEnvrn->OutBaroPress = StdPressureSeaLevel; @@ -1136,7 +1144,6 @@ TEST_F(EnergyPlusFixture, CO2ControlDesignOccupancyTest3Zone) state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, state->dataEnvrn->OutDryBulbTemp, state->dataEnvrn->OutHumRat); - ScheduleManager::ProcessScheduleInput(*state); InternalHeatGains::GetInternalHeatGainsInput(*state); GetOAControllerInputs(*state); @@ -1151,17 +1158,18 @@ TEST_F(EnergyPlusFixture, CO2ControlDesignOccupancyTest3Zone) EXPECT_NEAR(0.00314899, ventMechanical.VentMechZone(3).ZoneOAPeopleRate, 0.00001); EXPECT_NEAR(0.000407, ventMechanical.VentMechZone(3).ZoneOAAreaRate, 0.00001); - ventMechanical.SchPtr = 1; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; + ventMechanical.availSched = Sched::GetSchedule(*state, "OCCUPY-1"); + ventMechanical.availSched->currentVal = 1.0; + + ventMechanical.VentMechZone(1).zoneADEffSched = Sched::GetSchedule(*state, "ACTSCHD"); + ventMechanical.VentMechZone(2).zoneADEffSched = Sched::GetSchedule(*state, "ACTSCHD"); + ventMechanical.VentMechZone(3).zoneADEffSched = Sched::GetSchedule(*state, "ACTSCHD"); + Sched::GetSchedule(*state, "ACTSCHD")->currentVal = 1.0; - ventMechanical.VentMechZone(1).ZoneADEffSchPtr = 2; - ventMechanical.VentMechZone(2).ZoneADEffSchPtr = 2; - ventMechanical.VentMechZone(3).ZoneADEffSchPtr = 2; - state->dataScheduleMgr->Schedule(2).CurrentValue = 1.0; state->dataHeatBal->Zone(1).TotOccupants = 3; state->dataHeatBal->Zone(2).TotOccupants = 3; state->dataHeatBal->Zone(3).TotOccupants = 3; - state->dataScheduleMgr->Schedule(4).CurrentValue = 1.0; + Sched::GetSchedule(*state, "ZONEADEFFSCH")->currentVal = 1.0; state->dataContaminantBalance->ZoneCO2GainFromPeople.allocate(3); state->dataContaminantBalance->ZoneCO2GainFromPeople(1) = 3.82E-8; state->dataContaminantBalance->ZoneCO2GainFromPeople(2) = 3.82E-8; @@ -1391,13 +1399,15 @@ TEST_F(EnergyPlusFixture, MissingDesignOccupancyTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataAirLoop->AirLoopControlInfo.allocate(1); state->dataAirLoop->AirLoopControlInfo(1).LoopFlowRateSet = true; state->dataSize->OARequirements.allocate(1); state->dataSize->ZoneAirDistribution.allocate(1); state->dataSize->ZoneAirDistribution(1).Name = "CM DSZAD WEST ZONE"; - state->dataSize->ZoneAirDistribution(1).ZoneADEffSchPtr = 4; + + state->dataSize->ZoneAirDistribution(1).zoneADEffSched = Sched::GetSchedule(*state, "ZONEADEFFSCH"); state->dataAirLoop->AirLoopFlow.allocate(1); state->dataAirLoop->AirLoopFlow(1).OAFrac = 0.01; // DataAirLoop variable (AirloopHVAC) @@ -1511,6 +1521,7 @@ TEST_F(EnergyPlusFixture, MixedAir_TestHXinOASystem) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataMixedAir->GetOASysInputFlag = true; state->dataGlobal->BeginEnvrnFlag = true; @@ -1656,13 +1667,16 @@ TEST_F(EnergyPlusFixture, MixedAir_HumidifierOnOASystemTest) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60 / state->dataGlobal->NumOfTimeStepInHour; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60 / state->dataGlobal->TimeStepsInHour; + state->init_state(*state); + state->dataGlobal->TimeStep = 1; state->dataGlobal->HourOfDay = 1; state->dataEnvrn->DayOfWeek = 1; state->dataEnvrn->DayOfYear_Schedule = 1; - ScheduleManager::UpdateScheduleValues(*state); + + Sched::UpdateScheduleVals(*state); state->dataMixedAir->GetOASysInputFlag = true; state->dataGlobal->BeginEnvrnFlag = true; @@ -1752,6 +1766,7 @@ TEST_F(EnergyPlusFixture, FreezingCheckTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetOAControllerInputs(*state); @@ -1802,7 +1817,7 @@ TEST_F(EnergyPlusFixture, FreezingCheckTest) ; // OA inlet (actuated) air nodes, dry air state->dataMixedAir->OAController(1).CoolCoilFreezeCheck = true; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; + Sched::GetSchedule(*state, "OAFRACTIONSCHED")->currentVal = 1.0; state->dataMixedAir->OAController(OAControllerNum).CalcOAController(*state, AirLoopNum, true); @@ -1896,6 +1911,8 @@ TEST_F(EnergyPlusFixture, MixedAir_MissingHIghRHControlInputTest) compare_err_stream(""); // just for debugging + state->init_state(*state); + bool ErrorsFound(false); // If errors detected in input int ControllerNum(0); // Controller number int NumArg(0); @@ -2026,6 +2043,7 @@ TEST_F(EnergyPlusFixture, MixedAir_HIghRHControlTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); compare_err_stream(""); // just for debugging @@ -2197,6 +2215,7 @@ TEST_F(EnergyPlusFixture, OAControllerMixedAirSPTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataAirLoop->AirLoopFlow.allocate(1); state->dataAirLoop->AirLoopControlInfo.allocate(1); @@ -2347,6 +2366,8 @@ TEST_F(EnergyPlusFixture, MixedAir_MiscGetsPart1) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetOAControllerInputs(*state); EXPECT_EQ(1, GetNumOAMixers(*state)); @@ -5760,6 +5781,8 @@ TEST_F(EnergyPlusFixture, MixedAir_MiscGetsPart2) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetOAControllerInputs(*state); EXPECT_EQ(6, GetNumOAMixers(*state)); @@ -5843,6 +5866,7 @@ TEST_F(EnergyPlusFixture, MechVentController_VRPCap) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Real64 SysMassFlow(0.0); // System supply mass flow rate [kg/s] Real64 OAMassFlow(0.0); // OA mass flow rate [kg/s] @@ -5869,7 +5893,7 @@ TEST_F(EnergyPlusFixture, MechVentController_VRPCap) OAMassFlow = state->dataMixedAir->VentilationMechanical(1).CalcMechVentController(*state, SysMassFlow); EXPECT_NEAR( - ExpectedOAMassFlow, OAMassFlow, 0.001); // Expect to cap the system OA to the desing OA air flow, OAMassFlow without the cap is ~0.86 m3/s + ExpectedOAMassFlow, OAMassFlow, 0.001); // Expect to cap the system OA to the design OA air flow, OAMassFlow without the cap is ~0.86 m3/s } TEST_F(EnergyPlusFixture, MechVentController_VRPNoCap) @@ -5952,6 +5976,7 @@ TEST_F(EnergyPlusFixture, MechVentController_VRPNoCap) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Real64 OAMassFlow = 0.0; // OA mass flow rate [kg/s] bool ErrorsFound = false; @@ -6112,6 +6137,7 @@ TEST_F(EnergyPlusFixture, MechVentController_ACHflow) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Real64 SysMassFlow(0.0); // System supply mass flow rate [kg/s] Real64 OAMassFlow(0.0); // OA mass flow rate [kg/s] @@ -6160,6 +6186,7 @@ TEST_F(EnergyPlusFixture, MechVentController_IAQPTests) " Zone, Zone 2;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound(false); GetZoneData(*state, ErrorsFound); @@ -6193,10 +6220,10 @@ TEST_F(EnergyPlusFixture, MechVentController_IAQPTests) EXPECT_EQ(1.5, OAMassFlow); // Case 4 - System OA method = IndoorAirQualityProcedureCombined, SOAM_IAQPCOM, set zone OA schedules to alwaysoff - state->dataScheduleMgr->Schedule.allocate(1); - state->dataScheduleMgr->Schedule(1).CurrentValue = 0.0; - state->dataMixedAir->VentilationMechanical(1).VentMechZone(1).ZoneOASchPtr = 1; - state->dataMixedAir->VentilationMechanical(1).VentMechZone(2).ZoneOASchPtr = 1; + auto *sched = Sched::AddScheduleConstant(*state, "OCCUPY-1"); + sched->currentVal = 0.0; + state->dataMixedAir->VentilationMechanical(1).VentMechZone(1).zoneOASched = sched; + state->dataMixedAir->VentilationMechanical(1).VentMechZone(2).zoneOASched = sched; state->dataMixedAir->VentilationMechanical(1).SystemOAMethod = SysOAMethod::IAQPCOM; OAMassFlow = state->dataMixedAir->VentilationMechanical(1).CalcMechVentController(*state, SysMassFlow); @@ -6205,9 +6232,6 @@ TEST_F(EnergyPlusFixture, MechVentController_IAQPTests) TEST_F(EnergyPlusFixture, MechVentController_ZoneSumTests) { - state->dataContaminantBalance->Contaminant.CO2Simulation = true; - state->dataContaminantBalance->Contaminant.CO2OutdoorSchedPtr = 1; - std::string const idf_objects = delimited_string({" Controller:MechanicalVentilation,", " DCVObject, !- Name", " , !- Availability Schedule Name", @@ -6342,19 +6366,23 @@ TEST_F(EnergyPlusFixture, MechVentController_ZoneSumTests) " 600; !- Floor Area {m2}"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + + state->dataContaminantBalance->Contaminant.CO2Simulation = true; + state->dataContaminantBalance->Contaminant.CO2OutdoorSched = Sched::GetSchedule(*state, "ZONE 1 OA SCHEDULE"); bool ErrorsFound(false); GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); // Initialize schedule values - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60 / state->dataGlobal->NumOfTimeStepInHour; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60 / state->dataGlobal->TimeStepsInHour; state->dataGlobal->TimeStep = 1; state->dataGlobal->HourOfDay = 1; state->dataEnvrn->DayOfWeek = 1; state->dataEnvrn->DayOfYear_Schedule = 100; - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // Initialize zone areas and volumes - too many other things need to be set up to do these in the normal routines int NumZones(6); @@ -6401,16 +6429,16 @@ TEST_F(EnergyPlusFixture, MechVentController_ZoneSumTests) EXPECT_NEAR(1951.5, OAMassFlow, 0.00001); // Case 2 - Turn off Zone 4-6 - state->dataScheduleMgr->Schedule(4).CurrentValue = 0.0; - state->dataScheduleMgr->Schedule(5).CurrentValue = 0.0; - state->dataScheduleMgr->Schedule(6).CurrentValue = 0.0; + Sched::GetSchedule(*state, "ZONE 4 OA SCHEDULE")->currentVal = 0.0; + Sched::GetSchedule(*state, "ZONE 5 OA SCHEDULE")->currentVal = 0.0; + Sched::GetSchedule(*state, "ZONE 6 OA SCHEDULE")->currentVal = 0.0; OAMassFlow = state->dataMixedAir->VentilationMechanical(1).CalcMechVentController(*state, SysMassFlow); EXPECT_NEAR(41.0, OAMassFlow, 0.00001); // Case 3 - Turn off remaining zones - state->dataScheduleMgr->Schedule(1).CurrentValue = 0.0; - state->dataScheduleMgr->Schedule(2).CurrentValue = 0.0; - state->dataScheduleMgr->Schedule(3).CurrentValue = 0.0; + Sched::GetSchedule(*state, "ZONE 1 OA SCHEDULE")->currentVal = 0.0; + Sched::GetSchedule(*state, "ZONE 2 OA SCHEDULE")->currentVal = 0.0; + Sched::GetSchedule(*state, "ZONE 3 OA SCHEDULE")->currentVal = 0.0; OAMassFlow = state->dataMixedAir->VentilationMechanical(1).CalcMechVentController(*state, SysMassFlow); EXPECT_EQ(0.0, OAMassFlow); @@ -6419,10 +6447,6 @@ TEST_F(EnergyPlusFixture, MechVentController_ZoneSumTests) TEST_F(EnergyPlusFixture, CO2ControlDesignOARateTest) { - // Test a new feature: Proportional Demand Control Ventilation (DCV) Enhancements - state->dataContaminantBalance->Contaminant.CO2Simulation = true; - state->dataContaminantBalance->Contaminant.CO2OutdoorSchedPtr = 1; - std::string const idf_objects = delimited_string({ " OutdoorAir:Node,", " Outside Air Inlet Node; !- Name", @@ -6491,13 +6515,18 @@ TEST_F(EnergyPlusFixture, CO2ControlDesignOARateTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + + // Test a new feature: Proportional Demand Control Ventilation (DCV) Enhancements + state->dataContaminantBalance->Contaminant.CO2Simulation = true; + state->dataContaminantBalance->Contaminant.CO2OutdoorSched = Sched::GetSchedule(*state, "VENTSCHEDULE"); state->dataGlobal->CurrentTime = 0.25; state->dataContaminantBalance->ContaminantControlledZone.allocate(1); - state->dataContaminantBalance->ContaminantControlledZone(1).AvaiSchedPtr = 4; - state->dataContaminantBalance->ContaminantControlledZone(1).SPSchedIndex = 5; - state->dataContaminantBalance->ContaminantControlledZone(1).ZoneMinCO2SchedIndex = 6; - state->dataContaminantBalance->ContaminantControlledZone(1).ZoneMaxCO2SchedIndex = 7; + state->dataContaminantBalance->ContaminantControlledZone(1).availSched = Sched::GetSchedule(*state, "CO2AVAILSCHEDULE"); + state->dataContaminantBalance->ContaminantControlledZone(1).setptSched = Sched::GetSchedule(*state, "CO2SETPOINTSCHEDULE"); + state->dataContaminantBalance->ContaminantControlledZone(1).zoneMinCO2Sched = Sched::GetSchedule(*state, "CO2MINSCHEDULE"); + state->dataContaminantBalance->ContaminantControlledZone(1).zoneMaxCO2Sched = Sched::GetSchedule(*state, "CO2MAXSCHEDULE"); state->dataAirLoop->AirLoopControlInfo.allocate(1); state->dataAirLoop->AirLoopControlInfo(1).LoopFlowRateSet = true; @@ -6506,16 +6535,17 @@ TEST_F(EnergyPlusFixture, CO2ControlDesignOARateTest) state->dataSize->OARequirements(1).OAFlowMethod = OAFlowCalcMethod::Sum; state->dataSize->OARequirements(1).OAFlowPerPerson = 0.003149; state->dataSize->OARequirements(1).OAFlowPerArea = 0.000407; - state->dataSize->OARequirements(1).OAPropCtlMinRateSchPtr = 8; + state->dataSize->OARequirements(1).oaFlowFracSched = Sched::GetScheduleAlwaysOn(*state); + state->dataSize->OARequirements(1).oaPropCtlMinRateSched = Sched::GetSchedule(*state, "MINIMUM OUTDOOR AIR FLOW RATE SCHEDULE"); state->dataSize->ZoneAirDistribution.allocate(1); state->dataSize->ZoneAirDistribution(1).Name = "CM DSZAD WEST ZONE"; - state->dataSize->ZoneAirDistribution(1).ZoneADEffSchPtr = 4; + state->dataSize->ZoneAirDistribution(1).zoneADEffSched = Sched::GetSchedule(*state, "CO2AVAILSCHEDULE"); state->dataHeatBal->Zone.allocate(1); state->dataHeatBal->Zone(1).Name = "WEST ZONE"; state->dataHeatBal->Zone(1).FloorArea = 10.0; - state->dataHeatBal->Zone(1).ZoneContamControllerSchedIndex = 4; + state->dataHeatBal->Zone(1).zoneContamControllerSched = Sched::GetSchedule(*state, "CO2AVAILSCHEDULE"); state->dataAirLoop->AirLoopFlow.allocate(1); state->dataAirLoop->AirLoopFlow(1).OAFrac = 0.01; // DataAirLoop variable (AirloopHVAC) @@ -6532,19 +6562,20 @@ TEST_F(EnergyPlusFixture, CO2ControlDesignOARateTest) state->dataMixedAir->OAController(1).MixMassFlow = 1.7 * state->dataEnvrn->StdRhoAir; state->dataMixedAir->OAController(1).MaxOAMassFlowRate = 1.7 * state->dataEnvrn->StdRhoAir; state->dataAirLoop->AirLoopFlow(1).DesSupply = 1.7; - state->dataMixedAir->VentilationMechanical(1).SchPtr = 1; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; + state->dataMixedAir->VentilationMechanical(1).availSched = Sched::GetSchedule(*state, "VENTSCHEDULE"); - state->dataMixedAir->VentilationMechanical(1).VentMechZone(1).ZoneADEffSchPtr = 2; - state->dataScheduleMgr->Schedule(2).CurrentValue = 1.0; + Sched::GetSchedule(*state, "VENTSCHEDULE")->currentVal = 1.0; + + state->dataMixedAir->VentilationMechanical(1).VentMechZone(1).zoneADEffSched = Sched::GetSchedule(*state, "ZONEADEFFSCH"); + Sched::GetSchedule(*state, "ZONEADEFFSCH")->currentVal = 1.0; state->dataHeatBal->TotPeople = 1; state->dataHeatBal->People.allocate(1); state->dataHeatBal->People(1).Name = "WestPeople"; state->dataHeatBal->People(1).ZonePtr = 1; state->dataHeatBal->People(1).NumberOfPeople = 3; state->dataHeatBal->Zone(1).TotOccupants = 3; - state->dataScheduleMgr->Schedule(3).CurrentValue = 0.1; - state->dataScheduleMgr->Schedule(4).CurrentValue = 1.0; + Sched::GetSchedule(*state, "OAFRACTIONSCHED")->currentVal = 0.1; + Sched::GetSchedule(*state, "CO2AVAILSCHEDULE")->currentVal = 1.0; state->dataContaminantBalance->ZoneCO2GainFromPeople.allocate(1); state->dataContaminantBalance->ZoneCO2GainFromPeople(1) = 3.82E-8; state->dataContaminantBalance->OutdoorCO2 = 400; @@ -6564,12 +6595,12 @@ TEST_F(EnergyPlusFixture, CO2ControlDesignOARateTest) state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataHeatBal->ZoneIntGain.allocate(1); state->dataHeatBal->ZoneIntGain(1).NOFOCC = 0.1; - state->dataScheduleMgr->Schedule(5).CurrentValue = 900.0; - state->dataScheduleMgr->Schedule(6).CurrentValue = 300.0; - state->dataScheduleMgr->Schedule(7).CurrentValue = 900.0; - state->dataHeatBal->Zone(1).ZoneMinCO2SchedIndex = 6; - state->dataHeatBal->Zone(1).ZoneMaxCO2SchedIndex = 7; - state->dataScheduleMgr->Schedule(8).CurrentValue = 0.01; + Sched::GetSchedule(*state, "CO2SETPOINTSCHEDULE")->currentVal = 900.0; + Sched::GetSchedule(*state, "CO2MINSCHEDULE")->currentVal = 300.0; + Sched::GetSchedule(*state, "CO2MAXSCHEDULE")->currentVal = 900.0; + state->dataHeatBal->Zone(1).zoneMinCO2Sched = Sched::GetSchedule(*state, "CO2MINSCHEDULE"); + state->dataHeatBal->Zone(1).zoneMaxCO2Sched = Sched::GetSchedule(*state, "CO2MAXSCHEDULE"); + Sched::GetSchedule(*state, "MINIMUM OUTDOOR AIR FLOW RATE SCHEDULE")->currentVal = 0.01; state->dataMixedAir->OAController(1).CalcOAController(*state, 1, true); @@ -6826,6 +6857,7 @@ TEST_F(EnergyPlusFixture, MixedAir_OAControllerOrderInControllersListTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetOAControllerInputs(*state); @@ -6909,6 +6941,8 @@ TEST_F(EnergyPlusFixture, OAController_ProportionalMinimum_HXBypassTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetOAControllerInputs(*state); EXPECT_EQ(2, state->dataMixedAir->OAController(1).OANode); EXPECT_TRUE(OutAirNodeManager::CheckOutAirNodeNumber(*state, state->dataMixedAir->OAController(1).OANode)); @@ -7091,6 +7125,8 @@ TEST_F(EnergyPlusFixture, OAController_FixedMinimum_MinimumLimitTypeTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetOutsideAirSysInputs(*state); EXPECT_EQ(1, state->dataAirLoop->NumOASystems); EXPECT_EQ("OA SYS", state->dataAirLoop->OutsideAirSys(1).Name); @@ -7294,6 +7330,8 @@ TEST_F(EnergyPlusFixture, OAController_HighExhaustMassFlowTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetOutsideAirSysInputs(*state); EXPECT_EQ(1, state->dataAirLoop->NumOASystems); EXPECT_EQ("OA SYS", state->dataAirLoop->OutsideAirSys(1).Name); @@ -7541,6 +7579,8 @@ TEST_F(EnergyPlusFixture, OAController_LowExhaustMassFlowTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetOutsideAirSysInputs(*state); EXPECT_EQ(1, state->dataAirLoop->NumOASystems); EXPECT_EQ("OA SYS", state->dataAirLoop->OutsideAirSys(1).Name); @@ -7749,6 +7789,8 @@ TEST_F(EnergyPlusFixture, MixedAir_TemperatureError) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetOAControllerInputs(*state); EXPECT_EQ(1, GetNumOAMixers(*state)); diff --git a/tst/EnergyPlus/unit/MixerComponent.unit.cc b/tst/EnergyPlus/unit/MixerComponent.unit.cc index ee812ca78c9..79457c4c013 100644 --- a/tst/EnergyPlus/unit/MixerComponent.unit.cc +++ b/tst/EnergyPlus/unit/MixerComponent.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/MoistureBalanceEMPD.unit.cc b/tst/EnergyPlus/unit/MoistureBalanceEMPD.unit.cc index 961e19d6867..aa23fa8ed6f 100644 --- a/tst/EnergyPlus/unit/MoistureBalanceEMPD.unit.cc +++ b/tst/EnergyPlus/unit/MoistureBalanceEMPD.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/NodeInputManager.unit.cc b/tst/EnergyPlus/unit/NodeInputManager.unit.cc index b61b18d8ec6..00b38cf7631 100644 --- a/tst/EnergyPlus/unit/NodeInputManager.unit.cc +++ b/tst/EnergyPlus/unit/NodeInputManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/OASystemHWPreheatCoil.unit.cc b/tst/EnergyPlus/unit/OASystemHWPreheatCoil.unit.cc index ac99e523cae..a201b0cb2c0 100644 --- a/tst/EnergyPlus/unit/OASystemHWPreheatCoil.unit.cc +++ b/tst/EnergyPlus/unit/OASystemHWPreheatCoil.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/OccupantDiversity.unit.cc b/tst/EnergyPlus/unit/OccupantDiversity.unit.cc index 1636e528928..b7aca63e5d9 100644 --- a/tst/EnergyPlus/unit/OccupantDiversity.unit.cc +++ b/tst/EnergyPlus/unit/OccupantDiversity.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/OutAirNodeManager.unit.cc b/tst/EnergyPlus/unit/OutAirNodeManager.unit.cc index 41105bf25dc..8a4fa90ccf2 100644 --- a/tst/EnergyPlus/unit/OutAirNodeManager.unit.cc +++ b/tst/EnergyPlus/unit/OutAirNodeManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -67,7 +67,6 @@ TEST_F(EnergyPlusFixture, OutAirNodeManager_OATdbTwbOverrideTest) state->dataOutAirNodeMgr->NumOutsideAirNodes = 3; state->dataOutAirNodeMgr->OutsideAirNodeList.allocate(3); state->dataLoopNodes->Node.allocate(3); - state->dataScheduleMgr->Schedule.allocate(2); state->dataEnvrn->OutDryBulbTemp = 25.0; state->dataEnvrn->OutWetBulbTemp = 15.0; @@ -77,13 +76,14 @@ TEST_F(EnergyPlusFixture, OutAirNodeManager_OATdbTwbOverrideTest) state->dataEnvrn->OutHumRat = Psychrometrics::PsyWFnTdbTwbPb(*state, state->dataEnvrn->OutDryBulbTemp, state->dataEnvrn->OutWetBulbTemp, state->dataEnvrn->OutBaroPress); - state->dataScheduleMgr->Schedule(1).CurrentValue = 24.0; state->dataOutAirNodeMgr->OutsideAirNodeList(1) = 1; state->dataOutAirNodeMgr->OutsideAirNodeList(2) = 2; state->dataOutAirNodeMgr->OutsideAirNodeList(3) = 3; // Scheduled value state->dataLoopNodes->Node(1).IsLocalNode = true; - state->dataLoopNodes->Node(1).OutAirDryBulbSchedNum = 1; + state->dataLoopNodes->Node(1).outAirDryBulbSched = Sched::AddScheduleConstant(*state, "Out Air Dry Bulb"); + state->dataLoopNodes->Node(1).outAirDryBulbSched->currentVal = 24.0; + state->dataLoopNodes->Node(1).OutAirDryBulb = state->dataEnvrn->OutDryBulbTemp; state->dataLoopNodes->Node(1).OutAirWetBulb = state->dataEnvrn->OutWetBulbTemp; // EMS override value diff --git a/tst/EnergyPlus/unit/OutdoorAirUnit.unit.cc b/tst/EnergyPlus/unit/OutdoorAirUnit.unit.cc index 597d8498c8f..bd986f0acea 100644 --- a/tst/EnergyPlus/unit/OutdoorAirUnit.unit.cc +++ b/tst/EnergyPlus/unit/OutdoorAirUnit.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -91,7 +91,6 @@ using namespace EnergyPlus::Fans; using namespace EnergyPlus::HeatBalanceManager; using namespace OutputReportPredefined; using namespace EnergyPlus::Psychrometrics; -using namespace EnergyPlus::ScheduleManager; using namespace EnergyPlus::SteamCoils; using namespace EnergyPlus::WaterCoils; @@ -287,6 +286,7 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_AutoSize) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataGlobal->CurrentTime = 0.25; state->dataGlobal->BeginEnvrnFlag = true; @@ -302,7 +302,6 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_AutoSize) state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); - ProcessScheduleInput(*state); // read schedules GetCurveInput(*state); // read curves GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); @@ -334,9 +333,9 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_AutoSize) ZoneInletNode = OutdoorAirUnit::GetOutdoorAirUnitZoneInletNode(*state, OAUnitNum); // schedule values will get reset to 0 if initialized before GetInput - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // enable the VRF condenser - state->dataScheduleMgr->Schedule(2).CurrentValue = 1.0; // enable the terminal unit - state->dataScheduleMgr->Schedule(3).CurrentValue = 1.0; // turn on fan + Sched::GetSchedule(*state, "AVAILSCHED")->currentVal = 1.0; // enable the VRF condenser + Sched::GetSchedule(*state, "OAULOCTRLTEMP")->currentVal = 1.0; // enable the terminal unit + Sched::GetSchedule(*state, "OAUHICTRLTEMP")->currentVal = 1.0; // turn on fan int EAFanInletNode = state->dataFans->fans(2)->inletNodeNum; state->dataLoopNodes->Node(EAFanInletNode).MassFlowRate = 0.60215437; // zone exhaust flow rate state->dataLoopNodes->Node(EAFanInletNode).MassFlowRateMaxAvail = 0.60215437; // exhaust fan will not turn on unless max avail is set @@ -559,23 +558,20 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_WaterCoolingCoilAutoSizeTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); state->dataEnvrn->OutBaroPress = 101325.0; state->dataGlobal->TimeStep = 1; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; state->dataGlobal->DoingSizing = true; - InitializePsychRoutines(*state); - bool ErrorsFound(false); GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); EXPECT_EQ("THERMAL ZONE 1", state->dataHeatBal->Zone(1).Name); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; Fans::GetFanInput(*state); OutdoorAirUnit::GetOutdoorAirUnitInputs(*state); @@ -610,8 +606,8 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_WaterCoolingCoilAutoSizeTest) state->dataWaterCoils->WaterCoil(1).WaterPlantLoc.compNum = 1; state->dataPlnt->PlantLoop(1).Name = "ChilledWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterCooling; @@ -637,13 +633,13 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_WaterCoolingCoilAutoSizeTest) state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, state->dataGlobal->HourOfDay); - UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); state->dataSize->ZoneEqSizing.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback(1) = false; state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataSize->ZoneSizingRunDone = true; state->dataSize->CurZoneEqNum = 1; @@ -690,10 +686,8 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_WaterCoolingCoilAutoSizeTest) Real64 DesWaterCoolingCoilLoad = DesAirMassFlow * (EnthalpyAirIn - EnthalpyAirOut) + FanCoolLoad; Real64 CoilDesWaterDeltaT = state->dataSize->PlantSizData(1).DeltaT; - Real64 Cp = FluidProperties::GetSpecificHeatGlycol( - *state, state->dataPlnt->PlantLoop(1).FluidName, Constant::CWInitConvTemp, state->dataPlnt->PlantLoop(1).FluidIndex, " "); - Real64 rho = FluidProperties::GetDensityGlycol( - *state, state->dataPlnt->PlantLoop(1).FluidName, Constant::CWInitConvTemp, state->dataPlnt->PlantLoop(1).FluidIndex, " "); + Real64 Cp = state->dataPlnt->PlantLoop(1).glycol->getSpecificHeat(*state, Constant::CWInitConvTemp, " "); + Real64 rho = state->dataPlnt->PlantLoop(1).glycol->getDensity(*state, Constant::CWInitConvTemp, " "); Real64 DesCoolingCoilWaterVolFlowRate = DesWaterCoolingCoilLoad / (CoilDesWaterDeltaT * Cp * rho); // check water coil water flow rate calc EXPECT_EQ(DesWaterCoolingCoilLoad, state->dataWaterCoils->WaterCoil(1).DesWaterCoolingCoilRate); @@ -871,24 +865,21 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_SteamHeatingCoilAutoSizeTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); state->dataEnvrn->StdRhoAir = 1.20; state->dataEnvrn->OutBaroPress = 101325.0; state->dataGlobal->TimeStep = 1; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; state->dataGlobal->DoingSizing = true; - InitializePsychRoutines(*state); - bool ErrorsFound(false); GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); EXPECT_EQ("THERMAL ZONE 1", state->dataHeatBal->Zone(1).Name); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; Fans::GetFanInput(*state); OutdoorAirUnit::GetOutdoorAirUnitInputs(*state); @@ -923,8 +914,9 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_SteamHeatingCoilAutoSizeTest) state->dataSteamCoils->SteamCoil(1).plantLoc.compNum = 1; state->dataPlnt->PlantLoop(1).Name = "SteamLoop"; - state->dataPlnt->PlantLoop(1).FluidIndex = 0; state->dataPlnt->PlantLoop(1).FluidName = "STEAM"; + state->dataPlnt->PlantLoop(1).steam = Fluid::GetSteam(*state); + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataSteamCoils->SteamCoil(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilSteamAirHeating; @@ -950,13 +942,13 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_SteamHeatingCoilAutoSizeTest) state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, state->dataGlobal->HourOfDay); - UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); state->dataSize->ZoneEqSizing.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback(1) = false; state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataSize->ZoneSizingRunDone = true; state->dataSize->CurZoneEqNum = 1; @@ -996,14 +988,10 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_SteamHeatingCoilAutoSizeTest) Real64 DesSteamCoilLoad = DesAirMassFlow * CpAirAvg * (DesCoilOutTemp - DesCoilInTemp); // do steam flow rate sizing calculation - Real64 EnthSteamIn = - FluidProperties::GetSatEnthalpyRefrig(*state, "STEAM", Constant::SteamInitConvTemp, 1.0, state->dataSteamCoils->SteamCoil(1).FluidIndex, ""); - Real64 EnthSteamOut = - FluidProperties::GetSatEnthalpyRefrig(*state, "STEAM", Constant::SteamInitConvTemp, 0.0, state->dataSteamCoils->SteamCoil(1).FluidIndex, ""); - Real64 SteamDensity = - FluidProperties::GetSatDensityRefrig(*state, "STEAM", Constant::SteamInitConvTemp, 1.0, state->dataSteamCoils->SteamCoil(1).FluidIndex, ""); - Real64 CpOfCondensate = FluidProperties::GetSatSpecificHeatRefrig( - *state, "STEAM", Constant::SteamInitConvTemp, 0.0, state->dataSteamCoils->SteamCoil(1).FluidIndex, ""); + Real64 EnthSteamIn = state->dataSteamCoils->SteamCoil(1).steam->getSatEnthalpy(*state, Constant::SteamInitConvTemp, 1.0, ""); + Real64 EnthSteamOut = state->dataSteamCoils->SteamCoil(1).steam->getSatEnthalpy(*state, Constant::SteamInitConvTemp, 0.0, ""); + Real64 SteamDensity = state->dataSteamCoils->SteamCoil(1).steam->getSatDensity(*state, Constant::SteamInitConvTemp, 1.0, ""); + Real64 CpOfCondensate = state->dataSteamCoils->SteamCoil(1).steam->getSatSpecificHeat(*state, Constant::SteamInitConvTemp, 0.0, ""); Real64 LatentHeatChange = EnthSteamIn - EnthSteamOut; Real64 DesMaxSteamVolFlowRate = DesSteamCoilLoad / (SteamDensity * (LatentHeatChange + state->dataSteamCoils->SteamCoil(1).DegOfSubcooling * CpOfCondensate)); diff --git a/tst/EnergyPlus/unit/OutputFiles.unit.cc b/tst/EnergyPlus/unit/OutputFiles.unit.cc index 62a7f0d0747..b209805b090 100644 --- a/tst/EnergyPlus/unit/OutputFiles.unit.cc +++ b/tst/EnergyPlus/unit/OutputFiles.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -276,7 +276,8 @@ TEST_F(EnergyPlusFixture, OutputControlFiles) " ** ~~~ ** See InputOutputReference document for more details.", " ************* Object=Building=Bldg", " ** ~~~ ** Object=GlobalGeometryRules", - }); + " ** ~~~ ** Object=Timestep", + " ** ~~~ ** Object=Version"}); compare_err_stream(expected_error); } diff --git a/tst/EnergyPlus/unit/OutputProcessor.unit.cc b/tst/EnergyPlus/unit/OutputProcessor.unit.cc index effaeb282d0..7ef91be7a2b 100644 --- a/tst/EnergyPlus/unit/OutputProcessor.unit.cc +++ b/tst/EnergyPlus/unit/OutputProcessor.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -662,7 +662,7 @@ namespace OutputProcessor { EndMinute, StartMinute, DSTIndicator, - ScheduleManager::dayTypeNames[CurDayType]); + Sched::dayTypeNames[CurDayType]); EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,1,12,21, 0, 1, 0.00,10.00,WinterDesignDay"}, "\n"))); // TSMeter @@ -678,7 +678,7 @@ namespace OutputProcessor { EndMinute, StartMinute, DSTIndicator, - ScheduleManager::dayTypeNames[CurDayType]); + Sched::dayTypeNames[CurDayType]); EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,1,12,21, 0, 1, 0.00,10.00,WinterDesignDay"}, "\n"))); // HRMeter @@ -694,7 +694,7 @@ namespace OutputProcessor { -1, // EndMinute -1, // StartMinute DSTIndicator, - ScheduleManager::dayTypeNames[CurDayType]); + Sched::dayTypeNames[CurDayType]); EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,1,12,21, 0, 1, 0.00,60.00,WinterDesignDay"}, "\n"))); // DYMeter @@ -710,7 +710,7 @@ namespace OutputProcessor { -1, // EndMinute -1, // StartMinute DSTIndicator, - ScheduleManager::dayTypeNames[CurDayType]); + Sched::dayTypeNames[CurDayType]); EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,1,12,21, 0,WinterDesignDay"}, "\n"))); // MNMeter @@ -778,7 +778,7 @@ namespace OutputProcessor { TEST_F(SQLiteFixture, OutputProcessor_writeReportMeterData) { auto &sql = state->dataSQLiteProcedures->sqlite; - state->dataGlobal->MinutesPerTimeStep = 10; + state->dataGlobal->MinutesInTimeStep = 10; sql->createSQLiteTimeIndexRecord(ReportFreq::Simulation, 1, 1, 0, 2017, false); sql->createSQLiteReportDictionaryRecord( @@ -1552,7 +1552,7 @@ namespace OutputProcessor { rVar.key = "keyedValue"; rVar.name = "variableName"; rVar.unitNameCustomEMS = ""; - rVar.SchedPtr = 0; + rVar.sched = nullptr; rVar.writeReportDictionaryItem(*state); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1,keyedValue,variableName [m3/s] !TimeStep"}, "\n"))); @@ -1564,19 +1564,16 @@ namespace OutputProcessor { rVar.writeReportDictionaryItem(*state); EXPECT_TRUE(compare_eso_stream(delimited_string({"2,1,keyedValue,variableName [m3/s] !TimeStep"}, "\n"))); - state->dataScheduleMgr->Schedule.allocate(1); - state->dataScheduleMgr->Schedule(1).Name = "scheduleName"; - rVar.ReportID = 3; rVar.storeType = StoreType::Average; - rVar.SchedPtr = 1; + rVar.sched = Sched::AddScheduleConstant(*state, "scheduleName"); rVar.writeReportDictionaryItem(*state); EXPECT_TRUE(compare_eso_stream(delimited_string({"3,1,keyedValue,variableName [m3/s] !TimeStep,scheduleName"}, "\n"))); rVar.ReportID = 4; rVar.timeStepType = TimeStepType::System; - rVar.SchedPtr = 0; + rVar.sched = nullptr; rVar.writeReportDictionaryItem(*state); EXPECT_TRUE(compare_eso_stream(delimited_string({"4,1,keyedValue,variableName [m3/s] !TimeStep"}, "\n"))); @@ -1597,13 +1594,13 @@ namespace OutputProcessor { rVar.ReportID = 8; rVar.storeType = StoreType::Average; - rVar.SchedPtr = 1; + rVar.sched = Sched::GetSchedule(*state, "SCHEDULENAME"); rVar.writeReportDictionaryItem(*state); EXPECT_TRUE(compare_eso_stream(delimited_string({"8,1,keyedValue,variableName [m3/s] !Each Call,scheduleName"}, "\n"))); rVar.ReportID = 9; - rVar.SchedPtr = 0; + rVar.sched = nullptr; rVar.timeStepType = TimeStepType::System; rVar.writeReportDictionaryItem(*state); @@ -1627,14 +1624,14 @@ namespace OutputProcessor { rVar.ReportID = 13; rVar.storeType = StoreType::Average; - rVar.SchedPtr = 1; + rVar.sched = Sched::GetSchedule(*state, "SCHEDULENAME"); rVar.writeReportDictionaryItem(*state); EXPECT_TRUE(op->freqTrackingVariables[(int)ReportFreq::Hour]); op->freqTrackingVariables[(int)ReportFreq::Hour] = false; EXPECT_TRUE(compare_eso_stream(delimited_string({"13,1,keyedValue,variableName [m3/s] !Hourly,scheduleName"}, "\n"))); rVar.ReportID = 14; - rVar.SchedPtr = 0; + rVar.sched = nullptr; rVar.timeStepType = TimeStepType::System; rVar.writeReportDictionaryItem(*state); EXPECT_TRUE(op->freqTrackingVariables[(int)ReportFreq::Hour]); @@ -1662,7 +1659,7 @@ namespace OutputProcessor { rVar.ReportID = 18; rVar.storeType = StoreType::Average; - rVar.SchedPtr = 1; + rVar.sched = Sched::GetSchedule(*state, "SCHEDULENAME"); rVar.writeReportDictionaryItem(*state); EXPECT_TRUE(op->freqTrackingVariables[(int)ReportFreq::Day]); op->freqTrackingVariables[(int)ReportFreq::Day] = false; @@ -1671,7 +1668,7 @@ namespace OutputProcessor { rVar.ReportID = 19; rVar.timeStepType = TimeStepType::System; - rVar.SchedPtr = 0; + rVar.sched = nullptr; rVar.writeReportDictionaryItem(*state); EXPECT_TRUE(op->freqTrackingVariables[(int)ReportFreq::Day]); op->freqTrackingVariables[(int)ReportFreq::Day] = false; @@ -1697,7 +1694,7 @@ namespace OutputProcessor { rVar.ReportID = 23; rVar.storeType = StoreType::Average; - rVar.SchedPtr = 1; + rVar.sched = Sched::GetSchedule(*state, "SCHEDULENAME"); rVar.writeReportDictionaryItem(*state); EXPECT_TRUE(op->freqTrackingVariables[(int)ReportFreq::Month]); op->freqTrackingVariables[(int)ReportFreq::Month] = false; @@ -1706,7 +1703,7 @@ namespace OutputProcessor { rVar.ReportID = 24; rVar.timeStepType = TimeStepType::System; - rVar.SchedPtr = 0; + rVar.sched = nullptr; rVar.writeReportDictionaryItem(*state); EXPECT_TRUE(op->freqTrackingVariables[(int)ReportFreq::Month]); op->freqTrackingVariables[(int)ReportFreq::Month] = false; @@ -1732,7 +1729,7 @@ namespace OutputProcessor { rVar.ReportID = 28; rVar.storeType = StoreType::Average; - rVar.SchedPtr = 1; + rVar.sched = Sched::GetSchedule(*state, "SCHEDULENAME"); rVar.writeReportDictionaryItem(*state); EXPECT_TRUE(op->freqTrackingVariables[(int)ReportFreq::Simulation]); op->freqTrackingVariables[(int)ReportFreq::Simulation] = false; @@ -1741,7 +1738,7 @@ namespace OutputProcessor { rVar.ReportID = 29; rVar.timeStepType = TimeStepType::System; - rVar.SchedPtr = 0; + rVar.sched = nullptr; rVar.writeReportDictionaryItem(*state); EXPECT_TRUE(op->freqTrackingVariables[(int)ReportFreq::Simulation]); op->freqTrackingVariables[(int)ReportFreq::Simulation] = false; @@ -2379,36 +2376,31 @@ namespace OutputProcessor { EXPECT_EQ("", op->reqVars[0]->key); EXPECT_EQ("SITE OUTDOOR AIR DRYBULB TEMPERATURE", op->reqVars[0]->name); EXPECT_EQ((int)ReportFreq::TimeStep, (int)op->reqVars[0]->freq); - EXPECT_EQ(0, op->reqVars[0]->SchedPtr); - EXPECT_EQ("", op->reqVars[0]->SchedName); + EXPECT_EQ(nullptr, op->reqVars[0]->sched); EXPECT_FALSE(op->reqVars[0]->Used); EXPECT_EQ("", op->reqVars[1]->key); EXPECT_EQ("SITE OUTDOOR AIR DRYBULB TEMPERATURE", op->reqVars[1]->name); EXPECT_EQ((int)ReportFreq::Hour, (int)op->reqVars[1]->freq); - EXPECT_EQ(0, op->reqVars[1]->SchedPtr); - EXPECT_EQ("", op->reqVars[1]->SchedName); + EXPECT_EQ(nullptr, op->reqVars[1]->sched); EXPECT_FALSE(op->reqVars[1]->Used); EXPECT_EQ("", op->reqVars[2]->key); EXPECT_EQ("SITE OUTDOOR AIR DRYBULB TEMPERATURE", op->reqVars[2]->name); EXPECT_EQ((int)ReportFreq::Day, (int)op->reqVars[2]->freq); - EXPECT_EQ(0, op->reqVars[2]->SchedPtr); - EXPECT_EQ("", op->reqVars[2]->SchedName); + EXPECT_EQ(nullptr, op->reqVars[2]->sched); EXPECT_FALSE(op->reqVars[2]->Used); EXPECT_EQ("", op->reqVars[3]->key); EXPECT_EQ("SITE OUTDOOR AIR DRYBULB TEMPERATURE", op->reqVars[3]->name); EXPECT_EQ((int)ReportFreq::Month, (int)op->reqVars[3]->freq); - EXPECT_EQ(0, op->reqVars[3]->SchedPtr); - EXPECT_EQ("", op->reqVars[3]->SchedName); + EXPECT_EQ(nullptr, op->reqVars[3]->sched); EXPECT_FALSE(op->reqVars[3]->Used); EXPECT_EQ("", op->reqVars[4]->key); EXPECT_EQ("SITE OUTDOOR AIR DRYBULB TEMPERATURE", op->reqVars[4]->name); EXPECT_EQ((int)ReportFreq::Simulation, (int)op->reqVars[4]->freq); - EXPECT_EQ(0, op->reqVars[4]->SchedPtr); - EXPECT_EQ("", op->reqVars[4]->SchedName); + EXPECT_EQ(nullptr, op->reqVars[4]->sched); EXPECT_FALSE(op->reqVars[4]->Used); } @@ -2439,43 +2431,37 @@ namespace OutputProcessor { EXPECT_EQ("", op->reqVars[0]->key); EXPECT_EQ("SITE OUTDOOR AIR DRYBULB TEMPERATURE", op->reqVars[0]->name); EXPECT_EQ((int)ReportFreq::TimeStep, (int)op->reqVars[0]->freq); - EXPECT_EQ(0, op->reqVars[0]->SchedPtr); - EXPECT_EQ("", op->reqVars[0]->SchedName); + EXPECT_EQ(nullptr, op->reqVars[0]->sched); EXPECT_TRUE(op->reqVars[0]->Used); EXPECT_EQ("", op->reqVars[1]->key); EXPECT_EQ("SITE OUTDOOR AIR DRYBULB TEMPERATURE", op->reqVars[1]->name); EXPECT_EQ((int)ReportFreq::Hour, (int)op->reqVars[1]->freq); - EXPECT_EQ(0, op->reqVars[1]->SchedPtr); - EXPECT_EQ("", op->reqVars[1]->SchedName); + EXPECT_EQ(nullptr, op->reqVars[1]->sched); EXPECT_TRUE(op->reqVars[1]->Used); EXPECT_EQ("", op->reqVars[2]->key); EXPECT_EQ("SITE OUTDOOR AIR DRYBULB TEMPERATURE", op->reqVars[2]->name); EXPECT_EQ((int)ReportFreq::Day, (int)op->reqVars[2]->freq); - EXPECT_EQ(0, op->reqVars[2]->SchedPtr); - EXPECT_EQ("", op->reqVars[2]->SchedName); + EXPECT_EQ(nullptr, op->reqVars[2]->sched); EXPECT_TRUE(op->reqVars[2]->Used); EXPECT_EQ("", op->reqVars[3]->key); EXPECT_EQ("SITE OUTDOOR AIR DRYBULB TEMPERATURE", op->reqVars[3]->name); EXPECT_EQ((int)ReportFreq::Month, (int)op->reqVars[3]->freq); - EXPECT_EQ(0, op->reqVars[3]->SchedPtr); - EXPECT_EQ("", op->reqVars[3]->SchedName); + EXPECT_EQ(nullptr, op->reqVars[3]->sched); EXPECT_TRUE(op->reqVars[3]->Used); EXPECT_EQ("", op->reqVars[4]->key); EXPECT_EQ("SITE OUTDOOR AIR DRYBULB TEMPERATURE", op->reqVars[4]->name); EXPECT_EQ((int)ReportFreq::Simulation, (int)op->reqVars[4]->freq); - EXPECT_EQ(0, op->reqVars[4]->SchedPtr); - EXPECT_EQ("", op->reqVars[4]->SchedName); + EXPECT_EQ(nullptr, op->reqVars[4]->sched); EXPECT_TRUE(op->reqVars[4]->Used); EXPECT_EQ("", op->reqVars[4]->key); EXPECT_EQ("SITE OUTDOOR AIR DRYBULB TEMPERATURE", op->reqVars[4]->name); EXPECT_EQ((int)ReportFreq::Simulation, (int)op->reqVars[4]->freq); - EXPECT_EQ(0, op->reqVars[4]->SchedPtr); - EXPECT_EQ("", op->reqVars[4]->SchedName); + EXPECT_EQ(nullptr, op->reqVars[4]->sched); EXPECT_TRUE(op->reqVars[4]->Used); } @@ -2714,36 +2700,31 @@ namespace OutputProcessor { EXPECT_EQ("", op->reqVars[0]->key); EXPECT_EQ("SITE OUTDOOR AIR DRYBULB TEMPERATURE", op->reqVars[0]->name); EXPECT_EQ((int)ReportFreq::TimeStep, (int)op->reqVars[0]->freq); - EXPECT_EQ(0, op->reqVars[0]->SchedPtr); - EXPECT_EQ("", op->reqVars[0]->SchedName); + EXPECT_EQ(nullptr, op->reqVars[0]->sched); EXPECT_TRUE(op->reqVars[0]->Used); EXPECT_EQ("", op->reqVars[1]->key); EXPECT_EQ("SITE OUTDOOR AIR DRYBULB TEMPERATURE", op->reqVars[1]->name); EXPECT_EQ((int)ReportFreq::Hour, (int)op->reqVars[1]->freq); - EXPECT_EQ(0, op->reqVars[1]->SchedPtr); - EXPECT_EQ("", op->reqVars[1]->SchedName); + EXPECT_EQ(nullptr, op->reqVars[1]->sched); EXPECT_TRUE(op->reqVars[1]->Used); EXPECT_EQ("", op->reqVars[2]->key); EXPECT_EQ("SITE OUTDOOR AIR DRYBULB TEMPERATURE", op->reqVars[2]->name); EXPECT_EQ((int)ReportFreq::Day, (int)op->reqVars[2]->freq); - EXPECT_EQ(0, op->reqVars[2]->SchedPtr); - EXPECT_EQ("", op->reqVars[2]->SchedName); + EXPECT_EQ(nullptr, op->reqVars[2]->sched); EXPECT_TRUE(op->reqVars[2]->Used); EXPECT_EQ("", op->reqVars[3]->key); EXPECT_EQ("SITE OUTDOOR AIR DRYBULB TEMPERATURE", op->reqVars[3]->name); EXPECT_EQ((int)ReportFreq::Month, (int)op->reqVars[3]->freq); - EXPECT_EQ(0, op->reqVars[3]->SchedPtr); - EXPECT_EQ("", op->reqVars[3]->SchedName); + EXPECT_EQ(nullptr, op->reqVars[3]->sched); EXPECT_TRUE(op->reqVars[3]->Used); EXPECT_EQ("", op->reqVars[4]->key); EXPECT_EQ("SITE OUTDOOR AIR DRYBULB TEMPERATURE", op->reqVars[4]->name); EXPECT_EQ((int)ReportFreq::Simulation, (int)op->reqVars[4]->freq); - EXPECT_EQ(0, op->reqVars[4]->SchedPtr); - EXPECT_EQ("", op->reqVars[4]->SchedName); + EXPECT_EQ(nullptr, op->reqVars[4]->sched); EXPECT_TRUE(op->reqVars[4]->Used); } @@ -2852,8 +2833,7 @@ namespace OutputProcessor { EXPECT_EQ("", op->reqVars[0]->key); EXPECT_EQ("SITE OUTDOOR AIR DRYBULB TEMPERATURE", op->reqVars[0]->name); EXPECT_EQ((int)ReportFreq::Simulation, (int)op->reqVars[0]->freq); - EXPECT_EQ(0, op->reqVars[0]->SchedPtr); - EXPECT_EQ("", op->reqVars[0]->SchedName); + EXPECT_EQ(nullptr, op->reqVars[0]->sched); EXPECT_EQ(true, op->reqVars[0]->Used); EXPECT_EQ((int)TimeStepType::Zone, (int)op->ddOutVars[0]->timeStepType); @@ -2969,6 +2949,7 @@ namespace OutputProcessor { std::string const idf_objects = delimited_string({"Output:Variable,*,Boiler NaturalGas Rate,runperiod;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetReportVariableInput(*state); Real64 fuel_used = 999; @@ -3002,6 +2983,7 @@ namespace OutputProcessor { std::string const idf_objects = delimited_string({"Output:Variable,Boiler[13],Boiler NaturalGas Rate,runperiod;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetReportVariableInput(*state); Real64 fuel_used = 999; @@ -3033,6 +3015,7 @@ namespace OutputProcessor { std::string const idf_objects = delimited_string({"Output:Variable,Boiler.*,Boiler NaturalGas Rate,runperiod;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetReportVariableInput(*state); Real64 fuel_used = 999; @@ -3066,6 +3049,7 @@ namespace OutputProcessor { std::string const idf_objects = delimited_string({"Output:Variable,Zn003:Wall.*,AFN Linkage Node 1 to Node 2 Volume Flow Rate,timestep;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetReportVariableInput(*state); Real64 vol_flow = 999; @@ -3139,6 +3123,7 @@ namespace OutputProcessor { delimited_string({"Output:Variable,(?i)Zn003:Wall.*,AFN Linkage Node 1 to Node 2 Volume Flow Rate,timestep;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetReportVariableInput(*state); Real64 vol_flow = 999; @@ -3217,6 +3202,7 @@ namespace OutputProcessor { }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); auto const keyed_value = "Environment"; auto const var_name = "Site Outdoor Air Drybulb Temperature"; @@ -3233,36 +3219,31 @@ namespace OutputProcessor { EXPECT_EQ("", op->reqVars[0]->key); EXPECT_EQ("SITE OUTDOOR AIR DRYBULB TEMPERATURE", op->reqVars[0]->name); EXPECT_EQ((int)ReportFreq::TimeStep, (int)op->reqVars[0]->freq); - EXPECT_EQ(0, op->reqVars[0]->SchedPtr); - EXPECT_EQ("", op->reqVars[0]->SchedName); + EXPECT_EQ(nullptr, op->reqVars[0]->sched); EXPECT_EQ(true, op->reqVars[0]->Used); EXPECT_EQ("", op->reqVars[1]->key); EXPECT_EQ("SITE OUTDOOR AIR DRYBULB TEMPERATURE", op->reqVars[1]->name); EXPECT_EQ((int)ReportFreq::Hour, (int)op->reqVars[1]->freq); - EXPECT_EQ(0, op->reqVars[1]->SchedPtr); - EXPECT_EQ("", op->reqVars[1]->SchedName); + EXPECT_EQ(nullptr, op->reqVars[1]->sched); EXPECT_EQ(true, op->reqVars[1]->Used); EXPECT_EQ("", op->reqVars[2]->key); EXPECT_EQ("SITE OUTDOOR AIR DRYBULB TEMPERATURE", op->reqVars[2]->name); EXPECT_EQ((int)ReportFreq::Day, (int)op->reqVars[2]->freq); - EXPECT_EQ(0, op->reqVars[2]->SchedPtr); - EXPECT_EQ("", op->reqVars[2]->SchedName); + EXPECT_EQ(nullptr, op->reqVars[2]->sched); EXPECT_EQ(true, op->reqVars[2]->Used); EXPECT_EQ("", op->reqVars[3]->key); EXPECT_EQ("SITE OUTDOOR AIR DRYBULB TEMPERATURE", op->reqVars[3]->name); EXPECT_EQ((int)ReportFreq::Month, (int)op->reqVars[3]->freq); - EXPECT_EQ(0, op->reqVars[3]->SchedPtr); - EXPECT_EQ("", op->reqVars[3]->SchedName); + EXPECT_EQ(nullptr, op->reqVars[3]->sched); EXPECT_EQ(true, op->reqVars[3]->Used); EXPECT_EQ("", op->reqVars[4]->key); EXPECT_EQ("SITE OUTDOOR AIR DRYBULB TEMPERATURE", op->reqVars[4]->name); EXPECT_EQ((int)ReportFreq::Simulation, (int)op->reqVars[4]->freq); - EXPECT_EQ(0, op->reqVars[4]->SchedPtr); - EXPECT_EQ("", op->reqVars[4]->SchedName); + EXPECT_EQ(nullptr, op->reqVars[4]->sched); EXPECT_EQ(true, op->reqVars[4]->Used); } @@ -3272,6 +3253,7 @@ namespace OutputProcessor { std::string const idf_objects = delimited_string({"Output:Meter:MeterFileOnly,InteriorLights:Electricity:Zone:*,Monthly;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Real64 light_consumption = 0; for (int i = 1; i <= 5; ++i) { @@ -3340,6 +3322,7 @@ namespace OutputProcessor { }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Real64 light_consumption = 0; SetupOutputVariable(*state, "Lights Electricity Energy", @@ -3631,6 +3614,7 @@ namespace OutputProcessor { }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); InitializeOutput(*state); @@ -3745,6 +3729,7 @@ namespace OutputProcessor { }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataGlobal->TimeStep = 4; state->dataGlobal->DayOfSim = 365; @@ -3756,9 +3741,9 @@ namespace OutputProcessor { state->dataEnvrn->HolidayIndex = 0; state->dataGlobal->HourOfDay = 24; state->dataGlobal->NumOfDayInEnvrn = 365; - state->dataGlobal->MinutesPerTimeStep = 10; + state->dataGlobal->MinutesInTimeStep = 10; - if (state->dataGlobal->TimeStep == state->dataGlobal->NumOfTimeStepInHour) { + if (state->dataGlobal->TimeStep == state->dataGlobal->TimeStepsInHour) { state->dataGlobal->EndHourFlag = true; if (state->dataGlobal->HourOfDay == 24) { state->dataGlobal->EndDayFlag = true; @@ -4037,6 +4022,7 @@ namespace OutputProcessor { }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataGlobal->TimeStep = 4; state->dataGlobal->DayOfSim = 365; @@ -4048,9 +4034,9 @@ namespace OutputProcessor { state->dataEnvrn->HolidayIndex = 0; state->dataGlobal->HourOfDay = 24; state->dataGlobal->NumOfDayInEnvrn = 365; - state->dataGlobal->MinutesPerTimeStep = 10; + state->dataGlobal->MinutesInTimeStep = 10; - if (state->dataGlobal->TimeStep == state->dataGlobal->NumOfTimeStepInHour) { + if (state->dataGlobal->TimeStep == state->dataGlobal->TimeStepsInHour) { state->dataGlobal->EndHourFlag = true; if (state->dataGlobal->HourOfDay == 24) { state->dataGlobal->EndDayFlag = true; @@ -4341,6 +4327,7 @@ namespace OutputProcessor { }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataGlobal->DayOfSim = 365; state->dataGlobal->DayOfSimChr = "365"; @@ -4351,9 +4338,9 @@ namespace OutputProcessor { state->dataEnvrn->HolidayIndex = 0; state->dataGlobal->HourOfDay = 24; state->dataGlobal->NumOfDayInEnvrn = 365; - state->dataGlobal->MinutesPerTimeStep = 10; + state->dataGlobal->MinutesInTimeStep = 10; - if (state->dataGlobal->TimeStep == state->dataGlobal->NumOfTimeStepInHour) { + if (state->dataGlobal->TimeStep == state->dataGlobal->TimeStepsInHour) { state->dataGlobal->EndHourFlag = true; if (state->dataGlobal->HourOfDay == 24) { state->dataGlobal->EndDayFlag = true; @@ -4584,6 +4571,7 @@ namespace OutputProcessor { }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataGlobal->TimeStep = 4; state->dataGlobal->DayOfSim = 365; @@ -4595,9 +4583,9 @@ namespace OutputProcessor { state->dataEnvrn->HolidayIndex = 0; state->dataGlobal->HourOfDay = 24; state->dataGlobal->NumOfDayInEnvrn = 365; - state->dataGlobal->MinutesPerTimeStep = 10; + state->dataGlobal->MinutesInTimeStep = 10; - if (state->dataGlobal->TimeStep == state->dataGlobal->NumOfTimeStepInHour) { + if (state->dataGlobal->TimeStep == state->dataGlobal->TimeStepsInHour) { state->dataGlobal->EndHourFlag = true; if (state->dataGlobal->HourOfDay == 24) { state->dataGlobal->EndDayFlag = true; @@ -4673,6 +4661,7 @@ namespace OutputProcessor { }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataGlobal->DayOfSim = 365; state->dataGlobal->DayOfSimChr = "365"; @@ -4683,9 +4672,9 @@ namespace OutputProcessor { state->dataEnvrn->HolidayIndex = 0; state->dataGlobal->HourOfDay = 24; state->dataGlobal->NumOfDayInEnvrn = 365; - state->dataGlobal->MinutesPerTimeStep = 10; + state->dataGlobal->MinutesInTimeStep = 10; - if (state->dataGlobal->TimeStep == state->dataGlobal->NumOfTimeStepInHour) { + if (state->dataGlobal->TimeStep == state->dataGlobal->TimeStepsInHour) { state->dataGlobal->EndHourFlag = true; if (state->dataGlobal->HourOfDay == 24) { state->dataGlobal->EndDayFlag = true; @@ -4757,6 +4746,7 @@ namespace OutputProcessor { }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataGlobal->DayOfSim = 365; state->dataGlobal->DayOfSimChr = "365"; @@ -4767,9 +4757,9 @@ namespace OutputProcessor { state->dataEnvrn->HolidayIndex = 0; state->dataGlobal->HourOfDay = 24; state->dataGlobal->NumOfDayInEnvrn = 365; - state->dataGlobal->MinutesPerTimeStep = 10; + state->dataGlobal->MinutesInTimeStep = 10; - if (state->dataGlobal->TimeStep == state->dataGlobal->NumOfTimeStepInHour) { + if (state->dataGlobal->TimeStep == state->dataGlobal->TimeStepsInHour) { state->dataGlobal->EndHourFlag = true; if (state->dataGlobal->HourOfDay == 24) { state->dataGlobal->EndDayFlag = true; @@ -4997,6 +4987,7 @@ namespace OutputProcessor { "Output:Meter, Meter Air System Hot Water Energy, Timestep;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool errors_found = false; Real64 transferredenergy = 0; state->dataGlobal->NumOfZones = 1; @@ -5056,6 +5047,7 @@ namespace OutputProcessor { "Output:Meter,CustomMeter2,Hourly;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool errors_found = false; @@ -5161,6 +5153,7 @@ namespace OutputProcessor { }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool errors_found = false; @@ -5244,6 +5237,7 @@ namespace OutputProcessor { }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetReportVariableInput(*state); @@ -5302,8 +5296,7 @@ namespace OutputProcessor { EXPECT_EQ("", op->reqVars[0]->key); EXPECT_EQ("SITE OUTDOOR AIR DRYBULB TEMPERATURE", op->reqVars[0]->name); EXPECT_EQ((int)ReportFreq::Simulation, (int)op->reqVars[0]->freq); - EXPECT_EQ(0, op->reqVars[0]->SchedPtr); - EXPECT_EQ("", op->reqVars[0]->SchedName); + EXPECT_EQ(nullptr, op->reqVars[0]->sched); EXPECT_EQ(true, op->reqVars[0]->Used); EXPECT_EQ((int)TimeStepType::Zone, (int)op->ddOutVars[0]->timeStepType); @@ -5378,6 +5371,7 @@ namespace OutputProcessor { }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // Demonstrate that it's not unreasonable to reach the INT_MAX limit at all constexpr int numOfTimeStepInHour = 60; @@ -5392,10 +5386,10 @@ namespace OutputProcessor { state->dataEnvrn->DSTIndicator = 0; state->dataEnvrn->HolidayIndex = 0; state->dataGlobal->NumOfDayInEnvrn = 365; - state->dataGlobal->MinutesPerTimeStep = 1; - state->dataGlobal->NumOfTimeStepInHour = 60; + state->dataGlobal->MinutesInTimeStep = 1; + state->dataGlobal->TimeStepsInHour = 60; - Real64 timeStep = 1.0 / state->dataGlobal->NumOfTimeStepInHour; + Real64 timeStep = 1.0 / state->dataGlobal->TimeStepsInHour; SetupTimePointers(*state, TimeStepType::Zone, timeStep); SetupTimePointers(*state, TimeStepType::System, timeStep); @@ -5444,9 +5438,9 @@ namespace OutputProcessor { state->dataGlobal->EndDayFlag = false; for (state->dataGlobal->HourOfDay = 1; state->dataGlobal->HourOfDay <= 24; ++state->dataGlobal->HourOfDay) { - for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->NumOfTimeStepInHour; + for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->TimeStepsInHour; ++state->dataGlobal->TimeStep) { - if (state->dataGlobal->TimeStep == state->dataGlobal->NumOfTimeStepInHour) { + if (state->dataGlobal->TimeStep == state->dataGlobal->TimeStepsInHour) { state->dataGlobal->EndHourFlag = true; if (state->dataGlobal->HourOfDay == 24) { state->dataGlobal->EndDayFlag = true; diff --git a/tst/EnergyPlus/unit/OutputReportData.unit.cc b/tst/EnergyPlus/unit/OutputReportData.unit.cc index 9fafc7880cc..ecd504c5f90 100644 --- a/tst/EnergyPlus/unit/OutputReportData.unit.cc +++ b/tst/EnergyPlus/unit/OutputReportData.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc index 68afb1ad5ec..379bbdfd484 100644 --- a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc +++ b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -508,7 +508,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_AllocateLoadComponentArraysTes state->dataGlobal->NumOfZones = 4; state->dataViewFactor->NumOfRadiantEnclosures = 4; state->dataSurface->TotSurfaces = 7; - state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->TimeStepsInHour = 4; AllocateLoadComponentArrays(*state); @@ -518,128 +518,23 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_AllocateLoadComponentArraysTes // radiantPulseReceived.allocate( { 0, TotDesDays + TotRunDesPersDays }, TotSurfaces ); EXPECT_EQ(state->dataOutRptTab->radiantPulseReceived.size(), 42u); - // loadConvectedNormal.allocate( TotDesDays + TotRunDesPersDays, { 0, NumOfTimeStepInHour * 24 }, TotSurfaces ); - EXPECT_EQ(state->dataOutRptTab->loadConvectedNormal.size(), 3395u); - - // loadConvectedWithPulse.allocate( TotDesDays + TotRunDesPersDays, { 0, NumOfTimeStepInHour * 24 }, TotSurfaces ); - EXPECT_EQ(state->dataOutRptTab->loadConvectedWithPulse.size(), 3395u); - - // netSurfRadSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, TotSurfaces ); - EXPECT_EQ(state->dataOutRptTab->netSurfRadSeq.size(), 3360u); - - // decayCurveCool.allocate( NumOfTimeStepInHour * 24, TotSurfaces ); + // decayCurveCool.allocate( TimeStepsInHour * 24, TotSurfaces ); EXPECT_EQ(state->dataOutRptTab->decayCurveCool.size(), 672u); - // decayCurveHeat.allocate( NumOfTimeStepInHour * 24, TotSurfaces ); + // decayCurveHeat.allocate( TimeStepsInHour * 24, TotSurfaces ); EXPECT_EQ(state->dataOutRptTab->decayCurveHeat.size(), 672u); - // ITABSFseq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, TotSurfaces ); - EXPECT_EQ(state->dataOutRptTab->ITABSFseq.size(), 3360u); - - // TMULTseq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->TMULTseq.size(), 1920u); - - // peopleInstantSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->peopleInstantSeq.size(), 1920u); - - // peopleLatentSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->peopleLatentSeq.size(), 1920u); - - // peopleRadSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->peopleRadSeq.size(), 1920u); - - // peopleDelaySeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - // EXPECT_EQ( peopleDelaySeq.size(), 1920u ); - - // lightInstantSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->lightInstantSeq.size(), 1920u); - - // lightRetAirSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->lightRetAirSeq.size(), 1920u); - - // lightLWRadSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->lightLWRadSeq.size(), 1920u); - - // lightSWRadSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, TotSurfaces ); - EXPECT_EQ(state->dataOutRptTab->lightSWRadSeq.size(), 3360u); - - // lightDelaySeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - // EXPECT_EQ( lightDelaySeq.size(), 1920u ); - - // equipInstantSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->equipInstantSeq.size(), 1920u); - - // equipLatentSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->equipLatentSeq.size(), 1920u); - - // equipRadSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->equipRadSeq.size(), 1920u); - - // equipDelaySeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - // EXPECT_EQ( equipDelaySeq.size(), 1920u ); - - // refrigInstantSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->refrigInstantSeq.size(), 1920u); - - // refrigRetAirSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->refrigRetAirSeq.size(), 1920u); - - // refrigLatentSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->refrigLatentSeq.size(), 1920u); - - // waterUseInstantSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->waterUseInstantSeq.size(), 1920u); - - // waterUseLatentSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->waterUseLatentSeq.size(), 1920u); - - // hvacLossInstantSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->hvacLossInstantSeq.size(), 1920u); - - // hvacLossRadSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->hvacLossRadSeq.size(), 1920u); - - // hvacLossDelaySeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - // EXPECT_EQ( hvacLossDelaySeq.size(), 1920u ); - - // powerGenInstantSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->powerGenInstantSeq.size(), 1920u); - - // powerGenRadSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->powerGenRadSeq.size(), 1920u); - - // powerGenDelaySeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - // EXPECT_EQ( powerGenDelaySeq.size(), 1920u ); - - // infilInstantSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->infilInstantSeq.size(), 1920u); - - // infilLatentSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->infilLatentSeq.size(), 1920u); - - // zoneVentInstantSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->zoneVentInstantSeq.size(), 1920u); - - // zoneVentLatentSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->zoneVentLatentSeq.size(), 1920u); - - // interZoneMixInstantSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->interZoneMixInstantSeq.size(), 1920u); - - // interZoneMixLatentSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->interZoneMixLatentSeq.size(), 1920u); - - // feneCondInstantSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->feneCondInstantSeq.size(), 1920u); - - // feneSolarRadSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, TotSurfaces ); - EXPECT_EQ(state->dataOutRptTab->feneSolarRadSeq.size(), 3360u); - - // feneSolarDelaySeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - // EXPECT_EQ( feneSolarDelaySeq.size(), 1920u ); - - // surfDelaySeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, TotSurfaces ); - // EXPECT_EQ( surfDelaySeq.size(), 3360u ); + EXPECT_EQ(state->dataOutRptTab->surfCompLoads.size(), 5u); + EXPECT_EQ(state->dataOutRptTab->surfCompLoads[0].ts.size(), 96u); + EXPECT_EQ(state->dataOutRptTab->surfCompLoads[0].ts[0].surf.size(), 7u); + EXPECT_EQ(state->dataOutRptTab->surfCompLoads[4].ts.size(), 96u); + EXPECT_EQ(state->dataOutRptTab->surfCompLoads[4].ts[95].surf.size(), 7u); + + EXPECT_EQ(state->dataOutRptTab->znCompLoads.size(), 5u); + EXPECT_EQ(state->dataOutRptTab->znCompLoads[0].ts.size(), 96u); + EXPECT_EQ(state->dataOutRptTab->znCompLoads[0].ts[0].spacezone.size(), 4u); + EXPECT_EQ(state->dataOutRptTab->znCompLoads[4].ts.size(), 96u); + EXPECT_EQ(state->dataOutRptTab->znCompLoads[4].ts[95].spacezone.size(), 4u); } TEST_F(EnergyPlusFixture, OutputReportTabularTest_ConfirmConvertToEscaped) @@ -3641,7 +3536,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabular_ConfirmResetBEPSGathering) state->dataGlobal->DoWeathSim = true; state->dataGlobal->TimeStepZone = 1.0; state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * 3600.0; - state->dataGlobal->MinutesPerTimeStep = state->dataGlobal->TimeStepZone * 60.0; + state->dataGlobal->MinutesInTimeStep = state->dataGlobal->TimeStepZone * 60.0; state->dataOutRptTab->displayTabularBEPS = true; // OutputProcessor::TimeValue.allocate(2); @@ -3811,7 +3706,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabular_GatherHeatEmissionReport) state->dataOutRptTab->displayHeatEmissionsSummary = true; state->dataGlobal->DoWeathSim = true; state->dataHVACGlobal->TimeStepSys = 10.0; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->dataEnvrn->OutHumRat = 0.005; state->dataEnvrn->OutDryBulbTemp = 25.0; @@ -3893,8 +3788,9 @@ TEST_F(EnergyPlusFixture, OutputTableTimeBins_GetInput) "0.00, !- Interval Start", "0.20, !- Interval Size", "5, !- Interval Count", - "Always1; !- Schedule Name"}); + "Constant-1.0; !- Schedule Name"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataGlobal->DoWeathSim = true; @@ -3906,7 +3802,7 @@ TEST_F(EnergyPlusFixture, OutputTableTimeBins_GetInput) EXPECT_EQ(state->dataOutRptTab->OutputTableBinned(1).intervalStart, 0.0); EXPECT_EQ(state->dataOutRptTab->OutputTableBinned(1).intervalSize, 0.20); EXPECT_EQ(state->dataOutRptTab->OutputTableBinned(1).intervalCount, 5); - EXPECT_EQ(state->dataOutRptTab->OutputTableBinned(1).ScheduleName, "ALWAYS1"); + EXPECT_EQ(state->dataOutRptTab->OutputTableBinned(1).sched->Name, "Constant-1.0"); } // TEST_F( EnergyPlusFixture, FinAndOverhangCount ) @@ -6581,6 +6477,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_invalidAggregationOrder) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Real64 extLitUse; @@ -6631,7 +6528,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_invalidAggregationOrder) TEST_F(EnergyPlusFixture, OutputReportTabularTest_CollectPeakZoneConditions_test) { - Psychrometrics::InitializePsychRoutines(*state); + state->init_state(*state); createCoilSelectionReportObj(*state); CompLoadTablesType compLoad; @@ -6648,8 +6545,8 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_CollectPeakZoneConditions_test state->dataWeather->DesDayInput(1).Month = 5; state->dataWeather->DesDayInput(1).DayOfMonth = 21; - state->dataGlobal->NumOfTimeStepInHour = 4; - state->dataGlobal->MinutesPerTimeStep = 15; + state->dataGlobal->TimeStepsInHour = 4; + state->dataGlobal->MinutesInTimeStep = 15; state->dataSize->CalcFinalZoneSizing.allocate(1); state->dataSize->CalcFinalZoneSizing(1).CoolOutTempSeq.allocate(96); @@ -6716,6 +6613,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_ComputeEngineeringChecks_test) TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetZoneComponentAreas_test) { Array1D areas; + Array1D spaceAreas; areas.allocate(1); state->dataHeatBal->Zone.allocate(1); @@ -6802,7 +6700,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetZoneComponentAreas_test) state->dataSurface->Surface(13).Zone = 1; state->dataSurface->Surface(13).HeatTransSurf = true; - GetZoneComponentAreas(*state, areas); + GetZoneComponentAreas(*state, areas, spaceAreas); EXPECT_EQ(12., areas(1).floor); EXPECT_EQ(8., areas(1).roof); @@ -6982,7 +6880,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesTwice_test) int iZone = 1; state->dataEnvrn->TotDesDays = 2; state->dataEnvrn->TotRunDesPersDays = 3; - state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->TimeStepsInHour = 4; state->dataGlobal->NumOfZones = 4; state->dataHeatBal->Zone.allocate(state->dataGlobal->NumOfZones); @@ -7002,48 +6900,43 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesTwice_test) state->dataSurface->Surface(1).RadEnclIndex = 1; Array1D peopleDelaySeq; - peopleDelaySeq.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); + peopleDelaySeq.allocate(state->dataGlobal->TimeStepsInHour * 24); peopleDelaySeq = 0.; Array1D peopleDelaySeqCool; - peopleDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); + peopleDelaySeqCool.allocate(state->dataGlobal->TimeStepsInHour * 24); peopleDelaySeqCool = 0.; Array1D equipDelaySeqCool; - equipDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); + equipDelaySeqCool.allocate(state->dataGlobal->TimeStepsInHour * 24); equipDelaySeqCool = 0.; Array1D hvacLossDelaySeqCool; - hvacLossDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); + hvacLossDelaySeqCool.allocate(state->dataGlobal->TimeStepsInHour * 24); hvacLossDelaySeqCool = 0.; Array1D powerGenDelaySeqCool; - powerGenDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); + powerGenDelaySeqCool.allocate(state->dataGlobal->TimeStepsInHour * 24); powerGenDelaySeqCool = 0.; Array1D lightDelaySeqCool; - lightDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); + lightDelaySeqCool.allocate(state->dataGlobal->TimeStepsInHour * 24); lightDelaySeqCool = 0.; Array1D feneSolarDelaySeqCool; - feneSolarDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); + feneSolarDelaySeqCool.allocate(state->dataGlobal->TimeStepsInHour * 24); feneSolarDelaySeqCool = 0.; - Array3D feneCondInstantSeq; - feneCondInstantSeq.allocate(state->dataEnvrn->TotDesDays + state->dataEnvrn->TotRunDesPersDays, - state->dataGlobal->NumOfTimeStepInHour * 24, - state->dataViewFactor->NumOfRadiantEnclosures); - feneCondInstantSeq = 0.0; - Array2D surfDelaySeqCool; - surfDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24, state->dataSurface->TotSurfaces); + surfDelaySeqCool.allocate(state->dataGlobal->TimeStepsInHour * 24, state->dataSurface->TotSurfaces); surfDelaySeqCool = 0.0; AllocateLoadComponentArrays(*state); - feneCondInstantSeq(coolDesSelected, 1, 1) = 0.88; + auto &znCL = state->dataOutRptTab->znCompLoads; + znCL[coolDesSelected - 1].ts[0].spacezone[iZone - 1].feneCondInstantSeq = 0.88; - state->dataOutRptTab->netSurfRadSeq(coolDesSelected, 1, 1) = 0.05; + state->dataOutRptTab->surfCompLoads[coolDesSelected - 1].ts[0].surf[0].netSurfRadSeq = 0.05; GetDelaySequences(*state, coolDesSelected, @@ -7055,10 +6948,12 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesTwice_test) powerGenDelaySeqCool, lightDelaySeqCool, feneSolarDelaySeqCool, - feneCondInstantSeq, + znCL, surfDelaySeqCool); - EXPECT_EQ(0.83, feneCondInstantSeq(coolDesSelected, 1, 1)); // the first time the subtraction operation should have occurred + EXPECT_EQ( + 0.83, + znCL[coolDesSelected - 1].ts[0].spacezone[iZone - 1].feneCondInstantSeq); // the first time the subtraction operation should have occurred GetDelaySequences(*state, coolDesSelected, @@ -7070,14 +6965,13 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesTwice_test) powerGenDelaySeqCool, lightDelaySeqCool, feneSolarDelaySeqCool, - feneCondInstantSeq, + znCL, surfDelaySeqCool); EXPECT_EQ(0.83, - feneCondInstantSeq( - coolDesSelected, - 1, - 1)); // the second time the subtraction should not have happened since it is only adjusted once so the value should be the same. + znCL[coolDesSelected - 1].ts[0].spacezone[iZone - 1].feneCondInstantSeq); // the second time the subtraction should not have happened + // since it is + // only adjusted once so the value should be the same. } TEST_F(SQLiteFixture, OutputReportTabular_WriteLoadComponentSummaryTables_AirLoop_ZeroDesignDay) @@ -7113,6 +7007,8 @@ TEST_F(SQLiteFixture, OutputReportTabular_WriteLoadComponentSummaryTables_AirLoo // We ensure that if the Airloop peak matches the zone peak, we don't do the IP conversion twice TEST_F(SQLiteFixture, OutputReportTabular_WriteLoadComponentSummaryTables_AirLoop_IPConversion) { + state->init_state(*state); + state->dataSQLiteProcedures->sqlite->createSQLiteSimulationsRecord(1, "EnergyPlus Version", "Current Time"); OutputReportTabular::SetupUnitConversions(*state); @@ -7126,7 +7022,6 @@ TEST_F(SQLiteFixture, OutputReportTabular_WriteLoadComponentSummaryTables_AirLoo state->dataOutRptTab->displayFacilityComponentLoadSummary = true; state->dataGlobal->CompLoadReportIsReq = true; - Psychrometrics::InitializePsychRoutines(*state); createCoilSelectionReportObj(*state); // Two design days @@ -7139,8 +7034,8 @@ TEST_F(SQLiteFixture, OutputReportTabular_WriteLoadComponentSummaryTables_AirLoo state->dataWeather->DesDayInput(2).Month = 1; state->dataWeather->DesDayInput(2).DayOfMonth = 21; - state->dataGlobal->NumOfTimeStepInHour = 4; - state->dataGlobal->MinutesPerTimeStep = 15; + state->dataGlobal->TimeStepsInHour = 4; + state->dataGlobal->MinutesInTimeStep = 15; int numTimeStepInDay = 96; // One Zone @@ -7415,6 +7310,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularMonthlyPredefined_FindNeededOutputV }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); EXPECT_EQ(1, state->dataInputProcessing->inputProcessor->getNumObjectsFound(*state, "Output:Table:SummaryReports")); EXPECT_EQ(0, state->dataInputProcessing->inputProcessor->getNumObjectsFound(*state, "Output:Variable")); @@ -7631,6 +7527,7 @@ TEST_F(EnergyPlusFixture, AzimuthToCardinal) int nTests = expectedAzimuthToCards.size(); // Allocate some needed arrays + state->dataHeatBal->space.allocate(1); state->dataHeatBal->Zone.allocate(1); state->dataHeatBal->Zone(1).ListMultiplier = 1; state->dataConstruction->Construct.allocate(1); @@ -7657,6 +7554,7 @@ TEST_F(EnergyPlusFixture, AzimuthToCardinal) state->dataSurface->Surface(i).GrossArea = 200.; state->dataSurface->Surface(i).Tilt = 90.; state->dataSurface->Surface(i).Zone = 1; + state->dataSurface->Surface(i).spaceNum = 1; state->dataSurface->Surface(i).Construction = 1; state->dataSurface->AllSurfaceListReportOrder.push_back(i); @@ -7745,6 +7643,7 @@ TEST_F(EnergyPlusFixture, AzimuthToCardinal) TEST_F(EnergyPlusFixture, InteriorSurfaceEnvelopeSummaryReport) { // Allocate some needed arrays + state->dataHeatBal->space.allocate(2); state->dataHeatBal->Zone.allocate(2); state->dataHeatBal->Zone(1).ListMultiplier = 1; state->dataHeatBal->Zone(2).ListMultiplier = 1; @@ -7782,10 +7681,12 @@ TEST_F(EnergyPlusFixture, InteriorSurfaceEnvelopeSummaryReport) } if ((i + 1) / 2 == 1) { // first pair of wall and door + state->dataSurface->Surface(i).spaceNum = 1; state->dataSurface->Surface(i).Zone = 1; state->dataSurface->Surface(i).ExtBoundCond = i + 2; } else { // second pair of wall and door + state->dataSurface->Surface(i).spaceNum = 2; state->dataSurface->Surface(i).Zone = 2; state->dataSurface->Surface(i).ExtBoundCond = i - 2; } @@ -8138,7 +8039,7 @@ TEST_F(SQLiteFixture, OutputReportTabular_EndUseBySubcategorySQL) "General"); state->dataGlobal->DoWeathSim = true; state->dataGlobal->TimeStepZone = 1.0; - state->dataGlobal->MinutesPerTimeStep = state->dataGlobal->TimeStepZone * 60; + state->dataGlobal->MinutesInTimeStep = state->dataGlobal->TimeStepZone * 60; state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * 3600.0; state->dataOutRptTab->displayTabularBEPS = true; // OutputProcessor::TimeValue.allocate(2); @@ -8364,7 +8265,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ int iZone = 1; state->dataEnvrn->TotDesDays = 2; state->dataEnvrn->TotRunDesPersDays = 3; - state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->TimeStepsInHour = 4; state->dataGlobal->NumOfZones = 1; state->dataHeatBal->Zone.allocate(state->dataGlobal->NumOfZones); @@ -8382,41 +8283,35 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ state->dataSurface->Surface.allocate(state->dataSurface->TotSurfaces); Array1D peopleDelaySeq; - peopleDelaySeq.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); + peopleDelaySeq.allocate(state->dataGlobal->TimeStepsInHour * 24); peopleDelaySeq = 0.; Array1D peopleDelaySeqCool; - peopleDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); + peopleDelaySeqCool.allocate(state->dataGlobal->TimeStepsInHour * 24); peopleDelaySeqCool = 0.; Array1D equipDelaySeqCool; - equipDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); + equipDelaySeqCool.allocate(state->dataGlobal->TimeStepsInHour * 24); equipDelaySeqCool = 0.; Array1D hvacLossDelaySeqCool; - hvacLossDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); + hvacLossDelaySeqCool.allocate(state->dataGlobal->TimeStepsInHour * 24); hvacLossDelaySeqCool = 0.; Array1D powerGenDelaySeqCool; - powerGenDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); + powerGenDelaySeqCool.allocate(state->dataGlobal->TimeStepsInHour * 24); powerGenDelaySeqCool = 0.; Array1D lightDelaySeqCool; - lightDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); + lightDelaySeqCool.allocate(state->dataGlobal->TimeStepsInHour * 24); lightDelaySeqCool = 0.; Array1D feneSolarDelaySeqCool; - feneSolarDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); + feneSolarDelaySeqCool.allocate(state->dataGlobal->TimeStepsInHour * 24); feneSolarDelaySeqCool = 0.; - Array3D feneCondInstantSeq; - feneCondInstantSeq.allocate(state->dataEnvrn->TotDesDays + state->dataEnvrn->TotRunDesPersDays, - state->dataGlobal->NumOfTimeStepInHour * 24, - state->dataViewFactor->NumOfRadiantEnclosures); - feneCondInstantSeq = 0.0; - Array2D surfDelaySeqCool; - surfDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24, state->dataSurface->TotSurfaces); + surfDelaySeqCool.allocate(state->dataGlobal->TimeStepsInHour * 24, state->dataSurface->TotSurfaces); surfDelaySeqCool = 0.0; AllocateLoadComponentArrays(*state); @@ -8435,24 +8330,32 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ state->dataSurface->Surface(2).Class = SurfaceClass::Wall; state->dataSurface->Surface(3).Class = SurfaceClass::Floor; state->dataSurface->Surface(4).Class = SurfaceClass::Shading; - state->dataSurface->Surface(1).RadEnclIndex = 1; - state->dataSurface->Surface(2).RadEnclIndex = 1; - state->dataSurface->Surface(3).RadEnclIndex = 1; - state->dataSurface->Surface(4).RadEnclIndex = 1; + state->dataSurface->Surface(1).RadEnclIndex = radEnclosureNum; + state->dataSurface->Surface(2).RadEnclIndex = radEnclosureNum; + state->dataSurface->Surface(3).RadEnclIndex = radEnclosureNum; + state->dataSurface->Surface(4).RadEnclIndex = radEnclosureNum; + auto &znCL = state->dataOutRptTab->znCompLoads; + auto &znCLDay = znCL[coolDesSelected - 1]; for (int jSurf = 1; jSurf <= 4; ++jSurf) { for (int step = 1; step <= 10; ++step) { - state->dataOutRptTab->TMULTseq(coolDesSelected, step, radEnclosureNum) = 0.1 * step; - state->dataOutRptTab->ITABSFseq(coolDesSelected, step, jSurf) = 0.2 * step * surfBaseValue[jSurf - 1]; + auto &znCLDayTS = znCLDay.ts[step - 1].spacezone[iZone - 1]; + auto &surfCLDayTS = state->dataOutRptTab->surfCompLoads[coolDesSelected - 1].ts[step - 1].surf[jSurf - 1]; + surfCLDayTS.TMULTseq = 0.1 * step; + surfCLDayTS.ITABSFseq = 0.2 * step * surfBaseValue[jSurf - 1]; state->dataOutRptTab->decayCurveCool(step, jSurf) = 0.3 * step * surfBaseValue[jSurf - 1]; - state->dataOutRptTab->peopleRadSeq(coolDesSelected, step, iZone) = 0.4 * step; - state->dataOutRptTab->equipRadSeq(coolDesSelected, step, iZone) = 0.5 * step; - state->dataOutRptTab->hvacLossRadSeq(coolDesSelected, step, iZone) = 0.6 * step; - state->dataOutRptTab->powerGenRadSeq(coolDesSelected, step, iZone) = 0.7 * step; - state->dataOutRptTab->lightLWRadSeq(coolDesSelected, step, iZone) = 0.8 * step; } } + for (int step = 1; step <= 10; ++step) { + auto &enclCLDayTS = state->dataOutRptTab->enclCompLoads[coolDesSelected - 1].ts[step - 1].encl[radEnclosureNum - 1]; + enclCLDayTS.peopleRadSeq = 0.4 * step; + enclCLDayTS.equipRadSeq = 0.5 * step; + enclCLDayTS.hvacLossRadSeq = 0.6 * step; + enclCLDayTS.powerGenRadSeq = 0.7 * step; + enclCLDayTS.lightLWRadSeq = 0.8 * step; + } + GetDelaySequences(*state, coolDesSelected, true, @@ -8463,7 +8366,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ powerGenDelaySeqCool, lightDelaySeqCool, feneSolarDelaySeqCool, - feneCondInstantSeq, + znCL, surfDelaySeqCool); // Save some results from first pass @@ -8495,17 +8398,23 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ for (int jSurf = 1; jSurf <= 4; ++jSurf) { for (int step = 1; step <= 10; ++step) { - state->dataOutRptTab->TMULTseq(coolDesSelected, step, radEnclosureNum) = 0.1 * step; - state->dataOutRptTab->ITABSFseq(coolDesSelected, step, jSurf) = 0.2 * step * surfBaseValue[jSurf - 1]; + auto &znCLDayTS = znCLDay.ts[step - 1].spacezone[iZone - 1]; + auto &surfCLDayTS = state->dataOutRptTab->surfCompLoads[coolDesSelected - 1].ts[step - 1].surf[jSurf - 1]; + surfCLDayTS.TMULTseq = 0.1 * step; + surfCLDayTS.ITABSFseq = 0.2 * step * surfBaseValue[jSurf - 1]; state->dataOutRptTab->decayCurveCool(step, jSurf) = 0.3 * step * surfBaseValue[jSurf - 1]; - state->dataOutRptTab->peopleRadSeq(coolDesSelected, step, iZone) = 0.4 * step; - state->dataOutRptTab->equipRadSeq(coolDesSelected, step, iZone) = 0.5 * step; - state->dataOutRptTab->hvacLossRadSeq(coolDesSelected, step, iZone) = 0.6 * step; - state->dataOutRptTab->powerGenRadSeq(coolDesSelected, step, iZone) = 0.7 * step; - state->dataOutRptTab->lightLWRadSeq(coolDesSelected, step, iZone) = 0.8 * step; } } + for (int step = 1; step <= 10; ++step) { + auto &enclCLDayTS = state->dataOutRptTab->enclCompLoads[coolDesSelected - 1].ts[step - 1].encl[radEnclosureNum - 1]; + enclCLDayTS.peopleRadSeq = 0.4 * step; + enclCLDayTS.equipRadSeq = 0.5 * step; + enclCLDayTS.hvacLossRadSeq = 0.6 * step; + enclCLDayTS.powerGenRadSeq = 0.7 * step; + enclCLDayTS.lightLWRadSeq = 0.8 * step; + } + GetDelaySequences(*state, coolDesSelected, true, @@ -8516,7 +8425,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ powerGenDelaySeqCool, lightDelaySeqCool, feneSolarDelaySeqCool, - feneCondInstantSeq, + znCL, surfDelaySeqCool); // Save some results from second pass @@ -8541,9 +8450,9 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_ConfirmConversionFactors) Real64 curSourceFactor; bool fuelFactorUsed; bool fFScheduleUsed; - int ffScheduleIndex; + Sched::Schedule *ffSched; - Pollution::GetFuelFactorInfo(*state, Constant::eFuel::DistrictHeatingSteam, fuelFactorUsed, curSourceFactor, fFScheduleUsed, ffScheduleIndex); + Pollution::GetFuelFactorInfo(*state, Constant::eFuel::DistrictHeatingSteam, fuelFactorUsed, curSourceFactor, fFScheduleUsed, &ffSched); EXPECT_EQ(curSourceFactor, 1.2); } @@ -8556,7 +8465,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabular_GatherHeatGainReport) state->dataOutRptPredefined->reportName(state->dataOutRptPredefined->pdrSensibleGain).show = true; state->dataHVACGlobal->TimeStepSys = 10.0; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->dataGlobal->TimeStepZone = 20.0; @@ -8625,6 +8534,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_8317_ValidateOutputTableMon }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Real64 extLitUse; @@ -9672,7 +9582,7 @@ TEST_F(SQLiteFixture, ORT_EndUseBySubcategorySQL_DualUnits) state->dataGlobal->DoWeathSim = true; state->dataGlobal->TimeStepZone = 1.0; state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * 3600.0; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->MinutesInTimeStep = 60; state->dataOutRptTab->displayTabularBEPS = true; // OutputProcessor::TimeValue.allocate(2); @@ -10257,14 +10167,14 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_WarningMultiplePeopleObj) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); state->dataGlobal->NumOfZones = 1; state->dataHeatBal->Resilience.allocate(state->dataGlobal->NumOfZones); InternalHeatGains::GetInternalHeatGainsInput(*state); @@ -11675,6 +11585,7 @@ TEST_F(SQLiteFixture, DOASDirectToZone_ZoneMultiplierRemoved) std::string const idf_objects = idf_objects_1 + idf_objects_2 + idf_objects_3; ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); ManageSimulation(*state); // run the design days auto &finalSysSizing = state->dataSize->FinalSysSizing(1); @@ -12621,6 +12532,7 @@ TEST_F(SQLiteFixture, UpdateSizing_EndSysSizingCalc) std::string const idf_objects = idf_objects_1 + idf_objects_2 + idf_objects_3; ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); ManageSimulation(*state); // run the design days auto &finalSysSizing = state->dataSize->FinalSysSizing(1); @@ -13032,7 +12944,7 @@ TEST_F(SQLiteFixture, OutputReportTabular_DistrictHeating) state->dataGlobal->DoWeathSim = true; state->dataGlobal->TimeStepZone = 1.0; - state->dataGlobal->MinutesPerTimeStep = state->dataGlobal->TimeStepZone * 60; + state->dataGlobal->MinutesInTimeStep = state->dataGlobal->TimeStepZone * 60; state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * 3600.0; state->dataOutRptTab->displayTabularBEPS = true; // OutputProcessor::TimeValue.allocate(2); @@ -13480,7 +13392,7 @@ TEST_F(SQLiteFixture, ORT_EndUseBySubcategorySQL_IPUnitExceptElec) state->dataGlobal->DoWeathSim = true; state->dataGlobal->TimeStepZone = 1.0; state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * 3600.0; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->MinutesInTimeStep = 60; state->dataOutRptTab->displayTabularBEPS = true; // OutputProcessor::TimeValue.allocate(2); diff --git a/tst/EnergyPlus/unit/OutputReportTabularAnnual.unit.cc b/tst/EnergyPlus/unit/OutputReportTabularAnnual.unit.cc index d76f2ddbcf0..febdbede406 100644 --- a/tst/EnergyPlus/unit/OutputReportTabularAnnual.unit.cc +++ b/tst/EnergyPlus/unit/OutputReportTabularAnnual.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -71,7 +71,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_GetInput) "Output:Table:Annual,", "Space Gains Annual Report, !- Name", "Filter1, !- Filter", - "Schedule2, !- Schedule Name", + "Constant-1.0, !- Schedule Name", "Zone People Total Heating Energy, !- Variable or Meter 1 Name", "SumOrAverage, !- Aggregation Type for Variable or Meter 1", "4, !- field Digits After Decimal 1", @@ -82,6 +82,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_GetInput) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataGlobal->DoWeathSim = true; @@ -97,7 +98,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_GetInput) EXPECT_EQ(tableParams[0], "SPACE GAINS ANNUAL REPORT"); // m_name EXPECT_EQ(tableParams[1], "FILTER1"); // m_filter - EXPECT_EQ(tableParams[2], "SCHEDULE2"); // m_scheduleName + EXPECT_EQ(tableParams[2], "Constant-1.0"); // m_scheduleName std::vector fieldSetParams = firstTable->inspectTableFieldSets(0); EXPECT_EQ(fieldSetParams[0], "ZONE PEOPLE TOTAL HEATING ENERGY"); @@ -129,6 +130,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_SetupGathering) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Real64 extLitPow; Real64 extLitUse; @@ -221,6 +223,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_GatherResults) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Real64 extLitPow; Real64 extLitUse; @@ -303,7 +306,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_GatherResults_MinMaxHrsShown using namespace OutputProcessor; state->dataGlobal->TimeStepZone = 1.0; state->dataHVACGlobal->TimeStepSys = 1.0; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; Meter *meter1 = new Meter("HEATING:MYTH:VARIABLE"); meter1->units = Constant::Units::None; @@ -377,6 +380,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_columnHeadersToTitleCase) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Real64 facilUse; SetupOutputVariable(*state, @@ -441,6 +445,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_invalidAggregationOrder) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Real64 facilUse; SetupOutputVariable(*state, @@ -538,6 +543,7 @@ TEST_F(SQLiteFixture, OutputReportTabularAnnual_CurlyBraces) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Meter *meter1 = new Meter("ELECTRICITY:FACILITY"); meter1->units = Constant::Units::None; @@ -581,7 +587,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_WarnBlankVariable) "Output:Table:Annual,", "Space Gains Annual Report, !- Name", "Filter1, !- Filter", - "Schedule2, !- Schedule Name", + "Constant-1.0, !- Schedule Name", "Zone People Total Heating Energy, !- Variable or Meter 1 Name", "SumOrAverage, !- Aggregation Type for Variable or Meter 1", "4, !- field Digits After Decimal 1", @@ -592,6 +598,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_WarnBlankVariable) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataGlobal->DoWeathSim = true; diff --git a/tst/EnergyPlus/unit/OutputReports.unit.cc b/tst/EnergyPlus/unit/OutputReports.unit.cc index 519d8c86360..d7a360d6ad1 100644 --- a/tst/EnergyPlus/unit/OutputReports.unit.cc +++ b/tst/EnergyPlus/unit/OutputReports.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -140,8 +140,8 @@ TEST_F(EnergyPlusFixture, OutputReports_SurfaceDetailsReport) state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; diff --git a/tst/EnergyPlus/unit/OutsideEnergySources.unit.cc b/tst/EnergyPlus/unit/OutsideEnergySources.unit.cc index 8eda2e0503b..1fd8fdb9808 100644 --- a/tst/EnergyPlus/unit/OutsideEnergySources.unit.cc +++ b/tst/EnergyPlus/unit/OutsideEnergySources.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -87,6 +87,8 @@ TEST_F(EnergyPlusFixture, DistrictCoolingandHeating) }); ASSERT_TRUE(process_idf(idf_objects, false)); + state->init_state(*state); + GetOutsideEnergySourcesInput(*state); // GetOutsideEnergySourcesInput() finds DistrictHeating:Water, DistrictCooling, and DistrictHeating:Steam, respectively @@ -120,7 +122,7 @@ TEST_F(EnergyPlusFixture, DistrictCoolingandHeating) PlantLocation locHotWater(1, DataPlant::LoopSideLocation::Supply, 1, 1); thisHotWaterLoop.Name = "HotWaterLoop"; thisHotWaterLoop.FluidName = "WATER"; - thisHotWaterLoop.FluidIndex = 1; + thisHotWaterLoop.glycol = Fluid::GetWater(*state); thisHotWaterLoop.MinTemp = 1.0; thisHotWaterLoop.MaxTemp = 99.0; thisHotWaterLoop.MinMassFlowRate = 0.001; @@ -139,8 +141,7 @@ TEST_F(EnergyPlusFixture, DistrictCoolingandHeating) thisDistrictHeatingWater.BeginEnvrnInitFlag = true; thisDistrictHeatingWater.simulate(*state, locHotWater, firstHVAC, MyLoad, RunFlag); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol( - *state, thisHotWaterLoop.FluidName, thisDistrictHeatingWater.InletTemp, thisHotWaterLoop.FluidIndex, RoutineName); + Real64 Cp = thisHotWaterLoop.glycol->getSpecificHeat(*state, thisDistrictHeatingWater.InletTemp, RoutineName); Real64 calOutletTemp = (MyLoad + thisHotWaterLoop.MaxMassFlowRate * Cp * thisDistrictHeatingWater.InletTemp) / (thisHotWaterLoop.MaxMassFlowRate * Cp); @@ -152,7 +153,8 @@ TEST_F(EnergyPlusFixture, DistrictCoolingandHeating) PlantLocation locChilledWater(2, DataPlant::LoopSideLocation::Supply, 1, 1); thisChilledWaterLoop.Name = "ChilledWaterLoop"; thisChilledWaterLoop.FluidName = "WATER"; - thisChilledWaterLoop.FluidIndex = 1; + thisChilledWaterLoop.glycol = Fluid::GetWater(*state); + thisChilledWaterLoop.MinTemp = 1.0; thisChilledWaterLoop.MaxTemp = 99.0; thisChilledWaterLoop.MinMassFlowRate = 0.001; @@ -173,8 +175,7 @@ TEST_F(EnergyPlusFixture, DistrictCoolingandHeating) thisDistrictCooling.BeginEnvrnInitFlag = true; thisDistrictCooling.simulate(*state, locChilledWater, firstHVAC, MyLoad, RunFlag); - Cp = FluidProperties::GetSpecificHeatGlycol( - *state, thisChilledWaterLoop.FluidName, thisDistrictCooling.InletTemp, thisChilledWaterLoop.FluidIndex, RoutineName); + Cp = thisChilledWaterLoop.glycol->getSpecificHeat(*state, thisDistrictCooling.InletTemp, RoutineName); calOutletTemp = (MyLoad + thisChilledWaterLoop.MaxMassFlowRate * Cp * thisDistrictCooling.InletTemp) / (thisChilledWaterLoop.MaxMassFlowRate * Cp); @@ -185,7 +186,8 @@ TEST_F(EnergyPlusFixture, DistrictCoolingandHeating) PlantLocation locSteam(3, DataPlant::LoopSideLocation::Supply, 1, 1); thisSteamLoop.Name = "SteamLoop"; thisSteamLoop.FluidName = "STEAM"; - thisSteamLoop.FluidIndex = 1; + thisSteamLoop.steam = Fluid::GetSteam(*state); + thisSteamLoop.glycol = Fluid::GetWater(*state); thisSteamLoop.MinMassFlowRate = 0.00001; thisSteamLoop.MaxMassFlowRate = 20; thisSteamLoop.TempSetPointNodeNum = thisDistrictHeatingSteam.OutletNodeNum; @@ -204,15 +206,11 @@ TEST_F(EnergyPlusFixture, DistrictCoolingandHeating) thisDistrictHeatingSteam.BeginEnvrnInitFlag = true; thisDistrictHeatingSteam.simulate(*state, locSteam, firstHVAC, MyLoad, RunFlag); - Real64 SatTempAtmPress = FluidProperties::GetSatTemperatureRefrig( - *state, thisSteamLoop.FluidName, DataEnvironment::StdPressureSeaLevel, thisSteamLoop.FluidIndex, RoutineName); - Real64 CpCondensate = FluidProperties::GetSpecificHeatGlycol( - *state, thisSteamLoop.FluidName, thisDistrictHeatingSteam.InletTemp, thisSteamLoop.FluidIndex, RoutineName); + Real64 SatTempAtmPress = thisSteamLoop.steam->getSatTemperature(*state, DataEnvironment::StdPressureSeaLevel, RoutineName); + Real64 CpCondensate = thisSteamLoop.glycol->getSpecificHeat(*state, thisDistrictHeatingSteam.InletTemp, RoutineName); Real64 deltaTsensible = SatTempAtmPress - thisDistrictHeatingSteam.InletTemp; - Real64 EnthSteamInDry = FluidProperties::GetSatEnthalpyRefrig( - *state, thisSteamLoop.FluidName, thisDistrictHeatingSteam.InletTemp, 1.0, thisSteamLoop.FluidIndex, RoutineName); - Real64 EnthSteamOutWet = FluidProperties::GetSatEnthalpyRefrig( - *state, thisSteamLoop.FluidName, thisDistrictHeatingSteam.InletTemp, 0.0, thisSteamLoop.FluidIndex, RoutineName); + Real64 EnthSteamInDry = thisSteamLoop.steam->getSatEnthalpy(*state, thisDistrictHeatingSteam.InletTemp, 1.0, RoutineName); + Real64 EnthSteamOutWet = thisSteamLoop.steam->getSatEnthalpy(*state, thisDistrictHeatingSteam.InletTemp, 0.0, RoutineName); Real64 LatentHeatSteam = EnthSteamInDry - EnthSteamOutWet; Real64 calOutletMdot = MyLoad / (LatentHeatSteam + (CpCondensate * deltaTsensible)); diff --git a/tst/EnergyPlus/unit/PVWatts.unit.cc b/tst/EnergyPlus/unit/PVWatts.unit.cc index 7094d4c4f98..abc6d5e749d 100644 --- a/tst/EnergyPlus/unit/PVWatts.unit.cc +++ b/tst/EnergyPlus/unit/PVWatts.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -183,10 +183,10 @@ TEST_F(EnergyPlusFixture, PVWattsGenerator_Calc) state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStepZone = 1.0; state->dataHVACGlobal->TimeStepSys = 1.0; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->dataGlobal->BeginTimeStepFlag = true; - state->dataGlobal->MinutesPerTimeStep = 60; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->dataGlobal->TimeStepsInHour = 1; Weather::AllocateWeatherData(*state); // gets us the albedo array initialized state->dataEnvrn->Year = 1986; state->dataEnvrn->Month = 6; @@ -304,11 +304,13 @@ TEST_F(EnergyPlusFixture, PVWattsInverter_Constructor) ",", ";"}); ASSERT_TRUE(process_idf(idfTxt)); + state->init_state(*state); + auto eplc(ElectPowerLoadCenter(*state, 1)); ASSERT_TRUE(eplc.inverterPresent); EXPECT_DOUBLE_EQ(eplc.inverterObj->pvWattsDCCapacity(), 4000.0); state->dataHVACGlobal->TimeStepSys = 1.0; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; eplc.inverterObj->simulate(*state, 884.018); EXPECT_NEAR(eplc.inverterObj->aCPowerOut(), 842.527, 0.001); } diff --git a/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc b/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc index 7487dcafe92..bd573e48b4e 100644 --- a/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc +++ b/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -108,7 +108,6 @@ using namespace EnergyPlus::Fans; using namespace EnergyPlus::HeatBalanceManager; using namespace EnergyPlus::HeatingCoils; using namespace EnergyPlus::Psychrometrics; -using namespace EnergyPlus::ScheduleManager; using namespace EnergyPlus::SimulationManager; using namespace EnergyPlus::SingleDuct; using namespace EnergyPlus::SizingManager; @@ -497,8 +496,6 @@ TEST_F(EnergyPlusFixture, DISABLED_PackagedTerminalHP_VSCoils_Sizing) loopsidebranch.Comp.allocate(1); } state->dataPlnt->PlantLoop(2).Name = "ChilledWaterLoop"; - state->dataPlnt->PlantLoop(2).FluidName = "ChilledWater"; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataVariableSpeedCoils->VarSpeedCoil(1).Name; @@ -510,8 +507,6 @@ TEST_F(EnergyPlusFixture, DISABLED_PackagedTerminalHP_VSCoils_Sizing) state->dataVariableSpeedCoils->VarSpeedCoil(1).WaterOutletNodeNum; state->dataPlnt->PlantLoop(1).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "HotWater"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataVariableSpeedCoils->VarSpeedCoil(2).Name; @@ -544,7 +539,7 @@ TEST_F(EnergyPlusFixture, DISABLED_PackagedTerminalHP_VSCoils_Sizing) EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).Name, "LOBBY_ZN_1_FLR_2 WSHP COOLING MODE"); // PTHP sized the VS coil differently. The PTHP uses the design air flow to size VS coil capacity - // then back calulates air flow rate. The PTHP would read the coil air flow and capacity and report + // then back calculates air flow rate. The PTHP would read the coil air flow and capacity and report // those values to the eio. The UnitarySystem sizes the air flow rate and then calls the VS coil, // which sizes, and uses the VS coil capacity to report UnitarySystem capacity to the eio. // This requires and issue to correct. @@ -835,12 +830,11 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_HeatingCoilTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); - state->dataGlobal->NumOfTimeStepInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(*state); // read schedules - InitializePsychRoutines(*state); OutputReportPredefined::SetPredefinedTables(*state); GetZoneData(*state, ErrorsFound); @@ -879,9 +873,9 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_HeatingCoilTest) Psychrometrics::PsyHFnTdbW(state->dataLoopNodes->Node(state->dataZoneEquip->ZoneEquipConfig(1).ZoneNode).Temp, state->dataLoopNodes->Node(state->dataZoneEquip->ZoneEquipConfig(1).ZoneNode).HumRat); - state->dataScheduleMgr->Schedule(thisSys.m_FanOpModeSchedPtr).CurrentValue = 1.0; // unit is always on - state->dataScheduleMgr->Schedule(thisSys.m_SysAvailSchedPtr).CurrentValue = 1.0; // unit is always available - state->dataScheduleMgr->Schedule(thisSys.m_FanAvailSchedPtr).CurrentValue = 1.0; // fan is always available + thisSys.m_fanOpModeSched->currentVal = 1.0; // unit is always on + thisSys.m_sysAvailSched->currentVal = 1.0; // unit is always available + thisSys.m_fanAvailSched->currentVal = 1.0; // fan is always available // initialize mass flow rates state->dataLoopNodes->Node(thisSys.AirInNode).MassFlowRate = HVACInletMassFlowRate; @@ -915,7 +909,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_HeatingCoilTest) state->dataGlobal->SysSizingCalc = true; state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::SingleHeating; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::SingleHeat; state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataZoneEnergyDemand->ZoneSysMoistureDemand.allocate(1); @@ -1188,12 +1182,11 @@ TEST_F(EnergyPlusFixture, SimPTAC_SZVAVTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); - state->dataGlobal->NumOfTimeStepInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(*state); // read schedules - InitializePsychRoutines(*state); OutputReportPredefined::SetPredefinedTables(*state); GetZoneData(*state, ErrorsFound); @@ -1232,9 +1225,9 @@ TEST_F(EnergyPlusFixture, SimPTAC_SZVAVTest) state->dataHVACGlobal->TurnFansOff = false; state->dataHVACGlobal->TurnFansOn = true; - state->dataScheduleMgr->Schedule(thisSys.m_FanOpModeSchedPtr).CurrentValue = 1.0; // unit is always on - state->dataScheduleMgr->Schedule(thisSys.m_SysAvailSchedPtr).CurrentValue = 1.0; // unit is always available - state->dataScheduleMgr->Schedule(thisSys.m_FanAvailSchedPtr).CurrentValue = 1.0; // fan is always available + thisSys.m_fanOpModeSched->currentVal = 1.0; // unit is always on + thisSys.m_sysAvailSched->currentVal = 1.0; // unit is always available + thisSys.m_fanAvailSched->currentVal = 1.0; // fan is always available // set fan parameters state->dataFans->fans(1)->maxAirMassFlowRate = HVACInletMassFlowRate; @@ -1262,7 +1255,7 @@ TEST_F(EnergyPlusFixture, SimPTAC_SZVAVTest) state->dataGlobal->SysSizingCalc = false; state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::SingleHeating; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::SingleHeat; state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataZoneEnergyDemand->ZoneSysMoistureDemand.allocate(1); @@ -1297,7 +1290,7 @@ TEST_F(EnergyPlusFixture, SimPTAC_SZVAVTest) ASSERT_NEAR(state->dataHeatingCoils->HeatingCoil(1).HeatingCoilRate, 2668.1427, 0.0001); // Boundary load for this system in Region 1 at minimum air flow rate is 2006.8 W (lower boundary load in Region 1) - // loads below the bounday load should operate at the minimum air flow rate + // loads below the boundary load should operate at the minimum air flow rate // set heating load to non-zero value below lower boundary load state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputRequired = 1000.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 1000.0; @@ -1336,7 +1329,7 @@ TEST_F(EnergyPlusFixture, SimPTAC_SZVAVTest) // Boundary load for this system in Region 1 at maximum air flow rate is 2995.2 W // system should operate at maximum air flow rate for loads greater than 2995.2 W - // outlet air temperture is allowed to be above the design maximum supply air temperature in heating mode + // outlet air temperature is allowed to be above the design maximum supply air temperature in heating mode state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputRequired = 3000.0; // set heating load to just above upper boundary load state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 3000.0; thisSys.simulate(*state, thisSys.Name, FirstHVACIteration, 0, PTUnitNum, HeatActive, CoolActive, 0, 0, true, QUnitOut, latOut); @@ -3838,18 +3831,18 @@ TEST_F(EnergyPlusFixture, PTACDrawAirfromReturnNodeAndPlenum_Test) state->dataIPShortCut->cAlphaArgs = " "; state->dataIPShortCut->rNumericArgs = 0.0; + state->dataGlobal->TimeStepsInHour = 4; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 15; // must initialize this to get schedules initialized + state->init_state(*state); + bool ErrorsFound = false; // Read objects - SimulationManager::GetProjectData(*state); HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - state->dataGlobal->NumOfTimeStepInHour = 4; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized state->dataGlobal->TimeStepZone = 0.25; - state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * Constant::SecInHour; + state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * Constant::rSecsInHour; state->dataGlobal->CurrentTime = 12.0; - ProcessScheduleInput(*state); // read schedules HeatBalanceManager::GetHeatBalanceInput(*state); HeatBalanceManager::AllocateHeatBalArrays(*state); @@ -3912,21 +3905,24 @@ TEST_F(EnergyPlusFixture, PTACDrawAirfromReturnNodeAndPlenum_Test) } GetZoneAirSetPoints(*state); state->dataHeatBalFanSys->TempControlType.allocate(6); - state->dataHeatBalFanSys->TempControlType = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType = HVAC::SetptType::DualHeatCool; EnergyPlus::OutputReportPredefined::SetPredefinedTables(*state); - for (int i = 1; i <= 14; ++i) { - state->dataScheduleMgr->Schedule(i).CurrentValue = 1.0; // WindowVentSched - } - state->dataScheduleMgr->Schedule(5).CurrentValue = 117; // activity level - state->dataScheduleMgr->Schedule(6).CurrentValue = 0.0; // shade transmittance - state->dataScheduleMgr->Schedule(7).CurrentValue = 18.0; // heating set point - state->dataScheduleMgr->Schedule(8).CurrentValue = 24.0; // cooling set point - state->dataScheduleMgr->Schedule(11).CurrentValue = 4.0; // dual Tstat sch - state->dataScheduleMgr->Schedule(12).CurrentValue = 21.1; // DOAS SAT - state->dataScheduleMgr->Schedule(13).CurrentValue = 0.0; // cyc fan sch, CyclingFanSch - state->dataScheduleMgr->Schedule(14).CurrentValue = 1.0; // constant fan sch, ContsFanSch - int oaNode = 36; // this node index may change based on component calling order + Sched::GetSchedule(*state, "OCCUPY-1")->currentVal = 1.0; + Sched::GetSchedule(*state, "LIGHTS-1")->currentVal = 1.0; + Sched::GetSchedule(*state, "EQUIP-1")->currentVal = 1.0; + Sched::GetSchedule(*state, "INFIL-SCH")->currentVal = 1.0; + Sched::GetSchedule(*state, "ACTSCHD")->currentVal = 117; + Sched::GetSchedule(*state, "SHADETRANSSCH")->currentVal = 0.0; // shade transmittance + Sched::GetSchedule(*state, "HTG-SETP-SCH")->currentVal = 18.0; // heating set point + Sched::GetSchedule(*state, "CLG-SETP-SCH")->currentVal = 24.0; // cooling set point + Sched::GetSchedule(*state, "HVACTEMPLATE-ALWAYS 4")->currentVal = 4.0; // dual Tstat sch + Sched::GetSchedule(*state, "ALWAYS 21.1")->currentVal = 21.1; // DOAS SAT + Sched::GetSchedule(*state, "CYCLINGFANSCH")->currentVal = 0.0; // cyc fan sch, CyclingFanSch + Sched::GetSchedule(*state, "CONTSFANSCH")->currentVal = 1.0; // constant fan sch, ContsFanSch + Sched::GetSchedule(*state, "FANAVAILSCHED")->currentVal = 1.0; // Fan availability + + int oaNode = 36; // this node index may change based on component calling order state->dataLoopNodes->Node(oaNode).MassFlowRate = 0.26908 * 1.2; state->dataLoopNodes->Node(oaNode).Temp = state->dataEnvrn->OutDryBulbTemp; state->dataLoopNodes->Node(oaNode).HumRat = state->dataEnvrn->OutHumRat; @@ -4289,8 +4285,8 @@ TEST_F(EnergyPlusFixture, PTAC_ZoneEquipment_NodeInputTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); - ProcessScheduleInput(*state); // read schedules GetZoneData(*state, errorsFound); ASSERT_FALSE(errorsFound); @@ -4557,9 +4553,9 @@ TEST_F(EnergyPlusFixture, ZonePTHP_ElectricityRateTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool errorsFound = false; - ProcessScheduleInput(*state); // read schedules GetZoneData(*state, errorsFound); ASSERT_FALSE(errorsFound); @@ -4634,10 +4630,10 @@ TEST_F(EnergyPlusFixture, ZonePTHP_ElectricityRateTest) // set thermostat type state->dataHeatBalFanSys->TempControlType.allocate(1); state->dataHeatBalFanSys->TempControlTypeRpt.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; // set the uni sys is always available - state->dataScheduleMgr->Schedule(state->dataUnitarySystems->unitarySys[0].m_SysAvailSchedPtr).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(state->dataUnitarySystems->unitarySys[0].m_FanAvailSchedPtr).CurrentValue = 1.0; + state->dataUnitarySystems->unitarySys[0].m_sysAvailSched->currentVal = 1.0; + state->dataUnitarySystems->unitarySys[0].m_fanAvailSched->currentVal = 1.0; bool HeatActive = true; bool CoolActive = false; @@ -4890,12 +4886,11 @@ TEST_F(EnergyPlusFixture, PTAC_AvailabilityManagerTest) )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); - state->dataGlobal->NumOfTimeStepInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(*state); // read schedules - InitializePsychRoutines(*state); OutputReportPredefined::SetPredefinedTables(*state); GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -4927,9 +4922,9 @@ TEST_F(EnergyPlusFixture, PTAC_AvailabilityManagerTest) state->dataLoopNodes->Node(state->dataZoneEquip->ZoneEquipConfig(1).ZoneNode).Enthalpy = Psychrometrics::PsyHFnTdbW(state->dataLoopNodes->Node(state->dataZoneEquip->ZoneEquipConfig(1).ZoneNode).Temp, state->dataLoopNodes->Node(state->dataZoneEquip->ZoneEquipConfig(1).ZoneNode).HumRat); - state->dataScheduleMgr->Schedule(thisSys.m_FanOpModeSchedPtr).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(thisSys.m_SysAvailSchedPtr).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(thisSys.m_FanAvailSchedPtr).CurrentValue = 1.0; + thisSys.m_fanOpModeSched->currentVal = 1.0; + thisSys.m_sysAvailSched->currentVal = 1.0; + thisSys.m_fanAvailSched->currentVal = 1.0; // initialize mass flow rates state->dataLoopNodes->Node(thisSys.AirInNode).MassFlowRate = HVACInletMassFlowRate; state->dataLoopNodes->Node(thisSys.m_OAMixerNodes[0]).MassFlowRate = PrimaryAirMassFlowRate; @@ -4953,7 +4948,7 @@ TEST_F(EnergyPlusFixture, PTAC_AvailabilityManagerTest) state->dataUnitarySystems->unitarySys[0].ControlZoneNum = 1; state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::SingleHeating; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::SingleHeat; state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataZoneEnergyDemand->ZoneSysMoistureDemand.allocate(1); state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 0.0; // set heating load to zero @@ -5015,9 +5010,9 @@ TEST_F(EnergyPlusFixture, PTAC_AvailabilityManagerTest) state->dataHeatBalFanSys->TempControlType.allocate(NumZones); state->dataHeatBalFanSys->TempControlTypeRpt.allocate(NumZones); state->dataHeatBalFanSys->TempTstatAir.allocate(NumZones); - state->dataHeatBalFanSys->TempZoneThermostatSetPoint.allocate(NumZones); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::SingleCooling; - state->dataHeatBalFanSys->TempZoneThermostatSetPoint(1) = 21.1; + state->dataHeatBalFanSys->zoneTstatSetpts.allocate(NumZones); + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::SingleCool; + state->dataHeatBalFanSys->zoneTstatSetpts(1).setpt = 21.1; state->dataHeatBalFanSys->TempTstatAir(1) = 21.1; // get system availability schedule Avail::GetSysAvailManagerListInputs(*state); @@ -5033,7 +5028,7 @@ TEST_F(EnergyPlusFixture, PTAC_AvailabilityManagerTest) // test 1: availability manager status to off state->dataHVACGlobal->TurnFansOn = false; state->dataHVACGlobal->TurnFansOff = true; - state->dataHeatBalFanSys->TempZoneThermostatSetPoint(1) = 21.10; + state->dataHeatBalFanSys->zoneTstatSetpts(1).setpt = 21.10; state->dataHeatBalFanSys->TempTstatAir(1) = 21.1; sysAvailMgr.availStatus = Avail::Status::NoAction; // run calc system availability requirement @@ -5054,11 +5049,11 @@ TEST_F(EnergyPlusFixture, PTAC_AvailabilityManagerTest) // test 2: availability manager status to on state->dataAvail->ZoneComp(zoneEquipType).ZoneCompAvailMgrs(1).StartTime = 0.0; state->dataAvail->ZoneComp(zoneEquipType).ZoneCompAvailMgrs(1).StopTime = 4.0; - state->dataHeatBalFanSys->TempZoneThermostatSetPoint(1) = 21.10; + state->dataHeatBalFanSys->zoneTstatSetpts(1).setpt = 21.10; state->dataHeatBalFanSys->TempTstatAir(1) = 21.5; sysAvailMgr.availStatus = Avail::Status::NoAction; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1; - state->dataScheduleMgr->Schedule(2).CurrentValue = 0; + Sched::GetSchedule(*state, "FANAVAILSCHED")->currentVal = 1; + Sched::GetSchedule(*state, "FANCYCLING")->currentVal = 0; // run calc system availability requirement availStatus = Avail::CalcNCycSysAvailMgr(*state, SysAvailNum, PriAirSysNum, zoneEquipType, CompNum); // check that the availability manager is cycling On diff --git a/tst/EnergyPlus/unit/PhaseChangeModeling/HysteresisModel.unit.cc b/tst/EnergyPlus/unit/PhaseChangeModeling/HysteresisModel.unit.cc index 2b9418ffbac..a46302979fb 100644 --- a/tst/EnergyPlus/unit/PhaseChangeModeling/HysteresisModel.unit.cc +++ b/tst/EnergyPlus/unit/PhaseChangeModeling/HysteresisModel.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/PhotovoltaicThermalCollectors.unit.cc b/tst/EnergyPlus/unit/PhotovoltaicThermalCollectors.unit.cc index 58f832bb704..73bcee407ce 100644 --- a/tst/EnergyPlus/unit/PhotovoltaicThermalCollectors.unit.cc +++ b/tst/EnergyPlus/unit/PhotovoltaicThermalCollectors.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -69,6 +69,7 @@ using namespace EnergyPlus; TEST_F(EnergyPlusFixture, BIPVT_calc_k_taoalpha) { + state->init_state(*state); PhotovoltaicThermalCollectors::PVTCollectorStruct thisBIPVT; Real64 theta = 0.0; // lower value Real64 glass_thickness = 0.001; @@ -233,6 +234,8 @@ TEST_F(EnergyPlusFixture, BIPVT_calculateBIPVTMaxHeatGain) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + // bool foundErrors = false; // HeatBalanceManager::GetMaterialData(*state, foundErrors); // read material data // EXPECT_FALSE(foundErrors); // expect no errors diff --git a/tst/EnergyPlus/unit/Photovoltaics.unit.cc b/tst/EnergyPlus/unit/Photovoltaics.unit.cc index 380228789a6..02e1f892346 100644 --- a/tst/EnergyPlus/unit/Photovoltaics.unit.cc +++ b/tst/EnergyPlus/unit/Photovoltaics.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/PierceSurface.unit.cc b/tst/EnergyPlus/unit/PierceSurface.unit.cc index 1c6c8549d94..afee7813630 100644 --- a/tst/EnergyPlus/unit/PierceSurface.unit.cc +++ b/tst/EnergyPlus/unit/PierceSurface.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/Pipes.unit.cc b/tst/EnergyPlus/unit/Pipes.unit.cc index 27057b9fef4..1d72e47a012 100644 --- a/tst/EnergyPlus/unit/Pipes.unit.cc +++ b/tst/EnergyPlus/unit/Pipes.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -96,7 +96,7 @@ TEST_F(EnergyPlusFixture, CalcPipeHeatTransCoef) state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::PipeInterior; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).TotalBranches = 0; // just skip the supply side search state->dataPlnt->PlantLoop(1).FluidName = "WATER"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPipeHT->nsvNumOfPipeHT = 1; state->dataPipeHT->PipeHT.allocate(state->dataPipeHT->nsvNumOfPipeHT); diff --git a/tst/EnergyPlus/unit/Plant/Branch.unit.cc b/tst/EnergyPlus/unit/Plant/Branch.unit.cc index b7185e44b87..1b7e27da104 100644 --- a/tst/EnergyPlus/unit/Plant/Branch.unit.cc +++ b/tst/EnergyPlus/unit/Plant/Branch.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/Plant/Subcomponent.unit.cc b/tst/EnergyPlus/unit/Plant/Subcomponent.unit.cc index 931a22e6601..7d0e9076523 100644 --- a/tst/EnergyPlus/unit/Plant/Subcomponent.unit.cc +++ b/tst/EnergyPlus/unit/Plant/Subcomponent.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/PlantCentralGSHP.unit.cc b/tst/EnergyPlus/unit/PlantCentralGSHP.unit.cc index b121de3d3a3..3d1aa3cc39d 100644 --- a/tst/EnergyPlus/unit/PlantCentralGSHP.unit.cc +++ b/tst/EnergyPlus/unit/PlantCentralGSHP.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -75,7 +75,7 @@ TEST_F(EnergyPlusFixture, ChillerHeater_Autosize) state->dataPlantCentralGSHP->Wrapper(1).WrapperComp(1).WrapperPerformanceObjectType = "CHILLERHEATERPERFORMANCE:ELECTRIC:EIR"; state->dataPlantCentralGSHP->Wrapper(1).WrapperComp(1).WrapperIdenticalObjectNum = 2; - state->dataPlantCentralGSHP->Wrapper(1).WrapperComp(1).CHSchedPtr = ScheduleManager::ScheduleAlwaysOn; + state->dataPlantCentralGSHP->Wrapper(1).WrapperComp(1).chSched = Sched::GetScheduleAlwaysOn(*state); state->dataPlantCentralGSHP->Wrapper(1).ChillerHeaterNums = 2; state->dataPlantCentralGSHP->Wrapper(1).ChillerHeater.allocate(2); // First test in SizeWrapper, so need to set that @@ -119,8 +119,8 @@ TEST_F(EnergyPlusFixture, ChillerHeater_Autosize) // Chilled Water Loop int PltSizNum = 1; state->dataPlnt->PlantLoop(PltSizNum).PlantSizNum = 1; - state->dataPlnt->PlantLoop(PltSizNum).FluidIndex = 1; state->dataPlnt->PlantLoop(PltSizNum).FluidName = "WATER"; + state->dataPlnt->PlantLoop(PltSizNum).glycol = Fluid::GetWater(*state); state->dataSize->PlantSizData(PltSizNum).DesVolFlowRate = 1.0; state->dataSize->PlantSizData(PltSizNum).DeltaT = 10.0; state->dataSize->PlantSizData(PltSizNum).LoopType = DataSizing::TypeOfPlantLoop::Cooling; @@ -130,37 +130,23 @@ TEST_F(EnergyPlusFixture, ChillerHeater_Autosize) // Condenser Loop int PltSizCondNum = 2; state->dataPlnt->PlantLoop(PltSizCondNum).PlantSizNum = PltSizCondNum; - state->dataPlnt->PlantLoop(PltSizCondNum).FluidIndex = 1; state->dataPlnt->PlantLoop(PltSizCondNum).FluidName = "WATER"; + state->dataPlnt->PlantLoop(PltSizCondNum).glycol = Fluid::GetWater(*state); state->dataSize->PlantSizData(PltSizCondNum).DeltaT = 5.6; state->dataSize->PlantSizData(PltSizCondNum).LoopType = DataSizing::TypeOfPlantLoop::Condenser; // Assign to the wrapper state->dataPlantCentralGSHP->Wrapper(1).GLHEPlantLoc.loopNum = PltSizCondNum; // Calculate expected values - Real64 rho_evap = FluidProperties::GetDensityGlycol(*state, - state->dataPlnt->PlantLoop(PltSizNum).FluidName, - Constant::CWInitConvTemp, - state->dataPlnt->PlantLoop(PltSizNum).FluidIndex, - "ChillerHeater_Autosize_TEST"); - - Real64 Cp_evap = FluidProperties::GetSpecificHeatGlycol(*state, - state->dataPlnt->PlantLoop(PltSizNum).FluidName, - Constant::CWInitConvTemp, - state->dataPlnt->PlantLoop(PltSizNum).FluidIndex, - "ChillerHeater_Autosize_TEST"); - - Real64 rho_cond = FluidProperties::GetDensityGlycol(*state, - state->dataPlnt->PlantLoop(PltSizCondNum).FluidName, - Constant::CWInitConvTemp, - state->dataPlnt->PlantLoop(PltSizCondNum).FluidIndex, - "ChillerHeater_Autosize_TEST"); - - Real64 Cp_cond = FluidProperties::GetSpecificHeatGlycol(*state, - state->dataPlnt->PlantLoop(PltSizCondNum).FluidName, - state->dataPlantCentralGSHP->Wrapper(1).ChillerHeater(1).TempRefCondInCooling, - state->dataPlnt->PlantLoop(PltSizCondNum).FluidIndex, - "ChillerHeater_Autosize_TEST"); + Real64 rho_evap = state->dataPlnt->PlantLoop(PltSizNum).glycol->getDensity(*state, Constant::CWInitConvTemp, "ChillerHeater_Autosize_TEST"); + + Real64 Cp_evap = state->dataPlnt->PlantLoop(PltSizNum).glycol->getSpecificHeat(*state, Constant::CWInitConvTemp, "ChillerHeater_Autosize_TEST"); + + Real64 rho_cond = state->dataPlnt->PlantLoop(PltSizCondNum).glycol->getDensity(*state, Constant::CWInitConvTemp, "ChillerHeater_Autosize_TEST"); + + Real64 Cp_cond = state->dataPlnt->PlantLoop(PltSizCondNum) + .glycol->getSpecificHeat( + *state, state->dataPlantCentralGSHP->Wrapper(1).ChillerHeater(1).TempRefCondInCooling, "ChillerHeater_Autosize_TEST"); // Note: Each individual chiller heater module is sized to be capable of supporting the total load on the wrapper @@ -354,6 +340,8 @@ TEST_F(EnergyPlusFixture, Test_CentralHeatPumpSystem_Control_Schedule_fix) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + // May not need for direct wrapper input processing call (need when caling factory) state->dataPlantCentralGSHP->getWrapperInputFlag = true; @@ -361,11 +349,12 @@ TEST_F(EnergyPlusFixture, Test_CentralHeatPumpSystem_Control_Schedule_fix) PlantCentralGSHP::GetWrapperInput(*state); // verify that under this scenario of not finding a schedule match, ScheduleAlwaysOn is the treated default - EXPECT_EQ(state->dataPlantCentralGSHP->Wrapper(1).WrapperComp(1).CHSchedPtr, ScheduleManager::ScheduleAlwaysOn); + EXPECT_EQ(state->dataPlantCentralGSHP->Wrapper(1).WrapperComp(1).chSched, Sched::GetScheduleAlwaysOn(*state)); } TEST_F(EnergyPlusFixture, Test_CentralHeatPumpSystem_adjustChillerHeaterCondFlowTemp) { + state->dataFluid->init_state(*state); state->dataPlantCentralGSHP->Wrapper.allocate(1); state->dataPlantCentralGSHP->Wrapper(1).WrapperComp.allocate(1); state->dataPlantCentralGSHP->Wrapper(1).ChillerHeater.allocate(1); @@ -373,9 +362,8 @@ TEST_F(EnergyPlusFixture, Test_CentralHeatPumpSystem_adjustChillerHeaterCondFlow auto &thisCH = thisWrap.ChillerHeater(1); state->dataPlnt->PlantLoop.allocate(1); state->dataPlnt->PlantLoop(1).FluidName = "WATER"; - state->dataPlnt->PlantLoop(1).FluidIndex = FluidProperties::GetGlycolNum(*state, state->dataPlnt->PlantLoop(1).FluidName); + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); thisWrap.HWPlantLoc.loopNum = 1; - FluidProperties::GetFluidPropertiesData(*state); Real64 qCondenser; Real64 condMassFlowRate; @@ -450,6 +438,7 @@ TEST_F(EnergyPlusFixture, Test_CentralHeatPumpSystem_adjustChillerHeaterCondFlow TEST_F(EnergyPlusFixture, Test_CentralHeatPumpSystem_adjustChillerHeaterEvapFlowTemp) { + state->dataFluid->init_state(*state); state->dataPlantCentralGSHP->Wrapper.allocate(1); state->dataPlantCentralGSHP->Wrapper(1).WrapperComp.allocate(1); state->dataPlantCentralGSHP->Wrapper(1).ChillerHeater.allocate(1); @@ -457,9 +446,8 @@ TEST_F(EnergyPlusFixture, Test_CentralHeatPumpSystem_adjustChillerHeaterEvapFlow auto &thisCH = thisWrap.ChillerHeater(1); state->dataPlnt->PlantLoop.allocate(1); state->dataPlnt->PlantLoop(1).FluidName = "WATER"; - state->dataPlnt->PlantLoop(1).FluidIndex = FluidProperties::GetGlycolNum(*state, state->dataPlnt->PlantLoop(1).FluidName); + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); thisWrap.HWPlantLoc.loopNum = 1; - FluidProperties::GetFluidPropertiesData(*state); Real64 qEvaporator; Real64 evapMassFlowRate; diff --git a/tst/EnergyPlus/unit/PlantChillers.unit.cc b/tst/EnergyPlus/unit/PlantChillers.unit.cc index c79b4fc5ad2..f98a4d1799e 100644 --- a/tst/EnergyPlus/unit/PlantChillers.unit.cc +++ b/tst/EnergyPlus/unit/PlantChillers.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -82,8 +82,8 @@ TEST_F(EnergyPlusFixture, GTChiller_HeatRecoveryAutosizeTest) state->dataPlnt->PlantLoop.allocate(2); state->dataSize->PlantSizData.allocate(1); state->dataPlnt->PlantLoop(1).PlantSizNum = 1; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataSize->PlantSizData(1).DesVolFlowRate = 1.0; state->dataSize->PlantSizData(1).DeltaT = 5.0; state->dataPlnt->PlantFirstSizesOkayToFinalize = true; @@ -119,8 +119,8 @@ TEST_F(EnergyPlusFixture, EngineDrivenChiller_HeatRecoveryAutosizeTest) state->dataPlnt->PlantLoop.allocate(2); state->dataSize->PlantSizData.allocate(1); state->dataPlnt->PlantLoop(1).PlantSizNum = 1; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataSize->PlantSizData(1).DesVolFlowRate = 1.0; state->dataSize->PlantSizData(1).DeltaT = 5.0; state->dataPlnt->PlantFirstSizesOkayToFinalize = true; diff --git a/tst/EnergyPlus/unit/PlantComponentTemperatureSources.unit.cc b/tst/EnergyPlus/unit/PlantComponentTemperatureSources.unit.cc index 9fe6e990715..5993020be5e 100644 --- a/tst/EnergyPlus/unit/PlantComponentTemperatureSources.unit.cc +++ b/tst/EnergyPlus/unit/PlantComponentTemperatureSources.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -72,10 +72,14 @@ TEST_F(EnergyPlusFixture, TestPlantComponentTemperatureSource) " ; !- Source Temperature Schedule Name"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + // Setup the plant itself manually state->dataPlnt->TotNumLoops = 1; state->dataPlnt->PlantLoop.allocate(1); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -116,10 +120,5 @@ TEST_F(EnergyPlusFixture, TestPlantComponentTemperatureSource) myLoad = 1696.55; waterSource1.simulate(*state, loc, firstHVACIteration, myLoad, runFlag); EXPECT_NEAR(0.05, waterSource1.MassFlowRate, 0.001); - - // Do this for scheduled temperature - // NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - // MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - // ProcessScheduleInput(); // read schedules } } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/PlantCondLoopOperation.unit.cc b/tst/EnergyPlus/unit/PlantCondLoopOperation.unit.cc index 1d23eb5efe9..db24b7a8e3f 100644 --- a/tst/EnergyPlus/unit/PlantCondLoopOperation.unit.cc +++ b/tst/EnergyPlus/unit/PlantCondLoopOperation.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -947,6 +947,8 @@ TEST_F(EnergyPlusFixture, ThermalEnergyStorageWithIceForceDualOp) EXPECT_TRUE(process_idf(idf_objects, false)); + state->init_state(*state); + // Setup the plant itself manually state->dataPlnt->TotNumLoops = 1; state->dataPlnt->PlantLoop.allocate(1); diff --git a/tst/EnergyPlus/unit/PlantHeatExchangerFluidToFluid.unit.cc b/tst/EnergyPlus/unit/PlantHeatExchangerFluidToFluid.unit.cc index 1ee0b3b5922..6c8c71bbc29 100644 --- a/tst/EnergyPlus/unit/PlantHeatExchangerFluidToFluid.unit.cc +++ b/tst/EnergyPlus/unit/PlantHeatExchangerFluidToFluid.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -1060,10 +1060,11 @@ TEST_F(EnergyPlusFixture, PlantHXModulatedDualDeadDefectFileHi) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + bool ErrorsFound = false; state->dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(*state); OutputReportPredefined::SetPredefinedTables(*state); HeatBalanceManager::SetPreConstructionInputParameters(*state); // establish array bounds for constructions early @@ -1116,7 +1117,7 @@ TEST_F(EnergyPlusFixture, PlantHXModulatedDualDeadDefectFileHi) state->dataGlobal->BeginHourFlag = true; state->dataGlobal->EndHourFlag = false; - for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->NumOfTimeStepInHour; + for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->TimeStepsInHour; ++state->dataGlobal->TimeStep) { state->dataGlobal->BeginTimeStepFlag = true; @@ -1128,7 +1129,7 @@ TEST_F(EnergyPlusFixture, PlantHXModulatedDualDeadDefectFileHi) // Note also that BeginTimeStepFlag, EndTimeStepFlag, and the // SubTimeStepFlags can/will be set/reset in the HVAC Manager. - if (state->dataGlobal->TimeStep == state->dataGlobal->NumOfTimeStepInHour) { + if (state->dataGlobal->TimeStep == state->dataGlobal->TimeStepsInHour) { state->dataGlobal->EndHourFlag = true; if (state->dataGlobal->HourOfDay == 24) { state->dataGlobal->EndDayFlag = true; @@ -2152,10 +2153,10 @@ TEST_F(EnergyPlusFixture, PlantHXModulatedDualDeadDefectFileLo) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; state->dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(*state); OutputReportPredefined::SetPredefinedTables(*state); HeatBalanceManager::SetPreConstructionInputParameters(*state); // establish array bounds for constructions early @@ -2208,7 +2209,7 @@ TEST_F(EnergyPlusFixture, PlantHXModulatedDualDeadDefectFileLo) state->dataGlobal->BeginHourFlag = true; state->dataGlobal->EndHourFlag = false; - for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->NumOfTimeStepInHour; + for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->TimeStepsInHour; ++state->dataGlobal->TimeStep) { state->dataGlobal->BeginTimeStepFlag = true; @@ -2220,7 +2221,7 @@ TEST_F(EnergyPlusFixture, PlantHXModulatedDualDeadDefectFileLo) // Note also that BeginTimeStepFlag, EndTimeStepFlag, and the // SubTimeStepFlags can/will be set/reset in the HVAC Manager. - if (state->dataGlobal->TimeStep == state->dataGlobal->NumOfTimeStepInHour) { + if (state->dataGlobal->TimeStep == state->dataGlobal->TimeStepsInHour) { state->dataGlobal->EndHourFlag = true; if (state->dataGlobal->HourOfDay == 24) { state->dataGlobal->EndDayFlag = true; @@ -2259,6 +2260,11 @@ TEST_F(EnergyPlusFixture, PlantHXModulatedDualDeadDefectFileLo) TEST_F(EnergyPlusFixture, PlantHXControlWithFirstHVACIteration) { + // get availability schedule to work + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); + // this unit test is for issue #4959. Added FirstHVACIteration to simulate and control routines // unit test checks that the change to logic for #4959 does work to affect node mass flow rate. The conditions are set up such that the demand // side inlet is too warm to cool the supply side, so previous behavior would shut down flow. Now if firstHVACIteration is true is should set @@ -2267,11 +2273,6 @@ TEST_F(EnergyPlusFixture, PlantHXControlWithFirstHVACIteration) state->dataPlantHXFluidToFluid->FluidHX.allocate(1); - // get availability schedule to work - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules - state->dataScheduleMgr->ScheduleInputProcessed = true; state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataGlobal->HourOfDay = 1; @@ -2280,8 +2281,8 @@ TEST_F(EnergyPlusFixture, PlantHXControlWithFirstHVACIteration) state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(*state); - state->dataPlantHXFluidToFluid->FluidHX(1).AvailSchedNum = -1; + Sched::UpdateScheduleVals(*state); + state->dataPlantHXFluidToFluid->FluidHX(1).availSched = Sched::GetScheduleAlwaysOn(*state); // setup four plant nodes for HX state->dataLoopNodes->Node.allocate(4); @@ -2323,7 +2324,6 @@ TEST_F(EnergyPlusFixture, PlantHXControlWithFirstHVACIteration) } state->dataPlnt->PlantLoop(1).Name = "HX supply side loop "; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataPlantHXFluidToFluid->FluidHX(1).Name; @@ -2337,7 +2337,6 @@ TEST_F(EnergyPlusFixture, PlantHXControlWithFirstHVACIteration) state->dataPlantHXFluidToFluid->FluidHX(1).SupplySideLoop.compNum = 1; state->dataPlnt->PlantLoop(2).Name = "HX demand side loop "; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataPlantHXFluidToFluid->FluidHX(1).Name; @@ -2368,13 +2367,13 @@ TEST_F(EnergyPlusFixture, PlantHXControl_CoolingSetpointOnOffWithComponentOverri // this unit test is for issue #5626. Fixed logic for CoolingSetpointOnOffWithComponentOverride. // unit test checks that the change for #5626 adjusts the temperature value used in central plant dispatch routines by the tolerance value. + // get availability schedule to work + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); + state->dataPlantHXFluidToFluid->FluidHX.allocate(1); - // get availability schedule to work - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules - state->dataScheduleMgr->ScheduleInputProcessed = true; state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataGlobal->HourOfDay = 1; @@ -2383,8 +2382,8 @@ TEST_F(EnergyPlusFixture, PlantHXControl_CoolingSetpointOnOffWithComponentOverri state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(*state); - state->dataPlantHXFluidToFluid->FluidHX(1).AvailSchedNum = -1; + Sched::UpdateScheduleVals(*state); + state->dataPlantHXFluidToFluid->FluidHX(1).availSched = Sched::GetScheduleAlwaysOn(*state); // setup four plant nodes for HX state->dataLoopNodes->Node.allocate(6); @@ -2442,7 +2441,6 @@ TEST_F(EnergyPlusFixture, PlantHXControl_CoolingSetpointOnOffWithComponentOverri state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).Comp.allocate(1); state->dataPlnt->PlantLoop(1).Name = "HX supply side loop "; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).Comp(1).Name = state->dataPlantHXFluidToFluid->FluidHX(1).Name; @@ -2452,7 +2450,6 @@ TEST_F(EnergyPlusFixture, PlantHXControl_CoolingSetpointOnOffWithComponentOverri state->dataPlantHXFluidToFluid->FluidHX(1).SupplySideLoop.inletNodeNum; state->dataPlnt->PlantLoop(2).Name = "HX demand side loop "; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataPlantHXFluidToFluid->FluidHX(1).Name; diff --git a/tst/EnergyPlus/unit/PlantLoadProfile.unit.cc b/tst/EnergyPlus/unit/PlantLoadProfile.unit.cc index 79596369112..8bb129de725 100644 --- a/tst/EnergyPlus/unit/PlantLoadProfile.unit.cc +++ b/tst/EnergyPlus/unit/PlantLoadProfile.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -103,6 +103,8 @@ TEST_F(EnergyPlusFixture, LoadProfile_GetInput) }); ASSERT_TRUE(process_idf(idf_objects, false)); + state->init_state(*state); + GetPlantProfileInput(*state); // Tests for LoadProfile on Water loop @@ -130,7 +132,7 @@ TEST_F(EnergyPlusFixture, LoadProfile_initandsimulate_Waterloop) // Test setup for a load profile in a water loop auto &thisWaterLoop(state->dataPlnt->PlantLoop(1)); thisWaterLoop.FluidName = "WATER"; - thisWaterLoop.FluidIndex = 1; + thisWaterLoop.glycol = Fluid::GetWater(*state); thisWaterLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); thisWaterLoop.LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; thisWaterLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -152,18 +154,17 @@ TEST_F(EnergyPlusFixture, LoadProfile_initandsimulate_Waterloop) thisLoadProfileWaterLoop.Name = "LOAD PROFILE WATER"; thisLoadProfileWaterLoop.FluidType = PlantLoopFluidType::Water; thisLoadProfileWaterLoop.PeakVolFlowRate = 0.002; - thisLoadProfileWaterLoop.LoadSchedule = 1; - thisLoadProfileWaterLoop.FlowRateFracSchedule = 2; + thisLoadProfileWaterLoop.loadSched = Sched::AddScheduleConstant(*state, "LOAD"); + thisLoadProfileWaterLoop.flowRateFracSched = Sched::AddScheduleConstant(*state, "FLOWRATEFRAC"); thisLoadProfileWaterLoop.InletNode = 1; thisLoadProfileWaterLoop.OutletNode = 2; thisLoadProfileWaterLoop.plantLoc = locWater; thisLoadProfileWaterLoop.plantLoc.loopNum = 1; - state->dataScheduleMgr->Schedule.allocate(2); - state->dataScheduleMgr->Schedule(thisLoadProfileWaterLoop.LoadSchedule).EMSActuatedOn = false; - state->dataScheduleMgr->Schedule(thisLoadProfileWaterLoop.LoadSchedule).CurrentValue = 10000; - state->dataScheduleMgr->Schedule(thisLoadProfileWaterLoop.FlowRateFracSchedule).EMSActuatedOn = false; - state->dataScheduleMgr->Schedule(thisLoadProfileWaterLoop.FlowRateFracSchedule).CurrentValue = 0.8; + thisLoadProfileWaterLoop.loadSched->EMSActuatedOn = false; + thisLoadProfileWaterLoop.loadSched->currentVal = 10000; + thisLoadProfileWaterLoop.flowRateFracSched->EMSActuatedOn = false; + thisLoadProfileWaterLoop.flowRateFracSched->currentVal = 0.8; // InitPlantProfile() thisLoadProfileWaterLoop.InitPlantProfile(*state); @@ -179,9 +180,8 @@ TEST_F(EnergyPlusFixture, LoadProfile_initandsimulate_Waterloop) std::string_view RoutineName("PlantLoadProfileTests"); thisLoadProfileWaterLoop.simulate(*state, locWater, firstHVAC, curLoad, runFlag); - Real64 rhoWater = FluidProperties::GetDensityGlycol(*state, thisWaterLoop.FluidName, 60, thisWaterLoop.FluidIndex, RoutineName); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol( - *state, thisWaterLoop.FluidName, thisLoadProfileWaterLoop.InletTemp, thisWaterLoop.FluidIndex, RoutineName); + Real64 rhoWater = thisWaterLoop.glycol->getDensity(*state, 60, RoutineName); + Real64 Cp = thisWaterLoop.glycol->getSpecificHeat(*state, thisLoadProfileWaterLoop.InletTemp, RoutineName); Real64 deltaTemp = curLoad / (rhoWater * thisLoadProfileWaterLoop.VolFlowRate * Cp); Real64 calOutletTemp = thisLoadProfileWaterLoop.InletTemp - deltaTemp; @@ -199,7 +199,8 @@ TEST_F(EnergyPlusFixture, LoadProfile_initandsimulate_Steamloop) // Test setup for a load profile in a steam loop auto &thisSteamLoop(state->dataPlnt->PlantLoop(1)); thisSteamLoop.FluidName = "STEAM"; - thisSteamLoop.FluidIndex = 1; + thisSteamLoop.steam = Fluid::GetSteam(*state); + thisSteamLoop.glycol = Fluid::GetWater(*state); thisSteamLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); thisSteamLoop.LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; thisSteamLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -211,8 +212,7 @@ TEST_F(EnergyPlusFixture, LoadProfile_initandsimulate_Steamloop) std::string_view RoutineName("PlantLoadProfileTests"); - Real64 SatTempAtmPress = FluidProperties::GetSatTemperatureRefrig( - *state, state->dataPlnt->PlantLoop(1).FluidName, DataEnvironment::StdPressureSeaLevel, state->dataPlnt->PlantLoop(1).FluidIndex, RoutineName); + Real64 SatTempAtmPress = state->dataPlnt->PlantLoop(1).steam->getSatTemperature(*state, DataEnvironment::StdPressureSeaLevel, RoutineName); state->dataLoopNodes->Node(1).Temp = SatTempAtmPress; state->dataLoopNodes->Node(1).MassFlowRateMax = 1; @@ -227,18 +227,17 @@ TEST_F(EnergyPlusFixture, LoadProfile_initandsimulate_Steamloop) thisLoadProfileSteamLoop.FluidType = PlantLoopFluidType::Steam; thisLoadProfileSteamLoop.PeakVolFlowRate = 0.008; thisLoadProfileSteamLoop.DegOfSubcooling = 3.0; - thisLoadProfileSteamLoop.LoadSchedule = 1; - thisLoadProfileSteamLoop.FlowRateFracSchedule = 2; + thisLoadProfileSteamLoop.loadSched = Sched::AddScheduleConstant(*state, "LOAD"); + thisLoadProfileSteamLoop.flowRateFracSched = Sched::AddScheduleConstant(*state, "FLOWRATEFRAC"); thisLoadProfileSteamLoop.InletNode = 1; thisLoadProfileSteamLoop.OutletNode = 2; thisLoadProfileSteamLoop.plantLoc = locSteam; thisLoadProfileSteamLoop.plantLoc.loopNum = 1; - state->dataScheduleMgr->Schedule.allocate(2); - state->dataScheduleMgr->Schedule(thisLoadProfileSteamLoop.LoadSchedule).EMSActuatedOn = false; - state->dataScheduleMgr->Schedule(thisLoadProfileSteamLoop.LoadSchedule).CurrentValue = 10000; - state->dataScheduleMgr->Schedule(thisLoadProfileSteamLoop.FlowRateFracSchedule).EMSActuatedOn = false; - state->dataScheduleMgr->Schedule(thisLoadProfileSteamLoop.FlowRateFracSchedule).CurrentValue = 0.8; + thisLoadProfileSteamLoop.loadSched->EMSActuatedOn = false; + thisLoadProfileSteamLoop.loadSched->currentVal = 10000; + thisLoadProfileSteamLoop.flowRateFracSched->EMSActuatedOn = false; + thisLoadProfileSteamLoop.flowRateFracSched->currentVal = 0.8; // InitPlantProfile() thisLoadProfileSteamLoop.InitPlantProfile(*state); @@ -253,13 +252,10 @@ TEST_F(EnergyPlusFixture, LoadProfile_initandsimulate_Steamloop) bool runFlag = true; thisLoadProfileSteamLoop.simulate(*state, locSteam, firstHVAC, curLoad, runFlag); - Real64 EnthSteamIn = - FluidProperties::GetSatEnthalpyRefrig(*state, thisSteamLoop.FluidName, SatTempAtmPress, 1.0, thisSteamLoop.FluidIndex, RoutineName); - Real64 EnthSteamOut = - FluidProperties::GetSatEnthalpyRefrig(*state, thisSteamLoop.FluidName, SatTempAtmPress, 0.0, thisSteamLoop.FluidIndex, RoutineName); + Real64 EnthSteamIn = thisSteamLoop.steam->getSatEnthalpy(*state, SatTempAtmPress, 1.0, RoutineName); + Real64 EnthSteamOut = thisSteamLoop.steam->getSatEnthalpy(*state, SatTempAtmPress, 0.0, RoutineName); Real64 LatentHeatSteam = EnthSteamIn - EnthSteamOut; - Real64 CpCondensate = - FluidProperties::GetSpecificHeatGlycol(*state, thisSteamLoop.FluidName, SatTempAtmPress, thisSteamLoop.FluidIndex, RoutineName); + Real64 CpCondensate = thisSteamLoop.glycol->getSpecificHeat(*state, SatTempAtmPress, RoutineName); Real64 calOutletMdot = curLoad / (LatentHeatSteam + thisLoadProfileSteamLoop.DegOfSubcooling * CpCondensate); EXPECT_EQ(thisLoadProfileSteamLoop.MassFlowRate, calOutletMdot); diff --git a/tst/EnergyPlus/unit/PlantLoopHeatPumpEIR.unit.cc b/tst/EnergyPlus/unit/PlantLoopHeatPumpEIR.unit.cc index c2a861614bf..dd94012446e 100644 --- a/tst/EnergyPlus/unit/PlantLoopHeatPumpEIR.unit.cc +++ b/tst/EnergyPlus/unit/PlantLoopHeatPumpEIR.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -121,6 +121,7 @@ TEST_F(EnergyPlusFixture, ConstructionFullObjectsHeatingAndCooling_WaterSource) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // call the factory with a valid name to trigger reading inputs EIRPlantLoopHeatPump::factory(*state, DataPlant::PlantEquipmentType::HeatPumpEIRHeating, "HP HEATING SIDE"); @@ -231,6 +232,7 @@ TEST_F(EnergyPlusFixture, HeatingConstructionFullObjectsNoCompanion) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // call the factory with a valid name to trigger reading inputs EIRPlantLoopHeatPump::factory(*state, DataPlant::PlantEquipmentType::HeatPumpEIRHeating, "HP HEATING SIDE"); @@ -282,6 +284,7 @@ TEST_F(EnergyPlusFixture, CoolingConstructionFullObjectsNoCompanion) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // call the factory with a valid name to trigger reading inputs EIRPlantLoopHeatPump::factory(*state, DataPlant::PlantEquipmentType::HeatPumpEIRCooling, "HP COOLING SIDE"); @@ -333,6 +336,7 @@ TEST_F(EnergyPlusFixture, CoolingConstructionFullObjectWithDefaults) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // call the factory with a valid name to trigger reading inputs EIRPlantLoopHeatPump::factory(*state, DataPlant::PlantEquipmentType::HeatPumpEIRCooling, "HP COOLING SIDE"); @@ -377,6 +381,7 @@ TEST_F(EnergyPlusFixture, CoolingConstructionFullyAutoSized_WaterSource) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // call the factory with a valid name to trigger reading inputs EIRPlantLoopHeatPump::factory(*state, DataPlant::PlantEquipmentType::HeatPumpEIRCooling, "HP COOLING SIDE"); @@ -422,6 +427,8 @@ TEST_F(EnergyPlusFixture, CatchErrorsOnBadCurves) " dummyCurveB,", " dummyCurveC;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + // call the factory with a valid name to trigger reading inputs, it should throw for the bad curves EXPECT_THROW(EIRPlantLoopHeatPump::factory(*state, DataPlant::PlantEquipmentType::HeatPumpEIRCooling, "HP COOLING SIDE"), std::runtime_error); } @@ -454,12 +461,15 @@ TEST_F(EnergyPlusFixture, processInputForEIRPLHP_TestAirSourceDuplicateNodes) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // set up the plant loops // first the load side state->dataPlnt->TotNumLoops = 2; state->dataPlnt->PlantLoop.allocate(2); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).TotalComponents = 1; @@ -468,6 +478,8 @@ TEST_F(EnergyPlusFixture, processInputForEIRPLHP_TestAirSourceDuplicateNodes) PLHPPlantLoadSideComp.Type = DataPlant::PlantEquipmentType::HeatPumpEIRCooling; // then the source side + state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -523,12 +535,15 @@ TEST_F(EnergyPlusFixture, processInputForEIRPLHP_TestAirSourceOANode) "OutdoorAir:NodeList,", " node 3;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // set up the plant loops // first the load side state->dataPlnt->TotNumLoops = 2; state->dataPlnt->PlantLoop.allocate(2); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).TotalComponents = 1; @@ -537,6 +552,8 @@ TEST_F(EnergyPlusFixture, processInputForEIRPLHP_TestAirSourceOANode) PLHPPlantLoadSideComp.Type = DataPlant::PlantEquipmentType::HeatPumpEIRCooling; // then the source side + state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -582,12 +599,15 @@ TEST_F(EnergyPlusFixture, processInputForEIRPLHP_TestAirSourceNoOANode) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // set up the plant loops // first the load side state->dataPlnt->TotNumLoops = 2; state->dataPlnt->PlantLoop.allocate(2); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).TotalComponents = 1; @@ -596,6 +616,8 @@ TEST_F(EnergyPlusFixture, processInputForEIRPLHP_TestAirSourceNoOANode) PLHPPlantLoadSideComp.Type = DataPlant::PlantEquipmentType::HeatPumpEIRCooling; // then the source side + state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -652,12 +674,15 @@ TEST_F(EnergyPlusFixture, Initialization) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // set up the plant loops // first the load side state->dataPlnt->TotNumLoops = 2; state->dataPlnt->PlantLoop.allocate(2); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).TotalComponents = 1; @@ -666,6 +691,8 @@ TEST_F(EnergyPlusFixture, Initialization) PLHPPlantLoadSideComp.Type = DataPlant::PlantEquipmentType::HeatPumpEIRCooling; // then the source side + state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -774,6 +801,7 @@ TEST_F(EnergyPlusFixture, TestSizing_FullyAutosizedCoolingWithCompanion_WaterSou " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // call the factory with a valid name to trigger reading inputs EIRPlantLoopHeatPump::factory(*state, DataPlant::PlantEquipmentType::HeatPumpEIRCooling, "HP COOLING SIDE"); @@ -793,6 +821,8 @@ TEST_F(EnergyPlusFixture, TestSizing_FullyAutosizedCoolingWithCompanion_WaterSou state->dataPlnt->TotNumLoops = 2; state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -802,6 +832,8 @@ TEST_F(EnergyPlusFixture, TestSizing_FullyAutosizedCoolingWithCompanion_WaterSou state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).TotalComponents = 2; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).Comp.allocate(2); + state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 2; @@ -967,6 +999,7 @@ TEST_F(EnergyPlusFixture, TestSizing_FullyHardsizedHeatingWithCompanion) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // call the factory with a valid name to trigger reading inputs EIRPlantLoopHeatPump::factory(*state, DataPlant::PlantEquipmentType::HeatPumpEIRCooling, "HP COOLING SIDE"); @@ -986,6 +1019,8 @@ TEST_F(EnergyPlusFixture, TestSizing_FullyHardsizedHeatingWithCompanion) state->dataPlnt->TotNumLoops = 2; state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -996,6 +1031,8 @@ TEST_F(EnergyPlusFixture, TestSizing_FullyHardsizedHeatingWithCompanion) state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).Comp.allocate(2); state->dataPlnt->PlantLoop(1).PlantSizNum = 1; + state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 2; @@ -1110,6 +1147,7 @@ TEST_F(EnergyPlusFixture, TestSizing_WithCompanionNoPlantSizing) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // call the factory with a valid name to trigger reading inputs EIRPlantLoopHeatPump::factory(*state, DataPlant::PlantEquipmentType::HeatPumpEIRCooling, "HP COOLING SIDE"); @@ -1129,6 +1167,8 @@ TEST_F(EnergyPlusFixture, TestSizing_WithCompanionNoPlantSizing) state->dataPlnt->TotNumLoops = 2; state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -1138,6 +1178,8 @@ TEST_F(EnergyPlusFixture, TestSizing_WithCompanionNoPlantSizing) state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).TotalComponents = 2; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).Comp.allocate(2); + state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 2; @@ -1226,6 +1268,7 @@ TEST_F(EnergyPlusFixture, TestSizing_NoCompanionNoPlantSizingError) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // call the factory with a valid name to trigger reading inputs EIRPlantLoopHeatPump::factory(*state, DataPlant::PlantEquipmentType::HeatPumpEIRHeating, "HP HEATING SIDE"); @@ -1243,6 +1286,8 @@ TEST_F(EnergyPlusFixture, TestSizing_NoCompanionNoPlantSizingError) state->dataPlnt->TotNumLoops = 2; state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -1252,6 +1297,8 @@ TEST_F(EnergyPlusFixture, TestSizing_NoCompanionNoPlantSizingError) state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).TotalComponents = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).Comp.allocate(1); + state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -1318,6 +1365,7 @@ TEST_F(EnergyPlusFixture, TestSizing_NoCompanionNoPlantSizingHardSized) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // call the factory with a valid name to trigger reading inputs EIRPlantLoopHeatPump::factory(*state, DataPlant::PlantEquipmentType::HeatPumpEIRHeating, "HP HEATING SIDE"); @@ -1335,6 +1383,8 @@ TEST_F(EnergyPlusFixture, TestSizing_NoCompanionNoPlantSizingHardSized) state->dataPlnt->TotNumLoops = 2; state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -1344,6 +1394,8 @@ TEST_F(EnergyPlusFixture, TestSizing_NoCompanionNoPlantSizingHardSized) state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).TotalComponents = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).Comp.allocate(1); + state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -1414,6 +1466,7 @@ TEST_F(EnergyPlusFixture, CoolingOutletSetpointWorker) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // set up the plant loops // first the load side @@ -1421,6 +1474,8 @@ TEST_F(EnergyPlusFixture, CoolingOutletSetpointWorker) state->dataPlnt->PlantLoop.allocate(1); auto &PLHPPlantLoadSideLoop = state->dataPlnt->PlantLoop(1); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).TotalComponents = 1; @@ -1496,6 +1551,7 @@ TEST_F(EnergyPlusFixture, HeatingOutletSetpointWorker) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // set up the plant loops // first the load side @@ -1503,6 +1559,8 @@ TEST_F(EnergyPlusFixture, HeatingOutletSetpointWorker) state->dataPlnt->PlantLoop.allocate(1); auto &PLHPPlantLoadSideLoop = state->dataPlnt->PlantLoop(1); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).TotalComponents = 1; @@ -1568,6 +1626,7 @@ TEST_F(EnergyPlusFixture, Initialization2_WaterSource) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool firstHVACIteration = true; // set up the plant loops @@ -1575,6 +1634,8 @@ TEST_F(EnergyPlusFixture, Initialization2_WaterSource) state->dataPlnt->TotNumLoops = 2; state->dataPlnt->PlantLoop.allocate(2); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).TotalComponents = 1; @@ -1583,6 +1644,8 @@ TEST_F(EnergyPlusFixture, Initialization2_WaterSource) PLHPPlantLoadSideComp.Type = DataPlant::PlantEquipmentType::HeatPumpEIRCooling; // then the source side + state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -1705,11 +1768,14 @@ TEST_F(EnergyPlusFixture, OnInitLoopEquipTopologyErrorCases) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // set up a couple simple plant loops with one branch per loop-side and one component per branch state->dataPlnt->TotNumLoops = 2; state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); @@ -1720,6 +1786,8 @@ TEST_F(EnergyPlusFixture, OnInitLoopEquipTopologyErrorCases) state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).TotalComponents = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).Comp.allocate(1); + state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); @@ -1825,12 +1893,15 @@ TEST_F(EnergyPlusFixture, CoolingSimulate_WaterSource) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // set up the plant loops // first the load side state->dataPlnt->TotNumLoops = 2; state->dataPlnt->PlantLoop.allocate(2); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch.allocate(1); @@ -1841,6 +1912,8 @@ TEST_F(EnergyPlusFixture, CoolingSimulate_WaterSource) PLHPPlantLoadSideComp.CurOpSchemeType = DataPlant::OpScheme::CompSetPtBased; // then the source side + state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -1962,12 +2035,15 @@ TEST_F(EnergyPlusFixture, HeatingSimulate_WaterSource) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // set up the plant loops // first the load side state->dataPlnt->TotNumLoops = 2; state->dataPlnt->PlantLoop.allocate(2); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch.allocate(1); @@ -1978,6 +2054,8 @@ TEST_F(EnergyPlusFixture, HeatingSimulate_WaterSource) PLHPPlantLoadSideComp.CurOpSchemeType = DataPlant::OpScheme::CompSetPtBased; // then the source side + state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -2138,6 +2216,7 @@ TEST_F(EnergyPlusFixture, ConstructionFullObjectsHeatingAndCooling_AirSource) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // call the factory with a valid name to trigger reading inputs EIRPlantLoopHeatPump::factory(*state, DataPlant::PlantEquipmentType::HeatPumpEIRHeating, "HP HEATING SIDE"); @@ -2200,12 +2279,15 @@ TEST_F(EnergyPlusFixture, CoolingSimulate_AirSource) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // set up the plant loops // first the load side state->dataPlnt->TotNumLoops = 1; state->dataPlnt->PlantLoop.allocate(1); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch.allocate(1); @@ -2320,12 +2402,15 @@ TEST_F(EnergyPlusFixture, HeatingSimulate_AirSource) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // set up the plant loops // first the load side state->dataPlnt->TotNumLoops = 1; state->dataPlnt->PlantLoop.allocate(1); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch.allocate(1); @@ -2456,6 +2541,7 @@ TEST_F(EnergyPlusFixture, CoolingConstructionFullyAutoSized_AirSource) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // call the factory with a valid name to trigger reading inputs EIRPlantLoopHeatPump::factory(*state, DataPlant::PlantEquipmentType::HeatPumpEIRCooling, "HP COOLING SIDE"); @@ -2507,6 +2593,7 @@ TEST_F(EnergyPlusFixture, ClearState) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // call the factory with a valid name to trigger reading inputs EIRPlantLoopHeatPump::factory(*state, DataPlant::PlantEquipmentType::HeatPumpEIRCooling, "HP COOLING SIDE"); @@ -2545,6 +2632,7 @@ TEST_F(EnergyPlusFixture, Initialization2_AirSource) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool firstHVACIteration = true; // set up the plant loops @@ -2552,6 +2640,8 @@ TEST_F(EnergyPlusFixture, Initialization2_AirSource) state->dataPlnt->TotNumLoops = 1; state->dataPlnt->PlantLoop.allocate(1); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).TotalComponents = 1; @@ -2681,6 +2771,7 @@ TEST_F(EnergyPlusFixture, TestSizing_FullyAutosizedCoolingWithCompanion_AirSourc " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // call the factory with a valid name to trigger reading inputs EIRPlantLoopHeatPump::factory(*state, DataPlant::PlantEquipmentType::HeatPumpEIRCooling, "HP COOLING SIDE"); @@ -2700,6 +2791,8 @@ TEST_F(EnergyPlusFixture, TestSizing_FullyAutosizedCoolingWithCompanion_AirSourc state->dataPlnt->TotNumLoops = 1; state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -2850,6 +2943,7 @@ TEST_F(EnergyPlusFixture, TestSizing_HardsizedFlowAutosizedCoolingWithCompanion_ " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // call the factory with a valid name to trigger reading inputs EIRPlantLoopHeatPump::factory(*state, DataPlant::PlantEquipmentType::HeatPumpEIRCooling, "HP COOLING SIDE"); @@ -2869,6 +2963,8 @@ TEST_F(EnergyPlusFixture, TestSizing_HardsizedFlowAutosizedCoolingWithCompanion_ state->dataPlnt->TotNumLoops = 1; state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -2984,6 +3080,7 @@ TEST_F(EnergyPlusFixture, TestSizing_AutosizedFlowWithCompanion_AirSource) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // call the factory with a valid name to trigger reading inputs EIRPlantLoopHeatPump::factory(*state, DataPlant::PlantEquipmentType::HeatPumpEIRCooling, "HP COOLING SIDE"); @@ -2999,6 +3096,8 @@ TEST_F(EnergyPlusFixture, TestSizing_AutosizedFlowWithCompanion_AirSource) state->dataPlnt->TotNumLoops = 1; state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -3132,12 +3231,15 @@ TEST_F(EnergyPlusFixture, Test_DoPhysics) " 1.0;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // set up the plant loops // first the load side state->dataPlnt->TotNumLoops = 2; state->dataPlnt->PlantLoop.allocate(2); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).TotalComponents = 1; @@ -3147,6 +3249,8 @@ TEST_F(EnergyPlusFixture, Test_DoPhysics) PLHPPlantLoadSideComp.Type = DataPlant::PlantEquipmentType::HeatPumpEIRCooling; // then the source side + state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -3192,7 +3296,7 @@ TEST_F(EnergyPlusFixture, Test_DoPhysics) PLHPPlantLoadSideComp.CurOpSchemeType = DataPlant::OpScheme::CoolingRB; state->dataHVACGlobal->TimeStepSys = 60; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; Real64 curLoad = -10000; @@ -3234,12 +3338,15 @@ TEST_F(EnergyPlusFixture, CoolingMetering) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // set up the plant loops // first the load side state->dataPlnt->TotNumLoops = 2; state->dataPlnt->PlantLoop.allocate(2); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch.allocate(1); @@ -3250,6 +3357,8 @@ TEST_F(EnergyPlusFixture, CoolingMetering) PLHPPlantLoadSideComp.CurOpSchemeType = DataPlant::OpScheme::CompSetPtBased; // then the source side + state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -3325,12 +3434,15 @@ TEST_F(EnergyPlusFixture, HeatingMetering) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // set up the plant loops // first the load side state->dataPlnt->TotNumLoops = 2; state->dataPlnt->PlantLoop.allocate(2); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch.allocate(1); @@ -3341,6 +3453,8 @@ TEST_F(EnergyPlusFixture, HeatingMetering) PLHPPlantLoadSideComp.CurOpSchemeType = DataPlant::OpScheme::CompSetPtBased; // then the source side + state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -3433,6 +3547,7 @@ TEST_F(EnergyPlusFixture, TestOperatingFlowRates_FullyAutosized_AirSource) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool firstHVACIteration = true; // set up the plant loops @@ -3440,6 +3555,8 @@ TEST_F(EnergyPlusFixture, TestOperatingFlowRates_FullyAutosized_AirSource) state->dataPlnt->TotNumLoops = 1; state->dataPlnt->PlantLoop.allocate(1); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).TotalComponents = 1; @@ -3609,12 +3726,15 @@ TEST_F(EnergyPlusFixture, Test_Curve_Negative_Energy) " 1.0;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // set up the plant loops // first the load side state->dataPlnt->TotNumLoops = 2; state->dataPlnt->PlantLoop.allocate(2); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).TotalComponents = 1; @@ -3624,6 +3744,8 @@ TEST_F(EnergyPlusFixture, Test_Curve_Negative_Energy) PLHPPlantLoadSideComp.Type = DataPlant::PlantEquipmentType::HeatPumpEIRCooling; // then the source side + state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -3669,7 +3791,7 @@ TEST_F(EnergyPlusFixture, Test_Curve_Negative_Energy) PLHPPlantLoadSideComp.CurOpSchemeType = DataPlant::OpScheme::CoolingRB; state->dataHVACGlobal->TimeStepSys = 60; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; Real64 curLoad = -10000; @@ -3799,6 +3921,7 @@ TEST_F(EnergyPlusFixture, GAHP_HeatingConstructionFullObjectsNoCompanion) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // call the factory with a valid name to trigger reading inputs EIRFuelFiredHeatPump::factory(*state, DataPlant::PlantEquipmentType::HeatPumpFuelFiredHeating, "FUEL FIRED HP HEATING SIDE"); @@ -3926,6 +4049,7 @@ TEST_F(EnergyPlusFixture, GAHP_HeatingConstructionFullObjectsNoCompanion_with_De " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // call the factory with a valid name to trigger reading inputs EIRFuelFiredHeatPump::factory(*state, DataPlant::PlantEquipmentType::HeatPumpFuelFiredHeating, "FUEL FIRED HP HEATING SIDE"); @@ -4053,6 +4177,7 @@ TEST_F(EnergyPlusFixture, GAHP_Initialization_Test) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool firstHVACIteration = true; // set up the plant loops @@ -4060,6 +4185,8 @@ TEST_F(EnergyPlusFixture, GAHP_Initialization_Test) state->dataPlnt->TotNumLoops = 1; state->dataPlnt->PlantLoop.allocate(1); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).TotalComponents = 1; @@ -4239,12 +4366,15 @@ TEST_F(EnergyPlusFixture, GAHP_HeatingSimulate_AirSource) " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // set up the plant loops // first the load side state->dataPlnt->TotNumLoops = 1; state->dataPlnt->PlantLoop.allocate(1); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch.allocate(1); @@ -4459,13 +4589,17 @@ TEST_F(EnergyPlusFixture, GAHP_HeatingSimulate_AirSource_with_Defrost) ASSERT_TRUE(process_idf(idf_objects)); state->dataHVACGlobal->TimeStepSys = 0.25; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; + + state->init_state(*state); // set up the plant loops // first the load side state->dataPlnt->TotNumLoops = 1; state->dataPlnt->PlantLoop.allocate(1); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch.allocate(1); @@ -4636,6 +4770,7 @@ TEST_F(EnergyPlusFixture, Test_HeatRecoveryGetInputs_AirSource) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // call the factory with a valid name to trigger reading inputs EIRPlantLoopHeatPump::factory(*state, DataPlant::PlantEquipmentType::HeatPumpEIRCooling, "HP COOLING SIDE"); @@ -4703,6 +4838,7 @@ TEST_F(EnergyPlusFixture, Test_HeatRecoveryFlowSizing_AirSource) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // call the factory with a valid name to trigger reading inputs EIRPlantLoopHeatPump::factory(*state, DataPlant::PlantEquipmentType::HeatPumpEIRCooling, "HP COOLING SIDE"); @@ -4727,6 +4863,8 @@ TEST_F(EnergyPlusFixture, Test_HeatRecoveryFlowSizing_AirSource) state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); state->dataSize->PlantSizData.allocate(2); // chilled water plant loop + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -4749,6 +4887,8 @@ TEST_F(EnergyPlusFixture, Test_HeatRecoveryFlowSizing_AirSource) state->dataSize->PlantSizData(1).DeltaT = 6.67; // hot water plant loop + state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -4848,6 +4988,7 @@ TEST_F(EnergyPlusFixture, CoolingwithHeatRecoverySimulate_AirSource) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // call the factory with a valid name to trigger reading inputs EIRPlantLoopHeatPump::factory(*state, DataPlant::PlantEquipmentType::HeatPumpEIRCooling, "HP COOLING SIDE"); @@ -4872,6 +5013,8 @@ TEST_F(EnergyPlusFixture, CoolingwithHeatRecoverySimulate_AirSource) state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); state->dataSize->PlantSizData.allocate(2); // chilled water plant loop + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -4899,6 +5042,8 @@ TEST_F(EnergyPlusFixture, CoolingwithHeatRecoverySimulate_AirSource) PLHPPlantLoadSideComp.CurOpSchemeType = DataPlant::OpScheme::CompSetPtBased; // hot water plant loop + state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -5065,6 +5210,7 @@ TEST_F(EnergyPlusFixture, HeatingwithHeatRecoverySimulate_AirSource) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // call the factory with a valid name to trigger reading inputs EIRPlantLoopHeatPump::factory(*state, DataPlant::PlantEquipmentType::HeatPumpEIRCooling, "HP COOLING SIDE"); @@ -5089,6 +5235,8 @@ TEST_F(EnergyPlusFixture, HeatingwithHeatRecoverySimulate_AirSource) state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); state->dataSize->PlantSizData.allocate(2); // chilled water plant loop + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -5116,6 +5264,8 @@ TEST_F(EnergyPlusFixture, HeatingwithHeatRecoverySimulate_AirSource) PLHPPlantLoadSideComp.CurOpSchemeType = DataPlant::OpScheme::CompSetPtBased; // hot water plant loop + state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -5271,12 +5421,15 @@ TEST_F(EnergyPlusFixture, CoolingSimulate_WSHP_SourceSideOutletTemp) " 1,", " 1;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // set up the plant loops // first the load side state->dataPlnt->TotNumLoops = 2; state->dataPlnt->PlantLoop.allocate(2); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch.allocate(1); @@ -5287,6 +5440,8 @@ TEST_F(EnergyPlusFixture, CoolingSimulate_WSHP_SourceSideOutletTemp) PLHPPlantLoadSideComp.CurOpSchemeType = DataPlant::OpScheme::CompSetPtBased; // then the source side + state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; @@ -5560,6 +5715,8 @@ TEST_F(EnergyPlusFixture, GAHP_AirSource_CurveEval) state->dataPlnt->TotNumLoops = 1; state->dataPlnt->PlantLoop.allocate(1); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).TotalBranches = 2; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch.allocate(2); diff --git a/tst/EnergyPlus/unit/PlantManager.unit.cc b/tst/EnergyPlus/unit/PlantManager.unit.cc index 354af3d518d..ca75a0a1749 100644 --- a/tst/EnergyPlus/unit/PlantManager.unit.cc +++ b/tst/EnergyPlus/unit/PlantManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -70,7 +70,6 @@ namespace PlantManager { using namespace DataPlant; using namespace DataLoopNode; using namespace DataSizing; - using namespace ScheduleManager; using namespace SetPointManager; TEST_F(EnergyPlusFixture, PlantManager_SizePlantLoopTest) @@ -81,7 +80,7 @@ namespace PlantManager { state->dataPlnt->PlantLoop(1).MaxVolFlowRate = 5; state->dataPlnt->PlantLoop(1).CirculationTime = 2; state->dataPlnt->PlantLoop(1).FluidType = DataLoopNode::NodeFluidType::Water; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); SizePlantLoop(*state, 1, true); int TestVolume = 600; EXPECT_EQ(TestVolume, state->dataPlnt->PlantLoop(1).Volume); @@ -205,6 +204,7 @@ namespace PlantManager { }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // get input and checks if there are two setpointmanagers // for a TwoWayCommonPipe and one of them setpoints can be @@ -271,6 +271,8 @@ namespace UserDefinedComponents { }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + OutAirNodeManager::SetOutAirNodes(*state); EMSManager::CheckIfAnyEMS(*state); state->dataEMSMgr->FinishProcessingUserInput = true; diff --git a/tst/EnergyPlus/unit/PlantPipingSystemsManager.unit.cc b/tst/EnergyPlus/unit/PlantPipingSystemsManager.unit.cc index 2967f4ca730..f217556c210 100644 --- a/tst/EnergyPlus/unit/PlantPipingSystemsManager.unit.cc +++ b/tst/EnergyPlus/unit/PlantPipingSystemsManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -1731,6 +1731,8 @@ TEST_F(EnergyPlusFixture, PipingSystemFullSimulation) state->dataPlnt->TotNumLoops = 1; state->dataPlnt->PlantLoop.allocate(1); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).TotalBranches = 1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; diff --git a/tst/EnergyPlus/unit/PlantUtilities.unit.cc b/tst/EnergyPlus/unit/PlantUtilities.unit.cc index edb6bfccb56..ea25565b8ee 100644 --- a/tst/EnergyPlus/unit/PlantUtilities.unit.cc +++ b/tst/EnergyPlus/unit/PlantUtilities.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -91,13 +91,17 @@ TEST_F(EnergyPlusFixture, PlantUtilities_RegisterPlantCompDesignFlowTest1) TEST_F(EnergyPlusFixture, TestRegulateCondenserCompFlowReqOp) { // test consecutive call to fluid properties getInput - FluidProperties::GetFluidPropertiesData(*state); - EXPECT_EQ(1, state->dataFluidProps->refrigs.isize()); - EXPECT_EQ(1, state->dataFluidProps->glycols.isize()); + Fluid::GetFluidPropertiesData(*state); + EXPECT_EQ(1, state->dataFluid->refrigs.isize()); + EXPECT_EQ(1, state->dataFluid->glycols.isize()); - FluidProperties::GetFluidPropertiesData(*state); // should never happen but if it does it's safe - EXPECT_EQ(1, state->dataFluidProps->refrigs.isize()); - EXPECT_EQ(1, state->dataFluidProps->glycols.isize()); + // should never happen but if it does it's safe + + // This is the second unit test that does this, when really we + // should just ensure that it never happens. + Fluid::GetFluidPropertiesData(*state); + EXPECT_EQ(1, state->dataFluid->refrigs.isize()); + EXPECT_EQ(1, state->dataFluid->glycols.isize()); // This test captures all code paths through the RegulateCondenserCompFlowReqOp function // We only need a single component to check here diff --git a/tst/EnergyPlus/unit/PluginManager.unit.cc b/tst/EnergyPlus/unit/PluginManager.unit.cc index c91a62120cf..5442bea9c5c 100644 --- a/tst/EnergyPlus/unit/PluginManager.unit.cc +++ b/tst/EnergyPlus/unit/PluginManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/PollutionModule.unit.cc b/tst/EnergyPlus/unit/PollutionModule.unit.cc index 77411d5421b..596f5595aa6 100644 --- a/tst/EnergyPlus/unit/PollutionModule.unit.cc +++ b/tst/EnergyPlus/unit/PollutionModule.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/PoweredInductionUnits.unit.cc b/tst/EnergyPlus/unit/PoweredInductionUnits.unit.cc index 7809725dcd9..1724917e928 100644 --- a/tst/EnergyPlus/unit/PoweredInductionUnits.unit.cc +++ b/tst/EnergyPlus/unit/PoweredInductionUnits.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -169,11 +169,10 @@ TEST_F(EnergyPlusFixture, ParallelPIUTest1) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules - state->dataScheduleMgr->ScheduleInputProcessed = true; state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataGlobal->HourOfDay = 1; @@ -183,7 +182,7 @@ TEST_F(EnergyPlusFixture, ParallelPIUTest1) state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); @@ -194,9 +193,15 @@ TEST_F(EnergyPlusFixture, ParallelPIUTest1) Fans::GetFanInput(*state); state->dataFans->GetFanInputFlag = false; PoweredInductionUnits::GetPIUs(*state); - EXPECT_TRUE(compare_err_stream("")); + std::string error_string = delimited_string({" ** Warning ** ProcessScheduleInput: Schedule:Constant = ALWAYSOFF", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = ALWAYSON", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated."}); + EXPECT_TRUE(compare_err_stream(error_string)); state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; // node number table // 1 SPACE2-1 Air Node @@ -395,11 +400,10 @@ TEST_F(EnergyPlusFixture, SeriesPIUTest1) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules - state->dataScheduleMgr->ScheduleInputProcessed = true; state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataGlobal->HourOfDay = 1; @@ -409,7 +413,7 @@ TEST_F(EnergyPlusFixture, SeriesPIUTest1) state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); @@ -420,9 +424,16 @@ TEST_F(EnergyPlusFixture, SeriesPIUTest1) Fans::GetFanInput(*state); state->dataFans->GetFanInputFlag = false; PoweredInductionUnits::GetPIUs(*state); - EXPECT_TRUE(compare_err_stream("")); + + std::string error_string = delimited_string({" ** Warning ** ProcessScheduleInput: Schedule:Constant = ALWAYSOFF", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = ALWAYSON", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated."}); + EXPECT_TRUE(compare_err_stream(error_string)); state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; // node number table // 1 SPACE2-1 Air Node @@ -670,11 +681,10 @@ TEST_F(EnergyPlusFixture, SeriesPIUZoneOAVolumeFlowRateTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules - state->dataScheduleMgr->ScheduleInputProcessed = true; state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataGlobal->HourOfDay = 1; @@ -684,7 +694,7 @@ TEST_F(EnergyPlusFixture, SeriesPIUZoneOAVolumeFlowRateTest) state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); @@ -697,7 +707,7 @@ TEST_F(EnergyPlusFixture, SeriesPIUZoneOAVolumeFlowRateTest) PoweredInductionUnits::GetPIUs(*state); EXPECT_TRUE(compare_err_stream("")); state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback(1) = false; @@ -1937,6 +1947,7 @@ TEST_F(EnergyPlusFixture, PIU_InducedAir_Plenums) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // What we're testing for here is an initialization order issue, and this is why we rely on calling a high-level function such as ManageSizing // and not lower level ones @@ -2071,12 +2082,10 @@ TEST_F(EnergyPlusFixture, VSParallelPIUStagedHeat) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); - // Init - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules - state->dataScheduleMgr->ScheduleInputProcessed = true; state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataGlobal->HourOfDay = 1; @@ -2086,7 +2095,7 @@ TEST_F(EnergyPlusFixture, VSParallelPIUStagedHeat) state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -2096,9 +2105,15 @@ TEST_F(EnergyPlusFixture, VSParallelPIUStagedHeat) Fans::GetFanInput(*state); state->dataFans->GetFanInputFlag = false; PoweredInductionUnits::GetPIUs(*state); - EXPECT_TRUE(compare_err_stream("")); + std::string error_string = delimited_string({" ** Warning ** ProcessScheduleInput: Schedule:Constant = ALWAYSOFF", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = ALWAYSON", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated."}); + EXPECT_TRUE(compare_err_stream(error_string)); state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); @@ -2270,12 +2285,10 @@ TEST_F(EnergyPlusFixture, VSParallelPIUModulatedHeat) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); - // Init - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules - state->dataScheduleMgr->ScheduleInputProcessed = true; state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataGlobal->HourOfDay = 1; @@ -2285,7 +2298,7 @@ TEST_F(EnergyPlusFixture, VSParallelPIUModulatedHeat) state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -2295,9 +2308,15 @@ TEST_F(EnergyPlusFixture, VSParallelPIUModulatedHeat) Fans::GetFanInput(*state); state->dataFans->GetFanInputFlag = false; PoweredInductionUnits::GetPIUs(*state); - EXPECT_TRUE(compare_err_stream("")); + std::string error_string = delimited_string({" ** Warning ** ProcessScheduleInput: Schedule:Constant = ALWAYSOFF", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = ALWAYSON", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated."}); + EXPECT_TRUE(compare_err_stream(error_string)); state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); @@ -2509,12 +2528,10 @@ TEST_F(EnergyPlusFixture, VSSeriesPIUStagedHeat) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); - // Init - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules - state->dataScheduleMgr->ScheduleInputProcessed = true; state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataGlobal->HourOfDay = 1; @@ -2524,7 +2541,7 @@ TEST_F(EnergyPlusFixture, VSSeriesPIUStagedHeat) state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -2534,9 +2551,15 @@ TEST_F(EnergyPlusFixture, VSSeriesPIUStagedHeat) state->dataFans->GetFanInputFlag = false; Fans::GetFanInput(*state); PoweredInductionUnits::GetPIUs(*state); - EXPECT_TRUE(compare_err_stream("")); + std::string error_string = delimited_string({" ** Warning ** ProcessScheduleInput: Schedule:Constant = ALWAYSOFF", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = ALWAYSON", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated."}); + EXPECT_TRUE(compare_err_stream(error_string)); state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); @@ -2712,12 +2735,10 @@ TEST_F(EnergyPlusFixture, VSSeriesPIUModulatedHeat) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); - // Init - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules - state->dataScheduleMgr->ScheduleInputProcessed = true; state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataGlobal->HourOfDay = 1; @@ -2727,7 +2748,7 @@ TEST_F(EnergyPlusFixture, VSSeriesPIUModulatedHeat) state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -2737,9 +2758,15 @@ TEST_F(EnergyPlusFixture, VSSeriesPIUModulatedHeat) Fans::GetFanInput(*state); state->dataFans->GetFanInputFlag = false; PoweredInductionUnits::GetPIUs(*state); - EXPECT_TRUE(compare_err_stream("")); + std::string error_string = delimited_string({" ** Warning ** ProcessScheduleInput: Schedule:Constant = ALWAYSOFF", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = ALWAYSON", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated."}); + EXPECT_TRUE(compare_err_stream(error_string)); state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); @@ -2949,12 +2976,10 @@ TEST_F(EnergyPlusFixture, VSSeriesPIUCool) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); - // Init - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules - state->dataScheduleMgr->ScheduleInputProcessed = true; state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataGlobal->HourOfDay = 1; @@ -2964,7 +2989,7 @@ TEST_F(EnergyPlusFixture, VSSeriesPIUCool) state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -2974,9 +2999,15 @@ TEST_F(EnergyPlusFixture, VSSeriesPIUCool) Fans::GetFanInput(*state); state->dataFans->GetFanInputFlag = false; PoweredInductionUnits::GetPIUs(*state); - EXPECT_TRUE(compare_err_stream("")); + std::string error_string = delimited_string({" ** Warning ** ProcessScheduleInput: Schedule:Constant = ALWAYSOFF", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = ALWAYSON", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated."}); + EXPECT_TRUE(compare_err_stream(error_string)); state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); @@ -3044,11 +3075,8 @@ TEST_F(EnergyPlusFixture, PIU_reportTerminalUnit) SetPredefinedTables(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; - auto &sch = state->dataScheduleMgr->Schedule; - sch.allocate(5); - sch(1).Name = "schA"; - sch(2).Name = "schB"; + Sched::AddScheduleConstant(*state, "SCHA"); + Sched::AddScheduleConstant(*state, "SCHB"); auto &adu = state->dataDefineEquipment->AirDistUnit; adu.allocate(2); diff --git a/tst/EnergyPlus/unit/Psychrometrics.unit.cc b/tst/EnergyPlus/unit/Psychrometrics.unit.cc index 2213c9858a0..64390324f3e 100644 --- a/tst/EnergyPlus/unit/Psychrometrics.unit.cc +++ b/tst/EnergyPlus/unit/Psychrometrics.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -51,6 +51,7 @@ // EnergyPlus Headers #include "Fixtures/EnergyPlusFixture.hh" #include +#include #include using namespace EnergyPlus; @@ -58,8 +59,7 @@ using namespace EnergyPlus::Psychrometrics; TEST_F(EnergyPlusFixture, Psychrometrics_PsyTsatFnHPb_Test) { - - InitializePsychRoutines(*state); + state->init_state(*state); // Test 1: TEMP. IS FROM 20 C TO 40 C Real64 H = 7.5223e4 - 1.78637e4; @@ -149,8 +149,7 @@ TEST_F(EnergyPlusFixture, Psychrometrics_PsyTsatFnHPb_Test) TEST_F(EnergyPlusFixture, Psychrometrics_PsyTsatFnPb_Test) { - - InitializePsychRoutines(*state); + state->init_state(*state); // Test 1: general Real64 PB = 101325.0; @@ -274,8 +273,7 @@ inline Real64 PsyCpAirFnWTdb(Real64 const dw, // humidity ratio {kgWater/kgDryAi TEST_F(EnergyPlusFixture, Psychrometrics_PsyCpAirFn_Test) { - - InitializePsychRoutines(*state); + state->init_state(*state); // Test 1: analytical PsyCpAirFnW is independent of temperature Real64 W = 0.0080; @@ -358,8 +356,7 @@ TEST_F(EnergyPlusFixture, Psychrometrics_PsyCpAirFn_Test) TEST_F(EnergyPlusFixture, Psychrometrics_CpAirValue_Test) { - - InitializePsychRoutines(*state); + state->init_state(*state); // Test 1: dry cooling process test, delta enthalpy vs cpair times delta T Real64 W1 = 0.0030; @@ -380,8 +377,8 @@ TEST_F(EnergyPlusFixture, Psychrometrics_CpAirValue_Test) Real64 Qfrom_mdot_CpAir_DeltaT = MassFlowRate * CpAir * (T1 - T2); // get enthalpy at state 1 and 2 - Real64 H1 = PsyHFnTdbW(T1, W1); // enthaly ait state 1 - Real64 H2 = PsyHFnTdbW(T2, W2); // enthaly ait state 2 + Real64 H1 = PsyHFnTdbW(T1, W1); // enthalpy air state 1 + Real64 H2 = PsyHFnTdbW(T2, W2); // enthalpy air state 2 Real64 Qfrom_mdot_DeltaH = MassFlowRate * (H1 - H2); // check heat rate @@ -393,8 +390,8 @@ TEST_F(EnergyPlusFixture, Psychrometrics_CpAirValue_Test) CpAir = 1.00484e3 + W1 * 1.85895e3; Qfrom_mdot_CpAir_DeltaT = MassFlowRate * CpAir * (T2 - T1); - H1 = PsyHFnTdbW(T1, W1); // enthaly ait state 1 - H2 = PsyHFnTdbW(T2, W2); // enthaly ait state 2 + H1 = PsyHFnTdbW(T1, W1); // enthalpy air state 1 + H2 = PsyHFnTdbW(T2, W2); // enthalpy air state 2 Qfrom_mdot_DeltaH = MassFlowRate * (H2 - H1); // check heat transfer rate calc method for heating @@ -403,8 +400,7 @@ TEST_F(EnergyPlusFixture, Psychrometrics_CpAirValue_Test) TEST_F(EnergyPlusFixture, Psychrometrics_PsyTwbFnTdbWPb_Test) { - - InitializePsychRoutines(*state); + state->init_state(*state); // Test when wet bulb temperature is below zero Real64 TDB = 1; // C @@ -417,8 +413,7 @@ TEST_F(EnergyPlusFixture, Psychrometrics_PsyTwbFnTdbWPb_Test) TEST_F(EnergyPlusFixture, Psychrometrics_CpAirAverageValue_Test) { - - InitializePsychRoutines(*state); + state->init_state(*state); // Test 1: heating process, constant humidity ratio Real64 W1 = 0.0030; @@ -451,7 +446,7 @@ TEST_F(EnergyPlusFixture, Psychrometrics_Interpolation_Sample_Test) // Verify sample data for interpolation. // The sample data were extracted from the original psychrometric function PsyTsatFnPb every 64 Pa in the range of 64 Pa to 105,664 Pa. // The sample data for saturated temperature from tsat_fn_pb_tsat were compared to the results from the original psychrometric function. - InitializePsychRoutines(*state); + state->init_state(*state); Real64 tsat_psy; Real64 error = 0.0; int i; @@ -467,7 +462,7 @@ TEST_F(EnergyPlusFixture, Psychrometrics_Interpolation_Sample_Test) TEST_F(EnergyPlusFixture, Psychrometrics_CSpline_Test) { // compare the results of Tsat between CSpline interpolation and original psychrometric function for PsychTsatFnPb - InitializePsychRoutines(*state); + state->init_state(*state); Real64 tsat_psy; Real64 tsat_cspline; Real64 Press_test; @@ -491,7 +486,7 @@ TEST_F(EnergyPlusFixture, Psychrometrics_CSpline_Test) TEST_F(EnergyPlusFixture, Psychrometrics_PsyTwbFnTdbWPb_Test_Discontinuity) { // Test for #8599 - InitializePsychRoutines(*state); + state->init_state(*state); state->dataGlobal->WarmupFlag = true; @@ -506,5 +501,6 @@ TEST_F(EnergyPlusFixture, Psychrometrics_PsyTwbFnTdbWPb_Test_Discontinuity) Real64 expected_result = -0.1027; // expected result from psychrometrics chart EXPECT_NEAR(result, expected_result, 0.001); - EXPECT_FALSE(has_err_output()); + EXPECT_EQ(state->dataErrTracking->TotalSevereErrors, 0); + EXPECT_EQ(state->dataErrTracking->TotalWarningErrors, 1); // IDF version object } diff --git a/tst/EnergyPlus/unit/Pumps.unit.cc b/tst/EnergyPlus/unit/Pumps.unit.cc index 566d28741d3..4c23538e7f2 100644 --- a/tst/EnergyPlus/unit/Pumps.unit.cc +++ b/tst/EnergyPlus/unit/Pumps.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -90,6 +90,7 @@ TEST_F(EnergyPlusFixture, HeaderedVariableSpeedPumpSizingPowerTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Pumps::GetPumpInput(*state); Pumps::SizePump(*state, 1); EXPECT_NEAR(state->dataPumps->PumpEquip(1).NomPowerUse, 162.5, 0.0001); @@ -125,6 +126,7 @@ TEST_F(EnergyPlusFixture, HeaderedVariableSpeedPumpSizingPower22W_per_gpm) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Pumps::GetPumpInput(*state); Pumps::SizePump(*state, 1); EXPECT_NEAR(state->dataPumps->PumpEquip(1).NomPowerUse, 348.7011, 0.0001); @@ -159,6 +161,7 @@ TEST_F(EnergyPlusFixture, HeaderedVariableSpeedPumpSizingPowerDefault) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Pumps::GetPumpInput(*state); Pumps::SizePump(*state, 1); EXPECT_NEAR(state->dataPumps->PumpEquip(1).NomPowerUse, 255.4872, 0.0001); @@ -189,6 +192,7 @@ TEST_F(EnergyPlusFixture, HeaderedConstantSpeedPumpSizingPowerTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Pumps::GetPumpInput(*state); Pumps::SizePump(*state, 1); EXPECT_NEAR(state->dataPumps->PumpEquip(1).NomPowerUse, 162.5, 0.0001); @@ -219,6 +223,7 @@ TEST_F(EnergyPlusFixture, HeaderedConstantSpeedPumpSizingPower19W_per_gpm) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Pumps::GetPumpInput(*state); Pumps::SizePump(*state, 1); EXPECT_NEAR(state->dataPumps->PumpEquip(1).NomPowerUse, 301.1561, 0.0001); @@ -248,6 +253,7 @@ TEST_F(EnergyPlusFixture, HeaderedConstantSpeedPumpSizingPowerDefault) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Pumps::GetPumpInput(*state); Pumps::SizePump(*state, 1); EXPECT_NEAR(state->dataPumps->PumpEquip(1).NomPowerUse, 255.4872, 0.0001); @@ -291,6 +297,7 @@ TEST_F(EnergyPlusFixture, VariableSpeedPumpSizingMinVolFlowRate) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Pumps::GetPumpInput(*state); EXPECT_NEAR(state->dataPumps->PumpEquip(1).MinVolFlowRate, DataSizing::AutoSize, 0.000001); Pumps::SizePump(*state, 1); @@ -335,6 +342,7 @@ TEST_F(EnergyPlusFixture, VariableSpeedPumpSizingPowerPerPressureTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Pumps::GetPumpInput(*state); Pumps::SizePump(*state, 1); EXPECT_NEAR(state->dataPumps->PumpEquip(1).NomPowerUse, 162.5, 0.0001); @@ -376,6 +384,7 @@ TEST_F(EnergyPlusFixture, VariableSpeedPumpSizingPowerDefault) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Pumps::GetPumpInput(*state); Pumps::SizePump(*state, 1); EXPECT_NEAR(state->dataPumps->PumpEquip(1).NomPowerUse, 255.4872, 0.0001); @@ -416,6 +425,7 @@ TEST_F(EnergyPlusFixture, VariableSpeedPumpSizingPower22W_per_GPM) "0.0; !- Design Minimum Flow Rate Sizing Factor", }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Pumps::GetPumpInput(*state); Pumps::SizePump(*state, 1); EXPECT_NEAR(state->dataPumps->PumpEquip(1).NomPowerUse, 348.7011, 0.0001); @@ -447,6 +457,7 @@ TEST_F(EnergyPlusFixture, ConstantSpeedPumpSizingPower19W_per_gpm) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Pumps::GetPumpInput(*state); Pumps::SizePump(*state, 1); EXPECT_NEAR(state->dataPumps->PumpEquip(1).NomPowerUse, 301.1561, 0.0001); @@ -479,6 +490,7 @@ TEST_F(EnergyPlusFixture, ConstantSpeedPumpSizingPowerPerPressureTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Pumps::GetPumpInput(*state); Pumps::SizePump(*state, 1); EXPECT_NEAR(state->dataPumps->PumpEquip(1).NomPowerUse, 162.5, 0.0001); @@ -510,6 +522,7 @@ TEST_F(EnergyPlusFixture, ConstantSpeedPumpSizingPowerDefaults) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Pumps::GetPumpInput(*state); Pumps::SizePump(*state, 1); EXPECT_NEAR(state->dataPumps->PumpEquip(1).NomPowerUse, 255.4872, 0.0001); @@ -542,6 +555,7 @@ TEST_F(EnergyPlusFixture, CondensatePumpSizingPowerDefaults) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Pumps::GetPumpInput(*state); Pumps::SizePump(*state, 1); EXPECT_NEAR(state->dataPumps->PumpEquip(1).NomPowerUse, 153.3, 0.1); @@ -574,6 +588,7 @@ TEST_F(EnergyPlusFixture, CondensatePumpSizingPower19W_per_gpm) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Pumps::GetPumpInput(*state); Pumps::SizePump(*state, 1); EXPECT_NEAR(state->dataPumps->PumpEquip(1).NomPowerUse, 180.7, 0.1); @@ -605,6 +620,7 @@ TEST_F(EnergyPlusFixture, CondensatePumpSizingPowerTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Pumps::GetPumpInput(*state); Pumps::SizePump(*state, 1); EXPECT_NEAR(state->dataPumps->PumpEquip(1).NomPowerUse, 97.5, 0.1); @@ -647,6 +663,7 @@ TEST_F(EnergyPlusFixture, VariableSpeedPump_MinFlowGreaterThanMax) " ; !- Design Minimum Flow Rate Fraction", }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Pumps::GetPumpInput(*state); std::string const error_string = delimited_string({ @@ -698,6 +715,7 @@ TEST_F(EnergyPlusFixture, VariableSpeedPump_MinFlowEqualToMax) " ; !- Design Minimum Flow Rate Fraction", }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Pumps::GetPumpInput(*state); std::string const error_string = delimited_string({ @@ -746,6 +764,7 @@ TEST_F(EnergyPlusFixture, HeaderedVariableSpeedPumpEMSPressureTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Pumps::GetPumpInput(*state); Pumps::SizePump(*state, 1); Real64 massflowrate = 1.0; @@ -760,6 +779,8 @@ TEST_F(EnergyPlusFixture, HeaderedVariableSpeedPumpEMSPressureTest) DataPlant::LoopSideLocation thisLoopSideNum = DataPlant::LoopSideLocation::Supply; PlantLocation plantLoc{thisLoopNum, thisLoopSideNum, thisBranchNum, thisCompNum}; state->dataPlnt->PlantLoop.allocate(1); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(thisLoopSideNum).Branch.allocate(1); state->dataPlnt->PlantLoop(1).LoopSide(thisLoopSideNum).Branch(thisBranchNum).Comp.allocate(1); state->dataLoopNodes->Node(1).MassFlowRate = massflowrate; diff --git a/tst/EnergyPlus/unit/PurchasedAirManager.unit.cc b/tst/EnergyPlus/unit/PurchasedAirManager.unit.cc index 8ddad9c43a3..84574e34527 100644 --- a/tst/EnergyPlus/unit/PurchasedAirManager.unit.cc +++ b/tst/EnergyPlus/unit/PurchasedAirManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -99,10 +99,9 @@ class ZoneIdealLoadsTest : public EnergyPlusFixture { EnergyPlusFixture::SetUp(); // Sets up the base fixture first. - state->dataHeatBalFanSys->ZoneThermostatSetPointHi.allocate(1); - state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1) = 23.9; // 75F - state->dataHeatBalFanSys->ZoneThermostatSetPointLo.allocate(1); - state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1) = 23.0; // 73.4F + state->dataHeatBalFanSys->zoneTstatSetpts.allocate(1); + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi = 23.9; // 75F + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo = 23.0; // 73.4F state->dataSize->FinalZoneSizing.allocate(1); state->dataSize->ZoneEqSizing.allocate(1); @@ -125,7 +124,7 @@ class ZoneIdealLoadsTest : public EnergyPlusFixture state->dataHeatBal->RefrigCaseCredit.allocate(1); state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::SingleHeating; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::SingleHeat; state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); state->dataZoneEnergyDemand->DeadBandOrSetback.allocate(1); state->dataZoneEnergyDemand->DeadBandOrSetback(1) = false; @@ -287,6 +286,7 @@ TEST_F(EnergyPlusFixture, IdealLoadsAirSystem_GetInput) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataGlobal->DoWeathSim = true; @@ -388,6 +388,7 @@ TEST_F(ZoneIdealLoadsTest, IdealLoads_PlenumTest) }); ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); state->dataGlobal->DoWeathSim = true; @@ -396,7 +397,6 @@ TEST_F(ZoneIdealLoadsTest, IdealLoads_PlenumTest) state->dataHeatBal->space(1).HTSurfaceFirst = 1; state->dataHeatBal->space(1).HTSurfaceLast = 1; - state->dataScheduleMgr->Schedule.allocate(1); state->dataEnvrn->StdRhoAir = 1.0; // Prevent divide by zero AllocateHeatBalArrays(*state); @@ -502,6 +502,7 @@ TEST_F(ZoneIdealLoadsTest, IdealLoads_ExhaustNodeTest) }); ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); state->dataGlobal->DoWeathSim = true; @@ -510,7 +511,6 @@ TEST_F(ZoneIdealLoadsTest, IdealLoads_ExhaustNodeTest) state->dataHeatBal->space(1).HTSurfaceFirst = 1; state->dataHeatBal->space(1).HTSurfaceLast = 1; - state->dataScheduleMgr->Schedule.allocate(1); state->dataEnvrn->StdRhoAir = 1.0; // Prevent divide by zero AllocateHeatBalArrays(*state); EXPECT_FALSE(ErrorsFound); // expect no errors @@ -627,6 +627,7 @@ TEST_F(ZoneIdealLoadsTest, IdealLoads_IntermediateOutputVarsTest) }); ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); state->dataGlobal->DoWeathSim = true; @@ -634,7 +635,6 @@ TEST_F(ZoneIdealLoadsTest, IdealLoads_IntermediateOutputVarsTest) GetZoneData(*state, ErrorsFound); state->dataHeatBal->space(1).HTSurfaceFirst = 1; state->dataHeatBal->space(1).HTSurfaceLast = 1; - state->dataScheduleMgr->Schedule.allocate(1); state->dataEnvrn->StdRhoAir = 1.0; // Prevent divide by zero AllocateHeatBalArrays(*state); EXPECT_FALSE(ErrorsFound); // expect no errors @@ -799,6 +799,7 @@ TEST_F(ZoneIdealLoadsTest, IdealLoads_EMSOverrideTest) }); ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); state->dataGlobal->DoWeathSim = true; @@ -806,7 +807,6 @@ TEST_F(ZoneIdealLoadsTest, IdealLoads_EMSOverrideTest) GetZoneData(*state, ErrorsFound); state->dataHeatBal->space(1).HTSurfaceFirst = 1; state->dataHeatBal->space(1).HTSurfaceLast = 1; - state->dataScheduleMgr->Schedule.allocate(1); state->dataEnvrn->StdRhoAir = 1.0; // Prevent divide by zero AllocateHeatBalArrays(*state); EXPECT_FALSE(ErrorsFound); // expect no errors @@ -908,6 +908,7 @@ TEST_F(ZoneIdealLoadsTest, IdealLoads_NoCapacityTest) }); ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); state->dataGlobal->DoWeathSim = true; @@ -915,7 +916,6 @@ TEST_F(ZoneIdealLoadsTest, IdealLoads_NoCapacityTest) GetZoneData(*state, ErrorsFound); state->dataHeatBal->space(1).HTSurfaceFirst = 1; state->dataHeatBal->space(1).HTSurfaceLast = 1; - state->dataScheduleMgr->Schedule.allocate(1); state->dataEnvrn->StdRhoAir = 1.0; // Prevent divide by zero AllocateHeatBalArrays(*state); EXPECT_FALSE(ErrorsFound); // expect no errors @@ -1057,6 +1057,7 @@ TEST_F(ZoneIdealLoadsTest, IdealLoads_EMSOverrideTest_Revised) }); ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); state->dataGlobal->DoWeathSim = true; @@ -1064,7 +1065,6 @@ TEST_F(ZoneIdealLoadsTest, IdealLoads_EMSOverrideTest_Revised) GetZoneData(*state, ErrorsFound); state->dataHeatBal->space(1).HTSurfaceFirst = 1; state->dataHeatBal->space(1).HTSurfaceLast = 1; - state->dataScheduleMgr->Schedule.allocate(1); state->dataEnvrn->StdRhoAir = 1.0; // Prevent divide by zero AllocateHeatBalArrays(*state); EXPECT_FALSE(ErrorsFound); // expect no errors @@ -1229,6 +1229,7 @@ TEST_F(ZoneIdealLoadsTest, IdealLoads_EMSOverrideTest_Revised_ZeroFlow) }); ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); state->dataGlobal->DoWeathSim = true; @@ -1236,7 +1237,6 @@ TEST_F(ZoneIdealLoadsTest, IdealLoads_EMSOverrideTest_Revised_ZeroFlow) GetZoneData(*state, ErrorsFound); state->dataHeatBal->space(1).HTSurfaceFirst = 1; state->dataHeatBal->space(1).HTSurfaceLast = 1; - state->dataScheduleMgr->Schedule.allocate(1); AllocateHeatBalArrays(*state); EXPECT_FALSE(ErrorsFound); // expect no errors state->dataZoneEquip->ZoneEquipConfig.allocate(1); @@ -1403,12 +1403,12 @@ TEST_F(ZoneIdealLoadsTest, IdealLoads_Fix_SA_HumRat_Test) }); ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); state->dataGlobal->DoWeathSim = true; bool ErrorsFound = false; GetZoneData(*state, ErrorsFound); - state->dataScheduleMgr->Schedule.allocate(1); AllocateHeatBalArrays(*state); EXPECT_FALSE(ErrorsFound); // expect no errors state->dataZoneEquip->ZoneEquipConfig.allocate(1); @@ -1453,7 +1453,7 @@ TEST_F(ZoneIdealLoadsTest, IdealLoads_Fix_SA_HumRat_Test) int ControlledZoneNum = 1; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlledZoneNum).RemainingOutputReqToCoolSP = -1000.0; state->dataZoneEnergyDemand->ZoneSysMoistureDemand(ControlledZoneNum).RemainingOutputReqToDehumidSP = -0.0002; - state->dataHeatBalFanSys->TempControlType(ControlledZoneNum) = HVAC::ThermostatType::SingleCooling; + state->dataHeatBalFanSys->TempControlType(ControlledZoneNum) = HVAC::SetptType::SingleCool; state->dataLoopNodes->Node(1).Temp = 30; state->dataLoopNodes->Node(1).HumRat = 0.012; diff --git a/tst/EnergyPlus/unit/RefrigeratedCase.unit.cc b/tst/EnergyPlus/unit/RefrigeratedCase.unit.cc index ae91acad1de..ae4fe0ac7b6 100644 --- a/tst/EnergyPlus/unit/RefrigeratedCase.unit.cc +++ b/tst/EnergyPlus/unit/RefrigeratedCase.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -384,6 +384,7 @@ Schedule:Compact, )IDF"; ASSERT_TRUE(process_idf(fmt::format("{}\n{}", oneZoneBuildingWithIdealLoads, idf_objects))); // read idf objects + state->init_state(*state); state->dataZoneEquip->ZoneEquipInputsFilled = true; state->dataEnvrn->OutBaroPress = 101325.0; @@ -391,7 +392,7 @@ Schedule:Compact, HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); DataZoneEquipment::GetZoneEquipmentData(*state); - ScheduleManager::ProcessScheduleInput(*state); + // ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); InternalHeatGains::ManageInternalHeatGains(*state, true); RefrigeratedCase::ManageRefrigeratedCaseRacks(*state); @@ -479,6 +480,7 @@ Refrigeration:WalkIn, )IDF"; ASSERT_TRUE(process_idf(fmt::format("{}\n{}", oneZoneBuildingWithIdealLoads, idf_objects))); // read idf objects + state->init_state(*state); state->dataZoneEquip->ZoneEquipInputsFilled = true; state->dataEnvrn->OutBaroPress = 101325.0; @@ -486,7 +488,6 @@ Refrigeration:WalkIn, HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); DataZoneEquipment::GetZoneEquipmentData(*state); - ScheduleManager::ProcessScheduleInput(*state); // ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); InternalHeatGains::ManageInternalHeatGains(*state, true); RefrigeratedCase::ManageRefrigeratedCaseRacks(*state); @@ -577,6 +578,7 @@ Refrigeration:WalkIn, )IDF"; ASSERT_TRUE(process_idf(fmt::format("{}\n{}", oneZoneBuildingWithIdealLoads, idf_objects))); // read idf objects + state->init_state(*state); state->dataZoneEquip->ZoneEquipInputsFilled = true; state->dataEnvrn->OutBaroPress = 101325.0; @@ -584,7 +586,6 @@ Refrigeration:WalkIn, HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); DataZoneEquipment::GetZoneEquipmentData(*state); - ScheduleManager::ProcessScheduleInput(*state); // ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); InternalHeatGains::ManageInternalHeatGains(*state, true); RefrigeratedCase::ManageRefrigeratedCaseRacks(*state); @@ -735,6 +736,7 @@ Schedule:Compact, )IDF"; ASSERT_TRUE(process_idf(fmt::format("{}\n{}", oneZoneBuildingWithIdealLoads, idf_objects))); // read idf objects + state->init_state(*state); state->dataZoneEquip->ZoneEquipInputsFilled = true; state->dataEnvrn->OutBaroPress = 101325.0; @@ -742,7 +744,6 @@ Schedule:Compact, HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); DataZoneEquipment::GetZoneEquipmentData(*state); - ScheduleManager::ProcessScheduleInput(*state); // ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); InternalHeatGains::ManageInternalHeatGains(*state, true); RefrigeratedCase::ManageRefrigeratedCaseRacks(*state); diff --git a/tst/EnergyPlus/unit/ReportCoilSelection.unit.cc b/tst/EnergyPlus/unit/ReportCoilSelection.unit.cc index c2eed107684..538a3585328 100644 --- a/tst/EnergyPlus/unit/ReportCoilSelection.unit.cc +++ b/tst/EnergyPlus/unit/ReportCoilSelection.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -80,7 +80,7 @@ TEST_F(EnergyPlusFixture, ReportCoilSelection_ChWCoil) state->dataPlnt->PlantLoop.allocate(1); state->dataPlnt->PlantLoop(1).Name = "Chilled Water Loop"; state->dataPlnt->PlantLoop(1).FluidName = "Water"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).MaxMassFlowRate = 0.1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); @@ -235,7 +235,9 @@ TEST_F(EnergyPlusFixture, ReportCoilSelection_SteamCoil) state->dataPlnt->PlantLoop.allocate(1); state->dataPlnt->PlantLoop(1).Name = "Steam Loop"; state->dataPlnt->PlantLoop(1).FluidName = "Steam"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).steam = Fluid::GetSteam(*state); + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); + state->dataPlnt->PlantLoop(1).MaxMassFlowRate = 0.1; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); diff --git a/tst/EnergyPlus/unit/ResultsFramework.unit.cc b/tst/EnergyPlus/unit/ResultsFramework.unit.cc index 24f871ab160..c608352ac18 100644 --- a/tst/EnergyPlus/unit/ResultsFramework.unit.cc +++ b/tst/EnergyPlus/unit/ResultsFramework.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/RoomAirModelUserTempPattern.unit.cc b/tst/EnergyPlus/unit/RoomAirModelUserTempPattern.unit.cc index 1c78fb317de..1b6f48d0656 100644 --- a/tst/EnergyPlus/unit/RoomAirModelUserTempPattern.unit.cc +++ b/tst/EnergyPlus/unit/RoomAirModelUserTempPattern.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc index 7522f82eb6a..995f2dab4b1 100644 --- a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc +++ b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -169,7 +169,7 @@ TEST_F(RoomAirflowNetworkTest, RAFNTest) int ZoneNum = 1; int RoomAirNode; state->dataHVACGlobal->TimeStepSys = 15.0 / 60.0; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->dataEnvrn->OutBaroPress = 101325.0; state->dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpSens = 1; @@ -554,10 +554,11 @@ TEST_F(EnergyPlusFixture, RoomAirInternalGains_InternalHeatGains_Check) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + ErrorsFound = false; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ScheduleManager::ProcessScheduleInput(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -574,8 +575,8 @@ TEST_F(EnergyPlusFixture, RoomAirInternalGains_InternalHeatGains_Check) ErrorsFound = false; state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; SurfaceGeometry::GetSurfaceData(*state, ErrorsFound); @@ -591,7 +592,13 @@ TEST_F(EnergyPlusFixture, RoomAirInternalGains_InternalHeatGains_Check) EXPECT_TRUE(ErrorsFound); std::string const error_string = - delimited_string({" ** Severe ** GetRoomAirflowNetworkData: Invalid Internal Gain Object Name = LIVING_UNIT1 PEOPLE", + delimited_string({" ** Warning ** ProcessScheduleInput: Schedule:Constant = SCH_ACT", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = SCH", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Severe ** GetRoomAirflowNetworkData: Invalid Internal Gain Object Name = LIVING_UNIT1 PEOPLE", " ** ~~~ ** Entered in RoomAir:Node:AirflowNetwork:InternalGains = NODE1_GAIN", " ** ~~~ ** Internal gain did not match correctly", " ** Severe ** GetRoomAirflowNetworkData: Invalid Internal Gain Object Name = LIVING_UNIT1 LIGHTS", diff --git a/tst/EnergyPlus/unit/RootFinder.unit.cc b/tst/EnergyPlus/unit/RootFinder.unit.cc index 4b4ef143819..e65e4d42b69 100644 --- a/tst/EnergyPlus/unit/RootFinder.unit.cc +++ b/tst/EnergyPlus/unit/RootFinder.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/RunPeriod.unit.cc b/tst/EnergyPlus/unit/RunPeriod.unit.cc index 83bd60ad4ed..e6f634c07e9 100644 --- a/tst/EnergyPlus/unit/RunPeriod.unit.cc +++ b/tst/EnergyPlus/unit/RunPeriod.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -65,12 +65,11 @@ #include using namespace EnergyPlus; -using namespace EnergyPlus::ScheduleManager; TEST_F(EnergyPlusFixture, RunPeriod_Defaults) { Weather::RunPeriodData runperiod; - EXPECT_ENUM_EQ(ScheduleManager::DayType::Sunday, runperiod.startWeekDay); + EXPECT_ENUM_EQ(Sched::DayType::Sunday, runperiod.startWeekDay); EXPECT_EQ(1, runperiod.startMonth); EXPECT_EQ(1, runperiod.startDay); @@ -201,22 +200,22 @@ TEST_F(EnergyPlusFixture, RunPeriod_YearTests) Weather::GetRunPeriodData(*state, totalrps, errors_in_input); EXPECT_FALSE(errors_in_input); - EXPECT_ENUM_EQ(ScheduleManager::DayType::Monday, state->dataWeather->RunPeriodInput[0].startWeekDay); + EXPECT_ENUM_EQ(Sched::DayType::Monday, state->dataWeather->RunPeriodInput[0].startWeekDay); EXPECT_EQ(2016, state->dataWeather->RunPeriodInput[0].startYear); EXPECT_EQ(2457448, state->dataWeather->RunPeriodInput[0].startJulianDate); EXPECT_EQ(2457451, state->dataWeather->RunPeriodInput[0].endJulianDate); - EXPECT_ENUM_EQ(ScheduleManager::DayType::Wednesday, state->dataWeather->RunPeriodInput[1].startWeekDay); + EXPECT_ENUM_EQ(Sched::DayType::Wednesday, state->dataWeather->RunPeriodInput[1].startWeekDay); EXPECT_EQ(2012, state->dataWeather->RunPeriodInput[1].startYear); EXPECT_EQ(2455987, state->dataWeather->RunPeriodInput[1].startJulianDate); EXPECT_EQ(2455990, state->dataWeather->RunPeriodInput[1].endJulianDate); - EXPECT_ENUM_EQ(ScheduleManager::DayType::Thursday, state->dataWeather->RunPeriodInput[2].startWeekDay); + EXPECT_ENUM_EQ(Sched::DayType::Thursday, state->dataWeather->RunPeriodInput[2].startWeekDay); EXPECT_EQ(2015, state->dataWeather->RunPeriodInput[2].startYear); EXPECT_EQ(2457024, state->dataWeather->RunPeriodInput[2].startJulianDate); EXPECT_EQ(2457388, state->dataWeather->RunPeriodInput[2].endJulianDate); - EXPECT_ENUM_EQ(ScheduleManager::DayType::Sunday, state->dataWeather->RunPeriodInput[3].startWeekDay); + EXPECT_ENUM_EQ(Sched::DayType::Sunday, state->dataWeather->RunPeriodInput[3].startWeekDay); EXPECT_EQ(2017, state->dataWeather->RunPeriodInput[3].startYear); EXPECT_EQ(2457755, state->dataWeather->RunPeriodInput[3].startJulianDate); EXPECT_EQ(2458119, state->dataWeather->RunPeriodInput[3].endJulianDate); @@ -226,17 +225,17 @@ TEST_F(EnergyPlusFixture, RunPeriod_YearTests) EXPECT_EQ(startDays[i], state->dataWeather->RunPeriodInput[3].monWeekDay[i]); } - EXPECT_ENUM_EQ(ScheduleManager::DayType::Wednesday, state->dataWeather->RunPeriodInput[4].startWeekDay); + EXPECT_ENUM_EQ(Sched::DayType::Wednesday, state->dataWeather->RunPeriodInput[4].startWeekDay); EXPECT_EQ(2010, state->dataWeather->RunPeriodInput[4].startYear); EXPECT_EQ(2455427, state->dataWeather->RunPeriodInput[4].startJulianDate); EXPECT_EQ(2455562, state->dataWeather->RunPeriodInput[4].endJulianDate); - EXPECT_ENUM_EQ(ScheduleManager::DayType::Saturday, state->dataWeather->RunPeriodInput[5].startWeekDay); + EXPECT_ENUM_EQ(Sched::DayType::Saturday, state->dataWeather->RunPeriodInput[5].startWeekDay); EXPECT_EQ(1992, state->dataWeather->RunPeriodInput[5].startYear); EXPECT_EQ(2448682, state->dataWeather->RunPeriodInput[5].startJulianDate); EXPECT_EQ(2448988, state->dataWeather->RunPeriodInput[5].endJulianDate); - EXPECT_ENUM_EQ(ScheduleManager::DayType::Friday, state->dataWeather->RunPeriodInput[6].startWeekDay); + EXPECT_ENUM_EQ(Sched::DayType::Friday, state->dataWeather->RunPeriodInput[6].startWeekDay); EXPECT_EQ(2016, state->dataWeather->RunPeriodInput[6].startYear); EXPECT_EQ(2457389, state->dataWeather->RunPeriodInput[6].startJulianDate); EXPECT_EQ(2458940, state->dataWeather->RunPeriodInput[6].endJulianDate); diff --git a/tst/EnergyPlus/unit/RuntimeLanguageProcessor.unit.cc b/tst/EnergyPlus/unit/RuntimeLanguageProcessor.unit.cc index df04cd5fd5b..82777cfa0c9 100644 --- a/tst/EnergyPlus/unit/RuntimeLanguageProcessor.unit.cc +++ b/tst/EnergyPlus/unit/RuntimeLanguageProcessor.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/SQLite.unit.cc b/tst/EnergyPlus/unit/SQLite.unit.cc index aba5b3a41a2..9686709b43b 100644 --- a/tst/EnergyPlus/unit/SQLite.unit.cc +++ b/tst/EnergyPlus/unit/SQLite.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -628,7 +628,9 @@ TEST_F(SQLiteFixture, SQLiteProcedures_DaylightMaping) TEST_F(SQLiteFixture, SQLiteProcedures_createZoneExtendedOutput) { - auto const &zoneData0 = std::make_unique(); + state->init_state(*state); + + auto const &zoneData0 = std::make_unique(); // Why make_unique here? And why is this a reference? zoneData0->Name = "test zone 1"; zoneData0->CeilingHeight = 1; zoneData0->Volume = 1; @@ -738,10 +740,12 @@ TEST_F(SQLiteFixture, SQLiteProcedures_createZoneExtendedOutput) auto const lightingData0 = std::make_unique(); lightingData0->Name = "test lighting 1"; + lightingData0->sched = Sched::GetScheduleAlwaysOff(*state); + auto const lightingData1 = std::make_unique(); lightingData1->Name = "test lighting 2"; lightingData1->ZonePtr = 1; - lightingData1->SchedPtr = 1; + lightingData1->sched = Sched::AddScheduleConstant(*state, "SCHED-1"); lightingData1->DesignLevel = 2; lightingData1->FractionReturnAir = 2; lightingData1->FractionRadiant = 2; @@ -752,17 +756,23 @@ TEST_F(SQLiteFixture, SQLiteProcedures_createZoneExtendedOutput) auto const peopleData0 = std::make_unique(); peopleData0->Name = "test people 1"; + peopleData0->sched = Sched::GetScheduleAlwaysOff(*state); + peopleData0->activityLevelSched = Sched::GetScheduleAlwaysOff(*state); + peopleData0->workEffSched = Sched::GetScheduleAlwaysOff(*state); + peopleData0->clothingSched = Sched::GetScheduleAlwaysOff(*state); + peopleData0->airVelocitySched = Sched::GetScheduleAlwaysOff(*state); + auto const peopleData1 = std::make_unique(); peopleData1->Name = "test people 2"; peopleData1->ZonePtr = 1; peopleData1->NumberOfPeople = 2; - peopleData1->NumberOfPeoplePtr = 1; - peopleData1->ActivityLevelPtr = 1; + peopleData1->sched = Sched::GetSchedule(*state, "SCHED-1"); + peopleData1->activityLevelSched = Sched::GetSchedule(*state, "SCHED-1"); peopleData1->FractionRadiant = 2; peopleData1->FractionConvected = 2; - peopleData1->WorkEffPtr = 1; - peopleData1->ClothingPtr = 1; - peopleData1->AirVelocityPtr = 1; + peopleData1->workEffSched = Sched::GetSchedule(*state, "SCHED-1"); + peopleData1->clothingSched = Sched::GetSchedule(*state, "SCHED-1"); + peopleData1->airVelocitySched = Sched::GetSchedule(*state, "SCHED-1"); peopleData1->Fanger = true; peopleData1->Pierce = true; peopleData1->KSU = true; @@ -775,10 +785,12 @@ TEST_F(SQLiteFixture, SQLiteProcedures_createZoneExtendedOutput) auto const elecEquipData0 = std::make_unique(); elecEquipData0->Name = "test elecEquip 1"; + elecEquipData0->sched = Sched::GetScheduleAlwaysOff(*state); + auto const elecEquipData1 = std::make_unique(); elecEquipData1->Name = "test elecEquip 2"; elecEquipData1->ZonePtr = 1; - elecEquipData1->SchedPtr = 1; + elecEquipData1->sched = Sched::GetSchedule(*state, "SCHED-1"); elecEquipData1->DesignLevel = 2; elecEquipData1->FractionLatent = 2; elecEquipData1->FractionRadiant = 2; @@ -788,10 +800,11 @@ TEST_F(SQLiteFixture, SQLiteProcedures_createZoneExtendedOutput) auto const gasEquipData0 = std::make_unique(); gasEquipData0->Name = "test gasEquip 1"; + gasEquipData0->sched = Sched::GetScheduleAlwaysOff(*state); auto const gasEquipData1 = std::make_unique(); gasEquipData1->Name = "test gasEquip 2"; gasEquipData1->ZonePtr = 1; - gasEquipData1->SchedPtr = 1; + gasEquipData1->sched = Sched::GetSchedule(*state, "SCHED-1"); gasEquipData1->DesignLevel = 2; gasEquipData1->FractionLatent = 2; gasEquipData1->FractionRadiant = 2; @@ -801,10 +814,11 @@ TEST_F(SQLiteFixture, SQLiteProcedures_createZoneExtendedOutput) auto const steamEquipData0 = std::make_unique(); steamEquipData0->Name = "test steamEquip 1"; + steamEquipData0->sched = Sched::GetScheduleAlwaysOff(*state); auto const steamEquipData1 = std::make_unique(); steamEquipData1->Name = "test steamEquip 2"; steamEquipData1->ZonePtr = 1; - steamEquipData1->SchedPtr = 1; + steamEquipData1->sched = Sched::GetSchedule(*state, "SCHED-1"); steamEquipData1->DesignLevel = 2; steamEquipData1->FractionLatent = 2; steamEquipData1->FractionRadiant = 2; @@ -814,10 +828,11 @@ TEST_F(SQLiteFixture, SQLiteProcedures_createZoneExtendedOutput) auto const hwEquipData0 = std::make_unique(); hwEquipData0->Name = "test hwEquip 1"; + hwEquipData0->sched = Sched::GetScheduleAlwaysOff(*state); auto const hwEquipData1 = std::make_unique(); hwEquipData1->Name = "test hwEquip 2"; hwEquipData1->ZonePtr = 1; - hwEquipData1->SchedPtr = 1; + hwEquipData1->sched = Sched::GetSchedule(*state, "SCHED-1"); hwEquipData1->DesignLevel = 2; hwEquipData1->FractionLatent = 2; hwEquipData1->FractionRadiant = 2; @@ -827,10 +842,11 @@ TEST_F(SQLiteFixture, SQLiteProcedures_createZoneExtendedOutput) auto const otherEquipData0 = std::make_unique(); otherEquipData0->Name = "test otherEquip 1"; + otherEquipData0->sched = Sched::GetScheduleAlwaysOff(*state); auto const otherEquipData1 = std::make_unique(); otherEquipData1->Name = "test otherEquip 2"; otherEquipData1->ZonePtr = 1; - otherEquipData1->SchedPtr = 1; + otherEquipData1->sched = Sched::GetSchedule(*state, "SCHED-1"); otherEquipData1->DesignLevel = 2; otherEquipData1->FractionLatent = 2; otherEquipData1->FractionRadiant = 2; @@ -840,10 +856,11 @@ TEST_F(SQLiteFixture, SQLiteProcedures_createZoneExtendedOutput) auto const baseboardData0 = std::make_unique(); baseboardData0->Name = "test baseboard 1"; + baseboardData0->sched = Sched::GetScheduleAlwaysOff(*state); auto const baseboardData1 = std::make_unique(); baseboardData1->Name = "test baseboard 2"; baseboardData1->ZonePtr = 1; - baseboardData1->SchedPtr = 1; + baseboardData1->sched = Sched::GetSchedule(*state, "SCHED-1"); baseboardData1->CapatLowTemperature = 2; baseboardData1->LowTemperature = 2; baseboardData1->CapatHighTemperature = 2; @@ -854,18 +871,20 @@ TEST_F(SQLiteFixture, SQLiteProcedures_createZoneExtendedOutput) auto const infiltrationData0 = std::make_unique(); infiltrationData0->Name = "test infiltration 1"; + infiltrationData0->sched = Sched::GetScheduleAlwaysOff(*state); auto const infiltrationData1 = std::make_unique(); infiltrationData1->Name = "test infiltration 2"; infiltrationData1->ZonePtr = 1; - infiltrationData1->SchedPtr = 1; + infiltrationData1->sched = Sched::GetSchedule(*state, "SCHED-1"); infiltrationData1->DesignLevel = 2; auto const ventilationData0 = std::make_unique(); ventilationData0->Name = "test ventilation 1"; + ventilationData0->availSched = Sched::GetScheduleAlwaysOff(*state); auto const ventilationData1 = std::make_unique(); ventilationData1->Name = "test ventilation 2"; ventilationData1->ZonePtr = 1; - ventilationData1->SchedPtr = 1; + ventilationData1->availSched = Sched::GetSchedule(*state, "SCHED-1"); ventilationData1->DesignLevel = 2; auto const roomAirModelData0 = std::make_unique(); @@ -1009,62 +1028,62 @@ TEST_F(SQLiteFixture, SQLiteProcedures_createZoneExtendedOutput) ASSERT_EQ(2ul, lightings.size()); std::vector lighting0{"1", "test lighting 1", "", "", "0.0", "0.0", "0.0", "0.0", "0.0", "0.0", ""}; - std::vector lighting1{"2", "test lighting 2", "1", "1", "2.0", "2.0", "2.0", "2.0", "2.0", "2.0", "test"}; + std::vector lighting1{"2", "test lighting 2", "1", "2", "2.0", "2.0", "2.0", "2.0", "2.0", "2.0", "test"}; EXPECT_EQ(lighting0, lightings[0]); EXPECT_EQ(lighting1, lightings[1]); ASSERT_EQ(2ul, peoples.size()); std::vector people0{"1", "test people 1", "", "0", "", "", "0.0", "0.0", "", "", "", "0", "0", "0", "-1", "", "", "-1", "0.0", "0"}; - std::vector people1{"2", "test people 2", "1", "2", "1", "1", "2.0", "2.0", "1", "1", "1", "1", "1", "1", "1", + std::vector people1{"2", "test people 2", "1", "2", "2", "2", "2.0", "2.0", "2", "2", "2", "1", "1", "1", "1", "1", "test", "1", "2.0", "1"}; EXPECT_EQ(people0, peoples[0]); EXPECT_EQ(people1, peoples[1]); ASSERT_EQ(2ul, elecEquips.size()); std::vector elecEquip0{"1", "test elecEquip 1", "", "", "0.0", "0.0", "0.0", "0.0", "0.0", ""}; - std::vector elecEquip1{"2", "test elecEquip 2", "1", "1", "2.0", "2.0", "2.0", "2.0", "2.0", "test"}; + std::vector elecEquip1{"2", "test elecEquip 2", "1", "2", "2.0", "2.0", "2.0", "2.0", "2.0", "test"}; EXPECT_EQ(elecEquip0, elecEquips[0]); EXPECT_EQ(elecEquip1, elecEquips[1]); ASSERT_EQ(2ul, gasEquips.size()); std::vector gasEquip0{"1", "test gasEquip 1", "", "", "0.0", "0.0", "0.0", "0.0", "0.0", ""}; - std::vector gasEquip1{"2", "test gasEquip 2", "1", "1", "2.0", "2.0", "2.0", "2.0", "2.0", "test"}; + std::vector gasEquip1{"2", "test gasEquip 2", "1", "2", "2.0", "2.0", "2.0", "2.0", "2.0", "test"}; EXPECT_EQ(gasEquip0, gasEquips[0]); EXPECT_EQ(gasEquip1, gasEquips[1]); ASSERT_EQ(2ul, steamEquips.size()); std::vector steamEquip0{"1", "test steamEquip 1", "", "", "0.0", "0.0", "0.0", "0.0", "0.0", ""}; - std::vector steamEquip1{"2", "test steamEquip 2", "1", "1", "2.0", "2.0", "2.0", "2.0", "2.0", "test"}; + std::vector steamEquip1{"2", "test steamEquip 2", "1", "2", "2.0", "2.0", "2.0", "2.0", "2.0", "test"}; EXPECT_EQ(steamEquip0, steamEquips[0]); EXPECT_EQ(steamEquip1, steamEquips[1]); ASSERT_EQ(2ul, hwEquips.size()); std::vector hwEquip0{"1", "test hwEquip 1", "", "", "0.0", "0.0", "0.0", "0.0", "0.0", ""}; - std::vector hwEquip1{"2", "test hwEquip 2", "1", "1", "2.0", "2.0", "2.0", "2.0", "2.0", "test"}; + std::vector hwEquip1{"2", "test hwEquip 2", "1", "2", "2.0", "2.0", "2.0", "2.0", "2.0", "test"}; EXPECT_EQ(hwEquip0, hwEquips[0]); EXPECT_EQ(hwEquip1, hwEquips[1]); ASSERT_EQ(2ul, otherEquips.size()); std::vector otherEquip0{"1", "test otherEquip 1", "", "", "0.0", "0.0", "0.0", "0.0", "0.0", ""}; - std::vector otherEquip1{"2", "test otherEquip 2", "1", "1", "2.0", "2.0", "2.0", "2.0", "2.0", "test"}; + std::vector otherEquip1{"2", "test otherEquip 2", "1", "2", "2.0", "2.0", "2.0", "2.0", "2.0", "test"}; EXPECT_EQ(otherEquip0, otherEquips[0]); EXPECT_EQ(otherEquip1, otherEquips[1]); ASSERT_EQ(2ul, baseboards.size()); std::vector baseboard0{"1", "test baseboard 1", "", "", "0.0", "0.0", "0.0", "0.0", "0.0", "0.0", ""}; - std::vector baseboard1{"2", "test baseboard 2", "1", "1", "2.0", "2.0", "2.0", "2.0", "2.0", "2.0", "test"}; + std::vector baseboard1{"2", "test baseboard 2", "1", "2", "2.0", "2.0", "2.0", "2.0", "2.0", "2.0", "test"}; EXPECT_EQ(baseboard0, baseboards[0]); EXPECT_EQ(baseboard1, baseboards[1]); ASSERT_EQ(2ul, infiltrations.size()); std::vector infiltration0{"1", "test infiltration 1", "", "", "0.0"}; - std::vector infiltration1{"2", "test infiltration 2", "1", "1", "2.0"}; + std::vector infiltration1{"2", "test infiltration 2", "1", "2", "2.0"}; EXPECT_EQ(infiltration0, infiltrations[0]); EXPECT_EQ(infiltration1, infiltrations[1]); ASSERT_EQ(2ul, ventilations.size()); std::vector ventilation0{"1", "test ventilation 1", "", "", "0.0"}; - std::vector ventilation1{"2", "test ventilation 2", "1", "1", "2.0"}; + std::vector ventilation1{"2", "test ventilation 2", "1", "2", "2.0"}; EXPECT_EQ(ventilation0, ventilations[0]); EXPECT_EQ(ventilation1, ventilations[1]); diff --git a/tst/EnergyPlus/unit/SZVAVModel.unit.cc b/tst/EnergyPlus/unit/SZVAVModel.unit.cc index 0316d2a9067..cf7d0e3d185 100644 --- a/tst/EnergyPlus/unit/SZVAVModel.unit.cc +++ b/tst/EnergyPlus/unit/SZVAVModel.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -94,7 +94,6 @@ using namespace EnergyPlus::HeatBalanceManager; using namespace EnergyPlus::OutputReportPredefined; using namespace EnergyPlus::DataPlant; using namespace EnergyPlus::Psychrometrics; -using namespace EnergyPlus::ScheduleManager; using namespace EnergyPlus::SZVAVModel; using namespace EnergyPlus::UnitarySystems; using namespace EnergyPlus::WaterCoils; @@ -168,6 +167,7 @@ TEST_F(EnergyPlusFixture, SZVAV_PTUnit_Testing) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataEnvrn->StdRhoAir = 1.0; @@ -231,9 +231,6 @@ TEST_F(EnergyPlusFixture, SZVAV_PTUnit_Testing) state->dataZoneEquip->ZoneEquipConfig.allocate(1); state->dataZoneEquip->ZoneEquipConfig(1).ZoneNode = 1; - state->dataScheduleMgr->Schedule.allocate(1); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; - thisUnit.m_SimASHRAEModel = true; thisUnit.m_CoolingCoilUpstream = true; thisUnit.m_FanExists = true; @@ -250,8 +247,8 @@ TEST_F(EnergyPlusFixture, SZVAV_PTUnit_Testing) thisUnit.m_CoolingCoilIndex = 1; thisUnit.m_HeatingCoilIndex = 2; thisUnit.m_FanIndex = 1; - thisUnit.m_SysAvailSchedPtr = 1; - thisUnit.m_FanAvailSchedPtr = 1; + thisUnit.m_sysAvailSched = Sched::GetSchedule(*state, "ONSCHED"); + thisUnit.m_fanAvailSched = Sched::GetSchedule(*state, "ONSCHED"); thisUnit.m_FanPlace = HVAC::FanPlace::BlowThru; // ensure constant fan mode is used thisUnit.m_FanOpMode = HVAC::FanOp::Continuous; @@ -273,7 +270,6 @@ TEST_F(EnergyPlusFixture, SZVAV_PTUnit_Testing) state->dataEnvrn->OutDryBulbTemp = 30.0; state->dataEnvrn->OutBaroPress = 101325.0; OutputReportPredefined::SetPredefinedTables(*state); - Psychrometrics::InitializePsychRoutines(*state); createCoilSelectionReportObj(*state); int UnitNum = 0; @@ -315,7 +311,8 @@ TEST_F(EnergyPlusFixture, SZVAV_PTUnit_Testing) state->dataLoopNodes->Node(zoneNodeNum).Enthalpy = 52120.0; // turn the availability schedule on - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; + Sched::GetSchedule(*state, "ONSCHED")->currentVal = 1.0; + state->dataUnitarySystems->CoolingLoad = CoolingLoad; state->dataUnitarySystems->HeatingLoad = HeatingLoad; // set fan inlet max avail so fan doesn't shut down flow @@ -520,9 +517,9 @@ TEST_F(EnergyPlusFixture, SZVAV_FanCoilUnit_Testing) state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->MinutesInTimeStep = 60; state->dataSize->CurZoneEqNum = 1; std::string const idf_objects = delimited_string({ @@ -642,21 +639,20 @@ TEST_F(EnergyPlusFixture, SZVAV_FanCoilUnit_Testing) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + state->dataEnvrn->StdRhoAir = 1.0; state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; - state->dataGlobal->NumOfTimeStepInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; state->dataSize->CurZoneEqNum = 1; - InitializePsychRoutines(*state); GetZoneData(*state, ErrorsFound); EXPECT_EQ("WEST ZONE", state->dataHeatBal->Zone(1).Name); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; GetFanCoilUnits(*state); auto &thisFanCoil(state->dataFanCoilUnits->FanCoil(1)); EXPECT_ENUM_EQ(CCM::ASHRAE, thisFanCoil.CapCtrlMeth_Num); @@ -718,9 +714,8 @@ TEST_F(EnergyPlusFixture, SZVAV_FanCoilUnit_Testing) // chilled water plant loop auto &CWLoop(state->dataPlnt->PlantLoop(1)); CWLoop.Name = "ChilledWaterLoop"; - CWLoop.FluidName = "ChilledWater"; - CWLoop.FluidIndex = 1; CWLoop.FluidName = "WATER"; + CWLoop.glycol = Fluid::GetWater(*state); CWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = CWCoil.Name; CWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterCooling; CWLoop.LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).NodeNumIn = CWCoil.WaterInletNodeNum; @@ -742,7 +737,7 @@ TEST_F(EnergyPlusFixture, SZVAV_FanCoilUnit_Testing) state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); state->dataSize->ZoneEqSizing.allocate(1); state->dataSize->ZoneSizingRunDone = true; thisFanCoil.DesignHeatingCapacity = 10000.0; diff --git a/tst/EnergyPlus/unit/ScheduleManager.unit.cc b/tst/EnergyPlus/unit/ScheduleManager.unit.cc index bfaee667d65..f3f86ef794e 100644 --- a/tst/EnergyPlus/unit/ScheduleManager.unit.cc +++ b/tst/EnergyPlus/unit/ScheduleManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -70,120 +70,105 @@ #include using namespace EnergyPlus; -using namespace EnergyPlus::ScheduleManager; TEST_F(EnergyPlusFixture, ScheduleManager_isMinuteMultipleOfTimestep) { // EnergyPlus can accept 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60 timesteps per hour which correspond to // 60, 30, 20, 15, 12, 10, 5, 5, 4, 3, 2, 1 minutes per timestep - EXPECT_TRUE(isMinuteMultipleOfTimestep(0, 15)); - EXPECT_TRUE(isMinuteMultipleOfTimestep(15, 15)); - EXPECT_TRUE(isMinuteMultipleOfTimestep(30, 15)); - EXPECT_TRUE(isMinuteMultipleOfTimestep(45, 15)); - - EXPECT_FALSE(isMinuteMultipleOfTimestep(22, 15)); - EXPECT_FALSE(isMinuteMultipleOfTimestep(53, 15)); - - EXPECT_TRUE(isMinuteMultipleOfTimestep(0, 12)); - EXPECT_TRUE(isMinuteMultipleOfTimestep(12, 12)); - EXPECT_TRUE(isMinuteMultipleOfTimestep(24, 12)); - EXPECT_TRUE(isMinuteMultipleOfTimestep(36, 12)); - EXPECT_TRUE(isMinuteMultipleOfTimestep(48, 12)); - - EXPECT_FALSE(isMinuteMultipleOfTimestep(22, 12)); - EXPECT_FALSE(isMinuteMultipleOfTimestep(53, 12)); + EXPECT_TRUE(Sched::isMinuteMultipleOfTimestep(0, 15)); + EXPECT_TRUE(Sched::isMinuteMultipleOfTimestep(15, 15)); + EXPECT_TRUE(Sched::isMinuteMultipleOfTimestep(30, 15)); + EXPECT_TRUE(Sched::isMinuteMultipleOfTimestep(45, 15)); + + EXPECT_FALSE(Sched::isMinuteMultipleOfTimestep(22, 15)); + EXPECT_FALSE(Sched::isMinuteMultipleOfTimestep(53, 15)); + + EXPECT_TRUE(Sched::isMinuteMultipleOfTimestep(0, 12)); + EXPECT_TRUE(Sched::isMinuteMultipleOfTimestep(12, 12)); + EXPECT_TRUE(Sched::isMinuteMultipleOfTimestep(24, 12)); + EXPECT_TRUE(Sched::isMinuteMultipleOfTimestep(36, 12)); + EXPECT_TRUE(Sched::isMinuteMultipleOfTimestep(48, 12)); + + EXPECT_FALSE(Sched::isMinuteMultipleOfTimestep(22, 12)); + EXPECT_FALSE(Sched::isMinuteMultipleOfTimestep(53, 12)); } -TEST_F(EnergyPlusFixture, ScheduleManager_UpdateScheduleValues) +TEST_F(EnergyPlusFixture, ScheduleManager_UpdateScheduleVals) { - - state->dataScheduleMgr->ScheduleInputProcessed = true; + auto &s_glob = state->dataGlobal; + auto &s_sched = state->dataSched; state->dataEnvrn->DSTIndicator = 0; - state->dataScheduleMgr->NumSchedules = 1; - state->dataScheduleMgr->Schedule.allocate(1); - state->dataScheduleMgr->Schedule(1).WeekSchedulePointer.allocate(367); - state->dataScheduleMgr->WeekSchedule.allocate(3); - state->dataScheduleMgr->WeekSchedule(1).DaySchedulePointer.allocate(12); - state->dataScheduleMgr->WeekSchedule(2).DaySchedulePointer.allocate(12); - state->dataScheduleMgr->WeekSchedule(3).DaySchedulePointer.allocate(12); - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataScheduleMgr->DaySchedule.allocate(3); - state->dataScheduleMgr->DaySchedule(1).TSValue.allocate(1, 24); - state->dataScheduleMgr->DaySchedule(2).TSValue.allocate(1, 24); - state->dataScheduleMgr->DaySchedule(3).TSValue.allocate(1, 24); - - for (int ScheduleIndex = 1; ScheduleIndex <= state->dataScheduleMgr->NumSchedules; ScheduleIndex++) { - for (int i = 1; i <= 366; i++) { - int x = 1; - if (i > 250) { - x = 3; - } else if (i > 249) { - x = 2; - } - state->dataScheduleMgr->Schedule(ScheduleIndex).WeekSchedulePointer(i) = x; - } - } - for (int WeekSchedulePointer = 1; WeekSchedulePointer <= 3; WeekSchedulePointer++) { - for (int dayOfWeek = 1; dayOfWeek <= 12; dayOfWeek++) { - int y = 1; - if (WeekSchedulePointer == 2) y = 2; - if (WeekSchedulePointer == 3) y = 3; - state->dataScheduleMgr->WeekSchedule(WeekSchedulePointer).DaySchedulePointer(dayOfWeek) = y; - } - } - for (int daySchedulePointer = 1; daySchedulePointer <= 3; daySchedulePointer++) { - for (int whichHour = 1; whichHour <= 24; whichHour++) { - Real64 schVal = 1.0; - if (daySchedulePointer == 2) schVal = 2.0; - if (daySchedulePointer == 3) schVal = 3.0; - state->dataScheduleMgr->DaySchedule(daySchedulePointer).TSValue(1, whichHour) = schVal; - } - } + + auto *sched1 = Sched::AddScheduleDetailed(*state, "Detailed-1"); + + auto *weekSched1 = Sched::AddWeekSchedule(*state, "Week-1"); + auto *weekSched2 = Sched::AddWeekSchedule(*state, "Week-2"); + auto *weekSched3 = Sched::AddWeekSchedule(*state, "Week-3"); + + s_glob->TimeStepsInHour = 1; + + auto *daySched1 = Sched::AddDaySchedule(*state, "Day-1"); + auto *daySched2 = Sched::AddDaySchedule(*state, "Day-2"); + auto *daySched3 = Sched::AddDaySchedule(*state, "Day-3"); + + for (int i = 1; i <= 249; i++) + sched1->weekScheds[i] = weekSched1; + sched1->weekScheds[250] = weekSched2; + for (int i = 251; i <= 366; i++) + sched1->weekScheds[i] = weekSched3; + + std::fill(weekSched1->dayScheds.begin() + 1, weekSched1->dayScheds.end(), daySched1); + std::fill(weekSched2->dayScheds.begin() + 1, weekSched2->dayScheds.end(), daySched2); + std::fill(weekSched3->dayScheds.begin() + 1, weekSched3->dayScheds.end(), daySched3); + + std::fill(daySched1->tsVals.begin(), daySched1->tsVals.end(), 1.0); + std::fill(daySched2->tsVals.begin(), daySched2->tsVals.end(), 2.0); + std::fill(daySched3->tsVals.begin(), daySched3->tsVals.end(), 3.0); state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfWeek = 1; state->dataEnvrn->DayOfWeekTomorrow = 2; - state->dataGlobal->TimeStep = 1; - state->dataGlobal->HourOfDay = 1; + s_glob->TimeStep = 1; + s_glob->HourOfDay = 1; // check day schedules - EXPECT_EQ(state->dataScheduleMgr->DaySchedule(1).TSValue(1, 1), 1.0); // day < 250 points to this schedule - EXPECT_EQ(state->dataScheduleMgr->DaySchedule(1).TSValue(1, 24), 1.0); + EXPECT_EQ(daySched1->tsVals[0 * s_glob->TimeStepsInHour], 1.0); // day < 250 points to this schedule + EXPECT_EQ(daySched1->tsVals[23 * s_glob->TimeStepsInHour], 1.0); - EXPECT_EQ(state->dataScheduleMgr->DaySchedule(2).TSValue(1, 1), 2.0); // day = 250 points to this schedule - EXPECT_EQ(state->dataScheduleMgr->DaySchedule(2).TSValue(1, 24), 2.0); + EXPECT_EQ(daySched2->tsVals[0 * s_glob->TimeStepsInHour], 2.0); // day = 250 points to this schedule + EXPECT_EQ(daySched2->tsVals[23 * s_glob->TimeStepsInHour], 2.0); - EXPECT_EQ(state->dataScheduleMgr->DaySchedule(3).TSValue(1, 1), 3.0); // day > 250 points to this schedule - EXPECT_EQ(state->dataScheduleMgr->DaySchedule(3).TSValue(1, 24), 3.0); + EXPECT_EQ(daySched3->tsVals[0 * s_glob->TimeStepsInHour], 3.0); // day > 250 points to this schedule + EXPECT_EQ(daySched3->tsVals[23 * s_glob->TimeStepsInHour], 3.0); // schedule values are 1 through day 249, 2 for day 250, and 3 for remainder of year state->dataEnvrn->DayOfYear_Schedule = 1; - UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // expect 1.0 on day 1 - EXPECT_EQ(state->dataScheduleMgr->Schedule(1).CurrentValue, 1.0); + EXPECT_EQ(sched1->currentVal, 1.0); state->dataEnvrn->DayOfYear_Schedule = 250; - UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // expect 2.0 on day 250 - EXPECT_EQ(state->dataScheduleMgr->Schedule(1).CurrentValue, 2.0); + EXPECT_EQ(sched1->currentVal, 2.0); // test end of day 250 with daylight savings time active - state->dataGlobal->HourOfDay = 24; + s_glob->HourOfDay = 24; state->dataEnvrn->DSTIndicator = 1; - UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // expect a 3 on day 251, which on day 250 at midnight with DST of hour 1 of day 251 - EXPECT_EQ(state->dataScheduleMgr->Schedule(1).CurrentValue, 3.0); + EXPECT_EQ(sched1->currentVal, 3.0); - state->dataGlobal->HourOfDay = 2; + s_glob->HourOfDay = 2; state->dataEnvrn->DSTIndicator = 0; state->dataEnvrn->DayOfYear_Schedule = 251; - UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // expect 3.0 for remainder of year regardless of DST - EXPECT_EQ(state->dataScheduleMgr->Schedule(1).CurrentValue, 3.0); - state->dataGlobal->HourOfDay = 24; + EXPECT_EQ(sched1->currentVal, 3.0); + s_glob->HourOfDay = 24; state->dataEnvrn->DSTIndicator = 1; - UpdateScheduleValues(*state); - EXPECT_EQ(state->dataScheduleMgr->Schedule(1).CurrentValue, 3.0); + Sched::UpdateScheduleVals(*state); + EXPECT_EQ(sched1->currentVal, 3.0); } TEST_F(EnergyPlusFixture, ScheduleAnnualFullLoadHours_test) @@ -238,23 +223,27 @@ TEST_F(EnergyPlusFixture, ScheduleAnnualFullLoadHours_test) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 4; - state->dataGlobal->MinutesPerTimeStep = 15; + auto &s_glob = state->dataGlobal; - int onSchedIndex = GetScheduleIndex(*state, "ONSCHED"); - EXPECT_EQ(8760., ScheduleAnnualFullLoadHours(*state, onSchedIndex, 1, false)); + s_glob->TimeStepsInHour = 4; + s_glob->MinutesInTimeStep = 15; - int offSchedIndex = GetScheduleIndex(*state, "OFFSCHED"); - EXPECT_EQ(0., ScheduleAnnualFullLoadHours(*state, offSchedIndex, 1, false)); + state->init_state(*state); - int janOnSchedIndex = GetScheduleIndex(*state, "JANONSCHED"); - EXPECT_EQ(744., ScheduleAnnualFullLoadHours(*state, janOnSchedIndex, 1, false)); + auto *onSched = Sched::GetSchedule(*state, "ONSCHED"); + EXPECT_EQ(8760., onSched->getAnnualHoursFullLoad(*state, 1, false)); - int halfOnSchedIndex = GetScheduleIndex(*state, "HALFONSCHED"); - EXPECT_EQ(4380., ScheduleAnnualFullLoadHours(*state, halfOnSchedIndex, 1, false)); + auto *offSched = Sched::GetSchedule(*state, "OFFSCHED"); + EXPECT_EQ(0., offSched->getAnnualHoursFullLoad(*state, 1, false)); - int halfOnSched2Index = GetScheduleIndex(*state, "HALFONSCHED2"); - EXPECT_EQ(4380., ScheduleAnnualFullLoadHours(*state, halfOnSched2Index, 1, false)); + auto *janOnSched = Sched::GetSchedule(*state, "JANONSCHED"); + EXPECT_EQ(744., janOnSched->getAnnualHoursFullLoad(*state, 1, false)); + + auto *halfOnSched = Sched::GetSchedule(*state, "HALFONSCHED"); + EXPECT_EQ(4380., halfOnSched->getAnnualHoursFullLoad(*state, 1, false)); + + auto *halfOnSched2 = Sched::GetSchedule(*state, "HALFONSCHED2"); + EXPECT_EQ(4380., halfOnSched2->getAnnualHoursFullLoad(*state, 1, false)); } TEST_F(EnergyPlusFixture, ScheduleAverageHoursPerWeek_test) @@ -309,23 +298,27 @@ TEST_F(EnergyPlusFixture, ScheduleAverageHoursPerWeek_test) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 4; - state->dataGlobal->MinutesPerTimeStep = 15; + auto &s_glob = state->dataGlobal; + + s_glob->TimeStepsInHour = 4; + s_glob->MinutesInTimeStep = 15; + + state->init_state(*state); - int onSchedIndex = GetScheduleIndex(*state, "ONSCHED"); - EXPECT_EQ(168., ScheduleAverageHoursPerWeek(*state, onSchedIndex, 1, false)); + auto *onSched = Sched::GetSchedule(*state, "ONSCHED"); + EXPECT_EQ(168., onSched->getAverageWeeklyHoursFullLoad(*state, 1, false)); - int offSchedIndex = GetScheduleIndex(*state, "OFFSCHED"); - EXPECT_EQ(0., ScheduleAverageHoursPerWeek(*state, offSchedIndex, 1, false)); + auto *offSched = Sched::GetSchedule(*state, "OFFSCHED"); + EXPECT_EQ(0., offSched->getAverageWeeklyHoursFullLoad(*state, 1, false)); - int janOnSchedIndex = GetScheduleIndex(*state, "JANONSCHED"); - EXPECT_NEAR(14.3, ScheduleAverageHoursPerWeek(*state, janOnSchedIndex, 1, false), 0.1); + auto *janOnSched = Sched::GetSchedule(*state, "JANONSCHED"); + EXPECT_NEAR(14.3, janOnSched->getAverageWeeklyHoursFullLoad(*state, 1, false), 0.1); - int halfOnSchedIndex = GetScheduleIndex(*state, "HALFONSCHED"); - EXPECT_EQ(84., ScheduleAverageHoursPerWeek(*state, halfOnSchedIndex, 1, false)); + auto *halfOnSched = Sched::GetSchedule(*state, "HALFONSCHED"); + EXPECT_EQ(84., halfOnSched->getAverageWeeklyHoursFullLoad(*state, 1, false)); - int halfOnSched2Index = GetScheduleIndex(*state, "HALFONSCHED2"); - EXPECT_EQ(84., ScheduleAverageHoursPerWeek(*state, halfOnSched2Index, 1, false)); + auto *halfOnSched2 = Sched::GetSchedule(*state, "HALFONSCHED2"); + EXPECT_EQ(84., halfOnSched2->getAverageWeeklyHoursFullLoad(*state, 1, false)); } TEST_F(EnergyPlusFixture, ScheduleHoursGT1perc_test) @@ -388,27 +381,31 @@ TEST_F(EnergyPlusFixture, ScheduleHoursGT1perc_test) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 4; - state->dataGlobal->MinutesPerTimeStep = 15; - state->dataGlobal->TimeStepZone = 0.25; + auto &s_glob = state->dataGlobal; - int onSchedIndex = GetScheduleIndex(*state, "ONSCHED"); - EXPECT_EQ(8760., ScheduleHoursGT1perc(*state, onSchedIndex, 1, false)); + s_glob->TimeStepsInHour = 4; + s_glob->MinutesInTimeStep = 15; + s_glob->TimeStepZone = 0.25; - int offSchedIndex = GetScheduleIndex(*state, "OFFSCHED"); - EXPECT_EQ(0., ScheduleHoursGT1perc(*state, offSchedIndex, 1, false)); + state->init_state(*state); - int janOnSchedIndex = GetScheduleIndex(*state, "JANONSCHED"); - EXPECT_EQ(744., ScheduleHoursGT1perc(*state, janOnSchedIndex, 1, false)); + auto *onSched = Sched::GetSchedule(*state, "ONSCHED"); + EXPECT_EQ(8760., onSched->getAnnualHoursGreaterThan1Percent(*state, 1, false)); - int halfOnSchedIndex = GetScheduleIndex(*state, "HALFONSCHED"); - EXPECT_EQ(4380., ScheduleHoursGT1perc(*state, halfOnSchedIndex, 1, false)); + auto *offSched = Sched::GetSchedule(*state, "OFFSCHED"); + EXPECT_EQ(0., offSched->getAnnualHoursGreaterThan1Percent(*state, 1, false)); - int halfOnSched2Index = GetScheduleIndex(*state, "HALFONSCHED2"); - EXPECT_EQ(8760., ScheduleHoursGT1perc(*state, halfOnSched2Index, 1, false)); + auto *janOnSched = Sched::GetSchedule(*state, "JANONSCHED"); + EXPECT_EQ(744., janOnSched->getAnnualHoursGreaterThan1Percent(*state, 1, false)); - int halfOnSched3Index = GetScheduleIndex(*state, "HALFONSCHED3"); - EXPECT_EQ(4380., ScheduleHoursGT1perc(*state, halfOnSched3Index, 1, false)); + auto *halfOnSched = Sched::GetSchedule(*state, "HALFONSCHED"); + EXPECT_EQ(4380., halfOnSched->getAnnualHoursGreaterThan1Percent(*state, 1, false)); + + auto *halfOnSched2 = Sched::GetSchedule(*state, "HALFONSCHED2"); + EXPECT_EQ(8760., halfOnSched2->getAnnualHoursGreaterThan1Percent(*state, 1, false)); + + auto *halfOnSched3 = Sched::GetSchedule(*state, "HALFONSCHED3"); + EXPECT_EQ(4380., halfOnSched3->getAnnualHoursGreaterThan1Percent(*state, 1, false)); } TEST_F(EnergyPlusFixture, ScheduleDayInterval_SimpLinearInterp) @@ -463,71 +460,75 @@ TEST_F(EnergyPlusFixture, ScheduleDayInterval_SimpLinearInterp) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 4; - state->dataGlobal->MinutesPerTimeStep = 15; - state->dataGlobal->TimeStepZone = 0.25; + auto &s_glob = state->dataGlobal; + + s_glob->TimeStepsInHour = 4; + s_glob->MinutesInTimeStep = 15; + s_glob->TimeStepZone = 0.25; + + state->init_state(*state); state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 1; - state->dataGlobal->HourOfDay = 1; - state->dataGlobal->TimeStep = 1; + s_glob->HourOfDay = 1; + s_glob->TimeStep = 1; state->dataEnvrn->DSTIndicator = 0; state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - int ASchedIndex = GetScheduleIndex(*state, "SCHYR_A"); // interpolate Linear - EXPECT_NEAR(0.001, LookUpScheduleValue(*state, ASchedIndex, 7, 4), 0.000001); + auto *ASched = Sched::GetSchedule(*state, "SCHYR_A"); // interpolate Linear + EXPECT_NEAR(0.001, ASched->getHrTsVal(*state, 7, 4), 0.000001); // interpolate over one hour - EXPECT_NEAR(25.001, LookUpScheduleValue(*state, ASchedIndex, 8, 1), 0.000001); - EXPECT_NEAR(50.001, LookUpScheduleValue(*state, ASchedIndex, 8, 2), 0.000001); - EXPECT_NEAR(75.001, LookUpScheduleValue(*state, ASchedIndex, 8, 3), 0.000001); - EXPECT_NEAR(100.001, LookUpScheduleValue(*state, ASchedIndex, 8, 4), 0.000001); + EXPECT_NEAR(25.001, ASched->getHrTsVal(*state, 8, 1), 0.000001); + EXPECT_NEAR(50.001, ASched->getHrTsVal(*state, 8, 2), 0.000001); + EXPECT_NEAR(75.001, ASched->getHrTsVal(*state, 8, 3), 0.000001); + EXPECT_NEAR(100.001, ASched->getHrTsVal(*state, 8, 4), 0.000001); // interpolate over two hours - EXPECT_NEAR(125.001, LookUpScheduleValue(*state, ASchedIndex, 9, 1), 0.000001); - EXPECT_NEAR(150.001, LookUpScheduleValue(*state, ASchedIndex, 9, 2), 0.000001); - EXPECT_NEAR(175.001, LookUpScheduleValue(*state, ASchedIndex, 9, 3), 0.000001); - EXPECT_NEAR(200.001, LookUpScheduleValue(*state, ASchedIndex, 9, 4), 0.000001); + EXPECT_NEAR(125.001, ASched->getHrTsVal(*state, 9, 1), 0.000001); + EXPECT_NEAR(150.001, ASched->getHrTsVal(*state, 9, 2), 0.000001); + EXPECT_NEAR(175.001, ASched->getHrTsVal(*state, 9, 3), 0.000001); + EXPECT_NEAR(200.001, ASched->getHrTsVal(*state, 9, 4), 0.000001); - EXPECT_NEAR(225.001, LookUpScheduleValue(*state, ASchedIndex, 10, 1), 0.000001); - EXPECT_NEAR(250.001, LookUpScheduleValue(*state, ASchedIndex, 10, 2), 0.000001); - EXPECT_NEAR(275.001, LookUpScheduleValue(*state, ASchedIndex, 10, 3), 0.000001); - EXPECT_NEAR(300.001, LookUpScheduleValue(*state, ASchedIndex, 10, 4), 0.000001); + EXPECT_NEAR(225.001, ASched->getHrTsVal(*state, 10, 1), 0.000001); + EXPECT_NEAR(250.001, ASched->getHrTsVal(*state, 10, 2), 0.000001); + EXPECT_NEAR(275.001, ASched->getHrTsVal(*state, 10, 3), 0.000001); + EXPECT_NEAR(300.001, ASched->getHrTsVal(*state, 10, 4), 0.000001); // interpolate over four hours - EXPECT_NEAR(325.001, LookUpScheduleValue(*state, ASchedIndex, 11, 1), 0.000001); - EXPECT_NEAR(350.001, LookUpScheduleValue(*state, ASchedIndex, 11, 2), 0.000001); - EXPECT_NEAR(375.001, LookUpScheduleValue(*state, ASchedIndex, 11, 3), 0.000001); - EXPECT_NEAR(400.001, LookUpScheduleValue(*state, ASchedIndex, 11, 4), 0.000001); + EXPECT_NEAR(325.001, ASched->getHrTsVal(*state, 11, 1), 0.000001); + EXPECT_NEAR(350.001, ASched->getHrTsVal(*state, 11, 2), 0.000001); + EXPECT_NEAR(375.001, ASched->getHrTsVal(*state, 11, 3), 0.000001); + EXPECT_NEAR(400.001, ASched->getHrTsVal(*state, 11, 4), 0.000001); - EXPECT_NEAR(525.001, LookUpScheduleValue(*state, ASchedIndex, 13, 1), 0.000001); - EXPECT_NEAR(550.001, LookUpScheduleValue(*state, ASchedIndex, 13, 2), 0.000001); - EXPECT_NEAR(575.001, LookUpScheduleValue(*state, ASchedIndex, 13, 3), 0.000001); - EXPECT_NEAR(600.001, LookUpScheduleValue(*state, ASchedIndex, 13, 4), 0.000001); + EXPECT_NEAR(525.001, ASched->getHrTsVal(*state, 13, 1), 0.000001); + EXPECT_NEAR(550.001, ASched->getHrTsVal(*state, 13, 2), 0.000001); + EXPECT_NEAR(575.001, ASched->getHrTsVal(*state, 13, 3), 0.000001); + EXPECT_NEAR(600.001, ASched->getHrTsVal(*state, 13, 4), 0.000001); // interpolate over one hour - decreasing - EXPECT_NEAR(675.001, LookUpScheduleValue(*state, ASchedIndex, 15, 1), 0.000001); - EXPECT_NEAR(650.001, LookUpScheduleValue(*state, ASchedIndex, 15, 2), 0.000001); - EXPECT_NEAR(625.001, LookUpScheduleValue(*state, ASchedIndex, 15, 3), 0.000001); - EXPECT_NEAR(600.001, LookUpScheduleValue(*state, ASchedIndex, 15, 4), 0.000001); + EXPECT_NEAR(675.001, ASched->getHrTsVal(*state, 15, 1), 0.000001); + EXPECT_NEAR(650.001, ASched->getHrTsVal(*state, 15, 2), 0.000001); + EXPECT_NEAR(625.001, ASched->getHrTsVal(*state, 15, 3), 0.000001); + EXPECT_NEAR(600.001, ASched->getHrTsVal(*state, 15, 4), 0.000001); // interpolate over four hours - decreasing - EXPECT_NEAR(375.001, LookUpScheduleValue(*state, ASchedIndex, 18, 1), 0.000001); - EXPECT_NEAR(350.001, LookUpScheduleValue(*state, ASchedIndex, 18, 2), 0.000001); - EXPECT_NEAR(325.001, LookUpScheduleValue(*state, ASchedIndex, 18, 3), 0.000001); - EXPECT_NEAR(300.001, LookUpScheduleValue(*state, ASchedIndex, 18, 4), 0.000001); + EXPECT_NEAR(375.001, ASched->getHrTsVal(*state, 18, 1), 0.000001); + EXPECT_NEAR(350.001, ASched->getHrTsVal(*state, 18, 2), 0.000001); + EXPECT_NEAR(325.001, ASched->getHrTsVal(*state, 18, 3), 0.000001); + EXPECT_NEAR(300.001, ASched->getHrTsVal(*state, 18, 4), 0.000001); - EXPECT_NEAR(275.001, LookUpScheduleValue(*state, ASchedIndex, 19, 1), 0.000001); - EXPECT_NEAR(250.001, LookUpScheduleValue(*state, ASchedIndex, 19, 2), 0.000001); - EXPECT_NEAR(225.001, LookUpScheduleValue(*state, ASchedIndex, 19, 3), 0.000001); - EXPECT_NEAR(200.001, LookUpScheduleValue(*state, ASchedIndex, 19, 4), 0.000001); + EXPECT_NEAR(275.001, ASched->getHrTsVal(*state, 19, 1), 0.000001); + EXPECT_NEAR(250.001, ASched->getHrTsVal(*state, 19, 2), 0.000001); + EXPECT_NEAR(225.001, ASched->getHrTsVal(*state, 19, 3), 0.000001); + EXPECT_NEAR(200.001, ASched->getHrTsVal(*state, 19, 4), 0.000001); } TEST_F(EnergyPlusFixture, ScheduleDayInterval_PartialHourLinearInterp) @@ -576,31 +577,35 @@ TEST_F(EnergyPlusFixture, ScheduleDayInterval_PartialHourLinearInterp) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 4; - state->dataGlobal->MinutesPerTimeStep = 15; - state->dataGlobal->TimeStepZone = 0.25; + auto &s_glob = state->dataGlobal; + + s_glob->TimeStepsInHour = 4; + s_glob->MinutesInTimeStep = 15; + s_glob->TimeStepZone = 0.25; + + state->init_state(*state); state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 1; - state->dataGlobal->HourOfDay = 1; - state->dataGlobal->TimeStep = 1; + s_glob->HourOfDay = 1; + s_glob->TimeStep = 1; state->dataEnvrn->DSTIndicator = 0; state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - int ASchedIndex = GetScheduleIndex(*state, "SCHYR_A"); // interpolate Linear - EXPECT_NEAR(0.001, LookUpScheduleValue(*state, ASchedIndex, 7, 4), 0.000001); + auto *ASched = Sched::GetSchedule(*state, "SCHYR_A"); // interpolate Linear + EXPECT_NEAR(0.001, ASched->getHrTsVal(*state, 7, 4), 0.000001); // interpolate over first half hour - EXPECT_NEAR(25.001, LookUpScheduleValue(*state, ASchedIndex, 8, 1), 0.000001); - EXPECT_NEAR(50.001, LookUpScheduleValue(*state, ASchedIndex, 8, 2), 0.000001); + EXPECT_NEAR(25.001, ASched->getHrTsVal(*state, 8, 1), 0.000001); + EXPECT_NEAR(50.001, ASched->getHrTsVal(*state, 8, 2), 0.000001); // interpolate over second half hour - EXPECT_NEAR(75.001, LookUpScheduleValue(*state, ASchedIndex, 8, 3), 0.000001); - EXPECT_NEAR(100.001, LookUpScheduleValue(*state, ASchedIndex, 8, 4), 0.000001); + EXPECT_NEAR(75.001, ASched->getHrTsVal(*state, 8, 3), 0.000001); + EXPECT_NEAR(100.001, ASched->getHrTsVal(*state, 8, 4), 0.000001); } TEST_F(EnergyPlusFixture, ScheduleDayInterval_LinearInterpIntervalHittingIntervals) @@ -658,31 +663,35 @@ TEST_F(EnergyPlusFixture, ScheduleDayInterval_LinearInterpIntervalHittingInterva ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 4; - state->dataGlobal->MinutesPerTimeStep = 15; - state->dataGlobal->TimeStepZone = 0.25; + auto &s_glob = state->dataGlobal; + + s_glob->TimeStepsInHour = 4; + s_glob->MinutesInTimeStep = 15; + s_glob->TimeStepZone = 0.25; + + state->init_state(*state); state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 1; - state->dataGlobal->HourOfDay = 1; - state->dataGlobal->TimeStep = 1; + s_glob->HourOfDay = 1; + s_glob->TimeStep = 1; state->dataEnvrn->DSTIndicator = 0; state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - int ASchedIndex = GetScheduleIndex(*state, "2LLOYEAR"); // interpolate Linear + auto *ASched = Sched::GetSchedule(*state, "2LLOYEAR"); // interpolate Linear // Timesteps will go 1,2,3,4; Not 0,1,2,3, Hours to go as (actual hour+1) therefore 7:15 is 8,1 // Check for values specified in schedule (Lower and upper limits) - EXPECT_NEAR(0.1, LookUpScheduleValue(*state, ASchedIndex, 6, 4), 0.000001); // at 6:00 - EXPECT_NEAR(0.1, LookUpScheduleValue(*state, ASchedIndex, 17, 1), 0.000001); // at 16:15 - EXPECT_NEAR(0.1, LookUpScheduleValue(*state, ASchedIndex, 19, 1), 0.000001); // at 18:15 - EXPECT_NEAR(0.9, LookUpScheduleValue(*state, ASchedIndex, 24, 4), 0.000001); // at 24:00 + EXPECT_NEAR(0.1, ASched->getHrTsVal(*state, 6, 4), 0.000001); // at 6:00 + EXPECT_NEAR(0.1, ASched->getHrTsVal(*state, 17, 1), 0.000001); // at 16:15 + EXPECT_NEAR(0.1, ASched->getHrTsVal(*state, 19, 1), 0.000001); // at 18:15 + EXPECT_NEAR(0.9, ASched->getHrTsVal(*state, 24, 4), 0.000001); // at 24:00 // Interpolation check - EXPECT_NEAR(0.4199999, LookUpScheduleValue(*state, ASchedIndex, 7, 2), 0.000001); // Value at 06:30 - EXPECT_NEAR(0.1000000, LookUpScheduleValue(*state, ASchedIndex, 18, 3), 0.000001); // Value at 06:30 - EXPECT_NEAR(0.8304347, LookUpScheduleValue(*state, ASchedIndex, 24, 2), 0.000001); // Value at 06:30 + EXPECT_NEAR(0.4199999, ASched->getHrTsVal(*state, 7, 2), 0.000001); // Value at 06:30 + EXPECT_NEAR(0.1000000, ASched->getHrTsVal(*state, 18, 3), 0.000001); // Value at 06:30 + EXPECT_NEAR(0.8304347, ASched->getHrTsVal(*state, 24, 2), 0.000001); // Value at 06:30 } TEST_F(EnergyPlusFixture, ScheduleDayInterval_LinearInterpIntervalNotTimestep) @@ -731,31 +740,35 @@ TEST_F(EnergyPlusFixture, ScheduleDayInterval_LinearInterpIntervalNotTimestep) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 4; - state->dataGlobal->MinutesPerTimeStep = 15; - state->dataGlobal->TimeStepZone = 0.25; + auto &s_glob = state->dataGlobal; + + s_glob->TimeStepsInHour = 4; + s_glob->MinutesInTimeStep = 15; + s_glob->TimeStepZone = 0.25; + + state->init_state(*state); state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 1; - state->dataGlobal->HourOfDay = 1; - state->dataGlobal->TimeStep = 1; + s_glob->HourOfDay = 1; + s_glob->TimeStep = 1; state->dataEnvrn->DSTIndicator = 0; state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - int ASchedIndex = GetScheduleIndex(*state, "SCHYR_A"); // interpolate Linear - EXPECT_NEAR(0.0, LookUpScheduleValue(*state, ASchedIndex, 7, 4), 0.000001); + auto *ASched = Sched::GetSchedule(*state, "SCHYR_A"); // interpolate Linear + EXPECT_NEAR(0.0, ASched->getHrTsVal(*state, 7, 4), 0.000001); // interpolate over first half hour - EXPECT_NEAR(25.0, LookUpScheduleValue(*state, ASchedIndex, 8, 1), 0.000001); - EXPECT_NEAR(50.0, LookUpScheduleValue(*state, ASchedIndex, 8, 2), 0.000001); + EXPECT_NEAR(25.0, ASched->getHrTsVal(*state, 8, 1), 0.000001); + EXPECT_NEAR(50.0, ASched->getHrTsVal(*state, 8, 2), 0.000001); // interpolate over second half hour - EXPECT_NEAR(75.0, LookUpScheduleValue(*state, ASchedIndex, 8, 3), 0.000001); - EXPECT_NEAR(100.0, LookUpScheduleValue(*state, ASchedIndex, 8, 4), 0.000001); + EXPECT_NEAR(75.0, ASched->getHrTsVal(*state, 8, 3), 0.000001); + EXPECT_NEAR(100.0, ASched->getHrTsVal(*state, 8, 4), 0.000001); } TEST_F(EnergyPlusFixture, ScheduleYearMaxItems) @@ -864,35 +877,38 @@ TEST_F(EnergyPlusFixture, Schedule_GetCurrentScheduleValue_DST) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 4; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized - state->dataGlobal->TimeStepZone = 0.25; - state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * Constant::SecInHour; + auto &s_glob = state->dataGlobal; - ScheduleManager::ProcessScheduleInput(*state); // read schedules + s_glob->TimeStepsInHour = 4; // must initialize this to get schedules initialized + s_glob->MinutesInTimeStep = 15; // must initialize this to get schedules initialized + s_glob->TimeStepZone = 0.25; + s_glob->TimeStepZoneSec = s_glob->TimeStepZone * Constant::rSecsInHour; + + state->init_state(*state); state->dataEnvrn->Month = 5; state->dataEnvrn->DayOfMonth = 31; - state->dataGlobal->HourOfDay = 24; + s_glob->HourOfDay = 24; state->dataEnvrn->DayOfWeek = 4; state->dataEnvrn->DayOfWeekTomorrow = 5; state->dataEnvrn->HolidayIndex = 0; - state->dataGlobal->TimeStep = 1; + s_glob->TimeStep = 1; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); state->dataEnvrn->DSTIndicator = 0; // DST IS OFF - ScheduleManager::UpdateScheduleValues(*state); - EXPECT_EQ(1.0, ScheduleManager::LookUpScheduleValue(*state, 1, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep)); - EXPECT_EQ(1.0, state->dataScheduleMgr->Schedule(1).CurrentValue); - EXPECT_EQ(1.0, ScheduleManager::GetCurrentScheduleValue(*state, 1)); + Sched::UpdateScheduleVals(*state); + + auto *sched = Sched::GetSchedule(*state, "ELECTRICITY SEASON SCHEDULE"); + + EXPECT_EQ(1.0, sched->getHrTsVal(*state, s_glob->HourOfDay, s_glob->TimeStep)); + EXPECT_EQ(1.0, sched->currentVal); state->dataEnvrn->DSTIndicator = 1; // DST IS ON - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // Since DST is on, you're actually on the next day, on 6/1 at 1:00 // so it **should** return 3.0 - EXPECT_EQ(3.0, state->dataScheduleMgr->Schedule(1).CurrentValue); - EXPECT_EQ(3.0, ScheduleManager::GetCurrentScheduleValue(*state, 1)); - EXPECT_EQ(3.0, ScheduleManager::LookUpScheduleValue(*state, 1, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep)); + EXPECT_EQ(3.0, sched->currentVal); + EXPECT_EQ(3.0, sched->getHrTsVal(*state, s_glob->HourOfDay, s_glob->TimeStep)); } TEST_F(EnergyPlusFixture, Schedule_GetCurrentScheduleValue_DST_SouthernHemisphere) @@ -913,40 +929,43 @@ TEST_F(EnergyPlusFixture, Schedule_GetCurrentScheduleValue_DST_SouthernHemispher ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 4; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized - state->dataGlobal->TimeStepZone = 0.25; - state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * Constant::SecInHour; + auto &s_glob = state->dataGlobal; + + s_glob->TimeStepsInHour = 4; // must initialize this to get schedules initialized + s_glob->MinutesInTimeStep = 15; // must initialize this to get schedules initialized + s_glob->TimeStepZone = 0.25; + s_glob->TimeStepZoneSec = s_glob->TimeStepZone * Constant::rSecsInHour; - ScheduleManager::ProcessScheduleInput(*state); // read schedules + state->init_state(*state); + + auto *sched = Sched::GetSchedule(*state, "ELECTRICITY SEASON SCHEDULE"); state->dataEnvrn->Month = 12; state->dataEnvrn->DayOfMonth = 31; - state->dataGlobal->HourOfDay = 24; + s_glob->HourOfDay = 24; state->dataEnvrn->DayOfWeek = 4; state->dataEnvrn->DayOfWeekTomorrow = 5; state->dataEnvrn->HolidayIndex = 0; - state->dataGlobal->TimeStep = 1; + s_glob->TimeStep = 1; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); state->dataEnvrn->DSTIndicator = 0; // DST IS OFF - ScheduleManager::UpdateScheduleValues(*state); - EXPECT_EQ(2.0, ScheduleManager::LookUpScheduleValue(*state, 1, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep)); - EXPECT_EQ(2.0, state->dataScheduleMgr->Schedule(1).CurrentValue); - EXPECT_EQ(2.0, ScheduleManager::GetCurrentScheduleValue(*state, 1)); + Sched::UpdateScheduleVals(*state); + EXPECT_EQ(2.0, sched->getHrTsVal(*state, s_glob->HourOfDay, s_glob->TimeStep)); + EXPECT_EQ(2.0, sched->currentVal); state->dataEnvrn->DSTIndicator = 1; // DST IS ON - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // Since DST is on, you're actually on the next day, which in this specific case should be 1/1 at 0:15 // so it **should** return 1.0 - EXPECT_EQ(1.0, state->dataScheduleMgr->Schedule(1).CurrentValue); - EXPECT_EQ(1.0, ScheduleManager::GetCurrentScheduleValue(*state, 1)); - EXPECT_EQ(1.0, ScheduleManager::LookUpScheduleValue(*state, 1, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep)); + EXPECT_EQ(1.0, sched->currentVal); + EXPECT_EQ(1.0, sched->getHrTsVal(*state, s_glob->HourOfDay, s_glob->TimeStep)); } TEST_F(EnergyPlusFixture, Schedule_GetCurrentScheduleValue_DST_RampUp_Leap) { - + auto &s_sched = state->dataSched; + auto &s_glob = state->dataGlobal; // So here we'll mimic using a Schedule:Compact that ramps up constantly // Schedule:Compact, @@ -978,66 +997,60 @@ TEST_F(EnergyPlusFixture, Schedule_GetCurrentScheduleValue_DST_RampUp_Leap) state->dataWeather->LeapYearAdd = 1; int nDays = 366; - state->dataGlobal->NumOfTimeStepInHour = 4; - - state->dataScheduleMgr->ScheduleInputProcessed = true; - EXPECT_TRUE(state->dataScheduleMgr->ScheduleInputProcessed); - state->dataScheduleMgr->NumSchedules = 1; - state->dataScheduleMgr->Schedule.allocate(state->dataScheduleMgr->NumSchedules); - - state->dataScheduleMgr->Schedule(1).WeekSchedulePointer.allocate(nDays); - state->dataScheduleMgr->WeekSchedule.allocate(nDays); - state->dataScheduleMgr->DaySchedule.allocate(nDays); - - for (int ScheduleIndex = 1; ScheduleIndex <= state->dataScheduleMgr->NumSchedules; ScheduleIndex++) { - for (int day = 1; day <= nDays; ++day) { - // int DayOfWeek = ((day-1) % 7) + 1; - state->dataScheduleMgr->Schedule(ScheduleIndex).WeekSchedulePointer(day) = day; - state->dataScheduleMgr->WeekSchedule(day).DaySchedulePointer.allocate(7); - for (int d = 1; d <= 7; ++d) { - state->dataScheduleMgr->WeekSchedule(day).DaySchedulePointer(d) = day; - } - state->dataScheduleMgr->DaySchedule(day).TSValue.allocate(4, 24); - for (int whichHour = 1; whichHour <= 24; whichHour++) { - for (int TS = 1; TS <= state->dataGlobal->NumOfTimeStepInHour; ++TS) { - state->dataScheduleMgr->DaySchedule(day).TSValue(TS, whichHour) = whichHour + (day - 1) * 24; + s_glob->TimeStepsInHour = 4; + + auto *sched1 = Sched::AddScheduleDetailed(*state, "SCHED-1"); + + for (int i = 1; i <= 366; ++i) { + Sched::AddWeekSchedule(*state, format("WEEK_{}", i)); + Sched::AddDaySchedule(*state, format("DAY_{}", i)); + } + + for (int day = 1; day <= 366; ++day) { + // int DayOfWeek = ((day-1) % 7) + 1; + auto *weekSched = sched1->weekScheds[day] = Sched::GetWeekSchedule(*state, format("WEEK_{}", day)); + + for (int d = 1; d <= 7; ++d) { + auto *daySched = weekSched->dayScheds[d] = Sched::GetDaySchedule(*state, format("DAY_{}", day)); + + for (int hr = 0; hr < Constant::iHoursInDay; hr++) { + for (int ts = 0; ts < s_glob->TimeStepsInHour; ++ts) { + daySched->tsVals[hr * s_glob->TimeStepsInHour + ts] = (hr + 1) + (day - 1) * Constant::iHoursInDay; } } } } - EXPECT_EQ(366, state->dataScheduleMgr->Schedule(1).WeekSchedulePointer(366)); - EXPECT_EQ(366, state->dataScheduleMgr->WeekSchedule(366).DaySchedulePointer(2)); - EXPECT_EQ(8784.0, state->dataScheduleMgr->DaySchedule(366).TSValue(4, 24)); + EXPECT_EQ(365, sched1->weekScheds[366]->Num); + EXPECT_EQ(365, Sched::GetWeekSchedule(*state, format("WEEK_{}", 366))->dayScheds[2]->Num); + EXPECT_EQ(8784.0, Sched::GetDaySchedule(*state, format("DAY_{}", 366))->tsVals[23 * s_glob->TimeStepsInHour + 3]); - state->dataGlobal->NumOfTimeStepInHour = state->dataGlobal->NumOfTimeStepInHour; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized - state->dataGlobal->TimeStepZone = 0.25; - state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * Constant::SecInHour; + s_glob->TimeStepsInHour = s_glob->TimeStepsInHour; // must initialize this to get schedules initialized + s_glob->MinutesInTimeStep = 15; // must initialize this to get schedules initialized + s_glob->TimeStepZone = 0.25; + s_glob->TimeStepZoneSec = s_glob->TimeStepZone * Constant::rSecsInHour; state->dataEnvrn->Month = 12; state->dataEnvrn->DayOfMonth = 31; - state->dataGlobal->HourOfDay = 24; + s_glob->HourOfDay = 24; state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->DayOfWeekTomorrow = 3; state->dataEnvrn->HolidayIndex = 0; - state->dataGlobal->TimeStep = 1; + s_glob->TimeStep = 1; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); EXPECT_EQ(366, state->dataEnvrn->DayOfYear_Schedule); state->dataEnvrn->DSTIndicator = 0; // DST IS OFF - ScheduleManager::UpdateScheduleValues(*state); - EXPECT_EQ(8784.0, ScheduleManager::LookUpScheduleValue(*state, 1, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep)); - EXPECT_EQ(8784.0, state->dataScheduleMgr->Schedule(1).CurrentValue); - EXPECT_EQ(8784.0, ScheduleManager::GetCurrentScheduleValue(*state, 1)); + Sched::UpdateScheduleVals(*state); + EXPECT_EQ(8784.0, sched1->getHrTsVal(*state, s_glob->HourOfDay, s_glob->TimeStep)); + EXPECT_EQ(8784.0, sched1->currentVal); state->dataEnvrn->DSTIndicator = 1; // DST IS ON - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // Since DST is on, you're actually on the next day, which in this specific case should be 1/1 at 0:15 // so it **should** return 1.0 - EXPECT_EQ(1.0, state->dataScheduleMgr->Schedule(1).CurrentValue); - EXPECT_EQ(1.0, ScheduleManager::GetCurrentScheduleValue(*state, 1)); - EXPECT_EQ(1.0, ScheduleManager::LookUpScheduleValue(*state, 1, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep)); + EXPECT_EQ(1.0, sched1->currentVal); + EXPECT_EQ(1.0, sched1->getHrTsVal(*state, s_glob->HourOfDay, s_glob->TimeStep)); Array1D_int EndDayOfMonth(12, {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}); @@ -1065,15 +1078,13 @@ TEST_F(EnergyPlusFixture, Schedule_GetCurrentScheduleValue_DST_RampUp_Leap) for (int hr = 1; hr <= 24; ++hr) { ++HourOfYear; - state->dataGlobal->HourOfDay = hr; + s_glob->HourOfDay = hr; for (int ts = 1; ts <= 4; ++ts) { - state->dataGlobal->TimeStep = ts; + s_glob->TimeStep = ts; - ScheduleManager::UpdateScheduleValues(*state); - EXPECT_EQ(HourOfYear, - ScheduleManager::LookUpScheduleValue(*state, 1, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep)); - EXPECT_EQ(HourOfYear, state->dataScheduleMgr->Schedule(1).CurrentValue); - EXPECT_EQ(HourOfYear, ScheduleManager::GetCurrentScheduleValue(*state, 1)); + Sched::UpdateScheduleVals(*state); + EXPECT_EQ(HourOfYear, sched1->getHrTsVal(*state, s_glob->HourOfDay, s_glob->TimeStep)); + EXPECT_EQ(HourOfYear, sched1->currentVal); } } } @@ -1105,19 +1116,17 @@ TEST_F(EnergyPlusFixture, Schedule_GetCurrentScheduleValue_DST_RampUp_Leap) for (int hr = 1; hr <= 24; ++hr) { ++HourOfYear; - state->dataGlobal->HourOfDay = hr; + s_glob->HourOfDay = hr; for (int ts = 1; ts <= 4; ++ts) { - state->dataGlobal->TimeStep = ts; + s_glob->TimeStep = ts; - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); int thisHourOfYear = HourOfYear + 1; if (thisHourOfYear > 8784.0) { thisHourOfYear = 1; } - EXPECT_EQ(thisHourOfYear, - ScheduleManager::LookUpScheduleValue(*state, 1, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep)); - EXPECT_EQ(thisHourOfYear, state->dataScheduleMgr->Schedule(1).CurrentValue); - EXPECT_EQ(thisHourOfYear, ScheduleManager::GetCurrentScheduleValue(*state, 1)); + EXPECT_EQ(thisHourOfYear, sched1->getHrTsVal(*state, s_glob->HourOfDay, s_glob->TimeStep)); + EXPECT_EQ(thisHourOfYear, sched1->currentVal); } } } @@ -1129,7 +1138,7 @@ TEST_F(EnergyPlusFixture, Schedule_GetCurrentScheduleValue_DST_RampUp_Leap) TEST_F(EnergyPlusFixture, Schedule_GetCurrentScheduleValue_DST_RampUp_NoLeap) { - + auto &s_glob = state->dataGlobal; // So here we'll mimic using a Schedule:Compact that ramps up constantly // Schedule:Compact, @@ -1162,17 +1171,14 @@ TEST_F(EnergyPlusFixture, Schedule_GetCurrentScheduleValue_DST_RampUp_NoLeap) // ScheduleManager always assume LeapYear really. int nDays = 365; - state->dataGlobal->NumOfTimeStepInHour = 4; + s_glob->TimeStepsInHour = 4; - state->dataScheduleMgr->ScheduleInputProcessed = true; - EXPECT_TRUE(state->dataScheduleMgr->ScheduleInputProcessed); - state->dataScheduleMgr->NumSchedules = 1; - state->dataScheduleMgr->Schedule.allocate(state->dataScheduleMgr->NumSchedules); + auto *sched1 = Sched::AddScheduleDetailed(*state, "SCHED-1"); - state->dataScheduleMgr->Schedule(1).WeekSchedulePointer.allocate(366); - state->dataScheduleMgr->Schedule(1).WeekSchedulePointer = -1; - state->dataScheduleMgr->WeekSchedule.allocate(366); - state->dataScheduleMgr->DaySchedule.allocate(nDays); // Here only creating 365 ScheduleDays + for (int i = 1; i <= 366; ++i) + Sched::AddWeekSchedule(*state, format("WEEK_{}", i)); + for (int i = 1; i <= 365; ++i) + Sched::AddDaySchedule(*state, format("DAY_{}", i)); Array1D_int EndDayOfMonth(12, {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}); @@ -1187,151 +1193,141 @@ TEST_F(EnergyPlusFixture, Schedule_GetCurrentScheduleValue_DST_RampUp_NoLeap) EXPECT_EQ(dayOfYear + 1, DayOfYear_Schedule); } - state->dataScheduleMgr->Schedule(1).WeekSchedulePointer(DayOfYear_Schedule) = DayOfYear_Schedule; - state->dataScheduleMgr->WeekSchedule(DayOfYear_Schedule).DaySchedulePointer.allocate(7); + auto *weekSched = sched1->weekScheds[DayOfYear_Schedule] = Sched::GetWeekSchedule(*state, format("WEEK_{}", DayOfYear_Schedule)); + auto *daySched = Sched::GetDaySchedule(*state, format("DAY_{}", dayOfYear)); for (int d = 1; d <= 7; ++d) { - state->dataScheduleMgr->WeekSchedule(DayOfYear_Schedule).DaySchedulePointer(d) = dayOfYear; + weekSched->dayScheds[d] = daySched; } - state->dataScheduleMgr->DaySchedule(dayOfYear).TSValue.allocate(4, 24); - for (int whichHour = 1; whichHour <= 24; whichHour++) { - for (int TS = 1; TS <= state->dataGlobal->NumOfTimeStepInHour; ++TS) { - state->dataScheduleMgr->DaySchedule(dayOfYear).TSValue(TS, whichHour) = whichHour + (dayOfYear - 1) * 24; + + for (int hr = 0; hr < Constant::iHoursInDay; hr++) { + for (int ts = 0; ts < s_glob->TimeStepsInHour; ++ts) { + daySched->tsVals[hr * s_glob->TimeStepsInHour + ts] = (hr + 1) + (dayOfYear - 1) * Constant::iHoursInDay; } } } } // Feb 28 - EXPECT_EQ(59, state->dataScheduleMgr->Schedule(1).WeekSchedulePointer(59)); - EXPECT_EQ(59, state->dataScheduleMgr->WeekSchedule(59).DaySchedulePointer(1)); - EXPECT_EQ(59 * 24.0, state->dataScheduleMgr->DaySchedule(59).TSValue(4, 24)); + EXPECT_EQ(58, sched1->weekScheds[59]->Num); + EXPECT_EQ(58, Sched::GetWeekSchedule(*state, "WEEK_59")->dayScheds[1]->Num); + EXPECT_EQ(59 * Constant::rHoursInDay, Sched::GetDaySchedule(*state, "DAY_59")->tsVals[23 * s_glob->TimeStepsInHour + 3]); // Feb 29: doesn't exist, and I default initialized everything above to -1 - EXPECT_EQ(-1, state->dataScheduleMgr->Schedule(1).WeekSchedulePointer(60)); + EXPECT_EQ(nullptr, sched1->weekScheds[60]); // ProcessSchedule would have treated the "Until: 3/1" to include the 2/29, so do that too. - state->dataScheduleMgr->Schedule(1).WeekSchedulePointer(60) = 61; + sched1->weekScheds[60] = Sched::GetWeekSchedule(*state, "WEEK_61"); // March 1 - EXPECT_EQ(61, state->dataScheduleMgr->Schedule(1).WeekSchedulePointer(61)); - EXPECT_EQ(60, state->dataScheduleMgr->WeekSchedule(61).DaySchedulePointer(1)); - EXPECT_EQ(60 * 24.0, state->dataScheduleMgr->DaySchedule(60).TSValue(4, 24)); + EXPECT_EQ(60, sched1->weekScheds[61]->Num); + EXPECT_EQ(59, sched1->weekScheds[61]->dayScheds[1]->Num); + EXPECT_EQ(60 * Constant::rHoursInDay, sched1->weekScheds[61]->dayScheds[1]->tsVals[23 * s_glob->TimeStepsInHour + 3]); - EXPECT_EQ(366, state->dataScheduleMgr->Schedule(1).WeekSchedulePointer(366)); - EXPECT_EQ(365, state->dataScheduleMgr->WeekSchedule(366).DaySchedulePointer(1)); - EXPECT_EQ(8760.0, state->dataScheduleMgr->DaySchedule(365).TSValue(4, 24)); + EXPECT_EQ(365, sched1->weekScheds[366]->Num); + EXPECT_EQ(364, sched1->weekScheds[366]->dayScheds[1]->Num); + EXPECT_EQ(8760.0, sched1->weekScheds[366]->dayScheds[1]->tsVals[23 * s_glob->TimeStepsInHour + 3]); - state->dataGlobal->NumOfTimeStepInHour = state->dataGlobal->NumOfTimeStepInHour; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized - state->dataGlobal->TimeStepZone = 0.25; - state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * Constant::SecInHour; + s_glob->TimeStepsInHour = s_glob->TimeStepsInHour; // must initialize this to get schedules initialized + s_glob->MinutesInTimeStep = 15; // must initialize this to get schedules initialized + s_glob->TimeStepZone = 0.25; + s_glob->TimeStepZoneSec = s_glob->TimeStepZone * Constant::rSecsInHour; state->dataEnvrn->Month = 12; state->dataEnvrn->DayOfMonth = 31; - state->dataGlobal->HourOfDay = 24; + s_glob->HourOfDay = 24; state->dataEnvrn->DayOfWeek = 1; state->dataEnvrn->DayOfWeekTomorrow = 2; state->dataEnvrn->HolidayIndex = 0; - state->dataGlobal->TimeStep = 1; + s_glob->TimeStep = 1; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); EXPECT_EQ(366, state->dataEnvrn->DayOfYear_Schedule); state->dataEnvrn->DSTIndicator = 0; // DST IS OFF - ScheduleManager::UpdateScheduleValues(*state); - EXPECT_EQ(8760.0, ScheduleManager::LookUpScheduleValue(*state, 1, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep)); - EXPECT_EQ(8760.0, state->dataScheduleMgr->Schedule(1).CurrentValue); - EXPECT_EQ(8760.0, ScheduleManager::GetCurrentScheduleValue(*state, 1)); + Sched::UpdateScheduleVals(*state); + EXPECT_EQ(8760.0, sched1->getHrTsVal(*state, s_glob->HourOfDay, s_glob->TimeStep)); + EXPECT_EQ(8760.0, sched1->currentVal); state->dataEnvrn->DSTIndicator = 1; // DST IS ON - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // Since DST is on, you're actually on the next day, which in this specific case should be 1/1 at 0:15 // so it **should** return 1.0 - EXPECT_EQ(1.0, state->dataScheduleMgr->Schedule(1).CurrentValue); - EXPECT_EQ(1.0, ScheduleManager::GetCurrentScheduleValue(*state, 1)); - EXPECT_EQ(1.0, ScheduleManager::LookUpScheduleValue(*state, 1, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep)); + EXPECT_EQ(1.0, sched1->currentVal); + EXPECT_EQ(1.0, sched1->getHrTsVal(*state, s_glob->HourOfDay, s_glob->TimeStep)); - { - state->dataEnvrn->DSTIndicator = 0; // DST IS OFF - state->dataEnvrn->DayOfWeek = 0; - state->dataEnvrn->DayOfWeekTomorrow = 1; + state->dataEnvrn->DSTIndicator = 0; // DST IS OFF + state->dataEnvrn->DayOfWeek = 0; + state->dataEnvrn->DayOfWeekTomorrow = 1; - Real64 HourOfYear = 0.0; - for (int month = 1; month <= 12; ++month) { - state->dataEnvrn->Month = month; - for (int day = 1; day <= EndDayOfMonth(month); ++day) { - state->dataEnvrn->DayOfMonth = day; - ++state->dataEnvrn->DayOfWeek; - if (state->dataEnvrn->DayOfWeek > 7) { - state->dataEnvrn->DayOfWeek = 1; - } - ++state->dataEnvrn->DayOfWeekTomorrow; - if (state->dataEnvrn->DayOfWeekTomorrow > 7) { - state->dataEnvrn->DayOfWeekTomorrow = 1; - } + Real64 HourOfYear = 0.0; + for (int month = 1; month <= 12; ++month) { + state->dataEnvrn->Month = month; + for (int day = 1; day <= EndDayOfMonth(month); ++day) { + state->dataEnvrn->DayOfMonth = day; + ++state->dataEnvrn->DayOfWeek; + if (state->dataEnvrn->DayOfWeek > 7) { + state->dataEnvrn->DayOfWeek = 1; + } + ++state->dataEnvrn->DayOfWeekTomorrow; + if (state->dataEnvrn->DayOfWeekTomorrow > 7) { + state->dataEnvrn->DayOfWeekTomorrow = 1; + } - state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); + state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - for (int hr = 1; hr <= 24; ++hr) { - ++HourOfYear; - state->dataGlobal->HourOfDay = hr; - for (int ts = 1; ts <= 4; ++ts) { - state->dataGlobal->TimeStep = ts; + for (int hr = 1; hr <= Constant::iHoursInDay; ++hr) { + ++HourOfYear; + s_glob->HourOfDay = hr; + for (int ts = 1; ts <= s_glob->TimeStepsInHour; ++ts) { + s_glob->TimeStep = ts; - ScheduleManager::UpdateScheduleValues(*state); - EXPECT_EQ(HourOfYear, - ScheduleManager::LookUpScheduleValue(*state, 1, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep)); - EXPECT_EQ(HourOfYear, state->dataScheduleMgr->Schedule(1).CurrentValue); - EXPECT_EQ(HourOfYear, ScheduleManager::GetCurrentScheduleValue(*state, 1)); - } + Sched::UpdateScheduleVals(*state); + EXPECT_EQ(HourOfYear, sched1->getHrTsVal(*state, s_glob->HourOfDay, s_glob->TimeStep)); + EXPECT_EQ(HourOfYear, sched1->currentVal); } } } - - EXPECT_EQ(8760.0, HourOfYear); } - { - state->dataEnvrn->DSTIndicator = 1; // DST IS ON - state->dataEnvrn->DayOfWeek = 0; - state->dataEnvrn->DayOfWeekTomorrow = 1; + EXPECT_EQ(8760.0, HourOfYear); - Real64 HourOfYear = 0.0; - for (int month = 1; month <= 12; ++month) { - state->dataEnvrn->Month = month; - for (int day = 1; day <= EndDayOfMonth(month); ++day) { - state->dataEnvrn->DayOfMonth = day; - ++state->dataEnvrn->DayOfWeek; - if (state->dataEnvrn->DayOfWeek > 7) { - state->dataEnvrn->DayOfWeek = 1; - } - ++state->dataEnvrn->DayOfWeekTomorrow; - if (state->dataEnvrn->DayOfWeekTomorrow > 7) { - state->dataEnvrn->DayOfWeekTomorrow = 1; - } + state->dataEnvrn->DSTIndicator = 1; // DST IS ON + state->dataEnvrn->DayOfWeek = 0; + state->dataEnvrn->DayOfWeekTomorrow = 1; - state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); + HourOfYear = 0.0; + for (int month = 1; month <= 12; ++month) { + state->dataEnvrn->Month = month; + for (int day = 1; day <= EndDayOfMonth(month); ++day) { + state->dataEnvrn->DayOfMonth = day; + ++state->dataEnvrn->DayOfWeek; + if (state->dataEnvrn->DayOfWeek > 7) { + state->dataEnvrn->DayOfWeek = 1; + } + ++state->dataEnvrn->DayOfWeekTomorrow; + if (state->dataEnvrn->DayOfWeekTomorrow > 7) { + state->dataEnvrn->DayOfWeekTomorrow = 1; + } - for (int hr = 1; hr <= 24; ++hr) { - ++HourOfYear; - state->dataGlobal->HourOfDay = hr; - for (int ts = 1; ts <= 4; ++ts) { - state->dataGlobal->TimeStep = ts; + state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(*state); - int thisHourOfYear = HourOfYear + 1; - if (thisHourOfYear > 8760.0) { - thisHourOfYear = 1; - } - EXPECT_EQ(thisHourOfYear, - ScheduleManager::LookUpScheduleValue(*state, 1, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep)); - EXPECT_EQ(thisHourOfYear, state->dataScheduleMgr->Schedule(1).CurrentValue); - EXPECT_EQ(thisHourOfYear, ScheduleManager::GetCurrentScheduleValue(*state, 1)); + for (int hr = 1; hr <= 24; ++hr) { + ++HourOfYear; + s_glob->HourOfDay = hr; + for (int ts = 1; ts <= 4; ++ts) { + s_glob->TimeStep = ts; + + Sched::UpdateScheduleVals(*state); + int thisHourOfYear = HourOfYear + 1; + if (thisHourOfYear > 8760.0) { + thisHourOfYear = 1; } + EXPECT_EQ(thisHourOfYear, sched1->getHrTsVal(*state, s_glob->HourOfDay, s_glob->TimeStep)); + EXPECT_EQ(thisHourOfYear, sched1->currentVal); } } } - - EXPECT_EQ(8760.0, HourOfYear); } + + EXPECT_EQ(8760.0, HourOfYear); } TEST_F(EnergyPlusFixture, ScheduleFileDSTtoggleOptionTest) @@ -1404,58 +1400,58 @@ TEST_F(EnergyPlusFixture, ScheduleFileDSTtoggleOptionTest) // This will process the provided idf chunk within the test fixture (must pass this step in order to proceed) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - state->dataGlobal->TimeStep = 1; // Checking to see if omitting this is OK here + auto &s_glob = state->dataGlobal; + + s_glob->TimeStepsInHour = 1; + s_glob->MinutesInTimeStep = 60; + s_glob->TimeStep = 1; // Checking to see if omitting this is OK here + + state->init_state(*state); + state->dataEnvrn->DayOfWeek = 1; // Sunday state->dataEnvrn->DayOfWeekTomorrow = 2; // Monday state->dataEnvrn->DayOfYear_Schedule = 1; - state->dataGlobal->HourOfDay = 24; + s_glob->HourOfDay = 24; // Test 1 condition // "YES" Adjusts schedule for daylight savings - const int sch1idx = GetScheduleIndex(*state, "TEST1"); // Index of the IDF schedule object identified and stored into schdl1idx variable - ScheduleManager::ScheduleData &sch1 = - state->dataScheduleMgr->Schedule(sch1idx); // sch1 reference initialized that points to the specific schedule of interest - EXPECT_TRUE(sch1.UseDaylightSaving); // Checks that the member variable got set correctly. + auto const *sch1 = dynamic_cast(Sched::GetSchedule(*state, "TEST1")); + EXPECT_TRUE(sch1->UseDaylightSaving); // Checks that the member variable got set correctly. state->dataEnvrn->DSTIndicator = 1; // Tells the simulation that we're currently observing daylight savings - EXPECT_DOUBLE_EQ(ScheduleManager::LookUpScheduleValue(*state, sch1idx, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep), 0.0); + EXPECT_DOUBLE_EQ(sch1->getHrTsVal(*state, s_glob->HourOfDay, s_glob->TimeStep), 0.0); state->dataEnvrn->DSTIndicator = 0; // Tells the simulation that we're NOT currently observing daylight savings - EXPECT_DOUBLE_EQ(ScheduleManager::LookUpScheduleValue(*state, sch1idx, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep), 1.0); + EXPECT_DOUBLE_EQ(sch1->getHrTsVal(*state, s_glob->HourOfDay, s_glob->TimeStep), 1.0); // Test 2 condition // "NO" Does not adjust for daylight savings - const int sch2idx = GetScheduleIndex(*state, "TEST2"); - ScheduleManager::ScheduleData &sch2 = state->dataScheduleMgr->Schedule(sch2idx); - EXPECT_FALSE(sch2.UseDaylightSaving); + auto const *sch2 = dynamic_cast(Sched::GetSchedule(*state, "TEST2")); + EXPECT_FALSE(sch2->UseDaylightSaving); state->dataEnvrn->DSTIndicator = 1; // Tells the simulation that we're currently observing daylight savings - EXPECT_DOUBLE_EQ(ScheduleManager::LookUpScheduleValue(*state, sch2idx, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep), 1.0); + EXPECT_DOUBLE_EQ(sch2->getHrTsVal(*state, s_glob->HourOfDay, s_glob->TimeStep), 1.0); state->dataEnvrn->DSTIndicator = 0; // Tells the simulation that we're NOT currently observing daylight savings - EXPECT_DOUBLE_EQ(ScheduleManager::LookUpScheduleValue(*state, sch2idx, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep), 1.0); + EXPECT_DOUBLE_EQ(sch2->getHrTsVal(*state, s_glob->HourOfDay, s_glob->TimeStep), 1.0); // Test 3 condition // Default: "YES", changes schedule for daylight savings - const int sch3idx = GetScheduleIndex(*state, "TEST3"); - ScheduleManager::ScheduleData &sch3 = state->dataScheduleMgr->Schedule(sch3idx); - EXPECT_TRUE(sch3.UseDaylightSaving); + auto const *sch3 = dynamic_cast(Sched::GetSchedule(*state, "TEST3")); + EXPECT_TRUE(sch3->UseDaylightSaving); state->dataEnvrn->DSTIndicator = 1; // Tells the simulation that we're currently observing daylight savings - EXPECT_DOUBLE_EQ(ScheduleManager::LookUpScheduleValue(*state, sch3idx, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep), 0.0); + EXPECT_DOUBLE_EQ(sch3->getHrTsVal(*state, s_glob->HourOfDay, s_glob->TimeStep), 0.0); state->dataEnvrn->DSTIndicator = 0; // Tells the simulation that we're NOT currently observing daylight savings - EXPECT_DOUBLE_EQ(ScheduleManager::LookUpScheduleValue(*state, sch3idx, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep), 1.0); + EXPECT_DOUBLE_EQ(sch3->getHrTsVal(*state, s_glob->HourOfDay, s_glob->TimeStep), 1.0); // Test 4 condition // Default: "YES", changes schedule for daylight savings - const int sch4idx = GetScheduleIndex(*state, "TEST4"); // Index of the IDF schedule object identified - ScheduleManager::ScheduleData &sch4 = state->dataScheduleMgr->Schedule(sch4idx); // sch1 object initialized of type ScheduleData - EXPECT_TRUE(sch4.UseDaylightSaving); // Checks that the member variable got set correctly. + auto const *sch4 = dynamic_cast(Sched::GetSchedule(*state, "TEST4")); + EXPECT_TRUE(sch4->UseDaylightSaving); // Checks that the member variable got set correctly. state->dataEnvrn->DSTIndicator = 1; // Tells the simulation that we're currently observing daylight savings - EXPECT_DOUBLE_EQ(ScheduleManager::LookUpScheduleValue(*state, sch4idx, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep), 0.0); + EXPECT_DOUBLE_EQ(sch4->getHrTsVal(*state, s_glob->HourOfDay, s_glob->TimeStep), 0.0); state->dataEnvrn->DSTIndicator = 0; // Tells the simulation that we're NOT currently observing daylight savings - EXPECT_DOUBLE_EQ(ScheduleManager::LookUpScheduleValue(*state, sch4idx, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep), 1.0); + EXPECT_DOUBLE_EQ(sch4->getHrTsVal(*state, s_glob->HourOfDay, s_glob->TimeStep), 1.0); } TEST_F(EnergyPlusFixture, ScheduleFile_Blanks) @@ -1479,15 +1475,20 @@ TEST_F(EnergyPlusFixture, ScheduleFile_Blanks) }); ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 4; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized - state->dataGlobal->TimeStepZone = 0.25; - state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * Constant::SecInHour; + auto &s_glob = state->dataGlobal; + + s_glob->TimeStepsInHour = 4; // must initialize this to get schedules initialized + s_glob->MinutesInTimeStep = 15; // must initialize this to get schedules initialized + s_glob->TimeStepZone = 0.25; + s_glob->TimeStepZoneSec = s_glob->TimeStepZone * Constant::rSecsInHour; state->dataEnvrn->CurrentYearIsLeapYear = false; - ASSERT_THROW(ScheduleManager::ProcessScheduleInput(*state), EnergyPlus::FatalError); // read schedules + ASSERT_THROW(state->init_state(*state), EnergyPlus::FatalError); // read schedules const std::string expected_error = delimited_string({ + " ** Warning ** ProcessScheduleInput: Schedule:File = TEST1", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", " ** Severe ** CsvParser - Line 3 - Expected 3 columns, got 2. Error in following line.", " ** ~~~ ** 1,,0.33", " ** ~~~ ** Error Occurred in " + scheduleFile.string(), @@ -1512,14 +1513,16 @@ TEST_F(EnergyPlusFixture, ShadowCalculation_CSV_extra_parenthesis) }); ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 4; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized - state->dataGlobal->TimeStepZone = 0.25; - state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * Constant::SecInHour; - state->dataEnvrn->CurrentYearIsLeapYear = false; + auto &s_glob = state->dataGlobal; + auto &s_sched = state->dataSched; - EXPECT_FALSE(state->dataScheduleMgr->ScheduleFileShadingProcessed); - ScheduleManager::ProcessScheduleInput(*state); // read schedules + s_glob->TimeStepsInHour = 4; // must initialize this to get schedules initialized + s_glob->MinutesInTimeStep = 15; // must initialize this to get schedules initialized + s_glob->TimeStepZone = 0.25; + s_glob->TimeStepZoneSec = s_glob->TimeStepZone * Constant::rSecsInHour; + state->init_state(*state); + + state->dataEnvrn->CurrentYearIsLeapYear = false; const std::string expected_error = delimited_string({ " ** Warning ** ProcessScheduleInput: Schedule:File:Shading=\"" + scheduleFile.string() + @@ -1528,13 +1531,13 @@ TEST_F(EnergyPlusFixture, ShadowCalculation_CSV_extra_parenthesis) }); compare_err_stream(expected_error); - EXPECT_TRUE(state->dataScheduleMgr->ScheduleFileShadingProcessed); - EXPECT_EQ(1, state->dataScheduleMgr->NumSchedules); - EXPECT_EQ(366, state->dataScheduleMgr->NumWeekSchedules); - EXPECT_EQ(366, state->dataScheduleMgr->NumDaySchedules); - EXPECT_EQ(1, state->dataScheduleMgr->UniqueProcessedExternalFiles.size()); + EXPECT_TRUE(s_sched->ScheduleFileShadingProcessed); + EXPECT_EQ(3, s_sched->schedules.size()); // AlwaysOn, AlwaysOff, plus file + EXPECT_EQ(365, s_sched->weekSchedules.size()); + EXPECT_EQ(365, s_sched->daySchedules.size()); + EXPECT_EQ(1, s_sched->UniqueProcessedExternalFiles.size()); - auto &[fPath, root] = *(state->dataScheduleMgr->UniqueProcessedExternalFiles.begin()); + auto &[fPath, root] = *(s_sched->UniqueProcessedExternalFiles.begin()); EXPECT_EQ(scheduleFile, fPath); EXPECT_EQ(2, root["header"].size()); const std::set expectedHeaders{"Surface Name", "EAST SIDE TREE"}; @@ -1553,31 +1556,32 @@ TEST_F(EnergyPlusFixture, ShadowCalculation_CSV_extra_parenthesis) EXPECT_EQ("12/31 24:00", root["values"].at(0).at(8760 * 4 - 1).get()); EXPECT_EQ(0.00000000, root["values"].at(1).at(8760 * 4 - 1).get()); - std::string curName = "EAST SIDE TREE_shading"; - EXPECT_EQ("EAST SIDE TREE_shading_wk_1", state->dataScheduleMgr->WeekSchedule(1).Name); - EXPECT_EQ("EAST SIDE TREE_shading_wk_59", state->dataScheduleMgr->WeekSchedule(59).Name); - EXPECT_EQ("EAST SIDE TREE_shading_wk_61", state->dataScheduleMgr->WeekSchedule(60).Name); - EXPECT_EQ("EAST SIDE TREE_shading_wk_62", state->dataScheduleMgr->WeekSchedule(61).Name); - EXPECT_EQ("EAST SIDE TREE_shading_wk_366", state->dataScheduleMgr->WeekSchedule(365).Name); - - EXPECT_EQ("EAST SIDE TREE_shading_dy_1", state->dataScheduleMgr->DaySchedule(1).Name); - EXPECT_EQ("EAST SIDE TREE_shading_dy_59", state->dataScheduleMgr->DaySchedule(59).Name); - EXPECT_EQ("EAST SIDE TREE_shading_dy_61", state->dataScheduleMgr->DaySchedule(60).Name); - EXPECT_EQ("EAST SIDE TREE_shading_dy_62", state->dataScheduleMgr->DaySchedule(61).Name); - EXPECT_EQ("EAST SIDE TREE_shading_dy_366", state->dataScheduleMgr->DaySchedule(365).Name); - - EXPECT_EQ(1, state->dataScheduleMgr->Schedule(1).WeekSchedulePointer(1)); - EXPECT_EQ(59, state->dataScheduleMgr->Schedule(1).WeekSchedulePointer(59)); - EXPECT_EQ(59, state->dataScheduleMgr->Schedule(1).WeekSchedulePointer(60)); // 29 Feb points to 28 Feb - EXPECT_EQ(365, state->dataScheduleMgr->Schedule(1).WeekSchedulePointer(366)); - - for (int iDay = 1; iDay <= 365; ++iDay) { - if (iDay <= 59) { - EXPECT_EQ(fmt::format("{}_wk_{}", curName, iDay), state->dataScheduleMgr->WeekSchedule(iDay).Name); - EXPECT_EQ(fmt::format("{}_dy_{}", curName, iDay), state->dataScheduleMgr->DaySchedule(iDay).Name); + EXPECT_EQ(Sched::GetWeekScheduleNum(*state, "EAST SIDE TREE_SHADING_WK_1"), 0); + EXPECT_EQ(Sched::GetWeekScheduleNum(*state, "EAST SIDE TREE_SHADING_WK_59"), 58); + EXPECT_EQ(Sched::GetWeekScheduleNum(*state, "EAST SIDE TREE_SHADING_WK_61"), 59); + EXPECT_EQ(Sched::GetWeekScheduleNum(*state, "EAST SIDE TREE_SHADING_WK_62"), 60); + EXPECT_EQ(Sched::GetWeekScheduleNum(*state, "EAST SIDE TREE_SHADING_WK_366"), 364); + + EXPECT_EQ(Sched::GetDayScheduleNum(*state, "EAST SIDE TREE_SHADING_DY_1"), 0); + EXPECT_EQ(Sched::GetDayScheduleNum(*state, "EAST SIDE TREE_SHADING_DY_59"), 58); + EXPECT_EQ(Sched::GetDayScheduleNum(*state, "EAST SIDE TREE_SHADING_DY_61"), 59); + EXPECT_EQ(Sched::GetDayScheduleNum(*state, "EAST SIDE TREE_SHADING_DY_62"), 60); + EXPECT_EQ(Sched::GetDayScheduleNum(*state, "EAST SIDE TREE_SHADING_DY_366"), 364); + + auto const *sched = dynamic_cast(Sched::GetSchedule(*state, "EAST SIDE TREE_SHADING")); + + EXPECT_EQ(0, sched->weekScheds[1]->Num); + EXPECT_EQ(58, sched->weekScheds[59]->Num); + EXPECT_EQ(58, sched->weekScheds[60]->Num); // 29 Feb points to 28 Feb + EXPECT_EQ(364, sched->weekScheds[366]->Num); + + for (int iDay = 0; iDay < 365; ++iDay) { + if (iDay <= 58) { + EXPECT_EQ(fmt::format("EAST SIDE TREE_shading_wk_{}", iDay + 1), s_sched->weekSchedules[iDay]->Name); + EXPECT_EQ(fmt::format("EAST SIDE TREE_shading_dy_{}", iDay + 1), s_sched->daySchedules[iDay]->Name); } else { - EXPECT_EQ(fmt::format("{}_wk_{}", curName, iDay + 1), state->dataScheduleMgr->WeekSchedule(iDay).Name); - EXPECT_EQ(fmt::format("{}_dy_{}", curName, iDay + 1), state->dataScheduleMgr->DaySchedule(iDay).Name); + EXPECT_EQ(fmt::format("EAST SIDE TREE_shading_wk_{}", iDay + 2), s_sched->weekSchedules[iDay]->Name); + EXPECT_EQ(fmt::format("EAST SIDE TREE_shading_dy_{}", iDay + 2), s_sched->daySchedules[iDay]->Name); } } @@ -1585,25 +1589,25 @@ TEST_F(EnergyPlusFixture, ShadowCalculation_CSV_extra_parenthesis) int iDay = 1; int TS = 1; int iHour = 1; - EXPECT_EQ(0.00000000, state->dataScheduleMgr->DaySchedule(iDay).TSValue(TS, iHour)); + EXPECT_EQ(0.00000000, s_sched->daySchedules[(iDay - 1)]->tsVals[(iHour - 1) * s_glob->TimeStepsInHour + (TS - 1)]); // 01/01 13:00 iDay = 1; TS = 4; iHour = 13; - EXPECT_EQ(0.96107882, state->dataScheduleMgr->DaySchedule(iDay).TSValue(TS, iHour)); + EXPECT_EQ(0.96107882, s_sched->daySchedules[(iDay - 1)]->tsVals[(iHour - 1) * s_glob->TimeStepsInHour + (TS - 1)]); // 12/31 16:15,0.19556231, iDay = 365; TS = 1; iHour = 17; - EXPECT_EQ(0.19556231, state->dataScheduleMgr->DaySchedule(iDay).TSValue(TS, iHour)); + EXPECT_EQ(0.19556231, s_sched->daySchedules[(iDay - 1)]->tsVals[(iHour - 1) * s_glob->TimeStepsInHour + (TS - 1)]); // 12/31 24:00 iDay = 365; TS = 4; iHour = 24; - EXPECT_EQ(0.00000000, state->dataScheduleMgr->DaySchedule(iDay).TSValue(TS, iHour)); + EXPECT_EQ(0.00000000, s_sched->daySchedules[(iDay - 1)]->tsVals[(iHour - 1) * s_glob->TimeStepsInHour + (TS - 1)]); } TEST_F(EnergyPlusFixture, getScheduleMinMaxByDayType_test) @@ -1667,59 +1671,63 @@ TEST_F(EnergyPlusFixture, getScheduleMinMaxByDayType_test) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 4; - state->dataGlobal->MinutesPerTimeStep = 15; - state->dataGlobal->TimeStepZone = 0.25; + auto &s_glob = state->dataGlobal; + + s_glob->TimeStepsInHour = 4; + s_glob->MinutesInTimeStep = 15; + s_glob->TimeStepZone = 0.25; + + state->init_state(*state); Real64 schMin; Real64 schMax; - std::tie(schMin, schMax) = getScheduleMinMaxByDayType(*state, -1, DayTypeGroup::Weekday); + std::tie(schMin, schMax) = Sched::GetScheduleAlwaysOn(*state)->getMinMaxValsByDayType(*state, Sched::DayTypeGroup::Weekday); EXPECT_EQ(1.0, schMin); EXPECT_EQ(1.0, schMax); - std::tie(schMin, schMax) = getScheduleMinMaxByDayType(*state, 0, DayTypeGroup::Weekday); + std::tie(schMin, schMax) = Sched::GetScheduleAlwaysOff(*state)->getMinMaxValsByDayType(*state, Sched::DayTypeGroup::Weekday); EXPECT_EQ(0.0, schMin); EXPECT_EQ(0.0, schMax); - int index = GetScheduleIndex(*state, "HIGHLOW01"); + auto *sched = Sched::GetSchedule(*state, "HIGHLOW01"); - std::tie(schMin, schMax) = getScheduleMinMaxByDayType(*state, index, DayTypeGroup::Weekday); + std::tie(schMin, schMax) = sched->getMinMaxValsByDayType(*state, Sched::DayTypeGroup::Weekday); EXPECT_EQ(0.40, schMin); EXPECT_EQ(0.87, schMax); // repeat test to see if using cached values - std::tie(schMin, schMax) = getScheduleMinMaxByDayType(*state, index, DayTypeGroup::Weekday); + std::tie(schMin, schMax) = sched->getMinMaxValsByDayType(*state, Sched::DayTypeGroup::Weekday); EXPECT_EQ(0.40, schMin); EXPECT_EQ(0.87, schMax); - std::tie(schMin, schMax) = getScheduleMinMaxByDayType(*state, index, DayTypeGroup::WeekEndHoliday); + std::tie(schMin, schMax) = sched->getMinMaxValsByDayType(*state, Sched::DayTypeGroup::WeekEndHoliday); EXPECT_EQ(0.30, schMin); EXPECT_EQ(0.83, schMax); - std::tie(schMin, schMax) = getScheduleMinMaxByDayType(*state, index, DayTypeGroup::SummerDesignDay); + std::tie(schMin, schMax) = sched->getMinMaxValsByDayType(*state, Sched::DayTypeGroup::SummerDesignDay); EXPECT_EQ(0.85, schMin); EXPECT_EQ(0.95, schMax); - std::tie(schMin, schMax) = getScheduleMinMaxByDayType(*state, index, DayTypeGroup::WinterDesignDay); + std::tie(schMin, schMax) = sched->getMinMaxValsByDayType(*state, Sched::DayTypeGroup::WinterDesignDay); EXPECT_EQ(0.15, schMin); EXPECT_EQ(0.17, schMax); - index = GetScheduleIndex(*state, "HIGHLOW02"); + sched = Sched::GetSchedule(*state, "HIGHLOW02"); - std::tie(schMin, schMax) = getScheduleMinMaxByDayType(*state, index, DayTypeGroup::Weekday); + std::tie(schMin, schMax) = sched->getMinMaxValsByDayType(*state, Sched::DayTypeGroup::Weekday); EXPECT_EQ(0.21, schMin); EXPECT_EQ(0.73, schMax); - std::tie(schMin, schMax) = getScheduleMinMaxByDayType(*state, index, DayTypeGroup::WeekEndHoliday); + std::tie(schMin, schMax) = sched->getMinMaxValsByDayType(*state, Sched::DayTypeGroup::WeekEndHoliday); EXPECT_EQ(0.27, schMin); EXPECT_EQ(0.65, schMax); - std::tie(schMin, schMax) = getScheduleMinMaxByDayType(*state, index, DayTypeGroup::SummerDesignDay); + std::tie(schMin, schMax) = sched->getMinMaxValsByDayType(*state, Sched::DayTypeGroup::SummerDesignDay); EXPECT_EQ(0.76, schMin); EXPECT_EQ(0.85, schMax); - std::tie(schMin, schMax) = getScheduleMinMaxByDayType(*state, index, DayTypeGroup::WinterDesignDay); + std::tie(schMin, schMax) = sched->getMinMaxValsByDayType(*state, Sched::DayTypeGroup::WinterDesignDay); EXPECT_EQ(0.16, schMin); EXPECT_EQ(0.25, schMax); } diff --git a/tst/EnergyPlus/unit/SecondaryDXCoils.unit.cc b/tst/EnergyPlus/unit/SecondaryDXCoils.unit.cc index 0d1be41fe0d..010414d99c8 100644 --- a/tst/EnergyPlus/unit/SecondaryDXCoils.unit.cc +++ b/tst/EnergyPlus/unit/SecondaryDXCoils.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -67,7 +67,6 @@ using namespace EnergyPlus; using namespace DXCoils; -using Psychrometrics::InitializePsychRoutines; using Psychrometrics::PsyHFnTdbW; using Psychrometrics::PsyRhoAirFnPbTdbW; using Psychrometrics::PsyTwbFnTdbWPb; @@ -143,6 +142,7 @@ TEST_F(EnergyPlusFixture, SecondaryDXCoolingCoilMultiSpeed_Test3) TEST_F(EnergyPlusFixture, SecondaryDXHeatingCoilSingleSpeed_Test4) { // tests secondary DX coil calculation of single speed heat pump + state->init_state(*state); int DXCoilNum; state->dataDXCoils->NumDXCoils = 1; @@ -169,7 +169,6 @@ TEST_F(EnergyPlusFixture, SecondaryDXHeatingCoilSingleSpeed_Test4) state->dataEnvrn->OutBaroPress = 101325.0; state->dataDXCoils->DXCoil(DXCoilNum).AirInNode = 2; state->dataLoopNodes->Node(state->dataDXCoils->DXCoil(DXCoilNum).AirInNode).Temp = 20.0; - InitializePsychRoutines(*state); CalcSecondaryDXCoils(*state, DXCoilNum); EXPECT_DOUBLE_EQ(-5000.0, state->dataDXCoils->DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate); @@ -214,10 +213,12 @@ TEST_F(EnergyPlusFixture, SecondaryDXHeatingCoilSingleSpeed_Test4) state->dataDXCoils->DXCoil.deallocate(); state->dataLoopNodes->Node.deallocate(); } + TEST_F(EnergyPlusFixture, SecondaryDXHeatingCoilMultiSpeed_Test5) { - // tests secondary DX coil calculation of multi speed heat pump + state->init_state(*state); + int DXCoilNum; state->dataDXCoils->NumDXCoils = 1; @@ -260,7 +261,6 @@ TEST_F(EnergyPlusFixture, SecondaryDXHeatingCoilMultiSpeed_Test5) state->dataEnvrn->OutBaroPress = 101325.0; state->dataDXCoils->DXCoil(DXCoilNum).AirInNode = 2; state->dataLoopNodes->Node(state->dataDXCoils->DXCoil(DXCoilNum).AirInNode).Temp = 20.0; - InitializePsychRoutines(*state); CalcSecondaryDXCoils(*state, DXCoilNum); EXPECT_DOUBLE_EQ(-5000.0, state->dataDXCoils->DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate); diff --git a/tst/EnergyPlus/unit/SetPointManager.unit.cc b/tst/EnergyPlus/unit/SetPointManager.unit.cc index b2786517313..2450e5d4e90 100644 --- a/tst/EnergyPlus/unit/SetPointManager.unit.cc +++ b/tst/EnergyPlus/unit/SetPointManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -87,11 +87,12 @@ using namespace EnergyPlus; TEST_F(EnergyPlusFixture, SetPointManager_DefineReturnWaterChWSetPointManager) { + state->dataFluid->init_state(*state); // Set up the required plant loop data state->dataPlnt->TotNumLoops = 1; state->dataPlnt->PlantLoop.allocate(1); - state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).NodeNumIn = 1; // Supply inlet, return state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).NodeNumOut = 2; // Supply outlet, supply @@ -189,15 +190,18 @@ TEST_F(EnergyPlusFixture, SetPointManager_DefineReturnWaterChWSetPointManager_Fl ASSERT_TRUE(process_idf(idf_objects)); - EXPECT_EQ(2, state->dataFluidProps->glycols.isize()); - const auto *glycol = state->dataFluidProps->glycols(2); + state->init_state(*state); + + EXPECT_EQ(2, state->dataFluid->glycols.isize()); + const auto *glycol = state->dataFluid->glycols(2); + EXPECT_EQ("ETHYLENEGLYCOL40PERCENT", glycol->Name); EXPECT_EQ("ETHYLENEGLYCOL", glycol->GlycolName); // Set up the required plant loop data state->dataPlnt->TotNumLoops = 1; state->dataPlnt->PlantLoop.allocate(1); - state->dataPlnt->PlantLoop(1).FluidIndex = 2; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetGlycol(*state, "ETHYLENEGLYCOL40PERCENT"); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).NodeNumIn = 1; // Supply inlet, return state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).NodeNumOut = 2; // Supply outlet, supply @@ -253,10 +257,11 @@ TEST_F(EnergyPlusFixture, SetPointManager_DefineReturnWaterChWSetPointManager_Fl TEST_F(EnergyPlusFixture, SetPointManager_DefineReturnWaterHWSetPointManager) { + state->dataFluid->init_state(*state); // Set up the required plant loop data state->dataPlnt->TotNumLoops = 1; state->dataPlnt->PlantLoop.allocate(1); - state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).NodeNumIn = 1; // Supply inlet, return state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).NodeNumOut = 2; // Supply outlet, supply @@ -407,14 +412,15 @@ TEST_F(EnergyPlusFixture, SetPointManager_DefineCondEntSetPointManager) "For: AllDays, !- Field 2", "Until: 24:00,30.0; !- Field 3"}); ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 4; - state->dataGlobal->MinutesPerTimeStep = 60 / state->dataGlobal->NumOfTimeStepInHour; - ScheduleManager::ProcessScheduleInput(*state); + state->dataGlobal->TimeStepsInHour = 4; + state->dataGlobal->MinutesInTimeStep = 60 / state->dataGlobal->TimeStepsInHour; + state->init_state(*state); + state->dataGlobal->TimeStep = 1; state->dataGlobal->HourOfDay = 1; state->dataEnvrn->DayOfWeek = 1; state->dataEnvrn->DayOfYear_Schedule = 1; - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // a few constants for convenience int constexpr evapOutletNodeNum = 1; @@ -465,7 +471,7 @@ TEST_F(EnergyPlusFixture, SetPointManager_DefineCondEntSetPointManager) thisSPM.minTowerDesignWetBulbCurveNum = Curve::GetCurveIndex(*state, "MINDSNWBCURVENAME"); thisSPM.minOAWetBulbCurveNum = Curve::GetCurveIndex(*state, "MINACTWBCURVENAME"); thisSPM.optCondenserEnteringTempCurveNum = Curve::GetCurveIndex(*state, "OPTCONDENTCURVENAME"); - thisSPM.condenserEnteringTempSchedNum = ScheduleManager::GetScheduleIndex(*state, "CONDENSER LOOP TEMP SCHEDULE"); + thisSPM.condenserEnteringTempSched = Sched::GetSchedule(*state, "CONDENSER LOOP TEMP SCHEDULE"); thisSPM.plantPloc = {chwLoopIndex, DataPlant::LoopSideLocation::Supply, chillerBranchChW, chillerCompIndex}; thisSPM.demandPloc = {condLoopIndex, DataPlant::LoopSideLocation::Demand, chillerBranchCW, chillerCompIndex}; @@ -611,40 +617,35 @@ TEST_F(EnergyPlusFixture, CalcScheduledTESSetPoint) spmTESS.nonChargeCHWTemp = 5; spmTESS.chargeCHWTemp = -5; - // indexes in Schedule - int constexpr OnSched = 1; - int constexpr OffSched = 2; - std::string const idf_contents(delimited_string({ - "Schedule:Constant,MyScheduleOn,,1;", - "Schedule:Constant,MyScheduleOff,,0;", - })); - ASSERT_TRUE(process_idf(idf_contents)); - state->dataGlobal->NumOfTimeStepInHour = 4; - state->dataGlobal->MinutesPerTimeStep = 60 / state->dataGlobal->NumOfTimeStepInHour; - ScheduleManager::ProcessScheduleInput(*state); + state->dataGlobal->TimeStepsInHour = 4; + state->dataGlobal->MinutesInTimeStep = 60 / state->dataGlobal->TimeStepsInHour; + + state->init_state(*state); + state->dataGlobal->TimeStep = 1; state->dataGlobal->HourOfDay = 1; state->dataEnvrn->DayOfWeek = 1; state->dataEnvrn->DayOfYear_Schedule = 1; - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // CtrlType Bug // state->dataSetPointManager->SchTESSetPtMgr(schManNum).CompOpType = DataPlant::CtrlType::CoolingOp; spmTESS.compOpType = DataPlant::CtrlType::HeatingOp; - spmTESS.schedNum = OnSched; + spmTESS.sched = Sched::GetScheduleAlwaysOn(*state); + spmTESS.chargeSched = Sched::GetScheduleAlwaysOff(*state); spmTESS.calculate(*state); EXPECT_EQ(spmTESS.nonChargeCHWTemp, spmTESS.setPt); - spmTESS.schedNum = OffSched; - spmTESS.schedNumCharge = OffSched; + spmTESS.sched = Sched::GetScheduleAlwaysOff(*state); + spmTESS.chargeSched = Sched::GetScheduleAlwaysOff(*state); spmTESS.calculate(*state); EXPECT_EQ(spmTESS.nonChargeCHWTemp, spmTESS.setPt); - spmTESS.schedNum = OffSched; - spmTESS.schedNumCharge = OnSched; + spmTESS.sched = Sched::GetScheduleAlwaysOff(*state); + spmTESS.chargeSched = Sched::GetScheduleAlwaysOn(*state); spmTESS.calculate(*state); EXPECT_EQ(spmTESS.chargeCHWTemp, spmTESS.setPt); @@ -673,6 +674,9 @@ TEST_F(EnergyPlusFixture, SZRHOAFractionImpact) }); ASSERT_TRUE(process_idf(idf_objects)); + + state->init_state(*state); + bool ErrorsFound = false; state->dataGlobal->NumOfZones = 1; @@ -972,6 +976,8 @@ TEST_F(EnergyPlusFixture, MixedAirSetPointManager_SameRefAndSPNodeName) ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); + // GetInput should fail since reference and set point node names are the same bool ErrorsFound = false; SetPointManager::GetSetPointManagerInputData(*state, ErrorsFound); @@ -1286,9 +1292,10 @@ TEST_F(EnergyPlusFixture, ColdestSetPointMgrInSingleDuct) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ScheduleManager::ProcessScheduleInput(*state); + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + + state->init_state(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // zones are specified in the idf snippet @@ -1374,6 +1381,8 @@ TEST_F(EnergyPlusFixture, SetPointManager_OutdoorAirResetMaxTempTest) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(ErrorsFound); // zones are specified in the idf snippet + state->init_state(*state); + SetPointManager::GetSetPointManagerInputs(*state); // check Set Point Manager get inputs int spmNum = SetPointManager::GetSetPointManagerIndex(*state, "HOT WATER LOOP SETPOINT MANAGER"); @@ -1433,6 +1442,8 @@ TEST_F(EnergyPlusFixture, SetPointManager_OutdoorAirResetMinTempTest) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(ErrorsFound); // zones are specified in the idf snippet + state->init_state(*state); + SetPointManager::GetSetPointManagerInputs(*state); // check Set Point Manager get inputs @@ -1490,6 +1501,9 @@ TEST_F(EnergyPlusFixture, SingZoneRhSetPtMgrZoneInletNodeTest) }); ASSERT_TRUE(process_idf(idf_objects)); + + state->init_state(*state); + state->dataGlobal->NumOfZones = 1; state->dataHeatBal->Zone.allocate(state->dataGlobal->NumOfZones); @@ -1557,6 +1571,9 @@ TEST_F(EnergyPlusFixture, SingZoneCoolHeatSetPtMgrZoneInletNodeTest) }); ASSERT_TRUE(process_idf(idf_objects)); + + state->init_state(*state); + state->dataGlobal->NumOfZones = 1; state->dataHeatBal->Zone.allocate(state->dataGlobal->NumOfZones); @@ -1625,6 +1642,9 @@ TEST_F(EnergyPlusFixture, SingZoneCoolHeatSetPtMgrSetPtTest) }); ASSERT_TRUE(process_idf(idf_objects)); + + state->init_state(*state); + state->dataGlobal->NumOfZones = 1; state->dataHeatBal->Zone.allocate(state->dataGlobal->NumOfZones); @@ -1724,6 +1744,7 @@ TEST_F(EnergyPlusFixture, SetPointManager_SystemNodeResetTempTest) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(ErrorsFound); + state->init_state(*state); // check Setpoint Manager inputs SetPointManager::GetSetPointManagerInputs(*state); @@ -1785,6 +1806,7 @@ TEST_F(EnergyPlusFixture, SetPointManager_SystemNodeResetHumRatTest) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(ErrorsFound); + state->init_state(*state); // check Setpoint Manager inputs SetPointManager::GetSetPointManagerInputs(*state); @@ -1901,8 +1923,10 @@ TEST_F(EnergyPlusFixture, SetPointManager_OutdoorAirResetCalculateSchedValTest) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(ErrorsFound); // zones are specified in the idf snippet - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + state->dataGlobal->HourOfDay = 1; state->dataGlobal->TimeStep = 1; state->dataGlobal->DayOfSim = 1; @@ -1911,7 +1935,6 @@ TEST_F(EnergyPlusFixture, SetPointManager_OutdoorAirResetCalculateSchedValTest) state->dataEnvrn->DayOfWeek = 1; state->dataEnvrn->HolidayIndex = 0; - ScheduleManager::ProcessScheduleInput(*state); SetPointManager::GetSetPointManagerInputs(*state); int spm1Num = SetPointManager::GetSetPointManagerIndex(*state, "OA RESET MANAGER 1"); @@ -1928,7 +1951,7 @@ TEST_F(EnergyPlusFixture, SetPointManager_OutdoorAirResetCalculateSchedValTest) // Set general data for all tests state->dataEnvrn->OutDryBulbTemp = 7.0; - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // Test 1: First outdoor air reset setpoint manager--should use the first set of setpoint data expectedAnswer = 50.0; diff --git a/tst/EnergyPlus/unit/SimAirServingZones.unit.cc b/tst/EnergyPlus/unit/SimAirServingZones.unit.cc index cf5ec7c6e2e..09801c31953 100644 --- a/tst/EnergyPlus/unit/SimAirServingZones.unit.cc +++ b/tst/EnergyPlus/unit/SimAirServingZones.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -462,6 +462,7 @@ TEST_F(EnergyPlusFixture, GetAirPathData_ControllerLockout1) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); SimAirServingZones::GetAirPathData(*state); @@ -622,6 +623,7 @@ TEST_F(EnergyPlusFixture, GetAirPathData_ControllerLockout2) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); SimAirServingZones::GetAirPathData(*state); @@ -774,6 +776,8 @@ TEST_F(EnergyPlusFixture, InitAirLoops_1AirLoop2ADU) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -1006,6 +1010,8 @@ TEST_F(EnergyPlusFixture, InitAirLoops_2AirLoop2ADU) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -1036,7 +1042,6 @@ TEST_F(EnergyPlusFixture, InitAirLoops_2AirLoop2ADU) // this test checks whether an AirLoop with 0 airflow will raise the correct severe error TEST_F(EnergyPlusFixture, SizeAirLoopBranches_0Airflow) { - std::string const idf_objects = delimited_string({ "Zone,", " Space1; !- Name", @@ -1140,6 +1145,8 @@ TEST_F(EnergyPlusFixture, SizeAirLoopBranches_0Airflow) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -1171,7 +1178,6 @@ TEST_F(EnergyPlusFixture, SizeAirLoopBranches_0Airflow) TEST_F(EnergyPlusFixture, InitAirLoops_2AirLoop3ADUa) { - std::string const idf_objects = delimited_string({ "Zone,", " Space1; !- Name", @@ -1407,6 +1413,8 @@ TEST_F(EnergyPlusFixture, InitAirLoops_2AirLoop3ADUa) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -1437,7 +1445,6 @@ TEST_F(EnergyPlusFixture, InitAirLoops_2AirLoop3ADUa) TEST_F(EnergyPlusFixture, InitAirLoops_2AirLoop3ADUb) { - std::string const idf_objects = delimited_string({ "Zone,", " Space1; !- Name", @@ -1673,6 +1680,8 @@ TEST_F(EnergyPlusFixture, InitAirLoops_2AirLoop3ADUb) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -1870,6 +1879,8 @@ TEST_F(EnergyPlusFixture, InitAirLoops_1AirLoop2Zones3ADU) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -2415,6 +2426,7 @@ TEST_F(EnergyPlusFixture, DISABLED_AirLoop_ReturnFan_MinFlow) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); SimulationManager::ManageSimulation(*state); // run the design days diff --git a/tst/EnergyPlus/unit/SimulationManager.unit.cc b/tst/EnergyPlus/unit/SimulationManager.unit.cc index 954b4afae02..94acb66c1d5 100644 --- a/tst/EnergyPlus/unit/SimulationManager.unit.cc +++ b/tst/EnergyPlus/unit/SimulationManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -71,6 +71,7 @@ TEST_F(EnergyPlusFixture, CheckThreading) }); EXPECT_FALSE(process_idf(idf_objects, false)); + state->init_state(*state); std::string const error_string = delimited_string({ " ** Severe ** Line: 1 Index: 14 - \"ProgramControl\" is not a valid Object Type.", @@ -112,6 +113,8 @@ TEST_F(EnergyPlusFixture, Test_PerformancePrecisionTradeoffs_DirectSolution_Mess EXPECT_TRUE(process_idf(idf_objects, false)); + state->init_state(*state); + std::string const error_string = delimited_string({ " ** Warning ** PerformancePrecisionTradeoffs: Coil Direct Solution simulation is selected.", }); @@ -125,7 +128,7 @@ TEST_F(EnergyPlusFixture, Simulationmanager_bool_to_string) EXPECT_EQ(SimulationManager::bool_to_string(false), "False"); } -TEST_F(EnergyPlusFixture, Simulationmanager_writeIntialPerfLogValues) +TEST_F(EnergyPlusFixture, Simulationmanager_writeInitialPerfLogValues) { state->dataStrGlobals->outputPerfLogFilePath = "eplusout_perflog.csv"; @@ -136,7 +139,7 @@ TEST_F(EnergyPlusFixture, Simulationmanager_writeIntialPerfLogValues) Util::appendPerfLog(*state, "RESET", "RESET"); // call the function to test - SimulationManager::writeIntialPerfLogValues(*state, "MODE193"); + SimulationManager::writeInitialPerfLogValues(*state, "MODE193"); // force the file to be written Util::appendPerfLog(*state, "lastHeader", "lastValue", true); @@ -186,6 +189,7 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDebuggingData) state->init_state_called = false; EXPECT_TRUE(process_idf(idf_objects)); + state->init_state(*state); EXPECT_TRUE(state->dataReportFlag->DebugOutput); EXPECT_FALSE(state->dataReportFlag->EvenDuringWarmup); @@ -203,6 +207,7 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDebuggingData) state->init_state_called = false; EXPECT_TRUE(process_idf(idf_objects)); + state->init_state(*state); EXPECT_FALSE(state->dataReportFlag->DebugOutput); EXPECT_TRUE(state->dataReportFlag->EvenDuringWarmup); @@ -227,6 +232,8 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDebuggingData) compare_err_stream_substring("", true); // Input processor with throw a severe, so do not use assertions EXPECT_FALSE(process_idf(idf_objects, false)); + state->init_state(*state); + // Instead do it here, making sure to reset the stream { std::string const expectedError = delimited_string({ @@ -248,6 +255,7 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_DefaultState) }); EXPECT_TRUE(process_idf(idf_objects)); + state->init_state(*state); EXPECT_FALSE(state->dataGlobal->DisplayAllWarnings); EXPECT_FALSE(state->dataGlobal->DisplayExtraWarnings); @@ -282,6 +290,7 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_SimpleCase) }); EXPECT_TRUE(process_idf(idf_objects)); + state->init_state(*state); EXPECT_TRUE(state->dataGlobal->DisplayAllWarnings); EXPECT_TRUE(state->dataGlobal->DisplayExtraWarnings); @@ -320,6 +329,7 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_AllKeys) }); EXPECT_TRUE(process_idf(idf_objects)); + state->init_state(*state); EXPECT_TRUE(state->dataGlobal->DisplayAllWarnings); EXPECT_TRUE(state->dataGlobal->DisplayExtraWarnings); @@ -351,6 +361,8 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_Unicity) compare_err_stream_substring("", true); // Input processor will throw a severe, so do not use assertions EXPECT_FALSE(process_idf(idf_objects, false)); + state->init_state(*state); + // Instead do it here, making sure to reset the stream { std::string const expectedError = delimited_string({ @@ -387,6 +399,8 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_UndocumentedFlags) // This will throw a warning in InputProcessor since these aren't supported keys, so do not use assertions EXPECT_FALSE(process_idf(idf_objects, false)); + state->init_state(*state); + const std::string expected_warning = delimited_string({ " ** Severe ** [Output:Diagnostics][Output:Diagnostics 1][diagnostics][0][key] - \"IgnoreSolarRadiation\" - Failed to match against " "any enum values.", @@ -435,6 +449,7 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_HasEmpty) }); EXPECT_TRUE(process_idf(idf_objects)); + state->init_state(*state); EXPECT_FALSE(state->dataGlobal->DisplayAllWarnings); EXPECT_FALSE(state->dataGlobal->DisplayExtraWarnings); @@ -471,6 +486,7 @@ TEST_F(EnergyPlusFixture, SimulationManager_HVACSizingSimulationChoiceTest) }); EXPECT_TRUE(process_idf(idf_objects)); + state->init_state(*state); EXPECT_TRUE(state->dataGlobal->DoHVACSizingSimulation); // get a default value @@ -492,6 +508,7 @@ TEST_F(EnergyPlusFixture, Test_SimulationControl_ZeroSimulation) }); EXPECT_TRUE(process_idf(idf_objects)); + state->init_state(*state); ASSERT_THROW(SimulationManager::CheckForMisMatchedEnvironmentSpecifications(*state), std::runtime_error); // no error message from PerformancePrecisionTradeoffs objects @@ -522,6 +539,7 @@ TEST_F(EnergyPlusFixture, Test_SimulationControl_PureLoadCalc) }); EXPECT_TRUE(process_idf(idf_objects)); + state->init_state(*state); EXPECT_NO_THROW(SimulationManager::CheckForMisMatchedEnvironmentSpecifications(*state)); // no error message from PerformancePrecisionTradeoffs objects diff --git a/tst/EnergyPlus/unit/SingleDuct.unit.cc b/tst/EnergyPlus/unit/SingleDuct.unit.cc index be5edc2ff84..cc89e3506a0 100644 --- a/tst/EnergyPlus/unit/SingleDuct.unit.cc +++ b/tst/EnergyPlus/unit/SingleDuct.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -124,10 +124,10 @@ TEST_F(EnergyPlusFixture, VAVNoReheatTerminalUnitSchedule) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); + state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataGlobal->HourOfDay = 1; @@ -137,7 +137,7 @@ TEST_F(EnergyPlusFixture, VAVNoReheatTerminalUnitSchedule) state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); @@ -145,9 +145,15 @@ TEST_F(EnergyPlusFixture, VAVNoReheatTerminalUnitSchedule) DataZoneEquipment::GetZoneEquipmentData(*state); ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); SingleDuct::GetSysInput(*state); - EXPECT_TRUE(compare_err_stream("")); + std::string error_string = delimited_string({" ** Warning ** ProcessScheduleInput: Schedule:Constant = ALWAYSOFF", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = ALWAYSON", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated."}); + EXPECT_TRUE(compare_err_stream(error_string)); state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; // node number table // 1 Zone 1 Air Node @@ -170,7 +176,7 @@ TEST_F(EnergyPlusFixture, VAVNoReheatTerminalUnitSchedule) state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputRequired = 2000.0; // Heating load - expect min flow rate // First test - AlwaysOff Schedule - expecting no flow - state->dataSingleDuct->sd_airterminal(SysNum).SchedPtr = 1; + state->dataSingleDuct->sd_airterminal(SysNum).availSched = Sched::GetSchedule(*state, "ALWAYSOFF"); state->dataLoopNodes->Node(InletNodeNum).MassFlowRate = SysMinMassFlow; state->dataLoopNodes->Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlow; state->dataGlobal->BeginEnvrnFlag = true; // Must be true for initial pass thru SingleDuct::InitSys for this terminal unit @@ -188,7 +194,7 @@ TEST_F(EnergyPlusFixture, VAVNoReheatTerminalUnitSchedule) // Reset flows and switch to AlwaysOn Schedule state->dataLoopNodes->Node(InletNodeNum).MassFlowRate = SysMinMassFlow; state->dataLoopNodes->Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlow; - state->dataSingleDuct->sd_airterminal(SysNum).SchedPtr = 2; + state->dataSingleDuct->sd_airterminal(SysNum).availSched = Sched::GetSchedule(*state, "ALWAYSON"); FirstHVACIteration = true; state->dataSingleDuct->sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); // Run thru init once with FirstHVACIteration set to true FirstHVACIteration = false; @@ -202,7 +208,7 @@ TEST_F(EnergyPlusFixture, VAVNoReheatTerminalUnitSchedule) state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputRequired = -2000.0; // Cooling load - expect max flow rate // First test - AlwaysOff Schedule - expecting no flow - state->dataSingleDuct->sd_airterminal(SysNum).SchedPtr = 1; + state->dataSingleDuct->sd_airterminal(SysNum).availSched = Sched::GetSchedule(*state, "ALWAYSOFF"); state->dataLoopNodes->Node(InletNodeNum).MassFlowRate = SysMinMassFlow; state->dataLoopNodes->Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlow; state->dataGlobal->BeginEnvrnFlag = true; // Must be true for initial pass thru SingleDuct::InitSys for this terminal unit @@ -220,7 +226,7 @@ TEST_F(EnergyPlusFixture, VAVNoReheatTerminalUnitSchedule) // Reset flows and switch to AlwaysOn Schedule state->dataLoopNodes->Node(InletNodeNum).MassFlowRate = SysMinMassFlow; state->dataLoopNodes->Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlow; - state->dataSingleDuct->sd_airterminal(SysNum).SchedPtr = 2; + state->dataSingleDuct->sd_airterminal(SysNum).availSched = Sched::GetSchedule(*state, "ALWAYSON"); FirstHVACIteration = true; state->dataSingleDuct->sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); // Run thru init once with FirstHVACIteration set to true FirstHVACIteration = false; @@ -299,10 +305,10 @@ TEST_F(EnergyPlusFixture, VAVReheatTerminalUnitSchedule) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); + state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataGlobal->HourOfDay = 1; @@ -312,7 +318,7 @@ TEST_F(EnergyPlusFixture, VAVReheatTerminalUnitSchedule) state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); @@ -320,9 +326,14 @@ TEST_F(EnergyPlusFixture, VAVReheatTerminalUnitSchedule) DataZoneEquipment::GetZoneEquipmentData(*state); ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); SingleDuct::GetSysInput(*state); - EXPECT_TRUE(compare_err_stream("")); + std::string error_string = delimited_string({" ** Warning ** ProcessScheduleInput: Schedule:Constant = ALWAYSOFF", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = ALWAYSON", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated."}); state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; // node number table // 1 Zone 1 Air Node @@ -346,7 +357,7 @@ TEST_F(EnergyPlusFixture, VAVReheatTerminalUnitSchedule) state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputRequired = 2000.0; // Heating load - expect min flow rate // First test - AlwaysOff Schedule - expecting no flow - state->dataSingleDuct->sd_airterminal(SysNum).SchedPtr = 1; + state->dataSingleDuct->sd_airterminal(SysNum).availSched = Sched::GetSchedule(*state, "ALWAYSOFF"); state->dataLoopNodes->Node(InletNodeNum).MassFlowRate = SysMinMassFlow; state->dataLoopNodes->Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlow; state->dataGlobal->BeginEnvrnFlag = true; // Must be true for initial pass thru SingleDuct::InitSys for this terminal unit @@ -364,7 +375,7 @@ TEST_F(EnergyPlusFixture, VAVReheatTerminalUnitSchedule) // Reset flows and switch to AlwaysOn Schedule state->dataLoopNodes->Node(InletNodeNum).MassFlowRate = SysMinMassFlow; state->dataLoopNodes->Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlow; - state->dataSingleDuct->sd_airterminal(SysNum).SchedPtr = 2; + state->dataSingleDuct->sd_airterminal(SysNum).availSched = Sched::GetSchedule(*state, "ALWAYSON"); FirstHVACIteration = true; state->dataSingleDuct->sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); // Run thru init once with FirstHVACIteration set to true FirstHVACIteration = false; @@ -378,7 +389,7 @@ TEST_F(EnergyPlusFixture, VAVReheatTerminalUnitSchedule) state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputRequired = -2000.0; // Cooling load - expect max flow rate // First test - AlwaysOff Schedule - expecting no flow - state->dataSingleDuct->sd_airterminal(SysNum).SchedPtr = 1; + state->dataSingleDuct->sd_airterminal(SysNum).availSched = Sched::GetSchedule(*state, "ALWAYSOFF"); state->dataLoopNodes->Node(InletNodeNum).MassFlowRate = SysMinMassFlow; state->dataLoopNodes->Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlow; state->dataGlobal->BeginEnvrnFlag = true; // Must be true for initial pass thru SingleDuct::InitSys for this terminal unit @@ -396,7 +407,7 @@ TEST_F(EnergyPlusFixture, VAVReheatTerminalUnitSchedule) // Reset flows and switch to AlwaysOn Schedule state->dataLoopNodes->Node(InletNodeNum).MassFlowRate = SysMinMassFlow; state->dataLoopNodes->Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlow; - state->dataSingleDuct->sd_airterminal(SysNum).SchedPtr = 2; + state->dataSingleDuct->sd_airterminal(SysNum).availSched = Sched::GetSchedule(*state, "ALWAYSON"); FirstHVACIteration = true; state->dataSingleDuct->sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); // Run thru init once with FirstHVACIteration set to true FirstHVACIteration = false; @@ -1272,6 +1283,7 @@ TEST_F(EnergyPlusFixture, SingleDuct_ZeroFloorAreaTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // OutputProcessor::TimeValue.allocate(2); @@ -2490,7 +2502,7 @@ TEST_F(EnergyPlusFixture, SingleDuct_VAVWaterCoilSizing) }); ASSERT_TRUE(process_idf(idf_objects)); - + state->init_state(*state); // OutputProcessor::TimeValue.allocate(2); ManageSimulation(*state); // run the design days @@ -2724,6 +2736,7 @@ TEST_F(EnergyPlusFixture, VAVReheatTerminal_SizeMinFrac) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); @@ -2918,6 +2931,7 @@ TEST_F(EnergyPlusFixture, VAVConstantVolTU_NoReheat_Sizing) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); @@ -3006,6 +3020,7 @@ TEST_F(EnergyPlusFixture, VAVConstantVolTU_Reheat_Sizing) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); @@ -3070,11 +3085,8 @@ TEST_F(EnergyPlusFixture, SingleDuctAirTerminal_reportTerminalUnit) SetPredefinedTables(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; - auto &sch = state->dataScheduleMgr->Schedule; - sch.allocate(5); - sch(1).Name = "schA"; - sch(2).Name = "schB"; + auto *schA = Sched::AddScheduleConstant(*state, "schA"); + auto *schB = Sched::AddScheduleConstant(*state, "schB"); auto &adu = state->dataDefineEquipment->AirDistUnit; adu.allocate(2); @@ -3095,7 +3107,7 @@ TEST_F(EnergyPlusFixture, SingleDuctAirTerminal_reportTerminalUnit) sdat(1).ADUNum = 1; sdat(1).sysType = "AirTerminal:SingleDuct:ConstantVolume:NoReheat"; sdat(1).MaxAirVolFlowRate = 0.30; - sdat(1).ZoneMinAirFracSchPtr = 1; + sdat(1).zoneMinAirFracSched = schA; sdat(1).MaxAirVolFlowRateDuringReheat = 0.25; sdat(1).OARequirementsPtr = 0; sdat(1).ReheatComp = "watercoil"; @@ -3134,7 +3146,7 @@ TEST_F(EnergyPlusFixture, SingleDuctAirTerminal_reportTerminalUnit) sdat(2).ADUNum = 2; sdat(2).sysType = "AirTerminal:SingleDuct:ConstantVolume:Reheat"; sdat(2).MaxAirVolFlowRate = 0.31; - sdat(2).ZoneMinAirFracSchPtr = 0; + sdat(2).zoneMinAirFracSched = nullptr; sdat(2).MaxAirVolFlowRateDuringReheat = 0.26; sdat(2).OARequirementsPtr = 1; sdat(2).ReheatComp = "furncoil"; @@ -3143,7 +3155,7 @@ TEST_F(EnergyPlusFixture, SingleDuctAirTerminal_reportTerminalUnit) auto &oa = state->dataSize->OARequirements; oa.allocate(1); - oa(1).OAFlowFracSchPtr = 2; + oa(1).oaFlowFracSched = Sched::GetScheduleAlwaysOn(*state); sdat(2).reportTerminalUnit(*state); @@ -3158,7 +3170,7 @@ TEST_F(EnergyPlusFixture, SingleDuctAirTerminal_reportTerminalUnit) EXPECT_EQ("n/a", RetrievePreDefTableEntry(*state, orp.pdchAirTermSecdFlow, "ADU b")); EXPECT_EQ("n/a", RetrievePreDefTableEntry(*state, orp.pdchAirTermMinFlowSch, "ADU b")); EXPECT_EQ("0.26", RetrievePreDefTableEntry(*state, orp.pdchAirTermMaxFlowReh, "ADU b")); - EXPECT_EQ("schB", RetrievePreDefTableEntry(*state, orp.pdchAirTermMinOAflowSch, "ADU b")); + EXPECT_EQ("Constant-1.0", RetrievePreDefTableEntry(*state, orp.pdchAirTermMinOAflowSch, "ADU b")); EXPECT_EQ("furncoil", RetrievePreDefTableEntry(*state, orp.pdchAirTermHeatCoilType, "ADU b")); EXPECT_EQ("n/a", RetrievePreDefTableEntry(*state, orp.pdchAirTermCoolCoilType, "ADU b")); EXPECT_EQ("Fan:OnOff", RetrievePreDefTableEntry(*state, orp.pdchAirTermFanType, "ADU b")); diff --git a/tst/EnergyPlus/unit/SiteBuildingSurfaceGroundTemperatures.unit.cc b/tst/EnergyPlus/unit/SiteBuildingSurfaceGroundTemperatures.unit.cc index d987e2713cc..15f5a2ef6d8 100644 --- a/tst/EnergyPlus/unit/SiteBuildingSurfaceGroundTemperatures.unit.cc +++ b/tst/EnergyPlus/unit/SiteBuildingSurfaceGroundTemperatures.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -52,12 +52,11 @@ // EnergyPlus Headers #include "EnergyPlus/DataIPShortCuts.hh" -#include "EnergyPlus/GroundTemperatureModeling/GroundTemperatureModelManager.hh" +#include "EnergyPlus/GroundTemperatureModeling/BaseGroundTemperatureModel.hh" #include "Fixtures/EnergyPlusFixture.hh" #include using namespace EnergyPlus; -using namespace EnergyPlus::GroundTemperatureManager; TEST_F(EnergyPlusFixture, SiteBuildingSurfaceGroundTempTest) { @@ -79,10 +78,7 @@ TEST_F(EnergyPlusFixture, SiteBuildingSurfaceGroundTempTest) ASSERT_TRUE(process_idf(idf_objects)); - std::string const CurrentModuleObject = - static_cast(groundTempModelNamesUC[static_cast(GroundTempObjType::SiteBuildingSurfaceGroundTemp)]); - - auto thisModel = GetGroundTempModelAndInit(*state, CurrentModuleObject, "TEST"); + auto *thisModel = GroundTemp::GetGroundTempModelAndInit(*state, GroundTemp::ModelType::SiteBuildingSurface, "TEST"); EXPECT_NEAR(21.0, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 1), 0.1); // January EXPECT_NEAR(32.0, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 12), 0.1); // December diff --git a/tst/EnergyPlus/unit/SiteDeepGroundTemperatures.unit.cc b/tst/EnergyPlus/unit/SiteDeepGroundTemperatures.unit.cc index c821fb2ef48..bcf1a4cb3a4 100644 --- a/tst/EnergyPlus/unit/SiteDeepGroundTemperatures.unit.cc +++ b/tst/EnergyPlus/unit/SiteDeepGroundTemperatures.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -52,12 +52,11 @@ // EnergyPlus Headers #include "EnergyPlus/DataIPShortCuts.hh" -#include "EnergyPlus/GroundTemperatureModeling/GroundTemperatureModelManager.hh" +#include "EnergyPlus/GroundTemperatureModeling/BaseGroundTemperatureModel.hh" #include "Fixtures/EnergyPlusFixture.hh" #include using namespace EnergyPlus; -using namespace EnergyPlus::GroundTemperatureManager; TEST_F(EnergyPlusFixture, SiteDeepGroundTempTest) { @@ -79,9 +78,7 @@ TEST_F(EnergyPlusFixture, SiteDeepGroundTempTest) ASSERT_TRUE(process_idf(idf_objects)); - std::string const CurrentModuleObject = static_cast(groundTempModelNamesUC[static_cast(GroundTempObjType::SiteDeepGroundTemp)]); - - auto thisModel = GetGroundTempModelAndInit(*state, CurrentModuleObject, "TEST"); + auto *thisModel = GroundTemp::GetGroundTempModelAndInit(*state, GroundTemp::ModelType::SiteDeep, "TEST"); EXPECT_NEAR(21.0, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 1), 0.1); // January EXPECT_NEAR(32.0, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 12), 0.1); // December diff --git a/tst/EnergyPlus/unit/SiteFCFactorMethodGroundTemperatures.unit.cc b/tst/EnergyPlus/unit/SiteFCFactorMethodGroundTemperatures.unit.cc index ccaeab51c86..f5f12571e3d 100644 --- a/tst/EnergyPlus/unit/SiteFCFactorMethodGroundTemperatures.unit.cc +++ b/tst/EnergyPlus/unit/SiteFCFactorMethodGroundTemperatures.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -52,12 +52,11 @@ // EnergyPlus Headers #include "EnergyPlus/DataIPShortCuts.hh" -#include "EnergyPlus/GroundTemperatureModeling/GroundTemperatureModelManager.hh" +#include "EnergyPlus/GroundTemperatureModeling/BaseGroundTemperatureModel.hh" #include "Fixtures/EnergyPlusFixture.hh" #include using namespace EnergyPlus; -using namespace EnergyPlus::GroundTemperatureManager; TEST_F(EnergyPlusFixture, SiteFCFactorMethodGroundTempTest) { @@ -79,10 +78,7 @@ TEST_F(EnergyPlusFixture, SiteFCFactorMethodGroundTempTest) ASSERT_TRUE(process_idf(idf_objects)); - std::string const CurrentModuleObject = - static_cast(groundTempModelNamesUC[static_cast(GroundTempObjType::SiteFCFactorMethodGroundTemp)]); - - auto thisModel = GetGroundTempModelAndInit(*state, CurrentModuleObject, "TEST"); + auto *thisModel = GroundTemp::GetGroundTempModelAndInit(*state, GroundTemp::ModelType::SiteFCFactorMethod, "TEST"); EXPECT_NEAR(21.0, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 1), 0.1); // January EXPECT_NEAR(32.0, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 12), 0.1); // December diff --git a/tst/EnergyPlus/unit/SiteGroundDomain.unit.cc b/tst/EnergyPlus/unit/SiteGroundDomain.unit.cc index 61cdaaaa2fc..56cda9234db 100644 --- a/tst/EnergyPlus/unit/SiteGroundDomain.unit.cc +++ b/tst/EnergyPlus/unit/SiteGroundDomain.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -83,11 +83,8 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainSlabAndBasementModelsIndexChecking) state->dataPlantPipingSysMgr->domains.resize(2); - state->dataPlantPipingSysMgr->domains[0].groundTempModel = - GetGroundTempModelAndInit(*state, "Site:GroundTemperature:Undisturbed:KusudaAchenbach", "KA1"); + state->dataPlantPipingSysMgr->domains[0].groundTempModel = GroundTemp::GetGroundTempModelAndInit(*state, GroundTemp::ModelType::Kusuda, "KA1"); + state->dataPlantPipingSysMgr->domains[1].groundTempModel = GroundTemp::GetGroundTempModelAndInit(*state, GroundTemp::ModelType::Kusuda, "KA2"); - state->dataPlantPipingSysMgr->domains[1].groundTempModel = - GetGroundTempModelAndInit(*state, "Site:GroundTemperature:Undisturbed:KusudaAchenbach", "KA2"); - - EXPECT_NE(state->dataPlantPipingSysMgr->domains[0].groundTempModel.get(), state->dataPlantPipingSysMgr->domains[1].groundTempModel.get()); + EXPECT_NE(state->dataPlantPipingSysMgr->domains[0].groundTempModel, state->dataPlantPipingSysMgr->domains[1].groundTempModel); } diff --git a/tst/EnergyPlus/unit/SiteShallowGroundTemperatures.unit.cc b/tst/EnergyPlus/unit/SiteShallowGroundTemperatures.unit.cc index 6bc096f41b5..0a079048538 100644 --- a/tst/EnergyPlus/unit/SiteShallowGroundTemperatures.unit.cc +++ b/tst/EnergyPlus/unit/SiteShallowGroundTemperatures.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -52,12 +52,11 @@ // EnergyPlus Headers #include "EnergyPlus/DataIPShortCuts.hh" -#include "EnergyPlus/GroundTemperatureModeling/GroundTemperatureModelManager.hh" +#include "EnergyPlus/GroundTemperatureModeling/BaseGroundTemperatureModel.hh" #include "Fixtures/EnergyPlusFixture.hh" #include using namespace EnergyPlus; -using namespace EnergyPlus::GroundTemperatureManager; TEST_F(EnergyPlusFixture, SiteShallowGroundTempTest) { @@ -79,10 +78,7 @@ TEST_F(EnergyPlusFixture, SiteShallowGroundTempTest) ASSERT_TRUE(process_idf(idf_objects)); - std::string const CurrentModuleObject = - static_cast(groundTempModelNamesUC[static_cast(GroundTempObjType::SiteShallowGroundTemp)]); - - auto thisModel = GetGroundTempModelAndInit(*state, CurrentModuleObject, "TEST"); + auto *thisModel = GroundTemp::GetGroundTempModelAndInit(*state, GroundTemp::ModelType::SiteShallow, "TEST"); EXPECT_NEAR(21.0, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 1), 0.1); // January EXPECT_NEAR(32.0, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 12), 0.1); // December diff --git a/tst/EnergyPlus/unit/SizeWaterHeatingCoil.unit.cc b/tst/EnergyPlus/unit/SizeWaterHeatingCoil.unit.cc index fb749b85c57..ac913896c96 100644 --- a/tst/EnergyPlus/unit/SizeWaterHeatingCoil.unit.cc +++ b/tst/EnergyPlus/unit/SizeWaterHeatingCoil.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -81,7 +81,6 @@ using namespace EnergyPlus::DataSizing; using namespace EnergyPlus::DataZoneEquipment; using namespace EnergyPlus::HeatBalanceManager; using namespace EnergyPlus::Psychrometrics; -using namespace EnergyPlus::ScheduleManager; using namespace EnergyPlus::SimAirServingZones; using namespace EnergyPlus::SingleDuct; using namespace EnergyPlus::SizingManager; @@ -100,7 +99,6 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils1) bool ErrorsFound(false); - InitializePsychRoutines(*state); state->dataEnvrn->StdRhoAir = 1.20; std::string const idf_objects = delimited_string({ @@ -217,6 +215,7 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils1) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataSize->FinalZoneSizing.allocate(1); state->dataSize->TermUnitFinalZoneSizing.allocate(1); @@ -244,8 +243,6 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils1) GetZoneAirDistribution(*state); // get zone air distribution objects GetZoneSizingInput(*state); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; GetZoneAirLoopEquipment(*state); GetWaterCoilInput(*state); state->dataWaterCoils->GetWaterCoilsInputFlag = false; @@ -258,9 +255,8 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils1) state->dataWaterCoils->WaterCoil(1).WaterPlantLoc.branchNum = 1; state->dataWaterCoils->WaterCoil(1).WaterPlantLoc.compNum = 1; state->dataPlnt->PlantLoop(1).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "HotWater"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; @@ -353,7 +349,6 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils2) bool ErrorsFound(false); - InitializePsychRoutines(*state); state->dataEnvrn->StdRhoAir = 1.20; std::string const idf_objects = delimited_string({ @@ -470,6 +465,7 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils2) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataSize->FinalZoneSizing.allocate(1); state->dataSize->TermUnitFinalZoneSizing.allocate(1); @@ -497,8 +493,6 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils2) GetZoneAirDistribution(*state); // get zone air distribution objects GetZoneSizingInput(*state); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; GetZoneAirLoopEquipment(*state); GetWaterCoilInput(*state); state->dataWaterCoils->GetWaterCoilsInputFlag = false; @@ -511,9 +505,8 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils2) state->dataWaterCoils->WaterCoil(1).WaterPlantLoc.branchNum = 1; state->dataWaterCoils->WaterCoil(1).WaterPlantLoc.compNum = 1; state->dataPlnt->PlantLoop(1).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "HotWater"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; @@ -605,7 +598,6 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils3) // with all inputs set by user except rated capacity is autosized bool ErrorsFound(false); - InitializePsychRoutines(*state); state->dataEnvrn->StdRhoAir = 1.20; std::string const idf_objects = delimited_string({ @@ -722,6 +714,7 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils3) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataSize->FinalZoneSizing.allocate(1); state->dataSize->TermUnitFinalZoneSizing.allocate(1); @@ -749,8 +742,6 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils3) GetZoneAirDistribution(*state); // get zone air distribution objects GetZoneSizingInput(*state); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; GetZoneAirLoopEquipment(*state); GetWaterCoilInput(*state); state->dataWaterCoils->GetWaterCoilsInputFlag = false; @@ -763,9 +754,8 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils3) state->dataWaterCoils->WaterCoil(1).WaterPlantLoc.branchNum = 1; state->dataWaterCoils->WaterCoil(1).WaterPlantLoc.compNum = 1; state->dataPlnt->PlantLoop(1).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "HotWater"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; @@ -857,7 +847,6 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils4) bool ErrorsFound(false); - InitializePsychRoutines(*state); state->dataEnvrn->StdRhoAir = 1.20; std::string const idf_objects = delimited_string({ @@ -974,6 +963,7 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils4) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataSize->FinalZoneSizing.allocate(1); state->dataSize->TermUnitFinalZoneSizing.allocate(1); @@ -1001,8 +991,6 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils4) GetZoneAirDistribution(*state); // get zone air distribution objects GetZoneSizingInput(*state); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; GetZoneAirLoopEquipment(*state); GetWaterCoilInput(*state); state->dataWaterCoils->GetWaterCoilsInputFlag = false; @@ -1015,9 +1003,8 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils4) state->dataWaterCoils->WaterCoil(1).WaterPlantLoc.branchNum = 1; state->dataWaterCoils->WaterCoil(1).WaterPlantLoc.compNum = 1; state->dataPlnt->PlantLoop(1).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "HotWater"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; @@ -1108,7 +1095,6 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils5) bool ErrorsFound(false); - InitializePsychRoutines(*state); state->dataEnvrn->StdRhoAir = 1.20; std::string const idf_objects = delimited_string({ @@ -1191,6 +1177,7 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils5) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataSize->FinalSysSizing.allocate(1); state->dataSize->UnitarySysEqSizing.allocate(1); @@ -1213,8 +1200,6 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils5) } GetZoneData(*state, ErrorsFound); EXPECT_EQ("SPACE1-1", state->dataHeatBal->Zone(1).Name); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; GetWaterCoilInput(*state); state->dataWaterCoils->GetWaterCoilsInputFlag = false; state->dataWaterCoils->MySizeFlag(1) = true; @@ -1225,9 +1210,8 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils5) state->dataWaterCoils->WaterCoil(1).WaterPlantLoc.branchNum = 1; state->dataWaterCoils->WaterCoil(1).WaterPlantLoc.compNum = 1; state->dataPlnt->PlantLoop(1).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "HotWater"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; @@ -1280,7 +1264,6 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils6) bool ErrorsFound(false); - InitializePsychRoutines(*state); state->dataEnvrn->StdRhoAir = 1.20; std::string const idf_objects = delimited_string({ @@ -1408,6 +1391,7 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils6) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataSize->TermUnitSizing.allocate(1); state->dataPlnt->TotNumLoops = 1; @@ -1429,8 +1413,6 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils6) GetZoneAirDistribution(*state); // get zone air distribution objects GetZoneSizingInput(*state); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; GetZoneAirLoopEquipment(*state); GetWaterCoilInput(*state); state->dataWaterCoils->GetWaterCoilsInputFlag = false; @@ -1443,9 +1425,8 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils6) state->dataWaterCoils->WaterCoil(1).WaterPlantLoc.branchNum = 1; state->dataWaterCoils->WaterCoil(1).WaterPlantLoc.compNum = 1; state->dataPlnt->PlantLoop(1).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "HotWater"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; diff --git a/tst/EnergyPlus/unit/SizingAnalysisObjects.unit.cc b/tst/EnergyPlus/unit/SizingAnalysisObjects.unit.cc index 8678f9f1b36..ec4c5e1867c 100644 --- a/tst/EnergyPlus/unit/SizingAnalysisObjects.unit.cc +++ b/tst/EnergyPlus/unit/SizingAnalysisObjects.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -83,7 +83,7 @@ class SizingAnalysisObjectsTest : public EnergyPlusFixture midLogVal = 75.0; hiLogVal = 100.0; - state->dataGlobal->NumOfTimeStepInHour = 4; // in DataGlobals + state->dataGlobal->TimeStepsInHour = 4; // in DataGlobals state->dataGlobal->TimeStepZone = 0.25; // setup weather manager state needed @@ -435,7 +435,7 @@ TEST_F(SizingAnalysisObjectsTest, DISABLED_LoggingSubStep4stepPerHour) state->dataGlobal->DayOfSim = 1; int HourofDay(0); state->dataHVACGlobal->TimeStepSys = 1.0 / (4.0 * 5.0); // fractional hours, duration - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; Real64 zoneTimeStepDuration(0.25); int numTimeStepsInHour(4); diff --git a/tst/EnergyPlus/unit/SizingManager.unit.cc b/tst/EnergyPlus/unit/SizingManager.unit.cc index 3c85f995a1c..c1d2538e3cc 100644 --- a/tst/EnergyPlus/unit/SizingManager.unit.cc +++ b/tst/EnergyPlus/unit/SizingManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -72,6 +72,7 @@ using namespace EnergyPlus::DataSizing; TEST_F(EnergyPlusFixture, GetOARequirementsTest_DSOA1) { + state->init_state(*state); bool ErrorsFound(false); // If errors detected in input int OAIndex(0); // Zone number int NumAlphas(2); @@ -224,7 +225,7 @@ TEST_F(EnergyPlusFixture, GetOARequirementsTest_DSOA1) TEST_F(EnergyPlusFixture, SizingManagerTest_TimeIndexToHrMinString_test) { - state->dataGlobal->MinutesPerTimeStep = 15; + state->dataGlobal->MinutesInTimeStep = 15; EXPECT_EQ("00:00:00", TimeIndexToHrMinString(*state, 0)); EXPECT_EQ("00:15:00", TimeIndexToHrMinString(*state, 1)); @@ -233,7 +234,7 @@ TEST_F(EnergyPlusFixture, SizingManagerTest_TimeIndexToHrMinString_test) EXPECT_EQ("19:45:00", TimeIndexToHrMinString(*state, 79)); EXPECT_EQ("24:00:00", TimeIndexToHrMinString(*state, 96)); - state->dataGlobal->MinutesPerTimeStep = 3; + state->dataGlobal->MinutesInTimeStep = 3; EXPECT_EQ("00:00:00", TimeIndexToHrMinString(*state, 0)); EXPECT_EQ("00:03:00", TimeIndexToHrMinString(*state, 1)); @@ -299,6 +300,7 @@ TEST_F(EnergyPlusFixture, SizingManager_DOASControlStrategyDefaultSpecificationT }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound(false); HeatBalanceManager::GetZoneData(*state, ErrorsFound); @@ -368,6 +370,7 @@ TEST_F(EnergyPlusFixture, SizingManager_DOASControlStrategyDefaultSpecificationT }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound(false); HeatBalanceManager::GetZoneData(*state, ErrorsFound); @@ -552,11 +555,12 @@ TEST_F(EnergyPlusFixture, SizingManager_OverrideAvgWindowInSizing) }); EXPECT_TRUE(process_idf(idf_objects)); + state->init_state(*state); SimulationManager::GetProjectData(*state); EXPECT_TRUE(state->dataGlobal->OverrideTimestep); SizingManager::GetSizingParams(*state); - EXPECT_EQ(state->dataGlobal->NumOfTimeStepInHour, 1); + EXPECT_EQ(state->dataGlobal->TimeStepsInHour, 1); EXPECT_EQ(state->dataSize->NumTimeStepsInAvg, 1); } TEST_F(EnergyPlusFixture, SizingManager_ZoneSizing_Coincident_1x) diff --git a/tst/EnergyPlus/unit/SolarCollectors.unit.cc b/tst/EnergyPlus/unit/SolarCollectors.unit.cc index 85b7240d8e0..f6b5f7e211f 100644 --- a/tst/EnergyPlus/unit/SolarCollectors.unit.cc +++ b/tst/EnergyPlus/unit/SolarCollectors.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/SolarShading.unit.cc b/tst/EnergyPlus/unit/SolarShading.unit.cc index 23d8830f682..8bbeab8f38c 100644 --- a/tst/EnergyPlus/unit/SolarShading.unit.cc +++ b/tst/EnergyPlus/unit/SolarShading.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -626,15 +626,14 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_FigureSolarBeamAtTimestep) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); - SimulationManager::GetProjectData(*state); bool FoundError = false; - HeatBalanceManager::GetProjectControlData(*state, FoundError); // read project control data - EXPECT_FALSE(FoundError); // expect no errors + HeatBalanceManager::GetProjectControlData(*state, FoundError); + EXPECT_FALSE(FoundError); HeatBalanceManager::SetPreConstructionInputParameters(*state); - ScheduleManager::ProcessScheduleInput(*state); // read schedules Material::GetMaterialData(*state, FoundError); EXPECT_FALSE(FoundError); @@ -653,8 +652,8 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_FigureSolarBeamAtTimestep) state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; @@ -1030,15 +1029,14 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_ExternalShadingIO) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); - SimulationManager::GetProjectData(*state); bool FoundError = false; HeatBalanceManager::GetProjectControlData(*state, FoundError); // read project control data EXPECT_FALSE(FoundError); // expect no errors HeatBalanceManager::SetPreConstructionInputParameters(*state); - ScheduleManager::ProcessScheduleInput(*state); // read schedules Material::GetMaterialData(*state, FoundError); EXPECT_FALSE(FoundError); @@ -1057,8 +1055,8 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_ExternalShadingIO) state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; @@ -1087,14 +1085,14 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_ExternalShadingIO) SolarShading::SkyDifSolarShading(*state); state->dataSolarShading->CalcSkyDifShading = false; - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); state->dataBSDFWindow->SUNCOSTS(4, 9)(1) = 0.1; state->dataBSDFWindow->SUNCOSTS(4, 9)(2) = 0.1; state->dataBSDFWindow->SUNCOSTS(4, 9)(3) = 0.1; FigureSolarBeamAtTimestep(*state, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep); EXPECT_TRUE(state->dataSysVars->shadingMethod == DataSystemVariables::ShadingMethod::Scheduled); - EXPECT_DOUBLE_EQ(0.5432, ScheduleManager::LookUpScheduleValue(*state, 2, 9, 4)); + EXPECT_DOUBLE_EQ(0.5432, Sched::GetSchedule(*state, "EXTSHADINGSCH:ZN001:ROOF")->getHrTsVal(*state, 9, 4)); EXPECT_FALSE(state->dataSolarShading->SUNCOS(3) < 0.00001); EXPECT_DOUBLE_EQ(0.00001, DataEnvironment::SunIsUpValue); @@ -1443,15 +1441,11 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_DisableGroupSelfShading) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); - SimulationManager::GetProjectData(*state); bool FoundError = false; - HeatBalanceManager::GetProjectControlData(*state, FoundError); // read project control data - EXPECT_FALSE(FoundError); // expect no errors - HeatBalanceManager::SetPreConstructionInputParameters(*state); - ScheduleManager::ProcessScheduleInput(*state); // read schedules Material::GetMaterialData(*state, FoundError); EXPECT_FALSE(FoundError); @@ -1474,8 +1468,8 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_DisableGroupSelfShading) state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; @@ -1820,15 +1814,12 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_PolygonClippingDirect) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); - SimulationManager::GetProjectData(*state); bool FoundError = false; HeatBalanceManager::GetProjectControlData(*state, FoundError); // read project control data - EXPECT_FALSE(FoundError); // expect no errors - HeatBalanceManager::SetPreConstructionInputParameters(*state); - ScheduleManager::ProcessScheduleInput(*state); // read schedules Material::GetMaterialData(*state, FoundError); EXPECT_FALSE(FoundError); @@ -1847,8 +1838,8 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_PolygonClippingDirect) state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; @@ -2239,15 +2230,14 @@ WindowMaterial:SimpleGlazingSystem, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); - SimulationManager::GetProjectData(*state); bool FoundError = false; HeatBalanceManager::GetProjectControlData(*state, FoundError); // read project control data EXPECT_FALSE(FoundError); // expect no errors HeatBalanceManager::SetPreConstructionInputParameters(*state); - ScheduleManager::ProcessScheduleInput(*state); // read schedules Material::GetMaterialData(*state, FoundError); EXPECT_FALSE(FoundError); @@ -2266,8 +2256,8 @@ WindowMaterial:SimpleGlazingSystem, state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; @@ -2558,15 +2548,14 @@ WindowMaterial:SimpleGlazingSystem, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); - SimulationManager::GetProjectData(*state); bool FoundError = false; HeatBalanceManager::GetProjectControlData(*state, FoundError); // read project control data EXPECT_FALSE(FoundError); // expect no errors HeatBalanceManager::SetPreConstructionInputParameters(*state); - ScheduleManager::ProcessScheduleInput(*state); // read schedules Material::GetMaterialData(*state, FoundError); EXPECT_FALSE(FoundError); @@ -2585,8 +2574,8 @@ WindowMaterial:SimpleGlazingSystem, state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; @@ -2637,30 +2626,29 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_selectActiveWindowShadingControl) state->dataSurface->Surface(curSurface).windowShadingControlList.push_back(3); state->dataSurface->WindowShadingControl.allocate(3); - state->dataSurface->WindowShadingControl(1).Schedule = 1; - state->dataSurface->WindowShadingControl(2).Schedule = 2; - state->dataSurface->WindowShadingControl(3).Schedule = 3; + auto *sch1 = state->dataSurface->WindowShadingControl(1).sched = Sched::AddScheduleConstant(*state, "SCHED-1"); + auto *sch2 = state->dataSurface->WindowShadingControl(2).sched = Sched::AddScheduleConstant(*state, "SCHED-2"); + auto *sch3 = state->dataSurface->WindowShadingControl(3).sched = Sched::AddScheduleConstant(*state, "SCHED-3"); - state->dataScheduleMgr->Schedule.allocate(3); - state->dataScheduleMgr->Schedule(1).CurrentValue = 0; - state->dataScheduleMgr->Schedule(2).CurrentValue = 0; - state->dataScheduleMgr->Schedule(3).CurrentValue = 1; + sch1->currentVal = 0; + sch2->currentVal = 0; + sch3->currentVal = 1; curIndexActiveWindowShadingControl = selectActiveWindowShadingControlIndex(*state, curSurface); activeWindowShadingControl = state->dataSurface->Surface(curSurface).windowShadingControlList[curIndexActiveWindowShadingControl]; EXPECT_EQ(activeWindowShadingControl, 3); - state->dataScheduleMgr->Schedule(1).CurrentValue = 0; - state->dataScheduleMgr->Schedule(2).CurrentValue = 1; - state->dataScheduleMgr->Schedule(3).CurrentValue = 0; + sch1->currentVal = 0; + sch2->currentVal = 1; + sch3->currentVal = 0; curIndexActiveWindowShadingControl = selectActiveWindowShadingControlIndex(*state, curSurface); activeWindowShadingControl = state->dataSurface->Surface(curSurface).windowShadingControlList[curIndexActiveWindowShadingControl]; EXPECT_EQ(activeWindowShadingControl, 2); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1; - state->dataScheduleMgr->Schedule(2).CurrentValue = 0; - state->dataScheduleMgr->Schedule(3).CurrentValue = 0; + sch1->currentVal = 1; + sch2->currentVal = 0; + sch3->currentVal = 0; curIndexActiveWindowShadingControl = selectActiveWindowShadingControlIndex(*state, curSurface); activeWindowShadingControl = state->dataSurface->Surface(curSurface).windowShadingControlList[curIndexActiveWindowShadingControl]; @@ -2739,7 +2727,7 @@ TEST_F(EnergyPlusFixture, WindowShadingManager_Lum_Test) state->dataEnvrn->SOLCOS = 0.5; state->dataGlobal->TimeStep = 1; state->dataGlobal->HourOfDay = 10; - state->dataGlobal->NumOfTimeStepInHour = NumTimeSteps; + state->dataGlobal->TimeStepsInHour = NumTimeSteps; state->dataHeatBal->SurfSunlitFrac.allocate(HoursInDay, NumTimeSteps, state->dataSurface->TotSurfaces); state->dataHeatBal->SurfCosIncAng.allocate(HoursInDay, NumTimeSteps, state->dataSurface->TotSurfaces); state->dataHeatBal->SurfCosIncAng = 45; @@ -3115,15 +3103,14 @@ TEST_F(EnergyPlusFixture, SolarShading_TestSurfsPropertyViewFactor) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); - SimulationManager::GetProjectData(*state); bool FoundError = false; HeatBalanceManager::GetProjectControlData(*state, FoundError); // read project control data EXPECT_FALSE(FoundError); // expect no errors HeatBalanceManager::SetPreConstructionInputParameters(*state); - ScheduleManager::ProcessScheduleInput(*state); // read schedules Material::GetMaterialData(*state, FoundError); EXPECT_FALSE(FoundError); @@ -3142,8 +3129,8 @@ TEST_F(EnergyPlusFixture, SolarShading_TestSurfsPropertyViewFactor) state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; @@ -3404,6 +3391,7 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_CTRANS) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; @@ -3856,15 +3844,14 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_Warn_Pixel_Count_and_TM_Schedule) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); - SimulationManager::GetProjectData(*state); bool FoundError = false; HeatBalanceManager::GetProjectControlData(*state, FoundError); EXPECT_FALSE(FoundError); HeatBalanceManager::SetPreConstructionInputParameters(*state); - ScheduleManager::ProcessScheduleInput(*state); Material::GetMaterialData(*state, FoundError); EXPECT_FALSE(FoundError); @@ -3885,8 +3872,8 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_Warn_Pixel_Count_and_TM_Schedule) state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; @@ -3967,15 +3954,15 @@ TEST_F(EnergyPlusFixture, ShadowCalculation_CSV) state->dataGlobal->BeginDayFlag = true; state->dataGlobal->WarmupFlag = false; state->dataGlobal->KindOfSim = Constant::KindOfSim::RunPeriodWeather; - state->dataGlobal->NumOfTimeStepInHour = NumTimeSteps; + state->dataGlobal->TimeStepsInHour = NumTimeSteps; state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 25; state->dataHeatBal->SurfSunlitFrac.allocate(HoursInDay, NumTimeSteps, state->dataSurface->TotSurfaces); for (int iHour = 1; iHour <= 24; ++iHour) { // Do for all hours. - for (int TS = 1; TS <= state->dataGlobal->NumOfTimeStepInHour; ++TS) { - if (TS == state->dataGlobal->NumOfTimeStepInHour) { + for (int TS = 1; TS <= state->dataGlobal->TimeStepsInHour; ++TS) { + if (TS == state->dataGlobal->TimeStepsInHour) { expected_values += fmt::format(" 01/25 {:02}:00,", iHour); } else { expected_values += fmt::format(" 01/25 {:02}:30,", iHour - 1); @@ -4178,15 +4165,14 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_PolygonOverlap) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); - SimulationManager::GetProjectData(*state); bool FoundError = false; HeatBalanceManager::GetProjectControlData(*state, FoundError); // read project control data EXPECT_FALSE(FoundError); // expect no errors HeatBalanceManager::SetPreConstructionInputParameters(*state); - ScheduleManager::ProcessScheduleInput(*state); // read schedules Material::GetMaterialData(*state, FoundError); EXPECT_FALSE(FoundError); @@ -4212,8 +4198,8 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_PolygonOverlap) state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; @@ -4259,20 +4245,14 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_PolygonOverlap) int treeSurfNum = Util::FindItemInList("ZN001:WALL-SOUTH:TREE", state->dataSurface->Surface); // Get shading surface schedule indexes - int overhangSchedNum = state->dataSurface->Surface(overhangSurfNum).SchedShadowSurfIndex; - int treeSchedNum = state->dataSurface->Surface(treeSurfNum).SchedShadowSurfIndex; - - // Use EMS to turn shading surfaces on and off - auto &overhangSchedEMSOn = state->dataScheduleMgr->Schedule(overhangSchedNum).EMSActuatedOn; - auto &treeSchedEMSOn = state->dataScheduleMgr->Schedule(treeSchedNum).EMSActuatedOn; - auto &overhangSchedEMSValue = state->dataScheduleMgr->Schedule(overhangSchedNum).EMSValue; - auto &treeSchedEMSValue = state->dataScheduleMgr->Schedule(treeSchedNum).EMSValue; + auto *overhangSched = dynamic_cast(state->dataSurface->Surface(overhangSurfNum).shadowSurfSched); + auto *treeSched = dynamic_cast(state->dataSurface->Surface(treeSurfNum).shadowSurfSched); // Overhang transparent, Tree transparent - overhangSchedEMSOn = true; - treeSchedEMSOn = true; - overhangSchedEMSValue = 1.0; - treeSchedEMSValue = 1.0; + overhangSched->EMSActuatedOn = true; + treeSched->EMSActuatedOn = true; + overhangSched->EMSVal = 1.0; + treeSched->EMSVal = 1.0; FigureSolarBeamAtTimestep(*state, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep); ReportSurfaceShading(*state); @@ -4280,10 +4260,10 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_PolygonOverlap) EXPECT_NEAR(1.0, state->dataSurface->SurfSunlitFrac(winSurfNum), 0.0001); // Overhang opaque, Tree transparent - overhangSchedEMSOn = true; - treeSchedEMSOn = true; - overhangSchedEMSValue = 0.0; - treeSchedEMSValue = 1.0; + overhangSched->EMSActuatedOn = true; + treeSched->EMSActuatedOn = true; + overhangSched->EMSVal = 0.0; + treeSched->EMSVal = 1.0; FigureSolarBeamAtTimestep(*state, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep); ReportSurfaceShading(*state); @@ -4293,10 +4273,10 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_PolygonOverlap) EXPECT_NEAR(0.76955, winSunLitFracOverhangOnly, 0.0001); // Overhang tranparent, Tree opaque - overhangSchedEMSOn = true; - treeSchedEMSOn = true; - overhangSchedEMSValue = 1.0; - treeSchedEMSValue = 0.0; + overhangSched->EMSActuatedOn = true; + treeSched->EMSActuatedOn = true; + overhangSched->EMSVal = 1.0; + treeSched->EMSVal = 0.0; FigureSolarBeamAtTimestep(*state, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep); ReportSurfaceShading(*state); @@ -4306,10 +4286,10 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_PolygonOverlap) EXPECT_NEAR(0.05484, winSunLitFracTreeOnly, 0.0001); // Overhang opaque, Tree opaque - overhangSchedEMSOn = true; - treeSchedEMSOn = true; - overhangSchedEMSValue = 0.0; - treeSchedEMSValue = 0.0; + overhangSched->EMSActuatedOn = true; + treeSched->EMSActuatedOn = true; + overhangSched->EMSVal = 0.0; + treeSched->EMSVal = 0.0; FigureSolarBeamAtTimestep(*state, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep); ReportSurfaceShading(*state); @@ -4320,8 +4300,8 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_PolygonOverlap) // Use the base transmittance schedules (no EMS override) // Overhang transmittance = 0.5, Tree transmittance = 0.8 - overhangSchedEMSOn = false; - treeSchedEMSOn = false; + overhangSched->EMSActuatedOn = false; + treeSched->EMSActuatedOn = false; FigureSolarBeamAtTimestep(*state, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep); ReportSurfaceShading(*state); @@ -4360,10 +4340,10 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_PolygonOverlap) state->dataSolarShading->CalcSkyDifShading = false; // Overhang transparent, Tree transparent - overhangSchedEMSOn = true; - treeSchedEMSOn = true; - overhangSchedEMSValue = 1.0; - treeSchedEMSValue = 1.0; + overhangSched->EMSActuatedOn = true; + treeSched->EMSActuatedOn = true; + overhangSched->EMSVal = 1.0; + treeSched->EMSVal = 1.0; FigureSolarBeamAtTimestep(*state, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep); ReportSurfaceShading(*state); @@ -4371,10 +4351,10 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_PolygonOverlap) EXPECT_NEAR(1.0, state->dataSurface->SurfSunlitFrac(winSurfNum), 0.0001); // Overhang opaque, Tree transparent - overhangSchedEMSOn = true; - treeSchedEMSOn = true; - overhangSchedEMSValue = 0.0; - treeSchedEMSValue = 1.0; + overhangSched->EMSActuatedOn = true; + treeSched->EMSActuatedOn = true; + overhangSched->EMSVal = 0.0; + treeSched->EMSVal = 1.0; FigureSolarBeamAtTimestep(*state, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep); ReportSurfaceShading(*state); @@ -4384,10 +4364,10 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_PolygonOverlap) EXPECT_NEAR(0.08560, winSunLitFracOverhangOnly, 0.0001); // Overhang tranparent, Tree opaque - overhangSchedEMSOn = true; - treeSchedEMSOn = true; - overhangSchedEMSValue = 1.0; - treeSchedEMSValue = 0.0; + overhangSched->EMSActuatedOn = true; + treeSched->EMSActuatedOn = true; + overhangSched->EMSVal = 1.0; + treeSched->EMSVal = 0.0; FigureSolarBeamAtTimestep(*state, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep); ReportSurfaceShading(*state); @@ -4397,10 +4377,10 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_PolygonOverlap) EXPECT_NEAR(0.60655, winSunLitFracTreeOnly, 0.0001); // Overhang opaque, Tree opaque - overhangSchedEMSOn = true; - treeSchedEMSOn = true; - overhangSchedEMSValue = 0.0; - treeSchedEMSValue = 0.0; + overhangSched->EMSActuatedOn = true; + treeSched->EMSActuatedOn = true; + overhangSched->EMSVal = 0.0; + treeSched->EMSVal = 0.0; FigureSolarBeamAtTimestep(*state, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep); ReportSurfaceShading(*state); wallSunLitFracOverhangTree = state->dataSurface->SurfSunlitFrac(wallSurfNum); @@ -4411,8 +4391,8 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_PolygonOverlap) // Use the base transmittance schedules (no EMS override) // Overhang transmittance = 0.5, Tree transmittance = 0.8 - overhangSchedEMSOn = false; - treeSchedEMSOn = false; + overhangSched->EMSActuatedOn = false; + treeSched->EMSActuatedOn = false; FigureSolarBeamAtTimestep(*state, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep); ReportSurfaceShading(*state); @@ -4611,15 +4591,14 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_PolygonOverlap2) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); - SimulationManager::GetProjectData(*state); bool FoundError = false; HeatBalanceManager::GetProjectControlData(*state, FoundError); // read project control data EXPECT_FALSE(FoundError); // expect no errors HeatBalanceManager::SetPreConstructionInputParameters(*state); - ScheduleManager::ProcessScheduleInput(*state); // read schedules Material::GetMaterialData(*state, FoundError); EXPECT_FALSE(FoundError); @@ -4643,8 +4622,8 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_PolygonOverlap2) state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; @@ -4689,20 +4668,14 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_PolygonOverlap2) int shade2SurfNum = Util::FindItemInList("ZN001:WALL-SOUTH:SHADE2", state->dataSurface->Surface); // Get shading surface schedule indexes - int shade1SchedNum = state->dataSurface->Surface(shade1SurfNum).SchedShadowSurfIndex; - int shade2SchedNum = state->dataSurface->Surface(shade2SurfNum).SchedShadowSurfIndex; - - // Use EMS to turn shading surfaces on and off - auto &shade1SchedEMSOn = state->dataScheduleMgr->Schedule(shade1SchedNum).EMSActuatedOn; - auto &shade2SchedEMSOn = state->dataScheduleMgr->Schedule(shade2SchedNum).EMSActuatedOn; - auto &shade1SchedEMSValue = state->dataScheduleMgr->Schedule(shade1SchedNum).EMSValue; - auto &shade2SchedEMSValue = state->dataScheduleMgr->Schedule(shade2SchedNum).EMSValue; + auto *shade1Sched = state->dataSurface->Surface(shade1SurfNum).shadowSurfSched; + auto *shade2Sched = state->dataSurface->Surface(shade2SurfNum).shadowSurfSched; // shade1 transparent, shade2 transparent - shade1SchedEMSOn = true; - shade2SchedEMSOn = true; - shade1SchedEMSValue = 1.0; - shade2SchedEMSValue = 1.0; + shade1Sched->EMSActuatedOn = true; + shade2Sched->EMSActuatedOn = true; + shade1Sched->EMSVal = 1.0; + shade2Sched->EMSVal = 1.0; // Gotten from running 1ZoneUncontrolled.idf with chicago weather on Jan 1 at 12 state->dataBSDFWindow->SUNCOSTS(state->dataGlobal->TimeStep, state->dataGlobal->HourOfDay)(1) = 0.20531446332266728; @@ -4715,10 +4688,10 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_PolygonOverlap2) EXPECT_NEAR(1.0, state->dataSurface->SurfSunlitFrac(winSurfNum), 0.0001); // shade1 opaque, shade2 transparent - shade1SchedEMSOn = true; - shade2SchedEMSOn = true; - shade1SchedEMSValue = 0.0; - shade2SchedEMSValue = 1.0; + shade1Sched->EMSActuatedOn = true; + shade2Sched->EMSActuatedOn = true; + shade1Sched->EMSVal = 0.0; + shade2Sched->EMSVal = 1.0; FigureSolarBeamAtTimestep(*state, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep); ReportSurfaceShading(*state); @@ -4728,10 +4701,10 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_PolygonOverlap2) EXPECT_NEAR(0.0, winSunLitFracShade1Only, 0.0001); // shade1 transparent, shade2 opaque - shade1SchedEMSOn = true; - shade2SchedEMSOn = true; - shade1SchedEMSValue = 1.0; - shade2SchedEMSValue = 0.0; + shade1Sched->EMSActuatedOn = true; + shade2Sched->EMSActuatedOn = true; + shade1Sched->EMSVal = 1.0; + shade2Sched->EMSVal = 0.0; FigureSolarBeamAtTimestep(*state, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep); ReportSurfaceShading(*state); @@ -4741,10 +4714,10 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_PolygonOverlap2) EXPECT_NEAR(0.0, winSunLitFracShade2Only, 0.0001); // shade1 opaque, shade2 opaque - shade1SchedEMSOn = true; - shade2SchedEMSOn = true; - shade1SchedEMSValue = 0.0; - shade2SchedEMSValue = 0.0; + shade1Sched->EMSActuatedOn = true; + shade2Sched->EMSActuatedOn = true; + shade1Sched->EMSVal = 0.0; + shade2Sched->EMSVal = 0.0; FigureSolarBeamAtTimestep(*state, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep); ReportSurfaceShading(*state); @@ -4755,8 +4728,8 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_PolygonOverlap2) // Use the base transmittance schedules (no EMS override) // shade1 transmittance = 0.5, shade2 transmittance = 0.8 - shade1SchedEMSOn = false; - shade2SchedEMSOn = false; + shade1Sched->EMSActuatedOn = false; + shade2Sched->EMSActuatedOn = false; FigureSolarBeamAtTimestep(*state, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep); ReportSurfaceShading(*state); @@ -4978,15 +4951,14 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_PolygonOverlap3) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); - SimulationManager::GetProjectData(*state); bool FoundError = false; HeatBalanceManager::GetProjectControlData(*state, FoundError); // read project control data EXPECT_FALSE(FoundError); // expect no errors HeatBalanceManager::SetPreConstructionInputParameters(*state); - ScheduleManager::ProcessScheduleInput(*state); // read schedules Material::GetMaterialData(*state, FoundError); EXPECT_FALSE(FoundError); @@ -5010,8 +4982,8 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_PolygonOverlap3) state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; @@ -5110,7 +5082,7 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_checkScheduledSurfacePresent) } TEST_F(EnergyPlusFixture, SolarShadingTest_CalcBeamSolarOnWinRevealSurface) { - state->dataGlobal->NumOfTimeStepInHour = 6; + state->dataGlobal->TimeStepsInHour = 6; state->dataSurface->FrameDivider.allocate(2); auto &frameDivider1 = state->dataSurface->FrameDivider(1); @@ -5223,7 +5195,7 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_CalcBeamSolarOnWinRevealSurface) construct1.LayerPoint(1) = 1; construct1.Name = "Construction1"; construct1.TotGlassLayers = 1; - construct1.TransSolBeamCoef(1) = 0.9; + construct1.TransSolBeamCoef[0] = 0.9; auto &s_mat = state->dataMaterial; @@ -5250,7 +5222,7 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_CalcBeamSolarOnWinRevealSurface) state->dataHeatBal->SurfSunlitFracWithoutReveal(state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep, 2) = 1.0; Window::W5InitGlassParameters(*state); - construct1.TransSolBeamCoef(1) = 0.9; + construct1.TransSolBeamCoef[0] = 0.9; state->dataSurface->SurfWinTanProfileAngVert(1) = 10.0; state->dataSurface->SurfWinTanProfileAngVert(2) = 10.0; state->dataSurface->SurfWinTanProfileAngHor(1) = 10.0; @@ -5545,22 +5517,21 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_CalcInteriorSolarDistribution_Detaile }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); - SimulationManager::GetProjectData(*state); bool FoundError = false; HeatBalanceManager::GetProjectControlData(*state, FoundError); // read project control data EXPECT_FALSE(FoundError); // expect no errors HeatBalanceManager::SetPreConstructionInputParameters(*state); - ScheduleManager::ProcessScheduleInput(*state); // read schedules HeatBalanceManager::GetHeatBalanceInput(*state); state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; @@ -5917,22 +5888,21 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_CalcInteriorSolarDistribution_EQL) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); - SimulationManager::GetProjectData(*state); bool FoundError = false; HeatBalanceManager::GetProjectControlData(*state, FoundError); // read project control data EXPECT_FALSE(FoundError); // expect no errors HeatBalanceManager::SetPreConstructionInputParameters(*state); - ScheduleManager::ProcessScheduleInput(*state); // read schedules HeatBalanceManager::GetHeatBalanceInput(*state); state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; @@ -6068,7 +6038,6 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_GetShadowingInputTest3) }); ASSERT_TRUE(process_idf(idf_objects)); - state->dataSolarShading->anyScheduledShadingSurface = false; // Test 3 of 6: Polygon Clipping and SlaterBarskyandSutherlandHodgman @@ -6101,7 +6070,6 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_GetShadowingInputTest4) }); ASSERT_TRUE(process_idf(idf_objects)); - state->dataSolarShading->anyScheduledShadingSurface = false; // Test 4 of 6: Pixel Counting and ConvexWeilerAtherton @@ -6143,7 +6111,6 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_GetShadowingInputTest5) }); ASSERT_TRUE(process_idf(idf_objects)); - state->dataSolarShading->anyScheduledShadingSurface = false; // Test 5 of 6: Pixel Counting and SutherlandHodgman diff --git a/tst/EnergyPlus/unit/SortAndStringUtilities.unit.cc b/tst/EnergyPlus/unit/SortAndStringUtilities.unit.cc index 22e3db70b99..7438f1e92d4 100644 --- a/tst/EnergyPlus/unit/SortAndStringUtilities.unit.cc +++ b/tst/EnergyPlus/unit/SortAndStringUtilities.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/Standard621SimplifiedProcedure.unit.cc b/tst/EnergyPlus/unit/Standard621SimplifiedProcedure.unit.cc index 5c78b1b55fb..4b539ed22fb 100644 --- a/tst/EnergyPlus/unit/Standard621SimplifiedProcedure.unit.cc +++ b/tst/EnergyPlus/unit/Standard621SimplifiedProcedure.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/StandardRatings.unit.cc b/tst/EnergyPlus/unit/StandardRatings.unit.cc index 4a0bfea8108..223ad887d10 100644 --- a/tst/EnergyPlus/unit/StandardRatings.unit.cc +++ b/tst/EnergyPlus/unit/StandardRatings.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -101,7 +101,7 @@ TEST_F(EnergyPlusFixture, SingleSpeedHeatingCoilCurveTest) Coil.Name = "DX Single Speed Heating Coil"; Coil.DXCoilType = "Coil:Heating:DX:SingleSpeed"; Coil.DXCoilType_Num = HVAC::CoilDX_HeatingEmpirical; - Coil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; + Coil.availSched = Sched::GetScheduleAlwaysOn(*state); Coil.RatedSHR(1) = 1.0; Coil.RatedTotCap(1) = 1600.0; Coil.RatedCOP(1) = 4.0; @@ -297,7 +297,7 @@ TEST_F(EnergyPlusFixture, SingleSpeedHeatingCoilCurveTest_PositiveCurve) Coil.Name = "DX Single Speed Heating Coil"; Coil.DXCoilType = "Coil:Heating:DX:SingleSpeed"; Coil.DXCoilType_Num = HVAC::CoilDX_HeatingEmpirical; - Coil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; + Coil.availSched = Sched::GetScheduleAlwaysOn(*state); Coil.RatedSHR(1) = 1.0; Coil.RatedTotCap(1) = 1600.0; Coil.RatedCOP(1) = 4.0; @@ -484,7 +484,7 @@ TEST_F(EnergyPlusFixture, SingleSpeedHeatingCoilCurveTest2023) Coil.Name = "HeatingCoilDXSingleSpeedAutosize"; Coil.DXCoilType = "Coil:Heating:DX:SingleSpeed"; Coil.DXCoilType_Num = HVAC::CoilDX_HeatingEmpirical; - Coil.SchedPtr = ScheduleManager::ScheduleAlwaysOn; + Coil.availSched = Sched::GetScheduleAlwaysOn(*state); Coil.RatedSHR(1) = 1.0; Coil.RatedTotCap(1) = 1600.0; Coil.RatedCOP(1) = 3.8; // @@ -739,6 +739,8 @@ TEST_F(EnergyPlusFixture, SingleSpeedHeatingCurveTest2023_II) ASSERT_TRUE(process_idf(idf_objects1)); + state->init_state(*state); + GetDXCoils(*state); auto &Coil(state->dataDXCoils->DXCoil(1)); @@ -967,6 +969,8 @@ TEST_F(EnergyPlusFixture, MultiSpeedHeatingCoil_HSPFValueTest_2Speed) ASSERT_TRUE(process_idf(idf_objects1)); + state->init_state(*state); + GetDXCoils(*state); auto &Coil(state->dataDXCoils->DXCoil(1)); @@ -1283,10 +1287,9 @@ TEST_F(EnergyPlusFixture, ChillerIPLVTestWaterCooledReform) loopsidebranch.TotalComponents = 1; loopsidebranch.Comp.allocate(1); state->dataPlnt->PlantLoop(1).Name = "ChilledWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "ChilledWater"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).PlantSizNum = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); Real64 IPLVSI = 0.0; Real64 IPLVIP = 0.0; @@ -1430,6 +1433,8 @@ TEST_F(EnergyPlusFixture, SingleSpeedCoolingCoil_15000W_SameFanPower_SEER2_2023_ ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetDXCoils(*state); auto &thisCoil(state->dataDXCoils->DXCoil(1)); @@ -1697,6 +1702,8 @@ TEST_F(EnergyPlusFixture, SingleSpeedCoolingCoil_9000W_SEER2_2023_ValueTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetDXCoils(*state); auto &thisCoil(state->dataDXCoils->DXCoil(1)); @@ -1963,6 +1970,8 @@ TEST_F(EnergyPlusFixture, SingleSpeedCoolingCoil_18000W_SEER2_2023_ValueTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetDXCoils(*state); auto &thisCoil(state->dataDXCoils->DXCoil(1)); @@ -2219,6 +2228,8 @@ TEST_F(EnergyPlusFixture, SingleSpeedCoolingCoilAir_25000W_IEER_2022_ValueTest) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetDXCoils(*state); auto &thisCoil(state->dataDXCoils->DXCoil(1)); @@ -2369,6 +2380,8 @@ TEST_F(EnergyPlusFixture, SingleSpeedCoolingCoilEvap_32000W_IEER_2022_ValueTest) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetDXCoils(*state); auto &thisCoil(state->dataDXCoils->DXCoil(1)); @@ -2513,6 +2526,8 @@ TEST_F(EnergyPlusFixture, SingleSpeedCoolingCoilAir_AHRIExample_IEER_2022_ValueT ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetDXCoils(*state); auto &thisCoil(state->dataDXCoils->DXCoil(1)); @@ -2999,6 +3014,8 @@ TEST_F(EnergyPlusFixture, MultiSpeedCoolingCoil_02_Speed_4400W_SEER2_2023_ValueT ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetDXCoils(*state); auto &thisCoil(state->dataDXCoils->DXCoil(1)); @@ -3593,6 +3610,8 @@ TEST_F(EnergyPlusFixture, MultiSpeedCoolingCoil_03_Speed_12000W_SEER2_2023_Value ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetDXCoils(*state); auto &thisCoil(state->dataDXCoils->DXCoil(1)); @@ -4142,6 +4161,7 @@ TEST_F(EnergyPlusFixture, MultiSpeedCoolingCoil_04_Speed_17750W_SEER2_2023_Value }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetDXCoils(*state); @@ -4329,6 +4349,8 @@ TEST_F(EnergyPlusFixture, MultiSpeedCoolingCoil_02_Speeds_27717W_IEER_2022_Value }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetDXCoils(*state); auto &thisCoil(state->dataDXCoils->DXCoil(1)); auto &thisCoolPLFfPLR(state->dataCurveManager->PerfCurve(thisCoil.MSPLFFPLR(1))); @@ -4798,6 +4820,8 @@ TEST_F(EnergyPlusFixture, MultiSpeedCoolingCoil_03_Speeds_27717W_IEER_2022_Value ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetDXCoils(*state); auto &thisCoil(state->dataDXCoils->DXCoil(1)); auto &thisCoolPLFfPLR(state->dataCurveManager->PerfCurve(thisCoil.MSPLFFPLR(1))); @@ -5302,6 +5326,8 @@ TEST_F(EnergyPlusFixture, MultiSpeedCoolingCoil_04_Speeds_35500W_COP3_IEER_2022_ }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetDXCoils(*state); auto &thisCoil(state->dataDXCoils->DXCoil(1)); auto &thisCoolPLFfPLR(state->dataCurveManager->PerfCurve(thisCoil.MSPLFFPLR(1))); @@ -5556,6 +5582,8 @@ TEST_F(EnergyPlusFixture, MultiSpeedCoolingCoil_04_Speed_35500W_COP4_IEER_2022_V ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetDXCoils(*state); auto &thisCoil(state->dataDXCoils->DXCoil(1)); @@ -5706,6 +5734,8 @@ TEST_F(EnergyPlusFixture, VariableSpeedCooling_01_Speed_7200W_SEER2_2023_ValueTe ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + // get coil inputs EnergyPlus::VariableSpeedCoils::GetVarSpeedCoilInput(*state); EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).Name, "ZONE1PTHPDXCOOLCOIL"); @@ -5937,6 +5967,8 @@ TEST_F(EnergyPlusFixture, VariableSpeedCooling_02_Speed_7200W_SEER2_2023_ValueTe ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + // get coil inputs EnergyPlus::VariableSpeedCoils::GetVarSpeedCoilInput(*state); EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).Name, "ZONE1PTHPDXCOOLCOIL"); @@ -6177,6 +6209,7 @@ TEST_F(EnergyPlusFixture, VariableSpeedCooling_03_Speed_7200W_SEER2_2023_ValueTe }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // get coil inputs EnergyPlus::VariableSpeedCoils::GetVarSpeedCoilInput(*state); EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).Name, "ZONE1PTHPDXCOOLCOIL"); @@ -6430,6 +6463,7 @@ TEST_F(EnergyPlusFixture, VariableSpeedCooling_04_Speed_7200W_SEER2_2023_ValueTe ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // get coil inputs EnergyPlus::VariableSpeedCoils::GetVarSpeedCoilInput(*state); EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).Name, "ZONE1PTHPDXCOOLCOIL"); @@ -6720,6 +6754,8 @@ TEST_F(EnergyPlusFixture, VariableSpeedCooling_07_Speed_7200W_SEER2_2023_ValueTe }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + // get coil inputs EnergyPlus::VariableSpeedCoils::GetVarSpeedCoilInput(*state); EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).Name, "ZONE1PTHPDXCOOLCOIL"); @@ -7012,6 +7048,7 @@ TEST_F(EnergyPlusFixture, VariableSpeedCooling_07_Speed_14400W_SEER2_2023_ValueT ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // get coil inputs EnergyPlus::VariableSpeedCoils::GetVarSpeedCoilInput(*state); EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).Name, "ZONE1PTHPDXCOOLCOIL"); @@ -7339,6 +7376,8 @@ TEST_F(EnergyPlusFixture, VariableSpeedCooling_10_Speed_7200W_SEER2_2023_ValueTe ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + // get coil inputs EnergyPlus::VariableSpeedCoils::GetVarSpeedCoilInput(*state); EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).Name, "ZONE1PTHPDXCOOLCOIL"); @@ -7666,6 +7705,8 @@ TEST_F(EnergyPlusFixture, VariableSpeedCooling_10_Speed_14400W_SEER2_2023_ValueT ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + // get coil inputs EnergyPlus::VariableSpeedCoils::GetVarSpeedCoilInput(*state); EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).Name, "ZONE1PTHPDXCOOLCOIL"); @@ -7875,6 +7916,8 @@ TEST_F(EnergyPlusFixture, VariableSpeedCooling_01_Speed_22000W_IEER_2022_ValueTe ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + // get coil inputs EnergyPlus::VariableSpeedCoils::GetVarSpeedCoilInput(*state); EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).Name, "DESICCANT DXSYSTEM VS COOLING COIL"); @@ -8128,6 +8171,8 @@ TEST_F(EnergyPlusFixture, VariableSpeedCooling_02_Speed_36000W_IEER_2022_ValueTe ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + // get coil inputs EnergyPlus::VariableSpeedCoils::GetVarSpeedCoilInput(*state); EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).Name, "HEAT PUMP ACDXCOIL 1"); @@ -8432,6 +8477,8 @@ TEST_F(EnergyPlusFixture, VariableSpeedCooling_03_Speed_36000W_IEER_2022_ValueTe ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + // get coil inputs EnergyPlus::VariableSpeedCoils::GetVarSpeedCoilInput(*state); EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).Name, "HEAT PUMP ACDXCOIL 1"); @@ -8698,6 +8745,8 @@ TEST_F(EnergyPlusFixture, VariableSpeedCooling_04_Speed_36000W_IEER_2022_ValueTe ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + // get coil inputs EnergyPlus::VariableSpeedCoils::GetVarSpeedCoilInput(*state); EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).Name, "SYS 4 HEAT PUMP AIR SOURCE COOLING COIL"); @@ -8989,6 +9038,8 @@ TEST_F(EnergyPlusFixture, VariableSpeedCooling_07_Speed_25001W_IEER_2022_ValueTe ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + // get coil inputs EnergyPlus::VariableSpeedCoils::GetVarSpeedCoilInput(*state); EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).Name, "ZONE1PTHPDXCOOLCOIL"); @@ -9321,6 +9372,7 @@ TEST_F(EnergyPlusFixture, VariableSpeedCooling_10_Speed_34582W_IEER_2022_ValueTe ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // get coil inputs EnergyPlus::VariableSpeedCoils::GetVarSpeedCoilInput(*state); EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).Name, "ZONE1PTHPDXCOOLCOIL"); @@ -9657,6 +9709,7 @@ TEST_F(EnergyPlusFixture, VariableSpeedCooling_10_Speed_32000W_IEER_2022_ValueTe ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // get coil inputs EnergyPlus::VariableSpeedCoils::GetVarSpeedCoilInput(*state); EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).Name, "ZONE1PTHPDXCOOLCOIL"); @@ -10006,6 +10059,7 @@ TEST_F(EnergyPlusFixture, VariableSpeedCooling_04_Speed_AutoSize_IEER_2022_Value ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // get coil inputs EnergyPlus::VariableSpeedCoils::GetVarSpeedCoilInput(*state); EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).Name, "HEAT PUMP ACDXCOIL 1"); @@ -10269,6 +10323,7 @@ TEST_F(EnergyPlusFixture, TwoSpeedCoolingCoilAir_18000W_SEER2_2023_ValueTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetDXCoils(*state); auto &thisCoil(state->dataDXCoils->DXCoil(1)); @@ -10559,6 +10614,8 @@ TEST_F(EnergyPlusFixture, TwoSpeedCoolingCoilAir_12000W_SEER2_2023_ValueTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetDXCoils(*state); auto &thisCoil(state->dataDXCoils->DXCoil(1)); @@ -10838,6 +10895,7 @@ TEST_F(EnergyPlusFixture, TwoSpeedCoolingCoilAir_39000W_IEER_2022_ValueTest) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetDXCoils(*state); auto &thisCoil(state->dataDXCoils->DXCoil(1)); @@ -11127,6 +11185,7 @@ TEST_F(EnergyPlusFixture, TwoSpeedCoolingCoilAir_54000W_IEER_2022_ValueTest) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetDXCoils(*state); auto &thisCoil(state->dataDXCoils->DXCoil(1)); @@ -11424,6 +11483,7 @@ TEST_F(EnergyPlusFixture, TwoSpeedCoolingCoilAir_33000W_IEER_2022_ValueTest) ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetDXCoils(*state); auto &thisCoil(state->dataDXCoils->DXCoil(1)); @@ -11723,9 +11783,10 @@ TEST_F(EnergyPlusFixture, CurveFit_02_Speed_15000W_alternateMode_SEER2_2023_Valu }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); int coilIndex = CoilCoolingDX::factory(*state, "DX Cooling Coil"); - auto &thisCoil(state->dataCoilCooingDX->coilCoolingDXs[coilIndex]); + auto &thisCoil(state->dataCoilCoolingDX->coilCoolingDXs[coilIndex]); // size it thisCoil.size(*state); @@ -12044,9 +12105,10 @@ TEST_F(EnergyPlusFixture, CurveFit_03_Speed_5000W_SEER2_2023_ValueTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); int coilIndex = CoilCoolingDX::factory(*state, "Sys 2 Furnace DX Cool Cooling Coil"); - auto &thisCoil(state->dataCoilCooingDX->coilCoolingDXs[coilIndex]); + auto &thisCoil(state->dataCoilCoolingDX->coilCoolingDXs[coilIndex]); // size it thisCoil.size(*state); @@ -12347,9 +12409,10 @@ TEST_F(EnergyPlusFixture, CurveFit_02_Speed_30000W_alternateMode_IEER_2022_Value }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); int coilIndex = CoilCoolingDX::factory(*state, "DX Cooling Coil"); - auto &thisCoil(state->dataCoilCooingDX->coilCoolingDXs[coilIndex]); + auto &thisCoil(state->dataCoilCoolingDX->coilCoolingDXs[coilIndex]); // size it thisCoil.size(*state); @@ -12666,9 +12729,10 @@ TEST_F(EnergyPlusFixture, CurveFit_03_Speed_20000W_IEER_2022_ValueTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); int coilIndex = CoilCoolingDX::factory(*state, "Sys 2 Furnace DX Cool Cooling Coil"); - auto &thisCoil(state->dataCoilCooingDX->coilCoolingDXs[coilIndex]); + auto &thisCoil(state->dataCoilCoolingDX->coilCoolingDXs[coilIndex]); // size it thisCoil.size(*state); diff --git a/tst/EnergyPlus/unit/StringUtilities.unit.cc b/tst/EnergyPlus/unit/StringUtilities.unit.cc index a4867756549..4fe7423374c 100644 --- a/tst/EnergyPlus/unit/StringUtilities.unit.cc +++ b/tst/EnergyPlus/unit/StringUtilities.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc index 97dfe665b7c..f11cfcea2df 100644 --- a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc +++ b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -86,7 +87,7 @@ using namespace EnergyPlus::Material; TEST_F(EnergyPlusFixture, BaseSurfaceRectangularTest) { - + state->init_state(*state); // Test base surfaces for rectangular shape in ProcessSurfaceVertices state->dataSurface->TotSurfaces = 5; @@ -238,7 +239,6 @@ TEST_F(EnergyPlusFixture, BaseSurfaceRectangularTest) TEST_F(EnergyPlusFixture, DataSurfaces_SurfaceShape) { - bool ErrorsFound(false); std::string const idf_objects = delimited_string({ @@ -484,9 +484,7 @@ TEST_F(EnergyPlusFixture, DataSurfaces_SurfaceShape) }); ASSERT_TRUE(process_idf(idf_objects)); - - GetProjectControlData(*state, ErrorsFound); // read project control data - EXPECT_FALSE(ErrorsFound); // expect no errors + state->init_state(*state); GetMaterialData(*state, ErrorsFound); // read material data EXPECT_FALSE(ErrorsFound); // expect no errors @@ -500,8 +498,8 @@ TEST_F(EnergyPlusFixture, DataSurfaces_SurfaceShape) state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; @@ -581,6 +579,7 @@ TEST_F(EnergyPlusFixture, DataSurfaces_SurfaceShape) TEST_F(EnergyPlusFixture, ConfirmCheckSubSurfAzTiltNorm) { + state->init_state(*state); SurfaceData BaseSurface; SurfaceData SubSurface; bool surfaceError; @@ -600,7 +599,8 @@ TEST_F(EnergyPlusFixture, ConfirmCheckSubSurfAzTiltNorm) SubSurface.NewellSurfaceNormalVector.z = 1.; checkSubSurfAzTiltNorm(*state, BaseSurface, SubSurface, surfaceError); EXPECT_FALSE(surfaceError); - EXPECT_FALSE(has_err_output()); + EXPECT_EQ(state->dataErrTracking->TotalSevereErrors, 0); + EXPECT_EQ(state->dataErrTracking->TotalWarningErrors, 1); // IDF version object // Case 2 - Base surface and subsurface face the opposite way - should be error message and surfaceError=true surfaceError = false; @@ -711,6 +711,7 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_MakeMirrorSurface) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool FoundError = false; GetMaterialData(*state, FoundError); @@ -772,6 +773,7 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_MakeMirrorSurface) TEST_F(EnergyPlusFixture, SurfacesGeometry_CalcSurfaceCentroid_NonconvexRealisticZ) { + state->init_state(*state); state->dataSurface->TotSurfaces = 10; state->dataSurface->Surface.allocate(state->dataSurface->TotSurfaces); @@ -805,7 +807,6 @@ TEST_F(EnergyPlusFixture, SurfacesGeometry_CalcSurfaceCentroid_NonconvexRealisti TEST_F(EnergyPlusFixture, MakeEquivalentRectangle) { - bool ErrorsFound(false); std::string const idf_objects = delimited_string({ @@ -949,6 +950,8 @@ TEST_F(EnergyPlusFixture, MakeEquivalentRectangle) // Prepare data for the test ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetMaterialData(*state, ErrorsFound); // read material data EXPECT_FALSE(ErrorsFound); GetConstructData(*state, ErrorsFound); // read construction data @@ -959,8 +962,8 @@ TEST_F(EnergyPlusFixture, MakeEquivalentRectangle) EXPECT_FALSE(ErrorsFound); state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; GetSurfaceData(*state, ErrorsFound); // setup zone geometry and get zone data @@ -989,7 +992,6 @@ TEST_F(EnergyPlusFixture, MakeEquivalentRectangle) TEST_F(EnergyPlusFixture, SurfaceGeometryUnitTests_distance) { - DataVectorTypes::Vector a; DataVectorTypes::Vector b; @@ -2814,8 +2816,8 @@ TEST_F(EnergyPlusFixture, MakeRectangularVertices) state->dataSurfaceGeometry->CosZoneRelNorth.allocate(zoneNum); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(zoneNum); - state->dataSurfaceGeometry->CosZoneRelNorth(zoneNum) = std::cos(-state->dataHeatBal->Zone(zoneNum).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(zoneNum) = std::sin(-state->dataHeatBal->Zone(zoneNum).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(zoneNum) = std::cos(-state->dataHeatBal->Zone(zoneNum).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(zoneNum) = std::sin(-state->dataHeatBal->Zone(zoneNum).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; @@ -2964,6 +2966,7 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_VertexNumberMismatchTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataGlobal->NumOfZones = 2; state->dataHeatBal->Zone.allocate(2); @@ -3697,12 +3700,12 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_isWindowShadingControlSimilar_Test) state->dataSurface->WindowShadingControl(1).ShadingType = WinShadingType::ExtShade; state->dataSurface->WindowShadingControl(1).ShadingDevice = 17; state->dataSurface->WindowShadingControl(1).shadingControlType = WindowShadingControlType::OnIfScheduled; - state->dataSurface->WindowShadingControl(1).Schedule = 83; + state->dataSurface->WindowShadingControl(1).sched = nullptr; state->dataSurface->WindowShadingControl(1).SetPoint = 200; state->dataSurface->WindowShadingControl(1).SetPoint2 = 170; state->dataSurface->WindowShadingControl(1).ShadingControlIsScheduled = true; state->dataSurface->WindowShadingControl(1).GlareControlIsActive = false; - state->dataSurface->WindowShadingControl(1).SlatAngleSchedule = 84; + state->dataSurface->WindowShadingControl(1).slatAngleSched = nullptr; state->dataSurface->WindowShadingControl(1).slatAngleControl = SlatAngleControl::BlockBeamSolar; state->dataSurface->WindowShadingControl(1).DaylightingControlName = "TheDaylightingControl"; state->dataSurface->WindowShadingControl(1).DaylightControlIndex = 7; @@ -3738,11 +3741,11 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_isWindowShadingControlSimilar_Test) EXPECT_TRUE(isWindowShadingControlSimilar(*state, 1, 2)); state->dataSurface->WindowShadingControl(2) = state->dataSurface->WindowShadingControl(1); - state->dataSurface->WindowShadingControl(2).Schedule = 91; + state->dataSurface->WindowShadingControl(2).sched = Sched::GetScheduleAlwaysOn(*state); EXPECT_TRUE(isWindowShadingControlSimilar(*state, 1, 2)); state->dataSurface->WindowShadingControl(2) = state->dataSurface->WindowShadingControl(1); - state->dataSurface->WindowShadingControl(2).SlatAngleSchedule = 76; + state->dataSurface->WindowShadingControl(2).slatAngleSched = Sched::GetScheduleAlwaysOff(*state); EXPECT_TRUE(isWindowShadingControlSimilar(*state, 1, 2)); state->dataSurface->WindowShadingControl(2) = state->dataSurface->WindowShadingControl(1); @@ -3823,12 +3826,12 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_CheckWindowShadingControlSimilarForWin state->dataSurface->WindowShadingControl(1).ShadingType = WinShadingType::ExtShade; state->dataSurface->WindowShadingControl(1).ShadingDevice = 17; state->dataSurface->WindowShadingControl(1).shadingControlType = WindowShadingControlType::OnIfScheduled; - state->dataSurface->WindowShadingControl(1).Schedule = 83; + state->dataSurface->WindowShadingControl(1).sched = nullptr; state->dataSurface->WindowShadingControl(1).SetPoint = 200; state->dataSurface->WindowShadingControl(1).SetPoint2 = 170; state->dataSurface->WindowShadingControl(1).ShadingControlIsScheduled = true; state->dataSurface->WindowShadingControl(1).GlareControlIsActive = false; - state->dataSurface->WindowShadingControl(1).SlatAngleSchedule = 84; + state->dataSurface->WindowShadingControl(1).slatAngleSched = nullptr; state->dataSurface->WindowShadingControl(1).slatAngleControl = SlatAngleControl::BlockBeamSolar; state->dataSurface->WindowShadingControl(1).DaylightingControlName = "TheDaylightingControl"; state->dataSurface->WindowShadingControl(1).DaylightControlIndex = 7; @@ -4105,6 +4108,7 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_HeatTransferAlgorithmTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetProjectControlData(*state, ErrorsFound); // read project control data EXPECT_FALSE(ErrorsFound); // expect no errors @@ -4121,8 +4125,8 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_HeatTransferAlgorithmTest) state->dataSurfaceGeometry->CosZoneRelNorth.allocate(2); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(2); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosZoneRelNorth(2) = state->dataSurfaceGeometry->CosZoneRelNorth(1); state->dataSurfaceGeometry->SinZoneRelNorth(2) = state->dataSurfaceGeometry->SinZoneRelNorth(1); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; @@ -4221,6 +4225,7 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_SurfaceReferencesNonExistingSurface) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // Read Material and Construction, and expect no errors GetMaterialData(*state, ErrorsFound); @@ -4580,6 +4585,7 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_InternalMassSurfacesCount) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // Read Materials GetMaterialData(*state, ErrorsFound); @@ -4921,6 +4927,7 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_CreateInternalMassSurfaces) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // Read Materials GetMaterialData(*state, ErrorsFound); @@ -4989,6 +4996,7 @@ TEST_F(EnergyPlusFixture, WorldCoord_with_RelativeRectSurfCoord_test1) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound(false); @@ -5019,6 +5027,7 @@ TEST_F(EnergyPlusFixture, WorldCoord_with_RelativeRectSurfCoord_test2) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound(false); @@ -5049,6 +5058,7 @@ TEST_F(EnergyPlusFixture, WorldCoord_with_RelativeRectSurfCoord_test3) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound(false); @@ -5085,6 +5095,7 @@ TEST_F(EnergyPlusFixture, WorldCoord_with_RelativeRectSurfCoord_test4) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound(false); @@ -5395,6 +5406,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_SetupEnclosuresNoAirBoundari " 0,0,1; !- Vertex 1", }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; GetMaterialData(*state, ErrorsFound); // read material data @@ -5598,6 +5610,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_SetupEnclosuresWithAirBounda }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; GetMaterialData(*state, ErrorsFound); // read material data @@ -5798,6 +5811,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_SetupEnclosuresWithAirBounda }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; GetMaterialData(*state, ErrorsFound); // read material data @@ -6255,6 +6269,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_SetupEnclosuresWithAirBounda }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; GetMaterialData(*state, ErrorsFound); // read material data @@ -6808,6 +6823,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_SetupEnclosuresWithAirBounda }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; GetMaterialData(*state, ErrorsFound); // read material data @@ -7451,6 +7467,8 @@ TEST_F(EnergyPlusFixture, TwoZones_With_AirDoor) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + bool ErrorsFound = false; GetMaterialData(*state, ErrorsFound); // read material data @@ -7785,6 +7803,7 @@ TEST_F(EnergyPlusFixture, TwoZones_With_AirWindow) state->dataSurfaceGeometry->NoGroundTempObjWarning = false; ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; GetMaterialData(*state, ErrorsFound); // read material data @@ -8669,9 +8688,7 @@ TEST_F(EnergyPlusFixture, GetSurfaceData_SurfaceOrder) }); ASSERT_TRUE(process_idf(idf_objects)); - - GetProjectControlData(*state, ErrorsFound); // read project control data - EXPECT_FALSE(ErrorsFound); // expect no errors + state->init_state(*state); GetMaterialData(*state, ErrorsFound); // read material data EXPECT_FALSE(ErrorsFound); // expect no errors @@ -9654,6 +9671,7 @@ TEST_F(EnergyPlusFixture, GetSurfaceData_SurfaceOrder2) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetProjectControlData(*state, ErrorsFound); // read project control data EXPECT_FALSE(ErrorsFound); // expect no errors @@ -10507,6 +10525,7 @@ TEST_F(EnergyPlusFixture, GetSurfaceData_SurfaceOrder3) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetProjectControlData(*state, ErrorsFound); // read project control data EXPECT_FALSE(ErrorsFound); // expect no errors @@ -11274,6 +11293,7 @@ TEST_F(EnergyPlusFixture, GetSurfaceData_SurfaceOrder4) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetProjectControlData(*state, ErrorsFound); // read project control data EXPECT_FALSE(ErrorsFound); // expect no errors @@ -11662,6 +11682,7 @@ TEST_F(EnergyPlusFixture, Use_Gross_Roof_Area_for_Averge_Height) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -11961,6 +11982,7 @@ TEST_F(EnergyPlusFixture, Use_Gross_Roof_Area_for_Averge_Height_with_Window) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -12030,6 +12052,7 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_GetKivaFoundationTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetFoundationData(*state, ErrorsFound); std::string const error_string = delimited_string({ @@ -12058,6 +12081,7 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_GetKivaFoundationTest2) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataEnvrn->Elevation = 600.; @@ -12254,6 +12278,7 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_ZoneAndSpaceAreas) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; GetMaterialData(*state, ErrorsFound); // read material data @@ -12444,6 +12469,8 @@ TEST_F(EnergyPlusFixture, ZoneFloorAreaTest) // Prepare data for the test ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + GetMaterialData(*state, ErrorsFound); // read material data EXPECT_FALSE(ErrorsFound); GetConstructData(*state, ErrorsFound); // read construction data @@ -12454,8 +12481,8 @@ TEST_F(EnergyPlusFixture, ZoneFloorAreaTest) EXPECT_FALSE(ErrorsFound); state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; GetSurfaceData(*state, ErrorsFound); // setup zone geometry and get zone data @@ -12620,7 +12647,8 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_GetSurfaceGroundSurfsTest) " autocalculate; !- Volume {m3}"}); ASSERT_TRUE(process_idf(idf_objects)); - ScheduleManager::ProcessScheduleInput(*state); + state->init_state(*state); + state->dataHeatBal->ZoneIntGain.allocate(1); createFacilityElectricPowerServiceObject(*state); @@ -12635,7 +12663,7 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_GetSurfaceGroundSurfsTest) state->dataGlobal->TimeStepZone = 1; state->dataGlobal->TimeStepZoneSec = 3600.0; state->dataGlobal->HourOfDay = 1; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->BeginSimFlag = true; state->dataGlobal->BeginEnvrnFlag = true; state->dataEnvrn->OutBaroPress = 100000; @@ -12732,6 +12760,7 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_GetVerticesDropDuplicates) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataGlobal->NumOfZones = 2; state->dataHeatBal->Zone.allocate(2); @@ -12876,6 +12905,7 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_GetVerticesDropDuplicates_Once) fmt::arg("max_y", max_y), fmt::arg("off_y", off_y)); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataGlobal->NumOfZones = 2; state->dataHeatBal->Zone.allocate(2); @@ -13008,6 +13038,7 @@ TEST_F(EnergyPlusFixture, Wrong_Window_Construction) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetProjectControlData(*state, ErrorsFound); // read project control data EXPECT_FALSE(ErrorsFound); // expect no errors @@ -13024,8 +13055,8 @@ TEST_F(EnergyPlusFixture, Wrong_Window_Construction) state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; @@ -13222,6 +13253,7 @@ TEST_F(EnergyPlusFixture, CalculateZoneVolume_WithAirBoundaries) )IDF"; ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; + state->init_state(*state); GetMaterialData(*state, ErrorsFound); // read material data EXPECT_FALSE(ErrorsFound); // expect no errors @@ -13445,6 +13477,7 @@ TEST_F(EnergyPlusFixture, CalculatZoneVolume_WithoutAirBoundaries) )IDF"; ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; GetMaterialData(*state, ErrorsFound); // read material data @@ -13786,9 +13819,7 @@ TEST_F(EnergyPlusFixture, GetSurfaceData_ShadingSurfaceScheduleChecks) }); ASSERT_TRUE(process_idf(idf_objects)); - - SimulationManager::GetProjectData(*state); // read project data - ScheduleManager::ProcessScheduleInput(*state); + state->init_state(*state); GetMaterialData(*state, ErrorsFound); // read material data EXPECT_FALSE(ErrorsFound); // expect no errors @@ -14033,9 +14064,7 @@ TEST_F(EnergyPlusFixture, GetSurfaceData_ShadingSurfaceScheduleOutOfRange) }); ASSERT_TRUE(process_idf(idf_objects)); - - SimulationManager::GetProjectData(*state); // read project data - ScheduleManager::ProcessScheduleInput(*state); + state->init_state(*state); GetMaterialData(*state, ErrorsFound); // read material data EXPECT_FALSE(ErrorsFound); // expect no errors @@ -14049,31 +14078,15 @@ TEST_F(EnergyPlusFixture, GetSurfaceData_ShadingSurfaceScheduleOutOfRange) EXPECT_THROW(SetupZoneGeometry(*state, ErrorsFound), std::runtime_error); // EXPECT_THROW(GetSurfaceData(*state, ErrorsFound), std::runtime_error); EXPECT_TRUE(ErrorsFound); - std::string const error_string = delimited_string( - {" ** Severe ** Shading:Building:Detailed=\"BUILDINGSHADE:TILTEDSHADESURFACE\", Transmittance Schedule Name=\"OUTOFRANGE\", values not in " - "range [0,1].", - " ** Severe ** Shading:Building:Detailed=\"BUILDINGSHADE:TILTEDSHADESURFACE\", Transmittance Schedule Name=\"OUTOFRANGE\", " - "has schedule values < 0.", - " ** ~~~ ** ...Schedule values < 0 have no meaning for shading elements.", - " ** Severe ** " - "Shading:Building:Detailed=\"BUILDINGSHADE:TILTEDSHADESURFACE\", Transmittance Schedule Name=\"OUTOFRANGE\", has schedule values > 1.", - " ** ~~~ ** ...Schedule values > 1 have no meaning for shading elements.", - " ** Severe ** " - "Shading:Zone:Detailed=\"ZONESHADE:LIVING:SOUTH:SHADE001\", Transmittance Schedule Name=\"OUTOFRANGE\", values not in range [0,1].", - " ** " - "Severe ** Shading:Zone:Detailed=\"ZONESHADE:LIVING:SOUTH:SHADE001\", Base Surface Name=\"LIVING:SOUTH\", has schedule values < 0.", - " ** " - " ~~~ ** ...Schedule values < 0 have no meaning for shading elements.", - " ** Severe ** " - "Shading:Zone:Detailed=\"ZONESHADE:LIVING:SOUTH:SHADE001\", Base Surface Name=\"LIVING:SOUTH\", has schedule values > 1.", - " ** ~~~ ** " - "...Schedule values > 1 have no meaning for shading elements.", - " ** Fatal ** GetSurfaceData: Errors discovered, program terminates.", - " " - "...Summary of Errors that led to program termination:", - " ..... Reference severe error count=6", - " ..... Last severe error=Shading:Zone:Detailed=\"ZONESHADE:LIVING:SOUTH:SHADE001\", Base Surface Name=\"LIVING:SOUTH\", has schedule " - "values > 1."}); + std::string const error_string = + delimited_string({" ** Severe ** GetDetShdSurfaceData: Shading:Building:Detailed = BUILDINGSHADE:TILTEDSHADESURFACE", + " ** ~~~ ** Transmittance Schedule Name = OUTOFRANGE, schedule contains values that are < 0 and/or > 1", + " ** Severe ** GetAttShdSurfaceData: Shading:Zone:Detailed = ZONESHADE:LIVING:SOUTH:SHADE001", + " ** ~~~ ** Transmittance Schedule Name = OUTOFRANGE, schedule contains values that are < 0 and/or > 1", + " ** Fatal ** GetSurfaceData: Errors discovered, program terminates.", + " ...Summary of Errors that led to program termination:", + " ..... Reference severe error count=2", + " ..... Last severe error=GetAttShdSurfaceData: Shading:Zone:Detailed = ZONESHADE:LIVING:SOUTH:SHADE001"}); compare_err_stream(error_string); // compare_err_stream( "" ); // just for debugging @@ -14289,9 +14302,8 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_SurroundingSurfacesViewFactorTest) bool ErrorsFound = false; ASSERT_TRUE(process_idf(idf_objects)); - // process schedules - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->init_state(*state); + state->dataHeatBal->ZoneIntGain.allocate(1); createFacilityElectricPowerServiceObject(*state); HeatBalanceManager::SetPreConstructionInputParameters(*state); @@ -14520,6 +14532,7 @@ TEST_F(EnergyPlusFixture, ExtSolarForShadingTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); int TotSurfaces = 8; // Need to double the number of surfaces because E+ will add mirrored surfaces state->dataSurfaceGeometry->SurfaceTmp.allocate(TotSurfaces); // Allocate the Surface derived type appropriately diff --git a/tst/EnergyPlus/unit/SurfaceGroundHeatExchanger.unit.cc b/tst/EnergyPlus/unit/SurfaceGroundHeatExchanger.unit.cc index fa026610d41..ef318f2a9ef 100644 --- a/tst/EnergyPlus/unit/SurfaceGroundHeatExchanger.unit.cc +++ b/tst/EnergyPlus/unit/SurfaceGroundHeatExchanger.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/SurfaceOctree.unit.cc b/tst/EnergyPlus/unit/SurfaceOctree.unit.cc index b472559fe9a..5ab4d14b25b 100644 --- a/tst/EnergyPlus/unit/SurfaceOctree.unit.cc +++ b/tst/EnergyPlus/unit/SurfaceOctree.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/SwimmingPool.unit.cc b/tst/EnergyPlus/unit/SwimmingPool.unit.cc index 61d10cc5db5..027829595e2 100644 --- a/tst/EnergyPlus/unit/SwimmingPool.unit.cc +++ b/tst/EnergyPlus/unit/SwimmingPool.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -251,7 +251,7 @@ TEST_F(EnergyPlusFixture, SwimmingPool_ErrorCheckSetupPoolSurfaceTest) state->dataConstruction->Construct.allocate(1); state->dataSurface->SurfIsPool.allocate(1); state->dataSurface->SurfIsRadSurfOrVentSlabOrPool.allocate(1); - state->dataSurface->SurfMaterialMovInsulInt.allocate(1); + state->dataSurface->intMovInsuls.allocate(1); // testing variables static constexpr std::string_view Alpha1("FirstString"); static constexpr std::string_view Alpha2("SecondString"); @@ -304,7 +304,7 @@ TEST_F(EnergyPlusFixture, SwimmingPool_ErrorCheckSetupPoolSurfaceTest) state->dataSurface->SurfIsRadSurfOrVentSlabOrPool(poolReference.SurfacePtr) = false; state->dataSurface->Surface(poolReference.SurfacePtr).HeatTransferAlgorithm = DataSurfaces::HeatTransferModel::CTF; state->dataSurface->Surface(poolReference.SurfacePtr).Class = DataSurfaces::SurfaceClass::Floor; - state->dataSurface->SurfMaterialMovInsulInt(poolReference.SurfacePtr) = 1; + state->dataSurface->intMovInsuls(poolReference.SurfacePtr).matNum = 1; poolReference.ErrorCheckSetupPoolSurface(*state, Alpha1, Alpha2, AlphaField2, ErrFnd); @@ -316,7 +316,7 @@ TEST_F(EnergyPlusFixture, SwimmingPool_ErrorCheckSetupPoolSurfaceTest) state->dataSurface->SurfIsRadSurfOrVentSlabOrPool(poolReference.SurfacePtr) = false; state->dataSurface->Surface(poolReference.SurfacePtr).HeatTransferAlgorithm = DataSurfaces::HeatTransferModel::CTF; state->dataSurface->Surface(poolReference.SurfacePtr).Class = DataSurfaces::SurfaceClass::Floor; - state->dataSurface->SurfMaterialMovInsulInt(poolReference.SurfacePtr) = 1; + state->dataSurface->intMovInsuls(poolReference.SurfacePtr).matNum = 1; state->dataSurface->Surface(poolReference.SurfacePtr).Construction = 1; state->dataConstruction->Construct(state->dataSurface->Surface(poolReference.SurfacePtr).Construction).SourceSinkPresent = true; @@ -330,7 +330,7 @@ TEST_F(EnergyPlusFixture, SwimmingPool_ErrorCheckSetupPoolSurfaceTest) state->dataSurface->SurfIsRadSurfOrVentSlabOrPool(poolReference.SurfacePtr) = false; state->dataSurface->Surface(poolReference.SurfacePtr).HeatTransferAlgorithm = DataSurfaces::HeatTransferModel::CTF; state->dataSurface->Surface(poolReference.SurfacePtr).Class = DataSurfaces::SurfaceClass::Wall; - state->dataSurface->SurfMaterialMovInsulInt(poolReference.SurfacePtr) = 1; + state->dataSurface->intMovInsuls(poolReference.SurfacePtr).matNum = 1; state->dataConstruction->Construct(state->dataSurface->Surface(poolReference.SurfacePtr).Construction).SourceSinkPresent = false; poolReference.ErrorCheckSetupPoolSurface(*state, Alpha1, Alpha2, AlphaField2, ErrFnd); @@ -343,7 +343,7 @@ TEST_F(EnergyPlusFixture, SwimmingPool_ErrorCheckSetupPoolSurfaceTest) state->dataSurface->SurfIsRadSurfOrVentSlabOrPool(poolReference.SurfacePtr) = false; state->dataSurface->Surface(poolReference.SurfacePtr).HeatTransferAlgorithm = DataSurfaces::HeatTransferModel::CTF; state->dataSurface->Surface(poolReference.SurfacePtr).Class = DataSurfaces::SurfaceClass::Floor; - state->dataSurface->SurfMaterialMovInsulInt(poolReference.SurfacePtr) = 0; + state->dataSurface->intMovInsuls(poolReference.SurfacePtr).matNum = 0; state->dataConstruction->Construct(state->dataSurface->Surface(poolReference.SurfacePtr).Construction).SourceSinkPresent = false; state->dataSurface->Surface(poolReference.SurfacePtr).Zone = 7; state->dataSurface->SurfIsPool(poolReference.SurfacePtr) = false; @@ -504,6 +504,7 @@ TEST_F(EnergyPlusFixture, SwimmingPool_reportTest) state->init_state(*state); // Test Data myPool.Name = "This Pool"; + myPool.glycol = Fluid::GetWater(*state); myPool.SurfacePtr = 1; state->dataHeatBalSurf->SurfInsideTempHist.allocate(1); state->dataHeatBalSurf->SurfInsideTempHist(1).dimension(1, 0); diff --git a/tst/EnergyPlus/unit/SystemAvailabilityManager.unit.cc b/tst/EnergyPlus/unit/SystemAvailabilityManager.unit.cc index 78aad3323ad..45ea122e40d 100644 --- a/tst/EnergyPlus/unit/SystemAvailabilityManager.unit.cc +++ b/tst/EnergyPlus/unit/SystemAvailabilityManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -193,6 +193,9 @@ TEST_F(EnergyPlusFixture, SysAvailManager_OptimumStart) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 6; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 10; // must initialize this to get schedules initialized + state->init_state(*state); state->dataHeatBal->NumOfZoneLists = 1; state->dataHeatBal->ZoneList.allocate(state->dataHeatBal->NumOfZoneLists); @@ -239,10 +242,6 @@ TEST_F(EnergyPlusFixture, SysAvailManager_OptimumStart) state->dataAirLoop->AirToZoneNodeInfo(3).CoolCtrlZoneNums.allocate(1); state->dataAirLoop->AirToZoneNodeInfo(3).CoolCtrlZoneNums(1) = 6; - state->dataGlobal->NumOfTimeStepInHour = 6; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 10; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules - state->dataScheduleMgr->ScheduleInputProcessed = true; state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 1; state->dataGlobal->HourOfDay = 1; @@ -253,7 +252,7 @@ TEST_F(EnergyPlusFixture, SysAvailManager_OptimumStart) state->dataEnvrn->DayOfWeekTomorrow = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); state->dataZoneEquip->ZoneEquipAvail.allocate(6); @@ -297,11 +296,12 @@ TEST_F(EnergyPlusFixture, SysAvailManager_OptimumStart) state->dataHeatBalFanSys->TempTstatAir(5) = 14.0; state->dataHeatBalFanSys->TempTstatAir(6) = 10.0; - state->dataHeatBalFanSys->ZoneThermostatSetPointLo.allocate(6); - state->dataHeatBalFanSys->ZoneThermostatSetPointHi.allocate(6); + state->dataHeatBalFanSys->zoneTstatSetpts.allocate(6); - state->dataHeatBalFanSys->ZoneThermostatSetPointLo = 19.0; // all zones use same set point temperature - state->dataHeatBalFanSys->ZoneThermostatSetPointHi = 24.0; + for (auto &zoneTstatSetpt : state->dataHeatBalFanSys->zoneTstatSetpts) { + zoneTstatSetpt.setptLo = 19.0; // all zones use same set point temperature + zoneTstatSetpt.setptHi = 24.0; + } state->dataZoneCtrls->OccRoomTSetPointHeat.allocate(6); state->dataZoneCtrls->OccRoomTSetPointCool.allocate(6); @@ -356,15 +356,15 @@ TEST_F(EnergyPlusFixture, SysAvailManager_OptimumStart) ZoneTempPredictorCorrector::GetZoneAirSetPoints(*state); state->dataHeatBalFanSys->TempControlType.allocate(state->dataGlobal->NumOfZones); state->dataHeatBalFanSys->TempControlTypeRpt.allocate(state->dataGlobal->NumOfZones); - state->dataHeatBalFanSys->TempZoneThermostatSetPoint.allocate(state->dataGlobal->NumOfZones); + state->dataHeatBalFanSys->zoneTstatSetpts.allocate(state->dataGlobal->NumOfZones); state->dataGlobal->CurrentTime = 19.0; // set the current time to 7 PM which is post-occupancy Avail::ManageSystemAvailability(*state); ZoneTempPredictorCorrector::CalcZoneAirTempSetPoints(*state); EXPECT_EQ((int)Avail::Status::NoAction, (int)state->dataAvail->OptimumStartData(1).availStatus); // avail manager should be set to no action - EXPECT_EQ(15.0, state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1)); // 15.0C is the unoccupied heating setpoint - EXPECT_EQ(29.4, state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1)); // 29.4C is the unoccupied cooling setpoint + EXPECT_EQ(15.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo); // 15.0C is the unoccupied heating setpoint + EXPECT_EQ(29.4, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi); // 29.4C is the unoccupied cooling setpoint } TEST_F(EnergyPlusFixture, SysAvailManager_NightCycle_ZoneOutOfTolerance) @@ -373,26 +373,24 @@ TEST_F(EnergyPlusFixture, SysAvailManager_NightCycle_ZoneOutOfTolerance) state->dataHeatBalFanSys->TempControlType.allocate(NumZones); state->dataHeatBalFanSys->TempControlTypeRpt.allocate(NumZones); state->dataHeatBalFanSys->TempTstatAir.allocate(NumZones); - state->dataHeatBalFanSys->TempZoneThermostatSetPoint.allocate(NumZones); - state->dataHeatBalFanSys->ZoneThermostatSetPointHi.allocate(NumZones); - state->dataHeatBalFanSys->ZoneThermostatSetPointLo.allocate(NumZones); + state->dataHeatBalFanSys->zoneTstatSetpts.allocate(NumZones); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::SingleCooling; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::SingleCool; state->dataHeatBalFanSys->TempTstatAir(1) = 30.0; - state->dataHeatBalFanSys->TempZoneThermostatSetPoint(1) = 25.0; + state->dataHeatBalFanSys->zoneTstatSetpts(1).setpt = 25.0; - state->dataHeatBalFanSys->TempControlType(2) = HVAC::ThermostatType::SingleHeatCool; + state->dataHeatBalFanSys->TempControlType(2) = HVAC::SetptType::SingleHeatCool; state->dataHeatBalFanSys->TempTstatAir(2) = 25.0; - state->dataHeatBalFanSys->TempZoneThermostatSetPoint(2) = 25.0; + state->dataHeatBalFanSys->zoneTstatSetpts(2).setpt = 25.0; - state->dataHeatBalFanSys->TempControlType(3) = HVAC::ThermostatType::SingleHeating; + state->dataHeatBalFanSys->TempControlType(3) = HVAC::SetptType::SingleHeat; state->dataHeatBalFanSys->TempTstatAir(3) = 10.0; - state->dataHeatBalFanSys->TempZoneThermostatSetPoint(3) = 20.0; + state->dataHeatBalFanSys->zoneTstatSetpts(3).setpt = 20.0; - state->dataHeatBalFanSys->TempControlType(4) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(4) = HVAC::SetptType::DualHeatCool; state->dataHeatBalFanSys->TempTstatAir(4) = 30.0; - state->dataHeatBalFanSys->ZoneThermostatSetPointHi(4) = 25.0; - state->dataHeatBalFanSys->ZoneThermostatSetPointLo(4) = 20.0; + state->dataHeatBalFanSys->zoneTstatSetpts(4).setptHi = 25.0; + state->dataHeatBalFanSys->zoneTstatSetpts(4).setptLo = 20.0; Real64 TempTol = 0.5; Array1D_int ZoneNumList; @@ -416,9 +414,7 @@ TEST_F(EnergyPlusFixture, SysAvailManager_NightCycle_ZoneOutOfTolerance) state->dataHeatBalFanSys->TempControlType.deallocate(); state->dataHeatBalFanSys->TempTstatAir.deallocate(); - state->dataHeatBalFanSys->TempZoneThermostatSetPoint.deallocate(); - state->dataHeatBalFanSys->ZoneThermostatSetPointHi.deallocate(); - state->dataHeatBalFanSys->ZoneThermostatSetPointLo.deallocate(); + state->dataHeatBalFanSys->zoneTstatSetpts.deallocate(); ZoneNumList.deallocate(); } @@ -433,16 +429,15 @@ TEST_F(EnergyPlusFixture, SysAvailManager_HybridVentilation_OT_CO2Control) state->dataContaminantBalance->ZoneCO2SetPoint.allocate(1); state->dataAirLoop->PriAirSysAvailMgr.allocate(1); state->dataAvail->SchedData.allocate(1); - state->dataScheduleMgr->Schedule.allocate(1); state->dataAvail->ZoneComp.allocate(DataZoneEquipment::NumValidSysAvailZoneComponents); state->dataHeatBalFanSys->TempControlType.allocate(1); state->dataHeatBalFanSys->TempControlTypeRpt.allocate(1); - state->dataHeatBalFanSys->TempZoneThermostatSetPoint.allocate(1); + state->dataHeatBalFanSys->zoneTstatSetpts.allocate(1); state->dataAvail->HybridVentData(1).Name = "HybridControl"; state->dataAvail->HybridVentData(1).ControlledZoneNum = 1; state->dataAvail->HybridVentData(1).AirLoopNum = 1; - state->dataAvail->HybridVentData(1).ControlModeSchedPtr = 1; + state->dataAvail->HybridVentData(1).controlModeSched = Sched::AddScheduleConstant(*state, "CONTROL MODE"); state->dataAvail->HybridVentData(1).UseRainIndicator = false; state->dataAvail->HybridVentData(1).MaxWindSpeed = 40.0; state->dataAvail->HybridVentData(1).MinOutdoorTemp = 15.0; @@ -451,7 +446,7 @@ TEST_F(EnergyPlusFixture, SysAvailManager_HybridVentilation_OT_CO2Control) state->dataAvail->HybridVentData(1).MaxOutdoorEnth = 30000.0; state->dataAvail->HybridVentData(1).MinOutdoorDewPoint = 15.0; state->dataAvail->HybridVentData(1).MaxOutdoorDewPoint = 35.0; - state->dataAvail->HybridVentData(1).MinOASched = 2; + state->dataAvail->HybridVentData(1).minOASched = Sched::AddScheduleConstant(*state, "MIN OA"); state->dataAvail->HybridVentData(1).MinOperTime = 10.0; state->dataAvail->HybridVentData(1).MinVentTime = 10.0; @@ -496,11 +491,11 @@ TEST_F(EnergyPlusFixture, SysAvailManager_HybridVentilation_OT_CO2Control) state->dataAirLoop->PriAirSysAvailMgr(1).availManagers(1).type = Avail::ManagerType::Scheduled; // Scheduled state->dataAirLoop->PriAirSysAvailMgr(1).availManagers(1).Name = "Avail 1"; state->dataAirLoop->PriAirSysAvailMgr(1).availManagers(1).Num = 1; - state->dataAvail->SchedData(1).SchedPtr = 1; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1; + auto *availSched = state->dataAvail->SchedData(1).availSched = Sched::AddScheduleConstant(*state, "AVAIL"); + availSched->currentVal = 1; Avail::CalcHybridVentSysAvailMgr(*state, 1, 1); EXPECT_EQ((int)Avail::VentCtrlStatus::Close, (int)state->dataAvail->HybridVentData(1).ctrlStatus); // System operation - state->dataScheduleMgr->Schedule(1).CurrentValue = 0; + availSched->currentVal = 0; Avail::CalcHybridVentSysAvailMgr(*state, 1, 1); EXPECT_EQ((int)Avail::VentCtrlStatus::Open, (int)state->dataAvail->HybridVentData(1).ctrlStatus); // Vent open @@ -539,8 +534,8 @@ TEST_F(EnergyPlusFixture, SysAvailManager_HybridVentilation_OT_CO2Control) Avail::CalcHybridVentSysAvailMgr(*state, 1, 1); EXPECT_EQ((int)Avail::VentCtrlStatus::Close, (int)state->dataAvail->HybridVentData(1).ctrlStatus); // No change state->dataAvail->HybridVentData(1).TimeVentDuration = 11.0; - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::SingleHeating; - state->dataHeatBalFanSys->TempZoneThermostatSetPoint(1) = 25.0; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::SingleHeat; + state->dataHeatBalFanSys->zoneTstatSetpts(1).setpt = 25.0; Avail::CalcHybridVentSysAvailMgr(*state, 1, 1); EXPECT_EQ((int)Avail::VentCtrlStatus::Open, (int)state->dataAvail->HybridVentData(1).ctrlStatus); // Can change } @@ -595,11 +590,10 @@ TEST_F(EnergyPlusFixture, SysAvailManager_NightCycleGetInput) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules - state->dataScheduleMgr->ScheduleInputProcessed = true; // get system availability schedule Avail::GetSysAvailManagerInputs(*state); // check the three cycling run time control types @@ -628,16 +622,16 @@ TEST_F(EnergyPlusFixture, SysAvailManager_NightCycleZone_CalcNCycSysAvailMgr) state->dataHeatBalFanSys->TempControlType.allocate(NumZones); state->dataHeatBalFanSys->TempControlTypeRpt.allocate(NumZones); state->dataHeatBalFanSys->TempTstatAir.allocate(NumZones); - state->dataHeatBalFanSys->TempZoneThermostatSetPoint.allocate(NumZones); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::SingleCooling; - state->dataHeatBalFanSys->TempZoneThermostatSetPoint(1) = 25.0; + state->dataHeatBalFanSys->zoneTstatSetpts.allocate(NumZones); + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::SingleCool; + state->dataHeatBalFanSys->zoneTstatSetpts(1).setpt = 25.0; state->dataHeatBalFanSys->TempTstatAir(1) = 25.1; state->dataAvail->NightCycleData.allocate(NumZones); state->dataAvail->NightCycleData(1).Name = "System Avail"; state->dataAvail->NightCycleData(1).nightCycleControlType = Avail::NightCycleControlType::OnAny; - state->dataAvail->NightCycleData(1).SchedPtr = 1; - state->dataAvail->NightCycleData(1).FanSchedPtr = 2; + auto *availSched = state->dataAvail->NightCycleData(1).availSched = Sched::AddScheduleConstant(*state, "AVAIL"); + auto *fanSched = state->dataAvail->NightCycleData(1).fanSched = Sched::AddScheduleConstant(*state, "FAN"); state->dataAvail->NightCycleData(1).TempTolRange = 0.4; state->dataAvail->NightCycleData(1).CyclingTimeSteps = 4; state->dataAvail->NightCycleData(1).CtrlZoneListName = state->dataHeatBal->Zone(1).Name; @@ -647,9 +641,9 @@ TEST_F(EnergyPlusFixture, SysAvailManager_NightCycleZone_CalcNCycSysAvailMgr) state->dataAvail->NightCycleData(1).CoolingZoneListName = state->dataHeatBal->Zone(1).Name; state->dataAvail->NightCycleData(1).NumOfCoolingZones = NumZones; state->dataAvail->NightCycleData(1).CoolingZonePtrs = NumZones; - state->dataScheduleMgr->Schedule.allocate(2); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1; - state->dataScheduleMgr->Schedule(2).CurrentValue = 0; + + availSched->currentVal = 1; + fanSched->currentVal = 0; // Cycling Run Time Control Type = FixedRunTime // and current time is within the run time period, starting time is less than stopping time @@ -749,9 +743,9 @@ TEST_F(EnergyPlusFixture, SysAvailManager_NightCycleSys_CalcNCycSysAvailMgr) state->dataHeatBalFanSys->TempControlType.allocate(NumZones); state->dataHeatBalFanSys->TempControlTypeRpt.allocate(NumZones); state->dataHeatBalFanSys->TempTstatAir.allocate(NumZones); - state->dataHeatBalFanSys->TempZoneThermostatSetPoint.allocate(NumZones); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::SingleCooling; - state->dataHeatBalFanSys->TempZoneThermostatSetPoint(1) = 25.0; + state->dataHeatBalFanSys->zoneTstatSetpts.allocate(NumZones); + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::SingleCool; + state->dataHeatBalFanSys->zoneTstatSetpts(1).setpt = 25.0; state->dataHeatBalFanSys->TempTstatAir(1) = 25.1; state->dataHeatBal->Zone.allocate(NumZones); state->dataHeatBal->Zone(1).Name = "SPACE1-1"; @@ -766,8 +760,8 @@ TEST_F(EnergyPlusFixture, SysAvailManager_NightCycleSys_CalcNCycSysAvailMgr) state->dataAvail->NightCycleData(1).Name = "System Avail"; state->dataAvail->NightCycleData(1).nightCycleControlType = Avail::NightCycleControlType::OnAny; - state->dataAvail->NightCycleData(1).SchedPtr = 1; - state->dataAvail->NightCycleData(1).FanSchedPtr = 2; + auto *availSched = state->dataAvail->NightCycleData(1).availSched = Sched::AddScheduleConstant(*state, "AVAIL"); + auto *fanSched = state->dataAvail->NightCycleData(1).fanSched = Sched::AddScheduleConstant(*state, "FAN"); state->dataAvail->NightCycleData(1).TempTolRange = 0.4; state->dataAvail->NightCycleData(1).CyclingTimeSteps = 4; state->dataAvail->NightCycleData(1).CtrlZoneListName = state->dataHeatBal->Zone(1).Name; @@ -777,9 +771,8 @@ TEST_F(EnergyPlusFixture, SysAvailManager_NightCycleSys_CalcNCycSysAvailMgr) state->dataAvail->NightCycleData(1).CoolingZoneListName = state->dataHeatBal->Zone(1).Name; state->dataAvail->NightCycleData(1).NumOfCoolingZones = NumZones; state->dataAvail->NightCycleData(1).CoolingZonePtrs = NumZones; - state->dataScheduleMgr->Schedule.allocate(2); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1; - state->dataScheduleMgr->Schedule(2).CurrentValue = 0; + availSched->currentVal = 1; + fanSched->currentVal = 0; // Cycling Run Time Control Type = FixedRunTime // and current time is within the run time period, starting time is less than stopping time diff --git a/tst/EnergyPlus/unit/SystemReports.unit.cc b/tst/EnergyPlus/unit/SystemReports.unit.cc index 813000f144c..eb606320437 100644 --- a/tst/EnergyPlus/unit/SystemReports.unit.cc +++ b/tst/EnergyPlus/unit/SystemReports.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/TestHelpers/CustomMatchers.hh b/tst/EnergyPlus/unit/TestHelpers/CustomMatchers.hh index 9bd57b38e45..ff91db6e6f2 100644 --- a/tst/EnergyPlus/unit/TestHelpers/CustomMatchers.hh +++ b/tst/EnergyPlus/unit/TestHelpers/CustomMatchers.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/TestHelpers/IdfParser.cc b/tst/EnergyPlus/unit/TestHelpers/IdfParser.cc index 6d8281491e7..876714228d0 100644 --- a/tst/EnergyPlus/unit/TestHelpers/IdfParser.cc +++ b/tst/EnergyPlus/unit/TestHelpers/IdfParser.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/TestHelpers/IdfParser.hh b/tst/EnergyPlus/unit/TestHelpers/IdfParser.hh index d3ad8b5efb0..a271b0b7c9c 100644 --- a/tst/EnergyPlus/unit/TestHelpers/IdfParser.hh +++ b/tst/EnergyPlus/unit/TestHelpers/IdfParser.hh @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/ThermalChimney.unit.cc b/tst/EnergyPlus/unit/ThermalChimney.unit.cc index 1d5c6e9cf51..8ad223bdd56 100644 --- a/tst/EnergyPlus/unit/ThermalChimney.unit.cc +++ b/tst/EnergyPlus/unit/ThermalChimney.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -79,7 +79,6 @@ using namespace EnergyPlus::DataHeatBalance; using namespace EnergyPlus::InternalHeatGains; using namespace EnergyPlus::HeatBalanceManager; using namespace EnergyPlus::OutputProcessor; -using namespace EnergyPlus::ScheduleManager; using namespace EnergyPlus::DataSurfaces; using namespace EnergyPlus::DataHeatBalSurface; using namespace SimulationManager; @@ -1101,6 +1100,7 @@ TEST_F(EnergyPlusFixture, ThermalChimney_EMSAirflow_Test) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataIPShortCut->lNumericFieldBlanks.allocate(1000); state->dataIPShortCut->lAlphaFieldBlanks.allocate(1000); @@ -1134,8 +1134,6 @@ TEST_F(EnergyPlusFixture, ThermalChimney_EMSAirflow_Test) state->dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; SurfaceGeometry::GetSurfaceData(*state, localErrorsFound); EXPECT_FALSE(localErrorsFound); - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; state->dataHeatBal->Zone(2).HasWindow = true; state->dataHeatBal->Zone(4).HasWindow = true; @@ -1160,7 +1158,7 @@ TEST_F(EnergyPlusFixture, ThermalChimney_EMSAirflow_Test) state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(state->dataGlobal->NumOfZones); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; + Sched::GetSchedule(*state, "THERMALCHIMNEYAVAIL")->currentVal = 1.0; state->dataHeatBal->ZnAirRpt.allocate(state->dataGlobal->NumOfZones); // No EMS ThermalChimney::GetThermalChimney(*state, localErrorsFound); diff --git a/tst/EnergyPlus/unit/ThermalComfort.unit.cc b/tst/EnergyPlus/unit/ThermalComfort.unit.cc index cab93f0451b..70d2ee65b40 100644 --- a/tst/EnergyPlus/unit/ThermalComfort.unit.cc +++ b/tst/EnergyPlus/unit/ThermalComfort.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -92,8 +92,7 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcIfSetPointMetTest1) state->dataRoomAir->AirModel.allocate(state->dataGlobal->NumOfZones); state->dataRoomAir->AirModel(1).AirModel = RoomAir::RoomAirModel::Mixing; state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(state->dataGlobal->NumOfZones); - state->dataHeatBalFanSys->ZoneThermostatSetPointLo.allocate(state->dataGlobal->NumOfZones); - state->dataHeatBalFanSys->ZoneThermostatSetPointHi.allocate(state->dataGlobal->NumOfZones); + state->dataHeatBalFanSys->zoneTstatSetpts.allocate(state->dataGlobal->NumOfZones); state->dataGlobal->TimeStepZone = 0.25; state->dataThermalComforts->ThermalComfortInASH55.allocate(state->dataGlobal->NumOfZones); state->dataThermalComforts->ThermalComfortInASH55(1).ZoneIsOccupied = true; @@ -101,11 +100,11 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcIfSetPointMetTest1) // SingleHeatingSetPoint thermostat - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::SingleHeating; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::SingleHeat; // heating state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 21.1; // 70F - state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1) = 22.2; // 72F + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo = 22.2; // 72F state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).TotalOutputRequired = 500.0; // must be greater than zero CalcIfSetPointMet(*state); EXPECT_EQ(state->dataGlobal->TimeStepZone, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); @@ -115,7 +114,7 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcIfSetPointMetTest1) // cooling state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 25.0; // 77F - state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1) = 23.9; // 75F + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi = 23.9; // 75F state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).TotalOutputRequired = -500.0; // must be less than zero CalcIfSetPointMet(*state); EXPECT_EQ(0, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); @@ -125,11 +124,11 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcIfSetPointMetTest1) // SingleCoolingSetPoint thermostat - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::SingleCooling; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::SingleCool; // heating state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 21.1; // 70F - state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1) = 22.2; // 72F + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo = 22.2; // 72F state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).TotalOutputRequired = 500.0; // must be greater than zero CalcIfSetPointMet(*state); EXPECT_EQ(0, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); @@ -139,7 +138,7 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcIfSetPointMetTest1) // cooling state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 25.0; // 77F - state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1) = 23.9; // 75F + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi = 23.9; // 75F state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).TotalOutputRequired = -500.0; // must be less than zero CalcIfSetPointMet(*state); EXPECT_EQ(0, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); @@ -149,11 +148,11 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcIfSetPointMetTest1) // SingleHeatCoolSetPoint thermostat - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::SingleHeatCool; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::SingleHeatCool; // heating state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 21.1; // 70F - state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1) = 22.2; // 72F + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo = 22.2; // 72F state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).TotalOutputRequired = 500.0; // must be greater than zero CalcIfSetPointMet(*state); EXPECT_EQ(state->dataGlobal->TimeStepZone, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); @@ -163,7 +162,7 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcIfSetPointMetTest1) // cooling state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 25.0; // 77F - state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1) = 23.9; // 75F + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi = 23.9; // 75F state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).TotalOutputRequired = -500.0; // must be less than zero CalcIfSetPointMet(*state); EXPECT_EQ(0, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); @@ -171,13 +170,13 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcIfSetPointMetTest1) EXPECT_EQ(state->dataGlobal->TimeStepZone, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetCooling); EXPECT_EQ(state->dataGlobal->TimeStepZone, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetCoolingOccupied); - // DualSetPointWithDeadBand thermostat + // DualHeatCool thermostat - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; // heating state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 21.1; // 70F - state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1) = 22.2; // 72F + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo = 22.2; // 72F state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).TotalOutputRequired = 500.0; // must be greater than zero CalcIfSetPointMet(*state); EXPECT_EQ(state->dataGlobal->TimeStepZone, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); @@ -187,7 +186,7 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcIfSetPointMetTest1) // cooling state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 25.0; // 77F - state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1) = 23.9; // 75F + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi = 23.9; // 75F state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).TotalOutputRequired = -500.0; // must be less than zero CalcIfSetPointMet(*state); EXPECT_EQ(0, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); @@ -932,22 +931,19 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcIfSetPointMetWithCutoutTest) state->dataRoomAir->AirModel.allocate(state->dataGlobal->NumOfZones); state->dataRoomAir->AirModel(1).AirModel = RoomAir::RoomAirModel::Mixing; state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(state->dataGlobal->NumOfZones); - state->dataHeatBalFanSys->ZoneThermostatSetPointLo.allocate(state->dataGlobal->NumOfZones); - state->dataHeatBalFanSys->ZoneThermostatSetPointHi.allocate(state->dataGlobal->NumOfZones); - state->dataHeatBalFanSys->ZoneThermostatSetPointLoAver.allocate(state->dataGlobal->NumOfZones); - state->dataHeatBalFanSys->ZoneThermostatSetPointHiAver.allocate(state->dataGlobal->NumOfZones); + state->dataHeatBalFanSys->zoneTstatSetpts.allocate(state->dataGlobal->NumOfZones); state->dataThermalComforts->ThermalComfortInASH55.allocate(state->dataGlobal->NumOfZones); state->dataThermalComforts->ThermalComfortInASH55(1).ZoneIsOccupied = true; state->dataGlobal->TimeStepZone = 0.25; state->dataHeatBal->Zone.allocate(state->dataGlobal->NumOfZones); state->dataZoneTempPredictorCorrector->NumOnOffCtrZone = 1; - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; // heating state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 21.1; // 70F - state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1) = 22.2; // 72F - state->dataHeatBalFanSys->ZoneThermostatSetPointLoAver(1) = 22.2; // 72F + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo = 22.2; // 72F + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLoAver = 22.2; // 72F state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).TotalOutputRequired = 500.0; // must be greater than zero CalcIfSetPointMet(*state); EXPECT_EQ(state->dataGlobal->TimeStepZone, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); @@ -957,8 +953,8 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcIfSetPointMetWithCutoutTest) // cooling state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 25.0; // 77F - state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1) = 23.9; // 75F - state->dataHeatBalFanSys->ZoneThermostatSetPointHiAver(1) = 23.9; // 75F + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi = 23.9; // 75F + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHiAver = 23.9; // 75F state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).TotalOutputRequired = -500.0; // must be less than zero CalcIfSetPointMet(*state); EXPECT_EQ(0, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); @@ -982,6 +978,7 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcIfSetPointMetWithCutoutTest) TEST_F(EnergyPlusFixture, ThermalComfort_CalcThermalComfortASH55) { + state->init_state(*state); // Set the data for the test state->dataHeatBal->TotPeople = 1; @@ -999,7 +996,7 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcThermalComfortASH55) state->dataHeatBalFanSys->ZoneQElecBaseboardToPerson.allocate(state->dataGlobal->NumOfZones); state->dataHeatBal->People(1).ZonePtr = 1; - state->dataHeatBal->People(1).NumberOfPeoplePtr = -1; + state->dataHeatBal->People(1).sched = Sched::GetScheduleAlwaysOn(*state); state->dataHeatBal->People(1).NumberOfPeople = 5.0; state->dataHeatBal->People(1).NomMinNumberPeople = 5.0; state->dataHeatBal->People(1).NomMaxNumberPeople = 5.0; @@ -1015,7 +1012,7 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcThermalComfortASH55) state->dataHeatBal->space.allocate(1); state->dataHeatBal->space(1).radiantEnclosureNum = 1; state->dataViewFactor->EnclRadInfo.allocate(1); - state->dataHeatBal->People(1).WorkEffPtr = 0; + state->dataHeatBal->People(1).workEffSched = Sched::GetScheduleAlwaysOff(*state); state->dataHeatBal->People(1).clothingType = ClothingType::InsulationSchedule; state->dataRoomAir->IsZoneDispVent3Node(1) = state->dataRoomAir->IsZoneUFAD(1) = false; @@ -1027,11 +1024,10 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcThermalComfortASH55) Real64 BodySurfaceArea = 1.8258; state->dataEnvrn->OutBaroPress = 101325.; Real64 WorkEff = 0.0; - state->dataHeatBal->People(1).ActivityLevelPtr = 1; - state->dataHeatBal->People(1).ClothingPtr = 2; - state->dataHeatBal->People(1).AirVelocityPtr = 3; - state->dataHeatBal->People(1).AnkleAirVelocityPtr = 4; - state->dataScheduleMgr->Schedule.allocate(4); + auto *activitySched = state->dataHeatBal->People(1).activityLevelSched = Sched::AddScheduleConstant(*state, "ACTIVITY"); + auto *clothingSched = state->dataHeatBal->People(1).clothingSched = Sched::AddScheduleConstant(*state, "CLOTHING"); + auto *airVeloSched = state->dataHeatBal->People(1).airVelocitySched = Sched::AddScheduleConstant(*state, "AIR VELO"); + auto *ankleAirVeloSched = state->dataHeatBal->People(1).ankleAirVelocitySched = Sched::AddScheduleConstant(*state, "ANKLE AIR VELO"); // Part 1: Test SET calculations. // Reference: ANSI/ASHRAE Standard 55-2017 Appendix D - Table D3 Validation Table for SET Computer Model @@ -1062,12 +1058,12 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcThermalComfortASH55) zoneHB1.MRT = RadTemp; state->dataViewFactor->EnclRadInfo(1).MRT = RadTemp; zoneHB1.airHumRatAvgComf = Psychrometrics::PsyWFnTdbRhPb(*state, zoneHB1.ZTAVComf, RelHum, state->dataEnvrn->OutBaroPress); - state->dataScheduleMgr->Schedule(1).CurrentValue = ActMet * BodySurfaceArea * ThermalComfort::ActLevelConv; - state->dataScheduleMgr->Schedule(2).CurrentValue = CloUnit; + activitySched->currentVal = ActMet * BodySurfaceArea * ThermalComfort::ActLevelConv; + clothingSched->currentVal = CloUnit; // Test 1 - Air velocity = 0.15 m/s. Real64 AirVel = 0.15; - state->dataScheduleMgr->Schedule(3).CurrentValue = AirVel; + airVeloSched->currentVal = AirVel; CalcThermalComfortCoolingEffectASH(*state); Real64 CoolingEffect = state->dataThermalComforts->ThermalComfortData(1).CoolingEffectASH55; Real64 StillAirVel = 0.1; @@ -1079,7 +1075,7 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcThermalComfortASH55) // Test 2 - Air velocity = 1 m/s. AirVel = 1; - state->dataScheduleMgr->Schedule(3).CurrentValue = AirVel; + airVeloSched->currentVal = AirVel; CalcThermalComfortCoolingEffectASH(*state); CoolingEffect = state->dataThermalComforts->ThermalComfortData(1).CoolingEffectASH55; CoolingEffectSET = @@ -1093,8 +1089,8 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcThermalComfortASH55) state->dataHeatBal->People(1).AnkleDraftASH55 = true; AirVel = 0.15; Real64 AnkleAirVel = 0.3; - state->dataScheduleMgr->Schedule(3).CurrentValue = AirVel; - state->dataScheduleMgr->Schedule(4).CurrentValue = AnkleAirVel; + airVeloSched->currentVal = AirVel; + ankleAirVeloSched->currentVal = AnkleAirVel; CalcThermalComfortAnkleDraftASH(*state); EXPECT_NEAR(state->dataThermalComforts->ThermalComfortData(1).AnkleDraftPPDASH55, 25.0, 0.1); } diff --git a/tst/EnergyPlus/unit/Timer.unit.cc b/tst/EnergyPlus/unit/Timer.unit.cc index ac1878fc137..2db6463aaaf 100644 --- a/tst/EnergyPlus/unit/Timer.unit.cc +++ b/tst/EnergyPlus/unit/Timer.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/TranspiredCollector.unit.cc b/tst/EnergyPlus/unit/TranspiredCollector.unit.cc index a2aee98117b..0710ef94e66 100644 --- a/tst/EnergyPlus/unit/TranspiredCollector.unit.cc +++ b/tst/EnergyPlus/unit/TranspiredCollector.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -75,7 +75,6 @@ using namespace EnergyPlus::DataHeatBalSurface; using namespace EnergyPlus::DataSurfaces; using namespace EnergyPlus::DataZoneEquipment; using namespace EnergyPlus::Psychrometrics; -using namespace EnergyPlus::ScheduleManager; using namespace EnergyPlus::SurfaceGeometry; using namespace EnergyPlus::TranspiredCollector; using namespace EnergyPlus::HeatBalanceManager; @@ -194,10 +193,9 @@ TEST_F(EnergyPlusFixture, TranspiredCollectors_InitTranspiredCollectorTest) }); ASSERT_TRUE(process_idf(idf_objects)); - - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ScheduleManager::ProcessScheduleInput(*state); + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); GetProjectControlData(*state, ErrorsFound); // read project control data EXPECT_FALSE(ErrorsFound); @@ -214,8 +212,8 @@ TEST_F(EnergyPlusFixture, TranspiredCollectors_InitTranspiredCollectorTest) state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; @@ -227,8 +225,6 @@ TEST_F(EnergyPlusFixture, TranspiredCollectors_InitTranspiredCollectorTest) SetSurfaceOutBulbTempAt(*state); - InitializePsychRoutines(*state); - GetTranspiredCollectorInput(*state); EXPECT_FALSE(ErrorsFound); diff --git a/tst/EnergyPlus/unit/UFADManager.unit.cc b/tst/EnergyPlus/unit/UFADManager.unit.cc index 4c774d784e7..ad7324b0f3a 100644 --- a/tst/EnergyPlus/unit/UFADManager.unit.cc +++ b/tst/EnergyPlus/unit/UFADManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/UnitHeater.unit.cc b/tst/EnergyPlus/unit/UnitHeater.unit.cc index b5472f8f702..7acfeca1db1 100644 --- a/tst/EnergyPlus/unit/UnitHeater.unit.cc +++ b/tst/EnergyPlus/unit/UnitHeater.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -93,7 +93,6 @@ using namespace EnergyPlus::HeatBalanceManager; using namespace EnergyPlus::OutputProcessor; using namespace EnergyPlus::OutputReportPredefined; using namespace EnergyPlus::Psychrometrics; -using namespace EnergyPlus::ScheduleManager; using namespace EnergyPlus::SimulationManager; using namespace EnergyPlus::SizingManager; using namespace EnergyPlus::SurfaceGeometry; @@ -1100,10 +1099,9 @@ TEST_F(EnergyPlusFixture, UnitHeater_HWHeatingCoilUAAutoSizingTest) " ; !- Rated Ratio for Air and Water Convection", }); ASSERT_TRUE(process_idf(idf_objects)); - - state->dataGlobal->NumOfTimeStepInHour = 4; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized - ProcessScheduleInput(*state); // read schedule data + state->dataGlobal->TimeStepsInHour = 4; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 15; // must initialize this to get schedules initialized + state->init_state(*state); ErrorsFound = false; HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); // read project control data @@ -1123,7 +1121,7 @@ TEST_F(EnergyPlusFixture, UnitHeater_HWHeatingCoilUAAutoSizingTest) state->dataLoopNodes->MoreNodeInfo.allocate(20); state->dataHVACGlobal->TimeStepSys = state->dataGlobal->TimeStepZone; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; SetupTimePointers(*state, OutputProcessor::TimeStepType::Zone, state->dataGlobal->TimeStepZone); SetupTimePointers(*state, OutputProcessor::TimeStepType::System, state->dataHVACGlobal->TimeStepSys); @@ -1151,18 +1149,10 @@ TEST_F(EnergyPlusFixture, UnitHeater_HWHeatingCoilUAAutoSizingTest) EXPECT_FALSE(ErrorsFound); HWMaxVolFlowRate = state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate; - HWDensity = - FluidProperties::GetDensityGlycol(*state, - state->dataPlnt->PlantLoop(state->dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state->dataPlnt->PlantLoop(state->dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc.loopNum).FluidIndex, - "xxx"); - CpHW = FluidProperties::GetSpecificHeatGlycol( - *state, - state->dataPlnt->PlantLoop(state->dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc.loopNum).FluidName, - Constant::HWInitConvTemp, - state->dataPlnt->PlantLoop(state->dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc.loopNum).FluidIndex, - "xxx"); + HWDensity = state->dataPlnt->PlantLoop(state->dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc.loopNum) + .glycol->getDensity(*state, Constant::HWInitConvTemp, "xxx"); + CpHW = state->dataPlnt->PlantLoop(state->dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc.loopNum) + .glycol->getSpecificHeat(*state, Constant::HWInitConvTemp, "xxx"); HWPlantDeltaTDesign = state->dataSize->PlantSizData(PltSizHeatNum).DeltaT; // calculate hot water coil design capacity HWCoilDesignCapacity = HWMaxVolFlowRate * HWDensity * CpHW * HWPlantDeltaTDesign; @@ -1289,9 +1279,9 @@ TEST_F(EnergyPlusFixture, UnitHeater_SimUnitHeaterTest) }); ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 4; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized - ProcessScheduleInput(*state); // read schedule data + state->dataGlobal->TimeStepsInHour = 4; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 15; // must initialize this to get schedules initialized + state->init_state(*state); ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data @@ -1333,9 +1323,8 @@ TEST_F(EnergyPlusFixture, UnitHeater_SimUnitHeaterTest) } state->dataPlnt->PlantLoop(1).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "HotWater"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; @@ -1355,7 +1344,7 @@ TEST_F(EnergyPlusFixture, UnitHeater_SimUnitHeaterTest) state->dataHVACGlobal->TurnFansOn = true; state->dataHVACGlobal->TurnFansOff = false; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1; + Sched::GetSchedule(*state, "UNITHEATAVAILABILITY")->currentVal = 1; state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = false; @@ -1400,12 +1389,8 @@ TEST_F(EnergyPlusFixture, UnitHeater_SimUnitHeaterTest) EXPECT_NEAR(UHHeatingRate, state->dataUnitHeaters->UnitHeat(UnitHeatNum).HeatPower, ConvTol); // verify the heat rate delivered by the hot water heating coil HWMassFlowRate = state->dataWaterCoils->WaterCoil(CoilNum).InletWaterMassFlowRate; - CpHW = FluidProperties::GetSpecificHeatGlycol( - *state, - state->dataPlnt->PlantLoop(state->dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc.loopNum).FluidName, - 60.0, - state->dataPlnt->PlantLoop(state->dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc.loopNum).FluidIndex, - "UnitTest"); + CpHW = state->dataPlnt->PlantLoop(state->dataUnitHeaters->UnitHeat(UnitHeatNum).HWplantLoc.loopNum) + .glycol->getSpecificHeat(*state, 60.0, "UnitTest"); HWCoilHeatingRate = HWMassFlowRate * CpHW * (state->dataLoopNodes->Node(WCWaterInletNode).Temp - state->dataLoopNodes->Node(WCWaterOutletNode).Temp); EXPECT_NEAR(HWCoilHeatingRate, state->dataWaterCoils->WaterCoil(CoilNum).TotWaterHeatingCoilRate, ConvTol); diff --git a/tst/EnergyPlus/unit/UnitVentilator.unit.cc b/tst/EnergyPlus/unit/UnitVentilator.unit.cc index 640b6160f4a..39f75b78890 100644 --- a/tst/EnergyPlus/unit/UnitVentilator.unit.cc +++ b/tst/EnergyPlus/unit/UnitVentilator.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/UnitaryHybridAirConditioner.unit.cc b/tst/EnergyPlus/unit/UnitaryHybridAirConditioner.unit.cc index 9928dfbfe8e..54ea275b155 100644 --- a/tst/EnergyPlus/unit/UnitaryHybridAirConditioner.unit.cc +++ b/tst/EnergyPlus/unit/UnitaryHybridAirConditioner.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -91,7 +91,6 @@ using namespace EnergyPlus::DataAirLoop; using namespace EnergyPlus::DataAirSystems; using namespace EnergyPlus::DataSizing; using namespace EnergyPlus::DataHeatBalance; -using namespace EnergyPlus::ScheduleManager; using namespace EnergyPlus::DataEnvironment; using namespace EnergyPlus::DataZoneEquipment; using namespace EnergyPlus::DataLoopNode; @@ -110,13 +109,12 @@ using namespace EnergyPlus::SizingManager; using EnergyPlus::Curve::CurveValue; using EnergyPlus::Curve::GetCurveName; using EnergyPlus::Curve::GetNormalPoint; -using EnergyPlus::Psychrometrics::PsyHFnTdbRhPb; -using EnergyPlus::Psychrometrics::PsyRhFnTdbWPb; -using EnergyPlus::Psychrometrics::PsyWFnTdbRhPb; -using namespace EnergyPlus::ScheduleManager; using EnergyPlus::HybridEvapCoolingModel::CMode; using EnergyPlus::HybridEvapCoolingModel::CSetting; using EnergyPlus::HybridEvapCoolingModel::Model; +using EnergyPlus::Psychrometrics::PsyHFnTdbRhPb; +using EnergyPlus::Psychrometrics::PsyRhFnTdbWPb; +using EnergyPlus::Psychrometrics::PsyWFnTdbRhPb; using namespace EnergyPlus::HybridUnitaryAirConditioners; namespace EnergyPlus { @@ -126,6 +124,10 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_Unittest) ASSERT_TRUE(process_idf( delimited_string(read_lines_in_file(configured_source_directory() / "tst/EnergyPlus/unit/Resources/UnitaryHybridUnitTest_DOSA.idf")))); + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + // setup environment bool ErrorsFound(false); GetZoneData(*state, ErrorsFound); @@ -133,9 +135,7 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_Unittest) // Initialize schedule values state->dataGlobal->TimeStep = 1; state->dataHVACGlobal->TimeStepSys = 1; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataGlobal->HourOfDay = 1; @@ -144,7 +144,7 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_Unittest) state->dataEnvrn->HolidayIndex = 0; state->dataGlobal->WarmupFlag = false; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // Initialize zone areas and volumes - too many other things need to be set up to do these in the normal routines state->dataHeatBal->Zone(1).FloorArea = 232.26; state->dataEnvrn->StdRhoAir = 1.225; @@ -157,8 +157,7 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_Unittest) // Setup performance tables using namespace EnergyPlus::DataEnvironment; // process schedules - ProcessScheduleInput(*state); // read schedules - UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // Get Unitary system GetInputZoneHybridUnitaryAirConditioners(*state, ErrorsFound); EXPECT_EQ(1, state->dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner.size()); @@ -390,9 +389,7 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_Unittest) // Setup performance tables using namespace EnergyPlus::DataEnvironment; - // process schedules - ProcessScheduleInput(*state); // read schedules - UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // Get Unitary system: no, we don't want to do it twice! Otherwise the Output Variables will be duplicated // GetInputZoneHybridUnitaryAirConditioners(*state, ErrorsFound); EXPECT_EQ(1, state->dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner.size()); @@ -1255,6 +1252,7 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_ModelOperatingSetting "3.25; !- Output Value 1", }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Curve::GetCurveInput(*state); state->dataCurveManager->GetCurvesInputFlag = false; @@ -1430,6 +1428,8 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_ValidateOptionalError }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + bool ErrorsFound = false; GetInputZoneHybridUnitaryAirConditioners(*state, ErrorsFound); // Design Specification Outdoor Air Object Name 'SZ DSOA SPACE2-1' is not defined in this model, thus an error is thrown @@ -1444,6 +1444,10 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_RuntimeFraction_Initi ASSERT_TRUE(process_idf( delimited_string(read_lines_in_file(configured_source_directory() / "tst/EnergyPlus/unit/Resources/UnitaryHybridUnitTest_DOSA.idf")))); + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + // setup environment bool ErrorsFound(false); GetZoneData(*state, ErrorsFound); @@ -1451,9 +1455,8 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_RuntimeFraction_Initi // Initialize schedule values state->dataGlobal->TimeStep = 1; state->dataHVACGlobal->TimeStepSys = 1; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; + state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataGlobal->HourOfDay = 1; @@ -1462,7 +1465,7 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_RuntimeFraction_Initi state->dataEnvrn->HolidayIndex = 0; state->dataGlobal->WarmupFlag = false; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // Initialize zone areas and volumes - too many other things need to be set up to do these in the normal routines state->dataHeatBal->Zone(1).FloorArea = 232.26; state->dataEnvrn->StdRhoAir = 1.225; @@ -1474,9 +1477,7 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_RuntimeFraction_Initi // Setup performance tables using namespace EnergyPlus::DataEnvironment; - // process schedules - ProcessScheduleInput(*state); // read schedules - UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // Get Unitary system GetInputZoneHybridUnitaryAirConditioners(*state, ErrorsFound); // All to get OA requirements diff --git a/tst/EnergyPlus/unit/UnitarySystem.unit.cc b/tst/EnergyPlus/unit/UnitarySystem.unit.cc index dd552559557..7487675f6f6 100644 --- a/tst/EnergyPlus/unit/UnitarySystem.unit.cc +++ b/tst/EnergyPlus/unit/UnitarySystem.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -136,7 +136,7 @@ class ZoneUnitarySysTest : public EnergyPlusFixture state->dataZoneEquip->ZoneEquipConfig(1).ReturnNode(1) = 21; state->dataZoneEquip->ZoneEquipConfig(1).FixedReturnFlow.allocate(1); state->dataHeatBal->Zone(1).SystemZoneNodeNumber = state->dataZoneEquip->ZoneEquipConfig(1).ZoneNode; - state->dataZoneEquip->ZoneEquipConfig(1).ReturnFlowSchedPtrNum = ScheduleManager::ScheduleAlwaysOn; + state->dataZoneEquip->ZoneEquipConfig(1).returnFlowFracSched = Sched::GetScheduleAlwaysOn(*state); state->dataZoneEquip->ZoneEquipList(1).Name = "ZONE2EQUIPMENT"; int maxEquipCount = 1; state->dataZoneEquip->ZoneEquipList(1).NumOfEquipTypes = maxEquipCount; @@ -209,13 +209,17 @@ class ZoneUnitarySysTest : public EnergyPlusFixture loopsidebranch.TotalComponents = 2; loopsidebranch.Comp.allocate(2); } + + // Need to initialize FluidProperties, do that here + state->dataFluid->init_state(*state); + state->dataPlnt->PlantLoop(1).Name = "Hot Water Loop"; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).Name = "Chilled Water Loop"; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataSize->PlantSizData(1).PlantLoopName = "Hot Water Loop"; state->dataSize->PlantSizData(1).ExitTemp = 80.0; @@ -282,7 +286,6 @@ class AirloopUnitarySysTest : public EnergyPlusFixture state->dataHVACGlobal->NumPrimaryAirSys = 1; state->dataAirSystemsData->PrimaryAirSystems.allocate(1); state->dataAirLoop->AirLoopControlInfo.allocate(1); - Psychrometrics::InitializePsychRoutines(*state); state->dataLoopNodes->Node.allocate(30); state->dataHeatBal->HeatReclaimVS_DXCoil.allocate(4); } @@ -295,8 +298,7 @@ class AirloopUnitarySysTest : public EnergyPlusFixture TEST_F(AirloopUnitarySysTest, MultipleWaterCoolingCoilSizing) { - - FluidProperties::GetFluidPropertiesData(*state); + state->init_state(*state); // Set up raw water coil sizes as coil-on-branch configuration then // test against sizing of same water coils in UnitarySystem @@ -323,16 +325,12 @@ TEST_F(AirloopUnitarySysTest, MultipleWaterCoolingCoilSizing) loopsidebranch.Comp.allocate(1); } state->dataPlnt->PlantLoop(1).Name = "ColdWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "FluidWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(2).FluidName = "FluidWaterLoop"; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); // set up sizing data state->dataSize->FinalSysSizing(1).MixTempAtCoolPeak = 20.0; @@ -367,6 +365,9 @@ TEST_F(AirloopUnitarySysTest, MultipleWaterCoolingCoilSizing) state->dataWaterCoils->WaterCoil(CoilNum).WaterOutletNodeNum = 2; state->dataWaterCoils->WaterCoil(CoilNum).AirInletNodeNum = 3; state->dataWaterCoils->WaterCoil(CoilNum).AirOutletNodeNum = 4; + + state->dataWaterCoils->WaterCoil(CoilNum).availSched = Sched::GetScheduleAlwaysOff(*state); + state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum; @@ -590,7 +591,7 @@ TEST_F(ZoneUnitarySysTest, Test_UnitarySystemModel_factory) Setpoint, !- Control Type East Zone, !- Controlling Zone or Thermostat Location None, !- Dehumidification Control Type - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Zone Exhaust Node, !- Air Inlet Node Name Zone 2 Inlet Node, !- Air Outlet Node Name Fan:OnOff, !- Supply Fan Object Type @@ -651,7 +652,7 @@ TEST_F(ZoneUnitarySysTest, Test_UnitarySystemModel_factory) Fan:OnOff, Supply Fan 1, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name 0.7, !- Fan Total Efficiency 600.0, !- Pressure Rise{ Pa } AutoSize, !- Maximum Flow Rate{ m3 / s } @@ -662,7 +663,7 @@ TEST_F(ZoneUnitarySysTest, Test_UnitarySystemModel_factory) Coil:Cooling:DX:MultiSpeed, DX Cooling Coil, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Cooling Coil Air Inlet Node, !- Air Inlet Node Name Zone 2 Inlet Node, !- Air Outlet Node Name , !- Condenser Air Inlet Node Name @@ -724,13 +725,6 @@ TEST_F(ZoneUnitarySysTest, Test_UnitarySystemModel_factory) ScheduleTypeLimits, Any Number; !- Name - Schedule:Compact, - AlwaysOne, !- Name - Any Number, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, 1.0; !- Field 3 - Schedule:Compact, Always 20C, !- Name Any Number, !- Schedule Type Limits Name @@ -773,6 +767,7 @@ TEST_F(ZoneUnitarySysTest, Test_UnitarySystemModel_factory) )IDF"; ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // call the UnitarySystem factory std::string compName = "UNITARY SYSTEM MODEL"; @@ -793,10 +788,6 @@ TEST_F(ZoneUnitarySysTest, Test_UnitarySystemModel_factory) OutputReportPredefined::SetPredefinedTables(*state); - ScheduleManager::ProcessScheduleInput(*state); // read schedules - - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // set up node conditions to test UnitarySystem set point based control @@ -867,7 +858,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_TwoSpeedDXCoolCoil_Only) Setpoint, !- Control Type East Zone, !- Controlling Zone or Thermostat Location None, !- Dehumidification Control Type - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Zone Exhaust Node, !- Air Inlet Node Name Zone 2 Inlet Node, !- Air Outlet Node Name Fan:OnOff, !- Supply Fan Object Type @@ -905,7 +896,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_TwoSpeedDXCoolCoil_Only) 80.0; !- Maximum Supply Air Temperature{ C } Fan:OnOff, Supply Fan 1, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name 0.7, !- Fan Total Efficiency 600.0, !- Pressure Rise{ Pa } autosize, !- Maximum Flow Rate{ m3 / s } @@ -942,12 +933,6 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_TwoSpeedDXCoolCoil_Only) EvaporativelyCooled; !- Condenser Type ScheduleTypeLimits, Any Number; !- Name - Schedule:Compact, - AlwaysOne, !- Name - Any Number, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, 1.0; !- Field 3 Schedule:Compact, Always 20C, !- Name Any Number, !- Schedule Type Limits Name @@ -987,6 +972,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_TwoSpeedDXCoolCoil_Only) )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); // call the UnitarySystem factory std::string compName = "UNITARY SYSTEM MODEL"; @@ -1047,15 +1033,11 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_TwoSpeedDXCoolCoil_Only) state->dataLoopNodes->Node(1).HumRat = 0.00922; // 17C wb state->dataLoopNodes->Node(1).Enthalpy = 47597.03; // www.sugartech.com/psychro/index.php - ScheduleManager::ProcessScheduleInput(*state); // read schedules - // Cooling coil air inlet node = 3 state->dataLoopNodes->Node(3).MassFlowRateMax = thisSys->m_DesignMassFlowRate; // max at fan outlet so fan won't limit flow // Cooling coil air outlet node = 2 state->dataLoopNodes->Node(2).TempSetPoint = 17.0; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // COOLING mode @@ -1089,7 +1071,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiSpeedDXCoolCoil_Only) Setpoint, !- Control Type East Zone, !- Controlling Zone or Thermostat Location None, !- Dehumidification Control Type - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Zone Exhaust Node, !- Air Inlet Node Name Zone 2 Inlet Node, !- Air Outlet Node Name Fan:OnOff, !- Supply Fan Object Type @@ -1149,7 +1131,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiSpeedDXCoolCoil_Only) Fan:OnOff, Supply Fan 1, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name 0.7, !- Fan Total Efficiency 600.0, !- Pressure Rise{ Pa } autosize, !- Maximum Flow Rate{ m3 / s } @@ -1222,13 +1204,6 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiSpeedDXCoolCoil_Only) ScheduleTypeLimits, Any Number; !- Name - Schedule:Compact, - AlwaysOne, !- Name - Any Number, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, 1.0; !- Field 3 - Schedule:Compact, Always 20C, !- Name Any Number, !- Schedule Type Limits Name @@ -1271,6 +1246,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiSpeedDXCoolCoil_Only) )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); // call the UnitarySystem factory std::string compName = "UNITARY SYSTEM MODEL"; @@ -1333,15 +1309,11 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiSpeedDXCoolCoil_Only) state->dataLoopNodes->Node(1).HumRat = 0.00922; // 17C wb state->dataLoopNodes->Node(1).Enthalpy = 47597.03; // www.sugartech.com/psychro/index.php - ScheduleManager::ProcessScheduleInput(*state); // read schedules - // Cooling coil air inlet node = 3 state->dataLoopNodes->Node(3).MassFlowRateMax = thisSys->m_DesignMassFlowRate; // max at fan outlet so fan won't limit flow // Cooling coil air outlet node = 2 state->dataLoopNodes->Node(2).TempSetPoint = 17.0; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // COOLING mode @@ -1438,6 +1410,334 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiSpeedDXCoolCoil_Only) EXPECT_NEAR(thisSys->m_CoolingSpeedRatio, 1.0, 0.001); // RESET TO MAX SPEED ALLOWED } +TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiSpeedDXCoolCoil_Only_NoFan) +{ + + std::string_view constexpr idf_objects = R"IDF( + + AirLoopHVAC:UnitarySystem, + Unitary System Model, !- Name + Setpoint, !- Control Type + , !- Controlling Zone or Thermostat Location + None, !- Dehumidification Control Type + AlwaysOne, !- Availability Schedule Name + Zone Exhaust Node, !- Air Inlet Node Name + Zone 2 Inlet Node, !- Air Outlet Node Name + , !- Supply Fan Object Type + , !- Supply Fan Name + , !- Fan Placement + , !- Supply Air Fan Operating Mode Schedule Name + , !- Heating Coil Object Type + , !- Heating Coil Name + , !- DX Heating Coil Sizing Ratio + Coil:Cooling:DX:MultiSpeed, !- Cooling Coil Object Type + DX Cooling Coil, !- Cooling Coil Name + No, !- Use DOAS DX Cooling Coil + 2.0, !- DOAS DX Cooling Coil Leaving Minimum Air Temperature{ C } + SensibleOnlyLoadControl, !- Latent Load Control + , !- Supplemental Heating Coil Object Type + , !- Supplemental Heating Coil Name + SupplyAirFlowRate, !- Supply Air Flow Rate Method During Cooling Operation + 1.8, !- Supply Air Flow Rate During Cooling Operation{ m3/s } + , !- Supply Air Flow Rate Per Floor Area During Cooling Operation{ m3/s-m2 } + , !- Fraction of Autosized Design Cooling Supply Air Flow Rate + , !- Design Supply Air Flow Rate Per Unit of Capacity During Cooling Operation{ m3/s-W } + SupplyAirFlowRate, !- Supply air Flow Rate Method During Heating Operation + 1.8, !- Supply Air Flow Rate During Heating Operation{ m3/s } + , !- Supply Air Flow Rate Per Floor Area during Heating Operation{ m3/s-m2 } + , !- Fraction of Autosized Design Heating Supply Air Flow Rate + , !- Design Supply Air Flow Rate Per Unit of Capacity During Heating Operation{ m3/s-W } + , !- Supply Air Flow Rate Method When No Cooling or Heating is Required + , !- Supply Air Flow Rate When No Cooling or Heating is Required{ m3/s } + , !- Supply Air Flow Rate Per Floor Area When No Cooling or Heating is Required{ m3/s-m2 } + , !- Fraction of Autosized Design Cooling Supply Air Flow Rate + , !- Fraction of Autosized Design Heating Supply Air Flow Rate + , !- Design Supply Air Flow Rate Per Unit of Capacity During Cooling Operation{ m3/s-W } + , !- Design Supply Air Flow Rate Per Unit of Capacity During Heating Operation{ m3/s-W } + , !- No Load Supply Air Flow Rate Control Set To Low Speed + 80.0, !- Maximum Supply Air Temperature{ C } + , !- Maximum Outdoor Dry-Bulb Temperature for Supplemental Heater Operation {C} + , !- Outdoor Dry-Bulb Temperature Sensor Node Name + , !- Ancilliary On-Cycle Electric Power + , !- Ancilliary Off-Cycle Electric Power + , !- Design Heat Recovery Water Flow Rate + , !- Maximum Temperature for Heat Recovery + , !- Heat Recovery Water Inlet Node Name + , !- Heat Recovery Water Outlet Node Name + UnitarySystemPerformance:Multispeed, !- Design Specification Multispeed Object Type + DX Cool MultiSpd Unitary System MultiSpeed Performance; !- Design Specification Multispeed Object Name + + UnitarySystemPerformance:Multispeed, + DX Cool MultiSpd Unitary System MultiSpeed Performance, !- Name + 1, !- Number of Speeds for Heating + 2, !- Number of Speeds for Cooling + No, !- Single Mode Operation + , !- No Load Supply Air Flow Rate Ratio + 1, !- Heating Speed 1 Supply Air Flow Ratio + 1, !- Cooling Speed 1 Supply Air Flow Ratio + Autosize, !- Heating Speed 2 Supply Air Flow Ratio + Autosize; !- Cooling Speed 2 Supply Air Flow Ratio + + Coil:Cooling:DX:MultiSpeed, + DX Cooling Coil, !- Name + , !- Availability Schedule Name + Zone Exhaust Node, !- Air Inlet Node Name + Zone 2 Inlet Node, !- Air Outlet Node Name + , !- Condenser Air Inlet Node Name + AirCooled, !- Condenser Type + , !- Minimum Outdoor Dry - Bulb Temperature for Compressor Operation{ C } + , !- Supply Water Storage Tank Name + , !- Condensate Collection Water Storage Tank Name + No, !- Apply Part Load Fraction to Speeds Greater than 1 + No, !- Apply Latent Degradation to Speeds Greater than 1 + 0, !- Crankcase Heater Capacity{ W } + , !- Crankcase Heater Capacity Function of Temperature Curve Name + 10, !- Maximum Outdoor Dry - Bulb Temperature for Crankcase Heater Operation{ C } + 0, !- Basin Heater Capacity{ W / K } + 2, !- Basin Heater Setpoint Temperature{ C } + , !- Basin Heater Operating Schedule Name + Electricity, !- Fuel Type + 2, !- Number of Speeds + AutoSize, !- Speed 1 Gross Rated Total Cooling Capacity{ W } + AutoSize, !- Speed 1 Gross Rated Sensible Heat Ratio + 5.12895662368113, !- Speed 1 Gross Rated Cooling COP{ W / W } + AutoSize, !- Speed 1 Rated Air Flow Rate{ m3 / s } + 773.3, !- 2017 Speed 1 Rated Evaporator Fan Power Per Volume Flow Rate {W/(m3/s)} + 934.4, !- 2023 Speed 1 Rated Evaporator Fan Power Per Volume Flow Rate {W/(m3/s)}", //??BPS:T + Biquadratic, !- Speed 1 Total Cooling Capacity Function of Temperature Curve Name + Quadratic, !- Speed 1 Total Cooling Capacity Function of Flow Fraction Curve Name + Biquadratic, !- Speed 1 Energy Input Ratio Function of Temperature Curve Name + Quadratic, !- Speed 1 Energy Input Ratio Function of Flow Fraction Curve Name + Quadratic, !- Speed 1 Part Load Fraction Correlation Curve Name + 0, !- Speed 1 Nominal Time for Condensate Removal to Begin{ s } + 0, !- Speed 1 Ratio of Initial Moisture Evaporation Rate and Steady State Latent Capacity{ dimensionless } + 0, !- Speed 1 Maximum Cycling Rate{ cycles / hr } + 0, !- Speed 1 Latent Capacity Time Constant{ s } + 0.5, !- Speed 1 Rated Waste Heat Fraction of Power Input{ dimensionless } + Biquadratic, !- Speed 1 Waste Heat Function of Temperature Curve Name + 0.9, !- Speed 1 Evaporative Condenser Effectiveness{ dimensionless } + AutoSize, !- Speed 1 Evaporative Condenser Air Flow Rate{ m3 / s } + AutoSize, !- Speed 1 Rated Evaporative Condenser Pump Power Consumption{ W } + AutoSize, !- Speed 2 Gross Rated Total Cooling Capacity{ W } + AutoSize, !- Speed 2 Gross Rated Sensible Heat Ratio + 4.68933177022274, !- Speed 2 Gross Rated Cooling COP{ W / W } + AutoSize, !- Speed 2 Rated Air Flow Rate{ m3 / s } + 773.3, !- 2017 Speed 2 Rated Evaporator Fan Power Per Volume Flow Rate {W/(m3/s)} + 934.4, !- 2023 Speed 2 Rated Evaporator Fan Power Per Volume Flow Rate {W/(m3/s)}", //??BPS:T + Biquadratic, !- Speed 2 Total Cooling Capacity Function of Temperature Curve Name + Quadratic, !- Speed 2 Total Cooling Capacity Function of Flow Fraction Curve Name + Biquadratic, !- Speed 2 Energy Input Ratio Function of Temperature Curve Name + Quadratic, !- Speed 2 Energy Input Ratio Function of Flow Fraction Curve Name + Quadratic, !- Speed 2 Part Load Fraction Correlation Curve Name + 0, !- Speed 2 Nominal Time for Condensate Removal to Begin{ s } + 0, !- Speed 2 Ratio of Initial Moisture Evaporation Rate and steady state Latent Capacity{ dimensionless } + 0, !- Speed 2 Maximum Cycling Rate{ cycles / hr } + 0, !- Speed 2 Latent Capacity Time Constant{ s } + 0.5, !- Speed 2 Rated Waste Heat Fraction of Power Input{ dimensionless } + Biquadratic, !- Speed 2 Waste Heat Function of Temperature Curve Name + 0.9, !- Speed 2 Evaporative Condenser Effectiveness{ dimensionless } + AutoSize, !- Speed 2 Evaporative Condenser Air Flow Rate{ m3 / s } + AutoSize; !- Speed 2 Rated Evaporative Condenser Pump Power Consumption{ W } + + ScheduleTypeLimits, + Any Number; !- Name + + Schedule:Compact, + AlwaysOne, !- Name + Any Number, !- Schedule Type Limits Name + Through: 12/31, !- Field 1 + For: AllDays, !- Field 2 + Until: 24:00, 1.0; !- Field 3 + + Schedule:Compact, + Always 20C, !- Name + Any Number, !- Schedule Type Limits Name + Through: 12/31, !- Field 1 + For: AllDays, !- Field 2 + Until: 24:00, 20.0; !- Field 3 + + SetpointManager:Scheduled, + Cooling Coil Setpoint Manager, !- Name + Temperature, !- Control Variable + Always 20C, !- Schedule Name + Zone 2 Inlet Node; !- Setpoint Node or NodeList Name + + Curve:Quadratic, + Quadratic, !- Name + 0.8, !- Coefficient1 Constant + 0.2, !- Coefficient2 x + 0.0, !- Coefficient3 x**2 + 0.5, !- Minimum Value of x + 1.5; !- Maximum Value of x + + Curve:Biquadratic, + Biquadratic, !- Name + 0.942587793, !- Coefficient1 Constant + 0.009543347, !- Coefficient2 x + 0.000683770, !- Coefficient3 x**2 + -0.011042676, !- Coefficient4 y + 0.000005249, !- Coefficient5 y**2 + -0.000009720, !- Coefficient6 x*y + 12.77778, !- Minimum Value of x + 23.88889, !- Maximum Value of x + 18.0, !- Minimum Value of y + 46.11111, !- Maximum Value of y + , !- Minimum Curve Output + , !- Maximum Curve Output + Temperature, !- Input Unit Type for X + Temperature, !- Input Unit Type for Y + Dimensionless; !- Output Unit Type + + )IDF"; + + ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); + + // call the UnitarySystem factory + std::string compName = "UNITARY SYSTEM MODEL"; + bool zoneEquipment = false; + bool FirstHVACIteration = true; + UnitarySystems::UnitarySys::factory(*state, HVAC::UnitarySysType::Unitary_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; + + int AirLoopNum = 1; + state->dataHVACGlobal->NumPrimaryAirSys = 1; + state->dataAirLoop->AirLoopControlInfo.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(AirLoopNum).NumBranches = 1; + int BranchNum = 1; + state->dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).TotalComponents = 1; + int CompNum = 1; + state->dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).CompType_Num = + SimAirServingZones::CompType::UnitarySystemModel; + state->dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).Name = thisSys->Name; + + state->dataZoneEquip->ZoneEquipInputsFilled = true; // indicate zone data is available + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + compare_err_stream(""); + EXPECT_FALSE(ErrorsFound); // expect no errors + thisSys->m_ThisSysInputShouldBeGotten = false; + + OutputReportPredefined::SetPredefinedTables(*state); + + // UnitarySystem used as zone equipment will not be modeled when FirstHAVCIteration is true, first time FirstHVACIteration = false will disable + // the 'return' on FirstHVACIteration = true set FirstHVACIteration to false for unit testing to size water coils + FirstHVACIteration = false; + state->dataGlobal->BeginEnvrnFlag = false; + state->dataHVACGlobal->DoSetPointTest = true; + state->dataEnvrn->Month = 5; + state->dataEnvrn->DayOfMonth = 31; + state->dataGlobal->HourOfDay = 23; + state->dataEnvrn->DSTIndicator = 1; // DST IS ON + state->dataEnvrn->MonthTomorrow = 6; + state->dataEnvrn->DayOfWeek = 4; + state->dataEnvrn->DayOfWeekTomorrow = 5; + state->dataEnvrn->HolidayIndex = 0; + state->dataGlobal->TimeStep = 4; + state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); + + Sched::UpdateScheduleVals(*state); + SetPointManager::ManageSetPoints(*state); + + // overwrite outdoor weather temp to variable speed coil rated water temp until this gets fixed + state->dataSize->DesDayWeath(1).Temp(1) = 29.4; + + int CompIndex = 1; + bool HeatActive = false; + bool CoolActive = true; + int constexpr ZoneOAUnitNum = 0; + Real64 constexpr OAUCoilOutTemp = 0.0; + Real64 sensOut = 0.0; + Real64 latOut = 0.0; + + thisSys->CoolCtrlNode = thisSys->AirOutNode; + thisSys->CoolCoilInletNodeNum = thisSys->AirInNode; + + thisSys->simulate(*state, + thisSys->Name, + FirstHVACIteration, + AirLoopNum, + CompIndex, + HeatActive, + CoolActive, + ZoneOAUnitNum, + OAUCoilOutTemp, + zoneEquipment, + sensOut, + latOut); + + // Test System behavior with no supply fan + EXPECT_FALSE(thisSys->m_FanExists); + + // set up node conditions to test UnitarySystem set point based control + // Unitary system air inlet node = 1 + state->dataLoopNodes->Node(thisSys->AirInNode).MassFlowRate = 1.2; + + // test COOLING condition + state->dataLoopNodes->Node(1).Temp = 24.0; // 24C db + state->dataLoopNodes->Node(1).HumRat = 0.00922; // 17C wb + state->dataLoopNodes->Node(1).Enthalpy = 47597.03; // www.sugartech.com/psychro/index.php + + // ScheduleManager::ProcessScheduleInput(*state); // read schedules + + state->dataLoopNodes->Node(thisSys->AirOutNode).TempSetPoint = 17.0; + + Sched::GetSchedule(*state, "ALWAYSONE")->currentVal = 1.0; // Enable schedule without calling schedule manager + + state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning + thisSys->m_EMSOverrideCoilSpeedNumOn = false; + FirstHVACIteration = true; + + // COOLING mode + thisSys->simulate(*state, + thisSys->Name, + FirstHVACIteration, + AirLoopNum, + CompIndex, + HeatActive, + CoolActive, + ZoneOAUnitNum, + OAUCoilOutTemp, + zoneEquipment, + sensOut, + latOut); + + // check that cooling coil air outlet node is at set point + EXPECT_NEAR(state->dataLoopNodes->Node(thisSys->AirOutNode).Temp, state->dataLoopNodes->Node(thisSys->AirOutNode).TempSetPoint, 0.1); + // cooling coil air inlet node temp is greater than cooling coil air outlet node temp + EXPECT_GT(state->dataLoopNodes->Node(thisSys->AirInNode).Temp, state->dataLoopNodes->Node(thisSys->AirOutNode).Temp); + EXPECT_NEAR(thisSys->m_CoolingCycRatio, 0.36056, 0.001); + EXPECT_EQ(thisSys->m_CoolingSpeedRatio, 0); + EXPECT_EQ(thisSys->m_CoolingSpeedNum, 1); + EXPECT_EQ(state->dataLoopNodes->Node(thisSys->AirInNode).MassFlowRate, 1.2); + EXPECT_EQ(state->dataLoopNodes->Node(thisSys->AirInNode).MassFlowRate, state->dataLoopNodes->Node(thisSys->AirOutNode).MassFlowRate); + + // Set system availability schedule to off + Sched::GetSchedule(*state, "ALWAYSONE")->currentVal = 0.0; // Disable schedule without calling schedule manager + thisSys->simulate(*state, + thisSys->Name, + FirstHVACIteration, + AirLoopNum, + CompIndex, + HeatActive, + CoolActive, + ZoneOAUnitNum, + OAUCoilOutTemp, + zoneEquipment, + sensOut, + latOut); + + // no cooling, pass thru mass flow rate + EXPECT_EQ(state->dataLoopNodes->Node(thisSys->AirInNode).Temp, state->dataLoopNodes->Node(thisSys->AirOutNode).Temp); + EXPECT_NEAR(thisSys->m_CoolingCycRatio, 0.0, 0.001); + EXPECT_EQ(thisSys->m_CoolingSpeedRatio, 0); + EXPECT_EQ(thisSys->m_CoolingSpeedNum, 0); + EXPECT_EQ(state->dataLoopNodes->Node(thisSys->AirInNode).MassFlowRate, 1.2); + EXPECT_EQ(state->dataLoopNodes->Node(thisSys->AirInNode).MassFlowRate, state->dataLoopNodes->Node(thisSys->AirOutNode).MassFlowRate); +} + TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageGasHeatCoil_Only) { @@ -1448,7 +1748,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageGasHeatCoil_Only) Setpoint, !- Control Type East Zone, !- Controlling Zone or Thermostat Location None, !- Dehumidification Control Type - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Zone Exhaust Node, !- Air Inlet Node Name Zone 2 Inlet Node, !- Air Outlet Node Name Fan:OnOff, !- Supply Fan Object Type @@ -1506,7 +1806,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageGasHeatCoil_Only) 1; !- Cooling Speed 2 Supply Air Flow Ratio Fan:OnOff, Supply Fan 1, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name 0.7, !- Fan Total Efficiency 600.0, !- Pressure Rise{ Pa } autosize, !- Maximum Flow Rate{ m3 / s } @@ -1516,7 +1816,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageGasHeatCoil_Only) Heating Coil Air Inlet Node; !- Air Outlet Node Name Coil:Heating:Gas:MultiStage, Gas Heating Coil, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Heating Coil Air Inlet Node, !- Air Inlet Node Name Zone 2 Inlet Node, !- Air Outlet Node Name , !- Temperature Setpoint Node Name @@ -1531,12 +1831,6 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageGasHeatCoil_Only) 100; !- Stage 2 On Cycle Parasitic Electric Load{ W } ScheduleTypeLimits, Any Number; !- Name - Schedule:Compact, - AlwaysOne, !- Name - Any Number, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, 1.0; !- Field 3 Schedule:Compact, Always 18C, !- Name Any Number, !- Schedule Type Limits Name @@ -1559,6 +1853,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageGasHeatCoil_Only) )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; @@ -1612,15 +1907,11 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageGasHeatCoil_Only) state->dataLoopNodes->Node(1).HumRat = 0.00922; // 17C wb state->dataLoopNodes->Node(1).Enthalpy = 47597.03; // www.sugartech.com/psychro/index.php - ScheduleManager::ProcessScheduleInput(*state); // read schedules - // Heating coil air inlet node = 3 state->dataLoopNodes->Node(3).MassFlowRateMax = thisSys->m_DesignMassFlowRate; // max at fan outlet so fan won't limit flow // Heating coil air outlet node = 2 state->dataLoopNodes->Node(2).TempSetPoint = 25.0; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // Heating mode @@ -1681,7 +1972,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageElecHeatCoil_Only) Setpoint, !- Control Type East Zone, !- Controlling Zone or Thermostat Location None, !- Dehumidification Control Type - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Zone Exhaust Node, !- Air Inlet Node Name Zone 2 Inlet Node, !- Air Outlet Node Name Fan:OnOff, !- Supply Fan Object Type @@ -1741,7 +2032,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageElecHeatCoil_Only) Fan:OnOff, Supply Fan 1, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name 0.7, !- Fan Total Efficiency 600.0, !- Pressure Rise{ Pa } autosize, !- Maximum Flow Rate{ m3 / s } @@ -1752,7 +2043,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageElecHeatCoil_Only) Coil:Heating:Electric:MultiStage, Electric Heating Coil, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Heating Coil Air Inlet Node, !- Air Inlet Node Name Zone 2 Inlet Node, !- Air Outlet Node Name , !- Temperature Setpoint Node Name @@ -1765,13 +2056,6 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageElecHeatCoil_Only) ScheduleTypeLimits, Any Number; !- Name - Schedule:Compact, - AlwaysOne, !- Name - Any Number, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, 1.0; !- Field 3 - Schedule:Compact, Always 18C, !- Name Any Number, !- Schedule Type Limits Name @@ -1796,6 +2080,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageElecHeatCoil_Only) )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; @@ -1853,15 +2138,11 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageElecHeatCoil_Only) state->dataLoopNodes->Node(1).HumRat = 0.00922; // 17C wb state->dataLoopNodes->Node(1).Enthalpy = 47597.03; // www.sugartech.com/psychro/index.php - ScheduleManager::ProcessScheduleInput(*state); // read schedules - // Heating coil air inlet node = 3 state->dataLoopNodes->Node(3).MassFlowRateMax = thisSys->m_DesignMassFlowRate; // max at fan outlet so fan won't limit flow // Heating coil air outlet node = 2 state->dataLoopNodes->Node(2).TempSetPoint = 25.0; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // Heating mode @@ -1928,7 +2209,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageElecHeatCoil_Backup_Load Load, !- Control Type East Zone, !- Controlling Zone or Thermostat Location None, !- Dehumidification Control Type - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Zone Exhaust Node, !- Air Inlet Node Name Zone 2 Inlet Node, !- Air Outlet Node Name Fan:OnOff, !- Supply Fan Object Type @@ -1988,7 +2269,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageElecHeatCoil_Backup_Load Fan:OnOff, Supply Fan 1, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name 0.7, !- Fan Total Efficiency 0.0, !- Pressure Rise{ Pa } autosize, !- Maximum Flow Rate{ m3 / s } @@ -1999,7 +2280,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageElecHeatCoil_Backup_Load Coil:Heating:Electric:MultiStage, Electric Heating Coil, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Heating Coil Air Inlet Node, !- Air Inlet Node Name Heating Coil Air Outlet Node, !- Air Outlet Node Name , !- Temperature Setpoint Node Name @@ -2011,7 +2292,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageElecHeatCoil_Backup_Load Coil:Heating:Electric:MultiStage, Electric Backup Heating Coil, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Heating Coil Air Outlet Node, !- Air Inlet Node Name Zone 2 Inlet Node, !- Air Outlet Node Name , !- Temperature Setpoint Node Name @@ -2024,13 +2305,6 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageElecHeatCoil_Backup_Load ScheduleTypeLimits, Any Number; !- Name - Schedule:Compact, - AlwaysOne, !- Name - Any Number, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, 1.0; !- Field 3 - Curve:Quadratic, Quadratic, !- Name 0.8, !- Coefficient1 Constant @@ -2042,6 +2316,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageElecHeatCoil_Backup_Load )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; @@ -2081,7 +2356,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageElecHeatCoil_Backup_Load state->dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputReqToCoolSP = 0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputReqToHeatSP = 0; state->dataZoneEnergyDemand->ZoneSysMoistureDemand(ControlZoneNum).RemainingOutputReqToDehumidSP = 0; - state->dataHeatBalFanSys->TempControlType(ControlZoneNum) = HVAC::ThermostatType::SingleHeating; + state->dataHeatBalFanSys->TempControlType(ControlZoneNum) = HVAC::SetptType::SingleHeat; thisSys->simulate(*state, thisSys->Name, @@ -2122,14 +2397,10 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageElecHeatCoil_Backup_Load state->dataLoopNodes->Node(1).HumRat = 0.00922; // 17C wb state->dataLoopNodes->Node(1).Enthalpy = 47597.03; // www.sugartech.com/psychro/index.php - ScheduleManager::ProcessScheduleInput(*state); // read schedules - // Heating coil air inlet node = 3 state->dataLoopNodes->Node(3).MassFlowRateMax = thisSys->m_DesignMassFlowRate; // max at fan outlet so fan won't limit flow // Heating coil air outlet node = 2 - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning state->dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputRequired = 3000; @@ -2260,7 +2531,7 @@ AirLoopHVAC:UnitarySystem, Setpoint, !- Control Type East Zone, !- Controlling Zone or Thermostat Location None, !- Dehumidification Control Type - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Zone Exhaust Node, !- Air Inlet Node Name Zone 2 Inlet Node, !- Air Outlet Node Name Fan:OnOff, !- Supply Fan Object Type @@ -2320,7 +2591,7 @@ UnitarySystemPerformance:Multispeed, Fan:OnOff, Supply Fan 1, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name 0.7, !- Fan Total Efficiency 600.0, !- Pressure Rise{ Pa } autosize, !- Maximum Flow Rate{ m3 / s } @@ -2331,7 +2602,7 @@ Fan:OnOff, Coil:Heating:Electric:MultiStage, Electric Heating Coil, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Heating Coil Air Inlet Node, !- Air Inlet Node Name Heating Coil Air Outlet Node, !- Air Outlet Node Name , !- Temperature Setpoint Node Name @@ -2343,7 +2614,7 @@ Coil:Heating:Electric:MultiStage, Coil:Heating:Electric:MultiStage, Electric Backup Heating Coil, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Heating Coil Air Outlet Node, !- Air Inlet Node Name Zone 2 Inlet Node, !- Air Outlet Node Name , !- Temperature Setpoint Node Name @@ -2356,13 +2627,6 @@ Coil:Heating:Electric:MultiStage, ScheduleTypeLimits, Any Number; !- Name -Schedule:Compact, - AlwaysOne, !- Name - Any Number, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, 1.0; !- Field 3 - Schedule:Compact, Always 18C, !- Name Any Number, !- Schedule Type Limits Name @@ -2387,6 +2651,7 @@ Curve:Quadratic, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; @@ -2444,15 +2709,11 @@ Curve:Quadratic, state->dataLoopNodes->Node(1).HumRat = 0.00922; // 17C wb state->dataLoopNodes->Node(1).Enthalpy = 47597.03; // www.sugartech.com/psychro/index.php - ScheduleManager::ProcessScheduleInput(*state); // read schedules - // Heating coil air inlet node = 3 state->dataLoopNodes->Node(3).MassFlowRateMax = thisSys->m_DesignMassFlowRate; // max at fan outlet so fan won't limit flow // Heating coil air outlet node = 2 state->dataLoopNodes->Node(2).TempSetPoint = 25.0; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // Heating mode @@ -2548,7 +2809,7 @@ AirLoopHVAC:UnitarySystem, Load, !- Control Type East Zone, !- Controlling Zone or Thermostat Location None, !- Dehumidification Control Type - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Zone Exhaust Node, !- Air Inlet Node Name Zone 2 Inlet Node, !- Air Outlet Node Name Fan:OnOff, !- Supply Fan Object Type @@ -2608,7 +2869,7 @@ UnitarySystemPerformance:Multispeed, Fan:OnOff, Supply Fan 1, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name 0.7, !- Fan Total Efficiency 0.0, !- Pressure Rise{ Pa } autosize, !- Maximum Flow Rate{ m3 / s } @@ -2619,7 +2880,7 @@ Fan:OnOff, Coil:Heating:Electric:MultiStage, Electric Heating Coil, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Heating Coil Air Inlet Node, !- Air Inlet Node Name Heating Coil Air Outlet Node, !- Air Outlet Node Name , !- Temperature Setpoint Node Name @@ -2631,7 +2892,7 @@ Coil:Heating:Electric:MultiStage, Coil:Heating:Electric:MultiStage, Electric Backup Heating Coil, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Heating Coil Air Outlet Node, !- Air Inlet Node Name Zone 2 Inlet Node, !- Air Outlet Node Name , !- Temperature Setpoint Node Name @@ -2644,13 +2905,6 @@ Coil:Heating:Electric:MultiStage, ScheduleTypeLimits, Any Number; !- Name -Schedule:Compact, - AlwaysOne, !- Name - Any Number, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, 1.0; !- Field 3 - Curve:Quadratic, Quadratic, !- Name 0.8, !- Coefficient1 Constant @@ -2662,6 +2916,7 @@ Curve:Quadratic, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; @@ -2697,7 +2952,7 @@ Curve:Quadratic, state->dataHeatBalFanSys->TempControlType.allocate(1); state->dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputReqToCoolSP = 0; state->dataZoneEnergyDemand->ZoneSysMoistureDemand(ControlZoneNum).RemainingOutputReqToDehumidSP = 0; - state->dataHeatBalFanSys->TempControlType(ControlZoneNum) = HVAC::ThermostatType::SingleHeating; + state->dataHeatBalFanSys->TempControlType(ControlZoneNum) = HVAC::SetptType::SingleHeat; // set up node conditions to test UnitarySystem set point based control // Unitary system air inlet node = 1 @@ -2709,14 +2964,10 @@ Curve:Quadratic, state->dataLoopNodes->Node(1).HumRat = 0.00922; // 17C wb state->dataLoopNodes->Node(1).Enthalpy = 47597.03; // www.sugartech.com/psychro/index.php - ScheduleManager::ProcessScheduleInput(*state); // read schedules - // Heating coil air inlet node = 3 state->dataLoopNodes->Node(3).MassFlowRateMax = thisSys->m_DesignMassFlowRate; // max at fan outlet so fan won't limit flow // Heating coil air outlet node = 2 - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning state->dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputRequired = 5500; @@ -2794,7 +3045,7 @@ AirLoopHVAC:UnitarySystem, Setpoint, !- Control Type East Zone, !- Controlling Zone or Thermostat Location None, !- Dehumidification Control Type - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Zone Exhaust Node, !- Air Inlet Node Name Zone 2 Inlet Node, !- Air Outlet Node Name Fan:OnOff, !- Supply Fan Object Type @@ -2854,7 +3105,7 @@ UnitarySystemPerformance:Multispeed, Fan:OnOff, Supply Fan 1, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name 0.7, !- Fan Total Efficiency 600.0, !- Pressure Rise{ Pa } autosize, !- Maximum Flow Rate{ m3 / s } @@ -2865,7 +3116,7 @@ Fan:OnOff, Coil:Heating:Electric:MultiStage, Electric Heating Coil, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Heating Coil Air Inlet Node, !- Air Inlet Node Name Heating Coil Air Outlet Node, !- Air Outlet Node Name , !- Temperature Setpoint Node Name @@ -2877,7 +3128,7 @@ Coil:Heating:Electric:MultiStage, Coil:Heating:Electric:MultiStage, Electric Backup Heating Coil, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Heating Coil Air Outlet Node, !- Air Inlet Node Name Zone 2 Inlet Node, !- Air Outlet Node Name , !- Temperature Setpoint Node Name @@ -2890,13 +3141,6 @@ Coil:Heating:Electric:MultiStage, ScheduleTypeLimits, Any Number; !- Name -Schedule:Compact, - AlwaysOne, !- Name - Any Number, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, 1.0; !- Field 3 - Schedule:Compact, Always 18C, !- Name Any Number, !- Schedule Type Limits Name @@ -2921,6 +3165,7 @@ Curve:Quadratic, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; @@ -2977,14 +3222,10 @@ Curve:Quadratic, state->dataLoopNodes->Node(1).HumRat = 0.00922; // 17C wb state->dataLoopNodes->Node(1).Enthalpy = 47597.03; // www.sugartech.com/psychro/index.php - ScheduleManager::ProcessScheduleInput(*state); // read schedules - // Heating coil air inlet node = 3 state->dataLoopNodes->Node(3).MassFlowRateMax = thisSys->m_DesignMassFlowRate; // max at fan outlet so fan won't limit flow // Heating coil air outlet node = 2 - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - - state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning + state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // Backup Heating coil air outlet node = 2 state->dataLoopNodes->Node(2).TempSetPoint = 33.0; @@ -3021,10 +3262,9 @@ Curve:Quadratic, state->dataLoopNodes->Node(2).Temp = 24.0; state->dataLoopNodes->Node(3).Temp = 24.0; state->dataLoopNodes->Node(4).Temp = 24.0; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state->dataLoopNodes->Node(1).HumRat = 0.00922; // 17C wb - state->dataLoopNodes->Node(1).Enthalpy = 47597.03; // www.sugartech.com/psychro/index.php - state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning + state->dataLoopNodes->Node(1).HumRat = 0.00922; // 17C wb + state->dataLoopNodes->Node(1).Enthalpy = 47597.03; // www.sugartech.com/psychro/index.php + state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // Backup Heating coil air outlet node = 2 state->dataLoopNodes->Node(2).TempSetPoint = 33.0; thisSys->m_EMSOverrideSuppCoilSpeedNumOn = true; @@ -3066,7 +3306,7 @@ AirLoopHVAC:UnitarySystem, Setpoint, !- Control Type East Zone, !- Controlling Zone or Thermostat Location None, !- Dehumidification Control Type - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Zone Exhaust Node, !- Air Inlet Node Name Zone 2 Inlet Node, !- Air Outlet Node Name Fan:OnOff, !- Supply Fan Object Type @@ -3115,7 +3355,7 @@ AirLoopHVAC:UnitarySystem, Fan:OnOff, Supply Fan 1, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name 0.7, !- Fan Total Efficiency 600.0, !- Pressure Rise{ Pa } autosize, !- Maximum Flow Rate{ m3 / s } @@ -3126,7 +3366,7 @@ Fan:OnOff, Coil:Heating:Electric, Electric Heating Coil, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name 1.0, !- Efficiency autosize, !- Nominal Capacity Heating Coil Air Inlet Node, !- Air Inlet Node Name @@ -3136,13 +3376,6 @@ Coil:Heating:Electric, ScheduleTypeLimits, Any Number; !- Name -Schedule:Compact, - AlwaysOne, !- Name - Any Number, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, 1.0; !- Field 3 - Schedule:Compact, Always 18C, !- Name Any Number, !- Schedule Type Limits Name @@ -3167,6 +3400,7 @@ Curve:Quadratic, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; @@ -3220,15 +3454,11 @@ Curve:Quadratic, state->dataLoopNodes->Node(1).HumRat = 0.00922; // 17C wb state->dataLoopNodes->Node(1).Enthalpy = 47597.03; // www.sugartech.com/psychro/index.php - ScheduleManager::ProcessScheduleInput(*state); // read schedules - // Heating coil air inlet node = 3 state->dataLoopNodes->Node(3).MassFlowRateMax = thisSys->m_DesignMassFlowRate; // max at fan outlet so fan won't limit flow // Heating coil air outlet node = 2 state->dataLoopNodes->Node(2).TempSetPoint = 25.0; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // Heating mode @@ -3263,7 +3493,7 @@ AirLoopHVAC:UnitarySystem, Setpoint, !- Control Type East Zone, !- Controlling Zone or Thermostat Location None, !- Dehumidification Control Type - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Zone Exhaust Node, !- Air Inlet Node Name Zone 2 Inlet Node, !- Air Outlet Node Name Fan:OnOff, !- Supply Fan Object Type @@ -3323,7 +3553,7 @@ UnitarySystemPerformance:Multispeed, Fan:OnOff, Supply Fan 1, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name 0.7, !- Fan Total Efficiency 600.0, !- Pressure Rise{ Pa } autosize, !- Maximum Flow Rate{ m3 / s } @@ -3334,7 +3564,7 @@ Fan:OnOff, Coil:Heating:Gas:MultiStage, Gas Heating Coil, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Heating Coil Air Inlet Node, !- Air Inlet Node Name Zone 2 Inlet Node, !- Air Outlet Node Name , !- Temperature Setpoint Node Name @@ -3351,13 +3581,6 @@ Coil:Heating:Gas:MultiStage, ScheduleTypeLimits, Any Number; !- Name -Schedule:Compact, - AlwaysOne, !- Name - Any Number, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, 1.0; !- Field 3 - Schedule:Compact, Always 18C, !- Name Any Number, !- Schedule Type Limits Name @@ -3382,6 +3605,7 @@ Curve:Quadratic, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; @@ -3435,15 +3659,11 @@ Curve:Quadratic, state->dataLoopNodes->Node(1).HumRat = 0.00922; // 17C wb state->dataLoopNodes->Node(1).Enthalpy = 47597.03; // www.sugartech.com/psychro/index.php - ScheduleManager::ProcessScheduleInput(*state); // read schedules - // Heating coil air inlet node = 3 state->dataLoopNodes->Node(3).MassFlowRateMax = thisSys->m_DesignMassFlowRate; // max at fan outlet so fan won't limit flow // Heating coil air outlet node = 2 state->dataLoopNodes->Node(2).TempSetPoint = 25.0; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // Heating mode @@ -3505,13 +3725,13 @@ AirLoopHVAC:UnitarySystem, Setpoint, !- Control Type East Zone, !- Controlling Zone or Thermostat Location None, !- Dehumidification Control Type - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Zone Exhaust Node, !- Air Inlet Node Name Zone 2 Inlet Node, !- Air Outlet Node Name Fan:OnOff, !- Supply Fan Object Type Supply Fan 1, !- Supply Fan Name BlowThrough, !- Fan Placement - AlwaysOne, !- Supply Air Fan Operating Mode Schedule Name + Constant-1.0, !- Supply Air Fan Operating Mode Schedule Name Coil:Heating:DX:VariableSpeed, !- Heating Coil Object Type DX Heating Coil, !- Heating Coil Name , !- DX Heating Coil Sizing Ratio @@ -3581,7 +3801,7 @@ UnitarySystemPerformance:Multispeed, Fan:OnOff, Supply Fan 1, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name 0.7, !- Fan Total Efficiency 600.0, !- Pressure Rise{ Pa } autosize, !- Maximum Flow Rate{ m3 / s } @@ -3858,13 +4078,6 @@ Coil:Heating:DX:VariableSpeed, ScheduleTypeLimits, Any Number; !- Name -Schedule:Compact, - AlwaysOne, !- Name - Any Number, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, 1.0; !- Field 3 - Schedule:Compact, Always 16C, !- Name Any Number, !- Schedule Type Limits Name @@ -3927,6 +4140,7 @@ Curve:Biquadratic, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; @@ -3997,8 +4211,6 @@ Curve:Biquadratic, // Heating coil air outlet node = 2 state->dataLoopNodes->Node(2).TempSetPoint = 16.0; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // COOLING mode @@ -4176,13 +4388,13 @@ AirLoopHVAC:UnitarySystem, Setpoint, !- Control Type East Zone, !- Controlling Zone or Thermostat Location None, !- Dehumidification Control Type - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Zone Exhaust Node, !- Air Inlet Node Name Zone 2 Inlet Node, !- Air Outlet Node Name Fan:OnOff, !- Supply Fan Object Type Supply Fan 1, !- Supply Fan Name BlowThrough, !- Fan Placement - AlwaysOne, !- Supply Air Fan Operating Mode Schedule Name + Constant-1.0, !- Supply Air Fan Operating Mode Schedule Name Coil:Heating:Water, !- Heating Coil Object Type Water Heating Coil, !- Heating Coil Name , !- DX Heating Coil Sizing Ratio @@ -4215,7 +4427,7 @@ AirLoopHVAC:UnitarySystem, Fan:OnOff, Supply Fan 1, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name 0.7, !- Fan Total Efficiency 600.0, !- Pressure Rise{ Pa } 1.6, !- Maximum Flow Rate{ m3 / s } @@ -4226,7 +4438,7 @@ Fan:OnOff, Coil:Cooling:Water, Water Cooling Coil, !- Name - AlwaysOne, !- Availability Schedule Namev + Constant-1.0, !- Availability Schedule Namev 0.0004, !- Design Water Flow Rate { m3 / s } 1.6000, !- Design Air Flow Rate { m3 / s } 7.22, !- Design Inlet Water Temperature { Cv } @@ -4243,7 +4455,7 @@ Coil:Cooling:Water, Coil:Heating:Water, Water Heating Coil, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name 300.0, !- U - Factor Times Area Value { W / K } 0.0006, !- Maximum Water Flow Rate { m3 / s } HWInletNode, !- Water Inlet Node Name @@ -4260,7 +4472,7 @@ Coil:Heating:Water, Coil:Heating:Water, Supp Water Heating Coil, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name 300.0, !- U - Factor Times Area Value { W / K } 0.0006, !- Maximum Water Flow Rate { m3 / s } SuppHWInletNode, !- Water Inlet Node Name @@ -4278,13 +4490,6 @@ Coil:Heating:Water, ScheduleTypeLimits, Any Number; !- Name -Schedule:Compact, - AlwaysOne, !- Name - Any Number, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, 1.0; !- Field 3 - Schedule:Compact, Always 16C, !- Name Any Number, !- Schedule Type Limits Name @@ -4327,6 +4532,7 @@ SetpointManager:Scheduled, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; @@ -4343,12 +4549,16 @@ SetpointManager:Scheduled, EXPECT_EQ(thisSys->m_MaxHeatAirVolFlow, 1.6); EXPECT_EQ(thisSys->m_MaxNoCoolHeatAirVolFlow, 0.8); + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = "WATER COOLING COIL"; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterCooling; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).NodeNumIn = 10; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).NodeNumOut = 11; + state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = "WATER HEATING COIL"; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; @@ -4436,8 +4646,6 @@ SetpointManager:Scheduled, state->dataLoopNodes->Node(suppHeatingCoilWaterInletNodeIndex).Temp = 60.0; state->dataLoopNodes->Node(suppHeatingCoilWaterInletNodeIndex).Enthalpy = 251221.6; // www.peacesoftware.de/einigewerte/calc_dampf.php5 - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // COOLING mode @@ -4611,13 +4819,13 @@ AirLoopHVAC:UnitarySystem, Setpoint, !- Control Type East Zone, !- Controlling Zone or Thermostat Location CoolReheat, !- Dehumidification Control Type - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Water Cooling Coil Air Inlet Node, !- Air Inlet Node Name Zone Inlet Node, !- Air Outlet Node Name Fan:OnOff, !- Supply Fan Object Type Supply Fan 1, !- Supply Fan Name DrawThrough, !- Fan Placement - AlwaysOne, !- Supply Air Fan Operating Mode Schedule Name + Constant-1.0, !- Supply Air Fan Operating Mode Schedule Name , !- Heating Coil Object Type , !- Heating Coil Name , !- DX Heating Coil Sizing Ratio @@ -4650,7 +4858,7 @@ AirLoopHVAC:UnitarySystem, Fan:OnOff, Supply Fan 1, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name 0.7, !- Fan Total Efficiency 600.0, !- Pressure Rise{ Pa } 1.6, !- Maximum Flow Rate{ m3 / s } @@ -4661,7 +4869,7 @@ Fan:OnOff, Coil:Cooling:Water, Water Cooling Coil, !- Name - AlwaysOne, !- Availability Schedule Namev + Constant-1.0, !- Availability Schedule Namev 0.0008, !- Design Water Flow Rate { m3 / s } 1.6000, !- Design Air Flow Rate { m3 / s } 7.22, !- Design Inlet Water Temperature { Cv } @@ -4679,13 +4887,6 @@ Coil:Cooling:Water, ScheduleTypeLimits, Any Number; !- Name -Schedule:Compact, - AlwaysOne, !- Name - Any Number, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, 1.0; !- Field 3 - Schedule:Compact, Always 20C, !- Name Any Number, !- Schedule Type Limits Name @@ -4714,6 +4915,7 @@ SetpointManager:Scheduled, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; @@ -4731,6 +4933,9 @@ SetpointManager:Scheduled, auto coolingCoilWaterInletNodeIndex = Util::FindItemInList("CHWINLETNODE", state->dataLoopNodes->NodeID); // was Node 10 auto coolingCoilWaterOutletNodeIndex = Util::FindItemInList("CHWOUTLETNODE", state->dataLoopNodes->NodeID); // was Node 10 + state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); + state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = "WATER COOLING COIL"; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterCooling; @@ -4788,8 +4993,6 @@ SetpointManager:Scheduled, state->dataLoopNodes->Node(coolingCoilWaterInletNodeIndex).Temp = 6.0; state->dataLoopNodes->Node(coolingCoilWaterInletNodeIndex).Enthalpy = 25321.8; // www.peacesoftware.de/einigewerte/calc_dampf.php5 - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // Case 0 - COOLING mode - no load, sensible or latent @@ -4978,6 +5181,7 @@ Schedule:Compact, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); UnitarySys thisSys; state->dataUnitarySystems->numUnitarySystems = 1; @@ -4993,9 +5197,8 @@ Schedule:Compact, state->dataHVACGlobal->MSHPMassFlowRateLow = 0.0; state->dataHVACGlobal->MSHPMassFlowRateHigh = 0.0; - thisSys.m_SysAvailSchedPtr = ScheduleManager::GetScheduleIndex(*state, "FanAndCoilAvailSched"); // "Get" the schedule inputs - thisSys.m_FanAvailSchedPtr = ScheduleManager::GetScheduleIndex(*state, "FanAndCoilAvailSched"); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // set availability and fan schedule to 1 + thisSys.m_sysAvailSched = Sched::GetSchedule(*state, "FANANDCOILAVAILSCHED"); // "Get" the schedule inputs + thisSys.m_fanAvailSched = Sched::GetSchedule(*state, "FANANDCOILAVAILSCHED"); thisSys.m_HeatMassFlowRate.resize(4); thisSys.m_CoolMassFlowRate.resize(4); @@ -5005,7 +5208,7 @@ Schedule:Compact, thisSys.m_LastMode = UnitarySystems::HeatingMode; thisSys.MaxNoCoolHeatAirMassFlow = 0.2; thisSys.m_NoLoadAirFlowRateRatio = 0.2; - thisSys.m_FanAvailSchedPtr = ScheduleManager::ScheduleAlwaysOn; + thisSys.m_fanAvailSched = Sched::GetScheduleAlwaysOn(*state); thisSys.AirInNode = 1; thisSys.m_HeatMassFlowRate[1] = 0.25; @@ -5479,8 +5682,8 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_ConfirmUnitarySystemSizingTest) TEST_F(EnergyPlusFixture, UnitarySystemModel_CalcUnitaryHeatingSystem) { + state->init_state(*state); - FluidProperties::GetFluidPropertiesData(*state); int AirLoopNum(1); bool FirstHVACIteration(false); HVAC::CompressorOp CompressorOn(HVAC::CompressorOp::On); @@ -5506,7 +5709,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_CalcUnitaryHeatingSystem) thisSys.m_LastMode = UnitarySystems::HeatingMode; thisSys.MaxNoCoolHeatAirMassFlow = 0.2; thisSys.m_NoLoadAirFlowRateRatio = 0.2; - thisSys.m_FanAvailSchedPtr = ScheduleManager::ScheduleAlwaysOn; + thisSys.m_fanAvailSched = Sched::GetScheduleAlwaysOn(*state); thisSys.AirInNode = 1; thisSys.m_HeatMassFlowRate[1] = 0.25; thisSys.m_MSHeatingSpeedRatio[1] = 0.25; @@ -5549,7 +5752,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_CalcUnitaryHeatingSystem) state->dataWaterCoils->CheckEquipName.allocate(1); state->dataWaterCoils->NumWaterCoils = 1; state->dataWaterCoils->GetWaterCoilsInputFlag = false; - state->dataWaterCoils->WaterCoil(1).SchedPtr = ScheduleManager::ScheduleAlwaysOn; + state->dataWaterCoils->WaterCoil(1).availSched = Sched::GetScheduleAlwaysOn(*state); state->dataWaterCoils->WaterCoil(1).Name = "Water Heating Coil"; state->dataWaterCoils->WaterCoil(1).WaterCoilType = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; state->dataWaterCoils->WaterCoil(1).DesAirVolFlowRate = 1.0; @@ -5597,9 +5800,8 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_CalcUnitaryHeatingSystem) loopsidebranch.Comp.allocate(1); } state->dataPlnt->PlantLoop(1).Name = "WaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "FluidWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; @@ -5621,8 +5823,8 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_CalcUnitaryHeatingSystem) TEST_F(EnergyPlusFixture, UnitarySystemModel_CalcUnitaryCoolingSystem) { + state->init_state(*state); - FluidProperties::GetFluidPropertiesData(*state); HVAC::CompressorOp CompressorOn(HVAC::CompressorOp::On); int AirLoopNum(1); bool FirstHVACIteration(false); @@ -5640,7 +5842,6 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_CalcUnitaryCoolingSystem) state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.20; - Psychrometrics::InitializePsychRoutines(*state); thisSys.m_MultiOrVarSpeedHeatCoil = true; thisSys.m_MultiOrVarSpeedCoolCoil = true; @@ -5654,7 +5855,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_CalcUnitaryCoolingSystem) thisSys.m_LastMode = UnitarySystems::HeatingMode; thisSys.MaxNoCoolHeatAirMassFlow = 0.2; thisSys.m_NoLoadAirFlowRateRatio = 0.2; - thisSys.m_FanAvailSchedPtr = ScheduleManager::ScheduleAlwaysOn; + thisSys.m_fanAvailSched = Sched::GetScheduleAlwaysOn(*state); thisSys.AirInNode = 1; thisSys.m_HeatMassFlowRate[1] = 0.25; thisSys.m_MSHeatingSpeedRatio[1] = 0.25; @@ -5693,7 +5894,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_CalcUnitaryCoolingSystem) state->dataWaterCoils->CheckEquipName.allocate(1); state->dataWaterCoils->NumWaterCoils = 1; state->dataWaterCoils->GetWaterCoilsInputFlag = false; - state->dataWaterCoils->WaterCoil(1).SchedPtr = ScheduleManager::ScheduleAlwaysOn; + state->dataWaterCoils->WaterCoil(1).availSched = Sched::GetScheduleAlwaysOn(*state); state->dataWaterCoils->WaterCoil(1).Name = "Water Cooling Coil"; state->dataWaterCoils->WaterCoil(1).WaterCoilType = DataPlant::PlantEquipmentType::CoilWaterCooling; state->dataWaterCoils->WaterCoil(1).WaterCoilModel = WaterCoils::CoilModel::CoolingSimple; @@ -5752,9 +5953,8 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_CalcUnitaryCoolingSystem) loopsidebranch.Comp.allocate(1); } state->dataPlnt->PlantLoop(1).Name = "WaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "FluidWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterCooling; @@ -5991,6 +6191,7 @@ Curve:Biquadratic, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors @@ -6054,12 +6255,12 @@ Curve:Biquadratic, state->dataHeatBalFanSys->TempControlType.allocate(1); state->dataHeatBalFanSys->TempControlTypeRpt.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); // UnitarySystem does not care (or look at) if Tstat is in deadband // This line tests case where other zone equipment changes deadband status state->dataZoneEnergyDemand->CurDeadBandOrSetback(1) = true; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; + Sched::GetSchedule(*state, "FANANDCOILAVAILSCHED")->currentVal = 1.0; // Enable schedule without calling schedule manager state->dataGlobal->BeginEnvrnFlag = true; state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); // initialize RhoAir state->dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail = thisSys->m_MaxCoolAirVolFlow * state->dataEnvrn->StdRhoAir; @@ -6637,6 +6838,7 @@ Curve:Biquadratic, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors @@ -6999,6 +7201,7 @@ Curve:Biquadratic, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors @@ -7067,9 +7270,10 @@ Curve:Biquadratic, state->dataHeatBalFanSys->TempControlType.allocate(1); state->dataHeatBalFanSys->TempControlTypeRpt.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // FanAndCoilAvailSchedule - state->dataScheduleMgr->Schedule(2).CurrentValue = 1.0; // ContinuousFanSchedule + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; + Sched::GetSchedule(*state, "FANANDCOILAVAILSCHED")->currentVal = 1.0; + Sched::GetSchedule(*state, "FANANDCOILAVAILSCHED")->currentVal = 1.0; + Sched::GetSchedule(*state, "CONTINUOUSFANSCHEDULE")->currentVal = 1.0; // ContinuousFanSchedule state->dataGlobal->BeginEnvrnFlag = true; state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); // initialize RhoAir state->dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail = thisSys->m_MaxCoolAirVolFlow * state->dataEnvrn->StdRhoAir; @@ -7495,6 +7699,7 @@ Curve:Biquadratic, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors @@ -7560,8 +7765,8 @@ Curve:Biquadratic, state->dataHeatBalFanSys->TempControlType.allocate(1); state->dataHeatBalFanSys->TempControlTypeRpt.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; + Sched::GetSchedule(*state, "FANANDCOILAVAILSCHED")->currentVal = 1.0; state->dataGlobal->BeginEnvrnFlag = true; state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); // initialize RhoAir state->dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail = thisSys->m_MaxCoolAirVolFlow * state->dataEnvrn->StdRhoAir; @@ -7829,6 +8034,7 @@ Curve:Biquadratic, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors @@ -8012,6 +8218,7 @@ Curve:Biquadratic, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors @@ -8457,9 +8664,9 @@ OutdoorAir:NodeList, ASSERT_TRUE(process_idf(idf_objects)); // read idf objects - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors @@ -9223,8 +9430,8 @@ Curve:Biquadratic, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); - SimulationManager::GetProjectData(*state); createFacilityElectricPowerServiceObject(*state); state->dataGlobal->BeginSimFlag = true; state->dataGlobal->DoingSizing = true; @@ -9370,7 +9577,6 @@ Curve:Biquadratic, TEST_F(EnergyPlusFixture, UnitarySystemModel_WaterToAirHeatPump_LoadControl) { - bool ErrorsFound(false); bool FirstHVACIteration(false); Real64 Qsens_sys(0.0); // UnitarySystem delivered sensible capacity wrt zone @@ -9685,6 +9891,7 @@ Curve:QuadLinear, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors @@ -9706,18 +9913,16 @@ Curve:QuadLinear, loopsidebranch.Comp.allocate(1); } state->dataPlnt->PlantLoop(1).Name = "ChilledWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "FluidWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = "SYS 1 HEAT PUMP COOLING MODE"; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWAHPCoolingEquationFit; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).NodeNumIn = 6; state->dataPlnt->PlantLoop(2).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(2).FluidName = "FluidWaterLoop"; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = "SYS 1 HEAT PUMP HEATING MODE"; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWAHPHeatingEquationFit; @@ -9780,8 +9985,8 @@ Curve:QuadLinear, state->dataHeatBalFanSys->TempControlType.allocate(1); state->dataHeatBalFanSys->TempControlTypeRpt.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; + Sched::GetSchedule(*state, "FANANDCOILAVAILSCHED")->currentVal = 1.0; state->dataGlobal->BeginEnvrnFlag = true; state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); // initialize RhoAir state->dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail = thisSys->m_DesignFanVolFlowRate * state->dataEnvrn->StdRhoAir; @@ -10026,6 +10231,7 @@ Schedule:Compact, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors @@ -10048,9 +10254,8 @@ Schedule:Compact, loopsidebranch.Comp.allocate(1); } state->dataPlnt->PlantLoop(1).Name = "ChilledWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "FluidWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = "WATER COOLING COIL"; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterCooling; @@ -10058,9 +10263,8 @@ Schedule:Compact, state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).NodeNumOut = 10; state->dataPlnt->PlantLoop(2).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(2).FluidName = "FluidWaterLoop"; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = "WATER HEATING COIL"; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; @@ -10123,10 +10327,10 @@ Schedule:Compact, state->dataHeatBalFanSys->TempControlType.allocate(1); state->dataHeatBalFanSys->TempControlTypeRpt.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; // fill the schedule values - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // availability - state->dataScheduleMgr->Schedule(2).CurrentValue = 1.0; // constant fan + Sched::GetSchedule(*state, "FANANDCOILAVAILSCHED")->currentVal = 1.0; // availability + Sched::GetSchedule(*state, "CONTINUOUSFANSCHEDULE")->currentVal = 1.0; // constant fan state->dataGlobal->BeginEnvrnFlag = true; state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); // initialize RhoAir state->dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail = thisSys->m_DesignFanVolFlowRate * state->dataEnvrn->StdRhoAir; @@ -11086,8 +11290,8 @@ Schedule:Compact, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); - SimulationManager::GetProjectData(*state); createFacilityElectricPowerServiceObject(*state); state->dataGlobal->BeginSimFlag = true; state->dataGlobal->DoingSizing = true; @@ -11870,6 +12074,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_MultiSpeedCoils_SingleMode) }); ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); state->dataEnvrn->OutDryBulbTemp = 35.0; // initialize weather before input processing state->dataEnvrn->OutHumRat = 0.1; @@ -11927,7 +12132,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_MultiSpeedCoils_SingleMode) state->dataZoneEnergyDemand->ZoneSysMoistureDemand(thisSys->ControlZoneNum).SequencedOutputRequiredToDehumidSP.allocate(1); state->dataHeatBalFanSys->TempControlType.allocate(1); state->dataHeatBalFanSys->TempControlTypeRpt.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; InletNode = thisSys->AirInNode; OutletNode = thisSys->AirOutNode; @@ -11950,7 +12155,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_MultiSpeedCoils_SingleMode) thisSys->m_ZoneInletNode = state->dataZoneEquip->ZoneEquipConfig(1).InletNode(1); - state->dataScheduleMgr->Schedule(thisSys->m_SysAvailSchedPtr).CurrentValue = 1.0; + thisSys->m_sysAvailSched->currentVal = 1.0; state->dataSize->CurSysNum = 1; state->dataSize->UnitarySysEqSizing.allocate(1); @@ -13100,8 +13305,8 @@ Curve:Biquadratic, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); - SimulationManager::GetProjectData(*state); createFacilityElectricPowerServiceObject(*state); state->dataGlobal->BeginSimFlag = true; @@ -13215,6 +13420,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_SizingWithFans) )IDF"; ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); Fans::GetFanInput(*state); @@ -13257,7 +13463,6 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_SizingWithFans) state->dataSize->NumSysSizInput = 1; state->dataEnvrn->StdBaroPress = 101325.0; - Psychrometrics::InitializePsychRoutines(*state); // Need this to prevent crash in Sizers state->dataSize->UnitarySysEqSizing.allocate(1); @@ -13457,6 +13662,7 @@ Coil:Heating:Electric, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); @@ -13603,6 +13809,7 @@ Coil:Heating:Electric, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); @@ -13726,6 +13933,7 @@ Coil:Heating:Electric, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); @@ -13851,6 +14059,7 @@ Coil:Heating:Electric, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); @@ -13968,6 +14177,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_FractionOfAutoSizedCoolingValueTes )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); // call the UnitarySystem factory bool ErrorsFound = false; @@ -13984,6 +14194,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_FractionOfAutoSizedCoolingValueTes state->dataSize->ZoneSizingRunDone = true; // DataSizing::NumPltSizInput = 2; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; @@ -13992,6 +14203,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_FractionOfAutoSizedCoolingValueTes state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterCooling; @@ -14117,6 +14329,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_FlowPerCoolingCapacityTest) )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); // call the UnitarySystem factory bool ErrorsFound = false; @@ -14132,6 +14345,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_FlowPerCoolingCapacityTest) OutputReportPredefined::SetPredefinedTables(*state); state->dataSize->ZoneSizingRunDone = true; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; @@ -14140,6 +14354,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_FlowPerCoolingCapacityTest) state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterCooling; @@ -14291,6 +14506,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_getUnitarySystemInputDataTest) )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); // call the UnitarySystem factory bool ErrorsFound = false; @@ -14307,13 +14523,13 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_getUnitarySystemInputDataTest) EXPECT_ENUM_EQ(UnitarySys::UnitarySysCtrlType::Load, thisSys->m_ControlType); // checks control type EXPECT_ENUM_EQ(UnitarySys::DehumCtrlType::None, thisSys->m_DehumidControlType_Num); // checks Dehumidification Control type EXPECT_EQ(Util::FindItemInList("EAST ZONE", state->dataHeatBal->Zone), thisSys->ControlZoneNum); // checks zone ID - EXPECT_EQ(ScheduleManager::ScheduleAlwaysOn, thisSys->m_SysAvailSchedPtr); // checks availability schedule name + EXPECT_EQ(Sched::GetScheduleAlwaysOn(*state), thisSys->m_sysAvailSched); // checks availability schedule name EXPECT_EQ("NODE 29", state->dataLoopNodes->NodeID(thisSys->AirInNode)); // checks air inlet node name EXPECT_EQ("NODE 30", state->dataLoopNodes->NodeID(thisSys->AirOutNode)); // checks air outlet node name EXPECT_EQ((int)HVAC::FanType::OnOff, (int)thisSys->m_FanType); // checks fan object type "FAN:ONOFF" EXPECT_EQ("SUPPLY FAN", thisSys->m_FanName); // checks fan object name EXPECT_EQ((int)HVAC::FanPlace::DrawThru, (int)thisSys->m_FanPlace); // checks fan placement, "DrawThrough" - EXPECT_EQ(0, thisSys->m_FanOpModeSchedPtr); // checks Supply Air Fan Operating Mode Schedule Name + EXPECT_EQ(nullptr, thisSys->m_fanOpModeSched); // checks Supply Air Fan Operating Mode Schedule Name EXPECT_EQ("COIL:HEATING:WATER", thisSys->m_HeatingCoilTypeName); // checks heating coil object type EXPECT_EQ("WATER HEATING COIL", thisSys->m_HeatingCoilName); // checks heating coil object type EXPECT_EQ(1, thisSys->m_HeatingSizingRatio); // checks dx heating coil sizing ratio @@ -14553,6 +14769,7 @@ Curve:Biquadratic, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors @@ -14576,11 +14793,10 @@ Curve:Biquadratic, EXPECT_FALSE(ErrorsFound); // expect no errors // Issue 7777 - std::string const error_string = delimited_string({ - " ** Warning ** getUnitarySystemInputData AirLoopHVAC:UnitarySystem=\"UNITARY SYSTEM MODEL\", invalid Availability Schedule Name = " - "FANANDCOILAVAILTEST", - " ** ~~~ ** Set the default as Always On. Simulation continues.", - }); + std::string const error_string = + delimited_string({" ** Warning ** UnitarySys::processInputSpec: AirLoopHVAC:UnitarySystem = UNITARY SYSTEM MODEL", + " ** ~~~ ** Availability Schedule Name = FANANDCOILAVAILTEST, item not found, Set the default as Always On. " + "Simulation continues. will be used."}); EXPECT_TRUE(compare_err_stream(error_string, true)); } @@ -14789,6 +15005,7 @@ Curve:Biquadratic, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound(false); HeatBalanceManager::GetZoneData(*state, ErrorsFound); @@ -16197,10 +16414,10 @@ Dimensionless; !- Output Unit Type )IDF"; ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + bool ErrorsFound = false; // Read objects - HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); - EXPECT_FALSE(ErrorsFound); HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); Material::GetWindowGlassSpectralData(*state, ErrorsFound); @@ -16217,18 +16434,17 @@ Dimensionless; !- Output Unit Type SurfaceGeometry::GetSurfaceData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - ScheduleManager::ProcessScheduleInput(*state); // read schedules - - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state->dataScheduleMgr->Schedule(6).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state->dataScheduleMgr->Schedule(7).CurrentValue = 4.0; // Enable schedule without calling schedule manager + Sched::GetSchedule(*state, "HVACTEMPLATE-ALWAYS 1")->currentVal = 1.0; // Enable schedule without calling schedule manager + Sched::GetSchedule(*state, "LIGHTS-1")->currentVal = 1.0; // Enable schedule without calling schedule manager + auto *equipSched = Sched::GetSchedule(*state, "EQUIP-1"); + equipSched->currentVal = 4.0; // Enable schedule without calling schedule manager state->dataEnvrn->OutBaroPress = 101325; ZoneEquipmentManager::GetZoneEquipment(*state); SimAirServingZones::GetAirPathData(*state); - state->dataScheduleMgr->Schedule(7).MinValue = 4.0; // Enable schedule without calling schedule manager - state->dataScheduleMgr->Schedule(7).MaxValue = 4.0; // Enable schedule without calling schedule manager - state->dataScheduleMgr->Schedule(7).MaxMinSet = true; + equipSched->minVal = 4.0; // Enable schedule without calling schedule manager + equipSched->maxVal = 4.0; // Enable schedule without calling schedule manager + equipSched->isMinMaxSet = true; ZoneTempPredictorCorrector::GetZoneAirSetPoints(*state); std::string compName = "SYS 1 FURNACE DX COOL UNITARY SYSTEM"; @@ -16290,7 +16506,7 @@ Dimensionless; !- Output Unit Type state->dataZoneEnergyDemand->CurDeadBandOrSetback(1) = false; state->dataHeatBalFanSys->TempControlType.allocate(1); state->dataHeatBalFanSys->TempControlTypeRpt.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; auto &mixedAirNode = state->dataLoopNodes->Node(state->dataMixedAir->OAMixer(1).MixNode); mixedAirNode.Temp = 23.822; // 24C db mixedAirNode.HumRat = 0.0145946; // 17C wb @@ -16317,7 +16533,7 @@ Dimensionless; !- Output Unit Type ZoneEquipFlag, SenOutput, LatOutput); - auto &coilCoolingDX = state->dataCoilCooingDX->coilCoolingDXs[0]; + auto &coilCoolingDX = state->dataCoilCoolingDX->coilCoolingDXs[0]; EXPECT_EQ(coilCoolingDX.performance.OperatingMode, 3); EXPECT_EQ(coilCoolingDX.performance.ModeRatio, 1.0); EXPECT_NEAR(thisSys->CoilSHR, thisSys->LoadSHR, 0.001); @@ -16716,6 +16932,7 @@ Curve:Biquadratic, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); bool ErrorsFound(false); HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data @@ -16997,6 +17214,7 @@ Curve:Biquadratic, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; @@ -17305,6 +17523,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiSpeedDXCoilsNoLoadFlowRateSiz )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; @@ -17699,7 +17918,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiSpeedDXCoilsDirectSolutionTes )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects - + state->init_state(*state); bool ErrorsFound = false; std::string compName = "UNITARY SYSTEM MODEL"; @@ -17737,7 +17956,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiSpeedDXCoilsDirectSolutionTes state->dataZoneEnergyDemand->CurDeadBandOrSetback(1) = false; state->dataHeatBalFanSys->TempControlType.allocate(1); state->dataHeatBalFanSys->TempControlTypeRpt.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataLoopNodes->Node(7).FluidType = DataLoopNode::NodeFluidType::Air; state->dataLoopNodes->Node(7).Temp = 24.0; // 24C db state->dataLoopNodes->Node(7).HumRat = 0.01522; // 17C wb @@ -17912,7 +18131,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiSpeedDXCoilsDirectSolutionTes TEST_F(EnergyPlusFixture, UnitarySystemModel_reportUnitarySystemAncillaryPowerTest) { state->dataHVACGlobal->TimeStepSys = 0.25; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->dataLoopNodes->Node.allocate(2); UnitarySys thisSys; thisSys.AirInNode = 1; @@ -18247,6 +18466,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_CheckBadInputOutputNodes) )IDF"; ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; @@ -18272,13 +18492,13 @@ AirLoopHVAC:UnitarySystem, Setpoint, !- Control Type East Zone, !- Controlling Zone or Thermostat Location None, !- Dehumidification Control Type - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Zone Exhaust Node, !- Air Inlet Node Name Zone 2 Inlet Node, !- Air Outlet Node Name Fan:OnOff, !- Supply Fan Object Type Supply Fan 1, !- Supply Fan Name BlowThrough, !- Fan Placement - AlwaysZero, !- Supply Air Fan Operating Mode Schedule Name + Constant-0.0, !- Supply Air Fan Operating Mode Schedule Name , !- Heating Coil Object Type , !- Heating Coil Name , !- DX Heating Coil Sizing Ratio @@ -18311,7 +18531,7 @@ AirLoopHVAC:UnitarySystem, Fan:OnOff, Supply Fan 1, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name 0.7, !- Fan Total Efficiency 600.0, !- Pressure Rise{ Pa } autosize, !- Maximum Flow Rate{ m3 / s } @@ -18347,20 +18567,6 @@ Coil:Cooling:DX:SingleSpeed, ScheduleTypeLimits, Any Number; !- Name -Schedule:Compact, - AlwaysOne, !- Name - Any Number, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, 1.0; !- Field 3 - -Schedule:Compact, - AlwaysZero, !- Name - Any Number, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, 0.0; !- Field 3 - Schedule:Compact, Always 20C, !- Name Any Number, !- Schedule Type Limits Name @@ -18403,21 +18609,20 @@ Curve:Biquadratic, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects - + state->init_state(*state); // call the UnitarySystem factory std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; UnitarySystems::UnitarySys::factory(*state, HVAC::UnitarySysType::Unitary_AnyCoilType, compName, zoneEquipment, 0); UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; state->dataZoneEquip->ZoneEquipInputsFilled = true; // indicate zone data is available thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above - std::string const error_string = - delimited_string({" ** Severe ** AirLoopHVAC:UnitarySystem = UNITARY SYSTEM MODEL\n ** ~~~ ** For FAN:ONOFF = SUPPLY FAN 1\n ** " - "~~~ ** Fan operating mode must be continuous (fan operating mode schedule values > 0).\n ** ~~~ ** Error found in " - "Supply Air Fan Operating Mode Schedule Name ALWAYSZERO\n ** ~~~ ** ...schedule values must be (>0., <=1.)"}); + std::string const error_string = delimited_string( + {" ** Severe ** UnitarySys::processInputSpec: AirLoopHVAC:UnitarySystem = UNITARY SYSTEM MODEL", + " ** ~~~ ** Supply Air Fan Operating Mode Schedule Name = CONSTANT-0.0, schedule contains values that are <= 0 and/or > 1"}); EXPECT_TRUE(compare_err_stream(error_string, true)); } @@ -18431,7 +18636,7 @@ AirLoopHVAC:UnitarySystem, Setpoint, !- Control Type East Zone, !- Controlling Zone or Thermostat Location None, !- Dehumidification Control Type - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Zone Exhaust Node, !- Air Inlet Node Name Zone 2 Inlet Node, !- Air Outlet Node Name Fan:OnOff, !- Supply Fan Object Type @@ -18480,7 +18685,7 @@ AirLoopHVAC:UnitarySystem, Fan:OnOff, Supply Fan 1, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name 0.7, !- Fan Total Efficiency 600.0, !- Pressure Rise{ Pa } autosize, !- Maximum Flow Rate{ m3 / s } @@ -18491,7 +18696,7 @@ Fan:OnOff, Coil:Heating:Fuel, Fuel Heating Coil, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name NaturalGas, !- Fuel Type 1.0, !- Gas Burner Efficiency autosize, !- Nominal Capacity @@ -18501,13 +18706,6 @@ Coil:Heating:Fuel, ScheduleTypeLimits, Any Number; !- Name -Schedule:Compact, - AlwaysOne, !- Name - Any Number, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, 1.0; !- Field 3 - Schedule:Compact, Always 18C, !- Name Any Number, !- Schedule Type Limits Name @@ -18532,7 +18730,7 @@ Curve:Quadratic, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects - + state->init_state(*state); std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; bool FirstHVACIteration = true; @@ -18585,15 +18783,11 @@ Curve:Quadratic, state->dataLoopNodes->Node(1).HumRat = 0.00922; // 17C wb state->dataLoopNodes->Node(1).Enthalpy = 47597.03; // www.sugartech.com/psychro/index.php - ScheduleManager::ProcessScheduleInput(*state); // read schedules - // Heating coil air inlet node = 3 state->dataLoopNodes->Node(3).MassFlowRateMax = thisSys->m_DesignMassFlowRate; // max at fan outlet so fan won't limit flow // Heating coil air outlet node = 2 state->dataLoopNodes->Node(2).TempSetPoint = 25.0; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // Heating mode @@ -18636,7 +18830,7 @@ AirLoopHVAC:UnitarySystem, Setpoint, !- Control Type East Zone, !- Controlling Zone or Thermostat Location None, !- Dehumidification Control Type - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Zone Exhaust Node, !- Air Inlet Node Name Zone 2 Inlet Node, !- Air Outlet Node Name Fan:OnOff, !- Supply Fan Object Type @@ -18685,7 +18879,7 @@ AirLoopHVAC:UnitarySystem, Fan:OnOff, Supply Fan 1, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name 0.7, !- Fan Total Efficiency 600.0, !- Pressure Rise{ Pa } autosize, !- Maximum Flow Rate{ m3 / s } @@ -18696,7 +18890,7 @@ Fan:OnOff, Coil:Heating:Electric, Electric Heating Coil, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name 1.0, !- Efficiency autosize, !- Nominal Capacity Heating Coil Air Inlet Node, !- Air Inlet Node Name @@ -18705,13 +18899,6 @@ Coil:Heating:Electric, ScheduleTypeLimits, Any Number; !- Name -Schedule:Compact, - AlwaysOne, !- Name - Any Number, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, 1.0; !- Field 3 - Schedule:Compact, Always 18C, !- Name Any Number, !- Schedule Type Limits Name @@ -18736,7 +18923,7 @@ Curve:Quadratic, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects - + state->init_state(*state); std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; bool FirstHVACIteration = true; @@ -18789,15 +18976,11 @@ Curve:Quadratic, state->dataLoopNodes->Node(1).HumRat = 0.00922; // 17C wb state->dataLoopNodes->Node(1).Enthalpy = 47597.03; // www.sugartech.com/psychro/index.php - ScheduleManager::ProcessScheduleInput(*state); // read schedules - // Heating coil air inlet node = 3 state->dataLoopNodes->Node(3).MassFlowRateMax = thisSys->m_DesignMassFlowRate; // max at fan outlet so fan won't limit flow // Heating coil air outlet node = 2 state->dataLoopNodes->Node(2).TempSetPoint = 25.0; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // Heating mode @@ -18830,7 +19013,7 @@ AirLoopHVAC:UnitarySystem, Setpoint, !- Control Type East Zone, !- Controlling Zone or Thermostat Location None, !- Dehumidification Control Type - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Zone Exhaust Node, !- Air Inlet Node Name Zone 2 Inlet Node, !- Air Outlet Node Name Fan:OnOff, !- Supply Fan Object Type @@ -18879,7 +19062,7 @@ AirLoopHVAC:UnitarySystem, Fan:OnOff, Supply Fan 1, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name 0.7, !- Fan Total Efficiency 600.0, !- Pressure Rise{ Pa } autosize, !- Maximum Flow Rate{ m3 / s } @@ -18890,7 +19073,7 @@ Fan:OnOff, Coil:Heating:Desuperheater, Desuperheater Heating Coil, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name 0.3, !- Heat Reclaim Recovery Efficiency Heating Coil Air Inlet Node, !- Coil Air Inlet Node Name Zone 2 Inlet Node, !- Coil Air Outlet Node Name @@ -18902,13 +19085,6 @@ Coil:Heating:Desuperheater, ScheduleTypeLimits, Any Number; !- Name -Schedule:Compact, - AlwaysOne, !- Name - Any Number, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, 1.0; !- Field 3 - Schedule:Compact, Always 18C, !- Name Any Number, !- Schedule Type Limits Name @@ -19037,7 +19213,7 @@ Schedule:Compact, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects - + state->init_state(*state); state->dataZoneEquip->ZoneEquipInputsFilled = true; InternalHeatGains::ManageInternalHeatGains(*state, true); std::string compName = "UNITARY SYSTEM MODEL"; @@ -19097,16 +19273,12 @@ Schedule:Compact, state->dataLoopNodes->Node(thisSys->AirInNode).HumRat = 0.00922; // 17C wb state->dataLoopNodes->Node(thisSys->AirInNode).Enthalpy = 47597.03; // www.sugartech.com/psychro/index.php - ScheduleManager::ProcessScheduleInput(*state); // read schedules - // Heating coil air inlet node = 4 state->dataLoopNodes->Node(thisSys->HeatCoilInletNodeNum).MassFlowRateMax = thisSys->m_DesignMassFlowRate; // max at fan outlet so fan won't limit flow // Heating coil air outlet node = 5 state->dataLoopNodes->Node(thisSys->HeatCoilOutletNodeNum).TempSetPoint = 25.0; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // Heating mode @@ -19166,6 +19338,7 @@ TEST_F(EnergyPlusFixture, WaterCoil_getCoilWaterSystemInputDataTest) )IDF"; EXPECT_TRUE(process_idf(idf_objects, false)); + state->init_state(*state); bool zoneEquipment = false; state->dataZoneEquip->ZoneEquipInputsFilled = true; @@ -19253,6 +19426,7 @@ TEST_F(EnergyPlusFixture, DetailedWaterCoil_getCoilWaterSystemInputDataTest) )IDF"; EXPECT_TRUE(process_idf(idf_objects, false)); + state->init_state(*state); bool zoneEquipment = false; state->dataZoneEquip->ZoneEquipInputsFilled = true; @@ -19355,6 +19529,7 @@ TEST_F(EnergyPlusFixture, HXAssistedWaterCoil_getCoilWaterSystemInputDataTest) )IDF"; EXPECT_TRUE(process_idf(idf_objects, false)); + state->init_state(*state); bool zoneEquipment = false; state->dataZoneEquip->ZoneEquipInputsFilled = true; @@ -19433,6 +19608,7 @@ TEST_F(EnergyPlusFixture, CoilSystemCoolingWater_ControlStatusTest) )IDF"; EXPECT_TRUE(process_idf(idf_objects, false)); + state->init_state(*state); bool zoneEquipment = false; state->dataZoneEquip->ZoneEquipInputsFilled = true; @@ -19466,7 +19642,6 @@ TEST_F(EnergyPlusFixture, CoilSystemCoolingWater_ControlStatusTest) Real64 ColdWaterMassFlowRate(1.0); state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.0; - Psychrometrics::InitializePsychRoutines(*state); thisSys.m_MultiOrVarSpeedHeatCoil = false; thisSys.m_MultiOrVarSpeedCoolCoil = false; @@ -19474,7 +19649,7 @@ TEST_F(EnergyPlusFixture, CoilSystemCoolingWater_ControlStatusTest) thisSys.m_HeatMassFlowRate.resize(1); thisSys.m_CoolMassFlowRate.resize(1); thisSys.m_LastMode = UnitarySystems::CoolingMode; - thisSys.m_FanAvailSchedPtr = ScheduleManager::ScheduleAlwaysOn; + thisSys.m_fanAvailSched = Sched::GetScheduleAlwaysOn(*state); thisSys.m_FanOpMode = HVAC::FanOp::Cycling; // cooling load @@ -19498,7 +19673,7 @@ TEST_F(EnergyPlusFixture, CoilSystemCoolingWater_ControlStatusTest) state->dataWaterCoils->CheckEquipName.allocate(1); state->dataWaterCoils->GetWaterCoilsInputFlag = false; - state->dataWaterCoils->WaterCoil(1).SchedPtr = ScheduleManager::ScheduleAlwaysOn; + state->dataWaterCoils->WaterCoil(1).availSched = Sched::GetScheduleAlwaysOn(*state); state->dataWaterCoils->WaterCoil(1).WaterCoilType = DataPlant::PlantEquipmentType::CoilWaterCooling; state->dataWaterCoils->WaterCoil(1).WaterCoilModel = WaterCoils::CoilModel::CoolingSimple; state->dataWaterCoils->WaterCoil(1).DesAirVolFlowRate = 1.0; @@ -19555,9 +19730,8 @@ TEST_F(EnergyPlusFixture, CoilSystemCoolingWater_ControlStatusTest) loopsidebranch.Comp.allocate(1); } state->dataPlnt->PlantLoop(1).Name = "WaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "FluidWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterCooling; @@ -19680,6 +19854,7 @@ TEST_F(EnergyPlusFixture, CoilSystemCoolingWater_CalcTest) )IDF"; EXPECT_TRUE(process_idf(idf_objects, false)); + state->init_state(*state); bool zoneEquipment = false; state->dataZoneEquip->ZoneEquipInputsFilled = true; @@ -19715,7 +19890,6 @@ TEST_F(EnergyPlusFixture, CoilSystemCoolingWater_CalcTest) Real64 ColdWaterMassFlowRate(1.0); state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.0; - Psychrometrics::InitializePsychRoutines(*state); thisSys.m_MultiOrVarSpeedHeatCoil = false; thisSys.m_MultiOrVarSpeedCoolCoil = false; @@ -19726,7 +19900,7 @@ TEST_F(EnergyPlusFixture, CoilSystemCoolingWater_CalcTest) thisSys.m_LastMode = UnitarySystems::CoolingMode; thisSys.MaxNoCoolHeatAirMassFlow = 0.2; thisSys.m_NoLoadAirFlowRateRatio = 0.2; - thisSys.m_FanAvailSchedPtr = ScheduleManager::ScheduleAlwaysOn; + thisSys.m_fanAvailSched = Sched::GetScheduleAlwaysOn(*state); thisSys.m_FanOpMode = HVAC::FanOp::Cycling; // cooling load @@ -19750,7 +19924,7 @@ TEST_F(EnergyPlusFixture, CoilSystemCoolingWater_CalcTest) state->dataWaterCoils->CheckEquipName.allocate(1); state->dataWaterCoils->GetWaterCoilsInputFlag = false; - state->dataWaterCoils->WaterCoil(1).SchedPtr = ScheduleManager::ScheduleAlwaysOn; + state->dataWaterCoils->WaterCoil(1).availSched = Sched::GetScheduleAlwaysOn(*state); state->dataWaterCoils->WaterCoil(1).WaterCoilType = DataPlant::PlantEquipmentType::CoilWaterCooling; state->dataWaterCoils->WaterCoil(1).WaterCoilModel = WaterCoils::CoilModel::CoolingSimple; state->dataWaterCoils->WaterCoil(1).DesAirVolFlowRate = 1.0; @@ -19807,9 +19981,8 @@ TEST_F(EnergyPlusFixture, CoilSystemCoolingWater_CalcTest) loopsidebranch.Comp.allocate(1); } state->dataPlnt->PlantLoop(1).Name = "WaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "FluidWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterCooling; @@ -19947,6 +20120,7 @@ TEST_F(EnergyPlusFixture, CoilSystemCoolingWater_HeatRecoveryLoop) )IDF"; EXPECT_TRUE(process_idf(idf_objects, false)); + state->init_state(*state); bool zoneEquipment = false; state->dataZoneEquip->ZoneEquipInputsFilled = true; @@ -19982,7 +20156,6 @@ TEST_F(EnergyPlusFixture, CoilSystemCoolingWater_HeatRecoveryLoop) Real64 ColdWaterMassFlowRate(1.0); state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.0; - Psychrometrics::InitializePsychRoutines(*state); thisSys.m_MultiOrVarSpeedHeatCoil = false; thisSys.m_MultiOrVarSpeedCoolCoil = false; @@ -19993,7 +20166,7 @@ TEST_F(EnergyPlusFixture, CoilSystemCoolingWater_HeatRecoveryLoop) thisSys.m_LastMode = UnitarySystems::CoolingMode; thisSys.MaxNoCoolHeatAirMassFlow = 0.2; thisSys.m_NoLoadAirFlowRateRatio = 0.2; - thisSys.m_FanAvailSchedPtr = ScheduleManager::ScheduleAlwaysOn; + thisSys.m_fanAvailSched = Sched::GetScheduleAlwaysOn(*state); thisSys.m_FanOpMode = HVAC::FanOp::Cycling; // cooling load @@ -20018,7 +20191,7 @@ TEST_F(EnergyPlusFixture, CoilSystemCoolingWater_HeatRecoveryLoop) state->dataWaterCoils->CheckEquipName.allocate(2); state->dataWaterCoils->GetWaterCoilsInputFlag = false; for (int i = 1; i <= 2; ++i) { - state->dataWaterCoils->WaterCoil(i).SchedPtr = ScheduleManager::ScheduleAlwaysOn; + state->dataWaterCoils->WaterCoil(i).availSched = Sched::GetScheduleAlwaysOn(*state); state->dataWaterCoils->WaterCoil(i).WaterCoilType = DataPlant::PlantEquipmentType::CoilWaterCooling; state->dataWaterCoils->WaterCoil(i).WaterCoilModel = WaterCoils::CoilModel::CoolingSimple; state->dataWaterCoils->WaterCoil(i).DesAirVolFlowRate = 1.0; @@ -20078,9 +20251,8 @@ TEST_F(EnergyPlusFixture, CoilSystemCoolingWater_HeatRecoveryLoop) loopsidebranch.Comp.allocate(loopsidebranch.TotalComponents); } state->dataPlnt->PlantLoop(1).Name = "WaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "FluidWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterCooling; @@ -20187,7 +20359,8 @@ TEST_F(EnergyPlusFixture, CoilSystemCoolingWater_HeatRecoveryLoop) TEST_F(AirloopUnitarySysTest, WSHPVariableSpeedCoilSizing) { - FluidProperties::GetFluidPropertiesData(*state); + state->init_state(*state); + // test that correct CapFT inputs are used for the WSHP cooling coil state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); @@ -20211,15 +20384,11 @@ TEST_F(AirloopUnitarySysTest, WSHPVariableSpeedCoilSizing) loopsidebranch.Comp.allocate(1); } state->dataPlnt->PlantLoop(1).Name = "ColdWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "FluidWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(2).FluidName = "FluidWaterLoop"; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); // set up sizing data state->dataSize->FinalSysSizing(1).OutTempAtCoolPeak = 0.0; @@ -20368,7 +20537,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_LowerSpeedFlowSizingTest) Load, !- Control Type East Zone, !- Controlling Zone or Thermostat Location None, !- Dehumidification Control Type - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Zone Exhaust Node, !- Air Inlet Node Name DX ClgCoil Air Outlet Node, !- Air Outlet Node Name Fan:OnOff, !- Supply Fan Object Type @@ -20417,7 +20586,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_LowerSpeedFlowSizingTest) Fan:OnOff, Zone Supply Air Fan, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name 0.5, !- Fan Total Efficiency 500.0, !- Pressure Rise{ Pa } autosize, !- Maximum Flow Rate{ m3 / s } @@ -20429,13 +20598,6 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_LowerSpeedFlowSizingTest) ScheduleTypeLimits, Any Number; !- Name - Schedule:Compact, - AlwaysOne, !- Name - Any Number, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, 1.0; !- Field 3 - Coil:Cooling:DX, DX ClgCoil, !- Name DX ClgCoil Air Inlet Node, !- Evaporator Inlet Node Name @@ -20578,13 +20740,14 @@ Curve:Biquadratic, EIRFT, 1, 0, 0, 0, 0, 0, 0, 100, 0, 100, , , Temperature, Tem )IDF"; ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); std::string UnitarySysName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; UnitarySystems::UnitarySys::factory(*state, HVAC::UnitarySysType::Unitary_AnyCoilType, UnitarySysName, zoneEquipment, 0); UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; int coilIndex = CoilCoolingDX::factory(*state, "DX ClgCoil"); - auto &this_dx_clg_coil = state->dataCoilCooingDX->coilCoolingDXs[coilIndex]; + auto &this_dx_clg_coil = state->dataCoilCoolingDX->coilCoolingDXs[coilIndex]; state->dataZoneEquip->ZoneEquipInputsFilled = true; thisSys->getUnitarySystemInputData(*state, UnitarySysName, zoneEquipment, 0, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -20651,7 +20814,7 @@ AirLoopHVAC:UnitarySystem, Load, !- Control Type East Zone, !- Controlling Zone or Thermostat Location None, !- Dehumidification Control Type - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Zone Exhaust Node, !- Air Inlet Node Name Zone 2 Inlet Node, !- Air Outlet Node Name Fan:OnOff, !- Supply Fan Object Type @@ -20711,7 +20874,7 @@ UnitarySystemPerformance:Multispeed, Fan:OnOff, Supply Fan 1, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name 0.7, !- Fan Total Efficiency 600.0, !- Pressure Rise{ Pa } autosize, !- Maximum Flow Rate{ m3 / s } @@ -20784,13 +20947,6 @@ Coil:Cooling:DX:MultiSpeed, ScheduleTypeLimits, Any Number; !- Name -Schedule:Compact, - AlwaysOne, !- Name - Any Number, !- Schedule Type Limits Name - Through: 12/31, !- Field 1 - For: AllDays, !- Field 2 - Until: 24:00, 1.0; !- Field 3 - Schedule:Compact, Always 20C, !- Name Any Number, !- Schedule Type Limits Name @@ -20832,7 +20988,7 @@ Curve:Biquadratic, Coil:Heating:Gas:MultiStage, Gas Heating Coil, !- Name - AlwaysOne, !- Availability Schedule Name + Constant-1.0, !- Availability Schedule Name Heating Coil Air Inlet Node, !- Air Inlet Node Name Zone 2 Inlet Node, !- Air Outlet Node Name , !- Temperature Setpoint Node Name @@ -20849,6 +21005,7 @@ Coil:Heating:Gas:MultiStage, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); // call the UnitarySystem factory std::string compName = "UNITARY SYSTEM MODEL"; @@ -20892,7 +21049,7 @@ Coil:Heating:Gas:MultiStage, state->dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputReqToCoolSP = 0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputReqToHeatSP = 0; state->dataZoneEnergyDemand->ZoneSysMoistureDemand(ControlZoneNum).RemainingOutputReqToDehumidSP = 0; - state->dataHeatBalFanSys->TempControlType(ControlZoneNum) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(ControlZoneNum) = HVAC::SetptType::DualHeatCool; state->dataZoneCtrls->StageZoneLogic.allocate(1); state->dataZoneCtrls->StageZoneLogic(1) = true; @@ -20922,8 +21079,7 @@ Coil:Heating:Gas:MultiStage, state->dataLoopNodes->Node(4).MassFlowRateMax = thisSys->m_DesignMassFlowRate; // max at fan outlet so fan won't limit flow // Cooling coil air outlet node = 2 state->dataLoopNodes->Node(2).TempSetPoint = 17.0; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning + state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, @@ -20946,9 +21102,8 @@ Coil:Heating:Gas:MultiStage, state->dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputRequired = 1000.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).StageNum = 1; state->dataLoopNodes->Node(4).MassFlowRateMax = - thisSys->m_DesignMassFlowRate; // max at fan outlet so fan won't limit flow // Cooling coil air outlet node = 2 - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning + thisSys->m_DesignMassFlowRate; // max at fan outlet so fan won't limit flow // Cooling coil air outlet node = 2 + state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning thisSys->simulate(*state, thisSys->Name, @@ -20997,7 +21152,7 @@ TEST_F(EnergyPlusFixture, SetEconomizerStagingOperationSpeedTest) thisFan->totalEff = 0.7; thisFan->motorEff = 0.9; thisFan->motorInAirFrac = 1.0; - thisFan->availSchedNum = 0; + thisFan->availSched = Sched::GetScheduleAlwaysOff(*state); thisFan->minAirMassFlowRate = 0.0; thisFan->coeffs[0] = 0.0015302446; thisFan->coeffs[1] = 0.0052080574; @@ -21297,7 +21452,7 @@ ScheduleTypeLimits, percent; !- Unit Type Schedule:Constant, - Schedule_Constant_Humdifier, !- Name + Schedule_Constant_Humidifier, !- Name Percent, !- Schedule Type Limits Name 0; !- Hourly Value @@ -21309,6 +21464,7 @@ Schedule:Constant, )IDF"; ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors @@ -21324,9 +21480,8 @@ Schedule:Constant, state->dataZoneCtrls->HumidityControlZone(1).ControlName = "East Zone"; state->dataZoneCtrls->HumidityControlZone(1).ZoneName = "East Zone"; state->dataZoneCtrls->HumidityControlZone(1).ActualZoneNum = 1; - state->dataZoneCtrls->HumidityControlZone(1).HumidifyingSchedIndex = ScheduleManager::GetScheduleIndex(*state, "Schedule_Constant_Humdifier"); - state->dataZoneCtrls->HumidityControlZone(1).DehumidifyingSchedIndex = - ScheduleManager::GetScheduleIndex(*state, "Schedule_Constant_Dehumidifier"); + state->dataZoneCtrls->HumidityControlZone(1).humidifyingSched = Sched::GetSchedule(*state, "SCHEDULE_CONSTANT_HUMDIFIER"); + state->dataZoneCtrls->HumidityControlZone(1).dehumidifyingSched = Sched::GetSchedule(*state, "SCHEDULE_CONSTANT_DEHUMIDIFIER"); std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; @@ -21375,11 +21530,11 @@ Schedule:Constant, // set thermostat control type state->dataHeatBalFanSys->TempControlType.allocate(1); state->dataHeatBalFanSys->TempControlTypeRpt.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback(1) = true; state->dataGlobal->BeginEnvrnFlag = true; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; + Sched::GetSchedule(*state, "FANANDCOILAVAILSCHED")->currentVal = 1.0; state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); // initialize RhoAir state->dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail = thisSys->m_MaxCoolAirVolFlow * state->dataEnvrn->StdRhoAir; @@ -23759,6 +23914,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_MultiSpeedFanWSHP_Test) }); ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); bool FirstHVACIteration(false); diff --git a/tst/EnergyPlus/unit/UtilityRoutines.unit.cc b/tst/EnergyPlus/unit/UtilityRoutines.unit.cc index bdd7ed46878..444aa84f90e 100644 --- a/tst/EnergyPlus/unit/UtilityRoutines.unit.cc +++ b/tst/EnergyPlus/unit/UtilityRoutines.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/VAVDefMinMaxFlow.unit.cc b/tst/EnergyPlus/unit/VAVDefMinMaxFlow.unit.cc index d7ff4369e02..866867b230c 100644 --- a/tst/EnergyPlus/unit/VAVDefMinMaxFlow.unit.cc +++ b/tst/EnergyPlus/unit/VAVDefMinMaxFlow.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -76,7 +76,6 @@ using namespace EnergyPlus::DataSizing; using namespace EnergyPlus::DataZoneEquipment; using namespace EnergyPlus::HeatBalanceManager; using namespace EnergyPlus::Psychrometrics; -using namespace EnergyPlus::ScheduleManager; using namespace EnergyPlus::SimAirServingZones; using namespace EnergyPlus::SingleDuct; using namespace EnergyPlus::SizingManager; @@ -122,8 +121,6 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing1) bool ErrorsFound(false); - InitializePsychRoutines(*state); - std::string const idf_objects = delimited_string({ " Zone,", " SPACE3-1, !- Name", @@ -230,6 +227,7 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing1) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataSize->FinalZoneSizing.allocate(1); state->dataSize->FinalZoneSizing(1).allocateMemberArrays(96); @@ -244,8 +242,6 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing1) GetZoneAirDistribution(*state); // get zone air distribution objects GetZoneSizingInput(*state); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; GetZoneAirLoopEquipment(*state); GetSysInput(*state); state->dataSize->ZoneSizingRunDone = true; @@ -316,8 +312,6 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing2) bool ErrorsFound(false); - InitializePsychRoutines(*state); - std::string const idf_objects = delimited_string({ " Zone,", " SPACE3-1, !- Name", @@ -424,6 +418,7 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing2) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataSize->FinalZoneSizing.allocate(1); state->dataSize->FinalZoneSizing(1).allocateMemberArrays(96); @@ -438,8 +433,6 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing2) GetZoneAirDistribution(*state); // get zone air distribution objects GetZoneSizingInput(*state); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; GetZoneAirLoopEquipment(*state); GetSysInput(*state); state->dataSize->ZoneSizingRunDone = true; @@ -514,8 +507,6 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing3) bool ErrorsFound(false); - InitializePsychRoutines(*state); - std::string const idf_objects = delimited_string({ " Zone,", " SPACE3-1, !- Name", @@ -622,6 +613,7 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing3) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataSize->FinalZoneSizing.allocate(1); state->dataSize->FinalZoneSizing(1).allocateMemberArrays(96); @@ -635,8 +627,6 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing3) GetZoneAirDistribution(*state); // get zone air distribution objects GetZoneSizingInput(*state); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; GetZoneAirLoopEquipment(*state); GetSysInput(*state); state->dataSize->ZoneSizingRunDone = true; @@ -709,8 +699,6 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing4) bool ErrorsFound(false); - InitializePsychRoutines(*state); - std::string const idf_objects = delimited_string({ " Zone,", " SPACE3-1, !- Name", @@ -817,6 +805,7 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing4) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataSize->FinalZoneSizing.allocate(1); state->dataSize->FinalZoneSizing(1).allocateMemberArrays(96); @@ -830,8 +819,6 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing4) // GetZoneAirDistribution(*state); // get zone air distribution objects // GetZoneSizingInput(*state); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; GetZoneAirLoopEquipment(*state); GetSysInput(*state); state->dataSize->ZoneSizingRunDone = false; @@ -860,8 +847,6 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing5) bool ErrorsFound(false); - InitializePsychRoutines(*state); - std::string const idf_objects = delimited_string({ " Zone,", " SPACE3-1, !- Name", @@ -968,7 +953,7 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing5) }); ASSERT_TRUE(process_idf(idf_objects)); - + state->init_state(*state); state->dataSize->FinalZoneSizing.allocate(1); state->dataSize->FinalZoneSizing(1).allocateMemberArrays(96); state->dataSize->NumAirTerminalSizingSpec = 1; @@ -982,8 +967,6 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing5) GetZoneAirDistribution(*state); // get zone air distribution objects GetZoneSizingInput(*state); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; GetZoneAirLoopEquipment(*state); GetSysInput(*state); state->dataSize->ZoneSizingRunDone = true; diff --git a/tst/EnergyPlus/unit/VariableSpeedCoils.unit.cc b/tst/EnergyPlus/unit/VariableSpeedCoils.unit.cc index 0c24047ffe1..8aa09cc48ee 100644 --- a/tst/EnergyPlus/unit/VariableSpeedCoils.unit.cc +++ b/tst/EnergyPlus/unit/VariableSpeedCoils.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/Vector.unit.cc b/tst/EnergyPlus/unit/Vector.unit.cc index 29226d7081a..5ff9e950da0 100644 --- a/tst/EnergyPlus/unit/Vector.unit.cc +++ b/tst/EnergyPlus/unit/Vector.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/Vectors.unit.cc b/tst/EnergyPlus/unit/Vectors.unit.cc index 3b4bac42684..6e2bd7aa760 100644 --- a/tst/EnergyPlus/unit/Vectors.unit.cc +++ b/tst/EnergyPlus/unit/Vectors.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/VentilatedSlab.unit.cc b/tst/EnergyPlus/unit/VentilatedSlab.unit.cc index 3e0e6779b31..2c808e270db 100644 --- a/tst/EnergyPlus/unit/VentilatedSlab.unit.cc +++ b/tst/EnergyPlus/unit/VentilatedSlab.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -72,7 +72,6 @@ using namespace EnergyPlus::DataLoopNode; using namespace EnergyPlus::DataSurfaces; using namespace EnergyPlus::DataSurfaceLists; using namespace EnergyPlus::HeatBalanceManager; -using namespace EnergyPlus::ScheduleManager; using namespace EnergyPlus::SurfaceGeometry; TEST_F(EnergyPlusFixture, VentilatedSlab_CalcVentilatedSlabCoilOutputTest) @@ -2345,12 +2344,12 @@ TEST_F(EnergyPlusFixture, VentilatedSlab_InitVentilatedSlabTest) " Hot Water Loop Setpoint Node List; !- Setpoint Node or NodeList Name", }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); state->dataSize->CurZoneEqNum = 1; state->dataSize->ZoneEqSizing.allocate(1); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(*state); // read schedule data ErrorsFound = false; HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); // read project control data diff --git a/tst/EnergyPlus/unit/WaterCoils.unit.cc b/tst/EnergyPlus/unit/WaterCoils.unit.cc index e11cbf8fe26..a2b30e0afa6 100644 --- a/tst/EnergyPlus/unit/WaterCoils.unit.cc +++ b/tst/EnergyPlus/unit/WaterCoils.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -107,7 +107,6 @@ using namespace EnergyPlus::GlobalNames; using namespace EnergyPlus::HeatBalanceManager; using namespace EnergyPlus::MixedAir; using namespace EnergyPlus::Psychrometrics; -using namespace EnergyPlus::ScheduleManager; using namespace EnergyPlus::SizingManager; using namespace EnergyPlus::WaterCoils; using namespace EnergyPlus::Psychrometrics; @@ -155,7 +154,6 @@ class WaterCoilsTest : public EnergyPlusFixture state->dataSize->FinalZoneSizing.allocate(1); state->dataAirSystemsData->PrimaryAirSystems.allocate(1); state->dataAirLoop->AirLoopControlInfo.allocate(1); - InitializePsychRoutines(*state); } virtual void TearDown() @@ -166,7 +164,7 @@ class WaterCoilsTest : public EnergyPlusFixture TEST_F(WaterCoilsTest, WaterCoolingCoilSizing) { - FluidProperties::GetFluidPropertiesData(*state); + Fluid::GetFluidPropertiesData(*state); state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); @@ -188,10 +186,8 @@ TEST_F(WaterCoilsTest, WaterCoolingCoilSizing) loopsidebranch.Comp.allocate(1); } state->dataPlnt->PlantLoop(1).Name = "WaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "FluidWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); // set up sizing data state->dataSize->FinalSysSizing(1).MixTempAtCoolPeak = 20.0; @@ -400,7 +396,7 @@ TEST_F(WaterCoilsTest, TdbFnHRhPbTest) TEST_F(WaterCoilsTest, CoilHeatingWaterUASizing) { - FluidProperties::GetFluidPropertiesData(*state); + Fluid::GetFluidPropertiesData(*state); state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); @@ -424,10 +420,8 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterUASizing) loopsidebranch.Comp.allocate(1); } state->dataPlnt->PlantLoop(1).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "FluidWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); // set up sizing data state->dataSize->FinalSysSizing(1).DesMainVolFlow = 1.00; @@ -442,7 +436,7 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterUASizing) state->dataWaterCoils->WaterCoil(CoilNum).WaterPlantLoc.loopNum = 1; state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = WaterCoils::CoilModel::HeatingSimple; - state->dataWaterCoils->WaterCoil(CoilNum).SchedPtr = ScheduleManager::ScheduleAlwaysOn; + state->dataWaterCoils->WaterCoil(CoilNum).availSched = Sched::GetScheduleAlwaysOn(*state); state->dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; @@ -491,10 +485,8 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterUASizing) Real64 rho = 0; Real64 DesWaterFlowRate = 0; - Cp = FluidProperties::GetSpecificHeatGlycol( - *state, state->dataPlnt->PlantLoop(1).FluidName, Constant::HWInitConvTemp, state->dataPlnt->PlantLoop(1).FluidIndex, "Unit Test"); - rho = FluidProperties::GetDensityGlycol( - *state, state->dataPlnt->PlantLoop(1).FluidName, Constant::HWInitConvTemp, state->dataPlnt->PlantLoop(1).FluidIndex, "Unit Test"); + Cp = state->dataPlnt->PlantLoop(1).glycol->getSpecificHeat(*state, Constant::HWInitConvTemp, "Unit Test"); + rho = state->dataPlnt->PlantLoop(1).glycol->getDensity(*state, Constant::HWInitConvTemp, "Unit Test"); DesWaterFlowRate = state->dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate / (10.0 * Cp * rho); // check heating coil design water flow rate @@ -556,7 +548,7 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterUASizing) TEST_F(WaterCoilsTest, CoilHeatingWaterLowAirFlowUASizing) { - FluidProperties::GetFluidPropertiesData(*state); + Fluid::GetFluidPropertiesData(*state); state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); @@ -580,10 +572,8 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterLowAirFlowUASizing) loopsidebranch.Comp.allocate(1); } state->dataPlnt->PlantLoop(1).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "FluidWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); // set up sizing data state->dataSize->FinalSysSizing(1).DesMainVolFlow = 1.00; @@ -598,7 +588,7 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterLowAirFlowUASizing) state->dataWaterCoils->WaterCoil(CoilNum).WaterPlantLoc.loopNum = 1; state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = WaterCoils::CoilModel::HeatingSimple; - state->dataWaterCoils->WaterCoil(CoilNum).SchedPtr = ScheduleManager::ScheduleAlwaysOn; + state->dataWaterCoils->WaterCoil(CoilNum).availSched = Sched::GetScheduleAlwaysOn(*state); state->dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; @@ -647,10 +637,8 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterLowAirFlowUASizing) Real64 rho = 0; Real64 DesWaterFlowRate = 0; - Cp = FluidProperties::GetSpecificHeatGlycol( - *state, state->dataPlnt->PlantLoop(1).FluidName, Constant::HWInitConvTemp, state->dataPlnt->PlantLoop(1).FluidIndex, "Unit Test"); - rho = FluidProperties::GetDensityGlycol( - *state, state->dataPlnt->PlantLoop(1).FluidName, Constant::HWInitConvTemp, state->dataPlnt->PlantLoop(1).FluidIndex, "Unit Test"); + Cp = state->dataPlnt->PlantLoop(1).glycol->getSpecificHeat(*state, Constant::HWInitConvTemp, "Unit Test"); + rho = state->dataPlnt->PlantLoop(1).glycol->getDensity(*state, Constant::HWInitConvTemp, "Unit Test"); DesWaterFlowRate = state->dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate / (10.0 * Cp * rho); // check heating coil design water flow rate @@ -715,7 +703,7 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterLowAirFlowUASizing) TEST_F(WaterCoilsTest, CoilHeatingWaterUASizingLowHwaterInletTemp) { - FluidProperties::GetFluidPropertiesData(*state); + Fluid::GetFluidPropertiesData(*state); state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); @@ -739,10 +727,8 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterUASizingLowHwaterInletTemp) loopsidebranch.Comp.allocate(1); } state->dataPlnt->PlantLoop(1).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "FluidWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); // set up sizing data state->dataSize->FinalSysSizing(1).DesMainVolFlow = 1.00; @@ -757,7 +743,7 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterUASizingLowHwaterInletTemp) state->dataWaterCoils->WaterCoil(CoilNum).WaterPlantLoc.loopNum = 1; state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = WaterCoils::CoilModel::HeatingSimple; - state->dataWaterCoils->WaterCoil(CoilNum).SchedPtr = ScheduleManager::ScheduleAlwaysOn; + state->dataWaterCoils->WaterCoil(CoilNum).availSched = Sched::GetScheduleAlwaysOn(*state); state->dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; @@ -807,10 +793,8 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterUASizingLowHwaterInletTemp) Real64 rho = 0; Real64 DesWaterFlowRate = 0; - Cp = FluidProperties::GetSpecificHeatGlycol( - *state, state->dataPlnt->PlantLoop(1).FluidName, Constant::HWInitConvTemp, state->dataPlnt->PlantLoop(1).FluidIndex, "Unit Test"); - rho = FluidProperties::GetDensityGlycol( - *state, state->dataPlnt->PlantLoop(1).FluidName, Constant::HWInitConvTemp, state->dataPlnt->PlantLoop(1).FluidIndex, "Unit Test"); + Cp = state->dataPlnt->PlantLoop(1).glycol->getSpecificHeat(*state, Constant::HWInitConvTemp, "Unit Test"); + rho = state->dataPlnt->PlantLoop(1).glycol->getDensity(*state, Constant::HWInitConvTemp, "Unit Test"); DesWaterFlowRate = state->dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate / (10.0 * Cp * rho); // check heating coil design water flow rate @@ -831,8 +815,8 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterUASizingLowHwaterInletTemp) TEST_F(WaterCoilsTest, CoilCoolingWaterSimpleSizing) { - InitializePsychRoutines(*state); - FluidProperties::GetFluidPropertiesData(*state); + state->init_state(*state); + state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); ShowMessage(*state, "Begin Test: state->dataWaterCoils->WaterCoilsTest, CoilCoolingWaterSimpleSizing"); @@ -855,10 +839,8 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterSimpleSizing) loopsidebranch.Comp.allocate(1); } state->dataPlnt->PlantLoop(1).Name = "WaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "FluidWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); // set up sizing data state->dataSize->FinalSysSizing(1).MixTempAtCoolPeak = 20.0; @@ -921,10 +903,8 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterSimpleSizing) Real64 rho = 0; Real64 DesWaterFlowRate = 0; - Cp = FluidProperties::GetSpecificHeatGlycol( - *state, state->dataPlnt->PlantLoop(1).FluidName, Constant::CWInitConvTemp, state->dataPlnt->PlantLoop(1).FluidIndex, "Unit Test"); - rho = FluidProperties::GetDensityGlycol( - *state, state->dataPlnt->PlantLoop(1).FluidName, Constant::CWInitConvTemp, state->dataPlnt->PlantLoop(1).FluidIndex, "Unit Test"); + Cp = state->dataPlnt->PlantLoop(1).glycol->getSpecificHeat(*state, Constant::CWInitConvTemp, "Unit Test"); + rho = state->dataPlnt->PlantLoop(1).glycol->getDensity(*state, Constant::CWInitConvTemp, "Unit Test"); DesWaterFlowRate = state->dataWaterCoils->WaterCoil(CoilNum).DesWaterCoolingCoilRate / (state->dataWaterCoils->WaterCoil(CoilNum).DesignWaterDeltaTemp * Cp * rho); @@ -934,8 +914,8 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterSimpleSizing) TEST_F(WaterCoilsTest, CoilCoolingWaterDetailedSizing) { - InitializePsychRoutines(*state); - FluidProperties::GetFluidPropertiesData(*state); + state->init_state(*state); + state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); ShowMessage(*state, "Begin Test: state->dataWaterCoils->WaterCoilsTest, CoilCoolingWaterDetailedSizing"); @@ -958,10 +938,8 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterDetailedSizing) loopsidebranch.Comp.allocate(1); } state->dataPlnt->PlantLoop(1).Name = "WaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "FluidWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); // set up sizing data state->dataSize->FinalSysSizing(1).MixTempAtCoolPeak = 20.0; @@ -1038,10 +1016,8 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterDetailedSizing) Real64 rho = 0; Real64 DesWaterFlowRate = 0; - Cp = FluidProperties::GetSpecificHeatGlycol( - *state, state->dataPlnt->PlantLoop(1).FluidName, Constant::CWInitConvTemp, state->dataPlnt->PlantLoop(1).FluidIndex, "Unit Test"); - rho = FluidProperties::GetDensityGlycol( - *state, state->dataPlnt->PlantLoop(1).FluidName, Constant::CWInitConvTemp, state->dataPlnt->PlantLoop(1).FluidIndex, "Unit Test"); + Cp = state->dataPlnt->PlantLoop(1).glycol->getSpecificHeat(*state, Constant::CWInitConvTemp, "Unit Test"); + rho = state->dataPlnt->PlantLoop(1).glycol->getDensity(*state, Constant::CWInitConvTemp, "Unit Test"); DesWaterFlowRate = state->dataWaterCoils->WaterCoil(CoilNum).DesWaterCoolingCoilRate / (6.67 * Cp * rho); // check cooling coil design water flow rate EXPECT_DOUBLE_EQ(DesWaterFlowRate, state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate); @@ -1049,8 +1025,8 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterDetailedSizing) TEST_F(WaterCoilsTest, CoilCoolingWaterDetailed_WarningMath) { - InitializePsychRoutines(*state); - FluidProperties::GetFluidPropertiesData(*state); + state->init_state(*state); + state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); @@ -1071,10 +1047,8 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterDetailed_WarningMath) loopsidebranch.Comp.allocate(1); } state->dataPlnt->PlantLoop(1).Name = "WaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "FluidWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); // set up sizing data state->dataSize->FinalSysSizing(1).MixTempAtCoolPeak = 20.0; @@ -1087,6 +1061,7 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterDetailed_WarningMath) // set up water coil int CoilNum = 1; state->dataWaterCoils->WaterCoil(CoilNum).Name = "Test Detailed Water Cooling Coil"; + state->dataWaterCoils->WaterCoil(CoilNum).availSched = Sched::GetScheduleAlwaysOff(*state); state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = DataPlant::PlantEquipmentType::CoilWaterDetailedFlatCooling; state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = WaterCoils::CoilModel::CoolingDetailed; @@ -1165,10 +1140,8 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterDetailed_WarningMath) Real64 rho = 0; Real64 DesWaterFlowRate = 0; - Cp = FluidProperties::GetSpecificHeatGlycol( - *state, state->dataPlnt->PlantLoop(1).FluidName, Constant::CWInitConvTemp, state->dataPlnt->PlantLoop(1).FluidIndex, "Unit Test"); - rho = FluidProperties::GetDensityGlycol( - *state, state->dataPlnt->PlantLoop(1).FluidName, Constant::CWInitConvTemp, state->dataPlnt->PlantLoop(1).FluidIndex, "Unit Test"); + Cp = state->dataPlnt->PlantLoop(1).glycol->getSpecificHeat(*state, Constant::CWInitConvTemp, "Unit Test"); + rho = state->dataPlnt->PlantLoop(1).glycol->getDensity(*state, Constant::CWInitConvTemp, "Unit Test"); DesWaterFlowRate = state->dataWaterCoils->WaterCoil(CoilNum).DesWaterCoolingCoilRate / (6.67 * Cp * rho); // check cooling coil design water flow rate EXPECT_DOUBLE_EQ(DesWaterFlowRate, state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate); @@ -1189,6 +1162,7 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterDetailed_WarningMath) EXPECT_EQ(0.81060636699999999, state->dataWaterCoils->WaterCoil(CoilNum).MinAirFlowArea); std::string expected_error = delimited_string({ + format(" ** Warning ** Version: missing in IDF, processing for EnergyPlus version=\"{}\"", DataStringGlobals::MatchVersion), " ** Warning ** Coil:Cooling:Water:DetailedGeometry in Coil =Test Detailed Water Cooling Coil", " ** ~~~ ** Air Flow Rate Velocity has greatly exceeded upper design guidelines of ~2.5 m/s", format(" ** ~~~ ** Air Mass Flow Rate[kg/s]={:.6T}", state->dataWaterCoils->WaterCoil(CoilNum).InletAirMassFlowRate), @@ -1233,8 +1207,8 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterDetailed_WarningMath) TEST_F(WaterCoilsTest, CoilHeatingWaterSimpleSizing) { - InitializePsychRoutines(*state); - FluidProperties::GetFluidPropertiesData(*state); + state->init_state(*state); + state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); ShowMessage(*state, "Begin Test: state->dataWaterCoils->WaterCoilsTest, CoilHeatingWaterSimpleSizing"); @@ -1256,10 +1230,8 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterSimpleSizing) loopsidebranch.Comp.allocate(1); } state->dataPlnt->PlantLoop(1).Name = "WaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "FluidWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); // set up sizing data state->dataSize->FinalSysSizing(1).DesMainVolFlow = 1.00; @@ -1320,10 +1292,8 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterSimpleSizing) Real64 rho = 0; Real64 DesWaterFlowRate = 0; - Cp = FluidProperties::GetSpecificHeatGlycol( - *state, state->dataPlnt->PlantLoop(1).FluidName, Constant::HWInitConvTemp, state->dataPlnt->PlantLoop(1).FluidIndex, "Unit Test"); - rho = FluidProperties::GetDensityGlycol( - *state, state->dataPlnt->PlantLoop(1).FluidName, Constant::HWInitConvTemp, state->dataPlnt->PlantLoop(1).FluidIndex, "Unit Test"); + Cp = state->dataPlnt->PlantLoop(1).glycol->getSpecificHeat(*state, Constant::HWInitConvTemp, "Unit Test"); + rho = state->dataPlnt->PlantLoop(1).glycol->getDensity(*state, Constant::HWInitConvTemp, "Unit Test"); DesWaterFlowRate = state->dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate / (11.0 * Cp * rho); // check heating coil design water flow rate @@ -1331,7 +1301,7 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterSimpleSizing) } TEST_F(WaterCoilsTest, HotWaterHeatingCoilAutoSizeTempTest) { - FluidProperties::GetFluidPropertiesData(*state); + Fluid::GetFluidPropertiesData(*state); state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); @@ -1354,10 +1324,8 @@ TEST_F(WaterCoilsTest, HotWaterHeatingCoilAutoSizeTempTest) loopsidebranch.Comp.allocate(1); } state->dataPlnt->PlantLoop(1).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "FluidWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); // set up sizing data state->dataSize->FinalSysSizing(1).DesMainVolFlow = 1.00; @@ -1372,7 +1340,7 @@ TEST_F(WaterCoilsTest, HotWaterHeatingCoilAutoSizeTempTest) state->dataWaterCoils->WaterCoil(CoilNum).WaterPlantLoc.loopNum = 1; state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = WaterCoils::CoilModel::HeatingSimple; state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; - state->dataWaterCoils->WaterCoil(CoilNum).SchedPtr = ScheduleManager::ScheduleAlwaysOn; + state->dataWaterCoils->WaterCoil(CoilNum).availSched = Sched::GetScheduleAlwaysOn(*state); state->dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; @@ -1422,10 +1390,8 @@ TEST_F(WaterCoilsTest, HotWaterHeatingCoilAutoSizeTempTest) Real64 DesWaterFlowRate(0.0); // now size heating coil hot water flow rate at 60.0C - Cp = FluidProperties::GetSpecificHeatGlycol( - *state, state->dataPlnt->PlantLoop(1).FluidName, 60.0, state->dataPlnt->PlantLoop(1).FluidIndex, "Unit Test"); - rho = FluidProperties::GetDensityGlycol( - *state, state->dataPlnt->PlantLoop(1).FluidName, 60.0, state->dataPlnt->PlantLoop(1).FluidIndex, "Unit Test"); + Cp = state->dataPlnt->PlantLoop(1).glycol->getSpecificHeat(*state, 60.0, "Unit Test"); + rho = state->dataPlnt->PlantLoop(1).glycol->getDensity(*state, 60.0, "Unit Test"); DesWaterFlowRate = DesCoilHeatingLoad / (state->dataSize->PlantSizData(1).DeltaT * Cp * rho); // check heating coil design water flow rate calculated here and sizing results are identical @@ -1459,11 +1425,9 @@ TEST_F(WaterCoilsTest, FanCoilCoolingWaterFlowTest) state->dataEnvrn->StdRhoAir = 1.20; state->dataWaterCoils->GetWaterCoilsInputFlag = true; state->dataGlobalNames->NumCoils = 0; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - - InitializePsychRoutines(*state); + state->dataGlobal->MinutesInTimeStep = 60; std::string const idf_objects = delimited_string({ " Zone,", @@ -1588,13 +1552,12 @@ TEST_F(WaterCoilsTest, FanCoilCoolingWaterFlowTest) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetZoneData(*state, ErrorsFound); EXPECT_EQ("EAST ZONE", state->dataHeatBal->Zone(1).Name); GetZoneEquipmentData(*state); - ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; GetFanInput(*state); EXPECT_EQ((int)HVAC::FanType::OnOff, (int)state->dataFans->fans(1)->type); @@ -1697,7 +1660,7 @@ TEST_F(WaterCoilsTest, FanCoilCoolingWaterFlowTest) } state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataWaterCoils->WaterCoil(2).WaterPlantLoc.loopNum = 1; state->dataWaterCoils->WaterCoil(2).WaterPlantLoc.loopSideNum = DataPlant::LoopSideLocation::Demand; @@ -1710,9 +1673,8 @@ TEST_F(WaterCoilsTest, FanCoilCoolingWaterFlowTest) state->dataWaterCoils->WaterCoil(1).WaterPlantLoc.compNum = 1; state->dataPlnt->PlantLoop(2).Name = "ChilledWaterLoop"; - state->dataPlnt->PlantLoop(2).FluidName = "ChilledWater"; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterCooling; @@ -1723,9 +1685,8 @@ TEST_F(WaterCoilsTest, FanCoilCoolingWaterFlowTest) state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).FlowLock = DataPlant::FlowLock::Unlocked; state->dataPlnt->PlantLoop(1).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "HotWater"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::CoilWaterSimpleHeating; diff --git a/tst/EnergyPlus/unit/WaterManager.unit.cc b/tst/EnergyPlus/unit/WaterManager.unit.cc index 75a35d2a2e0..e0fd3dd929f 100644 --- a/tst/EnergyPlus/unit/WaterManager.unit.cc +++ b/tst/EnergyPlus/unit/WaterManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -80,6 +80,7 @@ TEST_F(EnergyPlusFixture, WaterManager_NormalAnnualPrecipitation) "1;", }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); WaterManager::GetWaterManagerInput(*state); state->dataEnvrn->Year = 2000; @@ -88,12 +89,12 @@ TEST_F(EnergyPlusFixture, WaterManager_NormalAnnualPrecipitation) state->dataGlobal->TimeStep = 2; state->dataGlobal->TimeStepZoneSec = 900; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; + Sched::GetSchedule(*state, "PRECIPITATIONSCHD")->currentVal = 1.0; WaterManager::UpdatePrecipitation(*state); Real64 ExpectedNomAnnualRain = 0.80771; - Real64 ExpectedCurrentRate = 1.0 * (0.75 / 0.80771) / Constant::SecInHour; + Real64 ExpectedCurrentRate = 1.0 * (0.75 / 0.80771) / Constant::rSecsInHour; Real64 NomAnnualRain = state->dataWaterData->RainFall.NomAnnualRain; EXPECT_NEAR(NomAnnualRain, ExpectedNomAnnualRain, 0.000001); @@ -119,6 +120,7 @@ TEST_F(EnergyPlusFixture, WaterManager_UpdatePrecipitation) "1;", }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); WaterManager::GetWaterManagerInput(*state); state->dataGlobal->TimeStepZoneSec = 900; state->dataEnvrn->Year = 2000; @@ -126,7 +128,7 @@ TEST_F(EnergyPlusFixture, WaterManager_UpdatePrecipitation) state->dataEnvrn->Month = 1; state->dataGlobal->TimeStep = 2; - state->dataScheduleMgr->Schedule(1).CurrentValue = 2.0; + Sched::GetSchedule(*state, "PRECIPITATIONSCHD")->currentVal = 2.0; state->dataEnvrn->LiquidPrecipitation = 0.5; WaterManager::UpdatePrecipitation(*state); @@ -161,6 +163,7 @@ TEST_F(EnergyPlusFixture, WaterManager_ZeroAnnualPrecipitation) "1;", }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); WaterManager::GetWaterManagerInput(*state); state->dataEnvrn->Year = 2000; state->dataEnvrn->EndYear = 2000; @@ -168,7 +171,7 @@ TEST_F(EnergyPlusFixture, WaterManager_ZeroAnnualPrecipitation) state->dataGlobal->TimeStep = 2; state->dataGlobal->TimeStepZoneSec = 900; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; + Sched::GetSchedule(*state, "PRECIPITATIONSCHD")->currentVal = 1.0; WaterManager::UpdatePrecipitation(*state); @@ -228,6 +231,7 @@ TEST_F(EnergyPlusFixture, WaterManager_Fill) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); WaterManager::GetWaterManagerInput(*state); state->dataWaterManager->GetInputFlag = false; @@ -248,7 +252,7 @@ TEST_F(EnergyPlusFixture, WaterManager_Fill) // Simulate a call for tank water that would produce 0.025m3 of draw in one timestep state->dataHVACGlobal->TimeStepSys = 10.0 / 60.0; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->dataWaterData->WaterStorage(TankNum).NumWaterDemands = 1; state->dataWaterData->WaterStorage(TankNum).VdotRequestDemand.allocate(1); Real64 draw = 0.025; @@ -362,6 +366,7 @@ TEST_F(EnergyPlusFixture, WaterManager_MainsWater_Meter_Test) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); WaterManager::GetWaterManagerInput(*state); state->dataWaterManager->GetInputFlag = false; diff --git a/tst/EnergyPlus/unit/WaterThermalTanks.unit.cc b/tst/EnergyPlus/unit/WaterThermalTanks.unit.cc index dcc74d48ce4..02c0a9d3959 100644 --- a/tst/EnergyPlus/unit/WaterThermalTanks.unit.cc +++ b/tst/EnergyPlus/unit/WaterThermalTanks.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -362,6 +362,7 @@ TEST_F(EnergyPlusFixture, HPWHZoneEquipSeqenceNumberWarning) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); @@ -539,6 +540,7 @@ TEST_F(EnergyPlusFixture, HPWHWrappedDummyNodeConfig) std::string const idf_objects = delimited_string(idf_lines); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); WaterThermalTanks::GetWaterThermalTankInput(*state); @@ -727,6 +729,7 @@ TEST_F(EnergyPlusFixture, HPWHEnergyBalance) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataEnvrn->StdRhoAir = 1.0; ASSERT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); @@ -767,7 +770,7 @@ TEST_F(EnergyPlusFixture, HPWHEnergyBalance) state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStepZone = 10. / 60.; state->dataHVACGlobal->TimeStepSys = state->dataGlobal->TimeStepZone; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->dataHVACGlobal->SysTimeElapsed = 0.0; Tank.TimeElapsed = @@ -779,8 +782,7 @@ TEST_F(EnergyPlusFixture, HPWHEnergyBalance) state->dataOutRptPredefined->pdstHeatCoil = -1; state->dataWaterThermalTanks->mdotAir = 0.0993699992873531; - int GlycolIndex = 0; - const Real64 Cp = FluidProperties::GetSpecificHeatGlycol(*state, "WATER", Tank.TankTemp, GlycolIndex, "HPWHEnergyBalance"); + const Real64 Cp = Fluid::GetWater(*state)->getSpecificHeat(*state, Tank.TankTemp, "HPWHEnergyBalance"); Tank.CalcHeatPumpWaterHeater(*state, false); @@ -1037,6 +1039,7 @@ TEST_F(EnergyPlusFixture, HPWHSizing) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataEnvrn->StdRhoAir = 1.0; bool ErrorsFound = false; @@ -1046,7 +1049,7 @@ TEST_F(EnergyPlusFixture, HPWHSizing) HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); state->dataHVACGlobal->TimeStepSys = 1; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->dataEnvrn->OutBaroPress = 101325; SetPredefinedTables(*state); @@ -1239,13 +1242,17 @@ TEST_F(EnergyPlusFixture, HPWHOutdoorAirMissingNodeNameWarning) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = WaterThermalTanks::GetWaterThermalTankInput(*state); EXPECT_TRUE(ErrorsFound); ASSERT_TRUE(ErrorsFound); std::string const error_string = - delimited_string({" ** Severe ** WaterHeater:HeatPump:PumpedCondenser=\"ZONE4HEATPUMPWATERHEATER\":", + delimited_string({" ** Warning ** ProcessScheduleInput: Schedule:Constant = DUMMYSCH", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Severe ** WaterHeater:HeatPump:PumpedCondenser=\"ZONE4HEATPUMPWATERHEATER\":", " ** ~~~ ** When Inlet Air Configuration=\"OUTDOORAIRONLY\".", " ** ~~~ ** Outdoor Air Node Name and Exhaust Air Node Name must be specified.", " ** Severe ** WaterHeater:HeatPump:PumpedCondenser=\"ZONE4HEATPUMPWATERHEATER\":", @@ -1406,19 +1413,20 @@ TEST_F(EnergyPlusFixture, HPWHTestSPControl) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataEnvrn->StdRhoAir = 1.0; state->dataHVACGlobal->TimeStepSys = 1; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60 / state->dataGlobal->NumOfTimeStepInHour; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60 / state->dataGlobal->TimeStepsInHour; state->dataGlobal->TimeStep = 1; state->dataGlobal->HourOfDay = 1; state->dataEnvrn->DayOfWeek = 1; state->dataEnvrn->DayOfYear_Schedule = 1; SetPredefinedTables(*state); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); @@ -1609,6 +1617,7 @@ TEST_F(EnergyPlusFixture, StratifiedTankUseEnergy) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); @@ -1625,7 +1634,7 @@ TEST_F(EnergyPlusFixture, StratifiedTankUseEnergy) state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStepZone = 10. / 60.; state->dataHVACGlobal->TimeStepSys = state->dataGlobal->TimeStepZone; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->dataHVACGlobal->SysTimeElapsed = 0.0; Tank.TimeElapsed = state->dataGlobal->HourOfDay + state->dataGlobal->TimeStep * state->dataGlobal->TimeStepZone + state->dataHVACGlobal->SysTimeElapsed; @@ -1706,6 +1715,9 @@ TEST_F(EnergyPlusFixture, StratifiedTankSourceTemperatures) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data @@ -1713,11 +1725,6 @@ TEST_F(EnergyPlusFixture, StratifiedTankSourceTemperatures) InternalHeatGains::GetInternalHeatGainsInput(*state); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; - state->dataGlobal->TimeStep = 1; state->dataGlobal->HourOfDay = 1; state->dataEnvrn->Month = 7; @@ -1727,7 +1734,7 @@ TEST_F(EnergyPlusFixture, StratifiedTankSourceTemperatures) state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); int TankNum(1); EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); @@ -1755,7 +1762,7 @@ TEST_F(EnergyPlusFixture, StratifiedTankSourceTemperatures) state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStepZone = 15. / 60.; state->dataHVACGlobal->TimeStepSys = state->dataGlobal->TimeStepZone; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->dataHVACGlobal->SysTimeElapsed = 0.0; Tank.CalcWaterThermalTankStratified(*state); @@ -1822,6 +1829,7 @@ TEST_F(EnergyPlusFixture, MixedTankTimeNeededCalc) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data @@ -1837,7 +1845,7 @@ TEST_F(EnergyPlusFixture, MixedTankTimeNeededCalc) state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStepZone = 1.0 / 60.0; // one-minute system time step state->dataHVACGlobal->TimeStepSys = state->dataGlobal->TimeStepZone; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; Tank.TankTemp = 60.0; Tank.AmbientTempZone = 20.0; Tank.AmbientTemp = 20.0; @@ -1934,6 +1942,7 @@ TEST_F(EnergyPlusFixture, StratifiedTankCalc) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data @@ -1946,7 +1955,7 @@ TEST_F(EnergyPlusFixture, StratifiedTankCalc) state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStepZone = 20.0 / 60.0; state->dataHVACGlobal->TimeStepSys = state->dataGlobal->TimeStepZone; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; constexpr int TankNum = 1; WaterThermalTanks::WaterThermalTankData &Tank = state->dataWaterThermalTanks->WaterThermalTank(TankNum); for (auto &node : Tank.Node) { @@ -2026,7 +2035,7 @@ TEST_F(EnergyPlusFixture, StratifiedTankCalc) auto &node = Tank.Node[i]; TankNodeEnergy += node.Mass * (NodeTemps[i] - PrevNodeTemps[i]); } - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(*state, "WATER", 60.0, DummyIndex, "StratifiedTankCalcNoDraw"); + Real64 Cp = Fluid::GetWater(*state)->getSpecificHeat(*state, 60.0, "StratifiedTankCalcNoDraw"); TankNodeEnergy *= Cp; EXPECT_NEAR(Tank.NetHeatTransferRate * state->dataHVACGlobal->TimeStepSysSec, TankNodeEnergy, fabs(TankNodeEnergy * 0.0001)); @@ -2129,6 +2138,7 @@ TEST_F(EnergyPlusFixture, StratifiedTankSourceFlowRateCalc) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data @@ -2147,7 +2157,7 @@ TEST_F(EnergyPlusFixture, StratifiedTankSourceFlowRateCalc) state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStepZone = 20.0 / 60.0; state->dataHVACGlobal->TimeStepSys = state->dataGlobal->TimeStepZone; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; // Test a constant temperature source flow rate for (auto &node : Tank.Node) { @@ -2165,7 +2175,7 @@ TEST_F(EnergyPlusFixture, StratifiedTankSourceFlowRateCalc) Tank.SourceMassFlowRate = 6.30901964e-5 * 997; // 1 gal/min int DummyIndex = 1; - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(*state, "WATER", 60.0, DummyIndex, "StratifiedTankCalcNoDraw"); + Real64 Cp = Fluid::GetWater(*state)->getSpecificHeat(*state, 60.0, "StratifiedTankCalcNoDraw"); Tank.CalcWaterThermalTankStratified(*state); @@ -2365,16 +2375,14 @@ TEST_F(EnergyPlusFixture, DesuperheaterTimeAdvanceCheck) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; - state->dataGlobal->TimeStep = 1; state->dataGlobal->HourOfDay = 1; state->dataEnvrn->Month = 7; @@ -2384,7 +2392,7 @@ TEST_F(EnergyPlusFixture, DesuperheaterTimeAdvanceCheck) state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); int TankNum = 1; int DXNum = 1; @@ -2395,12 +2403,12 @@ TEST_F(EnergyPlusFixture, DesuperheaterTimeAdvanceCheck) WaterThermalTanks::WaterThermalTankData &Tank = state->dataWaterThermalTanks->WaterThermalTank(TankNum); WaterThermalTanks::WaterHeaterDesuperheaterData &Desuperheater = state->dataWaterThermalTanks->WaterHeaterDesuperheater(Tank.DesuperheaterNum); - // Inititate tank conditions + // Initialize tank conditions state->dataGlobal->HourOfDay = 0; state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStepZone = 1; state->dataHVACGlobal->TimeStepSys = state->dataGlobal->TimeStepZone; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->dataHVACGlobal->SysTimeElapsed = 0.0; // First iteration condition set (extreme) @@ -2643,16 +2651,14 @@ TEST_F(EnergyPlusFixture, StratifiedTank_GSHP_DesuperheaterSourceHeat) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; - state->dataGlobal->TimeStep = 1; state->dataGlobal->HourOfDay = 1; state->dataEnvrn->Month = 7; @@ -2663,7 +2669,7 @@ TEST_F(EnergyPlusFixture, StratifiedTank_GSHP_DesuperheaterSourceHeat) state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); state->dataPlnt->TotNumLoops = 1; int TankNum(1); int HPNum(1); @@ -2687,7 +2693,8 @@ TEST_F(EnergyPlusFixture, StratifiedTank_GSHP_DesuperheaterSourceHeat) // Plant loop must be initialized state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).plantLoc.loopNum = 1; state->dataPlnt->PlantLoop.allocate(LoopNum); - state->dataPlnt->PlantLoop(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).plantLoc.loopNum).FluidIndex = 1; + state->dataPlnt->PlantLoop(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).plantLoc.loopNum).FluidName = "WATER"; + state->dataPlnt->PlantLoop(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).plantLoc.loopNum).glycol = Fluid::GetWater(*state); auto &SupplySideloop(state->dataPlnt->PlantLoop(LoopNum).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply)); SupplySideloop.TotalBranches = 1; SupplySideloop.Branch.allocate(BranchNum); @@ -2732,7 +2739,7 @@ TEST_F(EnergyPlusFixture, StratifiedTank_GSHP_DesuperheaterSourceHeat) state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStepZone = 1. / 60.; state->dataHVACGlobal->TimeStepSys = state->dataGlobal->TimeStepZone; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->dataHVACGlobal->SysTimeElapsed = 0.0; state->dataHeatBal->HeatReclaimSimple_WAHPCoil(1).AvailCapacity = 1000; state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).PartLoadRatio = 0.0; @@ -2762,7 +2769,7 @@ TEST_F(EnergyPlusFixture, StratifiedTank_GSHP_DesuperheaterSourceHeat) EXPECT_EQ(Desuperheater.DXSysPLR, 0.8); // The heater rate is correctly calculated EXPECT_EQ(Desuperheater.HeaterRate, 1000 * 0.25 / Desuperheater.DXSysPLR * Desuperheater.DesuperheaterPLR); - // The source rate calculated in stratified tank calculation function is near the heater rate calcualted in desuperheater function + // The source rate calculated in stratified tank calculation function is near the heater rate calculated in desuperheater function EXPECT_NEAR(Tank.SourceRate, Desuperheater.HeaterRate, Tank.SourceRate * 0.05); } @@ -3035,16 +3042,14 @@ TEST_F(EnergyPlusFixture, Desuperheater_Multispeed_Coil_Test) }); ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; - state->dataGlobal->TimeStep = 1; state->dataGlobal->HourOfDay = 1; state->dataEnvrn->Month = 7; @@ -3054,7 +3059,7 @@ TEST_F(EnergyPlusFixture, Desuperheater_Multispeed_Coil_Test) state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); int TankNum(1); int DXNum(1); @@ -3079,15 +3084,15 @@ TEST_F(EnergyPlusFixture, Desuperheater_Multispeed_Coil_Test) state->dataDXCoils->DXCoil(1).InletAirTemp = 27.0; state->dataDXCoils->DXCoil(1).InletAirHumRat = 0.005; state->dataDXCoils->DXCoil(1).InletAirEnthalpy = Psychrometrics::PsyHFnTdbW(27.0, 0.005); - state->dataDXCoils->DXCoil(1).SchedPtr = 1; - state->dataScheduleMgr->Schedule(state->dataDXCoils->DXCoil(1).SchedPtr).CurrentValue = 1.0; // enable the VRF condenser + state->dataDXCoils->DXCoil(1).availSched = Sched::GetSchedule(*state, "HOT WATER DEMAND SCHEDULE"); + state->dataDXCoils->DXCoil(1).availSched->currentVal = 1.0; // enable the VRF condenser state->dataDXCoils->DXCoil(1).MSRatedCBF(1) = 0.1262; state->dataDXCoils->DXCoil(1).MSRatedCBF(2) = 0.0408; // Calculate multispeed DX cooling coils DXCoils::CalcMultiSpeedDXCoilCooling(*state, DXNum, 1, 1, 2, HVAC::FanOp::Cycling, HVAC::CompressorOp::On, 1); - // Source availably heat successfully passed to DataHeatBalance::HeatReclaimDXCoil data struct + // Source available heat successfully passed to DataHeatBalance::HeatReclaimDXCoil data struct EXPECT_EQ(state->dataHeatBal->HeatReclaimDXCoil(DXNum).AvailCapacity, state->dataDXCoils->DXCoil(DXNum).TotalCoolingEnergyRate + state->dataDXCoils->DXCoil(DXNum).ElecCoolingPower); @@ -3095,12 +3100,12 @@ TEST_F(EnergyPlusFixture, Desuperheater_Multispeed_Coil_Test) WaterThermalTanks::WaterThermalTankData &Tank = state->dataWaterThermalTanks->WaterThermalTank(TankNum); WaterThermalTanks::WaterHeaterDesuperheaterData &Desuperheater = state->dataWaterThermalTanks->WaterHeaterDesuperheater(Tank.DesuperheaterNum); - // Inititate tank conditions + // Initialize tank conditions state->dataGlobal->HourOfDay = 0; state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStepZone = 1; state->dataHVACGlobal->TimeStepSys = state->dataGlobal->TimeStepZone; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->dataHVACGlobal->SysTimeElapsed = 0.0; Tank.TankTemp = 45.0; Tank.AmbientTemp = 20.0; @@ -3142,8 +3147,6 @@ TEST_F(EnergyPlusFixture, Desuperheater_Multispeed_Coil_Test) TEST_F(EnergyPlusFixture, MixedTankAlternateSchedule) { - using FluidProperties::GetDensityGlycol; - std::string const idf_objects = delimited_string({ "Schedule:Constant, Inlet Water Temperature, , 10.0;", "Schedule:Constant, Water Heater Setpoint Temperature, ,55.0;", @@ -3199,11 +3202,9 @@ TEST_F(EnergyPlusFixture, MixedTankAlternateSchedule) ASSERT_TRUE(process_idf(idf_objects)); // Schedules setup - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; - + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); state->dataGlobal->TimeStep = 1; state->dataGlobal->HourOfDay = 1; state->dataEnvrn->Month = 7; @@ -3213,7 +3214,7 @@ TEST_F(EnergyPlusFixture, MixedTankAlternateSchedule) state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); @@ -3230,7 +3231,7 @@ TEST_F(EnergyPlusFixture, MixedTankAlternateSchedule) // Source side is in the demand side of the plant loop Tank.SrcSidePlantLoc.loopSideNum = EnergyPlus::DataPlant::LoopSideLocation::Demand; Tank.SavedSourceOutletTemp = 60.0; - rho = FluidProperties::GetDensityGlycol(*state, "Water", Tank.TankTemp, WaterIndex, "MixedTankAlternateSchedule"); + rho = Fluid::GetWater(*state)->getDensity(*state, Tank.TankTemp, "MixedTankAlternateSchedule"); // Set the available max flow rates for tank and node Tank.PlantSourceMassFlowRateMax = Tank.SourceDesignVolFlowRate * rho; @@ -3303,6 +3304,7 @@ TEST_F(EnergyPlusFixture, MixedTank_WarnPotentialFreeze) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); @@ -3313,7 +3315,7 @@ TEST_F(EnergyPlusFixture, MixedTank_WarnPotentialFreeze) state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStepZone = 1.0 / 60.0; // one-minute system time step state->dataHVACGlobal->TimeStepSys = state->dataGlobal->TimeStepZone; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; Tank.TankTemp = 2.0; Tank.AmbientTemp = -40; Tank.UseInletTemp = 3.0; @@ -3334,7 +3336,13 @@ TEST_F(EnergyPlusFixture, MixedTank_WarnPotentialFreeze) // And the final tank temp too, which is the one triggering the warning EXPECT_LT(Tank.TankTemp, 2.0); - std::string const error_string = delimited_string({" ** Warning ** CalcWaterThermalTankMixed: WaterHeater:Mixed = 'CHILLEDWATERTANK': " + std::string const error_string = delimited_string({" ** Warning ** ProcessScheduleInput: Schedule:Constant = WATER HEATER SETPOINT TEMPERATURE", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = TANK AMBIENT TEMPERATURE", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** CalcWaterThermalTankMixed: WaterHeater:Mixed = 'CHILLEDWATERTANK': " "Temperature of tank < 2C indicates of possibility of freeze. Tank Temperature = 1.95 C.", " ** ~~~ ** Environment=, at Simulation time= 00:-1 - 00:00"}); EXPECT_TRUE(compare_err_stream(error_string, true)); @@ -3403,7 +3411,7 @@ TEST_F(EnergyPlusFixture, StratifiedTank_WarnPotentialFreeze) }); ASSERT_TRUE(process_idf(idf_objects)); - + state->init_state(*state); EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); int TankNum(1); @@ -3413,7 +3421,7 @@ TEST_F(EnergyPlusFixture, StratifiedTank_WarnPotentialFreeze) state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStepZone = 1.0 / 60.0; // one-minute system time step state->dataHVACGlobal->TimeStepSys = state->dataGlobal->TimeStepZone; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; Tank.TankTemp = 2.0; for (auto &node : Tank.Node) { node.Temp = 2.0; @@ -3444,7 +3452,13 @@ TEST_F(EnergyPlusFixture, StratifiedTank_WarnPotentialFreeze) } std::string const error_string = - delimited_string({" ** Warning ** CalcWaterThermalTankStratified: WaterHeater:Stratified = 'STRATIFIED CHILLEDWATERTANK': Temperature of " + delimited_string({" ** Warning ** ProcessScheduleInput: Schedule:Constant = WATER HEATER SETPOINT TEMPERATURE", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = TANK AMBIENT TEMPERATURE", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** CalcWaterThermalTankStratified: WaterHeater:Stratified = 'STRATIFIED CHILLEDWATERTANK': Temperature of " "tank < 2C indicates of possibility of freeze. Tank Temperature = 1.75 C.", " ** ~~~ ** Environment=, at Simulation time= 00:-1 - 00:00"}); EXPECT_TRUE(compare_err_stream(error_string, true)); @@ -3689,10 +3703,9 @@ TEST_F(EnergyPlusFixture, MultipleDesuperheaterSingleSource) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); state->dataGlobal->TimeStep = 1; state->dataGlobal->HourOfDay = 1; @@ -3703,14 +3716,14 @@ TEST_F(EnergyPlusFixture, MultipleDesuperheaterSingleSource) state->dataEnvrn->DayOfWeek = 2; state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); // Initiate tank conditions state->dataGlobal->HourOfDay = 0; state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStepZone = 1; state->dataHVACGlobal->TimeStepSys = state->dataGlobal->TimeStepZone; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->dataHVACGlobal->SysTimeElapsed = 0.0; int DXNum = 1; @@ -4213,7 +4226,7 @@ TEST_F(EnergyPlusFixture, HPWH_Both_Pumped_and_Wrapped_InputProcessing) }); ASSERT_TRUE(process_idf(idf_objects)); - + state->init_state(*state); EXPECT_TRUE(WaterThermalTanks::GetWaterThermalTankInput(*state)); EXPECT_EQ(state->dataWaterThermalTanks->HPWaterHeater.size(), 2u); @@ -4439,18 +4452,20 @@ TEST_F(EnergyPlusFixture, CrashCalcStandardRatings_HPWH_and_Standalone) }); ASSERT_TRUE(process_idf(idf_objects)); - state->dataEnvrn->StdRhoAir = 1.0; state->dataHVACGlobal->TimeStepSys = 1; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60 / state->dataGlobal->NumOfTimeStepInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60 / state->dataGlobal->TimeStepsInHour; + state->init_state(*state); + + state->dataEnvrn->StdRhoAir = 1.0; state->dataGlobal->TimeStep = 1; state->dataGlobal->HourOfDay = 1; state->dataEnvrn->DayOfWeek = 1; state->dataEnvrn->DayOfYear_Schedule = 1; SetPredefinedTables(*state); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); @@ -4733,18 +4748,40 @@ TEST_F(EnergyPlusFixture, HPWH_Wrapped_Stratified_Simultaneous) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // This returns true if ErrorsFound EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); // Previous warning before fix - // std::string const error_string = delimited_string({ + std::string const error_string = + delimited_string({" ** Warning ** ProcessScheduleInput: Schedule:Constant = ALWAYS ON DISCRETE", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = HPWHWRAPPED COMPRESSOR SETP TEMP SCH", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = HPWHWRAPPED INLET AIR HUM SCH", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = HPWHWRAPPED INLET AIR TEMP SCH", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = HPWHWRAPPED STRATIFIED TANK HEATER1 SETP TEMP SCH", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = HPWHWRAPPED STRATIFIED TANK HEATER2 SETP TEMP SCH", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = HPWHWRAPPED STRATIFIED TANK AMBIENT TEMP SCH", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated."}); //" ** Severe ** WaterHeater:HeatPump:WrappedCondenser = HPWHWRAPPED:", //" ** ~~~ ** Heater Control Type for WaterHeater:Stratified = HPWHWRAPPED STRATIFIED TANK must be CYCLE.", //}); - EXPECT_TRUE(compare_err_stream("", true)); + EXPECT_TRUE(compare_err_stream(error_string, true)); } // Test for #7902: If the HPWH is Pumped, and it has a Stratified Tank which Priority Mode is Simultaneous, @@ -5007,7 +5044,7 @@ TEST_F(EnergyPlusFixture, HPWH_Pumped_Stratified_Simultaneous) }); ASSERT_TRUE(process_idf(idf_objects)); - + state->init_state(*state); // This returns true if ErrorsFound EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); @@ -5017,7 +5054,30 @@ TEST_F(EnergyPlusFixture, HPWH_Pumped_Stratified_Simultaneous) //" ** ~~~ ** Heater Control Type for WaterHeater:Stratified = HPWHPUMPED STRATIFIED TANK must be CYCLE.", //}); - EXPECT_TRUE(compare_err_stream("", true)); + std::string const error_string = + delimited_string({" ** Warning ** ProcessScheduleInput: Schedule:Constant = ALWAYS ON DISCRETE", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = HPWHPUMPED COMPRESSOR SETP TEMP SCH", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = HPWHPUMPED INLET AIR HUM SCH", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = HPWHPUMPED INLET AIR TEMP SCH", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = HPWHPUMPED STRATIFIED TANK HEATER1 SETP TEMP SCH", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = HPWHPUMPED STRATIFIED TANK HEATER2 SETP TEMP SCH", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = HPWHPUMPED STRATIFIED TANK AMBIENT TEMP SCH", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated."}); + + EXPECT_TRUE(compare_err_stream(error_string, true)); } TEST_F(EnergyPlusFixture, StratifiedTank_WarningNumberOfNodes_FalsePositiveBlanks) @@ -5095,6 +5155,7 @@ TEST_F(EnergyPlusFixture, StratifiedTank_WarningNumberOfNodes_FalsePositiveBlank }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data @@ -5115,7 +5176,17 @@ TEST_F(EnergyPlusFixture, StratifiedTank_WarningNumberOfNodes_FalsePositiveBlank } } - EXPECT_TRUE(compare_err_stream("")); + std::string const error_string = delimited_string({" ** Warning ** ProcessScheduleInput: Schedule:Constant = HOT WATER SETPOINT TEMP SCHEDULE", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = AMBIENT TEMP SCHEDULE", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = HOT WATER DEMAND SCHEDULE", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated."}); + + EXPECT_TRUE(compare_err_stream(error_string)); } TEST_F(EnergyPlusFixture, StratifiedTank_WarningNumberOfNodes_FalsePositiveZeroes) @@ -5195,6 +5266,7 @@ TEST_F(EnergyPlusFixture, StratifiedTank_WarningNumberOfNodes_FalsePositiveZeroe " IndirectHeatPrimarySetpoint; !- Source Side Flow Control Mode"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data @@ -5215,7 +5287,17 @@ TEST_F(EnergyPlusFixture, StratifiedTank_WarningNumberOfNodes_FalsePositiveZeroe } } - EXPECT_TRUE(compare_err_stream("")); + std::string const error_string = delimited_string({" ** Warning ** ProcessScheduleInput: Schedule:Constant = HOT WATER SETPOINT TEMP SCHEDULE", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = AMBIENT TEMP SCHEDULE", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = HOT WATER DEMAND SCHEDULE", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated."}); + + EXPECT_TRUE(compare_err_stream(error_string)); } TEST_F(EnergyPlusFixture, StratifiedTank_WarningNumberOfNodes_ExpectedWarning) @@ -5294,6 +5376,7 @@ TEST_F(EnergyPlusFixture, StratifiedTank_WarningNumberOfNodes_ExpectedWarning) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data @@ -5315,6 +5398,15 @@ TEST_F(EnergyPlusFixture, StratifiedTank_WarningNumberOfNodes_ExpectedWarning) } std::string const error_string = delimited_string({ + " ** Warning ** ProcessScheduleInput: Schedule:Constant = HOT WATER SETPOINT TEMP SCHEDULE", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = AMBIENT TEMP SCHEDULE", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", + " ** Warning ** ProcessScheduleInput: Schedule:Constant = HOT WATER DEMAND SCHEDULE", + " ** ~~~ ** Schedule Type Limits Name is empty.", + " ** ~~~ ** Schedule will not be validated.", " ** Warning ** WaterHeater:Stratified = STRATIFIED TANK: More Additional Loss Coefficients were entered than the number of nodes; extra " "coefficients will not be used", }); @@ -5341,7 +5433,7 @@ TEST_F(EnergyPlusFixture, PlantMassFlowRatesFuncTest) Real64 result; Real64 expected = 0.0; Real64 answerTolerance = 1.0e-35; - Tank.UseSideAvailSchedNum = -1; + Tank.useSideAvailSched = Sched::GetScheduleAlwaysOn(*state); result = Tank.PlantMassFlowRatesFunc(*state, inNodeNum, @@ -5598,6 +5690,7 @@ TEST_F(EnergyPlusFixture, MixedTank_PVT_Per_VolumeSizing_PerSolarCollectorArea) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; HeatBalanceManager::GetHeatBalanceInput(*state); // Gets materials, constructions, zones, surfaces, etc. @@ -5635,6 +5728,8 @@ TEST_F(EnergyPlusFixture, MixedTank_PVT_Per_VolumeSizing_PerSolarCollectorArea) state->dataPlnt->PlantLoop.allocate(1); auto &plantLoop = state->dataPlnt->PlantLoop(1); + plantLoop.FluidName = "WATER"; + plantLoop.glycol = Fluid::GetWater(*state); auto &supplySide = plantLoop.LoopSide(DataPlant::LoopSideLocation::Supply); supplySide.TotalBranches = 1; supplySide.Branch.allocate(1); @@ -5694,7 +5789,7 @@ TEST_F(EnergyPlusFixture, MixedTank_PVT_Per_VolumeSizing_PerSolarCollectorArea) state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStepZone = 1.0 / 60.0; // one-minute system time step state->dataHVACGlobal->TimeStepSys = state->dataGlobal->TimeStepZone; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; Tank.SavedTankTemp = 60.0; Tank.TankTemp = 60.0; Tank.AmbientTempZone = 20.0; diff --git a/tst/EnergyPlus/unit/WaterToAirHeatPump.unit.cc b/tst/EnergyPlus/unit/WaterToAirHeatPump.unit.cc index 9b46f887f3f..4bce5dcf804 100644 --- a/tst/EnergyPlus/unit/WaterToAirHeatPump.unit.cc +++ b/tst/EnergyPlus/unit/WaterToAirHeatPump.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -136,11 +136,13 @@ TEST_F(EnergyPlusFixture, WaterToAirHeatPumpTest_SimWaterToAir) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + + auto *refrig = new Fluid::RefrigProps; - auto *refrig = new FluidProperties::RefrigProps; refrig->Name = "R22"; - state->dataFluidProps->refrigs.push_back(refrig); - refrig->Num = state->dataFluidProps->refrigs.isize(); + state->dataFluid->refrigs.push_back(refrig); + refrig->Num = state->dataFluid->refrigs.isize(); refrig->PsLowTempIndex = 1; refrig->PsHighTempIndex = 2; @@ -229,9 +231,8 @@ TEST_F(EnergyPlusFixture, WaterToAirHeatPumpTest_SimWaterToAir) } state->dataPlnt->PlantLoop(1).Name = "ChilledWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "ChilledWater"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = @@ -265,9 +266,8 @@ TEST_F(EnergyPlusFixture, WaterToAirHeatPumpTest_SimWaterToAir) HPNum = 2; state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).plantLoc.loopNum = 2; state->dataPlnt->PlantLoop(2).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(2).FluidName = "HotWater"; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).Name; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = @@ -309,5 +309,4 @@ TEST_F(EnergyPlusFixture, WaterToAirHeatPumpTest_SimWaterToAir) // clean up state->dataWaterToAirHeatPump->WatertoAirHP.deallocate(); - delete state->dataFluidProps->refrigs(1); } diff --git a/tst/EnergyPlus/unit/WaterToAirHeatPumpSimple.unit.cc b/tst/EnergyPlus/unit/WaterToAirHeatPumpSimple.unit.cc index 43a44b4d726..c519d2371a2 100644 --- a/tst/EnergyPlus/unit/WaterToAirHeatPumpSimple.unit.cc +++ b/tst/EnergyPlus/unit/WaterToAirHeatPumpSimple.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -76,6 +76,7 @@ using namespace EnergyPlus::Curve; TEST_F(EnergyPlusFixture, WaterToAirHeatPumpSimpleTest_SizeHVACWaterToAir) { + state->dataFluid->init_state(*state); // This unit test is intended to check if supply air Humidity ratio used in the cooling sizing calculation is // reset to the minimum of entering mixed air humidity ratio and the user specified supply air design Humidity // ratio such that the total cooling capacity is always greater than or equal to the sensible cooling capacity. @@ -186,6 +187,7 @@ TEST_F(EnergyPlusFixture, WaterToAirHeatPumpSimpleTest_SizeHVACWaterToAir) state->dataPlnt->PlantLoop.allocate(1); state->dataPlnt->PlantLoop(1).Name = "Condenser Water Loop"; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); auto &loopside(state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand)); loopside.TotalBranches = 1; loopside.Branch.allocate(1); @@ -362,6 +364,7 @@ TEST_F(EnergyPlusFixture, WaterToAirHeatPumpSimple_TestAirFlow) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetCurveInput(*state); GetSimpleWatertoAirHPInput(*state); @@ -398,9 +401,8 @@ TEST_F(EnergyPlusFixture, WaterToAirHeatPumpSimple_TestAirFlow) } state->dataPlnt->PlantLoop(1).Name = "ChilledWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "ChilledWater"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = @@ -482,9 +484,8 @@ TEST_F(EnergyPlusFixture, WaterToAirHeatPumpSimple_TestAirFlow) state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).plantLoc.loopNum = 2; state->dataPlnt->PlantLoop(2).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(2).FluidName = "HotWater"; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).Name; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = @@ -717,6 +718,7 @@ TEST_F(EnergyPlusFixture, WaterToAirHeatPumpSimple_TestWaterFlowControl) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); GetCurveInput(*state); GetSimpleWatertoAirHPInput(*state); @@ -752,9 +754,8 @@ TEST_F(EnergyPlusFixture, WaterToAirHeatPumpSimple_TestWaterFlowControl) } state->dataPlnt->PlantLoop(1).Name = "ChilledWaterLoop"; - state->dataPlnt->PlantLoop(1).FluidName = "ChilledWater"; - state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).Name; state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = @@ -825,9 +826,8 @@ TEST_F(EnergyPlusFixture, WaterToAirHeatPumpSimple_TestWaterFlowControl) HPNum = 2; state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).plantLoc.loopNum = 2; state->dataPlnt->PlantLoop(2).Name = "HotWaterLoop"; - state->dataPlnt->PlantLoop(2).FluidName = "HotWater"; - state->dataPlnt->PlantLoop(2).FluidIndex = 1; state->dataPlnt->PlantLoop(2).FluidName = "WATER"; + state->dataPlnt->PlantLoop(2).glycol = Fluid::GetWater(*state); state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).Name; state->dataPlnt->PlantLoop(2).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = @@ -1075,6 +1075,7 @@ TEST_F(EnergyPlusFixture, WaterToAirHeatPumpSimpleTest_CheckSimpleWAHPRatedCurve TEST_F(EnergyPlusFixture, WaterToAirHeatPumpSimpleTest_SizeHVACWaterToAirRatedConditions) { + state->dataFluid->init_state(*state); // This unit test is intended to check if the power calculated during the sizing routine // uses the user-specified COP at rated conditions @@ -1243,6 +1244,7 @@ TEST_F(EnergyPlusFixture, WaterToAirHeatPumpSimpleTest_SizeHVACWaterToAirRatedCo state->dataPlnt->PlantLoop.allocate(1); state->dataPlnt->PlantLoop(1).Name = "Condenser Water Loop"; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); auto &loopside(state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand)); loopside.TotalBranches = 1; loopside.Branch.allocate(1); @@ -1304,6 +1306,7 @@ TEST_F(EnergyPlusFixture, WaterToAirHeatPumpSimpleTest_SizeHVACWaterToAirRatedCo TEST_F(EnergyPlusFixture, WaterToAirHeatPumpSimpleTest_SizeHVACWaterToAirRatedConditionsNoDesHtgAirFlow) { + state->dataFluid->init_state(*state); // This unit test is similar as above but checks if the capacities can still be // correctly calculated when the design heating air flow rate is 0 @@ -1472,6 +1475,7 @@ TEST_F(EnergyPlusFixture, WaterToAirHeatPumpSimpleTest_SizeHVACWaterToAirRatedCo state->dataPlnt->PlantLoop.allocate(1); state->dataPlnt->PlantLoop(1).Name = "Condenser Water Loop"; state->dataPlnt->PlantLoop(1).FluidName = "WATER"; + state->dataPlnt->PlantLoop(1).glycol = Fluid::GetWater(*state); auto &loopside(state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand)); loopside.TotalBranches = 1; loopside.Branch.allocate(1); @@ -1598,6 +1602,8 @@ TEST_F(EnergyPlusFixture, EquationFit_Initialization) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); + std::string CurrentModuleObject = "Coil:Cooling:DX:VariableSpeed"; int num_coils = state->dataInputProcessing->inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); ASSERT_EQ(0, num_coils); diff --git a/tst/EnergyPlus/unit/WaterUse.unit.cc b/tst/EnergyPlus/unit/WaterUse.unit.cc index 61cc656bb85..8ed309daf94 100644 --- a/tst/EnergyPlus/unit/WaterUse.unit.cc +++ b/tst/EnergyPlus/unit/WaterUse.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -418,10 +418,10 @@ TEST_F(EnergyPlusFixture, WaterUse_WaterTempWarnings) ASSERT_TRUE(process_idf(idf_objects)); state->dataGlobal->CurrentTime = 0.25; - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedules - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); + state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataGlobal->HourOfDay = 1; @@ -431,7 +431,7 @@ TEST_F(EnergyPlusFixture, WaterUse_WaterTempWarnings) state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); InternalHeatGains::GetInternalHeatGainsInput(*state); @@ -462,8 +462,8 @@ TEST_F(EnergyPlusFixture, WaterUse_WaterTempWarnings) // configuration allows hot water mixing. A target temp schedule exists with either a hot temp schedule or a connnections object EXPECT_TRUE(thisWaterEquipment.allowHotControl); - EXPECT_TRUE(thisWaterEquipment.TargetTempSchedule); - EXPECT_TRUE(thisWaterEquipment.HotTempSchedule || thisWaterEquipment.Connections); + EXPECT_NE(thisWaterEquipment.targetTempSched, nullptr); + EXPECT_TRUE(thisWaterEquipment.hotTempSched != nullptr || thisWaterEquipment.Connections); EXPECT_GT(thisWaterEquipment.HotMassFlowRate, 0.0); EXPECT_NEAR(thisWaterEquipment.ColdMassFlowRate + thisWaterEquipment.HotMassFlowRate, thisWaterEquipment.TotalMassFlowRate, 0.00000001); @@ -472,7 +472,7 @@ TEST_F(EnergyPlusFixture, WaterUse_WaterTempWarnings) thisWaterConnections.InitConnections(*state); // Set target temperature to 50C, above hot water temperature to trigger warning - state->dataScheduleMgr->Schedule(4).CurrentValue = 50; + Sched::GetSchedule(*state, "WATER EQUIPMENT TEMP SCHED")->currentVal = 50; thisWaterEquipment.WaterEquipmentType::CalcEquipmentFlowRates(*state); std::string const error_string2 = delimited_string({ @@ -490,7 +490,7 @@ TEST_F(EnergyPlusFixture, WaterUse_WaterTempWarnings) EXPECT_NEAR(thisWaterEquipment.ColdMassFlowRate + thisWaterEquipment.HotMassFlowRate, thisWaterEquipment.TotalMassFlowRate, 0.00000001); // Set target temperature to 0C, below cold water temperature to trigger warning - state->dataScheduleMgr->Schedule(4).CurrentValue = 0; + Sched::GetSchedule(*state, "WATER EQUIPMENT TEMP SCHED")->currentVal = 0; thisWaterEquipment.WaterEquipmentType::CalcEquipmentFlowRates(*state); std::string const error_string3 = delimited_string({ @@ -855,10 +855,10 @@ TEST_F(EnergyPlusFixture, WaterUse_Default_Target_Temperature_Test1) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataGlobal->HourOfDay = 1; @@ -868,7 +868,7 @@ TEST_F(EnergyPlusFixture, WaterUse_Default_Target_Temperature_Test1) state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); InternalHeatGains::GetInternalHeatGainsInput(*state); @@ -887,10 +887,10 @@ TEST_F(EnergyPlusFixture, WaterUse_Default_Target_Temperature_Test1) // The target temp will default to the hot water temperature if there exists either a hot temp schedule or a water use connnections object. EXPECT_TRUE(thisWaterEquipment.allowHotControl); - EXPECT_FALSE(thisWaterEquipment.TargetTempSchedule); + EXPECT_EQ(thisWaterEquipment.targetTempSched, nullptr); EXPECT_NEAR(thisWaterEquipment.TargetTemp, 45, 1e-5); - EXPECT_TRUE(thisWaterEquipment.HotTempSchedule || thisWaterEquipment.Connections); + EXPECT_TRUE(thisWaterEquipment.hotTempSched != nullptr || thisWaterEquipment.Connections); EXPECT_GT(thisWaterEquipment.HotMassFlowRate, 0.0); EXPECT_NEAR(thisWaterEquipment.ColdMassFlowRate, 0.0, 1e-5); EXPECT_NEAR(thisWaterEquipment.ColdMassFlowRate + thisWaterEquipment.HotMassFlowRate, thisWaterEquipment.TotalMassFlowRate, 1e-8); @@ -1230,10 +1230,10 @@ TEST_F(EnergyPlusFixture, WaterUse_Default_Target_Temperature_Test2) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->dataGlobal->TimeStepsInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->init_state(*state); + state->dataEnvrn->Month = 1; state->dataEnvrn->DayOfMonth = 21; state->dataGlobal->HourOfDay = 1; @@ -1243,7 +1243,7 @@ TEST_F(EnergyPlusFixture, WaterUse_Default_Target_Temperature_Test2) state->dataEnvrn->HolidayIndex = 0; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); HeatBalanceManager::GetZoneData(*state, ErrorsFound); InternalHeatGains::GetInternalHeatGainsInput(*state); @@ -1257,10 +1257,10 @@ TEST_F(EnergyPlusFixture, WaterUse_Default_Target_Temperature_Test2) // A target temp will default to cold water temperature is there is neither a hot temp schedule nor a water use connnections object. EXPECT_FALSE(thisWaterEquipment.allowHotControl); - EXPECT_FALSE(thisWaterEquipment.TargetTempSchedule); + EXPECT_EQ(thisWaterEquipment.targetTempSched, nullptr); EXPECT_NEAR(thisWaterEquipment.TargetTemp, 15, 1e-5); - EXPECT_FALSE((thisWaterEquipment.TargetTempSchedule && thisWaterEquipment.HotTempSchedule) || thisWaterEquipment.Connections); + EXPECT_FALSE((thisWaterEquipment.targetTempSched != nullptr && thisWaterEquipment.hotTempSched != nullptr) || thisWaterEquipment.Connections); EXPECT_GT(thisWaterEquipment.ColdMassFlowRate, 0.0); EXPECT_NEAR(thisWaterEquipment.HotMassFlowRate, 0.0, 1e-5); diff --git a/tst/EnergyPlus/unit/WeatherManager.unit.cc b/tst/EnergyPlus/unit/WeatherManager.unit.cc index bbdcd682397..99bf29226c3 100644 --- a/tst/EnergyPlus/unit/WeatherManager.unit.cc +++ b/tst/EnergyPlus/unit/WeatherManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -77,7 +77,6 @@ #include using namespace EnergyPlus; -using namespace EnergyPlus::ScheduleManager; TEST_F(EnergyPlusFixture, SkyTempTest) { @@ -129,31 +128,27 @@ TEST_F(EnergyPlusFixture, SkyTempTest) }); ASSERT_TRUE(process_idf(idf_objects)); - Array2D TomorrowSkyTemp; // Sky temperature - state->dataGlobal->NumOfTimeStepInHour = 4; - state->dataGlobal->MinutesPerTimeStep = 60 / state->dataGlobal->NumOfTimeStepInHour; - TomorrowSkyTemp.allocate(state->dataGlobal->NumOfTimeStepInHour, 24); - TomorrowSkyTemp = 0.0; + state->dataGlobal->TimeStepsInHour = 4; + state->dataGlobal->MinutesInTimeStep = 60 / state->dataGlobal->TimeStepsInHour; + state->init_state(*state); + + auto *tSkySched = Sched::GetSchedule(*state, "TSKYSCHEDULE"); // Febuary 27 - ScheduleManager::GetScheduleValuesForDay(*state, 1, TomorrowSkyTemp, 58, 3); - EXPECT_NEAR(2.27, TomorrowSkyTemp(1, 1), .001); + + EXPECT_NEAR(2.27, tSkySched->getDayVals(*state, 58, 3)[0 * state->dataGlobal->TimeStepsInHour + 0], .001); // Febuary 28 - ScheduleManager::GetScheduleValuesForDay(*state, 1, TomorrowSkyTemp, 59, 4); - EXPECT_NEAR(2.28, TomorrowSkyTemp(1, 1), .001); + EXPECT_NEAR(2.28, tSkySched->getDayVals(*state, 59, 4)[0 * state->dataGlobal->TimeStepsInHour + 0], .001); // March 1 - ScheduleManager::GetScheduleValuesForDay(*state, 1, TomorrowSkyTemp, 60, 5); - EXPECT_NEAR(3.01, TomorrowSkyTemp(1, 1), .001); + EXPECT_NEAR(3.01, tSkySched->getDayVals(*state, 60, 5)[0 * state->dataGlobal->TimeStepsInHour + 0], .001); // Not March 2, this "Day" is ignored unless its a leap year, otherwise same data as March 1 - ScheduleManager::GetScheduleValuesForDay(*state, 1, TomorrowSkyTemp, 61, 6); - EXPECT_NEAR(3.01, TomorrowSkyTemp(1, 1), .001); + EXPECT_NEAR(3.01, tSkySched->getDayVals(*state, 61, 6)[0 * state->dataGlobal->TimeStepsInHour + 0], .001); // March 2 - ScheduleManager::GetScheduleValuesForDay(*state, 1, TomorrowSkyTemp, 62, 6); - EXPECT_NEAR(3.02, TomorrowSkyTemp(1, 1), .001); + EXPECT_NEAR(3.02, tSkySched->getDayVals(*state, 62, 6)[0 * state->dataGlobal->TimeStepsInHour + 0], .001); } TEST_F(EnergyPlusFixture, SkyEmissivityTest) @@ -318,6 +313,7 @@ TEST_F(EnergyPlusFixture, UnderwaterBoundaryConditionFullyPopulated) "Schedule:Constant, WaterVelocitySchedule, , 3.0;" "SurfaceProperty:OtherSideConditionsModel, UnderwaterSurfaceName, ConvectiveUnderwater;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // need to populate the OSCM array by calling the get input for it bool errorsFound = false; @@ -331,8 +327,8 @@ TEST_F(EnergyPlusFixture, UnderwaterBoundaryConditionFullyPopulated) EXPECT_EQ(state->dataWeather->underwaterBoundaries[0].Name, "UNDERWATERSURFACENAME"); EXPECT_NEAR(state->dataWeather->underwaterBoundaries[0].distanceFromLeadingEdge, 31.4159, 0.0001); EXPECT_EQ(state->dataWeather->underwaterBoundaries[0].OSCMIndex, 1); - EXPECT_EQ(state->dataWeather->underwaterBoundaries[0].WaterTempScheduleIndex, 1); - EXPECT_EQ(state->dataWeather->underwaterBoundaries[0].VelocityScheduleIndex, 2); + EXPECT_EQ(state->dataWeather->underwaterBoundaries[0].waterTempSched->Name, "WATERTEMPSCHEDULE"); + EXPECT_EQ(state->dataWeather->underwaterBoundaries[0].velocitySched->Name, "WATERVELOCITYSCHEDULE"); } TEST_F(EnergyPlusFixture, UnderwaterBoundaryConditionMissingVelocityOK) @@ -342,6 +338,7 @@ TEST_F(EnergyPlusFixture, UnderwaterBoundaryConditionMissingVelocityOK) "Schedule:Constant, WaterTempSchedule, , 30;", "SurfaceProperty:OtherSideConditionsModel, UnderwaterSurfaceName, ConvectiveUnderwater;"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); // need to populate the OSCM array by calling the get input for it bool errorsFound = false; @@ -355,8 +352,8 @@ TEST_F(EnergyPlusFixture, UnderwaterBoundaryConditionMissingVelocityOK) EXPECT_EQ(state->dataWeather->underwaterBoundaries[0].Name, "UNDERWATERSURFACENAME"); EXPECT_NEAR(state->dataWeather->underwaterBoundaries[0].distanceFromLeadingEdge, 31.4159, 0.0001); EXPECT_EQ(state->dataWeather->underwaterBoundaries[0].OSCMIndex, 1); - EXPECT_EQ(state->dataWeather->underwaterBoundaries[0].WaterTempScheduleIndex, 1); - EXPECT_EQ(state->dataWeather->underwaterBoundaries[0].VelocityScheduleIndex, 0); + EXPECT_NE(state->dataWeather->underwaterBoundaries[0].waterTempSched, nullptr); + EXPECT_EQ(state->dataWeather->underwaterBoundaries[0].velocitySched, nullptr); } TEST_F(EnergyPlusFixture, UnderwaterBoundaryConditionConvectionCoefficients) @@ -688,7 +685,7 @@ TEST_F(EnergyPlusFixture, ASHRAE_Tau2017ModelTest) bool ErrorsFound(false); state->dataEnvrn->TotDesDays = 2; - state->dataGlobal->NumOfTimeStepInHour = 0; + state->dataGlobal->TimeStepsInHour = 0; // setup environment state state->dataWeather->Environment.allocate(state->dataEnvrn->TotDesDays); state->dataWeather->DesignDay.allocate(state->dataEnvrn->TotDesDays); @@ -791,7 +788,7 @@ TEST_F(EnergyPlusFixture, WeatherManager_NoLocation) ASSERT_TRUE(process_idf(idf_objects)); state->dataGlobal->BeginSimFlag = false; - state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->TimeStepsInHour = 4; state->dataWeather->LocationGathered = false; bool Available{false}; @@ -816,7 +813,7 @@ TEST_F(EnergyPlusFixture, WeatherManager_NoLocation) } // Test for https://github.com/NREL/EnergyPlus/issues/7550 -TEST_F(SQLiteFixture, DesignDay_EnthalphyAtMaxDB) +TEST_F(SQLiteFixture, DesignDay_EnthalpyAtMaxDB) { state->dataSQLiteProcedures->sqlite->createSQLiteSimulationsRecord(1, "EnergyPlus Version", "Current Time"); @@ -874,8 +871,8 @@ TEST_F(SQLiteFixture, DesignDay_EnthalphyAtMaxDB) state->dataWeather->Environment(1).DesignDayNum = 1; state->dataWeather->Environment(1).WP_Type1 = 0; - state->dataGlobal->MinutesPerTimeStep = 60; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesInTimeStep = 60; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->BeginSimFlag = true; state->dataReportFlag->DoWeatherInitReporting = true; @@ -891,7 +888,7 @@ TEST_F(SQLiteFixture, DesignDay_EnthalphyAtMaxDB) unsigned n_RH_not100 = 0; for (int Hour = 1; Hour <= 24; ++Hour) { - for (int TS = 1; TS <= state->dataGlobal->NumOfTimeStepInHour; ++TS) { + for (int TS = 1; TS <= state->dataGlobal->TimeStepsInHour; ++TS) { EXPECT_GE(state->dataWeather->wvarsHrTsTomorrow(TS, Hour).OutRelHum, 0.); EXPECT_LE(state->dataWeather->wvarsHrTsTomorrow(TS, Hour).OutRelHum, 100.); if (state->dataWeather->wvarsHrTsTomorrow(TS, Hour).OutRelHum < 100.) { @@ -1145,7 +1142,7 @@ TEST_F(EnergyPlusFixture, IRHoriz_InterpretWeatherCalculateMissingIRHoriz) bool ErrorsFound(false); state->dataEnvrn->TotDesDays = 2; - state->dataGlobal->NumOfTimeStepInHour = 0; + state->dataGlobal->TimeStepsInHour = 0; // setup environment state state->dataWeather->Environment.allocate(state->dataEnvrn->TotDesDays); @@ -1157,7 +1154,7 @@ TEST_F(EnergyPlusFixture, IRHoriz_InterpretWeatherCalculateMissingIRHoriz) state->dataWeather->Envrn = 1; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataWeather->Environment.allocate(1); state->dataWeather->Environment(1).skyTempModel = Weather::SkyTempModel::ClarkAllen; @@ -1220,6 +1217,8 @@ TEST_F(EnergyPlusFixture, Add_and_InterpolateWeatherInputOutputTest) bool ErrorsFound(false); ErrorsFound = false; + state->init_state(*state); + state->dataWeather->WeatherFileExists = true; state->files.inputWeatherFilePath.filePath = configured_source_directory() / "weather/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw"; @@ -1249,7 +1248,7 @@ TEST_F(EnergyPlusFixture, Add_and_InterpolateWeatherInputOutputTest) state->dataWeather->Envrn = 1; - state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->TimeStepsInHour = 4; state->dataWeather->Environment.allocate(1); state->dataWeather->Environment(1).skyTempModel = Weather::SkyTempModel::ClarkAllen; state->dataWeather->Environment(1).StartMonth = 1; @@ -1319,6 +1318,8 @@ TEST_F(EnergyPlusFixture, Fix_first_hour_weather_data_interpolation_OutputTest) bool ErrorsFound(false); ErrorsFound = false; + state->init_state(*state); + state->dataWeather->WeatherFileExists = true; state->files.inputWeatherFilePath.filePath = configured_source_directory() / "weather/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw"; @@ -1333,7 +1334,7 @@ TEST_F(EnergyPlusFixture, Fix_first_hour_weather_data_interpolation_OutputTest) // The added first hour processing will be called here: Weather::GetNextEnvironment(*state, Available, ErrorsFound); - state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->TimeStepsInHour = 4; state->dataWeather->Environment(1).skyTempModel = Weather::SkyTempModel::ClarkAllen; state->dataWeather->Environment(1).StartMonth = 1; state->dataWeather->Environment(1).StartDay = 1; @@ -1444,8 +1445,9 @@ TEST_F(EnergyPlusFixture, Fix_OpaqueSkyCover_Test) ASSERT_TRUE(process_idf(idf_objects)); SimulationManager::PostIPProcessing(*state); + state->init_state(*state); + bool ErrorsFound(false); - ErrorsFound = false; state->dataWeather->WeatherFileExists = true; state->files.inputWeatherFilePath.filePath = configured_source_directory() / "weather/USA_IL_University.of.Illinois-Willard.AP.725315_TMY3.epw"; @@ -1469,7 +1471,7 @@ TEST_F(EnergyPlusFixture, Fix_OpaqueSkyCover_Test) state->dataWeather->Envrn = 1; - state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->TimeStepsInHour = 4; state->dataWeather->Environment.allocate(1); state->dataWeather->Environment(1).skyTempModel = Weather::SkyTempModel::ClarkAllen; state->dataWeather->Environment(1).StartMonth = 1; @@ -1583,16 +1585,19 @@ TEST_F(EnergyPlusFixture, WeatherManager_SetRainFlag) // setting up start ------------------------------------------------------------------------------ ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::ManageSimulation(*state); - WaterManager::GetWaterManagerInput(*state); state->dataGlobal->DayOfSim = 2; // avoid array bounds problem in RecKeepHeatBalance state->dataWeather->Envrn = 1; - state->dataGlobal->NumOfTimeStepInHour = 4; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized + state->dataGlobal->TimeStepsInHour = 4; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 15; // must initialize this to get schedules initialized state->dataGlobal->TimeStepZone = 0.25; - state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * Constant::SecInHour; + state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * Constant::rSecsInHour; + + state->init_state(*state); + + SimulationManager::ManageSimulation(*state); + WaterManager::GetWaterManagerInput(*state); - ScheduleManager::ProcessScheduleInput(*state); // read schedules + state->dataWeather->Envrn = 1; state->dataEnvrn->Month = 5; state->dataEnvrn->DayOfMonth = 31; @@ -1603,16 +1608,16 @@ TEST_F(EnergyPlusFixture, WeatherManager_SetRainFlag) state->dataGlobal->TimeStep = 1; state->dataEnvrn->DayOfYear_Schedule = General::OrdinalDay(state->dataEnvrn->Month, state->dataEnvrn->DayOfMonth, 1); state->dataEnvrn->DSTIndicator = 0; // DST IS OFF - ScheduleManager::UpdateScheduleValues(*state); + Sched::UpdateScheduleVals(*state); - state->dataWeather->Interpolation.allocate(state->dataGlobal->NumOfTimeStepInHour); + state->dataWeather->Interpolation.allocate(state->dataGlobal->TimeStepsInHour); state->dataWeather->Interpolation = 0; // setting up end ------------------------------------------------------------------------------ // Need to instantiate some stuff to avoid a crash // Weather::ReadUserWeatherInput(*state); - state->dataWeather->wvarsHrTsToday.allocate(state->dataGlobal->NumOfTimeStepInHour, Constant::HoursInDay); + state->dataWeather->wvarsHrTsToday.allocate(state->dataGlobal->TimeStepsInHour, Constant::iHoursInDay); state->dataWeather->wvarsHrTsToday(1, 24).IsRain = false; state->dataEnvrn->RunPeriodEnvironment = true; Weather::SetCurrentWeather(*state); @@ -1626,7 +1631,7 @@ TEST_F(EnergyPlusFixture, WeatherManager_SetRainFlag) ASSERT_FALSE(state->dataEnvrn->IsRain); // site:precipitation overwritten of rain flag does not take effect during sizing period - state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->TimeStepsInHour = 4; state->dataWeather->wvarsHrTsToday(1, 24).IsRain = false; state->dataEnvrn->RunPeriodEnvironment = false; Weather::SetCurrentWeather(*state); @@ -1842,7 +1847,7 @@ TEST_F(EnergyPlusFixture, WeatherRunPeriod_WeatherFile_OK) state->files.inputWeatherFilePath.filePath = configured_source_directory() / "weather/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw"; state->dataGlobal->BeginSimFlag = false; - state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->TimeStepsInHour = 4; state->dataWeather->LocationGathered = false; state->dataGlobal->DoWeathSim = true; @@ -1899,7 +1904,7 @@ TEST_F(EnergyPlusFixture, WeatherRunPeriod_WeatherFile_Missing) state->files.inputWeatherFilePath.filePath = "doesntnotexist.epw"; state->dataGlobal->BeginSimFlag = false; - state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->TimeStepsInHour = 4; state->dataWeather->LocationGathered = false; state->dataGlobal->DoWeathSim = true; @@ -2477,7 +2482,7 @@ TEST_F(EnergyPlusFixture, EPW_no_eol_at_end_of_file) state->files.inputWeatherFilePath.filePath = configured_source_directory() / "tst/EnergyPlus/unit/Resources/chicago_no_eol_at_end_of_file.epw"; state->dataGlobal->BeginSimFlag = false; - state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->TimeStepsInHour = 4; state->dataWeather->LocationGathered = false; state->dataGlobal->DoWeathSim = true; diff --git a/tst/EnergyPlus/unit/WinCalcEngine.unit.cc b/tst/EnergyPlus/unit/WinCalcEngine.unit.cc index 61c6e3fe43d..e8dc18a703d 100644 --- a/tst/EnergyPlus/unit/WinCalcEngine.unit.cc +++ b/tst/EnergyPlus/unit/WinCalcEngine.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/WindTurbine.unit.cc b/tst/EnergyPlus/unit/WindTurbine.unit.cc index 16cdd3704c3..94d7dabfd88 100644 --- a/tst/EnergyPlus/unit/WindTurbine.unit.cc +++ b/tst/EnergyPlus/unit/WindTurbine.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -88,6 +88,7 @@ TEST_F(EnergyPlusFixture, WindTurbineTest) " 21; !- Power Coefficient C6"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); WindTurbine::GetWindTurbineInput(*state); int index = 0; diff --git a/tst/EnergyPlus/unit/WindowAC.unit.cc b/tst/EnergyPlus/unit/WindowAC.unit.cc index 8051717dbf3..2f73f77ed32 100644 --- a/tst/EnergyPlus/unit/WindowAC.unit.cc +++ b/tst/EnergyPlus/unit/WindowAC.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -435,10 +435,9 @@ TEST_F(EnergyPlusFixture, WindowAC_VStest1) }); ASSERT_TRUE(process_idf(idf_objects)); - - state->dataGlobal->NumOfTimeStepInHour = 6; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 10; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(*state); // read schedule data + state->dataGlobal->TimeStepsInHour = 6; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 10; // must initialize this to get schedules initialized + state->init_state(*state); bool errorsFound(false); HeatBalanceManager::GetProjectControlData(*state, errorsFound); // read project control data diff --git a/tst/EnergyPlus/unit/WindowEquivalentLayer.unit.cc b/tst/EnergyPlus/unit/WindowEquivalentLayer.unit.cc index f139375a41e..5d2becee001 100644 --- a/tst/EnergyPlus/unit/WindowEquivalentLayer.unit.cc +++ b/tst/EnergyPlus/unit/WindowEquivalentLayer.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -88,7 +88,6 @@ using namespace EnergyPlus; using namespace EnergyPlus::DataZoneEquipment; using namespace EnergyPlus::HeatBalanceManager; -using namespace EnergyPlus::ScheduleManager; using namespace EnergyPlus::WindowEquivalentLayer; @@ -1973,7 +1972,7 @@ TEST_F(EnergyPlusFixture, WindowEquivalentLayer_VBEffectiveEmissivityTest) // get venetian blind material index int VBMatNum = Material::GetMaterialNum(*state, "WMTEUQL_BLND_KINDV_RF80_T02_A18_Rb45"); auto const *matVenetBlind = dynamic_cast(state->dataMaterial->materials(VBMatNum)); - // get equivalent layer window contruction index + // get equivalent layer window construction index for (int ConstrPtr = 1; ConstrPtr <= state->dataHeatBal->TotConstructs; ++ConstrPtr) { if (state->dataConstruction->Construct(ConstrPtr).WindowTypeEQL) { ConstrNum = ConstrPtr; diff --git a/tst/EnergyPlus/unit/WindowLayerEffectiveMultipliers.unit.cc b/tst/EnergyPlus/unit/WindowLayerEffectiveMultipliers.unit.cc index b81e4200e80..a39f167675f 100644 --- a/tst/EnergyPlus/unit/WindowLayerEffectiveMultipliers.unit.cc +++ b/tst/EnergyPlus/unit/WindowLayerEffectiveMultipliers.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/WindowManager.unit.cc b/tst/EnergyPlus/unit/WindowManager.unit.cc index c7fc9400de5..2666e71e242 100644 --- a/tst/EnergyPlus/unit/WindowManager.unit.cc +++ b/tst/EnergyPlus/unit/WindowManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -192,17 +192,16 @@ TEST_F(EnergyPlusFixture, WindowFrameTest) " autocalculate; !- Volume {m3}"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); createFacilityElectricPowerServiceObject(*state); HeatBalanceManager::SetPreConstructionInputParameters(*state); - Psychrometrics::InitializePsychRoutines(*state); - state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStepZone = 1; state->dataGlobal->TimeStepZoneSec = 60.0; state->dataGlobal->HourOfDay = 1; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->BeginSimFlag = true; state->dataGlobal->BeginEnvrnFlag = true; state->dataEnvrn->OutBaroPress = 100000; @@ -465,6 +464,7 @@ TEST_F(EnergyPlusFixture, WindowManager_RefAirTempTest) " autocalculate; !- Volume {m3}"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); state->dataHeatBal->ZoneIntGain.allocate(1); @@ -476,13 +476,11 @@ TEST_F(EnergyPlusFixture, WindowManager_RefAirTempTest) HeatBalanceManager::GetConstructData(*state, ErrorsFound); HeatBalanceManager::GetBuildingData(*state, ErrorsFound); - Psychrometrics::InitializePsychRoutines(*state); - state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStepZone = 1; state->dataGlobal->TimeStepZoneSec = 3600.0; state->dataGlobal->HourOfDay = 1; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->BeginSimFlag = true; state->dataGlobal->BeginEnvrnFlag = true; state->dataEnvrn->OutBaroPress = 100000; @@ -2521,14 +2519,14 @@ TEST_F(EnergyPlusFixture, SpectralAngularPropertyTest) state->dataSurfaceGeometry->CosZoneRelNorth.allocate(4); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(4); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->CosZoneRelNorth(3) = std::cos(-state->dataHeatBal->Zone(3).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->CosZoneRelNorth(4) = std::cos(-state->dataHeatBal->Zone(4).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(3) = std::sin(-state->dataHeatBal->Zone(3).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(4) = std::sin(-state->dataHeatBal->Zone(4).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->CosZoneRelNorth(3) = std::cos(-state->dataHeatBal->Zone(3).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->CosZoneRelNorth(4) = std::cos(-state->dataHeatBal->Zone(4).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-state->dataHeatBal->Zone(2).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(3) = std::sin(-state->dataHeatBal->Zone(3).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(4) = std::sin(-state->dataHeatBal->Zone(4).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; @@ -2699,7 +2697,8 @@ TEST_F(EnergyPlusFixture, WindowManager_SrdLWRTest) " autocalculate; !- Volume {m3}"}); ASSERT_TRUE(process_idf(idf_objects)); - ScheduleManager::ProcessScheduleInput(*state); + state->init_state(*state); + state->dataHeatBal->ZoneIntGain.allocate(1); createFacilityElectricPowerServiceObject(*state); @@ -2714,7 +2713,7 @@ TEST_F(EnergyPlusFixture, WindowManager_SrdLWRTest) state->dataGlobal->TimeStepZone = 1; state->dataGlobal->TimeStepZoneSec = 3600.0; state->dataGlobal->HourOfDay = 1; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->BeginSimFlag = true; state->dataGlobal->BeginEnvrnFlag = true; state->dataEnvrn->OutBaroPress = 100000; @@ -2725,8 +2724,6 @@ TEST_F(EnergyPlusFixture, WindowManager_SrdLWRTest) EXPECT_TRUE(state->dataGlobal->AnyLocalEnvironmentsInModel); - Psychrometrics::InitializePsychRoutines(*state); - state->dataZoneEquip->ZoneEquipConfig.allocate(1); state->dataZoneEquip->ZoneEquipConfig(1).ZoneName = "Zone"; std::vector controlledZoneEquipConfigNums; @@ -2805,7 +2802,7 @@ TEST_F(EnergyPlusFixture, WindowManager_SrdLWRTest) Real64 inSurfTemp; Real64 outSurfTemp; - state->dataScheduleMgr->Schedule(1).CurrentValue = 25.0; // Srd Srfs Temp + Sched::GetSchedule(*state, "SURROUNDING TEMP SCH 1")->currentVal = 25.0; // Srd Srfs Temp // Calculate temperature based on supply flow rate HeatBalanceSurfaceManager::InitSurfacePropertyViewFactors(*state); @@ -7642,17 +7639,16 @@ TEST_F(EnergyPlusFixture, CFS_InteriorSolarDistribution_Test) " 2.500000, 0.790000, 0.053000, 0.063000; !- N1764"}); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); createFacilityElectricPowerServiceObject(*state); HeatBalanceManager::SetPreConstructionInputParameters(*state); - Psychrometrics::InitializePsychRoutines(*state); - state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStepZone = 1; state->dataGlobal->TimeStepZoneSec = 60.0; state->dataGlobal->HourOfDay = 1; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->BeginSimFlag = true; state->dataGlobal->BeginEnvrnFlag = true; state->dataEnvrn->OutBaroPress = 101325.0; diff --git a/tst/EnergyPlus/unit/WindowManagerExteriorThermal.unit.cc b/tst/EnergyPlus/unit/WindowManagerExteriorThermal.unit.cc index 04b4ec8b74f..cd1a488a352 100644 --- a/tst/EnergyPlus/unit/WindowManagerExteriorThermal.unit.cc +++ b/tst/EnergyPlus/unit/WindowManagerExteriorThermal.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -674,15 +674,14 @@ TEST_F(EnergyPlusFixture, test_GetWindowAssemblyNfrcForReport_withIDF) }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); - SimulationManager::GetProjectData(*state); bool FoundError = false; HeatBalanceManager::GetProjectControlData(*state, FoundError); // read project control data EXPECT_FALSE(FoundError); // expect no errors HeatBalanceManager::SetPreConstructionInputParameters(*state); - ScheduleManager::ProcessScheduleInput(*state); // read schedules Material::GetMaterialData(*state, FoundError); EXPECT_FALSE(FoundError); @@ -701,8 +700,8 @@ TEST_F(EnergyPlusFixture, test_GetWindowAssemblyNfrcForReport_withIDF) state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); - state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRadians); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-state->dataHeatBal->Zone(1).RelNorth * Constant::DegToRad); state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; diff --git a/tst/EnergyPlus/unit/XingGroundTemperatureModel.unit.cc b/tst/EnergyPlus/unit/XingGroundTemperatureModel.unit.cc index 0f4655d0fb0..49c83c221ca 100644 --- a/tst/EnergyPlus/unit/XingGroundTemperatureModel.unit.cc +++ b/tst/EnergyPlus/unit/XingGroundTemperatureModel.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -52,12 +52,11 @@ // EnergyPlus Headers #include "EnergyPlus/DataIPShortCuts.hh" -#include "EnergyPlus/GroundTemperatureModeling/GroundTemperatureModelManager.hh" +#include "EnergyPlus/GroundTemperatureModeling/BaseGroundTemperatureModel.hh" #include "Fixtures/EnergyPlusFixture.hh" #include using namespace EnergyPlus; -using namespace EnergyPlus::GroundTemperatureManager; TEST_F(EnergyPlusFixture, XingGroundTempsModelTest) { @@ -67,7 +66,7 @@ TEST_F(EnergyPlusFixture, XingGroundTempsModelTest) " 1.08, !- Soil Thermal Conductivity {W/m-K}", " 962, !- Soil Density {kg/m3}", " 2576, !- Soil Specific Heat {J/kg-K}", - " 11.1, !- Average Soil Surface Tempeature {C}", + " 11.1, !- Average Soil Surface Temperature {C}", " 13.4, !- Soil Surface Temperature Amplitude 1 {deltaC}", " 0.7, !- Soil Surface Temperature Amplitude 2 {deltaC}", " 25, !- Phase Shift of Temperature Amplitude 1 {days}", @@ -76,9 +75,7 @@ TEST_F(EnergyPlusFixture, XingGroundTempsModelTest) ASSERT_TRUE(process_idf(idf_objects)); - std::string const CurrentModuleObject = static_cast(groundTempModelNamesUC[static_cast(GroundTempObjType::XingGroundTemp)]); - - auto thisModel = GetGroundTempModelAndInit(*state, CurrentModuleObject, "TEST"); + auto *thisModel = GroundTemp::GetGroundTempModelAndInit(*state, GroundTemp::ModelType::Xing, "TEST"); EXPECT_NEAR(-1.43, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 0.0), 0.01); EXPECT_NEAR(2.15, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 6393600), 0.1); // March 15 diff --git a/tst/EnergyPlus/unit/ZoneContaminantPredictorCorrector.unit.cc b/tst/EnergyPlus/unit/ZoneContaminantPredictorCorrector.unit.cc index ecb8a34cd0d..ba0e02f0de3 100644 --- a/tst/EnergyPlus/unit/ZoneContaminantPredictorCorrector.unit.cc +++ b/tst/EnergyPlus/unit/ZoneContaminantPredictorCorrector.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -94,6 +94,7 @@ using namespace EnergyPlus::ZoneContaminantPredictorCorrector; TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_AddMDotOATest) { + state->init_state(*state); state->dataHVACGlobal->ShortenTimeStepSys = false; state->dataHVACGlobal->UseZoneTimeStepHistory = false; @@ -163,7 +164,7 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_AddMDotOATest) Real64 PriorTimeStep; state->dataHVACGlobal->TimeStepSys = 15.0 / 60.0; // System timestep in hours - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; PriorTimeStep = state->dataHVACGlobal->TimeStepSys; state->dataZoneEquip->ZoneEquipConfig.allocate(1); @@ -198,9 +199,6 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_AddMDotOATest) state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MDotOA = 0.001; - state->dataScheduleMgr->Schedule.allocate(1); - - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; state->dataHeatBal->ZoneAirSolutionAlgo = DataHeatBalance::SolutionAlgo::EulerMethod; @@ -224,7 +222,8 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_AddMDotOATest) state->dataContaminantBalance->ContaminantControlledZone.allocate(1); - state->dataContaminantBalance->ContaminantControlledZone(1).AvaiSchedPtr = 1; + state->dataContaminantBalance->ContaminantControlledZone(1).availSched = Sched::GetScheduleAlwaysOn(*state); + state->dataContaminantBalance->ContaminantControlledZone(1).genericContamAvailSched = Sched::GetScheduleAlwaysOn(*state); state->dataContaminantBalance->ContaminantControlledZone(1).ActualZoneNum = 1; state->dataContaminantBalance->ContaminantControlledZone(1).NumOfZones = 1; state->dataContaminantBalance->ZoneGCSetPoint(1) = 0.0025; @@ -240,6 +239,7 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_AddMDotOATest) TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_CorrectZoneContaminantsTest) { + state->init_state(*state); state->dataHVACGlobal->ShortenTimeStepSys = false; state->dataHVACGlobal->UseZoneTimeStepHistory = false; @@ -298,7 +298,7 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_CorrectZoneContamina state->dataContaminantBalance->ZoneGC1(1) = state->dataContaminantBalance->OutdoorGC; state->dataHVACGlobal->TimeStepSys = 15.0 / 60.0; // System timestep in hours - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; state->dataZoneEquip->ZoneEquipConfig.allocate(1); state->dataZoneEquip->ZoneEquipConfig(1).ZoneName = "Zone 1"; @@ -356,6 +356,7 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_CorrectZoneContamina TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_MultiZoneCO2ControlTest) { + state->init_state(*state); state->dataHVACGlobal->ShortenTimeStepSys = false; state->dataHVACGlobal->UseZoneTimeStepHistory = false; @@ -427,7 +428,7 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_MultiZoneCO2ControlT Real64 PriorTimeStep; state->dataHVACGlobal->TimeStepSys = 15.0 / 60.0; // System timestep in hours - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; PriorTimeStep = state->dataHVACGlobal->TimeStepSys; state->dataZoneEquip->ZoneEquipConfig.allocate(3); @@ -497,9 +498,6 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_MultiZoneCO2ControlT state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MDotOA = 0.001; state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).MDotOA = 0.001; state->dataZoneTempPredictorCorrector->zoneHeatBalance(3).MDotOA = 0.001; - state->dataScheduleMgr->Schedule.allocate(1); - - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; state->dataHeatBal->ZoneAirSolutionAlgo = DataHeatBalance::SolutionAlgo::EulerMethod; @@ -534,13 +532,16 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_MultiZoneCO2ControlT state->dataContaminantBalance->ContaminantControlledZone.allocate(3); - state->dataContaminantBalance->ContaminantControlledZone(1).AvaiSchedPtr = 1; + state->dataContaminantBalance->ContaminantControlledZone(1).availSched = Sched::GetScheduleAlwaysOn(*state); + state->dataContaminantBalance->ContaminantControlledZone(1).genericContamAvailSched = Sched::GetScheduleAlwaysOn(*state); state->dataContaminantBalance->ContaminantControlledZone(1).ActualZoneNum = 1; state->dataContaminantBalance->ContaminantControlledZone(1).NumOfZones = 1; - state->dataContaminantBalance->ContaminantControlledZone(2).AvaiSchedPtr = 1; + state->dataContaminantBalance->ContaminantControlledZone(2).availSched = Sched::GetScheduleAlwaysOn(*state); + state->dataContaminantBalance->ContaminantControlledZone(2).genericContamAvailSched = Sched::GetScheduleAlwaysOn(*state); state->dataContaminantBalance->ContaminantControlledZone(2).ActualZoneNum = 2; state->dataContaminantBalance->ContaminantControlledZone(2).NumOfZones = 1; - state->dataContaminantBalance->ContaminantControlledZone(3).AvaiSchedPtr = 1; + state->dataContaminantBalance->ContaminantControlledZone(3).availSched = Sched::GetScheduleAlwaysOn(*state); + state->dataContaminantBalance->ContaminantControlledZone(3).genericContamAvailSched = Sched::GetScheduleAlwaysOn(*state); state->dataContaminantBalance->ContaminantControlledZone(3).ActualZoneNum = 3; state->dataContaminantBalance->ContaminantControlledZone(3).NumOfZones = 1; @@ -552,6 +553,7 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_MultiZoneCO2ControlT TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_MultiZoneGCControlTest) { + state->init_state(*state); state->dataHVACGlobal->ShortenTimeStepSys = false; state->dataHVACGlobal->UseZoneTimeStepHistory = false; @@ -613,7 +615,7 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_MultiZoneGCControlTe Real64 PriorTimeStep; state->dataHVACGlobal->TimeStepSys = 15.0 / 60.0; // System timestep in hours - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; PriorTimeStep = state->dataHVACGlobal->TimeStepSys; state->dataZoneEquip->ZoneEquipConfig.allocate(3); @@ -683,9 +685,6 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_MultiZoneGCControlTe state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MDotOA = 0.001; state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).MDotOA = 0.001; state->dataZoneTempPredictorCorrector->zoneHeatBalance(3).MDotOA = 0.001; - state->dataScheduleMgr->Schedule.allocate(1); - - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; state->dataHeatBal->ZoneAirSolutionAlgo = DataHeatBalance::SolutionAlgo::EulerMethod; @@ -722,13 +721,16 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_MultiZoneGCControlTe state->dataContaminantBalance->ContaminantControlledZone.allocate(3); - state->dataContaminantBalance->ContaminantControlledZone(1).AvaiSchedPtr = 1; + state->dataContaminantBalance->ContaminantControlledZone(1).availSched = Sched::GetScheduleAlwaysOn(*state); + state->dataContaminantBalance->ContaminantControlledZone(1).genericContamAvailSched = Sched::GetScheduleAlwaysOn(*state); state->dataContaminantBalance->ContaminantControlledZone(1).ActualZoneNum = 1; state->dataContaminantBalance->ContaminantControlledZone(1).NumOfZones = 1; - state->dataContaminantBalance->ContaminantControlledZone(2).AvaiSchedPtr = 1; + state->dataContaminantBalance->ContaminantControlledZone(2).availSched = Sched::GetScheduleAlwaysOn(*state); + state->dataContaminantBalance->ContaminantControlledZone(2).genericContamAvailSched = Sched::GetScheduleAlwaysOn(*state); state->dataContaminantBalance->ContaminantControlledZone(2).ActualZoneNum = 2; state->dataContaminantBalance->ContaminantControlledZone(2).NumOfZones = 1; - state->dataContaminantBalance->ContaminantControlledZone(3).AvaiSchedPtr = 1; + state->dataContaminantBalance->ContaminantControlledZone(3).availSched = Sched::GetScheduleAlwaysOn(*state); + state->dataContaminantBalance->ContaminantControlledZone(3).genericContamAvailSched = Sched::GetScheduleAlwaysOn(*state); state->dataContaminantBalance->ContaminantControlledZone(3).ActualZoneNum = 3; state->dataContaminantBalance->ContaminantControlledZone(3).NumOfZones = 1; diff --git a/tst/EnergyPlus/unit/ZoneEquipmentManager.unit.cc b/tst/EnergyPlus/unit/ZoneEquipmentManager.unit.cc index 86ba25331bb..89714c3827c 100644 --- a/tst/EnergyPlus/unit/ZoneEquipmentManager.unit.cc +++ b/tst/EnergyPlus/unit/ZoneEquipmentManager.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -93,7 +93,6 @@ using namespace EnergyPlus::HVACManager; TEST_F(EnergyPlusFixture, ZoneEquipmentManager_CalcZoneMassBalanceTest) { - std::string const idf_objects = delimited_string({ "Zone,", " Space; !- Name", @@ -135,6 +134,8 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_CalcZoneMassBalanceTest) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); + state->init_state(*state); + bool ErrorsFound = false; GetZoneData(*state, ErrorsFound); AllocateHeatBalArrays(*state); @@ -179,7 +180,6 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_CalcZoneMassBalanceTest) TEST_F(EnergyPlusFixture, ZoneEquipmentManager_MultiCrossMixingTest) { - std::string const idf_objects = delimited_string({ " Zone,", " SPACE1-1, !- Name", @@ -389,8 +389,8 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_MultiCrossMixingTest) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); + state->init_state(*state); bool ErrorsFound = false; - ScheduleManager::ProcessScheduleInput(*state); GetZoneData(*state, ErrorsFound); state->dataHeatBalFanSys->ZoneReOrder.allocate(state->dataGlobal->NumOfZones); @@ -412,12 +412,12 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_MultiCrossMixingTest) state->dataZoneTempPredictorCorrector->zoneHeatBalance(5).airHumRat = 0.001; state->dataHeatBal->AirFlowFlag = true; - state->dataScheduleMgr->Schedule(ScheduleManager::GetScheduleIndex(*state, "MIXINGAVAILSCHED")).CurrentValue = 1.0; - state->dataScheduleMgr->Schedule(ScheduleManager::GetScheduleIndex(*state, "MININDOORTEMP")).CurrentValue = 18.0; - state->dataScheduleMgr->Schedule(ScheduleManager::GetScheduleIndex(*state, "MAXINDOORTEMP")).CurrentValue = 100.0; - state->dataScheduleMgr->Schedule(ScheduleManager::GetScheduleIndex(*state, "DELTATEMP")).CurrentValue = 2.0; - state->dataScheduleMgr->Schedule(ScheduleManager::GetScheduleIndex(*state, "MINOUTDOORTEMP")).CurrentValue = -100.0; - state->dataScheduleMgr->Schedule(ScheduleManager::GetScheduleIndex(*state, "MAXOUTDOORTEMP")).CurrentValue = 100.0; + Sched::GetSchedule(*state, "MIXINGAVAILSCHED")->currentVal = 1.0; + Sched::GetSchedule(*state, "MININDOORTEMP")->currentVal = 18.0; + Sched::GetSchedule(*state, "MAXINDOORTEMP")->currentVal = 100.0; + Sched::GetSchedule(*state, "DELTATEMP")->currentVal = 2.0; + Sched::GetSchedule(*state, "MINOUTDOORTEMP")->currentVal = -100.0; + Sched::GetSchedule(*state, "MAXOUTDOORTEMP")->currentVal = 100.0; state->dataEnvrn->OutBaroPress = 101325.0; InitSimpleMixingConvectiveHeatGains(*state); @@ -444,7 +444,6 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_MultiCrossMixingTest) TEST_F(EnergyPlusFixture, ZoneEquipmentManager_CalcZoneMassBalanceTest2) { - std::string const idf_objects = delimited_string({ "Zone,", " Space; !- Name", @@ -498,6 +497,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_CalcZoneMassBalanceTest2) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); + state->init_state(*state); bool ErrorsFound = false; GetZoneData(*state, ErrorsFound); AllocateHeatBalArrays(*state); @@ -583,7 +583,6 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_CalcZoneMassBalanceTest2) TEST_F(EnergyPlusFixture, ZoneEquipmentManager_CalcZoneMassBalanceTest3) { - std::string const idf_objects = delimited_string({ "Zone,", " Space; !- Name", @@ -632,6 +631,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_CalcZoneMassBalanceTest3) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); + state->init_state(*state); bool ErrorsFound = false; GetZoneData(*state, ErrorsFound); AllocateHeatBalArrays(*state); @@ -680,7 +680,6 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_CalcZoneMassBalanceTest3) TEST_F(EnergyPlusFixture, ZoneEquipmentManager_CalcZoneMassBalanceTest4) { - std::string const idf_objects = delimited_string({ "Zone,", " Space; !- Name", @@ -732,6 +731,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_CalcZoneMassBalanceTest4) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); + state->init_state(*state); bool ErrorsFound = false; GetZoneData(*state, ErrorsFound); AllocateHeatBalArrays(*state); @@ -841,7 +841,6 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_CalcZoneMassBalanceTest4) TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialLoad) { - std::string const idf_objects = delimited_string({ "Zone,", " Space; !- Name", @@ -925,6 +924,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialLoad) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); + state->init_state(*state); bool ErrorsFound = false; GetZoneData(*state, ErrorsFound); AllocateHeatBalArrays(*state); @@ -1016,7 +1016,6 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialLoad) TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeUniformLoad) { - std::string const idf_objects = delimited_string({ "Zone,", " Space; !- Name", @@ -1100,6 +1099,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeUniformLoad) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); + state->init_state(*state); bool ErrorsFound = false; GetZoneData(*state, ErrorsFound); AllocateHeatBalArrays(*state); @@ -1202,7 +1202,6 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeUniformLoad) TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeUniformPLR) { - std::string const idf_objects = delimited_string({ "Zone,", " Space; !- Name", @@ -1286,6 +1285,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeUniformPLR) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); + state->init_state(*state); bool ErrorsFound = false; GetZoneData(*state, ErrorsFound); AllocateHeatBalArrays(*state); @@ -1311,7 +1311,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeUniformPLR) // Set up capacities for PLR calcs state->dataSize->FinalZoneSizing.allocate(1); state->dataSize->FinalZoneSizing(ZoneNum).DesHeatLoad = 4000; - // For finalzonesizing, desing cooling load is positive + // For finalzonesizing, design cooling load is positive state->dataSize->FinalZoneSizing(ZoneNum).DesCoolLoad = 2500; auto &thisZEqList(state->dataZoneEquip->ZoneEquipList(ZoneNum)); thisZEqList.HeatingCapacity(1) = 2000.0; @@ -1425,7 +1425,6 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeUniformPLR) TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialUniformPLR) { - std::string const idf_objects = delimited_string({ "Zone,", " Space; !- Name", @@ -1509,6 +1508,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialUniformPLR) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); + state->init_state(*state); bool ErrorsFound = false; GetZoneData(*state, ErrorsFound); AllocateHeatBalArrays(*state); @@ -1533,7 +1533,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialUniformPLR) // Set up capacities for PLR calcs state->dataSize->FinalZoneSizing.allocate(1); state->dataSize->FinalZoneSizing(ZoneNum).DesHeatLoad = 4000; - // For finalzonesizing, desing cooling load is positive + // For finalzonesizing, design cooling load is positive state->dataSize->FinalZoneSizing(ZoneNum).DesCoolLoad = 2500; auto &thisZEqList(state->dataZoneEquip->ZoneEquipList(ZoneNum)); thisZEqList.HeatingCapacity(1) = 2000.0; @@ -1740,7 +1740,6 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialUniformPLR) TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialLoad_MixedEquip) { - std::string const idf_objects = delimited_string({ "Zone,", " Space; !- Name", @@ -1835,6 +1834,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialLoad_MixedEqu ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); + state->init_state(*state); bool ErrorsFound = false; GetZoneData(*state, ErrorsFound); AllocateHeatBalArrays(*state); @@ -1846,7 +1846,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialLoad_MixedEqu state->dataZoneEnergyDemand->CurDeadBandOrSetback(1) = false; state->dataZoneEnergyDemand->DeadBandOrSetback(1) = false; state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataZoneEnergyDemand->ZoneSysMoistureDemand.allocate(1); @@ -1939,7 +1939,6 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialLoad_MixedEqu TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialLoad_MixedEquip_WithFractions) { - std::string const idf_objects = delimited_string({ "Zone,", " Space; !- Name", @@ -2061,6 +2060,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialLoad_MixedEqu ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); + state->init_state(*state); bool ErrorsFound = false; GetZoneData(*state, ErrorsFound); AllocateHeatBalArrays(*state); @@ -2072,7 +2072,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialLoad_MixedEqu state->dataZoneEnergyDemand->CurDeadBandOrSetback(1) = false; state->dataZoneEnergyDemand->DeadBandOrSetback(1) = false; state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataZoneEnergyDemand->ZoneSysMoistureDemand.allocate(1); @@ -2088,10 +2088,10 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialLoad_MixedEqu auto &moisture = state->dataZoneEnergyDemand->ZoneSysMoistureDemand(ZoneNum); state->dataZoneEquipmentManager->PrioritySimOrder.allocate(NumEquip); - state->dataScheduleMgr->Schedule(ScheduleManager::GetScheduleIndex(*state, "AIR TERMINAL 1 ADU COOLING FRACTION")).CurrentValue = 0.3; - state->dataScheduleMgr->Schedule(ScheduleManager::GetScheduleIndex(*state, "AIR TERMINAL 1 ADU HEATING FRACTION")).CurrentValue = 0.4; - state->dataScheduleMgr->Schedule(ScheduleManager::GetScheduleIndex(*state, "IDEAL SYSTEM A COOLING FRACTION")).CurrentValue = 0.5; - state->dataScheduleMgr->Schedule(ScheduleManager::GetScheduleIndex(*state, "IDEAL SYSTEM A HEATING FRACTION")).CurrentValue = 0.6; + Sched::GetSchedule(*state, "AIR TERMINAL 1 ADU COOLING FRACTION")->currentVal = 0.3; + Sched::GetSchedule(*state, "AIR TERMINAL 1 ADU HEATING FRACTION")->currentVal = 0.4; + Sched::GetSchedule(*state, "IDEAL SYSTEM A COOLING FRACTION")->currentVal = 0.5; + Sched::GetSchedule(*state, "IDEAL SYSTEM A HEATING FRACTION")->currentVal = 0.6; // Sequential Test 1 - Heating, FirstHVACIteration = true energy.TotalOutputRequired = 1000.0; @@ -2161,6 +2161,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialLoad_MixedEqu TEST_F(EnergyPlusFixture, ZoneEquipmentManager_RezeroZoneSizingArrays) { + state->init_state(*state); state->dataEnvrn->TotDesDays = 12; state->dataEnvrn->TotRunDesPersDays = 3; @@ -2913,7 +2914,6 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_RezeroZoneSizingArrays) TEST_F(EnergyPlusFixture, ZoneEquipmentManager_ZoneMassBalance_wAdjustInfiltrationFlow) { - std::string const idf_objects = delimited_string({ "ZoneAirMassFlowConservation,", @@ -2996,7 +2996,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_ZoneMassBalance_wAdjustInfiltrati "ZoneMixing,", " RZone ZoneMixing, !- Name", " RZone, !- Zone Name", - " AlwaysOn, !- Schedule Name", + " Constant-1.0, !- Schedule Name", " Flow/Zone, !- Design Flow Rate Calculation Method", " 0.5, !- Design Flow Rate{m3/s}", " , !- Flow Rate per Zone Floor Area{m3/s-m2}", @@ -3008,7 +3008,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_ZoneMassBalance_wAdjustInfiltrati "ZoneInfiltration:DesignFlowRate,", " SZone Infiltration, !- Name", " SZone, !- Zone or ZoneList Name", - " AlwaysOn, !- Schedule Name", + " Constant-1.0, !- Schedule Name", " flow/zone, !- Design Flow Rate Calculation Method", " 0.05, !- Design Flow Rate{ m3 / s }", " , !- Flow per Zone Floor Area{ m3 / s - m2 }", @@ -3022,7 +3022,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_ZoneMassBalance_wAdjustInfiltrati "ZoneInfiltration:DesignFlowRate,", " RZone Infiltration, !- Name", " RZone, !- Zone or ZoneList Name", - " AlwaysOn, !- Schedule Name", + " Constant-1.0, !- Schedule Name", " flow/zone, !- Design Flow Rate Calculation Method", " 0.05, !- Design Flow Rate{ m3 / s }", " , !- Flow per Zone Floor Area{ m3 / s - m2 }", @@ -3032,21 +3032,15 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_ZoneMassBalance_wAdjustInfiltrati " 0, !- Temperature Term Coefficient", " 0, !- Velocity Term Coefficient", " 0; !- Velocity Squared Term Coefficient", - - "Schedule:Constant,", - "AlwaysOn,", - "Fraction,", - "1.0;", - }); ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); + state->init_state(*state); int ZoneNum; int NodeNum; bool ErrorsFound = false; - ScheduleManager::ProcessScheduleInput(*state); GetZoneData(*state, ErrorsFound); AllocateHeatBalArrays(*state); GetZoneEquipmentData(*state); @@ -3060,7 +3054,6 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_ZoneMassBalance_wAdjustInfiltrati EXPECT_ENUM_EQ(state->dataHeatBal->ZoneAirMassFlow.InfiltrationForZones, DataHeatBalance::InfiltrationZoneType::AllZones); GetSimpleAirModelInputs(*state, ErrorsFound); SetZoneMassConservationFlag(*state); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; state->dataHeatBal->AirFlowFlag = 1; // set zone conditions state->dataEnvrn->StdRhoAir = 1.0; @@ -3158,7 +3151,6 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_ZoneMassBalance_wAdjustInfiltrati TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wAdjustReturnOnly) { - std::string const idf_objects = delimited_string({ "ZoneAirMassFlowConservation,", @@ -3241,7 +3233,7 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wAdjustReturnOnly) "ZoneMixing,", " RZone ZoneMixing, !- Name", " RZone, !- Zone Name", - " AlwaysOn, !- Schedule Name", + " Constant-1.0, !- Schedule Name", " Flow/Zone, !- Design Flow Rate Calculation Method", " 0.5, !- Design Flow Rate{m3/s}", " , !- Flow Rate per Zone Floor Area{m3/s-m2}", @@ -3253,7 +3245,7 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wAdjustReturnOnly) "ZoneInfiltration:DesignFlowRate,", " SZone Infiltration, !- Name", " SZone, !- Zone or ZoneList Name", - " AlwaysOn, !- Schedule Name", + " Constant-1.0, !- Schedule Name", " flow/zone, !- Design Flow Rate Calculation Method", " 0.05, !- Design Flow Rate{ m3 / s }", " , !- Flow per Zone Floor Area{ m3 / s - m2 }", @@ -3267,7 +3259,7 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wAdjustReturnOnly) "ZoneInfiltration:DesignFlowRate,", " RZone Infiltration, !- Name", " RZone, !- Zone or ZoneList Name", - " AlwaysOn, !- Schedule Name", + " Constant-1.0, !- Schedule Name", " flow/zone, !- Design Flow Rate Calculation Method", " 0.05, !- Design Flow Rate{ m3 / s }", " , !- Flow per Zone Floor Area{ m3 / s - m2 }", @@ -3277,20 +3269,14 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wAdjustReturnOnly) " 0, !- Temperature Term Coefficient", " 0, !- Velocity Term Coefficient", " 0; !- Velocity Squared Term Coefficient", - - "Schedule:Constant,", - "AlwaysOn,", - "Fraction,", - "1.0;", - }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); int ZoneNum; int NodeNum; bool ErrorsFound = false; - ScheduleManager::ProcessScheduleInput(*state); GetZoneData(*state, ErrorsFound); AllocateHeatBalArrays(*state); GetZoneEquipmentData(*state); @@ -3304,7 +3290,6 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wAdjustReturnOnly) EXPECT_ENUM_EQ(state->dataHeatBal->ZoneAirMassFlow.InfiltrationForZones, DataHeatBalance::InfiltrationZoneType::AllZones); GetSimpleAirModelInputs(*state, ErrorsFound); SetZoneMassConservationFlag(*state); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; state->dataHeatBal->AirFlowFlag = 1; // set zone conditions state->dataEnvrn->StdRhoAir = 1.2; @@ -3419,7 +3404,6 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wAdjustReturnOnly) TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wAdjustReturnThenMixing) { - std::string const idf_objects = delimited_string({ "ZoneAirMassFlowConservation,", @@ -3502,7 +3486,7 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wAdjustReturnThenMixing) "ZoneMixing,", " RZone ZoneMixing, !- Name", " RZone, !- Zone Name", - " AlwaysOn, !- Schedule Name", + " Constant-1.0, !- Schedule Name", " Flow/Zone, !- Design Flow Rate Calculation Method", " 0.5, !- Design Flow Rate{m3/s}", " , !- Flow Rate per Zone Floor Area{m3/s-m2}", @@ -3514,7 +3498,7 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wAdjustReturnThenMixing) "ZoneInfiltration:DesignFlowRate,", " SZone Infiltration, !- Name", " SZone, !- Zone or ZoneList Name", - " AlwaysOn, !- Schedule Name", + " Constant-1.0, !- Schedule Name", " flow/zone, !- Design Flow Rate Calculation Method", " 0.05, !- Design Flow Rate{ m3 / s }", " , !- Flow per Zone Floor Area{ m3 / s - m2 }", @@ -3528,7 +3512,7 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wAdjustReturnThenMixing) "ZoneInfiltration:DesignFlowRate,", " RZone Infiltration, !- Name", " RZone, !- Zone or ZoneList Name", - " AlwaysOn, !- Schedule Name", + " Constant-1.0, !- Schedule Name", " flow/zone, !- Design Flow Rate Calculation Method", " 0.05, !- Design Flow Rate{ m3 / s }", " , !- Flow per Zone Floor Area{ m3 / s - m2 }", @@ -3538,20 +3522,14 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wAdjustReturnThenMixing) " 0, !- Temperature Term Coefficient", " 0, !- Velocity Term Coefficient", " 0; !- Velocity Squared Term Coefficient", - - "Schedule:Constant,", - "AlwaysOn,", - "Fraction,", - "1.0;", - }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); int ZoneNum; int NodeNum; bool ErrorsFound = false; - ScheduleManager::ProcessScheduleInput(*state); GetZoneData(*state, ErrorsFound); AllocateHeatBalArrays(*state); GetZoneEquipmentData(*state); @@ -3565,7 +3543,6 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wAdjustReturnThenMixing) EXPECT_ENUM_EQ(state->dataHeatBal->ZoneAirMassFlow.InfiltrationForZones, DataHeatBalance::InfiltrationZoneType::AllZones); GetSimpleAirModelInputs(*state, ErrorsFound); SetZoneMassConservationFlag(*state); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; state->dataHeatBal->AirFlowFlag = 1; // set zone conditions state->dataEnvrn->StdRhoAir = 1.2; @@ -3692,7 +3669,6 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wAdjustReturnThenMixing) TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wAdjustMixingThenReturn) { - std::string const idf_objects = delimited_string({ "ZoneAirMassFlowConservation,", @@ -3775,7 +3751,7 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wAdjustMixingThenReturn) "ZoneMixing,", " RZone ZoneMixing, !- Name", " RZone, !- Zone Name", - " AlwaysOn, !- Schedule Name", + " Constant-1.0, !- Schedule Name", " Flow/Zone, !- Design Flow Rate Calculation Method", " 0.5, !- Design Flow Rate{m3/s}", " , !- Flow Rate per Zone Floor Area{m3/s-m2}", @@ -3787,7 +3763,7 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wAdjustMixingThenReturn) "ZoneInfiltration:DesignFlowRate,", " SZone Infiltration, !- Name", " SZone, !- Zone or ZoneList Name", - " AlwaysOn, !- Schedule Name", + " Constant-1.0, !- Schedule Name", " flow/zone, !- Design Flow Rate Calculation Method", " 0.05, !- Design Flow Rate{ m3 / s }", " , !- Flow per Zone Floor Area{ m3 / s - m2 }", @@ -3801,7 +3777,7 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wAdjustMixingThenReturn) "ZoneInfiltration:DesignFlowRate,", " RZone Infiltration, !- Name", " RZone, !- Zone or ZoneList Name", - " AlwaysOn, !- Schedule Name", + " Constant-1.0, !- Schedule Name", " flow/zone, !- Design Flow Rate Calculation Method", " 0.05, !- Design Flow Rate{ m3 / s }", " , !- Flow per Zone Floor Area{ m3 / s - m2 }", @@ -3811,20 +3787,14 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wAdjustMixingThenReturn) " 0, !- Temperature Term Coefficient", " 0, !- Velocity Term Coefficient", " 0; !- Velocity Squared Term Coefficient", - - "Schedule:Constant,", - "AlwaysOn,", - "Fraction,", - "1.0;", - }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); int ZoneNum; int NodeNum; bool ErrorsFound = false; - ScheduleManager::ProcessScheduleInput(*state); GetZoneData(*state, ErrorsFound); AllocateHeatBalArrays(*state); GetZoneEquipmentData(*state); @@ -3838,7 +3808,6 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wAdjustMixingThenReturn) EXPECT_ENUM_EQ(state->dataHeatBal->ZoneAirMassFlow.InfiltrationTreatment, DataHeatBalance::InfiltrationFlow::Adjust); GetSimpleAirModelInputs(*state, ErrorsFound); SetZoneMassConservationFlag(*state); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; state->dataHeatBal->AirFlowFlag = 1; // set zone conditions state->dataEnvrn->StdRhoAir = 1.2; @@ -3957,7 +3926,6 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wAdjustMixingThenReturn) TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wSourceAndReceivingZone) { - std::string const idf_objects = delimited_string({ "ZoneAirMassFlowConservation,", @@ -4076,7 +4044,7 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wSourceAndReceivingZone) "ZoneMixing,", " RSZone ZoneMixing, !- Name", " RSZone, !- Zone Name", - " AlwaysOn, !- Schedule Name", + " Constant-1.0, !- Schedule Name", " Flow/Zone, !- Design Flow Rate Calculation Method", " 0.852323, !- Design Flow Rate{m3/s}", " , !- Flow Rate per Zone Floor Area{m3/s-m2}", @@ -4088,7 +4056,7 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wSourceAndReceivingZone) "ZoneMixing,", " RZone ZoneMixing, !- Name", " RZone, !- Zone Name", - " AlwaysOn, !- Schedule Name", + " Constant-1.0, !- Schedule Name", " Flow/Zone, !- Design Flow Rate Calculation Method", " 0.852323, !- Design Flow Rate{m3/s}", " , !- Flow Rate per Zone Floor Area{m3/s-m2}", @@ -4100,7 +4068,7 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wSourceAndReceivingZone) "ZoneInfiltration:DesignFlowRate,", " SZone Infiltration, !- Name", " SZone, !- Zone or ZoneList Name", - " AlwaysOn, !- Schedule Name", + " Constant-1.0, !- Schedule Name", " flow/zone, !- Design Flow Rate Calculation Method", " 0.05, !- Design Flow Rate{ m3 / s }", " , !- Flow per Zone Floor Area{ m3 / s - m2 }", @@ -4114,7 +4082,7 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wSourceAndReceivingZone) "ZoneInfiltration:DesignFlowRate,", " RZone Infiltration, !- Name", " RZone, !- Zone or ZoneList Name", - " AlwaysOn, !- Schedule Name", + " Constant-1.0, !- Schedule Name", " flow/zone, !- Design Flow Rate Calculation Method", " 0.05, !- Design Flow Rate{ m3 / s }", " , !- Flow per Zone Floor Area{ m3 / s - m2 }", @@ -4124,20 +4092,14 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wSourceAndReceivingZone) " 0, !- Temperature Term Coefficient", " 0, !- Velocity Term Coefficient", " 0; !- Velocity Squared Term Coefficient", - - "Schedule:Constant,", - "AlwaysOn,", - "Fraction,", - "1.0;", - }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); int ZoneNum; int NodeNum; bool ErrorsFound = false; - ScheduleManager::ProcessScheduleInput(*state); GetZoneData(*state, ErrorsFound); AllocateHeatBalArrays(*state); GetZoneEquipmentData(*state); @@ -4151,7 +4113,6 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wSourceAndReceivingZone) EXPECT_ENUM_EQ(state->dataHeatBal->ZoneAirMassFlow.InfiltrationForZones, DataHeatBalance::InfiltrationZoneType::AllZones); GetSimpleAirModelInputs(*state, ErrorsFound); SetZoneMassConservationFlag(*state); - state->dataScheduleMgr->Schedule(1).CurrentValue = 1.0; state->dataHeatBal->AirFlowFlag = 1; // set zone conditions state->dataEnvrn->StdRhoAir = 1.2; @@ -4226,7 +4187,6 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_wSourceAndReceivingZone) TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_ZoneMixingInfiltrationFlowsFlags) { - std::string const idf_objects = delimited_string({ "ZoneAirMassFlowConservation,", @@ -4345,7 +4305,7 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_ZoneMixingInfiltrationFlowsFlag "ZoneMixing,", " RSZone ZoneMixing, !- Name", " RSZone, !- Zone Name", - " AlwaysOn, !- Schedule Name", + " Constant-1.0, !- Schedule Name", " Flow/Zone, !- Design Flow Rate Calculation Method", " 0.852323, !- Design Flow Rate{m3/s}", " , !- Flow Rate per Zone Floor Area{m3/s-m2}", @@ -4357,7 +4317,7 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_ZoneMixingInfiltrationFlowsFlag "ZoneMixing,", " RZone ZoneMixing, !- Name", " RZone, !- Zone Name", - " AlwaysOn, !- Schedule Name", + " Constant-1.0, !- Schedule Name", " Flow/Zone, !- Design Flow Rate Calculation Method", " 0.852323, !- Design Flow Rate{m3/s}", " , !- Flow Rate per Zone Floor Area{m3/s-m2}", @@ -4365,18 +4325,12 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_ZoneMixingInfiltrationFlowsFlag " , !- Air Changes per Hour{1/hr}", " RSZone, !- Source Zone Name", " 0.0; !- Delta Temperature{deltaC}", - - "Schedule:Constant,", - "AlwaysOn,", - "Fraction,", - "1.0;", - }); ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); bool ErrorsFound = false; - ScheduleManager::ProcessScheduleInput(*state); GetZoneData(*state, ErrorsFound); AllocateHeatBalArrays(*state); GetZoneEquipmentData(*state); @@ -4401,6 +4355,7 @@ TEST_F(EnergyPlusFixture, ZoneAirMassFlowBalance_ZoneMixingInfiltrationFlowsFlag TEST_F(EnergyPlusFixture, CalcAirFlowSimple_CO2andGCforRefrigerationDoorsTest) { + state->init_state(*state); state->dataGlobal->NumOfZones = 2; state->dataEnvrn->OutBaroPress = 101400.; @@ -4461,6 +4416,7 @@ TEST_F(EnergyPlusFixture, CalcAirFlowSimple_CO2andGCforRefrigerationDoorsTest) TEST_F(EnergyPlusFixture, CZoeEquipmentManager_CalcZoneLeavingConditions_Test) { + state->init_state(*state); state->dataGlobal->NumOfZones = 1; state->dataHeatBal->Zone.allocate(1); state->dataHeatBal->Zone(1).Name = "LIVING ZONE"; @@ -4536,6 +4492,8 @@ TEST_F(EnergyPlusFixture, CZoeEquipmentManager_CalcZoneLeavingConditions_Test) TEST_F(EnergyPlusFixture, ZoneEquipmentManager_SizeZoneEquipment_NoLoadTest) { + state->dataGlobal->TimeStepsInHour = 1; + state->init_state(*state); state->dataLoopNodes->Node.allocate(10); state->dataGlobal->NumOfZones = 1; @@ -4548,9 +4506,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_SizeZoneEquipment_NoLoadTest) state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(state->dataGlobal->NumOfZones); state->dataZoneEquip->ZoneEquipConfig.allocate(state->dataGlobal->NumOfZones); state->dataHeatBalFanSys->TempControlType.allocate(state->dataGlobal->NumOfZones); - state->dataHeatBalFanSys->TempZoneThermostatSetPoint.allocate(state->dataGlobal->NumOfZones); - state->dataHeatBalFanSys->ZoneThermostatSetPointLo.allocate(state->dataGlobal->NumOfZones); - state->dataHeatBalFanSys->ZoneThermostatSetPointHi.allocate(state->dataGlobal->NumOfZones); + state->dataHeatBalFanSys->zoneTstatSetpts.allocate(state->dataGlobal->NumOfZones); state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(state->dataGlobal->NumOfZones); state->dataZoneEnergyDemand->ZoneSysMoistureDemand.allocate(state->dataGlobal->NumOfZones); auto &zoneSysMoistureDemand = state->dataZoneEnergyDemand->ZoneSysMoistureDemand(1); @@ -4561,10 +4517,10 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_SizeZoneEquipment_NoLoadTest) state->dataHeatBalFanSys->ZoneMassBalanceFlag.allocate(state->dataGlobal->NumOfZones); state->dataHeatBal->MassConservation.allocate(state->dataGlobal->NumOfZones); HeatBalanceManager::AllocateHeatBalArrays(*state); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; - state->dataHeatBalFanSys->TempZoneThermostatSetPoint(1) = 22.; - state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1) = 22.; - state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1) = 24.; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; + state->dataHeatBalFanSys->zoneTstatSetpts(1).setpt = 22.; + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo = 22.; + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi = 24.; state->dataZoneEquip->ZoneEquipConfig(1).IsControlled = true; state->dataSize->CalcZoneSizing(1, 1).ZoneNum = 1; state->dataSize->CurOverallSimDay = 1; @@ -4584,6 +4540,8 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_SizeZoneEquipment_NoLoadTest) state->dataZoneEquip->ZoneEquipConfig(1).InletNode(2) = 2; state->dataZoneEquip->ZoneEquipConfig(1).ExhaustNode(1) = 3; state->dataZoneEquip->ZoneEquipConfig(1).NumReturnNodes = 0; + state->dataZoneEquip->ZoneEquipConfig(1).returnFlowFracSched = Sched::GetScheduleAlwaysOn(*state); + state->dataEnvrn->StdBaroPress = 101325.; state->dataSize->CalcFinalZoneSizing(1).MinOA = 0.1; state->dataSize->CalcFinalZoneSizing(1).OutTempAtHeatPeak = 28; @@ -4598,7 +4556,6 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_SizeZoneEquipment_NoLoadTest) SizeZoneEquipment(*state); UpdateZoneSizing(*state, Constant::CallIndicator::BeginDay); state->dataGlobal->HourOfDay = 1; - state->dataGlobal->NumOfTimeStepInHour = 1; state->dataGlobal->TimeStep = 1; state->dataSize->NumTimeStepsInAvg = 1; state->dataHVACGlobal->FracTimeStepZone = 1; @@ -4705,6 +4662,8 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_SizeZoneEquipment_NoLoadTest) TEST_F(EnergyPlusFixture, CalcAirFlowSimple_WindAndStackArea) { + state->init_state(*state); + state->dataGlobal->NumOfZones = 1; state->dataHeatBal->Zone.allocate(state->dataGlobal->NumOfZones); @@ -4743,7 +4702,7 @@ TEST_F(EnergyPlusFixture, CalcAirFlowSimple_WindAndStackArea) thisVentilation.OpenEff = Constant::AutoCalculate; thisVentilation.EffAngle = 135; // Effective angle thisVentilation.OpenArea = 1.0; - thisVentilation.OpenAreaSchedPtr = -1; // Always on + thisVentilation.openAreaFracSched = Sched::GetScheduleAlwaysOn(*state); // Always on thisVentilation.ZonePtr = 1; thisVentilation.DiscCoef = 0.5; @@ -4818,6 +4777,7 @@ TEST_F(EnergyPlusFixture, CalcAirFlowSimple_WindAndStackArea) TEST_F(EnergyPlusFixture, ZoneEquipmentManager_SizeZoneEquipment_DOASLoadTest) { + state->init_state(*state); state->dataLoopNodes->Node.allocate(10); state->dataGlobal->NumOfZones = 1; @@ -4834,9 +4794,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_SizeZoneEquipment_DOASLoadTest) state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(state->dataGlobal->NumOfZones); state->dataZoneEquip->ZoneEquipConfig.allocate(state->dataGlobal->NumOfZones); state->dataHeatBalFanSys->TempControlType.allocate(state->dataGlobal->NumOfZones); - state->dataHeatBalFanSys->TempZoneThermostatSetPoint.allocate(state->dataGlobal->NumOfZones); - state->dataHeatBalFanSys->ZoneThermostatSetPointLo.allocate(state->dataGlobal->NumOfZones); - state->dataHeatBalFanSys->ZoneThermostatSetPointHi.allocate(state->dataGlobal->NumOfZones); + state->dataHeatBalFanSys->zoneTstatSetpts.allocate(state->dataGlobal->NumOfZones); state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(state->dataGlobal->NumOfZones); state->dataZoneEnergyDemand->ZoneSysMoistureDemand.allocate(state->dataGlobal->NumOfZones); auto &zoneSysMoistureDemand = state->dataZoneEnergyDemand->ZoneSysMoistureDemand(1); @@ -4847,10 +4805,10 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_SizeZoneEquipment_DOASLoadTest) state->dataHeatBalFanSys->ZoneMassBalanceFlag.allocate(state->dataGlobal->NumOfZones); state->dataHeatBal->MassConservation.allocate(state->dataGlobal->NumOfZones); HeatBalanceManager::AllocateHeatBalArrays(*state); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; - state->dataHeatBalFanSys->TempZoneThermostatSetPoint(1) = 23.5; - state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1) = 22.5; - state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1) = 23.5; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; + state->dataHeatBalFanSys->zoneTstatSetpts(1).setpt = 23.5; + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo = 22.5; + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi = 23.5; state->dataZoneEquip->ZoneEquipConfig(1).IsControlled = true; state->dataSize->CalcZoneSizing(1, 1).ZoneNum = 1; state->dataSize->CurOverallSimDay = 1; @@ -4870,6 +4828,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_SizeZoneEquipment_DOASLoadTest) state->dataZoneEquip->ZoneEquipConfig(1).InletNode(2) = 2; state->dataZoneEquip->ZoneEquipConfig(1).ExhaustNode(1) = 3; state->dataZoneEquip->ZoneEquipConfig(1).NumReturnNodes = 0; + state->dataZoneEquip->ZoneEquipConfig(1).returnFlowFracSched = Sched::GetScheduleAlwaysOn(*state); state->dataEnvrn->StdBaroPress = 101325.; state->dataEnvrn->StdRhoAir = 1.20; @@ -4887,7 +4846,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_SizeZoneEquipment_DOASLoadTest) SizeZoneEquipment(*state); UpdateZoneSizing(*state, Constant::CallIndicator::BeginDay); state->dataGlobal->HourOfDay = 1; - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; state->dataGlobal->TimeStep = 1; state->dataSize->NumTimeStepsInAvg = 1; state->dataHVACGlobal->FracTimeStepZone = 1; @@ -5020,6 +4979,7 @@ TEST_F(EnergyPlusFixture, ZoneAirLoopEquipmentGetInputTest) )IDF"; ASSERT_TRUE(process_idf(idf_objects)); + state->init_state(*state); int AirDistCompUnitNum = 1; ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); @@ -5037,6 +4997,7 @@ TEST_F(EnergyPlusFixture, ZoneAirLoopEquipmentGetInputTest) TEST_F(EnergyPlusFixture, SpaceHVACSplitterTest) { + state->init_state(*state); state->dataZoneEquip->zoneEquipSplitter.resize(1); auto &thisSplitter = state->dataZoneEquip->zoneEquipSplitter[0]; // Assume 3 spaces are served by this splitter @@ -5088,6 +5049,8 @@ TEST_F(EnergyPlusFixture, SpaceHVACSplitterTest) space2Energy.RemainingOutputRequired = -40.0; space3Energy.RemainingOutputRequired = 10.0; + state->dataHeatBalFanSys->zoneTstatSetpts.allocate(1); + int zone1Num = 1; int equipNum = 1; @@ -5138,7 +5101,7 @@ TEST_F(EnergyPlusFixture, SpaceHVACSplitterTest) state->dataZoneEquip->ZoneEquipList.allocate(1); state->dataZoneEquip->ZoneEquipList(1).LoadDistScheme = DataZoneEquipment::LoadDist::Sequential; state->dataHeatBalFanSys->TempControlType.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); thisSplitter.distributeOutput(*state, zone1Num, sysOutputProvided, latOutputProvided, nonAirSysOutput, equipNum); @@ -5179,10 +5142,9 @@ TEST_F(EnergyPlusFixture, SpaceHVACSplitterTest) // Case 3 - Max Control thisSplitter.tstatControl = ZoneEquipTstatControl::Maximum; - state->dataHeatBalFanSys->ZoneThermostatSetPointLo.allocate(1); - state->dataHeatBalFanSys->ZoneThermostatSetPointHi.allocate(1); - state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1) = 18.0; - state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1) = 24.0; + state->dataHeatBalFanSys->zoneTstatSetpts.allocate(1); + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo = 18.0; + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi = 24.0; spaceHB1.T1 = 20.0; // Heating delta = 18-20=-2, cooling delta = 20-24=-4 spaceHB2.T1 = 16.0; // Heating delta = 18-16=2, cooling delta = 16-24=-8 - This zone is the winner, space2, splitSpace3 spaceHB3.T1 = 24.0; // Heating delta = 18-24=-6, cooling delta = 24-24=0 @@ -5200,6 +5162,7 @@ TEST_F(EnergyPlusFixture, SpaceHVACSplitterTest) TEST_F(EnergyPlusFixture, SpaceHVACMixerTest) { + state->init_state(*state); state->dataZoneEquip->zoneEquipMixer.resize(1); auto &thisMixer = state->dataZoneEquip->zoneEquipMixer[0]; // Assume 3 spaces are served by this mixter @@ -5289,7 +5252,6 @@ TEST_F(EnergyPlusFixture, SpaceHVACMixerTest) TEST_F(EnergyPlusFixture, ZoneEquipmentManager_GetZoneEquipmentTest) { - std::string const idf_objects = delimited_string({ "Zone,", " Space; !- Name", @@ -5331,6 +5293,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_GetZoneEquipmentTest) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); + state->init_state(*state); bool ErrorsFound = false; // Test 0: The get flag should default to true @@ -5338,7 +5301,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_GetZoneEquipmentTest) // Test 1: This should return no errors and the get flag should now be false. // In addition, it should have populated arrays and set the time steps correctly. - state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStepsInHour = 1; GetZoneData(*state, ErrorsFound); AllocateHeatBalArrays(*state); GetZoneEquipment(*state); @@ -5352,13 +5315,15 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_GetZoneEquipmentTest) // The get flag should still be false and the number of time steps in a day should NOT change. // In essence, this tests to make sure that GetZoneEquipment doesn't do anything after the // first time it is called. - state->dataGlobal->NumOfTimeStepInHour = 2; + state->dataGlobal->TimeStepsInHour = 2; GetZoneEquipment(*state); EXPECT_FALSE(state->dataZoneEquipmentManager->GetZoneEquipmentInputFlag); EXPECT_EQ(state->dataZoneEquipmentManager->NumOfTimeStepInDay, 24); } + TEST_F(EnergyPlusFixture, SpaceReturnMixerTest) { + state->init_state(*state); state->dataZoneEquip->zoneReturnMixer.resize(1); auto &thisMixer = state->dataZoneEquip->zoneReturnMixer[0]; // Assume 3 spaces are served by this mixter @@ -5425,6 +5390,10 @@ TEST_F(EnergyPlusFixture, SpaceReturnMixerTest) spaceEquipConfig2.FixedReturnFlow.allocate(1); spaceEquipConfig3.FixedReturnFlow.allocate(1); + spaceEquipConfig1.returnFlowFracSched = Sched::GetScheduleAlwaysOff(*state); + spaceEquipConfig2.returnFlowFracSched = Sched::GetScheduleAlwaysOff(*state); + spaceEquipConfig3.returnFlowFracSched = Sched::GetScheduleAlwaysOff(*state); + spaceEquipConfig1.ZoneNode = 5; spaceEquipConfig2.ZoneNode = 6; spaceEquipConfig3.ZoneNode = 7; diff --git a/tst/EnergyPlus/unit/ZoneHVACEvaporativeCooler.unit.cc b/tst/EnergyPlus/unit/ZoneHVACEvaporativeCooler.unit.cc index dd05492006a..3b1c1e0ad25 100644 --- a/tst/EnergyPlus/unit/ZoneHVACEvaporativeCooler.unit.cc +++ b/tst/EnergyPlus/unit/ZoneHVACEvaporativeCooler.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -99,7 +99,7 @@ class ZoneHVACEvapCoolerUnitTest : public EnergyPlusFixture state->dataZoneEquip->ZoneEquipList.allocate(state->dataGlobal->NumOfZones); state->dataLoopNodes->Node.allocate(NumOfNodes); state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); - state->dataHeatBalFanSys->ZoneThermostatSetPointHi.allocate(1); + state->dataHeatBalFanSys->zoneTstatSetpts.allocate(1); state->dataZoneEquip->ZoneEquipConfig(1).ZoneName = "One Zone"; state->dataZoneEquip->ZoneEquipConfig(1).NumInletNodes = 1; @@ -191,9 +191,7 @@ TEST_F(ZoneHVACEvapCoolerUnitTest, DirectCelDekPad_CyclingUnit_Sim) }); ASSERT_TRUE(process_idf(idf_objects)); - - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->init_state(*state); Fans::GetFanInput(*state); ASSERT_FALSE(ErrorsFound); @@ -221,7 +219,7 @@ TEST_F(ZoneHVACEvapCoolerUnitTest, DirectCelDekPad_CyclingUnit_Sim) state->dataLoopNodes->Node(thisZoneEvapCooler.OAInletNodeNum).Enthalpy = Psychrometrics::PsyHFnTdbW(state->dataEnvrn->OutDryBulbTemp, state->dataEnvrn->OutHumRat); - state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1) = 23.0; + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi = 23.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 0.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -15000.0; @@ -317,9 +315,7 @@ TEST_F(ZoneHVACEvapCoolerUnitTest, DirectResearchSpecial_CyclingUnit_Sim) " ZoneEvapCool Inlet Node; !- Sensor Node Name", }); ASSERT_TRUE(process_idf(idf_objects)); - - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->init_state(*state); Fans::GetFanInput(*state); ASSERT_FALSE(ErrorsFound); @@ -347,13 +343,13 @@ TEST_F(ZoneHVACEvapCoolerUnitTest, DirectResearchSpecial_CyclingUnit_Sim) state->dataLoopNodes->Node(thisZoneEvapCooler.OAInletNodeNum).Enthalpy = Psychrometrics::PsyHFnTdbW(state->dataEnvrn->OutDryBulbTemp, state->dataEnvrn->OutHumRat); - state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1) = 23.0; + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi = 23.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 0.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -15000.0; state->dataZoneEquip->ZoneEquipList(1).EquipName(1) = thisZoneEvapCooler.Name; // Evap Cooler Unit Control Method = Zone Temperature Dead Band OnOff Cycling - EXPECT_EQ((int)thisZoneEvapCooler.fanOp, (int)HVAC::FanOp::Cycling); + EXPECT_ENUM_EQ(thisZoneEvapCooler.fanOp, HVAC::FanOp::Cycling); EXPECT_ENUM_EQ(thisZoneEvapCooler.ControlSchemeType, ControlType::ZoneTemperatureDeadBandOnOffCycling); EvaporativeCoolers::SimZoneEvaporativeCoolerUnit( *state, thisZoneEvapCooler.Name, ActualZoneNum, SensOutputProvided, LatOutputProvided, ZoneEquipIndex); @@ -448,9 +444,7 @@ TEST_F(ZoneHVACEvapCoolerUnitTest, IndirectWetCoil_CyclingUnit_Sim) }); ASSERT_TRUE(process_idf(idf_objects)); - - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->init_state(*state); Fans::GetFanInput(*state); ASSERT_FALSE(ErrorsFound); @@ -486,7 +480,7 @@ TEST_F(ZoneHVACEvapCoolerUnitTest, IndirectWetCoil_CyclingUnit_Sim) state->dataLoopNodes->Node(thisEvapCooler.SecondaryInletNode).Enthalpy = Psychrometrics::PsyHFnTdbW(state->dataEnvrn->OutDryBulbTemp, state->dataEnvrn->OutHumRat); - state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1) = 23.0; + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi = 23.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 0.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -15000.0; state->dataZoneEquip->ZoneEquipList(1).EquipName(1) = thisZoneEvapCooler.Name; @@ -586,9 +580,7 @@ TEST_F(ZoneHVACEvapCoolerUnitTest, RHcontrol) }); ASSERT_TRUE(process_idf(idf_objects)); - - ScheduleManager::ProcessScheduleInput(*state); - state->dataScheduleMgr->ScheduleInputProcessed = true; + state->init_state(*state); Fans::GetFanInput(*state); ASSERT_FALSE(ErrorsFound); @@ -618,7 +610,7 @@ TEST_F(ZoneHVACEvapCoolerUnitTest, RHcontrol) state->dataLoopNodes->Node(thisZoneEvapCooler.OAInletNodeNum).Enthalpy = Psychrometrics::PsyHFnTdbW(state->dataEnvrn->OutDryBulbTemp, state->dataEnvrn->OutHumRat); - state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1) = 23.0; + state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi = 23.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 0.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -15000.0; state->dataZoneEquip->ZoneEquipList(1).EquipName(1) = thisZoneEvapCooler.Name; diff --git a/tst/EnergyPlus/unit/ZonePlenum.unit.cc b/tst/EnergyPlus/unit/ZonePlenum.unit.cc index ddf56d3cf17..75f9f17e800 100644 --- a/tst/EnergyPlus/unit/ZonePlenum.unit.cc +++ b/tst/EnergyPlus/unit/ZonePlenum.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/ZoneTempPredictorCorrector.unit.cc b/tst/EnergyPlus/unit/ZoneTempPredictorCorrector.unit.cc index 8502fb060a9..1681b8e499b 100644 --- a/tst/EnergyPlus/unit/ZoneTempPredictorCorrector.unit.cc +++ b/tst/EnergyPlus/unit/ZoneTempPredictorCorrector.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other @@ -93,7 +93,6 @@ using namespace EnergyPlus::DataLoopNode; using namespace EnergyPlus::DataSurfaces; using namespace EnergyPlus::DataEnvironment; using namespace EnergyPlus::Psychrometrics; -using namespace EnergyPlus::ScheduleManager; using namespace EnergyPlus::RoomAir; using namespace EnergyPlus::HybridModel; using namespace SimulationManager; @@ -102,7 +101,9 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_CorrectZoneHumRatTest) { state->dataHVACGlobal->TimeStepSys = 15.0 / 60.0; // System timestep in hours - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; + + state->init_state(*state); state->dataZoneEquip->ZoneEquipConfig.allocate(1); state->dataZoneEquip->ZoneEquipConfig(1).ZoneName = "Zone 1"; @@ -449,7 +450,12 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_ReportingTest) ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStepsInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesInTimeStep = 60; // must initialize this to get schedules initialized + state->init_state(*state); + bool ErrorsFound(false); // If errors detected in input + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -458,10 +464,6 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_ReportingTest) int CoolHeatZoneNum(3); int DualZoneNum(4); - state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(*state); // read schedules - GetZoneAirSetPoints(*state); state->dataZoneEnergyDemand->DeadBandOrSetback.allocate(state->dataZoneCtrls->NumTempControlledZones); @@ -469,10 +471,8 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_ReportingTest) state->dataHeatBalFanSys->TempControlType.allocate(state->dataZoneCtrls->NumTempControlledZones); state->dataHeatBalFanSys->TempControlTypeRpt.allocate(state->dataZoneCtrls->NumTempControlledZones); state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(state->dataZoneCtrls->NumTempControlledZones); - state->dataHeatBalFanSys->TempZoneThermostatSetPoint.allocate(state->dataZoneCtrls->NumTempControlledZones); + state->dataHeatBalFanSys->zoneTstatSetpts.allocate(state->dataZoneCtrls->NumTempControlledZones); state->dataZoneEnergyDemand->Setback.allocate(state->dataZoneCtrls->NumTempControlledZones); - state->dataHeatBalFanSys->ZoneThermostatSetPointLo.allocate(state->dataZoneCtrls->NumTempControlledZones); - state->dataHeatBalFanSys->ZoneThermostatSetPointHi.allocate(state->dataZoneCtrls->NumTempControlledZones); state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(state->dataGlobal->NumOfZones); state->dataZoneTempPredictorCorrector->spaceHeatBalance.allocate(state->dataGlobal->NumOfZones); @@ -486,83 +486,72 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_ReportingTest) // extern int const SingleHeatingSetPoint; = 1 // extern int const SingleCoolingSetPoint; = 2 // extern int const SingleHeatCoolSetPoint; = 3 - // extern int const DualSetPointWithDeadBand; = 4 - state->dataScheduleMgr->Schedule(state->dataZoneCtrls->TempControlledZone(HeatZoneNum).CTSchedIndex).CurrentValue = - static_cast(HVAC::ThermostatType::SingleHeating); - state->dataScheduleMgr->Schedule(state->dataZoneCtrls->TempControlledZone(CoolZoneNum).CTSchedIndex).CurrentValue = - static_cast(HVAC::ThermostatType::SingleCooling); - state->dataScheduleMgr->Schedule(state->dataZoneCtrls->TempControlledZone(CoolHeatZoneNum).CTSchedIndex).CurrentValue = - static_cast(HVAC::ThermostatType::SingleHeatCool); - - state->dataScheduleMgr->Schedule(state->dataZoneCtrls->TempControlledZone(DualZoneNum).CTSchedIndex).CurrentValue = - 0; // simulate no thermostat or non-controlled zone + // extern int const DualHeatCool; = 4 + state->dataZoneCtrls->TempControlledZone(HeatZoneNum).setptTypeSched->currentVal = (int)HVAC::SetptType::SingleHeat; + state->dataZoneCtrls->TempControlledZone(CoolZoneNum).setptTypeSched->currentVal = (int)HVAC::SetptType::SingleCool; + state->dataZoneCtrls->TempControlledZone(CoolHeatZoneNum).setptTypeSched->currentVal = (int)HVAC::SetptType::SingleHeatCool; + state->dataZoneCtrls->TempControlledZone(DualZoneNum).setptTypeSched->currentVal = (int)HVAC::SetptType::Uncontrolled; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(DualZoneNum).TotalOutputRequired = 0.0; // no load and no thermostat since control type is set to 0 above CalcZoneAirTempSetPoints(*state); state->dataZoneTempPredictorCorrector->zoneHeatBalance(DualZoneNum).calcPredictedSystemLoad(*state, 1.0, DualZoneNum); - EXPECT_EQ(0.0, - state->dataHeatBalFanSys->TempZoneThermostatSetPoint( - DualZoneNum)); // Set point initialized to 0 and never set since thermostat control type = 0 + EXPECT_EQ( + 0.0, + state->dataHeatBalFanSys->zoneTstatSetpts(DualZoneNum).setpt); // Set point initialized to 0 and never set since thermostat control type = 0 - state->dataScheduleMgr->Schedule(state->dataZoneCtrls->TempControlledZone(DualZoneNum).CTSchedIndex).CurrentValue = - static_cast(HVAC::ThermostatType::DualSetPointWithDeadBand); // reset Tstat control schedule to dual thermostat control + state->dataZoneCtrls->TempControlledZone(DualZoneNum).setptTypeSched->currentVal = + (int)HVAC::SetptType::DualHeatCool; // reset Tstat control schedule to dual thermostat control // set up a back calculated load // for the first few, TempIndZnLd() = 0.0 // LoadToHeatingSetPoint = ( TempDepZnLd( ZoneNum ) * ( TempZoneThermostatSetPoint( ZoneNum ) ) - TempIndZnLd( ZoneNum ) ); // LoadToCoolingSetPoint = ( TempDepZnLd( ZoneNum ) * ( TempZoneThermostatSetPoint( ZoneNum ) ) - TempIndZnLd( ZoneNum ) ); - int SetPointTempSchedIndex = state->dataZoneCtrls->TempControlledZone(HeatZoneNum).SchIndx_SingleHeatSetPoint; - state->dataScheduleMgr->Schedule(SetPointTempSchedIndex).CurrentValue = 20.0; + state->dataZoneCtrls->TempControlledZone(HeatZoneNum).setpts[(int)HVAC::SetptType::SingleHeat].heatSetptSched->currentVal = 20.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(HeatZoneNum).TotalOutputRequired = -1000.0; // cooling load state->dataZoneTempPredictorCorrector->zoneHeatBalance(HeatZoneNum).tempDepLoad = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(HeatZoneNum).TotalOutputRequired / - state->dataScheduleMgr->Schedule(SetPointTempSchedIndex).CurrentValue; + state->dataZoneCtrls->TempControlledZone(HeatZoneNum).setpts[(int)HVAC::SetptType::SingleHeat].heatSetptSched->currentVal; CalcZoneAirTempSetPoints(*state); state->dataZoneTempPredictorCorrector->zoneHeatBalance(HeatZoneNum).calcPredictedSystemLoad(*state, 1.0, HeatZoneNum); - EXPECT_EQ(20.0, state->dataHeatBalFanSys->TempZoneThermostatSetPoint(HeatZoneNum)); + EXPECT_EQ(20.0, state->dataHeatBalFanSys->zoneTstatSetpts(HeatZoneNum).setpt); EXPECT_EQ(-1000.0, state->dataZoneEnergyDemand->ZoneSysEnergyDemand(HeatZoneNum) .TotalOutputRequired); // TotalOutputRequired gets updated in CalcPredictedSystemLoad based on the load EXPECT_TRUE(state->dataZoneEnergyDemand->CurDeadBandOrSetback(HeatZoneNum)); // Tstat should show there is no load on a single heating SP - SetPointTempSchedIndex = state->dataZoneCtrls->TempControlledZone(HeatZoneNum).SchIndx_SingleHeatSetPoint; - state->dataScheduleMgr->Schedule(SetPointTempSchedIndex).CurrentValue = 21.0; + state->dataZoneCtrls->TempControlledZone(HeatZoneNum).setpts[(int)HVAC::SetptType::SingleHeat].heatSetptSched->currentVal = 21.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(HeatZoneNum).TotalOutputRequired = 1000.0; // heating load state->dataZoneTempPredictorCorrector->zoneHeatBalance(HeatZoneNum).tempDepLoad = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(HeatZoneNum).TotalOutputRequired / - state->dataScheduleMgr->Schedule(SetPointTempSchedIndex).CurrentValue; + state->dataZoneCtrls->TempControlledZone(HeatZoneNum).setpts[(int)HVAC::SetptType::SingleHeat].heatSetptSched->currentVal; - SetPointTempSchedIndex = state->dataZoneCtrls->TempControlledZone(CoolZoneNum).SchIndx_SingleCoolSetPoint; - state->dataScheduleMgr->Schedule(SetPointTempSchedIndex).CurrentValue = 23.0; + state->dataZoneCtrls->TempControlledZone(CoolZoneNum).setpts[(int)HVAC::SetptType::SingleCool].coolSetptSched->currentVal = 23.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(CoolZoneNum).TotalOutputRequired = -3000.0; // cooling load state->dataZoneTempPredictorCorrector->zoneHeatBalance(CoolZoneNum).tempDepLoad = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(CoolZoneNum).TotalOutputRequired / - state->dataScheduleMgr->Schedule(SetPointTempSchedIndex).CurrentValue; + state->dataZoneCtrls->TempControlledZone(CoolZoneNum).setpts[(int)HVAC::SetptType::SingleCool].coolSetptSched->currentVal; - SetPointTempSchedIndex = state->dataZoneCtrls->TempControlledZone(CoolHeatZoneNum).SchIndx_SingleHeatCoolSetPoint; - state->dataScheduleMgr->Schedule(SetPointTempSchedIndex).CurrentValue = 22.0; + state->dataZoneCtrls->TempControlledZone(CoolHeatZoneNum).setpts[(int)HVAC::SetptType::SingleHeatCool].heatSetptSched->currentVal = 22.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(CoolHeatZoneNum).TotalOutputRequired = -4000.0; // cooling load state->dataZoneTempPredictorCorrector->zoneHeatBalance(CoolHeatZoneNum).tempDepLoad = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(CoolHeatZoneNum).TotalOutputRequired / - state->dataScheduleMgr->Schedule(SetPointTempSchedIndex).CurrentValue; + state->dataZoneCtrls->TempControlledZone(CoolHeatZoneNum).setpts[(int)HVAC::SetptType::SingleHeatCool].heatSetptSched->currentVal; - SetPointTempSchedIndex = state->dataZoneCtrls->TempControlledZone(DualZoneNum).SchIndx_DualSetPointWDeadBandCool; - state->dataScheduleMgr->Schedule(SetPointTempSchedIndex).CurrentValue = 24.0; - SetPointTempSchedIndex = state->dataZoneCtrls->TempControlledZone(DualZoneNum).SchIndx_DualSetPointWDeadBandHeat; - state->dataScheduleMgr->Schedule(SetPointTempSchedIndex).CurrentValue = 20.0; + state->dataZoneCtrls->TempControlledZone(DualZoneNum).setpts[(int)HVAC::SetptType::DualHeatCool].coolSetptSched->currentVal = 24.0; + state->dataZoneCtrls->TempControlledZone(DualZoneNum).setpts[(int)HVAC::SetptType::DualHeatCool].heatSetptSched->currentVal = 20.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(DualZoneNum).TotalOutputRequired = 2500.0; // heating load state->dataZoneTempPredictorCorrector->zoneHeatBalance(DualZoneNum).tempDepLoad = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(DualZoneNum).TotalOutputRequired / - state->dataScheduleMgr->Schedule(SetPointTempSchedIndex).CurrentValue; + state->dataZoneCtrls->TempControlledZone(DualZoneNum).setpts[(int)HVAC::SetptType::DualHeatCool].heatSetptSched->currentVal; CalcZoneAirTempSetPoints(*state); state->dataZoneTempPredictorCorrector->zoneHeatBalance(HeatZoneNum).calcPredictedSystemLoad(*state, 1.0, HeatZoneNum); - EXPECT_EQ(21.0, state->dataHeatBalFanSys->TempZoneThermostatSetPoint(HeatZoneNum)); + EXPECT_EQ(21.0, state->dataHeatBalFanSys->zoneTstatSetpts(HeatZoneNum).setpt); EXPECT_FALSE(state->dataZoneEnergyDemand->CurDeadBandOrSetback(HeatZoneNum)); // Tstat should show there is load on a single heating SP EXPECT_EQ(1000.0, state->dataZoneEnergyDemand->ZoneSysEnergyDemand(HeatZoneNum) @@ -570,7 +559,7 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_ReportingTest) state->dataZoneTempPredictorCorrector->zoneHeatBalance(CoolZoneNum).calcPredictedSystemLoad(*state, 1.0, CoolZoneNum); - EXPECT_EQ(23.0, state->dataHeatBalFanSys->TempZoneThermostatSetPoint(CoolZoneNum)); + EXPECT_EQ(23.0, state->dataHeatBalFanSys->zoneTstatSetpts(CoolZoneNum).setpt); EXPECT_FALSE(state->dataZoneEnergyDemand->CurDeadBandOrSetback(CoolZoneNum)); // Tstat should show there is load on a single cooling SP EXPECT_EQ(-3000.0, state->dataZoneEnergyDemand->ZoneSysEnergyDemand(CoolZoneNum) @@ -578,7 +567,7 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_ReportingTest) state->dataZoneTempPredictorCorrector->zoneHeatBalance(CoolHeatZoneNum).calcPredictedSystemLoad(*state, 1.0, CoolHeatZoneNum); - ASSERT_EQ(22.0, state->dataHeatBalFanSys->TempZoneThermostatSetPoint(CoolHeatZoneNum)); + ASSERT_EQ(22.0, state->dataHeatBalFanSys->zoneTstatSetpts(CoolHeatZoneNum).setpt); EXPECT_FALSE( state->dataZoneEnergyDemand->CurDeadBandOrSetback(CoolHeatZoneNum)); // Tstat should show there is load on a single heating or cooling SP EXPECT_EQ(-4000.0, @@ -587,25 +576,24 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_ReportingTest) state->dataZoneTempPredictorCorrector->zoneHeatBalance(DualZoneNum).calcPredictedSystemLoad(*state, 1.0, DualZoneNum); - EXPECT_EQ(20.0, state->dataHeatBalFanSys->TempZoneThermostatSetPoint(DualZoneNum)); + EXPECT_EQ(20.0, state->dataHeatBalFanSys->zoneTstatSetpts(DualZoneNum).setpt); EXPECT_FALSE(state->dataZoneEnergyDemand->CurDeadBandOrSetback(DualZoneNum)); // Tstat should show there is load on a dual SP EXPECT_EQ(2500.0, state->dataZoneEnergyDemand->ZoneSysEnergyDemand(DualZoneNum) .TotalOutputRequired); // TotalOutputRequired gets updated in CalcPredictedSystemLoad based on the load - SetPointTempSchedIndex = state->dataZoneCtrls->TempControlledZone(DualZoneNum).SchIndx_DualSetPointWDeadBandCool; - state->dataScheduleMgr->Schedule(SetPointTempSchedIndex).CurrentValue = 25.0; + state->dataZoneCtrls->TempControlledZone(DualZoneNum).setpts[(int)HVAC::SetptType::DualHeatCool].coolSetptSched->currentVal = 25.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(DualZoneNum).TotalOutputRequired = 1000.0; // LoadToCoolingSetPoint = ( TempDepZnLd( ZoneNum ) * ( TempZoneThermostatSetPoint( ZoneNum ) ) - TempIndZnLd( ZoneNum ) ); state->dataZoneTempPredictorCorrector->zoneHeatBalance(DualZoneNum).tempDepLoad = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(DualZoneNum).TotalOutputRequired / - state->dataScheduleMgr->Schedule(SetPointTempSchedIndex).CurrentValue; + state->dataZoneCtrls->TempControlledZone(DualZoneNum).setpts[(int)HVAC::SetptType::DualHeatCool].coolSetptSched->currentVal; state->dataZoneTempPredictorCorrector->zoneHeatBalance(DualZoneNum).tempIndLoad = 3500.0; // results in a cooling load CalcZoneAirTempSetPoints(*state); state->dataZoneTempPredictorCorrector->zoneHeatBalance(DualZoneNum).calcPredictedSystemLoad(*state, 1.0, DualZoneNum); - EXPECT_EQ(25.0, state->dataHeatBalFanSys->TempZoneThermostatSetPoint(DualZoneNum)); + EXPECT_EQ(25.0, state->dataHeatBalFanSys->zoneTstatSetpts(DualZoneNum).setpt); EXPECT_FALSE(state->dataZoneEnergyDemand->CurDeadBandOrSetback(DualZoneNum)); // Tstat should show there is load on a dual SP EXPECT_EQ(-2500.0, state->dataZoneEnergyDemand->ZoneSysEnergyDemand(DualZoneNum).TotalOutputRequired); // should show a cooling load } @@ -797,6 +785,8 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_AdaptiveThermostat) ASSERT_TRUE(process_idf(idf_objects)); // Tstat should show if the idf is legel + state->init_state(*state); + int ZoneNum(4); int CoolZoneASHNum(1); int CoolZoneCENNum(2); @@ -937,6 +927,8 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_calcZoneOrSpaceSums_SurfCon // DATE WRITTEN: Jan 2017 // #5906 Adaptive convection resulting in extremely low zone temperature which causes fatal error + state->init_state(*state); + int ZoneNum = 1; // Zone number state->dataHeatBal->ZoneIntGain.allocate(ZoneNum); @@ -1055,6 +1047,7 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_EMSOverrideSetpointTest) // AUTHOR: L. Gu, FSEC // DATE WRITTEN: Jun. 2017 // #5870 EMS actuators for Zone Temperature Control not working + state->init_state(*state); state->dataZoneCtrls->NumTempControlledZones = 1; state->dataZoneCtrls->NumComfortControlledZones = 0; @@ -1067,14 +1060,12 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_EMSOverrideSetpointTest) state->dataHeatBalFanSys->TempControlType.allocate(1); state->dataHeatBalFanSys->TempControlTypeRpt.allocate(1); - state->dataHeatBalFanSys->TempZoneThermostatSetPoint.allocate(1); - state->dataHeatBalFanSys->ZoneThermostatSetPointLo.allocate(1); - state->dataHeatBalFanSys->ZoneThermostatSetPointHi.allocate(1); - state->dataHeatBalFanSys->TempControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->zoneTstatSetpts.allocate(1); + state->dataHeatBalFanSys->TempControlType(1) = HVAC::SetptType::DualHeatCool; OverrideAirSetPointsforEMSCntrl(*state); - EXPECT_EQ(23.0, state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1)); - EXPECT_EQ(26.0, state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1)); + EXPECT_EQ(23.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo); + EXPECT_EQ(26.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi); state->dataZoneCtrls->NumTempControlledZones = 0; state->dataZoneCtrls->NumComfortControlledZones = 1; @@ -1083,13 +1074,13 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_EMSOverrideSetpointTest) state->dataZoneCtrls->ComfortControlledZone(1).ActualZoneNum = 1; state->dataZoneCtrls->ComfortControlledZone(1).EMSOverrideHeatingSetPointOn = true; state->dataZoneCtrls->ComfortControlledZone(1).EMSOverrideCoolingSetPointOn = true; - state->dataHeatBalFanSys->ComfortControlType(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; + state->dataHeatBalFanSys->ComfortControlType(1) = HVAC::SetptType::DualHeatCool; state->dataZoneCtrls->ComfortControlledZone(1).EMSOverrideHeatingSetPointValue = 22; state->dataZoneCtrls->ComfortControlledZone(1).EMSOverrideCoolingSetPointValue = 25; OverrideAirSetPointsforEMSCntrl(*state); - EXPECT_EQ(22.0, state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1)); - EXPECT_EQ(25.0, state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1)); + EXPECT_EQ(22.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo); + EXPECT_EQ(25.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi); } TEST_F(EnergyPlusFixture, temperatureAndCountInSch_test) @@ -1133,9 +1124,10 @@ TEST_F(EnergyPlusFixture, temperatureAndCountInSch_test) ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->NumOfTimeStepInHour = 4; - state->dataGlobal->MinutesPerTimeStep = 15; + state->dataGlobal->TimeStepsInHour = 4; + state->dataGlobal->MinutesInTimeStep = 15; state->dataEnvrn->CurrentYearIsLeapYear = false; + state->init_state(*state); Real64 valueAtTime; int numDays; @@ -1143,52 +1135,52 @@ TEST_F(EnergyPlusFixture, temperatureAndCountInSch_test) constexpr int wednesday = 4; state->dataEnvrn->Latitude = 30.; // northern hemisphere - int sched1Index = GetScheduleIndex(*state, "SCHED1"); - std::tie(valueAtTime, numDays, monthAssumed) = temperatureAndCountInSch(*state, sched1Index, false, wednesday, 11); + auto *sched1 = Sched::GetSchedule(*state, "SCHED1"); + std::tie(valueAtTime, numDays, monthAssumed) = sched1->getValAndCountOnDay(*state, false, Sched::DayType::Wednesday, 11); EXPECT_EQ(20, valueAtTime); EXPECT_EQ(365, numDays); EXPECT_EQ("January", monthAssumed); // test month selected based on hemisphere and isSummer flag. - std::tie(valueAtTime, numDays, monthAssumed) = temperatureAndCountInSch(*state, sched1Index, true, wednesday, 11); + std::tie(valueAtTime, numDays, monthAssumed) = sched1->getValAndCountOnDay(*state, true, Sched::DayType::Wednesday, 11); EXPECT_EQ("July", monthAssumed); state->dataEnvrn->Latitude = -30.; // southern hemisphere - std::tie(valueAtTime, numDays, monthAssumed) = temperatureAndCountInSch(*state, sched1Index, false, wednesday, 11); + std::tie(valueAtTime, numDays, monthAssumed) = sched1->getValAndCountOnDay(*state, false, Sched::DayType::Wednesday, 11); EXPECT_EQ("July", monthAssumed); - std::tie(valueAtTime, numDays, monthAssumed) = temperatureAndCountInSch(*state, sched1Index, true, wednesday, 11); + std::tie(valueAtTime, numDays, monthAssumed) = sched1->getValAndCountOnDay(*state, true, Sched::DayType::Wednesday, 11); EXPECT_EQ("January", monthAssumed); state->dataEnvrn->Latitude = 30.; // northern hemisphere - int sched2Index = GetScheduleIndex(*state, "SCHED2"); - std::tie(valueAtTime, numDays, monthAssumed) = temperatureAndCountInSch(*state, sched2Index, false, wednesday, 11); + auto *sched2 = Sched::GetSchedule(*state, "SCHED2"); + std::tie(valueAtTime, numDays, monthAssumed) = sched2->getValAndCountOnDay(*state, false, Sched::DayType::Wednesday, 11); EXPECT_EQ(24, valueAtTime); EXPECT_EQ(31, numDays); EXPECT_EQ("January", monthAssumed); - std::tie(valueAtTime, numDays, monthAssumed) = temperatureAndCountInSch(*state, sched2Index, true, wednesday, 11); + std::tie(valueAtTime, numDays, monthAssumed) = sched2->getValAndCountOnDay(*state, true, Sched::DayType::Wednesday, 11); EXPECT_EQ(26, valueAtTime); EXPECT_EQ(334, numDays); EXPECT_EQ("July", monthAssumed); - int sched3Index = GetScheduleIndex(*state, "SCHED3"); - std::tie(valueAtTime, numDays, monthAssumed) = temperatureAndCountInSch(*state, sched3Index, false, wednesday, 11); + auto *sched3 = Sched::GetSchedule(*state, "SCHED3"); + std::tie(valueAtTime, numDays, monthAssumed) = sched3->getValAndCountOnDay(*state, false, Sched::DayType::Wednesday, 11); EXPECT_EQ(26, valueAtTime); EXPECT_EQ(365, numDays); EXPECT_EQ("January", monthAssumed); - std::tie(valueAtTime, numDays, monthAssumed) = temperatureAndCountInSch(*state, sched3Index, true, wednesday, 11); + std::tie(valueAtTime, numDays, monthAssumed) = sched3->getValAndCountOnDay(*state, true, Sched::DayType::Wednesday, 11); EXPECT_EQ(26, valueAtTime); EXPECT_EQ(365, numDays); EXPECT_EQ("July", monthAssumed); - std::tie(valueAtTime, numDays, monthAssumed) = temperatureAndCountInSch(*state, sched3Index, false, wednesday, 19); + std::tie(valueAtTime, numDays, monthAssumed) = sched3->getValAndCountOnDay(*state, false, Sched::DayType::Wednesday, 19); EXPECT_EQ(24, valueAtTime); EXPECT_EQ(31, numDays); @@ -1198,15 +1190,11 @@ TEST_F(EnergyPlusFixture, temperatureAndCountInSch_test) TEST_F(EnergyPlusFixture, SetPointWithCutoutDeltaT_test) { // On/Off thermostat - state->dataScheduleMgr->Schedule.allocate(3); - state->dataZoneCtrls->NumTempControlledZones = 1; // SingleHeatingSetPoint state->dataZoneCtrls->TempControlledZone.allocate(state->dataZoneCtrls->NumTempControlledZones); - state->dataHeatBalFanSys->TempZoneThermostatSetPoint.allocate(1); - state->dataHeatBalFanSys->ZoneThermostatSetPointLo.allocate(1); - state->dataHeatBalFanSys->ZoneThermostatSetPointHi.allocate(1); + state->dataHeatBalFanSys->zoneTstatSetpts.allocate(1); state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataZoneEnergyDemand->DeadBandOrSetback.allocate(1); state->dataHeatBal->Zone.allocate(1); @@ -1220,14 +1208,17 @@ TEST_F(EnergyPlusFixture, SetPointWithCutoutDeltaT_test) state->dataZoneCtrls->TempControlledZone(1).DeltaTCutSet = 2.0; state->dataZoneCtrls->TempControlledZone(1).ActualZoneNum = 1; - state->dataZoneCtrls->TempControlledZone(1).CTSchedIndex = 1; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1; + auto *setptTypeSched = state->dataZoneCtrls->TempControlledZone(1).setptTypeSched = Sched::AddScheduleConstant(*state, "SETPT TYPE-1"); + state->dataZoneCtrls->TempControlledZone(1).setptTypeSched->currentVal = (int)HVAC::SetptType::SingleHeat; state->dataHeatBalFanSys->TempControlType.allocate(1); state->dataHeatBalFanSys->TempControlTypeRpt.allocate(1); - state->dataZoneCtrls->TempControlledZone(1).SchIndx_SingleHeatSetPoint = 3; - state->dataZoneTempPredictorCorrector->SetPointSingleHeating.allocate(1); - state->dataZoneTempPredictorCorrector->SetPointSingleHeating(1).TempSchedIndex = 3; - state->dataScheduleMgr->Schedule(3).CurrentValue = 22.0; + auto *heatSetptSched = Sched::AddScheduleConstant(*state, "HEAT SETPT-1"); + auto *coolSetptSched = Sched::AddScheduleConstant(*state, "COOL SETPT-1"); + + state->dataZoneCtrls->TempControlledZone(1).setpts[(int)HVAC::SetptType::SingleHeat].heatSetptSched = heatSetptSched; + state->dataZoneTempPredictorCorrector->tempSetptScheds[(int)HVAC::SetptType::SingleHeat].allocate(1); + state->dataZoneTempPredictorCorrector->tempSetptScheds[(int)HVAC::SetptType::SingleHeat](1).heatSched = heatSetptSched; + heatSetptSched->currentVal = 22.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); state->dataZoneTempPredictorCorrector->spaceHeatBalance.allocate(1); auto &thisZoneHB = state->dataZoneTempPredictorCorrector->zoneHeatBalance(1); @@ -1241,60 +1232,62 @@ TEST_F(EnergyPlusFixture, SetPointWithCutoutDeltaT_test) CalcZoneAirTempSetPoints(*state); PredictSystemLoads(*state, false, false, 0.01); - EXPECT_EQ(24.0, state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1)); + EXPECT_EQ(24.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo); thisZoneHB.MAT = 23.0; thisZoneHB.T1 = thisZoneHB.MAT; state->dataZoneCtrls->TempControlledZone(1).HeatModeLast = true; CalcZoneAirTempSetPoints(*state); PredictSystemLoads(*state, false, false, 0.01); - EXPECT_EQ(22.0, state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1)); + EXPECT_EQ(22.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo); state->dataZoneCtrls->TempControlledZone(1).HeatModeLast = false; // SingleCoolingSetPoint - state->dataScheduleMgr->Schedule(1).CurrentValue = 2; - state->dataZoneCtrls->TempControlledZone(1).SchIndx_SingleCoolSetPoint = 3; - state->dataZoneTempPredictorCorrector->SetPointSingleCooling.allocate(1); - state->dataZoneTempPredictorCorrector->SetPointSingleCooling(1).TempSchedIndex = 3; - state->dataScheduleMgr->Schedule(3).CurrentValue = 26.0; + setptTypeSched->currentVal = (int)HVAC::SetptType::SingleCool; + state->dataZoneCtrls->TempControlledZone(1).setpts[(int)HVAC::SetptType::SingleCool].coolSetptSched = coolSetptSched; + state->dataZoneTempPredictorCorrector->tempSetptScheds[(int)HVAC::SetptType::SingleCool].allocate(1); + state->dataZoneTempPredictorCorrector->tempSetptScheds[(int)HVAC::SetptType::SingleCool](1).coolSched = coolSetptSched; + coolSetptSched->currentVal = 26.0; thisZoneHB.MAT = 25.0; thisZoneHB.T1 = thisZoneHB.MAT; state->dataZoneCtrls->TempControlledZone(1).CoolModeLast = true; CalcZoneAirTempSetPoints(*state); PredictSystemLoads(*state, false, false, 0.01); - EXPECT_EQ(26.0, state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1)); + EXPECT_EQ(26.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi); state->dataZoneCtrls->TempControlledZone(1).CoolModeLast = false; thisZoneHB.MAT = 27.0; thisZoneHB.T1 = thisZoneHB.MAT; CalcZoneAirTempSetPoints(*state); PredictSystemLoads(*state, false, false, 0.01); - EXPECT_EQ(24.0, state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1)); + EXPECT_EQ(24.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi); // SingleHeatCoolSetPoint - state->dataScheduleMgr->Schedule(1).CurrentValue = 3; - state->dataZoneCtrls->TempControlledZone(1).SchIndx_SingleHeatCoolSetPoint = 3; - state->dataZoneTempPredictorCorrector->SetPointSingleHeatCool.allocate(1); - state->dataZoneTempPredictorCorrector->SetPointSingleHeatCool(1).TempSchedIndex = 3; - state->dataScheduleMgr->Schedule(3).CurrentValue = 24.0; + setptTypeSched->currentVal = (int)HVAC::SetptType::SingleHeatCool; + state->dataZoneCtrls->TempControlledZone(1).setpts[(int)HVAC::SetptType::SingleHeatCool].heatSetptSched = heatSetptSched; + state->dataZoneCtrls->TempControlledZone(1).setpts[(int)HVAC::SetptType::SingleHeatCool].coolSetptSched = heatSetptSched; + state->dataZoneTempPredictorCorrector->tempSetptScheds[(int)HVAC::SetptType::SingleHeatCool].allocate(1); + state->dataZoneTempPredictorCorrector->tempSetptScheds[(int)HVAC::SetptType::SingleHeatCool](1).heatSched = heatSetptSched; + state->dataZoneTempPredictorCorrector->tempSetptScheds[(int)HVAC::SetptType::SingleHeatCool](1).coolSched = heatSetptSched; + heatSetptSched->currentVal = 24.0; thisZoneHB.MAT = 25.0; thisZoneHB.T1 = thisZoneHB.MAT; CalcZoneAirTempSetPoints(*state); PredictSystemLoads(*state, false, false, 0.01); - EXPECT_EQ(24.0, state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1)); - EXPECT_EQ(24.0, state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1)); - - // DualSetPointWithDeadBand : Adjust cooling setpoint - state->dataZoneTempPredictorCorrector->SetPointDualHeatCool.allocate(1); - state->dataScheduleMgr->Schedule(1).CurrentValue = 4; - state->dataZoneCtrls->TempControlledZone(1).SchIndx_DualSetPointWDeadBandHeat = 2; - state->dataZoneCtrls->TempControlledZone(1).SchIndx_DualSetPointWDeadBandCool = 3; - state->dataZoneTempPredictorCorrector->SetPointDualHeatCool(1).HeatTempSchedIndex = 2; - state->dataZoneTempPredictorCorrector->SetPointDualHeatCool(1).CoolTempSchedIndex = 3; - state->dataScheduleMgr->Schedule(2).CurrentValue = 22.0; - state->dataScheduleMgr->Schedule(3).CurrentValue = 26.0; + EXPECT_EQ(24.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo); + EXPECT_EQ(24.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi); + + // DualHeatCool : Adjust cooling setpoint + state->dataZoneTempPredictorCorrector->tempSetptScheds[(int)HVAC::SetptType::DualHeatCool].allocate(1); + setptTypeSched->currentVal = (int)HVAC::SetptType::DualHeatCool; + state->dataZoneCtrls->TempControlledZone(1).setpts[(int)HVAC::SetptType::DualHeatCool].heatSetptSched = heatSetptSched; + state->dataZoneCtrls->TempControlledZone(1).setpts[(int)HVAC::SetptType::DualHeatCool].coolSetptSched = coolSetptSched; + state->dataZoneTempPredictorCorrector->tempSetptScheds[(int)HVAC::SetptType::DualHeatCool](1).heatSched = heatSetptSched; + state->dataZoneTempPredictorCorrector->tempSetptScheds[(int)HVAC::SetptType::DualHeatCool](1).coolSched = coolSetptSched; + heatSetptSched->currentVal = 22.0; + coolSetptSched->currentVal = 26.0; thisZoneHB.MAT = 25.0; thisZoneHB.T1 = thisZoneHB.MAT; @@ -1302,38 +1295,36 @@ TEST_F(EnergyPlusFixture, SetPointWithCutoutDeltaT_test) state->dataZoneCtrls->TempControlledZone(1).HeatModeLast = true; CalcZoneAirTempSetPoints(*state); PredictSystemLoads(*state, false, false, 0.01); - EXPECT_EQ(22.0, state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1)); - EXPECT_EQ(26.0, state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1)); + EXPECT_EQ(22.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo); + EXPECT_EQ(26.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi); state->dataZoneCtrls->TempControlledZone(1).HeatModeLast = false; - // DualSetPointWithDeadBand : Adjust heating setpoint + // DualHeatCool : Adjust heating setpoint thisZoneHB.MAT = 21.0; thisZoneHB.T1 = thisZoneHB.MAT; CalcZoneAirTempSetPoints(*state); PredictSystemLoads(*state, false, false, 0.01); - EXPECT_EQ(24.0, state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1)); - EXPECT_EQ(26.0, state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1)); + EXPECT_EQ(24.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo); + EXPECT_EQ(26.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi); - // DualSetPointWithDeadBand : Adjust cooling setpoint + // DualHeatCool : Adjust cooling setpoint state->dataZoneCtrls->TempControlledZone(1).CoolModeLast = true; thisZoneHB.MAT = 27.0; thisZoneHB.T1 = thisZoneHB.MAT; CalcZoneAirTempSetPoints(*state); PredictSystemLoads(*state, false, false, 0.01); - EXPECT_EQ(22.0, state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1)); - EXPECT_EQ(24.0, state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1)); + EXPECT_EQ(22.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo); + EXPECT_EQ(24.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi); } TEST_F(EnergyPlusFixture, TempAtPrevTimeStepWithCutoutDeltaT_test) { - state->dataScheduleMgr->Schedule.allocate(3); + state->init_state(*state); state->dataZoneCtrls->NumTempControlledZones = 1; // SingleHeatingSetPoint state->dataZoneCtrls->TempControlledZone.allocate(state->dataZoneCtrls->NumTempControlledZones); - state->dataHeatBalFanSys->TempZoneThermostatSetPoint.allocate(1); - state->dataHeatBalFanSys->ZoneThermostatSetPointLo.allocate(1); - state->dataHeatBalFanSys->ZoneThermostatSetPointHi.allocate(1); + state->dataHeatBalFanSys->zoneTstatSetpts.allocate(1); state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataZoneEnergyDemand->DeadBandOrSetback.allocate(1); state->dataHeatBal->Zone.allocate(1); @@ -1347,14 +1338,20 @@ TEST_F(EnergyPlusFixture, TempAtPrevTimeStepWithCutoutDeltaT_test) state->dataZoneCtrls->TempControlledZone(1).DeltaTCutSet = 2.0; state->dataZoneCtrls->TempControlledZone(1).ActualZoneNum = 1; - state->dataZoneCtrls->TempControlledZone(1).CTSchedIndex = 1; - state->dataScheduleMgr->Schedule(1).CurrentValue = 1; + + auto *setptTypeSched = Sched::AddScheduleConstant(*state, "SETPT TYPE-1"); + state->dataZoneCtrls->TempControlledZone(1).setptTypeSched = setptTypeSched; + setptTypeSched->currentVal = (int)HVAC::SetptType::SingleHeat; + + auto *heatSetptSched = Sched::AddScheduleConstant(*state, "HEAT SETPT-1"); + auto *coolSetptSched = Sched::AddScheduleConstant(*state, "COOL SETPT-1"); + state->dataHeatBalFanSys->TempControlType.allocate(1); state->dataHeatBalFanSys->TempControlTypeRpt.allocate(1); - state->dataZoneCtrls->TempControlledZone(1).SchIndx_SingleHeatSetPoint = 3; - state->dataZoneTempPredictorCorrector->SetPointSingleHeating.allocate(1); - state->dataZoneTempPredictorCorrector->SetPointSingleHeating(1).TempSchedIndex = 3; - state->dataScheduleMgr->Schedule(3).CurrentValue = 22.0; + state->dataZoneCtrls->TempControlledZone(1).setpts[(int)HVAC::SetptType::SingleHeat].heatSetptSched = heatSetptSched; + state->dataZoneTempPredictorCorrector->tempSetptScheds[(int)HVAC::SetptType::SingleHeat].allocate(1); + state->dataZoneTempPredictorCorrector->tempSetptScheds[(int)HVAC::SetptType::SingleHeat](1).heatSched = heatSetptSched; + heatSetptSched->currentVal = 22.0; state->dataZoneTempPredictorCorrector->spaceHeatBalance.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); auto &thisZoneHB = state->dataZoneTempPredictorCorrector->zoneHeatBalance(1); @@ -1368,56 +1365,58 @@ TEST_F(EnergyPlusFixture, TempAtPrevTimeStepWithCutoutDeltaT_test) CalcZoneAirTempSetPoints(*state); PredictSystemLoads(*state, false, false, 0.01); - EXPECT_EQ(24.0, state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1)); + EXPECT_EQ(24.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo); state->dataZoneCtrls->TempControlledZone(1).HeatModeLastSave = true; CalcZoneAirTempSetPoints(*state); PredictSystemLoads(*state, true, false, 0.01); - EXPECT_EQ(22.0, state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1)); + EXPECT_EQ(22.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo); // SingleCoolingSetPoint - state->dataScheduleMgr->Schedule(1).CurrentValue = 2; - state->dataZoneCtrls->TempControlledZone(1).SchIndx_SingleCoolSetPoint = 3; - state->dataZoneTempPredictorCorrector->SetPointSingleCooling.allocate(1); - state->dataZoneTempPredictorCorrector->SetPointSingleCooling(1).TempSchedIndex = 3; - state->dataScheduleMgr->Schedule(3).CurrentValue = 26.0; + setptTypeSched->currentVal = (int)HVAC::SetptType::SingleCool; + state->dataZoneCtrls->TempControlledZone(1).setpts[(int)HVAC::SetptType::SingleCool].coolSetptSched = coolSetptSched; + state->dataZoneTempPredictorCorrector->tempSetptScheds[(int)HVAC::SetptType::SingleCool].allocate(1); + state->dataZoneTempPredictorCorrector->tempSetptScheds[(int)HVAC::SetptType::SingleCool](1).coolSched = coolSetptSched; + coolSetptSched->currentVal = 26.0; thisZoneHB.MAT = 25.0; thisZoneHB.XMPT = 27; state->dataZoneCtrls->TempControlledZone(1).CoolModeLast = true; CalcZoneAirTempSetPoints(*state); PredictSystemLoads(*state, false, false, 0.01); - EXPECT_EQ(26.0, state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1)); + EXPECT_EQ(26.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi); state->dataZoneCtrls->TempControlledZone(1).CoolModeLast = false; state->dataZoneCtrls->TempControlledZone(1).CoolModeLastSave = true; CalcZoneAirTempSetPoints(*state); PredictSystemLoads(*state, true, false, 0.01); - EXPECT_EQ(24.0, state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1)); + EXPECT_EQ(24.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi); // SingleHeatCoolSetPoint - state->dataScheduleMgr->Schedule(1).CurrentValue = 3; - state->dataZoneCtrls->TempControlledZone(1).SchIndx_SingleHeatCoolSetPoint = 3; - state->dataZoneTempPredictorCorrector->SetPointSingleHeatCool.allocate(1); - state->dataZoneTempPredictorCorrector->SetPointSingleHeatCool(1).TempSchedIndex = 3; - state->dataScheduleMgr->Schedule(3).CurrentValue = 24.0; + setptTypeSched->currentVal = (int)HVAC::SetptType::SingleHeatCool; + state->dataZoneCtrls->TempControlledZone(1).setpts[(int)HVAC::SetptType::SingleHeatCool].heatSetptSched = heatSetptSched; + state->dataZoneCtrls->TempControlledZone(1).setpts[(int)HVAC::SetptType::SingleHeatCool].coolSetptSched = heatSetptSched; + state->dataZoneTempPredictorCorrector->tempSetptScheds[(int)HVAC::SetptType::SingleHeatCool].allocate(1); + state->dataZoneTempPredictorCorrector->tempSetptScheds[(int)HVAC::SetptType::SingleHeatCool](1).heatSched = heatSetptSched; + state->dataZoneTempPredictorCorrector->tempSetptScheds[(int)HVAC::SetptType::SingleHeatCool](1).coolSched = heatSetptSched; + heatSetptSched->currentVal = 24.0; thisZoneHB.MAT = 25.0; thisZoneHB.XMPT = thisZoneHB.MAT; CalcZoneAirTempSetPoints(*state); PredictSystemLoads(*state, false, false, 0.01); - EXPECT_EQ(24.0, state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1)); - EXPECT_EQ(24.0, state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1)); - - // DualSetPointWithDeadBand : Adjust cooling setpoint - state->dataZoneTempPredictorCorrector->SetPointDualHeatCool.allocate(1); - state->dataScheduleMgr->Schedule(1).CurrentValue = 4; - state->dataZoneCtrls->TempControlledZone(1).SchIndx_DualSetPointWDeadBandHeat = 2; - state->dataZoneCtrls->TempControlledZone(1).SchIndx_DualSetPointWDeadBandCool = 3; - state->dataZoneTempPredictorCorrector->SetPointDualHeatCool(1).HeatTempSchedIndex = 2; - state->dataZoneTempPredictorCorrector->SetPointDualHeatCool(1).CoolTempSchedIndex = 3; - state->dataScheduleMgr->Schedule(2).CurrentValue = 22.0; - state->dataScheduleMgr->Schedule(3).CurrentValue = 26.0; + EXPECT_EQ(24.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo); + EXPECT_EQ(24.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi); + + // DualHeatCool : Adjust cooling setpoint + setptTypeSched->currentVal = (int)HVAC::SetptType::DualHeatCool; + state->dataZoneTempPredictorCorrector->tempSetptScheds[(int)HVAC::SetptType::DualHeatCool].allocate(1); + state->dataZoneCtrls->TempControlledZone(1).setpts[(int)HVAC::SetptType::DualHeatCool].heatSetptSched = heatSetptSched; + state->dataZoneCtrls->TempControlledZone(1).setpts[(int)HVAC::SetptType::DualHeatCool].coolSetptSched = coolSetptSched; + state->dataZoneTempPredictorCorrector->tempSetptScheds[(int)HVAC::SetptType::DualHeatCool](1).heatSched = heatSetptSched; + state->dataZoneTempPredictorCorrector->tempSetptScheds[(int)HVAC::SetptType::DualHeatCool](1).coolSched = coolSetptSched; + heatSetptSched->currentVal = 22.0; + coolSetptSched->currentVal = 26.0; thisZoneHB.MAT = 25.0; thisZoneHB.XMPT = 21.0; @@ -1425,28 +1424,30 @@ TEST_F(EnergyPlusFixture, TempAtPrevTimeStepWithCutoutDeltaT_test) state->dataZoneCtrls->TempControlledZone(1).HeatModeLast = true; CalcZoneAirTempSetPoints(*state); PredictSystemLoads(*state, false, false, 0.01); - EXPECT_EQ(22.0, state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1)); - EXPECT_EQ(26.0, state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1)); + EXPECT_EQ(22.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo); + EXPECT_EQ(26.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi); state->dataZoneCtrls->TempControlledZone(1).HeatModeLast = false; - // DualSetPointWithDeadBand : Adjust heating setpoint + // DualHeatCool : Adjust heating setpoint state->dataZoneCtrls->TempControlledZone(1).HeatModeLastSave = true; CalcZoneAirTempSetPoints(*state); PredictSystemLoads(*state, true, false, 0.01); - EXPECT_EQ(24.0, state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1)); - EXPECT_EQ(26.0, state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1)); + EXPECT_EQ(24.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo); + EXPECT_EQ(26.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi); - // DualSetPointWithDeadBand : Adjust cooling setpoint + // DualHeatCool : Adjust cooling setpoint state->dataZoneCtrls->TempControlledZone(1).CoolModeLastSave = true; thisZoneHB.XMPT = 27.0; CalcZoneAirTempSetPoints(*state); PredictSystemLoads(*state, true, false, 0.01); - EXPECT_EQ(22.0, state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1)); - EXPECT_EQ(24.0, state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1)); + EXPECT_EQ(22.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptLo); + EXPECT_EQ(24.0, state->dataHeatBalFanSys->zoneTstatSetpts(1).setptHi); } TEST_F(EnergyPlusFixture, ReportMoistLoadsZoneMultiplier_Test) { + state->init_state(*state); + int zoneNum = 1; state->dataZoneEnergyDemand->ZoneSysMoistureDemand.allocate(zoneNum); auto &thisZoneSysMoistureDemand = state->dataZoneEnergyDemand->ZoneSysMoistureDemand(zoneNum); @@ -1527,6 +1528,8 @@ TEST_F(EnergyPlusFixture, ReportMoistLoadsZoneMultiplier_Test) TEST_F(EnergyPlusFixture, ReportSensibleLoadsZoneMultiplier_Test) { + state->init_state(*state); + int zoneNum = 1; state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(zoneNum); auto &thisZoneSysEnergyDemand = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(zoneNum); @@ -1654,9 +1657,11 @@ TEST_F(EnergyPlusFixture, ReportSensibleLoadsZoneMultiplier_Test) TEST_F(EnergyPlusFixture, DownInterpolate4HistoryValues_Test) { - Real64 PriorTimeStep = 0.25; state->dataHVACGlobal->TimeStepSys = 0.125; - state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; + state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; + state->init_state(*state); + + Real64 PriorTimeStep = 0.25; Real64 myVarValue = 5.0; Real64 HistoryValue1 = 1.0; Real64 HistoryValue2 = 2.0; @@ -1699,6 +1704,7 @@ TEST_F(EnergyPlusFixture, DownInterpolate4HistoryValues_Test) TEST_F(EnergyPlusFixture, HybridModel_processInverseModelMultpHMTest) { + state->init_state(*state); // Test added for fix to GitHub Issue #10508 Real64 calcHMmult; Real64 calcHMsum = 0.0; @@ -1767,10 +1773,11 @@ TEST_F(EnergyPlusFixture, HybridModel_processInverseModelMultpHMTest) EXPECT_NEAR(calcHMavg, expectedHMavg, allowableTolerance); EXPECT_NE(state->dataZoneTempPredictorCorrector->zoneHeatBalance(numZones).hmThermalMassMultErrIndex, 0); // This is now set, won't be zero anymore - std::string const error_string = - delimited_string({" ** Warning ** Hybrid model thermal mass multiplier higher than the limit for Hybrid Zone", - " ** ~~~ ** This means that the ratio of the zone air heat capacity for the current time step to the", - " ** ~~~ ** zone air heat storage is higher than the maximum limit of 30.0."}); + std::string const error_string = delimited_string( + {format(" ** Warning ** Version: missing in IDF, processing for EnergyPlus version=\"{}\"", DataStringGlobals::MatchVersion), + " ** Warning ** Hybrid model thermal mass multiplier higher than the limit for Hybrid Zone", + " ** ~~~ ** This means that the ratio of the zone air heat capacity for the current time step to the", + " ** ~~~ ** zone air heat storage is higher than the maximum limit of 30.0."}); EXPECT_TRUE(compare_err_stream(error_string, true)); // Test 5: Repeat of Test 1--verifying that it won't impact the statistical variables. No error message. @@ -1789,11 +1796,9 @@ TEST_F(EnergyPlusFixture, HybridModel_processInverseModelMultpHMTest) TEST_F(EnergyPlusFixture, FillPredefinedTableOnThermostatSchedules_Test) { + state->init_state(*state); using namespace EnergyPlus::OutputReportPredefined; - state->dataScheduleMgr->Schedule.allocate(5); - state->dataScheduleMgr->ScheduleInputProcessed = true; - auto &orp = *state->dataOutRptPredefined; auto &dzc = *state->dataZoneCtrls; @@ -1804,49 +1809,30 @@ TEST_F(EnergyPlusFixture, FillPredefinedTableOnThermostatSchedules_Test) dzc.TempControlledZone(1).ZoneName = "zoneA"; dzc.TempControlledZone(1).Name = "stat A"; - dzc.TempControlledZone(1).ControlTypeSchedName = "control schedule A"; - dzc.TempControlledZone(1).NumControlTypes = 1; - dzc.TempControlledZone(1).ControlTypeEnum.allocate(dzc.TempControlledZone(1).NumControlTypes); - dzc.TempControlledZone(1).ControlTypeName.allocate(dzc.TempControlledZone(1).NumControlTypes); - dzc.TempControlledZone(1).ControlTypeEnum(1) = HVAC::ThermostatType::SingleHeating; - dzc.TempControlledZone(1).ControlTypeName(1) = "control A"; - dzc.TempControlledZone(1).SchIndx_SingleHeatSetPoint = 1; - state->dataScheduleMgr->Schedule(1).Name = "schA"; + + dzc.TempControlledZone(1).setptTypeSched = Sched::AddScheduleConstant(*state, "control schedule A"); + dzc.TempControlledZone(1).setpts[(int)HVAC::SetptType::SingleHeat].Name = "control A"; + dzc.TempControlledZone(1).setpts[(int)HVAC::SetptType::SingleHeat].heatSetptSched = Sched::AddScheduleConstant(*state, "SINGLEHEATSCH"); dzc.TempControlledZone(2).ZoneName = "zoneB"; dzc.TempControlledZone(2).Name = "stat B"; - dzc.TempControlledZone(2).ControlTypeSchedName = "control schedule B"; - dzc.TempControlledZone(2).NumControlTypes = 1; - dzc.TempControlledZone(2).ControlTypeEnum.allocate(dzc.TempControlledZone(1).NumControlTypes); - dzc.TempControlledZone(2).ControlTypeName.allocate(dzc.TempControlledZone(1).NumControlTypes); - dzc.TempControlledZone(2).ControlTypeEnum(1) = HVAC::ThermostatType::SingleCooling; - dzc.TempControlledZone(2).ControlTypeName(1) = "control B"; - dzc.TempControlledZone(2).SchIndx_SingleCoolSetPoint = 2; - state->dataScheduleMgr->Schedule(2).Name = "schB"; + dzc.TempControlledZone(2).setptTypeSched = Sched::AddScheduleConstant(*state, "control schedule B"); + dzc.TempControlledZone(2).setpts[(int)HVAC::SetptType::SingleCool].Name = "control B"; + dzc.TempControlledZone(2).setpts[(int)HVAC::SetptType::SingleCool].coolSetptSched = Sched::AddScheduleConstant(*state, "SINGLECOOLSCH"); dzc.TempControlledZone(3).ZoneName = "zoneC"; dzc.TempControlledZone(3).Name = "stat C"; - dzc.TempControlledZone(3).ControlTypeSchedName = "control schedule C"; - dzc.TempControlledZone(3).NumControlTypes = 1; - dzc.TempControlledZone(3).ControlTypeEnum.allocate(dzc.TempControlledZone(1).NumControlTypes); - dzc.TempControlledZone(3).ControlTypeName.allocate(dzc.TempControlledZone(1).NumControlTypes); - dzc.TempControlledZone(3).ControlTypeEnum(1) = HVAC::ThermostatType::SingleHeatCool; - dzc.TempControlledZone(3).ControlTypeName(1) = "control C"; - dzc.TempControlledZone(3).SchIndx_SingleHeatCoolSetPoint = 3; - state->dataScheduleMgr->Schedule(3).Name = "schC"; + dzc.TempControlledZone(3).setptTypeSched = Sched::AddScheduleConstant(*state, "control schedule C"); + dzc.TempControlledZone(3).setpts[(int)HVAC::SetptType::SingleHeatCool].Name = "control C"; + dzc.TempControlledZone(3).setpts[(int)HVAC::SetptType::SingleHeatCool].heatSetptSched = Sched::AddScheduleConstant(*state, "SINGLEHEATCOOLSCH"); + dzc.TempControlledZone(3).setpts[(int)HVAC::SetptType::SingleHeatCool].coolSetptSched = Sched::GetSchedule(*state, "SINGLEHEATCOOLSCH"); dzc.TempControlledZone(4).ZoneName = "zoneD"; dzc.TempControlledZone(4).Name = "stat D"; - dzc.TempControlledZone(4).ControlTypeSchedName = "control schedule D"; - dzc.TempControlledZone(4).NumControlTypes = 1; - dzc.TempControlledZone(4).ControlTypeEnum.allocate(dzc.TempControlledZone(1).NumControlTypes); - dzc.TempControlledZone(4).ControlTypeName.allocate(dzc.TempControlledZone(1).NumControlTypes); - dzc.TempControlledZone(4).ControlTypeEnum(1) = HVAC::ThermostatType::DualSetPointWithDeadBand; - dzc.TempControlledZone(4).ControlTypeName(1) = "control D"; - dzc.TempControlledZone(4).SchIndx_DualSetPointWDeadBandHeat = 4; - dzc.TempControlledZone(4).SchIndx_DualSetPointWDeadBandCool = 5; - state->dataScheduleMgr->Schedule(4).Name = "schD"; - state->dataScheduleMgr->Schedule(5).Name = "schE"; + dzc.TempControlledZone(4).setptTypeSched = Sched::AddScheduleConstant(*state, "control schedule D"); + dzc.TempControlledZone(4).setpts[(int)HVAC::SetptType::DualHeatCool].Name = "control D"; + dzc.TempControlledZone(4).setpts[(int)HVAC::SetptType::DualHeatCool].heatSetptSched = Sched::AddScheduleConstant(*state, "DUALHEATCOOLHEATSCH"); + dzc.TempControlledZone(4).setpts[(int)HVAC::SetptType::DualHeatCool].coolSetptSched = Sched::AddScheduleConstant(*state, "DUALHEATCOOLCOOLSCH"); FillPredefinedTableOnThermostatSchedules(*state); @@ -1854,27 +1840,100 @@ TEST_F(EnergyPlusFixture, FillPredefinedTableOnThermostatSchedules_Test) EXPECT_EQ("control schedule A", RetrievePreDefTableEntry(*state, orp.pdchStatCtrlTypeSchd, "zoneA")); EXPECT_EQ("SingleHeating", RetrievePreDefTableEntry(*state, orp.pdchStatSchdType1, "zoneA")); EXPECT_EQ("control A", RetrievePreDefTableEntry(*state, orp.pdchStatSchdTypeName1, "zoneA")); - EXPECT_EQ("schA", RetrievePreDefTableEntry(*state, orp.pdchStatSchdCoolName, "zoneA")); - EXPECT_EQ("NOT FOUND", RetrievePreDefTableEntry(*state, orp.pdchStatSchdHeatName, "zoneA")); + EXPECT_EQ("SINGLEHEATSCH", RetrievePreDefTableEntry(*state, orp.pdchStatSchdHeatName, "zoneA")); + EXPECT_EQ("NOT FOUND", RetrievePreDefTableEntry(*state, orp.pdchStatSchdCoolName, "zoneA")); EXPECT_EQ("stat B", RetrievePreDefTableEntry(*state, orp.pdchStatName, "zoneB")); EXPECT_EQ("control schedule B", RetrievePreDefTableEntry(*state, orp.pdchStatCtrlTypeSchd, "zoneB")); EXPECT_EQ("SingleCooling", RetrievePreDefTableEntry(*state, orp.pdchStatSchdType1, "zoneB")); EXPECT_EQ("control B", RetrievePreDefTableEntry(*state, orp.pdchStatSchdTypeName1, "zoneB")); - EXPECT_EQ("NOT FOUND", RetrievePreDefTableEntry(*state, orp.pdchStatSchdCoolName, "zoneB")); - EXPECT_EQ("schB", RetrievePreDefTableEntry(*state, orp.pdchStatSchdHeatName, "zoneB")); + EXPECT_EQ("NOT FOUND", RetrievePreDefTableEntry(*state, orp.pdchStatSchdHeatName, "zoneB")); + EXPECT_EQ("SINGLECOOLSCH", RetrievePreDefTableEntry(*state, orp.pdchStatSchdCoolName, "zoneB")); EXPECT_EQ("stat C", RetrievePreDefTableEntry(*state, orp.pdchStatName, "zoneC")); EXPECT_EQ("control schedule C", RetrievePreDefTableEntry(*state, orp.pdchStatCtrlTypeSchd, "zoneC")); EXPECT_EQ("SingleHeatCool", RetrievePreDefTableEntry(*state, orp.pdchStatSchdType1, "zoneC")); EXPECT_EQ("control C", RetrievePreDefTableEntry(*state, orp.pdchStatSchdTypeName1, "zoneC")); - EXPECT_EQ("schC", RetrievePreDefTableEntry(*state, orp.pdchStatSchdCoolName, "zoneC")); - EXPECT_EQ("schC", RetrievePreDefTableEntry(*state, orp.pdchStatSchdHeatName, "zoneC")); + EXPECT_EQ("SINGLEHEATCOOLSCH", RetrievePreDefTableEntry(*state, orp.pdchStatSchdHeatName, "zoneC")); + EXPECT_EQ("SINGLEHEATCOOLSCH", RetrievePreDefTableEntry(*state, orp.pdchStatSchdCoolName, "zoneC")); EXPECT_EQ("stat D", RetrievePreDefTableEntry(*state, orp.pdchStatName, "zoneD")); EXPECT_EQ("control schedule D", RetrievePreDefTableEntry(*state, orp.pdchStatCtrlTypeSchd, "zoneD")); EXPECT_EQ("DualSetPointWithDeadBand", RetrievePreDefTableEntry(*state, orp.pdchStatSchdType1, "zoneD")); EXPECT_EQ("control D", RetrievePreDefTableEntry(*state, orp.pdchStatSchdTypeName1, "zoneD")); - EXPECT_EQ("schE", RetrievePreDefTableEntry(*state, orp.pdchStatSchdCoolName, "zoneD")); - EXPECT_EQ("schD", RetrievePreDefTableEntry(*state, orp.pdchStatSchdHeatName, "zoneD")); + EXPECT_EQ("DUALHEATCOOLHEATSCH", RetrievePreDefTableEntry(*state, orp.pdchStatSchdHeatName, "zoneD")); + EXPECT_EQ("DUALHEATCOOLCOOLSCH", RetrievePreDefTableEntry(*state, orp.pdchStatSchdCoolName, "zoneD")); +} + +#ifdef GET_OUT +TEST_F(EnergyPlusFixture, FillPredefinedTableOnThermostatSchedules_MultipleControls) +{ + using namespace EnergyPlus::OutputReportPredefined; + + auto &orp = *state->dataOutRptPredefined; + auto &dzc = *state->dataZoneCtrls; + + SetPredefinedTables(*state); + + constexpr int NumControlTypes = 4; + dzc.NumTempControlledZones = NumControlTypes; + dzc.TempControlledZone.allocate(dzc.NumTempControlledZones); + + // [1, 2, 3, 4] + std::vector order(NumControlTypes); + std::iota(order.begin(), order.end(), 1); + for (size_t i = 0; i < order.size(); ++i) { + char zoneLetter = char(int('A') + i); + // Simple left rotate: [2, 3, 4, 1], etc + std::rotate(order.begin(), std::next(order.begin()), order.end()); + auto &tcz = dzc.TempControlledZone(i + 1); + + const std::string ZoneName = fmt::format("ZONE {}", zoneLetter); + tcz.ZoneName = ZoneName; + tcz.Name = fmt::format("TSTAT {}", zoneLetter); + tcz.ControlTypeSchedName = state->dataScheduleMgr->Schedule(CTSchedIndex).Name; + tcz.CTSchedIndex = CTSchedIndex; + tcz.NumControlTypes = NumControlTypes; + tcz.ControlTypeEnum.allocate(NumControlTypes); + tcz.ControlTypeName.allocate(NumControlTypes); + + tcz.ControlTypeEnum(order.at(0)) = HVAC::ThermostatType::SingleHeating; + tcz.ControlTypeName(order.at(0)) = "SINGLEHEATING CTRL"; + tcz.SchIndx_SingleHeatSetPoint = SingleHeatingSchIndex; + + tcz.ControlTypeEnum(order.at(1)) = HVAC::ThermostatType::SingleCooling; + tcz.ControlTypeName(order.at(1)) = "SINGLECOOLING CTRL"; + tcz.SchIndx_SingleCoolSetPoint = SingleCoolingSchIndex; + + tcz.ControlTypeEnum(order.at(2)) = HVAC::ThermostatType::SingleHeatCool; + tcz.ControlTypeName(order.at(2)) = "SINGLEHEATCOOL CTRL"; + tcz.SchIndx_SingleHeatCoolSetPoint = SingleHeatCoolSchIndex; + + tcz.ControlTypeEnum(order.at(3)) = HVAC::ThermostatType::DualSetPointWithDeadBand; + tcz.ControlTypeName(order.at(3)) = "DUALSETPOINTWITHDEADBAND CTRL"; + tcz.SchIndx_DualSetPointWDeadBandHeat = DualSetPointWDeadBandHeatSchIndex; + tcz.SchIndx_DualSetPointWDeadBandCool = DualSetPointWDeadBandCoolSchIndex; + } + + FillPredefinedTableOnThermostatSchedules(*state); + + for (size_t i = 0; i < order.size(); ++i) { + char zoneLetter = char(int('A') + i); + const std::string ZoneName = fmt::format("ZONE {}", zoneLetter); + EXPECT_EQ(fmt::format("TSTAT {}", zoneLetter), RetrievePreDefTableEntry(*state, orp.pdchStatName, ZoneName)) << "Failed for " << ZoneName; + EXPECT_EQ("CONTROL SCHEDULE", RetrievePreDefTableEntry(*state, orp.pdchStatCtrlTypeSchd, ZoneName)) << "Failed for " << ZoneName; + EXPECT_EQ("DualSetPointWithDeadBand, SingleCooling, SingleHeatCool, SingleHeating", + RetrievePreDefTableEntry(*state, orp.pdchStatSchdType1, ZoneName)) + << "Failed for " << ZoneName; + EXPECT_EQ("DUALSETPOINTWITHDEADBAND CTRL, SINGLECOOLING CTRL, SINGLEHEATCOOL CTRL, SINGLEHEATING CTRL", + RetrievePreDefTableEntry(*state, orp.pdchStatSchdTypeName1, ZoneName)) + << "Failed for " << ZoneName; + EXPECT_EQ("DUALSETPOINTWDEADBANDHEATSCH, SINGLEHEATCOOLSCH, SINGLEHEATINGSCH", + RetrievePreDefTableEntry(*state, orp.pdchStatSchdHeatName, ZoneName)) + << "Failed for " << ZoneName; + EXPECT_EQ("DUALSETPOINTWDEADBANDCOOLSCH, SINGLECOOLINGSCH, SINGLEHEATCOOLSCH", + RetrievePreDefTableEntry(*state, orp.pdchStatSchdCoolName, ZoneName)) + << "Failed for " << ZoneName; + } } +#endif // GET_OUT diff --git a/tst/EnergyPlus/unit/api/datatransfer.unit.cc b/tst/EnergyPlus/unit/api/datatransfer.unit.cc index eb50d603fa9..497b3e193a9 100644 --- a/tst/EnergyPlus/unit/api/datatransfer.unit.cc +++ b/tst/EnergyPlus/unit/api/datatransfer.unit.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/tst/EnergyPlus/unit/main.cc b/tst/EnergyPlus/unit/main.cc index b46336bf040..d9a632d10e7 100644 --- a/tst/EnergyPlus/unit/main.cc +++ b/tst/EnergyPlus/unit/main.cc @@ -1,4 +1,4 @@ -// EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois, +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, // The Regents of the University of California, through Lawrence Berkeley National Laboratory // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other diff --git a/workflows/app_g_postprocess.py b/workflows/app_g_postprocess.py index 4fd8beaf751..36b06ce68bb 100644 --- a/workflows/app_g_postprocess.py +++ b/workflows/app_g_postprocess.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/workflows/calc_soil_surface_temp.py b/workflows/calc_soil_surface_temp.py index caca7e118b2..1d32f41cf4b 100644 --- a/workflows/calc_soil_surface_temp.py +++ b/workflows/calc_soil_surface_temp.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/workflows/coeff_check.py b/workflows/coeff_check.py index 80c0bac7162..30b37c2a058 100644 --- a/workflows/coeff_check.py +++ b/workflows/coeff_check.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/workflows/coeff_conv.py b/workflows/coeff_conv.py index 859c38bf57a..a544098ac2c 100644 --- a/workflows/coeff_conv.py +++ b/workflows/coeff_conv.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/workflows/convert_input_format.py b/workflows/convert_input_format.py index e8eeebe6d80..cadc018d8b6 100644 --- a/workflows/convert_input_format.py +++ b/workflows/convert_input_format.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/workflows/energyplus.py b/workflows/energyplus.py index 7bd0c8af647..3bf543dd202 100644 --- a/workflows/energyplus.py +++ b/workflows/energyplus.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT- diff --git a/workflows/transition.py b/workflows/transition.py index 5f4d0ac1373..ce9bd7ab93b 100644 --- a/workflows/transition.py +++ b/workflows/transition.py @@ -1,4 +1,4 @@ -# EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University +# EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University # of Illinois, The Regents of the University of California, through Lawrence # Berkeley National Laboratory (subject to receipt of any required approvals # from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT-